Merged changes form stabel branch up to the current state (2.3.22+).
[fa-stable.git] / purchasing / supplier_credit.php
index a89acc7f8f33feff48720b5155aedbab09cb090b..0d1e6c9fd75455983b2a322037187d08a3cfdc12 100644 (file)
@@ -220,8 +220,7 @@ function check_data()
                foreach ($_SESSION['supp_trans']->grn_items as $n => $item) {
                        if (is_inventory_item($item->item_code))
                        {
-                               $qoh = get_qoh_on_date($item->item_code, null, $_SESSION['supp_trans']->tran_date);
-                               if ($item->this_quantity_inv > $qoh)
+                               if (check_negative_stock($item->item_code, -$item->this_quantity_inv, null, $_SESSION['supp_trans']->tran_date))
                                {
                                        $stock = get_item($item->item_code);
                                        display_error(_("The return cannot be processed because there is an insufficient quantity for item:") .