Ext.namespace('Shipping'); Shipping.MsChPaysettlementIndex = function (config) { Ext.applyIf(this, config); this.initUIComponents(); window.Shipping.MsChPaysettlementIndex.superclass.constructor.call(this); }; Ext.extend(Shipping.MsChPaysettlementIndex, Ext.Panel, { PageSize: 30, OprationStatus: null, //仅当弹出界面时使用 SelectedRecord: null, sqlcontext: '', strCwSTARTGID: '', sortfield: '', sortdire: '', initUIComponents: function () { this.formname = "formPaysettlementIndex"; //页面名称 this.MsPeriod = null; this.STLSHOWVOU = 0; this.ISRATESET = 0; _this = this; this.StoreLockOp = Ext.create('DsExt.ux.RefTableStore', { model: 'MsFeeOP', proxy: { url: '/MvcShipping/MsBaseInfo/GetOpIDRang' } }); this.StoreLockOp.load({ params: { optype: "modPayFeeSettlementLock"} }); this.StoreUnLockOp = Ext.create('DsExt.ux.RefTableStore', { model: 'MsFeeOP', proxy: { url: '/MvcShipping/MsBaseInfo/GetOpIDRang' } }); this.StoreUnLockOp.load({ params: { optype: "modPayFeeSettlementUnLock"} }); this.StoreOpRange = Ext.create('DsExt.ux.RefTableStore', { model: 'MsOP', proxy: { url: '/MvcShipping/MsBaseInfo/GetOpRang' } }); this.StoreOpRange.load({ params: { optype: "modPaySettlementList"} }); //定义数据集 this.storeList = Ext.create('Ext.data.Store', { pageSize: this.PageSize, model: 'MsChSettlement', remoteSort: true, proxy: { type: 'ajax', url: '/Account/Chfee_settlement/GetDataList', reader: { id: 'BILLNO', root: 'data', totalProperty: 'totalCount' } } }); this.initgirdcolums = [{ sortable: true, dataIndex: 'BILLNO', header: Zi.LAN.BillNo, width: 120 }, { sortable: true, dataIndex: 'BILLSTATUS', header: Zi.LAN.BillStatus, width: 60, renderer: function (value, meta, record) { value = record.data.BILLSTATUSREF; if (value == '锁定') { meta.tdCls = 'feestatus_pass'; } return record.data.BILLSTATUSREF; } }, { sortable: true, dataIndex: 'CUSTOMERNAME', header: Zi.LAN.CustomerName, width: 120 }, { sortable: true, dataIndex: 'SETTLEMODEREF', header: Zi.LAN.JieSuanLeiBie, width: 100 }, { sortable: true, dataIndex: 'SETTLETYPEREF', header: Zi.LAN.SettlementType, width: 100 }, { sortable: true, dataIndex: 'CURR', header: Zi.LAN.Currency, width: 50 }, { sortable: true, dataIndex: 'AMOUNTRMB', 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: 120 }, { sortable: true, dataIndex: 'AMOUNTUSD', 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: 120 }, { sortable: true, dataIndex: 'AMOUNTOT', header: Zi.LAN.OtherCurrency, 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: 120 }, { sortable: true, dataIndex: 'ACCOUNTREF', header: Zi.LAN.JieSuanAccount , width: 150 }, { sortable: true, dataIndex: 'NOINVOICE', header: Zi.LAN.WeiKaiPiao, width: 120 }, { sortable: true, dataIndex: 'SETTLETIME', header: Zi.LAN.SettlementTime, width: 100 }, { sortable: true, dataIndex: 'SETTLEUSERREF', header: Zi.LAN.SettlementUser, width: 100 }, { sortable: true, dataIndex: 'ISEXPORT', header: Zi.LAN.IsExportCerft, width: 120 }, { sortable: true, dataIndex: 'ISNOTVOU', header: '禁止生成凭证', width: 120, renderer: function (value, meta, record) { if (value == true) { value = '是'; } else value = '否'; return value; } }, { sortable: true, dataIndex: 'ISCHEQUE', header: Zi.LAN.CreateCheque, width: 120 }, { sortable: true, dataIndex: 'REMARK', header: Zi.LAN.Remark, width: 160 }, { sortable: true, dataIndex: 'VOUCHERNO', header: Zi.LAN.VoucherNo, width: 100, renderer: function (value, meta, record) { var openSet = "height=1000, width=950, toolbar=no, menubar=no,scrollbars=1, resizable=1,location=no, status=no,Top= " + (screen.height - 250) / 2 + ",Left= " + (screen.width - 600) / 2 var openType = "_blank"; var openUrl = ""; openUrl = "../../MvcShipping/MsCwVouchersGl/Edit?handle=check&ordno=" + record.data.VOUNO; var winstr = "window.open(this.href,'" + openType + "','" + openSet + "')"; value = '' + value + '' return value; } }, { sortable: true, dataIndex: 'SALECORP', header: Zi.LAN.DepartmentName, width: 100 }, { sortable: true, dataIndex: 'FEEAMOUNT', header: Zi.LAN.OriginalMoney, width: 100, 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: 'PAYBILLNO', header: Zi.LAN.ApplyNo, width: 100 }, { sortable: true, dataIndex: 'SETTLENO', header: Zi.LAN.SettlementNo, width: 100 }, { sortable: true, dataIndex: 'ACCOUNTS_MONEY', header: Zi.LAN.BookKeepingData, width: 100, 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: 'PREPAY_MONEY', header: Zi.LAN.PrepaidData, width: 100, 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: 'AHSR_MONEY', header:Zi.LAN.RelPaidData, width: 100, 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: 'FINANCIAL_MONEY', header: Zi.LAN.FinanceCose, width: 100, 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: 'ADVANCE_MONEY', header: Zi.LAN.PrepaidUseData, width: 100, 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: 'BILLDATE', header: Zi.LAN.BILLDATE, width: 100 }]; this.girdcolums = this.initgirdcolums; //定义Grid this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel'); this.Pagenum = Ext.create('Ext.form.field.Number', { name: 'bottles', fieldLabel: Zi.LAN.PageNum, labelAlign: 'right', value: this.PageSize, maxValue: 100000, width: 180, minValue: 0, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }); Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, { width: 40 }); this.gridList = new Ext.grid.GridPanel({ store: this.storeList, enableHdMenu: false, region: 'center', loadMask: { msg: Zi.LAN.LoadData }, trackMouseOver: true, disableSelection: false, selModel: this.GridCheckBoxModel, viewConfig: { enableTextSelection: true }, features: [{ ftype: 'summary'//Ext.grid.feature.Summary表格汇总特性 }], columns: this.girdcolums, // paging bar on the bottom bbar: [Ext.create('Ext.PagingToolbar', { store: this.storeList, displayInfo: true, displayMsg: Zi.LAN.FenYe, emptyMsg: Zi.LAN.DataEmptyMsg }), this.Pagenum] }); this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) { this.SelectedRecord = record; this.OprationStatus = 'edit'; if (record.data.SETTLEMODE == 1) DsOpenEditWin('/Account/Chfee_settlement/PayAppEdit'); else if (record.data.SETTLEMODE == 3) DsOpenEditWin('/Account/Chfee_settlement/PayInvEdit'); else DsOpenEditWin('/Account/Chfee_settlement/PayBLEdit'); }, this); this.girdcolums = DsTruck.GetGridPanel(USERID, this.formname, this.girdcolums, 1); //使用者id,表名,中间column数组,跳过一开始的几列 this.girdcolums.unshift(new Ext.grid.RowNumberer()); this.gridList.reconfigure(this.storeList, this.girdcolums); this.gridList.addListener('sortchange', function (ct, column, direction, eOpts) { this.sortfield = column.dataIndex; this.sortdire = direction; }, this); //#region formSearch //#region formSearch枚举参照相关 //#endregion this.storeCust = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' } }); this.storeCust.load({ params: { condition: ""} }); this.comboxCust = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: Zi.LAN.CustomerName, store: this.storeCust, // forceSelection: true, name: 'CustName', valueField: 'CustName', displayField: 'CodeAndName', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }); this.storeISVOU = Ext.create('Ext.data.Store', { fields: ['FSTATUS', 'NAME'] }); this.storeISVOU.add({ "FSTATUS": "1", "NAME": Zi.LAN.Yes }); this.storeISVOU.add({ "FSTATUS": "0", "NAME": Zi.LAN.No }); this.comboxISVOU = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: Zi.LAN.AddCwVouchers , store: this.storeISVOU, valueField: 'FSTATUS', displayField: 'NAME', flex: 0.7, // flex: 0.7, // labelWidth: 55, forceSelection: true, name: 'ISVOU', value: '', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }); _this = this; this.formSearch = Ext.widget('form', { frame: true, region: 'center', bodyPadding: 5, fieldDefaults: { margins: '2 2 2 2', labelAlign: 'right', flex: 1, labelWidth: 70, msgTarget: 'qtip' }, items: [ {//fieldset 1 xtype: 'container', defaultType: 'textfield', layout: 'anchor', defaults: { anchor: '100%' }, items: [{ xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: Zi.LAN.BillNo, name: 'BsNo', enableKeyEvents: true, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, this.comboxCust, { fieldLabel: Zi.LAN.ApplyBillNo, name: 'ShenNo', enableKeyEvents: true, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, { fieldLabel: Zi.LAN.VoucherNo, name: 'VOUCHERNO', enableKeyEvents: true, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, { fieldLabel: Zi.LAN.FromJieSuanDate, 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.ToJieSuanDate, format: 'Y-m-d', xtype: 'datefield', name: 'ExpDateEnd', enableKeyEvents: true, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } },this.comboxISVOU,{ xtype: 'button', width: 90, text: Zi.LAN.Executequery, iconCls: "btnrefresh", handler: function (button, event) { this.onRefreshClick(button, event); }, scope: this }, { xtype: 'button', width: 90, text: Zi.LAN.AdvancedSearch, iconCls: "btnmore", handler: function (button, event) { var sql = this.getCondition(); var winAccess = new Shipping.DsQuery({ }); winAccess.StoreList = this.storeList; winAccess.formname = this.formname; winAccess.condition = sql; winAccess.show(); return; }, scope: this } ] } ]//end items(fieldset 1) }//end fieldset 1 ]//end root items }); //#endregion formSearch //查询工具条 this.panelBtn = new Ext.Panel({ region: "north", tbar: [ { text: Zi.LAN.FreeJieSuan, iconCls: "btnadd", handler: function (button, event) { this.OprationStatus = 'add'; DsOpenEditWin('/Account/Chfee_settlement/PayBLEdit'); }, scope: this }, '-', { text: Zi.LAN.ApplyJieSuan, iconCls: "btnadd", handler: function (button, event) { this.OprationStatus = 'add'; DsOpenEditWin('/Account/Chfee_settlement/PayAppEdit'); }, scope: this }, '-', { text: Zi.LAN.FuFeeFPJS, iconCls: "btnadd", handler: function (button, event) { this.OprationStatus = 'add'; DsOpenEditWin('/Account/Chfee_settlement/PayInvEdit'); }, scope: this }, { text: Zi.LAN.ResetCondition , iconCls: "btnreset", handler: function (button, event) { var form = this.formSearch.getForm(); form.reset(); }, scope: this }, '-', { text: Zi.LAN.CommitLock, tooltip: Zi.LAN.CommitLock, id: 'btnSubmitAudit', handler: function (button, event) { this.onSubmitAuditClick(); }, scope: this }, '-', { text: Zi.LAN.SubmitAuditBack, tooltip: Zi.LAN.SubmitAuditBack, id: 'btnSubmitAuditBack', handler: function (button, event) { this.onSubmitAuditBackClick(); }, scope: this }, '-', { text: Zi.LAN.Btn_Delete, iconCls: "btndelete", id: 'btndelete', handler: function (button, event) { this.onDeleteClick(button, event); }, scope: this }, '-', { text:'打印', menu: [ { text:'打印列表', handler: function (button, event) { _this.Print(); } }, { text:'选择打印', handler: function (button, event) { _this.PrintSelect(); } }], scope: this }, '-', { text: Zi.LAN.ExportExcel, id: "btnExportExcel", iconCls: 'btnexportexcel', handler: function (button, event) { this.onExportClick(button, event); }, scope: this }, '-', { text: Zi.LAN.SavelistStyle, id: "btntest", menu: [ { text: Zi.LAN.Save , handler: function (button, event) { this.girdcolums = DsTruck.SaveGridPanel(USERID, _this.formname, _this.gridList.columns, _this.girdcolums, 1, true); } }, { text: Zi.LAN.Initialization, handler: function (menu, event) { _this.InitGrid(_this.initgirdcolums); _this.girdcolums = DsTruck.SaveGridPanel(USERID, _this.formname, _this.gridList.columns, _this.initgirdcolums, 1, true); } }], scope: this }, '-', { text: Zi.LAN.AddCwVouchers, id: "btnAddCwVouchers", iconCls: "btnadd", handler: function (button, event) { this.onAddCwVouchers(); }, scope: this }, '-', { text: Zi.LAN.CreateCheque, id: "btnCreateCheque", iconCls: "btnadd", handler: function (button, event) { var selections = this.gridList.getSelectionModel().getSelection(); if (selections.length == 0) { //Ext.Msg.show({ title: '提示', msg: '请先选择单据!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var record = selections[0]; if (record.data.ISCHEQUE == '是') { Ext.Msg.show({ title: '提示', msg: '已生成支票,不允许重复生成!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } this.SelectedRecord = record; var openSet = "height=400, width=1024, toolbar=no, menubar=no,scrollbars=1, resizable=1,location=no, status=no,Top= " + (screen.height - 750) / 2 + ",Left= " + (screen.width - 1100) / 2 var openType = "_blank"; var openUrl = "/Account/Chfee_cheque/Edit?handle=check&bstype=stllist"; window.open(openUrl, openType, openSet); }, scope: this } ] }); this.panelTop = new Ext.Panel({ layout: "border", region: "north", height: 80, items: [this.formSearch, this.panelBtn] }); Ext.apply(this, { items: [this.panelTop, this.gridList] }); this.storeList.on('beforeload', function (store) { Ext.apply(store.proxy.extraParams, { condition: _this.sqlcontext, billtype: 2 }); }, this); this.gridList.getSelectionModel().on('select', function (model, record, index) { var op = record.data.SETTLEUSER; var opname = record.data.SETTLEUSERREF; var bsstatus = record.data.BILLSTATUS; var btnESubmitAudit = Ext.getCmp('btnSubmitAudit'); var btnESubmitAuditBack = Ext.getCmp('btnSubmitAuditBack'); var btndelete = Ext.getCmp('btndelete'); var records = DsStoreQueryBy(this.StoreLockOp, 'OPID', op); if (records.getCount() > 0) { if (bsstatus == 1) { btnESubmitAudit.disable(); } else { btnESubmitAudit.enable(); } } else { btnESubmitAudit.disable(); } var records = DsStoreQueryBy(this.StoreUnLockOp, 'OPID', op); if (records.getCount() > 0) { if (bsstatus == 1) { btnESubmitAuditBack.enable(); } else { btnESubmitAuditBack.disable(); } } else { btnESubmitAuditBack.disable(); } var records = DsStoreQueryBy(this.StoreOpRange, 'OPID', opname); if (records.getCount() > 0) { btndelete.enable(); } else { btndelete.disable(); } }, this); // this.onRefreshClick(); var sql = ' BILLTYPE = 2 and BILLSTATUS<>1 '; this.sqlcontext = sql; this.PageSize = this.Pagenum.getValue(); this.storeList.pageSize = this.PageSize; this.storeList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql, billtype: 2 }, waitMsg: Zi.LAN.NowSelect , scope: this }); //#region 生成凭证_汇率列表 //#region 加载数据 //权限加载 this.StoreIsCwVouchers = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.ModuleModel', proxy: { url: '/MvcShipping/MsBaseInfo/GetSysModuleList' } }); this.StoreIsCwVouchers.load({ params: { condition: "[name]='modChPaySettlementIndexCwVouchers'" }, waitMsg: Zi.LAN.NowSelect, callback: function (options, success, response) { if (success) { //判断是否显示凭证按钮 if (options.length > 0) { Ext.getCmp('btnAddCwVouchers').show(); } else { Ext.getCmp('btnAddCwVouchers').hide(); } } }, scope: this }); //制单人 this.storePREPAREDCode = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.UserRefModel', proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' } }); this.storePREPAREDCode.load(); this.comboxPREPARED = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel:Zi.LAN.DocumentMakerUser, store: this.storePREPAREDCode, forceSelection: true, id: 'PREPARED', name: 'PREPARED', valueField: 'UserName', displayField: 'CodeAndName', value: SHOWNAME }); //键值维护表_凭证字//需求编号:SR2017080200007 this.storeCrmKeyCodeCode = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CrmKeyCodeModel', proxy: { url: '/CommMng/BasicDataRef/GetCrmKeyCodeList' } }); this.storeCrmKeyCodeCode.load({ params: { condition: " and KEYTYPE='凭证字'"} }); this.comboxVKNO = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: Zi.LAN.CertificateKeyValue, store: this.storeCrmKeyCodeCode, forceSelection: true, name: 'VKNO', valueField: 'KEYVALUE', displayField: 'KEYVALUE' }); this.storeMerGeType = Ext.create('Ext.data.Store', { fields: ['DC', 'NAME'] }); this.storeMerGeType.add({ "DC": "", "NAME": Zi.LAN.SystemSet }); this.storeMerGeType.add({ "DC": "1", "NAME": Zi.LAN.Merge }); this.storeMerGeType.add({ "DC": "2", "NAME": Zi.LAN.UnMerge }); this.comboxMergeType = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: Zi.LAN.IsConsolidatedGeneratedCertificate , store: this.storeMerGeType, labelWidth: 110, width: 210, valueField: 'DC', value: '', displayField: 'NAME', forceSelection: true, name: 'MERGE' }); //#endregion //#region 定义数据集 this.storeListCw = Ext.create('Ext.data.Store', { pageSize: this.PageSize, model: 'MsCodeCurrencyList', remoteSort: true, proxy: { type: 'ajax', url: '/Account/Chfee_settlement/GetCodeCurrencyList', reader: { id: 'CURR', root: 'data', totalProperty: 'totalCount' } } }); //#endregion //#region 列定义 this.girdcolums = [{ sortable: false, text: Zi.LAN.Currency, dataIndex: 'CURR', width: 100, align: 'center' }, { sortable: false, text: Zi.LAN.AdjustmentsRate, dataIndex: 'FCYEXRATE', width: 118, align: 'right', renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 5, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; }, editor: { xtype: 'numberfield', selectOnFocus: true, //得到焦点时自动选择文本 allowDecimals: true, //允许输入小数 decimalPrecision: 5, //允许保留的小数位数,并四舍五入 nanText: Zi.LAN.Msg_NotNumber, hideTrigger: true //是否隐藏上下调节按钮 } }]; //#endregion //#region gridList列表显示信息 this.gridListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', { clicksToEdit: 1 //1单击,2双击 }); this.gridListCw = new Ext.grid.GridPanel({ region: 'center', width: 220, store: this.storeListCw, enableHdMenu: false, //是否显示表格列的菜单 hideHeaders: false, //是否隐藏表头 rowLines: true, columnLines: true, loadMask: { msg: Zi.LAN.LoadData }, plugins: [this.gridListCellEditing], selType: 'cellmodel', columns: this.girdcolums }); //#endregion this.InitData(); //#endregion Ext.Ajax.request({ waitMsg: '', url: '/MvcShipping/MsSysParamSet/GetData', params: { condition: "PARAMNAME='STLSHOWVOU'" }, 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.STLSHOWVOU = 1; } else { } } } else { } }, scope: this }); Ext.Ajax.request({ waitMsg: '', url: '/MvcShipping/MsBaseInfo/GetCwISRATESET', 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 == '1') { this.ISRATESET = 1; } else { } } } else { } }, scope: this }); this.LoadPeriod(); }, //end initUIComponents //#region 加载事件 InitData: function () { Ext.Ajax.request({ waitMsg: Zi.LAN.OnSelect , url: '/MvcShipping/RptCwGenlegAccitems/GetData', callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (!result.Success) { return; } data = result.data; var arrtmp = data.toString().split("&"); this.strCwSTARTGID = arrtmp[0].toString(); var strCwSTARTNAME = arrtmp[1].toString(); var strCwACCDATE = arrtmp[2].toString(); var sYear = arrtmp[3].toString(); var sMonth = arrtmp[4].toString(); // //var sZQ = "  当前登录账套:“" + strCwSTARTNAME + "”  当前财务账期:“" + sYear + "年第" + sMonth + "期”  "; //Ext.getCmp("lbTitle2").setValue(sZQ); //this.onRefreshClick(); } else { //Ext.MessageBox.alert(Zi.LAN.Error, response.responseText); } }, scope: this }); }, //end InitData //#endregion LoadPeriod: function () { Ext.Ajax.request({ waitMsg: Zi.LAN.OnSelect , url: '/Account/ChMonthClose/GetNowPeriod', params: { condition: '' }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (!result.Success) { return; } data = result.data; this.MsPeriod = data; } else { Ext.MessageBox.alert(Zi.LAN.Error, response.responseText); } }, scope: this }); }, onRefreshClick: function (button, event) { var sql = this.getCondition(); this.sqlcontext = sql; this.PageSize = this.Pagenum.getValue(); this.storeList.pageSize = this.PageSize; this.storeList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql, billtype: 2 }, waitMsg: Zi.LAN.NowSelect , scope: this }); }, onDsQuery: function () { var sql = this.sqlcontext; this.storeList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql, billtype: 2 }, waitMsg: Zi.LAN.NowSelect , scope: this }); }, onDeleteClick: function (button, event) { var selections = this.gridList.getSelectionModel().getSelection(); if (selections.length == 0) { Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.SelectBillFirst, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var record = selections[0]; var billstatus = record.data.BILLSTATUS; var settlemode = record.data.SETTLEMODE; if (billstatus == '1') { Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.CanotDelBill4Status, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var SETTLETIME = record.data.SETTLETIME; var oDate1 = new Date(SETTLETIME); var oDate2 = new Date(this.MsPeriod.FDAY); if (oDate1.getTime() < oDate2.getTime()) { Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.EndMothJZCanotDelBill, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } Ext.MessageBox.confirm(Zi.LAN.TiShi,Zi.LAN.Sure2DelTheRecode, function (btn) { if (btn == 'yes') { Ext.Msg.wait(Zi.LAN.Msg_Deleting); Ext.Ajax.request({ waitMsg:Zi.LAN.Msg_Deleting, url: '/Account/Chfee_settlement/Delete', params: { data: Ext.JSON.encode(record.data), settlemode: settlemode }, callback: function (options, success, response) { if (success) { var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { this.storeList.remove(record); Ext.Msg.show({ title: Zi.LAN.TiShi, msg: '删除成功!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); } else { Ext.Msg.show({ title: Zi.LAN.E, msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } }, failure: function (response, options) { Ext.Msg.show({ title: Zi.LAN.Warn , msg: Zi.LAN.ServerResponseErrorRetry, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); }, success: function (response, options) { }, scope: this }); //end Ext.Ajax.request } }, this); }, //onDeleteClick onSubmitAuditClick: function () { var selections = this.gridList.getSelectionModel().getSelection(); if (selections.length == 0) { Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.SelectBillFirst, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var BILLNOStr = ''; for (var i = 0; i < selections.length; i++) { var rec = selections[i]; var BILLNO = rec.data.BILLNO; var op = rec.data.SETTLEUSER; var records = DsStoreQueryBy(this.StoreLockOp, 'OPID', op); if (records.getCount() > 0) { } else { isunlock = false; Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.NoPower2Lock, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); } if (rec.data.BILLSTATUS == '2') { if (BILLNOStr == '') BILLNOStr = BILLNO; else { BILLNOStr = BILLNOStr + ',' + BILLNO; } } } _this = this; if (BILLNOStr == '') { } else { Ext.Ajax.request({ waitMsg: Zi.LAN.Msg_Adding, url: '/Account/Chfee_settlement/LockList', params: { bills: BILLNOStr }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (!result.Success) { Ext.Msg.show({ title: Zi.LAN.TiShi, msg: result.Message, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK }); return; } else { this.storeList.reload(); } } else { Ext.MessageBox.alert(Zi.LAN.Error, response.responseText); } }, scope: this }); } }, onSubmitAuditBackClick: function () { var selections = this.gridList.getSelectionModel().getSelection(); if (selections.length == 0) { Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.SelectBillFirst, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var BILLNOStr = ''; var strIsVOUCHERNO = ""; for (var i = 0; i < selections.length; i++) { var rec = selections[i]; var BILLNO = rec.data.BILLNO; var isvou = rec.data.ISEXPORT; var isVOUCHERNO = rec.data.VOUCHERNO; var isunlock = true; if (isVOUCHERNO != "") { strIsVOUCHERNO = Zi.LAN.HasZongCerfCanotCancl; } var op = rec.data.SETTLEUSER; var records = DsStoreQueryBy(this.StoreUnLockOp, 'OPID', op); if (records.getCount() > 0) { } else { isunlock = false; Ext.Msg.show({ title: Zi.LAN.TiShi, msg: NoPower2Lock, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); } if ((rec.data.BILLSTATUS == '1') && (isVOUCHERNO == "") && (isunlock==true)) { if (BILLNOStr == '') BILLNOStr = BILLNO; else { BILLNOStr = BILLNOStr + ',' + BILLNO; } } } if (strIsVOUCHERNO != "") { Ext.Msg.show({ title: Zi.LAN.TiShi, msg: strIsVOUCHERNO, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); } _this = this; if (BILLNOStr == '') { } else { Ext.Ajax.request({ waitMsg: Zi.LAN.Msg_Adding, url: '/Account/Chfee_settlement/UnLockList', params: { bills: BILLNOStr }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (!result.Success) { Ext.Msg.show({ title: Zi.LAN.TiShi, msg: result.Message, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK }); return; } else { this.storeList.reload(); } } else { Ext.MessageBox.alert(Zi.LAN.Error, response.responseText); } }, scope: this }); }; }, getCondition: function () { var form = this.formSearch.getForm(); if (!form.isValid()) { Ext.Msg.alert(Zi.LAN.TiShi, Zi.LAN.SelectConditionValError); return ''; } var sql = ' BILLTYPE=2 '; var customNo = form.findField('BsNo').getValue(); sql = sql + getAndConSql(sql, customNo, "BILLNO like '%" + customNo + "%'"); var ShenNo = form.findField('ShenNo').getValue(); sql = sql + getAndConSql(sql, ShenNo, "BILLNO in (SELECT DISTINCT BILLNO from v_fee_do_payapplication WHERE PAYBILLNO like '%" + ShenNo + "%')"); var VOUCHERNO = form.findField('VOUCHERNO').getValue(); //sql = sql + getAndConSql(sql, VOUCHERNO, "VOUCHERNO like '%" + VOUCHERNO + "%'"); sql = sql + getAndConSql(sql, VOUCHERNO, "gid in (select BSGID from [cw_vouno_bs_gl] where [BSTABLENAME]='ch_fee_settlement' and [STARTGID]='" + this.strCwSTARTGID + "' and VOUALLNO like '%" + VOUCHERNO + "%')"); var ISVOU = form.findField('ISVOU').getValue(); if (ISVOU == '1') sql = sql + " AND EXISTS (select 1 from [cw_vouno_bs_gl] where [BSTABLENAME]='ch_fee_settlement' and BSGID=cm.GID) "; else if (ISVOU == '0') sql = sql + " AND (NOT EXISTS (select 1 from [cw_vouno_bs_gl] where [BSTABLENAME]='ch_fee_settlement' and BSGID=cm.GID) or (AMOUNTRMB<>0 and AMOUNTUSD<>0)) "; var custName = form.findField('CustName').getValue(); sql = sql + getAndConSql(sql, custName, "CUSTOMERNAME='" + custName + "'"); var expDateBgn = form.findField('ExpDateBgn').getRawValue(); sql = sql + getAndConSql(sql, expDateBgn, "SETTLETIME >='" + expDateBgn + "'"); var expDateEnd = form.findField('ExpDateEnd').getRawValue(); sql = sql + getAndConSql(sql, expDateEnd, "SETTLETIME <='" + expDateEnd + " 23:59:59'"); return sql; }, onExportClick: function (button, event) { _this = this; GridExportExcelPage(this.gridList); }, OprationSwap: function () { var ret = new Array(); ret[0] = this.OprationStatus; ret[1] = this.storeList; ret[2] = this.SelectedRecord; return ret; }, PrintSelect: function () { _this = this; if (this.storeList.getCount() == 0) { return; } var storeadd = null; var selectedRecords = this.gridList.getSelectionModel().getSelection(); if (selectedRecords.length == 0) { Ext.Msg.show({ title:'提示', msg:'请先选择要打印的单据', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var sortstr = 'SETTLETIME DESC'; if (this.sortfield != '' && this.sortdire != '') { sortstr = this.sortfield + ' ' + this.sortdire; } var feeGidSql = ''; for (var i = 0; i < selectedRecords.length; i++) { var record = selectedRecords[i]; var feeGId = "'" + record.get('GID') + "'"; if (feeGidSql == '') { feeGidSql = feeGId; } else { feeGidSql = feeGidSql + "," + feeGId; } }; var bsno = '11111'; var mblno = ''; var selections = this.gridList.getSelectionModel().getSelection(); if (selections.length != 0) { var record = selections[0]; GID = record.data.GID; } var printType = 'MSPAYSTTLLISTSELECT'; var sql1 = "select * from ch_fee_settlement WHERE GID IN (" + feeGidSql + ") order by " + sortstr; var sql2 = "select * from ch_fee_settlement where GID='" + GID + "'"; var sql3 = ""; var sql4 = ""; var sql5 = ""; var sql6 = ""; PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6, mblno); }, Print: function () { _this = this; if (this.storeList.getCount() == 0) { return; } var sortstr = ' SETTLETIME DESC,BILLNO DESC '; if (this.sortfield != '' && this.sortdire != '') { sortstr = this.sortfield + ' ' + this.sortdire; } Ext.Msg.wait(Zi.LAN.HandlingDataAndWait); Ext.Ajax.request({ waitMsg: Zi.LAN.HandlingData, url: '/Account/Chfee_settlement/GetDataListStr', //(int start, int limit, string sort, string condition, int billtype) scope: this, params: { start: 0, limit: 10000000, sort: sortstr, condition: _this.sqlcontext, billtype: 2 }, 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 = 'MSPAYSETTLLIST'; var sql1 = returnstr; var sql2 = ""; var sql3 = ""; var sql4 = ""; var sql5 = ""; var sql6 = ""; PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6); } else { Ext.Msg.show({ title: Zi.LAN.E, msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } else { Ext.Msg.show({ title: Zi.LAN.Retry, msg: Zi.LAN.ServerResponseError, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } }); }, //#region 生成凭证 onAddCwVouchers: function (button, event) { var selections = this.gridList.getSelectionModel().getSelection(); if (selections.length == 0) { Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.SelectBillFirst, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var strError = ""; var strGids = ""; var iGids = 0; // for (var i = 0; i < selections.length; i++) { // var rec = selections[i]; // var VOUCHERNO = rec.data.VOUCHERNO; //凭证号 // var BILLSTATUS = rec.data.BILLSTATUS; //是否锁定 // var SETTLETYPEREF = rec.data.SETTLETYPEREF; //结算方式 // var ACCOUNTREF = rec.data.ACCOUNTREF; //结算账户 // // // if (VOUCHERNO == "" && BILLSTATUS == 1 && ((SETTLETYPEREF != "现金" && ACCOUNTREF != "") || SETTLETYPEREF == "现金")) { // if (strGids == "") // strGids = rec.data.GID; // else { // strGids += "," + rec.data.GID; // } // iGids++; // } // else { // strError = "请选择已锁定、结算账户不为空(结算方式为现金除外),且未生成凭证的单据!"; // } // } // // // if (strError != "") { // Ext.Msg.show({ title: '提示', msg: strError, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); // return; // } // for (var i = 0; i < selections.length; i++) { var rec = selections[i]; if (strGids == "") strGids = rec.data.GID; else { strGids += "," + rec.data.GID; } } Ext.Ajax.request({ waitMsg:Zi.LAN.PreReadDataWait , url: '/Account/Chfee_settlement/GetIsVoucher', params: { strGids: strGids }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (!result.Success) { Ext.Msg.show({ title: Zi.LAN.TiShi, msg: result.Message, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK }); return; } // this.storeListCw.load({ params: { strGids: strGids }, callback: function (r, options, success) { if (success) { this.showContactForm(false, strGids, this, selections.length); } }, waitMsg: Zi.LAN.RefreshDataWait, scope: this }); } else { Ext.MessageBox.alert(Zi.LAN.Error, response.responseText); } }, scope: this }); // }, //#endregion //#region 层_显示信息 showContactForm: function (win, strGids, _this, iGids) { var required = '*'; if (!win) { //#region 编辑formDiv 基本信息 var formDiv = Ext.widget('form', { border: false, bodyPadding: 10, fieldDefaults: { labelAlign: 'right', labelWidth: 60, labelStyle: 'font-weight:bold' }, items: [this.comboxPREPARED, { fieldLabel: Zi.LAN.AccountingDate, format: 'Y-m-d', xtype: 'datefield', allowBlank: false, name: 'VOUDATE', value: Ext.util.Format.date(Ext.Date.add(new Date(), Ext.Date.MONTH - 1, 1), "Y-m-d") }, this.comboxVKNO, //需求编号:SR2017080200007 { xtype: "checkbox", //checkbox控件 name: "ButtSettlement", boxLabel: Zi.LAN.IsCreateBankAccount , width: 200, inputValue: "true", //选中的值 uncheckedValue: "false" //未选中的值 }, //需求编号:SR2017080200007 { xtype: "checkbox", //checkbox控件 name: "ISSTBANKGROUP", boxLabel:'银行科目合并', width: 200, inputValue: "true", //选中的值 uncheckedValue: "false" //未选中的值 }, this.comboxMergeType, { xtype: "checkbox", //checkbox控件 name: "ISRATE", boxLabel: Zi.LAN.IsReferSysTemRate, width: 200, inputValue: "true", //选中的值 uncheckedValue: "false", //未选中的值 checked: true, //绘制时的选中状态, listeners: { 'change': function (field, newValue, oldValue, eOpts) { if (field.checked.toString() == "false") { this.gridListCw.show(); } else { this.gridListCw.hide(); } }, scope: this } }, this.gridListCw ], buttons: [{ text: Zi.LAN.AddCwVouchers , handler: function (options, success, response) { if (!this.up('form').getForm().isValid()) { return; } var dataDiv = this.up('form').getForm().getValues(false, false, false); // var j = 0; var bodydatas = []; for (var i = 0; i < _this.storeListCw.getCount(); i += 1) { var member = _this.storeListCw.getAt(i); bodydatas.push(member); } var jsonBody; if (bodydatas.length > 0) { jsonBody = ConvertRecordsToJsonAll(bodydatas); } // Ext.Msg.wait('正在生成' + iGids + '票结算单数据, 请稍侯...'); Ext.Ajax.request({ waitMsg: '正在生成' + iGids + '票结算单数据, 请稍侯...', url: '/Account/Chfee_settlement/onAddCwVouchers', scope: this, params: { strGids: strGids, dataDiv: Ext.JSON.encode(dataDiv), jsonBody: jsonBody }, callback: function (options, success, response) { if (success) { Ext.MessageBox.hide(); var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { if (_this.STLSHOWVOU == 1) { DsOpenEditWin('/MvcShipping/MsCwVouchersGl/Edit?handle=check&ordno=' + jsonresult.Data, "凭证录入", "", "940", "10", "10"); } else { Ext.Msg.show({ title: Zi.LAN.TiShi, msg: jsonresult.Message, icon: Ext.MessageBox.INFO, buttons: Ext.Msg.OK }); _this.onRefreshClick(); } return; } else { Ext.Msg.show({ title: Zi.LAN.E, msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } else { Ext.Msg.show({ title: Zi.LAN.Retry, msg: Zi.LAN.ServerResponseError, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } }, timeout: 3000000//30秒 }); // this.up('form').getForm().reset(); this.up('window').hide(); } }, { text: Zi.LAN.Btn_Cancel, handler: function () { this.up('form').getForm().reset(); this.up('window').hide(); } }], listeners: { scope: this, 'render': function (thisDiv, thisExtend) { //var ISRATE = thisDiv.form.findField('ISRATE').getValue().toString(); //if (ISRATE == "false") { // this.gridListCw.show(); //} //else { // this.gridListCw.hide(); //} this.gridListCw.hide(); // Ext.Ajax.request({ waitMsg: Zi.LAN.SelectDelegateNumberStatus, url: '/MvcShipping/MsBaseInfo/GetCwVOUNO', params: { VKNO: "记" }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (!result.Success) { Ext.Msg.show({ title: Zi.LAN.TiShi, msg: result.Message, icon: Ext.MessageBox.INFO, buttons: Ext.Msg.OK }); return; } // data = result.data; var arrayList = new Array(); arrayList = data.split("~"); var strY = arrayList[0].toString(); var strM = arrayList[1].toString(); var sVOUNO = arrayList[2].toString(); var strVOUNO = arrayList[3].toString(); var strVOUDATE = arrayList[4].toString(); var strACCDATE = arrayList[5].toString(); // thisDiv.form.findField('VOUDATE').setValue(strVOUDATE); thisDiv.form.findField('VOUDATE').setMinValue(strACCDATE + "-01"); if (_this.ISRATESET == 1) thisDiv.form.findField('ISRATE').setValue(false) //Ext.getCmp('VOUDATE').setValue(strVOUDATE); //Ext.getCmp('VOUDATE').setMinValue(strACCDATE + "-01"); } else { Ext.MessageBox.alert(Zi.LAN.Error, response.responseText); } }, scope: this }); } } }); //#endregion win = Ext.widget('window', { title:Zi.LAN.AuxiliaryAccounting, closeAction: 'hide', width: 250, height: 350, layout: 'fit', resizable: true, modal: true, closable: false, items: formDiv }); } win.show(); } //#endregion });