From 4d7c45a8b4f45cfa34b8dc57eef2a1295949c090 Mon Sep 17 00:00:00 2001 From: Janusz Dobrowolski Date: Sat, 9 Apr 2011 12:15:20 +0200 Subject: [PATCH] EOL formatting cleanup. --- gl/inquiry/gl_trial_balance.php | 186 +++++++++++----------- reporting/rep114.php | 72 ++++----- reporting/rep701.php | 22 +-- reporting/rep708.php | 228 +++++++++++++-------------- reporting/rep709.php | 20 +-- sales/includes/db/sales_order_db.inc | 8 +- 6 files changed, 268 insertions(+), 268 deletions(-) diff --git a/gl/inquiry/gl_trial_balance.php b/gl/inquiry/gl_trial_balance.php index 90bc1f2..0b08c69 100644 --- a/gl/inquiry/gl_trial_balance.php +++ b/gl/inquiry/gl_trial_balance.php @@ -27,11 +27,11 @@ if ($use_date_picker) page(_($help_context = "Trial Balance"), false, false, "", $js); -$k = 0; -$pdeb = $pcre = $cdeb = $ccre = $tdeb = $tcre = $pbal = $cbal = $tbal = 0; -$cls_pdeb = $cls_pcre = $cls_cdeb = $cls_ccre = $cls_tdeb = $cls_tcre = $cls_pbal = $cls_cbal = $cls_tbal = 0; -$grp_pdeb = $grp_pcre = $grp_cdeb = $grp_ccre = $grp_tdeb = $grp_tcre = $grp_pbal = $grp_cbal = $grp_tbal = 0; - +$k = 0; +$pdeb = $pcre = $cdeb = $ccre = $tdeb = $tcre = $pbal = $cbal = $tbal = 0; +$cls_pdeb = $cls_pcre = $cls_cdeb = $cls_ccre = $cls_tdeb = $cls_tcre = $cls_pbal = $cls_cbal = $cls_tbal = 0; +$grp_pdeb = $grp_pcre = $grp_cdeb = $grp_ccre = $grp_tdeb = $grp_tcre = $grp_pbal = $grp_cbal = $grp_tbal = 0; + //---------------------------------------------------------------------------------------------------- // Ajax updates // @@ -64,19 +64,19 @@ function gl_inquiry_controls() //---------------------------------------------------------------------------------------------------- -function display_trial_balance($type, $typename) +function display_trial_balance($type, $typename) { global $path_to_root; - - global $k, $pdeb, $pcre, $cdeb, $ccre, $tdeb, $tcre, $pbal, $cbal, $tbal; - $printtitle = 0; //Flag for printing type name + + global $k, $pdeb, $pcre, $cdeb, $ccre, $tdeb, $tcre, $pbal, $cbal, $tbal; + $printtitle = 0; //Flag for printing type name $k = 0; - //$accounts = get_gl_accounts(); - //Get Accounts directly under this group/type - $accounts = get_gl_accounts(null, null, $type); - + //$accounts = get_gl_accounts(); + //Get Accounts directly under this group/type + $accounts = get_gl_accounts(null, null, $type); + $pdeb = $pcre = $cdeb = $ccre = $tdeb = $tcre = $pbal = $cbal = $tbal = 0; $begin = begin_fiscalyear(); if (date1_greater_date2($begin, $_POST['TransFromDate'])) @@ -85,15 +85,15 @@ function display_trial_balance($type, $typename) while ($account = db_fetch($accounts)) { - //Print Type Title if it has atleast one non-zero account - if (!$printtitle) - { - start_row("class='inquirybg' style='font-weight:bold'"); - label_cell("Group - ".$type ." - ".$typename, "colspan=8"); - end_row(); - $printtitle = 1; - } - + //Print Type Title if it has atleast one non-zero account + if (!$printtitle) + { + start_row("class='inquirybg' style='font-weight:bold'"); + label_cell("Group - ".$type ." - ".$typename, "colspan=8"); + end_row(); + $printtitle = 1; + } + $prev = get_balance($account["account_code"], $_POST['Dimension'], $_POST['Dimension2'], $begin, $_POST['TransFromDate'], false, false); $curr = get_balance($account["account_code"], $_POST['Dimension'], $_POST['Dimension2'], $_POST['TransFromDate'], $_POST['TransToDate'], true, true); $tot = get_balance($account["account_code"], $_POST['Dimension'], $_POST['Dimension2'], $begin, $_POST['TransToDate'], false, true); @@ -133,76 +133,76 @@ function display_trial_balance($type, $typename) end_row(); } - //Get Account groups/types under this group/type - $result = get_account_types(false, false, $type); - while ($accounttype=db_fetch($result)) - { - //Print Type Title if has sub types and not previously printed - if (!$printtitle) - { - start_row("class='inquirybg' style='font-weight:bold'"); - label_cell("Group - ".$type ." - ".$typename, "colspan=8"); - end_row(); - $printtitle = 1; - } - display_trial_balance($accounttype["id"], $accounttype["name"].' ('.$typename.')'); - } -} - -//---------------------------------------------------------------------------------------------------- - -gl_inquiry_controls(); - -if (isset($_POST['TransFromDate'])) -{ - $row = get_current_fiscalyear(); - if (date1_greater_date2($_POST['TransFromDate'], sql2date($row['end']))) - { - display_error(_("The from date cannot be bigger than the fiscal year end.")); - set_focus('TransFromDate'); - return; - } -} -div_start('balance_tbl'); -if (!isset($_POST['Dimension'])) - $_POST['Dimension'] = 0; -if (!isset($_POST['Dimension2'])) - $_POST['Dimension2'] = 0; -start_table(TABLESTYLE); -$tableheader = " - " . _("Account") . " - " . _("Account Name") . " - " . _("Brought Forward") . " - " . _("This Period") . " - " . _("Balance") . " - - " . _("Debit") . " - " . _("Credit") . " - " . _("Debit") . " - " . _("Credit") . " - " . _("Debit") . " - " . _("Credit") . " - "; - -echo $tableheader; - -//display_trial_balance(); - -$classresult = get_account_classes(false); -while ($class = db_fetch($classresult)) -{ - start_row("class='inquirybg' style='font-weight:bold'"); - label_cell("Class - ".$class['cid'] ." - ".$class['class_name'], "colspan=8"); - end_row(); - - //Get Account groups/types under this group/type with no parents - $typeresult = get_account_types(false, $class['cid'], -1); - while ($accounttype=db_fetch($typeresult)) - { - display_trial_balance($accounttype["id"], $accounttype["name"]); - } -} - + //Get Account groups/types under this group/type + $result = get_account_types(false, false, $type); + while ($accounttype=db_fetch($result)) + { + //Print Type Title if has sub types and not previously printed + if (!$printtitle) + { + start_row("class='inquirybg' style='font-weight:bold'"); + label_cell("Group - ".$type ." - ".$typename, "colspan=8"); + end_row(); + $printtitle = 1; + } + display_trial_balance($accounttype["id"], $accounttype["name"].' ('.$typename.')'); + } +} + +//---------------------------------------------------------------------------------------------------- + +gl_inquiry_controls(); + +if (isset($_POST['TransFromDate'])) +{ + $row = get_current_fiscalyear(); + if (date1_greater_date2($_POST['TransFromDate'], sql2date($row['end']))) + { + display_error(_("The from date cannot be bigger than the fiscal year end.")); + set_focus('TransFromDate'); + return; + } +} +div_start('balance_tbl'); +if (!isset($_POST['Dimension'])) + $_POST['Dimension'] = 0; +if (!isset($_POST['Dimension2'])) + $_POST['Dimension2'] = 0; +start_table(TABLESTYLE); +$tableheader = " + " . _("Account") . " + " . _("Account Name") . " + " . _("Brought Forward") . " + " . _("This Period") . " + " . _("Balance") . " + + " . _("Debit") . " + " . _("Credit") . " + " . _("Debit") . " + " . _("Credit") . " + " . _("Debit") . " + " . _("Credit") . " + "; + +echo $tableheader; + +//display_trial_balance(); + +$classresult = get_account_classes(false); +while ($class = db_fetch($classresult)) +{ + start_row("class='inquirybg' style='font-weight:bold'"); + label_cell("Class - ".$class['cid'] ." - ".$class['class_name'], "colspan=8"); + end_row(); + + //Get Account groups/types under this group/type with no parents + $typeresult = get_account_types(false, $class['cid'], -1); + while ($accounttype=db_fetch($typeresult)) + { + display_trial_balance($accounttype["id"], $accounttype["name"]); + } +} + //$prev = get_balance(null, $begin, $_POST['TransFromDate'], false, false); //$curr = get_balance(null, $_POST['TransFromDate'], $_POST['TransToDate'], true, true); //$tot = get_balance(null, $begin, $_POST['TransToDate'], false, true); @@ -227,7 +227,7 @@ while ($class = db_fetch($classresult)) end_table(1); if (($pbal = round2($pbal, user_price_dec())) != 0) - //display_warning(_("The Opening Balance is not in balance, probably due to a non closed Previous Fiscalyear.")); + //display_warning(_("The Opening Balance is not in balance, probably due to a non closed Previous Fiscalyear.")); div_end(); //---------------------------------------------------------------------------------------------------- diff --git a/reporting/rep114.php b/reporting/rep114.php index 1173598..da79d08 100644 --- a/reporting/rep114.php +++ b/reporting/rep114.php @@ -32,21 +32,21 @@ function getTaxTransactions($from, $to, $tax_id) { $fromdate = date2sql($from); $todate = date2sql($to); - + $sql = "SELECT d.debtor_no, d.name AS cust_name, d.tax_id, CASE WHEN net_amount IS NULL OR amount=0 THEN SUM(CASE WHEN dt.type=".ST_CUSTCREDIT." THEN (ov_amount+ov_freight+ov_discount)*-1 ELSE (ov_amount+ov_freight+ov_discount) END *dt.rate) ELSE SUM(CASE WHEN dt.type=".ST_CUSTCREDIT." THEN -net_amount ELSE net_amount END *ex_rate) END AS total, - SUM(CASE WHEN dt.type=".ST_CUSTCREDIT." THEN -amount ELSE amount END *ex_rate) AS tax - FROM ".TB_PREF."debtor_trans dt - LEFT JOIN ".TB_PREF."debtors_master d ON d.debtor_no=dt.debtor_no - LEFT JOIN ".TB_PREF."trans_tax_details t ON (t.trans_type=dt.type AND t.trans_no=dt.trans_no) - WHERE (dt.type=".ST_SALESINVOICE." OR dt.type=".ST_CUSTCREDIT.") "; - if ($tax_id) - $sql .= "AND tax_id<>'' "; - $sql .= "AND dt.tran_date >=".db_escape($fromdate)." AND dt.tran_date<=".db_escape($todate)." - GROUP BY d.debtor_no, d.name, d.tax_id ORDER BY d.name"; + SUM(CASE WHEN dt.type=".ST_CUSTCREDIT." THEN -amount ELSE amount END *ex_rate) AS tax + FROM ".TB_PREF."debtor_trans dt + LEFT JOIN ".TB_PREF."debtors_master d ON d.debtor_no=dt.debtor_no + LEFT JOIN ".TB_PREF."trans_tax_details t ON (t.trans_type=dt.type AND t.trans_no=dt.trans_no) + WHERE (dt.type=".ST_SALESINVOICE." OR dt.type=".ST_CUSTCREDIT.") "; + if ($tax_id) + $sql .= "AND tax_id<>'' "; + $sql .= "AND dt.tran_date >=".db_escape($fromdate)." AND dt.tran_date<=".db_escape($todate)." + GROUP BY d.debtor_no, d.name, d.tax_id ORDER BY d.name"; return db_query($sql,"No transactions were returned"); } @@ -54,18 +54,18 @@ function getTaxTransactions($from, $to, $tax_id) function print_sales_summary_report() { - global $path_to_root; + global $path_to_root; $from = $_POST['PARAM_0']; $to = $_POST['PARAM_1']; - $tax_id = $_POST['PARAM_2']; + $tax_id = $_POST['PARAM_2']; $comments = $_POST['PARAM_3']; $destination = $_POST['PARAM_4']; - if ($tax_id == 0) - $tid = _('No'); - else - $tid = _('Yes'); - + if ($tax_id == 0) + $tid = _('No'); + else + $tid = _('Yes'); + if ($destination) include_once($path_to_root . "/reporting/includes/excel_report.inc"); @@ -80,10 +80,10 @@ function print_sales_summary_report() 1 => array('text' => _('Period'), 'from' => $from, 'to' => $to), 2 => array( 'text' => _('Tax Id Only'),'from' => $tid,'to' => '')); - $cols = array(0, 130, 180, 270, 350, 500); + $cols = array(0, 130, 180, 270, 350, 500); - $headers = array(_('Customer'), _('Tax Id'), _('Total ex. Tax'), _('Tax')); - $aligns = array('left', 'left', 'right', 'right'); + $headers = array(_('Customer'), _('Tax Id'), _('Total ex. Tax'), _('Tax')); + $aligns = array('left', 'left', 'right', 'right'); $rep->Font(); $rep->Info($params, $cols, $headers, $aligns); $rep->NewPage(); @@ -91,9 +91,9 @@ function print_sales_summary_report() $totalnet = 0.0; $totaltax = 0.0; $transactions = getTaxTransactions($from, $to, $tax_id); - - $rep->TextCol(0, 4, _("Values in domestic currency")); - $rep->NewLine(2); + + $rep->TextCol(0, 4, _("Values in domestic currency")); + $rep->NewLine(2); while ($trans=db_fetch($transactions)) { @@ -101,9 +101,9 @@ function print_sales_summary_report() $rep->TextCol(1, 2, $trans['tax_id']); $rep->AmountCol(2, 3, $trans['total'], $dec); $rep->AmountCol(3, 4, $trans['tax'], $dec); - $totalnet += $trans['total']; - $totaltax += $trans['tax']; - + $totalnet += $trans['total']; + $totaltax += $trans['tax']; + $rep->NewLine(); if ($rep->row < $rep->bottomMargin + $rep->lineHeight) @@ -112,16 +112,16 @@ function print_sales_summary_report() $rep->NewPage(); } } - - $rep->Font('bold'); - $rep->NewLine(); - $rep->Line($rep->row + $rep->lineHeight); - $rep->TextCol(0, 2, _("Total")); - $rep->AmountCol(2, 3, $totalnet, $dec); - $rep->AmountCol(3, 4, $totaltax, $dec); - $rep->Line($rep->row - 5); - $rep->Font(); - + + $rep->Font('bold'); + $rep->NewLine(); + $rep->Line($rep->row + $rep->lineHeight); + $rep->TextCol(0, 2, _("Total")); + $rep->AmountCol(2, 3, $totalnet, $dec); + $rep->AmountCol(3, 4, $totaltax, $dec); + $rep->Line($rep->row - 5); + $rep->Font(); + $rep->End(); } diff --git a/reporting/rep701.php b/reporting/rep701.php index 8a86114..30e6aa0 100644 --- a/reporting/rep701.php +++ b/reporting/rep701.php @@ -25,7 +25,7 @@ include_once($path_to_root . "/gl/includes/gl_db.inc"); //---------------------------------------------------------------------------------------------------- -function display_type ($type, $typename, &$dec, &$rep, $showbalance, $level) +function display_type ($type, $typename, &$dec, &$rep, $showbalance, $level) { $printtitle = 0; //Flag for printing type name @@ -36,15 +36,15 @@ function display_type ($type, $typename, &$dec, &$rep, $showbalance, $level) //Print Type Title if it has atleast one non-zero account if (!$printtitle) { - $prefix = ''; - for ($sp=1; $sp<=$level; $sp++) - { - $prefix .= ' '; - } + $prefix = ''; + for ($sp=1; $sp<=$level; $sp++) + { + $prefix .= ' '; + } $printtitle = 1; $rep->row -= 4; $rep->TextCol(0, 1, $type); - $rep->TextCol(1, 4, $prefix.$typename); + $rep->TextCol(1, 4, $prefix.$typename); $rep->row -= 4; $rep->Line($rep->row); $rep->NewLine(); @@ -57,7 +57,7 @@ function display_type ($type, $typename, &$dec, &$rep, $showbalance, $level) $balance = get_gl_trans_from_to($begin, ToDay(), $account["account_code"], 0); } $rep->TextCol(0, 1, $account['account_code']); - $rep->TextCol(1, 2, $prefix.$account['account_name']); + $rep->TextCol(1, 2, $prefix.$account['account_name']); $rep->TextCol(2, 3, $account['account_code2']); if ($showbalance == 1) $rep->AmountCol(3, 4, $balance, $dec); @@ -79,8 +79,8 @@ function display_type ($type, $typename, &$dec, &$rep, $showbalance, $level) $rep->Line($rep->row); $rep->NewLine(); } - $nextlevel = $level + 1; - display_type($accounttype["id"], $accounttype["name"].' ('.$typename.')', $dec, $rep, $showbalance, $nextlevel); + $nextlevel = $level + 1; + display_type($accounttype["id"], $accounttype["name"].' ('.$typename.')', $dec, $rep, $showbalance, $nextlevel); } } @@ -131,7 +131,7 @@ function print_Chart_of_Accounts() $typeresult = get_account_types(false, $class['cid'], -1); while ($accounttype=db_fetch($typeresult)) { - display_type($accounttype["id"], $accounttype["name"], $dec, $rep, $showbalance, 0); + display_type($accounttype["id"], $accounttype["name"], $dec, $rep, $showbalance, 0); } $rep->NewLine(); } diff --git a/reporting/rep708.php b/reporting/rep708.php index d08ef0b..e57d0a9 100644 --- a/reporting/rep708.php +++ b/reporting/rep708.php @@ -24,105 +24,105 @@ include_once($path_to_root . "/includes/date_functions.inc"); include_once($path_to_root . "/includes/data_checks.inc"); include_once($path_to_root . "/gl/includes/gl_db.inc"); -$pdeb = $pcre = $cdeb = $ccre = $tdeb = $tcre = $pbal = $cbal = $tbal = 0; - -//---------------------------------------------------------------------------------------------------- - -function display_type ($type, $typename, &$dec, &$rep, $from, $to, $zero, $balances, $dimension, $dimension2) -{ - global $pdeb, $pcre, $cdeb, $ccre, $tdeb, $tcre, $pbal, $cbal, $tbal; - - $printtitle = 0; //Flag for printing type name - - //Get Accounts directly under this group/type - $accounts = get_gl_accounts(null, null, $type); - - $begin = begin_fiscalyear(); - if (date1_greater_date2($begin, $from)) - $begin = $from; - $begin = add_days($begin, -1); - while ($account=db_fetch($accounts)) - { - //Print Type Title if it has atleast one non-zero account - if (!$printtitle) - { - $rep->row -= 4; - $rep->TextCol(0, 8, _("Group")." - ".$type ." - ".$typename); - $printtitle = 1; - $rep->row -= 4; - $rep->Line($rep->row); - $rep->NewLine(); - } - - $prev = get_balance($account["account_code"], $dimension, $dimension2, $begin, $from, false, false); - $curr = get_balance($account["account_code"], $dimension, $dimension2, $from, $to, true, true); - $tot = get_balance($account["account_code"], $dimension, $dimension2, $begin, $to, false, true); - - if ($zero == 0 && !$prev['balance'] && !$curr['balance'] && !$tot['balance']) - continue; - $rep->TextCol(0, 1, $account['account_code']); - $rep->TextCol(1, 2, $account['account_name']); - if ($balances != 0) - { - if ($prev['balance'] >= 0.0) - $rep->AmountCol(2, 3, $prev['balance'], $dec); - else - $rep->AmountCol(3, 4, abs($prev['balance']), $dec); - if ($curr['balance'] >= 0.0) - $rep->AmountCol(4, 5, $curr['balance'], $dec); - else - $rep->AmountCol(5, 6, abs($curr['balance']), $dec); - if ($tot['balance'] >= 0.0) - $rep->AmountCol(6, 7, $tot['balance'], $dec); - else - $rep->AmountCol(7, 8, abs($tot['balance']), $dec); - } - else - { - $rep->AmountCol(2, 3, $prev['debit'], $dec); - $rep->AmountCol(3, 4, $prev['credit'], $dec); - $rep->AmountCol(4, 5, $curr['debit'], $dec); - $rep->AmountCol(5, 6, $curr['credit'], $dec); - $rep->AmountCol(6, 7, $tot['debit'], $dec); - $rep->AmountCol(7, 8, $tot['credit'], $dec); - $pdeb += $prev['debit']; - $pcre += $prev['credit']; - $cdeb += $curr['debit']; - $ccre += $curr['credit']; - $tdeb += $tot['debit']; - $tcre += $tot['credit']; - } - - $pbal += $prev['balance']; - $cbal += $curr['balance']; - $tbal += $tot['balance']; - $rep->NewLine(); - - if ($rep->row < $rep->bottomMargin + $rep->lineHeight) - { - $rep->Line($rep->row - 2); - $rep->NewPage(); - } - } - - //Get Account groups/types under this group/type - $result = get_account_types(false, false, $type); - while ($accounttype=db_fetch($result)) - { - //Print Type Title if has sub types and not previously printed - if (!$printtitle) - { - $rep->row -= 4; - $rep->TextCol(0, 8, _("Group")." - ".$type ." - ".$typename); - $printtitle = 1; - $rep->row -= 4; - $rep->Line($rep->row); - $rep->NewLine(); - } - display_type($accounttype["id"], $accounttype["name"].' ('.$typename.')', $dec, $rep, $from, $to, $zero, $balances, $dimension, $dimension2); - } -} - +$pdeb = $pcre = $cdeb = $ccre = $tdeb = $tcre = $pbal = $cbal = $tbal = 0; + +//---------------------------------------------------------------------------------------------------- + +function display_type ($type, $typename, &$dec, &$rep, $from, $to, $zero, $balances, $dimension, $dimension2) +{ + global $pdeb, $pcre, $cdeb, $ccre, $tdeb, $tcre, $pbal, $cbal, $tbal; + + $printtitle = 0; //Flag for printing type name + + //Get Accounts directly under this group/type + $accounts = get_gl_accounts(null, null, $type); + + $begin = begin_fiscalyear(); + if (date1_greater_date2($begin, $from)) + $begin = $from; + $begin = add_days($begin, -1); + while ($account=db_fetch($accounts)) + { + //Print Type Title if it has atleast one non-zero account + if (!$printtitle) + { + $rep->row -= 4; + $rep->TextCol(0, 8, _("Group")." - ".$type ." - ".$typename); + $printtitle = 1; + $rep->row -= 4; + $rep->Line($rep->row); + $rep->NewLine(); + } + + $prev = get_balance($account["account_code"], $dimension, $dimension2, $begin, $from, false, false); + $curr = get_balance($account["account_code"], $dimension, $dimension2, $from, $to, true, true); + $tot = get_balance($account["account_code"], $dimension, $dimension2, $begin, $to, false, true); + + if ($zero == 0 && !$prev['balance'] && !$curr['balance'] && !$tot['balance']) + continue; + $rep->TextCol(0, 1, $account['account_code']); + $rep->TextCol(1, 2, $account['account_name']); + if ($balances != 0) + { + if ($prev['balance'] >= 0.0) + $rep->AmountCol(2, 3, $prev['balance'], $dec); + else + $rep->AmountCol(3, 4, abs($prev['balance']), $dec); + if ($curr['balance'] >= 0.0) + $rep->AmountCol(4, 5, $curr['balance'], $dec); + else + $rep->AmountCol(5, 6, abs($curr['balance']), $dec); + if ($tot['balance'] >= 0.0) + $rep->AmountCol(6, 7, $tot['balance'], $dec); + else + $rep->AmountCol(7, 8, abs($tot['balance']), $dec); + } + else + { + $rep->AmountCol(2, 3, $prev['debit'], $dec); + $rep->AmountCol(3, 4, $prev['credit'], $dec); + $rep->AmountCol(4, 5, $curr['debit'], $dec); + $rep->AmountCol(5, 6, $curr['credit'], $dec); + $rep->AmountCol(6, 7, $tot['debit'], $dec); + $rep->AmountCol(7, 8, $tot['credit'], $dec); + $pdeb += $prev['debit']; + $pcre += $prev['credit']; + $cdeb += $curr['debit']; + $ccre += $curr['credit']; + $tdeb += $tot['debit']; + $tcre += $tot['credit']; + } + + $pbal += $prev['balance']; + $cbal += $curr['balance']; + $tbal += $tot['balance']; + $rep->NewLine(); + + if ($rep->row < $rep->bottomMargin + $rep->lineHeight) + { + $rep->Line($rep->row - 2); + $rep->NewPage(); + } + } + + //Get Account groups/types under this group/type + $result = get_account_types(false, false, $type); + while ($accounttype=db_fetch($result)) + { + //Print Type Title if has sub types and not previously printed + if (!$printtitle) + { + $rep->row -= 4; + $rep->TextCol(0, 8, _("Group")." - ".$type ." - ".$typename); + $printtitle = 1; + $rep->row -= 4; + $rep->Line($rep->row); + $rep->NewLine(); + } + display_type($accounttype["id"], $accounttype["name"].' ('.$typename.')', $dec, $rep, $from, $to, $zero, $balances, $dimension, $dimension2); + } +} + //---------------------------------------------------------------------------------------------------- print_trial_balance(); @@ -132,7 +132,7 @@ print_trial_balance(); function print_trial_balance() { global $path_to_root; - global $pdeb, $pcre, $cdeb, $ccre, $tdeb, $tcre, $pbal, $cbal, $tbal; + global $pdeb, $pcre, $cdeb, $ccre, $tdeb, $tcre, $pbal, $cbal, $tbal; $dim = get_company_pref('use_dimension'); $dimension = $dimension2 = 0; @@ -172,8 +172,8 @@ function print_trial_balance() $aligns2 = array('left', 'left', 'left', 'left', 'left'); - $cols = array(0, 50, 150, 210, 270, 330, 390, 450, 510, 570); - //------------0--1---2----3----4----5----6----7----8-- + $cols = array(0, 50, 150, 210, 270, 330, 390, 450, 510, 570); + //------------0--1---2----3----4----5----6----7----8-- $headers = array(_('Account'), _('Account Name'), _('Debit'), _('Credit'), _('Debit'), _('Credit'), _('Debit'), _('Credit')); @@ -207,21 +207,21 @@ function print_trial_balance() $rep->Font(); $rep->Info($params, $cols, $headers, $aligns, $cols2, $headers2, $aligns2); $rep->NewPage(); - - $classresult = get_account_classes(false); - while ($class = db_fetch($classresult)) + + $classresult = get_account_classes(false); + while ($class = db_fetch($classresult)) { - $rep->Font('bold'); - $rep->TextCol(0, 1, $class['cid']); - $rep->TextCol(1, 4, $class['class_name']); - $rep->Font(); - $rep->NewLine(); + $rep->Font('bold'); + $rep->TextCol(0, 1, $class['cid']); + $rep->TextCol(1, 4, $class['class_name']); + $rep->Font(); + $rep->NewLine(); - //Get Account groups/types under this group/type with no parents - $typeresult = get_account_types(false, $class['cid'], -1); - while ($accounttype=db_fetch($typeresult)) + //Get Account groups/types under this group/type with no parents + $typeresult = get_account_types(false, $class['cid'], -1); + while ($accounttype=db_fetch($typeresult)) { - display_type($accounttype["id"], $accounttype["name"], $dec, $rep, $from, $to, $zero, $balances, $dimension, $dimension2); + display_type($accounttype["id"], $accounttype["name"], $dec, $rep, $from, $to, $zero, $balances, $dimension, $dimension2); } $rep->NewLine(); } diff --git a/reporting/rep709.php b/reporting/rep709.php index 7c09e30..dbe25e5 100644 --- a/reporting/rep709.php +++ b/reporting/rep709.php @@ -33,13 +33,13 @@ function getTaxTransactions($from, $to) $fromdate = date2sql($from); $todate = date2sql($to); - $sql = "SELECT tt.name as taxname, taxrec.*, taxrec.amount*ex_rate AS amount, + $sql = "SELECT tt.name as taxname, taxrec.*, taxrec.amount*ex_rate AS amount, taxrec.net_amount*ex_rate AS net_amount, IF(ISNULL(supp.supp_name), debt.name, supp.supp_name) as name, branch.br_name FROM ".TB_PREF."trans_tax_details taxrec - LEFT JOIN ".TB_PREF."tax_types tt - ON taxrec.tax_type_id=tt.id + LEFT JOIN ".TB_PREF."tax_types tt + ON taxrec.tax_type_id=tt.id LEFT JOIN ".TB_PREF."supp_trans strans ON taxrec.trans_no=strans.trans_no AND taxrec.trans_type=strans.type LEFT JOIN ".TB_PREF."suppliers as supp ON strans.supplier_id=supp.supplier_id @@ -51,7 +51,7 @@ function getTaxTransactions($from, $to) AND taxrec.trans_type <> ".ST_CUSTDELIVERY." AND taxrec.tran_date >= '$fromdate' AND taxrec.tran_date <= '$todate' - ORDER BY taxrec.trans_type, taxrec.tran_date, taxrec.trans_no, taxrec.ex_rate"; + ORDER BY taxrec.trans_type, taxrec.tran_date, taxrec.trans_no, taxrec.ex_rate"; //display_error($sql); return db_query($sql,"No transactions were returned"); } @@ -73,7 +73,7 @@ function getTaxInfo($id) function print_tax_report() { - global $path_to_root, $trans_dir, $Hooks, $systypes_array; + global $path_to_root, $trans_dir, $Hooks, $systypes_array; $from = $_POST['PARAM_0']; $to = $_POST['PARAM_1']; @@ -104,11 +104,11 @@ function print_tax_report() 1 => array('text' => _('Period'), 'from' => $from, 'to' => $to), 2 => array('text' => _('Type'), 'from' => $summary, 'to' => '')); - $cols = array(0, 80, 130, 180, 270, 350, 400, 430, 480, 485, 520); + $cols = array(0, 80, 130, 180, 270, 350, 400, 430, 480, 485, 520); $headers = array(_('Trans Type'), _('Ref'), _('Date'), _('Name'), _('Branch Name'), - _('Net'), _('Rate'), _('Tax'), '', _('Name')); - $aligns = array('left', 'left', 'left', 'left', 'left', 'right', 'right', 'right', 'right','left'); + _('Net'), _('Rate'), _('Tax'), '', _('Name')); + $aligns = array('left', 'left', 'left', 'left', 'left', 'right', 'right', 'right', 'right','left'); $rep->Font(); $rep->Info($params, $cols, $headers, $aligns); if (!$summaryOnly) @@ -140,8 +140,8 @@ function print_tax_report() $rep->AmountCol(5, 6, $trans['net_amount'], $dec); $rep->AmountCol(6, 7, $trans['rate'], $dec); $rep->AmountCol(7, 8, $trans['amount'], $dec); - - $rep->TextCol(9, 10, $trans['taxname']); + + $rep->TextCol(9, 10, $trans['taxname']); $rep->NewLine(); diff --git a/sales/includes/db/sales_order_db.inc b/sales/includes/db/sales_order_db.inc index f8afbc7..db8f928 100644 --- a/sales/includes/db/sales_order_db.inc +++ b/sales/includes/db/sales_order_db.inc @@ -561,10 +561,10 @@ function get_sql_for_sales_orders_view($selected_customer, $trans_type, $trans_n elseif ($filter=='InvoiceTemplates' || $filter=='DeliveryTemplates') $sql .= " AND sorder.type=1"; - - //Chaiatanya : New Filter - if ($customer_id != ALL_TEXT) - $sql .= " AND sorder.debtor_no = ".db_escape($customer_id); + + //Chaiatanya : New Filter + if ($customer_id != ALL_TEXT) + $sql .= " AND sorder.debtor_no = ".db_escape($customer_id); $sql .= " GROUP BY sorder.order_no, sorder.debtor_no, -- 2.30.2