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.

3214 lines
115 KiB
JavaScript

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

Ext.namespace('DsTruck');
DsTruck.MsWlPcEdit = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.DsTruck.MsWlPcEdit.superclass.constructor.call(this);
};
var power = 0;
Ext.extend(DsTruck.MsWlPcEdit, Ext.Panel, {
ParentWin: null, //弹出式
ParentPanel: null, //Tab页编辑模式
FunType: '',
OpStatus: 'add',
StoreList: null,
EditRecord: null,
RefBillNo: '*',
formtype: "",
DataLoading: true,
LoadFuel: 0,
NoLoadFuel: 0,
feeType: 0,
//主要是为了处理修改事件。使用focus和blur模拟change事件。
RealMil: 0,
OverLoadMil: 0,
NoLoadMil: 0,
Ton: 0,
StoreUnit: null,
StoreCustType: null,
StoreDateCurr: null,
StoreCurr: null,
stroplb: 'op_truck',
initUIComponents: function () {
this.fixSerialNo = 0;
this.fixBodyDel = [];
this.feeSerialNo = 0;
this.feeBodyDel = [];
this.Cansearch = false;
_thisfee = this;
this.StoreUnit = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsFeeUnit',
proxy: { url: '/MvcShipping/MsChFee/GetCtnUnitList' }
});
//#region 编辑form
//#region 枚举参照相关(编辑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,
allowBlank: true,
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: '车牌号',
allowBlank: true,
store: this.storeTruckNo, //readOnly:true,
queryMode: 'remote',
name: 'TruckNo', id: "TruckNo",
valueField: 'TruckNo',
displayField: 'TruckNo',
matchFieldWidth: false,
listeners: {
focus: function (field, eOpts) {
var basicForm = this.formEdit.getForm();
var isEnd = basicForm.findField('isEnd').getValue();
if (isEnd == true) {
alert("已完结的业务不能修改派车");
//Ext.getCmp("TruckNo").readOnly = true;
//return false;
} else {
//Ext.getCmp("TruckNo").readOnly = false;
}
this.Cansearch = true;
},
blur: function (field, eOpts) {
this.getFuelPrice();
this.setFuelAmount();
this.tonAndTruckNoChange(field, field.lastValue, field.oldValue);
if (field.lastValue != "") {
var form = this.formEdit.getForm();
// DdCode =form.findField('DdCode').value;
_DdCode = form.findField('DdCode');
_DdCode.setValue(usercode);
}
this.Cansearch = false;
},
change: function (field, newValue, oldValue) {
/*
var _n = newValue;
var _this = this;
if (this.Cansearch == true) {
this.Cansearch = false;
this.storeTruckNo.load({
async: false,
params: { condition: " truckno like '%" + newValue + "%'" },
callback: function (options, success, response) {
var form = _this.formEdit.getForm();
_TruckNo = form.findField('TruckNo');
_TruckNo.setValue(newValue);
_this.Cansearch = true;
}
});
}
*/
},
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: '司机',
allowBlank: true,
store: this.storeDrvName,
name: 'DrvCode',
valueField: 'DrvCode',
displayField: 'CodeAndName',
listeners: {
scope: this,
'blur': function (combo, records, eOpts) {
if (records.length > 0) {
this.setDrvName(records[0].data.DrvCode);
}
}
}
});
this.comboxDrvName2 = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '押车人员',
allowBlank: true,
store: this.storeDrvName,
name: 'SECOND_DRV',
valueField: 'DrvName',
displayField: 'CodeAndName'
});
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', flex: 1.5
, labelWidth: 30
});
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',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var recs = DsStoreQueryBy(this.storeYardCode, 'CustCode', records[0].data.CustCode);
var custname = this.formEdit.getForm().findField('YardName');
if (recs.getCount() > 0) {
var data = recs.getAt(0).data;
custname.setValue(data.CustName);
} else {
custname.setValue('');
}
}
}
}
});
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: '调度员编码', hidden: true,
store: this.storeDdCode,
name: 'DdCode',
valueField: 'UserCode',
displayField: 'CodeAndName'
});
//客户加载_车队
this.storeTRUCKER = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeTRUCKER.load({ params: { condition: "ISTRUCK='1'"} });
this.comboxTRUCKER = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '车队',
store: this.storeTRUCKER,
name: 'TruckSpec',
valueField: 'CustName',
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', flex: 2
});*/
//封号
this.storeSealNo = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsWlBsHeadRefMsSeals',
proxy: { url: '/TruckMng/MsWlPc/GetSealNoList' }
});
//this.storeSealNo.load({ params: { condition: ""} });
//箱号 //改为录入
/*
this.storeContainerNo = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsWlBsHeadRefMsContainers',
proxy: { url: '/TruckMng/MsWlPc/GetContainerNoList' }
});
//this.storeContainerNo.load({ params: { condition: ""} });
this.comboxContainerNo = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '箱号',
store: this.storeContainerNo,
name: 'ContainerNo',
valueField: 'ContainerNo',
displayField: 'ContainerNo',
listeners: {
scope: this,
'expand': function (field, eOpts) {
var basicForm = this.formEdit.getForm();
var pcbillNoValue = basicForm.findField('BillNo').value;
var bsBillNoValue = basicForm.findField('RefBillNo').value;
this.storeContainerNo.load({ params: { pcbillNo: pcbillNoValue, bsBillNo: bsBillNoValue} });
},
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var recs = DsStoreQueryBy(this.storeSealNo, 'ContainerNo', records[0].data.ContainerNo);
var basicForm = this.formEdit.getForm();
var sealNo = basicForm.findField('SealNo');
if (recs.getCount() > 0) {
var data = recs.getAt(0).data;
sealNo.setValue(data.SealNo);
} else {
sealNo.setValue('');
}
}
}
}
});
this.comboxContainerNoSe = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '箱号',
store: this.storeContainerNo,
name: 'ContainerNoSe',
valueField: 'ContainerNo',
displayField: 'ContainerNo',
listeners: {
scope: this,
'expand': function (field, eOpts) {
var basicForm = this.formEdit.getForm();
var pcbillNoValue = basicForm.findField('BillNo').value;
var bsBillNoValue = basicForm.findField('RefBillNo').value;
this.storeContainerNo.load({ params: { pcbillNo: pcbillNoValue, bsBillNo: bsBillNoValue} });
},
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var recs = DsStoreQueryBy(this.storeSealNo, 'ContainerNo', records[0].data.ContainerNo);
var basicForm = this.formEdit.getForm();
var sealNo = basicForm.findField('SealNoSe');
if (recs.getCount() > 0) {
var data = recs.getAt(0).data;
sealNo.setValue(data.SealNo);
} else {
sealNo.setValue('');
}
}
}
}
});*/
this.storeCustomerName = Ext.create('DsExt.ux.RefTableStore', {
model: 'Tradermb',
proxy: { url: '/CommMng/BasicDataRef/GetTrader' }
});
this.storeCustomerName.load({ params: { condition: ""} });
this.comboxCustomerName = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '客户', id: "CustomerName", //hidden: true,
forceSelection: true,
allowBlank: true,
store: this.storeCustomerName,
name: 'CustomerName',
valueField: 'name',
displayField: 'codename'
});
this.storeF_CustomerName = Ext.create('DsExt.ux.RefTableStore', {
model: 'Tradermb',
proxy: { url: '/CommMng/BasicDataRef/GetTrader' }
});
this.storeF_CustomerName.load({ params: { condition: ""} });
this.comboxF_CustomerName = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '最终客户', id: "F_CustomerName", //hidden: true,
allowBlank: true,
forceSelection: true,
store: this.storeF_CustomerName,
name: 'F_CustomerName',
valueField: 'name',
displayField: 'codename'
});
//#endregion
//编辑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: '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: '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.comboxCustomerName
, this.comboxF_CustomerName
, this.comboxBsType
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
//this.comboxVoyVeg,
{
fieldLabel: '船名航次',
name: 'VoyVeg', flex: 2
},
{
fieldLabel: '截港日期', id: "EndPortDate", //hidden: true,
format: 'Y-m-d',
xtype: 'datefield',
name: 'EndPortDate', flex: 2
},
{
fieldLabel: '提单号',
name: 'MblNo',
allowBlank: true,
flex: 2
}, this.comboxContainerType
,
{
fieldLabel: '箱量',
name: 'ContainerQty', flex: 0.5
, labelWidth: 30
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
{
fieldLabel: '派车日期',
allowBlank: true,
format: 'Y-m-d',
xtype: 'datefield',
name: 'ExpDate',
listeners: {
focus: function (field, eOpts) {
},
blur: function (field, eOpts) {
this.getFuelPrice();
this.setFuelAmount();
},
scope: this
}
},
this.comboxTruckNo,
this.comboxDrvName, {
fieldLabel: '司机手机1',
name: 'Mobile'
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxYardCode, this.comboxRtnYardCode
//, this.comboxContainerNo
, {
fieldLabel: '箱号',
name: 'ContainerNo'
}
, {
fieldLabel: '封号',
name: 'SealNo'
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '始发地点',
allowBlank: true,
name: 'LoadPlace'
}, {
fieldLabel: '目的地',
allowBlank: true,
name: 'DstArea', flex: 2
}, {
fieldLabel: '品名',
allowBlank: true,
name: 'PINMING', flex: 1
}, {
fieldLabel: '实际里程',
xtype: 'numberfield',
allowBlank: false,
name: 'RealMil',
hidden: true,
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,
hideTrigger: true,
keyNavEnabled: false,
mouseWheelEnabled: false,
disabled: true,
hidden: true,
name: 'FuelQty'
}, //{ xtype: 'hiddenfield', flex: 1 },
{
xtype: 'checkbox', id: "isEnd", hidden: true,
fieldLabel: '运行完成',
name: 'isEnd',
listeners: {
focus: function (field, eOpts) {
var basicForm = this.formEdit.getForm();
var TruckNo = basicForm.findField('TruckNo').getValue();
if (TruckNo == "") {
alert("未进行派车不能完结");
Ext.getCmp("isEnd").readOnly = true;
} else {
Ext.getCmp("isEnd").readOnly = false;
}
},
blur: function (field, eOpts) {
var basicForm = this.formEdit.getForm();
var TruckNo = basicForm.findField('TruckNo');
if (field.value == true) {
TruckNo.readOnly = true;
TruckNo.show();
} else {
TruckNo.readOnly = false;
TruckNo.show()
}
},
scope: this
}
}]
}
, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
{
fieldLabel: '货重(吨)', flex: 1,
xtype: 'numberfield',
allowBlank: false,
name: 'Ton',
hideTrigger: true,
selectOnFocus: true,
keyNavEnabled: false,
mouseWheelEnabled: false,
allowDecimals: true,
decimalPrecision: 3,
listeners: {
focus: function (field, eOpts) {
this.Ton = field.value;
if (this.storeBodyChFee.getCount() > 0) {
var basicForm = this.formEdit.getForm();
basicForm.findField('Ton').setReadOnly(true);
Ext.Msg.show({ title:'警告', msg:'已录入费用,不允许修改', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
}
},
blur: function (field, eOpts) {
var newValue = field.value;
this.tonAndTruckNoChange(field, newValue, this.Ton);
},
scope: this
}
}, {
fieldLabel: '件数', flex: 0.5,
xtype: 'numberfield',
allowBlank: false,
name: 'GOODSCOUNT',
hideTrigger: true,
labelWidth: 70, selectOnFocus: true,
keyNavEnabled: false,
mouseWheelEnabled: false
}, {
fieldLabel: '体积(CBM)', flex: 0.5,
xtype: 'numberfield',
allowBlank: false,
labelWidth: 70,
name: 'CBM',
hideTrigger: true,
selectOnFocus: true,
keyNavEnabled: false,
mouseWheelEnabled: false
}, this.comboxTRUCKER, this.comboxDrvName2
]
}
, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
{
fieldLabel: '工厂地址',
name: 'DetiNation', flex: 2
}, {
fieldLabel: '联系电话',
name: 'LinkTel'
}, {
fieldLabel: '联系人',
name: 'LinkMan'
}
]
}
,
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
{
fieldLabel: '实际重量',
name: 'ActualWeight', hidden: true
}, {
fieldLabel: '到厂日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ArriveDate'
}, {
fieldLabel: '到厂时间',
name: 'ArriveTime'
}, {
fieldLabel: '行驶里程', id: "OverLoadMil", //重驶里程
xtype: 'numberfield', //hidden: true,
allowBlank: false,
name: 'OverLoadMil',
hideTrigger: true,
keyNavEnabled: false,
mouseWheelEnabled: false,
selectOnFocus: true,
listeners: {
focus: function (field, eOpts) {
this.OverLoadMil = field.value;
},
blur: function (field, eOpts) {
this.getFuelPrice();
var newValue = field.value;
this.overLoadMilChange(field, newValue, this.OverLoadMil);
this.setFuelAmount();
},
scope: this
}
}, {
fieldLabel: '额定油耗',
xtype: 'numberfield',
allowBlank: false,
hideTrigger: true,
keyNavEnabled: false,
mouseWheelEnabled: false,
name: 'RatedFuel'
, readOnly: true
, selectOnFocus: true
}
]
}
, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield', //隐藏
items: [
]
}
, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '重驶油耗', hidden: true,
xtype: 'numberfield',
allowBlank: false,
hideTrigger: true,
keyNavEnabled: false,
mouseWheelEnabled: false,
name: 'LoadFuel'
}, {
fieldLabel: '空驶油耗', hidden: true,
xtype: 'numberfield',
allowBlank: false,
hideTrigger: true,
keyNavEnabled: false,
mouseWheelEnabled: false,
name: 'NoLoadFuel'
}]
}
, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [, {
fieldLabel: '空驶里程', id: "NoLoadMil", //空驶里程
xtype: 'numberfield', hidden: true,
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);
this.setFuelAmount();
},
scope: this
}
}, {
fieldLabel: '实际油耗', id: "RealFuel", //adl项目中记录油耗
xtype: 'numberfield',
allowBlank: false,
hideTrigger: true,
keyNavEnabled: false,
mouseWheelEnabled: false,
name: 'RealFuel', hidden: true,
listeners: {
focus: function (field, eOpts) {
},
blur: function (field, eOpts) {
this.getFuelPrice();
this.setFuelAmount();
},
scope: this
}
}, {
fieldLabel: '油价', id: "FuelPrice", //adl项目中记录油耗
xtype: 'numberfield',
hideTrigger: true,
readOnly: true,
selectOnFocus: true,
mouseWheelEnabled: false,
name: 'FuelPrice'
}, {
fieldLabel: '油费', id: "FuelAmount", //adl项目中记录油耗
xtype: 'numberfield',
readOnly: true,
selectOnFocus: true,
hideTrigger: true,
mouseWheelEnabled: false,
name: 'FuelAmount'
}, {
fieldLabel: '运行次数', id: "RunTimes", hidden: true,
xtype: 'numberfield',
allowBlank: false,
hideTrigger: true,
keyNavEnabled: false,
mouseWheelEnabled: false,
allowDecimals: false,
name: 'RunTimes'
}, {
fieldLabel: '额定里程',
xtype: 'numberfield',
allowBlank: false,
name: 'RatedMil',
hideTrigger: true,
keyNavEnabled: false,
mouseWheelEnabled: false,
hidden: true
}, {
fieldLabel: '加油卡剩余金额',
name: 'FuelRemainAmount'
, readOnly: true
, selectOnFocus: true
}, {
fieldLabel: '加油卡剩余油量',
name: 'FuelRemain'
, readOnly: true
, selectOnFocus: true
}, {
fieldLabel: '高速费', id: "RoadFee", //adl项目中记录油耗
xtype: 'numberfield',
hideTrigger: true,
selectOnFocus: true,
mouseWheelEnabled: false,
name: 'RoadFee'
}, {
fieldLabel: '高速卡剩余金额',
name: 'RoadRemain'
, readOnly: true
, selectOnFocus: true
}
]
}
, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '变动里程', id: "ChangedMil", hidden: true,
xtype: 'numberfield',
allowBlank: false,
hideTrigger: true,
keyNavEnabled: false,
mouseWheelEnabled: false,
name: 'ChangedMil'
}, {
fieldLabel: '变动油耗', id: "ChangedFuel", hidden: true,
xtype: 'numberfield',
allowBlank: false,
hideTrigger: true,
keyNavEnabled: false,
mouseWheelEnabled: false,
name: 'ChangedFuel'
}, {
fieldLabel: '变动原因', id: "ChangedReson", hidden: true,
name: 'ChangedReson'
}
]
}
, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '返回日期', hidden: true,
format: 'Y-m-d',
xtype: 'datefield',
name: 'ReturnDate'
}, {
fieldLabel: '返回时间', hidden: true,
name: 'ReturnTime'
}
]
}
, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '客户联系人姓名',
flex: 1,
name: 'CustLikeManName'
}, {
fieldLabel: '客户联系电话',
flex: 1,
name: 'CustTel'
}, {
fieldLabel: '发票抬头',
flex: 2,
name: 'BillRises1'
}
]
}
, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
xtype: 'checkboxfield',
fieldLabel: '是否双背',
flex: 0.5,
allowBlank: false,
name: 'IsDouble',
listeners: {
change: function (field, newValue, oldValue, eOpts) {
Ext.getCmp('fdDouble').setVisible(newValue);
}
}
}, {
xtype: 'checkbox', flex: 0.5,
fieldLabel: '是否有海污',
name: 'ISHW'
}, {
fieldLabel: '合同号',
flex: 1,
name: 'RefBillNo'
}, {
fieldLabel: '危险品类型',
flex: 1,
name: 'DGTYPE'
}, {
fieldLabel: '危险品代码',
flex: 1,
name: 'DGTYPECODE'
}
]
}
, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textarea',
items: [{
fieldLabel: '货物品名',
flex: 1,
name: 'GoodsName'
}, {
fieldLabel: '备注',
flex: 3,
name: 'Remark'
}, {
fieldLabel: 'PCSTATUSREF',
name: 'PCSTATUSREF', hidden: true
}
]
}
]//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 hh:mm:ss',
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
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
//this.comboxContainerNoSe
{
fieldLabel: '箱号',
name: 'ContainerNoSe'
}
, {
fieldLabel: '封号',
name: 'SealNoSe'
}
]
}
]//end items(fieldset 1)
}//end fieldset 2
]//end root items
}); //end this.formEdit
//#endregion
//#region 按钮Toolbar
var _this = this;
this.CB_isEnd = new Ext.form.Checkbox({
fieldLabel: '运行完成',
labelwidth: 50, id: "CB_isEnd",
listeners: {
focus: function (field, eOpts) {
var basicForm = this.formEdit.getForm();
var TruckNo = basicForm.findField('TruckNo').getValue();
if (TruckNo == "") {
alert("未进行派车不能完结");
Ext.getCmp("CB_isEnd").readOnly = true;
} else {
Ext.getCmp("CB_isEnd").readOnly = false;
}
},
blur: function (field, eOpts) {
var basicForm = this.formEdit.getForm();
var TruckNo = basicForm.findField('TruckNo');
var isEnd = basicForm.findField('isEnd');
if (field.value == true) {
isEnd.setValue(1);
TruckNo.readOnly = true;
TruckNo.show();
} else {
isEnd.setValue(0);
TruckNo.readOnly = false;
TruckNo.show()
}
},
scope: this
}
});
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', hidden: true,
text: "保存并新建",
handler: function (button, event) {
this.Save('2');
},
scope: this
},
{
id: 'pcbtnSaveAndNewSame', hidden: true,
text: "保存并新建类似",
handler: function (button, event) {
this.Save('3');
},
scope: this
},
'-',
{
text: "关闭",
handler: function (button, event) {
window.close();
},
scope: this
},
{
id: 'pcbtnNew', hidden: true,
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
},
'-',
'-', this.CB_isEnd
]
}); //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: 'GId',
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 费用表
//#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,
forceSelection: true,
name: 'CUSTNAME',
valueField: 'CustName',
displayField: 'CodeAndName'
});
//#endregion
//明细表-数据集
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
}, {
text: '撤回提交',
tooltip: '撤回提交',
iconCls: 'btncomm',
handler: function (button, event) {
this.onAuditBackClick(button, event);
},
scope: this
}, '-', {
text: '生成应收应付',
tooltip: '生成应收应付',
iconCls: "btnCWStart", id: "CWStart",
handler: function (button, event) {
this.onbtnCWStartClick(button, event);
},
scope: this
}, '-', {
text: '引入模板费用',
tooltip: '引入模板费用',
iconCls: "btnCWStart", id: "TemplateAdd",
handler: function (button, event) {
this.onTemplateAddDetailClick(button, event);
},
scope: this
}, '-', {
text: '查看信息', //'查看信息',
tooltip: '查看信息', //查看信息',
handler: function (button, event) {
this.onViewDetailClick(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: 'EnterOperatorName',
header: '录入人',
width: 150
}, {
sortable: true,
dataIndex: 'Remark',
header: '备注',
editor: {
xtype: 'textfield',
selectOnFocus: true
},
width: 150
}
]
, bbar: [
{ xtype: "label", id: "YS", text: "应收" }
, "-"
, { xtype: "label", id: "YF", text: " 应付" }
, "-"
, { xtype: "label", id: "LR", text: " 利润" }
]
});
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: 370,
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" || fun == 'MsRptWlTransIndex') {
this.opStatus = ret[0];
this.StoreList = ret[1];
this.EditRecord = ret[2];
this.RefBillNo = ret[3];
this.formtype = ret[5];
/*
if (fun == "MsRptPcHeadQryIndex")
this.setSaveBtnStatus(false);
else if (fun == 'MsRptWlTransIndex') {
this.setBtnOnlyQuery();
}*/
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];
this.formtype = ret[5];
}
/*
if (this.formtype == 'Qry') {
Ext.getCmp("OverLoadMil").show();
Ext.getCmp("NoLoadMil").show();
Ext.getCmp("RealFuel").show();
Ext.getCmp("RunTimes").show();
Ext.getCmp("ChangedMil").show();
Ext.getCmp("ChangedFuel").show();
Ext.getCmp("ChangedReson").show();
Ext.getCmp("CustomerName").hide();
Ext.getCmp("F_CustomerName").hide();
Ext.getCmp("CutoffTime").hide();
Ext.getCmp("isEnd").hide();
}
if (this.formtype == 'Operate') {
Ext.getCmp("OverLoadMil").hide();
Ext.getCmp("NoLoadMil").hide();
Ext.getCmp("RealFuel").hide();
Ext.getCmp("RunTimes").hide();
Ext.getCmp("ChangedMil").hide();
Ext.getCmp("ChangedFuel").hide();
Ext.getCmp("ChangedReson").hide();
Ext.getCmp("CustomerName").show();
Ext.getCmp("F_CustomerName").show();
Ext.getCmp("CutoffTime").show();
Ext.getCmp("isEnd").show();
}
*/
var GId = "";
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') + "'";
}
GId = this.EditRecord.get('GId');
}
this.storeMustBe = Ext.create('Ext.data.Store', {
model: 'DsShipping.ux.OpDefValue',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsCodeOpMustField/GetDataList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.LoadMustBe();
this.LoadData(this.opStatus, condition, this.RefBillNo, GId);
}, //end InitData
LoadData: function (opstatus, condition, refbillno, GId) {
//获取是否允许提交应收应付费用的权限
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/TruckMng/MsWlPc/GetFFSFPower',
params: {
userid: USERID
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
power = result.power;
}
},
scope: this
});
this.fixSerialNo = 0;
this.fixBodyDel = [];
this.feeSerialNo = 0;
this.feeBodyDel = [];
this.opStatus = opstatus;
var Url = '/TruckMng/MsWlPc/GetData_ADL';
/*
if (this.formtype = 'Operate') {
Url = '/TruckMng/MsWlPc/GetData';
}
if (this.formtype = 'Qry') {
Url = '/TruckMng/MsWlPc/GetData_ADL';
}*/
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: Url,
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;
}
if (data.isEnd == 'True') {
data.isEnd = '1';
Ext.getCmp("CB_isEnd").setValue(true);
} else {
data.isEnd = '0';
Ext.getCmp("CB_isEnd").setValue(false);
};
if (data.FuelPrice == "") {
data.FuelPrice = "0";
}
if (data.RoadFee == "") {
data.RoadFee = "0";
}
this.DataLoading = true;
var basicForm = this.formEdit.getForm();
basicForm.reset();
basicForm.setValues(data);
this.getFuelPrice();
this.setFuelAmount();
this.LoadFuel = basicForm.findField('LoadFuel').value;
this.NoLoadFuel = basicForm.findField('NoLoadFuel').value;
this.DataLoading = false;
var FuelPrice = data.FuelPrice;
this.SetCardRemain_Fuel(data.TruckNo, "加油卡", FuelPrice);
this.SetCardRemain_Road(data.TruckNo, "高速卡");
if (data.BillStatus == "1") {
var fields = this.formEdit.getForm().getFields();
for (var i = 0, len = fields.length; i < len; i++) {
fields.items[i].setReadOnly(true);
}
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
/*
var billno = '*';
var gid = '*';
if (this.opStatus == 'edit') {
billno = this.editRecord.get('BillNo');
gid = GId;
}
*/
var _this = this;
this.storeBodyFix.load({ params: { billno: GId} });
this.storeBodyChFee.load({
params: { billno: GId }
,
callback: function (options, success, response) {
_this.SetHJ();
}
});
//this.storeSealNo.load({ params: { bsBillNo: refbillno} });
}, // end LoadDate
//#endregion
Save: function (type) {
var basicForm = this.formEdit.getForm();
if (!basicForm.isValid()) {
return;
}
basicForm.findField('BillNo').setDisabled(false);
this.setDrvName(basicForm.findField('DrvCode').getValue());
var data = basicForm.getValues();
data.isEnd = this.formEdit.getForm().findField('isEnd').getValue() ? 1 : 0;
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 FeeType = memberyf.data.FeeType;
if (memberyf.data.FeeStatus == 1) {
if (power == 0) {
Ext.Msg.show({ title: '提示',
msg: '当前用户没有申请收费与付费的权限',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
return;
}
if (power == 1 && FeeType == 2) {
Ext.Msg.show({ title: '提示',
msg: '当前用户没有申请付费的权限',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
return;
}
if (power == 2 && FeeType == 1) {
Ext.Msg.show({ title: '提示',
msg: '当前用户没有申请收费的权限',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
return;
}
}
var amount = memberyf.data.Amount;
if (amount == 0) {
Ext.Msg.show({ title: '警告',
msg: '费用的金额不允许为0请修改后再保存',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
return;
}
var Quantity = memberyf.data.Quantity;
if (Quantity == 0) {
Ext.Msg.show({ title: '警告',
msg: '费用的数量不允许为0请修改后再保存',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
return;
}
var UnitPrice = memberyf.data.UnitPrice;
if (UnitPrice == 0) {
Ext.Msg.show({ title: '警告',
msg: '费用的单价不允许为0请修改后再保存',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
var CustomerName = memberyf.data.CustomerName;
if (CustomerName == '') {
Ext.Msg.show({ title: '警告',
msg: '费用的结算对象不允许为空,请修改后再保存',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
var FeeType = memberyf.data.FeeType;
if (FeeType == '') {
Ext.Msg.show({ title: '警告',
msg: '费用的收付方式不允许为空,请修改后再保存',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
return;
}
}
;
var jsonChFeeBody = ConvertRecordsToJson(bodyChFeeDatas);
var jsonChFeeDelBody = ConvertRecordsToJsonAll(this.feeBodyDel);
data.ISHW = this.formEdit.getForm().findField('ISHW').getValue() ? 1 : 0;
//原来的交运逻辑
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/TruckMng/MsWlPc/Save_ADL',
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;
if (returnData.isEnd == 'True') {
returnData.isEnd = '1';
} else { returnData.isEnd = '0' };
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 != 'BILLNO')
this.EditRecord.set(name, editp.get(name));
}
}, this);
this.EditRecord.commit();
}
var BillNo = this.EditRecord.get('BillNo');
var OWNID = this.EditRecord.get('TruckNo');
//处理高速卡
var Outnum = returnData.RoadFee;
var Roadcard = this.DealCard(BillNo, OWNID, "高速卡", "路单使用", "0", Outnum);
//处理加油卡
var Outnum = returnData.FuelAmount;
var oilcard = this.DealCard(BillNo, OWNID, "加油卡", "路单使用", "0", Outnum);
var FuelPrice = returnData.FuelPrice;
var TruckNo = returnData.TruckNo;
this.SetCardRemain_Fuel(TruckNo, "加油卡", FuelPrice);
this.SetCardRemain_Road(TruckNo, "高速卡");
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();
};
this.SetHJ();
} else if (type == '1') {
window.close();
} else if (type == '2') {
this.LoadData('add', '', '');
//basicForm.findField('BillNo').setDisabled(false);
} if (type == '3') {
//this.LoadData('add', '', '');
this.opStatus = 'add';
basicForm.findField('BillNo').setValue("*");
basicForm.findField('TruckNo').setValue("");
basicForm.findField('DrvCode').setValue("");
basicForm.findField('Mobile').setValue("");
basicForm.findField('RatedFuel').setValue("0");
basicForm.findField('FuelPrice').setValue("0");
basicForm.findField('FuelAmount').setValue("0");
basicForm.findField('FuelRemainAmount').setValue("0");
basicForm.findField('FuelRemain').setValue("0");
basicForm.findField('RoadRemain').setValue("0");
basicForm.findField('RoadFee').setValue("0");
var _this = this;
this.storeBodyChFee.load({ params: { billno: "" }
,
callback: function (options, success, response) {
_this.SetHJ();
}
});
}
} 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
SetHJ: function () {
var YS = 0;
var YF = 0;
var LR = 0;
for (i = 0; i < this.storeBodyChFee.getCount(); i += 1) {
var memberyf = this.storeBodyChFee.getAt(i);
var amount = memberyf.data.Amount;
if (memberyf.data.FeeType == "1") {
YS = Add(YS, amount);
}
if (memberyf.data.FeeType == "2") {
YF = Add(YF, amount);
}
};
LR = Cut(YS, YF);
Ext.getCmp("YS").setText("应收: " + YS);
Ext.getCmp("YF").setText(" 应付: " + YF);
Ext.getCmp("LR").setText(" 利润: " + LR);
},
//#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 basicForm = this.formEdit.getForm();
var CustomerName = this.formEdit.getForm().findField('CustomerName').getValue()
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: '',
EnterOperatorName: showname
});
}
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' || feeStatus == '' || typeof (feeStatus) == 'undefined' || feeStatus == false || feeStatus == 'false')
return true;
else {
Ext.Msg.show({ title: '错误', msg: "此票委托已费用已锁定,不允许操作费用!", icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return false;
}
},
onViewDetailClick: function (button, event, type) {
var selectedRecords = [];
var feetype = '1';
selectedRecords = this.gridListChFee.selModel.getSelection();
if (selectedRecords.length > 0) {
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
feetype = rec.data.FeeType;
}
}
var openSet = "height=740, width=890, toolbar=no, menubar=no,scrollbars=no, resizable=no,location=no, status=no,Top= " + (screen.height - 540) / 2 + ",Left= " + (screen.width - 890) / 2
var openType = "_blank";
//打开费用“历史信息查询”页面
// var openUrl = "../../Shipping/FeeHistory.aspx?bsno=" + this.strBSNO + "&oplb=" + this.stroplb + "&type=" + type;
var openUrl = "../../MvcShipping/MsOpBill/MsFeeHistoryView??bsno=" + this.EditRecord.get('GId') + "&oplb=op_Seae&type=" + feetype;
window.open(openUrl, openType, openSet);
},
//#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', '');
}
}
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));
}
var custName = this.formEdit.getForm().findField('CustomerName').getValue();
if (e.field == 'FeeType' || e.field == 'FeeName') {
var records = DsStoreQueryBy(this.storeFeeTypeRef, 'EnumValueId', e.value);
if (e.value == 1 || e.value == "陆运费") {
e.record.set('CustomerName', custName);
}
}
},
//#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 allow = this.getAllowOperationDetail();
if (allow == false) {
return false;
}
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);
var FuelPrice = basicForm.findField('FuelPrice').value;
var TruckNo = basicForm.findField('TruckNo').value;
this.SetCardRemain_Fuel(TruckNo, "加油卡", FuelPrice);
},
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);
this.setDrvName(data.DrvCode);
basicForm.findField('Mobile').setValue(data.Mobile);
} else {
basicForm.findField('DrvCode').setValue('');
basicForm.findField('DrvName').setValue('');
basicForm.findField('Mobile').setValue('');
}
}
},
onSubmitAuditClick: function (button, event) {
var records = this.feeGridCheckBoxModel.selected.items;
for (var i = 0; i < records.length; i++) {
var record = records[i];
var FeeType = record.data.FeeType;
if (power == 0) {
Ext.Msg.show({ title: '提示',
msg: '当前用户没有申请收费与付费的权限',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
return;
}
if (power == 1 && FeeType == 2) {
Ext.Msg.show({ title: '提示',
msg: '当前用户没有申请付费的权限',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
return;
}
if (power == 2 && FeeType == 1) {
Ext.Msg.show({ title: '提示',
msg: '当前用户没有申请收费的权限',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
return;
}
}
DsTruck.MsChFeeAudit(records, 2, '正在提交审核数据, 请稍侯..');
},
onAuditBackClick: function (button, event) {
var records = this.feeGridCheckBoxModel.selected.items;
for (var i = 0; i < records.length; i++) {
if (records[i].data.FeeStatus_Ref == '审核通过') {
Ext.MessageBox.alert('提示', '已经审核通过,无法撤回!');
return;
}
}
DsTruck.MsChFeeAudit(records, 1, '正在提交审核数据, 请稍侯..');
},
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();
}
},
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('CustomerName');
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 BillNo = basicForm.findField('BillNo').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 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 = "SET LANGUAGE 'us_english ' "
+ " select * from vMsWlBsHeadPrint WHERE BillNo = '" + refBillNo + "' ";
var sql4 = " select billno,PINMING 品名,VoyVeg 船名航次,mblno 提单号,(select top 1 shortname from info_client where codename= Yardcode) 背箱场站,(select top 1 shortname from info_client where codename= RtnYardcode) 返箱场站 ";
sql4 = sql4 + " ,containertype,(select CTN from code_ctn where CTNID=containertype) 箱型,ContainerQty 箱量 ";
sql4 = sql4 + " ,ton 毛重,DetiNation 工厂地址,dbo.trimdate(ArriveDate)+' '+ArriveTime 到厂时间,DGTYPE 危险品类型,DGTYPECODE 危险品代码,LINKTEL 联系电话,LinkMan 联系人 ";
sql4 = sql4 + " ,GOODSCOUNT 件数,CBM [体积(CBM)] ,ISHW 是否有海污,remark 备注 ";
sql4 = sql4 + " from tMsWlPcHead where billno ='" + BillNo + "' ";
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 || overLoadMil == null || overLoadMil == 0) {
this.LoadFuel = 0;
return;
}
if (ton == "")
ton = 0;
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 (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
});
},
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('');
}
},
setBtnOnlyQuery: function () {
var bsbtnSave = Ext.getCmp('pcbtnSave');
var bsbtnSaveAndClose = Ext.getCmp('pcbtnSaveAndClose');
var bsbtnSaveAndNew = Ext.getCmp('pcbtnSaveAndNew');
var pcbtnNew = Ext.getCmp('pcbtnNew');
bsbtnSave.setVisible(false);
bsbtnSaveAndClose.setVisible(false);
bsbtnSaveAndNew.setVisible(false);
pcbtnNew.setVisible(false);
}
,
getFuelPrice: function () {
var form = this.formEdit.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var TruckNo = form.findField('TruckNo').getValue();
var ExpDate = form.findField('ExpDate').getValue();
var FuelPrice = form.findField('FuelPrice');
//通过 日期 燃油 类型从 燃油表中获取油价 select * from tMsWl_Port_FuelPrice
//var FuelPrice = "0";
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/TruckMng/MsWl_Port/GetFuelPrice',
async: false,
params: {
DATE: ExpDate,
TruckNo: TruckNo
},
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 (data.Price != "") {
FuelPrice.setValue(data.Price);
}
//e.record.set('AvrOil', parseFloat(FuelPrice)); //Mobile
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
},
setFuelAmount: function () {
var form = this.formEdit.getForm();
var FuelPrice = form.findField('FuelPrice').getValue();
var RatedFuel = form.findField('RatedFuel').getValue();
var FuelAmount = Mul(FuelPrice, RatedFuel, 2);
_FuelAmout = form.findField('FuelAmount');
_FuelAmout.setValue(FuelAmount);
},
onbtnCWStartClick: function (button, event) { //初始化应收应付,
/*
Ext.MessageBox.confirm('提示', '这将会在应收应付列表增加一些内容,如不保存就不会真正增加。确定吗?',
function (btn) {
if (btn == 'yes') {
}
},
this); //确认窗口over
*/
var form = this.formEdit.getForm();
var FuelAmount = form.findField('FuelAmount').getValue();
var RoadFee = form.findField('RoadFee').getValue();
this.addChFee(2, 'RMB', 1, '油费', FuelAmount, "加油站", "油费", "");
this.addChFee(2, 'RMB', 1, '路桥费', RoadFee, "高速公路", "路桥费", "");
},
onTemplateAddDetailClick: function (menu, event, type) {
var allow = this.getAllowOperationDetail();
if (allow == false) {
return;
}
DsOpenEditWin("/MvcShipping/MsFeeTemplate/AddFeeIndex", "模板引入费用");
},
addChFee: function (FeeType, Currency, Exchangerate, FeeName, price, CustomerName, Remark, feedate) {
//var _Amount=price*Quantity;
if (price == 0) return;
var _Amount = 0;
function GetDateStr(AddDayCount) {
var dd = new Date();
dd.setDate(dd.getDate() + AddDayCount); //获取AddDayCount天后的日期
var y = dd.getFullYear();
var m = dd.getMonth() + 1; //获取当前月份的日期
var d = dd.getDate();
return y + "-" + m + "-" + d;
}
var EnterDate = GetDateStr(0);
if (feedate == "" || typeof (feedate) == "undefined") {
EnterDate = GetDateStr(0);
} else {
EnterDate = feedate;
}
//////
if (FeeType == 1) {
var _FeeType = 1;
var _FeeType_Ref = '应收';
}
else {
var _FeeType = 2;
var _FeeType_Ref = '应付';
};
//var custName = this.formEdit.getForm().findField('CustomerName').getValue();
var newid = NewGuid();
record = Ext.create('MsChFee', {
GId: newid,
BsNo: '*',
FeeStatus: 1,
FeeStatus_Ref: '录入状态',
FeeType: _FeeType,
FeeType_Ref: _FeeType_Ref,
FeeName: FeeName,
FeeName_Ref: '',
FeeDescription: '',
CustomerType: '',
CustomerName: CustomerName,
//this.formEdit.getForm().findField('buyer');
CustomerName_Ref: '',
Unit: '',
price: 0,
UnitPrice: price,
Quantity: 1,
Amount: 0,
Currency: Currency,
ExChangerate: Exchangerate,
Reason: '',
Remark: Remark,
Commissionrate: 0,
Settlement: 0,
Invoice: 0,
OrderAmount: 0,
OrderInvoice: 0,
SubmitDate: null,
Auditoperator: '',
AuditDate: null,
EnteroPerator: USERID,
EnterDate: EnterDate,
DebitNo: '',
IsDebit: "0",
IsOpen: "0",
IsAdvancedpay: "0",
Sort: "1",
IsInvoice: "0",
FeeFrt: 'pp',
IsCrmOrderFee: "0",
AuditStatus: 0,
InvoiceNum: '',
ChequeNum: '',
WmsOutBsNo: ''
});
this.storeBodyChFee.add(record);
var _r = this.storeBodyChFee.findRecord("GId", newid);
_r.set("Amount", price);
}
,
DealCard: function (BILLNO, OWNID, CARDTYPE, Operate, Innum, Outnum) {
Ext.Ajax.request({
waitMsg: '处理充值卡信息...',
url: '/TruckMng/Card/DealCard',
async: false,
params: {
BILLNO: BILLNO,
OWNID: OWNID,
CARDTYPE: CARDTYPE,
Operate: Operate,
Innum: Innum,
Outnum: Outnum
},
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
});
}
var data = result.data;
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}
,
GetCardRemain: function (OWNID, CARDTYPE) {
Ext.Ajax.request({
waitMsg: '正在查询毛利数据...',
url: '/TruckMng/Card/GetCardRemain',
params: {
OWNID: OWNID,
CARDTYPE: CARDTYPE
},
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;
//this.formML.getForm().setValues(data);
return data;
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
}); //request over
}
,
SetCardRemain_Fuel: function (OWNID, CARDTYPE, FuelPrice) {
Ext.Ajax.request({
waitMsg: '正在查询毛利数据...',
url: '/TruckMng/Card/GetCardRemain',
params: {
OWNID: OWNID,
CARDTYPE: CARDTYPE
},
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 FuelRemainAmount = result.data;
if (FuelRemainAmount == "" || FuelRemainAmount == undefined) {
FuelRemainAmount = "0";
}
var basicForm = this.formEdit.getForm();
var FuelRemain = "0";
if (parseInt(FuelPrice) != "0" || FuelPrice == undefined) {
FuelRemain = Div(FuelRemainAmount, FuelPrice, 2);
} else FuelRemain = "0";
basicForm.findField('FuelRemainAmount').setValue(FuelRemainAmount);
basicForm.findField('FuelRemain').setValue(FuelRemain);
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
}); //request over
}
,
SetCardRemain_Road: function (OWNID, CARDTYPE) {
Ext.Ajax.request({
waitMsg: '正在查询毛利数据...',
url: '/TruckMng/Card/GetCardRemain',
params: {
OWNID: OWNID,
CARDTYPE: CARDTYPE
},
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 RoadRemain = result.data;
var RoadRemain = result.data;
if (RoadRemain == "" || RoadRemain == undefined) {
RoadRemain = "0";
}
var basicForm = this.formEdit.getForm();
basicForm.findField('RoadRemain').setValue(RoadRemain);
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
}); //request over
}
,
LoadMustBe: function () {
this.storeMustBe.load({ params: { condition: "BSTYPE='陆运派车单'" },
callback: function (r, options, success) {
if (success) {
if (this.storeMustBe.getCount() > 0) {
for (var j = 0; j < this.storeMustBe.getCount(); j += 1) {
var member = this.storeMustBe.getAt(j);
var headfield = this.formEdit.getForm().findField(member.data.FIELDNAME);
if (headfield != NaN && headfield != null) {
if (member.data.ISMUST == "1")
headfield.allowBlank = false;
if (member.data.ISCOLOR == "1")
headfield.setFieldStyle({ background: '#ffc' });
}
};
} else {
}
}
},
scope: this
});
}
});