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


PHP floatcmp函数代码示例

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


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

示例1: floatsort

function floatsort($a, $b)
{
    if (floatgtr($a[0], $b[0])) {
        return 1;
    }
    if (floatcmp($a[0], $b[0])) {
        return 0;
    }
    return -1;
}
开发者ID:ronniebrito,项目名称:moodle_moviemasher,代码行数:10,代码来源:floatlibs.php

示例2: alloc_link

function alloc_link($row)
{
    $link = pager_link(_("Allocation"), "/sales/allocations/customer_allocate.php?trans_no=" . $row["trans_no"] . "&trans_type=" . $row["type"] . "&debtor_no=" . $row["debtor_no"], ICON_ALLOC);
    if ($row["type"] == ST_CUSTCREDIT && $row['TotalAmount'] > 0) {
        /*its a credit note which could have an allocation */
        return $link;
    } elseif (($row["type"] == ST_CUSTPAYMENT || $row["type"] == ST_BANKDEPOSIT) && floatcmp($row['TotalAmount'], $row['Allocated']) >= 0) {
        /*its a receipt  which could have an allocation*/
        return $link;
    } elseif ($row["type"] == ST_CUSTPAYMENT && $row['TotalAmount'] <= 0) {
        /*its a negative receipt */
        return '';
    } elseif ($row["type"] == ST_SALESINVOICE && $row['TotalAmount'] - $row['Allocated'] > 0) {
        return pager_link(_("Payment"), "/sales/customer_payments.php?customer_id=" . $row["debtor_no"] . "&SInvoice=" . $row["trans_no"], ICON_MONEY);
    }
}
开发者ID:knjy24,项目名称:FrontAccounting,代码行数:16,代码来源:customer_allocation_inquiry.php

示例3: check_trans

function check_trans()
{
    global $Refs;
    $input_error = 0;
    if ($_SESSION['pay_items']->count_gl_items() < 1) {
        display_error(_("You must enter at least one payment line."));
        set_focus('code_id');
        $input_error = 1;
    }
    if ($_SESSION['pay_items']->gl_items_total() == 0.0) {
        display_error(_("The total bank amount cannot be 0."));
        set_focus('code_id');
        $input_error = 1;
    }
    $limit = get_bank_account_limit($_POST['bank_account'], $_POST['date_']);
    $amnt_chg = -$_SESSION['pay_items']->gl_items_total() - $_SESSION['pay_items']->original_amount;
    if ($limit !== null && floatcmp($limit, -$amnt_chg) < 0) {
        display_error(sprintf(_("The total bank amount exceeds allowed limit (%s)."), price_format($limit - $_SESSION['pay_items']->original_amount)));
        set_focus('code_id');
        $input_error = 1;
    }
    if ($trans = check_bank_account_history($amnt_chg, $_POST['bank_account'], $_POST['date_'])) {
        display_error(sprintf(_("The bank transaction would result in exceed of authorized overdraft limit for transaction: %s #%s on %s."), $systypes_array[$trans['type']], $trans['trans_no'], sql2date($trans['trans_date'])));
        set_focus('amount');
        $input_error = 1;
    }
    if (!$Refs->is_valid($_POST['ref'])) {
        display_error(_("You must enter a reference."));
        set_focus('ref');
        $input_error = 1;
    } elseif ($_POST['ref'] != $_SESSION['pay_items']->reference && !is_new_reference($_POST['ref'], $_SESSION['pay_items']->trans_type)) {
        display_error(_("The entered reference is already in use."));
        set_focus('ref');
        $input_error = 1;
    }
    if (!is_date($_POST['date_'])) {
        display_error(_("The entered date for the payment is invalid."));
        set_focus('date_');
        $input_error = 1;
    } elseif (!is_date_in_fiscalyear($_POST['date_'])) {
        display_error(_("The entered date is not in fiscal year."));
        set_focus('date_');
        $input_error = 1;
    }
    if (get_post('PayType') == PT_CUSTOMER && (!get_post('person_id') || !get_post('PersonDetailID'))) {
        display_error(_("You have to select customer and customer branch."));
        set_focus('person_id');
        $input_error = 1;
    } elseif (get_post('PayType') == PT_SUPPLIER && !get_post('person_id')) {
        display_error(_("You have to select supplier."));
        set_focus('person_id');
        $input_error = 1;
    }
    if (!db_has_currency_rates(get_bank_account_currency($_POST['bank_account']), $_POST['date_'], true)) {
        $input_error = 1;
    }
    if (isset($_POST['settled_amount']) && in_array(get_post('PayType'), array(PT_SUPPLIER, PT_CUSTOMER)) && input_num('settled_amount') <= 0) {
        display_error(_("Settled amount have to be positive number."));
        set_focus('person_id');
        $input_error = 1;
    }
    return $input_error;
}
开发者ID:nativebandung,项目名称:frontaccounting,代码行数:63,代码来源:gl_bank.php

