Fixed Customer Details Report and Pricelist (UOM) and Supp.aged Report
authorJoe Hunt <joe.hunt.consulting@gmail.com>
Sat, 24 Jul 2010 15:32:58 +0000 (15:32 +0000)
committerJoe Hunt <joe.hunt.consulting@gmail.com>
Sat, 24 Jul 2010 15:32:58 +0000 (15:32 +0000)
CHANGELOG.txt
reporting/rep103.php
reporting/rep104.php
reporting/rep202.php

index 663a6021a9075dfa64d50ed6ee2c204d9c589c09..cde8bb1cd15aac8654c89942f1cbc5b6f2be2990 100644 (file)
@@ -23,6 +23,9 @@ $ -> Affected files
 ! Changed so Purchase Order also print taxes.
 $ /reporting/rep209.php
   /reporting/doctype.inc
+# Fixed Customer Details Report and Pricelist (UOM)
+$ /reporting/rep103.php
+  /reporting/rep104.php
   
 23-Jul-2010 Janusz Dobrowolski
 + Added tax information display
index db9b8815d60310dfa753ce5e2884cf7048344710..5ad7f26526375555e90d5ca2faa6442b8eab2974 100644 (file)
@@ -1,12 +1,12 @@
 <?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 
+       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.  
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
 ***********************************************************************/
 $page_security = 'SA_CUSTBULKREP';
@@ -27,7 +27,7 @@ include_once($path_to_root . "/gl/includes/gl_db.inc");
 
 print_customer_details_listing();
 
-function get_customer_details_for_report($area=0, $salesid=0) 
+function get_customer_details_for_report($area=0, $salesid=0)
 {
        $sql = "SELECT ".TB_PREF."debtors_master.debtor_no,
                        ".TB_PREF."debtors_master.name,
@@ -37,14 +37,11 @@ function get_customer_details_for_report($area=0, $salesid=0)
                        ".TB_PREF."cust_branch.br_name,
                        ".TB_PREF."cust_branch.br_address,
                        ".TB_PREF."cust_branch.contact_name,
-                       ".TB_PREF."cust_branch.phone,
-                       ".TB_PREF."cust_branch.fax,
-                       ".TB_PREF."cust_branch.email,
                        ".TB_PREF."cust_branch.area,
                        ".TB_PREF."cust_branch.salesman,
                        ".TB_PREF."areas.description,
                        ".TB_PREF."salesman.salesman_name
-               FROM ".TB_PREF."debtors_master 
+               FROM ".TB_PREF."debtors_master
                INNER JOIN ".TB_PREF."cust_branch
                        ON ".TB_PREF."debtors_master.debtor_no=".TB_PREF."cust_branch.debtor_no
                INNER JOIN ".TB_PREF."sales_types
@@ -56,9 +53,9 @@ function get_customer_details_for_report($area=0, $salesid=0)
        if ($area != 0)
        {
                if ($salesid != 0)
-                       $sql .= " WHERE ".TB_PREF."salesman.salesman_code=".db_escape($salesid)." 
+                       $sql .= " WHERE ".TB_PREF."salesman.salesman_code=".db_escape($salesid)."
                                AND ".TB_PREF."areas.area_code=".db_escape($area);
-               else            
+               else
                        $sql .= " WHERE ".TB_PREF."areas.area_code=".db_escape($area);
        }
        elseif ($salesid != 0)
@@ -71,7 +68,7 @@ function get_customer_details_for_report($area=0, $salesid=0)
     return db_query($sql,"No transactions were returned");
 }
 
