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/MvcContainer/Viewsjs/MsOpPrice/HistryFeeAgentIndex.js

655 lines
22 KiB
JavaScript

Ext.namespace('Shipping');
Shipping.AgentPriceHistryFee = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.AgentPriceHistryFee.superclass.constructor.call(this);
};
Ext.extend(Shipping.AgentPriceHistryFee, Ext.Panel, {
PageSize: 10,
ParentWin: null,
feeType: 0,
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
StoreFee: null,
StoreFeeUnit: null,
StoreFeeCust: null,
EditRecord: null,
initUIComponents: function () {
//定义数据集
this.storeList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'MsOpPrice',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcContainer/MsOpPrice/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: 268,
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
selModel: this.gridListCheckBoxModel,
viewConfig: {
autoFill: true,
enableTextSelection: true
},
columns: [{
sortable: true,
dataIndex: 'GID',
header: 'GID',
hidden: true,
width: 120
}, {
sortable: true,
dataIndex: 'COMPANYID',
header: 'COMPANYID',
hidden: true,
width: 120
}, {
sortable: true,
dataIndex: 'PRICETYPE',
header: 'PRICETYPE',
hidden: true,
width: 120
}, {
sortable: true,
dataIndex: 'AGENTNAME',
header: '代理名称',
width: 100
}, {
sortable: true,
dataIndex: 'AGENTATTN',
header: '代理联系方式',
width: 100
}, {
sortable: true,
dataIndex: 'AGENTADDR',
header: '代理地址',
width: 140
}, {
sortable: true,
dataIndex: 'OPREF',
header: '维护人',
width: 100
}, {
sortable: true,
dataIndex: 'PORTLOAD',
header: '起运港',
width: 100
}, {
sortable: true,
dataIndex: 'PORTDISCHARGE',
header: '目的港',
width: 100
}, {
sortable: true,
dataIndex: 'TRANSPORT',
header: '中转港',
width: 100
}, {
sortable: true,
dataIndex: 'CARRIER',
header: '船公司',
width: 100
}, {
sortable: true,
dataIndex: 'WEEKETD',
header: '船期',
width: 100
}, {
sortable: true,
dataIndex: 'VOYAGE',
header: '航程',
width: 100
}, {
sortable: true,
dataIndex: 'VALIDETD',
header: '有效期',
width: 100
}, {
sortable: true,
dataIndex: 'SERVICE',
header: '运输条款',
width: 100
}, {
sortable: true,
dataIndex: 'GOODTYPE',
header: '货物类别',
width: 100
}, {
sortable: true,
dataIndex: 'CTNSTATUS',
header: '箱状态',
width: 100
}, {
sortable: true,
dataIndex: 'OTRMB',
header: '其他RMB',
width: 100
}, {
sortable: true,
dataIndex: 'OTUSD',
header: '其他USD',
width: 100
}, {
sortable: true,
dataIndex: 'TOTALRMB',
header: '合计RMB',
width: 100
}, {
sortable: true,
dataIndex: 'TOTALUSD',
header: '合计USD',
width: 100
}, {
sortable: true,
dataIndex: 'REMARKS',
header: '备注',
width: 200
}, {
sortable: true,
dataIndex: 'INPUTBYREF',
header: '录入人',
width: 100
}, {
sortable: true,
dataIndex: 'INPUTTIME',
header: '录入时间',
width: 100
}
],
// paging bar on the bottom
bbar: Ext.create('Ext.PagingToolbar', {
store: this.storeList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
})
});
//#endregion
//#region 固定费用明细表
//#region 费用表
_this = this;
//明细表表格相关
this.storeFeeTypeRef = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeFeeTypeRef.load({ params: { enumTypeId: 99020} });
this.comboxFeeTypeRef = Ext.create('DsExt.ux.RefEnumCombox', {
store: this.storeFeeTypeRef,
name: 'FeeType'
});
//明细表-数据集
this.storeBodyList = Ext.create('Ext.data.Store', {
model: 'MsOpPriceItems',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcContainer/MsOpPrice/GetPriceItemsList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.radiogroup = new Ext.form.RadioGroup({
fieldLabel: '引入方式',
width: 380,
columns: 2,
items: [
{ boxLabel: '全部引入', name: 'rb', id: 'rdall', inputValue: '1', checked: true },
{ boxLabel: '不引入客户', name: 'rb', id: 'rdfee', inputValue: '2' },
]
});
this.feeGridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
this.gridListBody = new Ext.grid.GridPanel({
store: this.storeBodyList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
selModel: this.feeGridCheckBoxModel,
selType: 'cellmodel',
columns: [{
sortable: true,
dataIndex: 'GID',
header: '编号',
hidden: true,
width: 0
}, {
sortable: true,
dataIndex: 'LINKGID',
header: '业务编号',
hidden: true,
width: 0
}, {
sortable: true,
dataIndex: 'ITEMSNO',
header: '序号',
renderer: Ext.util.Format.numberRenderer('00'),
align: 'right',
width: 60
}, {
sortable: true,
dataIndex: 'CUSTOMERNAME',
header: '付款方',
width: 110
}, {
sortable: true,
dataIndex: 'FEENAME',
header: '费用名称',
width: 140
}, {
sortable: true,
dataIndex: 'UNIT',
header: '标准',
width: 100
}, {
sortable: true,
dataIndex: 'CURRENCY',
header: '币别',
width: 100
}, {
sortable: true,
dataIndex: 'UNITPRICE',
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: 110
}, {
sortable: true,
dataIndex: 'REMARK',
header: '备注',
editor: {
xtype: 'textfield',
selectOnFocus: true,
enableKeyEvents: true
},
width: 250
}],
// paging bar on the bottom
bbar: [this.radiogroup, '-', {
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枚举参照相关
this.storeAgent = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeAgent.load({ params: { condition: "ISAGENT='1'"} });
this.comboxAgent = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '代理',
store: this.storeAgent,
forceSelection: true,
name: 'PS_AGENT',
valueField: 'CustName',
displayField: 'CodeAndName',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.storeCodeDisport = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CodeDisportModel',
proxy: { url: '/CommMng/BasicDataRef/GetCodeDisportList' }
});
this.storeCodeDisport.load();
this.comboxPORTDISCHARGE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '目的港',
store: this.storeCodeDisport,
name: 'PORTDISCHARGE',
valueField: 'PORT',
queryMode: 'local',
displayField: 'PORT',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.comboxPORTLOAD = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '起运港',
store: this.storeCodeDisport,
name: 'PORTLOAD',
valueField: 'PORT',
queryMode: 'local',
displayField: 'PORT',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
//客户加载_船公司
this.storeCARRIER = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeCARRIER.load({ params: { condition: "ISCARRIER='1'"} });
//船公司
this.comboxCARRIER = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '船公司',
store: this.storeCARRIER,
forceSelection: true,
name: 'CARRIER',
valueField: 'CustName',
displayField: 'CodeAndName',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
//#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: [this.comboxPORTLOAD, this.comboxPORTDISCHARGE, this.comboxAgent, this.comboxCARRIER, {
fieldLabel: '录入日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ETDbgn',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '到',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ETDend',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
xtype: 'button',
width: 90,
text: "执行查询",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick(button, event);
},
scope: this
}, {
xtype: 'button',
width: 90,
text: "高级查询",
iconCls: "btnmore",
handler: function (button, event) {
var sql = this.getCondition();
var winAccess = new Shipping.DsQuery({
});
winAccess.StoreList = this.storeList;
winAccess.formname = this.formname;
winAccess.condition = sql;
winAccess.show();
return;
},
scope: this
}
]
}]
}]
});
//#endregion formSearch
//#region 按钮ToolBar
//#endregion
//#region 布局
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 55,
items: [this.formSearch]
});
this.panelBody = new Ext.Panel({
title: '运价详细信息',
layout: "border",
region: 'center',
animate: true,
// autoScroll: true,
// containerScroll: true,
frame: false,
items: [this.gridListBody]
});
Ext.apply(this, {
items: [this.panelTop, this.gridList, this.panelBody]
});
//#endregion
this.parentWin = window.parent.opener._this;
if (this.parentWin) {
this.PRICETYPE = this.parentWin.thispricetype;
this.StoreFee = this.parentWin.storeBodyList;
this.EditRecord = this.parentWin.editRecord;
}
//#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.storeBodyList.load({ params: { condition: "LINKGID='" + bsno + "'"} });
}, this);
//#endregion
//#region 自动刷新(已经提交但是尚未审核的业务,哪怕一票货中有一笔费用没审核也显示)
this.onRefreshClick();
//#endregion
// this.SetBtnRight();
}, //end initUIComponents
onRefreshClick: function (button, event) {
var sql = this.getCondition();
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql, pricetype: this.PRICETYPE },
waitMsg: "正在查询数据...",
scope: this
});
},
onAddDetailClick: function (button, event) {
var myDate = new Date();
selectedRecords = this.feeGridCheckBoxModel.selected.items;
if (selectedRecords.length == 0) {
this.feeGridCheckBoxModel.selectAll();
selectedRecords = this.feeGridCheckBoxModel.selected.items;
}
for (i = 0; i < selectedRecords.length; i += 1) {
var memberyf = selectedRecords[i];
record = Ext.create('MsOpPriceItems', {
GID: NewGuid(),
LINKGID: '*',
ITEMSNO: memberyf.data.ITEMSNO,
FEENAME: memberyf.data.FEENAME,
UNIT: memberyf.data.UNIT,
UNITPRICE: memberyf.data.UNITPRICE,
CURRENCY: memberyf.data.CURRENCY,
CHANGERATE: memberyf.data.CHANGERATE,
GOODSNAME: memberyf.data.GOODSNAME,
REMARKS: memberyf.data.REMARKS
});
record.id = NewGuid();
record.internalId = NewGuid();
this.StoreFee.add(record);
};
window.closeAction = 'destroy';
window.close();
},
getCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var sql = " b.PRICETYPE='" + this.PRICETYPE + "' AND b.GID in (select LINKGID from op_price_items) ";
var PORTLOAD = form.findField('PORTLOAD').getValue();
sql = sql + getAndConSql(sql, PORTLOAD, " b.PORTLOAD like '%" + PORTLOAD + "%' ");
var PORTDISCHARGE = form.findField('PORTDISCHARGE').getValue();
sql = sql + getAndConSql(sql, PORTDISCHARGE, " b.PORTDISCHARGE like '%" + PORTDISCHARGE + "%' ");
var AGENT = form.findField('PS_AGENT').getValue();
sql = sql + getAndConSql(sql, AGENT, " b.AGENTNAME='" + AGENT + "'");
var CARRIER = form.findField('CARRIER').getValue();
sql = sql + getAndConSql(sql, CARRIER, " b.CARRIER='" + CARRIER + "'");
var expDateBgn = form.findField('ETDbgn').getRawValue();
sql = sql + getAndConSql(sql, expDateBgn, "b.INPUTTIME >='" + expDateBgn + "'");
var expDateEnd = form.findField('ETDend').getRawValue();
sql = sql + getAndConSql(sql, expDateEnd, "b.INPUTTIME <='" + expDateEnd + " 23:59:59'");
return sql;
}
});