|
|
Ext.namespace('Shipping');
|
|
|
|
|
|
Shipping.RptCwPLIndex = function (config) {
|
|
|
Ext.applyIf(this, config);
|
|
|
this.initUIComponents();
|
|
|
window.Shipping.RptCwPLIndex.superclass.constructor.call(this);
|
|
|
};
|
|
|
|
|
|
Ext.extend(Shipping.RptCwPLIndex, Ext.Panel, {
|
|
|
PageSize: 1000,
|
|
|
SelectedRecord: null,
|
|
|
sqlcontext: '',
|
|
|
strCwSTARTGID: '',
|
|
|
|
|
|
initUIComponents: function () {
|
|
|
this.formname = "formRptCwPLIndex"; //利润表
|
|
|
|
|
|
//#region 定义数据集
|
|
|
this.storeList = Ext.create('Ext.data.Store', {
|
|
|
pageSize: this.PageSize,
|
|
|
model: 'RptCwPLModel',
|
|
|
remoteSort: true,
|
|
|
proxy: {
|
|
|
type: 'ajax',
|
|
|
url: '/MvcShipping/RptCwPL/GetDataList',
|
|
|
reader: {
|
|
|
id: 'GID',
|
|
|
root: 'data',
|
|
|
totalProperty: 'totalCount'
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
//#endregion
|
|
|
|
|
|
//#region 定义列
|
|
|
this.girdcolums = [{
|
|
|
sortable: false,
|
|
|
dataIndex: 'GID',
|
|
|
header: '唯一编码',
|
|
|
width: 0
|
|
|
}, {
|
|
|
sortable: false,
|
|
|
dataIndex: 'ACCTYPE',
|
|
|
header: '项目',
|
|
|
width: 300
|
|
|
}, {
|
|
|
sortable: false,
|
|
|
dataIndex: 'QTYBLC',
|
|
|
header: '本月金额',
|
|
|
align: 'right',
|
|
|
width: 100,
|
|
|
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
|
|
|
value = usMoney(value, 2, '', true);
|
|
|
return value;
|
|
|
}
|
|
|
}, {
|
|
|
sortable: false,
|
|
|
dataIndex: 'QTYLASTBLC',
|
|
|
header: '本年累计金额',
|
|
|
align: 'right',
|
|
|
width: 100,
|
|
|
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
|
|
|
value = usMoney(value, 2, '', true);
|
|
|
return value;
|
|
|
}
|
|
|
}];
|
|
|
//#endregion
|
|
|
|
|
|
//#region List列表显示信息
|
|
|
Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, {
|
|
|
width: 30
|
|
|
});
|
|
|
|
|
|
//定义Grid
|
|
|
this.gridList = new Ext.grid.GridPanel({
|
|
|
store: this.storeList,
|
|
|
region: 'center',
|
|
|
loadMask: { msg: "数据加载中,请稍等..." },
|
|
|
enableHdMenu: false, //是否显示表格列的菜单
|
|
|
stripeRows: true, //斑马线效果
|
|
|
rowLines: true,
|
|
|
columnLines: true,
|
|
|
columns: this.girdcolums,
|
|
|
viewConfig: {
|
|
|
enableTextSelection: true, //允许复制数据
|
|
|
autoFill: true
|
|
|
},
|
|
|
// paging bar on the bottom
|
|
|
bbar: Ext.create('Ext.PagingToolbar', {
|
|
|
store: this.storeList,
|
|
|
displayInfo: true,
|
|
|
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
|
|
|
emptyMsg: "没有数据"
|
|
|
})
|
|
|
});
|
|
|
|
|
|
/////////////以下部分为获取存储的gridpanel显示样式
|
|
|
this.column = DsTruck.GetGridPanel(USERID, this.formname, this.girdcolums, 1); //使用者id,表名,中间column数组,跳过一开始的几列
|
|
|
this.gridList.reconfigure(this.storeList, this.girdcolums);
|
|
|
this.gridList.columns[0] = new Ext.grid.RowNumberer();
|
|
|
////////////////////////////////////////////////
|
|
|
this.gridList.addListener('cellClick', function (grid, td, columnIndex, record, tr, rowIndex, b, Object) {
|
|
|
if (columnIndex == 1) {
|
|
|
if (rowIndex != 3 && rowIndex != 8 && rowIndex != 12 && rowIndex != 14) {
|
|
|
this.SelectedRecord = record;
|
|
|
DsOpenEditWin('/MvcShipping/RptCwPL/Edit', "编辑公式", "500", "940", "10", "10");
|
|
|
}
|
|
|
}
|
|
|
}, this);
|
|
|
//#endregion
|
|
|
|
|
|
//#region formSearch 查询面板
|
|
|
this.formSearch = Ext.widget('form', {
|
|
|
frame: true,
|
|
|
region: 'center',
|
|
|
bodyPadding: 5,
|
|
|
fieldDefaults: {
|
|
|
margins: '2 2 2 2',
|
|
|
labelAlign: 'right',
|
|
|
flex: 1,
|
|
|
labelWidth: 60,
|
|
|
msgTarget: 'qtip'
|
|
|
},
|
|
|
items: [{//fieldset 1
|
|
|
xtype: 'container',
|
|
|
defaultType: 'textfield',
|
|
|
items: [{
|
|
|
fieldLabel: '会计期间',
|
|
|
xtype: 'monthfield',
|
|
|
editable: false,
|
|
|
id: 'ACCDATE',
|
|
|
name: 'ACCDATE',
|
|
|
enableKeyEvents: true, //激活键盘事件
|
|
|
listeners: {
|
|
|
scope: this,
|
|
|
'keyup': {
|
|
|
fn: function (_field, e) {
|
|
|
if (e.getKey() == 13) {
|
|
|
this.onRefreshClick();
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
}
|
|
|
}
|
|
|
}]
|
|
|
}]//end items(fieldset 1)
|
|
|
});
|
|
|
//#endregion formSearch
|
|
|
|
|
|
//#region 按钮工具条
|
|
|
this.panelBtn = new Ext.Panel({
|
|
|
region: "center",
|
|
|
border: false,
|
|
|
tbar: [{
|
|
|
text: "重新计算",
|
|
|
iconCls: "btnadd",
|
|
|
handler: function (button, event) {
|
|
|
this.getRecount(button, event);
|
|
|
},
|
|
|
scope: this
|
|
|
}, {
|
|
|
text: "执行查询",
|
|
|
iconCls: "btnrefresh",
|
|
|
handler: function (button, event) {
|
|
|
this.onRefreshClick(button, event);
|
|
|
},
|
|
|
scope: this
|
|
|
}
|
|
|
// , {
|
|
|
// text: "重置条件",
|
|
|
// iconCls: "btnreset",
|
|
|
// handler: function (button, event) {
|
|
|
// this.onClearSql(button, event);
|
|
|
// },
|
|
|
// 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
|
|
|
}]
|
|
|
});
|
|
|
//#endregion
|
|
|
|
|
|
//#region 页面布局
|
|
|
this.panelZQ = new Ext.Panel({
|
|
|
layout: "border",
|
|
|
region: "east",
|
|
|
width: 500,
|
|
|
style: 'text-align:right;',
|
|
|
border: false,
|
|
|
items: [{
|
|
|
xtype: 'displayfield',
|
|
|
id: 'lbTitle2',
|
|
|
name: 'lbTitle2',
|
|
|
value: " "
|
|
|
}]
|
|
|
});
|
|
|
|
|
|
this.panelTopF = new Ext.Panel({
|
|
|
layout: "border",
|
|
|
region: "north",
|
|
|
height: 26,
|
|
|
//border: false,
|
|
|
items: [this.panelBtn, this.panelZQ]
|
|
|
});
|
|
|
|
|
|
this.panelTop = new Ext.Panel({
|
|
|
layout: "border",
|
|
|
region: "north",
|
|
|
height: 65,
|
|
|
border: false,
|
|
|
items: [this.panelTopF, this.formSearch]
|
|
|
});
|
|
|
|
|
|
Ext.apply(this, {
|
|
|
border: false,
|
|
|
items: [this.panelTop, this.gridList]
|
|
|
});
|
|
|
//#endregion
|
|
|
|
|
|
//#region 页面加载
|
|
|
//this.onRefreshClick();
|
|
|
this.storeList.on('beforeload', function (store) {
|
|
|
var sACCDATE = this.getACCDATE();
|
|
|
if (sACCDATE.toString() != "") {
|
|
|
Ext.apply(store.proxy.extraParams, { TEMPLATE: this.formname, ACCDATE: sACCDATE });
|
|
|
}
|
|
|
}, this);
|
|
|
//加载事件
|
|
|
this.InitData();
|
|
|
//#endregion
|
|
|
}, //end initUIComponents
|
|
|
|
|
|
//#region 加载事件
|
|
|
InitData: function () {
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在查询主表数据...',
|
|
|
url: '/MvcShipping/RptCwGenlegAccitems/GetData',
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
var result = Ext.JSON.decode(response.responseText);
|
|
|
if (!result.Success) {
|
|
|
return;
|
|
|
}
|
|
|
data = result.data;
|
|
|
var arrtmp = data.toString().split("&");
|
|
|
this.strCwSTARTGID = arrtmp[0].toString();
|
|
|
var strCwSTARTNAME = arrtmp[1].toString();
|
|
|
var strCwACCDATE = arrtmp[2].toString();
|
|
|
var sYear = arrtmp[3].toString();
|
|
|
var sMonth = arrtmp[4].toString();
|
|
|
//
|
|
|
var sZQ = " 当前登录账套:“" + strCwSTARTNAME + "” 当前财务账期:“" + sYear + "年第" + sMonth + "期” ";
|
|
|
Ext.getCmp("lbTitle2").setValue(sZQ);
|
|
|
Ext.getCmp("ACCDATE").setValue(strCwACCDATE);
|
|
|
//
|
|
|
this.onRefreshClick();
|
|
|
} else {
|
|
|
//Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
});
|
|
|
}, //end InitData
|
|
|
//#endregion
|
|
|
|
|
|
//#region 执行查询
|
|
|
onRefreshClick: function (button, event) {
|
|
|
var sACCDATE = this.getACCDATE();
|
|
|
if (sACCDATE.toString() != "") {
|
|
|
this.sqlcontext = sACCDATE;
|
|
|
this.storeList.load({ params: { start: 0, limit: this.PageSize, sort: '', TEMPLATE: this.formname, ACCDATE: sACCDATE }, waitMsg: "正在查询数据...", scope: this });
|
|
|
}
|
|
|
},
|
|
|
//#endregion
|
|
|
|
|
|
//#region 查询
|
|
|
getACCDATE: function () {
|
|
|
var form = this.formSearch.getForm();
|
|
|
//会计期间
|
|
|
var sACCDATE = form.findField('ACCDATE').getRawValue();
|
|
|
if (sACCDATE.toString() == "") {
|
|
|
alert('请先选择会计期间!');
|
|
|
return '';
|
|
|
}
|
|
|
//sACCDATE = " and ACCDATE='" + sACCDATE + "'";
|
|
|
return sACCDATE;
|
|
|
},
|
|
|
//#endregion
|
|
|
|
|
|
//#region 重置条件
|
|
|
onClearSql: function () {
|
|
|
var form = this.formSearch.getForm();
|
|
|
form.reset();
|
|
|
}, //onDeleteClick
|
|
|
//#endregion
|
|
|
|
|
|
//#region 重新计算
|
|
|
getRecount: function () {
|
|
|
var sACCDATE = this.getACCDATE();
|
|
|
if (sACCDATE.toString() != "") {
|
|
|
this.sqlcontext = sACCDATE;
|
|
|
Ext.Msg.wait('正在计算数据, 请稍侯..');
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在计算数据...',
|
|
|
url: '/MvcShipping/RptCwPL/GetRecount',
|
|
|
params: { TEMPLATE: this.formname, ACCDATE: sACCDATE },
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
this.onRefreshClick();
|
|
|
} else {
|
|
|
//Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
|
|
|
}
|
|
|
Ext.Msg.hide();
|
|
|
},
|
|
|
timeout: 3000000,//30秒
|
|
|
scope: this
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
//#endregion
|
|
|
|
|
|
//#region 导出Excel
|
|
|
onExportClick: function (button, event) {
|
|
|
if (this.storeList.getCount() == 0) {
|
|
|
return;
|
|
|
}
|
|
|
var sACCDATE = this.getACCDATE();
|
|
|
|
|
|
//Ext.Msg.wait('正在组织数据, 请稍侯..');
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在组织数据, 请稍侯...',
|
|
|
url: '/MvcShipping/RptCwPL/GetDataListSQL',
|
|
|
params: { TEMPLATE: this.formname, ACCDATE: sACCDATE, printstr: 'true' },
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
var ddd = Ext.MessageBox.isVisible();
|
|
|
if (Ext.MessageBox.isVisible()) {
|
|
|
Ext.MessageBox.hide();
|
|
|
}
|
|
|
var jsonresult = Ext.JSON.decode(response.responseText);
|
|
|
if (jsonresult.Success) {
|
|
|
var returnStr = jsonresult.data;
|
|
|
if (returnStr.toString() != "") {
|
|
|
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 condition1 = escape(returnStr.toString());
|
|
|
var openUrl = "../../Reports/RptExport.aspx?handle=RptCwPLIndex&formname=" + this.formname + "&condition1=" + condition1;
|
|
|
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
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
});
|
|
|
},
|
|
|
|
|
|
//ExtJs 自带的导出当前页的excel导出函数
|
|
|
onExportClick2: function (button, event) {
|
|
|
GridExportExcelPage(this.gridList);
|
|
|
},
|
|
|
//#endregion
|
|
|
|
|
|
//#region 打印
|
|
|
Print: function () {
|
|
|
if (this.storeList.getCount() == 0) {
|
|
|
return;
|
|
|
}
|
|
|
var sACCDATE = this.getACCDATE();
|
|
|
|
|
|
//Ext.Msg.wait('正在组织数据, 请稍侯..');
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在组织数据, 请稍侯...',
|
|
|
url: '/MvcShipping/RptCwPL/GetDataListStr',
|
|
|
params: { TEMPLATE: this.formname, ACCDATE: sACCDATE, printstr: 'true' },
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
var ddd = Ext.MessageBox.isVisible();
|
|
|
if (Ext.MessageBox.isVisible()) {
|
|
|
Ext.MessageBox.hide();
|
|
|
}
|
|
|
var jsonresult = Ext.JSON.decode(response.responseText);
|
|
|
if (jsonresult.Success) {
|
|
|
var returnStr = jsonresult.data;
|
|
|
var printType = 'RptCwPLList';
|
|
|
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
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
});
|
|
|
},
|
|
|
//#endregion
|
|
|
|
|
|
OprationSwap: function () {
|
|
|
var ret = new Array();
|
|
|
ret[0] = this.SelectedRecord;
|
|
|
return ret;
|
|
|
}
|
|
|
});
|