Changed Inventory Sales Report to use average cost by actual trans dates if non zero
authorJoe Hunt <joe.hunt.consulting@gmail.com>
Sun, 17 Oct 2010 09:12:37 +0000 (09:12 +0000)
committerJoe Hunt <joe.hunt.consulting@gmail.com>
Sun, 17 Oct 2010 09:12:37 +0000 (09:12 +0000)
CHANGELOG.txt
reporting/rep304.php

index aef91a342c418f98add6fc63f76e0d2184f1808e..036f1ff7a887376849834aa6cfd249c4a0277be2 100644 (file)
@@ -19,6 +19,10 @@ Legend:
 ! -> Note
 $ -> Affected files
 
+17-Oct-2010 Joe Hunt
+! Changed Inventory Sales Report to use average cost by actual trans dates if non zero
+$ /reporting/rep304.php
+
 16-Oct-2010 Joe Hunt
 ! [0000266] Added dimension selections in Profit Loss and Balance drilldown and Trial Balance
 $ /gl/inquiry/balance_sheet.php
index a525f33c505d15d241f628217bafae83a6042b8f..ac59e881f3f35c25ec0f5c55d8d24a2477a97506 100644 (file)
@@ -43,7 +43,7 @@ function getTransactions($category, $location, $fromcust, $from, $to)
                        ".TB_PREF."stock_moves.tran_date,
                        SUM(-".TB_PREF."stock_moves.qty) AS qty,
                        SUM(-".TB_PREF."stock_moves.qty*".TB_PREF."stock_moves.price*(1-".TB_PREF."stock_moves.discount_percent)) AS amt,
-                       SUM(-".TB_PREF."stock_moves.qty *(".TB_PREF."stock_master.material_cost + ".TB_PREF."stock_master.labour_cost + ".TB_PREF."stock_master.overhead_cost)) AS cost
+                       SUM(-IF(".TB_PREF."stock_moves.standard_cost <> 0, ".TB_PREF."stock_moves.qty * ".TB_PREF."stock_moves.standard_cost, ".TB_PREF."stock_moves.qty *(".TB_PREF."stock_master.material_cost + ".TB_PREF."stock_master.labour_cost + ".TB_PREF."stock_master.overhead_cost))) AS cost
                FROM ".TB_PREF."stock_master,
                        ".TB_PREF."stock_category,
                        ".TB_PREF."debtor_trans,