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/MvcShipping/Viewsjs/RptCtBankJSChecking/RptCtBankJSCheckingIndex.js

1255 lines
52 KiB
JavaScript

2 years ago
Ext.namespace('Shipping');
Shipping.RptCtBankJSCheckingIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.RptCtBankJSCheckingIndex.superclass.constructor.call(this);
};
Ext.extend(Shipping.RptCtBankJSCheckingIndex, Ext.Panel, {
PageSize: 1000,
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
sqlcontext: '',
initUIComponents: function () {
this.formname = "formRptCtBankJSCheckingIndex"; //页面名称
//#region formSearch 下拉框信息加载
//借贷方向
Ext.define('JSModel', { extend: 'Ext.data.Model', fields: [{ name: 'Name', type: 'string'}] });
var dataJS = [{ "Name": "银行日记账" }, { "Name": "银行对账单"}];
var storeJS = Ext.create('Ext.data.Store', { model: 'JSModel', data: dataJS });
this.comboxJS = Ext.create('DsExt.ux.RefTableCombox', {
//fieldLabel: '方向',
forceSelection: true,
store: storeJS,
id: 'cbJS',
name: 'cbJS',
valueField: 'Name',
displayField: 'Name',
value: '银行日记账',
allowBlank: false,
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'select': function (_Field, newValue, eOpts) {
if (_Field.value != null) {
this.onRefreshClick();
}
}
}
});
//银行存款科目加载
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',
allowBlank: false,
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.comboxJS, this.comboxACCID, this.comboxCwAccitemsCurrency, {
fieldLabel: '凭证日期',
id: 'VOUDATE',
name: 'VOUDATE',
xtype: 'datefield',
format: 'Y-m-d',
allowBlank: false, //是否允许为空
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'keyup': {
fn: function (_field, e) {
if (e.getKey() == 13) {
this.onRefreshClick();
}
},
scope: this
}
}
}, {
fieldLabel: '未达天数', //(以上)
id: 'DaysOf',
name: 'DaysOf',
xtype: 'numberfield',
allowBlank: false, //是否允许为空
enableKeyEvents: true, //激活键盘事件
selectOnFocus: true, //得到焦点时自动选择文本
allowDecimals: false, //允许输入小数
hideTrigger: true, //是否隐藏上下调节按钮
nanText: '请输入有效数值',
minValue: 0,
value: 0,
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: true,
dataIndex: 'GID',
header: '', //唯一编码
hidden: true,
width: 0
},
{
sortable: true,
dataIndex: 'VOUDATE',
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
align: 'center',
header: '凭证日期',
width: 80
//,renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
// value = GetDateStr(value, 1);
// return value;
//}
},
{
sortable: true,
dataIndex: 'ITEMNO',
header: '当日序号',
align: 'center',
width: 60
},
{
sortable: true,
dataIndex: 'ACCDATE',
header: '会计期间',
align: 'center',
width: 60
},
{
sortable: true,
dataIndex: 'EXPLAN',
header: '摘要',
width: 200
},
{
sortable: true,
dataIndex: 'VKNO',
header: '凭证字',
align: 'center',
width: 50
},
{
sortable: true,
dataIndex: 'VOUNO',
header: '凭证号',
align: 'center',
width: 50
},
{
sortable: true,
dataIndex: 'FENTRYID',
header: '分录号',
align: 'center',
width: 50
},
{
sortable: true,
dataIndex: 'SETTLETYPENAME',
header: '结算方式',
align: 'center',
width: 80
},
{
sortable: true,
dataIndex: 'BILLNO',
header: '结算号',
align: 'center',
width: 80
},
{
sortable: true,
dataIndex: 'DR',
header: '借方金额',
align: 'right',
width: 120,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
sortable: true,
dataIndex: 'CR',
header: '贷方金额',
align: 'right',
width: 120,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
sortable: true,
dataIndex: 'DC',
header: '方向',
align: 'center',
width: 35
},
{
sortable: true,
dataIndex: 'BLC',
header: '余额',
align: 'right',
width: 120,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
sortable: true,
dataIndex: 'ENTERED',
header: '经手人',
align: 'center',
width: 60
},
{
sortable: true,
dataIndex: 'CREATEUSERNAME',
header: '制单人',
align: 'center',
width: 80
}];
//#endregion
//#region 定义列2
this.girdcolums2 = [{
sortable: true,
dataIndex: 'GID',
header: '', //唯一编码
hidden: true,
width: 0
},
{
sortable: true,
dataIndex: 'VOUDATE',
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
align: 'center',
header: '凭证日期',
width: 80
//,renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
// value = GetDateStr(value, 1);
// return value;
//}
},
{
sortable: true,
dataIndex: 'ITEMNO',
header: '当日序号',
align: 'center',
width: 60
},
{
sortable: true,
dataIndex: 'ACCDATE',
header: '会计期间',
align: 'center',
width: 60
},
{
sortable: true,
dataIndex: 'EXPLAN',
header: '摘要',
width: 200
},
{
sortable: true,
dataIndex: 'VKNO',
header: '凭证字',
align: 'center',
width: 50
},
{
sortable: true,
dataIndex: 'VOUNO',
header: '凭证号',
align: 'center',
width: 50
},
{
sortable: true,
dataIndex: 'FENTRYID',
header: '分录号',
align: 'center',
width: 50
},
{
sortable: true,
dataIndex: 'SETTLETYPENAME',
header: '结算方式',
align: 'center',
width: 80
},
{
sortable: true,
dataIndex: 'BILLNO',
header: '结算号',
align: 'center',
width: 80
}];
//#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("VOUDATE").setValue(this.strACCDAY);
} 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 sql = this.getCondition();
var scbJS = form.findField('cbJS').getValue();
if (scbJS == "银行日记账") {
//#region 定义临时数据集_storeMonthData
var zlcolumn = [];
var myfield = [];
var custfield = [];
var storeMonthData = Ext.create('DsExt.ux.RefTableStore', {
fields: [
{ name: 'GID', type: 'string' }, //惟一值
{name: 'VOUDATE', type: 'DateTime' }, //凭证日期
{name: 'ITEMNO', type: 'int' }, //当日序号
{name: 'VGID', type: 'string' }, //凭证明细GID
{name: 'VKNO', type: 'string' }, //凭证字
{name: 'VOUNO', type: 'string' }, //凭证号
{name: 'FENTRYID', type: 'int' }, //分录号
{name: 'ACCDATE', type: 'string' }, //会计期间
{name: 'SETTLETYPE', type: 'int' }, //结算方式
{name: 'BILLNO', type: 'string' }, //结算号
{name: 'DC', type: 'string' }, //借贷方向
{name: 'DR', type: 'decimal' }, //本位币借方金额(互斥)
{name: 'CR', type: 'decimal' }, //本位币贷方金额(互斥)
{name: 'FCYEXRATE', type: 'decimal' }, //汇率
{name: 'QTYDR', type: 'decimal' }, //折合本位币借方
{name: 'QTYCR', type: 'decimal' }, //折合本位币贷方
{name: 'BLC', type: 'decimal' }, //余额
{name: 'EXPLAN', type: 'string' }, //摘要,规则生成
{name: 'ENTERED', type: 'string' }, //经手人
{name: 'SETTLETYPENAME', type: 'string' }, //结算方式
{name: 'CREATEUSERNAME', type: 'string' }, //制单人
{name: 'MODIFIEDUSERNAME', type: 'string' }, //最后一次更改操作人
{name: 'QTYBLC', type: 'decimal'} //余额
],
proxy: { url: '/MvcShipping/RptCtBankJSChecking/GetDataList' }
});
//#endregion
//
_this = this;
storeMonthData.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
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: 'VOUDATE', type: 'DateTime' }); //凭证日期
myfield.push({ name: 'ITEMNO', type: 'int' }); //当日序号
myfield.push({ name: 'ACCDATE', type: 'string' }); //会计期间
myfield.push({ name: 'EXPLAN', type: 'string' }); //摘要,规则生成
myfield.push({ name: 'VKNO', type: 'string' }); //凭证字
myfield.push({ name: 'VOUNO', type: 'string' }); //凭证号
myfield.push({ name: 'FENTRYID', type: 'int' }); //分录号
myfield.push({ name: 'SETTLETYPE', type: 'int' }); //结算方式
myfield.push({ name: 'BILLNO', type: 'string' }); //结算号
myfield.push({ name: 'DR', type: 'decimal' }); //本位币借方金额(互斥)
myfield.push({ name: 'CR', type: 'decimal' }); //本位币贷方金额(互斥)
myfield.push({ name: 'DC', type: 'string' }); //借贷方向
myfield.push({ name: 'BLC', type: 'decimal' }); //余额
myfield.push({ name: 'ENTERED', type: 'string' }); //经手人
myfield.push({ name: 'CREATEUSERNAME', type: 'string' }); //制单人
//
zlcolumn.push({
sortable: true,
dataIndex: 'DR',
header: '借方金额',
align: 'right',
width: 120,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
sortable: true,
dataIndex: 'CR',
header: '贷方金额',
align: 'right',
width: 120,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
sortable: true,
dataIndex: 'DC',
header: '方向',
align: 'center',
width: 35
},
{
sortable: true,
dataIndex: 'BLC',
header: '余额',
align: 'right',
width: 120,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
sortable: true,
dataIndex: 'ENTERED',
header: '经手人',
align: 'center',
width: 60
},
{
sortable: true,
dataIndex: 'CREATEUSERNAME',
header: '制单人',
align: 'center',
width: 80
});
//#endregion
}
else {
//#region 列表zlcolumn
myfield.push({ name: 'GID', type: 'string' }); //惟一值
myfield.push({ name: 'VOUDATE', type: 'DateTime' }); //凭证日期
myfield.push({ name: 'ITEMNO', type: 'int' }); //当日序号
myfield.push({ name: 'ACCDATE', type: 'string' }); //会计期间
myfield.push({ name: 'EXPLAN', type: 'string' }); //摘要,规则生成
myfield.push({ name: 'VKNO', type: 'string' }); //凭证字
myfield.push({ name: 'VOUNO', type: 'string' }); //凭证号
myfield.push({ name: 'FENTRYID', type: 'int' }); //分录号
myfield.push({ name: 'SETTLETYPE', type: 'int' }); //结算方式
myfield.push({ name: 'BILLNO', type: 'string' }); //结算号
myfield.push({ name: 'DR', type: 'decimal' }); //原币借方金额(互斥)
myfield.push({ name: 'QTYDR', type: 'decimal' }); //本位币借方金额(互斥)
myfield.push({ name: 'CR', type: 'decimal' }); //原币贷方金额(互斥)
myfield.push({ name: 'QTYCR', type: 'decimal' }); //本位币贷方金额(互斥)
myfield.push({ name: 'DC', type: 'string' }); //借贷方向
myfield.push({ name: 'BLC', type: 'decimal' }); //余额
myfield.push({ name: 'QTYBLC', type: 'decimal' }); //余额
myfield.push({ name: 'ENTERED', type: 'string' }); //经手人
myfield.push({ name: 'CREATEUSERNAME', type: 'string' }); //制单人
//
zlcolumn.push({
text: '借方',
sortable: false,
columns: [{
sortable: false,
dataIndex: 'DR',
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: 'CR',
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: 'DC',
header: '方向',
align: 'center',
width: 35
}, {
text: '余额',
sortable: false,
columns: [{
sortable: false,
dataIndex: 'BLC',
header: '原币',
align: 'right',
width: 100,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
}, {
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: true,
dataIndex: 'ENTERED',
header: '经手人',
align: 'center',
width: 60
},
{
sortable: true,
dataIndex: 'CREATEUSERNAME',
header: '制单人',
align: 'center',
width: 80
});
//#endregion
}
//#region 定义 数据集
for (var k in myfield) {
custfield.push(myfield[k]);
}
//
Ext.define('MsCtBankJournalModel', {
extend: 'Ext.data.Model',
fields: custfield
});
this.storeList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'MsCtBankJournalModel',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/RptCtBankJSChecking/GetDataList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//#endregion
//#region 重载 数据集_列样式
this.girdcolums2 = [{
sortable: true,
dataIndex: 'GID',
header: '', //唯一编码
hidden: true,
width: 0
},
{
sortable: true,
dataIndex: 'VOUDATE',
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
align: 'center',
header: '凭证日期',
width: 80
//,renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
// value = GetDateStr(value, 1);
// return value;
//}
},
{
sortable: true,
dataIndex: 'ITEMNO',
header: '当日序号',
align: 'center',
width: 60
},
{
sortable: true,
dataIndex: 'ACCDATE',
header: '会计期间',
align: 'center',
width: 60
},
{
sortable: true,
dataIndex: 'EXPLAN',
header: '摘要',
width: 200
},
{
sortable: true,
dataIndex: 'VKNO',
header: '凭证字',
align: 'center',
width: 50
},
{
sortable: true,
dataIndex: 'VOUNO',
header: '凭证号',
align: 'center',
width: 50
},
{
sortable: true,
dataIndex: 'FENTRYID',
header: '分录号',
align: 'center',
width: 50
},
{
sortable: true,
dataIndex: 'SETTLETYPENAME',
header: '结算方式',
align: 'center',
width: 80
},
{
sortable: true,
dataIndex: 'BILLNO',
header: '结算号',
align: 'center',
width: 80
}];
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: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
this.storeList.on('beforeload', function (store) {
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
//#endregion
//}
}
},
scope: this
});
}
else {
//#region 定义临时数据集_storeMonthData
var zlcolumn = [];
var myfield = [];
var custfield = [];
var storeMonthData = Ext.create('DsExt.ux.RefTableStore', {
fields: [
{ name: 'GID', type: 'string' }, //GID
{name: 'ACCGID', type: 'string' }, //科目GID
{name: 'FCYNO', type: 'string' }, //外币编号RMB
{name: 'VOUDATE', type: 'datetime' }, //结算日期
{name: 'ITEMNO', type: 'int' }, //当天序号
{name: 'ACCDATE', type: 'string' }, //会计期间
{name: 'SETTLETYPE', type: 'int' }, //结算方式
{name: 'BILLNO', type: 'string' }, //结算号
{name: 'DC', type: 'string' }, //余额方向
{name: 'DR', type: 'decimal' }, //银行借方
{name: 'CR', type: 'decimal' }, //银行贷方
{name: 'FCYEXRATE', type: 'decimal' }, //汇率
{name: 'BLC', type: 'decimal' }, //余额
{name: 'EXPLAN', type: 'string' }, //摘要
{name: 'ENTERED', type: 'string' }, //经手人
{name: 'SETTLETYPENAME', type: 'string' }, //结算方式
{name: 'CREATEUSERNAME', type: 'string' }, //制单人
{name: 'MODIFIEDUSERNAME', type: 'string'} //最后一次更改操作人
],
proxy: { url: '/MvcShipping/RptCtBankJSChecking/GetDataList2' }
});
//#endregion
//
_this = this;
storeMonthData.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
callback: function (r, options, success) {
if (success) {
//#region 列表zlcolumn
var zlcolumn = [];
myfield.push({ name: 'GID', type: 'string' }); //惟一值
myfield.push({ name: 'VOUDATE', type: 'DateTime' }); //凭证日期
myfield.push({ name: 'ITEMNO', type: 'int' }); //当日序号
myfield.push({ name: 'ACCDATE', type: 'string' }); //会计期间
myfield.push({ name: 'EXPLAN', type: 'string' }); //摘要,规则生成
myfield.push({ name: 'SETTLETYPE', type: 'int' }); //结算方式
myfield.push({ name: 'BILLNO', type: 'string' }); //结算号
myfield.push({ name: 'DR', type: 'decimal' }); //本位币借方金额(互斥)
myfield.push({ name: 'CR', type: 'decimal' }); //本位币贷方金额(互斥)
myfield.push({ name: 'DC', type: 'string' }); //借贷方向
myfield.push({ name: 'BLC', type: 'decimal' }); //余额
myfield.push({ name: 'ENTERED', type: 'string' }); //经手人
myfield.push({ name: 'CREATEUSERNAME', type: 'string' }); //制单人
//
zlcolumn.push({
sortable: true,
dataIndex: 'DR',
header: '银行借方',
align: 'right',
width: 120,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
sortable: true,
dataIndex: 'CR',
header: '银行贷方',
align: 'right',
width: 120,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
sortable: true,
dataIndex: 'DC',
header: '方向',
align: 'center',
width: 35
},
{
sortable: true,
dataIndex: 'BLC',
header: '余额',
align: 'right',
width: 120,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
sortable: true,
dataIndex: 'ENTERED',
header: '经手人',
align: 'center',
width: 60
},
{
sortable: true,
dataIndex: 'CREATEUSERNAME',
header: '制单人',
align: 'center',
width: 80
});
//#endregion
//#region 定义 数据集
for (var k in myfield) {
custfield.push(myfield[k]);
}
//
Ext.define('MsCtBankStatementModel', {
extend: 'Ext.data.Model',
fields: custfield
});
this.storeList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'MsCtBankStatementModel',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/RptCtBankJSChecking/GetDataList2',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//#endregion
//#region 重载 数据集_列样式
this.girdcolums2 = [{
sortable: true,
dataIndex: 'GID',
header: '', //唯一编码
hidden: true,
width: 0
},
{
sortable: true,
dataIndex: 'VOUDATE',
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
align: 'center',
header: '凭证日期',
width: 80
//,renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
// value = GetDateStr(value, 1);
// return value;
//}
},
{
sortable: true,
dataIndex: 'ITEMNO',
header: '当日序号',
align: 'center',
width: 60
},
{
sortable: true,
dataIndex: 'ACCDATE',
header: '会计期间',
align: 'center',
width: 60
},
{
sortable: true,
dataIndex: 'EXPLAN',
header: '摘要',
width: 200
},
{
sortable: true,
dataIndex: 'SETTLETYPENAME',
header: '结算方式',
align: 'center',
width: 80
},
{
sortable: true,
dataIndex: 'BILLNO',
header: '结算号',
align: 'center',
width: 80
}];
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: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
this.storeList.on('beforeload', function (store) {
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
//#endregion
}
},
scope: this
});
}
},
//#endregion
//#region 查询
getCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
//Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var sql = '';
//#region formSearch 查询面板
var sDaysOf = this.formSearch.getForm().findField('DaysOf').getRawValue();
var sVOUDATE = this.formSearch.getForm().findField('VOUDATE').getRawValue();
if (sVOUDATE != null) {
if (sVOUDATE != "") {
sql = sql + getAndConSql(sql, sVOUDATE, "VOUDATE <=convert(varchar(10),DateAdd(dd,(-" + sDaysOf + "),'" + sVOUDATE.toString().trim() + "'),120)");
}
}
var sACCID = form.findField('ACCID').getValue();
if (sACCID != null) {
if (sACCID != "") {
sql = sql + getAndConSql(sql, sACCID, "ACCGID in (select GID from cw_accitems_gl where [YEAR]=SUBSTRING('" + sVOUDATE + "',1,4) and ACCID='" + sACCID + "')");
}
}
var sCURRENCY = form.findField('CURRENCY').getValue();
if (sCURRENCY != null) {
if (sCURRENCY != "") {
sql = sql + getAndConSql(sql, sCURRENCY, "FCYNO='" + sCURRENCY + "'");
}
}
//#endregion formSearch
return sql;
},
//#endregion
//#region 重置条件
onClearSql: function () {
var form = this.formSearch.getForm();
form.reset();
this.InitData();
this.onRefreshClick();
},
//#endregion
//#region 导出Excel
onExportClick: function (button, event) {
if (this.storeList.getCount() == 0) {
//return;
}
var form = this.formSearch.getForm();
if (!form.isValid()) {
//Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var sql = this.getCondition();
var scbJS = form.findField('cbJS').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=RptCtBankJSCheckingIndex&formname=" + this.formname + "&condition1=" + escape(sql) + "&condition2=" + escape(scbJS);
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 form = this.formSearch.getForm();
if (!form.isValid()) {
//Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var sql = this.getCondition();
var scbJS = form.findField('cbJS').getValue();
if (scbJS == "银行日记账") {
//Ext.Msg.wait('正在组织数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在组织数据, 请稍侯...',
url: '/MvcShipping/RptCtBankJSChecking/GetDataListStr',
params: {
condition: sql,
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 = 'RptCtBankJSCheckingList';
var sCURRENCY = this.formSearch.getForm().findField('CURRENCY').getValue();
if (sCURRENCY != "RMB") {
printType = 'RptCtBankJSCheckingList3';
}
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
});
}
else {
//Ext.Msg.wait('正在组织数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在组织数据, 请稍侯...',
url: '/MvcShipping/RptCtBankJSChecking/GetDataListStr2',
params: {
condition: sql,
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 = 'RptCtBankJSCheckingList2';
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;
}
});