Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
irul
/
opensipkd-base
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 4d50724d
authored
Jan 31, 2025
by
aa.gusti
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
penampaabhan parameter depok
1 parent
cf3b3ad4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
12 deletions
opensipkd/base/tools/report.py
opensipkd/base/tools/report.py
View file @
4d50724
...
@@ -2,10 +2,10 @@ from pyreportjasper import PyReportJasper
...
@@ -2,10 +2,10 @@ from pyreportjasper import PyReportJasper
from
opensipkd.base.tools
import
get_random_string
from
opensipkd.base.tools
import
get_random_string
from
opensipkd.base
import
get_settings
,
get_params
from
opensipkd.base
import
get_settings
,
get_params
from
platform
import
python_version
from
platform
import
python_version
import
logging
import
os
import
os
from
opensipkd.tools.report
import
*
from
opensipkd.tools.report
import
*
from
opensipkd.base
import
log
log
=
logging
.
getLogger
(
__name__
)
log
.
warning
(
"Opensipkd.base.tools.pbb depreciated use opensipkd.tools.pbb"
)
log
.
warning
(
"Opensipkd.base.tools.pbb depreciated use opensipkd.tools.pbb"
)
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
...
@@ -63,9 +63,11 @@ def jasper_db_conn(db_schema=None, dburl="sqlalchemy.url"):
...
@@ -63,9 +63,11 @@ def jasper_db_conn(db_schema=None, dburl="sqlalchemy.url"):
def
jasper_export
(
input_file
,
output_file
=
None
,
schema
=
None
,
def
jasper_export
(
input_file
,
output_file
=
None
,
schema
=
None
,
output_formats
=
[
"pdf"
],
dburl
=
"sqlalchemy.url"
,
output_formats
=
[
"pdf"
],
dburl
=
"sqlalchemy.url"
,
parameters
=
{},
db_schema
=
None
,
report_locale
=
"en_US"
,
use_db
=
True
):
parameters
=
{},
db_schema
=
None
,
report_locale
=
"en_US"
,
use_db
=
True
,
out_file
=
None
):
input_file
=
input_file
.
split
(
":"
)
module_file
=
None
input_file
=
input_file
.
split
(
":"
)
# Cek apakah input_file berupa module
# if os.name == 'nt' and len(input_file)>1:
# if os.name == 'nt' and len(input_file)>1:
# input_file=[input_file[0]]
# input_file=[input_file[0]]
# if len(input_file) > 1:
# if len(input_file) > 1:
...
@@ -74,10 +76,9 @@ def jasper_export(input_file, output_file=None, schema=None,
...
@@ -74,10 +76,9 @@ def jasper_export(input_file, output_file=None, schema=None,
# input_file = os.path.join(path, input_file[1])
# input_file = os.path.join(path, input_file[1])
# else:
# else:
# input_file=input_file[0]
# input_file=input_file[0]
module_file
=
None
if
len
(
input_file
)
>
1
:
if
len
(
input_file
)
>
1
:
if
os
.
name
==
'nt'
:
if
os
.
name
==
'nt'
:
if
len
(
input_file
)
>
2
:
if
len
(
input_file
)
>
2
:
# Cek apakah file berbentuk "C:\module_folder\filename.jrxml"
module_file
=
input_file
[
0
]
module_file
=
input_file
[
0
]
input_file
=
":"
.
join
([
input_file
[
1
],
input_file
[
2
]])
input_file
=
":"
.
join
([
input_file
[
1
],
input_file
[
2
]])
else
:
else
:
...
@@ -86,11 +87,10 @@ def jasper_export(input_file, output_file=None, schema=None,
...
@@ -86,11 +87,10 @@ def jasper_export(input_file, output_file=None, schema=None,
module_file
=
input_file
[
0
]
module_file
=
input_file
[
0
]
input_file
=
input_file
[
1
]
input_file
=
input_file
[
1
]
if
module_file
:
if
module_file
:
path
=
__import__
(
module_file
)
path
=
__import__
(
module_file
)
path
=
os
.
path
.
dirname
(
path
.
__file__
)
path
=
os
.
path
.
dirname
(
path
.
__file__
)
input_file
=
os
.
path
.
join
(
path
,
input_file
)
input_file
=
os
.
path
.
join
(
path
,
input_file
)
else
:
else
:
input_file
=
input_file
[
0
]
input_file
=
input_file
[
0
]
...
@@ -98,7 +98,13 @@ def jasper_export(input_file, output_file=None, schema=None,
...
@@ -98,7 +98,13 @@ def jasper_export(input_file, output_file=None, schema=None,
if
not
output_file
:
if
not
output_file
:
output_file
=
get_params
(
"tmp_report"
,
"/tmp"
)
output_file
=
get_params
(
"tmp_report"
,
"/tmp"
)
output_file
=
os
.
path
.
join
(
output_file
,
get_random_string
(
32
))
if
out_file
:
log
.
debug
(
f
"File name to generate: {out_file}"
)
out_file
=
os
.
path
.
splitext
(
out_file
)[
0
]
output_file
=
os
.
path
.
join
(
output_file
,
out_file
)
else
:
output_file
=
os
.
path
.
join
(
output_file
,
get_random_string
(
32
))
db_connection
=
use_db
and
jasper_db_conn
(
db_connection
=
use_db
and
jasper_db_conn
(
db_schema
=
db_schema
,
dburl
=
dburl
)
or
{}
db_schema
=
db_schema
,
dburl
=
dburl
)
or
{}
pyreportjasper
=
PyReportJasper
()
pyreportjasper
=
PyReportJasper
()
...
...
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