本文整理汇总了PHP中number_format2函数的典型用法代码示例。如果您正苦于以下问题:PHP number_format2函数的具体用法?PHP number_format2怎么用?PHP number_format2使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了number_format2函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: print_list_of_journal_entries
function print_list_of_journal_entries()
{
global $path_to_root;
include_once $path_to_root . "reporting/includes/pdf_report.inc";
$from = $_REQUEST['PARAM_0'];
$to = $_REQUEST['PARAM_1'];
$systype = $_REQUEST['PARAM_2'];
$comments = $_REQUEST['PARAM_3'];
$dec = user_price_dec();
$cols = array(0, 100, 240, 300, 400, 460, 520, 580);
$headers = array(tr('Type/Account'), tr('Account Name'), tr('Date/Dim.'), tr('Person/Item/Memo'), tr('Debit'), tr('Credit'));
$aligns = array('left', 'left', 'left', 'left', 'right', 'right');
$params = array(0 => $comments, 1 => array('text' => tr('Period'), 'from' => $from, 'to' => $to), 2 => array('text' => tr('Type'), 'from' => systypes::name($systype), 'to' => ''));
$rep = new FrontReport(tr('List of Journal Entries'), "JournalEntries.pdf", user_pagesize());
$rep->Font();
$rep->Info($params, $cols, $headers, $aligns);
$rep->Header();
if ($systype == -1) {
$systype = null;
}
$trans = get_gl_transactions($from, $to, -1, null, 0, $systype);
$typeno = 0;
while ($myrow = db_fetch($trans)) {
if ($typeno != $myrow['type_no']) {
if ($typeno != 0) {
$rep->Line($rep->row + 4);
$rep->NewLine();
}
$typeno = $myrow['type_no'];
$TransName = systypes::name($myrow['type']);
$rep->TextCol(0, 2, $TransName . " # " . $myrow['type_no']);
$rep->TextCol(2, 3, sql2date($myrow['tran_date']));
$coms = payment_person_types::person_name($myrow["person_type_id"], $myrow["person_id"]);
$memo = get_comments_string($myrow['type'], $myrow['type_no']);
if ($memo != '') {
$coms .= $coms != "" ? "/" : "" . $memo;
}
$rep->TextCol(3, 6, $coms);
$rep->NewLine(2);
}
$rep->TextCol(0, 1, $myrow['account']);
$rep->TextCol(1, 2, $myrow['account_name']);
$dim_str = get_dimension_string($myrow['dimension_id']);
$dim_str2 = get_dimension_string($myrow['dimension2_id']);
if ($dim_str2 != "") {
$dim_str .= "/" . $dim_str2;
}
$rep->TextCol(2, 3, $dim_str);
$rep->TextCol(3, 4, $myrow['memo_']);
if ($myrow['amount'] > 0.0) {
$rep->TextCol(4, 5, number_format2(abs($myrow['amount']), $dec));
} else {
$rep->TextCol(5, 6, number_format2(abs($myrow['amount']), $dec));
}
$rep->NewLine(1, 2);
}
$rep->Line($rep->row + 4);
$rep->End();
}
示例2: print_Chart_of_Accounts
function print_Chart_of_Accounts()
{
global $path_to_root;
include_once $path_to_root . "reporting/includes/pdf_report.inc";
$showbalance = $_REQUEST['PARAM_0'];
$comments = $_REQUEST['PARAM_1'];
$dec = 0;
$cols = array(0, 50, 300, 425, 500);
$headers = array(tr('Account'), tr('Account Name'), tr('Account Code'), tr('Balance'));
$aligns = array('left', 'left', 'left', 'right');
$params = array(0 => $comments);
$rep = new FrontReport(tr('Chart of Accounts'), "ChartOfAccounts.pdf", user_pagesize());
$rep->Font();
$rep->Info($params, $cols, $headers, $aligns);
$rep->Header();
$classname = '';
$group = '';
$accounts = get_gl_accounts_all();
while ($account = db_fetch($accounts)) {
if ($showbalance == 1) {
$begin = begin_fiscalyear();
if (is_account_balancesheet($account["account_code"])) {
$begin = "";
}
$balance = get_gl_trans_from_to($begin, ToDay(), $account["account_code"], 0);
}
if ($account['AccountTypeName'] != $group) {
if ($classname != '') {
$rep->row -= 4;
}
if ($account['AccountClassName'] != $classname) {
$rep->Font('bold');
$rep->TextCol(0, 4, $account['AccountClassName']);
$rep->Font();
$rep->row -= $rep->lineHeight + 4;
}
$group = $account['AccountTypeName'];
$rep->TextCol(0, 4, $account['AccountTypeName']);
//$rep->Line($rep->row - 4);
$rep->row -= $rep->lineHeight + 4;
}
$classname = $account['AccountClassName'];
$rep->TextCol(0, 1, $account['account_code']);
$rep->TextCol(1, 2, $account['account_name']);
$rep->TextCol(2, 3, $account['account_code2']);
if ($showbalance == 1) {
$rep->TextCol(3, 4, number_format2($balance, $dec));
}
$rep->NewLine();
if ($rep->row < $rep->bottomMargin + 3 * $rep->lineHeight) {
$rep->Line($rep->row - 2);
$rep->Header();
}
}
$rep->Line($rep->row);
$rep->End();
}
示例3: render
function render($id, $title)
{
global $path_to_root;
include_once $path_to_root . "/reporting/includes/class.graphic.inc";
$begin = begin_fiscalyear();
$today = Today();
$begin1 = date2sql($begin);
$today1 = date2sql($today);
$sql = "SELECT SUM(amount) AS total, c.class_name, c.ctype FROM\n " . TB_PREF . "gl_trans," . TB_PREF . "chart_master AS a, " . TB_PREF . "chart_types AS t,\n " . TB_PREF . "chart_class AS c WHERE\n account = a.account_code AND a.account_type = t.id AND t.class_id = c.cid\n AND IF(c.ctype > 3, tran_date >= '{$begin1}', tran_date >= '0000-00-00')\n AND tran_date <= '{$today1}' ";
if ($this->data_filter != '') {
$sql .= ' AND ' . $this->data_filter;
}
$sql .= " GROUP BY c.cid ORDER BY c.cid";
$result = db_query($sql, "Transactions could not be calculated");
$calculated = _("Calculated Return");
if ($this->graph_type == 'Table') {
start_table(TABLESTYLE2, "width=98%");
$total = 0;
while ($myrow = db_fetch($result)) {
if ($myrow['ctype'] > 3) {
$total += $myrow['total'];
$myrow['total'] = -$myrow['total'];
}
label_row($myrow['class_name'], number_format2($myrow['total'], user_price_dec()), "class='label' style='font-weight:bold;'", "style='font-weight:bold;' align=right");
}
label_row(" ", "");
label_row($calculated, number_format2(-$total, user_price_dec()), "class='label' style='font-weight:bold;'", "style='font-weight:bold;' align=right");
end_table(1);
} else {
$pg = new graph();
$i = 0;
$total = 0;
while ($myrow = db_fetch($result)) {
if ($myrow['ctype'] > 3) {
$total += $myrow['total'];
$myrow['total'] = -$myrow['total'];
$pg->x[$i] = $myrow['class_name'];
$pg->y[$i] = abs($myrow['total']);
$i++;
}
}
$pg->x[$i] = $calculated;
$pg->y[$i] = -$total;
$pg->title = $title;
$pg->axis_x = _("Class");
$pg->axis_y = _("Amount");
$pg->graphic_1 = $today;
$pg->type = 5;
$pg->skin = 1;
$pg->built_in = false;
$filename = company_path() . "/pdf_files/" . uniqid("") . ".png";
$pg->display($filename, true);
echo "<img src='{$filename}' border='0' alt='{$title}' style='max-width:100%'>";
}
}
示例4: display_po_receive_items
function display_po_receive_items()
{
div_start('grn_items');
start_table(TABLESTYLE, "colspan=7 width='90%'");
$th = array(_("Item Code"), _("Description"), _("Ordered"), _("Units"), _("Received"), _("Outstanding"), _("This Delivery"), _("Price"), _("Total"));
table_header($th);
/*show the line items on the order with the quantity being received for modification */
$total = 0;
$k = 0;
//row colour counter
if (count($_SESSION['PO']->line_items) > 0) {
foreach ($_SESSION['PO']->line_items as $ln_itm) {
alt_table_row_color($k);
$qty_outstanding = $ln_itm->quantity - $ln_itm->qty_received;
if (!isset($_POST['Update']) && !isset($_POST['ProcessGoodsReceived']) && $ln_itm->receive_qty == 0) {
//If no quantites yet input default the balance to be received
$ln_itm->receive_qty = $qty_outstanding;
}
$line_total = $ln_itm->receive_qty * $ln_itm->price;
$total += $line_total;
label_cell($ln_itm->stock_id);
if ($qty_outstanding > 0) {
text_cells(null, $ln_itm->stock_id . "Desc", $ln_itm->item_description, 30, 50);
} else {
label_cell($ln_itm->item_description);
}
$dec = get_qty_dec($ln_itm->stock_id);
qty_cell($ln_itm->quantity, false, $dec);
label_cell($ln_itm->units);
qty_cell($ln_itm->qty_received, false, $dec);
qty_cell($qty_outstanding, false, $dec);
if ($qty_outstanding > 0) {
qty_cells(null, $ln_itm->line_no, number_format2($ln_itm->receive_qty, $dec), "align=right", null, $dec);
} else {
label_cell(number_format2($ln_itm->receive_qty, $dec), "align=right");
}
amount_decimal_cell($ln_itm->price);
amount_cell($line_total);
end_row();
}
}
$colspan = count($th) - 1;
$display_sub_total = price_format($total);
label_row(_("Sub-total"), $display_sub_total, "colspan={$colspan} align=right", "align=right");
$taxes = $_SESSION['PO']->get_taxes(input_num('freight_cost'), true);
$tax_total = display_edit_tax_items($taxes, $colspan, $_SESSION['PO']->tax_included);
$display_total = price_format($total + input_num('freight_cost') + $tax_total);
start_row();
label_cells(_("Amount Total"), $display_total, "colspan={$colspan} align='right'", "align='right'");
end_row();
end_table();
div_end();
}
示例5: display_po_receive_items
function display_po_receive_items()
{
global $table_style;
start_table("colspan=7 {$table_style} width=90%");
$th = array(tr("Item Code"), tr("Description"), tr("Ordered"), tr("Units"), tr("Received"), tr("Outstanding"), tr("This Delivery"), tr("Price"), tr("Total"));
table_header($th);
/*show the line items on the order with the quantity being received for modification */
$total = 0;
$k = 0;
//row colour counter
if (count($_SESSION['PO']->line_items) > 0) {
foreach ($_SESSION['PO']->line_items as $ln_itm) {
alt_table_row_color($k);
$qty_outstanding = $ln_itm->quantity - $ln_itm->qty_received;
if ($ln_itm->receive_qty == 0) {
//If no quantites yet input default the balance to be received
$ln_itm->receive_qty = $qty_outstanding;
}
$line_total = $ln_itm->receive_qty * $ln_itm->price;
$total += $line_total;
label_cell($ln_itm->stock_id);
if ($qty_outstanding > 0) {
text_cells(null, $ln_itm->stock_id . "Desc", $ln_itm->item_description, 30, 50);
} else {
label_cell($ln_itm->item_description);
}
qty_cell($ln_itm->quantity);
label_cell($ln_itm->units);
qty_cell($ln_itm->qty_received);
qty_cell($qty_outstanding);
if ($qty_outstanding > 0) {
qty_cells(null, $ln_itm->line_no, qty_format($ln_itm->receive_qty), "align=right");
} else {
qty_cells(null, $ln_itm->line_no, qty_format($ln_itm->receive_qty), "align=right", "disabled");
}
amount_cell($ln_itm->price);
amount_cell($line_total);
end_row();
}
}
$display_total = number_format2($total, user_price_dec());
label_row(tr("Total value of items received"), $display_total, "colspan=8 align=right", "nowrap align=right");
end_table();
}
示例6: display_rates
function display_rates($curr_code)
{
global $table_style;
$result = get_exchange_rates($curr_code);
br(2);
start_table($table_style);
$th = array(tr("Date to Use From"), tr("Exchange Rate"), "", "");
table_header($th);
$k = 0;
//row colour counter
while ($myrow = db_fetch($result)) {
alt_table_row_color($k);
label_cell(sql2date($myrow["date_"]));
label_cell(number_format2($myrow["rate_buy"], user_exrate_dec()), "nowrap align=right");
edit_link_cell("selected_id=" . $myrow["id"]);
delete_link_cell("selected_id=" . $myrow["id"] . "&delete=1");
end_row();
}
//END WHILE LIST LOOP
end_table();
}
示例7: print_bill_of_material
function print_bill_of_material()
{
global $path_to_root;
include_once $path_to_root . "reporting/includes/pdf_report.inc";
$frompart = $_REQUEST['PARAM_0'];
$topart = $_REQUEST['PARAM_1'];
$comments = $_REQUEST['PARAM_2'];
$dec = user_qty_dec();
$cols = array(0, 50, 305, 375, 445, 515);
$headers = array(tr('Component'), tr('Description'), tr('Loc'), tr('Wrk Ctr'), tr('Quantity'));
$aligns = array('left', 'left', 'left', 'left', 'right');
$params = array(0 => $comments, 1 => array('text' => tr('Component'), 'from' => $frompart, 'to' => $topart));
$rep = new FrontReport(tr('Bill of Material Listing'), "BillOfMaterial.pdf", user_pagesize());
$rep->Font();
$rep->Info($params, $cols, $headers, $aligns);
$rep->Header();
$res = getTransactions($frompart, $topart);
$parent = '';
while ($trans = db_fetch($res)) {
if ($parent != $trans['parent']) {
if ($parent != '') {
$rep->Line($rep->row - 2);
$rep->NewLine(2, 3);
}
$rep->TextCol(0, 1, $trans['parent']);
$desc = get_item($trans['parent']);
$rep->TextCol(1, 2, $desc['description']);
$parent = $trans['parent'];
$rep->NewLine();
}
$rep->NewLine();
$rep->TextCol(0, 1, $trans['component']);
$rep->TextCol(1, 2, $trans['CompDescription']);
$rep->TextCol(2, 3, $trans['loc_code']);
$rep->TextCol(3, 4, $trans['workcentre_added']);
$rep->TextCol(4, 5, number_format2($trans['quantity'], $dec));
}
$rep->Line($rep->row - 4);
$rep->End();
}
示例8: render
function render($id, $title)
{
$sql = 'SELECT * FROM (SELECT max(trans_date) `Week End`, ' . 'concat(cast(case when weekofyear(trans_date) = 1 and month(trans_date)=12 then year(trans_date) + 1 else year(trans_date) end as char),cast(weekofyear(trans_date) as char)) `Week No`, ' . 'sum(case when weekday(trans_date)=0 then gross_output else 0 end) Monday, ' . 'sum(case when weekday(trans_date)=1 then gross_output else 0 end) Tuesday, ' . 'sum(case when weekday(trans_date)=2 then gross_output else 0 end) Wednesday, ' . 'sum(case when weekday(trans_date)=3 then gross_output else 0 end) Thursday, ' . 'sum(case when weekday(trans_date)=4 then gross_output else 0 end) Friday, ' . 'sum(case when weekday(trans_date)=5 then gross_output else 0 end) Saturday, ' . 'sum(case when weekday(trans_date)=6 then gross_output else 0 end) Sunday ' . 'FROM (SELECT bt.trans_date trans_date, ' . 'sum((ttd.net_amount+ttd.amount)*ex_rate) gross_output, ' . 'sum(ttd.net_amount*ex_rate) net_output, ' . 'sum(ttd.amount*ex_rate) payable ' . 'FROM ' . TB_PREF . 'bank_trans bt ' . 'INNER JOIN ' . TB_PREF . 'cust_allocations ca ' . 'ON bt.type = ca.trans_type_from ' . 'AND bt.trans_no = ca.trans_no_from ' . 'INNER JOIN ' . TB_PREF . 'debtor_trans dt ' . 'ON dt.type = ca.trans_type_from ' . 'AND dt.trans_no = ca.trans_no_from ' . 'INNER JOIN ' . TB_PREF . 'debtors_master dm ' . 'ON dt.debtor_no = dm.debtor_no ' . 'INNER JOIN ' . TB_PREF . 'trans_tax_details ttd ' . 'ON ttd.trans_type = ca.trans_type_to ' . 'AND ttd.trans_no = ca.trans_no_to ' . 'INNER JOIN ' . TB_PREF . 'tax_types tt ' . 'ON tt.id = ttd.tax_type_id ';
if ($this->data_filter != '') {
$sql .= ' WHERE ' . $this->data_filter;
}
$sql .= ' GROUP BY bt.trans_date ' . ') days ' . 'GROUP BY concat(cast(case when weekofyear(trans_date) = 1 and month(trans_date)=12 then year(trans_date) + 1 else year(trans_date) end as char),cast(weekofyear(trans_date) as char)) ' . 'ORDER BY max(trans_date) desc ';
if (isset($this->top)) {
$sql .= ' limit ' . $this->top;
}
$sql .= ") weeks ORDER BY `Week End`";
$result = db_query($sql) or die(_('Error getting daily sales data'));
$rows = array();
//flag is not needed
$flag = true;
$table = array();
$table['cols'] = array(array('label' => 'Week End', 'type' => 'string'), array('label' => 'Monday', 'type' => 'number'), array('label' => 'Tuesday', 'type' => 'number'), array('label' => 'Wednesday', 'type' => 'number'), array('label' => 'Thursday', 'type' => 'number'), array('label' => 'Friday', 'type' => 'number'), array('label' => 'Saturday', 'type' => 'number'), array('label' => 'Sunday', 'type' => 'number'));
$rows = array();
while ($r = db_fetch_assoc($result)) {
$temp = array();
// the following line will used to slice the Pie chart
$temp[] = array('v' => (string) $r['Week End'], 'f' => sql2date($r['Week End']));
$temp[] = array('v' => (double) $r['Monday'], 'f' => number_format2($r['Monday'], user_price_dec()));
$temp[] = array('v' => (double) $r['Tuesday'], 'f' => number_format2($r['Tuesday'], user_price_dec()));
$temp[] = array('v' => (double) $r['Wednesday'], 'f' => number_format2($r['Wednesday'], user_price_dec()));
$temp[] = array('v' => (double) $r['Thursday'], 'f' => number_format2($r['Thursday'], user_price_dec()));
$temp[] = array('v' => (double) $r['Friday'], 'f' => number_format2($r['Friday'], user_price_dec()));
$temp[] = array('v' => (double) $r['Saturday'], 'f' => number_format2($r['Saturday'], user_price_dec()));
$temp[] = array('v' => (double) $r['Sunday'], 'f' => number_format2($r['Sunday'], user_price_dec()));
$rows[] = array('c' => $temp);
}
$table['rows'] = $rows;
$jsonTable = json_encode($table);
$js = "google.load('visualization', '1', {'packages':['corechart','table']});\ngoogle.setOnLoadCallback(drawChart" . $id . ");\nfunction drawChart" . $id . "() {\n var data = new google.visualization.DataTable(" . $jsonTable . ");\n var options = {";
if ($this->graph_type != 'Table') {
$js .= "height: 300, ";
}
$js .= "title: '" . $title . "'\n };\n var chart" . $id . " = new google.visualization." . $this->graph_type . "(document.getElementById('widget_div_" . $id . "'));\n chart" . $id . ".draw(data, options);\n}";
add_js_source($js);
}
示例9: render
function render($id, $title)
{
$sql = '';
if (isset($this->orderby)) {
$sql .= 'SELECT `Week End`, `Week no`, `Gross Sales`, `Net Sales`, `Tax` ' . 'FROM (';
}
$sql .= 'SELECT max(bt.trans_date) `Week End`, ' . 'weekofyear(bt.trans_date) `Week no`, ' . 'sum((ttd.net_amount+ttd.amount)*ex_rate) `Gross Sales`, ' . 'sum(ttd.net_amount*ex_rate) `Net Sales`, ' . 'sum(ttd.amount*ex_rate) `Tax` ' . 'FROM ' . TB_PREF . 'bank_trans bt ' . 'INNER JOIN ' . TB_PREF . 'cust_allocations ca ' . 'ON bt.type = ca.trans_type_from ' . 'AND bt.trans_no = ca.trans_no_from ' . 'INNER JOIN ' . TB_PREF . 'debtor_trans dt ' . 'ON dt.type = ca.trans_type_from ' . 'AND dt.trans_no = ca.trans_no_from ' . 'INNER JOIN ' . TB_PREF . 'debtors_master dm ' . 'ON dt.debtor_no = dm.debtor_no ' . 'INNER JOIN ' . TB_PREF . 'trans_tax_details ttd ' . 'ON ttd.trans_type = ca.trans_type_to ' . 'AND ttd.trans_no = ca.trans_no_to ' . 'INNER JOIN ' . TB_PREF . 'tax_types tt ' . 'ON tt.id = ttd.tax_type_id ';
if ($this->data_filter != '') {
$sql .= ' WHERE ' . $this->data_filter;
}
$sql .= ' GROUP BY weekofyear(bt.trans_date) ';
if (isset($this->orderby)) {
$sql .= ') items order by `' . $this->orderby . '` ' . $this->orderby_seq;
}
if (isset($this->top)) {
$sql .= ' limit ' . $this->top;
}
$result = db_query($sql) or die(_('Error getting weekly sales data'));
$rows = array();
//flag is not needed
$flag = true;
$table = array();
$table['cols'] = array(array('label' => 'Week End', 'type' => 'string'), array('label' => 'Gross Sales', 'type' => 'number'));
$rows = array();
while ($r = db_fetch_assoc($result)) {
$temp = array();
// the following line will used to slice the Pie chart
$temp[] = array('v' => (string) $r['Week End'], 'f' => sql2date($r['Week End']));
$temp[] = array('v' => (double) $r['Gross Sales'], 'f' => number_format2($r['Gross Sales'], user_price_dec()));
$rows[] = array('c' => $temp);
}
$table['rows'] = $rows;
$jsonTable = json_encode($table);
$js = "google.load('visualization', '1', {'packages':['corechart','table']});\ngoogle.setOnLoadCallback(drawChart" . $id . ");\nfunction drawChart" . $id . "() {\n var data = new google.visualization.DataTable(" . $jsonTable . ");\n var options = {";
if ($this->graph_type != 'Table') {
$js .= "height: 300, ";
}
$js .= "title: '" . $title . "'\n };\n var chart" . $id . " = new google.visualization." . $this->graph_type . "(document.getElementById('widget_div_" . $id . "'));\n chart" . $id . ".draw(data, options);\n}";
add_js_source($js);
}
示例10: print_dimension_summary
function print_dimension_summary()
{
global $path_to_root;
include_once $path_to_root . "reporting/includes/pdf_report.inc";
$fromdim = $_REQUEST['PARAM_0'];
$todim = $_REQUEST['PARAM_1'];
$showbal = $_REQUEST['PARAM_2'];
$comments = $_REQUEST['PARAM_3'];
$cols = array(0, 50, 210, 250, 320, 395, 465, 515);
$headers = array(tr('Reference'), tr('Name'), tr('Type'), tr('Date'), tr('Due Date'), tr('Closed'), tr('YTD'));
$aligns = array('left', 'left', 'left', 'left', 'left', 'left', 'right');
$params = array(0 => $comments, 1 => array('text' => tr('Dimension'), 'from' => $fromdim, 'to' => $todim));
$rep = new FrontReport(tr('Dimension Summary'), "DimensionSummary.pdf", user_pagesize());
$rep->Font();
$rep->Info($params, $cols, $headers, $aligns);
$rep->Header();
$res = getTransactions($fromdim, $todim);
while ($trans = db_fetch($res)) {
$rep->TextCol(0, 1, $trans['reference']);
$rep->TextCol(1, 2, $trans['name']);
$rep->TextCol(2, 3, $trans['type_']);
$rep->TextCol(3, 4, $trans['date_']);
$rep->TextCol(4, 5, $trans['due_date']);
if ($trans['closed']) {
$str = tr('Yes');
} else {
$str = tr('No');
}
$rep->TextCol(5, 6, $str);
if ($showbal) {
$balance = getYTD($trans['id']);
$rep->TextCol(6, 7, number_format2($balance, 0));
}
$rep->NewLine(1, 2);
}
$rep->Line($rep->row);
$rep->End();
}
示例11: print_invoices
function print_invoices()
{
global $path_to_root, $alternative_tax_include_on_docs, $suppress_tax_rates, $no_zero_lines_amount;
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'];
$pay_service = $_POST['PARAM_4'];
$comments = $_POST['PARAM_5'];
$orientation = $_POST['PARAM_6'];
$TotalDiscount = 0;
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, 60, 225, 300, 325, 385, 450, 515);
// $headers in doctext.inc
$aligns = array('left', 'left', 'right', 'left', 'right', 'right', 'right');
$params = array('comments' => $comments);
$cur = get_company_Pref('curr_default');
if ($email == 0) {
$rep = new FrontReport(_('INVOICE'), "InvoiceBulk", user_pagesize(), 9, $orientation);
}
if ($orientation == 'L') {
recalculate_cols($cols);
}
for ($i = $from; $i <= $to; $i++) {
if (!exists_customer_trans(ST_SALESINVOICE, $i)) {
continue;
}
$sign = 1;
$myrow = get_customer_trans($i, ST_SALESINVOICE);
$transId = get_payment_id($i);
$urrow = get_customer_trans($transId['trans_no_from'], ST_CUSTPAYMENT);
$baccount = get_default_bank_account($myrow['curr_code']);
$params['bankaccount'] = $baccount['id'];
$branch = get_branch($myrow["branch_code"]);
$sales_order = get_sales_order_header($myrow["order_"], ST_SALESORDER);
if ($email == 1) {
$rep = new FrontReport("", "", user_pagesize(), 9, $orientation);
$rep->title = _('INVOICE');
$rep->filename = "Invoice" . $myrow['reference'] . ".pdf";
}
$rep->SetHeaderType('Header2');
$rep->currency = $cur;
$rep->Font();
$rep->Info($params, $cols, null, $aligns);
$contacts = get_branch_contacts($branch['branch_code'], 'invoice', $branch['debtor_no'], true);
$baccount['payment_service'] = $pay_service;
$rep->SetCommonData($myrow, $branch, $sales_order, $baccount, ST_SALESINVOICE, $contacts);
$rep->NewPage();
$result = get_customer_trans_details(ST_SALESINVOICE, $i);
// print_r($result);
$SubTotal = 0;
while ($myrow2 = db_fetch($result)) {
if ($myrow2["quantity"] == 0) {
continue;
}
$Net = round2($sign * ((1 - $myrow2["discount_percent"]) * $myrow2["unit_price"] * $myrow2["quantity"]), user_price_dec());
$SubTotal += $Net;
$DisplayPrice = number_format2($myrow2["unit_price"], $dec);
$DisplayQty = number_format2($sign * $myrow2["quantity"], get_qty_dec($myrow2['stock_id']));
$DisplayNet = number_format2($Net, $dec);
if ($myrow2["discount_percent"] == 0) {
$DisplayDiscount = 0;
} else {
$DisplayDiscount = number_format2($myrow2["discount_percent"] * 100, user_percent_dec()) . "%";
}
$rep->fontSize += 5;
$rep->TextCol(0, 1, $myrow2['stock_id'], -2);
$oldrow = $rep->row;
$rep->TextColLines(1, 5, $myrow2['StockDescription'], -2);
$newrow = $rep->row;
$rep->row = $oldrow;
if ($Net != 0.0 || !is_service($myrow2['mb_flag']) || !isset($no_zero_lines_amount) || $no_zero_lines_amount == 0) {
//$rep->TextCol(2, 3, $DisplayQty, -2);
//$rep->TextCol(3, 4, $myrow2['units'], -2);
$rep->TextCol(5, 6, $DisplayPrice, -2);
//$rep->TextCol(5, 6, $DisplayDiscount, -2);
$rep->TextCol(6, 7, $DisplayNet, -2);
$TotalDiscount += $DisplayPrice * ($DisplayDiscount / 100);
}
$rep->row = $newrow;
//$rep->NewLine(1);
if ($rep->row < $rep->bottomMargin + 15 * $rep->lineHeight) {
$rep->NewPage();
}
$rep->fontSize -= 5;
}
$memo = get_comments_string(ST_SALESINVOICE, $i);
if ($memo != "") {
$rep->NewLine();
$rep->TextColLines(1, 5, $memo, -2);
}
//.........这里部分代码省略.........
示例12: print_invoices
//.........这里部分代码省略.........
}
$rep->NewLine();
$rep->TextCol(2, 7, $branch['branch_ref']);
$rep->TextCol(8, 9, $salesman);
$rep->NewLine();
$rep->TextCol(2, 6, $contact);
if ($pay_term['terms'] == 'Cash Only') {
$rep->TextCol(8, 9, $pay_term['terms']);
} else {
$rep->TextCol(7, 10, $pay_term['terms']);
}
$rep->NewLine();
$oldrow = $rep->row;
$newrow = $rep->row;
$rep->TextColLines(2, 6, $branch['br_address'], -2);
$rep->row = $oldrow;
$rep->NewLine(5);
$rep->Font('bold');
//$rep->Line($rep->row + 10);
//$rep->TextCol(2,5, _("Item Description"));
//$rep->TextCol(5,6, _("Quantity"));
//$rep->TextCol(7,8, _("Unit Price"));
//$rep->TextCol(9,10, _("Total Amount"));
//$rep->Line($rep->row - 4);
$rep->NewLine(2);
$rep->Font();
while ($myrow2 = db_fetch($result)) {
if ($myrow2["quantity"] == 0) {
continue;
}
$Net = round2($sign * ((1 - $myrow2["discount_percent"]) * $myrow2["unit_price"] * $myrow2["quantity"]), user_price_dec());
$Net2 = round2($sign * ($myrow2["unit_price"] * $myrow2["quantity"]), user_price_dec());
$SubTotal += $Net;
$DisplayPrice = number_format2($myrow2["unit_price"], $dec);
$DisplayQty = number_format2($sign * $myrow2["quantity"], get_qty_dec($myrow2['stock_id']));
$DisplayNet = number_format2($Net, $dec);
$dNet = number_format2($Net2, $dec);
/*if ($myrow2["discount_percent"]==0)
$DisplayDiscount ="";
else
$DisplayDiscount = number_format2($myrow2["discount_percent"]*100,user_percent_dec()) . "%";*/
//if ($myrow["ov_discount"]==0)
// $DisplayDiscount ="";
//else
//$DisplayDiscount = number_format2($myrow["ov_discount"]/$myrow["ov_amount"] * 100,user_percent_dec()) . "%";
//$rep->TextCol(0, 3, $myrow2['stock_id'], -2);
$oldrow = $rep->row;
$rep->TextColLines(0, 5, $myrow2['StockDescription'], -2);
$newrow = $rep->row;
$rep->row = $oldrow;
if ($Net != 0.0 || !is_service($myrow2['mb_flag']) || !isset($no_zero_lines_amount) || $no_zero_lines_amount == 0) {
$rep->TextCol(5, 6, $DisplayQty . " " . $myrow2['units']);
//$rep->TextCol(5, 6, $myrow2['units'], -2);
$rep->TextCol(7, 8, $DisplayPrice, -2);
//$rep->TextCol(5, 6, $DisplayDiscount, -2);
$rep->TextCol(8, 10, $dNet, -2);
}
$rep->row = $newrow;
//$rep->NewLine(1);
if ($rep->row < $rep->bottomMargin + 15 * $rep->lineHeight) {
$rep->NewPage();
}
}
$memo = get_comments_string(ST_SALESINVOICE, $i);
if ($memo != "") {
$rep->NewLine();
示例13: label_cell
label_cell($date_);
if (!isset($_POST['amount' . $i])) {
$_POST['amount' . $i] = '0';
}
amount_cells(null, 'amount' . $i, null, 15, null, 0);
if ($showdims) {
$d = get_budget_trans_from_to($date_, $date_, $_POST['account'], $_POST['dim1'], $_POST['dim2']);
label_cell(number_format2($d, 0), "nowrap align=right");
$btotal += $d;
}
$lamount = get_gl_trans_from_to(add_years($date_, -1), add_years(end_month($date_), -1), $_POST['account'], $_POST['dim1'], $_POST['dim2']);
$total += input_num('amount' . $i);
$ltotal += $lamount;
label_cell(number_format2($lamount, 0), "nowrap align=right");
$date_ = add_months($date_, 1);
end_row();
}
start_row();
label_cell("<b>" . tr("Total") . "</b>");
label_cell("<b>" . number_format2($total, 0) . "</b>", 'align=right');
if ($showdims) {
label_cell("<b>" . number_format2($btotal, 0) . "</b>", "nowrap align=right");
}
label_cell("<b>" . number_format2($ltotal, 0) . "</b>", "nowrap align=right");
end_row();
end_table(1);
submit_center_first('add', tr("Save"));
submit_center_last('delete', tr("Delete"));
}
end_form();
end_page();
示例14: dec_amount
function dec_amount($row, $amount)
{
return number_format2($amount, $row['decimals']);
}
示例15: edit_button_cell
edit_button_cell("Edit" . $myrow['requisition_detail_id'], _("Edit"));
delete_button_cell("Delete" . $myrow['requisition_detail_id'], _("Delete"));
end_row();
}
end_table(1);
//-----------------------------------------------------------------------------------
start_table(TABLESTYLE2);
if ($selected_id != -1) {
if ($Mode == 'Edit') {
//editing an existing status code
$myrow = get_requisition_detail($selected_id);
$_POST['item_code'] = $myrow["item_code"];
$_POST['purpose'] = $myrow["purpose"];
$_POST['order_quantity'] = $myrow["order_quantity"];
$_POST['estimate_price'] = $myrow["estimate_price"];
}
hidden('selected_id', $selected_id);
}
sales_local_items_list_row(_("Item :"), 'item_code', null, false, false);
text_row(_("Purpose :"), 'purpose', null, 50, 50);
$res = get_item_edit_info(get_post('item_code'));
$dec = $res["decimals"] == '' ? 0 : $res["decimals"];
$units = $res["units"] == '' ? _('kits') : $res["units"];
qty_row(_("Requisition Quantity:"), 'order_quantity', number_format2(1, $dec), '', $units, $dec);
amount_row(_("Estimate Price :"), 'estimate_price', null, null, null, 2);
hidden('requisitionid');
end_table(1);
submit_add_or_update_center($selected_id == -1, '', 'both');
end_form();
//------------------------------------------------------------------------------------
end_page();