|
|
Ext.namespace('Shipping');
|
|
|
|
|
|
Shipping.MsChInvoiceapplicationBLEdit = function (config) {
|
|
|
Ext.applyIf(this, config);
|
|
|
this.initUIComponents();
|
|
|
window.Shipping.MsChInvoiceapplicationBLEdit.superclass.constructor.call(this);
|
|
|
};
|
|
|
|
|
|
Ext.extend(Shipping.MsChInvoiceapplicationBLEdit, Ext.Panel, {
|
|
|
|
|
|
ParentWin: null,
|
|
|
OpStatus: 'add',
|
|
|
StoreList: null,
|
|
|
editRecord: null,
|
|
|
addstore: false,
|
|
|
PageSize: 30,
|
|
|
sqlcontext: '',
|
|
|
|
|
|
initUIComponents: function () {
|
|
|
this.serialNo = 0;
|
|
|
this.workSerialNo = 0;
|
|
|
this.bodyDel = [];
|
|
|
this.FeeSql = '';
|
|
|
this.BillSql = '';
|
|
|
this.DuiBillSql = '';
|
|
|
this.IsDebit = '0';
|
|
|
this.sortfield = '';
|
|
|
this.sortdire = '';
|
|
|
this.addsortfield = '';
|
|
|
this.addsortdire = '';
|
|
|
this.canedit = false;
|
|
|
this.selectfeesql = '';
|
|
|
this.firsttemplate = 1;
|
|
|
|
|
|
|
|
|
this.formname = "MsChInvoiceapplicationBLEdit"; //页面名称
|
|
|
|
|
|
this.bsnosql = getUrlParam('bsnosql');
|
|
|
this.bsCurr = getUrlParam('bsCurr');
|
|
|
this.bsCust = getUrlParam('bsCust');
|
|
|
this.isfeename = getUrlParam('isfeename');
|
|
|
this.salecorp = getUrlParam('salecorp');
|
|
|
|
|
|
|
|
|
|
|
|
this.INVOICEPORT = "";
|
|
|
this.INVAPPPRINTAFTERAUDIT = 0;
|
|
|
|
|
|
//parentWin = window.parent.opener;
|
|
|
//mainWin = getMainForm(parentWin);
|
|
|
if (!this.bsCust) {
|
|
|
parentWin = window.parent.opener;
|
|
|
mainWin = getMainForm(parentWin);
|
|
|
} else {
|
|
|
parentWin = window.parent.opener.parent.opener;
|
|
|
mainWin = getMainForm(parentWin);
|
|
|
}
|
|
|
|
|
|
//#region 枚举参照相关(编辑form)
|
|
|
this.comboxPUSHMODE = getEnumcombox({
|
|
|
LABEL: '开票通知推送',
|
|
|
NAME: 'PUSHMODE',
|
|
|
FLEX: 1,
|
|
|
enumTypeId: 80002
|
|
|
});
|
|
|
//#endregion
|
|
|
|
|
|
//#region store和combox
|
|
|
Ext.define('DsShipping.ux.MsClientGroup', {
|
|
|
extend: 'Ext.data.Model',
|
|
|
fields: [
|
|
|
{ name: 'SHORTNAME', type: 'string' },
|
|
|
{ name: 'PCORPNAME', type: 'string' },
|
|
|
{ name: 'CODENAME', type: 'string' }
|
|
|
]
|
|
|
});
|
|
|
|
|
|
|
|
|
this.StoreClientGroup = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'DsShipping.ux.MsClientGroup',
|
|
|
proxy: { url: '/MvcShipping/MsInfoClient/GetClientGroupList' }
|
|
|
});
|
|
|
this.StoreClientGroup.load({ params: { condition: "PCORPNAME<>'' " }
|
|
|
});
|
|
|
|
|
|
this.storeMustBe = Ext.create('Ext.data.Store', {
|
|
|
model: 'DsShipping.ux.OpDefValue',
|
|
|
remoteSort: true,
|
|
|
proxy: {
|
|
|
type: 'ajax',
|
|
|
url: '/MvcShipping/MsCodeOpMustField/GetDataList',
|
|
|
reader: {
|
|
|
id: 'GID',
|
|
|
root: 'data',
|
|
|
totalProperty: 'totalCount'
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
|
|
|
this.storecustbank = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'MsInfoClientBankModel',
|
|
|
proxy: { url: '/MvcShipping/MsInfoClient/GetBankList' }
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
this.comboxCustBank = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: '开户行及账号',
|
|
|
store: this.storecustbank,
|
|
|
// forceSelection: true,
|
|
|
name: 'CUSTBANK',
|
|
|
valueField: 'BANKNAME_ACCOUNT',
|
|
|
displayField: 'BANKNAME_ACCOUNT'
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
//#region 枚举参照相关(编辑form)
|
|
|
|
|
|
|
|
|
//表参照相关(编辑form)
|
|
|
|
|
|
this.storeCustCode = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'DsShipping.ux.CustomInvRefModel',
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetCustomInvRefListRm' }
|
|
|
});
|
|
|
//this.storeCustCode.loadData(this.mainWin.GetPubStore("PubStore_CustomerAll").data.items);
|
|
|
|
|
|
//this.storeCustCode.load({ params: { condition: ""} });
|
|
|
this.comboxCustCode = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: '开票单位',
|
|
|
allowBlank: false,
|
|
|
store: this.storeCustCode,
|
|
|
labelWidth: 60,
|
|
|
flex: 1.5,
|
|
|
//queryMode: 'remote',
|
|
|
//minChars: 2,
|
|
|
queryParam: 'CODENAME',
|
|
|
name: 'CUSTOMERNAME',
|
|
|
valueField: 'CustName',
|
|
|
displayField: 'CodeAndName',
|
|
|
listeners: {
|
|
|
scope: this,
|
|
|
'select': function (combo, records, eOpts) {
|
|
|
if (records.length > 0) {
|
|
|
var recs = DsStoreQueryBy(this.storeCustCode, 'CustName', records[0].data.CustName);
|
|
|
var INVOICECUSTNAME = this.formEdit.getForm().findField('INVOICECUSTNAME');
|
|
|
var CUSTRATENO = this.formEdit.getForm().findField('CUSTRATENO');
|
|
|
var CUSTADDRTEL = this.formEdit.getForm().findField('CUSTADDRTEL');
|
|
|
var CUSTBANK = this.formEdit.getForm().findField('CUSTBANK');
|
|
|
var CURR = this.formEdit.getForm().findField('CURRENCY').getValue();
|
|
|
if (recs.getCount() > 0) {
|
|
|
var data = recs.getAt(0).data;
|
|
|
INVOICECUSTNAME.setValue(data.BillRises1);
|
|
|
CUSTRATENO.setValue(data.TaxNo);
|
|
|
if (data.INVADDRTEL == '')
|
|
|
CUSTADDRTEL.setValue(data.Addr + ' ' + data.Tel);
|
|
|
else
|
|
|
CUSTADDRTEL.setValue(data.INVADDRTEL);
|
|
|
// CUSTADDRTEL.setValue(data.Addr + ' ' + data.Tel);
|
|
|
if (CURR == 'RMB') {
|
|
|
this.storecustbank.load({ params: { condition: " CURRENCY='RMB' AND LINKID=(SELECT TOP 1 GID FROM INFO_CLIENT WHERE SHORTNAME='" + records[0].data.CustName + "')" },
|
|
|
callback: function (r, options, success) {
|
|
|
if (success) {
|
|
|
if (r.length != 0) {
|
|
|
CUSTBANK.setValue(this.storecustbank.data.items[0].data.BANKNAME_ACCOUNT);
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
});
|
|
|
} else if (CURR == 'USD') {
|
|
|
this.storecustbank.load({ params: { condition: " CURRENCY='USD' AND LINKID=(SELECT TOP 1 GID FROM INFO_CLIENT WHERE SHORTNAME='" + records[0].data.CustName + "')" },
|
|
|
callback: function (r, options, success) {
|
|
|
if (success) {
|
|
|
if (r.length != 0) {
|
|
|
CUSTBANK.setValue(this.storecustbank.data.items[0].data.BANKNAME_ACCOUNT);
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
});
|
|
|
}
|
|
|
} else {
|
|
|
INVOICECUSTNAME.setValue('');
|
|
|
CUSTRATENO.setValue('');
|
|
|
CUSTADDRTEL.setValue('');
|
|
|
CUSTBANK.setValue('');
|
|
|
}
|
|
|
|
|
|
var CUSTOMERNAME = this.formEdit.getForm().findField('CUSTOMERNAME').getValue();
|
|
|
|
|
|
if (CUSTOMERNAME == '') return;
|
|
|
var CUSTNAME = this.formSearch.getForm().findField('CUSTNAME');
|
|
|
// var tmpcust = CUSTNAME.getValue();
|
|
|
// if (tmpcust == '' || tmpcust == null || tmpcust == undefined) {
|
|
|
CUSTNAME.setValue(CUSTOMERNAME);
|
|
|
|
|
|
// }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
this.storeInvCustCode = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'DsShipping.ux.CustomInvRefModel',
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetCustomInvRefListRm' }
|
|
|
});
|
|
|
|
|
|
this.storeInvCustCodeAdd = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'DsShipping.ux.CustomInvRefModel',
|
|
|
autoSync: true,
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetCustomInvRefList' }
|
|
|
});
|
|
|
|
|
|
|
|
|
this.comboxInvCustCode = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: '代开客户',
|
|
|
store: this.storeInvCustCode,
|
|
|
flex: 1.5,
|
|
|
labelWidth: 60,
|
|
|
queryMode: 'remote',
|
|
|
minChars: 1,
|
|
|
queryParam: 'CODENAME',
|
|
|
name: 'ACTUALCUSTOMERNAME',
|
|
|
valueField: 'CustName',
|
|
|
displayField: 'CodeAndName',
|
|
|
listeners: {
|
|
|
scope: this,
|
|
|
'select': function (combo, records, eOpts) {
|
|
|
if (records.length > 0) {
|
|
|
var recs = DsStoreQueryBy(this.storeInvCustCode, 'CustName', records[0].data.CustName);
|
|
|
var INVOICECUSTNAME = this.formEdit.getForm().findField('INVOICECUSTNAME');
|
|
|
var CUSTRATENO = this.formEdit.getForm().findField('CUSTRATENO');
|
|
|
var CUSTADDRTEL = this.formEdit.getForm().findField('CUSTADDRTEL');
|
|
|
var CUSTBANK = this.formEdit.getForm().findField('CUSTBANK');
|
|
|
var CURRFIELD = this.formEdit.getForm().findField('RECVCURR');
|
|
|
var CURR = CURRFIELD.getValue();
|
|
|
if (recs.getCount() > 0) {
|
|
|
var data = recs.getAt(0).data;
|
|
|
INVOICECUSTNAME.setValue(data.BillRises1);
|
|
|
CUSTRATENO.setValue(data.TaxNo);
|
|
|
if (data.INVADDRTEL == '')
|
|
|
CUSTADDRTEL.setValue(data.Addr + ' ' + data.Tel);
|
|
|
else
|
|
|
CUSTADDRTEL.setValue(data.INVADDRTEL);
|
|
|
// CUSTADDRTEL.setValue(data.Addr + ' ' + data.Tel);
|
|
|
if (CURR == 'RMB') {
|
|
|
this.storecustbank.load({ params: { condition: " CURRENCY='RMB' AND LINKID=(SELECT TOP 1 GID FROM INFO_CLIENT WHERE SHORTNAME='" + records[0].data.CustName + "')" },
|
|
|
callback: function (r, options, success) {
|
|
|
if (success) {
|
|
|
if (r.length != 0) {
|
|
|
CUSTBANK.setValue(this.storecustbank.data.items[0].data.BANKNAME_ACCOUNT);
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
});
|
|
|
} else if (CURR == 'USD') {
|
|
|
this.storecustbank.load({ params: { condition: " CURRENCY='USD' AND LINKID=(SELECT TOP 1 GID FROM INFO_CLIENT WHERE SHORTNAME='" + records[0].data.CustName + "')" },
|
|
|
callback: function (r, options, success) {
|
|
|
if (success) {
|
|
|
if (r.length != 0) {
|
|
|
CUSTBANK.setValue(this.storecustbank.data.items[0].data.BANKNAME_ACCOUNT);
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
});
|
|
|
}
|
|
|
} else {
|
|
|
INVOICECUSTNAME.setValue('');
|
|
|
CUSTRATENO.setValue('');
|
|
|
CUSTADDRTEL.setValue('');
|
|
|
CUSTBANK.setValue('');
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
this.StoreOpRange = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'MsOP',
|
|
|
proxy: { url: '/MvcShipping/MsBaseInfo/GetOpRang' }
|
|
|
});
|
|
|
|
|
|
this.StoreCurr = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'MsFeeCurr',
|
|
|
proxy: { url: '/MvcShipping/MsChFee/GetFeeCurrList' }
|
|
|
});
|
|
|
this.StoreCurr.load({ params: { condition: ""} });
|
|
|
|
|
|
this.StoreDateCurr = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'MsFeeCurr',
|
|
|
proxy: { url: '/MvcShipping/MsChFee/GetFeeNowInvCurrList' }
|
|
|
});
|
|
|
this.StoreDateCurr.load({ params: { condition: ""} });
|
|
|
|
|
|
this.comboxCurr = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: '币别',
|
|
|
store: this.StoreCurr,
|
|
|
forceSelection: true,
|
|
|
allowBlank: false,
|
|
|
labelWidth: 60,
|
|
|
name: 'CURRENCY',
|
|
|
value: 'RMB',
|
|
|
valueField: 'CURR',
|
|
|
displayField: 'CURR'
|
|
|
//listeners: {
|
|
|
// scope: this,
|
|
|
// 'select': function (combo, records, eOpts) {
|
|
|
// if (records.length > 0) {
|
|
|
|
|
|
// var CUSTOMERNAME = this.formEdit.getForm().findField('ACTUALCUSTOMERNAME').getValue();
|
|
|
// if (CUSTOMERNAME == '') {
|
|
|
// CUSTOMERNAME = this.formEdit.getForm().findField('CUSTOMERNAME').getValue();
|
|
|
// }
|
|
|
// if (CUSTOMERNAME == '') return;
|
|
|
// var CURR = records[0].data.CURR;
|
|
|
// var CUSTBANK = this.formEdit.getForm().findField('CUSTBANK');
|
|
|
// var recs = DsStoreQueryBy(this.storeInvCustCodeAdd, 'CustName', CUSTOMERNAME);
|
|
|
// if (recs.getCount() > 0) {
|
|
|
// var data = recs.getAt(0).data;
|
|
|
// if (CURR == 'RMB') {
|
|
|
// this.storecustbank.load({ params: { condition: " CURRENCY='RMB' AND LINKID=(SELECT TOP 1 GID FROM INFO_CLIENT WHERE SHORTNAME='" + CUSTOMERNAME + "')" },
|
|
|
// callback: function (r, options, success) {
|
|
|
// if (success) {
|
|
|
// if (r.length != 0) {
|
|
|
// CUSTBANK.setValue(this.storecustbank.data.items[0].data.BANKNAME_ACCOUNT);
|
|
|
// }
|
|
|
// }
|
|
|
// },
|
|
|
// scope: this
|
|
|
// });
|
|
|
// } else if (CURR == 'USD') {
|
|
|
// this.storecustbank.load({ params: { condition: " CURRENCY='USD' AND LINKID=(SELECT TOP 1 GID FROM INFO_CLIENT WHERE SHORTNAME='" + CUSTOMERNAME + "')" },
|
|
|
// callback: function (r, options, success) {
|
|
|
// if (success) {
|
|
|
// if (r.length != 0) {
|
|
|
// CUSTBANK.setValue(this.storecustbank.data.items[0].data.BANKNAME_ACCOUNT);
|
|
|
// }
|
|
|
// }
|
|
|
// },
|
|
|
// scope: this
|
|
|
// });
|
|
|
// }
|
|
|
// } else {
|
|
|
// CUSTBANK.setValue('');
|
|
|
// }
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
//}
|
|
|
});
|
|
|
|
|
|
this.StoreCurr2 = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'MsFeeCurr',
|
|
|
proxy: { url: '/MvcShipping/MsChFee/GetFeeCurrList' }
|
|
|
});
|
|
|
this.StoreCurr2.load({ params: { condition: ""} });
|
|
|
|
|
|
this.comboxCurr2 = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: '发票币别',
|
|
|
store: this.StoreCurr2,
|
|
|
forceSelection: true,
|
|
|
labelWidth: 60,
|
|
|
name: 'RECVCURR',
|
|
|
valueField: 'CURR',
|
|
|
displayField: 'CURR',
|
|
|
listeners: {
|
|
|
scope: this,
|
|
|
'select': function (combo, records, eOpts) {
|
|
|
if (records.length > 0) {
|
|
|
|
|
|
var CUSTOMERNAME = this.formEdit.getForm().findField('ACTUALCUSTOMERNAME').getValue();
|
|
|
if (CUSTOMERNAME == '') {
|
|
|
CUSTOMERNAME = this.formEdit.getForm().findField('CUSTOMERNAME').getValue();
|
|
|
}
|
|
|
if (CUSTOMERNAME == '') return;
|
|
|
var CURR = records[0].data.CURR;
|
|
|
var CUSTBANK = this.formEdit.getForm().findField('CUSTBANK');
|
|
|
var recs = DsStoreQueryBy(this.storeInvCustCodeAdd, 'CustName', CUSTOMERNAME);
|
|
|
if (recs.getCount() > 0) {
|
|
|
var data = recs.getAt(0).data;
|
|
|
if (CURR == 'RMB') {
|
|
|
this.storecustbank.load({ params: { condition: " CURRENCY='RMB' AND LINKID=(SELECT TOP 1 GID FROM INFO_CLIENT WHERE SHORTNAME='" + CUSTOMERNAME + "')" },
|
|
|
callback: function (r, options, success) {
|
|
|
if (success) {
|
|
|
if (r.length != 0) {
|
|
|
CUSTBANK.setValue(this.storecustbank.data.items[0].data.BANKNAME_ACCOUNT);
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
});
|
|
|
} else if (CURR == 'USD') {
|
|
|
this.storecustbank.load({ params: { condition: " CURRENCY='USD' AND LINKID=(SELECT TOP 1 GID FROM INFO_CLIENT WHERE SHORTNAME='" + CUSTOMERNAME + "')" },
|
|
|
callback: function (r, options, success) {
|
|
|
if (success) {
|
|
|
if (r.length != 0) {
|
|
|
CUSTBANK.setValue(this.storecustbank.data.items[0].data.BANKNAME_ACCOUNT);
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
});
|
|
|
}
|
|
|
} else {
|
|
|
CUSTBANK.setValue('');
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
|
|
|
this.storeInvCategory = Ext.create('DsExt.ux.RefEnumStore', {});
|
|
|
this.storeInvCategory.load({ params: { enumTypeId: 97008} });
|
|
|
|
|
|
this.comboxInvCategory = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: '发票类型',
|
|
|
store: this.storeInvCategory,
|
|
|
labelWidth: 60,
|
|
|
forceSelection: true,
|
|
|
name: 'INVOICECATEGORY',
|
|
|
valueField: 'EnumValueId',
|
|
|
displayField: 'EnumValueName'
|
|
|
});
|
|
|
|
|
|
this.storeCompany = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'companymb', proxy: { url: '/CommMng/BasicDataRef/GetcompanyList' }
|
|
|
});
|
|
|
this.storeCompany.load({ params: { condition: ""} });
|
|
|
this.comboxCompany = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: '开票所属分部', flex: 1.5,
|
|
|
labelWidth: 78,
|
|
|
forceSelection: true,
|
|
|
store: this.storeCompany,
|
|
|
id: 'PAYCOMPANYID',
|
|
|
name: 'PAYCOMPANYID',
|
|
|
valueField: 'gid',
|
|
|
displayField: 'name'
|
|
|
});
|
|
|
|
|
|
|
|
|
this.storeInfoClientMailTel = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'DsShipping.ux.InfoClientContactModel',
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetInfoClientMailTel' }
|
|
|
});
|
|
|
this.comboxInfoClientMailTel = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
labelWidth: 55,
|
|
|
fieldLabel: '推送邮箱',
|
|
|
flex: 1.4,
|
|
|
store: this.storeInfoClientMailTel,
|
|
|
forceSelection: false,
|
|
|
name: 'PUSHEMAIL',
|
|
|
valueField: 'EMAIL',
|
|
|
displayField: 'NAMEANDEMAIL',
|
|
|
listeners: {
|
|
|
focus: function (field, newValue, oldValue) {
|
|
|
//在focus时 如果记录数为1 则载入
|
|
|
|
|
|
var CUSTOMERNAME = this.formEdit.getForm().findField('CUSTOMERNAME').getValue();
|
|
|
_this = this;
|
|
|
var currmail = this.formEdit.getForm().findField('PUSHEMAIL').getValue();
|
|
|
if (!isNullorEmpty(CUSTOMERNAME))
|
|
|
this.storeInfoClientMailTel.load({
|
|
|
params: { CUSTOMERNAME: CUSTOMERNAME }
|
|
|
,
|
|
|
callback: function (r, options, success) {
|
|
|
if (!isNullorEmpty(currmail)) {
|
|
|
Data_pushmail = { EMAIL: currmail, NAMEANDEMAIL: currmail };
|
|
|
_this.storeInfoClientMailTel.add(Data_pushmail);
|
|
|
_this.formEdit.getForm().findField('PUSHEMAIL').setValue(currmail);
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
});
|
|
|
},
|
|
|
scope: this
|
|
|
}
|
|
|
});
|
|
|
//#endregion
|
|
|
|
|
|
//#region 编辑form
|
|
|
this.formEdit = Ext.widget('form', {
|
|
|
region: 'center',
|
|
|
frame: true,
|
|
|
bodyPadding: 0,
|
|
|
trackResetOnLoad: true,
|
|
|
|
|
|
// autoScroll: true,
|
|
|
fieldDefaults: {
|
|
|
margins: '2 2 2 2',
|
|
|
labelAlign: 'right',
|
|
|
flex: 1,
|
|
|
labelWidth: 90,
|
|
|
msgTarget: 'qtip'
|
|
|
},
|
|
|
|
|
|
items: [
|
|
|
{//fieldset 1
|
|
|
xtype: 'container',
|
|
|
defaultType: 'textfield',
|
|
|
layout: 'anchor',
|
|
|
defaults: {
|
|
|
anchor: '100%'
|
|
|
},
|
|
|
items: [
|
|
|
//第一行
|
|
|
{
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [
|
|
|
|
|
|
{
|
|
|
fieldLabel: 'GID',
|
|
|
name: 'GID', flex: 0, hidden: true, margins: '0'
|
|
|
}, {
|
|
|
fieldLabel: 'BILLSTATUS',
|
|
|
name: 'BILLSTATUS', flex: 0, hidden: true, margins: '0'
|
|
|
}, {
|
|
|
fieldLabel: 'APPLICANT',
|
|
|
name: 'APPLICANT', flex: 0, hidden: true, margins: '0'
|
|
|
}, {
|
|
|
fieldLabel: 'COMPANYID',
|
|
|
name: 'COMPANYID', flex: 0, hidden: true, margins: '0'
|
|
|
},
|
|
|
{
|
|
|
fieldLabel: '申请编号',
|
|
|
readOnly: true,
|
|
|
flex: 1.5,
|
|
|
name: 'BILLNO'
|
|
|
}, {
|
|
|
fieldLabel: '状态',
|
|
|
readOnly: true,
|
|
|
flex: 1,
|
|
|
name: 'BILLSTATUSREF'
|
|
|
},
|
|
|
{
|
|
|
fieldLabel: '申请人',
|
|
|
readOnly: true,
|
|
|
flex: 1,
|
|
|
name: 'APPLICANTNAME'
|
|
|
},
|
|
|
{
|
|
|
fieldLabel: '申请开票日期',
|
|
|
format: 'Y-m-d',
|
|
|
flex: 1.5,
|
|
|
xtype: 'datefield',
|
|
|
name: 'APPLYTIME'
|
|
|
}, {
|
|
|
fieldLabel: '发票号',
|
|
|
flex: 1.5,
|
|
|
name: 'INVOICENO'
|
|
|
}, {
|
|
|
fieldLabel: '实际开出发票号',
|
|
|
flex: 1.5,
|
|
|
readOnly: true,
|
|
|
name: 'INVOICENOREF'
|
|
|
}
|
|
|
]
|
|
|
}
|
|
|
,
|
|
|
//第二行
|
|
|
{//container2
|
|
|
xtype: 'container',
|
|
|
defaultType: 'textfield',
|
|
|
layout: 'anchor',
|
|
|
defaults: {
|
|
|
anchor: '100%'
|
|
|
},
|
|
|
items: [{
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [
|
|
|
{ xtype: 'hiddenfield', flex: 6.5}]
|
|
|
}]
|
|
|
} //end items(fieldset 1)
|
|
|
]//end items(fieldset 1)
|
|
|
}, //end fieldset 1
|
|
|
|
|
|
{
|
|
|
xtype: 'fieldset',
|
|
|
defaultType: 'textfield',
|
|
|
layout: 'hbox',
|
|
|
defaults: {
|
|
|
anchor: '100%'
|
|
|
},
|
|
|
items: [{
|
|
|
xtype: 'container',
|
|
|
layout: 'anchor',
|
|
|
flex: 3,
|
|
|
defaultType: 'textfield',
|
|
|
margins: '7 2 2 2',
|
|
|
items: [
|
|
|
{
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [{
|
|
|
fieldLabel: '发票抬头',
|
|
|
name: 'INVOICECUSTNAME'
|
|
|
}]
|
|
|
|
|
|
}, {
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [{
|
|
|
fieldLabel: '纳税人识别号',
|
|
|
name: 'CUSTRATENO'
|
|
|
}]
|
|
|
|
|
|
}, {
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [{
|
|
|
fieldLabel: '地址、电话',
|
|
|
name: 'CUSTADDRTEL'
|
|
|
}]
|
|
|
|
|
|
}, {
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [this.comboxCustBank]
|
|
|
|
|
|
},
|
|
|
{
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',id:"pushform",hidden:true,
|
|
|
defaultType: 'textfield',
|
|
|
items: [this.comboxPUSHMODE, {
|
|
|
labelWidth: 60,
|
|
|
fieldLabel: '*推送手机',
|
|
|
flex: 1.1,
|
|
|
name: 'PUSHMOBILE'
|
|
|
},
|
|
|
//{
|
|
|
// labelWidth: 55,
|
|
|
// fieldLabel: '推送邮箱',
|
|
|
// flex: 1.4,
|
|
|
// name: 'PUSHEMAIL'
|
|
|
// }
|
|
|
this.comboxInfoClientMailTel
|
|
|
]
|
|
|
}
|
|
|
]
|
|
|
}, {
|
|
|
xtype: 'fieldset',
|
|
|
defaultType: 'textfield',
|
|
|
flex: 5,
|
|
|
layout: 'anchor',
|
|
|
defaults: {
|
|
|
anchor: '100%'
|
|
|
},
|
|
|
items: [{
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
flex: 1,
|
|
|
defaultType: 'textfield',
|
|
|
items: [this.comboxCurr, this.comboxInvCategory, this.comboxCurr2, this.comboxCustCode, this.comboxInvCustCode]
|
|
|
|
|
|
}, {
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
flex: 1,
|
|
|
defaultType: 'textfield',
|
|
|
items: [{
|
|
|
fieldLabel: '申请金额',
|
|
|
labelWidth: 60,
|
|
|
name: 'APPLYAMOUNT',
|
|
|
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
|
|
|
try {
|
|
|
var lsValue = usMoney(value, 2, '', false);
|
|
|
if (lsValue != "NaN") {
|
|
|
value = lsValue; if (parseFloat(lsValue) < 0) {
|
|
|
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
return value;
|
|
|
}
|
|
|
}
|
|
|
catch (e) {
|
|
|
return value;
|
|
|
}
|
|
|
return value;
|
|
|
}
|
|
|
}, {
|
|
|
fieldLabel: '开票金额',
|
|
|
labelWidth: 60,
|
|
|
name: 'INVAMOUNT',
|
|
|
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
|
|
|
try {
|
|
|
var lsValue = usMoney(value, 2, '', false);
|
|
|
if (lsValue != "NaN") {
|
|
|
value = lsValue; if (parseFloat(lsValue) < 0) {
|
|
|
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
return value;
|
|
|
}
|
|
|
}
|
|
|
catch (e) {
|
|
|
return value;
|
|
|
}
|
|
|
return value;
|
|
|
}
|
|
|
}, {
|
|
|
fieldLabel: '税率',
|
|
|
labelWidth: 60,
|
|
|
name: 'RATE',
|
|
|
listeners: {
|
|
|
scope: this,
|
|
|
blur: function (field, The, eOpts) {
|
|
|
_this.ChangeInvRate(field.value);
|
|
|
|
|
|
}
|
|
|
}
|
|
|
}, {
|
|
|
fieldLabel: '外币金额',
|
|
|
flex: 1.5,
|
|
|
labelWidth: 60,
|
|
|
name: 'OTCURRAMOUNT',
|
|
|
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.comboxCompany]
|
|
|
|
|
|
}
|
|
|
|
|
|
, {
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
flex: 2,
|
|
|
defaultType: 'textfield',
|
|
|
items: [{
|
|
|
xtype: 'textareafield',
|
|
|
labelWidth: 60,
|
|
|
grow: true,
|
|
|
flex: 2,
|
|
|
height: 80,
|
|
|
name: 'REMARK',
|
|
|
fieldLabel: '备注',
|
|
|
anchor: '100%'
|
|
|
}, {
|
|
|
xtype: 'fieldset',
|
|
|
defaultType: 'textfield',
|
|
|
layout: 'anchor',
|
|
|
region: 'east',
|
|
|
width: 80,
|
|
|
defaults: {
|
|
|
anchor: '100%'
|
|
|
},
|
|
|
items: [{
|
|
|
xtype: 'button',
|
|
|
text: "提取备注",
|
|
|
handler: function (button, event) {
|
|
|
_this.ImportRemarks();
|
|
|
},
|
|
|
scope: this
|
|
|
}, {
|
|
|
xtype: 'button',
|
|
|
text: "模板设置",
|
|
|
handler: function (button, event) {
|
|
|
|
|
|
_this.SetRemarksTemplate();
|
|
|
},
|
|
|
scope: this
|
|
|
}]
|
|
|
}, {
|
|
|
xtype: 'textareafield',
|
|
|
labelWidth: 60,
|
|
|
grow: true,
|
|
|
flex: 2,
|
|
|
height: 80,
|
|
|
name: 'SHENREMARK',
|
|
|
fieldLabel: '开票要求',
|
|
|
anchor: '100%'
|
|
|
}]
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
]
|
|
|
}
|
|
|
]//end items(fieldset 2)
|
|
|
}
|
|
|
|
|
|
]//end root items
|
|
|
|
|
|
|
|
|
|
|
|
}); //end this.formEdit
|
|
|
|
|
|
//#endregion
|
|
|
|
|
|
//#region 按钮Toolbar
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.panelBtn = new Ext.Panel({
|
|
|
region: "north",
|
|
|
tbar: [
|
|
|
{
|
|
|
id: 'btnEPrev',
|
|
|
text: "上一票",
|
|
|
// iconCls: "btnsave",
|
|
|
handler: function (button, event) {
|
|
|
this.PrevRecord();
|
|
|
},
|
|
|
scope: this
|
|
|
}, {
|
|
|
id: 'btnENext',
|
|
|
text: "下一票",
|
|
|
// iconCls: "btnsave",
|
|
|
handler: function (button, event) {
|
|
|
this.NextRecord();
|
|
|
},
|
|
|
scope: this
|
|
|
}, {
|
|
|
id: 'btnESave',
|
|
|
text: "保存",
|
|
|
iconCls: "btnsave",
|
|
|
handler: function (button, event) {
|
|
|
this.Save('0', '0', false);
|
|
|
},
|
|
|
scope: this
|
|
|
}, '-',
|
|
|
{
|
|
|
text: "打印",
|
|
|
handler: function (button, event) {
|
|
|
this.Print();
|
|
|
},
|
|
|
scope: this
|
|
|
},
|
|
|
'-',
|
|
|
{
|
|
|
id: 'btnESaveAndClose',
|
|
|
text: "保存并关闭",
|
|
|
handler: function (button, event) {
|
|
|
this.Save('1', '0', false);
|
|
|
},
|
|
|
scope: this
|
|
|
},
|
|
|
'-',
|
|
|
{
|
|
|
id: 'btnESaveAndNew',
|
|
|
text: "保存并新建",
|
|
|
handler: function (button, event) {
|
|
|
this.Save('2', '0', false);
|
|
|
this.GetEditStatus();
|
|
|
},
|
|
|
scope: this
|
|
|
},
|
|
|
'-',
|
|
|
{
|
|
|
id: 'btnENew',
|
|
|
text: "新建",
|
|
|
handler: function (button, event) {
|
|
|
this.LoadData('add', '*');
|
|
|
},
|
|
|
scope: this
|
|
|
}, '-', {
|
|
|
id: 'btnSubmitAudit',
|
|
|
text: '提交审核',
|
|
|
tooltip: '提交审核',
|
|
|
handler: function (button, event) {
|
|
|
var RECVCURR = this.formEdit.getForm().findField('RECVCURR').getValue();
|
|
|
var OTCURRAMOUNT = this.formEdit.getForm().findField('OTCURRAMOUNT').getValue();
|
|
|
if (RECVCURR == 'RMB' && OTCURRAMOUNT != 0) {
|
|
|
Ext.MessageBox.confirm("提示", "此发票存在外币,确认要申请RMB发票吗?", function (btn) {
|
|
|
if (btn == 'yes') {
|
|
|
_this.Save('0', '0', true);
|
|
|
}
|
|
|
}, this);
|
|
|
} else this.Save('0', '0', true);
|
|
|
// this.onSubmitAuditClick();
|
|
|
},
|
|
|
scope: this
|
|
|
}, '-', {
|
|
|
id: 'btnSubmitAuditBack',
|
|
|
text: '撤销提交',
|
|
|
tooltip: '撤销提交',
|
|
|
handler: function (button, event) {
|
|
|
this.onSubmitAuditBackClick();
|
|
|
},
|
|
|
scope: this
|
|
|
}
|
|
|
]
|
|
|
}); //end 按钮Toolbar
|
|
|
|
|
|
//#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//#region发票明细
|
|
|
|
|
|
this.StoreCodeGoodInv = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'MsCodeGoodInv',
|
|
|
proxy: { url: '/MvcShipping/MsCodeGoodInv/GetDataList' }
|
|
|
});
|
|
|
this.StoreCodeGoodInv.load({ params: { condition: "" }
|
|
|
});
|
|
|
|
|
|
this.comboxCodeGoodInv = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
store: this.StoreCodeGoodInv,
|
|
|
forceSelection: true,
|
|
|
valueField: 'GID',
|
|
|
displayField: 'GOODCODENAME'
|
|
|
});
|
|
|
|
|
|
this.GridDetailCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
|
|
|
//明细表-数据集
|
|
|
this.storeDetailList = Ext.create('Ext.data.Store', {
|
|
|
model: 'MsChInvoiceDetail',
|
|
|
remoteSort: true,
|
|
|
proxy: {
|
|
|
type: 'ajax',
|
|
|
url: '/Account/Chfee_invoiceapplication/GetDetailList',
|
|
|
reader: {
|
|
|
id: 'GID',
|
|
|
root: 'data',
|
|
|
totalProperty: 'totalCount'
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
//明细表表格
|
|
|
this.gridDetailCellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
|
|
|
clicksToEdit: 1
|
|
|
});
|
|
|
|
|
|
|
|
|
this.gridDetailList = new Ext.grid.GridPanel({
|
|
|
store: this.storeDetailList,
|
|
|
enableHdMenu: false,
|
|
|
region: 'center',
|
|
|
loadMask: { msg: "数据加载中,请稍等..." },
|
|
|
trackMouseOver: true,
|
|
|
disableSelection: false,
|
|
|
// columnLines: true,
|
|
|
selModel: this.GridDetailCheckBoxModel,
|
|
|
plugins: [this.gridDetailCellEditing],
|
|
|
features: [{
|
|
|
ftype: 'summary'//Ext.grid.feature.Summary表格汇总特性
|
|
|
}],
|
|
|
tbar: [{
|
|
|
text: '添加发票明细',
|
|
|
tooltip: '添加发票明细',
|
|
|
id: 'btnAddInvdetail',
|
|
|
iconCls: "btnadddetail",
|
|
|
handler: function (button, event) {
|
|
|
this.onAddInvDetailClick();
|
|
|
},
|
|
|
scope: this
|
|
|
}, {
|
|
|
text: '删除发票明细',
|
|
|
tooltip: '删除发票明细',
|
|
|
id: 'btndelInvdetail',
|
|
|
iconCls: "btndeletedetail",
|
|
|
handler: function (button, event) {
|
|
|
this.onDelInvDetailClick();
|
|
|
},
|
|
|
scope: this
|
|
|
}],
|
|
|
columns: [{
|
|
|
sortable: true,
|
|
|
dataIndex: 'GID',
|
|
|
header: 'GID',
|
|
|
hidden: true,
|
|
|
width: 100
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'PID',
|
|
|
header: 'PID',
|
|
|
hidden: true,
|
|
|
width: 100
|
|
|
}, {
|
|
|
sortable: false,
|
|
|
dataIndex: 'SERIALNO',
|
|
|
header: 'SERIALNO',
|
|
|
hidden: true,
|
|
|
width: 100
|
|
|
}, {
|
|
|
sortable: false,
|
|
|
dataIndex: 'GOODSNAME',
|
|
|
header: '货物或应税劳务名称',
|
|
|
editor: this.comboxCodeGoodInv,
|
|
|
renderer: function (value, p, record) {
|
|
|
return record.data.GOODSNAMEREF;
|
|
|
},
|
|
|
summaryType: 'count',
|
|
|
width: 120
|
|
|
}, {
|
|
|
sortable: false,
|
|
|
dataIndex: 'SPEC',
|
|
|
header: '规格型号',
|
|
|
editor: {
|
|
|
xtype: 'textfield',
|
|
|
allowBlank: false,
|
|
|
selectOnFocus: true
|
|
|
},
|
|
|
width: 120
|
|
|
}, {
|
|
|
sortable: false,
|
|
|
dataIndex: 'UNIT',
|
|
|
header: '单位',
|
|
|
editor: {
|
|
|
xtype: 'textfield',
|
|
|
allowBlank: false,
|
|
|
selectOnFocus: true
|
|
|
},
|
|
|
width: 100
|
|
|
}, {
|
|
|
sortable: false,
|
|
|
dataIndex: 'PKGS',
|
|
|
header: '数量',
|
|
|
editor: {
|
|
|
xtype: 'numberfield',
|
|
|
allowBlank: false,
|
|
|
selectOnFocus: true
|
|
|
},
|
|
|
width: 80
|
|
|
}, {
|
|
|
sortable: false,
|
|
|
dataIndex: 'TAXPRICE',
|
|
|
header: '含税单价',
|
|
|
editor: {
|
|
|
xtype: 'numberfield',
|
|
|
allowBlank: false,
|
|
|
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;
|
|
|
},
|
|
|
summaryType: 'sum',
|
|
|
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
|
|
|
value = usMoney(value, 2, '', true);
|
|
|
return value;
|
|
|
},
|
|
|
width: 80
|
|
|
}, {
|
|
|
sortable: false,
|
|
|
dataIndex: 'PRICE',
|
|
|
header: '单价',
|
|
|
editor: {
|
|
|
xtype: 'numberfield',
|
|
|
allowBlank: false,
|
|
|
selectOnFocus: true
|
|
|
},
|
|
|
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
|
|
|
try {
|
|
|
var lsValue = usMoney(value, 2, '', false);
|
|
|
if (lsValue != "NaN") {
|
|
|
value = lsValue; if (parseFloat(lsValue) < 0) {
|
|
|
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
return value;
|
|
|
}
|
|
|
}
|
|
|
catch (e) {
|
|
|
return value;
|
|
|
}
|
|
|
return value;
|
|
|
},
|
|
|
width: 80
|
|
|
}, {
|
|
|
sortable: false,
|
|
|
dataIndex: 'AMOUNT',
|
|
|
editor: {
|
|
|
xtype: 'numberfield',
|
|
|
allowBlank: false,
|
|
|
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;
|
|
|
},
|
|
|
summaryType: 'sum',
|
|
|
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
|
|
|
value = usMoney(value, 2, '', true);
|
|
|
return value;
|
|
|
},
|
|
|
header: '金额',
|
|
|
width: 80
|
|
|
}, {
|
|
|
sortable: false,
|
|
|
dataIndex: 'TAXRATE',
|
|
|
editor: {
|
|
|
xtype: 'numberfield',
|
|
|
allowBlank: false,
|
|
|
selectOnFocus: true
|
|
|
},
|
|
|
header: '税率',
|
|
|
width: 80
|
|
|
}, {
|
|
|
sortable: false,
|
|
|
dataIndex: 'TAX',
|
|
|
header: '税额',
|
|
|
editor: {
|
|
|
xtype: 'numberfield',
|
|
|
allowBlank: false,
|
|
|
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;
|
|
|
},
|
|
|
summaryType: 'sum',
|
|
|
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
|
|
|
value = usMoney(value, 2, '', true);
|
|
|
return value;
|
|
|
},
|
|
|
width: 80
|
|
|
}
|
|
|
]
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.gridDetailList.on('edit', function (editor, e, eOpts) {
|
|
|
this.gridListDetailAfterEdit(editor, e, eOpts);
|
|
|
}, this);
|
|
|
|
|
|
|
|
|
|
|
|
//#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//#region 明细表
|
|
|
|
|
|
//明细表表格相关
|
|
|
|
|
|
this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
|
|
|
//明细表-数据集
|
|
|
this.storeBodyList = Ext.create('Ext.data.Store', {
|
|
|
model: 'Chfee_do_detail',
|
|
|
remoteSort: true,
|
|
|
proxy: {
|
|
|
type: 'ajax',
|
|
|
url: '/Account/Chfee_invoiceapplication/GetBillList',
|
|
|
timeout: 120000,
|
|
|
reader: {
|
|
|
id: 'BSNO,FEEDOID',
|
|
|
root: 'data',
|
|
|
totalProperty: 'totalCount'
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
//明细表表格
|
|
|
this.gridListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
|
|
|
clicksToEdit: 1
|
|
|
});
|
|
|
|
|
|
this.initgirdcolums = [{
|
|
|
sortable: true,
|
|
|
dataIndex: 'BILLNO',
|
|
|
header: 'BILL',
|
|
|
hidden: true,
|
|
|
width: 100
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'BSNO',
|
|
|
header: 'BSNO',
|
|
|
hidden: true,
|
|
|
width: 100
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'FEEDOID',
|
|
|
header: 'FEEDOID',
|
|
|
hidden: true,
|
|
|
width: 100
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'CUSTNO',
|
|
|
header: '委托编号',
|
|
|
width: 120
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'MBLNO',
|
|
|
header: '主提单号',
|
|
|
width: 120
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'CUSTOMERNAME',
|
|
|
header: '委托单位',
|
|
|
width: 100
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'ETD',
|
|
|
header: '开船日期',
|
|
|
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
|
|
|
width: 100
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'BSSOURCE',
|
|
|
header: '业务来源',
|
|
|
width: 80
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'FEENAME',
|
|
|
header: '费用名称',
|
|
|
width: 80
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'FEETYPEREF',
|
|
|
header: '收付',
|
|
|
width: 40
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'AMOUNT',
|
|
|
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: 'ORIGCURRENCY',
|
|
|
header: '原始币别',
|
|
|
width: 80
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'ORIGEXCHANGERATE',
|
|
|
header: '原始汇率',
|
|
|
width: 80
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'EXCHANGERATE',
|
|
|
header: '折算汇率',
|
|
|
width: 80
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'ACCTAXRATE',
|
|
|
header: '销项/进项税率',
|
|
|
width: 80
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'ORIGAMOUNT',
|
|
|
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: 'SALE',
|
|
|
header: '揽货人',
|
|
|
width: 80
|
|
|
}, {
|
|
|
sortable: false,
|
|
|
dataIndex: 'INPUTMODE',
|
|
|
header: '录入方式',
|
|
|
width: 60
|
|
|
}, {
|
|
|
sortable: false,
|
|
|
dataIndex: 'COMPANYNAME',
|
|
|
header: '所属分部',
|
|
|
width: 60
|
|
|
}, {
|
|
|
sortable: false,
|
|
|
dataIndex: 'ENTERP',
|
|
|
header: '经营单位',
|
|
|
width: 60
|
|
|
}, {
|
|
|
sortable: false,
|
|
|
dataIndex: 'ACCDATE',
|
|
|
header: '会计期间',
|
|
|
width: 60
|
|
|
}
|
|
|
];
|
|
|
|
|
|
this.girdbillcolums = this.initgirdcolums;
|
|
|
|
|
|
this.gridList = new Ext.grid.GridPanel({
|
|
|
store: this.storeBodyList,
|
|
|
enableHdMenu: false,
|
|
|
region: 'center',
|
|
|
|
|
|
loadMask: { msg: "数据加载中,请稍等..." },
|
|
|
trackMouseOver: true,
|
|
|
disableSelection: false,
|
|
|
viewConfig: {
|
|
|
enableTextSelection: true
|
|
|
},
|
|
|
selModel: this.GridCheckBoxModel,
|
|
|
tbar: [{
|
|
|
xtype:'label',
|
|
|
text: '费用申请明细:'
|
|
|
},{
|
|
|
text: '删除申请明细',
|
|
|
tooltip: '删除申请明细',
|
|
|
id: 'btndeldetail',
|
|
|
iconCls: "btndeletedetail",
|
|
|
handler: function (button, event) {
|
|
|
this.onDeleteClick(button, event, 1);
|
|
|
},
|
|
|
scope: this
|
|
|
}, '-', {
|
|
|
text: '保存列表样式', //保存列表样式
|
|
|
id: "btntestbody",
|
|
|
menu: [
|
|
|
{
|
|
|
text: '保存', //保存
|
|
|
handler: function (button, event) {
|
|
|
_this.girdbillcolums = DsTruck.SaveGridPanel(USERID, _this.formname + 'bill', _this.gridList.columns, _this.girdbillcolums, 1, true);
|
|
|
}
|
|
|
}, {
|
|
|
text: '初始化', //初始化
|
|
|
handler: function (menu, event) {
|
|
|
_this.girdbillcolums = DsTruck.SaveGridPanel(USERID, _this.formname + 'bill', _this.gridList.columns, _this.initgirdbillcolums, 1, true);
|
|
|
}
|
|
|
}],
|
|
|
scope: this
|
|
|
},
|
|
|
{
|
|
|
fieldLabel: "单号",
|
|
|
labelWidth: 40,
|
|
|
xtype: 'textfield',
|
|
|
name: 'BSNO',
|
|
|
listeners: {
|
|
|
specialkey: function (field, e) {
|
|
|
if (e.getKey() == e.ENTER) {
|
|
|
var billno = _this.formEdit.getForm().findField('BILLNO').getValue();
|
|
|
var mblno = field.value;
|
|
|
var sql = " BILLNO='" + billno + "' and (b.MBLNO+' '+b.HBLNO+' '+b.CUSTNO like '%" + mblno + "%') ";
|
|
|
|
|
|
_this.storeBodyList.load({ params: { condition: sql } });
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}],
|
|
|
columns: this.girdbillcolums
|
|
|
});
|
|
|
|
|
|
this.gridList.addListener('sortchange', function (ct, column, direction, eOpts) {
|
|
|
this.sortfield = column.dataIndex;
|
|
|
this.sortdire = direction;
|
|
|
}, this);
|
|
|
|
|
|
this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
|
|
|
this.SelectedRecord = record;
|
|
|
var openSet = "height=700, width=1024, toolbar=no, menubar=no,scrollbars=1, resizable=1,location=no, status=no,Top= " + (screen.height - 750) / 2 + ",Left= " + (screen.width - 1100) / 2
|
|
|
var openType = "_blank";
|
|
|
var openUrl = "";
|
|
|
openUrl = "../../MvcShipping/MsOpBill/MsOpFeeView?handle=check&bsno=" + record.data.BSNO;
|
|
|
|
|
|
window.open(openUrl, openType, openSet);
|
|
|
}, this);
|
|
|
|
|
|
this.girdbillcolums = DsTruck.GetGridPanel(USERID, this.formname + 'bill', this.girdbillcolums, 1); //使用者id,表名,中间column数组,跳过一开始的几列
|
|
|
this.girdbillcolums.unshift(new Ext.grid.RowNumberer());
|
|
|
this.gridList.reconfigure(this.storeBodyList, this.girdbillcolums);
|
|
|
|
|
|
|
|
|
this.storeBodySum = Ext.create('Ext.data.Store', {
|
|
|
model: 'Chfee_do_sum',
|
|
|
remoteSort: true,
|
|
|
proxy: {
|
|
|
type: 'ajax',
|
|
|
url: '/Account/Chfee_invoiceapplication/GetBillSum',
|
|
|
reader: {
|
|
|
root: 'data',
|
|
|
totalProperty: 'totalCount'
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
|
|
|
this.gridSum = new Ext.grid.GridPanel({
|
|
|
store: this.storeBodySum,
|
|
|
enableHdMenu: false,
|
|
|
region: 'center',
|
|
|
loadMask: { msg: "数据加载中,请稍等..." },
|
|
|
trackMouseOver: true,
|
|
|
disableSelection: false,
|
|
|
tbar: [{
|
|
|
xtype: 'label',
|
|
|
width: 120,
|
|
|
height: 22,
|
|
|
text: '申请金额合计'
|
|
|
}],
|
|
|
columns: [{
|
|
|
sortable: true,
|
|
|
dataIndex: 'FEETYPEREF',
|
|
|
header: '收付',
|
|
|
width: 40
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'CURRENCY',
|
|
|
header: '币 别',
|
|
|
width: 80
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'AMOUNT',
|
|
|
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;
|
|
|
}
|
|
|
}
|
|
|
]
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//#region 添加业务列表
|
|
|
|
|
|
this.storeBodyAddList = Ext.create('Ext.data.Store', {
|
|
|
pageSize: this.PageSize,
|
|
|
model: 'MsAddBillCustFee',
|
|
|
remoteSort: true,
|
|
|
proxy: {
|
|
|
type: 'ajax',
|
|
|
url: '/Account/Chfee_invoiceapplication/GetBillDataList',
|
|
|
reader: {
|
|
|
id: 'BSNO',
|
|
|
root: 'data',
|
|
|
totalProperty: 'totalCount'
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
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();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
this.initaddgirdcolums = [{
|
|
|
sortable: true,
|
|
|
dataIndex: 'BSNO',
|
|
|
header: 'BSNO',
|
|
|
hidden: true,
|
|
|
width: 100
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'CUSTNO',
|
|
|
header: '委托编号',
|
|
|
width: 108
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'ORDERNO',
|
|
|
header: '订舱编号',
|
|
|
width: 108
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'MBLNO',
|
|
|
header: '主提单号',
|
|
|
width: 108
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'FEEOBJNAME',
|
|
|
header: '结费单位',
|
|
|
width: 90
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'RMBDrBalAmount',
|
|
|
header: 'RMB未开',
|
|
|
width: 70
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'USDDrBalAmount',
|
|
|
header: 'USD未开',
|
|
|
width: 70
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'OTDrBalAmount',
|
|
|
header: '其他未开',
|
|
|
width: 70
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'OPLBNAME',
|
|
|
header: '业务类别',
|
|
|
width: 80
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'HBLNO',
|
|
|
header: '分提单号',
|
|
|
width: 80
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'CUSTOMERNAME',
|
|
|
header: '委托单位',
|
|
|
width: 100
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'ETD',
|
|
|
header: '开船日期',
|
|
|
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
|
|
|
width: 100
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'SALE',
|
|
|
header: '揽货人',
|
|
|
width: 80
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'ACCDATE',
|
|
|
header: '会计期间',
|
|
|
width: 80
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'OP',
|
|
|
header: '操作',
|
|
|
width: 80
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'INPUTBY',
|
|
|
header: '录入人',
|
|
|
width: 80
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'PORTLOAD',
|
|
|
header: '起运港',
|
|
|
width: 120
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'PORTDISCHARGE',
|
|
|
header: '目的港',
|
|
|
width: 120
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'VESSEL',
|
|
|
header: '船名',
|
|
|
width: 150
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'VOYNO',
|
|
|
header: '航次',
|
|
|
width: 60
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'COMPANYNAME',
|
|
|
header: '所属分部',
|
|
|
width: 60
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'INVNO',
|
|
|
header: '业务发票号',
|
|
|
width: 60
|
|
|
}
|
|
|
];
|
|
|
this.addgirdcolums = DsTruck.GetGridPanel(USERID, this.formname + 'add', this.initaddgirdcolums, 1); //使用者id,表名,中间column数组,跳过一开始的几列
|
|
|
|
|
|
|
|
|
this.AddGridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
|
|
|
this.gridAddList = new Ext.grid.GridPanel({
|
|
|
store: this.storeBodyAddList,
|
|
|
enableHdMenu: false,
|
|
|
region: 'center',
|
|
|
loadMask: { msg: "数据加载中,请稍等..." },
|
|
|
trackMouseOver: true,
|
|
|
disableSelection: false,
|
|
|
selModel: this.AddGridCheckBoxModel,
|
|
|
viewConfig: {
|
|
|
enableTextSelection: true
|
|
|
},
|
|
|
tbar: [{
|
|
|
text: '添加发票明细',
|
|
|
tooltip: '添加发票明细',
|
|
|
id: 'btnaddbill',
|
|
|
iconCls: "btnadddetail",
|
|
|
handler: function (button, event) {
|
|
|
this.onAddClick(button, event);
|
|
|
},
|
|
|
scope: this
|
|
|
}, '-', {
|
|
|
text: "保存列表样式",
|
|
|
id: "btntest",
|
|
|
menu: [
|
|
|
{
|
|
|
text: "保存",
|
|
|
handler: function (button, event) {
|
|
|
_this.addgirdcolums = DsTruck.SaveGridPanel(USERID, _this.formname + 'add', _this.gridAddList.columns, _this.addgirdcolums, 1, true);
|
|
|
}
|
|
|
}, {
|
|
|
text: "初始化",
|
|
|
handler: function (menu, event) {
|
|
|
_this.addgirdcolums = DsTruck.SaveGridPanel(USERID, _this.formname + 'add', _this.gridAddList.columns, _this.initaddgirdcolums, 1, true);
|
|
|
}
|
|
|
}],
|
|
|
scope: this
|
|
|
}],
|
|
|
columns: this.addgirdcolums,
|
|
|
// paging bar on the bottom
|
|
|
bbar: [Ext.create('Ext.PagingToolbar', {
|
|
|
store: this.storeBodyAddList,
|
|
|
displayInfo: true,
|
|
|
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
|
|
|
emptyMsg: "没有数据"
|
|
|
}), this.Pagenum]
|
|
|
|
|
|
});
|
|
|
|
|
|
this.gridAddList.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
|
|
|
this.SelectedRecord = record;
|
|
|
var openSet = "height=700, width=1024, toolbar=no, menubar=no,scrollbars=1, resizable=1,location=no, status=no,Top= " + (screen.height - 750) / 2 + ",Left= " + (screen.width - 1100) / 2
|
|
|
var openType = "_blank";
|
|
|
var openUrl = "";
|
|
|
openUrl = "../../MvcShipping/MsOpBill/MsOpFeeView?handle=check&bsno=" + record.data.BSNO;
|
|
|
|
|
|
window.open(openUrl, openType, openSet);
|
|
|
}, this);
|
|
|
|
|
|
this.gridAddList.addListener('sortchange', function (ct, column, direction, eOpts) {
|
|
|
this.addsortfield = column.dataIndex;
|
|
|
this.addsortdire = direction;
|
|
|
}, this);
|
|
|
|
|
|
|
|
|
//#endregion
|
|
|
|
|
|
|
|
|
_this = this;
|
|
|
|
|
|
this.FeeGroup = new Ext.form.RadioGroup({
|
|
|
id: 'FeeGroup',
|
|
|
xtype: 'radiogroup',
|
|
|
fieldLabel: '发票明细',
|
|
|
columns: 2,
|
|
|
items: [
|
|
|
{ boxLabel: '费用合计', name: 'Curr', inputValue: 'false', checked: true },
|
|
|
{ boxLabel: '费用列表', name: 'Curr', inputValue: 'true' }
|
|
|
]
|
|
|
});
|
|
|
|
|
|
|
|
|
//#region 添加费用列表
|
|
|
this.storeAddFeeList = Ext.create('Ext.data.Store', {
|
|
|
pageSize: this.PageSize,
|
|
|
model: 'Chfee_add_detail',
|
|
|
remoteSort: true,
|
|
|
proxy: {
|
|
|
type: 'ajax',
|
|
|
url: '/Account/Chfee_invoiceapplication/GetFeeDetailList',
|
|
|
reader: {
|
|
|
id: 'BSNO',
|
|
|
root: 'data',
|
|
|
totalProperty: 'totalCount'
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
|
|
|
this.AddFeeGridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
|
|
|
this.cellEditingFee = Ext.create('Ext.grid.plugin.CellEditing', {
|
|
|
clicksToEdit: 1,
|
|
|
listeners: {
|
|
|
'edit': function (editor, e) {
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
this.initgirdfeecolums = [{
|
|
|
sortable: true,
|
|
|
dataIndex: 'CH_ID',
|
|
|
header: 'CH_ID',
|
|
|
hidden: true,
|
|
|
width: 100
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'BSNO',
|
|
|
header: 'BSNO',
|
|
|
hidden: true,
|
|
|
width: 100
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'CustomerName',
|
|
|
header: '客户名称',
|
|
|
width: 90
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'FeeType_Ref',
|
|
|
header: '收付',
|
|
|
width: 40
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'FeeName',
|
|
|
header: '费用名称',
|
|
|
width: 90
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'Amount',
|
|
|
header: '金额',
|
|
|
width: 70,
|
|
|
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: 'Currency',
|
|
|
header: '币别',
|
|
|
width: 40
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'BalAmount',
|
|
|
header: '未开票金额',
|
|
|
width: 70,
|
|
|
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: 'StlAmount',
|
|
|
header: '本次开票金额',
|
|
|
editor: {
|
|
|
xtype: 'numberfield',
|
|
|
keyNavEnabled: false,
|
|
|
allowDecimals: true,
|
|
|
decimalPrecision: 2,
|
|
|
selectOnFocus: true,
|
|
|
mouseWheelEnabled: false,
|
|
|
enableKeyEvents: true,
|
|
|
listeners: {
|
|
|
keydown: function (textfield, e) {
|
|
|
if (e.getKey() == 40) {
|
|
|
_this.onNextKeyClick(9)
|
|
|
} else if (e.getKey() == 38) {
|
|
|
_this.onUpKeyClick(9)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
},
|
|
|
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
|
|
|
try {
|
|
|
var lsValue = usMoney(value, 2, '', false);
|
|
|
if (lsValue != "NaN") {
|
|
|
value = lsValue; if (parseFloat(lsValue) < 0) {
|
|
|
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
return value;
|
|
|
}
|
|
|
}
|
|
|
catch (e) {
|
|
|
return value;
|
|
|
}
|
|
|
return value;
|
|
|
},
|
|
|
width: 70
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'ExChangerate',
|
|
|
header: '原始汇率',
|
|
|
width: 60
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'INPUTBY',
|
|
|
header: '录入人', //备注
|
|
|
width: 180
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'AccTaxRate',
|
|
|
header: '销项/进项税率',
|
|
|
width: 60
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'Remark',
|
|
|
header: '备注',
|
|
|
width: 60
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'INPUTMODE',
|
|
|
header: '录入方式',
|
|
|
width: 60
|
|
|
}
|
|
|
];
|
|
|
|
|
|
this.girdfeecolums = this.initgirdfeecolums;
|
|
|
this.gridAddFeeList = new Ext.grid.GridPanel({
|
|
|
store: this.storeAddFeeList,
|
|
|
enableHdMenu: false,
|
|
|
region: 'center',
|
|
|
loadMask: { msg: "数据加载中,请稍等..." },
|
|
|
trackMouseOver: true,
|
|
|
disableSelection: false,
|
|
|
plugins: [this.cellEditingFee],
|
|
|
selModel: this.AddFeeGridCheckBoxModel,
|
|
|
tbar: [{
|
|
|
text: '添加发票费用明细',
|
|
|
tooltip: '添加发票费用明细',
|
|
|
iconCls: "btnadddetail",
|
|
|
id: "btnadddetail",
|
|
|
handler: function (button, event) {
|
|
|
this.onAddDetailClick(button, event);
|
|
|
},
|
|
|
scope: this
|
|
|
}, '-', {
|
|
|
text: "保存列表样式",
|
|
|
id: "btntestfee",
|
|
|
menu: [
|
|
|
{ text: "保存",
|
|
|
handler: function (button, event) {
|
|
|
_this.girdfeecolums = DsTruck.SaveGridPanel(USERID, _this.formname + 'fee', _this.gridAddFeeList.columns, _this.girdfeecolums, 1, true);
|
|
|
}
|
|
|
}, { text: "初始化",
|
|
|
handler: function (menu, event) {
|
|
|
_this.girdfeecolums = DsTruck.SaveGridPanel(USERID, _this.formname + 'fee', _this.gridAddFeeList.columns, _this.initgirdfeecolums, 1, true);
|
|
|
}
|
|
|
}],
|
|
|
scope: this
|
|
|
}, { xtype: "label", id: "zongshu", text: ""
|
|
|
}],
|
|
|
columns: this.girdfeecolums,
|
|
|
// paging bar on the bottom
|
|
|
bbar: Ext.create('Ext.PagingToolbar', {
|
|
|
store: this.storeAddFeeList,
|
|
|
displayInfo: true,
|
|
|
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
|
|
|
emptyMsg: "没有数据"
|
|
|
})
|
|
|
});
|
|
|
|
|
|
|
|
|
this.gridAddFeeList.on('edit', function (editor, e, eOpts) {
|
|
|
this.gridAddFeeListAfterEdit(editor, e, eOpts);
|
|
|
}, this);
|
|
|
|
|
|
this.girdfeecolums = DsTruck.GetGridPanel(USERID, this.formname + 'fee', this.girdfeecolums, 1); //使用者id,表名,中间column数组,跳过一开始的几列
|
|
|
this.gridAddFeeList.reconfigure(this.storeAddFeeList, this.girdfeecolums);
|
|
|
|
|
|
|
|
|
|
|
|
this.storeSelectSum = Ext.create('Ext.data.Store', {
|
|
|
model: 'Chfee_do_selectsum'
|
|
|
});
|
|
|
|
|
|
|
|
|
this.gridSelectSum = new Ext.grid.GridPanel({
|
|
|
store: this.storeSelectSum,
|
|
|
enableHdMenu: false,
|
|
|
// anchor: '100% 50%',
|
|
|
region: 'south',
|
|
|
height: 80,
|
|
|
loadMask: { msg: "数据加载中,请稍等..." },
|
|
|
trackMouseOver: true,
|
|
|
disableSelection: false,
|
|
|
tbar: [{
|
|
|
xtype: 'label',
|
|
|
width: 220,
|
|
|
id: 'SelectGrid',
|
|
|
height: 22,
|
|
|
text: '所选费用合计'
|
|
|
}],
|
|
|
columns: [{
|
|
|
sortable: true,
|
|
|
dataIndex: 'RMBDRAMOUNT',
|
|
|
header: 'RMB未开',
|
|
|
width: 80
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'USDDRAMOUNT',
|
|
|
header: 'USD未开',
|
|
|
width: 80
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'OTDRAMOUNT',
|
|
|
header: '其他未开',
|
|
|
width: 80
|
|
|
}
|
|
|
]
|
|
|
});
|
|
|
|
|
|
//#endregion
|
|
|
|
|
|
_this = this;
|
|
|
this.storeCustCodefee = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'DsShipping.ux.CustomInvRefModel',
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetCustomInvRefListRm' }
|
|
|
});
|
|
|
|
|
|
// this.storeCustCodefee.load({ params: { condition: ""} });
|
|
|
this.storeCustCodefee.loadData(mainWin.GetPubStore("PubStore_CustomerAll").data.items);
|
|
|
this.comboxAddCustCode = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: '费用对象',
|
|
|
store: this.storeCustCodefee,
|
|
|
labelWidth: 70,
|
|
|
//queryMode: 'remote',
|
|
|
//minChars: 1,
|
|
|
queryParam: 'CODENAME',
|
|
|
name: 'CUSTNAME',
|
|
|
valueField: 'CustName',
|
|
|
displayField: 'CodeAndName',
|
|
|
enableKeyEvents: true,
|
|
|
listeners: {
|
|
|
beforequery: function (e) {
|
|
|
return FilterCombox(e, 1);
|
|
|
},
|
|
|
specialkey: function (combo, e) {
|
|
|
//将回车13转义成tab9
|
|
|
GetComboxFirstValueOnTableClick_RefTable(combo, e, 'CustName');
|
|
|
if (e.getKey() == e.ENTER) {
|
|
|
_this.onRefreshClick();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
});
|
|
|
this.StoreOpLb = Ext.create('DsExt.ux.RefEnumStore', {});
|
|
|
this.StoreOpLb.load({ params: { enumTypeId: 96005} });
|
|
|
|
|
|
this.comboxOpLb = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: '业务类别',
|
|
|
store: this.StoreOpLb,
|
|
|
labelWidth: 70,
|
|
|
valueField: 'EnumValueName',
|
|
|
displayField: 'EnumValueName',
|
|
|
forceSelection: true,
|
|
|
name: 'OPLBNAME',
|
|
|
enableKeyEvents: true,
|
|
|
listeners: {
|
|
|
keyup: function (field, e) {
|
|
|
if (e.getKey() == e.ENTER) {
|
|
|
_this.onRefreshClick();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
this.storeAddDCType = Ext.create('Ext.data.Store', {
|
|
|
fields: ['DC', 'NAME']
|
|
|
});
|
|
|
this.storeAddDCType.add({ "DC": "", "NAME": "全部" });
|
|
|
this.storeAddDCType.add({ "DC": "1", "NAME": "应收" });
|
|
|
this.storeAddDCType.add({ "DC": "2", "NAME": "应付" });
|
|
|
|
|
|
this.comboxaddDCType = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: '收/付',
|
|
|
store: this.storeAddDCType,
|
|
|
valueField: 'DC',
|
|
|
displayField: 'NAME',
|
|
|
flex: 0.5,
|
|
|
labelWidth: 70,
|
|
|
|
|
|
// readOnly: true,
|
|
|
// labelWidth: 50,
|
|
|
forceSelection: true,
|
|
|
name: 'DC',
|
|
|
value: '1',
|
|
|
enableKeyEvents: true,
|
|
|
listeners: {
|
|
|
keyup: function (field, e) {
|
|
|
if (e.getKey() == e.ENTER) {
|
|
|
_this.onRefreshClick();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
|
|
|
this.comboxCurr2 = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: '币别',
|
|
|
store: this.StoreCurr,
|
|
|
forceSelection: true,
|
|
|
name: 'Currency',
|
|
|
flex: 0.5,
|
|
|
labelWidth: 50,
|
|
|
valueField: 'CURR',
|
|
|
displayField: 'CURR',
|
|
|
enableKeyEvents: true,
|
|
|
listeners: {
|
|
|
keyup: function (field, e) {
|
|
|
if (e.getKey() == e.ENTER) {
|
|
|
_this.onRefreshClick();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
|
|
|
this.storeFeeNameRef = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'DsShipping.ux.FeeTypeRefModel',
|
|
|
proxy: { url: '/MvcShipping/MsChFee/GetFeeTypeRefList' }
|
|
|
});
|
|
|
|
|
|
|
|
|
this.comboxFeeNameRef = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: '费用名称',
|
|
|
store: this.storeFeeNameRef,
|
|
|
labelWidth: 70, forceSelection: true,
|
|
|
name: 'FeeName',
|
|
|
valueField: 'Name',
|
|
|
displayField: 'CodeAndName',
|
|
|
enableKeyEvents: true,
|
|
|
listeners: {
|
|
|
keyup: function (field, e) {
|
|
|
if (e.getKey() == e.ENTER) {
|
|
|
_this.onRefreshClick();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
this.storeFeeNameRef.load({ params: { condition: ""} });
|
|
|
|
|
|
|
|
|
this.storeCurrExrate = Ext.create('Ext.data.Store', {
|
|
|
fields: ['CURR', 'EXRATE', 'DFEXRATE']
|
|
|
});
|
|
|
|
|
|
this.storeFEERANGE = Ext.create('DsExt.ux.RefEnumStore', {});
|
|
|
this.storeFEERANGE.load({ params: { enumTypeId: 96009} });
|
|
|
|
|
|
this.comboxFEERANGE = Ext.create('DsExt.ux.RefEnumCombox', {
|
|
|
fieldLabel: '费用范围',
|
|
|
store: this.storeFEERANGE,
|
|
|
forceSelection: true,
|
|
|
name: 'FEERANGE',
|
|
|
enableKeyEvents: true,
|
|
|
listeners: {
|
|
|
keyup: function (field, e) {
|
|
|
if (e.getKey() == e.ENTER) {
|
|
|
_this.onRefreshClick();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
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'
|
|
|
});
|
|
|
|
|
|
this.formSearch = Ext.widget('form', {
|
|
|
frame: true,
|
|
|
title: '添加发票申请明细',
|
|
|
region: 'north',
|
|
|
bodyPadding: 5,
|
|
|
collapsible: true,
|
|
|
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: [this.comboxAddCustCode, this.comboxOpLb, {
|
|
|
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();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}, {
|
|
|
fieldLabel: '对账编号',
|
|
|
name: 'DuiNo',
|
|
|
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) {
|
|
|
if (this.bsnosql == undefined) {
|
|
|
var sql = this.getCondition();
|
|
|
} else {
|
|
|
var sql = this.sqlcontext;
|
|
|
|
|
|
}
|
|
|
var winAccess = new Shipping.DsQuery({
|
|
|
|
|
|
});
|
|
|
winAccess.StoreList = this.storeList;
|
|
|
winAccess.formname = this.formname;
|
|
|
winAccess.condition = sql;
|
|
|
winAccess.show();
|
|
|
return;
|
|
|
|
|
|
|
|
|
},
|
|
|
scope: this
|
|
|
}
|
|
|
]
|
|
|
}, {
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [this.comboxaddDCType, this.comboxCurr2, this.comboxFeeNameRef, {
|
|
|
fieldLabel: '会计期间',
|
|
|
xtype: 'monthfield',
|
|
|
name: 'ACCDATEFR',
|
|
|
enableKeyEvents: true,
|
|
|
listeners: {
|
|
|
specialkey: function (field, e) {
|
|
|
if (e.getKey() == e.ENTER) {
|
|
|
_this.onRefreshClick();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}, {
|
|
|
fieldLabel: '会计期间',
|
|
|
xtype: 'monthfield',
|
|
|
name: 'ACCDATETO',
|
|
|
enableKeyEvents: true,
|
|
|
listeners: {
|
|
|
specialkey: function (field, e) {
|
|
|
if (e.getKey() == e.ENTER) {
|
|
|
_this.onRefreshClick();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}, this.comboxFEERANGE, this.comboxSaleCompany, {
|
|
|
xtype: 'button',
|
|
|
width: 90,
|
|
|
text: "执行查询",
|
|
|
iconCls: "btnrefresh",
|
|
|
handler: function (button, event) {
|
|
|
this.onRefreshClick(button, event);
|
|
|
},
|
|
|
scope: this
|
|
|
}
|
|
|
]
|
|
|
}
|
|
|
]//end items(fieldset 1)
|
|
|
}//end fieldset 1
|
|
|
]//end root items
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
this.panelInvDetail = new Ext.Panel({
|
|
|
layout: "border",
|
|
|
// height: 220,
|
|
|
region: "center",
|
|
|
margin: '2 2',
|
|
|
items: []
|
|
|
});
|
|
|
|
|
|
this.panelService = new Ext.Panel({
|
|
|
layout: "border",
|
|
|
region: 'center',
|
|
|
autoScroll: true,
|
|
|
margin: '0 0 0 0',
|
|
|
items: [this.gridList]
|
|
|
});
|
|
|
|
|
|
this.panelSum = new Ext.Panel({
|
|
|
layout: "border",
|
|
|
region: 'east',
|
|
|
width: 260,
|
|
|
split: true,
|
|
|
margin: '0 0 0 0',
|
|
|
items: [this.gridSum]
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.paneldetail = new Ext.Panel({
|
|
|
title: '申请明细',
|
|
|
layout: "border",
|
|
|
height: 220,
|
|
|
region: "north",
|
|
|
items: [
|
|
|
|
|
|
]
|
|
|
});
|
|
|
|
|
|
this.panelAddService = new Ext.Panel({
|
|
|
layout: "border",
|
|
|
region: 'center',
|
|
|
margin: '2 2',
|
|
|
items: [this.gridAddList]
|
|
|
});
|
|
|
this.panelAddfee = new Ext.Panel({
|
|
|
layout: "border",
|
|
|
region: 'east',
|
|
|
width: 550,
|
|
|
split: true,
|
|
|
margin: '2 2',
|
|
|
items: [this.gridAddFeeList, this.gridSelectSum]
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
this.paneladddetail = new Ext.Panel({
|
|
|
layout: "border",
|
|
|
region: 'center',
|
|
|
items: [this.panelAddService, this.panelAddfee
|
|
|
]
|
|
|
});
|
|
|
|
|
|
|
|
|
this.paneladd = new Ext.Panel({
|
|
|
|
|
|
layout: "border",
|
|
|
// region: 'south',
|
|
|
|
|
|
region: "center",
|
|
|
// height: 420,
|
|
|
items: [
|
|
|
this.formSearch, this.paneladddetail
|
|
|
]
|
|
|
});
|
|
|
|
|
|
|
|
|
//#endregion 明细表
|
|
|
|
|
|
|
|
|
//#region 附件上传
|
|
|
|
|
|
|
|
|
|
|
|
this.storeChfeeFile = Ext.create('Ext.data.Store', {
|
|
|
model: 'FeeFileModel',
|
|
|
remoteSort: false,
|
|
|
proxy: {
|
|
|
type: 'ajax',
|
|
|
url: '/Account/Chfee_payapplication/GetFileList',
|
|
|
reader: {
|
|
|
id: 'GID',
|
|
|
root: 'data',
|
|
|
totalProperty: 'totalCount'
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
//表格
|
|
|
this.FeeFileColumns = [
|
|
|
{
|
|
|
sortable: true, hidden: true,
|
|
|
dataIndex: 'GID', readOnly: true,
|
|
|
header: 'GID',
|
|
|
width: 80
|
|
|
}, {
|
|
|
sortable: true, hidden: false,
|
|
|
dataIndex: 'File_OriginalName', readOnly: true,
|
|
|
header: '文件名称', //文件名称
|
|
|
renderer: function (value, p, record) {
|
|
|
return '<a href="' + "/Areas/Account/Files/" + record.data.BillNo + '/' + record.data.File_Name + '" target="_blank" style=' + '"text-decoration:none"' + ' >' + value + '</a>';
|
|
|
},
|
|
|
width: 180
|
|
|
}, {
|
|
|
sortable: true, hidden: false,
|
|
|
dataIndex: 'UpdateTime', readOnly: true,
|
|
|
header: '上传日期', //上传日期
|
|
|
width: 80
|
|
|
}, {
|
|
|
sortable: true, hidden: false,
|
|
|
dataIndex: 'Operator', readOnly: true,
|
|
|
header: '上传者', //上传者
|
|
|
width: 80
|
|
|
}, {
|
|
|
sortable: true, hidden: true,
|
|
|
dataIndex: 'File_Name', readOnly: true,
|
|
|
header: '文件物理名称', //文件物理名称
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
sortable: true, hidden: true,
|
|
|
dataIndex: 'File_Path',
|
|
|
header: 'File_Path',
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'File_DocType',
|
|
|
header: '文件类型',
|
|
|
width: 80
|
|
|
}, {
|
|
|
xtype: 'actioncolumn',
|
|
|
width: 50,
|
|
|
text: '操作', //操作
|
|
|
items: [{
|
|
|
icon: '/images/icons/btnSearch.gif', // Use a URL in the icon config
|
|
|
tooltip: '预览',
|
|
|
handler: function (grid, rowIndex, colIndex) {
|
|
|
var rec = grid.getStore().getAt(rowIndex);
|
|
|
var filePath = rec.get('File_Path') + '?a=' + Math.random();
|
|
|
var imgView = new Shipping.FileView({ filePath: filePath });
|
|
|
imgView.show();
|
|
|
}
|
|
|
}]
|
|
|
}
|
|
|
];
|
|
|
var selCertModel = Ext.create('Ext.selection.CheckboxModel');
|
|
|
this.fileGrid = new Ext.grid.GridPanel({
|
|
|
store: this.storeChfeeFile,
|
|
|
enableHdMenu: false,
|
|
|
layout: 'border',
|
|
|
region: 'center',
|
|
|
loadMask: { msg: '数据加载中,请稍等...' }, //数据加载中,请稍等...
|
|
|
trackMouseOver: true,
|
|
|
disableSelection: false,
|
|
|
selModel: selCertModel,
|
|
|
singleSelect: true,
|
|
|
selType: 'rowmodel',
|
|
|
tbar: [{
|
|
|
text: '上传图片', //上传图片
|
|
|
tooltip: '上传文件',
|
|
|
iconCls: "btnadddetail",
|
|
|
handler: function (button, event) {
|
|
|
this.onAddFileClick(button, event);
|
|
|
},
|
|
|
scope: this
|
|
|
}, '-', {
|
|
|
text: '删除图片', //删除
|
|
|
tooltip: '删除文件', //删除图片
|
|
|
iconCls: "btndeletedetail",
|
|
|
handler: function (button, event) {
|
|
|
this.onDelFileClick(button, event);
|
|
|
},
|
|
|
scope: this
|
|
|
}],
|
|
|
columns: this.FeeFileColumns
|
|
|
});
|
|
|
//#endregion附件上传
|
|
|
|
|
|
|
|
|
|
|
|
//#region 布局
|
|
|
//控件布局
|
|
|
this.panelTop = new Ext.Panel({
|
|
|
layout: "border",
|
|
|
region: "north",
|
|
|
height: 235,
|
|
|
items: [this.panelBtn, this.formEdit]
|
|
|
});
|
|
|
|
|
|
this.panelBody = new Ext.Panel({
|
|
|
title: "费用明细",
|
|
|
layout: "border",
|
|
|
region: "center",
|
|
|
items: [this.panelService, this.panelSum]
|
|
|
});
|
|
|
|
|
|
this.panelInv = new Ext.Panel({
|
|
|
title: "发票明细",
|
|
|
layout: "border",
|
|
|
region: "center",
|
|
|
margin: '0 0 0 0',
|
|
|
items: [this.gridDetailList]
|
|
|
});
|
|
|
|
|
|
//#region 增加附件上传tab
|
|
|
|
|
|
this.page_2 = new Ext.Panel({
|
|
|
id: "page_2",
|
|
|
title: '附件上传', //附件上传
|
|
|
autoScroll: true,
|
|
|
layout: "border",
|
|
|
region: 'center',
|
|
|
//closable:true,
|
|
|
items: [this.fileGrid]
|
|
|
});
|
|
|
|
|
|
//#endregion
|
|
|
|
|
|
this.tabpanel = new Ext.TabPanel
|
|
|
({
|
|
|
activeTab: 0,
|
|
|
autoWidth: true,
|
|
|
border: false,
|
|
|
frame: false,
|
|
|
height: 220,
|
|
|
region: 'north',
|
|
|
id: "TabPanelID",
|
|
|
enableTabScroll: true,
|
|
|
split: true,
|
|
|
items:
|
|
|
[
|
|
|
this.panelInv,
|
|
|
this.panelBody,
|
|
|
this.page_2
|
|
|
]
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Ext.apply(this, {
|
|
|
items: [this.panelTop, this.tabpanel, this.paneladd]
|
|
|
});
|
|
|
|
|
|
//#endregion
|
|
|
|
|
|
//绑定查询窗体
|
|
|
this.ParentWin = window.parent.opener;
|
|
|
if (this.bsnosql == undefined) {
|
|
|
//初始化数据
|
|
|
this.InitData();
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.opStatus = 'add'
|
|
|
this.StoreList = Ext.create('Ext.data.Store', {
|
|
|
pageSize: 50,
|
|
|
model: 'MsChInvoiceapplication',
|
|
|
remoteSort: true,
|
|
|
proxy: {
|
|
|
type: 'ajax',
|
|
|
url: '/Account/Chfee_invoiceapplication/GetDataList',
|
|
|
reader: {
|
|
|
id: 'BILLNO',
|
|
|
root: 'data',
|
|
|
totalProperty: 'totalCount'
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
// this.StoreList.load({ params: { condition:" 1=2 "} });
|
|
|
var bsnos = "";
|
|
|
var currsql = "";
|
|
|
|
|
|
if (this.ParentWin && this.bsnosql == 'oplist') {
|
|
|
var ret = this.ParentWin.OprationSwap();
|
|
|
bsnos = ret[3];
|
|
|
currsql = ret[6];
|
|
|
} else if (this.ParentWin && this.bsnosql == 'feelist') {
|
|
|
this.ParentWin = this.ParentWin._thisfee;
|
|
|
var ret = this.ParentWin.OprationSwap();
|
|
|
bsnos = ret[4];
|
|
|
currsql = ret[5];
|
|
|
} else if (this.ParentWin && this.bsnosql == 'amendfeelist') {
|
|
|
this.ParentWin = this.ParentWin._thisAmendfee;
|
|
|
var ret = this.ParentWin.OprationSwap();
|
|
|
bsnos = ret[4];
|
|
|
currsql = ret[5];
|
|
|
} else if (this.ParentWin && this.bsnosql == 'recapplist') {
|
|
|
var ret = this.ParentWin.OprationSwap();
|
|
|
bsnos = ret[4];
|
|
|
currsql = ret[5];
|
|
|
}
|
|
|
|
|
|
this.comboxCustCode.allowBlank = true;
|
|
|
this.comboxCurr.allowBlank = true;
|
|
|
|
|
|
|
|
|
var condition = '';
|
|
|
|
|
|
var sql = this.getCondition();
|
|
|
this.sqlcontext = sql + ' and ' + bsnos;
|
|
|
if (currsql != '')
|
|
|
this.FeeSqlStr = this.FeeSqlStr + ' and ' + currsql;
|
|
|
this.PageSize = this.Pagenum.getValue();
|
|
|
this.LoadData(this.opStatus, condition);
|
|
|
this.LoadMustBe();
|
|
|
|
|
|
}
|
|
|
|
|
|
//绑定事件
|
|
|
|
|
|
var billno = '*';
|
|
|
|
|
|
if (this.opStatus == 'edit') {
|
|
|
billno = this.editRecord.get('BILLNO');
|
|
|
|
|
|
};
|
|
|
|
|
|
this.storeBodyList.on('beforeload', function (store) {
|
|
|
var billno = this.editRecord.get('BILLNO');
|
|
|
var sql = " BILLNO='" + billno + "'";
|
|
|
Ext.apply(store.proxy.extraParams, { condition: sql });
|
|
|
}, this);
|
|
|
|
|
|
this.storeBodyList.on('load', function (store, records) {
|
|
|
if (store.getCount() > 0) {
|
|
|
//this.gridList.getSelectionModel().select(0);
|
|
|
|
|
|
}
|
|
|
}, this);
|
|
|
|
|
|
this.storeBodyAddList.on('beforeload', function (store) {
|
|
|
// var sql = this.getCondition();
|
|
|
|
|
|
Ext.apply(store.proxy.extraParams, { condition: this.sqlcontext });
|
|
|
}, this);
|
|
|
|
|
|
|
|
|
this.storeAddFeeList.on('beforeload', function (store) {
|
|
|
var sql = '';
|
|
|
if (this.selectfeesql == '')
|
|
|
sql = '1=2 ';
|
|
|
else
|
|
|
sql = this.selectfeesql;
|
|
|
Ext.apply(store.proxy.extraParams, { condition: sql });
|
|
|
}, this);
|
|
|
|
|
|
|
|
|
this.storeBodyAddList.on('load', function (store, records) {
|
|
|
if (store.getCount() > 0) {
|
|
|
// this.gridAddList.getSelectionModel().select(0);
|
|
|
var btnEAddbill = Ext.getCmp('btnaddbill');
|
|
|
if (this.canedit)
|
|
|
btnEAddbill.enable();
|
|
|
} else {
|
|
|
this.storeAddFeeList.removeAll();
|
|
|
|
|
|
}
|
|
|
}, this);
|
|
|
this.storeAddFeeList.on('load', function (store, records) {
|
|
|
if (store.getCount() > 0) {
|
|
|
var btnEAddDetail = Ext.getCmp('btnadddetail');
|
|
|
if (this.canedit)
|
|
|
btnEAddDetail.enable();
|
|
|
|
|
|
} else {
|
|
|
|
|
|
}
|
|
|
}, this);
|
|
|
|
|
|
var isloadfee = true;
|
|
|
this.gridAddList.getSelectionModel().on('select', function (model, record, index) {
|
|
|
if (!isloadfee) return;
|
|
|
var bsno = record.data.BSNO;
|
|
|
var feeobjname = record.data.FEEOBJNAME;
|
|
|
var sql = "";
|
|
|
sql = " BSNO='" + bsno + "' AND CUSTOMERNAME='" + feeobjname + "'";
|
|
|
sql = sql + getAndConSql(sql, this.FeeSqlStr, this.FeeSqlStr);
|
|
|
isloadfee = false;
|
|
|
this.selectfeesql = sql;
|
|
|
this.storeAddFeeList.load({ params: { condition: sql },
|
|
|
callback: function (r, options, success) {
|
|
|
if (success) {
|
|
|
isloadfee = true;
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
}, this);
|
|
|
|
|
|
|
|
|
|
|
|
_this = this;
|
|
|
this.gridAddList.on({
|
|
|
selectionchange: function (sm, selections) {
|
|
|
_this.onSelectFee();
|
|
|
|
|
|
var SelectGridtext = Ext.getCmp('SelectGrid');
|
|
|
_this.storeSelectSum.removeAll();
|
|
|
SelectGridtext.setText('所选费用合计');
|
|
|
|
|
|
if (selections.length == 0) {
|
|
|
return;
|
|
|
}
|
|
|
_this.storeSelectSum.add({ "RMBDRAMOUNT": 0, "RMBCRAMOUNT": 0, "USDDRAMOUNT": 0, "USDCRAMOUNT": 0, "OTDRAMOUNT": 0, "OTCRAMOUNT": 0 });
|
|
|
var R = selections.length;
|
|
|
for (var i = 0; i < selections.length; i++) {
|
|
|
var rec = selections[i];
|
|
|
var memberyf = _this.storeSelectSum.getAt(0);
|
|
|
var amount = memberyf.data.RMBDRAMOUNT;
|
|
|
var cramount = memberyf.data.RMBCRAMOUNT;
|
|
|
amount = (parseFloat(amount).add(parseFloat(rec.data.RMBDrBalAmount))).toFixed(2);
|
|
|
cramount = (parseFloat(cramount).add(parseFloat(rec.data.RMBCrBalAmount))).toFixed(2);
|
|
|
var usdamount = memberyf.data.USDDRAMOUNT;
|
|
|
var usdcramount = memberyf.data.USDCRAMOUNT;
|
|
|
usdamount = (parseFloat(usdamount).add(parseFloat(rec.data.USDDrBalAmount))).toFixed(2);
|
|
|
usdcramount = (parseFloat(usdcramount).add(parseFloat(rec.data.USDCrBalAmount))).toFixed(2);
|
|
|
var otamount = memberyf.data.OTDRAMOUNT;
|
|
|
var otcramount = memberyf.data.OTCRAMOUNT;
|
|
|
otamount = (parseFloat(otamount).add(parseFloat(rec.data.OTDrBalAmount))).toFixed(2);
|
|
|
otcramount = (parseFloat(otcramount).add(parseFloat(rec.data.OTCrBalAmount))).toFixed(2);
|
|
|
memberyf.set("RMBDRAMOUNT", amount);
|
|
|
memberyf.set("RMBCRAMOUNT", cramount);
|
|
|
memberyf.set("USDDRAMOUNT", usdamount);
|
|
|
memberyf.set("USDCRAMOUNT", usdcramount);
|
|
|
memberyf.set("OTDRAMOUNT", otamount);
|
|
|
memberyf.set("OTCRAMOUNT", otcramount);
|
|
|
memberyf.commit();
|
|
|
|
|
|
}
|
|
|
|
|
|
SelectGridtext.setText('所选费用合计(选中' + R + '票业务)');
|
|
|
|
|
|
|
|
|
}
|
|
|
});
|
|
|
|
|
|
this.gridAddFeeList.getSelectionModel().on('select', function (button, event) {
|
|
|
//Ext.getCmp("zongshu").setText("1234");
|
|
|
this.onSelectFee(button, event);
|
|
|
}, this);
|
|
|
|
|
|
this.gridAddFeeList.on('cellclick', function (button, event) {
|
|
|
//Ext.getCmp("zongshu").setText("1234");
|
|
|
this.onSelectFee(button, event);
|
|
|
}, this);
|
|
|
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '',
|
|
|
url: '/MvcShipping/MsSysParamSet/GetData',
|
|
|
params: {
|
|
|
condition: "PARAMNAME='INVAPPPRINTAFTERAUDIT'"
|
|
|
},
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
var result = Ext.JSON.decode(response.responseText);
|
|
|
if (result.Success != true) {
|
|
|
|
|
|
} else {
|
|
|
var data = result.data;
|
|
|
if (data.PARAMVALUE == '1') {
|
|
|
this.INVAPPPRINTAFTERAUDIT = 1;
|
|
|
} else {
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
} else {
|
|
|
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
});
|
|
|
|
|
|
|
|
|
}, //end initUIComponents
|
|
|
|
|
|
InitData: function () {
|
|
|
this.opStatus = 'add';
|
|
|
var condition = '';
|
|
|
if (this.ParentWin) {
|
|
|
var ret = this.ParentWin.OprationSwap();
|
|
|
this.opStatus = ret[0];
|
|
|
this.StoreList = ret[1];
|
|
|
this.editRecord = ret[2];
|
|
|
this.INVOICEPORT = ret[3];
|
|
|
var _storecust = ret[4];
|
|
|
this.storeCustCode.loadData(_storecust.data.items);
|
|
|
}
|
|
|
|
|
|
if (this.INVOICEPORT == "HangXin") {
|
|
|
Ext.getCmp("pushform").hidden = false;
|
|
|
}
|
|
|
|
|
|
if (this.opStatus == 'edit')
|
|
|
condition = " BILLNO='" + this.editRecord.get('BILLNO') + "'";
|
|
|
if (this.opStatus == 'edit') {
|
|
|
document.title = "发票申请" + this.editRecord.get('BILLNO').toString().trim();
|
|
|
}
|
|
|
else {
|
|
|
document.title = "发票申请-新增";
|
|
|
}
|
|
|
this.LoadData(this.opStatus, condition);
|
|
|
this.LoadMustBe();
|
|
|
|
|
|
}, //end InitData
|
|
|
|
|
|
LoadData: function (opstatus, condition) {
|
|
|
this.serialNo = 0;
|
|
|
this.workSerialNo = 0;
|
|
|
this.bodyDel = [];
|
|
|
|
|
|
this.opStatus = opstatus;
|
|
|
_this = this;
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在查询主表数据...',
|
|
|
url: '/Account/Chfee_invoiceapplication/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;
|
|
|
|
|
|
if (_this.opStatus == 'add' && _this.INVOICEPORT == "HangXin") {
|
|
|
data.PUSHMOBILE = "0";
|
|
|
}
|
|
|
|
|
|
_this.formEdit.getForm().findField('BILLSTATUS').setDisabled(false);
|
|
|
_this.formEdit.getForm().reset();
|
|
|
_this.formEdit.getForm().setValues(data);
|
|
|
_this.formEdit.getForm().findField('BILLSTATUS').setDisabled(true);
|
|
|
|
|
|
if (this.bsCurr != undefined)
|
|
|
_this.formEdit.getForm().findField('RECVCURR').setValue(this.bsCurr);
|
|
|
if (this.bsCust != undefined) {
|
|
|
_this.formEdit.getForm().findField('CUSTOMERNAME').setValue(this.bsCust);
|
|
|
}
|
|
|
if (this.isfeename != undefined) {
|
|
|
if (this.isfeename == 1)
|
|
|
Ext.getCmp('FeeGroup').setValue(true);
|
|
|
}
|
|
|
//if (this.salecorp != undefined) {
|
|
|
// var SALECORPID = this.formEdit.getForm().findField('PAYCOMPANYID').getValue();
|
|
|
// if ((SALECORPID == '') || (SALECORPID == null)) {
|
|
|
// var recs = DsStoreQueryBy(this.storeSaleCompany, 'NAME', this.salecorp);
|
|
|
// if (recs.getCount() > 0) {
|
|
|
// var data = recs.getAt(0).data;
|
|
|
// this.formEdit.getForm().findField('PAYCOMPANYID').setValue(data.GID)
|
|
|
// }
|
|
|
// }
|
|
|
|
|
|
//}
|
|
|
|
|
|
this.storeChfeeFile.load({ params: { start: 0, limit: 9999, BillNo: data.BILLNO} });
|
|
|
|
|
|
if (this.bsnosql != undefined) {
|
|
|
this.storeBodyAddList.pageSize = this.PageSize;
|
|
|
this.storeBodyAddList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: this.sqlcontext },
|
|
|
callback: function (r, options, success) {
|
|
|
if (success) {
|
|
|
if (r.length != 0) {
|
|
|
_this.gridAddList.getSelectionModel().selectAll();
|
|
|
_this.addBill();
|
|
|
} else {
|
|
|
|
|
|
//Ext.MessageBox.alert('提示', '无添加发票申请费用明细!');
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
_this.GetEditStatus();
|
|
|
} else {
|
|
|
//Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
});
|
|
|
|
|
|
var billno = '*';
|
|
|
var GID = '*';
|
|
|
|
|
|
if (this.opStatus == 'edit') {
|
|
|
billno = this.editRecord.get('BILLNO');
|
|
|
GID = this.editRecord.get('GID');
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
this.storeBodyList.load({ params: { condition: " BILLNO='" + billno + "'" },
|
|
|
callback: function (r, options, success) {
|
|
|
if (success) {
|
|
|
if (this.storeBodyList.getCount() > 0) {
|
|
|
this.comboxCurr.setReadOnly(true);
|
|
|
this.comboxCustCode.setReadOnly(true);
|
|
|
}
|
|
|
else {
|
|
|
this.comboxCurr.setReadOnly(false);
|
|
|
this.comboxCustCode.setReadOnly(false);
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
});
|
|
|
this.storeBodySum.load({ params: { condition: " BILLNO='" + billno + "'"} });
|
|
|
this.storeDetailList.load({ params: { condition: " PID='" + GID + "'"} });
|
|
|
}, // end LoadDate
|
|
|
|
|
|
|
|
|
Save: function (type, fntype, submit) {
|
|
|
var basicForm = this.formEdit.getForm();
|
|
|
|
|
|
if (!basicForm.isValid()) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
this.formEdit.getForm().findField('GID').setDisabled(false);
|
|
|
this.formEdit.getForm().findField('BILLSTATUS').setDisabled(false);
|
|
|
this.formEdit.getForm().findField('APPLICANT').setDisabled(false);
|
|
|
this.formEdit.getForm().findField('COMPANYID').setDisabled(false);
|
|
|
var data = basicForm.getValues();
|
|
|
var GID = this.formEdit.getForm().findField('GID').getValue();
|
|
|
this.formEdit.getForm().findField('BILLSTATUS').setDisabled(true);
|
|
|
this.formEdit.getForm().findField('APPLICANT').setDisabled(true);
|
|
|
this.formEdit.getForm().findField('COMPANYID').setDisabled(true);
|
|
|
this.formEdit.getForm().findField('GID').setDisabled(true);
|
|
|
|
|
|
var bodydatas = [];
|
|
|
for (var i = 0; i < this.storeDetailList.getCount(); i += 1) {
|
|
|
var member = this.storeDetailList.getAt(i);
|
|
|
bodydatas.push(member);
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var jsonBody = ConvertRecordsToJsonAll(bodydatas);
|
|
|
|
|
|
Ext.Msg.wait('正在保存数据, 请稍侯..');
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在保存数据...',
|
|
|
url: '/Account/Chfee_invoiceapplication/Save',
|
|
|
scope: this,
|
|
|
params: {
|
|
|
opstatus: this.opStatus,
|
|
|
data: Ext.JSON.encode(data),
|
|
|
body: jsonBody,
|
|
|
issubmit: submit
|
|
|
},
|
|
|
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.insert(0, returnData);
|
|
|
this.editRecord = this.StoreList.getAt(0);
|
|
|
}
|
|
|
else if (this.opStatus == 'edit') {
|
|
|
var editp = Ext.create('MsChInvoiceapplication', returnData);
|
|
|
|
|
|
this.editRecord.fields.each(function (field) {
|
|
|
if (field.persist) {
|
|
|
name = field.name;
|
|
|
if (name != 'id')
|
|
|
this.editRecord.set(name, editp.get(name));
|
|
|
}
|
|
|
}, this);
|
|
|
this.editRecord.commit();
|
|
|
}
|
|
|
if (type == '0') {
|
|
|
this.opStatus = 'edit';
|
|
|
this.storeDetailList.load({ params: { condition: " PID='" + GID + "'"} });
|
|
|
if (fntype == '1') {
|
|
|
|
|
|
_this.StoreDateCurr.load({ params: { condition: "" },
|
|
|
callback: function (r, options, success) {
|
|
|
if (success) {
|
|
|
_this.addBillfn();
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
|
|
|
}
|
|
|
_this.GetEditStatus();
|
|
|
} else if (type == '1') {
|
|
|
window.close();
|
|
|
} else {
|
|
|
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
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
}, //end save
|
|
|
|
|
|
onAddDetailClick: function (button, event) {
|
|
|
this.addstore = true;
|
|
|
this.addDetail();
|
|
|
}, //end onAddDetailClick
|
|
|
|
|
|
onDelDetailClick: function (button, event, type) {
|
|
|
this.deleteDetail();
|
|
|
}, //onDelDetailClick
|
|
|
|
|
|
onAddClick: function (button, event) {
|
|
|
this.addstore = true;
|
|
|
this.addBill();
|
|
|
}, //end onAddDetailClick
|
|
|
|
|
|
onDeleteClick: function (button, event) {
|
|
|
this.deleteBill();
|
|
|
}, //end onAddDetailClick
|
|
|
|
|
|
gridListDetailAfterEdit: function (editor, e, eOpts) {
|
|
|
|
|
|
if (e.value == e.originalValue) return;
|
|
|
|
|
|
if (e.field == 'PKGS' || e.field == 'PRICE') {
|
|
|
var TaxUnitPrice = e.record.data['TAXPRICE'];
|
|
|
var quantity = e.record.data['PKGS'];
|
|
|
var taxrate = e.record.data['TAXRATE'];
|
|
|
|
|
|
|
|
|
if (taxrate != null) {
|
|
|
var taxrateb = parseFloat(1 + parseFloat(taxrate / 100));
|
|
|
var unitPrice = (parseFloat(TaxUnitPrice).div(parseFloat(taxrateb))).toFixed(2);
|
|
|
e.record.set('PRICE', unitPrice);
|
|
|
|
|
|
}
|
|
|
if (quantity == 1) {
|
|
|
taxrate = parseFloat(taxrate) / 100;
|
|
|
var tax = ((parseFloat(TaxUnitPrice).div(parseFloat(taxrateb))).mul(taxrate)).toFixed(2);
|
|
|
e.record.set('TAX', tax);
|
|
|
var amount = Add(TaxUnitPrice, -tax).toFixed(2);
|
|
|
e.record.set('AMOUNT', amount);
|
|
|
|
|
|
} else {
|
|
|
var taxamount = (parseFloat(TaxUnitPrice).mul(quantity)).toFixed(2);
|
|
|
taxrate = parseFloat(taxrate) / 100;
|
|
|
var tax = (parseFloat(taxamount).div(parseFloat(taxrateb))).mul(taxrate).toFixed(2);
|
|
|
e.record.set('TAX', tax);
|
|
|
var amount = Add(taxamount, -tax).toFixed(2);
|
|
|
e.record.set('AMOUNT', amount);
|
|
|
}
|
|
|
this.calcDetailTotal();
|
|
|
} else if (e.field == 'TAXPRICE') {
|
|
|
|
|
|
var TaxUnitPrice = e.record.data['TAXPRICE'];
|
|
|
if (e.value != 0) {
|
|
|
var quantity = e.record.data['PKGS'];
|
|
|
var taxrate = e.record.data['TAXRATE'];
|
|
|
var taxrateb = parseFloat(1 + parseFloat(taxrate / 100));
|
|
|
var unitPrice = (parseFloat(TaxUnitPrice).div(parseFloat(taxrateb))).toFixed(2);
|
|
|
e.record.set('PRICE', unitPrice);
|
|
|
|
|
|
if (quantity != null) {
|
|
|
if (quantity == 1) {
|
|
|
taxrate = parseFloat(taxrate) / 100;
|
|
|
var tax = ((parseFloat(TaxUnitPrice).div(parseFloat(taxrateb))).mul(taxrate)).toFixed(2);
|
|
|
e.record.set('TAX', tax);
|
|
|
var amount = Add(TaxUnitPrice, -tax).toFixed(2);
|
|
|
e.record.set('AMOUNT', amount);
|
|
|
|
|
|
} else {
|
|
|
var taxamount = (parseFloat(TaxUnitPrice).mul(quantity)).toFixed(2);
|
|
|
taxrate = parseFloat(taxrate) / 100;
|
|
|
var tax = (parseFloat((parseFloat(TaxUnitPrice).mul(quantity))).div(parseFloat(taxrateb))).mul(taxrate).toFixed(2);
|
|
|
e.record.set('TAX', tax);
|
|
|
var amount = Add(taxamount, -tax).toFixed(2);
|
|
|
e.record.set('AMOUNT', amount);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
this.calcDetailTotal();
|
|
|
}
|
|
|
|
|
|
} else if (e.field == 'TAXRATE') {
|
|
|
|
|
|
var taxrate = e.record.data['TAXRATE'];
|
|
|
|
|
|
var TaxUnitPrice = e.record.data['TAXPRICE'];
|
|
|
|
|
|
if (TaxUnitPrice != 0) {
|
|
|
var quantity = e.record.data['PKGS'];
|
|
|
var taxrateb = parseFloat(1 + parseFloat(taxrate / 100));
|
|
|
var unitPrice = (parseFloat(TaxUnitPrice).div(parseFloat(taxrateb))).toFixed(2);
|
|
|
e.record.set('PRICE', unitPrice);
|
|
|
|
|
|
if (quantity != null) {
|
|
|
if (quantity == 1) {
|
|
|
taxrate = parseFloat(taxrate) / 100;
|
|
|
var tax = ((parseFloat(TaxUnitPrice).div(parseFloat(taxrateb))).mul(taxrate)).toFixed(2);
|
|
|
e.record.set('TAX', tax);
|
|
|
var amount = Add(TaxUnitPrice, -tax).toFixed(2);
|
|
|
e.record.set('AMOUNT', amount);
|
|
|
|
|
|
} else {
|
|
|
var taxamount = (parseFloat(TaxUnitPrice).mul(quantity)).toFixed(2);
|
|
|
taxrate = parseFloat(taxrate) / 100;
|
|
|
var tax = (parseFloat(taxamount).div(parseFloat(taxrateb))).mul(taxrate).toFixed(2);
|
|
|
e.record.set('TAX', tax);
|
|
|
var amount = Add(taxamount, -tax).toFixed(2);
|
|
|
e.record.set('AMOUNT', amount);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
this.calcDetailTotal();
|
|
|
}
|
|
|
/*
|
|
|
if (unitPrice != null) {
|
|
|
var taxrateb = parseFloat(1 + parseFloat(taxrate / 100));
|
|
|
var TaxUnitPrice = (parseFloat(unitPrice).mul(taxrateb)).toFixed(2);
|
|
|
e.record.set('TAXPRICE', TaxUnitPrice);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
var notaxamount = e.record.data['AMOUNT'];
|
|
|
|
|
|
taxrate = parseFloat(taxrate) / 100;
|
|
|
var tax = (parseFloat(notaxamount).mul(taxrate)).toFixed(2);
|
|
|
e.record.set('TAX', tax);
|
|
|
|
|
|
this.calcDetailTotal();
|
|
|
*/
|
|
|
|
|
|
} else if (e.field == 'AMOUNT' || e.field == 'TAX') {
|
|
|
|
|
|
this.calcDetailTotal();
|
|
|
|
|
|
} else if (e.field == 'GOODSNAME') {
|
|
|
var selectrecords = DsStoreQueryBy(this.StoreCodeGoodInv, 'GID', e.value);
|
|
|
if (selectrecords.getCount() > 0) {
|
|
|
var selectdata = selectrecords.getAt(0).data;
|
|
|
e.record.set('GOODSNAMEREF', selectdata.GOODNAME);
|
|
|
e.record.set('GOODCODE', selectdata.GOODCODE);
|
|
|
e.record.set('TAXRATE', selectdata.TAXRATE);
|
|
|
e.record.set('SPEC', selectdata.SPEC);
|
|
|
e.record.set('UNIT', selectdata.UNIT);
|
|
|
var taxrate = e.record.data['TAXRATE'];
|
|
|
|
|
|
var TaxUnitPrice = e.record.data['TAXPRICE'];
|
|
|
var quantity = e.record.data['PKGS'];
|
|
|
if (TaxUnitPrice != 0) {
|
|
|
var taxrateb = parseFloat(1 + parseFloat(taxrate / 100));
|
|
|
var unitPrice = (parseFloat(TaxUnitPrice).div(parseFloat(taxrateb))).toFixed(2);
|
|
|
e.record.set('PRICE', unitPrice);
|
|
|
|
|
|
if (quantity != null) {
|
|
|
if (quantity == 1) {
|
|
|
taxrate = parseFloat(taxrate) / 100;
|
|
|
var tax = ((parseFloat(TaxUnitPrice).div(parseFloat(taxrateb))).mul(taxrate)).toFixed(2);
|
|
|
e.record.set('TAX', tax);
|
|
|
var amount = Add(TaxUnitPrice, -tax).toFixed(2);
|
|
|
e.record.set('AMOUNT', amount);
|
|
|
|
|
|
} else {
|
|
|
var taxamount = (parseFloat(TaxUnitPrice).mul(quantity)).toFixed(2);
|
|
|
taxrate = parseFloat(taxrate) / 100;
|
|
|
var tax = (parseFloat(taxamount).div(parseFloat(taxrateb))).mul(taxrate).toFixed(2);
|
|
|
e.record.set('TAX', tax);
|
|
|
var amount = Add(taxamount, -tax).toFixed(2);
|
|
|
e.record.set('AMOUNT', amount);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
this.calcDetailTotal();
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
e.record.set('GOODSNAMEREF', '');
|
|
|
e.record.set('GOODCODE', '');
|
|
|
e.record.set('SPEC', '');
|
|
|
e.record.set('UNIT', '');
|
|
|
e.record.set('TAXRATE', 0);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
ChangeInvRate: function (InvRate) {
|
|
|
for (var i = 0; i < this.storeDetailList.getCount(); i += 1) {
|
|
|
var memberbody = this.storeDetailList.getAt(i);
|
|
|
memberbody.set("TAXRATE", InvRate);
|
|
|
var TaxUnitPrice = memberbody.data.TAXPRICE;
|
|
|
|
|
|
if (TaxUnitPrice != 0) {
|
|
|
var quantity = memberbody.data.PKGS;
|
|
|
var taxrate = InvRate;
|
|
|
var taxrateb = parseFloat(1 + parseFloat(taxrate / 100));
|
|
|
var unitPrice = (parseFloat(TaxUnitPrice).div(parseFloat(taxrateb))).toFixed(2);
|
|
|
memberbody.set("PRICE", unitPrice);
|
|
|
if (quantity != null) {
|
|
|
if (quantity == 1) {
|
|
|
taxrate = parseFloat(taxrate) / 100;
|
|
|
var tax = ((parseFloat(TaxUnitPrice).div(parseFloat(taxrateb))).mul(taxrate)).toFixed(2);
|
|
|
memberbody.set("TAX", tax);
|
|
|
var amount = Add(TaxUnitPrice, -tax).toFixed(2);
|
|
|
memberbody.set("AMOUNT", amount);
|
|
|
|
|
|
} else {
|
|
|
var taxamount = (parseFloat(TaxUnitPrice).mul(quantity)).toFixed(2);
|
|
|
taxrate = parseFloat(taxrate) / 100;
|
|
|
var tax = (parseFloat(taxamount).div(parseFloat(taxrateb))).mul(taxrate).toFixed(2);
|
|
|
memberbody.set("TAX", tax);
|
|
|
var amount = Add(taxamount, -tax).toFixed(2);
|
|
|
memberbody.set("AMOUNT", amount);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
memberbody.commit();
|
|
|
}
|
|
|
this.calcDetailTotal();
|
|
|
},
|
|
|
|
|
|
calcDetailTotal: function () {
|
|
|
var ttlamt = 0;
|
|
|
|
|
|
for (var i = 0; i < this.storeDetailList.getCount(); i += 1) {
|
|
|
var member = this.storeDetailList.getAt(i);
|
|
|
var value = member.get('AMOUNT');
|
|
|
var tax = member.get('TAX');
|
|
|
ttlamt = ttlamt.add(parseFloat(value));
|
|
|
ttlamt = ttlamt.add(parseFloat(tax));
|
|
|
|
|
|
}
|
|
|
|
|
|
this.setHeadFieldValue('INVAMOUNT', Ext.util.Format.number(parseFloat(ttlamt), '00.00'));
|
|
|
|
|
|
},
|
|
|
setHeadFieldValue: function (fieldName, value) {
|
|
|
var field = this.formEdit.getForm().findField(fieldName);
|
|
|
field.setValue(value);
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
gridAddFeeListAfterEdit: function (editor, e, eOpts) {
|
|
|
//需要自己实现里面的事件
|
|
|
if (e.value == e.originalValue) return;
|
|
|
if (e.field == 'StlAmount') {
|
|
|
var BalAmount = e.record.data['BalAmount'];
|
|
|
var StlAmount = e.record.data['StlAmount'];
|
|
|
if (BalAmount >= 0) {
|
|
|
if (StlAmount > BalAmount) {
|
|
|
e.record.set('StlAmount', BalAmount);
|
|
|
Ext.Msg.show({ title: '提示', msg: '申请金额不能大于未申金额!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
if (StlAmount < BalAmount) {
|
|
|
e.record.set('StlAmount', BalAmount);
|
|
|
Ext.Msg.show({ title: '提示', msg: '申请金额不能大于未申金额!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
onNextKeyClick: function (col) {
|
|
|
|
|
|
var rows = this.gridAddFeeList.getSelectionModel().getSelection();
|
|
|
var row = rows[rows.length - 1];
|
|
|
var s = this.gridAddFeeList.getStore();
|
|
|
var number = s.indexOf(row) + 1;
|
|
|
this.cellEditingFee.startEditByPosition({ row: number, column: col });
|
|
|
},
|
|
|
|
|
|
onUpKeyClick: function (col) {
|
|
|
|
|
|
var rows = this.gridAddFeeList.getSelectionModel().getSelection();
|
|
|
var row = rows[rows.length - 1];
|
|
|
var s = this.gridAddFeeList.getStore();
|
|
|
var number = s.indexOf(row) - 1;
|
|
|
if (number < 0) number = 0;
|
|
|
this.cellEditingFee.startEditByPosition({ row: number, column: col });
|
|
|
},
|
|
|
|
|
|
onAddInvDetailClick: function () {
|
|
|
|
|
|
var BILLNO = this.editRecord.get('BILLNO');
|
|
|
|
|
|
this.formEdit.getForm().findField('GID').setDisabled(false);
|
|
|
var GID = this.formEdit.getForm().findField('GID').getValue();
|
|
|
this.formEdit.getForm().findField('GID').setDisabled(true);
|
|
|
var billtaxrate = this.formEdit.getForm().findField('RATE').getValue();
|
|
|
|
|
|
|
|
|
if (BILLNO == '*') {
|
|
|
Ext.Msg.show({ title: '注意', msg: '请先保存业务信息再添加发票明细!', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
|
|
|
var newSerialno = DsGetNewSerialNo(this.storeDetailList, 0);
|
|
|
|
|
|
var record = Ext.create('MsChInvoiceDetail', {
|
|
|
GID: '',
|
|
|
PID: '*',
|
|
|
SERIALNO: newSerialno,
|
|
|
GOODSNAME: '',
|
|
|
SPEC: '',
|
|
|
UNIT: '',
|
|
|
PKGS: 1,
|
|
|
TAXPRICE: 0,
|
|
|
PRICE: 0,
|
|
|
TAXRATE: billtaxrate,
|
|
|
AMOUNT: 0,
|
|
|
TAX: 0,
|
|
|
REMARK: ''
|
|
|
});
|
|
|
|
|
|
this.storeDetailList.add(record);
|
|
|
|
|
|
var n = this.storeDetailList.getCount();
|
|
|
this.gridDetailCellEditing.startEditByPosition({ row: n - 1, column: 1 });
|
|
|
|
|
|
},
|
|
|
|
|
|
onDelInvDetailClick: function () {
|
|
|
|
|
|
var selectedRecords = this.GridDetailCheckBoxModel.selected.items;
|
|
|
var GID = this.formEdit.getForm().findField('GID').getValue();
|
|
|
|
|
|
Ext.MessageBox.confirm('提示', '确定要删除选中的明细吗?', function (btn) {
|
|
|
if (btn == 'yes') {
|
|
|
|
|
|
var bodyDatas = [];
|
|
|
for (var i = 0; i < selectedRecords.length; i++) {
|
|
|
var rec = selectedRecords[i];
|
|
|
if (rec.GID == "" || rec.PID == "*") //如果是新增但没有保存的数据,没有必要提交到后台
|
|
|
{
|
|
|
this.storeDetailList.remove(selectedRecords[i]);
|
|
|
this.calcDetailTotal();
|
|
|
} else {
|
|
|
|
|
|
bodyDatas.push(rec);
|
|
|
}
|
|
|
}
|
|
|
var jsonBody = ConvertRecordsToJsonAll(bodyDatas);
|
|
|
_this = this;
|
|
|
|
|
|
Ext.Msg.wait('正在删除数据...');
|
|
|
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在删除数据...',
|
|
|
url: '/Account/Chfee_invoiceapplication/DelInvDetail',
|
|
|
params: {
|
|
|
bsno: GID,
|
|
|
body: jsonBody
|
|
|
},
|
|
|
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.storeDetailList.remove(selectedRecords[i]);
|
|
|
_this.calcDetailTotal();
|
|
|
}
|
|
|
|
|
|
// this.gridList.getView().refresh();
|
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
}
|
|
|
}, this);
|
|
|
|
|
|
},
|
|
|
|
|
|
addDetail: function () {
|
|
|
var btnEAddDetail = Ext.getCmp('btnadddetail');
|
|
|
btnEAddDetail.disable();
|
|
|
var btnEAddbill = Ext.getCmp('btnaddbill');
|
|
|
btnEAddbill.disable();
|
|
|
|
|
|
var basicForm = this.formEdit.getForm();
|
|
|
var Duino = this.formEdit.getForm().findField('BILLNO').getValue();
|
|
|
_this = this;
|
|
|
if ((Duino == '*') || basicForm.isDirty()) {
|
|
|
|
|
|
var RECVCURR = this.formEdit.getForm().findField('RECVCURR').getValue();
|
|
|
var CUSTOMERNAME = this.formEdit.getForm().findField('CUSTOMERNAME').getValue();
|
|
|
var CURR = this.formEdit.getForm().findField('CURRENCY').getValue();
|
|
|
if ((CUSTOMERNAME == '') || (CUSTOMERNAME == null) || (CURR == '') || (CURR == null)) {
|
|
|
var selectedRecords = this.gridAddFeeList.selModel.getSelection();
|
|
|
if (selectedRecords.length > 0) {
|
|
|
var rec = selectedRecords[0];
|
|
|
var cust = rec.data.CustomerName;
|
|
|
var curr = rec.data.Currency;
|
|
|
var taxrate = rec.data.AccTaxRate;
|
|
|
if ((CUSTOMERNAME == '') || (CUSTOMERNAME == null)) {
|
|
|
this.formEdit.getForm().findField('CUSTOMERNAME').setValue(cust);
|
|
|
var recs = DsStoreQueryBy(this.storeInvCustCodeAdd, 'CustName', cust);
|
|
|
var INVOICECUSTNAME = this.formEdit.getForm().findField('INVOICECUSTNAME');
|
|
|
var CUSTRATENO = this.formEdit.getForm().findField('CUSTRATENO');
|
|
|
var CUSTADDRTEL = this.formEdit.getForm().findField('CUSTADDRTEL');
|
|
|
var CUSTBANK = this.formEdit.getForm().findField('CUSTBANK');
|
|
|
var CURRFIELD = this.formEdit.getForm().findField('CURRENCY');
|
|
|
this.formEdit.getForm().findField('RECVCURR').setValue(curr);
|
|
|
var RECVCURR = curr;
|
|
|
|
|
|
this.formEdit.getForm().findField('RATE').setValue(taxrate);
|
|
|
var CURR = CURRFIELD.getValue();
|
|
|
if (recs.getCount() > 0) {
|
|
|
var data = recs.getAt(0).data;
|
|
|
|
|
|
|
|
|
INVOICECUSTNAME.setValue(data.BillRises1);
|
|
|
CUSTRATENO.setValue(data.TaxNo);
|
|
|
if (data.INVADDRTEL == '')
|
|
|
CUSTADDRTEL.setValue(data.Addr + ' ' + data.Tel);
|
|
|
else
|
|
|
CUSTADDRTEL.setValue(data.INVADDRTEL);
|
|
|
if (RECVCURR == 'RMB')
|
|
|
CUSTBANK.setValue(data.RMBBank);
|
|
|
if (RECVCURR == 'USD')
|
|
|
CUSTBANK.setValue(data.USDBank);
|
|
|
|
|
|
} else {
|
|
|
INVOICECUSTNAME.setValue('');
|
|
|
CUSTRATENO.setValue('');
|
|
|
CUSTADDRTEL.setValue('');
|
|
|
CUSTBANK.setValue('');
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if ((CURR == '') || (CURR == null)) {
|
|
|
btnEAddDetail.enable();
|
|
|
Ext.Msg.show({ title: '提示', msg: '币别不能为空!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if (this.storeBodyList.getCount() == 0) {
|
|
|
var selectedRecords = this.gridAddFeeList.selModel.getSelection();
|
|
|
if (selectedRecords.length > 0) {
|
|
|
var rec = selectedRecords[0];
|
|
|
var taxrate = rec.data.AccTaxRate;
|
|
|
this.formEdit.getForm().findField('RATE').setValue(taxrate);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
if (!basicForm.isValid()) {
|
|
|
btnEAddDetail.enable();
|
|
|
btnEAddbill.enable();
|
|
|
return;
|
|
|
}
|
|
|
var type = 0;
|
|
|
|
|
|
//var PAYCOMPANYID = Ext.getCmp('PAYCOMPANYID').getValue();
|
|
|
//if ((PAYCOMPANYID == '') || (PAYCOMPANYID == null)) {
|
|
|
// var selectedRecords = this.gridAddList.selModel.getSelection();
|
|
|
// if (selectedRecords.length > 0) {
|
|
|
// var rec = selectedRecords[0];
|
|
|
// var PAYCOMPANYID = rec.data.COMPANYID;
|
|
|
// Ext.getCmp('PAYCOMPANYID').setValue(PAYCOMPANYID);
|
|
|
// }
|
|
|
|
|
|
//}
|
|
|
|
|
|
this.formEdit.getForm().findField('GID').setDisabled(false);
|
|
|
this.formEdit.getForm().findField('BILLSTATUS').setDisabled(false);
|
|
|
this.formEdit.getForm().findField('APPLICANT').setDisabled(false);
|
|
|
this.formEdit.getForm().findField('COMPANYID').setDisabled(false);
|
|
|
var data = basicForm.getValues();
|
|
|
var GID = this.formEdit.getForm().findField('GID').getValue();
|
|
|
this.formEdit.getForm().findField('BILLSTATUS').setDisabled(true);
|
|
|
this.formEdit.getForm().findField('APPLICANT').setDisabled(true);
|
|
|
this.formEdit.getForm().findField('COMPANYID').setDisabled(true);
|
|
|
this.formEdit.getForm().findField('GID').setDisabled(true);
|
|
|
|
|
|
var bodydatas = [];
|
|
|
for (var i = 0; i < this.storeDetailList.getCount(); i += 1) {
|
|
|
var member = this.storeDetailList.getAt(i);
|
|
|
bodydatas.push(member);
|
|
|
}
|
|
|
|
|
|
var jsonBody = ConvertRecordsToJsonAll(bodydatas);
|
|
|
|
|
|
Ext.Msg.wait('正在保存数据, 请稍侯..');
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在保存数据...',
|
|
|
url: '/Account/Chfee_invoiceapplication/Save',
|
|
|
scope: this,
|
|
|
params: {
|
|
|
opstatus: this.opStatus,
|
|
|
data: Ext.JSON.encode(data),
|
|
|
body: jsonBody
|
|
|
},
|
|
|
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.insert(0, returnData);
|
|
|
this.editRecord = this.StoreList.getAt(0);
|
|
|
}
|
|
|
else if (this.opStatus == 'edit') {
|
|
|
var editp = Ext.create('MsChInvoiceapplication', returnData);
|
|
|
|
|
|
this.editRecord.fields.each(function (field) {
|
|
|
if (field.persist) {
|
|
|
name = field.name;
|
|
|
if (name != 'id')
|
|
|
this.editRecord.set(name, editp.get(name));
|
|
|
}
|
|
|
}, this);
|
|
|
this.editRecord.commit();
|
|
|
}
|
|
|
|
|
|
this.opStatus = 'edit';
|
|
|
_this.addDetailfn();
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
btnEAddDetail.enable();
|
|
|
btnEAddbill.enable();
|
|
|
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
|
|
|
}
|
|
|
} else {
|
|
|
btnEAddDetail.enable();
|
|
|
|
|
|
Ext.Msg.show({ title: '请重试',
|
|
|
msg: '服务器响应出错',
|
|
|
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
} else {
|
|
|
|
|
|
this.addDetailfn();
|
|
|
}
|
|
|
}, //end save
|
|
|
|
|
|
addDetailfn: function () {
|
|
|
var btnEAddDetail = Ext.getCmp('btnadddetail');
|
|
|
if (this.addstore) {
|
|
|
this.storeCurrExrate.removeAll();
|
|
|
this.addstore = false;
|
|
|
}
|
|
|
var btnEAddbill = Ext.getCmp('btnaddbill');
|
|
|
|
|
|
|
|
|
|
|
|
var Duino = this.formEdit.getForm().findField('BILLNO').getValue();
|
|
|
|
|
|
var billstatus = this.formEdit.getForm().findField('BILLSTATUS').getValue();
|
|
|
|
|
|
var GID = this.formEdit.getForm().findField('GID').getValue();
|
|
|
|
|
|
var jobValue = this.FeeGroup.getValue();
|
|
|
|
|
|
if ((billstatus != 1) && (billstatus != 4)) {
|
|
|
btnEAddDetail.enable();
|
|
|
btnEAddbill.enable();
|
|
|
Ext.Msg.show({ title: '提示', msg: '当前状态无法添加发票申请明细!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
var basicForm = this.formEdit.getForm();
|
|
|
|
|
|
|
|
|
|
|
|
var billcust = this.editRecord.data.CUSTOMERNAME;
|
|
|
var billno = this.editRecord.data.BILLNO;
|
|
|
var billcurr = this.editRecord.data.CURRENCY;
|
|
|
var billtaxrate = this.editRecord.data.RATE;
|
|
|
var billgroupcorp = this.GetGroupCorp(billcust);
|
|
|
|
|
|
var selectedRecords = this.gridAddFeeList.selModel.getSelection();
|
|
|
|
|
|
var bodyAddDatas = [];
|
|
|
_this = this;
|
|
|
|
|
|
|
|
|
var issametaxrate = true;
|
|
|
var issamecust = true;
|
|
|
|
|
|
for (var i = 0; i < selectedRecords.length; i++) {
|
|
|
var rec = selectedRecords[i];
|
|
|
var cust = rec.data.CustomerName;
|
|
|
var custgroupcorp = this.GetGroupCorp(cust);
|
|
|
var bsno = rec.data.BSNO;
|
|
|
var curr = rec.data.Currency;
|
|
|
var acctaxrate = rec.data.AccTaxRate;
|
|
|
var ExChangerate = rec.data.ExChangerate;
|
|
|
if (cust == billcust || cust == billgroupcorp || (custgroupcorp == billgroupcorp && custgroupcorp != '')) {
|
|
|
if (billtaxrate == acctaxrate) {
|
|
|
if (billcurr == curr) {
|
|
|
rec.data.DoAmount = rec.data.StlAmount;
|
|
|
} else {
|
|
|
var recs = DsStoreQueryBy(_this.storeCurrExrate, 'CURR', curr);
|
|
|
if (recs.getCount() > 0) {
|
|
|
var data = recs.getAt(0).data;
|
|
|
var EXRATE = data.EXRATE;
|
|
|
rec.data.ExChangerate = EXRATE;
|
|
|
rec.data.DoAmount = parseFloat(rec.data.StlAmount).mul(parseFloat(EXRATE));
|
|
|
|
|
|
} else {
|
|
|
_this.ExrateConversion(curr, billcurr, 'detail', ExChangerate);
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
bodyAddDatas.push(rec);
|
|
|
} else {
|
|
|
|
|
|
// Ext.Msg.show({ title: '提示', msg: '费用进项税率与发票申请税率不一致,不能添加此费用明细!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
|
|
|
|
issametaxrate = false;
|
|
|
// alert('费用进项税率与发票申请税率不一致,不能添加此费用明细!');
|
|
|
}
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
// Ext.Msg.show({ title: '提示', msg: '费用对象与开票客户不一致,不能添加此费用明细!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
|
issamecust = false;
|
|
|
|
|
|
// alert('费用对象与开票客户不一致,不能添加此费用明细!');
|
|
|
}
|
|
|
}
|
|
|
if (!issametaxrate) {
|
|
|
btnEAddDetail.enable();
|
|
|
btnEAddbill.enable();
|
|
|
Ext.Msg.show({ title: '提示', msg: '费用进项税率与发票申请税率不一致,不能添加此费用明细!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
|
return;
|
|
|
}
|
|
|
if (!issamecust) {
|
|
|
btnEAddDetail.enable();
|
|
|
btnEAddbill.enable();
|
|
|
Ext.Msg.show({ title: '提示', msg: '费用对象与开票客户不一致,不能添加此费用明细!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
|
|
|
if (bodyAddDatas.length == 0) {
|
|
|
btnEAddDetail.enable();
|
|
|
btnEAddbill.enable();
|
|
|
Ext.Msg.show({ title: '提示', msg: '没有要添加的费用明细!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
|
return;
|
|
|
};
|
|
|
|
|
|
var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas);
|
|
|
|
|
|
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在添加数据...',
|
|
|
url: '/Account/Chfee_invoiceapplication/AddDetail',
|
|
|
params: {
|
|
|
bill: billno,
|
|
|
data: jsonbodyAddDatas,
|
|
|
curr: billcurr,
|
|
|
islist: jobValue,
|
|
|
GID: GID,
|
|
|
custgroup: true
|
|
|
},
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
var result = Ext.JSON.decode(response.responseText);
|
|
|
if (!result.Success) {
|
|
|
btnEAddDetail.enable();
|
|
|
btnEAddbill.enable();
|
|
|
Ext.Msg.show({
|
|
|
title: '提示',
|
|
|
msg: result.Message,
|
|
|
icon: Ext.MessageBox.ERROR,
|
|
|
buttons: Ext.Msg.OK
|
|
|
});
|
|
|
return;
|
|
|
} else {
|
|
|
|
|
|
this.storeAddFeeList.reload();
|
|
|
var sql = this.sqlcontext;
|
|
|
this.storeBodyAddList.load({ params: { start: 0, limit: _this.PageSize, sort: '', condition: sql} });
|
|
|
|
|
|
|
|
|
_this.storeBodyList.load({ params: { condition: " BILLNO='" + billno + "'" },
|
|
|
callback: function (r, options, success) {
|
|
|
if (success) {
|
|
|
if (_this.storeBodyList.getCount() > 0) {
|
|
|
_this.comboxCurr.setReadOnly(true);
|
|
|
_this.comboxCustCode.setReadOnly(true);
|
|
|
}
|
|
|
else {
|
|
|
_this.comboxCurr.setReadOnly(false);
|
|
|
_this.comboxCustCode.setReadOnly(false);
|
|
|
_this.formEdit.getForm().findField('CUSTOMERNAME').setValue("");
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
});
|
|
|
|
|
|
this.storeBodySum.load({ params: { condition: " BILLNO='" + billno + "'"} });
|
|
|
this.storeDetailList.load({ params: { condition: " PID='" + GID + "'"} });
|
|
|
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在查询主表数据...',
|
|
|
url: '/Account/Chfee_invoiceapplication/GetData',
|
|
|
params: {
|
|
|
handle: 'edit',
|
|
|
condition: " BILLNO='" + billno + "'"
|
|
|
},
|
|
|
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();
|
|
|
this.formEdit.getForm().setValues(data);
|
|
|
var editp = Ext.create('MsChInvoiceapplication', data);
|
|
|
|
|
|
this.editRecord.fields.each(function (field) {
|
|
|
if (field.persist) {
|
|
|
name = field.name;
|
|
|
if (name != 'id')
|
|
|
this.editRecord.set(name, editp.get(name));
|
|
|
}
|
|
|
}, this);
|
|
|
this.editRecord.commit();
|
|
|
|
|
|
} else {
|
|
|
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
});
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
btnEAddDetail.enable();
|
|
|
btnEAddbill.enable();
|
|
|
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
});
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
addBill: function () {
|
|
|
|
|
|
var btnEAddbill = Ext.getCmp('btnaddbill');
|
|
|
var basicForm = this.formEdit.getForm();
|
|
|
btnEAddbill.disable();
|
|
|
var btnEAddDetail = Ext.getCmp('btnadddetail');
|
|
|
btnEAddDetail.disable();
|
|
|
var Duino = this.formEdit.getForm().findField('BILLNO').getValue();
|
|
|
_this = this;
|
|
|
|
|
|
if (this.bsnosql != undefined) {
|
|
|
|
|
|
if (this.bsCust != undefined) {
|
|
|
//var recs = DsStoreQueryBy(this.storeInvCustCodeAdd, 'CustName', this.bsCust);
|
|
|
//var INVOICECUSTNAME = this.formEdit.getForm().findField('INVOICECUSTNAME');
|
|
|
//var CUSTRATENO = this.formEdit.getForm().findField('CUSTRATENO');
|
|
|
//var CUSTADDRTEL = this.formEdit.getForm().findField('CUSTADDRTEL');
|
|
|
//var CUSTBANK = this.formEdit.getForm().findField('CUSTBANK');
|
|
|
//var CURRFIELD = this.formEdit.getForm().findField('CURRENCY');
|
|
|
//var CURR = CURRFIELD.getValue();
|
|
|
//if (recs.getCount() > 0) {
|
|
|
// var data = recs.getAt(0).data;
|
|
|
// INVOICECUSTNAME.setValue(data.BillRises1);
|
|
|
// CUSTRATENO.setValue(data.TaxNo);
|
|
|
// if (data.INVADDRTEL == '')
|
|
|
// CUSTADDRTEL.setValue(data.Addr + ' ' + data.Tel);
|
|
|
// else
|
|
|
// CUSTADDRTEL.setValue(data.INVADDRTEL);
|
|
|
// CUSTBANK.setValue(data.RMBBank);
|
|
|
//} else {
|
|
|
// INVOICECUSTNAME.setValue('');
|
|
|
// CUSTRATENO.setValue('');
|
|
|
// CUSTADDRTEL.setValue('');
|
|
|
// CUSTBANK.setValue('');
|
|
|
//}
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.Save('0', '1');
|
|
|
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
|
|
|
if ((Duino == '*') || basicForm.isDirty()) {
|
|
|
|
|
|
var CUSTOMERNAME = this.formEdit.getForm().findField('CUSTOMERNAME').getValue();
|
|
|
|
|
|
|
|
|
var CURR = this.formEdit.getForm().findField('CURRENCY').getValue();
|
|
|
if ((CUSTOMERNAME == '') || (CUSTOMERNAME == null) || (CURR == '') || (CURR == null)) {
|
|
|
if (this.storeAddFeeList.getCount() > 0) {
|
|
|
var rec = this.storeAddFeeList.getAt(0);
|
|
|
var cust = rec.data.CustomerName;
|
|
|
var curr = rec.data.Currency;
|
|
|
var taxrate = rec.data.AccTaxRate;
|
|
|
if ((CUSTOMERNAME == '') || (CUSTOMERNAME == null)) {
|
|
|
this.formEdit.getForm().findField('CUSTOMERNAME').setValue(cust);
|
|
|
var recs = DsStoreQueryBy(this.storeInvCustCodeAdd, 'CustName', cust);
|
|
|
var INVOICECUSTNAME = this.formEdit.getForm().findField('INVOICECUSTNAME');
|
|
|
var CUSTRATENO = this.formEdit.getForm().findField('CUSTRATENO');
|
|
|
var CUSTADDRTEL = this.formEdit.getForm().findField('CUSTADDRTEL');
|
|
|
var CUSTBANK = this.formEdit.getForm().findField('CUSTBANK');
|
|
|
var CURRFIELD = this.formEdit.getForm().findField('CURRENCY');
|
|
|
this.formEdit.getForm().findField('RECVCURR').setValue(curr);
|
|
|
var RECVCURR = curr;
|
|
|
this.formEdit.getForm().findField('RATE').setValue(taxrate);
|
|
|
var CURR = CURRFIELD.getValue();
|
|
|
if (recs.getCount() > 0) {
|
|
|
var data = recs.getAt(0).data;
|
|
|
INVOICECUSTNAME.setValue(data.BillRises1);
|
|
|
CUSTRATENO.setValue(data.TaxNo);
|
|
|
if (data.INVADDRTEL == '')
|
|
|
CUSTADDRTEL.setValue(data.Addr + ' ' + data.Tel);
|
|
|
else
|
|
|
CUSTADDRTEL.setValue(data.INVADDRTEL);
|
|
|
// CUSTADDRTEL.setValue(data.Addr + ' ' + data.Tel);
|
|
|
if (RECVCURR == 'RMB')
|
|
|
CUSTBANK.setValue(data.RMBBank);
|
|
|
if (RECVCURR == 'USD')
|
|
|
CUSTBANK.setValue(data.USDBank);
|
|
|
|
|
|
// if (CURR == 'RMB') {
|
|
|
// this.storecustbank.load({ params: { condition: " CURRENCY='RMB' AND LINKID=(SELECT TOP 1 GID FROM INFO_CLIENT WHERE SHORTNAME='" + cust + "')" },
|
|
|
// callback: function (r, options, success) {
|
|
|
// if (success) {
|
|
|
// if (r.length != 0) {
|
|
|
// CUSTBANK.setValue(this.storecustbank.data.items[0].data.BANKNAME_ACCOUNT);
|
|
|
// }
|
|
|
// }
|
|
|
// },
|
|
|
// scope: this
|
|
|
// });
|
|
|
// } else if (CURR == 'USD') {
|
|
|
// this.storecustbank.load({ params: { condition: " CURRENCY='USD' AND LINKID=(SELECT TOP 1 GID FROM INFO_CLIENT WHERE SHORTNAME='" + cust + "')" },
|
|
|
// callback: function (r, options, success) {
|
|
|
// if (success) {
|
|
|
// if (r.length != 0) {
|
|
|
// CUSTBANK.setValue(this.storecustbank.data.items[0].data.BANKNAME_ACCOUNT);
|
|
|
// }
|
|
|
// }
|
|
|
// },
|
|
|
// scope: this
|
|
|
// });
|
|
|
// }
|
|
|
} else {
|
|
|
INVOICECUSTNAME.setValue('');
|
|
|
CUSTRATENO.setValue('');
|
|
|
CUSTADDRTEL.setValue('');
|
|
|
CUSTBANK.setValue('');
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
if ((CURR == '') || (CURR == null))
|
|
|
this.formEdit.getForm().findField('CURRENCY').setValue(curr);
|
|
|
|
|
|
|
|
|
} else {
|
|
|
btnEAddbill.enable();
|
|
|
btnEAddDetail.enable();
|
|
|
Ext.Msg.show({ title: '提示', msg: '结算客户和币别不能为空!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if (!basicForm.isValid()) {
|
|
|
btnEAddbill.enable();
|
|
|
btnEAddDetail.enable();
|
|
|
return;
|
|
|
}
|
|
|
var type = 0;
|
|
|
|
|
|
//var PAYCOMPANYID = Ext.getCmp('PAYCOMPANYID').getValue();
|
|
|
//if ((PAYCOMPANYID == '') || (PAYCOMPANYID == null)) {
|
|
|
// var selectedRecords = this.gridAddList.selModel.getSelection();
|
|
|
// if (selectedRecords.length > 0) {
|
|
|
// var rec = selectedRecords[0];
|
|
|
// var PAYCOMPANYID = rec.data.COMPANYID;
|
|
|
// Ext.getCmp('PAYCOMPANYID').setValue(PAYCOMPANYID);
|
|
|
// }
|
|
|
//}
|
|
|
|
|
|
if (this.storeBodyList.getCount() == 0) {
|
|
|
if (this.storeAddFeeList.getCount() > 0) {
|
|
|
var rec = this.storeAddFeeList.getAt(0);
|
|
|
var taxrate = rec.data.AccTaxRate;
|
|
|
this.formEdit.getForm().findField('RATE').setValue(taxrate);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
this.formEdit.getForm().findField('GID').setDisabled(false);
|
|
|
// this.formEdit.getForm().findField('BILLSTATUS').setDisabled(false);
|
|
|
this.formEdit.getForm().findField('COMPANYID').setDisabled(false);
|
|
|
var data = basicForm.getValues();
|
|
|
var GID = this.formEdit.getForm().findField('GID').getValue();
|
|
|
// this.formEdit.getForm().findField('BILLSTATUS').setDisabled(true);
|
|
|
this.formEdit.getForm().findField('COMPANYID').setDisabled(true);
|
|
|
this.formEdit.getForm().findField('GID').setDisabled(true);
|
|
|
|
|
|
var bodydatas = [];
|
|
|
for (var i = 0; i < this.storeDetailList.getCount(); i += 1) {
|
|
|
var member = this.storeDetailList.getAt(i);
|
|
|
bodydatas.push(member);
|
|
|
}
|
|
|
|
|
|
var jsonBody = ConvertRecordsToJsonAll(bodydatas);
|
|
|
|
|
|
Ext.Msg.wait('正在保存数据, 请稍侯..');
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在保存数据...',
|
|
|
url: '/Account/Chfee_invoiceapplication/Save',
|
|
|
scope: this,
|
|
|
params: {
|
|
|
opstatus: this.opStatus,
|
|
|
data: Ext.JSON.encode(data),
|
|
|
body: jsonBody
|
|
|
},
|
|
|
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.insert(0, returnData);
|
|
|
this.editRecord = this.StoreList.getAt(0);
|
|
|
}
|
|
|
else if (this.opStatus == 'edit') {
|
|
|
var editp = Ext.create('MsChInvoiceapplication', returnData);
|
|
|
|
|
|
this.editRecord.fields.each(function (field) {
|
|
|
if (field.persist) {
|
|
|
name = field.name;
|
|
|
if (name != 'id')
|
|
|
this.editRecord.set(name, editp.get(name));
|
|
|
}
|
|
|
}, this);
|
|
|
this.editRecord.commit();
|
|
|
}
|
|
|
this.opStatus = 'edit';
|
|
|
this.storeDetailList.load({ params: { condition: " PID='" + GID + "'"} });
|
|
|
_this.addBillfn();
|
|
|
|
|
|
} else {
|
|
|
btnEAddbill.enable();
|
|
|
btnEAddDetail.enable();
|
|
|
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
|
|
|
}
|
|
|
} else {
|
|
|
btnEAddbill.enable();
|
|
|
btnEAddDetail.enable();
|
|
|
Ext.Msg.show({ title: '请重试',
|
|
|
msg: '服务器响应出错',
|
|
|
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
} else {
|
|
|
|
|
|
this.addBillfn();
|
|
|
}
|
|
|
}, //end save
|
|
|
|
|
|
addBillfn: function () {
|
|
|
|
|
|
var btnEAddbill = Ext.getCmp('btnaddbill');
|
|
|
var btnEAddDetail = Ext.getCmp('btnadddetail');
|
|
|
|
|
|
var Duino = this.formEdit.getForm().findField('BILLNO').getValue();
|
|
|
|
|
|
var billstatus = this.formEdit.getForm().findField('BILLSTATUS').getValue();
|
|
|
|
|
|
var GID = this.formEdit.getForm().findField('GID').getValue();
|
|
|
|
|
|
var jobValue = this.FeeGroup.getValue();
|
|
|
|
|
|
if (this.isfeename != undefined) {
|
|
|
if (this.isfeename == 1) jobValue = true;
|
|
|
}
|
|
|
|
|
|
if ((billstatus != 1) && (billstatus != 4)) {
|
|
|
btnEAddbill.enable();
|
|
|
btnEAddDetail.enable();
|
|
|
Ext.Msg.show({ title: '提示', msg: '当前状态无法添加发票申请明细!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
if (this.addstore) {
|
|
|
this.storeCurrExrate.removeAll();
|
|
|
this.addstore = false;
|
|
|
}
|
|
|
|
|
|
var billcust = this.editRecord.data.CUSTOMERNAME;
|
|
|
var billno = this.editRecord.data.BILLNO;
|
|
|
var billcurr = this.editRecord.data.CURRENCY;
|
|
|
var billgroupcorp = this.GetGroupCorp(billcust);
|
|
|
var taxrate=this.formEdit.getForm().findField('RATE').getValue();
|
|
|
|
|
|
|
|
|
var feeBSNOSql = '';
|
|
|
var sql = '';
|
|
|
var selectedRecords = this.gridAddList.selModel.getSelection();
|
|
|
|
|
|
if (selectedRecords.length == 0) {
|
|
|
btnEAddbill.enable();
|
|
|
btnEAddDetail.enable();
|
|
|
Ext.Msg.show({ title: '提示', msg: '没有选择要添加的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
|
return;
|
|
|
};
|
|
|
var issamecust = true;
|
|
|
var bodyAddDatas = [];
|
|
|
for (var i = 0; i < selectedRecords.length; i++) {
|
|
|
|
|
|
var rec = selectedRecords[i];
|
|
|
var custgroupcorp = this.GetGroupCorp(rec.data.FEEOBJNAME);
|
|
|
if (rec.data.FEEOBJNAME == billcust || rec.data.FEEOBJNAME == billgroupcorp || (custgroupcorp == billgroupcorp && custgroupcorp != '')) {
|
|
|
|
|
|
var feeBSNO = " (BSNO='" + rec.data.BSNO + "' AND CUSTOMERNAME='" + rec.data.FEEOBJNAME + "') ";
|
|
|
if (feeBSNOSql == '') {
|
|
|
feeBSNOSql = feeBSNO;
|
|
|
} else {
|
|
|
feeBSNOSql = feeBSNOSql + " OR " + feeBSNO;
|
|
|
}
|
|
|
} else {
|
|
|
var issamecust = false;
|
|
|
|
|
|
alert('费用对象与开票客户不一致,不能添加此费用明细!');
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if (!issamecust) {
|
|
|
btnEAddbill.enable();
|
|
|
btnEAddDetail.enable();
|
|
|
Ext.Msg.show({ title: '提示', msg: '费用对象与开票客户不一致,不能添加此费用明细!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if (feeBSNOSql == '') {
|
|
|
btnEAddbill.enable();
|
|
|
btnEAddDetail.enable();
|
|
|
Ext.Msg.show({ title: '提示', msg: '没有要添加的费用明细!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
|
sql = " ";
|
|
|
return;
|
|
|
}
|
|
|
else {
|
|
|
sql = " (" + feeBSNOSql + ")";
|
|
|
sql = sql + getAndConSql(sql, this.FeeSqlStr, this.FeeSqlStr);
|
|
|
}
|
|
|
if (taxrate!='')
|
|
|
sql = sql + " and f.ACCTAXRATE=" + taxrate;
|
|
|
|
|
|
_this = this;
|
|
|
var bodydatas = [];
|
|
|
for (var i = 0; i < this.storeCurrExrate.getCount(); i += 1) {
|
|
|
var member = this.storeCurrExrate.getAt(i);
|
|
|
if (member.data.EXRATE == 0) {
|
|
|
_this.ExrateConversion(member.CURR, billcurr, 'bill', 0);
|
|
|
return;
|
|
|
}
|
|
|
bodydatas.push(member);
|
|
|
}
|
|
|
|
|
|
var currBody = ConvertRecordsToJsonAll(bodydatas);
|
|
|
|
|
|
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在添加数据...',
|
|
|
url: '/Account/Chfee_invoiceapplication/AddBill',
|
|
|
params: {
|
|
|
billno: billno,
|
|
|
billcust: billcust,
|
|
|
billcurr: billcurr,
|
|
|
feesql: sql,
|
|
|
storeCurrExrate: currBody,
|
|
|
islist: jobValue,
|
|
|
GID: GID,
|
|
|
custgroup: true
|
|
|
},
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
var result = Ext.JSON.decode(response.responseText);
|
|
|
if (!result.Success) {
|
|
|
btnEAddbill.enable();
|
|
|
btnEAddDetail.enable();
|
|
|
Ext.Msg.show({
|
|
|
title: '提示',
|
|
|
msg: result.Message,
|
|
|
icon: Ext.MessageBox.ERROR,
|
|
|
buttons: Ext.Msg.OK
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
|
|
dataList = result.Data;
|
|
|
|
|
|
if (dataList == null) {
|
|
|
|
|
|
if (result.Message != '添加成功') {
|
|
|
Ext.MessageBox.alert("提示", result.Message);
|
|
|
|
|
|
}
|
|
|
|
|
|
var sql = this.sqlcontext;
|
|
|
|
|
|
var sortstr = 'b.ETD,b.MBLNO,f.BsNo ';
|
|
|
|
|
|
if (this.addsortfield != '' && this.addsortdire != '') {
|
|
|
|
|
|
sortstr = this.addsortfield + ' ' + this.addsortdire;
|
|
|
}
|
|
|
|
|
|
this.storeBodyAddList.reload();
|
|
|
this.storeBodyList.load({ params: { condition: " BILLNO='" + billno + "'" },
|
|
|
callback: function (r, options, success) {
|
|
|
if (success) {
|
|
|
if (_this.storeBodyList.getCount() > 0) {
|
|
|
_this.comboxCurr.setReadOnly(true);
|
|
|
_this.comboxCustCode.setReadOnly(true);
|
|
|
}
|
|
|
else {
|
|
|
_this.comboxCurr.setReadOnly(false);
|
|
|
_this.comboxCustCode.setReadOnly(false);
|
|
|
_this.formEdit.getForm().findField('CUSTOMERNAME').setValue("");
|
|
|
}
|
|
|
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
});
|
|
|
this.storeDetailList.load({ params: { condition: " PID='" + GID + "'"} });
|
|
|
this.storeBodySum.load({ params: { condition: " BILLNO='" + billno + "'"} });
|
|
|
|
|
|
var CUSTBANK = this.formEdit.getForm().findField('CUSTBANK')
|
|
|
if (this.bsCust != undefined && (CUSTBANK == null || CUSTBANK == '')) {
|
|
|
var recs = DsStoreQueryBy(this.storeInvCustCodeAdd, 'CustName', this.bsCust);
|
|
|
var INVOICECUSTNAME = this.formEdit.getForm().findField('INVOICECUSTNAME');
|
|
|
var CUSTRATENO = this.formEdit.getForm().findField('CUSTRATENO');
|
|
|
var CUSTADDRTEL = this.formEdit.getForm().findField('CUSTADDRTEL');
|
|
|
var CUSTBANK = this.formEdit.getForm().findField('CUSTBANK');
|
|
|
var CURRFIELD = this.formEdit.getForm().findField('CURRENCY');
|
|
|
var CURR = CURRFIELD.getValue();
|
|
|
if (recs.getCount() > 0) {
|
|
|
var data = recs.getAt(0).data;
|
|
|
INVOICECUSTNAME.setValue(data.BillRises1);
|
|
|
CUSTRATENO.setValue(data.TaxNo);
|
|
|
if (data.INVADDRTEL == '')
|
|
|
CUSTADDRTEL.setValue(data.Addr + ' ' + data.Tel);
|
|
|
else
|
|
|
CUSTADDRTEL.setValue(data.INVADDRTEL);
|
|
|
CUSTBANK.setValue(data.RMBBank);
|
|
|
} else {
|
|
|
INVOICECUSTNAME.setValue('');
|
|
|
CUSTRATENO.setValue('');
|
|
|
CUSTADDRTEL.setValue('');
|
|
|
CUSTBANK.setValue('');
|
|
|
}
|
|
|
this.Save('0');
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在查询主表数据...',
|
|
|
url: '/Account/Chfee_invoiceapplication/GetData',
|
|
|
params: {
|
|
|
handle: 'edit',
|
|
|
condition: " BILLNO='" + billno + "'",
|
|
|
isapp: false
|
|
|
},
|
|
|
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();
|
|
|
this.formEdit.getForm().setValues(data);
|
|
|
var editp = Ext.create('MsChInvoiceapplication', data);
|
|
|
|
|
|
this.editRecord.fields.each(function (field) {
|
|
|
if (field.persist) {
|
|
|
name = field.name;
|
|
|
if (name != 'id')
|
|
|
this.editRecord.set(name, editp.get(name));
|
|
|
}
|
|
|
}, this);
|
|
|
this.editRecord.commit();
|
|
|
this.storeDetailList.load({ params: { condition: " PID='" + data.GID + "'" } });
|
|
|
|
|
|
|
|
|
} else {
|
|
|
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
});
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
if (dataList.lenght != 0) {
|
|
|
for (var i = 0; i < dataList.length; i++) {
|
|
|
var record = dataList[i];
|
|
|
_this.storeCurrExrate.add(record);
|
|
|
}
|
|
|
_this.ExrateConversion(record.CURR, billcurr, 'bill', 0);
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
btnEAddbill.enable();
|
|
|
btnEAddDetail.enable();
|
|
|
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
});
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
deleteBill: function (type) {
|
|
|
var btnEDeleteDetail = Ext.getCmp('btndeldetail');
|
|
|
btnEDeleteDetail.disable();
|
|
|
var billno = this.formEdit.getForm().findField('BILLNO').getValue();
|
|
|
var GID = this.formEdit.getForm().findField('GID').getValue();
|
|
|
|
|
|
var selectedRecords = this.gridList.selModel.getSelection();
|
|
|
|
|
|
if (selectedRecords.length == 0) {
|
|
|
Ext.Msg.show({ title: '提示', msg: '没有要删除的费用明细!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
|
btnEDeleteDetail.enable();
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
var billstatus = this.formEdit.getForm().findField('BILLSTATUS').getValue();
|
|
|
|
|
|
if ((billstatus != 1) && (billstatus != 4)) {
|
|
|
|
|
|
Ext.Msg.show({ title: '提示', msg: '当前状态无法删除发票申请明细!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
|
btnEDeleteDetail.enable();
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var bodyAddDatas = [];
|
|
|
for (var i = 0; i < selectedRecords.length; i++) {
|
|
|
var rec = selectedRecords[i];
|
|
|
bodyAddDatas.push(rec);
|
|
|
}
|
|
|
|
|
|
var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas);
|
|
|
|
|
|
_CUSTOMERNAME = _this.formEdit.getForm().findField('CUSTOMERNAME').getValue();
|
|
|
|
|
|
Ext.Msg.wait('正在删除数据., 请稍侯..');
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在删除数据...',
|
|
|
url: '/Account/Chfee_invoiceapplication/DelBill',
|
|
|
params: {
|
|
|
data: jsonbodyAddDatas,
|
|
|
billno: billno,
|
|
|
GID: GID
|
|
|
},
|
|
|
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
|
|
|
});
|
|
|
btnEDeleteDetail.enable();
|
|
|
return;
|
|
|
} else {
|
|
|
Ext.MessageBox.hide();
|
|
|
var sql = this.sqlcontext;
|
|
|
this.storeBodyAddList.load({ params: { start: 0, limit: _this.PageSize, sort: '', condition: sql} });
|
|
|
_this.storeBodyList.load({ params: { condition: " BILLNO='" + billno + "'" },
|
|
|
callback: function (r, options, success) {
|
|
|
if (success) {
|
|
|
if (_this.storeBodyList.getCount() > 0) {
|
|
|
_this.comboxCurr.setReadOnly(true);
|
|
|
_this.comboxCustCode.setReadOnly(true);
|
|
|
|
|
|
}
|
|
|
else {
|
|
|
_this.comboxCurr.setReadOnly(false);
|
|
|
_this.comboxCustCode.setReadOnly(false);
|
|
|
_CUSTOMERNAME = "";
|
|
|
}
|
|
|
_this.formEdit.getForm().findField('CUSTOMERNAME').setValue(_CUSTOMERNAME);
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
});
|
|
|
this.storeBodySum.load({ params: { condition: " BILLNO='" + billno + "'"} });
|
|
|
this.storeDetailList.load({ params: { condition: " PID='" + GID + "'"} });
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在查询主表数据...',
|
|
|
url: '/Account/Chfee_invoiceapplication/GetData',
|
|
|
params: {
|
|
|
handle: 'edit',
|
|
|
condition: " BILLNO='" + billno + "'"
|
|
|
},
|
|
|
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
|
|
|
});
|
|
|
btnEDeleteDetail.enable();
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
var data = result.data;
|
|
|
this.formEdit.getForm().reset();
|
|
|
this.formEdit.getForm().setValues(data);
|
|
|
this.formEdit.getForm().findField('CUSTOMERNAME').setValue(_CUSTOMERNAME);
|
|
|
var editp = Ext.create('MsChInvoiceapplication', data);
|
|
|
|
|
|
this.editRecord.fields.each(function (field) {
|
|
|
if (field.persist) {
|
|
|
name = field.name;
|
|
|
if (name != 'id')
|
|
|
this.editRecord.set(name, editp.get(name));
|
|
|
}
|
|
|
}, this);
|
|
|
this.editRecord.commit();
|
|
|
btnEDeleteDetail.enable();
|
|
|
|
|
|
} else {
|
|
|
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
|
|
|
btnEDeleteDetail.enable();
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
btnEDeleteDetail.enable();
|
|
|
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
});
|
|
|
|
|
|
},
|
|
|
|
|
|
onSubmitAuditClick: function () {
|
|
|
var Duino = this.formEdit.getForm().findField('BILLNO').getValue();
|
|
|
|
|
|
var billstatus = this.formEdit.getForm().findField('BILLSTATUS').getValue();
|
|
|
|
|
|
if (Duino == '*') {
|
|
|
Ext.Msg.show({ title: '提示', msg: '请先保存发票申请,然后才能提交审核!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
|
return;
|
|
|
};
|
|
|
|
|
|
|
|
|
if ((billstatus != 1) && (billstatus != 4)) {
|
|
|
|
|
|
Ext.Msg.show({ title: '提示', msg: '当前状态无法提交审核!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (this.storeBodyList.getCount() == 0) {
|
|
|
Ext.Msg.show({ title: '提示', msg: '没有申请明细,无法提交审核!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
_this = this;
|
|
|
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在添加数据...',
|
|
|
url: '/Account/Chfee_invoiceapplication/SubmitAudit',
|
|
|
params: {
|
|
|
bill: Duino
|
|
|
},
|
|
|
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;
|
|
|
} else {
|
|
|
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在查询主表数据...',
|
|
|
url: '/Account/Chfee_invoiceapplication/GetData',
|
|
|
params: {
|
|
|
handle: 'edit',
|
|
|
condition: " BILLNO='" + Duino + "'"
|
|
|
},
|
|
|
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().findField('BILLSTATUS').setDisabled(false);
|
|
|
_this.formEdit.getForm().reset();
|
|
|
_this.formEdit.getForm().setValues(data);
|
|
|
_this.formEdit.getForm().findField('BILLSTATUS').setDisabled(true);
|
|
|
|
|
|
var editp = Ext.create('MsChInvoiceapplication', data);
|
|
|
|
|
|
this.editRecord.fields.each(function (field) {
|
|
|
if (field.persist) {
|
|
|
name = field.name;
|
|
|
if (name != 'id')
|
|
|
this.editRecord.set(name, editp.get(name));
|
|
|
}
|
|
|
}, this);
|
|
|
this.editRecord.commit();
|
|
|
|
|
|
_this.GetEditStatus();
|
|
|
|
|
|
} else {
|
|
|
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
});
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
onSubmitAuditBackClick: function () {
|
|
|
var Duino = this.formEdit.getForm().findField('BILLNO').getValue();
|
|
|
|
|
|
var billstatus = this.formEdit.getForm().findField('BILLSTATUS').getValue();
|
|
|
|
|
|
if (Duino == '*') {
|
|
|
Ext.Msg.show({ title: '提示', msg: '请先保存发票申请,然后才能提交审核!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
|
return;
|
|
|
};
|
|
|
|
|
|
|
|
|
if (billstatus != 2) {
|
|
|
|
|
|
Ext.Msg.show({ title: '提示', msg: '当前状态无法撤销提交!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
_this = this;
|
|
|
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在添加数据...',
|
|
|
url: '/Account/Chfee_invoiceapplication/SubmitAuditBack',
|
|
|
params: {
|
|
|
bill: Duino
|
|
|
},
|
|
|
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;
|
|
|
} else {
|
|
|
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在查询主表数据...',
|
|
|
url: '/Account/Chfee_invoiceapplication/GetData',
|
|
|
params: {
|
|
|
handle: 'edit',
|
|
|
condition: " BILLNO='" + Duino + "'"
|
|
|
},
|
|
|
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().findField('BILLSTATUS').setDisabled(false);
|
|
|
_this.formEdit.getForm().reset();
|
|
|
_this.formEdit.getForm().setValues(data);
|
|
|
_this.formEdit.getForm().findField('BILLSTATUS').setDisabled(true);
|
|
|
var editp = Ext.create('MsChInvoiceapplication', data);
|
|
|
|
|
|
this.editRecord.fields.each(function (field) {
|
|
|
if (field.persist) {
|
|
|
name = field.name;
|
|
|
if (name != 'id')
|
|
|
this.editRecord.set(name, editp.get(name));
|
|
|
}
|
|
|
}, this);
|
|
|
this.editRecord.commit();
|
|
|
|
|
|
_this.GetEditStatus();
|
|
|
|
|
|
|
|
|
} else {
|
|
|
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
});
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
ImportRemarks: function () {
|
|
|
|
|
|
var billno = this.formEdit.getForm().findField('BILLNO').getValue();
|
|
|
if (billno == '*') {
|
|
|
Ext.Msg.show({ title: '提示', msg: '请先保存,然后才能撤销锁定!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
|
return;
|
|
|
};
|
|
|
|
|
|
|
|
|
this.formRemarkShowGet = Ext.widget('form', {
|
|
|
frame: true,
|
|
|
title: '提取发票备注',
|
|
|
region: 'center',
|
|
|
bodyPadding: 5,
|
|
|
fieldDefaults: {
|
|
|
margins: '2 2 2 2',
|
|
|
labelAlign: 'right',
|
|
|
flex: 1,
|
|
|
labelWidth: 90,
|
|
|
msgTarget: 'qtip'
|
|
|
},
|
|
|
|
|
|
items: [
|
|
|
{
|
|
|
xtype: 'radiogroup',
|
|
|
fieldLabel: "模板名称", //'文件功能',
|
|
|
name: 'TemplateName',
|
|
|
defaults: { flex: 1 },
|
|
|
layout: 'hbox',
|
|
|
items: [{
|
|
|
boxLabel: '模板1', //'原始',
|
|
|
name: 'TemplateName',
|
|
|
// id: 'TemplateName1',
|
|
|
inputValue: '发票备注',
|
|
|
checked: true
|
|
|
}, {
|
|
|
boxLabel: '模板2', //'更新',
|
|
|
name: 'TemplateName',
|
|
|
inputValue: '发票备注2'
|
|
|
}, {
|
|
|
boxLabel: '模板3', //'更新',
|
|
|
name: 'TemplateName',
|
|
|
inputValue: '发票备注3'
|
|
|
}]
|
|
|
}, {
|
|
|
fieldLabel: '是否追加', //'是否改签',
|
|
|
inputValue: true,
|
|
|
xtype: 'checkboxfield',
|
|
|
name: 'ISZHUIJIA',
|
|
|
checked: true
|
|
|
}
|
|
|
|
|
|
]//end root items
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
this.winCustomDataShowGet = Ext.create('Ext.window.Window', {
|
|
|
title: "",
|
|
|
// closeAction: 'hide',
|
|
|
width: 400,
|
|
|
height: 150,
|
|
|
layout: 'border',
|
|
|
resizable: true,
|
|
|
modal: true,
|
|
|
closeAction: 'close',
|
|
|
closable: true,
|
|
|
items: [this.formRemarkShowGet],
|
|
|
buttons: [{
|
|
|
text: "确定",
|
|
|
minWidth: 70,
|
|
|
handler: function () {
|
|
|
// var remarkstr = formRemarkShow.getForm().findField('INVREMARK').getValue();
|
|
|
// var cgFILEROLE = Ext.getCmp('hjFILEROLEGet');
|
|
|
// var FILEROLE = cgFILEROLE.getValue();
|
|
|
var APPLYTIME = _this.formEdit.getForm().findField('APPLYTIME').getRawValue();
|
|
|
var templatename = _this.formRemarkShowGet.getForm().findField('TemplateName').getValue();
|
|
|
var ISZHUIJIA = _this.formRemarkShowGet.getForm().findField('ISZHUIJIA').getValue();
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在查询主表数据...',
|
|
|
url: '/Account/Chfee_invoice/GetRemarksData',
|
|
|
params: {
|
|
|
billno: billno,
|
|
|
TemplateName: templatename,
|
|
|
invdate: APPLYTIME
|
|
|
},
|
|
|
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;
|
|
|
var REMARK = _this.formEdit.getForm().findField('REMARK').getValue();
|
|
|
if (ISZHUIJIA)
|
|
|
_this.formEdit.getForm().findField('REMARK').setValue(REMARK + ' ' + data);
|
|
|
else _this.formEdit.getForm().findField('REMARK').setValue(data);
|
|
|
_this.winCustomDataShowGet.close();
|
|
|
|
|
|
} else {
|
|
|
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
});
|
|
|
}
|
|
|
}, {
|
|
|
text: "关闭",
|
|
|
minWidth: 70,
|
|
|
handler: function () {
|
|
|
_this.winCustomDataShowGet.close();
|
|
|
}
|
|
|
}]
|
|
|
});
|
|
|
|
|
|
_this.winCustomDataShowGet.show();
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
SetRemarksTemplate: function () {
|
|
|
var StoreFieldName = Ext.create('Ext.data.Store', {
|
|
|
fields: ['OPLBNAME']
|
|
|
});
|
|
|
StoreFieldName.add({ "OPLBNAME": "委托编号" });
|
|
|
StoreFieldName.add({ "OPLBNAME": "主提单号" });
|
|
|
StoreFieldName.add({ "OPLBNAME": "分提单号" });
|
|
|
StoreFieldName.add({ "OPLBNAME": "委托单位" });
|
|
|
StoreFieldName.add({ "OPLBNAME": "船名" });
|
|
|
StoreFieldName.add({ "OPLBNAME": "航次" });
|
|
|
StoreFieldName.add({ "OPLBNAME": "开船日期" });
|
|
|
StoreFieldName.add({ "OPLBNAME": "装货港" });
|
|
|
StoreFieldName.add({ "OPLBNAME": "卸货港" });
|
|
|
StoreFieldName.add({ "OPLBNAME": "外币金额" });
|
|
|
StoreFieldName.add({ "OPLBNAME": "人民币金额" });
|
|
|
StoreFieldName.add({ "OPLBNAME": "折算汇率" });
|
|
|
StoreFieldName.add({ "OPLBNAME": "目的港" });
|
|
|
StoreFieldName.add({ "OPLBNAME": "集装箱" });
|
|
|
StoreFieldName.add({ "OPLBNAME": "订舱编号" });
|
|
|
StoreFieldName.add({ "OPLBNAME": "外币金额(总计)" });
|
|
|
StoreFieldName.add({ "OPLBNAME": "人民币金额(总计)" });
|
|
|
StoreFieldName.add({ "OPLBNAME": "折算汇率(总计)" });
|
|
|
|
|
|
var gridField = new Ext.grid.GridPanel({
|
|
|
store: StoreFieldName,
|
|
|
enableHdMenu: false,
|
|
|
region: 'center',
|
|
|
loadMask: { msg: "数据加载中,请稍等..." },
|
|
|
trackMouseOver: true,
|
|
|
disableSelection: false,
|
|
|
columns: [{
|
|
|
sortable: true,
|
|
|
dataIndex: 'OPLBNAME',
|
|
|
header: '字段',
|
|
|
width: 80
|
|
|
}
|
|
|
]
|
|
|
});
|
|
|
gridField.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
|
|
|
var remarkstr = formRemarkShow.getForm().findField('INVREMARK').getValue();
|
|
|
remarkstr = remarkstr + '[' + record.data.OPLBNAME + ']';
|
|
|
formRemarkShow.getForm().findField('INVREMARK').setValue(remarkstr);
|
|
|
|
|
|
}, this);
|
|
|
|
|
|
var panelBs = new Ext.Panel({
|
|
|
title: '字段列表',
|
|
|
layout: "border",
|
|
|
region: 'west',
|
|
|
width: 120,
|
|
|
frame: true,
|
|
|
split: true,
|
|
|
collapsed: false,
|
|
|
collapsible: true,
|
|
|
trackResetOnLoad: true,
|
|
|
items: [gridField]
|
|
|
});
|
|
|
|
|
|
|
|
|
var formRemarkShow = Ext.widget('form', {
|
|
|
frame: true,
|
|
|
title: '模板内容',
|
|
|
region: 'center',
|
|
|
bodyPadding: 5,
|
|
|
fieldDefaults: {
|
|
|
margins: '2 2 2 2',
|
|
|
labelAlign: 'right',
|
|
|
flex: 1,
|
|
|
labelWidth: 90,
|
|
|
msgTarget: 'qtip'
|
|
|
},
|
|
|
|
|
|
items: [
|
|
|
{//fieldset 1
|
|
|
xtype: 'container',
|
|
|
defaultType: 'textfield',
|
|
|
layout: 'anchor',
|
|
|
defaults: {
|
|
|
anchor: '100%'
|
|
|
},
|
|
|
items: [{
|
|
|
xtype: 'textareafield',
|
|
|
grow: true,
|
|
|
height: 300,
|
|
|
id: 'dREMARK',
|
|
|
name: 'INVREMARK',
|
|
|
anchor: '100%'
|
|
|
}, {
|
|
|
xtype: 'radiogroup',
|
|
|
fieldLabel: "模板名称", //'文件功能',
|
|
|
id: 'hjFILEROLE',
|
|
|
defaults: { flex: 1 },
|
|
|
layout: 'hbox',
|
|
|
items: [{
|
|
|
boxLabel: '模板1', //'原始',
|
|
|
name: 'TemplateName',
|
|
|
// id: 'TemplateName1',
|
|
|
inputValue: '发票备注',
|
|
|
checked: true
|
|
|
}, {
|
|
|
boxLabel: '模板2', //'更新',
|
|
|
name: 'TemplateName',
|
|
|
inputValue: '发票备注2'
|
|
|
}, {
|
|
|
boxLabel: '模板3', //'更新',
|
|
|
name: 'TemplateName',
|
|
|
inputValue: '发票备注3'
|
|
|
}],
|
|
|
listeners: {
|
|
|
change: function (rd, newValue, oldValue, eOpts) {
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在查询主表数据...',
|
|
|
url: '/Account/Chfee_invoice/GetRemarksTemplate',
|
|
|
params: {
|
|
|
TemplateName: newValue.TemplateName.toString()
|
|
|
},
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
var result = Ext.JSON.decode(response.responseText);
|
|
|
data = result.Data;
|
|
|
formRemarkShow.getForm().findField('INVREMARK').setValue(data);
|
|
|
|
|
|
|
|
|
} else {
|
|
|
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
]//end items(fieldset 1)
|
|
|
}//end fieldset 1
|
|
|
]//end root items
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
winCustomDataShow = Ext.create('Ext.window.Window', {
|
|
|
title: "",
|
|
|
// closeAction: 'hide',
|
|
|
width: 600,
|
|
|
height: 500,
|
|
|
layout: 'border',
|
|
|
resizable: true,
|
|
|
modal: true,
|
|
|
closeAction: 'close',
|
|
|
closable: true,
|
|
|
items: [panelBs, formRemarkShow],
|
|
|
// listeners: {
|
|
|
// scope: this,
|
|
|
// 'beforeshow': function (thewin, eOpts) {
|
|
|
// var cgFILEROLE = Ext.getCmp('hjFILEROLE');
|
|
|
// var FILEROLE = cgFILEROLE.getValue();
|
|
|
|
|
|
// }
|
|
|
|
|
|
// },
|
|
|
buttons: [{
|
|
|
text: "保存",
|
|
|
minWidth: 70,
|
|
|
handler: function () {
|
|
|
var remarkstr = formRemarkShow.getForm().findField('INVREMARK').getValue();
|
|
|
var cgFILEROLE = Ext.getCmp('hjFILEROLE');
|
|
|
var FILEROLE = cgFILEROLE.getValue();
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在查询主表数据...',
|
|
|
url: '/Account/Chfee_invoice/SaveRemarksTemplate',
|
|
|
params: {
|
|
|
Template: remarkstr,
|
|
|
TemplateName: FILEROLE.TemplateName
|
|
|
},
|
|
|
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;
|
|
|
}
|
|
|
// winCustomDataShow.close();
|
|
|
|
|
|
|
|
|
} else {
|
|
|
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
});
|
|
|
}
|
|
|
}, {
|
|
|
text: "关闭",
|
|
|
minWidth: 70,
|
|
|
handler: function () {
|
|
|
winCustomDataShow.close();
|
|
|
}
|
|
|
}]
|
|
|
});
|
|
|
|
|
|
winCustomDataShow.show();
|
|
|
|
|
|
if (this.firsttemplate == 1) {
|
|
|
this.firsttemplate = 0;
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在查询主表数据...',
|
|
|
url: '/Account/Chfee_invoice/GetRemarksTemplate',
|
|
|
params: {
|
|
|
TemplateName: "发票备注"
|
|
|
},
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
var result = Ext.JSON.decode(response.responseText);
|
|
|
data = result.Data;
|
|
|
formRemarkShow.getForm().findField('INVREMARK').setValue(data);
|
|
|
// Ext.getCmp('TemplateName1').checked = true;
|
|
|
|
|
|
// formRemarkShow.getForm().findField('TemplateName').setValue('发票备注');
|
|
|
|
|
|
// var cgFILEROLE = Ext.getCmp('hjFILEROLE');
|
|
|
// var FILEROLE = cgFILEROLE.setValue('发票备注');
|
|
|
|
|
|
} else {
|
|
|
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
onRefreshClick: function (button, event) {
|
|
|
if (this.bsnosql == undefined) {
|
|
|
var sql = this.getCondition();
|
|
|
this.sqlcontext = sql;
|
|
|
} else {
|
|
|
var sql = this.sqlcontext;
|
|
|
}
|
|
|
this.PageSize = this.Pagenum.getValue();
|
|
|
this.storeBodyAddList.pageSize = this.PageSize;
|
|
|
this.storeBodyAddList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql} });
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
onDsQuery: function (button, event) {
|
|
|
var sql = this.sqlcontext;
|
|
|
this.PageSize = this.Pagenum.getValue();
|
|
|
this.storeBodyAddList.pageSize = this.PageSize;
|
|
|
this.storeBodyAddList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql} });
|
|
|
|
|
|
},
|
|
|
|
|
|
onClearSql: function () {
|
|
|
var form = this.formSearch.getForm();
|
|
|
form.reset();
|
|
|
},
|
|
|
|
|
|
|
|
|
getCondition: function () {
|
|
|
var form = this.formSearch.getForm();
|
|
|
if (!form.isValid()) {
|
|
|
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
|
|
|
return '';
|
|
|
}
|
|
|
|
|
|
var sql = '';
|
|
|
|
|
|
var customNo = form.findField('CustomNo').getValue();
|
|
|
//sql = sql + getAndConSql(sql, customNo, " (b.CUSTNO like '%" + customNo + "%' or b.MBLNO like '%" + customNo + "%' or b.HBLNO like '%" + customNo + "%' or b.ORDERNO like '%" + customNo + "%')");
|
|
|
|
|
|
if (customNo) {
|
|
|
if (customNo.indexOf(",") > 0) {
|
|
|
var customNOList = customNo.split(",");
|
|
|
|
|
|
var customNOListStr = "(";
|
|
|
|
|
|
for (var _i = 0; _i < customNOList.length; _i++) {
|
|
|
if (customNOListStr != "(") customNOListStr += " OR ";
|
|
|
customNOListStr += " (ISNULL(b.CUSTNO, '') + '' + ISNULL(b.MBLNO, '') + '' + ISNULL(b.HBLNO, '') + '' + ISNULL(b.CUSTOMNO, '') + '' + ISNULL(b.ORDERNO, '')) like '%" + customNOList[_i] + "%' ";
|
|
|
}
|
|
|
customNOListStr += ")";
|
|
|
|
|
|
sql = sql + getAndConSql(sql, customNOListStr, customNOListStr);
|
|
|
|
|
|
} else {
|
|
|
sql = sql + getAndConSql(sql, customNo, " (ISNULL(b.CUSTNO,'')+''+ISNULL(b.MBLNO,'')+''+ISNULL(b.HBLNO,'')+''+ISNULL(b.CUSTOMNO,'')+''+ISNULL(b.ORDERNO,'')) like '%" + customNo + "%' ");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
var OPLBNAME = form.findField('OPLBNAME').getValue();
|
|
|
sql = sql + getAndConSql(sql, OPLBNAME, "b.OPLBNAME='" + OPLBNAME + "'");
|
|
|
|
|
|
var expDateBgn = form.findField('ExpDateBgn').getRawValue();
|
|
|
sql = sql + getAndConSql(sql, expDateBgn, "b.ETD >='" + expDateBgn + "'");
|
|
|
|
|
|
var expDateEnd = form.findField('ExpDateEnd').getRawValue();
|
|
|
sql = sql + getAndConSql(sql, expDateEnd, "b.ETD <='" + expDateEnd + "'");
|
|
|
|
|
|
var ACCDATE = form.findField('ACCDATEFR').getRawValue();
|
|
|
sql = sql + getAndConSql(sql, ACCDATE, "b.ACCDATE>='" + ACCDATE + "'");
|
|
|
|
|
|
var ACCDATETO = form.findField('ACCDATETO').getRawValue();
|
|
|
sql = sql + getAndConSql(sql, ACCDATETO, "b.ACCDATE<='" + ACCDATETO + "'");
|
|
|
|
|
|
var SALECORPID = form.findField('SALECORPID').getValue();
|
|
|
sql = sql + getAndConSql(sql, SALECORPID, "b.SALECORPID='" + SALECORPID + "'");
|
|
|
|
|
|
this.FeeSqlStr = this.getFeeCondition();
|
|
|
sql = sql + getAndConSql(sql, this.FeeSqlStr, this.FeeSqlStr);
|
|
|
|
|
|
// sql = sql + getAndConSql(sql, feesql, feesql);
|
|
|
|
|
|
this.BillSql = sql;
|
|
|
return sql;
|
|
|
},
|
|
|
getFeeCondition: function () {
|
|
|
var form = this.formSearch.getForm();
|
|
|
|
|
|
var feesql = '';
|
|
|
|
|
|
var CUSTNAME = form.findField('CUSTNAME').getValue();
|
|
|
feesql = feesql + getAndConSql(feesql, CUSTNAME, "f.CUSTOMERNAME='" + CUSTNAME + "'");
|
|
|
|
|
|
|
|
|
var DC = form.findField('DC').getValue();
|
|
|
feesql = feesql + getAndConSql(feesql, DC, "f.FEETYPE=" + DC);
|
|
|
|
|
|
var Currency = form.findField('Currency').getValue();
|
|
|
feesql = feesql + getAndConSql(feesql, Currency, "f.Currency='" + Currency + "'");
|
|
|
|
|
|
var FeeName = form.findField('FeeName').getValue();
|
|
|
feesql = feesql + getAndConSql(feesql, FeeName, "f.FeeName='" + FeeName + "'");
|
|
|
|
|
|
var DuiNo = form.findField('DuiNo').getValue();
|
|
|
//feesql = feesql + getAndConSql(feesql, DuiNo, " f.GID IN (SELECT GID FROM V_DUI_FEE WHERE DUINO='" + DuiNo + "')");
|
|
|
//展濠对账编号模糊查询
|
|
|
feesql = feesql + getAndConSql(feesql, DuiNo, " f.GID IN (SELECT GID FROM V_DUI_FEE WHERE DUINO like '%" + DuiNo + "%')");
|
|
|
|
|
|
var FEERANGE = form.findField('FEERANGE').getValue();
|
|
|
|
|
|
|
|
|
if (FEERANGE == '' || FEERANGE == null || FEERANGE == undefined) {
|
|
|
|
|
|
}
|
|
|
else {
|
|
|
|
|
|
if (feesql == '') {
|
|
|
if (FEERANGE == 'B') {
|
|
|
feesql = ' f.AMOUNT<>f.SETTLEMENT '
|
|
|
}
|
|
|
if (FEERANGE == 'S') {
|
|
|
feesql = ' f.SETTLEMENT<>0 '
|
|
|
} else if (FEERANGE == 'N') {
|
|
|
feesql = ' f.SETTLEMENT=0 '
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
if (FEERANGE == 'B') {
|
|
|
feesql = feesql + ' and f.AMOUNT<>f.SETTLEMENT '
|
|
|
}
|
|
|
if (FEERANGE == 'S') {
|
|
|
feesql = feesql + ' and f.SETTLEMENT<>0 '
|
|
|
} else if (FEERANGE == 'N') {
|
|
|
feesql = feesql + ' and f.SETTLEMENT=0 '
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
return feesql;
|
|
|
},
|
|
|
|
|
|
|
|
|
ExrateConversion: function (bfcurr, afcurr, fntype, dfexrate) {
|
|
|
|
|
|
var EXRATE = 0;
|
|
|
var achange = true;
|
|
|
var bchange = true;
|
|
|
|
|
|
formExrateConversion = Ext.widget('form', {
|
|
|
frame: true,
|
|
|
region: 'center',
|
|
|
bodyPadding: 5,
|
|
|
fieldDefaults: {
|
|
|
margins: '2 2 2 2',
|
|
|
labelAlign: 'right',
|
|
|
flex: 1,
|
|
|
labelWidth: 90,
|
|
|
msgTarget: 'qtip'
|
|
|
},
|
|
|
|
|
|
items: [
|
|
|
{//fieldset 1
|
|
|
xtype: 'container',
|
|
|
defaultType: 'textfield',
|
|
|
layout: 'anchor',
|
|
|
defaults: {
|
|
|
anchor: '100%'
|
|
|
},
|
|
|
items: [{
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [{
|
|
|
fieldLabel: '1' + bfcurr + '=',
|
|
|
xtype: 'numberfield',
|
|
|
name: 'bfcurr',
|
|
|
decimalPrecision: 6,
|
|
|
value: 0,
|
|
|
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
|
|
|
try {
|
|
|
var lsValue = usMoney(value, 6, '', 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;
|
|
|
},
|
|
|
listeners: {
|
|
|
change: function () {
|
|
|
if (bchange) {
|
|
|
|
|
|
var bfcurr = formExrateConversion.getForm().findField('bfcurr').getValue();
|
|
|
var field = formExrateConversion.getForm().findField('afcurr');
|
|
|
if (bfcurr == 0) { field.setValue(0); } else {
|
|
|
var taxrate = (parseFloat(1).div(parseFloat(bfcurr))).toFixed(6);
|
|
|
achange = false;
|
|
|
field.setValue(taxrate);
|
|
|
|
|
|
}
|
|
|
}
|
|
|
achange = true;
|
|
|
|
|
|
}
|
|
|
}
|
|
|
}, {
|
|
|
xtype: 'label',
|
|
|
width: 120,
|
|
|
text: afcurr,
|
|
|
name: 'bfcurr2'
|
|
|
}
|
|
|
]
|
|
|
}, {
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [{
|
|
|
fieldLabel: '1' + afcurr + '=',
|
|
|
xtype: 'numberfield',
|
|
|
name: 'afcurr',
|
|
|
decimalPrecision: 6,
|
|
|
value: 0,
|
|
|
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
|
|
|
try {
|
|
|
var lsValue = usMoney(value, 6, '', 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;
|
|
|
},
|
|
|
listeners: {
|
|
|
change: function () {
|
|
|
|
|
|
if (achange) {
|
|
|
var afcurr = formExrateConversion.getForm().findField('afcurr').getValue();
|
|
|
var field = formExrateConversion.getForm().findField('bfcurr');
|
|
|
if (afcurr == 0) { field.setValue(0); } else {
|
|
|
var taxrate = (parseFloat(1).div(parseFloat(afcurr))).toFixed(6);
|
|
|
bchange = false;
|
|
|
field.setValue(taxrate);
|
|
|
}
|
|
|
}
|
|
|
bchange = true;
|
|
|
|
|
|
}
|
|
|
}
|
|
|
}, {
|
|
|
xtype: 'label',
|
|
|
width: 120,
|
|
|
text: bfcurr,
|
|
|
name: 'afcurr2'
|
|
|
}
|
|
|
]
|
|
|
}
|
|
|
]//end items(fieldset 1)
|
|
|
}//end fieldset 1
|
|
|
]//end root items
|
|
|
});
|
|
|
me = this;
|
|
|
winExrateShow = Ext.create('Ext.window.Window', {
|
|
|
title: "币别汇率折算",
|
|
|
width: 450,
|
|
|
iconCls: "addicon",
|
|
|
resizable: false,
|
|
|
collapsible: true, // 允许缩放条
|
|
|
closeAction: 'close',
|
|
|
closable: true,
|
|
|
modal: 'true',
|
|
|
buttonAlign: "center",
|
|
|
bodyStyle: "padding:0 0 0 0",
|
|
|
items: [formExrateConversion],
|
|
|
buttons: [{
|
|
|
text: "确定",
|
|
|
minWidth: 70,
|
|
|
handler: function () {
|
|
|
var form = formExrateConversion.getForm();
|
|
|
var UsdExrate = form.findField('bfcurr').getValue();
|
|
|
if (UsdExrate == '' || UsdExrate == null || UsdExrate == undefined) {
|
|
|
Ext.Msg.show({ title: '提示', msg: '必须填折算汇率!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
|
return;
|
|
|
};
|
|
|
var recs = DsStoreQueryBy(me.storeCurrExrate, 'CURR', bfcurr);
|
|
|
if (recs.getCount() > 0) {
|
|
|
|
|
|
for (var i = 0; i < me.storeCurrExrate.getCount(); i += 1) {
|
|
|
var member = me.storeCurrExrate.getAt(i);
|
|
|
if (member.data.CURR == bfcurr) {
|
|
|
|
|
|
member.set('EXRATE', UsdExrate);
|
|
|
member.commit();
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
me.storeCurrExrate.add({ "CURR": bfcurr, "EXRATE": UsdExrate })
|
|
|
}
|
|
|
winExrateShow.close();
|
|
|
if (fntype == 'detail') {
|
|
|
me.addDetail();
|
|
|
}
|
|
|
if (fntype == 'bill') {
|
|
|
me.addBill();
|
|
|
}
|
|
|
return;
|
|
|
}
|
|
|
}, {
|
|
|
text: "关闭",
|
|
|
minWidth: 70,
|
|
|
handler: function () {
|
|
|
me.GetEditStatus();
|
|
|
winExrateShow.close();
|
|
|
return;
|
|
|
}
|
|
|
}]
|
|
|
});
|
|
|
|
|
|
if (bfcurr == 'RMB') {
|
|
|
var FFrecords = DsStoreQueryBy(this.StoreDateCurr, 'CURR', afcurr);
|
|
|
if (FFrecords.getCount() > 0) {
|
|
|
var ffdata = FFrecords.getAt(0).data;
|
|
|
var DEFRATE = ffdata.DEFRATE;
|
|
|
|
|
|
} else {
|
|
|
var DFrecords = DsStoreQueryBy(this.StoreCurr, 'CURR', afcurr);
|
|
|
if (DFrecords.getCount() > 0) {
|
|
|
var dfdata = DFrecords.getAt(0).data;
|
|
|
var DEFRATE = dfdata.DEFRATE;
|
|
|
|
|
|
} else {
|
|
|
var DEFRATE = 1;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
var field = formExrateConversion.getForm().findField('afcurr');
|
|
|
|
|
|
achange = true;
|
|
|
field.setValue(DEFRATE);
|
|
|
|
|
|
} else if (afcurr == 'RMB') {
|
|
|
|
|
|
var FFrecords = DsStoreQueryBy(this.StoreDateCurr, 'CURR', bfcurr);
|
|
|
if (FFrecords.getCount() > 0) {
|
|
|
var ffdata = FFrecords.getAt(0).data;
|
|
|
var DEFRATE = ffdata.DEFRATE;
|
|
|
|
|
|
} else {
|
|
|
var recs = DsStoreQueryBy(me.storeCurrExrate, 'CURR', bfcurr);
|
|
|
if (recs.getCount() > 0) {
|
|
|
var dfdata = recs.getAt(0).data;
|
|
|
var DEFRATE = dfdata.DFEXRATE;
|
|
|
} else var DEFRATE = dfexrate;
|
|
|
}
|
|
|
|
|
|
|
|
|
var field = formExrateConversion.getForm().findField('bfcurr');
|
|
|
|
|
|
achange = true;
|
|
|
field.setValue(DEFRATE);
|
|
|
|
|
|
|
|
|
} else {
|
|
|
var field = formExrateConversion.getForm().findField('bfcurr');
|
|
|
var recs = DsStoreQueryBy(me.storeCurrExrate, 'CURR', bfcurr);
|
|
|
if (recs.getCount() > 0) {
|
|
|
var dfdata = recs.getAt(0).data;
|
|
|
var DEFRATE = dfdata.DFEXRATE;
|
|
|
} else var DEFRATE = dfexrate;
|
|
|
bchange = true;
|
|
|
field.setValue(DEFRATE);
|
|
|
}
|
|
|
|
|
|
winExrateShow.show();
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
GetGroupCorp: function (custname) {
|
|
|
_this = this;
|
|
|
var records = DsStoreQueryBy(_this.StoreClientGroup, 'SHORTNAME', custname);
|
|
|
if (records.getCount() > 0) {
|
|
|
return records.getAt(0).data.PCORPNAME;
|
|
|
} else {
|
|
|
return '';
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
//#region 文件上传
|
|
|
|
|
|
onAddFileClick: function () {
|
|
|
var billstatus = this.formEdit.getForm().findField('BILLSTATUS').getValue();
|
|
|
if ((billstatus != 1) && (billstatus != 4)) {
|
|
|
Ext.Msg.show({ title: '提示', msg: '当前状态无法添加附件!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
|
return;
|
|
|
}
|
|
|
var BillNo = this.formEdit.getForm().findField('BILLNO').getValue();
|
|
|
if (BillNo == '' || BillNo == '*') {
|
|
|
Ext.MessageBox.alert('提示', '请先生成申请编号!'); //提示', '请先生成申请编号!
|
|
|
return;
|
|
|
}
|
|
|
var winAccess = new Shipping.FileUpload({});
|
|
|
winAccess.BillNo = BillNo;
|
|
|
winAccess.show();
|
|
|
}, onDelFileClick: function () {
|
|
|
var billstatus = this.formEdit.getForm().findField('BILLSTATUS').getValue();
|
|
|
if ((billstatus != 1) && (billstatus != 4)) {
|
|
|
Ext.Msg.show({ title: '提示', msg: '当前状态无法删除附件!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
|
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 BillNo = this.formEdit.getForm().findField('BILLNO').getValue();
|
|
|
|
|
|
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) {
|
|
|
panelEdit.LoadData('edit', "BILLNO='" + BillNo + "'");
|
|
|
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);
|
|
|
},
|
|
|
|
|
|
//#endregion
|
|
|
|
|
|
|
|
|
//#region 必填字段
|
|
|
|
|
|
LoadMustBe: function () {
|
|
|
this.storeMustBe.load({ params: { condition: "BSTYPE='发票申请'" },
|
|
|
callback: function (r, options, success) {
|
|
|
if (success) {
|
|
|
if (this.storeMustBe.getCount() > 0) {
|
|
|
for (var j = 0; j < this.storeMustBe.getCount(); j += 1) {
|
|
|
var member = this.storeMustBe.getAt(j);
|
|
|
|
|
|
var headfield = this.formEdit.getForm().findField(member.data.FIELDNAME);
|
|
|
if (headfield != NaN && headfield != null) {
|
|
|
if (member.data.ISMUST == "1")
|
|
|
headfield.allowBlank = false;
|
|
|
if (member.data.ISCOLOR == "1")
|
|
|
headfield.setFieldStyle({ background: '#ffc' });
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
});
|
|
|
|
|
|
|
|
|
},
|
|
|
//#endregion
|
|
|
|
|
|
// #region 根据权限和状态判断是否允许修改
|
|
|
|
|
|
GetEditStatus: function () {
|
|
|
var canedit = false;
|
|
|
var btnESubmitAudit = Ext.getCmp('btnSubmitAudit');
|
|
|
var btnESubmitAuditBack = Ext.getCmp('btnSubmitAuditBack');
|
|
|
|
|
|
this.formEdit.getForm().findField('BILLSTATUS').setDisabled(false);
|
|
|
var bsStatus = this.formEdit.getForm().findField('BILLSTATUS').getValue();
|
|
|
var op = this.formEdit.getForm().findField('APPLICANTNAME').getValue();
|
|
|
this.formEdit.getForm().findField('BILLSTATUS').setDisabled(true);
|
|
|
|
|
|
|
|
|
_this = this;
|
|
|
|
|
|
|
|
|
|
|
|
this.StoreOpRange.load({ params: { optype: "modInvoiceAppList" },
|
|
|
callback: function (r, options, success) {
|
|
|
if (success) {
|
|
|
if (r.length != 0) {
|
|
|
var records = DsStoreQueryBy(_this.StoreOpRange, 'OPID', op);
|
|
|
if (records.getCount() > 0) {
|
|
|
canedit = true;
|
|
|
if (bsStatus == 1 || bsStatus == 4) {
|
|
|
btnESubmitAudit.enable();
|
|
|
btnESubmitAuditBack.disable();
|
|
|
} else if (bsStatus == 2) {
|
|
|
btnESubmitAudit.disable();
|
|
|
btnESubmitAuditBack.enable();
|
|
|
} else {
|
|
|
btnESubmitAudit.disable();
|
|
|
btnESubmitAuditBack.disable();
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
canedit = false;
|
|
|
btnESubmitAudit.disable();
|
|
|
btnESubmitAuditBack.disable();
|
|
|
|
|
|
}
|
|
|
|
|
|
if ((bsStatus != 1) && (bsStatus != 4)) {
|
|
|
_this.setSaveBtnStatus(false);
|
|
|
} else {
|
|
|
_this.setSaveBtnStatus(canedit);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
setSaveBtnStatus: function (enable) {
|
|
|
var btnESave = Ext.getCmp('btnESave');
|
|
|
var btnESaveAndClose = Ext.getCmp('btnESaveAndClose');
|
|
|
var btnESaveAndNew = Ext.getCmp('btnESaveAndNew');
|
|
|
var btnEAddDetail = Ext.getCmp('btnadddetail');
|
|
|
var btnEDeleteDetail = Ext.getCmp('btndeldetail');
|
|
|
var btnEAddbill = Ext.getCmp('btnaddbill');
|
|
|
var btnEAddInvDetail = Ext.getCmp('btnAddInvdetail');
|
|
|
var btnEDeleteInvDetail = Ext.getCmp('btndelInvdetail');
|
|
|
|
|
|
this.canedit = enable;
|
|
|
|
|
|
if (enable) {
|
|
|
btnESave.enable();
|
|
|
btnESaveAndClose.enable();
|
|
|
btnESaveAndNew.enable();
|
|
|
|
|
|
btnEAddDetail.enable();
|
|
|
btnEDeleteDetail.enable();
|
|
|
btnEAddbill.enable();
|
|
|
btnEAddInvDetail.enable();
|
|
|
btnEDeleteInvDetail.enable();
|
|
|
|
|
|
|
|
|
} else {
|
|
|
btnESave.disable();
|
|
|
btnESaveAndClose.disable();
|
|
|
btnESaveAndNew.disable();
|
|
|
btnEAddDetail.disable();
|
|
|
btnEDeleteDetail.disable();
|
|
|
btnEAddbill.disable();
|
|
|
btnEAddInvDetail.disable();
|
|
|
btnEDeleteInvDetail.disable();
|
|
|
|
|
|
|
|
|
}
|
|
|
},
|
|
|
|
|
|
|
|
|
// #endregion
|
|
|
|
|
|
|
|
|
PrevRecord: function () {
|
|
|
|
|
|
// var modifystr = this.getIsModify();
|
|
|
// if (modifystr != "") {
|
|
|
// Ext.Msg.show({ title: '警告', msg: modifystr + '未保存,如果离开此页,将丢失未保存的更改 !!!', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
|
|
|
// return;
|
|
|
// }
|
|
|
var j = this.StoreList.indexOf(this.editRecord);
|
|
|
if (j == 0) {
|
|
|
Ext.Msg.show({ title: '警告', msg: '已是最前一票', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
|
|
|
|
|
|
return;
|
|
|
}
|
|
|
if (j == this.StoreList.count) {
|
|
|
Ext.Msg.show({ title: '警告', msg: '已是最后一票', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
j = j - 1;
|
|
|
this.editRecord = this.StoreList.getAt(j);
|
|
|
if (this.opStatus == 'edit')
|
|
|
condition = " BILLNO='" + this.editRecord.get('BILLNO') + "'";
|
|
|
this.LoadData(this.opStatus, condition);
|
|
|
},
|
|
|
NextRecord: function () {
|
|
|
|
|
|
// var modifystr = this.getIsModify();
|
|
|
// if (modifystr != "") {
|
|
|
// Ext.Msg.show({ title: '警告', msg: modifystr + '未保存,如果离开此页,将丢失未保存的更改 !!!', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
|
|
|
// return;
|
|
|
// }
|
|
|
|
|
|
var j = this.StoreList.indexOf(this.editRecord);
|
|
|
|
|
|
if (j == (this.StoreList.data.length - 1)) {
|
|
|
Ext.Msg.show({ title: '警告', msg: '已是最后一票', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
j = j + 1;
|
|
|
this.editRecord = this.StoreList.getAt(j);
|
|
|
if (this.opStatus == 'edit')
|
|
|
condition = " BILLNO='" + this.editRecord.get('BILLNO') + "'";
|
|
|
this.LoadData(this.opStatus, condition);
|
|
|
},
|
|
|
|
|
|
|
|
|
//合计选中的费用数字和
|
|
|
onSelectFee: function (button, event) {
|
|
|
//Ext.getCmp("zongshu").setText("1234");
|
|
|
|
|
|
var selectedRecords = this.gridAddFeeList.selModel.getSelection();
|
|
|
var sum = 0;
|
|
|
for (var i = 0; i < selectedRecords.length; i++) {
|
|
|
var rec = selectedRecords[i];
|
|
|
sum = sum + rec.get("Amount");
|
|
|
}
|
|
|
sum = sum.toFixed(2);
|
|
|
Ext.getCmp("zongshu").setText(" 选中金额:" + sum);
|
|
|
|
|
|
},
|
|
|
|
|
|
Print: function () {
|
|
|
var basicForm = this.formEdit.getForm();
|
|
|
var billNo = basicForm.findField('BILLNO').value;
|
|
|
var Gid = basicForm.findField('GID').value;
|
|
|
if (billNo == '*' || billNo == '') {
|
|
|
Ext.Msg.show({ title: '错误', msg: '单据还没有保存,请保存后再打印', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if (this.INVAPPPRINTAFTERAUDIT == 1) {
|
|
|
var BILLSTATUSREF = basicForm.findField('BILLSTATUSREF').getValue();
|
|
|
if (BILLSTATUSREF == '未提交') {
|
|
|
Ext.Msg.show({ title: '错误', msg: '当前状态不允许打印,请提交后再打印', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
var sortstr = ' b.VESSEL,b.VOYNO,b.MBLNO';
|
|
|
|
|
|
if (this.sortfield != '' && this.sortdire != '') {
|
|
|
|
|
|
sortstr = this.sortfield + ' ' + this.sortdire;
|
|
|
}
|
|
|
|
|
|
var printType = 'MSCHFEEINVOICEAPPLICATION';
|
|
|
var sql1 = "SELECT p.*,(select ShowName from [user] where GID=p.APPLICANT) as APPLICANTNAME,(select DESCRIPTION from info_client where SHORTNAME=p.CUSTOMERNAME) CUSTFULLNAME FROM ch_fee_invoiceapplication p WHERE p.BILLNO='" + billNo + "'";
|
|
|
var sql2 = "SELECT c.GID,c.BSNO,c.FEEID,c.FEENAME,c.CURRENCY,c.AMOUNT,c.DOAMOUNT,c.ORIGCURRENCY,c.ORIGAMOUNT,c.EXCHANGERATE,FEETYPE ";
|
|
|
sql2 = sql2 + ",b.CUSTOMERNAME,b.VESSEL,b.VOYNO,b.ETD,b.PORTLOAD";
|
|
|
sql2 = sql2 + " ,b.PORTDISCHARGE,b.INPUTBY,b.OP,b.CUSTSERVICE,b.DOC,b.SALE,b.MBLNO,b.CUSTNO";
|
|
|
sql2 = sql2 + " FROM ch_fee_do c left join v_op_bill b on (b.bsno=c.bsno)";
|
|
|
sql2 = sql2 + " WHERE C.BILLNO='" + billNo + "' ORDER BY " + sortstr;
|
|
|
|
|
|
var sql3 = "SELECT * FROM CH_FEE_INVOICEDETAIL WHERE PID='" + Gid + "'";
|
|
|
var sql4 = "";
|
|
|
var sql5 = "";
|
|
|
var sql6 = "";
|
|
|
|
|
|
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '',
|
|
|
url: '/Account/Chfee_Invoiceapplication/GetPrint',
|
|
|
params: {
|
|
|
billno: billNo
|
|
|
},
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
var jsonresult = Ext.JSON.decode(response.responseText);
|
|
|
if (jsonresult.Success) {
|
|
|
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '',
|
|
|
url: '/Account/Chfee_Invoiceapplication/UpdatePrint',
|
|
|
params: {
|
|
|
billnos: "'" + billNo + "'"
|
|
|
},
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
|
|
|
} else {
|
|
|
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
});
|
|
|
} else {//错误
|
|
|
Ext.Msg.show({ title: Zi.LAN.Error, msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
|
|
|
}
|
|
|
} else {
|
|
|
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
});
|
|
|
|
|
|
|
|
|
}
|
|
|
});
|
|
|
|
|
|
|