From 71ef60f5895e131182cdff8b092f6da905345dc5 Mon Sep 17 00:00:00 2001 From: Joe Hunt Date: Fri, 30 May 2008 16:26:55 +0000 Subject: [PATCH] Fixed bug in 2 files regarding stock movements. Moved from Invoice to Delivery. --- CHANGELOG.txt | 5 +++++ inventory/inquiry/stock_movements.php | 26 +++++++++++++------------- reporting/rep302.php | 12 ++++++------ 3 files changed, 24 insertions(+), 19 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 03fc9b2e..6be84cd0 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -19,6 +19,11 @@ Legend: ! -> Note $ -> Affected files +30-May-2008 Joe Hunt +# Fixed bug in 2 files regarding stock movements. Moved from Invoice to Delivery. +$ /inventory/inquiry/stock_movements.php + /reporting/rep302.php + 28-May-2008 Joe Hunt # More bugs related to debtor_trans changes (positive amounts) $ /gl/includes/db/gl_db_banking.inc diff --git a/inventory/inquiry/stock_movements.php b/inventory/inquiry/stock_movements.php index 942a1a8e..35e0f205 100644 --- a/inventory/inquiry/stock_movements.php +++ b/inventory/inquiry/stock_movements.php @@ -70,7 +70,7 @@ $before_qty = db_query($sql, "The starting quantity on hand could not be calcula $before_qty_row = db_fetch_row($before_qty); $after_qty = $before_qty = $before_qty_row[0]; -if (!isset($before_qty_row[0])) +if (!isset($before_qty_row[0])) { $after_qty = $before_qty = 0; } @@ -86,7 +86,7 @@ $k = 0; //row colour counter $total_in = 0; $total_out = 0; -while ($myrow = db_fetch($result)) +while ($myrow = db_fetch($result)) { alt_table_row_color($k); @@ -95,12 +95,12 @@ while ($myrow = db_fetch($result)) $type_name = systypes::name($myrow["type"]); - if ($myrow["qty"] > 0) + if ($myrow["qty"] > 0) { $quantity_formatted = number_format2($myrow["qty"],user_qty_dec()); $total_in += $myrow["qty"]; } - else + else { $quantity_formatted = number_format2(-$myrow["qty"],user_qty_dec()); $total_out += -$myrow["qty"]; @@ -118,15 +118,15 @@ while ($myrow = db_fetch($result)) $person = $myrow["person_id"]; $gl_posting = ""; - if (($myrow["type"] == 10) || ($myrow["type"] == 11)) + if (($myrow["type"] == 13) || ($myrow["type"] == 11)) { $cust_row = get_customer_details_from_trans($myrow["type"], $myrow["trans_no"]); if (strlen($cust_row['name']) > 0) $person = $cust_row['name'] . " (" . $cust_row['br_name'] . ")"; - } - elseif ($myrow["type"] == 25) + } + elseif ($myrow["type"] == 25) { // get the supplier name $sql = "SELECT supp_name FROM ".TB_PREF."suppliers WHERE supplier_id = '" . $myrow["person_id"] . "'"; @@ -136,15 +136,15 @@ while ($myrow = db_fetch($result)) if (strlen($supp_row['supp_name']) > 0) $person = $supp_row['supp_name']; - } - elseif ($myrow["type"] == systypes::location_transfer() || $myrow["type"] == systypes::inventory_adjustment()) + } + elseif ($myrow["type"] == systypes::location_transfer() || $myrow["type"] == systypes::inventory_adjustment()) { // get the adjustment type $movement_type = get_movement_type($myrow["person_id"]); $person = $movement_type["name"]; - } - elseif ($myrow["type"]==systypes::work_order() || $myrow["type"] == 28 || - $myrow["type"] == 29) + } + elseif ($myrow["type"]==systypes::work_order() || $myrow["type"] == 28 || + $myrow["type"] == 29) { $person = ""; } @@ -165,7 +165,7 @@ while ($myrow = db_fetch($result)) } //end of while loop -if ($total_in != 0 || $total_out != 0) +if ($total_in != 0 || $total_out != 0) { start_row("class='inquirybg'"); label_cell(""._("Quantity on hand after") . " " . $_POST['BeforeDate']."", "align=center colspan=7"); diff --git a/reporting/rep302.php b/reporting/rep302.php index ba7703cc..2a91d037 100644 --- a/reporting/rep302.php +++ b/reporting/rep302.php @@ -123,7 +123,7 @@ function getPeriods($stockid, $location) FROM ".TB_PREF."stock_moves WHERE stock_id='$stockid' AND loc_code ='$location' - AND (type=10 OR type=11) + AND (type=13 OR type=11) AND visible=1"; $TransResult = db_query($sql,"No transactions were returned"); @@ -160,11 +160,11 @@ function print_inventory_planning() $cols = array(0, 50, 150, 180, 210, 240, 270, 300, 330, 390, 435, 480, 525); - $per0 = strftime('%b',mktime(0,0,0,date('m'),date('d'),date('Y'))); - $per1 = strftime('%b',mktime(0,0,0,date('m')-1,date('d'),date('Y'))); - $per2 = strftime('%b',mktime(0,0,0,date('m')-2,date('d'),date('Y'))); - $per3 = strftime('%b',mktime(0,0,0,date('m')-3,date('d'),date('Y'))); - $per4 = strftime('%b',mktime(0,0,0,date('m')-4,date('d'),date('Y'))); + $per0 = strftime('%b',mktime(0,0,0,date('m'),1,date('Y'))); + $per1 = strftime('%b',mktime(0,0,0,date('m')-1,1,date('Y'))); + $per2 = strftime('%b',mktime(0,0,0,date('m')-2,1,date('Y'))); + $per3 = strftime('%b',mktime(0,0,0,date('m')-3,1,date('Y'))); + $per4 = strftime('%b',mktime(0,0,0,date('m')-4,1,date('Y'))); $headers = array(_('Category'), '', $per4, $per3, $per2, $per1, $per0, '3*M', _('QOH'), _('Cust Ord'), _('Supp Ord'), _('Sugg Ord')); -- 2.30.2