From 340b94e61a41673eddf12bba3815c3d8dfe68408 Mon Sep 17 00:00:00 2001 From: Joe Hunt Date: Fri, 4 Apr 2008 22:42:08 +0000 Subject: [PATCH] Removed annoying warnings in several reports. --- CHANGELOG.txt | 14 ++++++++ reporting/includes/pdf_report.inc | 30 ++++++++++------ reporting/rep102.php | 2 +- reporting/rep104.php | 28 +++++++-------- reporting/rep201.php | 2 +- reporting/rep203.php | 20 +++++------ reporting/rep705.php | 57 +++++++++++++------------------ reporting/rep706.php | 15 ++++---- reporting/rep707.php | 28 +++++++-------- reporting/rep709.php | 54 ++++++++++++++--------------- reporting/reports_main.php | 6 ++-- 11 files changed, 135 insertions(+), 121 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 5716d924..bced9063 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -19,6 +19,20 @@ Legend: ! -> Note $ -> Affected files +05-Apr-2008 Joe Hunt +# Removed annoying warnings in several reports. +$ config.php + /reporting/rep102.php + /reporting/rep104.php + /reporting/rep201.php + /reporting/rep203.php + /reporting/rep705.php + /reporting/rep706.php + /reporting/rep707.php + /reporting/rep709.php + /reporting/reports_main.php + /reporting/includes/pdf_report.inc + 04-Apr-2008 Janusz Dobrowolski # Javascript bugfix in selecting orders for template. $ /sales/inquiry/sales_orders_view.php diff --git a/reporting/includes/pdf_report.inc b/reporting/includes/pdf_report.inc index 71589758..b5ce162c 100644 --- a/reporting/includes/pdf_report.inc +++ b/reporting/includes/pdf_report.inc @@ -340,14 +340,15 @@ class FrontReport extends Cpdf $this->Text($mcol, $myrow['order_no'], $mcol + 90); else if ($doctype == 9) // SO $this->Text($mcol, $myrow['order_no'] ." ".$myrow['customer_ref'], $mcol + 90); - else // INV/CRE/STA + else if (isset($myrow['trans_no']) && isset($myrow['reference'])) // INV/CRE/STA { if ($print_invoice_no == 1) $this->Text($mcol, $myrow['trans_no'], $mcol + 90); else $this->Text($mcol, $myrow['reference'], $mcol + 90); } - $this->Text($mcol + 90, $myrow['debtor_no'], $mcol + 180); + if (isset($myrow['debtor_no'])) + $this->Text($mcol + 90, $myrow['debtor_no'], $mcol + 180); if ($doctype == 8 || $doctype == 9) $this->Text($mcol + 180, sql2date($myrow['ord_date'])); else @@ -364,7 +365,7 @@ class FrontReport extends Cpdf if ($doctype == 9) { $this->Text($ccol, $myrow['name'], $icol); - //$adr = ?; + $adr = array(); } else { @@ -395,12 +396,12 @@ class FrontReport extends Cpdf } $this->row = $iline2 - 2 * $this->lineHeight; $this->Text($ccol, $doc_Shipping_Company . ":", $ccol2); - if ($doctype != 8) + if ($doctype != 8 && isset($myrow['shipper_name'])) $this->Text($ccol2, $myrow['shipper_name'], $mcol); $this->Text($mcol, $doc_Due_Date . ":", $mcol2); if ($doctype == 9) $this->Text($mcol2, sql2date($myrow['delivery_date'])); - else if ($doctype != 8) + else if ($doctype != 8 && isset($myrow['due_date'])) $this->Text($mcol2, sql2date($myrow['due_date'])); if ($branch != null) { @@ -418,7 +419,7 @@ class FrontReport extends Cpdf } $this->NewLine(); $this->Text($ccol, $doc_Your_VAT_no . ":", $ccol2); - if ($doctype != 8) + if ($doctype != 8 && isset($myrow['tax_id'])) $this->Text($ccol2, $myrow['tax_id'], $mcol); $this->Text($mcol, $doc_Our_VAT_no . ":", $mcol2); $this->Text($mcol2, $this->company['gst_no']); @@ -432,7 +433,8 @@ class FrontReport extends Cpdf $this->Text($ccol2, $row["terms"], $mcol); $this->Text($mcol, $doc_Our_Order_No . ":", $mcol2); - $this->Text($mcol2, $myrow['order_']); + if (isset($myrow['order_'])) + $this->Text($mcol2, $myrow['order_']); $locale = $path_to_root . "lang/" . $_SESSION['language']->code . "/locale.inc"; if (file_exists($locale)) @@ -502,8 +504,12 @@ class FrontReport extends Cpdf $this->Text($ccol2 + 30, $this->company['email'], $mcol); // fetch this later $this->row = $adrline; - $this->Text($mcol, $bankaccount['bank_name'], $mcol2); - $adr = explode("\n", $bankaccount['bank_address']); + if (isset($bankaccount['bank_name'])) + $this->Text($mcol, $bankaccount['bank_name'], $mcol2); + if (isset($bankaccount['bank_address'])) + $adr = explode("\n", $bankaccount['bank_address']); + else + $adr = array(); for ($i = 0; $i < count($adr); $i++) { $this->NewLine(); @@ -511,9 +517,11 @@ class FrontReport extends Cpdf } $this->row = $adrline; - $this->Text($mcol2, $bankaccount['bank_account_name']); + if (isset($bankaccount['bank_account_name'])) + $this->Text($mcol2, $bankaccount['bank_account_name']); $this->NewLine(); - $this->Text($mcol2, $bankaccount['bank_account_number']); + if (isset($bankaccount['bank_account_number'])) + $this->Text($mcol2, $bankaccount['bank_account_number']); $this->row = $temp; } diff --git a/reporting/rep102.php b/reporting/rep102.php index e09bdefd..e3bf9d3f 100644 --- a/reporting/rep102.php +++ b/reporting/rep102.php @@ -159,7 +159,7 @@ function print_aged_customer_analysis() $rep->Info($params, $cols, $headers, $aligns); $rep->Header(); - $total = array(0,0,0,0); + $total = array(0,0,0,0, 0); $sql = "SELECT debtor_no, name, curr_code FROM ".TB_PREF."debtors_master "; if ($fromcust != reserved_words::get_all_numeric()) diff --git a/reporting/rep104.php b/reporting/rep104.php index 899da054..d78b79c6 100644 --- a/reporting/rep104.php +++ b/reporting/rep104.php @@ -21,7 +21,7 @@ include_once($path_to_root . "inventory/includes/db/items_category_db.inc"); // trial_inquiry_controls(); print_price_listing(); -function get_prices($category=0, $salestype=0) +function fetch_prices($category=0, $salestype=0) { $sql = "SELECT ".TB_PREF."prices.sales_type_id, ".TB_PREF."prices.stock_id, @@ -32,16 +32,16 @@ function get_prices($category=0, $salestype=0) ".TB_PREF."stock_master.material_cost+".TB_PREF."stock_master.labour_cost+".TB_PREF."stock_master.overhead_cost AS Standardcost, ".TB_PREF."stock_master.category_id, ".TB_PREF."stock_category.description - FROM ".TB_PREF."stock_master, + FROM ".TB_PREF."stock_master, ".TB_PREF."stock_category, ".TB_PREF."sales_types, ".TB_PREF."prices WHERE ".TB_PREF."stock_master.stock_id=".TB_PREF."prices.stock_id AND ".TB_PREF."prices.sales_type_id=".TB_PREF."sales_types.id AND ".TB_PREF."stock_master.category_id=".TB_PREF."stock_category.category_id"; - if ($salestype != null) + if ($salestype != 0) $sql .= " AND ".TB_PREF."sales_types.id = '$salestype'"; - if ($category != null) + if ($category != 0) $sql .= " AND ".TB_PREF."stock_category.category_id = '$category'"; $sql .= " ORDER BY ".TB_PREF."prices.curr_abrev, ".TB_PREF."stock_master.category_id, @@ -63,7 +63,7 @@ function print_price_listing() $pictures = $_POST['PARAM_2']; $showGP = $_POST['PARAM_3']; $comments = $_POST['PARAM_4']; - + $dec = user_price_dec(); if ($category == reserved_words::get_all_numeric()) @@ -84,11 +84,11 @@ function print_price_listing() $GP = _('Yes'); $cols = array(0, 100, 385, 450, 515); - + $headers = array(_('Category/Items'), _('Description'), _('Price'), _('GP %')); - + $aligns = array('left', 'left', 'right', 'right'); - + $params = array( 0 => $comments, 1 => array('text' => _('Category'), 'from' => $cat, 'to' => ''), 2 => array('text' => _('Sales Type'), 'from' => $stype, 'to' => ''), @@ -98,19 +98,19 @@ function print_price_listing() $user_comp = user_company(); else $user_comp = ""; - + $rep = new FrontReport(_('Price Listing'), "PriceListing.pdf", user_pagesize()); $rep->Font(); $rep->Info($params, $cols, $headers, $aligns); $rep->Header(); - $result = get_prices($category, $salestype); - + $result = fetch_prices($category, $salestype); + $currcode = ''; $catgor = ''; - while ($myrow=db_fetch($result)) + while ($myrow=db_fetch($result)) { if ($currcode != $myrow['curr_abrev']) { @@ -142,7 +142,7 @@ function print_price_listing() else $disp = 0.0; $rep->TextCol(3, 4, number_format2($disp, user_percent_dec()) . " %"); - } + } if ($pictures) { $image = $comp_path . '/'. $user_comp . "/images/" . $myrow['stock_id'] . ".jpg"; @@ -155,7 +155,7 @@ function print_price_listing() $rep->row -= $pic_height; $rep->NewLine(); } - } + } else $rep->NewLine(0, 1); } diff --git a/reporting/rep201.php b/reporting/rep201.php index 834ca6ce..92e85c04 100644 --- a/reporting/rep201.php +++ b/reporting/rep201.php @@ -84,7 +84,7 @@ function print_supplier_balances() $rep->Header(); $total = array(); - $grandtotal = array(); + $grandtotal = array(0,0,0,0); $sql = "SELECT supplier_id, supp_name AS name, curr_code FROM ".TB_PREF."suppliers "; if ($fromsupp != reserved_words::get_all_numeric()) diff --git a/reporting/rep203.php b/reporting/rep203.php index 34349967..625e3ce1 100644 --- a/reporting/rep203.php +++ b/reporting/rep203.php @@ -22,7 +22,7 @@ print_payment_report(); function getTransactions($supplier, $date) { $date = date2sql($date); - + $sql = "SELECT ".TB_PREF."sys_types.type_name, ".TB_PREF."supp_trans.supp_reference, ".TB_PREF."supp_trans.due_date, @@ -59,7 +59,7 @@ function print_payment_report() $from = _('All'); else $from = get_supplier_name($fromsupp); - + $dec = user_price_dec(); if ($currency == reserved_words::get_all()) @@ -89,17 +89,17 @@ function print_payment_report() $rep->Header(); $total = array(); - $grandtotal = array(); + $grandtotal = array(0,0); $sql = "SELECT supplier_id, supp_name AS name, curr_code, ".TB_PREF."payment_terms.terms FROM ".TB_PREF."suppliers, ".TB_PREF."payment_terms WHERE "; if ($fromsupp != reserved_words::get_all_numeric()) $sql .= "supplier_id=$fromsupp AND "; - $sql .= "".TB_PREF."suppliers.payment_terms = ".TB_PREF."payment_terms.terms_indicator + $sql .= "".TB_PREF."suppliers.payment_terms = ".TB_PREF."payment_terms.terms_indicator ORDER BY supp_name"; $result = db_query($sql, "The customers could not be retrieved"); - - while ($myrow=db_fetch($result)) + + while ($myrow=db_fetch($result)) { if (!$convert && $currency != $myrow['curr_code']) continue; @@ -118,14 +118,14 @@ function print_payment_report() if (db_num_rows($res)==0) continue; $rep->Line($rep->row + 4); - $total[0] = $total[1] = $total[2] = $total[3] = 0.0; + $total[0] = $total[1] = 0.0; while ($trans=db_fetch($res)) { $rep->NewLine(1, 2); $rep->TextCol(0, 1, $trans['type_name']); $rep->TextCol(1, 2, $trans['supp_reference']); $rep->TextCol(2, 3, sql2date($trans['due_date'])); - $item[0] = Abs($trans['TranTotal']) * $rate; + $item[0] = Abs($trans['TranTotal']) * $rate; $rep->TextCol(6, 7, number_format2($item[0], $dec)); $item[1] = $trans['Balance'] * $rate; $rep->TextCol(7, 8, number_format2($item[1], $dec)); @@ -133,7 +133,7 @@ function print_payment_report() { $total[$i] += $item[$i]; $grandtotal[$i] += $item[$i]; - } + } } $rep->Line($rep->row - 8); $rep->NewLine(2); @@ -142,7 +142,7 @@ function print_payment_report() { $rep->TextCol($i + 6, $i + 7, number_format2($total[$i], $dec)); $total[$i] = 0.0; - } + } $rep->Line($rep->row - 4); $rep->NewLine(2); } diff --git a/reporting/rep705.php b/reporting/rep705.php index 2c5ce3f5..86674fe3 100644 --- a/reporting/rep705.php +++ b/reporting/rep705.php @@ -99,7 +99,7 @@ function print_annual_expense_breakdown() $cols = array(0, 40, 150, 180, 210, 240, 270, 300, 330, 360, 390, 420, 450, 480, 510); //------------0--1---2----3----4----5----6----7----8----10---11---12---13---14---15- - + //$yr = date('Y'); //$mo = date('m'): // from now @@ -108,7 +108,7 @@ function print_annual_expense_breakdown() $da = 1; if ($date_system == 1) list($yr, $mo, $da) = jalali_to_gregorian($yr, $mo, $da); - else if ($date_system == 2) + elseif ($date_system == 2) list($yr, $mo, $da) = islamic_to_gregorian($yr, $mo, $da); $per12 = strftime('%b',mktime(0,0,0,$mo,$da,$yr)); $per11 = strftime('%b',mktime(0,0,0,$mo-1,$da,$yr)); @@ -122,21 +122,21 @@ function print_annual_expense_breakdown() $per03 = strftime('%b',mktime(0,0,0,$mo-9,$da,$yr)); $per02 = strftime('%b',mktime(0,0,0,$mo-10,$da,$yr)); $per01 = strftime('%b',mktime(0,0,0,$mo-11,$da,$yr)); - + $headers = array(_('Account'), _('Account Name'), $per01, $per02, $per03, $per04, $per05, $per06, $per07, $per08, $per09, $per10, $per11, $per12); - + $aligns = array('left', 'left', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right'); - + if ($dim == 2) { $params = array( 0 => $comments, - 1 => array('text' => _("Year"), + 1 => array('text' => _("Year"), 'from' => $year, 'to' => ''), - 2 => array('text' => _("Dimension")." 1", + 2 => array('text' => _("Dimension")." 1", 'from' => get_dimension_string($dimension), 'to' => ''), - 3 => array('text' => _("Dimension")." 2", + 3 => array('text' => _("Dimension")." 2", 'from' => get_dimension_string($dimension2), 'to' => ''), 4 => array('text' => _('Info'), 'from' => _('Amounts in thousands'), 'to' => '')); @@ -144,9 +144,9 @@ function print_annual_expense_breakdown() else if ($dim == 1) { $params = array( 0 => $comments, - 1 => array('text' => _("Year"), + 1 => array('text' => _("Year"), 'from' => $year, 'to' => ''), - 2 => array('text' => _('Dimension'), + 2 => array('text' => _('Dimension'), 'from' => get_dimension_string($dimension), 'to' => ''), 3 => array('text' => _('Info'), 'from' => _('Amounts in thousands'), 'to' => '')); @@ -154,7 +154,7 @@ function print_annual_expense_breakdown() else { $params = array( 0 => $comments, - 1 => array('text' => _("Year"), + 1 => array('text' => _("Year"), 'from' => $year, 'to' => ''), 2 => array('text' => _('Info'), 'from' => _('Amounts in thousands'), 'to' => '')); @@ -168,30 +168,21 @@ function print_annual_expense_breakdown() $classname = ''; $group = ''; - $total = Array(); - $total2 = Array(); - $sales = Array(); - $calc = Array(); - unset($total); - unset($total2); - unset($sales); - unset($calc); + $total = Array(1 => 0,0,0,0,0,0,0,0,0,0,0,0); + $total2 = Array(1 => 0,0,0,0,0,0,0,0,0,0,0,0); + $sales = Array(1 => 0,0,0,0,0,0,0,0,0,0,0,0); + $calc = Array(1 => 0,0,0,0,0,0,0,0,0,0,0,0); $accounts = get_gl_accounts_all(0); while ($account = db_fetch($accounts)) { $bal = getPeriods($year, $account["account_code"], $dimension, $dimension2); - if (!$bal['per01'] && !$bal['per02'] && !$bal['per03'] && !$bal['per04'] && - !$bal['per05'] && !$bal['per06'] && !$bal['per07'] && !$bal['per08'] && + if (!$bal['per01'] && !$bal['per02'] && !$bal['per03'] && !$bal['per04'] && + !$bal['per05'] && !$bal['per06'] && !$bal['per07'] && !$bal['per08'] && !$bal['per09'] && !$bal['per10'] && !$bal['per11'] && !$bal['per12']) continue; - //if (array_sum($bal) == 0.0) - //$i = 1; - //foreach ($bal as $b) - // $balance[$i++] = $b; - //$balance = $bal; - $balance = Array(1 => $bal['per01'], $bal['per02'], $bal['per03'], $bal['per04'], - $bal['per05'], $bal['per06'], $bal['per07'], $bal['per08'], + $balance = array(1 => $bal['per01'], $bal['per02'], $bal['per03'], $bal['per04'], + $bal['per05'], $bal['per06'], $bal['per07'], $bal['per08'], $bal['per09'], $bal['per10'], $bal['per11'], $bal['per12']); if ($account['AccountClassName'] != $classname) { @@ -210,7 +201,7 @@ function print_annual_expense_breakdown() $rep->TextCol(0, 2, _('Total') . " " . $group); for ($i = 1; $i <= 12; $i++) $rep->TextCol($i + 1, $i + 2, number_format2($total[$i], $dec)); - unset($total); + $total = Array(1 => 0,0,0,0,0,0,0,0,0,0,0,0); $rep->row -= ($rep->lineHeight + 4); if ($closeclass) { @@ -222,9 +213,9 @@ function print_annual_expense_breakdown() { $rep->TextCol($i + 1, $i + 2, number_format2($total2[$i], $dec)); $sales[$i] += $total2[$i]; - } + } $rep->Font(); - unset($total2); + $total2 = Array(1 => 0,0,0,0,0,0,0,0,0,0,0,0); $rep->NewLine(3); $closeclass = false; } @@ -249,7 +240,7 @@ function print_annual_expense_breakdown() $rep->TextCol($i + 1, $i + 2, number_format2($balance[$i], $dec)); $total[$i] += $balance[$i]; $total2[$i] += $balance[$i]; - } + } $rep->NewLine(); @@ -287,7 +278,7 @@ function print_annual_expense_breakdown() { $rep->TextCol($i + 1, $i + 2, number_format2($total2[$i], $dec)); $calc[$i] = $sales[$i] + $total2[$i]; - } + } $rep->row -= ($rep->lineHeight + 8); $rep->TextCol(0, 2, _('Calculated Return')); diff --git a/reporting/rep706.php b/reporting/rep706.php index 68b52f98..9917bf53 100644 --- a/reporting/rep706.php +++ b/reporting/rep706.php @@ -54,17 +54,17 @@ function print_balance_sheet() { include_once($path_to_root . "reporting/includes/class.graphic.inc"); $pg = new graph(); - } + } $dec = 0; $cols = array(0, 50, 200, 350, 425, 500); //------------0--1---2----3----4----5-- - + $headers = array(_('Account'), _('Account Name'), _('Open Balance'), _('Period'), _('Close Balance')); - + $aligns = array('left', 'left', 'right', 'right', 'right'); - + if ($dim == 2) { $params = array( 0 => $comments, @@ -104,6 +104,7 @@ function print_balance_sheet() $assetsopen = 0.0; $assetsperiod = 0.0; $assetsclose = 0.0; + $closeclass = false; $accounts = get_gl_accounts_all(1); @@ -138,7 +139,7 @@ function print_balance_sheet() { $pg->x[] = $group; $pg->y[] = abs($totalclose); - } + } $totalopen = $totalperiod = $totalclose = 0.0; $rep->row -= ($rep->lineHeight + 4); if ($closeclass) @@ -215,7 +216,7 @@ function print_balance_sheet() { $pg->x[] = $group; $pg->y[] = abs($totalclose); - } + } $rep->row -= ($rep->lineHeight + 4); if ($closeclass) { @@ -233,7 +234,7 @@ function print_balance_sheet() { $pg->x[] = _('Calculated Return'); $pg->y[] = abs($calculateclose); - } + } $rep->row -= ($rep->lineHeight + 4); $rep->Font('bold'); diff --git a/reporting/rep707.php b/reporting/rep707.php index 1228e10b..9d2f0d2c 100644 --- a/reporting/rep707.php +++ b/reporting/rep707.php @@ -31,8 +31,8 @@ function Achieve($d1, $d2) if ($ret > 999) $ret = 999; return $ret; -} - +} + //---------------------------------------------------------------------------------------------------- function print_profit_and_loss_statement() @@ -68,17 +68,17 @@ function print_profit_and_loss_statement() { include_once($path_to_root . "reporting/includes/class.graphic.inc"); $pg = new graph(); - } + } $dec = 0; $pdec = user_percent_dec(); $cols = array(0, 50, 200, 350, 425, 500); //------------0--1---2----3----4----5-- - + $headers = array(_('Account'), _('Account Name'), _('Period'), _('Accumulated'), _('Achieved %')); - + $aligns = array('left', 'left', 'right', 'right', 'right'); - + if ($dim == 2) { $params = array( 0 => $comments, @@ -140,14 +140,14 @@ function print_profit_and_loss_statement() while ($account=db_fetch($accounts)) { $per_balance = get_gl_trans_from_to($from, $to, $account["account_code"], $dimension, $dimension2); - + if ($compare == 2) $acc_balance = get_budget_trans_from_to($begin, $end, $account["account_code"], $dimension, $dimension2); else $acc_balance = get_gl_trans_from_to($begin, $end, $account["account_code"], $dimension, $dimension2); if (!$per_balance && !$acc_balance) continue; - + if ($account['AccountClassName'] != $classname) { if ($classname != '') @@ -171,7 +171,7 @@ function print_profit_and_loss_statement() $pg->x[] = $group; $pg->y[] = abs($totalper); $pg->z[] = abs($totalacc); - } + } $totalper = $totalacc = 0.0; $rep->row -= ($rep->lineHeight + 4); if ($closeclass) @@ -204,7 +204,7 @@ function print_profit_and_loss_statement() $rep->row -= ($rep->lineHeight + 4); } $classname = $account['AccountClassName']; - + $per_balance *= -1; $acc_balance *= -1; $totalper += $per_balance; @@ -248,7 +248,7 @@ function print_profit_and_loss_statement() $pg->x[] = $group; $pg->y[] = abs($totalper); $pg->z[] = abs($totalacc); - } + } $rep->row -= ($rep->lineHeight + 4); if ($closeclass) { @@ -273,8 +273,8 @@ function print_profit_and_loss_statement() $pg->x[] = _('Calculated Return'); $pg->y[] = abs($calculateper); $pg->z[] = abs($calculateacc); - } - + } + $rep->Font(); $rep->NewLine(); @@ -295,7 +295,7 @@ function print_profit_and_loss_statement() $pg->built_in = false; $pg->fontfile = $path_to_root . "reporting/fonts/Vera.ttf"; $pg->latin_notation = ($decseps[$_SESSION["wa_current_user"]->prefs->dec_sep()] != "."); - $filename = $comp_path.'/'.user_company(). ."/pdf_files/test.png"; + $filename = $comp_path.'/'.user_company(). "/pdf_files/test.png"; $pg->display($filename, true); $w = $pg->width / 1.5; $h = $pg->height / 1.5; diff --git a/reporting/rep709.php b/reporting/rep709.php index 1321d1ea..f0ebaf93 100644 --- a/reporting/rep709.php +++ b/reporting/rep709.php @@ -23,7 +23,7 @@ function getCustTransactions($from, $to) { $fromdate = date2sql($from); $todate = date2sql($to); - + $sql = "SELECT ".TB_PREF."debtor_trans.reference, ".TB_PREF."debtor_trans.type, ".TB_PREF."sys_types.type_name, @@ -51,7 +51,7 @@ function getSuppTransactions($from, $to) { $fromdate = date2sql($from); $todate = date2sql($to); - + $sql = "SELECT ".TB_PREF."supp_trans.supp_reference, ".TB_PREF."supp_trans.type, ".TB_PREF."sys_types.type_name, @@ -91,7 +91,7 @@ function getCustInvTax($taxtype, $from, $to) { $fromdate = date2sql($from); $todate = date2sql($to); - + $sql = "SELECT SUM(unit_price * quantity*".TB_PREF."debtor_trans.rate), SUM(amount*".TB_PREF."debtor_trans.rate) FROM ".TB_PREF."debtor_trans_details, ".TB_PREF."debtor_trans_tax_details, ".TB_PREF."debtor_trans WHERE ".TB_PREF."debtor_trans_details.debtor_trans_type>=10 @@ -112,8 +112,8 @@ function getSuppInvTax($taxtype, $from, $to) { $fromdate = date2sql($from); $todate = date2sql($to); - - $sql = "SELECT SUM(unit_price * quantity * ".TB_PREF."supp_trans.rate), SUM(amount*".TB_PREF."supp_trans.rate) + + $sql = "SELECT SUM(unit_price * quantity * ".TB_PREF."supp_trans.rate), SUM(amount*".TB_PREF."supp_trans.rate) FROM ".TB_PREF."supp_invoice_items, ".TB_PREF."supp_invoice_tax_items, ".TB_PREF."supp_trans WHERE ".TB_PREF."supp_invoice_items.supp_trans_type>=20 AND ".TB_PREF."supp_invoice_items.supp_trans_type<=21 @@ -138,19 +138,19 @@ function print_tax_report() include_once($path_to_root . "reporting/includes/pdf_report.inc"); $rep = new FrontReport(_('Tax Report'), "TaxReport.pdf", user_pagesize()); - + $from = $_POST['PARAM_0']; $to = $_POST['PARAM_1']; $summaryOnly = $_POST['PARAM_2']; $comments = $_POST['PARAM_3']; $dec = user_price_dec(); - + if ($summaryOnly == 1) $summary = _('Summary Only'); else $summary = _('Detailed Report'); - - + + $res = getTaxTypes(); $taxes = array(); @@ -158,21 +158,21 @@ function print_tax_report() while ($tax=db_fetch($res)) $taxes[$i++] = $tax['id']; $idcounter = count($taxes); - - $totalinvout = array(); - $totaltaxout = array(); - $totalinvin = array(); - $totaltaxin = array(); - + + $totalinvout = array(0,0,0,0,0,0,0,0,0,0); + $totaltaxout = array(0,0,0,0,0,0,0,0,0,0); + $totalinvin = array(0,0,0,0,0,0,0,0,0,0); + $totaltaxin = array(0,0,0,0,0,0,0,0,0,0); + if (!$summaryOnly) { $cols = array(0, 80, 130, 190, 290, 370, 435, 500, 565); - + $headers = array(_('Trans Type'), _('#'), _('Date'), _('Name'), _('Branch Name'), _('Net'), _('Tax')); - + $aligns = array('left', 'left', 'left', 'left', 'left', 'right', 'right'); - + $params = array( 0 => $comments, 1 => array('text' => _('Period'), 'from' => $from, 'to' => $to), 2 => array('text' => _('Type'), 'from' => $summary, 'to' => '')); @@ -201,7 +201,7 @@ function print_tax_report() $rep->TextCol(6, 7, number_format2($trans['Tax'], $dec)); $rep->NewLine(); - + if ($rep->row < $rep->bottomMargin + $rep->lineHeight) { $rep->Line($rep->row - 2); @@ -230,7 +230,7 @@ function print_tax_report() } $totalinnet = 0.0; $totalintax = 0.0; - + $transactions = getSuppTransactions($from, $to); while ($trans=db_fetch($transactions)) @@ -271,12 +271,12 @@ function print_tax_report() $rep->Line($rep->row - 5); } $cols2 = array(0, 100, 200, 300, 400, 500, 600); - + $headers2 = array(_('Tax Rate'), _('Outputs'), _('Output Tax'), _('Inputs'), _('Input Tax')); - + $aligns2 = array('left', 'right', 'right', 'right', 'right'); - - $invamount = 0.0; + + $invamount = 0.0; for ($i = 0; $i < $idcounter; $i++) { $amt = getCustInvTax($taxes[$i], $from, $to); @@ -296,7 +296,7 @@ function print_tax_report() if ($totalinnet != $invamount) $totalinvin[$idcounter] = ($totalinnet - $invamount); - for ($i = 0; $i < count($cols2); $i++) + for ($i = 0; $i < count($cols2) - 2; $i++) { $rep->cols[$i] = $rep->leftMargin + $cols2[$i]; $rep->headers[$i] = $headers2[$i]; @@ -348,7 +348,7 @@ function print_tax_report() $rep->NewLine(); } $rep->Line($rep->row - 4); - + $locale = $path_to_root . "lang/" . $_SESSION['language']->code . "/locale.inc"; if (file_exists($locale)) { @@ -357,7 +357,7 @@ function print_tax_report() /* if (function_exists("TaxFunction")) TaxFunction(); - */ + */ } $rep->End(); } diff --git a/reporting/reports_main.php b/reporting/reports_main.php index 97b97da1..c2d340ed 100644 --- a/reporting/reports_main.php +++ b/reporting/reports_main.php @@ -138,9 +138,9 @@ if ($dim > 0) new ReportParam(_('To Dimension'),'DIMENSION'), new ReportParam(_('Show Balance'),'YES_NO'), new ReportParam(_('Comments'),'TEXTBOX'))); - $reports->addReport(_('Dimensions'),502,_('Dimension Details'), - array( new ReportParam(_('Dimension'),'DIMENSIONS'), - new ReportParam(_('Comments'),'TEXTBOX'))); + //$reports->addReport(_('Dimensions'),502,_('Dimension Details'), + //array( new ReportParam(_('Dimension'),'DIMENSIONS'), + // new ReportParam(_('Comments'),'TEXTBOX'))); } $reports->addReportClass(_('Banking')); //$reports->addReport(_('Banking'),601,_('Bank Account Transactions'), -- 2.30.2