Ext.namespace('Shipping');
Shipping.FeeAmendEditGrid = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.FeeAmendEditGrid.superclass.constructor.call(this);
};
Ext.extend(Shipping.FeeAmendEditGrid, Ext.Panel, {
ParentWin: null, //弹出式
ParentPanel: null, //Tab页编辑模式
OpStatus: 'add',
StoreBill: null,
StoreCustType: null,
EditRecord: null,
RefBillNo: '*',
DataLoading: true,
stroplb: '',
strBSNO: '',
strAmendBSNO: '',
AmendFeeStatus: 0,
feeType: 0,
isCancel: '0',
SelectFeeGid: '',
OprationSwap: function () {
var ret = new Array();
ret[0] = this.stroplb;
ret[1] = this.feeType;
ret[2] = this.storeDrChFee;
ret[3] = this.storeCrChFee;
ret[4] = " b.BSNO='" + this.strAmendBSNO + "' and " + this.SelectFeeGid;
ret[5] = this.SelectFeeGid;
return ret;
},
// region: 'center',
initUIComponents: function () {
this.feeDrSerialNo = 0;
this.feeDrBodyDel = [];
this.feeCrSerialNo = 0;
this.feeCrBodyDel = [];
this.MsPeriod = null;
this.AMENDSELFWORKFLOW = 0;
this.FEEMANGERMUSTBE = 0;
this.selectbill = 0;
this.ACCTAXRATESAMETAXRATE = 0;
this.ADDAMENDNOTFEECLOSE = 0;
this.AmendSalenotedit = 0;
this.FEELOCKNOTPR = 0;
_thisAmendfee = this;
this.StoreDrOpRange = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsFeeOP',
proxy: { url: '/MvcShipping/MsChFee/GetFeeOpRang' }
});
this.StoreCrOpRange = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsFeeOP',
proxy: { url: '/MvcShipping/MsChFee/GetFeeOpRang' }
});
this.storeMustBe = Ext.create('Ext.data.Store', {
model: 'DsShipping.ux.OpDefValue',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsCodeOpMustField/GetDataList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.storeMustBe.load({ params: { condition: "BSTYPE='更改单'" } });
this.StoreCustType = Ext.create('Ext.data.Store', {
fields: ['SCUSTTYPE', 'CUSTTYPE', 'CUSTNAME']
});
this.StoreCustTypeCr = Ext.create('Ext.data.Store', {
fields: ['SCUSTTYPE', 'CUSTTYPE', 'CUSTNAME']
});
this.comboxCustType = Ext.create('DsExt.ux.RefTableCombox', {
store: this.StoreCustType,
// forceSelection: true,
name: 'CustomerType',
valueField: 'CUSTTYPE',
displayField: 'SCUSTTYPE'
});
this.comboxCustTypeCr = Ext.create('DsExt.ux.RefTableCombox', {
store: this.StoreCustTypeCr,
// forceSelection: true,
name: 'CustomerType',
valueField: 'CUSTTYPE',
displayField: 'SCUSTTYPE'
});
this.StoreFeeFrt = Ext.create('Ext.data.Store', {
fields: ['Frt']
});
this.StoreFeeFrt.add({ "Frt": "PP" });
this.StoreFeeFrt.add({ "Frt": "CC" });
this.comboxFeeFrt = Ext.create('DsExt.ux.RefTableCombox', {
store: this.StoreFeeFrt,
forceSelection: true,
name: 'FeeFrt',
valueField: 'Frt',
displayField: 'Frt'
});
this.storeFeeNameRef = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.FeeTypeRefModel',
proxy: { url: '/MvcShipping/MsChFee/GetFeeTypeRefList' }
});
this.storeFeeNameRefCr = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.FeeTypeRefModel',
proxy: { url: '/MvcShipping/MsChFee/GetFeeTypeRefList' }
});
this.storeFeeNameRef.on('load', function (store, records) {
if (store.getCount() > 0) {
_thisAmendfee.storeFeeNameRefCr.add(records);
}
_thisAmendfee.StoreCustTypeCr.loadData(_thisAmendfee.StoreCustType.data.items);
}, this);
this.comboxFeeNameRef = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeFeeNameRef,
forceSelection: true,
matchFieldWidth: false,
name: 'FeeName',
valueField: 'Name',
displayField: 'CodeAndName',
listeners: {
scope: this,
'beforequery': function (e) {
return FilterCombox(e, 1);//在beforequery使用此方法
}
}
});
this.comboxFeeNameRefCr = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeFeeNameRefCr,
forceSelection: true,
matchFieldWidth: false,
name: 'FeeName',
valueField: 'Name',
displayField: 'CodeAndName',
listeners: {
scope: this,
'beforequery': function (e) {
return FilterCombox(e, 1);//在beforequery使用此方法
}
}
});
this.storeCustomerNameRef = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
//proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListRm' }
});
this.storeCustomerNameRefCr = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
//proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListRm' }
});
//this.storeCustomerNameRef.load({ params: { condition: ""} });
this.comboxCustomerNameRef = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeCustomerNameRef,
forceSelection: true,
queryMode: 'remote',
minChars: 1,
queryParam: 'CODENAME',
name: 'CustomerName',
valueField: 'CustName',
displayField: 'CodeAndName'
});
this.comboxCustomerNameRefCr = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeCustomerNameRefCr,
forceSelection: true,
queryMode: 'remote',
minChars: 1,
queryParam: 'CODENAME',
name: 'CustomerName',
valueField: 'CustName',
displayField: 'CodeAndName'
});
this.StoreUnit = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsFeeUnit',
proxy: { url: '/MvcShipping/MsChFee/GetCtnUnitList' }
});
this.comboxUnit = Ext.create('DsExt.ux.RefTableCombox', {
store: this.StoreUnit,
name: 'Unit',
valueField: 'UNIT',
displayField: 'SUNIT'
});
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.comboxCurr = Ext.create('DsExt.ux.RefTableCombox', {
store: this.StoreCurr,
forceSelection: true,
name: 'Currency',
valueField: 'CURR',
displayField: 'CURR'
});
this.storeManagerDr = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserLinkRefList' }
});
this.storeManagerDr.load({ params: { condition: ""} });
this.comboxMANAGERDr = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeManagerDr,
forceSelection: true,
name: 'MANAGER',
valueField: 'GID',
displayField: 'CodeAndName'
});
this.storeManagerCr = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserLinkRefList' }
});
this.storeManagerCr.load({ params: { condition: ""} });
this.comboxMANAGERCr = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeManagerCr,
forceSelection: true,
name: 'MANAGER',
valueField: 'GID',
displayField: 'CodeAndName',
value: SHOWNAME
});
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.storeSALECORP = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsCompanySale',
proxy: { url: '/MvcShipping/MsCompanys/GetNoPicDataList' }
});
this.storeSALECORPCr = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsCompanySale',
proxy: { url: '/MvcShipping/MsCompanys/GetNoPicDataList' }
});
this.storeSALECORP.load({
params: { condition: "" },
callback: function (r, options, success) {
if (success) {
_thisAmendfee.storeSALECORPCr.add(r);
}
}
});
this.comboxSALECORPDr = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeSALECORP,
forceSelection: true,
name: 'SALECORP',
valueField: 'NAME',
displayField: 'CodeAndName'
});
this.comboxSALECORPCr = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeSALECORPCr,
forceSelection: true,
name: 'SALECORP',
valueField: 'NAME',
displayField: 'CodeAndName'
});
this.storeAmendBill = Ext.create('Ext.data.Store', {
model: 'MsOpFeeAmend',
remoteSort: false,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsChFee/GetAmendList',
reader: {
id: 'GId',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//明细表-数据集
this.storeDrChFee = Ext.create('Ext.data.Store', {
model: 'MsChFee',
remoteSort: false,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsChFee/GetDataList',
reader: {
id: 'GId',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.storeCrChFee = Ext.create('Ext.data.Store', {
model: 'MsChFee',
remoteSort: false,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsChFee/GetDataList',
reader: {
id: 'GId',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.storeChFeeGain = Ext.create('Ext.data.Store', {
model: 'MsChFeeGain',
remoteSort: false,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsChFee/GetGainData',
reader: {
id: 'GId',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.storeChFeeModify = Ext.create('Ext.data.Store', {
model: 'MsChFee',
remoteSort: false,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsChFee/GetModifyData',
reader: {
id: 'GId',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.storeSaleCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserLinkRefListRm' }
});
this.storeSaleCode.load();
this.comboxSALE = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeSaleCode,
forceSelection: false,
//queryMode: 'remote',
//minChars: 0,
//queryParam: 'CODENAME',
name: 'SALE',
valueField: 'UserName',
displayField: 'CodeAndName'
});
this.ACCDATEEDIT = Ext.create('Ext.ux.form.MonthField', {
format: 'Y-m',
selectOnFocus: true
});
this.gridListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
this.gridAmendList = new Ext.grid.GridPanel({
store: this.storeAmendBill,
enableHdMenu: false,
region: 'center',
loadMask: { msg: Zi.LAN.FEE.ShuJuJiaZaiZhongQingShaoDeng }, //"数据加载中,请稍等..."
trackMouseOver: true,
disableSelection: false,
plugins: [this.gridListCellEditing],
selModel: this.GridCheckBoxModel,
selType: 'cellmodel',
tbar: [{
text: Zi.LAN.FEE.AddAmend, //'添加更改单',
tooltip: Zi.LAN.FEE.AddAmend, //添加更改单',
iconCls: "btnadd",
handler: function (button, event) {
this.onAddAmendClick(button, event);
},
scope: this
}, {
text: Zi.LAN.FEE.DeleteAmend, //'删除更改单',
tooltip: Zi.LAN.FEE.DeleteAmend, //删除更改单',
iconCls: "btndeletedetail",
handler: function (button, event) {
this.onDeleteAmendClick(button, event);
},
scope: this
}, '-', {
text: Zi.LAN.FEE.PostAmend, //'保存更改单',
tooltip: Zi.LAN.FEE.PostAmend, //保存更改单',
iconCls: "btnsave",
handler: function (button, event) {
this.onPostAmendClick(button, event);
},
scope: this
}],
columns: [{
sortable: true,
dataIndex: 'GID',
header: Zi.LAN.FEE.GID, //'GId',,
hidden: true,
width: 100
}, {
sortable: true,
dataIndex: 'PARENTID',
header: Zi.LAN.FEE.PARENTID, //'PARENTID',
hidden: true,
width: 100
}, {
sortable: true,
dataIndex: 'BSNO',
header: Zi.LAN.FEE.BSNO, //'BSNO',
hidden: true,
width: 100
}, {
sortable: true,
dataIndex: 'ACCDATE',
format: 'Y-m',
header: Zi.LAN.FEE.ACCDATE, //'会计期间',
editor: this.ACCDATEEDIT,
renderer: Ext.util.Format.dateRenderer('Y-m'),
width: 80
}, {
sortable: true,
dataIndex: 'FEESTATUSREF',
header: Zi.LAN.FEE.FEESTATUS, //'费用状态',
width: 90
}, {
sortable: true,
dataIndex: 'SALE',
header:'揽货人', //'会计期间',
editor: this.comboxSALE,
width: 80
}, {
sortable: true,
dataIndex: 'REASON',
header: Zi.LAN.FEE.REASON, //'更改原因',
editor: {
xtype: 'textfield',
selectOnFocus: true
},
width: 100
}, {
sortable: true,
dataIndex: 'REMARKS',
header: Zi.LAN.FEE.REMARK, //'备注',
editor: {
xtype: 'textfield',
selectOnFocus: true
},
width: 100
}, {
sortable: true,
id: '',
dataIndex: 'BillFeeStatus',
header: '整票状态', //'整票状态',
width: 60,
renderer: function (value, meta) {
if (value == '0') {
return "未提交";
} else if (value == '1') {
meta.tdCls = 'feestatus_refer';
return "整票提交";
} else if (value == '2') {
meta.tdCls = 'feestatus_pass';
return "审核通过";
} else if (value == '3') {
meta.tdCls = 'feestatus_nopass';
return "整票驳回";
} else {
return "";
}
}
}, {
sortable: true,
dataIndex: 'AMENDNO',
header: Zi.LAN.FEE.AMENDNO, //'费用状态',
width: 130
}, {
sortable: true,
dataIndex: 'CREATETIME',
header: Zi.LAN.FEE.CREATETIME, //'更改日期',
width: 80
}, {
sortable: true,
dataIndex: 'CREATEUSER',
header: Zi.LAN.FEE.CREATEUSER, //'更改人',
width: 80
}
]
});
this.gridListCellEditing.on('beforeedit', function (editor, e) {
return this.gridListBeforeEdit(editor, e);
}, this);
//明细表表格
this.cellEditingDrChFee = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.feeDrGridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
this.initgirdDrcolums = [{
sortable: true,
dataIndex: 'GId',
header: Zi.LAN.FEE.GID2, //'惟一编号',
hidden: true,
width: 160
}, {
sortable: true,
dataIndex: 'BsNo',
header: Zi.LAN.FEE.BSNO2, //'业务编号',
hidden: true,
width: 200
}, {
sortable: true,
dataIndex: 'FeeStatus',
header: Zi.LAN.FEE.FEESTATUS, //'费用状态',
renderer: function (value, p, record) {
return record.data.FeeStatus_Ref;
},
width: 66
}, {
sortable: true,
dataIndex: 'IsOpen',
header: Zi.LAN.FEE.IsOpen, //'是否机密',
hidden: true,
editor: {
xtype: 'checkboxfield',
inputValue: '1',
uncheckedValue: '0'
// selectOnFocus: true
},
renderer: function (value, cellmeta) {
if (value == 'true' || value == '1') {
return "√";
} else return "";
},
width: 60
}, {
sortable: true,
dataIndex: 'FeeName',
header: Zi.LAN.FEE.FeeName, //'应收费用名称',
editor: this.comboxFeeNameRef,
width: 100
}, {
sortable: true,
dataIndex: 'CustomerType',
header: Zi.LAN.FEE.CustomerType, //'客户类别',
editor: this.comboxCustType,
// hidden: true,
width: 80
}, {
sortable: true,
dataIndex: 'CustomerName',
header: Zi.LAN.FEE.CUSTOMERNAME, //'结算对象',
editor: this.comboxCustomerNameRef,
width: 120
}, {
sortable: true,
dataIndex: 'CustomerFullName',
header: Zi.LAN.FEE.CUSTOMERFULLNAME, //'结算对象',
width: 160
}, {
sortable: true,
dataIndex: 'Unit',
header: Zi.LAN.FEE.Unit, //'单位标准',
editor: this.comboxUnit,
width: 60
}, {
sortable: true,
dataIndex: 'UnitPrice',
header: Zi.LAN.FEE.UnitPrice, //'不含税单价',
editor: {
xtype: 'numberfield',
keyNavEnabled: false,
selectOnFocus: true,
hideTrigger: true,
mouseWheelEnabled: false,
enableKeyEvents: true,
listeners: {
keydown: function (textfield, e) {
if (e.getKey() == 40) {
_thisAmendfee.onNextKeyClick(1, 8)
}
}
}
},
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 '' + lsValue + '';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
},
align: 'right',
width: 80
}, {
sortable: true,
dataIndex: 'TaxRate',
header: Zi.LAN.FEE.TaxRate, //'税率',
editor: {
xtype: 'numberfield',
keyNavEnabled: false,
selectOnFocus: true,
mouseWheelEnabled: false,
enableKeyEvents: true,
listeners: {
keydown: function (textfield, e) {
if (e.getKey() == 40) {
_thisAmendfee.onNextKeyClick(1, 9)
}
}
}
},
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '' + lsValue + '';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
},
align: 'right',
width: 60
}, {
sortable: true,
dataIndex: 'TaxUnitPrice',
header: Zi.LAN.FEE.TaxUnitPrice, //'单价',
editor: {
xtype: 'numberfield',
keyNavEnabled: false,
selectOnFocus: true,
hideTrigger: true,
mouseWheelEnabled: false,
enableKeyEvents: true,
listeners: {
keydown: function (textfield, e) {
if (e.getKey() == 40) {
_thisAmendfee.onNextKeyClick(1, 10)
}
}
}
},
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 '' + lsValue + '';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
},
align: 'right',
width: 80
}, {
sortable: true,
dataIndex: 'Quantity',
header: Zi.LAN.FEE.Quantity, //'数量',
editor: {
xtype: 'numberfield',
keyNavEnabled: false,
allowDecimals: true,
decimalPrecision: 3,
selectOnFocus: true,
mouseWheelEnabled: false,
enableKeyEvents: true,
listeners: {
keydown: function (textfield, e) {
if (e.getKey() == 40) {
_thisAmendfee.onNextKeyClick(1, 11)
}
}
}
},
width: 60
}, {
sortable: true,
dataIndex: 'NoTaxAmount',
header: Zi.LAN.FEE.NoTaxAmount, //'不含税金额',
editor: {
xtype: 'numberfield',
keyNavEnabled: false,
selectOnFocus: true,
mouseWheelEnabled: false,
enableKeyEvents: true,
listeners: {
keydown: function (textfield, e) {
if (e.getKey() == 40) {
_thisAmendfee.onNextKeyClick(1, 12)
}
}
}
},
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 '' + lsValue + '';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
},
align: 'right',
width: 80
}, {
sortable: true,
dataIndex: 'Amount',
header: Zi.LAN.FEE.Amount, //'金额',
editor: {
xtype: 'numberfield',
keyNavEnabled: false,
selectOnFocus: true,
mouseWheelEnabled: false,
enableKeyEvents: true,
listeners: {
keydown: function (textfield, e) {
if (e.getKey() == 40) {
_thisAmendfee.onNextKeyClick(1, 13)
}
}
}
},
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 '' + lsValue + '';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
},
align: 'right',
width: 80
}, {
sortable: true,
dataIndex: 'Currency',
header: Zi.LAN.FEE.Currency, //'币别',
editor: this.comboxCurr,
width: 40
}, {
sortable: true,
dataIndex: 'ExChangerate',
header: Zi.LAN.FEE.ExChangerate, //'汇率',
editor: {
xtype: 'numberfield',
keyNavEnabled: false,
selectOnFocus: true,
mouseWheelEnabled: false,
decimalPrecision: 6,
enableKeyEvents: true,
listeners: {
keydown: function (textfield, e) {
if (e.getKey() == 40) {
_thisAmendfee.onNextKeyClick(1, 15)
}
}
}
},
// renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 4, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; },
align: 'right',
width: 60
}, {
sortable: true,
dataIndex: 'AccTaxRate',
header: Zi.LAN.FEE.AccTaxRate2, //'销项税率',
editor: {
xtype: 'numberfield',
keyNavEnabled: false,
selectOnFocus: true,
mouseWheelEnabled: false,
enableKeyEvents: true,
listeners: {
keydown: function (textfield, e) {
if (e.getKey() == 40) {
_thisAmendfee.onNextKeyClick(1, 16)
}
}
}
},
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 '' + lsValue + '';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
},
align: 'right',
width: 80
}, {
sortable: true,
dataIndex: 'Remark',
header: Zi.LAN.FEE.REMARK, //'备注',
editor: {
xtype: 'textfield',
selectOnFocus: true,
enableKeyEvents: true,
listeners: {
keydown: function (textfield, e) {
if (e.getKey() == 40) {
_thisAmendfee.onNextKeyClick(1, 17)
}
}
}
},
width: 150
}, {
sortable: true,
dataIndex: 'IsAdvancedpay',
header: Zi.LAN.FEE.IsAdvancedpay, //'是否垫付',
editor: {
xtype: 'checkboxfield',
inputValue: '1',
uncheckedValue: '0'
// selectOnFocus: true
},
renderer: function (value, cellmeta) {
if (value == '1') {
return "√";
}
},
width: 60
}, {
sortable: true,
dataIndex: 'IsInvoice',
header: Zi.LAN.FEE.IsInvoice, //'禁开发票',
editor: {
xtype: 'checkboxfield',
inputValue: '1',
uncheckedValue: '0'
// selectOnFocus: true
},
renderer: function (value, cellmeta) {
if (value == '1' || value == true) {
return "√";
}
},
width: 60
}, {
sortable: true,
dataIndex: 'FeeFrt',
header: Zi.LAN.FEE.FeeFrt, //'FRT',
editor: this.comboxFeeFrt,
width: 40
}, {
sortable: true,
dataIndex: 'Commissionrate',
header: Zi.LAN.FEE.Commissionrate, //'佣金比率',
editor: {
xtype: 'numberfield',
keyNavEnabled: false,
selectOnFocus: true,
mouseWheelEnabled: false,
enableKeyEvents: true,
listeners: {
keydown: function (textfield, e) {
if (e.getKey() == 40) {
_thisAmendfee.onNextKeyClick(1, 19)
}
}
}
},
width: 60
}, {
sortable: true,
dataIndex: 'OpName',
header: Zi.LAN.FEE.OpName, //'录入人',
width: 60
}, {
sortable: true,
dataIndex: 'EnterDate',
header: Zi.LAN.FEE.EnterDate, //'录入日期',
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
width: 80
}, {
sortable: true,
dataIndex: 'Settlement',
header: Zi.LAN.FEE.Settlement, //'结算金额',
align: 'right',
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 '' + lsValue + '';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}, {
sortable: true,
dataIndex: 'Invoice',
header: Zi.LAN.FEE.Invoice, //'已开票金额',
align: 'right',
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 '' + lsValue + '';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
},
// {
// sortable: true,
// dataIndex: 'InvoiceNum',
// header: Zi.LAN.FEE.InvoiceNum, //'发票号码',
// width: 80
// },
{
sortable: true,
dataIndex: 'INPUTMODE',
header: Zi.LAN.FEE.INPUTMODE, //'录入方式',
width: 150
}, {
sortable: true,
dataIndex: 'LOCALCURR',
header: Zi.LAN.FEE.LOCALCURR, //'本地货币',
width: 150
}, {
sortable: true,
dataIndex: 'MANAGER',
header: Zi.LAN.FEE.MANAGER, //'MANAGER',
editor: this.comboxMANAGERDr,
renderer: function (value, p, record) {
return record.data.MANAGERREF;
},
width: 100
}, {
sortable: true,
dataIndex: 'SALECORP',
header: Zi.LAN.FEE.SALECORP, //'MANAGER',
editor: this.comboxSALECORPDr,
width: 100
}, {
sortable: true,
dataIndex: 'STATEMENTNO',
header: Zi.LAN.FEE.STATEMENTNO,
width: 100
}, {
sortable: true,
dataIndex: 'Auditoperator',
header: Zi.LAN.FEE.Auditoperator, //'审核人',
width: 60
}, {
sortable: true,
dataIndex: 'AuditDate',
header: Zi.LAN.FEE.AuditDate, //'审核日期',
// renderer: Ext.util.Format.dateRenderer('Y-m-d'),
width: 80
}
];
this.girdDrcolums = this.initgirdDrcolums;
this.gridDrChFee = new Ext.grid.GridPanel({
store: this.storeDrChFee,
enableHdMenu: false,
region: 'center',
loadMask: { msg: Zi.LAN.FEE.ShuJuJiaZaiZhongQingShaoDeng },
trackMouseOver: true,
disableSelection: false,
plugins: [this.cellEditingDrChFee],
selModel: this.feeDrGridCheckBoxModel,
selType: 'cellmodel',
viewConfig: {
autoFill: true,
enableTextSelection: true,
getRowClass: function (record, rowIndex, rowParams, store) {
var feeStatus = record.get('FeeStatus');
return Shipping.FeeGetRowClass(feeStatus);
}
},
tbar: [{
text: '',
tooltip: Zi.LAN.FEE.btnFeeAddDr, //添加应收费用',
iconCls: "btnadd",
handler: function (button, event) {
this.onPostAmendClick(button, event, 1);
},
scope: this
}, '-', {
text: '',
tooltip: Zi.LAN.FEE.btnFeeSaveDr, //保存应收费用',
iconCls: "btnsave",
handler: function (button, event) {
this.onPostAmendClick(button, event);
},
scope: this
},
'-', {
text: '',
tooltip: Zi.LAN.FEE.btnFeeDelDr, //删除应收费用',
iconCls: "btndelete",
handler: function (button, event) {
this.onDelDetailClick(button, event, 1);
},
scope: this
}, '-', {
text: '',
tooltip: Zi.LAN.FEE.btnFeeCancel, //取消修改',
iconCls: "btncancel",
handler: function (button, event) {
this.onCancelDetailClick(button, event, 1);
},
scope: this
}, '-', {
text: '',
tooltip: Zi.LAN.FEE.btnFeeRefDr, //刷新应收',
iconCls: "btnrefresh",
handler: function (button, event) {
this.storeDrChFee.load({ params: { billno: this.strAmendBSNO, type: 1, optype: this.stroplb} });
},
scope: this
}, '-', {
text: '',
tooltip: Zi.LAN.FEE.btnFeePrintDr, //打印应收',
iconCls: "btnprint",
menu:
[
{ text: Zi.LAN.FEE.DaYinYingShouZhangDan, //"打印应收账单",
menu:
[//海运进口应收应付列表
{text: Zi.LAN.FEE.PrintSelectDetailDr, //"所选应收打印",
handler: function (menu, event) {
_thisAmendfee.onPrintSelectDetailClick(menu, event, 1);
}
}, { text: Zi.LAN.FEE.PrintCustDetailDr, //"应收客户打印",
handler: function (menu, event) {
_thisAmendfee.onPrintCustDetailClick(menu, event, 1);
}
},
{ text: Zi.LAN.FEE.PrintAllDetailDr, //"所有应收打印",
handler: function (menu, event) {
_thisAmendfee.onPrintAllDetailClick(menu, event, 1);
}
}
]
},
'-',
{ text: Zi.LAN.FEE.PrintGain, //"利润核算单打印",
handler: function (menu, event) {
_thisAmendfee.onPrintGainClick(menu, event, 1);
}
},
'-',
{
text: Zi.LAN.FEE.PrintDebit, //"单票账单打印",
handler: function (menu, event) {
_thisAmendfee.onPrintDebitClick(menu, event, 1);
}
}
],
/*
handler: function (button, event) {
this.onPrintDetailClick(button, event, 1);
},
*/
scope: this
}, '-', {
// text: '提交审核',
// tooltip: 提交审核',
// handler: function (button, event) {
//// this.onSubmitAuditClick(button, event, 1);
// this.onSubmitAuditNewClick(button, event, 1);
// },
text: Zi.LAN.FEE.btnFeeAuditDr, //'提交审核',
tooltip: Zi.LAN.FEE.btnFeeAuditDr, //'提交审核',
menu:
[
{ text: Zi.LAN.FEE.btnFeeAuditDr, //"提交审核",
handler: function (menu, event) {
_thisAmendfee.onSubmitAuditNewClick(menu, event, 1);
}
},
{ text: Zi.LAN.FEE.CancelAuditNew, //"撤销提交",
handler: function (menu, event) {
_thisAmendfee.onCancelAuditNewClick(menu, event, 1);
}
}, {
text: Zi.LAN.FEE.SubmitAuditBill, //"整票提交",
handler: function (menu, event) {
_thisAmendfee.onSubmitAuditBillClick(menu, event, 1);
}
}, {
text: Zi.LAN.FEE.CancelAuditBill, //"整票提交",
handler: function (menu, event) {
_thisAmendfee.onCancelSubmitAuditBillClick();
}
},
{
text: Zi.LAN.FEE.ShenIvoice, //"申请开票",
handler: function (menu, event) {
_thisAmendfee.onShenIvoiceClick(menu, event, 1);
}
},
{
text: Zi.LAN.FEE.ShenRecv, //"收费申请",
handler: function (menu, event) {
_thisAmendfee.onShenRecClick(menu, event, 1);
}
},
{ text: Zi.LAN.FEE.ViewWorkFlow, //"查看工作流",
handler: function (menu, event) {
_thisAmendfee.onViewWorkFlowDetailClick(menu, event, 1);
}
}],
scope: this
},
'-', {
text: Zi.LAN.FEE.ShenModify, //'申请修改',
tooltip: Zi.LAN.FEE.ShenModify, //'申请修改',
handler: function (button, event) {
this.onShenModifyClick(button, event, 1);
},
scope: this
},
'-', {
text: Zi.LAN.FEE.ShenDelete, //'申请删除',
tooltip: Zi.LAN.FEE.ShenDelete, //'申请删除',
handler: function (button, event) {
this.onShenDeleteClick(button, event, 1);
},
scope: this
},
'-', {
text: Zi.LAN.FEE.CancelShen, //'取消申请',
tooltip: Zi.LAN.FEE.CancelShen, //'取消申请',
handler: function (button, event) {
this.onCancelShenClick(button, event, 1);
},
scope: this
}, '-', {
text: Zi.LAN.FEE.NoIvoice, //'不开发票',
tooltip: Zi.LAN.FEE.NoIvoice, //'不开发票',
menu:
[
{
text: Zi.LAN.FEE.NoIvoice, //'不开发票',
tooltip: Zi.LAN.FEE.NoIvoice, //'不开发票',
handler: function (button, event) {
this.onNoIvoiceClick(button, event, 1);
},
scope: this
}, {
text: Zi.LAN.FEE.CancelNoIvoice, //'解禁发票',
tooltip: Zi.LAN.FEE.CancelNoIvoice, //解禁发票',
handler: function (button, event) {
this.onCancelNoIvoiceClick(button, event, 1);
},
scope: this
}],
scope: this
}, '-', {
text: Zi.LAN.FEE.HistryShen, //'历史申请',
tooltip: Zi.LAN.FEE.HistryShen, //历史申请',
handler: function (button, event) {
this.onHistryShenClick(button, event, 1);
},
scope: this
}, '-', {
text: Zi.LAN.FEE.ViewDetail, //'查看信息',
tooltip: Zi.LAN.FEE.ViewDetail, //查看信息',
handler: function (button, event) {
this.onViewDetailClick(button, event, 1);
},
scope: this
}, '-', {
text: Zi.LAN.FEE.btnFeeImpAddDr, //'引入费用',
tooltip: Zi.LAN.FEE.btnFeeImpAddDr, //'引入费用',
menu:
[
{ text: Zi.LAN.FEE.HistryAddDetail, //"历史引入",
handler: function (menu, event) {
_thisAmendfee.onHistryAddDetailClick(menu, event, 1);
}
},
{ text: Zi.LAN.FEE.TemplateAddDetail, //"引入费用模板",
handler: function (menu, event) {
_thisAmendfee.onTemplateAddDetailClick(menu, event, 1);
}
}, { text: Zi.LAN.FEE.CtnTkAddDetail, //"罐箱费用引入",
handler: function (menu, event) {
_thisAmendfee.onCtnTkAddDetailClick(menu, event, 1);
}
},
'-',
{ text: Zi.LAN.FEE.ShengChengYingFu, //"生成应付",
menu:
[
{ text: Zi.LAN.FEE.AddSelectDetailCr, //"所选生成应付",
handler: function (menu, event) {
_thisAmendfee.onAddSelectDetailClick(menu, event, 2);
}
},
{ text: Zi.LAN.FEE.AddAllDetailCr, //"所有生成应付",
handler: function (menu, event) {
_thisAmendfee.onAddAllDetailClick(menu, event, 2);
}
}
]
}
],
/*
handler: function (button, event) {
this.onCopyAddClick(button, event, 1);
},
*/
scope: this
}, '-', {
text: Zi.LAN.FEE.btntest, //"保存列表样式",
menu: [
{ text: Zi.LAN.FEE.SaveGridPanel, //"保存",
handler: function (button, event) {
_thisAmendfee.girdDrcolums = DsTruck.SaveGridPanel(GID, 'FEEDRGRIDAMEND', _thisAmendfee.gridDrChFee.columns, _thisAmendfee.girdDrcolums, 0, true);
}
}, { text: Zi.LAN.FEE.SaveGridPanel2, //"初始化",
handler: function (menu, event) {
_thisAmendfee.gridDrChFee.reconfigure(_thisAmendfee.storeDrChFee, _thisAmendfee.initgirdDrcolums);
_thisAmendfee.girdDrcolums = DsTruck.SaveGridPanel(GID, 'FEEDRGRIDAMEND', _thisAmendfee.gridDrChFee.columns, _thisAmendfee.initgirdDrcolums, 0, true);
}
}],
scope: this
}],
columns: this.girdDrcolums
});
this.girdDrcolums = DsTruck.GetGridPanel(GID, 'FEEDRGRIDAMEND', this.girdDrcolums, 0); //使用者id,表名,中间column数组,跳过一开始的几列
// this.gridDrChFee.reconfigure(this.storeDrChFee, this.girdDrcolums);
this.gridDrChFee.on('edit', function (editor, e, eOpts) {
this.gridListChFeeAfterEdit(editor, e, eOpts);
}, this);
this.cellEditingDrChFee.on('beforeedit', function (editor, e) {
return this.cellEditingChFeeBeforeEdit(editor, e);
}, this);
this.cellEditingCrChFee = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.feeCrGridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
_thisAmendfee = this;
this.initgirdCrcolums = [{
sortable: true,
dataIndex: 'GId',
header: Zi.LAN.FEE.GID2, //'惟一编号',
hidden: true,
width: 160
}, {
sortable: true,
dataIndex: 'BsNo',
header: Zi.LAN.FEE.BSNO2, //'业务编号',
hidden: true,
width: 200
}, {
sortable: true,
dataIndex: 'FeeStatus',
header: Zi.LAN.FEE.FEESTATUS, //'费用状态',
renderer: function (value, p, record) {
return record.data.FeeStatus_Ref;
},
width: 66
}, {
sortable: true,
dataIndex: 'IsOpen',
header: Zi.LAN.FEE.IsOpen, //'是否机密',
hidden: true,
editor: {
xtype: 'checkboxfield',
inputValue: '1',
uncheckedValue: '0'
// selectOnFocus: true
},
renderer: function (value, cellmeta) {
if (value == 'true' || value == '1') {
return "√";
} else return "";
},
width: 60
}, {
sortable: true,
dataIndex: 'FeeName',
header: Zi.LAN.FEE.FeeName2, //'应付费用名称',
editor: this.comboxFeeNameRefCr,
width: 100
}, {
sortable: true,
dataIndex: 'CustomerType',
header: Zi.LAN.FEE.CustomerType, //'客户类别',
editor: this.comboxCustTypeCr,
// hidden: true,
width: 80
}, {
sortable: true,
dataIndex: 'CustomerName',
header: Zi.LAN.FEE.CUSTOMERNAME, //'结算对象',
editor: this.comboxCustomerNameRefCr,
width: 120
}, {
sortable: true,
dataIndex: 'CustomerFullName',
header: Zi.LAN.FEE.CUSTOMERFULLNAME, //'结算对象',
width: 160
}, {
sortable: true,
dataIndex: 'Unit',
header: Zi.LAN.FEE.Unit, //'单位标准',
editor: this.comboxUnit,
width: 60
}, {
sortable: true,
dataIndex: 'UnitPrice',
header: Zi.LAN.FEE.UnitPrice, //'不含税单价',
editor: {
xtype: 'numberfield',
keyNavEnabled: false,
selectOnFocus: true,
enableKeyEvents: true,
listeners: {
keydown: function (textField, e) {
if (e.getKey() == 40) {
_thisAmendfee.onNextKeyClick(2, 8)
}
}
}
},
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 3, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '' + lsValue + '';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
},
align: 'right',
width: 80
}, {
sortable: true,
dataIndex: 'TaxRate',
header: Zi.LAN.FEE.TaxRate, //'税率',
editor: {
xtype: 'numberfield',
keyNavEnabled: false,
selectOnFocus: true,
enableKeyEvents: true,
listeners: {
keydown: function (textField, e) {
if (e.getKey() == 40) {
_thisAmendfee.onNextKeyClick(2, 9)
}
}
}
},
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; },
align: 'right',
width: 60
}, {
sortable: true,
dataIndex: 'TaxUnitPrice',
header: Zi.LAN.FEE.TaxUnitPrice, //'单价',
editor: {
xtype: 'numberfield',
keyNavEnabled: false,
selectOnFocus: true,
enableKeyEvents: true,
listeners: {
keydown: function (textField, e) {
if (e.getKey() == 40) {
_thisAmendfee.onNextKeyClick(2, 10)
}
}
}
},
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 3, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '' + lsValue + '';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
},
align: 'right',
width: 80
}, {
sortable: true,
dataIndex: 'Quantity',
header: Zi.LAN.FEE.Quantity, //'数量',
editor: {
xtype: 'numberfield',
keyNavEnabled: false,
selectOnFocus: true,
enableKeyEvents: true,
listeners: {
keydown: function (textField, e) {
if (e.getKey() == 40) {
_thisAmendfee.onNextKeyClick(2, 11)
}
}
}
},
width: 60
}, {
sortable: true,
dataIndex: 'NoTaxAmount',
header: Zi.LAN.FEE.NoTaxAmount, //'不含税金额',
editor: {
xtype: 'numberfield',
keyNavEnabled: false,
selectOnFocus: true,
enableKeyEvents: true,
listeners: {
keydown: function (textField, e) {
if (e.getKey() == 40) {
_thisAmendfee.onNextKeyClick(2, 12)
}
}
}
},
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 '' + lsValue + '';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
},
align: 'right',
width: 80
}, {
sortable: true,
dataIndex: 'Amount',
header: Zi.LAN.FEE.Amount, //'金额',
editor: {
xtype: 'numberfield',
keyNavEnabled: false,
selectOnFocus: true,
enableKeyEvents: true,
listeners: {
keydown: function (textField, e) {
if (e.getKey() == 40) {
_thisAmendfee.onNextKeyClick(2, 13)
}
}
}
},
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 '' + lsValue + '';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
},
align: 'right',
width: 80
}, {
sortable: true,
dataIndex: 'Currency',
header: Zi.LAN.FEE.Currency, //'币别',
editor: this.comboxCurr,
width: 40
}, {
sortable: true,
dataIndex: 'ExChangerate',
header: Zi.LAN.FEE.ExChangerate, //'汇率',
editor: {
xtype: 'numberfield',
keyNavEnabled: false,
selectOnFocus: true,
decimalPrecision: 6,
enableKeyEvents: true,
listeners: {
keydown: function (textField, e) {
if (e.getKey() == 40) {
_thisAmendfee.onNextKeyClick(2, 15)
}
}
}
},
// renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 4, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; },
align: 'right',
width: 60
}, {
sortable: true,
dataIndex: 'AccTaxRate',
header: Zi.LAN.FEE.AccTaxRate, //'进项税率',
editor: {
xtype: 'numberfield',
keyNavEnabled: false,
selectOnFocus: true,
enableKeyEvents: true,
listeners: {
keydown: function (textField, e) {
if (e.getKey() == 40) {
_thisAmendfee.onNextKeyClick(2, 16)
}
}
}
},
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 '' + lsValue + '';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
},
align: 'right',
width: 80
}, {
sortable: true,
dataIndex: 'Remark',
header: Zi.LAN.FEE.REMARK, //'备注',
editor: {
xtype: 'textfield',
selectOnFocus: true,
enableKeyEvents: true,
listeners: {
keydown: function (textField, e) {
if (e.getKey() == 40) {
_thisAmendfee.onNextKeyClick(2, 17)
}
}
}
},
width: 150
}, {
sortable: true,
dataIndex: 'IsAdvancedpay',
header: Zi.LAN.FEE.IsAdvancedpay, //'是否垫付',
editor: {
xtype: 'checkboxfield'
// selectOnFocus: true
},
width: 60
}, {
sortable: true,
dataIndex: 'IsInvoice',
header: Zi.LAN.FEE.NoIvoice, //'不开发票',
width: 60
}, {
sortable: true,
dataIndex: 'FeeFrt',
header: Zi.LAN.FEE.FeeFrt, //'FRT',
editor: this.comboxFeeFrt,
width: 40
}, {
sortable: true,
dataIndex: 'Commissionrate',
header: Zi.LAN.FEE.Commissionrate, //'佣金比率',
editor: {
xtype: 'numberfield',
keyNavEnabled: false,
selectOnFocus: true,
enableKeyEvents: true,
listeners: {
keydown: function (textField, e) {
if (e.getKey() == 40) {
_thisAmendfee.onNextKeyClick(2, 20)
}
}
}
},
width: 60
}, {
sortable: true,
dataIndex: 'OpName',
header: Zi.LAN.FEE.OpName, //'录入人',
width: 60
}, {
sortable: true,
dataIndex: 'EnterDate',
header: Zi.LAN.FEE.EnterDate, //'录入日期',
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
width: 80
}, {
sortable: true,
dataIndex: 'Settlement',
header: Zi.LAN.FEE.Settlement, //'结算金额',
align: 'right',
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 '' + lsValue + '';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}, {
sortable: true,
dataIndex: 'OrderAmount',
header: Zi.LAN.FEE.OrderAmount, //'申请金额',
align: 'right',
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 '' + lsValue + '';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}, {
sortable: true,
dataIndex: 'INPUTMODE',
header: Zi.LAN.FEE.INPUTMODE, //'录入方式',
width: 150
}, {
sortable: true,
dataIndex: 'LOCALCURR',
header: Zi.LAN.FEE.LOCALCURR, //'本地货币',
width: 150
}, {
sortable: true,
dataIndex: 'MANAGER',
header: Zi.LAN.FEE.MANAGER, //'MANAGER',
editor: this.comboxMANAGERCr,
renderer: function (value, p, record) {
return record.data.MANAGERREF;
},
width: 100
}, {
sortable: true,
dataIndex: 'SALECORP',
header: Zi.LAN.FEE.SALECORP, //'MANAGER',
editor: this.comboxSALECORPCr,
width: 100
}, {
sortable: true,
dataIndex: 'STATEMENTNO',
header: Zi.LAN.FEE.STATEMENTNO,
width: 100
}, {
sortable: true,
dataIndex: 'Auditoperator',
header: Zi.LAN.FEE.Auditoperator, //'审核人',
width: 60
}, {
sortable: true,
dataIndex: 'AuditDate',
header: Zi.LAN.FEE.AuditDate, //'审核日期',
// renderer: Ext.util.Format.dateRenderer('Y-m-d'),
width: 80
}
];
this.girdCrcolums = this.initgirdCrcolums;
this.gridCrChFee = new Ext.grid.GridPanel({
store: this.storeCrChFee,
enableHdMenu: false,
region: 'center',
loadMask: { msg: Zi.LAN.FEE.ShuJuJiaZaiZhongQingShaoDeng },
trackMouseOver: true,
disableSelection: false,
plugins: [this.cellEditingCrChFee],
selModel: this.feeCrGridCheckBoxModel,
selType: 'cellmodel',
viewConfig: {
autoFill: true,
enableTextSelection: true,
getRowClass: function (record, rowIndex, rowParams, store) {
var feeStatus = record.get('FeeStatus');
return Shipping.FeeGetRowClass(feeStatus);
}
},
tbar: [{
text: '',
tooltip: Zi.LAN.FEE.btnFeeAddCr, //添加应付费用',
iconCls: "btnadd",
handler: function (button, event) {
this.onPostAmendClick(button, event, 2);
},
scope: this
}, '-', {
text: '',
tooltip: Zi.LAN.FEE.btnFeeSaveDr, //保存应收费用',
iconCls: "btnsave",
handler: function (button, event) {
this.onPostAmendClick(button, event);
},
scope: this
},
'-', {
text: '',
tooltip: Zi.LAN.FEE.btnFeeDelCr, //删除应付费用',
iconCls: "btndelete",
handler: function (button, event) {
this.onDelDetailClick(button, event, 2);
},
scope: this
}, '-', {
text: '',
tooltip: Zi.LAN.FEE.btnFeeCancel, //取消修改',
iconCls: "btncancel",
handler: function (button, event) {
this.onCancelDetailClick(button, event, 2);
},
scope: this
}, '-', {
text: '',
tooltip: Zi.LAN.FEE.btnFeeRefCr, //刷新应付',
iconCls: "btnrefresh",
handler: function (button, event) {
this.storeCrChFee.load({ params: { billno: this.strAmendBSNO, type: 2, optype: this.stroplb} });
},
scope: this
}, '-', {
text: '',
tooltip: Zi.LAN.FEE.btnFeePrintCr, //打印应付',
iconCls: "btnprint",
menu:
[
{ text: Zi.LAN.FEE.DaYinYingFuZhangDan, //"打印应付账单",
menu:
[
{ text: Zi.LAN.FEE.PrintSelectDetailCr, //"所选应付打印",
handler: function (menu, event) {
_thisAmendfee.onPrintSelectDetailClick(menu, event, 2);
}
}, { text: Zi.LAN.FEE.PrintCustDetailCr, //"应付客户打印",
handler: function (menu, event) {
_thisAmendfee.onPrintCustDetailClick(menu, event, 2);
}
},
{ text: Zi.LAN.FEE.PrintAllDetailCr, //"所有应付打印",
handler: function (menu, event) {
_thisAmendfee.onPrintAllDetailClick(menu, event, 2);
}
}
]
},
'-',
{ text: Zi.LAN.FEE.PrintGain, //"利润核算单打印",
handler: function (menu, event) {
_thisAmendfee.onPrintGainClick(menu, event, 1);
}
}
],
scope: this
}, '-', {
text: Zi.LAN.FEE.btnFeeAuditDr, //'提交审核',
tooltip: Zi.LAN.FEE.btnFeeAuditDr, //'提交审核',
menu:
[
{ text: Zi.LAN.FEE.btnFeeAuditDr, //"提交审核",
handler: function (menu, event) {
_thisAmendfee.onSubmitAuditNewClick(menu, event, 2);
}
},
{ text: Zi.LAN.FEE.CancelAuditNew, //"撤销提交",
handler: function (menu, event) {
_thisAmendfee.onCancelAuditNewClick(menu, event, 2);
}
},
{
text: Zi.LAN.FEE.ShenPay, //"申请开票",
handler: function (menu, event) {
_thisAmendfee.onShenPayClick(menu, event, 2);
}
},
{ text: Zi.LAN.FEE.ViewWorkFlow, //"查看工作流",
handler: function (menu, event) {
_thisAmendfee.onViewWorkFlowDetailClick(menu, event, 2);
}
}],
scope: this
},
'-', {
text: Zi.LAN.FEE.ShenModify, //'申请修改',
tooltip: Zi.LAN.FEE.ShenModify, //'申请修改',
handler: function (button, event) {
this.onShenModifyClick(button, event, 2);
},
scope: this
},
'-', {
text: Zi.LAN.FEE.ShenDelete, //'申请删除',
tooltip: Zi.LAN.FEE.ShenDelete, //'申请删除',
handler: function (button, event) {
this.onShenDeleteClick(button, event, 2);
},
scope: this
},
'-', {
text: Zi.LAN.FEE.CancelShen, //'取消申请',
tooltip: Zi.LAN.FEE.CancelShen, //'取消申请',
handler: function (button, event) {
this.onCancelShenClick(button, event, 2);
},
scope: this
}, '-', {
text: Zi.LAN.FEE.NoIvoice, //'不开发票',
tooltip: Zi.LAN.FEE.NoIvoice, //'不开发票',
menu:
[
{
text: Zi.LAN.FEE.NoIvoice, //'不开发票',
tooltip: Zi.LAN.FEE.NoIvoice, //'不开发票',
handler: function (button, event) {
this.onNoIvoiceClick(button, event, 2);
},
scope: this
}, {
text: Zi.LAN.FEE.CancelNoIvoice, //'解禁发票',
tooltip: Zi.LAN.FEE.CancelNoIvoice, //解禁发票',
handler: function (button, event) {
this.onCancelNoIvoiceClick(button, event, 2);
},
scope: this
}],
scope: this
}, '-', {
text: Zi.LAN.FEE.HistryShen, //'历史申请',
tooltip: Zi.LAN.FEE.HistryShen, //历史申请',
handler: function (button, event) {
this.onHistryShenClick(button, event, 2);
},
scope: this
}, '-', {
text: Zi.LAN.FEE.ViewDetail, //'查看信息',
tooltip: Zi.LAN.FEE.ViewDetail, //查看信息',
handler: function (button, event) {
this.onViewDetailClick(button, event, 2);
},
scope: this
}, '-', {
text: Zi.LAN.FEE.btnFeeImpAddDr, //'引入费用',
tooltip: Zi.LAN.FEE.btnFeeImpAddDr, //'引入费用',
menu:
[
{ text: Zi.LAN.FEE.HistryAddDetail, //"历史引入",
handler: function (menu, event) {
_thisAmendfee.onHistryAddDetailClick(menu, event, 2);
}
},
{ text: Zi.LAN.FEE.TemplateAddDetail, //"引入费用模板",
handler: function (menu, event) {
_thisAmendfee.onTemplateAddDetailClick(menu, event, 2);
}
}, { text: Zi.LAN.FEE.CtnTkAddDetail, //"罐箱费用引入",
handler: function (menu, event) {
_thisAmendfee.onCtnTkAddDetailClick(menu, event, 2);
}
},
'-',
{ text: Zi.LAN.FEE.ShengChengYingShou, //"生成应收",
menu:
[
{ text: Zi.LAN.FEE.AddSelectDetailDr, //"所选生成应收",
handler: function (menu, event) {
_thisAmendfee.onAddSelectDetailClick(menu, event, 1);
}
},
{ text: Zi.LAN.FEE.AddAllDetailDr, //"所有生成应收",
handler: function (menu, event) {
_thisAmendfee.onAddAllDetailClick(menu, event, 1);
}
}
]
}
],
scope: this
}, '-', {
text: Zi.LAN.FEE.btntest, //"保存列表样式",
menu: [
{ text: Zi.LAN.FEE.SaveGridPanel, //"保存",
handler: function (button, event) {
_thisAmendfee.girdCrcolums = DsTruck.SaveGridPanel(GID, 'FEECRGRIDAMEND', _thisAmendfee.gridCrChFee.columns, _thisAmendfee.girdCrcolums, 0, true);
}
}, { text: Zi.LAN.FEE.SaveGridPanel2, //"初始化",
handler: function (menu, event) {
_thisAmendfee.gridCrChFee.reconfigure(_thisAmendfee.storeCrChFee, _thisAmendfee.initgirdCrcolums);
_thisAmendfee.girdCrcolums = DsTruck.SaveGridPanel(GID, 'FEECRGRIDAMEND', _thisAmendfee.gridCrChFee.columns, _thisAmendfee.initgirdCrcolums, 0, true);
}
}],
scope: this
}],
columns: this.girdCrcolums
});
this.girdCrcolums = DsTruck.GetGridPanel(GID, 'FEECRGRIDAMEND', this.girdCrcolums, 0); //使用者id,表名,中间column数组,跳过一开始的几列
// this.gridCrChFee.reconfigure(this.storeCrChFee, this.girdCrcolums);
this.gridCrChFee.on('edit', function (editor, e, eOpts) {
this.gridListChFeeAfterEdit(editor, e, eOpts);
}, this);
this.cellEditingCrChFee.on('beforeedit', function (editor, e) {
return this.cellEditingChFeeBeforeEdit(editor, e);
}, this);
//#endregion
this.InitDrGrid(this.girdDrcolums);
this.InitCrGrid(this.girdCrcolums);
this.storeBodySum = Ext.create('Ext.data.Store', {
model: 'MsOPGain',
remoteSort: false,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsChFee/GetOPGainList',
reader: {
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.storeBodyBLSum = Ext.create('Ext.data.Store', {
model: 'MsOPGain',
remoteSort: false,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsChFee/GetOPGainList',
reader: {
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.gridSum = new Ext.grid.GridPanel({
store: this.storeBodySum,
enableHdMenu: false,
region: 'center',
loadMask: { msg: Zi.LAN.FEE.ShuJuJiaZaiZhongQingShaoDeng },
trackMouseOver: true,
disableSelection: false,
columns: [{
header: Zi.LAN.FEE.CURR, //"总 计",
sortable: false,
align: 'center',
dataIndex: 'CURR',
width: 160
}, {
text: Zi.LAN.FEE.YingShou, //'应 收',
columns: [{
header: Zi.LAN.FEE.NORATE, //'不含税',
dataIndex: 'NORATEDR',
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 '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; },
align: 'right',
width: 160
}, {
header: Zi.LAN.FEE.DRCRPR, //'含税',
dataIndex: 'DR',
align: 'right',
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 '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; },
width: 160
}]
}, {
text: Zi.LAN.FEE.YingFu, //'应 付',
columns: [{
header: Zi.LAN.FEE.NORATE, //'不含税',
dataIndex: 'NORATECR',
align: 'right',
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 '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; },
width: 160
}, {
header: Zi.LAN.FEE.DRCRPR, //'含税',
dataIndex: 'CR',
align: 'right',
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 '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; },
width: 160
}]
}, {
text: Zi.LAN.FEE.LiRun, //'利 润',
columns: [{
header: Zi.LAN.FEE.NORATE, //'不含税',
dataIndex: 'NORATEPR',
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 '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; },
align: 'right',
width: 160
}, {
header: Zi.LAN.FEE.DRCRPR, //'含税',
dataIndex: 'PR',
align: 'right',
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 '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; },
width: 160
}]
}
]
});
//#region 申请修改和删除界面
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.comboxFeeNameRefModify = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeFeeNameRef,
fieldLabel: Zi.LAN.FEE.FeeName3, //'费用名称',
forceSelection: true,
queryMode: 'remote',
minChars: 2,
queryParam: 'CodeAndName',
name: 'FeeName',
valueField: 'Name',
displayField: 'CodeAndName'
});
this.storeCustomerNameRefM = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeCustomerNameRefM.load({ params: { condition: ""} });
this.comboxCustomerNameRefModify = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeCustomerNameRefM,
forceSelection: true,
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.IsAdvancedpay2, //'仅需审核业务',
uncheckedValue: 'false',
inputValue: 'true',
name: 'IsAdvancedpay'
});
this.comboxCurrModify = Ext.create('DsExt.ux.RefTableCombox', {
store: this.StoreCurr,
fieldLabel: Zi.LAN.FEE.Currency, //'币别',
forceSelection: true,
name: 'Currency',
valueField: 'CURR',
displayField: 'CURR',
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 = _thisAmendfee.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);
}
}
}
}
}
}
});
_thisAmendfee = this;
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'
});
this.comboxCustTypeModify = Ext.create('DsExt.ux.RefTableCombox', {
store: this.StoreCustTypeModify,
fieldLabel: Zi.LAN.FEE.CustomerType,
// forceSelection: true,
name: 'CustomerType',
valueField: 'CUSTTYPE',
displayField: 'SCUSTTYPE'
});
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: 90,
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'
}, {
fieldLabel: Zi.LAN.FEE.FeeType, //'FeeType',
name: 'FeeType', flex: 0, hidden: true, margins: '0'
}, this.comboxFeeNameRefModify, this.comboxCustomerNameRefModify, this.comboxUnitModify, this.comboxCustTypeModify]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: Zi.LAN.FEE.UnitPrice, //'不含税单价',
xtype: 'numberfield',
name: 'UnitPrice',
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 '' + lsValue + '';
}
}
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;
if (newValue == null || newValue == '') newValue = 0;
var form = _thisAmendfee.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 = parseFloat(1 + parseFloat(taxrate / 100));
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',
listeners: {
scope: this,
'change': function (ths, newValue, oldValue, eOpts) {
if (this.DataLoading == true) return;
if (newValue == oldValue) return;
if (newValue == null || newValue == '') newValue = 0;
var form = _thisAmendfee.NewFeeEdit.getForm();
var unitPrice = form.findField('UnitPrice').getValue();
var FeeName = form.findField('FeeName').getValue();
var quantity = form.findField('Quantity').getValue();
var taxrate = newValue;
if (_thisAmendfee.ACCTAXRATESAMETAXRATE == 1) form.findField('AccTaxRate').setValue(taxrate);
this.DataLoading = true;
if (unitPrice != null) {
var taxrateb = parseFloat(1 + parseFloat(taxrate / 100));
var TaxUnitPrice = (parseFloat(unitPrice).mul(taxrateb)).toFixed(2);
form.findField('TaxUnitPrice').setValue(TaxUnitPrice);
}
var notaxamount = form.findField('NoTaxAmount').getValue();
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.TaxUnitPrice2, //'含税单价',
xtype: 'numberfield',
name: 'TaxUnitPrice',
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 '' + lsValue + '';
}
}
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;
if (newValue == null || newValue == '') newValue = 0;
var form = _thisAmendfee.NewFeeEdit.getForm();
var quantity = form.findField('Quantity').getValue();
var TaxUnitPrice = newValue;
var taxrate = form.findField('TaxUnitPrice').getValue();
this.DataLoading = true;
if (TaxUnitPrice != 0) {
var taxrateb = parseFloat(1 + parseFloat(taxrate / 100));
var unitPrice = (parseFloat(TaxUnitPrice).div(parseFloat(taxrateb))).toFixed(2);
form.findField('UnitPrice').setValue(unitPrice);
}
if (quantity != null) {
var notaxamount = (parseFloat(amount).div(taxrateb)).toFixed(2);
form.findField('NoTaxAmount').setValue(notaxamount);
var amount = (parseFloat(TaxUnitPrice).mul(quantity)).toFixed(2);
form.findField('Amount').setValue(amount);
}
this.DataLoading = false;
}
}
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: Zi.LAN.FEE.Quantity2, //'计费数量',
xtype: 'numberfield',
name: 'Quantity',
listeners: {
scope: this,
'change': function (ths, newValue, oldValue, eOpts) {
if (this.DataLoading == true) return;
if (newValue == oldValue) return;
if (newValue == null || newValue == '') newValue = 0;
var form = _thisAmendfee.NewFeeEdit.getForm();
var unitPrice = form.findField('UnitPrice').getValue();
var FeeName = form.findField('FeeName').getValue();
var quantity = newValue;
var taxrate = form.findField('TaxRate').getValue();
this.DataLoading = true;
if (taxrate != null) {
var taxrateb = parseFloat(1 + parseFloat(taxrate / 100));
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.NoTaxAmount, //'不含税金额',
xtype: 'numberfield',
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 '' + lsValue + '';
}
}
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;
if (newValue == null || newValue == '') newValue = 0;
var form = _thisAmendfee.NewFeeEdit.getForm();
var notaxamount = newValue;
var taxrate = form.findField('TaxRate').getValue();
this.DataLoading = true;
if (taxrate != null) {
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.Amount2, //'含税金额',
xtype: 'numberfield',
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 '' + lsValue + '';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxCurrModify, {
fieldLabel: Zi.LAN.FEE.ExChangerate, //'汇率',
xtype: 'numberfield',
name: 'ExChangerate'
}, {
fieldLabel: Zi.LAN.FEE.AccTaxRate3, //'财务税率',
xtype: 'numberfield',
name: 'AccTaxRate'
}, this.CheckIsAdvancedpay
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: Zi.LAN.FEE.Reason3, //'修改原因',
name: 'Reason'
}, {
fieldLabel: Zi.LAN.FEE.REMARK, //'备注',
name: 'Remark'
}]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
this.OldFee = Ext.widget('form', {
frame: true,
region: 'center',
title: Zi.LAN.FEE.OldFee, //'费用旧值',
trackResetOnLoad: true,
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: Zi.LAN.FEE.BSNO2, //'业务编号',
name: 'BsNo', hidden: true
}, {
fieldLabel: Zi.LAN.FEE.GID, //'GId',,
name: 'GId', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: 'IsOpen', //'GId',,
name: 'IsOpen', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: Zi.LAN.FEE.FeeName3, //'费用名称',
readOnly: true,
name: 'FeeName'
}, {
fieldLabel: Zi.LAN.FEE.CUSTOMERNAME2, //'费用对象',
readOnly: true,
name: 'CustomerName'
}, {
fieldLabel: Zi.LAN.FEE.Unit, //'单位标准',
readOnly: true,
name: 'Unit'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: Zi.LAN.FEE.UnitPrice, //'不含税单价',
readOnly: true,
name: 'UnitPrice',
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 '' + lsValue + '';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}, {
fieldLabel: Zi.LAN.FEE.TaxRate, //'税率',
readOnly: true,
name: 'TaxRate'
}, {
fieldLabel: Zi.LAN.FEE.TaxUnitPrice2, //'含税单价',
readOnly: true,
name: 'TaxUnitPrice',
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 '' + lsValue + '';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: Zi.LAN.FEE.Quantity2, //'计费数量',
readOnly: true,
name: 'Quantity'
}, {
fieldLabel: Zi.LAN.FEE.NoTaxAmount, //'不含税金额',
readOnly: true,
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 '' + lsValue + '';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}, {
fieldLabel: Zi.LAN.FEE.Amount2, //'含税金额',
readOnly: true,
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 '' + lsValue + '';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: Zi.LAN.FEE.Currency, //'币别',
readOnly: true,
name: 'Currency'
}, {
fieldLabel: Zi.LAN.FEE.ExChangerate, //'汇率',
readOnly: true,
name: 'ExChangerate'
}, {
fieldLabel: Zi.LAN.FEE.AccTaxRate3, //'财务税率',
readOnly: true,
name: 'AccTaxRate'
}, {
fieldLabel: Zi.LAN.FEE.IsAdvancedpay, //'是否垫付',
readOnly: true,
name: 'IsAdvancedpay'
}
]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
this.DeleteFee = Ext.widget('form', {
frame: true,
region: 'center',
trackResetOnLoad: true,
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: Zi.LAN.FEE.BSNO2, //'业务编号',
name: 'BsNo', hidden: true
}, {
fieldLabel: Zi.LAN.FEE.GID, //'GId',,
name: 'GId', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: Zi.LAN.FEE.FeeType, //'FeeType',
name: 'FeeType', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: 'IsOpen', //'GId',,
name: 'IsOpen', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: Zi.LAN.FEE.FeeName3, //'费用名称',
name: 'FeeName', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: Zi.LAN.FEE.CUSTOMERNAME2, //'费用对象',
name: 'CustomerName', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: Zi.LAN.FEE.Unit, //'单位标准',
name: 'Unit', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: Zi.LAN.FEE.UnitPrice, //'不含税单价',
name: 'UnitPrice', flex: 0, hidden: true, margins: '0',
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 '' + lsValue + '';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}, {
fieldLabel: Zi.LAN.FEE.TaxRate, //'税率',
name: 'TaxRate', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: Zi.LAN.FEE.TaxUnitPrice2, //'含税单价',
name: 'TaxUnitPrice', flex: 0, hidden: true, margins: '0',
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 '' + lsValue + '';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}, {
fieldLabel: Zi.LAN.FEE.Quantity2, //'计费数量',
name: 'Quantity', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: Zi.LAN.FEE.NoTaxAmount, //'不含税金额',
name: 'NoTaxAmount', flex: 0, hidden: true, margins: '0',
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 '' + lsValue + '';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}, {
fieldLabel: Zi.LAN.FEE.Amount2, //'含税金额',
name: 'Amount', flex: 0, hidden: true, margins: '0',
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 '' + lsValue + '';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}, {
fieldLabel: Zi.LAN.FEE.Currency, //'币别',
name: 'Currency', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: Zi.LAN.FEE.ExChangerate, //'汇率',
name: 'ExChangerate', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: Zi.LAN.FEE.AccTaxRate3, //'财务税率',
name: 'AccTaxRate', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: Zi.LAN.FEE.IsAdvancedpay, //'是否垫付',
name: 'IsAdvancedpay', flex: 0, hidden: true, margins: '0'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [, {
fieldLabel: Zi.LAN.FEE.REMARK, //'备注',
flex: 1,
labelWidth: 40,
readOnly: true,
name: 'Remark'
}, {
fieldLabel: Zi.LAN.FEE.Reason2, //'删除原因',
name: 'Reason'
}
]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
this.NewFeeShowDr = Ext.widget('form', {
frame: true,
region: 'east',
hidden: true,
title: Zi.LAN.FEE.NewFeeShow, //'费用修改新值',
width: 600,
trackResetOnLoad: true,
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: Zi.LAN.FEE.BSNO2, //'业务编号',
name: 'BsNo', hidden: true
}, {
fieldLabel: Zi.LAN.FEE.GID, //'GId',,
name: 'GId', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: Zi.LAN.FEE.FeeName3, //'费用名称',
readOnly: true,
name: 'FeeName'
}, {
fieldLabel: Zi.LAN.FEE.CUSTOMERNAME2, //'费用对象',
readOnly: true,
name: 'CustomerName'
}, {
fieldLabel: Zi.LAN.FEE.Unit, //'单位标准',
readOnly: true,
name: 'Unit'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: Zi.LAN.FEE.UnitPrice, //'不含税单价',
readOnly: true,
name: 'UnitPrice',
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 '' + lsValue + '';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}, {
fieldLabel: Zi.LAN.FEE.TaxRate, //'税率',
readOnly: true,
name: 'TaxRate'
}, {
fieldLabel: Zi.LAN.FEE.TaxUnitPrice2, //'含税单价',
readOnly: true,
name: 'TaxUnitPrice',
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 '' + lsValue + '';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: Zi.LAN.FEE.Quantity2, //'计费数量',
readOnly: true,
name: 'Quantity'
}, {
fieldLabel: Zi.LAN.FEE.NoTaxAmount, //'不含税金额',
readOnly: true,
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 '' + lsValue + '';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}, {
fieldLabel: Zi.LAN.FEE.Amount2, //'含税金额',
readOnly: true,
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 '' + lsValue + '';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: Zi.LAN.FEE.Currency, //'币别',
readOnly: true,
name: 'Currency'
}, {
fieldLabel: Zi.LAN.FEE.ExChangerate, //'汇率',
readOnly: true,
name: 'ExChangerate'
}, {
fieldLabel: Zi.LAN.FEE.AccTaxRate3, //'财务税率',
readOnly: true,
name: 'AccTaxRate'
}, {
fieldLabel: Zi.LAN.FEE.IsAdvancedpay, //'是否垫付',
readOnly: true,
name: 'IsAdvancedpay'
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [, {
fieldLabel: Zi.LAN.FEE.REMARK, //'备注',
flex: 1,
labelWidth: 40,
readOnly: true,
name: 'Remark'
}, {
fieldLabel: Zi.LAN.FEE.Reason3, //'修改原因',
readOnly: true,
name: 'Reason'
}]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
this.NewFeeShowCr = Ext.widget('form', {
frame: true,
region: 'east',
hidden: true,
title: Zi.LAN.FEE.NewFeeShow, //'费用修改新值',
width: 600,
trackResetOnLoad: true,
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: Zi.LAN.FEE.BSNO2, //'业务编号',
name: 'BsNo', hidden: true
}, {
fieldLabel: Zi.LAN.FEE.GID, //'GId',,
name: 'GId', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: Zi.LAN.FEE.FeeName3, //'费用名称',
readOnly: true,
name: 'FeeName'
}, {
fieldLabel: Zi.LAN.FEE.CUSTOMERNAME2, //'费用对象',
readOnly: true,
name: 'CustomerName'
}, {
fieldLabel: Zi.LAN.FEE.Unit, //'单位标准',
readOnly: true,
name: 'Unit'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: Zi.LAN.FEE.UnitPrice, //'不含税单价',
readOnly: true,
name: 'UnitPrice',
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 '' + lsValue + '';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}, {
fieldLabel: Zi.LAN.FEE.TaxRate, //'税率',
readOnly: true,
name: 'TaxRate'
}, {
fieldLabel: Zi.LAN.FEE.TaxUnitPrice2, //'含税单价',
readOnly: true,
name: 'TaxUnitPrice',
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 '' + lsValue + '';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: Zi.LAN.FEE.Quantity2, //'计费数量',
readOnly: true,
name: 'Quantity'
}, {
fieldLabel: Zi.LAN.FEE.NoTaxAmount, //'不含税金额',
readOnly: true,
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 '' + lsValue + '';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}, {
fieldLabel: Zi.LAN.FEE.Amount2, //'含税金额',
readOnly: true,
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 '' + lsValue + '';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: Zi.LAN.FEE.Currency, //'币别',
readOnly: true,
name: 'Currency'
}, {
fieldLabel: Zi.LAN.FEE.ExChangerate, //'汇率',
readOnly: true,
name: 'ExChangerate'
}, {
fieldLabel: Zi.LAN.FEE.AccTaxRate3, //'财务税率',
readOnly: true,
name: 'AccTaxRate'
}, {
fieldLabel: Zi.LAN.FEE.IsAdvancedpay, //'是否垫付',
readOnly: true,
name: 'IsAdvancedpay'
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [, {
fieldLabel: Zi.LAN.FEE.REMARK, //'备注',
flex: 1,
labelWidth: 40,
readOnly: true,
name: 'Remark'
}, {
fieldLabel: Zi.LAN.FEE.Reason3, //'修改原因',
readOnly: true,
name: 'Reason'
}]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
me = this;
this.winShenModifyShow = Ext.create('Ext.window.Window', {
title: Zi.LAN.FEE.winShenModifyShow, //"费用申请修改",
width: 600,
//height : 120,
//plain : true,
iconCls: "addicon",
resizable: false,
// 是否可以拖动
// draggable:false,
collapsible: true, // 允许缩放条
closeAction: 'close',
closable: true,
modal: 'true',
buttonAlign: "center",
bodyStyle: "padding:0 0 0 0",
layout: "anchor",
items: [this.OldFee, this.NewFeeEdit],
buttons: [{
text: Zi.LAN.FEE.TiJiaoShenQing, //"提交申请",
minWidth: 70,
handler: function () {
var form = me.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;
};
var REASON = form.findField('Reason').getValue();
if (REASON == '' || REASON == null || REASON == undefined) {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: Zi.LAN.FEE.XiuGaiYuanYinBuNengWeiKong, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); //修改原因不能为空!
return;
};
var type = form.findField('FeeType').getValue();
me.onCreateModifyClick(type);
}
}, {
text: Zi.LAN.FEE.CancelShen, //"取消申请",
minWidth: 70,
handler: function () {
me.winShenModifyShow.close();
}
}]
});
this.winShenDeleteShow = Ext.create('Ext.window.Window', {
title: Zi.LAN.FEE.winShenDeleteShow, //"费用申请删除",
width: 600,
//height : 120,
//plain : true,
iconCls: "addicon",
resizable: false,
// 是否可以拖动
// draggable:false,
collapsible: true, // 允许缩放条
closeAction: 'close',
closable: true,
modal: 'true',
buttonAlign: "center",
bodyStyle: "padding:0 0 0 0",
layout: "anchor",
items: [this.DeleteFee],
buttons: [{
text: Zi.LAN.FEE.TiJiaoShenQing, //"提交申请",
minWidth: 70,
handler: function () {
var form = me.DeleteFee.getForm();
var REASON = form.findField('Reason').getValue();
if (REASON == '' || REASON == null || REASON == undefined) {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: Zi.LAN.FEE.ShanChuYuanYinBuNengWeiKong, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
var type = form.findField('FeeType').getValue();
me.onCreateDeleteClick(type);
}
}, {
text: Zi.LAN.FEE.CancelShen, //"取消申请",
minWidth: 70,
handler: function () {
me.winShenDeleteShow.close();
}
}]
});
//#endregion
this.formtotal = Ext.widget('form', {
title: Zi.LAN.FEE.LiRunSum, //"利润合计",
region: 'south',
collapsed: true,
collapsible: true,
split: true,
enableTabScroll: true,
height: 120,
items: [this.gridSum]
});
this.panelAmend = new Ext.Panel({
title: Zi.LAN.FEE.panelAmend, //'更改单信息',
layout: "border",
region: 'north',
height: 160,
frame: true,
split: true,
items: [this.gridAmendList]
});
this.AuditBackReasonDr = Ext.widget('form', {
frame: true,
region: 'east',
trackResetOnLoad: true,
hidden: true,
width: 300,
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: [{
xtype: 'textareafield',
grow: true,
fieldLabel: Zi.LAN.FEE.Reason4, //'驳回原因',
height: 70,
name: 'Reason',
anchor: '100%'
}
]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
this.AuditBackReasonCr = Ext.widget('form', {
frame: true,
region: 'east',
trackResetOnLoad: true,
hidden: true,
width: 300,
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: [{
xtype: 'textareafield',
grow: true,
fieldLabel: Zi.LAN.FEE.Reason4, //'驳回原因',
height: 70,
name: 'Reason',
anchor: '100%'
}
]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
this.panelDrChFee = new Ext.Panel({
title: Zi.LAN.FEE.DRFEESTATUS, //'应收费用',
layout: "border",
anchor: '100% 50%',
frame: true,
split: true,
items: [this.gridDrChFee, this.NewFeeShowDr, this.AuditBackReasonDr]
});
this.panelCrChFee = new Ext.Panel({
title: Zi.LAN.FEE.CRFEESTATUS, //'应付费用',
layout: "border",
anchor: '100% 50%',
// region: 'center',
frame: true,
items: [this.gridCrChFee, this.NewFeeShowCr, this.AuditBackReasonCr]
});
this.panelFee = new Ext.Panel({
title: Zi.LAN.FEE.GengGaiDanFeiYongMingXi, //'更改单费用明细',
frame: true,
split: true, // layout: "border",
layout: "anchor",
// region: 'north',
// height: 560,
region: 'center',
items: [
this.panelDrChFee, this.panelCrChFee
]
});
//#region 布局
Ext.apply(this, {
items: [this.panelAmend, this.panelFee, this.formtotal]
});
//#endregion
this.opStatus = 'add';
/*
parentWin = window.parent.opener;
{
if (parentWin) {
var ret = parentWin.OprationSwap();
var fun = ret[4];
}
}
*/
this.InitData();
_thisAmendfee = this;
this.gridAmendList.getSelectionModel().on('select', function (model, record, index) {
if (this.selectbill == 1) return;
if (record != null) {
this.AmendFeeStatus = record.data.FEESTATUS;
this.strAmendBSNO = record.data.BSNO;
var bsno = record.data.BSNO;
this.storeDrChFee.load({ params: { billno: bsno, type: 1, optype: this.stroplb} });
this.storeCrChFee.load({ params: { billno: bsno, type: 2, optype: this.stroplb} });
this.storeBodySum.load({ params: { bsno: bsno, optype: this.stroplb },
callback: function (r, options, success) {
if (success) {
_thisAmendfee.setTotalHead();
}
}
});
this.StoreDateCurr.load({ params: { optype: this.stroplb, bsno: bsno} });
}
}, this);
_thisAmendfee = this;
this.gridDrChFee.getSelectionModel().on('select', function (model, record, index) {
var FeeStatus = record.data.FeeStatus;
var GId = record.data.GId;
if (FeeStatus == 3) {
this.NewFeeShowDr.setVisible(true);
this.storeChFeeModify.load({ params: { FeeID: GId, ApplyType: 2 },
callback: function (r, options, success) {
if (success) {
_thisAmendfee.NewFeeShowDr.getForm().loadRecord(_thisAmendfee.storeChFeeModify.getAt(0));
}
},
scope: this
});
} else {
this.NewFeeShowDr.setVisible(false);
}
if (FeeStatus == 6) {
var reason = this.AuditBackReasonDr.getForm().findField('Reason').setValue(record.data.Reason);
this.AuditBackReasonDr.setVisible(true);
} else {
this.AuditBackReasonDr.setVisible(false);
}
}, this);
this.gridCrChFee.getSelectionModel().on('select', function (model, record, index) {
var FeeStatus = record.data.FeeStatus;
var GId = record.data.GId;
if (FeeStatus == 3) {
this.NewFeeShowCr.setVisible(true);
this.storeChFeeModify.load({ params: { FeeID: GId, ApplyType: 2 },
callback: function (r, options, success) {
if (success) {
_thisAmendfee.NewFeeShowCr.getForm().loadRecord(_thisAmendfee.storeChFeeModify.getAt(0));
}
},
scope: this
});
} else {
this.NewFeeShowCr.setVisible(false);
}
if (FeeStatus == 6) {
var reason = this.AuditBackReasonCr.getForm().findField('Reason').setValue(record.data.Reason);
this.AuditBackReasonCr.setVisible(true);
} else {
this.AuditBackReasonCr.setVisible(false);
}
}, this);
this.gridDrChFee.on({
selectionchange: function (sm, selections) {
if (selections.length == 0) {
} else {
var rec = selections[0];
var custname = rec.data.CustomerName;
var recordCustCode = Ext.create('DsShipping.ux.CustomRefModel', {
GId: NewGuid(),
CustCode: custname,
CustName: custname,
CodeAndName: custname,
DESCRIPTION: custname
});
_thisAmendfee.storeCustomerNameRef.add(recordCustCode);
}
}
});
this.gridCrChFee.on({
selectionchange: function (sm, selections) {
if (selections.length == 0) {
} else {
var rec = selections[0];
var custname = rec.data.CustomerName;
var recordCustCode = Ext.create('DsShipping.ux.CustomRefModel', {
GId: NewGuid(),
CustCode: custname,
CustName: custname,
CodeAndName: custname,
DESCRIPTION: custname
});
_thisAmendfee.storeCustomerNameRefCr.add(recordCustCode);
}
}
});
this.LoadPeriod();
Ext.Ajax.request({
waitMsg: '',
url: '/MvcShipping/MsSysParamSet/GetData',
params: {
condition: "PARAMNAME='AMENDSELFWORKFLOW'"
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (result.Success != true) {
} else {
var data = result.data;
if (data.PARAMVALUE == '1') {
this.AMENDSELFWORKFLOW = 1;
} else {
}
}
} else {
}
},
scope: this
});
Ext.Ajax.request({
waitMsg: '',
url: '/MvcShipping/MsSysParamSet/GetData',
params: {
condition: "PARAMNAME='ADDAMENDNOTFEECLOSE'"
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (result.Success != true) {
} else {
var data = result.data;
if (data.PARAMVALUE == '1') {
this.ADDAMENDNOTFEECLOSE = 1;
} else {
}
}
} else {
}
},
scope: this
});
Ext.Ajax.request({
waitMsg: '',
url: '/MvcShipping/MsSysParamSet/GetData',
params: {
condition: "PARAMNAME='FEEMANGERMUSTBE'"
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (result.Success != true) {
} else {
var data = result.data;
if (data.PARAMVALUE == '1') {
this.FEEMANGERMUSTBE = 1;
} else {
}
}
} else {
}
},
scope: this
});
Ext.Ajax.request({
waitMsg: '',
url: '/MvcShipping/MsSysParamSet/GetData',
params: {
condition: "PARAMNAME='ACCTAXRATESAMETAXRATE'"
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (result.Success != true) {
} else {
var data = result.data;
if (data.PARAMVALUE == '1') {
this.ACCTAXRATESAMETAXRATE = 1;
} else {
}
}
} else {
}
},
scope: this
});
Ext.Ajax.request({
waitMsg: '',
url: '/MvcShipping/MsSysParamSet/GetData',
params: {
condition: "PARAMNAME='FEELOCKNOTPR'"
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (result.Success != true) {
} else {
var data = result.data;
if (data.PARAMVALUE == '1') {
this.FEELOCKNOTPR = 1;
} else {
}
}
} else {
}
},
scope: this
});
Ext.Ajax.request({
waitMsg: '',
url: '/MvcShipping/MsSysParamSet/GetData',
params: {
condition: "PARAMNAME='AMENDSALENOTEDIT'"
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (result.Success != true) {
} else {
var data = result.data;
if (data.PARAMVALUE == '1') {
this.AmendSalenotedit = 1;
} else {
}
}
} else {
}
},
scope: this
});
this.storeDefValue = Ext.create('Ext.data.Store', {
model: 'DsShipping.ux.OpDefValue',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsCodeOpDef/GetDataList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.storeDefValue.load({ params: { condition: "BSTYPE='费用信息'" } });
}, //end initUIComponents
//#region 加载数据
InitData: function () {
var condition = '';
/*
if (this.ParentPanel) {
var ret = this.ParentPanel.OprationSwap();
this.opStatus = ret[0];
this.StoreList = ret[1];
this.editRecord = ret[2];
this.RefBillNo = ret[3];
}
*/
this.LoadData(this.opStatus, condition, this.RefBillNo);
}, //end InitData
LoadData: function (opstatus, condition, refbillno) {
this.feeCrSerialNo = 0;
this.feeCrBodyDel = [];
this.feeCrSerialNo = 0;
this.feeCrBodyDel = [];
this.opStatus = opstatus;
/*
this.storeDrChFee.load({ params: { billno: this.gid, type: 1} });
this.storeCrChFee.load({ params: { billno: this.gid, type: 2} });
this.storeChFeeGain.load({ params: { bsno: this.gid },
callback: function (r, options, success) {
if (success) {
this.formtotal.getForm().loadRecord(this.storeChFeeGain.getAt(0));
}
},
scope: this
});
*/
}, // end LoadDate
LoadPeriod: function () {
Ext.Ajax.request({
waitMsg: Zi.LAN.FEE.ZhengZaiChaXunShuJu, //'正在查询主表数据...',
url: '/Account/ChMonthClose/GetNowPeriod',
params: {
condition: ''
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
return;
}
data = result.data;
this.MsPeriod = data;
this.ACCDATEEDIT.setMinValue(data.PERIOD)
} else {
Ext.MessageBox.alert(Zi.LAN.FEE.FuWuQiXiangYingChuCuo, response.responseText); //请求出现错误,请重试
}
},
scope: this
});
},
InitDrGrid: function (grid) {
_thisAmendfee = this;
var agirdcolums = grid;
Ext.Ajax.request({
waitMsg: '',
url: '/MvcShipping/MsSysParamSet/GetFeeParam',
params: {
condition: "PARAMNAME='Feenotopen'"
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (result.Success != true) {
_thisAmendfee.gridDrChFee.reconfigure(_thisAmendfee.storeDrChFee, agirdcolums);
} else {
var data = result.data;
for (var j = 0; j < agirdcolums.length; j++) {
if (agirdcolums[j].dataIndex == 'IsOpen') {
if (data.Feenotopen)
agirdcolums[j].hidden = false;
else agirdcolums[j].hidden = false;
}
if (agirdcolums[j].dataIndex == 'ExChangerate') {
if (data.EXCHANGERATEISREADONLY)
agirdcolums[j].editor = null;
}
}
_thisAmendfee.gridDrChFee.reconfigure(_thisAmendfee.storeDrChFee, agirdcolums);
}
} else {
_thisAmendfee.gridDrChFee.reconfigure(_thisAmendfee.storeDrChFee, agirdcolums);
}
},
scope: this
});
},
InitCrGrid: function (grid) {
_thisAmendfee = this;
var agirdcolums = grid;
// this.gridCrChFee.reconfigure(this.storeCrChFee, agirdcolums);
Ext.Ajax.request({
waitMsg: '',
url: '/MvcShipping/MsSysParamSet/GetFeeParam',
params: {
condition: "PARAMNAME='Feenotopen'"
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (result.Success != true) {
_thisAmendfee.gridCrChFee.reconfigure(_thisAmendfee.storeCrChFee, agirdcolums);
} else {
var data = result.data;
for (var j = 0; j < agirdcolums.length; j++) {
if (agirdcolums[j].dataIndex == 'IsOpen') {
if (data.Feenotopen)
agirdcolums[j].hidden = false;
else agirdcolums[j].hidden = false;
}
if (agirdcolums[j].dataIndex == 'ExChangerate') {
if (data.EXCHANGERATEISREADONLY)
agirdcolums[j].editor = null;
}
}
_thisAmendfee.gridCrChFee.reconfigure(_thisAmendfee.storeCrChFee, agirdcolums);
}
} else {
_thisAmendfee.gridCrChFee.reconfigure(_thisAmendfee.storeCrChFee, agirdcolums);
}
},
scope: this
});
},
//#endregion
//#region 明细操作
onNextKeyClick: function (type, col) {
if (type == 1) {
var rows = this.gridDrChFee.getSelectionModel().getSelection();
var row = rows[rows.length - 1];
var s = this.gridDrChFee.getStore();
var number = s.indexOf(row) + 1;
if (number == this.gridDrChFee.getStore().getCount()) {
this.onAddDetailClick(s, event, type);
} else {
this.cellEditingDrChFee.startEditByPosition({ row: number, column: col });
}
} else {
var rows = this.gridCrChFee.getSelectionModel().getSelection();
var row = rows[rows.length - 1];
var s = this.gridCrChFee.getStore();
var number = s.indexOf(row) + 1;
if (number == this.gridCrChFee.getStore().getCount()) {
this.onAddDetailClick(s, event, type);
} else {
this.cellEditingCrChFee.startEditByPosition({ row: number, column: col });
}
}
},
onAddDetailClick: function (button, event, type) {
if (this.storeAmendBill.getCount() == 0) {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: Zi.LAN.FEE.QingTianJiaBingBaoCunGengGaiDan, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); //请添加并保存更改单,然后再添加费用明细!
return;
}
var selections = this.gridAmendList.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: Zi.LAN.FEE.QingXianXuanZeGengGaiDan, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); //请先选择要添加费用的更改单!
return;
}
if (this.isCancel == '1' || this.isCancel == '2') {
Ext.Msg.show({ title: Zi.LAN.FEE.ChuoWu, msg: "此票业务已退舱或申请退舱,不能添加更改单!", icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return false;
}
var record = selections[0];
this.AmendFeeStatus = record.data.FEESTATUS;
this.strAmendBSNO = record.data.BSNO;
var allow = this.getAllowOperationDetail();
if (allow == false) {
return;
}
var store = null;
if (type == 1) {
store = this.storeDrChFee;
} else if (type == 2) {
store = this.storeCrChFee;
} else {
alert(Zi.LAN.FEE.HanShuCanShuSheZhiBuDui);
return;
}
var custtype = '';
if (type == 1)
custtype = '委托单位'
else
custtype = '订舱代理'
var records = DsStoreQueryBy(this.StoreCustType, 'CUSTTYPE', custtype);
if (records.getCount() > 0) {
var data = records.getAt(0).data;
var custname = this.EditRecord.get(data.CUSTNAME);
} else {
var custname = '';
}
var MANAGER = '';
var MANAGERREF = '';
if (store.getCount() > 0) {
var memberbody = store.getAt(store.getCount() - 1);
MANAGER = memberbody.data.MANAGER;
MANAGERREF = memberbody.data.MANAGERREF;
}
if (MANAGER == '') {
var SALE = this.EditRecord.get('SALE');
if (SALE != undefined && SALE != NaN && SALE != '') {
var records = DsStoreQueryBy(this.storeManagerModify, 'UserName', SALE);
if (records.getCount() > 0) {
var data = records.getAt(0).data;
MANAGER = data.GID;
MANAGERREF = SALE;
} else {
MANAGER = '';
MANAGERREF = '';
}
}
}
var newSerialno = this.GetHandleSerialNo(store, type);
var newsort = store.getCount() + 1;
var record = null;
record = Ext.create('MsChFee', {
GId: NewGuid(),
BsNo: '*',
FeeStatus: 1,
FeeStatus_Ref: '录入状态',
FeeType: type,
FeeName: '',
FeeDescription: '',
CustomerType: custtype,
CustomerName: custname,
Unit: '',
UnitPrice: 0,
Quantity: 1,
TaxRate: 0,
NoTaxAmount: 0,
Amount: 0,
AccTaxRate: 0,
Currency: 'RMB',
ExChangerate: 1,
Reason: '',
Remark: '',
Commissionrate: 0,
Settlement: 0,
Invoice: 0,
OrderAmount: 0,
OrderInvoice: 0,
SubmitDate: null,
Auditoperator: '',
AuditDate: null,
EnteroPerator: GetCookie_UserId(),
EnterDate: null,
DebitNo: '',
IsDebit: "0",
IsOpen: "0",
ISACC: "0",
IsAdvancedpay: "false",
Sort: newsort,
IsInvoice: "0",
FeeFrt: '',
IsCrmOrderFee: "0",
AuditStatus: 0,
InvoiceNum: '',
ChequeNum: '',
LOCALCURR: LOCALCURR,
WmsOutBsNo: '',
MANAGER: MANAGER,
MANAGERREF: MANAGERREF
});
if (this.storeDefValue.getCount() > 0) {
for (var j = 0; j < this.storeDefValue.getCount(); j += 1) {
var member = this.storeDefValue.getAt(j);
record.set(member.data.FIELDNAME, member.data.DEFVALUE);
};
};
store.add(record);
var editColumnIndex = 0;
var cellediting = null;
if (type == 1) {
cellediting = this.cellEditingDrChFee;
editColumnIndex = 4;
} else if (type == 2) {
cellediting = this.cellEditingCrChFee;
editColumnIndex = 4;
}
var n = store.getCount();
cellediting.startEditByPosition({ row: n - 1, column: editColumnIndex });
},
onAddSelectDetailClick: function (button, event, type) {
if (this.storeAmendBill.getCount() == 0) {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: Zi.LAN.FEE.QingTianJiaBingBaoCunGengGaiDan, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var selections = this.gridAmendList.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: Zi.LAN.FEE.QingXianXuanZeYaoTianJiaFeiYongDeGengGaiDan, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); //请先选择要添加费用的更改单!
return;
}
var record = selections[0];
this.AmendFeeStatus = record.data.FEESTATUS;
this.strAmendBSNO = record.data.BSNO;
var allow = this.getAllowOperationDetail();
if (allow == false) {
return;
}
var selectedRecords = [];
var storeadd = null;
if (type == 2) {
selectedRecords = this.feeDrGridCheckBoxModel.selected.items;
storeadd = this.storeCrChFee;
} else if (type == 1) {
selectedRecords = this.feeCrGridCheckBoxModel.selected.items;
storeadd = this.storeDrChFee;
} else {
alert(Zi.LAN.FEE.HanShuCanShuSheZhiBuDui);
return;
}
if (selectedRecords.length == 0) {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: Zi.LAN.FEE.QingXianXuanZeFeiYong, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); //请先选择要删除的费用!
return;
}
var MANAGER = '';
var MANAGERREF = '';
if (storeadd.getCount() > 0) {
var memberbody = storeadd.getAt(storeadd.getCount() - 1);
MANAGER = memberbody.data.MANAGER;
MANAGERREF = memberbody.data.MANAGERREF;
}
for (var i = 0; i < selectedRecords.length; i++) {
var memberyf = selectedRecords[i];
var custtype = '';
if (type == 1)
custtype = '委托单位'
else
custtype = '订舱代理'
var records = DsStoreQueryBy(this.StoreCustType, 'CUSTTYPE', custtype);
if (records.getCount() > 0) {
var data = records.getAt(0).data;
var custname = this.EditRecord.get(data.CUSTNAME);
} else {
var custname = '';
}
var newSerialno = this.GetHandleSerialNo(storeadd, type);
var newsort = storeadd.getCount() + 1;
var record = null;
record = Ext.create('MsChFee', {
GId: NewGuid(),
BsNo: '*',
FeeStatus: 1,
FeeStatus_Ref: '录入状态',
FeeType: type,
FeeName: memberyf.data.FeeName,
FeeDescription: memberyf.data.FeeDescription,
CustomerType: custtype,
CustomerName: custname,
Unit: memberyf.data.Unit,
UnitPrice: memberyf.data.UnitPrice,
Quantity: memberyf.data.Quantity,
TaxRate: memberyf.data.TaxRate,
NoTaxAmount: memberyf.data.NoTaxAmount,
Amount: memberyf.data.Amount,
AccTaxRate: memberyf.data.AccTaxRate,
Currency: memberyf.data.Currency,
ExChangerate: memberyf.data.ExChangerate,
Reason: '',
Remark: '',
Commissionrate: memberyf.data.Commissionrate,
Settlement: 0,
Invoice: 0,
OrderAmount: 0,
OrderInvoice: 0,
SubmitDate: null,
Auditoperator: '',
AuditDate: null,
EnteroPerator: GetCookie_UserId(),
EnterDate: null,
DebitNo: '',
IsDebit: "0",
IsOpen: "0",
ISACC: "0",
IsAdvancedpay: "false",
Sort: newsort,
IsInvoice: "0",
FeeFrt: memberyf.data.FeeFrt,
IsCrmOrderFee: "0",
AuditStatus: 0,
InvoiceNum: '',
ChequeNum: '',
LOCALCURR: LOCALCURR,
WmsOutBsNo: '',
MANAGER: MANAGER,
SALECORP: memberyf.data.SALECORP,
MANAGERREF: MANAGERREF
});
storeadd.add(record);
};
var editColumnIndex = 0;
var cellediting = null;
if (type == 2) {
cellediting = this.cellEditingDrChFee;
editColumnIndex = 4;
} else if (type == 1) {
cellediting = this.cellEditingCrChFee;
editColumnIndex = 4;
}
var n = storeadd.getCount();
cellediting.startEditByPosition({ row: n - 1, column: editColumnIndex });
this.calcDetailTotal();
},
onAddAllDetailClick: function (button, event, type) {
if (this.storeAmendBill.getCount() == 0) {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: Zi.LAN.FEE.QingTianJiaBingBaoCunGengGaiDan, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var selections = this.gridAmendList.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: Zi.LAN.FEE.QingXianXuanZeYaoTianJiaFeiYongDeGengGaiDan, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var record = selections[0];
this.AmendFeeStatus = record.data.FEESTATUS;
this.strAmendBSNO = record.data.BSNO;
var allow = this.getAllowOperationDetail();
if (allow == false) {
return;
}
var store = null;
var storeadd = null;
if (type == 2) {
store = this.storeDrChFee;
storeadd = this.storeCrChFee;
} else if (type == 1) {
store = this.storeCrChFee;
storeadd = this.storeDrChFee;
} else {
alert(Zi.LAN.FEE.HanShuCanShuSheZhiBuDui);
return;
}
var MANAGER = '';
var MANAGERREF = '';
if (storeadd.getCount() > 0) {
var memberbody = storeadd.getAt(storeadd.getCount() - 1);
MANAGER = memberbody.data.MANAGER;
MANAGERREF = memberbody.data.MANAGERREF;
}
for (i = 0; i < store.getCount(); i += 1) {
var memberyf = store.getAt(i);
var custtype = '';
if (type == 1)
custtype = '委托单位'
else
custtype = '订舱代理'
var records = DsStoreQueryBy(this.StoreCustType, 'CUSTTYPE', custtype);
if (records.getCount() > 0) {
var data = records.getAt(0).data;
var custname = this.EditRecord.get(data.CUSTNAME);
} else {
var custname = '';
}
var newSerialno = this.GetHandleSerialNo(storeadd, type);
var newsort = storeadd.getCount() + 1;
var record = null;
record = Ext.create('MsChFee', {
GId: NewGuid(),
BsNo: '*',
FeeStatus: 1,
FeeStatus_Ref: '录入状态',
FeeType: type,
FeeName: memberyf.data.FeeName,
FeeDescription: memberyf.data.FeeDescription,
CustomerType: custtype,
CustomerName: custname,
Unit: memberyf.data.Unit,
UnitPrice: memberyf.data.UnitPrice,
Quantity: memberyf.data.Quantity,
TaxRate: memberyf.data.TaxRate,
NoTaxAmount: memberyf.data.NoTaxAmount,
Amount: memberyf.data.Amount,
AccTaxRate: memberyf.data.AccTaxRate,
Currency: memberyf.data.Currency,
ExChangerate: memberyf.data.ExChangerate,
Reason: '',
Remark: '',
Commissionrate: memberyf.data.Commissionrate,
Settlement: 0,
Invoice: 0,
OrderAmount: 0,
OrderInvoice: 0,
SubmitDate: null,
Auditoperator: '',
AuditDate: null,
EnteroPerator: GetCookie_UserId(),
EnterDate: null,
DebitNo: '',
IsDebit: "0",
IsOpen: "0",
ISACC: "0",
IsAdvancedpay: "false",
Sort: newsort,
IsInvoice: "0",
FeeFrt: memberyf.data.FeeFrt,
IsCrmOrderFee: "0",
AuditStatus: 0,
InvoiceNum: '',
ChequeNum: '',
LOCALCURR: LOCALCURR,
WmsOutBsNo: '',
MANAGER: MANAGER,
SALECORP: memberyf.data.SALECORP,
MANAGERREF: MANAGERREF
});
storeadd.add(record);
};
var editColumnIndex = 0;
var cellediting = null;
if (type == 2) {
cellediting = this.cellEditingDrChFee;
editColumnIndex = 4;
} else if (type == 1) {
cellediting = this.cellEditingCrChFee;
editColumnIndex = 4;
}
var n = storeadd.getCount();
cellediting.startEditByPosition({ row: n - 1, column: editColumnIndex });
this.calcDetailTotal();
},
onHistryAddDetailClick: function (menu, event, type) {
if (this.storeAmendBill.getCount() == 0) {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: Zi.LAN.FEE.QingTianJiaBingBaoCunGengGaiDan, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var selections = this.gridAmendList.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: Zi.LAN.FEE.QingXianXuanZeYaoTianJiaFeiYongDeGengGaiDan, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var record = selections[0];
this.AmendFeeStatus = record.data.FEESTATUS;
this.strAmendBSNO = record.data.BSNO;
var allow = this.getAllowOperationDetail();
if (allow == false) {
return;
}
this.feeType = type;
var store = null;
if (type == 1) {
store = this.storeDrChFee;
} else if (type == 2) {
store = this.storeCrChFee;
} else {
alert(Zi.LAN.FEE.HanShuCanShuSheZhiBuDui);
return;
}
if (this.stroplb == 'op_Seae' || _thisAmendfee.stroplb == 'op_SeaeOrder') {
DsOpenEditWin("/MvcShipping/MsOpSeae/HistryFeeIndex", "历史引入费用");
} else if (this.stroplb == 'op_Apply') {
DsOpenEditWin("/MvcShipping/MsOpApply/HistryFeeIndex", "历史引入费用");
} else if (this.stroplb == 'op_Seai') {
DsOpenEditWin("/MvcShipping/MsOpSeai/HistryFeeIndex", "历史引入费用");
} else if (this.stroplb == 'op_Bulk') {
DsOpenEditWin("/MvcShipping/MsOpBulk/HistryFeeIndex", "历史引入费用");
} else if (this.stroplb == 'op_other') {
DsOpenEditWin("/MvcShipping/MsOpOther/HistryFeeIndex", "历史引入费用");
} else if (this.stroplb == 'op_railway') {
DsOpenEditWin("/MvcShipping/MsOpRailway/HistryFeeIndex", "历史引入费用");
} else if (this.stroplb == 'op_Aire') {
DsOpenEditWin("/MvcShipping/MsOpAire/HistryFeeIndex", "历史引入费用");
} else if (this.stroplb == 'op_Airi') {
DsOpenEditWin("/MvcShipping/MsOpAiri/HistryFeeIndex", "历史引入费用");
} else if (this.stroplb == 'import_main') {
DsOpenEditWin("/Import/XXH/HistryFeeIndex", "历史引入费用");
} else {
DsOpenEditWin("/MvcShipping/MsChFee/HistryIndex", "历史引入费用");
}
},
onTemplateAddDetailClick: function (menu, event, type) {
if (this.storeAmendBill.getCount() == 0) {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: Zi.LAN.FEE.QingTianJiaBingBaoCunGengGaiDan, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var selections = this.gridAmendList.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: Zi.LAN.FEE.QingXianXuanZeYaoTianJiaFeiYongDeGengGaiDan, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var record = selections[0];
this.AmendFeeStatus = record.data.FEESTATUS;
this.strAmendBSNO = record.data.BSNO;
var allow = this.getAllowOperationDetail();
if (allow == false) {
return;
}
this.feeType = type;
var store = null;
if (type == 1) {
store = this.storeDrChFee;
} else if (type == 2) {
store = this.storeCrChFee;
} else {
alert(Zi.LAN.FEE.HanShuCanShuSheZhiBuDui);
return;
}
// if (this.stroplb == 'op_Seae') {
DsOpenEditWin("/MvcShipping/MsFeeTemplate/AddFeeIndex", "模板引入费用");
// }
this.calcDetailTotal();
},
onCtnTkAddDetailClick: function (menu, event, type) {
if (this.storeAmendBill.getCount() == 0) {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: Zi.LAN.FEE.QingTianJiaBingBaoCunGengGaiDan, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var selections = this.gridAmendList.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: Zi.LAN.FEE.QingXianXuanZeYaoTianJiaFeiYongDeGengGaiDan, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var allow = this.getAllowOperationDetail();
if (allow == false) {
return;
}
this.onPostDetailClick(menu, event, type);
this.feeType = type;
var store = null;
if (type == 1) {
store = this.storeDrChFee;
} else if (type == 2) {
store = this.storeCrChFee;
} else {
alert(Zi.LAN.FEE.HanShuCanShuSheZhiBuDui);
return;
}
DsOpenEditWin("/MvcContainer/MsOpCtnBsCard/CtnStatusFee", "引入罐箱费用");
},
onCancelDetailClick: function (menu, event, type) {
var store = null;
if (type == 1) {
store = this.storeDrChFee;
} else if (type == 2) {
store = this.storeCrChFee;
} else {
alert(Zi.LAN.FEE.HanShuCanShuSheZhiBuDui2);
return;
}
for (var i = 0; i < store.getCount(); i += 1) {
var member = store.getAt(i);
member.reject();
}
this.calcDetailTotal();
},
GetHandleSerialNo: function (store, type) {
var result = 0;
if (result == 0) {
for (var i = 0; i < store.getCount(); i += 1) {
var member = store.getAt(i);
if (parseInt(member.data.Sort) > parseInt(result)) {
result = member.data.Sort;
}
}
}
result = parseInt(result) + 1;
if (type == 1) {
this.fixSerialNo = result;
} else if (type == 2) {
this.feeSerialNo = result;
}
return result;
},
onDelDetailClick: function (button, event, type) {
var allow = this.getAllowOperationDetail();
if (allow == false) {
return;
}
var feeGidSql = '';
var selectedRecords = [];
if (type == '1') {
selectedRecords = this.feeDrGridCheckBoxModel.selected.items;
var candelete = this.CheckChFeeDelete(selectedRecords, 1);
if (candelete == false)
return;
} else if (type == '2') {
selectedRecords = this.feeCrGridCheckBoxModel.selected.items;
var candelete = this.CheckChFeeDelete(selectedRecords, 2);
if (candelete == false)
return;
}
if (selectedRecords.length == 0) {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: Zi.LAN.FEE.QingXianXuanZeFeiYong, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
Ext.MessageBox.confirm(Zi.LAN.FEE.TiShi, '确定要删除选中的费用吗?', function (btn) {
if (btn == 'yes') {
if (selectedRecords.length > 0) {
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (rec.data.BsNo == "*") //如果是新增但没有保存的数据,没有必要提交到后台
{
if (type == '1') {
this.storeDrChFee.remove(selectedRecords[i]);
} else if (type == '2') {
this.storeCrChFee.remove(selectedRecords[i]);
}
} else {
var feeGId = "'" + rec.data.GId + "'";
if (feeGidSql == '') {
feeGidSql = feeGId;
} else {
feeGidSql = feeGidSql + "," + feeGId;
}
}
}
}
_thisAmendfee = this;
Ext.Msg.wait(Zi.LAN.FEE.ZhengZaiCaoZuoShuJu);
if (feeGidSql != '') {
Ext.Ajax.request({
waitMsg: Zi.LAN.FEE.ZhengZaiCaoZuoShuJu, //'正在删除数据...',
url: '/MvcShipping/MsChFee/Delete',
params: {
bsno: _thisAmendfee.strAmendBSNO,
data: feeGidSql
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
for (var i = 0; i < selectedRecords.length; i++) {
if (type == '1') {
this.storeDrChFee.remove(selectedRecords[i]);
} else if (type == '2') {
this.storeCrChFee.remove(selectedRecords[i]);
}
}
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
else {
Ext.Msg.show({ title: Zi.LAN.FEE.ChuoWu, msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
}
},
failure: function (response, options) {
Ext.Msg.show({ title: Zi.LAN.FEE.JingGao, msg: Zi.LAN.FEE.FuWuQiXiangYingChuCuo, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
},
success: function (response, options) {
},
scope: this
}); //end Ext.Ajax.request
} else {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: "删除成功!", icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
}
}, this);
this.calcDetailTotal();
},
CheckChFeeDelete: function (records, type) {
var canDelete = true;
for (var i = 0; i < records.length; i++) {
var rec = records[i];
var feeStatus = rec.data.FeeStatus;
if (feeStatus != 1 && feeStatus != 6) canDelete = false;
if (canDelete == false) {
Ext.Msg.show({
title: Zi.LAN.FEE.TiShi,
msg: Zi.LAN.FEE.ZiNengShanChuFuHeTiaoJianDeFeiYong, //'只能删除费用状态为[录入状态]和[驳回提交]的费用,请重新选择',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
if (canDelete) {
var op = rec.data.EnteroPerator;
var opname = rec.data.OpName;
if (type == 1) {
var recop = DsStoreQueryBy(this.StoreDrOpRange, 'OPID', op);
if (recop.getCount() > 0) {
} else {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: '你没有权限删除' + opname + '录入的费用!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
canDelete = false;
}
} else if (type == 2) {
var recop = DsStoreQueryBy(this.StoreCrOpRange, 'OPID', op);
if (recop.getCount() > 0) {
} else {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: '你没有权限删除' + opname + '录入的费用!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
canDelete = false;
}
}
if (canDelete) {
if (rec.data.Invoice != 0) {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: Zi.LAN.FEE.DangQianFeiYongYiKaiChuFaPiaoWuFaShanChu, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });//当前费用已开出发票无法删除!'
canDelete = false;
}
}
if (canDelete) {
if (rec.data.OrderAmount != 0) {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: Zi.LAN.FEE.DangQianFeiYongYiShenQingFeiYongWuFaShanChu, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });//当前费用已申请费用无法删除!'
canDelete = false;
}
}
if (canDelete) {
if (rec.data.OrderInvoice != 0) {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: Zi.LAN.FEE.DangQianFeiYongYiShenQingKaiPiaoWuFaShanChu, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });//当前费用已申请开票无法删除!'
canDelete = false;
}
}
if (canDelete) {
if (rec.data.IsDebit == 'True' || rec.data.IsDebit == '1') {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: Zi.LAN.FEE.DangQianFeiYongYiDuiZhangWuFaShanChu, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });//当前费用已対帐无法删除!'
canDelete = false;
}
}
}
}
return canDelete;
},
onPostDetailClick: function (button, event, type) {
var bodyDrChFeeDatas = [];
var i;
if (type == '1') {
for (i = 0; i < this.storeDrChFee.getCount(); i += 1) {
var memberyf = this.storeDrChFee.getAt(i);
if (_thisAmendfee.stroplb == 'op_SeaeOrder')
memberyf.data.IsCrmOrderFee = '1';
bodyDrChFeeDatas.push(memberyf);
var ExChangerate = memberyf.data.ExChangerate;
var amount = memberyf.data.Amount;
if (amount == 0) {
Ext.Msg.show({ title: Zi.LAN.FEE.JingGao,
msg: Zi.LAN.FEE.FeiYongJinEBuYunXuWeiLing, //'费用的金额不允许为0,请修改后再保存',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
return;
}
if (ExChangerate == 0) {
Ext.Msg.show({ title: Zi.LAN.FEE.JingGao,
msg: Zi.LAN.FEE.HuiLvBuNengWeiLing, //'汇率不允许为0,请修改后再保存',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
return;
}
};
var jsonChFeeBody = ConvertFeeRecordsToJson(bodyDrChFeeDatas);
} else if (type == '2') {
for (i = 0; i < this.storeCrChFee.getCount(); i += 1) {
var memberyf = this.storeCrChFee.getAt(i);
if (_thisAmendfee.stroplb == 'op_SeaeOrder')
memberyf.data.IsCrmOrderFee = '1';
bodyDrChFeeDatas.push(memberyf);
var amount = memberyf.data.Amount;
var ExChangerate = memberyf.data.ExChangerate;
if (amount == 0) {
Ext.Msg.show({ title: Zi.LAN.FEE.JingGao,
msg: Zi.LAN.FEE.FeiYongJinEBuYunXuWeiLing, //'费用的金额不允许为0,请修改后再保存',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
return;
}
if (ExChangerate == 0) {
Ext.Msg.show({ title: Zi.LAN.FEE.JingGao,
msg: Zi.LAN.FEE.HuiLvBuNengWeiLing, //'汇率不允许为0,请修改后再保存',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
return;
}
};
var jsonChFeeBody = ConvertFeeRecordsToJson(bodyDrChFeeDatas);
};
_thisAmendfee = this;
Ext.Msg.wait(Zi.LAN.FEE.ZhengZaiCaoZuoShuJu);
Ext.Ajax.request({
waitMsg: Zi.LAN.FEE.ZhengZaiCaoZuoShuJu, //'正在保存数据...',
url: '/MvcShipping/MsChFee/Save',
scope: this,
params: {
bsno: _thisAmendfee.strAmendBSNO,
type: type,
chfeebody: jsonChFeeBody
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
if (type == '1') {
this.storeDrChFee.reload()
} else if (type == '2') {
this.storeCrChFee.reload()
}
} else {
Ext.Msg.show({ title: Zi.LAN.FEE.ChuoWu, msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
} else {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi,
msg: Zi.LAN.FEE.FuWuQiXiangYingChuCuo,
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
}
});
}, //end save
onShenModifyClick: function (button, event, type) {
var allow = this.getAllowOperationDetail();
if (allow == false) {
return;
}
var selectedRecords = [];
if (type == '1') {
selectedRecords = this.feeDrGridCheckBoxModel.selected.items;
} else if (type == '2') {
selectedRecords = this.feeCrGridCheckBoxModel.selected.items;
}
if (selectedRecords.count == 0) {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: Zi.LAN.FEE.QingXianXuanZeYeWu, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); //没有选择要申请修改的业务!
return;
}
var rec = selectedRecords[0];
if (rec.data.FeeStatus != 0) {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: Zi.LAN.FEE.DangQianFeiYongZhangTaiWuFaShenQingXiuGai, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); //当前费用状态无法申请修改!
return;
}
if (rec.data.Settlement != 0) {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: Zi.LAN.FEE.DangQianFeiYongYiJieSuanWuFaShenQingXiuGai, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); //当前费用已结算无法申请修改!
return;
}
if (rec.data.Invoice != 0) {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: Zi.LAN.FEE.DangQianFeiYongYiKaiChuFaPiaoWuFaShenQingXiuGai, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); //当前费用已开出发票无法申请修改!
return;
}
if (rec.data.OrderAmount != 0) {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: Zi.LAN.FEE.DangQianFeiYongYiShenQingFeiYongWuFaShenQingXiuGai, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); //当前费用已申请费用无法申请修改!
return;
}
if (rec.data.IsDebit == 'True' || rec.data.IsDebit == '1') {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: Zi.LAN.FEE.DangQianFeiYongYiDuiZhangWuFaShenQingXiuGai, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });//当前费用已対帐无法申请修改!'
return;
}
if (rec.data.OrderInvoice != 0) {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: Zi.LAN.FEE.DangQianFeiYongYiShenQingKaiPiaoWuFaShenQingXiuGai, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); //当前费用已申请开票无法申请修改!
return;
}
this.DataLoading = true;
this.NewFeeEdit.getForm().loadRecord(rec);
this.OldFee.getForm().loadRecord(rec);
this.DataLoading = false;
this.winShenModifyShow.show();
},
onCreateModifyClick: function (type) {
var feeGIdSql = '';
var form = this.NewFeeEdit.getForm();
var data = this.NewFeeEdit.getForm().getValues();
var olddata = this.OldFee.getForm().getValues();
_thisAmendfee = this;
Ext.Ajax.request({
waitMsg: Zi.LAN.FEE.ZhengZaiCaoZuoShuJu, //'正在添加数据...',
url: '/Account/Chfee_Audit/ShenModify',
params: {
data: Ext.JSON.encode(data),
olddata: Ext.JSON.encode(olddata),
optype: _thisAmendfee.stroplb,
isamend: '1'
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title: Zi.LAN.FEE.TiShi,
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
} else {
if (type == 1)
_thisAmendfee.storeDrChFee.load({ params: { billno: _thisAmendfee.strAmendBSNO, type: 1, optype: _thisAmendfee.stroplb} });
if (type == 2)
_thisAmendfee.storeCrChFee.load({ params: { billno: _thisAmendfee.strAmendBSNO, type: 2, optype: _thisAmendfee.stroplb} });
_thisAmendfee.winShenModifyShow.close();
}
} else {
Ext.MessageBox.alert(Zi.LAN.FEE.FuWuQiXiangYingChuCuo, response.responseText);
}
},
scope: this
});
},
onShenDeleteClick: function (button, event, type) {
var allow = this.getAllowOperationDetail();
if (allow == false) {
return;
}
var selectedRecords = [];
if (type == '1') {
selectedRecords = this.feeDrGridCheckBoxModel.selected.items;
} else if (type == '2') {
selectedRecords = this.feeCrGridCheckBoxModel.selected.items;
}
if (selectedRecords.count == 0) {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: Zi.LAN.FEE.QingXianXuanZeYeWu, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); //没有选择要申请删除的业务!
return;
}
var rec = selectedRecords[0];
if (rec.data.FeeStatus != 0) {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: Zi.LAN.FEE.DangQianFeiYongZhuangTaiWuFaShenQingShanChu, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); //当前费用状态无法申请删除!
return;
}
if (rec.data.Settlement != 0) {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: Zi.LAN.FEE.DangQianFeiYongYiJieSuanWuFaShenQingShanChu, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); //当前费用已结算无法申请删除!
return;
}
if (rec.data.Invoice != 0) {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: Zi.LAN.FEE.SangQianFeiYongYiKaiChuFaPiaoWuFaShenQingShanChu, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); //当前费用已开出发票无法申请删除!
return;
}
if (rec.data.OrderAmount != 0) {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: Zi.LAN.FEE.DangQianFeiYongYiShenQingFeiYongWuFaShenQingShanChu, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); //当前费用已申请费用无法申请删除!
return;
}
if (rec.data.OrderInvoice != 0) {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: Zi.LAN.FEE.DangQianFeiYongYiShenQingKaiPiaoWuFaShenQingShanChu, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); //当前费用已申请开票无法申请删除!
return;
}
this.DataLoading = true;
this.DeleteFee.getForm().loadRecord(rec);
this.DataLoading = false;
this.winShenDeleteShow.show();
},
onCreateDeleteClick: function (type) {
var feeGIdSql = '';
var form = this.DeleteFee.getForm();
var data = this.DeleteFee.getForm().getValues();
_thisAmendfee = this;
Ext.Ajax.request({
waitMsg: Zi.LAN.FEE.ZhengZaiCaoZuoShuJu, //'正在申请删除...',
url: '/Account/Chfee_Audit/ShenDelete',
params: {
data: Ext.JSON.encode(data),
optype: _thisAmendfee.stroplb,
isamend: '1'
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title: Zi.LAN.FEE.TiShi,
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
} else {
if (type == 1)
_thisAmendfee.storeDrChFee.load({ params: { billno: _thisAmendfee.strAmendBSNO, type: 1, optype: _thisAmendfee.stroplb} });
if (type == 2)
_thisAmendfee.storeCrChFee.load({ params: { billno: _thisAmendfee.strAmendBSNO, type: 2, optype: _thisAmendfee.stroplb} });
_thisAmendfee.winShenDeleteShow.close();
}
} else {
Ext.MessageBox.alert(Zi.LAN.FEE.FuWuQiXiangYingChuCuo, response.responseText);
}
},
scope: this
});
},
onCancelShenClick: function (button, event, type) {
var allow = this.getAllowOperationDetail();
if (allow == false) {
return;
}
var selectedRecords = [];
if (type == '1') {
selectedRecords = this.feeDrGridCheckBoxModel.selected.items;
} else if (type == '2') {
selectedRecords = this.feeCrGridCheckBoxModel.selected.items;
}
if (selectedRecords.count == 0) {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: Zi.LAN.FEE.QingXianXuanZeYeWu, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); //没有选择要取消申请的业务!
return;
}
var rec = selectedRecords[0];
if (rec.data.FeeStatus != 3 && rec.data.FeeStatus != 4) {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: Zi.LAN.FEE.DangQianFeiYongZhuangTaiWuFaQuXiaoShenQing, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); //当前费用状态无法取消申请!
return;
}
// var bodyDrChFeeDatas = [];
// bodyDrChFeeDatas.push(rec);
// var jsonChFeeBody = ConvertFeeRecordsToJson(bodyDrChFeeDatas);
Ext.Ajax.request({
waitMsg: Zi.LAN.FEE.ZhengZaiCaoZuoShuJu, //'正在取消申请...',
url: '/Account/Chfee_Audit/CancelShen',
params: {
Feeid: rec.data.GId,
optype: _thisAmendfee.stroplb,
isamend: '1',
isopen: rec.data.IsOpen
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title: Zi.LAN.FEE.TiShi,
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
} else {
if (type == 1) {
_thisAmendfee.storeDrChFee.load({ params: { billno: _thisAmendfee.strAmendBSNO, type: 1, optype: _thisAmendfee.stroplb },
callback: function (r, options, success) {
if (success) {
if (r.length > 0) {
this.storeDrChFee.getSelectionModel().select(0);
} else {
}
}
},
scope: this
});
this.NewFeeShowDr.setVisible(false);
}
if (type == 2) {
_thisAmendfee.storeCrChFee.load({ params: { billno: _thisAmendfee.strAmendBSNO, type: 2, optype: _thisAmendfee.stroplb },
callback: function (r, options, success) {
if (r.length > 0) {
this.storeDrChFee.getSelectionModel().select(0);
} else {
}
},
scope: this
});
this.NewFeeShowCr.setVisible(false);
}
}
} else {
Ext.MessageBox.alert(Zi.LAN.FEE.FuWuQiXiangYingChuCuo, response.responseText);
}
},
scope: this
});
},
onViewDetailClick: function (button, event, type) {
var openSet = "height=740, width=890, toolbar=no, menubar=no,scrollbars=no, resizable=no,location=no, status=no,Top= " + (screen.height - 540) / 2 + ",Left= " + (screen.width - 890) / 2
var openType = "_blank";
//打开费用“历史信息查询”页面
var openUrl = "../../MvcShipping/MsOpBill/MsFeeHistoryView??bsno=" + _thisAmendfee.strAmendBSNO + "&oplb=" + this.stroplb + "&type=" + type;
window.open(openUrl, openType, openSet);
},
onShenIvoiceClick: function (button, event, type) {
var selectedRecords = [];
if (type == '1') {
selectedRecords = this.feeDrGridCheckBoxModel.selected.items;
} else if (type == '2') {
selectedRecords = this.feeCrGridCheckBoxModel.selected.items;
}
if (selectedRecords.length == 0) {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: Zi.LAN.FEE.QingXianXuanZeFeiYong, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });//没有选择要申请的费用!
return;
}
var invcurr = '';
var invcurrusd = '';
var invcust = '';
var invsalecorp = '';
var bsno = '';
var GidStr = '';
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (rec.data.FeeStatus != 0 && rec.data.FeeStatus != 8 && rec.data.FeeStatus != 9) {
// Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: '当前费用状态无法申请开票!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
// return;
} else {
invcust = rec.data.CustomerName;
invsalecorp = rec.data.SALECORP;
if (rec.data.Currency == 'RMB')
invcurr = rec.data.Currency;
if (rec.data.Currency != 'RMB')
invcurrusd = rec.data.Currency;
bsno = rec.data.BsNo;
var Gid = "'" + rec.data.GId + "'";
if (GidStr == '')
GidStr = Gid;
else {
GidStr = GidStr + ',' + Gid;
}
}
}
if (GidStr == '') {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: Zi.LAN.FEE.QingXianXuanZeFeiYong, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });//没有选择要申请的费用!
return;
}
this.SelectFeeGid = " f.GID IN (" + GidStr + ")";
var StoreCurr = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsFeeCurr',
proxy: { url: '/MvcShipping/MsChFee/GetFeeCurrList' }
});
StoreCurr.load({ params: { condition: "" } });
if (invcurr == '' && invcurrusd != '') invcurr = invcurrusd;
if (this.winIFTMBFShow == undefined || this.winIFTMBFShow == NaN) {
this.comboxInvCurr = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: Zi.LAN.FEE.ShenCurr, //'实收币别',
store: StoreCurr,
id: 'ShenCurr',
forceSelection: true,
allowBlank: false,
name: 'CURR',
value: invcurr,
valueField: 'CURR',
displayField: 'CURR'
});
this.storeINVFEENAME = Ext.create('Ext.data.Store', {
fields: ['FSTATUS', 'NAME']
});
this.storeINVFEENAME.add({ "FSTATUS": "0", "NAME": "否" });
this.storeINVFEENAME.add({ "FSTATUS": "1", "NAME": "是" });
this.comboxINVFEENAME = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '是否明细',
store: this.storeINVFEENAME,
valueField: 'FSTATUS',
displayField: 'NAME',
id: 'INVFEENAME',
forceSelection: true,
name: 'INVFEENAME',
value: '0'
});
this.formIFTMBFSShow = Ext.widget('form', {
frame: true,
region: 'center',
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 80,
msgTarget: 'qtip'
},
items: [{
xtype: 'container',
defaultType: 'textfield',
layout: 'hbox',
defaults: {
anchor: '100%'
},
items: [this.comboxInvCurr, this.comboxINVFEENAME]
}]
});
me = this;
this.winIFTMBFShow = Ext.create('Ext.window.Window', {
width: 320,
height: 160,
//plain : true,
iconCls: "addicon",
resizable: false,
// 是否可以拖动
// draggable:false,
collapsible: true, // 允许缩放条
closeAction: 'close',
closable: true,
modal: 'true',
buttonAlign: "center",
bodyStyle: "padding:0 0 0 0",
items: [this.formIFTMBFSShow],
buttons: [{
text: Zi.LAN.FEE.QueRenShengCheng, //"确认生成",
minWidth: 70,
handler: function () {
var ShenCurr = Ext.getCmp('ShenCurr');
var Curr = ShenCurr.getValue();
var isfeename = Ext.getCmp('INVFEENAME').getValue();
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (rec.data.FeeStatus != 0 && rec.data.FeeStatus != 8 && rec.data.FeeStatus != 9) {
// Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: '当前费用状态无法申请开票!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
// return;
} else {
invcust = rec.data.CustomerName;
}
}
_thisAmendfee.onCreateInvShenClick(Curr, invcust, isfeename, invsalecorp);
_thisAmendfee.winIFTMBFShow.close();
}
}, {
text: Zi.LAN.FEE.GuanBi, //"关闭",
minWidth: 70,
handler: function () {
_thisAmendfee.winIFTMBFShow.close();
}
}]
});
} else {
Ext.getCmp('ShenCurr').setValue(invcurr);
}
this.winIFTMBFShow.show();
},
onCreateInvShenClick: function (Curr, invcust, isfeename, invsalecorp) {
DsOpenEditWin("/Account/Chfee_invoiceapplication/BLEdit?handle=check&bsnosql=amendfeelist&bsCurr=" + Curr + "&bsCust=" + invcust + "&isfeename=" + isfeename + "&salecorp=" + invsalecorp, '发票申请');
},
onShenPayClick: function (button, event, type) {
var selectedRecords = [];
if (type == '1') {
selectedRecords = this.feeDrGridCheckBoxModel.selected.items;
} else if (type == '2') {
selectedRecords = this.feeCrGridCheckBoxModel.selected.items;
}
if (selectedRecords.length == 0) {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: Zi.LAN.FEE.QingXianXuanZeFeiYong, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });//没有选择要申请的费用!
return;
}
var invcurr = '';
var invcurrusd = '';
var invcust = '';
var bsno = '';
var GidStr = '';
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (rec.data.FeeStatus != 0 && rec.data.FeeStatus != 8 && rec.data.FeeStatus != 9) {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: '当前费用状态无法申请开票!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
} else {
if (invcust == '') {
invcust = rec.data.CustomerName;
bsno = rec.data.BsNo;
var Gid = "'" + rec.data.GId + "'";
if (GidStr == '')
GidStr = Gid;
else {
GidStr = GidStr + ',' + Gid;
}
} else {
if (invcust != rec.data.CustomerName) {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: '当前只有同一客户名称才可以申请付费!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
} else {
bsno = rec.data.BsNo;
var Gid = "'" + rec.data.GId + "'";
if (GidStr == '')
GidStr = Gid;
else {
GidStr = GidStr + ',' + Gid;
}
}
}
}
}
if (GidStr == '') {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: Zi.LAN.FEE.QingXianXuanZeFeiYong, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });//没有选择要申请的费用!
return;
}
this.SelectFeeGid = " f.GID IN (" + GidStr + ")";
DsOpenEditWin("/Account/Chfee_payapplication/BLEdit?handle=check&bsnosql=amendfeelist&bsCust=" + invcust, '付费申请');
},
onShenRecClick: function (button, event, type) {
var selectedRecords = [];
if (type == '1') {
selectedRecords = this.feeDrGridCheckBoxModel.selected.items;
} else if (type == '2') {
selectedRecords = this.feeCrGridCheckBoxModel.selected.items;
}
if (selectedRecords.length == 0) {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: Zi.LAN.FEE.QingXianXuanZeFeiYong, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });//没有选择要申请的费用!
return;
}
var invcurr = '';
var invcurrusd = '';
var invcust = '';
var bsno = '';
var GidStr = '';
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (rec.data.FeeStatus != 0 && rec.data.FeeStatus != 8 && rec.data.FeeStatus != 9) {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: '当前费用状态无法申请收费!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
} else {
if (invcust == '') {
invcust = rec.data.CustomerName;
bsno = rec.data.BsNo;
var Gid = "'" + rec.data.GId + "'";
if (GidStr == '')
GidStr = Gid;
else {
GidStr = GidStr + ',' + Gid;
}
} else {
if (invcust != rec.data.CustomerName) {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: '当前只有同一客户名称才可以申请收费!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
} else {
bsno = rec.data.BsNo;
var Gid = "'" + rec.data.GId + "'";
if (GidStr == '')
GidStr = Gid;
else {
GidStr = GidStr + ',' + Gid;
}
}
}
}
}
if (GidStr == '') {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: Zi.LAN.FEE.QingXianXuanZeFeiYong, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });//没有选择要申请的费用!
return;
}
this.SelectFeeGid = " f.GID IN (" + GidStr + ")";
var custno = this.EditRecord.get('CUSTNO');
DsOpenEditWin("/Account/Chfee_recvapplication/BLEdit?handle=check&bsnosql=amendfeelist&bsCust=" + invcust + "&bsCustNo=" + custno, '收费申请');
},
getAllowOperationDetail: function () {
var feeStatus = this.getFeeStatus();
if (feeStatus == '0' || feeStatus == false || feeStatus == 'false')
return true;
else {
return false;
}
},
onAddAmendClick: function (button, event) {
var isadd = this.getModifyStatus();
if (isadd) {
Ext.Msg.show({ title: Zi.LAN.FEE.ChuoWu, msg: "请先保存已修改的更改单,才能添加!", icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return false;
}
if (this.isCancel == '1' || this.isCancel == '2') {
Ext.Msg.show({ title: Zi.LAN.FEE.ChuoWu, msg: "此票业务已退舱或申请退舱,不能添加更改单!", icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
if (this.ADDAMENDNOTFEECLOSE != 1) {
var bsfeestatus = this.EditRecord.get('FEESTATUS');
//if (bsfeestatus != true) {
if (!isTrue(bsfeestatus)) {
Ext.Msg.show({ title: Zi.LAN.FEE.ChuoWu, msg: "此票货还没有费用锁定,不能添加更改单!", icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
}
var sale = this.EditRecord.get('SALE');
if (typeof (sale) == 'undefined')
sale = '';
var accdate = '';
var oDate1 = new Date();
var oDate2 = new Date(this.MsPeriod.FDAY);
var mydatestr = '';
if (oDate1.getTime() >= oDate2.getTime()) {
if (this.MsPeriod.CLOSEDAY != 0) {
var myday = Ext.util.Format.date(oDate1, 'd');
if (myday > this.MsPeriod.CLOSEDAY) {
var mymonth = Ext.util.Format.date(oDate1, 'm');
var myyear = Ext.util.Format.date(oDate1, 'Y');
mymonth = parseInt(mymonth) + 1;
var mymonthstr = mymonth.toString();
if (mymonthstr.length == 1) mymonthstr = '0' + mymonthstr;
mydatestr = myyear.toString() + '-' + mymonthstr;
} else mydatestr = Ext.util.Format.date(oDate1, 'Y-m').toString();
} else {
mydatestr = Ext.util.Format.date(oDate1, 'Y-m').toString();
}
accdate = mydatestr;
} else {
accdate = this.MsPeriod.PERIOD;
}
var store = this.storeAmendBill;
var newbsno = NewGuid();
this.strAmendBSNO = newbsno;
var record = null;
record = Ext.create('MsOpFeeAmend', {
GID: NewGuid(),
BSNO: newbsno,
PARENTID: this.strBSNO,
FEESTATUS: "false",
FEESTATUSREF: '未锁定',
ACCDATE: accdate,
SALE: sale,
REASON: '',
REMARKS: '',
CREATETIME: '',
CREATEUSER: ''
});
store.add(record);
var editColumnIndex = 5;
cellediting = this.gridListCellEditing;
var n = store.getCount();
cellediting.startEditByPosition({ row: n - 1, column: 7 });
},
onDeleteAmendClick: function (button, event) {
var selections = this.gridAmendList.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: Zi.LAN.FEE.QingXianXuanZeYeWu, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); //请先选择业务!
return;
}
var record = selections[0];
if (record.data.FEESTATUS == '1') {
Ext.Msg.show({ title: Zi.LAN.FEE.JingGao, msg: Zi.LAN.FEE.FeiYongYiSuoDingBuYunXuShanChu, icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK }); //费用已锁定,不允许删除!
return;
}
if (this.storeDrChFee.getCount() > 0) {
Ext.Msg.show({ title: Zi.LAN.FEE.JingGao, msg: Zi.LAN.FEE.CunZaiFeiYongXinXiBuYunXuShanChu, icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK }); //存在费用信息,不允许删除,请先删除费用信息!
return;
}
if (this.storeCrChFee.getCount() > 0) {
Ext.Msg.show({ title: Zi.LAN.FEE.JingGao, msg: Zi.LAN.FEE.CunZaiFeiYongXinXiBuYunXuShanChu, icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
}
Ext.MessageBox.confirm(Zi.LAN.FEE.TiShi, Zi.LAN.FEE.QueDingShanChuGaiJiLuMa, function (btn) {//'确定删除该记录吗?'
if (btn == 'yes') {
Ext.Msg.wait(Zi.LAN.FEE.ZhengZaiCaoZuoShuJu);
Ext.Ajax.request({
waitMsg: Zi.LAN.FEE.ZhengZaiCaoZuoShuJu, //'正在删除数据...',
url: '/MvcShipping/MsChFee/DeleteAmend',
params: {
data: Ext.JSON.encode(record.data)
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.storeAmendBill.remove(record);
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
else {
Ext.Msg.show({ title: Zi.LAN.FEE.ChuoWu, msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
}
},
failure: function (response, options) {
Ext.Msg.show({ title: Zi.LAN.FEE.JingGao, msg: Zi.LAN.FEE.FuWuQiXiangYingChuCuo, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
},
success: function (response, options) {
},
scope: this
}); //end Ext.Ajax.request
}
}, this);
},
onPostAmendClick: function (button, event, type) {
var selections = this.gridAmendList.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: Zi.LAN.FEE.QingXianXuanZeYeWu, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var record = selections[0];
if (record.data.ACCDATE == '' || record.data.ACCDATE == null || record.data.ACCDATE == NaN) {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: Zi.LAN.FEE.KuaiJiQiJianBuNengWeiKong, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); //会计期间不能为空!
return;
}
this.strAmendBSNO = record.data.BSNO;
record.data.ACCDATE = Ext.util.Format.date(record.data.ACCDATE, 'Y-m').toString();
if (this.storeMustBe.getCount() > 0) {
for (var j = 0; j < this.storeMustBe.getCount(); j += 1) {
var member = this.storeMustBe.getAt(j);
var fieldname = member.data.FIELDNAME;
if (fieldname == 'REASON') {
if (record.data.REASON == '' || record.data.REASON == null || record.data.REASON == NaN) {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: '原因不能为空!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); //会计期间不能为空!
return;
}
}
if (fieldname == 'SALE') {
if (record.data.SALE == '' || record.data.SALE == null || record.data.SALE == NaN) {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: '揽货人不能为空!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); //会计期间不能为空!
return;
}
}
if (fieldname == 'REMARKS') {
if (record.data.REMARKS == '' || record.data.REMARKS == null || record.data.REMARKS == NaN) {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: '备注不能为空!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); //会计期间不能为空!
return;
}
}
}
} else {
}
var bodyDrChFeeDatas = [];
var bodyCrChFeeDatas = [];
var i;
for (i = 0; i < this.storeDrChFee.getCount(); i += 1) {
var memberyf = this.storeDrChFee.getAt(i);
if (_thisAmendfee.stroplb == 'op_SeaeOrder')
memberyf.data.IsCrmOrderFee = '1';
bodyDrChFeeDatas.push(memberyf);
var ExChangerate = memberyf.data.ExChangerate;
var amount = memberyf.data.Amount;
if (amount == 0) {
Ext.Msg.show({ title: Zi.LAN.FEE.JingGao,
msg: Zi.LAN.FEE.FeiYongJinEBuYunXuWeiLing, //'费用的金额不允许为0,请修改后再保存',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
return;
}
if (ExChangerate == 0) {
Ext.Msg.show({ title: Zi.LAN.FEE.JingGao,
msg: Zi.LAN.FEE.HuiLvBuNengWeiLing, //'汇率不允许为0,请修改后再保存',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
return;
}
};
var jsonDrChFeeBody = ConvertFeeRecordsToJson(bodyDrChFeeDatas);
for (i = 0; i < this.storeCrChFee.getCount(); i += 1) {
var memberyf = this.storeCrChFee.getAt(i);
if (_thisAmendfee.stroplb == 'op_SeaeOrder')
memberyf.data.IsCrmOrderFee = '1';
bodyCrChFeeDatas.push(memberyf);
var amount = memberyf.data.Amount;
var ExChangerate = memberyf.data.ExChangerate;
if (amount == 0) {
Ext.Msg.show({ title: Zi.LAN.FEE.JingGao,
msg: Zi.LAN.FEE.FeiYongJinEBuYunXuWeiLing, //'费用的金额不允许为0,请修改后再保存',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
return;
}
if (ExChangerate == 0) {
Ext.Msg.show({ title: Zi.LAN.FEE.JingGao,
msg: Zi.LAN.FEE.HuiLvBuNengWeiLing, //'汇率不允许为0,请修改后再保存',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
return;
}
};
var jsonCrChFeeBody = ConvertFeeRecordsToJson(bodyCrChFeeDatas);
_thisAmendfee = this;
Ext.Msg.wait(Zi.LAN.FEE.ZhengZaiCaoZuoShuJu);
Ext.Ajax.request({
waitMsg: Zi.LAN.FEE.ZhengZaiCaoZuoShuJu, //'正在保存数据...',
url: '/MvcShipping/MsChFee/SaveAmend',
scope: this,
params: {
bsno: _thisAmendfee.strAmendBSNO,
data: Ext.JSON.encode(record.data),
chdrfeebody: jsonDrChFeeBody,
chcrfeebody: jsonCrChFeeBody
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var returnData = jsonresult.Data;
record.data.CREATEUSER = returnData[0].CREATEUSER;
record.data.CREATETIME = returnData[0].CREATETIME;
record.data.AMENDNO = returnData[0].AMENDNO;
record.commit();
this.StoreDateCurr.load({ params: { optype: this.stroplb, bsno: _thisAmendfee.strAmendBSNO} });
for (i = 0; i < this.storeAmendBill.getCount(); i += 1) {
var memberyf = this.storeAmendBill.getAt(i);
if (memberyf.data.BSNO == _thisAmendfee.strAmendBSNO) {
this.selectbill = 1;
this.gridAmendList.getSelectionModel().select(memberyf)
this.selectbill = 0;
}
};
for (i = 0; i < this.storeDrChFee.getCount(); i += 1) {
var memberyf = this.storeDrChFee.getAt(i);
memberyf.data.BSNO = _thisAmendfee.strAmendBSNO;
memberyf.commit();
};
for (i = 0; i < this.storeCrChFee.getCount(); i += 1) {
var memberyf = this.storeCrChFee.getAt(i);
memberyf.data.BSNO = _thisAmendfee.strAmendBSNO;
memberyf.commit();
};
if (type == 1 || type == 2) {
this.onAddDetailClick(button, event, type);
} else {
this.storeDrChFee.load({ params: { billno: this.strAmendBSNO, type: 1, optype: this.stroplb} });
this.storeCrChFee.load({ params: { billno: this.strAmendBSNO, type: 2, optype: this.stroplb} });
}
} else {
Ext.Msg.show({ title: Zi.LAN.FEE.ChuoWu, msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
} else {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi,
msg: Zi.LAN.FEE.FuWuQiXiangYingChuCuo,
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
}
});
}, //end save
//#endregion
gridListBeforeEdit: function (editor, e) {
var chfeefeeStatus = e.record.get('FEESTATUS');
var canedit = chfeefeeStatus == 0;
if (e.field == 'SALE' && this.AmendSalenotedit == 1) {
return false;
}
return canedit;
},
//#region 表格的AfterEdit
gridListChFeeAfterEdit: function (editor, e, eOpts) {
if (e.value == e.originalValue) return;
//var BSNO = e.record.get('BSNO');
if (e.field == 'UnitPrice') {
var unitPrice = e.record.data['UnitPrice'];
var quantity = e.record.data['Quantity'];
var taxrate = e.record.data['TaxRate'];
if (taxrate != null) {
var taxrateb = Add(1, Div(taxrate, 100));
//parseFloat(1 + parseFloat(taxrate).mul(0.01));
var TaxUnitPrice = Mul(unitPrice, taxrateb);
//(parseFloat(unitPrice).mul(taxrateb)).toFixed(2);
e.record.set('TaxUnitPrice', TaxUnitPrice);
}
var notaxamount = Mul(unitPrice, quantity); //(parseFloat(unitPrice).mul(quantity)).toFixed(2);
e.record.set('NoTaxAmount', notaxamount);
////taxrate = Div(taxrate, 100);
//parseFloat(taxrate).mul(0.01);
// tax = notaxamount * taxrate;
var tax = Div(Mul(notaxamount, taxrate), 100); //parseFloat(notaxamount).mul(taxrate);
e.record.set('Tax', tax);
var amount = Add(notaxamount, tax); //(parseFloat(notaxamount).add(parseFloat(tax))).toFixed(2);// e.record.set('Amount', Ext.util.Format.number(amount, '0.00'));
e.record.set('Amount', amount);
this.calcDetailTotal();
}
else if (e.field == 'CustomerName') {
var records = DsStoreQueryBy(this.storeCustomerNameRef, 'CustName', e.value);
if (records.getCount() > 0) {
var data = records.getAt(0).data;
var FEEFRT = data.FEEFRT;
if (FEEFRT != '')
e.record.set('FeeFrt', FEEFRT);
var DESCRIPTION = data.DESCRIPTION;
if (DESCRIPTION != '')
e.record.set('CustomerFullName', DESCRIPTION);
}
}
else if (e.field == 'TaxUnitPrice') {
var TaxUnitPrice = e.record.data['TaxUnitPrice'];
// if (e.value != 0) {
var quantity = e.record.data['Quantity'];
var taxrate = e.record.data['TaxRate'];
var taxrateb = Add(1, Div(taxrate, 100), 4); //parseFloat(1 + parseFloat(taxrate).mul(0.01));
var unitPrice = Div(TaxUnitPrice, taxrateb); //(parseFloat(TaxUnitPrice).div(parseFloat(taxrateb))).toFixed(2);
e.record.set('UnitPrice', unitPrice);
if (quantity != null) {
var amount = Mul(TaxUnitPrice, quantity);
//(parseFloat(TaxUnitPrice).mul(quantity)).toFixed(2);
e.record.set('Amount', amount);
var notaxamount = Div(amount, taxrateb);
//(parseFloat(amount).div(taxrateb)).toFixed(2);
e.record.set('NoTaxAmount', notaxamount);
var tax = Div(Mul(notaxamount, taxrate), 100); //parseFloat(notaxamount).mul(taxrate);
e.record.set('Tax', tax);
}
this.calcDetailTotal();
// }
} else if (e.field == 'Quantity') {
var unitPrice = e.record.data['UnitPrice'];
var quantity = e.record.data['Quantity'];
var TaxUnitPrice = e.record.data['TaxUnitPrice'];
var taxrate = e.record.data['TaxRate'];
if (taxrate != null) {
var taxrateb = Add(1, Div(taxrate, 100));
if ((TaxUnitPrice == null || TaxUnitPrice == 0 || TaxUnitPrice == NaN) && (unitPrice != null)) {
var TaxUnitPrice = Mul(unitPrice, taxrateb);
e.record.set('TaxUnitPrice', TaxUnitPrice);
}
}
if (unitPrice != null) {
var notaxamount = Mul(unitPrice, quantity); //(parseFloat(unitPrice).mul(quantity)).toFixed(2);
e.record.set('NoTaxAmount', notaxamount);
var tax = Div(Mul(notaxamount, taxrate), 100); //parseFloat(notaxamount).mul(taxrate);
e.record.set('Tax', tax);
}
if (TaxUnitPrice != null) {
var amount = Mul(TaxUnitPrice, quantity); //(parseFloat(unitPrice).mul(quantity)).toFixed(2);
e.record.set('Amount', amount);
}
this.calcDetailTotal();
}
else if (e.field == 'FeeName' || e.field == 'FeeDescription') {
if (e.field == 'FeeDescription') {
if (e.value == '') return;
}
if (e.field == 'FeeDescription') {
var records = DsStoreQueryBy(this.storeFeeNameRef, 'Description', e.value);
} else {
var records = DsStoreQueryBy(this.storeFeeNameRef, 'Name', e.value);
var FEENAME = e.value;
}
if (records.getCount() > 0) {
var data = records.getAt(0).data;
var FEENAME = data.Name;
var Currency = data.DefaultCurr;
var Description = data.Description;
var DEFAULTUNIT = data.DefaultUnit;
var DefaultDebitRef = data.DefaultDebitRef;
var DefaultCreditRef = data.DefaultCreditRef;
var UNIT = '';
var custtype = '';
var FeeType = e.record.data['FeeType'];
var codeFEETYPE = data.FEETYPE;
var FEEFRT = data.FEEFRT;
var ISADVANCEDPAY = data.ISADVANCEDPAY;
//alert(codeFEETYPE);
e.record.set('Currency', Currency);
e.record.set('FeeDescription', Description);
if (e.field == 'FeeDescription') {
e.record.set('FeeName', FEENAME);
}
if (FEEFRT != '') {
e.record.set('FeeFrt', FEEFRT);
}
if (ISADVANCEDPAY != '') {
e.record.set('IsAdvancedpay', ISADVANCEDPAY);
}
if (DEFAULTUNIT == "1" || DEFAULTUNIT == "11") {
e.record.set('Unit', "单票");
e.record.set('Quantity', 1);
UNIT = '单票';
} else if (DEFAULTUNIT == "2") {
e.record.set('Unit', "重量");
UNIT = '重量';
//设置重量,如果是进口的设置净重 Quantity
//获取业务类型 获取重量 设置
} else if (DEFAULTUNIT == "5") {
e.record.set('Unit', "TEU");
UNIT = 'TEU';
//设置数量
//获取业务类型 获取所有集装箱信息 折算TEU
} else if (DEFAULTUNIT == "6") {
e.record.set('Unit', "净重");
UNIT = '净重';
//如果是进口的设置净重
} else if (DEFAULTUNIT == "10" || DEFAULTUNIT == "3") {
e.record.set('Unit', "尺码");
UNIT = '尺码';
//如果是进口的设置净重
} else if (DEFAULTUNIT == "9") {
var Unitrecords = DsStoreQueryLikeBy(this.StoreUnit, 'UNIT', 1, '2');
if (Unitrecords.getCount() > 0) {
var ffdata = Unitrecords.getAt(0).data;
var aUNIT = ffdata.UNIT;
e.record.set('Unit', aUNIT);
UNIT = aUNIT;
} else {
var Unitrecords = DsStoreQueryLikeBy(this.StoreUnit, 'UNIT', 1, '4');
if (Unitrecords.getCount() > 0) {
var ffdata = Unitrecords.getAt(0).data;
var aUNIT = ffdata.UNIT;
e.record.set('Unit', aUNIT);
UNIT = aUNIT;
}
}
//如果是进口的设置净重
} else {
e.record.set('Unit', DEFAULTUNIT);
UNIT = DEFAULTUNIT;
}
if (Currency != LOCALCURR) {
var FeeType = e.record.data['FeeType'];
var FFrecords = DsStoreQueryBy(this.StoreDateCurr, 'CURR', Currency);
if (FFrecords.getCount() > 0) {
var ffdata = FFrecords.getAt(0).data;
if (FeeType == 2)
var DEFRATE = ffdata.CRDEFRATE;
else
var DEFRATE = ffdata.DEFRATE;
e.record.set('ExChangerate', DEFRATE);
} else {
var DFrecords = DsStoreQueryBy(this.StoreCurr, 'CURR', Currency);
if (DFrecords.getCount() > 0) {
var dfdata = DFrecords.getAt(0).data;
if (FeeType == 2)
var DEFRATE = dfdata.CRDEFRATE;
else
var DEFRATE = dfdata.DEFRATE;
e.record.set('ExChangerate', DEFRATE);
} else {
e.record.set('ExChangerate', 0);
}
}
} else { e.record.set('ExChangerate', 1); };
var Unitrecords = DsStoreQueryBy(this.StoreUnit, 'UNIT', UNIT);
var QUANTITY = 1;
if (Unitrecords.getCount() > 0) {
var Unitdata = Unitrecords.getAt(0).data;
QUANTITY = Unitdata.QUANTITY;
if ((UNIT == '重量') && (QUANTITY == 0)) {
Unitrecords = DsStoreQueryBy(this.StoreUnit, 'UNIT', '净重');
if (Unitrecords.getCount() > 0) {
Unitdata = Unitrecords.getAt(0).data;
QUANTITY = Unitdata.QUANTITY;
}
}
e.record.set('Quantity', QUANTITY);
} else {
e.record.set('Quantity', 1);
}
var taxrate = e.record.data['TaxRate'];
if (taxrate == null) taxrate = 0;
var unitPrice = e.record.data['UnitPrice'];
var notaxamount = Mul(unitPrice, QUANTITY); //(parseFloat(unitPrice).mul(QUANTITY)).toFixed(2);
if (notaxamount == null || notaxamount == NaN) notaxamount = 0;
e.record.set('NoTaxAmount', notaxamount); //taxrate = parseFloat(taxrate) / 100;
var tax = Mul3(notaxamount, taxrate, 0.01); //parseFloat(notaxamount).mul(taxrate);
var amount = Add(notaxamount, tax); //(parseFloat(notaxamount).add(parseFloat(tax))).toFixed(2);
if (amount == null || amount == NaN) amount = 0;
e.record.set('Amount', amount);
// var tax = Div(Mul(notaxamount, taxrate), 100); //parseFloat(notaxamount).mul(taxrate);
e.record.set('Tax', tax);
this.calcDetailTotal();
var CustomerName = e.record.data['CustomerName'];
if (CustomerName == '') {
if (FeeType == 2) {
var recordcust = DsStoreQueryBy(this.StoreCustType, 'CUSTTYPE', DefaultCreditRef);
if (recordcust.getCount() > 0) {
var data = recordcust.getAt(0).data;
var CUSTNAME = this.EditRecord.get(data.CUSTNAME);
e.record.set('CustomerType', DefaultCreditRef);
e.record.set('CustomerName', CUSTNAME);
} else {
}
} else {
var recordcust = DsStoreQueryBy(this.StoreCustType, 'CUSTTYPE', DefaultDebitRef);
if (recordcust.getCount() > 0) {
var data = recordcust.getAt(0).data;
var CUSTNAME = this.EditRecord.get(data.CUSTNAME);
e.record.set('CustomerType', DefaultDebitRef);
e.record.set('CustomerName', CUSTNAME);
} else {
}
}
}
} else {
e.record.set('Currency', LOCALCURR);
e.record.set('FeeDescription', '');
}
}
else if (e.field == 'TaxRate') {
var taxrate = e.record.data['TaxRate'];
var unitPrice = e.record.data['UnitPrice'];
var quantity = e.record.data['Quantity'];
if (_thisAmendfee.ACCTAXRATESAMETAXRATE == 1) e.record.set('AccTaxRate', taxrate);
if (unitPrice != null) {
var taxrateb = Add(1, Div(taxrate, 100, 4), 4);
//parseFloat(1 + parseFloat(taxrate).mul(0.01));
var TaxUnitPrice = Mul(unitPrice, taxrateb);
//(parseFloat(unitPrice).mul(taxrateb)).toFixed(2);
e.record.set('TaxUnitPrice', TaxUnitPrice);
}
var notaxamount = e.record.data['NoTaxAmount'];
////taxrate = Div(taxrate, 100);
//parseFloat(taxrate).mul(0.01);
var tax = Div(Mul(notaxamount, taxrate), 100);
//parseFloat(notaxamount).mul(taxrate);
var amount = Add(notaxamount, tax);
//(parseFloat(notaxamount).add(parseFloat(tax))).toFixed(2);
e.record.set('Amount', amount);
e.record.set('Tax', tax);
this.calcDetailTotal();
}
else if (e.field == 'NoTaxAmount') {
var taxrate = e.record.data['TaxRate'];
var notaxamount = e.record.data['NoTaxAmount'];
////taxrate = parseFloat(taxrate).mul(0.01);
var tax = Div(Mul(notaxamount, taxrate), 100);
//parseFloat(notaxamount).mul(taxrate);
var amount = Add(notaxamount, tax);
//(parseFloat(notaxamount).add(parseFloat(tax))).toFixed(2);
var quantity = e.record.data['Quantity'];
if (quantity != null && quantity != 0) {
var unitPrice = Div(notaxamount, quantity, 4); //(parseFloat(notaxamount).div(parseFloat(quantity))).toFixed(2);
e.record.set('UnitPrice', unitPrice);
var TaxUnitPrice = Div(amount, quantity, 4);
e.record.set('TaxUnitPrice', TaxUnitPrice);
}
e.record.set('Amount', amount);
e.record.set('Tax', tax);
/*
var amount = parseFloat(notaxamount) + parseFloat(notaxamount * taxrate / 100);
e.record.set('Amount', Ext.util.Format.number(amount, '0.00'));
*/
this.calcDetailTotal();
}
else if (e.field == 'Amount') {
var taxrate = e.record.data['TaxRate'];
var amount = e.record.data['Amount'];
if (taxrate != null) {
var taxrateb = Add(1, Div(taxrate, 100, 4), 4); //parseFloat(1 + parseFloat(taxrate.mul(0.01)));
if (amount > 0) {
var notaxamount = Div(amount, taxrateb);
e.record.set('NoTaxAmount', notaxamount);
} else {
var notaxamount = Div(Math.abs(amount), taxrateb);
notaxamount = -notaxamount;
e.record.set('NoTaxAmount', notaxamount);
}
var tax = Add(amount, -notaxamount); //parseFloat(notaxamount).mul(taxrate);
e.record.set('Tax', tax);
var quantity = e.record.data['Quantity'];
if (quantity != null && quantity != 0) {
var unitPrice = Div(notaxamount, quantity, 4); //(parseFloat(notaxamount).div(parseFloat(quantity))).toFixed(2);
e.record.set('UnitPrice', unitPrice);
var TaxUnitPrice = Div(amount, quantity, 4);
e.record.set('TaxUnitPrice', TaxUnitPrice);
}
};
this.calcDetailTotal();
}
else if (e.field == 'Unit') {
var records = DsStoreQueryBy(this.StoreUnit, 'UNIT', e.value);
var QUANTITY = 1;
if (records.getCount() > 0) {
var data = records.getAt(0).data;
QUANTITY = data.QUANTITY;
e.record.set('Quantity', QUANTITY);
} else {
e.record.set('Quantity', 1);
}
var taxrate = e.record.data['TaxRate'];
if (taxrate == null) taxrate = 0;
var unitPrice = e.record.data['UnitPrice'];
var notaxamount = Mul(unitPrice, QUANTITY); //(parseFloat(unitPrice).mul(QUANTITY)).toFixed(2);
e.record.set('NoTaxAmount', notaxamount); //taxrate = parseFloat(taxrate) / 100;
var tax = Mul3(notaxamount, taxrate, 0.01); //parseFloat(notaxamount).mul(taxrate);
var amount = Add(notaxamount, tax); //(parseFloat(notaxamount).add(parseFloat(tax))).toFixed(2);
e.record.set('Amount', amount);
e.record.set('Tax', tax);
this.calcDetailTotal();
} else if (e.field == 'Currency') {
var FeeType = e.record.data['FeeType'];
if (e.value == LOCALCURR) {
e.record.set('ExChangerate', 1);
} else {
var FFrecords = DsStoreQueryBy(this.StoreDateCurr, 'CURR', e.value);
if (FFrecords.getCount() > 0) {
var ffdata = FFrecords.getAt(0).data;
if (FeeType == 2)
var DEFRATE = ffdata.CRDEFRATE;
else
var DEFRATE = ffdata.DEFRATE;
e.record.set('ExChangerate', DEFRATE);
} else {
var DFrecords = DsStoreQueryBy(this.StoreCurr, 'CURR', e.value);
if (DFrecords.getCount() > 0) {
var dfdata = DFrecords.getAt(0).data;
if (FeeType == 2)
var DEFRATE = dfdata.CRDEFRATE;
else
var DEFRATE = dfdata.DEFRATE;
e.record.set('ExChangerate', DEFRATE);
} else {
e.record.set('ExChangerate', 0);
}
}
}
this.calcDetailTotal();
} else if (e.field == 'CustomerType') {
var records = DsStoreQueryBy(this.StoreCustType, 'CUSTTYPE', e.value);
if (records.getCount() > 0) {
var data = records.getAt(0).data;
var CUSTNAME = this.EditRecord.get(data.CUSTNAME);
e.record.set('CustomerName', CUSTNAME);
} else {
// e.record.set('CustomerName', 0);
}
} else if (e.field == 'MANAGER') {
var records = DsStoreQueryBy(this.storeManagerDr, 'GID', e.value);
if (records.getCount() > 0) {
var data = records.getAt(0).data;
e.record.set('MANAGERREF', data.UserName);
} else {
// e.record.set('CustomerName', 0);
}
}
},
calcDetailTotal: function () {
var rmbdr = 0;
var rmbcr = 0;
var usddr = 0;
var usdcr = 0;
var otdr = 0;
var otcr = 0;
var ttldr = 0;
var ttlcr = 0;
var notaxrmbdr = 0;
var notaxrmbcr = 0;
var notaxusddr = 0;
var notaxusdcr = 0;
var notaxotdr = 0;
var notaxotcr = 0;
var notaxttldr = 0;
var notaxttlcr = 0;
for (var i = 0; i < this.storeDrChFee.getCount(); i += 1) {
var member = this.storeDrChFee.getAt(i);
var value = member.get('Amount');
var notaxvalue = member.get('NoTaxAmount');
var curr = member.get('Currency');
var rate = member.get('ExChangerate');
if (curr == LOCALCURR) {
rmbdr = parseFloat(rmbdr) + parseFloat(value);
notaxrmbdr = parseFloat(notaxrmbdr) + parseFloat(notaxvalue);
} else if (curr == 'USD') {
usddr = parseFloat(usddr) + parseFloat(value);
notaxusddr = parseFloat(notaxusddr) + parseFloat(notaxvalue);
} else {
otdr = parseFloat(otdr) + parseFloat(value);
notaxotdr = parseFloat(notaxotdr) + parseFloat(notaxvalue);
}
ttldr = parseFloat(ttldr) + parseFloat(value) * parseFloat(rate);
notaxttldr = parseFloat(notaxttldr) + parseFloat(notaxvalue) * parseFloat(rate);
}
for (var i = 0; i < this.storeCrChFee.getCount(); i += 1) {
var member = this.storeCrChFee.getAt(i);
var value = member.get('Amount');
var curr = member.get('Currency');
var rate = member.get('ExChangerate');
var notaxvalue = member.get('NoTaxAmount');
if (curr == LOCALCURR) {
rmbcr = parseFloat(rmbcr) + parseFloat(value);
notaxrmbcr = parseFloat(notaxrmbcr) + parseFloat(notaxvalue);
} else if (curr == 'USD') {
usdcr = parseFloat(usdcr) + parseFloat(value);
notaxusdcr = parseFloat(notaxusdcr) + parseFloat(notaxvalue);
} else {
otcr = parseFloat(otcr) + parseFloat(value);
notaxotcr = parseFloat(notaxotcr) + parseFloat(notaxvalue);
}
ttlcr = parseFloat(ttlcr) + parseFloat(value) * parseFloat(rate);
notaxttlcr = parseFloat(notaxttlcr) + parseFloat(notaxvalue) * parseFloat(rate);
}
var rmbprofit = parseFloat(rmbdr) - parseFloat(rmbcr);
var usdprofit = parseFloat(usddr) - parseFloat(usdcr);
var otprofit = parseFloat(otdr) - parseFloat(otcr);
var ttlprofit = parseFloat(ttldr) - parseFloat(ttlcr);
var notaxrmbprofit = parseFloat(notaxrmbdr) - parseFloat(notaxrmbcr);
var notaxusdprofit = parseFloat(notaxusddr) - parseFloat(notaxusdcr);
var notaxotprofit = parseFloat(notaxotdr) - parseFloat(notaxotcr);
var notaxttlprofit = parseFloat(notaxttldr) - parseFloat(notaxttlcr);
for (i = 0; i < this.storeBodySum.getCount(); i += 1) {
var memberyf = this.storeBodySum.getAt(i);
if (memberyf.data.CURR == LOCALCURR) {
memberyf.set("NORATEDR", notaxrmbdr);
memberyf.set("DR", rmbdr);
memberyf.set("NORATECR", notaxrmbcr);
memberyf.set("CR", rmbcr);
memberyf.set("NORATEPR", notaxrmbprofit);
memberyf.set("PR", rmbprofit);
memberyf.commit();
} else if (memberyf.data.CURR == 'USD') {
memberyf.set("NORATEDR", notaxusddr);
memberyf.set("DR", usddr);
memberyf.set("NORATECR", notaxusdcr);
memberyf.set("CR", usdcr);
memberyf.set("NORATEPR", notaxusdprofit);
memberyf.set("PR", usdprofit);
memberyf.commit();
} if (memberyf.data.CURR == '其他币别') {
memberyf.set("NORATEDR", notaxotdr);
memberyf.set("DR", otdr);
memberyf.set("NORATECR", notaxotcr);
memberyf.set("CR", otcr);
memberyf.set("NORATEPR", notaxotprofit);
memberyf.set("PR", otprofit);
memberyf.commit();
} if (memberyf.data.CURR == '合计') {
memberyf.set("NORATEDR", notaxttldr);
memberyf.set("DR", ttldr);
memberyf.set("NORATECR", notaxttlcr);
memberyf.set("CR", ttlcr);
memberyf.set("NORATEPR", notaxttlprofit);
memberyf.set("PR", ttlprofit);
memberyf.commit();
}
}
this.setTotalHead();
},
setHeadFieldValue: function (fieldName, value) {
var field = this.formtotal.getForm().findField(fieldName);
field.setValue(value);
},
//#endregion
cellEditingChFeeBeforeEdit: function (editor, e) {
var allow = this.getAllowOperationDetail();
if (allow == false) {
return false;
Ext.Msg.show({ title: Zi.LAN.FEE.ChuoWu, msg: "此票委托已费用已锁定,不允许操作费用!", icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
var chfeefeeStatus = e.record.get('FeeStatus');
var canedit = chfeefeeStatus == 1 || chfeefeeStatus == 6;
var IsDebit = e.record.get('IsDebit');
if (canedit) {
if (IsDebit == 'True' || IsDebit == '1') {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: Zi.LAN.FEE.DangQianFeiYongYiDuiZhangWuFaXiuGai, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });//当前费用已対帐无法修改!
canedit = false;
}
};
if (canedit) {
if (e.record.get('Invoice') != 0) {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: Zi.LAN.FEE.DangQianFeiYongYiKaiChuFaPiaoWuFaShenQingXiuGai, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
canedit = false;
}
}
if (canedit) {
if (e.record.get('OrderAmount') != 0) {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: Zi.LAN.FEE.DangQianFeiYongYiShenQingFeiYongWuFaShenQingXiuGai, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
canedit = false;
}
}
if (canedit) {
if (e.record.get('OrderInvoice') != 0) {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: Zi.LAN.FEE.DangQianFeiYongYiShenQingKaiPiaoWuFaShenQingXiuGai, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
canedit = false;
}
}
if (canedit) {
var type = e.record.get('FeeType');
var op = e.record.get('EnteroPerator');
var opname = e.record.get('OpName');
if (type == 1) {
var records = DsStoreQueryBy(this.StoreDrOpRange, 'OPID', op);
if (records.getCount() > 0) {
} else {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: '你没有权限修改' + opname + '录入的费用!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
canedit = false;
}
} else if (type == 2) {
var records = DsStoreQueryBy(this.StoreCrOpRange, 'OPID', op);
if (records.getCount() > 0) {
} else {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: '你没有权限修改' + opname + '录入的费用!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
canedit = false;
}
}
}
return canedit;
},
refBillNoSeChange: function (field, newValue, oldValue) {
// if (newValue != oldValue) {
// alert(newValue + "," + oldValue);
// }
},
onNoIvoiceClick: function (button, event, type) {
var GidStr = '';
if (type == '1') {
var records = this.feeDrGridCheckBoxModel.selected.items;
} else if (type == '2') {
var records = this.feeCrGridCheckBoxModel.selected.items;
};
if (records.length == 0) {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: Zi.LAN.FEE.QingXianXuanZeFeiYong, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); //请先选择要禁开发票的费用!
return;
}
for (var i = 0; i < records.length; i++) {
var rec = records[i];
var feeStatus = rec.data.FeeStatus;
var Gid = rec.data.GId;
if (GidStr == '')
GidStr = Gid;
else {
GidStr = GidStr + ',' + Gid;
}
}
_this = this;
if (GidStr == '') {
} else {
Ext.Ajax.request({
waitMsg: Zi.LAN.FEE.ZhengZaiCaoZuoShuJu, //'正在提交数据...',
url: '/Account/Chfee_Audit/NoIvoice',
params: {
bill: GidStr
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title: Zi.LAN.FEE.TiShi,
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
} else {
if (type == 1) {
this.storeDrChFee.load({ params: { billno: this.strAmendBSNO, type: 1, optype: this.stroplb} });
} else {
this.storeCrChFee.load({ params: { billno: this.strAmendBSNO, type: 2, optype: this.stroplb} });
}
}
} else {
Ext.MessageBox.alert(Zi.LAN.FEE.FuWuQiXiangYingChuCuo, response.responseText);
}
},
scope: this
});
}
},
onCancelNoIvoiceClick: function (button, event, type) {
var GidStr = '';
if (type == '1') {
var records = this.feeDrGridCheckBoxModel.selected.items;
} else if (type == '2') {
var records = this.feeCrGridCheckBoxModel.selected.items;
};
if (records.length == 0) {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: Zi.LAN.FEE.QingXianXuanZeFeiYong, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
// isAll = this.comboxaddDCType.getValue();
for (var i = 0; i < records.length; i++) {
var rec = records[i];
var feeStatus = rec.data.FeeStatus;
var Gid = rec.data.GId;
if (GidStr == '')
GidStr = Gid;
else {
GidStr = GidStr + ',' + Gid;
}
}
_this = this;
if (GidStr == '') {
} else {
Ext.Ajax.request({
waitMsg: Zi.LAN.FEE.ZhengZaiCaoZuoShuJu, //'正在提交数据...',
url: '/Account/Chfee_Audit/CancelNoIvoice',
params: {
bill: GidStr
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title: Zi.LAN.FEE.TiShi,
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
} else {
if (type == 1) {
this.storeDrChFee.load({ params: { billno: this.strAmendBSNO, type: 1, optype: this.stroplb} });
} else {
this.storeCrChFee.load({ params: { billno: this.strAmendBSNO, type: 2, optype: this.stroplb} });
}
}
} else {
Ext.MessageBox.alert(Zi.LAN.FEE.FuWuQiXiangYingChuCuo, response.responseText);
}
},
scope: this
});
}
},
onSubmitAuditClick: function (button, event, type) {
var allow = this.getAllowOperationDetail();
if (allow == false) {
return;
}
if (type == '1') {
var records = this.feeDrGridCheckBoxModel.selected.items;
} else if (type == '2') {
var records = this.feeCrGridCheckBoxModel.selected.items;
};
if (records.length == 0) {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: Zi.LAN.FEE.QingXianXuanZeYaoTiJiaoShenHeDeFeiYong, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var insert;
for (var i = 0; i < records.length; i++) {
var rec = records[i];
var bsno = rec.data.BsNo;
if (bsno == '*') {
insert = true;
}
}
if (insert == true) {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: Zi.LAN.FEE.QingXianBaoCunFeiYong, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var iSuccess = 0;
var iFailure = 0;
var postCount = 0;
var postBillNO = "";
var loadVal = 0;
for (var i = 0; i < records.length; i++) {
var rec = records[i];
var feeStatus = rec.data.FeeStatus;
var canDelete = feeStatus == 1 || feeStatus == 6;
if (canDelete == false) {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi,
msg: Zi.LAN.FEE.ZiNengTiJiaoFuHeTiaoJianDeFeiYong, //'只能费用状态为[录入状态]和[驳回提交]的费用才能提交审核,请重新选择',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
} else {
var urlVal = "../../AuditProcess/AuditService.aspx?handle=audit&oplb=" + this.stroplb + "&id=" + rec.data.GId + "&val=" + NewGuid();
Ext.Ajax.request({
async: false,
url: urlVal,
success: function (response) {
loadVal = response.responseText;
postCount++;
if (loadVal > 0) {
iSuccess++;
if (iSuccess == 1) {
postBillNO = rec.data.GId;
}
} else {
iFailure++;
}
}
})
}
}
if (postCount > 0) {
if (loadVal != 10 && loadVal > 0) {
//向审核人发送申请消息
var postUrlVal = "../../message/messageservice.aspx?billno=" + postBillNO + "&type=1&oplb=" + this.stroplb + "&handle=postmessage&bsno=" + this.strAmendBSNO + "&uid=" + NewGuid(); ;
Ext.Ajax.request({
url: postUrlVal,
success: function (response) {
loadVal = response.responseText;
}
})
}
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: "提交应收费用审核 " + postCount + " 条 成功 " + iSuccess + " 条 失败 " + iFailure + " 条", icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
if (type == 1) {
this.storeDrChFee.load({ params: { billno: this.strAmendBSNO, type: 1, optype: this.stroplb} });
} else {
this.storeCrChFee.load({ params: { billno: this.strAmendBSNO, type: 2, optype: this.stroplb} });
}
// Shipping.MsChFeeAudit(records, 2, '正在提交审核数据, 请稍侯..');
},
onSubmitAuditNewClick: function (button, event, type) {
var GidStr = '';
var allow = this.getAllowOperationDetail();
if (allow == false) {
return;
}
var store = null;
if (type == 1) {
store = this.storeDrChFee;
} else if (type == 2) {
store = this.storeCrChFee;
} else {
alert(Zi.LAN.FEE.HanShuCanShuSheZhiBuDui);
return;
}
//var modifyrecords = store.getUpdatedRecords(); // 获取修改的行的数据,无法获取幻影数据
//var phantoms = store.getNewRecords(); //获得幻影行
//modifyrecords = modifyrecords.concat(phantoms); //将幻影数据与真实数据合并
//if (modifyrecords.length != 0) {
// Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: Zi.LAN.FEE.QingXianBaoCunFeiYong, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
// return;
//}
if (type == '1') {
var records = this.feeDrGridCheckBoxModel.selected.items;
} else if (type == '2') {
var records = this.feeCrGridCheckBoxModel.selected.items;
};
if (records.length == 0) {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: Zi.LAN.FEE.QingXianXuanZeYaoTiJiaoShenHeDeFeiYong, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var insert;
for (var i = 0; i < records.length; i++) {
var rec = records[i];
var bsno = rec.data.BsNo;
if (bsno == '*') {
insert = true;
}
var custname = rec.data.CustomerName;
if (custname == '') {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: Zi.LAN.FEE.KeHuMingChengBuNengWeiKong, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
var FeeName = rec.data.FeeName;
if (FeeName == '') {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: Zi.LAN.FEE.FeiYongMingChengBuNengWeiKong, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
var Currency = rec.data.Currency;
if (Currency == '') {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: Zi.LAN.FEE.BiBieBuNengWeiKong, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
var ExChangerate = rec.data.ExChangerate;
if (ExChangerate == 0) {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: Zi.LAN.FEE.HuiLvBuNengWeiLing, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
var Amount = rec.data.Amount;
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;
};
if (this.FEEMANGERMUSTBE == 1) {
var MANAGER = rec.data.MANAGER;
if (MANAGER == '') {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: Zi.LAN.FEE.MANAGERWeiKongBuNengTiJiao, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
}
}
//if (insert == true) {
// Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: Zi.LAN.FEE.QingXianBaoCunFeiYong, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
// return;
//}
var iSuccess = 0;
var iFailure = 0;
var postCount = 0;
var postBillNO = "";
var loadVal = 0;
var bodyDrChFeeDatas = [];
for (var i = 0; i < records.length; i++) {
var rec = records[i];
var feeStatus = rec.data.FeeStatus;
var Gid = rec.data.GId;
var canDelete = feeStatus == 1 || feeStatus == 6;
if (canDelete == false) {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi,
msg: Zi.LAN.FEE.ZiNengTiJiaoFuHeTiaoJianDeFeiYong, //'只能费用状态为[录入状态]和[驳回提交]的费用才能提交审核,请重新选择',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
} else {
bodyDrChFeeDatas.push(rec);
if (GidStr == '')
GidStr = Gid;
else {
GidStr = GidStr + ',' + Gid;
}
}
}
_thisAmendfee = this;
if (GidStr == '') {
} else {
var jsonChFeeBody = ConvertRecordsToJsonAll(bodyDrChFeeDatas);
Ext.Ajax.request({
waitMsg: Zi.LAN.FEE.ZhengZaiCaoZuoShuJu, //'正在添加数据...',
url: '/Account/Chfee_Audit/SubmitAuditNewAmend',
params: {
feebody: jsonChFeeBody,
optype: _thisAmendfee.stroplb,
bsno: _thisAmendfee.strAmendBSNO
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title: Zi.LAN.FEE.TiShi,
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
} else {
if (type == 1) {
_thisAmendfee.storeDrChFee.load({ params: { billno: _thisAmendfee.strAmendBSNO, type: 1, optype: _thisAmendfee.stroplb} });
} else {
_thisAmendfee.storeCrChFee.load({ params: { billno: _thisAmendfee.strAmendBSNO, type: 2, optype: _thisAmendfee.stroplb} });
}
}
} else {
Ext.MessageBox.alert(Zi.LAN.FEE.FuWuQiXiangYingChuCuo, response.responseText);
}
},
scope: this
});
}
},
onCancelAuditNewClick: function (menu, event, type) {
var GidStr = '';
var allow = this.getAllowOperationDetail();
if (allow == false) {
return;
}
var store = null;
if (type == 1) {
store = this.storeDrChFee;
} else if (type == 2) {
store = this.storeCrChFee;
} else {
alert(Zi.LAN.FEE.HanShuCanShuSheZhiBuDui);
return;
}
var modifyrecords = store.getUpdatedRecords(); // 获取修改的行的数据,无法获取幻影数据
var phantoms = store.getNewRecords(); //获得幻影行
modifyrecords = modifyrecords.concat(phantoms); //将幻影数据与真实数据合并
if (modifyrecords.length != 0) {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: Zi.LAN.FEE.QingXianBaoCunFeiYong, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); //有未保存的费用,请先保存费用然后再撤销提交!
return;
}
if (type == '1') {
var records = this.feeDrGridCheckBoxModel.selected.items;
} else if (type == '2') {
var records = this.feeCrGridCheckBoxModel.selected.items;
};
if (records.length == 0) {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: Zi.LAN.FEE.QingXianXuanZeFeiYong, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); //请先选择要撤销提交的费用!
return;
}
var iSuccess = 0;
var iFailure = 0;
var postCount = 0;
var postBillNO = "";
var loadVal = 0;
for (var i = 0; i < records.length; i++) {
var rec = records[i];
var feeStatus = rec.data.FeeStatus;
var Gid = rec.data.GId;
var canDelete = feeStatus == 2;
if (canDelete == false) {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi,
msg: Zi.LAN.FEE.ZiNengTiJiaoFuHeTiaoJianDeFeiYong2, //'只能费用状态为[提交审核]的费用才能撤销提交审核,请重新选择',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
} else {
if (GidStr == '')
GidStr = Gid;
else {
GidStr = GidStr + ',' + Gid;
}
}
}
_thisAmendfee = this;
if (GidStr == '') {
} else {
Ext.Ajax.request({
waitMsg: Zi.LAN.FEE.ZhengZaiCaoZuoShuJu, //'正在添加数据...',
url: '/Account/Chfee_Audit/CancelAuditAmend',
params: {
GidStr: GidStr,
optype: _thisAmendfee.stroplb
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title: Zi.LAN.FEE.TiShi,
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
} else {
if (type == 1) {
_thisAmendfee.storeDrChFee.load({ params: { billno: _thisAmendfee.strAmendBSNO, type: 1, optype: _thisAmendfee.stroplb} });
} else {
_thisAmendfee.storeCrChFee.load({ params: { billno: _thisAmendfee.strAmendBSNO, type: 2, optype: _thisAmendfee.stroplb} });
}
}
} else {
Ext.MessageBox.alert(Zi.LAN.FEE.FuWuQiXiangYingChuCuo, response.responseText);
}
},
scope: this
});
}
},
onSubmitAuditBillClick: function (button, event, type) {
var GidStr = '';
var allow = this.getAllowOperationDetail();
if (allow == false) {
return;
}
var store = null;
if (type == 1) {
store = this.storeDrChFee;
} else if (type == 2) {
store = this.storeCrChFee;
} else {
alert(Zi.LAN.FEE.HanShuCanShuSheZhiBuDui);
return;
}
for (var i = 0; i < this.storeDrChFee.getCount(); i++) {
var rec = this.storeDrChFee.getAt(i);
var bsno = rec.data.BsNo;
if (bsno == '*') {
insert = true;
}
var custname = rec.data.CustomerName;
if (custname == '') {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: Zi.LAN.FEE.KeHuMingChengBuNengWeiKong, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
var FeeName = rec.data.FeeName;
if (FeeName == '') {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: Zi.LAN.FEE.FeiYongMingChengBuNengWeiKong, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
var Currency = rec.data.Currency;
if (Currency == '') {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: Zi.LAN.FEE.BiBieBuNengWeiKong, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
var ExChangerate = rec.data.ExChangerate;
if (ExChangerate == 0) {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: Zi.LAN.FEE.HuiLvBuNengWeiLing, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
var Amount = rec.data.Amount;
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;
};
if (this.FEEMANGERMUSTBE == 1) {
var MANAGER = rec.data.MANAGER;
if (MANAGER == '') {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: Zi.LAN.FEE.MANAGERWeiKongBuNengTiJiao, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
}
}
for (var i = 0; i < this.storeCrChFee.getCount(); i++) {
var rec = this.storeCrChFee.getAt(i);
var bsno = rec.data.BsNo;
if (bsno == '*') {
insert = true;
}
var custname = rec.data.CustomerName;
if (custname == '') {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: Zi.LAN.FEE.KeHuMingChengBuNengWeiKong, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
var FeeName = rec.data.FeeName;
if (FeeName == '') {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: Zi.LAN.FEE.FeiYongMingChengBuNengWeiKong, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
var Currency = rec.data.Currency;
if (Currency == '') {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: Zi.LAN.FEE.BiBieBuNengWeiKong, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
var ExChangerate = rec.data.ExChangerate;
if (ExChangerate == 0) {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: Zi.LAN.FEE.HuiLvBuNengWeiLing, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
var Amount = rec.data.Amount;
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;
};
if (this.FEEMANGERMUSTBE == 1) {
var MANAGER = rec.data.MANAGER;
if (MANAGER == '') {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: Zi.LAN.FEE.MANAGERWeiKongBuNengTiJiao, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
}
}
var modifyrecords = this.storeDrChFee.getUpdatedRecords(); // 获取修改的行的数据,无法获取幻影数据
var phantoms = this.storeDrChFee.getNewRecords(); //获得幻影行
modifyrecords = modifyrecords.concat(phantoms); //将幻影数据与真实数据合并
var crmodifyrecords = this.storeCrChFee.getUpdatedRecords(); // 获取修改的行的数据,无法获取幻影数据
var crphantoms = this.storeCrChFee.getNewRecords(); //获得幻影行
crmodifyrecords = crmodifyrecords.concat(crphantoms); //将幻影数据与真实数据合并
if (modifyrecords.length != 0 || crmodifyrecords.length != 0) {
var bodyDrChFeeDatas = [];
var i;
for (i = 0; i < this.storeDrChFee.getCount(); i += 1) {
var memberyf = this.storeDrChFee.getAt(i);
bodyDrChFeeDatas.push(memberyf);
var ExChangerate = memberyf.data.ExChangerate;
};
for (i = 0; i < this.storeCrChFee.getCount(); i += 1) {
var memberyf = this.storeCrChFee.getAt(i);
bodyDrChFeeDatas.push(memberyf);
var amount = memberyf.data.Amount;
var ExChangerate = memberyf.data.ExChangerate;
};
var jsonChFeeBody = ConvertFeeRecordsToJson(bodyDrChFeeDatas);
_thisAmendfee = this;
Ext.Msg.wait(Zi.LAN.FEE.ZhengZaiCaoZuoShuJu);
Ext.Ajax.request({
waitMsg: Zi.LAN.FEE.ZhengZaiCaoZuoShuJu, //'正在保存数据...',
url: '/MvcShipping/MsChFee/Save',
scope: this,
params: {
bsno: _thisAmendfee.strAmendBSNO,
type: type,
chfeebody: jsonChFeeBody
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
for (var i = 0; i < this.storeDrChFee.getCount(); i += 1) {
var member = this.storeDrChFee.getAt(i);
member.set("BsNo", _thisAmendfee.strAmendBSNO);
member.commit();
}
for (var i = 0; i < this.storeCrChFee.getCount(); i += 1) {
var member = this.storeCrChFee.getAt(i);
member.set("BsNo", _thisAmendfee.strAmendBSNO);
member.commit();
}
this.onSubmitAuditBillfn(button, event, type);
} else {
Ext.Msg.show({ title: Zi.LAN.FEE.ChuoWu, msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
} else {
Ext.Msg.show({
title: Zi.LAN.FEE.TiShi,
msg: Zi.LAN.FEE.FuWuQiXiangYingChuCuo,
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
}
});
} else {
this.onSubmitAuditBillfn(button, event, type);
}
},
onSubmitAuditBillfn: function (button, event, type) {
var GidStr = '';
var bsno = _thisAmendfee.strAmendBSNO;
var bodyDrChFeeDatas = [];
for (var i = 0; i < this.storeDrChFee.getCount(); i++) {
var rec = this.storeDrChFee.getAt(i);
var feeStatus = rec.data.FeeStatus;
var Gid = rec.data.GId;
var canDelete = feeStatus == 1 || feeStatus == 6;
if (canDelete == false) {
} else {
bodyDrChFeeDatas.push(rec);
GidStr = GidStr + ',' + Gid;
}
}
for (var i = 0; i < this.storeCrChFee.getCount(); i++) {
var rec = this.storeCrChFee.getAt(i);
var feeStatus = rec.data.FeeStatus;
var Gid = rec.data.GId;
var canDelete = feeStatus == 1 || feeStatus == 6;
if (canDelete == false) {
} else {
bodyDrChFeeDatas.push(rec);
GidStr = GidStr + ',' + Gid;
}
}
_thisAmendfee = this;
//if (GidStr == '') {
if (1 == 2) {
} else {
var jsonChFeeBody = ConvertRecordsToJsonAll(bodyDrChFeeDatas);
urlStr = '/Account/Chfee_Audit/SubmitAuditBLAmend';
Ext.Ajax.request({
waitMsg: Zi.LAN.FEE.ZhengZaiCaoZuoShuJu, //'正在添加数据...',
url: urlStr,
params: {
feebody: jsonChFeeBody,
optype: _thisAmendfee.stroplb,
bsno: bsno
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title: Zi.LAN.FEE.TiShi,
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
} else {
_thisAmendfee.storeDrChFee.load({ params: { billno: _thisAmendfee.strAmendBSNO, type: 1, optype: _thisAmendfee.stroplb } });
_thisAmendfee.storeCrChFee.load({ params: { billno: _thisAmendfee.strAmendBSNO, type: 2, optype: _thisAmendfee.stroplb } });
if (result.Data != '' && result.Data != null) {
Ext.Msg.show({
title: Zi.LAN.FEE.TiShi,
msg: '已提交审核,' + result.Data,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
}
Ext.Ajax.request({
waitMsg: Zi.LAN.FEE.ZhengZaiChaXunShuJu, //'正在组织数据...',
url: '/MvcShipping/MsChFee/GetFeeLock',
scope: this,
params: {
bsno: _thisAmendfee.strAmendBSNO
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
_thisAmendfee.EditRecord.set('FEESTATUS', true);
} else {
}
} else {
Ext.Msg.show({
title: Zi.LAN.FEE.TiShi,
msg: Zi.LAN.FEE.FuWuQiXiangYingChuCuo,
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
}
});
}
} else {
Ext.MessageBox.alert(Zi.LAN.FEE.FuWuQiXiangYingChuCuo, response.responseText);
}
},
scope: this
});
}
},
onCancelSubmitAuditBillClick: function () {
var bsno = _thisAmendfee.strAmendBSNO;
Ext.Ajax.request({
waitMsg: Zi.LAN.FEE.ZhengZaiCaoZuoShuJu, //'正在添加数据...',
url: '/Account/Chfee_Audit/CancelAuditBL',
params: {
bsno: bsno
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title: Zi.LAN.FEE.TiShi,
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
} else {
_thisAmendfee.storeDrChFee.load({ params: { billno: _thisAmendfee.strAmendBSNO, type: 1, optype: _thisAmendfee.stroplb } });
_thisAmendfee.storeCrChFee.load({ params: { billno: _thisAmendfee.strAmendBSNO, type: 2, optype: _thisAmendfee.stroplb } });
if (result.Data != '' && result.Data != null) {
Ext.Msg.show({
title: Zi.LAN.FEE.TiShi,
msg: '已提交审核,' + result.Data,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
}
}
} else {
Ext.MessageBox.alert(Zi.LAN.FEE.FuWuQiXiangYingChuCuo, response.responseText);
}
},
scope: this
});
},
onViewWorkFlowDetailClick: function (button, event, type) {
if (type == '1') {
var records = this.feeDrGridCheckBoxModel.selected.items;
} else if (type == '2') {
var records = this.feeCrGridCheckBoxModel.selected.items;
};
if (records.length == 0) {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: Zi.LAN.FEE.QingXianXuanZeFeiYong, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var record = records[0];
var feeStatus = record.data.FeeStatus;
var Gid = record.data.GId;
var WorkFlowName = "FeeOpOpOtherRecvPayAudit";
if (this.AMENDSELFWORKFLOW == 1) {
WorkFlowName = "AmendFeefyAudit";
} else {
if (feeStatus == 3 || feeStatus == 4) {
WorkFlowName = "FeeOpOtherModifyAudit";
if (this.stroplb == "op_Seae") {
WorkFlowName = "FeeModifyAudit";
} if (this.stroplb == "op_Seai") {
WorkFlowName = "FeeSeaiModifyAudit";
} if (this.stroplb == "op_Aire") {
WorkFlowName = "AireFeeModify";
} if (this.stroplb == "op_Airi") {
WorkFlowName = "AiriFeeModify";
} if (this.stroplb == "op_Apply") {
WorkFlowName = "ApplyFeeModify";
} if (this.stroplb == "op_Bulk") {
WorkFlowName = "BulkFeeModify";
} if (this.stroplb == "op_other" || this.stroplb == "tMsWlPcHead" || this.stroplb == "OpCtnBsCard") {
WorkFlowName = "FeeOpOtherModifyAudit";
} if (this.stroplb == "op_railway") {
WorkFlowName = "RailwayFeeModify";
}
} else {
if (this.stroplb == "op_Seae") {
WorkFlowName = "FeeRecvPayAudit";
} if (this.stroplb == "op_Seai") {
WorkFlowName = "FeeSeaiRecvPayAudit";
} if (this.stroplb == "op_Aire") {
WorkFlowName = "AireFeeAudit";
} if (this.stroplb == "op_Airi") {
WorkFlowName = "AiriFeeAudit";
} if (this.stroplb == "op_Apply") {
WorkFlowName = "ApplyFeeAudit";
} if (this.stroplb == "op_Bulk") {
WorkFlowName = "BulkFeeAudit";
} if (this.stroplb == "op_other" || this.stroplb == "tMsWlPcHead" || this.stroplb == "OpCtnBsCard") {
WorkFlowName = "FeeOpOpOtherRecvPayAudit";
} if (this.stroplb == "op_railway") {
WorkFlowName = "RailwayFeeAudit";
}
}
}
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 = "";
var openUrl = "../../Account/Chfee_payapplication/Map?bsno=" + Gid + "&name=" + WorkFlowName;
window.open(openUrl, openType, openSet);
},
getModifyStatus: function () {
var amendmodify = this.storeAmendBill.getModifiedRecords();
var drmodify = this.storeDrChFee.getModifiedRecords();
var crmodify = this.storeCrChFee.getModifiedRecords();
if (drmodify.length != 0 || crmodify.length != 0 || amendmodify.length != 0) {
return true
} else {
for (i = 0; i < this.storeDrChFee.getCount(); i += 1) {
var memberyf = this.storeDrChFee.getAt(i);
if (memberyf.data.BsNo == "*")
return true
}
for (i = 0; i < this.storeCrChFee.getCount(); i += 1) {
var memberyf = this.storeCrChFee.getAt(i);
if (memberyf.data.BsNo == "*")
return true
}
for (i = 0; i < this.storeAmendBill.getCount(); i += 1) {
var memberyf = this.storeAmendBill.getAt(i);
if (memberyf.data.ACCDATE == "")
return true
}
return false;
}
},
loadUnit: function () {
this.StoreUnit.reload();
},
getFeeStatus: function () {
var feeStatus = this.AmendFeeStatus;
return feeStatus;
},
getBillStatus: function () {
// var basicForm = this.formEdit.getForm();
// var billStatus = basicForm.findField('BillStatus').value;
// return billStatus;
},
getCustName: function () {
// var custName = this.formEdit.getForm().findField('RefCustomerName');
//return custName.getValue();
},
setTotalHead: function () {
var rmbdr = 0;
var rmbcr = 0;
var usddr = 0;
var usdcr = 0;
var otdr = 0;
var otcr = 0;
var ttldr = 0;
var ttlcr = 0;
var rmbprofit = 0;
var usdprofit = 0;
var otprofit = 0;
var ttlprofit = 0;
var profitrate = 0;
var amendstr = '';
for (i = 0; i < this.storeBodySum.getCount(); i += 1) {
var memberyf = this.storeBodySum.getAt(i);
if (memberyf.data.CURR == LOCALCURR) {
amendstr = memberyf.data.AMENDSTR;
rmbdr = memberyf.data.DR;
rmbcr = memberyf.data.CR;
rmbprofit = memberyf.data.PR;
} else if (memberyf.data.CURR == 'USD') {
usddr = memberyf.data.DR;
usdcr = memberyf.data.CR;
usdprofit = memberyf.data.PR;
} if (memberyf.data.CURR == '其他币别') {
otdr = memberyf.data.DR;
otcr = memberyf.data.CR;
otprofit = memberyf.data.PR;
} if (memberyf.data.CURR == '合计') {
ttldr = memberyf.data.DR;
ttlcr = memberyf.data.CR;
ttlprofit = memberyf.data.PR;
profitrate = memberyf.data.PROFITRATE;
}
}
var rmblb = "";
var usdlb = "";
var otlb = "";
var ttllb = "";
if (rmbdr != 0 || rmbcr != 0 || (rmbprofit != 0 && rmbprofit != "***")) {
rmblb = "   " + LOCALCURR + "应收:" + returnfloat(rmbdr) + "    " + LOCALCURR + "应付: " + returnfloat(rmbcr) + "   " + LOCALCURR + "利润:" + returnfloat(rmbprofit) + "   |";
// rmblb = "统计信息(文字标题)(字段名-中文):(字段值-负值)(字段名-中文):(字段值-正值)";
}
if (usddr != 0 || usdcr != 0 || (usdprofit != 0 && usdprofit != "***")) {
usdlb = "   USD应收: " + returnfloat(usddr) + "   USD应付:" + returnfloat(usdcr) + "   USD利润" + returnfloat(usdprofit) + "   |";
}
if (otdr != 0 || otcr != 0 || (otprofit != 0 && otprofit != "***")) {
otlb = "   其他币别应收: " + returnfloat(otdr) + "    其他币别应付:" + returnfloat(otcr) + "   其他币别利润" + returnfloat(otprofit) + "   |";
}
if (ttldr != 0 || ttlcr != 0 || (ttlprofit != 0 && ttlprofit != "***")) {
ttllb = "   合计应收: " + returnfloat(ttldr) + "   合计应付:" + returnfloat(ttlcr) + "   合计利润" + returnfloat(ttlprofit) + "  利润率" + returnfloat(profitrate) + "";
}
this.formtotal.setTitle("利润合计:" + rmblb + usdlb + otlb + ttllb);
},
setBLTotalHead: function () {
var rmbdr = 0;
var rmbcr = 0;
var usddr = 0;
var usdcr = 0;
var otdr = 0;
var otcr = 0;
var ttldr = 0;
var ttlcr = 0;
var rmbprofit = 0;
var usdprofit = 0;
var otprofit = 0;
var ttlprofit = 0;
var profitrate = 0;
var amendstr = '';
for (i = 0; i < this.storeBodyBLSum.getCount(); i += 1) {
var memberyf = this.storeBodyBLSum.getAt(i);
if (memberyf.data.CURR == LOCALCURR) {
amendstr = memberyf.data.AMENDSTR;
rmbdr = memberyf.data.DR;
rmbcr = memberyf.data.CR;
rmbprofit = memberyf.data.PR;
} else if (memberyf.data.CURR == 'USD') {
usddr = memberyf.data.DR;
usdcr = memberyf.data.CR;
usdprofit = memberyf.data.PR;
} if (memberyf.data.CURR == '其他币别') {
otdr = memberyf.data.DR;
otcr = memberyf.data.CR;
otprofit = memberyf.data.PR;
} if (memberyf.data.CURR == '合计') {
ttldr = memberyf.data.DR;
ttlcr = memberyf.data.CR;
ttlprofit = memberyf.data.PR;
profitrate = memberyf.data.PROFITRATE;
}
}
var rmblb = "";
var usdlb = "";
var otlb = "";
var ttllb = "";
if (rmbdr != 0 || rmbcr != 0 || (rmbprofit != 0 && rmbprofit != "***")) {
rmblb = "   " + LOCALCURR + "应收:" + returnfloat(rmbdr) + "    " + LOCALCURR + "应付: " + returnfloat(rmbcr) + "   " + LOCALCURR + "利润:" + returnfloat(rmbprofit) + "   |";
// rmblb = "统计信息(文字标题)(字段名-中文):(字段值-负值)(字段名-中文):(字段值-正值)";
}
if (usddr != 0 || usdcr != 0 || (usdprofit != 0 && usdprofit != "***")) {
usdlb = "   USD应收: " + returnfloat(usddr) + "   USD应付:" + returnfloat(usdcr) + "   USD利润" + returnfloat(usdprofit) + "   |";
}
if (otdr != 0 || otcr != 0 || (otprofit != 0 && otprofit != "***")) {
otlb = "   其他币别应收: " + returnfloat(otdr) + "    其他币别应付:" + returnfloat(otcr) + "   其他币别利润" + returnfloat(otprofit) + "   |";
}
if (ttldr != 0 || ttlcr != 0 || (ttlprofit != 0 && ttlprofit != "***")) {
ttllb = "   合计应收: " + returnfloat(ttldr) + "   合计应付:" + returnfloat(ttlcr) + "   合计利润" + returnfloat(ttlprofit) + "  利润率" + returnfloat(profitrate) + "";
}
this.panelFee.setTitle(Zi.LAN.FEE.GengGaiDanFeiYongMingXi + " 原票利润合计:" + rmblb + usdlb + otlb + ttllb);
},
setSaveBtnStatus: function (enable) {
var bsbtnSave = Ext.getCmp('pcbtnSave');
var bsbtnSaveAndClose = Ext.getCmp('pcbtnSaveAndClose');
var bsbtnSaveAndNew = Ext.getCmp('pcbtnSaveAndNew');
var pcbtnNew = Ext.getCmp('pcbtnNew');
var btnFeeSaveDr = Ext.getCmp('btnFeeSaveDr');
var btnFeeSavCr = Ext.getCmp('btnFeeSaveCr');
if (enable) {
bsbtnSave.enable();
bsbtnSaveAndClose.enable();
bsbtnSaveAndNew.enable();
pcbtnNew.enable();
btnFeeSaveDr.enable();
btnFeeSaveCr.enable();
} else {
//bsbtnSave.disable();
//bsbtnSaveAndClose.disable();
bsbtnSaveAndNew.disable();
pcbtnNew.disable();
// btnFeeSaveDr.enable();
// btnFeeSaveCr.enable();
}
},
onPrintSelectDetailClick: function (button, event, type) {
// alert(this.StoreBill.getAt(0).get('MBLNO'));
//var allow = this.getAllowOperationDetail();
//if (allow == false) {
// return;
//}
var USDEXRATE = 0;
var FFrecords = DsStoreQueryBy(this.StoreDateCurr, 'CURR', 'USD');
if (FFrecords.getCount() > 0) {
var ffdata = FFrecords.getAt(0).data;
USDEXRATE = ffdata.DEFRATE;
} else {
var DFrecords = DsStoreQueryBy(this.StoreCurr, 'CURR', 'USD');
if (DFrecords.getCount() > 0) {
var dfdata = DFrecords.getAt(0).data;
USDEXRATE = dfdata.DEFRATE;
}
}
var selectedRecords = [];
var storeadd = null;
if (type == 1) {
selectedRecords = this.feeDrGridCheckBoxModel.selected.items;
} else if (type == 2) {
selectedRecords = this.feeCrGridCheckBoxModel.selected.items;
} else {
alert(Zi.LAN.FEE.HanShuCanShuSheZhiBuDui);
return;
}
if (selectedRecords.length == 0) {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: Zi.LAN.FEE.QingXianXuanZeYeWu, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); //请先选择要打印的费用!
return;
}
if (this.stroplb == 'op_Seae') {
var printType = '';
if (type == 1) {
printType = 'SEAEDRFEE';
} else { printType = 'SEAECRFEE'; };
var sql1 = "SET LANGUAGE 'us_english' "
+ " select * from op_seae WHERE BsNo = '" + this.strBSNO + "'";
} else if (this.stroplb == 'op_Apply') {
var printType = '';
if (type == 1) {
printType = 'APPLYDRFEE';
} else { printType = 'APPLYCRFEE'; };
var sql1 = "SET LANGUAGE 'us_english' "
+ " select * from op_apply WHERE BsNo = '" + this.strBSNO + "'";
} else if (this.stroplb == 'op_Seai') {
var printType = '';
if (type == 1) {
printType = 'SEAIDRFEE';
} else { printType = 'SEAICRFEE'; };
var sql1 = /*"SET LANGUAGE 'us_english' "
+ */" select * from op_seai WHERE BsNo = '" + this.strBSNO + "'";
} else if (this.stroplb == 'op_Bulk') {
var printType = '';
if (type == 1) {
printType = 'BULKDRFEE';
} else { printType = 'BULKCRFEE'; };
var sql1 = /*"SET LANGUAGE 'us_english' "
+ */" select * from op_bulk WHERE BsNo = '" + this.strBSNO + "'";
} else if (this.stroplb == 'op_other') {
var printType = '';
if (type == 1) {
printType = 'OTHERDRFEE';
} else { printType = 'OTHERCRFEE'; };
var sql1 = /*"SET LANGUAGE 'us_english' "
+ */" select * from op_other WHERE BsNo = '" + this.strBSNO + "'";
} else if (this.stroplb == 'op_railway') {
var printType = '';
if (type == 1) {
printType = 'RAILWAYDRFEE';
} else { printType = 'RAILWAYCRFEE'; };
var sql1 = /*"SET LANGUAGE 'us_english' "
+ */" select * from op_railway WHERE BsNo = '" + this.strBSNO + "'";
} else if (this.stroplb == 'op_Aire') {
var printType = '';
if (type == 1) {
printType = 'AIREDRFEE';
} else { printType = 'AIRECRFEE'; };
var sql1 = /*"SET LANGUAGE 'us_english' "
+ */" select * from op_aire WHERE BsNo = '" + this.strBSNO + "'";
} else if (this.stroplb == 'op_Airi') {
var printType = '';
if (type == 1) {
printType = 'AIRIDRFEE';
} else { printType = 'AIRICRFEE'; };
var sql1 = /*"SET LANGUAGE 'us_english' "
+ */" select * from op_airi WHERE BsNo = '" + this.strBSNO + "'";
};
var sql2 = "SET LANGUAGE 'us_english' SELECT * from ch_fee where BsNo='" + this.strAmendBSNO + "'";
var feeGidSql = '';
for (var i = 0; i < selectedRecords.length; i++) {
var record = selectedRecords[i];
var feeGId = "'" + record.get('GId') + "'";
if (feeGidSql == '') {
feeGidSql = feeGId;
} else {
feeGidSql = feeGidSql + "," + feeGId;
}
};
if (feeGidSql != '') {
sql2 = sql2 + ' and Gid in (' + feeGidSql + ')';
}
var sql3 = "";
if (feeGidSql != '') {
sql3 = sql3 + " Select c.*,(select showname from [user] where gid=c.enteroperator) as 录入人,(select DESCRIPTION from info_client where SHORTNAME=c.CUSTOMERNAME) CUSTFULLNAME from ch_fee c where c.Gid in (" + feeGidSql + ") order by sort,LineNum ";
}
var sql4 = " Select ic.*,icc.showname,icc.addr from info_client ic ";
sql4 = sql4 + " left join info_client_contact icc on icc.linkid=ic.gid where shortname=(select customername from v_op_bill where bsno='" + this.strAmendBSNO + "')";
var sql5 = "";
var sql6 = " SELECT " + USDEXRATE + " AS USDEXRATE FROM [USER]";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
},
onPrintDebitClick: function (button, event, type) {
var MBLNO = "";
var USDEXRATE = 0;
var FFrecords = DsStoreQueryBy(this.StoreDateCurr, 'CURR', 'USD');
if (FFrecords.getCount() > 0) {
var ffdata = FFrecords.getAt(0).data;
USDEXRATE = ffdata.DEFRATE;
} else {
var DFrecords = DsStoreQueryBy(this.StoreCurr, 'CURR', 'USD');
if (DFrecords.getCount() > 0) {
var dfdata = DFrecords.getAt(0).data;
USDEXRATE = dfdata.DEFRATE;
}
}
var records = [];
var storeadd = null;
if (type == 1) {
records = this.feeDrGridCheckBoxModel.selected.items;
MBLNO = this.strMBLNO + Zi.LAN.FEE.DRFEESTATUS;
} else if (type == 2) {
records = this.feeCrGridCheckBoxModel.selected.items;
MBLNO = this.strMBLNO + Zi.LAN.FEE.DRFEESTATUS;
} else {
alert(Zi.LAN.FEE.HanShuCanShuSheZhiBuDui);
return;
}
if (records.length == 0) {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: Zi.LAN.FEE.QingXianXuanZeYeWu, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var bodyDrChFeeDatas = [];
for (var i = 0; i < records.length; i++) {
var rec = records[i];
bodyDrChFeeDatas.push(rec);
}
var jsonChFeeBody = ConvertRecordsToJsonAll(bodyDrChFeeDatas);
var debitno = '11';
Ext.Msg.wait(Zi.LAN.FEE.ZhengZaiChaXunShuJu);
Ext.Ajax.request({
waitMsg: Zi.LAN.FEE.ZhengZaiChaXunShuJu, //'正在组织数据...',
url: '/MvcShipping/MsChFee/CreateDui',
scope: this,
params: {
list: jsonChFeeBody
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
debitno = jsonresult.Data;
if (this.stroplb == 'op_Seae') {
var printType = '';
if (type == 1) {
printType = 'SEAEDRDEBITFEE';
} else { printType = 'SEAECRDEBITFEE'; };
var sql1 = "SET LANGUAGE 'us_english' "
+ " select * from op_seae WHERE BsNo = '" + this.strBSNO + "'";
} else if (this.stroplb == 'op_Apply') {
var printType = '';
if (type == 1) {
printType = 'APPLYDRDEBITFEE';
} else { printType = 'APPLYCRDEBITFEE'; };
var sql1 = "SET LANGUAGE 'us_english' "
+ " select * from op_apply WHERE BsNo = '" + this.strBSNO + "'";
} else if (this.stroplb == 'op_Seai') {
var printType = '';
if (type == 1) {
printType = 'SEAIDRDEBITFEE';
} else { printType = 'SEAICRDEBITFEE'; };
var sql1 = /*"SET LANGUAGE 'us_english' "
+ */" select * from op_seai WHERE BsNo = '" + this.strBSNO + "'";
} else if (this.stroplb == 'op_Bulk') {
var printType = '';
if (type == 1) {
printType = 'BULKDRDEBITFEE';
} else { printType = 'BULKCRDEBITFEE'; };
var sql1 = /*"SET LANGUAGE 'us_english' "
+ */" select * from op_bulk WHERE BsNo = '" + this.strBSNO + "'";
} else if (this.stroplb == 'op_other') {
var printType = '';
if (type == 1) {
printType = 'OTHERDRDEBITFEE';
} else { printType = 'OTHERCRDEBITFEE'; };
var sql1 = /*"SET LANGUAGE 'us_english' "
+ */" select * from op_other WHERE BsNo = '" + this.strBSNO + "'";
} else if (this.stroplb == 'op_railway') {
var printType = '';
if (type == 1) {
printType = 'RAILWAYDRDEBITFEE';
} else { printType = 'RAILWAYCRDEBITFEE'; };
var sql1 = /*"SET LANGUAGE 'us_english' "
+ */" select * from op_railway WHERE BsNo = '" + this.strBSNO + "'";
} else if (this.stroplb == 'op_Aire') {
var printType = '';
if (type == 1) {
printType = 'AIREDRDEBITFEE';
} else { printType = 'AIRECRDEBITFEE'; };
var sql1 = /*"SET LANGUAGE 'us_english' "
+ */" select * from op_aire WHERE BsNo = '" + this.strBSNO + "'";
} else if (this.stroplb == 'op_Airi') {
var printType = '';
if (type == 1) {
printType = 'AIRIDRDEBITFEE';
} else { printType = 'AIRICRDEBITFEE'; };
var sql1 = /*"SET LANGUAGE 'us_english' "
+ */" select * from op_airi WHERE BsNo = '" + this.strBSNO + "'";
} else if (this.stroplb == 'OpCtnBsCard') {
var printType = '';
if (type == 1) {
printType = 'CTNBSCARDDRDEBITFEE';
} else { printType = 'CTNBSCARDCRDEBITFEE'; };
var sql1 = /*"SET LANGUAGE 'us_english' "
+ */" select * from op_ctnbscard WHERE GID= '" + this.strBSNO + "'";
} else if (this.stroplb == 'import_main') {
var printType = '';
if (type == 1) {
printType = 'IMPORTTRADEDRDEBITFEE';
} else { printType = 'IMPORTTRADECRDEBITFEE'; };
var sql1 = /*"SET LANGUAGE 'us_english' "
+ */" select * from Import_main WHERE ContractNo= '" + this.strBSNO + "'";
};
var sql2 = "";
sql2 = sql2 + " Select c.*,(select showname from [user] where gid=c.enteroperator) as INPUTBYREF,(select DESCRIPTION from info_client where SHORTNAME=c.CUSTOMERNAME) CUSTFULLNAME from ch_fee c where c.STATEMENTNO='" + debitno + "' order by sort,LineNum ";
var sql3 = "";
sql3 = sql3 + " Select c.*,(select showname from [user] where gid=c.enteroperator) as INPUTBYREF,(select DESCRIPTION from info_client where SHORTNAME=c.CUSTOMERNAME) CUSTFULLNAME from ch_fee c where c.STATEMENTNO='" + debitno + "' order by sort,LineNum ";
var sql4 = "";
var sql5 = "";
var sql6 = " SELECT " + USDEXRATE + " AS USDEXRATE FROM [USER]";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6, MBLNO);
} else {
Ext.Msg.show({ title: Zi.LAN.FEE.ChuoWu, msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
} else {
Ext.Msg.show({
title: Zi.LAN.FEE.TiShi,
msg: Zi.LAN.FEE.FuWuQiXiangYingChuCuo,
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
}
});
},
onPrintCustDetailClick: function (button, event, type) {
var MBLNO = "";
var USDEXRATE = 0;
var FFrecords = DsStoreQueryBy(this.StoreDateCurr, 'CURR', 'USD');
if (FFrecords.getCount() > 0) {
var ffdata = FFrecords.getAt(0).data;
USDEXRATE = ffdata.DEFRATE;
} else {
var DFrecords = DsStoreQueryBy(this.StoreCurr, 'CURR', 'USD');
if (DFrecords.getCount() > 0) {
var dfdata = DFrecords.getAt(0).data;
USDEXRATE = dfdata.DEFRATE;
}
}
var selectedRecords = [];
var storeadd = null;
if (type == 1) {
selectedRecords = this.feeDrGridCheckBoxModel.selected.items;
} else if (type == 2) {
selectedRecords = this.feeCrGridCheckBoxModel.selected.items;
} else {
alert(Zi.LAN.FEE.HanShuCanShuSheZhiBuDui); //函数(onAddDetailClick)的参数type类型设置的不对
return;
}
if (selectedRecords.length == 0) {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: Zi.LAN.FEE.QingXianXuanZeYeWu, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
if (this.stroplb == 'op_Seae') {
var printType = '';
if (type == 1) {
printType = 'SEAEDRFEE';
} else { printType = 'SEAECRFEE'; };
var sql1 = "SET LANGUAGE 'us_english' "
+ " select * from op_seae WHERE BsNo = '" + this.strBSNO + "'";
} else if (this.stroplb == 'op_Apply') {
var printType = '';
if (type == 1) {
printType = 'APPLYDRFEE';
} else { printType = 'APPLYCRFEE'; };
var sql1 = "SET LANGUAGE 'us_english' "
+ " select * from op_apply WHERE BsNo = '" + this.strBSNO + "'";
} else if (this.stroplb == 'op_Seai') {
var printType = '';
if (type == 1) {
printType = 'SEAIDRFEE';
} else { printType = 'SEAICRFEE'; };
var sql1 = /*"SET LANGUAGE 'us_english' "
+ */" select * from op_seai WHERE BsNo = '" + this.strBSNO + "'";
} else if (this.stroplb == 'op_Bulk') {
var printType = '';
if (type == 1) {
printType = 'BULKDRFEE';
} else { printType = 'BULKCRFEE'; };
var sql1 = /*"SET LANGUAGE 'us_english' "
+ */" select * from op_bulk WHERE BsNo = '" + this.strBSNO + "'";
} else if (this.stroplb == 'op_other') {
var printType = '';
if (type == 1) {
printType = 'OTHERDRFEE';
} else { printType = 'OTHERCRFEE'; };
var sql1 = /*"SET LANGUAGE 'us_english' "
+ */" select * from op_other WHERE BsNo = '" + this.strBSNO + "'";
} else if (this.stroplb == 'op_railway') {
var printType = '';
if (type == 1) {
printType = 'RAILWAYDRFEE';
} else { printType = 'RAILWAYCRFEE'; };
var sql1 = /*"SET LANGUAGE 'us_english' "
+ */" select * from op_railway WHERE BsNo = '" + this.strBSNO + "'";
} else if (this.stroplb == 'op_Aire') {
var printType = '';
if (type == 1) {
printType = 'AIREDRFEE';
} else { printType = 'AIRECRFEE'; };
var sql1 = /*"SET LANGUAGE 'us_english' "
+ */" select * from op_aire WHERE BsNo = '" + this.strBSNO + "'";
} else if (this.stroplb == 'op_Airi') {
var printType = '';
if (type == 1) {
printType = 'AIRIDRFEE';
} else { printType = 'AIRICRFEE'; };
var sql1 = /*"SET LANGUAGE 'us_english' "
+ */" select * from op_airi WHERE BsNo = '" + this.strBSNO + "'";
};
var custname = '';
var feeGidSql = '';
for (var i = 0; i < selectedRecords.length; i++) {
var record = selectedRecords[i];
custname = record.get('CustomerName');
var FeeType = record.get('FeeType');
var BsNo = record.get('BsNo');
};
if (type == 1) {
MBLNO = this.strMBLNO + "应收费用" + custname;
} else if (type == 2) {
MBLNO = this.strMBLNO + "应付费用" + custname;
}
var sql2 = " declare @sql varchar(8000) ";
sql2 = sql2 + " set @sql = 'select bsno '";
sql2 = sql2 + " select @sql = @sql + ' , sum(case feename when ''' + feename + ''' then amount else 0 end) [' + feename + ']' ";
sql2 = sql2 + " from (select name as feename from code_fee where name in ";
sql2 = sql2 + " ('掏箱费','港杂费','关税','增值税','监管费','滞报金','保证金','滞纳金', ";
sql2 = sql2 + " '二次换单费','换单费','报检费','仓储费','分拨费','港杂费','港建费','港口包干费', ";
sql2 = sql2 + " '验货费','熏蒸费','还柜吊柜费','转栈费','海运费','空运费','捆绑费', ";
sql2 = sql2 + " '铁路运费','公路运费','短途运输费','木检运费','搬倒费','装箱费','修箱费', ";
sql2 = sql2 + " '滞箱费','出入库费','拆箱费','吊箱费',";
sql2 = sql2 + " '国际运费','报关费','保险费','包干费','THC','运费','商检验货费','集装箱费'";
sql2 = sql2 + " )) as a set @sql = @sql + ' from ch_fee where bsno=''" + this.strAmendBSNO + "'' ' ";
if (custname != '') {
sql2 = sql2 + " set @sql = @sql + ' and CustomerName=''" + custname + "'' and Bsno=''" + BsNo + "'' and feetype=" + FeeType + " '";
}
sql2 = sql2 + "set @sql = @sql +' group by bsno ' exec(@sql) ";
var sql3 = "";
sql3 = sql3 + " Select c.*,(select showname from [user] where gid=c.enteroperator) as 录入人,(select DESCRIPTION from info_client where SHORTNAME=c.CUSTOMERNAME) CUSTFULLNAME from ch_fee c where c.CustomerName='" + custname + "' and c.BsNo='" + BsNo + "' and c.feetype=" + FeeType + " order by sort,LineNum ";
var sql4 = " Select ic.*,icc.showname,icc.addr from info_client ic ";
sql4 = sql4 + " left join info_client_contact icc on icc.linkid=ic.gid where shortname=(select customername from v_op_bill where bsno='" + this.strBSNO + "')";
var sql5 = "";
var sql6 = " SELECT " + USDEXRATE + " AS USDEXRATE FROM [USER]";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6, MBLNO);
},
onPrintAllDetailClick: function (button, event, type) {
//var allow = this.getAllowOperationDetail();
//if (allow == false) {
// return;
//}
if (this.stroplb == 'op_Seae') {
var printType = '';
if (type == 1) {
printType = 'SEAEDRFEEALL';
} else { printType = 'SEAECRFEEALL'; };
var sql1 = "SET LANGUAGE 'us_english' "
+ " select * from op_seae WHERE BsNo = '" + this.strBSNO + "'";
} else if (this.stroplb == 'op_Apply') {
var printType = '';
if (type == 1) {
printType = 'APPLYDRFEEALL';
} else { printType = 'APPLYCRFEEALL'; };
var sql1 = "SET LANGUAGE 'us_english' "
+ " select * from op_apply WHERE BsNo = '" + this.strBSNO + "'";
} else if (this.stroplb == 'op_Seai') {
var printType = '';
if (type == 1) {
printType = 'SEAIDRFEEALL';
} else { printType = 'SEAICRFEEALL'; };
var sql1 = "SET LANGUAGE 'us_english' "
+ " select * from op_seai WHERE BsNo = '" + this.strBSNO + "'";
} else if (this.stroplb == 'op_Bulk') {
var printType = '';
if (type == 1) {
printType = 'BULKDRFEEALL';
} else { printType = 'BULKCRFEEALL'; };
var sql1 = "SET LANGUAGE 'us_english' "
+ " select * from op_bulk WHERE BsNo = '" + this.strBSNO + "'";
} else if (this.stroplb == 'op_other') {
var printType = '';
if (type == 1) {
printType = 'OTHERDRFEEALL';
} else { printType = 'OTHERCRFEEALL'; };
var sql1 = "SET LANGUAGE 'us_english' "
+ " select * from op_other WHERE BsNo = '" + this.strBSNO + "'";
} else if (this.stroplb == 'op_railway') {
var printType = '';
if (type == 1) {
printType = 'RAILWAYDRFEEALL';
} else { printType = 'RAILWAYCRFEEALL'; };
var sql1 = "SET LANGUAGE 'us_english' "
+ " select * from op_railway WHERE BsNo = '" + this.strBSNO + "'";
} else if (this.stroplb == 'op_Aire') {
var printType = '';
if (type == 1) {
printType = 'AIREDRFEEALL';
} else { printType = 'AIRECRFEEALL'; };
var sql1 = "SET LANGUAGE 'us_english' "
+ " select * from op_aire WHERE BsNo = '" + this.strBSNO + "'";
} else if (this.stroplb == 'op_Airi') {
var printType = '';
if (type == 1) {
printType = 'AIRIDRFEEALL';
} else { printType = 'AIRICRFEEALL'; };
var sql1 = "SET LANGUAGE 'us_english' "
+ " select * from op_airi WHERE BsNo = '" + this.strBSNO + "'";
};
var sql2 = "SET LANGUAGE 'us_english' SELECT * from ch_fee where BsNo='" + this.strAmendBSNO + "' and FEETYPE=" + type;
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
},
onPrintGainClick: function (button, event, type) {
//var allow = this.getAllowOperationDetail();
//if (allow == false) {
// return;
//}
if (this.FEELOCKNOTPR == 1) {
var feeStatus = this.getFeeStatus();
if (feeStatus == '0' || feeStatus == '' || feeStatus == false || feeStatus == 'false' || typeof (feeStatus) == 'undefined') {
}
else {
Ext.Msg.show({ title: Zi.LAN.FEE.ChuoWu, msg: "此票委托已费用已锁定,不允许打印核算单!", icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
}
if (this.stroplb == 'op_Seae') {
var printType = 'SEAEAGAIN';
var sql1 = "SET LANGUAGE 'us_english' "
+ " select * from op_seae WHERE BSNO = '" + this.strBSNO + "'";
} else if (this.stroplb == 'op_Apply') {
var printType = 'APPLYAGAIN';
var sql1 = "SET LANGUAGE 'us_english' "
+ " select * from op_apply WHERE BSNO = '" + this.strBSNO + "'";
} else if (this.stroplb == 'op_Seai') {
var printType = 'SEAIAGAIN';
var sql1 = "SET LANGUAGE 'us_english' "
+ " select * from op_seai WHERE BSNO = '" + this.strBSNO + "'";
} else if (this.stroplb == 'op_Bulk') {
var printType = 'BULKAGAIN';
var sql1 = "SET LANGUAGE 'us_english' "
+ " select * from op_bulk WHERE BSNO = '" + this.strBSNO + "'";
} else if (this.stroplb == 'op_other') {
var printType = 'OTHERAGAIN';
var sql1 = "SET LANGUAGE 'us_english' "
+ " select * from op_other WHERE BSNO = '" + this.strBSNO + "'";
} else if (this.stroplb == 'op_railway') {
var printType = 'RAILWAYAGAIN';
var sql1 = "SET LANGUAGE 'us_english' "
+ " select * from op_railway WHERE BSNO = '" + this.strBSNO + "'";
} else if (this.stroplb == 'op_Aire') {
var printType = 'AIREAGAIN';
var sql1 = "SET LANGUAGE 'us_english' "
+ " select * from op_aire WHERE BSNO = '" + this.strBSNO + "'";
} else if (this.stroplb == 'op_Airi') {
var printType = 'AIRIAGAIN';
var sql1 = "SET LANGUAGE 'us_english' "
+ " select * from op_airi WHERE BSNO = '" + this.strBSNO + "'";
};
var sql2 = "SET LANGUAGE 'us_english' SELECT * from ch_fee where BsNo='" + this.strAmendBSNO + "' and FEETYPE=1";
var sql3 = "SET LANGUAGE 'us_english' SELECT * from ch_fee where BsNo='" + this.strAmendBSNO + "' and FEETYPE=2";
var sql4 = "SELECT BSNO"
+ ",SUM(RMBDR) as RMBDR,SUM(RMBCR) as RMBCR,SUM(USDDR) as USDDR,SUM(USDCR) as USDCR"
+ ",SUM(RMBDR+USDTORMBDR) as DRTTL"
+ ",SUM(RMBCR+USDTORMBCR) as CRTTL"
+ ",(SUM(RMBDR)-SUM(RMBCR)) AS RMBPROFIT"
+ ",(SUM(USDDR)-SUM(USDCR)) AS USDPROFIT"
+ ",SUM(RMBDR+USDTORMBDR)- SUM(RMBCR+USDTORMBCR) as TTLPROFIT"
//+ ",(CAST(CAST(CASE WHEN SUM(RMBCR+USDTORMBCR) = 0 THEN 100 ELSE (ROUND((case when SUM(RMBDR+USDTORMBDR)=0 then 0 else (SUM(RMBDR+USDTORMBDR)- SUM(RMBCR+USDTORMBCR))/SUM(RMBDR+USDTORMBDR) END),4))*100 END as decimal(18,2)) as varchar(20))+'%') AS PROFITRATE"
+ ",(CAST(CAST(CASE WHEN SUM(RMBCR+USDTORMBCR) = 0 THEN 100 ELSE (ROUND(((SUM(RMBDR+USDTORMBDR)- SUM(RMBCR+USDTORMBCR))/SUM(RMBCR+USDTORMBCR)),4))*100 END as decimal(18,2)) as varchar(20))+'%') AS PROFITRATE"
+ ",'" + SHOWNAME + "' as CREATEUSER,GETDATE() as CREATETIME "
+ " FROM ("
+ "SELECT BSNO,CURRENCY,FEETYPE"
+ ",SUM(CASE WHEN CURRENCY='RMB' AND FEETYPE = 1 THEN AMOUNT ELSE 0 END) as RMBDR"
+ ",SUM(CASE WHEN CURRENCY='RMB' AND FEETYPE = 2 THEN AMOUNT ELSE 0 END) as RMBCR"
+ ",SUM(CASE WHEN CURRENCY='USD' AND FEETYPE = 1 THEN AMOUNT ELSE 0 END) as USDDR"
+ ",SUM(CASE WHEN CURRENCY='USD' AND FEETYPE = 2 THEN AMOUNT ELSE 0 END) as USDCR"
+ ",SUM(CASE WHEN CURRENCY='USD' AND FEETYPE = 1 THEN AMOUNT*EXCHANGERATE ELSE 0 END) as USDTORMBDR"
+ ",SUM(CASE WHEN CURRENCY='USD' AND FEETYPE = 2 THEN AMOUNT*EXCHANGERATE ELSE 0 END) as USDTORMBCR "
+ " FROM ch_fee WHERE 1=1 and BSNO='" + this.strAmendBSNO + "'"
+ " GROUP BY BSNO,CURRENCY,EXCHANGERATE,FEETYPE "
+ " ) AS C GROUP BY BSNO ";
var sql5 = "exec GetPrintData '" + this.strAmendBSNO + "'";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
}
});