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.

828 lines
35 KiB
JavaScript

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

Ext.namespace('Shipping');
Shipping.RptCtGenlegAccitemsMonthIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.RptCtGenlegAccitemsMonthIndex.superclass.constructor.call(this);
};
Ext.extend(Shipping.RptCtGenlegAccitemsMonthIndex, Ext.Panel, {
PageSize: 1000,
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
sqlcontext: '',
initUIComponents: function () {
this.formname = "formRptCtGenlegAccitemsMonthIndex"; //页面名称
//#region formSearch 下拉框信息加载
//银行存款科目加载
this.storeCwAccitems = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CwAccitemsGlModel',
proxy: { url: '/CommMng/BasicDataRef/GetCwAccitemsGl' }
});
this.storeCwAccitems.load({ params: { condition: "DETAILED=1 and ISENABLE=1 and ISBANK=1"} });
this.comboxACCID = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '银行科目',
store: this.storeCwAccitems,
forceSelection: true, //输入值是否严格为待选列表中存在的值
id: 'ACCID',
name: 'ACCID',
valueField: 'ACCID',
displayField: 'ACCIDNAME',
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (combo.value != null) {
var sGID = "";
var AccitemsList = DsStoreQueryBy(this.storeCwAccitems, 'ACCID', combo.value.toString());
if (AccitemsList.length > 0) {
var AccitemsRaw = AccitemsList.getAt(0).raw;
sGID = AccitemsRaw.GID.toString();
}
if (sGID != "") {
this.storeCwAccitemsCurrency.load({
params: { condition: "LINKGID = '" + sGID + "'" },
callback: function (options, success, response) {
var combo = Ext.getCmp("CURRENCY");
combo.setValue(options[0].data.CURRENCY.toString()); //选中
this.onRefreshClick();
},
scope: this
});
}
}
}
}
});
//币别选项
this.storeCwAccitemsCurrency = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CwAccitemsCurrencyModel',
proxy: { url: '/CommMng/BasicDataRef/GetCwAccitemsCurrencyList' }
});
this.storeCwAccitemsCurrency.load({ params: { condition: ""} });
this.comboxCwAccitemsCurrency = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '币别',
store: this.storeCwAccitemsCurrency,
forceSelection: true, //输入值是否严格为待选列表中存在的值
id: 'CURRENCY',
name: 'CURRENCY',
valueField: 'CURRENCY',
displayField: 'CURRENCY',
allowBlank: false,
value: 'RMB',
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'select': function (_Field, newValue, eOpts) {
if (_Field.value != null) {
this.onRefreshClick();
}
}
}
});
//#endregion
//#region formSearch 查询面板
this.formSearch = Ext.widget('form', {
frame: true,
region: 'north',
height: 45,
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 60,
msgTarget: 'qtip'
},
items: [{
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxACCID, this.comboxCwAccitemsCurrency, {
fieldLabel: '会计期间',
xtype: 'monthfield',
editable: false,
allowBlank: false, //是否允许为空
id: 'ACCDATEbgn',
name: 'ACCDATEbgn',
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'keyup': {
fn: function (_field, e) {
if (e.getKey() == 13) {
this.onRefreshClick();
}
},
scope: this
}
}
}, {
fieldLabel: '至',
xtype: 'monthfield',
editable: false,
allowBlank: false, //是否允许为空
id: 'ACCDATEend',
name: 'ACCDATEend',
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'keyup': {
fn: function (_field, e) {
if (e.getKey() == 13) {
this.onRefreshClick();
}
},
scope: this
}
}
}]
}]
}]
});
//#endregion formSearch
this.storeList = null;
//#region 定义列
this.girdcolums = [{
sortable: false,
dataIndex: 'GID',
header: '唯一编码',
width: 0
},
{
sortable: false,
dataIndex: 'LINKCODE',
header: '科目代码',
width: 80
},
{
sortable: false,
dataIndex: 'LINKNAME',
header: '科目名称',
width: 150
},
{
sortable: false,
dataIndex: 'DC',
header: '方向',
align: 'center',
width: 35
}, {
sortable: false,
dataIndex: 'QTYYEARBLC',
header: '期初余额',
align: 'right',
width: 100,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
}, {
sortable: false,
dataIndex: 'QTYDR',
header: '本期借方',
align: 'right',
width: 100,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
}, {
sortable: false,
dataIndex: 'QTYCR',
header: '本期贷方',
align: 'right',
width: 100,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
sortable: false,
dataIndex: 'DC2',
header: '方向',
align: 'center',
width: 35
}, {
sortable: false,
dataIndex: 'QTYLASTBLC',
header: '期末余额',
align: 'right',
width: 100,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
sortable: false,
dataIndex: 'iDR',
header: '借方笔数',
align: 'center',
width: 60
},
{
sortable: false,
dataIndex: 'iCR',
header: '贷方笔数',
align: 'center',
width: 60
}];
//#endregion
//#region 定义列2
this.girdcolums2 = [{
sortable: false,
dataIndex: 'GID',
header: '唯一编码',
width: 0
},
{
sortable: false,
dataIndex: 'LINKCODE',
header: '科目代码',
width: 80
},
{
sortable: false,
dataIndex: 'LINKNAME',
header: '科目名称',
width: 150
}];
//#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, //是否显示表格列的菜单
hideHeaders: false, //是否隐藏表头
enableColumnHide: false, ///隐藏表头列
sortableColumns: false, ///隐藏表头排序
stripeRows: true, //斑马线效果
rowLines: true,
trackMouseOver: true,
disableSelection: false,
columnLines: true,
columns: this.girdcolums2,
viewConfig: {
enableTextSelection: true, //允许复制数据
autoFill: true
}
});
//#endregion
//#region 按钮工具条
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [{
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 页面布局
Ext.apply(this, {
items: [this.panelBtn, this.formSearch, this.gridList]
});
//#endregion
//#region 页面加载
this.InitData();
}, //end initUIComponents
//#region 加载事件
InitData: function () {
Ext.Ajax.request({
waitMsg: '正在查询...',
url: '/MvcShipping/MsCtBankJournal/GetInitData',
params: {
isInitial: this.isInitial
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
return;
}
//var data = result.data;
var strArg = result.data.toString().split("");
this.strCtSTARTGID = strArg[0].toString();
this.strACCDATE = strArg[1].toString();
this.strACCDAY = strArg[2].toString();
this.strACCTODAY = strArg[3].toString();
//
Ext.getCmp("ACCDATEbgn").setValue(this.strACCDATE);
Ext.getCmp("ACCDATEend").setValue(this.strACCDATE);
} else {
//Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}, //end InitData
//#endregion
//#region 执行查询
onRefreshClick: function (button, event) {
var form = this.formSearch.getForm();
if (!form.isValid()) {
//Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var ACCDATEbgn = form.findField('ACCDATEbgn').getRawValue();
var ACCDATEend = form.findField('ACCDATEend').getRawValue();
var sACCID = form.findField('ACCID').getValue();
var sCURRENCY = form.findField('CURRENCY').getValue();
//
//#region 定义临时数据集_storeMonthData
var zlcolumn = [];
var myfield = [];
var custfield = [];
var storeMonthData = Ext.create('DsExt.ux.RefTableStore', {
fields: [
{name: 'AMTYEARDR', type: 'decimal' }, //RMB年初借方
{name: 'AMTYEARCR', type: 'decimal' }, //RMB年初贷方
{name: 'AMTYEARBLC', type: 'decimal' }, //RMB年初余额
{name: 'AMTDR', type: 'decimal' }, //RMB本月借方
{name: 'AMTCR', type: 'decimal' }, //RMB本月贷方
{name: 'AMTBLC', type: 'decimal' }, //RMB本月余额
{name: 'AMTLASTDR', type: 'decimal' }, //RMB累计借方
{name: 'AMTLASTCR', type: 'decimal' }, //RMB累计贷方
{name: 'AMTLASTBLC', type: 'decimal' }, //RMB累计余额
{name: 'FCYYEARDR', type: 'decimal' }, //USD年初借方
{name: 'FCYYEARCR', type: 'decimal' }, //USD年初贷方
{name: 'FCYYEARBLC', type: 'decimal' }, //USD年初余额
{name: 'FCYDR', type: 'decimal' }, //USD本月借方
{name: 'FCYCR', type: 'decimal' }, //USD本月贷方
{name: 'FCYBLC', type: 'decimal' }, //USD本月余额
{name: 'FCYLASTDR', type: 'decimal' }, //外币累计借方
{name: 'FCYLASTCR', type: 'decimal' }, //外币累计贷方
{name: 'FCYLASTBLC', type: 'decimal' }, //外币累计余额
{name: 'QTYYEARDR', type: 'decimal' }, //年初借方
{name: 'QTYYEARCR', type: 'decimal' }, //年初贷方
{name: 'QTYYEARBLC', type: 'decimal' }, //年初余额
{name: 'QTYDR', type: 'decimal' }, //本月借方
{name: 'QTYCR', type: 'decimal' }, //本月贷方
{name: 'QTYBLC', type: 'decimal' }, //本月余额
{name: 'QTYLASTDR', type: 'decimal' }, //累计借方
{name: 'QTYLASTCR', type: 'decimal' }, //累计贷方
{name: 'QTYLASTBLC', type: 'decimal' }, //累计余额
{name: 'DC', type: 'string' },
{name: 'DC2', type: 'string' }
],
proxy: { url: '/MvcShipping/RptCtGenlegAccitemsMonth/GetDataList' }
});
//#endregion
//
_this = this;
//this.sqlcontext = sql;
storeMonthData.load({ params: { start: 0, limit: this.PageSize, sort: '', ACCDATEbgn: ACCDATEbgn, ACCDATEend: ACCDATEend, sACCID: sACCID, sCURRENCY: sCURRENCY },
waitMsg: "正在查询数据...",
callback: function (r, options, success) {
if (success) {
//if (r.length != 0) {
var zlcolumn = [];
var sCURRENCY = this.formSearch.getForm().findField('CURRENCY').getValue();
if (sCURRENCY == "RMB") {
//#region 列表zlcolumn
myfield.push({ name: 'GID', type: 'string' });
myfield.push({ name: 'LINKCODE', type: 'string' });
myfield.push({ name: 'LINKNAME', type: 'string' });
myfield.push({ name: 'DC', type: 'string' });
myfield.push({ name: 'QTYYEARBLC', type: 'decimal' });
myfield.push({ name: 'QTYDR', type: 'decimal' });
myfield.push({ name: 'QTYCR', type: 'decimal' });
myfield.push({ name: 'DC2', type: 'string' });
myfield.push({ name: 'QTYLASTBLC', type: 'decimal' });
myfield.push({ name: 'iDR', type: 'string' });
myfield.push({ name: 'iCR', type: 'string' });
//
zlcolumn.push({
sortable: false,
dataIndex: 'QTYYEARBLC',
header: '期初余额',
align: 'right',
width: 100,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
sortable: false,
dataIndex: 'DC',
header: '方向',
align: 'center',
width: 35
}, {
sortable: false,
dataIndex: 'QTYDR',
header: '本期借方',
align: 'right',
width: 100,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
}, {
sortable: false,
dataIndex: 'QTYCR',
header: '本期贷方',
align: 'right',
width: 100,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
sortable: false,
dataIndex: 'DC2',
header: '方向',
align: 'center',
width: 35
}, {
sortable: false,
dataIndex: 'QTYLASTBLC',
header: '期末余额',
align: 'right',
width: 100,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
sortable: false,
dataIndex: 'iDR',
align: 'center',
header: '借方笔数',
width: 60
},
{
sortable: false,
dataIndex: 'iCR',
align: 'center',
header: '贷方笔数',
width: 60
});
//#endregion
}
else {
//#region 列表zlcolumn
myfield.push({ name: 'GID', type: 'string' });
myfield.push({ name: 'LINKCODE', type: 'string' });
myfield.push({ name: 'LINKNAME', type: 'string' });
myfield.push({ name: 'DC', type: 'string' });
myfield.push({ name: 'FCYYEARBLC', type: 'decimal' });
myfield.push({ name: 'QTYYEARBLC', type: 'decimal' });
myfield.push({ name: 'FCYDR', type: 'decimal' });
myfield.push({ name: 'QTYDR', type: 'decimal' });
myfield.push({ name: 'FCYCR', type: 'decimal' });
myfield.push({ name: 'QTYCR', type: 'decimal' });
myfield.push({ name: 'DC2', type: 'string' });
myfield.push({ name: 'FCYLASTBLC', type: 'decimal' });
myfield.push({ name: 'QTYLASTBLC', type: 'decimal' });
myfield.push({ name: 'iDR', type: 'string' });
myfield.push({ name: 'iCR', type: 'string' });
//
zlcolumn.push({
sortable: false,
dataIndex: 'DC',
header: '方向',
align: 'center',
width: 35
}, {
text: '期初余额',
sortable: false,
columns: [{
sortable: false,
dataIndex: 'FCYYEARBLC',
header: '原币',
align: 'right',
width: 100,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
}, {
sortable: false,
dataIndex: 'QTYYEARBLC',
header: '本位币',
align: 'right',
width: 100,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
}]
}, {
text: '本期借方',
sortable: false,
columns: [{
sortable: false,
dataIndex: 'FCYDR',
header: '原币',
align: 'right',
width: 100,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
}, {
sortable: false,
dataIndex: 'QTYDR',
header: '本位币',
align: 'right',
width: 100,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
}]
}, {
text: '本期贷方',
sortable: false,
columns: [{
sortable: false,
dataIndex: 'FCYCR',
header: '原币',
align: 'right',
width: 100,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
}, {
sortable: false,
dataIndex: 'QTYCR',
header: '本位币',
align: 'right',
width: 100,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
}]
},
{
sortable: false,
dataIndex: 'DC2',
header: '方向',
align: 'center',
width: 35
}, {
text: '期末余额',
sortable: false,
columns: [{
sortable: false,
dataIndex: 'FCYLASTBLC',
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;
}
}]
},
{
sortable: false,
dataIndex: 'iDR',
align: 'center',
header: '借方笔数',
width: 60
},
{
sortable: false,
dataIndex: 'iCR',
align: 'center',
header: '贷方笔数',
width: 60
});
//#endregion
}
//#region 定义 数据集
for (var k in myfield) {
custfield.push(myfield[k]);
}
//
Ext.define('RptCtGenlegAccitemsMonthModel', {
extend: 'Ext.data.Model',
fields: custfield
});
this.storeList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'RptCtGenlegAccitemsMonthModel',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/RptCtGenlegAccitemsMonth/GetDataList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//#endregion
//#region 重载 数据集_列样式
this.girdcolums2 = [{
sortable: false,
dataIndex: 'GID',
header: '唯一编码',
width: 0
},
{
sortable: false,
dataIndex: 'LINKCODE',
header: '科目代码',
width: 80
},
{
sortable: false,
dataIndex: 'LINKNAME',
header: '科目名称',
width: 150
}];
for (var k in zlcolumn) {
this.girdcolums2.push(zlcolumn[k]);
}
this.gridList.reconfigure(this.storeList, this.girdcolums2);
//#endregion
//#region 加载 数据集
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', ACCDATEbgn: ACCDATEbgn, ACCDATEend: ACCDATEend, sACCID: sACCID, sCURRENCY: sCURRENCY },
waitMsg: "正在查询数据...",
scope: this
});
this.storeList.on('beforeload', function (store) {
Ext.apply(store.proxy.extraParams, { ACCDATEbgn: ACCDATEbgn, ACCDATEend: ACCDATEend, sACCID: sACCID, sCURRENCY: sCURRENCY });
}, this);
//#endregion
//}
}
},
scope: this
});
},
//#endregion
//#region 重置条件
onClearSql: function () {
var form = this.formSearch.getForm();
form.reset();
this.onRefreshClick();
},
//#endregion
//#region 导出Excel
onExportClick: function (button, event) {
if (this.storeList.getCount() == 0) {
//return;
}
var ACCDATEbgn = this.formSearch.getForm().findField('ACCDATEbgn').getRawValue();
var ACCDATEend = this.formSearch.getForm().findField('ACCDATEend').getRawValue();
var sACCID = this.formSearch.getForm().findField('ACCID').getValue();
var sCURRENCY = this.formSearch.getForm().findField('CURRENCY').getValue();
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=RptCtGenlegAccitemsMonthIndex&formname=" + this.formname + "&condition1=" + escape(ACCDATEbgn) + "&condition2=" + escape(ACCDATEend) + "&condition3=" + escape(sACCID) + "&condition4=" + escape(sCURRENCY);
window.open(openUrl, openType, openSet);
},
//ExtJs 自带的导出当前页的excel导出函数
onExportClick2: function (button, event) {
GridExportExcelPage(this.gridList);
},
//#endregion
//#region 打印
Print: function () {
_this = this;
if (this.storeList.getCount() == 0) {
return;
}
var ACCDATEbgn = this.formSearch.getForm().findField('ACCDATEbgn').getRawValue();
var ACCDATEend = this.formSearch.getForm().findField('ACCDATEend').getRawValue();
var sACCID = this.formSearch.getForm().findField('ACCID').getValue();
var sCURRENCY = this.formSearch.getForm().findField('CURRENCY').getValue();
//Ext.Msg.wait('正在组织数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在组织数据, 请稍侯...',
url: '/MvcShipping/RptCtGenlegAccitemsMonth/GetDataListStr',
params: {
ACCDATEbgn: ACCDATEbgn,
ACCDATEend: ACCDATEend,
sACCID: sACCID,
sCURRENCY: sCURRENCY,
sTYPE: "print"
},
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 = 'RptCtGenlegAccitemsMonthList';
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.OprationStatus;
ret[1] = this.storeList;
ret[2] = this.SelectedRecord;
return ret;
}
});