aii: stock reconciliation with test case

This commit is contained in:
Nabin Hait
2013-03-19 12:01:46 +05:30
parent c3afb256b4
commit 89a94d8135
17 changed files with 383 additions and 222 deletions

View File

@@ -24,8 +24,10 @@ def execute(filters=None):
data = []
for row in delivery_note_items:
selling_amount = flt(row.amount)
buying_amount = get_buying_amount(row.item_code, row.warehouse,
row.qty, "Delivery Note", row.name, row.item_row, stock_ledger_entries, item_sales_bom)
buying_amount = get_buying_amount(row.item_code, row.warehouse, -1*row.qty,
"Delivery Note", row.name, row.item_row, stock_ledger_entries, item_sales_bom)
buying_amount = buying_amount > 0 and buying_amount or 0
if selling_amount:
gross_profit = selling_amount - buying_amount
gross_profit_percent = (gross_profit / selling_amount) * 100.0