Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Project
/
import-sipkd-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 03fc12ff
authored
Aug 26, 2017
by
aa.gusti
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
aa.gusti
1 parent
04dcca34
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
3 deletions
proses-harian.py
proses-harian.py
View file @
03fc12f
...
...
@@ -13,12 +13,17 @@ from opensipkd.models import DBSession, Base
from
opensipkd.eis.models
import
Chart
,
ChartItem
from
opensipkd.eis_sipkd.models
import
(
EisSipkdArPayment
as
SipkdArPayment
,
EisSipkdApPayment
as
SipkdApPayment
,)
EisSipkdApPayment
as
SipkdApPayment
,
Harian
as
SipkdHarian
,)
from
datetime
import
datetime
now
=
datetime
.
now
()
tahun
=
now
.
strftime
(
'
%
Y'
)
bulan
=
now
.
strftime
(
'
%
m'
)
hari
=
now
.
strftime
(
'
%
d'
)
tanggal
=
now
.
date
()
print
(
'start'
)
def
process_pie
():
print
(
'PIE'
)
...
...
@@ -79,12 +84,35 @@ def process_barline():
for
i
in
range
(
2
,
13
):
field
=
'value'
+
str
(
i
)
.
rjust
(
2
,
'_'
)
values
[
field
]
=
values
[
field
]
+
values
[
'value'
+
str
(
i
-
1
)
.
rjust
(
2
,
'_'
)]
print
(
'************'
,
chart_item
.
nama
,
chart
.
chart_type
,
values
)
chart_item
.
from_dict
(
values
)
print
(
'************'
,
chart_item
.
to_dict
())
DBSession
.
add
(
chart_item
)
DBSession
.
flush
()
def
process_grid
():
print
(
'HARIAN'
,
tanggal
)
harians
=
DBSession
.
query
(
SipkdHarian
)
.
\
filter_by
(
status
=
1
)
for
harian
in
harians
.
all
():
rekening_kd
=
harian
.
kode
if
rekening_kd
[:
1
]
==
'4'
:
qry
=
DBSession
.
query
(
func
.
sum
(
SipkdArPayment
.
jumlah
))
.
\
filter_by
(
tahun
=
tahun
,
kode
=
rekening_kd
)
qry_kini
=
qry
.
filter
(
func
.
to_char
(
SipkdArPayment
.
tanggal
,
'MM'
)
==
bulan
)
qry_lalu
=
qry
.
filter
(
func
.
to_char
(
SipkdArPayment
.
tanggal
,
'MM'
)
<
bulan
)
elif
rekening_kd
[:
1
]
==
'5'
:
qry
=
DBSession
.
query
(
func
.
sum
(
SipkdApPayment
.
jumlah
))
.
\
filter_by
(
tahun
=
tahun
,
kode
=
rekening_kd
)
qry_kini
=
qry
.
filter
(
func
.
to_char
(
SipkdApPayment
.
tanggal
,
'MM'
)
==
bulan
)
qry_lalu
=
qry
.
filter
(
func
.
to_char
(
SipkdApPayment
.
tanggal
,
'MM'
)
<
bulan
)
harian
.
amt_hari
=
qry
.
filter_by
(
tanggal
=
tanggal
)
.
scalar
()
or
0
harian
.
amt_minggu
=
qry_kini
.
scalar
()
or
0
harian
.
amt_bulan
=
qry_lalu
.
scalar
()
or
0
harian
.
amt_tahun
=
harian
.
amt_minggu
+
harian
.
amt_bulan
DBSession
.
add
(
harian
)
DBSession
.
flush
()
#conf_file = 'conf.py'
#conf_table = None
...
...
@@ -136,6 +164,7 @@ def main(argv=sys.argv):
# initial_data.insert()
process_pie
()
process_barline
()
process_grid
()
transaction
.
commit
()
#call modules script
main
()
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