Rerun of sales_order_entry.php.
[fa-stable.git] / reporting / rep205.php
index 25393a39cf5c25e486a049d118f63a0baf14c7c8..4b27c182c697804ba060d71be0d8473f254d3c5c 100644 (file)
@@ -30,18 +30,11 @@ print_supplier_details_listing();
 
 function get_supplier_details_for_report()
 {
-       $sql = "SELECT ".TB_PREF."suppliers.supplier_id,
-                       ".TB_PREF."suppliers.supp_name,
-                       ".TB_PREF."suppliers.address,
-                       ".TB_PREF."suppliers.supp_address,
-                       ".TB_PREF."suppliers.supp_ref,
-                       ".TB_PREF."suppliers.contact,
-                       ".TB_PREF."suppliers.curr_code,
-                       ".TB_PREF."suppliers.dimension_id,
-                       ".TB_PREF."suppliers.dimension2_id,
-                       ".TB_PREF."suppliers.gst_no
-               FROM ".TB_PREF."suppliers
-               ORDER BY supp_name";
+       $sql = "SELECT supplier_id,     supp_name, address, supp_address, supp_ref,
+                               contact, curr_code,     dimension_id, dimension2_id, notes, gst_no
+                       FROM ".TB_PREF."suppliers
+                       WHERE inactive = 0
+                       ORDER BY supp_name";
 
     return db_query($sql,"No transactions were returned");
 }
@@ -129,8 +122,9 @@ function print_supplier_details_listing()
                }
                if ($printsupplier)
                {
+                       $newrow = 0;
                        $rep->NewLine();
-                       // Here starts the new report lines 2013-01-28 Joe Hunt
+                       // Here starts the new report lines
                        $contacts = get_supplier_contacts($myrow['supplier_id']);
                        $rep->TextCol(0, 1,     $myrow['supp_name']);
                        $rep->TextCol(1, 2,     _('Tax_Id') . ": " . $myrow['gst_no']);
@@ -141,6 +135,7 @@ function print_supplier_details_listing()
                        $count1 = count($adr);
                        $count2 = count($adr2);
                        $count1 = max($count1, $count2);
+                       $count1 = max($count1, 4); 
                        if (isset($adr[0]))
                                $rep->TextCol(0, 1, $adr[0]);
                        $rep->TextCol(1, 2,     _('Currency') . ": " . $myrow['curr_code']);
@@ -167,6 +162,14 @@ function print_supplier_details_listing()
                        {
                                $dim = get_dimension($myrow['dimension2_id']);
                                $rep->TextCol(1, 2,     _('Dimension') . " 2: " . $dim['name']);
+                       }
+                       if ($myrow['notes'] != '')
+                       {
+                               $oldrow = $rep->row;
+                               $rep->NewLine();
+                               $rep->TextColLines(1, 2, _("General Notes:")." ".$myrow['notes'], -2);
+                               $newrow = $rep->row;
+                               $rep->row = $oldrow;
                        }       
                        if (isset($contacts[0]))
                                $rep->TextCol(2, 3, _('Fax') . ": " . $contacts[0]['fax']);
@@ -179,14 +182,13 @@ function print_supplier_details_listing()
                                $rep->NewLine();
                                if (isset($adr[$i]))
                                        $rep->TextCol(0, 1, $adr[$i]);
+                               if ($i == 3 && isset($contacts[0]) && isset($contacts[0]['email']))     
+                                       $rep->TextCol(2, 3, _('Email') . ": " . $contacts[0]['email']);
                                if (isset($adr2[$i]))
-                                       $rep->TextCol(0, 1, $adr2[$i]);
+                                       $rep->TextCol(3, 4, $adr2[$i]);
                        }       
-                       if (isset($contacts[0]) && isset($contacts[0]['email']))
-                       {
-                               $rep->NewLine();
-                               $rep->TextCol(2, 4, _('Email') . ": " . $contacts[0]['email']);
-                       }               
+                       if ($newrow != 0 && $newrow < $rep->row)
+                               $rep->row = $newrow;
                        $rep->NewLine();
                        $rep->Line($rep->row + 8);
                        $rep->NewLine(0, 3);
@@ -195,4 +197,3 @@ function print_supplier_details_listing()
     $rep->End();
 }
 
-?>
\ No newline at end of file