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/MsCwVouchersGlBaoxiao2/MsCwVouchersGlBaoxiao2Edit.js

1424 lines
51 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.MsCwVouchersGlBaoxiao2Edit = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsCwVouchersGlBaoxiao2Edit.superclass.constructor.call(this);
};
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);
Ext.extend(Shipping.MsCwVouchersGlBaoxiao2Edit, Ext.Panel, {
parentWin: null,
OpStatus: 'add',
StoreList: null,
editRecord: null,
BXSTATUS: 1,
_First: true,
VISIBLERANGE: 0,
OPERATERANGE: 0,
WorkFlowName: "",
WorkFlowID: "",
isVOUALLNO: 0,
initUIComponents: function () {
this.feeSerialNo = 0;
this.feeBodyDel = [];
this.feeBodyUnUnion = [];
this.PayBodyDel = [];
this.formname = "BaoxiaoEdit2";
WorkFlowName = 'BaoxiaoMod';
//#region 枚举参照相关(编辑form)
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: '制单人',
forceSelection: true,
store: this.storeUser,
name: 'CREATEUSER',
id: "CREATEUSER",
valueField: 'UserName',
displayField: 'CodeAndName',
allowBlank: false
});
//通过mblno获取bsno
this.storeBS = Ext.create('DsExt.ux.RefTableStore', {
model: 'BSmb',
proxy: { url: '/OA/Baoxiao/GetBSNO' }
});
this.storeBS.load({ params: { COMPANYID: COMPANYID} });
this.comboxCUSTNO = Ext.create('DsExt.ux.RefTableCombox', {
//fieldLabel: '业务编号',
forceSelection: true,
store: this.storeBS,
name: 'BsNo',
valueField: 'BSNO',
displayField: 'CUSTNO',
allowBlank: false
});
this.comboxMBLNO = Ext.create('DsExt.ux.RefTableCombox', {
//fieldLabel: '业务编号',
forceSelection: true,
store: this.storeBS,
name: 'MBLNO',
valueField: 'MBLNO',
displayField: 'MBLNO', hidden: true,
allowBlank: false
});
this.comboxAuditor = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '审核人',
forceSelection: true,
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', {
forceSelection: true,
fieldLabel: '币别',
store: this.storecurr,
name: 'Currency',
valueField: 'codename',
displayField: 'codename',
value: "RMB"
});
this.storeBXSTATUS = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeBXSTATUS.load({ params: { enumTypeId: 99024} });
this.comboxBXSTATUS = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '报销单状态',
//forceSelection :true,
store: this.storeBXSTATUS,
name: 'BXSTATUS',
readOnly: true,
id: "BXSTATUS"
});
this.storeFEESTATUS = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeFEESTATUS.load({ params: { enumTypeId: 99024} });
this.comboxFEESTATUS = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '费用状态',
forceSelection: true,
store: this.storeFEESTATUS,
name: 'FEESTATUS',
readOnly: true,
id: "STATUS"
});
this.storeAccitems = Ext.create('DsExt.ux.RefTableStore', {
model: 'Accitemsmb',
proxy: { url: '/CommMng/BasicDataRef/GetAccitems' }
});
this.storeAccitems.load({ params: { condition: ""} });
this.storeAmount = Ext.create('DsExt.ux.RefTableStore', {
model: 'selectChFeemb',
proxy: { url: '/OA/Baoxiao/GetThisFee' }
});
//#endregion
//编辑form:formEdit
this.formEdit = Ext.widget('form', {
// layout: "border",
region: 'north',
frame: true,
bodyPadding: 1,
trackResetOnLoad: true,
fieldDefaults: {
margins: '1 1 1 1',
labelAlign: 'right',
flex: 1,
labelWidth: 90,
msgTarget: 'qtip'
//,split:true
},
//bodyStyle: 'background:#FFF',
items: [
{//fieldset 1
xtype: 'fieldset',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [
{//container_1
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '报销单序列号',
// allowBlank: false,
//disabled: true,
name: 'BXGID'
}, {
fieldLabel: '金额',
//allowBlank: false,
readOnly: true,
id: "AMOUNT_ALL", hidden: true,
name: 'AMOUNT', flex: 1,
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.comboxCreator, {
fieldLabel: '制单时间',
format: 'Y-m-d H:i:s', id: "CREATEDATE",
xtype: 'datefield',
renderer: Ext.util.Format.dateRenderer('Y-m-d H:i:s'),
name: 'CREATEDATE'
}, {
fieldLabel: '报销单号',
// allowBlank: false,
//disabled: true,
name: 'BXNO'
}
]
} //container_1 end
, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '支票号',
name: 'CHEQUENO', hidden: true,
flex: 2
}, {
fieldLabel: '支票额度', id: "CHEQUEAMOUNT",
name: 'CHEQUEAMOUNT', hidden: true,
flex: 1
}, this.comboxBXSTATUS,
{
fieldLabel: '备注',
name: 'REMARK',
flex: 2
}, {
fieldLabel: '总账凭证号',
readOnly: true,
xtype: 'textfield',
name: 'VOUALLNO'
}]
}
]
}]
});
this.formSum = Ext.widget('form', {
// layout: "border",
region: 'south',
frame: true,
bodyPadding: 1,
trackResetOnLoad: true,
fieldDefaults: {
margins: '1 1 1 1',
labelAlign: 'right',
flex: 1,
labelWidth: 90,
msgTarget: 'qtip'
//,split:true
},
//bodyStyle: 'background:#FFF',
items: [
{//fieldset 1
xtype: 'fieldset',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [
{//container_1
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
]
} //container_1 end
, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: []
}
, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '合计RMB',
// allowBlank: false,
readOnly: true, flex: 1,
name: 'RMBAMOUNT', id: "RMBAMOUNT",
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;
}
}, {
fieldLabel: '金额大写',
// allowBlank: false,
readOnly: true, flex: 2,
name: 'HJRMBDX', id: "HJRMBDX"
}, { xtype: 'hiddenfield', flex: 1}]
}
, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '合计USD',
// allowBlank: false,
readOnly: true, flex: 1,
name: 'USDAMOUNT', id: "USDAMOUNT"
}, {
fieldLabel: '金额大写',
// allowBlank: false,
readOnly: true, flex: 2,
name: 'HJUSDDX', id: "HJUSDDX"
}, { xtype: 'hiddenfield', flex: 1}]
}
, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '合计其他币别',
// allowBlank: false,
readOnly: true, flex: 1,
name: 'OTHERAMOUNT', id: "OTHERAMOUNT"
}, {
fieldLabel: '金额大写',
// allowBlank: false,
readOnly: true, flex: 2,
name: 'HJOTHERDX', id: "HJOTHERDX"
}, { xtype: 'hiddenfield', flex: 1}]
}
, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '审核人',
// allowBlank: false,
readOnly: true, flex: 1,
name: 'AUDITOR'
}, {
fieldLabel: '审核时间',
// allowBlank: false,
readOnly: true, flex: 1,
name: 'AUDITTIME'
}, { xtype: 'hiddenfield', flex: 2 }
]
}
]
}]
});
//////////////////////////////////
//#region 明细 <<<< 收支费用明细 >>>>
//
//#region 参照
this.comboxAccitems = Ext.create('DsExt.ux.RefTableCombox', {
forceSelection: true,
store: this.storeAccitems,
name: 'FEENAME',
valueField: 'ACCID',
displayField: 'ACCIDNAME'
});
this.storeFeeNameRef = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsTruckMng.ux.FeeTypeRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetFeeTypeRefList' }
});
this.storeFeeNameRef.load({ params: { condition: ""} });
this.comboxFeeNameRef = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeFeeNameRef,
forceSelection: true,
name: 'FeeName',
valueField: 'Name',
displayField: 'CodeAndName'
});
this.storeCustomerNameRef = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsTruckMng.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeCustomerNameRef.load({ params: { condition: ""} });
this.comboxCustomerNameRef = Ext.create('DsExt.ux.RefTableCombox', {
forceSelection: true,
store: this.storeCustomerNameRef,
name: 'CustomerName',
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: 'codename',
displayField: 'codename'
//币别
});
this.storeTAXRATE = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeTAXRATE.load({ params: { enumTypeId: 25} });
this.comboxTAXRATE = Ext.create('DsExt.ux.RefEnumCombox', {
//fieldLabel: '税率',
store: this.storeTAXRATE,
name: 'TAXRATE',
valueField: 'EnumValueName',
displayField: 'EnumValueName',
id: "TAXRATE"
});
this.storeCHEQUENUM = Ext.create('DsExt.ux.RefTableStore', {
model: 'CHEQUENUMmb',
proxy: { url: '/CommMng/BasicDataRef/GetUnusedCHEQUENUM' }
});
//this.storeCHEQUENUM.load({ params: { DEPTID: DEPTGID, BXGID: bxgid} });
this.comboxCHEQUENUM = Ext.create('DsExt.ux.RefTableCombox', {
//fieldLabel: '支票号',来自未使用的支票
forceSelection: true,
store: this.storeCHEQUENUM,
name: 'CHEQUENUM',
valueField: 'CHEQUENUM',
displayField: 'CHEQUENUM'
//,id: "CHEQUENUM"
});
this.storeREASON = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeREASON.load({ params: { enumTypeId: 36} });
this.comboxREASON = Ext.create('DsExt.ux.RefEnumCombox', {
//fieldLabel: '借款方式',
forceSelection: true,
store: this.storeREASON,
name: 'REASON',
valueField: 'EnumValueName',
displayField: 'EnumValueName'
});
//#endregion
//数据集
this.storeBaoXiao2Body = Ext.create('Ext.data.Store', {
model: 'BaoXiao2Bodymb',
remoteSort: false,
pruneModifiedRecords: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsCwVouchersGlBaoxiao2/GetBaoXiao2Body',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.CheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
this.girdcolums = [
//new Ext.grid.RowNumberer()
//,
{
sortable: true, hidden: true,
dataIndex: 'GID',
header: 'GID',
width: 80
}, {
sortable: true,
dataIndex: 'FEENAME',
header: '费用名称',
width: 80,
editor: this.comboxFeeNameRef
},
{
sortable: true,
dataIndex: 'CURRENCY',
header: '币别',
width: 80,
editor: this.comboxcurr
},
{
sortable: true,
dataIndex: 'Remark',
header: '报销事由',
width: 200,
editor: {
xtype: 'textfield', //numberfield
selectOnFocus: true
}
},
{
sortable: true,
dataIndex: 'SETTLEMENT',
header: '报销金额',
width: 100,
editor: {
xtype: 'numberfield', //numberfield
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;
}
},
{
sortable: true,
dataIndex: 'REASON',
header: '支付方式',
width: 80,
editor: this.comboxREASON,
renderer: function (value, p, record) {
return record.data.JKTYPE_REF;
}
},
{
sortable: true, hidden: true,
dataIndex: 'JKTYPE_REF',
header: 'JKTYPE_REF',
width: 80
},
{
sortable: true,
dataIndex: 'INVOICENUM',
header: '发票号',
width: 100,
editor: {
xtype: 'textfield', //numberfield
selectOnFocus: true
}
},
{
sortable: true, //hidden: true,
dataIndex: 'JKGID',
header: '借款单号',
width: 120
},
{
sortable: true,
dataIndex: 'AMOUNT',
header: '金额(借款/报销)',
width: 100,
editor: {
xtype: 'numberfield', //numberfield
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;
}
},
{
sortable: true, //hidden: true,
dataIndex: 'SALESNO',
header: '相关编号',
width: 100,
editor: {
xtype: 'textfield', //numberfield
selectOnFocus: true
}
}, {
sortable: true,
dataIndex: 'JKNAME',
header: '借款人',
width: 80
},
{
sortable: true,
dataIndex: 'JKDATE',
header: '借款日期',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'FEETYPE',
header: 'FEETYPE',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'FEETYPE_REF',
header: '收付类型',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'FEESTATUS',
header: 'FEESTATUS',
width: 80
},
{
sortable: true,
dataIndex: 'FEESTATUS_REF',
header: '费用状态',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'MODIFIEDUSER',
header: 'MODIFIEDUSER',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'MODIFIEDTIME',
header: 'MODIFIEDTIME',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'BXGID',
header: '报销单号',
width: 80
}];
this.formFeeBody = new Ext.grid.GridPanel({
store: this.storeBaoXiao2Body,
enableHdMenu: false,
region: 'center',
title: '费用明细',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
selModel: this.CheckBoxModel,
selType: 'cellmodel',
columns: this.girdcolums
});
/////////////以下部分为获取存储的gridpanel显示样式
this.girdcolums = DsTruck.GetGridPanel(USERID, this.formname, this.girdcolums);
//使用者id表名 中间column数组
this.girdcolums.unshift(new Ext.grid.RowNumberer());
this.formFeeBody.reconfigure(this.storeBaoXiao2Body, this.girdcolums);
////////////////////////////
//#endregion 明细<<<< 收支费用明细 >>>>结束
//#region 支付情况。贷方明细 OA_Baoxiao_Pay
this.storeSETTLEMENTTYPE = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeSETTLEMENTTYPE.load({ params: { enumTypeId: 26} });
this.comboxSETTLEMENTTYPE = Ext.create('DsExt.ux.RefEnumCombox', {
//支付方式 1支票 2网银电汇 3汇票
forceSelection: true,
store: this.storeSETTLEMENTTYPE,
name: 'SETTLEMENTTYPE'
});
this.storeBank = Ext.create('DsExt.ux.RefTableStore', {
model: 'Bankmb',
proxy: { url: '/CommMng/BasicDataRef/GetBank' }
});
this.storeBank.load({ params: { condition: " linkid='" + COMPANYID + "'"} });
this.comboxBank = Ext.create('DsExt.ux.RefTableCombox', {
forceSelection: true,
store: this.storeBank,
name: 'Bank',
//fieldLabel: '账户',
valueField: 'FINANCESOFTCODE',
displayField: 'codename'
//币别
});
this.comboxCHEQUE = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeBaoXiao2Body,
name: 'TICKETNO',
valueField: 'CHEQUENUM',
displayField: 'CHEQUENUM'
});
//总账科目加载
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, //输入值是否严格为待选列表中存在的值
name: 'OPERATORSIDE_gl',
valueField: 'ACCID',
displayField: 'ACCIDNAME'
});
//数据集
this.storePayBody = Ext.create('Ext.data.Store', {
model: 'BXPaymb',
remoteSort: false,
pruneModifiedRecords: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsCwVouchersGlBaoxiao2/GetPayList',
reader: {
id: 'gid',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//表格
this.CheckBoxModel_S = Ext.create('Ext.selection.CheckboxModel');
this.formPayBody = new Ext.grid.GridPanel({
layout: 'border',
store: this.storePayBody,
enableHdMenu: false,
region: 'center',
trackResetOnLoad: true,
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
selModel: this.CheckBoxModel_S,
selType: 'cellmodel',
columns: [
{
sortable: true,
dataIndex: 'GID',
header: 'GID',
hidden: true,
width: 60
}, {
sortable: true,
dataIndex: 'BXGID',
header: 'BXGID',
hidden: true,
width: 60
}, {
sortable: true,
dataIndex: 'SETTLEMENTTYPE',
header: '结算方式',
renderer: function (value, p, record) {
if (value == null || value == '') return '';
else return record.data.SETTLEMENTTYPE_REF;
},
editor: this.comboxSETTLEMENTTYPE,
width: 80
}, {
sortable: true,
dataIndex: 'TICKETNO',
header: '票号',
editor: this.comboxCHEQUE,
width: 120
}, {
sortable: true,
dataIndex: 'AMOUNT',
header: '报销金额',
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;
},
width: 100
}, {
sortable: true,
dataIndex: 'REMARK',
header: '备注',
editor: {
xtype: 'textfield',
selectOnFocus: true
},
width: 80
}, {
sortable: true,
dataIndex: 'FINANCIALCODE',
header: '贷方科目(接口,银行户/其他应收等)',
editor: this.comboxBank,
width: 120
}, {
sortable: true,
dataIndex: 'OPERATORSIDE_gl',
header: '借方科目(总账)',
editor: this.comboxACCNAME,
width: 120
}]
});
//#endregion 支付情况(贷方明细)//////////////////////end
//公共按钮Toolbar:panelBtn
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [{
text: "生成总账凭证",
id: "btnAddCwVouchers",
iconCls: "btnadd",
handler: function (button, event) {
this.onAddCwVouchers();
},
scope: this
}]
}); //end 按钮Toolbar
//布局
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 30,
items: [this.panelBtn]
});
this.panelFee = new Ext.Panel({
layout: "border",
region: 'north',
margin: '1 1',
height: 450,
split: true,
items: [this.panelTop, this.formEdit, this.formFeeBody, this.formSum]
});
this.panelPayBody = new Ext.Panel({
layout: "border",
region: 'center',
title: '结算方式',
split: true,
height: 220,
margin: '1 1',
items: [this.formPayBody]
});
Ext.apply(this, {
items: [this.panelTop, this.panelFee, this.panelPayBody]
});
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/MsCwVouchersGlBaoxiao2/GetCodeCurrencyList',
reader: {
id: 'CURR',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//#endregion
//#region 列定义
this.girdcolums = [{
sortable: false,
text: '币别',
dataIndex: 'CURR',
width: 100,
align: 'center'
}, {
sortable: false,
text: '调整汇率',
dataIndex: 'FCYEXRATE',
width: 118,
align: 'right',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 5, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>'; } } else { return value; } } catch (e) { return value; } return value; },
editor: {
xtype: 'numberfield',
selectOnFocus: true, //得到焦点时自动选择文本
allowDecimals: true, //允许输入小数
decimalPrecision: 5, //允许保留的小数位数,并四舍五入
nanText: '请输入有效数值',
hideTrigger: true //是否隐藏上下调节按钮
}
}];
//#endregion
//#region gridList列表显示信息
this.gridListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1 //1单击2双击
});
this.gridListCw = new Ext.grid.GridPanel({
region: 'center',
width: 220,
store: this.storeListCw,
enableHdMenu: false, //是否显示表格列的菜单
hideHeaders: false, //是否隐藏表头
rowLines: true,
columnLines: true,
loadMask: { msg: "数据加载中,请稍等..." },
plugins: [this.gridListCellEditing],
selType: 'cellmodel',
columns: this.girdcolums
});
//#endregion
//#endregion
}, //end initUIComponents
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];
// this.parentfunction = ret[3];
}
if (this.OpStatus == 'edit') {
condition = " BX.BXGID='" + this.editRecord.get('BXGID') + "'";
}
else {
Ext.getCmp("AMOUNT_ALL").setValue("0");
Ext.getCmp("CHEQUEAMOUNT").setValue("0");
}
/*
if (COMPANYID == "" || DEPTGID == "") {
alert("登录信息不全,请退出重新登录")
} else {
this.LoadData(this.OpStatus, condition);
}*/
this.LoadData(this.OpStatus, condition);
var me = this;
Ext.Ajax.request({
waitMsg: '正在查询用户权限...',
url: '/CommMng/BasicDataRef/GetAuthorityRange',
params: {
modName: "mod_Baoxiao",
USERID: USERID
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
rec = result.data;
//alert(rec.VISIBLERANGE);
//alert(rec.OPERATERANGE);
//可操作为0则全都可见3为可提交/驳回,2为可审核/驳回1为只能看
/*0 审核通过
1 录入状态
2 提交审核
3 申请修改
4 申请删除
5 取消申请
6 驳回提交*/
this.VISIBLERANGE = rec.VISIBLERANGE;
this.OPERATERANGE = rec.OPERATERANGE;
if (this.OPERATERANGE == '0') {
me.formPayBody.show();
} else
if (this.OPERATERANGE == '1') {
me.formPayBody.hide();
} else
if (this.OPERATERANGE == '2') {
Ext.getCmp("add2").enable();
Ext.getCmp("del2").enable();
} else {//3
Ext.getCmp("add2").disable();
Ext.getCmp("del2").disable();
}
}
else
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
},
scope: this
}); //request over
//var storeWorkFlowStep = GetWorkFlowStep('')
}, //end InitData
//载入数据
LoadData: function (OpStatus, condition) {
if (COMPANYID == "" || DEPTGID == "") {
alert("登录信息不全,请退出重新登录");
return;
}
this.OpStatus = OpStatus;
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/MvcShipping/MsCwVouchersGlBaoxiao2/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 hh:mm:ss') };
if (data.CREATEUSER == "") { data.CREATEUSER = SHOWNAME };
if (data.AMOUNT == "") { data.AMOUNT = 0 };
if (data.CHEQUEAMOUNT == "") { data.CHEQUEAMOUNT = 0 };
if (data.BXSTATUS_REF == "") { data.BXSTATUS_REF = "录入状态" };
if (data.BXSTATUS == "") { data.BXSTATUS = 1 };
if (this.OpStatus == 'add') {
data.COMPANY = COMPANYID;
data.DEPTNAME = DEPTGID;
data.BXSTATUS = "1";
}
var basicForm = this.formEdit.getForm();
this.formEdit.getForm().setValues(data);
this.formSum.getForm().setValues(data);
this.SetAmount();
this.SetDX();
//
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();
}
//
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
}); //request over
if (this.OpStatus == 'edit') {
//this.formEdit.getForm().findField('BXGID').setDisabled(false);
var BXGID = this.editRecord.get('BXGID');
var _this = this;
this.storeBaoXiao2Body.load({ params: { condition: "BXGID='" + BXGID + "' " }
, callback: function (options, success, response) {
_this.SetAmount();
_this.SetDX();
}
});
this.storePayBody.load({ params: { BXGID: BXGID} });
this.storeCHEQUENUM.load({ params: { DEPTID: DEPTGID, BXGID: BXGID} });
} else
this.storeCHEQUENUM.load({ params: { DEPTID: DEPTGID, BXGID: ""} });
}, // end LoadDate
SetAmount: function () {
var RMBAMOUNT = 0;
var USDAMOUNT = 0;
var OTHERAMOUNT = 0;
for (var i = 0; i < this.storeBaoXiao2Body.getCount(); i += 1) {
var Amount = this.storeBaoXiao2Body.getAt(i).get("SETTLEMENT");
if (typeof (Amount) == "undefined") {
return;
}
var CURRENCY = this.storeBaoXiao2Body.getAt(i).get("CURRENCY");
if (CURRENCY == "RMB") {
RMBAMOUNT = Add(RMBAMOUNT, Amount);
} else
if (CURRENCY == "USD") {
USDAMOUNT = Add(USDAMOUNT, Amount);
} else if (CURRENCY == "" || typeof (CURRENCY) == "undefined") {
} else {
OTHERAMOUNT = Add(OTHERAMOUNT, Amount);
}
}
Ext.getCmp("RMBAMOUNT").setValue(RMBAMOUNT + "");
Ext.getCmp("USDAMOUNT").setValue(USDAMOUNT + "");
Ext.getCmp("OTHERAMOUNT").setValue(OTHERAMOUNT + "");
},
SetDX: function () {
var data = this.formSum.getForm().getValues();
Ext.getCmp("HJRMBDX").setValue(formatRMB(data.RMBAMOUNT));
Ext.getCmp("HJUSDDX").setValue(formatUSD(data.USDAMOUNT));
Ext.getCmp("HJOTHERDX").setValue(formatRMB(data.OTHERAMOUNT));
},
//#region 生成凭证
onAddCwVouchers: function (button, event) {
var strGids = this.editRecord.get('BXGID');
if (strGids == "") {
Ext.Msg.show({ title: '提示', msg: '请先保存单据!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
//
if (strGids.trim() != "") {
Ext.Ajax.request({
waitMsg: '正在预读数据,请稍候...',
url: '/MvcShipping/MsCwVouchersGlBaoxiao2/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/MsCwVouchersGlBaoxiao2/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
});