diff --git a/DSWeb/Areas/Account/Controllers/Chfee_settlementController.cs b/DSWeb/Areas/Account/Controllers/Chfee_settlementController.cs index c3fb8eec..79884866 100644 --- a/DSWeb/Areas/Account/Controllers/Chfee_settlementController.cs +++ b/DSWeb/Areas/Account/Controllers/Chfee_settlementController.cs @@ -1166,6 +1166,49 @@ namespace DSWeb.Areas.Account.Controllers var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = count, data = dataList.ToList() }); return new ContentResult() { Content = json }; } + + public ContentResult AddDui(string bill, string data, string curr, string storeCurrExrate, int billtype, string addcurr) + { + var exrateList = JsonConvert.Deserialize>(storeCurrExrate); + var bodyList = JsonConvert.Deserialize>(data); + + if (((exrateList == null) || (exrateList.Count == 0)) && (addcurr != curr)) + { + + exrateList = ChsettlementDAL.GetAppCurrExrateData(bodyList, curr, addcurr); + if (exrateList.Count == 0) + { + var modb = new ModelObjectDB(); + DBResult result = ChsettlementDAL.AddRecvAppDCDetail(bill, bodyList, curr, Convert.ToString(Session["COMPANYID"]), addcurr, exrateList); + if (result.Success) { ChsettlementDAL.p_update_Amount(bill, billtype); } + + var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message }; + return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) }; + + + } + else + { + var jsonRespose = new JsonResponse { Success = true, Message = "查询成功", Data = exrateList.ToList() }; + return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) }; + + + } + + } + else + { + + var modb = new ModelObjectDB(); + DBResult result = ChsettlementDAL.AddRecvAppDCDetail(bill, bodyList, curr, Convert.ToString(Session["COMPANYID"]), addcurr, exrateList); + if (result.Success) { ChsettlementDAL.p_update_Amount(bill, billtype); } + + var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message }; + return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) }; + } + + } + #endregion diff --git a/DSWeb/Areas/Account/Viewsjs/Chfee_settlement/ChRecvDuiBLsettlementEdit.js b/DSWeb/Areas/Account/Viewsjs/Chfee_settlement/ChRecvDuiBLsettlementEdit.js index bba9e76e..521cdd9f 100644 --- a/DSWeb/Areas/Account/Viewsjs/Chfee_settlement/ChRecvDuiBLsettlementEdit.js +++ b/DSWeb/Areas/Account/Viewsjs/Chfee_settlement/ChRecvDuiBLsettlementEdit.js @@ -13,7 +13,10 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { StoreList: null, EditRecord: null, addstore: false, - PageSize: 30, + PageSize: 20, + BodyPageSize: 20, + sqlcontext: '', + initUIComponents: function () { this.serialNo = 0; @@ -27,12 +30,12 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { this.sortdire = ''; this.MsPeriod = null; this.canedit = false; - this.FeeDetailSql = ''; + this.selectfeesql = ''; this.STLSHOWVOU = 0; this.ISRATESET = 0; - this.sqlcontext = ''; - this.formname = "MsChRecvDuiSettlementEdit"; //页面名称 + this.FREESTLBYINPUTEXCHANGE = 0; + this.formname = "MsChRecvDuiSettlementEdit"; //页面名称 this.storeMustBe = Ext.create('Ext.data.Store', { model: 'DsShipping.ux.OpDefValue', remoteSort: true, @@ -47,17 +50,38 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { } }); + this.storeCurrExrate = Ext.create('Ext.data.Store', { + fields: ['CURR', 'EXRATE', 'DFEXRATE'] + }); this.StoreLockOp = Ext.create('DsExt.ux.RefTableStore', { model: 'MsFeeOP', proxy: { url: '/MvcShipping/MsBaseInfo/GetOpIDRang' } }); -// this.StoreLockOp.load({ params: { optype: "modRecvFeeSettlementLock"} }); + // this.StoreLockOp.load({ params: { optype: "modRecvFeeSettlementLock"} }); this.StoreUnLockOp = Ext.create('DsExt.ux.RefTableStore', { model: 'MsFeeOP', proxy: { url: '/MvcShipping/MsBaseInfo/GetOpIDRang' } }); -// this.StoreUnLockOp.load({ params: { optype: "modRecvFeeSettlementUnLock"} }); + // this.StoreUnLockOp.load({ params: { optype: "modRecvFeeSettlementUnLock"} }); + + Ext.define('DsShipping.ux.MsClientGroup', { + extend: 'Ext.data.Model', + fields: [ + { name: 'SHORTNAME', type: 'string' }, + { name: 'PCORPNAME', type: 'string' }, + { name: 'CODENAME', type: 'string' } + ] + }); + + + this.StoreClientGroup = Ext.create('DsExt.ux.RefTableStore', { + model: 'DsShipping.ux.MsClientGroup', + proxy: { url: '/MvcShipping/MsInfoClient/GetClientGroupList' } + }); + this.StoreClientGroup.load({ params: { condition: "PCORPNAME<>'' " } + }); + //#region 编辑form @@ -67,11 +91,11 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { //表参照相关(编辑form) this.storeCustCode = Ext.create('DsExt.ux.RefTableStore', { - model: 'DsShipping.ux.CustomRefModel', - proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListRm' } + model: 'DsShipping.ux.CustomInvRefModel', + proxy: { url: '/CommMng/BasicDataRef/GetCustomInvRefListRm' } }); - // this.storeCustCode.load({ params: { condition: ""} }); +// this.storeCustCode.load({ params: { condition: ""} }); this.comboxCustCode = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: Zi.LAN.CustomerName, store: this.storeCustCode, @@ -95,6 +119,25 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { CUSTNAME.setValue(CUSTOMERNAME); } + var recs = DsStoreQueryBy(this.storeCustCode, 'CustName', records[0].data.CustName); + var CUSTBANK = this.formEdit.getForm().findField('CUSTBANK'); + var CUSTACCOUNT = this.formEdit.getForm().findField('CUSTACCOUNT'); + var CURR = this.formEdit.getForm().findField('CURR').getValue(); + if (recs.getCount() > 0) { + var data = recs.getAt(0).data; + if (CURR == 'RMB') { + CUSTBANK.setValue(data.RMBBank); + CUSTACCOUNT.setValue(data.RMBAccount); + } else if (CURR == 'USD') { + CUSTBANK.setValue(data.USDBank); + CUSTACCOUNT.setValue(data.USDAccount); + + } + } else { + CUSTBANK.setValue(''); + CUSTACCOUNT.setValue(''); + } + } @@ -125,7 +168,6 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { store: this.StoreCurr, forceSelection: true, allowBlank: false, - emptyText: '原币结算', //原币申请 flex: 0.5, name: 'CURR', valueField: 'CURR', @@ -134,6 +176,26 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { scope: this, 'select': function (combo, records, eOpts) { if (records.length > 0) { + var CUST = this.formEdit.getForm().findField('CUSTOMERNAME').getValue(); + var recs = DsStoreQueryBy(this.storeCustCode, 'CustName', CUST); + var CUSTBANK = this.formEdit.getForm().findField('CUSTBANK'); + var CUSTACCOUNT = this.formEdit.getForm().findField('CUSTACCOUNT'); + var CURR = this.formEdit.getForm().findField('CURR').getValue(); + if (recs.getCount() > 0) { + var data = recs.getAt(0).data; + if (CURR == 'RMB') { + CUSTBANK.setValue(data.RMBBank); + CUSTACCOUNT.setValue(data.RMBAccount); + } else if (CURR == 'USD') { + CUSTBANK.setValue(data.USDBank); + CUSTACCOUNT.setValue(data.USDAccount); + + } + } else { + CUSTBANK.setValue(''); + CUSTACCOUNT.setValue(''); + } + var curr = this.formACCOUNTS.getForm().findField('ACCOUNTS_CURRENCY'); curr.setValue(records[0].data.CURR); var curr = this.formPREPAY.getForm().findField('PREPAY_CURRENCY'); @@ -144,6 +206,26 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { curr.setValue(records[0].data.CURR); var curr = this.formADVANCE.getForm().findField('ADVANCE_CURRENCY'); curr.setValue(records[0].data.CURR); + if (CURR == 'RMB') { + this.formEdit.getForm().findField('RATE').setValue(1); + } else { + var FFrecords = DsStoreQueryBy(this.StoreDateCurr, 'CURR', CURR); + if (FFrecords.getCount() > 0) { + var ffdata = FFrecords.getAt(0).data; + var DEFRATE = ffdata.DEFRATE; + this.formEdit.getForm().findField('RATE').setValue(DEFRATE); + } else { + var DFrecords = DsStoreQueryBy(this.StoreCurr, 'CURR', CURR); + if (DFrecords.getCount() > 0) { + var dfdata = DFrecords.getAt(0).data; + var DEFRATE = dfdata.DEFRATE; + this.formEdit.getForm().findField('RATE').setValue(DEFRATE); + } else { + this.formEdit.getForm().findField('RATE').setValue(1); + } + } + + } } } @@ -162,7 +244,7 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { fieldLabel: Zi.LAN.SettlementType, store: this.StoreStlMode, forceSelection: true, - flex: 0.6, + flex: 0.5, name: 'SETTLETYPE', valueField: 'STLCODE', displayField: 'STLNAME' @@ -173,6 +255,7 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { proxy: { url: '/MvcShipping/MsBaseInfo/GetBANKList' } }); //this.StoreBANK.load({ params: { condition: ""} }); + this.StoreBANK.on('beforeload', function (store) { var companyid = this.formEdit.getForm().findField('SALECORPID').getValue(); Ext.apply(store.proxy.extraParams, { companyid: companyid }); @@ -188,6 +271,7 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { }); + this.storeSTLCATEGROY = Ext.create('DsExt.ux.RefEnumStore', {}); this.storeSTLCATEGROY.load({ params: { enumTypeId: 97020} }); @@ -206,7 +290,6 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { }); this.storeSaleCompany.load({ params: { condition: ""} }); - this.comboxSaleCompany = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: Zi.LAN.DepartmentName, //'委托分公司', store: this.storeSaleCompany, @@ -220,7 +303,7 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { if (records.length > 0) { var CURR = this.formEdit.getForm().findField('CURR').getValue(); this.StoreBANK.load({ - params: { condition: "" }, + params: {condition: "" }, callback: function (r, options, success) { if (success) { if (this.StoreBANK.getCount() > 0) { @@ -248,6 +331,7 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { frame: true, bodyPadding: 3, trackResetOnLoad: true, + // autoScroll: true, fieldDefaults: { margins: '2 2 2 2', @@ -315,7 +399,6 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { fieldLabel: 'HXBILLNO', name: 'HXBILLNO', flex: 0, hidden: true, margins: '0' }, - { fieldLabel: Zi.LAN.BillNo, readOnly: true, @@ -342,8 +425,8 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { items: [this.comboxCurr, { fieldLabel: Zi.LAN.Money, readOnly: true, - labelWidth: 40, flex: 0.5, + labelWidth: 40, name: 'AMOUNT', renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { @@ -362,27 +445,35 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { } return value; } - }, this.comboxStlMode,{ - fieldLabel: Zi.LAN.ExchangeRate, - labelWidth: 40, - flex: 0.4, - name: 'RATE' + }, this.comboxStlMode, { + fieldLabel: Zi.LAN.ExchangeRate, + flex: 0.5, + labelWidth: 50, + name: 'RATE' }, this.comboxBANK, { fieldLabel: Zi.LAN.SettlementNo, flex: 1, name: 'SETTLENO' - }, this.comboxSaleCompany] + },this.comboxSaleCompany] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', - items: [this.comboxSTLCATEGROY, { + items: [{ + fieldLabel: Zi.LAN.JSDanWeiBank, + flex: 1, + name: 'CUSTBANK' + }, { + fieldLabel: Zi.LAN.JSDanWeiAccount , + flex: 1, + name: 'CUSTACCOUNT' + }, this.comboxSTLCATEGROY, { fieldLabel: Zi.LAN.Remark, - flex: 3, + flex: 1, name: 'REMARK' }, { - fieldLabel: Zi.LAN.VoucherNo_PayBL, + fieldLabel: Zi.LAN.VoucherNo, name: 'VOUCHERNO' }] @@ -424,6 +515,7 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { text: Zi.LAN.InZhangDanPrint, iconCls: "btnadd", handler: function (button, event) { + this.OprationStatus = 'add'; var BILLNO = this.formEdit.getForm().findField('BILLNO').getValue(); 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"; @@ -509,262 +601,358 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel'); //明细表-数据集 this.storeBodyList = Ext.create('Ext.data.Store', { - model: 'Payapplication_do_detail', + model: 'Chfee_do_detail', + pageSize: this.BodyPageSize, remoteSort: true, proxy: { type: 'ajax', - url: '/Account/Chfee_settlement/GetRecvdetailList', + url: '/Account/Chfee_settlement/GetBillList', reader: { - id: 'BILLNO', + id: 'BSNO,FEEDOID', root: 'data', totalProperty: 'totalCount' } } }); + this.BodyPagenum = Ext.create('Ext.form.field.Number', { + name: 'bottles', + fieldLabel: '每页记录数', //每页记录数 + labelAlign: 'right', + value: this.BodyPageSize, + maxValue: 100000, + width: 180, + minValue: 0, + listeners: { + specialkey: function (field, e) { + if (e.getKey() == e.ENTER) { + _this.storeBodyList.reload(); + } + } + } + }); //明细表表格 this.gridListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', { clicksToEdit: 1 }); - - - this.gridList = new Ext.grid.GridPanel({ - store: this.storeBodyList, - enableHdMenu: false, - region: 'center', - loadMask: { msg: Zi.LAN.LoadData }, - trackMouseOver: true, - disableSelection: false, - viewConfig: { - enableTextSelection: true - }, - selModel: this.GridCheckBoxModel, - tbar: [{ - text:Zi.LAN.DeleteApplyDetail, - tooltip:Zi.LAN.DeleteApplyDetail, - id: 'btndeldetail', - iconCls: "btndeletedetail", - handler: function (button, event) { - this.onDeleteClick(button, event, 1); - }, - scope: this - }], - columns: [{ - sortable: true, - dataIndex: 'BILLNO', - header: Zi.LAN.ApplyBillNo, - width: 100 + this.initgirdbillcolums = [{ + sortable: true, + dataIndex: 'BILLNO', + header: 'BILL', + hidden: true, + width: 100 + }, { + sortable: true, + dataIndex: 'BSNO', + header: 'BSNO', + hidden: true, + width: 100 + }, { + sortable: true, + dataIndex: 'FEEDOID', + header: 'FEEDOID', + hidden: true, + width: 100 + }, { + sortable: true, + dataIndex: 'CUSTNO', + header: Zi.LAN.DelegateNumber, + width: 120 + }, { + sortable: true, + dataIndex: 'MBLNO', + header: Zi.LAN.LadingNumber, + width: 120 }, { sortable: true, - dataIndex: 'BILLSTATUSREF', - header: Zi.LAN.BillStatus, - width: 60 + dataIndex: 'HBLNO', + header: Zi.LAN.FenladingNumber, + width: 120 }, { - sortable: true, - dataIndex: 'DOAMOUNT', - header: Zi.LAN.SettlementAmount, - width: 80, - 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; + sortable: true, + dataIndex: 'CUSTOMERNAME', + header: Zi.LAN.Requester, + width: 100 + }, { + sortable: true, + dataIndex: 'ETD', + header: Zi.LAN.SailingDate, + renderer: Ext.util.Format.dateRenderer('Y-m-d'), + width: 100 + }, { + sortable: true, + dataIndex: 'BSSOURCE', + header: Zi.LAN.BusinessSource, + width: 80 + }, { + sortable: true, + dataIndex: 'FEENAME', + header: Zi.LAN.CostName, + width: 80 + }, { + sortable: true, + dataIndex: 'FEETYPEREF', + header: Zi.LAN.FeeTypeRef, + width: 40 + }, { + sortable: true, + dataIndex: 'FEEOBJNAME', + header: Zi.LAN.Fyduixiang, + width: 80 + }, { + sortable: true, + dataIndex: 'AMOUNT', + header: Zi.LAN.SettlementAmount, + width: 80, + 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 + ''; } } - catch (e) { + else { return value; } + } + catch (e) { return value; } - }, { - sortable: true, - dataIndex: 'CURR', - header: Zi.LAN.OriginalCurrency, - width: 80 - }, { - sortable: true, - dataIndex: 'AMOUNT', - header: Zi.LAN.OriginalMoney, - width: 80, - 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; + return value; + } + }, { + sortable: true, + dataIndex: 'ORIGCURRENCY', + header: Zi.LAN.OriginalCurrency, + width: 80 + }, { + sortable: true, + dataIndex: 'ORIGEXCHANGERATE', + header: Zi.LAN.OriginalExchangeRate, + width: 80 + }, { + sortable: true, + dataIndex: 'EXCHANGERATE', + header: Zi.LAN.ConvertExchangeRate , + width: 80 + }, { + sortable: true, + dataIndex: 'ORIGAMOUNT', + header: Zi.LAN.OriginalMoney, + width: 80, + 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 + ''; } } - catch (e) { + else { return value; } + } + catch (e) { return value; } + return value; + } + }, { + sortable: true, + dataIndex: 'SALE', + header: Zi.LAN.LanhuoPeople, + width: 80 + }, { + sortable: true, + dataIndex: 'ENTERP', + header: Zi.LAN.BusinessUnit, + width: 80 + }, { + sortable: true, + dataIndex: 'CUSTOMNO', + header:Zi.LAN.DeclarationNumber, + width: 108 + }, { + sortable: true, + dataIndex: 'ACCDATE', + header: Zi.LAN.kuaiJiQJ, + width: 108 + }, { + sortable: true, + dataIndex: 'OPTYPE', + header: Zi.LAN.ChangeSingle, + width: 108 + }, { + sortable: true, + dataIndex: 'Remark', + header: Zi.LAN.Remark, + width: 180 + }, { + sortable: true, + dataIndex: 'INPUTMODE', + header: Zi.LAN.InputMode, + width: 160 }, { sortable: true, - dataIndex: 'APPLYTIME', - header: Zi.LAN.ApplyTime, - width: 80 + dataIndex: 'BSSALECORP', + header: Zi.LAN.BSSALECORP, + width: 160 }, { sortable: true, - dataIndex: 'APPLICANTNAME', - header: Zi.LAN.Sqperson, + dataIndex: 'VESSEL', + header: Zi.LAN.VESSEL, //揽货人 width: 80 }, { sortable: true, - dataIndex: 'PAYABLETIME', - header: Zi.LAN.ApplyShouKuanDate, + dataIndex: 'VOYNO', + header: Zi.LAN.VOYNO, //揽货人 width: 80 }, { sortable: true, - dataIndex: 'REMARK', - header: Zi.LAN.Remark, - width: 60 + dataIndex: 'CARRIER', + header: Zi.LAN.CARRIER, //揽货人 + width: 80 } - ] - }); - + ]; - - this.storeBodydetail = Ext.create('Ext.data.Store', { - model: 'Chfee_do_detail', - remoteSort: true, - proxy: { - type: 'ajax', - url: '/Account/Chfee_settlement/GetAppBodyList', - reader: { - root: 'data', - totalProperty: 'totalCount' - } - } - }); + this.girdbillcolums = this.initgirdbillcolums; - this.gridBodydetail = new Ext.grid.GridPanel({ - store: this.storeBodydetail, + this.gridList = new Ext.grid.GridPanel({ + store: this.storeBodyList, enableHdMenu: false, region: 'center', loadMask: { msg: Zi.LAN.LoadData }, trackMouseOver: true, + disableSelection: false, viewConfig: { enableTextSelection: true }, + selModel: this.GridCheckBoxModel, + tbar: [{ + text:Zi.LAN.DeleteApplyDetail, + tooltip:Zi.LAN.DeleteApplyDetail, + id: 'btndeldetail', + iconCls: "btndeletedetail", + handler: function (button, event) { + this.onDeleteClick(button, event, 1); + }, + scope: this + }, '-', { + text: Zi.LAN.SavelistStyle, + id: "btntestbody", + menu: [ + { text: Zi.LAN.Save , + handler: function (button, event) { + _this.girdbillcolums = DsTruck.SaveGridPanel(USERID, _this.formname + 'bill', _this.gridList.columns, _this.girdbillcolums, 1, true); + } + }, { text: Zi.LAN.Initialization, + handler: function (menu, event) { + _this.girdbillcolums = DsTruck.SaveGridPanel(USERID, _this.formname + 'bill', _this.gridList.columns, _this.initgirdbillcolums, 1, true); + } + }], + scope: this + }, + { + fieldLabel: "单号", + labelWidth: 40, + xtype: 'textfield', + name: 'BSNO', + id: 'BILLBSNO', + listeners: { + specialkey: function (field, e) { + if (e.getKey() == e.ENTER) { + var billno = _this.formEdit.getForm().findField('BILLNO').getValue(); + var mblno = field.value; + var sql = " BILLNO='" + billno + "' "; + if (mblno != '' && mblno != null) { + sql = sql + " and (b.MBLNO+b.HBLNO+b.CUSTNO+b.ORDERNO like '%" + mblno + "%') "; + } + + _this.storeBodyList.load({ params: { start: 0, limit: _this.BodyPageSize, condition: sql } }); + } + } + } + }, '-', { + text: "导出Excel", + iconCls: 'btnexportexcel', + handler: function (button, event) { + this.onExportDetailClick(button, event); + }, + scope: this + }], + columns: this.girdbillcolums, + bbar: [Ext.create('Ext.PagingToolbar', { + store: this.storeBodyList, + displayInfo: true, + displayMsg: '当前显示条数据', //当前显示条数据 + emptyMsg: '没有数据'//没有数据 + }), this.BodyPagenum] + }); + + this.gridList.addListener('sortchange', function (ct, column, direction, eOpts) { + this.sortfield = column.dataIndex; + this.sortdire = direction; + }, this); + + this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) { + this.SelectedRecord = record; + var openSet = "height=700, width=1024, toolbar=no, menubar=no,scrollbars=1, resizable=1,location=no, status=no,Top= " + (screen.height - 750) / 2 + ",Left= " + (screen.width - 1100) / 2 + var openType = "_blank"; + var openUrl = ""; + openUrl = "../../MvcShipping/MsOpBill/MsOpFeeView?handle=check&bsno=" + record.data.BSNO; + + window.open(openUrl, openType, openSet); + }, this); + + + this.girdbillcolums = DsTruck.GetGridPanel(USERID, this.formname + 'bill', this.girdbillcolums, 1); //使用者id,表名,中间column数组,跳过一开始的几列 + this.girdbillcolums.unshift(new Ext.grid.RowNumberer()); + this.gridList.reconfigure(this.storeBodyList, this.girdbillcolums); + + this.storeBodySum = Ext.create('Ext.data.Store', { + model: 'Chfee_do_sum', + remoteSort: true, + proxy: { + type: 'ajax', + url: '/Account/Chfee_settlement/GetBillSum', + reader: { + root: 'data', + totalProperty: 'totalCount' + } + } + }); + + + this.gridSum = new Ext.grid.GridPanel({ + store: this.storeBodySum, + enableHdMenu: false, + region: 'center', + loadMask: { msg: Zi.LAN.LoadData }, + trackMouseOver: true, disableSelection: false, tbar: [{ xtype: 'label', width: 120, height: 22, - text: Zi.LAN.ChargeDetails + text: Zi.LAN.SumJieSunAmount }], columns: [{ - sortable: true, - dataIndex: 'BILLNO', - header: 'BILL', - hidden: true, - width: 100 - }, { - sortable: true, - dataIndex: 'BSNO', - header: 'BSNO', - hidden: true, - width: 100 - }, { - sortable: true, - dataIndex: 'FEEDOID', - header: 'FEEDOID', - hidden: true, - width: 100 - }, { - sortable: true, - dataIndex: 'COMPANYNAME', - header: '分公司', - width: 80 - }, { - sortable: true, - dataIndex: 'CUSTNO', - header: Zi.LAN.DelegateNumber, - width: 120 - }, { - sortable: true, - dataIndex: 'MBLNO', - header: Zi.LAN.LadingNumber, - width: 120 - }, { - sortable: true, - dataIndex: 'CUSTOMERNAME', - header: Zi.LAN.Requester, - width: 100 - }, { - sortable: true, - dataIndex: 'ETD', - header: Zi.LAN.SailingDate, - renderer: Ext.util.Format.dateRenderer('Y-m-d'), - width: 100 - }, { - sortable: true, - dataIndex: 'BSSOURCE', - header: Zi.LAN.BusinessSource, - width: 80 - }, { - sortable: true, - dataIndex: 'FEENAME', - header: Zi.LAN.CostName, - width: 80 - }, { sortable: true, dataIndex: 'FEETYPEREF', header: Zi.LAN.FeeTypeRef, width: 40 }, { sortable: true, - dataIndex: 'AMOUNT', - header: Zi.LAN.SettlementAmount, - width: 80, - 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: 'ORIGCURRENCY', - header: Zi.LAN.OriginalCurrency, - width: 80 - }, { - sortable: true, - dataIndex: 'ORIGEXCHANGERATE', - header: Zi.LAN.OriginalExchangeRate, - width: 80 - }, { - sortable: true, - dataIndex: 'EXCHANGERATE', - header: Zi.LAN.ConvertExchangeRate , + dataIndex: 'CURRENCY', + header: Zi.LAN.Currency , width: 80 }, { sortable: true, - dataIndex: 'ORIGAMOUNT', - header: Zi.LAN.OriginalMoney, + dataIndex: 'AMOUNT', + header: Zi.LAN.Money, width: 80, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { @@ -783,51 +971,13 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { } return value; } - }, { - sortable: true, - dataIndex: 'INVOICENO', - header: Zi.LAN.InvoiceNumber, - width: 80 - }, { - sortable: true, - dataIndex: 'SALE', - header: Zi.LAN.LanhuoPeople, - width: 80 - }, { - sortable: true, - dataIndex: 'INPUTMODE', - header: Zi.LAN.InputMode, - width: 160 - }, { - sortable: true, - dataIndex: 'ACCDATE', - header: Zi.LAN.kuaiJiQJ, - width: 80 - }, { - sortable: true, - dataIndex: 'BSSALECORP', - header: Zi.LAN.BSSALECORP, - width: 160 - } + } ] }); - this.gridBodydetail.addListener('itemdblclick', function (dataview, record, item, index, e, b) { - this.SelectedRecord = record; - var openSet = "height=700, width=1024, toolbar=no, menubar=no,scrollbars=1, resizable=1,location=no, status=no,Top= " + (screen.height - 750) / 2 + ",Left= " + (screen.width - 1100) / 2 - var openType = "_blank"; - var openUrl = ""; - openUrl = "../../MvcShipping/MsOpBill/MsOpFeeView?handle=check&bsno=" + record.data.BSNO; - - window.open(openUrl, openType, openSet); - }, this); - this.gridBodydetail.addListener('sortchange', function (ct, column, direction, eOpts) { - this.sortfield = column.dataIndex; - this.sortdire = direction; - }, this); - this.storeAddFeeList = Ext.create('Ext.data.Store', { + this.storeBodyAddList = Ext.create('Ext.data.Store', { pageSize: this.PageSize, model: 'MsChDui', remoteSort: true, @@ -842,33 +992,26 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { } }); + //明细表表格 - this.AddFeeGridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel'); - this.cellEditingFee = Ext.create('Ext.grid.plugin.CellEditing', { - clicksToEdit: 1, + 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: { - 'edit': function (editor, e) { - + specialkey: function (field, e) { + if (e.getKey() == e.ENTER) { + _this.onRefreshClick(); + } } } - }); - _this = this; - - this.CurrGroup = new Ext.form.RadioGroup({ - id: 'CurrGroup', - xtype: 'radiogroup', - fieldLabel: Zi.LAN.ExchangeCurrency, - columns: 2, - items: [ - { boxLabel: 'RMB', name: 'Curr', inputValue: 'RMB', checked: true }, - { boxLabel: 'USD', name: 'Curr', inputValue: 'USD' } - ] - }); - - - this.initgirdfeecolums = [{ + this.initgirdbilladdcolums = [{ sortable: true, dataIndex: 'DUINO', header: '对账编号', //对账编号 @@ -919,7 +1062,7 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { width: 80 }, { sortable: true, - dataIndex: 'BALRMBDR', + dataIndex: 'STLRMBDR', header: '本次结算RMB', //未收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', @@ -949,7 +1092,7 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { width: 80 }, { sortable: true, - dataIndex: 'BALUSDDR', + dataIndex: 'STLUSDDR', header: '本次结算USD', //未收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', @@ -979,7 +1122,7 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { width: 80 }, { sortable: true, - dataIndex: 'BALOTDR', + dataIndex: 'STLOTDR', header: '本次结算OT', //未收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', @@ -996,332 +1139,152 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { }, { sortable: true, dataIndex: 'REMARKS', - header: Zi.LAN.shuoming, //说明 + header: '说明', //说明 width: 160 } ]; - this.girdfeecolums = this.initgirdfeecolums; + this.cellEditingFee = Ext.create('Ext.grid.plugin.CellEditing', { + clicksToEdit: 1, + listeners: { + 'edit': function (editor, e) { + + } + } + + }); + + this.girdbilladdcolums = this.initgirdbilladdcolums; //使用者id,表名,中间column数组,跳过一开始的几列 - this.gridAddFeeList = new Ext.grid.GridPanel({ - store: this.storeAddFeeList, + this.AddGridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel'); + this.gridAddList = new Ext.grid.GridPanel({ + store: this.storeBodyAddList, enableHdMenu: false, - region: 'west', - split: true, - width: 860, + region: 'center', loadMask: { msg: Zi.LAN.LoadData }, trackMouseOver: true, disableSelection: false, + plugins: [this.cellEditingFee], viewConfig: { enableTextSelection: true }, - plugins: [this.cellEditingFee], - selModel: this.AddFeeGridCheckBoxModel, + selModel: this.AddGridCheckBoxModel, tbar: [{ - text: Zi.LAN.AddApplyDetail , - id: "btnadddetail", - iconCls: 'btnadddetail', + text: Zi.LAN.AddJSDetail, + tooltip: Zi.LAN.AddJSDetail, + id: 'btnaddbill', + iconCls: "btnadddetail", + handler: function (button, event) { + this.onAddClick(button, event); + }, + scope: this + }, '-', { + text: Zi.LAN.SavelistStyle, + id: "btntest", menu: [ - { text: Zi.LAN.AllApplyAmount, - handler: function (menu, event) { - _this.onAddDetailClick(menu, event, ''); - } - }, { text: Zi.LAN.OnlyRMBApplyAmount, - handler: function (menu, event) { - _this.onAddDetailClick(menu, event, 'RMB'); + { text: Zi.LAN.Save , + handler: function (button, event) { + _this.girdbilladdcolums = DsTruck.SaveGridPanel(USERID, _this.formname + 'billadd', _this.gridAddList.columns, _this.girdbilladdcolums, 1, true); } - }, { text: Zi.LAN.OnlyUSDApplyAmount, + }, { text: Zi.LAN.Initialization, handler: function (menu, event) { - _this.onAddDetailClick(menu, event, 'USD'); + _this.girdbilladdcolums = DsTruck.SaveGridPanel(USERID, _this.formname + 'billadd', _this.gridAddList.columns, _this.initgirdbilladdcolums, 1, true); } }], - scope: this - }, '-', { - text: Zi.LAN.SavelistStyle, - menu: [ - { - text: Zi.LAN.Save, - handler: function (button, event) { - _this.girdfeecolums = DsTruck.SaveGridPanel(USERID, _this.formname + 'feeadd', _this.gridAddFeeList.columns, _this.girdfeecolums, 1, true); - } - }, { - text: Zi.LAN.Initialization, - handler: function (menu, event) { - _this.girdfeecolums = DsTruck.SaveGridPanel(USERID, _this.formname + 'feeadd', _this.gridAddFeeList.columns, _this.initgirdfeecolums, 1, true); - } - }], - scope: this - }], - columns: this.girdfeecolums , + }], + columns: this.girdbilladdcolums, // paging bar on the bottom - bbar: Ext.create('Ext.PagingToolbar', { - store: this.storeAddFeeList, + bbar: [Ext.create('Ext.PagingToolbar', { + store: this.storeBodyAddList, displayInfo: true, displayMsg: Zi.LAN.FenYe, emptyMsg: Zi.LAN.DataEmptyMsg - }) + }), this.Pagenum] + }); + this.gridAddList.addListener('itemdblclick', function (dataview, record, item, index, e, b) { + //this.SelectedRecord = record; + //var openSet = "height=700, width=1024, toolbar=no, menubar=no,scrollbars=1, resizable=1,location=no, status=no,Top= " + (screen.height - 750) / 2 + ",Left= " + (screen.width - 1100) / 2 + //var openType = "_blank"; + //var openUrl = ""; + //openUrl = "../../MvcShipping/MsOpBill/MsOpFeeView?handle=check&bsno=" + record.data.BSNO; + + //window.open(openUrl, openType, openSet); + // DsOpenEditWin("/TruckMng/MsWlPc/Edit"); + }, this); + this.gridAddList.on('edit', function (editor, e, eOpts) { + this.gridAddListAfterEdit(editor, e, eOpts); + }, this); - this.girdfeecolums = DsTruck.GetGridPanel(USERID, this.formname + 'feeadd', this.girdfeecolums, 1); //使用者id,表名,中间column数组,跳过一开始的几列 - this.gridAddFeeList.reconfigure(this.storeAddFeeList, this.girdfeecolums); + this.girdbilladdcolums = DsTruck.GetGridPanel(USERID, this.formname + 'billadd', this.girdbilladdcolums, 1); //使用者id,表名,中间column数组,跳过一开始的几列 + this.girdbilladdcolums.unshift(new Ext.grid.RowNumberer()); + this.gridAddList.reconfigure(this.storeBodyAddList, this.girdbilladdcolums); - this.gridAddFeeList.on('edit', function (editor, e, eOpts) { - this.gridAddFeeListAfterEdit(editor, e, eOpts); + this.gridAddList.addListener('sortchange', function (ct, column, direction, eOpts) { + this.addsortfield = column.dataIndex; + this.addsortdire = direction; }, this); _this = this; + this.CurrGroup = new Ext.form.RadioGroup({ + id: 'CurrGroup', + xtype: 'radiogroup', + fieldLabel: Zi.LAN.ExchangeCurrency, + columns: 2, + items: [ + { boxLabel: 'RMB', name: 'Curr', inputValue: 'RMB', checked: true }, + { boxLabel: 'USD', name: 'Curr', inputValue: 'USD' } + ] + }); - - this.storeAddBodydetail = Ext.create('Ext.data.Store', { - model: 'Chfee_do_detail', - remoteSort: true, - proxy: { - type: 'ajax', - url: '/Account/Chfee_recvapplication/GetBillList', - reader: { - root: 'data', - totalProperty: 'totalCount' - } - } + _this = this; + this.storeCustCode2 = Ext.create('DsExt.ux.RefTableStore', { + model: 'DsShipping.ux.CustomRefModel', + proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListRm' } }); - - this.initgirdfeecolums = [{ - sortable: true, - dataIndex: 'BILLNO', - header: 'BILL', - hidden: true, - width: 100 - }, { - sortable: true, - dataIndex: 'BSNO', - header: 'BSNO', - hidden: true, - width: 100 - }, { - sortable: true, - dataIndex: 'FEEDOID', - header: 'FEEDOID', - hidden: true, - width: 100 - }, { - sortable: true, - dataIndex: 'CUSTNO', - header: Zi.LAN.DelegateNumber, - width: 120 - }, { - sortable: true, - dataIndex: 'MBLNO', - header: Zi.LAN.LadingNumber, - width: 120 - }, { - sortable: true, - dataIndex: 'CUSTOMERNAME', - header: Zi.LAN.Requester, - width: 100 - }, { - sortable: true, - dataIndex: 'ETD', - header: Zi.LAN.SailingDate, - renderer: Ext.util.Format.dateRenderer('Y-m-d'), - width: 100 - }, { - sortable: true, - dataIndex: 'BSSOURCE', - header: Zi.LAN.BusinessSource, - width: 80 - }, { - sortable: true, - dataIndex: 'FEENAME', - header: Zi.LAN.CostName, - width: 80 - }, { - sortable: true, - dataIndex: 'FEETYPEREF', - header: Zi.LAN.FeeTypeRef, - width: 40 - }, { - sortable: true, - dataIndex: 'AMOUNT', - header: Zi.LAN.ApplyAmount, - width: 80, - 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: 'DOAMOUNT', - header: Zi.LAN.SettlementAmount, - width: 80, - 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: 'ORIGCURRENCY', - header: Zi.LAN.OriginalCurrency, - width: 80 - }, { - sortable: true, - dataIndex: 'ORIGAMOUNT', - header: Zi.LAN.OriginalMoney, - width: 80, - 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: 'SALE', - header: Zi.LAN.LanhuoPeople, - width: 80 - } - ]; - - this.girdfeecolums = this.initgirdfeecolums; - - this.gridAddBodydetail = new Ext.grid.GridPanel({ - store: this.storeAddBodydetail, - enableHdMenu: false, - region: 'center', - loadMask: { msg: Zi.LAN.LoadData }, - trackMouseOver: true, - viewConfig: { - enableTextSelection: true - }, - disableSelection: false, - tbar: [{ - xtype: 'label', - width: 120, - height: 22, - text: Zi.LAN.ChargeDetails - }, '-', { - text: Zi.LAN.SavelistStyle, - id: "btntestfee", - menu: [ - { - text: Zi.LAN.Save , - handler: function (button, event) { - _this.girdfeecolums = DsTruck.SaveGridPanel(USERID, _this.formname + 'AddBodydetail', _this.gridAddBodydetail.columns, _this.girdfeecolums, 1, true); - } - }, { - text: Zi.LAN.Initialization, - handler: function (menu, event) { - _this.girdfeecolums = DsTruck.SaveGridPanel(USERID, _this.formname + 'AddBodydetail', _this.gridAddBodydetail.columns, _this.initgirdfeecolums, 1, true); - } - }], - scope: this - }], - columns: this.girdfeecolums - }); - - this.girdfeecolums = DsTruck.GetGridPanel(USERID, this.formname + 'AddBodydetail', this.girdfeecolums, 1); //使用者id,表名,中间column数组,跳过一开始的几列 - this.gridAddBodydetail.reconfigure(this.storeAddBodydetail, this.girdfeecolums); - - - this.storeCustCodefee = Ext.create('DsExt.ux.RefTableStore', { - model: 'DsShipping.ux.CustomRefModel', - proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListRm' } - }); - - // this.storeCustCodefee.load({ params: { condition: ""} }); - - this.comboxAddCustCode = Ext.create('DsExt.ux.RefTableCombox', { - fieldLabel: Zi.LAN.Fyduixiang, - store: this.storeCustCodefee, + // this.storeCustCode.load({ params: { condition: ""} }); + //委托单位 + this.comboxCustCode2 = Ext.create('DsExt.ux.RefTableCombox', { + fieldLabel: '对账客户', //对账客户 + store: this.storeCustCode2, forceSelection: true, + name: 'CustName', queryMode: 'remote', - minChars: 1, + minChars: 0, queryParam: 'CODENAME', - name: 'CUSTNAME', valueField: 'CustName', - displayField: 'CodeAndName' - - }); - - - this.comboxCurr2 = Ext.create('DsExt.ux.RefTableCombox', { - fieldLabel: Zi.LAN.Currency, - store: this.StoreCurr, - forceSelection: true, - labelWidth: 40, - flex: 0.5, - name: 'Currency', - valueField: 'CURR', - displayField: 'CURR' + displayField: 'CodeAndName', + enableKeyEvents: true, + listeners: { + //specialkey: function (field, e) { + keyup: function (field, e) { + if (e.getKey() == e.ENTER) { + _this.onRefreshClick(); + } + } + } }); - - - this.storeIsDebit = Ext.create('Ext.data.Store', { - fields: ['DC', 'NAME'] + this.storeOpCode = Ext.create('DsExt.ux.RefTableStore', { + model: 'DsShipping.ux.UserRefModel', + proxy: { url: '/CommMng/BasicDataRef/GetUserLinkRefList' } }); - this.storeIsDebit.add({ "DC": "1", "NAME": Zi.LAN.Yes }); - this.storeIsDebit.add({ "DC": "2", "NAME": Zi.LAN.No }); - - this.comboxIsDebit = Ext.create('DsExt.ux.RefTableCombox', { - fieldLabel: Zi.LAN.OnlyUnSettlementApply, - store: this.storeIsDebit, - valueField: 'DC', - labelWidth: 90, - flex: 0.6, - displayField: 'NAME', - forceSelection: true, - value: "1", - name: 'ISDEBIT' + this.storeOpCode.load(); + this.comboxOP = Ext.create('DsExt.ux.RefTableCombox', { + fieldLabel: '对帐人', //'揽货人', + store: this.storeOpCode, + labelWidth: 50, + name: 'OP', + valueField: 'UserName', + displayField: 'CodeAndName' }); - this.storeCurrExrate = Ext.create('Ext.data.Store', { - fields: ['CURR', 'EXRATE', 'DFEXRATE'] - }); - - this.formSearch = Ext.widget('form', { frame: true, region: 'north', @@ -1330,7 +1293,7 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { margins: '2 2 2 2', labelAlign: 'right', flex: 1, - labelWidth:70, + labelWidth: 60, msgTarget: 'qtip' }, @@ -1346,61 +1309,76 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', - items: [this.comboxAddCustCode, { - fieldLabel: Zi.LAN.ApplyBillNo, - name: 'CustomNo' - }, { - fieldLabel: Zi.LAN.Number, - tooltip: Zi.LAN.DelegateNumber + '、' + Zi.LAN.LadingNumber + '、' + Zi.LAN.FenladingNumber, - labelWidth: 40, - name: 'BH', + items: [ + { + fieldLabel: '对账编号', //对账编号 + labelWidth: 80, + name: 'BsNo', + enableKeyEvents: true, + listeners: { + specialkey: function (field, e) { + if (e.getKey() == e.ENTER) { + _this.onRefreshClick(); + } + } + } + }, this.comboxCustCode2, { + fieldLabel:'从对账日期', //从对账日期 + labelWidth: 80, + format: 'Y-m-d', + xtype: 'datefield', + name: 'ExpDateBgn', enableKeyEvents: true, listeners: { - specialkey: function (field, e) { + keyup: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } - }, this.comboxCurr2, { - fieldLabel: Zi.LAN.ExpDateBgn , - format: 'Y-m-d', - xtype: 'datefield', - name: 'ExpDateBgn' }, { - fieldLabel: Zi.LAN.ExpDateEnd, + fieldLabel:'到对账日期', //到对账日期 format: 'Y-m-d', - xtype: 'datefield', - name: 'ExpDateEnd' - }, this.comboxIsDebit, { + labelWidth: 80, + xtype: 'datefield', + name: 'ExpDateEnd', + enableKeyEvents: true, + listeners: { + keyup: function (field, e) { + if (e.getKey() == e.ENTER) { + _this.onRefreshClick(); + } + } + } + }, { + fieldLabel:'对账描述', //对账描述 + name: 'DUINAME', + enableKeyEvents: true, + listeners: { + specialkey: function (field, e) { + if (e.getKey() == e.ENTER) { + _this.onRefreshClick(); + } + } + } + }, this.comboxOP, { + xtype: 'button', + width: 80, + text: Zi.LAN.SearchOrRefresh, + iconCls: "btnrefresh", + handler: function (button, event) { + _this.onRefreshClick(); + } + }, { xtype: 'button', - width: 80, - text: Zi.LAN.SearchOrRefresh, - iconCls: "btnrefresh", + width: 45, + text: "", + iconCls: "btnreset", handler: function (button, event) { - this.onRefreshClick(); + _this.onClearSql(button, event); }, scope: this - }, { - xtype: 'button', - width: 45, - text: "", - iconCls: "btnmore", - handler: function (button, event) { - var sql = this.getCondition(); - var winAccess = new Shipping.DsQuery({ - - }); - winAccess.StoreList = this.storeList; - winAccess.formname = this.formname; - winAccess.condition = sql; - winAccess.show(); - return; - - - }, - scope: this - } + } ] } ]//end items(fieldset 1) @@ -1409,134 +1387,31 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { }); - //#region 附件上传 - this.storeChfeeFile = Ext.create('Ext.data.Store', { - model: 'FeeFileModel', - remoteSort: false, - proxy: { - type: 'ajax', - url: '/Account/Chfee_payapplication/GetFileList', - reader: { - id: 'GID', - root: 'data', - totalProperty: 'totalCount' - } - } - }); - //表格 - this.FeeFileColumns = [ - { - sortable: true, hidden: true, - dataIndex: 'GID', readOnly: true, - header: 'GID', - width: 80 - }, { - sortable: true, hidden: false, - dataIndex: 'File_OriginalName', readOnly: true, - header: Zi.LAN.FileName, //文件名称 - width: 80 - }, { - sortable: true, hidden: false, - dataIndex: 'UpdateTime', readOnly: true, - header: Zi.LAN.FileDate, //上传日期 - width: 80 - }, { - sortable: true, hidden: false, - dataIndex: 'Operator', readOnly: true, - header: Zi.LAN.FilePerson, //上传者 - width: 80 - }, { - sortable: true, hidden: true, - dataIndex: 'File_Name', readOnly: true, - header: Zi.LAN.FileWName, //文件物理名称 - width: 80 - }, - { - sortable: true, hidden: true, - dataIndex: 'File_Path', - header: 'File_Path', - width: 80 - }, { - xtype: 'actioncolumn', - width: 50, - text: Zi.LAN.Operating, //操作 - 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(); - } - }] - } - ]; - var selCertModel = Ext.create('Ext.selection.CheckboxModel'); - this.fileGrid = new Ext.grid.GridPanel({ - store: this.storeChfeeFile, - enableHdMenu: false, - layout: 'border', - region: 'center', - loadMask: { msg: Zi.LAN.LoadData }, //数据加载中,请稍等... - trackMouseOver: true, - disableSelection: false, - selModel: selCertModel, - singleSelect: true, - selType: 'rowmodel', - tbar: [{ - text: Zi.LAN.filetp, //上传图片 - tooltip: Zi.LAN.filetp, - iconCls: "btnadddetail", - handler: function (button, event) { - this.onAddFileClick(button, event); - }, - scope: this - }, '-', { - text: Zi.LAN.delete1, //删除 - tooltip: Zi.LAN.delete1, //删除图片 - iconCls: "btndeletedetail", - handler: function (button, event) { - this.onDelFileClick(button, event); - }, - scope: this - }], - columns: this.FeeFileColumns - }); - - this.page_2 = new Ext.Panel({ - id: "page_2", - title: Zi.LAN.filefujina, //附件上传 - autoScroll: true, - layout: "border", - region: 'center', - //closable:true, - items: [this.fileGrid] - }); - //#endregion附件上传 this.panelService = new Ext.Panel({ layout: "border", - region: 'west', - split: true, - width: 860, + region: 'center', margin: '2 2', items: [this.gridList] }); - this.panelBodydetail = new Ext.Panel({ + this.panelSum = new Ext.Panel({ layout: "border", - region: 'center', + region: 'east', + width: 260, + split: true, margin: '2 2', - items: [this.gridBodydetail] + items: [this.gridSum] }); - this.panelAddBodydetail = new Ext.Panel({ - layout: "border", - region: 'center', + this.panelAddSum = new Ext.Panel({ + layout: "anchor", + region: 'east', + width: 260, + split: true, margin: '2 2', - items: [this.gridAddBodydetail] + items: [this.gridAddSum, this.gridSelectSum] }); @@ -1549,7 +1424,7 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { region: "north", split: true, items: [ - this.panelService, this.panelBodydetail + this.panelService, this.panelSum ] }); @@ -1557,17 +1432,27 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { layout: "border", region: 'center', margin: '2 2', - items: [this.gridAddFeeList, this.panelAddBodydetail] + items: [this.gridAddList] + }); + + + + this.paneladddetail = new Ext.Panel({ + layout: "border", + region: 'center', + items: [this.panelAddService + ] }); + this.paneladd = new Ext.Panel({ - title: Zi.LAN.AddPaySettlementDetail, + title: Zi.LAN.AddShouFeiJSDetail, layout: "border", // region: 'south', region: "center", // height: 420, items: [ - this.formSearch, this.panelAddService + this.formSearch, this.paneladddetail ] }); @@ -1578,9 +1463,9 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { anchor: '20% 100%', columnWidth: .20, frame: true, + trackResetOnLoad: true, bodyPadding: 5, title: Zi.LAN.BookKeepingData, - trackResetOnLoad: true, fieldDefaults: { margins: '2 2 2 2', labelAlign: 'right', @@ -1646,6 +1531,7 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { listeners: { scope: this, 'blur': function (textfield, eOpts) { + if (textfield.value == textfield.originalValue) return; var curr = this.formPREPAY.getForm().findField('PREPAY_MONEY'); var allamount = textfield.value; var amount = this.formEdit.getForm().findField('AMOUNT').getValue(); @@ -1685,7 +1571,6 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { trackResetOnLoad: true, bodyPadding: 5, title: "+" + Zi.LAN.YuShouZhiReport, - trackResetOnLoad: true, fieldDefaults: { margins: '2 2 2 2', labelAlign: 'right', @@ -1751,7 +1636,7 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { var prepamount = this.formPREPAY.getForm().findField('PREPAY_MONEY').getValue(); var advanceamount = this.formADVANCE.getForm().findField('ADVANCE_MONEY').getValue(); var financialamount = this.formFINANCIAL.getForm().findField('FINANCIAL_MONEY'); - + var amount = parseFloat(accamount).add(parseFloat(prepamount)); amount = parseFloat(amount).add(parseFloat(-advanceamount)); @@ -1797,9 +1682,9 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { anchor: '20% 100%', columnWidth: .20, frame: true, + trackResetOnLoad: true, bodyPadding: 5, title: "=" + Zi.LAN.ShiShouZhiReport, - trackResetOnLoad: true, fieldDefaults: { margins: '2 2 2 2', labelAlign: 'right', @@ -1854,9 +1739,7 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { return value; } return value; - } - - , + }, listeners: { scope: this, 'blur': function (textfield, eOpts) { @@ -1933,9 +1816,9 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { anchor: '20% 100%', columnWidth: .20, frame: true, + trackResetOnLoad: true, bodyPadding: 5, title: "+" + Zi.LAN.FinanceCose, - trackResetOnLoad: true, fieldDefaults: { margins: '2 2 2 2', labelAlign: 'right', @@ -1994,6 +1877,8 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { listeners: { scope: this, 'blur': function (textfield, eOpts) { + if (textfield.value == textfield.originalValue) return; + var curr = this.formAHSR.getForm().findField('AHSR_MONEY'); var accamount = this.formACCOUNTS.getForm().findField('ACCOUNTS_MONEY').getValue(); var prepamount = this.formPREPAY.getForm().findField('PREPAY_MONEY').getValue(); @@ -2012,7 +1897,6 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { }] }); - this.comboxCurrADVANCE = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: Zi.LAN.Currency, store: this.StoreCurr, @@ -2027,9 +1911,9 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { anchor: '20% 100%', columnWidth: .20, frame: true, + trackResetOnLoad: true, bodyPadding: 5, title: "+" + Zi.LAN.YuShouZhiQuReport, - trackResetOnLoad: true, fieldDefaults: { margins: '2 2 2 2', labelAlign: 'right', @@ -2127,10 +2011,6 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { }] }); - - - - //#endregion this.panelAcc = new Ext.Panel({ @@ -2140,7 +2020,7 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { items: [this.formACCOUNTS, this.formPREPAY, this.formAHSR, this.formFINANCIAL, this.formADVANCE] }); - //#region 预付取用 + //#region 预收取用 @@ -2219,12 +2099,6 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { header: Zi.LAN.BillNo, width: 120 }, - { - sortable: true, - dataIndex: 'FEETYPEREF', - header: Zi.LAN.FeeTypeRef, - width: 60 - }, { sortable: true, dataIndex: 'CUSTOMERNAME', @@ -2235,7 +2109,7 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { sortable: true, dataIndex: 'CURRENCY', header: Zi.LAN.Currency, - width: 80 + width: 60 }, { sortable: true, @@ -2351,6 +2225,8 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { } }); + + this.GridBodyAccCheckBoxModel = Ext.create('Ext.selection.CheckboxModel'); this.gridBodyListAcc = new Ext.grid.GridPanel({ @@ -2408,15 +2284,15 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { }, { sortable: true, - dataIndex: 'FEETYPE', - header: 'FEETYPE', + dataIndex: 'FEETYPEREF', + header: Zi.LAN.FeeTypeRef, width: 80 }, { sortable: true, dataIndex: 'CUSTOMERNAME', header: Zi.LAN.SettlementObject, hidden: true, - width: 100 + width: 80 }, { sortable: true, @@ -2533,12 +2409,6 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { header:Zi.LAN.VerificationUseBillNo, width: 80 }, - { - sortable: true, - dataIndex: 'FEETYPE', - header: 'FEETYPE', - width: 80 - }, { sortable: true, dataIndex: 'CUSTOMERNAME', @@ -2579,73 +2449,646 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { dataIndex: 'SETTLEUSER', header: Zi.LAN.VerificationUser, width: 80 - }, - { - sortable: true, - dataIndex: 'SETTLETIME', - header: Zi.LAN.VerificationTime, + }, + { + sortable: true, + dataIndex: 'SETTLETIME', + header: Zi.LAN.VerificationTime, + width: 80 + }, + { + sortable: true, + dataIndex: 'REMARK', + header: Zi.LAN.Remark, + width: 80 + }, + { + sortable: true, + dataIndex: 'VOUCHERNO', + header: Zi.LAN.VerificationNo, + width: 80 + } + ] + }); + + + this.paneldetailacc = new Ext.Panel({ + // title: Zi.LAN.SettlementDetail , + layout: "border", + height: 160, + region: "north", + split: true, + items: [ + this.gridBodyListAcc + ] + }); + + this.panelAddacc = new Ext.Panel({ + layout: "border", + height: 160, + region: "north", + margin: '2 2', + items: [this.gridListAcc] + }); + + + this.paneldetailacc2 = new Ext.Panel({ + title: Zi.LAN.VerificationDetail, + layout: "border", + height: 160, + region: "north", + hidden: true, + items: [ + this.gridBodyListAcc2 + ] + }); + + this.panelaccdetail = new Ext.Panel({ + title: Zi.LAN.UseOrCancleYSMX, + layout: "border", + hidden: true, + height: 360, + region: "north", + split: true, + items: [ + this.paneldetailacc, this.panelAddacc + ] + }); + + //#endregion + + //#region 汇兑损益 + + + this.storeREMITTANCE = Ext.create('DsExt.ux.RefEnumStore', {}); + this.storeREMITTANCE.load({ params: { enumTypeId: 97045} }); + + this.comboxREMITTANCE = Ext.create('DsExt.ux.RefTableCombox', { + fieldLabel: Zi.LAN.Exchange, + name: 'REMITTANCE', + flex: 1, + store: this.storeREMITTANCE, + valueField: 'EnumValueName', + displayField: 'EnumValueName', + forceSelection: true, + listeners: { + scope: this, + 'select': function (combo, records, eOpts) { + if (records.length > 0) { + this.formEdit.getForm().findField('REMITTANCE').setValue(combo.value); + + + + } + + } + } + }); + + this.formREMITTANCE = Ext.widget('form', { + region: "north", + layout: "border", + height: 100, + frame: true, + trackResetOnLoad: true, + bodyPadding: 5, + title: Zi.LAN.ExchangeGainOrLoss, + fieldDefaults: { + margins: '2 2 2 2', + labelAlign: 'right', + flex: 1, + labelWidth: 40, + msgTarget: 'qtip' + }, + + items: [ + {//fieldset 1 + xtype: 'fieldset', + defaultType: 'textfield', + layout: 'anchor', + defaults: { + anchor: '100%' + }, + items: [{ + xtype: 'container', + layout: 'hbox', + defaultType: 'textfield', + items: [this.comboxREMITTANCE, { + fieldLabel: Zi.LAN.AmountOfPurchase , + labelWidth: 60, + readOnly: true, + flex: 1, + name: 'REMITTANCEAMOUNT', + 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; + } + }, { + fieldLabel: Zi.LAN.BuyingRate , + labelWidth: 50, + flex: 1, + name: 'BUYRATE', + 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; + }, + listeners: { + change: function () { + var basicForm = _this.formREMITTANCE.getForm(); + var BUYRATE = basicForm.findField('BUYRATE').getValue(); + _this.formEdit.getForm().findField('BUYRATE').setValue(BUYRATE); + + } + } + }, { + fieldLabel: Zi.LAN.SellingRate, + labelWidth: 50, + name: 'SELLRATE', + flex: 1, + 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; + }, + listeners: { + change: function () { + var basicForm = _this.formREMITTANCE.getForm(); + var SELLRATE = basicForm.findField('SELLRATE').getValue(); + _this.formEdit.getForm().findField('SELLRATE').setValue(SELLRATE); + + } + } + } + ] + } + ]//end root items + }] + }); + this.GridRemitCheckBoxModel = Ext.create('Ext.selection.CheckboxModel'); + //明细表-数据集 + this.storeListRemit = Ext.create('Ext.data.Store', { + model: 'ChSettlement_remittance', + remoteSort: true, + proxy: { + type: 'ajax', + url: '/Account/Chfee_settlement/GetRemitList', + reader: { + id: 'GID', + root: 'data', + totalProperty: 'totalCount' + } + } + }); + + //明细表表格 + this.gridListRemitCellEditing = Ext.create('Ext.grid.plugin.CellEditing', { + clicksToEdit: 1 + }); + + this.storeREMITTANCE2 = Ext.create('DsExt.ux.RefEnumStore', {}); + this.storeREMITTANCE2.load({ params: { enumTypeId: 97045} }); + + this.comboxREMITTANCE2 = Ext.create('DsExt.ux.RefTableCombox', { + name: 'REMITTANCE', + flex: 1, + store: this.storeREMITTANCE2, + valueField: 'EnumValueName', + displayField: 'EnumValueName', + forceSelection: true + }); + + this.gridListRemit = new Ext.grid.GridPanel({ + store: this.storeListRemit, + enableHdMenu: false, + region: 'center', + loadMask: { msg: Zi.LAN.LoadData }, + trackMouseOver: true, + disableSelection: false, + viewConfig: { + enableTextSelection: true + }, + plugins: [this.gridListRemitCellEditing], + selModel: this.GridRemitCheckBoxModel, + tbar: [{ + text: Zi.LAN.Btn_Create, + iconCls: "btnadd", + id: 'AddRemit', + handler: function (button, event) { + this.addRemitDetailClick(button, event); + }, + scope: this + + }, + { + text: Zi.LAN.Save , + iconCls: "btnsave", + id: 'PostRemit', + handler: function (button, event) { + this.onPostRemitDetailClick(button, event); + }, + scope: this + }, '-', + { + text: Zi.LAN.Btn_Delete, + iconCls: "btndelete", + id: 'DelRemit', + handler: function (button, event) { + this.onDelRemitDetailClick(button, event); + }, + scope: this + }], + columns: [{ + sortable: true, + dataIndex: 'BILLNO', + header: 'BILL', + hidden: true, + width: 100 + }, { + sortable: true, + dataIndex: 'BSNO', + header: 'BSNO', + hidden: true, + width: 100 + }, { + sortable: true, + dataIndex: 'FEEDOID', + header: 'FEEDOID', + hidden: true, + width: 100 + }, { + sortable: true, + dataIndex: 'CUSTNO', + header: Zi.LAN.DelegateNumber, + width: 120 + }, { + sortable: true, + dataIndex: 'MBLNO', + header: Zi.LAN.LadingNumber, + width: 120 + }, { + sortable: true, + dataIndex: 'CUSTOMERNAME', + header: Zi.LAN.Requester, + width: 100 + }, { + sortable: true, + dataIndex: 'FEENAME', + header: Zi.LAN.CostName, + width: 80 + }, { + sortable: true, + dataIndex: 'FEETYPEREF', + header: Zi.LAN.FeeTypeRef, + width: 40 + }, { + sortable: true, + dataIndex: 'REMITTANCE', + header: Zi.LAN.Exchange, + editor: this.comboxREMITTANCE2, + width: 60 + }, { + sortable: true, + dataIndex: 'CUSTNAME', + header: Zi.LAN.CustomerName, + width: 100 + }, { + sortable: true, + dataIndex: 'AMOUNT', + header: Zi.LAN.SettlementAmount, + width: 80, + renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { + try { + var lsValue = usMoney(value, 2, '', false); + if (lsValue != "NaN") { + value = lsValue; if (parseFloat(lsValue) < 0) { + return '' + lsValue + ''; + } + } + else { + return value; + } + } + catch (e) { + return value; + } + return value; + } + }, { + sortable: true, + dataIndex: 'CURRENCY', + header: Zi.LAN.Currency, + width: 80 + }, { + sortable: true, + dataIndex: 'SELLRATE', + header: Zi.LAN.SellingRate, + editor: { + xtype: 'numberfield', + keyNavEnabled: false, + selectOnFocus: true, + hideTrigger: true, + decimalPrecision: 4, + mouseWheelEnabled: false, + enableKeyEvents: true + + }, + renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { + try { + var lsValue = usMoney(value, 4, '', false); + if (lsValue != "NaN") { + value = lsValue; if (parseFloat(lsValue) < 0) { + return '' + lsValue + ''; + } + } + else { + return value; + } + } + catch (e) { + return value; + } + return value; + }, + align: 'right', + width: 80 + }, { + sortable: true, + dataIndex: 'REMITTANCEAMOUNT', + header: Zi.LAN.ProvisionAmountOfPurchase, + editor: { + xtype: 'numberfield', + keyNavEnabled: false, + selectOnFocus: true, + hideTrigger: true, + mouseWheelEnabled: false, + enableKeyEvents: true + + }, + renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { + try { + var lsValue = usMoney(value, 2, '', false); + if (lsValue != "NaN") { + value = lsValue; if (parseFloat(lsValue) < 0) { + return '' + lsValue + ''; + } + } + else { + return value; + } + } + catch (e) { + return value; + } + return value; + }, + align: 'right', + width: 100 + }, { + sortable: true, + dataIndex: 'SETTLRATE', + header: Zi.LAN.SettlementRate, + editor: { + xtype: 'numberfield', + keyNavEnabled: false, + selectOnFocus: true, + hideTrigger: true, + mouseWheelEnabled: false, + enableKeyEvents: true + + }, + renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { + try { + var lsValue = usMoney(value, 4, '', false); + if (lsValue != "NaN") { + value = lsValue; if (parseFloat(lsValue) < 0) { + return '' + lsValue + ''; + } + } + else { + return value; + } + } + catch (e) { + return value; + } + return value; + }, + align: 'right', + width: 80 + }, { + sortable: true, + dataIndex: 'BUYRATE', + header: Zi.LAN.BuyingRate , + editor: { + xtype: 'numberfield', + keyNavEnabled: false, + selectOnFocus: true, + hideTrigger: true, + decimalPrecision: 4, + mouseWheelEnabled: false, + enableKeyEvents: true + + }, + renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { + try { + var lsValue = usMoney(value, 4, '', false); + if (lsValue != "NaN") { + value = lsValue; if (parseFloat(lsValue) < 0) { + return '' + lsValue + ''; + } + } + else { + return value; + } + } + catch (e) { + return value; + } + return value; + }, + align: 'right', + width: 80 + }, { + sortable: true, + dataIndex: 'SALE', + header: Zi.LAN.LanhuoPeople, + width: 80 + }, { + sortable: true, + dataIndex: 'REMARK', + header: Zi.LAN.Remark, + editor: { + xtype: 'textfield', + selectOnFocus: true, + enableKeyEvents: true + + }, + width: 120 + } + ] + }); + + + + this.gridListRemit.addListener('sortchange', function (ct, column, direction, eOpts) { + this.sortfield = column.dataIndex; + this.sortdire = direction; + }, this); + + + this.panelRemit = new Ext.Panel({ + title: Zi.LAN.ExchangeGainOrLoss, + layout: "border", + region: "center", + items: [this.formREMITTANCE, this.gridListRemit] + }); + + //#endregion + + + //#region 附件上传 + this.storeChfeeFile = Ext.create('Ext.data.Store', { + model: 'FeeFileModel', + remoteSort: false, + proxy: { + type: 'ajax', + url: '/Account/Chfee_payapplication/GetFileList', + reader: { + id: 'GID', + root: 'data', + totalProperty: 'totalCount' + } + } + }); + //表格 + this.FeeFileColumns = [ + { + sortable: true, hidden: true, + dataIndex: 'GID', readOnly: true, + header: 'GID', + width: 80 + }, { + sortable: true, hidden: false, + dataIndex: 'File_OriginalName', readOnly: true, + header: Zi.LAN.FileName, //文件名称 + width: 80 + }, { + sortable: true, hidden: false, + dataIndex: 'UpdateTime', readOnly: true, + header: Zi.LAN.FileDate, //上传日期 width: 80 - }, - { - sortable: true, - dataIndex: 'REMARK', - header: Zi.LAN.Remark, + }, { + sortable: true, hidden: false, + dataIndex: 'Operator', readOnly: true, + header: Zi.LAN.FilePerson, //上传者 + width: 80 + }, { + sortable: true, hidden: true, + dataIndex: 'File_Name', readOnly: true, + header: Zi.LAN.FileWName, //文件物理名称 width: 80 }, { - sortable: true, - dataIndex: 'VOUCHERNO', - header: Zi.LAN.VerificationNo, + sortable: true, hidden: true, + dataIndex: 'File_Path', + header: 'File_Path', width: 80 + }, { + xtype: 'actioncolumn', + width: 50, + text: Zi.LAN.Operating, //操作 + 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(); + } + }] } - ] - }); - - - this.paneldetailacc = new Ext.Panel({ - // title: Zi.LAN.SettlementDetail , - layout: "border", - height: 160, - region: "north", - split: true, - items: [ - this.gridBodyListAcc - ] - }); - - this.panelAddacc = new Ext.Panel({ - layout: "border", - height: 160, - region: "north", - margin: '2 2', - items: [this.gridListAcc] - }); - - - this.paneldetailacc2 = new Ext.Panel({ - title: Zi.LAN.VerificationDetail, - layout: "border", - height: 160, - region: "north", - hidden: true, - items: [ - this.gridBodyListAcc2 - ] + ]; + var selCertModel = Ext.create('Ext.selection.CheckboxModel'); + this.fileGrid = new Ext.grid.GridPanel({ + store: this.storeChfeeFile, + enableHdMenu: false, + layout: 'border', + region: 'center', + loadMask: { msg: Zi.LAN.LoadData }, //数据加载中,请稍等... + trackMouseOver: true, + disableSelection: false, + selModel: selCertModel, + singleSelect: true, + selType: 'rowmodel', + tbar: [{ + text: Zi.LAN.filetp, //上传图片 + tooltip: Zi.LAN.filetp, + iconCls: "btnadddetail", + handler: function (button, event) { + this.onAddFileClick(button, event); + }, + scope: this + }, '-', { + text: Zi.LAN.delete1, //删除 + tooltip: Zi.LAN.delete1, //删除图片 + iconCls: "btndeletedetail", + handler: function (button, event) { + this.onDelFileClick(button, event); + }, + scope: this + }], + columns: this.FeeFileColumns }); - this.panelaccdetail = new Ext.Panel({ - title: Zi.LAN.UseOrCancelPrePaidDetail, + this.page_2 = new Ext.Panel({ + id: "page_2", + title: Zi.LAN.filefujina, //附件上传 + autoScroll: true, layout: "border", - hidden: true, - height: 360, - region: "north", - split: true, - items: [ - this.paneldetailacc, this.panelAddacc - ] + region: 'center', + //closable:true, + items: [this.fileGrid] }); - - //#endregion + //#endregion附件上传 //#region 布局 @@ -2653,7 +3096,7 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { this.panelTop = new Ext.Panel({ layout: "border", region: "north", - height: 130, + height: 138, items: [this.panelBtn, this.formEdit] }); this.panelBody = new Ext.Panel({ @@ -2683,7 +3126,8 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { items: [ this.panelBody, - this.panelAccAll, + this.panelAccAll, + this.panelRemit, this.page_2 ] }); @@ -2709,64 +3153,111 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { }; + this.storeListRemit.on('beforeload', function (store) { + var sql = " r.BILLNO='" + this.editRecord.get('BILLNO') + "'"; + Ext.apply(store.proxy.extraParams, { condition: sql }); + }, this); + this.storeBodyList.on('beforeload', function (store) { var billno = this.editRecord.get('BILLNO'); - Ext.apply(store.proxy.extraParams, { billno: billno }); + var sql = " BILLNO='" + billno + "'"; + Ext.apply(store.proxy.extraParams, { condition: sql }); }, this); - this.storeBodyList.on('load', function (store, records) { - if (store.getCount() > 0) { - //this.gridList.getSelectionModel().select(0); - - } else { - - this.storeBodydetail.load({ params: { condition: " f.BILLNO='XX'"} }); - } - }, this); - this.gridList.getSelectionModel().on('select', function (model, record, index) { - var billno = this.formEdit.getForm().findField('BILLNO').getValue(); + this.storeBodyList.on('load', function (store, records) { + //if (store.getCount() > 0) { + // this.gridList.getSelectionModel().select(0); - var paybillno = record.data.BILLNO; - var sql = ""; - sql = " f.BILLNO='" + billno + "' and f.PAYBILLNO='" + paybillno + "'"; - this.FeeDetailSql = sql; - this.storeBodydetail.load({ params: { condition: sql} }); + //} }, this); - this.storeAddFeeList.on('beforeload', function (store) { - var sql = this.getCondition(); - Ext.apply(store.proxy.extraParams, { condition: this.BillSql }); - }, this); + this.storeBodyAddList.on('beforeload', function (store) { + // var sql = this.getCondition(); + - this.storeBodydetail.on('beforeload', function (store) { - var sql = this.FeeDetailSql; - if (sql == '') sql = ' 1=2 '; - Ext.apply(store.proxy.extraParams, { condition: sql }); + Ext.apply(store.proxy.extraParams, { condition: this.sqlcontext, billtype: 1}); }, this); - this.storeAddFeeList.on('load', function (store, records) { + this.storeBodyAddList.on('load', function (store, records) { if (store.getCount() > 0) { - //this.gridAddFeeList.getSelectionModel().select(0); + //this.gridAddList.getSelectionModel().select(0); + var btnEAddbill = Ext.getCmp('btnaddbill'); + if (this.canedit) + btnEAddbill.enable(); } else { - this.storeAddBodydetail.load({ params: { condition: " BILLNO='XX'"} }); + } }, this); - this.gridAddFeeList.getSelectionModel().on('select', function (model, record, index) { + var isloadfee = true; + this.gridAddList.getSelectionModel().on('select', function (model, record, index) { + //if (!isloadfee) return; + //var bsno = record.data.BSNO; + //var feeobjname = record.data.FEEOBJNAME; + //var sql = ""; + //sql = " f.BSNO='" + bsno + "' AND f.CUSTOMERNAME='" + feeobjname + "'"; + //sql = sql + getAndConSql(sql, this.FeeSqlStr, this.FeeSqlStr); + //this.selectfeesql = sql; + //isloadfee = false; + //var DuiNo = _this.formSearch.getForm().findField('DuiNo').getValue(); + - var bsno = record.data.BILLNO; - var sql = ""; - sql = " BILLNO='" + bsno + "'"; - this.storeAddBodydetail.load({ params: { condition: sql} }); }, this); + + _this = this; + //this.gridAddList.on({ + // selectionchange: function (sm, selections) { + // var SelectGridtext = Ext.getCmp('SelectGrid'); + // _this.storeSelectSum.removeAll(); + // SelectGridtext.setText(Zi.LAN.SumOfCostSelected); + + // if (selections.length == 0) { + // return; + // } + // _this.storeSelectSum.add({ "RMBDRAMOUNT": 0, "RMBCRAMOUNT": 0, "USDDRAMOUNT": 0, "USDCRAMOUNT": 0, "OTDRAMOUNT": 0, "OTCRAMOUNT": 0 }); + // var R = selections.length; + // for (var i = 0; i < selections.length; i++) { + // var rec = selections[i]; + // var memberyf = _this.storeSelectSum.getAt(0); + // var amount = memberyf.data.RMBDRAMOUNT; + // var cramount = memberyf.data.RMBCRAMOUNT; + // amount = (parseFloat(amount).add(parseFloat(rec.data.RMBDrBalAmount))).toFixed(2); + // cramount = (parseFloat(cramount).add(parseFloat(rec.data.RMBCrBalAmount))).toFixed(2); + // var usdamount = memberyf.data.USDDRAMOUNT; + // var usdcramount = memberyf.data.USDCRAMOUNT; + // usdamount = (parseFloat(usdamount).add(parseFloat(rec.data.USDDrBalAmount))).toFixed(2); + // usdcramount = (parseFloat(usdcramount).add(parseFloat(rec.data.USDCrBalAmount))).toFixed(2); + // var otamount = memberyf.data.OTDRAMOUNT; + // var otcramount = memberyf.data.OTCRAMOUNT; + // otamount = (parseFloat(otamount).add(parseFloat(rec.data.OTDrBalAmount))).toFixed(2); + // otcramount = (parseFloat(otcramount).add(parseFloat(rec.data.OTCrBalAmount))).toFixed(2); + // memberyf.set("RMBDRAMOUNT", amount); + // memberyf.set("RMBCRAMOUNT", cramount); + // memberyf.set("USDDRAMOUNT", usdamount); + // memberyf.set("USDCRAMOUNT", usdcramount); + // memberyf.set("OTDRAMOUNT", otamount); + // memberyf.set("OTCRAMOUNT", otcramount); + // memberyf.commit(); + + // } + + // SelectGridtext.setText('所选费用合计(选中' + R + '票业务)'); + + + // } + //}); + + + + //#region 生成凭证_汇率列表 //#region 加载数据 //权限加载 @@ -2840,6 +3331,7 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { forceSelection: true, name: 'MERGE' }); + //#endregion //#region 定义数据集 @@ -2904,6 +3396,10 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { }); //#endregion //#endregion + + + + this.onInitRefreshClick(); Ext.Ajax.request({ waitMsg: '', url: '/MvcShipping/MsSysParamSet/GetData', @@ -2930,6 +3426,34 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { }, scope: this }); + Ext.Ajax.request({ + waitMsg: '', + url: '/MvcShipping/MsSysParamSet/GetData', + params: { + condition: "PARAMNAME='FREESTLBYINPUTEXCHANGE'" + }, + 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.FREESTLBYINPUTEXCHANGE = 1; + } else { + + } + + } + } else { + + } + }, + scope: this + }); + + Ext.Ajax.request({ waitMsg: '', url: '/MvcShipping/MsBaseInfo/GetCwISRATESET', @@ -2953,6 +3477,7 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { }, scope: this }); + }, //end initUIComponents InitData: function () { @@ -2986,12 +3511,6 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { this.bodyDel = []; this.opStatus = opstatus; - var billno = '*'; - - if (this.opStatus == 'edit') { - billno = this.editRecord.get('BILLNO'); - - }; _this = this; Ext.Ajax.request({ waitMsg: Zi.LAN.OnSelect , @@ -3015,20 +3534,26 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { var data = result.data; _this.formEdit.getForm().findField('BILLSTATUS').setDisabled(false); + _this.formEdit.getForm().findField('SETTLEUSERREF').setDisabled(false); _this.formEdit.getForm().reset(); _this.formACCOUNTS.getForm().reset(); _this.formPREPAY.getForm().reset(); _this.formAHSR.getForm().reset(); _this.formFINANCIAL.getForm().reset(); _this.formADVANCE.getForm().reset(); + _this.formREMITTANCE.getForm().reset(); _this.formEdit.getForm().setValues(data); _this.formACCOUNTS.getForm().setValues(data); _this.formPREPAY.getForm().setValues(data); _this.formAHSR.getForm().setValues(data); _this.formFINANCIAL.getForm().setValues(data); _this.formADVANCE.getForm().setValues(data); - + _this.formREMITTANCE.getForm().setValues(data); + if (_this.opStatus == 'add') { + _this.formEdit.getForm().findField('CURR').setValue(''); + } _this.formEdit.getForm().findField('BILLSTATUS').setDisabled(true); + _this.formEdit.getForm().findField('SETTLEUSERREF').setDisabled(true); _this.GetEditStatus(); _this.LoadPeriod(this.opStatus); this.StoreBANK.load({ @@ -3041,24 +3566,7 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { scope: this }); _this.storeChfeeFile.load({ params: { start: 0, limit: 9999, BillNo: data.BILLNO } }); - if (_this.opStatus == 'add') { - _this.formEdit.getForm().findField('CURR').setValue(''); - } - _this.storeBodyList.load({ params: { billno: billno }, - callback: function (r, options, success) { - if (success) { - if (_this.storeBodyList.getCount() > 0) { - _this.comboxCurr.setReadOnly(true); - _this.comboxCustCode.setReadOnly(true); - } - else { - _this.comboxCurr.setReadOnly(false); - _this.comboxCustCode.setReadOnly(false); - } - } - }, - scope: this - }); + } else { Ext.MessageBox.alert(Zi.LAN.Error, response.responseText); } @@ -3066,35 +3574,53 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { scope: this }); + var billno = '*'; + if (this.opStatus == 'edit') { + billno = this.editRecord.get('BILLNO'); + }; + // billno = this.formEdit.getForm().findField('DUINO').getValue(); + this.storeBodyList.load({ + params: { start: 0, limit: this.BodyPageSize,condition: " BILLNO='" + billno + "'" }, + callback: function (r, options, success) { + if (success) { + if (this.storeBodyList.getCount() > 0) { + this.comboxCurr.setReadOnly(true); + this.comboxCustCode.setReadOnly(true); + } + else { + this.comboxCurr.setReadOnly(false); + this.comboxCustCode.setReadOnly(false); + } + } + }, + scope: this + }); + this.storeBodySum.load({ params: { condition: " BILLNO='" + billno + "'"} }); + this.storeListRemit.load({ params: { condition: " r.BILLNO='" + billno + "'"} }); + this.storePaymentList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: "BILLNO='" + billno + "'" }, + callback: function (r, options, success) { + if (success) { + if (this.storePaymentList.getCount() > 0) { + var member = this.storePaymentList.getAt(0); + if (member.data.ISVOU) { - this.onRefreshClick(); - - // this.storeBodySum.load({ params: { condition: " BILLNO='" + billno + "'"} }); - - // this.storePaymentList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: "BILLNO='" + billno + "'" }, - // callback: function (r, options, success) { - // if (success) { - // if (this.storePaymentList.getCount() > 0) { - - // var member = this.storePaymentList.getAt(0); - // if (member.data.ISVOU) { - - // this.formACCOUNTS.getForm().findField('ACCOUNTS_MONEY').readOnly = true; - // this.formPREPAY.getForm().findField('PREPAY_MONEY').readOnly = true; - // } - // } - // } - // }, - // scope: this - // }); - + this.formACCOUNTS.getForm().findField('ACCOUNTS_MONEY').readOnly = true; + this.formPREPAY.getForm().findField('PREPAY_MONEY').readOnly = true; + } + } + } + }, + scope: this + }); + // this.storeFeeList.load({ params: { condition: " DUINO='" + billno + "'"} }); }, // end LoadDate + LoadPeriod: function (opstatus) { Ext.Ajax.request({ waitMsg: Zi.LAN.OnSelect , @@ -3143,7 +3669,6 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { } } }, - Save: function (type) { var basicForm = this.formEdit.getForm(); @@ -3151,16 +3676,13 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { return; } - - - this.formEdit.getForm().findField('BILLSTATUS').setDisabled(false); this.formEdit.getForm().findField('SETTLEUSER').setDisabled(false); this.formEdit.getForm().findField('COMPANYID').setDisabled(false); this.formEdit.getForm().findField('SETTLEMODE').setDisabled(false); this.formEdit.getForm().findField('BILLTYPE').setDisabled(false); var field = this.formEdit.getForm().findField('SETTLEMODE'); - field.setValue(1); + field.setValue(2); var field = this.formEdit.getForm().findField('BILLTYPE'); field.setValue(1); @@ -3172,6 +3694,7 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { var ahsrdata = this.formAHSR.getForm().getValues(); var financialdata = this.formFINANCIAL.getForm().getValues(); var advancedata = this.formADVANCE.getForm().getValues(); + var aremitdata = this.formREMITTANCE.getForm().getValues(); this.formEdit.getForm().findField('BILLSTATUS').setDisabled(true); this.formEdit.getForm().findField('SETTLEUSER').setDisabled(true); this.formEdit.getForm().findField('COMPANYID').setDisabled(true); @@ -3203,8 +3726,10 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { this.formEdit.getForm().setValues(returnData); if (this.opStatus == 'add') { + var arrNewRecords = this.StoreList.insert(0, returnData); this.editRecord = this.StoreList.getAt(0); + } else if (this.opStatus == 'edit') { var editp = Ext.create('MsChSettlement', returnData); @@ -3220,8 +3745,7 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { } if (type == '0') { this.opStatus = 'edit'; - this.LoadPeriodStatus(_this.opStatus); - + this.LoadPeriodStatus(this.opStatus); } else if (type == '1') { @@ -3243,9 +3767,9 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { }); }, //end save - onAddDetailClick: function (button, event, curr) { + onAddDetailClick: function (button, event) { this.addstore = true; - this.addDetail(curr); + this.addDetail(); }, //end onAddDetailClick onDelDetailClick: function (button, event, type) { @@ -3262,43 +3786,42 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { }, //end onAddDetailClick - gridAddFeeListAfterEdit: function (editor, e, eOpts) { + gridAddListAfterEdit: function (editor, e, eOpts) { //需要自己实现里面的事件 if (e.value == e.originalValue) return; - if (e.field == 'STLAMOUNT') { - var BalAmount = e.record.data['BALAMOUNT']; - var StlAmount = e.record.data['STLAMOUNT']; - if (BalAmount >= 0) { + if (e.field == 'STLRMBDR') { + var BalAmount = e.record.data['BALRMBDR']; + var StlAmount = e.record.data['STLRMBDR']; if (StlAmount > BalAmount) { - e.record.set('STLAMOUNT', BalAmount); - Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.SettlementAmountTooLarge, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + e.record.set('STLRMBDR', BalAmount); + Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.HXJEDaYuWHJE, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); } - - } else { - if (StlAmount < BalAmount) { - e.record.set('STLAMOUNT', BalAmount); - Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.SettlementAmountTooLarge, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + if (StlAmount < 0) { + e.record.set('STLRMBDR', BalAmount); + Ext.Msg.show({ title: Zi.LAN.TiShi, msg: '结算金额不能小于0', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); } - + } else if (e.field == 'STLUSDDR') { + var BalAmount = e.record.data['BALUSDDR']; + var StlAmount = e.record.data['STLUSDDR']; + if (StlAmount > BalAmount) { + e.record.set('STLUSDDR', BalAmount); + Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.HXJEDaYuWHJE, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); } - - } else if (e.field == 'USDSTLAMOUNT') { - var BalAmount = e.record.data['USDBALAMOUNT']; - var StlAmount = e.record.data['USDSTLAMOUNT']; - if (BalAmount >= 0) { - if (StlAmount > BalAmount) { - e.record.set('USDSTLAMOUNT', BalAmount); - Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.SettlementAmountTooLarge, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); - } - - } else { - if (StlAmount < BalAmount) { - e.record.set('USDSTLAMOUNT', BalAmount); - Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.SettlementAmountTooLarge, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); - } - + if (StlAmount < 0) { + e.record.set('STLUSDDR', BalAmount); + Ext.Msg.show({ title: Zi.LAN.TiShi, msg: '结算金额不能小于0', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + } + } else if (e.field == 'STLOTDR') { + var BalAmount = e.record.data['BALOTDR']; + var StlAmount = e.record.data['STLOTDR']; + if (StlAmount > BalAmount) { + e.record.set('STLOTDR', BalAmount); + Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.HXJEDaYuWHJE, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + } + if (StlAmount < 0) { + e.record.set('STLOTDR', BalAmount); + Ext.Msg.show({ title: Zi.LAN.TiShi, msg: '结算金额不能小于0', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); } - } }, @@ -3323,74 +3846,75 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { }, - addDetail: function (addcurr) { + + + + addBill: function () { + var btnEAddbill = Ext.getCmp('btnaddbill'); + btnEAddbill.disable(); + + var basicForm = this.formEdit.getForm(); + + var Duino = this.formEdit.getForm().findField('BILLNO').getValue(); _this = this; if ((Duino == '*') || basicForm.isDirty()) { - + var SALECORP = ''; var CUSTOMERNAME = this.formEdit.getForm().findField('CUSTOMERNAME').getValue(); var CURR = this.formEdit.getForm().findField('CURR').getValue(); - if (addcurr == '') { - if ((CURR == '') || (CURR == null)) { - this.formEdit.getForm().findField('CURR').setValue('RMB'); - this.formEdit.getForm().findField('RATE').setValue(1); - } - } else { - if ((CURR == '') || (CURR == null)) { - this.formEdit.getForm().findField('CURR').setValue(addcurr); - var FFrecords = DsStoreQueryBy(this.StoreDateCurr, 'CURR', addcurr); - if (FFrecords.getCount() > 0) { - var ffdata = FFrecords.getAt(0).data; - var DEFRATE = ffdata.DEFRATE; - this.formEdit.getForm().findField('RATE').setValue(DEFRATE); - } else { - var DFrecords = DsStoreQueryBy(this.StoreCurr, 'CURR', addcurr); - if (DFrecords.getCount() > 0) { - var dfdata = DFrecords.getAt(0).data; - var DEFRATE = dfdata.DEFRATE; - this.formEdit.getForm().findField('RATE').setValue(DEFRATE); - } else { - this.formEdit.getForm().findField('RATE').setValue(1); - } - } - } - } - //if ((CUSTOMERNAME == '') || (CUSTOMERNAME == null) || (CURR == '') || (CURR == null)) { - var selectedRecords = this.gridAddFeeList.selModel.getSelection(); - if (selectedRecords.length > 0) { - var rec = selectedRecords[0]; - var cust = rec.data.CUSTOMERNAME; - var addcurr2 = rec.data.CURR; + if ((CUSTOMERNAME == '') || (CUSTOMERNAME == null) || (CURR == '') || (CURR == null)) { + if (this.storeBodyAddList.getCount() > 0) { + var rec = this.storeBodyAddList.getAt(0); + var cust = rec.data.CUSTNAME; if ((CUSTOMERNAME == '') || (CUSTOMERNAME == null)) this.formEdit.getForm().findField('CUSTOMERNAME').setValue(cust); - if ((CURR == '') || (CURR == null)) { - if (addcurr2 != '') - this.formEdit.getForm().findField('CURR').setValue(addcurr2); - else { - if (rec.data.BALAMOUNT != 0) this.formEdit.getForm().findField('CURR').setValue('RMB'); - else if (rec.data.USDBALAMOUNT != 0) this.formEdit.getForm().findField('CURR').setValue('USD'); + + var CUST = this.formEdit.getForm().findField('CUSTOMERNAME').getValue(); + var recs = DsStoreQueryBy(this.storeCustCode, 'CustName', CUST); + var CUSTBANK = this.formEdit.getForm().findField('CUSTBANK'); + var CUSTACCOUNT = this.formEdit.getForm().findField('CUSTACCOUNT'); + var CURR = this.formEdit.getForm().findField('CURR').getValue(); + if (recs.getCount() > 0) { + var data = recs.getAt(0).data; + if (CURR == 'RMB') { + CUSTBANK.setValue(data.RMBBank); + CUSTACCOUNT.setValue(data.RMBAccount); + } else if (CURR == 'USD') { + CUSTBANK.setValue(data.USDBank); + CUSTACCOUNT.setValue(data.USDAccount); + } + } else { + CUSTBANK.setValue(''); + CUSTACCOUNT.setValue(''); } - this.formEdit.getForm().findField('SETTLETYPE').setValue(rec.data.SETTLETYPE); + + + } else { + btnEAddbill.enable(); + Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.NotNullCustOrCurrency , icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + return; } - //} + } + + if (!basicForm.isValid()) { + btnEAddbill.enable(); + return; } - var type = 0; - this.GetBank(); - + var type = 0; this.formEdit.getForm().findField('BILLSTATUS').setDisabled(false); this.formEdit.getForm().findField('SETTLEUSER').setDisabled(false); this.formEdit.getForm().findField('COMPANYID').setDisabled(false); this.formEdit.getForm().findField('SETTLEMODE').setDisabled(false); this.formEdit.getForm().findField('BILLTYPE').setDisabled(false); var field = this.formEdit.getForm().findField('SETTLEMODE'); - field.setValue(1); + field.setValue(2); var field = this.formEdit.getForm().findField('BILLTYPE'); field.setValue(1); @@ -3448,15 +3972,15 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { }, this); this.editRecord.commit(); } - this.opStatus = 'edit'; - _this.addDetailfn(addcurr); - + _this.addBillfn(); } else { + btnEAddbill.enable(); Ext.Msg.show({ title: Zi.LAN.E, msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } else { + btnEAddbill.enable(); Ext.Msg.show({ title: Zi.LAN.Retry, msg: Zi.LAN.ServerResponseError, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK @@ -3465,48 +3989,49 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { } }); } else { - this.addDetailfn(addcurr); - } - }, //end save - - addDetailfn: function (addcurr) { - - if (this.addstore) { - this.storeCurrExrate.removeAll(); - this.addstore = false; + this.addBillfn(); } + }, //end save + addBillfn: function () { + var btnEAddbill = Ext.getCmp('btnaddbill'); - var Duino = this.formEdit.getForm().findField('BILLNO').getValue(); - var billstatus = this.formEdit.getForm().findField('BILLSTATUS').getValue(); if (billstatus != 2) { - - Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.CannotAddApplyDetailOfStatus, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + btnEAddbill.enable(); + Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.CannotAddFeeDetailOfStatus , icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } - - var basicForm = this.formEdit.getForm(); - - + if (this.addstore) { + this.storeCurrExrate.removeAll(); + this.addstore = false; + } var billcust = this.editRecord.data.CUSTOMERNAME; var billno = this.editRecord.data.BILLNO; var billcurr = this.editRecord.data.CURR; + var billgroupcorp = this.GetGroupCorp(billcust); - var selectedRecords = this.gridAddFeeList.selModel.getSelection(); + var feeBSNOSql = ''; + var sql = ''; + var selectedRecords = this.gridAddList.selModel.getSelection(); + + if (selectedRecords.length == 0) { + btnEAddbill.enable(); + + Ext.Msg.show({ title: Zi.LAN.TiShi, msg:Zi.LAN.NoSelecteAddBusiness, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + return; + }; var bodyAddDatas = []; - _this = this; for (var i = 0; i < selectedRecords.length; i++) { + var rec = selectedRecords[i]; - var cust = rec.data.CUSTOMERNAME; - var bsno = rec.data.BILLNO; - var curr = rec.data.CURR; + var cust = rec.data.CUSTNAME; if (cust == billcust) { bodyAddDatas.push(rec); @@ -3516,12 +4041,10 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { alert(Zi.LAN.FyduixiangDifSFJSCust); } - } - - + } if (bodyAddDatas.length == 0) { - Ext.Msg.show({ title: Zi.LAN.TiShi, msg:Zi.LAN.NoFeeDetai2Add, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.NoFeeDetai2Add, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; }; @@ -3539,54 +4062,82 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { var currBody = ConvertRecordsToJsonAll(bodydatas); - Ext.Ajax.request({ waitMsg: Zi.LAN.Msg_Adding, - url: '/Account/Chfee_settlement/AddRecvAppDCDetail', + url: '/Account/Chfee_settlement/AddDui', params: { bill: billno, data: jsonbodyAddDatas, curr: billcurr, billtype: 1, - addcurr: addcurr, storeCurrExrate: currBody }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (!result.Success) { + btnEAddbill.enable(); + Ext.Msg.show({ title: Zi.LAN.TiShi, msg: result.Message, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK }); + + + return; } else { + + dataList = result.Data; if (dataList == null) { - var sql = this.BillSql; - this.storeAddFeeList.load({ params: { start: 0, limit: _this.PageSize, sort: '', condition: sql} }); - this.storeBodyList.load({ params: { billno: billno }, - callback: function (r, options, success) { - if (success) { - if (_this.storeBodyList.getCount() > 0) { - _this.comboxCurr.setReadOnly(true); - _this.comboxCustCode.setReadOnly(true); +// this.storeBodyAddList.load({ params: { start: 0, limit: _this.PageSize, sort: '', condition: sql, billtype: 1 } }); + this.storeBodyAddList.reload(); + + if (this.storeBodyList.getCount() != 0) { + this.storeBodyList.reload({ + callback: function (r, options, success) { + if (success) { + if (_this.storeBodyList.getCount() > 0) { + _this.comboxCurr.setReadOnly(true); + _this.comboxCustCode.setReadOnly(true); + } + else { + _this.comboxCurr.setReadOnly(false); + _this.comboxCustCode.setReadOnly(false); + } + } - else { - _this.comboxCurr.setReadOnly(false); - _this.comboxCustCode.setReadOnly(false); + }, + scope: this + }); + } else { + this.storeBodyList.load({ + params: { start: 0, limit: this.BodyPageSize,condition: " BILLNO='" + billno + "'" }, + callback: function (r, options, success) { + if (success) { + if (_this.storeBodyList.getCount() > 0) { + _this.comboxCurr.setReadOnly(true); + _this.comboxCustCode.setReadOnly(true); + } + else { + _this.comboxCurr.setReadOnly(false); + _this.comboxCustCode.setReadOnly(false); + } + } + }, + scope: this + }); + } - } - }, - scope: this - }); + this.storeBodySum.load({ params: { condition: " BILLNO='" + billno + "'"} }); Ext.Ajax.request({ waitMsg: Zi.LAN.OnSelect , @@ -3621,6 +4172,8 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { _this.formAHSR.getForm().setValues(data); _this.formFINANCIAL.getForm().setValues(data); _this.formADVANCE.getForm().setValues(data); + _this.formREMITTANCE.getForm().setValues(data); + var editp = Ext.create('MsChSettlement', data); this.editRecord.fields.each(function (field) { @@ -3638,13 +4191,16 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { }, scope: this }); + + } else { + if (dataList.lenght != 0) { for (var i = 0; i < dataList.length; i++) { var record = dataList[i]; _this.storeCurrExrate.add(record); } - _this.ExrateConversion(record.CURR, billcurr, 'detail', addcurr); + _this.ExrateConversion(record.CURR, billcurr, 'bill', 0); return; } @@ -3653,6 +4209,8 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { } } else { + btnEAddbill.enable(); + Ext.MessageBox.alert(Zi.LAN.Error, response.responseText); } }, @@ -3662,9 +4220,7 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { }, - deleteBill: function (type) { - var btnEDeleteDetail = Ext.getCmp('btndeldetail'); btnEDeleteDetail.disable(); @@ -3672,7 +4228,7 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { var selectedRecords = this.gridList.selModel.getSelection(); if (selectedRecords.length == 0) { - Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.NoApplyDetailNeedDel, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.NoFeeDetai2Del, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); btnEDeleteDetail.enable(); return; }; @@ -3681,7 +4237,7 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { if (billstatus != 2) { - Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.CanotDelApplyMX4Status, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.CanotDelSFJSMX4Status, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); btnEDeleteDetail.enable(); return; @@ -3699,10 +4255,10 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas); var sql = this.BillSql; - + Ext.Msg.wait(Zi.LAN.DeletingAndWait); Ext.Ajax.request({ waitMsg:Zi.LAN.Msg_Deleting, - url: '/Account/Chfee_settlement/DelRecvAppBill', + url: '/Account/Chfee_settlement/DelBill', params: { data: jsonbodyAddDatas, billno: billno, @@ -3721,10 +4277,11 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { btnEDeleteDetail.enable(); return; } else { - + Ext.MessageBox.hide(); var sql = this.BillSql; - this.storeAddFeeList.load({ params: { start: 0, limit: _this.PageSize, sort: '', condition: sql} }); - this.storeBodyList.load({ params: { billno: billno }, + this.storeBodyAddList.load({ params: { start: 0, limit: _this.PageSize, sort: '', condition: sql, billtype: 1} }); + this.storeBodyList.load({ + params: { start: 0, limit: _this.BodyPageSize,condition: " BILLNO='" + billno + "'" }, callback: function (r, options, success) { if (success) { if (_this.storeBodyList.getCount() > 0) { @@ -3735,13 +4292,12 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { _this.comboxCurr.setReadOnly(false); _this.comboxCustCode.setReadOnly(false); } - } }, scope: this }); + this.storeBodySum.load({ params: { condition: " BILLNO='" + billno + "'"} }); - btnEDeleteDetail.enable(); Ext.Ajax.request({ waitMsg: Zi.LAN.OnSelect , url: '/Account/Chfee_settlement/GetData', @@ -3775,6 +4331,8 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { _this.formAHSR.getForm().setValues(data); _this.formFINANCIAL.getForm().setValues(data); _this.formADVANCE.getForm().setValues(data); + _this.formREMITTANCE.getForm().setValues(data); + var editp = Ext.create('MsChSettlement', data); this.editRecord.fields.each(function (field) { @@ -3785,8 +4343,9 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { } }, this); this.editRecord.commit(); - + btnEDeleteDetail.enable(); } else { + btnEDeleteDetail.enable(); Ext.MessageBox.alert(Zi.LAN.Error, response.responseText); } }, @@ -3796,8 +4355,8 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { } } else { - btnEDeleteDetail.enable(); Ext.MessageBox.alert(Zi.LAN.Error, response.responseText); + btnEDeleteDetail.enable(); } }, scope: this @@ -3805,49 +4364,182 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { }, - //#region 预收付操作 - onAddAPDetailClick: function (button, event) { + //#region 预收付操作 + onAddAPDetailClick: function (button, event) { + + var gid = this.formEdit.getForm().findField('GID').getValue(); + var billno = this.formEdit.getForm().findField('BILLNO').getValue(); + + var billstatus = this.formEdit.getForm().findField('BILLSTATUS').getValue(); + + if (billstatus != 2) { + + Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.CanotAddSFJSMX4Status, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + return; + + } + + _this = this; + + // var basicForm = this.formEdit.getForm(); + // var basicForm1 = this.formACCOUNTS.getForm(); + // var basicForm2 = this.formPREPAY.getForm(); + // var basicForm3 = this.formAHSR.getForm(); + // var basicForm4 = this.formFINANCIAL.getForm(); + // var basicForm5 = this.formADVANCE.getForm(); + + + // if (basicForm.isDirty() || basicForm1.isDirty() + // || basicForm2.isDirty() || basicForm3.isDirty() || basicForm4.isDirty() || basicForm5.isDirty()) { + // Ext.Msg.show({ title: '提示', msg: '请先保存收费结算单,然后才能添加明细!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + // return; + // }; + + var selectedRecords = this.gridListAcc.selModel.getSelection(); + + var bodyAddDatas = []; + _this = this; + for (var i = 0; i < selectedRecords.length; i++) { + var rec = selectedRecords[i]; + bodyAddDatas.push(rec); + } + + + + if (bodyAddDatas.length == 0) { + Ext.Msg.show({ title: Zi.LAN.TiShi, msg:Zi.LAN.NoFeeDetai2Add, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + return; + }; + + var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas); + + + _this = this; + Ext.Msg.wait(Zi.LAN.Msg_SavingAndWait); + Ext.Ajax.request({ + waitMsg: Zi.LAN.Msg_Saving, + url: '/Account/Chfee_settlement/AddAPDetail', + scope: this, + params: { + billno: billno, + data: jsonbodyAddDatas, + stlnogid: gid, + feetype: 1 + }, + callback: function (options, success, response) { + if (success) { + Ext.MessageBox.hide(); + var jsonresult = Ext.JSON.decode(response.responseText); + if (jsonresult.Success) { + var custome = _this.formEdit.getForm().findField('CUSTOMERNAME').getValue(); + var billno = _this.formEdit.getForm().findField('BILLNO').getValue(); + var curr = _this.formADVANCE.getForm().findField('ADVANCE_CURRENCY').getValue(); + + var sql = "CUSTOMERNAME='" + custome + "' and (ISFINISH=0 or ISFINISH IS NULL) AND FEETYPE=1 AND currency='" + curr + "' AND BILLNO<>'" + billno + "' AND (ap.amount<>ap.doamount) "; + _this.storeAccBodyList.load({ params: { start: 0, limit: _this.PageSize, sort: '', condition: sql} }); + // _this.storePaymentList.load({ params: { start: 0, limit: _this.PageSize, sort: '', condition: "BILLNO='" + billno + "'"} }); + _this.storeBodyListAcc.load({ + params: { start: 0, limit: _this.BodyPageSize,condition: " SETTLEBILLNO='" + billno + "'" }, + callback: function (r, options, success) { + if (success) { + if (_this.storeBodyListAcc.getCount() > 0) (this.comboxCurrADVANCE.readOnly = true) + } + }, + scope: this + }); + + + Ext.Ajax.request({ + waitMsg: Zi.LAN.OnSelect , + url: '/Account/Chfee_settlement/GetData', + params: { + handle: 'edit', + condition: " BILLNO='" + billno + "'" + }, + 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; + } + + var data = result.data; + _this.formAHSR.getForm().reset(); + _this.formADVANCE.getForm().reset(); + _this.formAHSR.getForm().setValues(data); + _this.formADVANCE.getForm().setValues(data); + var editp = Ext.create('MsChSettlement', data); + + this.editRecord.fields.each(function (field) { + if (field.persist) { + name = field.name; + if (name != 'id') + this.editRecord.set(name, editp.get(name)); + } + }, this); + this.editRecord.commit(); + + } else { + Ext.MessageBox.alert(Zi.LAN.Error, response.responseText); + } + }, + scope: this + }); + + + + + } 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 + }); + } + } + }); + + + }, + + onDeleteApClick: function (button, event) { - var gid = this.formEdit.getForm().findField('GID').getValue(); var billno = this.formEdit.getForm().findField('BILLNO').getValue(); var billstatus = this.formEdit.getForm().findField('BILLSTATUS').getValue(); if (billstatus != 2) { - Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.CannotAddDetailOfStatus, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.CannotDelDetailOfStatus, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } - // var basicForm = this.formEdit.getForm(); - // var basicForm1 = this.formACCOUNTS.getForm(); - // var basicForm2 = this.formPREPAY.getForm(); - // var basicForm3 = this.formAHSR.getForm(); - // var basicForm4 = this.formFINANCIAL.getForm(); - // var basicForm5 = this.formADVANCE.getForm(); - - - // if (basicForm.isDirty() || basicForm1.isDirty() - // || basicForm2.isDirty() || basicForm3.isDirty() || basicForm4.isDirty() || basicForm5.isDirty()) { - // Ext.Msg.show({ title: Zi.LAN.TiShi, msg: '请先保存收费结算单,然后才能添加明细!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); - // return; - // }; - - var selectedRecords = this.gridListAcc.selModel.getSelection(); - - var bodyAddDatas = []; + var selectedRecords = this.gridBodyListAcc.selModel.getSelection(); _this = this; + var bodyAddDatas = []; for (var i = 0; i < selectedRecords.length; i++) { var rec = selectedRecords[i]; - bodyAddDatas.push(rec); + var voucherno = rec.data.VOUCHERNO; + if (voucherno == '') { + bodyAddDatas.push(rec); + } else { + Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.HasCertificateCanotDel , icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + } } - - + if (bodyAddDatas.length == 0) { - Ext.Msg.show({ title: Zi.LAN.TiShi, msg:Zi.LAN.NoFeeDetai2Add, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + Ext.Msg.show({ title: Zi.LAN.TiShi, msg:Zi.LAN.NoDetai2Del, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; }; @@ -3858,13 +4550,10 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { Ext.Msg.wait(Zi.LAN.Msg_SavingAndWait); Ext.Ajax.request({ waitMsg: Zi.LAN.Msg_Saving, - url: '/Account/Chfee_settlement/AddAPDetail', + url: '/Account/Chfee_settlement/DelAPBill', scope: this, params: { - billno: billno, - data: jsonbodyAddDatas, - stlnogid: gid, - feetype: 1 + data: jsonbodyAddDatas }, callback: function (options, success, response) { if (success) { @@ -3878,7 +4567,8 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { var sql = "CUSTOMERNAME='" + custome + "' and (ISFINISH=0 or ISFINISH IS NULL) AND FEETYPE=1 AND currency='" + curr + "' AND BILLNO<>'" + billno + "'"; _this.storeAccBodyList.load({ params: { start: 0, limit: _this.PageSize, sort: '', condition: sql} }); // _this.storePaymentList.load({ params: { start: 0, limit: _this.PageSize, sort: '', condition: "BILLNO='" + billno + "'"} }); - _this.storeBodyListAcc.load({ params: { condition: " SETTLEBILLNO='" + billno + "'" }, + _this.storeBodyListAcc.load({ + params: { start: 0, limit: _this.BodyPageSize,condition: " SETTLEBILLNO='" + billno + "'" }, callback: function (r, options, success) { if (success) { if (_this.storeBodyListAcc.getCount() > 0) (this.comboxCurrADVANCE.readOnly = true) @@ -3946,91 +4636,101 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { }, - onDeleteApClick: function (button, event) { - - var billno = this.formEdit.getForm().findField('BILLNO').getValue(); - - var billstatus = this.formEdit.getForm().findField('BILLSTATUS').getValue(); + //#endregion - if (billstatus != 2) { + //#region 汇兑损益 + addRemitDetailClick: function (button, event) { + var sREMITTANCE = this.formREMITTANCE.getForm().findField('REMITTANCE').getValue(); + var sBUYRATE = this.formREMITTANCE.getForm().findField('BUYRATE').getValue(); + var sSELLRATE = this.formREMITTANCE.getForm().findField('SELLRATE').getValue(); + var sSETTLRATE = this.formEdit.getForm().findField('RATE').getValue(); + + if (this.storeBodyList.getCount() > 0) { + for (var i = 0; i < this.storeBodyList.getCount(); i += 1) { + var memberbody = this.storeBodyList.getAt(i); + var feeid = memberbody.data.FEEID; + var isused = false; + for (var j = 0; j < this.storeListRemit.getCount(); j += 1) { + var memberRemit = this.storeListRemit.getAt(j); + var feeidRemit = memberRemit.data.FEEID; + if (feeid == feeidRemit) { + isused = true; + memberRemit.set("REMITTANCE", sREMITTANCE); + memberRemit.set("BUYRATE", sBUYRATE); + memberRemit.set("SELLRATE", sSELLRATE); + memberRemit.set("SETTLRATE", sSETTLRATE); + } + } + if (!isused) { + var record = Ext.create('ChSettlement_remittance', { + GID: NewGuid(), + BILLNO: '*', + FEEID: memberbody.data.FEEID, + BSNO: memberbody.data.BSNO, + MBLNO: memberbody.data.MBLNO, + HBLNO: memberbody.data.HBLNO, + CUSTNO: memberbody.data.CUSTNO, + CUSTOMERNAME: memberbody.data.CUSTOMERNAME, + SALE: memberbody.data.SALE, + FEENAME: memberbody.data.FEENAME, + FEETYPEREF: memberbody.data.FEETYPEREF, + CURRENCY: memberbody.data.ORIGCURRENCY, + AMOUNT: memberbody.data.ORIGAMOUNT, + REMITTANCEAMOUNT: memberbody.data.ORIGAMOUNT, + REMITTANCE: sREMITTANCE, + BUYRATE: sBUYRATE, + SELLRATE: sSELLRATE, + SETTLRATE: sSETTLRATE, + REMARK: '' + }); + this.storeListRemit.add(record); + } - Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.CannotDelDetailOfStatus, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); - return; + } - } - var bodyAddDatas = []; - var selectedRecords = this.gridBodyListAcc.selModel.getSelection(); - _this = this; - for (var i = 0; i < selectedRecords.length; i++) { - var rec = selectedRecords[i]; - var voucherno = rec.data.VOUCHERNO; - if (voucherno == '') { - bodyAddDatas.push(rec); - } else { - Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.HasCertificateCanotDel , icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); - } } + }, - _this = this; - for (var i = 0; i < selectedRecords.length; i++) { - var rec = selectedRecords[i]; - var voucherno = rec.data.VOUCHERNO; - if (voucherno == '') { - bodyAddDatas.push(rec); - } else { - Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.HasCertificateCanotDel , icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + onPostRemitDetailClick: function (button, event) { - } - } + var bodyDrChFeeDatas = []; + var i; + var BILLNO = this.formEdit.getForm().findField('BILLNO').getValue(); + for (i = 0; i < this.storeListRemit.getCount(); i += 1) { + var memberyf = this.storeListRemit.getAt(i); + bodyDrChFeeDatas.push(memberyf); - if (bodyAddDatas.length == 0) { - Ext.Msg.show({ title: Zi.LAN.TiShi, msg:Zi.LAN.NoDetai2Del, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); - return; }; + var jsonChFeeBody = ConvertRecordsToJsonAll(bodyDrChFeeDatas); - var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas); - + var billno = this.formEdit.getForm().findField('BILLNO').getValue(); - _this = this; + _thisfee = this; Ext.Msg.wait(Zi.LAN.Msg_SavingAndWait); Ext.Ajax.request({ waitMsg: Zi.LAN.Msg_Saving, - url: '/Account/Chfee_settlement/DelAPBill', + url: '/Account/Chfee_settlement/SaveRemit', scope: this, params: { - data: jsonbodyAddDatas + billno: BILLNO, + body: jsonChFeeBody }, callback: function (options, success, response) { if (success) { Ext.MessageBox.hide(); var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { - var custome = _this.formEdit.getForm().findField('CUSTOMERNAME').getValue(); - var billno = _this.formEdit.getForm().findField('BILLNO').getValue(); - var curr = _this.formADVANCE.getForm().findField('ADVANCE_CURRENCY').getValue(); - - var sql = "CUSTOMERNAME='" + custome + "' and (ISFINISH=0 or ISFINISH IS NULL) AND FEETYPE=1 AND currency='" + curr + "' AND BILLNO<>'" + billno + "'"; - _this.storeAccBodyList.load({ params: { start: 0, limit: _this.PageSize, sort: '', condition: sql} }); - // _this.storePaymentList.load({ params: { start: 0, limit: _this.PageSize, sort: '', condition: "BILLNO='" + billno + "'"} }); - _this.storeBodyListAcc.load({ params: { condition: " SETTLEBILLNO='" + billno + "'" }, - callback: function (r, options, success) { - if (success) { - if (_this.storeBodyListAcc.getCount() > 0) (this.comboxCurrADVANCE.readOnly = true) - } - }, - scope: this - }); - + _this.storeListRemit.load({ params: { condition: " r.BILLNO='" + BILLNO + "'"} }); Ext.Ajax.request({ waitMsg: Zi.LAN.OnSelect , url: '/Account/Chfee_settlement/GetData', params: { handle: 'edit', - condition: " BILLNO='" + billno + "'" + condition: " BILLNO='" + BILLNO + "'" }, callback: function (options, success, response) { if (success) { @@ -4046,10 +4746,19 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { } var data = result.data; + _this.formEdit.getForm().reset(); + _this.formACCOUNTS.getForm().reset(); + _this.formPREPAY.getForm().reset(); _this.formAHSR.getForm().reset(); + _this.formFINANCIAL.getForm().reset(); _this.formADVANCE.getForm().reset(); + _this.formEdit.getForm().setValues(data); + _this.formACCOUNTS.getForm().setValues(data); + _this.formPREPAY.getForm().setValues(data); _this.formAHSR.getForm().setValues(data); + _this.formFINANCIAL.getForm().setValues(data); _this.formADVANCE.getForm().setValues(data); + _this.formREMITTANCE.getForm().setValues(data); var editp = Ext.create('MsChSettlement', data); this.editRecord.fields.each(function (field) { @@ -4068,7 +4777,6 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { scope: this }); - } else { Ext.Msg.show({ title: Zi.LAN.E, msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } @@ -4080,25 +4788,126 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { } } }); + }, //end save - }, + onDelRemitDetailClick: function (button, event) { + var selections = this.gridListRemit.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 = []; + for (var i = 0; i < selections.length; i++) { + var rec = selections[i]; + bodyAddDatas.push(rec); + } + var billno = this.formEdit.getForm().findField('BILLNO').getValue(); + var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas); + 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/DeleteRemit', + params: { + data: jsonbodyAddDatas + }, + callback: function (options, success, response) { + if (success) { + var jsonresult = Ext.JSON.decode(response.responseText); + if (jsonresult.Success) { + _this.storeListRemit.load({ params: { condition: " r.BILLNO='" + billno + "'"} }); + Ext.Ajax.request({ + waitMsg: Zi.LAN.OnSelect , + url: '/Account/Chfee_settlement/GetData', + params: { + handle: 'edit', + condition: " BILLNO='" + billno + "'" + }, + 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; + } + + var data = result.data; + _this.formEdit.getForm().reset(); + _this.formACCOUNTS.getForm().reset(); + _this.formPREPAY.getForm().reset(); + _this.formAHSR.getForm().reset(); + _this.formFINANCIAL.getForm().reset(); + _this.formADVANCE.getForm().reset(); + _this.formEdit.getForm().setValues(data); + _this.formACCOUNTS.getForm().setValues(data); + _this.formPREPAY.getForm().setValues(data); + _this.formAHSR.getForm().setValues(data); + _this.formFINANCIAL.getForm().setValues(data); + _this.formADVANCE.getForm().setValues(data); + _this.formREMITTANCE.getForm().setValues(data); + var editp = Ext.create('MsChSettlement', data); + + this.editRecord.fields.each(function (field) { + if (field.persist) { + name = field.name; + if (name != 'id') + this.editRecord.set(name, editp.get(name)); + } + }, this); + this.editRecord.commit(); + + } else { + Ext.MessageBox.alert(Zi.LAN.Error, response.responseText); + } + }, + scope: this + }); + + Ext.Msg.show({ title: Zi.LAN.TiShi, msg: jsonresult.Message, 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 //#endregion + onSubmitAuditClick: function () { var Duino = this.formEdit.getForm().findField('BILLNO').getValue(); - var billstatus = this.formEdit.getForm().findField('BILLSTATUS').getValue(); + var REMARK = this.formEdit.getForm().findField('REMARK').getValue(); + + // var btnESave = Ext.getCmp('btnESave'); + // isDisabled() + if (Duino == '*') { Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.SaveSFJSBeforLock, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; }; - + var billstatus = this.formEdit.getForm().findField('BILLSTATUS').getValue(); if ((billstatus != 2)) { Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.CanotLock4CurrStatus, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); @@ -4107,10 +4916,12 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { } //if (this.storeBodyList.getCount() == 0) { - // Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.NoShouFeeMXLock, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + // Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.CanotLock4NoJSDetail, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); // return; //} + + _this = this; Ext.Ajax.request({ @@ -4194,12 +5005,12 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { }, onSubmitAuditBackClick: function () { - var Duino = this.formEdit.getForm().findField('BILLNO').getValue(); - var billstatus = this.formEdit.getForm().findField('BILLSTATUS').getValue(); + var billstatus = this.formEdit.getForm().findField('BILLSTATUS').getValue(); + var Duino = this.formEdit.getForm().findField('BILLNO').getValue(); if (Duino == '*') { - Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.SaveSFJSBeforCancleLock, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.SaveSFJSBeforCancleLock , icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; }; @@ -4212,7 +5023,6 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { } var isvou = this.formEdit.getForm().findField('ISEXPORT').getValue(); - if (isvou == true) { Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.CanotUnlock4HasCert, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; @@ -4224,6 +5034,7 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { return; } + _this = this; Ext.Ajax.request({ @@ -4332,7 +5143,7 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { scope: this, params: { data: Ext.JSON.encode(data), - settlemode: 1 + settlemode: 2 }, callback: function (options, success, response) { if (success) { @@ -4357,11 +5168,22 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { onRefreshClick: function (button, event) { var sql = this.getCondition(); this.sqlcontext = sql; - this.storeAddFeeList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql} }); + this.PageSize = this.Pagenum.getValue(); + this.storeBodyAddList.pageSize = this.PageSize; + this.storeBodyAddList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql, billtype: 1} }); }, + onDsQuery: function (button, event) { var sql = this.sqlcontext; - this.storeAddFeeList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql } }); + this.PageSize = this.Pagenum.getValue(); + this.storeBodyAddList.pageSize = this.PageSize; + this.storeBodyAddList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql, billtype: 1} }); + }, + + onInitRefreshClick: function (button, event) { + var sql = this.getCondition(); + this.sqlcontext = " 1=2 "; + this.storeBodyAddList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: this.sqlcontext, billtype: 1} }); }, onClearSql: function () { @@ -4379,37 +5201,24 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { var sql = ''; - var customNo = form.findField('CustomNo').getValue(); - sql = sql + getAndConSql(sql, customNo, " BILLNO like '%" + customNo + "%'"); - - - var CUSTNAME = form.findField('CUSTNAME').getValue(); - sql = sql + getAndConSql(sql, CUSTNAME, " CUSTOMERNAME='" + CUSTNAME + "'"); + var customNo = form.findField('BsNo').getValue(); + sql = sql + getAndConSql(sql, customNo, "DUINO like '%" + customNo + "%'"); + var custName = form.findField('CustName').getValue(); + sql = sql + getAndConSql(sql, custName, "CUSTNAME='" + custName + "'"); - var BH = form.findField('BH').getValue(); - sql = sql + getAndConSql(sql, BH, " EXISTS(select 1 from ch_fee_do where BILLNO=cm.BILLNO and EXISTS(select 1 from v_op_bs where bsno=ch_fee_do.BSNO and (CUSTNO like '%" + BH + "%' or MBLNO like '%" + BH + "%' or HBLNO like '%" + BH + "%') ))"); + var DUINAME = form.findField('DUINAME').getValue(); + sql = sql + getAndConSql(sql, DUINAME, "DUINAME like '%" + DUINAME + "%'"); + var OP = form.findField('OP').getValue(); + sql = sql + getAndConSql(sql, OP, "OP='" + OP + "'"); - var Currency = form.findField('Currency').getValue(); - sql = sql + getAndConSql(sql, Currency, "CURR='" + Currency + "'"); var expDateBgn = form.findField('ExpDateBgn').getRawValue(); - sql = sql + getAndConSql(sql, expDateBgn, "APPLYTIME >='" + expDateBgn + "'"); + sql = sql + getAndConSql(sql, expDateBgn, "DUIDATE >='" + expDateBgn + "'"); var expDateEnd = form.findField('ExpDateEnd').getRawValue(); - sql = sql + getAndConSql(sql, expDateEnd, "APPLYTIME <='" + expDateEnd + "'"); - - - var DC = form.findField('ISDEBIT').getValue(); - if (DC == '1') - sql = sql + getAndConSql(sql, DC, " (BILLSTATUS=2 OR BILLSTATUS=0 OR BILLSTATUS=5) "); - - - // this.FeeSqlStr = this.getFeeCondition(); - // feesql = feesql + getAndConSql(feesql, this.FeeSqlStr, this.FeeSqlStr); - - // sql = sql + getAndConSql(sql, feesql, feesql); + sql = sql + getAndConSql(sql, expDateEnd, "DUIDATE <='" + expDateEnd + "'"); this.BillSql = sql; return sql; @@ -4417,11 +5226,16 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { getFeeCondition: function () { var form = this.formSearch.getForm(); - var feesql = ''; + var feesql = ' f.FEESTATUS IN (0,8,9) and (f.AMOUNT<>(f.SETTLEMENT+f.ORDERAMOUNT-ISNULL(f.ORDERSETTLEMENT,0))) '; var CUSTNAME = form.findField('CUSTNAME').getValue(); feesql = feesql + getAndConSql(feesql, CUSTNAME, "f.CUSTOMERNAME='" + CUSTNAME + "'"); + var SALECORP = form.findField('SALECORP').getValue(); + feesql = feesql + getAndConSql(feesql, SALECORP, "f.SALECORP='" + SALECORP + "'"); + + var DC = form.findField('DC').getValue(); + feesql = feesql + getAndConSql(feesql, DC, "f.FEETYPE=" + DC); var Currency = form.findField('Currency').getValue(); feesql = feesql + getAndConSql(feesql, Currency, "f.Currency='" + Currency + "'"); @@ -4429,10 +5243,22 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { var FeeName = form.findField('FeeName').getValue(); feesql = feesql + getAndConSql(feesql, FeeName, "f.FeeName='" + FeeName + "'"); + + //var DuiNo = form.findField('DuiNo').getValue(); + ////feesql = feesql + getAndConSql(feesql, DuiNo, " f.GID IN (SELECT GID FROM V_DUI_FEE WHERE DUINO='" + DuiNo + "')"); + ////展濠模糊查询 + //feesql = feesql + getAndConSql(feesql, DuiNo, " f.GID IN (SELECT GID FROM V_DUI_FEE WHERE DUINO like '%" + DuiNo + "%')"); + var InvNo = form.findField('InvNo').getValue(); + feesql = feesql + getAndConSql(feesql, InvNo, " f.GID IN (SELECT FEEID FROM ch_fee_do WHERE BILLNO in (select BILLNO FROM ch_fee_invoice WHERE INVOICENO='" + InvNo + "'))"); + + + + + return feesql; }, - ExrateConversion: function (bfcurr, afcurr, fntype, addcurr) { + ExrateConversion: function (bfcurr, afcurr, fntype, dfexrate) { var EXRATE = 0; var achange = true; @@ -4521,7 +5347,7 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { value: 0, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { - var lsValue = usMoney(value, 10, '', false); + var lsValue = usMoney(value,10, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '' + lsValue + ''; @@ -4568,12 +5394,8 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { winExrateShow = Ext.create('Ext.window.Window', { title: Zi.LAN.CurrencyRateConvert, width: 450, - //height : 120, - //plain : true, iconCls: "addicon", resizable: false, - // 是否可以拖动 - // draggable:false, collapsible: true, // 允许缩放条 closeAction: 'close', closable: true, @@ -4593,13 +5415,11 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { }; var recs = DsStoreQueryBy(me.storeCurrExrate, 'CURR', bfcurr); if (recs.getCount() > 0) { - // var dfdata = DFrecords.getAt(0).data; - // dfdata.EXRATE = UsdExrate; for (var i = 0; i < me.storeCurrExrate.getCount(); i += 1) { var member = me.storeCurrExrate.getAt(i); if (member.data.CURR == bfcurr) { - // member.EXRATE = UsdExrate; + member.set('EXRATE', UsdExrate); member.commit(); } @@ -4611,7 +5431,7 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { } winExrateShow.close(); if (fntype == 'detail') { - me.addDetail(addcurr); + me.addDetail(); } if (fntype == 'bill') { me.addBill(); @@ -4623,12 +5443,12 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { minWidth: 70, handler: function () { winExrateShow.close(); + me.GetEditStatus(); return; } }] }); - if (bfcurr == 'RMB') { var FFrecords = DsStoreQueryBy(this.StoreDateCurr, 'CURR', afcurr); if (FFrecords.getCount() > 0) { @@ -4654,18 +5474,24 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { } else if (afcurr == 'RMB') { - var FFrecords = DsStoreQueryBy(this.StoreDateCurr, 'CURR', bfcurr); - if (FFrecords.getCount() > 0) { - var ffdata = FFrecords.getAt(0).data; - var DEFRATE = ffdata.DEFRATE; + if (dfexrate != 0 && this.FREESTLBYINPUTEXCHANGE == 1) { + var DEFRATE = dfexrate; } else { - var recs = DsStoreQueryBy(me.storeCurrExrate, 'CURR', bfcurr); - if (recs.getCount() > 0) { - var dfdata = recs.getAt(0).data; - var DEFRATE = dfdata.DFEXRATE; - } else var DEFRATE = dfexrate; - } + + var FFrecords = DsStoreQueryBy(this.StoreDateCurr, 'CURR', bfcurr); + if (FFrecords.getCount() > 0) { + var ffdata = FFrecords.getAt(0).data; + var DEFRATE = ffdata.DEFRATE; + + } else { + var recs = DsStoreQueryBy(me.storeCurrExrate, 'CURR', bfcurr); + if (recs.getCount() > 0) { + var dfdata = recs.getAt(0).data; + var DEFRATE = dfdata.DFEXRATE; + } else var DEFRATE = dfexrate; + } + } var field = formExrateConversion.getForm().findField('bfcurr'); @@ -4674,7 +5500,7 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { field.setValue(DEFRATE); - } else { + }else { var field = formExrateConversion.getForm().findField('bfcurr'); var recs = DsStoreQueryBy(me.storeCurrExrate, 'CURR', bfcurr); if (recs.getCount() > 0) { @@ -4686,23 +5512,26 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { } winExrateShow.show(); - // S=setInterval(function () { - // if (EXRATE != 0) { - // alert(EXRATE); - // clearInterval(S); - // } - // }, 500) }, + GetGroupCorp: function (custname) { + _this = this; + var records = DsStoreQueryBy(_this.StoreClientGroup, 'SHORTNAME', custname); + if (records.getCount() > 0) { + return records.getAt(0).data.PCORPNAME; + } else { + return ''; + } + + }, GetBank: function () { if (this.StoreBANK.getCount() == 0) return; var ACCOUNT = this.formEdit.getForm().findField('ACCOUNT').getValue(); var CURR = this.formEdit.getForm().findField('CURR').getValue(); var SETTLETYPE = this.formEdit.getForm().findField('SETTLETYPE').getRawValue(); if (SETTLETYPE == '现金') return; - if (ACCOUNT != '') return; if (CURR == '') return; for (var j = 0; j < this.StoreBANK.getCount() ; j += 1) { @@ -4716,7 +5545,7 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { onAddFileClick: function () { var billstatus = this.formEdit.getForm().findField('BILLSTATUS').getValue(); - if ((billstatus == 1)) { + if ((billstatus ==1)) { Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.CanotLock4CurrStatus, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; @@ -4846,16 +5675,17 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { } else { canedit = false; } + _this.setSaveBtnStatus(canedit); - _this.LoadPeriodStatus(this.opStatus); + _this.LoadPeriodStatus(_this.opStatus); } } } }); } - this.StoreLockOp.load({ - params: { optype: "modRecvFeeSettlementLock" }, + + this.StoreLockOp.load({ params: { optype: "modRecvFeeSettlementLock" }, callback: function (r, options, success) { if (success) { if (r.length != 0) { @@ -4879,8 +5709,7 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { }); - this.StoreUnLockOp.load({ - params: { optype: "modRecvFeeSettlementUnLock" }, + this.StoreUnLockOp.load({ params: { optype: "modRecvFeeSettlementUnLock" }, callback: function (r, options, success) { if (success) { if (r.length != 0) { @@ -4906,12 +5735,16 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { }, + setSaveBtnStatus: function (enable) { var btnESave = Ext.getCmp('btnESave'); var btnESaveAndClose = Ext.getCmp('btnESaveAndClose'); var btnESaveAndNew = Ext.getCmp('btnESaveAndNew'); - var btnEAddDetail = Ext.getCmp('btnadddetail'); var btnEDeleteDetail = Ext.getCmp('btndeldetail'); + var btnEAddbill = Ext.getCmp('btnaddbill'); + var btnAddRemit = Ext.getCmp('AddRemit'); + var btnPostRemit = Ext.getCmp('PostRemit'); + var btnDelRemit = Ext.getCmp('DelRemit'); var btnEDeleteAndNew = Ext.getCmp('btnEDeleteAndNew'); this.canedit = enable; @@ -4920,26 +5753,80 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { btnESaveAndClose.enable(); btnESaveAndNew.enable(); - btnEAddDetail.enable(); btnEDeleteDetail.enable(); + btnEAddbill.enable(); + btnAddRemit.enable(); + btnPostRemit.enable(); + btnDelRemit.enable(); btnEDeleteAndNew.enable(); - } else { btnESave.disable(); btnESaveAndClose.disable(); btnESaveAndNew.disable(); - btnEAddDetail.disable(); btnEDeleteDetail.disable(); + btnEAddbill.disable(); + btnAddRemit.enable(); + btnPostRemit.enable(); + btnDelRemit.enable(); btnEDeleteAndNew.disable(); - } }, // #endregion + onExportDetailClick: function () { + if (this.storeBodyList.getCount() == 0) { + Ext.Msg.show({ title:'提示', msg: '没有数据,无法导出', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); + return; + } + var basicForm = this.formEdit.getForm(); + var billNo = basicForm.findField('BILLNO').value; + var sql = " BILLNO='" + billNo + "' "; + Ext.Msg.wait('正在组织数据, 请稍侯..'); + Ext.Ajax.request({ + waitMsg: '正在组织数据...', + url: '/Account/Chfee_settlement/GetBillListStr', + scope: this, + params: { + condition: sql, + printstr: 'true', + sortstr:'' + }, + callback: function (options, success, response) { + if (success) { + Ext.MessageBox.hide(); + var jsonresult = Ext.JSON.decode(response.responseText); + if (jsonresult.Success) { + var returnstr = jsonresult.Data; + var printType = 'STLBILLLIST'; + var sql1 = returnstr; + sql1 = sql1.replace(/\+/g, "@@@") + if (sql1 != '') { + GridExportBySql(sql1, this.formname + 'bill', '应收结算明细列表.xls'); + //var openSet = "height=1, width=400, toolbar=no, menubar=no,scrollbars=no, resizable=no,location=no, status=no,Top=" + (screen.height - 200) / 2 + ",Left=" + (screen.width - 400) / 2; + //var openType = "_blank"; + // var openUrl = "../../Reports/RptExport.aspx?handle=DsRptExcel&formname=" + this.formname + 'dr'+ "&condition1=" + sql1; + //window.open(openUrl, openType, openSet); + + } + + + } else { + Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); + } + } else { + Ext.Msg.show({ + title: '请重试', + msg: '服务器响应出错', + icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK + }); + } + } + }); + }, Print: function () { var basicForm = this.formEdit.getForm(); @@ -4948,9 +5835,6 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { Ext.Msg.show({ title: Zi.LAN.E, msg: Zi.LAN.PrintMustAfterSave, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); return; } - - var printType = 'MSCHFEERECVSETTLEMENT'; - var sortstr = ' b.VESSEL,b.VOYNO,b.MBLNO'; if (this.sortfield != '' && this.sortdire != '') { @@ -4958,6 +5842,8 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { sortstr = this.sortfield + ' ' + this.sortdire; } + var printType = 'MSCHFEERECVSETTLEMENT'; + var sql1 = "SELECT s.*,(select ShowName from [user] where GID=s.SETTLEUSER) as SETTLEUSERREF "; sql1 = sql1 + " ,(select STLNAME from [code_stlmode] where STLCODE=s.SETTLETYPE) as SETTLETYPERE "; sql1 = sql1 + " ,(select BANKNAME from [sys_bank] where GID=s.ACCOUNTRMB) as ACCOUNTRMBREF"; @@ -4969,7 +5855,7 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { var sql2 = "SELECT c.GID,c.BSNO,c.FEEID,c.FEENAME,c.CURRENCY,c.AMOUNT,c.DOAMOUNT,c.ORIGCURRENCY,c.ORIGAMOUNT,c.EXCHANGERATE,FEETYPE "; sql2 = sql2 + ",b.CUSTOMERNAME,b.VESSEL,b.VOYNO,b.ETD,b.PORTLOAD"; - sql2 = sql2 + " ,b.PORTDISCHARGE,b.INPUTBY,b.OP,b.CUSTSERVICE,b.DOC,b.SALE,b.MBLNO"; + sql2 = sql2 + " ,b.PORTDISCHARGE,b.INPUTBY,b.OP,b.CUSTSERVICE,b.DOC,b.SALE,b.MBLNO,b.CUSTNO"; sql2 = sql2 + " FROM ch_fee_do c left join v_op_bill b on (b.bsno=c.bsno)"; sql2 = sql2 + " WHERE C.BILLNO='" + billNo + "' ORDER BY " + sortstr; @@ -4994,16 +5880,16 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { // var BILLSTATUS = this.formEdit.getForm().findField('BILLSTATUS').value; //是否锁定 // var SETTLETYPEREF = this.formEdit.getForm().findField('SETTLETYPE').value; //结算方式 // var ACCOUNTREF = this.formEdit.getForm().findField('ACCOUNT').value; //结算账户 - + // // if (VOUCHERNO == "" && BILLSTATUS == 1 && ((SETTLETYPEREF != "现金" && ACCOUNTREF != "") || SETTLETYPEREF == "现金")) { // strGids = this.editRecord.data.GID.toString(); // } // if (strGids == "") { - // Ext.Msg.show({ title: '提示', msg: '请选择已锁定、结算账户不为空(结算方式为现金除外),且未生成凭证的单据!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + // Ext.Msg.show({ title: Zi.LAN.TiShi, msg: '请选择已锁定、结算账户不为空(结算方式为现金除外),且未生成凭证的单据!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); // return; // } // // - // this.storeListCw.load({ params: { strGids: strGids }, waitMsg: "正在刷新数据...", scope: this }); + // this.storeListCw.load({ params: { strGids: strGids }, waitMsg: Zi.LAN.RefreshDataWait, scope: this }); // this.showContactForm(false, strGids, this); // Ext.Ajax.request({ @@ -5256,6 +6142,19 @@ Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { win.show(); } //#endregion + + , +onSelectFee: function (button, event) { + + var selectedRecords = this.gridAddFeeList.selModel.getSelection(); + var sum = 0; + for (var i = 0; i < selectedRecords.length; i++) { + var rec = selectedRecords[i]; + sum = sum + rec.get("StlAmount"); + } + sum = sum.toFixed(2); + Ext.getCmp("zongshu").setText(Zi.LAN.SelecteAmount + sum); +} }); diff --git a/DSWeb/Areas/Account/Viewsjs/Chfee_settlement/ChRecvDuiBLsettlementEdit6.js b/DSWeb/Areas/Account/Viewsjs/Chfee_settlement/ChRecvDuiBLsettlementEdit6.js new file mode 100644 index 00000000..bba9e76e --- /dev/null +++ b/DSWeb/Areas/Account/Viewsjs/Chfee_settlement/ChRecvDuiBLsettlementEdit6.js @@ -0,0 +1,5261 @@ +Ext.namespace('Shipping'); + +Shipping.MsChRecvDuiSettlementEdit = function (config) { + Ext.applyIf(this, config); + this.initUIComponents(); + window.Shipping.MsChRecvDuiSettlementEdit.superclass.constructor.call(this); +}; + +Ext.extend(Shipping.MsChRecvDuiSettlementEdit, Ext.Panel, { + + ParentWin: null, + OpStatus: 'add', + StoreList: null, + EditRecord: null, + addstore: false, + PageSize: 30, + + initUIComponents: function () { + this.serialNo = 0; + this.workSerialNo = 0; + this.bodyDel = []; + this.FeeSql = ''; + this.BillSql = ''; + this.DuiBillSql = ''; + this.IsDebit = '0'; + this.sortfield = ''; + this.sortdire = ''; + this.MsPeriod = null; + this.canedit = false; + this.FeeDetailSql = ''; + this.STLSHOWVOU = 0; + this.ISRATESET = 0; + this.sqlcontext = ''; + this.formname = "MsChRecvDuiSettlementEdit"; //页面名称 + + this.storeMustBe = Ext.create('Ext.data.Store', { + model: 'DsShipping.ux.OpDefValue', + remoteSort: true, + proxy: { + type: 'ajax', + url: '/MvcShipping/MsCodeOpMustField/GetDataList', + reader: { + id: 'GID', + root: 'data', + totalProperty: 'totalCount' + } + } + }); + + this.StoreLockOp = Ext.create('DsExt.ux.RefTableStore', { + model: 'MsFeeOP', + proxy: { url: '/MvcShipping/MsBaseInfo/GetOpIDRang' } + }); +// this.StoreLockOp.load({ params: { optype: "modRecvFeeSettlementLock"} }); + + this.StoreUnLockOp = Ext.create('DsExt.ux.RefTableStore', { + model: 'MsFeeOP', + proxy: { url: '/MvcShipping/MsBaseInfo/GetOpIDRang' } + }); +// this.StoreUnLockOp.load({ params: { optype: "modRecvFeeSettlementUnLock"} }); + + //#region 编辑form + + //枚举参照相关(编辑form) + + + //表参照相关(编辑form) + + this.storeCustCode = Ext.create('DsExt.ux.RefTableStore', { + model: 'DsShipping.ux.CustomRefModel', + proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListRm' } + }); + + // this.storeCustCode.load({ params: { condition: ""} }); + this.comboxCustCode = Ext.create('DsExt.ux.RefTableCombox', { + fieldLabel: Zi.LAN.CustomerName, + store: this.storeCustCode, + allowBlank: false, + queryMode: 'remote', + minChars: 1, + queryParam: 'CODENAME', + name: 'CUSTOMERNAME', + valueField: 'CustName', + displayField: 'CodeAndName', + listeners: { + scope: this, + 'select': function (combo, records, eOpts) { + if (records.length > 0) { + var CUSTOMERNAME = this.formEdit.getForm().findField('CUSTOMERNAME').getValue(); + + if (CUSTOMERNAME == '') return; + var CUSTNAME = this.formSearch.getForm().findField('CUSTNAME'); + var tmpcust = CUSTNAME.getValue(); + if (tmpcust == '' || tmpcust == null || tmpcust == undefined) { + CUSTNAME.setValue(CUSTOMERNAME); + + } + + } + + } + } + + }); + + + this.StoreOpRange = Ext.create('DsExt.ux.RefTableStore', { + model: 'MsOP', + proxy: { url: '/MvcShipping/MsBaseInfo/GetOpRang' } + }); + + this.StoreCurr = Ext.create('DsExt.ux.RefTableStore', { + model: 'MsFeeCurr', + proxy: { url: '/MvcShipping/MsChFee/GetFeeCurrList' } + }); + this.StoreCurr.load({ params: { condition: ""} }); + this.StoreDateCurr = Ext.create('DsExt.ux.RefTableStore', { + model: 'MsFeeCurr', + proxy: { url: '/MvcShipping/MsChFee/GetFeeNowCurrList' } + }); + this.StoreDateCurr.load({ params: { condition: ""} }); + + this.comboxCurr = Ext.create('DsExt.ux.RefTableCombox', { + fieldLabel: Zi.LAN.Currency, + store: this.StoreCurr, + forceSelection: true, + allowBlank: false, + emptyText: '原币结算', //原币申请 + flex: 0.5, + name: 'CURR', + valueField: 'CURR', + displayField: 'CURR', + listeners: { + scope: this, + 'select': function (combo, records, eOpts) { + if (records.length > 0) { + var curr = this.formACCOUNTS.getForm().findField('ACCOUNTS_CURRENCY'); + curr.setValue(records[0].data.CURR); + var curr = this.formPREPAY.getForm().findField('PREPAY_CURRENCY'); + curr.setValue(records[0].data.CURR); + var curr = this.formAHSR.getForm().findField('AHSR_CURRENCY'); + curr.setValue(records[0].data.CURR); + var curr = this.formFINANCIAL.getForm().findField('FINANCIAL_CURRENCY'); + curr.setValue(records[0].data.CURR); + var curr = this.formADVANCE.getForm().findField('ADVANCE_CURRENCY'); + curr.setValue(records[0].data.CURR); + + } + } + } + }); + + + this.StoreStlMode = Ext.create('DsExt.ux.RefTableStore', { + model: 'STLMODE', + proxy: { url: '/MvcShipping/MsBaseInfo/GetStlModeList' } + }); + this.StoreStlMode.load({ params: { condition: ""} }); + + + this.comboxStlMode = Ext.create('DsExt.ux.RefTableCombox', { + fieldLabel: Zi.LAN.SettlementType, + store: this.StoreStlMode, + forceSelection: true, + flex: 0.6, + name: 'SETTLETYPE', + valueField: 'STLCODE', + displayField: 'STLNAME' + }); + + this.StoreBANK = Ext.create('DsExt.ux.RefTableStore', { + model: 'BANK', + proxy: { url: '/MvcShipping/MsBaseInfo/GetBANKList' } + }); + //this.StoreBANK.load({ params: { condition: ""} }); + this.StoreBANK.on('beforeload', function (store) { + var companyid = this.formEdit.getForm().findField('SALECORPID').getValue(); + Ext.apply(store.proxy.extraParams, { companyid: companyid }); + }, this); + + this.comboxBANK = Ext.create('DsExt.ux.RefTableCombox', { + fieldLabel: Zi.LAN.BankAccount, + store: this.StoreBANK, + forceSelection: true, + name: 'ACCOUNT', + valueField: 'GID', + displayField: 'BANKACCOUNT' + }); + + + this.storeSTLCATEGROY = Ext.create('DsExt.ux.RefEnumStore', {}); + this.storeSTLCATEGROY.load({ params: { enumTypeId: 97020} }); + + this.comboxSTLCATEGROY = Ext.create('DsExt.ux.RefTableCombox', { + fieldLabel: Zi.LAN.ServiceCategory, + name: 'STLCATEGROY', + store: this.storeSTLCATEGROY, + valueField: 'EnumValueName', + displayField: 'EnumValueName', + forceSelection: true + }); + + this.storeSaleCompany = Ext.create('DsExt.ux.RefTableStore', { + model: 'MsCompanysEntity', + proxy: { url: '/MvcShipping/MsCompanys/GetNoPicDataList' } + }); + this.storeSaleCompany.load({ params: { condition: ""} }); + + + this.comboxSaleCompany = Ext.create('DsExt.ux.RefTableCombox', { + fieldLabel: Zi.LAN.DepartmentName, //'委托分公司', + store: this.storeSaleCompany, + forceSelection: true, + name: 'SALECORPID', + valueField: 'GID', + displayField: 'NAME', + listeners: { + scope: this, + 'select': function (combo, records, eOpts) { + if (records.length > 0) { + var CURR = this.formEdit.getForm().findField('CURR').getValue(); + this.StoreBANK.load({ + params: { condition: "" }, + callback: function (r, options, success) { + if (success) { + if (this.StoreBANK.getCount() > 0) { + for (var i = 0; i < this.StoreBANK.getCount(); i += 1) { + var member = this.StoreBANK.getAt(i); + if (member.data.CURRENCY == CURR && member.data.ISDEF == 'True') { + this.formEdit.getForm().findField('ACCOUNT').setValue(member.data.GID); + } + } + } + } + }, + scope: this + }); + + } + + } + } + }); + + //编辑form + this.formEdit = Ext.widget('form', { + region: 'center', + frame: true, + bodyPadding: 3, + trackResetOnLoad: true, + // autoScroll: true, + fieldDefaults: { + margins: '2 2 2 2', + labelAlign: 'right', + flex: 1, + labelWidth: 90, + msgTarget: 'qtip' + }, + + items: [ + {//fieldset 1 + xtype: 'fieldset', + defaultType: 'textfield', + layout: 'anchor', + defaults: { + anchor: '100%' + }, + items: [{ + xtype: 'container', + layout: 'hbox', + defaultType: 'textfield', + items: [{ + fieldLabel: 'GID', + name: 'GID', flex: 0, hidden: true, margins: '0' + }, { + fieldLabel: 'BILLSTATUS', + name: 'BILLSTATUS', flex: 0, hidden: true, margins: '0' + }, { + fieldLabel: 'BILLDATE', + name: 'BILLDATE', flex: 0, hidden: true, margins: '0' + }, { + fieldLabel: 'SETTLEUSER', + name: 'SETTLEUSER', flex: 0, hidden: true, margins: '0' + }, { + fieldLabel: 'COMPANYID', + name: 'COMPANYID', flex: 0, hidden: true, margins: '0' + }, { + fieldLabel: 'SETTLEMODE', + name: 'SETTLEMODE', flex: 0, hidden: true, margins: '0' + }, { + fieldLabel: 'BILLTYPE', + name: 'BILLTYPE', flex: 0, hidden: true, margins: '0' + }, { + fieldLabel: 'ISEXPORT', + name: 'ISEXPORT', flex: 0, hidden: true, margins: '0' + }, { + fieldLabel: 'CREATEUSER', + name: 'CREATEUSER', flex: 0, hidden: true, margins: '0' + }, { + fieldLabel: 'CREATETIME', + name: 'CREATETIME', flex: 0, hidden: true, margins: '0' + }, { + fieldLabel: 'REMITTANCE', + name: 'REMITTANCE', flex: 0, hidden: true, margins: '0' + }, { + fieldLabel: 'BUYRATE', + name: 'BUYRATE', flex: 0, hidden: true, margins: '0' + }, { + fieldLabel: 'SELLRATE', + name: 'SELLRATE', flex: 0, hidden: true, margins: '0' + }, { + fieldLabel: 'STLAMOUNT', + name: 'STLAMOUNT', flex: 0, hidden: true, margins: '0' + }, { + fieldLabel: 'HXBILLNO', + name: 'HXBILLNO', flex: 0, hidden: true, margins: '0' + }, + + { + fieldLabel: Zi.LAN.BillNo, + readOnly: true, + name: 'BILLNO' + }, { + fieldLabel: Zi.LAN.BillStatus, + readOnly: true, + name: 'BILLSTATUSREF' + }, this.comboxCustCode, { + fieldLabel: Zi.LAN.SettlementTime, + format: 'Y-m-d H:i:s', + xtype: 'datefield', + name: 'SETTLETIME' + }, { + fieldLabel: Zi.LAN.SettlementUser, + readOnly: true, + name: 'SETTLEUSERREF' + } + ] + }, { + xtype: 'container', + layout: 'hbox', + defaultType: 'textfield', + items: [this.comboxCurr, { + fieldLabel: Zi.LAN.Money, + readOnly: true, + labelWidth: 40, + flex: 0.5, + name: 'AMOUNT', + 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; + } + }, this.comboxStlMode,{ + fieldLabel: Zi.LAN.ExchangeRate, + labelWidth: 40, + flex: 0.4, + name: 'RATE' + }, this.comboxBANK, { + fieldLabel: Zi.LAN.SettlementNo, + flex: 1, + name: 'SETTLENO' + }, this.comboxSaleCompany] + + }, { + xtype: 'container', + layout: 'hbox', + defaultType: 'textfield', + items: [this.comboxSTLCATEGROY, { + fieldLabel: Zi.LAN.Remark, + flex: 3, + name: 'REMARK' + }, { + fieldLabel: Zi.LAN.VoucherNo_PayBL, + name: 'VOUCHERNO' + }] + + } + ]//end items(fieldset 1) + }//end fieldset 1 + ]//end root items + }); //end this.formEdit + + //#endregion + + //#region 按钮Toolbar + + + + + + this.panelBtn = new Ext.Panel({ + region: "north", + tbar: [ + { + id: 'btnESave', + text: Zi.LAN.Save , + iconCls: "btnsave", + handler: function (button, event) { + this.Save('0'); + }, + scope: this + }, '-', + { + text: Zi.LAN.Print, + handler: function (button, event) { + this.Print(); + }, + scope: this + }, + '-', + { + text: Zi.LAN.InZhangDanPrint, + iconCls: "btnadd", + handler: function (button, event) { + var BILLNO = this.formEdit.getForm().findField('BILLNO').getValue(); + 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_jinzhang/Edit?handle=check&DRNO=" + BILLNO; + window.open(openUrl, openType, openSet); + }, + scope: this + + }, + '-', + { + id: 'btnESaveAndClose', + text: Zi.LAN.SaveAndClose, + handler: function (button, event) { + this.Save('1'); + }, + scope: this + }, + '-', + { + id: 'btnESaveAndNew', + text: Zi.LAN.SaveAndNew, + handler: function (button, event) { + this.Save('2'); + this.GetEditStatus(); + }, + scope: this + }, + '-', + { + id: 'btnENew', + text: Zi.LAN.New, + handler: function (button, event) { + this.LoadData('add', '*'); + }, + scope: this + }, + '-', + { + id: 'btnEDeleteAndNew', + text: Zi.LAN.DeleteAndNew, + handler: function (button, event) { + this.Delete(); + }, + scope: this + }, '-', { + id: 'btnSubmitAudit', + text: Zi.LAN.SubmitAudit, + tooltip: Zi.LAN.SubmitAudit, + disabled: true, + handler: function (button, event) { + this.onSubmitAuditClick(); + }, + scope: this + }, '-', { + id: 'btnSubmitAuditBack', + text: Zi.LAN.SubmitAuditBack, + tooltip: Zi.LAN.SubmitAuditBack, + disabled: true, + handler: function (button, event) { + this.onSubmitAuditBackClick(); + }, + scope: this + }, '-', + { + text: Zi.LAN.AddCwVouchers, + id: "btnAddCwVouchers", + iconCls: "btnadd", + handler: function (button, event) { + this.onAddCwVouchers(); + }, + scope: this + } + ] + }); //end 按钮Toolbar + + //#endregion + + //#region 明细表 + + //明细表表格相关 + + this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel'); + //明细表-数据集 + this.storeBodyList = Ext.create('Ext.data.Store', { + model: 'Payapplication_do_detail', + remoteSort: true, + proxy: { + type: 'ajax', + url: '/Account/Chfee_settlement/GetRecvdetailList', + reader: { + id: 'BILLNO', + root: 'data', + totalProperty: 'totalCount' + } + } + }); + + //明细表表格 + this.gridListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', { + clicksToEdit: 1 + }); + + + + this.gridList = new Ext.grid.GridPanel({ + store: this.storeBodyList, + enableHdMenu: false, + region: 'center', + loadMask: { msg: Zi.LAN.LoadData }, + trackMouseOver: true, + disableSelection: false, + viewConfig: { + enableTextSelection: true + }, + selModel: this.GridCheckBoxModel, + tbar: [{ + text:Zi.LAN.DeleteApplyDetail, + tooltip:Zi.LAN.DeleteApplyDetail, + id: 'btndeldetail', + iconCls: "btndeletedetail", + handler: function (button, event) { + this.onDeleteClick(button, event, 1); + }, + scope: this + }], + columns: [{ + sortable: true, + dataIndex: 'BILLNO', + header: Zi.LAN.ApplyBillNo, + width: 100 + }, { + sortable: true, + dataIndex: 'BILLSTATUSREF', + header: Zi.LAN.BillStatus, + width: 60 + }, { + sortable: true, + dataIndex: 'DOAMOUNT', + header: Zi.LAN.SettlementAmount, + width: 80, + 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: 'CURR', + header: Zi.LAN.OriginalCurrency, + width: 80 + }, { + sortable: true, + dataIndex: 'AMOUNT', + header: Zi.LAN.OriginalMoney, + width: 80, + 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: 'APPLYTIME', + header: Zi.LAN.ApplyTime, + width: 80 + }, { + sortable: true, + dataIndex: 'APPLICANTNAME', + header: Zi.LAN.Sqperson, + width: 80 + }, { + sortable: true, + dataIndex: 'PAYABLETIME', + header: Zi.LAN.ApplyShouKuanDate, + width: 80 + }, { + sortable: true, + dataIndex: 'REMARK', + header: Zi.LAN.Remark, + width: 60 + } + ] + }); + + + + this.storeBodydetail = Ext.create('Ext.data.Store', { + model: 'Chfee_do_detail', + remoteSort: true, + proxy: { + type: 'ajax', + url: '/Account/Chfee_settlement/GetAppBodyList', + reader: { + root: 'data', + totalProperty: 'totalCount' + } + } + }); + + + this.gridBodydetail = new Ext.grid.GridPanel({ + store: this.storeBodydetail, + enableHdMenu: false, + region: 'center', + loadMask: { msg: Zi.LAN.LoadData }, + trackMouseOver: true, + viewConfig: { + enableTextSelection: true + }, + disableSelection: false, + tbar: [{ + xtype: 'label', + width: 120, + height: 22, + text: Zi.LAN.ChargeDetails + }], + columns: [{ + sortable: true, + dataIndex: 'BILLNO', + header: 'BILL', + hidden: true, + width: 100 + }, { + sortable: true, + dataIndex: 'BSNO', + header: 'BSNO', + hidden: true, + width: 100 + }, { + sortable: true, + dataIndex: 'FEEDOID', + header: 'FEEDOID', + hidden: true, + width: 100 + }, { + sortable: true, + dataIndex: 'COMPANYNAME', + header: '分公司', + width: 80 + }, { + sortable: true, + dataIndex: 'CUSTNO', + header: Zi.LAN.DelegateNumber, + width: 120 + }, { + sortable: true, + dataIndex: 'MBLNO', + header: Zi.LAN.LadingNumber, + width: 120 + }, { + sortable: true, + dataIndex: 'CUSTOMERNAME', + header: Zi.LAN.Requester, + width: 100 + }, { + sortable: true, + dataIndex: 'ETD', + header: Zi.LAN.SailingDate, + renderer: Ext.util.Format.dateRenderer('Y-m-d'), + width: 100 + }, { + sortable: true, + dataIndex: 'BSSOURCE', + header: Zi.LAN.BusinessSource, + width: 80 + }, { + sortable: true, + dataIndex: 'FEENAME', + header: Zi.LAN.CostName, + width: 80 + }, { + sortable: true, + dataIndex: 'FEETYPEREF', + header: Zi.LAN.FeeTypeRef, + width: 40 + }, { + sortable: true, + dataIndex: 'AMOUNT', + header: Zi.LAN.SettlementAmount, + width: 80, + 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: 'ORIGCURRENCY', + header: Zi.LAN.OriginalCurrency, + width: 80 + }, { + sortable: true, + dataIndex: 'ORIGEXCHANGERATE', + header: Zi.LAN.OriginalExchangeRate, + width: 80 + }, { + sortable: true, + dataIndex: 'EXCHANGERATE', + header: Zi.LAN.ConvertExchangeRate , + width: 80 + }, { + sortable: true, + dataIndex: 'ORIGAMOUNT', + header: Zi.LAN.OriginalMoney, + width: 80, + 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: 'INVOICENO', + header: Zi.LAN.InvoiceNumber, + width: 80 + }, { + sortable: true, + dataIndex: 'SALE', + header: Zi.LAN.LanhuoPeople, + width: 80 + }, { + sortable: true, + dataIndex: 'INPUTMODE', + header: Zi.LAN.InputMode, + width: 160 + }, { + sortable: true, + dataIndex: 'ACCDATE', + header: Zi.LAN.kuaiJiQJ, + width: 80 + }, { + sortable: true, + dataIndex: 'BSSALECORP', + header: Zi.LAN.BSSALECORP, + width: 160 + } + ] + }); + this.gridBodydetail.addListener('itemdblclick', function (dataview, record, item, index, e, b) { + this.SelectedRecord = record; + var openSet = "height=700, width=1024, toolbar=no, menubar=no,scrollbars=1, resizable=1,location=no, status=no,Top= " + (screen.height - 750) / 2 + ",Left= " + (screen.width - 1100) / 2 + var openType = "_blank"; + var openUrl = ""; + openUrl = "../../MvcShipping/MsOpBill/MsOpFeeView?handle=check&bsno=" + record.data.BSNO; + + window.open(openUrl, openType, openSet); + }, this); + + this.gridBodydetail.addListener('sortchange', function (ct, column, direction, eOpts) { + this.sortfield = column.dataIndex; + this.sortdire = direction; + }, this); + + + this.storeAddFeeList = Ext.create('Ext.data.Store', { + pageSize: this.PageSize, + model: 'MsChDui', + remoteSort: true, + proxy: { + type: 'ajax', + url: '/Account/Chfee_settlement/GetRecvDuiDataList', + reader: { + id: 'DUINO', + root: 'data', + totalProperty: 'totalCount' + } + } + }); + + + this.AddFeeGridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel'); + this.cellEditingFee = Ext.create('Ext.grid.plugin.CellEditing', { + clicksToEdit: 1, + listeners: { + 'edit': function (editor, e) { + + } + } + + }); + + _this = this; + + this.CurrGroup = new Ext.form.RadioGroup({ + id: 'CurrGroup', + xtype: 'radiogroup', + fieldLabel: Zi.LAN.ExchangeCurrency, + columns: 2, + items: [ + { boxLabel: 'RMB', name: 'Curr', inputValue: 'RMB', checked: true }, + { boxLabel: 'USD', name: 'Curr', inputValue: 'USD' } + ] + }); + + + this.initgirdfeecolums = [{ + sortable: true, + dataIndex: 'DUINO', + header: '对账编号', //对账编号 + width: 120 + }, { + sortable: true, + dataIndex: 'CUSTNAME', + header: '客户名称', //客户名称 + width: 160 + }, { + sortable: true, + dataIndex: 'DUIDATE', + header: '对账日期', //对账日期 + width: 160 + }, { + sortable: true, + dataIndex: 'OP', + header: '对账人', //对账人 + width: 160 + }, { + sortable: true, + dataIndex: 'BILLSTATUSREF', + header: '状态', //状态 + width: 60 + }, { + sortable: true, + dataIndex: 'DUINAME', + header: '账单描述', //账单描述 + width: 160 + }, { + sortable: true, + dataIndex: 'CUSTTYPE', + header: '客户类型', //账单描述 + width: 160 + }, { + sortable: true, + dataIndex: 'RMBDR', + header: '应收RMB', //应收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', + width: 80 + }, { + sortable: true, + dataIndex: 'BALRMBDR', + header: '未结RMB', //未收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', + width: 80 + }, { + sortable: true, + dataIndex: 'BALRMBDR', + header: '本次结算RMB', //未收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', + editor: { + xtype: 'numberfield', + keyNavEnabled: false, + allowDecimals: true, + decimalPrecision: 2, + selectOnFocus: true, + mouseWheelEnabled: false, + enableKeyEvents: true + }, + width: 80 + }, { + sortable: true, + dataIndex: 'USDDR', + header: '应收USD', //应收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', + width: 80 + }, { + sortable: true, + dataIndex: 'BALUSDDR', + header: '未结USD', //未收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', + width: 80 + }, { + sortable: true, + dataIndex: 'BALUSDDR', + header: '本次结算USD', //未收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', + editor: { + xtype: 'numberfield', + keyNavEnabled: false, + allowDecimals: true, + decimalPrecision: 2, + selectOnFocus: true, + mouseWheelEnabled: false, + enableKeyEvents: true + }, + width: 80 + }, { + sortable: true, + dataIndex: 'OTDR', + header: '应收OT', //应收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', + width: 80 + }, { + sortable: true, + dataIndex: 'BALOTDR', + header: '未结OT', //未收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', + width: 80 + }, { + sortable: true, + dataIndex: 'BALOTDR', + header: '本次结算OT', //未收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', + editor: { + xtype: 'numberfield', + keyNavEnabled: false, + allowDecimals: true, + decimalPrecision: 2, + selectOnFocus: true, + mouseWheelEnabled: false, + enableKeyEvents: true + }, + width: 80 + }, { + sortable: true, + dataIndex: 'REMARKS', + header: Zi.LAN.shuoming, //说明 + width: 160 + } + ]; + + this.girdfeecolums = this.initgirdfeecolums; + + this.gridAddFeeList = new Ext.grid.GridPanel({ + store: this.storeAddFeeList, + enableHdMenu: false, + region: 'west', + split: true, + width: 860, + loadMask: { msg: Zi.LAN.LoadData }, + trackMouseOver: true, + disableSelection: false, + viewConfig: { + enableTextSelection: true + }, + plugins: [this.cellEditingFee], + selModel: this.AddFeeGridCheckBoxModel, + tbar: [{ + text: Zi.LAN.AddApplyDetail , + id: "btnadddetail", + iconCls: 'btnadddetail', + menu: [ + { text: Zi.LAN.AllApplyAmount, + handler: function (menu, event) { + _this.onAddDetailClick(menu, event, ''); + } + }, { text: Zi.LAN.OnlyRMBApplyAmount, + handler: function (menu, event) { + _this.onAddDetailClick(menu, event, 'RMB'); + } + }, { text: Zi.LAN.OnlyUSDApplyAmount, + handler: function (menu, event) { + _this.onAddDetailClick(menu, event, 'USD'); + } + }], + + scope: this + }, '-', { + text: Zi.LAN.SavelistStyle, + menu: [ + { + text: Zi.LAN.Save, + handler: function (button, event) { + _this.girdfeecolums = DsTruck.SaveGridPanel(USERID, _this.formname + 'feeadd', _this.gridAddFeeList.columns, _this.girdfeecolums, 1, true); + } + }, { + text: Zi.LAN.Initialization, + handler: function (menu, event) { + _this.girdfeecolums = DsTruck.SaveGridPanel(USERID, _this.formname + 'feeadd', _this.gridAddFeeList.columns, _this.initgirdfeecolums, 1, true); + } + }], + scope: this + }], + columns: this.girdfeecolums , + // paging bar on the bottom + bbar: Ext.create('Ext.PagingToolbar', { + store: this.storeAddFeeList, + displayInfo: true, + displayMsg: Zi.LAN.FenYe, + emptyMsg: Zi.LAN.DataEmptyMsg + }) + }); + + + this.girdfeecolums = DsTruck.GetGridPanel(USERID, this.formname + 'feeadd', this.girdfeecolums, 1); //使用者id,表名,中间column数组,跳过一开始的几列 + this.gridAddFeeList.reconfigure(this.storeAddFeeList, this.girdfeecolums); + + this.gridAddFeeList.on('edit', function (editor, e, eOpts) { + this.gridAddFeeListAfterEdit(editor, e, eOpts); + }, this); + + _this = this; + + + + + this.storeAddBodydetail = Ext.create('Ext.data.Store', { + model: 'Chfee_do_detail', + remoteSort: true, + proxy: { + type: 'ajax', + url: '/Account/Chfee_recvapplication/GetBillList', + reader: { + root: 'data', + totalProperty: 'totalCount' + } + } + }); + + this.initgirdfeecolums = [{ + sortable: true, + dataIndex: 'BILLNO', + header: 'BILL', + hidden: true, + width: 100 + }, { + sortable: true, + dataIndex: 'BSNO', + header: 'BSNO', + hidden: true, + width: 100 + }, { + sortable: true, + dataIndex: 'FEEDOID', + header: 'FEEDOID', + hidden: true, + width: 100 + }, { + sortable: true, + dataIndex: 'CUSTNO', + header: Zi.LAN.DelegateNumber, + width: 120 + }, { + sortable: true, + dataIndex: 'MBLNO', + header: Zi.LAN.LadingNumber, + width: 120 + }, { + sortable: true, + dataIndex: 'CUSTOMERNAME', + header: Zi.LAN.Requester, + width: 100 + }, { + sortable: true, + dataIndex: 'ETD', + header: Zi.LAN.SailingDate, + renderer: Ext.util.Format.dateRenderer('Y-m-d'), + width: 100 + }, { + sortable: true, + dataIndex: 'BSSOURCE', + header: Zi.LAN.BusinessSource, + width: 80 + }, { + sortable: true, + dataIndex: 'FEENAME', + header: Zi.LAN.CostName, + width: 80 + }, { + sortable: true, + dataIndex: 'FEETYPEREF', + header: Zi.LAN.FeeTypeRef, + width: 40 + }, { + sortable: true, + dataIndex: 'AMOUNT', + header: Zi.LAN.ApplyAmount, + width: 80, + 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: 'DOAMOUNT', + header: Zi.LAN.SettlementAmount, + width: 80, + 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: 'ORIGCURRENCY', + header: Zi.LAN.OriginalCurrency, + width: 80 + }, { + sortable: true, + dataIndex: 'ORIGAMOUNT', + header: Zi.LAN.OriginalMoney, + width: 80, + 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: 'SALE', + header: Zi.LAN.LanhuoPeople, + width: 80 + } + ]; + + this.girdfeecolums = this.initgirdfeecolums; + + this.gridAddBodydetail = new Ext.grid.GridPanel({ + store: this.storeAddBodydetail, + enableHdMenu: false, + region: 'center', + loadMask: { msg: Zi.LAN.LoadData }, + trackMouseOver: true, + viewConfig: { + enableTextSelection: true + }, + disableSelection: false, + tbar: [{ + xtype: 'label', + width: 120, + height: 22, + text: Zi.LAN.ChargeDetails + }, '-', { + text: Zi.LAN.SavelistStyle, + id: "btntestfee", + menu: [ + { + text: Zi.LAN.Save , + handler: function (button, event) { + _this.girdfeecolums = DsTruck.SaveGridPanel(USERID, _this.formname + 'AddBodydetail', _this.gridAddBodydetail.columns, _this.girdfeecolums, 1, true); + } + }, { + text: Zi.LAN.Initialization, + handler: function (menu, event) { + _this.girdfeecolums = DsTruck.SaveGridPanel(USERID, _this.formname + 'AddBodydetail', _this.gridAddBodydetail.columns, _this.initgirdfeecolums, 1, true); + } + }], + scope: this + }], + columns: this.girdfeecolums + }); + + this.girdfeecolums = DsTruck.GetGridPanel(USERID, this.formname + 'AddBodydetail', this.girdfeecolums, 1); //使用者id,表名,中间column数组,跳过一开始的几列 + this.gridAddBodydetail.reconfigure(this.storeAddBodydetail, this.girdfeecolums); + + + this.storeCustCodefee = Ext.create('DsExt.ux.RefTableStore', { + model: 'DsShipping.ux.CustomRefModel', + proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListRm' } + }); + + // this.storeCustCodefee.load({ params: { condition: ""} }); + + this.comboxAddCustCode = Ext.create('DsExt.ux.RefTableCombox', { + fieldLabel: Zi.LAN.Fyduixiang, + store: this.storeCustCodefee, + forceSelection: true, + queryMode: 'remote', + minChars: 1, + queryParam: 'CODENAME', + name: 'CUSTNAME', + valueField: 'CustName', + displayField: 'CodeAndName' + + }); + + + this.comboxCurr2 = Ext.create('DsExt.ux.RefTableCombox', { + fieldLabel: Zi.LAN.Currency, + store: this.StoreCurr, + forceSelection: true, + labelWidth: 40, + flex: 0.5, + name: 'Currency', + valueField: 'CURR', + displayField: 'CURR' + }); + + + + this.storeIsDebit = Ext.create('Ext.data.Store', { + fields: ['DC', 'NAME'] + }); + this.storeIsDebit.add({ "DC": "1", "NAME": Zi.LAN.Yes }); + this.storeIsDebit.add({ "DC": "2", "NAME": Zi.LAN.No }); + + this.comboxIsDebit = Ext.create('DsExt.ux.RefTableCombox', { + fieldLabel: Zi.LAN.OnlyUnSettlementApply, + store: this.storeIsDebit, + valueField: 'DC', + labelWidth: 90, + flex: 0.6, + displayField: 'NAME', + forceSelection: true, + value: "1", + name: 'ISDEBIT' + }); + + + + this.storeCurrExrate = Ext.create('Ext.data.Store', { + fields: ['CURR', 'EXRATE', 'DFEXRATE'] + }); + + + this.formSearch = Ext.widget('form', { + frame: true, + region: 'north', + bodyPadding: 5, + fieldDefaults: { + margins: '2 2 2 2', + labelAlign: 'right', + flex: 1, + labelWidth:70, + msgTarget: 'qtip' + }, + + items: [ + {//fieldset 1 + xtype: 'container', + defaultType: 'textfield', + layout: 'anchor', + defaults: { + anchor: '100%' + }, + items: [{ + xtype: 'container', + layout: 'hbox', + defaultType: 'textfield', + items: [this.comboxAddCustCode, { + fieldLabel: Zi.LAN.ApplyBillNo, + name: 'CustomNo' + }, { + fieldLabel: Zi.LAN.Number, + tooltip: Zi.LAN.DelegateNumber + '、' + Zi.LAN.LadingNumber + '、' + Zi.LAN.FenladingNumber, + labelWidth: 40, + name: 'BH', + enableKeyEvents: true, + listeners: { + specialkey: function (field, e) { + if (e.getKey() == e.ENTER) { + _this.onRefreshClick(); + } + } + } + }, this.comboxCurr2, { + fieldLabel: Zi.LAN.ExpDateBgn , + format: 'Y-m-d', + xtype: 'datefield', + name: 'ExpDateBgn' + }, { + fieldLabel: Zi.LAN.ExpDateEnd, + format: 'Y-m-d', + xtype: 'datefield', + name: 'ExpDateEnd' + }, this.comboxIsDebit, { + xtype: 'button', + width: 80, + text: Zi.LAN.SearchOrRefresh, + iconCls: "btnrefresh", + handler: function (button, event) { + this.onRefreshClick(); + }, + scope: this + }, { + xtype: 'button', + width: 45, + text: "", + iconCls: "btnmore", + handler: function (button, event) { + var sql = this.getCondition(); + var winAccess = new Shipping.DsQuery({ + + }); + winAccess.StoreList = this.storeList; + winAccess.formname = this.formname; + winAccess.condition = sql; + winAccess.show(); + return; + + + }, + scope: this + } + ] + } + ]//end items(fieldset 1) + }//end fieldset 1 + ]//end root items + + }); + + //#region 附件上传 + this.storeChfeeFile = Ext.create('Ext.data.Store', { + model: 'FeeFileModel', + remoteSort: false, + proxy: { + type: 'ajax', + url: '/Account/Chfee_payapplication/GetFileList', + reader: { + id: 'GID', + root: 'data', + totalProperty: 'totalCount' + } + } + }); + //表格 + this.FeeFileColumns = [ + { + sortable: true, hidden: true, + dataIndex: 'GID', readOnly: true, + header: 'GID', + width: 80 + }, { + sortable: true, hidden: false, + dataIndex: 'File_OriginalName', readOnly: true, + header: Zi.LAN.FileName, //文件名称 + width: 80 + }, { + sortable: true, hidden: false, + dataIndex: 'UpdateTime', readOnly: true, + header: Zi.LAN.FileDate, //上传日期 + width: 80 + }, { + sortable: true, hidden: false, + dataIndex: 'Operator', readOnly: true, + header: Zi.LAN.FilePerson, //上传者 + width: 80 + }, { + sortable: true, hidden: true, + dataIndex: 'File_Name', readOnly: true, + header: Zi.LAN.FileWName, //文件物理名称 + width: 80 + }, + { + sortable: true, hidden: true, + dataIndex: 'File_Path', + header: 'File_Path', + width: 80 + }, { + xtype: 'actioncolumn', + width: 50, + text: Zi.LAN.Operating, //操作 + 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(); + } + }] + } + ]; + var selCertModel = Ext.create('Ext.selection.CheckboxModel'); + this.fileGrid = new Ext.grid.GridPanel({ + store: this.storeChfeeFile, + enableHdMenu: false, + layout: 'border', + region: 'center', + loadMask: { msg: Zi.LAN.LoadData }, //数据加载中,请稍等... + trackMouseOver: true, + disableSelection: false, + selModel: selCertModel, + singleSelect: true, + selType: 'rowmodel', + tbar: [{ + text: Zi.LAN.filetp, //上传图片 + tooltip: Zi.LAN.filetp, + iconCls: "btnadddetail", + handler: function (button, event) { + this.onAddFileClick(button, event); + }, + scope: this + }, '-', { + text: Zi.LAN.delete1, //删除 + tooltip: Zi.LAN.delete1, //删除图片 + iconCls: "btndeletedetail", + handler: function (button, event) { + this.onDelFileClick(button, event); + }, + scope: this + }], + columns: this.FeeFileColumns + }); + + this.page_2 = new Ext.Panel({ + id: "page_2", + title: Zi.LAN.filefujina, //附件上传 + autoScroll: true, + layout: "border", + region: 'center', + //closable:true, + items: [this.fileGrid] + }); + + //#endregion附件上传 + + this.panelService = new Ext.Panel({ + layout: "border", + region: 'west', + split: true, + width: 860, + margin: '2 2', + items: [this.gridList] + }); + + this.panelBodydetail = new Ext.Panel({ + layout: "border", + region: 'center', + margin: '2 2', + items: [this.gridBodydetail] + }); + + this.panelAddBodydetail = new Ext.Panel({ + layout: "border", + region: 'center', + margin: '2 2', + items: [this.gridAddBodydetail] + }); + + + + + this.paneldetail = new Ext.Panel({ + // title: Zi.LAN.SettlementDetail , + layout: "border", + height: 260, + region: "north", + split: true, + items: [ + this.panelService, this.panelBodydetail + ] + }); + + this.panelAddService = new Ext.Panel({ + layout: "border", + region: 'center', + margin: '2 2', + items: [this.gridAddFeeList, this.panelAddBodydetail] + }); + + this.paneladd = new Ext.Panel({ + title: Zi.LAN.AddPaySettlementDetail, + layout: "border", + // region: 'south', + region: "center", + // height: 420, + items: [ + this.formSearch, this.panelAddService + ] + }); + + //#endregion 明细表 + + //#region 预收预付 + this.formACCOUNTS = Ext.widget('form', { + anchor: '20% 100%', + columnWidth: .20, + frame: true, + bodyPadding: 5, + title: Zi.LAN.BookKeepingData, + trackResetOnLoad: true, + fieldDefaults: { + margins: '2 2 2 2', + labelAlign: 'right', + flex: 1, + labelWidth: 40, + msgTarget: 'qtip' + }, + + items: [ + {//fieldset 1 + xtype: 'fieldset', + defaultType: 'textfield', + layout: 'anchor', + defaults: { + anchor: '100%' + }, + items: [{ + xtype: 'container', + layout: 'hbox', + defaultType: 'textfield', + items: [{ + fieldLabel: Zi.LAN.Currency, + labelWidth: 40, + readOnly: true, + name: 'ACCOUNTS_CURRENCY' + } + ]//end items(fieldset 1) + }, { + xtype: 'container', + layout: 'hbox', + defaultType: 'textfield', + items: [{ + fieldLabel: Zi.LAN.ExchangeRate, + labelWidth: 40, + name: 'ACCOUNTS_RATE' + } + ]//end items(fieldset 1) + }, { + xtype: 'container', + layout: 'hbox', + defaultType: 'textfield', + items: [{ + fieldLabel: Zi.LAN.Money, + labelWidth: 40, + name: 'ACCOUNTS_MONEY', + 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; + }, + listeners: { + scope: this, + 'blur': function (textfield, eOpts) { + var curr = this.formPREPAY.getForm().findField('PREPAY_MONEY'); + var allamount = textfield.value; + var amount = this.formEdit.getForm().findField('AMOUNT').getValue(); + var aftamount = parseFloat(allamount) - parseFloat(amount); + curr.setValue(aftamount); + this.formACCOUNTS.getForm().findField('ACCOUNTS_MONEY').setValue(amount); + + var financialamount = this.formFINANCIAL.getForm().findField('FINANCIAL_MONEY').getValue(); + var advanceamount = this.formADVANCE.getForm().findField('ADVANCE_MONEY').getValue(); + + amount = parseFloat(allamount).add(parseFloat(-advanceamount)); + amount = parseFloat(amount).add(parseFloat(-financialamount)); + this.formAHSR.getForm().findField('AHSR_MONEY').setValue(amount); + + } + } + } + ]//end items(fieldset 1) + }//end fieldset 1 + ]//end root items + }] + }); + + this.comboxCurrPREPAY = Ext.create('DsExt.ux.RefTableCombox', { + fieldLabel: Zi.LAN.Currency, + store: this.StoreCurr, + forceSelection: true, + name: 'PREPAY_CURRENCY', + valueField: 'CURR', + displayField: 'CURR' + }); + + this.formPREPAY = Ext.widget('form', { + anchor: '20% 100%', + columnWidth: .20, + frame: true, + trackResetOnLoad: true, + bodyPadding: 5, + title: "+" + Zi.LAN.YuShouZhiReport, + trackResetOnLoad: true, + fieldDefaults: { + margins: '2 2 2 2', + labelAlign: 'right', + flex: 1, + labelWidth: 40, + msgTarget: 'qtip' + }, + + items: [ + {//fieldset 1 + xtype: 'fieldset', + defaultType: 'textfield', + layout: 'anchor', + defaults: { + anchor: '100%' + }, + items: [{ + xtype: 'container', + layout: 'hbox', + defaultType: 'textfield', + items: [this.comboxCurrPREPAY + ]//end items(fieldset 1) + }, { + xtype: 'container', + layout: 'hbox', + defaultType: 'textfield', + items: [{ + fieldLabel: Zi.LAN.ExchangeRate, + labelWidth: 40, + name: 'PREPAY_RATE' + } + ]//end items(fieldset 1) + }, { + xtype: 'container', + layout: 'hbox', + defaultType: 'textfield', + items: [{ + fieldLabel: Zi.LAN.Money, + labelWidth: 40, + name: 'PREPAY_MONEY', + 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; + }, + listeners: { + scope: this, + 'blur': function (textfield, eOpts) { + var curr = this.formAHSR.getForm().findField('AHSR_MONEY'); + var accamount = this.formACCOUNTS.getForm().findField('ACCOUNTS_MONEY').getValue(); + var prepamount = this.formPREPAY.getForm().findField('PREPAY_MONEY').getValue(); + var advanceamount = this.formADVANCE.getForm().findField('ADVANCE_MONEY').getValue(); + var financialamount = this.formFINANCIAL.getForm().findField('FINANCIAL_MONEY'); + + + var amount = parseFloat(accamount).add(parseFloat(prepamount)); + amount = parseFloat(amount).add(parseFloat(-advanceamount)); + amount = parseFloat(amount).add(parseFloat(-financialamount)); + curr.setValue(amount); + } + } + }, { + xtype: 'button', + width: 115, + text: Zi.LAN.ShowVerificationDetail, + iconCls: "btnrefresh", + handler: function (button, event) { + + if (_this.paneldetailacc2.isVisible()) + _this.paneldetailacc2.hide(); + else { + _this.paneldetailacc2.show(); + var billno = _this.formEdit.getForm().findField('BILLNO').getValue(); + _this.storeBodyListAcc2.load({ params: { condition: " BILLNO='" + billno + "'"} }); + + } + }, + scope: this + } + ]//end items(fieldset 1) + }//end fieldset 1 + ]//end root items + }] + }); + + + this.comboxCurrAHSR = Ext.create('DsExt.ux.RefTableCombox', { + fieldLabel: Zi.LAN.Currency, + store: this.StoreCurr, + forceSelection: true, + name: 'AHSR_CURRENCY', + valueField: 'CURR', + displayField: 'CURR' + }); + + this.formAHSR = Ext.widget('form', { + anchor: '20% 100%', + columnWidth: .20, + frame: true, + bodyPadding: 5, + title: "=" + Zi.LAN.ShiShouZhiReport, + trackResetOnLoad: true, + fieldDefaults: { + margins: '2 2 2 2', + labelAlign: 'right', + flex: 1, + labelWidth: 40, + msgTarget: 'qtip' + }, + + items: [ + {//fieldset 1 + xtype: 'fieldset', + defaultType: 'textfield', + layout: 'anchor', + defaults: { + anchor: '100%' + }, + items: [{ + xtype: 'container', + layout: 'hbox', + defaultType: 'textfield', + items: [this.comboxCurrAHSR + ]//end items(fieldset 1) + }, { + xtype: 'container', + layout: 'hbox', + defaultType: 'textfield', + items: [{ + fieldLabel: Zi.LAN.ExchangeRate, + name: 'AHSR_RATE' + } + ]//end items(fieldset 1) + }, { + xtype: 'container', + layout: 'hbox', + defaultType: 'textfield', + items: [{ + fieldLabel: Zi.LAN.Money, + name: 'AHSR_MONEY', + 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; + } + + , + listeners: { + scope: this, + 'blur': function (textfield, eOpts) { + var curr = this.formFINANCIAL.getForm().findField('FINANCIAL_MONEY'); + var accamount = this.formACCOUNTS.getForm().findField('ACCOUNTS_MONEY').getValue(); + var prepamount = this.formPREPAY.getForm().findField('PREPAY_MONEY').getValue(); + var advanceamount = this.formADVANCE.getForm().findField('ADVANCE_MONEY').getValue(); + + var amount = parseFloat(accamount).add(parseFloat(prepamount)); + amount = parseFloat(amount).add(parseFloat(-advanceamount)); + amount = parseFloat(amount).add(parseFloat(-textfield.value)); + curr.setValue(amount); + } + } + } + ]//end items(fieldset 1) + }//end fieldset 1 + ]//end root items + }] + }); + + this.comboxCurrFINANCIAL = Ext.create('DsExt.ux.RefTableCombox', { + fieldLabel: Zi.LAN.Currency, + store: this.StoreCurr, + forceSelection: true, + name: 'FINANCIAL_CURRENCY', + valueField: 'CURR', + displayField: 'CURR', + enableKeyEvents: true, //激活键盘事件 + listeners: { + scope: this, + 'select': function blur(combo, eOpts) { + if (combo.value == 'RMB' || combo.value == '') { + this.formFINANCIAL.getForm().findField('FINANCIAL_RATE').setValue(1); + } else { + var FFrecords = DsStoreQueryBy(this.StoreDateCurr, 'CURR', combo.value); + if (FFrecords.getCount() > 0) { + var ffdata = FFrecords.getAt(0).data; + var DEFRATE = ffdata.DEFRATE; + this.formFINANCIAL.getForm().findField('FINANCIAL_RATE').setValue(DEFRATE); + } else { + var Duino = this.formEdit.getForm().findField('BILLNO').getValue(); + Ext.Ajax.request({ + waitMsg: '', + url: '/Account/Chfee_settlement/GetDefaulExrate', + params: { + billno: Duino, + curr: combo.value + }, + callback: function (options, success, response) { + if (success) { + var result = Ext.JSON.decode(response.responseText); + if (result.Success != true) { + + } else { + var data = result.Data; + this.formFINANCIAL.getForm().findField('FINANCIAL_RATE').setValue(data); + + } + } else { + + } + }, + scope: this + }); + } + + } + } + } + }); + + this.formFINANCIAL = Ext.widget('form', { + anchor: '20% 100%', + columnWidth: .20, + frame: true, + bodyPadding: 5, + title: "+" + Zi.LAN.FinanceCose, + trackResetOnLoad: true, + fieldDefaults: { + margins: '2 2 2 2', + labelAlign: 'right', + flex: 1, + labelWidth: 40, + msgTarget: 'qtip' + }, + + items: [ + {//fieldset 1 + xtype: 'fieldset', + defaultType: 'textfield', + layout: 'anchor', + defaults: { + anchor: '100%' + }, + items: [{ + xtype: 'container', + layout: 'hbox', + defaultType: 'textfield', + items: [this.comboxCurrFINANCIAL] + }, { + xtype: 'container', + layout: 'hbox', + defaultType: 'textfield', + items: [{ + fieldLabel: Zi.LAN.ExchangeRate, +// readOnly: true, + name: 'FINANCIAL_RATE' + } + ]//end items(fieldset 1) + }, { + xtype: 'container', + layout: 'hbox', + defaultType: 'textfield', + items: [{ + fieldLabel: Zi.LAN.Money, + name: 'FINANCIAL_MONEY', + 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; + }, + listeners: { + scope: this, + 'blur': function (textfield, eOpts) { + var curr = this.formAHSR.getForm().findField('AHSR_MONEY'); + var accamount = this.formACCOUNTS.getForm().findField('ACCOUNTS_MONEY').getValue(); + var prepamount = this.formPREPAY.getForm().findField('PREPAY_MONEY').getValue(); + var advanceamount = this.formADVANCE.getForm().findField('ADVANCE_MONEY').getValue(); + + var amount = parseFloat(accamount).add(parseFloat(prepamount)); + amount = parseFloat(amount).add(parseFloat(-advanceamount)); + amount = parseFloat(amount).add(parseFloat(-textfield.value)); + curr.setValue(amount); + } + } + } + ]//end items(fieldset 1) + }//end fieldset 1 + ]//end root items + }] + }); + + + this.comboxCurrADVANCE = Ext.create('DsExt.ux.RefTableCombox', { + fieldLabel: Zi.LAN.Currency, + store: this.StoreCurr, + forceSelection: true, + name: 'ADVANCE_CURRENCY', + valueField: 'CURR', + displayField: 'CURR' + }); + + _this = this; + this.formADVANCE = Ext.widget('form', { + anchor: '20% 100%', + columnWidth: .20, + frame: true, + bodyPadding: 5, + title: "+" + Zi.LAN.YuShouZhiQuReport, + trackResetOnLoad: true, + fieldDefaults: { + margins: '2 2 2 2', + labelAlign: 'right', + flex: 1, + labelWidth: 40, + msgTarget: 'qtip' + }, + + items: [ + {//fieldset 1 + xtype: 'fieldset', + defaultType: 'textfield', + layout: 'anchor', + defaults: { + anchor: '100%' + }, + items: [{ + xtype: 'container', + layout: 'hbox', + defaultType: 'textfield', + items: [this.comboxCurrADVANCE + ]//end items(fieldset 1) + }, { + xtype: 'container', + layout: 'hbox', + defaultType: 'textfield', + items: [{ + fieldLabel: Zi.LAN.ExchangeRate, + name: 'ADVANCE_RATE' + } + ]//end items(fieldset 1) + }, { + xtype: 'container', + layout: 'hbox', + defaultType: 'textfield', + items: [{ + fieldLabel: Zi.LAN.Money, + readOnly: true, + name: 'ADVANCE_MONEY', + 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; + } + }, { + xtype: 'button', + width: 90, + text: Zi.LAN.Btn_UseOrCancel, + iconCls: "btnrefresh", + handler: function (button, event) { + var Duino = _this.formEdit.getForm().findField('BILLNO').getValue(); + if (Duino == '*') { + Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.SaveDillFirst, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + return; + }; + if (_this.panelaccdetail.isVisible()) + _this.panelaccdetail.hide(); + else { + _this.panelaccdetail.show(); + var custome = _this.formEdit.getForm().findField('CUSTOMERNAME').getValue(); + var billno = _this.formEdit.getForm().findField('BILLNO').getValue(); + var curr = _this.formADVANCE.getForm().findField('ADVANCE_CURRENCY').getValue(); + + var sql = "CUSTOMERNAME='" + custome + "' and (ISFINISH=0 or ISFINISH IS NULL) AND FEETYPE=1 AND currency='" + curr + "' AND BILLNO<>'" + billno + "' AND (ap.amount<>ap.doamount) "; + + _this.storeAccBodyList.load({ params: { start: 0, limit: _this.PageSize, sort: '', condition: sql} }); + + _this.storeBodyListAcc.load({ params: { condition: " SETTLEBILLNO='" + billno + "'" }, + callback: function (r, options, success) { + if (success) { + if (_this.storeBodyListAcc.getCount() > 0) (this.comboxCurrADVANCE.readOnly = true) + } + }, + scope: this + }); + } + }, + scope: this + } + ]//end items(fieldset 1) + }//end fieldset 1 + ]//end root items + }] + }); + + + + + + //#endregion + + this.panelAcc = new Ext.Panel({ + layout: "column", + region: "north", + height: 140, + items: [this.formACCOUNTS, this.formPREPAY, this.formAHSR, this.formFINANCIAL, this.formADVANCE] + }); + + //#region 预付取用 + + + + + this.storePaymentList = Ext.create('Ext.data.Store', { + model: 'CWAdvancePaymentmb', + remoteSort: true, + proxy: { + type: 'ajax', + url: '/Account/Chfee_settlement/GetAdvancePayment', + reader: { + id: 'BILLNO', + root: 'data', + totalProperty: 'totalCount' + } + } + }); + + + this.GridAccCheckBoxModel = Ext.create('Ext.selection.CheckboxModel'); + //明细表-数据集 + this.storeAccBodyList = Ext.create('Ext.data.Store', { + model: 'CWAdvancePaymentmb', + remoteSort: true, + proxy: { + type: 'ajax', + url: '/Account/Chfee_settlement/GetAdvancePayment', + reader: { + id: 'BILLNO', + root: 'data', + totalProperty: 'totalCount' + } + } + }); + + //明细表表格 + this.gridListAccCellEditing = Ext.create('Ext.grid.plugin.CellEditing', { + clicksToEdit: 1 + }); + + + + this.gridListAcc = new Ext.grid.GridPanel({ + store: this.storeAccBodyList, + enableHdMenu: false, + region: 'center', + loadMask: { msg: Zi.LAN.LoadData }, + trackMouseOver: true, + disableSelection: false, + plugins: [this.gridListAccCellEditing], + selModel: this.GridAccCheckBoxModel, + tbar: [{ + text: Zi.LAN.AddUseDetail, + tooltip: Zi.LAN.AddUseDetail, + iconCls: "btnadddetail", + handler: function (button, event) { + this.onAddAPDetailClick(button, event); + }, + scope: this + }], + columns: [{ + sortable: true, + dataIndex: 'GID', + header: 'GID', + width: 80, hidden: true + }, + { + sortable: true, + dataIndex: 'LINKGID', + header: 'LINKGID', + width: 80, hidden: true + }, + { + sortable: true, + dataIndex: 'BILLNO', + header: Zi.LAN.BillNo, + width: 120 + }, + { + sortable: true, + dataIndex: 'FEETYPEREF', + header: Zi.LAN.FeeTypeRef, + width: 60 + }, + { + sortable: true, + dataIndex: 'CUSTOMERNAME', + header: Zi.LAN.SettlementObject, + width: 100 + }, + { + sortable: true, + dataIndex: 'CURRENCY', + header: Zi.LAN.Currency, + width: 80 + }, + { + sortable: true, + dataIndex: 'AMOUNT', + header: Zi.LAN.Money, + width: 80, + 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: 'DOAMOUNT', + header: Zi.LAN.HasVerificationAmount, + width: 80, + 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: 'REMAIN', + header: Zi.LAN.ThisVerification, + editor: { + xtype: 'numberfield', + keyNavEnabled: false, + allowDecimals: true, + decimalPrecision: 2, + selectOnFocus: true, + mouseWheelEnabled: false, + enableKeyEvents: true + }, + 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; + }, + width: 80 + }, + { + sortable: true, + dataIndex: 'CREATEUSERREF', + header: Zi.LAN.NotIncludederson, + width: 80 + }, + { + sortable: true, + dataIndex: 'CREATETIME', + header: Zi.LAN.notIncludedersonTime, + width: 80 + }, + { + sortable: true, + dataIndex: 'REMARK', + header: Zi.LAN.Remark, + width: 120 + } + ] + }); + + + this.storeBodyListAcc = Ext.create('Ext.data.Store', { + model: 'CWAdvancePaymentBodymb', + remoteSort: true, + proxy: { + type: 'ajax', + url: '/Account/Chfee_settlement/GetAPBodyList', + reader: { + id: 'GID', + root: 'data', + totalProperty: 'totalCount' + } + } + }); + + this.GridBodyAccCheckBoxModel = Ext.create('Ext.selection.CheckboxModel'); + + this.gridBodyListAcc = new Ext.grid.GridPanel({ + store: this.storeBodyListAcc, + enableHdMenu: false, + region: 'center', + //height: 600, + loadMask: { msg: Zi.LAN.LoadData }, + trackMouseOver: true, + disableSelection: false, + selModel: this.GridBodyAccCheckBoxModel, + viewConfig: { + autoFill: true, + enableTextSelection: true + }, + tbar: [{ + text: Zi.LAN.DeleteUseDetail , + tooltip: Zi.LAN.DeleteUseDetail , + iconCls: "btnadddetail", + handler: function (button, event) { + this.onDeleteApClick(button, event); + }, + scope: this + }], + columns: [ + { + sortable: true, + dataIndex: 'GID', + header: 'GID', hidden: true, + width: 80 + }, + { + sortable: true, + dataIndex: 'LINKGID', + header: 'LINKGID', hidden: true, + width: 80 + }, + { + sortable: true, + dataIndex: 'BILLNO', + header: Zi.LAN.BillNo, + width: 120 + }, + { + sortable: true, + dataIndex: 'SETTLELINKGID', + header: 'SETTLELINKGID', hidden: true, + width: 80 + }, + { + sortable: true, + dataIndex: 'SETTLEBILLNO', + header:Zi.LAN.VerificationUseBillNo, + width: 120 + }, + { + sortable: true, + dataIndex: 'FEETYPE', + header: 'FEETYPE', + width: 80 + }, + { + sortable: true, + dataIndex: 'CUSTOMERNAME', + header: Zi.LAN.SettlementObject, hidden: true, + width: 100 + }, + { + sortable: true, + dataIndex: 'CURRENCY', + header: Zi.LAN.Currency, + width: 80 + }, + { + sortable: true, + dataIndex: 'DOAMOUNT', + header: Zi.LAN.VerificationAmount , + width: 80, + 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: 'SETTLEUSERREF', + header: Zi.LAN.VerificationUser, + width: 80 + }, + { + sortable: true, + dataIndex: 'SETTLETIME', + header: Zi.LAN.VerificationTime, + width: 80 + }, + { + sortable: true, + dataIndex: 'REMARK', + header: Zi.LAN.Remark, + width: 80 + }, + { + sortable: true, + dataIndex: 'VOUCHERNO', + header: Zi.LAN.VerificationNo, + width: 80 + } + ] + }); + + + this.storeBodyListAcc2 = Ext.create('Ext.data.Store', { + model: 'CWAdvancePaymentBodymb', + remoteSort: true, + proxy: { + type: 'ajax', + url: '/Account/Chfee_settlement/GetAPBodyList', + reader: { + id: 'GID', + root: 'data', + totalProperty: 'totalCount' + } + } + }); + this.gridBodyListAcc2 = new Ext.grid.GridPanel({ + store: this.storeBodyListAcc2, + enableHdMenu: false, + region: 'center', + //height: 600, + loadMask: { msg: Zi.LAN.LoadData }, + trackMouseOver: true, + disableSelection: false, + selType: 'cellmodel', + viewConfig: { + autoFill: true, + enableTextSelection: true + }, + + columns: [ + { + sortable: true, + dataIndex: 'GID', + header: 'GID', hidden: true, + width: 80 + }, + { + sortable: true, + dataIndex: 'LINKGID', + header: 'LINKGID', hidden: true, + width: 80 + }, + { + sortable: true, + dataIndex: 'BILLNO', + header: Zi.LAN.BillNo, + width: 80 + }, + { + sortable: true, + dataIndex: 'SETTLELINKGID', + header: 'SETTLELINKGID', hidden: true, + width: 80 + }, + { + sortable: true, + dataIndex: 'SETTLEBILLNO', + header:Zi.LAN.VerificationUseBillNo, + width: 80 + }, + { + sortable: true, + dataIndex: 'FEETYPE', + header: 'FEETYPE', + width: 80 + }, + { + sortable: true, + dataIndex: 'CUSTOMERNAME', + header: Zi.LAN.SettlementObject, hidden: true, + width: 80 + }, + { + sortable: true, + dataIndex: 'CURRENCY', + header: Zi.LAN.Currency, + width: 80 + }, + { + sortable: true, + dataIndex: 'DOAMOUNT', + header: Zi.LAN.VerificationAmount , + width: 80, + 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: 'SETTLEUSER', + header: Zi.LAN.VerificationUser, + width: 80 + }, + { + sortable: true, + dataIndex: 'SETTLETIME', + header: Zi.LAN.VerificationTime, + width: 80 + }, + { + sortable: true, + dataIndex: 'REMARK', + header: Zi.LAN.Remark, + width: 80 + }, + { + sortable: true, + dataIndex: 'VOUCHERNO', + header: Zi.LAN.VerificationNo, + width: 80 + } + ] + }); + + + this.paneldetailacc = new Ext.Panel({ + // title: Zi.LAN.SettlementDetail , + layout: "border", + height: 160, + region: "north", + split: true, + items: [ + this.gridBodyListAcc + ] + }); + + this.panelAddacc = new Ext.Panel({ + layout: "border", + height: 160, + region: "north", + margin: '2 2', + items: [this.gridListAcc] + }); + + + this.paneldetailacc2 = new Ext.Panel({ + title: Zi.LAN.VerificationDetail, + layout: "border", + height: 160, + region: "north", + hidden: true, + items: [ + this.gridBodyListAcc2 + ] + }); + + this.panelaccdetail = new Ext.Panel({ + title: Zi.LAN.UseOrCancelPrePaidDetail, + layout: "border", + hidden: true, + height: 360, + region: "north", + split: true, + items: [ + this.paneldetailacc, this.panelAddacc + ] + }); + + //#endregion + + + //#region 布局 + //控件布局 + this.panelTop = new Ext.Panel({ + layout: "border", + region: "north", + height: 130, + items: [this.panelBtn, this.formEdit] + }); + this.panelBody = new Ext.Panel({ + title: Zi.LAN.SettlementDetail, + layout: "border", + region: "center", + items: [this.paneldetail, this.paneladd] + }); + + this.panelAccAll = new Ext.Panel({ + title: Zi.LAN.AdvancePrepaidInformation, + layout: "border", + region: "north", + height: 450, + items: [this.panelAcc, this.panelaccdetail, this.paneldetailacc2] + }); + + this.tabpanel = new Ext.TabPanel + ({ + activeTab: 0, + autoWidth: true, + border: false, + frame: false, + region: 'center', + id: "TabPanelID", + enableTabScroll: true, + items: + [ + this.panelBody, + this.panelAccAll, + this.page_2 + ] + }); + + Ext.apply(this, { + items: [this.panelTop, this.tabpanel] + }); + + //#endregion + + //绑定查询窗体 + this.ParentWin = window.parent.opener; + + //初始化数据 + this.InitData(); + + //绑定事件 + + var billno = '*'; + + if (this.opStatus == 'edit') { + billno = this.editRecord.get('BILLNO'); + + }; + + this.storeBodyList.on('beforeload', function (store) { + var billno = this.editRecord.get('BILLNO'); + Ext.apply(store.proxy.extraParams, { billno: billno }); + }, this); + + this.storeBodyList.on('load', function (store, records) { + if (store.getCount() > 0) { + //this.gridList.getSelectionModel().select(0); + + } else { + + this.storeBodydetail.load({ params: { condition: " f.BILLNO='XX'"} }); + } + }, this); + + + this.gridList.getSelectionModel().on('select', function (model, record, index) { + var billno = this.formEdit.getForm().findField('BILLNO').getValue(); + + var paybillno = record.data.BILLNO; + var sql = ""; + sql = " f.BILLNO='" + billno + "' and f.PAYBILLNO='" + paybillno + "'"; + this.FeeDetailSql = sql; + this.storeBodydetail.load({ params: { condition: sql} }); + }, this); + + + this.storeAddFeeList.on('beforeload', function (store) { + var sql = this.getCondition(); + Ext.apply(store.proxy.extraParams, { condition: this.BillSql }); + }, this); + + this.storeBodydetail.on('beforeload', function (store) { + var sql = this.FeeDetailSql; + if (sql == '') sql = ' 1=2 '; + Ext.apply(store.proxy.extraParams, { condition: sql }); + }, this); + + + + this.storeAddFeeList.on('load', function (store, records) { + if (store.getCount() > 0) { + //this.gridAddFeeList.getSelectionModel().select(0); + } else { + + this.storeAddBodydetail.load({ params: { condition: " BILLNO='XX'"} }); + } + }, this); + + + this.gridAddFeeList.getSelectionModel().on('select', function (model, record, index) { + + var bsno = record.data.BILLNO; + var sql = ""; + sql = " BILLNO='" + bsno + "'"; + this.storeAddBodydetail.load({ params: { condition: sql} }); + }, 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 + //#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 + }); + }, //end initUIComponents + + InitData: function () { + this.opStatus = 'add'; + var condition = ''; + if (this.ParentWin) { + var ret = this.ParentWin.OprationSwap(); + this.opStatus = ret[0]; + this.StoreList = ret[1]; + this.editRecord = ret[2]; + if (this.ParentWin.panelIndex.MsPeriod != NaN && this.ParentWin.panelIndex.MsPeriod != null) + this.MsPeriod = this.ParentWin.panelIndex.MsPeriod; + } + + if (this.opStatus == 'edit') + condition = " BILLNO='" + this.editRecord.get('BILLNO') + "'"; + if (this.opStatus == 'edit') { + document.title = "收费结算" + this.editRecord.get('BILLNO').toString().trim(); + } + else { + document.title = "收费结算-新增"; + } + this.LoadData(this.opStatus, condition); + this.LoadMustBe(); + + }, //end InitData + + LoadData: function (opstatus, condition) { + this.serialNo = 0; + this.workSerialNo = 0; + this.bodyDel = []; + + this.opStatus = opstatus; + var billno = '*'; + + if (this.opStatus == 'edit') { + billno = this.editRecord.get('BILLNO'); + + }; + _this = this; + Ext.Ajax.request({ + waitMsg: Zi.LAN.OnSelect , + url: '/Account/Chfee_settlement/GetData', + params: { + handle: opstatus, + condition: condition + }, + callback: function (options, success, response) { + if (success) { + var result = Ext.JSON.decode(response.responseText); + if (!result.Success) { + Ext.Msg.show({ + title: Zi.LAN.TiShi, + msg: result.Message, + icon: Ext.MessageBox.ERROR, + buttons: Ext.Msg.OK + }); + return; + } + + var data = result.data; + _this.formEdit.getForm().findField('BILLSTATUS').setDisabled(false); + _this.formEdit.getForm().reset(); + _this.formACCOUNTS.getForm().reset(); + _this.formPREPAY.getForm().reset(); + _this.formAHSR.getForm().reset(); + _this.formFINANCIAL.getForm().reset(); + _this.formADVANCE.getForm().reset(); + _this.formEdit.getForm().setValues(data); + _this.formACCOUNTS.getForm().setValues(data); + _this.formPREPAY.getForm().setValues(data); + _this.formAHSR.getForm().setValues(data); + _this.formFINANCIAL.getForm().setValues(data); + _this.formADVANCE.getForm().setValues(data); + + _this.formEdit.getForm().findField('BILLSTATUS').setDisabled(true); + _this.GetEditStatus(); + _this.LoadPeriod(this.opStatus); + this.StoreBANK.load({ + params: { condition: "" }, + callback: function (r, options, success) { + if (success) { + this.formEdit.getForm().findField('ACCOUNT').setValue(data.ACCOUNT); + } + }, + scope: this + }); + _this.storeChfeeFile.load({ params: { start: 0, limit: 9999, BillNo: data.BILLNO } }); + if (_this.opStatus == 'add') { + _this.formEdit.getForm().findField('CURR').setValue(''); + } + _this.storeBodyList.load({ params: { billno: billno }, + callback: function (r, options, success) { + if (success) { + if (_this.storeBodyList.getCount() > 0) { + _this.comboxCurr.setReadOnly(true); + _this.comboxCustCode.setReadOnly(true); + } + else { + _this.comboxCurr.setReadOnly(false); + _this.comboxCustCode.setReadOnly(false); + } + } + }, + scope: this + }); + } else { + Ext.MessageBox.alert(Zi.LAN.Error, response.responseText); + } + }, + scope: this + }); + + + + + + + + this.onRefreshClick(); + + // this.storeBodySum.load({ params: { condition: " BILLNO='" + billno + "'"} }); + + // this.storePaymentList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: "BILLNO='" + billno + "'" }, + // callback: function (r, options, success) { + // if (success) { + // if (this.storePaymentList.getCount() > 0) { + + // var member = this.storePaymentList.getAt(0); + // if (member.data.ISVOU) { + + // this.formACCOUNTS.getForm().findField('ACCOUNTS_MONEY').readOnly = true; + // this.formPREPAY.getForm().findField('PREPAY_MONEY').readOnly = true; + // } + // } + // } + // }, + // scope: this + // }); + + + }, // end LoadDate + LoadPeriod: function (opstatus) { + 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; + this.LoadPeriodStatus(opstatus); + + } else { + Ext.MessageBox.alert(Zi.LAN.Error, response.responseText); + } + }, + scope: this + }); + }, + LoadPeriodStatus: function (opstatus) { + var SETTLETIME = this.formEdit.getForm().findField('SETTLETIME').getRawValue(); + if (SETTLETIME == '') { + this.formEdit.getForm().findField('SETTLETIME').setMinValue(this.MsPeriod.FDAY); + this.formEdit.getForm().findField('SETTLETIME').setReadOnly(false); + } else { + var oDate1 = new Date(Ext.util.Format.date(SETTLETIME, 'Y-m-d')); + var oDate2 = new Date(this.MsPeriod.FDAY); + if (oDate1.getTime() >= oDate2.getTime()) { + this.formEdit.getForm().findField('SETTLETIME').setMinValue(this.MsPeriod.FDAY); + this.formEdit.getForm().findField('SETTLETIME').setReadOnly(false); + } else { + if (opstatus == 'add' || opstatus == 'copyadd') { + this.formEdit.getForm().findField('SETTLETIME').setMinValue(this.MsPeriod.FDAY); + this.formEdit.getForm().findField('SETTLETIME').setReadOnly(false); + } + else { + this.formEdit.getForm().findField('SETTLETIME').setMinValue(''); + this.formEdit.getForm().findField('SETTLETIME').setReadOnly(true); + this.setSaveBtnStatus(false); + } + } + } + }, + + Save: function (type) { + var basicForm = this.formEdit.getForm(); + + if (!basicForm.isValid()) { + return; + } + + + + + this.formEdit.getForm().findField('BILLSTATUS').setDisabled(false); + this.formEdit.getForm().findField('SETTLEUSER').setDisabled(false); + this.formEdit.getForm().findField('COMPANYID').setDisabled(false); + this.formEdit.getForm().findField('SETTLEMODE').setDisabled(false); + this.formEdit.getForm().findField('BILLTYPE').setDisabled(false); + var field = this.formEdit.getForm().findField('SETTLEMODE'); + field.setValue(1); + var field = this.formEdit.getForm().findField('BILLTYPE'); + field.setValue(1); + + var data = basicForm.getValues(); + var accountsdata = this.formACCOUNTS.getForm().getValues(); + var prepaydata = this.formPREPAY.getForm().getValues(); + var prepaychange = this.formPREPAY.getForm().findField('PREPAY_MONEY').isDirty(); + + var ahsrdata = this.formAHSR.getForm().getValues(); + var financialdata = this.formFINANCIAL.getForm().getValues(); + var advancedata = this.formADVANCE.getForm().getValues(); + this.formEdit.getForm().findField('BILLSTATUS').setDisabled(true); + this.formEdit.getForm().findField('SETTLEUSER').setDisabled(true); + this.formEdit.getForm().findField('COMPANYID').setDisabled(true); + this.formEdit.getForm().findField('SETTLEMODE').setDisabled(true); + this.formEdit.getForm().findField('BILLTYPE').setDisabled(true); + + Ext.Msg.wait(Zi.LAN.Msg_SavingAndWait); + Ext.Ajax.request({ + waitMsg: Zi.LAN.Msg_Saving, + url: '/Account/Chfee_settlement/Save', + scope: this, + params: { + opstatus: this.opStatus, + data: Ext.JSON.encode(data), + accountsdata: Ext.JSON.encode(accountsdata), + prepaydata: Ext.JSON.encode(prepaydata), + ahsrdata: Ext.JSON.encode(ahsrdata), + financialdata: Ext.JSON.encode(financialdata), + advancedata: Ext.JSON.encode(advancedata), + billtype: 1, + prepaychange: prepaychange + }, + callback: function (options, success, response) { + if (success) { + Ext.MessageBox.hide(); + var jsonresult = Ext.JSON.decode(response.responseText); + if (jsonresult.Success) { + var returnData = jsonresult.Data; + this.formEdit.getForm().setValues(returnData); + + if (this.opStatus == 'add') { + var arrNewRecords = this.StoreList.insert(0, returnData); + this.editRecord = this.StoreList.getAt(0); + } + else if (this.opStatus == 'edit') { + var editp = Ext.create('MsChSettlement', returnData); + + this.editRecord.fields.each(function (field) { + if (field.persist) { + name = field.name; + if (name != 'id') + this.editRecord.set(name, editp.get(name)); + } + }, this); + this.editRecord.commit(); + } + if (type == '0') { + this.opStatus = 'edit'; + this.LoadPeriodStatus(_this.opStatus); + + + + } else if (type == '1') { + window.close(); + } else { + this.LoadData('add', ''); + + } + } 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 + }); + } + } + }); + }, //end save + + onAddDetailClick: function (button, event, curr) { + this.addstore = true; + this.addDetail(curr); + }, //end onAddDetailClick + + onDelDetailClick: function (button, event, type) { + this.deleteDetail(); + }, //onDelDetailClick + + onAddClick: function (button, event) { + this.addstore = true; + this.addBill(); + }, //end onAddDetailClick + + onDeleteClick: function (button, event) { + this.deleteBill(); + }, //end onAddDetailClick + + + gridAddFeeListAfterEdit: function (editor, e, eOpts) { + //需要自己实现里面的事件 + if (e.value == e.originalValue) return; + if (e.field == 'STLAMOUNT') { + var BalAmount = e.record.data['BALAMOUNT']; + var StlAmount = e.record.data['STLAMOUNT']; + if (BalAmount >= 0) { + if (StlAmount > BalAmount) { + e.record.set('STLAMOUNT', BalAmount); + Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.SettlementAmountTooLarge, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + } + + } else { + if (StlAmount < BalAmount) { + e.record.set('STLAMOUNT', BalAmount); + Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.SettlementAmountTooLarge, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + } + + } + + } else if (e.field == 'USDSTLAMOUNT') { + var BalAmount = e.record.data['USDBALAMOUNT']; + var StlAmount = e.record.data['USDSTLAMOUNT']; + if (BalAmount >= 0) { + if (StlAmount > BalAmount) { + e.record.set('USDSTLAMOUNT', BalAmount); + Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.SettlementAmountTooLarge, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + } + + } else { + if (StlAmount < BalAmount) { + e.record.set('USDSTLAMOUNT', BalAmount); + Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.SettlementAmountTooLarge, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + } + + } + + } + + }, + + onNextKeyClick: function (col) { + + var rows = this.gridAddFeeList.getSelectionModel().getSelection(); + var row = rows[rows.length - 1]; + var s = this.gridAddFeeList.getStore(); + var number = s.indexOf(row) + 1; + this.cellEditingFee.startEditByPosition({ row: number, column: col }); + }, + + onUpKeyClick: function (col) { + + var rows = this.gridAddFeeList.getSelectionModel().getSelection(); + var row = rows[rows.length - 1]; + var s = this.gridAddFeeList.getStore(); + var number = s.indexOf(row) - 1; + if (number < 0) number = 0; + this.cellEditingFee.startEditByPosition({ row: number, column: col }); + }, + + + addDetail: function (addcurr) { + var basicForm = this.formEdit.getForm(); + var Duino = this.formEdit.getForm().findField('BILLNO').getValue(); + _this = this; + if ((Duino == '*') || basicForm.isDirty()) { + + var CUSTOMERNAME = this.formEdit.getForm().findField('CUSTOMERNAME').getValue(); + var CURR = this.formEdit.getForm().findField('CURR').getValue(); + if (addcurr == '') { + if ((CURR == '') || (CURR == null)) { + this.formEdit.getForm().findField('CURR').setValue('RMB'); + this.formEdit.getForm().findField('RATE').setValue(1); + } + } else { + if ((CURR == '') || (CURR == null)) { + this.formEdit.getForm().findField('CURR').setValue(addcurr); + var FFrecords = DsStoreQueryBy(this.StoreDateCurr, 'CURR', addcurr); + if (FFrecords.getCount() > 0) { + var ffdata = FFrecords.getAt(0).data; + var DEFRATE = ffdata.DEFRATE; + this.formEdit.getForm().findField('RATE').setValue(DEFRATE); + } else { + var DFrecords = DsStoreQueryBy(this.StoreCurr, 'CURR', addcurr); + if (DFrecords.getCount() > 0) { + var dfdata = DFrecords.getAt(0).data; + var DEFRATE = dfdata.DEFRATE; + this.formEdit.getForm().findField('RATE').setValue(DEFRATE); + } else { + this.formEdit.getForm().findField('RATE').setValue(1); + } + } + } + } + //if ((CUSTOMERNAME == '') || (CUSTOMERNAME == null) || (CURR == '') || (CURR == null)) { + var selectedRecords = this.gridAddFeeList.selModel.getSelection(); + if (selectedRecords.length > 0) { + var rec = selectedRecords[0]; + var cust = rec.data.CUSTOMERNAME; + var addcurr2 = rec.data.CURR; + if ((CUSTOMERNAME == '') || (CUSTOMERNAME == null)) + this.formEdit.getForm().findField('CUSTOMERNAME').setValue(cust); + if ((CURR == '') || (CURR == null)) { + if (addcurr2 != '') + this.formEdit.getForm().findField('CURR').setValue(addcurr2); + else { + if (rec.data.BALAMOUNT != 0) this.formEdit.getForm().findField('CURR').setValue('RMB'); + else if (rec.data.USDBALAMOUNT != 0) this.formEdit.getForm().findField('CURR').setValue('USD'); + } + } + this.formEdit.getForm().findField('SETTLETYPE').setValue(rec.data.SETTLETYPE); + } + + //} + + if (!basicForm.isValid()) { + return; + } + var type = 0; + + this.GetBank(); + + this.formEdit.getForm().findField('BILLSTATUS').setDisabled(false); + this.formEdit.getForm().findField('SETTLEUSER').setDisabled(false); + this.formEdit.getForm().findField('COMPANYID').setDisabled(false); + this.formEdit.getForm().findField('SETTLEMODE').setDisabled(false); + this.formEdit.getForm().findField('BILLTYPE').setDisabled(false); + var field = this.formEdit.getForm().findField('SETTLEMODE'); + field.setValue(1); + var field = this.formEdit.getForm().findField('BILLTYPE'); + field.setValue(1); + + var data = basicForm.getValues(); + var accountsdata = this.formACCOUNTS.getForm().getValues(); + var prepaydata = this.formPREPAY.getForm().getValues(); + var prepaychange = this.formPREPAY.getForm().findField('PREPAY_MONEY').isDirty(); + + var ahsrdata = this.formAHSR.getForm().getValues(); + var financialdata = this.formFINANCIAL.getForm().getValues(); + var advancedata = this.formADVANCE.getForm().getValues(); + this.formEdit.getForm().findField('BILLSTATUS').setDisabled(true); + this.formEdit.getForm().findField('SETTLEUSER').setDisabled(true); + this.formEdit.getForm().findField('COMPANYID').setDisabled(true); + this.formEdit.getForm().findField('SETTLEMODE').setDisabled(true); + this.formEdit.getForm().findField('BILLTYPE').setDisabled(true); + + Ext.Msg.wait(Zi.LAN.Msg_SavingAndWait); + Ext.Ajax.request({ + waitMsg: Zi.LAN.Msg_Saving, + url: '/Account/Chfee_settlement/Save', + scope: this, + params: { + opstatus: this.opStatus, + data: Ext.JSON.encode(data), + accountsdata: Ext.JSON.encode(accountsdata), + prepaydata: Ext.JSON.encode(prepaydata), + ahsrdata: Ext.JSON.encode(ahsrdata), + financialdata: Ext.JSON.encode(financialdata), + advancedata: Ext.JSON.encode(advancedata), + billtype: 1, + prepaychange: prepaychange + }, + callback: function (options, success, response) { + if (success) { + Ext.MessageBox.hide(); + var jsonresult = Ext.JSON.decode(response.responseText); + if (jsonresult.Success) { + var returnData = jsonresult.Data; + this.formEdit.getForm().setValues(returnData); + + if (this.opStatus == 'add') { + var arrNewRecords = this.StoreList.insert(0, returnData); + this.editRecord = this.StoreList.getAt(0); + } + else if (this.opStatus == 'edit') { + var editp = Ext.create('MsChSettlement', returnData); + + this.editRecord.fields.each(function (field) { + if (field.persist) { + name = field.name; + if (name != 'id') + this.editRecord.set(name, editp.get(name)); + } + }, this); + this.editRecord.commit(); + } + + this.opStatus = 'edit'; + _this.addDetailfn(addcurr); + + + } 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 + }); + } + } + }); + } else { + this.addDetailfn(addcurr); + } + }, //end save + + + addDetailfn: function (addcurr) { + + if (this.addstore) { + this.storeCurrExrate.removeAll(); + this.addstore = false; + } + + + + var Duino = this.formEdit.getForm().findField('BILLNO').getValue(); + + var billstatus = this.formEdit.getForm().findField('BILLSTATUS').getValue(); + + if (billstatus != 2) { + + Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.CannotAddApplyDetailOfStatus, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + return; + + } + + var basicForm = this.formEdit.getForm(); + + + + var billcust = this.editRecord.data.CUSTOMERNAME; + var billno = this.editRecord.data.BILLNO; + var billcurr = this.editRecord.data.CURR; + + var selectedRecords = this.gridAddFeeList.selModel.getSelection(); + + var bodyAddDatas = []; + _this = this; + for (var i = 0; i < selectedRecords.length; i++) { + var rec = selectedRecords[i]; + var cust = rec.data.CUSTOMERNAME; + var bsno = rec.data.BILLNO; + var curr = rec.data.CURR; + if (cust == billcust) { + bodyAddDatas.push(rec); + + } else { + + // Ext.Msg.show({ title: Zi.LAN.TiShi, msg: '费用对象与收费申请客户不一致,不能添加此申请!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + alert(Zi.LAN.FyduixiangDifSFJSCust); + + } + } + + + + if (bodyAddDatas.length == 0) { + Ext.Msg.show({ title: Zi.LAN.TiShi, msg:Zi.LAN.NoFeeDetai2Add, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + return; + }; + + var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas); + + var bodydatas = []; + for (var i = 0; i < this.storeCurrExrate.getCount(); i += 1) { + var member = this.storeCurrExrate.getAt(i); + if (member.data.EXRATE == 0) { + _this.ExrateConversion(member.CURR, billcurr, 'bill', addcurr); + return; + } + bodydatas.push(member); + } + + var currBody = ConvertRecordsToJsonAll(bodydatas); + + + Ext.Ajax.request({ + waitMsg: Zi.LAN.Msg_Adding, + url: '/Account/Chfee_settlement/AddRecvAppDCDetail', + params: { + bill: billno, + data: jsonbodyAddDatas, + curr: billcurr, + billtype: 1, + addcurr: addcurr, + storeCurrExrate: currBody + }, + 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 { + dataList = result.Data; + + if (dataList == null) { + + var sql = this.BillSql; + + this.storeAddFeeList.load({ params: { start: 0, limit: _this.PageSize, sort: '', condition: sql} }); + this.storeBodyList.load({ params: { billno: billno }, + callback: function (r, options, success) { + if (success) { + if (_this.storeBodyList.getCount() > 0) { + _this.comboxCurr.setReadOnly(true); + _this.comboxCustCode.setReadOnly(true); + } + else { + _this.comboxCurr.setReadOnly(false); + _this.comboxCustCode.setReadOnly(false); + } + + } + }, + scope: this + }); + + + Ext.Ajax.request({ + waitMsg: Zi.LAN.OnSelect , + url: '/Account/Chfee_settlement/GetData', + params: { + handle: 'edit', + condition: " BILLNO='" + billno + "'" + }, + 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; + } + + var data = result.data; + _this.formEdit.getForm().reset(); + _this.formACCOUNTS.getForm().reset(); + _this.formPREPAY.getForm().reset(); + _this.formAHSR.getForm().reset(); + _this.formFINANCIAL.getForm().reset(); + _this.formADVANCE.getForm().reset(); + _this.formEdit.getForm().setValues(data); + _this.formACCOUNTS.getForm().setValues(data); + _this.formPREPAY.getForm().setValues(data); + _this.formAHSR.getForm().setValues(data); + _this.formFINANCIAL.getForm().setValues(data); + _this.formADVANCE.getForm().setValues(data); + var editp = Ext.create('MsChSettlement', data); + + this.editRecord.fields.each(function (field) { + if (field.persist) { + name = field.name; + if (name != 'id') + this.editRecord.set(name, editp.get(name)); + } + }, this); + this.editRecord.commit(); + + } else { + Ext.MessageBox.alert(Zi.LAN.Error, response.responseText); + } + }, + scope: this + }); + } else { + if (dataList.lenght != 0) { + for (var i = 0; i < dataList.length; i++) { + var record = dataList[i]; + _this.storeCurrExrate.add(record); + } + _this.ExrateConversion(record.CURR, billcurr, 'detail', addcurr); + return; + } + + } + + } + + } else { + Ext.MessageBox.alert(Zi.LAN.Error, response.responseText); + } + }, + scope: this + }); + + + }, + + + deleteBill: function (type) { + + var btnEDeleteDetail = Ext.getCmp('btndeldetail'); + btnEDeleteDetail.disable(); + + var billno = this.formEdit.getForm().findField('BILLNO').getValue(); + var selectedRecords = this.gridList.selModel.getSelection(); + + if (selectedRecords.length == 0) { + Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.NoApplyDetailNeedDel, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + btnEDeleteDetail.enable(); + return; + }; + + var billstatus = this.formEdit.getForm().findField('BILLSTATUS').getValue(); + + if (billstatus != 2) { + + Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.CanotDelApplyMX4Status, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + btnEDeleteDetail.enable(); + return; + + } + + + + + var bodyAddDatas = []; + for (var i = 0; i < selectedRecords.length; i++) { + var rec = selectedRecords[i]; + bodyAddDatas.push(rec); + } + + var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas); + + var sql = this.BillSql; + + Ext.Ajax.request({ + waitMsg:Zi.LAN.Msg_Deleting, + url: '/Account/Chfee_settlement/DelRecvAppBill', + params: { + data: jsonbodyAddDatas, + billno: billno, + billtype: 1 + }, + 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 + }); + btnEDeleteDetail.enable(); + return; + } else { + + var sql = this.BillSql; + this.storeAddFeeList.load({ params: { start: 0, limit: _this.PageSize, sort: '', condition: sql} }); + this.storeBodyList.load({ params: { billno: billno }, + callback: function (r, options, success) { + if (success) { + if (_this.storeBodyList.getCount() > 0) { + _this.comboxCurr.setReadOnly(true); + _this.comboxCustCode.setReadOnly(true); + } + else { + _this.comboxCurr.setReadOnly(false); + _this.comboxCustCode.setReadOnly(false); + } + + } + }, + scope: this + }); + + btnEDeleteDetail.enable(); + Ext.Ajax.request({ + waitMsg: Zi.LAN.OnSelect , + url: '/Account/Chfee_settlement/GetData', + params: { + handle: 'edit', + condition: " BILLNO='" + billno + "'" + }, + 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; + } + + var data = result.data; + _this.formEdit.getForm().reset(); + _this.formACCOUNTS.getForm().reset(); + _this.formPREPAY.getForm().reset(); + _this.formAHSR.getForm().reset(); + _this.formFINANCIAL.getForm().reset(); + _this.formADVANCE.getForm().reset(); + _this.formEdit.getForm().setValues(data); + _this.formACCOUNTS.getForm().setValues(data); + _this.formPREPAY.getForm().setValues(data); + _this.formAHSR.getForm().setValues(data); + _this.formFINANCIAL.getForm().setValues(data); + _this.formADVANCE.getForm().setValues(data); + var editp = Ext.create('MsChSettlement', data); + + this.editRecord.fields.each(function (field) { + if (field.persist) { + name = field.name; + if (name != 'id') + this.editRecord.set(name, editp.get(name)); + } + }, this); + this.editRecord.commit(); + + } else { + Ext.MessageBox.alert(Zi.LAN.Error, response.responseText); + } + }, + scope: this + }); + + } + + } else { + btnEDeleteDetail.enable(); + Ext.MessageBox.alert(Zi.LAN.Error, response.responseText); + } + }, + scope: this + }); + + }, + + //#region 预收付操作 + onAddAPDetailClick: function (button, event) { + + var gid = this.formEdit.getForm().findField('GID').getValue(); + var billno = this.formEdit.getForm().findField('BILLNO').getValue(); + + var billstatus = this.formEdit.getForm().findField('BILLSTATUS').getValue(); + + if (billstatus != 2) { + + Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.CannotAddDetailOfStatus, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + return; + + } + + + // var basicForm = this.formEdit.getForm(); + // var basicForm1 = this.formACCOUNTS.getForm(); + // var basicForm2 = this.formPREPAY.getForm(); + // var basicForm3 = this.formAHSR.getForm(); + // var basicForm4 = this.formFINANCIAL.getForm(); + // var basicForm5 = this.formADVANCE.getForm(); + + + // if (basicForm.isDirty() || basicForm1.isDirty() + // || basicForm2.isDirty() || basicForm3.isDirty() || basicForm4.isDirty() || basicForm5.isDirty()) { + // Ext.Msg.show({ title: Zi.LAN.TiShi, msg: '请先保存收费结算单,然后才能添加明细!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + // return; + // }; + + var selectedRecords = this.gridListAcc.selModel.getSelection(); + + var bodyAddDatas = []; + _this = this; + for (var i = 0; i < selectedRecords.length; i++) { + var rec = selectedRecords[i]; + bodyAddDatas.push(rec); + } + + + + if (bodyAddDatas.length == 0) { + Ext.Msg.show({ title: Zi.LAN.TiShi, msg:Zi.LAN.NoFeeDetai2Add, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + return; + }; + + var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas); + + + _this = this; + Ext.Msg.wait(Zi.LAN.Msg_SavingAndWait); + Ext.Ajax.request({ + waitMsg: Zi.LAN.Msg_Saving, + url: '/Account/Chfee_settlement/AddAPDetail', + scope: this, + params: { + billno: billno, + data: jsonbodyAddDatas, + stlnogid: gid, + feetype: 1 + }, + callback: function (options, success, response) { + if (success) { + Ext.MessageBox.hide(); + var jsonresult = Ext.JSON.decode(response.responseText); + if (jsonresult.Success) { + var custome = _this.formEdit.getForm().findField('CUSTOMERNAME').getValue(); + var billno = _this.formEdit.getForm().findField('BILLNO').getValue(); + var curr = _this.formADVANCE.getForm().findField('ADVANCE_CURRENCY').getValue(); + + var sql = "CUSTOMERNAME='" + custome + "' and (ISFINISH=0 or ISFINISH IS NULL) AND FEETYPE=1 AND currency='" + curr + "' AND BILLNO<>'" + billno + "'"; + _this.storeAccBodyList.load({ params: { start: 0, limit: _this.PageSize, sort: '', condition: sql} }); + // _this.storePaymentList.load({ params: { start: 0, limit: _this.PageSize, sort: '', condition: "BILLNO='" + billno + "'"} }); + _this.storeBodyListAcc.load({ params: { condition: " SETTLEBILLNO='" + billno + "'" }, + callback: function (r, options, success) { + if (success) { + if (_this.storeBodyListAcc.getCount() > 0) (this.comboxCurrADVANCE.readOnly = true) + } + }, + scope: this + }); + + Ext.Ajax.request({ + waitMsg: Zi.LAN.OnSelect , + url: '/Account/Chfee_settlement/GetData', + params: { + handle: 'edit', + condition: " BILLNO='" + billno + "'" + }, + 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; + } + + var data = result.data; + _this.formAHSR.getForm().reset(); + _this.formADVANCE.getForm().reset(); + _this.formAHSR.getForm().setValues(data); + _this.formADVANCE.getForm().setValues(data); + var editp = Ext.create('MsChSettlement', data); + + this.editRecord.fields.each(function (field) { + if (field.persist) { + name = field.name; + if (name != 'id') + this.editRecord.set(name, editp.get(name)); + } + }, this); + this.editRecord.commit(); + + } else { + Ext.MessageBox.alert(Zi.LAN.Error, response.responseText); + } + }, + scope: this + }); + + + } 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 + }); + } + } + }); + + + }, + + onDeleteApClick: function (button, event) { + + var billno = this.formEdit.getForm().findField('BILLNO').getValue(); + + var billstatus = this.formEdit.getForm().findField('BILLSTATUS').getValue(); + + if (billstatus != 2) { + + Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.CannotDelDetailOfStatus, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + return; + + } + + var bodyAddDatas = []; + var selectedRecords = this.gridBodyListAcc.selModel.getSelection(); + _this = this; + for (var i = 0; i < selectedRecords.length; i++) { + var rec = selectedRecords[i]; + var voucherno = rec.data.VOUCHERNO; + if (voucherno == '') { + bodyAddDatas.push(rec); + } else { + Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.HasCertificateCanotDel , icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + } + } + + + _this = this; + for (var i = 0; i < selectedRecords.length; i++) { + var rec = selectedRecords[i]; + var voucherno = rec.data.VOUCHERNO; + if (voucherno == '') { + bodyAddDatas.push(rec); + } else { + Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.HasCertificateCanotDel , icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + + } + } + + + + if (bodyAddDatas.length == 0) { + Ext.Msg.show({ title: Zi.LAN.TiShi, msg:Zi.LAN.NoDetai2Del, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + return; + }; + + var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas); + + + _this = this; + Ext.Msg.wait(Zi.LAN.Msg_SavingAndWait); + Ext.Ajax.request({ + waitMsg: Zi.LAN.Msg_Saving, + url: '/Account/Chfee_settlement/DelAPBill', + scope: this, + params: { + data: jsonbodyAddDatas + }, + callback: function (options, success, response) { + if (success) { + Ext.MessageBox.hide(); + var jsonresult = Ext.JSON.decode(response.responseText); + if (jsonresult.Success) { + var custome = _this.formEdit.getForm().findField('CUSTOMERNAME').getValue(); + var billno = _this.formEdit.getForm().findField('BILLNO').getValue(); + var curr = _this.formADVANCE.getForm().findField('ADVANCE_CURRENCY').getValue(); + + var sql = "CUSTOMERNAME='" + custome + "' and (ISFINISH=0 or ISFINISH IS NULL) AND FEETYPE=1 AND currency='" + curr + "' AND BILLNO<>'" + billno + "'"; + _this.storeAccBodyList.load({ params: { start: 0, limit: _this.PageSize, sort: '', condition: sql} }); + // _this.storePaymentList.load({ params: { start: 0, limit: _this.PageSize, sort: '', condition: "BILLNO='" + billno + "'"} }); + _this.storeBodyListAcc.load({ params: { condition: " SETTLEBILLNO='" + billno + "'" }, + callback: function (r, options, success) { + if (success) { + if (_this.storeBodyListAcc.getCount() > 0) (this.comboxCurrADVANCE.readOnly = true) + } + }, + scope: this + }); + + Ext.Ajax.request({ + waitMsg: Zi.LAN.OnSelect , + url: '/Account/Chfee_settlement/GetData', + params: { + handle: 'edit', + condition: " BILLNO='" + billno + "'" + }, + 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; + } + + var data = result.data; + _this.formAHSR.getForm().reset(); + _this.formADVANCE.getForm().reset(); + _this.formAHSR.getForm().setValues(data); + _this.formADVANCE.getForm().setValues(data); + var editp = Ext.create('MsChSettlement', data); + + this.editRecord.fields.each(function (field) { + if (field.persist) { + name = field.name; + if (name != 'id') + this.editRecord.set(name, editp.get(name)); + } + }, this); + this.editRecord.commit(); + + } else { + Ext.MessageBox.alert(Zi.LAN.Error, response.responseText); + } + }, + scope: this + }); + + + } 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 + }); + } + } + }); + + + }, + + //#endregion + + + onSubmitAuditClick: function () { + var Duino = this.formEdit.getForm().findField('BILLNO').getValue(); + + var billstatus = this.formEdit.getForm().findField('BILLSTATUS').getValue(); + var REMARK = this.formEdit.getForm().findField('REMARK').getValue(); + + if (Duino == '*') { + Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.SaveSFJSBeforLock, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + return; + }; + + + if ((billstatus != 2)) { + + Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.CanotLock4CurrStatus, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + return; + + } + + //if (this.storeBodyList.getCount() == 0) { + // Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.NoShouFeeMXLock, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + // return; + //} + + _this = this; + + Ext.Ajax.request({ + waitMsg: Zi.LAN.Msg_Adding, + url: '/Account/Chfee_settlement/Lock', + params: { + bill: Duino, + remark: REMARK + }, + 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.Ajax.request({ + waitMsg: Zi.LAN.OnSelect , + url: '/Account/Chfee_settlement/GetData', + params: { + handle: 'edit', + condition: " BILLNO='" + Duino + "'" + }, + 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; + } + + var data = result.data; + _this.formEdit.getForm().findField('BILLSTATUS').setDisabled(false); + _this.formEdit.getForm().reset(); + _this.formEdit.getForm().setValues(data); + _this.formEdit.getForm().findField('BILLSTATUS').setDisabled(true); + + var editp = Ext.create('MsChSettlement', data); + + this.editRecord.fields.each(function (field) { + if (field.persist) { + name = field.name; + if (name != 'id') + this.editRecord.set(name, editp.get(name)); + } + }, this); + this.editRecord.commit(); + + _this.GetEditStatus(); + + } else { + Ext.MessageBox.alert(Zi.LAN.Error, response.responseText); + } + }, + scope: this + }); + + + } + + } else { + Ext.MessageBox.alert(Zi.LAN.Error, response.responseText); + } + }, + scope: this + }); + + + + }, + + onSubmitAuditBackClick: function () { + var Duino = this.formEdit.getForm().findField('BILLNO').getValue(); + + var billstatus = this.formEdit.getForm().findField('BILLSTATUS').getValue(); + + if (Duino == '*') { + Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.SaveSFJSBeforCancleLock, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + return; + }; + + + if (billstatus != 1) { + + Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.CanotUnlock4CurrStatus, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + return; + + } + + var isvou = this.formEdit.getForm().findField('ISEXPORT').getValue(); + + if (isvou == true) { + Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.CanotUnlock4HasCert, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + return; + } + + var isVOUCHERNO = this.formEdit.getForm().findField('VOUCHERNO').getValue(); + if (isVOUCHERNO != "") { + Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.CanotUnlock4HasVoucher , icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + return; + } + + _this = this; + + Ext.Ajax.request({ + waitMsg: Zi.LAN.Msg_Adding, + url: '/Account/Chfee_settlement/UnLock', + params: { + bill: Duino + }, + callback: function (options, success, response) { + if (success) { + var result = Ext.JSON.decode(response.responseText); + if (!result.Success) { + Ext.Msg.show({ + title: Zi.LAN.TiShi, + msg: result.Message, + icon: Ext.MessageBox.ERROR, + buttons: Ext.Msg.OK + }); + return; + } else { + + Ext.Ajax.request({ + waitMsg: Zi.LAN.OnSelect , + url: '/Account/Chfee_settlement/GetData', + params: { + handle: 'edit', + condition: " BILLNO='" + Duino + "'" + }, + 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; + } + + var data = result.data; + _this.formEdit.getForm().findField('BILLSTATUS').setDisabled(false); + _this.formEdit.getForm().reset(); + _this.formEdit.getForm().setValues(data); + _this.formEdit.getForm().findField('BILLSTATUS').setDisabled(true); + var editp = Ext.create('MsChSettlement', data); + + this.editRecord.fields.each(function (field) { + if (field.persist) { + name = field.name; + if (name != 'id') + this.editRecord.set(name, editp.get(name)); + } + }, this); + this.editRecord.commit(); + + _this.GetEditStatus(); + + + } else { + Ext.MessageBox.alert(Zi.LAN.Error, response.responseText); + } + }, + scope: this + }); + + + } + + } else { + Ext.MessageBox.alert(Zi.LAN.Error, response.responseText); + } + }, + scope: this + }); + + + + }, + + Delete: function () { + var basicForm = this.formEdit.getForm(); + + if (!basicForm.isValid()) { + return; + } + + this.formEdit.getForm().findField('BILLSTATUS').setDisabled(false); + this.formEdit.getForm().findField('SETTLEUSER').setDisabled(false); + this.formEdit.getForm().findField('COMPANYID').setDisabled(false); + this.formEdit.getForm().findField('SETTLEMODE').setDisabled(false); + this.formEdit.getForm().findField('BILLTYPE').setDisabled(false); + + var data = basicForm.getValues(); + this.formEdit.getForm().findField('BILLSTATUS').setDisabled(true); + this.formEdit.getForm().findField('SETTLEUSER').setDisabled(true); + this.formEdit.getForm().findField('COMPANYID').setDisabled(true); + this.formEdit.getForm().findField('SETTLEMODE').setDisabled(true); + this.formEdit.getForm().findField('BILLTYPE').setDisabled(true); + + Ext.Msg.wait(Zi.LAN.Msg_SavingAndWait); + Ext.Ajax.request({ + waitMsg: Zi.LAN.Msg_Saving, + url: '/Account/Chfee_settlement/DeleteRecv', + scope: this, + params: { + data: Ext.JSON.encode(data), + settlemode: 1 + }, + callback: function (options, success, response) { + if (success) { + Ext.MessageBox.hide(); + var jsonresult = Ext.JSON.decode(response.responseText); + if (jsonresult.Success) { + this.LoadData('add', ''); + } 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 + }); + } + } + }); + }, //end save + + onRefreshClick: function (button, event) { + var sql = this.getCondition(); + this.sqlcontext = sql; + this.storeAddFeeList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql} }); + }, + onDsQuery: function (button, event) { + var sql = this.sqlcontext; + this.storeAddFeeList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql } }); + }, + + onClearSql: function () { + var form = this.formSearch.getForm(); + form.reset(); + }, + + + getCondition: function () { + var form = this.formSearch.getForm(); + if (!form.isValid()) { + Ext.Msg.alert(Zi.LAN.TiShi, Zi.LAN.SelectConditionValError); + return ''; + } + + var sql = ''; + + var customNo = form.findField('CustomNo').getValue(); + sql = sql + getAndConSql(sql, customNo, " BILLNO like '%" + customNo + "%'"); + + + var CUSTNAME = form.findField('CUSTNAME').getValue(); + sql = sql + getAndConSql(sql, CUSTNAME, " CUSTOMERNAME='" + CUSTNAME + "'"); + + + var BH = form.findField('BH').getValue(); + sql = sql + getAndConSql(sql, BH, " EXISTS(select 1 from ch_fee_do where BILLNO=cm.BILLNO and EXISTS(select 1 from v_op_bs where bsno=ch_fee_do.BSNO and (CUSTNO like '%" + BH + "%' or MBLNO like '%" + BH + "%' or HBLNO like '%" + BH + "%') ))"); + + + var Currency = form.findField('Currency').getValue(); + sql = sql + getAndConSql(sql, Currency, "CURR='" + Currency + "'"); + + var expDateBgn = form.findField('ExpDateBgn').getRawValue(); + sql = sql + getAndConSql(sql, expDateBgn, "APPLYTIME >='" + expDateBgn + "'"); + + var expDateEnd = form.findField('ExpDateEnd').getRawValue(); + sql = sql + getAndConSql(sql, expDateEnd, "APPLYTIME <='" + expDateEnd + "'"); + + + var DC = form.findField('ISDEBIT').getValue(); + if (DC == '1') + sql = sql + getAndConSql(sql, DC, " (BILLSTATUS=2 OR BILLSTATUS=0 OR BILLSTATUS=5) "); + + + // this.FeeSqlStr = this.getFeeCondition(); + // feesql = feesql + getAndConSql(feesql, this.FeeSqlStr, this.FeeSqlStr); + + // sql = sql + getAndConSql(sql, feesql, feesql); + + this.BillSql = sql; + return sql; + }, + getFeeCondition: function () { + var form = this.formSearch.getForm(); + + var feesql = ''; + + var CUSTNAME = form.findField('CUSTNAME').getValue(); + feesql = feesql + getAndConSql(feesql, CUSTNAME, "f.CUSTOMERNAME='" + CUSTNAME + "'"); + + + var Currency = form.findField('Currency').getValue(); + feesql = feesql + getAndConSql(feesql, Currency, "f.Currency='" + Currency + "'"); + + var FeeName = form.findField('FeeName').getValue(); + feesql = feesql + getAndConSql(feesql, FeeName, "f.FeeName='" + FeeName + "'"); + + return feesql; + }, + + ExrateConversion: function (bfcurr, afcurr, fntype, addcurr) { + + var EXRATE = 0; + var achange = true; + var bchange = true; + + formExrateConversion = 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: '1' + bfcurr + '=', + xtype: 'numberfield', + name: 'bfcurr', + decimalPrecision: 10, + value: 0, + renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { + try { + var lsValue = usMoney(value, 10, '', false); + if (lsValue != "NaN") { + value = lsValue; if (parseFloat(lsValue) < 0) { + return '' + lsValue + ''; + } + } + else { + return value; + } + } + catch (e) { + return value; + } + return value; + }, + listeners: { + change: function () { + if (bchange) { + + var bfcurr = formExrateConversion.getForm().findField('bfcurr').getValue(); + var field = formExrateConversion.getForm().findField('afcurr'); + if (bfcurr == 0) { field.setValue(0); } else { + var taxrate = (parseFloat(1).div(parseFloat(bfcurr))).toFixed(10); + achange = false; + field.setValue(taxrate); + + } + } + achange = true; + + } + } + }, { + xtype: 'label', + width: 120, + text: afcurr, + name: 'bfcurr2' + } + ] + }, { + xtype: 'container', + layout: 'hbox', + defaultType: 'textfield', + items: [{ + fieldLabel: '1' + afcurr + '=', + xtype: 'numberfield', + name: 'afcurr', + decimalPrecision: 10, + value: 0, + renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { + try { + var lsValue = usMoney(value, 10, '', false); + if (lsValue != "NaN") { + value = lsValue; if (parseFloat(lsValue) < 0) { + return '' + lsValue + ''; + } + } + else { + return value; + } + } + catch (e) { + return value; + } + return value; + }, + listeners: { + change: function () { + + if (achange) { + var afcurr = formExrateConversion.getForm().findField('afcurr').getValue(); + var field = formExrateConversion.getForm().findField('bfcurr'); + if (afcurr == 0) { field.setValue(0); } else { + var taxrate = (parseFloat(1).div(parseFloat(afcurr))).toFixed(10); + bchange = false; + field.setValue(taxrate); + } + } + bchange = true; + + } + } + }, { + xtype: 'label', + width: 120, + text: bfcurr, + name: 'afcurr2' + } + ] + } + ]//end items(fieldset 1) + }//end fieldset 1 + ]//end root items + }); + me = this; + winExrateShow = Ext.create('Ext.window.Window', { + title: Zi.LAN.CurrencyRateConvert, + width: 450, + //height : 120, + //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: [formExrateConversion], + buttons: [{ + text: Zi.LAN.OK, + minWidth: 70, + handler: function () { + var form = formExrateConversion.getForm(); + var UsdExrate = form.findField('bfcurr').getValue(); + if (UsdExrate == '' || UsdExrate == null || UsdExrate == undefined) { + Ext.Msg.show({ title: Zi.LAN.TiShi, msg:Zi.LAN.ConvertRateMust , icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + return; + }; + var recs = DsStoreQueryBy(me.storeCurrExrate, 'CURR', bfcurr); + if (recs.getCount() > 0) { + // var dfdata = DFrecords.getAt(0).data; + // dfdata.EXRATE = UsdExrate; + + for (var i = 0; i < me.storeCurrExrate.getCount(); i += 1) { + var member = me.storeCurrExrate.getAt(i); + if (member.data.CURR == bfcurr) { + // member.EXRATE = UsdExrate; + member.set('EXRATE', UsdExrate); + member.commit(); + } + + } + + } else { + me.storeCurrExrate.add({ "CURR": bfcurr, "EXRATE": UsdExrate }) + } + winExrateShow.close(); + if (fntype == 'detail') { + me.addDetail(addcurr); + } + if (fntype == 'bill') { + me.addBill(); + } + return; + } + }, { + text: Zi.LAN.Close, + minWidth: 70, + handler: function () { + winExrateShow.close(); + return; + } + }] + }); + + + if (bfcurr == 'RMB') { + var FFrecords = DsStoreQueryBy(this.StoreDateCurr, 'CURR', afcurr); + if (FFrecords.getCount() > 0) { + var ffdata = FFrecords.getAt(0).data; + var DEFRATE = ffdata.DEFRATE; + + } else { + var DFrecords = DsStoreQueryBy(this.StoreCurr, 'CURR', afcurr); + if (DFrecords.getCount() > 0) { + var dfdata = DFrecords.getAt(0).data; + var DEFRATE = dfdata.DEFRATE; + + } else { + var DEFRATE = 1; + } + } + + + var field = formExrateConversion.getForm().findField('afcurr'); + + achange = true; + field.setValue(DEFRATE); + + } else if (afcurr == 'RMB') { + + var FFrecords = DsStoreQueryBy(this.StoreDateCurr, 'CURR', bfcurr); + if (FFrecords.getCount() > 0) { + var ffdata = FFrecords.getAt(0).data; + var DEFRATE = ffdata.DEFRATE; + + } else { + var recs = DsStoreQueryBy(me.storeCurrExrate, 'CURR', bfcurr); + if (recs.getCount() > 0) { + var dfdata = recs.getAt(0).data; + var DEFRATE = dfdata.DFEXRATE; + } else var DEFRATE = dfexrate; + } + + + var field = formExrateConversion.getForm().findField('bfcurr'); + + achange = true; + field.setValue(DEFRATE); + + + } else { + var field = formExrateConversion.getForm().findField('bfcurr'); + var recs = DsStoreQueryBy(me.storeCurrExrate, 'CURR', bfcurr); + if (recs.getCount() > 0) { + var dfdata = recs.getAt(0).data; + var DEFRATE = dfdata.DFEXRATE; + } else var DEFRATE = dfexrate; + bchange = true; + field.setValue(DEFRATE); + } + + winExrateShow.show(); + // S=setInterval(function () { + + // if (EXRATE != 0) { + // alert(EXRATE); + // clearInterval(S); + // } + // }, 500) + + }, + + GetBank: function () { + if (this.StoreBANK.getCount() == 0) return; + var ACCOUNT = this.formEdit.getForm().findField('ACCOUNT').getValue(); + var CURR = this.formEdit.getForm().findField('CURR').getValue(); + var SETTLETYPE = this.formEdit.getForm().findField('SETTLETYPE').getRawValue(); + if (SETTLETYPE == '现金') return; + + if (ACCOUNT != '') return; + if (CURR == '') return; + for (var j = 0; j < this.StoreBANK.getCount() ; j += 1) { + var memberbody = this.StoreBANK.getAt(j); + if (memberbody.data.CURRENCY == CURR && memberbody.data.ISDEF=='True') { + this.formEdit.getForm().findField('ACCOUNT').setValue(memberbody.data.GID); + } + } + + }, + + onAddFileClick: function () { + var billstatus = this.formEdit.getForm().findField('BILLSTATUS').getValue(); + if ((billstatus == 1)) { + + Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.CanotLock4CurrStatus, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + return; + + } + var Duino = this.formEdit.getForm().findField('BILLNO').getValue(); + if (Duino == '*') { + Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.SaveSFJSBeforCancleLock, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + return; + }; + var winAccess = new Shipping.FileUpload({}); + winAccess.BillNo = Duino; + winAccess.show(); + }, + onDelFileClick: function () { + var billstatus = this.formEdit.getForm().findField('BILLSTATUS').getValue(); + if ((billstatus == 1)) { + + Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.CanotLock4CurrStatus, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + return; + + } + var selections = this.fileGrid.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') { + Ext.Msg.wait(Zi.LAN.Msg_Deleting); //正在删除数据 + Ext.Ajax.request({ + waitMsg: Zi.LAN.Msg_Deleting, + url: '/Account/Chfee_payapplication/CertDel', + params: { + data: Ext.JSON.encode(record) + }, + callback: function (options, success, response) { + if (success) { + var jsonresult = Ext.JSON.decode(response.responseText); + if (jsonresult.Success) { + _this.storeChfeeFile.reload(); + Ext.Msg.show({ title: Zi.LAN.TiShi, msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + } //提示 + else { + Ext.Msg.show({ title: Zi.LAN.TiShi, msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); + } + } + }, + failure: function (response, options) {//'警告', msg: '服务器响应出错,请重试' + Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.ServerResponseError, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + }, + success: function (response, options) { + }, + scope: this + }); //end Ext.Ajax.request + } + }, this); + }, + + //#region 必填字段 + + LoadMustBe: function () { + this.storeMustBe.load({ + params: { condition: "BSTYPE='收费结算'" }, //付费申请 + callback: function (r, options, success) { + if (success) { + if (this.storeMustBe.getCount() > 0) { + for (var j = 0; j < this.storeMustBe.getCount(); j += 1) { + var member = this.storeMustBe.getAt(j); + + var headfield = this.formEdit.getForm().findField(member.data.FIELDNAME); + if (headfield != NaN && headfield != null) { + if (member.data.ISMUST == "1") + headfield.allowBlank = false; + if (member.data.ISCOLOR == "1") + headfield.setFieldStyle({ background: '#ffc' }); + } + + }; + + + } else { + + } + } + }, + scope: this + }); + + + }, + //#endregion + + // #region 根据权限和状态判断是否允许修改 + + GetEditStatus: function () { + var canedit = false; + var btnESubmitAudit = Ext.getCmp('btnSubmitAudit'); + var btnESubmitAuditBack = Ext.getCmp('btnSubmitAuditBack'); + this.formEdit.getForm().findField('BILLSTATUS').setDisabled(false); + var bsStatus = this.formEdit.getForm().findField('BILLSTATUS').getValue(); + var op = this.formEdit.getForm().findField('SETTLEUSERREF').getValue(); + var opid = this.formEdit.getForm().findField('SETTLEUSER').getValue(); + this.formEdit.getForm().findField('BILLSTATUS').setDisabled(true); + + + _this = this; + if (bsStatus != 2) { + canedit = false; + this.setSaveBtnStatus(canedit); + + } else { + + + this.StoreOpRange.load({ params: { optype: "modRecvSettleList" }, + callback: function (r, options, success) { + if (success) { + if (r.length != 0) { + var records = DsStoreQueryBy(_this.StoreOpRange, 'OPID', op); + if (records.getCount() > 0) { + canedit = true; + + } else { + canedit = false; + } + _this.setSaveBtnStatus(canedit); + _this.LoadPeriodStatus(this.opStatus); + } + } + } + }); + } + + this.StoreLockOp.load({ + params: { optype: "modRecvFeeSettlementLock" }, + callback: function (r, options, success) { + if (success) { + if (r.length != 0) { + var records = DsStoreQueryBy(_this.StoreLockOp, 'OPID', opid); + if (records.getCount() > 0) { + if (bsStatus == 1) { + btnESubmitAudit.disable(); + } else { + btnESubmitAudit.enable(); + } + + } else { + btnESubmitAudit.disable(); + } + + } else { + btnESubmitAudit.disable(); + } + } + } + }); + + + this.StoreUnLockOp.load({ + params: { optype: "modRecvFeeSettlementUnLock" }, + callback: function (r, options, success) { + if (success) { + if (r.length != 0) { + var records = DsStoreQueryBy(_this.StoreUnLockOp, 'OPID', opid); + if (records.getCount() > 0) { + if (bsStatus == 1) { + btnESubmitAuditBack.enable(); + } else { + btnESubmitAuditBack.disable(); + } + + } else { + btnESubmitAuditBack.disable(); + } + + } else { + btnESubmitAuditBack.disable(); + } + } + } + }); + + + }, + + setSaveBtnStatus: function (enable) { + var btnESave = Ext.getCmp('btnESave'); + var btnESaveAndClose = Ext.getCmp('btnESaveAndClose'); + var btnESaveAndNew = Ext.getCmp('btnESaveAndNew'); + var btnEAddDetail = Ext.getCmp('btnadddetail'); + var btnEDeleteDetail = Ext.getCmp('btndeldetail'); + var btnEDeleteAndNew = Ext.getCmp('btnEDeleteAndNew'); + this.canedit = enable; + + if (enable) { + btnESave.enable(); + btnESaveAndClose.enable(); + btnESaveAndNew.enable(); + + btnEAddDetail.enable(); + btnEDeleteDetail.enable(); + btnEDeleteAndNew.enable(); + + + } else { + btnESave.disable(); + btnESaveAndClose.disable(); + btnESaveAndNew.disable(); + btnEAddDetail.disable(); + btnEDeleteDetail.disable(); + btnEDeleteAndNew.disable(); + + + } + }, + + + // #endregion + + + Print: function () { + var basicForm = this.formEdit.getForm(); + var billNo = basicForm.findField('BILLNO').value; + if (billNo == '*' || billNo == '') { + Ext.Msg.show({ title: Zi.LAN.E, msg: Zi.LAN.PrintMustAfterSave, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); + return; + } + + var printType = 'MSCHFEERECVSETTLEMENT'; + + var sortstr = ' b.VESSEL,b.VOYNO,b.MBLNO'; + + if (this.sortfield != '' && this.sortdire != '') { + + sortstr = this.sortfield + ' ' + this.sortdire; + } + + var sql1 = "SELECT s.*,(select ShowName from [user] where GID=s.SETTLEUSER) as SETTLEUSERREF "; + sql1 = sql1 + " ,(select STLNAME from [code_stlmode] where STLCODE=s.SETTLETYPE) as SETTLETYPERE "; + sql1 = sql1 + " ,(select BANKNAME from [sys_bank] where GID=s.ACCOUNTRMB) as ACCOUNTRMBREF"; + sql1 = sql1 + " ,(select BANKNAME from [sys_bank] where GID=s.ACCOUNTUSD) as ACCOUNTUSDREF"; + sql1 = sql1 + " ,(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=97007 and EnumValueID=s.SETTLEMODE) as SETTLEMODEREF "; + sql1 = sql1 + " ,(select DESCRIPTION from info_client where SHORTNAME=s.CUSTOMERNAME) CUSTFULLNAME"; + sql1 = sql1 + ",总账凭证号=(select top 1 VOUALLNO from cw_vouno_bs_gl WITH(NOLOCK) where BSGID=s.GID and BSTABLENAME='ch_fee_settlement' and STARTGID in (select top 1 GID from cw_design_startusing WITH(NOLOCK) where (ISDELETE=0 or ISDELETE is null) and ISENABLE=1 and GID=(select top 1 STARTGID from [cw_design_startusing_user] WITH(NOLOCK) where USERGID='" + USERID + "')))"; + sql1 = sql1 + " FROM ch_fee_settlement s WHERE BILLNO='" + billNo + "'"; + + var sql2 = "SELECT c.GID,c.BSNO,c.FEEID,c.FEENAME,c.CURRENCY,c.AMOUNT,c.DOAMOUNT,c.ORIGCURRENCY,c.ORIGAMOUNT,c.EXCHANGERATE,FEETYPE "; + sql2 = sql2 + ",b.CUSTOMERNAME,b.VESSEL,b.VOYNO,b.ETD,b.PORTLOAD"; + sql2 = sql2 + " ,b.PORTDISCHARGE,b.INPUTBY,b.OP,b.CUSTSERVICE,b.DOC,b.SALE,b.MBLNO"; + sql2 = sql2 + " FROM ch_fee_do c left join v_op_bill b on (b.bsno=c.bsno)"; + sql2 = sql2 + " WHERE C.BILLNO='" + billNo + "' ORDER BY " + sortstr; + + var sql3 = ""; + var sql4 = ""; + var sql5 = ""; + var sql6 = ""; + + PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6); + }, + + //#region 生成凭证 + onAddCwVouchers: function (button, event) { + var billNo = this.formEdit.getForm().findField('BILLNO').value; + if (billNo == '*' || billNo == '') { + Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.SaveDillFirst, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + return; + } + // // + // var strGids = ""; + // var VOUCHERNO = this.formEdit.getForm().findField('VOUCHERNO').value; //凭证号 + // var BILLSTATUS = this.formEdit.getForm().findField('BILLSTATUS').value; //是否锁定 + // var SETTLETYPEREF = this.formEdit.getForm().findField('SETTLETYPE').value; //结算方式 + // var ACCOUNTREF = this.formEdit.getForm().findField('ACCOUNT').value; //结算账户 + + // if (VOUCHERNO == "" && BILLSTATUS == 1 && ((SETTLETYPEREF != "现金" && ACCOUNTREF != "") || SETTLETYPEREF == "现金")) { + // strGids = this.editRecord.data.GID.toString(); + // } + // if (strGids == "") { + // Ext.Msg.show({ title: '提示', msg: '请选择已锁定、结算账户不为空(结算方式为现金除外),且未生成凭证的单据!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + // return; + // } + // // + // this.storeListCw.load({ params: { strGids: strGids }, waitMsg: "正在刷新数据...", scope: this }); + // this.showContactForm(false, strGids, this); + // + Ext.Ajax.request({ + waitMsg:Zi.LAN.PreReadDataWait , + url: '/Account/Chfee_settlement/GetIsVoucher', + params: { + strGids: this.editRecord.data.GID.toString() + }, + 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: this.editRecord.data.GID.toString() }, + callback: function (r, options, success) { + if (success) { + this.showContactForm(false, this.editRecord.data.GID.toString(), this); + } + }, waitMsg: Zi.LAN.RefreshDataWait, scope: this + }); + } else { + Ext.MessageBox.alert(Zi.LAN.Error, response.responseText); + } + }, + scope: this + }); + }, + //#endregion + + //#region 层_显示信息 + showContactForm: function (win, strGids, _this) { + 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" //未选中的值 + }, 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(Zi.LAN.Msg_SavingAndWait); + Ext.Ajax.request({ + waitMsg: Zi.LAN.Msg_Saving, + 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) { + Ext.Msg.show({ title: Zi.LAN.TiShi, msg: jsonresult.Message, icon: Ext.MessageBox.INFO, buttons: Ext.Msg.OK }); + //刷新页面 + var billno = _this.formEdit.getForm().findField('BILLNO').getValue(); + Ext.Ajax.request({ + waitMsg: Zi.LAN.OnSelect , + url: '/Account/Chfee_settlement/GetData', + params: { + handle: 'edit', + condition: " BILLNO='" + billno + "'" + }, + 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; + } + + var data = result.data; + _this.formEdit.getForm().findField('BILLSTATUS').setDisabled(false); + _this.formEdit.getForm().reset(); + _this.formEdit.getForm().setValues(data); + _this.formEdit.getForm().findField('BILLSTATUS').setDisabled(true); + var editp = Ext.create('MsChSettlement', data); + + _this.editRecord.fields.each(function (field) { + if (field.persist) { + name = field.name; + if (name != 'id') + _this.editRecord.set(name, editp.get(name)); + } + }, this); + _this.editRecord.commit(); + _this.GetEditStatus(); + if (_this.STLSHOWVOU == 1) { + DsOpenEditWin('/MvcShipping/MsCwVouchersGl/Edit?handle=check&ordno=' + jsonresult.Data, "凭证录入", "", "940", "10", "10"); + } + } else { + Ext.MessageBox.alert(Zi.LAN.Error, response.responseText); + } + }, + scope: this + }); + //Ext.getCmp('btnAddCwVouchers').setText("撤销凭证"); + 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 }); + } + } + }); + // + 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: 300, + layout: 'fit', + resizable: true, + modal: true, + closable: false, + items: formDiv + }); + } + win.show(); +} +//#endregion +}); + + diff --git a/DSWeb/DSWeb.csproj b/DSWeb/DSWeb.csproj index ebc08a08..ea3f0757 100644 --- a/DSWeb/DSWeb.csproj +++ b/DSWeb/DSWeb.csproj @@ -545,10 +545,11 @@ - + +