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.

1554 lines
66 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.RptCwGLDetailColumnIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.RptCwGLDetailColumnIndex.superclass.constructor.call(this);
};
Ext.extend(Shipping.RptCwGLDetailColumnIndex, Ext.Panel, {
PageSize: 2000,
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
sqlcontext: '',
acctype: 1,
strtext: "",
isInitData: 0,
strCwSTARTGID: '',
initUIComponents: function () {
this.formname = "formRptCwGLDetailColumnIndex"; //多栏账
//#region 定义数据集
this.storeList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'RptCwGLDetailColumnModel',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/RptCwGLDetailColumn/GetDataList',
reader: {
id: '',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//#endregion
//#region 定义列
this.girdcolums = [{
sortable: true,
dataIndex: 'GID',
text: '唯一编码',
hidden: true,
width: 0
}, {
sortable: false,
dataIndex: 'VOUDATE',
text: '日期',
align: 'center',
width: 90
}, {
sortable: true,
dataIndex: 'VKNO',
text: '凭证字',
align: 'center',
width: 50
}, {
sortable: false,
dataIndex: 'VOUNO',
text: '凭证号',
align: 'center',
width: 50
}, {
sortable: false,
dataIndex: 'EXPLAN',
text: '摘要',
width: 200
}, {
sortable: true,
dataIndex: 'DR',
text: '借方',
align: 'right',
width: 100,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
}, {
sortable: true,
dataIndex: 'CR',
text: '贷方',
align: 'right',
width: 100,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
}, {
sortable: false,
dataIndex: 'DC',
text: '方向',
align: 'center',
width: 40
}, {
sortable: true,
dataIndex: 'BLC',
text: '余额',
align: 'right',
width: 100,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
}, {
sortable: true,
dataIndex: 'ORDNO',
text: 'ORDNO',
hidden: true,
width: 0
}];
//#endregion
//#region 定义Grid
Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, {
width: 30
});
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
columnLines: true, //是否显示列分割线,默认为false
columns: this.girdcolums,
viewConfig: {
enableTextSelection: true, //允许复制数据
autoFill: true
}
});
//this.gridList.columns[0] = new Ext.grid.RowNumberer();
this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
var sVKNO = record.data.VKNO.toString();
if (sVKNO != "") {
this.SelectedRecord = record;
this.OprationStatus = 'edit';
DsOpenEditWin('/MvcShipping/MsCwVouchersGl/Edit', "凭证录入", "500", "940", "10", "10");
}
}, this);
//#endregion
//#region formSearch 下拉框信息加载
//科目加载
this.storeCwAccitems = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CwAccitemsGlModel',
proxy: { url: '/CommMng/BasicDataRef/GetCwAccitemsGl' }
});
this.storeCwAccitems.load({ params: { condition: "ISENABLE=1"} });
this.comboxACCNAME = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '科目名称',
store: this.storeCwAccitems,
forceSelection: true, //输入值是否严格为待选列表中存在的值
allowBlank: false,
id: 'ACCID',
name: 'ACCID',
valueField: 'ACCID',
displayField: 'ACCIDNAME',
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'keyup': {
fn: function (_field, e) {
if (e.getKey() == 13) {
//this.onRefreshClick();
if (_field.rawValue.toString() != "") {
var fValue = _field.rawValue.toString();
if (fValue.indexOf("-") > -1) {
fValue = fValue.substr(0, fValue.indexOf("-"));
}
var ACCDATEbgn = Ext.getCmp('ACCDATEbgn').getRawValue();
Ext.Ajax.request({
waitMsg: '正在查询汇率值...',
url: '/MvcShipping/RptCwGLDetailColumn/GetIsSubject',
params: {
condition: "ACCID='" + fValue + "'",
ACCDATEbgn: ACCDATEbgn
},
callback: function (options, success, response) {
var result = Ext.JSON.decode(response.responseText);
if (success) {
if (!result.Success) {
Ext.Msg.show({ title: '提示', msg: result.Message, icon: Ext.MessageBox.INFO, buttons: Ext.Msg.OK });
_field.setValue("");
return;
}
//
Ext.getCmp('CustNAME').setValue("");
Ext.getCmp('DeptName').setValue("");
Ext.getCmp('SALE').setValue("");
Ext.getCmp('ITEMNAME').setValue("");
var strItem = result.Message.toString();
if (strItem == "") {
Ext.getCmp('SubjectAccount').hide();
Ext.getCmp('CustNAME').hide();
Ext.getCmp('DeptName').hide();
Ext.getCmp('SALE').hide();
Ext.getCmp('ITEMNAME').hide();
this.acctype = 1;
}
else {
this.acctype = 2;
Ext.getCmp('SubjectAccount').show();
this.storeSubjectAccount.load({ params: { condition: "ACCID='" + fValue + "'", ACCDATEbgn: ACCDATEbgn} });
argItems = result.Message.toString().split(",");
strItem = argItems[0].toString();
Ext.getCmp('SubjectAccount').setValue(strItem);
//
if (strItem == "客户") {
Ext.getCmp('CustNAME').show();
Ext.getCmp('DeptName').hide();
Ext.getCmp('SALE').hide();
Ext.getCmp('ITEMNAME').hide();
}
else if (strItem == "部门") {
Ext.getCmp('DeptName').show();
Ext.getCmp('CustNAME').hide();
Ext.getCmp('SALE').hide();
Ext.getCmp('ITEMNAME').hide();
}
else if (strItem == "人员") {
Ext.getCmp('SALE').show();
Ext.getCmp('CustNAME').hide();
Ext.getCmp('DeptName').hide();
Ext.getCmp('ITEMNAME').hide();
}
else if (strItem == "项目") {
Ext.getCmp('ITEMNAME').show();
Ext.getCmp('CustNAME').hide();
Ext.getCmp('DeptName').hide();
Ext.getCmp('SALE').hide();
}
}
this.onRefreshClick();
} else {
Ext.Msg.show({ title: '提示', msg: result.Message, icon: Ext.MessageBox.INFO, buttons: Ext.Msg.OK });
_field.setValue("");
return;
//Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}
}
},
scope: this
},
'select': function (_Field, itemArray, Object) {
if (_Field.value.toString() != "") {
var ACCDATEbgn = Ext.getCmp('ACCDATEbgn').getRawValue();
Ext.Ajax.request({
waitMsg: '正在查询汇率值...',
url: '/MvcShipping/RptCwGLDetailColumn/GetIsSubject',
params: {
condition: "ACCID='" + _Field.value.toString() + "'",
ACCDATEbgn: ACCDATEbgn
},
callback: function (options, success, response) {
var result = Ext.JSON.decode(response.responseText);
if (success) {
if (!result.Success) {
Ext.Msg.show({ title: '提示', msg: result.Message, icon: Ext.MessageBox.INFO, buttons: Ext.Msg.OK });
_Field.setValue("");
return;
}
//
Ext.getCmp('CustNAME').setValue("");
Ext.getCmp('DeptName').setValue("");
Ext.getCmp('SALE').setValue("");
Ext.getCmp('ITEMNAME').setValue("");
var strItem = result.Message.toString();
if (strItem == "") {
Ext.getCmp('SubjectAccount').hide();
Ext.getCmp('CustNAME').hide();
Ext.getCmp('DeptName').hide();
Ext.getCmp('SALE').hide();
Ext.getCmp('ITEMNAME').hide();
this.acctype = 1;
}
else {
this.acctype = 2;
Ext.getCmp('SubjectAccount').show();
this.storeSubjectAccount.load({ params: { condition: "ACCID='" + _Field.value.toString() + "'", ACCDATEbgn: ACCDATEbgn} });
argItems = result.Message.toString().split(",");
strItem = argItems[0].toString();
Ext.getCmp('SubjectAccount').setValue(strItem);
//
if (strItem == "客户") {
Ext.getCmp('CustNAME').show();
Ext.getCmp('DeptName').hide();
Ext.getCmp('SALE').hide();
Ext.getCmp('ITEMNAME').hide();
}
else if (strItem == "部门") {
Ext.getCmp('DeptName').show();
Ext.getCmp('CustNAME').hide();
Ext.getCmp('SALE').hide();
Ext.getCmp('ITEMNAME').hide();
}
else if (strItem == "人员") {
Ext.getCmp('SALE').show();
Ext.getCmp('CustNAME').hide();
Ext.getCmp('DeptName').hide();
Ext.getCmp('ITEMNAME').hide();
}
else if (strItem == "项目") {
Ext.getCmp('ITEMNAME').show();
Ext.getCmp('CustNAME').hide();
Ext.getCmp('DeptName').hide();
Ext.getCmp('SALE').hide();
}
}
} else {
Ext.Msg.show({ title: '提示', msg: result.Message, icon: Ext.MessageBox.INFO, buttons: Ext.Msg.OK });
_Field.setValue("");
return;
//Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}
}
}
});
//币别
this.storeCodeCurrency = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CodeCurrencyModel',
proxy: { url: '/MvcShipping/RptCwGLDetailColumn/GetCodeCurrencyList' }
});
this.storeCodeCurrency.load();
this.comboxCodeCurrency = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '币别',
store: this.storeCodeCurrency,
forceSelection: true,
name: 'CURRENCY',
valueField: 'CODENAME',
displayField: 'CODENAME',
value: '综合本位币',
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'keyup': {
fn: function (_field, e) {
if (e.getKey() == 13) {
this.onRefreshClick();
}
},
scope: this
},
'select': function (_Field, itemArray, Object) {
if (_Field.value.toString() != "") {
this.onRefreshClick();
}
}
}
});
//客户加载
this.storeCustCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeCustCode.load({ params: { condition: ""} });
//this.storeCustCode.insert(0, { "GId": "", "CustCode": "", "CustName": "", "CodeAndName": "", "SALE": "" });
this.comboxCust = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '客户',
store: this.storeCustCode,
forceSelection: true,
id: 'CustNAME',
name: 'CustNAME',
valueField: 'CustName',
displayField: 'CodeAndName',
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'keyup': {
fn: function (_field, e) {
if (e.getKey() == 13) {
this.onRefreshClick();
}
},
scope: this
},
'select': function (_Field, itemArray, Object) {
if (_Field.value.toString() != "") {
this.onRefreshClick();
}
}
}
});
//部门加载
this.storeDept = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.DeptModel',
proxy: { url: '/CommMng/BasicDataRef/GetDeptList' }
});
this.storeDept.load({ params: { condition: ""} });
//this.storeDept.insert(0, { "Deptno": "", "DeptName": "", "Manage1": "" });
this.comboxDept = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '部门',
store: this.storeDept,
forceSelection: true,
id: 'DeptName',
name: 'DeptName',
valueField: 'DeptName',
displayField: 'DeptName',
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'keyup': {
fn: function (_field, e) {
if (e.getKey() == 13) {
this.onRefreshClick();
}
},
scope: this
},
'select': function (_Field, itemArray, Object) {
if (_Field.value.toString() != "") {
this.onRefreshClick();
}
}
}
});
//人员信息加载
this.storeOpCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' }
});
this.storeOpCode.load();
this.comboxSALE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '人员',
store: this.storeOpCode,
forceSelection: true,
id: 'SALE',
name: 'SALE',
valueField: 'UserName',
displayField: 'CodeAndName',
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'keyup': {
fn: function (_field, e) {
if (e.getKey() == 13) {
this.onRefreshClick();
}
},
scope: this
},
'select': function (_Field, itemArray, Object) {
if (_Field.value.toString() != "") {
this.onRefreshClick();
}
}
}
});
//项目加载
this.storeCwItem = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CwItemModel',
proxy: { url: '/CommMng/BasicDataRef/GetCwItemList' }
});
this.storeCwItem.load();
this.comboxCwItem = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '项目',
store: this.storeCwItem,
forceSelection: true,
id: 'ITEMNAME',
name: 'ITEMNAME',
valueField: 'ITEMNAME',
displayField: 'CodeAndName',
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'keyup': {
fn: function (_field, e) {
if (e.getKey() == 13) {
this.onRefreshClick();
}
},
scope: this
},
'select': function (_Field, itemArray, Object) {
if (_Field.value.toString() != "") {
this.onRefreshClick();
}
}
}
});
//核算项目
this.storeSubjectAccount = Ext.create('DsExt.ux.RefTableStore', {
model: 'SubjectAccountModel',
proxy: { url: '/MvcShipping/RptCwGLDetailColumn/GetSubjectAccount' }
});
//this.storeSubjectAccount.load({ params: { condition: ""} });
this.comboxSubjectAccount = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '核算项目',
store: this.storeSubjectAccount,
forceSelection: true,
id: 'SubjectAccount',
name: 'SubjectAccount',
valueField: 'NAME',
displayField: 'NAME',
//value: '客户',
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'keyup': {
fn: function (_field, e) {
if (e.getKey() == 13) {
this.onRefreshClick();
}
},
scope: this
},
'select': function (_Field, itemArray, Object) {
if (_Field.value.toString() != "") {
Ext.getCmp('SubjectAccount').show();
Ext.getCmp('CustNAME').setValue("");
Ext.getCmp('DeptName').setValue("");
Ext.getCmp('SALE').setValue("");
Ext.getCmp('ITEMNAME').setValue("");
if (_Field.value.toString() == "客户") {
Ext.getCmp('CustNAME').show();
Ext.getCmp('DeptName').hide();
Ext.getCmp('SALE').hide();
Ext.getCmp('ITEMNAME').hide();
}
else if (_Field.value.toString() == "部门") {
Ext.getCmp('DeptName').show();
Ext.getCmp('CustNAME').hide();
Ext.getCmp('SALE').hide();
Ext.getCmp('ITEMNAME').hide();
}
else if (_Field.value.toString() == "人员") {
Ext.getCmp('SALE').show();
Ext.getCmp('CustNAME').hide();
Ext.getCmp('DeptName').hide();
Ext.getCmp('ITEMNAME').hide();
}
else if (_Field.value.toString() == "项目") {
Ext.getCmp('ITEMNAME').show();
Ext.getCmp('CustNAME').hide();
Ext.getCmp('DeptName').hide();
Ext.getCmp('SALE').hide();
}
}
}
}
});
//#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',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxCodeCurrency, this.comboxACCNAME, {
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: '至',
//labelWidth: 20,
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
}
}
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxSubjectAccount, this.comboxCust, this.comboxDept, this.comboxSALE, this.comboxCwItem]
}]
}]//end items(fieldset 1)
});
//#endregion formSearch
//#region 饼状图
//定义数据集
this.storeListBZT = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
fields: [
{ name: 'OBJNAME', type: 'string' },
{ name: 'OBJNUM', type: 'number' }
],
remoteSort: true,
proxy: {
type: 'ajax',
//url: '/MvcShipping/MsRptOpProfitPerCent/SumListData',
url: '/MvcShipping/RptCwGLDetailColumn/GetDataListBZT',
reader: {
id: '',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//定义Grid
this.initgirdcolums = [{
sortable: true,
dataIndex: 'OBJNAME',
text: '分析对象',
width: 110
}, {
sortable: true,
dataIndex: 'OBJNUM',
text: '数据',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>'; } } else { return value; } } catch (e) { return value; } return value; },
align: 'right',
summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00'),
width: 120
}];
this.gridListBZT = new Ext.grid.GridPanel({
store: this.storeListBZT,
enableHdMenu: false,
//region: 'center',
layout: "border",
region: 'east',
width: 260,
margin: '0 0',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
columns: this.initgirdcolums
});
this.piechart = Ext.create('Ext.chart.Chart', {
xtype: 'chart',
region: 'center',
animate: true,
store: this.storeListBZT,
shadow: true,
legend: { position: 'right' },
insetPadding: 60,
theme: 'Base:gradients',
series: [{
type: 'pie',
field: 'OBJNUM',
showInLegend: true,
donut: true,
tips: {
trackMouse: true,
width: 140,
height: 28,
renderer: function (storeItem, item) {
var total = 0;
this.storeListBZT.each(function (rec) {
total += rec.get('OBJNUM');
});
this.setTitle(storeItem.get('OBJNAME') + ': ' + Math.round(storeItem.get('OBJNUM') / total * 100) + '%');
}
},
highlight: { segment: { margin: 20} },
label: { field: 'OBJNAME', display: 'rotate', contrast: true, font: '18px Arial' }
}]
});
//#endregion
//#region 饼状图
this.columnchart = Ext.create('Ext.chart.Chart', {
id: 'chartCmp',
xtype: 'chart',
style: 'background:#fff',
animate: true,
shadow: true,
store: this.storeList,
axes: [{
type: 'Numeric',
position: 'left',
fields: ['OBJNUM'],
label: {
renderer: Ext.util.Format.numberRenderer('0,0')
},
title: '数据',
grid: true,
minimum: 0
}, {
type: 'Category',
position: 'bottom',
fields: ['OBJNAME'],
title: '分析对象'
}],
series: [{
type: 'column',
axis: 'left',
highlight: true,
tips: {
trackMouse: true,
width: 140,
height: 28,
renderer: function (storeItem, item) {
this.setTitle(storeItem.get('OBJNAME') + ': ' + storeItem.get('OBJNUM'));
}
},
label: {
display: 'insideEnd',
'text-anchor': 'middle',
field: 'OBJNUM',
renderer: Ext.util.Format.numberRenderer('0.00'),
orientation: 'vertical',
color: '#333'
},
xField: 'OBJNAME',
yField: 'OBJNUM',
//color renderer
renderer: function (sprite, record, attr, index, store) {
var fieldValue = Math.random() * 20 + 10;
var color = ['rgb(213, 70, 121)',
'rgb(44, 153, 201)',
'rgb(146, 6, 157)',
'rgb(49, 149, 0)',
'rgb(249, 153, 0)',
'rgb(180, 50, 201)',
'rgb(150, 10, 10)',
'rgb(130, 10, 201)',
'rgb(120, 10, 10)'][index];
return Ext.apply(attr, {
fill: color
});
}
}]
});
//#endregion
//#region 按钮工具条
this.CheckSaveQuery = new Ext.form.Checkbox({
fieldLabel: '记忆查询条件',
checked: true,
width: 120
});
this.panelBtn = new Ext.Panel({
layout: "border",
region: "center",
border: false,
tbar: [{
text: "执行查询",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick(button, event);
var isvisible = false;
var issavevalue = false;
if (this.CheckSaveQuery.checked) {
issavevalue = true
}
saveQuerySetting(this.formname, this.formSearch, isvisible, issavevalue);
},
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
}, '-', this.CheckSaveQuery]
});
//#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: "&nbsp;&nbsp;"
}]
});
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: 95,
border: false,
items: [this.panelTopF, this.formSearch]
});
Ext.apply(this, {
border: false,
items: [this.panelTop, this.gridList]
});
//this.onRefreshClick();
//#endregion
//#region 页面加载
//加载事件
this.InitData();
LoadQueryData(this.formname, this.formSearch, this.CheckSaveQuery);
//#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 = "&nbsp;&nbsp;当前登录账套:“" + strCwSTARTNAME + "”&nbsp;&nbsp;当前财务账期:“" + sYear + "年第" + sMonth + "期”&nbsp;&nbsp;";
Ext.getCmp("lbTitle2").setValue(sZQ);
Ext.getCmp("ACCDATEbgn").setValue(strCwACCDATE);
Ext.getCmp("ACCDATEend").setValue(strCwACCDATE);
//
//Ext.getCmp("ACCID").setValue(combo.store.data.items[0].data.ACCID); //选中
//
Ext.getCmp('SubjectAccount').hide();
Ext.getCmp('CustNAME').hide();
Ext.getCmp('DeptName').hide();
Ext.getCmp('SALE').hide();
Ext.getCmp('ITEMNAME').hide();
} else {
//Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
async: false,
scope: this
});
}, //end InitData
//#endregion
//#region 执行查询
onRefreshClick: function (button, event) {
if (this.isInitData == 0) {
this.isInitData = 1;
var sACCID = Ext.getCmp('ACCID').getValue();
var ACCDATEbgn = Ext.getCmp('ACCDATEbgn').getRawValue();
Ext.Ajax.request({
waitMsg: '正在查询汇率值...',
url: '/MvcShipping/RptCwGLDetailColumn/GetIsSubject',
params: {
condition: "ACCID='" + sACCID + "'",
ACCDATEbgn: ACCDATEbgn
},
callback: function (options, success, response) {
var result = Ext.JSON.decode(response.responseText);
if (success) {
if (!result.Success) {
//Ext.Msg.show({ title: '提示', msg: result.Message, icon: Ext.MessageBox.INFO, buttons: Ext.Msg.OK });
//_field.setValue("");
return;
}
//
//Ext.getCmp('CustNAME').setValue("");
//Ext.getCmp('DeptName').setValue("");
//Ext.getCmp('SALE').setValue("");
//Ext.getCmp('ITEMNAME').setValue("");
var strItem = result.Message.toString();
if (strItem == "") {
Ext.getCmp('SubjectAccount').hide();
Ext.getCmp('CustNAME').hide();
Ext.getCmp('DeptName').hide();
Ext.getCmp('SALE').hide();
Ext.getCmp('ITEMNAME').hide();
this.acctype = 1;
}
else {
this.acctype = 2;
Ext.getCmp('SubjectAccount').show();
this.storeSubjectAccount.load({ params: { condition: "ACCID='" + sACCID + "'", ACCDATEbgn: ACCDATEbgn} });
argItems = result.Message.toString().split(",");
strItem = argItems[0].toString();
Ext.getCmp('SubjectAccount').setValue(strItem);
//
if (strItem == "客户") {
Ext.getCmp('CustNAME').show();
Ext.getCmp('DeptName').hide();
Ext.getCmp('SALE').hide();
Ext.getCmp('ITEMNAME').hide();
}
else if (strItem == "部门") {
Ext.getCmp('DeptName').show();
Ext.getCmp('CustNAME').hide();
Ext.getCmp('SALE').hide();
Ext.getCmp('ITEMNAME').hide();
}
else if (strItem == "人员") {
Ext.getCmp('SALE').show();
Ext.getCmp('CustNAME').hide();
Ext.getCmp('DeptName').hide();
Ext.getCmp('ITEMNAME').hide();
}
else if (strItem == "项目") {
Ext.getCmp('ITEMNAME').show();
Ext.getCmp('CustNAME').hide();
Ext.getCmp('DeptName').hide();
Ext.getCmp('SALE').hide();
}
}
//this.onRefreshClick();
}
},
async: false,
scope: this
});
}
//#region 查询条件
var sql = this.getCondition();
var ACCDATEbgn = this.getACCDATEbgn();
var ACCDATEend = this.getACCDATEend();
var strCURRENCY = this.getCURRENCY();
var strACCID = this.getACCID();
var strCustNAME = this.getCustNAME();
var strDeptName = this.getDeptName();
var strSALE = this.getSALE();
var strITEMNAME = this.getITEMNAME();
var strSubjectAccount = this.getSubjectAccount();
//#endregion
var zlcolumn = [{
sortable: true,
dataIndex: new Ext.grid.RowNumberer(),
text: '序号',
hidden: true,
width: 0
}, {
sortable: true,
dataIndex: 'GID',
text: '唯一编码',
hidden: true,
width: 0
}, {
sortable: false,
dataIndex: 'VOUDATE',
text: '日期',
align: 'center',
width: 90
}, {
sortable: true,
dataIndex: 'VKNO',
text: '凭证字',
align: 'center',
width: 50
}, {
sortable: false,
dataIndex: 'VOUNO',
text: '凭证号',
align: 'center',
width: 50
}, {
sortable: false,
dataIndex: 'EXPLAN',
text: '摘要',
width: 200
}, {
sortable: true,
dataIndex: 'DR',
text: '借方',
align: 'right',
width: 100,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
}, {
sortable: true,
dataIndex: 'CR',
text: '贷方',
align: 'right',
width: 100,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
}, {
sortable: false,
dataIndex: 'DC',
text: '方向',
align: 'center',
width: 40
}, {
sortable: true,
dataIndex: 'BLC',
text: '余额',
align: 'right',
width: 100,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
}, {
sortable: true,
dataIndex: 'ORDNO',
text: 'ORDNO',
hidden: true,
width: 0
}];
var myfield = [];
var myfield2 = [];
//#region 列字段
var Columnfield = [
{ name: 'GID', type: 'string' },
{ name: 'VKNO', type: 'string' },
{ name: 'VOUNO', type: 'string' },
{ name: 'VOUDATE', type: 'string' },
{ name: 'DR', type: 'decimal' },
{ name: 'CR', type: 'decimal' },
{ name: 'BLC', type: 'decimal' },
{ name: 'EXPLAN', type: 'string' },
{ name: 'DC', type: 'string' },
{ name: 'ORDNO', type: 'string' }
];
//#endregion
if (this.acctype == 1) {//子科目
//#region 子科目
this.storeMonthData = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CwAccitemsGlModel',
proxy: { url: '/MvcShipping/RptCwGLDetailColumn/GetCwAccitemsGl' }
});
this.storeMonthData.load({ params: { condition: sql, ACCDATEbgn: ACCDATEbgn, ACCDATEend: ACCDATEend, strCURRENCY: strCURRENCY, strACCID: strACCID, strCustNAME: strCustNAME, strDeptName: strDeptName, strSALE: strSALE, strITEMNAME: strITEMNAME },
callback: function (r, options, success) {
if (success) {
//#region 列循环
if (r.length != 0) {
var acolumn = [];
for (i = 0; i < r.length; i++) {
//var memberyf = this.storeMonthData.getAt(i);
var memberyf = r[i];
if (memberyf.data.DC.toString() == "借") {
myfield.push({ name: memberyf.data.ACCNAME + '借', type: 'number' });
acolumn.push({
dataIndex: memberyf.data.ACCNAME + '借',
text: memberyf.data.ACCNAME, //'RMB应收',
align: 'right',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
//,width: 100
});
this.strHeader += ",[" + memberyf.data.ACCNAME + "(借)]";
}
};
if (acolumn.length > 0) {
zlcolumn.push({
text: "借方",
columns: acolumn
});
}
//
var acolumn2 = [];
for (i = 0; i < r.length; i++) {
var memberyf = r[i];
if (memberyf.data.DC.toString() == "贷") {
myfield2.push({ name: memberyf.data.ACCNAME + '贷', type: 'number' });
acolumn2.push({
dataIndex: memberyf.data.ACCNAME + '贷',
text: memberyf.data.ACCNAME, //'RMB应收',
align: 'right',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
});
this.strHeader += ",[" + memberyf.data.ACCNAME + "(贷)]";
}
};
if (acolumn2.length > 0) {
zlcolumn.push({
text: "贷方",
columns: acolumn2
});
}
}
for (var k in myfield) {
Columnfield.push(myfield[k]);
}
for (var k in myfield2) {
Columnfield.push(myfield2[k]);
}
//#endregion
//
Ext.define('ColumnModel', { extend: 'Ext.data.Model', fields: Columnfield });
this.storeList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'ColumnModel',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/RptCwGLDetailColumn/GetDataList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//
this.gridList.reconfigure(this.storeList, zlcolumn);
if (sql.toString() != "") {
this.sqlcontext = sql;
this.storeList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql, ACCDATEbgn: ACCDATEbgn, ACCDATEend: ACCDATEend, strCURRENCY: strCURRENCY, strACCID: strACCID, strCustNAME: strCustNAME, strDeptName: strDeptName, strSALE: strSALE, strITEMNAME: strITEMNAME, strSubjectAccount: strSubjectAccount, acctype: this.acctype }, waitMsg: "正在查询数据...", scope: this });
//this.storeListBZT.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql, ACCDATEbgn: ACCDATEbgn, ACCDATEend: ACCDATEend, strCURRENCY: strCURRENCY, strACCID: strACCID, strCustNAME: strCustNAME, strDeptName: strDeptName, strSALE: strSALE, strITEMNAME: strITEMNAME, strSubjectAccount: strSubjectAccount, acctype: this.acctype }, waitMsg: "正在查询数据...", scope: this });
}
}
},
scope: this
});
//#endregion
}
else {//核算项目
//#region 核算项目
this.storeMonthData = Ext.create('DsExt.ux.RefTableStore', {
model: 'SubjectAccountModel',
proxy: { url: '/MvcShipping/RptCwGLDetailColumn/GetSubject' }
});
this.storeMonthData.load({
params: { condition: sql, ACCDATEbgn: ACCDATEbgn, ACCDATEend: ACCDATEend, strCURRENCY: strCURRENCY, strACCID: strACCID, strCustNAME: strCustNAME, strDeptName: strDeptName, strSALE: strSALE, strITEMNAME: strITEMNAME, strSubjectAccount: strSubjectAccount, acctype: this.acctype },
callback: function (r, options, success) {
if (success) {
//#region 列循环
if (r.length != 0) {
var acolumn = [];
for (i = 0; i < r.length; i++) {
var memberyf = r[i];
if (memberyf.data.DC.toString() == "借") {
myfield.push({ name: memberyf.data.NAME + '借', type: 'number' });
acolumn.push({
dataIndex: memberyf.data.NAME + '借',
text: memberyf.data.NAME, //'RMB应收',
align: 'right',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
});
this.strHeader += ",[" + memberyf.data.NAME + "(借)]";
}
};
if (acolumn.length > 0) {
zlcolumn.push({
text: "借方",
columns: acolumn
});
}
//
var acolumn2 = [];
for (i = 0; i < r.length; i++) {
var memberyf = r[i];
if (memberyf.data.DC.toString() == "贷") {
myfield2.push({ name: memberyf.data.NAME + '贷', type: 'number' });
acolumn2.push({
dataIndex: memberyf.data.NAME + '贷',
text: memberyf.data.NAME, //'RMB应收',
align: 'right',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
});
this.strHeader += ",[" + memberyf.data.NAME + "(贷)]";
}
};
if (acolumn2.length > 0) {
zlcolumn.push({
text: "贷方",
columns: acolumn2
});
}
}
for (var k in myfield) {
Columnfield.push(myfield[k]);
}
for (var k in myfield2) {
Columnfield.push(myfield2[k]);
}
//#endregion
//
Ext.define('ColumnModel', { extend: 'Ext.data.Model', fields: Columnfield });
this.storeList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'ColumnModel',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/RptCwGLDetailColumn/GetDataList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
},
autoLoad: false //是否允许自动加载数据
}
});
//
this.gridList.reconfigure(this.storeList, zlcolumn);
if (sql.toString() != "") {
this.sqlcontext = sql;
this.storeList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql, ACCDATEbgn: ACCDATEbgn, ACCDATEend: ACCDATEend, strCURRENCY: strCURRENCY, strACCID: strACCID, strCustNAME: strCustNAME, strDeptName: strDeptName, strSALE: strSALE, strITEMNAME: strITEMNAME, strSubjectAccount: strSubjectAccount, acctype: this.acctype }, waitMsg: "正在查询数据...", scope: this });
//this.storeListBZT.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql, ACCDATEbgn: ACCDATEbgn, ACCDATEend: ACCDATEend, strCURRENCY: strCURRENCY, strACCID: strACCID, strCustNAME: strCustNAME, strDeptName: strDeptName, strSALE: strSALE, strITEMNAME: strITEMNAME, strSubjectAccount: strSubjectAccount, acctype: this.acctype }, waitMsg: "正在查询数据...", scope: this });
}
}
else {
this.storeList.removeAll(); //清空所有
}
},
scope: this
});
//#endregion
}
},
//#endregion
//#region 查询
getCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查!');
return '';
}
var sql = '';
//#region formSearch 查询面板
//会计期间
var ACCDATEbgn = form.findField('ACCDATEbgn').getRawValue();
var ACCDATEend = form.findField('ACCDATEend').getRawValue();
if (ACCDATEbgn.toString() == "" || ACCDATEend.toString() == "") {
alert('请先选择会计期间!');
return '';
}
sql = sql + getAndConSql(sql, ACCDATEbgn, "ACCDATE>='" + ACCDATEbgn + "'");
sql = sql + getAndConSql(sql, ACCDATEend, "ACCDATE<='" + ACCDATEend + "'");
//var ACCID = form.findField('ACCID').getValue();
//sql = sql + getAndConSql(sql, ACCID, "LINKGID in (select GID from cw_accitems_gl where [YEAR]=SUBSTRING('" + strACCDATE + "',1,4) and ACCID like '" + ACCID + "%')");
//#endregion formSearch
return sql;
},
getACCDATEbgn: function () {
var form = this.formSearch.getForm();
//会计期间
var ACCDATEbgn = form.findField('ACCDATEbgn').getRawValue();
if (ACCDATEbgn.toString() == "") {
alert('请先选择会计期间!');
return '';
}
ACCDATEbgn = " and ACCDATE='" + ACCDATEbgn + "'";
return ACCDATEbgn;
},
getACCDATEend: function () {
var form = this.formSearch.getForm();
//会计期间
var ACCDATEend = form.findField('ACCDATEend').getRawValue();
if (ACCDATEend.toString() == "") {
alert('请先选择会计期间!');
return '';
}
ACCDATEend = " and ACCDATE='" + ACCDATEend + "'";
return ACCDATEend;
},
getCURRENCY: function () {
var form = this.formSearch.getForm();
var strCURRENCY = form.findField('CURRENCY').getValue();
return strCURRENCY;
},
getACCID: function () {
var form = this.formSearch.getForm();
var strACCID = form.findField('ACCID').getValue();
if (strACCID.toString().indexOf("-") > -1) {
strACCID = strACCID.substr(0, strACCID.toString().indexOf("-"));
}
return strACCID;
},
getCustNAME: function () {
var form = this.formSearch.getForm();
var strCustNAME = form.findField('CustNAME').getValue();
return strCustNAME;
},
getDeptName: function () {
var form = this.formSearch.getForm();
var strDeptName = form.findField('DeptName').getValue();
return strDeptName;
},
getSALE: function () {
var form = this.formSearch.getForm();
var strSALE = form.findField('SALE').getValue();
return strSALE;
},
getITEMNAME: function () {
var form = this.formSearch.getForm();
var strITEMNAME = form.findField('ITEMNAME').getValue();
return strITEMNAME;
},
getSubjectAccount: function () {
var form = this.formSearch.getForm();
var strSubjectAccount = form.findField('SubjectAccount').getValue();
return strSubjectAccount;
},
//#endregion
//#region 重置条件
onClearSql: function () {
var form = this.formSearch.getForm();
form.reset();
this.InitData();
}, //onDeleteClick
//#endregion
//#region 导出Excel
onExportClick2: function (button, event) {
if (this.storeList.getCount() == 0) {
return;
}
var ACCDATEbgn = this.getACCDATEbgn();
var ACCDATEend = this.getACCDATEend();
var strCURRENCY = this.getCURRENCY();
var strACCID = this.getACCID();
var strCustNAME = this.getCustNAME();
var strDeptName = this.getDeptName();
var strSALE = this.getSALE();
var strITEMNAME = this.getITEMNAME();
var strSubjectAccount = this.getSubjectAccount();
//Ext.Msg.wait('正在组织数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在组织数据, 请稍侯...',
url: '/MvcShipping/RptCwGLDetailColumn/GetDataListSQL',
params: {
condition: this.sqlcontext,
ACCDATEbgn: ACCDATEbgn,
ACCDATEend: ACCDATEend,
strCURRENCY: strCURRENCY,
strACCID: strACCID,
strCustNAME: strCustNAME,
strDeptName: strDeptName,
strSALE: strSALE,
strITEMNAME: strITEMNAME,
strSubjectAccount: strSubjectAccount,
acctype: this.acctype,
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=RptCwGLDetailColumnIndex&formname=" + this.formname + "&condition1=" + condition1 + "&condition2=" + this.strHeader.toString();
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导出函数
onExportClick: function (button, event) {
//GridExportExcelPage(this.gridList);
grid2Excel(this.gridList, "多栏账"); //需求编号SR2017090500001
},
//#endregion
//#region 打印
Print: function () {
if (this.storeList.getCount() == 0) {
return;
}
var ACCDATEbgn = this.getACCDATEbgn();
var ACCDATEend = this.getACCDATEend();
var strCURRENCY = this.getCURRENCY();
var strACCID = this.getACCID();
var strCustNAME = this.getCustNAME();
var strDeptName = this.getDeptName();
var strSALE = this.getSALE();
var strITEMNAME = this.getITEMNAME();
var strSubjectAccount = this.getSubjectAccount();
//Ext.Msg.wait('正在组织数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在组织数据, 请稍侯...',
url: '/MvcShipping/RptCwGLDetailColumn/GetDataListStr',
params: {
condition: this.sqlcontext,
ACCDATEbgn: ACCDATEbgn,
ACCDATEend: ACCDATEend,
strCURRENCY: strCURRENCY,
strACCID: strACCID,
strCustNAME: strCustNAME,
strDeptName: strDeptName,
strSALE: strSALE,
strITEMNAME: strITEMNAME,
strSubjectAccount: strSubjectAccount,
acctype: this.acctype,
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 = 'RptCwGLDetailColumnList';
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
OprationSwapJK: function () {
var ret = new Array();
ret[0] = this.OprationStatus;
ret[1] = this.storeList;
ret[2] = this.SelectedRecord;
return ret;
}
});