Fixed bug in 2 files regarding stock movements. Moved from Invoice to Delivery.
authorJoe Hunt <joe.hunt.consulting@gmail.com>
Fri, 30 May 2008 16:26:55 +0000 (16:26 +0000)
committerJoe Hunt <joe.hunt.consulting@gmail.com>
Fri, 30 May 2008 16:26:55 +0000 (16:26 +0000)
CHANGELOG.txt
inventory/inquiry/stock_movements.php
reporting/rep302.php

index 03fc9b2e16eafc2f3650e6d26042068969cba839..6be84cd0800b735e682c5586aac375c7955c4859 100644 (file)
@@ -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
index 942a1a8e68b5c4a9e33b50052398e9b067b72257..35e0f20575c0782d76dcd5685586da62fc970e2e 100644 (file)
@@ -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("<b>"._("Quantity on hand after") . " " . $_POST['BeforeDate']."</b>", "align=center colspan=7");
index ba7703cc6c16c1109f068099a6a9b3c07ac51948..2a91d0373f6cb190afb59e41cc644959a2092d68 100644 (file)
@@ -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'));