|
|
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;
|
|
|
}
|
|
|
//#endregion
|
|
|
|
|
|
//#region 获取 YYYY-mm-dd 格式的日期
|
|
|
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
|
|
|
|
|
|
//#region 关闭窗口前的判断
|
|
|
function getSaved() {
|
|
|
var changelines = panelEdit.storeDetailList.getModifiedRecords();
|
|
|
var changecount = changelines.length;
|
|
|
var delcount = panelEdit.DelBody.length;
|
|
|
var AllDirty = true;
|
|
|
if (changecount == 0 && delcount == 0) { return false; }
|
|
|
if (panelEdit.formHead.getForm().isDirty() == true || AllDirty == true) { return true; }
|
|
|
else { return false };
|
|
|
}
|
|
|
//#endregion
|
|
|
|
|
|
Shipping.MsCwVouchersEdit = function (config) {
|
|
|
Ext.applyIf(this, config);
|
|
|
this.initUIComponents();
|
|
|
window.Shipping.MsCwVouchersEdit.superclass.constructor.call(this);
|
|
|
};
|
|
|
|
|
|
Ext.extend(Shipping.MsCwVouchersEdit, Ext.Panel, {
|
|
|
opStatus: 'add',
|
|
|
ParentWin: null,
|
|
|
StoreList: null,
|
|
|
EditRecord: null,
|
|
|
sqlcontext: '',
|
|
|
btnRefresh: null,
|
|
|
tbVOUNO: null,
|
|
|
btnAddCwVouchersJK: null,
|
|
|
btnSelCwVouchersJK: null,
|
|
|
|
|
|
initUIComponents: function () {
|
|
|
this.serialNo = 0;
|
|
|
this.itemindex = 1;
|
|
|
this.DelBody = [];
|
|
|
|
|
|
//#region formSearch 下拉框信息加载
|
|
|
//科目加载
|
|
|
this.storeCwAccitems = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'DsShipping.ux.CwAccitemsGlModel',
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetCwAccitems' }
|
|
|
});
|
|
|
this.storeCwAccitems.load({ params: { condition: ""} });
|
|
|
this.comboxACCNAME = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
//fieldLabel: '科目名称',
|
|
|
store: this.storeCwAccitems,
|
|
|
forceSelection: false, //输入值是否严格为待选列表中存在的值
|
|
|
id: 'ACCNAME',
|
|
|
name: 'ACCNAME',
|
|
|
valueField: 'ACCNAME',
|
|
|
displayField: 'ACCIDNAME',
|
|
|
allowBlank: false,
|
|
|
matchFieldWidth: false, //下拉款自适应宽度
|
|
|
enableKeyEvents: true, //激活键盘事件
|
|
|
listeners: {
|
|
|
scope: this,
|
|
|
'focus': function (combo, eOpts) {
|
|
|
if (combo.value != null) {
|
|
|
var selections = this.gridList.getSelectionModel().getSelection(); //获得选中的项
|
|
|
var sACCID = selections[0].data.ACCID;
|
|
|
var strOriginalValue = combo.value.toString();
|
|
|
if (strOriginalValue.indexOf("▁") < 0) {
|
|
|
var ayList = new Array();
|
|
|
ayList = strOriginalValue.split("▁");
|
|
|
var AccitemsList = DsStoreQueryBy(this.storeCwAccitems, 'ACCIDNAME', (sACCID + "_" + ayList[0].toString()));
|
|
|
if (AccitemsList.length > 0) {
|
|
|
var AccitemsRaw = AccitemsList.getAt(0);
|
|
|
if (AccitemsRaw != null) {
|
|
|
combo.setValue((sACCID + "-" + ayList[0].toString()), combo.value.toString());
|
|
|
selections[0].set('ACCALL', strOriginalValue);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
'blur': function blur(combo, eOpts) {
|
|
|
if (combo.value != null) {
|
|
|
var strOriginalValue = combo.value.toString();
|
|
|
var ayList = new Array();
|
|
|
ayList = strOriginalValue.split("▁");
|
|
|
var AccitemsList = DsStoreQueryBy(this.storeCwAccitems, 'ACCNAME', ayList[0].toString());
|
|
|
if (AccitemsList.length > 0) {
|
|
|
var AccitemsRaw = AccitemsList.getAt(0);
|
|
|
if (AccitemsRaw == null) {
|
|
|
combo.setValue("");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
combo.setValue("");
|
|
|
}
|
|
|
},
|
|
|
'select': function (combo, records, eOpts) {
|
|
|
if (combo.value.toString() != "") {
|
|
|
var AccitemsList = DsStoreQueryBy(this.storeCwAccitems, 'ACCIDNAME', combo.rawValue.toString());
|
|
|
if (AccitemsList.length > 0) {
|
|
|
var AccitemsRaw = AccitemsList.getAt(0).raw;
|
|
|
this.onColumnsHidden(false, AccitemsRaw.ISFCY);
|
|
|
var selections = this.gridList.getSelectionModel().getSelection(); //获得选中的项
|
|
|
//是不是外币,都默认为RMB?
|
|
|
var ssCURRENCY = selections[0].data.FCYNO;
|
|
|
this.storeCwAccitemsCurrency.load({
|
|
|
params: { condition: "" },
|
|
|
waitMsg: "正在刷新数据...",
|
|
|
callback: function (options, success, response) {
|
|
|
var combo = Ext.getCmp("CURRENCY");
|
|
|
if (options.length > 0) {
|
|
|
for (var i = 0; i < options.length; i++) {
|
|
|
if (options[i].data.CODENAME.toString() == selections[0].data.FCYNO.toString()) {
|
|
|
ssCURRENCY = selections[0].data.FCYNO.toString();
|
|
|
break;
|
|
|
}
|
|
|
ssCURRENCY = options[0].data.CURRENCY;
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
ssCURRENCY = "RMB";
|
|
|
}
|
|
|
combo.setValue(ssCURRENCY); //选中
|
|
|
selections[0].set('FCYNO', ssCURRENCY);
|
|
|
},
|
|
|
async: false,
|
|
|
scope: this
|
|
|
});
|
|
|
combo.setValue(combo.value.toString());
|
|
|
selections[0].set('ACCNAME', combo.value.toString());
|
|
|
selections[0].set('ACCID', AccitemsRaw.ACCID.toString());
|
|
|
//
|
|
|
if (AccitemsRaw.ISFCY) {
|
|
|
//如果是外币,则默认传送''
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在查询汇率值...',
|
|
|
url: '/MvcShipping/MsCwVouchers/GetFCYEXRATE',
|
|
|
params: {
|
|
|
FCY: '',
|
|
|
LINKGID: AccitemsRaw.GID.toString()
|
|
|
},
|
|
|
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;
|
|
|
}
|
|
|
var strArg = result.data.toString().split(",");
|
|
|
var FCYNO = strArg[0].toString();
|
|
|
var strFCYEXRATE = selections[0].data.FCYEXRATE;
|
|
|
if (strFCYEXRATE == 1) {
|
|
|
strFCYEXRATE = Div(strArg[1].toString(), 1, 5);
|
|
|
}
|
|
|
selections[0].set('FCYEXRATE', strFCYEXRATE);
|
|
|
selections[0].set('FCYNO', ssCURRENCY); //FCYNO
|
|
|
selections[0].set('CURRENCY', ssCURRENCY); //FCYNO
|
|
|
//
|
|
|
var AMTDR = selections[0].data.AMTDR;
|
|
|
var AMTCR = selections[0].data.AMTCR;
|
|
|
var AMT = 0;
|
|
|
if (AMTDR != 0) {
|
|
|
AMT = AMTDR;
|
|
|
}
|
|
|
if (AMTCR != 0) {
|
|
|
AMT = AMTCR;
|
|
|
}
|
|
|
selections[0].set('FCYAMT', Div(AMT, strFCYEXRATE, 2));
|
|
|
} else {
|
|
|
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
|
|
|
}
|
|
|
},
|
|
|
async: false,
|
|
|
scope: this
|
|
|
});
|
|
|
}
|
|
|
else {
|
|
|
selections[0].set('FCYEXRATE', 1);
|
|
|
selections[0].set('FCYNO', 'RMB');
|
|
|
selections[0].set('FCYAMT', 0);
|
|
|
}
|
|
|
if (AccitemsRaw.ISDEPTACC || AccitemsRaw.ISEMPLACC || AccitemsRaw.ISCORPACC || AccitemsRaw.ISITEMACC) {
|
|
|
//var strOriginalValue = selections[0].get('ACCALL');
|
|
|
var strOriginalValue = combo.value.toString();
|
|
|
this.showContactForm(false, combo.value.toString(), strOriginalValue.toString(), AccitemsRaw, selections, false);
|
|
|
}
|
|
|
else {
|
|
|
this.onNextKeyClick(4);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
'keyup': {
|
|
|
fn: function (_field, e, eOpts) {
|
|
|
if (e.getKey() == 118) {//F7
|
|
|
DsOpenEditWin('/MvcShipping/MsCwAccitemsGl/Index', "科目信息", "500", "800", (window.screen.availHeight / 2 - 150), (window.screen.availWidth / 2 - 500));
|
|
|
}
|
|
|
else if (e.getKey() == 13) {
|
|
|
var newValue = _field.rawValue.toString();
|
|
|
var inv = newValue.indexOf("-");
|
|
|
if (inv > -1) {
|
|
|
newValue = newValue.substr(inv + 1);
|
|
|
}
|
|
|
if (newValue != "") {
|
|
|
var AccitemsList = DsStoreQueryBy(this.storeCwAccitems, 'ACCIDNAME', _field.rawValue.toString());
|
|
|
if (AccitemsList.length > 0) {
|
|
|
var AccitemsRaw = AccitemsList.getAt(0).raw;
|
|
|
this.onColumnsHidden(false, AccitemsRaw.ISFCY);
|
|
|
var selections = this.gridList.getSelectionModel().getSelection(); //获得选中的项
|
|
|
selections[0].set('ACCID', AccitemsRaw.ACCID.toString());
|
|
|
|
|
|
//是不是外币,都默认为RMB?
|
|
|
var ssCURRENCY = selections[0].data.FCYNO;
|
|
|
this.storeCwAccitemsCurrency.load({
|
|
|
params: { condition: "" },
|
|
|
waitMsg: "正在刷新数据...",
|
|
|
callback: function (options, success, response) {
|
|
|
var combo = Ext.getCmp("CURRENCY");
|
|
|
if (options.length > 0) {
|
|
|
for (var i = 0; i < options.length; i++) {
|
|
|
if (options[i].data.CODENAME.toString() == selections[0].data.FCYNO.toString()) {
|
|
|
ssCURRENCY = selections[0].data.FCYNO.toString();
|
|
|
break;
|
|
|
}
|
|
|
ssCURRENCY = options[0].data.CURRENCY;
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
ssCURRENCY = "RMB";
|
|
|
}
|
|
|
combo.setValue(ssCURRENCY); //选中
|
|
|
selections[0].set('FCYNO', ssCURRENCY);
|
|
|
selections[0].set('CURRENCY', ssCURRENCY); //FCYNO
|
|
|
},
|
|
|
async: false,
|
|
|
scope: this
|
|
|
});
|
|
|
|
|
|
if (AccitemsRaw.ISFCY) {
|
|
|
//如果是外币,则默认传送''
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在查询汇率值...',
|
|
|
url: '/MvcShipping/MsCwVouchers/GetFCYEXRATE',
|
|
|
params: {
|
|
|
FCY: '',
|
|
|
LINKGID: AccitemsRaw.GID.toString()
|
|
|
},
|
|
|
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;
|
|
|
}
|
|
|
var strArg = result.data.toString().split(",");
|
|
|
var FCYNO = strArg[0].toString();
|
|
|
var strFCYEXRATE = selections[0].data.FCYEXRATE;
|
|
|
if (strFCYEXRATE == 1) {
|
|
|
strFCYEXRATE = Div(strArg[1].toString(), 1, 5);
|
|
|
}
|
|
|
selections[0].set('FCYEXRATE', strFCYEXRATE.toString());
|
|
|
selections[0].set('FCYNO', FCYNO);
|
|
|
selections[0].set('CURRENCY', FCYNO);
|
|
|
//
|
|
|
var AMTDR = selections[0].data.AMTDR;
|
|
|
var AMTCR = selections[0].data.AMTCR;
|
|
|
var AMT = 0;
|
|
|
if (AMTDR != 0) {
|
|
|
AMT = AMTDR;
|
|
|
}
|
|
|
if (AMTCR != 0) {
|
|
|
AMT = AMTCR;
|
|
|
}
|
|
|
selections[0].set('FCYAMT', Div(AMT, strFCYEXRATE, 2));
|
|
|
} else {
|
|
|
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
|
|
|
}
|
|
|
},
|
|
|
async: false,
|
|
|
scope: this
|
|
|
});
|
|
|
}
|
|
|
else {
|
|
|
selections[0].set('ACCNAME', newValue);
|
|
|
selections[0].set('ACCALL', newValue);
|
|
|
selections[0].set('FCYEXRATE', 1);
|
|
|
selections[0].set('FCYNO', 'RMB');
|
|
|
selections[0].set('FCYAMT', 0);
|
|
|
}
|
|
|
|
|
|
if (AccitemsRaw.ISDEPTACC || AccitemsRaw.ISEMPLACC || AccitemsRaw.ISCORPACC || AccitemsRaw.ISITEMACC) {
|
|
|
var strOriginalValue = selections[0].get('ACCALL');
|
|
|
this.showContactForm(false, newValue.toString(), strOriginalValue.toString(), AccitemsRaw, selections, false);
|
|
|
}
|
|
|
else {
|
|
|
this.onNextKeyClick(4);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
//
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
},
|
|
|
'render': function (_field, eOpts) {//自定义函数,定义双击事件
|
|
|
var _this = this;
|
|
|
_field.getEl().on('dblclick', function (e, t, eOpts) {
|
|
|
var selections = _this.gridList.getSelectionModel().getSelection(); //获得选中的项
|
|
|
var strOriginalValue = selections[0].get('ACCALL');
|
|
|
var strACCID = selections[0].get('ACCID');
|
|
|
if (strOriginalValue.indexOf("▁") > -1) {
|
|
|
var ayList = new Array();
|
|
|
ayList = strOriginalValue.split("▁");
|
|
|
var AccitemsList = DsStoreQueryBy(_this.storeCwAccitems, 'ACCIDNAME', (strACCID + "_" + ayList[0].toString()));
|
|
|
if (AccitemsList.length > 0) {
|
|
|
var AccitemsRaw = AccitemsList.getAt(0).raw;
|
|
|
_this.showContactForm(false, ayList[0].toString(), strOriginalValue.toString(), AccitemsRaw, selections, true);
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
//币别选项
|
|
|
this.storeCwAccitemsCurrency = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'DsShipping.ux.CodeCurrencyModel',
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetCodeCurrencyList' }
|
|
|
});
|
|
|
this.storeCwAccitemsCurrency.load({ params: { condition: ""} });
|
|
|
this.comboxCodeCurrency = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
//fieldLabel: '币别',
|
|
|
store: this.storeCwAccitemsCurrency,
|
|
|
forceSelection: true, //输入值是否严格为待选列表中存在的值
|
|
|
id: 'CURRENCY',
|
|
|
name: 'CURRENCY',
|
|
|
valueField: 'CODENAME',
|
|
|
displayField: 'CODENAME',
|
|
|
enableKeyEvents: true, //激活键盘事件
|
|
|
listeners: {
|
|
|
scope: this,
|
|
|
'focus': function (_this, eOpts) {
|
|
|
var selections = this.gridList.getSelectionModel().getSelection(); //获得选中的项
|
|
|
var strACCID = selections[0].get('ACCID');
|
|
|
var sCURRENCY = selections[0].data.FCYNO.toString().trim();
|
|
|
var sACCNAME = selections[0].data.ACCNAME.toString().trim();
|
|
|
if (sACCNAME == "") {
|
|
|
var ayList = new Array();
|
|
|
ayList = selections[0].data.ACCALL.toString().trim().split("▁");
|
|
|
sACCNAME = ayList[0].toString();
|
|
|
}
|
|
|
var AccitemsList = DsStoreQueryBy(this.storeCwAccitems, 'ACCIDNAME', (strACCID + "_" + sACCNAME));
|
|
|
if (AccitemsList.length > 0) {
|
|
|
var AccitemsRaw = AccitemsList.getAt(0).raw;
|
|
|
var ssCURRENCY = selections[0].data.FCYNO;
|
|
|
this.storeCwAccitemsCurrency.load({
|
|
|
params: { condition: "" },
|
|
|
waitMsg: "正在刷新数据...",
|
|
|
callback: function (options, success, response) {
|
|
|
var combo = Ext.getCmp("CURRENCY");
|
|
|
if (options.length > 0) {
|
|
|
for (var i = 0; i < options.length; i++) {
|
|
|
if (options[i].data.CODENAME.toString() == selections[0].data.FCYNO.toString()) {
|
|
|
ssCURRENCY = selections[0].data.FCYNO.toString();
|
|
|
break;
|
|
|
}
|
|
|
ssCURRENCY = options[0].data.CURRENCY;
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
ssCURRENCY = "RMB";
|
|
|
}
|
|
|
sCURRENCY = ssCURRENCY;
|
|
|
combo.setValue(ssCURRENCY); //选中
|
|
|
},
|
|
|
scope: this
|
|
|
});
|
|
|
selections[0].set('FCYNO', sCURRENCY);
|
|
|
selections[0].set('CURRENCY', sCURRENCY);
|
|
|
}
|
|
|
},
|
|
|
'select': function (combo, records, eOpts) {
|
|
|
var selections = this.gridList.getSelectionModel().getSelection(); //获得选中的项
|
|
|
var strACCID = selections[0].get('ACCID');
|
|
|
if (combo.value != "RMB") {
|
|
|
var sACCNAME = selections[0].data.ACCNAME.toString().trim();
|
|
|
if (sACCNAME == "") {
|
|
|
var ayList = new Array();
|
|
|
ayList = selections[0].data.ACCALL.toString().trim().split("▁");
|
|
|
sACCNAME = ayList[0].toString();
|
|
|
}
|
|
|
var AccitemsList = DsStoreQueryBy(this.storeCwAccitems, 'ACCIDNAME', (strACCID + "_" + sACCNAME));
|
|
|
if (AccitemsList.length > 0) {
|
|
|
var AccitemsRaw = AccitemsList.getAt(0).raw;
|
|
|
//如果是外币,则默认传送combo.value
|
|
|
if (AccitemsRaw.ISFCY) {
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在查询汇率值...',
|
|
|
url: '/MvcShipping/MsCwVouchers/GetFCYEXRATE',
|
|
|
params: {
|
|
|
FCY: combo.value,
|
|
|
LINKGID: AccitemsRaw.GID.toString()
|
|
|
},
|
|
|
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;
|
|
|
}
|
|
|
//
|
|
|
var strArg = result.data.toString().split(",");
|
|
|
var FCYNO = strArg[0].toString();
|
|
|
var strFCYEXRATE = selections[0].data.FCYEXRATE;
|
|
|
if (strFCYEXRATE == 1) {
|
|
|
strFCYEXRATE = Div(strArg[1].toString(), 1, 5);
|
|
|
}
|
|
|
selections[0].set('FCYEXRATE', strFCYEXRATE);
|
|
|
selections[0].set('FCYNO', combo.value);
|
|
|
selections[0].set('CURRENCY', combo.value);
|
|
|
//
|
|
|
var AMTDR = selections[0].data.AMTDR;
|
|
|
var AMTCR = selections[0].data.AMTCR;
|
|
|
var AMT = 0;
|
|
|
if (AMTDR != 0) {
|
|
|
AMT = AMTDR;
|
|
|
}
|
|
|
if (AMTCR != 0) {
|
|
|
AMT = AMTCR;
|
|
|
}
|
|
|
selections[0].set('FCYAMT', Div(AMT, strFCYEXRATE, 2));
|
|
|
} else {
|
|
|
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
selections[0].set('FCYEXRATE', 1);
|
|
|
selections[0].set('FCYNO', 'RMB');
|
|
|
selections[0].set('FCYAMT', 0);
|
|
|
}
|
|
|
},
|
|
|
'keyup': {
|
|
|
fn: function (_field, e) {
|
|
|
if (e.getKey() == 13) {
|
|
|
this.onNextKeyClick(5);
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
//键值维护表_凭证字
|
|
|
this.storeCrmKeyCodeCode = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'DsShipping.ux.CrmKeyCodeModel',
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetCrmKeyCodeList' }
|
|
|
});
|
|
|
this.storeCrmKeyCodeCode.load({ params: { condition: " and KEYTYPE='凭证字'"} });
|
|
|
this.comboxVKNO = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: '凭证字',
|
|
|
labelWidth: 50,
|
|
|
store: this.storeCrmKeyCodeCode,
|
|
|
forceSelection: true,
|
|
|
name: 'VKNO',
|
|
|
width: 100,
|
|
|
valueField: 'KEYVALUE',
|
|
|
displayField: 'KEYVALUE',
|
|
|
value: '记',
|
|
|
allowBlank: false
|
|
|
//
|
|
|
});
|
|
|
//#endregion
|
|
|
|
|
|
//#region 编辑formHead 基本信息
|
|
|
this.formHead = Ext.widget('form', {
|
|
|
region: 'north',
|
|
|
frame: true,
|
|
|
//bodyPadding: 5,
|
|
|
trackResetOnLoad: true, //是否记录字段原始值
|
|
|
fieldDefaults: {
|
|
|
labelAlign: 'right',
|
|
|
labelWidth: 40,
|
|
|
msgTarget: 'qtip'
|
|
|
//,style: 'font-size: 30px; color: #808000; vertical-align: text-bottom;'
|
|
|
},
|
|
|
items: [{
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [{ xtype: 'label', flex: 1 }, {
|
|
|
xtype: 'label',
|
|
|
text: "记账凭证",
|
|
|
style: 'font-size: 30px; color: #808000;',
|
|
|
anchor: '100%',
|
|
|
align: 'center'
|
|
|
}, { xtype: 'label', flex: 1}]
|
|
|
}, {
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [{
|
|
|
fieldLabel: '凭证GID',
|
|
|
id: 'ORDNO',
|
|
|
name: 'ORDNO',
|
|
|
hidden: true,
|
|
|
value: '*'
|
|
|
}, this.comboxVKNO, {
|
|
|
fieldLabel: '',
|
|
|
id: 'VOUNO',
|
|
|
name: 'VOUNO',
|
|
|
width: 60,
|
|
|
xtype: 'numberfield',
|
|
|
nanText: '请输入有效整数',
|
|
|
value: 0,
|
|
|
allowBlank: false
|
|
|
}, {
|
|
|
xtype: 'label',
|
|
|
id: 'VOUNO_HAO',
|
|
|
labelWidth: 50,
|
|
|
text: "号",
|
|
|
style: 'vertical-align: text-bottom;'
|
|
|
}, {
|
|
|
fieldLabel: '日期',
|
|
|
id: 'VOUDATE',
|
|
|
name: 'VOUDATE',
|
|
|
xtype: 'datefield',
|
|
|
format: 'Y-m-d',
|
|
|
value: currdate.format('yyyy-MM-dd'),
|
|
|
width: 140,
|
|
|
allowBlank: false
|
|
|
}, { xtype: 'label', flex: 1 }, {
|
|
|
xtype: 'displayfield',
|
|
|
id: 'lbTitle2',
|
|
|
name: 'lbTitle2',
|
|
|
width: 80,
|
|
|
value: "2015年第1期",
|
|
|
allowBlank: false
|
|
|
}, { xtype: 'label', flex: 1 }, {
|
|
|
fieldLabel: '附单据',
|
|
|
id: 'ATTACHS',
|
|
|
name: 'ATTACHS',
|
|
|
width: 90,
|
|
|
xtype: 'numberfield',
|
|
|
nanText: '请输入有效整数',
|
|
|
value: 1,
|
|
|
allowBlank: false
|
|
|
}, {
|
|
|
xtype: 'label',
|
|
|
text: "张",
|
|
|
style: 'vertical-align: text-bottom;'
|
|
|
}]
|
|
|
}]//end items(fieldset 1)
|
|
|
});
|
|
|
//#endregion
|
|
|
|
|
|
//#region 编辑formBottom 基本信息
|
|
|
this.formBottom = Ext.widget('form', {
|
|
|
region: 'south',
|
|
|
height: 40,
|
|
|
frame: true,
|
|
|
//bodyPadding: 5,
|
|
|
trackResetOnLoad: true, //是否记录字段原始值
|
|
|
fieldDefaults: {
|
|
|
labelAlign: 'right',
|
|
|
labelWidth: 80,
|
|
|
msgTarget: 'qtip'
|
|
|
//,style: 'font-size: 30px; color: #808000; vertical-align: text-bottom;'
|
|
|
},
|
|
|
items: [{
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [{
|
|
|
fieldLabel: '制单人',
|
|
|
id: 'MODIFIEDUSER',
|
|
|
name: 'MODIFIEDUSER',
|
|
|
width: 150,
|
|
|
value: SHOWNAME,
|
|
|
readOnly: true,
|
|
|
allowBlank: false
|
|
|
}, { xtype: 'hiddenfield', flex: 1 }, {
|
|
|
fieldLabel: '最后修改日期',
|
|
|
id: 'MODIFIEDTIME',
|
|
|
name: 'MODIFIEDTIME',
|
|
|
width: 210,
|
|
|
value: currdate.format('yyyy-MM-dd hh:mm:ss'),
|
|
|
readOnly: true,
|
|
|
allowBlank: false
|
|
|
}]
|
|
|
}]//end items(fieldset 1)
|
|
|
});
|
|
|
//#endregion
|
|
|
|
|
|
//#region 定义数据集
|
|
|
//权限范围
|
|
|
// this.StoreOpRange = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
// model: 'MsOP',
|
|
|
// proxy: { url: '/MvcShipping/MsBaseInfo/GetOpRang' }
|
|
|
// });
|
|
|
// this.StoreOpRange.load({ params: { optype: "MsCwVouchersCHECKED"} });
|
|
|
|
|
|
// this.StoreOpRange2 = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
// model: 'MsOP',
|
|
|
// proxy: { url: '/MvcShipping/MsBaseInfo/GetOpRang' }
|
|
|
// });
|
|
|
// this.StoreOpRange2.load({ params: { optype: "MsCwVouchersNotCHECKED"} });
|
|
|
|
|
|
//列表加载
|
|
|
this.storeDetailList = Ext.create('Ext.data.Store', {
|
|
|
model: 'MsCwVouitemsModel',
|
|
|
remoteSort: true,
|
|
|
proxy: {
|
|
|
type: 'ajax',
|
|
|
url: '/MvcShipping/MsCwVouchers/GetDetailList',
|
|
|
reader: {
|
|
|
id: 'GID',
|
|
|
root: 'data',
|
|
|
totalProperty: 'totalCount'
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
//#endregion
|
|
|
|
|
|
//#region 列定义
|
|
|
this.girdcolums = [{
|
|
|
sortable: true,
|
|
|
dataIndex: 'GID',
|
|
|
header: '', //唯一编码
|
|
|
hidden: true,
|
|
|
width: 0
|
|
|
},
|
|
|
{
|
|
|
sortable: false,
|
|
|
dataIndex: 'ITEMNO',
|
|
|
header: '行号',
|
|
|
align: 'center',
|
|
|
//style: "color: 'red'", //black
|
|
|
//color: "red",
|
|
|
width: 35
|
|
|
},
|
|
|
{
|
|
|
id: 'EXPLAN',
|
|
|
sortable: false,
|
|
|
dataIndex: 'EXPLAN',
|
|
|
header: '摘要',
|
|
|
//align: 'center',
|
|
|
width: 200,
|
|
|
editor: {
|
|
|
xtype: 'textfield',
|
|
|
allowBlank: false,
|
|
|
selectOnFocus: true,
|
|
|
enableKeyEvents: true, //激活键盘事件
|
|
|
listeners: {
|
|
|
scope: this,
|
|
|
'keyup': {
|
|
|
fn: function (_field, e) {
|
|
|
if (e.getKey() == 40) {
|
|
|
this.onAddClick();
|
|
|
}
|
|
|
else if (e.getKey() == 13) {
|
|
|
this.onNextKeyClick(3);
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
sortable: false,
|
|
|
dataIndex: 'ACCALL',
|
|
|
header: '会计科目',
|
|
|
//align: 'center',
|
|
|
width: 260,
|
|
|
editor: this.comboxACCNAME
|
|
|
},
|
|
|
{
|
|
|
sortable: false,
|
|
|
dataIndex: 'FCYNO',
|
|
|
header: '原币币别',
|
|
|
align: 'center',
|
|
|
width: 60,
|
|
|
editor: this.comboxCodeCurrency
|
|
|
},
|
|
|
{
|
|
|
sortable: false,
|
|
|
dataIndex: 'FCYEXRATE',
|
|
|
header: '汇率',
|
|
|
align: 'right',
|
|
|
//renderer: Ext.util.Format.numberRenderer('00.00000'),//
|
|
|
width: 60,
|
|
|
editor: {
|
|
|
xtype: 'numberfield',
|
|
|
allowBlank: false,
|
|
|
selectOnFocus: true, //得到焦点时自动选择文本
|
|
|
allowDecimals: true, //允许输入小数
|
|
|
decimalPrecision: 5, //允许保留的小数位数,并四舍五入
|
|
|
nanText: '请输入有效小数',
|
|
|
//minValue: 0,
|
|
|
//maxValue: 100000,
|
|
|
value: 0.00000,
|
|
|
keyNavEnabled: false, //键盘导航是否可用,启用后可以通过键盘的上下箭头调整数值
|
|
|
hideTrigger: true, //是否隐藏上下调节按钮
|
|
|
mouseWheelEnabled: false, //鼠标滚轮是否可用,启用后可以通过滚动鼠标滚轮调整数值
|
|
|
//step: 2,//通过调节按钮、键盘、鼠标滚轮调节数值时的大小
|
|
|
enableKeyEvents: true, //激活键盘事件
|
|
|
listeners: {
|
|
|
scope: this,
|
|
|
'keyup': {
|
|
|
fn: function (_field, e) {
|
|
|
if (e.getKey() == 40) {
|
|
|
this.onAddClick();
|
|
|
}
|
|
|
else if (e.getKey() == 13) {
|
|
|
this.onNextKeyClick(6);
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
|
|
|
value = usMoney(value, 5, '', true);
|
|
|
return value;
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
sortable: false,
|
|
|
dataIndex: 'FCYAMT',
|
|
|
header: '原币金额',
|
|
|
align: 'right',
|
|
|
width: 80,
|
|
|
editor: {
|
|
|
xtype: 'numberfield',
|
|
|
allowBlank: false,
|
|
|
selectOnFocus: true, //得到焦点时自动选择文本
|
|
|
allowDecimals: true, //允许输入小数
|
|
|
nanText: '请输入有效小数',
|
|
|
//minValue: 0,
|
|
|
//maxValue: 100000,
|
|
|
value: 0.00,
|
|
|
keyNavEnabled: false, //键盘导航是否可用,启用后可以通过键盘的上下箭头调整数值
|
|
|
hideTrigger: true, //是否隐藏上下调节按钮
|
|
|
mouseWheelEnabled: false, //鼠标滚轮是否可用,启用后可以通过滚动鼠标滚轮调整数值
|
|
|
//step: 2,//通过调节按钮、键盘、鼠标滚轮调节数值时的大小
|
|
|
enableKeyEvents: true, //激活键盘事件
|
|
|
listeners: {
|
|
|
scope: this,
|
|
|
'keyup': {
|
|
|
fn: function (_field, e) {
|
|
|
if (e.getKey() == 40) {
|
|
|
this.onAddClick();
|
|
|
}
|
|
|
else if (e.getKey() == 13) {
|
|
|
this.onNextKeyClick(7);
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
|
|
|
/*注释
|
|
|
//1.value是当前单元格的值
|
|
|
//2.cellmeta里保存的是cellId单元格id,id不知道是干啥的,似乎是列号,css是这个单元格的css样式。
|
|
|
//3.record是这行的所有数据,你想要什么,record.data["id"]这样就获得了。
|
|
|
//4.rowIndex是行号,不是从头往下数的意思,而是计算了分页以后的结果。
|
|
|
//5.columnIndex列号太简单了。
|
|
|
//6.store,这个厉害,实际上这个是你构造表格时候传递的ds,也就是说表格里所有的数据,你都可以随便调用,唉,太厉害了。
|
|
|
*/
|
|
|
value = usMoney(value, 2, '', true);
|
|
|
if (parseFloat(value) < 0) {
|
|
|
return '<SPAN style="COLOR: red">' + value + '</SPAN>';
|
|
|
}
|
|
|
return value;
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
sortable: false,
|
|
|
dataIndex: 'AMTDR',
|
|
|
header: '借方金额',
|
|
|
align: 'right',
|
|
|
width: 120,
|
|
|
summaryType: 'sum',
|
|
|
//summaryRenderer: Ext.util.Format.numberRenderer('00.00'),
|
|
|
editor: {
|
|
|
xtype: 'numberfield',
|
|
|
allowBlank: false,
|
|
|
selectOnFocus: true, //得到焦点时自动选择文本
|
|
|
allowDecimals: true, //允许输入小数
|
|
|
nanText: '请输入有效小数',
|
|
|
minValue: -999999999.99,
|
|
|
maxValue: 999999999.99,
|
|
|
value: 0.00,
|
|
|
keyNavEnabled: false, //键盘导航是否可用,启用后可以通过键盘的上下箭头调整数值
|
|
|
hideTrigger: true, //是否隐藏上下调节按钮
|
|
|
mouseWheelEnabled: false, //鼠标滚轮是否可用,启用后可以通过滚动鼠标滚轮调整数值
|
|
|
//step: 2,//通过调节按钮、键盘、鼠标滚轮调节数值时的大小
|
|
|
enableKeyEvents: true, //激活键盘事件
|
|
|
listeners: {
|
|
|
scope: this,
|
|
|
'keyup': {
|
|
|
fn: function (_field, e) {
|
|
|
if (e.getKey() == 32) {
|
|
|
var selections = this.gridList.getSelectionModel().getSelection(); //获得选中的项
|
|
|
var AMTDR_OLD = _field.value;
|
|
|
var AMTCR_OLD = selections[0].data.AMTCR;
|
|
|
_field.setValue(AMTCR_OLD);
|
|
|
selections[0].set('AMTCR', AMTDR_OLD);
|
|
|
}
|
|
|
else if (e.getKey() == 40) {
|
|
|
this.onAddClick();
|
|
|
}
|
|
|
else if (e.getKey() == 13) {
|
|
|
this.onNextKeyClick(8);
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
},
|
|
|
'render': function (_field, eOpts) {//自定义函数,定义双击事件
|
|
|
var _this = this;
|
|
|
_field.getEl().on('dblclick', function (e, t, eOpts) {
|
|
|
var dAMTDR = 0;
|
|
|
var dAMTCR = 0;
|
|
|
var iLength = _this.gridList.getStore().data.length;
|
|
|
if (iLength > 1) {
|
|
|
var records = _this.gridList.getStore().data.items;
|
|
|
for (var i = 0; i < iLength; i += 1) {
|
|
|
dAMTDR += records[i].data.AMTDR;
|
|
|
dAMTCR += records[i].data.AMTCR;
|
|
|
}
|
|
|
var dAMT = dAMTCR - (dAMTDR - (_field.value));
|
|
|
_field.setValue(dAMT);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
|
|
|
value = usMoney(value, 2, '', true);
|
|
|
if (parseFloat(value) < 0) {
|
|
|
return '<SPAN style="COLOR: red">' + value + '</SPAN>';
|
|
|
}
|
|
|
return value;
|
|
|
},
|
|
|
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
|
|
|
value = usMoney(value, 2, '', true);
|
|
|
return value;
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
sortable: false,
|
|
|
dataIndex: 'AMTCR',
|
|
|
header: '贷方金额',
|
|
|
align: 'right',
|
|
|
width: 120,
|
|
|
summaryType: 'sum',
|
|
|
//summaryRenderer: Ext.util.Format.numberRenderer('00.00'),
|
|
|
editor: {
|
|
|
xtype: 'numberfield',
|
|
|
allowBlank: false,
|
|
|
selectOnFocus: true, //得到焦点时自动选择文本
|
|
|
allowDecimals: true, //允许输入小数
|
|
|
nanText: '请输入有效小数',
|
|
|
minValue: -999999999.99,
|
|
|
maxValue: 999999999.99,
|
|
|
value: 0.00,
|
|
|
keyNavEnabled: false, //键盘导航是否可用,启用后可以通过键盘的上下箭头调整数值
|
|
|
hideTrigger: true, //是否隐藏上下调节按钮
|
|
|
mouseWheelEnabled: false, //鼠标滚轮是否可用,启用后可以通过滚动鼠标滚轮调整数值
|
|
|
//step: 2,//通过调节按钮、键盘、鼠标滚轮调节数值时的大小
|
|
|
enableKeyEvents: true, //激活键盘事件
|
|
|
listeners: {
|
|
|
scope: this,
|
|
|
'keyup': {
|
|
|
fn: function (_field, e) {
|
|
|
if (e.getKey() == 32) {
|
|
|
var selections = this.gridList.getSelectionModel().getSelection(); //获得选中的项
|
|
|
var AMTDR_OLD = selections[0].data.AMTDR;
|
|
|
var AMTCR_OLD = _field.value;
|
|
|
selections[0].set('AMTDR', AMTCR_OLD);
|
|
|
_field.setValue(AMTDR_OLD);
|
|
|
}
|
|
|
else if (e.getKey() == 40) {
|
|
|
this.onAddClick();
|
|
|
}
|
|
|
else if (e.getKey() == 9) {
|
|
|
this.onAddClick();
|
|
|
}
|
|
|
else if (e.getKey() == 13) {
|
|
|
//this.onNextKeyClick(9);
|
|
|
this.onAddClick();
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
},
|
|
|
'render': function (_field, eOpts) {//自定义函数,定义双击事件
|
|
|
var _this = this;
|
|
|
_field.getEl().on('dblclick', function (e, t, eOpts) {
|
|
|
var dAMTDR = 0;
|
|
|
var dAMTCR = 0;
|
|
|
var iLength = _this.gridList.getStore().data.length;
|
|
|
if (iLength > 1) {
|
|
|
var records = _this.gridList.getStore().data.items;
|
|
|
for (var i = 0; i < iLength; i += 1) {
|
|
|
dAMTDR += records[i].data.AMTDR;
|
|
|
dAMTCR += records[i].data.AMTCR;
|
|
|
}
|
|
|
var dAMT = dAMTDR - (dAMTCR - (_field.value));
|
|
|
_field.setValue(dAMT);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
|
|
|
/*注释
|
|
|
//1.value是当前单元格的值
|
|
|
//2.cellmeta里保存的是cellId单元格id,id不知道是干啥的,似乎是列号,css是这个单元格的css样式。
|
|
|
//3.record是这行的所有数据,你想要什么,record.data["id"]这样就获得了。
|
|
|
//4.rowIndex是行号,不是从头往下数的意思,而是计算了分页以后的结果。
|
|
|
//5.columnIndex列号太简单了。
|
|
|
//6.store,这个厉害,实际上这个是你构造表格时候传递的ds,也就是说表格里所有的数据,你都可以随便调用,唉,太厉害了。
|
|
|
*/
|
|
|
//Ext.util.Format.number(value, '00.00');
|
|
|
value = usMoney(value, 2, '', true);
|
|
|
if (parseFloat(value) < 0) {
|
|
|
return '<SPAN style="COLOR: red">' + value + '</SPAN>';
|
|
|
}
|
|
|
return value;
|
|
|
},
|
|
|
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
|
|
|
value = usMoney(value, 2, '', true);
|
|
|
return value;
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
id: 'ACCID',
|
|
|
sortable: false,
|
|
|
hidden: true,
|
|
|
dataIndex: 'ACCID',
|
|
|
header: '科目代码',
|
|
|
width: 0
|
|
|
}];
|
|
|
//#endregion
|
|
|
|
|
|
//#region gridList列表显示信息
|
|
|
this.gridListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
|
|
|
clicksToEdit: 1 //1单击,2双击
|
|
|
});
|
|
|
|
|
|
this.gridList = new Ext.grid.GridPanel({
|
|
|
region: 'center',
|
|
|
store: this.storeDetailList,
|
|
|
enableHdMenu: false, //是否显示表格列的菜单
|
|
|
hideHeaders: false, //是否隐藏表头
|
|
|
enableColumnHide: false, ///隐藏表头列
|
|
|
sortableColumns: false, ///隐藏表头排序
|
|
|
//disableSelection: false, //是否禁止选择表格行或列,默认为false
|
|
|
//trackMouseOver: true, //高亮显示鼠标所在的行,默认为true,
|
|
|
//stripeRows: true, //斑马线效果
|
|
|
rowLines: true,
|
|
|
columnLines: true,
|
|
|
loadMask: { msg: "数据加载中,请稍等..." },
|
|
|
plugins: [this.gridListCellEditing],
|
|
|
selType: 'cellmodel',
|
|
|
columns: this.girdcolums,
|
|
|
features: [{
|
|
|
ftype: 'summary'//Ext.grid.feature.Summary表格汇总特性
|
|
|
}],
|
|
|
listeners: {
|
|
|
scope: this,
|
|
|
'edit': function (editor, e, eOpts) {
|
|
|
if (e.value == e.originalValue) { return; }
|
|
|
if (e.colIdx == 4) {
|
|
|
var sACCID = e.record.data['ACCID'].toString();
|
|
|
var sACCALL = e.record.data['ACCALL'].toString();
|
|
|
var ayListA = new Array();
|
|
|
ayListA = sACCALL.split("▁");
|
|
|
var AccitemsList = DsStoreQueryBy(this.storeCwAccitems, 'ACCIDNAME', (sACCID + "_" + ayListA[0].toString()));
|
|
|
if (AccitemsList.length > 0) {
|
|
|
var AccitemsRaw = AccitemsList.getAt(0).raw;
|
|
|
if (!AccitemsRaw.ISFCY) {
|
|
|
e.record.set('FCYNO', 'RMB');
|
|
|
e.record.set('FCYEXRATE', 1);
|
|
|
e.record.set('FCYAMT', 0);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
else if (e.colIdx == 5) {
|
|
|
var sACCID = e.record.data['ACCID'].toString();
|
|
|
var sACCALL = e.record.data['ACCALL'].toString();
|
|
|
var FCYNO = e.record.data['FCYNO'].toString();
|
|
|
var FCYEXRATE = e.record.data['FCYEXRATE'];
|
|
|
var FCYAMT = e.record.data['FCYAMT'];
|
|
|
var ayListA = new Array();
|
|
|
ayListA = sACCALL.split("▁");
|
|
|
var AccitemsList = DsStoreQueryBy(this.storeCwAccitems, 'ACCIDNAME', (sACCID + "_" + ayListA[0].toString()));
|
|
|
if (AccitemsList.length > 0) {
|
|
|
var AccitemsRaw = AccitemsList.getAt(0).raw;
|
|
|
if (!AccitemsRaw.ISFCY) {
|
|
|
e.record.set('FCYNO', 'RMB');
|
|
|
e.record.set('FCYEXRATE', 1);
|
|
|
e.record.set('FCYAMT', 0);
|
|
|
}
|
|
|
else {
|
|
|
var amount = Mul(FCYEXRATE, FCYAMT);
|
|
|
if (AccitemsRaw.DC.toString() == "借") {
|
|
|
e.record.set('AMTDR', amount);
|
|
|
e.record.set('AMTCR', 0);
|
|
|
}
|
|
|
else {
|
|
|
e.record.set('AMTDR', 0);
|
|
|
e.record.set('AMTCR', amount);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
else if (e.colIdx == 6) {
|
|
|
var sACCID = e.record.data['ACCID'].toString();
|
|
|
var FCYNO = e.record.data['FCYNO'].toString();
|
|
|
var FCYEXRATE = e.record.data['FCYEXRATE'];
|
|
|
var FCYAMT = e.record.data['FCYAMT'];
|
|
|
var sACCALL = e.record.data['ACCALL'].toString();
|
|
|
var ayListA = new Array();
|
|
|
ayListA = sACCALL.split("▁");
|
|
|
var AccitemsList = DsStoreQueryBy(this.storeCwAccitems, 'ACCIDNAME', (sACCID + "_" + ayListA[0].toString()));
|
|
|
if (AccitemsList.length > 0) {
|
|
|
var AccitemsRaw = AccitemsList.getAt(0).raw;
|
|
|
if (AccitemsRaw.ISFCY) {
|
|
|
var amount = Mul(FCYEXRATE, FCYAMT);
|
|
|
if (AccitemsRaw.DC.toString() == "借") {
|
|
|
e.record.set('AMTDR', amount);
|
|
|
e.record.set('AMTCR', 0);
|
|
|
}
|
|
|
else {
|
|
|
e.record.set('AMTDR', 0);
|
|
|
e.record.set('AMTCR', amount);
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
if (AccitemsRaw.DC.toString() == "借") {
|
|
|
e.record.set('AMTDR', FCYAMT);
|
|
|
e.record.set('AMTCR', 0);
|
|
|
}
|
|
|
else {
|
|
|
e.record.set('AMTDR', 0);
|
|
|
e.record.set('AMTCR', FCYAMT);
|
|
|
}
|
|
|
e.record.set('FCYNO', 'RMB');
|
|
|
e.record.set('FCYEXRATE', 1);
|
|
|
e.record.set('FCYAMT', 0);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
else if (e.colIdx == 7) {
|
|
|
var AMTDR = e.record.data['AMTDR'];
|
|
|
if (AMTDR != 0) {
|
|
|
e.record.set('AMTCR', 0);
|
|
|
var FCYNO = e.record.data['FCYNO'].toString();
|
|
|
var FCYEXRATE = e.record.data['FCYEXRATE'];
|
|
|
var FCYAMT = e.record.data['FCYAMT'];
|
|
|
if (FCYNO.toString().trim() != 'RMB') {
|
|
|
var amount = Div(AMTDR, FCYEXRATE);
|
|
|
if (FCYAMT != amount) {
|
|
|
e.record.set('FCYAMT', amount);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
else if (e.colIdx == 8) {
|
|
|
var AMTCR = e.record.data['AMTCR'];
|
|
|
if (AMTCR != 0) {
|
|
|
e.record.set('AMTDR', 0);
|
|
|
var FCYNO = e.record.data['FCYNO'].toString();
|
|
|
var FCYEXRATE = e.record.data['FCYEXRATE'];
|
|
|
var FCYAMT = e.record.data['FCYAMT'];
|
|
|
if (FCYNO.toString().trim() != 'RMB') {
|
|
|
var amount = Div(AMTCR, FCYEXRATE);
|
|
|
if (FCYAMT != amount) {
|
|
|
e.record.set('FCYAMT', amount);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
'beforeedit': function (editor, e, eOpts) {
|
|
|
//if (e.colIdx == 4) {
|
|
|
// var sACCID = e.record.data['ACCID'].toString();
|
|
|
// var sACCALL = e.record.data['ACCALL'].toString();
|
|
|
// var ayListA = new Array();
|
|
|
// ayListA = sACCALL.split("▁");
|
|
|
// var AccitemsList = DsStoreQueryBy(this.storeCwAccitems, 'ACCIDNAME', (sACCID + "_" + ayListA[0].toString()));
|
|
|
// if (AccitemsList.length > 0) {
|
|
|
// var AccitemsRaw = AccitemsList.getAt(0).raw;
|
|
|
// if (AccitemsRaw.ISDEPTACC || AccitemsRaw.ISEMPLACC || AccitemsRaw.ISCORPACC || AccitemsRaw.ISITEMACC) {
|
|
|
// return false;
|
|
|
// }
|
|
|
// }
|
|
|
//}
|
|
|
return true;
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
//#endregion
|
|
|
|
|
|
//#region 按钮Toolbar/框架/加载
|
|
|
this.panelBtn = new Ext.Panel({
|
|
|
region: "north",
|
|
|
tbar: [{
|
|
|
text: '添加明细',
|
|
|
tooltip: '添加明细',
|
|
|
id: "btnadd",
|
|
|
iconCls: "btnadd",
|
|
|
handler: function (button, event) {
|
|
|
this.onAddClick();
|
|
|
},
|
|
|
scope: this
|
|
|
}, {
|
|
|
text: '删除明细',
|
|
|
tooltip: '删除明细',
|
|
|
id: "btndel",
|
|
|
iconCls: "btndelete",
|
|
|
handler: function (button, event) {
|
|
|
this.onDelClick(button, event);
|
|
|
},
|
|
|
scope: this
|
|
|
}, '-', {
|
|
|
id: 'btnSave',
|
|
|
text: "保存",
|
|
|
iconCls: "btnsave",
|
|
|
handler: function (button, event) {
|
|
|
this.Save('0');
|
|
|
},
|
|
|
scope: this
|
|
|
}, {
|
|
|
id: 'btnSaveAndClose',
|
|
|
text: "保存并关闭",
|
|
|
handler: function (button, event) {
|
|
|
this.Save('1');
|
|
|
},
|
|
|
scope: this
|
|
|
}, {
|
|
|
id: 'btnSaveAndNew',
|
|
|
text: "保存并新建",
|
|
|
handler: function (button, event) {
|
|
|
this.Save('2');
|
|
|
},
|
|
|
scope: this
|
|
|
}, {
|
|
|
id: 'btnNew',
|
|
|
text: "新建",
|
|
|
handler: function (button, event) {
|
|
|
this.GetAddText();
|
|
|
},
|
|
|
scope: this
|
|
|
}, {
|
|
|
text: "关闭",
|
|
|
handler: function (button, event) {
|
|
|
window.close();
|
|
|
},
|
|
|
scope: this
|
|
|
}, '-', {
|
|
|
text: '删除凭证',
|
|
|
tooltip: '删除凭证',
|
|
|
id: "btndelAll",
|
|
|
iconCls: "btndelete",
|
|
|
handler: function (button, event) {
|
|
|
this.onDeleteClick(button, event);
|
|
|
},
|
|
|
scope: this
|
|
|
}
|
|
|
//, '-', {
|
|
|
// text: '打印',
|
|
|
// tooltip: '打印',
|
|
|
// id: "btnprint",
|
|
|
// iconCls: "btnprint",
|
|
|
// handler: function (button, event) {
|
|
|
// this.Print(button, event);
|
|
|
// },
|
|
|
// scope: this
|
|
|
//}
|
|
|
]
|
|
|
}); //end 按钮Toolbar
|
|
|
|
|
|
this.panelTop = new Ext.Panel({
|
|
|
layout: "border",
|
|
|
region: "north",
|
|
|
height: 100,
|
|
|
items: [this.panelBtn, this.formHead]
|
|
|
});
|
|
|
|
|
|
Ext.apply(this, {
|
|
|
items: [this.panelTop, this.gridList, this.formBottom]
|
|
|
});
|
|
|
|
|
|
parentWin = window.parent.opener;
|
|
|
this.InitData();
|
|
|
//#endregion
|
|
|
}, //end initUIComponents
|
|
|
|
|
|
//#region 加载事件
|
|
|
InitData: function () {
|
|
|
this.opStatus = 'add';
|
|
|
var condition = '';
|
|
|
if (parentWin) {
|
|
|
var ret = parentWin.OprationSwapJK();
|
|
|
this.opStatus = ret[0];
|
|
|
this.StoreList = ret[1];
|
|
|
this.EditRecord = ret[2];
|
|
|
this.sqlcontext = ret[3];
|
|
|
this.btnRefresh = ret[4];
|
|
|
this.tbVOUNO = ret[5];
|
|
|
this.btnAddCwVouchersJK = ret[6];
|
|
|
this.btnSelCwVouchersJK = ret[7];
|
|
|
}
|
|
|
//
|
|
|
if (this.opStatus == 'edit') {
|
|
|
condition = "ORDNO='" + this.EditRecord.data.ORDNO + "'";
|
|
|
this.LoadData('edit', condition);
|
|
|
} else if (this.opStatus == 'add') {
|
|
|
this.GetAddText();
|
|
|
} else if (this.opStatus == 'sel') {
|
|
|
condition = "ORDNO in (select top 1 ORDNO from cw_vouchers where VOUALLNO='" + this.sqlcontext + "')";
|
|
|
this.LoadData('edit', condition);
|
|
|
this.setBtnStatusDisable(true);
|
|
|
}
|
|
|
}, //end InitData
|
|
|
|
|
|
LoadData: function (opStatus, condition) {
|
|
|
this.serialNo = 0;
|
|
|
//this.opStatus = opStatus;
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在查询主表数据...',
|
|
|
url: '/MvcShipping/MsCwVouchers/GetData',
|
|
|
params: {
|
|
|
handle: opStatus,
|
|
|
condition: condition
|
|
|
},
|
|
|
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;
|
|
|
this.formHead.getForm().reset();
|
|
|
this.formHead.getForm().setValues(data);
|
|
|
this.formBottom.getForm().reset();
|
|
|
this.formBottom.getForm().setValues(data);
|
|
|
//
|
|
|
var strVOUDATE = data.VOUDATE.toString();
|
|
|
var mydate = new Date(strVOUDATE)
|
|
|
mydate = mydate.format("yyyy-MM-dd");
|
|
|
var strY = mydate.substring(0, 4);
|
|
|
var strM = mydate.substring(5, 7);
|
|
|
var strD = mydate.substring(8, 10);
|
|
|
this.formHead.getForm().findField('lbTitle2').setValue(strY + "年第" + strM + "期");
|
|
|
this.formHead.getForm().findField('VOUDATE').setValue(mydate);
|
|
|
//
|
|
|
this.storeDetailList.load({ params: { condition: condition }, waitMsg: "正在刷新数据...", scope: this });
|
|
|
if (data.FCY.toString() != "RMB") {
|
|
|
this.onColumnsHidden(true, true);
|
|
|
}
|
|
|
} else {
|
|
|
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
});
|
|
|
//this.GetEditStatus();
|
|
|
}, // end LoadDate
|
|
|
//#endregion
|
|
|
|
|
|
//#region 保存
|
|
|
Save: function (type) {
|
|
|
this.formHead.getForm().findField('ORDNO').setDisabled(false);
|
|
|
var data = this.formHead.getForm().getValues(false, false, false);
|
|
|
this.formHead.getForm().findField('ORDNO').setDisabled(true);
|
|
|
//
|
|
|
var sStatus = this.opStatus;
|
|
|
if (this.opStatus == 'sel') {
|
|
|
sStatus = 'edit';
|
|
|
}
|
|
|
//
|
|
|
var sAMTDR = 0;
|
|
|
var sAMTCR = 0;
|
|
|
var bodydatas = [];
|
|
|
for (var i = 0; i < this.storeDetailList.getCount(); i += 1) {
|
|
|
sAMTDR += this.storeDetailList.getAt(i).get("AMTDR");
|
|
|
sAMTCR += this.storeDetailList.getAt(i).get("AMTCR");
|
|
|
var member = this.storeDetailList.getAt(i);
|
|
|
bodydatas.push(member);
|
|
|
}
|
|
|
sAMTDR = usMoney(sAMTDR, 2, '', false);
|
|
|
sAMTCR = usMoney(sAMTCR, 2, '', false);
|
|
|
if (sAMTDR != sAMTCR) {
|
|
|
alert("录入借贷不平!请重新调整数据!");
|
|
|
return;
|
|
|
}
|
|
|
//
|
|
|
if (bodydatas.length > 0) {
|
|
|
var jsonBody = ConvertRecordsToJsonAll(bodydatas);
|
|
|
var DelBody = ConvertRecordsToJsonAll(this.DelBody);
|
|
|
Ext.Msg.wait('正在保存数据, 请稍侯..');
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在保存数据...',
|
|
|
url: '/MvcShipping/MsCwVouchers/SaveEdit',
|
|
|
params: {
|
|
|
opStatus: sStatus,
|
|
|
data: Ext.JSON.encode(data),
|
|
|
body: jsonBody,
|
|
|
DelBody: DelBody
|
|
|
},
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
Ext.MessageBox.hide();
|
|
|
var jsonresult = Ext.JSON.decode(response.responseText);
|
|
|
if (jsonresult.Success) {
|
|
|
if (this.opStatus == 'add') {
|
|
|
this.opStatus = 'edit';
|
|
|
}
|
|
|
var returnData = jsonresult.Data;
|
|
|
var condition = "ORDNO='" + returnData.ORDNO + "'";
|
|
|
this.formHead.getForm().findField('ORDNO').setDisabled(false);
|
|
|
this.formHead.getForm().findField('ORDNO').setValue(returnData.ORDNO);
|
|
|
this.formHead.getForm().findField('VOUNO').setValue(returnData.VOUNO);
|
|
|
this.formHead.getForm().findField('VOUNO').show();
|
|
|
Ext.getCmp('VOUNO_HAO').show();
|
|
|
this.formHead.getForm().findField('ORDNO').setDisabled(true);
|
|
|
this.DelBody = [];
|
|
|
//
|
|
|
if (this.btnRefresh == null) {
|
|
|
this.tbVOUNO.setValue("");
|
|
|
this.btnAddCwVouchersJK.show();
|
|
|
this.btnSelCwVouchersJK.hide();
|
|
|
}
|
|
|
else {
|
|
|
var btn = opener.document.getElementById(this.btnRefresh.id);
|
|
|
btn.click();
|
|
|
}
|
|
|
//window.close();
|
|
|
//
|
|
|
this.storeDetailList.load({
|
|
|
params: { condition: condition },
|
|
|
waitMsg: "正在刷新数据...",
|
|
|
callback: function (options, success, response) {
|
|
|
if (type == '0') {
|
|
|
} else if (type == '1') {
|
|
|
window.close();
|
|
|
} else if (type == '2') {
|
|
|
this.GetAddText();
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
});
|
|
|
//
|
|
|
this.setBtnStatusDisable(true);
|
|
|
} 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.WARNING, buttons: Ext.Msg.OK });
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
});
|
|
|
}
|
|
|
}, //end save
|
|
|
//#endregion
|
|
|
|
|
|
//#region 新增明细
|
|
|
onAddClick: function () {
|
|
|
var ORDNO = this.formHead.getForm().findField('ORDNO').getValue();
|
|
|
var n = this.storeDetailList.getCount();
|
|
|
var sEXPLAN = "";
|
|
|
if (n > 0) {
|
|
|
sEXPLAN = this.storeDetailList.getAt(n - 1).get("EXPLAN");
|
|
|
}
|
|
|
//
|
|
|
var record = Ext.create('MsCwVouitemsModel', {
|
|
|
GID: '*',
|
|
|
ORDNO: ORDNO,
|
|
|
ITEMNO: n + 1,
|
|
|
EXPLAN: sEXPLAN,
|
|
|
ACCALL: '',
|
|
|
FCYNO: '', //RMB
|
|
|
FCYEXRATE: 1,
|
|
|
FCYAMT: 0,
|
|
|
AMTDR: 0,
|
|
|
AMTCR: 0,
|
|
|
ACCID: ''
|
|
|
});
|
|
|
this.storeDetailList.add(record);
|
|
|
this.gridListCellEditing.startEditByPosition({ row: n, column: 2 }); //n - 1
|
|
|
},
|
|
|
//#endregion
|
|
|
|
|
|
//#region 删除明细
|
|
|
onDelClick: function () {
|
|
|
var selectedRecords = this.gridList.selModel.getSelection();
|
|
|
for (var i = 0; i < selectedRecords.length; i++) {
|
|
|
var rec = selectedRecords[i];
|
|
|
if (rec.ContractNo != "" || rec.ContractNo != "*") //如果是新增但没有保存的数据,没有必要提交到后台
|
|
|
{
|
|
|
this.DelBody.push(rec);
|
|
|
}
|
|
|
this.storeDetailList.remove(selectedRecords[i]);
|
|
|
}
|
|
|
},
|
|
|
//#endregion
|
|
|
|
|
|
//#region 删除凭证
|
|
|
onDeleteClick: function (button, event) {
|
|
|
var sError = "";
|
|
|
var gids = this.formHead.getForm().findField('ORDNO').getValue();
|
|
|
if (gids.trim() == "") {
|
|
|
Ext.Msg.show({ title: '提示', msg: '请先保存凭证!' + sError, icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
|
|
|
return;
|
|
|
}
|
|
|
else {
|
|
|
Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) {
|
|
|
if (btn == 'yes') {
|
|
|
Ext.Msg.wait('正在删除数据...');
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在删除数据...',
|
|
|
url: '/MvcShipping/MsCwVouchers/Delete',
|
|
|
params: {
|
|
|
gids: gids
|
|
|
},
|
|
|
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 + sError, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
|
if (this.btnRefresh == null) {
|
|
|
this.tbVOUNO.setValue("");
|
|
|
this.btnAddCwVouchersJK.show();
|
|
|
this.btnSelCwVouchersJK.hide();
|
|
|
}
|
|
|
else {
|
|
|
var btn = opener.document.getElementById(this.btnRefresh.id);
|
|
|
btn.click();
|
|
|
}
|
|
|
window.close();
|
|
|
}
|
|
|
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.WARNING, buttons: Ext.Msg.OK });
|
|
|
},
|
|
|
success: function (response, options) { },
|
|
|
scope: this
|
|
|
}); //end Ext.Ajax.request
|
|
|
}
|
|
|
}, this);
|
|
|
}
|
|
|
},
|
|
|
//#endregion
|
|
|
|
|
|
//#region 新建
|
|
|
GetAddText: function () {
|
|
|
this.opStatus = 'add';
|
|
|
var ORDNO = '*';
|
|
|
this.formHead.getForm().findField('ORDNO').setDisabled(false);
|
|
|
this.formHead.getForm().findField('ORDNO').setValue('*');
|
|
|
this.formHead.getForm().findField('ORDNO').setDisabled(true);
|
|
|
//
|
|
|
this.storeDetailList.removeAll(); //清空所有;
|
|
|
this.onColumnsHidden(true, false);
|
|
|
var VKNO = this.formHead.getForm().findField('VKNO').getValue();
|
|
|
//
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在查询委托编号状态...',
|
|
|
url: '/MvcShipping/MsBaseInfo/GetVOUNO',
|
|
|
params: {
|
|
|
VKNO: 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();
|
|
|
this.formHead.getForm().findField('VOUNO').setValue(sVOUNO);
|
|
|
this.formHead.getForm().findField('lbTitle2').setValue(strY + "年第" + strM + "期");
|
|
|
//
|
|
|
this.formHead.getForm().findField('VOUDATE').setValue(strVOUDATE);
|
|
|
Ext.getCmp('VOUDATE').setMinValue(strACCDATE + "-01");
|
|
|
//
|
|
|
this.formHead.getForm().findField('VOUNO').hide();
|
|
|
Ext.getCmp('VOUNO_HAO').hide();
|
|
|
//
|
|
|
this.setBtnStatusDisable(true);
|
|
|
} else {
|
|
|
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
});
|
|
|
//
|
|
|
this.onAddClick();
|
|
|
},
|
|
|
//#endregion
|
|
|
|
|
|
//#region 按钮函数
|
|
|
onColumnsHidden: function (isHide, blISFCY) {
|
|
|
if (blISFCY) {
|
|
|
this.gridList.columns[4].show();
|
|
|
this.gridList.columns[5].show();
|
|
|
this.gridList.columns[6].show();
|
|
|
}
|
|
|
else {
|
|
|
if (isHide) {
|
|
|
this.gridList.columns[4].hide();
|
|
|
this.gridList.columns[5].hide();
|
|
|
this.gridList.columns[6].hide();
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
|
|
|
GetEditStatus: function () {
|
|
|
var canedit = false;
|
|
|
_this = this;
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在查询委托编号状态...',
|
|
|
url: '/MvcShipping/MsBaseInfo/GetRuleEdit',
|
|
|
params: {
|
|
|
rulename: '委托编号',
|
|
|
ruletype: '4'
|
|
|
},
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
var custno = _this.formHead.getForm().findField('CUSTNO');
|
|
|
custno.setReadOnly(true);
|
|
|
} else {
|
|
|
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
});
|
|
|
},
|
|
|
|
|
|
Print: function (button, event) {
|
|
|
if (this.opStatus == 'edit') {
|
|
|
var strGIDs = this.formHead.getForm().findField('ORDNO').getValue();
|
|
|
//#region sql语句
|
|
|
var sSql1 = "SELECT GID as [明细表GID],ORDNO as [主表GID并与明细表关联],VOUNO as [月初清零],VKNO as [凭证字],VOUDATE as [凭证日期],ACCYEAR as [年],ACCMONTH as [月],ATTACHS as [附件单据数],FCY as [是否含有外币科目],QTY as [是否含有数量科目],VOUPROP as [凭证属性],PREPARED as [制单人],CHECKED as [审核人],ENTERED as [记账人],ERRMSG as [错误信息],ISDELETE as [是否废除],DELETEUSER as [废除操作人],DELETETIME as [废除时间],VOUALLNO as [年+月+自动生成编号=凭证号],ISEXPORT as [是否导出凭证],ITEMNO as [行号],ACCID as [科目代码],PACCID as [父级科目代码],ACCNAME as [科目名称],PROPERTY as [科目属性],GRADE as [科目级别],DC as [借贷方向],AMTDR as [本位币借方金额],AMTCR as [本位币贷方金额],ISFCY as [是否外币],FCYNO as [外币编号usd],FCYEXRATE as [汇率],FCYDR as [外币借方金额],FCYCR as [外币贷方金额],QTYUNIT as [数量包装单位],QTYDR as [借方数量],QTYCR as [贷方数量],EXPLAN as [摘要],ISDEPTACC as [核算部门],ISEMPLACC as [核算人员],ISCORPACC as [核算客户],ISITEMACC as [核算项目],DEPTID as [部门(系统)],EMPLID as [人员(系统)],CORPID as [客户(系统)],PITEMID as [父级项目编号],ITEMID as [项目编号],FIELD1 as [预留字段1],FIELD2 as [预留字段2],FIELD3 as [预留字段3],FIELD4 as [预留字段4],FIELD5 as [预留字段5],FIELD6 as [预留字段6],FIELD7 as [预留字段7],FIELD8 as [预留字段8],FIELD9 as [预留字段9],FIELD10 as [预留字段10],ISSYS as [是否手动录入],FSETTLCODE as [结算方式],FSETTLENO as [财务辅助编号],FSETTLDATE as [结算日期],MODIFIEDUSER as [最后一次更新操作人],MODIFIEDTIME as [最后一次更新操作时间],CUSTOMERNAME as [委托单位],SALE as [揽货人],BLNO as [业务编号],ITEMGID as [项目GID],DEPTGID as [部门GID],ACCALL as [会计科目字符串]"
|
|
|
+ " from VW_cw_vouchers_vouitems_gl where ISDELETE=0 and ORDNO='" + strGIDs + "'";
|
|
|
var sSql2 = "";
|
|
|
var sSql3 = "";
|
|
|
var sSql4 = "";
|
|
|
var sSql5 = "SELECT u.GID as 惟一编号,u.USERNAME as 英文名,u.PASSWORD as 登录密码,u.CODENAME as 用户代码名,u.SHOWNAME as 显示用户名,u.ENROLLTIME as 注册时间,(SELECT TOP (1) SHOWNAME FROM [user] WHERE GID = u.CREATEUSER) as 操作人,(SELECT TOP (1) SHOWNAME FROM [user] WHERE GID = u.MODIFIEDUSER) as 更改操作人,u.MODIFIEDTIME as 更改操作时间,u.ISDELETED as 账户删除状态标志,u.ISDISABLE as 账户禁用状态标志,b.COMPANYNAME as 公司简称,b.DEPTNAME as 部门名称,b.QQ as QQ,b.MSN as MSN,(CASE b.OFFICEPHONE WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE b.OFFICEPHONE END) as 办公电话号码,(CASE b.HOMEPHONE WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE b.HOMEPHONE END) as 家庭电话号码,b.MOBILE as 手机号码,(CASE b.FAX WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE b.FAX END) as 传真号码,b.EMAIL1 as 主电子邮件地址,b.EMAIL2 as 次电子邮件地址,b.HOMEADDRESS as 家庭地址,b.REMARK as 备注信息,(SELECT TOP (1) SHOWNAME FROM [user] WHERE GID = b.CREATEUSER) as 创建人,b.CREATETIME as 创建时间,(SELECT TOP (1) SHOWNAME FROM [user] WHERE GID = b.MODIFIEDUSER) as 最后一次操作人,b.MODIFIEDTIME as 最后一次操作时间,b.EMERGUSER as 紧急联系人,(CASE b.EMERGPHONE WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE b.EMERGPHONE END) as 紧急联系人联系电话,b.EMERGEMAIL as 紧急联系人邮箱,b.POSTCODE as 邮政编码,b.SIGNATURE as 签名图片,b.FINANCESOFTCODE as 财务软件代码,b.IMAGEURL as 头像url,b.SIGNATUREURL as 签名Url FROM [user] as u INNER JOIN user_baseinfo as b ON u.GID = b.USERID where u.GID='" + USERID + "'";
|
|
|
var sSql6 = "SELECT GID as 惟一编号,CODENAME as 公司代码名,NAME as 公司简称,FULLNAME as 公司全称,ENNAME as 公司英文名称,ADDRESS as 公司联络地址,ENADDRESS as 公司英文地址,POSTCODE as 邮政编码,(CASE OFFICEPHONE WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE OFFICEPHONE END) AS 公司办公电话,(CASE FAX WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE FAX END) AS 传真号码,EMAIL as 电子邮箱,WEBSITEURL as 公司网址,LICENSECODE as 工商登记号,TAXCODE as 税务登记号,LOGO as 徽标,BillRises as 发票抬头,ChequePayable as 支票抬头,PRTHEADXML1 as 打印抬头1,PRTHEADXML2 as 打印抬头2,PRTHEADXML3 as 打印抬头3,PRTHEADXML4 as 打印抬头4,PRTHEADXML5 as 打印抬头5,CREATEUSER as 创建人gid,CREATETIME as 创建时间,MODIFIEDUSER as 更新人gid,MODIFIEDTIME as 更新时间,ISDELETED as 是否删除,ISDISABLE as 是否被禁用,PARENTID as 父公司GID,BANKSHEAD as 票号头字符 FROM [company] WHERE GID = '" + COMPANYID + "'";
|
|
|
//#endregion
|
|
|
PrintComm(printType, sSql1, sSql2, sSql3, sSql4, sSql5, sSql6);
|
|
|
}
|
|
|
},
|
|
|
|
|
|
setBtnStatusDisable: function (enable) {
|
|
|
var sbtnadd = Ext.getCmp('btnadd');
|
|
|
var sbtnSave = Ext.getCmp('btnSave');
|
|
|
var sbtnSaveAndClose = Ext.getCmp('btnSaveAndClose');
|
|
|
var sbtnSaveAndNew = Ext.getCmp('btnSaveAndNew');
|
|
|
var sbtndel = Ext.getCmp('btndel');
|
|
|
//var sbtnprint = Ext.getCmp('btnprint');
|
|
|
var sbtnNew = Ext.getCmp('btnNew');
|
|
|
//
|
|
|
if (enable) {
|
|
|
sbtnadd.enable();
|
|
|
sbtnSave.enable();
|
|
|
sbtnSaveAndClose.enable();
|
|
|
sbtnSaveAndNew.enable();
|
|
|
sbtndel.enable();
|
|
|
//sbtnprint.enable();
|
|
|
if (this.opStatus == "add") {
|
|
|
//sbtnprint.disable();
|
|
|
}
|
|
|
else if (this.opStatus == "sel") {
|
|
|
sbtnSaveAndNew.disable();
|
|
|
sbtnNew.disable();
|
|
|
}
|
|
|
} else {
|
|
|
sbtnadd.disable();
|
|
|
sbtnSave.disable();
|
|
|
sbtnSaveAndClose.disable();
|
|
|
sbtnSaveAndNew.disable();
|
|
|
sbtndel.disable();
|
|
|
if (this.opStatus == "add") {
|
|
|
//sbtnprint.disable();
|
|
|
}
|
|
|
else if (this.opStatus == "sel") {
|
|
|
sbtnSaveAndNew.disable();
|
|
|
sbtnNew.disable();
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
|
|
|
onNextKeyClick: function (col) {
|
|
|
var rows = this.gridList.getSelectionModel().getSelection();
|
|
|
var row = rows[rows.length - 1];
|
|
|
var s = this.gridList.getStore();
|
|
|
var number = s.indexOf(row);
|
|
|
this.gridListCellEditing.startEditByPosition({ row: number, column: col });
|
|
|
},
|
|
|
//#endregion
|
|
|
|
|
|
//#region 层_显示信息
|
|
|
showContactForm: function (win, strValue, strOriginalValue, AccitemsRaw, selections, isFocus) {
|
|
|
var required = '<span style="color:red;font-weight:bold;" data-qtip="Required">*</span>';
|
|
|
if (!win) {
|
|
|
//#region formSearch 下拉框信息加载
|
|
|
//科目加载
|
|
|
this.storeCwAccitems2 = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'DsShipping.ux.CwAccitemsGlModel',
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetCwAccitems' }
|
|
|
});
|
|
|
this.storeCwAccitems2.load({ params: { condition: ""} });
|
|
|
this.comboxACCNAME2 = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: '科目名称',
|
|
|
store: this.storeCwAccitems2,
|
|
|
forceSelection: true, //输入值是否严格为待选列表中存在的值
|
|
|
id: 'ACCNAME2',
|
|
|
name: 'ACCNAME2',
|
|
|
valueField: 'ACCNAME',
|
|
|
displayField: 'ACCIDNAME',
|
|
|
allowBlank: false,
|
|
|
enableKeyEvents: true, //激活键盘事件
|
|
|
listeners: {
|
|
|
scope: this,
|
|
|
'select': function (combo, records, eOpts) {
|
|
|
if (combo.value != "") {
|
|
|
var AccitemsList = DsStoreQueryBy(this.storeCwAccitems2, 'ACCIDNAME', combo.rawValue.toString());
|
|
|
if (AccitemsList.length > 0) {
|
|
|
var AccitemsRaw = AccitemsList.getAt(0).raw;
|
|
|
if (AccitemsRaw.ISCORPACC) {
|
|
|
Ext.getCmp('CustNAME').show();
|
|
|
}
|
|
|
else {
|
|
|
Ext.getCmp('CustNAME').setValue("");
|
|
|
Ext.getCmp('CustNAME').hide();
|
|
|
}
|
|
|
if (AccitemsRaw.ISDEPTACC) {
|
|
|
Ext.getCmp('DeptName').show();
|
|
|
}
|
|
|
else {
|
|
|
Ext.getCmp('DeptName').setValue("");
|
|
|
Ext.getCmp('DeptName').hide();
|
|
|
}
|
|
|
if (AccitemsRaw.ISEMPLACC) {
|
|
|
Ext.getCmp('SALE').show();
|
|
|
}
|
|
|
else {
|
|
|
Ext.getCmp('SALE').setValue("");
|
|
|
Ext.getCmp('SALE').hide();
|
|
|
}
|
|
|
if (AccitemsRaw.ISITEMACC) {
|
|
|
Ext.getCmp('ITEMNAME').show();
|
|
|
}
|
|
|
else {
|
|
|
Ext.getCmp('ITEMNAME').setValue("");
|
|
|
Ext.getCmp('ITEMNAME').hide();
|
|
|
}
|
|
|
//是不是外币,都默认为RMB
|
|
|
var selections = this.gridList.getSelectionModel().getSelection(); //获得选中的项
|
|
|
if (AccitemsRaw.ISFCY) {
|
|
|
//如果是外币,则默认传送''
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在查询汇率值...',
|
|
|
url: '/MvcShipping/MsCwVouchers/GetFCYEXRATE',
|
|
|
params: {
|
|
|
FCY: '',
|
|
|
LINKGID: AccitemsRaw.GID.toString()
|
|
|
},
|
|
|
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;
|
|
|
}
|
|
|
var strArg = result.data.toString().split(",");
|
|
|
var FCYNO = strArg[0].toString();
|
|
|
var strFCYEXRATE = selections[0].data.FCYEXRATE;
|
|
|
if (strFCYEXRATE == 1) {
|
|
|
strFCYEXRATE = Div(strArg[1].toString(), 1, 5);
|
|
|
}
|
|
|
selections[0].set('FCYEXRATE', strFCYEXRATE.toString());
|
|
|
selections[0].set('FCYNO', FCYNO);
|
|
|
selections[0].set('CURRENCY', FCYNO);
|
|
|
//
|
|
|
var AMTDR = selections[0].data.AMTDR;
|
|
|
var AMTCR = selections[0].data.AMTCR;
|
|
|
var AMT = 0;
|
|
|
if (AMTDR != 0) {
|
|
|
AMT = AMTDR;
|
|
|
}
|
|
|
if (AMTCR != 0) {
|
|
|
AMT = AMTCR;
|
|
|
}
|
|
|
selections[0].set('FCYAMT', Div(AMT, strFCYEXRATE, 2));
|
|
|
//
|
|
|
this.onColumnsHidden(false, AccitemsRaw.ISFCY);
|
|
|
} else {
|
|
|
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
});
|
|
|
}
|
|
|
else {
|
|
|
selections[0].set('FCYEXRATE', 1);
|
|
|
selections[0].set('FCYNO', 'RMB');
|
|
|
selections[0].set('FCYAMT', 0);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
//
|
|
|
},
|
|
|
//'keypress': {
|
|
|
'keyup': {
|
|
|
fn: function (_field, e) {
|
|
|
if (e.getKey() == 118) {//F7
|
|
|
DsOpenEditWin('/MvcShipping/MsCwAccitemsGl/Index', "科目信息", "500", "800", (window.screen.availHeight / 2 - 300), (window.screen.availWidth / 2 - 500));
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
//客户加载
|
|
|
this.storeCustCode = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'DsShipping.ux.CustomRefModel',
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
|
|
|
});
|
|
|
this.storeCustCode.load({ params: { condition: ""} });
|
|
|
this.comboxCust = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: '客户',
|
|
|
store: this.storeCustCode,
|
|
|
forceSelection: true,
|
|
|
//focusOnToFront: true,
|
|
|
selectOnFocus: true,
|
|
|
id: 'CustNAME',
|
|
|
name: 'CustNAME',
|
|
|
valueField: 'CustName',
|
|
|
displayField: 'CodeAndName',
|
|
|
allowBlank: false,
|
|
|
enableKeyEvents: true, //激活键盘事件
|
|
|
listeners: {
|
|
|
scope: this,
|
|
|
'focus': {
|
|
|
fn: function (e) {
|
|
|
e.expand();
|
|
|
//this.doQuery(this.allQuery, true);
|
|
|
},
|
|
|
buffer: 200
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
//部门加载
|
|
|
this.storeDept = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'DsShipping.ux.DeptModel',
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetDeptList_All_Group' }//proxy: { url: '/CommMng/BasicDataRef/GetDeptList' }
|
|
|
});
|
|
|
this.storeDept.load({ params: { condition: ""} });
|
|
|
this.comboxDept = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: '部门',
|
|
|
store: this.storeDept,
|
|
|
id: 'DeptName',
|
|
|
name: 'DeptName',
|
|
|
valueField: 'DeptName',
|
|
|
displayField: 'DeptName',
|
|
|
forceSelection: true,
|
|
|
allowBlank: false,
|
|
|
enableKeyEvents: true, //激活键盘事件
|
|
|
listeners: {
|
|
|
scope: this,
|
|
|
'focus': {
|
|
|
fn: function (e) {
|
|
|
e.expand();
|
|
|
//this.doQuery(this.allQuery, true);
|
|
|
},
|
|
|
buffer: 200
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
//人员信息加载
|
|
|
this.storeOpCode = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'DsShipping.ux.UserRefModel',
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' }
|
|
|
});
|
|
|
this.storeOpCode.load();
|
|
|
this.comboxSALE = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: '人员',
|
|
|
store: this.storeOpCode,
|
|
|
id: 'SALE',
|
|
|
name: 'SALE',
|
|
|
valueField: 'UserName',
|
|
|
displayField: 'CodeAndName',
|
|
|
//value: SHOWNAME,
|
|
|
forceSelection: true,
|
|
|
enableKeyEvents: true, //激活键盘事件
|
|
|
listeners: {
|
|
|
scope: this,
|
|
|
'focus': {
|
|
|
fn: function (e) {
|
|
|
e.expand();
|
|
|
//this.doQuery(this.allQuery, true);
|
|
|
},
|
|
|
buffer: 200
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
//项目加载
|
|
|
this.storeCwItem = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'DsShipping.ux.CwItemModel',
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetCwItemList' }
|
|
|
});
|
|
|
this.storeCwItem.load();
|
|
|
this.comboxCwItem = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: '项目',
|
|
|
store: this.storeCwItem,
|
|
|
forceSelection: true,
|
|
|
id: 'ITEMNAME',
|
|
|
name: 'ITEMNAME',
|
|
|
valueField: 'ITEMNAME',
|
|
|
displayField: 'CodeAndName', //CodeAndName
|
|
|
enableKeyEvents: true, //激活键盘事件
|
|
|
listeners: {
|
|
|
scope: this,
|
|
|
'focus': {
|
|
|
fn: function (e) {
|
|
|
e.expand();
|
|
|
//this.doQuery(this.allQuery, true);
|
|
|
},
|
|
|
buffer: 200
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
//#endregion
|
|
|
|
|
|
//#region 编辑formDiv 基本信息
|
|
|
var formDiv = Ext.widget('form', {
|
|
|
border: false,
|
|
|
bodyPadding: 10,
|
|
|
fieldDefaults: {
|
|
|
labelAlign: 'right',
|
|
|
labelWidth: 60,
|
|
|
labelStyle: 'font-weight:bold'
|
|
|
},
|
|
|
items: [this.comboxACCNAME2, this.comboxCust, this.comboxDept, this.comboxSALE, this.comboxCwItem],
|
|
|
buttons: [{
|
|
|
text: '取消',
|
|
|
handler: function () {
|
|
|
selections[0].set('ACCALL', strOriginalValue);
|
|
|
this.up('form').getForm().reset();
|
|
|
this.up('window').close();
|
|
|
}
|
|
|
}, {
|
|
|
id: 'tijiao',
|
|
|
text: '提交',
|
|
|
handler: function (options, success, response) {
|
|
|
this.GetSubmit(win, selections, this);
|
|
|
},
|
|
|
scope: this
|
|
|
}],
|
|
|
listeners: {
|
|
|
scope: this,
|
|
|
'render': function (thisDiv, thisExtend) {
|
|
|
//#region 加载下拉框信息
|
|
|
this.storeCwAccitems.load({ async: false, params: { condition: "" }, scope: this });
|
|
|
this.storeCustCode.load({ async: false, params: { condition: ""} });
|
|
|
this.storeDept.load({ async: false, params: { condition: ""} });
|
|
|
this.storeOpCode.load({ async: false });
|
|
|
this.storeCwItem.load({ async: false });
|
|
|
//#endregion
|
|
|
|
|
|
//#region 显示/隐藏下拉框
|
|
|
var sFocus = "";
|
|
|
Ext.getCmp('ACCNAME2').hide();
|
|
|
var strITEM = "ACCNAME2";
|
|
|
if (AccitemsRaw.ISCORPACC) {
|
|
|
//thisDiv.getForm().findField('CustNAME').hidden = false;
|
|
|
Ext.getCmp('CustNAME').show();
|
|
|
strITEM += "▁CustNAME";
|
|
|
sFocus += ",1";
|
|
|
}
|
|
|
else {
|
|
|
//thisDiv.getForm().findField('CustNAME').hidden = true;
|
|
|
Ext.getCmp('CustNAME').setValue("");
|
|
|
Ext.getCmp('CustNAME').hide();
|
|
|
}
|
|
|
//
|
|
|
if (AccitemsRaw.ISDEPTACC) {
|
|
|
Ext.getCmp('DeptName').show();
|
|
|
strITEM += "▁DeptName";
|
|
|
sFocus += ",2";
|
|
|
}
|
|
|
else {
|
|
|
Ext.getCmp('DeptName').setValue("");
|
|
|
Ext.getCmp('DeptName').hide();
|
|
|
}
|
|
|
//
|
|
|
if (AccitemsRaw.ISEMPLACC) {
|
|
|
Ext.getCmp('SALE').show();
|
|
|
strITEM += "▁SALE";
|
|
|
sFocus += ",3";
|
|
|
}
|
|
|
else {
|
|
|
Ext.getCmp('SALE').setValue("");
|
|
|
Ext.getCmp('SALE').hide();
|
|
|
}
|
|
|
//
|
|
|
if (AccitemsRaw.ISITEMACC) {
|
|
|
Ext.getCmp('ITEMNAME').show();
|
|
|
strITEM += "▁ITEMNAME";
|
|
|
sFocus += ",4";
|
|
|
}
|
|
|
else {
|
|
|
Ext.getCmp('ITEMNAME').setValue("");
|
|
|
Ext.getCmp('ITEMNAME').hide();
|
|
|
}
|
|
|
//
|
|
|
if (isFocus) {
|
|
|
if (strOriginalValue != "") {
|
|
|
var ayList = new Array();
|
|
|
ayList = strOriginalValue.split("▁");
|
|
|
var ayItem = new Array();
|
|
|
ayItem = strITEM.split("▁");
|
|
|
for (var i = 0; i < ayList.length; i++) {
|
|
|
Ext.getCmp(ayItem[i].toString()).setValue(ayList[i].toString());
|
|
|
//thisDiv.getForm().findField(ayItem[i].toString()).setValue(ayList[i].toString());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
if (strValue != "") {
|
|
|
Ext.getCmp('ACCNAME2').setValue(strValue);
|
|
|
}
|
|
|
}
|
|
|
//#endregion
|
|
|
|
|
|
//#region 设置下拉框焦点
|
|
|
var isFocus = Ext.getCmp('CustNAME');
|
|
|
if (sFocus.indexOf(",1") == 0) {
|
|
|
isFocus = Ext.getCmp('CustNAME');
|
|
|
}
|
|
|
else if (sFocus.indexOf(",2") == 0) {
|
|
|
isFocus = Ext.getCmp('DeptName');
|
|
|
}
|
|
|
else if (sFocus.indexOf(",3") == 0) {
|
|
|
isFocus = Ext.getCmp('SALE');
|
|
|
}
|
|
|
else if (sFocus.indexOf(",4") == 0) {
|
|
|
isFocus = Ext.getCmp('ITEMNAME');
|
|
|
}
|
|
|
isFocus.focus(true, true);
|
|
|
//#endregion
|
|
|
|
|
|
//#region 设置下拉框回车事件
|
|
|
var sFocus2 = sFocus.toString().substr(1);
|
|
|
var argItems = sFocus2.toString().split(",");
|
|
|
for (var i = 0; i < argItems.length; i++) {
|
|
|
if (argItems.length == 1 || (argItems.length - 1) == i) {
|
|
|
//#region 回车+提交事件
|
|
|
if (argItems[i].toString() == "1") {
|
|
|
this.comboxCust.addListener('keyup', function (dataview, record, item) {
|
|
|
if (record.getKey() == 13) {
|
|
|
//this.GetSubmit(win, selections, this);
|
|
|
isFocus = Ext.getCmp('tijiao');
|
|
|
isFocus.focus(true, true);
|
|
|
}
|
|
|
}, this);
|
|
|
}
|
|
|
else if (argItems[i].toString() == "2") {
|
|
|
this.comboxDept.addListener('keyup', function (dataview, record, item) {
|
|
|
if (record.getKey() == 13) {
|
|
|
//this.GetSubmit(win, selections, this);
|
|
|
isFocus = Ext.getCmp('tijiao');
|
|
|
isFocus.focus(true, true);
|
|
|
}
|
|
|
}, this);
|
|
|
}
|
|
|
else if (argItems[i].toString() == "3") {
|
|
|
this.comboxSALE.addListener('keyup', function (dataview, record, item) {
|
|
|
if (record.getKey() == 13) {
|
|
|
//this.GetSubmit(win, selections, this);
|
|
|
isFocus = Ext.getCmp('tijiao');
|
|
|
isFocus.focus(true, true);
|
|
|
}
|
|
|
}, this);
|
|
|
}
|
|
|
else if (argItems[i].toString() == "4") {
|
|
|
this.comboxCwItem.addListener('keyup', function (dataview, record, item) {
|
|
|
if (record.getKey() == 13) {
|
|
|
//this.GetSubmit(win, selections, this);
|
|
|
isFocus = Ext.getCmp('tijiao');
|
|
|
isFocus.focus(true, true);
|
|
|
}
|
|
|
}, this);
|
|
|
}
|
|
|
//#endregion
|
|
|
}
|
|
|
else {
|
|
|
//#region 回车+焦点事件
|
|
|
if (argItems[i].toString() == "1") {
|
|
|
if (argItems[i + 1].toString() == "2") {
|
|
|
this.comboxCust.addListener('keyup', function (dataview, record, item) {
|
|
|
if (record.getKey() == 13) {
|
|
|
isFocus = Ext.getCmp('DeptName');
|
|
|
isFocus.focus(true, true);
|
|
|
}
|
|
|
}, this);
|
|
|
}
|
|
|
else if (argItems[i + 1].toString() == "3") {
|
|
|
this.comboxCust.addListener('keyup', function (dataview, record, item) {
|
|
|
if (record.getKey() == 13) {
|
|
|
isFocus = Ext.getCmp('SALE');
|
|
|
isFocus.focus(true, true);
|
|
|
}
|
|
|
}, this);
|
|
|
}
|
|
|
else if (argItems[i + 1].toString() == "4") {
|
|
|
this.comboxCust.addListener('keyup', function (dataview, record, item) {
|
|
|
if (record.getKey() == 13) {
|
|
|
isFocus = Ext.getCmp('ITEMNAME');
|
|
|
isFocus.focus(true, true);
|
|
|
}
|
|
|
}, this);
|
|
|
}
|
|
|
}
|
|
|
else if (argItems[i].toString() == "2") {
|
|
|
if (argItems[i + 1].toString() == "3") {
|
|
|
this.comboxDept.addListener('keyup', function (dataview, record, item) {
|
|
|
if (record.getKey() == 13) {
|
|
|
isFocus = Ext.getCmp('SALE');
|
|
|
isFocus.focus(true, true);
|
|
|
}
|
|
|
}, this);
|
|
|
}
|
|
|
else if (argItems[i + 1].toString() == "4") {
|
|
|
this.comboxDept.addListener('keyup', function (dataview, record, item) {
|
|
|
if (record.getKey() == 13) {
|
|
|
isFocus = Ext.getCmp('ITEMNAME');
|
|
|
isFocus.focus(true, true);
|
|
|
}
|
|
|
}, this);
|
|
|
}
|
|
|
}
|
|
|
else if (argItems[i].toString() == "3") {
|
|
|
if (argItems[i + 1].toString() == "4") {
|
|
|
this.comboxSALE.addListener('keyup', function (dataview, record, item) {
|
|
|
if (record.getKey() == 13) {
|
|
|
isFocus = Ext.getCmp('ITEMNAME');
|
|
|
isFocus.focus(true, true);
|
|
|
}
|
|
|
}, this);
|
|
|
}
|
|
|
}
|
|
|
else if (argItems[i].toString() == "4") {
|
|
|
this.comboxCwItem.addListener('keyup', function (dataview, record, item) {
|
|
|
if (record.getKey() == 13) {
|
|
|
//this.GetSubmit(win, selections, this);
|
|
|
isFocus = Ext.getCmp('tijiao');
|
|
|
isFocus.focus(true, true);
|
|
|
}
|
|
|
}, this);
|
|
|
}
|
|
|
//#endregion
|
|
|
}
|
|
|
}
|
|
|
//
|
|
|
isFocus = Ext.getCmp('tijiao');
|
|
|
isFocus.addListener('focus', function (dataview, record, item) {
|
|
|
this.GetSubmit(win, selections, this);
|
|
|
}, this);
|
|
|
//#endregion
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
//#endregion
|
|
|
|
|
|
win = Ext.widget('window', {
|
|
|
title: '辅助核算',
|
|
|
closeAction: 'destroy', //hide,
|
|
|
width: 250,
|
|
|
height: 250,
|
|
|
layout: 'fit',
|
|
|
resizable: true,
|
|
|
modal: true,
|
|
|
closable: false, //为false时tab上不显示叉号
|
|
|
resizable: false, //是否可改变列宽,默认为true
|
|
|
items: formDiv
|
|
|
//draggable: false,//不允许窗体被拖拽
|
|
|
//获取当前鼠标坐标并设置为其生产的初始位置
|
|
|
//x: 250,
|
|
|
//y: 150,
|
|
|
});
|
|
|
}
|
|
|
win.show();
|
|
|
},
|
|
|
|
|
|
GetSubmit: function (win, selections, _this) {
|
|
|
var strACCNAME2 = Ext.getCmp('ACCNAME2').getValue();
|
|
|
var ls = strACCNAME2;
|
|
|
|
|
|
if (Ext.getCmp('CustNAME').getValue() != null) {
|
|
|
if (Ext.getCmp('CustNAME').getValue() != "") {
|
|
|
var CustNAME = Ext.getCmp('CustNAME').getValue();
|
|
|
var re = new RegExp(/^[A-Za-z]+$/);
|
|
|
var bl = re.test(CustNAME);
|
|
|
if (bl) {
|
|
|
if (CustNAME.indexOf("-") < 0) {
|
|
|
var AccitemsList = DsStoreQueryBy(this.storeCustCode, 'CustName', CustNAME.toString()); //CustCode
|
|
|
if (AccitemsList.length > 0) {
|
|
|
var AccitemsRaw = AccitemsList.getAt(0);
|
|
|
if (AccitemsRaw != null) {
|
|
|
CustNAME = AccitemsRaw.data.CustName.toString();
|
|
|
}
|
|
|
else {
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
var AccitemsList = DsStoreQueryBy(this.storeCustCode, 'CodeAndName', CustNAME.toString().toUpperCase());
|
|
|
if (AccitemsList.length > 0) {
|
|
|
var AccitemsRaw = AccitemsList.getAt(0);
|
|
|
if (AccitemsRaw != null) {
|
|
|
CustNAME = AccitemsRaw.data.CustName.toString();
|
|
|
}
|
|
|
else {
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
if (CustNAME.indexOf("-") < 0) {
|
|
|
var AccitemsList = DsStoreQueryBy(this.storeCustCode, 'CustName', CustNAME.toString());
|
|
|
if (AccitemsList.length > 0) {
|
|
|
var AccitemsRaw = AccitemsList.getAt(0);
|
|
|
if (AccitemsRaw != null) {
|
|
|
CustNAME = AccitemsRaw.data.CustName.toString();
|
|
|
}
|
|
|
else {
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
var AccitemsList = DsStoreQueryBy(this.storeCustCode, 'CodeAndName', CustNAME.toString().toUpperCase());
|
|
|
if (AccitemsList.length > 0) {
|
|
|
var AccitemsRaw = AccitemsList.getAt(0);
|
|
|
if (AccitemsRaw != null) {
|
|
|
CustNAME = AccitemsRaw.data.CustName.toString();
|
|
|
}
|
|
|
else {
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
if (CustNAME.toString().trim() != "") {
|
|
|
ls += "▁" + CustNAME;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
if (Ext.getCmp('DeptName').getValue() != null) {
|
|
|
if (Ext.getCmp('DeptName').getValue() != "") {
|
|
|
var DeptName = Ext.getCmp('DeptName').getValue();
|
|
|
if (DeptName.indexOf("-") > -1) {
|
|
|
DeptName = DeptName.toString().substr(DeptName.indexOf("-") + 1);
|
|
|
}
|
|
|
if (DeptName.toString().trim() != "") {
|
|
|
ls += "▁" + DeptName;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
if (Ext.getCmp('SALE').getValue() != null) {
|
|
|
if (Ext.getCmp('SALE').getValue() != "") {
|
|
|
var SALE = Ext.getCmp('SALE').getValue();
|
|
|
var re = new RegExp(/^[A-Za-z]+$/);
|
|
|
var bl = re.test(SALE);
|
|
|
if (bl) {
|
|
|
var AccitemsList = DsStoreQueryBy(this.storeOpCode, 'UserCode', SALE.toString().toUpperCase());
|
|
|
if (AccitemsList.length > 0) {
|
|
|
var AccitemsRaw = AccitemsList.getAt(0);
|
|
|
if (AccitemsRaw != null) {
|
|
|
SALE = AccitemsRaw.data.UserName.toString();
|
|
|
}
|
|
|
else {
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
//
|
|
|
if (SALE.indexOf("-") > -1) {
|
|
|
SALE = SALE.toString().substr(SALE.indexOf("-") + 1);
|
|
|
}
|
|
|
if (SALE.toString().trim() != "") {
|
|
|
ls += "▁" + SALE;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
if (Ext.getCmp('ITEMNAME').getValue() != null) {
|
|
|
if (Ext.getCmp('ITEMNAME').getValue() != "") {
|
|
|
var ITEMNAME = Ext.getCmp('ITEMNAME').getValue();
|
|
|
var re = new RegExp(/^[0-9a-zA-Z]+$/);
|
|
|
var bl = re.test(ITEMNAME);
|
|
|
if (bl) {
|
|
|
var AccitemsList = DsStoreQueryBy(this.storeCwItem, 'ITEMCODE', ITEMNAME.toString().toUpperCase());
|
|
|
if (AccitemsList.length > 0) {
|
|
|
var AccitemsRaw = AccitemsList.getAt(0);
|
|
|
if (AccitemsRaw != null) {
|
|
|
ITEMNAME = AccitemsRaw.data.ITEMNAME.toString();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
if (ITEMNAME.indexOf("-") > -1) {
|
|
|
ITEMNAME = ITEMNAME.toString().substr(ITEMNAME.indexOf("-") + 1);
|
|
|
}
|
|
|
if (ITEMNAME.toString().trim() != "") {
|
|
|
ls += "▁" + ITEMNAME;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
selections[0].set('ACCALL', ls);
|
|
|
//
|
|
|
var rows = this.gridList.getSelectionModel().getSelection();
|
|
|
if (rows[0].data.FCYNO == "RMB") {
|
|
|
this.onNextKeyClick(7);
|
|
|
}
|
|
|
else {
|
|
|
this.onNextKeyClick(5);
|
|
|
}
|
|
|
//
|
|
|
var lsACCALL = rows[0].data.ACCALL.toString();
|
|
|
while (lsACCALL != ls) {
|
|
|
rows = this.gridList.getSelectionModel().getSelection();
|
|
|
var lsACCALL = rows[0].data.ACCALL.toString();
|
|
|
selections[0].set('ACCALL', ls);
|
|
|
}
|
|
|
//
|
|
|
//var win = Ext.getCmp("DivWin");
|
|
|
//var win = this.up("window");
|
|
|
//win.hide();
|
|
|
win.close();
|
|
|
},
|
|
|
|
|
|
onNextKeyClick: function (col) {
|
|
|
var rows = this.gridList.getSelectionModel().getSelection();
|
|
|
var row = rows[rows.length - 1];
|
|
|
var s = this.gridList.getStore();
|
|
|
var number = s.indexOf(row);
|
|
|
this.gridListCellEditing.startEditByPosition({ row: number, column: col });
|
|
|
},
|
|
|
|
|
|
OprationSwap2: function () {
|
|
|
var ret = new Array();
|
|
|
ret[0] = this.gridList.getSelectionModel().getSelection();
|
|
|
ret[1] = this.comboxACCNAME;
|
|
|
ret[2] = this.comboxCust;
|
|
|
ret[3] = this.comboxDept;
|
|
|
ret[4] = this.comboxSALE;
|
|
|
return ret;
|
|
|
}
|
|
|
//#endregion
|
|
|
}); |