346 lines
6.4 KiB
JavaScript
346 lines
6.4 KiB
JavaScript
jQuery(document).ready(function(){
|
|
|
|
|
|
|
|
var lastsel; //used for Double Click Row Selection.
|
|
|
|
|
|
var numColWidth = 100;
|
|
|
|
|
|
jQuery("#grid").jqGrid({
|
|
url:'/jobs/build_jobs_json/',
|
|
datatype: "json",
|
|
mtype: 'GET',
|
|
colNames:[
|
|
//'id',
|
|
'Job Number','customer','Customer Ref','Supplier Ref','Order Received',
|
|
'Order Placed Principle','date_scheduled_ex_works','date_order_sent_to_customer','domestic_freight_paid_by',
|
|
'sale_category','shipment_category','comments','company_gross_sales_aud','net_sales_aud','gross_profit_aud','ato_exchange_rate',
|
|
'gst','currency_id','gst_amount','gross_commisions','invoiced_amount_inc_gst','net_export_sales_aud',
|
|
'gross_profit_exports_aud','gp_percent','gross_australian_sales_foreign_currency','net_australian_sales_foreign_currency',
|
|
'gross_profit_value_australian_sales_foreign_currency','gross_export_sales_foreign_currency','net_export_sales_foreign_currency',
|
|
'gross_profit_value_after_discount_exports_foreign_currency','gross_commissions','net_commissions'
|
|
],
|
|
|
|
|
|
jsonReader : {
|
|
root: "rows",
|
|
page: "page",
|
|
total: "total",
|
|
records: "records",
|
|
repeatitems: true,
|
|
cell: "cell",
|
|
id: "id"
|
|
},
|
|
|
|
colModel:[
|
|
|
|
/*{
|
|
name:'id',
|
|
index:'id',
|
|
width:200,
|
|
editable:false
|
|
},*/
|
|
|
|
|
|
{
|
|
name:'title',
|
|
index:'title',
|
|
width:100,
|
|
editable:false
|
|
},
|
|
|
|
{
|
|
name:'customer',
|
|
index:'customer',
|
|
width:400,
|
|
editable:false,
|
|
sortable: false
|
|
},
|
|
|
|
{
|
|
name:'customer_order_number',
|
|
index:'customer_order_number',
|
|
width:100,
|
|
editable:true
|
|
},
|
|
|
|
{
|
|
name:'supplier_reference',
|
|
index:'supplier_reference',
|
|
width:100,
|
|
editable:true
|
|
},
|
|
|
|
{
|
|
name:'date_order_received',
|
|
index:'date_order_received',
|
|
width:100,
|
|
editable:true,
|
|
sorttype:"date"
|
|
},
|
|
|
|
{
|
|
name:'date_order_placed_on_principle',
|
|
index:'date_order_placed_on_principle',
|
|
width:150,
|
|
editable:true,
|
|
sorttype:"date"
|
|
},
|
|
|
|
{
|
|
name:'date_scheduled_ex_works',
|
|
index:'date_scheduled_ex_works',
|
|
width:130,
|
|
editable:true,
|
|
sorttype:"date"
|
|
},
|
|
|
|
{
|
|
name:'date_order_sent_to_customer',
|
|
index:'date_order_sent_to_customer',
|
|
width:200,
|
|
editable:true,
|
|
sorttype:"date"
|
|
},
|
|
|
|
{
|
|
name:'domestic_freight_paid_by',
|
|
index:'domestic_freight_paid_by',
|
|
width:100,
|
|
editable:true,
|
|
edittype:"select",
|
|
editoptions:{
|
|
value:"Customer:Customer;CMC:CMC"
|
|
}
|
|
},
|
|
|
|
{
|
|
name:'sale_category',
|
|
index:'sale_category',
|
|
width:120,
|
|
editable:true,
|
|
edittype:"select",
|
|
editoptions:{
|
|
value:"INDENT:INDENT;STOCK:STOCK;COMMISSION:COMMISSION"
|
|
}
|
|
},
|
|
|
|
{
|
|
name:'shipment_category',
|
|
index:'shipment_category',
|
|
width:140,
|
|
editable:true,
|
|
edittype:"select",
|
|
editoptions:{
|
|
value:"AUSTRALIA:AUSTRALIA;EXPORT:EXPORT;DIRECT-INTL:DIRECT-INTL;DIRECT-AUST:DIRECT-AUST;NO-SHIP:NO-SHIP"
|
|
}
|
|
},
|
|
|
|
{
|
|
name:'comments',
|
|
index:'comments',
|
|
width:200,
|
|
editable:true,
|
|
edittype:"textarea",
|
|
},
|
|
|
|
{
|
|
name:'company_gross_sales_aud',
|
|
index:'company_gross_sales_aud',
|
|
width:numColWidth,
|
|
editable:true
|
|
},
|
|
|
|
{
|
|
name:'net_sales_aud',
|
|
index:'net_sales_aud',
|
|
width:numColWidth,
|
|
editable:true
|
|
},
|
|
|
|
{
|
|
name:'gross_profit_aud',
|
|
index:'gross_profit_aud',
|
|
width:numColWidth,
|
|
editable:true
|
|
},
|
|
|
|
{
|
|
name:'ato_exchange_rate',
|
|
index:'ato_exchange_rate',
|
|
width:numColWidth,
|
|
editable:true
|
|
},
|
|
|
|
{
|
|
name:'gst',
|
|
width:numColWidth,
|
|
editable:true
|
|
},
|
|
|
|
{
|
|
name:'currency_id',
|
|
index:'currency_id',
|
|
width:numColWidth,
|
|
editable:true
|
|
},
|
|
|
|
{
|
|
name:'gst_amount',
|
|
index:'gst_amount',
|
|
width:numColWidth,
|
|
editable:true
|
|
},
|
|
|
|
{
|
|
name:'gross_commisions',
|
|
index:'gross_commisions',
|
|
width:numColWidth,
|
|
editable:true
|
|
},
|
|
|
|
{
|
|
name:'invoiced_amount_inc_gst',
|
|
index:'invoiced_amount_inc_gst',
|
|
width:numColWidth,
|
|
editable:true
|
|
},
|
|
|
|
{
|
|
name:'net_export_sales_aud',
|
|
index:'net_export_sales_aud',
|
|
width:numColWidth,
|
|
editable:true
|
|
},
|
|
|
|
{
|
|
name:'gross_profit_exports_aud',
|
|
index:'gross_profit_exports_aud',
|
|
width:numColWidth,
|
|
editable:true
|
|
},
|
|
|
|
{
|
|
name:'gp_percent',
|
|
index:'gp_percent',
|
|
width:numColWidth,
|
|
editable:true
|
|
},
|
|
|
|
{
|
|
name:'gross_australian_sales_foreign_currency',
|
|
index:'gross_australian_sales_foreign_currency',
|
|
width:numColWidth,
|
|
editable:true
|
|
},
|
|
|
|
{
|
|
name:'net_australian_sales_foreign_currency',
|
|
index:'net_australian_sales_foreign_currency',
|
|
width:numColWidth,
|
|
editable:true
|
|
},
|
|
|
|
{
|
|
name:'gross_profit_value_australian_sales_foreign_currency',
|
|
index:'gross_profit_value_australian_sales_foreign_currency',
|
|
width:numColWidth,
|
|
editable:true
|
|
},
|
|
|
|
{
|
|
name:'gross_export_sales_foreign_currency',
|
|
index:'gross_export_sales_foreign_currency',
|
|
|
|
editable:true
|
|
},
|
|
|
|
{
|
|
name:'net_export_sales_foreign_currency',
|
|
index:'net_export_sales_foreign_currency',
|
|
width:numColWidth,
|
|
editable:true
|
|
},
|
|
|
|
{
|
|
name:'gross_profit_value_after_discount_exports_foreign_currency',
|
|
index:'gross_profit_value_after_discount_exports_foreign_currency',
|
|
width:numColWidth,
|
|
editable:true
|
|
},
|
|
|
|
{
|
|
name:'gross_commissions',
|
|
index:'gross_commissions',
|
|
width:numColWidth,
|
|
editable:true
|
|
},
|
|
|
|
{
|
|
name:'net_commissions',
|
|
index:'net_commissions',
|
|
width:numColWidth,
|
|
editable:true
|
|
},
|
|
|
|
|
|
],
|
|
|
|
// viewrecords: true,
|
|
|
|
rowNum: 500,
|
|
height: '700px',
|
|
caption:"Jobs",
|
|
editurl:"/jobs/ajax_edit",
|
|
|
|
|
|
onSelectRow: function(rowid){
|
|
|
|
|
|
if(typeof(lastsel) != undefined) {
|
|
if(rowid && rowid!==lastsel){
|
|
$(this).jqGrid('saveRow',lastsel);
|
|
$(this).jqGrid('editRow', rowid, true, pickdates);
|
|
}
|
|
|
|
}
|
|
lastsel = rowid;
|
|
|
|
}
|
|
});
|
|
|
|
|
|
$("#editButton").click(function(){
|
|
var gr = jQuery("#grid").jqGrid('getGridParam','selrow');
|
|
|
|
if(gr != null) {
|
|
jQuery("#grid").jqGrid('editRow', gr, true, pickdates);
|
|
}
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
function pickdates(id){
|
|
jQuery("#"+id+"_date_order_received","#grid").datepicker({
|
|
dateFormat:"yy-mm-dd"
|
|
});
|
|
|
|
jQuery("#"+id+"_date_order_placed_on_principle","#grid").datepicker({
|
|
dateFormat:"yy-mm-dd"
|
|
});
|
|
|
|
jQuery("#"+id+"_date_scheduled_ex_works","#grid").datepicker({
|
|
dateFormat:"yy-mm-dd"
|
|
});
|
|
|
|
jQuery("#"+id+"_date_order_sent_to_customer","#grid").datepicker({
|
|
dateFormat:"yy-mm-dd"
|
|
});
|
|
}
|
|
|
|
|
|
}); |