When buying a service item from a supplier, the delivery produced
authorJoe Hunt <joe.hunt.consulting@gmail.com>
Wed, 3 Feb 2010 10:30:23 +0000 (10:30 +0000)
committerJoe Hunt <joe.hunt.consulting@gmail.com>
Wed, 3 Feb 2010 10:30:23 +0000 (10:30 +0000)
wrong inventory GL transactions. No GL transactions should be here.
[0000200] stock_master material_cost incorrectly updated during GRN when
price format uses thousands seperator. A couple of minor errors too.

CHANGELOG.txt
purchasing/includes/db/grn_db.inc
purchasing/includes/db/invoice_db.inc
sales/includes/db/sales_delivery_db.inc

index ff39f740815c3e455a78846602ad81a126a49f46..3b5d0b8d595253c8a47bc20ec4e6eea634a51ba5 100644 (file)
@@ -19,6 +19,15 @@ Legend:
 ! -> Note
 $ -> Affected files
 
+03-Feb-2010 Joe Hunt
+# When buying a service item from a supplier, the delivery produced
+  wrong inventory GL transactions. No GL transactions should be here.
+$ /sales/includes/db/sales_delivery_db.inc
+# [0000200] stock_master material_cost incorrectly updated during GRN when 
+  price format uses thousands seperator. A couple of minor errors too. 
+$ /purchasing/includes/db/grn_db.inc
+  /purchasing/includes/db/invoices_db.inc
+
 03-Feb-2010 Chaitanya/Joe
 + Added a Profit and Loss Drilldown page and changed menu link
 $ /applications/generalledger.php
index b055c1f94eb8b14a955b9f8afa302d9eaf04303a..0a491a6f144588cafe5f23cb857bbe34d66be268 100644 (file)
@@ -18,10 +18,11 @@ function update_average_material_cost($supplier, $stock_id, $price, $qty, $date,
        else
                $currency = null;
        $dec = user_price_dec();
-       $price = price_decimal_format($price, $dec);
+       price_decimal_format($price, $dec);
+       $price = round2($price, $dec);
        if ($currency != null)
        {
-               $ex_rate = get_exchange_rate_to_home_currency($currency, $date_);
+               $ex_rate = get_exchange_rate_to_home_currency($currency, $date);
                $price_in_home_currency = $price / $ex_rate;
                //$price_in_home_currency = to_home_currency($price, $currency, $date);
        }       
index ef60a9380ac5312197fffc39e4b67e9b8538531f..a3a110dbf512cc4d03d555bca67cbc086f153862 100644 (file)
@@ -117,7 +117,7 @@ function get_diff_in_home_currency($supplier, $old_date, $date, $amount1, $amoun
        $currency = get_supplier_currency($supplier);
        $ex_rate = get_exchange_rate_to_home_currency($currency, $old_date);
        $amount1 = $amount1 / $ex_rate;
-       $ex_rate = get_exchange_rate_to_home_currency($currency, $date_);
+       $ex_rate = get_exchange_rate_to_home_currency($currency, $date);
        $amount2 = $amount2 / $ex_rate;
        $diff = $amount2 - $amount1;
        return round2($diff, $dec);
index 8bd2d785a3750c6a8836cc8172e4c8d1b5d3a3c8..0cded9cc349f19b1de54f93f0b0d34209aae52f0 100644 (file)
@@ -66,6 +66,10 @@ function write_sales_delivery(&$delivery,$bo_policy)
                if ($trans_no != 0) // Inserted 2008-09-25 Joe Hunt
                        $delivery_line->standard_cost = get_standard_cost($delivery_line->stock_id);
 
+               // do not use standard cost if it's a non-inventory item, 2010-02-03 Joe Hunt
+               if (!is_inventory_item($delivery_line->stock_id))
+                       $delivery_line->standard_cost = 0;
+
                /* add delivery details for all lines */
                write_customer_trans_detail_item(ST_CUSTDELIVERY, $delivery_no, $delivery_line->stock_id,
                        $delivery_line->item_description, $delivery_line->qty_dispatched,