Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -5,6 +5,8 @@ import numpy as np
|
|
5 |
import pandas as pd
|
6 |
import os
|
7 |
|
|
|
|
|
8 |
from sentence_transformers import SentenceTransformer
|
9 |
from sentence_transformers.util import cos_sim
|
10 |
from sentence_transformers import CrossEncoder
|
@@ -24,6 +26,14 @@ df_bobot = pd.read_sql(f"SELECT * FROM {db_user}.bobot", mydb)
|
|
24 |
df_bobot['BOBOT'] = [float(x.replace(",",".")) for x in df_bobot['BOBOT']]#.astype(float)
|
25 |
df_bobot["JENIS_KENDARAAN"] = [x[:-2] + x[-1] if x[-2] == "." else x for x in df_bobot["JENIS_KENDARAAN"]]
|
26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
codes = """001 - Vehicle Registration (New)
|
28 |
002 - Vehicle Registration Renewal
|
29 |
003 - Vehicle Ownership Transfer
|
@@ -794,6 +804,8 @@ def respond_pkb(
|
|
794 |
|
795 |
v_type = vehicle["nm_jenis_kb"].values[0]
|
796 |
nilai_jual = vehicle["nilai_jual"].values[0]
|
|
|
|
|
797 |
|
798 |
bobot = df_bobot[df_bobot["JENIS_KENDARAAN"]==v_type]["BOBOT"].values[0]
|
799 |
|
@@ -811,15 +823,55 @@ def respond_pkb(
|
|
811 |
if scores[scores_argsort[0]] < threshold:
|
812 |
continue
|
813 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
814 |
if scores[0] > w_avg:
|
815 |
-
out += "\
|
816 |
-
|
817 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
818 |
if scores[1] > w_avg:
|
819 |
-
|
820 |
-
|
821 |
-
|
822 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
823 |
if not out and scores[scores_argsort[0]] >= threshold:
|
824 |
if scores[0] > w_avg:
|
825 |
out += "\nRumus Bea Balik Nama Kendaraan Bermotor (BBNKB) : TARIF x NJKB x PENGENAAN"
|
|
|
5 |
import pandas as pd
|
6 |
import os
|
7 |
|
8 |
+
from datetime import datetime
|
9 |
+
|
10 |
from sentence_transformers import SentenceTransformer
|
11 |
from sentence_transformers.util import cos_sim
|
12 |
from sentence_transformers import CrossEncoder
|
|
|
26 |
df_bobot['BOBOT'] = [float(x.replace(",",".")) for x in df_bobot['BOBOT']]#.astype(float)
|
27 |
df_bobot["JENIS_KENDARAAN"] = [x[:-2] + x[-1] if x[-2] == "." else x for x in df_bobot["JENIS_KENDARAAN"]]
|
28 |
|
29 |
+
df_sample["pnbp_stnk"] = df["nm_jenis_kb"].apply(
|
30 |
+
lambda x: 100000 if x == "SPD. MOTOR R2" else 200000
|
31 |
+
)
|
32 |
+
|
33 |
+
df_sample["pnbp_tnkb"] = df["nm_jenis_kb"].apply(
|
34 |
+
lambda x: 60000 if x == "SPD. MOTOR R2" else 100000
|
35 |
+
)
|
36 |
+
|
37 |
codes = """001 - Vehicle Registration (New)
|
38 |
002 - Vehicle Registration Renewal
|
39 |
003 - Vehicle Ownership Transfer
|
|
|
804 |
|
805 |
v_type = vehicle["nm_jenis_kb"].values[0]
|
806 |
nilai_jual = vehicle["nilai_jual"].values[0]
|
807 |
+
pnbp_stnk = vehicle["pnbp_stnk"].values[0]
|
808 |
+
pnbp_tnkb = vehicle["pnbp_tnkb"].values[0]
|
809 |
|
810 |
bobot = df_bobot[df_bobot["JENIS_KENDARAAN"]==v_type]["BOBOT"].values[0]
|
811 |
|
|
|
823 |
if scores[scores_argsort[0]] < threshold:
|
824 |
continue
|
825 |
|
826 |
+
header_rincian = "| POKOK | DENDA | TOTAL ||\n|-:|-:|-:|:-|\n"
|
827 |
+
rincian = "\n\n### RINCIAN:\n\n" + header_rincian
|
828 |
+
|
829 |
+
is_rincian = False
|
830 |
+
|
831 |
+
out_k = ""
|
832 |
+
|
833 |
if scores[0] > w_avg:
|
834 |
+
out += f"\nBBNKB \t\t: {int(bbnkb):,}"
|
835 |
+
|
836 |
+
out_k += "\nRumus Bea Balik Nama Kendaraan Bermotor (BBNKB) : TARIF x NJKB x PENGENAAN"
|
837 |
+
out_k += f"\nKalkulasi : {tarif_bbnkb*100}% x Rp{int(nilai_jual):,} x 100%"
|
838 |
+
out_k += f"\nTotal Pembayaran : Rp{int(bbnkb):,}\n"
|
839 |
+
rincian += f"|{int(bbnkb):,}|0|{int(bbnkb):,}|BBNKB|\n"
|
840 |
+
is_rincian = True
|
841 |
+
else:
|
842 |
+
bbnkb = 0
|
843 |
+
|
844 |
if scores[1] > w_avg:
|
845 |
+
d = datetime.now().date().year - datetime.strptime(vehicle["tg_akhir_pkb"].values[0], "%Y-%m-%d").date().year
|
846 |
+
swdkllj = 35000
|
847 |
+
|
848 |
+
out += f"\nPKB \t\t: {int(pkb*d):,}"
|
849 |
+
out += f"\nSWDKLLJ \t\t: {int(swdkllj*d):,}"
|
850 |
+
out += f"\nPNBP STNK \t\t:{int(pnbp_stnk):,}"
|
851 |
+
out += f"\nPNBP TNKB \t\t:{int(pnbp_tnkb):,}"
|
852 |
+
out += f"\nTOTAL \t\t: {int(pkb + swdkllj + pnbp_stnk + pnbp_tnkb + bbnkb):,}"
|
853 |
+
|
854 |
+
out_k += "\nRumus Pokok Pajak Kendaraan Bermotor (PKB) : TARIF * NJKB * BOBOT * PENGENAAN"
|
855 |
+
out_k += f"\nKalkulasi : {tarif_pkb*100}% * Rp{int(nilai_jual):,} * {bobot} * 100%"
|
856 |
+
out_k += f"\nTotal Pembayaran : Rp{int(pkb):,}\n"
|
857 |
+
out_k += "\nRumus Total PKB: PKB + SWDKLLJ + PNBP STNK + PNBP TNKB"
|
858 |
+
out_k += f"\nKalkulasi : Rp{int(pkb):,} + Rp{int(swdkllj):,} + Rp{int(pnbp_stnk):,} + Rp{int(pnbp_tnkb):,}"
|
859 |
+
out_k += f"\nTotal Pembayaran : Rp{int(pkb + swdkllj + pnbp_stnk + pnbp_tnkb):,}\n"
|
860 |
+
|
861 |
+
if d < 1:
|
862 |
+
d == 1
|
863 |
+
|
864 |
+
rincian += f"|{int(pkb*d):,}|0|{int(pkb*d):,}|PKB|\n" + f"|{int(swdkllj*d):,}|0|{int(swdkllj*d):,}|SWDKLLJ|\n\n"
|
865 |
+
rincian_pkb = "### RINCIAN PKB:\n\n| POKOK | DENDA | TOTAL |\n|-:|-:|-:|\n"
|
866 |
+
rincian_swdkllj = "### RINCIAN SWDKLLJ:\n\n| POKOK | DENDA | TOTAL |\n|-:|-:|-:|\n"
|
867 |
+
for i in range(d):
|
868 |
+
rincian_pkb += f"|{int(pkb):,}|0|{int(pkb):,}|PKB|\n"
|
869 |
+
rincian_swdkllj += f"|{int(swdkllj):,}|0|{int(swdkllj):,}|PKB|\n"
|
870 |
+
rincian += rincian_pkb + "\n" + rincian_swdkllj
|
871 |
+
is_rincian = True
|
872 |
+
out += out_k
|
873 |
+
if is_rincian:
|
874 |
+
out += rincian
|
875 |
if not out and scores[scores_argsort[0]] >= threshold:
|
876 |
if scores[0] > w_avg:
|
877 |
out += "\nRumus Bea Balik Nama Kendaraan Bermotor (BBNKB) : TARIF x NJKB x PENGENAAN"
|