extending the delivery period to avoid early invoice
authorJoe Hunt <joe.hunt.consulting@gmail.com>
Fri, 28 Nov 2008 22:49:44 +0000 (22:49 +0000)
committerJoe Hunt <joe.hunt.consulting@gmail.com>
Fri, 28 Nov 2008 22:49:44 +0000 (22:49 +0000)
purchasing/includes/db/invoice_db.inc

index 2e35c96ee2982d2d14d2161143425abc8f132280..ae19c7e31b7dd3343e0c6647dc5455929fc1cd53 100644 (file)
@@ -217,7 +217,7 @@ function add_supp_invoice($supp_trans) // do not receive as ref because we chang
                        // always return due to change in currency.
                        $mat_cost = update_average_material_cost(null, $entered_grn->item_code,
                                $diff, $entered_grn->this_quantity_inv, $old_date, true);
-                       $deliveries = get_deliveries_between($entered_grn->item_code, $old_date, $date_);
+                       $deliveries = get_deliveries_between($entered_grn->item_code, $old_date, Today()); // extend the period, if invoice is before any deliveries.
                        if ($deliveries[0] != 0) // have deliveries been done during the period?
                        {
                                $deliveries[1] /= $deliveries[0];