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.
447 lines
13 KiB
JavaScript
447 lines
13 KiB
JavaScript
Ext.namespace('Shipping');
|
|
|
|
Shipping.FeeTemplateAgentAdd = function (config) {
|
|
Ext.applyIf(this, config);
|
|
this.initUIComponents();
|
|
window.Shipping.FeeTemplateAgentAdd.superclass.constructor.call(this);
|
|
};
|
|
|
|
Ext.extend(Shipping.FeeTemplateAgentAdd, Ext.Panel, {
|
|
PageSize: 100,
|
|
ParentWin: null,
|
|
feeType: 0,
|
|
feeTypeRef: '',
|
|
OprationStatus: null, //仅当弹出界面时使用
|
|
SelectedRecord: null,
|
|
StoreFee: null,
|
|
StoreFeeUnit: null,
|
|
StoreFeeCust: null,
|
|
StoreDateCurr: null,
|
|
storeCustomerNameRef: null,
|
|
StoreCurr: null,
|
|
EditRecord: null,
|
|
stroplb: '',
|
|
strGID: '',
|
|
|
|
initUIComponents: function () {
|
|
|
|
|
|
this.DEFORDERCUST = "";
|
|
//定义数据集
|
|
this.storeList = Ext.create('Ext.data.Store', {
|
|
pageSize: this.PageSize,
|
|
model: 'MsCodeFeeTemplateAgent',
|
|
remoteSort: true,
|
|
proxy: {
|
|
type: 'ajax',
|
|
url: '/MvcShipping/MsCodeFeeTemplateAgent/GetDataList',
|
|
reader: {
|
|
id: 'GID',
|
|
root: 'data',
|
|
totalProperty: 'totalCount'
|
|
}
|
|
}
|
|
});
|
|
|
|
//#region 主grid
|
|
this.gridListCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
|
|
|
|
this.gridList = new Ext.grid.GridPanel({
|
|
store: this.storeList,
|
|
enableHdMenu: false,
|
|
region: 'north',
|
|
height: 350,
|
|
loadMask: { msg: "数据加载中,请稍等..." },
|
|
trackMouseOver: true,
|
|
disableSelection: false,
|
|
selModel: this.gridListCheckBoxModel,
|
|
columns: [{
|
|
sortable: true,
|
|
dataIndex: 'NAME',
|
|
header: '模板名称',
|
|
width: 130
|
|
}, {
|
|
sortable: true,
|
|
dataIndex: 'DESCRIPTION',
|
|
header: '模板说明',
|
|
width: 160
|
|
}, {
|
|
sortable: true,
|
|
dataIndex: 'REMARK',
|
|
header: '备注',
|
|
width: 220
|
|
}
|
|
],
|
|
// paging bar on the bottom
|
|
bbar: Ext.create('Ext.PagingToolbar', {
|
|
store: this.storeList,
|
|
displayInfo: true,
|
|
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
|
|
emptyMsg: "没有数据"
|
|
})
|
|
});
|
|
|
|
//#endregion
|
|
|
|
//#region 固定费用明细表
|
|
|
|
|
|
|
|
//#region 费用表
|
|
|
|
|
|
|
|
//明细表-数据集
|
|
this.storeBodyChFee = Ext.create('Ext.data.Store', {
|
|
model: 'MsCodeFeeTemplateAgentDetail',
|
|
remoteSort: true,
|
|
proxy: {
|
|
type: 'ajax',
|
|
url: '/MvcShipping/MsCodeFeeTemplateAgent/GetBodyList',
|
|
reader: {
|
|
id: 'GID',
|
|
root: 'data',
|
|
totalProperty: 'totalCount'
|
|
}
|
|
}
|
|
});
|
|
|
|
//明细表表格
|
|
// this.feeGridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
|
|
|
|
_this = this;
|
|
this.gridListChFee = new Ext.grid.GridPanel({
|
|
store: this.storeBodyChFee,
|
|
enableHdMenu: false,
|
|
region: 'center',
|
|
loadMask: { msg: "数据加载中,请稍等..." },
|
|
trackMouseOver: true,
|
|
disableSelection: false,
|
|
// selModel: this.feeGridCheckBoxModel,
|
|
selType: 'cellmodel',
|
|
columns: [{
|
|
sortable: true,
|
|
dataIndex: 'GID',
|
|
header: Zi.LAN.GID, //'GID',
|
|
hidden: true,
|
|
width: 100
|
|
}, {
|
|
sortable: true,
|
|
dataIndex: 'TEMPLATEID',
|
|
header: Zi.LAN.TEMPLATEID, //'TEMPLATEID',
|
|
hidden: true,
|
|
width: 100
|
|
}, {
|
|
sortable: true,
|
|
dataIndex: 'FEENAME',
|
|
header: '费用名称', //'费用名称',
|
|
width: 140
|
|
}, {
|
|
sortable: true,
|
|
dataIndex: 'FEEENAME',
|
|
header: '费用英文名', //'备注',
|
|
width: 150
|
|
}, {
|
|
sortable: true,
|
|
dataIndex: 'CURRENCY',
|
|
header: '币别', //'币别',
|
|
width: 100
|
|
}, {
|
|
sortable: true,
|
|
dataIndex: 'EXCHANGERATE',
|
|
header: '汇率', //'汇率',
|
|
align: 'right',
|
|
width: 180
|
|
}, {
|
|
dataIndex: 'DRPP',
|
|
header: '应收PP', //'箱量',
|
|
width: 100
|
|
}, {
|
|
dataIndex: 'DRCC',
|
|
header: '应收CC', //'箱量',
|
|
width: 100
|
|
}, {
|
|
dataIndex: 'CRPP',
|
|
header: '应付PP', //'箱量',
|
|
width: 100
|
|
}, {
|
|
dataIndex: 'CRCC',
|
|
header: '应付CC', //'箱量',
|
|
width: 100
|
|
}, {
|
|
dataIndex: 'AMOUNTDR',
|
|
header: '应收金额', //'箱量',
|
|
width: 100
|
|
}, {
|
|
dataIndex: 'AMOUNTCR',
|
|
header: '应付金额', //'箱量',
|
|
width: 100
|
|
}, {
|
|
sortable: true,
|
|
dataIndex: 'UNIT',
|
|
header: '标准', //'标准',
|
|
width: 80
|
|
}, {
|
|
sortable: true,
|
|
dataIndex: 'UNITPRICE',
|
|
header: '单价', //'单价',
|
|
align: 'right',
|
|
width: 80
|
|
}, {
|
|
sortable: true,
|
|
dataIndex: 'QUANTITY',
|
|
header: '数量', //'单价',
|
|
align: 'right',
|
|
width: 80
|
|
}, {
|
|
sortable: true,
|
|
dataIndex: 'SORT',
|
|
header: '排序', //'排序',
|
|
align: 'right',
|
|
width: 80
|
|
}, {
|
|
sortable: true,
|
|
dataIndex: 'FEEDESCRIPTION',
|
|
header: '备注', //'备注',
|
|
width: 150
|
|
}
|
|
],
|
|
// paging bar on the bottom
|
|
|
|
bbar: [{
|
|
xtype: "button",
|
|
id: "button_add",
|
|
iconCls: "btnadd",
|
|
text: "引入费用",
|
|
handler: function (button, event) {
|
|
_this.onAddDetailClick(button, event);
|
|
}
|
|
},
|
|
'-',
|
|
{
|
|
xtype: "button",
|
|
id: "button_close",
|
|
text: "取消退出",
|
|
handler: function (button, event) {
|
|
window.close();
|
|
}
|
|
}
|
|
|
|
]
|
|
|
|
});
|
|
|
|
//#endregion
|
|
|
|
//#region formSearch
|
|
//#region formSearch枚举参照相关
|
|
|
|
|
|
//#endregion
|
|
|
|
|
|
this.formSearch = Ext.widget('form', {
|
|
frame: true,
|
|
region: 'center',
|
|
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: 'NAME'
|
|
}, {
|
|
fieldLabel: '模板说明',
|
|
name: 'DESCRIPTION'
|
|
}, {
|
|
xtype: 'button',
|
|
width: 90,
|
|
text: "执行查询",
|
|
iconCls: "btnrefresh",
|
|
handler: function (button, event) {
|
|
this.onRefreshClick(button, event);
|
|
},
|
|
scope: this
|
|
}
|
|
]
|
|
|
|
}]
|
|
|
|
}]
|
|
|
|
});
|
|
|
|
//#endregion formSearch
|
|
|
|
//#region 按钮ToolBar
|
|
|
|
//#endregion
|
|
|
|
//#region 布局
|
|
this.panelTop = new Ext.Panel({
|
|
layout: "border",
|
|
region: "north",
|
|
height: 55,
|
|
items: [this.formSearch]
|
|
});
|
|
|
|
|
|
this.panelBodyChFee = new Ext.Panel({
|
|
title: '费用明细',
|
|
layout: "border",
|
|
region: 'center',
|
|
margin: '5 10',
|
|
items: [this.gridListChFee]
|
|
});
|
|
|
|
this.panelFee = new Ext.Panel({
|
|
layout: "border",
|
|
region: "center",
|
|
items: [
|
|
this.panelBodyChFee
|
|
]
|
|
});
|
|
|
|
|
|
Ext.apply(this, {
|
|
items: [this.panelTop, this.gridList, this.panelFee]
|
|
});
|
|
//#endregion
|
|
this.parentWin = window.parent.opener._thisAgentFee;
|
|
if (this.parentWin) {
|
|
this.StoreFee = this.parentWin.storeDetailList;
|
|
}
|
|
|
|
|
|
//#region 事件绑定
|
|
this.storeList.on('beforeload', function (store) {
|
|
var sql = this.getCondition();
|
|
Ext.apply(store.proxy.extraParams, { condition: sql });
|
|
}, this);
|
|
|
|
this.storeList.on('load', function (store, records) {
|
|
if (store.getCount() > 0) {
|
|
this.gridList.getSelectionModel().select(0);
|
|
//this.gridListCheckBoxModel.selectAll();
|
|
}
|
|
}, this);
|
|
|
|
this.gridList.getSelectionModel().on('select', function (model, record, index) {
|
|
//alert(record.data.BillNo);
|
|
var bsno = record.data.GID;
|
|
this.strGID = record.data.GID;
|
|
var sql = " TEMPLATEID='" + bsno + "'";
|
|
this.storeBodyChFee.load({ params: { condition: sql} });
|
|
}, this);
|
|
//#endregion
|
|
|
|
//#region 自动刷新(已经提交但是尚未审核的业务,哪怕一票货中有一笔费用没审核也显示)
|
|
this.onAutoRefresh();
|
|
//#endregion
|
|
|
|
// this.SetBtnRight();
|
|
|
|
}, //end initUIComponents
|
|
|
|
onAutoRefresh: function () {
|
|
var sql = '';
|
|
|
|
this.storeList.load({
|
|
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
|
|
waitMsg: "正在查询数据...",
|
|
scope: this
|
|
});
|
|
},
|
|
|
|
onRefreshClick: function (button, event) {
|
|
var sql = this.getCondition();
|
|
this.storeList.load({
|
|
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
|
|
waitMsg: "正在查询数据...",
|
|
scope: this
|
|
});
|
|
},
|
|
|
|
onAddDetailClick: function (button, event) {
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < this.storeBodyChFee.getCount(); i += 1) {
|
|
|
|
var memberyf = this.storeBodyChFee.getAt(i);
|
|
var newsort = this.StoreFee.getCount() + 1;
|
|
var record = Ext.create('MsChFeeAgentDCDetail', {
|
|
GID: NewGuid(),
|
|
DCGID: '*',
|
|
FEENAME: memberyf.data.FEENAME,
|
|
FEEENAME: memberyf.data.FEEENAME,
|
|
CURRENCY: memberyf.data.CURRENCY,
|
|
FEEDESCRIPTION: memberyf.data.FEEDESCRIPTION,
|
|
EXCHANGERATE: memberyf.data.EXCHANGERATE,
|
|
DRPP: memberyf.data.DRPP,
|
|
DRCC: memberyf.data.DRCC,
|
|
CRPP: memberyf.data.CRPP,
|
|
CRCC: memberyf.data.CRCC,
|
|
AMOUNTDR: memberyf.data.AMOUNTDR,
|
|
AMOUNTCR: memberyf.data.AMOUNTCR,
|
|
UNIT: memberyf.data.UNIT,
|
|
UNITPRICE: memberyf.data.UNITPRICE,
|
|
QUANTITY: memberyf.data.QUANTITY,
|
|
SORT: newsort
|
|
});
|
|
|
|
record.id = NewGuid();
|
|
record.internalId = NewGuid();
|
|
|
|
this.StoreFee.add(record);
|
|
|
|
|
|
};
|
|
|
|
_this = this;
|
|
|
|
this.parentWin.setAllTotal();
|
|
|
|
window.closeAction = 'destroy';
|
|
window.close();
|
|
},
|
|
|
|
|
|
getCondition: function () {
|
|
var form = this.formSearch.getForm();
|
|
if (!form.isValid()) {
|
|
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
|
|
return '';
|
|
}
|
|
var sql = '';
|
|
var custName = form.findField('NAME').getValue();
|
|
sql = sql + getAndConSql(sql, custName, " Name like '%" + custName + "%'");
|
|
|
|
var mblNo = form.findField('DESCRIPTION').getValue();
|
|
sql = sql + getAndConSql(sql, mblNo, " Description like '%" + mblNo + "%'");
|
|
|
|
return sql;
|
|
}
|
|
|
|
});
|
|
|
|
|