Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Taufik Yulianto
/
esipkd
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit edd7d1c0
authored
May 05, 2021
by
taufikyu
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
update target ambil dari anggaran
1 parent
e5c81f6b
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
123 additions
and
53 deletions
esipkd/tools.py
esipkd/views/__init__.py
esipkd/views/chart_detail.py
esipkd/views/ranking_opd.py
esipkd/views/rekening_detail.py
esipkd/tools.py
View file @
edd7d1c
...
@@ -702,4 +702,11 @@ def int_to_roman(num):
...
@@ -702,4 +702,11 @@ def int_to_roman(num):
roman_num
+=
syb
[
i
]
roman_num
+=
syb
[
i
]
num
-=
val
[
i
]
num
-=
val
[
i
]
i
+=
1
i
+=
1
return
roman_num
\ No newline at end of file
\ No newline at end of file
return
roman_num
def
round_up
(
value
):
if
isinstance
(
value
,
str
):
value
=
float
(
int
(
value
))
if
isinstance
(
value
,
int
):
value
=
float
(
value
)
return
int
(
round
(
value
+
0.4999
))
\ No newline at end of file
\ No newline at end of file
esipkd/views/__init__.py
View file @
edd7d1c
...
@@ -7,12 +7,12 @@ from pyramid.view import view_config
...
@@ -7,12 +7,12 @@ from pyramid.view import view_config
from
pyramid.httpexceptions
import
(
HTTPFound
,
HTTPForbidden
,
HTTPNotFound
)
from
pyramid.httpexceptions
import
(
HTTPFound
,
HTTPForbidden
,
HTTPNotFound
)
from
pyramid.security
import
(
remember
,
forget
,
authenticated_userid
,)
from
pyramid.security
import
(
remember
,
forget
,
authenticated_userid
,)
from
deform
import
(
Form
,
ValidationFailure
,
widget
,)
from
deform
import
(
Form
,
ValidationFailure
,
widget
,)
from
..tools
import
dmy
,
date_from_str
,
int_to_roman
from
..tools
import
dmy
,
date_from_str
,
int_to_roman
,
round_up
from
sqlalchemy
import
func
,
and_
from
sqlalchemy
import
func
,
and_
,
case
from
..models
import
(
DBSession
,
User
,)
from
..models
import
(
DBSession
,
User
,)
from
..models.isipkd
import
(
from
..models.isipkd
import
(
ARSspd
,
ARInvoice
,
Unit
,
Rekening
ARSspd
,
ARInvoice
,
Unit
,
Rekening
,
Anggaran
)
)
from
pyramid.view
import
notfound_view_config
from
pyramid.view
import
notfound_view_config
import
logging
import
logging
...
@@ -181,14 +181,26 @@ def view_home(request):
...
@@ -181,14 +181,26 @@ def view_home(request):
unit3
[
'realisasi'
]
+=
p
.
jumlah
unit3
[
'realisasi'
]
+=
p
.
jumlah
#QUERY INVOICE
#QUERY INVOICE
# invoices = DBSession.query(
# ARInvoice.tgl_tetap.label('tanggal'),
# ARInvoice.jumlah.label('jumlah'),
# ARInvoice.rek_kode.label('rek_kode'),
# Unit.kode.label('kode'),
# Unit.nama.label('nama'),
# ).join(Unit, func.trim(Unit.kode) == func.trim(ARInvoice.unit_kode)).\
# filter(ARInvoice.tahun_id==dates['year']).order_by(ARInvoice.unit_kode)\
# .all()
invoices
=
DBSession
.
query
(
invoices
=
DBSession
.
query
(
ARInvoice
.
tgl_tetap
.
label
(
'tanggal'
),
case
([
ARInvoice
.
jumlah
.
label
(
'jumlah'
),
(
Anggaran
.
perubahan
>
0
,
ARInvoice
.
rek_kode
.
label
(
'rek_kode'
),
func
.
coalesce
(
Anggaran
.
perubahan
,
0
))
Unit
.
kode
.
label
(
'kode'
),
],
Unit
.
nama
.
label
(
'nama'
),
else_
=
func
.
coalesce
(
Anggaran
.
murni
,
0
))
.
label
(
'jumlah'
),
)
.
join
(
Unit
,
func
.
trim
(
Unit
.
kode
)
==
func
.
trim
(
ARInvoice
.
unit_kode
))
.
\
func
.
trim
(
Rekening
.
kode
)
.
label
(
'rek_kode'
),
filter
(
ARInvoice
.
tahun_id
==
dates
[
'year'
])
.
order_by
(
ARInvoice
.
unit_kode
)
\
Anggaran
.
kode
.
label
(
'kode'
),
Anggaran
.
nama
.
label
(
'nama'
),
)
.
join
(
Rekening
,
Rekening
.
id
==
Anggaran
.
rekening_id
)
.
\
filter
(
Anggaran
.
tahun
==
dates
[
'year'
])
.
order_by
(
Anggaran
.
kode
)
\
.
all
()
.
all
()
for
i
in
invoices
:
for
i
in
invoices
:
## JIKA ADA FILTER DEPARTEMEN DI HEADER
## JIKA ADA FILTER DEPARTEMEN DI HEADER
...
@@ -200,8 +212,9 @@ def view_home(request):
...
@@ -200,8 +212,9 @@ def view_home(request):
r
[
'target'
]
+=
int
(
i
.
jumlah
)
r
[
'target'
]
+=
int
(
i
.
jumlah
)
## chart target
## chart target
for
x
in
range
(
12
):
for
x
in
range
(
12
):
if
i
.
tanggal
.
month
==
x
+
1
:
# if i.tanggal.month == x+1:
data_dashboard
[
'chart'
][
't'
][
x
]
+=
int
(
i
.
jumlah
)
# data_dashboard['chart']['t'][x] += int(i.jumlah)
data_dashboard
[
'chart'
][
't'
][
x
]
+=
round_up
(
i
.
jumlah
/
12
)
## JIKA TIDAK ADA FILTER DEPARTEMEN HEADER
## JIKA TIDAK ADA FILTER DEPARTEMEN HEADER
elif
not
'unit'
in
request
.
params
or
not
request
.
params
[
'unit'
]:
elif
not
'unit'
in
request
.
params
or
not
request
.
params
[
'unit'
]:
## REKENING
## REKENING
...
@@ -210,8 +223,9 @@ def view_home(request):
...
@@ -210,8 +223,9 @@ def view_home(request):
r
[
'target'
]
+=
int
(
i
.
jumlah
)
r
[
'target'
]
+=
int
(
i
.
jumlah
)
## chart target
## chart target
for
x
in
range
(
12
):
for
x
in
range
(
12
):
if
i
.
tanggal
.
month
==
x
+
1
:
# if i.tanggal.month == x+1:
data_dashboard
[
'chart'
][
't'
][
x
]
+=
int
(
i
.
jumlah
)
# data_dashboard['chart']['t'][x] += int(i.jumlah)
data_dashboard
[
'chart'
][
't'
][
x
]
+=
round_up
(
i
.
jumlah
/
12
)
#RANKING Target
#RANKING Target
for
unit3
in
data_dashboard
[
'sopd'
]:
for
unit3
in
data_dashboard
[
'sopd'
]:
if
i
.
kode
.
strip
()
.
startswith
(
unit3
[
'kode'
]):
if
i
.
kode
.
strip
()
.
startswith
(
unit3
[
'kode'
]):
...
...
esipkd/views/chart_detail.py
View file @
edd7d1c
...
@@ -5,7 +5,7 @@ import os
...
@@ -5,7 +5,7 @@ import os
import
qrcode
import
qrcode
import
base64
import
base64
from
email.utils
import
parseaddr
from
email.utils
import
parseaddr
from
sqlalchemy
import
not_
,
func
,
or_
,
desc
from
sqlalchemy
import
not_
,
func
,
or_
,
desc
,
case
from
datetime
import
datetime
from
datetime
import
datetime
from
time
import
gmtime
,
strftime
,
strptime
from
time
import
gmtime
,
strftime
,
strptime
from
pyramid.view
import
(
from
pyramid.view
import
(
...
@@ -28,13 +28,14 @@ from ..tools import (
...
@@ -28,13 +28,14 @@ from ..tools import (
thousand
,
thousand
,
dmy
,
dmy
,
BULANS
,
BULANS
,
get_settings
get_settings
,
round_up
,
)
)
from
..models
import
DBSession
from
..models
import
DBSession
from
..models.isipkd
import
(
from
..models.isipkd
import
(
Pegawai
,
ObjekPajak
,
SubjekPajak
,
ARInvoice
,
Pegawai
,
ObjekPajak
,
SubjekPajak
,
ARInvoice
,
Unit
,
UserUnit
,
Wilayah
,
Pajak
,
Rekening
,
Unit
,
UserUnit
,
Wilayah
,
Pajak
,
Rekening
,
ARSts
,
ARStsItem
,
ARSspd
,
ARTbp
ARSts
,
ARStsItem
,
ARSspd
,
ARTbp
,
Anggaran
)
)
from
datatables
import
(
from
datatables
import
(
...
@@ -100,23 +101,35 @@ def view_detail(request):
...
@@ -100,23 +101,35 @@ def view_detail(request):
if
p
.
tanggal
.
month
==
x
+
1
:
if
p
.
tanggal
.
month
==
x
+
1
:
re
[
'realisasi'
][
x
]
+=
int
(
p
.
jumlah
)
re
[
'realisasi'
][
x
]
+=
int
(
p
.
jumlah
)
# invoices = DBSession.query(
# ARInvoice.tgl_tetap.label('tanggal'),
# ARInvoice.jumlah.label('jumlah'),
# ARInvoice.rek_kode.label('rek_kode'),
# Unit.kode.label('kode'),
# Unit.nama.label('nama'),
# ).join(Unit, func.trim(Unit.kode) == func.trim(ARInvoice.unit_kode)).\
# filter(ARInvoice.tahun_id==params['year']).order_by(ARInvoice.unit_kode)\
# .all()
invoices
=
DBSession
.
query
(
invoices
=
DBSession
.
query
(
ARInvoice
.
tgl_tetap
.
label
(
'tanggal'
),
case
([
ARInvoice
.
jumlah
.
label
(
'jumlah'
),
(
Anggaran
.
perubahan
>
0
,
ARInvoice
.
rek_kode
.
label
(
'rek_kode'
),
func
.
coalesce
(
Anggaran
.
perubahan
,
0
))
Unit
.
kode
.
label
(
'kode'
),
],
Unit
.
nama
.
label
(
'nama'
),
else_
=
func
.
coalesce
(
Anggaran
.
murni
,
0
))
.
label
(
'jumlah'
),
)
.
join
(
Unit
,
func
.
trim
(
Unit
.
kode
)
==
func
.
trim
(
ARInvoice
.
unit_kode
))
.
\
func
.
trim
(
Rekening
.
kode
)
.
label
(
'rek_kode'
),
filter
(
ARInvoice
.
tahun_id
==
params
[
'year'
])
.
order_by
(
ARInvoice
.
unit_kode
)
\
Anggaran
.
kode
.
label
(
'kode'
),
Anggaran
.
nama
.
label
(
'nama'
),
)
.
join
(
Rekening
,
Rekening
.
id
==
Anggaran
.
rekening_id
)
.
\
filter
(
Anggaran
.
tahun
==
params
[
'year'
])
.
order_by
(
Anggaran
.
kode
)
\
.
all
()
.
all
()
for
i
in
invoices
:
for
i
in
invoices
:
for
re
in
reks
:
for
re
in
reks
:
if
i
.
rek_kode
.
strip
()
.
startswith
(
re
[
'kode'
]):
if
i
.
rek_kode
.
strip
()
.
startswith
(
re
[
'kode'
]):
## chart target
## chart target
for
x
in
range
(
12
):
for
x
in
range
(
12
):
if
i
.
tanggal
.
month
==
x
+
1
:
#
if i.tanggal.month == x+1:
re
[
'target'
][
x
]
+=
int
(
p
.
jumlah
)
#
re['target'][x] += int(p.jumlah)
re
[
'target'
][
x
]
+=
round_up
(
i
.
jumlah
/
12
)
##Hitung persen
##Hitung persen
for
re
in
reks
:
for
re
in
reks
:
for
x
in
range
(
12
):
for
x
in
range
(
12
):
...
...
esipkd/views/ranking_opd.py
View file @
edd7d1c
...
@@ -8,11 +8,11 @@ from pyramid.httpexceptions import (HTTPFound, HTTPForbidden, HTTPNotFound)
...
@@ -8,11 +8,11 @@ from pyramid.httpexceptions import (HTTPFound, HTTPForbidden, HTTPNotFound)
from
pyramid.security
import
(
remember
,
forget
,
authenticated_userid
,)
from
pyramid.security
import
(
remember
,
forget
,
authenticated_userid
,)
from
deform
import
(
Form
,
ValidationFailure
,
widget
,)
from
deform
import
(
Form
,
ValidationFailure
,
widget
,)
from
..tools
import
dmy
,
date_from_str
,
int_to_roman
from
..tools
import
dmy
,
date_from_str
,
int_to_roman
from
sqlalchemy
import
func
,
and_
from
sqlalchemy
import
func
,
and_
,
case
from
..models
import
(
DBSession
,
User
,)
from
..models
import
(
DBSession
,
User
,)
from
..models.isipkd
import
(
from
..models.isipkd
import
(
ARSspd
,
ARInvoice
,
Unit
,
Rekening
ARSspd
,
ARInvoice
,
Unit
,
Rekening
,
Anggaran
)
)
from
pyramid.view
import
notfound_view_config
from
pyramid.view
import
notfound_view_config
import
logging
import
logging
...
@@ -78,14 +78,26 @@ def view_rank(request):
...
@@ -78,14 +78,26 @@ def view_rank(request):
if
sopd
.
kode
.
startswith
(
unit4
[
'kode'
]):
if
sopd
.
kode
.
startswith
(
unit4
[
'kode'
]):
unit4
[
'nominal'
]
+=
sopd
.
jumlah
unit4
[
'nominal'
]
+=
sopd
.
jumlah
#QUERY INVOICE
#QUERY INVOICE
# invoices = DBSession.query(
# ARInvoice.tgl_tetap.label('tanggal'),
# ARInvoice.jumlah.label('jumlah'),
# ARInvoice.rek_kode.label('rek_kode'),
# Unit.kode.label('kode'),
# Unit.nama.label('nama'),
# ).join(Unit, func.trim(Unit.kode) == func.trim(ARInvoice.unit_kode)).\
# filter(ARInvoice.tahun_id==dates['year']).order_by(ARInvoice.unit_kode)\
# .all()
invoices
=
DBSession
.
query
(
invoices
=
DBSession
.
query
(
ARInvoice
.
tgl_tetap
.
label
(
'tanggal'
),
case
([
ARInvoice
.
jumlah
.
label
(
'jumlah'
),
(
Anggaran
.
perubahan
>
0
,
ARInvoice
.
rek_kode
.
label
(
'rek_kode'
),
func
.
coalesce
(
Anggaran
.
perubahan
,
0
))
Unit
.
kode
.
label
(
'kode'
),
],
Unit
.
nama
.
label
(
'nama'
),
else_
=
func
.
coalesce
(
Anggaran
.
murni
,
0
))
.
label
(
'jumlah'
),
)
.
join
(
Unit
,
func
.
trim
(
Unit
.
kode
)
==
func
.
trim
(
ARInvoice
.
unit_kode
))
.
\
func
.
trim
(
Rekening
.
kode
)
.
label
(
'rek_kode'
),
filter
(
ARInvoice
.
tahun_id
==
dates
[
'year'
])
.
order_by
(
ARInvoice
.
unit_kode
)
\
Anggaran
.
kode
.
label
(
'kode'
),
Anggaran
.
nama
.
label
(
'nama'
),
)
.
join
(
Rekening
,
Rekening
.
id
==
Anggaran
.
rekening_id
)
.
\
filter
(
Anggaran
.
tahun
==
dates
[
'year'
])
.
order_by
(
Anggaran
.
kode
)
\
.
all
()
.
all
()
for
i
in
invoices
:
for
i
in
invoices
:
#RANKING Target
#RANKING Target
...
@@ -164,14 +176,26 @@ def view_det(request):
...
@@ -164,14 +176,26 @@ def view_det(request):
if
sopd
.
kode
.
startswith
(
unit4
[
'kode'
]):
if
sopd
.
kode
.
startswith
(
unit4
[
'kode'
]):
unit4
[
'nominal'
]
+=
sopd
.
jumlah
unit4
[
'nominal'
]
+=
sopd
.
jumlah
#QUERY INVOICE
#QUERY INVOICE
# invoices = DBSession.query(
# ARInvoice.tgl_tetap.label('tanggal'),
# ARInvoice.jumlah.label('jumlah'),
# ARInvoice.rek_kode.label('rek_kode'),
# Unit.kode.label('kode'),
# Unit.nama.label('nama'),
# ).join(Unit, func.trim(Unit.kode) == func.trim(ARInvoice.unit_kode)).\
# filter(ARInvoice.tahun_id==dates['year']).order_by(ARInvoice.unit_kode)\
# .all()
invoices
=
DBSession
.
query
(
invoices
=
DBSession
.
query
(
ARInvoice
.
tgl_tetap
.
label
(
'tanggal'
),
case
([
ARInvoice
.
jumlah
.
label
(
'jumlah'
),
(
Anggaran
.
perubahan
>
0
,
ARInvoice
.
rek_kode
.
label
(
'rek_kode'
),
func
.
coalesce
(
Anggaran
.
perubahan
,
0
))
Unit
.
kode
.
label
(
'kode'
),
],
Unit
.
nama
.
label
(
'nama'
),
else_
=
func
.
coalesce
(
Anggaran
.
murni
,
0
))
.
label
(
'jumlah'
),
)
.
join
(
Unit
,
func
.
trim
(
Unit
.
kode
)
==
func
.
trim
(
ARInvoice
.
unit_kode
))
.
\
func
.
trim
(
Rekening
.
kode
)
.
label
(
'rek_kode'
),
filter
(
ARInvoice
.
tahun_id
==
dates
[
'year'
])
.
order_by
(
ARInvoice
.
unit_kode
)
\
Anggaran
.
kode
.
label
(
'kode'
),
Anggaran
.
nama
.
label
(
'nama'
),
)
.
join
(
Rekening
,
Rekening
.
id
==
Anggaran
.
rekening_id
)
.
\
filter
(
Anggaran
.
tahun
==
dates
[
'year'
])
.
order_by
(
Anggaran
.
kode
)
\
.
all
()
.
all
()
for
i
in
invoices
:
for
i
in
invoices
:
#RANKING Target
#RANKING Target
...
...
esipkd/views/rekening_detail.py
View file @
edd7d1c
...
@@ -5,7 +5,7 @@ import os
...
@@ -5,7 +5,7 @@ import os
import
qrcode
import
qrcode
import
base64
import
base64
from
email.utils
import
parseaddr
from
email.utils
import
parseaddr
from
sqlalchemy
import
not_
,
func
,
or_
,
desc
from
sqlalchemy
import
not_
,
func
,
or_
,
desc
,
case
from
datetime
import
datetime
from
datetime
import
datetime
from
time
import
gmtime
,
strftime
,
strptime
from
time
import
gmtime
,
strftime
,
strptime
from
pyramid.view
import
(
from
pyramid.view
import
(
...
@@ -34,7 +34,7 @@ from ..models import DBSession
...
@@ -34,7 +34,7 @@ from ..models import DBSession
from
..models.isipkd
import
(
from
..models.isipkd
import
(
Pegawai
,
ObjekPajak
,
SubjekPajak
,
ARInvoice
,
Pegawai
,
ObjekPajak
,
SubjekPajak
,
ARInvoice
,
Unit
,
UserUnit
,
Wilayah
,
Pajak
,
Rekening
,
Unit
,
UserUnit
,
Wilayah
,
Pajak
,
Rekening
,
ARSts
,
ARStsItem
,
ARSspd
,
ARTbp
ARSts
,
ARStsItem
,
ARSspd
,
ARTbp
,
Anggaran
)
)
from
datatables
import
(
from
datatables
import
(
...
@@ -110,14 +110,26 @@ def view_detail(request):
...
@@ -110,14 +110,26 @@ def view_detail(request):
if
p
.
rek_kode
.
strip
()
.
startswith
(
r
[
'kode'
]):
if
p
.
rek_kode
.
strip
()
.
startswith
(
r
[
'kode'
]):
r
[
'realisasi'
]
+=
int
(
p
.
jumlah
)
r
[
'realisasi'
]
+=
int
(
p
.
jumlah
)
# invoices = DBSession.query(
# ARInvoice.tgl_tetap.label('tanggal'),
# ARInvoice.jumlah.label('jumlah'),
# ARInvoice.rek_kode.label('rek_kode'),
# Unit.kode.label('kode'),
# Unit.nama.label('nama'),
# ).join(Unit, func.trim(Unit.kode) == func.trim(ARInvoice.unit_kode)).\
# filter(ARInvoice.tahun_id==params['year']).order_by(ARInvoice.unit_kode)
invoices
=
DBSession
.
query
(
invoices
=
DBSession
.
query
(
ARInvoice
.
tgl_tetap
.
label
(
'tanggal'
),
case
([
ARInvoice
.
jumlah
.
label
(
'jumlah'
),
(
Anggaran
.
perubahan
>
0
,
ARInvoice
.
rek_kode
.
label
(
'rek_kode'
),
func
.
coalesce
(
Anggaran
.
perubahan
,
0
))
Unit
.
kode
.
label
(
'kode'
),
],
Unit
.
nama
.
label
(
'nama'
),
else_
=
func
.
coalesce
(
Anggaran
.
murni
,
0
))
.
label
(
'jumlah'
),
)
.
join
(
Unit
,
func
.
trim
(
Unit
.
kode
)
==
func
.
trim
(
ARInvoice
.
unit_kode
))
.
\
func
.
trim
(
Rekening
.
kode
)
.
label
(
'rek_kode'
),
filter
(
ARInvoice
.
tahun_id
==
params
[
'year'
])
.
order_by
(
ARInvoice
.
unit_kode
)
Anggaran
.
kode
.
label
(
'kode'
),
Anggaran
.
nama
.
label
(
'nama'
),
)
.
join
(
Rekening
,
Rekening
.
id
==
Anggaran
.
rekening_id
)
.
\
filter
(
Anggaran
.
tahun
==
params
[
'year'
])
.
order_by
(
Anggaran
.
kode
)
\
.
all
()
invoices
=
invoices
.
all
()
invoices
=
invoices
.
all
()
for
i
in
invoices
:
for
i
in
invoices
:
## JIKA ADA FILTER DEPARTEMEN
## JIKA ADA FILTER DEPARTEMEN
...
...
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