|
|
Ext.namespace('Shipping');
|
|
|
|
|
|
Shipping.MsCwVouchersGlManagementIndex = function (config) {
|
|
|
Ext.applyIf(this, config);
|
|
|
this.initUIComponents();
|
|
|
window.Shipping.MsCwVouchersGlManagementIndex.superclass.constructor.call(this);
|
|
|
};
|
|
|
|
|
|
Ext.extend(Shipping.MsCwVouchersGlManagementIndex, Ext.Panel, {
|
|
|
PageSize: 500,
|
|
|
OprationStatus: null, //仅当弹出界面时使用
|
|
|
SelectedRecord: null,
|
|
|
strCwSTARTGID: '',
|
|
|
|
|
|
initUIComponents: function () {
|
|
|
this.formname = "MsCwVouchersGlManagement";
|
|
|
this.formname_Fee = "Chfee_MBody";
|
|
|
|
|
|
//#region 主列表
|
|
|
this.storeList = Ext.create('Ext.data.Store', {
|
|
|
model: 'C_Mmb',
|
|
|
remoteSort: false,
|
|
|
pageSize: this.PageSize,
|
|
|
proxy: {
|
|
|
type: 'ajax',
|
|
|
url: '/MvcShipping/MsCwVouchersGlManagement/GetDataList',
|
|
|
reader: {
|
|
|
idProperty: 'Feeid',
|
|
|
root: 'data',
|
|
|
totalProperty: 'totalCount'
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
//枚举参照
|
|
|
this.MainCB = Ext.create('Ext.selection.CheckboxModel');
|
|
|
//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',
|
|
|
header: '制单人',
|
|
|
width: 80
|
|
|
},
|
|
|
// {
|
|
|
// sortable: true,
|
|
|
// dataIndex: 'ISVOU',
|
|
|
// header: '是否生成凭证',
|
|
|
// width: 80
|
|
|
// },
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'VOUCHERNO',
|
|
|
header: '接口凭证号',
|
|
|
width: 100
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'VOUALLNO',
|
|
|
header: '总账凭证号',
|
|
|
width: 150
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'AUDITDATE',
|
|
|
header: '审核时间',
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'AUDITOR',
|
|
|
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,
|
|
|
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) {
|
|
|
this.SelectedRecord = record;
|
|
|
this.OprationStatus = 'edit';
|
|
|
DsOpenEditWin("/MvcShipping/MsCwVouchersGlManagement/Edit", "编辑管理费用", "450", "800");
|
|
|
}, this);
|
|
|
////////////////////
|
|
|
//#endregion
|
|
|
|
|
|
//#region 费用列表
|
|
|
this.storeList_Fee = Ext.create('Ext.data.Store', {
|
|
|
model: 'FeeBodymb_2',
|
|
|
remoteSort: false,
|
|
|
pageSize: this.PageSize,
|
|
|
proxy: {
|
|
|
type: 'ajax',
|
|
|
url: '/MvcShipping/MsCwVouchersGlManagement/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 = [
|
|
|
{
|
|
|
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: '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: 100
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'VOUALLNO',
|
|
|
header: '总账凭证号',
|
|
|
width: 100
|
|
|
},
|
|
|
{
|
|
|
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
|
|
|
},
|
|
|
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_Fee.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("/MvcShipping/MsCwVouchersGlManagement/Edit", "编辑管理费用", "450", "800");
|
|
|
}, this);
|
|
|
//#endregion
|
|
|
|
|
|
//#region formSearch 下拉框信息加载
|
|
|
//凭证状态
|
|
|
Ext.define('ISVOUALLNOModel', { extend: 'Ext.data.Model', fields: [{ name: 'Name', type: 'string'}] });
|
|
|
var dataISVOUALLNO = [{ "Name": "未生成" }, { "Name": "已生成" }, { "Name": ""}];
|
|
|
var storeISVOUALLNO = Ext.create('Ext.data.Store', { model: 'ISVOUALLNOModel', data: dataISVOUALLNO });
|
|
|
this.comboxISVOUALLNO = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: '凭证状态',
|
|
|
forceSelection: true,
|
|
|
store: storeISVOUALLNO,
|
|
|
id: 'ISVOUALLNO',
|
|
|
name: 'ISVOUALLNO',
|
|
|
labelAlign: 'right',
|
|
|
valueField: 'Name',
|
|
|
displayField: 'Name',
|
|
|
value: "未生成",
|
|
|
enableKeyEvents: true, //激活键盘事件
|
|
|
listeners: {
|
|
|
scope: this,
|
|
|
'keyup': {
|
|
|
fn: function (_field, e) {
|
|
|
if (e.getKey() == 13) {
|
|
|
this.onRefreshClick();
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
//#endregion
|
|
|
|
|
|
//#region formSearch
|
|
|
this.formSearch = Ext.widget('form', {
|
|
|
frame: true,
|
|
|
region: 'center',
|
|
|
bodyPadding: 5,
|
|
|
fieldDefaults: {
|
|
|
margins: '2 2 2 2',
|
|
|
labelAlign: 'right',
|
|
|
flex: 1,
|
|
|
labelWidth: 65,
|
|
|
msgTarget: 'qtip'
|
|
|
},
|
|
|
|
|
|
items: [{
|
|
|
xtype: 'container',
|
|
|
defaultType: 'textfield',
|
|
|
layout: 'anchor',
|
|
|
defaults: {
|
|
|
anchor: '100%'
|
|
|
},
|
|
|
items: [{
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [this.comboxISVOUALLNO, {
|
|
|
fieldLabel: '凭证号',
|
|
|
name: 'VOUALLNO',
|
|
|
enableKeyEvents: true, //激活键盘事件
|
|
|
listeners: {
|
|
|
scope: this,
|
|
|
'keyup': {
|
|
|
fn: function (_field, e) {
|
|
|
if (e.getKey() == 13) {
|
|
|
this.onRefreshClick();
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
}
|
|
|
}
|
|
|
}, {
|
|
|
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();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}]
|
|
|
}]
|
|
|
}]
|
|
|
});
|
|
|
//#endregion formSearch
|
|
|
|
|
|
//#region 按钮工具条
|
|
|
this.panelBtn = new Ext.Panel({
|
|
|
border: false,
|
|
|
region: "center", //north
|
|
|
tbar: [{
|
|
|
text: "执行查询",
|
|
|
iconCls: "btnrefresh",
|
|
|
handler: function (button, event) {
|
|
|
this.onRefreshClick(button, event);
|
|
|
},
|
|
|
scope: this
|
|
|
},
|
|
|
{
|
|
|
text: "重置条件",
|
|
|
iconCls: "btnreset",
|
|
|
handler: function (button, event) {
|
|
|
this.onResetClick(button, event);
|
|
|
},
|
|
|
scope: this
|
|
|
}, {
|
|
|
text: "生成总账凭证",
|
|
|
id: "btnAddCwVouchers",
|
|
|
iconCls: "btnadd",
|
|
|
handler: function (button, event) {
|
|
|
this.onAddCwVouchers();
|
|
|
},
|
|
|
scope: this
|
|
|
}]
|
|
|
});
|
|
|
//#endregion
|
|
|
|
|
|
//#region 布局
|
|
|
this.panelZQ = new Ext.Panel({
|
|
|
layout: "border",
|
|
|
region: "east",
|
|
|
width: 500,
|
|
|
style: 'text-align:right;',
|
|
|
border: false,
|
|
|
items: [{
|
|
|
xtype: 'displayfield',
|
|
|
id: 'lbTitle2',
|
|
|
name: 'lbTitle2',
|
|
|
value: " "
|
|
|
}]
|
|
|
});
|
|
|
|
|
|
this.panelTopF = new Ext.Panel({
|
|
|
layout: "border",
|
|
|
region: "north",
|
|
|
height: 26,
|
|
|
//border: false,
|
|
|
items: [this.panelBtn, this.panelZQ]
|
|
|
});
|
|
|
|
|
|
this.panelTop = new Ext.Panel({
|
|
|
layout: "border",
|
|
|
region: "north",
|
|
|
height: 70,
|
|
|
border: false,
|
|
|
items: [this.panelTopF, this.formSearch]
|
|
|
});
|
|
|
this.page_1 = new Ext.Panel({
|
|
|
id: "page_1",
|
|
|
title: "管理费用",
|
|
|
border: false,
|
|
|
layout: "border",
|
|
|
region: 'center',
|
|
|
items: [this.gridList]
|
|
|
});
|
|
|
this.page_2 = new Ext.Panel({
|
|
|
id: "page_2",
|
|
|
title: "费用列表",
|
|
|
layout: "border",
|
|
|
region: 'center',
|
|
|
border: false,
|
|
|
items: [this.gridList_Fee]
|
|
|
});
|
|
|
this.MainTab = new Ext.tab.Panel({
|
|
|
border: false,
|
|
|
region: "center",
|
|
|
items: [this.page_1, this.page_2
|
|
|
]
|
|
|
});
|
|
|
|
|
|
Ext.apply(this, {
|
|
|
border: false,
|
|
|
items: [this.panelTop, this.MainTab]
|
|
|
});
|
|
|
//#endregion
|
|
|
|
|
|
this.storeList.on('beforeload', function (store) {
|
|
|
var sql = this.getCondition();
|
|
|
Ext.apply(store.proxy.extraParams, { condition: sql });
|
|
|
}, 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
|
|
|
|
|
|
this.InitDataCw();
|
|
|
//#endregion
|
|
|
}, //end initUIComponents
|
|
|
|
|
|
//#region 加载事件
|
|
|
InitDataCw: function () {
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在查询主表数据...',
|
|
|
url: '/MvcShipping/RptCwGenlegAccitems/GetData',
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
var result = Ext.JSON.decode(response.responseText);
|
|
|
if (!result.Success) {
|
|
|
return;
|
|
|
}
|
|
|
data = result.data;
|
|
|
var arrtmp = data.toString().split("&");
|
|
|
this.strCwSTARTGID = arrtmp[0].toString();
|
|
|
var strCwSTARTNAME = arrtmp[1].toString();
|
|
|
var strCwACCDATE = arrtmp[2].toString();
|
|
|
var sYear = arrtmp[3].toString();
|
|
|
var sMonth = arrtmp[4].toString();
|
|
|
//
|
|
|
var sZQ = " 当前登录账套:“" + strCwSTARTNAME + "” 当前财务账期:“" + sYear + "年第" + sMonth + "期” ";
|
|
|
Ext.getCmp("lbTitle2").setValue(sZQ);
|
|
|
//this.onRefreshClick();
|
|
|
} else {
|
|
|
//Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
});
|
|
|
}, //end InitData
|
|
|
//#endregion
|
|
|
|
|
|
onRefreshClick: function (button, event) {
|
|
|
var sql = this.getCondition();
|
|
|
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());
|
|
|
},
|
|
|
|
|
|
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;
|
|
|
|
|
|
sql = sql + "FEESTATUS=0";
|
|
|
|
|
|
//页面
|
|
|
if (_p == "page_1") {
|
|
|
//凭证状态
|
|
|
var ISVOUALLNO = form.findField('ISVOUALLNO').getValue();
|
|
|
if (ISVOUALLNO == "未生成") {
|
|
|
sql = sql + getAndConSql(sql, ISVOUALLNO, "FEEID not in (select BSGID from [cw_vouno_bs_gl] where [BSTABLENAME]='ch_fee_management' and [STARTGID]='" + this.strCwSTARTGID + "')");
|
|
|
}
|
|
|
else if (ISVOUALLNO == "已生成") {
|
|
|
sql = sql + getAndConSql(sql, ISVOUALLNO, "FEEID in (select BSGID from [cw_vouno_bs_gl] where [BSTABLENAME]='ch_fee_management' and [STARTGID]='" + this.strCwSTARTGID + "')");
|
|
|
}
|
|
|
|
|
|
//凭证号
|
|
|
var VOUALLNO = form.findField('VOUALLNO').getValue();
|
|
|
sql = sql + getAndConSql(sql, VOUALLNO, "FEEID in (select BSGID from [cw_vouno_bs_gl] where [BSTABLENAME]='ch_fee_management' and [STARTGID]='" + this.strCwSTARTGID + "' and VOUALLNO like '%" + VOUALLNO + "%')");
|
|
|
|
|
|
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'");
|
|
|
}
|
|
|
if (_p == "page_2") {
|
|
|
//凭证状态
|
|
|
var ISVOUALLNO = form.findField('ISVOUALLNO').getValue();
|
|
|
if (ISVOUALLNO == "未生成") {
|
|
|
sql = sql + getAndConSql(sql, ISVOUALLNO, "cfm.FEEID not in (select BSGID from [cw_vouno_bs_gl] where [BSTABLENAME]='ch_fee_management' and [STARTGID]='" + this.strCwSTARTGID + "')");
|
|
|
}
|
|
|
else if (ISVOUALLNO == "已生成") {
|
|
|
sql = sql + getAndConSql(sql, ISVOUALLNO, "cfm.FEEID in (select BSGID from [cw_vouno_bs_gl] where [BSTABLENAME]='ch_fee_management' and [STARTGID]='" + this.strCwSTARTGID + "')");
|
|
|
}
|
|
|
|
|
|
//凭证号
|
|
|
var VOUALLNO = form.findField('VOUALLNO').getValue();
|
|
|
sql = sql + getAndConSql(sql, VOUALLNO, "cfm.FEEID in (select BSGID from [cw_vouno_bs_gl] where [BSTABLENAME]='ch_fee_management' and [STARTGID]='" + this.strCwSTARTGID + "' and VOUALLNO like '%" + VOUALLNO + "%')");
|
|
|
|
|
|
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')");
|
|
|
}
|
|
|
return sql;
|
|
|
},
|
|
|
|
|
|
OprationSwap: function () {
|
|
|
var ret = new Array();
|
|
|
ret[0] = this.OprationStatus;
|
|
|
ret[1] = this.storeList;
|
|
|
ret[2] = this.SelectedRecord;
|
|
|
return ret;
|
|
|
},
|
|
|
|
|
|
//#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: '/MvcShipping/MsCwVouchersGlManagement/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: '/MvcShipping/MsCwVouchersGlManagement/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
|
|
|
});
|