Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
aa.gusti
/
opensipkd-base
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 2b1eaed2
authored
Jun 14, 2022
by
aagusti
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
google signin
1 parent
a7d72c4a
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
96 additions
and
189 deletions
README.md
README.rst
etc/live_opensipkd.tpl
opensipkd/base/__init__.py
opensipkd/base/scripts/data/new 2
opensipkd/base/scripts/initializedb.py
opensipkd/base/views/user.py
README.md
deleted
100644 → 0
View file @
a7d72c4
# Basis Aplikasi openSIPKD
========================
Ini adalah basis dari seluruh aplikasi openSIPKD.
Pemasangan
----------
Pasang paket Debian yang dibutuhkan::
$ sudo apt-get install libxml2-dev libxslt1-dev libtiff5-dev libjpeg8-dev zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev
Buat Python Virtual Environment, biasanya pada home directory::
$ python3 -m venv ~/env
$ ~/env/bin/pip install --upgrade pip setuptools
Install Production
------------------
$ ~/env/bin/pip install git+https://git.opensipkd.com/aa.gusti/opensipkd-base.git
$ cp ~/env/etc/live_opensipkd.tpl ~/env/etc/live_opensipkd.ini
Install Development::
-------------------
$ source ~/env/bin/activate
$ mkdir apps
$ cd apps
$ git clone https://git.opensipkd.com/bekasi/base.git@ciamis
$ env/bin/pip install -e base
[
dev
]
$ cp ~/env/etc/test_opensipkd.tpl ~/env/etc/test_opensipkd.ini
Sesuaikan konfigurasi
``test_opensipkd.ini``
atau
``live_opensipkd.ini``
pada baris berikut ini::
sqlalchemy.url = postgresql://user:password@localhost:5432/db
session.url = postgresql://user:password@localhost:5432/db
[
alembic_ziggurat
]
sqlalchemy.url = postgresql://user:password@localhost:5432/db
script_location = ziggurat_foundation:migration
[
alembic_base
]
sqlalchemy.url = postgresql://user:password@localhost:5432/db
script_location = opensipkd.base:alembic
Handling Log File:
==================
Logging dapat dilakukan console, file atau tabel
>> Module yang akan di logging
[
loggers
]
keys = root, opensipkd, sqlalchemy
>> output handler gunakan sesuai kebutuhan tidak perlu semuanya
[
handlers
]
keys = console, file, table
>> output handler gunakan INFO pada level kalau sedang testing
[
logger_opensipkd
]
level = WARN
handlers = file, table
qualname = opensipkd
[
handler_table
]
class = opensipkd.base.handlers.SQLAlchemyHandler
args = ()
level = NOTSET #Sebaiknya hanya gunakan NOTSET atau WARN
formatter = generic
[
handler_file
]
class = FileHandler
args = ('/full/path/file.log', 'a')
level = NOTSET #Sebaiknya hanya gunakan NOTSET atau WARN
formatter = generic
[
alembic
]
sqlalchemy.url = postgresql://user:password@localhost:5432/db
script_location = alembic
```
Buat tabelnya::
$ ~/env/bin/initialize_opensipkd_db ~/env/etc/test_opensipkd.ini
Jalankan::
$ ~/env/bin/pserve --reload test.ini
# Penggunaan Proxy
## Apache::
Tambahkan line berikut ini didalam ``<VirtualHost>``::
```
ProxyRequests Off
ProxyPreserveHost On
ProxyPass / http://server:port/
ProxyPassReverse / http://server:port/
<Proxy
*
>
allow from all
</Proxy>
```
Contoh::
```
<VirtualHost
ip:80
>
SuexecUserGroup "#uid" "#gid"
ServerName antrian.opensipkd.com
ServerAlias www.antrian.opensipkd.com
ProxyRequests Off
ProxyPreserveHost On
ProxyPass / http://localhost:6552/
ProxyPassReverse / http://localhost:6552/
<Proxy
*
>
allow from all
</Proxy>
</VirtualHost>
```
# Virtual Directory
## Setting Ini File
### Ubah `[app:ain]` jadi `[app:opensipkd]`
```
;
[
app:main
]
[
app:opensipkd_base
]
trusted_proxy_headers = "forwarded x-forwarded-for x-forwarded-host x-forwarded-proto x-forwarded-port"
url_prefix='/virtualdir' ; nama cirtual direktory
```
Tambahkan blok berikut ini dibawah ini file
```
[
filter:proxy-prefix
]
use = egg:PasteDeploy#prefix
prefix = /virtualdir ; nama virtual directory
[
pipeline:main
]
pipeline =
proxy-prefix
opensipkd_base
```
## Nginx::
```
location /virtualdir{
return 302 /virtualdir/;
}
location /virtualdir/ {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $host:$server_port;
proxy_set_header X-Forwarded-Port $server_port;
proxy_pass http://127.0.0.1:6543/;
}
```
README.rst
View file @
2b1eaed
...
@@ -14,11 +14,12 @@ Buat Python Virtual Environment, biasanya pada home directory::
...
@@ -14,11 +14,12 @@ Buat Python Virtual Environment, biasanya pada home directory::
$ python3 -m venv ~/env
$ python3 -m venv ~/env
$ ~/env/bin/pip install --upgrade pip setuptools
$ ~/env/bin/pip install --upgrade pip setuptools
$ ~/env/bin/pip install wheel
Install Production
Install Production
------------------
------------------
$ ~/env/bin/pip install git+https://git
hub.com/aagusti/tandur.gi
t
$ ~/env/bin/pip install git+https://git
.opensipkd.com/aa.gusti/base.git@lates
t
$ cp ~/env/etc/live_opensipkd.tpl ~/env/etc/live_opensipkd.ini
$ cp ~/env/etc/live_opensipkd.tpl ~/env/etc/live_opensipkd.ini
Install Development::
Install Development::
...
@@ -44,9 +45,6 @@ pada baris berikut ini::
...
@@ -44,9 +45,6 @@ pada baris berikut ini::
sqlalchemy.url = postgresql://user:password@localhost:5432/db
sqlalchemy.url = postgresql://user:password@localhost:5432/db
script_location = opensipkd.base:alembic
script_location = opensipkd.base:alembic
[alembic_tandur]
sqlalchemy.url = postgresql://user:password@localhost:5432/db
script_location = tandur:alembic
Handling Log File:
Handling Log File:
==================
==================
...
@@ -128,7 +126,7 @@ Contoh::
...
@@ -128,7 +126,7 @@ Contoh::
# Virtual Directory
# Virtual Directory
## Setting Ini File
## Setting Ini File
### Ubah `[app:ain]` jadi `[app:opensipkd]`
### Ubah `[app:
m
ain]` jadi `[app:opensipkd]`
```
```
;[app:main]
;[app:main]
[app:opensipkd_base]
[app:opensipkd_base]
...
@@ -139,14 +137,14 @@ Contoh::
...
@@ -139,14 +137,14 @@ Contoh::
Tambahkan blok berikut ini dibawah ini file
Tambahkan blok berikut ini dibawah ini file
```
```
[filter:proxy-prefix]
[filter:proxy-prefix]
use = egg:PasteDeploy#prefix
use = egg:PasteDeploy#prefix
prefix = /virtualdir ; nama virtual directory
prefix = /virtualdir ; nama virtual directory
[pipeline:main]
[pipeline:main]
pipeline =
pipeline =
proxy-prefix
proxy-prefix
opensipkd_base
opensipkd_base
```
```
...
@@ -170,3 +168,20 @@ pipeline =
...
@@ -170,3 +168,20 @@ pipeline =
```
```
## Google Integrated
Aplikasi sudah bisa terintegrsi dengan google oauth2
# Setting Configurasi
```
allow_register = True
google-signin-client-id = id oauth2 client dari google
```
# RML Reporting
Untuk aktivasi harus terdapat konfigurasi berikut ini
# Setting Configurasi
```
report_img = "fisik path opensipkd_base:static/img"
```
etc/live_opensipkd.tpl
View file @
2b1eaed
...
@@ -77,7 +77,8 @@ departemen_chg_id = 3
...
@@ -77,7 +77,8 @@ departemen_chg_id = 3
[server:main]
[server:main]
use = egg:waitress#main
use = egg:waitress#main
host = 0.0.0.0
host = 0.0.0.0
port = %(http_port)s
port = 6543
;port = %(http_port)s digunakan jika port akan menggunakan parameter
# Begin logging configuration
# Begin logging configuration
...
@@ -109,7 +110,8 @@ qualname = sqlalchemy.engine
...
@@ -109,7 +110,8 @@ qualname = sqlalchemy.engine
[handler_filelog]
[handler_filelog]
class = FileHandler
class = FileHandler
args = ('%(logfile)s','a')
args = ('app.log','a')
;args = ('%(logfile)s','a') digunakan jika nama log file akan menggunakan parameter
level = INFO
level = INFO
formatter = generic
formatter = generic
...
...
opensipkd/base/__init__.py
View file @
2b1eaed
...
@@ -51,13 +51,14 @@ from pkg_resources import resource_filename
...
@@ -51,13 +51,14 @@ from pkg_resources import resource_filename
import
os
import
os
from
.models.handlers
import
LogDBSession
from
.models.handlers
import
LogDBSession
log
=
logging
.
getLogger
(
__name__
)
log
=
logging
.
getLogger
(
__name__
)
# version 2.0.0 digunakan untuk change default template
# version 2.0.0 digunakan untuk change default template
deform_templates
=
resource_filename
(
'deform'
,
'templates'
)
deform_templates
=
resource_filename
(
'deform'
,
'templates'
)
path
=
os
.
path
.
dirname
(
__file__
)
path
=
os
.
path
.
dirname
(
__file__
)
path
=
os
.
path
.
join
(
path
,
'views'
,
'widgets'
)
path
=
os
.
path
.
join
(
path
,
'views'
,
'widgets'
)
search_path
=
(
path
,
deform_templates
)
#
,
search_path
=
(
path
,
deform_templates
)
#
,
renderer
=
ZPTRendererFactory
(
search_path
)
renderer
=
ZPTRendererFactory
(
search_path
)
Form
.
set_zpt_renderer
(
search_path
)
Form
.
set_zpt_renderer
(
search_path
)
main_title
=
'openSIPKD'
main_title
=
'openSIPKD'
...
@@ -134,7 +135,8 @@ def get_params(params, alternate=None):
...
@@ -134,7 +135,8 @@ def get_params(params, alternate=None):
def
allow_register
(
request
):
def
allow_register
(
request
):
return
get_params
(
'allow_register'
,
'false'
)
==
'true'
allow
=
get_params
(
'allow_register'
,
'false'
)
return
allow
==
'true'
or
allow
==
"True"
or
allow
==
True
def
disable_responsive
(
request
):
def
disable_responsive
(
request
):
...
@@ -188,7 +190,7 @@ def is_devel(request):
...
@@ -188,7 +190,7 @@ def is_devel(request):
def
google_signin_client_ids
(
request
):
def
google_signin_client_ids
(
request
):
ids
=
get_params
(
'google-signin-client
_
id'
,
''
)
ids
=
get_params
(
'google-signin-client
-
id'
,
''
)
if
ids
:
if
ids
:
return
ids
.
split
(
','
)
return
ids
.
split
(
','
)
else
:
else
:
...
@@ -323,9 +325,11 @@ def get_host(request):
...
@@ -323,9 +325,11 @@ def get_host(request):
host
=
f
"{proto}://{request.host}"
host
=
f
"{proto}://{request.host}"
return
host
return
host
def
get_home
(
request
):
def
get_home
(
request
):
return
request
.
route_url
(
'home'
)
return
request
.
route_url
(
'home'
)
def
set_routes
(
config
,
app_id
=
None
):
def
set_routes
(
config
,
app_id
=
None
):
q
=
DBSession
.
query
(
Route
)
q
=
DBSession
.
query
(
Route
)
if
not
app_id
:
if
not
app_id
:
...
@@ -424,7 +428,7 @@ def main(global_config, **settings):
...
@@ -424,7 +428,7 @@ def main(global_config, **settings):
captcha_files
=
get_params
(
'captcha_files'
,
'/tmp/captcha'
)
captcha_files
=
get_params
(
'captcha_files'
,
'/tmp/captcha'
)
if
not
os
.
path
.
exists
(
captcha_files
):
if
not
os
.
path
.
exists
(
captcha_files
):
os
.
makedirs
(
captcha_files
)
os
.
makedirs
(
captcha_files
)
config
.
add_static_view
(
'captcha'
,
captcha_files
)
config
.
add_static_view
(
'captcha'
,
captcha_files
)
# config.add_static_view('tts', path=get_params('tts_files'))
# config.add_static_view('tts', path=get_params('tts_files'))
config
.
add_renderer
(
'csv'
,
'opensipkd.tools.CSVRenderer'
)
config
.
add_renderer
(
'csv'
,
'opensipkd.tools.CSVRenderer'
)
...
...
opensipkd/base/scripts/data/new 2
0 → 100644
View file @
2b1eaed
g
248/04.06.2022 (DISC : 0 %)
E 6281 JL 0944061/R1/11400-14/PU/VI/22 SUMBER
SATAR 32092307077XXXXX/ P.U.
BLOK KLANGENAN RT 03 RW 02 DS KLANGENAN- [11]
KEC KLANGENAN CRBN-KLANGENAN 0 0 0
HONDA/E1F02N11M2 A/T 232.800 0 232.800
SEPEDA MOTOR BENSIN 35.000 0 35.000
2017/2017 HITAM 100.000 0 100.000
HITAM 1 : 1,75 60.000 0 60.000
125 CC 427.800 0 427.800
MH1JFU119HK892552
JFU1E1897403 R01183325 04 Jun 2022 REZA F., A.MD.A.PJ. GINA & EKO
N03125569 [12:51:31#04-06-2022#E 6281 JL #Rp. 427.800<GINA & EKO>DPD#BJB 000]
05 Jun 2023
KETERANGAN:
bea_bbnkb_pok = bea_bbnkb1_pok+bea_bbnkb1_tgk+bea_bbnkb2_pok+bea_bbnkb2_tgk
bea_pkb_pok = bea_pkb_pok+ bea_pkb_tgk1+ bea_pkb_tgk2+ bea_pkb_tgk3+ bea_pkb_tgk4
bea_swdkllj_pok = bea_swdkllj_pok+ bea_swdkllj_tgk1+ bea_swdkllj_tgk2+ bea_swdkllj_tgk3+ bea_swdkllj_tgk4
jumlah_pokok = bea_bbnkb_pok + bea_pkb_pok + bea_swdkllj_pok + bea_adm_stnk + bea_adm_tnkb
bea_bbnkb_den = bea_bbnkb1_den + bea_bbnkb2_den
bea_pkb_den = bea_pkb_den+ bea_pkb_den1 + bea_pkb_den2 + bea_pkb_den3 + bea_pkb_den4
bea_swdkllj_den = bea_swdkllj_den + bea_swdkllj_den1+ bea_swdkllj_den2+ bea_swdkllj_den3+ bea_swdkllj_den4
jumlah_den = bea_bbnkb_den + bea_pkb_den + bea_swdkllj_den
jumlah_bbnkb = bea_bbkb_pok + bea_bbnkb_den
jumlah_pkb = bea_pkb_pok + bea_pkb_den
jumlah_swdkllj = bea_swdkllj_pok + bea_swdkllj_den
jumlah_total = jumlah_pokok + jumlah_den
========================================================================================================================================
g
{no_urut_daf}/{tg_pros_daftar}(DISC : {no_kohir2} %)
{no_polisi} {no_kohir1} {nm_wil}
{nm_pemilik} {no_ktp}/{npwpd} {no_kohir1[4]}
{al_pemilik}- [{kd_fungsi}]
{al_pemilik2}-{nm_kecamatan} {bea_bbnkb_pok} {bea_bbnkb_den} {jumlah_bbnkb}
{nm_merek_kb}/{nm_model_kb} {bea_pkb_pok} {bea_pkb_den} {jumlah_pkb}
{nm_jenis_kb} {bbm} {bea_swdkllj_pok} {bea_swdkllj_den} {jumlah_swdkllj}
{th_buatan}/{th_rakitan} {warna_tnkb} {bea_adm_stnk} 0 {bea_adm_stnk}
{warna_kb} {milik_ke} : {tarif} {bea_adm_tnkb} 0 {bea_adm_tnkb}
{jumlah_cc} CC {jumlah_pokok} {jumlah_den} {jumlah_total}
{no_rangka}
{no_mesin} {kd_merek_kb} {tg_pros_tetap} {nm_operator} {nm_kasir}
{no_bpkb} [{jam_proses}#{tg_pros_bayar}#{no_polisi}#Rp. {jumlah_total}<{nm_kasir}>DPD#BJB {kd_bank}]
{tg_akhir_pajak}
opensipkd/base/scripts/initializedb.py
View file @
2b1eaed
import
os
import
os
import
sys
import
sys
import
csv
import
csv
from
collections
import
defaultdict
import
transaction
import
transaction
import
subprocess
import
subprocess
from
getpass
import
getpass
from
getpass
import
getpass
...
@@ -264,7 +266,7 @@ def base_alembic_run(ini_file, name=None):
...
@@ -264,7 +266,7 @@ def base_alembic_run(ini_file, name=None):
def
main
(
argv
=
sys
.
argv
):
def
main
(
argv
=
sys
.
argv
):
if
len
(
argv
)
!=
2
:
if
len
(
argv
)
<
2
:
usage
(
argv
)
usage
(
argv
)
config_uri
=
argv
[
1
]
config_uri
=
argv
[
1
]
...
...
opensipkd/base/views/user.py
View file @
2b1eaed
...
@@ -5,7 +5,7 @@ import colander
...
@@ -5,7 +5,7 @@ import colander
import
transaction
import
transaction
from
datatables
import
(
ColumnDT
,
DataTables
,
)
from
datatables
import
(
ColumnDT
,
DataTables
,
)
from
deform
import
(
Form
,
widget
,
ValidationFailure
,
Button
,
)
from
deform
import
(
Form
,
widget
,
ValidationFailure
,
Button
,
)
from
sqlalchemy.exc
import
IntegrityError
# from sqlalchemy.exc import IntegrityErrortpl
from
opensipkd.tools
import
create_now
from
opensipkd.tools
import
create_now
from
opensipkd.tools.buttons
import
btn_cancel
,
btn_save
,
btn_close
from
opensipkd.tools.buttons
import
btn_cancel
,
btn_save
,
btn_close
...
...
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