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/MsFeeSortEdit.js

416 lines
15 KiB
JavaScript

3 years ago
Ext.namespace('Shipping');
Shipping.MsFeeSortEdit= function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsFeeSortEdit.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsFeeSortEdit, Ext.Panel, {
ParentWin: null,
OpStatus: 'add',
StoreList: null,
editRecord: null,
region: 'north',
bsno: '',
feetype: 0,
oplb: '',
AccDate: null,
IsAccDate: '',
initUIComponents: function () {
//枚举参照相关
//编辑form
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.bsno = getUrlParam('bsno');
this.feetype = getUrlParam('type');
this.oplb = getUrlParam('oplb');
//按钮Toolbar
this.feeDrGridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
this.cellEditingDrChFee = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
_this = this;
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,
getRowClass: function (record, rowIndex, rowParams, store) {
var feeStatus = record.get('FeeStatus');
return Shipping.FeeGetRowClass(feeStatus);
}
},
tbar: [
{
text: '更新顺序', //'增加明细',
tooltip: '更新顺序', //'增加明细',
handler: function (button, event) {
this.onPostDetailClick();
},
scope: this
}],
columns: [{
sortable: true,
dataIndex: 'GId',
header: '惟一编号',
hidden: true,
width: 160
}, {
sortable: true,
dataIndex: 'BsNo',
header: '业务编号',
hidden: true,
width: 200
}, {
sortable: true,
dataIndex: 'Sort',
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)
}
}
}
},
align: 'right',
width: 60
}, {
sortable: true,
dataIndex: 'FeeStatus',
header: '费用状态',
renderer: function (value, p, record) {
return record.data.FeeStatus_Ref;
},
width: 66
}, {
sortable: true,
dataIndex: 'FeeName',
header: '应收费用名称',
width: 100
}, {
sortable: true,
dataIndex: 'FeeDescription',
header: '费用英文名称',
width: 120
}, {
sortable: true,
dataIndex: 'CustomerType',
header: '客户类别',
width: 80
}, {
sortable: true,
dataIndex: 'CustomerName',
header: '结算对象',
width: 120
}, {
sortable: true,
dataIndex: 'Unit',
header: '单位标准',
width: 60
}, {
sortable: true,
dataIndex: 'UnitPrice',
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: 'Quantity',
header: '数量',
width: 60
}, {
sortable: true,
dataIndex: 'TaxRate',
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',
width: 60
}, {
sortable: true,
dataIndex: 'NoTaxAmount',
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: 'Amount',
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: 'Currency',
header: '币别',
width: 40
}, {
sortable: true,
dataIndex: 'ExChangerate',
header: '汇率',
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: '进项税率',
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: '备注',
width: 150
}, {
sortable: true,
dataIndex: 'IsAdvancedpay',
header: '是否垫付',
width: 60
}, {
sortable: true,
dataIndex: 'FeeFrt',
header: 'FRT',
width: 40
}, {
sortable: true,
dataIndex: 'Commissionrate',
header: '佣金比率',
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
}
]
});
this.panelTop = new Ext.Panel({
layout: "border",
region: "center",
//height: 180,
//id: "BillHead",
items: [this.gridDrChFee]
});
this.gridDrChFee.getSelectionModel().on('select', function (model, record, index) {
//var GId = record.data.GId;
//var condition = " FEEID='" + GId + "'";
//this.storeBodyRecShen.load({ params: { condition: condition, dotype: "5"} });
//this.storeBodyPayShen.load({ params: { condition: condition, dotype: "4"} });
//this.storeBodyStl.load({ params: { condition: condition, dotype: "1"} });
//this.storeBodyInv.load({ params: { condition: condition, dotype: "7"} });
//this.storeBodyInvShen.load({ params: { condition: condition, dotype: "6"} });
//this.storeBodyInvStl.load({ params: { condition: condition} });
//this.storeBodyDui.load({ params: { condition: " EXISTS (SELECT 1 FROM v_dui_fee z WHERE z.DUINO=ch_dui.DUINO AND z.GID='" + GId + "') "} });
}, this);
Ext.apply(this, {
items: [this.panelTop]
});
this.feepanel = window.parent.opener._thisfee;
this.storeDrChFee.load({ params: { billno: this.bsno, type: this.feetype, optype: this.oplb} });
},
onPostDetailClick: function (button, event, type) {
var bodyDrChFeeDatas = [];
var i;
for (i = 0; i < this.storeDrChFee.getCount(); i += 1) {
var memberyf= this.storeDrChFee.getAt(i);
bodyDrChFeeDatas.push(memberyf);
};
var jsonChFeeBody = ConvertFeeRecordsToJson(bodyDrChFeeDatas);
Ext.Msg.wait('正在保存数据...');
Ext.Ajax.request({
waitMsg: '正在保存数据...', //'正在保存数据...',
url: '/MvcShipping/MsChFee/SaveSort',
scope: this,
params: {
bsno:this.bsno,
chfeebody: jsonChFeeBody
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.storeDrChFee.reload();
if (this.feetype == 1) {
this.feepanel.storeDrChFee.reload();
} else {
this.feepanel.storeCrChFee.reload();
}
} 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
});