Commit ae322ed9 by aagusti

gilang_27052015

1 parent 41bc1e52
Showing 50 changed files with 595 additions and 99 deletions
...@@ -225,7 +225,9 @@ class SubjekPajak(NamaModel, Base): ...@@ -225,7 +225,9 @@ class SubjekPajak(NamaModel, Base):
user_id = Column(Integer, ForeignKey("users.id")) user_id = Column(Integer, ForeignKey("users.id"))
provinsi = Column(String(128)) provinsi = Column(String(128))
email = Column(String(40)) email = Column(String(40))
unit_id = Column(Integer, ForeignKey("units.id"))
users = relationship("User", backref=backref('subjekpajaks')) users = relationship("User", backref=backref('subjekpajaks'))
units = relationship('Unit', backref=backref('subjekpajaks'))
UniqueConstraint('kode') UniqueConstraint('kode')
......
description,group_name,id,member_count
"Wajib Pajak","wp",1,1
"Bendahara Penerimaan","bendahara",2,1
"Administrator","admin",3,2
"Bendahara Umum Daerah","bud",4,1
GroupData = {
'options': ['insert if not exists'],
'csv': 'group.csv',
}
route_id,group_id
4,1
42,1
42,2
42,4
65,2
65,4
66,1
66,2
66,4
67,2
67,4
68,2
68,4
69,2
69,4
70,1
70,2
70,4
71,1
71,2
71,4
72,1
72,2
72,4
73,1
73,2
73,4
74,1
74,2
74,4
75,4
76,4
77,4
78,4
79,4
80,2
80,4
81,2
81,4
82,2
82,4
83,2
83,4
84,2
84,4
94,2
94,4
95,2
95,4
96,2
96,4
97,2
97,4
98,2
98,4
99,2
99,4
100,2
100,4
101,2
101,4
102,2
102,4
103,2
103,4
104,2
104,4
114,2
115,2
116,2
117,2
118,1
119,1
120,1
121,1
122,2
123,1
GroupRouteData = {
'options': ['insert if not exists'],
'csv': 'group_route.csv',
}
...@@ -95,4 +95,14 @@ id,kode,nama,path,factory,perm_name,disabled,created,updated,create_uid ...@@ -95,4 +95,14 @@ id,kode,nama,path,factory,perm_name,disabled,created,updated,create_uid
110,"user-unit","User OPD","/user-unit",,"read",0,"2015-03-08 16:45:45",,1 110,"user-unit","User OPD","/user-unit",,"read",0,"2015-03-08 16:45:45",,1
111,"user-unit-act","User OPD Act","/user-unit/{act}/act",,"read",0,"2015-03-08 16:45:45",,1 111,"user-unit-act","User OPD Act","/user-unit/{act}/act",,"read",0,"2015-03-08 16:45:45",,1
112,"user-unit-add","Tambah User OPD","/user-unit/add",,"add",0,"2015-03-08 16:45:45",,1 112,"user-unit-add","Tambah User OPD","/user-unit/add",,"add",0,"2015-03-08 16:45:45",,1
113,"user-unit-delete","Hapus User OPD","/user-unit/{id}/{id2}/delete",,"delete",0,"2015-03-08 16:45:45",,1
\ No newline at end of file \ No newline at end of file
113,"user-unit-delete","Hapus User OPD","/user-unit/{id}/{id2}/delete",,"delete",0,"2015-03-08 16:45:45",,1
114,"arinvoiceb","Reg. Bayar Bendahara","/arinvoiceb",,"read",0,"2015-03-08 16:45:45",,1
115,"arinvoiceb-act","Register Bendahara Action","/arinvoiceb/{act}/act",,"read",0,"2015-03-08 16:45:45",,1
116,"arinvoiceb-add","Tambah Reg. Bayar Bendahara","/arinvoiceb/add",,"add",0,"2015-03-08 16:45:45",,1
117,"arinvoiceb-edit","Edit Reg. Bayar Bendahara","/arinvoiceb/{id}/edit",,"edit",0,"2015-03-08 16:45:45",,1
118,"arinvoicewp","Reg. Bayar WP","/arinvoicewp",,"read",0,"2015-03-08 16:45:45",,1
119,"arinvoicewp-act","Register WP Action","/arinvoicewp/{act}/act",,"read",0,"2015-03-08 16:45:45",,1
120,"arinvoicewp-add","Tambah Reg. Bayar WP","/arinvoicewp/add",,"add",0,"2015-03-08 16:45:45",,1
121,"arinvoicewp-edit","Edit Reg. Bayar WP","/arinvoicewp/{id}/edit",,"edit",0,"2015-03-08 16:45:45",,1
122,"arinvoiceb-delete","Hapus Reg. Bayar Bendahara","/arinvoiceb/{id}/delete",,"delete",0,"2015-03-08 16:45:45",,1
123,"arinvoicewp-delete","Hapus Reg. Bayar WP","/arinvoicewp/{id}/delete",,"delete",0,"2015-03-08 16:45:45",,1
\ No newline at end of file \ No newline at end of file
...@@ -193,7 +193,7 @@ def get_form(request, class_form): ...@@ -193,7 +193,7 @@ def get_form(request, class_form):
schema.request = request schema.request = request
return Form(schema, buttons=('simpan','batal')) return Form(schema, buttons=('simpan','batal'))
def save(values, row=None): def save(request, values, row=None):
if not row: if not row:
row = ARInvoice() row = ARInvoice()
row.from_dict(values) row.from_dict(values)
...@@ -252,7 +252,8 @@ def save(values, row=None): ...@@ -252,7 +252,8 @@ def save(values, row=None):
str(bulan).rjust(2,'0'), str(bulan).rjust(2,'0'),
str(tahun).rjust(2,'0'), str(tahun).rjust(2,'0'),
str(row.no_id).rjust(4,'0')]) str(row.no_id).rjust(4,'0')])
row.owner_id = request.user.id
#if values['password']: #if values['password']:
# row.password = values['password'] # row.password = values['password']
DBSession.add(row) DBSession.add(row)
...@@ -262,7 +263,7 @@ def save(values, row=None): ...@@ -262,7 +263,7 @@ def save(values, row=None):
def save_request(values, request, row=None): def save_request(values, request, row=None):
if 'id' in request.matchdict: if 'id' in request.matchdict:
values['id'] = request.matchdict['id'] values['id'] = request.matchdict['id']
row = save(values, row) row = save(request, values, row)
request.session.flash('No Bayar %s sudah disimpan.' % row.kode) request.session.flash('No Bayar %s sudah disimpan.' % row.kode)
def route_list(request): def route_list(request):
...@@ -414,10 +415,11 @@ def view_act(request): ...@@ -414,10 +415,11 @@ def view_act(request):
url_dict = req.matchdict url_dict = req.matchdict
user = req.user user = req.user
if url_dict['act']=='grid': if url_dict['act']=='grid':
u = request.user.id
columns = [] columns = []
columns.append(ColumnDT('id')) columns.append(ColumnDT('id'))
columns.append(ColumnDT('kode')) columns.append(ColumnDT('kode'))
columns.append(ColumnDT('wp_kode')) columns.append(ColumnDT('wp_nama'))
columns.append(ColumnDT('op_kode')) columns.append(ColumnDT('op_kode'))
columns.append(ColumnDT('op_nama')) columns.append(ColumnDT('op_nama'))
columns.append(ColumnDT('rek_nama')) columns.append(ColumnDT('rek_nama'))
...@@ -426,27 +428,8 @@ def view_act(request): ...@@ -426,27 +428,8 @@ def view_act(request):
#columns.append(ColumnDT('bunga')) #columns.append(ColumnDT('bunga'))
columns.append(ColumnDT('jumlah', filter=_DTnumberformat)) columns.append(ColumnDT('jumlah', filter=_DTnumberformat))
columns.append(ColumnDT('unit_nama')) columns.append(ColumnDT('unit_nama'))
if 'g:wp' in group_finder(req.user.email,req): query = DBSession.query(ARInvoice
rows = SubjekPajak.get_by_user(user.id) ).filter(ARInvoice.owner_id==u
ids = [] )
if rows:
for r in rows:
ids.append(r.id)
query = qry_arinv().\
filter(ARInvoice.subjek_pajak_id.in_(ids))
if 'g:bendahara' in group_finder(req.user.email,req):
rows = Pegawai.get_by_user(user.id)
ids = []
if rows:
for r in rows:
ids.append(r.unit_id)
query = qry_arinv().\
filter(ARInvoice.unit_id.in_(ids))
elif req.user.id==1 or 'g:admin' in group_finder(req.user.email,req):
query = qry_arinv()
rowTable = DataTables(req, ARInvoice, query, columns) rowTable = DataTables(req, ARInvoice, query, columns)
return rowTable.output_result() return rowTable.output_result()
...@@ -70,6 +70,11 @@ class AddSchema(colander.Schema): ...@@ -70,6 +70,11 @@ class AddSchema(colander.Schema):
widget=widget.HiddenWidget(), widget=widget.HiddenWidget(),
oid = "subjekpajak_us" oid = "subjekpajak_us"
) )
subjekpajak_un = colander.SchemaNode(
colander.Integer(),
widget=widget.HiddenWidget(),
oid = "subjekpajak_un"
)
unit_id = colander.SchemaNode( unit_id = colander.SchemaNode(
colander.Integer(), colander.Integer(),
widget=widget.HiddenWidget(), widget=widget.HiddenWidget(),
...@@ -264,7 +269,7 @@ def view_act(request): ...@@ -264,7 +269,7 @@ def view_act(request):
d = DBSession.query(User.email).filter(User.id==x).first() d = DBSession.query(User.email).filter(User.id==x).first()
if c == 4: #Untuk login BUD if c == 1: #Untuk login WP
columns = [] columns = []
columns.append(ColumnDT('id')) columns.append(ColumnDT('id'))
columns.append(ColumnDT('subjekpajaks.kode')) columns.append(ColumnDT('subjekpajaks.kode'))
...@@ -273,10 +278,14 @@ def view_act(request): ...@@ -273,10 +278,14 @@ def view_act(request):
columns.append(ColumnDT('pajaks.kode')) columns.append(ColumnDT('pajaks.kode'))
columns.append(ColumnDT('wilayahs.nama')) columns.append(ColumnDT('wilayahs.nama'))
columns.append(ColumnDT('status')) columns.append(ColumnDT('status'))
query = DBSession.query(ObjekPajak).join(SubjekPajak).join(Pajak).join(Wilayah) query = DBSession.query(ObjekPajak).join(SubjekPajak).join(Pajak).join(Wilayah
).filter(ObjekPajak.subjekpajak_id==SubjekPajak.id,
SubjekPajak.email==d
)
rowTable = DataTables(req, ObjekPajak, query, columns) rowTable = DataTables(req, ObjekPajak, query, columns)
return rowTable.output_result() return rowTable.output_result()
elif c == 1: #Untuk login WP
elif c == 2: #Untuk login Bendahara
columns = [] columns = []
columns.append(ColumnDT('id')) columns.append(ColumnDT('id'))
columns.append(ColumnDT('subjekpajaks.kode')) columns.append(ColumnDT('subjekpajaks.kode'))
...@@ -287,7 +296,7 @@ def view_act(request): ...@@ -287,7 +296,7 @@ def view_act(request):
columns.append(ColumnDT('status')) columns.append(ColumnDT('status'))
query = DBSession.query(ObjekPajak).join(SubjekPajak).join(Pajak).join(Wilayah query = DBSession.query(ObjekPajak).join(SubjekPajak).join(Pajak).join(Wilayah
).filter(ObjekPajak.subjekpajak_id==SubjekPajak.id, ).filter(ObjekPajak.subjekpajak_id==SubjekPajak.id,
SubjekPajak.email==d SubjekPajak.user_id==x
) )
rowTable = DataTables(req, ObjekPajak, query, columns) rowTable = DataTables(req, ObjekPajak, query, columns)
return rowTable.output_result() return rowTable.output_result()
...@@ -301,17 +310,15 @@ def view_act(request): ...@@ -301,17 +310,15 @@ def view_act(request):
columns.append(ColumnDT('pajaks.kode')) columns.append(ColumnDT('pajaks.kode'))
columns.append(ColumnDT('wilayahs.nama')) columns.append(ColumnDT('wilayahs.nama'))
columns.append(ColumnDT('status')) columns.append(ColumnDT('status'))
query = DBSession.query(ObjekPajak).join(SubjekPajak).join(Pajak).join(Wilayah query = DBSession.query(ObjekPajak).join(SubjekPajak).join(Pajak).join(Wilayah)
).filter(ObjekPajak.subjekpajak_id==SubjekPajak.id,
SubjekPajak.user_id==x
)
rowTable = DataTables(req, ObjekPajak, query, columns) rowTable = DataTables(req, ObjekPajak, query, columns)
return rowTable.output_result() return rowTable.output_result()
elif url_dict['act']=='hon': elif url_dict['act']=='hon':
term = 'term' in params and params['term'] or '' term = 'term' in params and params['term'] or ''
subjek_pajak_id = 'subjek_pajak_id' in params and params['subjek_pajak_id'] or 0 subjek_pajak_id = 'subjek_pajak_id' in params and params['subjek_pajak_id'] or 0
x = request.user.id x = request.user.id
print'xxxxxxxxxxxxxxxxxxxxxxx',x
rows = DBSession.query(ObjekPajak).join(SubjekPajak).join(Pajak).\ rows = DBSession.query(ObjekPajak).join(SubjekPajak).join(Pajak).\
filter(ObjekPajak.nama.ilike('%%%s%%' % term), filter(ObjekPajak.nama.ilike('%%%s%%' % term),
ObjekPajak.subjekpajak_id==SubjekPajak.id, ObjekPajak.subjekpajak_id==SubjekPajak.id,
......
...@@ -276,9 +276,25 @@ def view_act(request): ...@@ -276,9 +276,25 @@ def view_act(request):
elif url_dict['act']=='hon_ob': elif url_dict['act']=='hon_ob':
term = 'term' in params and params['term'] or '' term = 'term' in params and params['term'] or ''
user_id = 'user_id' in params and params['user_id'] or 0 unit_id = 'unit_id' in params and params['unit_id'] or 0
print '---------------Unit Param----------------',unit_id
rows = DBSession.query(Unit.id, Unit.nama
).filter(Unit.id==unit_id,
Unit.nama.ilike('%%%s%%' % term)).all()
r = []
for k in rows:
d={}
d['id'] = k[0]
d['value'] = k[1]
d['nama'] = k[1]
r.append(d)
print '---------------Unit------------------',r
return r
elif url_dict['act']=='hon_wp':
term = 'term' in params and params['term'] or ''
u = request.user.id u = request.user.id
print '---------------User Param----------------',user_id
print '---------------User Login----------------',u print '---------------User Login----------------',u
a = DBSession.query(UserGroup.group_id).filter(UserGroup.user_id==u).first() a = DBSession.query(UserGroup.group_id).filter(UserGroup.user_id==u).first()
...@@ -325,14 +341,8 @@ def view_act(request): ...@@ -325,14 +341,8 @@ def view_act(request):
return r return r
elif c == 3: #Untuk login Admin elif c == 3: #Untuk login Admin
x = DBSession.query(UserUnit.unit_id).filter(UserUnit.user_id==user_id).first()
y = '%s' % x
z = int(y)
print '---------------Unit_id---------------',z
rows = DBSession.query(Unit.id, Unit.nama rows = DBSession.query(Unit.id, Unit.nama
).filter( Unit.id==z, ).filter(Unit.nama.ilike('%%%s%%' % term)).all()
Unit.nama.ilike('%%%s%%' % term)).all()
r = [] r = []
for k in rows: for k in rows:
d={} d={}
...@@ -344,14 +354,8 @@ def view_act(request): ...@@ -344,14 +354,8 @@ def view_act(request):
return r return r
else: #Untuk login BUD else: #Untuk login BUD
x = DBSession.query(UserUnit.unit_id).filter(UserUnit.user_id==user_id).first()
y = '%s' % x
z = int(y)
print '---------------Unit_id---------------',z
rows = DBSession.query(Unit.id, Unit.nama rows = DBSession.query(Unit.id, Unit.nama
).filter( Unit.id==z, ).filter(Unit.nama.ilike('%%%s%%' % term)).all()
Unit.nama.ilike('%%%s%%' % term)).all()
r = [] r = []
for k in rows: for k in rows:
d={} d={}
...@@ -361,4 +365,4 @@ def view_act(request): ...@@ -361,4 +365,4 @@ def view_act(request):
r.append(d) r.append(d)
print '---------------Unit------------------',r print '---------------Unit------------------',r
return r return r
\ No newline at end of file \ No newline at end of file
\ No newline at end of file \ No newline at end of file
...@@ -229,12 +229,13 @@ ...@@ -229,12 +229,13 @@
</div> </div>
</div> </div>
<script> <script>
/*
$("#unit_id").attr("readonly",${has_permission(request,'arinvoice-edt-unit') and 'false' or 'true'}) $("#unit_id").attr("readonly",${has_permission(request,'arinvoice-edt-unit') and 'false' or 'true'})
$("#unit_nm").attr("readonly",${has_permission(request,'arinvoice-edt-unit') and 'false' or 'true'}) $("#unit_nm").attr("readonly",${has_permission(request,'arinvoice-edt-unit') and 'false' or 'true'})
$("#subjek_pajak_id").attr("readonly",${has_permission(request,'arinvoice-edt-subjek') and 'false' or 'true'}) $("#subjek_pajak_id").attr("readonly",${has_permission(request,'arinvoice-edt-subjek') and 'false' or 'true'})
$("#subjek_pajak_nm").attr("readonly",${has_permission(request,'arinvoice-edt-subjek') and 'false' or 'true'}) $("#subjek_pajak_nm").attr("readonly",${has_permission(request,'arinvoice-edt-subjek') and 'false' or 'true'})
$("#subjek_pajak_us").attr("readonly",${has_permission(request,'arinvoice-edt-subjek') and 'false' or 'true'}) $("#subjek_pajak_us").attr("readonly",${has_permission(request,'arinvoice-edt-subjek') and 'false' or 'true'})
*/
$('#subjek_pajak_nm').bind('typeahead:selected', function(obj, datum, name) { $('#subjek_pajak_nm').bind('typeahead:selected', function(obj, datum, name) {
$('#subjek_pajak_id').val(datum.id); $('#subjek_pajak_id').val(datum.id);
$('#subjek_pajak_us').val(datum.user); $('#subjek_pajak_us').val(datum.user);
......
...@@ -47,6 +47,7 @@ ...@@ -47,6 +47,7 @@
$(document).ready(function () { $(document).ready(function () {
oTable = $('#table1').dataTable({ oTable = $('#table1').dataTable({
"sAjaxSource" : oTableUrl, "sAjaxSource" : oTableUrl,
"bStateSave" : true,
"bServerSide" : true, "bServerSide" : true,
"bProcessing" : true, "bProcessing" : true,
"sDom" : '<"toolbar">lfrtip', "sDom" : '<"toolbar">lfrtip',
......
<html metal:use-macro="load: ../base.pt">
<div metal:fill-slot="content">
<link href="/static/datatables/extensions/TableTools/css/dataTables.tableTools.min.css" rel="stylesheet">
<link href="/static/datatables/media/css/dataTables.bootstrap.css" rel="stylesheet">
<h4>Daftar No. Bayar</h4>
<hr>
<div class="container">
<!--form class="form-inline" role="form" id="frm_upload" name="frm_upload">
<label for="upload" class="control-label">Upload:</label>
<input type="text" class="form-control" id="upload">
<button type="submit" class="btn btn-default">Upload</button>
</form-->
</div>
<p>
<table id="table1" name="table1" class="table table-bordered table-hover table-condensed" >
<thead>
<tr>
<th>ID</th>
<th>Kode</th>
<th>Penyetor</th>
<th>Objek</th>
<th>Uraian</th>
<th>Rekening</th>
<!--th>Pokok</th>
<th>Denda</th>
<th>Bunga</th-->
<th>Jumlah</th>
<th>OPD</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
<script src="/static/datatables/media/js/jquery.dataTables.min.js"></script>
<!--script src="/static/datatables/media/js/jquery.jeditable.js')}"></script-->
<script src="/static/datatables/media/js/jquery.dataTables.ext.js"></script>
<script src="/static/datatables/extensions/TableTools/media/js/ZeroClipboard.js"></script>
<script src="/static/datatables/media/js/dataTables.bootstrap.js"></script>
<script>
var mID;
var oTable;
var iPos;
var oFormUrl = "/arinvoiceb/";
var oTableUrl = oFormUrl+"grid/act";
$(document).ready(function () {
oTable = $('#table1').dataTable({
"sAjaxSource" : oTableUrl,
"bStateSave" : true,
"bServerSide" : true,
"bProcessing" : true,
"sDom" : '<"toolbar">lfrtip',
"bScrollCollapse" : true,
"bSort" : true,
"bInfo" : false,
"bFilter" : true,
"bAutoWidth" : false,
"bPaginate" : true,
"sPaginationType" : "full_numbers",
"lengthMenu": [
[10, 25, 50, -1],
[10, 25, 50, "All"]
],
"aoColumnDefs": [
{"bSearchable": false, "bVisible": false, "aTargets": [0]}
],
"aoColumns": [
null,
{"sWidth": "100px", "sClass": "left"},
{"sWidth": "30px", "sClass": "center"},
{"sWidth": "30px", "sClass": "center"},
null,
null,
{"sWidth": "75px", "sClass": "right"},
//{"sWidth": "75px", "sClass": "center"},
//{"sWidth": "40px", "sClass": "center"},
//{"sWidth": "40px", "sClass": "center"},
null
],
});
var tb_array = [
'<div class="btn-group pull-left">',
' <button id="btn_tambah" class="btn btn btn-primary pull-left" type="button">Tambah</button>',
' <button id="btn_edit" class="btn btn btn-primary pull-left" type="button">Edit</button>',
' <button id="btn_delete" class="btn btn btn-danger pull-left" type="button">Hapus</button>',
' <button id="btn_print" class="btn btn btn-primary pull-left" type="button">Cetak</button>',
' <button id="btn_close" class="btn btn btn-warning" type="button">Tutup</button>',
' &nbsp;',
'</div>',
];
var tb = tb_array.join(' ');
$("div.toolbar").html(tb);
$('#table1 tbody').on('click', 'tr', function () {
if ($(this).hasClass('selected')) {
mID = '';
$(this).removeClass('selected');
} else {
iPos = oTable.fnGetPosition(this);
var aData = oTable.fnGetData(iPos);
mID = aData[0];
oTable.$('tr.selected').removeClass('selected');
$(this).addClass('selected');
}
});
$('#btn_tambah').click(function () {
window.location = oFormUrl+'add';
});
$('#btn_edit').click(function () {
if (mID) {
window.location = oFormUrl+mID+'/edit';
} else {
alert('Silahkan pilih data yang akan diedit');
}
});
$('#btn_print').click(function () {
url = "/reports/act/r100"
window.open(url);
});
$('#btn_close').click(function () {
window.location = "/"
});
$('#btn_delete').click(function () {
if (mID) {
var hapus = confirm('Hapus data ini?');
if (hapus == true) {
window.location = oFormUrl+mID+'/delete';
};
} else {
alert('Silahkan pilih data yang akan dihapus');
}
});
});
</script>
</div>
</html>
<html metal:use-macro="load: ../base.pt">
<div metal:fill-slot="content">
<link href="/static/datatables/extensions/TableTools/css/dataTables.tableTools.min.css" rel="stylesheet">
<link href="/static/datatables/media/css/dataTables.bootstrap.css" rel="stylesheet">
<h4>Daftar No. Bayar</h4>
<hr>
<div class="container">
<!--form class="form-inline" role="form" id="frm_upload" name="frm_upload">
<label for="upload" class="control-label">Upload:</label>
<input type="text" class="form-control" id="upload">
<button type="submit" class="btn btn-default">Upload</button>
</form-->
</div>
<p>
<table id="table1" name="table1" class="table table-bordered table-hover table-condensed" >
<thead>
<tr>
<th>ID</th>
<th>Kode</th>
<th>Penyetor</th>
<th>Objek</th>
<th>Uraian</th>
<th>Rekening</th>
<!--th>Pokok</th>
<th>Denda</th>
<th>Bunga</th-->
<th>Jumlah</th>
<th>OPD</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
<script src="/static/datatables/media/js/jquery.dataTables.min.js"></script>
<!--script src="/static/datatables/media/js/jquery.jeditable.js')}"></script-->
<script src="/static/datatables/media/js/jquery.dataTables.ext.js"></script>
<script src="/static/datatables/extensions/TableTools/media/js/ZeroClipboard.js"></script>
<script src="/static/datatables/media/js/dataTables.bootstrap.js"></script>
<script>
var mID;
var oTable;
var iPos;
var oFormUrl = "/arinvoicewp/";
var oTableUrl = oFormUrl+"grid/act";
$(document).ready(function () {
oTable = $('#table1').dataTable({
"sAjaxSource" : oTableUrl,
"bStateSave" : true,
"bServerSide" : true,
"bProcessing" : true,
"sDom" : '<"toolbar">lfrtip',
"bScrollCollapse" : true,
"bSort" : true,
"bInfo" : false,
"bFilter" : true,
"bAutoWidth" : false,
"bPaginate" : true,
"sPaginationType" : "full_numbers",
"lengthMenu": [
[10, 25, 50, -1],
[10, 25, 50, "All"]
],
"aoColumnDefs": [
{"bSearchable": false, "bVisible": false, "aTargets": [0]}
],
"aoColumns": [
null,
{"sWidth": "100px", "sClass": "left"},
{"sWidth": "30px", "sClass": "center"},
{"sWidth": "30px", "sClass": "center"},
null,
null,
{"sWidth": "75px", "sClass": "right"},
//{"sWidth": "75px", "sClass": "center"},
//{"sWidth": "40px", "sClass": "center"},
//{"sWidth": "40px", "sClass": "center"},
null
],
});
var tb_array = [
'<div class="btn-group pull-left">',
' <button id="btn_tambah" class="btn btn btn-primary pull-left" type="button">Tambah</button>',
' <button id="btn_edit" class="btn btn btn-primary pull-left" type="button">Edit</button>',
' <button id="btn_delete" class="btn btn btn-danger pull-left" type="button">Hapus</button>',
' <button id="btn_print" class="btn btn btn-primary pull-left" type="button">Cetak</button>',
' <button id="btn_close" class="btn btn btn-warning" type="button">Tutup</button>',
' &nbsp;',
'</div>',
];
var tb = tb_array.join(' ');
$("div.toolbar").html(tb);
$('#table1 tbody').on('click', 'tr', function () {
if ($(this).hasClass('selected')) {
mID = '';
$(this).removeClass('selected');
} else {
iPos = oTable.fnGetPosition(this);
var aData = oTable.fnGetData(iPos);
mID = aData[0];
oTable.$('tr.selected').removeClass('selected');
$(this).addClass('selected');
}
});
$('#btn_tambah').click(function () {
window.location = oFormUrl+'add';
});
$('#btn_edit').click(function () {
if (mID) {
window.location = oFormUrl+mID+'/edit';
} else {
alert('Silahkan pilih data yang akan diedit');
}
});
$('#btn_print').click(function () {
url = "/reports/act/r100"
window.open(url);
});
$('#btn_close').click(function () {
window.location = "/"
});
$('#btn_delete').click(function () {
if (mID) {
var hapus = confirm('Hapus data ini?');
if (hapus == true) {
window.location = oFormUrl+mID+'/delete';
};
} else {
alert('Silahkan pilih data yang akan dihapus');
}
});
});
</script>
</div>
</html>
...@@ -48,6 +48,7 @@ ...@@ -48,6 +48,7 @@
$(document).ready(function () { $(document).ready(function () {
oTable = $('#table1').dataTable({ oTable = $('#table1').dataTable({
"sAjaxSource" : oTableUrl, "sAjaxSource" : oTableUrl,
"bStateSave" : true,
"bServerSide" : true, "bServerSide" : true,
"bProcessing" : true, "bProcessing" : true,
"sDom" : '<"toolbar">lfrtip', "sDom" : '<"toolbar">lfrtip',
......
...@@ -123,6 +123,7 @@ ...@@ -123,6 +123,7 @@
$(document).ready(function () { $(document).ready(function () {
oTable = $('#table1').dataTable({ oTable = $('#table1').dataTable({
"sAjaxSource" : oTableUrl, "sAjaxSource" : oTableUrl,
"bStateSave" : true,
"bServerSide" : true, "bServerSide" : true,
"bProcessing" : true, "bProcessing" : true,
"sDom" : '<"toolbar">lfrtip', "sDom" : '<"toolbar">lfrtip',
......
...@@ -44,6 +44,7 @@ ...@@ -44,6 +44,7 @@
$(document).ready(function () { $(document).ready(function () {
oTable = $('#table1').dataTable({ oTable = $('#table1').dataTable({
"sAjaxSource" : oTableUrl, "sAjaxSource" : oTableUrl,
"bStateSave" : true,
"bServerSide" : true, "bServerSide" : true,
"bProcessing" : true, "bProcessing" : true,
"sDom" : '<"toolbar">lfrtip', "sDom" : '<"toolbar">lfrtip',
......
...@@ -51,6 +51,7 @@ ...@@ -51,6 +51,7 @@
$(document).ready(function () { $(document).ready(function () {
oTable = $('#table1').dataTable({ oTable = $('#table1').dataTable({
"sAjaxSource" : oTableUrl, "sAjaxSource" : oTableUrl,
"bStateSave" : true,
"bServerSide" : true, "bServerSide" : true,
"bProcessing" : true, "bProcessing" : true,
"sDom" : '<"toolbar">lfrtip', "sDom" : '<"toolbar">lfrtip',
......
...@@ -50,7 +50,9 @@ ...@@ -50,7 +50,9 @@
<li class="dropdown" tal:attributes="class request.matched_route.name in ['wp', 'wp-add', 'wp-edit', 'wp-delete'] and 'active'"> <li class="dropdown" tal:attributes="class request.matched_route.name in ['wp', 'wp-add', 'wp-edit', 'wp-delete'] and 'active'">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">e-Payment<b class="caret"></b></a> <a href="#" class="dropdown-toggle" data-toggle="dropdown">e-Payment<b class="caret"></b></a>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
<li><a href="/arinvoice">No. Bayar</a></li> <li><a href="/arinvoice">No. Bayar (BUD)</a></li>
<li><a href="/arinvoiceb">No. Bayar (Bendahara)</a></li>
<li><a href="/arinvoicewp">No. Bayar (WP)</a></li>
<li><a href="/wp">Penyetor</a></li> <li><a href="/wp">Penyetor</a></li>
<li><a href="/op">Objek</a></li> <li><a href="/op">Objek</a></li>
</ul> </ul>
......
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
$(document).ready(function () { $(document).ready(function () {
oTable = $('#table1').dataTable({ oTable = $('#table1').dataTable({
"sAjaxSource" : oTableUrl, "sAjaxSource" : oTableUrl,
"bStateSave" : true,
"bServerSide" : true, "bServerSide" : true,
"bProcessing" : true, "bProcessing" : true,
"sDom" : '<"toolbar">lfrtip', "sDom" : '<"toolbar">lfrtip',
......
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
$(document).ready(function () { $(document).ready(function () {
oTable = $('#table1').dataTable({ oTable = $('#table1').dataTable({
"sAjaxSource" : oTableUrl, "sAjaxSource" : oTableUrl,
"bStateSave" : true,
"bServerSide" : true, "bServerSide" : true,
"bProcessing" : true, "bProcessing" : true,
"sDom" : '<"toolbar">lfrtip', "sDom" : '<"toolbar">lfrtip',
......
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
$(document).ready(function () { $(document).ready(function () {
oTable = $('#table1').dataTable({ oTable = $('#table1').dataTable({
"sAjaxSource": oTableUrl, "sAjaxSource": oTableUrl,
"bStateSave" : true,
"bServerSide": true, "bServerSide": true,
"bProcessing": true, "bProcessing": true,
"sDom": '<"toolbar">lfrtip', "sDom": '<"toolbar">lfrtip',
......
...@@ -47,6 +47,7 @@ ...@@ -47,6 +47,7 @@
$(document).ready(function () { $(document).ready(function () {
oTable = $('#table1').dataTable({ oTable = $('#table1').dataTable({
"sAjaxSource": oTableUrl, "sAjaxSource": oTableUrl,
"bStateSave" : true,
"bServerSide": true, "bServerSide": true,
"bProcessing": true, "bProcessing": true,
"sDom": '<"toolbar">lfrtip', "sDom": '<"toolbar">lfrtip',
......
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
$(document).ready(function () { $(document).ready(function () {
oTable = $('#table1').dataTable({ oTable = $('#table1').dataTable({
"sAjaxSource" : oTableUrl, "sAjaxSource" : oTableUrl,
"bStateSave" : true,
"bServerSide" : true, "bServerSide" : true,
"bProcessing" : true, "bProcessing" : true,
"sDom" : '<"toolbar">lfrtip', "sDom" : '<"toolbar">lfrtip',
......
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
$(document).ready(function () { $(document).ready(function () {
oTable = $('#table1').dataTable({ oTable = $('#table1').dataTable({
"sAjaxSource": oTableUrl, "sAjaxSource": oTableUrl,
"bStateSave" : true,
"bServerSide": true, "bServerSide": true,
"bProcessing": true, "bProcessing": true,
"sDom": '<"toolbar">lfrtip', "sDom": '<"toolbar">lfrtip',
......
...@@ -15,6 +15,9 @@ ...@@ -15,6 +15,9 @@
<div tal:define="field form['subjekpajak_us']"> <div tal:define="field form['subjekpajak_us']">
${structure:field.serialize()} ${structure:field.serialize()}
</div> </div>
<div tal:define="field form['subjekpajak_un']">
${structure:field.serialize()}
</div>
<!--unit_id -------------------------------> <!--unit_id ------------------------------->
<div tal:define="field form['unit_id']"> <div tal:define="field form['unit_id']">
${structure:field.serialize()} ${structure:field.serialize()}
...@@ -122,13 +125,14 @@ ...@@ -122,13 +125,14 @@
$('#subjekpajak_nm').bind('typeahead:selected', function(obj, datum, name) { $('#subjekpajak_nm').bind('typeahead:selected', function(obj, datum, name) {
$('#subjekpajak_id').val(datum.id); $('#subjekpajak_id').val(datum.id);
$('#subjekpajak_us').val(datum.user); $('#subjekpajak_us').val(datum.user);
$('#subjekpajak_un').val(datum.unit);
//Untuk headof OPD //Untuk headof OPD
$('#unit_nm').typeahead({ $('#unit_nm').typeahead({
"hint" : true, "hint" : true,
"highlight": true, "highlight": true,
"minLength": 1, "minLength": 1,
"remote" : "/skpd/hon_ob/act?user_id="+$("#subjekpajak_us").val()+"&term=%QUERY", "remote" : "/skpd/hon_ob/act?unit_id="+$("#subjekpajak_un").val()+"&term=%QUERY",
},{ },{
"name" : 'unit_nm', "name" : 'unit_nm',
"displayKey": 'value', "displayKey": 'value',
......
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
$(document).ready(function () { $(document).ready(function () {
oTable = $('#table1').dataTable({ oTable = $('#table1').dataTable({
"sAjaxSource" : oTableUrl, "sAjaxSource" : oTableUrl,
"bStateSave" : true,
"bServerSide" : true, "bServerSide" : true,
"bProcessing" : true, "bProcessing" : true,
"sDom" : '<"toolbar">lfrtip', "sDom" : '<"toolbar">lfrtip',
......
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
$(document).ready(function () { $(document).ready(function () {
oTable = $('#table1').dataTable({ oTable = $('#table1').dataTable({
"sAjaxSource" : oTableUrl, "sAjaxSource" : oTableUrl,
"bStateSave" : true,
"bServerSide" : true, "bServerSide" : true,
"bProcessing" : true, "bProcessing" : true,
"sDom" : '<"toolbar">lfrtip', "sDom" : '<"toolbar">lfrtip',
......
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
$(document).ready(function () { $(document).ready(function () {
oTable = $('#table1').dataTable({ oTable = $('#table1').dataTable({
"sAjaxSource": oTableUrl, "sAjaxSource": oTableUrl,
"bStateSave" : true,
"bServerSide": true, "bServerSide": true,
"bProcessing": true, "bProcessing": true,
"sDom": '<"toolbar">lfrtip', "sDom": '<"toolbar">lfrtip',
......
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
$(document).ready(function () { $(document).ready(function () {
oTable = $('#table1').dataTable({ oTable = $('#table1').dataTable({
"sAjaxSource" : oTableUrl, "sAjaxSource" : oTableUrl,
"bStateSave" : true,
"bServerSide" : true, "bServerSide" : true,
"bProcessing" : true, "bProcessing" : true,
"sDom" : '<"toolbar">lfrtip', "sDom" : '<"toolbar">lfrtip',
......
...@@ -49,6 +49,7 @@ ...@@ -49,6 +49,7 @@
"bFilter" : true, "bFilter" : true,
"bAutoWidth" : false, "bAutoWidth" : false,
"bPaginate" : true, "bPaginate" : true,
"bStateSave" : true,
"sPaginationType" : "full_numbers", "sPaginationType" : "full_numbers",
"lengthMenu": [ "lengthMenu": [
[10, 25, 50, -1], [10, 25, 50, -1],
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
$(document).ready(function () { $(document).ready(function () {
oTable = $('#table1').dataTable({ oTable = $('#table1').dataTable({
"sAjaxSource" : oTableUrl, "sAjaxSource" : oTableUrl,
"bStateSave" : true,
"bServerSide" : true, "bServerSide" : true,
"bProcessing" : true, "bProcessing" : true,
"sDom" : '<"toolbar">lfrtip', "sDom" : '<"toolbar">lfrtip',
......
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
$(document).ready(function () { $(document).ready(function () {
oTable = $('#table1').dataTable({ oTable = $('#table1').dataTable({
"sAjaxSource": oTableUrl, "sAjaxSource": oTableUrl,
"bStateSave" : true,
"bServerSide": true, "bServerSide": true,
"bProcessing": true, "bProcessing": true,
"sDom": '<"toolbar">lfrtip', "sDom": '<"toolbar">lfrtip',
......
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
$(document).ready(function () { $(document).ready(function () {
oTable = $('#table1').dataTable({ oTable = $('#table1').dataTable({
"sAjaxSource" : oTableUrl, "sAjaxSource" : oTableUrl,
"bStateSave" : true,
"bServerSide" : true, "bServerSide" : true,
"bProcessing" : true, "bProcessing" : true,
"sDom" : '<"toolbar">lfrtip', "sDom" : '<"toolbar">lfrtip',
......
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
$(document).ready(function () { $(document).ready(function () {
oTable = $('#table1').dataTable({ oTable = $('#table1').dataTable({
"sAjaxSource" : oTableUrl, "sAjaxSource" : oTableUrl,
"bStateSave" : true,
"bServerSide" : true, "bServerSide" : true,
"bProcessing" : true, "bProcessing" : true,
"sDom" : '<"toolbar">lfrtip', "sDom" : '<"toolbar">lfrtip',
......
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
$(document).ready(function () { $(document).ready(function () {
oTable = $('#table1').dataTable({ oTable = $('#table1').dataTable({
"sAjaxSource" : oTableUrl, "sAjaxSource" : oTableUrl,
"bStateSave" : true,
"bServerSide" : true, "bServerSide" : true,
"bProcessing" : true, "bProcessing" : true,
"sDom" : '<"toolbar">lfrtip', "sDom" : '<"toolbar">lfrtip',
......
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
$(document).ready(function () { $(document).ready(function () {
oTable = $('#table1').dataTable({ oTable = $('#table1').dataTable({
"sAjaxSource" : oTableUrl, "sAjaxSource" : oTableUrl,
"bStateSave" : true,
"bServerSide" : true, "bServerSide" : true,
"bProcessing" : true, "bProcessing" : true,
"sDom" : '<"toolbar">lfrtip', "sDom" : '<"toolbar">lfrtip',
......
...@@ -7,8 +7,25 @@ ...@@ -7,8 +7,25 @@
<fieldset class="deformFormFieldset"> <fieldset class="deformFormFieldset">
<input type="hidden" name="_charset_" /> <input type="hidden" name="_charset_" />
<input type="hidden" name="__formid__" value="deform"/> <input type="hidden" name="__formid__" value="deform"/>
<div class="form-group">
<!--unit_id ------------------------------->
<div tal:define="field form['unit_id']">
${structure:field.serialize()}
</div>
</div>
<div class="col-md-12"> <div class="col-md-12">
<!--unit_id ------------------------------->
<div class="form-group" tal:define="field form['unit_nm']" id="item-${field.oid}">
<label for="${field.oid}" class="control-label col-md-3" id="req-${field.oid}">
${field.title}<span id="error-${field.oid}" class="text text-danger"
tal:condition="field.required">&nbsp*</span></label>
<div class="col-md-9">
${structure:field.serialize()}
<p id="error-${field.oid}" class="help-block" tal:condition="field.error"
tal:repeat="error field.error.messages()">
${error}</p>
</div>
</div>
<!--kode -------------------------------> <!--kode ------------------------------->
<div class="form-group" tal:define="field form['kode']" id="item-${field.oid}"> <div class="form-group" tal:define="field form['kode']" id="item-${field.oid}">
<label for="${field.oid}" class="control-label col-md-3" id="req-${field.oid}"> <label for="${field.oid}" class="control-label col-md-3" id="req-${field.oid}">
...@@ -154,7 +171,22 @@ ...@@ -154,7 +171,22 @@
</div> </div>
</div> </div>
</div> </div>
<script>
//Untuk headof OPD
$('#unit_nm').typeahead({
"hint" : true,
"highlight": true,
"minLength": 1,
"remote" : "/skpd/hon_wp/act?term=%QUERY",
},{
"name" : 'unit_nm',
"displayKey": 'value',
});
$('#unit_nm').bind('typeahead:selected', function(obj, datum, name) {
$('#unit_id').val(datum.id);
});
</script>
</fieldset> </fieldset>
</form> </form>
</div> </div>
......
...@@ -7,8 +7,25 @@ ...@@ -7,8 +7,25 @@
<fieldset class="deformFormFieldset"> <fieldset class="deformFormFieldset">
<input type="hidden" name="_charset_" /> <input type="hidden" name="_charset_" />
<input type="hidden" name="__formid__" value="deform"/> <input type="hidden" name="__formid__" value="deform"/>
<div class="form-group">
<!--unit_id ------------------------------->
<div tal:define="field form['unit_id']">
${structure:field.serialize()}
</div>
</div>
<div class="col-md-12"> <div class="col-md-12">
<!--unit_id ------------------------------->
<div class="form-group" tal:define="field form['unit_nm']" id="item-${field.oid}">
<label for="${field.oid}" class="control-label col-md-3" id="req-${field.oid}">
${field.title}<span id="error-${field.oid}" class="text text-danger"
tal:condition="field.required">&nbsp*</span></label>
<div class="col-md-9">
${structure:field.serialize()}
<p id="error-${field.oid}" class="help-block" tal:condition="field.error"
tal:repeat="error field.error.messages()">
${error}</p>
</div>
</div>
<!--kode -------------------------------> <!--kode ------------------------------->
<div class="form-group" tal:define="field form['kode']" id="item-${field.oid}"> <div class="form-group" tal:define="field form['kode']" id="item-${field.oid}">
<label for="${field.oid}" class="control-label col-md-3" id="req-${field.oid}"> <label for="${field.oid}" class="control-label col-md-3" id="req-${field.oid}">
...@@ -154,13 +171,28 @@ ...@@ -154,13 +171,28 @@
</div> </div>
</div> </div>
</div> </div>
<script> <script>
var email = $('#email').val(); //Untuk readonly email
if(email!=''){ var email = $('#email').val();
$('#email').attr('readonly', true) if(email!=''){
} $('#email').attr('readonly', true)
</script> }
//Untuk headof OPD
$('#unit_nm').typeahead({
"hint" : true,
"highlight": true,
"minLength": 1,
"remote" : "/skpd/hon_wp/act?term=%QUERY",
},{
"name" : 'unit_nm',
"displayKey": 'value',
});
$('#unit_nm').bind('typeahead:selected', function(obj, datum, name) {
$('#unit_id').val(datum.id);
});
</script>
</fieldset> </fieldset>
</form> </form>
</div> </div>
......
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
$(document).ready(function () { $(document).ready(function () {
oTable = $('#table1').dataTable({ oTable = $('#table1').dataTable({
"sAjaxSource" : oTableUrl, "sAjaxSource" : oTableUrl,
"bStateSave" : true,
"bServerSide" : true, "bServerSide" : true,
"bProcessing" : true, "bProcessing" : true,
"sDom" : '<"toolbar">lfrtip', "sDom" : '<"toolbar">lfrtip',
......
File mode changed
...@@ -16,7 +16,8 @@ from ..tools import (email_validator,BULANS, captcha_submit, get_settings) ...@@ -16,7 +16,8 @@ from ..tools import (email_validator,BULANS, captcha_submit, get_settings)
from ..models import DBSession, User, UserGroup, Group from ..models import DBSession, User, UserGroup, Group
from ..models.isipkd import( from ..models.isipkd import(
SubjekPajak, SubjekPajak,
ARInvoice ARInvoice,
Unit,
) )
from datatables import ( from datatables import (
...@@ -147,7 +148,18 @@ class AddSchema(colander.Schema): ...@@ -147,7 +148,18 @@ class AddSchema(colander.Schema):
missing=colander.drop, missing=colander.drop,
oid = 'email' oid = 'email'
) )
unit_id = colander.SchemaNode(
colander.Integer(),
widget=widget.HiddenWidget(),
oid="unit_id",
title="OPD",
)
unit_nm = colander.SchemaNode(
colander.String(),
title="OPD",
oid="unit_nm"
)
class EditSchema(AddSchema): class EditSchema(AddSchema):
id = colander.SchemaNode(colander.Integer(), id = colander.SchemaNode(colander.Integer(),
missing=colander.drop, missing=colander.drop,
...@@ -165,12 +177,29 @@ def get_form(request, class_form): ...@@ -165,12 +177,29 @@ def get_form(request, class_form):
def save(request,values, row=None): def save(request,values, row=None):
login = None login = None
if 'login' in values and values['login']: # and int(values['user_id'])==0:
if not row:
row = SubjekPajak()
row.from_dict(values)
#Sementara untuk user yg masuk ke Subjek adalah user yg login dan yg menginputkan data subjek (Bukan subjek yg dibuatkan user login)
if login:
row.user_id=request.user.id #login.id
else:
row.user_id=request.user.id
if not row.user_id:
row.user_id=None
DBSession.add(row)
DBSession.flush()
if 'login' in values and values['login']:
login = User() login = User()
login.user_password = values['kode']
login.status = values['status'] login.status = values['status']
login.user_name = values['email'] login.user_name = values['email']
login.email = values['email'] login.email = values['email']
login.password = values['kode']
DBSession.add(login) DBSession.add(login)
DBSession.flush() DBSession.flush()
...@@ -183,22 +212,7 @@ def save(request,values, row=None): ...@@ -183,22 +212,7 @@ def save(request,values, row=None):
usergroup.group_id = DBSession.query(Group.id).filter_by(group_name='wp').scalar() usergroup.group_id = DBSession.query(Group.id).filter_by(group_name='wp').scalar()
DBSession.add(usergroup) DBSession.add(usergroup)
DBSession.flush() DBSession.flush()
if not row:
row = SubjekPajak()
row.from_dict(values)
#Sementara untuk user yg masuk ke Subjek adalah user yg login dan yg menginputkan data subjek (Bukan subjek yg dibuatkan user login)
if login:
row.user_id=request.user.id #login.id
else:
row.user_id=request.user.id
if not row.user_id:
row.user_id=None
DBSession.add(row)
DBSession.flush()
return row return row
def save_request(values, request, row=None): def save_request(values, request, row=None):
...@@ -308,13 +322,6 @@ def view_edit(request): ...@@ -308,13 +322,6 @@ def view_edit(request):
else: else:
request.session.flash('Email harus diisi.','error') request.session.flash('Email harus diisi.','error')
return HTTPFound(location=request.route_url('wp-edit',id=row.id)) return HTTPFound(location=request.route_url('wp-edit',id=row.id))
else:
if b != '':
c = "%s" % b
cek = DBSession.query(User).filter(User.email==c).first()
if cek :
request.session.flash('Email sudah digunakan.', 'error')
return HTTPFound(location=request.route_url('wp-edit',id=row.id))
try: try:
c = form.validate(controls) c = form.validate(controls)
...@@ -359,10 +366,12 @@ def view_edit(request): ...@@ -359,10 +366,12 @@ def view_edit(request):
else: else:
values['email'] = row.email values['email'] = row.email
cek = DBSession.query(User).filter(User.email==row.email).first() #cek = DBSession.query(User).filter(User.email==row.email).first()
if cek: #if cek:
values['login'] = True # values['login'] = True
values['unit_nm'] = row and row.units.nama or None
form.set_appstruct(values) form.set_appstruct(values)
return dict(form=form) return dict(form=form)
...@@ -456,7 +465,7 @@ def view_act(request): ...@@ -456,7 +465,7 @@ def view_act(request):
if z == 1: if z == 1:
a = DBSession.query(User.email).filter(User.id==u).first() a = DBSession.query(User.email).filter(User.id==u).first()
print '----------------Email---------------------',a print '----------------Email---------------------',a
rows = DBSession.query(SubjekPajak.id, SubjekPajak.nama, SubjekPajak.user_id rows = DBSession.query(SubjekPajak.id, SubjekPajak.nama, SubjekPajak.user_id, SubjekPajak.unit_id
).filter(SubjekPajak.email==a, ).filter(SubjekPajak.email==a,
SubjekPajak.nama.ilike('%%%s%%' % term) SubjekPajak.nama.ilike('%%%s%%' % term)
).all() ).all()
...@@ -466,13 +475,14 @@ def view_act(request): ...@@ -466,13 +475,14 @@ def view_act(request):
d['id'] = k[0] d['id'] = k[0]
d['value'] = k[1] d['value'] = k[1]
d['user'] = k[2] d['user'] = k[2]
d['unit'] = k[3]
r.append(d) r.append(d)
print '----------------Penyetor------------------',r print '----------------Penyetor------------------',r
return r return r
elif z == 2: elif z == 2:
print '----------------User_id-------------------',u print '----------------User_id-------------------',u
rows = DBSession.query(SubjekPajak.id, SubjekPajak.nama, SubjekPajak.user_id rows = DBSession.query(SubjekPajak.id, SubjekPajak.nama, SubjekPajak.user_id, SubjekPajak.unit_id
).filter(SubjekPajak.user_id==u, ).filter(SubjekPajak.user_id==u,
SubjekPajak.nama.ilike('%%%s%%' % term) SubjekPajak.nama.ilike('%%%s%%' % term)
).all() ).all()
...@@ -482,12 +492,13 @@ def view_act(request): ...@@ -482,12 +492,13 @@ def view_act(request):
d['id'] = k[0] d['id'] = k[0]
d['value'] = k[1] d['value'] = k[1]
d['user'] = k[2] d['user'] = k[2]
d['unit'] = k[3]
r.append(d) r.append(d)
print '----------------Penyetor------------------',r print '----------------Penyetor------------------',r
return r return r
else: else:
rows = DBSession.query(SubjekPajak.id, SubjekPajak.nama, SubjekPajak.user_id rows = DBSession.query(SubjekPajak.id, SubjekPajak.nama, SubjekPajak.user_id, SubjekPajak.unit_id
).filter(SubjekPajak.nama.ilike('%%%s%%' % term) ).filter(SubjekPajak.nama.ilike('%%%s%%' % term)
).all() ).all()
r = [] r = []
...@@ -496,6 +507,7 @@ def view_act(request): ...@@ -496,6 +507,7 @@ def view_act(request):
d['id'] = k[0] d['id'] = k[0]
d['value'] = k[1] d['value'] = k[1]
d['user'] = k[2] d['user'] = k[2]
d['unit'] = k[3]
r.append(d) r.append(d)
print '----------------Penyetor------------------',r print '----------------Penyetor------------------',r
return r return r
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!