示例4: check_overdue

function check_overdue($row)
{
    return $row['OverDue'] == 1 && floatcmp($row["TotalAmount"], $row["Allocated"]) != 0;
}
开发者ID:nativebandung,项目名称:frontaccounting,代码行数:4,代码来源:customer_inquiry.php

示例5: check_valid_entries

function check_valid_entries()
{
    global $Refs;
    if (!is_date($_POST['DatePaid'])) {
        display_error(_("The entered date is invalid."));
        set_focus('DatePaid');
        return false;
    }
    if (!is_date_in_fiscalyear($_POST['DatePaid'])) {
        display_error(_("The entered date is not in fiscal year."));
        set_focus('DatePaid');
        return false;
    }
    if (!check_num('amount', 0)) {
        display_error(_("The entered amount is invalid or less than zero."));
        set_focus('amount');
        return false;
    }
    if (input_num('amount') == 0) {
        display_error(_("The total bank amount cannot be 0."));
        set_focus('amount');
        return false;
    }
    $limit = get_bank_account_limit($_POST['FromBankAccount'], $_POST['DatePaid']);
    $amnt_tr = input_num('charge') + input_num('amount');
    if ($limit !== null && floatcmp($limit, $amnt_tr) < 0) {
        display_error(sprintf(_("The total bank amount exceeds allowed limit (%s) for source account."), price_format($limit)));
        set_focus('amount');
        return false;
    }
    if ($trans = check_bank_account_history(-$amnt_tr, $_POST['FromBankAccount'], $_POST['DatePaid'])) {
        display_error(sprintf(_("The bank transaction would result in exceed of authorized overdraft limit for transaction: %s #%s on %s."), $systypes_array[$trans['type']], $trans['trans_no'], sql2date($trans['trans_date'])));
        set_focus('amount');
        $input_error = 1;
    }
    if (isset($_POST['charge']) && !check_num('charge', 0)) {
        display_error(_("The entered amount is invalid or less than zero."));
        set_focus('charge');
        return false;
    }
    if (isset($_POST['charge']) && input_num('charge') > 0 && get_company_pref('bank_charge_act') == '') {
        display_error(_("The Bank Charge Account has not been set in System and General GL Setup."));
        set_focus('charge');
        return false;
    }
    if (!$Refs->is_valid($_POST['ref'])) {
        display_error(_("You must enter a reference."));
        set_focus('ref');
        return false;
    }
    if (!is_new_reference($_POST['ref'], ST_BANKTRANSFER)) {
        display_error(_("The entered reference is already in use."));
        set_focus('ref');
        return false;
    }
    if ($_POST['FromBankAccount'] == $_POST['ToBankAccount']) {
        display_error(_("The source and destination bank accouts cannot be the same."));
        set_focus('ToBankAccount');
        return false;
    }
    if (isset($_POST['target_amount']) && !check_num('target_amount', 0)) {
        display_error(_("The entered amount is invalid or less than zero."));
        set_focus('target_amount');
        return false;
    }
    if (isset($_POST['target_amount']) && input_num('target_amount') == 0) {
        display_error(_("The incomming bank amount cannot be 0."));
        set_focus('target_amount');
        return false;
    }
    if (!db_has_currency_rates(get_bank_account_currency($_POST['FromBankAccount']), $_POST['DatePaid'])) {
        return false;
    }
    if (!db_has_currency_rates(get_bank_account_currency($_POST['ToBankAccount']), $_POST['DatePaid'])) {
        return false;
    }
    return true;
}
开发者ID:knjy24,项目名称:FrontAccounting,代码行数:78,代码来源:bank_transfer.php

示例6: check_inputs

