Ext.namespace('Shipping'); Shipping.PiliangSeaeFee = function (config) { Ext.applyIf(this, config); this.initUIComponents(); window.Shipping.PiliangSeaeFee.superclass.constructor.call(this); }; Ext.extend(Shipping.PiliangSeaeFee, Ext.Panel, { ParentWin: null, OpStatus: 'add', StoreList: null, EditRecord: null, region: 'north', BsNo: '', feeType:null, StoreFee: null, StoreFeeUnit: null, StoreFeeCust:null, initUIComponents: function () { this.formHead = Ext.widget('form', { frame: true, region: 'center', bodyPadding: 1, fieldDefaults: { margins: '2 2 2 2', labelAlign: 'right', flex: 1, labelWidth: 70, msgTarget: 'qtip' }, items: [ { xtype: 'fieldset', defaultType: 'textfield', layout: 'anchor', defaults: { anchor: '100%' }, items: [ { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '件数', name: 'PKGS', flex: 0, hidden: true, margins: '0' }, { fieldLabel: '重量', name: 'KGS', flex: 0, hidden: true, margins: '0' }, { fieldLabel: '尺码', name: 'CBM', flex: 0, hidden: true, margins: '0' }, { fieldLabel: '委托编号', readOnly: true, name: 'CUSTNO' }, { fieldLabel: '主提单号', readOnly: true, name: 'MBLNO' }, { fieldLabel: '箱型箱量', readOnly: true, name: 'CNTRTOTAL' }, { fieldLabel: '付费方式', readOnly: true, name: 'BLFRT' }, { fieldLabel: 'MBL付费方式', labelWidth: 80, readOnly: true, name: 'MBLFRT' }, { fieldLabel: '船公司', readOnly: true, name: 'CARRIER' }, { fieldLabel: '订舱代理', readOnly: true, name: 'FORWARDER' } ] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: Zi.LAN.INVNO, readOnly: true, name: 'INVNO' },{ fieldLabel: '揽货人', readOnly: true, name: 'SALE' }, { fieldLabel: '委托单位', readOnly: true, name: 'CUSTOMERNAME' }, { fieldLabel: '卸货港', readOnly: true, name: 'PORTDISCHARGE' }, { fieldLabel: '船名', readOnly: true, name: 'VESSEL' }, { fieldLabel: '航次', readOnly: true, name: 'VOYNO' }, { fieldLabel: '尺码', readOnly: true, name: 'CBM' } ] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '分提单号', //'分提单号', readOnly: true, name: 'HBLNO' }, { fieldLabel: '目的地', //'目的地', readOnly: true, name: 'DESTINATION' }, { fieldLabel: Zi.LAN.CUSTOMNO, //'报关单号', name: 'CUSTOMNO' }, { fieldLabel: Zi.LAN.OP, //'报关单号', name: 'OP' }, { fieldLabel: Zi.LAN.LANE, //'报关单号', name: 'LANE' }, { fieldLabel: Zi.LAN.ISSUETYPE, //'报关单号', name: 'ISSUETYPE' }, { fieldLabel:'发货人', //'报关单号', name: 'SHIPPER' } ] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: Zi.LAN.ETD2, //'目的地', readOnly: true, name: 'ETD' }, { fieldLabel: Zi.LAN.PORTLOAD, //'目的地', readOnly: true, name: 'PORTLOAD' },{ fieldLabel: '备注', //'备注', readOnly: true, flex: 4, name: 'REMARK' } ] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ xtype: 'label', text: '服务项目' }, { xtype: 'checkboxfield', fieldLabel: '熏蒸', flex: 1, labelAlign: 'right', readOnly: true, frame: true, name: 'ISFUMIGATION' }, { xtype: 'checkboxfield', fieldLabel: '仓储', flex: 1, labelAlign: 'right', readOnly: true, name: 'ISSTORAGE' }, { xtype: 'checkboxfield', fieldLabel: '陆运', flex: 1, labelAlign: 'right', readOnly: true, name: 'ISLAND' }, { xtype: 'checkboxfield', fieldLabel: '报关', flex: 1, labelAlign: 'right', readOnly: true, name: 'ISCUSTOMES' }, { xtype: 'checkboxfield', fieldLabel: '报检', flex: 1, labelAlign: 'right', readOnly: true, name: 'ISINSPECTION' }, { xtype: 'checkboxfield', fieldLabel: '订舱', flex: 1, labelAlign: 'right', readOnly: true, name: 'ISBOOKING' }, { xtype: 'checkboxfield', fieldLabel: '使用代理', flex: 1, labelAlign: 'right', readOnly: true, name: 'ISAGENT' }, { xtype: 'checkboxfield', fieldLabel: '分单签单', flex: 1, labelAlign: 'right', readOnly: true, name: 'ISHBLNO' } ] } ] }] }); //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 }] }); //end 按钮Toolbar //#endregion //客户加载_委托单位 this.storeCustCode = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListController' } }); // this.storeCustCode.load({ params: { condition: "ISCONTROLLER='1'"} }); // this.storeCustCode.loadData(mainWin.GetPubStore("OPSEAE_CUST_ISCONTROLLER").data.items); //委托单位 _this = this; this.comboxCustCode = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '委托单位', //'委托单位', store: this.storeCustCode, queryMode: 'remote', matchFieldWidth: false, minChars: 1, queryParam: 'CODENAME', name: 'CUSTOMERNAME', valueField: 'CustName', displayField: 'CodeAndName', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } //, //'beforequery': function (e) { // return FilterCombox(e,2);//在beforequery使用此方法 //} , specialkey: function (field, e) { //if (e.getKey() == e.ENTER) { // e.keyCode = 9; //} if (e.keyCode == 9) { if (field.value == null) { _rec = _this.storeCustCode.getAt(0); _this.formSearch.getForm().findField('CUSTOMERNAME').setValue(_rec.data.CustName); } } } } }); this.formSearch = Ext.widget('form', { frame: true, region: 'north', height: 40, bodyPadding: 5, fieldDefaults: { margins: '2 2 2 2', labelAlign: 'right', flex: 1, labelWidth: 90, msgTarget: 'qtip' }, items: [ {//fieldset 1 xtype: 'container', defaultType: 'textfield', layout: 'anchor', defaults: { anchor: '100%' }, items: [{ xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '编号', name: 'MblNo', enableKeyEvents: true, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, this.comboxCustCode, { fieldLabel: '开船日期', format: 'Y-m-d', xtype: 'datefield', name: 'ETDbgn', enableKeyEvents: true, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, { fieldLabel: '至', format: 'Y-m-d', xtype: 'datefield', name: 'ETDend', enableKeyEvents: true, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, { xtype: 'button', width: 90, text: "执行查询", iconCls: "btnrefresh", handler: function (button, event) { this.onRefreshClick(button, event); }, scope: this } ] }] }] }); this.storeList = Ext.create('Ext.data.Store', { pageSize: this.PageSize, model: 'MsOpSeaeModel', remoteSort: true, proxy: { type: 'ajax', url: '/MvcShipping/MsOpSeae/GetDataList', reader: { id: 'GId', root: 'data', totalProperty: 'totalCount' } } }); this.panelTop = new Ext.Panel({ layout: "border", region: "north", collapsed: false, collapsible: true, height: 220, id: "BillHeadSeae", items: [this.panelBtn, this.formSearch, this.formHead] }); this.panelFee = new Shipping.FeeEditGrid({ region: 'center', layout: 'border' }); this.panelFee.stroplb = 'op_Seae'; this.panelFee.StoreCustType.add({ "SCUSTTYPE": "WTDW-委托单位", "CUSTTYPE": "委托单位", "CUSTNAME": "CUSTOMERNAME" }); this.panelFee.StoreCustType.add({ "SCUSTTYPE": "CGS-船公司", "CUSTTYPE": "船公司", "CUSTNAME": "CARRIER" }); this.panelFee.StoreCustType.add({ "SCUSTTYPE": "DCDL-订舱代理", "CUSTTYPE": "订舱代理", "CUSTNAME": "FORWARDER" }); this.panelFee.StoreCustType.add({ "SCUSTTYPE": "BGH-报关行", "CUSTTYPE": "报关行", "CUSTNAME": "CUSTOMSER" }); this.panelFee.StoreCustType.add({ "SCUSTTYPE": "CD-车队", "CUSTTYPE": "车队", "CUSTNAME": "TRUCKER" }); this.panelFee.StoreCustType.add({ "SCUSTTYPE": "FHR-发货人", "CUSTTYPE": "发货人", "CUSTNAME": "SHIPPERID" }); this.panelFee.StoreCustType.add({ "SCUSTTYPE": "SHR-收货人", "CUSTTYPE": "收货人", "CUSTNAME": "CONSIGNEEID" }); this.panelFee.StoreCustType.add({ "SCUSTTYPE": "TZR-通知人", "CUSTTYPE": "通知人", "CUSTNAME": "NOTIFYPARTYID" }); this.panelFee.StoreCustType.add({ "SCUSTTYPE": "DL-代理", "CUSTTYPE": "代理", "CUSTNAME": "AGENTID" }); this.panelFee.StoreCustType.add({ "SCUSTTYPE": "CZ-场站", "CUSTTYPE": "场站", "CUSTNAME": "YARD" }); this.panelFee.StoreCustType.add({ "SCUSTTYPE": "CDD-船代", "CUSTTYPE": "船代", "CUSTNAME": "SHIPAGENCY" }); this.panelFee.StoreCustType.add({ "SCUSTTYPE": "BXGS-保险公司", "CUSTTYPE": "保险公司", "CUSTNAME": "" }); this.panelFee.StoreCustType.add({ "SCUSTTYPE": "QT-其他", "CUSTTYPE": "其他", "CUSTNAME": "" }); this.panelFee.StoreDrOpRange.load({ params: { optype: "modRecvFeeManagement"} }); this.panelFee.StoreCrOpRange.load({ params: { optype: "modPayFeeManagement"} }); this.panelFee.storeFeeNameRef.load({ params: { condition: "ISSEA='1' "} }); Ext.apply(this, { items: [this.panelTop, this.panelFee] }); 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]; } this.BsNo = this.EditRecord.get('BSNO'); this.LoadData(); }, //end InitData LoadData: function () { this.formHead.getForm().loadRecord(this.EditRecord); this.panelFee.EditRecord = this.EditRecord; this.panelFee.strBSNO = this.BsNo; this.panelFee.strPBSNO = this.BsNo; this.panelFee.strMBLNO = this.EditRecord.get('MBLNO'); this.panelFee.StoreDateCurr.load({ params: { optype: "op_Seae", bsno: this.BsNo} }); this.panelFee.StoreUnit.load({ params: { bsno: this.BsNo, bstype: "op_Seae"} }); this.panelFee.storeDrChFee.load({ params: { billno: this.BsNo, type: 1, optype: "op_Seae"} }); this.panelFee.storeCrChFee.load({ params: { billno: this.BsNo, type: 2, optype: "op_Seae"} }); this.panelFee.storeBodyList_GuDingFeeWeiHu.load({ params: { condition: "CUSTOMERNAME='" + this.EditRecord.get('CUSTOMERNAME') + "'" } }); this.panelFee.storeBodySum.load({ params: { bsno: this.BsNo, optype: "op_Seae" }, callback: function (r, options, success) { if (success) { _thisfee.setTotalHead(); } } }); this.panelFee.storeChFeeGain.load({ params: { bsno: this.BsNo, optype: "op_Seae"} }); }, // end LoadDate //#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 onRefreshClick: function (button, event) { var sql = this.getCondition(); this.storeList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql }, callback: function (r, options, success) { if (success) { if (this.storeList.getCount() > 0) { this.EditRecord = this.storeList.getAt(0); this.BsNo = this.EditRecord.get('BSNO'); this.LoadData(); } else { } } }, waitMsg: "正在查询数据...", scope: this }); }, getCondition: function () { var form = this.formSearch.getForm(); if (!form.isValid()) { Ext.Msg.alert('提示', '查询条件赋值错误,请检查。'); return ''; } var sql = ''; //#region formSearch 查询面板 //编号包括(主提单号) var MblNo = form.findField('MblNo').getValue(); sql = sql + getAndConSql(sql, MblNo, "(B.MblNo like '%" + MblNo + "%' or B.CONTRACTNO like '%" + MblNo + "%' or B.CUSTNO like '%" + MblNo + "%' or B.HBLNO like '%" + MblNo + "%' or B.ORDERNO like '%" + MblNo + "%')"); //客户名称 var CUSTOMERNAME = form.findField('CUSTOMERNAME').getValue(); sql = sql + getAndConSql(sql, CUSTOMERNAME, "B.CUSTOMERNAME='" + CUSTOMERNAME + "'"); //到港日期 var ETDbgn = form.findField('ETDbgn').getRawValue(); sql = sql + getAndConSql(sql, ETDbgn, "B.ETD >='" + ETDbgn + "'"); var ETDend = form.findField('ETDend').getRawValue(); sql = sql + getAndConSql(sql, ETDend, "B.ETD <='" + ETDend + "'"); return sql; }, 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; } });