You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
755 lines
34 KiB
JavaScript
755 lines
34 KiB
JavaScript
Ext.namespace('Shipping');
|
|
|
|
Shipping.FeeAddEdit= function (config) {
|
|
|
|
Ext.applyIf(this, config);
|
|
this.initUIComponents();
|
|
window.Shipping.FeeAddEdit.superclass.constructor.call(this);
|
|
};
|
|
|
|
|
|
|
|
Ext.extend(Shipping.FeeAddEdit, Ext.Window, {
|
|
StoreList: null,
|
|
ParentPanel: null, //Tab页编辑模式
|
|
OpStatus: 'add',
|
|
StoreBill: null,
|
|
StoreCustType: null,
|
|
stroplb:'',
|
|
EditRecord: null,
|
|
|
|
// region: 'center',
|
|
|
|
|
|
initUIComponents: function () {
|
|
|
|
|
|
_thisAddFee = this;
|
|
//#region 申请修改和删除界面
|
|
|
|
|
|
this.storeFeeType = Ext.create('Ext.data.Store', {
|
|
fields: ['ID', 'NAME']
|
|
});
|
|
//this.storeFeeType.add({ "ID": "0", "NAME": "" });
|
|
this.storeFeeType.add({ "ID": 1, "NAME": "应收" });
|
|
this.storeFeeType.add({ "ID": 2, "NAME": "应付" });
|
|
|
|
this.comboxFEETYPE = Ext.create('DsExt.ux.RefTableCombox', {
|
|
store: this.storeFeeType, //id: "STLNAME",
|
|
fieldLabel: '收付类型',
|
|
forceSelection: true,
|
|
name: 'FeeType',
|
|
value:1,
|
|
valueField: 'ID',
|
|
displayField: 'NAME'
|
|
});
|
|
|
|
this.storeFeeStatus = Ext.create('Ext.data.Store', {
|
|
fields: ['ID', 'NAME']
|
|
});
|
|
//this.storeFeeType.add({ "ID": "0", "NAME": "" });
|
|
this.storeFeeStatus.add({ "ID":1, "NAME": "录入状态" });
|
|
this.storeFeeStatus.add({ "ID":2, "NAME": "提交审核" });
|
|
//this.storeFeeStatus.add({ "ID":0, "NAME": "审核通过" });
|
|
|
|
this.comboxFeeStatus = Ext.create('DsExt.ux.RefTableCombox', {
|
|
store: this.storeFeeStatus, //id: "STLNAME",
|
|
fieldLabel: '费用状态',
|
|
forceSelection: true,
|
|
name: 'FeeStatus',
|
|
value: 1,
|
|
valueField: 'ID',
|
|
displayField: 'NAME'
|
|
});
|
|
|
|
|
|
|
|
this.StoreUnit = Ext.create('DsExt.ux.RefTableStore', {
|
|
model: 'MsFeeUnit',
|
|
proxy: { url: '/MvcShipping/MsChFee/GetCtnUnitList' }
|
|
});
|
|
this.StoreUnit.add({ "SUNIT": "P-单票", "UNIT": "单票", "QUANTITY":1 });
|
|
this.StoreUnit.add({ "SUNIT": "J-件", "UNIT": "件", "QUANTITY": 1 });
|
|
this.StoreUnit.add({ "SUNIT": "Z-重量", "UNIT": "重量", "QUANTITY": 1 });
|
|
this.StoreUnit.add({ "SUNIT": "T-TEU", "UNIT": "TEU", "QUANTITY": 1 });
|
|
this.StoreUnit.add({ "SUNIT": "C-CBM", "UNIT": "CBM", "QUANTITY": 1 });
|
|
this.StoreUnit.add({ "SUNIT": "B-BILL", "UNIT": "BILL", "QUANTITY": 1 });
|
|
this.StoreUnit.add({ "SUNIT": "V-车", "UNIT": "车", "QUANTITY": 1 });
|
|
this.StoreUnit.add({ "SUNIT": "T-天", "UNIT": "天", "QUANTITY": 1 });
|
|
this.StoreUnit.add({ "SUNIT": "G-个", "UNIT": "个", "QUANTITY": 1 });
|
|
this.StoreUnit.add({ "SUNIT": "S-小时", "UNIT": "小时", "QUANTITY": 1 });
|
|
this.StoreUnit.add({ "SUNIT": "JF-计费吨", "UNIT": "计费吨", "QUANTITY": 1 });
|
|
this.StoreUnit.add({ "SUNIT": "ZRX-自然箱", "UNIT": "自然箱", "QUANTITY": 1 });
|
|
this.StoreUnit.add({ "SUNIT": "D-吨", "UNIT": "吨", "QUANTITY": 1 });
|
|
this.StoreUnit.add({ "SUNIT": "20TK", "UNIT": "20TK", "QUANTITY": 1 });
|
|
|
|
this.StoreDateCurr = Ext.create('DsExt.ux.RefTableStore', {
|
|
model: 'MsFeeCurr',
|
|
proxy: { url: '/MvcShipping/MsChFee/GetFeeDateCurrList' }
|
|
});
|
|
|
|
this.StoreCurr = Ext.create('DsExt.ux.RefTableStore', {
|
|
model: 'MsFeeCurr',
|
|
proxy: { url: '/MvcShipping/MsChFee/GetFeeCurrList' }
|
|
});
|
|
this.StoreCurr.load({ params: { condition: "" } });
|
|
|
|
this.StoreFeeFrt = Ext.create('Ext.data.Store', {
|
|
fields: ['Frt']
|
|
});
|
|
this.StoreFeeFrt.add({ "Frt": "PP" });
|
|
this.StoreFeeFrt.add({ "Frt": "CC" });
|
|
|
|
|
|
this.comboxFeeFrtModify = Ext.create('DsExt.ux.RefTableCombox', {
|
|
store: this.StoreFeeFrt,
|
|
forceSelection: true,
|
|
fieldLabel: Zi.LAN.FEE.Frt, //'FRT',
|
|
name: 'FeeFrt',
|
|
valueField: 'Frt',
|
|
displayField: 'Frt'
|
|
});
|
|
|
|
this.storeFeeNameRefModify = Ext.create('DsExt.ux.RefTableStore', {
|
|
model: 'DsShipping.ux.FeeTypeRefModel',
|
|
proxy: { url: '/MvcShipping/MsChFee/GetFeeTypeRefList' }
|
|
});
|
|
this.storeFeeNameRefModify.load({ params: { condition: ""} });
|
|
|
|
this.comboxFeeNameRefModify = Ext.create('DsExt.ux.RefTableCombox', {
|
|
store: this.storeFeeNameRefModify,
|
|
fieldLabel: Zi.LAN.FEE.FeeName3, //'费用名称',
|
|
forceSelection: true,
|
|
name: 'FeeName',
|
|
valueField: 'Name',
|
|
displayField: 'CodeAndName',
|
|
listeners: {
|
|
scope: this,
|
|
'select': function (combo, records, eOpts) {
|
|
if (records.length > 0) {
|
|
|
|
var Description = records[0].data.Description;
|
|
var form = _thisAddFee.NewFeeEdit.getForm();
|
|
form.findField('FeeDescription').setValue(Description);
|
|
|
|
}
|
|
|
|
}
|
|
}
|
|
});
|
|
|
|
|
|
this.storeCustomerNameRefM = Ext.create('DsExt.ux.RefTableStore', {
|
|
model: 'DsShipping.ux.CustomRefModel',
|
|
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListRm' }
|
|
});
|
|
// this.storeCustomerNameRefM.load({ params: { condition: ""} });
|
|
|
|
|
|
this.comboxCustomerNameRefModify = Ext.create('DsExt.ux.RefTableCombox', {
|
|
store: this.storeCustomerNameRefM,
|
|
forceSelection: true,
|
|
queryMode: 'remote',
|
|
minChars: 1,
|
|
queryParam: 'CODENAME',
|
|
lazyRender: false,
|
|
fieldLabel: Zi.LAN.FEE.CUSTOMERNAME, //'结费对象',
|
|
name: 'CustomerName',
|
|
valueField: 'CustName',
|
|
displayField: 'CodeAndName'
|
|
});
|
|
|
|
|
|
this.comboxUnitModify = Ext.create('DsExt.ux.RefTableCombox', {
|
|
store: this.StoreUnit,
|
|
fieldLabel: Zi.LAN.FEE.Unit, //'单位标准',
|
|
name: 'Unit',
|
|
valueField: 'UNIT',
|
|
displayField: 'SUNIT'
|
|
});
|
|
|
|
this.CheckIsAdvancedpay = new Ext.form.Checkbox({
|
|
fieldLabel: Zi.LAN.FEE.IsAdvancedpay, //'是否垫付',
|
|
uncheckedValue: '0',
|
|
inputValue: '1',
|
|
name: 'IsAdvancedpay'
|
|
});
|
|
|
|
this.CheckIsInvoice = new Ext.form.Checkbox({
|
|
fieldLabel: Zi.LAN.FEE.NoIvoice, //'是否垫付',
|
|
uncheckedValue: '0',
|
|
inputValue: '1',
|
|
name: 'IsInvoice'
|
|
});
|
|
|
|
this.comboxCurrModify = Ext.create('DsExt.ux.RefTableCombox', {
|
|
store: this.StoreCurr,
|
|
fieldLabel: Zi.LAN.FEE.Currency, //'币别',
|
|
forceSelection: true,
|
|
// labelWidth: 40,
|
|
name: 'Currency',
|
|
valueField: 'CURR',
|
|
displayField: 'CURR',
|
|
value:'RMB',
|
|
listeners: {
|
|
scope: this,
|
|
'select': function (combo, records, eOpts) {
|
|
if (records.length > 0) {
|
|
if (this.DataLoading == true) return;
|
|
|
|
var CURR = records[0].data.CURR;
|
|
var form = _thisAddFee.NewFeeEdit.getForm();
|
|
if (CURR == 'RMB') {
|
|
form.findField('ExChangerate').setValue(1);
|
|
|
|
} else {
|
|
var FFrecords = DsStoreQueryBy(this.StoreDateCurr, 'CURR', CURR);
|
|
if (FFrecords.getCount() > 0) {
|
|
var ffdata = FFrecords.getAt(0).data;
|
|
var DEFRATE = ffdata.DEFRATE;
|
|
form.findField('ExChangerate').setValue(DEFRATE);
|
|
} else {
|
|
var DFrecords = DsStoreQueryBy(this.StoreCurr, 'CURR', CURR);
|
|
if (DFrecords.getCount() > 0) {
|
|
var dfdata = DFrecords.getAt(0).data;
|
|
var DEFRATE = dfdata.DEFRATE;
|
|
form.findField('ExChangerate').setValue(DEFRATE);
|
|
} else {
|
|
form.findField('ExChangerate').setValue(1);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
});
|
|
|
|
this.storeManagerModify = Ext.create('DsExt.ux.RefTableStore', {
|
|
model: 'DsShipping.ux.UserRefModel',
|
|
proxy: { url: '/CommMng/BasicDataRef/GetUserLinkRefList' }
|
|
});
|
|
this.storeManagerModify.load({ params: { condition: ""} });
|
|
|
|
this.comboxMANAGERModify = Ext.create('DsExt.ux.RefTableCombox', {
|
|
store: this.storeManagerModify,
|
|
fieldLabel: Zi.LAN.FEE.MANAGER, //'费用对象',
|
|
forceSelection: true,
|
|
name: 'MANAGER',
|
|
valueField: 'GID',
|
|
displayField: 'CodeAndName'
|
|
});
|
|
|
|
Ext.define('MsCompanySale', {
|
|
extend: 'Ext.data.Model',
|
|
idProperty: 'GID',
|
|
fields: [
|
|
{ name: 'GID', type: 'string' }, //GID
|
|
{ name: 'CODENAME', type: 'string' }, //CODENAME
|
|
{ name: 'NAME', type: 'string' }, //NAME
|
|
{ name: 'CodeAndName', type: 'string' }, //NAME
|
|
{ name: 'FULLNAME', type: 'string' }
|
|
]
|
|
});
|
|
|
|
this.storeSALECORPM = Ext.create('DsExt.ux.RefTableStore', {
|
|
model: 'MsCompanySale',
|
|
proxy: { url: '/MvcShipping/MsCompanys/GetNoPicDataList' }
|
|
});
|
|
this.storeSALECORPM.load();
|
|
|
|
|
|
this.comboxSALECORPM = Ext.create('DsExt.ux.RefTableCombox', {
|
|
store: this.storeSALECORPM,
|
|
fieldLabel: Zi.LAN.FEE.SALECORP, //'费用对象',
|
|
forceSelection: true,
|
|
name: 'SALECORP',
|
|
valueField: 'NAME',
|
|
displayField: 'CodeAndName'
|
|
});
|
|
|
|
this.DataLoading = false;
|
|
this.NewFeeEdit = Ext.widget('form', {
|
|
frame: true,
|
|
region: 'center',
|
|
trackResetOnLoad: true,
|
|
// title: Zi.LAN.FEE.NewFeeEdit, //'费用新值',
|
|
bodyPadding: 5,
|
|
fieldDefaults: {
|
|
margins: '2 2 2 2',
|
|
labelAlign: 'right',
|
|
flex: 1,
|
|
labelWidth: 80,
|
|
msgTarget: 'qtip'
|
|
},
|
|
|
|
items: [
|
|
{//fieldset 1
|
|
xtype: 'container',
|
|
defaultType: 'textfield',
|
|
layout: 'anchor',
|
|
defaults: {
|
|
anchor: '100%'
|
|
},
|
|
items: [{
|
|
xtype: 'container',
|
|
layout: 'hbox',
|
|
defaultType: 'textfield',
|
|
items: [{
|
|
fieldLabel: Zi.LAN.FEE.BSNO2, //'业务编号',
|
|
name: 'BsNo', hidden: true
|
|
}, {
|
|
fieldLabel: Zi.LAN.FEE.GID, //'GId',,
|
|
name: 'GId', flex: 0, hidden: true, margins: '0'
|
|
}, this.comboxFEETYPE, this.comboxFeeStatus,this.comboxFeeNameRefModify, this.comboxCustomerNameRefModify]
|
|
}, {
|
|
xtype: 'container',
|
|
layout: 'hbox',
|
|
defaultType: 'textfield',
|
|
items: [this.comboxUnitModify,{
|
|
fieldLabel: Zi.LAN.FEE.UnitPrice, //'不含税单价',
|
|
xtype: 'numberfield',
|
|
value: 0,
|
|
name: 'UnitPrice',
|
|
listeners: {
|
|
scope: this,
|
|
'change': function (ths, newValue, oldValue, eOpts) {
|
|
if (this.DataLoading == true) return;
|
|
if (newValue == oldValue) return;
|
|
var form = _thisAddFee.NewFeeEdit.getForm();
|
|
var unitPrice = newValue;
|
|
var FeeName = form.findField('FeeName').getValue();
|
|
var quantity = form.findField('Quantity').getValue();
|
|
var taxrate = form.findField('TaxRate').getValue();
|
|
|
|
this.DataLoading = true;
|
|
if (taxrate != null) {
|
|
var taxrateb = Add(1, Div(taxrate, 100, 4), 4);
|
|
var TaxUnitPrice = (parseFloat(unitPrice).mul(taxrateb)).toFixed(2);
|
|
form.findField('TaxUnitPrice').setValue(TaxUnitPrice);
|
|
|
|
}
|
|
var notaxamount = (parseFloat(unitPrice).mul(quantity)).toFixed(2);
|
|
form.findField('NoTaxAmount').setValue(notaxamount);
|
|
taxrate = parseFloat(taxrate) / 100;
|
|
var tax = parseFloat(notaxamount).mul(taxrate);
|
|
var amount = (parseFloat(notaxamount).add(parseFloat(tax))).toFixed(2);
|
|
form.findField('Amount').setValue(amount);
|
|
this.DataLoading = false;
|
|
}
|
|
}
|
|
}, {
|
|
fieldLabel: Zi.LAN.FEE.TaxRate, //'税率',
|
|
xtype: 'numberfield',
|
|
name: 'TaxRate',
|
|
value:0,
|
|
listeners: {
|
|
scope: this,
|
|
'change': function (ths, newValue, oldValue, eOpts) {
|
|
if (this.DataLoading == true) return;
|
|
if (newValue == oldValue) return;
|
|
|
|
var form = _thisAddFee.NewFeeEdit.getForm();
|
|
|
|
|
|
var unitPrice = form.findField('UnitPrice').getValue();
|
|
var FeeName = form.findField('FeeName').getValue();
|
|
var quantity = form.findField('Quantity').getValue();
|
|
var amount = form.findField('Amount').getValue();
|
|
var taxrate = newValue;
|
|
var taxrateb = Add(1, Div(taxrate, 100, 4), 4);//parseFloat(1 + parseFloat(taxrate.mul(0.01)));
|
|
|
|
this.DataLoading = true;
|
|
if (amount > 0) {
|
|
var notaxamount = Div(amount, taxrateb);
|
|
form.findField('NoTaxAmount').setValue(notaxamount);
|
|
} else {
|
|
var notaxamount = Div(Math.abs(amount), taxrateb);
|
|
notaxamount = -notaxamount;
|
|
form.findField('NoTaxAmount').setValue(notaxamount);
|
|
}
|
|
var tax = Add(amount, -notaxamount); //parseFloat(notaxamount).mul(taxrate);
|
|
form.findField('Tax').setValue(tax);
|
|
|
|
if (quantity != null && quantity != 0) {
|
|
var unitPrice = Div(notaxamount, quantity, 4); //(parseFloat(notaxamount).div(parseFloat(quantity))).toFixed(2);
|
|
form.findField('UnitPrice').setValue(unitPrice);
|
|
var TaxUnitPrice = Div(amount, quantity, 4);
|
|
form.findField('TaxUnitPrice').setValue(TaxUnitPrice);
|
|
}
|
|
|
|
this.DataLoading = false;
|
|
}
|
|
}
|
|
}, {
|
|
fieldLabel: Zi.LAN.FEE.TaxUnitPrice2, //'含税单价',
|
|
xtype: 'numberfield',
|
|
name: 'TaxUnitPrice',
|
|
value: 0,
|
|
listeners: {
|
|
scope: this,
|
|
'change': function (ths, newValue, oldValue, eOpts) {
|
|
if (this.DataLoading == true) return;
|
|
if (newValue == oldValue) return;
|
|
|
|
var form = _thisAddFee.NewFeeEdit.getForm();
|
|
|
|
var quantity = form.findField('Quantity').getValue();
|
|
var TaxUnitPrice = newValue;
|
|
var taxrate = form.findField('TaxRate').getValue();
|
|
this.DataLoading = true;
|
|
|
|
if (TaxUnitPrice != 0) {
|
|
var taxrateb = Add(1, Div(taxrate, 100, 4), 4);
|
|
var unitPrice = (parseFloat(TaxUnitPrice).div(parseFloat(taxrateb))).toFixed(2);
|
|
form.findField('UnitPrice').setValue(unitPrice);
|
|
|
|
}
|
|
if (quantity != null) {
|
|
|
|
var amount = (parseFloat(TaxUnitPrice).mul(quantity)).toFixed(2);
|
|
form.findField('Amount').setValue(amount);
|
|
|
|
var notaxamount = (parseFloat(amount).div(taxrateb)).toFixed(2);
|
|
form.findField('NoTaxAmount').setValue(notaxamount);
|
|
|
|
var tax = Add(amount, -notaxamount); //parseFloat(notaxamount).mul(taxrate);
|
|
form.findField('Tax').setValue(tax);
|
|
}
|
|
|
|
this.DataLoading = false;
|
|
}
|
|
}
|
|
}
|
|
]
|
|
}, {
|
|
xtype: 'container',
|
|
layout: 'hbox',
|
|
defaultType: 'textfield',
|
|
items: [{
|
|
fieldLabel: Zi.LAN.FEE.Quantity2, //'计费数量',
|
|
xtype: 'numberfield',
|
|
name: 'Quantity',
|
|
value: 1,
|
|
listeners: {
|
|
scope: this,
|
|
'change': function (ths, newValue, oldValue, eOpts) {
|
|
if (this.DataLoading == true) return;
|
|
if (newValue == oldValue) return;
|
|
var form = _thisAddFee.NewFeeEdit.getForm();
|
|
var TaxUnitPrice = form.findField('TaxUnitPrice').getValue();
|
|
var quantity = newValue;
|
|
var taxrate = form.findField('TaxRate').getValue();
|
|
this.DataLoading = true;
|
|
var amount = Mul(TaxUnitPrice, quantity); //(parseFloat(unitPrice).mul(quantity)).toFixed(2);
|
|
form.findField('Amount').setValue(amount);
|
|
var taxrateb = Add(1, Div(taxrate, 100, 4), 4);
|
|
if (amount > 0) {
|
|
var notaxamount = Div(amount, taxrateb);
|
|
form.findField('NoTaxAmount').setValue(notaxamount);
|
|
} else {
|
|
var notaxamount = Div(Math.abs(amount), taxrateb);
|
|
notaxamount = -notaxamount;
|
|
form.findField('NoTaxAmount').setValue(notaxamount);
|
|
}
|
|
var tax = Add(amount, -notaxamount); //parseFloat(notaxamount).mul(taxrate);
|
|
form.findField('Tax').setValue(tax);
|
|
|
|
if (taxrate != null) {
|
|
var unitPrice = Div(notaxamount, quantity, 4); //(parseFloat(notaxamount).div(parseFloat(quantity))).toFixed(2);
|
|
form.findField('UnitPrice').setValue(unitPrice);
|
|
|
|
}
|
|
|
|
this.DataLoading = false;
|
|
}
|
|
}
|
|
}, {
|
|
fieldLabel: Zi.LAN.FEE.NoTaxAmount, //'不含税金额',
|
|
xtype: 'numberfield',
|
|
value: 0,
|
|
name: 'NoTaxAmount',
|
|
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 = _thisAddFee.NewFeeEdit.getForm();
|
|
|
|
var notaxamount = newValue;
|
|
var taxrate = form.findField('TaxRate').getValue();
|
|
this.DataLoading = true;
|
|
|
|
var quantity = form.findField('Quantity').getValue();
|
|
if (quantity != null && quantity != 0) {
|
|
var unitPrice = Div(notaxamount, quantity); //(parseFloat(notaxamount).div(parseFloat(quantity))).toFixed(2);
|
|
form.findField('UnitPrice').setValue(unitPrice);
|
|
//var TaxUnitPrice = Div(amount, quantity);
|
|
//form.findField('TaxUnitPrice').setValue(TaxUnitPrice);
|
|
}
|
|
|
|
if (taxrate != null) {
|
|
|
|
var tax = Div(Mul(notaxamount, taxrate), 100);
|
|
var amount = (parseFloat(notaxamount).add(parseFloat(tax))).toFixed(2);
|
|
form.findField('Amount').setValue(amount);
|
|
|
|
if (quantity != null && quantity != 0) {
|
|
var TaxUnitPrice = Div(amount, quantity);
|
|
form.findField('TaxUnitPrice').setValue(TaxUnitPrice);
|
|
}
|
|
}
|
|
this.DataLoading = false;
|
|
|
|
}
|
|
}
|
|
}, {
|
|
fieldLabel: Zi.LAN.FEE.Amount2, //'含税金额',
|
|
xtype: 'numberfield',
|
|
value: 0,
|
|
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;
|
|
},
|
|
listeners: {
|
|
scope: this,
|
|
'change': function (ths, newValue, oldValue, eOpts) {
|
|
if (this.DataLoading == true) return;
|
|
if (newValue == oldValue) return;
|
|
var form = _thisAddFee.NewFeeEdit.getForm();
|
|
var amount = newValue;
|
|
var taxrate = form.findField('TaxRate').getValue();
|
|
this.DataLoading = true;
|
|
|
|
if (taxrate != null) {
|
|
var taxrateb = Add(1, Div(taxrate, 100, 4), 4);
|
|
var notaxamount = Div(amount, taxrateb); //(parseFloat(amount).div(taxrateb)).toFixed(2);
|
|
form.findField('NoTaxAmount').setValue(notaxamount);
|
|
var quantity = form.findField('Quantity').getValue();
|
|
if (quantity != null && quantity != 0) {
|
|
var unitPrice = Div(notaxamount, quantity); //(parseFloat(notaxamount).div(parseFloat(quantity))).toFixed(2);
|
|
form.findField('UnitPrice').setValue(unitPrice);
|
|
var TaxUnitPrice = Div(amount, quantity);
|
|
form.findField('TaxUnitPrice').setValue(TaxUnitPrice);
|
|
}
|
|
var tax = Add(amount, -notaxamount); //parseFloat(notaxamount).mul(taxrate);
|
|
form.findField('Tax').setValue(tax);
|
|
}
|
|
this.DataLoading = false;
|
|
|
|
}
|
|
}
|
|
}, this.comboxCurrModify
|
|
]
|
|
}, {
|
|
xtype: 'container',
|
|
layout: 'hbox',
|
|
defaultType: 'textfield',
|
|
items: [ {
|
|
fieldLabel: Zi.LAN.FEE.ExChangerate, //'汇率',
|
|
xtype: 'numberfield',
|
|
labelWidth: 40,
|
|
decimalPrecision: 6,
|
|
value: 1,
|
|
name: 'ExChangerate',
|
|
listeners: {
|
|
scope: this,
|
|
'change': function (ths, newValue, oldValue, eOpts) {
|
|
|
|
}
|
|
}
|
|
}, {
|
|
fieldLabel: Zi.LAN.FEE.Tax, //'汇率',
|
|
xtype: 'numberfield',
|
|
labelWidth: 40,
|
|
decimalPrecision: 6,
|
|
value: 0,
|
|
name: 'Tax'
|
|
}, {
|
|
fieldLabel: Zi.LAN.FEE.AccTaxRate3, //'财务税率',
|
|
xtype: 'numberfield',
|
|
value: 0,
|
|
name: 'AccTaxRate'
|
|
}, {
|
|
fieldLabel: Zi.LAN.FEE.FeeDescription, //'备注',
|
|
name: 'FeeDescription'
|
|
}
|
|
]
|
|
}, {
|
|
xtype: 'container',
|
|
layout: 'hbox',
|
|
defaultType: 'textfield',
|
|
items: [this.CheckIsInvoice, this.comboxMANAGERModify, this.CheckIsAdvancedpay, {
|
|
fieldLabel:'待引入委托编号', //'备注',
|
|
name: 'SALESNO'
|
|
}]
|
|
}, {
|
|
xtype: 'container',
|
|
layout: 'hbox',
|
|
defaultType: 'textfield',
|
|
items: [{
|
|
fieldLabel: Zi.LAN.FEE.REMARK, //'备注',
|
|
name: 'Remark'
|
|
}]
|
|
}
|
|
]//end items(fieldset 1)
|
|
}//end fieldset 1
|
|
],
|
|
buttons: [{
|
|
text: '确定添加',
|
|
id: 'btnEnter',
|
|
handler: function (button, event) {
|
|
_thisAddFee.execSql();
|
|
},
|
|
scope: this
|
|
}, {
|
|
text:'取消',
|
|
handler: function (button, event) {
|
|
var win = this.up("window");
|
|
win.close();
|
|
}
|
|
}]//end root items
|
|
});
|
|
|
|
//#endregion
|
|
|
|
|
|
|
|
//#region 布局
|
|
|
|
Ext.apply(this, {
|
|
height: 250,
|
|
closable: true,
|
|
draggable: true,
|
|
title: '新增费用',
|
|
defaultButton: 'btnEnter',
|
|
resizable: false,
|
|
items: [this.NewFeeEdit],
|
|
layout: "border",
|
|
width: 800,
|
|
xtype: "window",
|
|
id: "DsAddFeeWin"
|
|
});
|
|
//#endregion
|
|
}, execSql: function () {
|
|
|
|
var form = _thisAddFee.NewFeeEdit.getForm();
|
|
var FeeName = form.findField('FeeName').getValue();
|
|
if (FeeName == '' || FeeName == null || FeeName == undefined) {
|
|
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: Zi.LAN.FEE.FeiYongMingChengBuNengWeiKong, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); //费用名称不能为空!'
|
|
return;
|
|
};
|
|
var CustomerName = form.findField('CustomerName').getValue();
|
|
if (CustomerName == '' || CustomerName == null || CustomerName == undefined) {
|
|
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: Zi.LAN.FEE.JieFeiDuiXiangBuNengWeiKong, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
return;
|
|
};
|
|
|
|
var TaxRate = form.findField('TaxRate').getValue();
|
|
if (TaxRate == null || TaxRate == undefined) {
|
|
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: Zi.LAN.FEE.ShuiLvBuNengWeiKong, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });//'税率不能为空!'
|
|
return;
|
|
};
|
|
|
|
var Currency = form.findField('Currency').getValue();
|
|
if (Currency == '' || Currency == null || Currency == undefined) {
|
|
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: Zi.LAN.FEE.BiBieBuNengWeiKong, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
return;
|
|
};
|
|
var ExChangerate = form.findField('ExChangerate').getValue();
|
|
if (ExChangerate == '' || ExChangerate == null || ExChangerate == undefined) {
|
|
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: Zi.LAN.FEE.HuiLvBuNengWeiKong, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });//汇率不能为空!
|
|
return;
|
|
};
|
|
if (Currency == this.LOCALCURR && ExChangerate != 1) {
|
|
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: Zi.LAN.FEE.RMBHUILVBIXUWEI1, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
return;
|
|
}
|
|
var Amount = form.findField('Amount').getValue();;
|
|
if (Amount == 0) {
|
|
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: Zi.LAN.FEE.JinEWeiLingBuNengTiJiao, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
return;
|
|
};
|
|
|
|
|
|
var bodyAddDatas = [];
|
|
for (i = 0; i < this.StoreList.getCount(); i += 1) {
|
|
var memberyf = this.StoreList.getAt(i);
|
|
bodyAddDatas.push(memberyf);
|
|
}
|
|
|
|
var data = this.NewFeeEdit.getForm().getValues();
|
|
var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas);
|
|
Ext.Ajax.request({
|
|
waitMsg: Zi.LAN.ZhengZaiCaoZuoShuJu,
|
|
url: '/MvcShipping/MsChFee/SavePiLiang',
|
|
params: {
|
|
bslist: jsonbodyAddDatas,
|
|
optype: _thisAddFee.stroplb,
|
|
chfeebody: Ext.JSON.encode(data)
|
|
},
|
|
callback: function (options, success, response) {
|
|
if (success) {
|
|
var result = Ext.JSON.decode(response.responseText);
|
|
if (!result.Success) {
|
|
Ext.Msg.show({
|
|
title:'提示',
|
|
msg: result.Message,
|
|
icon: Ext.MessageBox.ERROR,
|
|
buttons: Ext.Msg.OK
|
|
});
|
|
return;
|
|
} else {
|
|
|
|
Ext.Msg.show({ title:'提示', msg: result.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
var win = Ext.getCmp("DsAddFeeWin");
|
|
win.close();
|
|
|
|
}
|
|
|
|
} else {
|
|
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
|
|
}
|
|
},
|
|
scope: this
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
});
|
|
|