//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.fixSerialNo = 0; this.fixBodyDel = []; 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: 'DCLASS', type: 'string' }, { name: 'DUNNO', type: 'string' }, { name: 'OPSTATUS', type: 'string' }, { name: 'COLOR', 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/GetTraderRm' } }); this.storeCustomerName.load(); this.comboxCustomerName = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '客户', id: "CustomerName", //hidden: true, forceSelection: true, store: this.storeCustomerName, queryMode: 'remote', minChars: 1, queryParam: 'CODENAME', 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/GetCustomRefListTRUCK' } }); //this.storeTRUCKER.load({ params: { condition: "ISTRUCK='1'"} }); _thisPc = this; //车队 this.comboxTRUCKER = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '车队', store: this.storeTRUCKER, queryMode: 'remote', minChars: 1, queryParam: 'CODENAME', 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' }, { name: 'OWNER', 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: { scope: this, 'select': function (combo, records, eOpts) { if (records.length > 0) { this.formEdit.getForm().findField('F_CustomerName').setValue(records[0].data.OWNER); } } } }); //委托单位_联系人 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.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: "货物标示", 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/GetDataListRm' } }); this.storeFactry.load(); //工厂 this.comboxFactory = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '装货工厂', flex: 1, store: this.storeFactry, matchFieldWidth: false, //下拉款自适应宽度 queryMode: 'remote', minChars: 1, queryParam: 'CODENAME', autoSelect: true, 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' }); this.storeDrvName = Ext.create('DsExt.ux.RefTableStore', { model: 'MsWlBsHeadRefMsWlDriver', proxy: { url: '/TruckMng/MsWlPc/GetDrvNameList' } }); this.storeDrvName.load({ params: { condition: "" } }); this.comboxDrvName = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '司机', store: this.storeDrvName, name: 'DrvCode', valueField: 'DrvCode', displayField: 'DrvName' , listeners: { beforequery: function (e) { return FilterCombox(e, 1); //在beforequery使用此方法 }, scope: this } }); Ext.define('MsOpSeaeDetail', { extend: 'Ext.data.Model', fields: [ { name: 'GID', type: 'string' }, { name: 'CTN_ID', type: 'string' }, { name: 'CTNNUM', type: 'number' }, { name: 'KGS', type: 'number' }, { name: 'CTNALL', type: 'string' }, { name: 'CNTRNO', type: 'string' }, { name: 'SEALNO', type: 'string' } ] }); this.storeCtnList = Ext.create('Ext.data.Store', { model: 'MsOpSeaeDetail', remoteSort: true, proxy: { type: 'ajax', url: '/MvcShipping/MsOpLetter/GetLetterCtnList', reader: { id: 'CTN_ID', root: 'data', totalProperty: 'totalCount' } } }); //箱型_集装箱列表中的下拉框加载 this.storeCodeCtn = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CodeCtnModel', proxy: { url: '/CommMng/BasicDataRef/GetCodeCtnList' } }); this.storeCodeCtn.load(); this.comboxCTNALL = Ext.create('DsExt.ux.RefTableCombox', { store: this.storeCodeCtn, forceSelection: true, name: 'CTNALL', valueField: 'CTN', displayField: 'CTN' }); this.gridListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', { clicksToEdit: 1 }); this.gridListCtn = new Ext.grid.GridPanel({ store: this.storeCtnList, enableHdMenu: false, region: 'center', loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, plugins: [this.gridListCellEditing], selType: 'cellmodel', tbar: [ { text: '增加明细', //'增加明细', tooltip: '增加明细', //'增加明细', id: "btnadddetail", iconCls: "btnadddetail", handler: function (button, event) { this.addDetail(); }, scope: this }, '-', { text: '删除明细', //'删除明细', tooltip: '删除明细', //'删除明细', id: "btndeldetail", iconCls: "btndeletedetail", handler: function (button, event) { this.deleteDetail(); }, scope: this }], columns: [{ sortable: true, dataIndex: 'CTN_ID', header: '编号', hidden: true, width: 0 }, { dataIndex: 'CTNALL', header: '箱型', //'箱型', width: 80, editor: this.comboxCTNALL }, { dataIndex: 'CNTRNO', header: '箱号', //'重量', width: 120, editor: { xtype: 'textfield', selectOnFocus: true } }, { dataIndex: 'SEALNO', header:'封号', //'重量', width: 120, editor: { xtype: 'textfield', selectOnFocus: true } } // , { // dataIndex: 'CTNNUM', // header: Zi.LAN.CTNNUM, //'箱量', // width: 100, // editor: { // xtype: 'numberfield', // allowBlank: false, // selectOnFocus: true // } //}, { // dataIndex: 'KGS', // header: Zi.LAN.ZHONGLIANG, //'重量', // width: 120, // editor: { // xtype: 'textfield', // selectOnFocus: true // } // } ] }); this.storeCtnList.on('beforeload', function (store) { var billNo = this.editRecord.get('gId'); var condition = "LE_ID='" + billNo + "'"; Ext.apply(store.proxy.extraParams, { condition: condition }); }, this); this.panelBodyCtn = new Ext.Panel({ // title: '集装箱信息', //'集装箱信息', layout: "border", height: 100, flex: 1, margin: '5 20', frame: true, items: [this.gridListCtn] }); //编辑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: 'container', 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' }, this.comboxDrvName] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '装货地址', flex:3, name: 'LoadPlace' }, { fieldLabel: '联系电话1', flex: 1, name: 'LinkTel' }, { fieldLabel: '联系电话2', flex: 1, name: 'LinkTelSe' } ] }, { 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: 1, name: 'GoodsName' }, { fieldLabel: '危品等级', flex: 0.5, name: 'DCLASS' }, { fieldLabel: '危品编号', flex: 0.5, name: 'DUNNO' }, { 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: 80, flex: 3, name: 'Remark' },this.panelBodyCtn] } ]//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.storeFeeTypeCodeRef = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.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, matchFieldWidth: false, name: 'FeeTypeCode', valueField: 'FeeCode', displayField: 'CodeAndName' }); Ext.define('MsWlPcFixed', { extend: 'Ext.data.Model', idProperty: 'GId', fields: [ { name: 'BillNo', type: 'string' }, { name: 'SerialNo', type: 'number' }, { name: 'CreditDebit', type: 'string' }, { name: 'CreditDebit_Ref', type: 'string' }, { name: 'FeeTypeCode', type: 'string' }, { name: 'FeeTypeCode_Ref', type: 'string' }, { name: 'FeeTypeName', type: 'string' }, { name: 'DistCount', type: 'number' }, { name: 'Price', type: 'number' }, { name: 'FsTotal', type: 'number' }, { name: 'JsTotal', type: 'number' }, { name: 'Remark', type: 'string' }, { name: 'GId', type: 'string' }, { name: 'FeeStatus', type: 'number' }, { name: 'FeeStatus_Ref', type: 'string' }, { name: 'SubmitDate', type: 'date' }, { name: 'Auditoperator', type: 'string' }, { name: 'AuditDate', type: 'date' }, { name: 'AuditStatus', type: 'number' } ] }); //明细表-数据集 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); //this.panelFix = new Ext.Panel({ // title: '车辆成本', // split: true, // layout: "border", // region: 'west', // width: 260, // items: [this.gridListFix] //}); //#endregion 明细表 //#region 布局 this.panelTop = new Ext.Panel({ layout: "border", region: "north", height: 410, 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.panelFeeAll = new Ext.Panel({ // layout: "border", // region: 'center', // animate: true, // autoScroll: true, // frame: false, // //closable:true, // items: [this.panelFix, this.panelFee] //}); 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' || this.opStatus == 'copy' || this.opStatus == 'copyfee') condition = " BillNo='" + this.editRecord.get('BillNo') + "'"; if (this.opStatus == 'copy' || this.opStatus == 'copyfee') this.LoadCopyData(this.opStatus, condition); else this.LoadData(this.opStatus, condition); }, //end InitData LoadData: function (opstatus, condition) { this.fixSerialNo = 0; this.fixBodyDel = []; 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(); this.panelReceipt = new Shipping.ReceiptEditGrid({ region: 'center', layout: 'border', title: '单据信息' }); this.panelReceipt.EditRecord = this.editRecord; this.panelReceipt.stroplb = 'tMsWlPcHead'; this.panelReceipt.strBSNO = this.editRecord.get('gId'); this.panelReceipt.strMBLNO = this.editRecord.get('MblNoSe'); this.panelReceipt.StoreDrOpRange.load({ params: { optype: "modOpReceiptManagement" } }); this.panelReceipt.storeDrOpReceipt.load({ params: { billno: this.editRecord.get('gId'), optype: "tMsWlPcHead" } }); this.panelReceipt.storeDocList.load({ params: { condition: " BSNO='" + this.editRecord.get('gId') + "'" } }); this.tabSeaepanel.add(this.panelReceipt); this.tabSeaepanel.doLayout(); var paneltabitems = new Ext.Panel({ id: 'pnlopstatus', layout: "fit", region: "center", autoScroll: true, frame: false, closable: true, title:'状态管理', html: ' ' }); this.tabSeaepanel.add(paneltabitems); 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 LoadCopyData: function (opstatus, condition) { this.fixSerialNo = 0; this.fixBodyDel = []; this.opStatus = opstatus; Ext.Ajax.request({ waitMsg: '正在查询主表数据...', url: '/TruckMng/PcHeadEdit_WFSD/GetData', params: { handle: 'edit', 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); var basicForm = this.formEdit.getForm(); 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(''); if (this.opStatus == 'copyfee') { this.LoadCopyFeeData(oldbsno, BSNO); } else { _thisPc.panelFee.strBSNO = BSNO; _thisPc.panelFee.storeDrChFee.removeAll(); _thisPc.panelFee.storeCrChFee.removeAll(); } this.editRecord.set('gId', BSNO); this.opStatus = 'add'; 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); 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(); this.panelReceipt = new Shipping.ReceiptEditGrid({ region: 'center', layout: 'border', title: '单据信息' }); this.panelReceipt.EditRecord = this.editRecord; this.panelReceipt.stroplb = 'tMsWlPcHead'; this.panelReceipt.strBSNO = BSNO; this.panelReceipt.strMBLNO = this.editRecord.get('MblNoSe'); this.panelReceipt.StoreDrOpRange.load({ params: { optype: "modOpReceiptManagement" } }); this.panelReceipt.storeDrOpReceipt.load({ params: { billno: BSNO, optype: "tMsWlPcHead" } }); this.panelReceipt.storeDocList.load({ params: { condition: " BSNO='" + BSNO+ "'" } }); this.tabSeaepanel.add(this.panelReceipt); this.tabSeaepanel.doLayout(); var paneltabitems = new Ext.Panel({ id: 'pnlopstatus', layout: "fit", region: "center", autoScroll: true, frame: false, closable: true, title: '状态管理', html: ' ' }); this.tabSeaepanel.add(paneltabitems); 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" } }); this.panelFee.storeBodyList_GuDingFeeWeiHu.load(); this.storeCtnList.load({ params: { condition: "LE_ID='" + bsno + "'" } }); //this.storeBodyFix.load({ params: { billno: bsno } }); }, // end LoadDate LoadCopyFeeData: function (oldbsno, bsno) { this.panelFee.EditRecord = this.editRecord; this.panelFee.strBSNO = bsno; this.panelFee.StoreDateCurr.load({ params: { optype: "tMsWlPcHead", bsno: oldbsno } }); this.panelFee.StoreUnit.load({ params: { bsno: oldbsno, bstype: "tMsWlPcHead" } }); this.panelFee.storeDrChFee.load({ params: { billno: oldbsno, type: 1, optype: "tMsWlPcHead" }, callback: function (r, options, success) { if (success) { if (_thisPc.panelFee.storeDrChFee.getCount() > 0) { for (var j = 0; j < _thisPc.panelFee.storeDrChFee.getCount(); j += 1) { var memberbody = _thisPc.panelFee.storeDrChFee.getAt(j); memberbody.set("GId", NewGuid()); memberbody.set("BsNo", "*"); memberbody.set("FeeStatus",1); memberbody.commit(); } } else { _thisPc.panelFee.storeDrChFee.removeAll(); } } }, scope: this }); this.panelFee.storeCrChFee.load({ params: { billno: oldbsno, type: 2, optype: "tMsWlPcHead" }, callback: function (r, options, success) { if (success) { if (_thisPc.panelFee.storeCrChFee.getCount() > 0) { for (var j = 0; j < _thisPc.panelFee.storeCrChFee.getCount(); j += 1) { var memberbody = _thisPc.panelFee.storeCrChFee.getAt(j); memberbody.set("GId", NewGuid()); memberbody.set("BsNo", "*"); memberbody.set("FeeStatus", 1); memberbody.commit(); } } else { _thisPc.panelFee.storeCrChFee.removeAll(); } } }, scope: this }); this.panelFee.storeBodySum.removeAll(); this.panelFee.storeChFeeGain.removeAll(); this.panelFee.storeBodyList_GuDingFeeWeiHu.load(); this.storeCtnList.load({ params: { condition: "LE_ID='" + oldbsno + "'" }, callback: function (r, options, success) { if (success) { if (_this.storeCtnList.getCount() > 0) { for (var j = 0; j < _this.storeCtnList.getCount(); j += 1) { var memberbody = _this.storeCtnList.getAt(j); memberbody.set("BSNO", "*"); memberbody.commit(); } } else { _this.storeCtnList.removeAll(); } } }, scope: this }); //this.storeBodyFix.load({ params: { billno: bsno } }); }, // 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); var bodyctndatas = []; for (var i = 0; i < this.storeCtnList.getCount(); i += 1) { var member = this.storeCtnList.getAt(i); bodyctndatas.push(member); } ; var jsonCtnBody = ConvertRecordsToJsonAll(bodyctndatas); Ext.Msg.wait('正在保存数据, 请稍侯..'); Ext.Ajax.request({ waitMsg: '正在保存数据...', url: '/TruckMng/PcHeadEdit_WFSD/SaveWFSD', scope: this, params: { opstatus: this.opStatus, data: Ext.JSON.encode(data), ctnbody:jsonCtnBody }, 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); //for (var i = 0; i < this.storeBodyFix.getCount(); i += 1) { // var member = this.storeBodyFix.getAt(i); // member.set("BillNo", this.editRecord.get('gId')); // member.commit(); //}; var LE_ID = this.editRecord.get('gId'); for (var j = 0; j < this.storeCtnList.getCount(); j += 1) { var memberbody = this.storeCtnList.getAt(j); memberbody.set("LE_ID", LE_ID); memberbody.commit(); }; this.panelFee.strBSNO = LE_ID; this.panelFee.StoreDateCurr.load({ params: { optype: "tMsWlPcHead", bsno: LE_ID } }); this.panelFee.StoreUnit.load({ params: { bsno: LE_ID, bstype: "tMsWlPcHead" } }); } 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 //#region 明细操作 addDetail: function () { var record = Ext.create('MsOpSeaeDetail', { CTN_ID: NewGuid(), LE_ID: '*', CTNALL: '', SEALNO: '', CNTRNO: '', CTNNUM: 1, KGS: 0 }); this.storeCtnList.add(record); var n = this.storeCtnList.getCount(); this.gridListCellEditing.startEditByPosition({ row: n - 1, column: 1 }); }, deleteDetail: function () { var selectedRecords = this.gridListCtn.selModel.getSelection(); for (var i = 0; i < selectedRecords.length; i++) { var rec = selectedRecords[i]; if (rec.data.LE_ID == "" || rec.data.LE_ID == "*")//如果是新增但没有保存的数据,没有必要提交到后台 { this.storeCtnList.remove(selectedRecords[i]); this.setAllTotal(); } else { Ext.MessageBox.confirm(Zi.LAN.TiShi, Zi.LAN.QueDingShanChuGaiJiLuMa, function (btn) { if (btn == 'yes') { Ext.Msg.wait('正在操作数据'); Ext.Ajax.request({ waitMsg: '正在操作数据', //'正在删除数据...', url: '/MvcShipping/MsOpLetter/DeleteLetterCtn', params: { data: Ext.JSON.encode(rec.data) }, callback: function (options, success, response) { if (success) { var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { this.storeCtnList.remove(rec); this.setAllTotal(); Ext.Msg.show({ title: Zi.LAN.TiShi, msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); } else { Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } }, failure: function (response, options) { Ext.Msg.show({ title: '警告', msg: '服务器响应出错!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); }, scope: this }); //end Ext.Ajax.request } }, this); } //this.storeBodyList.remove(selectedRecords[i]); } }, setAllTotal: function () { var cntrstr = ''; //var kgs = 0; //for (var j = 0; j < _this.storeCtnList.getCount(); j += 1) { // var memberbody = _this.storeCtnList.getAt(j); // if (cntrstr == '') // cntrstr = memberbody.data.CTNALL + '*' + memberbody.data.CTNNUM; // else // cntrstr = cntrstr + ' ' + memberbody.data.CTNALL + '*' + memberbody.data.CTNNUM; //} //this.formEdit.getForm().findField('CTNS').setValue(cntrstr); //this.formEdit.getForm().findField('KGS').setValue(kgs); }, //#endregion 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; return '0'; }, 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); } });