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 3182dbef
authored
Nov 29, 2021
by
miftahudin
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
update dashboard
1 parent
f2205b32
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
8 deletions
esipkd/views/__init__.py
esipkd/views/__init__.py
View file @
3182dbe
...
@@ -12,7 +12,7 @@ from sqlalchemy import func, and_, case
...
@@ -12,7 +12,7 @@ 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
,
Anggaran
ARSspd
,
ARInvoice
,
Unit
,
Rekening
,
Anggaran
,
AnggaranOPD
)
)
from
pyramid.view
import
notfound_view_config
from
pyramid.view
import
notfound_view_config
import
logging
import
logging
...
@@ -192,17 +192,18 @@ def view_home(request):
...
@@ -192,17 +192,18 @@ def view_home(request):
# .all()
# .all()
invoices
=
DBSession
.
query
(
invoices
=
DBSession
.
query
(
case
([
case
([
(
Anggaran
.
perubahan
>
0
,
(
Anggaran
OPD
.
perubahan
>
0
,
func
.
coalesce
(
Anggaran
.
perubahan
,
0
))
func
.
coalesce
(
Anggaran
OPD
.
perubahan
,
0
))
],
],
else_
=
func
.
coalesce
(
Anggaran
.
murni
,
0
))
.
label
(
'jumlah'
),
else_
=
func
.
coalesce
(
Anggaran
OPD
.
murni
,
0
))
.
label
(
'jumlah'
),
func
.
trim
(
Rekening
.
kode
)
.
label
(
'rek_kode'
),
func
.
trim
(
Rekening
.
kode
)
.
label
(
'rek_kode'
),
Anggaran
.
kode
.
label
(
'kode'
),
Anggaran
OPD
.
kode
.
label
(
'kode'
),
Anggaran
.
nama
.
label
(
'nama'
),
Anggaran
OPD
.
nama
.
label
(
'nama'
),
)
.
join
(
Rekening
,
Rekening
.
id
==
Anggaran
.
rekening_id
)
.
\
)
.
join
(
Rekening
,
Rekening
.
id
==
Anggaran
OPD
.
rekening_id
)
.
\
filter
(
Anggaran
.
tahun
==
dates
[
'year'
])
.
order_by
(
Anggaran
.
kode
)
\
filter
(
Anggaran
OPD
.
tahun
==
dates
[
'year'
])
.
order_by
(
AnggaranOPD
.
kode
)
\
.
all
()
.
all
()
for
i
in
invoices
:
for
i
in
invoices
:
# print(">>>>i", i)
## JIKA ADA FILTER DEPARTEMEN DI HEADER
## JIKA ADA FILTER DEPARTEMEN DI HEADER
if
'unit'
in
request
.
params
and
request
.
params
[
'unit'
]:
if
'unit'
in
request
.
params
and
request
.
params
[
'unit'
]:
if
i
.
kode
.
strip
()
.
startswith
(
request
.
params
[
'unit'
]
.
strip
()):
if
i
.
kode
.
strip
()
.
startswith
(
request
.
params
[
'unit'
]
.
strip
()):
...
@@ -244,6 +245,7 @@ def view_home(request):
...
@@ -244,6 +245,7 @@ def view_home(request):
data_dashboard
[
'sopd'
]
=
sorted
(
data_dashboard
[
'sopd'
],
key
=
lambda
i
:
(
i
[
'realisasi'
]),
reverse
=
True
)
data_dashboard
[
'sopd'
]
=
sorted
(
data_dashboard
[
'sopd'
],
key
=
lambda
i
:
(
i
[
'realisasi'
]),
reverse
=
True
)
i
=-
1
i
=-
1
for
opd
in
data_dashboard
[
'sopd'
]:
for
opd
in
data_dashboard
[
'sopd'
]:
# print(">>>>opd", opd)
i
+=
1
i
+=
1
if
i
<
10
:
if
i
<
10
:
data_dashboard
[
'sopd10'
]
.
append
(
dict
(
data_dashboard
[
'sopd10'
]
.
append
(
dict
(
...
...
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