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 5169bad5
authored
Jun 12, 2025
by
Ari Agung Prasetiyo
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge branch '2025.05' of
https://git.opensipkd.com/aa.gusti/eis
into 2025.05
2 parents
15370e2e
bd81b565
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
98 additions
and
45 deletions
eispajak/views/pcpd.py
eispajak/views/pcpd.py
View file @
5169bad
...
...
@@ -9,6 +9,7 @@ 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
opensipkd.pbb.monitoring.models
import
PembayaranSppt
from
datetime
import
timedelta
logger
=
logging
.
getLogger
(
__name__
)
...
...
@@ -91,38 +92,91 @@ class Views(BaseView):
trx
=
tx
return
amt
,
trx
,
daily
,
dailyTrx
,
dailyAcc
,
dailyAccTrx
# def get_pbb_data(self):
# 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_exp = PaymentPBB.tgl_pembayaran_sppt.between(
# today-timedelta(6), today)
# amt, trx, daily, dailyTrx, dailyAcc, dailyAccTrx = \
# self.get_daily_data(PaymentPBB, field,
# today.strftime("%Y-%m-%d"), filter_exp)
# filter_exp = PaymentPBB.tgl_pembayaran_sppt.between(
# today-timedelta(days=6), today)
# field = func.to_char(PaymentPBB.tgl_pembayaran_sppt, 'IYYY')
# filter_exp = 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, field,
# str(today.year), filter_exp)
# field = func.to_char(PaymentPBB.tgl_pembayaran_sppt, 'MM')
# month, monthTrx, monthly, monthlyTrx, monthlyAcc, monthlyAccTrx = \
# self.get_daily_data(PaymentPBB, field, None, filter_exp)
# field = func.to_char(PaymentPBB.tgl_pembayaran_sppt, 'WW')
# filter_exp = PaymentPBB.tgl_pembayaran_sppt.between(
# today-timedelta(weeks=6), today)
# week, weekTrx, weekly, weeklyTrx, weeklyAcc, weeklyAccTrx = \
# self.get_daily_data(PaymentPBB, field, None, filter_exp)
# 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,
# "monthlyAccTrx": monthlyAccTrx,
# }
def
get_pbb_data
(
self
):
if
log
.
root
.
level
==
logging
.
DEBUG
:
today
=
datetime
.
strptime
(
'2025-06-05'
,
"
%
Y-
%
m-
%
d"
)
else
:
today
=
datetime
.
now
()
.
date
()
field
=
func
.
to_char
(
P
aymentPBB
.
tgl_pembayaran_sppt
,
'yyyy-mm-dd'
)
filter_exp
=
P
aymentPBB
.
tgl_pembayaran_sppt
.
between
(
field
=
func
.
to_char
(
P
embayaranSppt
.
tgl_pembayaran_sppt
,
'yyyy-mm-dd'
)
filter_exp
=
P
embayaranSppt
.
tgl_pembayaran_sppt
.
between
(
today
-
timedelta
(
6
),
today
)
amt
,
trx
,
daily
,
dailyTrx
,
dailyAcc
,
dailyAccTrx
=
\
self
.
get_daily_data
(
P
aymentPBB
,
field
,
self
.
get_daily_data
(
P
embayaranSppt
,
field
,
today
.
strftime
(
"
%
Y-
%
m-
%
d"
),
filter_exp
)
filter_exp
=
P
aymentPBB
.
tgl_pembayaran_sppt
.
between
(
filter_exp
=
P
embayaranSppt
.
tgl_pembayaran_sppt
.
between
(
today
-
timedelta
(
days
=
6
),
today
)
field
=
func
.
to_char
(
P
aymentPBB
.
tgl_pembayaran_sppt
,
'IYYY'
)
filter_exp
=
P
aymentPBB
.
tgl_pembayaran_sppt
.
between
(
field
=
func
.
to_char
(
P
embayaranSppt
.
tgl_pembayaran_sppt
,
'IYYY'
)
filter_exp
=
P
embayaranSppt
.
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
(
P
aymentPBB
,
field
,
self
.
get_daily_data
(
P
embayaranSppt
,
field
,
str
(
today
.
year
),
filter_exp
)
field
=
func
.
to_char
(
P
aymentPBB
.
tgl_pembayaran_sppt
,
'MM'
)
field
=
func
.
to_char
(
P
embayaranSppt
.
tgl_pembayaran_sppt
,
'MM'
)
month
,
monthTrx
,
monthly
,
monthlyTrx
,
monthlyAcc
,
monthlyAccTrx
=
\
self
.
get_daily_data
(
P
aymentPBB
,
field
,
None
,
filter_exp
)
self
.
get_daily_data
(
P
embayaranSppt
,
field
,
None
,
filter_exp
)
field
=
func
.
to_char
(
P
aymentPBB
.
tgl_pembayaran_sppt
,
'WW'
)
filter_exp
=
P
aymentPBB
.
tgl_pembayaran_sppt
.
between
(
field
=
func
.
to_char
(
P
embayaranSppt
.
tgl_pembayaran_sppt
,
'WW'
)
filter_exp
=
P
embayaranSppt
.
tgl_pembayaran_sppt
.
between
(
today
-
timedelta
(
weeks
=
6
),
today
)
week
,
weekTrx
,
weekly
,
weeklyTrx
,
weeklyAcc
,
weeklyAccTrx
=
\
self
.
get_daily_data
(
P
aymentPBB
,
field
,
None
,
filter_exp
)
self
.
get_daily_data
(
P
embayaranSppt
,
field
,
None
,
filter_exp
)
return
{
"today"
:
amt
,
"trx"
:
trx
,
...
...
@@ -319,21 +373,21 @@ class Views(BaseView):
dst
.
sort
()
def
get_pajak_data
(
self
):
pbb
=
self
.
get_pbb_data
()
bphtb
=
self
.
get_bphtb_data
()
pdl
=
self
.
get_pad_data
(
"pbb"
)
daily
=
[]
dailyTrx
=
[]
dailyAcc
=
[]
dailyAccTrx
=
[]
monthly
=
[]
monthlyTrx
=
[]
monthlyAcc
=
[]
monthlyAccTrx
=
[]
weekly
=
[]
weeklyTrx
=
[]
weeklyAcc
=
[]
weeklyAccTrx
=
[]
pbb
=
self
.
get_pbb_data
()
bphtb
=
self
.
get_bphtb_data
()
pdl
=
self
.
get_pad_data
(
"pbb"
)
daily
=
[]
dailyTrx
=
[]
dailyAcc
=
[]
dailyAccTrx
=
[]
monthly
=
[]
monthlyTrx
=
[]
monthlyAcc
=
[]
monthlyAccTrx
=
[]
weekly
=
[]
weeklyTrx
=
[]
weeklyAcc
=
[]
weeklyAccTrx
=
[]
self
.
loop_data
(
pbb
[
"daily"
],
daily
)
self
.
loop_data
(
pbb
[
"dailyTrx"
],
dailyTrx
)
...
...
@@ -374,8 +428,7 @@ class Views(BaseView):
self
.
loop_data
(
pdl
[
"weeklyAcc"
],
weeklyAcc
)
self
.
loop_data
(
pdl
[
"weeklyAccTrx"
],
weeklyAccTrx
)
resp
=
{
"today"
:
float
(
pbb
.
get
(
"today"
,
0
))
+
float
(
bphtb
.
get
(
"today"
,
0
))
+
float
(
pdl
.
get
(
"today"
,
0
)),
resp
=
{
"today"
:
float
(
pbb
.
get
(
"today"
,
0
))
+
float
(
bphtb
.
get
(
"today"
,
0
))
+
float
(
pdl
.
get
(
"today"
,
0
)),
"trx"
:
float
(
pbb
.
get
(
"trx"
,
0
))
+
float
(
bphtb
.
get
(
"trx"
,
0
))
+
float
(
pdl
.
get
(
"trx"
,
0
)),
"daily"
:
daily
,
"dailyTrx"
:
dailyTrx
,
...
...
@@ -397,31 +450,31 @@ class Views(BaseView):
}
return
resp
@
view_config
(
route_name
=
'eis-pcpd-act'
,
renderer
=
'json'
)
@view_config
(
route_name
=
'eis-pcpd-act'
,
renderer
=
'json'
)
def
view_app_act
(
self
):
tahun
=
self
.
ses
[
'tahun'
]
req
=
self
.
req
ses
=
req
.
session
params
=
req
.
params
id
=
'id'
in
params
and
params
[
'id'
]
or
0
json_data
=
{}
json_data
[
'success'
]
=
False
act
=
req
.
matchdict
[
'act'
]
tahun
=
self
.
ses
[
'tahun'
]
req
=
self
.
req
ses
=
req
.
session
params
=
req
.
params
id
=
'id'
in
params
and
params
[
'id'
]
or
0
json_data
=
{}
json_data
[
'success'
]
=
False
act
=
req
.
matchdict
[
'act'
]
if
act
==
'grid'
:
rows
=
DBSession
.
query
(
Eis
)
.
filter
(
Eis
.
id
==
id
)
rows
=
DBSession
.
query
(
Eis
)
.
filter
(
Eis
.
id
==
id
)
if
not
rows
:
return
json_data
elif
act
==
'pbb'
:
resp
=
self
.
get_pbb_data
()
resp
=
self
.
get_pbb_data
()
elif
act
==
'bphtb'
:
resp
=
self
.
get_bphtb_data
()
resp
=
self
.
get_bphtb_data
()
elif
act
==
'webr'
:
resp
=
self
.
get_webr_data
()
resp
=
self
.
get_webr_data
()
elif
act
==
'pajak'
:
resp
=
self
.
get_pajak_data
()
resp
=
self
.
get_pajak_data
()
else
:
resp
=
self
.
get_pad_data
(
act
)
resp
[
"time"
]
=
datetime
.
now
()
.
strftime
(
"
%
Y-
%
m-
%
d
%
H:
%
M:
%
S"
)
resp
=
self
.
get_pad_data
(
act
)
resp
[
"time"
]
=
datetime
.
now
()
.
strftime
(
"
%
Y-
%
m-
%
d
%
H:
%
M:
%
S"
)
return
resp
def
view_pajak
(
self
):
...
...
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