function check_inputs()
{
    global $Refs;
    if (!get_post('supplier_id')) {
        display_error(_("There is no supplier selected."));
        set_focus('supplier_id');
        return false;
    }
    if (@$_POST['amount'] == "") {
        $_POST['amount'] = price_format(0);
    }
    if (!check_num('amount', 0)) {
        display_error(_("The entered amount is invalid or less than zero."));
        set_focus('amount');
        return false;
    }
    if (isset($_POST['charge']) && !check_num('charge', 0)) {
        display_error(_("The entered amount is invalid or less than zero."));
        set_focus('charge');
        return false;
    }
    if (isset($_POST['charge']) && input_num('charge') > 0) {
        $charge_acct = get_company_pref('bank_charge_act');
        if (get_gl_account($charge_acct) == false) {
            display_error(_("The Bank Charge Account has not been set in System and General GL Setup."));
            set_focus('charge');
            return false;
        }
    }
    if (@$_POST['discount'] == "") {
        $_POST['discount'] = 0;
    }
    if (!check_num('discount', 0)) {
        display_error(_("The entered discount is invalid or less than zero."));
        set_focus('amount');
        return false;
    }
    //if (input_num('amount') - input_num('discount') <= 0)
    if (input_num('amount') <= 0) {
        display_error(_("The total of the amount and the discount is zero or negative. Please enter positive values."));
        set_focus('amount');
        return false;
    }
    if (isset($_POST['bank_amount']) && input_num('bank_amount') <= 0) {
        display_error(_("The entered bank amount is zero or negative."));
        set_focus('bank_amount');
        return false;
    }
    if (!is_date($_POST['DatePaid'])) {
        display_error(_("The entered date is invalid."));
        set_focus('DatePaid');
        return false;
    } elseif (!is_date_in_fiscalyear($_POST['DatePaid'])) {
        display_error(_("The entered date is out of fiscal year or is closed for further data entry."));
        set_focus('DatePaid');
        return false;
    }
    $limit = get_bank_account_limit($_POST['bank_account'], $_POST['DatePaid']);
    if ($limit !== null && floatcmp($limit, input_num('amount')) < 0) {
        display_error(sprintf(_("The total bank amount exceeds allowed limit (%s)."), price_format($limit)));
        set_focus('amount');
        return false;
    }
    if (!$Refs->is_valid($_POST['ref'])) {
        display_error(_("You must enter a reference."));
        set_focus('ref');
        return false;
    }
    if (!is_new_reference($_POST['ref'], ST_SUPPAYMENT)) {
        display_error(_("The entered reference is already in use."));
        set_focus('ref');
        return false;
    }
    if (!db_has_currency_rates(get_supplier_currency($_POST['supplier_id']), $_POST['DatePaid'], true)) {
        return false;
    }
    $_SESSION['alloc']->amount = -input_num('amount');
    if (isset($_POST["TotalNumberOfAllocs"])) {
        return check_allocations();
    } else {
        return true;
    }
}
开发者ID:M-Shahbaz,项目名称:FA,代码行数:83,代码来源:supplier_payment.php

示例7: print_remittances

