|
|
Ext.namespace('Shipping');
|
|
|
|
|
|
Shipping.MsChInvoicehexiaoEdit = function (config) {
|
|
|
Ext.applyIf(this, config);
|
|
|
this.initUIComponents();
|
|
|
window.Shipping.MsChInvoicehexiaoEdit.superclass.constructor.call(this);
|
|
|
};
|
|
|
|
|
|
Ext.extend(Shipping.MsChInvoicehexiaoEdit, Ext.Panel, {
|
|
|
|
|
|
ParentWin: null,
|
|
|
OpStatus: 'add',
|
|
|
StoreList: null,
|
|
|
EditRecord: null,
|
|
|
DataLoading: true,
|
|
|
addstore: false,
|
|
|
PageSize: 30,
|
|
|
sqlcontext: '',
|
|
|
|
|
|
|
|
|
initUIComponents: function () {
|
|
|
this.serialNo = 0;
|
|
|
this.workSerialNo = 0;
|
|
|
this.bodyDel = [];
|
|
|
this.FeeSql = '';
|
|
|
this.BillSql = '';
|
|
|
this.DuiBillSql = '';
|
|
|
this.canedit = false;
|
|
|
this.IsDebit = '0';
|
|
|
this.selectfeesql = '1=2';
|
|
|
this.IsDebit = '0';
|
|
|
|
|
|
//#region 编辑form
|
|
|
this.formname = "formMsChInvoicehexiaoEdit"; //页面名称
|
|
|
|
|
|
this.StoreOpRange = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'MsOP',
|
|
|
proxy: { url: '/MvcShipping/MsBaseInfo/GetOpRang' }
|
|
|
});
|
|
|
|
|
|
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'
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
//枚举参照相关(编辑form)
|
|
|
|
|
|
|
|
|
//表参照相关(编辑form)
|
|
|
|
|
|
this.storeCustCode = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'DsShipping.ux.CustomInvRefModel',
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetCustomInvRefList' }
|
|
|
});
|
|
|
|
|
|
this.storeCustCode.load({ params: { condition: ""} });
|
|
|
this.comboxCustCode = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: Zi.LAN.INVCUSTOMERNAME,
|
|
|
store: this.storeCustCode,
|
|
|
allowBlank: false,
|
|
|
forceSelection: true,
|
|
|
name: 'CUSTOMERNAME',
|
|
|
valueField: 'CustName',
|
|
|
displayField: 'CodeAndName',
|
|
|
listeners: {
|
|
|
scope: this,
|
|
|
'select': function (combo, records, eOpts) {
|
|
|
if (records.length > 0) {
|
|
|
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);
|
|
|
|
|
|
// }
|
|
|
var recs = DsStoreQueryBy(this.storeCustCode, 'CustName', records[0].data.CustName);
|
|
|
var INVOICECUSTNAME = this.formEdit.getForm().findField('INVOICECUSTNAME');
|
|
|
if (recs.getCount() > 0) {
|
|
|
var data = recs.getAt(0).data;
|
|
|
INVOICECUSTNAME.setValue(data.BillRises1);
|
|
|
} else {
|
|
|
INVOICECUSTNAME.setValue('');
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
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/GetFeeNowCurrList' }
|
|
|
});
|
|
|
this.StoreDateCurr.load({ params: { condition: ""} });
|
|
|
this.comboxCurr = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: Zi.LAN.Currency,
|
|
|
store: this.StoreCurr,
|
|
|
forceSelection: true,
|
|
|
allowBlank: false,
|
|
|
name: 'CURR',
|
|
|
valueField: 'CURR',
|
|
|
displayField: 'CURR'
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
this.storeDCType = Ext.create('DsExt.ux.RefEnumStore', {});
|
|
|
this.storeDCType.load({ params: { enumTypeId: 96008} });
|
|
|
|
|
|
this.comboxDCType = Ext.create('DsExt.ux.RefEnumCombox', {
|
|
|
fieldLabel: Zi.LAN.FEETYPEREF,
|
|
|
store: this.storeDCType,
|
|
|
forceSelection: true,
|
|
|
name: 'SETTLETYPE'
|
|
|
});
|
|
|
|
|
|
this.storeInvCategory = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'DsExtEnumModel',
|
|
|
proxy: { url: '/CommMng/PubSys/GetEnumValueList' }
|
|
|
});
|
|
|
this.storeInvCategory.load({ params: { enumTypeId: 97008 } });
|
|
|
|
|
|
this.comboxInvCategory = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: Zi.LAN.INVOICECATEGORYREF,
|
|
|
labelWidth: 60,
|
|
|
flex: 0.5,
|
|
|
store: this.storeInvCategory,
|
|
|
forceSelection: true,
|
|
|
name: 'INVOICECATEGORY',
|
|
|
valueField: 'EnumValueId',
|
|
|
displayField: 'EnumValueName'
|
|
|
});
|
|
|
|
|
|
|
|
|
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: Zi.LAN.PAYCOMPANYREF, //'委托分公司',
|
|
|
store: this.storeSaleCompany,
|
|
|
forceSelection: true,
|
|
|
name: 'SALECORPID',
|
|
|
//labelWidth: 60,
|
|
|
//flex: 1.5,
|
|
|
valueField: 'GID',
|
|
|
displayField: 'NAME',
|
|
|
listeners: {
|
|
|
scope: this,
|
|
|
'select': function (combo, records, eOpts) {
|
|
|
if (records.length > 0) {
|
|
|
// var companyid = data.items[0].data.GID;
|
|
|
// this.StoreBANK.load({ params: { condition: ""} });
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
|
|
|
//编辑form
|
|
|
this.formEdit = Ext.widget('form', {
|
|
|
region: 'center',
|
|
|
frame: true,
|
|
|
bodyPadding: 5,
|
|
|
trackResetOnLoad: true,
|
|
|
autoScroll: true,
|
|
|
fieldDefaults: {
|
|
|
margins: '2 2 2 2',
|
|
|
labelAlign: 'right',
|
|
|
flex: 1,
|
|
|
labelWidth: 90,
|
|
|
msgTarget: 'qtip'
|
|
|
},
|
|
|
|
|
|
items: [
|
|
|
{//fieldset 1
|
|
|
xtype: 'fieldset',
|
|
|
defaultType: 'textfield',
|
|
|
layout: 'anchor',
|
|
|
defaults: {
|
|
|
anchor: '100%'
|
|
|
},
|
|
|
items: [{
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [{
|
|
|
fieldLabel: '录入人',
|
|
|
name: 'OP', flex: 0, hidden: true, margins: '0'
|
|
|
},
|
|
|
{
|
|
|
fieldLabel: Zi.LAN.BILLNO,
|
|
|
readOnly: true,
|
|
|
name: 'BILLNO'
|
|
|
}, {
|
|
|
fieldLabel: Zi.LAN.status,
|
|
|
readOnly: true,
|
|
|
name: 'BILLSTATUS'
|
|
|
}, this.comboxCustCode, {
|
|
|
fieldLabel: Zi.LAN.INVOICECUSTNAME,
|
|
|
name: 'INVOICECUSTNAME'
|
|
|
}
|
|
|
]
|
|
|
}, {
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [{
|
|
|
fieldLabel: Zi.LAN.INVOICENO,
|
|
|
name: 'INVNO'
|
|
|
}, {
|
|
|
fieldLabel: Zi.LAN.INVDATE,
|
|
|
format: 'Y-m-d',
|
|
|
xtype: 'datefield',
|
|
|
allowBlank: false,
|
|
|
name: 'INVDATE'
|
|
|
}, this.comboxCurr, {
|
|
|
fieldLabel: Zi.LAN.ORGAMOUNT,
|
|
|
name: 'AMOUNT',
|
|
|
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
|
|
|
try {
|
|
|
var lsValue = usMoney(value, 2, '', false);
|
|
|
if (lsValue != "NaN") {
|
|
|
value = lsValue; if (parseFloat(lsValue) < 0) {
|
|
|
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
return value;
|
|
|
}
|
|
|
}
|
|
|
catch (e) {
|
|
|
return value;
|
|
|
}
|
|
|
return value;
|
|
|
}
|
|
|
}]
|
|
|
|
|
|
}, {
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [{
|
|
|
fieldLabel: Zi.LAN.INVAMOUNT,
|
|
|
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;
|
|
|
},
|
|
|
listeners: {
|
|
|
scope: this,
|
|
|
'change': function (ths, newValue, oldValue, eOpts) {
|
|
|
if (this.DataLoading == true) return;
|
|
|
if (newValue == oldValue) return;
|
|
|
|
|
|
var form = this.formEdit.getForm();
|
|
|
var taxrate = form.findField('TAXRATE').getValue();
|
|
|
var invamount = newValue;
|
|
|
|
|
|
this.DataLoading = true;
|
|
|
taxrate = parseFloat(taxrate) / 100;
|
|
|
var acctaxrate = 1 + taxrate;
|
|
|
var acctax = Div(parseFloat(invamount), acctaxrate);
|
|
|
var tax = Mul(acctax, taxrate);
|
|
|
|
|
|
form.findField('TAX').setValue(tax);
|
|
|
this.DataLoading = false;
|
|
|
}
|
|
|
}
|
|
|
}, {
|
|
|
fieldLabel: Zi.LAN.RATE,
|
|
|
name: 'TAXRATE',
|
|
|
listeners: {
|
|
|
scope: this,
|
|
|
'change': function (ths, newValue, oldValue, eOpts) {
|
|
|
if (this.DataLoading == true) return;
|
|
|
if (newValue == oldValue) return;
|
|
|
|
|
|
var form = this.formEdit.getForm();
|
|
|
var invamount = form.findField('INVAMOUNT').getValue();
|
|
|
var taxrate = newValue;
|
|
|
|
|
|
this.DataLoading = true;
|
|
|
taxrate = parseFloat(taxrate) / 100;
|
|
|
var acctaxrate = 1 + taxrate;
|
|
|
var acctax = Div(parseFloat(invamount), acctaxrate);
|
|
|
var tax = Mul(acctax, taxrate);
|
|
|
|
|
|
form.findField('TAX').setValue(tax);
|
|
|
this.DataLoading = false;
|
|
|
}
|
|
|
}
|
|
|
}, {
|
|
|
fieldLabel: Zi.LAN.TAX,
|
|
|
name: 'TAX',
|
|
|
flex: 0.5,
|
|
|
|
|
|
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.comboxInvCategory,this.comboxSaleCompany]
|
|
|
|
|
|
}, {
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [{
|
|
|
fieldLabel: Zi.LAN.REMARK ,
|
|
|
name: 'REMARKS'
|
|
|
}]
|
|
|
|
|
|
}
|
|
|
]//end items(fieldset 1)
|
|
|
}//end fieldset 1
|
|
|
]//end root items
|
|
|
}); //end this.formEdit
|
|
|
|
|
|
//#endregion
|
|
|
|
|
|
//#region 按钮Toolbar
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.panelBtn = new Ext.Panel({
|
|
|
region: "north",
|
|
|
tbar: [
|
|
|
{
|
|
|
id: 'btnEPrev',
|
|
|
text: Zi.LAN.sypiao,
|
|
|
// iconCls: "btnsave",
|
|
|
handler: function (button, event) {
|
|
|
this.PrevRecord();
|
|
|
},
|
|
|
scope: this
|
|
|
}, {
|
|
|
id: 'btnENext',
|
|
|
text: Zi.LAN.xypiao,
|
|
|
// iconCls: "btnsave",
|
|
|
handler: function (button, event) {
|
|
|
this.NextRecord();
|
|
|
},
|
|
|
scope: this
|
|
|
}, {
|
|
|
text: Zi.LAN.Save,
|
|
|
id: 'btnESave',
|
|
|
iconCls: "btnsave",
|
|
|
handler: function (button, event) {
|
|
|
this.Save('0');
|
|
|
},
|
|
|
scope: this
|
|
|
}, '-',
|
|
|
{
|
|
|
text: Zi.LAN.print,
|
|
|
handler: function (button, event) {
|
|
|
this.Print();
|
|
|
},
|
|
|
scope: this
|
|
|
},
|
|
|
'-',
|
|
|
{
|
|
|
text: Zi.LAN.saveandclose,
|
|
|
id: 'btnESaveAndClose',
|
|
|
handler: function (button, event) {
|
|
|
this.Save('1');
|
|
|
},
|
|
|
scope: this
|
|
|
},
|
|
|
'-',
|
|
|
{
|
|
|
text: Zi.LAN.saveandnew,
|
|
|
id: 'btnESaveAndNew',
|
|
|
handler: function (button, event) {
|
|
|
this.Save('2');
|
|
|
},
|
|
|
scope: this
|
|
|
},
|
|
|
'-',
|
|
|
{
|
|
|
id: 'btnENew',
|
|
|
text: Zi.LAN.btnENew,
|
|
|
handler: function (button, event) {
|
|
|
this.LoadData('add', '*');
|
|
|
},
|
|
|
scope: this
|
|
|
}, '-', {
|
|
|
id: 'btnSubmitAudit',
|
|
|
text: Zi.LAN.tjshe,
|
|
|
tooltip: Zi.LAN.tjshe,
|
|
|
handler: function (button, event) {
|
|
|
this.onSubmitAuditClick();
|
|
|
},
|
|
|
scope: this
|
|
|
}, '-', {
|
|
|
id: 'btnSubmitAuditBack',
|
|
|
text: Zi.LAN.cxtijiao,
|
|
|
tooltip: Zi.LAN.cxtijiao,
|
|
|
handler: function (button, event) {
|
|
|
this.onSubmitCancelClick();
|
|
|
},
|
|
|
scope: this
|
|
|
}, '-', {
|
|
|
text: Zi.LAN.CREATERZSHEN,
|
|
|
tooltip: Zi.LAN.CREATERZSHEN,
|
|
|
handler: function (button, event) {
|
|
|
this.onCreateBalBillClick();
|
|
|
},
|
|
|
scope: this
|
|
|
}
|
|
|
]
|
|
|
}); //end 按钮Toolbar
|
|
|
|
|
|
//#endregion
|
|
|
|
|
|
//#region 明细表
|
|
|
|
|
|
//明细表表格相关
|
|
|
_this = this;
|
|
|
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_Invoicehexiao/GetBillList',
|
|
|
reader: {
|
|
|
id: 'BSNO,FEEDOID',
|
|
|
root: 'data',
|
|
|
totalProperty: 'totalCount'
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
//明细表表格
|
|
|
this.gridListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
|
|
|
clicksToEdit: 1
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.gridList = new Ext.grid.GridPanel({
|
|
|
store: this.storeBodyList,
|
|
|
enableHdMenu: false,
|
|
|
region: 'center',
|
|
|
loadMask: { msg: Zi.LAN.LoadData },
|
|
|
trackMouseOver: true,
|
|
|
disableSelection: false,
|
|
|
selModel: this.GridCheckBoxModel,
|
|
|
tbar: [{
|
|
|
text: Zi.LAN.btndelInvdetail,
|
|
|
tooltip: Zi.LAN.btndelInvdetail,
|
|
|
id: 'btndelbill',
|
|
|
iconCls: "btndeletedetail",
|
|
|
handler: function (button, event) {
|
|
|
this.onDeleteClick(button, event, 1);
|
|
|
},
|
|
|
scope: this
|
|
|
}],
|
|
|
columns: [{
|
|
|
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: Zi.LAN.CUSTNO,
|
|
|
width: 120
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'MBLNO',
|
|
|
header: Zi.LAN.MBLNO ,
|
|
|
width: 120
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'CUSTOMERNAME',
|
|
|
header: Zi.LAN.CUSTOMERNAME,
|
|
|
width: 100
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'ETD',
|
|
|
header: Zi.LAN.ETD,
|
|
|
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
|
|
|
width: 100
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'BSSOURCE',
|
|
|
header: Zi.LAN.BSSOURCE,
|
|
|
width: 80
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'FEENAME',
|
|
|
header: Zi.LAN.FEENAME,
|
|
|
width: 80
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'FEETYPEREF',
|
|
|
header: Zi.LAN.FEETYPEREF,
|
|
|
width: 40
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'AMOUNT',
|
|
|
header: Zi.LAN.AMOUNT,
|
|
|
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: Zi.LAN.ORIGCURRENCY,
|
|
|
width: 80
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'ORIGAMOUNT',
|
|
|
header: Zi.LAN.ORIGAMOUNT,
|
|
|
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: Zi.LAN.SALE,
|
|
|
width: 80
|
|
|
}
|
|
|
]
|
|
|
});
|
|
|
|
|
|
|
|
|
this.storeBodySum = Ext.create('Ext.data.Store', {
|
|
|
model: 'Chfee_do_sum',
|
|
|
remoteSort: true,
|
|
|
proxy: {
|
|
|
type: 'ajax',
|
|
|
url: '/Account/Chfee_Invoicehexiao/GetBillSum',
|
|
|
reader: {
|
|
|
root: 'data',
|
|
|
totalProperty: 'totalCount'
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
|
|
|
this.gridSum = new Ext.grid.GridPanel({
|
|
|
store: this.storeBodySum,
|
|
|
enableHdMenu: false,
|
|
|
region: 'center',
|
|
|
loadMask: { msg: Zi.LAN.LoadData},
|
|
|
trackMouseOver: true,
|
|
|
disableSelection: false,
|
|
|
tbar: [{
|
|
|
xtype: 'label',
|
|
|
width: 120,
|
|
|
height: 22,
|
|
|
text: Zi.LAN.SHENAMOUNTTOTAL
|
|
|
}],
|
|
|
columns: [{
|
|
|
sortable: true,
|
|
|
dataIndex: 'FEETYPEREF',
|
|
|
header: Zi.LAN.FEETYPEREF,
|
|
|
width: 40
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'CURRENCY',
|
|
|
header: Zi.LAN.Currency,
|
|
|
width: 80
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'AMOUNT',
|
|
|
header: Zi.LAN.AMOUNT,
|
|
|
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;
|
|
|
}
|
|
|
}
|
|
|
]
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.storeBodyAddList = Ext.create('Ext.data.Store', {
|
|
|
pageSize: this.PageSize,
|
|
|
model: 'MsAddBillCustFee',
|
|
|
remoteSort: true,
|
|
|
proxy: {
|
|
|
type: 'ajax',
|
|
|
url: '/Account/Chfee_Invoicehexiao/GetBillDataList',
|
|
|
reader: {
|
|
|
id: 'BSNO',
|
|
|
root: 'data',
|
|
|
totalProperty: 'totalCount'
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
//明细表表格
|
|
|
|
|
|
this.Pagenum = Ext.create('Ext.form.field.Number', {
|
|
|
name: 'bottles',
|
|
|
fieldLabel: Zi.LAN.NumberOfpage,
|
|
|
labelAlign: 'right',
|
|
|
value: this.PageSize,
|
|
|
maxValue: 100000,
|
|
|
width: 180,
|
|
|
minValue: 0,
|
|
|
listeners: {
|
|
|
specialkey: function (field, e) {
|
|
|
if (e.getKey() == e.ENTER) {
|
|
|
_this.onRefreshClick();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
this.initgirdbilladdcolums = [{
|
|
|
sortable: true,
|
|
|
dataIndex: 'BSNO',
|
|
|
header: 'BSNO',
|
|
|
hidden: true,
|
|
|
width: 100
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'OPLBNAME',
|
|
|
header: Zi.LAN.OPLBNAME,
|
|
|
width: 80
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'CUSTNO',
|
|
|
header: Zi.LAN.CUSTNO ,
|
|
|
width: 108
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'MBLNO',
|
|
|
header: Zi.LAN.MBLNO ,
|
|
|
width: 108
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'CUSTOMERNAME',
|
|
|
header: Zi.LAN.CUSTOMERNAME,
|
|
|
width: 100
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'ETD',
|
|
|
header: Zi.LAN.ETD,
|
|
|
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
|
|
|
width: 100
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'SALE',
|
|
|
header: Zi.LAN.SALE,
|
|
|
width: 80
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'ACCDATE',
|
|
|
header: Zi.LAN.ACCDATE,
|
|
|
width: 80
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'OP',
|
|
|
header: Zi.LAN.OP,
|
|
|
width: 80
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'INPUTBY',
|
|
|
header: Zi.LAN.INPUTBY,
|
|
|
width: 80
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'PORTLOAD',
|
|
|
header: Zi.LAN.PORTLOAD,
|
|
|
width: 120
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'PORTDISCHARGE',
|
|
|
header: Zi.LAN.PORTDISCHARGE,
|
|
|
width: 120
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'VESSEL',
|
|
|
header: Zi.LAN.VESSEL,
|
|
|
width: 150
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'VOYNO',
|
|
|
header: Zi.LAN.VOYNO,
|
|
|
width: 60
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'FEEOBJNAME',
|
|
|
header: Zi.LAN.FEEOBJNAME,
|
|
|
width: 90
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'RMBCrBalAmount',
|
|
|
header: Zi.LAN.RMBCrBalAmount,
|
|
|
width: 70
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'USDCrBalAmount',
|
|
|
header: Zi.LAN.USDCrBalAmount,
|
|
|
width: 70
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'OTCrBalAmount',
|
|
|
header: Zi.LAN.OTCrBalAmount,
|
|
|
width: 70
|
|
|
}
|
|
|
];
|
|
|
this.girdbilladdcolums = this.initgirdbilladdcolums; //使用者id,表名,中间column数组,跳过一开始的几列
|
|
|
|
|
|
this.AddGridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
|
|
|
this.gridAddList = new Ext.grid.GridPanel({
|
|
|
store: this.storeBodyAddList,
|
|
|
enableHdMenu: false,
|
|
|
region: 'center',
|
|
|
loadMask: { msg: Zi.LAN.LoadData},
|
|
|
trackMouseOver: true,
|
|
|
disableSelection: false,
|
|
|
selModel: this.AddGridCheckBoxModel,
|
|
|
tbar: [{
|
|
|
text: Zi.LAN.btnAddInvdetail,
|
|
|
tooltip: Zi.LAN.btnAddInvdetail,
|
|
|
id: 'btnaddbill',
|
|
|
iconCls: "btnadddetail",
|
|
|
handler: function (button, event) {
|
|
|
this.onAddClick(button, event);
|
|
|
},
|
|
|
scope: this
|
|
|
}, '-', {
|
|
|
text: Zi.LAN.Saveliststyle, //保存列表样式
|
|
|
id: "btntest",
|
|
|
menu: [
|
|
|
{
|
|
|
text: Zi.LAN.Save, //保存
|
|
|
handler: function (button, event) {
|
|
|
_this.girdbilladdcolums = DsTruck.SaveGridPanel(USERID, _this.formname + 'billadd', _this.gridAddList.columns, _this.girdbilladdcolums, 1, true);
|
|
|
}
|
|
|
}, {
|
|
|
text: Zi.LAN.Initialization, //初始化
|
|
|
handler: function (menu, event) {
|
|
|
_this.girdbilladdcolums = DsTruck.SaveGridPanel(USERID, _this.formname + 'billadd', _this.gridAddList.columns, _this.initgirdbilladdcolums, 1, true);
|
|
|
}
|
|
|
}],
|
|
|
scope: this
|
|
|
}],
|
|
|
columns: this.girdbilladdcolums,
|
|
|
// paging bar on the bottom
|
|
|
bbar: [Ext.create('Ext.PagingToolbar', {
|
|
|
store: this.storeBodyAddList,
|
|
|
displayInfo: true,
|
|
|
displayMsg: Zi.LAN.FenYe,
|
|
|
emptyMsg: Zi.LAN.Nodata
|
|
|
}), 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);
|
|
|
// DsOpenEditWin("/TruckMng/MsWlPc/Edit");
|
|
|
}, this);
|
|
|
|
|
|
|
|
|
this.girdbilladdcolums = DsTruck.GetGridPanel(USERID, this.formname + 'billadd', this.girdbilladdcolums, 1); //使用者id,表名,中间column数组,跳过一开始的几列
|
|
|
this.girdbilladdcolums.unshift(new Ext.grid.RowNumberer());
|
|
|
this.gridAddList.reconfigure(this.storeBodyAddList, this.girdbilladdcolums);
|
|
|
|
|
|
|
|
|
this.storeAddFeeList = Ext.create('Ext.data.Store', {
|
|
|
model: 'Chfee_add_detail',
|
|
|
remoteSort: true,
|
|
|
proxy: {
|
|
|
type: 'ajax',
|
|
|
url: '/Account/Chfee_Invoicehexiao/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
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
this.gridAddFeeList = new Ext.grid.GridPanel({
|
|
|
store: this.storeAddFeeList,
|
|
|
enableHdMenu: false,
|
|
|
region: 'center',
|
|
|
loadMask: { msg: Zi.LAN.LoadData},
|
|
|
trackMouseOver: true,
|
|
|
disableSelection: false,
|
|
|
plugins: [this.cellEditingFee],
|
|
|
selModel: this.AddFeeGridCheckBoxModel,
|
|
|
tbar: [{
|
|
|
text: Zi.LAN.btnAddInvdetail,
|
|
|
tooltip: Zi.LAN.btnAddInvdetail,
|
|
|
iconCls: "btnadddetail",
|
|
|
id: 'btnadddetail',
|
|
|
handler: function (button, event) {
|
|
|
this.onAddDetailClick(button, event);
|
|
|
},
|
|
|
scope: this
|
|
|
}, {
|
|
|
xtype: "label", id: "zongshu", text: "",
|
|
|
handler: function () { ; }
|
|
|
}],
|
|
|
columns: [{
|
|
|
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
|
|
|
},
|
|
|
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
|
|
|
}
|
|
|
]
|
|
|
});
|
|
|
|
|
|
|
|
|
this.gridAddFeeList.on('edit', function (editor, e, eOpts) {
|
|
|
this.gridAddFeeListAfterEdit(editor, e, eOpts);
|
|
|
}, this);
|
|
|
|
|
|
this.gridAddFeeList.on({
|
|
|
selectionchange: function (sm, selections) {
|
|
|
_this.onSelectFee();
|
|
|
}
|
|
|
});
|
|
|
|
|
|
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: Zi.LAN.LoadData },
|
|
|
trackMouseOver: true,
|
|
|
disableSelection: false,
|
|
|
tbar: [{
|
|
|
xtype: 'label',
|
|
|
width: 220,
|
|
|
id: 'SelectGrid',
|
|
|
height: 22,
|
|
|
text: '所选费用合计'
|
|
|
}],
|
|
|
columns: [{
|
|
|
sortable: true,
|
|
|
dataIndex: 'RMBCRAMOUNT',
|
|
|
header: 'RMB未开',
|
|
|
width: 80
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'USDCRAMOUNT',
|
|
|
header: 'USD未开',
|
|
|
width: 80
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'OTCRAMOUNT',
|
|
|
header: '其他未开',
|
|
|
width: 80
|
|
|
}
|
|
|
]
|
|
|
});
|
|
|
|
|
|
//#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.storeCustCodefee = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'DsShipping.ux.CustomRefModel',
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListRm' }
|
|
|
});
|
|
|
|
|
|
this.storeCustCodefee.load({ params: { condition: ""} });
|
|
|
_this = this;
|
|
|
|
|
|
this.comboxAddCustCode = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: '费用对象',
|
|
|
store: this.storeCustCodefee,
|
|
|
queryMode: 'remote',
|
|
|
forceSelection: true,
|
|
|
minChars: 1,
|
|
|
queryParam: 'CODENAME',
|
|
|
name: 'CUSTNAME',
|
|
|
valueField: 'CustName',
|
|
|
displayField: 'CodeAndName',
|
|
|
enableKeyEvents: true,
|
|
|
listeners: {
|
|
|
specialkey: function (field, e) {
|
|
|
if (e.getKey() == e.ENTER) {
|
|
|
_this.onRefreshClick();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
});
|
|
|
this.StoreOpLb = Ext.create('Ext.data.Store', {
|
|
|
fields: ['OPLBNAME']
|
|
|
});
|
|
|
this.StoreOpLb.add({ "OPLBNAME": "海运出口" });
|
|
|
this.StoreOpLb.add({ "OPLBNAME": "海运进口" });
|
|
|
this.StoreOpLb.add({ "OPLBNAME": "报关业务" });
|
|
|
this.StoreOpLb.add({ "OPLBNAME": "进口贸易" });
|
|
|
this.StoreOpLb.add({ "OPLBNAME": "大宗散货" });
|
|
|
this.StoreOpLb.add({ "OPLBNAME": "综合业务" });
|
|
|
|
|
|
this.comboxOpLb = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: '业务类别',
|
|
|
store: this.StoreOpLb,
|
|
|
valueField: 'OPLBNAME',
|
|
|
displayField: 'OPLBNAME',
|
|
|
forceSelection: true,
|
|
|
name: 'OPLBNAME',
|
|
|
enableKeyEvents: true,
|
|
|
listeners: {
|
|
|
specialkey: 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',
|
|
|
forceSelection: true,
|
|
|
name: 'DC',
|
|
|
flex: 0.6,
|
|
|
value: '2',
|
|
|
enableKeyEvents: true,
|
|
|
listeners: {
|
|
|
specialkey: function (field, e) {
|
|
|
if (e.getKey() == e.ENTER) {
|
|
|
_this.onRefreshClick();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
|
|
|
this.comboxCurr2 = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: '币别',
|
|
|
store: this.StoreCurr,
|
|
|
forceSelection: true,
|
|
|
labelWidth: 40,
|
|
|
flex: 0.4,
|
|
|
name: 'Currency',
|
|
|
valueField: 'CURR',
|
|
|
displayField: 'CURR',
|
|
|
enableKeyEvents: true,
|
|
|
listeners: {
|
|
|
specialkey: 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,
|
|
|
forceSelection: true,
|
|
|
labelWidth: 60,
|
|
|
name: 'FeeName',
|
|
|
valueField: 'Name',
|
|
|
displayField: 'CodeAndName',
|
|
|
enableKeyEvents: true,
|
|
|
listeners: {
|
|
|
specialkey: 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.storePort = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
// model: 'DsShipping.ux.PortRefModel',
|
|
|
// proxy: { url: '/MvcShipping/MsBaseInfo/GetPortRefList' }
|
|
|
// });
|
|
|
|
|
|
// this.storePort.load();
|
|
|
|
|
|
// this.comboxPortRef = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
// fieldLabel: '港口(国外)',
|
|
|
// store: this.storePort,
|
|
|
// name: 'Port',
|
|
|
// valueField: 'PORT',
|
|
|
// displayField: 'PORTANDNAME'
|
|
|
// });
|
|
|
|
|
|
|
|
|
// this.storeOurPort = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
// model: 'DsShipping.ux.PortRefModel',
|
|
|
// proxy: { url: '/MvcShipping/MsBaseInfo/GetOurPortRefList' }
|
|
|
// });
|
|
|
|
|
|
// this.storeOurPort.load();
|
|
|
|
|
|
// this.comboxOurPortRef = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
// fieldLabel: '港口(国内)',
|
|
|
// store: this.storeOurPort,
|
|
|
// name: 'OurPort',
|
|
|
// valueField: 'PORT',
|
|
|
// displayField: 'PORTANDNAME'
|
|
|
// });
|
|
|
|
|
|
this.formSearch = Ext.widget('form', {
|
|
|
frame: true,
|
|
|
region: 'north',
|
|
|
bodyPadding: 5,
|
|
|
fieldDefaults: {
|
|
|
margins: '2 2 2 2',
|
|
|
labelAlign: 'right',
|
|
|
flex: 1,
|
|
|
labelWidth: 75,
|
|
|
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();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}, this.comboxFeeNameRef, {
|
|
|
xtype: 'button',
|
|
|
width: 45,
|
|
|
text: "",
|
|
|
iconCls: "btnreset",
|
|
|
handler: function (button, event) {
|
|
|
this.onClearSql(button, event);
|
|
|
},
|
|
|
scope: this
|
|
|
}, {
|
|
|
xtype: 'button',
|
|
|
width: 45,
|
|
|
text: "",
|
|
|
iconCls: "btnmore",
|
|
|
handler: function (button, event) {
|
|
|
var sql = this.getCondition();
|
|
|
var winAccess = new Shipping.DsQuery({
|
|
|
|
|
|
});
|
|
|
winAccess.StoreList = this.storeList;
|
|
|
winAccess.formname = this.formname;
|
|
|
winAccess.condition = sql;
|
|
|
winAccess.show();
|
|
|
return;
|
|
|
|
|
|
|
|
|
},
|
|
|
scope: this
|
|
|
}
|
|
|
]
|
|
|
}, {
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [this.comboxaddDCType, this.comboxCurr2, {
|
|
|
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();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}, {
|
|
|
fieldLabel: '申请编号',
|
|
|
name: 'ShenNo',
|
|
|
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();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}, {
|
|
|
fieldLabel: '结算单号',
|
|
|
name: 'StlNo',
|
|
|
enableKeyEvents: true,
|
|
|
listeners: {
|
|
|
specialkey: function (field, e) {
|
|
|
if (e.getKey() == e.ENTER) {
|
|
|
_this.onRefreshClick();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}, {
|
|
|
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.panelService = new Ext.Panel({
|
|
|
layout: "border",
|
|
|
region: 'center',
|
|
|
margin: '2 2',
|
|
|
items: [this.gridList]
|
|
|
});
|
|
|
|
|
|
this.panelSum = new Ext.Panel({
|
|
|
layout: "border",
|
|
|
region: 'east',
|
|
|
width: 550,
|
|
|
split: true,
|
|
|
margin: '2 2',
|
|
|
items: [this.gridSum]
|
|
|
});
|
|
|
|
|
|
|
|
|
this.paneldetail = new Ext.Panel({
|
|
|
title: '发票核销明细',
|
|
|
layout: "border",
|
|
|
region: "center",
|
|
|
items: [
|
|
|
this.panelService, this.panelSum
|
|
|
]
|
|
|
});
|
|
|
|
|
|
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.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({
|
|
|
title: '添加发票核销明细',
|
|
|
layout: "border",
|
|
|
region: 'south',
|
|
|
split: true,
|
|
|
height: 420,
|
|
|
items: [
|
|
|
this.formSearch, this.paneladddetail
|
|
|
]
|
|
|
});
|
|
|
|
|
|
//#endregion 明细表
|
|
|
|
|
|
//#region 布局
|
|
|
//控件布局
|
|
|
this.panelTop = new Ext.Panel({
|
|
|
layout: "border",
|
|
|
region: "north",
|
|
|
height: 162,
|
|
|
items: [this.panelBtn, this.formEdit]
|
|
|
});
|
|
|
|
|
|
Ext.apply(this, {
|
|
|
items: [this.panelTop, this.paneldetail, this.paneladd]
|
|
|
});
|
|
|
|
|
|
//#endregion
|
|
|
|
|
|
//绑定查询窗体
|
|
|
this.ParentWin = window.parent.opener;
|
|
|
|
|
|
//初始化数据
|
|
|
this.InitData();
|
|
|
|
|
|
//绑定事件
|
|
|
|
|
|
var billno = '*';
|
|
|
|
|
|
if (this.opStatus == 'edit') {
|
|
|
billno = this.editRecord.get('BILLNO');
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
this.storeBodyList.on('beforeload', function (store) {
|
|
|
|
|
|
var billno = _this.formEdit.getForm().findField('BILLNO').getValue();
|
|
|
var sql = " BILLNO='" + billno + "'";
|
|
|
Ext.apply(store.proxy.extraParams, { condition: sql });
|
|
|
}, this);
|
|
|
|
|
|
|
|
|
this.storeBodySum.on('beforeload', function (store) {
|
|
|
|
|
|
var billno = _this.formEdit.getForm().findField('BILLNO').getValue();
|
|
|
var sql = " BILLNO='" + billno + "'";
|
|
|
Ext.apply(store.proxy.extraParams, { condition: sql });
|
|
|
}, this);
|
|
|
|
|
|
|
|
|
this.storeBodyAddList.on('beforeload', function (store) {
|
|
|
// var sql = this.getCondition();
|
|
|
|
|
|
Ext.apply(store.proxy.extraParams, { condition: this.sqlcontext });
|
|
|
}, 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 sql = "";
|
|
|
sql = " BSNO='" + bsno + "'";
|
|
|
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.storeAddFeeList.on('beforeload', function (store) {
|
|
|
// var sql = this.getCondition();
|
|
|
|
|
|
Ext.apply(store.proxy.extraParams, { condition: this.selectfeesql });
|
|
|
}, this);
|
|
|
|
|
|
this.gridAddList.on({
|
|
|
selectionchange: function (sm, selections) {
|
|
|
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 + '票业务)'); //所选费用合计(选中' + R + '票业务)'
|
|
|
|
|
|
|
|
|
}
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
}, //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];
|
|
|
}
|
|
|
|
|
|
if (this.opStatus == 'edit')
|
|
|
condition = " BILLNO='" + this.editRecord.get('BILLNO') + "'";
|
|
|
|
|
|
this.LoadData(this.opStatus, condition);
|
|
|
this.LoadMustBe();
|
|
|
|
|
|
}, //end InitData
|
|
|
|
|
|
LoadData: function (opstatus, condition) {
|
|
|
this.serialNo = 0;
|
|
|
this.workSerialNo = 0;
|
|
|
this.bodyDel = [];
|
|
|
|
|
|
this.opStatus = opstatus;
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在查询主表数据...',
|
|
|
url: '/Account/Chfee_Invoicehexiao/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: Zi.LAN.Prompt,
|
|
|
msg: result.Message,
|
|
|
icon: Ext.MessageBox.ERROR,
|
|
|
buttons: Ext.Msg.OK
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
var data = result.data;
|
|
|
this.DataLoading = true;
|
|
|
this.formEdit.getForm().reset();
|
|
|
this.formEdit.getForm().setValues(data);
|
|
|
this.DataLoading = false;
|
|
|
this.GetEditStatus();
|
|
|
|
|
|
} else {
|
|
|
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
});
|
|
|
|
|
|
|
|
|
var billno = '*';
|
|
|
|
|
|
if (this.opStatus == 'edit') {
|
|
|
billno = this.editRecord.get('BILLNO');
|
|
|
|
|
|
};
|
|
|
|
|
|
// billno = this.formEdit.getForm().findField('DUINO').getValue();
|
|
|
|
|
|
this.storeBodyList.load({ params: { condition: " BILLNO='" + billno + "'" },
|
|
|
callback: function (r, options, success) {
|
|
|
if (success) {
|
|
|
if (this.storeBodyList.getCount() > 0) (this.comboxCurr.readOnly = true)
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
});
|
|
|
|
|
|
this.storeBodySum.load({ params: { condition: " BILLNO='" + billno + "'"} });
|
|
|
|
|
|
|
|
|
// this.storeFeeList.load({ params: { condition: " DUINO='" + billno + "'"} });
|
|
|
}, // end LoadDate
|
|
|
|
|
|
|
|
|
Save: function (type) {
|
|
|
var basicForm = this.formEdit.getForm();
|
|
|
|
|
|
if (!basicForm.isValid()) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
var data = basicForm.getValues();
|
|
|
|
|
|
Ext.Msg.wait('正在保存数据, 请稍侯..');
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在保存数据...',
|
|
|
url: '/Account/Chfee_Invoicehexiao/Save',
|
|
|
scope: this,
|
|
|
params: {
|
|
|
opstatus: this.opStatus,
|
|
|
data: Ext.JSON.encode(data)
|
|
|
},
|
|
|
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.DataLoading = true;
|
|
|
this.formEdit.getForm().setValues(returnData);
|
|
|
this.DataLoading = false;
|
|
|
|
|
|
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('MsChInvoicehexiao', 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';
|
|
|
|
|
|
|
|
|
|
|
|
} else if (type == '1') {
|
|
|
window.close();
|
|
|
} else {
|
|
|
this.LoadData('add', '');
|
|
|
|
|
|
}
|
|
|
} else {
|
|
|
Ext.Msg.show({ title: Zi.LAN.Error, 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
|
|
|
|
|
|
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: Zi.LAN.Prompt, msg: '核销金额不能大于未核金额!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
if (StlAmount < BalAmount) {
|
|
|
e.record.set('StlAmount', BalAmount);
|
|
|
Ext.Msg.show({ title: Zi.LAN.Prompt, msg: '核销金额不能大于未核金额!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
onSubmitAuditClick: function () {
|
|
|
var Duino = this.formEdit.getForm().findField('BILLNO').getValue();
|
|
|
|
|
|
var billstatus = this.formEdit.getForm().findField('BILLSTATUS').getValue();
|
|
|
|
|
|
|
|
|
var basicForm = this.formEdit.getForm();
|
|
|
|
|
|
if (Duino == '*') {
|
|
|
Ext.Msg.show({ title: Zi.LAN.Prompt, msg: '请先保存发票核销单,然后才能提交审核!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
|
return;
|
|
|
};
|
|
|
|
|
|
|
|
|
if ((billstatus != '新建') && (billstatus != '驳回提交')) {
|
|
|
|
|
|
Ext.Msg.show({ title: Zi.LAN.Prompt, msg: '当前状态无法提交审核!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (this.storeBodyList.getCount() == 0) {
|
|
|
Ext.Msg.show({ title: Zi.LAN.Prompt, msg: '没有核销明细,无法提交审核!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在更新数据...',
|
|
|
url: '/Account/Chfee_Invoicehexiao/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: Zi.LAN.Prompt,
|
|
|
msg: result.Message,
|
|
|
icon: Ext.MessageBox.ERROR,
|
|
|
buttons: Ext.Msg.OK
|
|
|
});
|
|
|
return;
|
|
|
} else {
|
|
|
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在查询主表数据...',
|
|
|
url: '/Account/Chfee_Invoicehexiao/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: Zi.LAN.Prompt,
|
|
|
msg: result.Message,
|
|
|
icon: Ext.MessageBox.ERROR,
|
|
|
buttons: Ext.Msg.OK
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
var data = result.data;
|
|
|
this.DataLoading = true;
|
|
|
this.formEdit.getForm().reset();
|
|
|
this.formEdit.getForm().setValues(data);
|
|
|
this.DataLoading = false;
|
|
|
|
|
|
var editp = Ext.create('MsChInvoicehexiao', 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
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
onCreateBalBillClick: function () {
|
|
|
var Duino = this.formEdit.getForm().findField('BILLNO').getValue();
|
|
|
|
|
|
var billstatus = this.formEdit.getForm().findField('BILLSTATUS').getValue();
|
|
|
|
|
|
|
|
|
var basicForm = this.formEdit.getForm();
|
|
|
|
|
|
if (Duino == '*') {
|
|
|
Ext.Msg.show({ title: Zi.LAN.Prompt, msg: '请先保存发票核销单,然后才能提交审核!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
|
return;
|
|
|
};
|
|
|
|
|
|
|
|
|
if (this.storeBodyList.getCount() == 0) {
|
|
|
Ext.Msg.show({ title: Zi.LAN.Prompt, msg: '没有核销明细,无法提交审核!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在更新数据...',
|
|
|
url: '/Account/Chfee_Invoicehexiao/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: Zi.LAN.Prompt,
|
|
|
msg: result.Message,
|
|
|
icon: Ext.MessageBox.ERROR,
|
|
|
buttons: Ext.Msg.OK
|
|
|
});
|
|
|
return;
|
|
|
} else {
|
|
|
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在查询主表数据...',
|
|
|
url: '/Account/Chfee_Invoicehexiao/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: Zi.LAN.Prompt,
|
|
|
msg: result.Message,
|
|
|
icon: Ext.MessageBox.ERROR,
|
|
|
buttons: Ext.Msg.OK
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
var data = result.data;
|
|
|
this.DataLoading = true;
|
|
|
this.formEdit.getForm().reset();
|
|
|
this.formEdit.getForm().setValues(data);
|
|
|
this.DataLoading = false;
|
|
|
|
|
|
var editp = Ext.create('MsChInvoicehexiao', 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
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
onSubmitCancelClick: function () {
|
|
|
var Duino = this.formEdit.getForm().findField('BILLNO').getValue();
|
|
|
|
|
|
var billstatus = this.formEdit.getForm().findField('BILLSTATUS').getValue();
|
|
|
|
|
|
var basicForm = this.formEdit.getForm();
|
|
|
|
|
|
if (Duino == '*' || basicForm.isDirty()) {
|
|
|
Ext.Msg.show({ title: Zi.LAN.Prompt, msg: '请先保存发票核销单,然后才能提交审核!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
|
return;
|
|
|
};
|
|
|
|
|
|
|
|
|
if (billstatus != '提交审核') {
|
|
|
|
|
|
Ext.Msg.show({ title: Zi.LAN.Prompt, msg: '当前状态无法撤销提交!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在更新数据...',
|
|
|
url: '/Account/Chfee_Invoicehexiao/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: Zi.LAN.Prompt,
|
|
|
msg: result.Message,
|
|
|
icon: Ext.MessageBox.ERROR,
|
|
|
buttons: Ext.Msg.OK
|
|
|
});
|
|
|
return;
|
|
|
} else {
|
|
|
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在查询主表数据...',
|
|
|
url: '/Account/Chfee_Invoicehexiao/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: Zi.LAN.Prompt,
|
|
|
msg: result.Message,
|
|
|
icon: Ext.MessageBox.ERROR,
|
|
|
buttons: Ext.Msg.OK
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
var data = result.data;
|
|
|
this.DataLoading = true;
|
|
|
this.formEdit.getForm().reset();
|
|
|
this.formEdit.getForm().setValues(data);
|
|
|
this.DataLoading = true;
|
|
|
|
|
|
var editp = Ext.create('MsChInvoicehexiao', 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
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
onAddDetailClick: function (button, event) {
|
|
|
this.addstore = true;
|
|
|
this.addDetail();
|
|
|
}, //end onAddDetailClick
|
|
|
|
|
|
|
|
|
onAddClick: function (button, event) {
|
|
|
this.addstore = true;
|
|
|
this.addBill();
|
|
|
}, //end onAddDetailClick
|
|
|
|
|
|
onDeleteClick: function (button, event) {
|
|
|
this.deleteBill();
|
|
|
}, //end onAddDetailClick
|
|
|
|
|
|
|
|
|
gridAfterEdit: function (editor, e, eOpts) {
|
|
|
//需要自己实现里面的事件
|
|
|
|
|
|
},
|
|
|
onSelectFee: function (button, event) {
|
|
|
//Ext.getCmp("zongshu").setText("1234");
|
|
|
|
|
|
var selectedRecords = this.gridAddFeeList.selModel.getSelection();
|
|
|
var sum = 0;
|
|
|
var usdsum = 0;
|
|
|
|
|
|
for (var i = 0; i < selectedRecords.length; i++) {
|
|
|
var rec = selectedRecords[i];
|
|
|
if (rec.data.Currency == 'USD') {
|
|
|
var stlamount = rec.get("StlAmount");
|
|
|
if (rec.data.FeeType == '1')
|
|
|
usdsum = Add(usdsum, -stlamount);
|
|
|
else
|
|
|
usdsum = Add(usdsum, stlamount);
|
|
|
} else if (rec.data.Currency == 'RMB') {
|
|
|
var stlamount = rec.get("StlAmount");
|
|
|
if (rec.data.FeeType == '1')
|
|
|
sum = Add(sum, -stlamount);
|
|
|
else
|
|
|
sum = Add(sum, stlamount);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
var sumstr = '';
|
|
|
if (sum != 0) {
|
|
|
sumstr = 'RMB:' + sum;
|
|
|
}
|
|
|
if (usdsum != 0) {
|
|
|
sumstr = sumstr + ' USD:' + usdsum;
|
|
|
}
|
|
|
|
|
|
|
|
|
Ext.getCmp("zongshu").setText("所选金额 :" + sumstr);
|
|
|
|
|
|
},
|
|
|
|
|
|
addDetail: function () {
|
|
|
var btnEAddDetail = Ext.getCmp('btnadddetail');
|
|
|
btnEAddDetail.disable();
|
|
|
|
|
|
var basicForm = this.formEdit.getForm();
|
|
|
|
|
|
|
|
|
var Duino = this.formEdit.getForm().findField('BILLNO').getValue();
|
|
|
_this = this;
|
|
|
if ((Duino == '*') || basicForm.isDirty()) {
|
|
|
|
|
|
var CUSTOMERNAME = this.formEdit.getForm().findField('CUSTOMERNAME').getValue();
|
|
|
var CURR = this.formEdit.getForm().findField('CURR').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;
|
|
|
if ((CUSTOMERNAME == '') || (CUSTOMERNAME == null)) {
|
|
|
this.formEdit.getForm().findField('CUSTOMERNAME').setValue(cust);
|
|
|
var recs = DsStoreQueryBy(this.storeCustCode, 'CustName', cust);
|
|
|
var INVOICECUSTNAME = this.formEdit.getForm().findField('INVOICECUSTNAME');
|
|
|
if (recs.getCount() > 0) {
|
|
|
var data = recs.getAt(0).data;
|
|
|
INVOICECUSTNAME.setValue(data.BillRises1);
|
|
|
} else {
|
|
|
INVOICECUSTNAME.setValue('');
|
|
|
}
|
|
|
}
|
|
|
if ((CURR == '') || (CURR == null))
|
|
|
this.formEdit.getForm().findField('CURR').setValue(curr);
|
|
|
} else {
|
|
|
|
|
|
Ext.Msg.show({ title: Zi.LAN.Prompt, msg: '核算客户和币别不能为空!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if (!basicForm.isValid()) {
|
|
|
btnEAddDetail.enable();
|
|
|
|
|
|
return;
|
|
|
}
|
|
|
var type = 0;
|
|
|
var data = basicForm.getValues();
|
|
|
|
|
|
Ext.Msg.wait('正在保存数据, 请稍侯..');
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在保存数据...',
|
|
|
url: '/Account/Chfee_Invoicehexiao/Save',
|
|
|
scope: this,
|
|
|
params: {
|
|
|
opstatus: this.opStatus,
|
|
|
data: Ext.JSON.encode(data)
|
|
|
},
|
|
|
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.DataLoading = true;
|
|
|
this.formEdit.getForm().setValues(returnData);
|
|
|
this.DataLoading = false;
|
|
|
|
|
|
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('MsChInvoicehexiao', 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(); //错误
|
|
|
Ext.Msg.show({ title: Zi.LAN.Error, 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 Duino = this.formEdit.getForm().findField('BILLNO').getValue();
|
|
|
|
|
|
var billstatus = this.formEdit.getForm().findField('BILLSTATUS').getValue();
|
|
|
|
|
|
if ((billstatus != '新建') && (billstatus != '驳回提交')) {
|
|
|
|
|
|
btnEAddDetail.enable();
|
|
|
Ext.Msg.show({ title: Zi.LAN.Prompt, 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.CURR;
|
|
|
|
|
|
var selections = this.gridAddList.getSelectionModel().getSelection();
|
|
|
var record = selections[0];
|
|
|
var billduino = record.data.BILLNO;
|
|
|
var mblno = record.data.MBLNO;
|
|
|
|
|
|
var selectedRecords = this.gridAddFeeList.selModel.getSelection();
|
|
|
|
|
|
var bodyAddDatas = [];
|
|
|
_this = this;
|
|
|
for (var i = 0; i < selectedRecords.length; i++) {
|
|
|
var rec = selectedRecords[i];
|
|
|
var cust = rec.data.CustomerName;
|
|
|
var bsno = rec.data.BSNO;
|
|
|
var curr = rec.data.Currency;
|
|
|
var ExChangerate = rec.data.ExChangerate;
|
|
|
if (cust == billcust) {
|
|
|
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.DoAmount = parseFloat(rec.data.StlAmount).mul(parseFloat(EXRATE));
|
|
|
|
|
|
} else {
|
|
|
_this.ExrateConversion(curr, billcurr, 'detail', ExChangerate);
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
bodyAddDatas.push(rec);
|
|
|
} else {
|
|
|
|
|
|
Ext.Msg.show({ title: Zi.LAN.Prompt, msg: '费用对象与发票核销客户不一致,不能添加此费用明细!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (bodyAddDatas.length == 0) {
|
|
|
btnEAddDetail.enable();
|
|
|
Ext.Msg.show({ title: Zi.LAN.Prompt, msg: '没有要添加的费用明细!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
|
return;
|
|
|
};
|
|
|
|
|
|
var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas);
|
|
|
|
|
|
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在添加数据...',
|
|
|
url: '/Account/Chfee_Invoicehexiao/AddDetail',
|
|
|
params: {
|
|
|
bill: billno,
|
|
|
data: jsonbodyAddDatas,
|
|
|
curr: billcurr,
|
|
|
mblno: mblno
|
|
|
},
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
var result = Ext.JSON.decode(response.responseText);
|
|
|
if (!result.Success) {
|
|
|
btnEAddDetail.enable();
|
|
|
|
|
|
Ext.Msg.show({
|
|
|
title: Zi.LAN.Prompt,
|
|
|
msg: result.Message,
|
|
|
icon: Ext.MessageBox.ERROR,
|
|
|
buttons: Ext.Msg.OK
|
|
|
});
|
|
|
return;
|
|
|
} else {
|
|
|
|
|
|
var sql = "";
|
|
|
|
|
|
var selections = this.gridAddFeeList.getSelectionModel().getSelection();
|
|
|
if (selections.length == 0) {
|
|
|
|
|
|
}
|
|
|
var record = selections[0];
|
|
|
var bsno = record.data.BSNO;
|
|
|
sql = " BSNO='" + bsno + "'";
|
|
|
|
|
|
var feesqlstr = this.getFeeCondition();
|
|
|
sql = sql + getAndConSql(sql, feesqlstr, feesqlstr);
|
|
|
|
|
|
this.storeAddFeeList.load({ params: { condition: sql} });
|
|
|
this.storeBodyList.load({ params: { condition: " BILLNO='" + billno + "'" },
|
|
|
callback: function (r, options, success) {
|
|
|
if (success) {
|
|
|
if (_this.storeBodyList.getCount() > 0) (_this.comboxCurr.readOnly = true)
|
|
|
else (_this.comboxCurr.readOnly = false)
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
});
|
|
|
this.storeBodySum.load({ params: { condition: " BILLNO='" + billno + "'"} });
|
|
|
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在查询主表数据...',
|
|
|
url: '/Account/Chfee_Invoicehexiao/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: Zi.LAN.Prompt,
|
|
|
msg: result.Message,
|
|
|
icon: Ext.MessageBox.ERROR,
|
|
|
buttons: Ext.Msg.OK
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
var data = result.data;
|
|
|
this.DataLoading = true;
|
|
|
this.formEdit.getForm().reset();
|
|
|
this.formEdit.getForm().setValues(data);
|
|
|
this.DataLoading = false;
|
|
|
|
|
|
var editp = Ext.create('MsChInvoicehexiao', 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(); //请求出现错误,请重试
|
|
|
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
});
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
addBill: function () {
|
|
|
var basicForm = this.formEdit.getForm();
|
|
|
|
|
|
var btnEAddbill = Ext.getCmp('btnaddbill');
|
|
|
btnEAddbill.disable();
|
|
|
|
|
|
var Duino = this.formEdit.getForm().findField('BILLNO').getValue();
|
|
|
_this = this;
|
|
|
if ((Duino == '*') || basicForm.isDirty()) {
|
|
|
|
|
|
var CUSTOMERNAME = this.formEdit.getForm().findField('CUSTOMERNAME').getValue();
|
|
|
var CURR = this.formEdit.getForm().findField('CURR').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;
|
|
|
if ((CUSTOMERNAME == '') || (CUSTOMERNAME == null)) {
|
|
|
this.formEdit.getForm().findField('CUSTOMERNAME').setValue(cust);
|
|
|
var recs = DsStoreQueryBy(this.storeCustCode, 'CustName', cust);
|
|
|
var INVOICECUSTNAME = this.formEdit.getForm().findField('INVOICECUSTNAME');
|
|
|
if (recs.getCount() > 0) {
|
|
|
var data = recs.getAt(0).data;
|
|
|
INVOICECUSTNAME.setValue(data.BillRises1);
|
|
|
} else {
|
|
|
INVOICECUSTNAME.setValue('');
|
|
|
}
|
|
|
}
|
|
|
if ((CURR == '') || (CURR == null))
|
|
|
this.formEdit.getForm().findField('CURR').setValue(curr);
|
|
|
} else {
|
|
|
btnEAddbill.enable(); //'提示', msg: '核算客户不能为空!'
|
|
|
|
|
|
Ext.Msg.show({ title: Zi.LAN.Prompt, msg: '核算客户和币别不能为空!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if (!basicForm.isValid()) {
|
|
|
return;
|
|
|
}
|
|
|
var type = 0;
|
|
|
var data = basicForm.getValues();
|
|
|
|
|
|
Ext.Msg.wait('正在保存数据, 请稍侯..');
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在保存数据...',
|
|
|
url: '/Account/Chfee_Invoicehexiao/Save',
|
|
|
scope: this,
|
|
|
params: {
|
|
|
opstatus: this.opStatus,
|
|
|
data: Ext.JSON.encode(data)
|
|
|
},
|
|
|
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.DataLoading = true;
|
|
|
this.formEdit.getForm().setValues(returnData);
|
|
|
this.DataLoading = false;
|
|
|
|
|
|
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('MsChInvoicehexiao', 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.addBillfn();
|
|
|
|
|
|
} else {
|
|
|
btnEAddbill.enable(); //错误
|
|
|
Ext.Msg.show({ title: Zi.LAN.Error, msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
|
|
|
}
|
|
|
} else {
|
|
|
btnEAddbill.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 billstatus = this.formEdit.getForm().findField('BILLSTATUS').getValue();
|
|
|
|
|
|
if ((billstatus != '新建') && (billstatus != '驳回提交')) {
|
|
|
btnEAddbill.enable(); //'提示', msg: '当前状态无法添加付费申请明细!'
|
|
|
|
|
|
Ext.Msg.show({ title: Zi.LAN.Prompt, 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.CURR;
|
|
|
|
|
|
var feeBSNOSql = '';
|
|
|
var sql = '';
|
|
|
var selectedRecords = this.gridAddList.selModel.getSelection();
|
|
|
|
|
|
if (selectedRecords.length == 0) {
|
|
|
btnEAddbill.enable(); //提示', msg: '没有选择要添加的业务!
|
|
|
Ext.Msg.show({ title: Zi.LAN.Prompt, msg: '没有选择要添加的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
|
return;
|
|
|
};
|
|
|
|
|
|
var bodyAddDatas = [];
|
|
|
for (var i = 0; i < selectedRecords.length; i++) {
|
|
|
|
|
|
var rec = selectedRecords[i];
|
|
|
var feeBSNO = "'" + rec.data.BSNO + "'";
|
|
|
if (feeBSNOSql == '') {
|
|
|
feeBSNOSql = feeBSNO;
|
|
|
} else {
|
|
|
feeBSNOSql = feeBSNOSql + "," + feeBSNO;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
if (feeBSNOSql == '') {
|
|
|
btnEAddbill.enable(); //提示', msg: '没有要添加的费用明细!
|
|
|
|
|
|
sql = "";
|
|
|
}
|
|
|
else {
|
|
|
sql = " BSNO IN (" + feeBSNOSql + ")";
|
|
|
sql = sql + getAndConSql(sql, this.FeeSqlStr, this.FeeSqlStr);
|
|
|
}
|
|
|
|
|
|
_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.data.CURR, billcurr, 'bill', 0);
|
|
|
return;
|
|
|
}
|
|
|
bodydatas.push(member);
|
|
|
}
|
|
|
|
|
|
var currBody = ConvertRecordsToJsonAll(bodydatas);
|
|
|
|
|
|
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在添加数据...',
|
|
|
url: '/Account/Chfee_Invoicehexiao/AddBill',
|
|
|
params: {
|
|
|
billno: billno,
|
|
|
billcust: billcust,
|
|
|
billcurr: billcurr,
|
|
|
feesql: sql,
|
|
|
storeCurrExrate: currBody
|
|
|
},
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
var result = Ext.JSON.decode(response.responseText);
|
|
|
if (!result.Success) {
|
|
|
btnEAddbill.enable();
|
|
|
|
|
|
Ext.Msg.show({
|
|
|
title: Zi.LAN.Prompt,
|
|
|
msg: result.Message,
|
|
|
icon: Ext.MessageBox.ERROR,
|
|
|
buttons: Ext.Msg.OK
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
} else {
|
|
|
|
|
|
|
|
|
dataList = result.Data;
|
|
|
|
|
|
if (dataList == null) {
|
|
|
|
|
|
var sql = "";
|
|
|
|
|
|
sql = " FEESTATUS IN (0,8,9) and ((ISNULL(AMOUNT,0)-ISNULL(ORDERINVOICE,0))<>0 AND (ISNULL(AMOUNT,0)-ISNULL(INVOICE,0))<>0) AND BSNO='1111111'";
|
|
|
|
|
|
this.storeAddFeeList.load({ params: { condition: sql} });
|
|
|
this.storeBodyAddList.load({ params: { start: 0, limit: _this.PageSize, condition: this.BillSql} });
|
|
|
|
|
|
this.storeBodyList.load({ params: { condition: " BILLNO='" + billno + "'" },
|
|
|
callback: function (r, options, success) {
|
|
|
if (success) {
|
|
|
if (_this.storeBodyList.getCount() > 0) (_this.comboxCurr.readOnly = true)
|
|
|
else (_this.comboxCurr.readOnly = false)
|
|
|
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
});
|
|
|
this.storeBodySum.load({ params: { condition: " BILLNO='" + billno + "'"} });
|
|
|
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在查询主表数据...',
|
|
|
url: '/Account/Chfee_Invoicehexiao/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: Zi.LAN.Prompt,
|
|
|
msg: result.Message,
|
|
|
icon: Ext.MessageBox.ERROR,
|
|
|
buttons: Ext.Msg.OK
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
var data = result.data;
|
|
|
this.DataLoading = true;
|
|
|
this.formEdit.getForm().reset();
|
|
|
this.formEdit.getForm().setValues(data);
|
|
|
this.DataLoading = false;
|
|
|
|
|
|
var editp = Ext.create('MsChInvoicehexiao', 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 {
|
|
|
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(); //请求出现错误,请重试
|
|
|
|
|
|
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
});
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
deleteBill: function (type) {
|
|
|
var btnEDeleteDetail = Ext.getCmp('btndelbill');
|
|
|
btnEDeleteDetail.disable();
|
|
|
|
|
|
var billstatus = this.formEdit.getForm().findField('BILLSTATUS').getValue();
|
|
|
|
|
|
if ((billstatus != '新建') && (billstatus != '驳回提交')) {
|
|
|
|
|
|
Ext.Msg.show({ title: Zi.LAN.Prompt, msg: '当前状态无法删除核销明细!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
|
btnEDeleteDetail.enable();
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
var billno = this.formEdit.getForm().findField('BILLNO').getValue();
|
|
|
var selectedRecords = this.gridList.selModel.getSelection();
|
|
|
|
|
|
if (selectedRecords.length == 0) {
|
|
|
Ext.Msg.show({ title: Zi.LAN.Prompt, msg: '没有要删除的费用明细!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
|
btnEDeleteDetail.enable();
|
|
|
return;
|
|
|
};
|
|
|
|
|
|
|
|
|
var feeBSNOSql = '';
|
|
|
|
|
|
var bodyAddDatas = [];
|
|
|
for (var i = 0; i < selectedRecords.length; i++) {
|
|
|
var rec = selectedRecords[i];
|
|
|
bodyAddDatas.push(rec);
|
|
|
}
|
|
|
|
|
|
var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas);
|
|
|
|
|
|
|
|
|
var sql = " BSNO IN (" + feeBSNOSql + ")";
|
|
|
Ext.Msg.wait('正在删除数据., 请稍侯..');
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在删除数据...',
|
|
|
url: '/Account/Chfee_Invoicehexiao/DelBill',
|
|
|
params: {
|
|
|
data: jsonbodyAddDatas,
|
|
|
billno: billno
|
|
|
},
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
var result = Ext.JSON.decode(response.responseText);
|
|
|
if (!result.Success) {
|
|
|
Ext.Msg.show({
|
|
|
title: Zi.LAN.Prompt,
|
|
|
msg: result.Message,
|
|
|
icon: Ext.MessageBox.ERROR,
|
|
|
buttons: Ext.Msg.OK
|
|
|
});
|
|
|
btnEDeleteDetail.enable();
|
|
|
return;
|
|
|
} else {
|
|
|
Ext.MessageBox.hide();
|
|
|
this.storeBodySum.load({ params: { condition: " BILLNO='" + billno + "'"} });
|
|
|
this.storeBodyList.load({ params: { condition: " BILLNO='" + billno + "'" },
|
|
|
callback: function (r, options, success) {
|
|
|
if (success) {
|
|
|
if (_this.storeBodyList.getCount() > 0) (_this.comboxCurr.readOnly = true)
|
|
|
else (_this.comboxCurr.readOnly = false)
|
|
|
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
});
|
|
|
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在查询主表数据...',
|
|
|
url: '/Account/Chfee_Invoicehexiao/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: Zi.LAN.Prompt,
|
|
|
msg: result.Message,
|
|
|
icon: Ext.MessageBox.ERROR,
|
|
|
buttons: Ext.Msg.OK
|
|
|
});
|
|
|
btnEDeleteDetail.enable();
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
var data = result.data;
|
|
|
this.DataLoading = true;
|
|
|
this.formEdit.getForm().reset();
|
|
|
this.formEdit.getForm().setValues(data);
|
|
|
this.DataLoading = false;
|
|
|
|
|
|
var editp = Ext.create('MsChInvoicehexiao', 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 {
|
|
|
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
|
|
|
btnEDeleteDetail.enable();
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
});
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
onRefreshClick: function (button, event) {
|
|
|
var sql = this.getCondition();
|
|
|
this.sqlcontext = sql;
|
|
|
this.PageSize = this.Pagenum.getValue();
|
|
|
this.storeBodyAddList.pageSize = this.PageSize;
|
|
|
this.storeBodyAddList.load({
|
|
|
params: { start: 0, limit: _this.PageSize, sort: '', condition: this.BillSql },
|
|
|
waitMsg: Zi.LAN.NowSelect ,
|
|
|
callback: function (r, options, success) {
|
|
|
if (success) {
|
|
|
if (r.length == 0) {
|
|
|
|
|
|
var sql = " BSNO='11111111' ";
|
|
|
this.storeAddFeeList.load({ params: { condition: sql} });
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
});
|
|
|
},
|
|
|
|
|
|
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: this.BillSql },
|
|
|
waitMsg: Zi.LAN.NowSelect ,
|
|
|
callback: function (r, options, success) {
|
|
|
if (success) {
|
|
|
if (r.length == 0) {
|
|
|
|
|
|
var sql = " BSNO='11111111' ";
|
|
|
this.storeAddFeeList.load({ params: { condition: sql} });
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
});
|
|
|
},
|
|
|
|
|
|
|
|
|
onClearSql: function () {
|
|
|
var form = this.formSearch.getForm();
|
|
|
form.reset();
|
|
|
},
|
|
|
|
|
|
|
|
|
getCondition: function () {
|
|
|
var form = this.formSearch.getForm();
|
|
|
if (!form.isValid()) {
|
|
|
Ext.Msg.alert(Zi.LAN.Prompt, '查询条件赋值错误,请检查。');
|
|
|
return '';
|
|
|
}
|
|
|
|
|
|
var sql = '';
|
|
|
|
|
|
var customNo = form.findField('CustomNo').getValue();
|
|
|
sql = sql + getAndConSql(sql, customNo, " (CUSTNO like '%" + customNo + "%' or MBLNO like '%" + customNo + "%' or HBLNO like '%" + customNo + "%' or CUSTOMNO like '%" + customNo + "%' or ORDERNO like '%" + customNo + "%')");
|
|
|
|
|
|
|
|
|
var OPLBNAME = form.findField('OPLBNAME').getValue();
|
|
|
sql = sql + getAndConSql(sql, OPLBNAME, "OPLBNAME='" + OPLBNAME + "'");
|
|
|
|
|
|
var expDateBgn = form.findField('ExpDateBgn').getRawValue();
|
|
|
sql = sql + getAndConSql(sql, expDateBgn, "ETD >='" + expDateBgn + "'");
|
|
|
|
|
|
var expDateEnd = form.findField('ExpDateEnd').getRawValue();
|
|
|
sql = sql + getAndConSql(sql, expDateEnd, "ETD <='" + expDateEnd + "'");
|
|
|
|
|
|
var ACCDATE = form.findField('ACCDATEFR').getRawValue();
|
|
|
sql = sql + getAndConSql(sql, ACCDATE, "ACCDATE>='" + ACCDATE + "'");
|
|
|
|
|
|
var ACCDATETO = form.findField('ACCDATETO').getRawValue();
|
|
|
sql = sql + getAndConSql(sql, ACCDATETO, "ACCDATE<='" + ACCDATETO + "'");
|
|
|
|
|
|
var feesql = ' EXISTS (select 1 from ch_fee where b.BSNO=ch_fee.BSNO and ch_fee.ISINVOICE=0 AND FEESTATUS IN (0,8,9) and (AMOUNT<>(ISNULL(INVOICE,0)+ISNULL(ORDERINVOICE,0))) ';
|
|
|
|
|
|
|
|
|
this.FeeSqlStr = this.getFeeCondition();
|
|
|
feesql = feesql + getAndConSql(feesql, this.FeeSqlStr, this.FeeSqlStr);
|
|
|
|
|
|
feesql = feesql + ')';
|
|
|
|
|
|
sql = sql + getAndConSql(sql, feesql, feesql);
|
|
|
|
|
|
this.BillSql = sql;
|
|
|
return sql;
|
|
|
},
|
|
|
getFeeCondition: function () {
|
|
|
var form = this.formSearch.getForm();
|
|
|
|
|
|
var feesql = ' FEESTATUS IN (0,8,9) and (AMOUNT<>(ISNULL(INVOICE,0)+ISNULL(ORDERINVOICE,0))) ';
|
|
|
|
|
|
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, "FEETYPE=" + DC);
|
|
|
|
|
|
var Currency = form.findField('Currency').getValue();
|
|
|
feesql = feesql + getAndConSql(feesql, Currency, "Currency='" + Currency + "'");
|
|
|
|
|
|
var FeeName = form.findField('FeeName').getValue();
|
|
|
feesql = feesql + getAndConSql(feesql, FeeName, "FeeName='" + FeeName + "'");
|
|
|
|
|
|
|
|
|
var ShenNo = form.findField('ShenNo').getValue();
|
|
|
feesql = feesql + getAndConSql(feesql, ShenNo, " GID IN (SELECT FEEID FROM CH_FEE_DO WHERE BILLNO like '%" + ShenNo + "%')");
|
|
|
|
|
|
var StlNo = form.findField('StlNo').getValue();
|
|
|
feesql = feesql + getAndConSql(feesql, StlNo, " GID IN (SELECT FEEID FROM CH_FEE_DO WHERE BILLNO='" + StlNo + "')");
|
|
|
|
|
|
|
|
|
var DuiNo = form.findField('DuiNo').getValue();
|
|
|
feesql = feesql + getAndConSql(feesql, DuiNo, " GID IN (SELECT GID FROM V_DUI_FEE WHERE DUINO LIKE '%" + DuiNo + "%')");
|
|
|
|
|
|
|
|
|
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(4);
|
|
|
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(4);
|
|
|
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: Zi.LAN.Prompt, 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 () {
|
|
|
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 {
|
|
|
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();
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
//#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
|
|
|
|
|
|
|
|
|
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('OP').getValue();
|
|
|
this.formEdit.getForm().findField('BILLSTATUS').setDisabled(true);
|
|
|
|
|
|
|
|
|
_this = this;
|
|
|
if ((bsStatus != '新建') && (bsStatus != '驳回提交')) {
|
|
|
canedit = false;
|
|
|
this.setSaveBtnStatus(canedit);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
this.StoreOpRange.load({ params: { optype: "modChInvoicehexiaoList" },
|
|
|
callback: function (r, options, success) {
|
|
|
if (success) {
|
|
|
if (r.length != 0) {
|
|
|
var records = DsStoreQueryBy(_this.StoreOpRange, 'OPID', op);
|
|
|
if (records.getCount() > 0) {
|
|
|
canedit = true;
|
|
|
btnESubmitAudit.enable();
|
|
|
btnESubmitAuditBack.enable();
|
|
|
|
|
|
} else {
|
|
|
canedit = false;
|
|
|
btnESubmitAudit.disable();
|
|
|
btnESubmitAuditBack.disable();
|
|
|
|
|
|
}
|
|
|
|
|
|
_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('btndelbill');
|
|
|
var btnEAddBill = Ext.getCmp('btnaddbill');
|
|
|
this.canedit = enable;
|
|
|
|
|
|
if (enable) {
|
|
|
btnESave.enable();
|
|
|
btnESaveAndClose.enable();
|
|
|
btnESaveAndNew.enable();
|
|
|
|
|
|
btnEAddDetail.enable();
|
|
|
btnEDeleteDetail.enable();
|
|
|
btnEAddBill.enable();
|
|
|
|
|
|
|
|
|
} else {
|
|
|
btnESave.disable();
|
|
|
btnESaveAndClose.disable();
|
|
|
btnESaveAndNew.disable();
|
|
|
btnEAddDetail.disable();
|
|
|
btnEDeleteDetail.disable();
|
|
|
btnEAddBill.disable();
|
|
|
|
|
|
|
|
|
}
|
|
|
},
|
|
|
|
|
|
|
|
|
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: Zi.LAN.Caveat, msg: '已是最前一票', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
|
|
|
|
|
|
return;
|
|
|
}
|
|
|
if (j == this.StoreList.count) {
|
|
|
Ext.Msg.show({ title: Zi.LAN.Caveat, 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: Zi.LAN.Caveat, 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);
|
|
|
},
|
|
|
|
|
|
Print: function () {
|
|
|
var basicForm = this.formEdit.getForm();
|
|
|
var billNo = basicForm.findField('BILLNO').value;
|
|
|
if (billNo == '*' || billNo == '') {
|
|
|
Ext.Msg.show({ title: '错误', msg: '单据还没有保存,请保存后再打印', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
var printType = 'MSCHDUIINVHEXIAO';
|
|
|
var sql1 = "SELECT * FROM ch_fee_invoicehexiao WHERE BILLNO='" + billNo + "'";
|
|
|
var sql2 = "SELECT c.GID,c.BSNO,c.FEEID,c.FEETYPE,(CASE C.FEETYPE WHEN 1 THEN '收' ELSE '付' END) AS FEETYPEREF,c.FEENAME,c.CURRENCY,c.AMOUNT,c.DOAMOUNT,c.ORIGCURRENCY,c.ORIGAMOUNT,c.EXCHANGERATE ";
|
|
|
sql2 = sql2 + " ,b.OPLBNAME,b.BSSTATUS,b.ACCDATE,b.MBLNO,b.HBLNO,b.CUSTNO";
|
|
|
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";
|
|
|
sql2 = sql2 + " FROM ch_fee_do_invoice c left join v_op_bill b on (b.bsno=c.bsno)";
|
|
|
sql2 = sql2 + " WHERE C.BILLNO='" + billNo + "' ORDER BY b.VESSEL,b.VOYNO,b.MBLNO";
|
|
|
|
|
|
var sql3 = "";
|
|
|
var sql4 = "";
|
|
|
var sql5 = "";
|
|
|
var sql6 = "";
|
|
|
|
|
|
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
|