Delivery against sales order fixed (merge bug).
authorJanusz Dobrowolski <janusz@frontaccounting.eu>
Sat, 3 Jan 2015 15:53:24 +0000 (16:53 +0100)
committerJanusz Dobrowolski <janusz@frontaccounting.eu>
Sat, 3 Jan 2015 15:53:24 +0000 (16:53 +0100)
sales/customer_delivery.php

index f54bbd1cc9c19db1cd49931139ec0e5b85fd3612..fb7efe0a0394ab124b1c10d1c9f9314ecfc8bca0 100644 (file)
@@ -274,47 +274,12 @@ function check_quantities()
                        }
                }
        }
-// ...
-//     else
-//       $_SESSION['Items']->freight_cost = input_num('ChargeFreightCost');
        return $ok;
 }
-//------------------------------------------------------------------------------
-
-if (isset($_POST['process_delivery']) && check_data())
-{
-    global $SysPrefs;
-    $dn = &$_SESSION['Items'];
-    $newdelivery = ($dn->trans_no==0);
-    if (!$SysPrefs->allow_negative_stock()) {
-        foreach ($_SESSION['Items']->line_items as $itm) {
-
-            if ($itm->qty_dispatched && has_stock_holding($itm->mb_flag)) {
-                $qoh_by_date = get_qoh_on_date($itm->stock_id, $_POST['Location'], $_POST['DispatchDate']);
-                $qoh_abs = get_qoh_on_date($itm->stock_id, $_POST['Location'], null);
-                //If editing current delivery delivered qty should be added 
-                if (!$newdelivery)
-                {
-                    $delivered = get_already_delivered($itm->stock_id, $_POST['Location'], key($dn->trans_no));
-
-                    $qoh_abs = $qoh_abs - $delivered;
-                    $qoh_by_date = $qoh_by_date - $delivered;
-                }
-                $qoh = ($qoh_by_date < $qoh_abs ? $qoh_by_date : $qoh_abs); 
-                if ($itm->qty_dispatched > $qoh) {
-                    display_error(_("The delivery cannot be processed because there is an insufficient quantity for item:") .
-                        " " . $itm->stock_id . " - " . $itm->item_description);
-                    return false;
-                }
-            }
-        }
-    }
-    return true;
-}
 
 //------------------------------------------------------------------------------
 
-if (isset($_POST['process_delivery']) && check_data() && check_qoh()) {
+if (isset($_POST['process_delivery']) && check_data()) {
        $dn = &$_SESSION['Items'];
 
        if ($_POST['bo_policy']) {