function print_remittances()
{
    global $path_to_root, $systypes_array;
    include_once $path_to_root . "/reporting/includes/pdf_report.inc";
    $from = $_POST['PARAM_0'];
    $to = $_POST['PARAM_1'];
    $currency = $_POST['PARAM_2'];
    $email = $_POST['PARAM_3'];
    $comments = $_POST['PARAM_4'];
    $orientation = $_POST['PARAM_5'];
    if (!$from || !$to) {
        return;
    }
    $orientation = $orientation ? 'L' : 'P';
    $dec = user_price_dec();
    $fno = explode("-", $from);
    $tno = explode("-", $to);
    $from = min($fno[0], $tno[0]);
    $to = max($fno[0], $tno[0]);
    $cols = array(4, 85, 150, 225, 275, 360, 450, 515);
    // $headers in doctext.inc
    $aligns = array('left', 'left', 'left', 'left', 'right', 'right', 'right');
    $params = array('comments' => $comments);
    $cur = get_company_Pref('curr_default');
    if ($email == 0) {
        $rep = new FrontReport(_('REMITTANCE'), "RemittanceBulk", user_pagesize(), 9, $orientation);
    }
    if ($orientation == 'L') {
        recalculate_cols($cols);
    }
    for ($i = $from; $i <= $to; $i++) {
        if ($fno[0] == $tno[0]) {
            $types = array($fno[1]);
        } else {
            $types = array(ST_BANKPAYMENT, ST_SUPPAYMENT, ST_SUPPCREDIT);
        }
        foreach ($types as $j) {
            $myrow = get_remittance($j, $i);
            if (!$myrow) {
                continue;
            }
            $res = get_bank_trans($j, $i);
            $baccount = db_fetch($res);
            $params['bankaccount'] = $baccount['bank_act'];
            if ($email == 1) {
                $rep = new FrontReport("", "", user_pagesize(), 9, $orientation);
                $rep->title = _('REMITTANCE');
                $rep->filename = "Remittance" . $i . ".pdf";
            }
            $rep->SetHeaderType('Header2');
            $rep->currency = $cur;
            $rep->Font();
            $rep->Info($params, $cols, null, $aligns);
            $contacts = get_supplier_contacts($myrow['supplier_id'], 'invoice');
            $rep->SetCommonData($myrow, null, $myrow, $baccount, ST_SUPPAYMENT, $contacts);
            $rep->NewPage();
            $result = get_allocations_for_remittance($myrow['supplier_id'], $myrow['type'], $myrow['trans_no']);
            $doctype = ST_SUPPAYMENT;
            $total_allocated = 0;
            $rep->TextCol(0, 4, _("As advance / full / part / payment towards:"), -2);
            $rep->NewLine(2);
            while ($myrow2 = db_fetch($result)) {
                $rep->TextCol(0, 1, $systypes_array[$myrow2['type']], -2);
                $rep->TextCol(1, 2, $myrow2['supp_reference'], -2);
                $rep->TextCol(2, 3, sql2date($myrow2['tran_date']), -2);
                $rep->TextCol(3, 4, sql2date($myrow2['due_date']), -2);
                $rep->AmountCol(4, 5, $myrow2['Total'], $dec, -2);
                $rep->AmountCol(5, 6, $myrow2['Total'] - $myrow2['alloc'], $dec, -2);
                $rep->AmountCol(6, 7, $myrow2['amt'], $dec, -2);
                $total_allocated += $myrow2['amt'];
                $rep->NewLine(1);
                if ($rep->row < $rep->bottomMargin + 15 * $rep->lineHeight) {
                    $rep->NewPage();
                }
            }
            $memo = get_comments_string($j, $i);
            if ($memo != "") {
                $rep->NewLine();
                $rep->TextColLines(1, 5, $memo, -2);
            }
            $rep->row = $rep->bottomMargin + 16 * $rep->lineHeight;
            $rep->TextCol(3, 6, _("Total Allocated"), -2);
            $rep->AmountCol(6, 7, $total_allocated, $dec, -2);
            $rep->NewLine();
            $rep->TextCol(3, 6, _("Left to Allocate"), -2);
            $myrow['Total'] *= -1;
            $myrow['ov_discount'] *= -1;
            $rep->AmountCol(6, 7, $myrow['Total'] + $myrow['ov_discount'] - $total_allocated, $dec, -2);
            if (floatcmp($myrow['ov_discount'], 0)) {
                $rep->NewLine();
                $rep->TextCol(3, 6, _("Discount"), -2);
                $rep->AmountCol(6, 7, -$myrow['ov_discount'], $dec, -2);
            }
            $rep->NewLine();
            $rep->Font('bold');
            $rep->TextCol(3, 6, _("TOTAL REMITTANCE"), -2);
            $rep->AmountCol(6, 7, $myrow['Total'], $dec, -2);
            $words = price_in_words($myrow['Total'], ST_SUPPAYMENT);
            if ($words != "") {
                $rep->NewLine(2);
//.........这里部分代码省略.........
开发者ID:knjy24,项目名称:FrontAccounting,代码行数:101,代码来源:rep210.php

示例8: print_aged_supplier_analysis


//.........这里部分代码省略.........
    $rep->Info($params, $cols, $headers, $aligns);
    $rep->NewPage();
    $total = array();
    $total[0] = $total[1] = $total[2] = $total[3] = $total[4] = 0.0;
    $PastDueDays1 = get_company_pref('past_due_days');
    $PastDueDays2 = 2 * $PastDueDays1;
    $nowdue = "1-" . $PastDueDays1 . " " . _('Days');
    $pastdue1 = $PastDueDays1 + 1 . "-" . $PastDueDays2 . " " . _('Days');
    $pastdue2 = _('Over') . " " . $PastDueDays2 . " " . _('Days');
    $sql = "SELECT supplier_id, supp_name AS name, curr_code FROM " . TB_PREF . "suppliers";
    if ($fromsupp != ALL_TEXT) {
        $sql .= " WHERE supplier_id=" . db_escape($fromsupp);
    }
    $sql .= " ORDER BY supp_name";
    $result = db_query($sql, "The suppliers could not be retrieved");
    while ($myrow = db_fetch($result)) {
        if (!$convert && $currency != $myrow['curr_code']) {
            continue;
        }
        if ($convert) {
            $rate = get_exchange_rate_from_home_currency($myrow['curr_code'], $to);
        } else {
            $rate = 1.0;
        }
        $supprec = get_supplier_details($myrow['supplier_id'], $to, $show_all);
        if (!$supprec) {
            continue;
        }
        $supprec['Balance'] *= $rate;
        $supprec['Due'] *= $rate;
        $supprec['Overdue1'] *= $rate;
        $supprec['Overdue2'] *= $rate;
        $str = array($supprec["Balance"] - $supprec["Due"], $supprec["Due"] - $supprec["Overdue1"], $supprec["Overdue1"] - $supprec["Overdue2"], $supprec["Overdue2"], $supprec["Balance"]);
        if ($no_zeros && floatcmp(array_sum($str), 0) == 0) {
            continue;
        }
        $rep->fontSize += 2;
        $rep->TextCol(0, 2, $myrow['name']);
        if ($convert) {
            $rep->TextCol(2, 3, $myrow['curr_code']);
        }
        $rep->fontSize -= 2;
        $total[0] += $supprec["Balance"] - $supprec["Due"];
        $total[1] += $supprec["Due"] - $supprec["Overdue1"];
        $total[2] += $supprec["Overdue1"] - $supprec["Overdue2"];
        $total[3] += $supprec["Overdue2"];
        $total[4] += $supprec["Balance"];
        for ($i = 0; $i < count($str); $i++) {
            $rep->AmountCol($i + 3, $i + 4, $str[$i], $dec);
        }
        $rep->NewLine(1, 2);
        if (!$summaryOnly) {
            $res = get_invoices($myrow['supplier_id'], $to, $show_all);
            if (db_num_rows($res) == 0) {
                continue;
            }
            $rep->Line($rep->row + 4);
            while ($trans = db_fetch($res)) {
                $rep->NewLine(1, 2);
                $rep->TextCol(0, 1, $systypes_array[$trans['type']], -2);
                $rep->TextCol(1, 2, $trans['reference'], -2);
                $rep->TextCol(2, 3, sql2date($trans['tran_date']), -2);
                foreach ($trans as $i => $value) {
                    $trans[$i] *= $rate;
                }
                $str = array($trans["Balance"] - $trans["Due"], $trans["Due"] - $trans["Overdue1"], $trans["Overdue1"] - $trans["Overdue2"], $trans["Overdue2"], $trans["Balance"]);
开发者ID:pthdnq,项目名称:ivalley-svn,代码行数:67,代码来源:rep202.php

示例9: __sortByStartTime

 function __sortByStartTime($a, $b)
 {
     if (floatgtr($a['start'], $b['start'])) {
         return 1;
     }
     if (floatcmp($a['start'], $b['start'])) {
         return 0;
     }
     return -1;
 }
开发者ID:ronniebrito,项目名称:moodle_moviemasher,代码行数:10,代码来源:Decoder.php

示例10: scale_switches

function scale_switches($orig_dims, $dims, $fill)
{
    $target_w = floatval($dims[0]);
    $target_h = floatval($dims[1]);
    $vf = '';
    $scale = 'scale=' . $target_w . ':' . $target_h;
    if ($fill && $fill != 'stretch') {
        $orig_even_w = floatval($orig_dims[0]);
        $orig_dims1 = floatval($orig_dims[1]);
        $extra0 = $orig_even_w % 2;
        $extra1 = $orig_dims1 % 2;
        $orig_even_w -= $extra0;
        $orig_dims1 -= $extra1;
        $ratio_w = $target_w / $orig_even_w;
        $ratio_h = $target_h / $orig_dims1;
        if (!floatcmp($ratio_w, $ratio_h)) {
            $multiplier = $fill == 'scale' ? floatmin($ratio_w, $ratio_h) : floatmax($ratio_w, $ratio_h);
            $scaled_w = round($target_w / $multiplier);
            $scaled_h = round($target_h / $multiplier);
            if (!floatcmp($orig_even_w, $scaled_w)) {
                if (floatgtr($orig_even_w, $scaled_w)) {
                    //$a['cropleft'] = $a['cropright'] = floor((($orig_even_w - $scaled_w) / 2));
                    $vf .= 'crop=' . floor(($orig_even_w - $scaled_w) / 2) . ':0:' . $scaled_w . ':' . $scaled_h;
                } else {
                    /*$pad_x = $pad_width = floor(($scaled_w -$orig_even_w) / 2);
                    			$pad_x -= $extra0;
                    			$dims[0] -= 2 * $pad_width;
                    			$dims[0] += $extra0;
                    			$dims[1] += $extra1;
                    		*/
                    $vf .= 'pad=' . $scaled_w . ':' . $scaled_h . ':' . (floor(($scaled_w - $orig_even_w) / 2) - $extra0) . ':0';
                }
            }
            if (!floatcmp($orig_dims1, $scaled_h)) {
                if (floatgtr($orig_dims1, $scaled_h)) {
                    $vf .= 'crop=0:' . floor(($orig_dims1 - $scaled_h) / 2) . ':' . $scaled_w . ':' . $scaled_h;
                } else {
                    /*
                    $pad_y = $pad_height = floor(($scaled_h - $orig_dims1) / 2);
                    $pad_y -= $extra1;
                    $dims[1] -= 2 * $pad_height;
                    $dims[1] += $extra1;
                    $dims[0] += $extra0;
                    */
                    $vf .= 'pad=' . $scaled_w . ':' . $scaled_h . ':0:' . (floor(($scaled_h - $orig_dims1) / 2) - $extra1);
                }
            }
        }
        //$a['s'] = $dims[0] . 'x' . $dims[1];
    }
    if ($vf) {
        $vf .= ',';
    }
    $vf .= $scale;
    $a = array();
    $a['vf'] = $vf;
    return $a;
}
开发者ID:ronniebrito,项目名称:moodle_moviemasher,代码行数:58,代码来源:cacheutils.php

示例11: print_customer_balances


//.........这里部分代码省略.........
        $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)) {
            if ($no_zeros && floatcmp($trans['TotalAmount'], $trans['Allocated']) == 0) {
                continue;
            }
            $rep->NewLine(1, 2);
            $rep->TextCol(0, 1, $systypes_array[$trans['type']]);
            $rep->TextCol(1, 2, $trans['reference']);
            $rep->DateCol(2, 3, $trans['tran_date'], true);
            if ($trans['type'] == ST_SALESINVOICE) {
                $rep->DateCol(3, 4, $trans['due_date'], true);
            }
            $item[0] = $item[1] = 0.0;
            if ($trans['type'] == ST_CUSTCREDIT || $trans['type'] == ST_CUSTPAYMENT || $trans['type'] == ST_BANKDEPOSIT) {
                $trans['TotalAmount'] *= -1;
            }
            if ($trans['TotalAmount'] > 0.0) {
                $item[0] = round2(abs($trans['TotalAmount']) * $rate, $dec);
                $rep->AmountCol(4, 5, $item[0], $dec);
                $accumulate += $item[0];
            } else {
                $item[1] = round2(Abs($trans['TotalAmount']) * $rate, $dec);
                $rep->AmountCol(5, 6, $item[1], $dec);
                $accumulate -= $item[1];
            }
            $item[2] = round2($trans['Allocated'] * $rate, $dec);
            $rep->AmountCol(6, 7, $item[2], $dec);
            if ($trans['type'] == ST_SALESINVOICE || $trans['type'] == ST_BANKPAYMENT) {
                $item[3] = $item[0] + $item[1] - $item[2];
            } else {
                $item[3] = $item[0] - $item[1] + $item[2];
            }
            if ($show_balance) {
                $rep->AmountCol(7, 8, $accumulate, $dec);
            } else {
                $rep->AmountCol(7, 8, $item[3], $dec);
            }
            for ($i = 0; $i < 4; $i++) {
                $total[$i] += $item[$i];
                $grandtotal[$i] += $item[$i];
            }
            if ($show_balance) {
                $total[3] = $total[0] - $total[1];
            }
        }
        $rep->Line($rep->row - 8);
        $rep->NewLine(2);
        $rep->TextCol(0, 3, _('Total'));
        for ($i = 0; $i < 4; $i++) {
            $rep->AmountCol($i + 4, $i + 5, $total[$i], $dec);
        }
        $rep->Line($rep->row - 4);
        $rep->NewLine(2);
    }
    $rep->fontSize += 2;
    $rep->TextCol(0, 3, _('Grand Total'));
    $rep->fontSize -= 2;
    if ($show_balance) {
        $grandtotal[3] = $grandtotal[0] - $grandtotal[1];
    }
    for ($i = 0; $i < 4; $i++) {
        $rep->AmountCol($i + 4, $i + 5, $grandtotal[$i], $dec);
    }
    $rep->Line($rep->row - 4);
    $rep->NewLine();
    $rep->End();
}
开发者ID:M-Shahbaz,项目名称:FA,代码行数:101,代码来源:rep101.php


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