You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
DS7/DSWeb/Areas/Import/Viewsjs/RptFeeTotal/RptFeeTotalIndex.js

342 lines
11 KiB
JavaScript

Ext.namespace('DsImportRpt');
DsImportRpt.RptFeeTotalIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.DsImportRpt.RptFeeTotalIndex.superclass.constructor.call(this);
};
Ext.extend(DsImportRpt.RptFeeTotalIndex, Ext.Panel, {
PageSize: 30,
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
initUIComponents: function () {
//定义数据集
this.storeList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
idProperty: 'Id',
fields: [
{ name: 'gid', type: 'string' },
{ name: 'HTH', type: 'string' },
{ name: 'CustomerName', type: 'string' },
{ name: 'AuditDate', type: 'string' },
{ name: 'bsno', type: 'string' },
{ name: 'FeeName', type: 'string' },
{ name: 'dotyperef', type: 'string' },
{ name: 'Y', type: 'string' },
{ name: 'S', type: 'string' },
{ name: 'name', type: 'string' },
{ name: 'jy', type: 'string' }
],
remoteSort: true,
proxy: {
type: 'ajax',
url: '/Import/RptFeeTotal/GetDataList',
reader: {
id: 'gid',
root: 'data',
totalProperty: 'totalCount'
}
}
});
Ext.define('Tradermb', {
extend: 'Ext.data.Model',
idProperty: 'gid',
fields: [
{ name: 'gid', type: 'string' },
{ name: 'name', type: 'string' },
{ name: 'codename', type: 'string' }
]
});
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: 'CustomerName',
valueField: 'name',
displayField: 'codename'
});
//定义Grid
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.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
columns: [{
sortable: true,
dataIndex: 'gid',
header: 'gid',hidden:true,
width: 76
}, {
sortable: true,
dataIndex: 'CustomerName',
header: '结算对象',
width: 80
}, {
sortable: true,
dataIndex: 'HTH',
header: '合同号/结算单号',
width: 125
}, {
sortable: true,
dataIndex: 'AuditDate',
header: '费用时间',
width: 130
}, {
sortable: true,
dataIndex: 'bsno',
header: 'bsno',hidden:true,
width: 60
}, {
sortable: true,
dataIndex: 'dotyperef',
header: '收付类型',
width: 90
}, {
sortable: true,
dataIndex: 'Y',
header: '应收/应付',
width: 90
}, {
sortable: true,
dataIndex: 'S',
header: '实收/实付',
width: 90
},{
sortable: true,
dataIndex: 'name',
header: '结余类型',
width: 70
}, {
sortable: true,
dataIndex: 'jy',
header: '结余',
width: 90
}
],
// paging bar on the bottom
bbar: [Ext.create('Ext.PagingToolbar', {
store: this.storeList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
}), this.Pagenum]
});
this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
// alert('0....' + dataview.toString() + ',' + record.toString() + ',' + item.toString() + ',' + index.toString() + ',' + e.toString() + ',' + b.toString());
this.SelectedRecord = record;
this.OprationStatus = 'edit';
DsOpenEditWin('/Import/XXH/Edit');
}, this);
//#region formSearch
//#region formSearch枚举参照相关
//#endregion
this.formSearch = Ext.widget('form', {
frame: true,
region: 'center',
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 90,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '合同号',
name: 'HTH',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, this.comboxCustomer,
{
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 1)
} //end fieldset 1
]//end root items
});
//#endregion formSearch
//查询工具条
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
}
]
});
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 105,
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();
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;
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 = " tt.dotyperef in ('应收','实际结算 实收') ";
//var sql = "";
var HTH = form.findField('HTH').getValue();
sql = sql + getAndConSql(sql, HTH, " tt.HTH like '%" + HTH + "%'");
var Customer = form.findField('CustomerName').getValue();
sql = sql + getAndConSql(sql, Customer, " tt.CustomerName like '%" + Customer + "%'");
var EnterDate_min = form.findField('EnterDate_min').getRawValue();
sql = sql + getAndConSql(sql, EnterDate_min, " tt.auditdate >= '" + EnterDate_min + "'");
var EnterDate_max = form.findField('EnterDate_max').getRawValue();
sql = sql + getAndConSql(sql, EnterDate_max, " tt.auditdate <= '" + EnterDate_max + " 23:59:59'");
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);
}
});