-                                       
+
 function getTransactions($debtorno, $branchcode, $date)
 {
        $date = date2sql($date);
@@ -106,7 +103,7 @@ function print_customer_details_listing()
                include_once($path_to_root . "/reporting/includes/excel_report.inc");
        else
                include_once($path_to_root . "/reporting/includes/pdf_report.inc");
-    
+
     $dec = 0;
 
        if ($area == ALL_NUMERIC)
@@ -130,8 +127,8 @@ function print_customer_details_listing()
                $lessstr = _('Less than ') . number_format2($less, $dec);
        else
                $lessstr = '';
-       
-       $more = (double)$more;  
+
+       $more = (double)$more;
        $less = (double)$less;
 
        $cols = array(0, 150, 300, 400, 550);
@@ -154,10 +151,10 @@ function print_customer_details_listing()
     $rep->NewPage();
 
        $result = get_customer_details_for_report($area, $folk);
-       
+
        $carea = '';
        $sman = '';
-       while ($myrow=db_fetch($result)) 
+       while ($myrow=db_fetch($result))
        {
                $printcustomer = true;
                if ($more != '' || $less != '')
@@ -167,25 +164,25 @@ function print_customer_details_listing()
                                $printcustomer = false;
                        if ($less != 0.0 && $turnover >= (double)$less)
                                $printcustomer = false;
-               }       
+               }
                if ($printcustomer)
                {
                        if ($carea != $myrow['description'])
                        {
                                $rep->fontSize += 2;
                                $rep->NewLine(2, 7);
-                               $rep->Font('bold');     
+                               $rep->Font('bold');
                                $rep->TextCol(0, 3,     _('Customers in') . " " . $myrow['description']);
                                $carea = $myrow['description'];
                                $rep->fontSize -= 2;
                                $rep->Font();
                                $rep->NewLine();
-                       }       
+                       }
                        if ($sman != $myrow['salesman_name'])
                        {
                                $rep->fontSize += 2;
                                $rep->NewLine(1, 7);
-                               $rep->Font('bold');     
+                               $rep->Font('bold');
                                $rep->TextCol(0, 3,     $myrow['salesman_name']);
                                $sman = $myrow['salesman_name'];
                                $rep->fontSize -= 2;
@@ -198,23 +195,28 @@ function print_customer_details_listing()
                        $count1 = count($adr);
                        for ($i = 0; $i < $count1; $i++)
                                $rep->TextCol(0, 1, $adr[$i], 0, ($i + 1) * $rep->lineHeight);
-                       $count1++;              
+                       $count1++;
                        $rep->TextCol(1, 2,     _('Price List') . ": " . $myrow['sales_type']);
                        if ($more != 0.0 || $less != 0.0)
                                $rep->TextCol(1, 2,     _('Turnover') . ": " . number_format2($turnover, $dec), 0, $rep->lineHeight);
                        $rep->TextCol(2, 3,     $myrow['br_name']);
-                       $rep->TextCol(2, 3, $myrow['contact_name'], 0, $rep->lineHeight);
-                       $rep->TextCol(2, 3, _('Ph') . ": " . $myrow['phone'], 0, 2 * $rep->lineHeight);
-                       $rep->TextCol(2, 3, _('Fax') . ": " . $myrow['fax'], 0, 3 * $rep->lineHeight);
+
+                       $contacts = get_branch_contacts($myrow['branch_code']);
+                       if (isset($contacts[0]))
+                       {
+                               $rep->TextCol(2, 3, $contacts[0]['name'], 0, $rep->lineHeight);
+                               $rep->TextCol(2, 3, _('Ph') . ": " . $contacts[0]['phone'], 0, 2 * $rep->lineHeight);
+                               $rep->TextCol(2, 3, _('Fax') . ": " . $contacts[0]['fax'], 0, 3 * $rep->lineHeight);
+                       }
                        $adr = Explode("\n", $myrow['br_address']);
                        $count2 = count($adr);
                        for ($i = 0; $i < $count2; $i++)
                                $rep->TextCol(3, 4, $adr[$i], 0, ($i + 1) * $rep->lineHeight);
-                       $rep->TextCol(3, 4, $myrow['email'], 0, ($count2 + 1) * $rep->lineHeight);
+                       //$rep->TextCol(3, 4, $myrow['email'], 0, ($count2 + 1) * $rep->lineHeight);
                        $count2++;
                        $count1 = Max($count1, $count2);
                        $count1 = Max($count1, 4);
-                       $rep->NewLine($count1); 
+                       $rep->NewLine($count1);
                        $rep->Line($rep->row + 8);
                        $rep->NewLine(0, 3);
                }
index eabb5956881d0af33c9eba004ef1af0f3d1bb4b2..a9bec54ba2115c1e61c30dc8908d324f9216f868 100644 (file)
@@ -1,12 +1,12 @@
 <?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 
+       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.  
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
 ***********************************************************************/
 $page_security = 'SA_PRICEREP';
