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/TruckMng/Viewsjs/MsWlBs/MsPcWFSDEdit.js

1513 lines
57 KiB
JavaScript

2 years ago
//2013-03-15 删除固定费用
Ext.namespace('DsTruck');
DsTruck.MsPcWFSDEdit = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.DsTruck.MsPcWFSDEdit.superclass.constructor.call(this);
};
Ext.extend(DsTruck.MsPcWFSDEdit, Ext.Panel, {
ParentWin: null,
OpStatus: 'add',
StoreList: null,
editRecord: null,
selectPGID: '',
initUIComponents: function () {
this.accdatesameetd = 0;
this.MsPeriod = null;
Ext.define('PCmb', {
extend: 'Ext.data.Model',
idProperty: '',
fields: [
{ name: 'ywType', type: 'string' },
{ name: 'PcBillType', type: 'string' },
{ name: 'PcBillTypeREF', type: 'string' },
{ name: 'timeMark', type: 'string' },
{ name: 'gId', type: 'string' },
{ name: 'PGid', type: 'string' },
{ name: 'BLTYPE', type: 'string' },
{ name: 'RowNumber', type: 'string' },
{ name: 'BillNo', type: 'string' },
{ name: 'ExpDate', type: 'date', dateFormat: 'Y-m-d H:i:s' },
{ name: 'GroupDate', type: 'string' },
{ name: 'EndPortDate', type: 'date'},
{ name: 'EtDate', type: 'date' },
{ name: 'VoyVeg', type: 'string' },
{ name: 'ArriveDate', type: 'date' },
{ name: 'ReturnDate', type: 'date' },
{ name: 'CustomerName', type: 'string' },
{ name: 'F_CustomerName', type: 'string' },
{ name: 'DrvName', type: 'string' },
{ name: 'TruckNo', type: 'string' },
{ name: 'MblNo', type: 'string' },
{ name: 'LinkMan', type: 'string' },
{ name: 'DstArea', type: 'string' },
{ name: 'DetiNation', type: 'string' },
{ name: 'ContainerQty', type: 'string' },
{ name: 'Ton', type: 'string' },
{ name: 'LoadCount', type: 'string' },
{ name: 'LoadPlace', type: 'string' },
{ name: 'TruckSpec', type: 'string' },
{ name: 'IsDouble', type: 'string' },
{ name: 'Property', type: 'string' },
{ name: 'YUNFEI', type: 'string' },
{ name: 'HCHJ', type: 'string' },
{ name: 'ZXF', type: 'string' },
{ name: 'DDF', type: 'string' },
{ name: 'QTFee', type: 'string' },
{ name: 'TotalFee', type: 'string' },
{ name: 'Remark', type: 'string' },
{ name: 'FEESTATUS', type: 'string' },
{ name: 'FEESTATUSREF', type: 'string' },
{ name: 'UserCode', type: 'string' },
{ name: 'UserName', type: 'string' },
{ name: 'OrgName', type: 'string' },
{ name: 'LrDate', type: 'string' },
{ name: 'PCSTATUSREF', type: 'string' },
{ name: 'RefBillNo', type: 'string' },
{ name: 'RefBillNose', type: 'string' },
{ name: 'MblNoSe', type: 'string' },
{ name: 'ContainerType', type: 'string' },
{ name: 'LinkTel', type: 'string' },
{ name: 'YardName', type: 'string' },
{ name: 'LinkManSe', type: 'string' },
{ name: 'LinkTelSe', type: 'string' },
{ name: 'RtnYardName', type: 'string' },
{ name: 'BsType', type: 'string' },
{ name: 'CustName', type: 'string' },
{ name: 'CustLikeManName', type: 'string' },
{ name: 'DispatchName', type: 'string' },
{ name: 'INVOICENO', type: 'string' },
{ name: 'KINDPKGS', type: 'string' },
{ name: 'CUSTNO', type: 'string' },
{ name: 'SalesName', type: 'string' },
{ name: 'GoodsName', type: 'string' },
{ name: 'RtnDocStatus', type: 'string' },
{ name: 'RtnDocTime', type: 'string' },
{ name: 'PORTLOAD', type: 'string' },
{ name: 'DESTINATION', type: 'string' },
{ name: 'SALECORPID', type: 'string' },
{ name: 'SALECORP', type: 'string' },
{ name: 'ChangedReson', type: 'string' },
{ name: 'LoadFactory', type: 'string' },
{ name: 'CargoID', type: 'string' }
]
});
Ext.define('Tradermb', {
extend: 'Ext.data.Model',
idProperty: 'gid',
fields: [
{ name: 'gid', type: 'string' },
{ name: 'name', type: 'string' },
{ name: 'codename', type: 'string' }
]
});
Ext.define('DsShipping.ux.CustomRefModel', {
extend: 'Ext.data.Model',
fields: [
{ name: 'GId', type: 'string' },
{ name: 'CustCode', type: 'string' },
{ name: 'CustName', type: 'string' },
{ name: 'CodeAndName', type: 'string' },
{ name: 'SALE', type: 'string' }
]
});
//#region 编辑Form
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,
store: this.storeCustomerName,
name: 'CustomerName',
valueField: 'name',
displayField: 'codename',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var s = " LINKID in (select gid from [info_client] where SHORTNAME='" + combo.value + "')";
this.storeInfoClientContact.load({ params: { condition: s} });
}
}
}
});
//客户加载_车队
this.storeTRUCKER = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeTRUCKER.load({ params: { condition: "ISTRUCK='1'"} });
_thisPc = this;
//车队
this.comboxTRUCKER = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '车队',
store: this.storeTRUCKER,
name: 'F_CustomerName',
valueField: 'CustName',
displayField: 'CodeAndName'
});
this.StoreBLTYPE = Ext.create('Ext.data.Store', {
fields: ['BLTYPE']
});
this.StoreBLTYPE.add({ "BLTYPE": "派车主票" });
this.StoreBLTYPE.add({ "BLTYPE": "派车分票" });
this.StoreBLTYPE.add({ "BLTYPE": "派车单票" });
this.comboxBLTYPE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '派车单类型',
store: this.StoreBLTYPE,
forceSelection: true,
name: 'BLTYPE',
valueField: 'BLTYPE',
displayField: 'BLTYPE',
value: '派车单票'
});
this.StorePcBillType = Ext.create('DsExt.ux.RefEnumStore', {});
this.StorePcBillType.load({ params: { enumTypeId: 99046} });
this.comboxPcBillType = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '派车类型',
store: this.StorePcBillType,
forceSelection: true,
name: 'PcBillType'
});
this.StoreTruckTypeProp = Ext.create('DsExt.ux.RefEnumStore', {});
this.StoreTruckTypeProp.load({ params: { enumTypeId: 97043} });
this.comboxTruckTypeProp = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '车辆类别',
store: this.StoreTruckTypeProp,
flex: 0.5,
// forceSelection: true,
name: 'Property'
});
this.StoreTruckType = Ext.create('DsExt.ux.RefEnumStore', {});
this.StoreTruckType.load({ params: { enumTypeId: 99019} });
this.comboxTruckType = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '车型',
store: this.StoreTruckType,
flex: 0.5,
labelWidth: 60, // forceSelection: true,
name: 'TruckSpec'
});
this.storeBsType = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeBsType.load({ params: { enumTypeId: 96004 } });
this.comboxBsType = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '业务类型',
store: this.storeBsType,
labelWidth: 60,
flex: 0.5,
forceSelection: true,
name: 'BsType'
});
//this.StoreBsType = Ext.create('Ext.data.Store', {
// fields: ['BLTYPE']
//});
//this.StoreBsType.add({ "BLTYPE": "海运出口" });
//this.StoreBsType.add({ "BLTYPE": "海运进口" });
//this.StoreBsType.add({ "BLTYPE": "空运出口" });
//this.StoreBsType.add({ "BLTYPE": "空运进口" });
//this.comboxBsType = Ext.create('DsExt.ux.RefTableCombox', {
// fieldLabel: '业务类型',
// store: this.StoreBsType,
// forceSelection: true,
// name: 'BsType',
// valueField: 'BLTYPE',
// displayField: 'BLTYPE'
//});
Ext.define('DsShipping.ux.CodePackageModel', {
extend: 'Ext.data.Model',
fields: [
{ name: 'PKGS', type: 'string' }
]
});
//件数包装
this.storeCodePackage = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CodePackageModel',
proxy: { url: '/CommMng/BasicDataRef/GetCodePackageList' }
});
this.storeCodePackage.load();
this.comboxKINDPKGS = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '包 装',
store: this.storeCodePackage,
name: 'KINDPKGS',
valueField: 'PKGS',
displayField: 'PKGS'
});
Ext.define('MsWlBsHeadRefMsWlTruck', {
extend: 'Ext.data.Model',
fields: [
{ name: 'TruckNo', type: 'string' },
{ name: 'DrvCode', type: 'string' },
{ name: 'DrvName', type: 'string' },
{ name: 'Mobile', type: 'string' }
]
});
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',
matchFieldWidth: true,
listeners: {
change: function (field, newValue, oldValue) {
// this.tonAndTruckNoChange(field, newValue, oldValue);
},
scope: this
}
});
//委托单位_联系人
this.storeInfoClientContact = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.InfoClientContactModel',
proxy: { url: '/CommMng/BasicDataRef/GetInfoClientContactList' }
});
this.comboxInfoClientContactYard = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '客户联系人',
store: this.storeInfoClientContact,
name: 'LinkMan',
valueField: 'SHOWNAME',
displayField: 'SHOWNAME',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
// this.formEdit.getForm().findField('Tel').setValue(records[0].data.TEL);
}
}
}
});
this.storeOpCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserLinkRefList' }
});
this.storeOpCode.load({ params: { condition: ""} });
this.comboxSALE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '揽货人', //'揽货人',
store: this.storeOpCode,
forceSelection: true,
name: 'SalesName',
valueField: 'UserName',
displayField: 'CodeAndName',
value: SHOWNAME
});
//货物标识
this.StoreCargoid = Ext.create('Ext.data.Store', {
fields: [ 'NAME']
});
this.StoreCargoid.add({"NAME": "S普通货" });
this.StoreCargoid.add({ "NAME": "D危险品" });
this.comboxCargoid = Ext.create('DsExt.ux.RefTableCombox', {
store: this.StoreCargoid,
fieldLabel: "<a><font color='#FF0000'>货物标示</font></a>",
forceSelection: true,
width: 1200,
name: 'CargoID',
valueField: 'NAME',
displayField: 'NAME'
});
Ext.define('MsCodeFactry', {
extend: 'Ext.data.Model',
idProperty: 'GID',
fields: [
{ name: 'GID', type: 'string' },
{ name: 'CODENAME', type: 'string' },
{ name: 'CUSTOMERNAME', type: 'string' },
{ name: 'FACTRYNAME', type: 'string' },
{ name: 'FACTRYADDR', type: 'string' },
{ name: 'FACTRYATTN', type: 'string' },
{ name: 'FACTRYTEL', type: 'string' },
{ name: 'CodeAndName', type: 'string' }
]
});
//客户加载_工厂
this.storeFactry = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsCodeFactry',
proxy: { url: '/MvcShipping/MsCodeFactry/GetDataList' }
});
this.storeFactry.load();
//工厂
this.comboxFactory = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '装货工厂',
flex: 1,
store: this.storeFactry,
name: 'LoadFactory',
valueField: 'FACTRYNAME',
displayField: 'CodeAndName',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var dataFactory = records[0].data;
this.formEdit.getForm().findField('CustLikeManName').setValue(dataFactory.FACTRYATTN);
this.formEdit.getForm().findField('LoadPlace').setValue(dataFactory.FACTRYADDR);
}
}
}
});
this.storeRtnDocStatus = Ext.create('Ext.data.Store', {
fields: ['FSTATUS', 'NAME']
});
this.storeRtnDocStatus.add({ "FSTATUS": "", "NAME": "未回单" });
this.storeRtnDocStatus.add({ "FSTATUS": "0", "NAME": "部分回单" });
this.storeRtnDocStatus.add({ "FSTATUS": "1", "NAME": "已回单" });
this.comboxRtnDocStatus = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '回单状态', //是否开垫付
store: this.storeRtnDocStatus,
valueField: 'FSTATUS',
displayField: 'NAME',
forceSelection: true,
name: 'RtnDocStatus',
value: '未回单',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.storeSaleCompany = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsCompanysEntity',
proxy: { url: '/MvcShipping/MsCompanys/GetNoPicDataList' }
});
this.storeSaleCompany.load({ params: { condition: "" } });
this.comboxSaleCompany = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel:'所属分部', //'委托分公司',
store: this.storeSaleCompany,
forceSelection: true,
name: 'SALECORPID',
valueField: 'GID',
displayField: 'NAME'
});
//编辑form
this.formEdit = Ext.widget('form', {
region: 'center',
frame: true,
bodyPadding: 1,
autoScroll: true,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 70,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'fieldset',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
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: 'FactoryAddr', 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: 'gId',
name: 'gId', flex: 0, hidden: true, margins: '0'
}, { fieldLabel: 'PGid',
name: 'PGid', flex: 0, hidden: true, margins: '0'
}, { fieldLabel: 'RefBillNo',
name: 'RefBillNo', flex: 0, hidden: true, margins: '0'
}, { fieldLabel: 'RefBillNose',
name: 'RefBillNose', flex: 0, hidden: true, margins: '0'
}, { fieldLabel: 'FEESTATUS',
name: 'FEESTATUS', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: '时间戳',
name: 'timeMark', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: '委托编号',
allowBlank: false,
disabled: true,
name: 'BillNo'
}, {
fieldLabel: '提单号',
name: 'MblNoSe'
}, this.comboxBLTYPE, {
fieldLabel: 'Marstar业务号',
labelWidth: 85,
name: 'MblNo'
}, {
fieldLabel: '会计期间', //'会计期间',
xtype: 'monthfield',
flex: 0.5,
name: 'ACCDATE'
}, {
fieldLabel: '费用锁定', //'费用锁定',
readOnly: true,
labelWidth: 60,
flex: 0.5,
disabled: true,
name: 'FEESTATUSREF'
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxCustomerName, this.comboxInfoClientContactYard, {
fieldLabel: '发货人',
name: 'CustName'
}, {
fieldLabel: '收货人',
name: 'DispatchName'
}, {
fieldLabel: '状态',
readOnly: true,
flex: 0.5,
name: 'PCSTATUSREF'
}, this.comboxBsType
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '派车时间',
xtype: 'datetimefield',
format: 'Y-m-d', name: 'ExpDate'
}, this.comboxPcBillType, {
fieldLabel: '派车申请人',
name: 'UserName'
}, this.comboxTRUCKER, this.comboxTruckNo
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '装货日期',
format: 'Y-m-d',
xtype: 'datetimefield',
name: 'ArriveDate'
}, {
fieldLabel: '卸货日期',
format: 'Y-m-d',
xtype: 'datetimefield',
name: 'ReturnDate'
}, {
fieldLabel: '到达地',
name: 'DstArea'
}, {
fieldLabel: '目的地',
name: 'DetiNation'
}, {
fieldLabel: '装货地址',
name: 'LoadPlace'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '件数',
name: 'ContainerQty'
}, this.comboxKINDPKGS, {
fieldLabel: '重量',
name: 'Ton'
}, {
fieldLabel: '体积',
name: 'LoadCount'
}, {
fieldLabel: '箱型箱量',
name: 'ContainerType'
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '运单号',
name: 'CUSTNO'
}, {
fieldLabel: '发票号',
name: 'INVOICENO'
}, {
fieldLabel: '提箱场站',
name: 'YardName'
}, this.comboxTruckTypeProp, this.comboxTruckType, this.comboxSALE
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '工厂联系人',
name: 'CustLikeManName'
}, {
fieldLabel: '船名航次',
name: 'VoyVeg'
}, {
fieldLabel: '开船日期',
xtype: 'datefield',
format: 'Y-m-d', name: 'EtDate'
}, {
fieldLabel: '截港日期',
xtype: 'datefield',
format: 'Y-m-d', name: 'EndPortDate'
}, {
fieldLabel: '注意事项',
flex: 1,
name: 'ChangedReson'
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '装货港',
name: 'PORTLOAD'
}, {
fieldLabel: '目的港',
name: 'DESTINATION'
}, {
fieldLabel: '品名',
flex: 2,
name: 'GoodsName'
}, {
fieldLabel: '陆运费',
flex: 1,
name: 'RoadFee'
}
]
},{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxFactory,
this.comboxCargoid, this.comboxRtnDocStatus
, {
fieldLabel: '回单时间',
format: 'Y-m-d',
xtype: 'datetimefield',
name: 'RtnDocTime'
},
this.comboxSaleCompany
]
},{
xtype: 'container',
layout: 'hbox',
defaultType: 'textarea',
items: [{
fieldLabel: '备注',
height: 40,
name: 'Remark'
}]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
}); //end this.formEdit
//#endregion
//#region 按钮Toolbar
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [{
id: 'btnEPrev',
text: "上一票",
// iconCls: "btnsave",
handler: function (button, event) {
this.PrevRecord();
},
scope: this
}, {
id: 'btnENext',
text: "下一票",
// iconCls: "btnsave",
handler: function (button, event) {
this.NextRecord();
},
scope: this
}, {
id: 'bsbtnSave',
text: "保存",
iconCls: "btnsave",
handler: function (button, event) {
this.Save('0');
},
scope: this
},
{
id: 'bsbtnSaveAndClose',
text: "保存并关闭",
handler: function (button, event) {
this.Save('1');
},
scope: this
},
'-',
{
id: 'bsbtnSaveAndNew',
text: "保存并新建",
handler: function (button, event) {
this.Save('2');
},
scope: this
},
'-',
{
text: "关闭",
handler: function (button, event) {
window.close();
},
scope: this
},
{
id: 'bsbtnNew',
text: "新建",
handler: function (button, event) {
this.LoadData('add', '');
var basicForm = this.formEdit.getForm();
basicForm.findField('BillNo').setDisabled(false);
},
scope: this
},
'-',
{
id: 'bsbtnCopyAndNew',
text: "复制新建",
handler: function (button, event) {
var basicForm = this.formEdit.getForm();
this.opStatus = 'add';
basicForm.findField('gId').setDisabled(false);
var field = basicForm.findField('gId');
var BSNO = 'PC' + NewGuid();
var oldbsno = field.getValue();
var oldmasterno = basicForm.findField('PGid').getValue();
field.setValue(BSNO);
if (oldbsno == "" || oldbsno == oldmasterno) {
field = basicForm.findField('PGid');
field.setValue(BSNO);
}
field = basicForm.findField('BillNo');
field.setValue('');
_thisPc.panelFee.strBSNO = BSNO;
_thisPc.panelFee.storeDrChFee.removeAll();
_thisPc.panelFee.storeCrChFee.removeAll();
},
scope: this
},
'-',
{
id: 'bsbtnDriverFee',
text: "利润转司机费用",
handler: function (button, event) {
for (i = 0; i < this.panelFee.storeDrChFee.getCount(); i += 1) {
var memberyf = this.panelFee.storeDrChFee.getAt(i);
if (memberyf.data.FeeStatus != '0') {
Ext.Msg.show({ title: '提示', msg: '系统费用还未审核完毕', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
}
for (i = 0; i < this.panelFee.storeCrChFee.getCount(); i += 1) {
var memberyf = this.panelFee.storeCrChFee.getAt(i);
if (memberyf.data.FeeStatus != '0') {
Ext.Msg.show({ title: '提示', msg: '系统费用还未审核完毕', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
}
this.winRatio.show();
},
scope: this
}
]
}); //end 按钮Toolbar
//#endregion
//#region 布局
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 330,
items: [this.panelBtn, this.formEdit]
});
this.panelFee = new Shipping.FeeEditGrid({
region: 'center',
layout: 'border'
});
this.panelFee.stroplb = 'tMsWlPcHead';
this.panelFee.StoreCustType.add({ "SCUSTTYPE": "WTDW-委托单位", "CUSTTYPE": "委托单位", "CUSTNAME": "CustomerName" });
this.panelFee.StoreCustType.add({ "SCUSTTYPE": "CD-车队", "CUSTTYPE": "车队", "CUSTNAME": "F_CustomerName" });
this.panelFee.StoreDrOpRange.load({ params: { optype: "modOtherRecvFeeManagement"} });
this.panelFee.StoreCrOpRange.load({ params: { optype: "modOtherRecvFeeManagement"} });
this.panelFee.storeFeeNameRef.load({ params: { condition: "ISTRUCKING='1' "} });
this.panelSeae = new Ext.Panel({
title: '委托信息',
// id: 'pnlmodNewOpSeaeInfo',
layout: "border",
region: 'center',
animate: true,
autoScroll: true,
frame: false,
//closable:true,
items: [this.panelTop, this.panelFee]
});
this.tabSeaepanel = new Ext.TabPanel({
activeTab: 0,
autoWidth: true,
border: true,
frame: false,
region: 'center',
// id: "TabSeaePanel",
enableTabScroll: true,
items:
[
this.panelSeae
]
});
Ext.apply(this, {
items: [this.tabSeaepanel]
});
//#endregion
parentWin = window.parent.opener;
this.InitData();
this.LoadMustBe();
Ext.Ajax.request({
waitMsg: '',
url: '/MvcShipping/MsSysParamSet/GetData',
params: {
condition: "PARAMNAME='ACCDATESAMEETD'"
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (result.Success != true) {
} else {
var data = result.data;
if (data.PARAMVALUE == '1') {
this.accdatesameetd = 1;
} else {
}
}
} else {
}
},
scope: this
});
//#region 转司机费用比例
this.formRatio = Ext.widget('form', {
//region: 'north',
//title: '比例',
flex: 1,
frame: true,
bodyPadding: 0,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 110,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'fieldset',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '比例',
name: 'Ratio',
value:'30%',
//xtype: 'numberfield',
//regex: /^(([^0][0-9]+|0)\.([0-9]{1,2}))$/,
regex: /^((\d+\.?\d*)|(\d*\.\d+))\%$/,
regexText: '请输入百分比,不要忘记百分号吖'
}]
}]
}]//end root items
});
me = this;
this.winRatio = Ext.create('Ext.window.Window', {
title: '设定百分比', //"",
width: 320,
//height : 120,
//plain : true,
iconCls: "addicon",
resizable: false,
// 是否可以拖动
// draggable:false,
collapsible: true, // 允许缩放条
closeAction: 'close',
closable: true,
modal: 'true',
buttonAlign: "center",
bodyStyle: "padding:0 0 0 0",
items: [this.formRatio],
buttons: [{
text: '确定', //"确定修改",
minWidth: 70,
handler: function () {
//批量修改
me.GainToDriverFee();
}
}, ]
});
//#endregion
}, //end initUIComponents
//#region 加载数据
InitData: function () {
this.opStatus = 'add';
var condition = '';
if (parentWin) {
var ret = parentWin.OprationSwap();
this.opStatus = ret[0];
this.StoreList = ret[1];
this.editRecord = ret[2];
this.selectPGID = ret[3];
}
if (this.opStatus == 'edit')
condition = " BillNo='" + this.editRecord.get('BillNo') + "'";
this.LoadData(this.opStatus, condition);
}, //end InitData
LoadData: function (opstatus, condition) {
this.opStatus = opstatus;
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/TruckMng/PcHeadEdit_WFSD/GetData',
params: {
handle: opstatus,
condition: condition
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title: '提示',
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
}
var data = result.data;
this.formEdit.getForm().reset();
this.formEdit.getForm().setValues(data);
if (this.selectPGID != '') {
var PGid = this.formEdit.getForm().findField('PGid');
PGid.setValue(this.selectPGID);
if (this.editRecord != NaN && this.editRecord != null) {
this.formEdit.getForm().findField('CustomerName').setValue(this.editRecord.get('CustomerName'));
this.formEdit.getForm().findField('F_CustomerName').setValue(this.editRecord.get('F_CustomerName'));
this.formEdit.getForm().findField('LinkMan').setValue(this.editRecord.get('LinkMan'));
this.formEdit.getForm().findField('CustName').setValue(this.editRecord.get('CustName'));
this.formEdit.getForm().findField('DispatchName').setValue(this.editRecord.get('DispatchName'));
this.formEdit.getForm().findField('BLTYPE').setValue('派车分票');
this.formEdit.getForm().findField('DstArea').setValue(this.editRecord.get('DstArea'));
this.formEdit.getForm().findField('DetiNation').setValue(this.editRecord.get('DetiNation'));
this.formEdit.getForm().findField('LoadPlace').setValue(this.editRecord.get('LoadPlace'));
this.formEdit.getForm().findField('PcBillType').setValue(this.editRecord.get('PcBillType'));
this.formEdit.getForm().findField('ExpDate').setValue(this.editRecord.get('ExpDate'));
this.formEdit.getForm().findField('ArriveDate').setValue(this.editRecord.get('ArriveDate'));
this.formEdit.getForm().findField('ReturnDate').setValue(this.editRecord.get('ReturnDate'));
this.formEdit.getForm().findField('TruckNo').setValue(this.editRecord.get('TruckNo'));
}
}
this.LoadPeriod();
if (data.PCSTATUSREF != '完成') {
this.setSaveBtnStatus(true);
} else {
this.setSaveBtnStatus(false);
}
var editp = Ext.create('PCmb', data);
this.LoadFeeData(editp);
var children = this.tabSeaepanel.items;
if (children) {
for (var i = children.length - 1, len = 0; i >= len; i--) {
if (children.items[i].id) {
if (children.items[i].id == 'pnlmodPcAmendFee') {
children.items[i].close();
}
}
}
}
this.paneltabfeeamend = new Shipping.PcAmendFee({
id: 'pnlmodPcAmendFee',
layout: "border",
region: "center",
autoScroll: true,
frame: false,
closable: true,
title: '更改单信息'
});
this.tabSeaepanel.add(this.paneltabfeeamend);
this.tabSeaepanel.doLayout();
if (data.CustomerName != '') {
var s = " LINKID in (select gid from [info_client] where SHORTNAME='" + data.CustomerName + "')";
this.storeInfoClientContact.load({ params: { condition: s} });
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}, // end LoadDate
LoadFeeData: function (EditRecord) {
this.panelFee.EditRecord = EditRecord;
var bsno = EditRecord.get('gId');
this.panelFee.strBSNO = bsno;
this.panelFee.StoreDateCurr.load({ params: { optype: "tMsWlPcHead", bsno: bsno} });
this.panelFee.StoreUnit.load({ params: { bsno: bsno, bstype: "tMsWlPcHead"} });
this.panelFee.storeDrChFee.load({ params: { billno: bsno, type: 1, optype: "tMsWlPcHead"} });
this.panelFee.storeCrChFee.load({ params: { billno: bsno, type: 2, optype: "tMsWlPcHead"} });
this.panelFee.storeBodySum.load({ params: { bsno: bsno, optype: "tMsWlPcHead" },
callback: function (r, options, success) {
if (success) {
_thisfee.setTotalHead();
}
}
});
this.panelFee.storeChFeeGain.load({ params: { bsno: bsno, optype: "tMsWlPcHead"} });
}, // end LoadDate
LoadPeriod: function (opstatus) {
Ext.Ajax.request({
waitMsg: Zi.LAN.ZhengZaiChaXunShuJu, //'正在查询主表数据...',
url: '/Account/ChMonthClose/GetNowPeriod',
params: {
condition: ''
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
return;
}
data = result.data;
this.MsPeriod = data;
this.LoadPeriodStatus(opstatus);
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
},
LoadPeriodStatus: function (opstatus) {
var ETD = this.formEdit.getForm().findField('ExpDate').getRawValue();
if (ETD == '') {
this.formEdit.getForm().findField('ExpDate').setMinValue(this.MsPeriod.FDAY);
this.formEdit.getForm().findField('ExpDate').setReadOnly(false);
} else {
var oDate1 = new Date(ETD);
var oDate2 = new Date(this.MsPeriod.FDAY);
if (oDate1.getTime() >= oDate2.getTime()) {
this.formEdit.getForm().findField('ExpDate').setMinValue(this.MsPeriod.FDAY);
this.formEdit.getForm().findField('ExpDate').setReadOnly(false);
} else {
if (opstatus == 'add' || opstatus == 'copyadd') {
this.formEdit.getForm().findField('ExpDate').setValue('');
this.formEdit.getForm().findField('ExpDate').setMinValue(this.MsPeriod.FDAY);
this.formEdit.getForm().findField('ExpDate').setReadOnly(false);
}
else {
this.formEdit.getForm().findField('ExpDate').setMinValue('');
this.formEdit.getForm().findField('ExpDate').setReadOnly(true);
}
}
}
var ACCDATE = this.formEdit.getForm().findField('ACCDATE').getValue();
var oDate1 = new Date(ACCDATE + '-01');
var oDate2 = new Date(this.MsPeriod.PERIOD + '-01');
if (oDate1.getTime() >= oDate2.getTime()) {
this.formEdit.getForm().findField('ACCDATE').setMinValue(this.MsPeriod.PERIOD);
this.formEdit.getForm().findField('ACCDATE').setReadOnly(false);
} else {
if (opstatus == 'add' || opstatus == 'copyadd') {
this.formEdit.getForm().findField('ACCDATE').setMinValue(this.MsPeriod.PERIOD);
this.formEdit.getForm().findField('ACCDATE').setReadOnly(false);
}
else {
this.formEdit.getForm().findField('ACCDATE').setMinValue('');
this.formEdit.getForm().findField('ACCDATE').setReadOnly(true);
}
}
},
//#endregion
Save: function (type) {
var basicForm = this.formEdit.getForm();
if (!basicForm.isValid()) {
return;
}
basicForm.findField('BillNo').setDisabled(false);
var data = basicForm.getValues();
basicForm.findField('BillNo').setDisabled(true);
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/TruckMng/PcHeadEdit_WFSD/SaveWFSD',
scope: this,
params: {
opstatus: this.opStatus,
data: Ext.JSON.encode(data)
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var returnData = jsonresult.Data;
this.formEdit.getForm().setValues(returnData);
if (returnData.PCSTATUSREF != '完成') {
this.setSaveBtnStatus(true);
} else {
this.setSaveBtnStatus(false);
}
if (this.opStatus == 'add') {
var arrNewRecords = this.StoreList.insert(0, returnData);
this.editRecord = this.StoreList.getAt(0);
}
else if (this.opStatus == 'edit') {
var editp = Ext.create('PCmb', 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);
} else if (type == '1') {
window.close();
} else {
this.LoadData('add', '');
}
} 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
getCustName: function () {
var custName = this.formEdit.getForm().findField('CustName');
return custName.getValue();
},
onSubmitAuditClick: function (button, event) {
var records = this.feeGridCheckBoxModel.selected.items;
DsTruck.MsChFeeAudit(records, 2, '正在提交审核数据, 请稍侯..');
},
PrevRecord: function () {
var j = this.StoreList.indexOf(this.editRecord);
if (j == 0) {
Ext.Msg.show({ title: '警告', msg: '已是最前一票', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
if (j == this.StoreList.count) {
Ext.Msg.show({ title: '警告', msg: '已是最后一票', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
j = j - 1;
this.editRecord = this.StoreList.getAt(j);
// this.BsNo = this.editRecord.get('BSNO');
this.opStatus = 'edit';
var condition = " BillNo='" + this.editRecord.get('BillNo') + "'";
this.LoadData(this.opStatus, condition);
},
NextRecord: function () {
var j = this.StoreList.indexOf(this.editRecord);
if (j == (this.StoreList.count - 1)) {
Ext.Msg.show({ title: '警告', msg: '已是最后一票', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
j = j + 1;
this.editRecord = this.StoreList.getAt(j);
// this.BsNo = this.editRecord.get('BSNO');
this.opStatus = 'edit';
var condition = " BillNo='" + this.editRecord.get('BillNo') + "'";
this.LoadData(this.opStatus, condition);
},
setSaveBtnStatus: function (enable) {
var bsbtnSave = Ext.getCmp('bsbtnSave');
var bsbtnSaveAndClose = Ext.getCmp('bsbtnSaveAndClose');
var bsbtnSaveAndNew = Ext.getCmp('bsbtnSaveAndNew');
if (enable) {
bsbtnSave.enable();
bsbtnSaveAndClose.enable();
bsbtnSaveAndNew.enable();
} else {
bsbtnSave.disable();
bsbtnSaveAndClose.disable();
bsbtnSaveAndNew.disable();
}
},
LoadMustBe: function () {
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.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 fieldname = member.data.FIELDNAME;
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' });
if (member.data.ISREADONLY == "1")
headfield.setReadOnly(true);
}
};
} else {
}
}
},
scope: this
});
},
GainToDriverFee: function () {
var ratio = this.formRatio.getForm().findField('Ratio').getValue();
this.winRatio.close();
var ttlprofit = '';
for (i = 0; i < this.panelFee.storeBodySum.getCount(); i += 1) {
var memberyf = this.panelFee.storeBodySum.getAt(i);
if (memberyf.data.CURR == '合计') {
ttlprofit = memberyf.data.PR;
}
}
var basicForm = this.formEdit.getForm();
var bsno = basicForm.findField('gId').value;
var data = basicForm.getValues();
var feevalue = returnfloat(ttlprofit) * returnfloat(ratio)/100;
Ext.Msg.wait('正在生成相关费用, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在生成相关费用...',
url: '/TruckMng/PcHeadEdit_WFSD/CreateDriverFee',
scope: this,
params: {
FeeValue: feevalue,
data: Ext.JSON.encode(data)
},
success: function (resp, opts) {
Ext.MessageBox.hide();
this.panelFee.storeCrChFee.load({ params: { billno: bsno, type: 2, optype: "tMsWlPcHead" } });
},
failure: function (resp, opts) {
Ext.MessageBox.hide();
Ext.Msg.show({
title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
});
},
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;
},
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;
Ext.Ajax.request({
waitMsg: '正在查询数据...',
url: '/TruckMng/MsWlBs/GetIsPrint',
async: false,
params: {
billno: billNo,
Gid: gid
},
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;
} else {
var printType = 'MSWLBS';
var sql1 = "SET LANGUAGE 'us_english ' "
+ " select * from vMsWlBsHeadPrint WHERE BillNo = '" + billNo + "' order by BillNo";
var sql2 = "SET LANGUAGE 'us_english' SELECT * from ch_fee where BsNo='" + gid + "'";
//var sql3 = "SET LANGUAGE 'us_english' "
// + " select * from vMsWlPcHeadPrint where RefBillNo='" + billNo + "' order by RefBillNo";
//var sql4 = "SET LANGUAGE 'us_english' select * from ch_fee where BSNO in (select Gid from tMswlpcHead where RefBillNo='" + billNo + "') order by BsNo";
var sql3 = "SET LANGUAGE 'us_english' select A.*,B.* from vMsWlPcHeadPrint A, ch_fee B where A.Gid=B.BsNo and A.RefBillNo='" + billNo + "' order by A.RefBillNo";
//var sql4 = "SET LANGUAGE 'us_english' select * from tMsWlPcFixed where BillNo in (select Gid from tMswlpcHead where RefBillNo='" + billNo + "') order by BillNo";
var sql4 = "SET LANGUAGE 'us_english' select A.*,B.* from vMsWlPcHeadPrint A,tMsWlPcFixed B where A.Gid=B.BillNo and A.RefBillNo='" + billNo + "' order by A.RefBillNo";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
},
DispatchTruck: function () {
},
setBtnOnlyQuery: function () {
var bsbtnSave = Ext.getCmp('bsbtnSave');
var bsbtnSaveAndClose = Ext.getCmp('bsbtnSaveAndClose');
var bsbtnSaveAndNew = Ext.getCmp('bsbtnSaveAndNew');
var bsbtnNew = Ext.getCmp('bsbtnNew');
bsbtnSave.setVisible(false);
bsbtnSaveAndClose.setVisible(false);
bsbtnSaveAndNew.setVisible(false);
bsbtnNew.setVisible(false);
}
});