Commit d800c0af by Owo Sugiana

Menyertakan juga rumus discount 2025 untuk Kota Tangerang Selatan

1 parent 6638aa07
......@@ -23,6 +23,9 @@ from ..models.tangsel import (
)
AWAL_DISC_2025 = date(2025, 10, 1)
AKHIR_DISC_2025 = date(2025, 12, 29)
DISC = [
(date(2026, 1, 1), date(2026, 4, 30), 0.1),
(date(2026, 5, 1), date(2026, 6, 30), 0.05),
......@@ -77,15 +80,29 @@ class Inquiry(BaseInquiry):
row = q.first()
return row and row.status_pembayaran_sppt == '1'
def get_disc(self):
if not self.tahun_lunas('2025'):
print('Tahun 2025 belum lunas')
return 0
if self.invoice.thn_pajak_sppt <= '2014':
return 0.75
if self.invoice.thn_pajak_sppt <= '2024':
return 0.3
return 0
def hitung_discount(self): # Override
self.discount_denda = self.discount_pokok = 0
if self.invoice.thn_pajak_sppt != '2026':
return
for awal, akhir, potongan in DISC:
if awal <= self.tgl_bayar <= akhir:
self.discount = self.discount_pokok = \
self.hitung_discount_pokok(potongan)
return
if AWAL_DISC_2025 <= self.tgl_bayar <= AKHIR_DISC_2025:
disc = self.get_disc()
self.discount_denda = int(disc * self.denda)
self.discount_pokok = self.hitung_discount_pokok(disc)
self.discount = self.discount_denda + self.discount_pokok
elif self.invoice.thn_pajak_sppt == '2026':
for awal, akhir, potongan in DISC:
if awal <= self.tgl_bayar <= akhir:
self.discount = self.discount_pokok = \
self.hitung_discount_pokok(potongan)
return
def before_save(self, payment): # Override
# Sekedar catatan
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!