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/MsCtInitialBalance/MsCtInitialBalanceIndex.js

825 lines
36 KiB
JavaScript

Ext.namespace('Shipping');
String.prototype.trim = function () { return this.replace(/(^\s*)|(\s*$)/g, ""); }
//#region 当前日期格式
Date.prototype.format = function (format) {
var o = {
"M+": this.getMonth() + 1, //month
"d+": this.getDate(), //day
"h+": this.getHours(), //hour
"m+": this.getMinutes(), //minute
"s+": this.getSeconds(), //cond
"q+": Math.floor((this.getMonth() + 3) / 3), //quarter
"S": this.getMilliseconds() //millisecond
}
if (/(y+)/.test(format)) format = format.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
for (var k in o) if (new RegExp("(" + k + ")").test(format))
format = format.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length));
return format;
}
var xhr = new XMLHttpRequest();
var currdate = new Date();
xhr.open("HEAD", location.href, true);
xhr.onreadystatechange = function () {
if (xhr.readyState == 4 && xhr.status == 200) {
var datestr = xhr.getResponseHeader("Date");
currdate = new Date(datestr);
}
}
xhr.send(null);
//#endregion
Shipping.MsCtInitialBalanceIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsCtInitialBalanceIndex.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsCtInitialBalanceIndex, Ext.Panel, {
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
sCondition: "",
isInitial: 0,
initUIComponents: function () {
this.formname = "formMsCtInitialBalanceIndex"; //页面名称
//#region formSearch 下拉框信息加载
//银行存款科目加载
this.storeCwAccitems = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CwAccitemsGlModel',
proxy: { url: '/CommMng/BasicDataRef/GetCwAccitemsGl' }
});
this.storeCwAccitems.load({ params: { condition: "DETAILED=1 and ISENABLE=1 and ISBANK=1"} });
this.comboxACCID = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '银行存款科目',
store: this.storeCwAccitems,
forceSelection: true, //输入值是否严格为待选列表中存在的值
id: 'ACCID',
name: 'ACCID',
valueField: 'ACCID',
displayField: 'ACCIDNAME',
allowBlank: false,
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'select': function ( combo, records, eOpts ) {
if (combo.value != null) {
var sGID = "";
var AccitemsList = DsStoreQueryBy(this.storeCwAccitems, 'ACCID', combo.value.toString());
if (AccitemsList.length > 0) {
var AccitemsRaw = AccitemsList.getAt(0).raw;
sGID = AccitemsRaw.GID.toString();
}
if (sGID != "") {
this.storeCwAccitemsCurrency.load({
params: { condition: "LINKGID = '" + sGID + "'" },
callback: function (options, success, response) {
var combo = Ext.getCmp("CURRENCY");
combo.setValue(options[0].data.CURRENCY.toString()); //选中
this.InitData();
},
scope: this
});
}
}
}
}
});
//币别选项
this.storeCwAccitemsCurrency = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CwAccitemsCurrencyModel',
proxy: { url: '/CommMng/BasicDataRef/GetCwAccitemsCurrencyList' }
});
//this.storeCwAccitemsCurrency.load({ params: { condition: ""} });
this.comboxCwAccitemsCurrency = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '币别',
store: this.storeCwAccitemsCurrency,
forceSelection: true, //输入值是否严格为待选列表中存在的值
id: 'CURRENCY',
name: 'CURRENCY',
valueField: 'CURRENCY',
displayField: 'CURRENCY',
allowBlank: false,
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'select': function (_Field, newValue, eOpts) {
if (_Field.value != null) {
this.InitData();
}
}
}
});
//#endregion
//#region 编辑formHead 基本信息
this.formHead = Ext.widget('form', {
region: 'north',
frame: true,
fieldDefaults: {
labelAlign: 'right',
labelWidth: 100
},
items: [{ xtype: 'hiddenfield', height: 10 }, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
id: 'GID',
name: 'GID',
hidden: true,
value: '*'
}, this.comboxACCID, this.comboxCwAccitemsCurrency, {
name: 'ACCGID',
hidden: true,
value: ''
}, {
name: 'VOUDATE',
hidden: true
}]
}, { xtype: 'hiddenfield', height: 10}]//end items(fieldset 1)
});
this.formRJZ = Ext.widget('form', {
title: '银行日记账',
region: 'west',
frame: true,
width: 280,
fieldDefaults: {
labelAlign: 'right',
labelWidth: 120
},
items: [{ xtype: 'hiddenfield', height: 10 }, {
xtype: 'container',
layout: 'hbox',
align: 'right',
defaultType: 'textfield',
items: [{
fieldLabel: '启用期初原币余额',
name: 'QTYYEARBLC_D',
id: 'QTYYEARBLC_D',
value: '0.00',
blankText: '请填写数值!',
allowBlank: false,
selectOnFocus: true, //得到焦点时自动选择文本
//allowDecimals: true, //允许输入小数
//hideTrigger: true, //是否隐藏上下调节按钮
//xtype: 'numberfield',
regex: /^\d+(\.\d{1,2})?$/,
regexText: '请填写正确的数值!',
listeners: {
scope: this,
'blur': function blur(_field, eOpts) {
this.Save();
}
}
}]
}, { xtype: 'hiddenfield', height: 10 }, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '启用期初本位币余额',
name: 'AMTYEARBLC_D',
id: 'AMTYEARBLC_D',
value: '0.00',
blankText: '请填写数值!',
allowBlank: false,
selectOnFocus: true, //得到焦点时自动选择文本
regex: /^\d+(\.\d{1,2})?$/,
regexText: '请填写正确的数值!',
listeners: {
scope: this,
'blur': function blur(_field, eOpts) {
this.Save();
}
}
}]
}, { xtype: 'hiddenfield', height: 10 }, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '加:银收企未收',
name: 'QTYYEARCR_D',
id: 'QTYYEARCR_D',
value: '0.00',
blankText: '请填写数值!',
allowBlank: false,
selectOnFocus: true, //得到焦点时自动选择文本
disabled: true,
regex: /^\d+(\.\d{1,2})?$/,
regexText: '请填写正确的数值!'
}]
}, { xtype: 'hiddenfield', height: 10 }, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '减:银付企未付',
name: 'QTYYEARDR_D',
id: 'QTYYEARDR_D',
value: '0.00',
blankText: '请填写数值!',
allowBlank: false,
selectOnFocus: true, //得到焦点时自动选择文本
disabled: true,
regex: /^\d+(\.\d{1,2})?$/,
regexText: '请填写正确的数值!'
}]
}, { xtype: 'hiddenfield', height: 10 }, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '调整后原币金额',
name: 'QTYYEARBLC_DH',
id: 'QTYYEARBLC_DH',
value: '0.00',
blankText: '请填写数值!',
allowBlank: false,
selectOnFocus: true, //得到焦点时自动选择文本
disabled: true,
regex: /^\d+(\.\d{1,2})?$/,
regexText: '请填写正确的数值!'
}]
}]//end items(fieldset 1)
});
this.formDZD = Ext.widget('form', {
title: '银行对账单',
region: 'center',
frame: true,
fieldDefaults: {
labelAlign: 'right',
labelWidth: 120
},
items: [{ xtype: 'hiddenfield', height: 10 }, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '启用期初原币余额',
name: 'QTYYEARBLC_B',
id: 'QTYYEARBLC_B',
value: '0.00',
blankText: '请填写数值!',
allowBlank: false,
selectOnFocus: true, //得到焦点时自动选择文本
regex: /^\d+(\.\d{1,2})?$/,
regexText: '请填写正确的数值!',
listeners: {
scope: this,
'blur': function blur(_field, eOpts) {
this.Save();
}
}
}]
}, { xtype: 'hiddenfield', height: 10 }, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '加:企收银未收',
name: 'QTYYEARDR_B',
id: 'QTYYEARDR_B',
value: '0.00',
blankText: '请填写数值!',
allowBlank: false,
selectOnFocus: true, //得到焦点时自动选择文本
disabled: true,
regex: /^\d+(\.\d{1,2})?$/,
regexText: '请填写正确的数值!'
}]
}, { xtype: 'hiddenfield', height: 10 }, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '减:企付银未付',
name: 'QTYYEARCR_B',
id: 'QTYYEARCR_B',
value: '0.00',
blankText: '请填写数值!',
allowBlank: false,
selectOnFocus: true, //得到焦点时自动选择文本
disabled: true,
regex: /^\d+(\.\d{1,2})?$/,
regexText: '请填写正确的数值!'
}]
}, { xtype: 'hiddenfield', height: 10 }, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '调整后原币金额',
name: 'QTYYEARBLC_BH',
id: 'QTYYEARBLC_BH',
value: '0.00',
blankText: '请填写数值!',
allowBlank: false,
selectOnFocus: true, //得到焦点时自动选择文本
disabled: true,
regex: /^\d+(\.\d{1,2})?$/,
regexText: '请填写正确的数值!'
}]
}]//end items(fieldset 1)
});
this.formBlank = Ext.widget('form', {
region: 'south',
height: 30,
style: 'border:0px solid black; border-top:0;', //隐藏边框
frame: true,
items: [{ xtype: 'container'}]
});
//#endregion
//#region 按钮工具条
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [{
text: '企业未达...',
tooltip: '企业未达...',
iconCls: "btnadd",
handler: function (button, event) {
this.onAddClick(1);
},
scope: this
}, {
text: '银行未达...',
tooltip: '银行未达...',
iconCls: "btnadd",
handler: function (button, event) {
this.onAddClick(2);
},
scope: this
}, '-', {
text: "刷新",
id: "btnRefresh",
iconCls: "btnrefresh",
handler: function (button, event) {
this.InitData();
},
scope: this
}]
}); //end 按钮Toolbar
//#endregion
//#region 页面布局
Ext.apply(this, {
items: [this.panelBtn, this.formHead, this.formRJZ, this.formDZD]
});
//#endregion
//加载事件
this.InitData();
}, //end initUIComponents
//#region 加载事件
InitData: function () {
var sCondition = "";
var sGID = "";
var AccitemsList = DsStoreQueryBy(this.storeCwAccitems, 'ACCID', Ext.getCmp('ACCID').getValue());
if (AccitemsList.length > 0) {
var AccitemsRaw = AccitemsList.getAt(0).raw;
sGID = AccitemsRaw.GID.toString();
}
if (sGID != "") {
sCondition += "ACCGID='" + sGID + "'";
var sCACurrency = Ext.getCmp('CURRENCY').getValue();
if (sCACurrency != "") {
sCondition += " and CURRENCY='" + sCACurrency + "'";
}
//
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/MvcShipping/MsCtInitialBalance/GetData',
params: {
condition: sCondition
},
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;
}
data = result.data;
if (data.GID.toString() != "*") {
this.formHead.getForm().reset();
this.formHead.getForm().setValues(data);
}
else {
Ext.getCmp('GID').setValue("*");
}
//
this.formRJZ.getForm().findField('QTYYEARCR_D').setDisabled(false);
this.formRJZ.getForm().findField('QTYYEARDR_D').setDisabled(false);
this.formRJZ.getForm().findField('QTYYEARBLC_DH').setDisabled(false);
this.formDZD.getForm().findField('QTYYEARCR_B').setDisabled(false);
this.formDZD.getForm().findField('QTYYEARDR_B').setDisabled(false);
this.formDZD.getForm().findField('QTYYEARBLC_BH').setDisabled(false);
//
this.formRJZ.getForm().reset();
this.formRJZ.getForm().setValues(data);
this.formDZD.getForm().reset();
this.formDZD.getForm().setValues(data);
//
this.formRJZ.getForm().findField('QTYYEARCR_D').setDisabled(true);
this.formRJZ.getForm().findField('QTYYEARDR_D').setDisabled(true);
this.formRJZ.getForm().findField('QTYYEARBLC_DH').setDisabled(true);
this.formDZD.getForm().findField('QTYYEARCR_B').setDisabled(true);
this.formDZD.getForm().findField('QTYYEARDR_B').setDisabled(true);
this.formDZD.getForm().findField('QTYYEARBLC_BH').setDisabled(true);
//this.onBtnHidden(data.VOUNUM, data.VOUNUM_ISCHECKED, data.isCarryOverType);
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}
},
//#endregion
//#region 保存
Save: function (button, event) {
if (!this.formHead.getForm().isValid()) {
return;
}
if (!this.formRJZ.getForm().isValid()) {
return;
}
if (!this.formDZD.getForm().isValid()) {
return;
}
//
var sCondition = "";
var sGID = "";
var AccitemsList = DsStoreQueryBy(this.storeCwAccitems, 'ACCID', Ext.getCmp('ACCID').getValue());
if (AccitemsList.length > 0) {
var AccitemsRaw = AccitemsList.getAt(0).raw;
sGID = AccitemsRaw.GID.toString();
}
if (sGID != "") {
sCondition += "ACCGID='" + sGID + "'";
var sCACurrency = Ext.getCmp('CURRENCY').getValue();
if (sCACurrency != "") {
sCondition += " and CURRENCY='" + sCACurrency + "'";
}
//
Ext.Ajax.request({
waitMsg: '正在操作数据...',
url: '/MvcShipping/MsCtInitialBalance/GetData',
async: false, //同步请求数据
params: {
condition: sCondition
},
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;
}
data = result.data;
if (data.GID.toString() != "*") {
this.formHead.getForm().reset();
this.formHead.getForm().setValues(data);
}
else {
Ext.getCmp('GID').setValue("*");
}
//
this.formRJZ.getForm().findField('QTYYEARCR_D').setDisabled(false);
this.formRJZ.getForm().findField('QTYYEARDR_D').setDisabled(false);
this.formRJZ.getForm().findField('QTYYEARBLC_DH').setDisabled(false);
this.formDZD.getForm().findField('QTYYEARCR_B').setDisabled(false);
this.formDZD.getForm().findField('QTYYEARDR_B').setDisabled(false);
this.formDZD.getForm().findField('QTYYEARBLC_BH').setDisabled(false);
//
//this.formRJZ.getForm().reset();
//this.formRJZ.getForm().setValues(data);
//this.formDZD.getForm().reset();
//this.formDZD.getForm().setValues(data);
Ext.getCmp('QTYYEARCR_D').setValue(data.QTYYEARCR_D.toString());
Ext.getCmp('QTYYEARDR_D').setValue(data.QTYYEARDR_D.toString());
Ext.getCmp('QTYYEARDR_B').setValue(data.QTYYEARDR_B.toString());
Ext.getCmp('QTYYEARCR_B').setValue(data.QTYYEARCR_B.toString());
//
var iQTYYEARBLC_D = Number(Ext.getCmp('QTYYEARBLC_D').getValue());
var iQTYYEARCR_D = Number(Ext.getCmp('QTYYEARCR_D').getValue());
var iQTYYEARDR_D = Number(Ext.getCmp('QTYYEARDR_D').getValue());
var iQTYYEARBLC_DH = iQTYYEARBLC_D + iQTYYEARCR_D - iQTYYEARDR_D;
Ext.getCmp('QTYYEARBLC_DH').setValue(iQTYYEARBLC_DH.toString());
//
var iQTYYEARBLC_B = Number(Ext.getCmp('QTYYEARBLC_B').getValue());
var iQTYYEARCR_B = Number(Ext.getCmp('QTYYEARCR_B').getValue());
var iQTYYEARDR_B = Number(Ext.getCmp('QTYYEARDR_B').getValue());
var iQTYYEARBLC_BH = iQTYYEARBLC_B + iQTYYEARCR_B - iQTYYEARDR_B;
Ext.getCmp('QTYYEARBLC_BH').setValue(iQTYYEARBLC_BH.toString());
//
var dataHead = this.formHead.getForm().getValues(false, false, false);
dataHead.ACCGID = sGID;
var dataRJZ = this.formRJZ.getForm().getValues(false, false, false);
var dataDZD = this.formDZD.getForm().getValues(false, false, false);
//
this.formRJZ.getForm().findField('QTYYEARCR_D').setDisabled(true);
this.formRJZ.getForm().findField('QTYYEARDR_D').setDisabled(true);
this.formRJZ.getForm().findField('QTYYEARBLC_DH').setDisabled(true);
this.formDZD.getForm().findField('QTYYEARCR_B').setDisabled(true);
this.formDZD.getForm().findField('QTYYEARDR_B').setDisabled(true);
this.formDZD.getForm().findField('QTYYEARBLC_BH').setDisabled(true);
//this.onBtnHidden(data.VOUNUM, data.VOUNUM_ISCHECKED, data.isCarryOverType);
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
//
var iSave = 0;
var strCondition = this.getCondition();
Ext.Ajax.request({
waitMsg: '正在操作数据...',
url: '/MvcShipping/MsCtInitialBalance/isSave',
async: false, //同步请求数据
params: {
condition: strCondition
},
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 });
iSave++;
return;
}
data = result.data;
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
//
if (iSave == 0) {
this.formRJZ.getForm().findField('QTYYEARCR_D').setDisabled(false);
this.formRJZ.getForm().findField('QTYYEARDR_D').setDisabled(false);
this.formRJZ.getForm().findField('QTYYEARBLC_DH').setDisabled(false);
this.formDZD.getForm().findField('QTYYEARCR_B').setDisabled(false);
this.formDZD.getForm().findField('QTYYEARDR_B').setDisabled(false);
this.formDZD.getForm().findField('QTYYEARBLC_BH').setDisabled(false);
//
var dataHead = this.formHead.getForm().getValues(false, false, false);
dataHead.ACCGID = sGID;
var dataRJZ = this.formRJZ.getForm().getValues(false, false, false);
var dataDZD = this.formDZD.getForm().getValues(false, false, false);
//
this.formRJZ.getForm().findField('QTYYEARCR_D').setDisabled(true);
this.formRJZ.getForm().findField('QTYYEARDR_D').setDisabled(true);
this.formRJZ.getForm().findField('QTYYEARBLC_DH').setDisabled(true);
this.formDZD.getForm().findField('QTYYEARCR_B').setDisabled(true);
this.formDZD.getForm().findField('QTYYEARDR_B').setDisabled(true);
this.formDZD.getForm().findField('QTYYEARBLC_BH').setDisabled(true);
Ext.Msg.wait('正在操作数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在操作数据...',
url: '/MvcShipping/MsCtInitialBalance/Save',
async: false, //同步请求数据
params: {
dataHead: Ext.JSON.encode(dataHead),
dataRJZ: Ext.JSON.encode(dataRJZ),
dataDZD: Ext.JSON.encode(dataDZD)
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var data = jsonresult.Data;
this.formRJZ.getForm().findField('QTYYEARCR_D').setDisabled(false);
this.formRJZ.getForm().findField('QTYYEARDR_D').setDisabled(false);
this.formRJZ.getForm().findField('QTYYEARBLC_DH').setDisabled(false);
this.formDZD.getForm().findField('QTYYEARCR_B').setDisabled(false);
this.formDZD.getForm().findField('QTYYEARDR_B').setDisabled(false);
this.formDZD.getForm().findField('QTYYEARBLC_BH').setDisabled(false);
//
this.formHead.getForm().reset();
this.formHead.getForm().setValues(data);
this.formRJZ.getForm().reset();
this.formRJZ.getForm().setValues(data);
this.formDZD.getForm().reset();
this.formDZD.getForm().setValues(data);
//
this.formRJZ.getForm().findField('QTYYEARCR_D').setDisabled(true);
this.formRJZ.getForm().findField('QTYYEARDR_D').setDisabled(true);
this.formRJZ.getForm().findField('QTYYEARBLC_DH').setDisabled(true);
this.formDZD.getForm().findField('QTYYEARCR_B').setDisabled(true);
this.formDZD.getForm().findField('QTYYEARDR_B').setDisabled(true);
this.formDZD.getForm().findField('QTYYEARBLC_BH').setDisabled(true);
//this.InitData();
} else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
} else {
Ext.Msg.show({ title: '请重试', msg: '服务器响应出错', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
},
scope: this
});
}
else {
Ext.Ajax.request({
waitMsg: '正在操作数据...',
url: '/MvcShipping/MsCtInitialBalance/GetData',
async: false, //同步请求数据
params: {
condition: sCondition
},
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;
}
data = result.data;
if (data.GID.toString() != "*") {
this.formHead.getForm().reset();
this.formHead.getForm().setValues(data);
}
else {
Ext.getCmp('GID').setValue("*");
}
//
this.formRJZ.getForm().findField('QTYYEARCR_D').setDisabled(false);
this.formRJZ.getForm().findField('QTYYEARDR_D').setDisabled(false);
this.formRJZ.getForm().findField('QTYYEARBLC_DH').setDisabled(false);
this.formDZD.getForm().findField('QTYYEARCR_B').setDisabled(false);
this.formDZD.getForm().findField('QTYYEARDR_B').setDisabled(false);
this.formDZD.getForm().findField('QTYYEARBLC_BH').setDisabled(false);
//
this.formRJZ.getForm().reset();
this.formRJZ.getForm().setValues(data);
this.formDZD.getForm().reset();
this.formDZD.getForm().setValues(data);
//
this.formRJZ.getForm().findField('QTYYEARCR_D').setDisabled(true);
this.formRJZ.getForm().findField('QTYYEARDR_D').setDisabled(true);
this.formRJZ.getForm().findField('QTYYEARBLC_DH').setDisabled(true);
this.formDZD.getForm().findField('QTYYEARCR_B').setDisabled(true);
this.formDZD.getForm().findField('QTYYEARDR_B').setDisabled(true);
this.formDZD.getForm().findField('QTYYEARBLC_BH').setDisabled(true);
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}
}
},
//#endregion
//#region 未达...
onAddClick: function (iTYPE) {
if (!this.formHead.getForm().isValid()) {
return;
}
if (!this.formRJZ.getForm().isValid()) {
return;
}
if (!this.formDZD.getForm().isValid()) {
return;
}
//
var iSave = 0;
var strCondition = this.getCondition();
Ext.Ajax.request({
waitMsg: '正在操作数据...',
url: '/MvcShipping/MsCtInitialBalance/isSave',
async: false, //同步请求数据
params: {
condition: strCondition
},
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 });
iSave++;
return;
}
data = result.data;
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
//
if (iSave == 0) {
this.SelectedRecord = null;
this.isInitial = 1;
this.sCondition = this.getCondition2();
if (iTYPE == 1) {
//企业未达...
DsOpenEditWin('/MvcShipping/MsCtBankStatement/Edit', "银行对账单", "700", "950", "10", "10");
}
else {
//银行未达...
DsOpenEditWin('/MvcShipping/MsCtBankJournal/Edit', "银行日记账", "700", "1220", "10", "10");
}
}
},
getCondition: function () {
var sql = '';
//银行科目
var sACCID = this.formHead.getForm().findField('ACCID').getValue();
if (sACCID != null) {
if (sACCID != "") {
var sGID = "";
var AccitemsList = DsStoreQueryBy(this.storeCwAccitems, 'ACCID', sACCID);
if (AccitemsList.length > 0) {
var AccitemsRaw = AccitemsList.getAt(0).raw;
sGID = AccitemsRaw.GID.toString();
sql = sql + getAndConSql(sql, sGID, "ACCGID='" + sGID.trim() + "'");
}
}
}
//币别
var sFCYNO = this.formHead.getForm().findField('CURRENCY').getValue();
if (sFCYNO != null) {
if (sFCYNO != "") {
sql = sql + getAndConSql(sql, sFCYNO, "FCYNO='" + sFCYNO.toString().trim() + "'");
}
}
//是否期初
sql += " and ISINITIAL=0";
return sql;
},
getCondition2: function () {
var sql = '';
//银行科目
var sACCID = this.formHead.getForm().findField('ACCID').getValue();
if (sACCID != null) {
if (sACCID != "") {
var sGID = "";
var AccitemsList = DsStoreQueryBy(this.storeCwAccitems, 'ACCID', sACCID);
if (AccitemsList.length > 0) {
var AccitemsRaw = AccitemsList.getAt(0).raw;
sGID = AccitemsRaw.GID.toString();
sql = sql + getAndConSql(sql, sGID, "ACCGID='" + sGID.trim() + "'");
}
}
}
//币别
var sFCYNO = this.formHead.getForm().findField('CURRENCY').getValue();
if (sFCYNO != null) {
if (sFCYNO != "") {
sql = sql + getAndConSql(sql, sFCYNO, "FCYNO='" + sFCYNO.toString().trim() + "'");
}
}
//未达账
sql += " and (CHECKINGGID='' or CHECKINGGID is null)";
//是否期初
sql += " and ISINITIAL=1";
//是否期初
var sVOUDATE = this.formHead.getForm().findField('VOUDATE').getValue();
if (sVOUDATE != null) {
if (sVOUDATE != "") {
sql = sql + getAndConSql(sql, sVOUDATE, "convert(varchar,VOUDATE,23)='" + sVOUDATE.toString().trim() + "'");
}
}
return sql;
},
//#endregion
OprationSwap: function () {
var ret = new Array();
ret[0] = this.storeList;
ret[1] = this.SelectedRecord;
ret[2] = this.sqlcontext;
ret[3] = this.sCondition;
ret[4] = this.isInitial;
ret[5] = Ext.getCmp('btnRefresh');
return ret;
}
});