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.
DS7/DSWeb/Areas/MvcShipping/Viewsjs/MsChFee/FeeDrCrGridView.js

2812 lines
114 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.FeeViewGrid = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.FeeViewGrid.superclass.constructor.call(this);
};
Ext.extend(Shipping.FeeViewGrid, Ext.Panel, {
ParentWin: null, //弹出式
ParentPanel: null, //Tab页编辑模式
OpStatus: 'add',
StoreBill: null,
StoreCustType: null,
EditRecord: null,
RefBillNo: '*',
DataLoading: true,
strMBLNO: '',
stroplb: '',
strBSNO: '',
feeType: 0,
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.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.cellEditingDrChFee = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
/*
_this = this;
this.cellEditingDrChFee = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1,
onSpecialKey: function (ed, field, e) {
var sm;
if (e.getKey() === 40) {
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, 1);
e.stopEvent();
}
}
}
});
*/
this.initgirdDrcolums = [{
sortable: true,
dataIndex: 'GId',
header: Zi.LAN.FEE.GID2, //'惟一编号',
hidden: true,
width: 160
}, {
sortable: true,
dataIndex: 'BsNo',
header: Zi.LAN.FEE.BSNO2, //'业务编号',
hidden: true,
width: 200
}, {
sortable: true,
dataIndex: 'FeeStatus',
header: Zi.LAN.FEE.FEESTATUS, //'费用状态',
renderer: function (value, p, record) {
return record.data.FeeStatus_Ref;
},
width: 66
}, {
sortable: true,
dataIndex: 'FeeName',
header: Zi.LAN.FEE.FeeName, //'应收费用名称',
width: 90
}, {
sortable: true,
dataIndex: 'CustomerType',
header: Zi.LAN.FEE.CustomerType, //'客户类别',
// hidden: true,
width: 75,
renderer: function (value, meta) {
if (value == '委托单位') {
return Zi.LAN.FEE.WEITUODANWEI;
} else if (value == '船公司') {
return Zi.LAN.FEE.CHUANGONGSI;
} else if (value == '订舱代理') {
return Zi.LAN.FEE.DINGCANGDAILI;
} else if (value == '报关行') {
return Zi.LAN.FEE.BAOGUANHANG;
} else if (value == '车队') {
return Zi.LAN.FEE.CHEDUI;
} else if (value == '发货人') {
return Zi.LAN.FEE.FAHUOREN;
} else if (value == '收货人') {
return Zi.LAN.FEE.SHOUHUOREN;
} else if (value == '通知人') {
return Zi.LAN.FEE.TONGZHIREN;
} else if (value == '代理') {
return Zi.LAN.FEE.DAILI;
} else if (value == '场站') {
return Zi.LAN.FEE.CHANGZHAN;
} else if (value == '船代') {
return Zi.LAN.FEE.CHUANDAI;
} else if (value == '保险公司') {
return Zi.LAN.FEE.BAOXIANGONGS;
} else if (value == '其他') {
return Zi.LAN.FEE.QITA;
} else if (value == '仓库') {
return Zi.LAN.FEE.CANGKU;
} else {
return value;
}
}
}, {
sortable: true,
dataIndex: 'CustomerName',
header: Zi.LAN.FEE.CUSTOMERNAME, //'结算对象',
width: 110
}, {
sortable: true,
dataIndex: 'CustomerFullName',
width: 160
}, {
sortable: true,
dataIndex: 'Unit',
header: Zi.LAN.FEE.Unit, //'单位标准',
width: 60
}, {
sortable: true,
dataIndex: 'UnitPrice',
header: Zi.LAN.FEE.UnitPrice, //'不含税单价',
align: 'right',
width: 80
}, {
sortable: true,
dataIndex: 'TaxRate',
header: Zi.LAN.FEE.TaxRate, //'税率',
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: Zi.LAN.FEE.TaxUnitPrice, //'单价',
// 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: Zi.LAN.FEE.Quantity, //'数量',
width: 60
}, {
sortable: true,
dataIndex: 'NoTaxAmount',
header: Zi.LAN.FEE.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;
},
align: 'right',
width: 80
}, {
sortable: true,
dataIndex: 'Amount',
header: Zi.LAN.FEE.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;
},
align: 'right',
width: 80
}, {
sortable: true,
dataIndex: 'Currency',
header: Zi.LAN.FEE.Currency, //'币别',
width: 40
}, {
sortable: true,
dataIndex: 'ExChangerate',
header: Zi.LAN.FEE.ExChangerate, //'汇率',
// 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: Zi.LAN.FEE.AccTaxRate2, //'销项税率',
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: 'AccTax',
header: Zi.LAN.FEE.AccTax2, //'销项税率',
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: 'AccAmount',
header: Zi.LAN.FEE.AccAmount2, //'销项税率',
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: Zi.LAN.FEE.REMARK, //'备注',
width: 150
}, {
sortable: true,
dataIndex: 'FeeDescription',
header: Zi.LAN.FEE.FeeDescription, //'费用英文名称',
width: 150
}, {
sortable: true,
dataIndex: 'IsOpen',
header: Zi.LAN.FEE.IsOpen, //'是否机密',
hidden: true,
renderer: function (value, cellmeta) {
if (value == 'true' || value == '1') {
return "√";
} else return "";
},
width: 60
}, {
sortable: true,
dataIndex: 'ISDJY',
header: Zi.LAN.FEE.ISDJY, //'是否机密',
renderer: function (value, cellmeta) {
if (value) {
return "√";
} else return "";
},
width: 60
}, {
sortable: true,
dataIndex: 'IsAdvancedpay',
header: Zi.LAN.FEE.IsAdvancedpay, //'是否垫付',
renderer: function (value, cellmeta) {
if (value == '1') {
return "√";
}
},
width: 60
}, {
sortable: true,
dataIndex: 'IsInvoice',
header: Zi.LAN.FEE.IsInvoice, //'禁开发票',
renderer: function (value, cellmeta) {
if (value == '1' || value == true) {
return "√";
}
},
width: 60
}, {
sortable: true,
dataIndex: 'FeeFrt',
header: Zi.LAN.FEE.FeeFrt, //'FRT',
width: 40
}, {
sortable: true,
dataIndex: 'Commissionrate',
header: Zi.LAN.FEE.Commissionrate, //'佣金比率',
width: 60
}, {
sortable: true,
dataIndex: 'OpName',
header: Zi.LAN.FEE.OpName, //'录入人',
width: 60
}, {
sortable: true,
dataIndex: 'EnterDate',
header: Zi.LAN.FEE.EnterDate, //'录入日期',
// renderer: Ext.util.Format.dateRenderer('Y-m-d h'),
width: 80
}, {
sortable: true,
dataIndex: 'Settlement',
header: Zi.LAN.FEE.Settlement, //'结算金额',
align: 'right',
width: 80,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}, {
sortable: true,
dataIndex: 'Invoice',
header: Zi.LAN.FEE.Invoice, //'已开票金额',
align: 'right',
width: 80,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
},
{
sortable: true,
dataIndex: 'DebitNo',
header: Zi.LAN.FEE.DebitNo, //'対帐编号',
width: 80
}, {
sortable: true,
dataIndex: 'Auditoperator',
header: Zi.LAN.FEE.Auditoperator, //'审核人',
width: 60
}, {
sortable: true,
dataIndex: 'AuditDate',
header: Zi.LAN.FEE.AuditDate, //'审核日期',
// renderer: Ext.util.Format.dateRenderer('Y-m-d'),
width: 80
}, {
sortable: true,
dataIndex: 'MODIFIEDUSER',
header: Zi.LAN.FEE.MODIFIEDUSER, //'修改人',
width: 60
}, {
sortable: true,
dataIndex: 'MODIFIEDTIME',
header: Zi.LAN.FEE.MODIFIEDTIME, //'修改日期',
renderer: Ext.util.Format.dateRenderer('Y-m-d H:i:s'),
width: 130
}, {
sortable: true,
dataIndex: 'OrderInvoice',
header: Zi.LAN.FEE.OrderInvoice, //'发票申请金额',
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: Zi.LAN.FEE.UNINVOICE, //'未开票金额',
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: Zi.LAN.FEE.PreAmount, //'预估金额',
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
}, {
dataIndex: 'Tax',
header: Zi.LAN.FEE.Tax, //'税额',
width: 60
}, {
sortable: true,
dataIndex: 'INPUTMODE',
header: Zi.LAN.FEE.INPUTMODE, //'录入方式',
width: 150
}, {
sortable: true,
dataIndex: 'LOCALCURR',
header: Zi.LAN.FEE.LOCALCURR, //'本位币',
width: 150
}, {
sortable: true,
dataIndex: 'STLNAME',
header: Zi.LAN.FEE.STLNAME, //'本位币',
width: 150
}, {
sortable: true,
dataIndex: 'MANAGER',
header: Zi.LAN.FEE.MANAGER, //'MANAGER',
renderer: function (value, p, record) {
return record.data.MANAGERREF;
},
width: 100
}, {
sortable: true,
dataIndex: 'SALECORP',
header: Zi.LAN.FEE.SALECORP, //'MANAGER',
width: 100
}, {
sortable: true,
dataIndex: 'STATEMENTNO',
header: Zi.LAN.FEE.STATEMENTNO,
width: 100
}
];
this.girdDrcolums = this.initgirdDrcolums;
this.feeDrGridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
_thisfeeview = this;
this.storeProfitType = Ext.create('Ext.data.Store', {
fields: ['DC', 'NAME']
});
this.storeProfitType.add({ "DC": "", "NAME": Zi.LAN.FEE.DRCRPR });
this.storeProfitType.add({ "DC": "NOTAX", "NAME": Zi.LAN.FEE.NORATE });
this.comboxProfitType = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: Zi.LAN.FEE.PRDP,
store: this.storeProfitType,
valueField: 'DC',
displayField: 'NAME',
labelWidth: 60,
width: 120,
forceSelection: true,
id: 'PROFITTYPE',
name: 'PROFITTYPE',
value: '',
enableKeyEvents: true,
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
_thisfeeview.setTotalHead();
}
}
}
});
this.gridDrChFee = new Ext.grid.GridPanel({
store: this.storeDrChFee,
enableHdMenu: false,
region: 'center',
id: 'gridDrChFee',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
plugins: [this.cellEditingDrChFee],
selModel: this.feeDrGridCheckBoxModel,
selType: 'cellmodel',
viewConfig: {
autoFill: true,
enableTextSelection: true,
getRowClass: function (record, rowIndex, rowParams, store) {
var feeStatus = record.get('FeeStatus');
var BsNo = record.get('BsNo');
var ISSEL = record.get('ISSEL');
if (ISSEL == '1') { return Shipping.FeeGetRowClassFont(feeStatus); }
else {
if (BsNo == _thisfeeview.strBSNO)
return Shipping.FeeGetRowClass(feeStatus);
else return Shipping.FeeGetRowClassFont(feeStatus);
}
}
},
tbar: [{
text: '',
tooltip: Zi.LAN.FEE.btnFeePrintDr,
iconCls: "btnprint",
menu:
[
{
text: Zi.LAN.FEE.DaYinYingShouZhangDan,
menu:
[//海运进口应收应付列表
{
text: Zi.LAN.FEE.PrintSelectDetailDr,
handler: function (menu, event) {
_thisfeeview.onPrintSelectDetailClick(menu, event, 1);
}
},
{
text: Zi.LAN.FEE.PrintAllDetailDr,
handler: function (menu, event) {
_thisfeeview.onPrintAllDetailClick(menu, event, 1);
}
}
]
},
'-',
{
text: Zi.LAN.FEE.PrintGain,
handler: function (menu, event) {
_thisfeeview.onPrintGainClick(menu, event, 1);
}
}
],
/*
handler: function (button, event) {
this.onPrintDetailClick(button, event, 1);
},
*/
scope: this
}, '-', {
text: Zi.LAN.FEE.ViewDetail,
tooltip: Zi.LAN.FEE.ViewDetail,
handler: function (button, event) {
this.onViewDetailClick(button, event, 1);
},
scope: this
}, '-', {
text: Zi.LAN.FEE.btntest, //"保存列表样式",
menu: [
{
text: Zi.LAN.FEE.SaveGridPanel, //"保存",
handler: function (button, event) {
_thisfeeview.girdDrcolums = DsTruck.SaveGridPanel(USERID, 'FEEDRGRIDVIEW', _thisfeeview.gridDrChFee.columns, _thisfeeview.girdDrcolums, 0, true);
}
}, {
text: Zi.LAN.FEE.SaveGridPanel2, //"初始化",
handler: function (menu, event) {
_thisfeeview.gridDrChFee.reconfigure(this.storeList, _thisfeeview.initgirdDrcolums);
_thisfeeview.girdDrcolums = DsTruck.SaveGridPanel(USERID, 'FEEDRGRIDVIEW', _thisfeeview.gridDrChFee.columns, _thisfeeview.initgirdDrcolums, 0, true);
}
}],
scope: this
}, this.comboxProfitType],
columns: this.girdDrcolums
});
this.girdDrcolums = DsTruck.GetGridPanel(USERID, 'FEEDRGRIDVIEW', this.girdDrcolums, 0); //使用者id表名中间column数组跳过一开始的几列
/*
var map = new Ext.util.KeyMap(this.gridDrChFee, [
{
key: [40],
fn: function () { alert("Return was pressed"); }
}
]);
this.gridDrChFee.on('onKeyPress', function (e) {
var k = e.getKey();
if (k == 40) {
this.onAddDetailClick(null, null, 1);
}
}, this);
*/
//#endregion
this.cellEditingCrChFee = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
/*
this.cellEditingCrChFee = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1,
onSpecialKey: function (ed, field, e) {
var sm;
if (e.getKey() === 40) {
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, 2);
e.stopEvent();
}
}
}
});
*/
this.initgirdCrcolums = [{
sortable: true,
dataIndex: 'GId',
header: Zi.LAN.FEE.GID2, //'惟一编号',
hidden: true,
width: 160
}, {
sortable: true,
dataIndex: 'BsNo',
header: Zi.LAN.FEE.BSNO2, //'业务编号',
hidden: true,
width: 200
}, {
sortable: true,
dataIndex: 'FeeStatus',
header: Zi.LAN.FEE.FEESTATUS, //'费用状态',
renderer: function (value, p, record) {
return record.data.FeeStatus_Ref;
},
width: 66
}, {
sortable: true,
dataIndex: 'FeeName',
header: Zi.LAN.FEE.FeeName, //'应收费用名称',
width: 90
}, {
sortable: true,
dataIndex: 'CustomerType',
header: Zi.LAN.FEE.CustomerType, //'客户类别',
// hidden: true,
width: 75,
renderer: function (value, meta) {
if (value == '委托单位') {
return Zi.LAN.FEE.WEITUODANWEI;
} else if (value == '船公司') {
return Zi.LAN.FEE.CHUANGONGSI;
} else if (value == '订舱代理') {
return Zi.LAN.FEE.DINGCANGDAILI;
} else if (value == '报关行') {
return Zi.LAN.FEE.BAOGUANHANG;
} else if (value == '车队') {
return Zi.LAN.FEE.CHEDUI;
} else if (value == '发货人') {
return Zi.LAN.FEE.FAHUOREN;
} else if (value == '收货人') {
return Zi.LAN.FEE.SHOUHUOREN;
} else if (value == '通知人') {
return Zi.LAN.FEE.TONGZHIREN;
} else if (value == '代理') {
return Zi.LAN.FEE.DAILI;
} else if (value == '场站') {
return Zi.LAN.FEE.CHANGZHAN;
} else if (value == '船代') {
return Zi.LAN.FEE.CHUANDAI;
} else if (value == '保险公司') {
return Zi.LAN.FEE.BAOXIANGONGS;
} else if (value == '其他') {
return Zi.LAN.FEE.QITA;
} else if (value == '仓库') {
return Zi.LAN.FEE.CANGKU;
} else {
return value;
}
}
}, {
sortable: true,
dataIndex: 'CustomerName',
header: Zi.LAN.FEE.CUSTOMERNAME, //'结算对象',
width: 110
}, {
sortable: true,
dataIndex: 'CustomerFullName',
width: 160
}, {
sortable: true,
dataIndex: 'Unit',
header: Zi.LAN.FEE.Unit, //'单位标准',
width: 60
}, {
sortable: true,
dataIndex: 'UnitPrice',
header: Zi.LAN.FEE.UnitPrice, //'不含税单价',
align: 'right',
width: 80
}, {
sortable: true,
dataIndex: 'TaxRate',
header: Zi.LAN.FEE.TaxRate, //'税率',
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: Zi.LAN.FEE.TaxUnitPrice, //'单价',
// 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: Zi.LAN.FEE.Quantity, //'数量',
width: 60
}, {
sortable: true,
dataIndex: 'NoTaxAmount',
header: Zi.LAN.FEE.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;
},
align: 'right',
width: 80
}, {
sortable: true,
dataIndex: 'Amount',
header: Zi.LAN.FEE.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;
},
align: 'right',
width: 80
}, {
sortable: true,
dataIndex: 'Currency',
header: Zi.LAN.FEE.Currency, //'币别',
width: 40
}, {
sortable: true,
dataIndex: 'ExChangerate',
header: Zi.LAN.FEE.ExChangerate, //'汇率',
// 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: Zi.LAN.FEE.AccTaxRate2, //'销项税率',
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: 'AccTax',
header: Zi.LAN.FEE.AccTax2, //'销项税率',
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: 'AccAmount',
header: Zi.LAN.FEE.AccAmount2, //'销项税率',
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: Zi.LAN.FEE.REMARK, //'备注',
width: 150
}, {
sortable: true,
dataIndex: 'FeeDescription',
header: Zi.LAN.FEE.FeeDescription, //'费用英文名称',
width: 150
}, {
sortable: true,
dataIndex: 'IsOpen',
header: Zi.LAN.FEE.IsOpen, //'是否机密',
hidden: true,
renderer: function (value, cellmeta) {
if (value == 'true' || value == '1') {
return "√";
} else return "";
},
width: 60
}, {
sortable: true,
dataIndex: 'ISDJY',
header: Zi.LAN.FEE.ISDJY, //'是否机密',
renderer: function (value, cellmeta) {
if (value) {
return "√";
} else return "";
},
width: 60
}, {
sortable: true,
dataIndex: 'IsAdvancedpay',
header: Zi.LAN.FEE.IsAdvancedpay, //'是否垫付',
renderer: function (value, cellmeta) {
if (value == '1') {
return "√";
}
},
width: 60
}, {
sortable: true,
dataIndex: 'IsInvoice',
header: Zi.LAN.FEE.IsInvoice, //'禁开发票',
renderer: function (value, cellmeta) {
if (value == '1' || value == true) {
return "√";
}
},
width: 60
}, {
sortable: true,
dataIndex: 'FeeFrt',
header: Zi.LAN.FEE.FeeFrt, //'FRT',
width: 40
}, {
sortable: true,
dataIndex: 'Commissionrate',
header: Zi.LAN.FEE.Commissionrate, //'佣金比率',
width: 60
}, {
sortable: true,
dataIndex: 'OpName',
header: Zi.LAN.FEE.OpName, //'录入人',
width: 60
}, {
sortable: true,
dataIndex: 'EnterDate',
header: Zi.LAN.FEE.EnterDate, //'录入日期',
// renderer: Ext.util.Format.dateRenderer('Y-m-d h'),
width: 80
}, {
sortable: true,
dataIndex: 'Settlement',
header: Zi.LAN.FEE.Settlement, //'结算金额',
align: 'right',
width: 80,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}, {
sortable: true,
dataIndex: 'Invoice',
header: Zi.LAN.FEE.Invoice, //'已开票金额',
align: 'right',
width: 80,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
},
{
sortable: true,
dataIndex: 'DebitNo',
header: Zi.LAN.FEE.DebitNo, //'対帐编号',
width: 80
}, {
sortable: true,
dataIndex: 'Auditoperator',
header: Zi.LAN.FEE.Auditoperator, //'审核人',
width: 60
}, {
sortable: true,
dataIndex: 'AuditDate',
header: Zi.LAN.FEE.AuditDate, //'审核日期',
// renderer: Ext.util.Format.dateRenderer('Y-m-d'),
width: 80
}, {
sortable: true,
dataIndex: 'MODIFIEDUSER',
header: Zi.LAN.FEE.MODIFIEDUSER, //'修改人',
width: 60
}, {
sortable: true,
dataIndex: 'MODIFIEDTIME',
header: Zi.LAN.FEE.MODIFIEDTIME, //'修改日期',
renderer: Ext.util.Format.dateRenderer('Y-m-d H:i:s'),
width: 130
}, {
sortable: true,
dataIndex: 'OrderInvoice',
header: Zi.LAN.FEE.OrderInvoice, //'发票申请金额',
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: Zi.LAN.FEE.UNINVOICE, //'未开票金额',
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: Zi.LAN.FEE.PreAmount, //'预估金额',
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
}, {
dataIndex: 'Tax',
header: Zi.LAN.FEE.Tax, //'税额',
width: 60
}, {
sortable: true,
dataIndex: 'INPUTMODE',
header: Zi.LAN.FEE.INPUTMODE, //'录入方式',
width: 150
}, {
sortable: true,
dataIndex: 'LOCALCURR',
header: Zi.LAN.FEE.LOCALCURR, //'本位币',
width: 150
}, {
sortable: true,
dataIndex: 'STLNAME',
header: Zi.LAN.FEE.STLNAME, //'本位币',
width: 150
}, {
sortable: true,
dataIndex: 'MANAGER',
header: Zi.LAN.FEE.MANAGER, //'MANAGER',
renderer: function (value, p, record) {
return record.data.MANAGERREF;
},
width: 100
}, {
sortable: true,
dataIndex: 'SALECORP',
header: Zi.LAN.FEE.SALECORP, //'MANAGER',
width: 100
}, {
sortable: true,
dataIndex: 'STATEMENTNO',
header: Zi.LAN.FEE.STATEMENTNO,
width: 100
}
];
this.girdCrcolums = this.initgirdCrcolums;
this.feeCrGridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
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,
enableTextSelection: true,
getRowClass: function (record, rowIndex, rowParams, store) {
var feeStatus = record.get('FeeStatus');
var BsNo = record.get('BsNo');
var ISSEL = record.get('ISSEL');
if (ISSEL == '1') { return Shipping.FeeGetRowClassFont(feeStatus); }
else {
if (BsNo == _thisfeeview.strBSNO)
return Shipping.FeeGetRowClass(feeStatus);
else return Shipping.FeeGetRowClassFont(feeStatus);
}
}
},
tbar: [{
text: '',
tooltip: Zi.LAN.FEE.btnFeePrintCr,
iconCls: "btnprint",
menu:
[
{
text: Zi.LAN.FEE.DaYinYingFuZhangDan,
menu:
[
{
text: Zi.LAN.FEE.PrintSelectDetailCr,
handler: function (menu, event) {
_thisfeeview.onPrintSelectDetailClick(menu, event, 2);
}
},
{
text: Zi.LAN.FEE.PrintAllDetailCr,
handler: function (menu, event) {
_thisfeeview.onPrintAllDetailClick(menu, event, 2);
}
}
]
},
'-',
{
text: Zi.LAN.FEE.PrintGain,
handler: function (menu, event) {
_thisfeeview.onPrintGainClick(menu, event, 1);
}
}
],
scope: this
}, '-', {
text: Zi.LAN.FEE.ViewDetail,
tooltip: Zi.LAN.FEE.ViewDetail,
handler: function (button, event) {
this.onViewDetailClick(button, event, 2);
},
scope: this
}, '-', {
text: Zi.LAN.FEE.btntest, //"保存列表样式",
menu: [
{
text: Zi.LAN.FEE.SaveGridPanel, //"保存",
handler: function (button, event) {
_thisfeeview.girdCrcolums = DsTruck.SaveGridPanel(USERID, 'FEECRGRIDVIEW', _thisfeeview.gridCrChFee.columns, _thisfeeview.girdCrcolums, 0, true);
}
}, {
text: Zi.LAN.FEE.SaveGridPanel2, //"初始化",
handler: function (menu, event) {
_thisfeeview.gridCrChFee.reconfigure(this.storeList, _thisfeeview.initgirdCrcolums);
_thisfeeview.girdCrcolums = DsTruck.SaveGridPanel(USERID, 'FEECRGRIDVIEW', _thisfeeview.gridCrChFee.columns, _thisfeeview.initgirdCrcolums, 0, true);
}
}],
scope: this
}],
columns: this.girdCrcolums
});
this.girdCrcolums = DsTruck.GetGridPanel(USERID, 'FEECRGRIDVIEW', this.girdCrcolums, 0); //使用者id表名中间column数组跳过一开始的几列
this.gridDrChFee.reconfigure(this.storeDrChFee, this.girdDrcolums);
this.gridCrChFee.reconfigure(this.storeCrChFee, this.girdCrcolums);
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.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',
columnLines: true,
loadMask: { msg: Zi.LAN.FEE.ShuJuJiaZaiZhongQingShaoDeng },
viewConfig: {
autoFill: true,
enableTextSelection: true
},
trackMouseOver: true,
disableSelection: false,
columns: [{
header: Zi.LAN.FEE.CURR, //"<a href='#'><font color='#FF0000'>总 计</font></a>",
sortable: false,
align: 'center',
dataIndex: 'CURR',
width: 160,
renderer: function (value, cellmeta) {
if (value == '合计') {
return Zi.LAN.HEJI;
} else if (value == '其他币别') {
return Zi.LAN.OTCURR;
} else {
return value;
}
}
}, {
text: Zi.LAN.FEE.YingShou, //'应 收',
columns: [{
header: Zi.LAN.FEE.NORATE, //'不含税',
dataIndex: 'NORATEDR',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>'; } } else { return value; } } catch (e) { return value; } return value; },
align: 'right',
width: 160
}, {
header: Zi.LAN.FEE.DRCRPR, //'含税',
dataIndex: 'DR',
align: 'right',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>'; } } else { return value; } } catch (e) { return value; } return value; },
width: 160
}]
}, {
text: Zi.LAN.FEE.YingFu, //'应 付',
columns: [{
header: Zi.LAN.FEE.NORATE, //'不含税',
dataIndex: 'NORATECR',
align: 'right',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>'; } } else { return value; } } catch (e) { return value; } return value; },
width: 160
}, {
header: Zi.LAN.FEE.DRCRPR, //'含税',
dataIndex: 'CR',
align: 'right',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>'; } } else { return value; } } catch (e) { return value; } return value; },
width: 160
}]
}, {
text: Zi.LAN.FEE.LiRun, //'利 润',
columns: [{
header: Zi.LAN.FEE.NORATE, //'不含税',
dataIndex: 'NORATEPR',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
if (value == "***") return value;
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: Zi.LAN.FEE.DRCRPR, //'含税',
dataIndex: 'PR',
align: 'right',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { if (value == "***") return value; 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
}]
}
]
});
this.initCustSumColumn = [{
sortable: true,
dataIndex: 'CUSTOMERNAME',
header: Zi.LAN.FEE.CUSTOMERNAME, //'结算对象',
// summaryRenderer: function () {
// return '合计'
// },
width: 110,
renderer: function (value, cellmeta) {
if (value == '合计') {
return Zi.LAN.FEE.CustSum;
} else {
value = value.replace('更改单', 'Amend');
value = value.replace('普通货', 'General');
return value;
}
}
}, {
sortable: true,
dataIndex: 'RMBDR',
header: LOCALCURR + Zi.LAN.FEE.DRFEESTATUS,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
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: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
},
width: 80
}, {
sortable: true,
dataIndex: 'RMBCR',
header: LOCALCURR + Zi.LAN.FEE.CRFEESTATUS,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
},
summaryType: 'sum',
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
},
align: 'right',
width: 80
}, {
sortable: true,
dataIndex: 'RMBPROFIT',
header: LOCALCURR + Zi.LAN.FEE.ROFIT,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
if (value == "***") return value;
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
},
summaryType: 'sum',
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
},
align: 'right',
width: 80
}, {
sortable: true,
dataIndex: 'USDDR',
header: Zi.LAN.FEE.USDDR, //'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: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
},
align: 'right',
width: 80
}, {
sortable: true,
dataIndex: 'USDCR',
header: Zi.LAN.FEE.USDCR, //'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: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
},
align: 'right',
width: 80
}, {
sortable: true,
dataIndex: 'USDPROFIT',
header: Zi.LAN.FEE.USDPROFIT, //'USD利润',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
if (value == "***") return value;
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
},
summaryType: 'sum',
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
},
align: 'right',
width: 80
}, {
sortable: true,
dataIndex: 'OTDR',
header: Zi.LAN.FEE.OTDR, //'其他币别应收',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
},
summaryType: 'sum',
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
},
align: 'right',
width: 80
}, {
sortable: true,
dataIndex: 'OTCR',
header: Zi.LAN.FEE.OTCR, //'其他币别应付',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
},
summaryType: 'sum',
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
},
align: 'right',
width: 80
}, {
sortable: true,
dataIndex: 'OTPROFIT',
header: Zi.LAN.FEE.OTPROFIT, //'其他币别利润',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
},
summaryType: 'sum',
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
},
align: 'right',
width: 80
}, {
sortable: true,
dataIndex: 'TTLDR',
header: Zi.LAN.FEE.TTLDR, //'合计应收',
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: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
},
width: 80
}, {
sortable: true,
dataIndex: 'TTLCR',
header: Zi.LAN.FEE.TTLCR, //'合计应付',
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: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
},
width: 80
}, {
sortable: true,
dataIndex: 'TTLPROFIT',
header: Zi.LAN.FEE.TTLPROFIT, //'合计利润',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
if (value == "***") return value;
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: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
},
width: 80
}
];
this.CustSumColumn = this.initCustSumColumn;
//定义Grid
this.gridListCust = new Ext.grid.GridPanel({
store: this.storeChFeeGain,
enableHdMenu: false,
columnLines: true,
region: 'center',
loadMask: { msg: Zi.LAN.FEE.ShuJuJiaZaiZhongQingShaoDeng },
trackMouseOver: true,
viewConfig: {
autoFill: true,
enableTextSelection: true
},
getRowClass: function (record, rowIndex, rowParams, store) {
var CUSTOMERNAME = record.get('CUSTOMERNAME');
if (CUSTOMERNAME == '合计')
return 'fees_sum';
},
features: [{
id: 'group',
ftype: 'groupingsummary',
groupHeaderTpl: '{name}',
hideGroupedHeader: true,
enableGroupingMenu: true
}],
disableSelection: false,
columns: this.CustSumColumn,
// paging bar on the bottom
bbar: Ext.create('Ext.PagingToolbar', {
store: this.storeChFeeGain,
displayInfo: true,
displayMsg: Zi.LAN.FEE.displayMsg, //'当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: Zi.LAN.FEE.emptyMsg, //"没有数据"
})
});
this.panelCustSum = new Ext.Panel({
title: Zi.LAN.FEE.CustSum,
layout: "border",
region: 'center',
animate: true,
autoScroll: true,
// containerScroll: true,
frame: false,
items: [this.gridListCust]
});
this.panelCurrSum = new Ext.Panel({
title: Zi.LAN.FEE.CurrSum,
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: Zi.LAN.FEE.LiRunSum,
collapsed: true,
collapsible: true,
split: true,
enableTabScroll: true,
items:
[
this.panelCustSum,
this.panelCurrSum
]
});
this.panelDrChFee = new Ext.Panel({
title: Zi.LAN.FEE.DRFEEDEBIT,
layout: "border",
anchor: '100% 50%',
frame: true,
split: true,
items: [this.gridDrChFee]
});
this.panelCrChFee = new Ext.Panel({
title: Zi.LAN.FEE.CRFEEDEBIT,
layout: "border",
anchor: '100% 50%',
// region: 'center',
frame: true,
items: [this.gridCrChFee]
});
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';
this.storeBodySum.on('load', function (store, records) {
this.setTotalHead();
}, this);
this.gridDrChFee.getSelectionModel().on('select', function (model, record, index) {
var FeeStatus = record.data.FeeStatus;
var CustomerName = record.data.CustomerName;
var GId = record.data.GId;
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 ((FeeName != '') && (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 CustomerName = record.data.CustomerName;
var GId = record.data.GId;
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 ((FeeName != '') && (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 < _thisfeeview.storeCrChFee.getCount(); i += 1) {
var memberyf = _thisfeeview.storeCrChFee.getAt(i);
var recchange = memberyf.getChanges();
memberyf.set("ISSEL", '0');
if (isEmptyObject(recchange)) memberyf.commit();
};
}
}
});
this.gridCrChFee.on({
selectionchange: function (sm, selections) {
if (selections.length == 0) {
for (i = 0; i < _thisfeeview.storeDrChFee.getCount(); i += 1) {
var memberyf = _thisfeeview.storeDrChFee.getAt(i);
var recchange = memberyf.getChanges();
memberyf.set("ISSEL", '0');
if (isEmptyObject(recchange)) memberyf.commit();
};
var DRSELECTSTR = Ext.getCmp('CRSELECTSTR');
DRSELECTSTR.setText('', false);
}
}
});
this.storeChFeeGain.on('load', function (store, records) {
if (store.getCount() > 0) {
var data = store.getAt(0).data;
// this.gridAddList.getSelectionModel().select(0);
for (var j = 0; j < _thisfeeview.CustSumColumn.length; j++) {
if (data.RMBCURR != '') {
if (_thisfeeview.CustSumColumn[j].dataIndex == 'RMBDR') {
_thisfeeview.CustSumColumn[j].header = data.RMBCURR + Zi.LAN.FEE.DRFEESTATUS;
}
if (_thisfeeview.CustSumColumn[j].dataIndex == 'RMBCR') {
_thisfeeview.CustSumColumn[j].header = data.RMBCURR + Zi.LAN.FEE.CRFEESTATUS;
}
if (_thisfeeview.CustSumColumn[j].dataIndex == 'RMBPROFIT') {
_thisfeeview.CustSumColumn[j].header = data.RMBCURR + Zi.LAN.FEE.ROFIT;
}
_thisfeeview.CustSumColumn[j].hidden = false;
} else {
if (_thisfeeview.CustSumColumn[j].dataIndex == 'RMBDR') {
_thisfeeview.CustSumColumn[j].hidden = true;
}
if (_thisfeeview.CustSumColumn[j].dataIndex == 'RMBCR') {
_thisfeeview.CustSumColumn[j].hidden = true;
}
if (_thisfeeview.CustSumColumn[j].dataIndex == 'RMBPROFIT') {
_thisfeeview.CustSumColumn[j].hidden = true;
}
}
if (data.USDCURR != '') {
if (_thisfeeview.CustSumColumn[j].dataIndex == 'USDDR') {
_thisfeeview.CustSumColumn[j].header = data.USDCURR + Zi.LAN.FEE.DRFEESTATUS;
}
if (_thisfeeview.CustSumColumn[j].dataIndex == 'USDCR') {
_thisfeeview.CustSumColumn[j].header = data.USDCURR + Zi.LAN.FEE.CRFEESTATUS;
}
if (_thisfeeview.CustSumColumn[j].dataIndex == 'USDPROFIT') {
_thisfeeview.CustSumColumn[j].header = data.USDCURR + Zi.LAN.FEE.ROFIT;
}
_thisfeeview.CustSumColumn[j].hidden = false;
} else {
if (_thisfeeview.CustSumColumn[j].dataIndex == 'USDDR') {
_thisfeeview.CustSumColumn[j].hidden = true;
}
if (_thisfeeview.CustSumColumn[j].dataIndex == 'USDCR') {
_thisfeeview.CustSumColumn[j].hidden = true;
}
if (_thisfeeview.CustSumColumn[j].dataIndex == 'USDPROFIT') {
_thisfeeview.CustSumColumn[j].hidden = true;
}
}
if (data.OTCURR != '') {
if (_thisfeeview.CustSumColumn[j].dataIndex == 'OTDR') {
_thisfeeview.CustSumColumn[j].header = data.OTCURR + Zi.LAN.FEE.DRFEESTATUS;
}
if (_thisfeeview.CustSumColumn[j].dataIndex == 'OTCR') {
_thisfeeview.CustSumColumn[j].header = data.OTCURR + Zi.LAN.FEE.CRFEESTATUS;
}
if (_thisfeeview.CustSumColumn[j].dataIndex == 'OTPROFIT') {
_thisfeeview.CustSumColumn[j].header = data.OTCURR + Zi.LAN.FEE.ROFIT;
}
_thisfeeview.CustSumColumn[j].hidden = false;
} else {
if (_thisfeeview.CustSumColumn[j].dataIndex == 'OTDR') {
_thisfeeview.CustSumColumn[j].hidden = true;
}
if (_thisfeeview.CustSumColumn[j].dataIndex == 'OTCR') {
_thisfeeview.CustSumColumn[j].hidden = true;
}
if (_thisfeeview.CustSumColumn[j].dataIndex == 'OTPROFIT') {
_thisfeeview.CustSumColumn[j].hidden = true;
}
}
}
_thisfeeview.gridListCust.reconfigure(_thisfeeview.storeChFeeGain, _thisfeeview.CustSumColumn);
} else {
}
}, this);
/*
parentWin = window.parent.opener;
{
if (parentWin) {
var ret = parentWin.OprationSwap();
var fun = ret[4];
}
}
*/
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 明细操作
GetHandleSerialNo: function (store, type) {
var result = 0;
if (result == 0) {
for (var i = 0; i < store.getCount(); i += 1) {
var member = store.getAt(i);
if (member.data.Sort > result) {
result = member.data.Sort;
}
}
}
result = parseInt(result) + 1;
return result;
}, //end save
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 = 0;
if (feeStatus == '0' || feeStatus == false || feeStatus == 'false')
return true;
else {
Ext.Msg.show({ title: '错误', msg: "此票委托已费用已锁定,不允许操作费用!", icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return false;
}
},
//#endregion
//#region 表格的AfterEdit
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;
for (var i = 0; i < this.storeDrChFee.getCount(); i += 1) {
var member = this.storeDrChFee.getAt(i);
var value = member.get('Amount');
var curr = member.get('Currency');
var rate = member.get('ExChangerate');
if (curr ==LOCALCURR) {
rmbdr = parseFloat(rmbdr) + parseFloat(value);
} else if (curr == 'USD') {
usddr = parseFloat(usddr) + parseFloat(value);
} else { otdr = parseFloat(otdr) + parseFloat(value); }
ttldr = parseFloat(ttldr) + parseFloat(value) * 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');
if (curr == LOCALCURR) {
rmbcr = parseFloat(rmbcr) + parseFloat(value);
} else if (curr == 'USD') {
usdcr = parseFloat(usdcr) + parseFloat(value);
} else { otcr = parseFloat(otcr) + parseFloat(value); }
ttlcr = parseFloat(ttlcr) + parseFloat(value) * 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);
this.setHeadFieldValue('RMBDR', Ext.util.Format.number(parseFloat(rmbdr), '00.00'));
this.setHeadFieldValue('RMBCR', Ext.util.Format.number(parseFloat(rmbcr), '00.00'));
this.setHeadFieldValue('USDDR', Ext.util.Format.number(parseFloat(usddr), '00.00'));
this.setHeadFieldValue('USDCR', Ext.util.Format.number(parseFloat(usdcr), '00.00'));
this.setHeadFieldValue('OTDR', Ext.util.Format.number(parseFloat(otdr), '00.00'));
this.setHeadFieldValue('OTCR', Ext.util.Format.number(parseFloat(otcr), '00.00'));
this.setHeadFieldValue('TTLDR', Ext.util.Format.number(parseFloat(ttldr), '00.00'));
this.setHeadFieldValue('TTLCR', Ext.util.Format.number(parseFloat(ttlcr), '00.00'));
this.setHeadFieldValue('RMBPROFIT', Ext.util.Format.number(parseFloat(rmbprofit), '00.00'));
this.setHeadFieldValue('USDPROFIT', Ext.util.Format.number(parseFloat(usdprofit), '00.00'));
this.setHeadFieldValue('OTPROFIT', Ext.util.Format.number(parseFloat(otprofit), '00.00'));
this.setHeadFieldValue('TTLPROFIT', Ext.util.Format.number(parseFloat(ttlprofit), '00.00'));
this.setTotalHead();
},
setHeadFieldValue: function (fieldName, value) {
var field = this.formtotal.getForm().findField(fieldName);
field.setValue(value);
},
setTotalHead: function () {
var rmbdr = 0;
var rmbcr = 0;
var usddr = 0;
var usdcr = 0;
var otdr = 0;
var otcr = 0;
var ttldr = 0;
var ttlcr = 0;
var rmbprofit = 0;
var usdprofit = 0;
var otprofit = 0;
var ttlprofit = 0;
var profitrate = 0;
var PROFITTYPE = Ext.getCmp('PROFITTYPE').getValue();
if (PROFITTYPE == 'NOTAX') {
for (i = 0; i < this.storeBodySum.getCount(); i += 1) {
var memberyf = this.storeBodySum.getAt(i);
if (memberyf.data.CURR == LOCALCURR) {
rmbdr = memberyf.data.NORATEDR;
rmbcr = memberyf.data.NORATECR;
rmbprofit = memberyf.data.NORATEPR;
} else if (memberyf.data.CURR == 'USD') {
usddr = memberyf.data.NORATEDR;
usdcr = memberyf.data.NORATECR;
usdprofit = memberyf.data.NORATEPR;
} if (memberyf.data.CURR == '其他币别') {
otdr = memberyf.data.NORATEDR;
otcr = memberyf.data.NORATECR;
otprofit = memberyf.data.NORATEPR;
} if (memberyf.data.CURR == '合计') {
ttldr = memberyf.data.NORATEDR;
ttlcr = memberyf.data.NORATECR;
ttlprofit = memberyf.data.NORATEPR;
profitrate = memberyf.data.NOTAXPROFITRATE;
}
}
} else {
for (i = 0; i < this.storeBodySum.getCount(); i += 1) {
var memberyf = this.storeBodySum.getAt(i);
if (memberyf.data.CURR == LOCALCURR) {
rmbdr = memberyf.data.DR;
rmbcr = memberyf.data.CR;
rmbprofit = memberyf.data.PR;
} else if (memberyf.data.CURR == 'USD') {
usddr = memberyf.data.DR;
usdcr = memberyf.data.CR;
usdprofit = memberyf.data.PR;
} if (memberyf.data.CURR == '其他币别') {
otdr = memberyf.data.DR;
otcr = memberyf.data.CR;
otprofit = memberyf.data.PR;
} if (memberyf.data.CURR == '合计') {
ttldr = memberyf.data.DR;
ttlcr = memberyf.data.CR;
ttlprofit = memberyf.data.PR;
profitrate = memberyf.data.PROFITRATE;
}
}
}
var rmbdrlb = "";
var usddrlb = "";
var otdrlb = "";
var ttldrlb = "";
var rmbcrlb = "";
var usdcrlb = "";
var otcrlb = "";
var ttlcrlb = "";
var rmblb = "";
var usdlb = "";
var otlb = "";
var ttllb = "";
rmbdrlb = "&nbsp&nbsp&nbsp" + LOCALCURR + "应收:<font color='green'>" + returnfloat(rmbdr) + "</font>";
rmbcrlb = "&nbsp&nbsp&nbsp " + LOCALCURR + "应付: <font color='green'>" + returnfloat(rmbcr) + "</font>";
if (rmbprofit < 0)
rmblb = "&nbsp&nbsp" + LOCALCURR + "利润:<font color='red'>" + returnfloat(rmbprofit) + "</font>&nbsp&nbsp&nbsp|";
else
rmblb = "&nbsp&nbsp" + LOCALCURR + "利润:<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>";
usddrlb = "&nbsp&nbsp&nbspUSD应收:<font color='green'>" + returnfloat(usddr) + "</font>";
usdcrlb = "&nbsp&nbsp&nbsp USD应付: <font color='green'>" + returnfloat(usdcr) + "</font>";
if (usdprofit < 0)
usdlb = "&nbsp&nbsp&nbspUSD利润<font color='red'>" + returnfloat(usdprofit) + "</font>&nbsp&nbsp&nbsp|";
else
usdlb = "&nbsp&nbsp&nbspUSD利润<font color='green'>" + returnfloat(usdprofit) + "</font>&nbsp&nbsp&nbsp|";
otdrlb = "&nbsp&nbsp&nbsp其他币别应收:<font color='green'>" + returnfloat(otdr) + "</font>";
otcrlb = "&nbsp&nbsp&nbsp 其他币别应付: <font color='green'>" + returnfloat(otcr) + "</font>";
if (otprofit < 0)
otlb = "&nbsp&nbsp&nbsp其他币别利润<font color='red'>" + returnfloat(otprofit) + "</font>&nbsp&nbsp&nbsp|";
else
otlb = "&nbsp&nbsp&nbsp其他币别利润<font color='green'>" + returnfloat(otprofit) + "</font>&nbsp&nbsp&nbsp|";
ttldrlb = "&nbsp&nbsp&nbsp 合计应收: <font color='green'>" + returnfloat(ttldr) + "</font>";
ttlcrlb = "&nbsp&nbsp&nbsp 合计应付: <font color='green'>" + returnfloat(ttlcr) + "</font>";
if (ttlprofit < 0)
ttllb = "&nbsp&nbsp&nbsp合计利润<font color='red'>" + returnfloat(ttlprofit) + "</font>&nbsp&nbsp利润率<font color='green'>" + returnfloat(profitrate) + "%</font>";
else
ttllb = "&nbsp&nbsp&nbsp合计利润<font color='green'>" + returnfloat(ttlprofit) + "</font>&nbsp&nbsp利润率<font color='green'>" + returnfloat(profitrate) + "%</font>";
this.panelDrChFee.setTitle("应收费用 " + rmbdrlb + usddrlb + otdrlb + ttldrlb);
this.panelCrChFee.setTitle("应付费用 " + rmbcrlb + usdcrlb + otcrlb + ttlcrlb);
this.tabTotal.setTitle("利润合计:" + rmblb + usdlb + otlb + ttllb);
},
//#endregion
cellEditingChFeeBeforeEdit: function (editor, e) {
var allow = this.getAllowOperationDetail();
if (allow == false) {
return;
}
var chfeefeeStatus = e.record.get('FeeStatus');
var canedit = chfeefeeStatus == 1 || chfeefeeStatus == 6;
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);
// }
},
getFeeStatus: function () {
var feeStatus = this.EditRecord.get('FEESTATUS');
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 selectedRecords = [];
var storeadd = null;
if (type == 1) {
selectedRecords = this.feeDrGridCheckBoxModel.selected.items;
MBLNO = _thisfeeview.strMBLNO;
} else if (type == 2) {
selectedRecords = this.feeCrGridCheckBoxModel.selected.items;
MBLNO = _thisfeeview.strMBLNO;
} else {
alert(Zi.LAN.FEE.HanShuCanShuSheZhiBuDui);
return;
}
if (selectedRecords.length == 0) {
Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, msg: Zi.LAN.FEE.QingXianXuanZeYeWu, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
_thisfeeview.strPBSNO = _thisfeeview.strBSNO;
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 = '" + _thisfeeview.strPBSNO + "'";
} 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 = '" + _thisfeeview.strPBSNO + "'";
} 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 = '" + _thisfeeview.strPBSNO + "'";
} 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 = '" + _thisfeeview.strPBSNO + "'";
} 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 = '" + _thisfeeview.strPBSNO + "'";
} 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 = '" + _thisfeeview.strPBSNO + "'";
} 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 = '" + _thisfeeview.strPBSNO + "'";
} 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 = '" + _thisfeeview.strPBSNO + "'";
} 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= '" + _thisfeeview.strPBSNO + "'";
} else if (this.stroplb == 'import_main') {
var printType = '';
if (type == 1) {
printType = 'IMPORTTRADEDRFEE';
} else { printType = 'IMPORTTRADECRFEE'; };
var sql1 = /*"SET LANGUAGE 'us_english' "
+ */" select * from Import_main WHERE ContractNo= '" + _thisfeeview.strPBSNO + "'";
};
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='" + _thisfeeview.strBSNO + "')";
var sql5 = "";
if (feeGidSql != '') {
sql5 = sql5 + " 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.feetype=1 and c.bsno='" + _thisfeeview.strBSNO + "' and c.FEENAME in (SELECT FEENAME FROM CH_FEE WHERE GID IN (" + feeGidSql + ")) order by sort,LineNum ";
}
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6, MBLNO);
},
onPrintAllDetailClick: function (button, event, type) {
var allow = this.getAllowOperationDetail();
if (allow == false) {
return;
}
if (this.stroplb == 'op_Seae') {
var printType = '';
if (type == 1) {
printType = 'SEAEDRFEEALL';
} else { printType = 'SEAECRFEEALL'; };
var sql1 = "SET LANGUAGE 'us_english' "
+ " select * from op_seae WHERE BsNo = '" + this.strBSNO + "'";
} else if (this.stroplb == 'op_Apply') {
var printType = '';
if (type == 1) {
printType = 'APPLYDRFEEALL';
} else { printType = 'APPLYCRFEEALL'; };
var sql1 = "SET LANGUAGE 'us_english' "
+ " select * from op_apply WHERE BsNo = '" + this.strBSNO + "'";
} else if (this.stroplb == 'op_Seai') {
var printType = '';
if (type == 1) {
printType = 'SEAIDRFEEALL';
} else { printType = 'SEAICRFEEALL'; };
var sql1 = "SET LANGUAGE 'us_english' "
+ " select * from op_seai WHERE BsNo = '" + this.strBSNO + "'";
} else if (this.stroplb == 'op_Bulk') {
var printType = '';
if (type == 1) {
printType = 'BULKDRFEEALL';
} else { printType = 'BULKCRFEEALL'; };
var sql1 = "SET LANGUAGE 'us_english' "
+ " select * from op_bulk WHERE BsNo = '" + this.strBSNO + "'";
} else if (this.stroplb == 'op_other') {
var printType = '';
if (type == 1) {
printType = 'OTHERDRFEEALL';
} else { printType = 'OTHERCRFEEALL'; };
var sql1 = "SET LANGUAGE 'us_english' "
+ " select * from op_other WHERE BsNo = '" + this.strBSNO + "'";
} else if (this.stroplb == 'op_railway') {
var printType = '';
if (type == 1) {
printType = 'RAILWAYDRFEEALL';
} else { printType = 'RAILWAYCRFEEALL'; };
var sql1 = "SET LANGUAGE 'us_english' "
+ " select * from op_railway WHERE BsNo = '" + this.strBSNO + "'";
} else if (this.stroplb == 'op_Aire') {
var printType = '';
if (type == 1) {
printType = 'AIREDRFEEALL';
} else { printType = 'AIRECRFEEALL'; };
var sql1 = "SET LANGUAGE 'us_english' "
+ " select * from op_aire WHERE BsNo = '" + this.strBSNO + "'";
} else if (this.stroplb == 'op_Airi') {
var printType = '';
if (type == 1) {
printType = 'AIRIDRFEEALL';
} else { printType = 'AIRICRFEEALL'; };
var sql1 = "SET LANGUAGE 'us_english' "
+ " select * from op_airi WHERE BsNo = '" + this.strBSNO + "'";
};
var sql2 = "SET LANGUAGE 'us_english' SELECT * from ch_fee where BsNo='" + this.strBSNO + "' and FEETYPE=" + type;
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
},
onPrintGainClick: function (button, event, type) {
_thisfeeview = this;
Ext.Msg.wait('正在组织数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在组织数据...',
url: '/MvcShipping/MsChFee/GetGainPrint',
scope: this,
params: {
bsno: _thisfeeview.strBSNO,
oplb: _thisfeeview.stroplb
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var printsql = jsonresult.Data;
var printdrsql = jsonresult.Message;
var printcrsql = jsonresult.Message2;
if (_thisfeeview.stroplb == 'op_Seae') {
var printType = 'SEAEGAIN';
var sql1 = "SET LANGUAGE 'us_english' "
+ " select * from op_seae WHERE BSNO = '" + _thisfeeview.strBSNO + "'";
} else if (_thisfeeview.stroplb == 'op_Apply') {
var printType = 'APPLYGAIN';
var sql1 = "SET LANGUAGE 'us_english' "
+ " select * from op_apply WHERE BSNO = '" + _thisfeeview.strBSNO + "'";
} else if (_thisfeeview.stroplb == 'op_Seai') {
var printType = 'SEAIGAIN';
var sql1 = "SET LANGUAGE 'us_english' "
+ " select * from op_seai WHERE BSNO = '" + _thisfeeview.strBSNO + "'";
} else if (_thisfeeview.stroplb == 'op_Bulk') {
var printType = 'BULKGAIN';
var sql1 = "SET LANGUAGE 'us_english' "
+ " select * from op_bulk WHERE BSNO = '" + _thisfeeview.strBSNO + "'";
} else if (_thisfeeview.stroplb == 'op_other') {
var printType = 'OTHERGAIN';
var sql1 = "SET LANGUAGE 'us_english' "
+ " select * from op_other WHERE BSNO = '" + _thisfeeview.strBSNO + "'";
} else if (_thisfeeview.stroplb == 'op_railway') {
var printType = 'RAILWAYGAIN';
var sql1 = "SET LANGUAGE 'us_english' "
+ " select * from op_railway WHERE BSNO = '" + _thisfeeview.strBSNO + "'";
} else if (_thisfeeview.stroplb == 'op_Aire') {
var printType = 'AIREGAIN';
var sql1 = "SET LANGUAGE 'us_english' "
+ " select * from op_aire WHERE BSNO = '" + _thisfeeview.strBSNO + "'";
} else if (_thisfeeview.stroplb == 'op_Airi') {
var printType = 'AIRIGAIN';
var sql1 = "SET LANGUAGE 'us_english' "
+ " select * from op_airi WHERE BSNO = '" + _thisfeeview.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 录入人 from ch_fee c where c.BSNO='" + _thisfeeview.strBSNO + "' and " + printdrsql +" 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 录入人 from ch_fee c where c.BSNO='" + _thisfeeview.strBSNO + "' and " + printcrsql +" 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='" + _thisfeeview.strBSNO + "'"
+ " GROUP BY BSNO,CURRENCY,EXCHANGERATE,FEETYPE "
+ " ) AS C GROUP BY BSNO ";
var sql5 = "exec GetPrintDataNew '" + _thisfeeview.strBSNO + "','" + printsql.replace(new RegExp("'", "gm"), "''") + "'";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
} 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
});
}
}
});
}
});