From 565a41e2d7fd4b4a32848e4829c11dbbcb5881d1 Mon Sep 17 00:00:00 2001 From: Janusz Dobrowolski Date: Fri, 17 Jun 2011 13:45:52 +0200 Subject: [PATCH] Rewitten document reports layout for easier modifications, support for multiply payment services. --- includes/ui/ui_lists.inc | 15 +- includes/ui/ui_view.inc | 28 ++ purchasing/includes/ui/invoice_ui.inc | 2 + reporting/includes/doctext.inc | 400 +++++++++++++++---------- reporting/includes/header2.inc | 265 ++++------------ reporting/includes/pdf_report.inc | 41 +-- reporting/includes/reports_classes.inc | 3 +- reporting/rep107.php | 24 +- reporting/rep108.php | 14 +- reporting/rep109.php | 14 +- reporting/rep110.php | 12 +- reporting/rep111.php | 14 +- reporting/rep112.php | 20 +- reporting/rep113.php | 12 +- reporting/rep209.php | 10 +- reporting/rep210.php | 12 +- 16 files changed, 428 insertions(+), 458 deletions(-) diff --git a/includes/ui/ui_lists.inc b/includes/ui/ui_lists.inc index 808e7557..592b49a0 100644 --- a/includes/ui/ui_lists.inc +++ b/includes/ui/ui_lists.inc @@ -2327,4 +2327,17 @@ function coa_list_row($label, $name, $value=null) echo array_selector( $name, $value, $coas ); echo "\n"; } -?> \ No newline at end of file + +function payment_services($name) +{ + global $payment_services; + + $services = array_combine(array_keys($payment_services), array_keys($payment_services)); + + return array_selector($name, null, $services, array( + 'spec_option'=> _("No payment Link"), + 'spec_id' => '', + )); +} + +?> diff --git a/includes/ui/ui_view.inc b/includes/ui/ui_view.inc index e2e5066a..97b932c8 100644 --- a/includes/ui/ui_view.inc +++ b/includes/ui/ui_view.inc @@ -1300,4 +1300,32 @@ function display_backtrace($cond=true, $msg='') { } } +// +// FIXME: $payment_services array will be moved to bank_accounts in 2.4.x +// +if (!isset($payment_services)) +{ + $payment_services = array( + 'PayPal' => "https://www.paypal.com/xclick/business=&item_name=&amount=¤cy_code=", + ); +} +/* +* Payment link generation. Options provided during invoice generation: +* company_email, comment, amount, currency +*/ +function payment_link($name, $options) +{ + global $payment_services; + + $link = @$payment_services[$name]; + + if (!$link) return null; + + $patterns = array(); + foreach ($options as $id => $option) + $patterns['<'.$id.'>'] = urlencode($options[$id]); + + return strtr($link, $patterns); +} + ?> \ No newline at end of file diff --git a/purchasing/includes/ui/invoice_ui.inc b/purchasing/includes/ui/invoice_ui.inc index 1be65a16..24396f27 100644 --- a/purchasing/includes/ui/invoice_ui.inc +++ b/purchasing/includes/ui/invoice_ui.inc @@ -319,6 +319,8 @@ function display_gl_items(&$supp_trans, $mode=0) function display_grn_items_for_selection(&$supp_trans, $k) { + global $use_invoice_adjustments; + if ($supp_trans->trans_type == ST_SUPPINVOICE) $result = get_grn_items(0, $supp_trans->supplier_id, true); else diff --git a/reporting/includes/doctext.inc b/reporting/includes/doctext.inc index 355cda64..e296ead3 100644 --- a/reporting/includes/doctext.inc +++ b/reporting/includes/doctext.inc @@ -9,177 +9,263 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the License here . ***********************************************************************/ -if (isset($header2type)) -{ - $doc_Cust_no = _("Cust no"); - $doc_Date = _("Date"); - if ($doctype == ST_PURCHORDER || $doctype == ST_SUPPAYMENT) // Purchase Order - { - $doc_Charge_To = _("Order To"); - if ($doctype == ST_PURCHORDER) - $doc_Delivered_To = _("Deliver To"); - else - $doc_Delivered_To = _("Charge To"); - } - else - { - if ($doctype == ST_CUSTPAYMENT) - $doc_Charge_To = _("With thanks from"); - else - $doc_Charge_To = _("Charge To"); - $doc_Delivered_To = _("Delivered To"); - } - $doc_Shipping_Company = _("Shipping Company"); - if ($doctype == ST_SALESQUOTE) - $doc_Due_Date = _("Valid until"); - elseif ($doctype == ST_SALESORDER) - $doc_Due_Date = _("Delivery Date"); - elseif($doctype == ST_CUSTDELIVERY) - $doc_Due_Date = _("To Be Invoiced Before"); - else - $doc_Due_Date = _("Due Date"); - $doc_Your_Ref = _("Your Ref"); - if ($doctype == ST_WORKORDER) - { - $doc_Our_Ref = _("Type"); - $doc_Your_VAT_no = _("Manufactured Item"); - $doc_Payment_Terms = _("Required By"); - $doc_Customers_Ref = _("Reference"); - $doc_Our_Order_No = _("Into Location"); - $doc_Due_Date = _("Quantity"); - } - else - { - if ($doctype == ST_SUPPAYMENT || $doctype == ST_CUSTPAYMENT) - $doc_Our_Ref = _("Type"); - else - $doc_Our_Ref = _("Sales Person"); - $doc_Your_VAT_no = _("Your VAT no."); - $doc_Payment_Terms = _("Payment Terms"); - $doc_Customers_Ref = _("Customers Reference"); - $doc_Our_Order_No = _("Our Order No"); - } - $doc_Our_VAT_no = _("Our VAT No."); - $doc_Domicile = _("Domicile"); - $doc_Extra = ""; - if($doctype == ST_CUSTDELIVERY || $doctype == ST_SALESQUOTE || $doctype == ST_PURCHORDER || $doctype == ST_SALESORDER || - $doctype == ST_SUPPAYMENT || $doctype == ST_CUSTPAYMENT) { - if ($doctype == ST_CUSTPAYMENT) - $doc_Extra = _("* Subject to Realisation of the Cheque."); - $doc_Bank_Account = ''; - $doc_Please_Quote = _("All amounts stated in"); - } else { - $doc_Bank_Account = _("Bank Account"); - $doc_Please_Quote = $doctype==ST_SALESINVOICE ? - _("Please quote Invoice no. when paying. All amounts stated in") : - _("Please quote Credit no. when paying. All amounts stated in"); - } - $doc_Address = _("Address"); - $doc_Phone_Fax_Email = _("Phone/Fax/Email"); - $doc_Bank = _("Bank"); - $doc_Payment_Link = _("You can pay through"); - if ($doctype == ST_SALESQUOTE || $doctype == ST_PURCHORDER || $doctype == ST_SALESORDER || $doctype == ST_SALESINVOICE || - $doctype == ST_CUSTCREDIT || $doctype == ST_CUSTDELIVERY || $doctype == ST_WORKORDER || $doctype == ST_SUPPAYMENT || - $doctype == ST_CUSTPAYMENT) +/***** +* +* Set document type dependent elements of common page layout. +* +*/ + $Addr1 = array( + 'title' => _("Charge To"), + 'name' => @$this->formData['br_name'] ? $this->formData['br_name'] : @$this->formData['DebtorName'], + 'address' => @$this->formData['br_address'] ? $this->formData['br_address'] : @$this->formData['address'] + ); + $Addr2 = array( + 'title' => _("Delivered To"), + 'name' => @$this->formData['deliver_to'], + 'address' => @$this->formData['delivery_address'] + ); + + // default item column headers + $this->headers = array(_("Item Code"), _("Item Description"), _("Quantity"), + _("Unit"), _("Price"), _("Discount %"), _("Total")); + + // for links use 'text' => 'url' + $Footer[0] = _("All amounts stated in") . @$this->formData['curr_code']; + + switch ($this->formData['doctype']) { - if ($doctype == ST_SALESQUOTE) + case ST_SALESQUOTE: $this->title = _("SALES QUOTATION"); - elseif ($doctype == ST_PURCHORDER) - $this->title = _("PURCHASE ORDER"); - elseif ($doctype == ST_CUSTDELIVERY) - $this->title = ($packing_slip==1 ? _("PACKING SLIP") : _("DELIVERY NOTE")); - elseif ($doctype == ST_SALESORDER) + $this->formData['document_name'] =_("Quotation No."); + $this->formData['document_date'] = $this->formData['ord_date']; + $this->formData['document_number'] = $this->formData['order_no']; + $aux_info = array( + _("Customers Reference") => $this->formData["customer_ref"], + _("Sales Person") => get_salesman_name($this->formData['salesman']), + _("Your VAT no.") => '', + _("Our Order No") => '', + _("Valid until") => sql2date($this->formData['delivery_date']), + ); + break; + + case ST_SALESORDER: $this->title = ($print_as_quote==1 ? _("QUOTE") : _("SALES ORDER")); - elseif ($doctype == ST_SALESINVOICE) + $this->formData['document_name'] =_("Order No."); + $this->formData['document_date'] = $this->formData['ord_date']; + $this->formData['document_number'] = $this->formData['order_no']; + $this->formData['document_amount'] = $this->formData['order_no']; + + $aux_info = array( + _("Customers Reference") => $this->formData["customer_ref"], + _("Sales Person") => get_salesman_name($this->formData['salesman']), + _("Your VAT no.") => '', + _("Our Order No") => '', + _("Delivery Date") => sql2date($this->formData['delivery_date']), + ); + break; + + case ST_CUSTDELIVERY: + $this->title = ($packing_slip==1 ? _("PACKING SLIP") : _("DELIVERY NOTE")); + $this->formData['document_name'] = _("Delivery Note No."); + if (@$packing_slip) + $Payment_Terms = ''; + $ref = $this->formData['order_']; + if ($print_invoice_no == 0) + { + $ref = get_reference(ST_SALESORDER, $this->formData['order_']); + if (!$ref) + $ref = $this->formData['order_']; + } + $aux_info = array( + _("Customers Reference") => $this->formData["customer_ref"], + _("Sales Person") => get_salesman_name($this->formData['salesman']), + _("Your VAT no.") => $this->formData['tax_id'], + _("Our Order No") => $ref, + _("To Be Invoiced Before") => sql2date($this->formData['due_date']), + ); + break; + + case ST_CUSTCREDIT: + $this->title = _("CREDIT NOTE"); + $this->formData['document_name'] =_("Credit No."); + $Footer[0] = _("Please quote Credit no. when paying. All amounts stated in") . $this->formData['curr_code']; + + $aux_info = array( + _("Customers Reference") => @$this->formData["customer_ref"], + _("Sales Person") => get_salesman_name($this->formData['salesman']), + _("Your VAT no.") => $this->formData['tax_id'], + _("Our Order No") => $this->formData['order_'], + _("Due Date") => '', + ); + break; + + case ST_SALESINVOICE: $this->title = _("INVOICE"); - elseif ($doctype == ST_WORKORDER) - $this->title = _("WORK ORDER"); - elseif ($doctype == ST_SUPPAYMENT) + $this->formData['document_name'] =_("Invoice No."); + $this->formData['domicile'] = $this->company['domicile']; + $Footer[0] = _("Please quote Invoice no. when paying. All amounts stated in"). $this->formData['curr_code']; + + $deliveries = get_sales_parent_numbers(ST_SALESINVOICE, $this->formData['trans_no']); + if ($print_invoice_no == 0) + { + foreach($deliveries as $n => $delivery) { + $deliveries[$n] = get_reference(ST_CUSTDELIVERY, $delivery); + } + } + $aux_info = array( + _("Customers Reference") => $this->formData["customer_ref"], + _("Sales Person") => get_salesman_name($this->formData['salesman']), + _("Your VAT no.") => $this->formData['tax_id'], + _("Delivery Note No.") => implode(',', $deliveries), + _("Due Date") => sql2date($this->formData['due_date']), + ); + break; + + case ST_SUPPAYMENT: + global $systypes_array; + $this->title = _("REMITTANCE"); - elseif ($doctype == ST_CUSTPAYMENT) - $this->title = _("RECEIPT"); - else - $this->title = _("CREDIT NOTE"); - if ($doctype == ST_PURCHORDER) + $this->formData['document_name'] =_("Remittance No."); + $Addr1['title'] = _("Order To"); + $Addr1['name'] = $this->formData['supp_name']; + $Addr1['address'] = $this->formData['address']; + $Addr2['title'] = _("Charge To"); + $Addr2['name'] = ''; + $Addr2['address'] = ''; + + $aux_info = array( + _("Customers Reference") => $this->formData['supp_account_no'], + _("Type") =>$systypes_array[$this->formData["type"]], + _("Your VAT no.") => $this->formData['tax_id'], + _("Our Order No") => '', + _("Due Date") => sql2date($this->formData['tran_date']), + ); + $this->headers = array(_("Trans Type"), _("#"), _("Date"), _("Due Date"), _("Total Amount"), _("Left to Allocate"), _("This Allocation")); + break; + + case ST_PURCHORDER: + $this->title = _("PURCHASE ORDER"); + $this->formData['document_name'] =_("Purchase Order No."); + $Addr1['title'] = _("Order To"); + $Addr1['name'] = $this->formData['supp_name']; + $Addr1['address'] = $this->formData['address']; + $Addr2['title'] = _("Deliver To"); + $Addr2['name'] = $this->company['coy_name']; + $Addr2['address'] = $this->formData['deliver_to']; + $this->formData['document_date'] = $this->formData['ord_date']; + $this->formData['document_number'] = $this->formData['order_no']; + + $aux_info = array( + _("Customers Reference") => $this->formData['supp_account_no'], + _("Sales Person") => '', + _("Your VAT no.") => '', + _("Our Order No") => '', + _("Due Date") => '', + ); + $this->headers = array(_("Item Code"), _("Item Description"), _("Delivery Date"), _("Quantity"), _("Unit"), _("Price"), _("Total")); - elseif ($doctype == ST_WORKORDER) + break; + + case ST_CUSTPAYMENT: + global $systypes_array; + + $this->title = _("RECEIPT"); + $this->formData['document_name'] =_("Receipt No."); + $Addr1['title'] = _("With thanks from"); + $aux_info = array( + _("Customers Reference") => $this->formData["debtor_ref"], + _("Type") =>$systypes_array[$this->formData["type"]], + _("Your VAT no.") => $this->formData['tax_id'], + _("Our Order No") => $this->formData['order_'], + _("Due Date") => sql2date($this->formData['tran_date']), + ); + $this->headers = array(_("Trans Type"), _("#"), _("Date"), _("Due Date"), _("Total Amount"), _("Left to Allocate"), _("This Allocation")); + break; + + case ST_WORKORDER: + global $wo_types_array; + + $this->title = _("WORK ORDER"); + $this->formData['document_name'] =_("Work Order No."); + $this->formData['document_date'] = $this->formData['date_']; + $this->formData['document_number'] = $this->formData['id']; + $Addr1['name'] = $this->formData['location_name']; + $Addr1['address'] = $this->formData['delivery_address']; + $aux_info = array( + _("Reference") => $this->formData['wo_ref'], + _("Type") => $wo_types_array[$this->formData["type"]], + _("Manufactured Item") => $this->formData["StockItemName"], + _("Into Location") => $this->formData["location_name"], + _("Quantity") => $this->formData["units_issued"], + ); + $Payment_Terms = _("Required By").": ".sql2date($this->formData["required_by"]); $this->headers = array(_("Item Code"), _("Item Description"), _("From Location"), _("Work Centre"), _("Unit Quantity"), _("Total Quantity"), _("Units Issued")); - elseif ($doctype == ST_SUPPAYMENT || $doctype == ST_CUSTPAYMENT) - $this->headers = array(_("Trans Type"), _("#"), _("Date"), _("Due Date"), _("Total Amount"), _("Left to Allocate"), _("This Allocation")); - else - $this->headers = array(_("Item Code"), _("Item Description"), _("Quantity"), - _("Unit"), _("Price"), _("Discount %"), _("Total")); - } - else if ($doctype == ST_STATEMENT) - { - $this->title = _("STATEMENT"); - $this->headers = array(_("Trans Type"), _("#"), _("Date"), _("DueDate"), _("Charges"), - _("Credits"), _("Allocated"), _("Outstanding")); + unset($Footer[0]); + break; + + + case ST_STATEMENT: + $this->formData['document_name'] = ''; + $this->formData['domicile'] = $this->company['domicile']; + $Payment_Terms = ''; + $this->title = _("STATEMENT"); + $aux_info = array( + _("Customers Reference") => '', + _("Sales Person") => '', + _("Your VAT no.") => $this->formData['tax_id'], + _("Our Order No") => '', + _("Delivery Date") => '', + ); + $this->headers = array(_("Trans Type"), _("#"), _("Date"), _("DueDate"), _("Charges"), + _("Credits"), _("Allocated"), _("Outstanding")); } -} -if (isset($emailtype)) -{ - $doc_Dear_Sirs = _("Dear"); - $doc_AttachedFile = _("Attached you will find "); - $doc_Kindest_regards = _("Kindest regards"); - $doc_Payment_Link = _("You can pay through"); -} -if (isset($header2type) || isset($linetype)) -{ - $doc_Invoice_no = ($doctype==ST_CUSTDELIVERY ? _("Delivery Note No.") : - ($doctype == ST_CUSTPAYMENT ? _("Receipt No.") : - ($doctype == ST_SUPPAYMENT ? _("Remittance No.") : - ($doctype == ST_PURCHORDER ? _("Purchase Order No.") : - ($doctype == ST_SALESORDER ? _("Order No.") : - ($doctype == ST_SALESQUOTE ? _("Quotation No.") : - ($doctype == ST_SALESINVOICE ? _("Invoice No.") : - ($doctype == ST_WORKORDER ? _("Work Order No.") : _("Credit No."))))))))); - - $doc_Delivery_no = _("Delivery Note No."); - $doc_Order_no = _("Order No."); -} -if (isset($linetype)) -{ - - if ($doctype == ST_SALESQUOTE || $doctype == ST_PURCHORDER || $doctype == ST_SALESORDER || - $doctype == ST_SALESINVOICE || $doctype == ST_CUSTCREDIT || $doctype == ST_CUSTDELIVERY) + + // default values + if (!isset($this->formData['document_date'])) + $this->formData['document_date'] = $this->formData['tran_date']; + + if (!isset($this->formData['document_number'])) + $this->formData['document_number'] = $print_invoice_no == 0 && isset($this->formData['reference']) + ? $this->formData['reference'] : @$this->formData['trans_no']; + + if (!isset($Payment_Terms)) { - $doc_Sub_total = _("Sub-total"); - $doc_Shipping = _("Shipping"); - $doc_Included = _("Included"); - $doc_Amount = _("Amount"); - $doc_TOTAL_INVOICE = $doctype ==ST_SALESINVOICE ? _("TOTAL INVOICE") : _("TOTAL CREDIT"); - $doc_TOTAL_ORDER = _("TOTAL ORDER EX VAT"); - $doc_TOTAL_ORDER2 = _("TOTAL ORDER VAT INCL."); - $doc_TOTAL_PO = _("TOTAL PO"); - $doc_TOTAL_DELIVERY = _("TOTAL DELIVERY INCL. VAT"); + $id = $this->formData['payment_terms']; + $sql = "SELECT terms FROM ".TB_PREF."payment_terms WHERE terms_indicator=".db_escape($id); + $result = db_query($sql,"could not get paymentterms"); + $row = db_fetch($result); + $Payment_Terms = _("Payment Terms") . ': ' . $row["terms"]; } - elseif ($doctype == ST_SUPPAYMENT || $doctype == ST_CUSTPAYMENT) + + // footer generic content + if (@$this->formData['bank_name']) + $Footer[] = _("Bank"). ": ".$this->formData['bank_name']. ", " . _("Bank Account") . ": " . $this->formData['bank_account_number']; + + if (@$this->formData['payment_service']) //payment link { - $doc_Towards = _("As advance / full / part / payment towards:"); - $doc_by_Cheque = _("By Cash / Cheque* / Draft No."); - $doc_Dated = _("Dated"); - $doc_Drawn = _("Drawn on Bank"); - $doc_Drawn_Branch = _("Branch"); - $doc_Received = _("Received / Sign"); - $doc_Total_Allocated = _("Total Allocated"); - $doc_Left_To_Allocate = _("Left to Allocate"); - if ($doctype == ST_CUSTPAYMENT) - $doc_Total_Payment = _("TOTAL RECEIPT"); - else - $doc_Total_Payment = _("TOTAL REMITTANCE"); + $amt = number_format($this->formData["ov_freight"] + $this->formData["ov_gst"] + $this->formData["ov_amount"], user_price_dec()); + $service = $this->formData['payment_service']; + $url = payment_link($service, array( + 'company_email' => $this->company['email'], + 'amount' => $amt, + 'currency' => $this->formData['curr_code'], + 'comment' => $this->title . " " . $this->formData['reference'] + )); + $Footer[_("You can pay through"). " $service: "] = "$url"; } - elseif ($doctype == ST_STATEMENT) + + if ($this->formData['doctype'] == ST_CUSTPAYMENT) + $Footer[] = _("* Subject to Realisation of the Cheque."); + + if ($this->params['comments'] != '') + $Footer[] = $this->params['comments']; + + if (($this->formData['doctype'] == ST_SALESINVOICE || $this->formData['doctype'] == ST_STATEMENT) && $this->company['legal_text'] != "") { - $doc_Outstanding = _("Outstanding Transactions"); - $doc_Current = _("Current"); - $doc_Total_Balance = _("Total Balance"); - $doc_Statement = _("Statement"); - $doc_as_of = _("as of"); - $doc_Days = _("Days"); - $doc_Over = _("Over"); + foreach(explode("\n", $this->company['legal_text']) as $line) + $Footer[] = $line; } -} + ?> diff --git a/reporting/includes/header2.inc b/reporting/includes/header2.inc index cb40430a..d1ac120b 100644 --- a/reporting/includes/header2.inc +++ b/reporting/includes/header2.inc @@ -9,10 +9,18 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the License here . ***********************************************************************/ - // New version (without vertical lines) - global $wo_types_array, $systypes_array; - +/** + Document blueprint use following parameters set in doctext.inc: + + $Addr1, $Addr2 - address info + $Payment_Terms - payment terms line + $Footer - footer texts + $this->company - company info + $this->title - report title + $this->formData - some other info +***/ + $this->row = $this->pageHeight - $this->topMargin; $upper = $this->row - 2 * $this->lineHeight; @@ -56,6 +64,7 @@ $this->LineTo($this->cols[$cols - 2] + 4, $iline5 ,$this->cols[$cols - 2] + 4, $iline7); $this->LineTo($right, $iline5 ,$right, $iline7); + // Company Logo $this->NewLine(); if ($this->company['coy_logo'] != '') { @@ -70,6 +79,7 @@ $this->Font(); $this->fontSize -= 4; } + // Document title $this->SetTextColor(190, 190, 190); $this->fontSize += 10; $this->Font('bold'); @@ -79,6 +89,8 @@ $this->NewLine(); $this->SetTextColor(0, 0, 0); $adrline = $this->row; + + // Company data $this->TextWrapLines($ccol, $icol, $this->company['postal_address']); $this->Font('italic'); if ($this->company['phone'] != "") @@ -104,198 +116,67 @@ $this->addLink($url, $c2col, $this->row, $mcol, $this->row + $this->lineHeight); $this->NewLine(); - } + } if ($this->company['gst_no'] != "") { - $this->Text($ccol, $doc_Our_VAT_no, $c2col); + $this->Text($ccol, _("Our VAT No."), $c2col); $this->Text($c2col, $this->company['gst_no'], $mcol); $this->NewLine(); } - if (($doctype == ST_SALESINVOICE || $doctype == ST_STATEMENT) && $this->company['domicile'] != "") + if ($this->formData['domicile'] != "") { - $this->Text($ccol, $doc_Domicile, $c2col); + $this->Text($ccol, _("Domicile"), $c2col); $this->Text($c2col, $this->company['domicile'], $mcol); $this->NewLine(); } $this->Font(); $this->row = $adrline; $this->NewLine(3); - $this->Text($mcol + 100, $doc_Date); - if ($doctype == ST_SALESQUOTE || $doctype == ST_PURCHORDER || $doctype == ST_SALESORDER) - $this->Text($mcol + 180, sql2date($this->formData['ord_date'])); - elseif ($doctype == ST_WORKORDER) - $this->Text($mcol + 180, sql2date($this->formData['date_'])); - else - $this->Text($mcol + 180, sql2date($this->formData['tran_date'])); + $this->Text($mcol + 100, _("Date")); + $this->Text($mcol + 180, sql2date($this->formData['document_date'])); + $this->NewLine(); - $this->Text($mcol + 100, $doc_Invoice_no); - if ($doctype == ST_SALESQUOTE || $doctype == ST_PURCHORDER || $doctype == ST_SALESORDER) // QUOTE, PO or SO - { - if ($print_invoice_no == 1) - $this->Text($mcol + 180, $this->formData['order_no']); - else - $this->Text($mcol + 180, $this->formData['reference']); - } - elseif ($doctype == ST_WORKORDER) - $this->Text($mcol + 180, $this->formData['id']); - else if (isset($this->formData['trans_no']) && isset($this->formData['reference'])) // INV/CRE/STA - { - if ($print_invoice_no == 1) - $this->Text($mcol + 180, $this->formData['trans_no']); - else - $this->Text($mcol + 180, $this->formData['reference']); - } + $this->Text($mcol + 100, $this->formData['document_name']); + $this->Text($mcol + 180, $this->formData['document_number']); if ($this->pageNumber > 1 && !strstr($this->filename, "Bulk")) $this->Text($this->endLine - 35, _("Page") . ' ' . $this->pageNumber); $this->row = $iline1 - $this->lineHeight; $this->fontSize -= 4; - $this->Text($ccol, $doc_Charge_To, $icol); - $this->Text($mcol, $doc_Delivered_To); + $this->Text($ccol, $Addr1['title'], $icol); + $this->Text($mcol, $Addr2['title']); $this->fontSize += 4; - $this->row = $this->row - $this->lineHeight - 5; +// address1 + $temp = $this->row = $this->row - $this->lineHeight - 5; + $this->Text($ccol, $Addr1['name'], $icol); + $this->NewLine(); + $this->TextWrapLines($ccol, $icol - $ccol, $Addr1['address']); - $temp = $this->row; - if ($doctype == ST_SALESQUOTE || $doctype == ST_SALESORDER) - { - $this->Text($ccol, $this->formData['name'], $icol); - } - elseif ($doctype == ST_WORKORDER) - { - $this->Text($ccol, $this->formData['location_name'], $icol); - $this->NewLine(); - $this->TextWrapLines($ccol, $icol - $ccol, $this->formData['delivery_address']); - } - else - { - if ($doctype == ST_PURCHORDER || $doctype == ST_SUPPAYMENT) { - $name = $this->formData['supp_name']; - $addr = $this->formData['address']; - } else { - if (isset($this->formData['br_address']) && - trim($this->formData['br_address']) != '') { - $name = $this->formData['br_name']; - $addr = $this->formData['br_address']; - } else { - $name = $this->formData['DebtorName']; - $addr = $this->formData['address']; - } - } - $this->Text($ccol, $name, $icol); - $this->NewLine(); - $this->TextWrapLines($ccol, $icol - $ccol, $addr); - } +// address2 $this->row = $temp; - if (isset($this->formData['deliver_to'])) - { - if ($doctype == ST_PURCHORDER) - $this->Text($mcol, $this->company['coy_name']); - elseif ($doctype != ST_SUPPAYMENT && isset($this->formData['deliver_to'])) - { - $this->Text($mcol, $this->formData['deliver_to']); - $this->NewLine(); - } - if ($doctype != ST_SUPPAYMENT && isset($this->formData['delivery_address'])) - $this->TextWrapLines($mcol, $this->rightMargin - $mcol, $this->formData['delivery_address']); - } // if you need the company name in purchase order then write it as first line in location addresss. - elseif ($doctype == ST_PURCHORDER && isset($this->formData['delivery_address'])) - $this->TextWrapLines($mcol, $this->rightMargin - $mcol, $this->formData['delivery_address']); - $this->row = $iline2 - $this->lineHeight - 1; - $col = $this->leftMargin; - $this->TextWrap($col, $this->row, $width, $doc_Customers_Ref, 'C'); - $col += $width; - $this->TextWrap($col, $this->row, $width, $doc_Our_Ref, 'C'); - $col += $width; - $this->TextWrap($col, $this->row, $width, $doc_Your_VAT_no, 'C'); - $col += $width; - if ($doctype == ST_SALESINVOICE) - $this->TextWrap($col, $this->row, $width, $doc_Delivery_no, 'C'); - else - $this->TextWrap($col, $this->row, $width, $doc_Our_Order_No, 'C'); - $col += $width; - $this->TextWrap($col, $this->row, $width, $doc_Due_Date, 'C'); - $this->row = $iline3 - $this->lineHeight - 1; + $this->Text($mcol, $Addr2['name']); + $this->NewLine(); + $this->TextWrapLines($mcol, $this->rightMargin - $mcol, $Addr2['address']); + + // Auxiliary document information $col = $this->leftMargin; - if ($doctype == ST_PURCHORDER || $doctype == ST_SUPPAYMENT) - $this->TextWrap($col, $this->row, $width, $this->formData['supp_account_no'], 'C'); - elseif ($doctype == ST_WORKORDER) - $this->TextWrap($col, $this->row, $width, $this->formData['wo_ref'], 'C'); - elseif (isset($this->formData["customer_ref"])) - $this->TextWrap($col, $this->row, $width, $this->formData["customer_ref"], 'C'); - elseif (isset($this->formData["debtor_ref"])) - $this->TextWrap($col, $this->row, $width, $this->formData["debtor_ref"], 'C'); - $col += $width; - if (isset($this->formData['salesman'])) + foreach($aux_info as $info_header => $info_content) { - $id = $this->formData['salesman']; - //$sql = "SELECT salesman_name FROM ".TB_PREF."salesman WHERE salesman_code='$id'"; - //$result = db_query($sql,"could not get sales person"); - //$row = db_fetch($result); - //$this->TextWrap($col, $this->row, $width, $row['salesman_name'], 'C'); - $this->TextWrap($col, $this->row, $width, get_salesman_name($id), 'C'); - } - elseif ($doctype == ST_SUPPAYMENT || $doctype == ST_CUSTPAYMENT) - $this->TextWrap($col, $this->row, $width, $systypes_array[$this->formData["type"]], 'C'); - elseif ($doctype == ST_WORKORDER) - $this->TextWrap($col, $this->row, $width, $wo_types_array[$this->formData["type"]], 'C'); - $col += $width; - if ($doctype == ST_WORKORDER) - $this->TextWrap($col, $this->row, $width, $this->formData["StockItemName"], 'C'); - elseif ($doctype != ST_PURCHORDER && isset($this->formData['tax_id'])) - $this->TextWrap($col, $this->row, $width, $this->formData['tax_id'], 'C'); - $col += $width; - if ($doctype == ST_SALESINVOICE) - { - $deliveries = get_sales_parent_numbers(ST_SALESINVOICE, $this->formData['trans_no']); - if ($print_invoice_no == 0) - { - foreach($deliveries as $n => $delivery) { - $deliveries[$n] = get_reference(ST_CUSTDELIVERY, $delivery); - } - } - $this->TextWrap($col, $this->row, $width, implode(',', $deliveries), 'C'); - } - elseif ($doctype == ST_CUSTDELIVERY) - { - $ref = $this->formData['order_']; - if ($print_invoice_no == 0) - { - $ref = get_reference(ST_SALESORDER, $this->formData['order_']); - if (!$ref) - $ref = $this->formData['order_']; - } - $this->TextWrap($col, $this->row, $width, $ref, 'C'); - } - elseif ($doctype == ST_WORKORDER) - $this->TextWrap($col, $this->row, $width, $this->formData["location_name"], 'C'); - elseif (isset($this->formData['order_']) && $this->formData['order_'] != 0) - $this->TextWrap($col, $this->row, $width, $this->formData['order_'], 'C'); - $col += $width; - if ($doctype == ST_SALESORDER || $doctype == ST_SALESQUOTE) - $this->TextWrap($col, $this->row, $width, sql2date($this->formData['delivery_date']), 'C'); - elseif ($doctype == ST_WORKORDER) - $this->TextWrap($col, $this->row, $width, $this->formData["units_issued"], 'C'); - elseif ($doctype != ST_PURCHORDER && $doctype != ST_CUSTCREDIT && $doctype != ST_CUSTPAYMENT && - $doctype != ST_SUPPAYMENT && isset($this->formData['due_date'])) - $this->TextWrap($col, $this->row, $width, sql2date($this->formData['due_date']), 'C'); - if ((!isset($packing_slip) || $packing_slip == 0) && ($doctype != ST_STATEMENT)) //! - { - $this->row -= (2 * $this->lineHeight); - if ($doctype == ST_WORKORDER) - $str = sql2date($this->formData["required_by"]); - else - { - $id = $this->formData['payment_terms']; - $sql = "SELECT terms FROM ".TB_PREF."payment_terms WHERE terms_indicator=".db_escape($id); - $result = db_query($sql,"could not get paymentterms"); - $row = db_fetch($result); - $str = $row["terms"]; - } - $this->Font('italic'); - $this->TextWrap($ccol, $this->row, $right-$ccol, $doc_Payment_Terms . ": " . $str); - $this->Font(); + + $this->row = $iline2 - $this->lineHeight - 1; + $this->TextWrap($col, $this->row, $width, $info_header, 'C'); + $this->row = $iline3 - $this->lineHeight - 1; + $this->TextWrap($col, $this->row, $width, $info_content, 'C'); + $col += $width; } + // Payment terms + $this->row -= (2 * $this->lineHeight); + $this->Font('italic'); + $this->TextWrap($ccol, $this->row, $right-$ccol, $Payment_Terms); + $this->Font(); + + // Line headers $this->row = $iline5 - $this->lineHeight - 1; $this->Font('bold'); $count = count($this->headers); @@ -303,52 +184,30 @@ for ($i = 0; $i < $count; $i++) $this->TextCol($i, $i + 1, $this->headers[$i], -2); $this->Font(); + + // Footer $this->Font('italic'); $this->row = $iline7 - $this->lineHeight - 6; - if ($doctype != ST_WORKORDER) - $this->TextWrap($ccol, $this->row, $right - $ccol, $doc_Please_Quote . " - " . $this->formData['curr_code'], 'C'); - $this->row -= $this->lineHeight; - if (isset($this->formData['bank_name'])) - { - $txt = $doc_Bank . ": ".$this->formData['bank_name']. ", " . $doc_Bank_Account . ": " . $this->formData['bank_account_number']; - $this->TextWrap($ccol, $this->row, $right - $ccol, $txt, 'C'); - $this->row -= $this->lineHeight; - } - if ($doctype == ST_SALESINVOICE && $this->formData['disable_branch'] > 0) // payment links + foreach ($Footer as $line => $txt) { - if ($this->formData['disable_branch'] == 1) + if (!is_numeric($line)) // title => link { - $amt = number_format($this->formData["ov_freight"] + $this->formData["ov_gst"] + $this->formData["ov_amount"], user_price_dec()); - $txt = $doc_Payment_Link . " PayPal: "; - $name = urlencode($this->title . " " . $this->formData['reference']); - $url = "https://www.paypal.com/xclick/business=" . $this->company['email'] . "&item_name=" . - $name . "&amount=" . $amt . "¤cy_code=" . $this->formData['curr_code']; $this->fontSize -= 2; - $this->TextWrap($ccol, $this->row, $right - $ccol, $txt, 'C'); + $this->TextWrap($ccol, $this->row, $right - $ccol, $line, 'C'); $this->row -= $this->lineHeight; $this->SetTextColor(0, 0, 255); - $this->TextWrap($ccol, $this->row, $right - $ccol, $url, 'C'); + $this->TextWrap($ccol, $this->row, $right - $ccol, $txt, 'C'); $this->SetTextColor(0, 0, 0); - $this->addLink($url, $ccol, $this->row, $this->pageWidth - $this->rightMargin, $this->row + $this->lineHeight); + $this->addLink($txt, $ccol, $this->row, $this->pageWidth - $this->rightMargin, $this->row + $this->lineHeight); $this->fontSize += 2; - $this->row -= $this->lineHeight; } - } - if ($doc_Extra != "") - { - $this->TextWrap($ccol, $this->row, $right - $ccol, $doc_Extra, 'C'); - $this->row -= $this->lineHeight; - } - if ($this->params['comments'] != '') - { - $this->TextWrap($ccol, $this->row, $right - $ccol, $this->params['comments'], 'C'); + else + $this->TextWrap($ccol, $this->row, $right - $ccol, $txt, 'C'); $this->row -= $this->lineHeight; + } - if (($doctype == ST_SALESINVOICE || $doctype == ST_STATEMENT) && $this->company['legal_text'] != "") - { - $this->TextWrapLines($ccol, $right - $ccol, $this->company['legal_text'], 'C'); - } + $this->Font(); $temp = $iline6 - $this->lineHeight - 2; ?> \ No newline at end of file diff --git a/reporting/includes/pdf_report.inc b/reporting/includes/pdf_report.inc index e3aedbf6..9e405431 100644 --- a/reporting/includes/pdf_report.inc +++ b/reporting/includes/pdf_report.inc @@ -389,7 +389,7 @@ class FrontReport extends Cpdf 'ov_freight', 'ov_gst', 'ov_amount'), 'branch' => array('br_address', 'br_name', 'salesman', 'disable_branch'), 'sales_order' => array('deliver_to', 'delivery_address', 'customer_ref'), - 'bankaccount' => array('bank_name', 'bank_account_number') + 'bankaccount' => array('bank_name', 'bank_account_number', 'payment_service') ); foreach($datnames as $var => $fields) { @@ -402,6 +402,7 @@ class FrontReport extends Cpdf } } $this->formData['doctype'] = $doctype; + $this->formData['document_amount'] = @$this->formData['ov_amount']+@$this->formData['ov_freight']+@$this->formData['ov_gst']; if (count($contacts)) { if (!is_array($contacts[0])) $contacts = array($contacts); // change to array when single contact passed @@ -427,7 +428,7 @@ class FrontReport extends Cpdf $doctype = $this->formData['doctype']; $header2type = true; - + $this->SetLang(@$this->formData['rep_lang'] ? $this->formData['rep_lang'] : $dflt_lang); // leave layout files names without path to enable including @@ -944,7 +945,7 @@ class FrontReport extends Cpdf $this->{$this->headerTmpl}(); } - function End($email=0, $subject=null, $myrow=null, $doctype = 0) + function End($email=0) { global $pdf_debug, $path_to_root; @@ -958,7 +959,6 @@ class FrontReport extends Cpdf } else { - $dir = company_path(). '/pdf_files'; //save the file if (!file_exists($dir)) @@ -980,12 +980,12 @@ class FrontReport extends Cpdf display_error(_("You have no email contact defined for this type of document")); } else { $sent = $try = 0; + $subject = $this->formData['document_name'] . ' '. $this->formData['document_number']; foreach($this->contactData as $contact) { if (!isset($contact['email'])) continue; $emailtype = true; $this->SetLang($contact['lang']); - include("includes/doctext.inc"); require_once($path_to_root . "/reporting/includes/class.mail.inc"); $mail = new email(str_replace(",", "", $this->company['coy_name']), @@ -994,21 +994,24 @@ class FrontReport extends Cpdf $to = str_replace(",", "", $contact['name'].' '.$contact['name2']) ." <" . $contact['email'] . ">"; - $msg = $doc_Dear_Sirs . " " . $contact['name2'] . ",\n\n" - . $doc_AttachedFile . " " . $subject ."\n\n"; - if (isset($myrow['dimension_id']) && $myrow['dimension_id'] > 0 && $doctype == ST_SALESINVOICE) // helper for payment links + $msg = _("Dear") . " " . $contact['name2'] . ",\n\n" + . _("Attached you will find ") . " " . $subject ."\n\n"; + + if (isset($this->formData['payment_service'])) { - if ($myrow['dimension_id'] == 1) - { - $amt = number_format($myrow["ov_freight"] + $myrow["ov_gst"] + $myrow["ov_amount"], user_price_dec()); - $txt = $doc_Payment_Link . " PayPal: "; - $nn = urlencode($this->title . " " . $myrow['reference']); - $url = "https://www.paypal.com/xclick/business=" . $this->company['email'] . "&item_name=" . - $nn . "&amount=" . $amt . "¤cy_code=" . $myrow['curr_code']; - $msg .= $txt . $url . "\n\n"; - } + $amt = number_format($this->formData['document_amount'], user_price_dec()); + $service = $this->formData['payment_service']; + $url = payment_link($service, array( + 'company_email' => $this->company['email'], + 'amount' => $amt, + 'currency' => $this->formData['curr_code'], + 'comment' => $this->title . " " . $this->formData['document_number'] + )); + if ($url) + $msg.= _("You can pay through"). " $service: $url\n\n"; } - $msg .= $doc_Kindest_regards . "\n\n"; + + $msg .= _("Kindest regards") . "\n\n"; $sender = $this->user . "\n" . $this->company['coy_name'] . "\n" . $this->company['postal_address'] . "\n" . $this->company['email'] . "\n" . $this->company['phone']; $mail->to($to); $try++; $mail->subject($subject); @@ -1023,7 +1026,7 @@ class FrontReport extends Cpdf } elseif (!$sent) display_error(_("Sending document by email failed")); else - display_notification($this->title . " " . $myrow['reference'] . " " + display_notification($this->title . " " . $this->formData['document_number'] . " " . _("has been sent by email to destination.")); } } diff --git a/reporting/includes/reports_classes.inc b/reporting/includes/reports_classes.inc index 7606f3cf..92e5a9eb 100644 --- a/reporting/includes/reports_classes.inc +++ b/reporting/includes/reports_classes.inc @@ -221,8 +221,7 @@ class BoxReports return yesno_list($name); case 'PAYMENT_LINK': - $sel = array(_("No payment Link"), "PayPal"); - return array_selector($name, null, $sel); + return payment_services($name, null); case 'DESTINATION': $sel = array(_("PDF/Printer"), "Excel"); diff --git a/reporting/rep107.php b/reporting/rep107.php index 910b5b62..e5a832cc 100644 --- a/reporting/rep107.php +++ b/reporting/rep107.php @@ -40,7 +40,7 @@ function print_invoices() $to = $_POST['PARAM_1']; $currency = $_POST['PARAM_2']; $email = $_POST['PARAM_3']; - $paylink = $_POST['PARAM_4']; + $pay_service = $_POST['PARAM_4']; $comments = $_POST['PARAM_5']; if ($from == null) @@ -69,7 +69,6 @@ function print_invoices() $rep->Font(); $rep->Info($params, $cols, null, $aligns); } - for ($i = $fno[0]; $i <= $tno[0]; $i++) { if (!exists_customer_trans(ST_SALESINVOICE, $i)) @@ -80,7 +79,6 @@ function print_invoices() $params['bankaccount'] = $baccount['id']; $branch = get_branch($myrow["branch_code"]); - $branch['disable_branch'] = $paylink; // helper $sales_order = get_sales_order_header($myrow["order_"], ST_SALESORDER); if ($email == 1) { @@ -95,16 +93,16 @@ function print_invoices() else $rep->title = _('INVOICE'); $contacts = get_branch_contacts($branch['branch_code'], 'invoice', $branch['debtor_no']); + $baccount['payment_service'] = $pay_service; $rep->SetCommonData($myrow, $branch, $sales_order, $baccount, ST_SALESINVOICE, $contacts); $rep->NewPage(); - $result = get_customer_trans_details(ST_SALESINVOICE, $i); $SubTotal = 0; while ($myrow2=db_fetch($result)) { if ($myrow2["quantity"] == 0) continue; - + $Net = round2($sign * ((1 - $myrow2["discount_percent"]) * $myrow2["unit_price"] * $myrow2["quantity"]), user_price_dec()); $SubTotal += $Net; @@ -143,14 +141,12 @@ function print_invoices() $DisplayFreight = number_format2($sign*$myrow["ov_freight"],$dec); $rep->row = $rep->bottomMargin + (15 * $rep->lineHeight); - $linetype = true; $doctype = ST_SALESINVOICE; - include($path_to_root . "/reporting/includes/doctext.inc"); - $rep->TextCol(3, 6, $doc_Sub_total, -2); + $rep->TextCol(3, 6, _("Sub-total"), -2); $rep->TextCol(6, 7, $DisplaySubTot, -2); $rep->NewLine(); - $rep->TextCol(3, 6, $doc_Shipping, -2); + $rep->TextCol(3, 6, _("Shipping"), -2); $rep->TextCol(6, 7, $DisplayFreight, -2); $rep->NewLine(); $tax_items = get_trans_tax_details(ST_SALESINVOICE, $i); @@ -181,7 +177,7 @@ function print_invoices() $first = false; } else - $rep->TextCol(3, 7, $doc_Included . " " . $tax_type_name . $doc_Amount . ": " . $DisplayTax, -2); + $rep->TextCol(3, 7, _("Included") . " " . $tax_type_name . _("Amount") . ": " . $DisplayTax, -2); } else { @@ -190,23 +186,23 @@ function print_invoices() } $rep->NewLine(); } + $rep->NewLine(); $DisplayTotal = number_format2($sign*($myrow["ov_freight"] + $myrow["ov_gst"] + $myrow["ov_amount"]+$myrow["ov_freight_tax"]),$dec); $rep->Font('bold'); - $rep->TextCol(3, 6, $doc_TOTAL_INVOICE, - 2); + $rep->TextCol(3, 6, _("TOTAL INVOICE"), - 2); $rep->TextCol(6, 7, $DisplayTotal, -2); $words = price_in_words($myrow['Total'], ST_SALESINVOICE); if ($words != "") { $rep->NewLine(1); $rep->TextCol(1, 7, $myrow['curr_code'] . ": " . $words, - 2); - } + } $rep->Font(); if ($email == 1) { - $myrow['dimension_id'] = $paylink; // helper for pmt link - $rep->End($email, $doc_Invoice_no . " " . $myrow['reference'], $myrow, ST_SALESINVOICE); + $rep->End($email, '', $myrow, ST_SALESINVOICE); } } if ($email == 0) diff --git a/reporting/rep108.php b/reporting/rep108.php index e40e29c0..83234fd2 100644 --- a/reporting/rep108.php +++ b/reporting/rep108.php @@ -121,11 +121,9 @@ function print_statements() $rep->SetCommonData($myrow, null, null, $baccount, ST_STATEMENT, $contacts); $rep->NewPage(); $rep->NewLine(); - $linetype = true; $doctype = ST_STATEMENT; - include($path_to_root . "/reporting/includes/doctext.inc"); $rep->fontSize += 2; - $rep->TextCol(0, 8, $doc_Outstanding); + $rep->TextCol(0, 8, _("Outstanding Transactions")); $rep->fontSize -= 2; $rep->NewLine(2); while ($myrow2=db_fetch($TransResult)) @@ -149,11 +147,11 @@ function print_statements() if ($rep->row < $rep->bottomMargin + (10 * $rep->lineHeight)) $rep->NewPage(); } - $nowdue = "1-" . $PastDueDays1 . " " . $doc_Days; - $pastdue1 = $PastDueDays1 + 1 . "-" . $PastDueDays2 . " " . $doc_Days; - $pastdue2 = $doc_Over . " " . $PastDueDays2 . " " . $doc_Days; + $nowdue = "1-" . $PastDueDays1 . " " . _("Days"); + $pastdue1 = $PastDueDays1 + 1 . "-" . $PastDueDays2 . " " . _("Days"); + $pastdue2 = _("Over") . " " . $PastDueDays2 . " " . _("Days"); $CustomerRecord = get_customer_details($myrow['debtor_no'], null, $show_also_allocated); - $str = array($doc_Current, $nowdue, $pastdue1, $pastdue2, $doc_Total_Balance); + $str = array(_("Current"), $nowdue, $pastdue1, $pastdue2, _("Total Balance")); $str2 = array(number_format2(($CustomerRecord["Balance"] - $CustomerRecord["Due"]),$dec), number_format2(($CustomerRecord["Due"]-$CustomerRecord["Overdue1"]),$dec), number_format2(($CustomerRecord["Overdue1"]-$CustomerRecord["Overdue2"]) ,$dec), @@ -168,7 +166,7 @@ function print_statements() for ($i = 0; $i < 5; $i++) $rep->TextWrap($col[$i], $rep->row, $col[$i + 1] - $col[$i], $str2[$i], 'right'); if ($email == 1) - $rep->End($email, $doc_Statement . " " . $doc_as_of . " " . sql2date($date), $myrow, ST_STATEMENT); + $rep->End($email, _("Statement") . " " . _("as of") . " " . sql2date($date), $myrow, ST_STATEMENT); } if ($email == 0) diff --git a/reporting/rep109.php b/reporting/rep109.php index 25399a4b..3939459d 100644 --- a/reporting/rep109.php +++ b/reporting/rep109.php @@ -143,20 +143,18 @@ function print_sales_orders() $DisplayFreight = number_format2($myrow["freight_cost"],$dec); $rep->row = $rep->bottomMargin + (15 * $rep->lineHeight); - $linetype = true; $doctype = ST_SALESORDER; - include($path_to_root . "/reporting/includes/doctext.inc"); - $rep->TextCol(3, 6, $doc_Sub_total, -2); + $rep->TextCol(3, 6, _("Sub-total"), -2); $rep->TextCol(6, 7, $DisplaySubTot, -2); $rep->NewLine(); - $rep->TextCol(3, 6, $doc_Shipping, -2); + $rep->TextCol(3, 6, _("Shipping"), -2); $rep->TextCol(6, 7, $DisplayFreight, -2); $rep->NewLine(); $DisplayTotal = number_format2($myrow["freight_cost"] + $SubTotal, $dec); if ($myrow['tax_included'] == 0) { - $rep->TextCol(3, 6, $doc_TOTAL_ORDER, - 2); + $rep->TextCol(3, 6, _("TOTAL ORDER EX VAT"), - 2); $rep->TextCol(6, 7, $DisplayTotal, -2); $rep->NewLine(); } @@ -187,7 +185,7 @@ function print_sales_orders() $first = false; } else - $rep->TextCol(3, 7, $doc_Included . " " . $tax_type_name . " " . $doc_Amount . ": " . $DisplayTax, -2); + $rep->TextCol(3, 7, _("Included") . " " . $tax_type_name . " " . _("Amount"). ": " . $DisplayTax, -2); } else { @@ -202,7 +200,7 @@ function print_sales_orders() $DisplayTotal = number_format2($myrow["freight_cost"] + $SubTotal, $dec); $rep->Font('bold'); - $rep->TextCol(3, 6, $doc_TOTAL_ORDER2, - 2); + $rep->TextCol(3, 6, _("TOTAL ORDER VAT INCL."), - 2); $rep->TextCol(6, 7, $DisplayTotal, -2); $words = price_in_words($myrow["freight_cost"] + $SubTotal, ST_SALESORDER); if ($words != "") @@ -213,7 +211,7 @@ function print_sales_orders() $rep->Font(); if ($email == 1) { - $rep->End($email, $doc_Invoice_no . " " . $i, $myrow); + $rep->End($email, '', $myrow); } } if ($email == 0) diff --git a/reporting/rep110.php b/reporting/rep110.php index 06857a8d..b4bf2e9d 100644 --- a/reporting/rep110.php +++ b/reporting/rep110.php @@ -153,15 +153,13 @@ function print_deliveries() $DisplayFreight = number_format2($myrow["ov_freight"],$dec); $rep->row = $rep->bottomMargin + (15 * $rep->lineHeight); - $linetype = true; $doctype=ST_CUSTDELIVERY; - include($path_to_root . "/reporting/includes/doctext.inc"); if ($packing_slip == 0) { - $rep->TextCol(3, 6, $doc_Sub_total, -2); + $rep->TextCol(3, 6, _("Sub-total"), -2); $rep->TextCol(6, 7, $DisplaySubTot, -2); $rep->NewLine(); - $rep->TextCol(3, 6, $doc_Shipping, -2); + $rep->TextCol(3, 6, _("Shipping"), -2); $rep->TextCol(6, 7, $DisplayFreight, -2); $rep->NewLine(); $tax_items = get_trans_tax_details(ST_CUSTDELIVERY, $i); @@ -192,7 +190,7 @@ function print_deliveries() $first = false; } else - $rep->TextCol(3, 7, $doc_Included . " " . $tax_type_name . $doc_Amount . ": " . $DisplayTax, -2); + $rep->TextCol(3, 7, _("Included") . " " . $tax_type_name . _("Amount") . ": " . $DisplayTax, -2); } else { @@ -205,7 +203,7 @@ function print_deliveries() $DisplayTotal = number_format2($myrow["ov_freight"] +$myrow["ov_freight_tax"] + $myrow["ov_gst"] + $myrow["ov_amount"],$dec); $rep->Font('bold'); - $rep->TextCol(3, 6, $doc_TOTAL_DELIVERY, - 2); + $rep->TextCol(3, 6, _("TOTAL DELIVERY INCL. VAT"), - 2); $rep->TextCol(6, 7, $DisplayTotal, -2); $words = price_in_words($myrow['Total'], ST_CUSTDELIVERY); if ($words != "") @@ -217,7 +215,7 @@ function print_deliveries() } if ($email == 1) { - $rep->End($email, $doc_Delivery_no . " " . $myrow['reference'], $myrow, ST_CUSTDELIVERY); + $rep->End($email, '', $myrow, ST_CUSTDELIVERY); } } if ($email == 0) diff --git a/reporting/rep111.php b/reporting/rep111.php index c70ac618..d11e487a 100644 --- a/reporting/rep111.php +++ b/reporting/rep111.php @@ -130,20 +130,18 @@ function print_sales_quotations() $DisplayFreight = number_format2($myrow["freight_cost"],$dec); $rep->row = $rep->bottomMargin + (15 * $rep->lineHeight); - $linetype = true; $doctype = ST_SALESQUOTE; - include($path_to_root . "/reporting/includes/doctext.inc"); - $rep->TextCol(3, 6, $doc_Sub_total, -2); + $rep->TextCol(3, 6, _("Sub-total"), -2); $rep->TextCol(6, 7, $DisplaySubTot, -2); $rep->NewLine(); - $rep->TextCol(3, 6, $doc_Shipping, -2); + $rep->TextCol(3, 6, _("Shipping"), -2); $rep->TextCol(6, 7, $DisplayFreight, -2); $rep->NewLine(); $DisplayTotal = number_format2($myrow["freight_cost"] + $SubTotal, $dec); if ($myrow['tax_included'] == 0) { - $rep->TextCol(3, 6, $doc_TOTAL_ORDER, - 2); + $rep->TextCol(3, 6, _("TOTAL ORDER EX VAT"), - 2); $rep->TextCol(6, 7, $DisplayTotal, -2); $rep->NewLine(); } @@ -174,7 +172,7 @@ function print_sales_quotations() $first = false; } else - $rep->TextCol(3, 7, $doc_Included . " " . $tax_type_name . " " . $doc_Amount . ": " . $DisplayTax, -2); + $rep->TextCol(3, 7, _("Included") . " " . $tax_type_name . " " . _("Amount") . ": " . $DisplayTax, -2); } else { @@ -189,7 +187,7 @@ function print_sales_quotations() $DisplayTotal = number_format2($myrow["freight_cost"] + $SubTotal, $dec); $rep->Font('bold'); - $rep->TextCol(3, 6, $doc_TOTAL_ORDER2, - 2); + $rep->TextCol(3, 6, _("TOTAL ORDER VAT INCL."), - 2); $rep->TextCol(6, 7, $DisplayTotal, -2); $words = price_in_words($myrow["freight_cost"] + $SubTotal, ST_SALESQUOTE); if ($words != "") @@ -202,7 +200,7 @@ function print_sales_quotations() { if ($print_invoice_no == 1) $myrow['reference'] = $i; - $rep->End($email, $doc_Invoice_no . " " . $myrow['reference'], $myrow); + $rep->End($email, '', $myrow); } } if ($email == 0) diff --git a/reporting/rep112.php b/reporting/rep112.php index a2f1b358..d2e06c09 100644 --- a/reporting/rep112.php +++ b/reporting/rep112.php @@ -115,12 +115,10 @@ function print_receipts() $rep->NewPage(); $result = get_allocations_for_receipt($myrow['debtor_no'], $myrow['type'], $myrow['trans_no']); - $linetype = true; $doctype = ST_CUSTPAYMENT; - include($path_to_root . "/reporting/includes/doctext.inc"); $total_allocated = 0; - $rep->TextCol(0, 4, $doc_Towards, -2); + $rep->TextCol(0, 4, _("As advance / full / part / payment towards:"), -2); $rep->NewLine(2); while ($myrow2=db_fetch($result)) @@ -141,14 +139,14 @@ function print_receipts() $rep->row = $rep->bottomMargin + (15 * $rep->lineHeight); - $rep->TextCol(3, 6, $doc_Total_Allocated, -2); + $rep->TextCol(3, 6, _("Total Allocated"), -2); $rep->AmountCol(6, 7, $total_allocated, $dec, -2); $rep->NewLine(); - $rep->TextCol(3, 6, $doc_Left_To_Allocate, -2); + $rep->TextCol(3, 6, _("Left to Allocate"), -2); $rep->AmountCol(6, 7, $myrow['Total'] - $total_allocated, $dec, -2); $rep->NewLine(); $rep->Font('bold'); - $rep->TextCol(3, 6, $doc_Total_Payment, - 2); + $rep->TextCol(3, 6, _("TOTAL RECEIPT"), - 2); $rep->AmountCol(6, 7, $myrow['Total'], $dec, -2); $words = price_in_words($myrow['Total'], ST_CUSTPAYMENT); if ($words != "") @@ -158,16 +156,16 @@ function print_receipts() } $rep->Font(); $rep->NewLine(); - $rep->TextCol(6, 7, $doc_Received, - 2); + $rep->TextCol(6, 7, _("Received / Sign"), - 2); $rep->NewLine(); - $rep->TextCol(0, 2, $doc_by_Cheque, - 2); + $rep->TextCol(0, 2, _("By Cash / Cheque* / Draft No."), - 2); $rep->TextCol(2, 4, "______________________________", - 2); - $rep->TextCol(4, 5, $doc_Dated, - 2); + $rep->TextCol(4, 5, _("Dated"), - 2); $rep->TextCol(5, 6, "__________________", - 2); $rep->NewLine(1); - $rep->TextCol(0, 2, $doc_Drawn, - 2); + $rep->TextCol(0, 2, _("Drawn on Bank"), - 2); $rep->TextCol(2, 4, "______________________________", - 2); - $rep->TextCol(4, 5, $doc_Drawn_Branch, - 2); + $rep->TextCol(4, 5, _("Branch"), - 2); $rep->TextCol(5, 6, "__________________", - 2); $rep->TextCol(6, 7, "__________________"); } diff --git a/reporting/rep113.php b/reporting/rep113.php index 8e36f554..4a110745 100644 --- a/reporting/rep113.php +++ b/reporting/rep113.php @@ -143,14 +143,12 @@ function print_credits() $DisplayFreight = number_format2($sign*$myrow["ov_freight"],$dec); $rep->row = $rep->bottomMargin + (15 * $rep->lineHeight); - $linetype = true; $doctype = ST_CUSTCREDIT; - include($path_to_root . "/reporting/includes/doctext.inc"); - $rep->TextCol(3, 6, $doc_Sub_total, -2); + $rep->TextCol(3, 6, _("Sub-total"), -2); $rep->TextCol(6, 7, $DisplaySubTot, -2); $rep->NewLine(); - $rep->TextCol(3, 6, $doc_Shipping, -2); + $rep->TextCol(3, 6, _("Shipping"), -2); $rep->TextCol(6, 7, $DisplayFreight, -2); $rep->NewLine(); $tax_items = get_trans_tax_details(ST_CUSTCREDIT, $i); @@ -181,7 +179,7 @@ function print_credits() $first = false; } else - $rep->TextCol(3, 7, $doc_Included . " " . $tax_type_name . $doc_Amount . ": " . $DisplayTax, -2); + $rep->TextCol(3, 7, _("Included") . " " . $tax_type_name . _("Amount") . ": " . $DisplayTax, -2); } else { @@ -194,7 +192,7 @@ function print_credits() $DisplayTotal = number_format2($sign*($myrow["ov_freight"] + $myrow["ov_gst"] + $myrow["ov_amount"]+$myrow["ov_freight_tax"]),$dec); $rep->Font('bold'); - $rep->TextCol(3, 6, $doc_TOTAL_INVOICE, - 2); + $rep->TextCol(3, 6, _("TOTAL CREDIT"), - 2); $rep->TextCol(6, 7, $DisplayTotal, -2); $words = price_in_words($myrow['Total'], ST_CUSTCREDIT); if ($words != "") @@ -206,7 +204,7 @@ function print_credits() if ($email == 1) { $myrow['dimension_id'] = $paylink; // helper for pmt link - $rep->End($email, $doc_Invoice_no . " " . $myrow['reference'], $myrow, ST_CUSTCREDIT); + $rep->End($email, '', $myrow, ST_CUSTCREDIT); } } if ($email == 0) diff --git a/reporting/rep209.php b/reporting/rep209.php index a4e200ca..24639927 100644 --- a/reporting/rep209.php +++ b/reporting/rep209.php @@ -162,11 +162,9 @@ function print_po() $DisplaySubTot = number_format2($SubTotal,$dec); $rep->row = $rep->bottomMargin + (15 * $rep->lineHeight); - $linetype = true; $doctype = ST_PURCHORDER; - include($path_to_root . "/reporting/includes/doctext.inc"); - $rep->TextCol(3, 6, $doc_Sub_total, -2); + $rep->TextCol(3, 6, _("Sub-total"), -2); $rep->TextCol(6, 7, $DisplaySubTot, -2); $rep->NewLine(); @@ -196,7 +194,7 @@ function print_po() $first = false; } else - $rep->TextCol(3, 7, $doc_Included . " " . $tax_type_name . $doc_Amount . ": " . $DisplayTax, -2); + $rep->TextCol(3, 7, _("Included") . " " . $tax_type_name . _("Amount") . ": " . $DisplayTax, -2); } else { @@ -210,7 +208,7 @@ function print_po() $rep->NewLine(); $DisplayTotal = number_format2($SubTotal, $dec); $rep->Font('bold'); - $rep->TextCol(3, 6, $doc_TOTAL_PO, - 2); + $rep->TextCol(3, 6, _("TOTAL PO"), - 2); $rep->TextCol(6, 7, $DisplayTotal, -2); $words = price_in_words($SubTotal, ST_PURCHORDER); if ($words != "") @@ -225,7 +223,7 @@ function print_po() if ($myrow['reference'] == "") $myrow['reference'] = $myrow['order_no']; - $rep->End($email, $doc_Order_no . " " . $myrow['reference'], $myrow); + $rep->End($email, '', $myrow); } } if ($email == 0) diff --git a/reporting/rep210.php b/reporting/rep210.php index 7f6b53b6..2c94b3d3 100644 --- a/reporting/rep210.php +++ b/reporting/rep210.php @@ -129,12 +129,10 @@ function print_remittances() $rep->NewPage(); $result = get_allocations_for_remittance($myrow['supplier_id'], $myrow['type'], $myrow['trans_no']); - $linetype = true; $doctype = ST_SUPPAYMENT; - include($path_to_root . "/reporting/includes/doctext.inc"); $total_allocated = 0; - $rep->TextCol(0, 4, $doc_Towards, -2); + $rep->TextCol(0, 4, _("As advance / full / part / payment towards:"), -2); $rep->NewLine(2); while ($myrow2=db_fetch($result)) @@ -155,15 +153,15 @@ function print_remittances() $rep->row = $rep->bottomMargin + (15 * $rep->lineHeight); - $rep->TextCol(3, 6, $doc_Total_Allocated, -2); + $rep->TextCol(3, 6, _("Total Allocated"), -2); $rep->AmountCol(6, 7, $total_allocated, $dec, -2); $rep->NewLine(); - $rep->TextCol(3, 6, $doc_Left_To_Allocate, -2); + $rep->TextCol(3, 6, _("Left to Allocate"), -2); $myrow['Total'] *= -1; $rep->AmountCol(6, 7, $myrow['Total'] - $total_allocated, $dec, -2); $rep->NewLine(); $rep->Font('bold'); - $rep->TextCol(3, 6, $doc_Total_Payment, - 2); + $rep->TextCol(3, 6, _("TOTAL REMITTANCE"), - 2); $rep->AmountCol(6, 7, $myrow['Total'], $dec, -2); $words = price_in_words($myrow['Total'], ST_SUPPAYMENT); if ($words != "") @@ -175,7 +173,7 @@ function print_remittances() if ($email == 1) { $myrow['DebtorName'] = $myrow['supp_name']; - $rep->End($email, $doc_Order_no . " " . $myrow['reference'], $myrow); + $rep->End($email, '', $myrow); } } } -- 2.30.2