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.

408 lines
12 KiB
JavaScript

Ext.namespace('Shipping');
Shipping.MsRptDeptArrearsIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsRptDeptArrearsIndex.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsRptDeptArrearsIndex, Ext.Panel, {
PageSize: 2000,
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
sqlcontext: '1=2',
bslistsortfield: '',
bslistsortdire: '',
salelistsortfield: '',
salelistsortdire: '',
custlistsortfield: '',
custlistsortdire: '',
oplistsortfield: '',
oplistsortdire: '',
bssourcelistsortfield: '',
bssourcelistsortdire: '',
bssourcedetaillistsortfield: '',
bssourcedetaillistsortdire: '',
initUIComponents: function () {
this.formname = 'MsRptDeptArrearsIndex';
//定义数据集
this.storeList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
fields: [
{ name: 'GID', type: 'string' },
{ name: 'DEPT', type: 'string' },
{ name: 'MAXARREARS', type: 'number' },
{ name: 'DEPTTTLNODR', type: 'number' }
],
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsOp_BLISSUE/DeptARREARSListData',
reader: {
id: '',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//定义Grid
this.initgirdcolums = [{
sortable: true,
dataIndex: 'DEPT',
header: '销售部门',
width: 120
}, {
sortable: true,
dataIndex: 'MAXARREARS',
header: '部门额度',
width: 110
}, {
sortable: true,
dataIndex: 'DEPTTTLNODR',
header: '剩余额度',
width: 110
}
];
// this.girdcolums = this.initgirdcolums;
this.girdcolums = DsTruck.GetGridPanel(USERID, this.formname + 'bs', this.initgirdcolums, 1);
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
viewConfig: {
autoFill: true
},
columns: this.girdcolums,
// paging bar on the bottom
bbar: Ext.create('Ext.PagingToolbar', {
store: this.storeList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
})
});
// this.girdcolums = DsTruck.GetGridPanel(USERID, this.formname + 'bs', this.girdcolums, 1);
// this.gridList.reconfigure(this.storeList, this.girdcolums);
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";
openUrl = "../../MvcShipping/MsOp_BLISSUE/DeptArrearsDetail?handle=check&dept=" + record.data.DEPT;
window.open(openUrl, openType, openSet);
}, this);
_this = this;
//#region formSearch
//#region formSearch枚举参照相关
_this = this;
//#endregion
//#endregion formSearch
//查询工具条
_this = this;
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [
{
text: "执行查询",
iconCls: "btnrefresh",
handler: function (button, event) {
this.storeList.load();
},
scope: this
}, '-',{
text: "导出Excel",
id: "btnExportExcel",
iconCls: 'btnexportexcel',
handler: function (button, event) {
this.onExportClick(button, event);
},
scope: this
}, '-',
{
text: "打印",
iconCls: 'btnprint',
handler: function (button, event) {
this.Print();
},
scope: this
}, '-', {
text: "保存列表样式",
id: "btntest",
menu: [
{ text: "保存列表",
handler: function (button, event) {
_this.onSaveGridClick(button, event);
}
}, { text: "列表初始化",
handler: function (button, event) {
_this.oninitGridClick(button, event);
}
}],
scope: this
}
]
});
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 29,
items: [this.panelBtn]
});
this.panelBody = new Ext.Panel({
layout: "border",
region: 'center',
margin: '0 0',
frame: true,
items: [
this.gridList]
});
Ext.apply(this, {
items: [this.panelTop, this.panelBody]
});
this.storeList.load();
// this.storeList.on('beforeload', function (store) {
// if (!this.checkSearchCondition())
// return;
// var sql = this.getCondition();
// Ext.apply(store.proxy.extraParams, { condition: sql });
// }, this);
// LoadQueryData(this.formname, this.formSearch, this.CheckSaveQuery);
}, //end initUIComponents
onRefreshClick: function (button, event) {
if (!this.checkSearchCondition())
return;
var form = this.formSearch.getForm();
var form = this.formSearch.getForm();
var expDate_Min = form.findField('PS_EXPDATEBGN').getRawValue();
var expDate_Max = form.findField('PS_EXPDATEEND').getRawValue();
var ACCOUNT = form.findField('ACCOUNT').getValue();
var sql = this.getCondition();
this.sqlcontext = sql;
this.storeList.load({
params: { start: 0, limit: this.PageSize, condition: sql, startdate: expDate_Min, enddate: expDate_Max, account: ACCOUNT },
waitMsg: "正在查询数据...",
scope: this
});
},
getCondition: function () {
var form = this.formSearch.getForm();
var sql = '';
var expDate_Min = form.findField('PS_EXPDATEBGN').getRawValue();
sql = sql + getAndConSql(sql, expDate_Min, " BILLDATE>='" + expDate_Min + "'");
var expDate_Max = form.findField('PS_EXPDATEEND').getRawValue();
sql = sql + getAndConSql(sql, expDate_Max, " BILLDATE<='" + expDate_Max + " 23:59:59'");
var ACCOUNT = form.findField('ACCOUNT').getValue();
sql = sql + getAndConSql(sql, ACCOUNT, "ACCOUNT='" + ACCOUNT + "'");
var CURR = form.findField('CURR').getValue();
sql = sql + getAndConSql(sql, CURR, "CURRENCY='" + CURR + "'");
var CUSTOMERNAME = form.findField('CUSTOMERNAME').getValue();
sql = sql + getAndConSql(sql, CUSTOMERNAME, "CUSTOMERNAME='" + CUSTOMERNAME + "'");
var FEENAME = form.findField('FEENAME').getValue();
sql = sql + getAndConSql(sql, FEENAME, "FEENAME='" + FEENAME + "'");
return sql;
},
checkSearchCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return false;
}
return true;
},
onClearSql: function () {
var form = this.formSearch.getForm();
form.reset();
},
OprationSwap: function () {
var ret = new Array();
ret[0] = this.OprationStatus;
ret[1] = this.storeList;
ret[2] = this.SelectedRecord;
ret[3] = "MsRptCwFundsIndex";
return ret;
},
onSaveGridClick: function (button, event) {
this.girdcolums = DsTruck.SaveGridPanel(USERID, this.formname + 'bs', this.gridList.columns, this.girdcolums, 1, true);
},
oninitGridClick: function (button, event) {
var agirdcolums = this.initgirdcolums;
this.gridList.reconfigure(this.storeList, agirdcolums);
this.girdcolums = DsTruck.SaveGridPanel(USERID, this.formname + 'bs', this.gridList.columns, this.initgirdcolums, 1, true);
},
onExportClick: function (button, event) {
GridExportExcelPage(this.gridList);
},
Print: function () {
_this = this;
if (this.storeList.getCount() == 0) {
return;
}
var form = this.formSearch.getForm();
var form = this.formSearch.getForm();
var expDate_Min = form.findField('PS_EXPDATEBGN').getRawValue();
var expDate_Max = form.findField('PS_EXPDATEEND').getRawValue();
if (expDate_Min == '' || expDate_Min == null || expDate_Min == undefined) {
Ext.Msg.alert('提示', '开始业务日期不能为空!');
return;
}
if (expDate_Max == '' || expDate_Max == null || expDate_Max == undefined) {
Ext.Msg.alert('提示', '结束业务日期不能为空!');
return;
}
var expDate_Mindate = form.findField('PS_EXPDATEBGN').getValue();
var expDate_Maxdate = form.findField('PS_EXPDATEEND').getValue();
if (expDate_Mindate > expDate_Maxdate) {
Ext.Msg.alert('提示', '业务开始日期不能大于结束日期!');
return;
}
var ACCOUNT = form.findField('ACCOUNT').getValue();
Ext.Msg.wait('正在组织数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在组织数据...',
url: '/MvcShipping/MsRptCwFunds/SumListData',
scope: this,
params: {
start: 0, limit: this.PageSize,
condition: _this.sqlcontext,
startdate: expDate_Min,
account: ACCOUNT,
printstr: 'true'
},
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 = 'MSRPTCWFUNDS';
var sql1 = returnstr;
var sql2 = "";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
} else {
Ext.Msg.show({ title: '错误', 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
});
}
}
});
}
});