Allocation of credit note amount and pdc in payment terms
This commit is contained in:
parent
24f8d3ed0c
commit
b6c083706a
@ -192,29 +192,37 @@ class ReceivablePayableReport(object):
|
|||||||
|
|
||||||
for gle in gl_entries_data:
|
for gle in gl_entries_data:
|
||||||
if self.is_receivable_or_payable(gle, self.dr_or_cr, future_vouchers):
|
if self.is_receivable_or_payable(gle, self.dr_or_cr, future_vouchers):
|
||||||
if self.filters.based_on_payment_terms and self.payment_term_map.get(gle.voucher_no):
|
|
||||||
outstanding_amount, credit_note_amount, payment_amount = self.get_outstanding_amount(
|
outstanding_amount, credit_note_amount, payment_amount = self.get_outstanding_amount(
|
||||||
gle,self.filters.report_date, self.dr_or_cr, return_entries, currency_precision)
|
gle,self.filters.report_date, self.dr_or_cr, return_entries, currency_precision)
|
||||||
if abs(outstanding_amount) > 0.1/10**currency_precision:
|
if abs(outstanding_amount) > 0.1/10**currency_precision:
|
||||||
|
if self.filters.based_on_payment_terms and self.payment_term_map.get(gle.voucher_no):
|
||||||
|
pdc_amount = flt(self.pdc_details.get((gle.voucher_no, gle.party), {}).get("pdc_amount"))
|
||||||
for d in self.payment_term_map.get(gle.voucher_no):
|
for d in self.payment_term_map.get(gle.voucher_no):
|
||||||
if payment_amount >= d[1]:
|
if payment_amount + credit_note_amount >= d[1]:
|
||||||
payment_amount -= d[1]
|
temp = payment_amount
|
||||||
|
payment_amount = payment_amount - d[1] + credit_note_amount
|
||||||
|
credit_note_amount = credit_note_amount - d[1] + temp - payment_amount
|
||||||
else:
|
else:
|
||||||
outstanding_amount = d[1] - payment_amount
|
outstanding_amount = d[1] - payment_amount - credit_note_amount
|
||||||
|
if pdc_amount > outstanding_amount:
|
||||||
|
pdc = outstanding_amount
|
||||||
|
pdc_amount -= outstanding_amount
|
||||||
|
else:
|
||||||
|
pdc = pdc_amount
|
||||||
|
pdc_amount = 0
|
||||||
|
|
||||||
row = self.prepare_row(party_naming_by, args, gle, outstanding_amount,
|
row = self.prepare_row(party_naming_by, args, gle, outstanding_amount,
|
||||||
credit_note_amount, d[0], payment_amount , d[1], d[2])
|
credit_note_amount, d[0], payment_amount , d[1], d[2], pdc)
|
||||||
payment_amount = 0
|
payment_amount = 0
|
||||||
|
credit_note_amount = 0
|
||||||
data.append(row)
|
data.append(row)
|
||||||
else:
|
else:
|
||||||
outstanding_amount, credit_note_amount, payment_amount = self.get_outstanding_amount(
|
|
||||||
gle,self.filters.report_date, self.dr_or_cr, return_entries, currency_precision)
|
|
||||||
if abs(outstanding_amount) > 0.1/10**currency_precision:
|
|
||||||
row = self.prepare_row(party_naming_by, args, gle, outstanding_amount, credit_note_amount)
|
row = self.prepare_row(party_naming_by, args, gle, outstanding_amount, credit_note_amount)
|
||||||
data.append(row)
|
data.append(row)
|
||||||
return data
|
return data
|
||||||
|
|
||||||
def prepare_row(self, party_naming_by, args, gle, outstanding_amount, credit_note_amount,
|
def prepare_row(self, party_naming_by, args, gle, outstanding_amount, credit_note_amount,
|
||||||
due_date=None, paid_amt=None, payment_term_amount=None, payment_term=None):
|
due_date=None, paid_amt=None, payment_term_amount=None, payment_term=None, pdc_amount=None):
|
||||||
row = [gle.posting_date, gle.party]
|
row = [gle.posting_date, gle.party]
|
||||||
|
|
||||||
# customer / supplier name
|
# customer / supplier name
|
||||||
@ -274,9 +282,14 @@ class ReceivablePayableReport(object):
|
|||||||
|
|
||||||
pdc = self.pdc_details.get((gle.voucher_no, gle.party), {})
|
pdc = self.pdc_details.get((gle.voucher_no, gle.party), {})
|
||||||
|
|
||||||
remaining_balance = outstanding_amount - flt(pdc.get("pdc_amount"))
|
if pdc_amount == None:
|
||||||
row += [pdc.get("pdc_date"), pdc.get("pdc_ref"),
|
pdc_amount = flt(pdc.get("pdc_amount"))
|
||||||
flt(pdc.get("pdc_amount")), remaining_balance]
|
|
||||||
|
pdc_date = pdc.get("pdc_date") if pdc_amount else ''
|
||||||
|
pdc_ref = pdc.get("pdc_ref") if pdc_amount else ''
|
||||||
|
|
||||||
|
remaining_balance = outstanding_amount - pdc_amount
|
||||||
|
row += [pdc_date, pdc_ref, pdc_amount, remaining_balance]
|
||||||
|
|
||||||
<<<<<<< HEAD
|
<<<<<<< HEAD
|
||||||
# customer territory / supplier group
|
# customer territory / supplier group
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user