Commit 128fcdb9 by Owo Sugiana

Modul tangsel memperhatikan field sppt.faktor_pengurang_sppt

1 parent 0309da2a
......@@ -43,6 +43,7 @@ def get_option_tangsel(argv):
pars.add_argument('conf')
pars.add_argument('--tahun')
pars.add_argument('--discount-penuh', action='store_true')
pars.add_argument('--faktor-pengurang', action='store_true')
pars.add_argument(
'--count', type=int, default=default_count, help=help_count)
return pars.parse_args(argv)
......
......@@ -83,6 +83,9 @@ class Inquiry(BaseInquiry):
return 0
def hitung_discount_pokok(self):
faktor_pengurang = self.invoice.faktor_pengurang_sppt or 0
if faktor_pengurang > 0:
return 0
if self.invoice.thn_pajak_sppt not in TAHUN_PAJAK_DISC_POKOK:
return 0
if self.tgl_bayar.year not in PERIODE_DISC_POKOK:
......@@ -143,6 +146,9 @@ class Reversal(BaseReversal):
class AvailableInvoice(BaseAvailableInvoice):
def get_payment_model(self): # Override
return PembayaranSppt
def get_inquiry_class(self):
return Inquiry
......@@ -162,15 +168,17 @@ class AvailableInvoiceTangsel(AvailableInvoice):
def get_msg(self, inq):
s = AvailableInvoice.get_msg(self, inq)
if not inq.discount_pokok:
if inq.discount_pokok:
s = '{}, Discount Pokok {}'.format(s, thousand(inq.discount_pokok))
if inq.invoice.faktor_pengurang_sppt:
s = '{}, Faktor Pengurang {}'.format(
s, thousand(inq.invoice.faktor_pengurang_sppt))
return s
return '{}, Discount Pokok {}'.format(
s, thousand(inq.discount_pokok))
def get_filter(self, q): # Override
if self.option.discount_penuh:
DBSession = get_db_session()
Sppt = self.get_invoice_model()
if self.option.discount_penuh:
Sppt1 = aliased(Sppt)
Sppt2 = aliased(Sppt)
subq1 = DBSession.query(Sppt1).filter(
......@@ -192,8 +200,10 @@ class AvailableInvoiceTangsel(AvailableInvoice):
Sppt2.kd_jns_op == Sppt.kd_jns_op,
Sppt2.thn_pajak_sppt.in_(THN_DISC),
Sppt2.status_pembayaran_sppt != '1')
return q.filter(
q = q.filter(
Sppt.thn_pajak_sppt < str(THN_AWAL),
subq1.exists(),
~subq2.exists())
if self.option.faktor_pengurang:
q = q.filter(Sppt.faktor_pengurang_sppt > 0)
return q
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!