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/OA/Viewsjs/Baoxiao2/BaoxiaoNewEdit.js

4483 lines
161 KiB
JavaScript

2 years ago
///<reference path="../../../../Views/../TruckMng/Scripts/vswd-ext_2.0.2.js" />
Ext.namespace('DsTruck');
var C_cargoinfo_id = "";
var HTHCount = 0;
DsTruck.Chfee_managementEdit = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.DsTruck.Chfee_managementEdit.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);
function getSaved() {
var feedirty = DsTruck.GetDirty(panelEdit.storeBaoXiao2Body, panelEdit.storeBaoXiao2BodyDel);
if (panelEdit.formEdit.getForm().isDirty() == true) {
return true;
}
else return false;
}
Ext.extend(DsTruck.Chfee_managementEdit, Ext.Panel, {
2 years ago
PageSize: 30,
2 years ago
parentWin: null,
OpStatus: 'add',
StoreList: null,
editRecord: null,
audittype:'',
BXSTATUS: 1,
// parentfunction: null,
_First: true,
VISIBLERANGE: 0,
OPERATERANGE: 0,
WorkFlowName: "",
WorkFlowID: "",
isVOUALLNO: 0,
initUIComponents: function () {
this.feeSerialNo = 0;
this.feeBodyDel = [];
this.feeBodyUnUnion = [];
this.PayBodyDel = [];
this.formname = "BaoxiaoEdit2";
this.formname_结算方式 = "报销管理2_结算方式";
WorkFlowName = 'BaoxiaoMod';
this.JKGID = '';
this.JKCURR = 'RMB';
this.selectJK = null;
_thisBaoXiao = this;
//#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.comboxMAKETIMEUPPER = Ext.create('DsExt.ux.RefTableCombox', {
//fieldLabel: '业务编号',
forceSelection: true,
store: this.storeBS,
name: 'BSNO',
valueField: 'BSNO',
displayField: 'MBLNO'
});
this.storeBS2 = Ext.create('DsExt.ux.RefTableStore', {
model: 'BSmb',
proxy: { url: '/OA/Baoxiao/GetBSNO' }
});
this.storeBS2.load({ params: { COMPANYID: COMPANYID } });
this.comboxMBLNO = Ext.create('DsExt.ux.RefTableCombox', {
//fieldLabel: '业务编号',
forceSelection: true,
store: this.storeBS,
name: 'BSNO',
valueField: 'BSNO',
displayField: 'MBLNO',
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' }
});
this.storeJKTYPE = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeJKTYPE.load({ params: { enumTypeId: 36 } });
this.comboxJKTYPE = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '借款方式',
forceSelection: true,
store: this.storeJKTYPE,
name: 'JKTYPE',
//readOnly: true,
id: "JKTYPE"
});
this.storeREASON = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeREASON.load({ params: { enumTypeId: 96018 } });
this.comboxREASON = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '借款类型',
store: this.storeREASON,
forceSelection: true,
name: 'JKREASON'
});
this.storeSaleCompany = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsCompanysEntity',
proxy: { url: '/MvcShipping/MsCompanys/GetNoPicDataList' }
});
this.storeSaleCompany.load({ params: { condition: "" } });
this.comboxSaleCompany = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '所属分部', //'委托分公司',
store: this.storeSaleCompany,
forceSelection: true,
name: 'SALECORPID',
valueField: 'GID',
displayField: 'NAME'
});
//#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
, {//container_1
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxJKTYPE, this.comboxREASON, this.comboxSaleCompany, {
fieldLabel: '交接单号',
flex: 0.5,
readOnly:true,
name: 'JJNO'
}, {
fieldLabel: '交接时间',
flex: 0.5,
readOnly: true,
name: 'JJNDATE'
}
]
} //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: '审核人',
// allowBlank: false,
readOnly: true, flex: 1,
name: 'AUDITOR'
}, {
fieldLabel: '审核时间',
// allowBlank: false,
readOnly: true, flex: 1,
name: 'AUDITTIME'
}, {
fieldLabel: '总账凭证号',
readOnly: true,
xtype: 'textfield',
name: 'VOUALLNO'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
{
fieldLabel: '备注',
name: 'REMARK',
flex: 2
}]
}
]
}]
});
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: [ { xtype: 'hiddenfield', flex: 2 }
]
}
]
}]
});
//////////////////////////////////
//#region 明细 <<<< 收支费用明细 >>>>
//
//#region 参照
this.comboxAccitems = Ext.create('DsExt.ux.RefTableCombox', {
forceSelection: true,
store: this.storeAccitems,
name: 'FEENAME',
valueField: 'ACCID',
displayField: 'ACCIDNAME'
});
2 years ago
2 years ago
this.storeFeeNameRef = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsTruckMng.ux.FeeTypeRefModel',
2 years ago
proxy: { url: '/MvcShipping/MsChFee/GetFeeTypeRefListNew' }
2 years ago
});
2 years ago
this.storeFeeNameRef.load({ params: { condition: "" } });
this.comboxFeeNameRef = Ext.create('DsExt.ux.DCombox', {
2 years ago
store: this.storeFeeNameRef,
forceSelection: true,
2 years ago
minChars: 1,
matchFieldWidth: false,
//queryParam: 'Name',
forceSelection: true,
lazyRender: false,
2 years ago
name: 'FeeName',
valueField: 'Name',
displayField: 'CodeAndName'
});
this.storeCustomerNameRef = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsTruckMng.ux.CustomRefModel',
2 years ago
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListRm' }
2 years ago
});
this.storeCustomerNameRef.load({ params: { condition: ""} });
this.comboxCustomerNameRef = Ext.create('DsExt.ux.RefTableCombox', {
forceSelection: true,
2 years ago
queryMode: 'remote',
minChars: 1,
queryParam: 'CODENAME',
lazyRender: false,
2 years ago
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.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: '/OA/Baoxiao2/GetBaoXiaoZCBody',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//表格
this.cellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
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: 'CUSTOMERNAME',
header: '客户名称',
width: 100
}, {
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,
dataIndex: 'TAXRATE',
header: '税率', //'税率',
editor: {
xtype: 'numberfield',
keyNavEnabled: false,
selectOnFocus: true,
hideTrigger: true,
mouseWheelEnabled: false,
enableKeyEvents: 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;
},
align: 'right',
width: 60
},
{
sortable: true,
dataIndex: 'TAX',
header: '税额',
width: 100,
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: 'NOTAXAMOUNT',
header: '不含税金额',
width: 100,
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, //hidden: true,
dataIndex: 'MBLNO',
header: '主提单号',
width: 100,
}, {
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,
plugins: [this.cellEditing],
selModel: this.CheckBoxModel,
selType: 'cellmodel',
tbar: [
{
text: '增加费用', id: "add1",
tooltip: '增加费用',
iconCls: "btnadddetail",
handler: function (button, event) {
this.onAddFeeClick(button, event);
},
scope: this
}, {
text: '删除费用', id: "del1",
tooltip: '删除费用',
iconCls: "btndeletedetail",
handler: function (button, event) {
this.onDelClick(button, event);
},
scope: this
}, {
text: "保存列表样式",
id: "btnSaveTable",
handler: function (button, event) {
//this.column = DsTruck.SaveGridPanel(GID, this.formname, this.gridList.columns, this.column, 1, true);
var tempcolumns = this.formFeeBody.columns;
DsTruck.SaveGridPanel(USERID, this.formname, tempcolumns, this.girdcolums, 1, true);
},
scope: this
}],
columns: this.girdcolums
});
this.formFeeBody.on('edit', function (editor, e, eOpts) {
this.JieKuan2AfterEdit(editor, e, eOpts);
}, this);
/////////////以下部分为获取存储的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 明细<<<< 收支费用明细 >>>>结束
this.storeAddList = Ext.create('Ext.data.Store', {
model: 'Jiekuanmb',
remoteSort: false,
pageSize: this.PageSize,
proxy: {
type: 'ajax',
url: '/OA/Jiekuan2/GetDataList',
reader: {
idProperty: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.BXCB = Ext.create('Ext.selection.CheckboxModel', { checkOnly: true });
this.Addcolumn = [{
sortable: true,
dataIndex: '', id: "",
header: '',
width: 80
}, /*{
sortable: true, hidden: true,
dataIndex: 'GID',
header: 'GID',
width: 80
},*/
{
sortable: true, hidden: true,
dataIndex: 'ENTEROPERATOR',
header: 'ENTEROPERATOR',
width: 80
}, {
sortable: true, hidden: true,
dataIndex: 'BSNO',
header: 'BSNO',
width: 120
}, {
sortable: true,
dataIndex: 'GID',
header: '借款单号',
width: 140
}, {
sortable: true,
dataIndex: 'OP',
header: '借款人',
width: 80
}, {
sortable: true,
dataIndex: 'REASON',
header: '借款类型',
width: 80
}, {
sortable: true,
dataIndex: 'CURRENCY',
header: '币别',
width: 80
}, {
sortable: true,
dataIndex: 'AMOUNT',
header: '借款金额',
width: 80
},
{
sortable: true,
dataIndex: 'ENTERDATE',
header: '借款时间',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'COMPANYID',
header: 'COMPANYID',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'DEPTID',
header: 'DEPTID',
width: 80
},
{
sortable: true,
dataIndex: 'DEPTNAME',
header: '部门',
width: 80
},
{
sortable: true,
dataIndex: 'RMBAMOUNT',
header: 'RMB金额',
width: 80,
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: 'USDAMOUNT',
header: 'USD金额',
width: 80,
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: 'OTHERAMOUNT',
header: '其他金额',
width: 80,
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: 'ISDELETE',
header: 'ISDELETE',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'DELETEUSER',
header: 'DELETEUSER',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'DELETETIME',
header: 'DELETETIME',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'JKSTATUS', id: "JKSTATUS",
header: 'JKSTATUS',
width: 80
}, {
sortable: true,
dataIndex: 'CHEQUENO',
header: '支票号',
width: 80
}, {
sortable: true,
dataIndex: 'JKSTATUS_REF', id: "JKSTATUS_REF",
header: '借款状态',
width: 80
}, {
sortable: true, hidden: true,
dataIndex: 'REMAIN', id: "REMAIN",
header: 'REMAIN',
width: 80
}, {
sortable: true,
dataIndex: 'RMBAMOUNT_SETTLEMENT',
header: 'RMB核销金额',
width: 80,
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: 'USDAMOUNT_SETTLEMENT',
header: 'USD核销金额',
width: 80,
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: 'OTHERAMOUNT_SETTLEMENT',
header: '其他核销金额',
width: 80,
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: 'REMARK',
header: '借款理由',
width: 200
},
{
sortable: true,
dataIndex: 'EXREPAYDATE',
header: '预计还款日',
width: 80
},
{
sortable: true,
dataIndex: 'SETTINFO',
header: '核销情况',
width: 200
}];
//定义Grid
this.gridAddList = new Ext.grid.GridPanel({
store: this.storeAddList,
enableHdMenu: false,
region: 'west',
split: true,
width: 860,
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
// stripeRows: true,
viewConfig: {
enableTextSelection: true
},
// stateful: true,
selModel: this.BXCB,
selType: 'cellmodel',
tbar: [
{
text: '增加至报销单', id: "add4",
tooltip: '增加明细',
iconCls: "btnadddetail",
handler: function (button, event) {
this.onAddBillClick(button, event);
},
scope: this
}],
columns: [new Ext.grid.RowNumberer()],
bbar: [Ext.create('Ext.PagingToolbar', {
store: this.storeList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
2 years ago
}), this.Pagenum]
2 years ago
});
/////////////以下部分为获取存储的gridpanel显示样式
this.Addcolumn = DsTruck.GetGridPanel(USERID, this.formname, this.Addcolumn, 1, true);
//使用者id表名 中间column数组跳过一开始的几列
this.gridAddList.reconfigure(this.storeAddList, this.Addcolumn);
this.gridAddList.columns[0] = new Ext.grid.RowNumberer();
//#region 明细 <<<< 待添加费用明细 >>>>
this.storeUser = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsTruckMng.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' }
});
this.storeUser.load({ params: { condition: ""} });
this.comboxUser = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '借款人',
forceSelection: true,
store: this.storeUser,
name: 'S_Enter', id: "S_Enter",
valueField: 'GID',
displayField: 'CodeAndName',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
2 years ago
this.storeJKTYPE2 = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeJKTYPE2.load({ params: { enumTypeId: 36 } });
this.comboxJKTYPE2 = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '借款方式',
forceSelection: true,
store: this.storeJKTYPE2,
name: 'JKTYPE',
//readOnly: true,
id: "JKTYPE2"
});
2 years ago
//数据集
this.storeBaoXiaoAddBody = Ext.create('Ext.data.Store', {
model: 'JieKuan2Bodymb',
remoteSort: false,
pruneModifiedRecords: true,
proxy: {
type: 'ajax',
url: '/OA/Jiekuan2/GetJieKuanZCBody',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//表格
this.AddCBM = Ext.create('Ext.selection.CheckboxModel');
this.cellFeeEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
2 years ago
this.Pagenum = Ext.create('Ext.form.field.Number', {
name: 'bottles',
fieldLabel: '每页记录数',//每页记录数
labelAlign: 'right',
value: this.PageSize,
maxValue: 100000,
width: 180,
minValue: 0,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
2 years ago
this.formAddBody = new Ext.grid.GridPanel({
store: this.storeBaoXiaoAddBody,
enableHdMenu: false,
region: 'center',
//title: '待添加费用明细',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
plugins: [this.cellFeeEditing],
selModel: this.AddCBM,
selType: 'cellmodel',
tbar: [{
text: '增加至报销单', id: "add3",
tooltip: '增加明细',
iconCls: "btnadddetail",
handler: function (button, event) {
this.onAddClick(button, event);
},
scope: this
},{
text: '增加借款明细',
tooltip: '增加借款明细',
iconCls: "btnadddetail",
id: 'addfee',
disabled: true,
handler: function (button, event) {
this.onAddJKFeeClick(button, event);
},
scope: this
}, '-', {
text: '删除借款明细',
tooltip: '删除借款明细',
iconCls: "btndeletedetail",
id: 'delfee',
disabled: true,
handler: function (button, event) {
this.onDelJKFeeClick(button, event);
},
scope: this
}, '-', {
text: '保存借款费用',
tooltip:'', //保存应收费用',
iconCls: "btnsave",
id: 'postfee',
disabled: true,
handler: function (button, event) {
this.onPostJKFeeClick(button, event);
},
scope: this
}],
columns: [
new Ext.grid.RowNumberer()
,
{
sortable: true, hidden: true,
dataIndex: 'GID',
header: 'GID',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'JKGID',
header: 'JKGID',
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,
dataIndex: 'CUSTOMERNAME',
header: '客户名称',
width: 120,
editor: this.comboxCustomerNameRef
},
{
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: '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,
dataIndex: 'TAXRATE',
header: '税率', //'税率',
editor: {
xtype: 'numberfield',
keyNavEnabled: false,
selectOnFocus: true,
hideTrigger: true,
mouseWheelEnabled: false,
enableKeyEvents: 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;
},
align: 'right',
width: 60
},
{
sortable: true,
dataIndex: 'TAX',
header: '税额',
width: 100,
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: 'NOTAXAMOUNT',
header: '不含税金额',
width: 100,
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: 'SETTLEMENT',
header: '已核销金额',
width: 100,
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: 'MODIFIEDUSER',
header: 'MODIFIEDUSER',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'MODIFIEDTIME',
header: 'MODIFIEDTIME',
width: 80
},
{
sortable: true,
dataIndex: 'BXGID',
header: '报销单号',
width: 80
},
{
sortable: true,
dataIndex: 'SALESNO',
header: '相关编号',
width: 120,
editor: {
xtype: 'textfield', //numberfield
selectOnFocus: true
}
}, {
sortable: true,
dataIndex: 'PaymentGID',
header: '业务编号(提单号)',
//hidden: true,
width: 150,
renderer: function (value, p, record) {
if (value == null || value == '') return '';
else return record.data.MBLNO;
},
editor: this.comboxMAKETIMEUPPER
}]
});
this.formAddBody.on('edit', function (editor, e, eOpts) {
this.JieKuan2AfterEdit(editor, e, eOpts);
}, this);
this.storeOpCode3 = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserLinkRefListRm' }
});
this.storeOpCode3.load();
//操 作
this.comboxOP = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '借款人', //'操 作',
store: this.storeOpCode3,
forceSelection: true,
queryMode: 'remote',
minChars: 0,
queryParam: 'CODENAME',
name: 'OP',
valueField: 'UserName',
displayField: 'CodeAndName',
value: SHOWNAME
});
this.formSearch = Ext.widget('form', {
frame: true,
region: 'north',
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 70,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: 'PARAMVALUE',
name: 'PARAMVALUE', value: '0', hidden: true
2 years ago
}, this.comboxOP, this.comboxJKTYPE2,{
2 years ago
fieldLabel:'借款单号',
name: 'CustomNo',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel:'借款日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ExpDateBgn',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '借款日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ExpDateEnd',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
xtype: 'button',
width: 45,
text: "",
iconCls: "btnreset",
handler: function (button, event) {
this.onClearSql(button, event);
},
scope: this
}, {
xtype: 'button',
width: 45,
text: "",
iconCls: "btnmore",
handler: function (button, event) {
var sql = this.getCondition();
var winAccess = new Shipping.DsQuery({
});
winAccess.StoreList = this.storeList;
winAccess.formname = this.formname;
winAccess.condition = sql;
winAccess.show();
return;
},
scope: this
}, {
xtype: 'button',
width: 90,
text:'查询',
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick();
},
scope: this
}
]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
//#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',
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'keyup': {
fn: function (_field, e) {
if (e.getKey() == 13) {
this.onRefreshClick();
}
},
scope: this
}
}
});
//数据集
this.storePayBody = Ext.create('Ext.data.Store', {
model: 'BXPaymb',
remoteSort: false,
pruneModifiedRecords: true,
proxy: {
type: 'ajax',
url: '/OA/Baoxiao2/GetPayList',
reader: {
id: 'gid',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//表格
this.cellEditing_S = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.CheckBoxModel_S = Ext.create('Ext.selection.CheckboxModel');
this.PayColumns = [
{
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
},
width: 100,
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: '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
}];
_this = this;
this.formPayBody = new Ext.grid.GridPanel({
layout: 'border',
store: this.storePayBody,
enableHdMenu: false,
region: 'center',
//bodyStyle: 'background:#FFF',
trackResetOnLoad: true,
//split:true,
//height: 160,
//title: '支付明细',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
plugins: [this.cellEditing_S],
selModel: this.CheckBoxModel_S,
selType: 'cellmodel',
tbar: [{
text: '增加明细',
tooltip: '增加明细', id: "add2",
iconCls: "btnadddetail",
handler: function (button, event) {
this.onAddPayClick(button, event);
},
scope: this
}, {
text: '删除明细',
tooltip: '删除明细', id: "del2",
iconCls: "btndeletedetail",
handler: function (button, event) {
this.onDelPayClick(button, event);
},
scope: this
}, '-', {
id: "btnSave",
text: '保存更改',
tooltip: '仅保存结算方式',
iconCls: "btnsave",
handler: function (button, event) {
this.SaveSTL();
//alert(USERID);
},
scope: this
}, '-', {
text: "保存列表样式",
id: "btnsavelist",
handler: function (button, event) {
var tempcolumns = this.formPayBody.columns;
DsTruck.SaveGridPanel(USERID, this.formname_结算方式, tempcolumns);
},
scope: this
}],
columns: this.PayColumns
});
this.PayColumns = DsTruck.GetGridPanel(USERID, this.formname_结算方式, this.PayColumns);
//使用者id表名 中间column数组跳过一开始的几列
this.formPayBody.reconfigure(this.storePayBody, this.PayColumns);
//#endregion 支付情况(贷方明细)//////////////////////end
//公共按钮Toolbar:panelBtn
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [
{
id: "savebtn",
text: "保存",
handler: function (button, event) {
this.Save('0');
},
scope: this
}, {
id: "saveandclosebtn",
text: "保存并关闭",
handler: function (button, event) {
this.Save('1');
},
scope: this
},
{
id: "saveandnewbtn",
text: "保存并新建",
handler: function (button, event) {
this.Save('2');
},
scope: this
}, '-', {
text: "导出Excel",
id: "btnExportExcel",
iconCls: 'btnexportexcel',
handler: function (button, event) {
this.onExportClick(button, event);
},
scope: this
}, '-',
{
// id: "saveandclose",
text: "提交审核", id: "Submit",
handler: function (button, event) {
this.onSubmitAuditClick();
},
scope: this
}, '-',
{
// id: "saveandclose",
text: "撤销提交", id: "SubmitBack",
handler: function (button, event) {
this.onSubmitAuditBackClick();
},
scope: this
}, '-',
{
// id: "saveandclose",
text: "审核通过", id: "Pass",
handler: function (button, event) {
this.onAuditPassClick();
},
scope: this
},
{
// id: "saveandclose",
text: "驳回提交", id: "Refuse",
handler: function (button, event) {
this.onAuditRefuseClick();
},
scope: this
},
{
id: "printjk",
text: "打印",
handler: function (button, event) {
this.DoPrint();
},
scope: this
}, '-', {
text: "生成总账凭证",
id: "btnAddCwVouchers",
iconCls: "btnadd",
handler: function (button, event) {
this.onAddCwVouchers();
},
scope: this
}, '-',
{
// id: "saveandclose",
text: "关闭",
handler: function (button, event) {
window.close();
},
scope: this
}
]
}); //end 按钮Toolbar
//布局
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 30,
items: [this.panelBtn]
});
//#region 附件上传
this.storeISOPEN = Ext.create('Ext.data.Store', {
fields: ['FSTATUS', 'NAME']
});
this.storeISOPEN.add({ "FSTATUS": "1", "NAME": "公开" });
this.storeISOPEN.add({ "FSTATUS": "0", "NAME": "不公开" });
this.comboxISOPEN = Ext.create('DsExt.ux.RefTableCombox', {
// fieldLabel: '海运费',
store: this.storeISOPEN,
valueField: 'FSTATUS',
displayField: 'NAME',
// flex: 0.7,
// labelWidth: 55,
forceSelection: true,
name: 'ISPUBLIC'
});
this.storeDocList = Ext.create('Ext.data.Store', {
model: 'ReceiptDocmb',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/Import/ReceiptDoc/GetDocList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//明细表表格
this.DocListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.DocCM = Ext.create('Ext.selection.CheckboxModel');
this.gridDocList = new Ext.grid.GridPanel({
store: this.storeDocList,
enableHdMenu: false,
region: 'center',
// width: 350,
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
plugins: [this.DocListCellEditing],
selModel: this.DocCM,
selType: 'cellmodel',
tbar: [{
text: '删除',
tooltip: '删除',
id: 'delinv',
iconCls: "btndeletedetail",
handler: function (button, event) {
this.onDelFileClick(button, event);
},
scope: this
}, '-', {
text: '上传附件',
tooltip: '上传附件',
iconCls: "btnadddetail",
id:'addinv',
handler: function (button, event) {
this.onUpLoadFileClick(button, event);
},
scope: this
}, '-', {
text: '保存',
tooltip: '保存',
id: 'postinv',
// iconCls: "btnadddetail",
handler: function (button, event) {
this.onPostFileClick(button, event);
},
scope: this
}],
columns: [{
sortable: true, hidden: true,
dataIndex: 'GID',
header: 'GID',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'R_GID',
header: 'R_GID',
width: 80
}, {
sortable: true,
dataIndex: 'BSNO',
header: '业务编号(提单号)',
//hidden: true,
width: 150,
renderer: function (value, p, record) {
if (value == null || value == '') return '';
else return record.data.MBLNO;
},
editor: this.comboxMBLNO
},
{
sortable: true,
dataIndex: 'URL',
header: '文件名',
width: 200,
renderer: function (value, p, record) {
return '<a href="' + record.data.Driect_URL + '" target="_blank" style=' + '"text-decoration:none"' + ' >' + value + '</a>';
}
},
{
sortable: true,
dataIndex: 'RECEIPTTYPE',
header: '附件类型',
width: 135
},
{
sortable: true, hidden: true,
dataIndex: 'Driect_URL',
header: 'Driect_URL',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'MODIFIEDUSER',
header: 'MODIFIEDUSER',
width: 80
},
{
sortable: true,
dataIndex: 'MODIFIEDUSERRef',
header: '上传人',
width: 80
},
{
sortable: true,
dataIndex: 'MODIFIEDTIME',
header: '上传时间',
width: 135
},
{
sortable: true,
dataIndex: 'DOCUMENTATTACHEDCODE',
header: '随附单证代码', //需求编号SR2017081100003
width: 120
},
{
sortable: true,
dataIndex: 'DOCUMENTATTACHEDNO',
header: '随附单证编号', //需求编号SR2017081100003
width: 120
}, {
sortable: true,
dataIndex: 'ISPUBLIC',
header: '是否公开',
editor: this.comboxISOPEN,
width: 80,
renderer: function (value, cellmeta) {
if (value == '1') {
return "公开";
} else return "不公开";
}
}
]
});
this.storeDocList.on('beforeload', function (store) {
var BXGID = this.editRecord.get('BXGID');
var condition2 = " R_GID='" + BXGID + "' ";
Ext.apply(store.proxy.extraParams, { condition: condition2 });
}, this);
this.gridDocList.on('edit', function (editor, e, eOpts) {
this.DOCAfterEdit(editor, e, eOpts);
}, this);
//#endregion附件上传
//#region 增加附件上传tab
this.page_1 = new Ext.Panel({
id: "page_1",
title:'费用明细', //申请明细
autoScroll: true,
layout: "border",
region: 'center',
//closable:true,
items: [this.formFeeBody]
});
this.page_2 = new Ext.Panel({
id: "page_2",
title:'发票附件', //附件上传
autoScroll: true,
layout: "border",
region: 'center',
//closable:true,
items: [this.gridDocList]
});
this.panelPayBody = new Ext.Panel({
layout: "border",
region: 'center',
title: '结算方式',
split: true,
height: 220,
margin: '1 1',
items: [this.formPayBody]
});
this.MainFeeTab = new Ext.tab.Panel({
layout: "border",
region: 'center',
//region: "north", split: true,
items: [
this.page_1
, this.page_2,
this.panelPayBody
]
});
//#endregion
this.panelFee = new Ext.Panel({
layout: "border",
region: 'north',
margin: '1 1',
height: 450,
split: true,
items: [this.panelTop, this.formEdit, this.MainFeeTab]
});
this.panelAddBodydetail = new Ext.Panel({
layout: "border",
region: 'center',
margin: '2 2',
items: [this.formAddBody]
});
this.panelAddBody = new Ext.Panel({
layout: "border",
region: 'center',
split: true,
//height: 300,
margin: '1 1',
items: [this.gridAddList, this.formAddBody]
});
this.paneladd = new Ext.Panel({
title: '待添加借款单',
layout: "border",
// region: 'south',
region: "center",
// height: 420,
items: [
this.formSearch, this.panelAddBody
]
});
Ext.apply(this, {
items: [this.panelTop, this.panelFee, this.paneladd]
});
parentWin = window.parent.opener;
this.InitData();
var isloadfee = true;
this.gridAddList.getSelectionModel().on('select', function (model, record, index) {
if (!isloadfee) return;
this.selectJK = record.data;
var bsno = record.data.GID;
this.JKGID = bsno;
this.JKCURR = record.data.CURRENCY;
var REASON = record.data.REASON;
if (REASON == '备用金' || REASON == '现金') {
this.SetFeeBtn(true);
} else {
this.SetFeeBtn(false);
}
var sql = "";
sql = " (JKGID='" + bsno + "' or CARGO_GID='" + bsno + "') AND ISNULL(BXGID,'')='' ";
isloadfee = false;
this.storeBaoXiaoAddBody.load({
params: { condition: sql },
callback: function (r, options, success) {
if (success) {
isloadfee = true;
}
}
});
// this.onSelectFee(button, event);
}, this);
this.gridAddList.on({
selectionchange: function (sm, selections) {
if (selections.length == 0) {
this.selectJK = null;
return;
}
}
});
//集中绑定事件
this.formFeeBody.on('edit', function (editor, e, eOpts) {
this.FeeAfterEdit(editor, e, eOpts);
}, this);
this.formPayBody.on('edit', function (editor, e, eOpts) {
this.PayAfterEdit(editor, e, eOpts);
}, this);
this.cellEditing.on('beforeedit', function (editor, e) {
//Ext.getCmp("zongshu").setText("1234");
return this.FeeBeforeEdit(editor, e);
}, this);
this.cellEditing_S.on('beforeedit', function (editor, e) {
//Ext.getCmp("zongshu").setText("1234");
return this.PayBeforeEdit(editor, e);
}, this);
this.cellFeeEditing.on('beforeedit', function (editor, e) {
return this.cellFeeEditingBeforeEdit(editor, e);
}, this);
//#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: '/OA/Baoxiao2/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
parentfunction: function (button, event) {
var ret1 = window.parent.opener.OprationSwap();
// alert(this.First);
ret1[3]();
},
onAddFeeClick: function (button, event, type) {
var store = null;
store = this.storeBaoXiao2Body;
var record = null;
record = Ext.create('BaoXiao2Bodymb', {
GID: NewGuid(),
//BsNo: '',
JKGID: '',
BXGID: '',
FEESTATUS: 1,
FEESTATUS_REF: '录入状态',
FEETYPE: 2,
FEETYPE_REF: '',
FEENAME: '',
//FeeName_Ref: '',
//FeeDescription: '',
//CustomerType: '',
//CustomerName: '',
//CustomerName_Ref: '',
//Unit: '单票',
//UnitPrice: 0,
//Quantity: 1,
AMOUNT: 0,
CURRENCY: 'RMB',
//ExChangerate: 1,
//Reason: '',
Remark: '',
//Commissionrate: 0,
SETTLEMENT: 0,
/*Invoice: 0,
OrderAmount: 0,
OrderInvoice: 0,
SubmitDate: null,
Auditoperator: '',
AuditDate: null,*/
MODIFIEDUSER: GetCookie_UserId(),
MODIFIEDTIME: Ext.getCmp("CREATEDATE").getRawValue(),
JKTYPE_REF: '',
INVOICENUM: ''
/*,
IsOpen: "0" ,
IsAdvancedpay: "0",
Sort: "0",
IsInvoice: "0",
FeeFrt: 'pp',
IsCrmOrderFee: "0",
AuditStatus: 0,
InvoiceNum: '',
ChequeNum: '',
TAX: 0,
TAXRATE: 0,
NOTAXAMOUNT: 0,
CHEQUENUM: ""*/
});
store.add(record);
cellediting = this.cellEditing;
var n = store.getCount();
cellediting.startEditByPosition({ row: n - 1, column: 2 });
},
onUnUnionClick: function (button, event) {
var selectedRecords = this.formFeeBody.selModel.getSelection();
Ext.MessageBox.confirm('提示', '确定解除关联吗?', function (btn) {
if (btn == 'yes') {
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (rec.BXGID != "" || rec.BXGID != "*") //如果是新增但没有保存的数据,没有必要提交到后台
{
this.feeBodyUnUnion.push(rec);
}
this.storeBaoXiao2Body.remove(selectedRecords[i]);
}
}
}, this);
//aftereditform();
var Amount_ALL = 0;
for (var i = 0; i < this.storeBaoXiao2Body.getCount(); i += 1) {
Amount_ALL = Add(Amount_ALL, parseFloat(this.storeBaoXiao2Body.getAt(i).get("Amount")));
}
Ext.getCmp("AMOUNT_ALL").setValue(Amount_ALL + "");
},
onDelFeeClick: function (button, event) {
var selectedRecords = this.formFeeBody.selModel.getSelection();
Ext.MessageBox.confirm('提示', '确定删除记录吗?', function (btn) {
if (btn == 'yes') {
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (rec.BXGID != "" || rec.BXGID != "*") //如果是新增但没有保存的数据,没有必要提交到后台
{
this.feeBodyDel.push(rec);
}
this.storeBaoXiao2Body.remove(selectedRecords[i]);
}
}
}, this);
//aftereditform();
var Amount_ALL = 0;
for (var i = 0; i < this.storeBaoXiao2Body.getCount(); i += 1) {
Amount_ALL = Add(Amount_ALL, parseFloat(this.storeBaoXiao2Body.getAt(i).get("Amount")));
}
Ext.getCmp("AMOUNT_ALL").setValue(Amount_ALL + "");
},
onAddPayClick: function (button, event, type) {
var store = null;
store = this.storePayBody;
var record = null;
record = Ext.create('BXPaymb', {
GID: NewGuid(),
BXGID: '',
SETTLEMENTTYPE: "0",
TICKETNO: "",
AMOUNT: "0",
REMARK: "",
FINANCIALCODE: "",
OPERATEDATE: ""
});
store.add(record);
cellediting = this.cellEditing_S;
var n = store.getCount();
cellediting.startEditByPosition({ row: n - 1, column: 2 });
},
onDelPayClick: function (button, event) {
var selectedRecords = this.formPayBody.selModel.getSelection();
Ext.MessageBox.confirm('提示', '确定删除记录吗?', function (btn) {
if (btn == 'yes') {
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (rec.BXGID != "" || rec.BXGID != "*") //如果是新增但没有保存的数据,没有必要提交到后台
{
this.PayBodyDel.push(rec);
}
this.storePayBody.remove(selectedRecords[i]);
}
}
}, this);
},
FeeAfterEdit: function (editor, e, eOpts) {
if (e.field == 'SETTLEMENT') {
var AMOUNT = parseFloat(e.record.get('SETTLEMENT'));
if (e.record.get('JKGID') == "" || typeof (e.record.get('JKGID')) == "undefined") {
e.record.set('AMOUNT', AMOUNT);
}
}
if (e.field == 'REASON') {
var records = DsStoreQueryBy(this.storeREASON, 'EnumValueName', e.value);
if (records.getCount() > 0) {
var BSdata = records.getAt(0).data;
e.record.set('JKTYPE_REF', BSdata.EnumValueName);
} else {
e.record.set('JKTYPE_REF', '');
}
}
this.SetAmount();
this.SetDX();
},
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));
},
PayAfterEdit: function (editor, e, eOpts) {
//需要自己实现里面的事件
if (COMPANYID == "" || DEPTGID == "") {
alert("登录信息不全,请退出重新登录");
returen;
}
if (e.field == 'SETTLEMENTTYPE') {
var BSrecords = DsStoreQueryBy(this.storeSETTLEMENTTYPE, 'EnumValueId', e.value);
if (BSrecords.getCount() > 0) {
var BSdata = BSrecords.getAt(0).data;
e.record.set('SETTLEMENTTYPE_REF', BSdata.EnumValueName);
} else {
e.record.set('SETTLEMENTTYPE_REF', '');
}
}
if (e.field == 'TICKETNO') {
var Amount_CHEQUE = 0;
for (var i = 0; i < this.storeBaoXiao2Body.getCount(); i += 1) {
var _thisCHEQUENUM = this.storeBaoXiao2Body.getAt(i).get("CHEQUENUM");
if (e.record.get('TICKETNO') == _thisCHEQUENUM) {
Amount_CHEQUE = Add(Amount_CHEQUE, parseFloat(this.storeBaoXiao2Body.getAt(i).get("Amount")));
}
e.record.set('AMOUNT', Amount_CHEQUE.toFixed(2));
}
}
},
FeeBeforeEdit: function (editor, e) {
var canedit = true;
var BXSTATUS = this.BXSTATUS;
var JKTYPE_REF = e.record.get('JKTYPE_REF');
var JKGID = e.record.get('JKGID');
if (BXSTATUS != "1" && BXSTATUS != "6") {
canedit = false;
alert("只有录入或驳回提交状态的报销单可以修改");
}
if (e.field == 'AMOUNT') {
if (JKTYPE_REF != "空白支票" && (JKGID != "" && typeof (JKGID) != "undefined")) {
canedit = false;
alert("只有[空白支票]的申请费用可以修改");
}
}
if (e.field == 'REASON' && JKGID != "") {
canedit = false;
alert("只有不来自借款的报销费用明细可以修改支付方式。");
}
return canedit;
},
PayBeforeEdit: function (editor, e) {
if (this.OpStatus == "add") {
var BXSTATUS = "1";
} else {
var BXSTATUS = this.editRecord.get('BXSTATUS');
}
/* this.VISIBLERANGE
this.OPERATERANGE 可操作;*/
//可操作为0则全都可见3为可提交/驳回,2为可审核/驳回1为只能看
if (this.OPERATERANGE == 0) {
canedit = true;
} else
if (this.OPERATERANGE == 1) {
canedit = false;
} else//chfeefeeStatus == 1 || chfeefeeStatus == 2 || chfeefeeStatus == 6
if (this.OPERATERANGE == 2) {
canedit = true;
} else
if (this.OPERATERANGE == 3) {
canedit = false;
} else
{ canedit = false; }
//alert(canedit);
return canedit;
},
onAddJKFeeClick: function (button, event) {
/*
if (this.OpStatus == 'add') {
this.Save('0');
this.onAddFeeClick(button, event);
}*/
function newID() {
var guid = "";
for (var i = 1; i <= 32; i++) {
var n = Math.floor(Math.random() * 16.0).toString(16);
guid += n;
if ((i == 8) || (i == 12) || (i == 16) || (i == 20))
guid += "-";
}
return guid.toUpperCase();
}
var store = null;
store = this.storeBaoXiaoAddBody;
//var newSerialno = this.GetHandleSerialNo(store, type);
var record = null;
record = Ext.create('JieKuan2Bodymb', {
GID: newID(),
JKGID:'*',
BXGID: '',
FEETYPE: '2',
FEETYPE_REF: '',
FEESTATUS: '1',
FEESTATUS_REF: '',
BSNO: '',
FEENAME: '',
CURRENCY: this.JKCURR,
AMOUNT: '0',
EXCHANGERATE:1,
SETTLEMENT: '0',
MODIFIEDUSER: USERID,
MODIFIEDTIME: currdate.format('yyyy-MM-dd hh:mm:ss'),
Remark: ''
});
//alert(Ext.getCmp("CREATEDATE").getRawValue());
store.add(record);
cellediting = this.cellEditing;
var n = store.getCount();
cellediting.startEditByPosition({ row: n - 1, column: 2 });
},
onDelJKFeeClick: function (button, event) {
var selectedRecords = this.formAddBody.selModel.getSelection();
Ext.MessageBox.confirm('提示', '确定删除记录吗?', function (btn) {
if (btn == 'yes') {
var bodyDrChFeeDatas = [];
var j = 0;
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (rec.GID != "" || rec.GID != "*") //如果是新增但没有保存的数据,没有必要提交到后台
{
bodyDrChFeeDatas.push(rec);
j = j + 1;
}else
this.storeBaoXiaoAddBody.remove(selectedRecords[i]);
}
if (j != 0) {
var jsonChFeeBody = ConvertRecordsToJsonAll(bodyDrChFeeDatas);
Ext.Msg.wait('正在保存数据...');
Ext.Ajax.request({
waitMsg: '正在保存数据...', //'正在保存数据...',
url: '/OA/Jiekuan2/DeleteDetail',
scope: this,
params: {
Jiekuan2Body: jsonChFeeBody
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
_thisBaoXiao.storeBaoXiaoAddBody.reload();
} 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
});
}
}
});
}
}
}, this);
//aftereditform();
},
onPostJKFeeClick: function (button, event) {
var bodyDrChFeeDatas = [];
for (i = 0; i < this.storeBaoXiaoAddBody.getCount(); i += 1) {
var memberyf = this.storeBaoXiaoAddBody.getAt(i);
bodyDrChFeeDatas.push(memberyf);
};
var jsonChFeeBody = ConvertRecordsToJsonAll(bodyDrChFeeDatas);
if (this.JKGID == null || this.JKGID == '') {
Ext.Msg.show({ title: Zi.LAN.FEE.ChuoWu, msg: '请先选择借款单!', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
Ext.Msg.wait('正在保存数据...');
Ext.Ajax.request({
waitMsg: '正在保存数据...', //'正在保存数据...',
url: '/OA/Jiekuan2/SaveDetail',
scope: this,
params: {
JKGID: this.JKGID,
Jiekuan2Body: jsonChFeeBody
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.storeBaoXiaoAddBody.reload();
} 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
});
}
}
});
},
cellFeeEditingBeforeEdit: function (editor, e) {
if (this.selectJK.REASON != '备用金'&&this.selectJK.REASON != '现金') {
Ext.Msg.show({ title: '提示', msg: '只有现金才可以添加修改费用!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
},
JieKuan2AfterEdit: function (editor, e, eOpts) {
//需要自己实现里面的事件
if (e.field == 'BSNO') {
var BSrecords = DsStoreQueryBy(this.storeBS, 'BSNO', e.value);
if (BSrecords.getCount() > 0) {
var BSdata = BSrecords.getAt(0).data;
e.record.set('MAKETIMEUPPER', BSdata.BSNO);
e.record.set('MBLNO', BSdata.MBLNO);
} else {
e.record.set('MAKETIMEUPPER', '');
e.record.set('MBLNO', '');
}
} else if (e.field == 'CURRENCY') {
var BSrecords = DsStoreQueryBy(this.StoreDateCurr, 'CURR', e.value);
if (BSrecords.getCount() > 0) {
var BSdata = BSrecords.getAt(0).data;
e.record.set('EXCHANGERATE', BSdata.DEFRATE);
} else {
e.record.set('EXCHANGERATE', 1);
}
} else if (e.field == 'FEENAME') {
var BSrecords = DsStoreQueryBy(this.storeFeeNameRef, 'Name', e.value);
if (BSrecords.getCount() > 0) {
var BSdata = BSrecords.getAt(0).data;
var Currency = BSdata.DefaultCurr;
if (Currency != '')
e.record.set('CURRENCY', Currency);
} else {
e.record.set('CURRENCY', 'RMB');
}
} else if (e.field == 'TAXRATE' || e.field == 'AMOUNT') {
var taxrate = e.record.data['TAXRATE'];
var amount = e.record.data['AMOUNT'];
if (amount != null) {
var taxrateb = Add(1, Div(taxrate, 100, 4), 4); //parseFloat(1 + parseFloat(taxrate.mul(0.01)));
if (amount > 0) {
var notaxamount = Div(amount, taxrateb);
e.record.set('NOTAXAMOUNT', notaxamount);
} else {
var notaxamount = Div(Math.abs(amount), taxrateb);
notaxamount = -notaxamount;
e.record.set('NOTAXAMOUNT', notaxamount);
}
var tax = Add(amount, -notaxamount); //parseFloat(notaxamount).mul(taxrate);
e.record.set('TAX', tax);
}
}
},
DOCAfterEdit: function (editor, e, eOpts) {
//需要自己实现里面的事件
if (e.field == 'BSNO') {
var BSrecords = DsStoreQueryBy(this.storeBS2, 'BSNO', e.value);
if (BSrecords.getCount() > 0) {
var BSdata = BSrecords.getAt(0).data;
e.record.set('MBLNO', BSdata.MBLNO);
} else {
e.record.set('MBLNO', '');
}
}
},
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.audittype = ret[3];
// this.parentfunction = ret[3];
}
if (this.audittype == 'AUDIT') {
Ext.getCmp("savebtn").setVisible(false);
Ext.getCmp("saveandclosebtn").setVisible(false);
Ext.getCmp("saveandnewbtn").setVisible(false);
//Ext.getCmp("btnadddetail").setVisible(false);
//Ext.getCmp("btndeletedetail").setVisible(false);
Ext.getCmp("add4").setVisible(false);
Ext.getCmp("addfee").setVisible(false);
Ext.getCmp("delfee").setVisible(false);
Ext.getCmp("postfee").setVisible(false);
Ext.getCmp("add2").setVisible(false);
Ext.getCmp("del2").setVisible(false);
Ext.getCmp("addinv").setVisible(false);
Ext.getCmp("delinv").setVisible(false);
Ext.getCmp("postinv").setVisible(false);
Ext.getCmp("printjk").setVisible(true);
Ext.getCmp("Submit").setVisible(false);
Ext.getCmp("SubmitBack").setVisible(false);
Ext.getCmp("Pass").setVisible(true);
Ext.getCmp("Refuse").setVisible(true);
} else {
Ext.getCmp("savebtn").setVisible(true);
Ext.getCmp("saveandclosebtn").setVisible(true);
Ext.getCmp("saveandnewbtn").setVisible(true);
//Ext.getCmp("btnadddetail").setVisible(true);
//Ext.getCmp("btndeletedetail").setVisible(true);
Ext.getCmp("add4").setVisible(true);
Ext.getCmp("addfee").setVisible(true);
Ext.getCmp("delfee").setVisible(true);
Ext.getCmp("postfee").setVisible(true);
Ext.getCmp("add2").setVisible(true);
Ext.getCmp("del2").setVisible(true);
Ext.getCmp("addinv").setVisible(true);
Ext.getCmp("delinv").setVisible(true);
Ext.getCmp("postinv").setVisible(true);
Ext.getCmp("printjk").setVisible(false);
Ext.getCmp("Submit").setVisible(true);
Ext.getCmp("SubmitBack").setVisible(true);
Ext.getCmp("Pass").setVisible(false);
Ext.getCmp("Refuse").setVisible(false);
}
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
//查询待添加的费用
onClearSql: function () {
var form = this.formSearch.getForm();
form.reset();
},
onRefreshClick: function (button, event) {
//if (this.editRecord != null) {
// this.editRecord.get('BXGID');
// }
this.selectJK = null;
this.storeBaoXiaoAddBody.removeAll();
var form = this.formSearch.getForm();
var sql = " jk.AMOUNT<>jk.STLAMOUNT AND jk.JKSTATUS=0 AND (EXISTS (select 1 from ch_fee f where f.JKGID=JK.GID AND isnull(F.BXGID,'')='' ) OR (JK.REASON='备用金' or JK.REASON='现金')) ";
var JKGID = form.findField('CustomNo').getValue();
sql = sql + getAndConSql(sql, JKGID, " JK.GID like '%" + JKGID + "%' ");
var OP = form.findField('OP').getValue();
sql = sql + getAndConSql(sql, OP, " JK.OP='" + OP + "' ");
2 years ago
var JKTYPE = form.findField('JKTYPE').getValue();
sql = sql + getAndConSql(sql, JKTYPE, " JK.JKTYPE='" + JKTYPE + "' ");
2 years ago
var expDateBgn = form.findField('ExpDateBgn').getRawValue();
sql = sql + getAndConSql(sql, expDateBgn, "JK.ENTERDATE >='" + expDateBgn + "'");
var expDateEnd = form.findField('ExpDateEnd').getRawValue();
sql = sql + getAndConSql(sql, expDateEnd, "JK.ENTERDATE <='" + expDateEnd + "'");
2 years ago
this.PageSize = this.Pagenum.getValue();
this.storeAddList.pageSize = this.PageSize;
2 years ago
this.storeAddList.load({
2 years ago
params: { start: 0, limit: this.PageSize,condition: sql },
2 years ago
waitMsg: "正在查询数据...",
scope: this,
callback: function (records, options, success) {
}
});
},
BaoXiaoSaveFn(type,button, event) {
//先保存以获取业务编号
var data = this.formEdit.getForm().getValues();
var data2 = this.formSum.getForm().getValues();
//BXGID = data.BXGID;
if (COMPANYID == "" || DEPTGID == "") {
alert("登录信息不全,请退出重新登录");
return;
}
var Feedatas = [];
for (var i = 0; i < this.storeBaoXiao2Body.getCount(); i += 1) {
var member = this.storeBaoXiao2Body.getAt(i);
Feedatas.push(member);
}
var FeeBody = ConvertRecordsToJson(Feedatas);
var FeeDelBody = ConvertRecordsToJsonAll(this.feeBodyDel);
var Paydatas = [];
for (var i = 0; i < this.storePayBody.getCount(); i += 1) {
var member = this.storePayBody.getAt(i);
Paydatas.push(member);
}
//支付明细
var PayBody = ConvertRecordsToJson(Paydatas);
var PayDelBody = ConvertRecordsToJsonAll(this.PayBodyDel);
var _this = this;
var returnData = "";
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/OA/Baoxiao2/Save',
scope: this,
async: false,
params: {
OpStatus: this.OpStatus,
data: Ext.JSON.encode(data),
data2: Ext.JSON.encode(data2),
FeeBody: FeeBody,
FeeDelBody: FeeDelBody,
PayBody: PayBody,
PayDelBody: PayDelBody
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
returnData = jsonresult.Data;
this.formEdit.getForm().setValues(returnData);
if (this.OpStatus == 'add') {
var arrNewRecords = this.StoreList.add(returnData);
this.editRecord = arrNewRecords[0];
// alert(editRecord.get('ContractNo'));
BXGID = this.editRecord.get('BXGID');
}
else if (this.OpStatus == 'edit') {
var editp = Ext.create('Baoxiaomb', returnData);
this.editRecord.fields.each(function (field) {
if (field.persist) {
name = field.name;
//alert(name + ' -- ' + editp.get(name));
if (name != 'BXGID')
this.editRecord.set(name, editp.get(name));
}
}, this);
this.editRecord.commit();
//this.onRefreshClick(button, event);
}
this.OpStatus = "edit";
if (type==1)
this.onAddFn();
else this.onAddBillFn();
} 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
});
}
//alert('03');
}
});
},
onAddFn: function (button, event) {
var BXGID = "";
var formEdit = this.formEdit.getForm();
var selectedRecords = this.formAddBody.selModel.getSelection();
var data = formEdit.getValues();
BXGID = data.BXGID;
if (BXGID == "") {
return;
}
var FeeList = "";
selectedRecords = this.formAddBody.selModel.getSelection();
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (FeeList == "") { FeeList = "'" + rec.get('GID') + "'"; }
else {
FeeList = FeeList + ",'" + rec.get('GID') + "'";
}
}
var JKTYPE = '';
var JKREASON = '';
var SALECORPID = '';
var selectedRecords2 = this.gridAddList.selModel.getSelection();
for (var i = 0; i < selectedRecords2.length; i++) {
var rec = selectedRecords2[i];
JKTYPE = rec.data.JKTYPE;
JKREASON = rec.data.REASON;
SALECORPID = rec.data.SALECORPID;
}
formEdit.findField('JKTYPE').setValue(JKTYPE);
formEdit.findField('JKREASON').setValue(JKREASON);
formEdit.findField('SALECORPID').setValue(SALECORPID);
if (FeeList == "") {
return;
}
var _this = this;
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/OA/Baoxiao2/AddJKFee',
scope: this,
params: {
BXGID: BXGID,
FeeList: FeeList
},
callback: function (options, success, response) {
if (success) {
var _this = this;
var BXGID = formEdit.findField('BXGID').getValue();
this.storeBaoXiao2Body.load({
params: { condition: "BXGID='" + BXGID + "' " }
, callback: function (options, success, response) {
_this.SetAmount();
_this.SetDX();
_this.Save('0');
}
});
this.storeBaoXiaoAddBody.reload();
// this.onRefreshClick();
//this.Save('0');
} else {
Ext.Msg.show({
title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
}
});
},
onAddClick: function (button, event) {
//传递GID参数
//添加销售
if (this.OpStatus == "add") {
this.BaoXiaoSaveFn(1,button, event);
}
else {
this.onAddFn(button, event)
}
},
onAddBillFn: function (button, event) {
var BXGID = "";
var formEdit = this.formEdit.getForm();
var selectedRecords = this.gridAddList.selModel.getSelection();
var data = formEdit.getValues();
BXGID = data.BXGID;
if (BXGID == "") {
return;
}
var FeeList = "";
var bodyDrChFeeDatas = [];
var JKTYPE = '';
var JKREASON = '';
selectedRecords = this.gridAddList.selModel.getSelection();
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
JKTYPE = rec.data.JKTYPE;
JKREASON = rec.data.REASON;
bodyDrChFeeDatas.push(rec);
}
formEdit.findField('JKTYPE').setValue(JKTYPE);
formEdit.findField('JKREASON').setValue(JKREASON);
if (bodyDrChFeeDatas.length==0) {
return;
}
var jsonChFeeBody = ConvertRecordsToJsonAll(bodyDrChFeeDatas);
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/OA/Baoxiao2/AddJKBill',
scope: this,
params: {
BXGID: BXGID,
BillList: jsonChFeeBody
},
callback: function (options, success, response) {
if (success) {
var _this = this;
var BXGID = formEdit.findField('BXGID').getValue();
this.storeBaoXiao2Body.load({
params: { condition: "BXGID='" + BXGID + "' " }
, callback: function (options, success, response) {
_this.SetAmount();
_this.SetDX();
_this.Save('0');
}
});
this.storeAddList.reload();
this.storeBaoXiaoAddBody.removeAll();
//this.Save('0');
} else {
Ext.Msg.show({
title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
}
});
},
onAddBillClick: function (button, event) {
if (this.OpStatus == "add") {
this.BaoXiaoSaveFn(2,button, event);
}
else {
this.onAddBillFn(button, event)
}
},
onDelClick: function (button, event) {
//传递GID参数
//添加销售
var formEdit = this.formEdit.getForm();
var selectedRecords = this.formFeeBody.selModel.getSelection();
this.SetAmount();
this.SetDX();
//this.Save('0');
var BXGID = formEdit.findField('BXGID').getValue();
var FeeList = "";
//selectedRecords = this.formAddBody.selModel.getSelection();
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (FeeList == "") { FeeList = "'" + rec.get('GID') + "'"; }
else {
FeeList = FeeList + ",'" + rec.get('GID') + "'";
}
}
if (FeeList == "") {
return;
}
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/OA/Baoxiao2/DelJKFee',
scope: this,
params: {
FeeList: FeeList
},
callback: function (options, success, response) {
if (success) {
var _this = this;
var BXGID = formEdit.findField('BXGID').getValue();
this.storeBaoXiao2Body.load(
{ params: { condition: "BXGID='" + BXGID + "' " }
, callback: function (options, success, response) {
_this.SetAmount();
_this.SetDX();
_this.Save('0');
}
});
this.onRefreshClick();
} else {
Ext.Msg.show({ title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
}
});
},
//载入数据
LoadData: function (OpStatus, condition) {
if (COMPANYID == "" || DEPTGID == "") {
alert("登录信息不全,请退出重新登录");
return;
}
this.OpStatus = OpStatus;
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/OA/Baoxiao2/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 (data.BXSTATUS == "1" || data.BXSTATUS == "6" || this.OpStatus == "add") {
//可以编辑
Ext.getCmp('savebtn').enable();
Ext.getCmp('saveandclosebtn').enable();
Ext.getCmp('saveandnewbtn').enable();
Ext.getCmp('add1').enable();
Ext.getCmp('del1').enable();
Ext.getCmp('add3').enable();
Ext.getCmp('add4').enable();
} else {
Ext.getCmp('savebtn').disable();
Ext.getCmp('saveandclosebtn').disable();
Ext.getCmp('saveandnewbtn').disable();
Ext.getCmp('add1').disable();
Ext.getCmp('del1').disable();
Ext.getCmp('add3').disable();
Ext.getCmp('add4').disable();
}
//storeBaoXiao2Body
//
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 } });
this.storeDocList.load({ params: { start: 0, limit: 9999, condition: "R_GID='" + BXGID+"'" } });
} else {
}
//this.storeCHEQUENUM.load({ params: { DEPTID: DEPTGID, BXGID: ""} });
}, // end LoadDate
checkedit: function (status) {
if (status != 1 && status != 2 && status != 6 && status != 0) {
//alert("注意 录入状态/提交审核/驳回提交 的费用可以全部保存,审核通过的业务只保存支付信息 ");
return false;
} else
if (status == 0) {
//alert("注意审核通过的业务只保存支付信息 ");
return true;
}
},
Save: function (type) {
var basicForm = this.formEdit.getForm();
if (!basicForm.isValid()) {
return;
}
var data = this.formEdit.getForm().getValues();
var data2 = this.formSum.getForm().getValues();
var BXGID = data.BXGID;
if (COMPANYID == "" || DEPTGID == "") {
alert("登录信息不全,请退出重新登录");
return;
}
var Feedatas = [];
for (var i = 0; i < this.storeBaoXiao2Body.getCount(); i += 1) {
var member = this.storeBaoXiao2Body.getAt(i);
Feedatas.push(member);
}
//费用明细
var FeeBody = ConvertRecordsToJson(Feedatas);
var FeeDelBody = ConvertRecordsToJsonAll(this.feeBodyDel);
var Paydatas = [];
for (var i = 0; i < this.storePayBody.getCount(); i += 1) {
var member = this.storePayBody.getAt(i);
Paydatas.push(member);
}
//支付明细
var PayBody = ConvertRecordsToJson(Paydatas);
var PayDelBody = ConvertRecordsToJsonAll(this.PayBodyDel);
//如果已经审核通过,则只保存支付信息
if (data.BXSTATUS == 0) {
FeeBody = "";
FeeDelBody = "";
//feeUnUnionBody = "";
}
var _this = this;
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/OA/Baoxiao2/Save2',
scope: this,
async: false,
params: {
OpStatus: this.OpStatus,
data: Ext.JSON.encode(data),
data2: Ext.JSON.encode(data2),
FeeBody: FeeBody,
FeeDelBody: FeeDelBody,
PayBody: PayBody,
PayDelBody: PayDelBody
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var returnData = jsonresult.Data;
this.formEdit.getForm().setValues(returnData);
if (this.OpStatus == 'add') {
var arrNewRecords = this.StoreList.add(returnData);
this.editRecord = arrNewRecords[0];
// alert(editRecord.get('ContractNo'));
BXGID = this.editRecord.get('BXGID');
}
else if (this.OpStatus == 'edit') {
var editp = Ext.create('Baoxiaomb', returnData);
this.editRecord.fields.each(function (field) {
if (field.persist) {
name = field.name;
//alert(name + ' -- ' + editp.get(name));
if (name != 'BXGID')
this.editRecord.set(name, editp.get(name));
}
}, this);
this.editRecord.commit();
//this.onRefreshClick(button, event);
}
this.storeBaoXiao2Body.commitChanges();
this.storePayBody.commitChanges();
if (type == '0') {
this.OpStatus = 'edit';
this.storeBaoXiao2Body.load({ params: { condition: "BXGID='" + BXGID + "' " }
, callback: function (options, success, response) {
_this.SetAmount();
_this.SetDX();
}
});
this.storePayBody.load({ params: { BXGID: BXGID} });
} else if (type == '1') {//保存并关闭
window.close();
} else if (type == '2') {//保存并全部新建
this.LoadData('add', '');
this.storeBaoXiao2Body.removeAll();
}
} 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
});
}
//alert('03');
}
});
var me = this;
if (this.editRecord.get('BXSTATUS') == "0") {
//var recordList = [];
//var BXGID = me.editRecord.get('BXGID');
Ext.Ajax.request({
waitMsg: "",
url: '/OA/Baoxiao/SetGZ',
scope: this,
async: true,
params: {
BXGID: BXGID
},
callback: function (_count) {
//return _count;
}
});
}
},
//end save
onExportClick: function (button, event) {
GridExportExcelPage(this.formFeeBody);
},
//#region 上传图片
onAddFileClick: function (button, event) {
var myDate = new Date();
var record = Ext.create('ReceiptDocmb', {
GID: NewGuid(),
RECEIPTTYPE: '',
R_GID: '',
BSNO: '', //ContractNo
URL: '',
Driect_URL: '',
ISPUBLIC: '0',
MODIFIEDUSER: SHOWNAME,
MODIFIEDTIME: myDate.format('yyyy-MM-dd hh:mm:ss')
});
this.storeDocList.add(record);
var n = this.storeDocList.getCount();
this.DocListCellEditing.startEditByPosition({ row: n - 1, column: 5 });
}
, onPostFileClick: function (button, event) {
if (USERID == "") {
alert("登录信息不全,请退出重新登录");
return;
}
var BXSTATUS = this.formEdit.getForm().findField('BXSTATUS').getValue();
var billno = this.formEdit.getForm().findField('BXGID').getValue();
var bodyDatas = [];
var i;
for (var i = 0; i < this.storeDocList.getCount(); i += 1) {
var member = this.storeDocList.getAt(i);
bodyDatas.push(member);
}
var DocBody = ConvertRecordsToJsonAll(bodyDatas);
_this = this;
//var Docdatas = [];
//var DocBody = ConvertRecordsToJson(Docdatas);
//var DocBodyDel = ConvertRecordsToJsonAll(this.DocDel);
var _this = this;
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/MvcShipping/MsOpReceipt/SaveUploadFile',
scope: this,
params: {
data: DocBody
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var condition2 = " R_GID='" + billno + "' ";
_this.Loading = true;
_this.storeDocList.load({
params: { condition: condition2 },
waitMsg: "正在查询数据...",
scope: this,
callback: function () {
_this.Loading = false;
}
});
} 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
});
}
//alert('03');
}
});
} //end save
, onDelFileClick: function (button, event) {
var feeGidSql = '';
var selectedRecords = [];
selectedRecords = this.DocCM.selected.items;
if (selectedRecords.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择要删除的附件!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
Ext.MessageBox.confirm('提示', '确定要删除选中的附件吗?', function (btn) {
if (btn == 'yes') {
if (selectedRecords.length > 0) {
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (rec.data.GID == "*") //如果是新增但没有保存的数据,没有必要提交到后台
{
this.storeDocList.remove(selectedRecords[i]);
} else {
var feeGId = "'" + rec.data.GID + "'";
if (feeGidSql == '') {
feeGidSql = feeGId;
} else {
feeGidSql = feeGidSql + "," + feeGId;
}
}
}
}
_this = this;
Ext.Msg.wait('正在删除数据...');
if (feeGidSql != '') {
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/MvcShipping/MsOpReceipt/DeleteUploadFile',
params: {
data: feeGidSql
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
for (var i = 0; i < selectedRecords.length; i++) {
this.storeDocList.remove(selectedRecords[i]);
}
Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
}
},
failure: function (response, options) {
Ext.Msg.show({ title: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
},
success: function (response, options) {
},
scope: this
}); //end Ext.Ajax.request
} else {
Ext.Msg.show({ title: '提示', msg: "删除成功!", icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
}
}, this);
}
, onUpLoadFileClick: function (button, event) {
var billno = this.formEdit.getForm().findField('BXGID').getValue();
//枚举维护表tSysEnumValue_附件类型97048 //需求编号SR2017081100003
this.storeFileType = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.TSysEnumValueDataModel',
proxy: { url: '/CommMng/BasicDataRef/GetTSysEnumValueList' }
});
this.storeFileType.load({ params: { condition: " and EnumTypeID=97048" } });
var comboxFileType = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '附件类型',
store: this.storeFileType,
forceSelection: true,
id: 'FILETYPE',
name: 'FILETYPE',
valueField: 'EnumValueName',
displayField: 'EnumValueName'
});
me = this;
var imgform = new Ext.FormPanel({
region: 'center',
labelWidth: 40,
frame: true,
//bodyStyle: 'padding:5px 5px 0',
//autoScroll: true,
border: false,
fileUpload: true,
items: [{
xtype: 'fileuploadfield',
id: 'LoadFile',
name: 'LoadFile',
emptyText: '请选择文件',
fieldLabel: '文件',
buttonText: '选择文件',
allowBlank: false,
buttonCfg: { iconCls: 'uploaddialog' },
anchor: '98%'
}, comboxFileType, {
xtype: 'textfield',
id: 'DOCUMENTATTACHEDCODE',
name: 'DOCUMENTATTACHEDCODE',
fieldLabel: '随附单证代码'//需求编号SR2017081100003
}, {
xtype: 'textfield',
id: 'DOCUMENTATTACHEDNO',
name: 'DOCUMENTATTACHEDNO',
fieldLabel: '随附单证编号'//需求编号SR2017081100003
}],
buttons: [{
text: '上传',
type: 'submit',
handler: function () {
var UserFilePath = Ext.getCmp('LoadFile').getValue();
// if (!CheckFileExt(UserFilePath, /.jpg|.gif|.png|.bmp|.pdf/i)) {
// Ext.Msg.show({ title: '错误', msg: '请确认你上传的文件为图片文件!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
// return;
// }
if (!imgform.form.isValid()) { return; }
imgform.form.submit({
url: '/MvcShipping/MsOpReceipt/UploadFile',
waitMsg: '正在上传',
method: 'POST',
submitEmptyText: false,
async: false,
params: {
CUSTNO: billno,
BSNO:'',
TYPE: comboxFileType.getRawValue(),
DOCUMENTATTACHEDCODE: Ext.getCmp('DOCUMENTATTACHEDCODE').getValue(), //需求编号SR2017081100003
DOCUMENTATTACHEDNO: Ext.getCmp('DOCUMENTATTACHEDNO').getValue() //需求编号SR2017081100003
},
success: function (form, action) {
win.close(this);
Ext.Msg.show({ title: '提示', msg: '上传成功!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
var condition2 = " R_GID='" + billno + "' ";
me.Loading = true;
me.storeDocList.load({
params: { condition: condition2 },
waitMsg: "正在查询数据...",
scope: this,
callback: function () {
me.Loading = false;
}
});
},
failure: function (form, action) {
form.reset();
// if (action.failureType == Ext.form.Action.SERVER_INVALID) {
// Ext.MessageBox.alert('警告', action.result.errors.msg);
// }
}
});
}
}, {
text: '关闭',
type: 'submit',
handler: function () {
win.close(this);
}
}]
});
var win = new Ext.Window({
title: "上传文件",
width: 360,
height: 200,
modal: true,
resizable: false,
border: false,
items: imgform
});
win.show();
}
,
//#endregion
//onAddFileClick: function () {
// var BXSTATUS = this.formEdit.getForm().findField('BXSTATUS').getValue();
// var BXGID = this.formEdit.getForm().findField('BXGID').getValue();
// if (BXSTATUS != "1" && BXSTATUS != "6") {//未提交
// Ext.MessageBox.alert('提示','当前状态不允许修改附件列表'); //提示', '当前状态不允许修改附件列表
// return;
// }
// var winAccess = new Shipping.FileUpload({});
// winAccess.BillNo = BXGID;
// winAccess.File_DocType ='发票';
// winAccess.show();
//}, onDelFileClick: function () {
// var BXSTATUS = this.formEdit.getForm().findField('BXSTATUS').getValue();
// if (BXSTATUS != "1" && BXSTATUS != "6") {//未提交
// Ext.MessageBox.alert('提示','当前状态不允许修改附件列表!'); //提示', '当前状态不允许修改附件列表!
// return;
// }
// var selections = this.fileGrid.getSelectionModel().getSelection();
// if (selections.length == 0) {//提示', msg: '请先选择要删除的数据!
// Ext.Msg.show({
// title: '提示', msg:'请先选择要删除的数据!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
// return;
// }
// var record = new Array();
// for (var i = 0; i < selections.length; i++) {
// record.push(selections[i].data);
// } //提示', '确定删除该记录吗?'
// Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) {
// if (btn == 'yes') {
// Ext.Msg.wait('正在删除数据...'); //正在删除数据
// Ext.Ajax.request({
// waitMsg: '正在删除数据...',
// url: '/Account/Chfee_payapplication/CertDel',
// params: {
// data: Ext.JSON.encode(record)
// },
// callback: function (options, success, response) {
// if (success) {
// var jsonresult = Ext.JSON.decode(response.responseText);
// if (jsonresult.Success) {
// this.storeChfeeFile.reload();
// Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
// } //提示
// else {
// Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
// }
// }
// },
// failure: function (response, options) {//'警告', msg: '服务器响应出错,请重试'
// Ext.Msg.show({ title: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
// },
// success: function (response, options) {
// },
// scope: this
// }); //end Ext.Ajax.request
// }
// }, this);
//},
SetFeeBtn: function (enable) {
if (enable) {
Ext.getCmp('addfee').enable();
Ext.getCmp('delfee').enable();
Ext.getCmp('postfee').enable();
} else {
Ext.getCmp('addfee').disable();
Ext.getCmp('delfee').disable();
Ext.getCmp('postfee').disable();
}
},
onSubmitAuditClick: function (button, event) {
var basicForm = this.formEdit.getForm();
if (!basicForm.isValid()) {
return;
}
this.storejiekuanlist = Ext.create('DsExt.ux.RefTableStore', {
model: 'Baoxiaomb',
proxy: { url: '/OA/Jiekuan2/GetDataList' }
});
var data = this.formEdit.getForm().getValues();
this.storejiekuanlist.insert(0, data);
var bodydatas = [];
var member = this.storejiekuanlist.getAt(0);
bodydatas.push(member);
DsTruck.BaoxiaoAudit(bodydatas, 2, "BaoxiaoMod", '正在审核数据, 请稍侯..');
var condition = " BX.BXGID='" + this.editRecord.get('BXGID') + "'";
this.LoadData("edit", condition);
}
, onSubmitAuditBackClick: function (button, event) {
var basicForm = this.formEdit.getForm();
if (!basicForm.isValid()) {
return;
}
this.storejiekuanlist = Ext.create('DsExt.ux.RefTableStore', {
model: 'Baoxiaomb',
proxy: { url: '/OA/Jiekuan2/GetDataList' }
});
var data = this.formEdit.getForm().getValues();
this.storejiekuanlist.insert(0, data);
var bodydatas = [];
var member = this.storejiekuanlist.getAt(0);
bodydatas.push(member);
DsTruck.BaoxiaoAudit(bodydatas, 1, "BaoxiaoMod", '正在审核数据, 请稍侯..');
var condition = " BX.BXGID='" + this.editRecord.get('BXGID') + "'";
this.LoadData("edit", condition);
}
,onAuditPassClick: function (button, event) {
var basicForm = this.formEdit.getForm();
if (!basicForm.isValid()) {
return;
}
this.storejiekuanlist = Ext.create('DsExt.ux.RefTableStore', {
model: 'Baoxiaomb',
proxy: { url: '/OA/Jiekuan2/GetDataList' }
});
var data = this.formEdit.getForm().getValues();
this.storejiekuanlist.insert(0, data);
var bodydatas = [];
var member = this.storejiekuanlist.getAt(0);
bodydatas.push(member);
DsTruck.BaoxiaoAudit(bodydatas, 0, "BaoxiaoMod", '正在审核数据, 请稍侯..');
var condition = " BX.BXGID='" + this.editRecord.get('BXGID') + "'";
this.LoadData("edit", condition);
}
, onAuditRefuseClick: function (button, event) {
var basicForm = this.formEdit.getForm();
if (!basicForm.isValid()) {
return;
}
this.storejiekuanlist = Ext.create('DsExt.ux.RefTableStore', {
model: 'Baoxiaomb',
proxy: { url: '/OA/Jiekuan2/GetDataList' }
});
var data = this.formEdit.getForm().getValues();
this.storejiekuanlist.insert(0, data);
var bodydatas = [];
var member = this.storejiekuanlist.getAt(0);
bodydatas.push(member);
DsTruck.BaoxiaoAudit(bodydatas, 6, "BaoxiaoMod", '正在审核数据, 请稍侯..');
var condition = " BX.BXGID='" + this.editRecord.get('BXGID') + "'";
this.LoadData("edit", condition);
},
DoPrint: function () {
var basicForm = this.formEdit.getForm();
/*
if (ContractNo == '*' || ContractNo == '') {
Ext.Msg.show({ title: '错误', msg: '单据还没有保存,请保存后再打印', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}*/
function GetDateStr(AddDayCount) {
var dd = new Date();
dd.setDate(dd.getDate() + AddDayCount); //获取AddDayCount天后的日期
var y = dd.getFullYear();
var m = dd.getMonth() + 1; //获取当前月份的日期
var d = dd.getDate();
return y + "-" + m + "-" + d;
}
//alert(GetDateStr(+5));
//var needdate = GetDateStr(+5);
//var printdate = GetDateStr(0);
//var _date = Ext.getCmp("ENTERDATE").getRawValue();
var printType = 'BaoXiao2'; //打印借款单
//
var data = this.formEdit.getForm().getValues();
var JKUSERID = data.USERID;
var GID = data.BXGID;
var sql1 = " select bx.bxgid 报销单号,bx.CREATEUSER 报销人,dbo.trimtime(bx.createdate) 报销日期,bx.REMARK 备注 ";
sql1 = sql1 + " ,(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=99024 and EnumValueID=BX.BXSTATUS) as 报销状态 ";
sql1 = sql1 + " ,(select showname from vw_user where userid=(select top 1 auditor from workflow_do where billno=bx.BXGID order by AUDITTIME DESC )) 审核人";
sql1 = sql1 + " ,(select top 1 dbo.trimtime(AUDITTIME) from workflow_do where billno=bx.BXGID order by AUDITTIME DESC ) 审核时间 ";
sql1 = sql1 + " ,isnull((select top 1 VOUALLNO from cw_vouno_bs_gl WITH(NOLOCK) where BSGID=BX.BXGID and BSTABLENAME='OA_Baoxiao' and STARTGID=(select top 1 GID from cw_design_startusing WITH(NOLOCK) where (ISDELETE=0 or ISDELETE is null) and ISENABLE=1 and GID=(select top 1 STARTGID from [cw_design_startusing_user] WITH(NOLOCK) where USERGID='" + USERID + "'))),'') 总账凭证号";
sql1 = sql1 + " FROM vw_BaoXiao BX ";
sql1 = sql1 + " where BX.BXGID='" + GID + "' ";
var sql2 = " select C.gid,C.feename 费用名称,C.SALESNO 相关编号,C.currency 币别,c.SETTLEMENT 核销金额,c.remark 报销事由 ";
sql2 = sql2 + " ,case isnull(c.reason,'') when '' then (select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=36 and EnumValueID=J.JKTYPE) else c.Reason end 支付方式 ";
sql2 = sql2 + " ,INVOICENUM 发票号,J.GID 借款单号, C.Amount 申请金额 ";
sql2 = sql2 + " from ch_fee c left join OA_JIEKUAN j on j.GID=c.JKGID where c.BXGID='" + GID + "' ";
var sql3 = "";
var sql4 = ""; //获取该部门剩余资金
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
},
//#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: '/OA/Baoxiao2/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: '/OA/Baoxiao2/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.onRefreshClick();
//
_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
,
SaveSTL: function () {
var basicForm = this.formEdit.getForm();
//if (!basicForm.isValid()) {
// return;
//}
var data = this.formEdit.getForm().getValues();
var BXGID = data.BXGID;
var Paydatas = [];
for (var i = 0; i < this.storePayBody.getCount(); i += 1) {
var member = this.storePayBody.getAt(i);
Paydatas.push(member);
}
//支付明细
var PayBody = ConvertRecordsToJson(Paydatas);
var PayDelBody = ConvertRecordsToJsonAll(this.PayBodyDel);
if (PayBody != "" || PayDelBody != "") {
} else {
return;
}
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/OA/Baoxiao2/SaveSTL',
scope: this,
params: {
BXGID: BXGID,
PayBody: PayBody,
PayDelBody: PayDelBody
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
//this.storePayBody.commitChanges();
this.storePayBody.load({ params: { BXGID: BXGID} });
} 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
});
}
//alert('03');
}
});
}
});