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 cbc8f96a
authored
Jul 11, 2025
by
aa.gustiana@gmail.com
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Refactor payment model and enhance error handling in PCPD view
1 parent
32935e41
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
13 deletions
eispajak/models/payment.py
eispajak/views/pcpd.py
eispajak/models/payment.py
View file @
cbc8f96
from
datetime
import
timedelta
,
datetime
from
pyexpat
import
model
import
sys
from
opensipkd.base.models
import
(
Base
,
CommonModel
,
DefaultModel
,
NamaModel
,
KodeModel
,
TABLE_ARGS
)
from
sqlalchemy
import
(
Column
,
Integer
,
DateTime
,
String
,
Text
,
ForeignKey
,
Float
,
Boolean
,
BigInteger
,
SmallInteger
,
desc
,
asc
,
Date
,
Time
,
from
opensipkd.base
import
models
from
sqlalchemy
import
(
Column
,
Integer
,
DateTime
,
String
,
Float
,
BigInteger
,
SmallInteger
,
Date
,
Time
,
UniqueConstraint
,
func
,
literal_column
)
from
sqlalchemy.ext.declarative
import
declarative_base
from
sqlalchemy
import
engine_from_config
...
...
@@ -20,11 +17,34 @@ from pyramid.paster import (
setup_logging
,
)
from
..tools
import
create_now
PCDBSession
=
scoped_session
(
sessionmaker
())
PCBase
=
declarative_base
()
class
DefaultModel
(
models
.
DefaultModel
):
@classmethod
def
count
(
cls
,
db_session
=
PCDBSession
):
return
super
()
.
count
(
db_session
)
@classmethod
def
query
(
cls
,
db_session
=
PCDBSession
,
filters
=
None
):
return
super
()
.
query
(
db_session
,
filters
)
@classmethod
def
query_from
(
cls
,
columns
=
None
,
filters
=
None
,
db_session
=
PCDBSession
):
return
super
()
.
query_from
(
columns
,
filters
,
db_session
)
@classmethod
def
query_id
(
cls
,
row_id
,
db_session
=
PCDBSession
):
return
super
.
query_id
(
row_id
,
db_session
)
@classmethod
def
delete
(
cls
,
row_id
,
db_session
=
PCDBSession
):
super
()
.
delete
(
row_id
,
db_session
)
@classmethod
def
flush
(
cls
,
row
,
db_session
=
PCDBSession
):
super
()
.
flush
(
row
,
db_session
)
class
PaymentPBB
(
PCBase
,
DefaultModel
):
__tablename__
=
'pbb_report'
...
...
@@ -74,7 +94,7 @@ class PaymentPBB(PCBase, DefaultModel):
# baru dari db BPHTB
class
PaymentBPHTB
(
PCBase
,
CommonModel
):
class
PaymentBPHTB
(
PCBase
,
models
.
CommonModel
):
__tablename__
=
'bphtb_report'
__table_args__
=
{
'schema'
:
'public'
}
id
=
Column
(
Integer
,
primary_key
=
True
)
...
...
@@ -114,7 +134,7 @@ class PaymentBPHTB(PCBase, CommonModel):
# baru PAD
class
PaymentPAD
(
PCBase
,
CommonModel
):
class
PaymentPAD
(
PCBase
,
models
.
CommonModel
):
__tablename__
=
'pad_report'
__table_args__
=
{
'schema'
:
'public'
}
id
=
Column
(
Integer
,
primary_key
=
True
)
...
...
@@ -168,7 +188,7 @@ class PaymentPAD(PCBase, CommonModel):
# baru PAD
class
PaymentWEBR
(
PCBase
,
CommonModel
):
class
PaymentWEBR
(
PCBase
,
models
.
CommonModel
):
__tablename__
=
'webr_report'
__table_args__
=
{
'schema'
:
'public'
}
id
=
Column
(
Integer
,
primary_key
=
True
)
...
...
@@ -208,7 +228,7 @@ class PaymentWEBR(PCBase, CommonModel):
return
qry
class
TargetJNS
(
PCBase
,
CommonModel
):
class
TargetJNS
(
PCBase
,
models
.
CommonModel
):
__tablename__
=
'target_jenis'
__table_args__
=
{
'schema'
:
'public'
}
id
=
Column
(
Integer
,
primary_key
=
True
)
...
...
@@ -244,6 +264,7 @@ class Targets(PCBase, DefaultModel):
m11
=
Column
(
BigInteger
)
m12
=
Column
(
BigInteger
)
status
=
Column
(
SmallInteger
)
@classmethod
def
query_from
(
cls
,
columns
=
None
,
filters
=
None
,
db_session
=
PCDBSession
):
query
=
db_session
.
query
()
.
select_from
(
cls
)
...
...
eispajak/views/pcpd.py
View file @
cbc8f96
...
...
@@ -287,7 +287,11 @@ class Views(BaseView):
week
,
weekTrx
,
weekly
,
weeklyTrx
,
weeklyAcc
,
weeklyAccTrx
=
\
self
.
get_daily_data
(
PembayaranSppt
,
field
,
None
,
filter_exp
)
ytd_target
=
self
.
get_targets
(
"pbb"
)
try
:
ytd_target
=
self
.
get_targets
(
"pbb"
)
except
:
ytd_target
=
0
ytd_persen
=
round
(
ytd
/
ytd_target
*
100
,
2
)
if
ytd_target
>
0
else
0
return
{
"today"
:
amt
,
...
...
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