Commit d1acbfee by taufikyu

Merge branch 'master' of http://git.opensipkd.com/taufik/esipkd

2 parents 242e2bde fd8774fd
...@@ -313,4 +313,4 @@ def clear_null_value(values): ...@@ -313,4 +313,4 @@ def clear_null_value(values):
return values return values
def ymd(tgl): def ymd(tgl):
return tgl.strftime('%Y-%m-%d')
\ No newline at end of file \ No newline at end of file
return tgl.strftime('%Y-%m-%d')
...@@ -52,7 +52,7 @@ class AddSchema(colander.Schema): ...@@ -52,7 +52,7 @@ class AddSchema(colander.Schema):
product_code = colander.SchemaNode( product_code = colander.SchemaNode(
colander.String(), colander.String(),
widget = widget.HiddenWidget(), widget = widget.HiddenWidget(),
default = 30, default = "01", #30,
oid = "product_code", oid = "product_code",
title="") title="")
invoice_no = colander.SchemaNode( invoice_no = colander.SchemaNode(
...@@ -475,4 +475,4 @@ def q_inv(kode): ...@@ -475,4 +475,4 @@ def q_inv(kode):
def calculate_tagihan(values): def calculate_tagihan(values):
pokok = int(values['pokok']) pokok = int(values['pokok'])
denda = hitung_bunga(pokok,values['jatuh_tempo']) denda = hitung_bunga(pokok,values['jatuh_tempo'])
return pokok, denda
\ No newline at end of file \ No newline at end of file
return pokok, denda
...@@ -555,4 +555,4 @@ def q_inv(kode): ...@@ -555,4 +555,4 @@ def q_inv(kode):
def calculate_tagihan(values): def calculate_tagihan(values):
pokok = int(values['pokok']) pokok = int(values['pokok'])
denda = hitung_bunga(pokok,values['jatuh_tempo']) denda = hitung_bunga(pokok,values['jatuh_tempo'])
return pokok, denda
\ No newline at end of file \ No newline at end of file
return pokok, denda
...@@ -62,9 +62,9 @@ def deferred_tahun(node, kw): ...@@ -62,9 +62,9 @@ def deferred_tahun(node, kw):
return widget.SelectWidget(values=values) return widget.SelectWidget(values=values)
TAHUNS = (('','Pilih Tahun'), TAHUNS = (('','Pilih Tahun'),
('1990','1990'),('1991','1991'),('1992','1992'),('1993','1993'),('1994','1994'), # ('1990','1990'),('1991','1991'),('1992','1992'),('1993','1993'),('1994','1994'),
('1995','1995'),('1996','1996'),('1997','1997'),('1998','1998'),('1999','1999'), # ('1995','1995'),('1996','1996'),('1997','1997'),('1998','1998'),('1999','1999'),
('2000','2000'),('2001','2001'),('2002','2002'),('2003','2003'),('2004','2004'), # ('2000','2000'),('2001','2001'),('2002','2002'),('2003','2003'),('2004','2004'),
('2005','2005'),('2006','2006'),('2007','2007'),('2008','2008'),('2009','2009'), ('2005','2005'),('2006','2006'),('2007','2007'),('2008','2008'),('2009','2009'),
('2010','2010'),('2011','2011'),('2012','2012'),('2013','2013'),('2014','2014'), ('2010','2010'),('2011','2011'),('2012','2012'),('2013','2013'),('2014','2014'),
('2015','2015'),('2016','2016'),('2017','2017'),('2018','2018'),('2019','2019'), ('2015','2015'),('2016','2016'),('2017','2017'),('2018','2018'),('2019','2019'),
...@@ -283,7 +283,7 @@ def view_add(request): ...@@ -283,7 +283,7 @@ def view_add(request):
return session_failed(request, SESS_ADD_FAILED) return session_failed(request, SESS_ADD_FAILED)
return dict(form=form, private_key=private_key, found=found, data_key=data_key) return dict(form=form, private_key=private_key, found=found, data_key=data_key)
def query_id(request): def query_id(request):
engInformix = EngInformix() engInformix = EngInformix()
sql_result1 = """ sql_result1 = """
......
...@@ -19,7 +19,7 @@ SESS_EDIT_FAILED = 'user edit failed' ...@@ -19,7 +19,7 @@ SESS_EDIT_FAILED = 'user edit failed'
####### #######
# Add # # Add #
####### #######
import logging
def form_validator(form, value): def form_validator(form, value):
def err_no_rangka(): def err_no_rangka():
raise colander.Invalid(form, raise colander.Invalid(form,
...@@ -139,7 +139,7 @@ class AddSchema(colander.Schema): ...@@ -139,7 +139,7 @@ class AddSchema(colander.Schema):
colander.String(), colander.String(),
missing=colander.drop, missing=colander.drop,
title = 'Thn. Pembuatan', title = 'Thn. Pembuatan',
oid="th_buatan" oid="th_buatan"
) )
tg_akhir_pjklm = colander.SchemaNode( tg_akhir_pjklm = colander.SchemaNode(
colander.String(), colander.String(),
...@@ -259,7 +259,7 @@ def save(request, values, row=None): ...@@ -259,7 +259,7 @@ def save(request, values, row=None):
tg_pros_daftar, jam_daftar, kd_status, flag_sms) tg_pros_daftar, jam_daftar, kd_status, flag_sms)
VALUES('{no_rangka}', '{no_ktp}', '{email}', '{no_hp}', '{ivr}', VALUES('{no_rangka}', '{no_ktp}', '{email}', '{no_hp}', '{ivr}',
'{c_date}' , '{c_time}', '{kd_status}', '{flag_sms}')""" '{c_date}' , '{c_time}', '{kd_status}', '{flag_sms}')"""
logging.info(sql)
row = engInformix.execute(sql.format( row = engInformix.execute(sql.format(
no_rangka = values['no_rangka'], no_rangka = values['no_rangka'],
no_ktp = values['no_ktp'], no_ktp = values['no_ktp'],
...@@ -270,7 +270,8 @@ def save(request, values, row=None): ...@@ -270,7 +270,8 @@ def save(request, values, row=None):
c_time = values['c_time'], c_time = values['c_time'],
kd_status = 0, kd_status = 0,
flag_sms = 0)) flag_sms = 0))
except: except Exception as e:
logging.info(e)
return return
tm_awal = datetime.now() tm_awal = datetime.now()
...@@ -279,25 +280,24 @@ def save(request, values, row=None): ...@@ -279,25 +280,24 @@ def save(request, values, row=None):
sql_result = """ sql_result = """
SELECT * FROM v_smsdft SELECT * FROM v_smsdft
WHERE no_rangka= '{no_rangka}' and no_ktp= '{no_ktp}' WHERE no_rangka= '{no_rangka}' and no_ktp= '{no_ktp}'
and email = '{email}' and no_hp='{no_hp}' and ivr= '{ivr}' and no_hp='{no_hp}' and ivr= '{ivr}'
and tg_pros_daftar='{c_date}' and jam_daftar='{c_time}' and tg_pros_daftar='{c_date}' and jam_daftar='{c_time}'
and kd_status='{kd_status}' and kd_status='{kd_status}'
""".format( """.format(
no_rangka = values['no_rangka'], no_rangka = values['no_rangka'],
no_ktp = values['no_ktp'], no_ktp = values['no_ktp'],
email = values['email'], # email = values['email'],
no_hp = values['no_hp'], no_hp = values['no_hp'],
ivr = '11', ivr = '11',
c_date = values['c_date'], c_date = values['c_date'],
c_time = values['c_time'], c_time = values['c_time'],
kd_status = 2) kd_status = 2)
trx_timeout = 10 trx_timeout = 20
delay_after_insert = 1 delay_after_insert = 1
awal = time() awal = time()
p = None p = None
msg = None msg = None
while time() - awal < trx_timeout: while time() - awal < trx_timeout:
sleep(delay_after_insert) sleep(delay_after_insert)
try: try:
...@@ -370,6 +370,7 @@ def view_add(request): ...@@ -370,6 +370,7 @@ def view_add(request):
c_now = datetime.now() c_now = datetime.now()
ctrl['c_date'] = c_now.strftime('%m-%d-%Y') ctrl['c_date'] = c_now.strftime('%m-%d-%Y')
ctrl['c_time'] = c_now.strftime('%H:%M:%S') ctrl['c_time'] = c_now.strftime('%H:%M:%S')
ctrl['c_date2'] = c_now
row = save_request(ctrl, request) row = save_request(ctrl, request)
found = 1 found = 1
return HTTPFound(location=request.route_url('pkb-edit',nr=ctrl['no_rangka'], return HTTPFound(location=request.route_url('pkb-edit',nr=ctrl['no_rangka'],
...@@ -391,13 +392,12 @@ def query_id(request): ...@@ -391,13 +392,12 @@ def query_id(request):
sql_result1 = """ sql_result1 = """
SELECT * FROM v_smsdft SELECT * FROM v_smsdft
WHERE no_rangka= '{no_rangka}' and no_ktp= '{no_ktp}' WHERE no_rangka= '{no_rangka}' and no_ktp= '{no_ktp}'
and email = '{email}' and no_hp='{no_hp}' and ivr= '{ivr}' and no_hp='{no_hp}' and ivr= '{ivr}'
and tg_pros_daftar='{c_date}' and jam_daftar='{c_time}' and tg_pros_daftar='{c_date}' and jam_daftar='{c_time}'
and kd_status<>'{kd_status}' and kd_status<>'{kd_status}'
""".format( """.format(
no_rangka = request.matchdict['nr'], no_rangka = request.matchdict['nr'],
no_ktp = request.matchdict['nk'], no_ktp = request.matchdict['nk'],
email = request.matchdict['em'],
no_hp = request.matchdict['nh'], no_hp = request.matchdict['nh'],
c_date = request.matchdict['cd'], c_date = request.matchdict['cd'],
c_time = request.matchdict['ct'], c_time = request.matchdict['ct'],
...@@ -446,6 +446,7 @@ def view_edit(request): ...@@ -446,6 +446,7 @@ def view_edit(request):
c_now = datetime.now() c_now = datetime.now()
ctrl['c_date'] = c_now.strftime('%m-%d-%Y') ctrl['c_date'] = c_now.strftime('%m-%d-%Y')
ctrl['c_time'] = c_now.strftime('%H:%M:%S') ctrl['c_time'] = c_now.strftime('%H:%M:%S')
ctrl['c_date2'] = c_now
row = save_request(ctrl, request) row = save_request(ctrl, request)
found = 1 found = 1
print '----------------Row Hasil Select--------------------',row print '----------------Row Hasil Select--------------------',row
......
...@@ -192,9 +192,16 @@ class ViewLaporan(BaseViews): ...@@ -192,9 +192,16 @@ class ViewLaporan(BaseViews):
def reports_act(self): def reports_act(self):
global awal, akhir, tgl_awal, tgl_akhir,u,unit_kd,unit_nm,unit_al,now,thn,thun,bulan,bulan2 global awal, akhir, tgl_awal, tgl_akhir,u,unit_kd,unit_nm,unit_al,now,thn,thun,bulan,bulan2
req = self.request req = self.request
params = req.params params = req.params
url_dict = req.matchdict url_dict = req.matchdict
u = req.user.id if not req.user:
req_user = False
req_user_id = None
else:
req_user = True
req_user_id = req.user.id
u = req_user_id # req.user.id
now = datetime.now().strftime('%Y-%m-%d') now = datetime.now().strftime('%Y-%m-%d')
thn = datetime.now().strftime('%Y') thn = datetime.now().strftime('%Y')
id = 'id' in params and params['id'] and int(params['id']) or 0 id = 'id' in params and params['id'] and int(params['id']) or 0
...@@ -212,40 +219,47 @@ class ViewLaporan(BaseViews): ...@@ -212,40 +219,47 @@ class ViewLaporan(BaseViews):
bulan2 = int(bulan)-1 bulan2 = int(bulan)-1
sptpd_id = 'sptpd_id' in params and params['sptpd_id'] and str(params['sptpd_id']) or '' sptpd_id = 'sptpd_id' in params and params['sptpd_id'] and str(params['sptpd_id']) or ''
if group_in(req, 'bendahara'): if req_user == True:
unit_id = DBSession.query(UserUnit.unit_id
if group_in(req, 'bendahara'):
unit_id = DBSession.query(UserUnit.unit_id
).filter(UserUnit.user_id==u ).filter(UserUnit.user_id==u
).first() ).first()
unit_id = '%s' % unit_id unit_id = '%s' % unit_id
unit_id = int(unit_id) unit_id = int(unit_id)
unit = DBSession.query(Unit.kode.label('kd'), unit = DBSession.query(Unit.kode.label('kd'),
Unit.nama.label('nm'), Unit.nama.label('nm'),
Unit.alamat.label('al') Unit.alamat.label('al')
).filter(UserUnit.unit_id==unit_id, ).filter(UserUnit.unit_id==unit_id,
Unit.id==unit_id Unit.id==unit_id
).first() ).first()
#unit_kd = '%s' % unit.kd #unit_kd = '%s' % unit.kd
unit_kd = strip('%s' % unit.kd) unit_kd = strip('%s' % unit.kd)
unit_nm = '%s' % unit.nm unit_nm = '%s' % unit.nm
unit_al = '%s' % unit.al unit_al = '%s' % unit.al
elif group_in(req, 'wp'): elif group_in(req, 'wp'):
unit_id = DBSession.query(UserUnit.unit_id unit_id = DBSession.query(UserUnit.unit_id
).filter(UserUnit.user_id==u ).filter(UserUnit.user_id==u
).first() ).first()
unit_id = '%s' % unit_id unit_id = '%s' % unit_id
unit_id = int(unit_id) unit_id = int(unit_id)
unit = DBSession.query(Unit.kode.label('kd'), unit = DBSession.query(Unit.kode.label('kd'),
Unit.nama.label('nm'), Unit.nama.label('nm'),
Unit.alamat.label('al') Unit.alamat.label('al')
).filter(UserUnit.unit_id==unit_id, ).filter(UserUnit.unit_id==unit_id,
Unit.id==unit_id Unit.id==unit_id
).first() ).first()
unit_kd = '%s' % unit.kd unit_kd = '%s' % unit.kd
unit_nm = '%s' % unit.nm unit_nm = '%s' % unit.nm
unit_al = '%s' % unit.al unit_al = '%s' % unit.al
else:
unit_kd = "1.20.05."
unit_nm = "BADAN PENDAPATAN DAERAH"
unit_al = "Jl. Soekarno Hatta, No. 528, Bandung"
else: else:
unit_kd = "1.20.05." unit_kd = "1.20.05."
...@@ -865,7 +879,7 @@ class ViewLaporan(BaseViews): ...@@ -865,7 +879,7 @@ class ViewLaporan(BaseViews):
elif url_dict['act']=='Laporan_7' : elif url_dict['act']=='Laporan_7' :
query = DBSession.query(ARSspd.bayar.label('bayar'), query = DBSession.query(ARSspd.bayar.label('bayar'),
ARSspd.bunga.label('bunga'), (ARInvoice.denda+ARSspd.bunga).label('bunga'),
#ARInvoice.denda.label('bunga'), #ARInvoice.denda.label('bunga'),
ARSspd.tgl_bayar.label('tgl'), ARSspd.tgl_bayar.label('tgl'),
ARInvoice.kode.label('kd'), ARInvoice.kode.label('kd'),
......
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
${structure:field.serialize()} ${structure:field.serialize()}
<script> <script>
$(document).ready(function () { $(document).ready(function () {
//Membatasi 4 Digit & Membatasi Huruf //Membatasi 4 Digit & Membatasi Huruf
$('#m_pjk_thn').keyup(function(){ $('#m_pjk_thn').keyup(function(){
var m_pjk_thn = this.value.length; var m_pjk_thn = this.value.length;
if(!/^[0-9]+$/.test(this.value)){ if(!/^[0-9]+$/.test(this.value)){
...@@ -187,7 +187,7 @@ ...@@ -187,7 +187,7 @@
</div> </div>
<!--npa --> <!--npa -->
<label for="npa" class="control-label col-md-3" id="req-npa"> <label for="npa" class="control-label col-md-3" id="req-npa">
NPS </label> NPA </label>
<div class="col-md-3" tal:define="field form['npa']" id="item-${field.oid}"> <div class="col-md-3" tal:define="field form['npa']" id="item-${field.oid}">
${structure:field.serialize()} ${structure:field.serialize()}
<script> <script>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!