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 eb1ab40d
authored
Aug 25, 2017
by
aa.gusti
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
import-opd
1 parent
c36625b1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
5 deletions
import-sipkd-master.py
models_eis.py
models_sipkd_master.py
import-sipkd-master.py
View file @
eb1ab40
from
models_sipkd_master
import
RekPendapatan
,
RekBelanja
,
RekBiaya
,
SipkdDBSession
,
SipkdBase
from
models_sipkd_master
import
RekPendapatan
,
RekBelanja
,
RekBiaya
,
SipkdDBSession
,
SipkdBase
,
DaftUnit
from
models_eis
import
Rekening
as
EisRekening
,
EisBase
,
EisDBSession
from
models_eis
import
Rekening
as
EisRekening
,
EisBase
,
EisDBSession
,
Opd
from
conf
import
sipkd_url
,
sipkd_url_master
from
conf
import
sipkd_url
,
sipkd_url_master
from
sqlalchemy
import
create_engine
from
sqlalchemy
import
create_engine
...
@@ -32,7 +32,24 @@ def import_rekening(tabel):
...
@@ -32,7 +32,24 @@ def import_rekening(tabel):
EisDBSession
.
flush
()
EisDBSession
.
flush
()
EisDBSession
.
commit
()
EisDBSession
.
commit
()
import_rekening
(
RekPendapatan
)
def
import_opd
():
import_rekening
(
RekBelanja
)
query
=
SipkdDBSession
.
query
(
DaftUnit
)
import_rekening
(
RekBiaya
)
for
row
in
query
.
all
():
row_target
=
EisDBSession
.
query
(
Opd
)
.
\
filter_by
(
tahun
=
tahun
,
kode
=
row
.
kdunit
.
strip
()
)
.
first
()
if
not
row_target
:
row_target
=
Opd
()
row_target
.
tahun
=
tahun
row_target
.
kode
=
row
.
kdunit
.
strip
()
row_target
.
nama
=
row
.
nmunit
.
strip
()
row_target
.
level_id
=
row
.
kdunit
.
strip
()
.
count
(
'.'
)
EisDBSession
.
add
(
row_target
)
EisDBSession
.
flush
()
EisDBSession
.
commit
()
#import_rekening(RekPendapatan)
#import_rekening(RekBelanja)
#import_rekening(RekBiaya)
import_opd
()
models_eis.py
View file @
eb1ab40
...
@@ -101,6 +101,19 @@ class Rekening(NamaModel, EisBase):
...
@@ -101,6 +101,19 @@ class Rekening(NamaModel, EisBase):
#ForeignKeyConstraint(['parent_id'], ForeignKey('rekening.id')),
#ForeignKeyConstraint(['parent_id'], ForeignKey('rekening.id')),
TABLE_ARGS
TABLE_ARGS
)
)
class
Opd
(
NamaModel
,
EisBase
):
__tablename__
=
'sipkd_opd'
tahun
=
Column
(
Integer
)
level_id
=
Column
(
SmallInteger
,
default
=
1
)
parent_id
=
Column
(
Integer
,
ForeignKey
(
'eis.sipkd_rekening.id'
),)
status
=
Column
(
SmallInteger
,
default
=
1
)
defsign
=
Column
(
SmallInteger
,
default
=
1
)
# children = relationship("Rekening",
# backref=backref('parent', remote_side='Rekening.id'))
__table_args__
=
(
UniqueConstraint
(
'kode'
,
'tahun'
,
name
=
'sipkd_opd_uq'
),
TABLE_ARGS
)
EisBase
.
metadata
.
create_all
(
engine
)
EisBase
.
metadata
.
create_all
(
engine
)
\ No newline at end of file
\ No newline at end of file
models_sipkd_master.py
View file @
eb1ab40
...
@@ -52,3 +52,15 @@ class RekBelanja(SipkdBase):
...
@@ -52,3 +52,15 @@ class RekBelanja(SipkdBase):
kdkhusus
=
Column
(
String
(
1
))
kdkhusus
=
Column
(
String
(
1
))
type
=
Column
(
String
(
2
))
type
=
Column
(
String
(
2
))
__table_args__
=
TABLE_ARGS
__table_args__
=
TABLE_ARGS
class
DaftUnit
(
SipkdBase
):
__tablename__
=
'daftunit'
unitkey
=
Column
(
String
(
10
),
primary_key
=
True
)
kdlevel
=
Column
(
String
(
2
))
kdunit
=
Column
(
String
(
30
))
nmunit
=
Column
(
String
(
200
))
akrounit
=
Column
(
String
(
30
))
alamat
=
Column
(
String
(
200
))
telepon
=
Column
(
String
(
20
))
type
=
Column
(
String
(
2
))
__table_args__
=
TABLE_ARGS
\ No newline at end of file
\ No newline at end of file
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