page(_($help_context = "Trial Balance"), false, false, "", $js);
-$k = 0;\r
-$pdeb = $pcre = $cdeb = $ccre = $tdeb = $tcre = $pbal = $cbal = $tbal = 0;\r
-$cls_pdeb = $cls_pcre = $cls_cdeb = $cls_ccre = $cls_tdeb = $cls_tcre = $cls_pbal = $cls_cbal = $cls_tbal = 0;\r
-$grp_pdeb = $grp_pcre = $grp_cdeb = $grp_ccre = $grp_tdeb = $grp_tcre = $grp_pbal = $grp_cbal = $grp_tbal = 0;\r
-\r
+$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
//
//----------------------------------------------------------------------------------------------------
-function display_trial_balance($type, $typename)\r
+function display_trial_balance($type, $typename)
{
global $path_to_root;
- \r
- global $k, $pdeb, $pcre, $cdeb, $ccre, $tdeb, $tcre, $pbal, $cbal, $tbal;\r
- $printtitle = 0; //Flag for printing type name \r
+
+ global $k, $pdeb, $pcre, $cdeb, $ccre, $tdeb, $tcre, $pbal, $cbal, $tbal;
+ $printtitle = 0; //Flag for printing type name
$k = 0;
- //$accounts = get_gl_accounts();\r
- //Get Accounts directly under this group/type\r
- $accounts = get_gl_accounts(null, null, $type); \r
- \r
+ //$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']))
while ($account = db_fetch($accounts))
{
- //Print Type Title if it has atleast one non-zero account \r
- if (!$printtitle)\r
- { \r
- start_row("class='inquirybg' style='font-weight:bold'");\r
- label_cell("Group - ".$type ." - ".$typename, "colspan=8");\r
- end_row(); \r
- $printtitle = 1; \r
- } \r
- \r
+ //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);
end_row();
}
- //Get Account groups/types under this group/type\r
- $result = get_account_types(false, false, $type);\r
- while ($accounttype=db_fetch($result))\r
- {\r
- //Print Type Title if has sub types and not previously printed\r
- if (!$printtitle)\r
- {\r
- start_row("class='inquirybg' style='font-weight:bold'");\r
- label_cell("Group - ".$type ." - ".$typename, "colspan=8");\r
- end_row(); \r
- $printtitle = 1; \r
- }\r
- display_trial_balance($accounttype["id"], $accounttype["name"].' ('.$typename.')');\r
- }\r
-}\r
-\r
-//----------------------------------------------------------------------------------------------------\r
-\r
-gl_inquiry_controls();\r
-\r
-if (isset($_POST['TransFromDate']))\r
-{\r
- $row = get_current_fiscalyear();\r
- if (date1_greater_date2($_POST['TransFromDate'], sql2date($row['end'])))\r
- {\r
- display_error(_("The from date cannot be bigger than the fiscal year end."));\r
- set_focus('TransFromDate');\r
- return;\r
- } \r
-} \r
-div_start('balance_tbl');\r
-if (!isset($_POST['Dimension']))\r
- $_POST['Dimension'] = 0;\r
-if (!isset($_POST['Dimension2']))\r
- $_POST['Dimension2'] = 0;\r
-start_table(TABLESTYLE);\r
-$tableheader = "<tr>\r
- <td rowspan=2 class='tableheader'>" . _("Account") . "</td>\r
- <td rowspan=2 class='tableheader'>" . _("Account Name") . "</td>\r
- <td colspan=2 class='tableheader'>" . _("Brought Forward") . "</td>\r
- <td colspan=2 class='tableheader'>" . _("This Period") . "</td>\r
- <td colspan=2 class='tableheader'>" . _("Balance") . "</td>\r
- </tr><tr>\r
- <td class='tableheader'>" . _("Debit") . "</td>\r
- <td class='tableheader'>" . _("Credit") . "</td>\r
- <td class='tableheader'>" . _("Debit") . "</td>\r
- <td class='tableheader'>" . _("Credit") . "</td>\r
- <td class='tableheader'>" . _("Debit") . "</td>\r
- <td class='tableheader'>" . _("Credit") . "</td>\r
- </tr>";\r
-\r
-echo $tableheader;\r
-\r
-//display_trial_balance();\r
-\r
-$classresult = get_account_classes(false);\r
-while ($class = db_fetch($classresult))\r
-{\r
- start_row("class='inquirybg' style='font-weight:bold'");\r
- label_cell("Class - ".$class['cid'] ." - ".$class['class_name'], "colspan=8");\r
- end_row();\r
-\r
- //Get Account groups/types under this group/type with no parents\r
- $typeresult = get_account_types(false, $class['cid'], -1);\r
- while ($accounttype=db_fetch($typeresult))\r
- {\r
- display_trial_balance($accounttype["id"], $accounttype["name"]);\r
- }\r
-}\r
-\r
+ //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 = "<tr>
+ <td rowspan=2 class='tableheader'>" . _("Account") . "</td>
+ <td rowspan=2 class='tableheader'>" . _("Account Name") . "</td>
+ <td colspan=2 class='tableheader'>" . _("Brought Forward") . "</td>
+ <td colspan=2 class='tableheader'>" . _("This Period") . "</td>
+ <td colspan=2 class='tableheader'>" . _("Balance") . "</td>
+ </tr><tr>
+ <td class='tableheader'>" . _("Debit") . "</td>
+ <td class='tableheader'>" . _("Credit") . "</td>
+ <td class='tableheader'>" . _("Debit") . "</td>
+ <td class='tableheader'>" . _("Credit") . "</td>
+ <td class='tableheader'>" . _("Debit") . "</td>
+ <td class='tableheader'>" . _("Credit") . "</td>
+ </tr>";
+
+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);
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."));\r
+ //display_warning(_("The Opening Balance is not in balance, probably due to a non closed Previous Fiscalyear."));
div_end();
//----------------------------------------------------------------------------------------------------
{
$fromdate = date2sql($from);
$todate = date2sql($to);
-\r
+
$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\r
- FROM ".TB_PREF."debtor_trans dt\r
- LEFT JOIN ".TB_PREF."debtors_master d ON d.debtor_no=dt.debtor_no\r
- LEFT JOIN ".TB_PREF."trans_tax_details t ON (t.trans_type=dt.type AND t.trans_no=dt.trans_no)\r
- WHERE (dt.type=".ST_SALESINVOICE." OR dt.type=".ST_CUSTCREDIT.") ";\r
- if ($tax_id)\r
- $sql .= "AND tax_id<>'' ";\r
- $sql .= "AND dt.tran_date >=".db_escape($fromdate)." AND dt.tran_date<=".db_escape($todate)."\r
- GROUP BY d.debtor_no, d.name, d.tax_id ORDER BY d.name"; \r
+ 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");
}
function print_sales_summary_report()
{
- global $path_to_root;\r
+ global $path_to_root;
$from = $_POST['PARAM_0'];
$to = $_POST['PARAM_1'];
- $tax_id = $_POST['PARAM_2'];\r
+ $tax_id = $_POST['PARAM_2'];
$comments = $_POST['PARAM_3'];
$destination = $_POST['PARAM_4'];
- if ($tax_id == 0)\r
- $tid = _('No');\r
- else\r
- $tid = _('Yes');\r
-\r
+ if ($tax_id == 0)
+ $tid = _('No');
+ else
+ $tid = _('Yes');
+
if ($destination)
include_once($path_to_root . "/reporting/includes/excel_report.inc");
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);\r
+ $cols = array(0, 130, 180, 270, 350, 500);
- $headers = array(_('Customer'), _('Tax Id'), _('Total ex. Tax'), _('Tax'));\r
- $aligns = array('left', 'left', 'right', 'right');\r
+ $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();
$totalnet = 0.0;
$totaltax = 0.0;
$transactions = getTaxTransactions($from, $to, $tax_id);
-\r
- $rep->TextCol(0, 4, _("Values in domestic currency"));\r
- $rep->NewLine(2);\r
+
+ $rep->TextCol(0, 4, _("Values in domestic currency"));
+ $rep->NewLine(2);
while ($trans=db_fetch($transactions))
{
$rep->TextCol(1, 2, $trans['tax_id']);
$rep->AmountCol(2, 3, $trans['total'], $dec);
$rep->AmountCol(3, 4, $trans['tax'], $dec);
- $totalnet += $trans['total'];\r
- $totaltax += $trans['tax'];\r
-\r
+ $totalnet += $trans['total'];
+ $totaltax += $trans['tax'];
+
$rep->NewLine();
if ($rep->row < $rep->bottomMargin + $rep->lineHeight)
$rep->NewPage();
}
}
-\r
- $rep->Font('bold');\r
- $rep->NewLine();\r
- $rep->Line($rep->row + $rep->lineHeight);\r
- $rep->TextCol(0, 2, _("Total"));\r
- $rep->AmountCol(2, 3, $totalnet, $dec);\r
- $rep->AmountCol(3, 4, $totaltax, $dec);\r
- $rep->Line($rep->row - 5);\r
- $rep->Font();\r
-\r
+
+ $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();
}
//----------------------------------------------------------------------------------------------------
-function display_type ($type, $typename, &$dec, &$rep, $showbalance, $level)\r
+function display_type ($type, $typename, &$dec, &$rep, $showbalance, $level)
{
$printtitle = 0; //Flag for printing type name
//Print Type Title if it has atleast one non-zero account
if (!$printtitle)
{
- $prefix = '';\r
- for ($sp=1; $sp<=$level; $sp++)\r
- {\r
- $prefix .= ' ';\r
- } \r
+ $prefix = '';
+ for ($sp=1; $sp<=$level; $sp++)
+ {
+ $prefix .= ' ';
+ }
$printtitle = 1;
$rep->row -= 4;
$rep->TextCol(0, 1, $type);
- $rep->TextCol(1, 4, $prefix.$typename);\r
+ $rep->TextCol(1, 4, $prefix.$typename);
$rep->row -= 4;
$rep->Line($rep->row);
$rep->NewLine();
$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']);\r
+ $rep->TextCol(1, 2, $prefix.$account['account_name']);
$rep->TextCol(2, 3, $account['account_code2']);
if ($showbalance == 1)
$rep->AmountCol(3, 4, $balance, $dec);
$rep->Line($rep->row);
$rep->NewLine();
}
- $nextlevel = $level + 1;\r
- display_type($accounttype["id"], $accounttype["name"].' ('.$typename.')', $dec, $rep, $showbalance, $nextlevel);\r
+ $nextlevel = $level + 1;
+ display_type($accounttype["id"], $accounttype["name"].' ('.$typename.')', $dec, $rep, $showbalance, $nextlevel);
}
}
$typeresult = get_account_types(false, $class['cid'], -1);
while ($accounttype=db_fetch($typeresult))
{
- display_type($accounttype["id"], $accounttype["name"], $dec, $rep, $showbalance, 0);\r
+ display_type($accounttype["id"], $accounttype["name"], $dec, $rep, $showbalance, 0);
}
$rep->NewLine();
}
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;\r
-\r
-//----------------------------------------------------------------------------------------------------\r
-\r
-function display_type ($type, $typename, &$dec, &$rep, $from, $to, $zero, $balances, $dimension, $dimension2)\r
-{\r
- global $pdeb, $pcre, $cdeb, $ccre, $tdeb, $tcre, $pbal, $cbal, $tbal;\r
- \r
- $printtitle = 0; //Flag for printing type name \r
- \r
- //Get Accounts directly under this group/type\r
- $accounts = get_gl_accounts(null, null, $type); \r
- \r
- $begin = begin_fiscalyear();\r
- if (date1_greater_date2($begin, $from))\r
- $begin = $from;\r
- $begin = add_days($begin, -1);\r
- while ($account=db_fetch($accounts))\r
- {\r
- //Print Type Title if it has atleast one non-zero account \r
- if (!$printtitle)\r
- { \r
- $rep->row -= 4;\r
- $rep->TextCol(0, 8, _("Group")." - ".$type ." - ".$typename); \r
- $printtitle = 1;\r
- $rep->row -= 4;\r
- $rep->Line($rep->row);\r
- $rep->NewLine(); \r
- }\r
- \r
- $prev = get_balance($account["account_code"], $dimension, $dimension2, $begin, $from, false, false);\r
- $curr = get_balance($account["account_code"], $dimension, $dimension2, $from, $to, true, true);\r
- $tot = get_balance($account["account_code"], $dimension, $dimension2, $begin, $to, false, true);\r
-\r
- if ($zero == 0 && !$prev['balance'] && !$curr['balance'] && !$tot['balance'])\r
- continue;\r
- $rep->TextCol(0, 1, $account['account_code']);\r
- $rep->TextCol(1, 2, $account['account_name']);\r
- if ($balances != 0)\r
- {\r
- if ($prev['balance'] >= 0.0)\r
- $rep->AmountCol(2, 3, $prev['balance'], $dec);\r
- else\r
- $rep->AmountCol(3, 4, abs($prev['balance']), $dec);\r
- if ($curr['balance'] >= 0.0)\r
- $rep->AmountCol(4, 5, $curr['balance'], $dec);\r
- else\r
- $rep->AmountCol(5, 6, abs($curr['balance']), $dec);\r
- if ($tot['balance'] >= 0.0)\r
- $rep->AmountCol(6, 7, $tot['balance'], $dec);\r
- else\r
- $rep->AmountCol(7, 8, abs($tot['balance']), $dec);\r
- }\r
- else\r
- {\r
- $rep->AmountCol(2, 3, $prev['debit'], $dec);\r
- $rep->AmountCol(3, 4, $prev['credit'], $dec);\r
- $rep->AmountCol(4, 5, $curr['debit'], $dec);\r
- $rep->AmountCol(5, 6, $curr['credit'], $dec);\r
- $rep->AmountCol(6, 7, $tot['debit'], $dec);\r
- $rep->AmountCol(7, 8, $tot['credit'], $dec);\r
- $pdeb += $prev['debit'];\r
- $pcre += $prev['credit'];\r
- $cdeb += $curr['debit'];\r
- $ccre += $curr['credit'];\r
- $tdeb += $tot['debit'];\r
- $tcre += $tot['credit'];\r
- } \r
-\r
- $pbal += $prev['balance'];\r
- $cbal += $curr['balance'];\r
- $tbal += $tot['balance'];\r
- $rep->NewLine();\r
-\r
- if ($rep->row < $rep->bottomMargin + $rep->lineHeight)\r
- {\r
- $rep->Line($rep->row - 2);\r
- $rep->NewPage();\r
- }\r
- }\r
- \r
- //Get Account groups/types under this group/type\r
- $result = get_account_types(false, false, $type);\r
- while ($accounttype=db_fetch($result))\r
- {\r
- //Print Type Title if has sub types and not previously printed\r
- if (!$printtitle)\r
- {\r
- $rep->row -= 4;\r
- $rep->TextCol(0, 8, _("Group")." - ".$type ." - ".$typename); \r
- $printtitle = 1;\r
- $rep->row -= 4;\r
- $rep->Line($rep->row);\r
- $rep->NewLine(); \r
- }\r
- display_type($accounttype["id"], $accounttype["name"].' ('.$typename.')', $dec, $rep, $from, $to, $zero, $balances, $dimension, $dimension2);\r
- }\r
-}\r
-\r
+$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();
function print_trial_balance()
{
global $path_to_root;
- global $pdeb, $pcre, $cdeb, $ccre, $tdeb, $tcre, $pbal, $cbal, $tbal;\r
+ global $pdeb, $pcre, $cdeb, $ccre, $tdeb, $tcre, $pbal, $cbal, $tbal;
$dim = get_company_pref('use_dimension');
$dimension = $dimension2 = 0;
$aligns2 = array('left', 'left', 'left', 'left', 'left');
- $cols = array(0, 50, 150, 210, 270, 330, 390, 450, 510, 570);\r
- //------------0--1---2----3----4----5----6----7----8--\r
+ $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'));
$rep->Font();
$rep->Info($params, $cols, $headers, $aligns, $cols2, $headers2, $aligns2);
$rep->NewPage();
- \r
- $classresult = get_account_classes(false);\r
- while ($class = db_fetch($classresult))\r
+
+ $classresult = get_account_classes(false);
+ while ($class = db_fetch($classresult))
{
- $rep->Font('bold');\r
- $rep->TextCol(0, 1, $class['cid']);\r
- $rep->TextCol(1, 4, $class['class_name']);\r
- $rep->Font();\r
- $rep->NewLine();\r
+ $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\r
- $typeresult = get_account_types(false, $class['cid'], -1);\r
- while ($accounttype=db_fetch($typeresult))\r
+ //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);\r
+ display_type($accounttype["id"], $accounttype["name"], $dec, $rep, $from, $to, $zero, $balances, $dimension, $dimension2);
}
$rep->NewLine();
}
$fromdate = date2sql($from);
$todate = date2sql($to);
- $sql = "SELECT tt.name as taxname, taxrec.*, taxrec.amount*ex_rate AS amount,\r
+ $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\r
- ON taxrec.tax_type_id=tt.id\r
+ 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
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";\r
+ 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");
}
function print_tax_report()
{
- global $path_to_root, $trans_dir, $Hooks, $systypes_array;\r
+ global $path_to_root, $trans_dir, $Hooks, $systypes_array;
$from = $_POST['PARAM_0'];
$to = $_POST['PARAM_1'];
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);\r
+ $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'));\r
- $aligns = array('left', 'left', 'left', 'left', 'left', 'right', 'right', 'right', 'right','left');\r
+ _('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)
$rep->AmountCol(5, 6, $trans['net_amount'], $dec);
$rep->AmountCol(6, 7, $trans['rate'], $dec);
$rep->AmountCol(7, 8, $trans['amount'], $dec);
- \r
- $rep->TextCol(9, 10, $trans['taxname']);\r
+
+ $rep->TextCol(9, 10, $trans['taxname']);
$rep->NewLine();
elseif ($filter=='InvoiceTemplates' || $filter=='DeliveryTemplates')
$sql .= " AND sorder.type=1";
- \r
- //Chaiatanya : New Filter\r
- if ($customer_id != ALL_TEXT)\r
- $sql .= " AND sorder.debtor_no = ".db_escape($customer_id); \r
+
+ //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,