Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
aa.gusti
/
eis
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 1e43b80c
authored
Jun 11, 2025
by
aa.gustiana@gmail.com
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
perhitungan pbb
1 parent
68251610
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
126 additions
and
28 deletions
eispajak/models/payment.py
eispajak/views/pcpd.py
eispajak/views/templates/pcpd.pt
eispajak/models/payment.py
View file @
1e43b80
from
datetime
import
timedelta
,
datetime
import
sys
from
opensipkd.base.models
import
(
Base
,
DBSession
,
CommonModel
,
DefaultModel
,
NamaModel
,
KodeModel
,
DBSession
,
Base
,
CommonModel
,
DefaultModel
,
NamaModel
,
KodeModel
,
TABLE_ARGS
)
from
sqlalchemy
import
(
Column
,
Integer
,
DateTime
,
String
,
Text
,
ForeignKey
,
Float
,
...
...
@@ -59,9 +59,20 @@ class PaymentPBB(PCBase, DefaultModel):
UniqueConstraint
(
'stan'
,
'ntb'
),
)
@classmethod
def
qry_sum
(
cls
,
columns
=
[]):
qry
=
PCDBSession
.
query
(
func
.
sum
(
cls
.
jml_sppt_yg_dibayar
)
.
label
(
'bayar'
),
func
.
sum
(
cls
.
denda_sppt
)
.
label
(
'denda'
),
func
.
count
(
cls
.
id
)
.
label
(
'trx'
))
.
select_from
(
cls
)
for
col
in
columns
:
qry
=
qry
.
add_columns
(
col
)
return
qry
@classmethod
def
sum_data
(
cls
):
return
DBSession
.
query
(
return
PC
DBSession
.
query
(
func
.
to_char
(
cls
.
tgl_pembayaran_sppt
,
'yyyy-mm-dd'
)
.
label
(
'tanggal'
),
func
.
sum
(
cls
.
jml_sppt_yg_dibayar
)
.
label
(
'bayar'
),
...
...
@@ -109,7 +120,7 @@ class PaymentBPHTB(PCBase, CommonModel):
@classmethod
def
sum_data
(
cls
):
return
DBSession
.
query
(
func
.
sum
(
cls
.
nilai_bphtb
)
.
label
(
'bayar'
),
return
PC
DBSession
.
query
(
func
.
sum
(
cls
.
nilai_bphtb
)
.
label
(
'bayar'
),
func
.
sum
(
'0'
)
.
label
(
'denda'
))
@classmethod
...
...
@@ -165,7 +176,7 @@ class PaymentPAD(PCBase, CommonModel):
@classmethod
def
sum_data
(
cls
):
return
DBSession
.
query
(
func
.
sum
(
cls
.
jml_bayar
)
.
label
(
'bayar'
),
return
PC
DBSession
.
query
(
func
.
sum
(
cls
.
jml_bayar
)
.
label
(
'bayar'
),
func
.
sum
(
cls
.
denda
+
cls
.
bunga
)
.
label
(
'denda'
))
@classmethod
...
...
@@ -208,7 +219,7 @@ class PaymentWEBR(PCBase, CommonModel):
@classmethod
def
sum_data
(
cls
):
return
DBSession
.
query
(
func
.
sum
(
cls
.
jml_bayar
)
.
label
(
'bayar'
),
return
PC
DBSession
.
query
(
func
.
sum
(
cls
.
jml_bayar
)
.
label
(
'bayar'
),
func
.
sum
(
cls
.
denda
)
.
label
(
'denda'
))
@classmethod
...
...
eispajak/views/pcpd.py
View file @
1e43b80
from
types
import
NoneType
from
pyramid.view
import
(
view_config
,
)
)
from
..views
import
BaseView
from
..models
import
*
from
..models.eis
import
Eis
,
Chart
,
ChartItem
,
Slide
...
...
@@ -8,22 +9,25 @@ from datatables import ColumnDT, DataTables
from
sqlalchemy
import
func
,
and_
,
String
from
sqlalchemy.sql.expression
import
cast
from
..models.payment
import
PaymentPBB
,
PaymentPAD
,
PaymentBPHTB
,
PaymentWEBR
from
datetime
import
timedelta
logger
=
logging
.
getLogger
(
__name__
)
class
Views
(
BaseView
):
@view_config
(
route_name
=
'eis-pcpd'
,
renderer
=
'templates/pcpd.pt'
,
permission
=
'eis'
)
def
view_app
(
self
):
return
{
"module"
:
"pad"
,
"title"
:
"Realisasi Pajak dan Retribusi Daerah"
}
return
{
"module"
:
"pad"
,
"title"
:
"Realisasi Pajak dan Retribusi Daerah"
}
def
get_dummy_data
(
self
):
return
{
"today"
:
1000
,
"trx"
:
155
,
"ytd"
:
10000
,
"trxYtd"
:
1550
,
return
{
"today"
:
1000
,
"trx"
:
155
,
"ytd"
:
10000
,
"trxYtd"
:
1550
,
"pie"
:
[(
"I"
,
100
,
'#16a75c'
),
(
"II"
,
200
,
'#ffb900'
),
(
"III"
,
300
,
'#133132'
),
(
"IV"
,
200
,
'#123456'
),
(
"V"
,
100
,
'#545355'
)],
"daily"
:
[(
"I"
,
100
),
(
"II"
,
200
),
(
"III"
,
300
),
(
"IV"
,
200
),
(
"V"
,
100
),
(
"VI"
,
100
),
(
"VII"
,
700
)],
(
"III"
,
300
,
'#133132'
),
(
"IV"
,
200
,
'#123456'
),
(
"V"
,
100
,
'#545355'
)],
"daily"
:
[(
"I"
,
100
),
(
"II"
,
200
),
(
"III"
,
300
),
(
"IV"
,
200
),
(
"V"
,
100
),
(
"VI"
,
100
),
(
"VII"
,
700
)],
"dailyTrx"
:
[(
"I"
,
50
),
(
"II"
,
25
),
(
"III"
,
10
),
(
"IV"
,
10
),
(
"V"
,
50
),
(
"VI"
,
34
),
(
"VII"
,
35
)],
"dailyAcc"
:
[(
"I"
,
100
),
(
"II"
,
200
),
(
"III"
,
300
),
(
"IV"
,
200
),
(
"V"
,
100
),
(
"VI"
,
100
),
(
"VII"
,
700
)],
"dailyAccTrx"
:
[(
"I"
,
100
),
(
"II"
,
200
),
(
"III"
,
300
),
(
"IV"
,
200
),
(
"V"
,
100
),
(
"VI"
,
100
),
(
"VII"
,
700
)],
...
...
@@ -37,8 +41,87 @@ class Views(BaseView):
"monthtrAccTrx"
:
[(
"JAN"
,
100
),
(
"FEB"
,
200
),
(
"MAR"
,
300
),
(
"APR"
,
200
),
(
"MAY"
,
100
),
(
"JUN"
,
100
),
(
"JUL"
,
700
)],
}
def
get_daily_data
(
self
,
table
,
filter
,
field
=
None
,
today
=
None
):
columns
=
[
field
.
label
(
"step"
)]
qry
=
table
.
qry_sum
(
columns
)
\
.
group_by
(
field
)
\
.
order_by
(
field
)
qry
=
qry
.
filter
(
filter
)
daily
=
[]
dailyTrx
=
[]
dailyAcc
=
[]
dailyAccTrx
=
[]
amt
=
trx
=
acc
=
accTrx
=
0
for
r
in
qry
:
step
=
r
[
3
]
bayar
=
r
[
0
]
or
0
denda
=
r
[
1
]
or
0
pokok
=
bayar
-
denda
tx
=
r
[
2
]
or
0
daily
.
append
((
step
,
pokok
))
dailyTrx
.
append
((
step
,
tx
))
acc
+=
pokok
accTrx
+=
tx
dailyAcc
.
append
((
step
,
acc
))
dailyAccTrx
.
append
((
step
,
accTrx
))
if
step
==
today
:
amt
=
pokok
trx
=
tx
return
amt
,
trx
,
daily
,
dailyTrx
,
dailyAcc
,
dailyAccTrx
def
get_pbb_data
(
self
):
return
self
.
get_dummy_data
()
log
.
debug
(
"YYYYY"
)
logger
.
debug
(
"XXXX"
)
if
log
.
root
.
level
==
logging
.
DEBUG
:
today
=
datetime
.
strptime
(
'2025-06-05'
,
"
%
Y-
%
m-
%
d"
)
else
:
today
=
datetime
.
now
()
.
date
()
field
=
func
.
to_char
(
PaymentPBB
.
tgl_pembayaran_sppt
,
'yyyy-mm-dd'
)
filter
=
PaymentPBB
.
tgl_pembayaran_sppt
.
between
(
today
-
timedelta
(
6
),
today
)
amt
,
trx
,
daily
,
dailyTrx
,
dailyAcc
,
dailyAccTrx
=
\
self
.
get_daily_data
(
PaymentPBB
,
filter
,
field
,
today
.
strftime
(
"
%
Y-
%
m-
%
d"
))
filter
=
PaymentPBB
.
tgl_pembayaran_sppt
.
between
(
today
-
timedelta
(
days
=
6
),
today
)
field
=
func
.
to_char
(
PaymentPBB
.
tgl_pembayaran_sppt
,
'IYYY'
)
filter
=
PaymentPBB
.
tgl_pembayaran_sppt
.
between
(
datetime
.
strptime
(
f
"{today.year}-01-01"
,
"
%
Y-
%
m-
%
d"
),
today
)
ytd
,
ytdTrx
,
yearly
,
yearlyTrx
,
yearlyAcc
,
yearlyAccTrx
=
\
self
.
get_daily_data
(
PaymentPBB
,
filter
,
field
,
str
(
today
.
year
))
field
=
func
.
to_char
(
PaymentPBB
.
tgl_pembayaran_sppt
,
'IYYY-IM'
)
month
,
monthTrx
,
monthly
,
monthlyTrx
,
monthlyAcc
,
monthlyAccTrx
=
\
self
.
get_daily_data
(
PaymentPBB
,
filter
,
field
)
filter
=
PaymentPBB
.
tgl_pembayaran_sppt
.
between
(
today
-
timedelta
(
weeks
=
6
),
today
)
week
,
weekTrx
,
weekly
,
weeklyTrx
,
weeklyAcc
,
weeklyAccTrx
=
\
self
.
get_daily_data
(
PaymentPBB
,
filter
,
field
)
field
=
func
.
to_char
(
PaymentPBB
.
tgl_pembayaran_sppt
,
'YYYY-MM'
)
return
{
"today"
:
amt
,
"trx"
:
trx
,
"daily"
:
daily
,
"dailyTrx"
:
dailyTrx
,
"dailyAcc"
:
dailyAcc
,
"dailyAccTrx"
:
dailyAccTrx
,
"ytd"
:
ytd
,
"trxYtd"
:
ytdTrx
,
"pie"
:
[(
"I"
,
100
,
'#16a75c'
),
(
"II"
,
200
,
'#ffb900'
),
(
"III"
,
300
,
'#133132'
),
(
"IV"
,
200
,
'#123456'
),
(
"V"
,
100
,
'#545355'
)],
"weekly"
:
weekly
,
"weeklyTrx"
:
weeklyTrx
,
"weeklyAcc"
:
weeklyAcc
,
"weeklyAccTrx"
:
weeklyAccTrx
,
"monthly"
:
monthly
,
"monthlyTrx"
:
monthlyTrx
,
"monthlyAcc"
:
monthlyAcc
,
"monthtrAccTrx"
:
monthlyAccTrx
,
}
@view_config
(
route_name
=
'eis-pcpd-act'
,
renderer
=
'json'
)
def
view_app_act
(
self
):
...
...
@@ -48,18 +131,19 @@ class Views(BaseView):
params
=
req
.
params
id
=
'id'
in
params
and
params
[
'id'
]
or
0
json_data
=
{}
json_data
[
'success'
]
=
False
json_data
[
'success'
]
=
False
act
=
req
.
matchdict
[
'act'
]
if
act
==
'grid'
:
rows
=
DBSession
.
query
(
Eis
)
.
filter
(
Eis
.
id
==
id
)
if
act
==
'grid'
:
rows
=
DBSession
.
query
(
Eis
)
.
filter
(
Eis
.
id
==
id
)
if
not
rows
:
return
json_data
elif
act
==
'pbb'
:
elif
act
==
'pbb'
:
resp
=
self
.
get_pbb_data
()
else
:
resp
=
self
.
get_dummy_data
()
resp
[
"time"
]
=
datetime
.
now
()
.
strftime
(
"
%
Y-
%
m-
%
d
%
H:
%
M:
%
S"
)
resp
[
"time"
]
=
datetime
.
now
()
.
strftime
(
"
%
Y-
%
m-
%
d
%
H:
%
M:
%
S"
)
return
resp
def
view_pajak
(
self
):
return
{
"module"
:
'pajak'
,
"title"
:
"Realisasi Pajak Daerah"
}
...
...
@@ -79,6 +163,7 @@ class Views(BaseView):
def
view_resto
(
self
):
return
{
"module"
:
'resto'
,
"title"
:
"Realisasi Pajak Restoran"
}
def
view_parkir
(
self
):
return
{
"module"
:
'parkir'
,
"title"
:
"Realisasi Pajak Parkir"
}
...
...
@@ -86,12 +171,15 @@ class Views(BaseView):
def
view_hiburan
(
self
):
return
{
"module"
:
'hiburan'
,
"title"
:
"Realisasi Pajak Hiburan"
}
def
view_ppju
(
self
):
return
{
"module"
:
'ppju'
,
"title"
:
"Realisasi Pajak Penerangan Jalan Umum"
}
def
view_minerba
(
self
):
return
{
"module"
:
'minerba'
,
"title"
:
"Realisasi Pajak Minerba"
}
def
view_reklame
(
self
):
return
{
"module"
:
'reklame'
,
"title"
:
"Realisasi Pajak Reklame"
}
...
...
@@ -250,6 +338,3 @@ class Views(BaseView):
# ]
# rowTable = DataTables(req.GET, query, columns)
# return rowTable.output_result()
eispajak/views/templates/pcpd.pt
View file @
1e43b80
...
...
@@ -349,6 +349,7 @@
$
(
"#rangeType"
).
change
(
function
()
{
trendChart
();
});
$
().
datarefresh
();
});
function
addData
(
chart
,
data
)
{
labels
=
[];
...
...
@@ -415,6 +416,11 @@
}
else
{
console
.
log
(
"Request failed."
);
}
setTimeout
(
function
()
{
console
.
log
(
"timeout"
);
$
().
datarefresh
();
},
15000
);
});
// $().get_realisasi();
// $().get_harian();
...
...
@@ -423,10 +429,6 @@
}
setTimeout
(
function
()
{
console
.
log
(
"timeout"
);
$
().
datarefresh
();
},
1
);
</script>
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment