Final rewriting of sales module and some smaller changes.
[fa-stable.git] / reporting / rep209.php
index 947dd64d325cf762e8610ae5d8b50241e2445d90..32108d5ab4c3d550565dc0e28c5f4e75a882fad3 100644 (file)
@@ -5,7 +5,7 @@ $page_security = 2;
 // $ Revision: 2.0 $
 // Creator:    Joe Hunt
 // date_:      2005-05-19
-// Title:      Print Invoices
+// Title:      Purchase Orders
 // ----------------------------------------------------------------
 $path_to_root="../";
 
@@ -23,7 +23,8 @@ print_po();
 function get_po($order_no)
 {
        $sql = "SELECT ".TB_PREF."purch_orders.*, ".TB_PREF."suppliers.supp_name, 
-               ".TB_PREF."suppliers.curr_code, ".TB_PREF."suppliers.payment_terms, ".TB_PREF."locations.location_name 
+               ".TB_PREF."suppliers.curr_code, ".TB_PREF."suppliers.payment_terms, ".TB_PREF."locations.location_name,
+               ".TB_PREF."suppliers.email, ".TB_PREF."suppliers.address 
                FROM ".TB_PREF."purch_orders, ".TB_PREF."suppliers, ".TB_PREF."locations 
                WHERE ".TB_PREF."purch_orders.supplier_id = ".TB_PREF."suppliers.supplier_id
                AND ".TB_PREF."locations.loc_code = into_stock_location 
@@ -90,7 +91,7 @@ function print_po()
                        $rep = new FrontReport("", "", user_pagesize());
                        $rep->currency = $cur;
                        $rep->Font();
-                       $rep->title = _('PURCHASE_ORDER');
+                       $rep->title = _('PURCHASE ORDER');
                        $rep->filename = "PurchaseOrder" . $i . ".pdf";
                        $rep->Info($params, $cols, null, $aligns);
                }
@@ -147,12 +148,10 @@ function print_po()
                $rep->Font();   
                if ($email == 1)
                {
-                       if ($myrow['contact_email'] == '')
-                       {
-                               $myrow['contact_email'] = $branch['email'];
-                               $myrow['DebtorName'] = $branch['br_name'];
-                       }
-                       $rep->End($email, $doc_Invoice_no . " " . $myrow['reference'], $myrow);
+                       $myrow['contact_email'] = $myrow['email'];
+                       $myrow['DebtorName'] = $myrow['supp_name'];
+                       $myrow['reference'] = $myrow['order_no'];
+                       $rep->End($email, $doc_Order_no . " " . $myrow['reference'], $myrow);
                }       
        }
        if ($email == 0)