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 d4887d64
authored
Oct 08, 2020
by
taufikyu
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
revisi output html qrcode
1 parent
1da78899
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
8 deletions
esipkd/views/arinvoice_b.py
esipkd/views/public.py
esipkd/views/templates/public/public.pt → esipkd/views/templates/public/skrd.pt
esipkd/views/arinvoice_b.py
View file @
d4887d6
...
@@ -26,7 +26,8 @@ from ..tools import (
...
@@ -26,7 +26,8 @@ from ..tools import (
terbilang
,
terbilang
,
thousand
,
thousand
,
dmy
,
dmy
,
BULANS
BULANS
,
get_settings
)
)
from
..models
import
DBSession
from
..models
import
DBSession
from
..models.isipkd
import
(
from
..models.isipkd
import
(
...
@@ -882,10 +883,14 @@ def view_pdf(request):
...
@@ -882,10 +883,14 @@ def view_pdf(request):
item
.
denda
=
(
row
.
tgl_bayar
)
and
thousand
(
row
.
bunga
)
or
(
row
.
denda
)
and
thousand
(
row
.
denda
)
or
'0'
item
.
denda
=
(
row
.
tgl_bayar
)
and
thousand
(
row
.
bunga
)
or
(
row
.
denda
)
and
thousand
(
row
.
denda
)
or
'0'
item
.
bayar
=
row
.
bayar
and
thousand
(
row
.
bayar
)
or
(
row
.
jumlah
)
and
thousand
(
row
.
jumlah
)
or
(
int
(
item
.
pokok
)
+
int
(
item
.
denda
))
item
.
bayar
=
row
.
bayar
and
thousand
(
row
.
bayar
)
or
(
row
.
jumlah
)
and
thousand
(
row
.
jumlah
)
or
(
int
(
item
.
pokok
)
+
int
(
item
.
denda
))
from
..tools
import
get_settings
qrcodename
=
'skrd_{}'
.
format
(
params
[
'id'
])
qrcodename
=
'skrd_{}'
.
format
(
params
[
'id'
])
path
=
'/tmp/'
+
qrcodename
path
=
'/tmp/'
+
qrcodename
imgqrcode
=
qrcode
.
make
(
str
(
'{}/public/skrd?id={}'
.
format
(
get_settings
()[
'_host'
],
params
[
'id'
])))
## ambil host
settings
=
get_settings
()
host
=
settings
[
'_host'
]
## generate qrcode
imgqrcode
=
qrcode
.
make
(
'{}/public/skrd?id={}'
\
.
format
(
host
,
params
[
'id'
]))
imgqrcode
.
save
(
path
,
'PNG'
)
imgqrcode
.
save
(
path
,
'PNG'
)
item
.
qrcode
=
open
(
path
,
'rb'
)
.
read
()
item
.
qrcode
=
open
(
path
,
'rb'
)
.
read
()
...
...
esipkd/views/public.py
View file @
d4887d6
...
@@ -3,6 +3,7 @@ import re
...
@@ -3,6 +3,7 @@ import re
import
logging
import
logging
import
os
import
os
import
qrcode
import
qrcode
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
from
datetime
import
datetime
from
datetime
import
datetime
...
@@ -26,7 +27,8 @@ from ..tools import (
...
@@ -26,7 +27,8 @@ from ..tools import (
terbilang
,
terbilang
,
thousand
,
thousand
,
dmy
,
dmy
,
BULANS
BULANS
,
get_settings
)
)
from
..models
import
DBSession
from
..models
import
DBSession
from
..models.isipkd
import
(
from
..models.isipkd
import
(
...
@@ -324,7 +326,7 @@ def session_failed(request, session_name):
...
@@ -324,7 +326,7 @@ def session_failed(request, session_name):
del
request
.
session
[
SESS_ADD_FAILED
]
del
request
.
session
[
SESS_ADD_FAILED
]
return
r
return
r
@view_config
(
route_name
=
'public-act'
,
renderer
=
'templates/public/
public
.pt'
)
@view_config
(
route_name
=
'public-act'
,
renderer
=
'templates/public/
skrd
.pt'
)
def
view_public
(
request
):
def
view_public
(
request
):
params
=
request
.
params
params
=
request
.
params
url_dict
=
request
.
matchdict
url_dict
=
request
.
matchdict
...
@@ -366,6 +368,19 @@ def view_public(request):
...
@@ -366,6 +368,19 @@ def view_public(request):
jml
=
terbilang
(
row
.
jumlah
)
+
' Rupiah'
jml
=
terbilang
(
row
.
jumlah
)
+
' Rupiah'
tahun
=
datetime
.
now
()
.
year
tahun
=
datetime
.
now
()
.
year
qrcodename
=
'skrd_{}{}'
.
format
(
row
.
invoice_id
,
'.png'
)
return
dict
(
data
=
row
,
jml_terbilang
=
jml
,
tahun
=
tahun
,
qrcodename
=
qrcodename
,
found
=
found
)
## buat nama di folder /tmp
qrcodename
=
'skrd_{}{}'
.
format
(
row
.
invoice_id
,
'.png'
)
path
=
'/tmp/'
+
qrcodename
## ambil host
settings
=
get_settings
()
host
=
settings
[
'_host'
]
##Generate dulu qrcode nya
imgqrcode
=
qrcode
.
make
(
str
(
'{}/public/skrd?id={}'
.
format
(
host
,
row
.
invoice_id
)))
imgqrcode
.
save
(
path
,
'PNG'
)
## Ambil isinya
readqrcode
=
open
(
path
,
'rb'
)
.
read
()
## convert ke base64
qrcodebase64
=
base64
.
b64encode
(
readqrcode
)
##akan diouput ke html image
return
dict
(
data
=
row
,
jml_terbilang
=
jml
,
tahun
=
tahun
,
qrcodebase64
=
qrcodebase64
,
found
=
found
)
esipkd/views/templates/public/
public
.pt
→
esipkd/views/templates/public/
skrd
.pt
View file @
d4887d6
...
@@ -148,7 +148,7 @@
...
@@ -148,7 +148,7 @@
</td>
</td>
</tr>
</tr>
<tr>
<tr>
<td
align=
"center"
><p><img
src=
"
/tmp/${qrcodename
}"
width=
"150"
height=
"150"
></p></td>
<td
align=
"center"
><p><img
src=
"
data:image/png;base64, ${qrcodebase64
}"
width=
"150"
height=
"150"
></p></td>
<td></td>
<td></td>
<td
align=
"center"
><b>
${data.tgl_tetap.strftime('%d %B')}, Tahun ${data.tahun_id}
</b><br>
<td
align=
"center"
><b>
${data.tgl_tetap.strftime('%d %B')}, Tahun ${data.tahun_id}
</b><br>
${data.pejabat_pangkat}
<br><br><br><br><br>
${data.pejabat_pangkat}
<br><br><br><br><br>
...
...
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