You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

7973 lines
304 KiB
JavaScript

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

Ext.namespace('Shipping');
Shipping.FeeEditGrid = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.FeeEditGrid.superclass.constructor.call(this);
};
Ext.extend(Shipping.FeeEditGrid, Ext.Panel, {
ParentWin: null, //弹出式
ParentPanel: null, //Tab页编辑模式
OpStatus: 'add',
StoreBill: null,
StoreCustType: null,
EditRecord: null,
RefBillNo: '*',
DataLoading: true,
stroplb: '',
strBSNO: '',
strMBLNO: '',
WMSOUTBSNO: '',
feeType: 0,
CR_condition: "",
DR_condition: "",
OprationSwap: function () {
var ret = new Array();
ret[0] = this.stroplb;
ret[1] = this.feeType;
ret[2] = this.storeDrChFee;
ret[3] = this.storeCrChFee;
return ret;
},
// region: 'center',
initUIComponents: function () {
this.feeDrSerialNo = 0;
this.feeDrBodyDel = [];
this.feeCrSerialNo = 0;
this.feeCrBodyDel = [];
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.StoreCustType = 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.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.comboxFeeNameRef = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeFeeNameRef,
forceSelection: true,
name: 'FeeName',
valueField: 'Name',
displayField: 'CodeAndName'
});
this.storeCustomerNameRef = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListRm' }
});
this.storeCustomerNameRefDr = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListRm' }
});
this.storeCustomerNameRefCr = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
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',
listeners: {
scope: this,
'focus': function (_this, eOpts) {
var selections = this.gridDrChFee.getSelectionModel().getSelection(); //获得选中的项
var strCustomerName = selections[0].get('CustomerName');
var recordCustCode = Ext.create('DsShipping.ux.CustomRefModel', {
GId: NewGuid(),
CustCode: strCustomerName,
CustName: strCustomerName,
CodeAndName: strCustomerName,
DESCRIPTION: strCustomerName
});
_thisfee.storeCustomerNameRefDr.add(recordCustCode);
}
}
});
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.StoreFeeINPUTMODE = Ext.create('Ext.data.Store', {
fields: ['Frt']
});
this.StoreFeeINPUTMODE.add({ "Frt": "出口报价" });
this.StoreFeeINPUTMODE.add({ "Frt": "进口报价" });
this.StoreFeeINPUTMODE.add({ "Frt": "代理报价" });
this.StoreFeeINPUTMODE.add({ "Frt": "场站报价" });
this.StoreFeeINPUTMODE.add({ "Frt": "手工" });
this.comboxFeeINPUTMODE = Ext.create('DsExt.ux.RefTableCombox', {
store: this.StoreFeeINPUTMODE,
forceSelection: true,
name: 'INPUTMODE',
valueField: 'Frt',
displayField: 'Frt'
});
//明细表-数据集
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.cellEditingDrChFee = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.feeDrGridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
_thisfee = this;
this.initgirdDrcolums = [{
sortable: true,
dataIndex: 'GId',
header: '惟一编号',
hidden: true,
width: 160
}, {
sortable: true,
dataIndex: 'BsNo',
header: '业务编号',
hidden: true,
width: 200
}, {
sortable: true,
dataIndex: 'FeeStatus',
header: '费用状态',
renderer: function (value, p, record) {
return record.data.FeeStatus_Ref;
},
width: 66
}, {
sortable: true,
dataIndex: 'FeeName',
header: '应收费用名称',
editor: this.comboxFeeNameRef,
width: 90
}, {
sortable: true,
dataIndex: 'CustomerType',
header: '客户类别',
editor: this.comboxCustType,
// hidden: true,
width: 75
}, {
sortable: true,
dataIndex: 'CustomerName',
header: '结算对象',
editor: this.comboxCustomerNameRef,
width: 110
}, {
sortable: true,
dataIndex: 'Unit',
header: '单位标准',
editor: this.comboxUnit,
width: 60
}, {
sortable: true,
dataIndex: 'UnitPrice',
header: '不含税单价',
editor: {
xtype: 'numberfield',
keyNavEnabled: false,
selectOnFocus: true,
hideTrigger: true,
mouseWheelEnabled: false,
decimalPrecision: 4,
enableKeyEvents: true,
listeners: {
keydown: function (textfield, e) {
if (e.getKey() == 40) {
_thisfee.onNextKeyClick(1, 8)
} else if (e.getKey() == 38) {
_thisfee.onUpKeyClick(1, 8)
}
}
}
},
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 '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
},
align: 'right',
width: 80
}, {
sortable: true,
dataIndex: 'TaxRate',
header: '税率',
editor: {
xtype: 'numberfield',
keyNavEnabled: false,
selectOnFocus: true,
hideTrigger: true,
mouseWheelEnabled: false,
enableKeyEvents: true,
listeners: {
keydown: function (textfield, e) {
if (e.getKey() == 40) {
_thisfee.onNextKeyClick(1, 9)
} else if (e.getKey() == 38) {
_thisfee.onUpKeyClick(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 '<SPAN style="COLOR: red">' + lsValue + '</SPAN>'; } } else { return value; } } catch (e) { return value; } return value; },
align: 'right',
width: 60
}, {
sortable: true,
dataIndex: 'TaxUnitPrice',
header: '单价',
editor: {
xtype: 'numberfield',
keyNavEnabled: false,
selectOnFocus: true,
decimalPrecision: 4,
hideTrigger: true,
mouseWheelEnabled: false,
enableKeyEvents: true,
listeners: {
keydown: function (textfield, e) {
if (e.getKey() == 40) {
_thisfee.onNextKeyClick(1, 10)
} else if (e.getKey() == 38) {
_thisfee.onUpKeyClick(1, 10)
}
}
}
},
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 '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
},
align: 'right',
width: 80
}, {
sortable: true,
dataIndex: 'Quantity',
header: '数量',
editor: {
xtype: 'numberfield',
keyNavEnabled: false,
allowDecimals: true,
decimalPrecision: 4,
selectOnFocus: true,
hideTrigger: true,
mouseWheelEnabled: false,
enableKeyEvents: true,
listeners: {
keydown: function (textfield, e) {
if (e.getKey() == 40) {
_thisfee.onNextKeyClick(1, 11)
} else if (e.getKey() == 38) {
_thisfee.onUpKeyClick(1, 11)
}
}
}
},
width: 60
}, {
sortable: true,
dataIndex: 'NoTaxAmount',
header: '不含税金额',
editor: {
xtype: 'numberfield',
keyNavEnabled: false,
selectOnFocus: true,
hideTrigger: true,
mouseWheelEnabled: false,
enableKeyEvents: true,
listeners: {
keydown: function (textfield, e) {
if (e.getKey() == 40) {
_thisfee.onNextKeyClick(1, 12)
} else if (e.getKey() == 38) {
_thisfee.onUpKeyClick(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 '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
},
align: 'right',
width: 80
}, {
sortable: true,
dataIndex: 'Amount',
header: '金额',
editor: {
xtype: 'numberfield',
keyNavEnabled: false,
selectOnFocus: true,
hideTrigger: true,
mouseWheelEnabled: false,
enableKeyEvents: true,
listeners: {
keydown: function (textfield, e) {
if (e.getKey() == 40) {
_thisfee.onNextKeyClick(1, 13)
} else if (e.getKey() == 38) {
_thisfee.onUpKeyClick(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 '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
},
align: 'right',
width: 80
}, {
sortable: true,
dataIndex: 'Currency',
header: '币别',
editor: this.comboxCurr,
width: 40
}, {
sortable: true,
dataIndex: 'ExChangerate',
header: '汇率',
editor: {
xtype: 'numberfield',
keyNavEnabled: false,
selectOnFocus: true,
decimalPrecision: 6,
hideTrigger: true,
mouseWheelEnabled: false,
enableKeyEvents: true,
listeners: {
keydown: function (textfield, e) {
if (e.getKey() == 40) {
_thisfee.onNextKeyClick(1, 15)
} else if (e.getKey() == 38) {
_thisfee.onUpKeyClick(1, 15)
}
}
}
},
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 6, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>'; } } else { return value; } } catch (e) { return value; } return value; },
align: 'right',
width: 60
}, {
sortable: true,
dataIndex: 'AccTaxRate',
header: '销项税率',
editor: {
xtype: 'numberfield',
keyNavEnabled: false,
selectOnFocus: true,
hideTrigger: true,
mouseWheelEnabled: false,
enableKeyEvents: true,
listeners: {
keydown: function (textfield, e) {
if (e.getKey() == 40) {
_thisfee.onNextKeyClick(1, 16)
} else if (e.getKey() == 38) {
_thisfee.onUpKeyClick(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 '<SPAN style="COLOR: red">' + lsValue + '</SPAN>'; } } else { return value; } } catch (e) { return value; } return value; },
align: 'right',
width: 80
}, {
sortable: true,
dataIndex: 'Remark',
header: '备注',
editor: {
xtype: 'textfield',
selectOnFocus: true,
enableKeyEvents: true,
listeners: {
keydown: function (textfield, e) {
if (e.getKey() == 40) {
_thisfee.onNextKeyClick(1, 17)
} else if (e.getKey() == 38) {
_thisfee.onUpKeyClick(1, 17)
}
}
}
},
width: 150
}, {
sortable: true,
dataIndex: 'FeeDescription',
header: '费用英文名称',
editor: {
xtype: 'textfield',
selectOnFocus: true,
enableKeyEvents: true,
listeners: {
keydown: function (textField, e) {
if (e.getKey() == 40) {
_thisfee.onNextKeyClick(1, 18)
} else if (e.getKey() == 38) {
_thisfee.onUpKeyClick(1, 18)
}
}
}
},
width: 150
}, {
sortable: true,
dataIndex: 'IsOpen',
header: '是否机密',
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: 'IsAdvancedpay',
header: '是否垫付',
editor: {
xtype: 'checkboxfield',
inputValue: '1',
uncheckedValue: '0'
// selectOnFocus: true
},
renderer: function (value, cellmeta) {
if (value == '1') {
return "√";
}
},
width: 60
}, {
sortable: true,
dataIndex: 'IsInvoice',
header: '禁开发票',
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: 'FRT',
editor: this.comboxFeeFrt,
width: 40
}, {
sortable: true,
dataIndex: 'Commissionrate',
header: '佣金比率',
editor: {
xtype: 'numberfield',
keyNavEnabled: false,
selectOnFocus: true,
mouseWheelEnabled: false,
enableKeyEvents: true,
listeners: {
keydown: function (textfield, e) {
if (e.getKey() == 40) {
_thisfee.onNextKeyClick(1, 23)
} else if (e.getKey() == 38) {
_thisfee.onUpKeyClick(1, 23)
}
}
}
},
width: 60
}, {
sortable: true,
dataIndex: 'OpName',
header: '录入人',
width: 60
}, {
sortable: true,
dataIndex: 'EnterDate',
header: '录入日期',
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
width: 80
}, {
sortable: true,
dataIndex: 'Settlement',
header: '结算金额',
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 '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}, {
sortable: true,
dataIndex: 'Invoice',
header: '已开票金额',
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 '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}, {
sortable: true,
dataIndex: 'InvoiceNum',
header: '发票号码',
width: 80
}, {
sortable: true,
dataIndex: 'DebitNo',
header: '対帐编号',
width: 80
}, {
sortable: true,
dataIndex: 'Auditoperator',
header: '审核人',
width: 60
}, {
sortable: true,
dataIndex: 'AuditDate',
header: '审核日期',
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
width: 80
}, {
sortable: true,
dataIndex: 'MODIFIEDUSER',
header: '修改人',
width: 60
}, {
sortable: true,
dataIndex: 'MODIFIEDTIME',
header: '修改日期',
renderer: Ext.util.Format.dateRenderer('Y-m-d H:i:s'),
width: 130
}, {
sortable: true,
dataIndex: 'OrderInvoice',
header: '发票申请金额',
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 '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}, {
dataIndex: 'UNINVOICE',
header: '未开票金额',
width: 60,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}, {
sortable: true,
dataIndex: 'PreAmount',
header: '预估金额',
// editor: {
// xtype: 'numberfield',
// keyNavEnabled: false,
// selectOnFocus: true,
// hideTrigger: true,
// mouseWheelEnabled: false,
// enableKeyEvents: true,
// listeners: {
// keydown: function (textfield, e) {
// if (e.getKey() == 40) {
// _thisfee.onNextKeyClick(1, 30)
// } else if (e.getKey() == 38) {
// _thisfee.onUpKeyClick(1, 30)
// }
// }
// }
// },
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
},
align: 'right',
width: 80
}, {
sortable: true,
dataIndex: 'INPUTMODE',
header: '录入方式',
editor: this.comboxFeeINPUTMODE,
width: 150
}, {
sortable: true,
dataIndex: 'WmsOutBsNo',
header: '相关业务号',
width: 150
}
];
this.girdDrcolums = this.initgirdDrcolums;
this.gridDrChFee = new Ext.grid.GridPanel({
store: this.storeDrChFee,
enableHdMenu: false,
region: 'center',
id: 'gridDrChFee',
// allowDeselect:true,
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
plugins: [this.cellEditingDrChFee],
selModel: this.feeDrGridCheckBoxModel,
selType: 'cellmodel',
viewConfig: {
autoFill: true,
getRowClass: function (record, rowIndex, rowParams, store) {
var feeStatus = record.get('FeeStatus');
var ISSEL = record.get('ISSEL');
if (ISSEL == '1')
return Shipping.FeeGetRowClassFont(feeStatus);
else
return Shipping.FeeGetRowClass(feeStatus);
}
},
tbar: [{ xtype: 'label', text: '应收费用',
style: 'font-size:18px',
labelColor: '#000',
//style:'background-color: #4b9bf5',
x: '5%',
y: '5%'
}, {
text: '',
tooltip: '添加应收费用',
iconCls: "btnadd",
id: 'btnFeeAddDr',
handler: function (button, event) {
this.onAddDetailClick(button, event, 1);
},
scope: this
}, '-', {
text: '',
tooltip: '保存应收费用',
iconCls: "btnsave",
id: 'btnFeeSaveDr',
handler: function (button, event) {
this.onPostDetailClick(button, event, 1);
},
scope: this
},
'-', {
text: '',
tooltip: '删除应收费用',
iconCls: "btndelete",
id: 'btnFeeDelDr',
handler: function (button, event) {
this.onDelDetailClick(button, event, 1);
},
scope: this
}, '-', {
text: '',
tooltip: '取消修改',
iconCls: "btncancel",
id: 'btnFeeCancelDr',
handler: function (button, event) {
this.onCancelDetailClick(button, event, 1);
},
scope: this
}, '-', {
text: '',
tooltip: '刷新应收',
iconCls: "btnrefresh",
id: 'btnFeeRefDr',
handler: function (button, event) {
//this.storeDrChFee.load({ params: { billno: this.strBSNO, type: 1, optype: this.stroplb} });
this.LoadDrChFee();
},
scope: this
}, '-', {
text: '',
tooltip: '打印应收',
iconCls: "btnprint",
menu:
[
{ text: "打印应收账单",
menu:
[//海运进口应收应付列表
{text: "所选应收打印",
handler: function (menu, event) {
_thisfee.onPrintSelectDetailClick(menu, event, 1);
}
}, { text: "应收客户打印",
handler: function (menu, event) {
_thisfee.onPrintCustDetailClick(menu, event, 1);
}
},
{ text: "所有应收打印",
handler: function (menu, event) {
_thisfee.onPrintAllDetailClick(menu, event, 1);
}
}
]
},
'-',
{ text: "利润核算单打印",
handler: function (menu, event) {
_thisfee.onPrintGainClick(menu, event, 1);
}
}
],
/*
handler: function (button, event) {
this.onPrintDetailClick(button, event, 1);
},
*/
scope: this
}, '-', {
text: '提交审核',
tooltip: '提交审核',
id: 'btnFeeAuditDr',
menu:
[
{ text: "提交审核",
handler: function (menu, event) {
_thisfee.onSubmitAuditClick(menu, event, 1);
}
}, { text: "应收提交",
handler: function (menu, event) {
_thisfee.onSubmitAuditAllClick(menu, event, 1);
}
}, { text: "整票提交",
handler: function (menu, event) {
_thisfee.onSubmitAuditBillClick(menu, event, 1);
}
},
{ text: "撤销提交",
handler: function (menu, event) {
_thisfee.onCancelAuditNewClick(menu, event, 1);
}
}],
scope: this
},
'-', {
text: '申请修改',
tooltip: '申请修改',
id: 'btnFeeShenDr',
handler: function (button, event) {
this.onShenModifyClick(button, event, 1);
},
scope: this
},
'-', {
text: '申请删除',
tooltip: '申请删除',
id: 'btnFeeShenDelDr',
handler: function (button, event) {
this.onShenDeleteClick(button, event, 1);
},
scope: this
},
'-', {
text: '取消申请',
tooltip: '取消申请',
id: 'btnFeeShenCancelDr',
handler: function (button, event) {
this.onCancelShenClick(button, event, 1);
},
scope: this
},
// '-', {
// text: '不开发票',
// tooltip: '不开发票',
// menu:
// [
// {
// text: '不开发票',
// tooltip: '不开发票',
// handler: function (button, event) {
// this.onNoIvoiceClick(button, event, 1);
// },
// scope: this
// }, {
// text: '解禁发票',
// tooltip: '解禁发票',
// handler: function (button, event) {
// this.onCancelNoIvoiceClick(button, event, 1);
// },
// scope: this
// }],
// scope: this
// },
//
'-', {
text: '查看信息',
tooltip: '查看信息',
handler: function (button, event) {
this.onViewDetailClick(button, event, 1);
},
scope: this
}, '-', {
text: '引入费用',
tooltip: '引入费用',
id: 'btnFeeImpAddDr',
menu:
[
{ text: "历史引入",
handler: function (menu, event) {
_thisfee.onHistryAddDetailClick(menu, event, 1);
}
},
{ text: "引入费用模板",
handler: function (menu, event) {
_thisfee.onTemplateAddDetailClick(menu, event, 1);
}
}, { text: "罐箱费用引入",
handler: function (menu, event) {
_thisfee.onCtnTkAddDetailClick(menu, event, 1);
}
},
'-',
{ text: "生成应付",
menu:
[
{ text: "所选生成应付",
handler: function (menu, event) {
_thisfee.onAddSelectDetailClick(menu, event, 2);
}
},
{ text: "所有生成应付",
handler: function (menu, event) {
_thisfee.onAddAllDetailClick(menu, event, 2);
}
}
]
}
],
/*
handler: function (button, event) {
this.onCopyAddClick(button, event, 1);
},
*/
scope: this
}, '-', {
text: "保存列表样式",
menu: [
{ text: "保存",
handler: function (button, event) {
_thisfee.girdDrcolums = DsTruck.SaveGridPanel(GID, 'FEEDRGRID', _thisfee.gridDrChFee.columns, _thisfee.girdDrcolums, 0, true);
}
}, { text: "初始化",
handler: function (menu, event) {
_thisfee.gridDrChFee.reconfigure(this.storeList, _thisfee.initgirdDrcolums);
_thisfee.girdDrcolums = DsTruck.SaveGridPanel(GID, 'FEEDRGRID', _thisfee.gridDrChFee.columns, _thisfee.initgirdDrcolums, 0, true);
}
}],
scope: this
}],
columns: this.girdDrcolums
});
this.girdDrcolums = DsTruck.GetGridPanel(GID, 'FEEDRGRID', 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.gridDrChFee.on('cellclick', function (_thisTable, td, cellIndex, record, tr, rowIndex, e, eOpts) {
if ((cellIndex == 37) && record.data.IsCrmOrderFee == 'True') {
return false;
}
}, 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');
_thisfee = this;
this.initgirdCrcolums = [{
sortable: true,
dataIndex: 'GId',
header: '惟一编号',
hidden: true,
width: 160
}, {
sortable: true,
dataIndex: 'BsNo',
header: '业务编号',
hidden: true,
width: 200
}, {
sortable: true,
dataIndex: 'FeeStatus',
header: '费用状态',
renderer: function (value, p, record) {
return record.data.FeeStatus_Ref;
},
width: 66
}, {
sortable: true,
dataIndex: 'FeeName',
header: '应付费用名称',
editor: this.comboxFeeNameRef,
width: 100
}, {
sortable: true,
dataIndex: 'CustomerType',
header: '客户类别',
editor: this.comboxCustType,
// hidden: true,
width: 80
}, {
sortable: true,
dataIndex: 'CustomerName',
header: '结算对象',
editor: this.comboxCustomerNameRef,
width: 120
}, {
sortable: true,
dataIndex: 'Unit',
header: '单位标准',
editor: this.comboxUnit,
width: 60
}, {
sortable: true,
dataIndex: 'UnitPrice',
header: '不含税单价',
editor: {
xtype: 'numberfield',
allowDecimals: true,
//这里允许保留3位小数所以你输入11.996就不会进位了
decimalPrecision: 6,
keyNavEnabled: false,
selectOnFocus: true,
hideTrigger: true,
mouseWheelEnabled: false,
enableKeyEvents: true,
listeners: {
keydown: function (textField, e) {
if (e.getKey() == 40) {
_thisfee.onNextKeyClick(2, 8)
} else if (e.getKey() == 38) {
_thisfee.onUpKeyClick(2, 8)
}
}
}
},
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 6, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
},
align: 'right',
width: 80
}, {
sortable: true,
dataIndex: 'TaxRate',
header: '税率',
editor: {
xtype: 'numberfield',
keyNavEnabled: false,
selectOnFocus: true,
hideTrigger: true,
mouseWheelEnabled: false,
enableKeyEvents: true,
listeners: {
keydown: function (textField, e) {
if (e.getKey() == 40) {
_thisfee.onNextKeyClick(2, 9)
} else if (e.getKey() == 38) {
_thisfee.onUpKeyClick(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 '<SPAN style="COLOR: red">' + lsValue + '</SPAN>'; } } else { return value; } } catch (e) { return value; } return value; },
align: 'right',
width: 60
}, {
sortable: true,
dataIndex: 'TaxUnitPrice',
header: '单价',
editor: {
xtype: 'numberfield',
keyNavEnabled: false,
selectOnFocus: true,
decimalPrecision: 4,
hideTrigger: true,
mouseWheelEnabled: false,
enableKeyEvents: true,
listeners: {
keydown: function (textField, e) {
if (e.getKey() == 40) {
_thisfee.onNextKeyClick(2, 10)
} else if (e.getKey() == 38) {
_thisfee.onUpKeyClick(2, 10)
}
}
}
},
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 '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
},
align: 'right',
width: 80
}, {
sortable: true,
dataIndex: 'Quantity',
header: '数量',
editor: {
xtype: 'numberfield',
keyNavEnabled: false,
allowDecimals: true,
decimalPrecision: 4,
selectOnFocus: true,
hideTrigger: true,
mouseWheelEnabled: false,
enableKeyEvents: true,
listeners: {
keydown: function (textfield, e) {
if (e.getKey() == 40) {
_thisfee.onNextKeyClick(2, 11)
} else if (e.getKey() == 38) {
_thisfee.onUpKeyClick(2, 11)
}
}
}
},
width: 60
}, {
sortable: true,
dataIndex: 'NoTaxAmount',
header: '不含税金额',
editor: {
xtype: 'numberfield',
keyNavEnabled: false,
selectOnFocus: true,
enableKeyEvents: true,
hideTrigger: true,
mouseWheelEnabled: false,
listeners: {
keydown: function (textField, e) {
if (e.getKey() == 40) {
_thisfee.onNextKeyClick(2, 12)
} else if (e.getKey() == 38) {
_thisfee.onUpKeyClick(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 '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
},
align: 'right',
width: 80
}, {
sortable: true,
dataIndex: 'Amount',
header: '金额',
editor: {
xtype: 'numberfield',
keyNavEnabled: false,
selectOnFocus: true,
hideTrigger: true,
mouseWheelEnabled: false,
enableKeyEvents: true,
listeners: {
keydown: function (textField, e) {
if (e.getKey() == 40) {
_thisfee.onNextKeyClick(2, 13)
} else if (e.getKey() == 38) {
_thisfee.onUpKeyClick(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 '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
},
align: 'right',
width: 80
}, {
sortable: true,
dataIndex: 'Currency',
header: '币别',
editor: this.comboxCurr,
width: 40
}, {
sortable: true,
dataIndex: 'ExChangerate',
header: '汇率',
editor: {
xtype: 'numberfield',
keyNavEnabled: false,
selectOnFocus: true,
decimalPrecision: 6,
hideTrigger: true,
mouseWheelEnabled: false,
enableKeyEvents: true,
listeners: {
keydown: function (textField, e) {
if (e.getKey() == 40) {
_thisfee.onNextKeyClick(2, 15)
} else if (e.getKey() == 38) {
_thisfee.onUpKeyClick(2, 15)
}
}
}
},
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 6, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>'; } } else { return value; } } catch (e) { return value; } return value; },
align: 'right',
width: 60
}, {
sortable: true,
dataIndex: 'AccTaxRate',
header: '进项税率',
editor: {
xtype: 'numberfield',
keyNavEnabled: false,
selectOnFocus: true,
hideTrigger: true,
mouseWheelEnabled: false,
enableKeyEvents: true,
listeners: {
keydown: function (textField, e) {
if (e.getKey() == 40) {
_thisfee.onNextKeyClick(2, 16)
} else if (e.getKey() == 38) {
_thisfee.onUpKeyClick(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 '<SPAN style="COLOR: red">' + lsValue + '</SPAN>'; } } else { return value; } } catch (e) { return value; } return value; },
align: 'right',
width: 80
}, {
sortable: true,
dataIndex: 'Remark',
header: '备注',
editor: {
xtype: 'textfield',
selectOnFocus: true,
enableKeyEvents: true,
listeners: {
keydown: function (textField, e) {
if (e.getKey() == 40) {
_thisfee.onNextKeyClick(2, 17)
} else if (e.getKey() == 38) {
_thisfee.onUpKeyClick(2, 17)
}
}
}
},
width: 150
}, {
sortable: true,
dataIndex: 'FeeDescription',
header: '费用英文名称',
editor: {
xtype: 'textfield',
selectOnFocus: true,
enableKeyEvents: true,
listeners: {
keydown: function (textField, e) {
if (e.getKey() == 40) {
_thisfee.onNextKeyClick(2, 18)
} else if (e.getKey() == 38) {
_thisfee.onUpKeyClick(2, 18)
}
}
}
},
width: 150
}, {
sortable: true,
dataIndex: 'IsAdvancedpay',
header: '是否垫付',
editor: {
xtype: 'checkboxfield',
inputValue: '1',
uncheckedValue: '0'
// selectOnFocus: true
},
renderer: function (value, cellmeta) {
if (value == '1' || value == true) {
return "√";
}
},
width: 60
}, {
sortable: true,
dataIndex: 'IsOpen',
header: '是否机密',
hidden: true,
editor: {
xtype: 'checkboxfield',
inputValue: '1',
uncheckedValue: '0'
// selectOnFocus: true
},
renderer: function (value, cellmeta) {
if (value == '1' || value == true) {
return "√";
}
},
width: 60
}, {
sortable: true,
dataIndex: 'IsInvoice',
header: '禁开发票',
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: 'FRT',
editor: this.comboxFeeFrt,
width: 40
}, {
sortable: true,
dataIndex: 'Commissionrate',
header: '佣金比率',
editor: {
xtype: 'numberfield',
keyNavEnabled: false,
selectOnFocus: true,
enableKeyEvents: true,
hideTrigger: true,
mouseWheelEnabled: false,
listeners: {
keydown: function (textField, e) {
if (e.getKey() == 40) {
_thisfee.onNextKeyClick(2, 23)
} else if (e.getKey() == 38) {
_thisfee.onUpKeyClick(2, 23)
}
}
}
},
width: 60
}, {
sortable: true,
dataIndex: 'OpName',
header: '录入人',
width: 60
}, {
sortable: true,
dataIndex: 'EnterDate',
header: '录入日期',
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
width: 80
}, {
sortable: true,
dataIndex: 'Auditoperator',
header: '审核人',
width: 60
}, {
sortable: true,
dataIndex: 'AuditDate',
header: '审核日期',
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
width: 80
}, {
sortable: true,
dataIndex: 'Settlement',
header: '结算金额',
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 '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}, {
sortable: true,
dataIndex: 'Invoice',
header: '已开票金额',
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 '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}, {
sortable: true,
dataIndex: 'OrderAmount',
header: '申请金额',
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 '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}, {
sortable: true,
dataIndex: 'MODIFIEDUSER',
header: '修改人',
width: 60
}, {
sortable: true,
dataIndex: 'MODIFIEDTIME',
header: '修改日期',
renderer: Ext.util.Format.dateRenderer('Y-m-d H:i:s'),
width: 130
}, {
sortable: true,
dataIndex: 'DebitNo',
header: '対帐编号',
width: 80
}, {
sortable: true,
dataIndex: 'OrderInvoice',
header: '发票申请金额',
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 '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}, {
dataIndex: 'UNINVOICE',
header: '未开票金额',
width: 60,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}, {
sortable: true,
dataIndex: 'PreAmount',
header: '预估金额',
// editor: {
// xtype: 'numberfield',
// keyNavEnabled: false,
// selectOnFocus: true,
// hideTrigger: true,
// mouseWheelEnabled: false,
// enableKeyEvents: true,
// listeners: {
// keydown: function (textfield, e) {
// if (e.getKey() == 40) {
// _thisfee.onNextKeyClick(2, 31)
// } else if (e.getKey() == 38) {
// _thisfee.onUpKeyClick(2, 31)
// }
// }
// }
// },
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
},
align: 'right',
width: 80
}, {
sortable: true,
dataIndex: 'INPUTMODE',
header: '录入方式',
editor: this.comboxFeeINPUTMODE,
width: 80
}, {
sortable: true,
dataIndex: 'WmsOutBsNo',
header: '相关业务号',
width: 150
}
];
this.girdCrcolums = this.initgirdCrcolums;
this.gridCrChFee = new Ext.grid.GridPanel({
store: this.storeCrChFee,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
plugins: [this.cellEditingCrChFee],
selModel: this.feeCrGridCheckBoxModel,
selType: 'cellmodel',
viewConfig: {
autoFill: true,
getRowClass: function (record, rowIndex, rowParams, store) {
var feeStatus = record.get('FeeStatus');
var ISSEL = record.get('ISSEL');
if (ISSEL == '1')
return Shipping.FeeGetRowClassFont(feeStatus);
else
return Shipping.FeeGetRowClass(feeStatus);
}
},
tbar: [{ xtype: 'label', text: '应付费用',
style: 'font-size:18px',
labelColor: '#000',
//style:'background-color: #4b9bf5',
x: '5%',
y: '5%'
}, {
text: '',
tooltip: '添加应付费用',
iconCls: "btnadd",
id: 'btnFeeAddCr',
handler: function (button, event) {
this.onAddDetailClick(button, event, 2);
},
scope: this
}, '-', {
text: '',
tooltip: '保存应付费用',
iconCls: "btnsave",
id: 'btnFeeSaveCr',
handler: function (button, event) {
this.onPostDetailClick(button, event, 2);
},
scope: this
},
'-', {
text: '',
tooltip: '删除应付费用',
iconCls: "btndelete",
id: 'btnFeeDelCr',
handler: function (button, event) {
this.onDelDetailClick(button, event, 2);
},
scope: this
}, '-', {
text: '',
tooltip: '取消修改',
iconCls: "btncancel",
id: 'btnFeeCancelCr',
handler: function (button, event) {
this.onCancelDetailClick(button, event, 2);
},
scope: this
}, '-', {
text: '',
tooltip: '刷新应付',
iconCls: "btnrefresh",
handler: function (button, event) {
//this.storeCrChFee.load({ params: { billno: this.strBSNO, type: 2, optype: this.stroplb} });
this.LoadCrChFee(button, event);
},
scope: this
}, '-', {
text: '',
tooltip: '打印应付',
iconCls: "btnprint",
menu:
[
{ text: "打印应付账单",
menu:
[
{ text: "所选应付打印",
handler: function (menu, event) {
_thisfee.onPrintSelectDetailClick(menu, event, 2);
}
}, { text: "应付客户打印",
handler: function (menu, event) {
_thisfee.onPrintCustDetailClick(menu, event, 2);
}
},
{ text: "所有应付打印",
handler: function (menu, event) {
_thisfee.onPrintAllDetailClick(menu, event, 2);
}
}
]
},
'-',
{ text: "利润核算单打印",
handler: function (menu, event) {
_thisfee.onPrintGainClick(menu, event, 1);
}
}
],
scope: this
}, '-', {
text: '提交审核',
tooltip: '提交审核',
id: 'btnFeeAuditCr',
menu:
[
{ text: "提交审核",
handler: function (menu, event) {
_thisfee.onSubmitAuditNewClick(menu, event, 2);
}
}, { text: "全部提交",
handler: function (menu, event) {
_thisfee.onSubmitAuditAllClick(menu, event, 2);
}
}, { text: "整票提交",
handler: function (menu, event) {
_thisfee.onSubmitAuditBillClick(menu, event, 2);
}
},
{ text: "撤销提交",
handler: function (menu, event) {
_thisfee.onCancelAuditNewClick(menu, event, 2);
}
}],
scope: this
},
'-', {
text: '申请修改',
tooltip: '申请修改',
id: 'btnFeeShenCr',
handler: function (button, event) {
this.onShenModifyClick(button, event, 2);
},
scope: this
},
'-', {
text: '申请删除',
tooltip: '申请删除',
id: 'btnFeeShenDelCr',
handler: function (button, event) {
this.onShenDeleteClick(button, event, 2);
},
scope: this
},
'-', {
text: '取消申请',
tooltip: '取消申请',
id: 'btnFeeShenCancelCr',
handler: function (button, event) {
this.onCancelShenClick(button, event, 2);
},
scope: this
},
//
//
// '-', {
// text: '不开发票',
// tooltip: '不开发票',
// menu:
// [
// {
// text: '不开发票',
// tooltip: '不开发票',
// handler: function (button, event) {
// this.onNoIvoiceClick(button, event, 2);
// },
// scope: this
// }, {
// text: '解禁发票',
// tooltip: '解禁发票',
// handler: function (button, event) {
// this.onCancelNoIvoiceClick(button, event, 2);
// },
// scope: this
// }],
// scope: this
// },
'-', {
text: '查看信息',
tooltip: '查看信息',
handler: function (button, event) {
this.onViewDetailClick(button, event, 2);
},
scope: this
}, {
text: "生成清洗改装",
handler: function (menu, event) {
_thisfee.onAddClearRepairClick(menu, event);
}
}, '-', {
text: '引入费用',
tooltip: '引入费用',
id: 'btnFeeImpAddCr',
menu:
[
{
text: "引入堆存费备注",
handler: function (menu, event) {
_thisfee.onAddYardRemarkClick(menu, event);
}
},{ text: "历史引入",
handler: function (menu, event) {
_thisfee.onHistryAddDetailClick(menu, event, 2);
}
},
{ text: "引入费用模板",
handler: function (menu, event) {
_thisfee.onTemplateAddDetailClick(menu, event, 2);
}
}, { text: "罐箱费用引入",
handler: function (menu, event) {
_thisfee.onCtnTkAddDetailClick(menu, event, 2);
}
},
'-',
{ text: "生成应收",
menu:
[
{ text: "所选生成应收",
handler: function (menu, event) {
_thisfee.onAddSelectDetailClick(menu, event, 1);
}
},
{ text: "所有生成应收",
handler: function (menu, event) {
_thisfee.onAddAllDetailClick(menu, event, 1);
}
}
]
}
],
scope: this
}, '-', {
text: "保存列表样式",
menu: [
{ text: "保存",
handler: function (button, event) {
_thisfee.girdCrcolums = DsTruck.SaveGridPanel(GID, 'FEECRGRID', _thisfee.gridCrChFee.columns, _thisfee.girdCrcolums, 0, true);
}
}, { text: "初始化",
handler: function (menu, event) {
_thisfee.gridCrChFee.reconfigure(this.storeList, _thisfee.initgirdCrcolums);
_thisfee.girdCrcolums = DsTruck.SaveGridPanel(GID, 'FEECRGRID', _thisfee.gridCrChFee.columns, _thisfee.initgirdCrcolums, 0, true);
}
}],
scope: this
}],
columns: this.girdCrcolums
});
this.girdCrcolums = DsTruck.GetGridPanel(GID, 'FEECRGRID', 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.gridCrChFee.on('cellclick', function (_thisTable, td, cellIndex, record, tr, rowIndex, e, eOpts) {
if ((cellIndex == 37) && record.data.IsCrmOrderFee == 'True') {
return false;
}
}, 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.gridSum = new Ext.grid.GridPanel({
store: this.storeBodySum,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
columns: [{
header: "<a href='#'><font color='#FF0000'>总 计</font></a>",
sortable: false,
align: 'center',
dataIndex: 'CURR',
width: 160
}, {
text: '应 收',
columns: [{
header: '不含税',
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 '<SPAN style="COLOR: red">' + lsValue + '</SPAN>'; } } else { return value; } } catch (e) { return value; } return value; },
align: 'right',
width: 160
}, {
header: '含税',
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 '<SPAN style="COLOR: red">' + lsValue + '</SPAN>'; } } else { return value; } } catch (e) { return value; } return value; },
width: 160
}]
}, {
text: '应 付',
columns: [{
header: '不含税',
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 '<SPAN style="COLOR: red">' + lsValue + '</SPAN>'; } } else { return value; } } catch (e) { return value; } return value; },
width: 160
}, {
header: '含税',
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 '<SPAN style="COLOR: red">' + lsValue + '</SPAN>'; } } else { return value; } } catch (e) { return value; } return value; },
width: 160
}]
}, {
text: '利 润',
columns: [{
header: '不含税',
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 '<SPAN style="COLOR: red">' + lsValue + '</SPAN>'; } } else { return value; } } catch (e) { return value; } return value; },
align: 'right',
width: 160
}, {
header: '含税',
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 '<SPAN style="COLOR: red">' + lsValue + '</SPAN>'; } } else { return value; } } catch (e) { return value; } return value; },
width: 160
}]
}
]
});
//定义Grid
this.gridListCust = new Ext.grid.GridPanel({
store: this.storeChFeeGain,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
// features: [{
// ftype: 'summary'//Ext.grid.feature.Summary表格汇总特性
// }],
columns: [{
sortable: true,
dataIndex: 'CUSTOMERNAME',
header: '结算对象',
// summaryRenderer: function () {
// return '合计'
// },
width: 110
}, {
sortable: true,
dataIndex: 'RMBDR',
header: 'RMB应收',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
},
align: 'right',
// summaryType: 'sum',
// summaryRenderer: Ext.util.Format.numberRenderer('00.00'),
width: 80
}, {
sortable: true,
dataIndex: 'RMBCR',
header: 'RMB应付',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
},
// summaryType: 'sum',
// summaryRenderer: Ext.util.Format.numberRenderer('00.00'),
align: 'right',
width: 80
}, {
sortable: true,
dataIndex: 'RMBPROFIT',
header: 'RMB利润',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
},
// summaryType: 'sum',
// summaryRenderer: Ext.util.Format.numberRenderer('00.00'),
align: 'right',
width: 80
}, {
sortable: true,
dataIndex: 'USDDR',
header: 'USD应收',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
},
// summaryType: 'sum',
// summaryRenderer: Ext.util.Format.numberRenderer('00.00'),
align: 'right',
width: 80
}, {
sortable: true,
dataIndex: 'USDCR',
header: 'USD应付',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
},
// summaryType: 'sum',
// summaryRenderer: Ext.util.Format.numberRenderer('00.00'),
align: 'right',
width: 80
}, {
sortable: true,
dataIndex: 'USDPROFIT',
header: 'USD利润',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
},
// summaryType: 'sum',
// summaryRenderer: Ext.util.Format.numberRenderer('00.00'),
align: 'right',
width: 80
}, {
sortable: true,
dataIndex: 'OTDR',
header: '其他币别应收',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
},
// summaryType: 'sum',
// summaryRenderer: Ext.util.Format.numberRenderer('00.00'),
align: 'right',
width: 80
}, {
sortable: true,
dataIndex: 'OTCR',
header: '其他币别应付',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
},
// summaryType: 'sum',
// summaryRenderer: Ext.util.Format.numberRenderer('00.00'),
align: 'right',
width: 80
}, {
sortable: true,
dataIndex: 'OTPROFIT',
header: '其他币别利润',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
},
// summaryType: 'sum',
// summaryRenderer: Ext.util.Format.numberRenderer('00.00'),
align: 'right',
width: 80
}, {
sortable: true,
dataIndex: 'TTLDR',
header: '合计应收',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
},
align: 'right',
// summaryType: 'sum',
// summaryRenderer: Ext.util.Format.numberRenderer('00.00'),
width: 80
}, {
sortable: true,
dataIndex: 'TTLCR',
header: '合计应付',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
},
align: 'right',
// summaryType: 'sum',
// summaryRenderer: Ext.util.Format.numberRenderer('00.00'),
width: 80
}, {
sortable: true,
dataIndex: 'TTLPROFIT',
header: '合计利润',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
},
align: 'right',
// summaryType: 'sum',
// summaryRenderer: Ext.util.Format.numberRenderer('00.00'),
width: 80
}
],
// paging bar on the bottom
bbar: Ext.create('Ext.PagingToolbar', {
store: this.storeChFeeGain,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
})
});
this.panelCustSum = new Ext.Panel({
title: '客户合计',
layout: "border",
region: 'center',
animate: true,
autoScroll: true,
// containerScroll: true,
frame: false,
items: [this.gridListCust]
});
this.panelCurrSum = new Ext.Panel({
title: '币别合计',
layout: "border",
region: 'center',
animate: true,
autoScroll: true,
// containerScroll: true,
frame: false,
items: [this.gridSum]
});
this.tabTotal = new Ext.TabPanel({
activeTab: 0,
autoWidth: true,
border: true,
height: 210,
frame: false,
region: 'south',
enableHdMenu: false,
// region: 'center',
title: "利润合计",
collapsed: true,
collapsible: true,
split: true,
enableTabScroll: true,
items:
[
this.panelCustSum,
this.panelCurrSum
]
});
// this.formtotal = Ext.widget('form', {
// region: 'south',
// title: "利润统计",
// //height: 150,
// items: [this.tabTotal]
// });
//#region 申请修改和删除界面
this.comboxFeeFrtModify = Ext.create('DsExt.ux.RefTableCombox', {
store: this.StoreFeeFrt,
forceSelection: true,
fieldLabel: 'FRT',
name: 'FeeFrt',
valueField: 'Frt',
displayField: 'Frt'
});
this.storeFeeNameRefModify = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.FeeTypeRefModel',
proxy: { url: '/MvcShipping/MsChFee/GetFeeTypeRefList' }
});
this.storeFeeNameRefModify.load({ params: { condition: ""} });
this.comboxFeeNameRefModify = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeFeeNameRefModify,
fieldLabel: '费用名称',
forceSelection: true,
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: '结费对象',
name: 'CustomerName',
valueField: 'CustName',
displayField: 'CodeAndName'
});
this.comboxUnitModify = Ext.create('DsExt.ux.RefTableCombox', {
store: this.StoreUnit,
fieldLabel: '单位标准',
name: 'Unit',
valueField: 'UNIT',
displayField: 'SUNIT'
});
this.CheckIsAdvancedpay = new Ext.form.Checkbox({
fieldLabel: '是否垫付',
uncheckedValue: '0',
inputValue: '1',
name: 'IsAdvancedpay'
});
this.comboxCurrModify = Ext.create('DsExt.ux.RefTableCombox', {
store: this.StoreCurr,
fieldLabel: '币别',
forceSelection: true,
labelWidth: 40,
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 = _thisfee.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);
}
}
}
}
}
}
});
_thisfee = this;
this.NewFeeEdit = Ext.widget('form', {
frame: true,
region: 'center',
trackResetOnLoad: true,
title: '费用新值',
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 80,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '业务编号',
name: 'BsNo', hidden: true
}, {
fieldLabel: 'GId',
name: 'GId', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: 'FeeType',
name: 'FeeType', flex: 0, hidden: true, margins: '0'
}, this.comboxFeeNameRefModify, this.comboxCustomerNameRefModify, this.comboxUnitModify]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '不含税单价',
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 '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
},
listeners: {
scope: this,
'change': function (ths, newValue, oldValue, eOpts) {
if (this.DataLoading == true) return;
if (newValue == oldValue) return;
var form = _thisfee.NewFeeEdit.getForm();
var unitPrice = newValue;
if (unitPrice == null) unitPrice = 0;
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: '税率',
xtype: 'numberfield',
name: 'TaxRate',
listeners: {
scope: this,
'change': function (ths, newValue, oldValue, eOpts) {
if (this.DataLoading == true) return;
if (newValue == oldValue) return;
var form = _thisfee.NewFeeEdit.getForm();
var unitPrice = form.findField('UnitPrice').getValue();
var FeeName = form.findField('FeeName').getValue();
var quantity = form.findField('Quantity').getValue();
var taxrate = newValue;
if (taxrate == null) taxrate = 0;
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: '含税单价',
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 '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
},
listeners: {
scope: this,
'change': function (ths, newValue, oldValue, eOpts) {
if (this.DataLoading == true) return;
if (newValue == oldValue) return;
var form = _thisfee.NewFeeEdit.getForm();
var quantity = form.findField('Quantity').getValue();
var TaxUnitPrice = newValue;
if (TaxUnitPrice == null) TaxUnitPrice = 0;
var taxrate = form.findField('TaxRate').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 amount = (parseFloat(TaxUnitPrice).mul(quantity)).toFixed(2);
form.findField('Amount').setValue(amount);
var notaxamount = (parseFloat(amount).div(taxrateb)).toFixed(2);
form.findField('NoTaxAmount').setValue(notaxamount);
}
this.DataLoading = false;
}
}
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '计费数量',
xtype: 'numberfield',
name: 'Quantity',
listeners: {
scope: this,
'change': function (ths, newValue, oldValue, eOpts) {
if (this.DataLoading == true) return;
if (newValue == oldValue) return;
var form = _thisfee.NewFeeEdit.getForm();
var unitPrice = form.findField('UnitPrice').getValue();
var FeeName = form.findField('FeeName').getValue();
var quantity = newValue;
if (quantity == null) quantity = 0;
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: '不含税金额',
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 '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
},
listeners: {
scope: this,
'change': function (ths, newValue, oldValue, eOpts) {
if (this.DataLoading == true) return;
if (newValue == oldValue) return;
var form = _thisfee.NewFeeEdit.getForm();
var notaxamount = newValue;
if (notaxamount == null) notaxamount = 0;
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: '含税金额',
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 '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
},
listeners: {
scope: this,
'change': function (ths, newValue, oldValue, eOpts) {
if (this.DataLoading == true) return;
if (newValue == oldValue) return;
var form = _thisfee.NewFeeEdit.getForm();
var amount = newValue;
if (amount == null) amount = 0;
var taxrate = form.findField('TaxRate').getValue();
this.DataLoading = true;
if (taxrate != null) {
var taxrateb = Add(1, Mul(taxrate, 0.01)); //parseFloat(1 + parseFloat(taxrate.mul(0.01)));
var notaxamount = Div(amount, taxrateb); //(parseFloat(amount).div(taxrateb)).toFixed(2);
form.findField('NoTaxAmount').setValue(notaxamount);
var quantity = form.findField('Quantity').getValue();
if (quantity != null && quantity != 0) {
var unitPrice = Div(notaxamount, quantity); //(parseFloat(notaxamount).div(parseFloat(quantity))).toFixed(2);
form.findField('UnitPrice').setValue(unitPrice);
var TaxUnitPrice = Div(amount, quantity);
form.findField('TaxUnitPrice').setValue(TaxUnitPrice);
}
var tax = Div(Mul(notaxamount, taxrate), 100); //parseFloat(notaxamount).mul(taxrate);
form.findField('Tax').setValue(tax);
}
this.DataLoading = false;
}
}
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxCurrModify, {
fieldLabel: '税额',
xtype: 'numberfield',
labelWidth: 40,
decimalPrecision: 6,
name: 'Tax'
}, {
fieldLabel: '汇率',
xtype: 'numberfield',
labelWidth: 40,
decimalPrecision: 6,
name: 'ExChangerate'
}, {
fieldLabel: '财务税率',
xtype: 'numberfield',
name: 'AccTaxRate'
}, this.CheckIsAdvancedpay
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel:'备注', //'备注',
name: 'Remark'
},{
fieldLabel: '修改原因',
name: 'Reason'
}]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
this.OldFee = Ext.widget('form', {
frame: true,
region: 'center',
title: '费用旧值',
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: '业务编号',
name: 'BsNo', hidden: true
}, {
fieldLabel: 'GId',
name: 'GId', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: '费用名称',
readOnly: true,
name: 'FeeName'
}, {
fieldLabel: '费用对象',
readOnly: true,
name: 'CustomerName'
}, {
fieldLabel: '单位标准',
readOnly: true,
name: 'Unit'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '不含税单价',
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 '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}, {
fieldLabel: '税率',
readOnly: true,
name: 'TaxRate'
}, {
fieldLabel: '含税单价',
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 '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '计费数量',
readOnly: true,
name: 'Quantity'
}, {
fieldLabel: '不含税金额',
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 '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}, {
fieldLabel: '含税金额',
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 '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '币别',
readOnly: true,
name: 'Currency'
}, {
fieldLabel: '汇率',
readOnly: true,
name: 'ExChangerate'
}, {
fieldLabel: '财务税率',
readOnly: true,
name: 'AccTaxRate'
}, {
fieldLabel: '是否垫付',
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: '业务编号',
name: 'BsNo', hidden: true
}, {
fieldLabel: 'GId',
name: 'GId', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: 'FeeType',
name: 'FeeType', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: '费用名称',
name: 'FeeName', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: '费用对象',
name: 'CustomerName', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: '单位标准',
name: 'Unit', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: '不含税单价',
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 '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}, {
fieldLabel: '税率',
name: 'TaxRate', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: '含税单价',
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 '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}, {
fieldLabel: '计费数量',
name: 'Quantity', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: '不含税金额',
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 '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}, {
fieldLabel: '含税金额',
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 '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}, {
fieldLabel: '币别',
name: 'Currency', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: '汇率',
name: 'ExChangerate', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: '财务税率',
name: 'AccTaxRate', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: '是否垫付',
name: 'IsAdvancedpay', flex: 0, hidden: true, margins: '0'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '删除原因',
name: 'Reason'
}
]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
this.NewFeeShowDr = Ext.widget('form', {
frame: true,
region: 'east',
hidden: true,
title: '费用修改新值',
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: '业务编号',
name: 'BsNo', hidden: true
}, {
fieldLabel: 'GId',
name: 'GId', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: '费用名称',
readOnly: true,
name: 'FeeName'
}, {
fieldLabel: '费用对象',
readOnly: true,
name: 'CustomerName'
}, {
fieldLabel: '单位标准',
readOnly: true,
name: 'Unit'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '不含税单价',
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 '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}, {
fieldLabel: '税率',
readOnly: true,
name: 'TaxRate'
}, {
fieldLabel: '含税单价',
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 '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '计费数量',
readOnly: true,
name: 'Quantity'
}, {
fieldLabel: '不含税金额',
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 '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}, {
fieldLabel: '含税金额',
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 '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '币别',
readOnly: true,
name: 'Currency'
}, {
fieldLabel: '汇率',
readOnly: true,
labelWidth: 60,
name: 'ExChangerate'
}, {
fieldLabel: '财务税率',
readOnly: true,
labelWidth: 60,
name: 'AccTaxRate'
}, {
fieldLabel: '是否垫付',
readOnly: true,
name: 'IsAdvancedpay'
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '备注', //'备注',
name: 'Remark'
}, {
fieldLabel: '修改原因',
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: '费用修改新值',
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: '业务编号',
name: 'BsNo', hidden: true
}, {
fieldLabel: 'GId',
name: 'GId', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: '费用名称',
readOnly: true,
name: 'FeeName'
}, {
fieldLabel: '费用对象',
readOnly: true,
name: 'CustomerName'
}, {
fieldLabel: '单位标准',
readOnly: true,
name: 'Unit'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '不含税单价',
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 '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}, {
fieldLabel: '税率',
readOnly: true,
name: 'TaxRate'
}, {
fieldLabel: '含税单价',
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 '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '计费数量',
readOnly: true,
name: 'Quantity'
}, {
fieldLabel: '不含税金额',
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 '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}, {
fieldLabel: '含税金额',
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 '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '币别',
readOnly: true,
name: 'Currency'
}, {
fieldLabel: '汇率',
readOnly: true,
labelWidth: 60,
name: 'ExChangerate'
}, {
fieldLabel: '财务税率',
readOnly: true,
labelWidth: 60,
name: 'AccTaxRate'
}, {
fieldLabel: '是否垫付',
readOnly: true,
name: 'IsAdvancedpay'
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '备注', //'备注',
name: 'Remark'
}, {
fieldLabel: '修改原因',
readOnly: true,
name: 'Reason'
}]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
me = this;
this.winShenModifyShow = Ext.create('Ext.window.Window', {
title: "费用申请修改",
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: "提交申请",
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: '提示', msg: '费用名称不能为空!', 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: '提示', msg: '结费对象不能为空!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
var TaxRate = form.findField('TaxRate').getValue();
if (TaxRate == null || TaxRate == undefined) {
Ext.Msg.show({ title: '提示', msg: '税率不能为空!', 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: '提示', msg: '币别不能为空!', 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: '提示', msg: '汇率不能为空!', 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: '提示', msg: '修改原因不能为空!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
var type = form.findField('FeeType').getValue();
me.onCreateModifyClick(type);
}
}, {
text: "取消申请",
minWidth: 70,
handler: function () {
me.winShenModifyShow.close();
}
}]
});
this.winShenDeleteShow = Ext.create('Ext.window.Window', {
title: "费用申请删除",
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: "提交申请",
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: '提示', msg: '删除原因不能为空!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
var type = form.findField('FeeType').getValue();
me.onCreateDeleteClick(type);
}
}, {
text: "取消申请",
minWidth: 70,
handler: function () {
me.winShenDeleteShow.close();
}
}]
});
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: '驳回原因',
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: '驳回原因',
height: 70,
name: 'Reason',
anchor: '100%'
}
]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
//#endregion
this.panelDrChFee = new Ext.Panel({
//title: '应收费用',
layout: "border",
anchor: '100% 50%',
frame: true,
split: true,
items: [this.gridDrChFee, this.NewFeeShowDr, this.AuditBackReasonDr]
});
this.panelCrChFee = new Ext.Panel({
//title: '应付费用',
layout: "border",
anchor: '100% 50%',
// region: 'center',
frame: true,
items: [this.gridCrChFee, this.NewFeeShowCr, this.AuditBackReasonCr]
});
this.panelFee = new Ext.Panel({
// layout: "border",
layout: "anchor",
// region: 'north',
// height: 560,
region: 'center',
items: [
this.panelDrChFee, this.panelCrChFee
]
});
//#region 布局
Ext.apply(this, {
items: [this.panelFee, this.tabTotal]
});
//#endregion
this.opStatus = 'add';
/*
parentWin = window.parent.opener;
{
if (parentWin) {
var ret = parentWin.OprationSwap();
var fun = ret[4];
}
}
*/
_thisfee = 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) {
_thisfee.NewFeeShowDr.getForm().loadRecord(_thisfee.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);
}
var FeeName = record.data.FeeName;
for (i = 0; i < this.storeCrChFee.getCount(); i += 1) {
var memberyf = this.storeCrChFee.getAt(i);
var recchange = memberyf.getChanges();
if (memberyf.data.FeeName == FeeName) {
memberyf.set("ISSEL", '1');
} else {
memberyf.set("ISSEL", '0');
}
if (isEmptyObject(recchange)) memberyf.commit();
};
}, 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) {
_thisfee.NewFeeShowCr.getForm().loadRecord(_thisfee.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);
}
var FeeName = record.data.FeeName;
for (i = 0; i < this.storeDrChFee.getCount(); i += 1) {
var memberyf = this.storeDrChFee.getAt(i);
var recchange = memberyf.getChanges();
if (memberyf.data.FeeName == FeeName) {
memberyf.set("ISSEL", '1');
} else {
memberyf.set("ISSEL", '0');
}
if (isEmptyObject(recchange)) memberyf.commit();
};
}, this);
this.gridDrChFee.on({
selectionchange: function (sm, selections) {
if (selections.length == 0) {
for (i = 0; i < _thisfee.storeCrChFee.getCount(); i += 1) {
var memberyf = _thisfee.storeCrChFee.getAt(i);
var recchange = memberyf.getChanges();
memberyf.set("ISSEL", '0');
if (isEmptyObject(recchange)) memberyf.commit();
};
} 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
});
_thisfee.storeCustomerNameRefDr.add(recordCustCode);
}
}
});
this.gridCrChFee.on({
selectionchange: function (sm, selections) {
if (selections.length == 0) {
for (i = 0; i < _thisfee.storeDrChFee.getCount(); i += 1) {
var memberyf = _thisfee.storeDrChFee.getAt(i);
var recchange = memberyf.getChanges();
memberyf.set("ISSEL", '0');
if (isEmptyObject(recchange)) memberyf.commit();
};
}
}
});
this.InitData();
}, //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;
// var el = Ext.get("gridDrChFee");
/*
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
//#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 });
}
}
},
onUpKeyClick: 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 < 0) number = 0;
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 < 0) number = 0;
this.cellEditingCrChFee.startEditByPosition({ row: number, column: col });
}
},
onAddDetailClick: function (button, event, type) {
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('函数(onAddDetailClick)的参数type类型设置的不对');
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 newSerialno = this.GetHandleSerialNo(store);
var newsort = store.getCount() + 1;
var myDate = new Date();
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,
TaxUnitPrice: 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: USERID,
OpName: SHOWNAME,
EnterDate: myDate,
DebitNo: '',
IsDebit: "0",
IsOpen: "0",
IsAdvancedpay: "0",
Sort: newSerialno,
IsInvoice: "0",
ISACC: "0",
FeeFrt: '',
IsCrmOrderFee: "0",
AuditStatus: 0,
InvoiceNum: '',
ChequeNum: '',
WmsOutBsNo: this.WMSOUTBSNO,
UNINVOICE: -1
});
var z = 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();
var feeid = z[0].internalId;
var rown = store.data.keys.indexOf(feeid);
cellediting.startEditByPosition({ row: rown, column: editColumnIndex });
},
onAddSelectDetailClick: function (button, event, type) {
var allow = this.getAllowOperationDetail();
if (allow == false) {
return;
}
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('函数(onAddDetailClick)的参数type类型设置的不对');
return;
}
if (selectedRecords.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择要添加的费用!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var myDate = new Date();
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);
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,
TaxUnitPrice: memberyf.data.TaxUnitPrice,
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: memberyf.data.Remark,
Commissionrate: memberyf.data.Commissionrate,
Settlement: 0,
Invoice: 0,
OrderAmount: 0,
OrderInvoice: 0,
SubmitDate: null,
Auditoperator: '',
AuditDate: null,
EnteroPerator: USERID,
OpName: SHOWNAME,
EnterDate: myDate,
DebitNo: '',
IsDebit: "0",
IsOpen: "0",
ISACC: "0",
IsAdvancedpay: "0",
Sort: newSerialno,
IsInvoice: "0",
FeeFrt: memberyf.data.FeeFrt,
IsCrmOrderFee: "0",
AuditStatus: 0,
InvoiceNum: '',
ChequeNum: '',
WmsOutBsNo: this.WMSOUTBSNO
});
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) {
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('函数(onAddDetailClick)的参数type类型设置的不对');
return;
}
var myDate = new Date();
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);
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,
TaxUnitPrice: memberyf.data.TaxUnitPrice,
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: memberyf.data.Remark,
Commissionrate: memberyf.data.Commissionrate,
Settlement: 0,
Invoice: 0,
OrderAmount: 0,
OrderInvoice: 0,
SubmitDate: null,
Auditoperator: '',
AuditDate: null,
EnteroPerator: USERID,
OpName: SHOWNAME,
EnterDate: myDate,
DebitNo: '',
IsDebit: "0",
IsOpen: "0",
ISACC: "0",
IsAdvancedpay: "0",
Sort: newSerialno,
IsInvoice: "0",
FeeFrt: memberyf.data.FeeFrt,
IsCrmOrderFee: "0",
AuditStatus: 0,
InvoiceNum: '',
ChequeNum: '',
WmsOutBsNo: this.WMSOUTBSNO
});
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();
},
onAddClearRepairClick: function (menu, event) {
var selectedRecords = [];
selectedRecords = this.feeCrGridCheckBoxModel.selected.items;
if (selectedRecords.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择要生成的费用!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var bodyDrChFeeDatas = [];
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
bodyDrChFeeDatas.push(rec);
}
var jsonChFeeBody = ConvertRecordsToJsonAll(bodyDrChFeeDatas);
Ext.Ajax.request({
waitMsg:'正在处理数据...',
url: '/MvcContainer/MsOpCtnBsCard/CreateOpCtnRepairFromFee',
params: {
data: jsonChFeeBody
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title:'提示',
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
} else {
Ext.Msg.show({ title:'提示', msg: '已生成业务信息!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
} else {
Ext.MessageBox.alert('服务器响应出错!', response.responseText);
}
},
scope: this
});
},
onAddYardRemarkClick: function (menu, event) {
selectedRecords = this.feeCrGridCheckBoxModel.selected.items;
if (selectedRecords.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择要生成的费用!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var bsno = selectedRecords[0].data.BsNo;
Ext.Ajax.request({
waitMsg: '正在处理数据...',
url: '/MvcContainer/MsOpCtnBsCard/GetYardRemark',
params: {
bsno: bsno
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title: '提示',
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
} else {
var remark = result.Data;
for (var i = 0; i < selectedRecords.length; i++) {
var memberyf = selectedRecords[i];
memberyf.set("Remark", remark);
}
}
} else {
Ext.MessageBox.alert('服务器响应出错!', response.responseText);
}
},
scope: this
});
},
onHistryAddDetailClick: function (menu, event, type) {
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('函数(onAddDetailClick)的参数type类型设置的不对');
return;
}
DsOpenEditWin("/MvcContainer/MsOpCtnBsCard/CtnStatusFee?ishistry=1", "引入罐箱费用");
},
onTemplateAddDetailClick: function (menu, event, type) {
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('函数(onAddDetailClick)的参数type类型设置的不对');
return;
}
DsOpenEditWin("/MvcShipping/MsFeeTemplate/AddFeeIndex", "模板引入费用");
// window.open('/MvcShipping/MsFeeTemplate/AddFeeIndex', "模板引入费用", 'width=1200,height=760,top=0,left=0,resizable=yes,status=yes,menubar=no,scrollbars=yes');
// DsOpenEditWin("/MvcShipping/MsFeeTemplate/AddFeeIndex", "模板引入费用");
},
onCtnTkAddDetailClick: function (menu, event, type) {
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('函数(onAddDetailClick)的参数type类型设置的不对');
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('函数(onCancelDetailClick)的参数type类型设置的不对');
return;
}
for (var i = 0; i < store.getCount(); i += 1) {
var member = store.getAt(i);
member.reject();
}
this.calcDetailTotal();
},
GetHandleSerialNo: function (store) {
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;
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: '提示', msg: '请先选择要删除的费用!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
Ext.MessageBox.confirm('提示', '确定要删除选中的费用吗?', 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]);
}
this.calcDetailTotal();
} else {
var feeGId = "'" + rec.data.GId + "'";
if (feeGidSql == '') {
feeGidSql = feeGId;
} else {
feeGidSql = feeGidSql + "," + feeGId;
}
}
}
}
_thisfee = this;
Ext.Msg.wait('正在删除数据...');
if (feeGidSql != '') {
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/MvcShipping/MsChFee/Delete',
params: {
bsno: _thisfee.strBSNO,
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]);
}
}
// this.calcDetailTotal();
this.storeChFeeGain.load({ params: { bsno: _thisfee.strBSNO, optype: _thisfee.stroplb} });
this.storeBodySum.load({ params: { bsno: _thisfee.strBSNO, optype: _thisfee.stroplb },
callback: function (r, options, success) {
if (success) {
_thisfee.setTotalHead();
}
}
});
Ext.Msg.hide();
}
else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
}
},
failure: function (response, options) {
Ext.Msg.show({ title: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
},
success: function (response, options) {
},
scope: this
}); //end Ext.Ajax.request
} else {
Ext.Msg.show({ title: '提示', msg: "删除成功!", icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
}
}, this);
},
CheckChFeeDelete: function (records, type) {
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: '提示',
msg: '只能删除费用状态为[录入状态]和[驳回提交]的费用,请重新选择',
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: '提示', 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: '提示', msg: '你没有权限删除' + opname + '录入的费用!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
canDelete = false;
}
}
}
if (canDelete) {
if (rec.data.Invoice != 0) {
Ext.Msg.show({ title: '提示', msg: '当前费用已开出发票无法删除!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
canDelete = false;
}
}
if (canDelete) {
if (rec.data.OrderAmount != 0) {
Ext.Msg.show({ title: '提示', msg: '当前费用已申请费用无法删除!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
canDelete = false;
}
}
if (canDelete) {
if (rec.data.OrderInvoice != 0) {
Ext.Msg.show({ title: '提示', msg: '当前费用已申请开票无法删除!', 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: '提示', msg: '当前费用已対帐无法删除!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
canDelete = false;
}
}
if (canDelete) {
if (rec.data.IsCrmOrderFee == 'True' || rec.data.IsCrmOrderFee == '1') {
Ext.Msg.show({ title: '提示', msg: '当前费用为成本核算费用,无法删除!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
canDelete = false;
}
}
if (canDelete) {
if (rec.data.WmsOutBsNo != '' && rec.data.WmsOutBsNo == null) {
Ext.Msg.show({ title: '提示', msg: '当前费用已引入操作模块,无法删除!', 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);
bodyDrChFeeDatas.push(memberyf);
var ExChangerate = memberyf.data.ExChangerate;
};
var jsonChFeeBody = ConvertFeeRecordsToJson(bodyDrChFeeDatas);
} else if (type == '2') {
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);
};
_thisfee = this;
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/MvcShipping/MsChFee/Save',
scope: this,
params: {
bsno: _thisfee.strBSNO,
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') {
// for (var i = 0; i < this.storeDrChFee.getCount(); i += 1) {
// var member = this.storeDrChFee.getAt(i);
// member.set("BsNo", _thisfee.strBSNO);
// member.commit();
// }
//// this.gridDrChFee.unSelectAll();
// } else if (type == '2') {
// for (var i = 0; i < this.storeCrChFee.getCount(); i += 1) {
// var member = this.storeCrChFee.getAt(i);
// member.set("BsNo", _thisfee.strBSNO);
// member.commit();
// }
//// this.gridCrChFee.unSelectAll();
// }
if (type == 1) {
_thisfee.LoadDrChFee();
} else {
_thisfee.LoadCrChFee();
}
this.storeChFeeGain.load({ params: { bsno: _thisfee.strBSNO, optype: _thisfee.stroplb} });
this.storeBodySum.load({ params: { bsno: _thisfee.strBSNO, optype: _thisfee.stroplb },
callback: function (r, options, success) {
if (success) {
_thisfee.setTotalHead();
}
}
});
} else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
} else {
Ext.Msg.show({ title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
}
});
}, //end save
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: '提示', msg: '没有选择要申请修改的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var rec = selectedRecords[0];
if (rec.data.FeeStatus != 0) {
Ext.Msg.show({ title: '提示', msg: '当前费用状态无法申请修改!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
if (rec.data.Settlement != 0) {
Ext.Msg.show({ title: '提示', msg: '当前费用已结算无法申请修改!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
if (rec.data.IsDebit == 'True' || rec.data.IsDebit == '1') {
Ext.Msg.show({ title: '提示', msg: '当前费用已対帐无法申请修改!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
if (rec.data.Invoice != 0) {
Ext.Msg.show({ title: '提示', msg: '当前费用已开出发票无法申请修改!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
if (rec.data.OrderAmount != 0) {
Ext.Msg.show({ title: '提示', msg: '当前费用已申请费用无法申请修改!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
if (rec.data.OrderInvoice != 0) {
Ext.Msg.show({ title: '提示', msg: '当前费用已申请开票无法申请修改!', 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();
_thisfee = this;
Ext.Ajax.request({
waitMsg: '正在添加数据...',
url: '/Account/Chfee_Audit/ShenModify',
params: {
data: Ext.JSON.encode(data),
olddata: Ext.JSON.encode(olddata),
optype: _thisfee.stroplb
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title: '提示',
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
} else {
if (type == 1)
//_this.storeDrChFee.load({ params: { billno: _this.strBSNO, type: 1, optype: _this.stroplb} });
_thisfee.LoadDrChFee();
if (type == 2)
//_this.storeCrChFee.load({ params: { billno: _this.strBSNO, type: 2, optype: _this.stroplb} });
_thisfee.LoadCrChFee();
_thisfee.winShenModifyShow.close();
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', 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: '提示', msg: '没有选择要申请删除的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var rec = selectedRecords[0];
if (rec.data.FeeStatus != 0) {
Ext.Msg.show({ title: '提示', msg: '当前费用状态无法申请删除!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
if (rec.data.Settlement != 0) {
Ext.Msg.show({ title: '提示', msg: '当前费用已结算无法申请删除!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
if (rec.data.Invoice != 0) {
Ext.Msg.show({ title: '提示', msg: '当前费用已开出发票无法申请删除!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
if (rec.data.IsDebit == 'True' || rec.data.IsDebit == '1') {
Ext.Msg.show({ title: '提示', msg: '当前费用已対帐无法申请删除!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
if (rec.data.OrderAmount != 0) {
Ext.Msg.show({ title: '提示', msg: '当前费用已申请费用无法申请删除!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
if (rec.data.OrderInvoice != 0) {
Ext.Msg.show({ title: '提示', msg: '当前费用已申请开票无法申请删除!', 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();
_thisfee = this;
Ext.Ajax.request({
waitMsg: '正在申请删除...',
url: '/Account/Chfee_Audit/ShenDelete',
params: {
data: Ext.JSON.encode(data),
optype: _thisfee.stroplb
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title: '提示',
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
} else {
if (type == 1)
//_this.storeDrChFee.load({ params: { billno: _this.strBSNO, type: 1, optype: _this.stroplb} });
_thisfee.LoadDrChFee();
if (type == 2)
//_this.storeCrChFee.load({ params: { billno: _this.strBSNO, type: 2, optype: _this.stroplb} });
_thisfee.LoadCrChFee();
_thisfee.winShenDeleteShow.close();
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', 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: '提示', msg: '没有选择要取消申请的业务!', 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: '提示', msg: '当前费用状态无法取消申请!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
// var bodyDrChFeeDatas = [];
// bodyDrChFeeDatas.push(rec);
// var jsonChFeeBody = ConvertFeeRecordsToJson(bodyDrChFeeDatas);
Ext.Ajax.request({
waitMsg: '正在取消申请...',
url: '/Account/Chfee_Audit/CancelShen',
params: {
Feeid: rec.data.GId,
optype: _thisfee.stroplb
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title: '提示',
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
} else {
if (type == 1) {
/*
_this.storeDrChFee.load({ params: { billno: _this.strBSNO, type: 1, optype: _this.stroplb },
callback: function (r, options, success) {
if (success) {
if (r.length > 0) {
_this.storeDrChFee.getSelectionModel().select(0);
} else {
}
}
},
scope: this
});*/
this.LoadDrChFee(button, event);
this.NewFeeShowDr.setVisible(false);
}
if (type == 2) {
/*
_this.storeCrChFee.load({ params: { billno: _this.strBSNO, type: 2, optype: _this.stroplb },
callback: function (r, options, success) {
if (r.length > 0) {
_this.storeCrChFee.getSelectionModel().select(0);
} else {
}
},
scope: this
});*/
this.LoadCrChFee(button, event);
this.NewFeeShowCr.setVisible(false);
}
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', 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 = "../../Shipping/FeeHistory.aspx?bsno=" + this.strBSNO + "&oplb=" + this.stroplb + "&type=" + type;
var openUrl = "../../MvcShipping/MsOpBill/MsFeeHistoryView??bsno=" + this.strBSNO + "&oplb=" + this.stroplb + "&type=" + type;
window.open(openUrl, openType, openSet);
},
getAllowOperationDetail: function () {
var feeStatus = this.getFeeStatus();
if (feeStatus == '0' || feeStatus == '' || typeof (feeStatus) == 'undefined' || feeStatus == false || feeStatus == 'false')
return true;
else {
Ext.Msg.show({ title: '错误', msg: "此票委托已费用已锁定,不允许操作费用!", icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return false;
}
},
//#endregion
InitDrGrid: function (grid) {
_thisfee = this;
var agirdcolums = grid;
Ext.Ajax.request({
waitMsg: '',
url: '/MvcShipping/MsSysParamSet/GetData',
params: {
condition: "PARAMNAME='Feenotopen'"
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (result.Success != true) {
_thisfee.gridDrChFee.reconfigure(_thisfee.storeDrChFee, agirdcolums);
} else {
var data = result.data;
if (data.PARAMVALUE == '1') {
for (var j = 0; j < agirdcolums.length; j++) {
if (agirdcolums[j].dataIndex == 'IsOpen')
agirdcolums[j].hidden = false;
}
} else {
for (var j = 0; j < agirdcolums.length; j++) {
if (agirdcolums[j].dataIndex == 'IsOpen')
agirdcolums[j].hidden = true;
}
}
_thisfee.gridDrChFee.reconfigure(_thisfee.storeDrChFee, agirdcolums);
}
} else {
_this.gridDrChFee.reconfigure(_this.storeDrChFee, agirdcolums);
}
},
scope: this
});
},
InitCrGrid: function (grid) {
_thisfee = this;
var agirdcolums = grid;
// this.gridCrChFee.reconfigure(this.storeCrChFee, agirdcolums);
Ext.Ajax.request({
waitMsg: '',
url: '/MvcShipping/MsSysParamSet/GetData',
params: {
condition: "PARAMNAME='Feenotopen'"
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (result.Success != true) {
_thisfee.gridCrChFee.reconfigure(_thisfee.storeCrChFee, agirdcolums);
} else {
var data = result.data;
if (data.PARAMVALUE == '1') {
for (var j = 0; j < agirdcolums.length; j++) {
if (agirdcolums[j].dataIndex == 'IsOpen')
agirdcolums[j].hidden = false;
}
} else {
for (var j = 0; j < agirdcolums.length; j++) {
if (agirdcolums[j].dataIndex == 'IsOpen')
agirdcolums[j].hidden = true;
}
}
_thisfee.gridCrChFee.reconfigure(_thisfee.storeCrChFee, agirdcolums);
}
} else {
_thisfee.gridCrChFee.reconfigure(_thisfee.storeCrChFee, agirdcolums);
}
},
scope: this
});
},
//#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);
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 == '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);
}
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);
}
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') {
var records = DsStoreQueryBy(this.storeFeeNameRef, 'Name', e.value);
var FEENAME = e.value;
if (records.getCount() > 0) {
var data = records.getAt(0).data;
var Currency = data.DefaultCurr;
var Description = data.Description;
var DEFAULTUNIT = data.DefaultUnit;
var UNIT = '';
var custtype = '';
var FeeType = e.record.data['FeeType'];
var codeFEETYPE = data.FEETYPE;
//alert(codeFEETYPE);
e.record.set('Currency', Currency);
e.record.set('FeeDescription', Description);
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 != 'RMB') {
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);
this.calcDetailTotal();
// if (codeFEETYPE == "普通") {
// e.record.set('IsAdvancedpay', "0");
// } else {
// e.record.set('IsAdvancedpay', "1");
// }
} else {
e.record.set('Currency', 'RMB');
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 (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);
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);
e.record.set('Amount', amount);
var quantity = e.record.data['Quantity'];
if (quantity != null && quantity != 0) {
var unitPrice = Div(notaxamount, quantity); //(parseFloat(notaxamount).div(parseFloat(quantity))).toFixed(2);
e.record.set('UnitPrice', unitPrice);
var TaxUnitPrice = Div(amount, quantity);
e.record.set('TaxUnitPrice', TaxUnitPrice);
}
/*
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, Mul(taxrate, 0.01)); //parseFloat(1 + parseFloat(taxrate.mul(0.01)));
var notaxamount = Div(amount, taxrateb); //(parseFloat(amount).div(taxrateb)).toFixed(2);
e.record.set('NoTaxAmount', notaxamount);
var quantity = e.record.data['Quantity'];
if (quantity != null && quantity != 0) {
var unitPrice = Div(notaxamount, quantity); //(parseFloat(notaxamount).div(parseFloat(quantity))).toFixed(2);
e.record.set('UnitPrice', unitPrice);
var TaxUnitPrice = Div(amount, quantity);
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);
this.calcDetailTotal();
} else if (e.field == 'Currency') {
var FeeType = e.record.data['FeeType'];
if (e.value == 'RMB') {
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);
}
}
},
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 == 'RMB') {
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 == 'RMB') {
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 == '人民币') {
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 == '美元') {
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();
},
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;
for (i = 0; i < this.storeBodySum.getCount(); i += 1) {
var memberyf = this.storeBodySum.getAt(i);
if (memberyf.data.CURR == '人民币') {
rmbdr = memberyf.data.DR;
rmbcr = memberyf.data.CR;
rmbprofit = memberyf.data.PR;
} else if (memberyf.data.CURR == '美元') {
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) {
rmblb = "&nbsp&nbsp&nbspRMB应收:<font color='green'>" + returnfloat(rmbdr) + "</font> &nbsp&nbsp RMB应付: <font color='green'>" + returnfloat(rmbcr) + "</font> &nbsp&nbspRMB利润:<font color='green'>" + returnfloat(rmbprofit) + "</font>&nbsp&nbsp&nbsp|";
// rmblb = "<span style="margin:0;padding:0;height:22px;line-height:22px;font-size:12px;color:#04408c;font-family:'微软雅黑';font-weight:bold;display:inline-block;">统计信息(文字标题)<span style="margin:0;margin-left:40px;padding:0;height:22px;line-height:22px;font-size:12px;color:#04408c;font-family:'微软雅黑';font-weight:normal;display:inline-block;">(字段名-中文)</span><span style="margin:0;padding:0;height:22px;line-height:22px;font-size:12px;color:#ff0000;font-family:'微软雅黑';font-weight:normal;display:inline-block;">(字段值-负值)</span><span style="margin:0;margin-left:20px;padding:0;height:22px;line-height:22px;font-size:12px;color:#04408c;font-family:'微软雅黑';font-weight:normal;display:inline-block;">(字段名-中文)</span><span style="margin:0;padding:0;height:22px;line-height:22px;font-size:12px;color:#009bdb;font-family:'微软雅黑';font-weight:normal;display:inline-block;">(字段值-正值)</span></span>";
}
if (usddr != 0 || usdcr != 0 || usdprofit != 0) {
usdlb = "&nbsp&nbsp&nbspUSD应收: <font color='green'>" + returnfloat(usddr) + "</font> &nbsp&nbspUSD应付:<font color='green'>" + returnfloat(usdcr) + "</font> &nbsp&nbspUSD利润<font color='green'>" + returnfloat(usdprofit) + "</font>&nbsp&nbsp&nbsp|";
}
if (otdr != 0 || otcr != 0 || otprofit != 0) {
otlb = "&nbsp&nbsp&nbsp其他币别应收: <font color='green'>" + returnfloat(otdr) + "</font> &nbsp&nbsp 其他币别应付:<font color='green'>" + returnfloat(otcr) + "</font> &nbsp&nbsp其他币别利润<font color='green'>" + returnfloat(otprofit) + "</font>&nbsp&nbsp&nbsp|";
}
if (ttldr != 0 || ttlcr != 0 || ttlprofit != 0) {
ttllb = "&nbsp&nbsp&nbsp合计应收: <font color='green'>" + returnfloat(ttldr) + "</font> &nbsp&nbsp合计应付:<font color='green'>" + returnfloat(ttlcr) + "</font> &nbsp&nbsp合计利润<font color='green'>" + returnfloat(ttlprofit) + "</font>&nbsp&nbsp利润率<font color='green'>" + returnfloat(profitrate) + "</font>";
}
this.tabTotal.setTitle("利润合计:" + rmblb + usdlb + otlb + ttllb);
},
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;
}
var chfeefeeStatus = e.record.get('FeeStatus');
var canedit = chfeefeeStatus == 1 || chfeefeeStatus == 6 || chfeefeeStatus == 2;
var IsDebit = e.record.get('IsDebit');
if (canedit) {
if (IsDebit == 'True' || IsDebit == '1') {
Ext.Msg.show({ title: '提示', msg: '当前费用已対帐无法修改!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
canedit = false;
}
};
if (canedit) {
if (e.record.get('Invoice') != 0) {
Ext.Msg.show({ title: '提示', msg: '当前费用已开出发票无法申请修改!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
canedit = false;
}
}
if (canedit) {
if (e.record.get('OrderAmount') != 0) {
Ext.Msg.show({ title: '提示', msg: '当前费用已申请费用无法申请修改!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
canedit = false;
}
}
if (canedit) {
if (e.record.get('OrderInvoice') != 0) {
Ext.Msg.show({ title: '提示', msg: '当前费用已申请开票无法申请修改!', 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: '提示', 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: '提示', 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);
// }
},
onSubmitAuditClick: 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('函数(onAddDetailClick)的参数type类型设置的不对');
return;
}
var modifyrecords = store.getUpdatedRecords(); // 获取修改的行的数据,无法获取幻影数据
var phantoms = store.getNewRecords(); //获得幻影行
modifyrecords = modifyrecords.concat(phantoms); //将幻影数据与真实数据合并
if (modifyrecords.length != 0) {
Ext.Msg.show({ title: '提示', msg: '有未保存的费用,请先保存费用然后再提交审核!', 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: '提示', msg: '请先选择要提交审核的费用!', 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: '提示', msg: '客户名称不能为空!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
var FeeName = rec.data.FeeName;
if (FeeName == '') {
Ext.Msg.show({ title: '提示', msg: '费用名称不能为空!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
var Currency = rec.data.Currency;
if (Currency == '') {
Ext.Msg.show({ title: '提示', msg: '币别不能为空!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
var ExChangerate = rec.data.ExChangerate;
if (ExChangerate == 0) {
Ext.Msg.show({ title: '提示', msg: '汇率不能为0!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
var Amount = rec.data.Amount;
if (Amount == 0) {
Ext.Msg.show({ title: '提示', msg: '金额为0,不能提交!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
}
if (insert == true) {
Ext.Msg.show({ title: '提示', msg: '有未保存的费用,请先保存费用然后再提交审核!', 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: '提示',
msg: '只能费用状态为[录入状态]和[驳回提交]的费用才能提交审核,请重新选择',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
} else {
bodyDrChFeeDatas.push(rec);
GidStr = GidStr + Gid;
}
}
var jsonChFeeBody = ConvertRecordsToJsonAll(bodyDrChFeeDatas);
_thisfee = this;
if (GidStr == '') {
} else {
Ext.Ajax.request({
waitMsg: '正在添加数据...',
url: '/Account/Chfee_Audit/SubmitAuditNew',
params: {
feebody: jsonChFeeBody,
optype: _thisfee.stroplb
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title: '提示',
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
} else {
if (type == 1) {
//_this.storeDrChFee.load({ params: { billno: _this.strBSNO, type: 1, optype: _this.stroplb} });
_thisfee.LoadDrChFee(button, event);
} else {
//_this.storeCrChFee.load({ params: { billno: _this.strBSNO, type: 2, optype: _this.stroplb} });
_thisfee.LoadCrChFee(button, event);
}
this.storeChFeeGain.load({ params: { bsno: _thisfee.strBSNO, optype: _thisfee.stroplb} });
this.storeBodySum.load({ params: { bsno: _thisfee.strBSNO, optype: _thisfee.stroplb },
callback: function (r, options, success) {
if (success) {
_thisfee.setTotalHead();
}
}
});
if (result.Data != '') {
Ext.Msg.show({
title: '提示',
msg: '已提交审核,' + result.Data,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
}
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}
},
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('函数(onAddDetailClick)的参数type类型设置的不对');
return;
}
var modifyrecords = store.getUpdatedRecords(); // 获取修改的行的数据,无法获取幻影数据
var phantoms = store.getNewRecords(); //获得幻影行
modifyrecords = modifyrecords.concat(phantoms); //将幻影数据与真实数据合并
if (modifyrecords.length != 0) {
Ext.Msg.show({ title: '提示', msg: '有未保存的费用,请先保存费用然后再提交审核!', 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: '提示', msg: '请先选择要提交审核的费用!', 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: '提示', msg: '客户名称不能为空!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
var FeeName = rec.data.FeeName;
if (FeeName == '') {
Ext.Msg.show({ title: '提示', msg: '费用名称不能为空!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
var Currency = rec.data.Currency;
if (Currency == '') {
Ext.Msg.show({ title: '提示', msg: '币别不能为空!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
var ExChangerate = rec.data.ExChangerate;
if (ExChangerate == 0) {
Ext.Msg.show({ title: '提示', msg: '汇率不能为0!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
var Amount = rec.data.Amount;
if (Amount == 0) {
Ext.Msg.show({ title: '提示', msg: '金额为0,不能提交!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
}
if (insert == true) {
Ext.Msg.show({ title: '提示', msg: '有未保存的费用,请先保存费用然后再提交审核!', 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 == 1 || feeStatus == 6;
if (canDelete == false) {
Ext.Msg.show({ title: '提示',
msg: '只能费用状态为[录入状态]和[驳回提交]的费用才能提交审核,请重新选择',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
} else {
if (GidStr == '')
GidStr = Gid;
else {
GidStr = GidStr + ',' + Gid;
}
}
}
_thisfee = this;
if (GidStr == '') {
} else {
Ext.Ajax.request({
waitMsg: '正在添加数据...',
url: '/Account/Chfee_Audit/SubmitAudit',
params: {
GidStr: GidStr,
optype: _thisfee.stroplb
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title: '提示',
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
} else {
if (type == 1) {
//_this.storeDrChFee.load({ params: { billno: _this.strBSNO, type: 1, optype: _this.stroplb} });
_thisfee.LoadDrChFee(button, event);
} else {
//_this.storeCrChFee.load({ params: { billno: _this.strBSNO, type: 2, optype: _this.stroplb} });
_thisfee.LoadCrChFee(button, event);
}
this.storeChFeeGain.load({ params: { bsno: _thisfee.strBSNO, optype: _thisfee.stroplb} });
this.storeBodySum.load({ params: { bsno: _thisfee.strBSNO, optype: _thisfee.stroplb },
callback: function (r, options, success) {
if (success) {
_thisfee.setTotalHead();
}
}
});
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}
},
onSubmitAuditAllClick: 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('函数(onAddDetailClick)的参数type类型设置的不对');
return;
}
for (var i = 0; i < store.getCount(); i++) {
var rec = store.getAt(i);
var bsno = rec.data.BsNo;
if (bsno == '*') {
insert = true;
}
var custname = rec.data.CustomerName;
if (custname == '') {
Ext.Msg.show({ title: '提示', msg: '客户名称不能为空!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
var FeeName = rec.data.FeeName;
if (FeeName == '') {
Ext.Msg.show({ title: '提示', msg: '费用名称不能为空!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
var Currency = rec.data.Currency;
if (Currency == '') {
Ext.Msg.show({ title: '提示', msg: '币别不能为空!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
var ExChangerate = rec.data.ExChangerate;
if (ExChangerate == 0) {
Ext.Msg.show({ title: '提示', msg: '汇率不能为0!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
var Amount = rec.data.Amount;
if (Amount == 0) {
Ext.Msg.show({ title: '提示', msg: '金额为0,不能提交!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
}
var modifyrecords = store.getUpdatedRecords(); // 获取修改的行的数据,无法获取幻影数据
var phantoms = store.getNewRecords(); //获得幻影行
modifyrecords = modifyrecords.concat(phantoms); //将幻影数据与真实数据合并
if (modifyrecords.length != 0) {
var bodyDrChFeeDatas = [];
var i;
if (type == '1') {
for (i = 0; i < this.storeDrChFee.getCount(); i += 1) {
var memberyf = this.storeDrChFee.getAt(i);
bodyDrChFeeDatas.push(memberyf);
var ExChangerate = memberyf.data.ExChangerate;
};
var jsonChFeeBody = ConvertFeeRecordsToJson(bodyDrChFeeDatas);
} else if (type == '2') {
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);
};
_thisfee = this;
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/MvcShipping/MsChFee/Save',
scope: this,
params: {
bsno: _thisfee.strBSNO,
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') {
for (var i = 0; i < this.storeDrChFee.getCount(); i += 1) {
var member = this.storeDrChFee.getAt(i);
member.set("BsNo", _thisfee.strBSNO);
member.commit();
}
} else if (type == '2') {
for (var i = 0; i < this.storeCrChFee.getCount(); i += 1) {
var member = this.storeCrChFee.getAt(i);
member.set("BsNo", _thisfee.strBSNO);
member.commit();
}
}
this.onSubmitAuditAllfn(button, event, type);
} else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
} else {
Ext.Msg.show({ title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
}
});
} else {
this.onSubmitAuditAllfn(button, event, type);
}
},
onSubmitAuditAllfn: function (button, event, type) {
var GidStr = '';
var store = null;
if (type == 1) {
store = this.storeDrChFee;
} else if (type == 2) {
store = this.storeCrChFee;
} else {
alert('函数(onAddDetailClick)的参数type类型设置的不对');
return;
}
var bodyDrChFeeDatas = [];
for (var i = 0; i < store.getCount(); i++) {
var rec = store.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;
}
}
_thisfee = this;
if (GidStr == '') {
} else {
var jsonChFeeBody = ConvertRecordsToJsonAll(bodyDrChFeeDatas);
Ext.Ajax.request({
waitMsg: '正在添加数据...',
url: '/Account/Chfee_Audit/SubmitAuditNew',
params: {
feebody: jsonChFeeBody,
optype: _thisfee.stroplb
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title: '提示',
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
} else {
if (type == 1) {
//_this.storeDrChFee.load({ params: { billno: _this.strBSNO, type: 1, optype: _this.stroplb} });
_thisfee.LoadDrChFee(button, event);
} else {
//_this.storeCrChFee.load({ params: { billno: _this.strBSNO, type: 2, optype: _this.stroplb} });
_thisfee.LoadCrChFee(button, event);
}
this.storeChFeeGain.load({ params: { bsno: _thisfee.strBSNO, optype: _thisfee.stroplb} });
this.storeBodySum.load({ params: { bsno: _thisfee.strBSNO, optype: _thisfee.stroplb },
callback: function (r, options, success) {
if (success) {
_thisfee.setTotalHead();
}
}
});
if (result.Data != '' && result.Data != null) {
Ext.Msg.show({
title: '提示',
msg: '已提交审核,' + result.Data,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
}
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', 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('函数(onAddDetailClick)的参数type类型设置的不对');
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: '提示', msg: '客户名称不能为空!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
var FeeName = rec.data.FeeName;
if (FeeName == '') {
Ext.Msg.show({ title: '提示', msg: '费用名称不能为空!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
var Currency = rec.data.Currency;
if (Currency == '') {
Ext.Msg.show({ title: '提示', msg: '币别不能为空!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
var ExChangerate = rec.data.ExChangerate;
if (ExChangerate == 0) {
Ext.Msg.show({ title: '提示', msg: '汇率不能为0!', 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: '提示', msg: '客户名称不能为空!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
var FeeName = rec.data.FeeName;
if (FeeName == '') {
Ext.Msg.show({ title: '提示', msg: '费用名称不能为空!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
var Currency = rec.data.Currency;
if (Currency == '') {
Ext.Msg.show({ title: '提示', msg: '币别不能为空!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
var ExChangerate = rec.data.ExChangerate;
if (ExChangerate == 0) {
Ext.Msg.show({ title: '提示', msg: '汇率不能为0!', 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);
_thisfee = this;
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/MvcShipping/MsChFee/Save',
scope: this,
params: {
bsno: _thisfee.strBSNO,
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", _thisfee.strBSNO);
member.commit();
}
for (var i = 0; i < this.storeCrChFee.getCount(); i += 1) {
var member = this.storeCrChFee.getAt(i);
member.set("BsNo", _thisfee.strBSNO);
member.commit();
}
this.onSubmitAuditBillfn(button, event, type);
} else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
} else {
Ext.Msg.show({ title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
}
});
} else {
this.onSubmitAuditBillfn(button, event, type);
}
},
onSubmitAuditBillfn: function (button, event, type) {
var GidStr = '';
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;
}
}
_thisfee = this;
if (GidStr == '') {
} else {
var jsonChFeeBody = ConvertRecordsToJsonAll(bodyDrChFeeDatas);
Ext.Ajax.request({
waitMsg: '正在添加数据...',
url: '/Account/Chfee_Audit/SubmitAuditBL',
params: {
feebody: jsonChFeeBody,
optype: _thisfee.stroplb
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title: '提示',
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
} else {
_thisfee.LoadDrChFee(button, event);
_thisfee.LoadCrChFee(button, event);
this.storeChFeeGain.load({ params: { bsno: _thisfee.strBSNO, optype: _thisfee.stroplb} });
this.storeBodySum.load({ params: { bsno: _thisfee.strBSNO, optype: _thisfee.stroplb} });
if (result.Data != '' && result.Data != null) {
Ext.Msg.show({
title: '提示',
msg: '已提交审核,' + result.Data,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
}
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', 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('函数(onAddDetailClick)的参数type类型设置的不对');
return;
}
var modifyrecords = store.getUpdatedRecords(); // 获取修改的行的数据,无法获取幻影数据
var phantoms = store.getNewRecords(); //获得幻影行
modifyrecords = modifyrecords.concat(phantoms); //将幻影数据与真实数据合并
if (modifyrecords.length != 0) {
Ext.Msg.show({ title: '提示', msg: '有未保存的费用,请先保存费用然后再撤销提交!', 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: '提示', msg: '请先选择要撤销提交的费用!', 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: '提示',
msg: '只能费用状态为[提交审核]的费用才能撤销提交审核,请重新选择',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
} else {
if (GidStr == '')
GidStr = Gid;
else {
GidStr = GidStr + ',' + Gid;
}
}
}
_thisfee = this;
if (GidStr == '') {
} else {
Ext.Ajax.request({
waitMsg: '正在添加数据...',
url: '/Account/Chfee_Audit/CancelAudit',
params: {
GidStr: GidStr,
optype: _thisfee.stroplb
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title: '提示',
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
} else {
if (type == 1) {
//_this.storeDrChFee.load({ params: { billno: _this.strBSNO, type: 1, optype: _this.stroplb} });
_thisfee.LoadDrChFee();
} else {
//_this.storeCrChFee.load({ params: { billno: _this.strBSNO, type: 2, optype: _this.stroplb} });
_thisfee.LoadCrChFee();
}
this.storeChFeeGain.load({ params: { bsno: _thisfee.strBSNO, optype: _thisfee.stroplb} });
this.storeBodySum.load({ params: { bsno: _thisfee.strBSNO, optype: _thisfee.stroplb },
callback: function (r, options, success) {
if (success) {
_thisfee.setTotalHead();
}
}
});
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}
},
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: '提示', msg: '请先选择要禁开发票的费用!', 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: '正在提交数据...',
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: '提示',
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
} else {
if (type == 1) {
_thisfee.LoadDrChFee();
} else {
_thisfee.LoadCrChFee();
}
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', 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: '提示', msg: '请先选择要解禁开发票的费用!', 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: '正在提交数据...',
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: '提示',
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
} else {
if (type == 1) {
_thisfee.LoadDrChFee();
} else {
_thisfee.LoadCrChFee();
}
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}
},
getModifyStatus: function () {
var drmodify = this.storeDrChFee.getModifiedRecords();
var crmodify = this.storeCrChFee.getModifiedRecords();
if (drmodify.length != 0 || crmodify.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
}
return false;
}
},
getFeeStatus: function () {
var feeStatus = this.EditRecord.get('FEESTATUS');
return feeStatus;
/*
//if (this.EditRecord == null || typeof (this.EditRecord) == 'undefined') {
// return '';
//} else {
var feeStatus = this.EditRecord.get('FEESTATUS');
if (typeof (this.EditRecord) == 'undefined') {
return "0";
} else {
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();
},
setSaveBtnStatus: function (enable) {
var bsbtnSave = Ext.getCmp('pcbtnSave');
var bsbtnSaveAndClose = Ext.getCmp('pcbtnSaveAndClose');
var bsbtnSaveAndNew = Ext.getCmp('pcbtnSaveAndNew');
var pcbtnNew = Ext.getCmp('pcbtnNew');
if (enable) {
bsbtnSave.enable();
bsbtnSaveAndClose.enable();
bsbtnSaveAndNew.enable();
pcbtnNew.enable();
} else {
//bsbtnSave.disable();
//bsbtnSaveAndClose.disable();
bsbtnSaveAndNew.disable();
pcbtnNew.disable();
}
},
onPrintSelectDetailClick: 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;
MBLNO = this.strMBLNO + "应收费用";
} else if (type == 2) {
selectedRecords = this.feeCrGridCheckBoxModel.selected.items;
MBLNO = this.strMBLNO + "应付费用";
} else {
alert('函数(onAddDetailClick)的参数type类型设置的不对');
return;
}
if (selectedRecords.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择要打印的费用!', 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 + "'";
} else if (this.stroplb == 'OpCtnBsCard') {
var printType = '';
if (type == 1) {
printType = 'CTNBSCARDDRFEE';
} else { printType = 'CTNBSCARDCRFEE'; };
var sql1 = /*"SET LANGUAGE 'us_english' "
+ */" select * from op_ctnbscard WHERE GID= '" + this.strBSNO + "'";
};
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;
}
};
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.strBSNO + "'' ' ";
if (feeGidSql != '') {
sql2 = sql2 + " set @sql = @sql + ' and Gid in (" + feeGidSql + ") '";
}
sql2 = sql2 + "set @sql = @sql +' group by bsno ' exec(@sql) ";
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;
}
};
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.strBSNO + "')";
var sql5 = "";
var sql6 = " SELECT " + USDEXRATE + " AS USDEXRATE FROM [USER]";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6, MBLNO);
},
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;
MBLNO = this.strMBLNO + "应收费用";
} else if (type == 2) {
selectedRecords = this.feeCrGridCheckBoxModel.selected.items;
MBLNO = this.strMBLNO + "应付费用";
} else {
alert('函数(onAddDetailClick)的参数type类型设置的不对');
return;
}
if (selectedRecords.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择要打印的费用!', 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 + "'";
} else if (this.stroplb == 'OpCtnBsCard') {
var printType = '';
if (type == 1) {
printType = 'CTNBSCARDDRFEE';
} else { printType = 'CTNBSCARDCRFEE'; };
var sql1 = /*"SET LANGUAGE 'us_english' "
+ */" select * from op_ctnbscard WHERE GID= '" + this.strBSNO + "'";
};
var feeGidSql = '';
for (var i = 0; i < selectedRecords.length; i++) {
var record = selectedRecords[i];
var custname = record.get('CustomerName');
var FeeType = record.get('FeeType');
var BsNo = record.get('BsNo');
};
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.strBSNO + "'' ' ";
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 MBLNO = "";
if (type == 1) {
MBLNO = this.strMBLNO + "应收费用";
} else if (type == 2) {
MBLNO = this.strMBLNO + "应付费用";
}
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 + "'";
} else if (this.stroplb == 'OpCtnBsCard') {
var printType = '';
if (type == 1) {
printType = 'CTNBSCARDDRFEEALL';
} else { printType = 'CTNBSCARDCRFEEALL'; };
var sql1 = /*"SET LANGUAGE 'us_english' "
+ */" select * from op_ctnbscard WHERE GID= '" + this.strBSNO + "'";
};
var sql2 = "SET LANGUAGE 'us_english' SELECT *,(select DESCRIPTION from info_client where SHORTNAME=c.CUSTOMERNAME) CUSTFULLNAME from ch_fee c where BsNo='" + this.strBSNO + "' and FEETYPE=" + type + " order by sort,LineNum ";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6, MBLNO);
},
onPrintGainClick: function (button, event, type) {
var MBLNO = this.strMBLNO;
_this = this;
Ext.Msg.wait('正在组织数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在组织数据...',
url: '/MvcShipping/MsChFee/GetGainPrint',
scope: this,
params: {
bsno: _thisfee.strBSNO,
oplb: _thisfee.stroplb
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
if (_this.stroplb == 'op_Seae') {
var printType = 'SEAEGAIN';
var sql1 = "SET LANGUAGE 'us_english' "
+ " select * from op_seae WHERE BSNO = '" + _this.strBSNO + "'";
} else if (_this.stroplb == 'op_Apply') {
var printType = 'APPLYGAIN';
var sql1 = "SET LANGUAGE 'us_english' "
+ " select * from op_apply WHERE BSNO = '" + _this.strBSNO + "'";
} else if (_this.stroplb == 'op_Seai') {
var printType = 'SEAIGAIN';
var sql1 = "SET LANGUAGE 'us_english' "
+ " select * from op_seai WHERE BSNO = '" + _this.strBSNO + "'";
} else if (_this.stroplb == 'op_Bulk') {
var printType = 'BULKGAIN';
var sql1 = "SET LANGUAGE 'us_english' "
+ " select * from op_bulk WHERE BSNO = '" + _this.strBSNO + "'";
} else if (_this.stroplb == 'op_other') {
var printType = 'OTHERGAIN';
var sql1 = "SET LANGUAGE 'us_english' "
+ " select * from op_other WHERE BSNO = '" + _this.strBSNO + "'";
} else if (_this.stroplb == 'op_railway') {
var printType = 'RAILWAYGAIN';
var sql1 = "SET LANGUAGE 'us_english' "
+ " select * from op_railway WHERE BSNO = '" + _this.strBSNO + "'";
} else if (_this.stroplb == 'op_Aire') {
var printType = 'AIREGAIN';
var sql1 = "SET LANGUAGE 'us_english' "
+ " select * from op_aire WHERE BSNO = '" + _this.strBSNO + "'";
} else if (_this.stroplb == 'op_Airi') {
var printType = 'AIRIGAIN';
var sql1 = "SET LANGUAGE 'us_english' "
+ " select * from op_airi WHERE BSNO = '" + _this.strBSNO + "'";
} else if (_this.stroplb == 'OpCtnBsCard') {
var printType = 'CTNBSCARDGAIN';
var sql1 = "SET LANGUAGE 'us_english' "
+ " select * from op_ctnbscard WHERE GID= '" + _this.strBSNO + "'";
};
// sql3 = sql3 + " Select c.*,(select showname from [user] where gid=c.enteroperator) as 录入人 from ch_fee c where c.Gid in (" + feeGidSql + ") order by sort,LineNum ";
var sql2 = "SET LANGUAGE 'us_english' 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.BSNO='" + _this.strBSNO + "' and c.FEETYPE=1 order by sort,LineNum ";
var sql3 = "SET LANGUAGE 'us_english' 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.BSNO='" + _this.strBSNO + "' and c.FEETYPE=2 order by sort,LineNum ";
//全部费用利润 或 海运费利润 或 仓储利润
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.strBSNO + "'"
+ " GROUP BY BSNO,CURRENCY,EXCHANGERATE,FEETYPE "
+ " ) AS C GROUP BY BSNO ";
var sql5 = "exec GetPrintData '" + _this.strBSNO + "'";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6, MBLNO);
} else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
} else {
Ext.Msg.show({ title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
}
});
},
LoadDrChFee: function (button, event) {
if (this.DR_condition != "") {
this.LoadDrChFee2(this.DR_condition);
} else {
this.storeDrChFee.load({ params: { billno: this.strBSNO, type: 1, optype: this.stroplb }
, callback: function (r, options, success) {
if (success) {
if (r.length > 0) {
// _thisfee.storeDrChFee.getSelectionModel().select(0);
} else {
}
}
},
scope: this
});
}
},
LoadCrChFee: function (button, event) {
/*var fieldcomm = [];
var valuecomm = [];
if (this.WMSOUTBSNO != "") {
fieldcomm.push("WMSOUTBSNO");
valuecomm.push(this.WMSOUTBSNO);
}
var _thisfee = this;
if (fieldcomm.length == 0) {*/
if (this.CR_condition != "") {
this.LoadCrChFee2(this.CR_condition);
} else {
_thisfee.storeCrChFee.load({ params: { billno: this.strBSNO, type: 2, optype: this.stroplb },
callback: function (r, options, success) {
if (r.length > 0) {
// _thisfee.storeCrChFee.getSelectionModel().select(0);
} else {
}
},
scope: this
});
}
/* } else {
_thisfee.storeCrChFee.load({ params: { billno: this.strBSNO, type: 2, optype: this.stroplb, Fields: fieldcomm, Values: valuecomm },
callback: function (r, options, success) {
if (r.length > 0) {
// _thisfee.storeCrChFee.getSelectionModel().select(0);
} else {
}
},
scope: this
});
//}*/
},
setBtnStatusDr: function (enable) {
var btnFeeAddDr = Ext.getCmp('btnFeeAddDr');
var btnFeeSaveDr = Ext.getCmp('btnFeeSaveDr');
var btnFeeDelDr = Ext.getCmp('btnFeeDelDr');
var btnFeeCancelDr = Ext.getCmp('btnFeeCancelDr');
var btnFeeAuditDr = Ext.getCmp('btnFeeAuditDr');
var btnFeeShenDr = Ext.getCmp('btnFeeShenDr');
var btnFeeShenDelDr = Ext.getCmp('btnFeeShenDelDr');
var btnFeeShenCancelDr = Ext.getCmp('btnFeeShenCancelDr');
var btnFeeImpAddDr = Ext.getCmp('btnFeeImpAddDr');
if (enable) {
btnFeeAddDr.enable();
btnFeeSaveDr.enable();
btnFeeDelDr.enable();
btnFeeCancelDr.enable();
btnFeeAuditDr.enable();
btnFeeShenDr.enable();
btnFeeShenDelDr.enable();
btnFeeShenCancelDr.enable();
btnFeeImpAddDr.enable();
} else {
btnFeeAddDr.disable();
btnFeeSaveDr.disable();
btnFeeDelDr.disable();
btnFeeCancelDr.disable();
btnFeeAuditDr.disable();
btnFeeShenDr.disable();
btnFeeShenDelDr.disable();
btnFeeShenCancelDr.disable();
btnFeeImpAddDr.disable();
}
},
setBtnStatusCr: function (enable) {
var btnFeeAddDr = Ext.getCmp('btnFeeAddCr');
var btnFeeSaveDr = Ext.getCmp('btnFeeSaveCr');
var btnFeeDelDr = Ext.getCmp('btnFeeDelCr');
var btnFeeCancelDr = Ext.getCmp('btnFeeCancelCr');
var btnFeeAuditDr = Ext.getCmp('btnFeeAuditCr');
var btnFeeShenDr = Ext.getCmp('btnFeeShenCr');
var btnFeeShenDelDr = Ext.getCmp('btnFeeShenDelCr');
var btnFeeShenCancelDr = Ext.getCmp('btnFeeShenCancelCr');
var btnFeeImpAddDr = Ext.getCmp('btnFeeImpAddCr');
if (enable) {
btnFeeAddDr.enable();
btnFeeSaveDr.enable();
btnFeeDelDr.enable();
btnFeeCancelDr.enable();
btnFeeAuditDr.enable();
btnFeeShenDr.enable();
btnFeeShenDelDr.enable();
btnFeeShenCancelDr.enable();
btnFeeImpAddDr.enable();
} else {
btnFeeAddDr.disable();
btnFeeSaveDr.disable();
btnFeeDelDr.disable();
btnFeeCancelDr.disable();
btnFeeAuditDr.disable();
btnFeeShenDr.disable();
btnFeeShenDelDr.disable();
btnFeeShenCancelDr.disable();
btnFeeImpAddDr.disable();
}
},
LoadDrChFee2: function (condition) {
this.DR_condition = condition;
this.storeDrChFee.load({ params: { billno: this.strBSNO, type: 1, optype: this.stroplb, condition: condition }
, callback: function (r, options, success) {
if (success) {
if (r.length > 0) {
// _thisfee.storeDrChFee.getSelectionModel().select(0);
} else {
}
}
},
scope: this
});
},
LoadCrChFee2: function (condition) {
this.CR_condition = condition;
_thisfee.storeCrChFee.load({ params: { billno: this.strBSNO, type: 2, optype: this.stroplb, condition: condition },
callback: function (r, options, success) {
if (r.length > 0) {
// _thisfee.storeCrChFee.getSelectionModel().select(0);
} else {
}
},
scope: this
});
}
});