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/MsWlBs/20130614优化前备份/MsWlPcEdit_Bak.js

2041 lines
71 KiB
JavaScript

3 years ago
Ext.namespace('DsTruck');
DsTruck.MsWlPcEdit = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.DsTruck.MsWlPcEdit.superclass.constructor.call(this);
};
Ext.extend(DsTruck.MsWlPcEdit, Ext.Panel, {
ParentWin: null, //弹出式
ParentPanel: null, //Tab页编辑模式
FunType: '',
OpStatus: 'add',
StoreList: null,
EditRecord: null,
RefBillNo: '*',
DataLoading: true,
LoadFuel: 0,
NoLoadFuel: 0,
//主要是为了处理修改事件。使用focus和blur模拟change事件。
RealMil: 0,
OverLoadMil: 0,
NoLoadMil: 0,
Ton: 0,
initUIComponents: function () {
this.fixSerialNo = 0;
this.fixBodyDel = [];
this.feeSerialNo = 0;
this.feeBodyDel = [];
//#region 编辑form
//枚举参照相关(编辑form)
this.storeBsType = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeBsType.load({ params: { enumTypeId: 99025} });
this.comboxBsType = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '托单类型',
store: this.storeBsType,
name: 'BsType'
});
//表参照相关(编辑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);
},
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) {
var recs = DsStoreQueryBy(this.storeDrvName, 'DrvCode', records[0].data.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('');
}
}
}
}
});
this.storeContainerType = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsTruckMng.ux.CtnRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCtnRefList' }
});
this.storeContainerType.load({ params: { condition: ""} });
this.comboxContainerType = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '箱型',
store: this.storeContainerType,
name: 'ContainerType',
valueField: 'CtnCode',
displayField: 'CodeAndName'
});
this.storeYardCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsTruckMng.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeYardCode.load({ params: { condition: "ISYARD='1'"} });
this.comboxYardCode = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '拖箱场站',
store: this.storeYardCode,
name: 'YardCode',
valueField: 'CustCode',
displayField: 'CodeAndName'
});
this.comboxRtnYardCode = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '返箱场站',
store: this.storeYardCode,
name: 'RtnYardCode',
valueField: 'CustCode',
displayField: 'CodeAndName'
});
this.comboxYardCodeSe = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '拖箱场站',
store: this.storeYardCode,
name: 'YardCodeSe',
valueField: 'CustCode',
displayField: 'CodeAndName'
});
this.comboxRtnYardCodeSe = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '返箱场站',
store: this.storeYardCode,
name: 'RtnYardCodeSe',
valueField: 'CustCode',
displayField: 'CodeAndName'
});
this.storeDdCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsTruckMng.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' }
});
this.storeDdCode.load({ params: { condition: ""} });
this.comboxDdCode = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '调度员编码',
store: this.storeDdCode,
name: 'DdCode',
valueField: 'UserCode',
displayField: 'CodeAndName'
});
this.storeVoyVeg = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsTruckMng.ux.VoyRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetVoyRefList' }
});
this.storeVoyVeg.load({ params: { condition: ""} });
this.comboxVoyVeg = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '船名航次',
store: this.storeVoyVeg,
name: 'VoyVeg',
valueField: 'VoyCode',
displayField: 'CodeAndName'
});
//编辑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: [
//#region 界面需要的但不需要显示的控件
{
fieldLabel: '录入日期',
name: 'LrDate',
flex: 0,
hidden: true,
margins: '0'
}, {
fieldLabel: '记账日期',
name: 'JzDate',
flex: 0,
hidden: true,
margins: '0'
}, {
fieldLabel: '用户编码',
name: 'UserCode',
flex: 0,
hidden: true,
margins: '0'
}, {
fieldLabel: '用户姓名',
name: 'UserName',
flex: 0,
hidden: true,
margins: '0'
}, {
fieldLabel: '组织编码',
name: 'OrgCode',
flex: 0,
hidden: true,
margins: '0'
}, {
fieldLabel: '组织名称',
name: 'OrgName',
flex: 0,
hidden: true,
margins: '0'
}, {
fieldLabel: '司机姓名',
name: 'DrvName',
flex: 0,
hidden: true,
margins: '0'
}, {
fieldLabel: '开船日期',
name: 'EtDate',
flex: 0,
hidden: true,
margins: '0'
}, {
fieldLabel: '截港日期',
name: 'EndPortDate',
flex: 0,
hidden: true,
margins: '0'
}, {
fieldLabel: '场站名称',
name: 'YardName',
flex: 0,
hidden: true,
margins: '0'
}, {
fieldLabel: '周转量',
name: 'AroundTon',
flex: 0,
hidden: true,
margins: '0'
}, {
fieldLabel: '运输次数',
name: 'LoadCount',
flex: 0,
hidden: true,
margins: '0'
}, {
fieldLabel: '调度员姓名',
name: 'DdName',
flex: 0,
hidden: true,
margins: '0'
}, {
fieldLabel: '相关托单结算客户',
name: 'RefCustomerName',
flex: 0,
hidden: true,
margins: '0'
}, {
fieldLabel: '时间戳',
name: 'TimeMark',
flex: 0,
hidden: true,
margins: '0'
},
{
fieldLabel: '相关托单物流号',
name: 'RefBillNo',
flex: 0,
hidden: true,
margins: '0'
}, {
fieldLabel: '单据锁定状态',
name: 'BillStatus',
flex: 0,
hidden: true,
margins: '0'
}, {
fieldLabel: '费用锁定状态',
name: 'FeeStatus',
flex: 0,
hidden: true,
margins: '0'
}, {
fieldLabel: 'GId',
name: 'GId',
flex: 0,
hidden: true,
margins: '0'
},
//#endregion
{
fieldLabel: '物流号',
allowBlank: false,
disabled: true,
name: 'BillNo'
}, this.comboxDdCode, this.comboxTruckNo
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxDrvName, {
fieldLabel: '司机手机',
name: 'Mobile'
}, {
fieldLabel: '派车日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ExpDate'
}, this.comboxBsType
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxVoyVeg, {
fieldLabel: '提单号',
name: 'MblNo'
}, this.comboxContainerType
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxYardCode, this.comboxRtnYardCode, {
fieldLabel: '始发地点',
name: 'LoadPlace'
}, {
fieldLabel: '目的地',
name: 'DstArea'
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '工厂地址',
name: 'DetiNation'
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '联系电话',
name: 'LinkTel'
}, {
fieldLabel: '联系人',
name: 'LinkMan'
}, {
fieldLabel: '本次加油量',
xtype: 'numberfield',
allowBlank: false,
hideTrigger: true,
keyNavEnabled: false,
mouseWheelEnabled: false,
disabled: true,
name: 'FuelQty'
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '实际里程',
xtype: 'numberfield',
allowBlank: false,
name: 'RealMil',
hideTrigger: true,
keyNavEnabled: false,
mouseWheelEnabled: false,
listeners: {
focus: function (field, eOpts) {
this.RealMil = field.value;
},
blur: function (field, eOpts) {
var newValue = field.value;
this.realMilChange(field, newValue, this.RealMil);
},
scope: this
}
}, {
fieldLabel: '重驶里程',
xtype: 'numberfield',
allowBlank: false,
name: 'OverLoadMil',
hideTrigger: true,
keyNavEnabled: false,
mouseWheelEnabled: false,
listeners: {
focus: function (field, eOpts) {
this.OverLoadMil = field.value;
},
blur: function (field, eOpts) {
var newValue = field.value;
this.overLoadMilChange(field, newValue, this.OverLoadMil);
},
scope: this
}
}, {
fieldLabel: '空驶里程',
xtype: 'numberfield',
allowBlank: false,
name: 'NoLoadMil',
hideTrigger: true,
keyNavEnabled: false,
mouseWheelEnabled: false,
listeners: {
focus: function (field, eOpts) {
this.NoLoadMil = field.value;
},
blur: function (field, eOpts) {
var newValue = field.value;
this.noLoadMilChange(field, newValue, this.NoLoadMil);
},
scope: this
}
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [, {
fieldLabel: '货重(吨)',
xtype: 'numberfield',
allowBlank: false,
name: 'Ton',
hideTrigger: true,
keyNavEnabled: false,
mouseWheelEnabled: false,
listeners: {
focus: function (field, eOpts) {
this.Ton = field.value;
},
blur: function (field, eOpts) {
var newValue = field.value;
this.tonAndTruckNoChange(field, newValue, this.Ton);
},
scope: this
}
}, {
fieldLabel: '重驶油耗',
xtype: 'numberfield',
allowBlank: false,
hideTrigger: true,
keyNavEnabled: false,
mouseWheelEnabled: false,
name: 'LoadFuel'
}, {
fieldLabel: '空驶油耗',
xtype: 'numberfield',
allowBlank: false,
hideTrigger: true,
keyNavEnabled: false,
mouseWheelEnabled: false,
name: 'NoLoadFuel'
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '额定油耗',
xtype: 'numberfield',
allowBlank: false,
hideTrigger: true,
keyNavEnabled: false,
mouseWheelEnabled: false,
name: 'RatedFuel'
}, {
fieldLabel: '实际油耗',
xtype: 'numberfield',
allowBlank: false,
hideTrigger: true,
keyNavEnabled: false,
mouseWheelEnabled: false,
name: 'RealFuel'
}, { xtype: 'hiddenfield' }, {
fieldLabel: '额定里程',
xtype: 'numberfield',
allowBlank: false,
name: 'RatedMil',
hideTrigger: true,
keyNavEnabled: false,
mouseWheelEnabled: false,
hidden: true
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '变动里程',
xtype: 'numberfield',
allowBlank: false,
hideTrigger: true,
keyNavEnabled: false,
mouseWheelEnabled: false,
name: 'ChangedMil'
}, {
fieldLabel: '变动油耗',
xtype: 'numberfield',
allowBlank: false,
hideTrigger: true,
keyNavEnabled: false,
mouseWheelEnabled: false,
name: 'ChangedFuel'
}, {
fieldLabel: '变动原因',
name: 'ChangedReson'
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '到厂日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ArriveDate'
}, {
fieldLabel: '到厂时间',
name: 'ArriveTime'
}, {
fieldLabel: '返回日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ReturnDate'
}, {
fieldLabel: '返回时间',
name: 'ReturnTime'
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '客户联系人姓名',
flex: 2,
name: 'CustLikeManName'
}, {
fieldLabel: '客户联系电话',
flex: 2,
name: 'CustTel'
}, {
fieldLabel: '发票抬头',
flex: 3,
name: 'BillRises1'
}, {
xtype: 'checkboxfield',
fieldLabel: '是否双背',
flex: 1,
allowBlank: false,
name: 'IsDouble',
listeners: {
change: function (field, newValue, oldValue, eOpts) {
Ext.getCmp('fdDouble').setVisible(newValue);
}
}
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textarea',
items: [{
fieldLabel: '备注',
name: 'Remark'
}
]
}
]//end items(fieldset 1)
}, //end fieldset 1
{
//fieldset 2
xtype: 'fieldset',
//checkboxToggle: true,
//collapsed: true,
hidden: true,
id: 'fdDouble',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '托单物流号',
name: 'RefBillNoSe',
listeners: {
change: function (field, newValue, oldValue) {
this.refBillNoSeChange(field, newValue, oldValue);
},
scope: this
}
}, {
fieldLabel: '提单号',
name: 'MblNoSe'
}, this.comboxVoyVegSe
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '开船日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'EtDateSe'
}, {
fieldLabel: '截港日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'EndPortDateSe'
}, this.comboxYardCodeSe
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxRtnYardCodeSe, {
fieldLabel: '联系人',
name: 'LinkManSe'
}, {
fieldLabel: '联系电话',
name: 'LinkTelSe'
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '目的地',
name: 'DstAreaSe'
}, {
fieldLabel: '工厂地址',
name: 'DetiNationSe',
flex: 2
}
]
}
]//end items(fieldset 1)
}//end fieldset 2
]//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: "关闭",
handler: function (button, event) {
window.close();
},
scope: this
},
{
id: 'pcbtnNew',
text: "新建",
handler: function (button, event) {
this.LoadData('add', '', this.RefBillNo);
var basicForm = this.formEdit.getForm();
basicForm.findField('BillNo').setDisabled(false);
},
scope: this
},
'-',
{
text: "打印",
iconCls: "btnprint",
handler: function (button, event) {
this.Print();
},
scope: this
}
]
}); //end 按钮Toolbar
//#endregion
//#region 固定费用明细表
//明细表表格相关
this.storeCreditDebitRef = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeCreditDebitRef.load({ params: { enumTypeId: 99020} });
this.comboxCreditDebitRef = Ext.create('DsExt.ux.RefEnumCombox', {
store: this.storeCreditDebitRef,
name: 'CreditDebit'
});
this.storeFeeTypeCodeRef = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsTruckMng.ux.FeeTypeRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetFeeTypeRefList' }
});
this.storeFeeTypeCodeRef.load({ params: { condition: "ISTRUCKING='1' and ISTRUCKINGFIXED ='1'"} });
this.comboxFeeTypeCodeRef = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeFeeTypeCodeRef,
name: 'FeeTypeCode',
valueField: 'FeeCode',
displayField: 'CodeAndName'
});
//明细表-数据集
this.storeBodyFix = Ext.create('Ext.data.Store', {
model: 'MsWlPcFixed',
remoteSort: false,
proxy: {
type: 'ajax',
url: '/TruckMng/MsWlPc/GetFeeFixBodyList',
reader: {
id: 'BillNo',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//明细表表格
this.cellEditingFix = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.gridListFix = new Ext.grid.GridPanel({
store: this.storeBodyFix,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
plugins: [this.cellEditingFix],
selType: 'cellmodel',
tbar: [{
text: '增加明细',
tooltip: '增加明细',
iconCls: "btnadddetail",
handler: function (button, event) {
this.onAddDetailClick(button, event, '1');
},
scope: this
}, '-', {
text: '删除明细',
tooltip: '删除明细',
iconCls: "btndeletedetail",
handler: function (button, event) {
this.onDelDetailClick(button, event, '1');
},
scope: this
}],
columns: [{
sortable: true,
dataIndex: 'BillNo',
header: '单据号',
hidden: true,
width: 120
}, {
sortable: true,
dataIndex: 'SerialNo',
header: '序号',
width: 40
}, {
sortable: true,
dataIndex: 'FeeTypeCode',
header: '费用编码',
renderer: function (value, p, record) {
if (value == null || value == '')
return '';
else
return value + '-' + record.data.FeeTypeCode_Ref;
},
editor: this.comboxFeeTypeCodeRef,
width: 80
}, {
sortable: true,
dataIndex: 'FeeTypeName',
header: '费用名称',
hidden: true,
width: 120
}, {
sortable: true,
dataIndex: 'FsTotal',
header: '金额',
editor: {
xtype: 'numberfield',
allowBlank: false,
selectOnFocus: true
},
width: 60
}, {
sortable: true,
dataIndex: 'Remark',
header: '备注',
editor: {
xtype: 'textfield',
selectOnFocus: true
},
width: 150
}
]
});
this.gridListFix.on('edit', function (editor, e, eOpts) {
this.gridListFixAfterEdit(editor, e, eOpts);
}, this);
this.cellEditingFix.on('beforeedit', function (editor, e) {
return this.cellEditingFixBeforeEdit(editor, e);
}, this);
//#endregion 明细表
//#region 费用表
//明细表表格相关
this.storeFeeTypeRef = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeFeeTypeRef.load({ params: { enumTypeId: 99020} });
this.comboxFeeTypeRef = Ext.create('DsExt.ux.RefEnumCombox', {
store: this.storeFeeTypeRef,
name: 'FeeType'
});
this.storeFeeNameRef = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsTruckMng.ux.FeeTypeRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetFeeTypeRefList' }
});
this.storeFeeNameRef.load({ params: { condition: "ISTRUCKING='1' "} });
this.comboxFeeNameRef = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeFeeNameRef,
name: 'FeeName',
valueField: 'Name',
displayField: 'CodeAndName'
});
this.storeCustomerNameRef = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsTruckMng.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeCustomerNameRef.load({ params: { condition: ""} });
this.comboxCustomerNameRef = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeCustomerNameRef,
name: 'CustomerName',
valueField: 'CustName',
displayField: 'CodeAndName'
});
//明细表-数据集
this.storeBodyChFee = Ext.create('Ext.data.Store', {
model: 'MsChFee',
remoteSort: false,
proxy: {
type: 'ajax',
url: '/TruckMng/MsChFee/GetDataList',
reader: {
id: 'GId',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//明细表表格
this.cellEditingChFee = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.feeGridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
this.gridListChFee = new Ext.grid.GridPanel({
store: this.storeBodyChFee,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
plugins: [this.cellEditingChFee],
selModel: this.feeGridCheckBoxModel,
selType: 'cellmodel',
viewConfig: {
autoFill: true,
getRowClass: function (record, rowIndex, rowParams, store) {
var feeStatus = record.get('FeeStatus');
return DsTruck.MsChFeeGetRowClass(feeStatus);
}
},
tbar: [{
text: '增加明细',
tooltip: '增加明细',
iconCls: "btnadddetail",
handler: function (button, event) {
this.onAddDetailClick(button, event, '2');
},
scope: this
}, '-', {
text: '删除明细',
tooltip: '删除明细',
iconCls: "btndeletedetail",
handler: function (button, event) {
this.onDelDetailClick(button, event, '2');
},
scope: this
}, '-', {
text: '提交审核',
tooltip: '提交审核',
iconCls: 'btnsubmitaudit',
handler: function (button, event) {
this.onSubmitAuditClick(button, event);
},
scope: this
}],
columns: [{
sortable: true,
dataIndex: 'GId',
header: '惟一编号',
hidden: true,
width: 160
}, {
sortable: true,
dataIndex: 'BsNo',
header: '业务编号',
hidden: true,
width: 200
}, {
sortable: true,
dataIndex: 'FeeStatus',
header: '费用状态',
renderer: function (value, p, record) {
return record.data.FeeStatus_Ref;
},
width: 66
}, {
sortable: true,
dataIndex: 'FeeName',
header: '费用名称',
editor: this.comboxFeeNameRef,
width: 100
}, {
sortable: true,
dataIndex: 'FeeType',
header: '收付方式',
renderer: function (value, p, record) {
if (value == null || value == '')
return '';
else
return value + '-' + record.data.FeeType_Ref;
},
editor: this.comboxFeeTypeRef,
width: 66
}, {
sortable: true,
dataIndex: 'FeeDescription',
header: '费用英文名称',
hidden: true,
width: 200
}, {
sortable: true,
dataIndex: 'CustomerType',
header: '客户类别',
hidden: true,
width: 200
}, {
sortable: true,
dataIndex: 'CustomerName',
header: '结算对象',
editor: this.comboxCustomerNameRef,
width: 120
}, {
sortable: true,
dataIndex: 'Unit',
header: '单位标准',
hidden: true,
width: 200
}, {
sortable: true,
dataIndex: 'UnitPrice',
header: '单价',
editor: {
xtype: 'numberfield',
selectOnFocus: true
},
width: 60
}, {
sortable: true,
dataIndex: 'Quantity',
header: '数量',
editor: {
xtype: 'numberfield',
selectOnFocus: true
},
width: 60
}, {
sortable: true,
dataIndex: 'Amount',
header: '金额',
width: 60
}, {
sortable: true,
dataIndex: 'Currency',
header: '币别',
hidden: true,
width: 200
}, {
sortable: true,
dataIndex: 'ExChangerate',
header: '汇率',
hidden: true,
width: 160
}, {
sortable: true,
dataIndex: 'Reason',
header: '原因',
hidden: true,
width: 200
}, {
sortable: true,
dataIndex: 'Remark',
header: '备注',
editor: {
xtype: 'textfield',
selectOnFocus: true
},
width: 150
}, {
sortable: true,
dataIndex: 'Commissionrate',
header: '佣金比率',
hidden: true,
width: 160
}, {
sortable: true,
dataIndex: 'Settlement',
header: '结算金额',
hidden: true,
width: 160
}, {
sortable: true,
dataIndex: 'Invoice',
header: '开票金额',
hidden: true,
width: 160
}, {
sortable: true,
dataIndex: 'OrderAmount',
header: '申请金额',
hidden: true,
width: 160
}, {
sortable: true,
dataIndex: 'OrderInvoice',
header: '申请开票',
hidden: true,
width: 160
}, {
sortable: true,
dataIndex: 'SubmitDate',
header: '提交时间',
hidden: true,
width: 200
}, {
sortable: true,
dataIndex: 'Auditoperator',
header: '审核人',
hidden: true,
width: 200
}, {
sortable: true,
dataIndex: 'AuditDate',
header: '审核时间',
hidden: true,
width: 200
}, {
sortable: true,
dataIndex: 'EnteroPerator',
header: '录入人',
hidden: true,
width: 200
}, {
sortable: true,
dataIndex: 'EnterDate',
header: '录入时间',
hidden: true,
width: 200
}, {
sortable: true,
dataIndex: 'DebitNo',
header: '对账编号',
hidden: true,
width: 200
}, {
sortable: true,
dataIndex: 'IsDebit',
header: '是否对帐',
hidden: true,
width: 20
}, {
sortable: true,
dataIndex: 'IsOpen',
header: '是否机密',
hidden: true,
width: 20
}, {
sortable: true,
dataIndex: 'IsAdvancedpay',
header: '是否垫付',
hidden: true,
width: 20
}, {
sortable: true,
dataIndex: 'Sort',
header: '排序值',
hidden: true,
width: 20
}, {
sortable: true,
dataIndex: 'IsInvoice',
header: '是否开发票',
hidden: true,
width: 20
}, {
sortable: true,
dataIndex: 'FeeFrt',
header: '运费支付方式',
hidden: true,
width: 160
}, {
sortable: true,
dataIndex: 'IsCrmOrderFee',
header: '是否来自订舱费用信息',
hidden: true,
width: 20
}, {
sortable: true,
dataIndex: 'AuditStatus',
header: '审核状态',
hidden: true,
width: 100
}, {
sortable: true,
dataIndex: 'InvoiceNum',
header: '发票号码',
hidden: true,
width: 200
}, {
sortable: true,
dataIndex: 'ChequeNum',
header: '支票号码',
hidden: true,
width: 200
}, {
sortable: true,
dataIndex: 'WmsOutBsNo',
header: '出库单BSNO',
hidden: true,
width: 200
}
]
});
this.gridListChFee.on('edit', function (editor, e, eOpts) {
this.gridListChFeeAfterEdit(editor, e, eOpts);
}, this);
this.cellEditingChFee.on('beforeedit', function (editor, e) {
return this.cellEditingChFeeBeforeEdit(editor, e);
}, this);
//#endregion
//#region 布局
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 320,
items: [this.panelBtn, this.formEdit]
});
this.panelBodyFix = new Ext.Panel({
title: '固定费用',
layout: "border",
region: 'west',
width: 270,
margin: '5 10',
items: [this.gridListFix]
});
this.panelBodyChFee = new Ext.Panel({
title: '费用',
layout: "border",
region: 'center',
margin: '5 10',
items: [this.gridListChFee]
});
this.panelFee = new Ext.Panel({
layout: "border",
region: "center",
items: [
this.panelBodyFix, this.panelBodyChFee
]
});
Ext.apply(this, {
items: [this.panelTop, this.panelFee]
});
//#endregion
this.opStatus = 'add';
parentWin = window.parent.opener;
{
if (parentWin) {
var ret = parentWin.OprationSwap();
var fun = ret[4];
if (fun) {
this.FunType = fun;
if (fun == "MsRptPcHeadQryIndex") {
this.opStatus = ret[0];
this.StoreList = ret[1];
this.editRecord = ret[2];
this.RefBillNo = ret[3];
this.setSaveBtnStatus(false);
var pcbtnNew = Ext.getCmp('pcbtnNew');
pcbtnNew.disable();
this.InitData();
}
}
}
}
}, //end initUIComponents
//#region 加载数据
InitData: function () {
var condition = '';
if (this.ParentPanel) {
var ret = this.ParentPanel.OprationSwap();
this.opStatus = ret[0];
this.StoreList = ret[1];
this.editRecord = ret[2];
this.RefBillNo = ret[3];
}
if (this.opStatus == 'add') {
condition = " BillNo='*'";
} else if (this.opStatus == 'edit') {
if (this.FunType == 'MsRptPcHeadQryIndex') {
condition = " BillNo='" + this.editRecord.get('BILLNO') + "'";
} else {
condition = " BillNo='" + this.editRecord.get('BillNo') + "'";
}
}
this.LoadData(this.opStatus, condition, this.RefBillNo);
}, //end InitData
LoadData: function (opstatus, condition, refbillno) {
this.fixSerialNo = 0;
this.fixBodyDel = [];
this.feeSerialNo = 0;
this.feeBodyDel = [];
this.opStatus = opstatus;
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/TruckMng/MsWlPc/GetData',
params: {
handle: opstatus,
condition: condition,
refbillno: refbillno
},
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.LoadFuel = basicForm.findField('LoadFuel').value;
this.NoLoadFuel = basicForm.findField('NoLoadFuel').value;
this.DataLoading = false;
} 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} });
}, // end LoadDate
//#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);
var bodyFixdatas = [];
for (var i = 0; i < this.storeBodyFix.getCount(); i += 1) {
var member = this.storeBodyFix.getAt(i);
bodyFixdatas.push(member);
}
;
var jsonFixBody = ConvertRecordsToJson(bodyFixdatas);
var jsonFixDelBody = ConvertRecordsToJsonAll(this.fixBodyDel);
var bodyChFeeDatas = [];
for (i = 0; i < this.storeBodyChFee.getCount(); i += 1) {
var memberyf = this.storeBodyChFee.getAt(i);
bodyChFeeDatas.push(memberyf);
var amount = memberyf.data.Amount;
if (amount == 0) {
Ext.Msg.show({ title: '警告',
msg: '费用的金额不允许为0请修改后再保存',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
return;
}
}
;
var jsonChFeeBody = ConvertRecordsToJson(bodyChFeeDatas);
var jsonChFeeDelBody = ConvertRecordsToJsonAll(this.feeBodyDel);
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/TruckMng/MsWlPc/Save',
scope: this,
params: {
opstatus: this.opStatus,
data: Ext.JSON.encode(data),
fixbody: jsonFixBody,
fixdelbody: jsonFixDelBody,
chfeebody: jsonChFeeBody,
chfeedelbody: jsonChFeeDelBody
},
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('MsWlPcHead', 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';
basicForm.findField('BillNo').setDisabled(true);
for (var i = 0; i < this.storeBodyFix.getCount(); i += 1) {
var member = this.storeBodyFix.getAt(i);
member.set("BillNo", this.editRecord.get('BillNo'));
member.commit();
}
;
// for (var i = 0; i < this.storeBodyChFee.getCount(); i += 1) {
// var member = this.storeBodyChFee.getAt(i);
// //member.set("BsNo", this.editRecord.get('BillNo'));
// member.commit();
// };
let gid = this.editRecord.get('GId');
let billno = this.editRecord.get('BillNo')
this.storeBodyChFee.load({ params: { condition: "Bsno='" + gid + "' or Bsno='" + billno + "'" } });
} else if (type == '1') {
window.close();
} else {
this.LoadData('add', '', this.RefBillNo);
//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
//#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 {
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.getCustName(),
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: ''
});
}
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;
}
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;
}
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;
}
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 {
alert('函数(onAddDetailClick)的参数type类型设置的不对');
return;
}
var result = 0;
if (type == '1') {
result = this.fixSerialNo;
} else if (type == '2') {
result = this.feeSerialNo;
}
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;
}
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;
}
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);
}
}
if (type == '1') {
this.storeBodyFix.remove(selectedRecords[i]);
} else if (type == '2') {
this.storeBodyChFee.remove(selectedRecords[i]);
}
}
}
},
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
//#region 表格的AfterEdit
gridListFixAfterEdit: function (editor, e, eOpts) {
if (e.field == 'FeeTypeCode') {
var records = DsStoreQueryBy(this.storeFeeTypeCodeRef, 'FeeCode', e.value);
if (records.getCount() > 0) {
var data = records.getAt(0).data;
e.record.set('FeeTypeCode_Ref', data.Name);
e.record.set('FeeTypeName', data.Name);
} else {
e.record.set('FeeTypeCode_Ref', '');
e.record.set('FeeTypeName', '');
}
} else if (e.field == 'CreditDebit') {
var recordsCreditDebit = DsStoreQueryBy(this.storeCreditDebitRef, 'EnumValueId', e.value);
if (recordsCreditDebit.getCount() > 0) {
var dataCreditDebit = recordsCreditDebit.getAt(0).data;
e.record.set('CreditDebit_Ref', dataCreditDebit.EnumValueName);
} else {
e.record.set('CreditDebit_Ref', '');
}
}
},
gridListChFeeAfterEdit: function (editor, e, eOpts) {
if (e.field == 'FeeType') {
var records = DsStoreQueryBy(this.storeFeeTypeRef, 'EnumValueId', e.value);
if (records.getCount() > 0) {
var data = records.getAt(0).data;
e.record.set('FeeType_Ref', data.EnumValueName);
} else {
e.record.set('FeeType_Ref', '');
}
} else if (e.field == 'UnitPrice' || e.field == 'Quantity') {
var unitPrice = e.record.data['UnitPrice'];
var quantity = e.record.data['Quantity'];
e.record.set('Amount', (unitPrice * quantity).toFixed(2));
}
},
//#endregion
cellEditingFixBeforeEdit: function (editor, e) {
var feeStatus = this.getFeeStatus();
var billStatus = this.getBillStatus();
var canedit = feeStatus == '0' && billStatus == '0';
return canedit;
},
cellEditingChFeeBeforeEdit: function (editor, e) {
var chfeefeeStatus = e.record.get('FeeStatus');
var canedit = chfeefeeStatus == 1 || chfeefeeStatus == 6;
if (canedit) {
var feeStatus = this.getFeeStatus();
var billStatus = this.getBillStatus();
canedit = feeStatus == '0' && billStatus == '0';
}
return canedit;
},
refBillNoSeChange: function (field, newValue, oldValue) {
// if (newValue != oldValue) {
// alert(newValue + "," + oldValue);
// }
},
realMilChange: function (field, newValue, oldValue) {
if (this.DataLoading == true) return;
if (newValue == oldValue) return;
var realMil = newValue;
var basicForm = this.formEdit.getForm();
basicForm.findField('OverLoadMil').setValue(realMil);
basicForm.findField('NoLoadMil').setValue(realMil);
this.getTruckOverLoadFuel();
this.getTruckNoLoadFuel();
var ratedFuel = this.LoadFuel + this.NoLoadFuel;
basicForm.findField('LoadFuel').setValue(this.LoadFuel);
basicForm.findField('NoLoadFuel').setValue(this.NoLoadFuel);
basicForm.findField('RatedFuel').setValue(ratedFuel);
},
overLoadMilChange: function (field, newValue, oldValue) {
if (this.DataLoading == true) return;
var basicForm = this.formEdit.getForm();
this.getTruckOverLoadFuel();
var ratedFuel = this.LoadFuel + this.NoLoadFuel;
basicForm.findField('LoadFuel').setValue(this.LoadFuel);
basicForm.findField('RatedFuel').setValue(ratedFuel);
},
noLoadMilChange: function (field, newValue, oldValue) {
if (this.DataLoading == true) return;
var basicForm = this.formEdit.getForm();
this.getTruckNoLoadFuel();
var ratedFuel = this.LoadFuel + this.NoLoadFuel;
basicForm.findField('NoLoadFuel').setValue(this.NoLoadFuel);
basicForm.findField('RatedFuel').setValue(ratedFuel);
},
tonAndTruckNoChange: function (field, newValue, oldValue) {
if (this.DataLoading == true) return;
this.getTruckOverLoadFuel();
this.getTruckNoLoadFuel();
var ratedFuel = this.LoadFuel + this.NoLoadFuel;
var basicForm = this.formEdit.getForm();
basicForm.findField('LoadFuel').setValue(this.LoadFuel);
basicForm.findField('NoLoadFuel').setValue(this.NoLoadFuel);
basicForm.findField('RatedFuel').setValue(ratedFuel);
if (field.name == 'TruckNo') {
var records = DsStoreQueryBy(this.storeTruckNo, 'TruckNo', newValue);
if (records.getCount() > 0) {
var data = records.getAt(0).data;
basicForm.findField('DrvCode').setValue(data.DrvCode);
basicForm.findField('Mobile').setValue(data.Mobile);
} else {
basicForm.findField('DrvCode').setValue('');
basicForm.findField('Mobile').setValue('');
}
}
},
onSubmitAuditClick: function (button, event) {
var records = this.feeGridCheckBoxModel.selected.items;
DsTruck.MsChFeeAudit(records, 2, '正在提交审核数据, 请稍侯..');
},
setSaveBtnStatus: function (enable) {
var bsbtnSave = Ext.getCmp('pcbtnSave');
var bsbtnSaveAndClose = Ext.getCmp('pcbtnSaveAndClose');
var bsbtnSaveAndNew = Ext.getCmp('pcbtnSaveAndNew');
if (enable) {
bsbtnSave.enable();
bsbtnSaveAndClose.enable();
bsbtnSaveAndNew.enable();
} else {
bsbtnSave.disable();
bsbtnSaveAndClose.disable();
bsbtnSaveAndNew.disable();
}
},
getFeeStatus: function () {
var basicForm = this.formEdit.getForm();
var feeStatus = basicForm.findField('FeeStatus').value;
return feeStatus;
},
getBillStatus: function () {
var basicForm = this.formEdit.getForm();
var billStatus = basicForm.findField('BillStatus').value;
return billStatus;
},
getCustName: function () {
var custName = this.formEdit.getForm().findField('RefCustomerName');
return custName.getValue();
},
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 = 'MSWLPC';
var sql1 = "SET LANGUAGE 'us_english' "
+ " select * from vMsWlPcHeadPrint WHERE BillNo = '" + billNo + "'";
var sql2 = "SET LANGUAGE 'us_english' SELECT * from ch_fee where BsNo='" + gid + "'";
var sql3 = "SET LANGUAGE 'us_english ' "
+ " select * from vMsWlBsHeadPrint WHERE BillNo = '" + refBillNo + "'";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
},
//获取重驶油耗
getTruckOverLoadFuel: function () {
var truckNo = this.getTruckNo();
if (truckNo == null || truckNo == "") {
this.LoadFuel = 0;
return;
}
var basicForm = this.formEdit.getForm();
var overLoadMil = basicForm.findField('OverLoadMil').value;
var ton = basicForm.findField('Ton').value;
if (ton == null || ton == "" || overLoadMil == null || overLoadMil == 0) {
this.LoadFuel = 0;
return;
}
this.getTruckFuel(truckNo, "1", ton, overLoadMil);
},
//获取空驶油耗
getTruckNoLoadFuel: function () {
var truckNo = this.getTruckNo();
if (truckNo == null || truckNo == "") {
this.NoLoadFuel = 0;
return;
}
var basicForm = this.formEdit.getForm();
var overLoadMil = basicForm.findField('NoLoadMil').value;
var ton = basicForm.findField('Ton').value;
if (ton == null || ton == "" || overLoadMil == null || overLoadMil == 0) {
this.NoLoadFuel = 0;
return;
}
this.getTruckFuel(truckNo, "0", ton, overLoadMil);
},
getTruckFuel: function (truckNo, loadType, ton, mil) {
Ext.Ajax.request({
waitMsg: '正在计算车里油量信息...',
url: '/TruckMng/MsWlPc/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
});
if (loadType == '1')
this.LoadFuel = 0;
else
this.NoLoadFuel = 0;
}
var data = result.data;
if (loadType == '1')
this.LoadFuel = data;
else
this.NoLoadFuel = data;
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
if (loadType == '1')
this.LoadFuel = 0;
else
this.NoLoadFuel = 0;
}
},
scope: this
});
}
});