//应收应付费用列表 Ext.namespace('DsTruck'); DsTruck.RptImportFeedetailIndex = function (config) { Ext.applyIf(this, config); this.initUIComponents(); window.DsTruck.RptImportFeedetailIndex.superclass.constructor.call(this); }; //201403060002 //13号 Ext.extend(DsTruck.RptImportFeedetailIndex, Ext.Panel, { PageSize: 500, OprationStatus: null, //仅当弹出界面时使用 SelectedRecord: null, initUIComponents: function () { this.BSNO = ""; //定义数据集 this.storeList = Ext.create('Ext.data.Store', { pageSize: this.PageSize, idProperty: 'GId', fields: [ { name: 'GId', type: 'string' }, { name: 'Billno', type: 'string' }, { name: 'ContractNo', type: 'string' }, { name: 'HTH', type: 'string' }, { name: 'seller', type: 'string' }, { name: 'buyer', type: 'string' }, { name: 'Vessel', type: 'string' }, { name: 'Voyage', type: 'string' }, { name: 'Sailingdate', type: 'string' }, { name: 'ArrivalDate', type: 'string' }, { name: 'ContainerNo', type: 'string' }, { name: 'SealNo', type: 'string' }, { name: 'creattime', type: 'string' }, { name: 'FeeType_Ref', type: 'string' }, { name: 'FeeStatus_Ref', type: 'string' }, { name: 'FeeStatus', type: 'string' }, { name: 'FeeName_Ref', type: 'string' }, { name: 'FeeDescription', type: 'string' }, { name: 'CustomerName_Ref', type: 'string' }, { name: 'Unit', type: 'string' }, { name: 'Currency', type: 'string' }, { name: 'Remark', type: 'string' }, { name: 'EnterDate', type: 'string' }, { name: 'UnitPrice', type: 'number' }, { name: 'Quantity', type: 'number' }, { name: 'Amount_YS', type: 'number' }, { name: 'Amount_YF', type: 'number' }, { name: 'Amount_RMBYS', type: 'number' }, { name: 'Amount_RMBYF', type: 'number' }, { name: 'ExChangerate', type: 'number' }, { name: 'CreateUser', type: 'string' }, { name: 'AC_AD', type: 'string' }, //{ name: 'AD', type: 'string' }, {name: 'CR_DR', type: 'string' }, //{ name: 'DR', type: 'string' }, {name: 'AUDITOPERATOR', type: 'string' }, { name: 'AUDITDATE', type: 'string' }, { name: 'VOUCHERNO', type: 'string' }, { name: 'VOUNO', type: 'string'}//结算凭证号 , { name: 'SETTLEMENT_ys', type: 'number' }, { name: 'SETTLEMENT_yf', type: 'number' }, { name: 'REMAIN', type: 'number' }, { name: 'CARGONAME', type: 'string' }, { name: 'COMPANY', type: 'string' }, { name: 'OP', type: 'string' }, { name: 'DEBITNO', type: 'string' }, { name: 'INV', type: 'string' } ], remoteSort: false, groupField: 'HTH', proxy: { type: 'ajax', url: '/Import/RptImportFeedetail/GetDataList', reader: { id: 'Id', root: 'data', totalProperty: 'totalCount' } } }); //#region 相关参照 Ext.define('Tradermb', { extend: 'Ext.data.Model', idProperty: 'gid', fields: [ { name: 'gid', type: 'string' }, { name: 'name', type: 'string' }, { name: 'codename', type: 'string' } ] }); Ext.define('companymb', { extend: 'Ext.data.Model', fields: [ { name: 'gid', type: 'string' }, { name: 'name', type: 'string' } ] }); this.formname = "ImportFeedetail"; this.storeMainstate = Ext.create('DsExt.ux.RefEnumStore', {}); this.storeMainstate.load({ params: { enumTypeId: 3} }); this.comboxMainstate = Ext.create('DsExt.ux.RefEnumCombox', { fieldLabel: '合同状态', store: this.storeMainstate, name: 'Mainstate' }); this.storeFeetype = Ext.create('DsExt.ux.RefEnumStore', {}); this.storeFeetype.load({ params: { enumTypeId: 22} }); this.comboxFeetype = Ext.create('DsExt.ux.RefEnumCombox', { fieldLabel: '收付方向', store: this.storeFeetype, name: 'Feetype' }); this.storeFeeName = Ext.create('DsExt.ux.RefTableStore', { model: 'DsTruckMng.ux.FeeTypeRefModel', proxy: { url: '/CommMng/BasicDataRef/GetFeeTypeRefList' } }); this.storeFeeName.load({ params: { condition: ""} }); this.comboxFeeName = Ext.create('Ext.ux.form.field.BoxSelect', { fieldLabel: '费用名称', //renderTo: 'basicBoxselect',height:60,pinList: false, //autoHeight:true,width: 500,stacked: true, autosize: true, bodyPadding: 7, flex: 2, labelWidth: 90, store: this.storeFeeName, queryMode: 'local', triggerOnClick: false, valueField: 'Name', displayField: 'CodeAndName' }); this.storeFeeGroup = Ext.create('DsExt.ux.RefTableStore', { model: 'DsTruckMng.ux.FeeTypeRefModel', proxy: { url: '/CommMng/BasicDataRef/GetFeeGroupRefList' } }); this.storeFeeGroup.load({ params: { condition: ""} }); this.comboxFeeGroup = Ext.create('Ext.ux.form.field.BoxSelect', { fieldLabel: '费用分组名称', //renderTo: 'basicBoxselect',height:60,pinList: false, //autoHeight:true,width: 500,stacked: true, autosize: true, bodyPadding: 7, flex: 2, labelWidth: 90, store: this.storeFeeGroup, queryMode: 'local', triggerOnClick: false, valueField: 'Name', displayField: 'CodeAndName' }); this.storeFeestatus = Ext.create('DsExt.ux.RefEnumStore', {}); this.storeFeestatus.load({ params: { enumTypeId: 99024} }); this.comboxFeestatus = Ext.create('Ext.ux.form.field.BoxSelect', { fieldLabel: '费用状态', autosize: true, bodyPadding: 7, flex: 3, labelWidth: 90, store: this.storeFeestatus, queryMode: 'local', triggerOnClick: false, valueField: 'EnumValueId', displayField: 'EnumValueName' }); this.storeCustomer = Ext.create('DsExt.ux.RefTableStore', { model: 'Tradermb', proxy: { url: '/CommMng/BasicDataRef/GetTrader' } }); this.storeCustomer.load({ params: { condition: " 1=1 "} }); this.comboxCustomer = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '业务委托单位', store: this.storeCustomer, name: 'Customer', valueField: 'name', displayField: 'codename', flex: 1 }); this.storeport = Ext.create('DsExt.ux.RefEnumStore', {}); this.storeport.load({ params: { enumTypeId: 10} }); this.comboxport = Ext.create('DsExt.ux.RefEnumCombox', { fieldLabel: '目的港', store: this.storeport, name: 'port' }); this.storeCompany = Ext.create('DsExt.ux.RefTableStore', { model: 'companymb', proxy: { url: '/CommMng/BasicDataRef/GetcompanyList' } }); this.storeCompany.load({ params: { condition: ""} }); this.comboxCompany = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '用证公司', flex: 1, store: this.storeCompany, name: 'company', valueField: 'gid', displayField: 'name' }); //#endregion this.column = [{ sortable: true, dataIndex: 'CustomerName_Ref', header: '结算对象', width: 76 }, { sortable: true, dataIndex: 'COMPANY', header: '用证公司', width: 82 }, { sortable: true, dataIndex: 'HTH', header: '合同号', width: 65 }, { sortable: true, dataIndex: 'ContractNo', header: '合同序列号', hidden: true, width: 65 }, { sortable: true, dataIndex: 'FeeName_Ref', header: '费用名称', width: 60 }, { sortable: true, dataIndex: 'CreateUser', header: '录入人', width: 60 }, { sortable: true, dataIndex: 'FeeType_Ref', header: '收付类型', width: 65 }, { sortable: true, dataIndex: 'Amount_YS', header: '应收', width: 80, summaryType: 'sum', align: 'right', summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; } }, { sortable: true, dataIndex: 'Amount_YF', header: '应付', width: 80, summaryType: 'sum', align: 'right', summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; } }, { sortable: true, dataIndex: 'Amount_RMBYS', header: '应收(RMB)', width: 80, summaryType: 'sum', align: 'right', summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; } }, { sortable: true, dataIndex: 'Amount_RMBYF', header: '应付(RMB)', width: 80, summaryType: 'sum', align: 'right', summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; } }, { sortable: true, dataIndex: 'SETTLEMENT_ys', header: '应收已结算', width: 80, summaryType: 'sum', align: 'right', summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; } }, { sortable: true, dataIndex: 'SETTLEMENT_yf', header: '应付已结算', width: 80, summaryType: 'sum', align: 'right', summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; } }, { sortable: true, dataIndex: 'REMAIN', header: '剩余', width: 80, summaryType: 'sum', align: 'right', summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; }, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { value = usMoney(value, 2, '', true); return value; } }, { sortable: true, dataIndex: 'AC_AD', header: '申请单号', width: 120 }, { sortable: true, dataIndex: 'CR_DR', header: '结算单号', width: 120 }, { sortable: true, dataIndex: 'ArrivalDate', header: '到港日期', width: 70 }, { sortable: true, dataIndex: 'Billno', header: '提单号', width: 130 }, { sortable: true, dataIndex: 'seller', header: '贸易商', hidden: true, width: 65 }, { sortable: true, dataIndex: 'EnterDate', header: '费用录入日期', width: 70 }, { sortable: true, dataIndex: 'FeeStatus_Ref', header: '费用状态', width: 60 }, { dataIndex: 'FeeStatus', header: 'FeeStatus', hidden: true, width: 60 }, { sortable: true, dataIndex: 'UnitPrice', header: '单价', width: 60 }, { sortable: true, dataIndex: 'Unit', header: '重量单位', width: 60 }, { sortable: true, dataIndex: 'Quantity', header: '数量', width: 60 }, { sortable: true, dataIndex: 'Currency', header: '币别', width: 60 }, { sortable: true, dataIndex: 'ExChangerate', header: '汇率', width: 60 }, { sortable: true, dataIndex: 'Vessel', header: '船名', width: 60 }, { sortable: true, dataIndex: 'Voyage', header: '航次', width: 60 }, { sortable: true, dataIndex: 'ContainerNo', header: '箱号', width: 80 }, { sortable: true, dataIndex: 'SealNo', header: '封号', width: 80 }, { sortable: true, dataIndex: 'Remark', header: '费用备注', width: 80 }, { dataIndex: 'GId', header: 'GId', hidden: true, width: 140 }, { sortable: true, dataIndex: 'AUDITOPERATOR', header: '审核人', width: 100 }, { sortable: true, dataIndex: 'AUDITDATE', header: '审核时间', width: 100 }, { sortable: true, dataIndex: 'VOUCHERNO', header: '应收应付凭证号', width: 100 }, { sortable: true, dataIndex: 'VOUNO', header: '结算凭证号', width: 100 }, { sortable: true, dataIndex: 'CARGONAME', header: '货物名称', width: 120 }, { sortable: true, dataIndex: 'OP', header: '操作人(业务)', width: 100 }, { sortable: true, dataIndex: 'DEBITNO', header: '对账编号', width: 100 }, { sortable: true, dataIndex: 'INV', header: '发票申请单号', width: 100 }]; var _this = this; this.Pagenum = Ext.create('Ext.form.field.Number', { name: 'bottles', fieldLabel: '每页记录数', labelAlign: 'right', value: this.PageSize, maxValue: 100000, width: 180, minValue: 0, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }); this.FeeCBModel = Ext.create('Ext.selection.CheckboxModel', { checkOnly: true }); //定义Grid this.gridList = new Ext.grid.GridPanel({ store: this.storeList, enableHdMenu: false, region: 'center', loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, stripeRows: true, viewConfig: { enableTextSelection: true, autoFill: true, getRowClass: function (record, rowIndex, rowParams, store) { var feeStatus = record.get('FeeStatus'); return DsTruck.MsChFeeGetRowClass(feeStatus); } }, features: [{ id: 'group', ftype: 'groupingsummary', groupHeaderTpl: '{name}', hideGroupedHeader: false, enableGroupingMenu: true }], stateful: false, selModel: this.FeeCBModel, columns: [new Ext.grid.RowNumberer()], // paging bar on the bottom bbar: [Ext.create('Ext.PagingToolbar', { store: this.storeList, displayInfo: true, displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录', emptyMsg: "没有数据" }), this.Pagenum] }); /////////////以下部分为获取存储的gridpanel显示样式 this.column = DsTruck.GetGridPanel(GID, this.formname, this.column); this.column.unshift(new Ext.grid.RowNumberer()); this.gridList.reconfigure(this.storeList, this.column); //////////////////////////// this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) { this.SelectedRecord = record; this.BSNO = record.data.ContractNo; this.OprationStatus = 'view'; DsOpenEditWin('/Import/PortOperate/Edit', this.BSNO, "750", "1000"); }, this); //#region formSearch枚举参照相关 this.storeBuyer = Ext.create('DsExt.ux.RefTableStore', { model: 'Tradermb', proxy: { url: '/CommMng/BasicDataRef/GetTrader' } }); this.storeBuyer.load({ params: { condition: " 1=1 "} }); this.comboxBuyer = Ext.create('Ext.ux.form.field.BoxSelect', { fieldLabel: '结算对象', autosize: true, bodyPadding: 7, flex: 2, labelWidth: 90, store: this.storeBuyer, queryMode: 'local', triggerOnClick: false, valueField: 'name', displayField: 'codename' }); this.storeUser = Ext.create('DsExt.ux.RefTableStore', { model: 'DsTruckMng.ux.UserRefModel', proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' } }); this.storeUser.load({ params: { condition: ""} }); this.comboxOP = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '操作人', //forceSelection: true, store: this.storeUser, name: 'OP', valueField: 'UserName', displayField: 'CodeAndName' }); this.comboxEnter = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '录入', //forceSelection: true, store: this.storeUser, name: 'Enter', valueField: 'GID', displayField: 'CodeAndName' }); //#endregion var _this = this; this.formSearch = Ext.widget('form', { frame: true, region: 'center', bodyPadding: 5, fieldDefaults: { margins: '2 2 2 2', labelAlign: 'right', flex: 1, labelWidth: 90, msgTarget: 'qtip' }, items: [ {//fieldset 1 xtype: 'container', defaultType: 'textfield', layout: 'anchor', defaults: { anchor: '100%' }, items: [{ xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxport, this.comboxFeetype, this.comboxOP, { fieldLabel: '从..到港日', format: 'Y-m-d', xtype: 'datefield', name: 'arrivaldate_min', listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, { fieldLabel: '到..到港日', format: 'Y-m-d', xtype: 'datefield', name: 'arrivaldate_max', listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } } ] } ]//end items(fieldset 1) }, //end fieldset 1 {//fieldset 2 xtype: 'container', defaultType: 'textfield', layout: 'anchor', defaults: { anchor: '100%' }, items: [{ xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxCustomer, { fieldLabel: '合同号', name: 'HTH', flex: 1, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, this.comboxEnter, { fieldLabel: '从..费用日期', format: 'Y-m-d', xtype: 'datefield', name: 'EnterDate_min', listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, { fieldLabel: '到..费用日期', format: 'Y-m-d', xtype: 'datefield', name: 'EnterDate_max', listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } } ] } ]//end items(fieldset 2) }//end fieldset 2 , {//----------- xtype: 'container', defaultType: 'textfield', labelWidth: 90, layout: 'anchor', defaults: { anchor: '100%' }, items: [{ xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '申请单/结算单号', name: 'DH', flex: 1, labelWidth: 110, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, { fieldLabel: '应收应付凭证号', name: 'VOUCHERNO', flex: 1 , labelWidth: 110, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, { fieldLabel: '结算凭证号', name: 'VOUNO', flex: 1, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, { fieldLabel: '备注中包含', name: 'ReMark', flex: 1, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, this.comboxCompany ] } ]//end items(fieldset 2) }//--------------------- , {//fieldset 2 xtype: 'container', defaultType: 'textfield', layout: 'anchor', defaults: { anchor: '100%' }, items: [{ xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ labelWidth: 110, fieldLabel: '从..合同完成日期', format: 'Y-m-d', xtype: 'datefield', name: 'AccDate_min', listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, { labelWidth: 110, fieldLabel: '到..合同完成日期', format: 'Y-m-d', xtype: 'datefield', name: 'AccDate_max', listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, { fieldLabel: '对账编号', name: 'DEBITNO', flex: 1, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, { fieldLabel: '无对账编号', xtype: 'checkbox', name: 'NoDEBITNO', flex: 1 }, { xtype: 'hiddenfield', flex: 1 } ] } ]//end items(fieldset 2) }//end fieldset 2 , {//fieldset 3 xtype: 'container', defaultType: 'textfield', layout: 'anchor', defaults: { anchor: '100%' }, items: [{ xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxBuyer, this.comboxFeestatus ] } ]//end items(fieldset 2) }//end fieldset 3 , {//----------- xtype: 'container', defaultType: 'textfield', layout: 'anchor', defaults: { anchor: '100%' }, items: [{ xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxMainstate, this.comboxFeeName, this.comboxFeeGroup ] } ]//end items(fieldset 2) }//--------------------- ]//end root items }); //#endregion formSearch var menu1 = new Ext.menu.Menu({ id: 'basicMenu', items: [{ text: '收款通知单', handler: clickHandler_SK }, { text: '对账列表', handler: clickHandler_DHM }, { text: '费用结算明细', handler: clickHandler_ZWC }/*, { text: '付款通知单', handler: clickHandler_FK }*/] }); function clickHandler_SK() { window.pnlRptImportFeedetailIndex.Print_SK(); }; function clickHandler_DHM() { window.pnlRptImportFeedetailIndex.Print_DHM(); }; function clickHandler_FK() { window.pnlRptImportFeedetailIndex.Print_FK(); }; function clickHandler_ZWC() { window.pnlRptImportFeedetailIndex.Print_ZWCDZ(); }; //查询工具条 this.panelBtn = new Ext.Panel({ region: "north", tbar: [ { text: "执行查询", iconCls: "btnrefresh", handler: function (button, event) { this.onRefreshClick(button, event); }, scope: this }, { text: "导出Excel", id: "btnExportExcel", iconCls: 'btnexportexcel', handler: function (button, event) { this.onExportClick(button, event); }, scope: this }, { text: "保存列表样式", id: "btntest", handler: function (button, event) { //this.column = DsTruck.SaveGridPanel(GID, this.formname, this.gridList.columns, this.column, 1, true); var tempcolumns = this.gridList.columns; DsTruck.SaveGridPanel(GID, this.formname, tempcolumns, this.column, 1, true); }, scope: this }, { text: "打印报表", menu: menu1, scope: this } ] }); this.panelTop = new Ext.Panel({ layout: "border", region: "north", height: 200, items: [this.formSearch, this.panelBtn] }); Ext.apply(this, { items: [this.panelTop, this.gridList] }); this.storeList.on('beforeload', function (store) { if (!this.checkSearchCondition()) return; var sql = this.getCondition(); if (sql != "false") { Ext.apply(store.proxy.extraParams, { condition: sql }); } }, this); }, //end initUIComponents onRefreshClick: function (button, event) { if (!this.checkSearchCondition()) return; var sql = this.getCondition(); this.PageSize = this.Pagenum.getValue(); this.storeList.pageSize = this.PageSize; if (sql != "false") { this.storeList.load({ params: { start: 0, limit: this.PageSize, condition: sql }, waitMsg: "正在查询数据...", scope: this }); } }, getCondition: function () { var form = this.formSearch.getForm(); if (!form.isValid()) { Ext.Msg.alert('提示', '查询条件赋值错误,请检查。'); return ''; } var sql = '';//M.ISDELETE=0 var CustomerName = this.getStrValue(this.comboxBuyer.getValue()); sql = sql + getAndConSql(sql, CustomerName, " f.CustomerName in (" + CustomerName + ")"); var Buyer = this.comboxCustomer.getValue(); sql = sql + getAndConSql(sql, Buyer, " m.CUSTOMERNAME like '%" + Buyer + "%' "); var Feetype = form.findField('Feetype').getValue(); sql = sql + getAndConSql(sql, Feetype, "f.Feetype = " + Feetype); var port = form.findField('port').getRawValue(); sql = sql + getAndConSql(sql, port, "m.PortDischarge='" + port + "'"); var arrivaldate_min = form.findField('arrivaldate_min').getRawValue(); sql = sql + getAndConSql(sql, arrivaldate_min, "(select arrivaldate from import_main where contractno=m.bsno) >= '" + arrivaldate_min + "'"); var arrivaldate_max = form.findField('arrivaldate_max').getRawValue(); sql = sql + getAndConSql(sql, arrivaldate_max, "(select arrivaldate from import_main where contractno=m.bsno) <= '" + arrivaldate_max + " 23:59:59'"); var EnterDate_min = form.findField('EnterDate_min').getRawValue(); sql = sql + getAndConSql(sql, EnterDate_min, " f.gid in ( select gid from ch_fee where enterdate >= '" + EnterDate_min + "')"); var EnterDate_max = form.findField('EnterDate_max').getRawValue(); sql = sql + getAndConSql(sql, EnterDate_max, " f.gid in ( select gid from ch_fee where enterdate <= '" + EnterDate_max + " 23:59:59')"); var AccDate_min = form.findField('AccDate_min').getRawValue(); sql = sql + getAndConSql(sql, AccDate_min, "M.AccDate >= '" + AccDate_min + "'"); var AccDate_max = form.findField('AccDate_max').getRawValue(); sql = sql + getAndConSql(sql, AccDate_max, "M.AccDate <= '" + AccDate_max + " 23:59:59'"); var HTH = form.findField('HTH').getValue(); sql = sql + getAndConSql(sql, HTH, "M.CUSTNO like '%" + HTH + "%'"); /* var FeeType = form.findField('FeeType').getValue(); sql = sql + getAndConSql(sql, FeeType, "f.FeeType = " + FeeType); */ var FeeName = this.getStrValue(this.comboxFeeName.getValue()); sql = sql + getAndConSql(sql, FeeName, "f.FeeName in (" + FeeName + ")"); var FEEGROUP = this.getStrValue(this.comboxFeeGroup.getValue()); sql = sql + getAndConSql(sql, FEEGROUP, "f.FeeName in (select NAME from code_fee where FEEGROUP in(" + FEEGROUP + "))"); var FeeStatus = this.getStrValue(this.comboxFeestatus.getValue()); sql = sql + getAndConSql(sql, FeeStatus, "f.FeeStatus in (" + FeeStatus + ")"); var OP = form.findField('OP').getValue(); sql = sql + getAndConSql(sql, OP, "M.OP = '" + OP + "'"); var Enter = form.findField('Enter').getValue(); sql = sql + getAndConSql(sql, Enter, "f.gid in ( select gid from ch_fee where EnterOperator = '" + Enter + "')"); var DH = form.findField('DH').getValue(); //结算单号/申请单号 sql = sql + getAndConSql(sql, DH, "f.gid in ( select distinct feeid from ch_fee_do where billno like '%" + DH + "%')"); var DEBITNO = form.findField('DEBITNO').getValue(); //结算单号/申请单号 sql = sql + getAndConSql(sql, DEBITNO, " (f.DEBITNO like '%" + DEBITNO + "%' or f.gid in(select CH_ID from ch_dui_detail where DUINO like '%" + DEBITNO + "%'))"); var NoDEBITNO = form.findField("NoDEBITNO").getValue(); if (NoDEBITNO) { sql = sql + getAndConSql(sql, NoDEBITNO, " (isnull(f.DEBITNO,'')='' and not EXISTS(select * from ch_dui_detail where CH_ID=f.gid))"); } var VOUCHERNO = form.findField('VOUCHERNO').getValue(); //应收应付凭证 sql = sql + getAndConSql(sql, VOUCHERNO, "f.voucherno like '%" + VOUCHERNO + "%'"); var VOUNO = form.findField('VOUNO').getValue(); //结算凭证 sql = sql + getAndConSql(sql, VOUNO, "f.gid in ( select feeid from ch_fee_do where billno in( select billno from ch_fee_settlement where VOUNO like '%" + VOUNO + "%') )"); var company = form.findField('company').getValue(); sql = sql + getAndConSql(sql, company, "m.corpid= '" + company + "'"); var Mainstate = form.findField('Mainstate').getValue(); sql = sql + getAndConSql(sql, Mainstate, "(select minstate from import_main where contractno=m.bsno)= " + Mainstate + ""); var ReMark = form.findField('ReMark').getValue(); sql = sql + getAndConSql(sql, ReMark, "f.gid in ( select gid from ch_fee where ReMark like '%" + ReMark + "%')"); if (sql == ' M.ISDELETE=0 ') { alert("无限定条件的查询会等待超长时间并返回大量结果。请至少设定一个条件。"); return "false"; }; return sql; }, checkSearchCondition: function () { var form = this.formSearch.getForm(); if (!form.isValid()) { Ext.Msg.alert('提示', '查询条件赋值错误,请检查。'); return false; } return true; }, onExportClick: function (button, event) { GridExportExcelPage(this.gridList); }, getStrValue: function (list) { var _list = []; for (var _i = 0; _i < list.length; _i++) { _list.push("'" + list[_i] + "'"); } return _list; }, Print_SK: function () { //alert("print"); var selectedRecords = this.gridList.selModel.getSelection(); var FEEGID = ""; var CUSTOMERNAME = []; var company = []; for (var i = 0; i < selectedRecords.length; i++) { var rec = selectedRecords[i]; if (rec.get('FeeType_Ref') == "应收" && rec.get('FeeStatus') == '0') { if (FEEGID == "") { FEEGID = FEEGID + "'" + rec.get('GId') + "'"; } else { FEEGID = FEEGID + ",'" + rec.get('GId') + "'"; } if (company[0] != rec.get('COMPANY')) { company.push(rec.get('COMPANY')); } if (CUSTOMERNAME[0] != rec.get('CustomerName_Ref')) { CUSTOMERNAME.push(rec.get('CustomerName_Ref')); } } } if (FEEGID == "") { alert("没有选中审核通过的应收款"); return; } if (company.Length > 1) { alert("注意 用证公司超过一个"); //return; } function GetDateStr(AddDayCount) { var dd = new Date(); dd.setDate(dd.getDate() + AddDayCount); //获取AddDayCount天后的日期 var y = dd.getFullYear(); var m = dd.getMonth() + 1; //获取当前月份的日期 var d = dd.getDate(); return y + "-" + m + "-" + d; } //alert(GetDateStr(+5)); var madedate = GetDateStr(0); var printType = 'RptFee_TZD_SK'; //收款通知单 var sql1 = " select m.hth,m.billno,cf.feename,cf.amount,cf.currency "; var sql1 = sql1 + " ,(select fullname from company c where c.gid=m.company) companyfullname "; var sql1 = sql1 + " ,(select name from company c where c.gid=m.company) companyname from ch_fee cf "; var sql1 = sql1 + " left join import_main m on m.contractno=cf.bsno "; var sql1 = sql1 + " where cf.gid in( " + FEEGID + ")"; //var sql1 = sql1 + T; //var sql1 = sql1 + " go "; var sql2 = ""; var sql3 = "select '" + madedate + "' as madedate,'" + CUSTOMERNAME[0] + "' as CUSTOMERNAME,'" + SHOWNAME + "' as SHOWNAME"; var sql4 = ""; var sql5 = ""; var sql6 = ""; PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6); }, Print_FK: function () { //alert("print"); var selectedRecords = this.gridList.selModel.getSelection(); var FEEGID = ""; var CUSTOMERNAME = []; var company = []; for (var i = 0; i < selectedRecords.length; i++) { var rec = selectedRecords[i]; if (rec.get('FeeType_Ref') == "应付" && rec.get('FeeStatus') == '2') { if (FEEGID == "") { FEEGID = FEEGID + "'" + rec.get('GId') + "'"; } else { FEEGID = FEEGID + ",'" + rec.get('GId') + "'"; } if (CUSTOMERNAME[0] != rec.get('CustomerName_Ref')) { CUSTOMERNAME.push(rec.get('CustomerName_Ref')); } if (company[0] != rec.get('COMPANY')) { company.push(rec.get('COMPANY')); } } } if (CUSTOMERNAME.length > 1) { alert("只能有一个结算对象"); return; } if (CUSTOMERNAME.length == 0) { alert("没有选中提交审核的应付款"); return; } if (company.Length > 1) { alert("注意 用证公司超过一个"); //return; } function GetDateStr(AddDayCount) { var dd = new Date(); dd.setDate(dd.getDate() + AddDayCount); //获取AddDayCount天后的日期 var y = dd.getFullYear(); var m = dd.getMonth() + 1; //获取当前月份的日期 var d = dd.getDate(); return y + "-" + m + "-" + d; } //alert(GetDateStr(+5)); var madedate = GetDateStr(0); var printType = 'RptFee_TZD_FK'; //付款通知单 var sql1 = " select m.hth,m.billno,cf.feename,cf.amount,cf.currency,m.buyer "; var sql1 = sql1 + " ,(select fullname from company c where c.gid=m.company) companyfullname "; var sql1 = sql1 + " ,(select name from company c where c.gid=m.company) company,M.arrivaldate from ch_fee cf "; var sql1 = sql1 + " left join import_main m on m.contractno=cf.bsno "; ; var sql1 = sql1 + " where cf.gid in( " + FEEGID + " )"; //var sql1 = sql1 + T; //var sql1 = sql1 + " go "; var sql2 = ""; var sql3 = "select '" + madedate + "' as madedate,'" + CUSTOMERNAME[0] + "' as CUSTOMERNAME,'" + SHOWNAME + "' as SHOWNAME"; var sql4 = ""; var sql5 = ""; var sql6 = ""; PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6); }, Print_DHM: function () { var printType = 'RptFee_DHM1'; //付款通知单 var _T = this.getCondition(); var sql1 = " SELECT f.CustomerName as 结算对象,m.HTH,f.feename,(select showname from [user] where gid=f.enteroperator) 录入人, "; sql1 = sql1 + " (select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=99020 and EnumValueID=f.FeeType) as 收付类型 , "; sql1 = sql1 + " case f.feetype when 1 then 0 else f.Amount*f.exchangerate end 应付RMB, "; sql1 = sql1 + " dbo.f_danhao(f.gid,1) [CR_DR],m.ArrivalDate 到港日, "; sql1 = sql1 + " dbo.trimdate((select min(settletime) from ch_Fee_settlement where billno in(select billno from ch_fee_do where feeid =f.gid and CATEGORY in(1,2,3,8,9)))) 结算日期 "; sql1 = sql1 + " ,datediff(day,(select min(settletime) from ch_Fee_settlement where billno in(select billno from ch_fee_do where feeid =f.gid and CATEGORY in(1,2,3,8,9))),m.arrivaldate) 提前付款天数 "; sql1 = sql1 + " ,m.Billno 提单号,dbo.trimdate(f.ENTERDATE) 录入日, "; sql1 = sql1 + " (select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=99024 and EnumValueID=f.FeeStatus) as 费用状态, "; sql1 = sql1 + " f.UNITPRICE 单价,f.CURRENCY 币别,f.EXCHANGERATE 汇率,m.ContainerNo 箱号,f.REMARK 费用备注 "; sql1 = sql1 + " ,dbo.f_str(f.bsno) 货物名称,m.op 操作人 "; sql1 = sql1 + " ,dbo.trimdate(m.Agents_paydate) 代理商付汇时间_预付,dbo.trimdate(m.Agents_b_paydate) 代理商付汇时间_尾款 "; sql1 = sql1 + " ,isnull(dbo.trimtime((select min(settletime) from ch_Fee_settlement where billno in(select billno from ch_fee_do where feeid in(select gid from ch_fee where bsno=m.contractno and CUSTOMERNAME=m.Agent and feename='预付款') and CATEGORY in(1,2,3,8,9)))),'') 向代里付款时间_预付 "; sql1 = sql1 + " ,isnull(dbo.trimtime((select min(settletime) from ch_Fee_settlement where billno in(select billno from ch_fee_do where feeid in(select gid from ch_fee where bsno=m.contractno and CUSTOMERNAME=m.Agent and feename in('尾款','购货款')) and CATEGORY in(1,2,3,8,9)))),'') 向代里付款时间_尾款 "; sql1 = sql1 + " ,dbo.trimdate((select min(wmsdate) from wms where associatedno=f.bsno)) 入库日期 "; sql1 = sql1 + " from ch_fee f "; sql1 = sql1 + " left join Import_main m on (f.bsno=m.ContractNo) "; sql1 = sql1 + " where m.id is not null "; if (_T!=""){ sql1 = sql1 + " and "+_T; } //var sql1 = sql1 + T; //var sql1 = sql1 + " go "; var sql2 = ""; var sql3 = ""; var sql4 = ""; var sql5 = ""; var sql6 = ""; PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6); }, Print_ZWCDZ: function () { var printType = 'RptFee_ZWCDZ'; //中物储对账单 var _T = this.getCondition(); var sql1 = " select "; var sql1 = sql1 + " f.CUSTOMERNAME 结算对象,m.CUSTOMERNAME 委托单位,f.FEETYPE 收付方向 "; var sql1 = sql1 + " , m.MBLNO 提单号,m.etD 开船日,m.eta 到港日,m.KGS 净重,m.CONTRACTNO 合同号,m.GOODSNAME 货名,m.NUMBERPLATE 牌号 "; var sql1 = sql1 + " ,FEENAME 费用名称,QUANTITY 数量,UNIT 单位,UNITPRICE 单价,f.CURRENCY 币别 "; var sql1 = sql1 + " ,case CURRENCY when 'RMB' then amount else 0 end RMB金额 "; var sql1 = sql1 + " ,case CURRENCY when 'USD' then amount else 0 end USD金额 "; var sql1 = sql1 + " ,amount*EXCHANGERATE Total_in_RMB "; var sql1 = sql1 + " from ch_fee f "; var sql1 = sql1 + " left join v_op_bs m on (f.bsno=m.bsno) where 1=1 "; if (_T != "") { sql1 = sql1 + " and " + _T; } var sql1 = sql1 + " order by m.MBLNO,f.CUSTOMERNAME,f.feename "; //var sql1 = sql1 + T; //var sql1 = sql1 + " go "; var sql2= ""; var sql3 = ""; var sql4 = ""; var sql5 = ""; var sql6 = ""; PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6); }, OprationSwap: function () { var ret = new Array(); ret[0] = 'view'; ret[1] = this.BSNO; //ret[2] = this.SelectedRecord; return ret; } });