Ext.namespace('Shipping'); Shipping.TruckBulkAmendFeeEdit = function (config) { Ext.applyIf(this, config); this.initUIComponents(); window.Shipping.TruckBulkAmendFeeEdit.superclass.constructor.call(this); }; Ext.extend(Shipping.TruckBulkAmendFeeEdit, Ext.Panel, { ParentWin: null, OpStatus: 'add', StoreList: null, EditRecord: null, region: 'north', BsNo: '', feeType: null, StoreFee: null, StoreFeeUnit: null, StoreFeeCust: null, sqlcontext: '', PageSize: 50, MsPeriod: null, initUIComponents: function () { this.formname = "MsTruckBulkAmendFeeEdit"; //页面名称 this.MsPeriod = null; _this = this; //#region 编辑formHead 基本信息 this.formHead = Ext.widget('form', { region: 'north', frame: true, bodyPadding: 5, trackResetOnLoad: true, fieldDefaults: { margins: '2 2 2 2', labelAlign: 'right', flex: 1, labelWidth: 70, msgTarget: 'qtip' }, items: [ { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: 'BSNO', //'业务编号', name: 'BSNO', hidden: true }, { fieldLabel: 'GID', //'业务编号', name: 'GID', hidden: true }, { fieldLabel: 'PARENTID', //'业务编号', name: 'PARENTID', hidden: true }, { fieldLabel: '考核单编号', //'订舱编号', readOnly: true, name: 'AMENDNO' }, { fieldLabel: '会计期间', //'会计期间', xtype: 'monthfield', allowBlank: true, name: 'ACCDATE' }, { fieldLabel: '费用锁定', //'费用锁定', readOnly: true, disabled: true, name: 'FEESTATUSREF' }, { fieldLabel:'录入人', //'CREATETIME', readOnly: true, name: 'CREATEUSER' }, { fieldLabel:'录入时间', //'CREATETIME', readOnly: true, name: 'CREATETIME' }, { fieldLabel: '揽货人', //'CREATETIME', readOnly: true, name: 'SALE' }] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel:'原因', //'订舱编号', flex: 3, name: 'REASON' }, { fieldLabel:'备注', //'主提单号', flex: 2, name: 'REMARKS' }] } ]//end items(fieldset 1) }); //end this.formEdit //#endregion this.formEdit = Ext.widget('form', { frame: true, region: 'center', bodyPadding: 5, fieldDefaults: { margins: '2 2 2 2', labelAlign: 'right', flex: 1, labelWidth: 70, msgTarget: 'qtip' }, items: [ { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '业务编号', name: 'BSNO', flex: 0, hidden: true, margins: '0' }, { fieldLabel: '委托编号', readOnly: true, name: 'CUSTNO' }, { fieldLabel: '业务锁定', readOnly: true, name: 'BSSTATUSREF' }, { fieldLabel: '费用锁定', readOnly: true, name: 'FEESTATUSREF' }, { fieldLabel: '会计期间', readOnly: true, name: 'ACCDATE' //xtype: 'monthfield', //value: Ext.util.Format.date(Ext.Date.add(new Date(), Ext.Date.MONTH - 1, 1), "Y-m"), }, { fieldLabel: '委托单位', readOnly: true, name: 'CUSTOMERNAME' }, { fieldLabel: '装运方式', readOnly: true, name: 'TRANSTYPE' }] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '合同号', readOnly: true, name: 'CONTRACTNO' }, { fieldLabel: '计费方案', readOnly: true, name: 'TEMPLATENAME' }, { fieldLabel: '客户经理', readOnly: true, name: 'SALE' }, { fieldLabel: '操 作', readOnly: true, name: 'OP' }, { fieldLabel: '运营经理', readOnly: true, name: 'CUSTSERVICE' }, { fieldLabel: '起运地', readOnly: true, name: 'PORTLOAD' }] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '客户订单号', readOnly: true, name: 'ORDERNO' },{ fieldLabel: '目的地', readOnly: true, name: 'PORTDISCHARGE' },{ fieldLabel: '品名', readOnly: true, name: 'GOODSNAME' }, { fieldLabel: '件数', readOnly: true, name: 'PKGS' }, { fieldLabel: '毛量', readOnly: true, name: 'KGS' }, { fieldLabel: '尺码', readOnly: true, name: 'CBM' }] } ] }); //end this.formEdit //#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: 'btnESave', text: '保存', //"保存", iconCls: "btnsave", handler: function (button, event) { this.Save('0'); }, scope: this }, { id: 'btnESaveAndClose', text: "保存并关闭", //"保存并关闭", handler: function (button, event) { this.Save('1'); }, scope: this }, { text: "新建", //"新建", handler: function (button, event) { this.formEdit.getForm().reset(); this.formEdit.getForm().setValues(''); this.formHead.getForm().reset(); this.formHead.getForm().setValues(''); this.formHead.getForm().findField('BSNO').setValue(''); this.formHead.getForm().findField('GID').setValue(''); this.formHead.getForm().findField('PARENTID').setValue(''); this.formHead.getForm().findField('AMENDNO').setValue(''); this.formHead.getForm().findField('FEESTATUSREF').setValue('未锁定'); this.formHead.getForm().findField('REASON').setValue(''); this.formHead.getForm().findField('REMARKS').setValue(''); this.formHead.getForm().findField('CREATEUSER').setValue(''); this.formHead.getForm().findField('CREATETIME').setValue(''); var myDate = new Date(); var mydatestr = Ext.util.Format.date(myDate, 'Y-m'); field = this.formHead.getForm().findField('ACCDATE'); field.setValue(mydatestr); this.panelList.setVisible(true); this.tabSeaepanel.removeAll(); this.tabSeaepanel.add(this.panelList); this.tabSeaepanel.doLayout(); this.opStatus = 'add'; }, scope: this }] }); //end 按钮Toolbar //#endregion this.panelTop = new Ext.Panel({ layout: "border", region: "north", height: 220, id: "BillHeadSeae", items: [this.panelBtn, this.formHead, this.formEdit] }); this.panelFee = new Shipping.FeeEditGrid({ region: 'center', title: '费用信息', layout: 'border' }); this.panelFee.stroplb = 'op_truckbulk'; this.panelFee.StoreCustType.add({ "SCUSTTYPE": "WTDW-委托单位", "CUSTTYPE": "委托单位", "CUSTNAME": "CUSTOMERNAME" }); this.panelFee.StoreCustType.add({ "SCUSTTYPE": "QT-其他", "CUSTTYPE": "其他", "CUSTNAME": "" }); this.panelFee.StoreCustType.add({ "SCUSTTYPE": "", "CUSTTYPE": "", "CUSTNAME": "" }); this.panelFee.StoreDrOpRange.load({ params: { optype: "modTruckRecvFeeManagement" } }); this.panelFee.StoreCrOpRange.load({ params: { optype: "modTruckPayFeeManagement" } }); this.panelFee.storeFeeNameRef.load({ params: { condition: "ISSEA='1' "} }); //#regin 业务列表 this.storeList = Ext.create('Ext.data.Store', { pageSize: this.PageSize, model: 'MsOpTruckBulk', remoteSort: true, proxy: { type: 'ajax', url: '/TruckMng/MsOpTruckBulk/GetDataList', reader: { id: 'BSNO', root: 'data', totalProperty: 'totalCount' } } }); this.Pagenum = Ext.create('Ext.form.field.Number', { name: 'bottles', fieldLabel:'每页记录数', //'每页记录数', labelAlign: 'right', value: this.PageSize, maxValue: 100000, width: 180, minValue: 0, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }); Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, { width: 40 }); this.initgirdcolums = [{ sortable: true, dataIndex: 'BSNO', header: '业务编号', hidden: true, width: 80 }, { sortable: true, dataIndex: 'TRANSSTATUS', header: '订单状态', width: 80 }, { sortable: true, dataIndex: 'BSSTATUSREF', header: '业务锁定', align: 'center', width: 60, renderer: function (value, cellmeta) { if (value == '锁定') { return ""; } } }, { sortable: true, dataIndex: 'FEESTATUSREF', header: '费用锁定', align: 'center', width: 60, renderer: function (value, cellmeta) { if (value == '锁定') { return ""; } } }, { sortable: true, id: '', dataIndex: 'DRFEESTATUS', header: '应收费用', align: 'center', width: 60, renderer: function (value, meta) { if (value == '审核通过') { meta.tdCls = 'feestatus_pass'; } else if (value == '录入状态') { } else if (value == '提交审核') { meta.tdCls = 'feestatus_refer'; } else if (value == '部分结算') { meta.tdCls = 'feestatus_refer'; } else if (value == '结算完毕') { meta.tdCls = 'feestatus_settle'; } else if (value == '未录入') { } else if (value == '部分结算') { meta.tdCls = 'feestatus_settle'; } else if (value == '部分审核') { meta.tdCls = 'feestatus_pass'; } else if (value == '部分提交') { meta.tdCls = 'feestatus_refer'; } return value; } }, { sortable: true, id: '', dataIndex: 'CRFEESTATUS', header: '应付费用', align: 'center', width: 60, renderer: function (value, meta) { if (value == '审核通过') { meta.tdCls = 'feestatus_pass'; } else if (value == '录入状态') { } else if (value == '提交审核') { meta.tdCls = 'feestatus_refer'; } else if (value == '部分结算') { meta.tdCls = 'feestatus_refer'; } else if (value == '结算完毕') { meta.tdCls = 'feestatus_settle'; } else if (value == '未录入') { } else if (value == '部分结算') { meta.tdCls = 'feestatus_settle'; } else if (value == '部分审核') { meta.tdCls = 'feestatus_pass'; } else if (value == '部分提交') { meta.tdCls = 'feestatus_refer'; } return value; } }, { sortable: true, id: '', dataIndex: 'DRINVSTATUS', header: '应收开票', align: 'center', width: 60, renderer: function (value, meta) { if (value == '已开票') { meta.tdCls = 'feestatus_pass'; } else if (value == '部分开票') { meta.tdCls = 'feestatus_refer'; } return value; } }, { sortable: true, id: '', dataIndex: 'BillFeeStatus', header: '整票状态', //'整票状态', width: 60, renderer: function (value, meta) { if (value == '0') { return "未提交"; } else if (value == '1') { meta.tdCls = 'feestatus_refer'; return "整票提交"; } else if (value == '2') { meta.tdCls = 'feestatus_pass'; return "审核通过"; } else { return ""; } } }, { sortable: true, dataIndex: 'TRANSTYPE', header: '装运方式', width: 80 }, { sortable: true, dataIndex: 'CUSTOMERNAME', header: '委托单位', width: 80 }, { sortable: true, dataIndex: 'CUSTNO', header: '订单编号', width: 80 }, { sortable: true, dataIndex: 'CONTRACTNO', header: '合同号', width: 80 }, { sortable: true, dataIndex: 'ORDERNO', header: '客户订单号', width: 80 }, { sortable: true, dataIndex: 'BSDATE', header: '接单日期', width: 80 }, { sortable: true, dataIndex: 'ACCDATE', header: '会计期间', width: 80 }, { sortable: true, dataIndex: 'ETD', header: '起运日期', width: 80 }, { sortable: true, dataIndex: 'ETA', header: '到达日期', width: 80 }, { sortable: true, dataIndex: 'OP', header: '操作', width: 80 }, { sortable: true, dataIndex: 'SALE', header: '客户经理', width: 80 }, { sortable: true, dataIndex: 'CUSTSERVICE', header: '运营经理', width: 80 }, { sortable: true, dataIndex: 'CUSTATTN', header: '客户联系人', width: 80 }, { sortable: true, dataIndex: 'CUSTTEL', header: '客户联系人电话', width: 80 }, { sortable: true, dataIndex: 'CONSIGNEENAME', header: '收货方', width: 80 }, { sortable: true, dataIndex: 'CONSIGNEEATTN', header: '收货联系人', width: 80 }, { sortable: true, dataIndex: 'CONSIGNEETEL', header: '收货联系人电话', width: 80 }, { sortable: true, dataIndex: 'CONSIGNEEADDR', header: '收货地址', width: 80 }, { sortable: true, dataIndex: 'PORTLOAD', header: '启运地', width: 80 }, { sortable: true, dataIndex: 'PORTDISCHARGE', header: '目的地', width: 80 }, { sortable: true, dataIndex: 'GOODSNAME', header: '品名', width: 80 }, { sortable: true, dataIndex: 'KGS', header: '毛重', width: 80 }, { sortable: true, dataIndex: 'NETWEIGHT', header: '净重', width: 80 }, { sortable: true, dataIndex: 'CBM', header: '尺码', width: 80 }, { sortable: true, dataIndex: 'PKGS', header: '件数', width: 80 }, { sortable: true, dataIndex: 'KINDPKGS', header: '件数包装', width: 80 }, { sortable: true, dataIndex: 'VOUNO', header: '凭证号', width: 80 }, { sortable: true, dataIndex: 'CREATEUSER', header: '创建人', width: 80 }, { sortable: true, dataIndex: 'CREATETIME', header: '创建日期', width: 80 }, { sortable: true, dataIndex: 'MODIFIEDUSER', header: '修改人', width: 80 }, { sortable: true, dataIndex: 'MODIFIEDTIME', header: '修改日期', width: 80 }, { sortable: true, dataIndex: 'REMARK', header: '备注', width: 200 }, { sortable: true, dataIndex: 'ISPRINTPR', header: '打印核算单', width: 100, renderer: function (value, meta, record) { if (value == '1') return '√'; else return ''; } }]; this.girdcolums = this.initgirdcolums; this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel'); // configure whether filter query is encoded or not (initially) var encode = false; // configure whether filtering is performed locally or remotely (initially) var local = true; //定义Grid this.gridList = new Ext.grid.GridPanel({ store: this.storeList, enableHdMenu: false, region: 'center', id: 'gridlist', loadMask: { msg: "数据加载中,请稍等..." //"数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, selModel: this.GridCheckBoxModel, viewConfig: { enableTextSelection: true, //允许复制数据 autoFill: true, getRowClass: function (record, rowIndex, rowParams, store) { var ISCANCEL = record.get('ISCANCEL'); if (ISCANCEL == '1') return 'feestatus_Del'; } }, tbar: [{ text: '生成更改单', tooltip: '生成更改单', id: 'btnaddbill', iconCls: "btnadddetail", handler: function (button, event) { this.onAddClick(button, event); }, scope: this }, '-', { text: "保存列表样式", id: "btntestbody", menu: [ { text: "保存", //"保存", handler: function (button, event) { this.girdcolums = DsTruck.SaveGridPanel(USERID, _this.formname, _this.gridList.columns, _this.girdcolums, 2, true); } }, { text: "初始化", //"初始化", handler: function (menu, event) { // _this.InitGrid(_this.initgirdcolums); _this.girdcolums = DsTruck.SaveGridPanel(USERID, _this.formname, _this.gridList.columns, _this.initgirdcolums, 2, true); } } ], scope: this }], columns: this.girdcolums, bbar: [Ext.create('Ext.PagingToolbar', { store: this.storeList, displayInfo: true, displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录', //'当前显示 {0} - {1}条记录 /共 {2}条记录', emptyMsg: '没有数据'//'没有数据' }), this.Pagenum] }); /////////////以下部分为获取存储的gridpanel显示样式 this.girdcolums = DsTruck.GetGridPanel(USERID, this.formname, this.girdcolums, 1); //使用者id,表名,中间column数组,跳过一开始的几列 this.gridList.reconfigure(this.storeList, this.girdcolums); this.gridList.columns[1] = new Ext.grid.RowNumberer(); //状态_业务状态 Ext.define('BSSTATUSModel', { extend: 'Ext.data.Model', fields: [ { name: 'Name', type: 'string' } ] }); var dataBSSTATUS = [{ "Name": "未锁定" }, { "Name": "锁定" }, { "Name": "" }]; var storeBSSTATUS = Ext.create('Ext.data.Store', { model: 'BSSTATUSModel', data: dataBSSTATUS }); //业务状态 this.comboxBSSTATUS = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '业务锁定', forceSelection: true, store: storeBSSTATUS, name: 'BSSTATUS', valueField: 'Name', displayField: 'Name' }); //费用状态 this.comboxFEESTATUS = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '费用锁定', forceSelection: true, store: storeBSSTATUS, name: 'FEESTATUS', valueField: 'Name', displayField: 'Name' }); //人员信息加载 this.storeOpCode = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.UserRefModel', proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' } }); this.storeOpCode.load(); //操 作 this.comboxOP = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '操 作', store: this.storeOpCode, forceSelection: true, name: 'OP', valueField: 'UserName', displayField: 'CodeAndName', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }); //客户加载_委托单位 this.storeCustCode = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListController' } }); this.storeCustCode.load(); //委托单位 this.comboxCustCode = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '委托单位', store: this.storeCustCode, forceSelection: true, queryMode: 'remote', minChars: 0, queryParam: 'CODENAME', name: 'CUSTOMERNAME', valueField: 'CustName', displayField: 'CodeAndName', enableKeyEvents: true, listeners: { //specialkey: function (field, e) { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }); this.storeTransStatus = Ext.create('Ext.data.Store', { fields: ['DC', 'NAME'] }); this.storeTransStatus.add({ "DC": "新建", "NAME": "新建" }); this.storeTransStatus.add({ "DC": "提交审核", "NAME": "提交审核" }); this.storeTransStatus.add({ "DC": "审核通过", "NAME": "审核通过" }); this.storeTransStatus.add({ "DC": "配载", "NAME": "配载" }); this.storeTransStatus.add({ "DC": "完成", "NAME": "完成" }); this.comboxTransStatus = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '订单状态', //'费用类型', store: this.storeTransStatus, valueField: 'DC', displayField: 'NAME', forceSelection: true, name: 'TRANSSTATUS' }); _this = this; this.formSearch = Ext.widget('form', { frame: true, region: 'north', height:80, bodyPadding: 5, fieldDefaults: { margins: '2 2 2 2', labelAlign: 'right', flex: 1, labelWidth: 90, msgTarget: 'qtip' }, items: [{ xtype: 'container', defaultType: 'textfield', layout: 'anchor', defaults: { anchor: '100%' }, items: [{ xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxCustCode, { fieldLabel: '合同号', name: 'CONTRACTNO', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, { fieldLabel: '订单编号', name: 'CUSTNO', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, { fieldLabel: '从接单日期', format: 'Y-m-d', xtype: 'datefield', name: 'BSDATEBgn', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, { fieldLabel: '到接单日期', format: 'Y-m-d', xtype: 'datefield', name: 'BSDATEEnd', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, { xtype: 'button', width: 100, text: "执行查询", iconCls: "btnrefresh", handler: function (button, event) { this.onRefreshClick(button, event); }, scope: this }] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxTransStatus, { fieldLabel: '从起运日期', format: 'Y-m-d', xtype: 'datefield', name: 'ETDBgn', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, { fieldLabel: '到起运日期', format: 'Y-m-d', xtype: 'datefield', name: 'ETDEnd', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, { fieldLabel: '从到货日期', format: 'Y-m-d', xtype: 'datefield', name: 'ETABgn', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, { fieldLabel: '到到货日期', format: 'Y-m-d', xtype: 'datefield', name: 'ETAEnd', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, { text: "重置", width: 50, xtype: 'button', iconCls: "btnreset", handler: function (button, event) { this.onClearSql(button, event); }, scope: this }, { xtype: 'button', width: 50, text: "高级", iconCls: "btnmore", handler: function (button, event) { var sql = this.getCondition(); var winAccess = new Shipping.DsQuery({ }); winAccess.StoreList = this.storeList; winAccess.formname = this.formname; winAccess.condition = sql; winAccess.show(); return; }, scope: this }] }] }] }); this.storeList.on('beforeload', function (store) { // var sql = this.getCondition(); Ext.apply(store.proxy.extraParams, { condition: _this.sqlcontext }); }, this); this.panelList = new Ext.Panel({ layout: "border", region: "center", title: '业务列表', // hidden: true, items: [this.formSearch, this.gridList] }); //#endregion this.tabSeaepanel = new Ext.TabPanel({ activeTab: 0, autoWidth: true, border: true, frame: false, region: 'center', enableTabScroll: true, items: [ // this.panelFee, this.panelList ] }); Ext.apply(this, { items: [this.panelTop, this.tabSeaepanel] }); parentWin = window.parent.opener; this.InitData(); }, //#region 加载事件 InitData: function () { this.opStatus = 'add'; var condition = ''; _this = this; if (parentWin) { var ret = parentWin.OprationSwap(); this.opStatus = ret[0]; this.StoreList = ret[1]; this.EditRecord = ret[2]; } if (this.opStatus == 'edit') { this.BsNo = this.EditRecord.get('BSNO'); this.LoadData(); this.tabSeaepanel.removeAll(); this.tabSeaepanel.add(this.panelFee); this.tabSeaepanel.doLayout(); var condition = " BSNO='" + this.BsNo + "'"; Ext.Ajax.request({ waitMsg:'正在查询...', //'正在查询主表数据...', url: '/MvcShipping/MsChFee/GetAmendData', params: { handle: this.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.formHead.getForm().reset(); this.formHead.getForm().setValues(data); } else { Ext.MessageBox.alert('服务器响应出错!', response.responseText); } }, scope: this }); } else { this.panelList.setVisible(true); this.tabSeaepanel.removeAll(); this.tabSeaepanel.add(this.panelList); // this.tabSeaepanel.setActiveTab(this.panelList); // this.panelFee.setVisible(false); this.tabSeaepanel.doLayout(); } Ext.Ajax.request({ waitMsg:'正在查询。。。', //'正在查询主表数据...', 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; var ACCDATE = this.formHead.getForm().findField('ACCDATE').getValue(); var oDate1 = new Date(ACCDATE + '-01'); var oDate2 = new Date(data.PERIOD + '-01'); if (oDate1.getTime() >= oDate2.getTime()) { this.formHead.getForm().findField('ACCDATE').setMinValue(data.PERIOD); this.formHead.getForm().findField('ACCDATE').setReadOnly(false); } else { if (this.opStatus == 'add') { this.formHead.getForm().findField('ACCDATE').setMinValue(data.PERIOD); this.formHead.getForm().findField('ACCDATE').setReadOnly(false); } else { this.formHead.getForm().findField('ACCDATE').setMinValue(''); this.formHead.getForm().findField('ACCDATE').setReadOnly(true); } } } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: this }); }, //end InitData LoadData: function () { this.formEdit.getForm().loadRecord(this.EditRecord); this.panelFee.EditRecord = this.EditRecord; this.panelFee.strBSNO = this.BsNo; this.panelFee.strPBSNO = this.EditRecord.data.PARENTID; this.panelFee.amendfee = '1'; this.panelFee.StoreDateCurr.load({ params: { optype: "op_truckbulk", bsno: this.BsNo } }); this.panelFee.StoreUnit.load({ params: { bsno: this.BsNo} }); this.panelFee.storeDrChFee.load({ params: { billno: this.BsNo, type: 1, optype: "op_truckbulk" } }); this.panelFee.storeCrChFee.load({ params: { billno: this.BsNo, type: 2, optype: "op_truckbulk" } }); this.panelFee.storeBodySum.load({ params: { bsno: this.BsNo, optype: "op_truckbulk" }, callback: function (r, options, success) { if (success) { _thisfee.setTotalHead(); } } }); this.panelFee.storeChFeeGain.load({ params: { bsno: this.BsNo, optype: "op_truckbulk" } }); }, // end LoadDate Save: function (type) { var basicForm = this.formHead.getForm(); if (!basicForm.isValid()) { return; } var billNo = this.formEdit.getForm().findField('BSNO').getValue(); if (billNo == '*' || billNo == '') { Ext.Msg.show({ title: '错误', msg: '请先查找要生成更改单的业务,并生成更改单!', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); return; } basicForm.findField('GID').setDisabled(false); var data = basicForm.getValues(); basicForm.findField('GID').setDisabled(true); if (this.opStatus == 'add') { data.GID = NewGuid(); } Ext.Msg.wait('正在保存数据,请稍等...'); //'正在保存数据, 请稍侯..' Ext.Ajax.request({ waitMsg: '正在保存数据...', //'正在保存数据...', url: '/MvcShipping/MsChFee/SaveAmendData', scope: this, params: { opstatus: this.opStatus, data: Ext.JSON.encode(data), bsno: billNo }, 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.formHead.getForm().setValues(returnData); Ext.Ajax.request({ waitMsg: '正在查询主表数据...', //'正在查询主表数据...', url: '/TruckMng/MsOpTruckBulk/GetAmendData', params: { handle: this.opStatus, condition: " A.BSNO='" + returnData.BSNO + "'" }, 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.opStatus == 'add') { var arrNewRecords = this.StoreList.insert(0, data); this.EditRecord = this.StoreList.getAt(0); } else { var editp = Ext.create('MsOpTruckBulk', data); this.EditRecord.fields.each(function (field) { if (field.persist) { name = field.name; if (name != 'id') this.EditRecord.set(name, editp.get(name)); } }, this); this.EditRecord.commit(); } this.BsNo = data.BSNO; if (type == '0') { this.opStatus = 'edit'; basicForm.findField('GID').setDisabled(true); this.LoadData(); this.tabSeaepanel.removeAll(); this.tabSeaepanel.add(this.panelFee); this.tabSeaepanel.doLayout(); } else if (type == '1') { window.close(); } else { this.LoadData(); this.tabSeaepanel.removeAll(); this.tabSeaepanel.add(this.panelFee); this.tabSeaepanel.doLayout(); basicForm.findField('GID').setDisabled(false); } } else { Ext.MessageBox.alert('服务器响应出错!', response.responseText); } }, scope: this }); } 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 }); } } }); }, onAddClick: function (button, event) { var basicForm = this.formEdit.getForm(); var billNo = basicForm.findField('BSNO').getValue(); if (billNo != '*' && billNo != '') { Ext.Msg.show({ title: '错误', msg: '已生成,不能重复生成!', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); return; } var selections = this.gridList.getSelectionModel().getSelection(); if (selections.length == 0) { Ext.Msg.show({ title:'提示', msg:'请选择业务', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var record = selections[0]; this.formEdit.getForm().loadRecord(record); var myDate = new Date(); var mydatestr = Ext.util.Format.date(myDate, 'Y-m'); field = this.formHead.getForm().findField('ACCDATE'); field.setValue(mydatestr); }, onRefreshClick: function (button, event) { //var girdcolums = this.gridList.getColumnMode(); var sql = this.getCondition(); this.sqlcontext = sql; this.PageSize = this.Pagenum.getValue(); this.storeList.pageSize = this.PageSize; this.storeList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql }, waitMsg: '正在查询数据。。。', //"正在查询数据...", scope: this }); }, onDsQuery: function () { //var girdcolums = this.gridList.getColumnMode(); var sql = this.sqlcontext; this.PageSize = this.Pagenum.getValue(); this.storeList.pageSize = this.PageSize; this.storeList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql }, waitMsg: '正在查询数据。。。', //"正在查询数据...", scope: this }); }, onClearSql: function () { var form = this.formSearch.getForm(); form.reset(); }, getCondition: function () { var form = this.formSearch.getForm(); // var form2 = this.formSearch2.getForm(); if (!form.isValid()) { Ext.Msg.alert('提示', '查询条件赋值错误,请检查。'); return ''; } //隐藏查询面板 // this.panelSearch.hide(); this.isShowAdvancedQuery = 0; // var sql = '1=1'; var CUSTNO = form.findField('CUSTNO').getValue(); sql = sql + getAndConSql(sql, CUSTNO, "CUSTNO like '%" + CUSTNO + "%'"); var TRANSSTATUS = form.findField('TRANSSTATUS').getValue(); sql = sql + getAndConSql(sql, TRANSSTATUS, "TRANSSTATUS='" + TRANSSTATUS + "'"); var CONTRACTNO = form.findField('CONTRACTNO').getValue(); sql = sql + getAndConSql(sql, CONTRACTNO, "CONTRACTNO like '%" + CONTRACTNO + "%'"); var CUSTOMERNAME = form.findField('CUSTOMERNAME').getValue(); sql = sql + getAndConSql(sql, CUSTOMERNAME, "CUSTOMERNAME='" + CUSTOMERNAME + "'"); var ETDBgn = form.findField('ETDBgn').getRawValue(); sql = sql + getAndConSql(sql, ETDBgn, "CONVERT(char(10), ETD, 20) >='" + ETDBgn + "'"); var ETDEnd = form.findField('ETDEnd').getRawValue(); sql = sql + getAndConSql(sql, ETDEnd, "CONVERT(char(10), ETD, 20) <='" + ETDEnd + "'"); var ETABgn = form.findField('ETABgn').getRawValue(); sql = sql + getAndConSql(sql, ETABgn, "CONVERT(char(10), ETD, 20) >='" + ETABgn + "'"); var ETAEnd = form.findField('ETAEnd').getRawValue(); sql = sql + getAndConSql(sql, ETAEnd, "CONVERT(char(10), ETD, 20) <='" + ETAEnd + "'"); var BSDATEBgn = form.findField('BSDATEBgn').getRawValue(); sql = sql + getAndConSql(sql, BSDATEBgn, "CONVERT(char(10), BSDATE, 20) >='" + BSDATEBgn + "'"); var BSDATEEnd = form.findField('BSDATEEnd').getRawValue(); sql = sql + getAndConSql(sql, BSDATEEnd, "CONVERT(char(10), BSDATE, 20) <='" + BSDATEEnd + "'"); return sql; }, //#region 打印 Print: function () { var basicForm = this.formHead.getForm(); var billNo = basicForm.findField('BSNO').value; if (billNo == '*' || billNo == '') { Ext.Msg.show({ title: '错误', msg: '单据还没有保存,请保存后再打印', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); return; } var printType = 'MSOPSEAE'; var sql1 = "SET LANGUAGE 'us_english' SELECT * FROM op_seae WHERE BSNO = '" + billNo + "'"; var sql2 = ""; var sql3 = ""; var sql4 = ""; var sql5 = ""; var sql6 = ""; PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6); }, //#endregion 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.LoadData(); }, NextRecord: function () { var j = this.StoreList.indexOf(this.EditRecord); if (j == (this.StoreList.data.length - 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.LoadData(); }, getModifyStatus: function () { return this.panelFee.getModifyStatus(); }, feeType: function () { return this.panelFee.feeType; }, StoreFee: function () { return this.panelFee.StoreFee; }, StoreFeeUnit: function () { return this.panelFee.StoreFeeUnit; }, StoreFeeCust: function () { return this.panelFee.StoreFeeCust; } });