Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Kunto
/
backoffice
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit aacf6f6b
authored
Oct 11, 2019
by
yasir
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
update filter tanggal
1 parent
2f1f06be
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
141 additions
and
3 deletions
src/agratek/api/merchant/views/payment_list.py
src/agratek/api/merchant/views/purchase_list.py
src/agratek/api/merchant/views/templates/payment/list.pt
src/agratek/api/merchant/views/templates/purchase/list.pt
src/agratek/api/merchant/views/payment_list.py
View file @
aacf6f6
...
...
@@ -11,6 +11,7 @@ from . import BaseView
from
..models
import
(
DBSession
,
PartnerPay
,
Partner
)
from
opensipkd.base.tools
import
format_json
from
opensipkd.base.tools.db
import
column_concat
from
datetime
import
datetime
status_payment
=
(
(
9999
,
'--Semua--'
),
...
...
@@ -34,6 +35,16 @@ class ViewData(BaseView):
colander
.
String
(),
oid
=
"status"
,
widget
=
widget
.
SelectWidget
(
values
=
status_payment
,
css_class
=
'form-toolbar'
)
)
awal
=
colander
.
SchemaNode
(
colander
.
String
(),
oid
=
"awal"
,
title
=
"Tgl."
)
akhir
=
colander
.
SchemaNode
(
colander
.
String
(),
oid
=
"akhir"
,
title
=
"-"
)
toolbar
=
ToolbarSchema
(
Validator
=
form_validator
)
toolbar
.
request
=
self
.
req
...
...
@@ -45,6 +56,7 @@ class ViewData(BaseView):
'columns'
:
[
dict
(
title
=
"ID"
),
dict
(
title
=
"No. Invoice"
),
dict
(
title
=
"Tanggal"
),
dict
(
title
=
"Customer"
),
dict
(
title
=
"Vendor"
),
dict
(
title
=
"Amount"
),
...
...
@@ -53,6 +65,7 @@ class ViewData(BaseView):
'column_data'
:
[
dict
(
data
=
"id"
,
width
=
"0px"
),
dict
(
data
=
"nomor"
,
width
=
"150px"
),
dict
(
data
=
"created"
),
dict
(
data
=
"customer"
),
dict
(
data
=
"vendor"
),
dict
(
data
=
"amount"
,
width
=
"100px"
),
...
...
@@ -79,6 +92,19 @@ class ViewData(BaseView):
request
=
self
.
req
url_dict
=
request
.
matchdict
act
=
url_dict
[
'act'
]
def
filter_tanggal
(
query
,
field
):
awal
=
request
.
session
[
'awal'
]
+
' 00:00:00'
#None
akhir
=
request
.
session
[
'akhir'
]
+
' 23:59:59'
#None
if
awal
and
akhir
:
tglawal
=
datetime
.
strptime
(
awal
,
'
%
d-
%
m-
%
Y
%
H:
%
M:
%
S'
)
tglakhir
=
datetime
.
strptime
(
akhir
,
'
%
d-
%
m-
%
Y
%
H:
%
M:
%
S'
)
query
=
query
.
filter
(
field
.
between
(
tglawal
,
tglakhir
))
return
query
if
act
==
"grid"
:
status
=
9999
if
'status'
in
request
.
params
:
...
...
@@ -90,6 +116,7 @@ class ViewData(BaseView):
columns
=
[
ColumnDT
(
PartnerPay
.
id
,
mData
=
'id'
),
ColumnDT
(
PartnerPay
.
cust_inv_no
,
mData
=
'nomor'
),
ColumnDT
(
PartnerPay
.
created
,
mData
=
'created'
),
ColumnDT
(
column_concat
([
PartnerPay
.
inv_cust_nm
,
...
...
@@ -116,6 +143,7 @@ class ViewData(BaseView):
query
=
query
.
filter
(
PartnerPay
.
status
<=
status
)
else
:
query
=
query
.
filter
(
PartnerPay
.
status
==
status
)
filter_tanggal
(
query
,
PartnerPay
.
created
)
row_table
=
DataTables
(
request
.
GET
,
query
,
columns
)
return
row_table
.
output_result
()
...
...
src/agratek/api/merchant/views/purchase_list.py
View file @
aacf6f6
...
...
@@ -10,6 +10,7 @@ from sqlalchemy.orm import aliased
from
.
import
BaseView
from
..models
import
(
DBSession
,
H2hArInvoice
,
H2hArInvoiceDet
,
Partner
,
Produk
)
from
opensipkd.base.tools
import
format_json
from
datetime
import
datetime
status_purchase
=
(
(
9999
,
'--Semua--'
),
...
...
@@ -48,6 +49,16 @@ class ViewData(BaseView):
widget
=
widget
.
SelectWidget
(
values
=
status_purchase
,
css_class
=
'form-toolbar'
),
title
=
"Status"
)
awal
=
colander
.
SchemaNode
(
colander
.
String
(),
oid
=
"awal"
,
title
=
"Tgl."
)
akhir
=
colander
.
SchemaNode
(
colander
.
String
(),
oid
=
"akhir"
,
title
=
"-"
)
toolbar
=
ToolbarSchema
(
Validator
=
form_validator
)
toolbar
.
request
=
self
.
req
...
...
@@ -60,6 +71,7 @@ class ViewData(BaseView):
'columns'
:
[
dict
(
title
=
"ID"
),
dict
(
title
=
"No.Invoice"
),
dict
(
title
=
"Tanggal"
),
dict
(
title
=
"ID.Pel"
),
dict
(
title
=
"Customer"
),
dict
(
title
=
"Vendor"
),
...
...
@@ -70,6 +82,7 @@ class ViewData(BaseView):
'column_data'
:
[
dict
(
data
=
"id"
,
width
=
"0px"
),
dict
(
data
=
"nomor"
,
width
=
"150px"
),
dict
(
data
=
"created"
),
dict
(
data
=
"id_pel"
,
width
=
"150px"
),
dict
(
data
=
"customer"
),
dict
(
data
=
"vendor"
),
...
...
@@ -98,6 +111,18 @@ class ViewData(BaseView):
request
=
self
.
req
url_dict
=
request
.
matchdict
act
=
url_dict
[
'act'
]
def
filter_tanggal
(
query
,
field
):
awal
=
request
.
session
[
'awal'
]
+
' 00:00:00'
#None
akhir
=
request
.
session
[
'akhir'
]
+
' 23:59:59'
#None
if
awal
and
akhir
:
tglawal
=
datetime
.
strptime
(
awal
,
'
%
d-
%
m-
%
Y
%
H:
%
M:
%
S'
)
tglakhir
=
datetime
.
strptime
(
akhir
,
'
%
d-
%
m-
%
Y
%
H:
%
M:
%
S'
)
query
=
query
.
filter
(
field
.
between
(
tglawal
,
tglakhir
))
return
query
if
act
==
"grid"
:
# jenis = 'jenis' in request.params and request.params['jenis'] and int(request.params['jenis']) or None
status
=
9999
...
...
@@ -110,6 +135,7 @@ class ViewData(BaseView):
columns
=
[
ColumnDT
(
H2hArInvoiceDet
.
id
,
mData
=
'id'
),
ColumnDT
(
H2hArInvoice
.
cust_inv_no
,
mData
=
'nomor'
),
ColumnDT
(
H2hArInvoice
.
created
,
mData
=
'created'
),
ColumnDT
(
H2hArInvoiceDet
.
id_pel
,
mData
=
'id_pel'
),
ColumnDT
(
customer
.
nama
,
mData
=
'customer'
),
ColumnDT
(
vendor
.
nama
,
mData
=
'vendor'
),
...
...
@@ -133,6 +159,7 @@ class ViewData(BaseView):
query
=
query
.
filter
(
H2hArInvoiceDet
.
status
<=
status
)
else
:
query
=
query
.
filter
(
H2hArInvoiceDet
.
status
==
status
)
filter_tanggal
(
query
,
H2hArInvoice
.
created
)
row_table
=
DataTables
(
request
.
GET
,
query
,
columns
)
return
row_table
.
output_result
()
...
...
src/agratek/api/merchant/views/templates/payment/list.pt
View file @
aacf6f6
...
...
@@ -60,7 +60,33 @@
function getDataUrl() {
var opt = $('select#status').val();
return oTableUrl + '?status=' + opt.toString();
var param = '';
var awalControl = $('#awal');
var akhirControl = $('#akhir');
var awal = awalControl.val();
var akhir = akhirControl.val();
var tgl = new Date();
var tgl_indo = tgl.getDate() + '-' + (tgl.getMonth()+1) + '-' + tgl.getFullYear();
if (awal == '' || awal == undefined){
awalControl.val(tgl_indo)
}
if (akhir == '' || akhir == undefined){
akhirControl.val(tgl_indo)
}
if (awal != '' && awal != undefined) {
param += '&awal=' + awal;
}
if (akhir != '' && akhir != undefined) {
param += '&akhir=' + akhir;
}
return oTableUrl + '?status=' + opt.toString() + param;
}
function getViewUrl(vid) {
...
...
@@ -88,6 +114,7 @@
columns: [
{'data': 'id', 'width': '0px'},
{'data': 'nomor', 'width': '150px'},
{'data': 'tanggal', 'width': '85px'},
{'data': 'customer'},
{'data': 'vendor'},
{'data': 'amount', 'width': '100px'},
...
...
@@ -179,6 +206,20 @@
mID = 0;
oTable.ajax.url(getDataUrl()).load();
});
$('#awal,#akhir').datepicker({
format: 'dd-mm-yyyy',
autoclose: true
});
$('#awal, #akhir').css('width', '98px');
var el = $('#table1_length').parent();
el.addClass('col-md-9');
el.removeClass('col-md-8');
var el = $('#table1_filter').parent();
el.addClass('col-md-3');
el.removeClass('col-md-4');
});
</script>
...
...
src/agratek/api/merchant/views/templates/purchase/list.pt
View file @
aacf6f6
...
...
@@ -59,8 +59,34 @@
var oTableUrl = oTableUri + "/grid/act";
function getDataUrl() {
var sts = $('select#status').val();
return oTableUrl + '?status=' + sts.toString();
var opt = $('select#status').val();
var param = '';
var awalControl = $('#awal');
var akhirControl = $('#akhir');
var awal = awalControl.val();
var akhir = akhirControl.val();
var tgl = new Date();
var tgl_indo = tgl.getDate() + '-' + (tgl.getMonth()+1) + '-' + tgl.getFullYear();
if (awal == '' || awal == undefined){
awalControl.val(tgl_indo)
}
if (akhir == '' || akhir == undefined){
akhirControl.val(tgl_indo)
}
if (awal != '' && awal != undefined) {
param += '&awal=' + awal;
}
if (akhir != '' && akhir != undefined) {
param += '&akhir=' + akhir;
}
return oTableUrl + '?status=' + opt.toString() + param;
}
function getViewUrl(vid) {
...
...
@@ -88,6 +114,7 @@
columns: [
{'data': 'id', 'width': '0px'},
{'data': 'nomor', 'width': '150px'},
{'data': 'tanggal', 'width': '85px'},
{'data': 'id_pel', 'width': '150px'},
{'data': 'customer'},
{'data': 'vendor'},
...
...
@@ -180,6 +207,21 @@
mID = 0;
oTable.ajax.url(getDataUrl()).load();
});
$('#awal,#akhir').datepicker({
format: 'dd-mm-yyyy',
autoclose: true
});
$('#awal, #akhir').css('width', '98px');
var el = $('#table1_length').parent();
el.addClass('col-md-9');
el.removeClass('col-md-8');
var el = $('#table1_filter').parent();
el.addClass('col-md-3');
el.removeClass('col-md-4');
});
</script>
...
...
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