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/MsPrice/MsPrice_QuotationEdit.js

3011 lines
97 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.MsPrice_QuotationEdit = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsPrice_QuotationEdit.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsPrice_QuotationEdit, Ext.Panel, {
parentWin: null,
opStatus: 'add',
StoreList: null,
editRecord: null,
Editdata: null,
MainEditRecord: null,
stroplb: '报价管理',///与视图 V_op_bs 的OPLBNAME相同 依赖于枚举类型96005
isfen: false,
PageSize: 50,
initUIComponents: function () {
this.serialNo = 0;
//this.bodyDel = [];
this.itemindex = 1;
this.initloaddata = 0;
this.accdatesameetd = 0;
this.MsPeriod = null;
this.SALEORDERDEPTBYOP = 0;
this.formname = "MsPrice_ContractEdit";
this.formname_Add = "MsPrice_ContractEdit_Add";
this.UpLoadFileType = 'Price_Quotation';
_this = this;
parentWin = window.parent.opener;
//mainWin = getMainForm(parentWin);
opflex = 0.6;//上方几个用户下拉框 《操作》等的宽度
ViaWidth = 90;//中转港信息的的标签宽度
//#region 信息加载
//权限范围
this.StoreOpRange = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsOP',
proxy: { url: '/MvcShipping/MsBaseInfo/GetOpIDRang' }
});
//this.StoreOpRange.load({ params: { optype: "modOrderManagement" } });
//#region 船公司
this.storeCARRIER = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListCARRIER' }
});
//this.storeCARRIER.load();
this.comboxCARRIER = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '船公司',
labelWidth:45,
store: this.storeCARRIER,
flex:1,
//queryMode: 'remote',
//minChars: 1,
//queryParam: 'CODENAME',
name: 'CARRIER',
id: 'search_carrier',
valueField: 'CustName',
displayField: 'CodeAndName',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.comboxCARRIER_grid = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeCARRIER,
matchFieldWidth: false,
name: 'CARRIER',
valueField: 'CustName',
displayField: 'CodeAndName',
});
this.storeCustCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListController' }
});
//this.storeCustCode.load();
this.comboxCust = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '报价单位',
store: this.storeCustCode,
forceSelection: true,
//queryMode: 'remote',
//minChars: 2,
autoSelect: true,
name: 'CUSTOMERNAME',
valueField: 'CustName',
displayField: 'CodeAndName'
//,allowBlank: false
});
//#endregion
//#region 起运港 目的港
this.storeCodeLoadport = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CodeLoadportModel',
proxy: { url: '/CommMng/BasicDataRef/GetCodeLoadportList' }
});
//this.storeCodeLoadport.load();
this.comboxPORTLOAD = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '起运港',
labelWidth: 45,
flex: 1,
store: this.storeCodeLoadport,
name: 'PORTLOAD',
id: 'search_portload',
valueField: 'PORT',
displayField: 'CodeAndName',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.comboxPORTLOAD_grid = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeCodeLoadport,
matchFieldWidth: false,
name: 'PORTLOAD',
valueField: 'PORT',
displayField: 'CodeAndName'
});
this.storeCodePort = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CodeDisportModel',
proxy: { url: '/CommMng/BasicDataRef/GetCodeDisportList' }
});
//this.storeCodePort.load();
this.comboxPORTDISCHARGE = Ext.create('DsExt.ux.RefTableCombox', {
//fieldLabel: '目的港',
store: this.storeCodePort,
name: 'PORTDISCHARGE',
matchFieldWidth: false,
valueField: 'PORT',
displayField: 'CodeAndName'
});
this.storeCodePort2 = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CodeDisportModel',
proxy: { url: '/CommMng/BasicDataRef/GetCodeDisportList' }
});
//this.storeCodePort2.load();
this.comboxPORTDISCHARGE2 = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '目的港',
labelWidth: 45,
flex: 1,
store: this.storeCodePort2,
name: 'PORTDISCHARGE',
id: 'search_portdischarge',
valueField: 'PORT',
displayField: 'CodeAndName',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.storeCodePort3 = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CodeDisportModel',
proxy: { url: '/CommMng/BasicDataRef/GetCodeDisportList' }
});
//this.storeCodePort3.load();
this.comboxPORTDISCHARGE3 = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '中转港',
labelWidth: 45,
flex: 1,
store: this.storeCodePort3,
name: 'VIA',
id: 'search_via',
valueField: 'PORT',
displayField: 'CodeAndName',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.comboxVIA = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeCodePort2,
name: 'VIA',
matchFieldWidth: false,
valueField: 'PORT',
displayField: 'CodeAndName'
});
this.comboxVIA2 = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeCodePort3,
name: 'VIA2',
matchFieldWidth: false,
valueField: 'PORT',
displayField: 'CodeAndName'
});
this.comboxVIA3 = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeCodePort,
name: 'VIA3',
matchFieldWidth: false,
valueField: 'PORT',
displayField: 'CodeAndName'
});
//#endregion
this.storeCT = getPriceCtnTypeStore();
this.comboxCTNTYPE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '箱型',
labelWidth: 35,
store: this.storeCT,
name: 'CTNTYPE',
id: 'search_ctntype',
valueField: 'ID',
displayField: 'NAME',
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'keyup': {
fn: function (_field, e) {
if (e.getKey() == 13) {
this.onRefreshClick();
}
},
scope: this
}
}
});
this.storeLANE = Ext.create('DsExt.ux.RefTableStore', {
model: 'XiaLaKuangModel',
proxy: { url: '/MvcShipping/MsCrmPriceCarrierList/GetLANEList' }
});
this.storeLANE.load();
this.comboxLANE = Ext.create('DsExt.ux.RefTableCombox', {
labelWidth: 35,
flex: 1,
store: this.storeLANE,
name: 'LANE',
id: 'search_lane1',
valueField: 'NAME',
displayField: 'CodeAndName',
forceSelection: false,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.storeLANE_2 = Ext.create('DsExt.ux.RefTableStore', {
model: 'XiaLaKuangModel',
proxy: { url: '/MvcShipping/MsCrmPriceCarrierList/GetLANEList' }
});
this.storeLANE_2.load();
this.comboxLANE_2 = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '航线',
labelWidth: 35,
flex: 1,
store: this.storeLANE_2,
name: 'LANE_2',
id: 'search_lane',
valueField: 'NAME',
displayField: 'CodeAndName',
forceSelection: false,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
//加载业务信息
//枚举类型30002 默认杂费模板
this.storeZaFeiModel = Ext.create('DsExt.ux.RefEnum_AllStore', {});
this.comboxZaFeiFeeName = Ext.create('DsExt.ux.RefEnumCombox', {
store: this.storeZaFeiModel,
forceSelection: false,
name: 'FEENAME',
valueField: 'EnumValueName',
displayField: 'EnumValueName'
});
//
this.storecurr = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CodeCurrencyModel',
proxy: { url: '/CommMng/BasicDataRef/GetCodeCurrencyList' }
});
this.storecurr.load({ params: { condition: "" } });
this.comboxcurr = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storecurr,
name: 'CURRENCY',
valueField: 'CODENAME',
displayField: 'CODENAME'
//币别
});
//#endregion
//#region 主表信息
this.formHead = Ext.widget('form', {
//layout: "border",
region: 'north',
title: '报价信息',
//height:300,
frame: true,
bodyPadding: 5,
collapsed: false,
collapsible: true,
trackResetOnLoad: true,
fieldDefaults: {
margins: '2 3 2 0',
labelAlign: 'right',
flex: 1,
labelWidth: 65,
msgTarget: 'qtip'
},
items: [
{
//第一格
xtype: 'container',
//title:'委托信息',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
{
fieldLabel: 'TIMEMARK',
name: 'TIMEMARK', hidden: true
},
{
fieldLabel: '报价编号', flex: 1, readOnly: true,
name: 'BSNO'
}, this.comboxCust
, {
fieldLabel: '生效时间',
format: 'Y-m-d',
flex: 1,
xtype: 'datefield',
name: 'EFFECTIVEDATE',
id: 'search_etdbgn'
, allowBlank: false
}, {
fieldLabel: '失效时间',
format: 'Y-m-d',
flex: 1,
xtype: 'datefield',
name: 'VALIDDATE',
id: 'search_etdend'
, allowBlank: false
}
]
}
]
},
{
//第2格
xtype: 'container',
defaultType: 'textfield',
layout: 'hbox',
defaults: {
anchor: '100%'
},
items: [
{
fieldLabel: '报价人',readOnly:true,
flex: 1,
name: 'CREATOR'
},
{
fieldLabel: '报价时间', readOnly: true,
flex: 1,
name: 'CREATETIME'
},
{
fieldLabel: '备注',
flex:2,
name: 'REMARK'
}
]
}
]//end items(fieldset 1)
}); //end this.formHead
//#endregion
//#region 报价明细
this.cellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
//this.cargoCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
this.initcolumn = [
{
sortable: true,hidden:true,
dataIndex: 'GID',
header: 'GID',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'BSNO',
header: 'BSNO',
width: 80
},
{
sortable: true,
dataIndex: 'SEQUENCE',
header: '顺序号',
width: 40,
editor: {
xtype: 'numberfield',
selectOnFocus: true, //得到焦点时自动选择文本
allowDecimals: false //允许输入小数
//decimalPrecision: 2 //允许保留的小数位数,并四舍五入
}
},
{
sortable: true,
dataIndex: 'LANE',
header: '航线',
width: 80
,editor: this.comboxLANE
},
{
sortable: true,
dataIndex: 'PODLOAD',
header: '起运港',
width: 80
, editor: this.comboxPORTLOAD_grid
},
{
sortable: true,
dataIndex: 'PORTDISCHARGE',
header: '卸货港',
width: 80
,editor: this.comboxPORTDISCHARGE
},
{
sortable: true,
dataIndex: 'CARRIER',
header: '船公司',
width: 80
,editor: this.comboxCARRIER_grid
},
{
sortable: true,
dataIndex: 'VIA',
header: '中转港',
width: 80
, editor: this.comboxVIA
},
{
sortable: true,
dataIndex: 'VIA2',
header: '中转港2',
width: 80
, editor: this.comboxVIA3
},
{
sortable: true, align: 'right',
dataIndex: 'ETD',
header: 'ETD',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},
{
sortable: true, align: 'right',
dataIndex: 'TT',
header: 'TT',
width: 80,
editor: {
xtype: 'numberfield',
allowDecimals: false, //允许输入小数
decimalPrecision: 0,
nanText: '请输入有效数字',
selectOnFocus: true
}
},
{
sortable: true,
dataIndex: 'EFFECTIVEDATE',
header: '生效时间',
width: 80,
renderer: Ext.util.Format.dateRenderer('Y-m-d')
, editor: {
xtype: 'datefield',
format: 'Y-m-d'
}
},
{
sortable: true,
dataIndex: 'VALIDDATE',
header: '失效时间',
width: 80,
renderer: Ext.util.Format.dateRenderer('Y-m-d')
, editor: {
xtype: 'datefield',
format: 'Y-m-d'
}
},
{
sortable: true,
dataIndex: 'FEE0',
header: '附加费',
width: 80,
editor: {
xtype: 'numberfield',
allowDecimals: false, //允许输入小数
decimalPrecision: 2,
nanText: '请输入有效数字',
selectOnFocus: true
}
},
{
sortable: true, hidden: true,
dataIndex: 'FEE1',
header: 'FEE1',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'FEE2',
header: 'FEE2',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'FEE3',
header: 'FEE3',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'FEE4',
header: 'FEE4',
width: 80
},
{
sortable: true, align: 'right',
dataIndex: 'CTN00',
header: '小柜底价',
width: 80,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
cellmeta.tdCls = '浅灰色';
return '<div id="CTN00' + record.data.GID + '" class="TipDiv">' + value + '</div>';
}
},
{
sortable: true, align: 'right',
dataIndex: 'CTN02',
header: '小柜报价',
width: 80,
editor: {
xtype: 'numberfield',
allowDecimals: true, //允许输入小数
decimalPrecision: 2,
nanText: '请输入有效小数',
selectOnFocus: true
},
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
if (parseFloat(value, 2) <= parseFloat(record.data.CTN00))
cellmeta.tdCls = 'OST';
value = usMoney(value, 2, '', true);
return value;
}
},
{
sortable: true, align: 'right',
dataIndex: 'CTN10',
header: '大柜底价',
width: 80,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
cellmeta.tdCls = '浅灰色';
return '<div id="CTN10' + record.data.GID + '" class="TipDiv">' + value + '</div>';
}
},
{
sortable: true, align: 'right',
dataIndex: 'CTN12',
header: '大柜报价',
width: 80,
editor: {
xtype: 'numberfield',
allowDecimals: true, //允许输入小数
decimalPrecision: 2,
nanText: '请输入有效小数',
selectOnFocus: true
},
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
if (parseFloat(value, 2) <= parseFloat(record.data.CTN10))
cellmeta.tdCls = 'OST';
value = usMoney(value, 2, '', true);
return value;
}
},
{
sortable: true, align: 'right',
dataIndex: 'CTN20',
header: '超高底价',
width: 80,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
cellmeta.tdCls = '浅灰色';
return '<div id="CTN20' + record.data.GID + '" class="TipDiv">' + value + '</div>';
}
},
{
sortable: true, align: 'right',
dataIndex: 'CTN22',
header: '超高报价',
width: 80,
editor: {
xtype: 'numberfield',
allowDecimals: true, //允许输入小数
decimalPrecision: 2,
nanText: '请输入有效小数',
selectOnFocus: true
},
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
if (parseFloat(value, 2) <= parseFloat(record.data.CTN20))
cellmeta.tdCls = 'OST';
value = usMoney(value, 2, '', true);
return value;
}
},
{
sortable: true, align: 'right',
dataIndex: 'CTN30',
header: '小冻底价',
width: 80,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
cellmeta.tdCls = '浅灰色';
return '<div id="CTN30' + record.data.GID + '" class="TipDiv">' + value + '</div>';
}
},
{
sortable: true, align: 'right',
dataIndex: 'CTN32',
header: '小冻报价',
width: 80,
editor: {
xtype: 'numberfield',
allowDecimals: true, //允许输入小数
decimalPrecision: 2,
nanText: '请输入有效小数',
selectOnFocus: true
},
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
if (parseFloat(value, 2) <= parseFloat(record.data.CTN30))
cellmeta.tdCls = 'OST';
value = usMoney(value, 2, '', true);
return value;
}
},
{
sortable: true, align: 'right',
dataIndex: 'CTN40',
header: '超冻底价',
width: 80,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
cellmeta.tdCls = '浅灰色';
return '<div id="CTN40' + record.data.GID + '" class="TipDiv">' + value + '</div>';
}
},
{
sortable: true, align: 'right',
dataIndex: 'CTN42',
header: '超冻报价',
width: 80,
editor: {
xtype: 'numberfield',
allowDecimals: true, //允许输入小数
decimalPrecision: 2,
nanText: '请输入有效小数',
selectOnFocus: true
},
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
if (parseFloat(value, 2) <= parseFloat(record.data.CTN40))
cellmeta.tdCls = 'OST';
value = usMoney(value, 2, '', true);
return value;
}
},
{
dataIndex: 'CTN0DETENTION',
text: '目的港免箱期_小柜',
width: 100,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},
{
dataIndex: 'CTN1DETENTION',
text: '目的港免箱期_大柜',
width: 100,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},
{
dataIndex: 'CTN2DETENTION',
text: '目的港免箱期_超高',
width: 100,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},
{
dataIndex: 'CTN3DETENTION',
text: '目的港免箱期_小冻',
width: 100,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},
{
dataIndex: 'CTN4DETENTION',
text: '目的港免箱期_超冻',
width: 100,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},
{
sortable: true,
dataIndex: 'COMMODITY',
header: '品名/特殊商品',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},
{
sortable: true,
dataIndex: 'REMARK',
header: '备注',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},
{
sortable: true, hidden: true,
dataIndex: 'INPUTBY',
header: 'INPUTBY',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'INPUTBYREF',
header: '录入人',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'INPUTTIME',
header: '录入时间',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'MODIFIEDUSER',
header: 'MODIFIEDUSER',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'MODIFIEDUSERREF',
header: '修改人',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'MODIFYTIME',
header: '修改时间',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CTN50',
header: 'CTN50',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CTN60',
header: 'CTN60',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CTN70',
header: 'CTN70',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CTN80',
header: 'CTN80',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CTN90',
header: 'CTN90',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CTN01',
header: 'CTN01',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CTN11',
header: 'CTN11',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CTN21',
header: 'CTN21',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CTN31',
header: 'CTN31',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CTN41',
header: 'CTN41',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CTN51',
header: 'CTN51',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CTN61',
header: 'CTN61',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CTN71',
header: 'CTN71',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CTN81',
header: 'CTN81',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CTN91',
header: 'CTN91',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CTN52',
header: 'CTN52',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CTN62',
header: 'CTN62',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CTN72',
header: 'CTN72',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CTN82',
header: 'CTN82',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CTN92',
header: 'CTN92',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CTN03',
header: 'CTN03',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CTN13',
header: 'CTN13',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CTN23',
header: 'CTN23',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CTN33',
header: 'CTN33',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CTN43',
header: 'CTN43',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CTN53',
header: 'CTN53',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CTN63',
header: 'CTN63',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CTN73',
header: 'CTN73',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CTN83',
header: 'CTN83',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CTN93',
header: 'CTN93',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CTN04',
header: 'CTN04',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CTN14',
header: 'CTN14',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CTN24',
header: 'CTN24',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CTN34',
header: 'CTN34',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CTN44',
header: 'CTN44',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CTN54',
header: 'CTN54',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CTN64',
header: 'CTN64',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CTN74',
header: 'CTN74',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CTN84',
header: 'CTN84',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CTN94',
header: 'CTN94',
width: 80
},
{
sortable: true,
dataIndex: 'PORTDISCHARGEID',
header: '卸货港ID',
width: 80,
editor: this.comboxVIA2
},
{
sortable: true,
dataIndex: 'CONTRACTNO',
header: '合约号',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},
{
sortable: true, hidden: true,
dataIndex: 'CONTRACTBSNO',
header: 'CONTRACTBSNO',
width: 80
}
];
this.column = this.initcolumn;
this.storeBody = Ext.create('Ext.data.Store', {
model: 'MsPrice_Quotation_Detailmb',
remoteSort: false,
//groupField: 'GroupDate',
proxy: {
type: 'ajax',
//url: '/TruckMng/MsRptPcHeadOperate/QryData_ADL',
url: '/MvcShipping/MsPrice/GetQuotationDetailList',
//this.storeList.proxy.url = '/TruckMng/MsRptPcHeadOperate/QryData_ADL';
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.formDetail = new Ext.grid.GridPanel({
store: this.storeBody,
enableHdMenu: false,
region: 'center',
layout: "border",
anchor: '100% 55%',
//height: 160,
title: '报价明细',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
plugins: [this.cellEditing],
//selModel: //this.cargoCheckBoxModel,
selType: 'cellmodel',
//features: [{
// ftype: 'summary'//Ext.grid.feature.Summary表格汇总特性
//}],
tbar: [
//{
// text: '增加明细',
// tooltip: '增加明细',
// id: "btnadddetail",
// iconCls: "btnadddetail",
// handler: function (button, event) {
// this.onAddDetailClick(button, event);
// },
// scope: this
//},
{
text: '删除明细',
tooltip: '删除明细',
id: 'btndeletedetail',
iconCls: "btndeletedetail",
handler: function (button, event) {
this.onDelDetailClick(button, event);
},
scope: this
}
],
columns: this.column
});
this.column = DsTruck.GetGridPanel(USERID, this.formname, this.column);
//使用者id表名 中间column数组跳过一开始的几列
this.formDetail.reconfigure(this.storeBody, this.column);
//#endregion
//#region 待取用的运价明细
this.initcolumn_Add = [
{
sortable: true, hidden: true,
dataIndex: 'GID',
header: 'GID',
width: 80
},
{
sortable: true,
dataIndex: 'LANE',
header: '航线',
width: 80
},
{
sortable: true,
dataIndex: 'PODLOAD',
header: '起运港',
width: 80
},
{
sortable: true,
dataIndex: 'PORTDISCHARGE',
header: '卸货港中文',
width: 80
},
{
sortable: true,
dataIndex: 'PORTDISCHARGEID',
header: '卸货港',
width: 80
},
{
sortable: true,
dataIndex: 'CARRIER',
header: '船公司',
width: 80
},
{
sortable: true,
dataIndex: 'CONTRACTNO',
header: '合约号',
width: 80
},
{
sortable: true,
dataIndex: 'VIA',
header: '中转港',
width: 80
},
{
sortable: true,
dataIndex: 'VIA2',
header: '中转港2',
width: 80
},
{
sortable: true,
dataIndex: 'ETD',
header: 'ETD',
width: 80
},
{
sortable: true,
dataIndex: 'TT',
header: 'TT',
width: 80
},
{
sortable: true,
dataIndex: 'EFFECTIVEDATE',
header: '生效时间',
width: 80,
renderer: Ext.util.Format.dateRenderer('Y-m-d')
},
{
sortable: true,
dataIndex: 'VALIDDATE',
header: '失效时间',
width: 80,
renderer: Ext.util.Format.dateRenderer('Y-m-d')
},
{
sortable: true,
dataIndex: 'FEE0',
header: '附加费',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'FEE1',
header: 'FEE1',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'FEE2',
header: 'FEE2',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'FEE3',
header: 'FEE3',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'FEE4',
header: 'FEE4',
width: 80
},
{
sortable: true,
dataIndex: 'CTN00',
header: '小柜底价',
width: 80,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
return '<div id="CTN00' + record.data.GID + '" class="TipDiv">' + usMoney(value, 2, '', true) + '</div>';
}
},
{
sortable: true,
dataIndex: 'CTN02',
header: '小柜报价',
width: 80,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
sortable: true,
dataIndex: 'CTN10',
header: '大柜底价',
width: 80,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
return '<div id="CTN10' + record.data.GID + '" class="TipDiv">' + usMoney(value, 2, '', true) + '</div>';
}
},
{
sortable: true,
dataIndex: 'CTN12',
header: '大柜报价',
width: 80,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
sortable: true,
dataIndex: 'CTN20',
header: '超高底价',
width: 80,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
return '<div id="CTN20' + record.data.GID + '" class="TipDiv">' + usMoney(value, 2, '', true) + '</div>';
}
},
{
sortable: true,
dataIndex: 'CTN22',
header: '超高报价',
width: 80,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
sortable: true,
dataIndex: 'CTN30',
header: '小冻底价',
width: 80,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
return '<div id="CTN30' + record.data.GID + '" class="TipDiv">' + usMoney(value, 2, '', true) + '</div>';
}
},
{
sortable: true,
dataIndex: 'CTN32',
header: '小冻报价',
width: 80,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
sortable: true,
dataIndex: 'CTN40',
header: '超冻底价',
width: 80,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
return '<div id="CTN40' + record.data.GID + '" class="TipDiv">' + usMoney(value, 2, '', true) + '</div>';
}
},
{
sortable: true,
dataIndex: 'CTN42',
header: '超冻报价',
width: 80,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
dataIndex: 'CTN0DETENTION',
text: '目的港免箱期_小柜',
width: 100
},
{
dataIndex: 'CTN1DETENTION',
text: '目的港免箱期_大柜',
width: 100
},
{
dataIndex: 'CTN2DETENTION',
text: '目的港免箱期_超高',
width: 100
},
{
dataIndex: 'CTN3DETENTION',
text: '目的港免箱期_小冻',
width: 100
},
{
dataIndex: 'CTN4DETENTION',
text: '目的港免箱期_超冻',
width: 100
},
{
sortable: true,
dataIndex: 'COMMODITY',
header: '品名/特殊商品',
width: 80
},
{
sortable: true,
dataIndex: 'REMARK',
header: '备注',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'INPUTBY',
header: 'INPUTBY',
width: 80
},
{
sortable: true,
dataIndex: 'INPUTBYREF',
header: '录入人',
width: 80
},
{
sortable: true,
dataIndex: 'INPUTTIME',
header: '录入时间',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'MODIFIEDUSER',
header: 'MODIFIEDUSER',
width: 80
},
{
sortable: true,
dataIndex: 'MODIFIEDUSERREF',
header: '修改人',
width: 80
},
{
sortable: true,
dataIndex: 'MODIFYTIME',
header: '修改时间',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CTN50',
header: 'CTN50',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CTN60',
header: 'CTN60',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CTN70',
header: 'CTN70',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CTN80',
header: 'CTN80',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CTN90',
header: 'CTN90',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CTN01',
header: 'CTN01',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CTN11',
header: 'CTN11',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CTN21',
header: 'CTN21',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CTN31',
header: 'CTN31',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CTN41',
header: 'CTN41',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CTN51',
header: 'CTN51',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CTN61',
header: 'CTN61',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CTN71',
header: 'CTN71',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CTN81',
header: 'CTN81',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CTN91',
header: 'CTN91',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CTN52',
header: 'CTN52',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CTN62',
header: 'CTN62',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CTN72',
header: 'CTN72',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CTN82',
header: 'CTN82',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CTN92',
header: 'CTN92',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CTN03',
header: 'CTN03',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CTN13',
header: 'CTN13',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CTN23',
header: 'CTN23',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CTN33',
header: 'CTN33',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CTN43',
header: 'CTN43',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CTN53',
header: 'CTN53',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CTN63',
header: 'CTN63',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CTN73',
header: 'CTN73',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CTN83',
header: 'CTN83',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CTN93',
header: 'CTN93',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CTN04',
header: 'CTN04',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CTN14',
header: 'CTN14',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CTN24',
header: 'CTN24',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CTN34',
header: 'CTN34',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CTN44',
header: 'CTN44',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CTN54',
header: 'CTN54',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CTN64',
header: 'CTN64',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CTN74',
header: 'CTN74',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CTN84',
header: 'CTN84',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CTN94',
header: 'CTN94',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CONTRACTBSNO',
header: 'CONTRACTBSNO',
width: 80
}
];
this.column_Add = this.initcolumn_Add;
this.storeBody_Add = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'MsPrice_Quotation_Addmb',
remoteSort: false,
//groupField: 'GroupDate',
viewConfig: {
enableTextSelection: true
},
proxy: {
type: 'ajax',
//url: '/TruckMng/MsRptPcHeadOperate/QryData_ADL',
url: '/MvcShipping/MsPrice/GetQuotationAddList',
//this.storeList.proxy.url = '/TruckMng/MsRptPcHeadOperate/QryData_ADL';
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.CBM = Ext.create('Ext.selection.CheckboxModel');
this.Pagenum = Ext.create('Ext.form.field.Number', {
name: 'bottles',
fieldLabel: '每页记录数',
labelAlign: 'right',
value: this.PageSize,
maxValue: 100000,
width: 180,
minValue: 0,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.formDetail_Add = new Ext.grid.GridPanel({
store: this.storeBody_Add,
enableHdMenu: false,
region: 'center',
layout: "border",
anchor: '100% 45%',
title: '报价',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
//plugins: [this.cellEditing],
selModel: this.CBM,
selType: 'cellmodel',
//features: [{
// ftype: 'summary'//Ext.grid.feature.Summary表格汇总特性
//}],
tbar: [
{
text: '增加明细',
tooltip: '增加明细',
id: "btnadddetail",
iconCls: "btnadddetail",
handler: function (button, event) {
this.onAddDetailClick(button, event);
},
scope: this
}, '-',
{
text: "执行查询",
labelWidth: 60,
iconCls: "btnrefresh",
handler: function (button, event) {
var Form = this.formHead.getForm();
if (!Form.isValid()) {
return;
}
this.onRefreshClick(button, event);
},
scope: this
},
this.comboxCARRIER,
this.comboxPORTLOAD,
this.comboxPORTDISCHARGE2,
this.comboxPORTDISCHARGE3,
this.comboxCTNTYPE,
this.comboxLANE_2,
{
xtype: 'textfield',
fieldLabel: '合约号/合约序列号',
labelWidth: 109,
flex: 1,
name: 'CONTRACT',
id: 'search_contract',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}
//{
// text: '删除明细',
// tooltip: '删除明细',
// id: 'btndeletedetail',
// iconCls: "btndeletedetail",
// handler: function (button, event) {
// this.onDelDetailClick(button, event);
// },
// scope: this
//}
],
columns: this.column_Add
,
bbar: [Ext.create('Ext.PagingToolbar', {
store: this.storeBody_Add,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
}), this.Pagenum]
});
this.column_Add = DsTruck.GetGridPanel(USERID, this.formname_Add, this.column_Add);
//使用者id表名 中间column数组跳过一开始的几列
this.formDetail_Add.reconfigure(this.storeBody_Add, this.column_Add);
//#endregion
//#region 按钮Toolbar
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [
{
id: 'btnESave',
text: "保存",
iconCls: "btnsave",
handler: function (button, event) {
this.Save('0');
},
scope: this
},
{
id: 'btnESaveAndClose',
text: "保存并关闭",
handler: function (button, event) {
this.Save('1');
},
scope: this
},
{
text: "关闭",
handler: function (button, event) {
window.close();
},
scope: this
}
, '-',
{
id: 'btnCopyNew',
text: "复制新建",
iconCls: "btncopy",
handler: function (button, event) {
this.Save('2');
},
scope: this
}, '-',
{
text: "上传报价单", id: "btnMAKEPRICE",
handler: function (button, event) {
this.UploadPDF();
},
scope: this
},
{
text: "下载报价单", id: "btndownload",
handler: function (button, event) {
window.open(this.Editdata.PDFURL);
},
scope: this
}, '-',
{
text: "打印",
iconCls: "btnprint",
handler: function (button, event) {
this.Print();
},
scope: this
}, '-', {
text: "保存列表样式",
menu: [
{
text: "保存",
handler: function (button, event) {
_this.column = DsTruck.SaveGridPanel(USERID, _this.formname, _this.formDetail.columns, _this.column, 0, true);
_this.formDetail.reconfigure(_this.storeBody, _this.column);
_this.column_Add = DsTruck.SaveGridPanel(USERID, _this.formname_Add, _this.formDetail_Add.columns, _this.column_Add, 0, true);
_this.formDetail_Add.reconfigure(_this.storeBody_Add, _this.column_Add);
}
}, {
text: "初始化",
handler: function (menu, event) {
_this.formDetail.reconfigure(_this.storeBody, _this.initcolumn);
_this.columns = DsTruck.SaveGridPanel(USERID, _this.formname, _this.formDetail.columns, _this.initctncolumns, 0, true);
_this.formDetail_Add.reconfigure(_this.storeBody_Add, _this.initcolumn_Add);
_this.columns_Add = DsTruck.SaveGridPanel(USERID, _this.formname_Add, _this.formDetail_Add.columns, _this.initctncolumns_Add, 0, true);
}
}],
scope: this
}]
}); //end 按钮Toolbar
//#endregion
//#region 关联提单号
this.storeMblnoList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'MsPrice_Quotation_MblnoListmb',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsPrice/GetQuotationMblnoList',
reader: {
id: 'ID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.gridMblnoList = new Ext.grid.GridPanel({
store: this.storeMblnoList,
enableHdMenu: false,
region: 'center',
layout: "border",
title: '报价相关业务列表',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
plugins: [],
tbar: [
],
columns: [
{
sortable: true, hidden: true,
dataIndex: 'ID',
header: 'ID',
width: 80
}, {
sortable: true, hidden: true,
dataIndex: 'BSNO',
header: 'BSNO',
width: 80
}, {
sortable: true,
dataIndex: 'MBLNO',
header: '主提单号',
width: 100
}, {
sortable: true,
dataIndex: 'CREATOR',
header: '关联人',
width: 100
}, {
sortable: true,
dataIndex: 'CREATETIME',
header: '关联时间',
width: 100
}
]
});
//#endregion
//#region 杂费列表
this.storeZaFeiList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'MsPrice_Quotation_ZaFeiListmb',
remoteSort: false,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsPrice/GetZaFeiList',
reader: {
id: 'ID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.cellEditingZaFei = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.gridZaFeiList = new Ext.grid.GridPanel({
store: this.storeZaFeiList,
enableHdMenu: false,
region: 'center',
layout: "border",
title: '杂费列表',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
plugins: [this.cellEditingZaFei],
tbar: [
{
id: 'btnAddZaFei',
text: "添加",
tooltip:"注意,此处变动必须点击保存才实际保存。",
iconCls: "btnadd",
handler: function (button, event) {
this.AddZaFei();
},
scope: this
},
{
id: 'btnDelZaFei',
text: "删除",
tooltip: "注意,此处变动必须点击保存才实际保存。",
iconCls: "btndelete",
handler: function (button, event) {
this.DelZaFei();
},
scope: this
}
],
columns: [
{
sortable: true, hidden: true,
dataIndex: 'ID',
header: 'ID',
width: 80
}, {
sortable: true, hidden: true,
dataIndex: 'BSNO',
header: 'BSNO',
width: 80
},
{
sortable: true,
dataIndex: 'SEQUENCE',
header: '顺序号',
width: 40,
editor: {
xtype: 'numberfield',
selectOnFocus: true, //得到焦点时自动选择文本
allowDecimals: false //允许输入小数
//decimalPrecision: 2 //允许保留的小数位数,并四舍五入
}
}, {
sortable: true,
dataIndex: 'FEENAME',
header: '费用名称',
width: 100,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}, {
sortable: true,
dataIndex: 'CURRENCY',
header: '币别',
width: 100,
editor: this.comboxcurr
}, {
sortable: true,
dataIndex: 'UNIT',
header: '单位标准',
width: 100,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}, {
sortable: true,
dataIndex: 'AMOUNT',
header: '金额',
width: 100,
editor: {
xtype: 'numberfield',
allowDecimals: true, //允许输入小数
decimalPrecision: 2,
selectOnFocus: true
}
}, {
sortable: true,
align: 'center',
dataIndex: 'NEEDSHOW',
header: '包含',
width: 100,
renderer: function (value, cellmeta) {
if (isTrue(value)) {
return "√";
} else return "";
},
editor: {
xtype: 'checkboxfield'
}
}, {
sortable: true,
align: 'center',
dataIndex: 'NEEDHIDE',
header: '不包含',
width: 100,
renderer: function (value, cellmeta) {
if (isTrue( value)) {
return "√";
} else return "";
},
editor: {
xtype: 'checkboxfield'
}
}
]
});
//#endregion
//#region 框架结构
this.panelPrice = new Ext.Panel({
title:"报价信息",
layout: "anchor",
// region: 'north',
// height: 560,
region: 'center',
items: [
this.formDetail
, this.formDetail_Add
]
});
this.MainTab = new Ext.tab.Panel({
layout: "border",
region: "center",
items: [this.panelPrice, this.gridMblnoList, this.gridZaFeiList]
});
Ext.apply(this, {
items: [
this.panelBtn, this.formHead, this.MainTab
]
});
//#endregion
this.LoadInitData();
this.InitData();
//#region 其他
this.formDetail.on('edit', function (editor, e, eOpts) {
//this.AfterEdit(editor, e, eOpts);
}, this);
this.gridZaFeiList.on('edit', function (editor, e, eOpts) {
this.ZaFeiAfterEdit(editor, e, eOpts);
}, this);
this.storeBody_Add.on('beforeload', function (store) {
var sql = this.getCondition();
this.storeBody_Add.pageSize = this.PageSize;
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
//#endregion
}, //end initUIComponents
//#region 加载事件
InitData: function () {
this.opStatus = 'add';
var condition = '';
_this = this;
if (parentWin) {
var ret = parentWin.OprationSwap();
this.opStatus = ret[0];
this.StoreList = ret[1];
this.editRecord = ret[2];
_storeCustCode = ret[5];
this.storeCustCode.loadData(_storeCustCode.data.items);
_storeCodeLoadport = ret[6];
this.storeCodeLoadport.loadData(_storeCodeLoadport.data.items);
_storeCodePort = ret[7];
this.storeCodePort.loadData(_storeCodePort.data.items);
this.storeCodePort2.loadData(_storeCodePort.data.items);
this.storeCodePort3.loadData(_storeCodePort.data.items);
_storeCARRIER = ret[8];
this.storeCARRIER.loadData(_storeCARRIER.data.items);
}
if (this.opStatus == 'edit') {
Headcondition = "BSNO='" + this.editRecord.get('BSNO') + "'";
Bodycondition = "BSNO='" + this.editRecord.get('BSNO') + "'";
//this.storeBodyList.load({ params: { condition: condition} });
this.storeZaFeiModel.load({ params: { enumTypeId: 30002 } });
} else {
Headcondition = "";
Bodycondition = "1=2";
this.LoadZaFeiDefault();
}
this.LoadData(this.opStatus, Headcondition, Bodycondition);
}, //end InitData
LoadData: function (opstatus, condition, Bodycondition) {
this.serialNo = 0;
//this.bodyDel = [];
var BSNO = "";
this.opStatus = opstatus;
if (this.opStatus == 'add') {
document.title = "新建报价单";
}
if (this.opStatus == 'edit') {
BSNO = this.editRecord.get('BSNO').toString().trim()
if (BSNO != "") {
document.title = "报价单序列号:" + this.editRecord.get('BSNO').toString().trim();
}
}
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/MvcShipping/MsPrice/GetQuotationData',
params: {
handle: opstatus,
condition: condition
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title: '提示',
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
}
this.Editdata = result.data;
//this.LoadInit(data);
this.formHead.getForm().reset();
this.formHead.getForm().setValues(this.Editdata);
this.GetEditStatus();
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
this.storeMblnoList.load({ params: { condition: " BSNO='" + BSNO+"' " } });
this.loadBody(Bodycondition);
},
loadBody: function (condition) {
_this = this;
this.storeBody.load(
{
params: { condition: condition }
,
callback: function (options, success, response) {
_this.DoSetGridTip();
}
}
);
if (this.opStatus == 'edit')
this.storeZaFeiList.load(
{
params: { condition: condition }
,
callback: function (options, success, response) {
}
}
);
},
//#endregion
LoadInitData: function () {
},
//#region 保存/添加/删除
Save: function (type) {
var Form = this.formHead.getForm();
if (!Form.isValid()) {
return;
}
var data = Form.getValues();
var Bodydatas = [];
for (var i = 0; i < this.storeBody.getCount(); i += 1) {
var member = this.storeBody.getAt(i);
Bodydatas.push(member);
}
var jsonBody = ConvertRecordsToJson(Bodydatas);
var ZaFeidatas = [];
for (var i = 0; i < this.storeZaFeiList.getCount(); i += 1) {
var member = this.storeZaFeiList.getAt(i);
ZaFeidatas.push(member);
}
var jsonBody_ZaFei = ConvertRecordsToJson(ZaFeidatas);
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/MvcShipping/MsPrice/SaveQuotation',
scope: this,
params: {
opstatus: this.opStatus,
data: Ext.JSON.encode(data),
Body: jsonBody,
ZaFei: jsonBody_ZaFei
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var returnData = jsonresult.Data;
this.Editdata = returnData;
this.Editdata.EFFECTIVEDATE = this.Editdata.EFFECTIVEDATE.replace(" 00:00:00", "");
this.Editdata.VALIDDATE = this.Editdata.VALIDDATE.replace(" 00:00:00", "");
this.formHead.getForm().reset();
this.formHead.getForm().setValues(this.Editdata);
if (this.opStatus == 'add') {
var arrNewRecords = this.StoreList.add(returnData);
this.editRecord = arrNewRecords[0];
this.opStatus = 'edit';
}
else if (this.opStatus == 'edit') {
var editp = Ext.create('MsPrice_QuotationIndexmb', returnData);
this.editRecord.fields.each(function (field) {
if (field.persist) {
name = field.name;
if (name != 'BSNO')
this.editRecord.set(name, editp.get(name));
}
}, this);
this.editRecord.commit();
//this.Editdata = result.data;
}
this.GetEditStatus();
if (type == '0') {
this.loadBody(" BSNO='" + this.editRecord.get('BSNO').toString().trim() + "'");
} else if (type == '1') {
window.close();
} else if (type == '2') {
this.CopyNew();
} else if (type == '3') {
//执行add方法
this.DoAddDetailClick();
}
} 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
CopyNew: function () {
this.opStatus = 'add';
var basicForm = this.formHead.getForm();
basicForm.findField('BSNO').setValue('');
basicForm.findField('CUSTOMERNAME').setValue('');
this.storeBody.each(function (record) {
record.set('GID', NewGuid());
record.set('BSNO', '');
});
this.storeZaFeiList.each(function (record) {
record.set('GID', NewGuid());
record.set('BSNO', '');
});
}
,
onAddDetailClick: function (button, event) {
//执行save方法 在callback当中执行添加子项 最后再load一次
var selections = this.formDetail_Add.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择单据!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
this.Save('3');
},
DoAddDetailClick: function (button, event) {
var selections = this.formDetail_Add.getSelectionModel().getSelection();
GIDList = "";
for (var _i = 0; _i < selections.length; _i++) {
rec = selections[_i];
if (GIDList != "") GIDList += ",";
GIDList += "'" + rec.data.GID + "'";
}
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/MvcShipping/MsPrice/AddQuotationDetail',
scope: this,
params: {
data: Ext.JSON.encode(this.Editdata),
GID: GIDList
},
callback: function (options, success, response) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.loadBody("BSNO='" + this.editRecord.get('BSNO') + "'");
this.onRefreshClick();
} else {
Ext.Msg.show({
title: '请重试',
msg: jsonresult.Message,
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
}
});
},
onDelDetailClick: function (button, event) {
var selectedRecords = this.formDetail.selModel.getSelection();
Ext.MessageBox.confirm('提示', '确定删除记录吗?', function (btn) {
if (btn == 'yes') {
var GIDList = "";
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (GIDList != "") {
GIDList += ",";
}
GIDList += "'" + rec.data.GID + "'";
}
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/MvcShipping/MsPrice/DelQuotationDetail',
scope: this,
params: {
data: Ext.JSON.encode(this.Editdata),
GID: GIDList
},
callback: function (options, success, response) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
//var returnData = jsonresult.Data;
//this.Editdata = returnData;
this.loadBody("BSNO='" + this.editRecord.get('BSNO') + "'");
//this.formHead.getForm().reset();
//this.formHead.getForm().setValues(this.Editdata);
//this.loadBody(" BSNO='" + this.editRecord.get('BSNO').toString().trim() + "' ");
} else {
Ext.Msg.show({
title: '请重试',
msg: jsonresult.Message,
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
}
});
}
}, this);
},
reLine: function (button, event) {
var _L = 1;
this.storeBody.each(function (record) {
var ln = _L + "";
_L = _L + 1;
record.set('SEQUENCE', ln);
});
},
//#endregion
//#region 载入初始信息
LoadInit: function (data) {
},
//#endregion
//#region 编辑时按钮等的状态
GetEditStatus: function () {
var canedit = false;
_this = this;
var op = USERID;
this.StoreOpRange.load({
params: { optype: "modPrice_Quotation" },
callback: function (r, options, success) {
if (success) {
if (r.length != 0) {
var records = DsStoreQueryBy(_this.StoreOpRange, 'OPID', op);
if (records.getCount() > 0) {
canedit = true;
}
} else { canedit = false; }
_this.setSaveBtnStatus(canedit);
}
}
});
},
GetStringNum: function (str) {
var num = 0;
if (str == null || str == '') return num;
if (str.length == 0) return num;
var if_find = false;
var str_num = '';
for (var i = 0; i < str.length; i += 1) {
var member = str.substr(i, 1);
if ((member == '0') || (member == '1') || (member == '2') || (member == '3')
|| (member == '4') || (member == '5') || (member == '6') || (member == '7')
|| (member == '8') || (member == '9') || (member == '.') || (member == '-')) {
if (!if_find) {
str_num = str_num + member;
}
} else {
if_find = true;
}
}
return str_num;
},
setSaveBtnStatus: function (enable) {
var btnESave = Ext.getCmp('btnESave');
var btnESaveAndClose = Ext.getCmp('btnESaveAndClose');
var btndeletedetail = Ext.getCmp('btndeletedetail');
if (enable) {
btnESave.enable();
btnESaveAndClose.enable();
btndeletedetail.enable();
} else {
btnESave.disable();
btnESaveAndClose.disable();
btndeletedetail.disable();
}
},
//#endregion
//#region 下半部查询
onRefreshClick: function (button, event) {
this.PageSize = this.Pagenum.getValue();
_this = this;
var sql = this.getCondition();
this.storeBody_Add.load({
params: { start: 0, limit: this.PageSize, condition: sql },
waitMsg: "正在查询数据...",
callback: function (options, success, response) {
_this.DoSetGridTip_Add();
},
scope: this
});
//}
},
getCondition: function () {
//var form = this.formSearch.getForm();
var sql = '';
//if (!isNullorEmpty(this.Editdata.BSNO)) {
// _bsno = this.Editdata.BSNO;
// sql = sql + getAndConSql(sql, _bsno, " not exists (select 1 from op_seaprice_quotation_detail d where d.carrier = carrier and d.PODLOAD=PODLOAD and d.PORTDISCHARGE=PORTDISCHARGE and d.VIA=VIA) ");
//}
var CARRIER = Ext.getCmp('search_carrier').getValue();
sql = sql + getAndConSql(sql, CARRIER, " CARRIER like '%" + CARRIER + "%' ");
var PORTLOAD = Ext.getCmp('search_portload').getValue();
sql = sql + getAndConSql(sql, PORTLOAD, " PODLOAD = '" + PORTLOAD + "' ");
var PORTDISCHARGE = Ext.getCmp('search_portdischarge').getValue();
sql = sql + getAndConSql(sql, PORTDISCHARGE, " PORTDISCHARGEID = '" + PORTDISCHARGE + "' ");
var VIA = Ext.getCmp('search_via').getValue();
sql = sql + getAndConSql(sql, VIA, " (VIA = '" + VIA + "' or VIA2 = '" + VIA + "') ");
var BSNO = Ext.getCmp('search_contract').getValue();
sql = sql + getAndConSql(sql, BSNO, " (CONTRACTNO like '%" + BSNO + "%' or CONTRACTBSNO like '%" + BSNO + "%') ");
var ETD_BGN = Ext.getCmp('search_etdbgn').getRawValue();
var ETD_END = Ext.getCmp('search_etdend').getRawValue() + " 23:59:59";
if (!isNullorEmpty(ETD_BGN) && !isNullorEmpty(ETD_END)) {
sql = sql + getAndConSql(sql, ETD_BGN, "dbo.F_TimeMixed(EFFECTIVEDATE,VALIDDATE,'" + ETD_BGN + "','" + ETD_END + "')='true' ");
} else {
sql = sql + getAndConSql(sql, ETD_BGN, " VALIDDATE>='" + ETD_BGN + "'");
sql = sql + getAndConSql(sql, ETD_END, " EFFECTIVEDATE<='" + ETD_END);
}
var CTNTYPE = Ext.getCmp('search_ctntype').getValue();
sql = sql + getAndConSql(sql, CTNTYPE, " isnull(" + CTNTYPE + "2,0)>0 ");
// ((endTime < begin) OR (startTime > end))
return sql;
},
//#endregion
//#region 上传pdf
UploadPDF: function () {
if (this.opStatus != 'edit') {
Ext.Msg.show({
title: '提示',
msg: '请先保存',
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
}
_this = this;
URLINFO = { KeyValue: this.Editdata.BSNO, INDATABASE: "false" };
UpLoadFile(URLINFO, this.UpLoadFileType, _this.rewrite, _this);
},
rewrite: function () {
Bodycondition = "BSNO='" + this.Editdata.get('BSNO') + "'";
this.LoadData(this.opStatus, this.Editdata.BSNO, Bodycondition);
},
//#endregion
DoSetGridTip: function () {
this.SetGridTip(this.storeBody,"GID", "CTN00", "CTN0PRICESTR");
this.SetGridTip(this.storeBody,"GID", "CTN10", "CTN1PRICESTR");
this.SetGridTip(this.storeBody,"GID", "CTN20", "CTN2PRICESTR");
this.SetGridTip(this.storeBody,"GID", "CTN30", "CTN3PRICESTR");
this.SetGridTip(this.storeBody, "GID", "CTN40", "CTN4PRICESTR");
}
,
DoSetGridTip_Add: function () {
this.SetGridTip(this.storeBody_Add, "GID", "CTN00", "CTN0PRICESTR");
this.SetGridTip(this.storeBody_Add, "GID", "CTN10", "CTN1PRICESTR");
this.SetGridTip(this.storeBody_Add, "GID", "CTN20", "CTN2PRICESTR");
this.SetGridTip(this.storeBody_Add, "GID", "CTN30", "CTN3PRICESTR");
this.SetGridTip(this.storeBody_Add, "GID", "CTN40", "CTN4PRICESTR");
}
,
SetGridTip: function (store,keyfield, idname, columnname) {
store.each(function (record) {
_id = idname + record.get(keyfield);
_html = _this.truntohtml(record.get(columnname));
Ext.create('Ext.tip.ToolTip', {
target: _id,
html: _html,
title: '',
//autoHide: false,
dismissDelay: 4000
//closable: true,
//draggable: true //可以允许被拖动
});
});
},
truntohtml: function (str) {
if (isNullorEmpty(str)) return '';
var arr = str.split(';');
var result = "";
if (arr.length > 0)
for (_i = 0; _i < arr.length; _i++) {
if (!isNullorEmpty(arr[_i]))
result += arr[_i] + '<br />';
}
return result;
},
//#region 添加删除杂费列表的杂费
AddZaFei: function () {
if (this.opStatus == "add") {
Ext.Msg.show({
title: '错误',
msg: '请先保存业务',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
return;
}
var linenum = this.storeZaFeiList.getCount() + 1;
var record = Ext.create('MsPrice_Quotation_ZaFeiListmb', {
'ID': '',
'BSNO': '',
'SEQUENCE': linenum,
'FEENAME': '',
'CURRENCY': 'RMB',
'AMOUNT': 0,
'NEEDHIDE': 'false',
'NEEDSHOW': 'true'
});
this.storeZaFeiList.add(record);
},
DelZaFei: function () {
if (this.opStatus == "add") {
Ext.Msg.show({
title: '错误',
msg: '请先保存业务',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
return;
}
var selectedRecords = this.gridZaFeiList.selModel.getSelection();
if (selectedRecords.length == 0) return;
Ext.MessageBox.confirm('提示', '确定删除记录吗?', function (btn) {
if (btn == 'yes') {
var GIDList = "";
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (!isNullorEmpty(rec.data.ID)) {
if (GIDList != "") {
GIDList += ",";
}
GIDList += "" + rec.data.ID + "";
}
this.storeZaFeiList.remove(rec);
}
if (GIDList == "") {
//this.storeZaFeiList.load("BSNO='" + this.editRecord.get('BSNO') + "'");
return;
}
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/MvcShipping/MsPrice/DelZaFeiDetail',
scope: this,
params: {
data: Ext.JSON.encode(this.Editdata),
GID: GIDList
},
callback: function (options, success, response) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.loadBody(" BSNO='" + this.editRecord.get('BSNO').toString().trim() + "'");
} else {
Ext.Msg.show({
title: '请重试',
msg: jsonresult.Message,
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
}
});
}
}, this);
},
//从枚举类型30002当中查找所有内容并写入storeZaFeiList
LoadZaFeiDefault: function () {
_this = this;
this.storeZaFeiModel.load({
params: { enumTypeId: 30002 }
, callback: function (options, success, response) {
var jsonArray = [];
_this.storeZaFeiModel.each(function (record) {
_this.InsertZaFei(record);
});
}
});
},
InsertZaFei: function (rec) {
var linenum = this.storeZaFeiList.getCount() + 1;
if (isNullorEmpty(rec.data.EnumValueName)) return;
ss = rec.data.EnumValueName_2.split(",");
var record = Ext.create('MsPrice_Quotation_ZaFeiListmb', {
'ID': '',
'BSNO': '',
'SEQUENCE': linenum,
'FEENAME': rec.data.EnumValueName,
'CURRENCY': ss[0],
'UNIT': ss[1],
'AMOUNT': -1,
'NEEDHIDE': 'false',
'NEEDSHOW': 'true'
});
this.storeZaFeiList.add(record);
this.storeZaFeiList.each(function (newrec) {
if (newrec.data.AMOUNT == -1) {
newrec.set("AMOUNT", rec.data.VerNo);
}
});
},
ZaFeiAfterEdit: function (editor, e, eOpts) {
if (e.value == e.originalValue) { return; }
if (e.field == 'NEEDHIDE') {
if (e.value==true)
e.record.set('NEEDSHOW', false);
if (e.value == false)
e.record.set('NEEDSHOW', true);
}
if (e.field == 'NEEDSHOW') {
if (e.value == true)
e.record.set('NEEDHIDE', false);
if (e.value == false)
e.record.set('NEEDHIDE', true);
}
},
//#endregion
//#region 打印
Print: function () {
var basicForm = this.formHead.getForm();
var BSNO = basicForm.findField('BSNO').value;
if (BSNO == '*' || BSNO == '') {
Ext.Msg.show({ title: '错误', msg: '单据还没有保存,请保存后再打印', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
var printType = 'Op_Price_Quotation';
var sql1 = "";
var sql2 = "";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
ctninfo = [];
for (var i = 0; i < this.storeBody.getCount(); i += 1) {
var recdata = this.storeBody.getAt(i).data;
if (recdata.CTN02 > 0 && this.ArrayHaveNot(ctninfo, 'CTN02'))
ctninfo.push('CTN02');
if (recdata.CTN12 > 0 && this.ArrayHaveNot(ctninfo, 'CTN12'))
ctninfo.push('CTN12');
if (recdata.CTN22 > 0 && this.ArrayHaveNot(ctninfo, 'CTN22'))
ctninfo.push('CTN22');
if (recdata.CTN32 > 0 && this.ArrayHaveNot(ctninfo, 'CTN32'))
ctninfo.push('CTN32');
if (recdata.CTN42 > 0 && this.ArrayHaveNot(ctninfo, 'CTN42'))
ctninfo.push('CTN42');
}
if (ctninfo.length == 0) {
Ext.Msg.show({
title: '提示',
msg: "第一行报价中至少要有一项不是0的报价",
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
}
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/MvcShipping/MsPrice/GetQuotationPrintSql_Fen',
params: {
printname: printType,
BSNOList: "'" + BSNO + "'",
ctntype: ctninfo
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title: '提示',
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
}
//this.Editdata = result.data;
//this.LoadInit(data);
sql1 = result.Data.sql1;
sql2 ='select * from(' +result.Data.sql2 + ')t order by PODLOAD,PORTDISCHARGE,报价类型';
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}
, ArrayHaveNot(ctninfo, ctntypestr) {
_i = ctninfo.indexOf(ctntypestr);
if (_i >= 0) { return false; }
else { return true;}
}
//#endregion
});