fixes in new gross profit report
diff --git a/accounts/page/accounts_home/accounts_home.js b/accounts/page/accounts_home/accounts_home.js
index 237b51f..f2faf93 100644
--- a/accounts/page/accounts_home/accounts_home.js
+++ b/accounts/page/accounts_home/accounts_home.js
@@ -151,6 +151,11 @@
route: "Report/Profile/Trend Analyzer",
doctype: "Sales Invoice"
},
+ {
+ "label":wn._("Gross Profit"),
+ route: "query-report/Gross Profit",
+ doctype: "Sales Invoice"
+ },
]
},
{
diff --git a/accounts/report/gross_profit/gross_profit.py b/accounts/report/gross_profit/gross_profit.py
index a9a4532..de8651b 100644
--- a/accounts/report/gross_profit/gross_profit.py
+++ b/accounts/report/gross_profit/gross_profit.py
@@ -56,12 +56,9 @@
if sle.voucher_type == "Delivery Note" and sle.voucher_no == voucher_no:
if (sle.voucher_detail_no == item_row) or \
(sle.item_code == item_code and sle.warehouse == warehouse and \
- abs(sle.qty) == qty):
+ abs(flt(sle.qty)) == qty):
buying_amount = flt(stock_ledger_entries[i+1].stock_value) - flt(sle.stock_value)
- if buying_amount < 0:
- webnotes.errprint([voucher_no, item_row, item_code, warehouse, qty])
- webnotes.errprint(["previous", stock_ledger_entries[i+1]])
- webnotes.errprint(["current", sle])
+
return buying_amount
return 0.0
@@ -78,7 +75,8 @@
global stock_ledger_entries
query = """select item_code, voucher_type, voucher_no,
- voucher_detail_no, posting_date, posting_time, stock_value
+ voucher_detail_no, posting_date, posting_time, stock_value,
+ warehouse, actual_qty as qty
from `tabStock Ledger Entry` where ifnull(`is_cancelled`, "No") = "No" """
if filters.get("company"):
@@ -86,4 +84,4 @@
query += " order by item_code desc, warehouse desc, posting_date desc, posting_time desc, name desc"
- stock_ledger_entries = webnotes.conn.sql(query, filters, as_dict=True, debug=1)
+ stock_ledger_entries = webnotes.conn.sql(query, filters, as_dict=True)