Commit 6f0008b5 by aagusti

perbaikan prosedure

1 parent 314994c5
......@@ -52,7 +52,7 @@ import string
import os
import zipfile
import xml.dom.minidom
from reportlab.lib.divisis import toLength
#from reportlab.lib.divisis import toLength
import base64
class DomApiGeneral:
......@@ -150,7 +150,7 @@ class DomApi(DomApiGeneral):
# ******** always use the following order:
self.buildStyleDict()
self.buildStylePropertiesDict()
if self.styles_dom.getElementsByTagName("style:page-master").__len__()<>0:
if self.styles_dom.getElementsByTagName("style:page-master").__len__()!=0:
self.page_master = self.styles_dom.getElementsByTagName("style:page-master")[0]
self.document = self.content_dom.getElementsByTagName("office:document-content")[0]
......@@ -354,12 +354,13 @@ if __name__ == "__main__":
parser.error("incorrect number of arguments")
import sys
import StringIO
import io
#StringIO
fname = sys.argv[1]
f = StringIO.StringIO(file(fname).read())
f = io.StringIO(open(fname).read())
xsl = file(os.path.join(os.getcwd(), os.path.dirname(sys.argv[0]), 'normalized_oo2rml.xsl')).read()
xsl = open(os.path.join(os.getcwd(), os.path.dirname(sys.argv[0]), 'normalized_oo2rml.xsl')).read()
result = sxw2rml(f, xsl, output=opt.output, save_pict=False)
print result
print(result)
......@@ -183,4 +183,12 @@ div.tab-content {
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.dataTables_paginate {
font-size: 10px !important;
}
.paginate_button .current{
font-size: 10px !important;
}
\ No newline at end of file
id,thn_pajak_sppt,nik,nm_wp,nik_doc,tgl_terima_wp
2,32.79-010.006-009.0218-0,2022,1234567890123456,BBB,XGBytf.jpeg,2022-07-26 00:00:00
id,thn_pajak_sppt,nik,nm_wp,nik_doc,tgl_terima_wp
2,32.79-010.006-009.0218-0,2022,1234567890123456,BBB,XGBytf.jpeg,2022-07-26 00:00:00
......@@ -12,7 +12,7 @@ from pyramid.httpexceptions import HTTPFound
from .common import DataTables
from .. import DBSession, get_params
from opensipkd.tools import dmy, dmy_to_date, get_settings, get_ext, \
from opensipkd.tools import dmy, date_from_str, get_settings, get_ext, \
date_from_str
import colander
from deform import (widget, Form, ValidationFailure, Button, )
......@@ -36,6 +36,12 @@ class BaseView(object):
self.params = self.req.params
self.settings = get_settings()
now = datetime.now()
# self.dt_awal = self.ses["dt_awal"] if "dt_awal" in self.ses else now
# self.awal = dmy(self.dt_awal)
# self.dt_akhir = self.ses["dt_akhir"] if "dt_akhir" in self.ses else now
# self.akhir = dmy(self.dt_akhir)
# self.ses["dt_awal"] = self.dt_awal
# self.ses["dt_akhir"] = self.dt_akhir
self.tahun = 'tahun' in self.ses and self.ses['tahun'] or now.strftime(
'%Y')
self.tahun = 'tahun' in self.params and self.params[
......@@ -47,7 +53,7 @@ class BaseView(object):
if 'bulan' in self.params and self.params['bulan']:
self.bulan = self.params['bulan'].strip().zfill(2)
dt_awal = dmy_to_date(
dt_awal = date_from_str(
'{d}-{m}-{y}'.format(y=self.tahun, m=self.bulan, d='01'))
dt_akhir = dt_awal + relativedelta(months=1) - relativedelta(days=1)
......@@ -66,10 +72,10 @@ class BaseView(object):
self.awal = 'awal' in self.ses and self.ses['awal'] or dmy(now)
awal = 'awal' in self.params and self.params['awal'] or self.awal
try:
self.dt_awal = dmy_to_date(awal)
self.dt_awal = date_from_str(awal)
self.awal = awal
except:
self.dt_awal = dmy_to_date(self.awal)
self.dt_awal = date_from_str(self.awal)
self.ses['awal'] = self.awal
self.ses['dt_awal'] = self.dt_awal
......@@ -78,10 +84,10 @@ class BaseView(object):
akhir = 'akhir' in self.params and self.params['akhir'] or self.akhir
try:
self.dt_akhir = dmy_to_date(akhir)
self.dt_akhir = date_from_str(akhir)
self.akhir = akhir
except:
self.dt_akhir = dmy_to_date(self.akhir)
self.dt_akhir = date_from_str(self.akhir)
self.tahun_awal = 'tahun_awal' in self.ses and self.ses[
'tahun_awal'] or self.tahun
......@@ -181,8 +187,8 @@ class BaseView(object):
def view_list(self, **kwargs):
if self.list_schema:
allow_edit=kwargs.get("allow_edit", True)
allow_delete=kwargs.get("allow_delete", True)
allow_edit = kwargs.get("allow_edit", True)
allow_delete = kwargs.get("allow_delete", True)
table = DeTable(self.list_schema(),
action=self.req.route_url(self.list_route),
action_suffix="/grid/act",
......@@ -219,7 +225,7 @@ class BaseView(object):
return dict(form=form.render(readonly=True),
table=table and table.render() or None,
scripts=self.form_scripts)
def before_add(self):
return {}
......@@ -227,7 +233,7 @@ class BaseView(object):
return value
def cancel_act(self):
pass
return self.route_list()
def after_add(self, row, values):
return
......@@ -244,12 +250,12 @@ class BaseView(object):
def view_act(self, **kwargs):
url_dict = self.req.matchdict
if url_dict['act'] == 'grid':
url=[]
url = []
columns = []
for d in self.list_schema():
global_search = hasattr(d, "searchable") and \
hasattr(d, "searchable") == False and False \
or True
hasattr(d, "searchable") == False and False \
or True
if hasattr(d, "field"):
if type(d.field) == str:
columns.append(
......@@ -268,7 +274,7 @@ class BaseView(object):
self.table, "company_id"):
query = query.filter(
self.table.company_id == self.req.user.company_id)
query=self.list_filter(query)
query = self.list_filter(query)
row_table = DataTables(self.req.GET, query, columns)
result = row_table.output_result()
# for d in result["data"]:
......@@ -301,7 +307,7 @@ class BaseView(object):
values = dict(c)
row = self.save_request(values)
self.after_add(row, values)
elif "cancel" in self.req.POST or 'batal' in self.req.POST:
elif "cancel" in self.req.POST or 'batal' in self.req.POST or "close" in self.req.POST:
self.cancel_act()
else:
return self.next_add(form, table=table, resources=resources)
......@@ -407,7 +413,8 @@ class BaseView(object):
DBSession.flush()
request.session.flash(msg)
return self.route_list()
form = self.get_form(self.edit_schema, buttons=(btn_delete, btn_cancel))
form = self.get_form(
self.edit_schema, buttons=(btn_delete, btn_cancel))
table = self.get_item_table(row)
resources = form.get_widget_resources()
form.set_appstruct(self.get_values(row))
......
......@@ -178,6 +178,22 @@ class DeTable(field.Field):
if hasattr(f, 'visible'):
d["visible"] = f.visible
data.append(f"visible: {f.visible}")
if hasattr(f, 'orderable'):
d["orderable"] = f.orderable
data.append(f"orderable: {f.orderable}")
if hasattr(f, "url"):
request=kw.get("request")
if request:
d["url"]= request.static_url(f.url)
log.debug(d["url"])
if hasattr(f, "action"):
d["action"] = f.action
else:
d["action"]=True
if isinstance(f.widget, deform.widget.HiddenWidget):
d["visible"] = False
if isinstance(f.widget, deform.widget.CheckboxWidget):
......@@ -185,9 +201,8 @@ class DeTable(field.Field):
else:
d["checkbox"]=False
if hasattr(f, 'orderable'):
d["orderable"] = f.orderable
data.append(f"orderable: {f.orderable}")
thousand = hasattr(f, 'thousand') and f.thousand or None
separator = thousand and "separator" in thousand and thousand[
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!