|
|
///<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);
|
|
|
};
|
|
|
|
|
|
//#region 获取当前时间
|
|
|
Date.prototype.format = function (format) {
|
|
|
var o = {
|
|
|
"M+": this.getMonth() + 1, //month
|
|
|
"d+": this.getDate(), //day
|
|
|
"h+": this.getHours(), //hour
|
|
|
"m+": this.getMinutes(), //minute
|
|
|
"s+": this.getSeconds(), //second
|
|
|
"q+": Math.floor((this.getMonth() + 3) / 3), //quarter
|
|
|
"S": this.getMilliseconds() //millisecond
|
|
|
}
|
|
|
if (/(y+)/.test(format)) format = format.replace(RegExp.$1,
|
|
|
(this.getFullYear() + "").substr(4 - RegExp.$1.length));
|
|
|
for (var k in o) if (new RegExp("(" + k + ")").test(format))
|
|
|
format = format.replace(RegExp.$1,
|
|
|
RegExp.$1.length == 1 ? o[k] :
|
|
|
("00" + o[k]).substr(("" + o[k]).length));
|
|
|
return format;
|
|
|
}
|
|
|
|
|
|
var xhr = new XMLHttpRequest();
|
|
|
var currdate = new Date();
|
|
|
if (!xhr) {
|
|
|
//...其他生成xmlhttprequest方法
|
|
|
}
|
|
|
xhr.open("HEAD", location.href, true);
|
|
|
xhr.onreadystatechange = function () {
|
|
|
if (xhr.readyState == 4 && xhr.status == 200) {
|
|
|
var datestr = xhr.getResponseHeader("Date");
|
|
|
currdate = new Date(datestr);
|
|
|
// alert(currdate.format('yyyy-MM-dd'));
|
|
|
}
|
|
|
}
|
|
|
xhr.send(null);
|
|
|
|
|
|
|
|
|
function getSaved() {
|
|
|
var feedirty = DsTruck.GetDirty(panelEdit.storeFeeBody, panelEdit.feeBodyDel);
|
|
|
|
|
|
if (panelEdit.formEdit.getForm().isDirty()== true )
|
|
|
{
|
|
|
return true;
|
|
|
}
|
|
|
else return false;
|
|
|
}
|
|
|
//#endregion
|
|
|
|
|
|
Ext.extend(DsTruck.Chfee_managementEdit, Ext.Panel, {
|
|
|
parentWin: null,
|
|
|
OpStatus: 'add',
|
|
|
StoreList: null,
|
|
|
editRecord: null,
|
|
|
strCwSTARTGID: '',
|
|
|
isVOUALLNO: 0,
|
|
|
// parentfunction: null,
|
|
|
_First: true,
|
|
|
initUIComponents: function () {
|
|
|
this.feeSerialNo = 0;
|
|
|
this.feeBodyDel = [];
|
|
|
this.BodyFormName = "C_MBodyDetail";
|
|
|
|
|
|
//#region 枚举参照相关(编辑form)
|
|
|
|
|
|
|
|
|
Ext.define('FeeTypeMd', {
|
|
|
extend: 'Ext.data.Model',
|
|
|
fields: [
|
|
|
{ name: 'FeeTypeID', type: 'string' },
|
|
|
{ name: 'FeeTypeName', type: 'string' }
|
|
|
]
|
|
|
});
|
|
|
var FeeTypeData = [{ "FeeTypeID": "1", "FeeTypeName": "收入" },
|
|
|
{ "FeeTypeID": "2", "FeeTypeName": "支出"}];
|
|
|
|
|
|
var storeFeeType = Ext.create('Ext.data.Store', {
|
|
|
model: 'FeeTypeMd',
|
|
|
data: FeeTypeData
|
|
|
});
|
|
|
this.comboxFeeTypeRef = Ext.create('DsExt.ux.RefEnumCombox', {
|
|
|
fieldLabel: '收付类型',
|
|
|
store: storeFeeType,
|
|
|
name: 'FEETYPE',
|
|
|
valueField: 'FeeTypeID',
|
|
|
displayField: 'FeeTypeName'
|
|
|
, forceSelection: true
|
|
|
});
|
|
|
|
|
|
this.storeUser = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'DsTruckMng.ux.UserRefModel',
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' }
|
|
|
});
|
|
|
this.storeUser.load({ params: { condition: " 1=1 "} });
|
|
|
this.comboxCreator = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: '制单人',
|
|
|
store: this.storeUser,
|
|
|
name: 'CREATOR',
|
|
|
valueField: 'UserName',
|
|
|
displayField: 'CodeAndName',
|
|
|
allowBlank: false
|
|
|
});
|
|
|
this.comboxAuditor = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: '审核人',
|
|
|
store: this.storeUser,
|
|
|
name: 'AUDITOR',
|
|
|
id: "AUDITOR",
|
|
|
valueField: 'UserCode',
|
|
|
displayField: 'CodeAndName'
|
|
|
});
|
|
|
|
|
|
this.storecurr = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'currRef',
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetcurrRefList' }
|
|
|
});
|
|
|
this.storecurr.load({ params: { condition: ""} });
|
|
|
this.comboxcurr = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: '币别',
|
|
|
store: this.storecurr,
|
|
|
name: 'CURRENCY',
|
|
|
valueField: 'codename',
|
|
|
displayField: 'codename',
|
|
|
value: "RMB",
|
|
|
listeners: {
|
|
|
scope: this,
|
|
|
'select': function (combo, records, eOpts) {
|
|
|
if (records.length > 0) {
|
|
|
|
|
|
this.formEdit.getForm().findField('EXCHANGERATE').setValue(records[0].data.defaultrate);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
this.storeFEESTATUS = Ext.create('DsExt.ux.RefEnumStore', {});
|
|
|
this.storeFEESTATUS.load({ params: { enumTypeId: 99024} });
|
|
|
this.comboxFEESTATUS = Ext.create('DsExt.ux.RefEnumCombox', {
|
|
|
fieldLabel: '费用状态',
|
|
|
store: this.storeFEESTATUS,
|
|
|
name: 'FEESTATUS',
|
|
|
disabled: true,
|
|
|
id: "STATUS"
|
|
|
});
|
|
|
|
|
|
this.storeAccitems = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'Accitemsmb',
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetMngAccitems' }
|
|
|
});
|
|
|
this.storeAccitems.load({ params: { condition: ""} });
|
|
|
|
|
|
/*
|
|
|
this.storeBANK = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'BANKmb',
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GETBANK' }
|
|
|
});
|
|
|
this.storeBANK.load({ params: { condition: ""} });
|
|
|
*/
|
|
|
this.comboxBANK = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: '收支科目', //收支的银行账户
|
|
|
store: this.storeAccitems, //hidden: true,
|
|
|
name: 'OPERATORSIDE',
|
|
|
valueField: 'ACCID',
|
|
|
displayField: 'ACCIDNAME',
|
|
|
flex: 2
|
|
|
, forceSelection: true
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
//#endregion ////////////////
|
|
|
|
|
|
//#region 编辑form:formEdit
|
|
|
this.formEdit = Ext.widget('form', {
|
|
|
// layout: "border",
|
|
|
region: 'center',
|
|
|
frame: true,
|
|
|
bodyPadding: 5,
|
|
|
trackResetOnLoad: true,
|
|
|
fieldDefaults: {
|
|
|
margins: '2 2 2 2',
|
|
|
labelAlign: 'right',
|
|
|
flex: 1,
|
|
|
labelWidth: 90,
|
|
|
msgTarget: 'qtip'
|
|
|
//,split:true
|
|
|
},
|
|
|
|
|
|
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: 'Feeid'
|
|
|
}, this.comboxFeeTypeRef, this.comboxCreator, {
|
|
|
fieldLabel: '制单时间',
|
|
|
format: 'Y-m-d',
|
|
|
xtype: 'datefield',
|
|
|
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
|
|
|
name: 'CREATEDATE'
|
|
|
},
|
|
|
//this.comboxFEENAME,
|
|
|
{
|
|
|
fieldLabel: '时间戳',
|
|
|
name: 'TimeMark', flex: 0, hidden: true, margins: '0'
|
|
|
}
|
|
|
]
|
|
|
}, //container_1 end
|
|
|
{
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [
|
|
|
{
|
|
|
fieldLabel: '金额',
|
|
|
//allowBlank: false,
|
|
|
disabled: true,
|
|
|
id: "AMOUNT_ALL",
|
|
|
name: 'AMOUNT',
|
|
|
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
|
|
|
try {
|
|
|
var lsValue = usMoney(value, 2, '', false);
|
|
|
if (lsValue != "NaN") {
|
|
|
value = lsValue; if (parseFloat(lsValue) < 0) {
|
|
|
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
return value;
|
|
|
}
|
|
|
}
|
|
|
catch (e) {
|
|
|
return value;
|
|
|
}
|
|
|
return value;
|
|
|
}
|
|
|
}, this.comboxcurr, {
|
|
|
fieldLabel: '汇率',
|
|
|
allowBlank: false,
|
|
|
disabled: false,
|
|
|
name: 'EXCHANGERATE'
|
|
|
}, {
|
|
|
fieldLabel: '费用发生时间',
|
|
|
format: 'Y-m-d',
|
|
|
xtype: 'datefield',
|
|
|
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
|
|
|
name: 'FEEDATE'
|
|
|
}
|
|
|
]
|
|
|
},
|
|
|
{
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [
|
|
|
this.comboxFEESTATUS,
|
|
|
this.comboxAuditor, {
|
|
|
fieldLabel: '审核时间',
|
|
|
format: 'Y-m-d',
|
|
|
xtype: 'datefield',
|
|
|
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
|
|
|
name: 'AUDITDATE'
|
|
|
, id: "AUDITDATE"
|
|
|
}, {
|
|
|
fieldLabel: '接口凭证号',
|
|
|
readOnly: true,
|
|
|
xtype: 'textfield',
|
|
|
name: 'VOUCHERNO'
|
|
|
}]
|
|
|
}, /*{
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: []
|
|
|
}, {
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: []
|
|
|
},*/{
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [{
|
|
|
fieldLabel: '会计期间',
|
|
|
allowBlank: false,
|
|
|
xtype: 'monthfield',
|
|
|
name: 'ACCDATE',
|
|
|
flex: 1
|
|
|
}, this.comboxBANK, {
|
|
|
fieldLabel: '总账凭证号',
|
|
|
readOnly: true,
|
|
|
xtype: 'textfield',
|
|
|
name: 'VOUALLNO'
|
|
|
}]
|
|
|
}, {
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [{
|
|
|
fieldLabel: '备注',
|
|
|
name: 'REMARK',
|
|
|
flex: 4
|
|
|
}]
|
|
|
}
|
|
|
]
|
|
|
}
|
|
|
]
|
|
|
});
|
|
|
//#endregion
|
|
|
|
|
|
|
|
|
//#region 明细 <<<< 收支费用明细 >>>>
|
|
|
//#region 参照定义
|
|
|
this.storeFeeAccitems = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'Accitemsmb',
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetMngAccitems' }
|
|
|
});
|
|
|
this.storeFeeAccitems.load({ params: { condition: ""} });
|
|
|
this.comboxAccitems = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
//fieldLabel: '费用科目',
|
|
|
store: this.storeFeeAccitems,
|
|
|
name: 'FEENAME',
|
|
|
valueField: 'ACCID',
|
|
|
displayField: 'ACCIDNAME'
|
|
|
});
|
|
|
|
|
|
//科目加载
|
|
|
this.storeCwAccitems = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'DsShipping.ux.CwAccitemsGlModel',
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetCwAccitemsGl' }
|
|
|
});
|
|
|
this.storeCwAccitems.load({
|
|
|
params: { condition: "ISENABLE=1 and DETAILED=1" },
|
|
|
callback: function (options, success, response) {
|
|
|
var data = {
|
|
|
"GID": "",
|
|
|
"ACCID": "",
|
|
|
"ACCNAME": "",
|
|
|
"ACCIDNAME": "",
|
|
|
"DETAILED": "",
|
|
|
"DC": "",
|
|
|
"ISFCY": "",
|
|
|
"ISDEPTACC": "", //核算部门,按规则设置生成
|
|
|
"ISEMPLACC": "", //核算人员,按规则设置生成
|
|
|
"ISCORPACC": "", //核算客户,按规则设置生成
|
|
|
"ISITEMACC": "", //核算项目,按规则设置生成
|
|
|
"REMARKS": "",
|
|
|
"YEAR": "",
|
|
|
"MONTH": "",
|
|
|
"PACCGID": "",
|
|
|
"ACCATTRIBUTE": "", //科目属性(资产、负债、共同、权益、成本、损益)
|
|
|
//"ISENABLE": "",
|
|
|
"id": "",
|
|
|
"NAME": "",
|
|
|
"ACCTYPE": "", //科目类别
|
|
|
"leaf": "",
|
|
|
"expanded": "",
|
|
|
"DR": "",
|
|
|
"CR": "",
|
|
|
"PACCNAME": ""
|
|
|
};
|
|
|
this.storeCwAccitems.insert(0, data);
|
|
|
},
|
|
|
scope: this
|
|
|
});
|
|
|
this.comboxACCNAME = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
//fieldLabel: '科目名称(总账)',
|
|
|
store: this.storeCwAccitems,
|
|
|
forceSelection: true, //输入值是否严格为待选列表中存在的值
|
|
|
//id: 'ACCID',
|
|
|
name: 'OPERATORSIDE_gl',
|
|
|
valueField: 'ACCID',
|
|
|
displayField: 'ACCIDNAME',
|
|
|
enableKeyEvents: true, //激活键盘事件
|
|
|
listeners: {
|
|
|
scope: this,
|
|
|
'keyup': {
|
|
|
fn: function (_field, e) {
|
|
|
if (e.getKey() == 13) {
|
|
|
this.onRefreshClick();
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
Ext.define('DsShipping.ux.CustomInvRefModel', {
|
|
|
extend: 'Ext.data.Model',
|
|
|
fields: [
|
|
|
{ name: 'GId', type: 'string' },
|
|
|
{ name: 'CustCode', type: 'string' },
|
|
|
{ name: 'CustName', type: 'string' },
|
|
|
{ name: 'CodeAndName', type: 'string' },
|
|
|
{ name: 'BillRises1', type: 'string' },
|
|
|
{ name: 'RMBBillRises', type: 'string' },
|
|
|
{ name: 'RMBBank', type: 'string' },
|
|
|
{ name: 'RMBAccount', type: 'string' },
|
|
|
{ name: 'USDBillRises', type: 'string' },
|
|
|
{ name: 'USDBank', type: 'string' },
|
|
|
{ name: 'USDAccount', type: 'string' },
|
|
|
{ name: 'TaxNo', type: 'string' },
|
|
|
{ name: 'Addr', type: 'string' },
|
|
|
{ name: 'Tel', type: 'string' }
|
|
|
]
|
|
|
});
|
|
|
|
|
|
this.storeTrader = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'DsShipping.ux.CustomInvRefModel',
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetCustomInvRefList' }
|
|
|
});
|
|
|
this.storeTrader.load({ params: { condition: ""} });
|
|
|
this.comboxTrader = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
//fieldLabel: '关系人',
|
|
|
store: this.storeTrader,
|
|
|
name: 'CUSTOMERSIDE',
|
|
|
valueField: 'CustName',
|
|
|
displayField: 'CodeAndName'
|
|
|
});
|
|
|
|
|
|
this.storecurr = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'currRef',
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetcurrRefList' }
|
|
|
});
|
|
|
this.storecurr.load({ params: { condition: ""} });
|
|
|
this.comboxcurr = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
store: this.storecurr,
|
|
|
name: 'currid',
|
|
|
valueField: 'gid',
|
|
|
displayField: 'codename'
|
|
|
//币别
|
|
|
});
|
|
|
|
|
|
this.storeDEPT = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'DsTruckMng.ux.DEPTRefModel',
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetDeptList_All_Group' }//proxy: { url: '/CommMng/BasicDataRef/GetDeptList' }
|
|
|
});
|
|
|
this.storeDEPT.load({ params: { condition: ""} });
|
|
|
this.comboxDEPT = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
//fieldLabel: '部门',
|
|
|
store: this.storeDEPT,
|
|
|
name: 'DEPTID', id: "DEPTID",
|
|
|
valueField: 'GID',
|
|
|
displayField: 'DeptName'
|
|
|
});
|
|
|
|
|
|
this.storeUser2 = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'DsTruckMng.ux.UserRefModel',
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' }
|
|
|
});
|
|
|
this.storeUser2.load({ params: { condition: " 1=1 "} });
|
|
|
this.comboxUser2 = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
store: this.storeUser2,
|
|
|
name: 'SALE',
|
|
|
valueField: 'UserName',
|
|
|
displayField: 'CodeAndName'
|
|
|
});
|
|
|
|
|
|
//#endregion
|
|
|
|
|
|
//数据集
|
|
|
this.storeFeeBody = Ext.create('Ext.data.Store', {
|
|
|
model: 'FeeBodymb',
|
|
|
remoteSort: false,
|
|
|
pruneModifiedRecords: true,
|
|
|
proxy: {
|
|
|
type: 'ajax',
|
|
|
url: '/Account/Chfee_management/GetFeeList',
|
|
|
reader: {
|
|
|
id: 'id,ContractNo',
|
|
|
root: 'data',
|
|
|
totalProperty: 'totalCount'
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
//
|
|
|
this.C_MBodyColumns = [
|
|
|
{ dataIndex: 'gid', header: 'gid', width: 80, hidden: true },
|
|
|
{ dataIndex: 'Feeid', header: 'Feeid', width: 80, hidden: true },
|
|
|
{
|
|
|
dataIndex: 'CUSTOMERSIDE',
|
|
|
header: '关系人',
|
|
|
renderer: function (value, p, record) {
|
|
|
if (value == null || value == '') return '';
|
|
|
else return record.data.CUSTOMERSIDE; //此处是FeeBody中的字段,如果需要则是def之类的查询字段
|
|
|
},
|
|
|
editor: this.comboxTrader,
|
|
|
width: 140
|
|
|
},
|
|
|
{
|
|
|
dataIndex: 'FEENAME',
|
|
|
header: '费用名称(接口)',
|
|
|
renderer: function (value, p, record) {
|
|
|
if (value == null || value == '') return '';
|
|
|
else return record.data.FEENAMEREF;
|
|
|
},
|
|
|
editor: this.comboxAccitems,
|
|
|
width: 170
|
|
|
},
|
|
|
{
|
|
|
dataIndex: 'OPERATORSIDE_gl',
|
|
|
header: '费用名称(总账)',
|
|
|
renderer: function (value, p, record) {
|
|
|
if (value == null || value == '') return '';
|
|
|
else return record.data.OPERATORSIDE_gl_REF;
|
|
|
},
|
|
|
editor: this.comboxACCNAME,
|
|
|
width: 170
|
|
|
},
|
|
|
{
|
|
|
dataIndex: 'AMOUNT',
|
|
|
header: '金额',
|
|
|
width: 80,
|
|
|
editor: {
|
|
|
xtype: 'textfield',
|
|
|
selectOnFocus: true
|
|
|
},
|
|
|
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
|
|
|
try {
|
|
|
var lsValue = usMoney(value, 2, '', false);
|
|
|
if (lsValue != "NaN") {
|
|
|
value = lsValue; if (parseFloat(lsValue) < 0) {
|
|
|
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
return value;
|
|
|
}
|
|
|
}
|
|
|
catch (e) {
|
|
|
return value;
|
|
|
}
|
|
|
return value;
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
dataIndex: 'DEPTGID',
|
|
|
header: '所属部门',
|
|
|
renderer: function (value, p, record) {
|
|
|
if (value == null || value == '') return '';
|
|
|
else return record.data.DEPTNAME;
|
|
|
},
|
|
|
editor: this.comboxDEPT,
|
|
|
width: 140
|
|
|
},
|
|
|
{
|
|
|
dataIndex: 'SALE',
|
|
|
header: '揽货人',
|
|
|
renderer: function (value, p, record) {
|
|
|
if (value == null || value == '') return '';
|
|
|
else return record.data.SALE;
|
|
|
},
|
|
|
editor: this.comboxUser2,
|
|
|
width: 140
|
|
|
},
|
|
|
{
|
|
|
dataIndex: 'REMARK',
|
|
|
header: '备注',
|
|
|
width: 80,
|
|
|
editor: {
|
|
|
xtype: 'textfield',
|
|
|
selectOnFocus: true
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
dataIndex: 'CUSTBANK',
|
|
|
header: '关系人银行',
|
|
|
width: 100,
|
|
|
editor: {
|
|
|
xtype: 'textfield',
|
|
|
selectOnFocus: true
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
dataIndex: 'CUSTACCOUNT',
|
|
|
header: '关系人银行账号',
|
|
|
width: 100,
|
|
|
editor: {
|
|
|
xtype: 'textfield',
|
|
|
selectOnFocus: true
|
|
|
}
|
|
|
}]
|
|
|
|
|
|
//表格
|
|
|
this.cellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
|
|
|
clicksToEdit: 1
|
|
|
});
|
|
|
this.CheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
|
|
|
_this = this;
|
|
|
this.formFeeBody = new Ext.grid.GridPanel({
|
|
|
store: this.storeFeeBody,
|
|
|
enableHdMenu: false,
|
|
|
region: 'center',
|
|
|
trackResetOnLoad: true,
|
|
|
//height: 160,
|
|
|
title: '费用明细',
|
|
|
loadMask: { msg: "数据加载中,请稍等..." },
|
|
|
trackMouseOver: true,
|
|
|
disableSelection: false,
|
|
|
plugins: [this.cellEditing],
|
|
|
selModel: this.CheckBoxModel,
|
|
|
selType: 'cellmodel',
|
|
|
tbar: [{
|
|
|
text: '增加明细',
|
|
|
tooltip: '增加明细',
|
|
|
iconCls: "btnadddetail",
|
|
|
id: 'btnadddetail',
|
|
|
handler: function (button, event) {
|
|
|
this.onAddFeeClick(button, event);
|
|
|
},
|
|
|
scope: this
|
|
|
}, '-', {
|
|
|
text: '删除明细',
|
|
|
tooltip: '删除明细',
|
|
|
iconCls: "btndeletedetail",
|
|
|
id: 'btndeletedetail',
|
|
|
handler: function (button, event) {
|
|
|
this.onDelFeeClick(button, event);
|
|
|
},
|
|
|
scope: this
|
|
|
}, '-', {
|
|
|
text: "保存列表样式",
|
|
|
id: "btnsavelist",
|
|
|
handler: function (button, event) {
|
|
|
|
|
|
var tempcolumns = this.formFeeBody.columns;
|
|
|
DsTruck.SaveGridPanel(USERID, _this.BodyFormName, tempcolumns);
|
|
|
},
|
|
|
scope: this
|
|
|
}],
|
|
|
columns: this.C_MBodyColumns
|
|
|
});
|
|
|
//////
|
|
|
this.C_MBodyColumns = DsTruck.GetGridPanel(USERID, this.BodyFormName, this.C_MBodyColumns);
|
|
|
//使用者id,表名 ,中间column数组,跳过一开始的几列
|
|
|
this.formFeeBody.reconfigure(this.storeFeeBody, this.C_MBodyColumns);
|
|
|
//////
|
|
|
//#endregion 明细<<<< 收支费用明细 >>>>结束
|
|
|
|
|
|
|
|
|
|
|
|
//公共按钮Toolbar:panelBtn
|
|
|
this.panelBtn = new Ext.Panel({
|
|
|
region: "north",
|
|
|
tbar: [
|
|
|
{
|
|
|
|
|
|
text: "保存", id: "SaveBtn",
|
|
|
handler: function (button, event) {
|
|
|
this.Save('0');
|
|
|
},
|
|
|
scope: this
|
|
|
}, {
|
|
|
|
|
|
text: "保存并关闭", id: "SaveBtn1",
|
|
|
handler: function (button, event) {
|
|
|
this.Save('1');
|
|
|
},
|
|
|
scope: this
|
|
|
},
|
|
|
{
|
|
|
// id: "saveandclose",
|
|
|
text: "保存并新建", id: "SaveBtn2",
|
|
|
handler: function (button, event) {
|
|
|
this.Save('2');
|
|
|
},
|
|
|
scope: this
|
|
|
}, '-',
|
|
|
{
|
|
|
// id: "saveandclose",
|
|
|
text: "关闭",
|
|
|
handler: function (button, event) {
|
|
|
window.close();
|
|
|
},
|
|
|
scope: this
|
|
|
}, '-',
|
|
|
{
|
|
|
// id: "saveandclose",
|
|
|
text: "提交审核",
|
|
|
handler: function (button, event) {
|
|
|
this.onSubmitAuditClick();
|
|
|
},
|
|
|
scope: this
|
|
|
},
|
|
|
{
|
|
|
// id: "saveandclose",
|
|
|
text: "审核通过",
|
|
|
handler: function (button, event) {
|
|
|
this.onAuditPassClick();
|
|
|
},
|
|
|
scope: this
|
|
|
},
|
|
|
{
|
|
|
// id: "saveandclose",
|
|
|
text: "驳回提交",
|
|
|
handler: function (button, event) {
|
|
|
this.onAuditRefuseClick();
|
|
|
},
|
|
|
scope: this
|
|
|
}, '-', {
|
|
|
text: "打印",
|
|
|
iconCls: "btnprint",
|
|
|
handler: function (button, event) {
|
|
|
this.Print();
|
|
|
},
|
|
|
scope: this
|
|
|
}, '-', {
|
|
|
text: "生成总账凭证",
|
|
|
id: "btnAddCwVouchers",
|
|
|
iconCls: "btnadd",
|
|
|
handler: function (button, event) {
|
|
|
this.onAddCwVouchers();
|
|
|
},
|
|
|
scope: this
|
|
|
}
|
|
|
]
|
|
|
}); //end 按钮Toolbar
|
|
|
|
|
|
//布局
|
|
|
/* 3 */
|
|
|
this.panelTop = new Ext.Panel({
|
|
|
layout: "border",
|
|
|
region: "north",
|
|
|
height: 32,
|
|
|
items: [this.panelBtn]//, this.formEdit]
|
|
|
});
|
|
|
|
|
|
|
|
|
this.page_1 = new Ext.Panel({
|
|
|
title: "管理费用",
|
|
|
items: [this.formEdit, this.formFeeBody]
|
|
|
});
|
|
|
/*
|
|
|
this.page_2 = new Ext.Panel({
|
|
|
title: "库存管理",
|
|
|
items: [this.formKC]
|
|
|
});
|
|
|
this.page_3 = new Ext.Panel({
|
|
|
title: "票据管理",
|
|
|
items: [this.gridListReceipt]
|
|
|
});
|
|
|
this.page_4 = new Ext.Panel({
|
|
|
title: "应收应付录入",
|
|
|
items: [this.gridListChFee]
|
|
|
});
|
|
|
|
|
|
this.panelReceipt = new Ext.Panel({
|
|
|
layout: "border",
|
|
|
region: "center",
|
|
|
items: [this.panelBodyReceipt]
|
|
|
});*/
|
|
|
|
|
|
this.MainTab = new Ext.tab.Panel({
|
|
|
layout: "border",
|
|
|
region: "center",
|
|
|
items: [
|
|
|
this.page_1
|
|
|
//, this.page_2
|
|
|
//, this.page_3
|
|
|
//, this.page_4
|
|
|
]
|
|
|
})
|
|
|
|
|
|
Ext.apply(this, {
|
|
|
items: [this.panelTop, this.MainTab]
|
|
|
});
|
|
|
|
|
|
parentWin = window.parent.opener;
|
|
|
this.InitData();
|
|
|
|
|
|
//集中绑定编辑后事件
|
|
|
|
|
|
this.formFeeBody.on('edit', function (editor, e, eOpts) {
|
|
|
this.FeeAfterEdit(editor, e, eOpts);
|
|
|
}, this);
|
|
|
|
|
|
|
|
|
Ext.define('MsInfoClientBankModel', {
|
|
|
extend: 'Ext.data.Model',
|
|
|
idProperty: 'GID',
|
|
|
fields: [
|
|
|
{ name: 'GID', type: 'string' },
|
|
|
{ name: 'LINKID', type: 'string' },
|
|
|
{ name: 'ACCOUNTNAME', type: 'string' },
|
|
|
{ name: 'CODENAME', type: 'string' },
|
|
|
{ name: 'CURRENCY', type: 'string' },
|
|
|
{ name: 'BANKNAME', type: 'string' },
|
|
|
{ name: 'ACCOUNT', type: 'string' },
|
|
|
{ name: 'REMARK', type: 'string' },
|
|
|
{ name: 'FINANCESOFTCODE', type: 'string' },
|
|
|
{ name: 'CREATEUSER', type: 'string' },
|
|
|
{ name: 'CREATETIME', type: 'string' },
|
|
|
{ name: 'CWGLACCID', type: 'string' }
|
|
|
]
|
|
|
});
|
|
|
|
|
|
|
|
|
//#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: '/Account/Chfee_management/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
|
|
|
|
|
|
this.InitDataCw();
|
|
|
//#endregion
|
|
|
|
|
|
}, //end initUIComponents
|
|
|
|
|
|
parentfunction: function (button, event) {
|
|
|
var ret1 = window.parent.opener.OprationSwap();
|
|
|
// alert(this.First);
|
|
|
ret1[3]();
|
|
|
},
|
|
|
|
|
|
onAddFeeClick: function (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 form = this.formEdit.getForm();
|
|
|
var REMARK = form.findField('REMARK').getValue();
|
|
|
|
|
|
var record = Ext.create('FeeBodymb', {
|
|
|
'gid': newID(),
|
|
|
'Feeid': '',
|
|
|
'CUSTOMERSIDE': '',
|
|
|
'FEENAME': '',
|
|
|
'AMOUNT': '0',
|
|
|
'REMARK': REMARK
|
|
|
});
|
|
|
this.storeFeeBody.add(record);
|
|
|
|
|
|
var n = this.storeFeeBody.getCount();
|
|
|
// this.CheckBoxModel.startEditByPosition({ row: n - 1, column: 2 });
|
|
|
},
|
|
|
|
|
|
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.Feeid != "" || rec.Feeid != "*") //如果是新增但没有保存的数据,没有必要提交到后台
|
|
|
{
|
|
|
this.feeBodyDel.push(rec);
|
|
|
}
|
|
|
this.storeFeeBody.remove(selectedRecords[i]);
|
|
|
}
|
|
|
}
|
|
|
}, this);
|
|
|
//aftereditform();
|
|
|
},
|
|
|
FeeAfterEdit: function (editor, e, eOpts) {
|
|
|
//需要自己实现里面的事件
|
|
|
if (e.field == 'CUSTOMERSIDE') {
|
|
|
var CUSTOMERrecords = DsStoreQueryBy(this.storeTrader, 'CustName', e.value);
|
|
|
var CURRENCY = this.formEdit.getForm().findField('CURRENCY').getValue();
|
|
|
|
|
|
var storecustall = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'MsInfoClientBankModel',
|
|
|
proxy: { url: '/MvcShipping/MsInfoClient/GetBankList' }
|
|
|
});
|
|
|
storecustall.load({ params: { condition: "CURRENCY='" + CURRENCY + "' and LINKID=(SELECT TOP 1 GID FROM INFO_CLIENT WHERE SHORTNAME='" + e.value + "')" },
|
|
|
callback: function (r, options, success) {
|
|
|
if (success) {
|
|
|
if (r.length != 0) {
|
|
|
var custall = storecustall.getAt(0);
|
|
|
e.record.set('CUSTBANK', custall.data.BANKNAME);
|
|
|
e.record.set('CUSTACCOUNT', custall.data.ACCOUNT);
|
|
|
} else {
|
|
|
e.record.set('CUSTBANK', '');
|
|
|
e.record.set('CUSTACCOUNT', '');
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
|
|
|
// if (CUSTOMERrecords.getCount() > 0) {
|
|
|
// var CUSTOMERdata = CUSTOMERrecords.getAt(0).data;
|
|
|
// if (CURRENCY == 'RMB') {
|
|
|
// e.record.set('CUSTBANK', CUSTOMERdata.RMBBank);
|
|
|
// e.record.set('CUSTACCOUNT', CUSTOMERdata.RMBAccount);
|
|
|
// } else if (CURRENCY == 'USD') {
|
|
|
// e.record.set('CUSTBANK', CUSTOMERdata.USDBank);
|
|
|
// e.record.set('CUSTACCOUNT', CUSTOMERdata.USDAccount);
|
|
|
|
|
|
// }
|
|
|
// } else {
|
|
|
// e.record.set('CUSTBANK', '');
|
|
|
// e.record.set('CUSTACCOUNT', '');
|
|
|
|
|
|
// }
|
|
|
}
|
|
|
|
|
|
if (e.field == 'FEENAME') {
|
|
|
var czstaterecords = DsStoreQueryBy(this.storeAccitems, 'ACCID', e.value);
|
|
|
if (czstaterecords.getCount() > 0) {
|
|
|
var czstatedata = czstaterecords.getAt(0).data;
|
|
|
e.record.set('FEENAMEREF', czstatedata.ACCNAME);
|
|
|
} else {
|
|
|
e.record.set('FEENAMEREF', '');
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (e.field == 'OPERATORSIDE_gl') {
|
|
|
var czstaterecords = DsStoreQueryBy(this.storeCwAccitems, 'ACCID', e.value);
|
|
|
if (czstaterecords.getCount() > 0) {
|
|
|
var czstatedata = czstaterecords.getAt(0).data;
|
|
|
e.record.set('OPERATORSIDE_gl_REF', czstatedata.ACCIDNAME);
|
|
|
} else {
|
|
|
e.record.set('OPERATORSIDE_gl_REF', '');
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (e.field == 'DEPTGID') {
|
|
|
var czstaterecords = DsStoreQueryBy(this.storeDEPT, 'GID', e.value);
|
|
|
if (czstaterecords.getCount() > 0) {
|
|
|
var czstatedata = czstaterecords.getAt(0).data;
|
|
|
e.record.set('DEPTNAME', czstatedata.DeptName);
|
|
|
} else {
|
|
|
e.record.set('DEPTNAME', '');
|
|
|
}
|
|
|
}
|
|
|
var Amount = 0;
|
|
|
for (var i = 0; i < this.storeFeeBody.getCount(); i += 1) {
|
|
|
Amount = Amount + parseFloat(this.storeFeeBody.getAt(i).get("AMOUNT"));
|
|
|
}
|
|
|
|
|
|
//this.editRecord.set('AMOUNT', Amount + '');
|
|
|
//this.formEdit.getForm().setValues(this.editRecord.data);
|
|
|
Ext.getCmp("AMOUNT_ALL").setValue(Amount + "");
|
|
|
//getElementById("AMOUNT_ALL").value = Amount + "";
|
|
|
},
|
|
|
|
|
|
InitData: function () {
|
|
|
|
|
|
this.opStatus = 'add';
|
|
|
var condition = '';
|
|
|
|
|
|
|
|
|
if (parentWin) {
|
|
|
var ret = parentWin.OprationSwap();
|
|
|
this.opStatus = ret[0];
|
|
|
this.StoreList = ret[1];
|
|
|
this.editRecord = ret[2];
|
|
|
// this.parentfunction = ret[3];
|
|
|
}
|
|
|
|
|
|
if (this.opStatus == 'edit')
|
|
|
condition = " cm.Feeid='" + this.editRecord.get('Feeid') + "'";
|
|
|
|
|
|
this.LoadData(this.opStatus, condition);
|
|
|
|
|
|
}, //end InitData
|
|
|
|
|
|
//载入数据
|
|
|
LoadData: function (opstatus, condition) {
|
|
|
this.opStatus = opstatus;
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在查询主表数据...',
|
|
|
url: '/Account/Chfee_management/GetData',
|
|
|
params: {
|
|
|
handle: opstatus,
|
|
|
condition: condition
|
|
|
},
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
var result = Ext.JSON.decode(response.responseText);
|
|
|
if (!result.Success) {
|
|
|
Ext.Msg.show({ title: '提示', msg: result.Message, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK });
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
var data = result.data;
|
|
|
// this.formEdit.getForm().reset();
|
|
|
if (data.CREATEDATE == "") { data.CREATEDATE = currdate.format('yyyy-MM-dd') };
|
|
|
if (data.CREATOR == "") { data.CREATOR = usercode };
|
|
|
if (data.CURRENCY == "") { data.CURRENCY = "RMB" };
|
|
|
if (data.FEETYPE == "0") { data.FEETYPE = "2" };
|
|
|
if (data.EXCHANGERATE == "") { data.EXCHANGERATE = "1" };
|
|
|
if (data.FEEDATE == "") { data.FEEDATE = currdate.format('yyyy-MM-dd') };
|
|
|
if (data.AMOUNT == "") { data.AMOUNT = 0 };
|
|
|
|
|
|
this.formEdit.getForm().setValues(data);
|
|
|
//alert(data.TimeMark);
|
|
|
|
|
|
if (this.opStatus == 'add') {
|
|
|
Ext.getCmp("STATUS").setValue('1');
|
|
|
} else {
|
|
|
if (data.FEESTATUS == "1" || data.FEESTATUS == "6") {
|
|
|
Ext.getCmp("SaveBtn").enable();
|
|
|
Ext.getCmp("SaveBtn1").enable();
|
|
|
Ext.getCmp("SaveBtn2").enable();
|
|
|
}
|
|
|
else {
|
|
|
Ext.getCmp("SaveBtn").disable();
|
|
|
Ext.getCmp("SaveBtn1").disable();
|
|
|
Ext.getCmp("SaveBtn2").disable();
|
|
|
}
|
|
|
//
|
|
|
if (this.isVOUALLNO == 1) {
|
|
|
this.editRecord.fields.each(function (field) {
|
|
|
if (field.persist) {
|
|
|
name = field.name;
|
|
|
if (name == 'VOUALLNO') {
|
|
|
this.editRecord.set(name, data.VOUALLNO.toString());
|
|
|
}
|
|
|
}
|
|
|
}, this);
|
|
|
this.editRecord.commit();
|
|
|
}
|
|
|
}
|
|
|
this.LoadPeriod(this.opStatus);
|
|
|
|
|
|
function setsave() { saved = true; }
|
|
|
var task = new Ext.util.DelayedTask(setsave);
|
|
|
task.delay(500);
|
|
|
} else {
|
|
|
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
}); //request over
|
|
|
|
|
|
if (this.opStatus == 'edit') {
|
|
|
|
|
|
this.formEdit.getForm().findField('Feeid').setDisabled(false);
|
|
|
|
|
|
this.storeFeeBody.load({ params: { condition: "cfm.Feeid = '" + this.editRecord.get('Feeid') + "'"} });
|
|
|
|
|
|
this.formEdit.getForm().findField('Feeid').setDisabled(true);
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
LoadPeriod: function (opstatus) {
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在查询主表数据...',
|
|
|
url: '/Account/ChMonthClose/GetNowPeriod',
|
|
|
params: {
|
|
|
condition: ''
|
|
|
},
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
var result = Ext.JSON.decode(response.responseText);
|
|
|
if (!result.Success) {
|
|
|
return;
|
|
|
}
|
|
|
data = result.data;
|
|
|
this.MsPeriod = data;
|
|
|
this.LoadPeriodStatus(opstatus);
|
|
|
|
|
|
} else {
|
|
|
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
});
|
|
|
},
|
|
|
LoadPeriodStatus: function (opstatus) {
|
|
|
var FEEDATE = this.formEdit.getForm().findField('FEEDATE').getValue();
|
|
|
if (FEEDATE == '') {
|
|
|
this.formEdit.getForm().findField('FEEDATE').setMinValue(this.MsPeriod.FDAY);
|
|
|
this.formEdit.getForm().findField('FEEDATE').setReadOnly(false);
|
|
|
} else {
|
|
|
var oDate1 = new Date(FEEDATE);
|
|
|
var oDate2 = new Date(this.MsPeriod.FDAY);
|
|
|
if (oDate1.getTime() >= oDate2.getTime()) {
|
|
|
this.formEdit.getForm().findField('FEEDATE').setMinValue(this.MsPeriod.FDAY);
|
|
|
this.formEdit.getForm().findField('FEEDATE').setReadOnly(false);
|
|
|
} else {
|
|
|
if (opstatus == 'add' || opstatus == 'copyadd') {
|
|
|
this.formEdit.getForm().findField('FEEDATE').setMinValue(this.MsPeriod.FDAY);
|
|
|
this.formEdit.getForm().findField('FEEDATE').setReadOnly(false);
|
|
|
}
|
|
|
else {
|
|
|
this.formEdit.getForm().findField('FEEDATE').setMinValue('');
|
|
|
this.formEdit.getForm().findField('FEEDATE').setReadOnly(true);
|
|
|
Ext.getCmp("SaveBtn").disable();
|
|
|
Ext.getCmp("SaveBtn1").disable();
|
|
|
Ext.getCmp("SaveBtn2").disable();
|
|
|
Ext.getCmp("btnadddetail").disable();
|
|
|
Ext.getCmp("btndeletedetail").disable();
|
|
|
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// end LoadDate
|
|
|
checkedit: function (status) {
|
|
|
if (status != 1 && status != 2 && status != 6) {
|
|
|
alert("只有 录入状态/提交审核/驳回提交 的费用才能保存");
|
|
|
return false;
|
|
|
} else { return true; }
|
|
|
},
|
|
|
Save: function (type) {
|
|
|
var basicForm = this.formEdit.getForm();
|
|
|
if (!basicForm.isValid()) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
basicForm.findField('Feeid').setDisabled(false);
|
|
|
basicForm.findField('FEESTATUS').setDisabled(false);
|
|
|
basicForm.findField('AMOUNT').setDisabled(false);
|
|
|
var data = this.formEdit.getForm().getValues();
|
|
|
var Feeid = data.Feeid;
|
|
|
var status = data.FEESTATUS;
|
|
|
basicForm.findField('Feeid').setDisabled(true);
|
|
|
basicForm.findField('FEESTATUS').setDisabled(true);
|
|
|
basicForm.findField('AMOUNT').setDisabled(true);
|
|
|
|
|
|
if (!this.checkedit(status)) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
|
|
|
var Feedatas = [];
|
|
|
for (var i = 0; i < this.storeFeeBody.getCount(); i += 1) {
|
|
|
var member = this.storeFeeBody.getAt(i);
|
|
|
Feedatas.push(member);
|
|
|
}
|
|
|
|
|
|
//商品明细
|
|
|
var FeeBody = ConvertRecordsToJson(Feedatas);
|
|
|
var FeeDelBody = ConvertRecordsToJsonAll(this.feeBodyDel);
|
|
|
|
|
|
|
|
|
var _this = this;
|
|
|
Ext.Msg.wait('正在保存数据, 请稍侯..');
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在保存数据...',
|
|
|
url: '/Account/Chfee_management/Save',
|
|
|
scope: this,
|
|
|
async: false,
|
|
|
params: {
|
|
|
opstatus: this.opStatus,
|
|
|
data: Ext.JSON.encode(data),
|
|
|
FeeBody: FeeBody,
|
|
|
FeeDelBody: FeeDelBody
|
|
|
},
|
|
|
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'));
|
|
|
}
|
|
|
else if (this.opStatus == 'edit') {
|
|
|
var editp = Ext.create('C_Mmb', returnData);
|
|
|
this.editRecord.fields.each(function (field) {
|
|
|
if (field.persist) {
|
|
|
name = field.name;
|
|
|
//alert(name + ' -- ' + editp.get(name));
|
|
|
if (name != 'Feeid')
|
|
|
this.editRecord.set(name, editp.get(name));
|
|
|
}
|
|
|
}, this);
|
|
|
this.editRecord.commit();
|
|
|
}
|
|
|
this.storeFeeBody.commitChanges();
|
|
|
|
|
|
if (type == '0') {
|
|
|
this.opStatus = 'edit';
|
|
|
//basicForm.findField('Feeid').setDisabled(false);
|
|
|
//this.storeApp.load({ params: { condition: this.editRecord.get('ContractNo')} });
|
|
|
//this.storeCargo.load({ params: { condition: this.editRecord.get('ContractNo')} });
|
|
|
//basicForm.findField('Feeid').setDisabled(true);
|
|
|
this.LoadPeriodStatus(this.opStatus);
|
|
|
|
|
|
} else if (type == '1') {//保存并关闭
|
|
|
|
|
|
window.close();
|
|
|
} else if (type == '2') {//保存并全部新建
|
|
|
this.LoadData('add', '');
|
|
|
}
|
|
|
} 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
|
|
|
|
|
|
onSubmitAuditClick: function (button, event) {
|
|
|
//提交审核
|
|
|
if (getSaved() == false) {
|
|
|
|
|
|
var records = [this.editRecord];
|
|
|
|
|
|
DsTruck.GLFYAudit(records, 2, '正在审核数据, 请稍侯..');
|
|
|
|
|
|
//Ext.getCmp("STATUS").setValue("2");
|
|
|
|
|
|
condition = " cm.Feeid='" + this.editRecord.get('Feeid') + "'";
|
|
|
this.LoadData(this.opStatus, condition);
|
|
|
Ext.getCmp("STATUS").setValue(2);
|
|
|
} else
|
|
|
{ alert("请先保存"); }
|
|
|
},
|
|
|
onAuditPassClick: function (button, event) {
|
|
|
//审核通过
|
|
|
if (getSaved() == false) {
|
|
|
|
|
|
Ext.getCmp("AUDITOR").setValue(usercode);
|
|
|
Ext.getCmp("AUDITDATE").setValue(currdate.format('yyyy-MM-dd'));
|
|
|
//this.editRecord.set('AUDITOR', GID);
|
|
|
//this.editRecord.set('AUDITDATE', currdate.format('yyyy-MM-dd'));
|
|
|
this.formEdit.getForm().setValues(this.editRecord);
|
|
|
this.Save('0');
|
|
|
|
|
|
var records = [this.editRecord];
|
|
|
|
|
|
DsTruck.GLFYAudit(records, 0, '正在审核数据, 请稍侯..');
|
|
|
|
|
|
condition = " cm.Feeid='" + this.editRecord.get('Feeid') + "'";
|
|
|
|
|
|
//this.LoadData(this.opStatus, condition);
|
|
|
Ext.getCmp("STATUS").setValue(0);
|
|
|
|
|
|
} else
|
|
|
{ alert("请先保存"); }
|
|
|
},
|
|
|
|
|
|
onAuditRefuseClick: function (button, event) {
|
|
|
//驳回提交
|
|
|
var records = [this.editRecord];
|
|
|
|
|
|
var VOUCHERNO = this.editRecord.data.VOUCHERNO;
|
|
|
var VOUALLNO = this.editRecord.data.VOUALLNO;
|
|
|
if (VOUCHERNO == "" && VOUALLNO == "") {
|
|
|
DsTruck.GLFYAudit(records, 6, '正在审核数据, 请稍侯..');
|
|
|
|
|
|
condition = " cm.Feeid='" + this.editRecord.get('Feeid') + "'";
|
|
|
|
|
|
this.LoadData(this.opStatus, condition);
|
|
|
Ext.getCmp("STATUS").setValue(6);
|
|
|
} else {
|
|
|
alert("已生成凭证,无法驳回");
|
|
|
}
|
|
|
},
|
|
|
|
|
|
Print: function () {
|
|
|
var basicForm = this.formEdit.getForm();
|
|
|
var billNo = basicForm.findField('Feeid').value;
|
|
|
if (billNo == '*' || billNo == '') {
|
|
|
Ext.Msg.show({ title: '错误', msg: '单据还没有保存,请保存后再打印', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
var printType = 'MSCHFEEmanagement';
|
|
|
var sql1 = "SELECT s.*,(select ShowName from [user] where GID=s.SETTLEUSER) as SETTLEUSERREF FROM ch_fee_settlement s WHERE BILLNO='" + billNo + "'";
|
|
|
sql1 = " SELECT Feeid,FEESTATUS,FEETYPE,AMOUNT,dbo.trimdate(FEEDATE) FEEDATE ";
|
|
|
sql1 = sql1 + " ,dbo.trimdate(CREATEDATE) CREATEDATE,CREATOR,VOUCHERNO,case cm.ISVOU when 1 then '是' else '否' end as ISVOU,dbo.trimdate(AUDITDATE) AUDITDATE,AUDITOR ";
|
|
|
sql1 = sql1 + " ,OPERATORSIDE,BILLINGDATE,REMARK,cm.currency,cm.exchangerate ";
|
|
|
sql1 = sql1 + " ,convert(bigint ,cm.TimeMark) as TimeMark,ACCDATE ";
|
|
|
sql1 = sql1 + " ,(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=99024 and EnumValueID=cm.FeeStatus) as FeeStatus_Ref ";
|
|
|
sql1 = sql1 + " ,(select bankname+' '+remark from sys_bank sb where sb.gid=cm.OPERATORSIDE) as OPERATORSIDE_Ref ";
|
|
|
sql1 = sql1 + " ,case FEETYPE when 1 then '收入' else '支出' end as FeeType_Ref";
|
|
|
sql1 = sql1 + " ,isnull((select top 1 VOUALLNO from cw_vouno_bs_gl WITH(NOLOCK) where BSGID=cm.FEEID and BSTABLENAME='ch_fee_management' 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 + "'))),'') VOUALLNO";
|
|
|
|
|
|
sql1 = sql1 + " FROM ch_fee_management cm where cm.ISDELETE<>1 and cm.Feeid='" + billNo + "' ";
|
|
|
|
|
|
var sql2 = "SELECT * from ch_fee_Mbody where feeid='" + billNo + "' ";
|
|
|
|
|
|
var sql3 = "";
|
|
|
var sql4 = "";
|
|
|
var sql5 = "";
|
|
|
var sql6 = "";
|
|
|
|
|
|
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
|
|
|
}
|
|
|
,
|
|
|
|
|
|
//#region 生成凭证
|
|
|
//#region 加载事件
|
|
|
InitDataCw: function () {
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在查询主表数据...',
|
|
|
url: '/MvcShipping/RptCwGenlegAccitems/GetData',
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
var result = Ext.JSON.decode(response.responseText);
|
|
|
if (!result.Success) {
|
|
|
return;
|
|
|
}
|
|
|
data = result.data;
|
|
|
var arrtmp = data.toString().split("&");
|
|
|
this.strCwSTARTGID = arrtmp[0].toString();
|
|
|
var strCwSTARTNAME = arrtmp[1].toString();
|
|
|
var strCwACCDATE = arrtmp[2].toString();
|
|
|
var sYear = arrtmp[3].toString();
|
|
|
var sMonth = arrtmp[4].toString();
|
|
|
//
|
|
|
//var sZQ = " 当前登录账套:“" + strCwSTARTNAME + "” 当前财务账期:“" + sYear + "年第" + sMonth + "期” ";
|
|
|
//Ext.getCmp("lbTitle2").setValue(sZQ);
|
|
|
//this.onRefreshClick();
|
|
|
} else {
|
|
|
//Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
});
|
|
|
},
|
|
|
//#endregion
|
|
|
|
|
|
onAddCwVouchers: function (button, event) {
|
|
|
var strGids = this.editRecord.get('Feeid');
|
|
|
if (strGids == "") {
|
|
|
Ext.Msg.show({ title: '提示', msg: '请先保存单据!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
|
return;
|
|
|
}
|
|
|
//
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在预读数据,请稍候...',
|
|
|
url: '/Account/Chfee_management/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: '/Account/Chfee_management/onAddCwVouchers',
|
|
|
scope: this,
|
|
|
params: {
|
|
|
strGids: strGids,
|
|
|
dataDiv: Ext.JSON.encode(dataDiv),
|
|
|
jsonBody: jsonBody
|
|
|
},
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
Ext.MessageBox.hide();
|
|
|
var jsonresult = Ext.JSON.decode(response.responseText);
|
|
|
if (jsonresult.Success) {
|
|
|
Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.MessageBox.INFO, buttons: Ext.Msg.OK })
|
|
|
//
|
|
|
_this.isVOUALLNO = 1;
|
|
|
_this.InitData();
|
|
|
return;
|
|
|
} else {
|
|
|
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
|
|
|
}
|
|
|
} else {
|
|
|
Ext.Msg.show({ title: '请重试', msg: '服务器响应出错', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
|
|
|
}
|
|
|
},
|
|
|
timeout: 3000000//30秒
|
|
|
});
|
|
|
//
|
|
|
this.up('form').getForm().reset();
|
|
|
this.up('window').hide();
|
|
|
}
|
|
|
}, {
|
|
|
text: '取消',
|
|
|
handler: function () {
|
|
|
this.up('form').getForm().reset();
|
|
|
this.up('window').hide();
|
|
|
}
|
|
|
}],
|
|
|
listeners: {
|
|
|
scope: this,
|
|
|
'render': function (thisDiv, thisExtend) {
|
|
|
this.gridListCw.hide();
|
|
|
//
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在查询委托编号状态...',
|
|
|
url: '/MvcShipping/MsBaseInfo/GetCwVOUNO',
|
|
|
params: {
|
|
|
VKNO: "记"
|
|
|
},
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
var result = Ext.JSON.decode(response.responseText);
|
|
|
if (!result.Success) {
|
|
|
Ext.Msg.show({ title: '提示', msg: result.Message, icon: Ext.MessageBox.INFO, buttons: Ext.Msg.OK });
|
|
|
return;
|
|
|
}
|
|
|
//
|
|
|
data = result.data;
|
|
|
var arrayList = new Array();
|
|
|
arrayList = data.split("~");
|
|
|
var strY = arrayList[0].toString();
|
|
|
var strM = arrayList[1].toString();
|
|
|
var sVOUNO = arrayList[2].toString();
|
|
|
var strVOUNO = arrayList[3].toString();
|
|
|
var strVOUDATE = arrayList[4].toString();
|
|
|
var strACCDATE = arrayList[5].toString();
|
|
|
//
|
|
|
thisDiv.form.findField('VOUDATE').setValue(strVOUDATE);
|
|
|
thisDiv.form.findField('VOUDATE').setMinValue(strACCDATE + "-01");
|
|
|
} else {
|
|
|
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
//#endregion
|
|
|
|
|
|
win = Ext.widget('window', {
|
|
|
title: '辅助核算',
|
|
|
closeAction: 'hide',
|
|
|
width: 250,
|
|
|
height: 250,
|
|
|
layout: 'fit',
|
|
|
resizable: true,
|
|
|
modal: true,
|
|
|
closable: false,
|
|
|
items: formDiv
|
|
|
});
|
|
|
}
|
|
|
win.show();
|
|
|
}
|
|
|
//#endregion
|
|
|
//#endregion
|
|
|
});
|
|
|
|