Changed to let the $doctypes in documents follow the types in types.inc
authorJoe Hunt <joe.hunt.consulting@gmail.com>
Thu, 7 Jan 2010 14:24:55 +0000 (14:24 +0000)
committerJoe Hunt <joe.hunt.consulting@gmail.com>
Thu, 7 Jan 2010 14:24:55 +0000 (14:24 +0000)
New document, Remittance, to print payment allocations to suppliers
Also print/email links from Supplier Payment and Supplier Inquiry.

16 files changed:
CHANGELOG.txt
purchasing/inquiry/supplier_inquiry.php
purchasing/supplier_payment.php
reporting/includes/doctext.inc
reporting/includes/doctext2.inc
reporting/includes/header2.inc
reporting/includes/pdf_report.inc
reporting/includes/reporting.inc
reporting/includes/reports_classes.inc
reporting/rep108.php
reporting/rep109.php
reporting/rep110.php
reporting/rep111.php
reporting/rep209.php
reporting/rep210.php [new file with mode: 0644]
reporting/reports_main.php

index de25f853df21967e6fdcfebfca1f40c7c9c6195a..5461f6d9cf03341197378d7b9b5e97830d4aa8d9 100644 (file)
@@ -19,6 +19,26 @@ Legend:
 ! -> Note
 $ -> Affected files
 
+07-Jan-2010 Joe Hunt
+! Changed to let the $doctypes in documents follow the types in types.inc
++ New document, Remittance, to print payment allocations to suppliers
+  Also print/email links from Supplier Payment and Supplier Inquiry.
+$ /purchasing/supplier_payment.php
+  /purchasing/inquiry/supplier_inquiry.php
+  /reporting/rep108.php
+  /reporting/rep109.php
+  /reporting/rep110.php
+  /reporting/rep111.php
+  /reporting/rep209.php
+  /reporting/rep210.php (New file)
+  /reporting/reports_main.php
+  /reporting/includes/doctext.inc
+  /reporting/includes/doctext2.inc
+  /reporting/includes/header2.inc
+  /reporting/includes/pdf_report.inc
+  /reporting/includes/reporting.inc
+  /reporting/includes/reports_classes.inc
+  
 06-Jan-2010 Janusz Dobrowolski
 # Check on existence of locale.inc added to avoid blank pages when the file is broken.
 $ /includes/session.inc
index 264b551819974f904f8934ef6ffbe1ed4e41687b..0b23bd6d4e3d8242bba209646495395426a79266 100644 (file)
@@ -15,6 +15,7 @@ include($path_to_root . "/includes/db_pager.inc");
 include($path_to_root . "/includes/session.inc");
 
 include($path_to_root . "/purchasing/includes/purchasing_ui.inc");
+include($path_to_root . "/reporting/includes/reporting.inc");
 
 $js = "";
 if ($use_popup_windows)
@@ -146,7 +147,8 @@ function fmt_credit($row)
 
 function prt_link($row)
 {
-               return print_document_link($row['trans_no'], _("Print"), true, $row['type']);
+       if ($row['type'] == ST_SUPPAYMENT || $row['type'] == ST_BANKPAYMENT) 
+               return print_document_link($row['trans_no'], _("Print Remittance"), true, $row['type'], ICON_PRINT);
 }
 
 function check_overdue($row)
@@ -217,7 +219,8 @@ $cols = array(
                        _("Debit") => array('align'=>'right', 'fun'=>'fmt_debit'), 
                        _("Credit") => array('align'=>'right', 'insert'=>true,'fun'=>'fmt_credit'), 
                        array('insert'=>true, 'fun'=>'gl_view'),
-                       array('insert'=>true, 'fun'=>'credit_link')
+                       array('insert'=>true, 'fun'=>'credit_link'),
+                       array('insert'=>true, 'fun'=>'prt_link')
                        );
 
 if ($_POST['supplier_id'] != ALL_TEXT)
index 68ed1c8f61b8762878d9c9528c21ebc1bc93d2c4..cb94548e42a5b12820410e1caee27b811d610389 100644 (file)
@@ -19,6 +19,7 @@ include_once($path_to_root . "/includes/banking.inc");
 include_once($path_to_root . "/includes/data_checks.inc");
 //include_once($path_to_root . "/purchasing/includes/ui/supp_alloc_ui.inc");
 include_once($path_to_root . "/purchasing/includes/purchasing_db.inc");
+include_once($path_to_root . "/reporting/includes/reporting.inc");
 
 $js = "";
 if ($use_popup_windows)
@@ -69,6 +70,9 @@ if (isset($_GET['AddedID']))
 
        display_notification_centered( _("Payment has been sucessfully entered"));
 
+       submenu_print(_("&Print This Remittance"), ST_SUPPAYMENT, $payment_id, 'prtopt');
+       submenu_print(_("&Email This Remittance"), ST_SUPPAYMENT, $payment_id, null, 1);
+
     display_note(get_gl_view_str(22, $payment_id, _("View the GL &Journal Entries for this Payment")));
 
 //    hyperlink_params($path_to_root . "/purchasing/allocations/supplier_allocate.php", _("&Allocate this Payment"), "trans_no=$payment_id&trans_type=22");
