Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Owo Sugiana
/
payment-report
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 d9695e33
authored
Aug 15, 2024
by
Owo Sugiana
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Penerapan timezone pada command line argument
1 parent
b657f5f9
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
49 additions
and
6 deletions
bphtb.ini
contrib/webr_update_deleted_payment.py
pad.ini
payment_report/common.py
payment_report/webr/default.py
webr.ini
bphtb.ini
View file @
d9695e3
...
@@ -5,7 +5,6 @@ db_url = postgresql://user:pass@localhost/db
...
@@ -5,7 +5,6 @@ db_url = postgresql://user:pass@localhost/db
#va_db_url = postgresql://user:pass@localhost/db
#va_db_url = postgresql://user:pass@localhost/db
report_db_url
=
postgresql://user:pass@localhost/db
report_db_url
=
postgresql://user:pass@localhost/db
pid_file
=
/home/sugiana/tmp/bphtb-report.pid
pid_file
=
/home/sugiana/tmp/bphtb-report.pid
log_file
=
/home/sugiana/log/bphtb-report.log
[formatter_generic]
[formatter_generic]
format
=
%(asctime)s %(levelname)s %(name)s %(message)s
format
=
%(asctime)s %(levelname)s %(name)s %(message)s
...
...
contrib/webr_update_deleted_payment.py
0 → 100644
View file @
d9695e3
import
sys
from
argparse
import
ArgumentParser
from
configparser
import
ConfigParser
from
sqlalchemy
import
create_engine
from
sqlalchemy.orm
import
sessionmaker
from
opensipkd.webr.models.default
import
Payment
from
payment_report.models
import
Webr
pars
=
ArgumentParser
()
pars
.
add_argument
(
'conf'
)
option
=
pars
.
parse_args
(
sys
.
argv
[
1
:])
conf
=
ConfigParser
()
conf
.
read
(
option
.
conf
)
cf
=
dict
(
conf
.
items
(
'main'
))
engine_prod
=
create_engine
(
cf
[
'db_url'
])
engine_rpt
=
create_engine
(
cf
[
'report_db_url'
])
factory_prod
=
sessionmaker
(
bind
=
engine_prod
)
factory_rpt
=
sessionmaker
(
bind
=
engine_rpt
)
db_session_prod
=
factory_prod
()
db_session_rpt
=
factory_rpt
()
q_rpt
=
db_session_rpt
.
query
(
Webr
)
q_rpt
=
q_rpt
.
filter
(
Webr
.
id
>=
17739
)
for
rpt
in
q_rpt
.
order_by
(
Webr
.
id
):
q_prod
=
db_session_prod
.
query
(
Payment
)
.
filter_by
(
id
=
rpt
.
id
)
prod
=
q_prod
.
first
()
if
prod
:
continue
print
(
f
'webr.ar_payment.id = {rpt.id} sudah tidak ada'
)
rpt
.
pokok
=
rpt
.
denda
=
rpt
.
jml_bayar
=
0
db_session_rpt
.
add
(
rpt
)
db_session_rpt
.
flush
()
db_session_rpt
.
commit
()
pad.ini
View file @
d9695e3
...
@@ -6,7 +6,6 @@ db_url = postgresql://user:pass@localhost/db
...
@@ -6,7 +6,6 @@ db_url = postgresql://user:pass@localhost/db
#va_db_url = postgresql://user:pass@localhost/db
#va_db_url = postgresql://user:pass@localhost/db
report_db_url
=
postgresql://user:pass@localhost/db
report_db_url
=
postgresql://user:pass@localhost/db
pid_file
=
/home/sugiana/tmp/pad-report.pid
pid_file
=
/home/sugiana/tmp/pad-report.pid
log_file
=
/home/sugiana/log/pad-report.log
[formatter_generic]
[formatter_generic]
format
=
%(asctime)s %(levelname)s %(name)s %(message)s
format
=
%(asctime)s %(levelname)s %(name)s %(message)s
...
...
payment_report/common.py
View file @
d9695e3
...
@@ -22,6 +22,10 @@ from sqlalchemy import (
...
@@ -22,6 +22,10 @@ from sqlalchemy import (
from
sqlalchemy.orm
import
sessionmaker
from
sqlalchemy.orm
import
sessionmaker
import
transaction
import
transaction
from
zope.sqlalchemy
import
register
from
zope.sqlalchemy
import
register
from
opensipkd.waktu
import
(
as_timezone
,
create_now
,
)
from
opensipkd.views.models
import
Conf
as
BaseConf
from
opensipkd.views.models
import
Conf
as
BaseConf
from
opensipkd.iso8583.bjb.scripts.common
import
get_module_object
from
opensipkd.iso8583.bjb.scripts.common
import
get_module_object
from
.models
import
Base
from
.models
import
Base
...
@@ -387,7 +391,11 @@ class BaseApp:
...
@@ -387,7 +391,11 @@ class BaseApp:
if
'tgl_akhir'
in
self
.
conf
:
if
'tgl_akhir'
in
self
.
conf
:
self
.
tgl_akhir
=
self
.
conf
[
'tgl_akhir'
]
self
.
tgl_akhir
=
self
.
conf
[
'tgl_akhir'
]
else
:
else
:
self
.
tgl_akhir
=
date
.
today
()
self
.
tgl_akhir
=
create_now
()
self
.
tgl_awal
=
as_timezone
(
self
.
tgl_awal
)
self
.
tgl_akhir
=
as_timezone
(
self
.
tgl_akhir
)
print
(
self
.
tgl_awal
)
print
(
self
.
tgl_akhir
)
def
run
(
self
):
def
run
(
self
):
self
.
last_pay
=
self
.
last
=
None
self
.
last_pay
=
self
.
last
=
None
...
...
payment_report/webr/default.py
View file @
d9695e3
...
@@ -109,8 +109,8 @@ class App(BaseApp):
...
@@ -109,8 +109,8 @@ class App(BaseApp):
stan
=
iso
and
iso
.
bit_011
or
None
stan
=
iso
and
iso
.
bit_011
or
None
ntb
=
pay
.
ntb
and
pay
.
ntb
.
strip
()
or
None
ntb
=
pay
.
ntb
and
pay
.
ntb
.
strip
()
or
None
return
dict
(
return
dict
(
id
=
pay
.
id
,
stan
=
stan
,
ntb
=
ntb
,
tgl
=
pay
.
created
.
date
(),
id
=
pay
.
id
,
stan
=
stan
,
ntb
=
ntb
,
tgl
=
pay
.
tgl_bayar
.
date
(),
jam
=
pay
.
created
.
time
(),
nomor_bayar
=
self
.
invoice_id
,
jam
=
pay
.
tgl_bayar
.
time
(),
nomor_bayar
=
self
.
invoice_id
,
nama_wp
=
inv
.
subjek_nama
,
pokok
=
inv
.
jumlah
-
inv
.
bunga
,
nama_wp
=
inv
.
subjek_nama
,
pokok
=
inv
.
jumlah
-
inv
.
bunga
,
denda
=
pay
.
bunga
,
jml_bayar
=
pay
.
bayar
,
channel_id
=
channel_id
,
denda
=
pay
.
bunga
,
jml_bayar
=
pay
.
bayar
,
channel_id
=
channel_id
,
channel_name
=
channel_name
,
status
=
pay
.
status
,
channel_name
=
channel_name
,
status
=
pay
.
status
,
...
...
webr.ini
View file @
d9695e3
...
@@ -4,7 +4,6 @@ db_url = postgresql://user:pass@localhost/db
...
@@ -4,7 +4,6 @@ db_url = postgresql://user:pass@localhost/db
#va_db_url = postgresql://user:pass@localhost/db
#va_db_url = postgresql://user:pass@localhost/db
report_db_url
=
postgresql://user:pass@localhost/db
report_db_url
=
postgresql://user:pass@localhost/db
pid_file
=
/home/sugiana/tmp/webr-report.pid
pid_file
=
/home/sugiana/tmp/webr-report.pid
log_file
=
/home/sugiana/log/webr-report.log
[formatter_generic]
[formatter_generic]
format
=
%(asctime)s %(levelname)s %(name)s %(message)s
format
=
%(asctime)s %(levelname)s %(name)s %(message)s
...
...
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