You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
DS7/DSWeb/Areas/TruckMng/Viewsjs/MsWl_Haier/MsWl_HaierIndex.js

998 lines
33 KiB
JavaScript

3 years ago
//集运管理-路单查询
Ext.namespace('DsTruck');
DsTruck.MsWl_HaierIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.DsTruck.MsWl_HaierIndex.superclass.constructor.call(this);
};
//#region 当前时间
Date.prototype.format = function (format) {
var o = {
"M+": this.getMonth() + 1, //month
"d+": this.getDate(), //day
"h+": this.getHours(), //hour
"m+": this.getMinutes(), //minute
"s+": this.getSeconds(), //second
"q+": Math.floor((this.getMonth() + 3) / 3), //quarter
"S": this.getMilliseconds() //millisecond
}
if (/(y+)/.test(format)) format = format.replace(RegExp.$1,
(this.getFullYear() + "").substr(4 - RegExp.$1.length));
for (var k in o) if (new RegExp("(" + k + ")").test(format))
format = format.replace(RegExp.$1,
RegExp.$1.length == 1 ? o[k] :
("00" + o[k]).substr(("" + o[k]).length));
return format;
}
var xhr = new XMLHttpRequest();
var currdate = new Date();
if (!xhr) {
//...其他生成xmlhttprequest方法
}
xhr.open("HEAD", location.href, true);
xhr.onreadystatechange = function () {
if (xhr.readyState == 4 && xhr.status == 200) {
var datestr = xhr.getResponseHeader("Date");
currdate = new Date(datestr);
// alert(currdate.format('yyyy-MM-dd'));
}
}
xhr.send(null);
//#endregion
Ext.extend(DsTruck.MsWl_HaierIndex, Ext.Panel, {
PageSize: 500,
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
initUIComponents: function () {
//定义数据集
this.storeList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'PCmb',
remoteSort: false,
proxy: {
type: 'ajax',
url: '/TruckMng/MsWl_Haier/GetDataList',
reader: {
id: 'GId',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.formname = "MsWl_Haier";
//#region 表参照
this.storeTruckNo = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsWlBsHeadRefMsWlTruck',
proxy: { url: '/TruckMng/MsWlPc/GetTruckNoList' }
});
this.storeTruckNo.load({ params: { condition: ""} });
this.comboxTruckNo = Ext.create('DsExt.ux.RefTableCombox', {
//fieldLabel: '车牌号',
store: this.storeTruckNo,
name: 'TruckNo',
valueField: 'TruckNo',
displayField: 'TruckNo',
listeners: {
change: function (field, newValue, oldValue) {
//this.tonAndTruckNoChange(field, newValue, oldValue);
},
scope: this
}
});
this.storeDrvName = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsWlBsHeadRefMsWlDriver',
proxy: { url: '/TruckMng/MsWlPc/GetDrvNameList' }
});
this.storeDrvName.load({ params: { condition: ""} });
this.comboxDrvName = Ext.create('DsExt.ux.RefTableCombox', {
//fieldLabel: '司机',
store: this.storeDrvName,
name: 'DrvCode',
valueField: 'DrvCode',
displayField: 'CodeAndName',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
//this.setDrvName(records[0].data.DrvCode);
}
}
}
});
//路单类型 用于查询条件 派车单/维修单
Ext.define('LDLXmb', {
extend: 'Ext.data.Model',
fields: [
{ name: 'code', type: 'string' },
{ name: 'name', type: 'string' }
]
});
var LDLXData = [{ "code": "WLPC", "name": "业务派车单" },
{ "code": "WXPC", "name": "维修路单" },
{ "code": "PC", "name": "全部"}];
this.storeLDLX = Ext.create('Ext.data.Store', {
model: 'LDLXmb',
data: LDLXData
});
this.comboxLDLX = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '路单类型',
forceSelection: true,
store: this.storeLDLX,
name: 'LDLX',
valueField: 'code',
displayField: 'name'
});
//#endregion
this.cellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.PCCB = Ext.create('Ext.selection.CheckboxModel', { checkOnly: true });
Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, {
width: 45
});
this.column = [{
sortable: true,
dataIndex: 'BillNo',
header: '路单序列号',
width: 130
}, {
sortable: true,
dataIndex: 'DdCode_Ref',
header: '调度',
width: 100
}, {
sortable: true,
dataIndex: 'ArriveDate',
header: '派车日期',
width: 85,
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
editor: {
format: 'Y-m-d',
xtype: 'datefield',
selectOnFocus: true
}
}, {
sortable: true, hidden: true,
dataIndex: 'CustName',
header: '客户',
//summaryType: 'count',
width: 120
}, {
sortable: true,
dataIndex: 'TruckNo',
header: '车号',
editor: this.comboxTruckNo,
width: 85
}, {
sortable: true,
dataIndex: 'MblNo',
header: '路单号',
//summaryType: 'count',
width: 120,
editor: {
xtype: 'textfield', //numberfield textfield
selectOnFocus: true
}
}, {
sortable: true,
dataIndex: 'DrvCode',
header: '司机姓名',
renderer: function (value, p, record) {
if (value == null || value == '') return '';
else return record.data.DrvName;
},
width: 80,
editor: this.comboxDrvName
}, {
sortable: true,
dataIndex: 'FactoryAddr',
header: '路径',
editor: {
xtype: 'textfield', //numberfield textfield
selectOnFocus: true
},
width: 200
}, {
sortable: true,
dataIndex: 'OverLoadMil',
header: '重驶里程',
summaryType: 'sum',
width: 60,
editor: {
xtype: 'numberfield', //numberfield textfield
selectOnFocus: true
}
}, {
sortable: true,
dataIndex: 'NoLoadMil',
header: '空驶里程',
summaryType: 'sum',
width: 60,
editor: {
xtype: 'numberfield', //numberfield textfield
selectOnFocus: true
}
}, {
sortable: true,
dataIndex: 'RealMil',
header: '维修里程',
summaryType: 'sum',
width: 60,
editor: {
xtype: 'numberfield', //numberfield textfield
selectOnFocus: true
}
}, {
sortable: true,
dataIndex: 'TotalMil',
header: '总里程',
summaryType: 'sum',
width: 60
}, {
sortable: true,
dataIndex: 'ZSLQF',
header: '路桥费(重驶)',
summaryType: 'sum',
width: 60
/*,
editor: {
xtype: 'numberfield', //numberfield textfield
selectOnFocus: true
}*/
}, {
sortable: true,
dataIndex: 'KSLQF',
header: '路桥费(空驶)',
summaryType: 'sum',
width: 60/*,
editor: {
xtype: 'numberfield', //numberfield textfield
selectOnFocus: true
}*/
}, {
sortable: true,
dataIndex: 'LQF',
header: '总路桥费',
summaryType: 'sum',
width: 60/*,
editor: {
xtype: 'numberfield', //numberfield textfield
selectOnFocus: true
}*/
}, {
sortable: true, hidden: true,
dataIndex: 'DrvName',
header: 'DrvName',
width: 60
}, {
sortable: true, hidden: true,
dataIndex: 'TimeMark',
header: 'TimeMark',
width: 80
}, {
sortable: true, hidden: true,
dataIndex: 'CustCode',
header: 'CustCode',
width: 80
}, {
sortable: true, hidden: true,
dataIndex: 'DdCode',
header: 'DdCode',
width: 80
}, {
sortable: true,
dataIndex: 'RealFuel',
header: '实际油耗',
summaryType: 'sum',
width: 60,
editor: {
xtype: 'numberfield', //numberfield textfield
selectOnFocus: true
}
}
];
//定义Grid
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
features: [{
ftype: 'summary'//Ext.grid.feature.Summary表格汇总特性
}],
selModel: this.PCCB,
plugins: [this.cellEditing],
columns: [],
// paging bar on the bottom
bbar: Ext.create('Ext.PagingToolbar', {
store: this.storeList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
})
});
this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
this.SelectedRecord = record;
this.OprationStatus = 'edit';
DsOpenEditWin('/TruckMng/MsWl_Haier/Edit');
//alert("双击!");
}, this);
/////////////以下部分为获取存储的gridpanel显示样式
this.column = DsTruck.GetGridPanel(GID, this.formname, this.column);
this.column.unshift(new Ext.grid.RowNumberer());
this.gridList.reconfigure(this.storeList, this.column);
////////////////////////////
//#region formSearch
//#region formSearch枚举参照相关
//#endregion
this.formSearch = Ext.widget('form', {
frame: true,
region: 'center',
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 90,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '提单号',
name: 'PS_MBLNO'
}, {
fieldLabel: '司机姓名',
name: 'PS_DRVNAME'
}, {
fieldLabel: '车牌号',
name: 'PS_TRUCKNO'
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '托单号',
name: 'PS_REFBILLNO'
}, {
fieldLabel: '单据号',
name: 'PS_BILLNO'
}, {
fieldLabel: '组织编码',
name: 'OrgCode'
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '从派车日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'PS_EXPDATEBGN'
}, {
fieldLabel: '到派车日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'PS_EXPDATEEND'
}, this.comboxLDLX
//{ xtype: 'hiddenfield' }
]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
//#endregion formSearch
//菜单
var menu_Print = new Ext.menu.Menu({
id: 'PriceMenu',
items: [{
text: '导出派车单',
handler: clickHandler_1
}, {
text: '导出维修路单',
handler: clickHandler_2
}]
});
var _this=this;
function clickHandler_1() {
_this.Print_PC();
};
function clickHandler_2() {
_this.Print_WXPC();
};
//查询工具条
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [
{
text: "执行查询",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick(button, event);
},
scope: this
}, '-', {
text: '新建路单',
tooltip: '新建路单',
iconCls: "btnadddetail",
handler: function (button, event) {
this.onAddPCClick(button, event, "PC");
},
scope: this
}, {
text: '新建维修路单',
tooltip: '新建维修路单',
iconCls: "btnadddetail",
handler: function (button, event) {
this.onAddPCClick(button, event, "WX");
},
scope: this
}, {
text: '删除路单',
tooltip: '删除路单',
iconCls: "btndeletedetail",
handler: function (button, event) {
this.onDelPCClick(button, event);
},
scope: this
}, {
text: "保存修改",
iconCls: "btnsave",
handler: function (button, event) {
this.onSaveClick(button, event);
},
scope: this
}, '-', {
text: "导出Excel",
id: "btnExportExcel",
iconCls: 'btnexportexcel',
handler: function (button, event) {
this.onExportClick(button, event);
},
scope: this
}, {
text: "保存列表样式",
id: "btntest",
handler: function (button, event) {
DsTruck.SaveGridPanel(GID, this.formname, this.gridList.columns, this.column, 1, false);
},
scope: this
},'-',
{ text: "导出报表", menu: menu_Print, scope: this }
]
});
//布局
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 125,
items: [this.formSearch, this.panelBtn]
});
Ext.apply(this, {
items: [this.panelTop, this.gridList]
});
this.storeList.on('beforeload', function (store) {
if (!this.checkSearchCondition())
return;
var sql = this.getCondition();
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
this.gridList.on('edit', function (editor, e, eOpts) {
this.HaierAfterEdit(editor, e, eOpts);
}, this);
}, //end initUIComponents
HaierAfterEdit: function (editor, e, eOpts) {
if (e.value == e.originalValue) { return; }
function decimal(str, length) {
var _r = round2(str, length);
return (_r);
}
if (e.field == 'DrvCode') {
var records = DsStoreQueryBy(this.storeDrvName, 'DrvCode', e.value);
if (records.getCount() > 0) {
var recorddata = records.getAt(0).data;
e.record.set('DrvName', recorddata.DrvName);
} else {
e.record.set('DrvName', '');
}
}
//OverLoadMil NoLoadMil
if (e.field == 'OverLoadMil' || e.field == 'NoLoadMil') {
var OverLoadMil = e.record.get('OverLoadMil');
var NoLoadMil = e.record.get('NoLoadMil');
var TotalMil = Add(OverLoadMil, NoLoadMil);
e.record.set('TotalMil', TotalMil);
}
if (e.field == 'RealMil') {
var OverLoadMil = e.record.get('OverLoadMil');
var NoLoadMil = e.record.get('NoLoadMil');
var RealMil = e.record.get('RealMil');
if (NoLoadMil == "0" && OverLoadMil == "0") {
var TotalMil = Add("0", RealMil);
}
e.record.set('TotalMil', TotalMil);
}
},
onAuditRefuseClick: function (button, event) {
var sql = " A.GID in (select bsno from ch_fee where FEESTATUS=6)";
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: "", condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
},
onRefreshClick: function (button, event) {
if (!this.checkSearchCondition())
return;
var sql = this.getCondition();
this.storeList.load({
//GetDataList(int start, int limit, string sort, string condition)
params: { start: 0, limit: this.PageSize, sort: "", condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
},
getCondition: function () {
var form = this.formSearch.getForm();
var sql = " A.CUSTCODE='QDHE' ";
/*
var sqldata = form.getValues();
sql = Ext.JSON.encode(sqldata);
*/
var mblNo = form.findField('PS_MBLNO').getValue();
sql = sql + getAndConSql(sql, mblNo, "A.MblNo like '%" + mblNo + "%'");
var drvName = form.findField('PS_DRVNAME').getValue();
sql = sql + getAndConSql(sql, drvName, " A.DrvName='" + drvName + "'");
var truckNo = form.findField('PS_TRUCKNO').getValue();
sql = sql + getAndConSql(sql, truckNo, " A.TruckNo='" + truckNo + "'");
var pcBillNo = form.findField('PS_BILLNO').getValue();
sql = sql + getAndConSql(sql, pcBillNo, " A.BillNo like '%" + pcBillNo + "%'");
var billNo = form.findField('PS_REFBILLNO').getValue();
sql = sql + getAndConSql(sql, billNo, " A.RefBillNo like '%" + billNo + "%'");
var expDate_Min = form.findField('PS_EXPDATEBGN').getRawValue();
sql = sql + getAndConSql(sql, expDate_Min, " A.ArriveDate>='" + expDate_Min + "'");
var expDate_Max = form.findField('PS_EXPDATEEND').getRawValue();
sql = sql + getAndConSql(sql, expDate_Max, " A.ArriveDate<='" + expDate_Max + " 23:59:59'");
var orgCode = form.findField('OrgCode').getValue();
sql = sql + getAndConSql(sql, orgCode, "OrgCode like '%" + orgCode + "%'");
var LDLX = form.findField('LDLX').getValue();
sql = sql + getAndConSql(sql, LDLX, "A.BillNo like '%" + LDLX + "%'");
return sql;
},
checkSearchCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return false;
}
return true;
},
OprationSwap: function () {
var ret = new Array();
ret[0] = this.OprationStatus;
ret[1] = this.storeList;
ret[2] = this.SelectedRecord;
ret[3] = this.SelectedRecord.data.BillNo;
ret[4] = "MsWl_HaierIndex";
return ret;
},
onExportClick: function (button, event) {
GridExportExcelPage(this.gridList);
},
SetFee: function (FeeName, Amount, Type) {
var _condition = this.getCondition();
var GIDList = [];
var selectedRecords = this.gridList.selModel.getSelection();
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
GIDList.push(rec.get('GID'));
}
var _GIDList = ConvertStringListToJson(GIDList);
Ext.Ajax.request({//
waitMsg: '正在初始化库存数据...',
url: '/TruckMng/MsRptPcHeadQry/SetFee',
params: {
GIDList: _GIDList,
FeeName: FeeName,
Amount: Amount,
Type: Type
},
callback: function (_count) {
//alert('初始化完成');
//重新load库存表的store
this.storeList.load({ params: { condition: _condition} });
},
scope: this
}); //request over
},
onAddPCClick: function (button, event, type) {
var store = null;
store = this.storeList;
//var truckno = Ext.getCmp('S_TRUCKNO').getValue();
record = Ext.create('PCmb', {
TRUCKNO: "",
DRVCODE: "",
DRVNAME: "",
GId: newGuid(),
BillNo: "",
DdCode: usercode,
DdCode_Ref: SHOWNAME,
DDNAME: "",
ArriveDate: currdate.format('yyyy-MM-dd'),
CustCode: "QDHE",
CustName: "海尔",
TRUCKNO: "",
MBLNO: "",
DRVNAME: "",
DRVNAME_REF: "",
MOBILE: "",
CONTAINERTYPE: "",
CONTAINERTYPE_REF: "",
CONTAINERQTY: "",
YARDCODE_REF: "",
VOYVEG_REF: "",
DSTAREA: "",
NOLOADMIL: "",
OVERLOADMIL: "",
RATEDFUEL: "",
REALFUEL: "",
LRDATE: "",
USERCODE: "",
USERNAME: "",
REFBILLNO: "",
DETINATION: "",
CONTAINERNO: "",
SEALNO: "",
Ton: "",
ActualWeight: "",
IsDoubleREF: "",
IsDoubleREF: "",
TimeMark: 0
});
var _this = this;
var data = record.data;
Ext.Msg.wait('正在保存数据, 请稍侯..');
if (type == "PC") {
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/TruckMng/MsWl_Haier/CreatePC',
scope: this,
async: true,
params: {
data: Ext.JSON.encode(data)
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
record = jsonresult.Data;
store.add(record);
cellediting = this.cellEditing;
var n = store.getCount();
cellediting.startEditByPosition({ row: n - 1, column: 2 });
} else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
} else {
Ext.Msg.show({ title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
//alert('03');
}
});
} else
if (type = "WX") {
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/TruckMng/MsWl_Haier/CreateWXPC',
scope: this,
async: true,
params: {
data: Ext.JSON.encode(data)
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
record = jsonresult.Data;
store.add(record);
cellediting = this.cellEditing;
var n = store.getCount();
cellediting.startEditByPosition({ row: n - 1, column: 2 });
} else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
} else {
Ext.Msg.show({ title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
//alert('03');
}
});
}
},
onDelPCClick: function (button, event) {
var selections = this.gridList.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择路单!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var selectedRecords = [];
selectedRecords = this.gridList.selModel.getSelection();
/*
var candelete = DsTruck.CheckBaoxiaoDelete(selectedRecords);
if (candelete == false) {
return;
}*/
var record = selections[0];
Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在删除数据...');
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/TruckMng/MsWl_Haier/DeletePC',
params: {
data: Ext.JSON.encode(record.data)
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.storeList.remove(record);
Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
}
},
failure: function (response, options) {
Ext.Msg.show({ title: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
},
success: function (response, options) {
},
scope: this
}); //end Ext.Ajax.request
}
}, this);
InitData();
} //onDeleteClick
,
onSaveClick: function (button, event) {
for (var i = 0; i < this.storeList.getCount(); i += 1) {
var record = this.storeList.getAt(i);
if (record.dirty) {
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/TruckMng/MsWl_Haier/SavePC',
scope: this,
async: false,
params: {
data: Ext.JSON.encode(record.data)
},
callback: function (options, success, response) {
if (success) {
//Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var returnData = jsonresult.Data;
var editp = Ext.create('PCmb', returnData);
this.storeList.getAt(i).fields.each(function (field) {
if (field.persist) {
name = field.name;
//alert(name + ' -- ' + editp.get(name));
if (name != 'BillNo')
this.storeList.getAt(i).set(name, editp.get(name));
}
}, this);
this.storeList.getAt(i).commit();
} else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
} else {
Ext.Msg.show({ title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
}
});
}
}
}
,
Print_PC: function () {
var MainList = "";
var selectedRecords = [];
selectedRecords = this.gridList.selModel.getSelection();
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (MainList == "") { MainList = "'" + rec.get('BillNo') + "'"; }
else {
MainList = MainList + ",'" + rec.get('BillNo') + "'";
}
}
var printType = 'MsWl_Haier_PC'; //海尔派车路单
var T = this.getCondition();
if (T != "") { T = " where A.billno like '%WLPC%' and " + T; }
else {
{ T = " where A.billno like '%WLPC%' " ; }
}
var sql1 = " select A.*,(select sum(Amount) from ch_fee where bsno=A.billno and feetype=2 and feename ='路桥费(重驶)') ZSLQF ";
sql1 = sql1 +",(select sum(Amount) from ch_fee where bsno=A.billno and feetype=2 and feename ='路桥费(空驶)') KSLQF from tMsWlPcHead A ";
sql1 = sql1 + T;
if (MainList != "" && T == "") {
sql1 = sql1 + " where " + " A.BillNo in(" + MainList + ")";
}
if (MainList != "" && T != "") {
sql1 = sql1 + " and " + " A.BillNo in(" + MainList + ")";
}
sql1 = sql1 + " order by BillNo ";
var sql2 = "";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
},
Print_WXPC: function () {
var MainList = "";
var selectedRecords = [];
selectedRecords = this.gridList.selModel.getSelection();
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (MainList == "") { MainList = "'" + rec.get('BillNo') + "'"; }
else {
MainList = MainList + ",'" + rec.get('BillNo') + "'";
}
}
var printType = 'MsWl_Haier_WXPC'; //海尔维修路单
var T = this.getCondition();
if (T != "") { T = " where A.billno like '%WXPC%' and " + T; }
else {
{ T = " where A.billno like '%WXPC%' " ; }
}
var sql1 = " select A.* ,(select sum(Amount) from ch_fee where bsno=A.billno and feetype=2 and feename ='路桥费(维修)') WXLQF ";
sql1 = sql1 +" from tMsWlPcHead A ";
sql1 = sql1 + T;
if (MainList != "" && T == "") {
sql1 = sql1 + " where " + " A.BillNo in(" + MainList + ")";
}
if (MainList != "" && T != "") {
sql1 = sql1 + " and " + " A.BillNo in(" + MainList + ")";
}
sql1 = sql1 + " order by BillNo ";
var sql2 = "";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
},
});