From 8d83034325c15a6304b37998c855d71d7ee4859c Mon Sep 17 00:00:00 2001 From: Joe Hunt Date: Sat, 24 Jul 2010 15:32:58 +0000 Subject: [PATCH] Fixed Customer Details Report and Pricelist (UOM) and Supp.aged Report --- CHANGELOG.txt | 3 +++ reporting/rep103.php | 54 +++++++++++++++++++++++--------------------- reporting/rep104.php | 27 +++++++++++----------- reporting/rep202.php | 12 +++------- 4 files changed, 48 insertions(+), 48 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 663a6021..cde8bb1c 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -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 diff --git a/reporting/rep103.php b/reporting/rep103.php index db9b8815..5ad7f265 100644 --- a/reporting/rep103.php +++ b/reporting/rep103.php @@ -1,12 +1,12 @@ . ***********************************************************************/ $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); } diff --git a/reporting/rep104.php b/reporting/rep104.php index eabb5956..a9bec54b 100644 --- a/reporting/rep104.php +++ b/reporting/rep104.php @@ -1,12 +1,12 @@ . ***********************************************************************/ $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); diff --git a/reporting/rep202.php b/reporting/rep202.php index 57ef0e8b..f921d308 100644 --- a/reporting/rep202.php +++ b/reporting/rep202.php @@ -1,12 +1,12 @@ . ***********************************************************************/ $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; -- 2.30.2