//集运管理-路单查询 Ext.namespace('Shipping'); Shipping.MsChfeeyj = function (config) { Ext.applyIf(this, config); this.initUIComponents(); window.Shipping.MsChfeeyj.superclass.constructor.call(this); }; Ext.extend(Shipping.MsChfeeyj, Ext.Panel, { PageSize: 100, OprationStatus: null, //仅当弹出界面时使用 SelectedRecord: null, sqlcontext: '1=1', AccDate: null, IsAccDate: '', sortfield: '', sortdire: '', ISRATE: true, tbRATE: 0, VOUDATE: null, PREPARED: '', initUIComponents: function () { this.formname = 'frmMsChfeeyj'; this.MsPeriod = null; Ext.Ajax.timeout = 12000000; this.sqlcontext = '1=1'; this.editcolumnindex = 0; this.yjinput = 0; this.yjmng = 0; this.yjsale = 0; //定义数据集 this.storeList = Ext.create('Ext.data.Store', { pageSize: this.PageSize, fields: [ { name: 'BSNO', type: 'string' }, { name: 'OPLB', type: 'string' }, { name: 'OPTYPE', type: 'string' }, { name: 'FEESTATUSREF', type: 'string' }, { name: 'OPLBNAME', type: 'string' }, { name: 'STLNAME', type: 'string' }, { name: 'BSTYPE', type: 'string' }, { name: 'CUSTOMERNAME', type: 'string' }, { name: 'ACCDATE', type: 'string' }, { name: 'CUSTNO', type: 'string' }, { name: 'MBLNO', type: 'string' }, { name: 'VESSEL', type: 'string' }, { name: 'VOYNO', type: 'string' }, { name: 'LANE', type: 'string' }, { name: 'ETD', type: 'string' }, { name: 'BSSOURCE', type: 'string' }, { name: 'BSSOURCEDETAIL', type: 'string' }, { name: 'CNTRTOTAL', type: 'string' }, { name: 'SALE', type: 'string' }, { name: 'OP', type: 'string' }, { name: 'PORTDISCHARGE', type: 'string' }, { name: 'DESTINATION', type: 'string' }, { name: 'ACCDATE', type: 'string' }, { name: 'CARRIER', type: 'string' }, { name: 'BLFRT', type: 'string' }, { name: 'REMARK', type: 'string' }, { name: 'REMARK2', type: 'string' }, { name: 'YJSTATUS', type: 'string' }, { name: 'YJREMARK', type: 'string' }, { name: 'INPUTDATE', type: 'string' }, { name: 'INPUTBY', type: 'string' }, { name: 'FCOP', type: 'string' }, { name: 'AUDITDATE', type: 'string' }, { name: 'AUDITBY', type: 'string' }, { name: 'ORDERAMOUNT', type: 'number' }, { name: 'CUSTNAME', type: 'string' }, { name: 'AMOUNT', type: 'number' }, { name: 'CURRENCY', type: 'string' }, { name: 'CUSTOMERNAME2', type: 'string' }, { name: 'AMOUNT2', type: 'number' }, { name: 'USDDR', type: 'number' }, { name: 'USDCR', type: 'number' }, { name: 'USDPROFIT', type: 'number' }, { name: 'AUSDPROFIT', type: 'number' }, { name: 'BillFeeStatus', type: 'string' } ], remoteSort: true, proxy: { type: 'ajax', url: '/Account/Chfee_lock/BsYjListData', reader: { id: '', root: 'data', totalProperty: 'totalCount' } } }); //定义Grid Ext.define('MsFeeCurr', { extend: 'Ext.data.Model', idProperty: 'CURR', fields: [ { name: 'CURR', type: 'string' }, { name: 'DEFRATE', type: 'number' }, { name: 'CRDEFRATE', type: 'number' } ] }); 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(); } } } }); me = this; this.storeCustomerNameRef = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListRm' } }); this.storeCustomerNameRefDr = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListRm' } }); this.comboxCustomerNameRef = Ext.create('DsExt.ux.RefTableCombox', { store: this.storeCustomerNameRef, forceSelection: true, queryMode: 'remote', minChars: 1, queryParam: 'CODENAME', lazyRender: false, name: 'CUSTNAME', valueField: 'CustName', displayField: 'CodeAndName', listeners: { scope: this, 'focus': function (_this, eOpts) { var selections = this.gridList.getSelectionModel().getSelection(); //获得选中的项 var strCustomerName = selections[0].get('CUSTNAME'); var recordCustCode = Ext.create('DsShipping.ux.CustomRefModel', { GId: NewGuid(), CustCode: strCustomerName, CustName: strCustomerName, CodeAndName: strCustomerName, DESCRIPTION: strCustomerName }); me.storeCustomerNameRef.add(recordCustCode); } } }); this.comboxCustomerNameRef2 = Ext.create('DsExt.ux.RefTableCombox', { store: this.storeCustomerNameRefDr, forceSelection: true, queryMode: 'remote', minChars: 1, lazyRender: false, queryParam: 'CODENAME', name: 'CUSTOMERNAME2', valueField: 'CustName', displayField: 'CodeAndName', listeners: { scope: this, 'focus': function (_this, eOpts) { var selections = this.gridList.getSelectionModel().getSelection(); //获得选中的项 var strCustomerName = selections[0].get('CUSTOMERNAME2'); var recordCustCode = Ext.create('DsShipping.ux.CustomRefModel', { GId: NewGuid(), CustCode: strCustomerName, CustName: strCustomerName, CodeAndName: strCustomerName, DESCRIPTION: strCustomerName }); me.storeCustomerNameRefDr.add(recordCustCode); } } }); this.StoreCurr = Ext.create('DsExt.ux.RefTableStore', { model: 'MsFeeCurr', proxy: { url: '/MvcShipping/MsChFee/GetFeeCurrList' } }); this.StoreCurr.load({ params: { condition: "" } }); this.comboxCurr = Ext.create('DsExt.ux.RefTableCombox', { store: this.StoreCurr, forceSelection: true, name: 'CURRENCY', valueField: 'CURR', displayField: 'CURR' }); this.storeOpCode = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.UserRefModel', proxy: { url: '/CommMng/BasicDataRef/GetUserLinkRefListRm' } }); this.comboxFCOP = Ext.create('DsExt.ux.RefTableCombox', { store: this.storeOpCode, forceSelection: true, queryMode: 'remote', minChars: 0, queryParam: 'CODENAME', name: 'FCOP', valueField: 'UserName', displayField: 'CodeAndName' }); this.initgirdcolums = [{ sortable: true, dataIndex: 'BSNO', header: '编号', hidden: true, width: 130 }, { sortable: true, dataIndex: 'ACCDATE', header: '会计期间', width: 86 }, { sortable: true, dataIndex: 'OPDATE', header: '业务日期', width: 86 }, { 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 if (value == '4') { meta.tdCls = 'feestatus_nopass'; return "整票驳回"; } else { return ""; } } }, { sortable: true, id: '', align: 'center', dataIndex: 'FEESTATUSREF', header: '费用锁定', width: 60, renderer: function (value, cellmeta) { if (value == '已锁定' || value == '锁定') { return ""; } } }, { sortable: true, dataIndex: 'CUSTOMERNAME', header: '委托单位', width: 120 }, { sortable: true, dataIndex: 'BLTYPE', header: '装运方式', width: 70 }, { sortable: true, dataIndex: 'STLNAME', header: '结算方式', width: 86 }, { sortable: true, dataIndex: 'VESSEL', header: '船名', width: 136 }, { sortable: true, dataIndex: 'VOYNO', header: '航次', width: 136 }, { sortable: true, dataIndex: 'LANE', header: '航线', width: 136 }, { sortable: true, dataIndex: 'CARRIER', header: '船公司', width: 136 }, { sortable: true, dataIndex: 'BLFRT', header: '付费方式', width: 136 }, { sortable: true, dataIndex: 'CNTRTOTAL', header: '集装箱', width: 136 }, { sortable: true, dataIndex: 'BSSOURCE', header: '业务来源', width: 100 }, { sortable: true, dataIndex: 'BSSOURCEDETAIL', header: '来源明细', width: 100 }, { sortable: true, dataIndex: 'MBLNO', header: '主提单号', width: 120 }, { sortable: true, dataIndex: 'ETD', header: '开船日期', width: 86 }, { sortable: true, dataIndex: 'SALE', header: '揽货人', width: 80 }, { sortable: true, dataIndex: 'PORTDISCHARGE', header: '卸货港', width: 150 }, { sortable: true, dataIndex: 'DESTINATION', header: '目的港', width: 150 }, { sortable: true, dataIndex: 'REMARK2', header: '委托其他备注', width: 150 }, { sortable: true, dataIndex: 'REMARK', header: '佣金说明', editor: { xtype: 'textfield', selectOnFocus: true, enableKeyEvents: true, listeners: { keydown: function (textfield, e) { if (e.getKey() == 40) { me.onNextKeyClick(1, 17) } else if (e.getKey() == 38) { me.onUpKeyClick(1, 17) } } } }, width: 80 }, { sortable: true, dataIndex: 'YJSTATUS', header: '佣金状态', width: 80 }, { sortable: true, dataIndex: 'YJREMARK', header:'最低收货价', //'备注', editor: { xtype: 'textfield', selectOnFocus: true, enableKeyEvents: true, listeners: { keydown: function (textfield, e) { if (e.getKey() == 40) { me.onNextKeyClick(1, 17) } else if (e.getKey() == 38) { me.onUpKeyClick(1, 17) } } } }, width: 150 }, { sortable: true, dataIndex: 'USDDR', header: 'USD应收', renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; }, align: 'right', width: 80 }, { sortable: true, dataIndex: 'USDCR', header: 'USD应付', renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; }, align: 'right', width: 80 }, { sortable: true, dataIndex: 'USDPROFIT', header: 'USD利润', renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; }, align: 'right', width: 80 }, { sortable: true, dataIndex: 'ORDERAMOUNT', header: '包干USD', //'金额', editor: { xtype: 'numberfield', keyNavEnabled: false, selectOnFocus: true, hideTrigger: true, mouseWheelEnabled: false, enableKeyEvents: true, listeners: { keydown: function (textfield, e) { if (e.getKey() == 40) { me.onNextKeyClick(1, 13) } else if (e.getKey() == 38) { me.onUpKeyClick(1, 13) } } } }, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; }, align: 'right', width: 80 }, { sortable: true, dataIndex: 'AMOUNT', header:'审批金额', //'金额', editor: { xtype: 'numberfield', keyNavEnabled: false, selectOnFocus: true, hideTrigger: true, mouseWheelEnabled: false, enableKeyEvents: true, listeners: { keydown: function (textfield, e) { if (e.getKey() == 40) { me.onNextKeyClick(1, 13) } else if (e.getKey() == 38) { me.onUpKeyClick(1, 13) } } } }, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; }, align: 'right', width: 80 }, { sortable: true, dataIndex: 'AUSDPROFIT', header: '分配后USD利润', renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; }, align: 'right', width: 80 }, { sortable: true, dataIndex: 'AMOUNT2', header: '包干USD2', //'金额', editor: { xtype: 'numberfield', keyNavEnabled: false, selectOnFocus: true, hideTrigger: true, mouseWheelEnabled: false, enableKeyEvents: true, listeners: { keydown: function (textfield, e) { if (e.getKey() == 40) { me.onNextKeyClick(1, 13) } else if (e.getKey() == 38) { me.onUpKeyClick(1, 13) } } } }, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; }, align: 'right', width: 80 }, { sortable: true, dataIndex: 'CURRENCY', header: '币别', //'币别', editor: this.comboxCurr, width: 40 }, { sortable: true, dataIndex: 'CUSTNAME', header: '结算对象', //'结算对象', editor: this.comboxCustomerNameRef, width: 110 }, { sortable: true, dataIndex: 'FCOP', header: '航线', //'单位标准', editor: this.comboxFCOP, width: 70 }, { sortable: true, dataIndex: 'INPUTBY', header: '录入人', width: 80 }, { sortable: true, dataIndex: 'INPUTDATE', header: '录入时间', width: 80 }, { sortable: true, dataIndex: 'AUDITBY', header: '审核人', width: 80 }, { sortable: true, dataIndex: 'AUDITDATE', header: '审核时间', width: 80 } ]; this.girdcolums = this.initgirdcolums; this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel'); this.cellEditingDrChFee = Ext.create('Ext.grid.plugin.CellEditing', { clicksToEdit: 1 }); this.gridList = new Ext.grid.GridPanel({ store: this.storeList, enableHdMenu: false, region: 'center', loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, plugins: [this.cellEditingDrChFee], selModel: this.GridCheckBoxModel, tbar: [{ text: '保存', tooltip:'保存', //保存应收费用', iconCls: "btnsave", hidden: true, id: 'btnSave', handler: function (button, event) { this.onPostDetailClick(); // this.onPostDetailClick(button, event, 2); }, scope: this }, '-', { text: '提交航线', tooltip: '提交航线', //保存应收费用', id: 'btnSubmitSale', hidden:true, handler: function (button, event) { this.onSubmitSaleClick('提交航线'); // this.onPostDetailClick(button, event, 2); }, scope: this }, '-', { text: '提交审核', tooltip: '提交审核', //保存应收费用', id: 'btnSubmitAudit', hidden: true, handler: function (button, event) { this.onSubmitSaleClick('提交审核'); // this.onPostDetailClick(button, event, 2); }, scope: this }, '-', { text: '撤销提交', tooltip: '撤销提交审核', //保存应收费用', id: 'btnCancelSubmit', hidden: true, handler: function (button, event) { this.onSubmitSaleClick('撤销提交'); // this.onPostDetailClick(button, event, 2); }, scope: this }, '-', { text: '审核通过', tooltip: '审核通过', //保存应收费用', id: 'btnSubmitAuditBL', hidden: true, handler: function (button, event) { this.onSubmitAuditBLClick(); // this.onPostDetailClick(button, event, 2); }, scope: this }], columns: this.girdcolums, plugins: [this.cellEditingDrChFee], viewConfig: { enableTextSelection: true }, // paging bar on the bottom bbar: [Ext.create('Ext.PagingToolbar', { store: this.storeList, displayInfo: true, displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录', emptyMsg: "没有数据" }), this.Pagenum] }); this.gridList.on('edit', function (editor, e, eOpts) { this.gridListChFeeAfterEdit(editor, e, eOpts); }, this); this.cellEditingDrChFee.on('beforeedit', function (editor, e) { return this.cellEditingChFeeBeforeEdit(editor, e); }, this); this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) { this.SelectedRecord = record; var openSet = "height=700, width=1024, toolbar=no, menubar=no,scrollbars=1, resizable=1,location=no, status=no,Top= " + (screen.height - 750) / 2 + ",Left= " + (screen.width - 1100) / 2 var openType = "_blank"; var openUrl = "/Account/Chfee_lock/Chfee_lockDetail"; window.open(openUrl, openType, openSet); }, this); 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(); this.gridList.addListener('sortchange', function (ct, column, direction, eOpts) { this.sortfield = column.dataIndex; this.sortdire = direction; }, this); //#region formSearch //#region formSearch枚举参照相关 this.StoreOpLb = Ext.create('DsExt.ux.RefEnumStore', {}); this.StoreOpLb.load({ params: { enumTypeId: 96005} }); this.comboxOpLb = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '业务类型', store: this.StoreOpLb, forceSelection: true, name: 'PS_OPLB', valueField: 'EnumValueName', displayField: 'EnumValueName', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }); this.storeBsType = Ext.create('DsExt.ux.RefEnumStore', {}); this.storeBsType.load({ params: { enumTypeId: 96004} }); this.comboxBsType = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '运输类型', store: this.storeBsType, name: 'PS_BSTYPE', valueField: 'EnumValueName', displayField: 'EnumValueName', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }); this.storeSalesCode = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.UserRefModel', proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' } }); this.storeSalesCode.load(); this.comboxSalesCode = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '揽货人', store: this.storeSalesCode, forceSelection: true, name: 'PS_SALE', valueField: 'UserName', displayField: 'CodeAndName', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }); 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: 'PS_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/GetCustomRefList' } }); this.storeCustCode.load({ params: { condition: "ISCONTROLLER='1'"} }); this.comboxCustCode = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '委托单位', store: this.storeCustCode, forceSelection: true, name: 'PS_CUSTOMERNAME', valueField: 'CustName', displayField: 'CodeAndName', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }); this.storeEnterpCode = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomerRefModel', proxy: { url: '/MvcShipping/MsBaseInfo/GetCustomerRefList' } }); this.storeEnterpCode.load({ params: { condition: "ISENTERP='1'"} }); this.comboxEnterp = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '经营单位', store: this.storeEnterpCode, forceSelection: true, name: 'PS_ENTERP', valueField: 'DESCRIPTION', displayField: 'CodeAndName', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }); this.StoreOpLock = Ext.create('Ext.data.Store', { fields: ['OpLb'] }); this.StoreOpLock.add({ "OpLb": "全部" }); this.StoreOpLock.add({ "OpLb": "已锁定" }); this.StoreOpLock.add({ "OpLb": "未锁定" }); this.comboxOpLock = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '业务锁定', store: this.StoreOpLock, forceSelection: true, //labelWidth: 60, //flex: 0.5, name: 'PS_OPLOCK', valueField: 'OpLb', displayField: 'OpLb', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }); this.StoreFeeLock = Ext.create('Ext.data.Store', { fields: ['OpLb'] }); this.StoreFeeLock.add({ "OpLb": "全部" }); this.StoreFeeLock.add({ "OpLb": "已锁定" }); this.StoreFeeLock.add({ "OpLb": "未锁定" }); this.comboxFeeLock = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '费用锁定', store: this.StoreFeeLock, forceSelection: true, //flex: 0.5, //labelWidth: 60, name: 'PS_FEELOCK', valueField: 'OpLb', displayField: 'OpLb', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }); this.StoreIsVou = Ext.create('Ext.data.Store', { fields: ['OpLb'] }); this.StoreIsVou.add({ "OpLb": "全部" }); this.StoreIsVou.add({ "OpLb": "已生成" }); this.StoreIsVou.add({ "OpLb": "未生成" }); this.comboxIsVou = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '生成凭证', store: this.StoreIsVou, forceSelection: true, // flex: 0.5, //labelWidth: 60, name: 'PS_ISVOU', valueField: 'OpLb', displayField: 'OpLb', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }); this.storeFEEUP = Ext.create('Ext.data.Store', { fields: ['FSTATUS', 'NAME'] }); this.storeFEEUP.add({ "FSTATUS": "", "NAME": "" }); this.storeFEEUP.add({ "FSTATUS": "0", "NAME": "否" }); this.storeFEEUP.add({ "FSTATUS": "1", "NAME": "是" }); this.comboxFEEUP = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '费用提交', store: this.storeFEEUP, valueField: 'FSTATUS', displayField: 'NAME', //flex: 0.5, //labelWidth: 60, forceSelection: true, name: 'ISFEEUP', value: '', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }); this.storeFSTATUS = Ext.create('Ext.data.Store', { fields: ['FSTATUS', 'NAME'] }); this.storeFSTATUS.add({ "FSTATUS": "0", "NAME": "全部" }); this.storeFSTATUS.add({ "FSTATUS": "1", "NAME": "仅已审核" }); this.storeFSTATUS.add({ "FSTATUS": "2", "NAME": "仅未审核" }); this.comboxFSTATUS = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '费用审核', store: this.storeFSTATUS, valueField: 'FSTATUS', displayField: 'NAME', //labelWidth: 60, //flex: 0.5, forceSelection: true, name: 'FSTATUS', value: '0', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }); this.storeOPTYPE = Ext.create('Ext.data.Store', { fields: ['FSTATUS', 'NAME'] }); this.storeOPTYPE.add({ "FSTATUS": "", "NAME": "" }); this.storeOPTYPE.add({ "FSTATUS": "普通货", "NAME": "普通货" }); this.storeOPTYPE.add({ "FSTATUS": "更改单", "NAME": "更改单" }); this.storeOPTYPE.add({ "FSTATUS": "普通货有更改单", "NAME": "普通货有更改单" }); this.comboxOPTYPE = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '更改单', store: this.storeOPTYPE, valueField: 'FSTATUS', displayField: 'NAME', //flex: 0.5, //labelWidth: 60, forceSelection: true, name: 'OPTYPE', value: '', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }); this.storeYJSTATUS = Ext.create('Ext.data.Store', { fields: ['FSTATUS', 'NAME'] }); this.storeYJSTATUS.add({ "FSTATUS": "", "NAME": "" }); this.storeYJSTATUS.add({ "FSTATUS": "提交航线", "NAME": "提交航线" }); this.storeYJSTATUS.add({ "FSTATUS": "提交审核", "NAME": "提交审核" }); this.storeYJSTATUS.add({ "FSTATUS": "审核通过", "NAME": "审核通过" }); this.comboxYJSTATUS= Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '审批状态', store: this.storeYJSTATUS, valueField: 'FSTATUS', displayField: 'NAME', //flex: 0.5, //labelWidth: 60, forceSelection: true, name: 'YJSTATUS', value: '', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }); this.storeBillFeeStatus = Ext.create('Ext.data.Store', { fields: ['FSTATUS', 'NAME'] }); this.storeBillFeeStatus.add({ "FSTATUS": "", "NAME": "全部" }); this.storeBillFeeStatus.add({ "FSTATUS": "0", "NAME": "未提交" }); this.storeBillFeeStatus.add({ "FSTATUS": "1", "NAME": "整票提交" }); this.storeBillFeeStatus.add({ "FSTATUS": "2", "NAME": "审核通过" }); this.storeBillFeeStatus.add({ "FSTATUS": "4", "NAME": "整票驳回" }); this.comboxBillFeeStatus = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '整票状态', //是否开垫付 store: this.storeBillFeeStatus, valueField: 'FSTATUS', displayField: 'NAME', forceSelection: true, name: 'BillFeeStatus', value: '', // flex: 0.7, enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }); //#endregion this.CheckSaveQuery = new Ext.form.Checkbox({ fieldLabel: '记忆查询条件', checked: true, width: 20 }); this.formSearch = Ext.widget('form', { frame: true, region: 'center', bodyPadding: 5, 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: [this.comboxYJSTATUS, { fieldLabel: '编号', name: 'PS_MBLNO', enableKeyEvents: true, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, { fieldLabel: '船名', name: 'PS_VESSEL', enableKeyEvents: true, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, { fieldLabel: '航次', name: 'PS_VOYNO', enableKeyEvents: true, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } } // , { // fieldLabel: '品名', // name: 'PS_GOODSNAME', // enableKeyEvents: true, // listeners: { // specialkey: function (field, e) { // if (e.getKey() == e.ENTER) { // _this.onRefreshClick(); // } // } // } // }, , this.comboxOp, this.comboxFEEUP, this.comboxFSTATUS ] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxBsType, this.comboxSalesCode, this.comboxCustCode, { fieldLabel: '从业务日期', format: 'Y-m-d', xtype: 'datefield', name: 'PS_EXPDATEBGN', enableKeyEvents: true, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, { fieldLabel: '到业务日期', format: 'Y-m-d', xtype: 'datefield', name: 'PS_EXPDATEEND', enableKeyEvents: true, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, this.comboxOpLock, this.comboxFeeLock ] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '从ETD', format: 'Y-m-d', xtype: 'datefield', name: 'PS_ETDDATEBGN', enableKeyEvents: true, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, { fieldLabel: '到ETD', format: 'Y-m-d', xtype: 'datefield', name: 'PS_ETDDATEEND', enableKeyEvents: true, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, { fieldLabel: '从会计期间', xtype: 'monthfield', name: 'PS_ACCDATEBGN', enableKeyEvents: true, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, { fieldLabel: '从会计期间', xtype: 'monthfield', name: 'PS_ACCDATEEND', enableKeyEvents: true, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, this.comboxIsVou, this.comboxOPTYPE, this.comboxBillFeeStatus ] } ]//end items(fieldset 1) }//end fieldset 1 ]//end root items }); //#endregion formSearch //查询工具条 _this = this; this.SearchBtn = new Ext.Button({ text: '隐藏查询', handler: function () { if (_this.SearchBtn.text == '隐藏查询') { _this.panelSearch.hide(); _this.SearchBtn.setText("显示查询"); } else { _this.panelSearch.show(); _this.SearchBtn.setText("隐藏查询"); } } }); this.panelBtn = new Ext.Panel({ region: "north", tbar: [ { text: "执行查询", iconCls: "btnrefresh", handler: function (button, event) { var isvisible = true; var issavevalue = false; if (_this.SearchBtn.text == '隐藏查询') isvisible = true else isvisible = false; if (this.CheckSaveQuery.checked) issavevalue = true saveQuerySetting(this.formname, this.formSearch, isvisible, issavevalue); this.onRefreshClick(button, event); }, scope: this }, '-', { xtype: 'button', 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 }, '-', { text: "打印", iconCls: 'btnprint', menu: [ { text: "全部", handler: function (menu, event) { _this.Print(); } }, { text: "选择打印", handler: function (menu, event) { _this.PrintSelect(); } }, { text: "核算单打印", handler: function (menu, event) { _this.onPrintGainClick(); } }], scope: this }, '-', { text: "导出Excel", id: "btnExportExcel", iconCls: 'btnexportexcel', handler: function (button, event) { this.onExportClick(button, event); }, scope: this }, '-', this.SearchBtn, { xtype: 'button', width: 90, text: "清空条件", iconCls: "btnreset", handler: function (button, event) { this.onClearSql(button, event); }, scope: this }, '-', { text: "保存列表样式", id: "btntest", menu: [ { text: "保存", handler: function (button, event) { this.girdcolums = DsTruck.SaveGridPanel(USERID, _this.formname, _this.gridList.columns, _this.girdcolums, 1, true); } }, { text: "初始化", handler: function (menu, event) { _this.InitGrid(_this.initgirdcolums); _this.girdcolums = DsTruck.SaveGridPanel(USERID, _this.formname, _this.gridList.columns, _this.initgirdcolums, 1, true); } }], scope: this }, '-', this.CheckSaveQuery ] }); this.panelTop = new Ext.Panel({ layout: "border", region: "north", height: 29, items: [this.panelBtn] }); this.panelSearch = new Ext.Panel({ layout: "border", region: "north", height: 96, items: [this.formSearch] }); this.panelBodyChFee = new Ext.Panel({ title: '业务明细', layout: "border", region: 'center', margin: '0 0', frame: true, items: [this.gridList] }); this.tabpanel = new Ext.TabPanel ({ activeTab: 0, autoWidth: true, border: false, frame: false, region: 'center', id: "TabPanelID", enableTabScroll: true, items: [ this.panelBodyChFee ] }); Ext.apply(this, { items: [this.panelTop, this.panelSearch, this.tabpanel] }); this.storeList.on('beforeload', function (store) { var sql = this.sqlcontext; Ext.apply(store.proxy.extraParams, { condition: sql, type: locktype, printstr: 'false' }); }, this); this.GetBtnStatus(); this.gridList.reconfigure(this.storeList, this.girdcolums); this.LoadPeriod(); LoadQueryData(this.formname, this.formSearch, this.CheckSaveQuery); Ext.Ajax.request({ waitMsg: '', url: '/MvcShipping/MsBaseInfo/GetUserModuleEnable', params: { modulename: "modyjinput" }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (result.Success != true) { this.yjinput = 0; } else { this.yjinput = 1; var btnSave = Ext.getCmp('btnSave'); btnSave.setVisible(true); var btnSubmitSale = Ext.getCmp('btnSubmitSale'); btnSubmitSale.setVisible(true); var btnCancelSubmit = Ext.getCmp('btnCancelSubmit'); btnCancelSubmit.setVisible(true); var btnSubmitAudit = Ext.getCmp('btnSubmitAudit'); btnSubmitAudit.setVisible(true); } } else { } }, scope: this }); Ext.Ajax.request({ waitMsg: '', url: '/MvcShipping/MsBaseInfo/GetUserModuleEnable', params: { modulename: "modyjsale" }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (result.Success != true) { this.yjsale = 0; } else { this.yjsale = 1; var btnSave = Ext.getCmp('btnSave'); btnSave.setVisible(true); var btnCancelSubmit = Ext.getCmp('btnCancelSubmit'); btnCancelSubmit.setVisible(true); var btnSubmitAudit = Ext.getCmp('btnSubmitAudit'); btnSubmitAudit.setVisible(true); } } else { } }, scope: this }); Ext.Ajax.request({ waitMsg: '', url: '/MvcShipping/MsBaseInfo/GetUserModuleEnable', params: { modulename: "modyjmng" }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (result.Success != true) { this.yjmng = 0; } else { this.yjmng = 1; var btnSubmitAuditBL = Ext.getCmp('btnSubmitAuditBL'); btnSubmitAuditBL.setVisible(true); } } else { } }, scope: this }); }, //end initUIComponents onPostDetailClick: function () { var GidStr = ''; var records = this.GridCheckBoxModel.selected.items; if (records.length == 0) { Ext.Msg.show({ title: '提示', msg: '请先选择业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var bodyAddDatas = []; for (var i = 0; i < records.length; i++) { var rec = records[i]; if (rec.data.YJSTATUS != '提交审核' && rec.data.YJSTATUS != '审核通过') { bodyAddDatas.push(rec); } } _this = this; if (bodyAddDatas.length == 0) { Ext.Msg.show({ title: '提示', msg: '没有选择要保存的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } else { Ext.Msg.wait('正在保存数据...'); var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas); Ext.Ajax.request({ waitMsg: '正在锁定...', url: '/Account/Chfee_lock/SaveYj', params: { data: jsonbodyAddDatas }, 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 { Ext.Msg.show({ title: '提示', msg: result.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); _this.onRefreshClick(); } } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: this }); } }, onSubmitSaleClick: function (type) { var GidStr = ''; var records = this.GridCheckBoxModel.selected.items; if (records.length == 0) { Ext.Msg.show({ title: '提示', msg: '请先选择业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var optype = type; if (type == '撤销提交') { if (this.yjsale ==1) optype = '提交航线'; else optype = '录入状态'; } var bodyAddDatas = []; for (var i = 0; i < records.length; i++) { var rec = records[i]; if (rec.data.FCOP == '' && type == '提交航线') { Ext.Msg.show({ title: '提示', msg: '航线为必填!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } else { if (type == '提交审核' && (rec.data.ORDERAMOUNT == 0 || rec.data.CURRENCY == '' || rec.data.CUSTNAME == '')) { Ext.Msg.show({ title: '提示', msg: '提交审核,包干费、币别、结算客户不能为空!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } else { if ((rec.data.YJSTATUS != '提交审核' && rec.data.YJSTATUS != '审核通过') || type == '撤销提交') { rec.data.YJSTATUS = optype; bodyAddDatas.push(rec); } } } } _this = this; if (bodyAddDatas.length == 0) { Ext.Msg.show({ title: '提示', msg: '没有选择要保存的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } else { Ext.Msg.wait('正在保存数据...'); var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas); Ext.Ajax.request({ waitMsg: '正在锁定...', url: '/Account/Chfee_lock/SaveYj', params: { data: jsonbodyAddDatas }, 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 { Ext.Msg.show({ title: '提示', msg: result.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); _this.onRefreshClick(); } } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: this }); } }, onSubmitAuditBLClick: function () { var GidStr = ''; var records = this.GridCheckBoxModel.selected.items; if (records.length == 0) { Ext.Msg.show({ title: '提示', msg: '请先选择业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var bodyAddDatas = []; for (var i = 0; i < records.length; i++) { var rec = records[i]; if (rec.data.YJSTATUS == '提交审核' || rec.data.YJSTATUS == '提交航线') { rec.data.YJSTATUS ='审核通过'; bodyAddDatas.push(rec); } } _this = this; if (bodyAddDatas.length == 0) { Ext.Msg.show({ title: '提示', msg: '没有选择要保存的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } else { Ext.Msg.wait('正在保存数据...'); var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas); Ext.Ajax.request({ waitMsg: '正在锁定...', url: '/Account/Chfee_lock/AuditYj', params: { data: jsonbodyAddDatas }, 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 { Ext.Msg.show({ title: '提示', msg: result.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); _this.onRefreshClick(); } } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: this }); } }, LoadPeriod: function () { 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; } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: this }); }, onNextKeyClick: function (type, col) { var rows = this.gridList.getSelectionModel().getSelection(); var row = rows[rows.length - 1]; var s = this.gridList.getStore(); var number = s.indexOf(row) + 1; if (number == this.gridList.getStore().getCount()) { } else { this.cellEditingDrChFee.startEditByPosition({ row: number, column: this.editcolumnindex }); } }, onUpKeyClick: function (type, col) { var rows = this.gridList.getSelectionModel().getSelection(); var row = rows[rows.length - 1]; var s = this.gridList.getStore(); var number = s.indexOf(row) - 1; if (number < 0) number = 0; this.cellEditingDrChFee.startEditByPosition({ row: number, column: this.editcolumnindex }); }, cellEditingChFeeBeforeEdit: function (editor, e) { var YJSTATUS = e.record.get('YJSTATUS'); this.editcolumnindex = e.colIdx; if (YJSTATUS == '审核通过') { Ext.Msg.show({ title:'提示', msg:'当前状态无法修改', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });//当前费用已対帐无法修改! return false; } if (this.yjmng == 1) { if (e.field == 'ORDERAMOUNT' || e.field == 'CUSTNAME' || e.field == 'CURRENCY' || e.field == 'FCOP' || e.field == 'REMARK') { return false; } } else { if (e.field == 'AMOUNT') { return false; } } if (this.yjsale == 1) { if (e.field == 'FCOP' || e.field == 'CUSTNAME') { return false; } } return true; }, gridListChFeeAfterEdit: function (editor, e, eOpts) { if (e.value == e.originalValue) return; //var BSNO = e.record.get('BSNO');Div( if (e.field == 'AMOUNT') { var usdprofit = e.record.data['USDPROFIT']; var afterusdprofit = Add(usdprofit, -e.value); e.record.set('AUSDPROFIT', afterusdprofit); } else if (e.field == 'ORDERAMOUNT') { var usdprofit = e.record.data['USDPROFIT']; var afterusdprofit = Add(usdprofit, -e.value); e.record.set('AUSDPROFIT', afterusdprofit); } }, onRefreshClick: function (button, event) { if (!this.checkSearchCondition()) return; this.PageSize = this.Pagenum.getValue(); var sql = this.getCondition(); this.sqlcontext = sql; this.storeList.pageSize = this.PageSize; this.storeList.load({ params: { start: 0, limit: this.PageSize, condition: sql, type: locktype }, waitMsg: "正在查询数据...", scope: this }); }, onDsQuery: function (button, event) { this.PageSize = this.Pagenum.getValue(); var sql = this.sqlcontext; this.storeList.pageSize = this.PageSize; this.storeList.load({ params: { start: 0, limit: this.PageSize, condition: sql, type: locktype }, waitMsg: "正在查询数据...", scope: this }); }, getCondition: function () { var form = this.formSearch.getForm(); var sql = ''; /* var sqldata = form.getValues(); sql = Ext.JSON.encode(sqldata); */ //if (this.yjmng == 1) { // sql = sql + getAndConSql(sql, this.yjmng, " C.YJSTATUS='提交审核' "); //} if (this.yjsale == 1) { sql = sql + getAndConSql(sql, this.yjsale, " C.FCOP='" + SHOWNAME+"'"); } var mblNo = form.findField('PS_MBLNO').getValue(); sql = sql + getAndConSql(sql, mblNo, " (B.CUSTNO like '%" + mblNo + "%' or B.MBLNO like '%" + mblNo + "%' or B.HBLNO like '%" + mblNo + "%' or B.CUSTOMNO like '%" + mblNo + "%' or B.ORDERNO like '%" + mblNo + "%')"); var expDate_Min = form.findField('PS_EXPDATEBGN').getRawValue(); sql = sql + getAndConSql(sql, expDate_Min, " B.OPDATE>='" + expDate_Min + "'"); var expDate_Max = form.findField('PS_EXPDATEEND').getRawValue(); sql = sql + getAndConSql(sql, expDate_Max, " B.OPDATE<='" + expDate_Max + " 23:59:59'"); var etdDate_Min = form.findField('PS_ETDDATEBGN').getRawValue(); sql = sql + getAndConSql(sql, etdDate_Min, " B.ETD>='" + etdDate_Min + "'"); var etdDate_Max = form.findField('PS_ETDDATEEND').getRawValue(); sql = sql + getAndConSql(sql, etdDate_Max, " B.ETD<='" + etdDate_Max + " 23:59:59'"); var accDate_Min = form.findField('PS_ACCDATEBGN').getRawValue(); sql = sql + getAndConSql(sql, accDate_Min, " B.ACCDATE>='" + accDate_Min + "'"); var accDate_Max = form.findField('PS_ACCDATEEND').getRawValue(); sql = sql + getAndConSql(sql, accDate_Max, " B.ACCDATE<='" + accDate_Max + "'"); //var ENTERP = form.findField('PS_ENTERP').getValue(); //sql = sql + getAndConSql(sql, ENTERP, "B.ENTERP='" + ENTERP + "'"); var CUSTOMERNAME = form.findField('PS_CUSTOMERNAME').getValue(); sql = sql + getAndConSql(sql, CUSTOMERNAME, "B.CUSTOMERNAME='" + CUSTOMERNAME + "'"); var SALE = form.findField('PS_SALE').getValue(); sql = sql + getAndConSql(sql, SALE, "B.SALE='" + SALE + "'"); var OP = form.findField('PS_OP').getValue(); sql = sql + getAndConSql(sql, OP, "B.OP='" + OP + "'"); var BSTYPE = form.findField('PS_BSTYPE').getValue(); sql = sql + getAndConSql(sql, BSTYPE, "B.BSTYPE='" + BSTYPE + "'"); var YJSTATUS = form.findField('YJSTATUS').getValue(); sql = sql + getAndConSql(sql, YJSTATUS, "C.YJSTATUS='" + YJSTATUS + "'"); var VESSEL = form.findField('PS_VESSEL').getValue(); sql = sql + getAndConSql(sql, VESSEL, "B.VESSEL like '%" + VESSEL + "%'"); var VOYNO = form.findField('PS_VOYNO').getValue(); sql = sql + getAndConSql(sql, VOYNO, "B.VOYNO like '%" + VOYNO + "%'"); // var GOODSNAME = form.findField('PS_GOODSNAME').getValue(); // sql = sql + getAndConSql(sql, GOODSNAME, "B.GOODSNAME like '%" + GOODSNAME + "%'"); var PS_OPLOCK = form.findField('PS_OPLOCK').getValue(); if (PS_OPLOCK == '已锁定') sql = sql + getAndConSql(sql, PS_OPLOCK, "B.BSSTATUS=1"); else if (PS_OPLOCK == '未锁定') sql = sql + getAndConSql(sql, PS_OPLOCK, "B.BSSTATUS=0"); var PS_FEELOCK = form.findField('PS_FEELOCK').getValue(); if (PS_FEELOCK == '已锁定') sql = sql + getAndConSql(sql, PS_FEELOCK, "B.FEESTATUS=1"); else if (PS_FEELOCK == '未锁定') sql = sql + getAndConSql(sql, PS_FEELOCK, "B.FEESTATUS=0"); var PS_ISVOU = form.findField('PS_ISVOU').getValue(); if (PS_ISVOU == '已生成') sql = sql + getAndConSql(sql, PS_ISVOU, "B.ISVOU=1"); else if (PS_ISVOU == '未生成') sql = sql + getAndConSql(sql, PS_ISVOU, " ISNULL(B.ISVOU,0)=0"); var ISFEEUP = form.findField('ISFEEUP').getValue(); if (ISFEEUP == '0') { sql = sql + getAndConSql(sql, ISFEEUP, " NOT EXISTS (select 1 from OP_STATUS WHERE B.BSNO=OP_STATUS.BSNO AND OP_STATUS.STTYPE='2') "); } else if (ISFEEUP == '1') { sql = sql + getAndConSql(sql, ISFEEUP, " EXISTS (select 1 from OP_STATUS WHERE B.BSNO=OP_STATUS.BSNO AND OP_STATUS.STTYPE='2') "); } var OPTYPE = form.findField('OPTYPE').getValue(); if (OPTYPE == '普通货' || OPTYPE == '更改单') { sql = sql + getAndConSql(sql, OPTYPE, " B.OPTYPE='" + OPTYPE + "' "); } else if (OPTYPE == '普通货有更改单') { sql = sql + getAndConSql(sql, OPTYPE, " EXISTS (select 1 from OP_AMEND WHERE PARENTID=B.BSNO) "); } var BillFeeStatus = form.findField('BillFeeStatus').getValue(); sql = sql + getAndConSql(sql, BillFeeStatus, "BillFeeStatus='" + BillFeeStatus + "'"); var FSTATUS = form.findField('FSTATUS').getValue(); if (FSTATUS == '' || FSTATUS == null || FSTATUS == undefined || FSTATUS == 0) { } else { if (sql == '') { if (FSTATUS == 1) { sql = ' EXISTS (select 1 from CH_FEE WHERE B.BSNO=CH_FEE.BSNO AND (CH_FEE.FEESTATUS=0 or CH_FEE.FEESTATUS=8 or CH_FEE.FEESTATUS=9) AND CH_FEE.FEESTATUS<>1 AND CH_FEE.FEESTATUS<>2) ' } else if (FSTATUS == 2) { sql = ' EXISTS (select 1 from CH_FEE WHERE B.BSNO=CH_FEE.BSNO AND (CH_FEE.FEESTATUS!=0 AND CH_FEE.FEESTATUS!=8 AND CH_FEE.FEESTATUS!=9) AND (CH_FEE.FEESTATUS=1 OR CH_FEE.FEESTATUS=2)) ' } } else { if (FSTATUS == 1) { sql = sql + ' AND EXISTS (select 1 from CH_FEE WHERE B.BSNO=CH_FEE.BSNO AND (CH_FEE.FEESTATUS=0 or CH_FEE.FEESTATUS=8 or CH_FEE.FEESTATUS=9) AND CH_FEE.FEESTATUS<>1 AND CH_FEE.FEESTATUS<>2) ' } else if (FSTATUS == 2) { sql = sql + ' AND EXISTS (select 1 from CH_FEE WHERE B.BSNO=CH_FEE.BSNO AND (CH_FEE.FEESTATUS!=0 AND CH_FEE.FEESTATUS!=8 AND CH_FEE.FEESTATUS!=9) AND (CH_FEE.FEESTATUS=1 OR CH_FEE.FEESTATUS=2)) ' } } } return sql; }, checkSearchCondition: function () { var form = this.formSearch.getForm(); if (!form.isValid()) { Ext.Msg.alert('提示', '查询条件赋值错误,请检查。'); return false; } return true; }, onClearSql: function () { var form = this.formSearch.getForm(); form.reset(); }, OprationSwap: function () { var ret = new Array(); ret[0] = this.OprationStatus; ret[1] = this.storeList; ret[2] = this.SelectedRecord; ret[3] = this.SelectedRecord.data.BSNO; ret[4] = "chfee_lock"; return ret; }, onExportClick: function (button, event) { GridExportExcelPage(this.gridList); }, OprationSwap: function () { var ret = new Array(); ret[0] = this.OprationStatus; ret[1] = this.storeList; ret[2] = this.SelectedRecord; return ret; }, onExportClick: function (button, event) { GridExportExcelPage(this.gridList); }, GetBtnStatus: function () { //var btnFeeLock = Ext.getCmp('btnFeeLock'); //var btnFeeUnLock = Ext.getCmp('btnFeeUnLock'); //var btnBsLock = Ext.getCmp('btnBsLock'); //var btnBsUnLock = Ext.getCmp('btnBsUnLock'); //var btnCreateVoucher = Ext.getCmp('btnCreateVoucher'); //if (locktype == 'BS') { // btnBsLock.setVisible(true); // btnBsUnLock.setVisible(true); // btnFeeLock.setVisible(false); // btnFeeUnLock.setVisible(false); // btnCreateVoucher.setVisible(false); //} else if (locktype == 'FEE') { // btnBsLock.setVisible(false); // btnBsUnLock.setVisible(false); // btnFeeLock.setVisible(true); // btnFeeUnLock.setVisible(true); // btnCreateVoucher.setVisible(false); //} else if (locktype == 'BSVOUCHER') { // btnBsLock.setVisible(false); // btnBsUnLock.setVisible(false); // btnFeeLock.setVisible(false); // btnFeeUnLock.setVisible(false); // btnCreateVoucher.setVisible(true); // var form = this.formSearch.getForm(); // form.findField('PS_ISVOU').setValue('未生成'); //} }, Print: function () { _this = this; if (this.storeList.getCount() == 0) { return; } var sortstr = ''; if (this.sortfield != '' && this.sortdire != '') { sortstr = this.sortfield + ' ' + this.sortdire; } Ext.Msg.wait('正在组织数据, 请稍侯..'); Ext.Ajax.request({ waitMsg: '正在组织数据...', url: '/Account/Chfee_lock/BsListData', scope: this, params: { start: 0, limit: this.PageSize, condition: _this.sqlcontext, type: locktype, printstr: 'true', sort: sortstr }, callback: function (options, success, response) { if (success) { Ext.MessageBox.hide(); var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { var returnstr = jsonresult.Data; var printType = 'MSLOCKLIST'; var sql1 = returnstr; var sql2 = "select SUBSTRING(CONVERT(char(15),ETD,111),1,7) AS 月份,OP,max(UNCLOSEOP) UNCLOSEOP,SUM(CASE WHEN UNCLOSECOUNT=1 THEN 1 ELSE 0 END) 一次解锁票数 "; sql2 = sql2 + ",SUM(CASE WHEN UNCLOSECOUNT>=2 THEN 1 ELSE 0 END) 二次解锁票数 from v_op_unclose B" if (this.sqlcontext != '') sql2 = sql2 + " where B.CORPID='" + COMPANYID + "' and " + this.sqlcontext; sql2 = sql2 + " GROUP BY SUBSTRING(CONVERT(char(15),ETD,111),1,7),OP"; var sql3 = ""; var sql4 = ""; var sql5 = ""; var sql6 = ""; PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6); } 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 }); } } }); }, PrintSelect: function () { _this = this; if (this.storeList.getCount() == 0) { return; } var selectedRecords = []; var storeadd = null; selectedRecords = this.GridCheckBoxModel.selected.items; if (selectedRecords.length == 0) { Ext.Msg.show({ title: '提示', msg: '请先选择要打印的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var sortstr = ' CUSTNO desc '; if (this.sortfield != '' && this.sortdire != '') { sortstr = this.sortfield + ' ' + this.sortdire; } var feeGidSql = ''; for (var i = 0; i < selectedRecords.length; i++) { var record = selectedRecords[i]; var feeGId = "'" + record.get('BSNO') + "'"; if (feeGidSql == '') { feeGidSql = feeGId; } else { feeGidSql = feeGidSql + "," + feeGId; } }; var bsno = '11111'; var selections = this.gridList.getSelectionModel().getSelection(); if (selections.length != 0) { var record = selections[0]; bsno = record.data.BSNO; } var printType = 'MSLOCKLISTSELECT'; var sql1 = "select * from V_OP_BILL WHERE BSNO IN (" + feeGidSql + ") order by " + sortstr; var sql2 = "select *from V_OP_BILL where BSNO='" + bsno + "'"; var sql3 = ""; var sql4 = ""; var sql5 = ""; var sql6 = ""; PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6); }, onPrintGainClick: function (button, event) { 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]; var strbsno = record.data.BSNO; var stroplb = record.data.OPLB; var stroptype = record.data.OPTYPE; var opstr = " BSNO='" + strbsno + "'" if (stroptype == '更改单') { opstr = " BSNO IN (SELECT PARENTID FROM OP_AMEND WHERE BSNO='" + strbsno + "')" } _this = this; Ext.Msg.wait('正在组织数据, 请稍侯..'); Ext.Ajax.request({ waitMsg: '正在组织数据...', url: '/MvcShipping/MsChFee/GetGainPrint', scope: this, params: { bsno: strbsno, oplb: stroplb }, callback: function (options, success, response) { if (success) { Ext.MessageBox.hide(); var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { if (stroplb == 'op_seae') { var printType = 'SEAEGAIN'; var sql1 = "SET LANGUAGE 'us_english' " + " select * from op_seae WHERE " + opstr; } else if (stroplb == 'op_apply') { var printType = 'APPLYGAIN'; var sql1 = "SET LANGUAGE 'us_english' " + " select * from op_apply WHERE " + opstr; } else if (stroplb == 'op_seai') { var printType = 'SEAIGAIN'; var sql1 = "SET LANGUAGE 'us_english' " + " select * from op_seai WHERE " + opstr; } else if (stroplb == 'op_bulk') { var printType = 'BULKGAIN'; var sql1 = "SET LANGUAGE 'us_english' " + " select * from op_bulk WHERE " + opstr; } else if (stroplb == 'op_other') { var printType = 'OTHERGAIN'; var sql1 = "SET LANGUAGE 'us_english' " + " select * from op_other WHERE " + opstr; } else if (stroplb == 'op_railway') { var printType = 'RAILWAYGAIN'; var sql1 = "SET LANGUAGE 'us_english' " + " select * from op_railway WHERE " + opstr; } else if (stroplb == 'op_aire') { var printType = 'AIREGAIN'; var sql1 = "SET LANGUAGE 'us_english' " + " select * from op_aire WHERE " + opstr; } else if (stroplb == 'op_airi') { var printType = 'AIRIGAIN'; var sql1 = "SET LANGUAGE 'us_english' " + " select * from op_airi WHERE " + opstr; }; // sql3 = sql3 + " Select c.*,(select showname from [user] where gid=c.enteroperator) as 录入人 from ch_fee c where c.Gid in (" + feeGidSql + ") order by sort,LineNum "; var sql2 = "SET LANGUAGE 'us_english' Select c.*,(select showname from [user] where gid=c.enteroperator) as 录入人 from ch_fee c where c.BSNO='" + strbsno + "' and c.FEETYPE=1 order by sort,LineNum "; var sql3 = "SET LANGUAGE 'us_english' Select c.*,(select showname from [user] where gid=c.enteroperator) as 录入人 from ch_fee c where c.BSNO='" + strbsno + "' and c.FEETYPE=2 order by sort,LineNum "; //全部费用利润 或 海运费利润 或 仓储利润 var sql4 = "SELECT BSNO" + ",SUM(RMBDR) as RMBDR,SUM(RMBCR) as RMBCR,SUM(USDDR) as USDDR,SUM(USDCR) as USDCR" + ",SUM(RMBDR+USDTORMBDR) as DRTTL" + ",SUM(RMBCR+USDTORMBCR) as CRTTL" + ",(SUM(RMBDR)-SUM(RMBCR)) AS RMBPROFIT" + ",(SUM(USDDR)-SUM(USDCR)) AS USDPROFIT" + ",SUM(RMBDR+USDTORMBDR)- SUM(RMBCR+USDTORMBCR) as TTLPROFIT" //+ ",(CAST(CAST(CASE WHEN SUM(RMBCR+USDTORMBCR) = 0 THEN 100 ELSE (ROUND((case when SUM(RMBDR+USDTORMBDR)=0 then 0 else (SUM(RMBDR+USDTORMBDR)- SUM(RMBCR+USDTORMBCR))/SUM(RMBDR+USDTORMBDR) END),4))*100 END as decimal(18,2)) as varchar(20))+'%') AS PROFITRATE" + ",(CAST(CAST(CASE WHEN SUM(RMBCR+USDTORMBCR) = 0 THEN 100 ELSE (ROUND(((SUM(RMBDR+USDTORMBDR)- SUM(RMBCR+USDTORMBCR))/SUM(RMBCR+USDTORMBCR)),4))*100 END as decimal(18,2)) as varchar(20))+'%') AS PROFITRATE" + ",'" + SHOWNAME + "' as CREATEUSER,GETDATE() as CREATETIME " + " FROM (" + "SELECT BSNO,CURRENCY,FEETYPE" + ",SUM(CASE WHEN CURRENCY='RMB' AND FEETYPE = 1 THEN AMOUNT ELSE 0 END) as RMBDR" + ",SUM(CASE WHEN CURRENCY='RMB' AND FEETYPE = 2 THEN AMOUNT ELSE 0 END) as RMBCR" + ",SUM(CASE WHEN CURRENCY='USD' AND FEETYPE = 1 THEN AMOUNT ELSE 0 END) as USDDR" + ",SUM(CASE WHEN CURRENCY='USD' AND FEETYPE = 2 THEN AMOUNT ELSE 0 END) as USDCR" + ",SUM(CASE WHEN CURRENCY='USD' AND FEETYPE = 1 THEN AMOUNT*EXCHANGERATE ELSE 0 END) as USDTORMBDR" + ",SUM(CASE WHEN CURRENCY='USD' AND FEETYPE = 2 THEN AMOUNT*EXCHANGERATE ELSE 0 END) as USDTORMBCR " + " FROM ch_fee WHERE 1=1 and BSNO='" + strbsno + "'" + " GROUP BY BSNO,CURRENCY,EXCHANGERATE,FEETYPE " + " ) AS C GROUP BY BSNO "; var sql5 = "exec GetPrintData '" + strbsno + "'"; var sql6 = ""; PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6); } 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 }); } } }); } });