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/Account/Viewsjs/Chfee_management/C_MIndex.js

1640 lines
58 KiB
JavaScript

2 years ago
Ext.namespace('DsTruck');
DsTruck.Chfee_managementIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.DsTruck.Chfee_managementIndex.superclass.constructor.call(this);
};
Ext.extend(DsTruck.Chfee_managementIndex, Ext.Panel, {
PageSize: 500,
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
sqlcontext: '',
initUIComponents: function () {
//定义数据集
this.storeList = Ext.create('Ext.data.Store', {
model: 'C_Mmb',
remoteSort: false,
pageSize: this.PageSize,
proxy: {
type: 'ajax',
url: '/Account/Chfee_management/GetDataList',
reader: {
idProperty: 'Feeid',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.formname = "Chfee_management";
this.formname_Fee = "Chfee_MBody";
//枚举参照
this.MainCB = Ext.create('Ext.selection.CheckboxModel', { checkOnly: true });
Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, {
width: 30
});
this.column = [
{
sortable: true,
dataIndex: 'Feeid',
header: '费用单号',
width: 120
},
{
sortable: true,
dataIndex: 'FeeStatus_Ref',
header: '状态',
width: 80
},
{
sortable: true,
dataIndex: 'FeeType_Ref',
header: '收支方向',
width: 80
},
{
sortable: true,
dataIndex: 'FEEDATE',
header: '费用产生时间',
width: 80
},
{
sortable: true,
dataIndex: 'CREATEDATE',
header: '制单时间',
width: 80
},
{
sortable: true,
dataIndex: 'CREATOR_REF',
header: '制单人',
width: 80
},
// {
// sortable: true,
// dataIndex: 'ISVOU',
// header: '是否生成凭证',
// width: 80
// },
{
sortable: true,
dataIndex: 'VOUCHERNO',
header: '接口凭证号',
width: 80
},
{
sortable: true,
dataIndex: 'VOUALLNO',
header: '总账凭证号',
width: 80
},
{
sortable: true,
dataIndex: 'AUDITDATE',
header: '审核时间',
width: 80
},
{
sortable: true,
dataIndex: 'AUDITOR_REF',
header: '审核人',
width: 80
},
{
sortable: true, //hidden: true,
dataIndex: 'OPERATORSIDE_Ref',
header: '收支科目',
width: 80
},
{
sortable: true,
dataIndex: 'REMARK',
header: '备注',
width: 80
},
{
sortable: true,
dataIndex: 'CURRENCY',
header: '币别',
width: 80
},
{
sortable: true,
dataIndex: 'AMOUNT',
header: '金额',
width: 80,
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;
}
},
{
sortable: true, hidden: true,
dataIndex: 'OPERATORSIDE_gl_REF',
header: '科目名称(总账)',
width: 80
}];
//定义Grid
_this = this;
this.Pagenum = Ext.create('Ext.form.field.Number', {
name: 'bottles',
fieldLabel: '每页记录数',
labelAlign: 'right',
value: this.PageSize,
maxValue: 100000,
width: 180,
minValue: 0,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
stripeRows: true,
viewConfig: {
enableTextSelection: true
},
stateful: true,
selModel: this.MainCB,
tbar: [{
id: "btnFeeAuditPass",
text: '审核通过',
tooltip: '审核通过',
iconCls: "btnconfirm",
handler: function (button, event) {
this.onAuditPassClick(button, event);
},
scope: this
}, '-', {
id: "btnFeeAuditReject",
text: '驳回提交',
tooltip: '驳回提交',
iconCls: "btnrefuse",
handler: function (button, event) {
this.onAuditRefuseClick(button, event);
},
scope: this
}, '-', {
text: "导出Excel",
id: "btnExportExcel",
iconCls: 'btnexportexcel',
handler: function (button, event) {
this.onExportClick(button, event);
},
scope: this
}
],
columns: [new Ext.grid.RowNumberer()],
bbar: [Ext.create('Ext.PagingToolbar', {
store: this.storeList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
}), this.Pagenum]
});
/////////////以下部分为获取存储的gridpanel显示样式
this.column = DsTruck.GetGridPanel(GID, this.formname, this.column);
//使用者id表名 中间column数组跳过一开始的几列
this.column.unshift(new Ext.grid.RowNumberer());
this.gridList.reconfigure(this.storeList, this.column);
////////////////////////////
this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
// alert('0....' + dataview.toString() + ',' + record.toString() + ',' + item.toString() + ',' + index.toString() + ',' + e.toString() + ',' + b.toString());
this.SelectedRecord = record;
this.OprationStatus = 'edit';
DsOpenEditWin("/Account/Chfee_management/Edit", "编辑管理费用", "450", "800");
}, this);
////////////////////
this.storeList_Fee = Ext.create('Ext.data.Store', {
model: 'FeeBodymb_2',
remoteSort: false,
pageSize: this.PageSize,
proxy: {
type: 'ajax',
url: '/Account/Chfee_management/GetFeeList_Index',
reader: {
idProperty: 'gid',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.Pagenum_2 = Ext.create('Ext.form.field.Number', {
name: 'bottles',
fieldLabel: '每页记录数',
labelAlign: 'right',
value: this.PageSize,
maxValue: 100000,
width: 180,
minValue: 0,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
Ext.grid.RowNumberer_Fee = Ext.extend(Ext.grid.RowNumberer, {
width: 30
});
this.column_Fee = [/* { name: 'gid', type: 'string' },
{ name: 'Feeid', type: 'string' },
{ name: 'CUSTOMERSIDE', type: 'string' },
{ name: 'FEENAME', type: 'string' },
{ name: 'FEENAMEREF', type: 'string' },
{ name: 'AMOUNT', type: 'string' },
{ name: 'REMARK', type: 'string' },
{ name: 'DEPTGID', type: 'string' },
{ name: 'DEPTNAME', type: 'string' }*/
{
sortable: true, hidden: true,
dataIndex: 'gid',
header: 'gid',
width: 80
},
{
sortable: true,
dataIndex: 'Feeid',
header: '费用单号',
width: 120
},
{
sortable: true,
dataIndex: 'CUSTOMERSIDE',
header: '关系人',
width: 80
},
{
sortable: true,
dataIndex: 'FEENAME',
header: '费用科目',
width: 80
},
{
sortable: true,
dataIndex: 'FEENAMEREF',
header: '费用名称',
width: 80
},
{
sortable: true,
dataIndex: 'DEPTNAME',
header: '部门',
width: 80
},
{
sortable: true,
dataIndex: 'SALE',
header: '揽货人',
width: 80
},
{
sortable: true,
dataIndex: 'CURRENCY',
header: '币别',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'AMOUNT',
header: '金额',
summaryType: 'sum',
width: 80,
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;
}
},
{
sortable: true,
dataIndex: 'AMOUNTRMB',
header: 'RMB金额',
summaryType: 'sum',
width: 80,
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;
}
},
{
sortable: true,
dataIndex: 'AMOUNTUSD',
header: 'USD金额',
summaryType: 'sum',
width: 80,
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;
}
},
{
sortable: true,
dataIndex: 'AMOUNTOTHER',
header: '其他币别金额',
summaryType: 'sum',
width: 80,
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;
}
},
{
sortable: true,
dataIndex: 'VOUCHERNO',
header: '接口凭证号',
width: 80
},
{
sortable: true,
dataIndex: 'VOUALLNO',
header: '总账凭证号',
width: 80
},
{
sortable: true,
dataIndex: 'REMARK',
header: '备注',
width: 80
}];
//定义Grid
this.gridList_Fee = new Ext.grid.GridPanel({
store: this.storeList_Fee,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
stripeRows: true,
viewConfig: {
enableTextSelection: true
},
tbar: [{
text: "导出Excel",
id: "btnExportExcel2",
iconCls: 'btnexportexcel',
handler: function (button, event) {
this.onExportClick2(button, event);
},
scope: this
}
],
stateful: true,
features: [{
ftype: 'summary'//Ext.grid.feature.Summary表格汇总特性
}],
columns: [],
bbar: [Ext.create('Ext.PagingToolbar', {
store: this.storeList_Fee,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
}), this.Pagenum_2]
});
/////////////以下部分为获取存储的gridpanel显示样式
this.column_Fee = DsTruck.GetGridPanel(GID, this.formname_Fee, this.column_Fee);
//使用者id表名 中间column数组跳过一开始的几列
this.column.unshift(new Ext.grid.RowNumberer_Fee());
this.gridList_Fee.reconfigure(this.storeList_Fee, this.column_Fee);
////////////////////////////
this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
// alert('0....' + dataview.toString() + ',' + record.toString() + ',' + item.toString() + ',' + index.toString() + ',' + e.toString() + ',' + b.toString());
this.SelectedRecord = record;
this.OprationStatus = 'edit';
DsOpenEditWin("/Account/Chfee_management/Edit", "编辑管理费用", "450", "800");
}, this);
//#region formSearch
//#region formSearch枚举参照相关
this.storeFeeAccitems = Ext.create('DsExt.ux.RefTableStore', {
model: 'Accitemsmb',
proxy: { url: '/CommMng/BasicDataRef/GetMngAccitems' }
});
this.storeFeeAccitems.load({ params: { condition: ""} });
this.comboxAccitems = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '费用名称(接口)',
store: this.storeFeeAccitems,
name: 'FEENAME',
valueField: 'ACCID',
displayField: 'ACCIDNAME',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
//#endregion
this.storeUser = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsTruckMng.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' }
});
this.storeUser.load({ params: { condition: ""} });
this.comboxUser = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '制单人',
store: this.storeUser,
name: 'OP',
valueField: 'UserCode',
displayField: 'CodeAndName',
value: SHOWNAME
});
this.CheckRate = new Ext.form.Checkbox({
fieldLabel: '用系统录入汇率',
checked: true
});
this.formVoucherShow = Ext.widget('form', {
frame: true,
region: 'center',
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 90,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '凭证日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'VoucherDate'
}, this.comboxUser
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '美元汇率',
xtype: 'numberfield',
name: 'UsdExrate'
}, this.CheckRate
]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
me = this;
this.winVoucherShow = Ext.create('Ext.window.Window', {
title: "添加凭证",
width: 450,
//height : 120,
//plain : true,
iconCls: "addicon",
resizable: false,
// 是否可以拖动
// draggable:false,
collapsible: true, // 允许缩放条
closeAction: 'close',
closable: true,
modal: 'true',
buttonAlign: "center",
bodyStyle: "padding:0 0 0 0",
items: [this.formVoucherShow],
buttons: [{
text: "生成凭证",
minWidth: 70,
handler: function () {
var selectedRecords = me.gridList.selModel.getSelection();
if (selectedRecords.length == 0) {
Ext.Msg.show({ title: '提示', msg: '没有选择要生成凭证的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
var form = me.formVoucherShow.getForm();
var VoucherDate = form.findField('VoucherDate').getRawValue();
if (VoucherDate == '' || VoucherDate == null || VoucherDate == undefined) {
Ext.Msg.show({ title: '提示', msg: '必须填凭证日期!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
var UsdExrate = form.findField('UsdExrate').getValue();
if (!me.CheckRate.checked) {
if (UsdExrate == '' || UsdExrate == null || UsdExrate == undefined) {
Ext.Msg.show({ title: '提示', msg: '必须填凭证汇率!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
};
var User = me.comboxUser.getValue();
if (User == '' || User == null || User == undefined) {
Ext.Msg.show({ title: '提示', msg: '必须填凭证制单人!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
me.onCreateVoucherClick();
}
}, {
text: "关闭",
minWidth: 70,
handler: function () {
me.winVoucherShow.close();
}
}]
});
this.storeZD = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsTruckMng.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' }
});
this.storeZD.load({ params: { condition: " 1=1 "} });
this.comboxZD = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '制单人',
store: this.storeZD,
name: 'CREATOR',
valueField: 'UserCode',
displayField: 'CodeAndName',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.storeSale = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsTruckMng.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' }
});
this.storeSale.load({ params: { condition: " 1=1 "} });
this.comboxSale = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeSale,
fieldLabel: '揽货人',
name: 'SALE',
valueField: 'UserName',
displayField: 'CodeAndName',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.formSearch = Ext.widget('form', {
frame: true,
region: 'center',
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 90,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: []
}]
}, //end items(fieldset 1)
{//fieldset 2
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: []
}]
}, //end fieldset 2
{//fieldset 3
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [//this.comboxRemind,
{
fieldLabel: '费用单号',
name: 'FEEID', id: "FEEID",
flex: 1,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
},
{
fieldLabel: '会计期间',
xtype: 'monthfield',
name: 'ACCDATE', id: "ACCDATE",
flex: 1,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
},
{
fieldLabel: '费用时间 晚于',
format: 'Y-m-d',
xtype: 'datefield',
name: 'FEEDATE_min',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '费用时间 早于',
format: 'Y-m-d',
xtype: 'datefield',
name: 'FEEDATE_max',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
},
this.comboxAccitems
]
}]
}, //end items(fieldset 3)
{//fieldset 5
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxZD,this.comboxSale,{
fieldLabel: '备注中包含',
name: 'REMARK', id: "REMARK",
flex: 2,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, { xtype: 'hiddenfield'}]
}]
} //end items(fieldset 5)
]//end root items
});
//#endregion formSearch
//查询工具条
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [
{
text: "新建",
iconCls: "btnadd",
handler: function (button, event) {
this.OprationStatus = 'add';
DsOpenEditWin("/Account/Chfee_management/Edit", "新建管理费用", "450", "800");
},
scope: this
},
{
text: "删除",
iconCls: "btndelete",
handler: function (button, event) {
this.onDeleteClick(button, event);
},
scope: this
}, '-',
{
text: "打印",
handler: function (button, event) {
this.Print();
},
scope: this
},
'-',
{
text: "执行查询",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick(button, event);
},
scope: this
},
{
text: "重置条件",
iconCls: "btnreset",
handler: function (button, event) {
//this.onResetClick(button, event);
//alert(this.getCondition);
},
scope: this
}, {
text: "高级查询",
iconCls: "btnmore",
handler: function (button, event) {
var sql = this.getCondition();
var winAccess = new Shipping.DsQuery({
});
winAccess.StoreList = this.storeList;
winAccess.formname = this.formname;
winAccess.condition = sql;
winAccess.show();
return;
},
scope: this
}, '-', {
text: "生成接口凭证",
iconCls: "btnadd",
handler: function (button, event) {
var form = this.formVoucherShow.getForm();
var VoucherDate = form.findField('VoucherDate');
this.thisday = this.getToday();
VoucherDate.setRawValue(this.thisday)
this.winVoucherShow.show();
},
scope: this
}, {
text: "生成总账凭证",
id: "btnAddCwVouchers",
iconCls: "btnadd",
handler: function (button, event) {
this.onAddCwVouchers();
},
scope: this
}, '-', {
text: "保存列表样式",
id: "btntest",
handler: function (button, event) {
//this.column = DsTruck.SaveGridPanel(GID, this.formname, this.gridList.columns, this.column, 1, true);
//alert(this.column[0].id);
DsTruck.SaveGridPanel(GID, this.formname, this.gridList.columns, this.column, 1, true);
},
scope: this
}/*, '-',
{ text: "打印报表", menu: menu1, scope: this }*/
]
});
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 100,
items: [this.formSearch, this.panelBtn]
});
this.page_1 = new Ext.Panel({
id: "page_1",
title: "管理费用",
//autoScroll: true,
layout: "border",
region: 'center',
items: [this.gridList]
});
this.page_2 = new Ext.Panel({
id: "page_2",
title: "费用列表",
layout: "border",
region: 'center',
items: [this.gridList_Fee]
});
this.MainTab = new Ext.tab.Panel({
//layout: "border",
region: "center", //split: true,
items: [this.page_1, this.page_2
]
});
Ext.apply(this, {
items: [this.panelTop, this.MainTab]
});
this.storeList.on('beforeload', function (store) {
Ext.apply(store.proxy.extraParams, { condition: _this.sqlcontext });
}, this);
//#region 生成凭证_汇率列表
//#region 加载数据
//制单人
this.storePREPAREDCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' }
});
this.storePREPAREDCode.load();
this.comboxPREPARED = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '制单人',
store: this.storePREPAREDCode,
forceSelection: true,
id: 'PREPARED',
name: 'PREPARED',
valueField: 'UserName',
displayField: 'CodeAndName',
value: SHOWNAME
});
//#endregion
//#region 定义数据集
this.storeListCw = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'MsCodeCurrencyList',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/OA/Baoxiao2/GetCodeCurrencyList',
reader: {
id: 'CURR',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//#endregion
//#region 列定义
this.girdcolums = [{
sortable: false,
text: '币别',
dataIndex: 'CURR',
width: 100,
align: 'center'
}, {
sortable: false,
text: '调整汇率',
dataIndex: 'FCYEXRATE',
width: 118,
align: 'right',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 5, '', 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; },
editor: {
xtype: 'numberfield',
selectOnFocus: true, //得到焦点时自动选择文本
allowDecimals: true, //允许输入小数
decimalPrecision: 5, //允许保留的小数位数,并四舍五入
nanText: '请输入有效数值',
hideTrigger: true //是否隐藏上下调节按钮
}
}];
//#endregion
//#region gridList列表显示信息
this.gridListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1 //1单击2双击
});
this.gridListCw = new Ext.grid.GridPanel({
region: 'center',
width: 220,
store: this.storeListCw,
enableHdMenu: false, //是否显示表格列的菜单
hideHeaders: false, //是否隐藏表头
rowLines: true,
columnLines: true,
loadMask: { msg: "数据加载中,请稍等..." },
plugins: [this.gridListCellEditing],
selType: 'cellmodel',
columns: this.girdcolums
});
//#endregion
//#endregion
}, //end initUIComponents
checkHandler: function () {
alert('Checked a menu item');
},
onRefreshClick: function (button, event) {
var sql = this.getCondition();
this.sqlcontext = sql;
var _p = this.MainTab.getActiveTab().id;
if (_p == "page_1") {
this.PageSize = this.Pagenum.getValue();
this.storeList.pageSize = this.PageSize;
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
}
if (_p == "page_2") {
this.PageSize = this.Pagenum_2.getValue();
this.storeList_Fee.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
}
//alert(this.storeList.getCount());
},
onDsQuery: function (button, event) {
var sql = this.sqlcontext;
var _p = this.MainTab.getActiveTab().id;
if (_p == "page_1") {
this.PageSize = this.Pagenum.getValue();
this.storeList.pageSize = this.PageSize;
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
}
if (_p == "page_2") {
this.PageSize = this.Pagenum_2.getValue();
this.storeList_Fee.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
}
//alert(this.storeList.getCount());
},
onDeleteClick: function (button, event) {
var selections = this.gridList.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择单据!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var record = selections[0];
Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在删除数据...');
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/Account/Chfee_management/Delete',
params: {
data: Ext.JSON.encode(record.data),
USERID: GID
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.storeList.remove(record);
Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
}
},
failure: function (response, options) {
Ext.Msg.show({ title: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
},
success: function (response, options) {
},
scope: this
}); //end Ext.Ajax.request
}
}, this);
}, //onDeleteClick
onCreateVoucherClick: function (button, event) {
var feeBSNOSql = '';
var selectedRecords = this.gridList.selModel.getSelection();
var form = this.formVoucherShow.getForm();
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (rec.data.FeeStatus_Ref = '审核通过') {
if (rec.data.ISVOU != '是') {
var feeBSNO = "'" + rec.data.Feeid + "'";
if (feeBSNOSql == '') {
feeBSNOSql = feeBSNO;
} else {
feeBSNOSql = feeBSNOSql + "," + feeBSNO;
}
}
}
}
if (feeBSNOSql == '') {
Ext.Msg.show({ title: '提示', msg: '没有选择要生成凭证的业务,必须是审核通过并没有生成凭证的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
feeBSNOSql = " (" + feeBSNOSql + ")";
var VoucherDate = form.findField('VoucherDate').getRawValue();
var UsdExrate = form.findField('UsdExrate').getValue();
var User = this.comboxUser.getValue();
var useRate = 1;
if (!this.CheckRate.checked) { useRate = 0 };
Ext.Ajax.request({
waitMsg: '正在添加数据...',
url: '/Account/Chfee_management/CreateVoucher',
params: {
VoucherDate: VoucherDate,
UsdExrate: UsdExrate,
User: User,
useRate: useRate,
feesql: feeBSNOSql
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title: '提示',
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
} else {
this.winVoucherShow.close();
this.onRefreshClick();
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
},
getToday: function () {
var now = new Date();
var year = now.getFullYear(); //年
var month = now.getMonth() + 1; //月
var day = now.getDate(); //日
var clock = year + "-";
if (month < 10)
clock += "0";
clock += month + "-";
if (day < 10)
clock += "0";
clock += day + " ";
return (clock);
},
onResetClick: function (button, event) {
this.formSearch.getForm().reset();
},
getCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var sql = '';
var _p = this.MainTab.getActiveTab().id;
if (_p == "page_1") {
var FEEID = Ext.getCmp("FEEID").getRawValue();
sql = sql + getAndConSql(sql, FEEID, "cm.FEEID like '%" + FEEID + "%'");
var ACCDATE = Ext.getCmp("ACCDATE").getRawValue();
sql = sql + getAndConSql(sql, ACCDATE, "cm.ACCDATE = '" + ACCDATE + "'");
var FEEDATE_min = form.findField('FEEDATE_min').getRawValue();
sql = sql + getAndConSql(sql, FEEDATE_min, "cm.FEEDATE >= '" + FEEDATE_min + "'");
var FEEDATE_max = form.findField('FEEDATE_max').getRawValue();
sql = sql + getAndConSql(sql, FEEDATE_max, "cm.FEEDATE <= '" + FEEDATE_max + " 23:59:59'");
var CREATOR = form.findField('CREATOR').getValue();
sql = sql + getAndConSql(sql, CREATOR, "cm.CREATOR = '" + CREATOR + "'");
var SALE = form.findField('SALE').getValue();
sql = sql + getAndConSql(sql, SALE, " cm.feeid in(select distinct feeid from ch_fee_Mbody where SALE= '" + SALE + "') ");
var FEENAME = form.findField("FEENAME").getValue();
sql = sql + getAndConSql(sql, FEENAME, " (cm.feeid IN(select distinct feeid from ch_fee_Mbody where feename in(select accid from cw_accitems where accname like '%" + FEENAME + "%') union all select distinct feeid from ch_fee_Mbody where feename like '%" + FEENAME + "%') or cm.remark like '%" + FEENAME + "%' )");
var REMARK = form.findField("REMARK").getValue();
//sql = sql + getAndConSql(sql, REMARK, " cm.remark like '%" + REMARK + "%' ");
sql = sql + getAndConSql(sql, REMARK, " (cm.remark like '%" + REMARK + "%' or cm.feeid in(select distinct feeid from ch_fee_Mbody where feename in(select accid from cw_accitems where accname like '%" + REMARK + "%') or remark like '%" + REMARK + "%' )) ");
}
if (_p == "page_2") {
var FEEID = Ext.getCmp("FEEID").getRawValue();
sql = sql + getAndConSql(sql, FEEID, "cfm.FEEID like '%" + FEEID + "%'");
var ACCDATE = Ext.getCmp("ACCDATE").getRawValue();
sql = sql + getAndConSql(sql, ACCDATE, "cfm.feeid in(select distinct feeid from ch_fee_management where accdate= '" + ACCDATE + "')");
var FEEDATE_min = form.findField('FEEDATE_min').getRawValue();
sql = sql + getAndConSql(sql, FEEDATE_min, "cfm.feeid in(select distinct feeid from ch_fee_management where FEEDATE >= '" + FEEDATE_min + "')");
var FEEDATE_max = form.findField('FEEDATE_max').getRawValue();
sql = sql + getAndConSql(sql, FEEDATE_max, "cfm.feeid in(select distinct feeid from ch_fee_management where FEEDATE <= '" + FEEDATE_max + " 23:59:59')");
var CREATOR = form.findField('CREATOR').getValue();
sql = sql + getAndConSql(sql, CREATOR, " cfm.feeid in (select distinct feeid from ch_fee_management where CREATOR='" + CREATOR + "')");
var SALE = form.findField('SALE').getValue();
sql = sql + getAndConSql(sql, SALE, " cfm.SALE= '" + SALE + "' ");
var FEENAME = form.findField("FEENAME").getValue();
sql = sql + getAndConSql(sql, FEENAME, " ( feename in(select accid from cw_accitems where accname like '%" + FEENAME + "%') or feename like '%" + FEENAME + "%' or cfm.remark like '%" + FEENAME + "%' )");
var REMARK = form.findField("REMARK").getValue();
sql = sql + getAndConSql(sql, REMARK, " (cfm.feename in(select accid from cw_accitems where accname like '%" + FEENAME + "%') or cfm.remark like '%" + REMARK + "%') ");
}
return sql;
},
onGetremind: function (field, newValue, oldValue) {
if (newValue != null) {
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: newValue },
waitMsg: "正在查询数据...",
scope: this
});
}
},
OprationSwap: function () {
var ret = new Array();
ret[0] = this.OprationStatus;
ret[1] = this.storeList;
ret[2] = this.SelectedRecord;
return ret;
},
onSubmitAuditClick: function (button, event) {
//提交审核
var records = this.gridList.selModel.getSelection();
DsTruck.GLFYAudit(records, 2, '正在审核数据, 请稍侯..');
this.onRefreshClick(button, event);
},
onAuditPassClick: function (button, event) {
//审核通过
//var records = this.MainCB.selected.items;
var records = this.gridList.selModel.getSelection();
DsTruck.GLFYAudit(records, 0, '正在审核数据, 请稍侯..');
this.onRefreshClick(button, event);
},
onAuditRefuseClick: function (button, event) {
//驳回提交
var records = this.gridList.selModel.getSelection();
var cando = true;
var _a = function (record) {
if (record.data.VOUCHERNO != "") {
cando = false;
}
if (record.data.VOUALLNO != "") {
cando = false;
}
}
//var _set=function (record){
// record.data.FeeStatus_Ref="驳回提交";
//}
Ext.each(records, _a);
if (cando == true) {
DsTruck.GLFYAudit(records, 6, '正在审核数据, 请稍侯..');
this.onRefreshClick(button, event);
} else {
alert("已生成凭证,无法驳回");
}
},
Print: function () {
var sql = this.getCondition();
var sqlstr = "SELECT Feeid,FEESTATUS,FEETYPE,AMOUNT,dbo.trimdate(FEEDATE) FEEDATE";
sqlstr = sqlstr + " ,dbo.trimdate(CREATEDATE) CREATEDATE,CREATOR,VOUCHERNO,case cm.ISVOU when 1 then '是' else '否' end as ISVOU,dbo.trimdate(AUDITDATE) AUDITDATE,AUDITOR";
sqlstr = sqlstr + " ,(select showname from [user] where codename=CREATOR) CREATOR_REF,(select showname from [user] where codename=AUDITOR) AUDITOR_REF";
sqlstr = sqlstr + " ,OPERATORSIDE,BILLINGDATE,REMARK,cm.currency,cm.exchangerate";
sqlstr = sqlstr + " ,convert(bigint ,cm.TimeMark) as TimeMark,ACCDATE";
sqlstr = sqlstr + " ,(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=99024 and EnumValueID=cm.FeeStatus) as FeeStatus_Ref";
sqlstr = sqlstr + " ,(select ACCNAME from cw_accitems where accid=cm.OPERATORSIDE) as OPERATORSIDE_Ref";
sqlstr = sqlstr + " ,case FEETYPE when 1 then '收入' else '支出' end as FeeType_Ref FROM ch_fee_management cm where cm.ISDELETE<>1 ";
var printType = 'RptChfee_management';
var _p = this.MainTab.getActiveTab().id;
if (_p == "page_1") {
var sql1 = sqlstr;
if (sql != '') sql1 = sql1 + " and " + sql;
} else {
var sql1 = "SELECT * ";
sql1 = sql1 + " ,(select ACCNAME from cw_accitems where accid=cfm.feename) as Feenameref,(select voucherno from ch_fee_management where Feeid=cfm.Feeid) as Voucherno";
sql1 = sql1 + " ,(select deptname from sys_dept where gid=cfm.deptgid) as deptname";
sql1 = sql1 + " ,m.CURRENCY,case M.CURRENCY when 'RMB' then cfm.amount else 0 end AMOUNTRMB,case M.CURRENCY when 'USD' then cfm.amount else 0 end AMOUNTUSD";
sql1 = sql1 + " ,case when M.CURRENCY not in('RMB','USD') then cfm.amount else 0 end AMOUNTOTHER";
sql1 = sql1 + " FROM ch_fee_Mbody cfm left join ch_fee_management m on m.FEEID=cfm.FEEID";
if (sql != '') sql1 = sql1 + " where " + sql;
}
var sql2 = "";
var sql3 = ""; sql4 = "";
var selections = this.gridList.getSelectionModel().getSelection();
if (selections.length == 0) {
} else {
var record = selections[0];
Feeid = record.data.Feeid;
sql3 = sqlstr;
sql3 = sql3 + " WHERE cm.Feeid='" + Feeid + "'";
sql4 = " SELECT * ";
sql4 = sql4 + ",(select ACCNAME from cw_accitems where accid=cfm.feename) as Feenameref,(select voucherno from ch_fee_management where Feeid=cfm.Feeid) as Voucherno ";
sql4 = sql4 + ",(select deptname from sys_dept where gid=cfm.deptgid) as deptname FROM ch_fee_Mbody cfm where cfm.Feeid ='" + Feeid + "'";
}
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
},
onExportClick: function (button, event) {
GridExportExcelPage(this.gridList);
}
,
onExportClick2: function (button, event) {
GridExportExcelPage(this.gridList_Fee);
}
,
//#region 生成凭证
onAddCwVouchers: function (button, event) {
var selections = this.gridList.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择单据!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
//
var strError = "";
var strGids = "";
var iGids = 0;
for (var i = 0; i < selections.length; i++) {
var rec = selections[i];
if (strGids == "")
strGids = rec.data.Feeid;
else {
strGids += "," + rec.data.Feeid;
}
}
//
Ext.Ajax.request({
waitMsg: '正在预读数据,请稍候...',
url: '/Account/Chfee_management/GetIsVoucher',
params: {
strGids: strGids
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({ title: '提示', msg: result.Message, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK });
return;
}
this.storeListCw.load({ params: { strGids: strGids }, waitMsg: "正在刷新数据...", scope: this });
this.showContactForm(false, strGids, this, selections.length);
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
//
},
//#region 层_显示信息
showContactForm: function (win, strGids, _this, iGids) {
var required = '<span style="color:red;font-weight:bold;" data-qtip="Required">*</span>';
if (!win) {
//#region 编辑formDiv 基本信息
var formDiv = Ext.widget('form', {
border: false,
bodyPadding: 10,
fieldDefaults: {
labelAlign: 'right',
labelWidth: 60,
labelStyle: 'font-weight:bold'
},
items: [this.comboxPREPARED, {
fieldLabel: '记账日期',
format: 'Y-m-d',
xtype: 'datefield',
allowBlank: false,
name: 'VOUDATE',
value: Ext.util.Format.date(Ext.Date.add(new Date(), Ext.Date.MONTH - 1, 1), "Y-m-d")
}, {
xtype: "checkbox", //checkbox控件
name: "ISRATE",
boxLabel: "是否按照系统录入汇率",
width: 200,
inputValue: "true", //选中的值
uncheckedValue: "false", //未选中的值
checked: true, //绘制时的选中状态,
listeners: {
'change': function (field, newValue, oldValue, eOpts) {
if (field.checked.toString() == "false") {
this.gridListCw.show();
}
else {
this.gridListCw.hide();
}
},
scope: this
}
}, this.gridListCw
],
buttons: [{
text: '生成凭证',
handler: function (options, success, response) {
if (!this.up('form').getForm().isValid()) {
return;
}
var dataDiv = this.up('form').getForm().getValues(false, false, false);
//
var j = 0;
var bodydatas = [];
for (var i = 0; i < _this.storeListCw.getCount(); i += 1) {
var member = _this.storeListCw.getAt(i);
bodydatas.push(member);
}
var jsonBody;
if (bodydatas.length > 0) {
jsonBody = ConvertRecordsToJsonAll(bodydatas);
}
//
Ext.Msg.wait('正在生成' + iGids + '票结算单数据, 请稍侯...');
Ext.Ajax.request({
waitMsg: '正在生成' + iGids + '票结算单数据, 请稍侯...',
url: '/Account/Chfee_management/onAddCwVouchers',
scope: this,
params: {
strGids: strGids,
dataDiv: Ext.JSON.encode(dataDiv),
jsonBody: jsonBody
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.MessageBox.INFO, buttons: Ext.Msg.OK });
_this.onRefreshClick();
return;
} 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 });
}
},
timeout: 3000000//30秒
});
//
this.up('form').getForm().reset();
this.up('window').hide();
}
}, {
text: '取消',
handler: function () {
this.up('form').getForm().reset();
this.up('window').hide();
}
}],
listeners: {
scope: this,
'render': function (thisDiv, thisExtend) {
this.gridListCw.hide();
//
Ext.Ajax.request({
waitMsg: '正在查询委托编号状态...',
url: '/MvcShipping/MsBaseInfo/GetCwVOUNO',
params: {
VKNO: "记"
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({ title: '提示', msg: result.Message, icon: Ext.MessageBox.INFO, buttons: Ext.Msg.OK });
return;
}
//
data = result.data;
var arrayList = new Array();
arrayList = data.split("~");
var strY = arrayList[0].toString();
var strM = arrayList[1].toString();
var sVOUNO = arrayList[2].toString();
var strVOUNO = arrayList[3].toString();
var strVOUDATE = arrayList[4].toString();
var strACCDATE = arrayList[5].toString();
//
thisDiv.form.findField('VOUDATE').setValue(strVOUDATE);
thisDiv.form.findField('VOUDATE').setMinValue(strACCDATE + "-01");
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}
}
});
//#endregion
win = Ext.widget('window', {
title: '辅助核算',
closeAction: 'hide',
width: 250,
height: 250,
layout: 'fit',
resizable: true,
modal: true,
closable: false,
items: formDiv
});
}
win.show();
}
//#endregion
//#endregion
});