Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Project
/
eis
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
1
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 5ed4b7a0
authored
Nov 15, 2022
by
taufikyu
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge branch 'eis-tasik' of
http://git.opensipkd.com/project/eis
into eis-tasik
2 parents
5454bda1
7ac5538d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
14 deletions
models/eis.py
views/eis.py
models/eis.py
View file @
5ed4b7a
...
@@ -21,7 +21,7 @@ from sqlalchemy.orm import (
...
@@ -21,7 +21,7 @@ from sqlalchemy.orm import (
from
..models
import
(
EisDBSession
,
DefaultModel
,
EisBase
,
NamaModel
,
TABLE_ARGS
)
from
..models
import
(
EisDBSession
,
DefaultModel
,
EisBase
,
NamaModel
,
TABLE_ARGS
)
class
Eis
(
EisBase
,
NamaModel
):
class
Eis
(
EisBase
,
NamaModel
):
__tablename__
=
'
harian
'
__tablename__
=
'
wells
'
tahun
=
Column
(
Integer
)
tahun
=
Column
(
Integer
)
amt_tahun
=
Column
(
BigInteger
)
amt_tahun
=
Column
(
BigInteger
)
amt_bulan
=
Column
(
BigInteger
)
amt_bulan
=
Column
(
BigInteger
)
...
...
views/eis.py
View file @
5ed4b7a
...
@@ -9,7 +9,7 @@ from ..views import BaseView
...
@@ -9,7 +9,7 @@ from ..views import BaseView
from
..models
import
EisDBSession
from
..models
import
EisDBSession
from
..models.eis
import
Eis
,
Chart
,
ChartItem
,
Slide
from
..models.eis
import
Eis
,
Chart
,
ChartItem
,
Slide
from
datatables
import
ColumnDT
,
DataTables
from
datatables
import
ColumnDT
,
DataTables
from
sqlalchemy
import
not_
,
func
,
literal_column
,
and_
,
or_
,
String
from
sqlalchemy
import
not_
,
func
,
literal_column
,
and_
,
or_
,
String
,
Float
from
sqlalchemy.sql.expression
import
cast
from
sqlalchemy.sql.expression
import
cast
#from ..tools import row2dict
#from ..tools import row2dict
########
########
...
@@ -111,20 +111,38 @@ class eis(BaseView):
...
@@ -111,20 +111,38 @@ class eis(BaseView):
elif
req
.
matchdict
[
'act'
]
==
'dasboard'
:
elif
req
.
matchdict
[
'act'
]
==
'dasboard'
:
max_tahun
=
EisDBSession
.
query
(
func
.
max
(
Eis
.
tahun
))
.
scalar
()
subq
=
EisDBSession
.
query
(
func
.
max
(
Eis
.
nama
)
.
label
(
'nama'
),
func
.
sum
(
ChartItem
.
value_1
+
ChartItem
.
value_2
+
ChartItem
.
value_3
+
ChartItem
.
value_4
+
\
ChartItem
.
value_5
+
ChartItem
.
value_6
+
ChartItem
.
value_7
+
ChartItem
.
value_8
+
ChartItem
.
value_9
+
\
ChartItem
.
value10
+
ChartItem
.
value11
+
ChartItem
.
value12
)
.
label
(
'target'
),
func
.
sum
(
Eis
.
amt_bulan
)
.
label
(
'amt_bulan'
),
func
.
sum
(
Eis
.
amt_tahun
)
.
label
(
'amt_tahun'
),
func
.
sum
(
(
ChartItem
.
value_1
+
ChartItem
.
value_2
+
ChartItem
.
value_3
+
ChartItem
.
value_4
+
ChartItem
.
value_5
+
\
ChartItem
.
value_6
+
ChartItem
.
value_7
+
ChartItem
.
value_8
+
ChartItem
.
value_9
+
ChartItem
.
value10
+
\
ChartItem
.
value11
+
ChartItem
.
value12
)
-
Eis
.
amt_tahun
)
.
label
(
'sisa_target'
),
cast
((
func
.
sum
(
(
ChartItem
.
value_1
+
ChartItem
.
value_2
+
ChartItem
.
value_3
+
ChartItem
.
value_4
+
ChartItem
.
value_5
+
\
ChartItem
.
value_6
+
ChartItem
.
value_7
+
ChartItem
.
value_8
+
ChartItem
.
value_9
+
ChartItem
.
value10
+
\
ChartItem
.
value11
+
ChartItem
.
value12
)
-
Eis
.
amt_tahun
)
/
func
.
sum
(
ChartItem
.
value_1
+
ChartItem
.
value_2
+
ChartItem
.
value_3
+
ChartItem
.
value_4
+
\
ChartItem
.
value_5
+
ChartItem
.
value_6
+
ChartItem
.
value_7
+
ChartItem
.
value_8
+
ChartItem
.
value_9
+
\
ChartItem
.
value10
+
ChartItem
.
value11
+
ChartItem
.
value12
))
*
100
,
Float
)
.
label
(
'persen'
))
.
\
join
(
ChartItem
,
func
.
trim
(
ChartItem
.
rekening_kd
)
==
func
.
trim
(
Eis
.
kode
))
.
\
join
(
Chart
,
Chart
.
id
==
ChartItem
.
chart_id
)
.
\
filter
(
Eis
.
tahun
==
max_tahun
,
Chart
.
chart_type
==
'line'
)
.
\
group_by
(
Eis
.
kode
,
Eis
.
nama
)
.
order_by
(
Eis
.
kode
)
.
subquery
()
query
=
EisDBSession
.
query
()
.
select_from
(
subq
)
columns
=
[
columns
=
[
ColumnDT
(
Eis
.
nama
,
mData
=
"jenis_pajak"
),
ColumnDT
(
subq
.
c
.
nama
,
mData
=
"jenis_pajak"
),
ColumnDT
(
literal_column
(
"'0'"
)
,
mData
=
"target"
),
ColumnDT
(
subq
.
c
.
target
,
mData
=
"target"
),
ColumnDT
(
Eis
.
amt_bulan
,
mData
=
"realisasi_bulan_ini"
),
ColumnDT
(
subq
.
c
.
amt_bulan
,
mData
=
"realisasi_bulan_ini"
),
ColumnDT
(
Eis
.
amt_tahun
,
mData
=
"realisasi_sampai_dengan"
),
ColumnDT
(
subq
.
c
.
amt_tahun
,
mData
=
"realisasi_sampai_dengan"
),
ColumnDT
(
Eis
.
amt_tahun
,
mData
=
"sisa_target"
),
ColumnDT
(
subq
.
c
.
sisa_target
,
mData
=
"sisa_target"
),
ColumnDT
(
(
Eis
.
amt_bulan
/
Eis
.
amt_tahun
)
*
100
,
mData
=
"persen"
),
ColumnDT
(
str
(
round
(
subq
.
c
.
persen
,
2
))
,
mData
=
"persen"
),
]
]
max_tahun
=
EisDBSession
.
query
(
func
.
max
(
Eis
.
tahun
))
.
scalar
()
query
=
EisDBSession
.
query
()
.
select_from
(
Eis
)
.
\
outerjoin
(
Slide
,
Slide
.
source_id
==
cast
(
Eis
.
id
,
String
))
.
\
outerjoin
(
ChartItem
,
and_
(
cast
(
ChartItem
.
id
,
String
)
==
Slide
.
source_id
,
Slide
.
id
==
Slide
.
id
+
1
))
.
\
filter
(
Eis
.
tahun
==
max_tahun
,
Eis
.
nama
!=
'PAJAK DAERAH'
)
.
order_by
(
Eis
.
order_id
)
rowTable
=
DataTables
(
req
.
GET
,
query
,
columns
)
rowTable
=
DataTables
(
req
.
GET
,
query
,
columns
)
return
rowTable
.
output_result
()
return
rowTable
.
output_result
()
...
...
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