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

2327 lines
79 KiB
JavaScript

2 years ago
//集运管理-路单查询
Ext.namespace('Shipping');
Shipping.MsOpPriceAddIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsOpPriceAddIndex.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsOpPriceAddIndex, Ext.Panel, {
PageSize: 2000,
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
sqlcontext: '1=2',
MainEditRecord: null,
storeBodyCostList: null,
initUIComponents: function () {
this.formname = 'MsOpPriceAddIndex';
this.sqlcontext = '1=2';
//定义数据集
this.storeListSeae = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'MsOpPrice',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcContainer/MsOpPrice/GetDataList',
reader: {
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.StoreDateCurr = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsFeeCurr',
proxy: { url: '/MvcShipping/MsChFee/GetFeeDateCurrList' }
});
this.StoreDateCurr.load();
this.StoreCurr = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsFeeCurr',
proxy: { url: '/MvcShipping/MsChFee/GetFeeCurrList' }
});
this.StoreCurr.load({ params: { condition: ""} });
//定义Grid
this.initgirdcolumsSeae = [{
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: 'LINE',
header: '航线',
width: 100
}, {
sortable: true,
dataIndex: 'COUNTRY',
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: '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
}];
this.girdcolumsSeae = this.initgirdcolumsSeae;
// this.girdcolumsSeae = DsTruck.GetGridPanel(USERID, this.formname + 'seae', this.initgirdcolumsSeae, 1);
this.gridListSeae = new Ext.grid.GridPanel({
store: this.storeListSeae,
enableHdMenu: false,
region: 'north',
height: 260,
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
columns: this.girdcolumsSeae,
bbar: Ext.create('Ext.PagingToolbar', {
store: this.storeListSeae,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
})
});
this.girdcolumsSeae = DsTruck.GetGridPanel(USERID, this.formname + 'Sea', this.girdcolumsSeae, 1);
this.gridListSeae.reconfigure(this.storeListSeae, this.girdcolumsSeae);
this.gridListSeae.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
}, this);
this.gridListSeae.getSelectionModel().on('select', function (model, record, index) {
var GID = record.data.GID;
var sql = "";
sql = " LINKGID='" + GID + "'";
this.storeBodyListSeae.load({ params: { condition: sql} });
}, this);
//#region 费用信息
this.storeBodyListSeae = Ext.create('Ext.data.Store', {
model: 'MsOpPriceItems',
remoteSort: false,
proxy: {
type: 'ajax',
url: '/MvcContainer/MsOpPrice/GetPriceItemsList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//明细表表格
this.gridListCheckBoxModelSeae = Ext.create('Ext.selection.CheckboxModel');
this.gridListBodySeae = new Ext.grid.GridPanel({
store: this.storeBodyListSeae,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
selModel: this.gridListCheckBoxModelSeae,
tbar: [{
text: '确认添加',
tooltip: '确认添加',
id: "btnadddetailSeae",
iconCls: "btnadddetail",
handler: function (button, event) {
this.addDetailSeae();
},
scope: this
}],
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: '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: 'CUSTOMERNAME',
header: '付款方',
width: 110
}, {
sortable: true,
dataIndex: 'REMARKS',
header: '备注',
width: 250
}]
});
this.panelBodySeae = new Ext.Panel({
title: '运价详细信息',
layout: "border",
region: 'center',
animate: true,
// autoScroll: true,
// containerScroll: true,
frame: false,
items: [this.gridListBodySeae]
});
//#endregion
//#region formSearch 查询面板
this.storeLANE = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.Lane',
proxy: { url: '/CommMng/BasicDataRef/GetCodeLaneList' }
});
this.storeLANE.load();
this.comboxLANESeae = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '航线',
store: this.storeLANE,
name: 'LANE',
valueField: 'LANE',
displayField: 'LANE',
enableKeyEvents: true,
listeners: {
specialkey: 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.comboxPORTDISCHARGESeae = 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.comboxPORTLOADSeae = 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.comboxCARRIERSeae = 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.onRefreshSeaeClick();
}
}
}
});
_this = this;
_this = this;
this.formSearchSeae = Ext.widget('form', {
frame: true,
region: 'north',
height: 40,
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.comboxPORTLOADSeae, this.comboxPORTDISCHARGESeae, this.comboxLANESeae, this.comboxCARRIERSeae, {
xtype: 'button',
width: 90,
text: "执行查询",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClickSeae(button, event);
},
scope: this
}
, {
xtype: 'button',
text: "保存列表样式",
menu: [
{
text: "保存",
handler: function (button, event) {
this.girdcolumsSeae = DsTruck.SaveGridPanel(USERID, _this.formname + 'Sea', _this.gridListSeae.columns, _this.girdcolumsSeae, 1, true);
}
}, {
text: "初始化",
handler: function (menu, event) {
_this.gridListSeae.reconfigure(_this.storeListSeae, _this.initgirdcolumsSeae);
_this.girdcolumsSeae = DsTruck.SaveGridPanel(USERID, _this.formname + 'Sea', _this.gridListSeae.columns, _this.initgirdcolumsSeae, 1, true);
}
}]
}
]
}
]//end items(fieldset 1)
}]//end root items
});
//#endregion formSearch
this.storeListSeai = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'MsOpPrice',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcContainer/MsOpPrice/GetDataList',
reader: {
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.girdcolumsseai = this.initgirdcolumsSeae;
this.gridListSeai = new Ext.grid.GridPanel({
store: this.storeListSeai,
enableHdMenu: false,
region: 'north',
height: 260,
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
columns: this.girdcolumsseai,
// paging bar on the bottom
bbar: Ext.create('Ext.PagingToolbar', {
store: this.storeListSeai,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
})
});
this.girdcolumsseai = DsTruck.GetGridPanel(USERID, this.formname + 'seai', this.girdcolumsseai, 1);
this.gridListSeai.reconfigure(this.storeListSeai, this.girdcolumsseai);
this.gridListSeai.getSelectionModel().on('select', function (model, record, index) {
var GID = record.data.GID;
var sql = "";
sql = " LINKGID='" + GID + "'";
this.storeBodyListSeai.load({ params: { condition: sql} });
}, this);
//#region 费用信息
this.storeBodyListSeai = Ext.create('Ext.data.Store', {
model: 'MsOpPriceItems',
remoteSort: false,
proxy: {
type: 'ajax',
url: '/MvcContainer/MsOpPrice/GetPriceItemsList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//明细表表格
this.gridListCheckBoxModelSeai = Ext.create('Ext.selection.CheckboxModel');
this.gridListBodySeai = new Ext.grid.GridPanel({
store: this.storeBodyListSeai,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
selModel: this.gridListCheckBoxModelSeai,
tbar: [{
text: '确认添加',
tooltip: '确认添加',
id: "btnadddetailSeai",
iconCls: "btnadddetail",
handler: function (button, event) {
this.addDetailSeai();
},
scope: this
}],
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: '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: 'CUSTOMERNAME',
header: '付款方',
width: 110
}, {
sortable: true,
dataIndex: 'REMARKS',
header: '备注',
width: 250
}]
});
this.panelBodySeai = new Ext.Panel({
title: '运价详细信息',
layout: "border",
region: 'center',
animate: true,
// autoScroll: true,
// containerScroll: true,
frame: false,
items: [this.gridListBodySeai]
});
//#endregion
//#region formSearch 查询面板
this.storeLANESeai = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.Lane',
proxy: { url: '/CommMng/BasicDataRef/GetCodeLaneList' }
});
this.storeLANESeai.load();
this.comboxLANESeai = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '航线',
store: this.storeLANESeai,
name: 'LANE',
valueField: 'LANE',
displayField: 'LANE',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClickSeai();
}
}
}
});
this.storeCodeDisportSeai = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CodeDisportModel',
proxy: { url: '/CommMng/BasicDataRef/GetCodeDisportList' }
});
this.storeCodeDisportSeai.load();
this.comboxPORTDISCHARGESeai = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '目的港',
store: this.storeCodeDisportSeai,
name: 'PORTDISCHARGE',
valueField: 'PORT',
queryMode: 'local',
displayField: 'PORT',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClickSeai();
}
}
}
});
this.comboxPORTLOADSeai = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '起运港',
store: this.storeCodeDisportSeai,
name: 'PORTLOAD',
valueField: 'PORT',
queryMode: 'local',
displayField: 'PORT',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClickSeai();
}
}
}
});
//客户加载_船公司
this.storeCARRIERSeai = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeCARRIERSeai.load({ params: { condition: "ISCARRIER='1'"} });
//船公司
this.comboxCARRIERSeai = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '船公司',
store: this.storeCARRIERSeai,
forceSelection: true,
name: 'CARRIER',
valueField: 'CustName',
displayField: 'CodeAndName',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
_this = this;
this.formSearchSeai = Ext.widget('form', {
frame: true,
region: 'north',
height: 40,
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 70,
msgTarget: 'qtip'
},
items: [{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxPORTLOADSeai, this.comboxPORTDISCHARGESeai, this.comboxLANESeai, this.comboxCARRIERSeai, {
xtype: 'button',
width: 90,
text: "执行查询",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClickSeai(button, event);
},
scope: this
}, {
xtype: 'button',
text: "保存列表样式",
menu: [
{
text: "保存",
handler: function (button, event) {
this.girdcolumsseai = DsTruck.SaveGridPanel(USERID, _this.formname + 'seai', _this.gridListSeai.columns, _this.girdcolumsseai, 1, true);
}
}, {
text: "初始化",
handler: function (menu, event) {
_this.gridListSeai.reconfigure(_this.storeListSeai, _this.initgirdcolumsSeae);
_this.girdcolumsseai = DsTruck.SaveGridPanel(USERID, _this.formname + 'seai', _this.gridListSeai.columns, _this.initgirdcolumsSeae, 1, true);
}
}],
scope: this
}]
}
]//end items(fieldset 1)
}]//end root items
});
//#endregion formSearch
this.storeListAgent = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'MsOpPrice',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcContainer/MsOpPrice/GetDataList',
reader: {
root: 'data',
totalProperty: 'totalCount'
}
}
});
//定义Grid
this.initgirdcolumsagent = [{
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
}
];
this.girdcolumsagent = this.initgirdcolumsagent;
// this.girdcolumsagent = DsTruck.GetGridPanel(USERID, this.formname + 'agent', this.initgirdcolumsagent, 1);
this.gridListAgent = new Ext.grid.GridPanel({
store: this.storeListAgent,
enableHdMenu: false,
region: 'north',
height: 260,
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
columns: this.girdcolumsagent,
// paging bar on the bottom
bbar: Ext.create('Ext.PagingToolbar', {
store: this.storeListAgent,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
})
});
this.girdcolumsagent = DsTruck.GetGridPanel(USERID, this.formname + 'agent', this.girdcolumsagent, 1);
this.gridListAgent.reconfigure(this.storeListAgent, this.girdcolumsagent);
this.gridListAgent.getSelectionModel().on('select', function (model, record, index) {
var GID = record.data.GID;
var sql = "";
sql = " LINKGID='" + GID + "'";
this.storeBodyListAgent.load({ params: { condition: sql} });
}, this);
//#region 费用信息
this.storeBodyListAgent = Ext.create('Ext.data.Store', {
model: 'MsOpPriceItems',
remoteSort: false,
proxy: {
type: 'ajax',
url: '/MvcContainer/MsOpPrice/GetPriceItemsList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//明细表表格
this.gridListCheckBoxModelAgent = Ext.create('Ext.selection.CheckboxModel');
this.gridListBodyAgent = new Ext.grid.GridPanel({
store: this.storeBodyListAgent,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
selModel: this.gridListCheckBoxModelAgent,
tbar: [{
text: '确认添加',
tooltip: '确认添加',
id: "btnadddetailAgent",
iconCls: "btnadddetail",
handler: function (button, event) {
this.addDetailAgent();
},
scope: this
}],
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: '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: 'CUSTOMERNAME',
header: '付款方',
width: 110
}, {
sortable: true,
dataIndex: 'REMARKS',
header: '备注',
width: 250
}]
});
this.panelBodyAgent = new Ext.Panel({
title: '运价详细信息',
layout: "border",
region: 'center',
animate: true,
// autoScroll: true,
// containerScroll: true,
frame: false,
items: [this.gridListBodyAgent]
});
//#endregion
//#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.onRefreshClickAgent();
}
}
}
});
this.storeCodeDisportAgent = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CodeDisportModel',
proxy: { url: '/CommMng/BasicDataRef/GetCodeDisportList' }
});
this.storeCodeDisportAgent.load();
this.comboxPORTDISCHARGEAgent = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '目的港',
store: this.storeCodeDisportAgent,
name: 'PORTDISCHARGE',
valueField: 'PORT',
queryMode: 'local',
displayField: 'PORT',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClickAgent();
}
}
}
});
this.comboxPORTLOADAgent = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '起运港',
store: this.storeCodeDisportAgent,
name: 'PORTLOAD',
valueField: 'PORT',
queryMode: 'local',
displayField: 'PORT',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClickAgent();
}
}
}
});
//客户加载_船公司
this.storeCARRIERAgent = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeCARRIERAgent.load({ params: { condition: "ISCARRIER='1'"} });
//船公司
this.comboxCARRIERAgent = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '船公司',
store: this.storeCARRIERAgent,
forceSelection: true,
name: 'CARRIER',
valueField: 'CustName',
displayField: 'CodeAndName',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClickAgent();
}
}
}
});
_this = this;
this.formSearchAgent = Ext.widget('form', {
frame: true,
region: 'north',
height: 40,
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 70,
msgTarget: 'qtip'
},
items: [{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxPORTLOADAgent, this.comboxPORTDISCHARGEAgent, this.comboxAgent, this.comboxCARRIERAgent, {
xtype: 'button',
width: 90,
text: "执行查询",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClickAgent(button, event);
},
scope: this
}, {
xtype: 'button',
text: "保存列表样式",
menu: [
{
text: "保存",
handler: function (button, event) {
this.girdcolumsagent = DsTruck.SaveGridPanel(USERID, _this.formname + 'agent', _this.gridListAgent.columns, _this.girdcolumsagent, 1, true);
}
}, {
text: "初始化",
handler: function (menu, event) {
_this.gridListAgent.reconfigure(_this.storeListAgent, _this.initgirdcolumsagent);
_this.girdcolumsagent = DsTruck.SaveGridPanel(USERID, _this.formname + 'agent', _this.gridListAgent.columns, _this.initgirdcolumsagent, 1, true);
}
}],
scope: this
}]
}
]//end items(fieldset 1)
}]//end root items
});
//#endregion formSearch
this.storeListYard = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'MsOpPrice',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcContainer/MsOpPrice/GetDataList',
reader: {
root: 'data',
totalProperty: 'totalCount'
}
}
});
//定义Grid
this.initgirdcolumsyard = [{
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: 'COUNTRY',
header: '国家',
width: 100
}, {
sortable: true,
dataIndex: 'PORTDISCHARGE',
header: '港口',
width: 100
}, {
sortable: true,
dataIndex: 'YARD',
header: '场站',
width: 100
}, {
sortable: true,
dataIndex: 'FEETYPE',
header: '费用类别',
width: 140
}, {
sortable: true,
dataIndex: 'REMARKS',
header: '备注',
width: 200
}, {
sortable: true,
dataIndex: 'INPUTBYREF',
header: '录入人',
width: 100
}, {
sortable: true,
dataIndex: 'INPUTTIME',
header: '录入时间',
width: 100
}];
this.girdcolumsyard = this.initgirdcolumsyard;
this.gridListYard = new Ext.grid.GridPanel({
store: this.storeListYard,
enableHdMenu: false,
region: 'north',
height: 260,
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
columns: this.girdcolumsyard,
// paging bar on the bottom
bbar: Ext.create('Ext.PagingToolbar', {
store: this.storeListYard,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
})
});
this.girdcolumsyard = DsTruck.GetGridPanel(USERID, this.formname + 'yard', this.girdcolumsyard, 1);
this.gridListYard.reconfigure(this.storeListYard, this.girdcolumsyard);
//#region 费用信息
this.storeBodyListYard = Ext.create('Ext.data.Store', {
model: 'MsOpPriceItems',
remoteSort: false,
proxy: {
type: 'ajax',
url: '/MvcContainer/MsOpPrice/GetPriceItemsList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//明细表表格
this.gridListCheckBoxModelYard = Ext.create('Ext.selection.CheckboxModel');
this.bodyYardcolumn = [{
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: 30
}, {
sortable: true,
dataIndex: 'FEENAME',
header: '费用名称',
width: 140
}, {
sortable: true,
dataIndex: 'GOODSNAME',
header: '品名',
width: 140
}, {
sortable: true,
dataIndex: 'CTNSTATUS',
header: '箱状态',
width: 80
}, {
sortable: true,
dataIndex: 'FREEDAY',
header: '免堆天数',
renderer: Ext.util.Format.numberRenderer('00'),
align: 'right',
width: 60
}, {
sortable: true,
dataIndex: 'UNIT',
header: '标准',
width: 100
}, {
sortable: true,
dataIndex: 'CURRENCY',
header: '币别',
width: 60
}, {
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: 100
}, {
sortable: true,
dataIndex: 'CUSTOMERNAME',
header: '收款方',
width: 110
}, {
sortable: true,
dataIndex: 'VALIDETD',
header: '有效日期',
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
width: 130
}, {
sortable: true,
dataIndex: 'REMARKS',
header: '备注',
width: 250
}, {
sortable: true,
dataIndex: 'FEESTATUS_REF',
header: '费用状态',
width: 60
}, {
sortable: true,
dataIndex: 'INPUTBYREF',
header: '录入人',
width: 60
}, {
sortable: true,
dataIndex: 'INPUTTIME',
header: '录入日期',
width: 80
}, {
sortable: true,
dataIndex: 'AUDITNAME',
header: '审核人',
width: 60
}, {
sortable: true,
dataIndex: 'AUDITDATE',
header: '审核日期',
width: 80
}];
this.gridListBodyYard = new Ext.grid.GridPanel({
store: this.storeBodyListYard,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
selModel: this.gridListCheckBoxModelYard,
tbar: [{
text: '确认添加',
tooltip: '确认添加',
id: "btnadddetailYard",
iconCls: "btnadddetail",
handler: function (button, event) {
this.addDetailYard();
},
scope: this
}],
columns: this.bodyYardcolumn
});
this.gridListYard.getSelectionModel().on('select', function (model, record, index) {
var GID = record.data.GID;
var FEETYPE = record.data.FEETYPE;
var sql = "";
sql = " LINKGID='" + GID + "'";
this.storeBodyListYard.load({ params: { condition: sql} });
this.InitYardGrid(this.bodyYardcolumn, FEETYPE);
}, this);
this.panelBodyYard = new Ext.Panel({
title: '运价详细信息',
layout: "border",
region: 'center',
animate: true,
// autoScroll: true,
// containerScroll: true,
frame: false,
items: [this.gridListBodyYard]
});
//#endregion
//#region formSearch 查询面板
//客户加载_场站
this.storeYARD = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeYARD.load({ params: { condition: "ISYARD='1'"} });
//场站
this.comboxYARD = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '场站',
store: this.storeYARD,
forceSelection: true,
name: 'YARD',
valueField: 'CustName',
displayField: 'CodeAndName'
});
this.storeCodeDisportYard = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CodeDisportModel',
proxy: { url: '/CommMng/BasicDataRef/GetCodeDisportList' }
});
this.storeCodeDisportYard.load();
this.comboxPORTDISCHARGEYard = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '港口',
store: this.storeCodeDisportYard,
name: 'PORTDISCHARGE',
valueField: 'PORT',
queryMode: 'local',
displayField: 'PORT',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClickYard();
}
}
}
});
this.storeCountry = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsCodeCountry',
proxy: { url: '/MvcShipping/MsCodeCountry/GetDataList' }
});
this.storeCountry.load({ params: { condition: ""} });
this.comboxCountry = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '国家',
store: this.storeCountry,
name: 'COUNTRY',
valueField: 'COUNTRY',
displayField: 'COUNTRY'
});
_this = this;
this.formSearchYard = Ext.widget('form', {
frame: true,
region: 'north',
height: 40,
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 70,
msgTarget: 'qtip'
},
items: [{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxPORTDISCHARGEYard, this.comboxYARD, this.comboxCountry, {
xtype: 'button',
width: 90,
text: "执行查询",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClickYard(button, event);
},
scope: this
}, {
xtype: 'button',
text: "保存列表样式",
menu: [
{
text: "保存",
handler: function (button, event) {
this.girdcolumsyard = DsTruck.SaveGridPanel(USERID, _this.formname + 'yard', _this.gridListYard.columns, _this.girdcolumsyard, 1, true);
}
}, {
text: "初始化",
handler: function (menu, event) {
_this.gridListYard.reconfigure(_this.storeListYard, _this.initgirdcolumsyard);
_this.girdcolumsyard = DsTruck.SaveGridPanel(USERID, _this.formname + 'yard', _this.gridListYard.columns, _this.initgirdcolumsyard, 1, true);
}
}],
scope: this
}]
}
]//end items(fieldset 1)
}]//end root items
});
//#endregion formSearch
//定义Grid
this.panelBodySeae = new Ext.Panel({
title: '海运出口报价',
layout: "border",
region: 'center',
margin: '0 0',
frame: true,
items: [this.formSearchSeae, this.gridListSeae, this.panelBodySeae]
});
this.panelBodySeai = new Ext.Panel({
title: '海运进口报价',
layout: "border",
region: 'center',
margin: '0 0',
frame: true,
items: [this.formSearchSeai, this.gridListSeai, this.panelBodySeai]
});
this.panelBodyAgent = new Ext.Panel({
title: '代理报价',
layout: "border",
region: 'center',
margin: '0 0',
frame: true,
items: [this.formSearchAgent, this.gridListAgent, this.panelBodyAgent]
});
this.panelBodyYard = new Ext.Panel({
title: '场站报价',
layout: "border",
region: 'center',
margin: '0 0',
frame: true,
items: [this.formSearchYard, this.gridListYard, this.panelBodyYard]
});
this.tabpanel = new Ext.TabPanel
({
activeTab: 0,
autoWidth: true,
border: false,
frame: false,
region: 'center',
id: "TabPanelID",
enableTabScroll: true,
items:
[
this.panelBodySeae,
this.panelBodySeai,
this.panelBodyAgent,
this.panelBodyYard
]
});
Ext.apply(this, {
items: [this.tabpanel]
});
_this = this;
this.storeListSeae.on('beforeload', function (store) {
var sql = this.getConditionSeae();
Ext.apply(store.proxy.extraParams, { condition: sql, pricetype: '1' });
}, this);
this.storeListSeai.on('beforeload', function (store) {
var sql = this.getConditionSeai();
Ext.apply(store.proxy.extraParams, { condition: sql, pricetype: '2' });
}, this);
this.storeListAgent.on('beforeload', function (store) {
var sql = this.getConditionAgent();
Ext.apply(store.proxy.extraParams, { condition: sql, pricetype: '3' });
}, this);
this.storeListYard.on('beforeload', function (store) {
var sql = this.getConditionYard();
Ext.apply(store.proxy.extraParams, { condition: sql, pricetype: '4' });
}, this);
this.parentWin = window.parent.opener._this;
if (this.parentWin) {
this.storeBodyCostList = this.parentWin.storeBodyCostList;
this.MainEditRecord = this.parentWin.editRecord;
}
window.closeAction = 'destroy';
}, //end initUIComponents
InitGrid: function (grid, thgridList, thstoreList) {
var agirdcolums = grid;
for (i = 0; i < this.storectndisp.getCount(); i += 1) {
var itemindex = i + 1;
var memberyf = this.storectndisp.getAt(i);
for (var j = 0; j < agirdcolums.length; j++) {
if (agirdcolums[j].dataIndex == 'CNTR1') {
if (memberyf.data.CNT1 != '' && memberyf.data.CNT1 != null) {
agirdcolums[j].header = memberyf.data.CNT1;
agirdcolums[j].hidden = false;
} else {
agirdcolums[j].hidden = true;
}
}
if (agirdcolums[j].dataIndex == 'CNTR2') {
if (memberyf.data.CNT2 != '' && memberyf.data.CNT2 != null) {
agirdcolums[j].header = memberyf.data.CNT2;
agirdcolums[j].hidden = false;
} else {
agirdcolums[j].hidden = true;
}
}
if (agirdcolums[j].dataIndex == 'CNTR3') {
if (memberyf.data.CNT3 != '' && memberyf.data.CNT3 != null) {
agirdcolums[j].header = memberyf.data.CNT3;
agirdcolums[j].hidden = false;
} else {
agirdcolums[j].hidden = true;
}
}
if (agirdcolums[j].dataIndex == 'CNTR4') {
if (memberyf.data.CNT4 != '' && memberyf.data.CNT4 != null) {
agirdcolums[j].header = memberyf.data.CNT4;
agirdcolums[j].hidden = false;
} else {
agirdcolums[j].hidden = true;
}
}
if (agirdcolums[j].dataIndex == 'CNTR5') {
if (memberyf.data.CNT5 != '' && memberyf.data.CNT5 != null) {
agirdcolums[j].header = memberyf.data.CNT5;
agirdcolums[j].hidden = false;
} else {
agirdcolums[j].hidden = true;
}
}
if (agirdcolums[j].dataIndex == 'CNTR6') {
if (memberyf.data.CNT6 != '' && memberyf.data.CNT6 != null) {
agirdcolums[j].header = memberyf.data.CNT6;
agirdcolums[j].hidden = false;
} else {
agirdcolums[j].hidden = true;
}
}
if (agirdcolums[j].dataIndex == 'CNTR7') {
if (memberyf.data.CNT7 != '' && memberyf.data.CNT7 != null) {
agirdcolums[j].header = memberyf.data.CNT7;
agirdcolums[j].hidden = false;
} else {
agirdcolums[j].hidden = true;
}
}
if (agirdcolums[j].dataIndex == 'CNTR8') {
if (memberyf.data.CNT8 != '' && memberyf.data.CNT8 != null) {
agirdcolums[j].header = memberyf.data.CNT8;
agirdcolums[j].hidden = false;
} else {
agirdcolums[j].hidden = true;
}
}
if (agirdcolums[j].dataIndex == 'CNTR9') {
if (memberyf.data.CNT9 != '' && memberyf.data.CNT9 != null) {
agirdcolums[j].header = memberyf.data.CNT9;
agirdcolums[j].hidden = false;
} else {
agirdcolums[j].hidden = true;
}
}
if (agirdcolums[j].dataIndex == 'CNTR10') {
if (memberyf.data.CNT10 != '' && memberyf.data.CNT10 != null) {
agirdcolums[j].header = memberyf.data.CNT10;
agirdcolums[j].hidden = false;
} else {
agirdcolums[j].hidden = true;
}
}
}
};
thgridList.reconfigure(thstoreList, agirdcolums);
},
onRefreshClickSeae: function (button, event) {
if (!this.checkSearchConditionSeae())
return;
var sql = this.getConditionSeae();
this.sqlcontext = sql;
this.storeListSeae.load({
params: { start: 0, limit: this.PageSize, condition: sql, pricetype: '1' },
waitMsg: "正在查询数据...",
scope: this
});
},
onRefreshClickSeai: function (button, event) {
if (!this.checkSearchConditionSeai())
return;
var sql = this.getConditionSeai();
this.sqlcontext = sql;
this.storeListSeai.load({
params: { start: 0, limit: this.PageSize, condition: sql, pricetype: '2' },
waitMsg: "正在查询数据...",
scope: this
});
},
onRefreshClickAgent: function (button, event) {
if (!this.checkSearchConditionAgent())
return;
var sql = this.getConditionAgent();
this.sqlcontext = sql;
this.storeListAgent.load({
params: { start: 0, limit: this.PageSize, condition: sql, pricetype: '3' },
waitMsg: "正在查询数据...",
scope: this
});
},
onRefreshClickYard: function (button, event) {
if (!this.checkSearchConditionYard())
return;
var sql = this.getConditionYard();
this.sqlcontext = sql;
this.storeListYard.load({
params: { start: 0, limit: this.PageSize, condition: sql, pricetype: '4' },
waitMsg: "正在查询数据...",
scope: this
});
},
onDsQuery: function (button, event) {
var sql = this.sqlcontext;
this.storeList.load({
params: { start: 0, limit: this.PageSize, condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
this.storeCustList.load({
params: { start: 0, limit: this.PageSize, condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
this.storeSaleList.load({
params: { start: 0, limit: this.PageSize, condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
this.storeDeptList.load({
params: { start: 0, limit: this.PageSize, condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
},
addDetailSeae: function () {
var selectedRecords = [];
var storeadd = null;
selectedRecords = this.gridListCheckBoxModelSeae.selected.items;
if (selectedRecords.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择要添加的费用明细!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
for (var i = 0; i < selectedRecords.length; i++) {
var memberyf = selectedRecords[i];
var newsort = this.storeBodyCostList.getCount() + 1;
var QUANTITY = 1;
var AMOUNT = memberyf.data.UNITPRICE;
if (this.MainEditRecord.get('CTNALL') == memberyf.data.UNIT) {
QUANTITY = this.MainEditRecord.get('CTNNUM');
AMOUNT = Mul(memberyf.data.UNITPRICE, QUANTITY);
}
var exchange = this.calExchange(memberyf.data.CURRENCY);
var record = Ext.create('MsOpCtnApplyCostItems', {
GID: '*',
LINKGID: '*',
PRICETYPE: '1',
ITEMSNO: newsort,
CUSTOMERNAME: memberyf.data.CUSTOMERNAME,
FEENAME: memberyf.data.FEENAME,
UNIT: memberyf.data.UNIT,
UNITPRICE: memberyf.data.UNITPRICE,
QUANTITY: QUANTITY,
AMOUNT: AMOUNT,
CURRENCY: memberyf.data.CURRENCY,
EXCHANGERATE: exchange,
REMARKS: memberyf.data.REMARKS
});
record.id = NewGuid();
record.internalId = NewGuid();
this.storeBodyCostList.add(record);
};
Ext.Msg.alert('提示', '已加入!');
},
addDetailSeai: function () {
var selectedRecords = [];
var storeadd = null;
selectedRecords = this.gridListCheckBoxModelSeai.selected.items;
if (selectedRecords.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择要添加的费用明细!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
for (var i = 0; i < selectedRecords.length; i++) {
var memberyf = selectedRecords[i];
var newsort = this.storeBodyCostList.getCount() + 1;
var QUANTITY = 1;
var AMOUNT = memberyf.data.UNITPRICE;
if (this.MainEditRecord.get('CTNALL') == memberyf.data.UNIT) {
QUANTITY = this.MainEditRecord.get('CTNNUM');
AMOUNT = Mul(memberyf.data.UNITPRICE, QUANTITY);
}
var exchange = this.calExchange(memberyf.data.CURRENCY);
var record = Ext.create('MsOpCtnApplyCostItems', {
GID: '*',
LINKGID: '*',
PRICETYPE: '2',
ITEMSNO: newsort,
CUSTOMERNAME: memberyf.data.CUSTOMERNAME,
FEENAME: memberyf.data.FEENAME,
UNIT: memberyf.data.UNIT,
UNITPRICE: memberyf.data.UNITPRICE,
QUANTITY: QUANTITY,
AMOUNT: AMOUNT,
EXCHANGERATE: exchange,
CURRENCY: memberyf.data.CURRENCY,
REMARKS: memberyf.data.REMARKS
});
record.id = NewGuid();
record.internalId = NewGuid();
this.storeBodyCostList.add(record);
};
Ext.Msg.alert('提示', '已加入!');
},
addDetailAgent: function () {
var selections = this.gridListAgent.getSelectionModel().getSelection();
if (selections.length == 0) {
this.gridListAgent.getSelectionModel().select(0);
}
selections = this.gridListAgent.getSelectionModel().getSelection();
var rec = selections[0];
this.parentWin.setHeadCostFieldValue('CHANGERATE', rec.data.CHANGERATE);
this.parentWin.setHeadCostFieldValue('AGENTNAME', rec.data.AGENTNAME);
var selectedRecords = [];
var storeadd = null;
selectedRecords = this.gridListCheckBoxModelAgent.selected.items;
if (selectedRecords.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择要添加的费用明细!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
for (var i = 0; i < selectedRecords.length; i++) {
var memberyf = selectedRecords[i];
var newsort = this.storeBodyCostList.getCount() + 1;
// if (memberyf.data.FEENAME == '超期箱使费') {
// this.parentWin.setHeadFieldValue('CHANGERATE', memberyf.data.CHANGERATE);
// }
var QUANTITY = 1;
var AMOUNT = memberyf.data.UNITPRICE;
if (this.MainEditRecord.get('CTNALL') == memberyf.data.UNIT) {
QUANTITY = this.MainEditRecord.get('CTNNUM');
AMOUNT = Mul(memberyf.data.UNITPRICE, QUANTITY);
}
var exchange = this.calExchange(memberyf.data.CURRENCY);
var record = Ext.create('MsOpCtnApplyCostItems', {
GID: '*',
LINKGID: '*',
PRICETYPE: '3',
ITEMSNO: newsort,
CUSTOMERNAME: memberyf.data.CUSTOMERNAME,
FEENAME: memberyf.data.FEENAME,
UNIT: memberyf.data.UNIT,
UNITPRICE: memberyf.data.UNITPRICE,
QUANTITY: QUANTITY,
AMOUNT: AMOUNT,
EXCHANGERATE: exchange,
CURRENCY: memberyf.data.CURRENCY,
REMARKS: memberyf.data.REMARKS
});
record.id = NewGuid();
record.internalId = NewGuid();
this.storeBodyCostList.add(record);
};
Ext.Msg.alert('提示', '已加入!');
},
addDetailYard: function () {
var selectedRecords = [];
var storeadd = null;
selectedRecords = this.gridListCheckBoxModelYard.selected.items;
if (selectedRecords.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择要添加的费用明细!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
for (var i = 0; i < selectedRecords.length; i++) {
var memberyf = selectedRecords[i];
var newsort = this.storeBodyCostList.getCount() + 1;
if (memberyf.data.CTNSTATUS == '重箱') {
if (memberyf.data.FREEDAY != 0)
this.parentWin.setHeadCostFieldValue('FULL_CTN_FREE_STORAGE_DAY', memberyf.data.FREEDAY);
if (memberyf.data.FEENAME == '堆存费') {
this.parentWin.setHeadCostFieldValue('FULL_CTN_OVER_STORAGE_RATE', memberyf.data.UNITPRICE);
}
}
if (memberyf.data.CTNSTATUS == '清洗空箱') {
if (memberyf.data.FREEDAY != 0)
this.parentWin.setHeadCostFieldValue('CLEAR_CTN_FREE_STORAGE_DAY', memberyf.data.FREEDAY);
if (memberyf.data.FEENAME == '堆存费') {
this.parentWin.setHeadCostFieldValue('CLEAR_CTN_OVER_STORAGE_RATE', memberyf.data.UNITPRICE);
}
}
if (memberyf.data.CTNSTATUS == '不清洗空箱') {
if (memberyf.data.FREEDAY != 0)
this.parentWin.setHeadCostFieldValue('NO_CLEAR_CTN_FREE_STORAGE_DAY', memberyf.data.FREEDAY);
if (memberyf.data.FEENAME == '堆存费') {
this.parentWin.setHeadCostFieldValue('NO_CLEAR_CTN_OVER_STORAGE_RATE', memberyf.data.UNITPRICE);
}
}
var QUANTITY = 1;
var AMOUNT = memberyf.data.UNITPRICE;
if (this.MainEditRecord.get('CTNALL') == memberyf.data.UNIT) {
QUANTITY = this.MainEditRecord.get('CTNNUM');
AMOUNT = Mul(memberyf.data.UNITPRICE, QUANTITY);
}
var exchange = this.parentWin.calExchange(memberyf.data.CURRENCY);
var record = Ext.create('MsOpCtnApplyCostItems', {
GID: NewGuid(),
LINKGID: '*',
PRICETYPE: '4',
ITEMSNO: newsort,
FEENAME: memberyf.data.FEENAME,
CUSTOMERNAME: memberyf.data.CUSTOMERNAME,
UNIT: memberyf.data.UNIT,
UNITPRICE: memberyf.data.UNITPRICE,
QUANTITY: QUANTITY,
AMOUNT: AMOUNT,
CURRENCY: memberyf.data.CURRENCY,
GOODSNAME: memberyf.data.GOODSNAME,
EXCHANGERATE: exchange,
REMARKS: memberyf.data.REMARKS
});
record.id = NewGuid();
record.internalId = NewGuid();
this.storeBodyCostList.add(record);
};
Ext.Msg.alert('提示', '已加入!');
},
InitYardGrid: function (grid, feetype) {
if (feetype == '' || feetype == NaN) return;
_thisfee = this;
var agirdcolums = grid;
for (var j = 0; j < agirdcolums.length; j++) {
if (feetype == '维修') {
if (agirdcolums[j].dataIndex == 'GOODSNAME')
agirdcolums[j].hidden = true;
if (agirdcolums[j].dataIndex == 'CTNSTATUS')
agirdcolums[j].hidden = true;
if (agirdcolums[j].dataIndex == 'FREEDAY')
agirdcolums[j].hidden = true;
} else if (feetype == '清洗') {
if (agirdcolums[j].dataIndex == 'GOODSNAME')
agirdcolums[j].hidden = false;
if (agirdcolums[j].dataIndex == 'CTNSTATUS')
agirdcolums[j].hidden = true;
if (agirdcolums[j].dataIndex == 'FREEDAY')
agirdcolums[j].hidden = true;
} else if (feetype == '堆存') {
if (agirdcolums[j].dataIndex == 'GOODSNAME')
agirdcolums[j].hidden = true;
if (agirdcolums[j].dataIndex == 'CTNSTATUS')
agirdcolums[j].hidden = false;
if (agirdcolums[j].dataIndex == 'FREEDAY')
agirdcolums[j].hidden = false;
}
}
this.gridListBodyYard.reconfigure(this.storeBodyListYard, agirdcolums);
},
calExchange: function (curr) {
var result = 1;
if (curr != 'RMB') {
var FFrecords = DsStoreQueryBy(this.StoreDateCurr, 'CURR', curr);
if (FFrecords.getCount() > 0) {
var ffdata = FFrecords.getAt(0).data;
result = ffdata.DEFRATE;
} else {
var DFrecords = DsStoreQueryBy(this.StoreCurr, 'CURR', curr);
if (DFrecords.getCount() > 0) {
var dfdata = DFrecords.getAt(0).data;
result = dfdata.DEFRATE;
} else {
}
}
}
return result;
},
getConditionSeae: function () {
var form = this.formSearchSeae.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var sql = " b.PRICETYPE='1' AND 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 LANE = form.findField('LANE').getValue();
sql = sql + getAndConSql(sql, LANE, " b.LINE='" + LANE + "'");
var CARRIER = form.findField('CARRIER').getValue();
sql = sql + getAndConSql(sql, CARRIER, " b.CARRIER='" + CARRIER + "'");
return sql;
},
getConditionSeai: function () {
var form = this.formSearchSeai.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var sql = " b.PRICETYPE='2' AND 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 LANE = form.findField('LANE').getValue();
sql = sql + getAndConSql(sql, LANE, " b.LINE='" + LANE + "'");
var CARRIER = form.findField('CARRIER').getValue();
sql = sql + getAndConSql(sql, CARRIER, " b.CARRIER='" + CARRIER + "'");
return sql;
},
getConditionAgent: function () {
var form = this.formSearchAgent.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var sql = " b.PRICETYPE='3' AND 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 + "'");
return sql;
},
getConditionYard: function () {
var form = this.formSearchYard.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var sql = " b.PRICETYPE='4' AND GID IN (SELECT LINKGID FROM op_price_items) ";
var PORTDISCHARGE = form.findField('PORTDISCHARGE').getValue();
sql = sql + getAndConSql(sql, PORTDISCHARGE, " b.PORTDISCHARGE like '%" + PORTDISCHARGE + "%' ");
var YARD = form.findField('YARD').getValue();
sql = sql + getAndConSql(sql, YARD, " b.YARD='" + YARD + "'");
var COUNTRY = form.findField('COUNTRY').getValue();
sql = sql + getAndConSql(sql, COUNTRY, " b.COUNTRY='" + COUNTRY + "'");
return sql;
},
checkSearchConditionSeae: function () {
var form = this.formSearchSeae.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return false;
}
return true;
},
checkSearchConditionSeai: function () {
var form = this.formSearchSeai.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return false;
}
return true;
},
checkSearchConditionAgent: function () {
var form = this.formSearchAgent.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return false;
}
return true;
},
checkSearchConditionYard: function () {
var form = this.formSearchYard.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return false;
}
return true;
},
onClearSqlSeae: function () {
var form = this.formSearchSeae.getForm();
form.reset();
},
onClearSqlSeai: function () {
var form = this.formSearchSeai.getForm();
form.reset();
},
onClearSqlAgent: function () {
var form = this.formSearchAgent.getForm();
form.reset();
},
onClearSqlYard: function () {
var form = this.formSearchYard.getForm();
form.reset();
},
onSaveGridClick: function (button, event) {
if (this.tabpanel.getActiveTab() == this.panelBodyChFee) {
this.girdcolums = DsTruck.SaveGridPanel(USERID, this.formname + 'bs', this.gridList.columns, this.girdcolums, 1, true);
} else if (this.tabpanel.getActiveTab() == this.panelSaleSum) {
this.girdcolumssale = DsTruck.SaveGridPanel(USERID, this.formname + 'sale', this.gridListSale.columns, this.girdcolumssale, 1, true);
} else if (this.tabpanel.getActiveTab() == this.panelCustSum) {
this.girdcolumscust = DsTruck.SaveGridPanel(USERID, this.formname + 'cust', this.gridListCust.columns, this.girdcolumscust, 1, true);
} else if (this.tabpanel.getActiveTab() == this.panelDeptSum) {
this.girdcolumsdept = DsTruck.SaveGridPanel(USERID, this.formname + 'dept', this.gridListDept.columns, this.girdcolumsdept, 1, true);
}
},
oninitGridClick: function (button, event) {
if (this.tabpanel.getActiveTab() == this.panelBodyChFee) {
var agirdcolums = this.initgirdcolums;
this.gridList.reconfigure(this.storeList, agirdcolums);
this.girdcolums = DsTruck.SaveGridPanel(USERID, this.formname + 'bs', this.gridList.columns, this.initgirdcolums, 1, true);
} else if (this.tabpanel.getActiveTab() == this.panelSaleSum) {
this.gridListSale.reconfigure(this.storeSaleList, this.initgirdcolumssale);
this.girdcolumssale = DsTruck.SaveGridPanel(USERID, this.formname + 'sale', this.gridListSale.columns, this.initgirdcolumssale, 1, true);
} else if (this.tabpanel.getActiveTab() == this.panelCustSum) {
this.gridListCust.reconfigure(this.storeCustList, this.initgirdcolumscust);
this.girdcolumscust = DsTruck.SaveGridPanel(USERID, this.formname + 'cust', this.gridListCust.columns, this.initgirdcolumscust, 1, true);
} else if (this.tabpanel.getActiveTab() == this.panelDeptSum) {
this.gridListDept.reconfigure(this.storeDeptList, this.initgirdcolumsdept);
this.girdcolumsdept = DsTruck.SaveGridPanel(USERID, this.formname + 'dept', this.gridListDept.columns, this.initgirdcolumsdept, 1, true);
}
}
});