Commit ec4e119e by Owo Sugiana

Discount Kota Tangerang Selatan

1 parent 438c9a48
0.3.40 2025-09-30
-----------------
- Discount Kota Tangerang Selatan
0.3.39 2025-09-21
-----------------
- Discount denda Kota Bogor
......
......@@ -3,7 +3,7 @@ requires = ['setuptools >= 64']
[project]
name = 'sismiop-models'
version = '0.3.39'
version = '0.3.40'
dependencies = [
'sqlalchemy',
'zope.sqlalchemy',
......
......@@ -23,10 +23,8 @@ from ..models.tangsel import (
)
DISC_POKOK = [
(date(2025, 1, 3), date(2025, 4, 30), '2025', 0.1),
(date(2025, 5, 1), date(2025, 6, 30), '2025', 0.05),
]
AWAL_DISC = date(2025, 10, 1)
AKHIR_DISC = date(2025, 12, 29)
class Inquiry(BaseInquiry):
......@@ -58,7 +56,7 @@ class Inquiry(BaseInquiry):
super().hitung_denda()
self.denda_sblm_diskon = self.denda
def hitung_discount_pokok(self):
def hitung_discount_pokok(self, disc: float):
DBSession = get_db_session()
nop = self.invoice_id_raw[:18]
tahun = self.invoice.thn_pajak_sppt
......@@ -66,14 +64,18 @@ class Inquiry(BaseInquiry):
if q.first():
print('Tanpa Discount Pokok')
return 0
disc = 0
for awal, akhir, tahun, disc_ in DISC_POKOK:
if awal <= self.tgl_bayar <= akhir:
if tahun == self.invoice.thn_pajak_sppt:
disc = disc_
break
return int(disc * self.tagihan)
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 '2015' <= self.invoice.thn_pajak_sppt <= '2023':
return 0.3
return 0
def tahun_lunas(self, tahun):
DBSession = get_db_session()
Sppt = self.get_invoice_model()
......@@ -84,8 +86,10 @@ class Inquiry(BaseInquiry):
return row and row.status_pembayaran_sppt == '1'
def hitung_discount(self): # Override
self.discount_denda = 0
self.discount_pokok = self.hitung_discount_pokok()
if AWAL_DISC <= self.tgl_bayar <= AKHIR_DISC:
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
def before_save(self, payment): # Override
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!