Commit 7e0788cb by Owo Sugiana

Invoice ID porsi sptno menjadi 6 digit

1 parent a5748532
......@@ -24,7 +24,7 @@ def show_rp(label, value):
def show_field(t, fieldname):
label = 'Field ' + fieldname
label = f'Field {t.__tablename__}.{fieldname}'
try:
value = getattr(t, fieldname)
except AttributeError:
......@@ -72,6 +72,10 @@ def show(inq):
show_rp('Total Bayar', inq.total_bayar)
show_rp('Total Tagihan', inq.total)
show_field(inq.invoice, 'status_pembayaran')
if inq.total_bayar:
pay = inq.get_payment()
show_field(pay, 'sspdtgl')
show_field(pay, 'id')
def show_pkey_values(row):
......
......@@ -36,7 +36,7 @@ from ..base import get_db_session
INVOICE_ID = [
('Tahun', 4, 'N'),
('SptNo', 5, 'N'),
('SptNo', 6, 'N'),
]
......@@ -240,6 +240,13 @@ class BaseInquiry:
k = self.get_kohir()
return k and k.kohirtgl.date()
def get_payment(self):
Payment = self.get_payment_model()
DBSession = get_db_session()
q = DBSession.query(Payment).filter_by(spt_id=self.invoice.id)
q = q.order_by(Payment.id.desc())
return q.first()
class Inquiry(BaseInquiry):
def __init__(
......@@ -357,13 +364,6 @@ class Reversal(BaseInquiry):
DBSession.add(self.invoice)
DBSession.flush()
def get_payment(self):
Payment = self.get_payment_model()
DBSession = get_db_session()
q = DBSession.query(Payment).filter_by(spt_id=self.invoice.id)
q = q.order_by(Payment.id.desc())
return q.first()
def date_from_str(s):
d, m, y = [int(x) for x in s.split('-')]
......
......@@ -53,6 +53,8 @@ def satu_kalimat(notes):
class Inquiry(BaseInquiry):
def get_discount_denda(self): # Override
if self.denda < 1:
return 0
tgl_bayar = to_date(self.tgl_bayar)
if tgl_bayar > TGL_BAYAR_MAX:
return 0
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!