@@ -34,7 +34,7 @@ function fetch_items($category=0)
 {
                $sql = "SELECT ".TB_PREF."stock_master.stock_id, ".TB_PREF."stock_master.description AS name,
                                ".TB_PREF."stock_master.material_cost+".TB_PREF."stock_master.labour_cost+".TB_PREF."stock_master.overhead_cost AS Standardcost,
-                               ".TB_PREF."stock_master.category_id,
+                               ".TB_PREF."stock_master.category_id,".TB_PREF."stock_master.units,
                                ".TB_PREF."stock_category.description
                        FROM ".TB_PREF."stock_master,
                                ".TB_PREF."stock_category
@@ -104,11 +104,11 @@ function print_price_listing()
        else
                $GP = _('Yes');
 
-       $cols = array(0, 100, 385, 450, 515);
+       $cols = array(0, 100, 360, 385, 450, 515);
 
-       $headers = array(_('Category/Items'), _('Description'), _('Price'),     _('GP %'));
+       $headers = array(_('Category/Items'), _('Description'), _('UOM'), _('Price'),   _('GP %'));
 
-       $aligns = array('left', 'left', 'right', 'right');
+       $aligns = array('left', 'left', 'left', 'right', 'right');
 
     $params =   array(         0 => $comments,
                                    1 => array('text' => _('Currency'), 'from' => $curr_sel, 'to' => ''),
@@ -146,8 +146,9 @@ function print_price_listing()
                $rep->NewLine();
                $rep->TextCol(0, 1,     $myrow['stock_id']);
                $rep->TextCol(1, 2, $myrow['name']);
+               $rep->TextCol(2, 3, $myrow['units']);
                $price = get_price($myrow['stock_id'], $currency, $salestype);
-               $rep->AmountCol(2, 3, $price, $dec);
+               $rep->AmountCol(3, 4, $price, $dec);
                if ($showGP)
                {
                        $price2 = get_price($myrow['stock_id'], $home_curr, $salestype);
@@ -155,11 +156,11 @@ function print_price_listing()
                                $disp = ($price2 - $myrow['Standardcost']) * 100 / $price2;
                        else
                                $disp = 0.0;
-                       $rep->TextCol(3, 4,     number_format2($disp, user_percent_dec()) . " %");
+                       $rep->TextCol(4, 5,     number_format2($disp, user_percent_dec()) . " %");
                }
                if ($pictures)
                {
-                       $image = company_path(). "/images/" 
+                       $image = company_path(). "/images/"
                                . item_img_name($myrow['stock_id']) . ".jpg";
                        if (file_exists($image))
                        {
@@ -189,7 +190,7 @@ function print_price_listing()
                                $rep->fontSize += 2;
                                $rep->TextCol(0, 3, _("Sales Kits"));
                                $rep->fontSize -= 2;
-                       }       
+                       }
                        $rep->Line($rep->row  - $rep->lineHeight);
                        $rep->NewLine(2);
                        $rep->fontSize += 2;
@@ -200,9 +201,9 @@ function print_price_listing()
                }
                $rep->NewLine();
                $rep->TextCol(0, 1,     $myrow['kit_code']);
-               $rep->TextCol(1, 2, $myrow['kit_name']);
+               $rep->TextCol(1, 3, $myrow['kit_name']);
                $price = get_kit_price($myrow['kit_code'], $currency, $salestype);
-               $rep->AmountCol(2, 3, $price, $dec);
+               $rep->AmountCol(3, 4, $price, $dec);
                $rep->NewLine(0, 1);
        }
        $rep->Line($rep->row  - 4);
index 57ef0e8baaa4cd1d9620479150b0a01381d664f3..f921d308ff0292f82a1374249ef0ad8e799f1a5a 100644 (file)
@@ -1,12 +1,12 @@
 <?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 
+       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.  
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
 ***********************************************************************/
 $page_security = 'SA_SUPPLIERANALYTIC';
@@ -131,15 +131,9 @@ function print_aged_supplier_analysis()
                $headers[2] = _('currency');
        $rep = new FrontReport(_('Aged Supplier Analysis'), "AgedSupplierAnalysis", user_pagesize());
 
-<<<<<<< rep202.php
     $rep->Font();
     $rep->Info($params, $cols, $headers, $aligns);
     $rep->NewPage();
-=======
-       $rep->Font();
-       $rep->Info($params, $cols, $headers, $aligns);
-       $rep->Header();
->>>>>>> 1.7
 
        $total = array();
        $total[0] = $total[1] = $total[2] = $total[3] = $total[4] = 0.0;