Ext.namespace('Shipping'); Shipping.MsChPaysettlementIndex = function (config) { Ext.applyIf(this, config); this.initUIComponents(); window.Shipping.MsChPaysettlementIndex.superclass.constructor.call(this); }; if (Ext.MessageBox) { Ext.MessageBox.buttonText = { ok: "Ok", cancel: "Cancel", yes: "Yes", no: "No" }; } 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, renderer: function (value, meta) { meta.tdCls = 'mblno'; btnurl = getGridCopyButton(value); return btnurl + value; } }, { 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: 'BANKCODE', header: Zi.LAN.BANKCODE, 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: Zi.LAN.ISNOTVOU , width: 120, renderer: function (value, meta, record) { if (value == true) { value = Zi.LAN.YES; } else value = Zi.LAN.NO; return value; } }, { sortable: true, dataIndex: 'ISCHEQUE', header: Zi.LAN.CreateCheque, width: 120, renderer: function (value, meta, record) { if (value =='是') { value = Zi.LAN.YES; } else value = Zi.LAN.NO; return value; } }, { sortable: true, dataIndex: 'REMARK', header: Zi.LAN.Remark, width: 160 }, { sortable: true, dataIndex: 'INVNO', header: Zi.LAN.InvoiceNumber, 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 }, { sortable: true, dataIndex: 'INVOICENO', header: Zi.LAN.InvoiceNumber, width: 160 }, { sortable: true, dataIndex: 'INVOICEDATE', header: Zi.LAN.INVOICEDATE, width: 160 }, { sortable: true, dataIndex: 'INVOICEAMOUNT', header: Zi.LAN.INVOICEAMOUNT, width: 160 }, { sortable: true, dataIndex: 'AUDITTIME', header: Zi.LAN.LOCKTIME, width: 100 }, { sortable: true, dataIndex: 'AUDITUSERREF', header: Zi.LAN.LOCKUSERREF, width: 100 }, { sortable: true, dataIndex: 'DELETETIME', header: Zi.LAN.UNLOCKTIME, width: 100 }, { sortable: true, dataIndex: 'DELETEUSERREF', header: Zi.LAN.UNLOCKUSERREF, width: 100 }, { sortable: true, dataIndex: 'PAYSTATUS', header: Zi.LAN.PAYSTATUS, width: 100 }, { sortable: true, dataIndex: 'PAYREASON', header: Zi.LAN.PAYREASON, 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/GetCustomRefListRm' } }); this.storeCust.load({ params: { condition: ""} }); this.comboxCust = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: Zi.LAN.CustomerName, store: this.storeCust, queryMode: 'remote', minChars: 0, queryParam: 'CODENAME', // 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: 90, 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(); } } } }, this.comboxISVOU, { xtype: 'button', flex: 0.4, text: Zi.LAN.Executequery, //执行查询 iconCls: "btnrefresh", handler: function (button, event) { this.onRefreshClick(button, event); }, scope: this } ] } , { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [ { fieldLabel: Zi.LAN.ywnum, //业务编号 name: 'CustNo', 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(); } } } }, { xtype: 'hiddenfield', flex: 1.7 }, { xtype: 'button', flex: 0.4, 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.UsdPay, tooltip: Zi.LAN.UsdPay, id: 'btnCreatePay', handler: function (button, event) { this.onCreatePayClick(); }, scope: this }, '-', { text: Zi.LAN.UsdPayReg, tooltip: Zi.LAN.UsdPayReg, id: 'btnCreateReg', handler: function (button, event) { this.onCreateRegClick(); }, scope: this }, '-', { text: Zi.LAN.UsdPayRegUrl, tooltip: Zi.LAN.UsdPayRegUrl, id: 'btnCreateUrl', handler: function (button, event) { this.onCreateUrlClick(); }, scope: this }, '-', { text: Zi.LAN.Btn_Delete, iconCls: "btndelete", id: 'btndelete', handler: function (button, event) { this.onDeleteClick(button, event); }, scope: this }, '-', { text: Zi.LAN.Print, menu: [ { text: Zi.LAN.PrintReport, handler: function (button, event) { _this.Print(); } }, { text: Zi.LAN.ShouFeiJSListSel, 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: Zi.LAN.TiShi, msg: Zi.LAN.YSCZP, 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: 100, 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(); this.storeChfeeFile1 = Ext.create('Ext.data.Store', { model: 'FeeFileModel', remoteSort: false, proxy: { type: 'ajax', url: '/Account/Chfee_payapplication/GetFileList', reader: { id: 'GID', root: 'data', totalProperty: 'totalCount' } } }); //表格 var selCertModel1 = Ext.create('Ext.selection.CheckboxModel'); this.fileGrid1 = new Ext.grid.GridPanel({ store: this.storeChfeeFile1, title: '发票', //'集装箱信息', enableHdMenu: false, layout: 'border', region: 'center', height: 120, loadMask: { msg: '数据加载中,请稍等...' }, //数据加载中,请稍等... trackMouseOver: true, disableSelection: false, selModel: selCertModel1, singleSelect: true, selType: 'rowmodel', tbar: [{ text: '上传发票', //上传图片 tooltip: Zi.LAN.filetp, iconCls: "btnadddetail", handler: function (button, event) { this.onAddFileClick(button, event); }, scope: this }, '-', { text: '删除发票', //删除 tooltip: Zi.LAN.delete1, //删除图片 iconCls: "btndeletedetail", handler: function (button, event) { this.onDelFileClick(button, event); }, scope: this }], columns: [ { sortable: true, hidden: true, dataIndex: 'GID', readOnly: true, header: 'GID', width: 80 }, { sortable: true, hidden: false, dataIndex: 'File_OriginalName', readOnly: true, header: '文件名称', //文件名称 renderer: function (value, p, record) { return '' + value + ''; }, width: 120 }, { xtype: 'actioncolumn', width: 50, text: '操作', //操作 items: [{ icon: '/images/icons/btnSearch.gif', // Use a URL in the icon config tooltip: '预览', handler: function (grid, rowIndex, colIndex) { var rec = grid.getStore().getAt(rowIndex); var filePath = "/Areas/Account/Files/" + rec.get('BillNo') + '/' + rec.get('File_Name') + '?a=' + Math.random(); var imgView = new Shipping.FileView({ filePath: filePath }); imgView.show(); } }] }, { sortable: true, hidden: false, dataIndex: 'UpdateTime', readOnly: true, header: '上传日期', //上传日期 width: 80 }, { sortable: true, hidden: false, dataIndex: 'Operator', readOnly: true, header: '上传人', //上传者 width: 80 }, { sortable: true, hidden: true, dataIndex: 'File_Name', readOnly: true, header: 'FFF', //文件物理名称 width: 80 }, { sortable: true, hidden: true, dataIndex: 'File_Path', header: 'File_Path', width: 80 } ] }); this.storePayBank = Ext.create('DsExt.ux.RefTableStore', { model: 'MsPayBank', proxy: { url: '/Account/Chfee_Pay/GetPayBankList' } }); //客服 this.comboxPayBank = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel:'收款人开户银行(跨行)', //'客服', store: this.storePayBank, forceSelection: true, name: 'BankId', valueField: 'Id', displayField: 'Name', listeners: { scope: this, 'select': function (combo, records, eOpts) { if (records.length > 0) { var selectrecords = DsStoreQueryBy(this.storePayBank, 'Id', combo.value); if (selectrecords.getCount() > 0) { var selectdata = selectrecords.getAt(0).data; this.UsdPayForm.getForm().findField('BankName').setValue(selectdata.Name); } else { this.UsdPayForm.getForm().findField('BankName').setValue(''); } } } } }); this.UsdPayForm = Ext.widget('form', { frame: true, region: 'center', /* title: '美元快付',*/ // autoScroll: true, trackResetOnLoad: true, bodyPadding: 5, fieldDefaults: { margins: '2 2 2 2', labelAlign: 'right', labelWidth: 130, flex: 1, msgTarget: 'qtip' }, items: [ {//fieldset 1 xtype: 'container', defaultType: 'textfield', layout: 'anchor', defaults: { anchor: '100%' }, items: [{ fieldLabel: 'BankName', //'INPUTBY', name: 'BankName', hidden: true }, { fieldLabel: 'Username', //'CNTRTOTAL', name: 'Username', hidden: true }, { fieldLabel: 'PAYGID', //'CNTRTOTAL', name: 'PAYGID', hidden: true }, { fieldLabel: 'PAYBILLNO', //'CNTRTOTAL', name: 'PAYBILLNO', hidden: true }, { fieldLabel: '收款方公司名', name: 'PayeeCompanyName' }, { fieldLabel: '收款方账号', name: 'PayeeCompanyAccount' }, { fieldLabel: '付款金额', xtype: 'numberfield', name: 'PayAmount' }, { fieldLabel: '支付附言', name: 'PayRemark' }, { xtype: 'radiogroup', fieldLabel: '美元账户', //'船公司', columns: 2, vertical: true, items: [{ boxLabel: '第一美金', //'MAERSK LINE', name: 'DollarNo', inputValue: 0, checked: true }, { boxLabel: '第二美金', //'MCC SINGAPORE', name: 'DollarNo', inputValue: 1, checked: false }] }, { xtype: 'radiogroup', fieldLabel: '极速支付', //'船公司', columns: 2, vertical: true, items: [{ boxLabel: '普通', //'MAERSK LINE', name: 'IsQuickPay', inputValue: 0, checked: true }, { boxLabel: '极速', //'MCC SINGAPORE', name: 'IsQuickPay', inputValue: 1, checked: false }] }, { xtype: 'radiogroup', fieldLabel: '全额支付', //'船公司', columns: 2, vertical: true, items: [{ boxLabel: '全额', //'MAERSK LINE', name: 'IsPartialPayment', inputValue: 0, checked: true }, { boxLabel: '分次', //'MCC SINGAPORE', name: 'IsPartialPayment', inputValue: 1, checked: false }] }, { xtype: 'radiogroup', fieldLabel:'换汇支付', //'船公司', columns: 2, vertical: true, items: [{ boxLabel: '否', //'MAERSK LINE', name: 'IsCNYPay', inputValue:0, checked: true }, { boxLabel: '是', //'MCC SINGAPORE', name: 'IsCNYPay', inputValue: 1, checked: false }] }, { xtype: 'radiogroup', fieldLabel: '同行/跨行', //'船公司', columns: 2, vertical: true, items: [{ boxLabel: '同行', //'MAERSK LINE', id: 'rdoth', name: 'IsAcrossBank', inputValue: 0, checked: true }, { boxLabel: '跨行', //'MCC SINGAPORE', id: 'rdokh', name: 'IsAcrossBank', inputValue: 1 }], listeners: { change: function (rd, newValue, oldValue, eOpts) { var data = _this.UsdPayForm.getForm().getValues(); if (data.IsAcrossBank == 1) { _this.storePayBank.load(); } } } }, this.comboxPayBank,{ fieldLabel: 'Swift Code(跨行)', name: 'SwiftCode' }, { fieldLabel: '支行名称(跨行)', name: 'BankBranchName' }, this.fileGrid1 ]//end items(fieldset 1) }//end fieldset 1 ]//end root items }); this.winUsdPayShow = Ext.create('Ext.window.Window', { title: "美元快付", width: 410, /* layout: "hbox",*/ height: 550, //plain : true, iconCls: "addicon", resizable: false, // 是否可以拖动 // draggable:false, collapsible: true, // 允许缩放条 closeAction: 'close', closable: true, modal: 'true', buttonAlign: "center", bodyStyle: "padding:0 0 0 0", items: [this.UsdPayForm], buttons: [{ text: '确认支付', //"确认修改", minWidth: 70, handler: function () { var form = _this.UsdPayForm.getForm(); var PayeeCompanyName = form.findField('PayeeCompanyName').getValue(); if (PayeeCompanyName == '' || PayeeCompanyName == null || PayeeCompanyName == undefined) { Ext.Msg.show({ title: Zi.LAN.TiShi, msg: '收款公司不能为空', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); //'委托分公司为必填!' return; }; var PayeeCompanyName = form.findField('PayeeCompanyAccount').getValue(); if (PayeeCompanyName == '' || PayeeCompanyName == null || PayeeCompanyName == undefined) { Ext.Msg.show({ title: Zi.LAN.TiShi, msg: '收款公司账号不能为空', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); //'委托分公司为必填!' return; }; var PayAmount = form.findField('PayAmount').getValue(); if (PayAmount == '' || PayeeCompanyName =='0' || PayeeCompanyName == undefined) { Ext.Msg.show({ title: Zi.LAN.TiShi, msg: '支付金额不能为0', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); //'委托分公司为必填!' return; }; var data = _this.UsdPayForm.getForm().getValues(); if (data.IsAcrossBank == 1) { var SwiftCode = form.findField('SwiftCode').getValue(); if (SwiftCode == '' || SwiftCode == null || SwiftCode == undefined) { Ext.Msg.show({ title: Zi.LAN.TiShi, msg: 'SwiftCode不能为空', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); //'委托分公司为必填!' return; }; var BankId = form.findField('BankId').getValue(); if (BankId == '' || BankId == null || BankId == 0 || BankId == undefined) { Ext.Msg.show({ title: Zi.LAN.TiShi, msg: '银行名称不能为空', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); //'委托分公司为必填!' return; }; var BankName = form.findField('BankName').getValue(); if (BankName == '' || BankName == null || BankName == undefined) { Ext.Msg.show({ title: Zi.LAN.TiShi, msg: '银行名称不能为空', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); //'委托分公司为必填!' return; }; var BankBranchName = form.findField('BankBranchName').getValue(); if (BankBranchName == '' || BankBranchName == null || BankBranchName == undefined) { Ext.Msg.show({ title: Zi.LAN.TiShi, msg: '支行名称不能为空', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); //'委托分公司为必填!' return; }; } else { } _this.onCreatePayFn() } }, { text: "关闭", minWidth: 70, handler: function () { _this.winUsdPayShow.close(); } }] }); this.storePayCity = Ext.create('DsExt.ux.RefTableStore', { model: 'MsPayCity', proxy: { url: '/Account/Chfee_Pay/GetPayCityList' } }); //客服 this.comboxPayCity = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '城市', //'客服', store: this.storePayCity, forceSelection: true, allowBlank: false, name: 'City', valueField: 'Id', displayField: 'CityName' }); this.RegisterFrom = Ext.widget('form', { frame: true, region: 'center', /* title: '美元快付',*/ autoScroll: true, trackResetOnLoad: true, bodyPadding: 5, fieldDefaults: { margins: '2 2 2 2', labelAlign: 'right', labelWidth: 130, flex: 1, msgTarget: 'qtip' }, items: [ {//fieldset 1 xtype: 'container', defaultType: 'textfield', layout: 'anchor', defaults: { anchor: '100%' }, items: [ { fieldLabel: '用户名', allowBlank: false, name: 'Username' }, { fieldLabel: '登录密码', allowBlank: false, name: 'Password' }, { fieldLabel: '联系人', allowBlank: false, name: 'ContactName' }, { fieldLabel: '联系电话', allowBlank: false, name: 'Phone' }, { fieldLabel: '支付密码', allowBlank: false, name: 'PayPassword' }, this.comboxPayCity, { fieldLabel: '公司全称', allowBlank: false, name: 'CompanyName' }, { fieldLabel: '公司组织机构代码证', allowBlank: false, name: 'CompanyCode' }, { fieldLabel: '公司地址', allowBlank: false, name: 'CompanyAddress' }, { fieldLabel: '开户行', allowBlank: false, name: 'CompanyBank' }, { fieldLabel: '银行账号', allowBlank: false, name: 'CompanyAccount' }, { fieldLabel: '邮箱', allowBlank: false, name: 'Email' }, { fieldLabel: '法人', allowBlank: false, name: 'LegalName' }, { fieldLabel: '验证密码(验证老客户)', name: 'ValidatePassword' } ]//end items(fieldset 1) }//end fieldset 1 ]//end root items }); this.winRegisterShow = Ext.create('Ext.window.Window', { title: "美元快付注册", width: 410, /* layout: "hbox",*/ height: 520, //plain : true, iconCls: "addicon", resizable: false, // 是否可以拖动 // draggable:false, collapsible: true, // 允许缩放条 closeAction: 'close', closable: true, modal: 'true', buttonAlign: "center", bodyStyle: "padding:0 0 0 0", items: [this.RegisterFrom], buttons: [{ text: '确认注册', //"确认修改", minWidth: 70, handler: function () { var form = _this.RegisterFrom.getForm(); if (!form.isValid()) { Ext.Msg.show({ title: Zi.LAN.TiShi, msg: '必填项不能为空', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });//'委托分公司为必填!' return; } var Username = form.findField('Username').getValue(); if (Username == '' || Username == null || Username == undefined) { Ext.Msg.show({ title: Zi.LAN.TiShi, msg: '用户名不能为空', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); //'委托分公司为必填!' return; }; var Password = form.findField('Password').getValue(); if (Password == '' || Password == null || Password == undefined) { Ext.Msg.show({ title: Zi.LAN.TiShi, msg: '登录密码不能为空', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); //'委托分公司为必填!' return; }; var ContactName = form.findField('ContactName').getValue(); if (ContactName == '' || ContactName == null || ContactName == undefined) { Ext.Msg.show({ title: Zi.LAN.TiShi, msg: '联系人不能为空', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); //'委托分公司为必填!' return; }; var Phone = form.findField('Phone').getValue(); if (Phone == '' || Phone == null || Phone == undefined) { Ext.Msg.show({ title: Zi.LAN.TiShi, msg: '手机号不能为空', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); //'委托分公司为必填!' return; }; var City = form.findField('City').getValue(); if (City == '' || City ==0 || City == undefined) { Ext.Msg.show({ title: Zi.LAN.TiShi, msg: '城市不能为空', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); //'委托分公司为必填!' return; }; var PayPassword = form.findField('PayPassword').getValue(); if (PayPassword == '' || PayPassword == null || PayPassword == undefined) { Ext.Msg.show({ title: Zi.LAN.TiShi, msg: '支付密码不能为空', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); //'委托分公司为必填!' return; }; var CompanyName = form.findField('CompanyName').getValue(); if (CompanyName == '' || CompanyName == null || CompanyName == undefined) { Ext.Msg.show({ title: Zi.LAN.TiShi, msg: '公司全称不能为空', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); //'委托分公司为必填!' return; }; _this.onCreateRegFn() } }, { text: "关闭", minWidth: 70, handler: function () { _this.winRegisterShow.close(); } }] }); var btnCreatePay = Ext.getCmp('btnCreatePay'); var btnCreateReg = Ext.getCmp('btnCreateReg'); var btnCreateUrl = Ext.getCmp('btnCreateUrl'); Ext.Ajax.request({ waitMsg: '正在查询', url: '/MvcShipping/MsBaseInfo/GetUserModuleEnable', params: { modulename: 'modUsdPay' }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (result.Success) { btnCreatePay.show(); btnCreateReg.show(); btnCreateUrl.show(); } else { btnCreatePay.hide(); btnCreateReg.hide(); btnCreateUrl.hide(); } } }, scope: this }); }, //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: Zi.LAN.DELETECHENGGONG, 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 bodyAddDatas = []; 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; } bodyAddDatas.push(rec); } } _this = this; if (BILLNOStr == '') { } else { var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas); Ext.Ajax.request({ waitMsg: Zi.LAN.Msg_Adding, url: '/Account/Chfee_settlement/LockListNew', params: { data: jsonbodyAddDatas }, 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 }); }; }, onCreatePayClick: 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 GID = selections[0].data.GID; var BILLNO = selections[0].data.BILLNO; _this = this; if (GID == '') { } else { Ext.Ajax.request({ waitMsg: Zi.LAN.Msg_Adding, url: '/Account/Chfee_Pay/CreatePay', params: { GID: GID }, 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.UsdPayForm.getForm().reset(); _this.UsdPayForm.getForm().setValues(result.Data); _this.winUsdPayShow.show(); _this.storeChfeeFile1.load({ params: { start: 0, limit: 9999, BillNo: BILLNO } }); } } else { Ext.MessageBox.alert(Zi.LAN.Error, response.responseText); } }, scope: this }); } }, onCreatePayFn: function () { if (this.storeChfeeFile1.getCount() == 0) { Ext.Msg.show({ title: Zi.LAN.TiShi, msg: '发票文件不能为空!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var data = this.UsdPayForm.getForm().getValues(); var bodyctndatas = []; for (var i = 0; i < this.storeChfeeFile1.getCount(); i += 1) { var member = this.storeChfeeFile1.getAt(i); bodyctndatas.push(member); }; var jsonCtnBody = ConvertRecordsToJsonAll(bodyctndatas); Ext.Ajax.request({ waitMsg: Zi.LAN.ZhengZaiCaoZuoShuJu, url: '/Account/Chfee_Pay/SendPay', params: { filedata: jsonCtnBody, data: Ext.JSON.encode(data) }, 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 { Ext.Msg.show({ title: Zi.LAN.TiShi, msg: result.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); _this.onDsQuery(); _this.winUsdPayShow.close(); } } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: this }); }, onCreateRegClick: function () { this.storePayCity.load(); Ext.Ajax.request({ waitMsg: Zi.LAN.Msg_Adding, url: '/Account/Chfee_Pay/CreateReg', params: { GID: '' }, 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.RegisterFrom.getForm().reset(); _this.RegisterFrom.getForm().setValues(result.Data); _this.winRegisterShow.show(); } } else { Ext.MessageBox.alert(Zi.LAN.Error, response.responseText); } }, scope: this }); }, onCreateRegFn: function () { var data = this.RegisterFrom.getForm().getValues(); Ext.Ajax.request({ waitMsg: Zi.LAN.ZhengZaiCaoZuoShuJu, url: '/Account/Chfee_Pay/SendReg', params: { data: Ext.JSON.encode(data) }, 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 { Ext.Msg.show({ title: Zi.LAN.TiShi, msg: result.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); _this.winRegisterShow.close(); } } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: this }); }, onCreateUrlClick: function () { Ext.Ajax.request({ waitMsg: Zi.LAN.ZhengZaiCaoZuoShuJu, url: '/Account/Chfee_Pay/CreateUrl', params: { GID:'' }, 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 { DsOpenEditWin(result.Data); } } else { Ext.MessageBox.alert('请求出现错误,请重试', 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 CustNo = form.findField('CustNo').getValue(); sql = sql + getAndConSql(sql, CustNo, "exists (SELECT 1 FROM CH_FEE_DO d LEFT JOIN V_OP_BILL B ON (B.BSNO=D.BSNO) WHERE cm.BILLNO=d.BILLNO AND (b.CUSTNO+''+b.MBLNO+''+b.HBLNO+''+b.CUSTOMNO+''+b.ORDERNO) like '%" + CustNo + "%' )"); 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; }, onAddFileClick: 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 BILLNO = selections[0].data.BILLNO; var winAccess = new Shipping.FileUpload({}); winAccess.BillNo = BILLNO; winAccess.storeChfeeFile = this.storeChfeeFile1; winAccess.show(); }, onDelFileClick: function () { var selections = this.fileGrid1.getSelectionModel().getSelection(); if (selections.length == 0) {//提示', msg: '请先选择要删除的数据! Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.NoFeeDetai2Del, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var record = new Array(); for (var i = 0; i < selections.length; i++) { record.push(selections[i].data); } //提示', '确定删除该记录吗?' Ext.MessageBox.confirm(Zi.LAN.TiShi, Zi.LAN.Sure2DelTheRecode, function (btn) { if (btn == 'yes') { var selectedRecords = this.fileGrid1.selModel.getSelection(); for (var i = 0; i < selectedRecords.length; i++) { this.storeChfeeFile1.remove(selectedRecords[i]); } } }, this); }, 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 });