Salesman Report: fixed bug in provision calculation, Sales Persons: changed break...
[fa-stable.git] / reporting / rep107.php
index 0e14b7024eda47f140c72574543eba809b56c564..a125995dce7b5a04d4818f0eadbc441cdca21de0 100644 (file)
@@ -97,7 +97,10 @@ function print_invoices()
                        $sign = 1;
                        $myrow = get_customer_trans($row['trans_no'], ST_SALESINVOICE);
 
-                       if($customer && $myrow['debtor_no'] != $customer) {
+                       if ($customer && $myrow['debtor_no'] != $customer) {
+                               continue;
+                       }
+                       if ($currency != ALL_TEXT && $myrow['curr_code'] != $currency) {
                                continue;
                        }
                        $baccount = get_default_bank_account($myrow['curr_code']);
@@ -111,7 +114,6 @@ function print_invoices()
                                $rep->title = _('INVOICE');
                                $rep->filename = "Invoice" . $myrow['reference'] . ".pdf";
                        }       
-                       $rep->SetHeaderType('Header2');
                        $rep->currency = $cur;
                        $rep->Font();
                        $rep->Info($params, $cols, null, $aligns);
@@ -119,6 +121,7 @@ function print_invoices()
                        $contacts = get_branch_contacts($branch['branch_code'], 'invoice', $branch['debtor_no'], true);
                        $baccount['payment_service'] = $pay_service;
                        $rep->SetCommonData($myrow, $branch, $sales_order, $baccount, ST_SALESINVOICE, $contacts);
+                       $rep->SetHeaderType('Header2');
                        $rep->NewPage();
                        // calculate summary start row for later use
                        $summary_start_row = $rep->bottomMargin + (15 * $rep->lineHeight);