feat(report): add trade markup and its VAT to agricultural stock report
Closing balance is now cost-based (opening + purchased - COGS) so the trade-markup identity holds. Adds two columns: - Trade markup on goods sold = sold(sale) - (opening + purchased - closing) - VAT on trade markup = trade markup * 18% Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
72f8292bfe
commit
18e55b7421
|
|
@ -61,6 +61,21 @@ def get_columns(filters=None):
|
||||||
"fieldname": "closing_balance",
|
"fieldname": "closing_balance",
|
||||||
"fieldtype": "Currency",
|
"fieldtype": "Currency",
|
||||||
"width": 200
|
"width": 200
|
||||||
|
},
|
||||||
|
{
|
||||||
|
# Cari hesabat dövründə satılmış mallara görə ticarət əlavəsi
|
||||||
|
"label": _("Trade markup on goods sold"),
|
||||||
|
"fieldname": "trade_markup",
|
||||||
|
"fieldtype": "Currency",
|
||||||
|
"width": 220
|
||||||
|
},
|
||||||
|
{
|
||||||
|
# Cari hesabat dövründə satılmış mallara görə ticarət əlavəsinin
|
||||||
|
# ƏDV məbləği = ticarət əlavəsi * 18%
|
||||||
|
"label": _("VAT on trade markup"),
|
||||||
|
"fieldname": "trade_markup_vat",
|
||||||
|
"fieldtype": "Currency",
|
||||||
|
"width": 200
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
@ -241,8 +256,17 @@ def get_data(filters=None):
|
||||||
else:
|
else:
|
||||||
sold_purchase_price = _fifo_sold_purchase_price(purchases, sales, from_date, to_date)
|
sold_purchase_price = _fifo_sold_purchase_price(purchases, sales, from_date, to_date)
|
||||||
|
|
||||||
# Closing balance keeps the simplified formula (sale price for sold).
|
# Closing balance at purchase price = opening + purchased - cost of goods
|
||||||
closing_balance = opening_balance + purchased - sold
|
# sold (COGS, valued per the company's stock valuation method).
|
||||||
|
closing_balance = opening_balance + purchased - sold_purchase_price
|
||||||
|
|
||||||
|
# Cari hesabat dövründə satılmış mallara görə ticarət əlavəsi:
|
||||||
|
# sold (sale price) - (opening + purchased - closing)
|
||||||
|
# The parenthesised term is the COGS, so this is sale value minus cost.
|
||||||
|
trade_markup = sold - (opening_balance + purchased - closing_balance)
|
||||||
|
|
||||||
|
# ƏDV on the trade markup (18%).
|
||||||
|
trade_markup_vat = trade_markup * 0.18
|
||||||
|
|
||||||
if from_date and to_date:
|
if from_date and to_date:
|
||||||
period = f"{from_date} — {to_date}"
|
period = f"{from_date} — {to_date}"
|
||||||
|
|
@ -257,7 +281,9 @@ def get_data(filters=None):
|
||||||
"purchased": purchased,
|
"purchased": purchased,
|
||||||
"sold": sold,
|
"sold": sold,
|
||||||
"sold_purchase_price": sold_purchase_price,
|
"sold_purchase_price": sold_purchase_price,
|
||||||
"closing_balance": closing_balance
|
"closing_balance": closing_balance,
|
||||||
|
"trade_markup": trade_markup,
|
||||||
|
"trade_markup_vat": trade_markup_vat
|
||||||
}]
|
}]
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue