You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
DS7/DSWeb/Areas/MvcShipping/Viewsjs/MsCtCarryOver/MsCtCarryOverIndex.js

299 lines
10 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');
String.prototype.trim = function () { return this.replace(/(^\s*)|(\s*$)/g, ""); }
Shipping.MsCtCarryOverIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsCtCarryOverIndex.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsCtCarryOverIndex, Ext.Panel, {
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
strCtSTARTGID: '',
strACCDATE: '',
strACCDAY: '',
strACCTODAY: '',
initUIComponents: function () {
this.formname = "formMsCtCarryOverIndex"; //页面名称
//#region 编辑formHead 基本信息
this.formHead = Ext.widget('form', {
region: 'north',
height: 35,
frame: true,
fieldDefaults: {
labelAlign: 'right',
labelWidth: 70
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '轧账日期',
id: 'ACCDAY',
name: 'ACCDAY',
xtype: 'datefield',
format: 'Y-m-d',
allowBlank: false
}, { xtype: 'label', width: 20 }, {
xtype: 'label',
text: "注意:每月的最后一天,默认为期末结转日期!",
//style: 'font-size: 30px; color: #808000;',
anchor: '100%',
align: 'center'
}]
}]
});
//#endregion
//#region 定义数据集
this.storeList = Ext.create('Ext.data.Store', {
model: 'MsCtCarryOverModel',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsCtCarryOver/GetDataList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//#endregion
//#region 列定义
this.girdcolums = [{
sortable: false,
dataIndex: 'GID',
text: '唯一编码',
hidden: true,
width: 0
}, {
sortable: false,
dataIndex: 'ACCDAY',
header: '轧账日期',
align: 'center',
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
width: 100
}, {
sortable: false,
dataIndex: 'ISRETURN',
header: '返轧账',
xtype: "booleancolumn",
align: 'center',
width: 60,
trueText: "是",
falseText: " "
}, {
sortable: false,
dataIndex: 'ISCARRY',
header: '期末轧账',
xtype: "booleancolumn",
align: 'center',
width: 60,
trueText: "是",
falseText: " "
}, {
sortable: false,
dataIndex: 'MODIFIEDUSERNAME',
header: '操作人',
align: 'center',
width: 80
}, {
sortable: false,
dataIndex: 'MODIFIEDTIME',
header: '操作时间',
align: 'center',
width: 150
}];
//#endregion
//#region gridList列表显示信息
this.gridList = new Ext.grid.GridPanel({
region: 'center',
store: this.storeList,
enableHdMenu: false, //是否显示表格列的菜单
hideHeaders: false, //是否隐藏表头
rowLines: true,
columnLines: true,
loadMask: { msg: "数据加载中,请稍等..." },
selType: 'cellmodel',
columns: this.girdcolums
});
this.storeList.on('beforeload', function (store) { Ext.apply(store.proxy.extraParams, { condition: "" }); }, this);
this.storeList.load({ params: { condition: "" }, waitMsg: "正在查询数据...", scope: this });
//#endregion
//#region 按钮工具条/页面布局
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [{
text: "刷新",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick();
},
scope: this
}, '-', {
text: '轧账',
tooltip: '轧账',
id: "btnCARRY",
handler: function (button, event) {
this.onCARRYClick(button, event);
},
scope: this
}, {
text: '返轧账',
tooltip: '返轧账',
id: "btnRETURN",
handler: function (button, event) {
this.onRETURNClick(button, event);
},
scope: this
}]
}); //end 按钮Toolbar
Ext.apply(this, {
items: [this.panelBtn, this.formHead, this.gridList]
});
//#endregion
this.InitData();
}, //end initUIComponents
//#region 加载事件_返回财务当前账套和会计期间
InitData: function () {
Ext.Ajax.request({
waitMsg: '正在查询...',
url: '/MvcShipping/MsCtBankJournal/GetInitData',
params: {
condition: ''
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
return;
}
//var data = result.data;
var strArg = result.data.toString().split("");
this.strCtSTARTGID = strArg[0].toString();
this.strACCDATE = strArg[1].toString();
this.strACCDAY = strArg[2].toString();
this.strACCTODAY = strArg[3].toString();
//
Ext.getCmp("ACCDAY").setValue(this.strACCDAY);
//Ext.getCmp('ACCDAY').setMinValue(strACCDATE + "-01");
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
return "";
},
//#endregion
//#region 轧账
onCARRYClick: function () {
if (!this.formHead.getForm().isValid()) {
return;
}
var sACCDAY = Ext.getCmp("ACCDAY").getRawValue();
//判断是否隔期轧账
if (sACCDAY > this.strACCDAY) {
Ext.Msg.show({ title: '提示', msg: "本期还未轧账,不允许隔期轧账!", icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
Ext.getCmp("ACCDAY").setValue(this.strACCDAY);
return;
}
//判断是否期末轧账
var sISCARRY = "0";
if (sACCDAY == this.strACCDAY) {
sISCARRY = "1";
}
//
Ext.MessageBox.confirm('提示', '确定轧账吗?', function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在操作数据...');
Ext.Ajax.request({
waitMsg: '正在操作数据...',
url: '/MvcShipping/MsCtCarryOver/onCARRYClick',
params: {
ACCDAY: sACCDAY,
ISCARRY: sISCARRY
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.onRefreshClick();
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 });
},
scope: this
});
}
}, this);
},
//#endregion
//#region 返轧账
onRETURNClick: function () {
if (!this.formHead.getForm().isValid()) {
return;
}
var sACCDAY = Ext.getCmp("ACCDAY").getRawValue();
Ext.MessageBox.confirm('提示', '确定返轧账吗?', function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在操作数据...');
Ext.Ajax.request({
waitMsg: '正在操作数据...',
url: '/MvcShipping/MsCtCarryOver/onRETURNClick',
params: {
ACCDAY: sACCDAY
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.onRefreshClick();
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 });
},
scope: this
}); //end Ext.Ajax.request
}
}, this);
},
//#endregion
//#region 刷新
onRefreshClick: function (button, event) {
this.storeList.load({ params: { condition: "" }, waitMsg: "正在刷新数据...", scope: this });
}
//#endregion
});