X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=reporting%2Frep107.php;h=3401320ed07d763c1a225e51fc6f54b0d3dba6c3;hb=7ff72280e015c920df41faad255d19173bf4f141;hp=1f081ee2204be4cbf17923a039d7a069750b0b10;hpb=04955b71e59a4abf396b92e0298891582bf32768;p=fa-stable.git diff --git a/reporting/rep107.php b/reporting/rep107.php index 1f081ee2..3401320e 100644 --- a/reporting/rep107.php +++ b/reporting/rep107.php @@ -72,48 +72,33 @@ function print_invoices() for ($i = $fno[0]; $i <= $tno[0]; $i++) { - for ($j = ST_SALESINVOICE; $j <= ST_CUSTCREDIT; $j++) - { - if (isset($_POST['PARAM_6']) && $_POST['PARAM_6'] != $j) + if (!exists_customer_trans(ST_SALESINVOICE, $i)) continue; - if (!exists_customer_trans($j, $i)) - continue; - $sign = $j==ST_SALESINVOICE ? 1 : -1; - $myrow = get_customer_trans($i, $j); + $sign = 1; + $myrow = get_customer_trans($i, ST_SALESINVOICE); $baccount = get_default_bank_account($myrow['curr_code']); $params['bankaccount'] = $baccount['id']; $branch = get_branch($myrow["branch_code"]); $branch['disable_branch'] = $paylink; // helper - if ($j == ST_SALESINVOICE) - $sales_order = get_sales_order_header($myrow["order_"], ST_SALESORDER); - else - $sales_order = null; + $sales_order = get_sales_order_header($myrow["order_"], ST_SALESORDER); if ($email == 1) { $rep = new FrontReport("", "", user_pagesize()); $rep->SetHeaderType('Header2'); $rep->currency = $cur; $rep->Font(); - if ($j == ST_SALESINVOICE) - { - $rep->title = _('INVOICE'); - $rep->filename = "Invoice" . $myrow['reference'] . ".pdf"; - } - else - { - $rep->title = _('CREDIT NOTE'); - $rep->filename = "CreditNote" . $myrow['reference'] . ".pdf"; - } + $rep->title = _('INVOICE'); + $rep->filename = "Invoice" . $myrow['reference'] . ".pdf"; $rep->Info($params, $cols, null, $aligns); } else - $rep->title = ($j == ST_SALESINVOICE) ? _('INVOICE') : _('CREDIT NOTE'); + $rep->title = _('INVOICE'); $contacts = get_branch_contacts($branch['branch_code'], 'invoice', $branch['debtor_no']); - $rep->SetCommonData($myrow, $branch, $sales_order, $baccount, $j, $contacts); + $rep->SetCommonData($myrow, $branch, $sales_order, $baccount, ST_SALESINVOICE, $contacts); $rep->NewPage(); - $result = get_customer_trans_details($j, $i); + $result = get_customer_trans_details(ST_SALESINVOICE, $i); $SubTotal = 0; while ($myrow2=db_fetch($result)) { @@ -146,7 +131,7 @@ function print_invoices() $rep->NewPage(); } - $comments = get_comments($j, $i); + $comments = get_comments(ST_SALESINVOICE, $i); if ($comments && db_num_rows($comments)) { $rep->NewLine(); @@ -159,7 +144,7 @@ function print_invoices() $rep->row = $rep->bottomMargin + (15 * $rep->lineHeight); $linetype = true; - $doctype = $j; + $doctype = ST_SALESINVOICE; include($path_to_root . "/reporting/includes/doctext.inc"); $rep->TextCol(3, 6, $doc_Sub_total, -2); @@ -168,7 +153,7 @@ function print_invoices() $rep->TextCol(3, 6, $doc_Shipping, -2); $rep->TextCol(6, 7, $DisplayFreight, -2); $rep->NewLine(); - $tax_items = get_trans_tax_details($j, $i); + $tax_items = get_trans_tax_details(ST_SALESINVOICE, $i); $first = true; while ($tax_item = db_fetch($tax_items)) { @@ -209,7 +194,7 @@ function print_invoices() $rep->Font('bold'); $rep->TextCol(3, 6, $doc_TOTAL_INVOICE, - 2); $rep->TextCol(6, 7, $DisplayTotal, -2); - $words = price_in_words($myrow['Total'], $j); + $words = price_in_words($myrow['Total'], ST_SALESINVOICE); if ($words != "") { $rep->NewLine(1); @@ -219,9 +204,8 @@ function print_invoices() if ($email == 1) { $myrow['dimension_id'] = $paylink; // helper for pmt link - $rep->End($email, $doc_Invoice_no . " " . $myrow['reference'], $myrow, $j); + $rep->End($email, $doc_Invoice_no . " " . $myrow['reference'], $myrow, ST_SALESINVOICE); } - } } if ($email == 0) $rep->End();