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_Port/FuelTruckEdit_ADL.js

2006 lines
63 KiB
JavaScript

2 years ago
Ext.namespace('DsTruck');
DsTruck.FuelTruckEdit_ADL = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.DsTruck.FuelTruckEdit_ADL.superclass.constructor.call(this);
};
Ext.extend(DsTruck.FuelTruckEdit_ADL, Ext.Panel, {
ParentWin: null, //弹出式
ParentPanel: null, //Tab页编辑模式
FunType: '',
OpStatus: 'add',
//StoreList: null,
EditRecord: null,
RefBillNo: '*',
DataLoading: true,
LoadFuel: 0,
NoLoadFuel: 0,
ratedFuel: 0,
//主要是为了处理修改事件。使用focus和blur模拟change事件。
RealMil: 0,
OverLoadMil: 0,
NoLoadMil: 0,
Ton: 0,
PageSize: 500,
initUIComponents: function () {
//this.poundSerialNo = 0;
this.CargoDel = [];
this.CargoDoDel = [];
this.fixSerialNo = 0;
this.fixBodyDel = [];
this.feeSerialNo = 0;
this.feeBodyDel = [];
//#region 编辑form
//枚举参照相关(编辑form)
//表参照相关(编辑form)
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);
var _Rs = DsStoreQueryBy(this.storeTruckNo, 'TruckNo', newValue);
if (_Rs.getCount() > 0) {
var _R = _Rs.getAt(0).data;
//e.record.set('cicodeandname', Cargoinfodata.codeandname);
Ext.getCmp("DRVCODE").setValue(_R.DrvCode);
} else {
Ext.getCmp("DRVCODE").setValue("");
}
},
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', id: "DRVCODE",
valueField: 'DrvCode',
displayField: 'CodeAndName',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
//this.setDrvName(records[0].data.DrvCode);
}
}
}
});
//编辑form
this.formEdit = Ext.widget('form', {
region: 'center',
frame: true,
bodyPadding: 5,
//autoScroll: true,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 90,
msgTarget: 'qtip'
},
items: [
{
//fieldset 1
xtype: 'fieldset',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
{
fieldLabel: 'TimeMark',
allowBlank: true, hidden: true,
//disabled: true,
name: 'TimeMark'
},
{
fieldLabel: '油料结算单号',
allowBlank: true, readOnly: true,
//disabled: true,
name: 'GID',
id: "GID"
}, {
fieldLabel: '从..派车日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'EXPDATE_BGN'
}, {
fieldLabel: '到..派车日期', //hidden: true,
format: 'Y-m-d',
xtype: 'datefield',
name: 'EXPDATE_END'
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxTruckNo,
this.comboxDrvName
, {
fieldLabel: '车标准油耗',
name: 'FUELRATE',
readOnly: true
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '总行驶里程',
name: 'OVERLOADMIL',
readOnly: true
}, {
fieldLabel: '总额定油耗',
name: 'RATEDFUEL',
readOnly: true
}, {
fieldLabel: '总实际油耗',
name: 'REALFUEL',
readOnly: true
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [, {
fieldLabel: '当前油价',
xtype: 'numberfield',
allowBlank: false,
hideTrigger: true,
keyNavEnabled: false,
mouseWheelEnabled: false,
//disabled: true,
flex: 1,
name: 'FUELPRICE'
}, {
fieldLabel: '购油价', //hidden: true,
xtype: 'numberfield',
allowBlank: false,
hideTrigger: true,
//keyNavEnabled: false,
mouseWheelEnabled: false,
//allowDecimals: true,
flex: 1,
name: 'FUELPRICE_AGIO'
}, {
fieldLabel: '金额',
name: 'AMOUNT',
readOnly: true
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textarea',
height: 36,
items: [{
fieldLabel: '备注',
height: 34,
name: 'REMARK'
}
]
}
]//end items(fieldset 1)
} //end fieldset 1
]//end root items
}); //end this.formEdit
//#endregion
//#region 按钮Toolbar
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [
{
id: 'pcbtnSave',
text: "保存",
iconCls: "btnsave",
handler: function (button, event) {
this.Save('0');
},
scope: this
},
{
id: 'pcbtnSaveAndClose',
text: "保存并关闭",
handler: function (button, event) {
this.Save('1');
},
scope: this
},
'-',
{
id: 'pcbtnSaveAndNew',
text: "保存并新建",
handler: function (button, event) {
this.Save('2');
},
scope: this
},
'-',
{
text: "打印",
iconCls: "btnprint",
handler: function (button, event) {
this.Print();
},
scope: this
},
'-'
]
}); //end 按钮Toolbar
//#endregion
//#region 明细表 油料单内的加油明细
//派车明细表表格相关
//明细表-从excel导入的加油记录
this.storeInput = Ext.create('Ext.data.Store', {
model: 'MsWl_FuelDateInputmb',
remoteSort: false,
pageSize: this.PageSize,
proxy: {
type: 'ajax',
url: '/TruckMng/MsWl_ADL_FuelTruckList/GetFuelDateInputList',
reader: {
idProperty: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//明细表表格
this.cargoCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
this.gridListInput = new Ext.grid.GridPanel({
store: this.storeInput,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
//plugins: [this.gridListCargoCellEditing],
features: [{
ftype: 'summary'//Ext.grid.feature.Summary表格汇总特性
}],
selModel: this.cargoCheckBoxModel,
selType: 'cellmodel',
tbar: [{
text: '删除明细',
tooltip: '删除明细',
iconCls: "btndeletedetail",
handler: function (button, event) {
this.onDelInputClick(button, event);
},
scope: this
}],
columns: [
new Ext.grid.RowNumberer(),
{
sortable: true, hidden: true,
dataIndex: 'GID',
header: 'GID',
width: 80
},
{
sortable: true,
dataIndex: 'STATION',
header: '站号',
width: 80
},
{
sortable: true,
dataIndex: 'BLSH',
header: '班流水号',
width: 80
},
{
sortable: true,
dataIndex: 'ZH',
header: '账号',
width: 80
},
{
sortable: true,
dataIndex: 'KLX',
header: '卡类型',
width: 80
},
{
sortable: true,
dataIndex: 'CKR',
header: '持卡人',
width: 80
},
{
sortable: true,
dataIndex: 'CH',
header: '车号',
width: 80
},
{
sortable: true,
dataIndex: 'JH',
header: '机号',
width: 80
},
{
sortable: true,
dataIndex: 'YP',
header: '油品',
width: 80
},
{
sortable: true,
dataIndex: 'FUEL',
header: '油量',
width: 80,
summaryType: 'sum', align: 'right',
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
sortable: true,
dataIndex: 'PRICE',
header: '单价',
width: 80
},
{
sortable: true,
dataIndex: 'AMOUNT',
header: '金额',
width: 80,
summaryType: 'sum', align: 'right',
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
sortable: true,
dataIndex: 'YHED',
header: '优惠额度',
width: 80
},
{
sortable: true,
dataIndex: 'SS',
header: '实收',
width: 80
},
{
sortable: true,
dataIndex: 'YE',
header: '余额(元)',
width: 80
},
{
sortable: true,
dataIndex: 'YY',
header: '余油(升)',
width: 80
},
{
sortable: true,
dataIndex: 'DEPT',
header: '单位',
width: 80
},
{
sortable: true,
dataIndex: 'JYTIME',
header: '加油时间',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'inserted',
header: 'inserted',
width: 80
}
]
});
//#endregion 明细表
//#region 相关时间段内,指定车号指定司机的路单情况
this.PCformname = "tmswlPcList_ADLFuelList";
//定义数据集
this.storeList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
fields: [
{ name: 'BillNo', type: 'string' },
{ name: 'GId', type: 'string' },
{ name: 'DdCode', type: 'string' },
{ name: 'DdCode_Ref', type: 'string' },
{ name: 'DDNAME', type: 'string' },
{ name: 'ExpDate', type: 'string' },
{ name: 'CustCode', type: 'string' },
{ name: 'CustName', type: 'string' },
{ name: 'TruckNo', type: 'string' },
{ name: 'MblNo', type: 'string' },
{ name: 'DrvName', type: 'string' },
{ name: 'DrvCode_Ref', type: 'string' },
{ name: 'Mobile', type: 'string' },
{ name: 'ContainerType', type: 'string' },
{ name: 'ContainerType_Ref', type: 'string' },
{ name: 'ContainerQty', type: 'string' },
{ name: 'YardCode_Ref', type: 'string' },
{ name: 'VoyVeg', type: 'string' },
{ name: 'DstArea', type: 'string' },
{ name: 'NOLOADMIL', type: 'number' },
{ name: 'OverLoadMil', type: 'number' },
{ name: 'RatedFuel', type: 'number' },
{ name: 'REALFUEL', type: 'number' },
{ name: 'LrDate', type: 'string' },
{ name: 'USERCODE', type: 'string' },
{ name: 'USERNAME', type: 'string' },
{ name: 'REFBILLNO', type: 'string' },
{ name: 'DetiNation', type: 'string' },
{ name: 'ContainerNo', type: 'string' },
{ name: 'SealNo', type: 'string' }
, { name: 'CustomerName', type: 'string' }
, { name: 'F_CustomerName', type: 'string' }
, { name: 'EndPortDate', type: 'string' }
, { name: 'isEnd', type: 'string' }
, { name: 'PCSTATUSREF', type: 'string' }
],
remoteSort: true,
proxy: {
type: 'ajax',
//url: '/TruckMng/MsRptPcHeadOperate/QryData_ADL',
url: '/TruckMng/MsWlPc/GetDataList_ADL',
//this.storeList.proxy.url = '/TruckMng/MsRptPcHeadOperate/QryData_ADL';
reader: {
id: '',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.PCcolumn = [
{
sortable: true, hidden: true,
dataIndex: 'GId',
header: 'GId',
width: 130
}, {
sortable: true, hidden: true,
dataIndex: 'PCSTATUSREF',
header: '状态',
width: 50,
renderer: function (value) {
if (value == "接单") {
return "<a><font color='#333333'>" + value + "</font></a>";
} else if (value == "派车") {
return "<a><font color='#0000FF'>" + value + "</font></a>";
} else if (value == "完成") {
return "<a><font color='#00FF00'>" + value + "</font></a>";
}
}
}, {
sortable: true,
dataIndex: 'BillNo',
header: '路单号',
width: 110
}, {
sortable: true,hidden:true,
dataIndex: 'DdCode_Ref',
header: '调度',
width: 100
}, {
sortable: true,
dataIndex: 'ExpDate',
header: '派车日期',
width: 80
}, {
sortable: true, hidden: true,
dataIndex: 'CustName',
header: '客户',
width: 120
}, {
sortable: true,
dataIndex: 'CustomerName',
header: '客户',
width: 120
}, {
sortable: true,
dataIndex: 'F_CustomerName',
header: '最终客户',
width: 120
}, {
sortable: true,
dataIndex: 'TruckNo',
header: '车号',
width: 75
}, {
sortable: true, hidden: true,
dataIndex: 'MblNo',
header: '提单号',
width: 120
}, {
sortable: true,
dataIndex: 'DrvCode_Ref',
header: '司机姓名',
width: 65
}, {
sortable: true,
dataIndex: 'OverLoadMil',
header: '行驶里程',
width: 90,
summaryType: 'sum', align: 'right',
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
}, {
sortable: true, hidden: true,
dataIndex: 'Mobile',
header: '司机手机',
width: 76
}, {
sortable: true, hidden: true,
dataIndex: 'ContainerType_Ref',
header: '箱型',
width: 50
}, {
sortable: true, hidden: true,
dataIndex: 'ContainerQty',
header: '箱量',
width: 50
}, {
sortable: true, hidden: true,
dataIndex: 'YardCode_Ref',
header: '场站',
width: 150
}, {
sortable: true, hidden: true,
dataIndex: 'VoyVeg',
header: '船名航次',
width: 150
}, {
sortable: true, hidden: true,
dataIndex: 'EndPortDate',
header: '截港日期',
width: 150
}, {
sortable: true,
dataIndex: 'DstArea',
header: '目的地',
width: 80
}, {
sortable: true,
dataIndex: 'DetiNation',
header: '工厂地址',
width: 200
}, /*{
sortable: true,
dataIndex: 'NOLOADMIL',
header: '空驶里程',
width: 60
},*/{
sortable: true, hidden: true,
dataIndex: 'RatedFuel',
header: '额定油耗',
width: 60
}, {
sortable: true, hidden: true,
dataIndex: 'REALFUEL',
header: '实际油耗',
width: 60
}, {
sortable: true,
dataIndex: 'USERNAME',
header: '录入人',
width: 60
}, {
sortable: true,
dataIndex: 'LrDate',
header: '录入日期',
width: 80
}, {
sortable: true, hidden: true,
dataIndex: 'ContainerNo',
header: '箱号',
width: 80
}, {
sortable: true, hidden: true,
dataIndex: 'SealNo',
header: '封号',
width: 80
}
];
//this.MainCB = Ext.create('Ext.selection.CheckboxModel', { checkOnly: true });
Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, {
width: 40
});
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
//selModel: this.MainCB,
features: [{
ftype: 'summary'//Ext.grid.feature.Summary表格汇总特性
}],
columns: this.PCcolumn
/*,
bbar: Ext.create('Ext.PagingToolbar', {
store: this.storeList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
})*/
});
/*
/////////////以下部分为获取存储的gridpanel显示样式
this.column = DsTruck.GetGridPanel(USERID, this.PCformname, this.PCcolumn);
//使用者id表名 中间column数组
this.column.unshift(new Ext.grid.RowNumberer());
this.gridList.reconfigure(this.storeList, this.PCcolumn);
*/
//#endregion
//#region formSearch
this.storeTruckNo2 = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsWlBsHeadRefMsWlTruck',
proxy: { url: '/TruckMng/MsWlPc/GetTruckNoList' }
});
this.storeTruckNo2.load({ params: { condition: ""} });
this.comboxTruckNo2 = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '车号',
store: this.storeTruckNo2,
name: 'TRUCKNO', id: "TRUCKNO",
valueField: 'TruckNo',
displayField: 'TruckNo',
listeners: {
change: function (field, newValue, oldValue) {
//this.tonAndTruckNoChange(field, newValue, oldValue);
var _Rs = DsStoreQueryBy(this.storeTruckNo2, 'TruckNo', newValue);
if (_Rs.getCount() > 0) {
var _R = _Rs.getAt(0).data;
var _Rs2 = DsStoreQueryBy(this.storeDrvName2, 'DrvCode', _R.DrvCode);
if (_Rs2.getCount() > 0) {
var _R2 = _Rs2.getAt(0).data;
Ext.getCmp("DrvName").setValue(_R2.DrvName);
}
} else {
xt.getCmp("DrvName").setValue("");
}
},
scope: this
}
});
this.storeDrvName2 = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsWlBsHeadRefMsWlDriver',
proxy: { url: '/TruckMng/MsWlPc/GetDrvNameList' }
});
this.storeDrvName2.load({ params: { condition: ""} });
this.comboxDrvName2 = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '持卡人',
store: this.storeDrvName2,
name: 'DrvName', id: "DrvName",
valueField: 'DrvName',
displayField: 'CodeAndName',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
//this.setDrvName(records[0].data.DrvCode);
}
}
}
});
this.formSearch = Ext.widget('form', {
frame: true,
region: 'north',
height: 40,
bodyPadding: 1,
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: [{
xtype: 'button',
width: 90,
text: "执行查询",
iconCls: "btnrefresh",
handler: function (button, event) {
//var PcBillType = Ext.getCmp("PcBillType").getValue();
this.SearchInput();
},
scope: this
}, {
xtype: 'button',
width: 70,
text: "添加",
iconCls: "btnadddetail",
handler: function (button, event) {
this.AddInput();
},
scope: this
}
,
this.comboxTruckNo2,
this.comboxDrvName2,
{
fieldLabel: '从..加油日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'FuelDate_min'
}, {
fieldLabel: '到..加油日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'FuelDate_max'
}//, { xtype: 'hiddenfield', flex: 2 }
]
}]
}, //end items(fieldset 1)
{//fieldset 2
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
]
}]
}, //end fieldset 2
{//fieldset 3
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
]
}]
}, //end items(fieldset 4)
{//fieldset 4
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: []
}]
}, //end items(fieldset 4)
{//fildset 5
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: []
}]
} //end items(fieldset 5)
]//end root items
});
//#endregion formSearch
//#region 用于导入单据内的加油记录明细
//定义数据集
this.storeAddInput = Ext.create('Ext.data.Store', {
model: 'MsWl_FuelDateInputmb',
remoteSort: false,
pageSize: this.PageSize,
proxy: {
type: 'ajax',
url: '/TruckMng/MsWl_ADL_FuelTruckList/GetFuelDateInputList',
reader: {
idProperty: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//定义Grid
this.MCCargoCMB = Ext.create('Ext.selection.CheckboxModel');
this.gridListAddInput = new Ext.grid.GridPanel({
store: this.storeAddInput,
enableHdMenu: false,
region: 'center',
split: true,
selModel: this.MCCargoCMB,
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
columns: [
new Ext.grid.RowNumberer(),
{
sortable: true, hidden: true,
dataIndex: 'GID',
header: 'GID',
width: 80
},
{
sortable: true,
dataIndex: 'STATION',
header: '站号',
width: 80
},
{
sortable: true,
dataIndex: 'BLSH',
header: '班流水号',
width: 80
},
{
sortable: true,
dataIndex: 'ZH',
header: '账号',
width: 80
},
{
sortable: true,
dataIndex: 'KLX',
header: '卡类型',
width: 80
},
{
sortable: true,
dataIndex: 'CKR',
header: '持卡人',
width: 80
},
{
sortable: true,
dataIndex: 'CH',
header: '车号',
width: 80
},
{
sortable: true,
dataIndex: 'JH',
header: '机号',
width: 80
},
{
sortable: true,
dataIndex: 'YP',
header: '油品',
width: 80
},
{
sortable: true,
dataIndex: 'FUEL',
header: '油量',
width: 80
},
{
sortable: true,
dataIndex: 'PRICE',
header: '单价',
width: 80
},
{
sortable: true,
dataIndex: 'AMOUNT',
header: '金额',
width: 80
},
{
sortable: true,
dataIndex: 'YHED',
header: '优惠额度',
width: 80
},
{
sortable: true,
dataIndex: 'SS',
header: '实收',
width: 80
},
{
sortable: true,
dataIndex: 'YE',
header: '余额(元)',
width: 80
},
{
sortable: true,
dataIndex: 'YY',
header: '余油(升)',
width: 80
},
{
sortable: true,
dataIndex: 'DEPT',
header: '单位',
width: 80
},
{
sortable: true,
dataIndex: 'JYTIME',
header: '加油时间',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'inserted',
header: 'inserted',
width: 80
}
],
features: [],
bbar: Ext.create('Ext.PagingToolbar', {
store: this.storeAddInput,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
})
});
//#endregion
//#region 布局
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 210,
items: [this.panelBtn, this.formEdit]
});
this.panelInput = new Ext.Panel({
title: '单内加油明细',
layout: "border",
region: 'center',
margin: '0 0',
height: 280,
split: true,
items: [this.gridListInput]
});
this.panelPC = new Ext.Panel({
title: '相关派车明细',
layout: "border",
region: 'center',
margin: '0 0',
height: 280,
split: true,
items: [this.gridList]
});
this.MainTab = new Ext.tab.Panel({
layout: "border",
region: "center", split: true,
items: [this.panelInput, this.panelPC//, this.page_3, this.page_4//,this.page_5
]
});
this.panelAddInput = new Ext.Panel({
layout: "border",
region: "south",
height: 280,
split: true,
title: '导入的加油信息',
items: [
this.formSearch, this.gridListAddInput
]
});
Ext.apply(this, {
items: [this.panelTop, this.MainTab, this.panelAddInput]
});
//#endregion
this.opStatus = 'add';
this.ParentWin = window.parent.opener;
//初始化数据
this.InitData();
/*
this.gridListCargoCellEditing.on('beforeedit', function (editor, e) {
return this.CargoBeforeEdit(editor, e);
}, this);
this.gridListCargo.on('edit', function (editor, e, eOpts) {
this.gridListCargoAfterEdit(editor, e, eOpts);
}, this);
this.gridListCargoDo.on('edit', function (editor, e, eOpts) {
this.gridListCargoDoAfterEdit(editor, e, eOpts);
}, this);*/
}, //end initUIComponents
//#region 加载数据
InitData: function () {
var condition = '';
if (this.ParentWin) {
var ret = this.ParentWin.OprationSwap();
this.opStatus = ret[0];
this.StoreList = ret[1];
this.editRecord = ret[2];
this.RefBillNo = ret[3];
}
if (this.opStatus == 'add') {
condition = " GID='' ";
} else if (this.opStatus == 'edit') {
condition = " GID='" + this.editRecord.get('GID') + "'";
}
this.LoadData(this.opStatus, condition, "");
}, //end InitData
LoadData: function (opstatus, condition, refbillno) {
this.poundSerialNo = 0;
this.CargoDel = [];
this.CargoDoDel = [];
this.fixSerialNo = 0;
this.fixBodyDel = [];
this.feeSerialNo = 0;
this.feeBodyDel = [];
this.opStatus = opstatus;
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/TruckMng/MsWl_ADL_FuelTruckList/GetData',
params: {
handle: opstatus,
condition: condition
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title: '提示',
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
}
var data = result.data;
if (this.opStatus == 'add') {
//data.RefBillNo = this.RefBillNo;
}
this.DataLoading = true;
var basicForm = this.formEdit.getForm();
basicForm.reset();
basicForm.setValues(data);
this.DataLoading = false;
//this.SetLockBtnState(data);
//////
this.storeInput.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: " isnull(BSNO,'')<>'' and BSNO='" + data.GID + "' " },
waitMsg: "正在查询数据...",
scope: this
});
/*
var drvName = form.findField('PS_DRVNAME').getValue();
sql = sql + getAndConSql(sql, drvName, " DrvName like '%" + drvName + "%' ");
var TruckNo = form.findField('TruckNo').getValue();
sql = sql + getAndConSql(sql, TruckNo, " TruckNo like '%" + TruckNo + "% ");
var expDate_Min = form.findField('PS_EXPDATEBGN').getRawValue();
sql = sql + getAndConSql(sql, expDate_Min, " ExpDate>='" + expDate_Min + "'");
var expDate_Max = form.findField('PS_EXPDATEEND').getRawValue();
sql = sql + getAndConSql(sql, expDate_Max, " ExpDate<='" + expDate_Max + " 23:59:59'");
*/
var PCCondition = " DrvCode='" + data.DRVCODE + "' and TruckNo='" + data.TRUCKNO + "' and ExpDate>='" + data.EXPDATE_BGN + "' and ExpDate<='" + data.EXPDATE_END + " 23:59:59' ";
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: PCCondition },
waitMsg: "正在查询数据...",
scope: this
});
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
var billno = '*';
var gid = '*';
if (this.opStatus == 'edit') {
billno = this.editRecord.get('BillNo');
gid = this.editRecord.get('GID');
}
//this.storeBodyFix.load({ params: { billno: gid} });
//this.storeBodyChFee.load({ params: { billno: gid} });
//this.storeCargo.load({ params: { billno: billno} });
//this.storeCargoDo.load({ params: { billno: billno} });
}, // end LoadData
SetLockBtnState: function (data) {
if (data.ISPC == "0" && data.ISBACK == "0") {
Ext.getCmp('LOCKPC').enable(); //保存按钮置灰
Ext.getCmp('UNLOCKPC').disable(); //enable;
Ext.getCmp('LOCKBACK').disable();
Ext.getCmp('UNLOCKBACK').disable();
} else
if (data.ISPC == "1" && data.ISBACK == "0") {
Ext.getCmp('LOCKPC').disable(); //保存按钮置灰
Ext.getCmp('UNLOCKPC').enable(); //enable;
Ext.getCmp('LOCKBACK').enable();
Ext.getCmp('UNLOCKBACK').disable();
} else
if (data.ISPC == "1" && data.ISBACK == "1") {
Ext.getCmp('LOCKPC').disable(); //保存按钮置灰
Ext.getCmp('UNLOCKPC').disable(); //enable;
Ext.getCmp('LOCKBACK').disable();
Ext.getCmp('UNLOCKBACK').enable();
}
},
//#endregion
//#region 待添加加油明细的查询
getCondition: function () {
var sql = " isnull(BSNO,'')='' ";
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return "";
}
var TRUCKNO = Ext.getCmp('TRUCKNO').getValue();
sql = sql + getAndConSql(sql, TRUCKNO, " CH like '%" + TRUCKNO + "%' ");
var DrvName = Ext.getCmp('DrvName').getValue();
sql = sql + getAndConSql(sql, DrvName, " CKR like '%" + DrvName + "%' ");
var FuelDate_min = form.findField('FuelDate_min').getRawValue();
sql = sql + getAndConSql(sql, FuelDate_min, "JYTIME >= '" + FuelDate_min + "'");
var FuelDate_max = form.findField('FuelDate_max').getRawValue();
sql = sql + getAndConSql(sql, FuelDate_max, "JYTIME <= '" + FuelDate_max + " 23:59:59'");
return sql;
},
SearchInput: function (button, event) {
var sql = this.getCondition();
this.storeAddInput.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
},
//#endregion
Save: function (type) {
var basicForm = this.formEdit.getForm();
if (!basicForm.isValid()) {
return;
}
//basicForm.findField('BillNo').setDisabled(false);
var data = basicForm.getValues();
//basicForm.findField('BillNo').setDisabled(true);
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/TruckMng/MsWl_ADL_FuelTruckList/Save',
scope: this,
async: false,
params: {
opstatus: this.opStatus,
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) {
var returnData = jsonresult.Data;
this.formEdit.getForm().setValues(returnData);
if (this.opStatus == 'add') {
//var arrNewRecords = this.StoreList.add(returnData);
//this.editRecord = arrNewRecords[0];
} else if (this.opStatus == 'edit') {
var editp = Ext.create('MsWl_ADL_FuelTruckListmb', returnData);
this.editRecord.fields.each(function (field) {
if (field.persist) {
name = field.name;
if (name != 'id')
this.editRecord.set(name, editp.get(name));
}
}, this);
this.editRecord.commit();
}
if (type == '0') {
this.opStatus = 'edit';
//this.SearchMC();
} else if (type == '1') {
window.close(returnData.GID);
} else {
this.LoadData('add', '', "");
//basicForm.findField('BillNo').setDisabled(false);
}
} 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
});
}
}
});
}, //end save
reLine: function (button, event) {
var _L = 1;
this.storeCargo.each(function (record) {
var ln = _L + "";
_L = _L + 1;
record.set('SEQUENCE', ln);
});
},
onDelInputClick: function (button, event) {
var GID = Ext.getCmp("GID").getValue();
if (GID == "" || GID == "*") {
this.Save("0");
}
if (GID == "") {
return;
}
var selectedRecords = this.gridListInput.selModel.getSelection();
Ext.MessageBox.confirm('提示', '确定删除记录吗?', function (btn) {
if (btn == 'yes') {
var GIDList = "";
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (GIDList == "") //如果是新增但没有保存的数据,没有必要提交到后台
{
GIDList = "'" + rec.data.GID + "'";
} else {
GIDList = GIDList + ",'" + rec.data.GID + "'";
}
}
Ext.Ajax.request({
waitMsg: '正在添加信息...',
url: '/TruckMng/MsWl_ADL_FuelTruckList/DelADLFuel',
async: false,
params: {
GID: GID,
GIDList: GIDList
},
callback: function (options, success, response) {
if (success) {
//重新加载两个子表
/*
this.storeInput.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: " isnull(BSNO,'')<>'' and BSNO='" + GID + "' " },
waitMsg: "正在查询数据...",
scope: this
});*/
this.LoadData(this.opStatus, " GID='" + GID + "' ");
this.SearchInput();
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
resultFuel = 0;
}
},
scope: this
});
}
}, this);
}, //onDelDetailClick
AddInput: function (editor, e, eOpts) {
var GID = Ext.getCmp("GID").getValue();
if (GID == "" || GID == "*") {
//var type = '0';
var basicForm = this.formEdit.getForm();
if (!basicForm.isValid()) {
return;
}
var data = basicForm.getValues();
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/TruckMng/MsWl_ADL_FuelTruckList/Save',
scope: this,
async: false,
params: {
opstatus: this.opStatus,
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) {
var returnData = jsonresult.Data;
this.formEdit.getForm().setValues(returnData);
if (this.opStatus == 'add') {
//var arrNewRecords = this.StoreList.add(returnData);
//this.editRecord = arrNewRecords[0];
} else if (this.opStatus == 'edit') {
var editp = Ext.create('MsWl_ADL_FuelTruckListmb', returnData);
this.editRecord.fields.each(function (field) {
if (field.persist) {
name = field.name;
if (name != 'id')
this.editRecord.set(name, editp.get(name));
}
}, this);
this.editRecord.commit();
}
this.opStatus = 'edit';
GID = Ext.getCmp("GID").getValue();
} 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
});
}
}
});
}
if (GID == "") {
return;
}
var selectedRecords = this.gridListAddInput.selModel.getSelection();
var GIDList = "";
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (GIDList == "") //如果是新增但没有保存的数据,没有必要提交到后台
{
GIDList = "'" + rec.data.GID + "'";
} else {
GIDList = GIDList + ",'" + rec.data.GID + "'";
}
}
Ext.Ajax.request({
waitMsg: '正在添加信息...',
url: '/TruckMng/MsWl_ADL_FuelTruckList/AddADLFuel',
async: false,
params: {
GID: GID,
GIDList: GIDList
},
callback: function (options, success, response) {
if (success) {
//重新加载两个子表
/*
this.storeInput.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: " isnull(BSNO,'')<>'' and BSNO='" + GID + "' " },
waitMsg: "正在查询数据...",
scope: this
});*/
this.LoadData(this.opStatus, " GID='" + GID + "' ");
this.SearchInput();
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
resultFuel = 0;
}
},
scope: this
});
},
//#region 明细表合计
setAllTotal: function () {
this.setOverLoadMilTotal();
this.setNoLoadMilTotal();
this.setLoadCountTotal();
// this.setWeightCountTotal();
this.setNoFuelCountTotal();
},
setOverLoadMilTotal: function () {
var total = this.calcDetailTotal('OverLoadMil');
this.setHeadFieldValue('OverLoadMil', total);
},
setNoLoadMilTotal: function () {
var total = this.calcDetailTotal('NoLoadMil');
this.setHeadFieldValue('NoLoadMil', total);
},
setLoadCountTotal: function () {
var total = this.calcDetailTotal('LoadCount');
this.setHeadFieldValue('LoadCount', total);
},
setNoFuelCountTotal: function () {
var total = this.calcDetailTotal('RatedFuel');
this.setHeadFieldValue('RatedFuel', total);
},
calcDetailTotal: function (fieldName) {
var total = 0;
for (var i = 0; i < this.storePoundBodyList.getCount(); i += 1) {
var member = this.storePoundBodyList.getAt(i);
var value = member.get(fieldName);
total = total + value;
}
return total;
},
setHeadFieldValue: function (fieldName, value) {
var field = this.formEdit.getForm().findField(fieldName);
field.setValue(value);
},
//#endregion
//#region 明细操作
onAddDetailClick: function (button, event, type) {
var allow = this.getAllowOperationDetail();
if (allow == false) {
return;
}
var store = null;
if (type == 1) {
store = this.storeBodyFix;
} else if (type == 2) {
store = this.storeBodyChFee;
} else if (type == 3) {
store = this.storePoundBodyList;
} else {
alert('函数(onAddDetailClick)的参数type类型设置的不对');
return;
}
var newSerialno = this.GetHandleSerialNo(store, type);
var record = null;
if (type == 1) {
record = Ext.create('MsWlPcFixed', {
GId: NewGuid(),
BillNo: '*',
SerialNo: newSerialno,
FeeStatus: 1,
FeeStatus_Ref: '录入状态',
AuditStatus: 0,
CreditDebit: "2",
CreditDebit_Ref: "应付",
FeeTypeCode: '',
FeeTypeCode_Ref: '',
FeeTypeName: '',
DistCount: 0,
Price: 0,
FsTotal: 0,
JsTotal: 0,
Remark: ''
});
} else if (type == 2) {
record = Ext.create('MsChFee', {
GId: NewGuid(),
BsNo: '*',
FeeStatus: 1,
FeeStatus_Ref: '录入状态',
FeeType: 1,
FeeType_Ref: '应收',
FeeName: '',
FeeName_Ref: '',
FeeDescription: '',
CustomerType: '',
CustomerName: this.getPoundcustname(),
CustomerName_Ref: '',
Unit: '',
UnitPrice: 0,
Quantity: 1,
Amount: 0,
Currency: 'RMB',
ExChangerate: 1,
Reason: '',
Remark: '',
Commissionrate: 0,
Settlement: 0,
Invoice: 0,
OrderAmount: 0,
OrderInvoice: 0,
SubmitDate: null,
Auditoperator: '',
AuditDate: null,
EnteroPerator: GetCookie_UserId(),
EnterDate: null,
DebitNo: '',
IsDebit: "0",
IsOpen: "0",
IsAdvancedpay: "0",
Sort: "0",
IsInvoice: "0",
FeeFrt: '',
IsCrmOrderFee: "0",
AuditStatus: 0,
InvoiceNum: '',
ChequeNum: '',
WmsOutBsNo: ''
});
} else if (type == 3) {
record = Ext.create('MsWlDjPound', {
BillNo: '*',
SerialNo: newSerialno,
DjBillNo: '',
DjBillNo_Ref: '',
GId: NewGuid(),
CustCode: '',
CustCode_Ref: '',
CustName: '',
ClsName: '',
DepartureDate: '',
LoadPlace: '',
UnLoadPlace: '',
PlanOverLoadMil: 0,
PlanNoLoadMil: 0,
PlanLoadCount: 0,
OverLoadMil: 0,
NoLoadMil: 0,
LoadCount: 0,
PNum: 0,
PKgs: 0,
Weight: 0,
WorkTime: ''
});
}
store.add(record);
var editColumnIndex = 0;
var cellediting = null;
if (type == 1) {
cellediting = this.cellEditingFix;
editColumnIndex = 2;
} else if (type == 2) {
cellediting = this.cellEditingChFee;
editColumnIndex = 4;
} else if (type == 3) {
cellediting = this.PoundgridListCellEditing;
editColumnIndex = 2;
}
var n = store.getCount();
cellediting.startEditByPosition({ row: n - 1, column: editColumnIndex });
},
GetHandleSerialNo: function (store, type) {
var result = 0;
if (type == 1) {
result = this.fixSerialNo;
} else if (type == 2) {
result = this.feeSerialNo;
} else if (type == 3) {
result = this.poundSerialNo;
}
if (result == 0) {
for (var i = 0; i < store.getCount(); i += 1) {
var member = store.getAt(i);
if (member.data.SerialNo > result) {
result = member.data.SerialNo;
}
}
}
result = result + 1;
if (type == 1) {
this.fixSerialNo = result;
} else if (type == 2) {
this.feeSerialNo = result;
} else if (type == 3) {
this.poundSerialNo = result;
}
return result;
},
onDelDetailClick: function (button, event, type) {
var allow = this.getAllowOperationDetail();
if (allow == false) {
return;
}
var store = null;
if (type == 1) {
store = this.storeBodyFix;
} else if (type == 2) {
store = this.storeBodyChFee;
} else if (type == 3) {
store = this.storePoundBodyList;
} else {
alert('函数(onAddDetailClick)的参数type类型设置的不对');
return;
}
var result = 0;
if (type == '1') {
result = this.fixSerialNo;
} else if (type == '2') {
result = this.feeSerialNo;
} else if (type == '3') {
result = this.poundSerialNo;
}
if (result == 0) {
for (var i = 0; i < store.getCount(); i += 1) {
var member = store.getAt(i);
if (member.data.SerialNo > this.giSerialNo) {
result = member.data.SerialNo;
}
}
}
if (type == '1') {
this.fixSerialNo = result;
} else if (type == '2') {
this.feeSerialNo = result;
} else if (type == '3') {
this.poundSerialNo = result;
}
var selectedRecords = [];
if (type == '1') {
selectedRecords = this.gridListFix.selModel.getSelection();
} else if (type == '2') {
selectedRecords = this.gridListChFee.selModel.getSelection();
var candelete = DsTruck.CheckChFeeDelete(selectedRecords);
if (candelete == false)
return;
} else if (type == '3') {
selectedRecords = this.PoundgridList.selModel.getSelection();
}
if (selectedRecords.length > 0) {
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (rec.BillNo != "" || rec.BillNo != "*") //如果是新增但没有保存的数据,没有必要提交到后台
{
if (type == '1') {
this.fixBodyDel.push(rec);
} else if (type == '2') {
this.feeBodyDel.push(rec);
} else if (type == '3') {
this.CargoDel.push(rec);
}
}
if (type == '1') {
this.storeBodyFix.remove(selectedRecords[i]);
} else if (type == '2') {
this.storeBodyChFee.remove(selectedRecords[i]);
} else if (type == '3') {
this.storePoundBodyList.remove(selectedRecords[i]);
this.setAllTotal();
}
}
}
},
getAllowOperationDetail: function () {
var feeStatus = this.getFeeStatus();
if (feeStatus == '0')
return true;
else {
//Ext.Msg.show({ title: '错误', msg: "费用已锁定,不允许操作费用!", icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
//return false;
}
},
//#endregion
setSaveBtnStatus: function (enable) {
var bsbtnSave = Ext.getCmp('pcbtnSave');
var bsbtnSaveAndClose = Ext.getCmp('pcbtnSaveAndClose');
var bsbtnSaveAndNew = Ext.getCmp('pcbtnSaveAndNew');
var pcbtnNew = Ext.getCmp('pcbtnNew');
if (enable) {
bsbtnSave.enable();
bsbtnSaveAndClose.enable();
bsbtnSaveAndNew.enable();
pcbtnNew.enable();
} else {
//bsbtnSave.disable();
//bsbtnSaveAndClose.disable();
bsbtnSaveAndNew.disable();
pcbtnNew.disable();
}
},
getTruckNo: function () {
var truckNo = this.formEdit.getForm().findField('TruckNo');
return truckNo.getValue();
},
Print: function () {
/*
var basicForm = this.formEdit.getForm();
var billNo = basicForm.findField('BillNo').value;
if (billNo == '*' || billNo == '') {
Ext.Msg.show({ title: '错误', msg: '单据还没有保存,请保存后再打印', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
var gid = basicForm.findField('GID').value;
var refBillNo = basicForm.findField('RefBillNo').value;
var printType = 'MSWL_LKPC';
var sql1 = "SET LANGUAGE 'us_english' "
+ " select *,(select Mobile from user_baseinfo where USERID=(select GID from [user] where codename=ddcode)) 调度手机 from vMsWlPcHeadPrint WHERE BillNo = '" + billNo + "'";
var sql2 = "SET LANGUAGE 'us_english' SELECT * from ch_fee where BsNo='" + gid + "'";
var records = this.feeGridCheckBoxModel.selected.items;
if (records.length > 0) {
var feeGidSql = '';
for (var i = 0; i < records.length; i++) {
var record = records[i];
var feeGId = "'" + record.get('GId') + "'";
if (feeGidSql == '') {
feeGidSql = feeGId;
} else {
feeGidSql = feeGidSql + "," + feeGId;
}
}
if (feeGidSql != '') {
sql2 = sql2 + ' and Gid in (' + feeGidSql + ')';
}
}
var sql3 = "select distinct PointName 站点名称,[address] 站点地址,CONTACTER 联系人,convert(varchar,convert(DECIMAL,TEL)) 电话"
sql3 = sql3 + " ,PC_BILLNO,POINT_GID,dbo.F_LK_Cargo(PC_BILLNO,POINT_GID) 货物信息";
sql3 = sql3 + " from(select c.GID,c.SEQUENCE,c.PC_BILLNO,c.CARGOINFO_GID,I.CARGONAME CARGO_NAME,I.CARGOTYPE CargoType ";
sql3 = sql3 + " ,c.PalletCount,c.CargoCount,c.[WEIGHT],c.POINT_GID,P.NAME PointName,P.[ADDRESS],P.CONTACTER,P.TEL,C.Remark ";
sql3 = sql3 + " ,I.BOXCOUNT,I.BOXWEIGHT ";
sql3 = sql3 + " from tMsWl_LK_Cargo C ";
sql3 = sql3 + " left join tMsWl_LK_CargoInfo I on I.gid=c.CARGOINFO_GID ";
sql3 = sql3 + " left join tMsWl_LK_Point P on P.gid=c.POINT_GID ";
sql3 = sql3 + " where C.PC_BILLNO='" + billNo + "')tt ";
var sql4 = "SET LANGUAGE 'us_english' select A.*,B.* from vMsWlPcHeadPrint A,tMsWlPcFixed B where A.Gid=B.BillNo and A.BillNo='" + billNo + "' order by A.BillNo";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
*/
}
,
//获取油耗
getTruckLoadFuel: function (ton, mil, type) {
var resultFuel = 0;
var truckNo = this.getTruckNo();
if (truckNo == null || truckNo == "") {
resultFuel = 0;
return resultFuel;
}
if (ton == null || ton == "" || mil == null) {
resultFuel = 0;
return resultFuel;
}
resultFuel = this.getTruckFuel(truckNo, type, ton, mil);
return resultFuel;
},
getTruckFuel: function (truckNo, loadType, ton, mil) {
var resultFuel = 0;
Ext.Ajax.request({
waitMsg: '正在计算车里油量信息...',
url: '/TruckMng/MsWlDjPc/GetTruckFuel',
async: false,
params: {
truckNo: truckNo,
loadType: loadType,
ton: ton,
mil: mil
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title: '提示',
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
resultFuel = 0;
}
var data = result.data;
resultFuel = data;
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
resultFuel = 0;
}
},
scope: this
});
return resultFuel;
},
setDrvName: function (drvCode) {
var recs = DsStoreQueryBy(this.storeDrvName, 'DrvCode', drvCode);
var basicForm = this.formEdit.getForm();
var custname = basicForm.findField('DrvName');
var mobile = basicForm.findField('Mobile');
if (recs.getCount() > 0) {
var data = recs.getAt(0).data;
custname.setValue(data.DrvName);
mobile.setValue(data.Mobile);
} else {
custname.setValue('');
mobile.setValue('');
}
}
});