Accounting report: Split gift card transactions in credit and debit

This commit is contained in:
Raphael Michel
2023-10-24 11:18:29 +02:00
parent 053cfdf3a9
commit 3aa751aa10

View File

@@ -762,17 +762,27 @@ class ReportExporter(ReportlabExportMixin, BaseExporter):
else: else:
tx_before = Decimal("0.00") tx_before = Decimal("0.00")
tx_during = self._giftcard_transaction_qs(form_data, currency).aggregate(s=Sum("value"))[ tx_during_pos = self._giftcard_transaction_qs(form_data, currency).filter(value__gte=Decimal("0.00")).aggregate(s=Sum("value"))[
"s" "s"
] or Decimal("0.00") ] or Decimal("0.00")
tdata.append( tdata.append(
[ [
Paragraph(_("Gift card transactions"), tstyle), Paragraph(_("Gift card transactions (credit)"), tstyle),
Paragraph(money_filter(tx_during, currency), tstyle_right), Paragraph(money_filter(tx_during_pos, currency), tstyle_right),
] ]
) )
open_after = tx_before + tx_during tx_during_neg = self._giftcard_transaction_qs(form_data, currency).filter(value__lt=Decimal("0.00")).aggregate(s=Sum("value"))[
"s"
] or Decimal("0.00")
tdata.append(
[
Paragraph(_("Gift card transactions (debit)"), tstyle),
Paragraph(money_filter(tx_during_neg, currency), tstyle_right),
]
)
open_after = tx_before + tx_during_pos + tx_during_neg
tdata.append( tdata.append(
[ [
Paragraph( Paragraph(