当前位置: 首页>>代码示例>>PHP>>正文


PHP Abs函数代码示例

本文整理汇总了PHP中Abs函数的典型用法代码示例。如果您正苦于以下问题:PHP Abs函数的具体用法?PHP Abs怎么用?PHP Abs使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了Abs函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: readfile

 /**
  * Читаем входные данные из файла
  * и записываем их в переменную класса data
  * @return null
  */
 private function readfile()
 {
     if (!is_file($this->path)) {
         echo 'Нет такого файла';
         return null;
     }
     $handle = fopen($this->path, "r");
     $this->data = [];
     if ($handle) {
         while (($buffer = fgets($handle, 4096)) !== false) {
             $dots = explode(' ', $buffer);
             foreach ($dots as $cord) {
                 $cord = (int) Abs($cord);
                 if ($cord < 1 || $cord > 10000) {
                     continue 2;
                 }
             }
             // Если 4 координаты
             if (count($dots) == 4) {
                 $this->data[] = [[$dots[0], $dots[1]], [$dots[2], $dots[3]]];
             }
         }
         fclose($handle);
     }
 }
开发者ID:Rochfort,项目名称:shcool,代码行数:30,代码来源:class.readata.php

示例2: Color_Shift

function Color_Shift($ColorA, $ColorB, $Shift)
{
    /****************************************************************************/
    $__args_types = array('integer');
    #-----------------------------------------------------------------------------
    $__args__ = Func_Get_Args();
    eval(FUNCTION_INIT);
    /****************************************************************************/
    $RGB1 = Color_RGB_Explode($ColorA);
    $RGB2 = Color_RGB_Explode($ColorB);
    #-----------------------------------------------------------------------------
    $R = $RGB1['R'] == $RGB2['R'] ? $RGB1['R'] : (int) (Abs($RGB2['R'] - $RGB1['R']) * ($RGB2['R'] > $RGB1['R'] ? $Shift : 100 - $Shift) / 100) + ($RGB2['R'] > $RGB1['R'] ? $RGB1['R'] : $RGB2['R']);
    $G = $RGB1['G'] == $RGB2['G'] ? $RGB1['G'] : (int) (Abs($RGB2['G'] - $RGB1['G']) * ($RGB2['G'] > $RGB1['G'] ? $Shift : 100 - $Shift) / 100) + ($RGB2['G'] > $RGB1['G'] ? $RGB1['G'] : $RGB2['G']);
    $B = $RGB1['B'] == $RGB2['B'] ? $RGB1['B'] : (int) (Abs($RGB2['B'] - $RGB1['B']) * ($RGB2['B'] > $RGB1['B'] ? $Shift : 100 - $Shift) / 100) + ($RGB2['B'] > $RGB1['B'] ? $RGB1['B'] : $RGB2['B']);
    #-----------------------------------------------------------------------------
    return Color_RGB_Implode($R, $G, $B);
}
开发者ID:carriercomm,项目名称:jbs,代码行数:17,代码来源:Color.php

示例3: print_customer_balances

function print_customer_balances()
{
    global $path_to_root, $systypes_array;
    $from = $_POST['PARAM_0'];
    $to = $_POST['PARAM_1'];
    $fromcust = $_POST['PARAM_2'];
    $show_balance = $_POST['PARAM_3'];
    $currency = $_POST['PARAM_4'];
    $no_zeros = $_POST['PARAM_5'];
    $comments = $_POST['PARAM_6'];
    $orientation = $_POST['PARAM_7'];
    $destination = $_POST['PARAM_8'];
    if ($destination) {
        include_once $path_to_root . "/reporting/includes/excel_report.inc";
    } else {
        include_once $path_to_root . "/reporting/includes/pdf_report.inc";
    }
    $orientation = $orientation ? 'L' : 'P';
    if ($fromcust == ALL_TEXT) {
        $cust = _('All');
    } else {
        $cust = get_customer_name($fromcust);
    }
    $dec = user_price_dec();
    if ($currency == ALL_TEXT) {
        $convert = true;
        $currency = _('Balances in Home Currency');
    } else {
        $convert = false;
    }
    if ($no_zeros) {
        $nozeros = _('Yes');
    } else {
        $nozeros = _('No');
    }
    $cols = array(0, 100, 130, 190, 250, 320, 385, 450, 515);
    $headers = array(_('Trans Type'), _('#'), _('Date'), _('Due Date'), _('Charges'), _('Credits'), _('Allocated'), _('Outstanding'));
    if ($show_balance) {
        $headers[7] = _('Balance');
    }
    $aligns = array('left', 'left', 'left', 'left', 'right', 'right', 'right', 'right');
    $params = array(0 => $comments, 1 => array('text' => _('Period'), 'from' => $from, 'to' => $to), 2 => array('text' => _('Customer'), 'from' => $cust, 'to' => ''), 3 => array('text' => _('Currency'), 'from' => $currency, 'to' => ''), 4 => array('text' => _('Suppress Zeros'), 'from' => $nozeros, 'to' => ''));
    $rep = new FrontReport(_('Customer Balances'), "CustomerBalances", user_pagesize(), 9, $orientation);
    if ($orientation == 'L') {
        recalculate_cols($cols);
    }
    $rep->Font();
    $rep->Info($params, $cols, $headers, $aligns);
    $rep->NewPage();
    $grandtotal = array(0, 0, 0, 0);
    $sql = "SELECT debtor_no, name, curr_code FROM " . TB_PREF . "debtors_master ";
    if ($fromcust != ALL_TEXT) {
        $sql .= "WHERE debtor_no=" . db_escape($fromcust);
    }
    $sql .= " ORDER BY name";
    $result = db_query($sql, "The customers could not be retrieved");
    while ($myrow = db_fetch($result)) {
        if (!$convert && $currency != $myrow['curr_code']) {
            continue;
        }
        $accumulate = 0;
        $rate = $convert ? get_exchange_rate_from_home_currency($myrow['curr_code'], Today()) : 1;
        $bal = get_open_balance($myrow['debtor_no'], $from, $convert);
        $init[0] = $init[1] = 0.0;
        $init[0] = round2(abs($bal['charges'] * $rate), $dec);
        $init[1] = round2(Abs($bal['credits'] * $rate), $dec);
        $init[2] = round2($bal['Allocated'] * $rate, $dec);
        if ($show_balance) {
            $init[3] = $init[0] - $init[1];
            $accumulate += $init[3];
        } else {
            $init[3] = round2($bal['OutStanding'] * $rate, $dec);
        }
        $res = get_transactions($myrow['debtor_no'], $from, $to);
        if ($no_zeros && db_num_rows($res) == 0) {
            continue;
        }
        $rep->fontSize += 2;
        $rep->TextCol(0, 2, $myrow['name']);
        if ($convert) {
            $rep->TextCol(2, 3, $myrow['curr_code']);
        }
        $rep->fontSize -= 2;
        $rep->TextCol(3, 4, _("Open Balance"));
        $rep->AmountCol(4, 5, $init[0], $dec);
        $rep->AmountCol(5, 6, $init[1], $dec);
        $rep->AmountCol(6, 7, $init[2], $dec);
        $rep->AmountCol(7, 8, $init[3], $dec);
        $total = array(0, 0, 0, 0);
        for ($i = 0; $i < 4; $i++) {
            $total[$i] += $init[$i];
            $grandtotal[$i] += $init[$i];
        }
        $rep->NewLine(1, 2);
        $rep->Line($rep->row + 4);
        if (db_num_rows($res) == 0) {
            $rep->NewLine(1, 2);
            continue;
        }
        while ($trans = db_fetch($res)) {
//.........这里部分代码省略.........
开发者ID:M-Shahbaz,项目名称:FA,代码行数:101,代码来源:rep101.php

示例4: mysql_connect

<?php

include 'data/config.php';
//Выдача формы, если нажата кнопка map_links
if (isset($_POST['map_links']) && isset($_POST['num_last_dors'])) {
    //Соединяемся с базой
    $cn = mysql_connect($db_host, $db_user, $db_pass) or die("Could not connect : " . mysql_error());
    mysql_query("SET NAMES cp1251");
    mysql_select_db($db_name, $cn) or die("Could not select database");
    //Получаем параметр
    $num_last_dors = $_POST["num_last_dors"];
    if (!is_numeric($num_last_dors)) {
        $num_last_dors = 10;
    } else {
        $num_last_dors = Abs(ceil(trim($num_last_dors)));
    }
    //Получаем массив  доров
    $result = mysql_query("SELECT `index_urls`, `map_urls` FROM `dors` ORDER BY `dor_date` DESC LIMIT 0, {$num_last_dors}");
    $index_urls = array();
    $map_urls = array();
    while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
        $index_st = explode('&', $row["index_urls"]);
        $map_st = explode('&', $row["map_urls"]);
        $index_urls = array_merge($index_urls, $index_st);
        $map_urls = array_merge($map_urls, $map_st);
    }
    mysql_free_result($result);
    mysql_close($cn);
    if (isset($index_urls) && count($index_urls)) {
        $index_str = implode("\n", $index_urls);
        $index_map_str = $index_str;
开发者ID:ivrm,项目名称:mbgdorgen,代码行数:31,代码来源:links.php

示例5: ConvertMinutes2Hours

 public function ConvertMinutes2Hours($Minutes)
 {
     if ($Minutes < 0) {
         $Min = Abs($Minutes);
     } else {
         $Min = $Minutes;
     }
     $iHours = Floor($Min / 60);
     $Minutes = ($Min - $iHours * 60) / 100;
     $tHours = $iHours + $Minutes;
     if ($Minutes < 0) {
         $tHours = $tHours * -1;
     }
     $aHours = explode(".", $tHours);
     $iHours = $aHours[0];
     if (empty($aHours[1])) {
         $aHours[1] = "00";
     }
     $Minutes = $aHours[1];
     if (strlen($Minutes) < 2) {
         $Minutes = $Minutes . "0";
     }
     $tHours = $iHours . ":" . $Minutes;
     return $tHours;
 }
开发者ID:ryanunderwood,项目名称:phpVMS,代码行数:25,代码来源:kACARS_Free.php

示例6: array

         }
         #-------------------------------------------------------------------------------
     }
     #-------------------------------------------------------------------------------
 }
 #-------------------------------------------------------------------------------
 #-------------------------------------------------------------------------------
 # перенос
 #-------------------------------------------------------------------------------
 $Deviation = $Schemes[$Key]['CostTransfer'] * (100 + $Settings['DomainPriceDeviationPercent']) / 100 - $Schemes[$Key]['CostTransfer'];
 #-------------------------------------------------------------------------------
 if ($Deviation < $Settings['DomainPriceDeviationSumm']) {
     $Deviation = $Settings['DomainPriceDeviationSumm'];
 }
 #-------------------------------------------------------------------------------
 if (Abs($Schemes[$Key]['CostTransfer'] - $NewPriceTransfer) > $Deviation) {
     #-------------------------------------------------------------------------------
     # прописываем новую цену в базе данных
     $IsUpdate = DB_Update('DomainSchemes', array('CostTransfer' => $NewPriceTransfer), array('ID' => $Schemes[$Key]['ID']));
     if (Is_Error($IsUpdate)) {
         return ERROR | @Trigger_Error(500);
     }
     #-------------------------------------------------------------------------------
     $Message = SPrintF('%s/%s: цена переноса изменена %s->%s', $Registrator['Params']['Name'], $Key, IntVal($Schemes[$Key]['CostTransfer']), $NewPriceTransfer);
     #-------------------------------------------------------------------------------
     Debug(SPrintF('[comp/Tasks/GC/DomainCheckPriceList]: %s', $Message));
     #-------------------------------------------------------------------------------
     if ($Settings['IsEvent'] && $Schemes[$Key]['IsActive']) {
         #-------------------------------------------------------------------------------
         $Event = array('Text' => $Message, 'PriorityID' => 'Notice', 'IsReaded' => FALSE);
         $Event = Comp_Load('Events/EventInsert', $Event);
开发者ID:carriercomm,项目名称:jbs,代码行数:31,代码来源:DomainCheckPriceList.comp.php

示例7: sin

        $y2 = ($radius - 6) * sin($angle_to_use);
    } else {
        $x1 = (-$radius + $dist_from_diameter2c) * cos($angle_to_use);
        $y1 = ($radius - $dist_from_diameter2c) * sin($angle_to_use);
        $x2 = (-$radius + 6) * cos($angle_to_use);
        $y2 = ($radius - 6) * sin($angle_to_use);
    }
    imageline($im, $x1 + $center_pt, $y1 + $center_pt, $x2 + $center_pt, $y2 + $center_pt, $black);
    $flag = !$flag;
}
// ------------------------------------------
// draw in the aspect lines
for ($i = 0; $i <= $last_planet_num; $i++) {
    for ($j = 0; $j <= $last_planet_num; $j++) {
        $q = 0;
        $da = Abs($longitude1[$sort_pos1[$i]] - $longitude2[$sort_pos2[$j]]);
        if ($da > 180) {
            $da = 360 - $da;
        }
        // set orb - 8 if Sun or Moon, 6 if not Sun or Moon
        if ($sort_pos1[$i] == 0 or $sort_pos1[$i] == 1 or $sort_pos2[$j] == 0 or $sort_pos2[$j] == 1) {
            $orb = 8;
        } else {
            $orb = 6;
        }
        // is there an aspect within orb?
        if ($da <= $orb) {
            $q = 1;
        } elseif ($da <= 60 + $orb and $da >= 60 - $orb) {
            $q = 6;
        } elseif ($da <= 90 + $orb and $da >= 90 - $orb) {
开发者ID:pumi11,项目名称:astro,代码行数:31,代码来源:synastry_wheel.php

示例8: getPaginator

function getPaginator($sql, $limit_find, $page_number = 1)
{
    $rs = array();
    $rs['records'] = 0;
    $rs['pages'] = 0;
    if ($limit_find < 10) {
        $limit_find = 20;
    }
    if ($sql != '') {
        $records = _executeSql('select', array($sql), array('single'));
        if ($records > 0) {
            $rs['records'] = $records;
            $rs['pages'] = Ceil($records / $limit_find);
        }
    }
    if ($rs['records'] > 0) {
        // vypocet pocatecni a koncove stranky (snazime se vypsat vzdy 10 odkazu)
        $rs['start_page'] = $page_number - 5;
        $rs['end_page'] = $page_number + 5;
        // oprava nekorektnich hodnot (zaporne nebo prilis velke)
        if ($rs['start_page'] < 1) {
            $rs['end_page'] += Abs($rs['start_page']) + 1;
        }
        if ($rs['end_page'] > $rs['pages']) {
            $rs['start_page'] = $rs['start_page'] - ($rs['end_page'] - $rs['pages']);
            $rs['end_page'] = $rs['pages'];
        }
        if ($rs['start_page'] < 1) {
            $rs['start_page'] = 1;
        }
        for ($x = $rs['start_page']; $x <= $rs['end_page']; $x++) {
            $rs['view_pages'][] = $x;
        }
        if ($page_number > $rs['end_page']) {
            $rs['page_number'] = $rs['end_page'];
            setSessionMickaSearchPage($rs['page_number']);
        } else {
            $rs['page_number'] = $page_number;
        }
    }
    return $rs;
}
开发者ID:riskatlas,项目名称:micka,代码行数:42,代码来源:micka_lib.php

示例9: print_statements

function print_statements()
{
    global $path_to_root;
    include_once $path_to_root . "reporting/includes/pdf_report.inc";
    $customer = $_REQUEST['PARAM_0'];
    $currency = $_REQUEST['PARAM_1'];
    $bankaccount = $_REQUEST['PARAM_2'];
    $email = $_REQUEST['PARAM_3'];
    $comments = $_REQUEST['PARAM_4'];
    $dec = user_price_dec();
    $cols = array(4, 100, 130, 190, 250, 320, 385, 450, 515);
    //$headers in doctext.inc
    $aligns = array('left', 'left', 'left', 'left', 'right', 'right', 'right', 'right');
    $params = array('comments' => $comments, 'bankaccount' => $bankaccount);
    $baccount = get_bank_account($params['bankaccount']);
    $cur = get_company_pref('curr_default');
    $PastDueDays1 = get_company_pref('past_due_days');
    $PastDueDays2 = 2 * $PastDueDays1;
    if ($email == 0) {
        $rep = new FrontReport(tr('STATEMENT'), "StatementBulk.pdf", user_pagesize());
        $rep->currency = $cur;
        $rep->Font();
        $rep->Info($params, $cols, null, $aligns);
    }
    $sql = "SELECT debtor_no, name AS DebtorName, address, tax_id, email, curr_code, curdate() AS tran_date, payment_terms FROM debtors_master";
    if ($customer != reserved_words::get_all_numeric()) {
        $sql .= " WHERE debtor_no = {$customer}";
    } else {
        $sql .= " ORDER by name";
    }
    $result = db_query($sql, "The customers could not be retrieved");
    while ($myrow = db_fetch($result)) {
        $date = date('Y-m-d');
        $myrow['order_'] = "";
        $TransResult = getTransactions($myrow['debtor_no'], $date);
        if (db_num_rows($TransResult) == 0) {
            continue;
        }
        if ($email == 1) {
            $rep = new FrontReport("", "", user_pagesize());
            $rep->currency = $cur;
            $rep->Font();
            $rep->title = tr('STATEMENT');
            $rep->filename = "Statement" . $myrow['debtor_no'] . ".pdf";
            $rep->Info($params, $cols, null, $aligns);
        }
        $rep->Header2($myrow, null, null, $baccount, 12);
        $rep->NewLine();
        $linetype = true;
        $doctype = 12;
        if ($rep->currency != $myrow['curr_code']) {
            include $path_to_root . "reporting/includes/doctext2.inc";
        } else {
            include $path_to_root . "reporting/includes/doctext.inc";
        }
        $rep->fontSize += 2;
        $rep->TextCol(0, 8, $doc_Outstanding);
        $rep->fontSize -= 2;
        $rep->NewLine(2);
        while ($myrow2 = db_fetch($TransResult)) {
            $DisplayTotal = number_format2(Abs($myrow2["TotalAmount"]), $dec);
            $DisplayAlloc = number_format2($myrow2["Allocated"], $dec);
            if ($myrow2['type'] == 10) {
                $DisplayNet = number_format2($myrow2["TotalAmount"] - $myrow2["Allocated"], $dec);
            } else {
                $DisplayNet = number_format2($myrow2["TotalAmount"] + $myrow2["Allocated"], $dec);
            }
            $rep->TextCol(0, 1, $myrow2['type_name'], -2);
            $rep->TextCol(1, 2, $myrow2['reference'], -2);
            $rep->TextCol(2, 3, sql2date($myrow2['tran_date']), -2);
            if ($myrow2['type'] == 10) {
                $rep->TextCol(3, 4, sql2date($myrow2['due_date']), -2);
            }
            if ($myrow2['TotalAmount'] > 0.0) {
                $rep->TextCol(4, 5, $DisplayTotal, -2);
            } else {
                $rep->TextCol(5, 6, $DisplayTotal, -2);
            }
            $rep->TextCol(6, 7, $DisplayAlloc, -2);
            $rep->TextCol(7, 8, $DisplayNet, -2);
            $rep->NewLine();
            if ($rep->row < $rep->bottomMargin + 10 * $rep->lineHeight) {
                $rep->Header2($myrow, null, null, $baccount);
            }
        }
        $nowdue = "1-" . $PastDueDays1 . " " . $doc_Days;
        $pastdue1 = $PastDueDays1 + 1 . "-" . $PastDueDays2 . " " . $doc_Days;
        $pastdue2 = $doc_Over . " " . $PastDueDays2 . " " . $doc_Days;
        $CustomerRecord = get_customer_details($myrow['debtor_no']);
        $str = array($doc_Current, $nowdue, $pastdue1, $pastdue2, $doc_Total_Balance);
        $str2 = array(number_format2($CustomerRecord["Balance"] - $CustomerRecord["Due"], $dec), number_format2($CustomerRecord["Due"] - $CustomerRecord["Overdue1"], $dec), number_format2($CustomerRecord["Overdue1"] - $CustomerRecord["Overdue2"], $dec), number_format2($CustomerRecord["Overdue2"], $dec), number_format2($CustomerRecord["Balance"], $dec));
        $col = array($rep->cols[0], $rep->cols[0] + 110, $rep->cols[0] + 210, $rep->cols[0] + 310, $rep->cols[0] + 410, $rep->cols[0] + 510);
        $rep->row = $rep->bottomMargin + 8 * $rep->lineHeight;
        for ($i = 0; $i < 5; $i++) {
            $rep->TextWrap($col[$i], $rep->row, $col[$i + 1] - $col[$i], $str[$i], 'right');
        }
        $rep->NewLine();
        for ($i = 0; $i < 5; $i++) {
            $rep->TextWrap($col[$i], $rep->row, $col[$i + 1] - $col[$i], $str2[$i], 'right');
        }
//.........这里部分代码省略.........
开发者ID:ravenii,项目名称:guardocs,代码行数:101,代码来源:rep108.php

示例10: print_statements

function print_statements()
{
    global $path_to_root, $systypes_array;
    include_once $path_to_root . "/reporting/includes/pdf_report.inc";
    $from = date2sql($_POST['PARAM_0']);
    $to = date2sql($_POST['PARAM_1']);
    $customer = $_POST['PARAM_2'];
    $currency = $_POST['PARAM_3'];
    $email = $_POST['PARAM_4'];
    $comments = $_POST['PARAM_5'];
    $orientation = $_POST['PARAM_6'];
    $orientation = $orientation ? 'L' : 'P';
    $dec = user_price_dec();
    $cols = array(4, 64, 180, 250, 320, 385, 450, 515);
    //$headers in doctext.inc
    $aligns = array('left', 'left', 'left', 'left', 'right', 'right', 'right', 'right');
    $params = array('comments' => $comments);
    $cur = get_company_pref('curr_default');
    $PastDueDays1 = get_company_pref('past_due_days');
    $PastDueDays2 = 2 * $PastDueDays1;
    if ($email == 0) {
        $rep = new FrontReport(_('CUSTOMER ACCOUNT STATEMENT'), "StatementBulk", user_pagesize(), 9, $orientation);
    }
    if ($orientation == 'L') {
        recalculate_cols($cols);
    }
    $sql = "SELECT b.debtor_no, b.name AS DebtorName, b.address, b.tax_id, b.curr_code, curdate() AS tran_date, CONCAT (d.name, d.name2) AS contactPerson, d.phone, d.phone2  FROM " . TB_PREF . "debtors_master b INNER JOIN\n" . TB_PREF . "crm_contacts c on b.debtor_no=c.entity_id INNER JOIN " . TB_PREF . "crm_persons d on c.person_id=d.id";
    if ($customer != ALL_TEXT) {
        $sql .= " WHERE b.debtor_no = " . db_escape($customer);
    } else {
        $sql .= " ORDER by b.name";
    }
    $result = db_query($sql, "The customers could not be retrieved");
    while ($debtor_row = db_fetch($result)) {
        $date = date('Y-m-d');
        if ($from != $to) {
            // find the latest point where the balance was null
            $start = findLatestNullDate($debtor_row['debtor_no'], $from);
            // but not earlier than the $to date.
            if (date1_greater_date2(sql2date($start), sql2date($to))) {
                $start = $to;
            }
            if (date1_greater_date2(sql2date($from), sql2date($start))) {
                $start = $from;
            }
        } else {
            $start = $from;
        }
        $debtor_row['order_'] = "";
        $TransResult = getTransactions($debtor_row['debtor_no'], $start, $date);
        $baccount = get_default_bank_account($debtor_row['curr_code']);
        $params['bankaccount'] = $baccount['id'];
        if (db_num_rows($TransResult) == 0) {
            continue;
        }
        if ($email == 1) {
            $rep = new FrontReport("CUSTOMER ACCOUNT STATEMENT", "", user_pagesize(), 9, $orientation);
            $rep->title = _('CUSTOMER ACCOUNT STATEMENT');
            $rep->filename = "Statement" . $debtor_row['debtor_no'] . ".pdf";
            $rep->Info($params, $cols, null, $aligns);
        }
        $rep->filename = "ST-" . strtr($debtor_row['DebtorName'], " '", "__") . "--" . strtr(Today(), "/", "-") . ".pdf";
        $contacts = get_customer_contacts($debtor_row['debtor_no'], 'invoice');
        $rep->SetHeaderType(0);
        $rep->currency = $cur;
        $rep->Font();
        $rep->Info(null, $cols, null, $aligns);
        //= get_branch_contacts($branch['branch_code'], 'invoice', $branch['debtor_no']);
        $rep->SetCommonData($debtor_row, null, null, $baccount, ST_STATEMENT, $contacts);
        $rep->NewPage();
        $doctype = ST_STATEMENT;
        /*
        		$rep->NewLine();
        		$rep->fontSize += 2;
        		$rep->TextCol(0, 7, _("Overdue"));
        		$rep->fontSize -= 2;
        		$rep->NewLine(2);
        */
        $rep->NewLine(10);
        $rep->TextCol(0, 5, $debtor_row['DebtorName']);
        $rep->NewLine();
        $rep->TextCol(0, 5, $debtor_row['contactPerson']);
        $rep->NewLine();
        $rep->TextCol(0, 5, $debtor_row['address']);
        $rep->NewLine();
        $rep->TextCol(0, 5, $debtor_row['phone'] . " " . $debtor_row['phone2']);
        $rep->NewLine(5);
        $current = false;
        $balance = getInitialBalance($debtor_row['debtor_no'], $start);
        if (true || Abs($balance) > 1.0E-6) {
            // Display initial balance
            //$rep->TextCol(1, 4, 'Balance Brought Forward');
            if (Abs($balance) < 1.0E-6) {
                $rep->SetTextColor(190, 190, 190);
            } else {
                if ($balance > 0) {
                    $rep->SetTextColor(190, 0, 0);
                }
            }
            //$rep->TextCol(6, 7,	number_format2(-$balance, $dec), -2);
//.........这里部分代码省略.........
开发者ID:knjy24,项目名称:FrontAccounting,代码行数:101,代码来源:rep_customer_account_statement.php

示例11: sin

        $y2 = ($radius - 6) * sin($angle_to_use);
    } else {
        $x1 = (-$radius + $dist_from_diameter2a) * cos($angle_to_use);
        $y1 = ($radius - $dist_from_diameter2a) * sin($angle_to_use);
        $x2 = (-$radius + 6) * cos($angle_to_use);
        $y2 = ($radius - 6) * sin($angle_to_use);
    }
    imageline($im, $x1 + $center_pt, $y1 + $center_pt, $x2 + $center_pt, $y2 + $center_pt, $black);
    $flag = !$flag;
}
// ------------------------------------------
// draw in the aspect lines
for ($i = 0; $i <= $last_planet_num - 1; $i++) {
    for ($j = $i + 1; $j <= $last_planet_num; $j++) {
        $q = 0;
        $da = Abs($longitude[$sort_pos[$i]] - $longitude[$sort_pos[$j]]);
        if ($da > 180) {
            $da = 360 - $da;
        }
        // set orb - 8 if Sun or Moon, 6 if not Sun or Moon
        if ($sort_pos[$i] == 0 or $sort_pos[$i] == 1 or $sort_pos[$j] == 0 or $sort_pos[$j] == 1) {
            $orb = 8;
        } else {
            $orb = 6;
        }
        // is there an aspect within orb?
        if ($da <= $orb) {
            $q = 1;
        } elseif ($da <= 60 + $orb and $da >= 60 - $orb) {
            $q = 6;
        } elseif ($da <= 90 + $orb and $da >= 90 - $orb) {
开发者ID:pumi11,项目名称:astro,代码行数:31,代码来源:composite_wheel.php

示例12: elseif

<tr><td colspan="3" class="b">&nbsp;</td></tr>
</table></form><br><br><br>';
    echo $form;
    include 'data/d/footer.php';
} elseif (isset($_POST['maps']) && isset($_POST['dors']) && isset($_POST['min_links'])) {
    //Соединяемся с базой
    $cn = mysql_connect($db_host, $db_user, $db_pass) or die("Could not connect : " . mysql_error());
    mysql_query("SET NAMES cp1251");
    mysql_select_db($db_name, $cn) or die("Could not select database");
    //Получаем параметры
    $sel_dors = $_POST['dors'];
    $min_links = $_POST["min_links"];
    if (!is_numeric($min_links)) {
        $min_links = 100;
    } else {
        $min_links = Abs(ceil(trim($min_links)));
    }
    $links_in_map = $min_links;
    $index_urls = array();
    foreach ($sel_dors as $dor_str) {
        $dor_par = explode('&', $dor_str);
        $id_dor = $dor_par[0];
        $domen = $dor_par[1];
        $result = mysql_query("SELECT `index_urls` FROM `dors` WHERE `id` = {$id_dor} LIMIT 1");
        while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
            $index_st = explode('&', $row["index_urls"]);
            $index_urls = array_merge($index_urls, $index_st);
        }
    }
    mysql_free_result($result);
    mysql_close($cn);
开发者ID:ivrm,项目名称:mbgdorgen,代码行数:31,代码来源:dors_archive.php

示例13: rotate

 public function rotate($rotate)
 {
     $RotSrc = $this->image;
     $width = imagesx($RotSrc);
     $height = imagesy($RotSrc);
     // - Zappo - Calculate correct rotated-image size...
     $theta = deg2rad($rotate);
     $CenterX = $width / 2;
     $CenterY = $height / 2;
     $XMin = $CenterX - 0.5 * ($width * Abs(cos($theta)) + $height * Abs(sin($theta)));
     $XMax = $CenterX + 0.5 * ($width * Abs(cos($theta)) + $height * Abs(sin($theta)));
     $YMin = $CenterY - 0.5 * ($width * Abs(sin($theta)) + $height * Abs(cos($theta)));
     $YMax = $CenterY + 0.5 * ($width * Abs(sin($theta)) + $height * Abs(cos($theta)));
     $newwidth = $XMax - $XMin;
     $newheight = $YMax - $YMin;
     $this->image = imagecreatetruecolor($newwidth, $newheight);
     $color = imagecolorallocate($this->image, 255, 255, 255);
     imagecolortransparent($this->image, $color);
     $this->image = imagerotate($RotSrc, $rotate, $color);
     imagealphablending($this->image, true);
     imagesavealpha($this->image, true);
     $this->transparent = true;
     $this->info['width'] = $newwidth;
     $this->info['height'] = $newheight;
     imagedestroy($RotSrc);
 }
开发者ID:AvanOsch,项目名称:ImagEngine,代码行数:26,代码来源:image.php

示例14: print_payment_report

function print_payment_report()
{
    global $path_to_root;
    include_once $path_to_root . "reporting/includes/pdf_report.inc";
    $to = $_REQUEST['PARAM_0'];
    $fromsupp = $_REQUEST['PARAM_1'];
    $currency = $_REQUEST['PARAM_2'];
    $comments = $_REQUEST['PARAM_3'];
    if ($fromsupp == reserved_words::get_all_numeric()) {
        $from = tr('All');
    } else {
        $from = get_supplier_name($fromsupp);
    }
    $dec = user_price_dec();
    if ($currency == reserved_words::get_all()) {
        $convert = true;
        $currency = tr('Balances in Home Currency');
    } else {
        $convert = false;
    }
    $cols = array(0, 100, 130, 190, 250, 320, 385, 450, 515);
    $headers = array(tr('Trans Type'), tr('#'), tr('Due Date'), '', '', '', tr('Total'), tr('Balance'));
    $aligns = array('left', 'left', 'left', 'left', 'right', 'right', 'right', 'right');
    $params = array(0 => $comments, 1 => array('text' => tr('End Date'), 'from' => $to, 'to' => ''), 2 => array('text' => tr('Supplier'), 'from' => $from, 'to' => ''), 3 => array('text' => tr('Currency'), 'from' => $currency, 'to' => ''));
    $rep = new FrontReport(tr('Payment Report'), "PaymentReport.pdf", user_pagesize());
    $rep->Font();
    $rep->Info($params, $cols, $headers, $aligns);
    $rep->Header();
    $total = array();
    $grandtotal = array(0, 0);
    $sql = "SELECT supplier_id, supp_name AS name, curr_code, payment_terms.terms FROM suppliers, payment_terms\n\t\tWHERE ";
    if ($fromsupp != reserved_words::get_all_numeric()) {
        $sql .= "supplier_id={$fromsupp} AND ";
    }
    $sql .= "suppliers.payment_terms = payment_terms.terms_indicator\n\t\tORDER BY supp_name";
    $result = db_query($sql, "The customers could not be retrieved");
    while ($myrow = db_fetch($result)) {
        if (!$convert && $currency != $myrow['curr_code']) {
            continue;
        }
        $rep->fontSize += 2;
        $rep->TextCol(0, 6, $myrow['name'] . " - " . $myrow['terms']);
        if ($convert) {
            $rate = get_exchange_rate_from_home_currency($myrow['curr_code'], $to);
            $rep->TextCol(6, 7, $myrow['curr_code']);
        } else {
            $rate = 1.0;
        }
        $rep->fontSize -= 2;
        $rep->NewLine(1, 2);
        $res = getTransactions($myrow['supplier_id'], $to);
        if (db_num_rows($res) == 0) {
            continue;
        }
        $rep->Line($rep->row + 4);
        $total[0] = $total[1] = 0.0;
        while ($trans = db_fetch($res)) {
            $rep->NewLine(1, 2);
            $rep->TextCol(0, 1, $trans['type_name']);
            $rep->TextCol(1, 2, $trans['supp_reference']);
            $rep->TextCol(2, 3, sql2date($trans['due_date']));
            $item[0] = Abs($trans['TranTotal']) * $rate;
            $rep->TextCol(6, 7, number_format2($item[0], $dec));
            $item[1] = $trans['Balance'] * $rate;
            $rep->TextCol(7, 8, number_format2($item[1], $dec));
            for ($i = 0; $i < 2; $i++) {
                $total[$i] += $item[$i];
                $grandtotal[$i] += $item[$i];
            }
        }
        $rep->Line($rep->row - 8);
        $rep->NewLine(2);
        $rep->TextCol(0, 3, tr('Total'));
        for ($i = 0; $i < 2; $i++) {
            $rep->TextCol($i + 6, $i + 7, number_format2($total[$i], $dec));
            $total[$i] = 0.0;
        }
        $rep->Line($rep->row - 4);
        $rep->NewLine(2);
    }
    $rep->fontSize += 2;
    $rep->TextCol(0, 3, tr('Grand Total'));
    $rep->fontSize -= 2;
    for ($i = 0; $i < 2; $i++) {
        $rep->TextCol($i + 6, $i + 7, number_format2($grandtotal[$i], $dec));
    }
    $rep->Line($rep->row - 4);
    $rep->End();
}
开发者ID:ravenii,项目名称:guardocs,代码行数:89,代码来源:rep203.php

示例15: m2h

 /**
  * m2h
  *
  * Minutes to Hours
  *
  * @param mixed $mins
  * @access public
  * @return void
  */
 public function m2h($mins)
 {
     /*{{{*/
     // return an empty string, if no minutes are given
     // (or the value is zero)
     if (empty($mins)) {
         return '';
     }
     if ($mins < 0) {
         $min = Abs($mins);
     } else {
         $min = $mins;
     }
     $H = Floor($min / 60);
     //$M = ($min - ($H * 60)) / 100;
     // set the part of an hour relative to 60, not to 100
     $M = ($min - $H * 60) / 60;
     $M = round($M, 2);
     $hours = $H + $M;
     if ($mins < 0) {
         $hours = $hours * -1;
     }
     $expl = explode(".", $hours);
     $H = $expl[0];
     if (empty($expl[1])) {
         $expl[1] = 00;
     }
     $M = $expl[1];
     if (strlen($M) < 2) {
         $M = $M . 0;
     }
     $hours = $H . "," . $M;
     return $hours;
 }
开发者ID:tiggr,项目名称:ke_troubletickets,代码行数:43,代码来源:class.tx_ketroubletickets_lib.php


注:本文中的Abs函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。