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.

1226 lines
44 KiB
JavaScript

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden 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.MsOpSubSeaeArrivalEdit = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsOpSubSeaeArrivalEdit.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsOpSubSeaeArrivalEdit, Ext.Panel, {
ParentWin: null,
OpStatus: 'add',
StoreList: null,
EditRecord: null,
Editdata: null,
isAudit: null,
accdate: null,
seaeop: "",
seaecustservice: "",
reason: "",
BillType: null,
OrType: null,
initUIComponents: function () {
this.serialNo = 0;
//this.bodyDel = [];
this.itemindex = 1;
//键值维护表_装运方式
//#endregion
//#region 编辑formHead 基本信息
this.formHead = Ext.widget('form', {
region: 'north',
frame: true,
bodyPadding: 5,
collapsed: false,
collapsible: true,
trackResetOnLoad: true,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 90,
msgTarget: 'qtip'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: 'BSNO',
name: 'BSNO', hidden: true
}, {
fieldLabel: 'ORSTATUS',
name: 'ORSTATUS', hidden: true
}, {
fieldLabel: 'BILLTYPE',
name: 'BILLTYPE', hidden: true, value: 2
}, {
fieldLabel: 'MBLNO',
name: 'MBLNO'
}, {
fieldLabel: 'ORDNO',
readOnly: true,
name: 'ORDNO'
}, {
fieldLabel: 'STATUS',
readOnly: true,
name: 'ORSTATUSREF'
}, {
fieldLabel: 'INPUTBY',
readOnly: true,
name: 'INPUTBY'
}, this.comboxAgent, {
xtype: 'checkboxfield',
boxLabel: 'SPECIAL CHARGE',
name: 'SPCHARGE',
inputValue: true,
checked: true
}]
}
]//end items(fieldset 1)
}); //end this.formEdit
//#endregion
this.StoreUnit = Ext.create('Ext.data.Store', {
fields: ['UNIT']
});
this.StoreUnit.add({ "UNIT": "20FT" });
this.StoreUnit.add({ "UNIT": "40FT" });
this.StoreUnit.add({ "UNIT": "D/O" });
this.StoreUnit.add({ "UNIT": "B/L" });
this.comboxUnit = Ext.create('DsExt.ux.RefTableCombox', {
store: this.StoreUnit,
name: 'Unit',
valueField: 'UNIT',
displayField: 'UNIT'
});
this.StoreFee = Ext.create('Ext.data.Store', {
fields: ['UNIT']
});
this.StoreFee.add({ "UNIT": "CY CHARGE" });
this.StoreFee.add({ "UNIT": "YAS/FAF" });
this.StoreFee.add({ "UNIT": "EBS" });
this.StoreFee.add({ "UNIT": "D/O FEE" });
this.StoreFee.add({ "UNIT": "M.DOC FEE" });
this.StoreFee.add({ "UNIT": "O/F & PSS" });
this.StoreFee.add({ "UNIT": "AFR" });
this.comboxFee = Ext.create('DsExt.ux.RefTableCombox', {
store: this.StoreFee,
name: 'FeeName',
valueField: 'UNIT',
displayField: 'UNIT'
});
this.StoreCurr = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsFeeCurr',
proxy: { url: '/MvcShipping/MsChFee/GetFeeCurrList' }
});
this.StoreCurr.load({ params: { condition: ""} });
this.comboxCurr = Ext.create('DsExt.ux.RefTableCombox', {
store: this.StoreCurr,
forceSelection: true,
name: 'Currency',
valueField: 'CURR',
displayField: 'CURR'
});
//this.storeDrChFee = Ext.create('Ext.data.Store', {
// model: 'MsArrivalFee',
// remoteSort: false,
// proxy: {
// type: 'ajax',
// url: '/MvcShipping/MsOpSubSeaOrder/GetArrivalFeeList',
// reader: {
// id: 'GId',
// root: 'data',
// totalProperty: 'totalCount'
// }
// }
//});
//this.cellEditingDrChFee = Ext.create('Ext.grid.plugin.CellEditing', {
// clicksToEdit: 1
//});
//_this = this;
//this.gridDrChFee = new Ext.grid.GridPanel({
// store: this.storeDrChFee,
// enableHdMenu: false,
// region: "center",
// loadMask: { msg: "Data is LoadingWaiting..." },
// trackMouseOver: true,
// disableSelection: false,
// plugins: [this.cellEditingDrChFee],
// selType: 'cellmodel',
// tbar: [{
// text: 'ADD',
// id: "btnaddfeedetail",
// iconCls: "btnadddetail",
// handler: function (button, event) {
// this.onAddFeeDetailClick(button, event);
// },
// scope: this
// }, '-', {
// text: 'DELETE',
// id: "btndelfeedetail",
// iconCls: "btndeletedetail",
// handler: function (button, event) {
// this.deleteFeeDetail(button, event);
// },
// scope: this
// }],
// columns: [{
// sortable: true,
// dataIndex: 'FEEID',
// header: 'FEEID',
// hidden: true,
// width: 160
// }, {
// sortable: true,
// dataIndex: 'ORDNO',
// header: 'ORDNO',
// hidden: true,
// width: 200
// }, {
// sortable: true,
// dataIndex: 'FeeName',
// header: 'Freight and Charges',
// editor: this.comboxFee,
// width: 250
// }, {
// sortable: true,
// dataIndex: 'Quantity',
// header: 'Volume',
// editor: {
// xtype: 'numberfield',
// keyNavEnabled: false,
// allowDecimals: true,
// decimalPrecision: 3,
// selectOnFocus: true,
// hideTrigger: true,
// mouseWheelEnabled: false,
// enableKeyEvents: true,
// listeners: {
// keydown: function (textfield, e) {
// if (e.getKey() == 40) {
// _this.onNextKeyClick(1, 4)
// }
// }
// }
// },
// width: 120
// }, {
// sortable: true,
// dataIndex: 'Currency',
// header: 'Currency',
// editor: this.comboxCurr,
// width: 140
// }, {
// sortable: true,
// dataIndex: 'EXCHANGERATE',
// header: 'Ex.Rate',
// editor: {
// xtype: 'numberfield',
// keyNavEnabled: false,
// selectOnFocus: true,
// hideTrigger: true,
// mouseWheelEnabled: false,
// enableKeyEvents: true,
// listeners: {
// keydown: function (textfield, e) {
// if (e.getKey() == 40) {
// _this.onNextKeyClick(1, 3)
// }
// }
// }
// },
// renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>'; } } else { return value; } } catch (e) { return value; } return value; },
// align: 'right',
// width: 80
// }, {
// sortable: true,
// dataIndex: 'UnitPrice',
// header: 'UnitPrice',
// editor: {
// xtype: 'numberfield',
// keyNavEnabled: false,
// selectOnFocus: true,
// hideTrigger: true,
// mouseWheelEnabled: false,
// enableKeyEvents: true,
// listeners: {
// keydown: function (textfield, e) {
// if (e.getKey() == 40) {
// _this.onNextKeyClick(1, 3)
// }
// }
// }
// },
// 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: 160
// }, {
// sortable: true,
// dataIndex: 'Unit',
// header: 'Unit',
// editor: this.comboxUnit,
// width: 140
// }, {
// sortable: true,
// dataIndex: 'AmountUsd',
// header: 'Amount($)',
// editor: {
// xtype: 'numberfield',
// keyNavEnabled: false,
// selectOnFocus: true,
// hideTrigger: true,
// mouseWheelEnabled: false,
// enableKeyEvents: true
// },
// 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: 180
// }, {
// sortable: true,
// dataIndex: 'AmountJpy',
// header: 'Amount(¥)',
// editor: {
// xtype: 'numberfield',
// keyNavEnabled: false,
// selectOnFocus: true,
// hideTrigger: true,
// mouseWheelEnabled: false,
// enableKeyEvents: true,
// listeners: {
// keydown: function (textfield, e) {
// if (e.getKey() == 40) {
// _this.onNextKeyClick(1, 5)
// }
// }
// }
// },
// 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: 180
// }
// ]
//});
//this.gridDrChFee.on('edit', function (editor, e, eOpts) {
// this.gridListChFeeAfterEdit(editor, e, eOpts);
//}, this);
this.StoreOfficeAddr = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsSubSeaOrderYard',
proxy: { url: '/MvcShipping/MsOpSubSeaOrder/GetArrivalYardList' }
});
this.StoreOfficeAddr.load({ params: { condition: ""} });
// this.StoreOfficeAddr = Ext.create('Ext.data.Store', {
// fields: ['UNIT', 'VALUES']
// });
// this.StoreOfficeAddr.add({ "UNIT": "本牧BC-1山九", "VALUES": "本牧BC-1山九\nTEL:045-623-1924" });
// this.StoreOfficeAddr.add({ "UNIT": "青海 A-1 山九", "VALUES": "青海 A-1 山九\nTEL:03-3529-3915" });
// this.StoreOfficeAddr.add({ "UNIT": "夢洲C10-12 住友倉庫(4ED71)", "VALUES": "夢洲C10-12 住友倉庫(4ED71)\nTEL:06-6612-1324" });
// this.StoreOfficeAddr.add({ "UNIT": "本牧 D-4 APL", "VALUES": "本牧 D-4 APL\nTEL:045-625-4321" });
// this.StoreOfficeAddr.add({ "UNIT": "青海 A-2 住友倉庫", "VALUES": "青海 A-2 住友倉庫\nTEL:03-3528-0850" });
// this.StoreOfficeAddr.add({ "UNIT": "苫小牧国際コンテナターミナル", "VALUES": "苫小牧国際コンテナターミナル\nTEL:0145-26-8333" });
this.comboxOfficeAddr = Ext.create('DsExt.ux.RefTableCombox', {
store: this.StoreOfficeAddr,
name: 'OFFICEADDRID',
fieldLabel: '搬入場所',
valueField: 'YARDCODE',
displayField: 'YARDCODE',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var selectrecords = DsStoreQueryBy(this.StoreOfficeAddr, 'YARDCODE', combo.value);
if (selectrecords.getCount() > 0) {
var selectdata = selectrecords.getAt(0).data;
this.formEdit.getForm().findField('OFFICEADDR').setValue(selectdata.DESCRIP);
} else {
this.formEdit.getForm().findField('OFFICEADDR').setValue('');
}
}
}
}
});
this.StoreDOAddr = Ext.create('Ext.data.Store', {
fields: ['UNIT', 'VALUES']
});
this.StoreDOAddr.add({ "UNIT": "D/O LESS", "VALUES": "D/O LESS\n返信用書類はございません。NACCSにて御確認下さい。" });
this.StoreDOAddr.add({ "UNIT": "D/O ID NO.", "VALUES": "D/O ID NO.をお伝えします。" });
this.comboxDOAddr = Ext.create('DsExt.ux.RefTableCombox', {
store: this.StoreDOAddr,
name: 'DOADDRID',
fieldLabel: 'D/O発行場所',
region: 'west',
width: 260,
valueField: 'UNIT',
displayField: 'UNIT',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var selectrecords = DsStoreQueryBy(this.StoreDOAddr, 'UNIT', combo.value);
if (selectrecords.getCount() > 0) {
var selectdata = selectrecords.getAt(0).data;
this.formEdit.getForm().findField('DOADDR').setValue(selectdata.VALUES);
} else {
this.formEdit.getForm().findField('DOADDR').setValue('');
}
}
}
}
});
this.StoreISSUETYPE = Ext.create('Ext.data.Store', {
fields: ['UNIT', 'VALUES']
});
this.StoreISSUETYPE.add({ "UNIT": "SURRENDER", "VALUES": "电放" });
this.StoreISSUETYPE.add({ "UNIT": "ORIGINAL", "VALUES": "正本" });
this.comboxISSUETYPE = Ext.create('DsExt.ux.RefTableCombox', {
store: this.StoreISSUETYPE,
name: 'ISSUETYPE',
fieldLabel: 'ISSUE TYPE',
valueField: 'VALUES',
displayField: 'UNIT'
});
this.panelfee = new Ext.Panel({
title: 'Charge Information',
layout: "border",
region: 'center',
height: 280,
animate: true,
// autoScroll: true,
// containerScroll: true,
frame: false,
items: [this.gridDrChFee]
});
//#region 编辑formEdit 基本信息
this.formEdit = Ext.widget('form', {
region: 'north',
frame: true,
bodyPadding: 5,
layout: 'anchor',
trackResetOnLoad: true,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 90,
msgTarget: 'qtip'
},
items: [{
xtype: 'fieldset',
defaultType: 'textfield',
layout: 'hbox',
defaults: {
anchor: '96%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: 'GID',
name: 'GID', hidden: true
}, {
fieldLabel: 'ORDNO',
readOnly: true,
hidden: true,
name: 'ORDNO'
}, {
fieldLabel: 'INPUTBY',
readOnly: true,
hidden: true,
name: 'INPUTBY'
}]
}, {
xtype: 'container',
layout: 'anchor',
flex: 1,
defaultType: 'textfield',
items: [{
xtype: 'label',
html: '<html>Messrs </html>'
}, {
xtype: 'textareafield',
grow: true,
labelWidth: 0,
height: 90,
name: 'MESSRS',
anchor: '100%'
}, {
fieldLabel: 'Ref No.',
readOnly: true,
flex: 1,
name: 'REFNO'
}
]
}, {
xtype: 'container',
layout: 'anchor',
flex: 1,
defaultType: 'textfield',
items: [{
xtype: 'label',
html: "<html><a><font size='8' color='blue'>&nbsp&nbspARRIVAL NOTICE </font></a></html>"
}
]
}
]
}, {
xtype: 'container',
layout: 'anchor',
flex: 1,
defaultType: 'textfield',
defaults: {
anchor: '99%'
},
items: [{
xtype: 'container',
defaultType: 'textfield',
layout: 'hbox',
items: [{
fieldLabel: 'Place of Receipt',
name: 'PLACERECEIPT'
}, {
fieldLabel: 'Vessel',
flex: 1,
name: 'VESSEL'
}, {
fieldLabel: 'VoyNo',
flex: 1,
name: 'VOYNO'
}, {
fieldLabel: 'HB/L No.',
flex: 1,
name: 'HBLNO'
}]
}, {
xtype: 'container',
defaultType: 'textfield',
layout: 'hbox',
items: [{
fieldLabel: 'Via',
name: 'VIA'
}, {
fieldLabel: '2nd Vessel',
flex: 1,
name: 'N2VESSEL'
}, {
fieldLabel: 'VoyNo',
flex: 1,
name: 'N2VOYNO'
}, {
fieldLabel: 'MB/L No.',
flex: 1,
name: 'MBLNO'
}]
}, {
xtype: 'container',
defaultType: 'textfield',
layout: 'hbox',
items: [{
fieldLabel: 'Port of Loading',
name: 'PORTLOAD'
}, {
fieldLabel: 'Port of Discharge',
name: 'PORTDISCHARGE'
}, {
fieldLabel: 'ETA',
format: 'Y-m-d',
flex: 1,
xtype: 'datefield',
name: 'ETA'
}, {
fieldLabel: 'Free Time',
format: 'Y-m-d',
flex: 1,
xtype: 'datefield',
name: 'FREETIME'
}]
}, {
xtype: 'container',
defaultType: 'textfield',
layout: 'hbox',
items: [{
xtype: 'container',
layout: 'anchor',
flex: 1,
defaultType: 'textfield',
items: [{
xtype: 'textareafield',
fieldLabel: 'Place of Delivery',
grow: true,
height: 70,
name: 'PLACEDELIVERY',
anchor: '100%'
}
]
}, {
xtype: 'container',
layout: 'anchor',
flex: 1,
defaultType: 'textfield',
items: [
this.comboxOfficeAddr,
{
xtype: 'textareafield',
fieldLabel: '&nbsp&nbsp',
grow: true,
height: 50,
name: 'OFFICEADDR',
anchor: '100%'
}
]
}, {
xtype: 'container',
layout: 'anchor',
flex: 2,
defaultType: 'textfield',
items: [{
xtype: 'label',
html: "<html><a><font size='2' color='blue'>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp※入港日は荒天・港閉鎖等による船の遅れの影響で変更になる場合がございますので予めご了承下さい。</font></a></html>"
},
{
xtype: 'label',
html: "<html><a><font size='2' color='blue'><br>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp※Free Timeは直接ヤードにお問合せ下さい</font></a></html>"
}
]
}]
}, {
xtype: 'container',
defaultType: 'textfield',
layout: 'hbox',
items: [{
xtype: 'container',
layout: 'anchor',
flex: 1,
defaultType: 'textfield',
items: [this.comboxDOAddr, {
xtype: 'textareafield',
fieldLabel: ' ',
region: 'center',
grow: true,
height: 60,
name: 'DOADDR',
anchor: '100%'
}
]
}, {
xtype: 'container',
layout: 'anchor',
flex: 1,
defaultType: 'textfield',
items: [{
xtype: 'label',
html: "<html><a><font size='3' color='blue'>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspリリース先を明記の上、振込明細とアライバルを</font></a></html>"
},
{
xtype: 'label',
html: "<html><a><font size='3' color='blue'><br>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspFAX願います。FAX No.078-367-8329</font></a></html>"
}, this.comboxISSUETYPE
]
}]
}, {
xtype: 'container',
defaultType: 'textfield',
layout: 'hbox',
items: [{
xtype: 'container',
layout: 'anchor',
flex: 2,
defaultType: 'textfield',
items: [{
xtype: 'label',
html: '<html>Container No.Marks & Numbers </html>'
}, {
xtype: 'textareafield',
grow: true,
height: 180,
name: 'MARKS',
anchor: '100%'
}
]
}, {
xtype: 'container',
layout: 'anchor',
flex: 3,
defaultType: 'textfield',
items: [{
xtype: 'label',
html: '<html>&nbsp&nbsp&nbsp&nbsp&nbspQuantity&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspDescription of Goods</html>'
}, {
xtype: 'textareafield',
grow: true,
fieldLabel: '&nbsp&nbsp',
labelSeparator: '',
labelWidth: 20,
height: 180,
name: 'DESCRIPTION',
anchor: '100%'
}]
}, {
xtype: 'container',
layout: 'anchor',
flex: 1,
defaultType: 'textfield',
items: [{
xtype: 'label',
html: '<html>&nbsp&nbsp&nbsp&nbsp&nbspGross Weight</html>'
}, {
labelWidth: 50,
name: 'KGS'
}
]
}, {
xtype: 'container',
layout: 'anchor',
flex: 1,
defaultType: 'textfield',
items: [{
xtype: 'label',
html: '<html>&nbsp&nbsp&nbsp&nbsp&nbspMeasurement</html>'
}, {
labelWidth: 50,
name: 'CBM'
}
]
}
]
}]
}
]
}); //end this.formEdit
//#endregion
//#region 按钮Toolbar
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [{
text: "Print",
iconCls: 'btnprint',
handler: function (button, event) {
this.Print();
},
scope: this
}, '-', {
id: 'btnESave',
text: "Save",
iconCls: "btnsave",
handler: function (button, event) {
this.Save('0');
},
scope: this
}, '-', {
text: "Close",
iconCls: "btnlogout",
handler: function (button, event) {
window.close();
},
scope: this
}]
}); //end 按钮Toolbar
//#endregion
//#region 框架结构
this.panelpage = new Ext.Panel({
title: 'information',
layout: "border",
region: 'center',
animate: true,
autoScroll: true,
// containerScroll: true,
frame: false,
items: [this.formEdit]
});
this.panelFee = new Shipping.FeeEditGrid({
region: 'center',
layout: 'border'
});
this.panelFee.stroplb = 'op_other';
this.panelFee.StoreCustType.add({ "SCUSTTYPE": "WTDW-委托单位", "CUSTTYPE": "委托单位", "CUSTNAME": "" });
this.panelFee.StoreCustType.add({ "SCUSTTYPE": "BGH-报关行", "CUSTTYPE": "报关行", "CUSTNAME": "" });
this.panelFee.StoreCustType.add({ "SCUSTTYPE": "HG-海关", "CUSTTYPE": "海关", "CUSTNAME": "" });
this.panelFee.StoreCustType.add({ "SCUSTTYPE": "DCDL-订舱代理", "CUSTTYPE": "订舱代理", "CUSTNAME": "" });
this.panelFee.StoreDrOpRange.load({ params: { optype: "modOtherRecvFeeManagement" } });
this.panelFee.StoreCrOpRange.load({ params: { optype: "modOtherPayFeeManagement" } });
this.panelFee.storeFeeNameRef.load({ params: { condition: "" } });
this.panelFee.storeBodyList_GuDingFeeWeiHu.load();
this.panelfee = new Ext.Panel({
title: 'Charge Information',
layout: "border",
region: 'center',
animate: true,
autoScroll: true,
// containerScroll: true,
frame: false,
items: [this.panelFee]
});
this.tabSeaepanel = new Ext.TabPanel({
activeTab: 0,
autoWidth: true,
border: true,
frame: false,
region: 'center',
id: "TabSeaePanel",
enableTabScroll: true,
items:
[
this.panelpage,
this.panelfee
]
});
this.panelSeae = new Ext.Panel({
id: 'pnlmodSeaeOrderArrivalInfo',
layout: "border",
region: 'center',
animate: true,
autoScroll: true,
frame: false,
//closable:true,
items: [this.panelBtn, this.tabSeaepanel]
});
Ext.apply(this, {
items: [this.panelSeae]
});
//#endregion
//#region 其他
parentWin = window.parent.opener;
this.InitData();
//#endregion
}, //end initUIComponents
//#region 加载事件
InitData: function () {
this.opStatus = 'edit';
var condition = '';
_this = this;
if (parentWin) {
var ret = parentWin.OprationSwap();
this.StoreList = ret[1];
this.editRecord = ret[2];
this.isAudit = ret[3];
this.BillType = ret[4];
this.OrType = ret[5];
}
if (this.opStatus == 'edit') {
condition = "ORDNO='" + this.editRecord.get('ORDNO') + "'";
}
this.LoadData(this.opStatus, condition, this.editRecord.get('ORDNO'));
}, //end InitData
LoadData: function (opstatus, condition, ordno) {
this.serialNo = 0;
//this.bodyDel = [];
this.opStatus = opstatus;
Ext.Ajax.request({
waitMsg: 'Is Loading...',
url: '/MvcShipping/MsOpSubSeaOrder/GetArrivalData',
params: {
handle: opstatus,
condition: condition,
ordno: ordno
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title: 'Prompt',
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
}
data = result.data;
this.formEdit.getForm().reset();
this.formEdit.getForm().setValues(data);
this.GetEditStatus();
} else {
Ext.MessageBox.alert('The Server Response Error, Please Try Again', response.responseText);
}
},
scope: this
});
this.panelFee.EditRecord = this.editRecord;
this.panelFee.strBSNO = this.editRecord.get("ORDNO");
this.panelFee.storeDrChFee.load({ params: { billno: this.panelFee.strBSNO, type: 1, optype: "op_other" } });
this.panelFee.storeCrChFee.load({ params: { billno: this.panelFee.strBSNO, type: 2, optype: "op_other" } });
}, // end LoadDate
//#endregion
//#region 保存
Save: function (type) {
var basicForm = this.formEdit.getForm();
if (!basicForm.isValid()) {
return;
}
var eta = this.formEdit.getForm().findField('ETA').getValue();
if (eta == "" || eta == NaN || eta == null) {
Ext.Msg.show({ title: 'Warning', msg: "ETA Can't Empty", icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
var feedatas = [];
//for (var i = 0; i < this.storeDrChFee.getCount(); i += 1) {
// var member = this.storeDrChFee.getAt(i);
// feedatas.push(member);
//}
//
var jsonfee = ConvertRecordsToJsonAll(feedatas);
this.formEdit.getForm().findField('ORDNO').setDisabled(false);
var data = this.formEdit.getForm().getValues(false, false, false);
this.formEdit.getForm().findField('ORDNO').setDisabled(true);
//
Ext.Msg.wait('Saveing, Please Wait..');
Ext.Ajax.request({
waitMsg: 'Saveing...',
url: '/MvcShipping/MsOpSubSeaOrder/SaveArrival',
scope: this,
params: {
opstatus: this.opStatus,
data: Ext.JSON.encode(data),
fee: jsonfee
},
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.formEdit.getForm().reset();
this.formEdit.getForm().setValues(returnData);
//
if (this.opStatus == 'add') {
var arrNewRecords = this.StoreList.add(returnData);
this.editRecord = arrNewRecords[0];
}
else if (this.opStatus == 'edit') {
var editp = Ext.create('MsSubSeaArrivalModel', returnData);
this.editRecord.fields.each(function (field) {
if (field.persist) {
name = field.name;
if (name != 'id')
this.editRecord.set(name, editp.get(name));
}
}, this);
this.editRecord.commit();
}
if (type == '0') {
this.opStatus = 'edit';
//for (var j = 0; j < this.storeDrChFee.getCount(); j += 1) {
// var memberbody = this.storeDrChFee.getAt(j);
// memberbody.set("ORDNO", this.editRecord.get('ORDNO'));
// memberbody.commit();
//};
} else if (type == '1') {
window.close();
}
this.panelFee.EditRecord = this.editRecord;
this.panelFee.strBSNO = this.editRecord.get("ORDNO");
this.panelFee.storeDrChFee.load({ params: { billno: this.panelFee.strBSNO, type: 1, optype: "op_other" } });
this.panelFee.storeCrChFee.load({ params: { billno: this.panelFee.strBSNO, type: 2, optype: "op_other" } });
} else {
Ext.Msg.show({ title: 'Error', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
} else {
Ext.Msg.show({ title: 'Please Try Again',
msg: 'The Server Response Error',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
}
});
}, //end save
//#endregion
//#region 集装箱按钮事件
gridListChFeeAfterEdit: function (editor, e, eOpts) {
if (e.value == e.originalValue) return;
if (e.field == 'UnitPrice' || e.field == 'Quantity' || e.field == 'Currency') {
var unitPrice = e.record.data['UnitPrice'];
var quantity = e.record.data['Quantity'];
var amount = (parseFloat(unitPrice).mul(quantity)).toFixed(2);
var curr = e.record.data['Currency'];
if (curr == 'USD') {
e.record.set('AmountUsd', amount)
e.record.set('AmountJpy', 0)
}
else {
e.record.set('AmountUsd', 0)
e.record.set('AmountJpy', amount)
}
}
},
onNextKeyClick: function (type, col) {
var rows = this.gridDrChFee.getSelectionModel().getSelection();
var row = rows[rows.length - 1];
var s = this.gridDrChFee.getStore();
var number = s.indexOf(row) + 1;
if (number == this.gridDrChFee.getStore().getCount()) {
} else {
this.cellEditingDrChFee.startEditByPosition({ row: number, column: col });
}
},
//#endregion
onAddFeeDetailClick: function (button, event) {
var newSerialno = this.DsGetFeeNewNo(this.storeDrChFee);
var record = Ext.create('MsArrivalFee', {
FEEID: NewGuid(),
ORDNO: '*',
SORT: newSerialno,
FeeName: '',
Currency: '',
Reason: '',
UnitPrice: 0,
EXCHANGERATE: 1,
Quantity: 1,
AmountJpy: 0,
AmountUsd: 0,
Unit: ''
});
this.storeDrChFee.add(record);
var n = this.storeDrChFee.getCount();
this.cellEditingDrChFee.startEditByPosition({ row: n - 1, column: 2 });
}, //end onAddDetailClick
deleteFeeDetail: function (button, event) {
var selectedRecords = this.gridDrChFee.selModel.getSelection();
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (rec.data.ORDNO == "" || rec.data.ORDNO == "*")//如果是新增但没有保存的数据,没有必要提交到后台
{
this.storeDrChFee.remove(selectedRecords[i]);
}
else {
Ext.MessageBox.confirm('Prompt', 'Sure To Delete This Record', function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('is Deleting...');
Ext.Ajax.request({
waitMsg: 'is Deleting...',
url: '/MvcShipping/MsOpSubSeaOrder/DeleteArrivalFeeDetail',
params: {
data: Ext.JSON.encode(rec.data)
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.storeDrChFee.remove(rec);
Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
}
},
failure: function (response, options) {
Ext.Msg.show({ title: 'Warning', msg: 'The Server Response Error, Please Try Again', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
},
scope: this
}); //end Ext.Ajax.request
}
}, this);
}
//this.storeBodyList.remove(selectedRecords[i]);
}
},
DsGetFeeNewNo: function (store) {
var result = store.getCount();
if (result == 0) {
return 1;
}
var record = store.getAt(result - 1).data.SORT;
result = parseInt(record) + 1;
return result;
},
getToMonth: function () {
var now = new Date();
var year = now.getFullYear(); //年
var month = now.getMonth() + 1; //月
var clock = year + "-";
if (month < 10)
clock = clock + "0" + month;
else
clock = clock + month;
return (clock);
},
//#region 编辑时按钮等的状态
GetEditStatus: function () {
this.setSaveBtnStatus(true);
},
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;
},
setBtnStatus: function (enable) {
},
setSaveBtnStatus: function (enable) {
},
//#endregion
//#region 打印
Print: function () {
var basicForm = this.formEdit.getForm();
var billNo = this.editRecord.get('ORDNO');
if (billNo == '*' || billNo == '') {
Ext.Msg.show({ title: '错误', msg: '单据还没有保存,请保存后再打印', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
var printType = 'MSOPSUBSEAARRIVAL';
var sql1 = "SELECT * FROM op_sub_seaorder_arrival WHERE ORDNO='" + billNo + "'";
var sql2 = "SELECT * from op_sub_seaorder_arrivalfee WHERE ORDNO='" + billNo + "' ORDER BY SORT";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
}
//#endregion
});