Ext.namespace('Shipping'); Shipping.MsChDuiEdit = function (config) { Ext.applyIf(this, config); this.initUIComponents(); window.Shipping.MsChDuiEdit.superclass.constructor.call(this); }; Ext.extend(Shipping.MsChDuiEdit, Ext.Panel, { ParentWin: null, OpStatus: 'add', StoreList: null, EditRecord: null, PageSize: 100, PageSizeAdd: 100, sqlcontext: '', initUIComponents: function () { this.serialNo = 0; this.workSerialNo = 0; this.bodyDel = []; this.FeeSql = ''; this.BillSql = ''; this.DuiBillSql = ''; this.IsDebit = '0'; this.FeeSqlStr = ''; this.sortfield = ''; this.sortdire = ''; this.CUSTDUIISNOTREPEAT = 0; //#region 编辑form //枚举参照相关(编辑form) this.formname = 'MsChDuiEdit'; Ext.Ajax.timeout = 120000; //表参照相关(编辑form) //表参照相关(编辑form) this.StoreOpRange = Ext.create('DsExt.ux.RefTableStore', { model: 'MsOP', proxy: { url: '/MvcShipping/MsBaseInfo/GetOpRang' } }); this.StoreOpRange.load({ params: { optype: "modChDuiFeeList"} }); this.storeCustCode = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListRm' } }); Ext.define('DsShipping.ux.MsClientGroup', { extend: 'Ext.data.Model', fields: [ { name: 'SHORTNAME', type: 'string' }, { name: 'PCORPNAME', type: 'string' }, { name: 'CODENAME', type: 'string' } ] }); this.StoreClientGroup = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.MsClientGroup', proxy: { url: '/MvcShipping/MsInfoClient/GetClientGroupList' } }); this.StoreClientGroup.load({ params: { condition: "PCORPNAME<>'' " } }); // this.storeCustCode.load({ params: { condition: ""} }); this.comboxCustCode = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: Zi.LAN.duizkehu, //对账客户 store: this.storeCustCode, allowBlank: false, queryMode: 'remote', minChars: 1, queryParam: 'CODENAME', name: 'CUSTNAME', valueField: 'CustName', displayField: 'CodeAndName', listeners: { scope: this, 'select': function (combo, records, eOpts) { if (records.length > 0) { var CUSTOMERNAME = this.formEdit.getForm().findField('CUSTNAME').getValue(); if (CUSTOMERNAME == '') return; var CUSTNAME = this.formSearch.getForm().findField('CUSTNAME'); var tmpcust = CUSTNAME.getValue(); if (tmpcust == '' || tmpcust == null || tmpcust == undefined) { CUSTNAME.setValue(CUSTOMERNAME); } } } } }); this.storeDuiTemplate = Ext.create('DsExt.ux.RefTableStore', { model: 'MsCodeDuiTemplate', proxy: { url: '/MvcShipping/MsCodeDuiTemplate/GetDataList' } }); this.storeDuiTemplate.load({ params: { condition: ""} }); this.comboxDuiTemplate = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: Zi.LAN.printmoban, //打印模板 store: this.storeDuiTemplate, forceSelection: true, name: 'DM_ID', valueField: 'DM_ID', displayField: 'NAME' }); this.storeDCType = Ext.create('DsExt.ux.RefEnumStore', {}); this.storeDCType.load({ params: { enumTypeId: 96008} }); this.comboxDCType = Ext.create('DsExt.ux.RefEnumCombox', { fieldLabel: Zi.LAN.zdantype, //账单类别 store: this.storeDCType, forceSelection: true, name: 'DC' }); this.storeFeeType = Ext.create('DsExt.ux.RefEnumStore', {}); this.storeFeeType.load({ params: { enumTypeId: 96009} }); this.comboxFeeType = Ext.create('DsExt.ux.RefEnumCombox', { fieldLabel: Zi.LAN.fyfanwei, //费用范围 store: this.storeFeeType, forceSelection: true, name: 'ISNOSTL' }); this.storeNOTAX = Ext.create('Ext.data.Store', { fields: ['DC', 'NAME'] }); this.storeNOTAX.add({ "DC": "", "NAME": "含税" }); this.storeNOTAX.add({ "DC": "1", "NAME": "不含税" }); this.comboxNOTAX = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: Zi.LAN.ishanshui, //是否含税 store: this.storeNOTAX, forceSelection: true, name: 'ISNOTAX', valueField: 'DC', displayField: 'NAME' }); //编辑form this.formEdit = Ext.widget('form', { region: 'center', frame: true, bodyPadding: 1, autoScroll: true, trackResetOnLoad: true, fieldDefaults: { margins: '2 2 1 2', labelAlign: 'right', flex: 1, labelWidth: 90, msgTarget: 'qtip' }, items: [ {//fieldset 1 xtype: 'fieldset', defaultType: 'textfield', layout: 'anchor', defaults: { anchor: '100%' }, items: [{ xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [ { fieldLabel: 'BILLSTATUS', name: 'BILLSTATUS', flex: 0, hidden: true, margins: '0' }, { fieldLabel: 'OP', name: 'OP', hidden: true }, { fieldLabel: Zi.LAN.duiznum, //对账编号 readOnly: true, name: 'DUINO' }, this.comboxCustCode, { fieldLabel: Zi.LAN.zdshuoming, //账单说明 name: 'DUINAME' }, { fieldLabel: Zi.LAN.duizdate, //对账日期 readOnly: true, name: 'DUIDATE' }, { fieldLabel: Zi.LAN.status, //状态 readOnly: true, name: 'BILLSTATUSREF' }, this.comboxNOTAX ] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxDuiTemplate, this.comboxDCType, this.comboxFeeType, { fieldLabel: Zi.LAN.Remarks, //备注 flex: 3, name: 'REMARKS' }] } ]//end items(fieldset 1) }//end fieldset 1 ]//end root items }); //end this.formEdit //#endregion //#region 按钮Toolbar this.panelBtn = new Ext.Panel({ region: "north", tbar: [ { id: 'btnEPrev', text: Zi.LAN.btnEPrev, //"上一票", // iconCls: "btnsave", handler: function (button, event) { this.PrevRecord(); }, scope: this }, { id: 'btnENext', text: Zi.LAN.btnENext, //"下一票", // iconCls: "btnsave", handler: function (button, event) { this.NextRecord(); }, scope: this },{ text: Zi.LAN.Save, //保存 iconCls: "btnsave", id: 'btnESave', handler: function (button, event) { this.Save('0'); }, scope: this }, '-', { text: Zi.LAN.biaozprint, //标准打印 handler: function (button, event) { this.Print(); }, scope: this }, '-', { text: Zi.LAN.mobprint, //模板打印 handler: function (button, event) { this.ModulPrint(); }, scope: this }, '-', { text: Zi.LAN.saveandclose, //保存并关闭 id: 'btnESaveAndClose', handler: function (button, event) { this.Save('1'); }, scope: this }, '-', { text: Zi.LAN.saveandnew, //保存并新建 id: 'btnESaveAndNew', handler: function (button, event) { this.Save('2'); }, scope: this }, '-', { id: 'btnSubmitAudit', text: '锁定', //锁定 tooltip: '锁定', handler: function (button, event) { this.onSubmitAuditClick(); }, scope: this }, '-', { id: 'btnSubmitAuditBack', text: '撤销锁定', //撤销锁定 tooltip: '撤销锁定', handler: function (button, event) { this.onSubmitAuditBackClick(); }, scope: this }, '-', { id: 'btnSubmitFee', text: Zi.LAN.SubmitFee, //锁定 tooltip: Zi.LAN.SubmitFee, handler: function (button, event) { this.onSubmitFeeClick(); }, scope: this } //, '-', { // id: 'btnSubmitFee2', // text: '开票链接', //锁定 // tooltip: Zi.LAN.SubmitFee, // handler: function (button, event) { // this.onSubmitFeeClick(); // }, // scope: this //} ] }); //end 按钮Toolbar //#endregion //#region 明细表 //明细表表格相关 this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel'); //明细表-数据集 this.storeBodyList = Ext.create('Ext.data.Store', { model: 'MsChDuiBill', pageSize: this.PageSize, remoteSort: true, proxy: { type: 'ajax', url: '/MvcShipping/MsChDui/GetBillList', reader: { id: 'DUINO,BSNO', root: 'data', totalProperty: 'totalCount' } } }); //明细表表格 this.gridListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', { clicksToEdit: 1 }); _this = this; this.initgridListcolumns = [{ sortable: true, dataIndex: 'DUINO', header: 'DUINO', hidden: true, width: 100 }, { sortable: true, dataIndex: 'BSNO', header: 'BSNO', hidden: true, width: 100 }, { sortable: true, dataIndex: 'OPLBNAME', header: Zi.LAN.yewutype, //业务类别 width: 90 }, { sortable: true, dataIndex: 'CUSTNO', header: Zi.LAN.DelegateNumber, //委托编号 summaryType: 'count', width: 80 }, { sortable: true, dataIndex: 'MBLNO', header: Zi.LAN.ZhuTDH, //主提单号 width: 90 }, { sortable: true, dataIndex: 'HBLNO', header: Zi.LAN.HBLNO, //主提单号 width: 90 }, { sortable: true, dataIndex: 'CUSTOMERNAME', header: Zi.LAN.Requester, //委托单位 width: 100 }, { sortable: true, dataIndex: 'VESSEL', header: Zi.LAN.chuanname, //船名 width: 150 }, { sortable: true, dataIndex: 'VOYNO', header: Zi.LAN.vessel, //航次 width: 60 }, { sortable: true, dataIndex: 'ETD', header: Zi.LAN.SailingDate, //开船日期 renderer: Ext.util.Format.dateRenderer('Y-m-d'), width: 80 }, { sortable: true, dataIndex: 'ACCDATE', header: Zi.LAN.AccountingPeriod, //会计期间 width: 80 }, { sortable: true, dataIndex: 'OP', header: Zi.LAN.Operating, //操作 width: 80 }, { sortable: true, dataIndex: 'CNTRTOTAL', header: Zi.LAN.CNTRTOTAL, //操作 width: 80 }, { sortable: true, dataIndex: 'CUSTOMNO', header: Zi.LAN.bgdannum, //报关单编号 width: 100 }, { sortable: true, dataIndex: 'BSSOURCE', header: Zi.LAN.BusinessSource, //业务来源 width: 80 }, { sortable: true, dataIndex: 'PORTDISCHARGE', header: Zi.LAN.PORTDISCHARGE, //目的港 width: 120 }, { sortable: true, id: '', dataIndex: 'DUIFEESTATUS', header: Zi.LAN.fystate, //'应收费用', 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, dataIndex: 'RMBDR', header: Zi.LAN.yshouRmbi, //应收RMB 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', summaryType: 'sum', summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, width: 80 }, { sortable: true, dataIndex: 'BALRMBDR', header: Zi.LAN.weishourmb, //未收RMB 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', summaryType: 'sum', summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, width: 80 }, { sortable: true, dataIndex: 'USDDR', header: Zi.LAN.yingsUsd, //应收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', summaryType: 'sum', summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, width: 80 }, { sortable: true, dataIndex: 'BALUSDDR', header: Zi.LAN.wsUSD, //未收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', summaryType: 'sum', summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, width: 80 }, { sortable: true, dataIndex: 'OTDR', header: Zi.LAN.yingsOT, //应收OT 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', summaryType: 'sum', summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, width: 80 }, { sortable: true, dataIndex: 'BALOTDR', header: Zi.LAN.weisOT, //未收OT 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', summaryType: 'sum', summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, width: 80 }, { sortable: true, dataIndex: 'TTLDR', header: '应收合计', //应收合计 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', summaryType: 'sum', summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, width: 80 }, { sortable: true, dataIndex: 'BALTTLDR', header: '未收合计', //未收合计 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', summaryType: 'sum', summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, width: 80 }, { sortable: true, dataIndex: 'RMBCR', header: Zi.LAN.tingfRmbi, //应付RMB 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', summaryType: 'sum', summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, width: 80 }, { sortable: true, dataIndex: 'BALRMBCR', header: Zi.LAN.weifuRmbi, //未付RMB 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', summaryType: 'sum', summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, width: 80 }, { sortable: true, dataIndex: 'USDCR', header: Zi.LAN.yingfuusd, //应付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', summaryType: 'sum', summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, width: 80 }, { sortable: true, dataIndex: 'BALUSDCR', header: Zi.LAN.weifuusd, //未付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', summaryType: 'sum', summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, width: 80 }, { sortable: true, dataIndex: 'OTCR', header: Zi.LAN.yingfuot, //应付OT 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', summaryType: 'sum', summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, width: 80 }, { sortable: true, dataIndex: 'BALOTCR', header: Zi.LAN.weifuot, //未付OT 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', summaryType: 'sum', summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, width: 80 }, { sortable: true, dataIndex: 'TTLCR', header: '应付合计', //应付合计 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', summaryType: 'sum', summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, width: 80 }, { sortable: true, dataIndex: 'BALTTLCR', header: '未付合计', //未付合计 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', summaryType: 'sum', summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, width: 80 }, { sortable: true, dataIndex: 'RMBORDERINVOICEDR', header: 'RMB发票申请', //未付合计 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', summaryType: 'sum', summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, width: 80 }, { sortable: true, dataIndex: 'USDORDERINVOICEDR', 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', summaryType: 'sum', summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, width: 80 }, { sortable: true, dataIndex: 'RMBORDERAMOUNTCR', header: 'RMB申请金额', //未付合计 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', summaryType: 'sum', summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, width: 80 }, { sortable: true, dataIndex: 'USDORDERAMOUNTCR', 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', summaryType: 'sum', summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, width: 80 }, { sortable: true, dataIndex: 'SALE', header: Zi.LAN.LanhuoPeople, //揽货人 width: 80 }, { sortable: true, dataIndex: 'ORDERNO', header: Zi.LAN.ORDERNO, //揽货人 width: 80 }, { sortable: true, dataIndex: 'SALECORP', header: Zi.LAN.SALECORP, //揽货人 width: 80 } ]; this.gridListcolumns = this.initgridListcolumns; this.Pagenum = Ext.create('Ext.form.field.Number', { name: 'bottles', fieldLabel: Zi.LAN.NumberOfpage, //每页记录数 labelAlign: 'right', value: this.PageSize, maxValue: 100000, width: 180, minValue: 0, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { var billno = _this.formEdit.getForm().findField('DUINO').getValue(); var sql = " DUINO='" + billno + "' "; _this.PageSize = _this.Pagenum.getValue(); _this.storeBodyList.pageSize = _this.PageSize; _this.storeBodyList.load({ params: { start: 0, limit: _this.PageSize, condition: sql } }); } } } }); this.gridList = new Ext.grid.GridPanel({ store: this.storeBodyList, enableHdMenu: false, region: 'center', loadMask: { msg: Zi.LAN.LoadData }, //数据加载中,请稍等... trackMouseOver: true, disableSelection: false, selModel: this.GridCheckBoxModel, viewConfig: { enableTextSelection: true, //允许复制数据 autoFill: true }, features: [{ ftype: 'summary'//Ext.grid.feature.Summary表格汇总特性 }], tbar: [{ text: Zi.LAN.sczdmingxi, //删除账单明细 tooltip: Zi.LAN.sczdmingxi, iconCls: "btndeletedetail", id: 'btnEDeleteDetail', handler: function (button, event) { this.onDeleteClick(button, event, 1); }, scope: this }, '-', { text: Zi.LAN.Saveliststyle, //保存列表样式 menu: [ { text: Zi.LAN.Save, //保存 handler: function (button, event) { _this.gridListcolumns = DsTruck.SaveGridPanel(USERID, _this.formname + '_gridList', _this.gridList.columns, _this.gridListcolumns, 0, true); } }, { text: '初始化', //初始化 handler: function (menu, event) { _this.gridList.reconfigure(_this.storeBodyList, _this.initgridListcolumns); _this.gridListcolumns = DsTruck.SaveGridPanel(USERID, _this.formname + '_gridList', _this.gridList.columns, _this.initgridListcolumns, 0, true); } }], scope: this }, { fieldLabel: "单号", labelWidth:40, xtype: 'textfield', name: 'BSNO', listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { var billno = _this.formEdit.getForm().findField('DUINO').getValue(); var mblno = field.value; var sql = " DUINO='" + billno + "' and (b.MBLNO+b.HBLNO+b.CUSTNO like '%"+mblno+"%') "; _this.storeBodyList.load({ params: { start: 0, limit: _this.PageSize, condition: sql } }); } } } }], columns: this.gridListcolumns, bbar: [Ext.create('Ext.PagingToolbar', { store: this.storeBodyList, displayInfo: true, displayMsg: Zi.LAN.FenYe, //当前显示 {0} - {1}条记录 /共 {2}条记录 emptyMsg: Zi.LAN.Nodata//没有数据 }), this.Pagenum] }); this.gridListcolumns = DsTruck.GetGridPanel(USERID, this.formname + '_gridList', this.gridListcolumns, 0); //使用者id,表名,中间column数组,跳过一开始的几列 this.gridList.addListener('sortchange', function (ct, column, direction, eOpts) { this.sortfield = column.dataIndex; this.sortdire = direction; }, 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 = ""; openUrl = "../../MvcShipping/MsOpBill/MsOpFeeView?handle=check&bsno=" + record.data.BSNO; window.open(openUrl, openType, openSet); // DsOpenEditWin("/TruckMng/MsWlPc/Edit"); }, this); this.storeFeeList = Ext.create('Ext.data.Store', { model: 'MsChDuiDetail', remoteSort: true, proxy: { type: 'ajax', url: '/MvcShipping/MsChDui/GetDetailList', reader: { id: 'DUINO,BSNO', root: 'data', totalProperty: 'totalCount' } } }); this.FeeGridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel'); this.gridFeeList = new Ext.grid.GridPanel({ store: this.storeFeeList, enableHdMenu: false, region: 'center', loadMask: { msg: Zi.LAN.LoadData }, //数据加载中,请稍等... trackMouseOver: true, disableSelection: false, viewConfig: { enableTextSelection: true, //允许复制数据 autoFill: true }, selModel: this.FeeGridCheckBoxModel, tbar: [{ text: Zi.LAN.deletezdfy, //删除账单费用明细 tooltip: Zi.LAN.deletezdfy, iconCls: "btndeletedetail", id: 'btnEDeleteDetailFee', handler: function (button, event) { this.onDelDetailClick(button, event, 2); }, scope: this }], columns: [{ sortable: true, dataIndex: 'CH_ID', header: 'CH_ID', hidden: true, width: 100 }, { sortable: true, dataIndex: 'CustomerName', header: Zi.LAN.kehname, //客户名称 width: 90 }, { sortable: true, dataIndex: 'FeeType_Ref', header: Zi.LAN.PayReceive, //收付 width: 40 }, { sortable: true, dataIndex: 'FeeName', header: Zi.LAN.CostName, //费用名称 width: 90 }, { sortable: true, dataIndex: 'Amount', header: Zi.LAN.AmountOfMoney, //金额 width: 70, 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; } }, { sortable: true, dataIndex: 'Currency', header: Zi.LAN.Currency, //币别 width: 40 }, { sortable: true, dataIndex: 'BalAmount', header: Zi.LAN.wjmoney, //未结金额 width: 70, 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; } }, { sortable: true, dataIndex: 'ExChangerate', header: Zi.LAN.huilv, //汇率 width: 60 }, { sortable: true, dataIndex: 'NoTaxAmount', header: Zi.LAN.buhansuimoney, //不含税金额 width: 70, 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; } }, { sortable: true, dataIndex: 'Remark', header: Zi.LAN.fybeizhu, //费用备注 width: 60 }] }); this.storeBodyAddList = Ext.create('Ext.data.Store', { pageSize: this.PageSize, model: 'MsChDuiBill', remoteSort: true, proxy: { type: 'ajax', url: '/MvcShipping/MsChDui/GetAddBillList', reader: { root: 'data', totalProperty: 'totalCount' } } }); //明细表表格 this.initgirdAddListColumns = [{ sortable: true, dataIndex: 'BSNO', header: 'BSNO', hidden: true, width: 100 }, { sortable: true, dataIndex: 'OPLBNAME', header: Zi.LAN.yewutype, //业务类别 width: 80 }, { sortable: true, dataIndex: 'ISDEBIT', header: Zi.LAN.isduizhang, //是否对账 width: 80 }, { sortable: true, dataIndex: 'DUINO', header: Zi.LAN.duiznum, //对账编号 width: 80 }, { sortable: true, id: '', dataIndex: 'FEESTATUSREF', header: Zi.LAN.FEESTATUSREF, //'费用锁定', align: 'center', width: 60, renderer: function (value, cellmeta) { if (value == '锁定') { return ""; } }, filter: { type: 'list', options: ['锁定', '未锁定'] } }, { sortable: true, dataIndex: 'FEEOBJNAME', header: Zi.LAN.fyduixiang, //费用对象 width: 80 }, { sortable: true, dataIndex: 'CUSTNO', header: Zi.LAN.DelegateNumber, //委托编号 width: 108 }, { sortable: true, dataIndex: 'MBLNO', header: Zi.LAN.ZhuTDH, //主提单号 width: 108 }, { sortable: true, dataIndex: 'HBLNO', header: Zi.LAN.HBLNO, //主提单号 width: 108 }, { sortable: true, dataIndex: 'ORDERNO', header: Zi.LAN.dcnum, //订舱编号 width: 108 }, { sortable: true, dataIndex: 'CUSTOMERNAME', header: Zi.LAN.Requester, //委托单位 width: 100 }, { sortable: true, dataIndex: 'RMBDR', header: Zi.LAN.yshouRmbi, //应收RMB 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', summaryType: 'sum', summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, width: 90 }, { sortable: true, dataIndex: 'BALRMBDR', header: Zi.LAN.weishourmb, //未收RMB 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', summaryType: 'sum', summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, width: 90 }, { sortable: true, dataIndex: 'USDDR', header: Zi.LAN.yingsUsd, //应收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', summaryType: 'sum', summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, width: 90 }, { sortable: true, dataIndex: 'BALUSDDR', header: Zi.LAN.wsUSD, //未收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', summaryType: 'sum', summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, width: 90 }, { sortable: true, dataIndex: 'OTDR', header: Zi.LAN.yingsOT, //应收OT 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', summaryType: 'sum', summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, width: 90 }, { sortable: true, dataIndex: 'BALOTDR', header: Zi.LAN.weisOT, //未收OT 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', summaryType: 'sum', summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, width: 90 }, { sortable: true, dataIndex: 'RMBCR', header: Zi.LAN.tingfRmbi, //应付RMB 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', summaryType: 'sum', summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, width: 90 }, { sortable: true, dataIndex: 'BALRMBCR', header: Zi.LAN.weifuRmbi, //未付RMB 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', summaryType: 'sum', summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, width: 90 }, { sortable: true, dataIndex: 'USDCR', header: Zi.LAN.yingfuusd, //应付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', summaryType: 'sum', summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, width: 90 }, { sortable: true, dataIndex: 'BALUSDCR', header: Zi.LAN.weifuusd, //未付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', summaryType: 'sum', summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, width: 90 }, { sortable: true, dataIndex: 'OTCR', header: Zi.LAN.yingfuot, //应付OT 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', summaryType: 'sum', summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, width: 90 }, { sortable: true, dataIndex: 'BALOTCR', header: Zi.LAN.weifuot, //未付OT 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', summaryType: 'sum', summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, width: 90 }, { sortable: true, dataIndex: 'ETD', header: Zi.LAN.SailingDate, //开船日期 renderer: Ext.util.Format.dateRenderer('Y-m-d'), width: 100 }, { sortable: true, dataIndex: 'ATD', header: Zi.LAN.ATD, //开船日期 renderer: Ext.util.Format.dateRenderer('Y-m-d'), width: 100 }, { sortable: true, dataIndex: 'CUSTOMNO', header: Zi.LAN.baognum, //报关单号 width: 100 }, { sortable: true, dataIndex: 'SALE', header: Zi.LAN.LanhuoPeople, //揽货人 width: 80 }, { sortable: true, dataIndex: 'ACCDATE', header: Zi.LAN.AccountingPeriod, //会计期间 width: 80 }, { sortable: true, dataIndex: 'OP', header: Zi.LAN.Operating, //操作 width: 80 }, { sortable: true, dataIndex: 'CNTRTOTAL', header: Zi.LAN.CNTRTOTAL, //操作 width: 80 }, { sortable: true, dataIndex: 'INPUTBY', header: Zi.LAN.lurmen, //录入人 width: 80 }, { sortable: true, dataIndex: 'PORTLOAD', header: Zi.LAN.qiyunport, //起运港 width: 120 }, { sortable: true, dataIndex: 'PORTDISCHARGE', header: Zi.LAN.mudport, //目的港 width: 120 }, { sortable: true, dataIndex: 'VESSEL', header: Zi.LAN.chuanname, //船名 width: 150 }, { sortable: true, dataIndex: 'VOYNO', header: Zi.LAN.vessel, //航次 width: 60 }, { sortable: true, dataIndex: 'SALECORP', header: Zi.LAN.SALECORP, //揽货人 width: 80 } ]; this.girdAddListColumns = this.initgirdAddListColumns; this.AddGridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel'); this.PagenumAdd = Ext.create('Ext.form.field.Number', { name: 'bottles', fieldLabel: Zi.LAN.NumberOfpage, //每页记录数 labelAlign: 'right', value: this.PageSizeAdd, maxValue: 100000, width: 180, minValue: 0, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }); this.gridAddList = new Ext.grid.GridPanel({ store: this.storeBodyAddList, enableHdMenu: false, region: 'center', loadMask: { msg: Zi.LAN.LoadData }, //数据加载中,请稍等.. trackMouseOver: true, disableSelection: false, viewConfig: { enableTextSelection: true, //允许复制数据 autoFill: true }, features: [{ ftype: 'summary'//Ext.grid.feature.Summary表格汇总特性 }], selModel: this.AddGridCheckBoxModel, tbar: [{ text: Zi.LAN.addzdmingxi, //添加账单明细 tooltip: Zi.LAN.addzdmingxi, iconCls: "btnadddetail", id: 'btnadddetail', handler: function (button, event) { this.onAddClick(button, event); }, scope: this }, '-', { text: Zi.LAN.Saveliststyle, //保存列表样式 menu: [ { text: Zi.LAN.Save, //保存 handler: function (button, event) { _this.girdAddListColumns = DsTruck.SaveGridPanel(USERID, _this.formname + '_gridAddList', _this.gridAddList.columns, _this.girdAddListColumns, 0, true); } }, { text: Zi.LAN.Initialization, //初始化 handler: function (menu, event) { _this.gridAddList.reconfigure(_this.storeBodyAddList, _this.initgirdAddListColumns); _this.girdAddListColumns = DsTruck.SaveGridPanel(USERID, _this.formname + '_gridAddList', _this.gridAddList.columns, _this.initgirdAddListColumns, 0, true); } }], scope: this }], columns: this.girdAddListColumns, // paging bar on the bottom bbar:[ Ext.create('Ext.PagingToolbar', { store: this.storeBodyAddList, displayInfo: true, displayMsg: Zi.LAN.FenYe, //当前显示 {0} - {1}条记录 /共 {2}条记录 emptyMsg: Zi.LAN.Nodata//没有数据 }), this.PagenumAdd ] }); this.girdAddListColumns = DsTruck.GetGridPanel(USERID, this.formname + '_gridAddList', this.girdAddListColumns, 0); //使用者id,表名,中间column数组,跳过一开始的几列 this.gridAddList.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 = ""; openUrl = "../../MvcShipping/MsOpBill/MsOpFeeView?handle=check&bsno=" + record.data.BSNO; window.open(openUrl, openType, openSet); // DsOpenEditWin("/TruckMng/MsWlPc/Edit"); }, this); this.storeAddFeeList = Ext.create('Ext.data.Store', { model: 'MsChDuiDetail', remoteSort: true, proxy: { type: 'ajax', url: '/MvcShipping/MsChDui/GetFeeDetailList', reader: { id: 'BSNO', root: 'data', totalProperty: 'totalCount' } } }); this.AddFeeGridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel'); this.gridAddFeeList = new Ext.grid.GridPanel({ store: this.storeAddFeeList, enableHdMenu: false, anchor: '100% 50%', loadMask: { msg: Zi.LAN.LoadData }, //数据加载中,请稍等... trackMouseOver: true, disableSelection: false, viewConfig: { enableTextSelection: true, //允许复制数据 autoFill: true }, selModel: this.AddFeeGridCheckBoxModel, tbar: [{ text: Zi.LAN.addfymingxi, tooltip: Zi.LAN.addfymingxi, //添加账单费用明细 iconCls: "btnadddetail", id: 'btnadddetailFee', handler: function (button, event) { this.onAddDetailClick(button, event); }, scope: this }, { xtype: "label", id: "zongshu", text: "" }], columns: [{ sortable: true, dataIndex: 'CH_ID', header: 'CH_ID', hidden: true, width: 100 }, { sortable: true, dataIndex: 'BSNO', header: 'BSNO', hidden: true, width: 100 }, { sortable: true, dataIndex: 'CustomerName', header: Zi.LAN.kehname, //客户名称 width: 90 }, { sortable: true, dataIndex: 'FeeType_Ref', header: Zi.LAN.PayReceive, //收付 width: 40 }, { sortable: true, dataIndex: 'FeeName', header: Zi.LAN.CostName, //费用名称 width: 90 }, { sortable: true, dataIndex: 'Amount', header: Zi.LAN.AmountOfMoney, //金额 width: 70, 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; } }, { sortable: true, dataIndex: 'Currency', header: Zi.LAN.Currency, //币别 width: 40 }, { sortable: true, dataIndex: 'BalAmount', header: Zi.LAN.wjmoney, //未结金额 width: 70, 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; } }, { sortable: true, dataIndex: 'NoTaxAmount', header: Zi.LAN.buhansuimoney, //不含税金额 width: 70, 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; } }, { sortable: true, dataIndex: 'ExChangerate', header: Zi.LAN.huilv, //汇率 width: 60 }, { sortable: true, dataIndex: 'UnitPrice', header: Zi.LAN.UnitPrice, //汇率 width: 60 }, { sortable: true, dataIndex: 'Remark', header: Zi.LAN.fybeizhu, //费用备注 width: 60 } ] }); this.storeCustCodeFee = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListRm' } }); // this.storeCustCodeFee.load({ params: { condition: ""} }); _this = this; this.comboxAddCustCode = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: Zi.LAN.fyduixiang, //费用对象 store: this.storeCustCodeFee, // forceSelection: true, queryMode: 'remote', minChars: 1, queryParam: 'CODENAME', name: 'CUSTNAME', valueField: 'CustName', displayField: 'CodeAndName', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }); this.storeagent = Ext.create('DsExt.ux.RefTableStore', { model: 'OpSeaeShipper', proxy: { url: '/MvcShipping/MsOpSeae/GetShipperList' } }); this.storeagent.load({ params: { condition: "shippertype=4 "} }); this.comboxAgent = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: Zi.LAN.dailiwai, //国外代理 store: this.storeagent, forceSelection: true, name: 'PS_AGENT', valueField: 'SHORTNAME', displayField: 'CodeAndName', enableKeyEvents: true, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }); this.storeAddDCType = Ext.create('Ext.data.Store', { fields: ['DC', 'NAME'] }); this.storeAddDCType.add({ "DC": "", "NAME": "全部" }); this.storeAddDCType.add({ "DC": "1", "NAME": "应收" }); this.storeAddDCType.add({ "DC": "2", "NAME": "应付" }); this.comboxaddDCType = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: Zi.LAN.PayReceive, //收付 store: this.storeAddDCType, valueField: 'DC', displayField: 'NAME', flex: 0.6, forceSelection: true, name: 'DC', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }); this.storeIsDebit = Ext.create('Ext.data.Store', { fields: ['DC', 'NAME'] }); this.storeIsDebit.add({ "DC": "1", "NAME": "是" }); this.storeIsDebit.add({ "DC": "2", "NAME": "否" }); this.comboxIsDebit = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: Zi.LAN.bdyidaozhang, //包含已对账 store: this.storeIsDebit, valueField: 'DC', flex: 0.5, displayField: 'NAME', forceSelection: true, name: 'ISDEBIT', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }); this.StoreFeeFrt = Ext.create('Ext.data.Store', { fields: ['Frt'] }); this.StoreFeeFrt.add({ "Frt": "PP" }); this.StoreFeeFrt.add({ "Frt": "CC" }); this.comboxFeeFrt = Ext.create('DsExt.ux.RefTableCombox', { store: this.StoreFeeFrt, fieldLabel: 'FRT', flex: 0.5, forceSelection: true, name: 'FEEFRT', valueField: 'Frt', displayField: 'Frt' }); 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', { fieldLabel: Zi.LAN.Currency, //币别 store: this.StoreCurr, forceSelection: true, flex: 0.4, labelWidth: 40, name: 'Currency', valueField: 'CURR', displayField: 'CURR', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }); this.storeFeeNameRef = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.FeeTypeRefModel', proxy: { url: '/MvcShipping/MsChFee/GetFeeTypeRefList' } }); this.comboxFeeNameRef = Ext.create('Ext.ux.form.field.BoxSelect', { fieldLabel: Zi.LAN.CostName, //费用名称 autosize: true, bodyPadding: 7, flex: 1, store: this.storeFeeNameRef, queryMode: 'local', triggerOnClick: false, name: 'FeeName', valueField: 'Name', displayField: 'CodeAndName', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }); this.storeFeeNameRef.load({ params: { condition: "" } }); this.storeFeeRange = Ext.create('Ext.data.Store', { fields: ['DC', 'NAME'] }); this.storeFeeRange.add({ "DC": "", "NAME": "全部" }); this.storeFeeRange.add({ "DC": "B", "NAME": "未结费用" }); this.storeFeeRange.add({ "DC": "S", "NAME": "已结费用" }); this.storeFeeRange.add({ "DC": "审核通过", "NAME": "审核通过" }); this.storeFeeRange.add({ "DC": "已付未收", "NAME": "已付未收" }); this.storeFeeRange.add({ "DC": "已收未付", "NAME": "已收未付" }); this.storeFeeRange.add({ "DC": "未申请未结算", "NAME": "未申请未结算" }); this.storeFeeRange.add({ "DC": "仅已开发票", "NAME": "仅已开发票" }); this.storeFeeRange.add({ "DC": "仅未开发票", "NAME": "仅未开发票" }); this.storeFeeRange.add({ "DC": "仅已开发票未收款", "NAME": "仅已开发票未收款" }); this.storeFeeRange.add({ "DC": "仅已收款未开发票", "NAME": "仅已收款未开发票" }); this.storeFeeRange.add({ "DC": "仅未开票未申请未收款", "NAME": "仅未开票未申请未收款" }); this.storeFeeRange.add({ "DC": "仅已收款已开发票", "NAME": "仅已收款已开发票" }); this.storeFeeRange.add({ "DC": "仅未开票未收款", "NAME": "仅未开票未收款" }); this.storeFeeRange.add({ "DC": "审核通过未结算", "NAME": "审核通过未结算" }); this.comboxaddFeeType = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '费用范围', store: this.storeFeeRange, valueField: 'DC', displayField: 'NAME', forceSelection: true, name: 'FEERANGE', enableKeyEvents: true, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }); //this.comboxaddFeeType = Ext.create('DsExt.ux.RefEnumCombox', { // fieldLabel: Zi.LAN.fyfanwei, //费用范围 // store: this.storeFeeRange, // forceSelection: true, // name: 'FEERANGE', // enableKeyEvents: true, // listeners: { // keyup: function (field, e) { // if (e.getKey() == e.ENTER) { // _this.onRefreshClick(); // } // } // } //}); this.storeINVSTATUS = Ext.create('Ext.data.Store', { fields: ['FSTATUS', 'NAME'] }); this.storeINVSTATUS.add({ "FSTATUS": "", "NAME": "全部" }); this.storeINVSTATUS.add({ "FSTATUS": "0", "NAME": "仅开票" }); this.storeINVSTATUS.add({ "FSTATUS": "1", "NAME": "仅不开票" }); this.comboxINVSTATUS = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: Zi.LAN.iskaipiao, //是否开票 store: this.storeINVSTATUS, valueField: 'FSTATUS', displayField: 'NAME', flex: 0.5, forceSelection: true, name: 'ISINVOICE', value: '', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }); this.storeISADVANCEDPAY = Ext.create('Ext.data.Store', { fields: ['FSTATUS', 'NAME'] }); this.storeISADVANCEDPAY.add({ "FSTATUS": "", "NAME": "全部" }); this.storeISADVANCEDPAY.add({ "FSTATUS": "0", "NAME": "仅未垫付" }); this.storeISADVANCEDPAY.add({ "FSTATUS": "1", "NAME": "仅垫付" }); this.comboxISADVANCEDPAY = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: Zi.LAN.isdianfu, //是否开垫付 store: this.storeISADVANCEDPAY, valueField: 'FSTATUS', displayField: 'NAME', labelWidth: 60, flex: 0.5, forceSelection: true, name: 'ISADVANCEDPAY', value: '', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }); this.storePort = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.PortRefModel', proxy: { url: '/MvcShipping/MsBaseInfo/GetPortRefList' } }); this.storePort.load(); this.comboxPortRef = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: Zi.LAN.portwai, //港口(国外) store: this.storePort, name: 'Port', valueField: 'PORT', displayField: 'PORTANDNAME', enableKeyEvents: true, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }); this.storeOurPort = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.PortRefModel', proxy: { url: '/MvcShipping/MsBaseInfo/GetOurPortRefList' } }); this.storeOurPort.load(); this.comboxOurPortRef = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: Zi.LAN.portnei, //港口(国内) store: this.storeOurPort, name: 'OurPort', valueField: 'PORT', displayField: 'PORTANDNAME', enableKeyEvents: true, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }); this.storeVoyVeg = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.VesselModel', proxy: { url: '/CommMng/BasicDataRef/GetVesselList' } }); this.storeVoyVeg.load({ params: { condition: ""} }); this.comboxVoyVeg = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: Zi.LAN.chuanname, //船 名 store: this.storeVoyVeg, name: 'VESSEL', valueField: 'VESSEL', flex: 1, displayField: 'VESSEL', enableKeyEvents: true, listeners: { specialkey: 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: Zi.LAN.Requester, //委托单位 store: this.storeCustCode, forceSelection: true, name: 'PS_CUSTOMERNAME', valueField: 'CustName', displayField: 'CodeAndName', enableKeyEvents: true, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }); this.storeHYF = Ext.create('Ext.data.Store', { fields: ['FSTATUS', 'NAME'] }); this.storeHYF.add({ "FSTATUS": "", "NAME": "是" }); this.storeHYF.add({ "FSTATUS": "0", "NAME": "否" }); this.comboxHYF = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: Zi.LAN.hseayw, //含海运费业务 store: this.storeHYF, valueField: 'FSTATUS', displayField: 'NAME', flex: 0.6, labelWidth: 90, forceSelection: true, name: 'ISHYF', value: '', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }); this.CheckSaveQuery = new Ext.form.Checkbox({ fieldLabel: Zi.LAN.jiyiselect, //记忆查询 labelWidth: 60, flex: 0.4, checked: true }); this.formSearch = Ext.widget('form', { frame: true, region: 'north', 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: [{ fieldLabel: 'PARAMVALUE', name: 'PARAMVALUE', value: '否', hidden: true }, this.comboxAddCustCode, { fieldLabel: Zi.LAN.selectnum, //编号检索 name: 'CustomNo', enableKeyEvents: true, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, { fieldLabel: Zi.LAN.cyewudate, //从业务日期 format: 'Y-m-d', xtype: 'datefield', name: 'ExpDateBgn', enableKeyEvents: true, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, { fieldLabel: Zi.LAN.dyewudate, //到业务日期 format: 'Y-m-d', xtype: 'datefield', name: 'ExpDateEnd', enableKeyEvents: true, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, { fieldLabel: Zi.LAN.cfydate, //从费用日期 format: 'Y-m-d', xtype: 'datefield', name: 'EnterDateBgn', enableKeyEvents: true, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, { fieldLabel: Zi.LAN.dfydate, //到费用日期 format: 'Y-m-d', xtype: 'datefield', name: 'EnterDateEnd', enableKeyEvents: true, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, { xtype: 'button', flex: 0.5, width: 90, text: Zi.LAN.ResetCondition, //重置条件 iconCls: "btnreset", handler: function (button, event) { this.onClearSql(button, event); }, scope: this } ] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxCustCode, this.comboxaddDCType, this.comboxCurr, this.comboxFeeNameRef, this.comboxFeeFrt, this.comboxIsDebit, this.comboxaddFeeType, this.comboxINVSTATUS, this.comboxISADVANCEDPAY, { xtype: 'button', width: 90, flex: 0.5, text: Zi.LAN.ExecuteQuery, //执行查询 iconCls: "btnrefresh", handler: function (button, event) { this.onRefreshClick(button, event); var issavevalue = false; var isvisible = true; if (this.CheckSaveQuery.checked) issavevalue = true saveQuerySetting(this.formname, this.formSearch, isvisible, issavevalue); }, scope: this } ] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxVoyVeg, { fieldLabel: Zi.LAN.vessel, //航次 name: 'VOYNO', enableKeyEvents: true, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, this.comboxPortRef, this.comboxOurPortRef, this.comboxBsType, this.comboxAgent, this.comboxHYF, this.CheckSaveQuery, { xtype: 'button', width: 90, flex: 0.5, text: Zi.LAN.more, //更多 iconCls: "btnmore", handler: function (button, event) { var sql = ''; var winAccess = new Shipping.DsQuery({ }); winAccess.StoreList = this.storeList; winAccess.formname = this.formname; winAccess.condition = sql; winAccess.show(); return; }, scope: this } ] } ]//end items(fieldset 1) }//end fieldset 1 ]//end root items }); //#endregion 明细表 //#region 选择合计 this.storeSelectSum = Ext.create('Ext.data.Store', { model: 'MsChDuiSelectSum' }); this.gridSelectSum = new Ext.grid.GridPanel({ store: this.storeSelectSum, enableHdMenu: false, anchor: '100% 50%', // region: 'south', loadMask: { msg: Zi.LAN.LoadData }, //数据加载中,请稍等... trackMouseOver: true, disableSelection: false, tbar: [{ xtype: 'label', width: 160, id: 'SelectGrid', height: 22, text: Zi.LAN.countfyong//所选费用合计 }], columns: [{ sortable: true, dataIndex: 'CURRENCY', header: Zi.LAN.Currency, //币 别 width: 80 }, { sortable: true, dataIndex: 'DR', header: Zi.LAN.YingShou, //应收 width: 80 }, { sortable: true, dataIndex: 'NODR', header: Zi.LAN.weishou, //未收 width: 80 }, { sortable: true, dataIndex: 'CR', header: Zi.LAN.YingFu, //应付 width: 80 }, { sortable: true, dataIndex: 'NOCR', header: Zi.LAN.weifu, //未付 width: 80 } ] }); //#endregion //#region 明细表-单据图片档案管理 this.storeISOPEN = Ext.create('Ext.data.Store', { fields: ['FSTATUS', 'NAME'] }); this.storeISOPEN.add({ "FSTATUS": "1", "NAME": "公开" }); this.storeISOPEN.add({ "FSTATUS": "0", "NAME": "不公开" }); this.comboxISOPEN = Ext.create('DsExt.ux.RefTableCombox', { // fieldLabel: '海运费', store: this.storeISOPEN, valueField: 'FSTATUS', displayField: 'NAME', // flex: 0.7, // labelWidth: 55, forceSelection: true, name: 'ISPUBLIC' }); this.storeDocList = Ext.create('Ext.data.Store', { model: 'ReceiptDocmb', remoteSort: true, proxy: { type: 'ajax', url: '/Import/ReceiptDoc/GetDocList', reader: { id: 'GID', root: 'data', totalProperty: 'totalCount' } } }); //明细表表格 this.DocListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', { clicksToEdit: 1 }); this.DocCM = Ext.create('Ext.selection.CheckboxModel'); this.gridDocList = new Ext.grid.GridPanel({ store: this.storeDocList, enableHdMenu: false, region: 'center', // width: 350, loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, plugins: [this.DocListCellEditing], selModel: this.DocCM, selType: 'cellmodel', tbar: [{ text: '删除', tooltip: '删除', iconCls: "btndeletedetail", handler: function (button, event) { this.onDelFileClick(button, event); }, scope: this }, '-', { text: '上传附件', tooltip: '上传附件', iconCls: "btnadddetail", handler: function (button, event) { this.onUpLoadFileClick(button, event); }, scope: this }], columns: [{ sortable: true, hidden: true, dataIndex: 'GID', header: 'GID', width: 80 }, { sortable: true, hidden: true, dataIndex: 'R_GID', header: 'R_GID', width: 80 }, { sortable: true, hidden: true, dataIndex: 'BSNO', header: 'BSNO', width: 80 }, { sortable: true, dataIndex: 'URL', header: '文件名', width: 200, renderer: function (value, p, record) { return '' + value + ''; } }, { sortable: true, dataIndex: 'RECEIPTTYPE', header: '附件类型', width: 135 }, { sortable: true, hidden: true, dataIndex: 'Driect_URL', header: 'Driect_URL', width: 80 }, { sortable: true, hidden: true, dataIndex: 'MODIFIEDUSER', header: 'MODIFIEDUSER', width: 80 }, { sortable: true, dataIndex: 'MODIFIEDUSERRef', header: '上传人', width: 80 }, { sortable: true, dataIndex: 'MODIFIEDTIME', header: '上传时间', width: 135 }, { sortable: true, dataIndex: 'DOCUMENTATTACHEDCODE', header: '随附单证代码', //需求编号:SR2017081100003 width: 120 }, { sortable: true, dataIndex: 'DOCUMENTATTACHEDNO', header: '随附单证编号', //需求编号:SR2017081100003 width: 120 }, { sortable: true, dataIndex: 'ISPUBLIC', header: '是否公开', editor: this.comboxISOPEN, width: 80, renderer: function (value, cellmeta) { if (value == '1') { return "公开"; } else return "不公开"; } } ] }); this.storeDocList.on('beforeload', function (store) { var condition =_this.formEdit.getForm().findField('DUINO').getValue(); var condition2 = " BSNO='" + condition + "' "; Ext.apply(store.proxy.extraParams, { condition: condition2 }); }, this); // this.gridDocList.getSelectionModel().on('select', function (model, record, index) { // if (this.Loading == true) { // return; // } // var PICURL = record.data.Driect_URL; // if ((PICURL!=undefined)&&(PICURL!='')) // Ext.getCmp('panelPic').body.update(' '); // }, this); // this.panelPic = new Ext.Panel({ // id: "panelPic", // layout: "fit", // region: "center", // autoScroll: true, // frame: false, // html: ' '//ftp://bjes:@120.27.53.37/dhm-11111/2.jpg // }); this.panelDoc = new Ext.Panel({ id: "panelDoc", layout: "border", region: "center", title: "附件", //账单明细 //autoScroll: true, frame: false, // split: true, items: [this.gridDocList] }); //#endregion //#region 布局 //控件布局 this.panelService = new Ext.Panel({ layout: "border", region: 'center', margin: '2 2', items: [this.gridList]//账单明细左边的业务列表 }); this.panelfee = new Ext.Panel({ layout: "border", region: 'east', width: 400, split: true, margin: '2 2', items: [this.gridFeeList]//账单明细右边的费用列表 }); this.paneldetail = new Ext.Panel({ title: Zi.LAN.zdmingx, //账单明细 layout: "border", region: "center", items: [ this.panelService, this.panelfee ] }); this.MainTab = new Ext.tab.Panel({ layout: "border", //height: 250, region: "center", //split: true, items: [ this.paneldetail , this.panelDoc ] }); this.panelAddService = new Ext.Panel({ layout: "border", region: 'center', margin: '2 2', items: [this.gridAddList] }); this.panelAddfee = new Ext.Panel({ layout: "anchor", region: 'east', width: 400, split: true, margin: '2 2', items: [this.gridAddFeeList, this.gridSelectSum] }); this.paneladddetail = new Ext.Panel({ layout: "border", region: 'center', items: [this.panelAddService, this.panelAddfee ] }); this.paneladd = new Ext.Panel({ title: Zi.LAN.addzdmingxi, //添加账单明细 layout: "border", region: 'south', split: true, height: 390, items: [ this.formSearch, this.paneladddetail ] }); this.panelTop = new Ext.Panel({ layout: "border", region: "north", height: 118, items: [this.panelBtn, this.formEdit] }); Ext.apply(this, { items: [this.panelTop, this.MainTab, this.paneladd] }); //#endregion //绑定查询窗体 this.ParentWin = window.parent.opener; //初始化数据 this.InitData(); //绑定事件 var billno = '*'; if (this.opStatus == 'edit') { billno = this.editRecord.get('DUINO'); }; this.gridList.reconfigure(this.storeBodyList, this.gridListcolumns); this.gridAddList.reconfigure(this.storeBodyAddList, this.girdAddListColumns); // billno = this.formEdit.getForm().findField('DUINO').getValue(); this.storeBodyList.on('beforeload', function (store) { var billno = this.formEdit.getForm().findField('DUINO').getValue(); var sql = " DUINO='" + billno + "'"; Ext.apply(store.proxy.extraParams, { condition: sql }); }, this); this.storeBodyList.on('load', function (store, records) { if (store.getCount() > 0) { //this.gridList.getSelectionModel().select(0); } }, this); var isloadfee2 = true; this.gridList.getSelectionModel().on('select', function (model, record, index) { if (!isloadfee2) return; var duino = record.data.DUINO; var bsno = record.data.BSNO; var sql = " DUINO='" + duino + "' and BSNO='" + bsno + "'"; isloadfee2 = false; this.storeFeeList.load({ params: { condition: sql }, callback: function (r, options, success) { if (success) { isloadfee2 = true; } } }); }, this); this.storeBodyAddList.on('beforeload', function (store) { // var sql = this.getCondition(); // var duisql = this.getduiCondition(); var form = this.formSearch.getForm(); var isdebit = form.findField('ISDEBIT').getValue(); this.IsDebit = isdebit; Ext.apply(store.proxy.extraParams, { condition: this.BillSql, duicondition: this.DuiBillSql, isdebit: this.IsDebit }); }, this); // this.storeBodyAddList.on('load', function (store, records) { // if (store.getCount() > 0) { // // this.gridAddList.getSelectionModel().select(0); // } else { // this.storeAddFeeList.removeAll(); // } // }, this); var isloadfee = true; this.gridAddList.getSelectionModel().on('select', function (model, record, index) { if (!isloadfee) return; var Duino = this.formEdit.getForm().findField('DUINO').getValue(); var bsno = record.data.BSNO; var feeobjname = record.data.FEEOBJNAME; var isdebit = record.data.ISDEBIT; var sql = ""; var duino = record.data.DUINO; if (isdebit == '是') { sql = " CUSTOMERNAME='" + feeobjname + "' AND DUINO='" + duino + "' AND BSNO='" + bsno + "' and GID NOT IN (SELECT GID from v_dui_fee where duino='" + Duino + "')"; } else { sql = " (ISDEBIT=0 or ISDEBIT IS NULL) AND BSNO='" + bsno + "' AND CUSTOMERNAME='" + feeobjname + "'"; }; sql = sql + getAndConSql(sql, this.FeeSqlStr, this.FeeSqlStr); isloadfee = false; this.storeAddFeeList.load({ params: { condition: sql, isdebit: isdebit }, callback: function (r, options, success) { if (success) { isloadfee = true; } } }); }, this); _this = this; this.gridAddList.on({ selectionchange: function (sm, selections) { _this.onSelectFee(); var SelectGridtext = Ext.getCmp('SelectGrid'); _this.storeSelectSum.removeAll(); SelectGridtext.setText(Zi.LAN.countfyong); //所选费用合计 if (selections.length == 0) { return; } var Duino = _this.formEdit.getForm().findField('DUINO').getValue(); var j = selections.length; for (var i = 0; i < selections.length; i++) { var rec = selections[i]; var rmbdr = rec.data.RMBDR; var rmbcr = rec.data.RMBCR; var usddr = rec.data.USDDR; var usdcr = rec.data.USDCR; var otdr = rec.data.OTDR; var otcr = rec.data.OTCR; var balrmbdr = rec.data.BALRMBDR; var balrmbcr = rec.data.BALRMBCR; var balusddr = rec.data.BALUSDDR; var balusdcr = rec.data.BALUSDCR; var balotdr = rec.data.BALOTDR; var balotcr = rec.data.BALOTCR; if (rmbdr != 0 || rmbcr != 0 || balrmbdr != 0 || balrmbcr != 0) { var isinsert = false; for (var z = 0; z < _this.storeSelectSum.getCount(); z++) { var sumrec = _this.storeSelectSum.getAt(z); if (sumrec.data.CURRENCY == 'RMB') { sumrec.set("DR", (parseFloat(sumrec.data.DR).add(parseFloat(rmbdr))).toFixed(2)); sumrec.set("NODR", (parseFloat(sumrec.data.NODR).add(parseFloat(balrmbdr))).toFixed(2)); sumrec.set("CR", (parseFloat(sumrec.data.CR).add(parseFloat(rmbcr))).toFixed(2)); sumrec.set("NOCR", (parseFloat(sumrec.data.NOCR).add(parseFloat(balrmbcr))).toFixed(2)); sumrec.commit(); isinsert = true; } } if (isinsert != true) { _this.storeSelectSum.add({ "CURRENCY": 'RMB', "DR": rmbdr, "NODR": balrmbdr, "CR": rmbcr, "NOCR": balrmbcr }); } } if (usddr != 0 || usdcr != 0 || balusddr != 0 || balusdcr != 0) { var isinsert = false; for (var z = 0; z < _this.storeSelectSum.getCount(); z++) { var sumrec = _this.storeSelectSum.getAt(z); if (sumrec.data.CURRENCY == 'USD') { sumrec.set("DR", (parseFloat(sumrec.data.DR).add(parseFloat(usddr))).toFixed(2)); sumrec.set("NODR", (parseFloat(sumrec.data.NODR).add(parseFloat(balusddr))).toFixed(2)); sumrec.set("CR", (parseFloat(sumrec.data.CR).add(parseFloat(usdcr))).toFixed(2)); sumrec.set("NOCR", (parseFloat(sumrec.data.NOCR).add(parseFloat(balusdcr))).toFixed(2)); sumrec.commit(); isinsert = true; } } if (isinsert != true) { _this.storeSelectSum.add({ "CURRENCY": 'USD', "DR": usddr, "NODR": balusddr, "CR": usdcr, "NOCR": balusdcr }); } } if (otdr != 0 || otcr != 0 || balotdr != 0 || balotcr != 0) { var isinsert = false; for (var z = 0; z < _this.storeSelectSum.getCount(); z++) { var sumrec = _this.storeSelectSum.getAt(z); if (sumrec.data.CURRENCY == '其他') { sumrec.set("DR", (parseFloat(sumrec.data.DR).add(parseFloat(otdr))).toFixed(2)); sumrec.set("NODR", (parseFloat(sumrec.data.NODR).add(parseFloat(balotdr))).toFixed(2)); sumrec.set("CR", (parseFloat(sumrec.data.CR).add(parseFloat(otcr))).toFixed(2)); sumrec.set("NOCR", (parseFloat(sumrec.data.NOCR).add(parseFloat(balotcr))).toFixed(2)); sumrec.commit(); isinsert = true; } } if (isinsert != true) { _this.storeSelectSum.add({ "CURRENCY": '其他', "DR": otdr, "NODR": balotdr, "CR": otcr, "NOCR": balotcr }); } } } SelectGridtext.setText(Zi.LAN.selectxuanzhong + j + Zi.LAN.pyewu); //'所选费用合计(选中' + j + '票业务)' } }); this.gridAddFeeList.getSelectionModel().on('select', function (button, event) { //Ext.getCmp("zongshu").setText("1234"); this.onSelectFee(button, event); }, this); this.gridAddFeeList.on('cellclick', function (button, event) { //Ext.getCmp("zongshu").setText("1234"); this.onSelectFee(button, event); }, this); LoadQueryData(this.formname, this.formSearch, this.CheckSaveQuery); Ext.Ajax.request({ waitMsg: '', url: '/MvcShipping/MsSysParamSet/GetData', params: { condition: "PARAMNAME='CUSTDUIISNOTREPEAT'" }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (result.Success != true) { } else { var data = result.data; if (data.PARAMVALUE == '1') { this.CUSTDUIISNOTREPEAT = 1; } else { } } } else { } }, scope: this }); }, //end initUIComponents InitData: function () { this.opStatus = 'add'; var condition = ''; if (this.ParentWin) { var ret = this.ParentWin.OprationSwap(); this.opStatus = ret[0]; this.StoreList = ret[1]; this.editRecord = ret[2]; } if (this.opStatus == 'edit') condition = " DUINO='" + this.editRecord.get('DUINO') + "'"; this.LoadData(this.opStatus, condition); }, //end InitData LoadData: function (opstatus, condition) { this.serialNo = 0; this.workSerialNo = 0; this.bodyDel = []; this.opStatus = opstatus; Ext.Ajax.request({ waitMsg: Zi.LAN.onselect, //正在查询主表数据... url: '/MvcShipping/MsChDui/GetData', params: { handle: opstatus, condition: condition }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (!result.Success) { Ext.Msg.show({ title: Zi.LAN.Prompt, //提示 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); _this.GetEditStatus(); if (this.opStatus == 'edit') { this.formSearch.getForm().findField('CUSTNAME').setValue(data.CUSTNAME); } var billno = this.formEdit.getForm().findField('DUINO').getValue(); var condition2 = " BSNO='" + billno + "' "; _this.storeDocList.load({ params: { condition: condition2 }, waitMsg: "正在查询数据...", scope: this, callback: function () { _this.Loading = false; } }); } else { Ext.MessageBox.alert(Zi.LAN.qqerror, response.responseText); //请求出现错误,请重试 } }, scope: this }); Ext.Ajax.request({ waitMsg: Zi.LAN.onselect, //正在查询主表数据... url: '/MvcShipping/MsSysParamSet/GetData', params: { handle: 'edit', condition: "PARAMNAME='ISSUBMITFEE'" }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (!result.Success) { Ext.Msg.show({ title: Zi.LAN.Prompt, //提示 msg: result.Message, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK }); return; } var data = result.data; this.formSearch.getForm().reset(); this.formSearch.getForm().setValues(data); } else {//请求出现错误,请重试 Ext.MessageBox.alert(Zi.LAN.qqerror, response.responseText); } }, scope: this }); if (opstatus == "add") { this.storeBodyList.removeAll(); this.storeFeeList.removeAll(); } else { this.storeBodyList.load({ params: { start: 0, limit: this.PageSize, condition: condition } }); } // this.storeFeeList.load({ params: { condition: " DUINO='" + billno + "'"} }); }, // end LoadDate Save: function (type) { var basicForm = this.formEdit.getForm(); if (!basicForm.isValid()) { return; } var data = basicForm.getValues(); Ext.Msg.wait(Zi.LAN.nowsave); //正在保存数据, 请稍侯.. Ext.Ajax.request({ waitMsg: Zi.LAN.baocunshujunow, url: '/MvcShipping/MsChDui/Save', scope: this, params: { opstatus: this.opStatus, data: Ext.JSON.encode(data) }, callback: function (options, success, response) { if (success) { Ext.MessageBox.hide(); var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { var returnData = jsonresult.Data; this.formEdit.getForm().setValues(returnData); if (this.opStatus == 'add') { var arrNewRecords = this.StoreList.add(returnData); this.editRecord = arrNewRecords[0]; } else if (this.opStatus == 'edit') { this.editRecord.commit(); } if (type == '0') { this.opStatus = 'edit'; } else if (type == '1') { window.close(); } else { this.LoadData('add', ''); } } else {//错误 Ext.Msg.show({ title: Zi.LAN.Error, msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } else {//请重试 Ext.Msg.show({ title: Zi.LAN.qagin, msg: Zi.LAN.FuWuQiError, //服务器响应出错 icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } }); }, //end save onAddDetailClick: function (button, event) { this.addDetail(); }, //end onAddDetailClick onDelDetailClick: function (button, event, type) { this.deleteDetail(); }, //onDelDetailClick onAddClick: function (button, event) { this.addBill(); }, //end onAddDetailClick onDeleteClick: function (button, event) { this.deleteBill(); }, //end onAddDetailClick gridAfterEdit: function (editor, e, eOpts) { //需要自己实现里面的事件 }, addDetail: function () { var basicForm = this.formEdit.getForm(); var Duino = this.formEdit.getForm().findField('DUINO').getValue(); if (Duino == '*') { var CUSTNAME = this.formEdit.getForm().findField('CUSTNAME').getValue(); if (CUSTNAME == null || CUSTNAME == "") { var selectedRecords = this.gridAddFeeList.selModel.getSelection(); if (selectedRecords.length > 0) { var rec = selectedRecords[0]; var cust = rec.data.CustomerName; if ((CUSTNAME == '') || (CUSTNAME == null)) this.formEdit.getForm().findField('CUSTNAME').setValue(cust); } else { //提示', msg: '対帐客户不能为空! Ext.Msg.show({ title: Zi.LAN.Prompt, msg: Zi.LAN.kehunotnull, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } // // // Ext.Msg.show({ title: Zi.LAN.Prompt, msg: '対帐客户不能为空!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); // return; } _this = this; var data = basicForm.getValues(); Ext.Msg.wait(Zi.LAN.nowsave); //正在保存数据, 请稍侯.. Ext.Ajax.request({ waitMsg: Zi.LAN.baocunshujunow, url: '/MvcShipping/MsChDui/Save', scope: this, params: { opstatus: this.opStatus, data: Ext.JSON.encode(data) }, callback: function (options, success, response) { if (success) { Ext.MessageBox.hide(); var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { var returnData = jsonresult.Data; this.formEdit.getForm().setValues(returnData); if (this.opStatus == 'add') { var arrNewRecords = this.StoreList.add(returnData); this.editRecord = arrNewRecords[0]; } else if (this.opStatus == 'edit') { this.editRecord.commit(); } this.opStatus = 'edit'; _this.addDetailfn(); } else {//错误 Ext.Msg.show({ title: Zi.LAN.Error, msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } else {//请重试 Ext.Msg.show({ title: Zi.LAN.qagin, msg: Zi.LAN.FuWuQiError, //服务器响应出错 icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } }); } else { this.addDetailfn(); }; }, //end save addDetailfn: function () { var Duino = this.formEdit.getForm().findField('DUINO').getValue(); if (Duino == '*') { Ext.Msg.show({ title: Zi.LAN.Prompt, msg:'当前账单未保存,不允许添加!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var duicust = this.editRecord.data.CUSTNAME; var duino = this.editRecord.data.DUINO; var billgroupcorp = this.GetGroupCorp(duicust); var selections = this.gridAddList.getSelectionModel().getSelection(); var record = selections[0]; var billduino = record.data.DUINO; var isdebit = record.data.ISDEBIT; var selectedRecords = this.gridAddFeeList.selModel.getSelection(); var bodyAddDatas = []; for (var i = 0; i < selectedRecords.length; i++) { var rec = selectedRecords[i]; var cust = rec.data.CustomerName; var bsno = rec.data.BSNO; var custgroupcorp = this.GetGroupCorp(cust); if (cust == duicust || cust == billgroupcorp || (custgroupcorp == billgroupcorp && custgroupcorp != '')) { bodyAddDatas.push(rec); } } if (bodyAddDatas.length == 0) {//没有要添加的费用明细 Ext.Msg.show({ title: Zi.LAN.Prompt, msg: Zi.LAN.notaddmingxi, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; }; var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas); Ext.Ajax.request({ waitMsg: Zi.LAN.addnumnow, //正在添加数据... url: '/MvcShipping/MsChDui/AddDetail', params: { duino: duino, data: jsonbodyAddDatas, isdebit: isdebit }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (!result.Success) { Ext.Msg.show({ title: Zi.LAN.Prompt, msg: result.Message, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK }); return; } else { var sql = ""; if (isdebit == '是') { sql = " DUINO='" + billduino + "' AND BSNO='" + bsno + "' and GID NOT IN (SELECT GID FROM V_DUI_FEE WHERE DUINO='" + Duino + "')"; } else { sql = " (ISDEBIT=0 or ISDEBIT IS NULL) AND BSNO='" + bsno + "'"; }; var feesqlstr = this.getFeeCondition(); sql = sql + getAndConSql(sql, feesqlstr, feesqlstr); this.storeAddFeeList.load({ params: { condition: sql, isdebit: isdebit} }); this.storeBodyList.load({ params: {start: 0, limit: this.PageSize, condition: " DUINO='" + duino + "'"} }); } } else {//请求出现错误,请重试 Ext.MessageBox.alert(Zi.LAN.qqerror, response.responseText); } }, scope: this }); }, addBill: function () { var basicForm = this.formEdit.getForm(); var Duino = this.formEdit.getForm().findField('DUINO').getValue(); if (Duino == '*') { var CUSTNAME = this.formEdit.getForm().findField('CUSTNAME').getValue(); if (CUSTNAME == null || CUSTNAME == "") { if (this.storeAddFeeList.getCount() > 0) { var rec = this.storeAddFeeList.getAt(0); var cust = rec.data.CustomerName; if ((CUSTNAME == '') || (CUSTNAME == null)) this.formEdit.getForm().findField('CUSTNAME').setValue(cust); } else { //对账客户不能为空 Ext.Msg.show({ title: Zi.LAN.Prompt, msg: Zi.LAN.duiznotnull, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } } _this = this; var data = basicForm.getValues(); //正在保存数据, 请稍侯 Ext.Msg.wait(Zi.LAN.nowsave); Ext.Ajax.request({ waitMsg: Zi.LAN.baocunshujunow, url: '/MvcShipping/MsChDui/Save', scope: this, params: { opstatus: this.opStatus, data: Ext.JSON.encode(data) }, callback: function (options, success, response) { if (success) { Ext.MessageBox.hide(); var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { var returnData = jsonresult.Data; this.formEdit.getForm().setValues(returnData); if (this.opStatus == 'add') { var arrNewRecords = this.StoreList.add(returnData); this.editRecord = arrNewRecords[0]; } else if (this.opStatus == 'edit') { this.editRecord.commit(); } this.opStatus = 'edit'; _this.addBillfn(); } else {//错误 Ext.Msg.show({ title: Zi.LAN.Error, msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } else { Ext.Msg.show({ title: Zi.LAN.qagin, msg: Zi.LAN.FuWuQiError, //服务器响应出错 icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } }); } else { this.addBillfn(); }; }, //end save addBillfn: function () { var basicForm = this.formEdit.getForm(); var Duino = this.formEdit.getForm().findField('DUINO').getValue(); if (Duino == '*') { Ext.Msg.show({ title: Zi.LAN.Prompt, msg: '当前账单未保存,不允许添加!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var duicust = this.editRecord.data.CUSTNAME; var duino = this.editRecord.data.DUINO; var feeBSNOSql = ''; var sql = ''; var selectedRecords = this.gridAddList.selModel.getSelection(); if (selectedRecords.length == 0) {//没有选择要添加的费用 Ext.Msg.show({ title: Zi.LAN.Prompt, msg: Zi.LAN.notselectaddfy, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; }; var bodyAddDatas = []; for (var i = 0; i < selectedRecords.length; i++) { var rec = selectedRecords[i]; if (rec.data.ISDEBIT == '是') { bodyAddDatas.push(rec); } else { var feeBSNO = "'" + rec.data.BSNO + "'"; if (feeBSNOSql == '') { feeBSNOSql = feeBSNO; } else { feeBSNOSql = feeBSNOSql + "," + feeBSNO; } } } if (feeBSNOSql == '') { sql = ""; } else { sql = " BSNO IN (" + feeBSNOSql + ")"; sql = sql + getAndConSql(sql, this.FeeSqlStr, this.FeeSqlStr); } var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas); Ext.Ajax.request({//正在添加数据... waitMsg: Zi.LAN.addnumnow, url: '/MvcShipping/MsChDui/AddBill', params: { duino: duino, duicust: duicust, data: jsonbodyAddDatas, feesql: sql }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (!result.Success) { Ext.Msg.show({ title: Zi.LAN.Prompt, msg: result.Message, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK }); return; } else { this.storeBodyAddList.reload(); this.storeBodyList.load({ params: { start: 0, limit: this.PageSize,condition: " DUINO='" + duino + "'"} }); } } else {//请求出现错误,请重试 Ext.MessageBox.alert(Zi.LAN.qqerror, response.responseText); } }, scope: this }); }, deleteDetail: function (type) { var selectedRecords = this.gridFeeList.selModel.getSelection(); if (selectedRecords.length == 0) {//没有要删除的费用明细 Ext.Msg.show({ title: Zi.LAN.Prompt, msg: Zi.LAN.addnumnow, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; }; var duino = this.editRecord.data.DUINO; var feeCH_IDSql = ''; for (var i = 0; i < selectedRecords.length; i++) { var rec = selectedRecords[i]; var feeCH_ID = "'" + rec.data.CH_ID + "'"; if (feeCH_IDSql == '') { feeCH_IDSql = feeCH_ID; } else { feeCH_IDSql = feeCH_IDSql + "," + feeCH_ID; } } var sql = " DEBITNO='" + duino + "' AND GID IN (" + feeCH_IDSql + ")"; var duisql = " CH_ID IN (" + feeCH_IDSql + ")"; Ext.Ajax.request({ waitMsg: Zi.LAN.nowdelete, //正在删除数据 url: '/MvcShipping/MsChDui/DelDetail', params: { feesql: sql, duisql: duisql }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (!result.Success) { Ext.Msg.show({ title: Zi.LAN.Prompt, msg: result.Message, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK }); return; } else { var selectedRecords = this.gridFeeList.selModel.getSelection(); for (var i = 0; i < selectedRecords.length; i++) { var rec = selectedRecords[i]; this.storeFeeList.remove(rec); } this.storeBodyList.load({ params: { start: 0, limit: this.PageSize,condition: " DUINO='" + duino + "'"} }); } } else {//请求出现错误,请重试 Ext.MessageBox.alert(Zi.LAN.qqerror, response.responseText); } }, scope: this }); }, deleteBill: function (type) { var selectedRecords = this.gridList.selModel.getSelection(); if (selectedRecords.length == 0) {//没有要删除明细 Ext.Msg.show({ title: Zi.LAN.Prompt, msg: Zi.LAN.nodeletemx, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; }; var duino = this.editRecord.data.DUINO; var feeBSNOSql = ''; for (var i = 0; i < selectedRecords.length; i++) { var rec = selectedRecords[i]; var feeBSNO = "'" + rec.data.BSNO + "'"; if (feeBSNOSql == '') { feeBSNOSql = feeBSNO; } else { feeBSNOSql = feeBSNOSql + "," + feeBSNO; } } var sql = " BSNO IN (" + feeBSNOSql + ")"; Ext.Ajax.request({//正在删除数据 waitMsg: Zi.LAN.nowdelete, url: '/MvcShipping/MsChDui/DelBill', params: { duino: duino, feesql: sql }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (!result.Success) { Ext.Msg.show({ title: Zi.LAN.Prompt, msg: result.Message, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK }); return; } else { this.storeBodyList.load({ params: { start: 0, limit: this.PageSize,condition: " DUINO='" + duino + "'" }, callback: function (r, options, success) { if (success) { if (r.length == 0) { var sql = " BSNO='11111111' "; this.storeFeeList.load({ params: { condition: sql} }); } } }, scope: this }); } } else {//请求出现错误,请重试 Ext.MessageBox.alert(Zi.LAN.qqerror, response.responseText); } }, scope: this }); }, onSubmitAuditClick: function () { var Duino = this.formEdit.getForm().findField('DUINO').getValue(); var billstatus = this.formEdit.getForm().findField('BILLSTATUS').getValue(); // var btnESave = Ext.getCmp('btnESave'); // isDisabled() if (Duino == '*') {//请先保存收费结算,然后才能锁定! Ext.Msg.show({ title: Zi.LAN.Prompt, msg: Zi.LAN.fsavetsuoding, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; }; if ((billstatus != 2)) { //当前状态无法锁定 Ext.Msg.show({ title: Zi.LAN.Prompt, msg: Zi.LAN.nowstatenosuoding, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var condition = " DUINO='" + Duino + "'"; _this = this; Ext.Ajax.request({//正在添加数据 waitMsg: Zi.LAN.addnumnow, url: '/MvcShipping/MsChDui/Lock', params: { bill: Duino }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (!result.Success) { Ext.Msg.show({ title: Zi.LAN.Prompt, msg: result.Message, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK }); return; } else { Ext.Ajax.request({//正在查询主表数据 waitMsg: Zi.LAN.onselect, url: '/MvcShipping/MsChDui/GetData', params: { handle: 'edit', condition: condition }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (!result.Success) { Ext.Msg.show({ title: Zi.LAN.Prompt, 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); _this.GetEditStatus(); } else {//请求出现错误,请重试 Ext.MessageBox.alert(Zi.LAN.qqerror, response.responseText); } }, scope: this }); } } else {//请求出现错误,请重试 Ext.MessageBox.alert(Zi.LAN.qqerror, response.responseText); } }, scope: this }); }, onSubmitAuditBackClick: function () { var Duino = this.formEdit.getForm().findField('DUINO').getValue(); var billstatus = this.formEdit.getForm().findField('BILLSTATUS').getValue(); if (Duino == '*') {//请先保存收费结算,然后才能撤销锁定 Ext.Msg.show({ title: Zi.LAN.Prompt, msg: Zi.LAN.saveone, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; }; if (billstatus != 1) { //当前状态无法撤销锁定 Ext.Msg.show({ title: Zi.LAN.Prompt, msg: Zi.LAN.savetwo, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var condition = " DUINO='" + Duino + "'"; _this = this; Ext.Ajax.request({//正在添加数据 waitMsg: Zi.LAN.addnumnow, url: '/MvcShipping/MsChDui/UnLock', params: { bill: Duino }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (!result.Success) { Ext.Msg.show({ title: Zi.LAN.Prompt, //提示 msg: result.Message, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK }); return; } else { Ext.Ajax.request({//正在查询主表数据 waitMsg: Zi.LAN.onselect, url: '/MvcShipping/MsChDui/GetData', params: { handle: 'edit', condition: condition }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (!result.Success) { Ext.Msg.show({ title: Zi.LAN.Prompt, 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); _this.GetEditStatus(); } else {//请求出现错误,请重试 Ext.MessageBox.alert(Zi.LAN.qqerror, response.responseText); } }, scope: this }); } } else {//请求出现错误,请重试 Ext.MessageBox.alert(Zi.LAN.qqerror, response.responseText); } }, scope: this }); }, onSubmitFeeClick: function () { var Duino = this.formEdit.getForm().findField('DUINO').getValue(); var billstatus = this.formEdit.getForm().findField('BILLSTATUS').getValue(); // var btnESave = Ext.getCmp('btnESave'); // isDisabled() if (Duino == '*') {//请先保存收费结算,然后才能锁定! Ext.Msg.show({ title: Zi.LAN.Prompt, msg: Zi.LAN.fsavetsuoding, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; }; var condition = " DUINO='" + Duino + "'"; _this = this; Ext.Ajax.request({//正在添加数据 waitMsg: Zi.LAN.addnumnow, url: '/MvcShipping/MsChDui/SubmitFee', params: { bill: Duino }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (!result.Success) { Ext.Msg.show({ title: Zi.LAN.Prompt, msg: result.Message, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK }); return; } else { Ext.Msg.show({ title: Zi.LAN.Prompt, msg: result.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); this.storeBodyList.load({ params: { start: 0, limit: this.PageSize, condition: " DUINO='" + Duino + "'" }, callback: function (r, options, success) { if (success) { if (r.length == 0) { var sql = " BSNO='11111111' "; this.storeFeeList.load({ params: { condition: sql } }); } } }, scope: this }); return; } } else {//请求出现错误,请重试 Ext.MessageBox.alert(Zi.LAN.qqerror, response.responseText); } }, scope: this }); }, onRefreshClick: function (button, event) { var sql = this.getCondition(); var duisql = this.getduiCondition(); var form = this.formSearch.getForm(); var isdebit = form.findField('ISDEBIT').getValue(); if (this.CUSTDUIISNOTREPEAT == 1) this.IsDebit = 2; else this.IsDebit = isdebit; this.PageSizeAdd = this.PagenumAdd.getValue(); this.storeBodyAddList.pageSize = this.PageSizeAdd; this.storeBodyAddList.currentPage = 1; this.storeBodyAddList.load({ params: { start: 0, limit: this.PageSizeAdd, sort: '', condition: this.BillSql, duicondition: this.DuiBillSql, isdebit: this.IsDebit }, waitMsg: Zi.LAN.NowSelect, //正在查询数据 callback: function (r, options, success) { if (success) { if (r.length == 0) { var sql = " BSNO='11111111' "; this.storeAddFeeList.load({ params: { condition: sql, isdebit: '否'} }); } } }, scope: this }); }, onDsQuery: function () { //var girdcolums = this.gridList.getColumnMode(); var sql = this.sqlcontext; this.getCondition(); this.getduiCondition(); var form = this.formSearch.getForm(); var isdebit = form.findField('ISDEBIT').getValue(); if (this.CUSTDUIISNOTREPEAT == 1) this.IsDebit = 2; else this.IsDebit = isdebit; this.BillSql = this.BillSql + getAndConSql(this.BillSql, sql, sql); this.DuiBillSql = this.DuiBillSql + getAndConSql(this.DuiBillSql, sql, sql); this.PageSizeAdd = this.PagenumAdd.getValue(); this.storeBodyAddList.pageSize = this.PageSizeAdd; this.storeBodyAddList.currentPage = 1; this.storeBodyAddList.load({ params: { start: 0, limit: this.PageSizeAdd, sort: '', condition: this.BillSql, duicondition: this.DuiBillSql, isdebit: this.IsDebit }, waitMsg: Zi.LAN.NowSelect, //正在查询数据 callback: function (r, options, success) { if (success) { if (r.length == 0) { var sql = " BSNO='11111111' "; this.storeAddFeeList.load({ params: { condition: sql, isdebit: '否'} }); } } }, scope: this }); }, onClearSql: function () { var form = this.formSearch.getForm(); form.reset(); }, getduiCondition: function () { var form = this.formSearch.getForm(); if (!form.isValid()) { Ext.Msg.alert(Zi.LAN.Prompt, Zi.LAN.SelectError); //提示', '查询条件赋值错误,请检查 return ''; } var Duino = this.formEdit.getForm().findField('DUINO').getValue(); var sql = ""; var customNo = form.findField('CustomNo').getValue(); sql = sql + getAndConSql(sql, customNo, " (B.CUSTNO like '%" + customNo + "%' or B.MBLNO like '%" + customNo + "%' or B.HBLNO like '%" + customNo + "%')"); // var OPLBNAME = form.findField('OPLBNAME').getValue(); // sql = sql + getAndConSql(sql, OPLBNAME, "B.OPLBNAME='" + OPLBNAME + "'"); // var BSTYPE = form.findField('BSTYPE').getValue(); // sql = sql + getAndConSql(sql, BSTYPE, "B.BSTYPE='" + BSTYPE + "'"); var VESSEL = form.findField('VESSEL').getValue(); sql = sql + getAndConSql(sql, VESSEL, "B.VESSEL='" + VESSEL + "'"); var VOYNO = form.findField('VOYNO').getValue(); sql = sql + getAndConSql(sql, VOYNO, "B.VOYNO like '%" + VOYNO + "%'"); var PORT = form.findField('Port').getValue(); sql = sql + getAndConSql(sql, PORT, " (B.PORTLOAD like '%" + PORT + "%' or B.PORTDISCHARGE like '%" + PORT + "%') "); var OURPORT = form.findField('OurPort').getValue(); sql = sql + getAndConSql(sql, OURPORT, " (B.PORTLOAD like '%" + OURPORT + "%' or B.PORTDISCHARGE like '%" + OURPORT + "%') "); var expDateBgn = form.findField('ExpDateBgn').getRawValue(); sql = sql + getAndConSql(sql, expDateBgn, "B.ETD >='" + expDateBgn + "'"); var expDateEnd = form.findField('ExpDateEnd').getRawValue(); sql = sql + getAndConSql(sql, expDateEnd, "B.ETD <='" + expDateEnd + "'"); // var ACCDATE = form.findField('ACCDATEFR').getRawValue(); // sql = sql + getAndConSql(sql, ACCDATE, "B.ACCDATE>='" + ACCDATE + "'"); // var ACCDATETO = form.findField('ACCDATETO').getRawValue(); // sql = sql + getAndConSql(sql, ACCDATETO, "B.ACCDATE<='" + ACCDATETO + "'"); var feesql = " F.DEBITNO<>'" + Duino + "' AND F.GID not in (select GID from v_dui_fee where DUINO='" + Duino + "') "; FeeSqlStr = this.getFeeCondition(); feesql = feesql + getAndConSql(feesql, FeeSqlStr, FeeSqlStr); // feesql = feesql + ')'; sql = sql + getAndConSql(sql, feesql, feesql); this.DuiBillSql = sql; return sql; }, getCondition: function () { var form = this.formSearch.getForm(); if (!form.isValid()) { Ext.Msg.alert(Zi.LAN.Prompt, Zi.LAN.SelectError); //提示', '查询条件赋值错误,请检查。 return ''; } var sql = ''; var customNo = form.findField('CustomNo').getValue(); sql = sql + getAndConSql(sql, customNo, " (B.CUSTNO like '%" + customNo + "%' or B.MBLNO like '%" + customNo + "%' or B.HBLNO like '%" + customNo + "%' or B.CUSTOMNO like '%" + customNo + "%')"); var PORT = form.findField('Port').getValue(); sql = sql + getAndConSql(sql, PORT, " (B.PORTLOAD like '%" + PORT + "%' or B.PORTDISCHARGE like '%" + PORT + "%') "); var OURPORT = form.findField('OurPort').getValue(); sql = sql + getAndConSql(sql, OURPORT, " (B.PORTLOAD like '%" + OURPORT + "%' or B.PORTDISCHARGE like '%" + OURPORT + "%') "); // var OPLBNAME = form.findField('OPLBNAME').getValue(); // sql = sql + getAndConSql(sql, OPLBNAME, "B.OPLBNAME='" + OPLBNAME + "'"); // var BSTYPE = form.findField('BSTYPE').getValue(); // sql = sql + getAndConSql(sql, BSTYPE, "B.BSTYPE='" + BSTYPE + "'"); var VESSEL = form.findField('VESSEL').getValue(); sql = sql + getAndConSql(sql, VESSEL, "B.VESSEL='" + VESSEL + "'"); var VOYNO = form.findField('VOYNO').getValue(); sql = sql + getAndConSql(sql, VOYNO, "B.VOYNO like '%" + VOYNO + "%'"); var expDateBgn = form.findField('ExpDateBgn').getRawValue(); sql = sql + getAndConSql(sql, expDateBgn, "B.ETD >='" + expDateBgn + "'"); var expDateEnd = form.findField('ExpDateEnd').getRawValue(); sql = sql + getAndConSql(sql, expDateEnd, "B.ETD <='" + expDateEnd + " 23:59:59'"); var ISHYF = form.findField('ISHYF').getValue(); if (ISHYF == '0') { sql = sql + getAndConSql(sql, ISHYF, " NOT EXISTS (select 1 from ch_fee WHERE B.BSNO=ch_fee.BSNO AND ch_fee.FEENAME='海运费') "); } // var ACCDATE = form.findField('ACCDATEFR').getRawValue(); // sql = sql + getAndConSql(sql, ACCDATE, "B.ACCDATE>='" + ACCDATE + "'"); // var ACCDATETO = form.findField('ACCDATETO').getRawValue(); // sql = sql + getAndConSql(sql, ACCDATETO, "B.ACCDATE<='" + ACCDATETO + "'"); var CUSTOMERNAME = form.findField('PS_CUSTOMERNAME').getValue(); sql = sql + getAndConSql(sql, CUSTOMERNAME, " B.CUSTOMERNAME='" + CUSTOMERNAME + "'"); var AGENTID = form.findField('PS_AGENT').getValue(); sql = sql + getAndConSql(sql, AGENTID, " B.AGENTID='" + AGENTID + "'"); var feesql = ' (F.ISDEBIT=0 or F.ISDEBIT IS NULL) '; this.FeeSqlStr = this.getFeeCondition(); feesql = feesql + getAndConSql(feesql, this.FeeSqlStr, this.FeeSqlStr); // feesql = feesql + ')'; sql = sql + getAndConSql(sql, feesql, feesql); // sql = sql + " and B.OPLB!='WMS' "; this.BillSql = sql; return sql; }, getFeeCondition: function () { var form = this.formSearch.getForm(); var feesql = ' F.FEESTATUS<>11 '; var CUSTNAME = form.findField('CUSTNAME').getValue(); feesql = feesql + getAndConSql(feesql, CUSTNAME, "F.CUSTOMERNAME='" + CUSTNAME + "'"); var DC = form.findField('DC').getValue(); feesql = feesql + getAndConSql(feesql, DC, "F.FEETYPE=" + DC); var Currency = form.findField('Currency').getValue(); feesql = feesql + getAndConSql(feesql, Currency, "F.Currency='" + Currency + "'"); var FeeName = this.getStrValue(this.comboxFeeNameRef.getValue()); feesql = feesql + getAndConSql(feesql, FeeName, "F.FeeName in (" + FeeName + ")"); var FEEFRT = form.findField('FEEFRT').getValue(); feesql = feesql + getAndConSql(feesql, FEEFRT, "F.FEEFRT='" + FEEFRT + "'"); var ISINVOICE = form.findField('ISINVOICE').getValue(); feesql = feesql + getAndConSql(feesql, ISINVOICE, "F.ISINVOICE=" + ISINVOICE); var ISADVANCEDPAY = form.findField('ISADVANCEDPAY').getValue(); feesql = feesql + getAndConSql(feesql, ISADVANCEDPAY, "F.ISADVANCEDPAY=" + ISADVANCEDPAY); var EnterDateBgn = form.findField('EnterDateBgn').getRawValue(); feesql = feesql + getAndConSql(feesql, EnterDateBgn, " F.EnterDate>='" + EnterDateBgn + "' "); var EnterDateEnd = form.findField('EnterDateEnd').getRawValue(); feesql = feesql + getAndConSql(feesql, EnterDateEnd, " F.EnterDate<='" + EnterDateEnd + " 23:59:59' "); var FEERANGE = form.findField('FEERANGE').getValue(); if (FEERANGE == '' || FEERANGE == null || FEERANGE == undefined) { } else { if (feesql == '') { if (FEERANGE == 'B') { feesql = 'F.AMOUNT<> F.SETTLEMENT' } else if (FEERANGE == 'S') { feesql = 'F.SETTLEMENT<>0' } else if (FEERANGE == '审核通过') { feesql = ' F.FEESTATUS IN (0,8,9) ' } else if (FEERANGE == '已付未收') { feesql = ' F.BSNO IN (select BSNO from v_op_gain_sum WHERE v_op_gain_sum.STLTTLCR<>0 AND (v_op_gain_sum.TTLDR=0 OR v_op_gain_sum.TTLDR<>v_op_gain_sum.STLTTLDR) ) ' }else if (FEERANGE == '已收未付') { feesql = ' F.BSNO IN (select BSNO from v_op_gain_sum WHERE v_op_gain_sum.STLTTLDR<>0 AND (v_op_gain_sum.TTLCR=0 OR v_op_gain_sum.TTLCR<>v_op_gain_sum.STLTTLCR) ) ' } else if (FEERANGE == '仅已开发票') { feesql = ' ISNULL(F.INVOICE,0)<>0 ' } else if (FEERANGE == '仅未开发票') { feesql = ' ISNULL(F.INVOICE,0)<>F.AMOUNT ' } else if (FEERANGE == '仅已开发票未收款') { feesql = ' ISNULL(F.INVOICE,0)<>0 AND ((F.AMOUNT>0 and ISNULL(F.INVOICE,0)>ISNULL(F.SETTLEMENT,0)) or (F.AMOUNT<0 and ISNULL(F.INVOICE,0) F.SETTLEMENT' } else if (FEERANGE == 'S') { feesql = feesql +' and F.SETTLEMENT<>0 ' } else if (FEERANGE == '审核通过') { feesql = feesql +' AND F.FEESTATUS IN (0,8,9) ' } else if (FEERANGE == '已付未收') { feesql = feesql + ' and F.BSNO IN (select BSNO from v_op_gain_sum WHERE v_op_gain_sum.STLTTLCR<>0 AND (v_op_gain_sum.TTLDR=0 OR v_op_gain_sum.TTLDR<>v_op_gain_sum.STLTTLDR) ) ' } else if (FEERANGE == '已收未付') { feesql = feesql + ' and F.BSNO IN (select BSNO from v_op_gain_sum WHERE v_op_gain_sum.STLTTLDR<>0 AND (v_op_gain_sum.TTLCR=0 OR v_op_gain_sum.TTLCR<>v_op_gain_sum.STLTTLCR) ) ' } else if (FEERANGE == '仅已开发票') { feesql = feesql + ' and ISNULL(F.INVOICE,0)<>0 ' } else if (FEERANGE == '仅未开发票') { feesql = feesql + ' and ISNULL(F.INVOICE,0)<>F.AMOUNT ' } else if (FEERANGE == '仅已开发票未收款') { feesql = feesql + ' and ISNULL(F.INVOICE,0)<>0 AND ((F.AMOUNT>0 and ISNULL(F.INVOICE,0)>ISNULL(F.SETTLEMENT,0)) or (F.AMOUNT<0 and ISNULL(F.INVOICE,0)0 AND ((F.AMOUNT>0 and ISNULL(F.SETTLEMENT,0)>ISNULL(F.INVOICE,0)) or (F.AMOUNT<0 and ISNULL(F.SETTLEMENT,0)0 AND ISNULL(F.INVOICE,0)<>0 and F.FEETYPE=1 ' } else if (FEERANGE == '仅未开票未收款') { feesql = feesql + ' and ISNULL(F.SETTLEMENT,0)=0 AND ISNULL(F.INVOICE,0)=0 and F.FEETYPE=1 ' } else if (FEERANGE == '审核通过未结算') { feesql = FeeSql+ ' and F.FEESTATUS IN (0,8,9) AND ISNULL(F.SETTLEMENT,0)=0 ' } } } // var PARAMVALUE = form.findField('PARAMVALUE').getValue(); // if (PARAMVALUE == '' || PARAMVALUE == null || PARAMVALUE == undefined) { // } // else { // if (feesql == '') { // if (PARAMVALUE == '是') { // feesql = ' F.FEESTATUS<>1' // } // } // else { // if (PARAMVALUE == '是') { // feesql = feesql + 'and F.FEESTATUS<>1' // } // } // } return feesql; }, getStrValue: function (list) { var _list = []; for (var _i = 0; _i < list.length; _i++) { _list.push("'" + list[_i] + "'"); } return _list; }, GetGroupCorp: function (custname) { _this = this; var records = DsStoreQueryBy(_this.StoreClientGroup, 'SHORTNAME', custname); if (records.getCount() > 0) { return records.getAt(0).data.PCORPNAME; } else { return ''; } }, onSelectFee: function (button, event) { //Ext.getCmp("zongshu").setText("1234"); var selectedRecords = this.gridAddFeeList.selModel.getSelection(); var sum = 0; for (var i = 0; i < selectedRecords.length; i++) { var rec = selectedRecords[i]; sum = sum + rec.get("Amount"); } sum = sum.toFixed(2); Ext.getCmp("zongshu").setText(" 选中金额:" + sum); }, //#region 上传图片 onAddFileClick: function (button, event) { var myDate = new Date(); var record = Ext.create('ReceiptDocmb', { GID: NewGuid(), RECEIPTTYPE: '', R_GID: '', BSNO: '', //ContractNo URL: '', Driect_URL: '', ISPUBLIC: '0', MODIFIEDUSER: SHOWNAME, MODIFIEDTIME: myDate.format('yyyy-MM-dd hh:mm:ss') }); this.storeDocList.add(record); var n = this.storeDocList.getCount(); this.DocListCellEditing.startEditByPosition({ row: n - 1, column: 5 }); } , onPostFileClick: function (button, event) { if (USERID == "") { alert("登录信息不全,请退出重新登录"); return; } var billno = this.formEdit.getForm().findField('DUINO').getValue(); var bodyDatas = []; var i; for (var i = 0; i < this.storeDocList.getCount(); i += 1) { var member = this.storeDocList.getAt(i); bodyDatas.push(member); } var DocBody = ConvertRecordsToJsonAll(bodyDatas); _this = this; //var Docdatas = []; //var DocBody = ConvertRecordsToJson(Docdatas); //var DocBodyDel = ConvertRecordsToJsonAll(this.DocDel); var _this = this; Ext.Msg.wait('正在保存数据, 请稍侯..'); Ext.Ajax.request({ waitMsg: '正在保存数据...', url: '/MvcShipping/MsOpReceipt/SaveUploadFile', scope: this, params: { data: DocBody }, callback: function (options, success, response) { if (success) { Ext.MessageBox.hide(); var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { var condition = billno; var condition2 = " BSNO='" + condition + "' "; _this.Loading = true; _this.storeDocList.load({ params: { condition: condition2 }, waitMsg: "正在查询数据...", scope: this, callback: function () { _this.Loading = false; } }); } 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 }); } //alert('03'); } }); } //end save , onDelFileClick: function (button, event) { var feeGidSql = ''; var selectedRecords = []; selectedRecords = this.DocCM.selected.items; if (selectedRecords.length == 0) { Ext.Msg.show({ title: '提示', msg: '请先选择要删除的附件!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } Ext.MessageBox.confirm('提示', '确定要删除选中的附件吗?', function (btn) { if (btn == 'yes') { if (selectedRecords.length > 0) { for (var i = 0; i < selectedRecords.length; i++) { var rec = selectedRecords[i]; if (rec.data.GID == "*") //如果是新增但没有保存的数据,没有必要提交到后台 { this.storeDocList.remove(selectedRecords[i]); } else { var feeGId = "'" + rec.data.GID + "'"; if (feeGidSql == '') { feeGidSql = feeGId; } else { feeGidSql = feeGidSql + "," + feeGId; } } } } _this = this; Ext.Msg.wait('正在删除数据...'); if (feeGidSql != '') { Ext.Ajax.request({ waitMsg: '正在删除数据...', url: '/MvcShipping/MsOpReceipt/DeleteUploadFile', params: { data: feeGidSql }, callback: function (options, success, response) { if (success) { var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { for (var i = 0; i < selectedRecords.length; i++) { this.storeDocList.remove(selectedRecords[i]); } Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); } else { Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } }, failure: function (response, options) { Ext.Msg.show({ title: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); }, success: function (response, options) { }, scope: this }); //end Ext.Ajax.request } else { Ext.Msg.show({ title: '提示', msg: "删除成功!", icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); } } }, this); } , onUpLoadFileClick: function (button, event) { var billno = this.formEdit.getForm().findField('DUINO').getValue(); //枚举维护表tSysEnumValue_附件类型97048 //需求编号:SR2017081100003 this.storeFileType = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.TSysEnumValueDataModel', proxy: { url: '/CommMng/BasicDataRef/GetTSysEnumValueList' } }); this.storeFileType.load({ params: { condition: " and EnumTypeID=97048" } }); var comboxFileType = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '附件类型', store: this.storeFileType, forceSelection: true, id: 'FILETYPE', name: 'FILETYPE', valueField: 'EnumValueName', displayField: 'EnumValueName' }); me = this; var imgform = new Ext.FormPanel({ region: 'center', labelWidth: 40, frame: true, //bodyStyle: 'padding:5px 5px 0', //autoScroll: true, border: false, fileUpload: true, items: [{ xtype: 'fileuploadfield', id: 'LoadFile', name: 'LoadFile', emptyText: '请选择文件', fieldLabel: '文件', buttonText: '选择文件', allowBlank: false, buttonCfg: { iconCls: 'uploaddialog' }, anchor: '98%' }, comboxFileType, { xtype: 'textfield', id: 'DOCUMENTATTACHEDCODE', name: 'DOCUMENTATTACHEDCODE', fieldLabel: '随附单证代码'//需求编号:SR2017081100003 }, { xtype: 'textfield', id: 'DOCUMENTATTACHEDNO', name: 'DOCUMENTATTACHEDNO', fieldLabel: '随附单证编号'//需求编号:SR2017081100003 }], buttons: [{ text: '上传', type: 'submit', handler: function () { var UserFilePath = Ext.getCmp('LoadFile').getValue(); // if (!CheckFileExt(UserFilePath, /.jpg|.gif|.png|.bmp|.pdf/i)) { // Ext.Msg.show({ title: '错误', msg: '请确认你上传的文件为图片文件!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); // return; // } if (!imgform.form.isValid()) { return; } imgform.form.submit({ url: '/MvcShipping/MsOpReceipt/UploadFile', waitMsg: '正在上传', method: 'POST', submitEmptyText: false, async: false, params: { CUSTNO: billno, BSNO: billno, TYPE: comboxFileType.getRawValue(), DOCUMENTATTACHEDCODE: Ext.getCmp('DOCUMENTATTACHEDCODE').getValue(), //需求编号:SR2017081100003 DOCUMENTATTACHEDNO: Ext.getCmp('DOCUMENTATTACHEDNO').getValue() //需求编号:SR2017081100003 }, success: function (form, action) { win.close(this); Ext.Msg.show({ title: '提示', msg: '上传成功!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); var condition = billno; var condition2 = " BSNO='" + condition + "' "; me.Loading = true; me.storeDocList.load({ params: { condition: condition2 }, waitMsg: "正在查询数据...", scope: this, callback: function () { me.Loading = false; } }); }, failure: function (form, action) { form.reset(); // if (action.failureType == Ext.form.Action.SERVER_INVALID) { // Ext.MessageBox.alert('警告', action.result.errors.msg); // } } }); } }, { text: '关闭', type: 'submit', handler: function () { win.close(this); } }] }); var win = new Ext.Window({ title: "上传文件", width: 360, height: 200, modal: true, resizable: false, border: false, items: imgform }); win.show(); } , //#endregion GetEditStatus: function () { var canedit = false; this.formEdit.getForm().findField('BILLSTATUS').setDisabled(false); var bsStatus = this.formEdit.getForm().findField('BILLSTATUS').getValue(); var op = this.formEdit.getForm().findField('OP').getValue(); this.formEdit.getForm().findField('BILLSTATUS').setDisabled(true); var btnESubmitAudit = Ext.getCmp('btnSubmitAudit'); var btnESubmitAuditBack = Ext.getCmp('btnSubmitAuditBack'); Ext.Ajax.request({ waitMsg: '', url: '/MvcShipping/MsBaseInfo/GetUserModuleEnable', params: { modulename: "modChduiCancelAudit" }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (result.Success != true) { btnESubmitAuditBack.disable(); } else { btnESubmitAuditBack.enable(); } } else { } }, scope: this }); _this = this; if (bsStatus != 2) { canedit = false; this.setSaveBtnStatus(canedit); this.StoreOpRange.load({ params: { optype: "modChDuiFeeList" }, callback: function (r, options, success) { if (success) { if (r.length != 0) { var records = DsStoreQueryBy(_this.StoreOpRange, 'OPID', op); if (records.getCount() > 0) { canedit = true; if (bsStatus == 1) { btnESubmitAudit.disable(); } else { btnESubmitAudit.enable(); } } else { canedit = false; btnESubmitAudit.disable(); } if (op == '') canedit = true; } } } }); } else { this.StoreOpRange.load({ params: { optype: "modChDuiFeeList" }, callback: function (r, options, success) { if (success) { if (r.length != 0) { var records = DsStoreQueryBy(_this.StoreOpRange, 'OPID', op); if (records.getCount() > 0) { canedit = true; if (bsStatus == 1) { btnESubmitAudit.disable(); } else { btnESubmitAudit.enable(); } } else { canedit = false; btnESubmitAudit.disable(); } if (op == '') canedit = true; _this.setSaveBtnStatus(canedit); } } } }); } Ext.Ajax.request({ waitMsg: Zi.LAN.ZhengZaiChaXunShuJu, //'正在查询委托编号状态...', url: '/MvcShipping/MsSysBillNoSet/GetData', params: { condition: "OPLBNAME='客户对账'", handle: 'edit' }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (result.Success != true) { var custno = _this.formEdit.getForm().findField('DUINO'); custno.setReadOnly(true); } else { var data = result.data; if (data.ISEDIT == '1') { var custno = _this.formEdit.getForm().findField('DUINO'); custno.setReadOnly(false); } else { if (data.RULEBLNO == '') { var custno = _this.formEdit.getForm().findField('DUINO'); custno.setReadOnly(false); } else { var custno = _this.formEdit.getForm().findField('DUINO'); custno.setReadOnly(true); } } } } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: this }); }, setSaveBtnStatus: function (enable) { var btnESave = Ext.getCmp('btnESave'); var btnESaveAndClose = Ext.getCmp('btnESaveAndClose'); var btnESaveAndNew = Ext.getCmp('btnESaveAndNew'); var btnEAddDetail = Ext.getCmp('btnadddetail'); var btnEDeleteDetail = Ext.getCmp('btnEDeleteDetail'); var btnEAddDetailfee = Ext.getCmp('btnadddetailFee'); var btnEDeleteDetailfee = Ext.getCmp('btnEDeleteDetailFee'); if (enable) { btnESave.enable(); btnESaveAndClose.enable(); btnESaveAndNew.enable(); btnEAddDetail.enable(); btnEDeleteDetail.enable(); btnEAddDetailfee.enable(); btnEDeleteDetailfee.enable(); } else { btnESave.disable(); btnESaveAndClose.disable(); btnESaveAndNew.disable(); btnEAddDetail.disable(); btnEDeleteDetail.disable(); btnEAddDetailfee.disable(); btnEDeleteDetailfee.disable(); } }, PrevRecord: function () { var j = this.StoreList.indexOf(this.editRecord); if (j == 0) { Ext.Msg.show({ title: Zi.LAN.JingGao, msg: Zi.LAN.YiShiZuiQianYiPiao, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });//'已是最前一票' return; } if (j == this.StoreList.count) { Ext.Msg.show({ title: Zi.LAN.JingGao, msg: Zi.LAN.YiShiZuiHouYiPiao, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });//'已是最后一票' return; } j = j - 1; this.editRecord = this.StoreList.getAt(j); if (this.opStatus == 'edit') { condition = " DUINO='" + this.editRecord.get('DUINO') + "'"; //this.storeBodyList.load({ params: { condition: condition} }); } this.LoadData(this.opStatus, condition); }, NextRecord: function () { var j = this.StoreList.indexOf(this.editRecord); if (j == (this.StoreList.data.length - 1)) { Ext.Msg.show({ title: Zi.LAN.JingGao, msg: Zi.LAN.YiShiZuiHouYiPiao, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });//'已是最后一票' return; } j = j + 1; this.editRecord = this.StoreList.getAt(j); if (this.opStatus == 'edit') { condition = " DUINO='" + this.editRecord.get('DUINO') + "'"; } this.LoadData(this.opStatus, condition); }, Print: function () { var basicForm = this.formEdit.getForm(); var billNo = basicForm.findField('DUINO').value; if (billNo == '*' || billNo == '') {//错误', msg: '单据还没有保存,请保存后再打印 Ext.Msg.show({ title: Zi.LAN.Error, msg: Zi.LAN.djnotsave, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); return; } var sortstr = ' b.ETD,b.MBLNO'; if (this.sortfield != '' && this.sortdire != '') { sortstr = this.sortfield + ' ' + this.sortdire; } var printType = 'MSCHDUI'; var sql1 = "SELECT *,(select DESCRIPTION from info_client where SHORTNAME=CH_DUI.CUSTNAME) CUSTFULLNAME FROM CH_DUI WHERE DUINO='" + billNo + "'"; var sql2 = "SELECT distinct d.BSNO,d.DUINO,b.MBLNO,b.CUSTNO,b.CUSTOMERNAME,b.VESSEL,b.VOYNO,b.ETD,b.ACCDATE,b.SALE,b.HBLNO,b.PORTLOAD,b.PORTDISCHARGE,b.CNTRTOTAL,"; sql2 = sql2 + "b.PKGS,b.KGS,b.CBM,f.RMBDR,f.RMBCR,f.RMBDR-f.STLRMBDR AS BALRMBDR,f.RMBCR-f.STLRMBCR AS BALRMBCR,f.USDDR,f.USDCR "; sql2 = sql2 + " ,f.USDDR-f.STLUSDDR AS BALUSDDR,f.USDCR-f.STLUSDCR AS BALUSDCR,f.OTDR,f.OTCR,f.OTDR-f.STLOTDR AS BALOTDR,f.OTCR-f.STLOTCR as BALOTCR "; sql2 = sql2 + " from ch_dui_bill d left join v_op_bill b on (b.BSNO=d.BSNO) left join v_dui_allfee_sum f on (f.BSNO=d.BSNO and f.DEBITNO=d.DUINO) "; sql2 = sql2 + " where d.DUINO='" + billNo + "' ORDER BY " + sortstr; var sql3 = "SELECT f.DUINO,f.BSNO,f.GID AS CH_ID,(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=99020 and EnumValueID=f.FeeType) as FeeType_Ref "; sql3 = sql3 + ",f.feeName,f.customerName,f.amount,f.amount-f.Settlement as balamount,f.currency,f.exChangerate from v_dui_fee f where f.DUINO='" + billNo + "'"; var sql4 = ""; var sql5 = ""; var sql6 = ""; PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6); }, ModulPrint: function () { var basicForm = this.formEdit.getForm(); var billNo = basicForm.findField('DUINO').value; if (billNo == '*' || billNo == '') {//错误', msg: '单据还没有保存,请保存后再打印 Ext.Msg.show({ title: Zi.LAN.Error, msg: Zi.LAN.djnotsave, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); return; } if (this.formEdit.getForm().isDirty() == true) { Ext.Msg.show({ title: Zi.LAN.Error, msg: Zi.LAN.djnotsave, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); return; } var DMID = basicForm.findField('DM_ID').value; if (DMID == '*' || DMID == '') {//错误', msg: '请选择打印模板,保存后再打印 Ext.Msg.show({ title: Zi.LAN.Error, msg: Zi.LAN.savethree, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); return; } var ISNOTAX = basicForm.findField('ISNOTAX').value; var aurl = '/MvcShipping/MsChDui/GetPrintStr'; if (ISNOTAX == '1') aurl = '/MvcShipping/MsChDui/GetNoTaxPrintStr'; var data = basicForm.getValues(); Ext.Msg.wait(Zi.LAN.zhuzhidata); //正在组织数据, 请稍侯.. Ext.Ajax.request({ waitMsg: Zi.LAN.zhuzhidatanow, url: aurl, scope: this, params: { data: Ext.JSON.encode(data) }, callback: function (options, success, response) { if (success) { Ext.MessageBox.hide(); var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { var returnstr = jsonresult.Data; var printType = 'MSCHDUIMODULE' + DMID; var sql1 = "SELECT *,(select DESCRIPTION from info_client where SHORTNAME=CH_DUI.CUSTNAME) CUSTFULLNAME FROM CH_DUI WHERE DUINO='" + billNo + "'"; var sql2 = returnstr; var sql3 = "SELECT f.DUINO,f.BSNO,f.GID AS CH_ID,(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=99020 and EnumValueID=f.FeeType) as FeeType_Ref "; sql3 = sql3 + ",f.feeName,f.customerName,f.amount,f.amount-f.Settlement as balamount,f.currency,f.exChangerate,f.UNITPRICE,f.QUANTITY,f.UNIT,f.NOTAXAMOUNT from v_dui_fee f where f.DUINO='" + billNo + "'"; var sql4 = ""; var sql5 = ""; var sql6 = ""; PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6); } else {//错误 Ext.Msg.show({ title: Zi.LAN.Error, msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } else { Ext.Msg.show({ title: Zi.LAN.qagin, msg: Zi.LAN.FuWuQiError, //服务器响应出错 icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } }); } });