Some smaller fixes (see CHANGELOG)
[fa-stable.git] / reporting / rep302.php
index ba7703cc6c16c1109f068099a6a9b3c07ac51948..47bf8448c8c2212dd4cb1d255ed30cb14fef7539 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");
@@ -142,8 +142,6 @@ function print_inventory_planning()
     $location = $_POST['PARAM_1'];
     $comments = $_POST['PARAM_2'];
 
-    $dec = user_qty_dec();
-
        if ($category == reserved_words::get_all_numeric())
                $category = 0;
        if ($category == 0)
@@ -160,11 +158,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'));
@@ -204,6 +202,7 @@ function print_inventory_planning()
                $suppqty = getSuppQty($trans['stock_id'], $trans['loc_code']);
                $period = getPeriods($trans['stock_id'], $trans['loc_code']);
                $rep->NewLine();
+               $dec = get_qty_dec($trans['stock_id']);
                $rep->TextCol(0, 1, $trans['stock_id']);
                $rep->TextCol(1, 2, $trans['description']);
                $rep->TextCol(2, 3, number_format2($period['prd0'], $dec));