index 79812ecead1e63500e18832032831717ac8d7791..b2bcea21d97c89fed03467d49e0e7c095efa1977 100644 (file)
@@ -13,7 +13,7 @@ if (isset($header2type))
 {
        $doc_Cust_no = _("Cust no");
        $doc_Date = _("Date");
-       if ($doctype == 8) // Purchase Order
+       if ($doctype == ST_PURCHORDER || $doctype == ST_SUPPAYMENT) // Purchase Order
        {
                $doc_Charge_To = _("Order To");
                $doc_Delivered_To = _("Charge To");
@@ -24,14 +24,14 @@ if (isset($header2type))
                $doc_Delivered_To = _("Delivered To");
        }       
        $doc_Shipping_Company = _("Shipping Company");
-       if ($doctype == 7)
+       if ($doctype == ST_SALESQUOTE)
                $doc_Due_Date = _("Valid until");
-       elseif ($doctype == 9)
+       elseif ($doctype == ST_SALESORDER)
                $doc_Due_Date = _("Delivery Date");
        else
                $doc_Due_Date = _("Due Date");
        $doc_Your_Ref = _("Your Ref");
-       if ($doctype == 26)
+       if ($doctype == ST_WORKORDER)
        {
                $doc_Our_Ref = _("Type");
                $doc_Your_VAT_no = _("Manufactured Item");
@@ -42,7 +42,10 @@ if (isset($header2type))
        }       
        else
        {
-               $doc_Our_Ref = _("Sales Person");
+               if ($doctype == ST_SUPPAYMENT)
+                       $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");
@@ -50,47 +53,52 @@ if (isset($header2type))
        }
        $doc_Our_VAT_no = _("Our VAT No.");
        $doc_Domicile = _("Domicile");
-       if($doctype == 13 || $doctype == 7 || $doctype == 8 || $doctype == 9) {
+       if($doctype == ST_CUSTDELIVERY || $doctype == ST_SALESQUOTE || $doctype == ST_PURCHORDER || $doctype == ST_SALESORDER ||
+               $doctype == ST_SUPPAYMENT) {
         $doc_Bank_Account = '';
         $doc_Please_Quote = _("All amounts stated in");
   } else {
         $doc_Bank_Account = _("Bank Account");
-        $doc_Please_Quote = $doctype==10 ? 
+        $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_Bank_Account = _("Bank Account");
        $doc_Payment_Link = _("You can pay through");
-       if ($doctype == 7 || $doctype == 8 || $doctype == 9 || $doctype == 10 || $doctype == 11 || $doctype == 13 || $doctype == 26)
+       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)
        {
-               if ($doctype == 7)
+               if ($doctype == ST_SALESQUOTE)
                        $this->title = _("SALES QUOTATION");
-               elseif ($doctype == 8)
+               elseif ($doctype == ST_PURCHORDER)
                        $this->title = _("PURCHASE ORDER");
-               elseif ($doctype == 13)
+               elseif ($doctype == ST_CUSTDELIVERY)
                        $this->title = ($packing_slip==1 ? _("PACKING SLIP") : _("DELIVERY NOTE"));
-               elseif ($doctype == 9)
+               elseif ($doctype == ST_SALESORDER)
                        $this->title = ($print_as_quote==1 ? _("QUOTE") : _("SALES ORDER"));
-               elseif ($doctype == 10)
+               elseif ($doctype == ST_SALESINVOICE)
                        $this->title = _("INVOICE");
-               elseif ($doctype == 26)
+               elseif ($doctype == ST_WORKORDER)
                        $this->title = _("WORK ORDER");
+               elseif ($doctype == ST_SUPPAYMENT)
+                       $this->title = _("REMITTANCE");
                else
                        $this->title = _("CREDIT NOTE");
-               if ($doctype == 8)
+               if ($doctype == ST_PURCHORDER)
                        $this->headers = array(_("Item Code"), _("Item Description"),
                                _("Delivery Date"), _("Quantity"),      _("Unit"), _("Price"), _("Total"));
-               elseif ($doctype == 26)
+               elseif ($doctype == ST_WORKORDER)
                        $this->headers = array(_("Item Code"), _("Item Description"),
                                _("From Location"), _("Work Centre"),   _("Unit Quantity"), _("Total Quantity"), _("Units Issued"));
+               elseif ($doctype == ST_SUPPAYMENT)
+                       $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 == 12)
+       else if ($doctype == ST_CUSTPAYMENT)
        {
                $this->title = _("STATEMENT");
                $this->headers = array(_("Trans Type"), _("#"), _("Date"), _("DueDate"), _("Charges"),
@@ -106,26 +114,35 @@ if (isset($emailtype))
 }
 if (isset($header2type) || isset($linetype))
 {
-       $doc_Invoice_no = ($doctype==13 ? _("Delivery Note No.") : (($doctype==7 || $doctype==8 || $doctype==9) ? _("Order no.") : 
-               ($doctype==10 ? _("Invoice No.") : ($doctype==26 ? _("Word Order No") : _("Credit No.")))));
+       $doc_Invoice_no = ($doctype==ST_CUSTDELIVERY ? _("Delivery Note No.") : 
+               ($doctype == ST_SUPPAYMENT ? _("Payment No.") :
+               (($doctype==ST_SALESQUOTE || $doctype==ST_PURCHORDER || $doctype==ST_SALESORDER) ? _("Order no.") : 
+               ($doctype==ST_SALESINVOICE ? _("Invoice No.") : ($doctype==ST_WORKORDER ? _("Word Order No") : _("Credit No."))))));
        $doc_Delivery_no = _("Delivery Note No.");
        $doc_Order_no = _("Order no.");
 }
 if (isset($linetype))
 {
-       if ($doctype == 7 || $doctype == 8 || $doctype == 9 || $doctype == 10 || $doctype == 11 || $doctype == 13)
+       if ($doctype == ST_SALESQUOTE || $doctype == ST_PURCHORDER || $doctype == ST_SALESORDER || 
+               $doctype == ST_SALESINVOICE || $doctype == ST_CUSTCREDIT || $doctype == ST_CUSTDELIVERY)
        {
                $doc_Sub_total = _("Sub-total");
                $doc_Shipping = _("Shipping");
                $doc_Included = _("Included");
                $doc_Amount = _("Amount");
-               $doc_TOTAL_INVOICE = $doctype ==10 ? _("TOTAL INVOICE") : _("TOTAL CREDIT");
+               $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 EX VAT");
                $doc_TOTAL_DELIVERY = _("TOTAL DELIVERY INCL. VAT");
        }
-       else if ($doctype == 12)
+       elseif ($doctype == ST_SUPPAYMENT)
+       {
+               $doc_Total_Allocated = _("Total Allocated");
+               $doc_Left_To_Allocate = _("Left to Allocate");
+               $doc_Total_Payment = _("TOTAL PAYMENT");
+       }
+       elseif ($doctype == ST_CUSTPAYMENT)
        {
                $doc_Outstanding = _("Outstanding Transactions");
                $doc_Current = _("Current");
index f1e3e0ee9abfe65cfcbb637baf83d318bd197da9..0f53367f2a002229479a3fa3bde0f9c965f80d0c 100644 (file)
@@ -13,7 +13,7 @@ if (isset($header2type))
 {
        $doc_Cust_no = "Cust no";
        $doc_Date = "Date";
-       if ($doctype == 8) // Purchase Order
+       if ($doctype == ST_PURCHORDER || $doctype == ST_SUPPAYMENT) // Purchase Order
        {
                $doc_Charge_To = "Order To";
                $doc_Delivered_To = "Charge To";
@@ -24,14 +24,14 @@ if (isset($header2type))
                $doc_Delivered_To = "Delivered To";
        }       
        $doc_Shipping_Company = "Shipping Company";
-       if ($doctype == 7)
+       if ($doctype == ST_SALESQUOTE)
                $doc_Due_Date = "Valid until";
-       if ($doctype == 9)
+       elseif ($doctype == ST_SALESORDER)
                $doc_Due_Date = "Delivery Date";
        else
                $doc_Due_Date = "Due Date";
        $doc_Your_Ref = "Your Ref";
-       if ($doctype == 26)
+       if ($doctype == ST_WORKORDER)
        {
                $doc_Our_Ref = "Type";
                $doc_Your_VAT_no = "Manufactured Item";
@@ -42,7 +42,10 @@ if (isset($header2type))
        }       
        else
        {
-               $doc_Our_Ref = "Sales Person";
+               if ($doctype == ST_SUPPAYMENT)
+                       $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";
@@ -50,46 +53,51 @@ if (isset($header2type))
        }
        $doc_Our_VAT_no = "Our VAT No.";
        $doc_Domicile = "Domicile";
-       if($doctype == 13 || $doctype == 7 || $doctype == 8 || $doctype == 9) {
+       if($doctype == ST_CUSTDELIVERY || $doctype == ST_SALESQUOTE || $doctype == ST_PURCHORDER || $doctype == ST_SALESORDER ||
+               $doctype == ST_SUPPAYMENT) {
         $doc_Bank_Account = '';
         $doc_Please_Quote = "All amounts stated in";
   } else {
-        $doc_Please_Quote = "Please quote ".($doctype==10 ? "Invoice" : "Credit")
+        $doc_Please_Quote = "Please quote ".($doctype==ST_SALESINVOICE ? "Invoice" : "Credit")
                ." no. when paying. All amounts stated in";
         $doc_Bank_Account = "Bank Account";
        }
        $doc_Address = "Address";
        $doc_Phone_Fax_Email = "Phone/Fax/Email";
        $doc_Bank = "Bank";
-       $doc_Bank_Account = "Bank Account";
        $doc_Payment_Link = "You can pay through";
-       if ($doctype == 7 || $doctype == 8 || $doctype == 9 || $doctype == 10 || $doctype == 11 || $doctype == 13 || $doctype == 26)
+       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)
        {
-               if ($doctype == 7)
+               if ($doctype == ST_SALESQUOTE)
                        $this->title = "SALES QUOTATION";
-               elseif ($doctype == 8)
+               elseif ($doctype == ST_PURCHORDER)
                        $this->title = "PURCHASE ORDER";
-               elseif ($doctype == 9)
+               elseif ($doctype == ST_SALESORDER)
                        $this->title = ($print_as_quote==1 ? "QUOTE" : "SALES ORDER");
-               elseif ($doctype == 10)
+               elseif ($doctype == ST_SALESINVOICE)
                        $this->title = "INVOICE";
-               elseif ($doctype == 13)
+               elseif ($doctype == ST_CUSTDELIVERY)
                        $this->title = ($packing_slip==1 ? "PACKING SLIP" : "DELIVERY NOTE");
-               elseif ($doctype == 26)
+               elseif ($doctype == ST_WORKORDER)
                        $this->title = "WORK ORDER";
+               elseif ($doctype == ST_SUPPAYMENT)
+                       $this->title = "REMITTANCE";
                else
                        $this->title = "CREDIT NOTE";
-               if ($doctype == 8)
+               if ($doctype == ST_PURCHORDER)
                        $this->headers = array('Item Code', 'Item Description', 'Delivery Date',
                                'Quantity', 'Unit',     'Price', 'Total');
-               elseif ($doctype == 26)
+               elseif ($doctype == ST_WORKORDER)
                        $this->headers = array("Item Code", "Item Description",
                                "From Location", "Work Centre",         "Unit Quantity", "Total Quantity", "Units Issued");
+               elseif ($doctype == ST_SUPPAYMENT)
+                       $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 == 12)
+       elseif ($doctype == ST_CUSTPAYMENT)
        {
                $this->title = "STATEMENT";
                $this->headers = array('Trans Type', '#', 'Date', 'Due Date', 'Charges',
@@ -105,26 +113,35 @@ if (isset($emailtype))
 }
 if (isset($header2type) || isset($linetype))
 {
-       $doc_Invoice_no = ($doctype==13 ? "Delivery Note No." : (($doctype == 7 || $doctype==8 || $doctype==9) ? "Order no." : 
-       ($doctype==10 ? "Invoice No." : ($doctype == 26 ? "Work Order No" : "Credit No."))));
+       $doc_Invoice_no = ($doctype==ST_CUSTDELIVERY ? "Delivery Note No." :
+               ($doctype == ST_SUPPAYMENT ? "Payment No." :
+               (($doctype == ST_SALESQUOTE || $doctype==ST_PURCHORDER || $doctype==ST_SALESORDER) ? "Order 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 == 7 || $doctype == 8 || $doctype == 9 || $doctype == 10 || $doctype == 11 || $doctype == 13)
+       if ($doctype == ST_SALESQUOTE || $doctype == ST_PURCHORDER || $doctype == ST_SALESORDER || $doctype == ST_SALESINVOICE || 
+               $doctype == ST_CUSTCREDIT || $doctype == ST_CUSTDELIVERY)
        {
                $doc_Sub_total = "Sub-total";
                $doc_Shipping = "Shipping";
                $doc_Included = "Included";
                $doc_Amount = "amount";
-               $doc_TOTAL_INVOICE = $doctype==10 ? "TOTAL INVOICE" : "TOTAL CREDIT";
+               $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 EX VAT";
                $doc_TOTAL_DELIVERY = "TOTAL DELIVERY INCL. VAT";
        }
-       else if ($doctype == 12)
+       elseif ($doctype == ST_SUPPAYMENT)
+       {
+               $doc_Total_Allocated = "Total Allocated";
+               $doc_Left_To_Allocate = "Left to Allocate";
+               $doc_Total_Payment = "TOTAL PAYMENT";
+       }
+       elseif ($doctype == ST_CUSTPAYMENT)
        {
                $doc_Outstanding = "Outstanding Transactions";
                $doc_Current = "Current";
index da51522863ada247a47af88398718ff25b19ef47..2da3c7c0a3c6a66431a3b6bf20baf4b384535f67 100644 (file)
@@ -11,7 +11,7 @@
 ***********************************************************************/
                // New version (without vertical lines)
 
-       global $wo_types_array;
+       global $wo_types_array, $systypes_array;
        
                $this->row = $this->pageHeight - $this->topMargin;
 
                        $this->Text($c2col, $this->company['gst_no'], $mcol);
                        $this->NewLine();
                }
-               if (($doctype == 10 || $doctype == 12) && $this->company['domicile'] != "")
+               if (($doctype == ST_SALESINVOICE || $doctype == ST_CUSTPAYMENT) && $this->company['domicile'] != "")
                {
                        $this->Text($ccol, $doc_Domicile, $c2col);
                        $this->Text($c2col, $this->company['domicile'], $mcol);
                $this->row = $adrline;
                $this->NewLine(3);
                $this->Text($mcol + 100, $doc_Date);
-               if ($doctype == 7 || $doctype == 8 || $doctype == 9)
+               if ($doctype == ST_SALESQUOTE || $doctype == ST_PURCHORDER || $doctype == ST_SALESORDER)
                        $this->Text($mcol + 180, sql2date($myrow['ord_date']));
-               elseif ($doctype == 26) 
+               elseif ($doctype == ST_WORKORDER)       
                        $this->Text($mcol + 180, sql2date($myrow['date_']));
                else
                        $this->Text($mcol + 180, sql2date($myrow['tran_date']));
                $this->NewLine();
                $this->Text($mcol + 100, $doc_Invoice_no);
-               if ($doctype == 7 || $doctype == 8 || $doctype == 9) // QUOTE, PO or SO
+               if ($doctype == ST_SALESQUOTE || $doctype == ST_PURCHORDER || $doctype == ST_SALESORDER) // QUOTE, PO or SO
                {
                        if ($print_invoice_no == 1)
                                $this->Text($mcol + 180, $myrow['order_no']);
                        else    
                                $this->Text($mcol + 180, $myrow['reference']);
                }               
-               elseif ($doctype == 26) 
+               elseif ($doctype == ST_WORKORDER)       
                        $this->Text($mcol + 180, $myrow['id']);
                else if (isset($myrow['trans_no']) && isset($myrow['reference'])) // INV/CRE/STA
                {
                $this->row = $this->row - $this->lineHeight - 5;
 
                $temp = $this->row;
-               if ($doctype == 7 || $doctype == 9)
+               if ($doctype == ST_SALESQUOTE || $doctype == ST_SALESORDER)
                {
                        $this->Text($ccol, $myrow['name'], $icol);
                }
-               elseif ($doctype == 26)
+               elseif ($doctype == ST_WORKORDER)
                {
                        $this->Text($ccol, $myrow['location_name'], $icol);
                        $this->NewLine();
                }
                else
                {
-                       if ($doctype == 8) {
+                       if ($doctype == ST_PURCHORDER || $doctype == ST_SUPPAYMENT) {
                                $name = $myrow['supp_name'];
                                $addr = $myrow['address'];
                        } else {
                if ($sales_order != NULL)
                {
                        $this->row = $temp;
-                       if ($doctype == 8)
+                       if ($doctype == ST_PURCHORDER)
                                $this->Text($mcol, $this->company['coy_name']);
-                       else
+                       elseif ($doctype != ST_SUPPAYMENT)
                                $this->Text($mcol, $sales_order['deliver_to']);
                        $this->NewLine();
-                       $this->TextWrapLines($mcol, $this->rightMargin - $mcol, $sales_order['delivery_address']);
+                       if ($doctype != ST_SUPPAYMENT)
+                               $this->TextWrapLines($mcol, $this->rightMargin - $mcol, $sales_order['delivery_address']);
                }
                $this->row = $iline2 - $this->lineHeight - 1;
                $col = $this->leftMargin;
                $col += $width;
                $this->TextWrap($col, $this->row, $width, $doc_Your_VAT_no, 'C');
                $col += $width;
-               if ($doctype == 10)
+               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');
                $this->TextWrap($col, $this->row, $width, $doc_Due_Date, 'C');
                $this->row = $iline3 - $this->lineHeight - 1;
                $col = $this->leftMargin;
-               if ($doctype == 8)
+               if ($doctype == ST_PURCHORDER || $doctype == ST_SUPPAYMENT)
                        $this->TextWrap($col, $this->row, $width, $myrow['supp_account_no'], 'C');
-               elseif ($doctype == 26)
+               elseif ($doctype == ST_WORKORDER)
                        $this->TextWrap($col, $this->row, $width, $myrow['wo_ref'], 'C');
                elseif (isset($sales_order["customer_ref"]))
                        $this->TextWrap($col, $this->row, $width, $sales_order["customer_ref"], 'C');
                        $row = db_fetch($result);
                        $this->TextWrap($col, $this->row, $width, $row['salesman_name'], 'C');
                }               
-               elseif ($doctype == 26)
+               elseif ($doctype == ST_SUPPAYMENT)
+                       $this->TextWrap($col, $this->row, $width, $systypes_array[$myrow["type"]], 'C');
+               elseif ($doctype == ST_WORKORDER)
                        $this->TextWrap($col, $this->row, $width, $wo_types_array[$myrow["type"]], 'C');
                $col += $width; 
-               if ($doctype == 26)
+               if ($doctype == ST_WORKORDER)
                        $this->TextWrap($col, $this->row, $width, $myrow["StockItemName"], 'C');
-               elseif ($doctype != 8 && isset($myrow['tax_id']))
+               elseif ($doctype != ST_PURCHORDER && isset($myrow['tax_id']))
                        $this->TextWrap($col, $this->row, $width, $myrow['tax_id'], 'C');
                $col += $width; 
-               if ($doctype == 10)
+               if ($doctype == ST_SALESINVOICE)
                {
                        $deliveries = get_parent_trans(ST_SALESINVOICE, $myrow['trans_no']);
                        $line = "";
                        }               
                        $this->TextWrap($col, $this->row, $width, $line, 'C');
                }
-               elseif ($doctype == 13)
+               elseif ($doctype == ST_CUSTDELIVERY)
                {
                        $ref = $myrow['order_'];
                        if ($print_invoice_no == 0)
                        }               
                        $this->TextWrap($col, $this->row, $width, $ref, 'C');
                }
-               elseif ($doctype == 26)
+               elseif ($doctype == ST_WORKORDER)
                        $this->TextWrap($col, $this->row, $width, $myrow["location_name"], 'C');
                elseif (isset($myrow['order_']))
                        $this->TextWrap($col, $this->row, $width, $myrow['order_'], 'C');
                $col += $width; 
-               if ($doctype == 9 || $doctype == 7)
+               if ($doctype == ST_SALESORDER || $doctype == ST_SALESQUOTE)
                        $this->TextWrap($col, $this->row, $width, sql2date($myrow['delivery_date']), 'C');
-               elseif ($doctype == 26) 
+               elseif ($doctype == ST_WORKORDER)       
                        $this->TextWrap($col, $this->row, $width, $myrow["units_issued"], 'C');
-               elseif ($doctype != 8 && $doctype != 11 && isset($myrow['due_date']))
+               elseif ($doctype != ST_PURCHORDER && $doctype != ST_CUSTCREDIT && isset($myrow['due_date']))
                        $this->TextWrap($col, $this->row, $width, sql2date($myrow['due_date']), 'C');
                if (!isset($packing_slip) || $packing_slip == 0)
                {
                        $this->row -= (2 * $this->lineHeight);
-                       if ($doctype == 26)
+                       if ($doctype == ST_WORKORDER)
                                $str = sql2date($myrow["required_by"]);
                        else
                        {
                $this->Font();
                $this->Font('italic');
                $this->row = $iline7 - $this->lineHeight - 6;
-               if ($doctype != 26)
+               if ($doctype != ST_WORKORDER)
                        $this->TextWrap($ccol, $this->row, $right - $ccol, $doc_Please_Quote . " - " . $myrow['curr_code'], 'C');
                $this->row -= $this->lineHeight;
 
                        $this->TextWrap($ccol, $this->row, $right - $ccol, $txt, 'C');
                        $this->row -= $this->lineHeight;
                }       
-               if ($doctype == 10 && $branch['disable_branch'] > 0) // payment links
+               if ($doctype == ST_SALESINVOICE && $branch['disable_branch'] > 0) // payment links
                {
                        if ($branch['disable_branch'] == 1)
                        {
                        $this->TextWrap($ccol, $this->row, $right - $ccol, $this->params['comments'], 'C');
                        $this->row -= $this->lineHeight;
                }
-               if (($doctype == 10 || $doctype == 12) && $this->company['legal_text'] != "") 
+               if (($doctype == ST_SALESINVOICE || $doctype == ST_CUSTPAYMENT) && $this->company['legal_text'] != "") 
                {
                        $this->TextWrapLines($ccol, $right - $ccol, $this->company['legal_text'], 'C');
                }
index bb70cbe4ef3656b06e29426bd80f3fe43c9ed408..627031f587f550923034774d4bb72b339bef9499 100644 (file)
@@ -929,7 +929,7 @@ class FrontReport extends Cpdf
                        $to = $myrow['DebtorName'] . " <" . $myrow['email'] . ">";
                        $msg = $doc_Dear_Sirs . " " . $myrow['DebtorName'] . ",\n\n" . $doc_AttachedFile . " " . $subject .
                                "\n\n";
-                               if (isset($myrow['dimension_id']) && $myrow['dimension_id'] > 0 && $doctype == 10) // helper for payment links
+                               if (isset($myrow['dimension_id']) && $myrow['dimension_id'] > 0 && $doctype == ST_SALESINVOICE) // helper for payment links
                                {
                                        if ($myrow['dimension_id'] == 1)
                                        {
index 6a0712998267b8fd02ce64aec1dc785ebe14b1ec..0650c98e9afa0afd92ec567d5b116093db965195 100644 (file)
@@ -77,6 +77,17 @@ function print_document_link($doc_no, $link_text, $link=true, $type_no,
                                'PARAM_3' => $email, 
                                'PARAM_4' => '');
                        break;
+               case ST_SUPPAYMENT :
+               case ST_BANKPAYMENT :
+                       $rep = 210;
+                       // from, to, currency, bank acc, email, comments
+                       $ar = array(
+                               'PARAM_0' => $doc_no, 
+                               'PARAM_1' => $doc_no, 
+                               'PARAM_2' => '', 
+                               'PARAM_3' => $email, 
+                               'PARAM_4' => '');
+                       break;
 //             default: $ar = array();
        }
        
index e7df6a73c6b59d1443bf00a85ba539d0f18bc6e5..1aff54618f8c06a1087bd73099ca10da1c77ae52 100644 (file)
@@ -325,6 +325,15 @@ class BoxReports
                                                FROM ".TB_PREF."suppliers, ".TB_PREF."purch_orders WHERE ".TB_PREF."suppliers.supplier_id=".TB_PREF."purch_orders.supplier_id ORDER BY ".TB_PREF."purch_orders.order_no DESC";
                                        return combo_input($name, '', $sql, 'order_no', 'IName',array('order'=>false));
 
+                               case 'REMITTANCE':
+                                       $BP = _("BP");
+                                       $SP = _("SP");
+                                       $ref = ($print_invoice_no == 1 ? "trans_no" : "reference");
+                                       $sql = "SELECT concat(".TB_PREF."supp_trans.trans_no, '-',
+                                               ".TB_PREF."supp_trans.type) AS TNO, concat(".TB_PREF."supp_trans.$ref, if (type=".ST_BANKPAYMENT.", ' $BP ', ' $SP '), ".TB_PREF."suppliers.supp_name) as IName
+                                               FROM ".TB_PREF."suppliers, ".TB_PREF."supp_trans WHERE (type=".ST_BANKPAYMENT." OR type=".ST_SUPPAYMENT.") AND ".TB_PREF."suppliers.supplier_id=".TB_PREF."supp_trans.supplier_id ORDER BY ".TB_PREF."supp_trans.trans_no DESC";
+                                       return combo_input($name, '', $sql, 'TNO', 'IName',array('order'=>false));
+
                                case 'ITEMS':
                                        return stock_manufactured_items_list($name);
 
index a3519221d453818e5588b3f68b8385948bf280f4..d5b1c022b480f231ef86745fe2d90541630cb73b 100644 (file)
@@ -107,10 +107,10 @@ function print_statements()
                        $rep->filename = "Statement" . $myrow['debtor_no'] . ".pdf";
                        $rep->Info($params, $cols, null, $aligns);
                }
-               $rep->Header2($myrow, null, null, $baccount, 12);
+               $rep->Header2($myrow, null, null, $baccount, ST_CUSTPAYMENT);
                $rep->NewLine();
                $linetype = true;
-               $doctype = 12;
+               $doctype = ST_CUSTPAYMENT;
                if ($rep->currency != $myrow['curr_code'])
                {
                        include($path_to_root . "/reporting/includes/doctext2.inc");
@@ -142,7 +142,7 @@ function print_statements()
                        $rep->TextCol(7, 8,     $DisplayNet, -2);
                        $rep->NewLine();
                        if ($rep->row < $rep->bottomMargin + (10 * $rep->lineHeight))
-                               $rep->Header2($myrow, null, null, $baccount, 12);
+                               $rep->Header2($myrow, null, null, $baccount, ST_CUSTPAYMENT);
                }
                $nowdue = "1-" . $PastDueDays1 . " " . $doc_Days;
                $pastdue1 = $PastDueDays1 + 1 . "-" . $PastDueDays2 . " " . $doc_Days;
@@ -163,7 +163,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, 12);
+                       $rep->End($email, $doc_Statement . " " . $doc_as_of . " " . sql2date($date), $myrow, ST_CUSTPAYMENT);
 
        }
        if ($email == 0)
index 11349184d626e43203791e1eb8a2ca92d2269964..5b049c111ce799fd0a4be400fe0b6a03ab392320 100644 (file)
@@ -94,7 +94,7 @@ function print_sales_orders()
                }
                else
                        $rep->title = ($print_as_quote==1 ? _("QUOTE") : _("SALES ORDER"));
-               $rep->Header2($myrow, $branch, $myrow, $baccount, 9);
+               $rep->Header2($myrow, $branch, $myrow, $baccount, ST_SALESORDER);
 
                $result = get_sales_order_details($i, ST_SALESORDER);
                $SubTotal = 0;
@@ -123,7 +123,7 @@ function print_sales_orders()
                        $rep->row = $newrow;
                        //$rep->NewLine(1);
                        if ($rep->row < $rep->bottomMargin + (15 * $rep->lineHeight))
-                               $rep->Header2($myrow, $branch, $myrow, $baccount, 9);
+                               $rep->Header2($myrow, $branch, $myrow, $baccount, ST_SALESORDER);
                }
                if ($myrow['comments'] != "")
                {
@@ -135,7 +135,7 @@ function print_sales_orders()
 
                $rep->row = $rep->bottomMargin + (15 * $rep->lineHeight);
                $linetype = true;
-               $doctype = 9;
+               $doctype = ST_SALESORDER;
                if ($rep->currency != $myrow['curr_code'])
                {
                        include($path_to_root . "/reporting/includes/doctext2.inc");
index fc330428b7f6af2f030b9dd28198f467b8cf6489..a8fdbc4a6caae71abf175ab090c49b5b6d9d4ac8 100644 (file)
@@ -99,9 +99,9 @@ function print_deliveries()
                        }
                        else
                                $rep->title = _('DELIVERY NOTE');
-                       $rep->Header2($myrow, $branch, $sales_order, '', 13);
+                       $rep->Header2($myrow, $branch, $sales_order, '', ST_CUSTDELIVERY);
 
-                       $result = get_customer_trans_details(13, $i);
+                       $result = get_customer_trans_details(ST_CUSTDELIVERY, $i);
                        $SubTotal = 0;
                        while ($myrow2=db_fetch($result))
                        {
@@ -131,7 +131,7 @@ function print_deliveries()
                                $rep->row = $newrow;
                                //$rep->NewLine(1);
                                if ($rep->row < $rep->bottomMargin + (15 * $rep->lineHeight))
-                                       $rep->Header2($myrow, $branch, $sales_order,'',13);
+                                       $rep->Header2($myrow, $branch, $sales_order,'',ST_CUSTDELIVERY);
                        }
 
                        $comments = get_comments(ST_CUSTDELIVERY, $i);
@@ -147,7 +147,7 @@ function print_deliveries()
 
                $rep->row = $rep->bottomMargin + (15 * $rep->lineHeight);
                        $linetype = true;
-                       $doctype=13;
+                       $doctype=ST_CUSTDELIVERY;
                        if ($rep->currency != $myrow['curr_code'])
                        {
                                include($path_to_root . "/reporting/includes/doctext2.inc");
@@ -164,7 +164,7 @@ function print_deliveries()
                                $rep->TextCol(3, 6, $doc_Shipping, -2);
                                $rep->TextCol(6, 7,     $DisplayFreight, -2);
                                $rep->NewLine();
-                               $tax_items = get_trans_tax_details(13, $i);
+                               $tax_items = get_trans_tax_details(ST_CUSTDELIVERY, $i);
                        while ($tax_item = db_fetch($tax_items))
                        {
                                $DisplayTax = number_format2($tax_item['amount'], $dec);
@@ -196,7 +196,7 @@ function print_deliveries()
                                        $myrow['email'] = $branch['email'];
                                        $myrow['DebtorName'] = $branch['br_name'];
                                }
-                               $rep->End($email, $doc_Delivery_no . " " . $myrow['reference'], $myrow, 13);
+                               $rep->End($email, $doc_Delivery_no . " " . $myrow['reference'], $myrow, ST_CUSTDELIVERY);
                        }
        }
        if ($email == 0)
index 826089bca9f5577b56032b6e56e20d2cbfa717d5..0301ed616e2f8677c3765cb3f703702f0e16aca9 100644 (file)
@@ -78,7 +78,7 @@ function print_sales_quotations()
                        $rep->Info($params, $cols, null, $aligns);
                }
                $rep->title = _("SALES QUOTATION");
-               $rep->Header2($myrow, $branch, $myrow, $baccount, 7);
+               $rep->Header2($myrow, $branch, $myrow, $baccount, ST_SALESQUOTE);
 
                $result = get_sales_order_details($i, ST_SALESQUOTE);
                $SubTotal = 0;
@@ -107,7 +107,7 @@ function print_sales_quotations()
                        $rep->row = $newrow;
                        //$rep->NewLine(1);
                        if ($rep->row < $rep->bottomMargin + (15 * $rep->lineHeight))
-                               $rep->Header2($myrow, $branch, $myrow, $baccount, 9);
+                               $rep->Header2($myrow, $branch, $myrow, $baccount, ST_SALESQUOTE);
                }
                if ($myrow['comments'] != "")
                {
@@ -119,7 +119,7 @@ function print_sales_quotations()
 
                $rep->row = $rep->bottomMargin + (15 * $rep->lineHeight);
                $linetype = true;
-               $doctype = 9;
+               $doctype = ST_SALESQUOTE;
                if ($rep->currency != $myrow['curr_code'])
                {
                        include($path_to_root . "/reporting/includes/doctext2.inc");
index b6b88a4572ee85b310b3493d5109b019c5594441..e8278e60e13036c644e5742654c61c983c4b0a79 100644 (file)
@@ -105,7 +105,7 @@ function print_po()
                }
                else
                        $rep->title = _('PURCHASE ORDER');
-               $rep->Header2($myrow, null, $myrow, $baccount, 8);
+               $rep->Header2($myrow, null, $myrow, $baccount, ST_PURCHORDER);
 
                $result = get_po_details($i);
                $SubTotal = 0;
@@ -139,7 +139,7 @@ function print_po()
                        $rep->TextCol(6, 7,     $DisplayNet, -2);
                        $rep->NewLine(1);
                        if ($rep->row < $rep->bottomMargin + (15 * $rep->lineHeight))
-                               $rep->Header2($myrow, $branch, $myrow, $baccount, 8);
+                               $rep->Header2($myrow, $branch, $myrow, $baccount, ST_PURCHORDER);
                }
                if ($myrow['comments'] != "")
                {
@@ -150,7 +150,7 @@ function print_po()
 
                $rep->row = $rep->bottomMargin + (15 * $rep->lineHeight);
                $linetype = true;
-               $doctype = 8;
+               $doctype = ST_PURCHORDER;
                if ($rep->currency != $myrow['curr_code'])
                {
                        include($path_to_root . "/reporting/includes/doctext2.inc");
diff --git a/reporting/rep210.php b/reporting/rep210.php
new file mode 100644 (file)
index 0000000..1a99195
--- /dev/null
@@ -0,0 +1,176 @@
+<?php
+/**********************************************************************
+    Copyright (C) FrontAccounting, LLC.
+       Released under the terms of the GNU General Public License, GPL, 
+       as published by the Free Software Foundation, either version 3 
+       of the License, or (at your option) any later version.
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+    See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
+***********************************************************************/
+
+$page_security = $_POST['PARAM_0'] == $_POST['PARAM_1'] ?
+       'SA_SUPPTRANSVIEW' : 'SA_SUPPBULKREP';
+// ----------------------------------------------------------------
+// $ Revision: 2.0 $
+// Creator:    Joe Hunt
+// date_:      2005-05-19
+// Title:      Purchase Orders
+// ----------------------------------------------------------------
+$path_to_root="..";
+
+include_once($path_to_root . "/includes/session.inc");
+include_once($path_to_root . "/includes/date_functions.inc");
+include_once($path_to_root . "/includes/data_checks.inc");
+
+//----------------------------------------------------------------------------------------------------
+
+print_remittances();
+
+//----------------------------------------------------------------------------------------------------
+function get_remittance($type, $trans_no)
+{
+       $sql = "SELECT ".TB_PREF."supp_trans.*, 
+               (".TB_PREF."supp_trans.ov_amount+".TB_PREF."supp_trans.ov_gst+".TB_PREF."supp_trans.ov_discount) AS Total, 
+               ".TB_PREF."suppliers.supp_name,  ".TB_PREF."suppliers.supp_account_no,
+               ".TB_PREF."suppliers.curr_code, ".TB_PREF."suppliers.payment_terms, ".TB_PREF."suppliers.gst_no AS tax_id, 
+               ".TB_PREF."suppliers.email, ".TB_PREF."suppliers.address, ".TB_PREF."suppliers.contact
+               FROM ".TB_PREF."supp_trans, ".TB_PREF."suppliers
+               WHERE ".TB_PREF."supp_trans.supplier_id = ".TB_PREF."suppliers.supplier_id
+               AND ".TB_PREF."supp_trans.type = ".db_escape($type)."
+               AND ".TB_PREF."supp_trans.trans_no = ".db_escape($trans_no);
+       $result = db_query($sql, "The remittance cannot be retrieved");
+       if (db_num_rows($result) == 0)
+               return false;
+    return db_fetch($result);
+}
+
+function get_allocations_for_remittance($supplier_id, $type, $trans_no)
+{
+       $sql = get_alloc_supp_sql("amt, supp_reference, trans.alloc", "trans.trans_no = alloc.trans_no_to
+               AND trans.type = alloc.trans_type_to
+               AND alloc.trans_no_from=".db_escape($trans_no)."
+               AND alloc.trans_type_from=".db_escape($type)."
+               AND trans.supplier_id=".db_escape($supplier_id),
+               TB_PREF."supp_allocations as alloc");
+       $sql .= " ORDER BY trans_no";
+       return db_query($sql, "Cannot retreive alloc to transactions");
+}
+
+function print_remittances()
+{
+       global $path_to_root, $systypes_array;
+
+       include_once($path_to_root . "/reporting/includes/pdf_report.inc");
+
+       $from = $_POST['PARAM_0'];
+       $to = $_POST['PARAM_1'];
+       $currency = $_POST['PARAM_2'];
+       $email = $_POST['PARAM_3'];
+       $comments = $_POST['PARAM_4'];
+
+       if ($from == null)
+               $from = 0;
+       if ($to == null)
+               $to = 0;
+       $dec = user_price_dec();
+
+       $fno = explode("-", $from);
+       $tno = explode("-", $to);
+
+       $cols = array(4, 85, 150, 225, 275, 360, 450, 515);
+
+       // $headers in doctext.inc
+       $aligns = array('left', 'left', 'left', 'left', 'right', 'right', 'right');
+
+       $params = array('comments' => $comments);
+
+       $cur = get_company_Pref('curr_default');
+
+       if ($email == 0)
+       {
+               $rep = new FrontReport(_('PURCHASE ORDER'), "PurchaseOrderBulk", user_pagesize());
+               $rep->currency = $cur;
+               $rep->Font();
+               $rep->Info($params, $cols, null, $aligns);
+       }
+
+       for ($i = $fno[0]; $i <= $tno[0]; $i++)
+       {
+               for ($j = ST_BANKPAYMENT; $j <= ST_SUPPAYMENT; $j = ($j == ST_BANKPAYMENT ? ST_SUPPAYMENT : 999))
+               {
+                       $myrow = get_remittance($j, $i);
+                       if (!$myrow)
+                               continue;                       
+                       $baccount = get_default_bank_account($myrow['curr_code']);
+                       $params['bankaccount'] = $baccount['id'];
+
+                       if ($email == 1)
+                       {
+                               $rep = new FrontReport("", "", user_pagesize());
+                               $rep->currency = $cur;
+                               $rep->Font();
+                               $rep->title = _('REMITTANCE');
+                               $rep->filename = "Remittance" . $i . ".pdf";
+                               $rep->Info($params, $cols, null, $aligns);
+                       }
+                       else
+                               $rep->title = _('REMITTANCE');
+                       $rep->Header2($myrow, null, $myrow, $baccount, ST_SUPPAYMENT);
+                       $result = get_allocations_for_remittance($myrow['supplier_id'], $myrow['type'], $myrow['trans_no']);
+
+                       $total_allocated = 0;
+                       while ($myrow2=db_fetch($result))
+                       {
+                               $rep->TextCol(0, 1,     $systypes_array[$myrow2['type']], -2);
+                               $rep->TextCol(1, 2,     $myrow2['supp_reference'], -2);
+                               $rep->TextCol(2, 3,     sql2date($myrow2['tran_date']), -2);
+                               $rep->TextCol(3, 4,     sql2date($myrow2['due_date']), -2);
+                               $rep->AmountCol(4, 5, $myrow2['Total'], $dec, -2);
+                               $rep->AmountCol(5, 6, $myrow2['Total'] - $myrow2['alloc'], $dec, -2);
+                               $rep->AmountCol(6, 7, $myrow2['amt'], $dec, -2);
+
+                               $total_allocated += $myrow2['amt'];
+                               $rep->NewLine(1);
+                               if ($rep->row < $rep->bottomMargin + (15 * $rep->lineHeight))
+                                       $rep->Header2($myrow, null, $myrow, $baccount, ST_SUPPAYMENT);
+                       }
+
+                       $rep->row = $rep->bottomMargin + (15 * $rep->lineHeight);
+                       $linetype = true;
+                       $doctype = ST_SUPPAYMENT;
+                       if ($rep->currency != $myrow['curr_code'])
+                       {
+                               include($path_to_root . "/reporting/includes/doctext2.inc");
+                       }
+                       else
+                       {
+                               include($path_to_root . "/reporting/includes/doctext.inc");
+                       }
+
+                       $rep->TextCol(3, 6, $doc_Total_Allocated, -2);
+                       $rep->AmountCol(6, 7, $total_allocated, $dec, -2);
+                       $rep->NewLine();
+                       $rep->TextCol(3, 6, $doc_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->AmountCol(6, 7, $myrow['Total'], $dec, -2);
+                       $rep->Font();
+                       if ($email == 1)
+                       {
+                               $myrow['contact_email'] = $myrow['email'];
+                               $myrow['DebtorName'] = $myrow['supp_name'];
+                               if ($myrow['contact'] != '') $myrow['DebtorName'] = $myrow['contact'];
+                               $rep->End($email, $doc_Order_no . " " . $myrow['reference'], $myrow);
+                       }
+               }       
+       }
+       if ($email == 0)
+               $rep->End();
+}
+
+?>
\ No newline at end of file
index 650f0dba39e091ffee83b247ab1189e8da524da6..a36a043cd87826ed9429ff446005604e77310712 100644 (file)
@@ -136,6 +136,12 @@ $reports->addReport(_('Supplier'),209,_('Print Purchase &Orders'),
                        _('Currency Filter') => 'CURRENCY',
                        _('Email Customers') => 'YES_NO',
                        _('Comments') => 'TEXTBOX'));
+$reports->addReport(_('Supplier'),210,_('Print Remittances'),
+       array(  _('From') => 'REMITTANCE',
+                       _('To') => 'REMITTANCE',
+                       _('Currency Filter') => 'CURRENCY',
+                       _('Email Customers') => 'YES_NO',
+                       _('Comments') => 'TEXTBOX'));
 
 $reports->addReportClass(_('Inventory'));
 $reports->addReport(_('Inventory'),301,_('Inventory &Valuation Report'),