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/MsCwVouchersGlManagement/MsCwVouchersGlManagementEdi...

1024 lines
38 KiB
JavaScript

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

Ext.namespace('Shipping');
var C_cargoinfo_id="";
var HTHCount=0;
Shipping.MsCwVouchersGlManagementEdit = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsCwVouchersGlManagementEdit.superclass.constructor.call(this);
};
//#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(), //second
"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();
if (!xhr) {
//...其他生成xmlhttprequest方法
}
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);
// alert(currdate.format('yyyy-MM-dd'));
}
}
xhr.send(null);
//#endregion
Ext.extend(Shipping.MsCwVouchersGlManagementEdit, Ext.Panel, {
parentWin: null,
OpStatus: 'add',
StoreList: null,
editRecord: null,
strCwSTARTGID: '',
isVOUALLNO: 0,
_First: true,
initUIComponents: function () {
this.feeSerialNo = 0;
this.feeBodyDel = [];
//#region 枚举参照相关(编辑form)
Ext.define('FeeTypeMd', {
extend: 'Ext.data.Model',
fields: [
{ name: 'FeeTypeID', type: 'string' },
{ name: 'FeeTypeName', type: 'string' }
]
});
var FeeTypeData = [{ "FeeTypeID": "1", "FeeTypeName": "收入" },
{ "FeeTypeID": "2", "FeeTypeName": "支出"}];
var storeFeeType = Ext.create('Ext.data.Store', {
model: 'FeeTypeMd',
data: FeeTypeData
});
this.comboxFeeTypeRef = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '收付类型',
store: storeFeeType,
name: 'FEETYPE',
valueField: 'FeeTypeID',
displayField: 'FeeTypeName'
, forceSelection: true
});
this.storeUser = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsTruckMng.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' }
});
this.storeUser.load({ params: { condition: " 1=1 "} });
this.comboxCreator = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '制单人',
store: this.storeUser,
name: 'CREATOR',
valueField: 'UserName',
displayField: 'CodeAndName',
allowBlank: false
});
this.comboxAuditor = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '审核人',
store: this.storeUser,
name: 'AUDITOR',
id: "AUDITOR",
valueField: 'UserCode',
displayField: 'CodeAndName'
});
this.storecurr = Ext.create('DsExt.ux.RefTableStore', {
model: 'currRef',
proxy: { url: '/CommMng/BasicDataRef/GetcurrRefList' }
});
this.storecurr.load({ params: { condition: ""} });
this.comboxcurr = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '币别',
store: this.storecurr,
name: 'CURRENCY',
valueField: 'codename',
displayField: 'codename',
value: "RMB",
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
this.formEdit.getForm().findField('EXCHANGERATE').setValue(records[0].data.defaultrate);
}
}
}
});
this.storeFEESTATUS = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeFEESTATUS.load({ params: { enumTypeId: 99024} });
this.comboxFEESTATUS = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '费用状态',
store: this.storeFEESTATUS,
name: 'FEESTATUS',
disabled: true,
id: "STATUS"
});
this.storeAccitems = Ext.create('DsExt.ux.RefTableStore', {
model: 'Accitemsmb',
proxy: { url: '/CommMng/BasicDataRef/GetMngAccitems' }
});
this.storeAccitems.load({ params: { condition: ""} });
this.comboxBANK = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '收支科目(接口)', //收支的银行账户
store: this.storeAccitems, //hidden: true,
name: 'OPERATORSIDE',
valueField: 'ACCID',
displayField: 'ACCIDNAME',
flex: 2
, forceSelection: true
});
//#endregion
//#region 编辑formEdit
this.formEdit = Ext.widget('form', {
region: 'center',
frame: true,
bodyPadding: 5,
trackResetOnLoad: true,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 90,
msgTarget: 'qtip'
},
items: [{
xtype: 'fieldset',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '管理费单号',
disabled: true,
name: 'Feeid'
}, this.comboxFeeTypeRef, this.comboxCreator, {
fieldLabel: '制单时间',
format: 'Y-m-d',
xtype: 'datefield',
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
name: 'CREATEDATE'
}, {
fieldLabel: '时间戳',
name: 'TimeMark', flex: 0, hidden: true, margins: '0'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '金额',
//allowBlank: false,
disabled: true,
id: "AMOUNT_ALL",
name: 'AMOUNT',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}, this.comboxcurr, {
fieldLabel: '汇率',
allowBlank: false,
disabled: false,
name: 'EXCHANGERATE'
}, {
fieldLabel: '费用发生时间',
format: 'Y-m-d',
xtype: 'datefield',
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
name: 'FEEDATE'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
this.comboxFEESTATUS,
this.comboxAuditor, {
fieldLabel: '审核时间',
format: 'Y-m-d',
xtype: 'datefield',
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
name: 'AUDITDATE'
, id: "AUDITDATE"
}, {
fieldLabel: '接口凭证号',
readOnly: true,
xtype: 'textfield',
name: 'VOUCHERNO'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '会计期间',
allowBlank: false,
xtype: 'monthfield',
name: 'ACCDATE',
flex: 1
}, this.comboxBANK, {
fieldLabel: '总账凭证号',
readOnly: true,
xtype: 'textfield',
name: 'VOUALLNO'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '备注',
name: 'REMARK',
flex: 4
}]
}]
}]
});
//#endregion
//#region 明细 <<<< 收支费用明细 >>>>
//#region 参照定义
this.storeFeeAccitems = Ext.create('DsExt.ux.RefTableStore', {
model: 'Accitemsmb',
proxy: { url: '/CommMng/BasicDataRef/GetMngAccitems' }
});
this.storeFeeAccitems.load({ params: { condition: ""} });
this.comboxAccitems = Ext.create('DsExt.ux.RefTableCombox', {
//fieldLabel: '费用科目',
store: this.storeFeeAccitems,
name: 'FEENAME',
valueField: 'ACCID',
displayField: 'ACCIDNAME'
});
//科目加载
this.storeCwAccitems = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CwAccitemsGlModel',
proxy: { url: '/CommMng/BasicDataRef/GetCwAccitemsGl' }
});
this.storeCwAccitems.load({
params: { condition: "ISENABLE=1 and DETAILED=1" },
callback: function (options, success, response) {
var data = {
"GID": "",
"ACCID": "",
"ACCNAME": "",
"ACCIDNAME": "",
"DETAILED": "",
"DC": "",
"ISFCY": "",
"ISDEPTACC": "", //核算部门,按规则设置生成
"ISEMPLACC": "", //核算人员,按规则设置生成
"ISCORPACC": "", //核算客户,按规则设置生成
"ISITEMACC": "", //核算项目,按规则设置生成
"REMARKS": "",
"YEAR": "",
"MONTH": "",
"PACCGID": "",
"ACCATTRIBUTE": "", //科目属性(资产、负债、共同、权益、成本、损益)
//"ISENABLE": "",
"id": "",
"NAME": "",
"ACCTYPE": "", //科目类别
"leaf": "",
"expanded": "",
"DR": "",
"CR": "",
"PACCNAME": ""
};
this.storeCwAccitems.insert(0, data);
},
scope: this
});
this.comboxACCNAME = Ext.create('DsExt.ux.RefTableCombox', {
//fieldLabel: '科目名称(总账)',
store: this.storeCwAccitems,
forceSelection: true, //输入值是否严格为待选列表中存在的值
//id: 'ACCID',
name: 'OPERATORSIDE_gl',
valueField: 'ACCID',
displayField: 'ACCIDNAME',
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'keyup': {
fn: function (_field, e) {
if (e.getKey() == 13) {
this.onRefreshClick();
}
},
scope: this
}
}
});
Ext.define('DsShipping.ux.CustomInvRefModel', {
extend: 'Ext.data.Model',
fields: [
{ name: 'GId', type: 'string' },
{ name: 'CustCode', type: 'string' },
{ name: 'CustName', type: 'string' },
{ name: 'CodeAndName', type: 'string' },
{ name: 'BillRises1', type: 'string' },
{ name: 'RMBBillRises', type: 'string' },
{ name: 'RMBBank', type: 'string' },
{ name: 'RMBAccount', type: 'string' },
{ name: 'USDBillRises', type: 'string' },
{ name: 'USDBank', type: 'string' },
{ name: 'USDAccount', type: 'string' },
{ name: 'TaxNo', type: 'string' },
{ name: 'Addr', type: 'string' },
{ name: 'Tel', type: 'string' }
]
});
this.storeTrader = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomInvRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomInvRefList' }
});
this.storeTrader.load({ params: { condition: ""} });
this.comboxTrader = Ext.create('DsExt.ux.RefTableCombox', {
//fieldLabel: '关系人',
store: this.storeTrader,
name: 'CUSTOMERSIDE',
valueField: 'CustName',
displayField: 'CodeAndName'
});
this.storecurr = Ext.create('DsExt.ux.RefTableStore', {
model: 'currRef',
proxy: { url: '/CommMng/BasicDataRef/GetcurrRefList' }
});
this.storecurr.load({ params: { condition: ""} });
this.comboxcurr = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storecurr,
name: 'currid',
valueField: 'gid',
displayField: 'codename'
//币别
});
this.storeDEPT = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsTruckMng.ux.DEPTRefModel',
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,
name: 'DEPTID', id: "DEPTID",
valueField: 'GID',
displayField: 'DeptName'
});
//#endregion
//数据集
this.storeFeeBody = Ext.create('Ext.data.Store', {
model: 'FeeBodymb',
remoteSort: false,
pruneModifiedRecords: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsCwVouchersGlManagement/GetFeeList',
reader: {
id: 'id,ContractNo',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//表格
this.CheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
this.formFeeBody = new Ext.grid.GridPanel({
store: this.storeFeeBody,
enableHdMenu: false,
region: 'north',
trackResetOnLoad: true,
//height: 160,
title: '费用明细',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
selModel: this.CheckBoxModel,
selType: 'cellmodel',
columns: [{
dataIndex: 'gid',
header: 'gid',
width: 80,
hidden: true
}, {
dataIndex: 'Feeid',
header: 'Feeid',
width: 80,
hidden: true
}, {
dataIndex: 'CUSTOMERSIDE',
header: '关系人',
renderer: function (value, p, record) {
if (value == null || value == '') return '';
else return record.data.CUSTOMERSIDE; //此处是FeeBody中的字段如果需要则是def之类的查询字段
},
editor: this.comboxTrader,
width: 140
}, {
dataIndex: 'FEENAME',
header: '费用名称(接口)',
renderer: function (value, p, record) {
if (value == null || value == '') return '';
else return record.data.FEENAMEREF;
},
editor: this.comboxAccitems,
width: 170
}, {
dataIndex: 'OPERATORSIDE_gl',
header: '费用名称(总账)',
renderer: function (value, p, record) {
if (value == null || value == '') return '';
else return record.data.OPERATORSIDE_gl_REF;
},
editor: this.comboxACCNAME,
width: 170
}, {
dataIndex: 'AMOUNT',
header: '金额',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
},
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}, {
dataIndex: 'DEPTGID',
header: '所属部门',
renderer: function (value, p, record) {
if (value == null || value == '') return '';
else return record.data.DEPTNAME;
},
editor: this.comboxDEPT,
width: 140
}, {
dataIndex: 'REMARK',
header: '备注',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}, {
dataIndex: 'CUSTBANK',
header: '关系人银行',
width: 100,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}, {
dataIndex: 'CUSTACCOUNT',
header: '关系人银行账号',
width: 100,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}]
});
//#endregion
//#region 公共按钮//布局
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [{
text: "生成总账凭证",
id: "btnAddCwVouchers",
iconCls: "btnadd",
handler: function (button, event) {
this.onAddCwVouchers();
},
scope: this
}]
});
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 32,
items: [this.panelBtn]//, this.formEdit]
});
this.page_1 = new Ext.Panel({
title: "管理费用",
items: [this.formEdit, this.formFeeBody]
});
this.MainTab = new Ext.tab.Panel({
layout: "border",
region: "center",
items: [ this.page_1 ]
})
Ext.apply(this, {
items: [this.panelTop, this.MainTab]
});
//#endregion
parentWin = window.parent.opener;
this.InitData();
//#region 生成凭证_汇率列表
//#region 加载数据
//制单人
this.storePREPAREDCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' }
});
this.storePREPAREDCode.load();
this.comboxPREPARED = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '制单人',
store: this.storePREPAREDCode,
forceSelection: true,
id: 'PREPARED',
name: 'PREPARED',
valueField: 'UserName',
displayField: 'CodeAndName',
value: SHOWNAME
});
//#endregion
//#region 定义数据集
this.storeListCw = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'MsCodeCurrencyList',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsCwVouchersGlManagement/GetCodeCurrencyList',
reader: {
id: 'CURR',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//#endregion
//#region 列定义
this.girdcolums = [{
sortable: false,
text: '币别',
dataIndex: 'CURR',
width: 100,
align: 'center'
}, {
sortable: false,
text: '调整汇率',
dataIndex: 'FCYEXRATE',
width: 118,
align: 'right',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 5, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>'; } } else { return value; } } catch (e) { return value; } return value; },
editor: {
xtype: 'numberfield',
selectOnFocus: true, //得到焦点时自动选择文本
allowDecimals: true, //允许输入小数
decimalPrecision: 5, //允许保留的小数位数,并四舍五入
nanText: '请输入有效数值',
hideTrigger: true //是否隐藏上下调节按钮
}
}];
//#endregion
//#region gridList列表显示信息
this.gridListCw = new Ext.grid.GridPanel({
region: 'center',
width: 220,
store: this.storeListCw,
enableHdMenu: false, //是否显示表格列的菜单
hideHeaders: false, //是否隐藏表头
rowLines: true,
columnLines: true,
loadMask: { msg: "数据加载中,请稍等..." },
selType: 'cellmodel',
columns: this.girdcolums
});
//#endregion
this.InitDataCw();
//#endregion
}, //end initUIComponents
//#region 载入数据
InitData: function () {
this.opStatus = 'add';
var condition = '';
if (parentWin) {
var ret = parentWin.OprationSwap();
this.opStatus = ret[0];
this.StoreList = ret[1];
this.editRecord = ret[2];
}
if (this.opStatus == 'edit')
condition = " cm.Feeid='" + this.editRecord.get('Feeid') + "'";
this.LoadData(this.opStatus, condition);
}, //end InitData
LoadData: function (opstatus, condition) {
this.opStatus = opstatus;
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/MvcShipping/MsCwVouchersGlManagement/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.ERROR, buttons: Ext.Msg.OK });
return;
}
var data = result.data;
// this.formEdit.getForm().reset();
if (data.CREATEDATE == "") { data.CREATEDATE = currdate.format('yyyy-MM-dd') };
if (data.CREATOR == "") { data.CREATOR = usercode };
if (data.CURRENCY == "") { data.CURRENCY = "RMB" };
if (data.FEETYPE == "0") { data.FEETYPE = "2" };
if (data.EXCHANGERATE == "") { data.EXCHANGERATE = "1" };
if (data.FEEDATE == "") { data.FEEDATE = currdate.format('yyyy-MM-dd') };
if (data.AMOUNT == "") { data.AMOUNT = 0 };
this.formEdit.getForm().setValues(data);
//alert(data.TimeMark);
if (this.opStatus == 'add') {
Ext.getCmp("STATUS").setValue('1');
} else {
if (this.isVOUALLNO == 1) {
this.editRecord.fields.each(function (field) {
if (field.persist) {
name = field.name;
if (name == 'VOUALLNO') {
this.editRecord.set(name, data.VOUALLNO.toString());
}
}
}, this);
this.editRecord.commit();
}
}
this.LoadPeriod(this.opStatus);
function setsave() { saved = true; }
var task = new Ext.util.DelayedTask(setsave);
task.delay(500);
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
}); //request over
if (this.opStatus == 'edit') {
this.formEdit.getForm().findField('Feeid').setDisabled(false);
this.storeFeeBody.load({ params: { condition: "cfm.Feeid = '" + this.editRecord.get('Feeid') + "'"} });
this.formEdit.getForm().findField('Feeid').setDisabled(true);
}
},
LoadPeriod: function (opstatus) {
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/Account/ChMonthClose/GetNowPeriod',
params: {
condition: ''
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
return;
}
data = result.data;
this.MsPeriod = data;
this.LoadPeriodStatus(opstatus);
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
},
LoadPeriodStatus: function (opstatus) {
var FEEDATE = this.formEdit.getForm().findField('FEEDATE').getValue();
if (FEEDATE == '') {
this.formEdit.getForm().findField('FEEDATE').setMinValue(this.MsPeriod.FDAY);
this.formEdit.getForm().findField('FEEDATE').setReadOnly(false);
} else {
var oDate1 = new Date(FEEDATE);
var oDate2 = new Date(this.MsPeriod.FDAY);
if (oDate1.getTime() >= oDate2.getTime()) {
this.formEdit.getForm().findField('FEEDATE').setMinValue(this.MsPeriod.FDAY);
this.formEdit.getForm().findField('FEEDATE').setReadOnly(false);
} else {
if (opstatus == 'add' || opstatus == 'copyadd') {
this.formEdit.getForm().findField('FEEDATE').setMinValue(this.MsPeriod.FDAY);
this.formEdit.getForm().findField('FEEDATE').setReadOnly(false);
}
else {
this.formEdit.getForm().findField('FEEDATE').setMinValue('');
this.formEdit.getForm().findField('FEEDATE').setReadOnly(true);
}
}
}
},
//#endregion
//#region 生成凭证
//#region 加载事件
InitDataCw: function () {
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/MvcShipping/RptCwGenlegAccitems/GetData',
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
return;
}
data = result.data;
var arrtmp = data.toString().split("&");
this.strCwSTARTGID = arrtmp[0].toString();
var strCwSTARTNAME = arrtmp[1].toString();
var strCwACCDATE = arrtmp[2].toString();
var sYear = arrtmp[3].toString();
var sMonth = arrtmp[4].toString();
//
//var sZQ = "&nbsp;&nbsp;当前登录账套:“" + strCwSTARTNAME + "”&nbsp;&nbsp;当前财务账期:“" + sYear + "年第" + sMonth + "期”&nbsp;&nbsp;";
//Ext.getCmp("lbTitle2").setValue(sZQ);
//this.onRefreshClick();
} else {
//Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
},
//#endregion
onAddCwVouchers: function (button, event) {
var strGids = this.editRecord.get('Feeid');
if (strGids == "") {
Ext.Msg.show({ title: '提示', msg: '请先保存单据!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
//
Ext.Ajax.request({
waitMsg: '正在预读数据,请稍候...',
url: '/MvcShipping/MsCwVouchersGlManagement/GetIsVoucher',
params: {
strGids: strGids
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({ title: '提示', msg: result.Message, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK });
return;
}
this.storeListCw.load({ params: { strGids: strGids }, waitMsg: "正在刷新数据...", scope: this });
this.showContactForm(false, strGids, this, 1);
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
//
},
//#region 层_显示信息
showContactForm: function (win, strGids, _this, iGids) {
var required = '<span style="color:red;font-weight:bold;" data-qtip="Required">*</span>';
if (!win) {
//#region 编辑formDiv 基本信息
var formDiv = Ext.widget('form', {
border: false,
bodyPadding: 10,
fieldDefaults: {
labelAlign: 'right',
labelWidth: 60,
labelStyle: 'font-weight:bold'
},
items: [this.comboxPREPARED, {
fieldLabel: '记账日期',
format: 'Y-m-d',
xtype: 'datefield',
allowBlank: false,
name: 'VOUDATE',
value: Ext.util.Format.date(Ext.Date.add(new Date(), Ext.Date.MONTH - 1, 1), "Y-m-d")
}, {
xtype: "checkbox", //checkbox控件
name: "ISRATE",
boxLabel: "是否按照系统录入汇率",
width: 200,
inputValue: "true", //选中的值
uncheckedValue: "false", //未选中的值
checked: true, //绘制时的选中状态,
listeners: {
'change': function (field, newValue, oldValue, eOpts) {
if (field.checked.toString() == "false") {
this.gridListCw.show();
}
else {
this.gridListCw.hide();
}
},
scope: this
}
}, this.gridListCw
],
buttons: [{
text: '生成凭证',
handler: function (options, success, response) {
if (!this.up('form').getForm().isValid()) {
return;
}
var dataDiv = this.up('form').getForm().getValues(false, false, false);
//
var j = 0;
var bodydatas = [];
for (var i = 0; i < _this.storeListCw.getCount(); i += 1) {
var member = _this.storeListCw.getAt(i);
bodydatas.push(member);
}
var jsonBody;
if (bodydatas.length > 0) {
jsonBody = ConvertRecordsToJsonAll(bodydatas);
}
//
Ext.Msg.wait('正在生成' + iGids + '票结算单数据, 请稍侯...');
Ext.Ajax.request({
waitMsg: '正在生成' + iGids + '票结算单数据, 请稍侯...',
url: '/MvcShipping/MsCwVouchersGlManagement/onAddCwVouchers',
scope: this,
params: {
strGids: strGids,
dataDiv: Ext.JSON.encode(dataDiv),
jsonBody: jsonBody
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.MessageBox.INFO, buttons: Ext.Msg.OK })
//
_this.isVOUALLNO = 1;
_this.InitData();
return;
} else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
} else {
Ext.Msg.show({ title: '请重试', msg: '服务器响应出错', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
},
timeout: 3000000//30秒
});
//
this.up('form').getForm().reset();
this.up('window').hide();
}
}, {
text: '取消',
handler: function () {
this.up('form').getForm().reset();
this.up('window').hide();
}
}],
listeners: {
scope: this,
'render': function (thisDiv, thisExtend) {
this.gridListCw.hide();
//
Ext.Ajax.request({
waitMsg: '正在查询委托编号状态...',
url: '/MvcShipping/MsBaseInfo/GetCwVOUNO',
params: {
VKNO: "记"
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({ title: '提示', msg: result.Message, icon: Ext.MessageBox.INFO, buttons: Ext.Msg.OK });
return;
}
//
data = result.data;
var arrayList = new Array();
arrayList = data.split("~");
var strY = arrayList[0].toString();
var strM = arrayList[1].toString();
var sVOUNO = arrayList[2].toString();
var strVOUNO = arrayList[3].toString();
var strVOUDATE = arrayList[4].toString();
var strACCDATE = arrayList[5].toString();
//
thisDiv.form.findField('VOUDATE').setValue(strVOUDATE);
thisDiv.form.findField('VOUDATE').setMinValue(strACCDATE + "-01");
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}
}
});
//#endregion
win = Ext.widget('window', {
title: '辅助核算',
closeAction: 'hide',
width: 250,
height: 250,
layout: 'fit',
resizable: true,
modal: true,
closable: false,
items: formDiv
});
}
win.show();
}
//#endregion
//#endregion
});