function render($id, $title) { global $path_to_root; include_once $path_to_root . "/includes/ui.inc"; $today = date2sql(Today()); $sql = "SELECT bank_act, bank_account_name, SUM(amount) balance FROM " . TB_PREF . "bank_trans bt" . " INNER JOIN " . TB_PREF . "bank_accounts ba ON bt.bank_act = ba.id" . " WHERE trans_date < '{$today}'" . " AND inactive <> 1"; if ($this->data_filter != '') { $sql .= ' AND ' . $this->data_filter; } $sql .= " GROUP BY bank_act, bank_account_name" . " ORDER BY bank_account_name"; $result = db_query($sql); br(); $th = array(_("Account"), _("Balance")); start_table(TABLESTYLE, "width=98%"); table_header($th); $k = 0; //row colour counter while ($myrow = db_fetch($result)) { alt_table_row_color($k); label_cell($myrow["bank_account_name"]); amount_cell($myrow['balance']); end_row(); } end_table(1); }
function display_wo_issue_details($issue_no) { $result = get_work_order_issue_details($issue_no); if (db_num_rows($result) == 0) { display_note(_("There are no items for this issue.")); } else { start_table(TABLESTYLE); $th = array(_("Component"), _("Quantity"), _("Units")); table_header($th); $j = 1; $k = 0; //row colour counter $total_cost = 0; while ($myrow = db_fetch($result)) { alt_table_row_color($k); label_cell($myrow["stock_id"] . " - " . $myrow["description"]); qty_cell($myrow["qty_issued"], false, get_qty_dec($myrow["stock_id"])); label_cell($myrow["units"]); end_row(); $j++; if ($j == 12) { $j = 1; table_header($th); } //end of page full new headings if } //end of while end_table(); } }
function display_trial_balance() { global $table_style, $path_to_root; start_table($table_style); $tableheader = "<tr>\n <td rowspan=2 class='tableheader'>" . tr("Account") . "</td>\n <td rowspan=2 class='tableheader'>" . tr("Account Name") . "</td>\n\t\t<td colspan=2 class='tableheader'>" . tr("Brought Forward") . "</td>\n\t\t<td colspan=2 class='tableheader'>" . tr("This Period") . "</td>\n\t\t<td colspan=2 class='tableheader'>" . tr("Balance") . "</td>\n\t\t</tr><tr>\n\t\t<td class='tableheader'>" . tr("Debit") . "</td>\n <td class='tableheader'>" . tr("Credit") . "</td>\n\t\t<td class='tableheader'>" . tr("Debit") . "</td>\n\t\t<td class='tableheader'>" . tr("Credit") . "</td>\n <td class='tableheader'>" . tr("Debit") . "</td>\n <td class='tableheader'>" . tr("Credit") . "</td>\n </tr>"; echo $tableheader; $k = 0; $accounts = get_gl_accounts(); while ($account = db_fetch($accounts)) { if (is_account_balancesheet($account["account_code"])) { $begin = null; } else { $begin = begin_fiscalyear(); if ($_POST['TransFromDate'] < $begin) { $begin = $_POST['TransFromDate']; } $begin = add_days($begin, -1); } $prev_balance = get_balance($account["account_code"], $begin, $_POST['TransFromDate'], false, false); $curr_balance = get_balance($account["account_code"], $_POST['TransFromDate'], $_POST['TransToDate']); if (check_value("NoZero") && !$prev_balance && !$curr_balance) { continue; } alt_table_row_color($k); $url = "<a href='{$path_to_root}/gl/inquiry/gl_account_inquiry.php?" . SID . "TransFromDate=" . $_POST["TransFromDate"] . "&TransToDate=" . $_POST["TransToDate"] . "&account=" . $account["account_code"] . "'>" . $account["account_code"] . "</a>"; label_cell($url); label_cell($account["account_name"]); display_debit_or_credit_cells($prev_balance); display_debit_or_credit_cells($curr_balance); display_debit_or_credit_cells($prev_balance + $curr_balance); end_row(); } end_table(1); }
function render($id, $title) { global $path_to_root, $systypes_array; include_once $path_to_root . "/includes/ui.inc"; $start_date = add_days(Today(), -$this->days_past); $end_date = add_days(Today(), $this->days_future); $result = get_bank_trans_for_bank_account($this->bank_act, $start_date, $end_date); start_table(TABLESTYLE, 'width=98%'); $th = array(_("#"), _("Date"), _("Receipt"), _("Payment"), _("Balance"), _("Person/Item"), _("Memo"), ""); table_header($th); $bfw = get_balance_before_for_bank_account($this->bank_act, $start_date); $credit = $debit = 0; start_row("class='inquirybg' style='font-weight:bold'"); label_cell(_("Opening Balance") . " - " . $start_date, "colspan=4"); display_debit_or_credit_cells($bfw); label_cell(""); label_cell("", "colspan=2"); end_row(); $running_total = $bfw; if ($bfw > 0) { $debit += $bfw; } else { $credit += $bfw; } $j = 1; $k = 0; //row colour counter while ($myrow = db_fetch($result)) { alt_table_row_color($k); $running_total += $myrow["amount"]; label_cell(get_trans_view_str($myrow["type"], $myrow["trans_no"])); $trandate = sql2date($myrow["trans_date"]); label_cell($trandate); display_debit_or_credit_cells($myrow["amount"]); amount_cell($running_total); label_cell(payment_person_name($myrow["person_type_id"], $myrow["person_id"])); label_cell(get_comments_string($myrow["type"], $myrow["trans_no"])); label_cell(get_gl_view_str($myrow["type"], $myrow["trans_no"])); end_row(); if ($myrow["amount"] > 0) { $debit += $myrow["amount"]; } else { $credit += $myrow["amount"]; } if ($j == 12) { $j = 1; table_header($th); } $j++; } //end of while loop start_row("class='inquirybg' style='font-weight:bold'"); label_cell(_("Ending Balance") . " - " . $end_date, "colspan=4"); amount_cell($debit + $credit); label_cell(""); label_cell("", "colspan=2"); end_row(); end_table(2); }
function render($id, $title) { global $path_to_root; include_once $path_to_root . "/includes/ui.inc"; include_once $path_to_root . "/reporting/includes/class.graphic.inc"; if (!defined('FLOAT_COMP_DELTA')) { define('FLOAT_COMP_DELTA', 0.004); } if (!isset($this->top)) { $this->top = 10; } $begin = begin_fiscalyear(); $today = Today(); $begin1 = date2sql($begin); $today1 = date2sql($today); $sql = "SELECT SUM((trans.ov_amount + trans.ov_discount) * rate) AS total, s.supplier_id, s.supp_name FROM\n " . TB_PREF . "supp_trans AS trans, " . TB_PREF . "suppliers AS s WHERE trans.supplier_id=s.supplier_id\n AND (trans.type = " . ST_SUPPINVOICE . " OR trans.type = " . ST_SUPPCREDIT . ")\n AND tran_date >= '{$begin1}' AND tran_date <= '{$today1}' "; if ($this->data_filter != '') { $sql .= ' AND ' . $this->data_filter; } $sql .= "GROUP by s.supplier_id ORDER BY total DESC, s.supplier_id " . " LIMIT " . $this->top; $result = db_query($sql); if ($this->graph_type == 'Table') { $th = array(_("Supplier"), _("Amount")); start_table(TABLESTYLE, "width=98%"); table_header($th); $k = 0; //row colour counter while ($myrow = db_fetch($result)) { alt_table_row_color($k); $name = $myrow["supplier_id"] . " " . $myrow["supp_name"]; label_cell($name); amount_cell($myrow['total']); end_row(); } end_table(1); } else { $pg = new graph(); $i = 0; while ($myrow = db_fetch($result)) { $name = $myrow["supplier_id"] . " " . $myrow["supp_name"]; $pg->x[$i] = $name; $pg->y[$i] = $myrow['total']; $i++; } $pg->title = $title; $pg->axis_x = _("Supplier"); $pg->axis_y = _("Amount"); $pg->graphic_1 = $today; $pg->type = 2; $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%'>"; } }
function render($id, $title) { global $path_to_root; if (!isset($this->top)) { $this->top = 10; } global $path_to_root; $pg = new graph(); $begin = begin_fiscalyear(); $today = Today(); $begin1 = date2sql($begin); $today1 = date2sql($today); $sql = "SELECT SUM(-t.amount) AS total, d.reference, d.name FROM\n " . TB_PREF . "gl_trans AS t," . TB_PREF . "dimensions AS d WHERE\n (t.dimension_id = d.id OR t.dimension2_id = d.id) AND\n t.tran_date >= '{$begin1}' AND t.tran_date <= '{$today1}' "; if ($this->data_filter != '') { $sql .= ' AND ' . $this->data_filter; } $sql .= "GROUP BY d.id ORDER BY total DESC LIMIT " . $this->top; $result = db_query($sql, "Transactions could not be calculated"); if ($this->graph_type == 'Table') { $title = _("Top 10 Dimensions in fiscal year"); br(2); display_heading($title); br(); $th = array(_("Dimension"), _("Amount")); start_table(TABLESTYLE, "width=98%"); table_header($th); $k = 0; //row colour counter while ($myrow = db_fetch($result)) { alt_table_row_color($k); label_cell($myrow['reference'] . " " . $myrow["name"]); amount_cell($myrow['total']); end_row(); } end_table(2); } else { $pg = new graph(); $i = 0; while ($myrow = db_fetch($result)) { $pg->x[$i] = $myrow['reference'] . " " . $myrow["name"]; $pg->y[$i] = abs($myrow['total']); $i++; } $pg->title = $title; $pg->axis_x = _("Dimension"); $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%'>"; } }
function render($id, $title) { global $path_to_root; include_once $path_to_root . "/reporting/includes/class.graphic.inc"; if (!defined('FLOAT_COMP_DELTA')) { define('FLOAT_COMP_DELTA', 0.004); } if (!isset($this->top)) { $this->top = 10; } $begin = begin_fiscalyear(); $today = Today(); $begin1 = date2sql($begin); $today1 = date2sql($today); $sql = "SELECT SUM((ov_amount + ov_discount) * rate * IF(trans.type = " . ST_CUSTCREDIT . ", -1, 1)) AS total,d.debtor_no, d.name" . " FROM " . TB_PREF . "debtor_trans AS trans, " . TB_PREF . "debtors_master AS d" . " WHERE trans.debtor_no=d.debtor_no" . " AND (trans.type = " . ST_SALESINVOICE . " OR trans.type = " . ST_CUSTCREDIT . ")" . " AND tran_date >= '{$begin1}' AND tran_date <= '{$today1}'"; if ($this->data_filter != '') { $sql .= ' AND ' . $this->data_filter; } $sql .= " GROUP by d.debtor_no ORDER BY total DESC, d.debtor_no " . " LIMIT " . $this->top; $result = db_query($sql); if ($this->graph_type == 'Table') { $th = array(null, _("Customer"), _("Amount")); start_table(TABLESTYLE, "width=98%"); table_header($th); $k = 0; //row colour counter $i = 0; while ($myrow = db_fetch($result)) { alt_table_row_color($k); label_cell(viewer_link($myrow["debtor_no"], 'sales/inquiry/customer_inquiry.php?customer_id=' . $myrow["debtor_no"])); label_cell(viewer_link($myrow["name"], 'sales/inquiry/customer_inquiry.php?customer_id=' . $myrow["debtor_no"])); amount_cell($myrow['total']); end_row(); } end_table(1); } else { $pg = new graph(); $i = 0; while ($myrow = db_fetch($result)) { $pg->x[$i] = $myrow["debtor_no"] . " " . $myrow["name"]; $pg->y[$i] = $myrow['total']; $i++; } $pg->title = $title; $pg->axis_x = _("Customer"); $pg->axis_y = _("Amount"); $pg->graphic_1 = $today; $pg->type = 2; $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%'>"; } }
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(); }
function show_results() { global $path_to_root; /*Now get the transactions */ div_start('trans_tbl'); start_table(TABLESTYLE); $th = array(_("Type"), _("Description"), _("Amount"), _("Outputs") . "/" . _("Inputs")); table_header($th); $k = 0; $total = 0; $bdate = date2sql($_POST['TransFromDate']); $edate = date2sql($_POST['TransToDate']); $taxes = get_tax_summary($_POST['TransFromDate'], $_POST['TransToDate']); while ($tx = db_fetch($taxes)) { $payable = $tx['payable']; $collectible = $tx['collectible']; $net = $collectible + $payable; $total += $net; alt_table_row_color($k); label_cell($tx['name'] . " " . $tx['rate'] . "%"); label_cell(_("Charged on sales") . " (" . _("Output Tax") . "):"); amount_cell($payable); amount_cell($tx['net_output']); end_row(); alt_table_row_color($k); label_cell($tx['name'] . " " . $tx['rate'] . "%"); label_cell(_("Paid on purchases") . " (" . _("Input Tax") . "):"); amount_cell($collectible); amount_cell($tx['net_input']); end_row(); alt_table_row_color($k); label_cell("<b>" . $tx['name'] . " " . $tx['rate'] . "%</b>"); label_cell("<b>" . _("Net payable or collectible") . ":</b>"); amount_cell($net, true); label_cell(""); end_row(); } alt_table_row_color($k); label_cell(""); label_cell("<b>" . _("Total payable or refund") . ":</b>"); amount_cell($total, true); label_cell(""); end_row(); end_table(2); div_end(); }
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(); }
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(); }
function display_kit_items($selected_kit) { $result = get_item_kit($selected_kit); div_start('bom'); start_table(TABLESTYLE, "width='60%'"); $th = array(_("Stock Item"), _("Description"), _("Quantity"), _("Units"), '', ''); table_header($th); $k = 0; while ($myrow = db_fetch($result)) { alt_table_row_color($k); label_cell($myrow["stock_id"]); label_cell($myrow["comp_name"]); qty_cell($myrow["quantity"], false, $myrow["units"] == '' ? 0 : get_qty_dec($myrow["comp_name"])); label_cell($myrow["units"] == '' ? _('kit') : $myrow["units"]); edit_button_cell("Edit" . $myrow['id'], _("Edit")); delete_button_cell("Delete" . $myrow['id'], _("Delete")); end_row(); } //END WHILE LIST LOOP end_table(); div_end(); }
function display_langs() { start_table(TABLESTYLE); $th = array(_("Language"), _("Encoding"), _("Description"), _("Install")); table_header($th); $k = 0; $langs = get_languages_list(); foreach ($langs as $pkg_name => $lang) { $available = @$lang['available']; $installed = @$lang['version']; $id = @$lang['local_id']; if (!$available) { continue; } alt_table_row_color($k); label_cell($lang['name']); label_cell($lang['encoding']); label_cell(is_array($lang['Descr']) ? implode('<br>', $lang['Descr']) : $lang['Descr']); label_cell($installed ? _("Installed") : checkbox(null, 'langs[' . $lang['package'] . ']'), "align='center'"); end_row(); } end_table(1); }
function display_bom_items($selected_parent) { global $table_style; $result = get_bom($selected_parent); start_table("{$table_style} width=60%"); $th = array(tr("Code"), tr("Description"), tr("Location"), tr("Work Centre"), tr("Quantity"), tr("Units"), '', ''); table_header($th); $k = 0; while ($myrow = db_fetch($result)) { alt_table_row_color($k); label_cell($myrow["component"]); label_cell($myrow["description"]); label_cell($myrow["location_name"]); label_cell($myrow["WorkCentreDescription"]); label_cell(qty_format($myrow["quantity"])); label_cell($myrow["units"]); edit_link_cell(SID . "NewItem={$selected_parent}&selected_component=" . $myrow["id"]); delete_link_cell(SID . "delete=" . $myrow["id"] . "&stock_id=" . $_POST['stock_id']); end_row(); } //END WHILE LIST LOOP end_table(); }
function render($id, $title) { global $path_to_root; include_once $path_to_root . "/includes/ui.inc"; if (!defined('FLOAT_COMP_DELTA')) { define('FLOAT_COMP_DELTA', 0.004); } $today = date2sql(Today()); $sql = "SELECT trans.trans_no, trans.reference, trans.tran_date, trans.due_date, debtor.debtor_no,\n debtor.name, branch.br_name, debtor.curr_code,\n (trans.ov_amount + trans.ov_gst + trans.ov_freight\n + trans.ov_freight_tax + trans.ov_discount) AS total,\n (trans.ov_amount + trans.ov_gst + trans.ov_freight\n + trans.ov_freight_tax + trans.ov_discount - trans.alloc) AS remainder,\n DATEDIFF('{$today}', trans.due_date) AS days\n FROM " . TB_PREF . "debtor_trans as trans, " . TB_PREF . "debtors_master as debtor,\n " . TB_PREF . "cust_branch as branch\n WHERE debtor.debtor_no = trans.debtor_no AND trans.branch_code = branch.branch_code\n AND trans.type = " . ST_SALESINVOICE . " AND (trans.ov_amount + trans.ov_gst + trans.ov_freight\n + trans.ov_freight_tax + trans.ov_discount - trans.alloc) > " . FLOAT_COMP_DELTA . "\n AND DATEDIFF('{$today}', trans.due_date) > 0 ORDER BY days DESC"; if ($this->data_filter != '') { $sql .= ' AND ' . $this->data_filter; } $result = db_query($sql); $title = db_num_rows($result) . _(" Overdue Sales Invoices"); br(1); display_heading($title); br(); $th = array("#", _("Date"), _("Due Date"), _("Customer"), _("Currency"), _("Total"), _("Remainder"), _("Days")); start_table(TABLESTYLE, "width=98%"); table_header($th); $k = 0; //row colour counter while ($myrow = db_fetch($result)) { alt_table_row_color($k); label_cell(get_trans_view_str(ST_SALESINVOICE, $myrow["trans_no"])); label_cell(sql2date($myrow['tran_date'])); label_cell(sql2date($myrow['due_date'])); $name = $myrow["debtor_no"] . " " . $myrow["name"]; label_cell($name); label_cell($myrow['curr_code']); amount_cell($myrow['total']); amount_cell($myrow['remainder']); label_cell($myrow['days'], "align='right'"); end_row(); } end_table(1); }
function render($id, $title) { global $path_to_root; include_once $path_to_root . "/includes/ui.inc"; $end_date = date2sql(add_days(Today(), $this->days_future)); $role_id = $_SESSION["wa_current_user"]->access; $sql = "SELECT id, description, next_date FROM " . TB_PREF . "dashboard_reminders " . " WHERE next_date < '{$end_date}'" . " AND role_id = '{$role_id}'"; if ($this->data_filter != '') { $sql .= ' AND ' . $this->data_filter; } $sql .= " ORDER BY next_date"; $result = db_query($sql); br(); $th = array(_("Actioned"), _("Date"), _("Description")); start_table(TABLESTYLE, "id='reminder' width=98%"); table_header($th); $k = 0; //row colour counter while ($myrow = db_fetch($result)) { $nextdate = sql2date($myrow["next_date"]); if (date1_greater_date2(Today(), $nextdate)) { $extra = "class='reminder_overdue'"; } elseif (Today() == $nextdate) { $extra = "class='reminder_due'"; } else { $extra = "class='reminder'"; } alt_table_row_color($k); $js = 'setTimeout(function(){updateToDoData(' . $myrow["id"] . ');}, 0);'; check_cells(null, null, null, $js); label_cell($nextdate, $extra); label_cell("<pre>" . $myrow["description"] . "</pre>", $extra); end_row(); } end_table(1); }
function display_bom_items($selected_parent) { $result = get_bom($selected_parent); div_start('bom'); start_table(TABLESTYLE, "width=60%"); $th = array(_("Code"), _("Description"), _("Location"), _("Work Centre"), _("Quantity"), _("Units"), '', ''); table_header($th); $k = 0; while ($myrow = db_fetch($result)) { alt_table_row_color($k); label_cell($myrow["component"]); label_cell($myrow["description"]); label_cell($myrow["location_name"]); label_cell($myrow["WorkCentreDescription"]); qty_cell($myrow["quantity"], false, get_qty_dec($myrow["component"])); label_cell($myrow["units"]); edit_button_cell("Edit" . $myrow['id'], _("Edit")); delete_button_cell("Delete" . $myrow['id'], _("Delete")); end_row(); } //END WHILE LIST LOOP end_table(); div_end(); }
function display_grn_items_for_selection() { global $table_style; $result = get_grn_items(0, $_SESSION['supp_trans']->supplier_id, true); if (db_num_rows($result) == 0) { display_note(tr("There are no outstanding items received from this supplier that have not been invoiced by them."), 0, 1); end_page(); exit; } /*Set up a table to show the outstanding GRN items for selection */ start_form(false, true); display_heading2(tr("Items Received Yet to be Invoiced")); start_table("{$table_style} colspan=7 width=95%"); $th = array(tr("Delivery"), tr("Sequence #"), tr("P.O."), tr("Item"), tr("Description"), tr("Received On"), tr("Quantity Received"), tr("Quantity Invoiced"), tr("Uninvoiced Quantity"), tr("Order Price"), tr("Total")); table_header($th); $i = $k = 0; while ($myrow = db_fetch($result)) { $grn_already_on_invoice = False; foreach ($_SESSION['supp_trans']->grn_items as $entered_grn) { if ($entered_grn->id == $myrow["id"]) { $grn_already_on_invoice = True; } } if ($grn_already_on_invoice == False) { alt_table_row_color($k); label_cell(get_trans_view_str(25, $myrow["grn_batch_id"])); //text_cells(null, 'grn_item_id', $myrow["id"]); submit_cells('grn_item_id', $myrow["id"]); label_cell(get_trans_view_str(systypes::po(), $myrow["purch_order_no"])); label_cell($myrow["item_code"]); label_cell($myrow["description"]); label_cell(sql2date($myrow["delivery_date"])); qty_cell($myrow["qty_recd"]); qty_cell($myrow["quantity_inv"]); qty_cell($myrow["qty_recd"] - $myrow["quantity_inv"]); amount_cell($myrow["unit_price"]); amount_cell(round($myrow["unit_price"] * ($myrow["qty_recd"] - $myrow["quantity_inv"]), user_price_dec())); end_row(); $i++; if ($i > 15) { $i = 0; table_header($th); } } } end_table(); }
function pager(&$pager) { global $use_popup_windows, $use_date_picker, $path_to_root; $pager->select_records(); div_start("_{$pager->name}_span"); $headers = array(); foreach ($pager->columns as $num_col => $col) { // record status control column is displayed only when control checkbox is on if (isset($col['head']) && ($col['type'] != 'inactive' || get_post('show_inactive'))) { if (!isset($col['ord'])) { $headers[] = $col['head']; } else { $icon = $col['ord'] == 'desc' ? 'sort_desc.gif' : ($col['ord'] == 'asc' ? 'sort_asc.gif' : 'sort_none.gif'); $headers[] = navi_button($pager->name . '_sort_' . $num_col, $col['head'], true, $icon); } } } /* show a table of records returned by the sql */ start_table(TABLESTYLE, "width={$pager->width}"); table_header($headers); if ($pager->header_fun) { // if set header handler start_row("class='{$pager->header_class}'"); $fun = $pager->header_fun; if (method_exists($pager, $fun)) { $h = $pager->{$fun}($pager); } elseif (function_exists($fun)) { $h = $fun($pager); } foreach ($h as $c) { // draw header columns $pars = isset($c[1]) ? $c[1] : ''; label_cell($c[0], $pars); } end_row(); } $cc = 0; // row colour counter foreach ($pager->data as $line_no => $row) { $marker = $pager->marker; if ($marker && $marker($row)) { start_row("class='{$pager->marker_class}'"); } else { alt_table_row_color($cc); } foreach ($pager->columns as $k => $col) { $coltype = $col['type']; $cell = isset($col['name']) ? $row[$col['name']] : ''; if (isset($col['fun'])) { // use data input function if defined $fun = $col['fun']; if (method_exists($pager, $fun)) { $cell = $pager->{$fun}($row, $cell); } elseif (function_exists($fun)) { $cell = $fun($row, $cell); } else { $cell = ''; } } switch ($coltype) { // format column case 'time': label_cell($cell, "width=40"); break; case 'date': label_cell(sql2date($cell), "align='center' nowrap"); break; case 'dstamp': // time stamp displayed as date label_cell(sql2date(substr($cell, 0, 10)), "align='center' nowrap"); break; case 'tstamp': // time stamp - FIX user format label_cell(sql2date(substr($cell, 0, 10)) . ' ' . substr($cell, 10), "align='center'"); break; case 'percent': percent_cell($cell); break; case 'amount': if ($cell == '') { label_cell(''); } else { amount_cell($cell, false); } break; case 'qty': if ($cell == '') { label_cell(''); } else { qty_cell($cell, false, isset($col['dec']) ? $col['dec'] : null); } break; case 'email': email_cell($cell, isset($col['align']) ? "align='" . $col['align'] . "'" : null); break; case 'rate': label_cell(number_format2($cell, user_exrate_dec()), "align=center"); break; case 'inactive': if (get_post('show_inactive')) { $pager->inactive_control_cell($row); } break; default: // case 'text': if (isset($col['align'])) { label_cell($cell, "align='" . $col['align'] . "'"); } else { label_cell($cell); } case 'skip': // column not displayed } } end_row(); } // end of while loop if ($pager->footer_fun) { // if set footer handler start_row("class='{$pager->footer_class}'"); $fun = $pager->footer_fun; if (method_exists($pager, $fun)) { $h = $pager->{$fun}($pager); } elseif (function_exists($fun)) { $h = $fun($pager); } foreach ($h as $c) { // draw footer columns $pars = isset($c[1]) ? $c[1] : ''; label_cell($c[0], $pars); } end_row(); } start_row("class='navibar'"); $colspan = count($pager->columns); $inact = @$pager->inactive_ctrl == true ? ' ' . checkbox(null, 'show_inactive', null, true) . _("Show also Inactive") : ''; end_row(); end_table(); $but_pref = $pager->name . '_page_'; // if (@$pager->inactive_ctrl) // submit('Update', _('Update'), true, '', null); // inactive update $context = array('first' => $this->pager_button($but_pref . 'first', _('«'), $pager->first_page), 'previous' => $this->pager_button($but_pref . 'prev', _('‹'), $pager->prev_page), 'next' => $this->pager_button($but_pref . 'next', _('›'), $pager->next_page), 'last' => $this->pager_button($but_pref . 'last', _('»'), $pager->last_page)); $from = ($pager->curr_page - 1) * $pager->page_len + 1; $to = $from + $pager->page_len - 1; if ($to > $pager->rec_count) { $to = $pager->rec_count; } $all = $pager->rec_count; // echo sprintf(_('Records %d-%d of %d'), $from, $to, $all); // echo $inact; // echo "</td>"; echo ThemeBootstrap::get()->renderBlock('controls.twig.html', 'pager', $context); /* if ($pager->rec_count) { echo "<td colspan=$colspan class='navibar' style='border:none;padding:3px;'>"; echo "<div style='float:right;'>"; $but_pref = $pager->name . '_page_'; start_table(); start_row(); if (@$pager->inactive_ctrl) submit('Update', _('Update'), true, '', null); // inactive update echo navi_button_cell($but_pref . 'first', _('First'), $pager->first_page, 'right'); echo navi_button_cell($but_pref . 'prev', _('Prev'), $pager->prev_page, 'right'); echo navi_button_cell($but_pref . 'next', _('Next'), $pager->next_page, 'right'); echo navi_button_cell($but_pref . 'last', _('Last'), $pager->last_page, 'right'); end_row(); end_table(); echo "</div>"; $from = ($pager->curr_page - 1) * $pager->page_len + 1; $to = $from + $pager->page_len - 1; if ($to > $pager->rec_count) $to = $pager->rec_count; $all = $pager->rec_count; echo sprintf(_('Records %d-%d of %d'), $from, $to, $all); echo $inact; echo "</td>"; } else { label_cell(_('No records') . $inact, "colspan=$colspan class='navibar'"); } */ if (isset($pager->marker_txt)) { display_note($pager->marker_txt, 0, 1, "class='{$pager->notice_class}'"); } div_end(); return true; }
// (but anyway dispatch is checked again later before transaction is saved) $qty = $ln_itm->qty_dispatched; if ($check = check_negative_stock($ln_itm->stock_id, -$ln_itm->qty_dispatched, $_POST['Location'], $_POST['DispatchDate'])) { $qty = $check['qty']; } $q_class = hook_get_dispatchable_quantity($ln_itm, $_POST['Location'], $_POST['DispatchDate'], $qty); // Skip line if needed if ($q_class === 'skip') { continue; } if (is_array($q_class)) { list($ln_itm->qty_dispatched, $row_classes) = $q_class; $has_marked = true; } } alt_table_row_color($k, $row_classes); view_stock_status_cell($ln_itm->stock_id); if ($ln_itm->descr_editable) { text_cells(null, 'Line' . $line . '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_done, false, $dec); if (isset($_POST['clear_quantity'])) { $ln_itm->qty_dispatched = 0; } $_POST['Line' . $line] = $ln_itm->qty_dispatched; /// clear post so value displayed in the fiel is the 'new' quantity
function company_extensions($id) { start_table(TABLESTYLE); $th = array(_("Extension"), _("Modules provided"), _("Options provided"), _("Active")); $mods = get_company_extensions(); $exts = get_company_extensions($id); foreach ($mods as $key => $ins) { foreach ($exts as $ext) { if ($ext['name'] == $ins['name']) { $mods[$key]['active'] = @$ext['active']; continue 2; } } } $mods = array_natsort($mods, null, 'name'); table_header($th); $k = 0; foreach ($mods as $i => $mod) { if ($mod['type'] != 'extension') { continue; } alt_table_row_color($k); label_cell($mod['name']); $entries = fmt_titles(@$mod['entries']); $tabs = fmt_titles(@$mod['tabs']); label_cell($tabs); label_cell($entries); check_cells(null, 'Active' . $i, @$mod['active'] ? 1 : 0, false, false, "align='center'"); end_row(); } end_table(1); submit_center('Refresh', _('Update'), true, false, 'default'); }
function display_companies() { global $def_coy, $db_connections; $coyno = $_SESSION["wa_current_user"]->company; echo "\n\t\t<script language='javascript'>\n\t\tfunction deleteCompany(id, name) {\n\t\t\tif (!confirm('" . _("Are you sure you want to delete company no. ") . "'+id+' '+name+'?'))\n\t\t\t\treturn\n\t\t\tdocument.location.replace('create_coy.php?c=df&id='+id)\n\t\t}\n\t\t</script>"; start_table(TABLESTYLE); $th = array(_("Company"), _("Database Host"), _("Database User"), _("Database Name"), _("Table Pref"), _("Default"), "", ""); table_header($th); $k = 0; $conn = $db_connections; $n = count($conn); for ($i = 0; $i < $n; $i++) { if ($i == $def_coy) { $what = _("Yes"); } else { $what = _("No"); } if ($i == $coyno) { start_row("class='stockmankobg'"); } else { alt_table_row_color($k); } label_cell($conn[$i]['name']); label_cell($conn[$i]['host']); label_cell($conn[$i]['dbuser']); label_cell($conn[$i]['dbname']); label_cell($conn[$i]['tbpref']); label_cell($what); $edit = _("Edit"); $delete = _("Delete"); if (user_graphic_links()) { $edit = set_icon(ICON_EDIT, $edit); $delete = set_icon(ICON_DELETE, $delete); } label_cell("<a href='" . $_SERVER['PHP_SELF'] . "?selected_id={$i}'>{$edit}</a>"); $name = "\"" . $conn[$i]['name'] . "\""; label_cell($i == $coyno ? '' : "<a href='javascript:deleteCompany({$i}, {$name})'>{$delete}</a>"); end_row(); } end_table(); display_note(_("The marked company is the current company which cannot be deleted."), 0, 0, "class='currentfg'"); display_note(_("If no Admin Password is entered, the new Admin Password will be '<b>password</b>' by default "), 1, 0, "class='currentfg'"); }
function edit_allocations_for_transaction($type, $trans_no) { global $table_style; start_form(false, true); display_heading(sprintf(tr("Allocation of %s # %d"), systypes::name($_SESSION['alloc']->type), $_SESSION['alloc']->trans_no)); display_heading($_SESSION['alloc']->person_name); display_heading2(tr("Date:") . " <b>" . $_SESSION['alloc']->date_ . "</b>"); display_heading2(tr("Total:") . " <b>" . price_format($_SESSION['alloc']->amount) . "</b>"); echo "<br>"; if (count($_SESSION['alloc']->allocs) > 0) { start_table($table_style); $th = array(tr("Transaction Type"), tr("#"), tr("Date"), tr("Due Date"), tr("Amount"), tr("Other Allocations"), tr("This Allocation"), tr("Left to Allocate"), "", ""); table_header($th); $k = $counter = $total_allocated = 0; foreach ($_SESSION['alloc']->allocs as $allocn_item) { alt_table_row_color($k); label_cell(systypes::name($allocn_item->type)); label_cell(get_trans_view_str($allocn_item->type, $allocn_item->type_no)); label_cell($allocn_item->date_, "align=right"); label_cell($allocn_item->due_date, "align=right"); amount_cell($allocn_item->amount); amount_cell($allocn_item->amount_allocated); if (!check_num('amount' . $counter)) { $_POST['amount' . $counter] = price_format($allocn_item->current_allocated); } amount_cells(null, 'amount' . $counter, $_POST['amount' . $counter]); $un_allocated = round($allocn_item->amount - $allocn_item->amount_allocated, 6); hidden("un_allocated" . $counter, $un_allocated); amount_cell($un_allocated); label_cell("<a href='#' name=Alloc{$counter} onclick='allocate_all(this.name.substr(5));return true;'>" . tr("All") . "</a>"); label_cell("<a href='#' name=DeAll{$counter} onclick='allocate_none(this.name.substr(5));return true;'>" . tr("None") . "</a>"); end_row(); $total_allocated += input_num('amount' . $counter); $counter++; } label_row(tr("Total Allocated"), price_format($total_allocated), "colspan=6 align=right", "nowrap align=right id='total_allocated'"); if ($_SESSION['alloc']->amount - $total_allocated < 0) { $font1 = "<font color=red>"; $font2 = "</font>"; } else { $font1 = $font2 = ""; } $left_to_allocate = $_SESSION['alloc']->amount - $total_allocated; $left_to_allocate = price_format($left_to_allocate); label_row(tr("Left to Allocate"), $font1 . $left_to_allocate . $font2, "colspan=6 align=right ", "nowrap align=right id='left_to_allocate'"); end_table(1); hidden('TotalNumberOfAllocs', $counter); // hidden('left_to_allocate', $left_to_allocate); submit_center_first('UpdateDisplay', tr("Update")); submit('Process', tr("Process")); } else { display_note(tr("There are no unsettled transactions to allocate."), 0, 1); } submit_center_last('Cancel', tr("Back to Allocations")); end_form(); }
function display_companies() { global $table_style, $def_coy, $db_connections; $coyno = $_SESSION["wa_current_user"]->company; echo "\n\t\t<script language='javascript'>\n\t\tfunction deleteCompany(id) {\n\t\t\tif (!confirm('" . tr("Are you sure you want to delete company no. ") . "'+id))\n\t\t\t\treturn\n\t\t\tdocument.location.replace('create_coy.php?c=df&id='+id)\n\t\t}\n\t\t</script>"; start_table($table_style); $th = array(tr("Company"), tr("Database Host"), tr("Database User"), tr("Database Name"), tr("Table Pref"), tr("Default"), "", ""); table_header($th); $k = 0; $conn = $db_connections; $n = count($conn); for ($i = 0; $i < $n; $i++) { if ($i == $def_coy) { $what = tr("Yes"); } else { $what = tr("No"); } if ($i == $coyno) { start_row("class='stockmankobg'"); } else { alt_table_row_color($k); } label_cell($conn[$i]['name']); label_cell($conn[$i]['host']); label_cell($conn[$i]['dbuser']); label_cell($conn[$i]['dbname']); label_cell($what); label_cell("<a href=" . $_SERVER['PHP_SELF'] . "?selected_id=" . $i . ">" . tr("Edit") . "</a>"); if ($i != $coyno) { label_cell("<a href='javascript:deleteCompany(" . $i . ")'>" . tr("Delete") . "</a>"); } end_row(); } end_table(); display_note(tr("The marked company is the current company which cannot be deleted."), 0, 0, "class='currentfg'"); }
function display_currencies() { $company_currency = get_company_currency(); $result = get_currencies(check_value('show_inactive')); start_table(TABLESTYLE); $th = array(_("Abbreviation"), _("Symbol"), _("Currency Name"), _("Hundredths name"), _("Country"), _("Auto update"), "", ""); inactive_control_column($th); table_header($th); $k = 0; //row colour counter while ($myrow = db_fetch($result)) { if ($myrow[1] == $company_currency) { start_row("class='currencybg'"); } else { alt_table_row_color($k); } label_cell($myrow["curr_abrev"]); label_cell($myrow["curr_symbol"]); label_cell($myrow["currency"]); label_cell($myrow["hundreds_name"]); label_cell($myrow["country"]); label_cell($myrow[1] == $company_currency ? '-' : ($myrow["auto_update"] ? _('Yes') : _('No')), "align='center'"); inactive_control_cell($myrow["curr_abrev"], $myrow["inactive"], 'currencies', 'curr_abrev'); edit_button_cell("Edit" . $myrow["curr_abrev"], _("Edit")); if ($myrow["curr_abrev"] != $company_currency) { delete_button_cell("Delete" . $myrow["curr_abrev"], _("Delete")); } else { label_cell(''); } end_row(); } //END WHILE LIST LOOP inactive_control_row($th); end_table(); display_note(_("The marked currency is the home currency which cannot be deleted."), 0, 0, "class='currentfg'"); }
function show_results() { global $path_to_root, $systypes_array; if (!isset($_POST["account"])) { $_POST["account"] = null; } $act_name = $_POST["account"] ? get_gl_account_name($_POST["account"]) : ""; $dim = get_company_pref('use_dimension'); /*Now get the transactions */ if (!isset($_POST['Dimension'])) { $_POST['Dimension'] = 0; } if (!isset($_POST['Dimension2'])) { $_POST['Dimension2'] = 0; } $result = get_gl_transactions($_POST['TransFromDate'], $_POST['TransToDate'], -1, $_POST["account"], $_POST['Dimension'], $_POST['Dimension2'], null, input_num('amount_min'), input_num('amount_max')); $colspan = $dim == 2 ? "6" : ($dim == 1 ? "5" : "4"); if ($_POST["account"] != null) { display_heading($_POST["account"] . " " . $act_name); } // Only show balances if an account is specified AND we're not filtering by amounts $show_balances = $_POST["account"] != null && input_num("amount_min") == 0 && input_num("amount_max") == 0; start_table(TABLESTYLE); $first_cols = array(_("Type"), _("#"), _("Date")); if ($_POST["account"] == null) { $account_col = array(_("Account")); } else { $account_col = array(); } if ($dim == 2) { $dim_cols = array(_("Dimension") . " 1", _("Dimension") . " 2"); } else { if ($dim == 1) { $dim_cols = array(_("Dimension")); } else { $dim_cols = array(); } } if ($show_balances) { $remaining_cols = array(_("Person/Item"), _("Debit"), _("Credit"), _("Balance"), _("Memo")); } else { $remaining_cols = array(_("Person/Item"), _("Debit"), _("Credit"), _("Memo")); } $th = array_merge($first_cols, $account_col, $dim_cols, $remaining_cols); table_header($th); if ($_POST["account"] != null && is_account_balancesheet($_POST["account"])) { $begin = ""; } else { $begin = get_fiscalyear_begin_for_date($_POST['TransFromDate']); if (date1_greater_date2($begin, $_POST['TransFromDate'])) { $begin = $_POST['TransFromDate']; } $begin = add_days($begin, -1); } $bfw = 0; if ($show_balances) { $bfw = get_gl_balance_from_to($begin, $_POST['TransFromDate'], $_POST["account"], $_POST['Dimension'], $_POST['Dimension2']); start_row("class='inquirybg'"); label_cell("<b>" . _("Opening Balance") . " - " . $_POST['TransFromDate'] . "</b>", "colspan={$colspan}"); display_debit_or_credit_cells($bfw, true); label_cell(""); label_cell(""); end_row(); } $running_total = $bfw; $j = 1; $k = 0; //row colour counter while ($myrow = db_fetch($result)) { alt_table_row_color($k); $running_total += $myrow["amount"]; $trandate = sql2date($myrow["tran_date"]); label_cell($systypes_array[$myrow["type"]]); label_cell(get_gl_view_str($myrow["type"], $myrow["type_no"], $myrow["type_no"], true)); label_cell($trandate); if ($_POST["account"] == null) { label_cell($myrow["account"] . ' ' . get_gl_account_name($myrow["account"])); } if ($dim >= 1) { label_cell(get_dimension_string($myrow['dimension_id'], true)); } if ($dim > 1) { label_cell(get_dimension_string($myrow['dimension2_id'], true)); } label_cell(payment_person_name($myrow["person_type_id"], $myrow["person_id"])); display_debit_or_credit_cells($myrow["amount"]); if ($show_balances) { amount_cell($running_total); } if ($myrow['memo_'] == "") { $myrow['memo_'] = get_comments_string($myrow['type'], $myrow['type_no']); } label_cell($myrow['memo_']); end_row(); $j++; if ($j == 12) { $j = 1; table_header($th); } } //end of while loop if ($show_balances) { start_row("class='inquirybg'"); label_cell("<b>" . _("Ending Balance") . " - " . $_POST['TransToDate'] . "</b>", "colspan={$colspan}"); display_debit_or_credit_cells($running_total, true); label_cell(""); label_cell(""); end_row(); } end_table(2); if (db_num_rows($result) == 0) { display_note(_("No general ledger transactions have been created for the specified criteria."), 0, 1); } }
function display_profit_and_loss() { global $path_to_root, $sel; if (!isset($_POST['Dimension'])) { $_POST['Dimension'] = 0; } if (!isset($_POST['Dimension2'])) { $_POST['Dimension2'] = 0; } $dimension = $_POST['Dimension']; $dimension2 = $_POST['Dimension2']; $from = $_POST['TransFromDate']; $to = $_POST['TransToDate']; $compare = $_POST['Compare']; if (isset($_POST["AccGrp"]) && strlen($_POST['AccGrp']) > 0) { $drilldown = 1; } else { $drilldown = 0; } // Root level $dec = 0; $pdec = user_percent_dec(); if ($compare == 0 || $compare == 2) { $end = $to; if ($compare == 2) { $begin = $from; } else { $begin = begin_fiscalyear(); } } elseif ($compare == 1) { $begin = add_months($from, -12); $end = add_months($to, -12); } div_start('pl_tbl'); start_table(TABLESTYLE, "width=50%"); $tableheader = "<tr>\n <td class='tableheader'>" . _("Group/Account Name") . "</td>\n <td class='tableheader'>" . _("Period") . "</td>\n\t\t<td class='tableheader'>" . $sel[$compare] . "</td>\n\t\t<td class='tableheader'>" . _("Achieved %") . "</td>\n </tr>"; if (!$drilldown) { $parent = -1; $classper = 0.0; $classacc = 0.0; $salesper = 0.0; $salesacc = 0.0; //Get classes for PL $classresult = get_account_classes(false, 0); while ($class = db_fetch($classresult)) { $class_per_total = 0; $class_acc_total = 0; $convert = get_class_type_convert($class["ctype"]); //Print Class Name table_section_title($class["class_name"], 4); echo $tableheader; //Get Account groups/types under this group/type $typeresult = get_account_types(false, $class['cid'], -1); while ($accounttype = db_fetch($typeresult)) { $TypeTotal = display_type($accounttype["id"], $accounttype["name"], $from, $to, $begin, $end, $compare, $convert, $dec, $pdec, $rep, $dimension, $dimension2, $drilldown, $path_to_root); $class_per_total += $TypeTotal[0]; $class_acc_total += $TypeTotal[1]; if ($TypeTotal[0] != 0 || $TypeTotal[1] != 0) { $url = "<a href='{$path_to_root}/gl/inquiry/profit_loss.php?TransFromDate=" . $from . "&TransToDate=" . $to . "&Compare=" . $compare . "&Dimension=" . $dimension . "&Dimension2=" . $dimension2 . "&AccGrp=" . $accounttype['id'] . "'>" . $accounttype['id'] . " " . $accounttype['name'] . "</a>"; alt_table_row_color($k); label_cell($url); amount_cell($TypeTotal[0] * $convert); amount_cell($TypeTotal[1] * $convert); amount_cell(Achieve($TypeTotal[0], $TypeTotal[1])); end_row(); } } //Print Class Summary start_row("class='inquirybg' style='font-weight:bold'"); label_cell(_('Total') . " " . $class["class_name"]); amount_cell($class_per_total * $convert); amount_cell($class_acc_total * $convert); amount_cell(Achieve($class_per_total, $class_acc_total)); end_row(); $salesper += $class_per_total; $salesacc += $class_acc_total; } start_row("class='inquirybg' style='font-weight:bold'"); label_cell(_('Calculated Return')); amount_cell($salesper * -1); amount_cell($salesacc * -1); amount_cell(achieve($salesper, $salesacc)); end_row(); } else { //Level Pointer : Global variable defined in order to control display of root global $levelptr; $levelptr = 0; $accounttype = get_account_type($_POST["AccGrp"]); $classid = $accounttype["class_id"]; $class = get_account_class($classid); $convert = get_class_type_convert($class["ctype"]); //Print Class Name table_section_title($_POST["AccGrp"] . " " . get_account_type_name($_POST["AccGrp"]), 4); echo $tableheader; $classtotal = display_type($accounttype["id"], $accounttype["name"], $from, $to, $begin, $end, $compare, $convert, $dec, $pdec, $rep, $dimension, $dimension2, $drilldown, $path_to_root); } end_table(1); // outer table div_end(); }
function display_balance_sheet() { global $path_to_root; $from = begin_fiscalyear(); $to = $_POST['TransToDate']; if (!isset($_POST['Dimension'])) { $_POST['Dimension'] = 0; } if (!isset($_POST['Dimension2'])) { $_POST['Dimension2'] = 0; } $dimension = $_POST['Dimension']; $dimension2 = $_POST['Dimension2']; $lconvert = $econvert = 1; if (isset($_POST["AccGrp"]) && strlen($_POST['AccGrp']) > 0) { $drilldown = 1; } else { $drilldown = 0; } // Root level div_start('balance_tbl'); start_table(TABLESTYLE, "width='30%'"); if (!$drilldown) { $equityclose = 0.0; $lclose = 0.0; $calculateclose = 0.0; $parent = -1; //Get classes for BS $classresult = get_account_classes(false, 1); while ($class = db_fetch($classresult)) { $classclose = 0.0; $convert = get_class_type_convert($class["ctype"]); $ctype = $class["ctype"]; $classname = $class["class_name"]; //Print Class Name table_section_title($class["class_name"]); //Get Account groups/types under this group/type $typeresult = get_account_types(false, $class['cid'], -1); while ($accounttype = db_fetch($typeresult)) { $TypeTotal = display_type($accounttype["id"], $accounttype["name"], $from, $to, $convert, $dimension, $dimension2, $drilldown, $path_to_root); //Print Summary if ($TypeTotal != 0) { $url = "<a href='{$path_to_root}/gl/inquiry/balance_sheet.php?TransFromDate=" . $from . "&TransToDate=" . $to . "&Dimension=" . $dimension . "&Dimension2=" . $dimension2 . "&AccGrp=" . $accounttype['id'] . "'>" . $accounttype['id'] . " " . $accounttype['name'] . "</a>"; alt_table_row_color($k); label_cell($url); amount_cell($TypeTotal * $convert); end_row(); } $classclose += $TypeTotal; } //Print Class Summary start_row("class='inquirybg' style='font-weight:bold'"); label_cell(_('Total') . " " . $class["class_name"]); amount_cell($classclose * $convert); end_row(); if ($ctype == CL_EQUITY) { $equityclose += $classclose; $econvert = $convert; } if ($ctype == CL_LIABILITIES) { $lclose += $classclose; $lconvert = $convert; } $calculateclose += $classclose; } if ($lconvert == 1) { $calculateclose *= -1; } //Final Report Summary $url = "<a href='{$path_to_root}/gl/inquiry/profit_loss.php?TransFromDate=" . $from . "&TransToDate=" . $to . "&Dimension=" . $dimension . "&Dimension2=" . $dimension2 . "&Compare=0'>" . _('Calculated Return') . "</a>"; start_row("class='inquirybg' style='font-weight:bold'"); label_cell($url); amount_cell($calculateclose); end_row(); start_row("class='inquirybg' style='font-weight:bold'"); label_cell(_('Total') . " " . _('Liabilities') . _(' and ') . _('Equities')); amount_cell($lclose * $lconvert + $equityclose * $econvert + $calculateclose); end_row(); } else { //Level Pointer : Global variable defined in order to control display of root global $levelptr; $levelptr = 0; $accounttype = get_account_type($_POST["AccGrp"]); $classid = $accounttype["class_id"]; $class = get_account_class($classid); $convert = get_class_type_convert($class["ctype"]); //Print Class Name table_section_title($_POST["AccGrp"] . " " . get_account_type_name($_POST["AccGrp"])); $classclose = display_type($accounttype["id"], $accounttype["name"], $from, $to, $convert, $dimension, $dimension2, $drilldown, $path_to_root); } end_table(1); // outer table div_end(); }
if ($dim == 2) { $th = array(_("Account Code"), _("Account Description"), _("Dimension") . " 1", _("Dimension") . " 2", _("Amount"), _("Memo")); } else { if ($dim == 1) { $th = array(_("Account Code"), _("Account Description"), _("Dimension"), _("Amount"), _("Memo")); } else { $th = array(_("Account Code"), _("Account Description"), _("Amount"), _("Memo")); } } table_header($th); $k = 0; //row colour counter $total_amount = 0; while ($item = db_fetch($items)) { if ($item["account"] != $to_trans["account_code"]) { alt_table_row_color($k); label_cell($item["account"]); label_cell($item["account_name"]); if ($dim >= 1) { label_cell(get_dimension_string($item['dimension_id'], true)); } if ($dim > 1) { label_cell(get_dimension_string($item['dimension2_id'], true)); } amount_cell(-$item["amount"]); label_cell($item["memo_"]); end_row(); $total_amount += $item["amount"]; } } label_row(_("Total"), number_format2(-$total_amount, user_price_dec()), "colspan=" . (2 + $dim) . " align=right", "align=right");
function display_credit_items() { start_form(); hidden('cart_id'); start_table(TABLESTYLE2, "width=80%", 5); echo "<tr><td>"; // outer table start_table(TABLESTYLE, "width=100%"); start_row(); label_cells(_("Customer"), $_SESSION['Items']->customer_name, "class='tableheader2'"); label_cells(_("Branch"), get_branch_name($_SESSION['Items']->Branch), "class='tableheader2'"); label_cells(_("Currency"), $_SESSION['Items']->customer_currency, "class='tableheader2'"); end_row(); start_row(); // if (!isset($_POST['ref'])) // $_POST['ref'] = $Refs->get_next(11); if ($_SESSION['Items']->trans_no == 0) { ref_cells(_("Reference"), 'ref', '', null, "class='tableheader2'"); } else { label_cells(_("Reference"), $_SESSION['Items']->reference, "class='tableheader2'"); } label_cells(_("Crediting Invoice"), get_customer_trans_view_str(ST_SALESINVOICE, array_keys($_SESSION['Items']->src_docs)), "class='tableheader2'"); if (!isset($_POST['ShipperID'])) { $_POST['ShipperID'] = $_SESSION['Items']->ship_via; } label_cell(_("Shipping Company"), "class='tableheader2'"); shippers_list_cells(null, 'ShipperID', $_POST['ShipperID']); // if (!isset($_POST['sales_type_id'])) // $_POST['sales_type_id'] = $_SESSION['Items']->sales_type; // label_cell(_("Sales Type"), "class='tableheader2'"); // sales_types_list_cells(null, 'sales_type_id', $_POST['sales_type_id']); end_row(); end_table(); echo "</td><td>"; // outer table start_table(TABLESTYLE, "width=100%"); if ($_SESSION['Items']->custom_num != '') { text_row(_("Credit Memo No."), 'custom_num', $_SESSION['Items']->custom_num, null, "class='tableheader2'"); } else { text_row(_("Credit Memo No."), 'custom_num', '', null, "class='tableheader2'"); } //moodlearning label_row(_("Invoice Date"), $_SESSION['Items']->src_date, "class='tableheader2'"); date_row(_("Credit Note Date"), 'CreditDate', '', $_SESSION['Items']->trans_no == 0, 0, 0, 0, "class='tableheader2'"); end_table(); echo "</td></tr>"; end_table(1); // outer table div_start('credit_items'); start_table(TABLESTYLE, "width=80%"); $th = array(_("Item Code"), _("Item Description"), _("Invoiced Quantity"), _("Units"), _("Credited"), _("Credit Quantity"), _("Price"), _("Discount %"), _("Total")); //Karen edited Credited table_header($th); $k = 0; //row colour counter foreach ($_SESSION['Items']->line_items as $line_no => $ln_itm) { if ($ln_itm->quantity == $ln_itm->qty_done) { continue; // this line was fully credited/removed } alt_table_row_color($k); // view_stock_status_cell($ln_itm->stock_id); alternative view label_cell($ln_itm->stock_id); text_cells(null, 'Line' . $line_no . 'Desc', $ln_itm->item_description, 30, 50); $dec = get_qty_dec($ln_itm->stock_id); qty_cell($ln_itm->quantity, false, $dec); label_cell($ln_itm->units); label_cell($ln_itm->qty_done); //Karen edited amount_cells(null, 'Line' . $line_no, number_format2($ln_itm->qty_dispatched, $dec), null, null, $dec); $line_total = $ln_itm->qty_dispatched * $ln_itm->price * (1 - $ln_itm->discount_percent); amount_cell($ln_itm->price); percent_cell($ln_itm->discount_percent * 100); amount_cell($line_total); end_row(); } if (!check_num('ChargeFreightCost')) { $_POST['ChargeFreightCost'] = price_format($_SESSION['Items']->freight_cost); } $colspan = 8; //Karen edited 7 start_row(); label_cell(_("Credit Shipping Cost"), "colspan={$colspan} align=right"); small_amount_cells(null, "ChargeFreightCost", price_format(get_post('ChargeFreightCost', 0))); end_row(); /*moodlearning*/ start_row(); label_cell(_("Bulk Discount"), "colspan={$colspan} align=right"); small_amount_cells(null, "bulk_dis", $_SESSION['Items']->bulk_discount); end_row(); /* */ $inv_items_total = $_SESSION['Items']->get_items_total_dispatch(); $discount = input_num('bulk_dis') / 100; $display_sub_total = price_format($inv_items_total + input_num($_POST['ChargeFreightCost'])); label_row(_("Sub-total"), $display_sub_total, "colspan={$colspan} align=right", "align=right"); $taxes = $_SESSION['Items']->get_taxes(input_num($_POST['ChargeFreightCost'])); $tax_total = display_edit_tax_items($taxes, $colspan, $_SESSION['Items']->tax_included); /*moodlearning*/ $total = $inv_items_total + input_num('ChargeFreightCost') + $tax_total; $tot = price_format($total - $total * $discount); /* */ $display_total = price_format($inv_items_total + input_num('ChargeFreightCost') + $tax_total); label_row(_("Credit Note Total"), $tot, "colspan={$colspan} align=right", "align=right"); //moodlearning edit $tot end_table(); div_end(); }