Void a Transaction: fixed GRN voiding.
[fa-stable.git] / reporting / rep109.php
index d01c9bdae0e865ff9a6e948b4e840859eb9590be..dde986674c2e7cfc7315cfb429aa0bcbcade74af 100644 (file)
@@ -29,11 +29,9 @@ include_once($path_to_root . "/taxes/tax_calc.inc");
 
 print_sales_orders();
 
-$print_as_quote = 0;
-
 function print_sales_orders()
 {
-       global $path_to_root, $print_as_quote, $SysPrefs;
+       global $path_to_root, $SysPrefs;
 
        include_once($path_to_root . "/reporting/includes/pdf_report.inc");
 
@@ -55,7 +53,7 @@ function print_sales_orders()
        // $headers in doctext.inc
        $aligns = array('left', 'left', 'right', 'left', 'right', 'right', 'right');
 
-       $params = array('comments' => $comments);
+       $params = array('comments' => $comments, 'print_quote' => $print_as_quote);
 
        $cur = get_company_Pref('curr_default');
 
@@ -73,6 +71,9 @@ function print_sales_orders()
        for ($i = $from; $i <= $to; $i++)
        {
                $myrow = get_sales_order_header($i, ST_SALESORDER);
+               if ($currency != ALL_TEXT && $myrow['curr_code'] != $currency) {
+                       continue;
+               }
                $baccount = get_default_bank_account($myrow['curr_code']);
                $params['bankaccount'] = $baccount['id'];
                $branch = get_branch($myrow["branch_code"]);
@@ -97,13 +98,13 @@ function print_sales_orders()
                }
                else
                        $rep->title = ($print_as_quote==1 ? _("QUOTE") : _("SALES ORDER"));
-               $rep->SetHeaderType('Header2');
                $rep->currency = $cur;
                $rep->Font();
                $rep->Info($params, $cols, null, $aligns);
 
                $contacts = get_branch_contacts($branch['branch_code'], 'order', $branch['debtor_no'], true);
                $rep->SetCommonData($myrow, $branch, $myrow, $baccount, ST_SALESORDER, $contacts);
+               $rep->SetHeaderType('Header2');
                $rep->NewPage();
 
                $result = get_sales_order_details($i, ST_SALESORDER);