mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-28 22:28:24 +00:00
Loyalty Program (#12631)
* First Cut for the Loyalty Program * finished the collection part * redmeption for the loyalty point update the loyalty point entry in the FIFO style make the accounting entry knocking the debtors account against the expense account selected in the loyalty program update the outstanding balance in the client side * completed for the desk viewe * wrap up for the desk and shopping cart * pos * fix and test the travis
This commit is contained in:
committed by
Nabin Hait
parent
5d134e0465
commit
da486eeebd
@@ -462,7 +462,7 @@ class calculate_taxes_and_totals(object):
|
||||
if self.doc.doctype in ["Sales Invoice", "Purchase Invoice"]:
|
||||
grand_total = self.doc.rounded_total or self.doc.grand_total
|
||||
if self.doc.party_account_currency == self.doc.currency:
|
||||
total_amount_to_pay = flt(grand_total - self.doc.total_advance
|
||||
total_amount_to_pay = flt(grand_total - self.doc.total_advance
|
||||
- flt(self.doc.write_off_amount), self.doc.precision("grand_total"))
|
||||
else:
|
||||
total_amount_to_pay = flt(flt(grand_total *
|
||||
@@ -481,11 +481,11 @@ class calculate_taxes_and_totals(object):
|
||||
paid_amount = self.doc.paid_amount \
|
||||
if self.doc.party_account_currency == self.doc.currency else self.doc.base_paid_amount
|
||||
|
||||
|
||||
self.doc.outstanding_amount = flt(total_amount_to_pay - flt(paid_amount) + flt(change_amount),
|
||||
self.doc.precision("outstanding_amount"))
|
||||
|
||||
def calculate_paid_amount(self):
|
||||
|
||||
paid_amount = base_paid_amount = 0.0
|
||||
|
||||
if self.doc.is_pos:
|
||||
@@ -497,6 +497,10 @@ class calculate_taxes_and_totals(object):
|
||||
elif not self.doc.is_return:
|
||||
self.doc.set('payments', [])
|
||||
|
||||
if self.doc.redeem_loyalty_points and self.doc.loyalty_amount:
|
||||
base_paid_amount += self.doc.loyalty_amount
|
||||
paid_amount += (self.doc.loyalty_amount / flt(self.doc.conversion_rate))
|
||||
|
||||
self.doc.paid_amount = flt(paid_amount, self.doc.precision("paid_amount"))
|
||||
self.doc.base_paid_amount = flt(base_paid_amount, self.doc.precision("base_paid_amount"))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user