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/MsOpAiri/FenBillList.js

1061 lines
36 KiB
JavaScript

3 years ago
Ext.namespace('Shipping');
Shipping.AiriFenBillList = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.AiriFenBillList.superclass.constructor.call(this);
};
Ext.extend(Shipping.AiriFenBillList, Ext.Panel, {
ParentWin: null,
OpStatus: 'add',
EditRecord: null,
StoreList: null,
region: 'north',
BsNo: '',
FenBsNo:'',
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
initUIComponents: function () {
this.formHead = Ext.widget('form', {
frame: true,
title: "主票信息",
region: 'center',
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 90,
msgTarget: 'qtip'
},
items: [
{
xtype: 'fieldset',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [
{ xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '业务编号',
name: 'BSNO', hidden: true
}, {
fieldLabel: '委托编号',
readOnly: true,
name: 'CUSTNO'
}, {
fieldLabel: '主提单号',
readOnly: true,
name: 'MBLNO'
}, {
fieldLabel: '委托单位',
readOnly: true,
name: 'CUSTOMERNAME'
},
{
fieldLabel: '计费重量',
readOnly: true,
name: 'FEEKGS'
}, {
fieldLabel: '付费方式',
readOnly: true,
name: 'BLFRT'
}
]
},
{ xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
{
fieldLabel: '航班',
readOnly: true,
name: 'VESSEL'
}, {
fieldLabel: '进口日期',
readOnly: true,
name: 'ETA'
}, {
fieldLabel: '装货港',
readOnly: true,
name: 'PORTLOAD'
}, {
fieldLabel: '卸货港',
readOnly: true,
name: 'PORTDISCHARGE'
}, {
fieldLabel: '航班公司',
readOnly: true,
name: 'CARRIER'
}
]
},
{ xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
{
fieldLabel: '件数',
readOnly: true,
name: 'PKGS'
}, {
fieldLabel: '包装',
readOnly: true,
name: 'KINGPKGS'
}, {
fieldLabel: '毛重',
readOnly: true,
name: 'KGS'
}, {
fieldLabel: '体积',
readOnly: true,
name: 'CBM'
}, {
fieldLabel: '国外代理',
readOnly: true,
name: 'AGENTID'
}
]
}
]
}]
}); //end this.formEdit
//#region 按钮Toolbar
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [{
id: 'btnEPrev',
text: "上一票",
// iconCls: "btnsave",
handler: function (button, event) {
this.PrevRecord();
},
scope: this
}, {
id: 'btnENext',
text: "下一票",
// iconCls: "btnsave",
handler: function (button, event) {
this.NextRecord();
},
scope: this
}, '-', {
text: "打印",
iconCls: "btnprint",
handler: function (button, event) {
this.Print();
},
scope: this
}]
}); //end 按钮Toolbar
//#endregion
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 160,
items: [this.panelBtn, this.formHead]
});
_thisfenlist = this;
this.StoreOpRange = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsOP',
proxy: { url: '/MvcShipping/MsBaseInfo/GetOpRang' }
});
this.StoreOpRange.load({ params: { optype: "modOpAiriList"} });
//#region 分票列表
this.storeBodyList = Ext.create('Ext.data.Store', {
model: 'MsOpAiriModel',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsOpAiri/GetFenList',
reader: {
id: 'BsNo',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.storeCustCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.comboxCustCode = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeCustCode,
forceSelection: true,
name: 'CUSTOMERNAME',
valueField: 'CustName',
displayField: 'CodeAndName'
});
this.storeOpCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserLinkRefList' }
});
this.comboxSALE = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeOpCode,
forceSelection: true,
name: 'SALE',
valueField: 'UserName',
displayField: 'CodeAndName'
});
this.storeFrt = Ext.create('Ext.data.Store', {
fields: ['FRT']
});
this.storeFrt.add({ "FRT": "PP" });
this.storeFrt.add({ "FRT": "CC" });
this.comboxBLFRT = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeFrt,
forceSelection: true,
valueField: 'FRT',
displayField: 'FRT'
});
this.storeCodePackage = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CodePackageModel',
proxy: { url: '/CommMng/BasicDataRef/GetCodePackageList' }
});
this.storeCodePackage.load();
this.comboxKINDPKGS = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeCodePackage,
name: 'KINDPKGS',
valueField: 'PKGS',
displayField: 'PKGS'
});
this.storeCodeDisport = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CodeDisportModel',
proxy: { url: '/CommMng/BasicDataRef/GetCodeDisportList' }
});
this.comboxDESTINATION = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeCodeDisport,
name: 'DESTINATION',
valueField: 'PORT',
displayField: 'PORT'
});
//明细表表格
this.gridListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
this.gridList = new Ext.grid.GridPanel({
store: this.storeBodyList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
plugins: [this.gridListCellEditing],
selModel: this.GridCheckBoxModel,
selType: 'cellmodel',
tbar: [{
text: '添加分票',
tooltip: '添加分票',
id: "btnadddetail",
iconCls: "btnadddetail",
handler: function (button, event) {
this.onAddDetailClick(button, event);
},
scope: this
}, '-', {
text: '保存分票',
tooltip: '保存分票',
iconCls: "btnsave",
handler: function (button, event) {
this.onPostDetailClick(button, event);
},
scope: this
}, '-', {
text: '删除分票',
tooltip: '删除分票',
id: "btndeldetail",
iconCls: "btndeletedetail",
handler: function (button, event) {
this.onDelDetailClick(button, event);
},
scope: this
}, '-', {
text: '委托信息',
tooltip: '委托信息',
handler: function (button, event) {
var selectedRecords = this.GridCheckBoxModel.selected.items;
if (selectedRecords.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择要编辑的分票!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var rec = selectedRecords[0];
this.SelectedRecord = rec;
this.OprationStatus = 'edit';
// DsOpenEditWin('/MvcShipping/MsOpSeae/FenEdit', "分票信息");
DsOpenEditWin('/MvcShipping/MsOpAiri/Edit', "分票信息");
},
scope: this
}, '-', {
text: '费用信息',
tooltip: '费用信息',
handler: function (button, event) {
_thisfenlist.onFenFeeEditClick(button, event);
},
scope: this
}, '-', {
text: '提单信息',
tooltip: '提单信息',
handler: function (button, event) {
// this.onPostDetailClick(button, event);
},
scope: this
}, '-', {
text: '业务函电',
tooltip: '业务函电',
handler: function (button, event) {
// this.onPostDetailClick(button, event);
},
scope: this
}],
columns: [{
sortable: true,
dataIndex: 'MASTERNO',
header: '主编号',
hidden: true,
width: 0
}, {
sortable: true,
dataIndex: 'BSNO',
header: '业务编号',
hidden: true,
width: 0
}, {
dataIndex: 'MBLNO',
header: '主提单号',
width: 130,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}, {
dataIndex: 'HBLNO',
header: '分提单号',
width: 130,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}, {
dataIndex: 'CUSTOMERNAME',
header: '委托单位',
width: 120,
editor: this.comboxCustCode
}, {
dataIndex: 'SALE',
header: '销售',
width: 70,
editor: this.comboxSALE
}, {
sortable: true,
dataIndex: 'PKGS',
header: '件数',
width: 80,
editor: {
xtype: 'numberfield',
allowBlank: false,
selectOnFocus: true
}
}, {
dataIndex: 'KINDPKGS',
header: '包装',
width: 100,
editor: this.comboxKINDPKGS
}, {
dataIndex: 'KGS',
header: '重量',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}, {
dataIndex: 'CBM',
header: '尺码',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}, {
dataIndex: 'FEEKGS',
header: '计费重量',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}, {
dataIndex: 'BLFRT',
header: '运费',
width: 60,
editor: this.comboxBLFRT
}, {
dataIndex: 'OTFRT',
header: '杂费',
width: 60,
editor: this.comboxBLFRT
}, {
dataIndex: 'GOODSNAME',
header: '品名',
width: 150,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}, {
dataIndex: 'REMARK',
header: '备注',
width: 150,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}, {
dataIndex: 'CUSTNO',
header: '委托编号',
width: 130
}]
});
//#endregion
//#region 合计列表
this.SumField = [
{ name: 'NOBILL', type: 'number' },
{ name: 'KGS', type: 'number' },
{ name: 'PKGS', type: 'number' },
{ name: 'CBM', type: 'number' }
];
this.storeSumList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
fields: this.SumField,
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsOpAiri/GetDataListSum',
reader: {
id: '',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.girdcolumsSum = [{
sortable: true,
dataIndex: 'NOBILL',
header: '票数',
align: 'right',
width: 60
}, {
sortable: true,
dataIndex: 'PKGS',
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: 80
}, {
sortable: true,
dataIndex: 'KGS',
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: 80
}, {
sortable: true,
dataIndex: 'CBM',
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: 60
}, {
sortable: true,
dataIndex: 'FEEKGS',
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: 60
}
];
this.gridListSum = new Ext.grid.GridPanel({
store: this.storeSumList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
columns: this.girdcolumsSum
});
//#endregion
this.panelBodysouth = new Ext.Panel({
layout: "border",
height: 90,
region: 'south',
//margin: '5 10',
frame: true,
items: [this.gridListSum]
});
this.gridList.on('edit', function (editor, e, eOpts) {
this.gridListAfterEdit(editor, e, eOpts);
}, this);
this.gridListCellEditing.on('beforeedit', function (editor, e) {
return this.cellEditingBeforeEdit(editor, e);
}, this);
this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
this.SelectedRecord = record;
this.OprationStatus = 'edit';
DsOpenEditWin('/MvcShipping/MsOpAiri/Edit', "分票信息");
}, this);
this.panelBody = new Ext.Panel({
title: '分票信息',
region: 'center',
layout: "border",
frame: true,
items: [this.gridList, this.panelBodysouth]
});
Ext.apply(this, {
items: [this.panelTop, this.panelBody]
});
this.storeBodyList.on('beforeload', function (store) {
var sql = " MASTERNO='" + this.EditRecord.get('BSNO') + "' AND BSNO<>MASTERNO";
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
parentWin = window.parent.opener;
this.InitData();
},
//#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];
}
this.BsNo = this.EditRecord.get('BSNO');
condition = " MASTERNO='" + this.EditRecord.get('BSNO') + "' AND BSNO<>MASTERNO";
this.LoadData();
this.storeCustCode.load({ params: { condition: "ISCONTROLLER='1'"} });
this.storeOpCode.load();
this.storeCodeDisport.load();
this.storeBodyList.load({ params: { condition: condition} });
this.storeSumList.load({ params: { condition: condition} });
}, //end InitData
LoadData: function () {
this.formHead.getForm().loadRecord(this.EditRecord);
}, // end LoadDate
PrevRecord: function () {
var j = this.StoreList.indexOf(this.EditRecord);
if (j == 0) {
Ext.Msg.show({ title: '警告', msg: '已是最前一票', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
if (j == this.StoreList.count) {
Ext.Msg.show({ title: '警告', msg: '已是最后一票', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
j = j - 1;
this.EditRecord = this.StoreList.getAt(j);
this.BsNo = this.EditRecord.get('BSNO');
this.LoadData();
},
NextRecord: function () {
var j = this.StoreList.indexOf(this.EditRecord);
if (j == (this.StoreList.count - 1)) {
Ext.Msg.show({ title: '警告', msg: '已是最后一票', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
j = j + 1;
this.EditRecord = this.StoreList.getAt(j);
this.BsNo = this.EditRecord.get('BSNO');
this.LoadData();
},
onNextKeyClick: function (col) {
var rows = this.gridList.getSelectionModel().getSelection();
var row = rows[rows.length - 1];
var s = this.gridList.getStore();
var number = s.indexOf(row) + 1;
if (number == this.gridList.getStore().getCount()) {
this.onAddDetailClick(s, event);
} else {
this.gridListCellEditing.startEditByPosition({ row: number, column: col });
}
},
onAddDetailClick: function (button, event) {
var allow = this.getAllowOperationDetail();
if (allow == false) {
return;
}
var store = null;
store = this.storeBodyList;
var myDate = new Date();
var mydatestr = Ext.util.Format.date(myDate, 'Y-m-d');
var record = null;
record = Ext.create('MsOpAiriModel', {
BSNO: NewGuid(),
ORDERTYPE: '操作录入',
MASTERNO: '*',
CUSTNO: '',
MBLNO: this.EditRecord.get('MBLNO'),
HBLNO: '',
BSSTATUS: false,
FEESTATUS: false,
BSSTATUSREF: '未锁定',
FEESTATUSREF: '未锁定',
ACCDATE: this.EditRecord.get('ACCDATE'),
BSDATE: mydatestr,
INPUTBY: SHOWNAME,
OP: SHOWNAME,
CUSTSERVICE: SHOWNAME,
VESSEL: this.EditRecord.get('VESSEL'),
ETD: this.EditRecord.get('ETD'),
PORTLOADID: this.EditRecord.get('PORTLOADID'),
PORTLOAD: this.EditRecord.get('PORTLOAD'),
PORTDISCHARGEID: this.EditRecord.get('PORTDISCHARGEID'),
PORTDISCHARGE: this.EditRecord.get('PORTDISCHARGE'),
BLTYPE: '空运分票',
AGENTID: this.EditRecord.get('AGENTID'),
AGENT: this.EditRecord.get('AGENT'),
ETA: this.EditRecord.get('ETA'),
BLFRT: 'PP',
OTFRT: 'PP',
FORWARDER: this.EditRecord.get('FORWARDER'),
AIRLINES: this.EditRecord.get('AIRLINES'),
KINGPKGS: 'CTNS',
CARGOID: 'S',
PKGS: 0,
KGS: 0,
CBM: 0,
FEEKGS: 0,
ISVOU: false
});
store.add(record);
var editColumnIndex = 0;
var cellediting = this.gridListCellEditing;
editColumnIndex = 3;
var n = store.getCount();
cellediting.startEditByPosition({ row: n - 1, column: editColumnIndex });
},
onPostDetailClick: function (button, event) {
var bodyDatas = [];
var i;
for (i = 0; i < this.storeBodyList.getCount(); i += 1) {
var memberyf = this.storeBodyList.getAt(i);
bodyDatas.push(memberyf);
};
var jsonBody = ConvertRecordsToJsonAll(bodyDatas);
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/MvcShipping/MsOpAiri/SaveFen',
scope: this,
params: {
bsno: _thisfenlist.BsNo,
fenbody: jsonBody
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
for (var i = 0; i < this.storeBodyList.getCount(); i += 1) {
var member = this.storeBodyList.getAt(i);
member.set("MASTERNO", _thisfenlist.BsNo);
member.commit();
}
} 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
onDelDetailClick: function (button, event) {
var allow = this.getAllowOperationDetail();
if (allow == false) {
return;
}
var feeGidSql = '';
var selectedRecords = [];
selectedRecords = this.GridCheckBoxModel.selected.items;
var candelete = this.CheckDelete(selectedRecords);
if (candelete == false)
return;
if (selectedRecords.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择要删除的分票!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var bodyDatas = [];
Ext.MessageBox.confirm('提示', '确定要删除选中的分票吗?', function (btn) {
if (btn == 'yes') {
if (selectedRecords.length > 0) {
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (rec.data.MASTERNO == "*") //如果是新增但没有保存的数据,没有必要提交到后台
{
this.storeBodyList.remove(selectedRecords[i]);
} else {
bodyDatas.push(rec);
var feeGId = "'" + rec.data.BSNO + "'";
if (feeGidSql == '') {
feeGidSql = feeGId;
} else {
feeGidSql = feeGidSql + "," + feeGId;
}
}
}
}
var jsonBody = ConvertRecordsToJsonAll(bodyDatas);
_thisfenlist = this;
Ext.Msg.wait('正在删除数据...');
if (feeGidSql != '') {
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/MvcShipping/MsOpAiri/DeleteFen',
params: {
bsno: _thisfenlist.BsNo,
fenbody: jsonBody
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.storeBodyList.load({ params: { condition: " MASTERNO='" + _thisfenlist.EditRecord.get('BSNO') + "' AND BSNO<>MASTERNO"} });
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: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
},
success: function (response, options) {
},
scope: this
}); //end Ext.Ajax.request
} else {
Ext.Msg.show({ title: '提示', msg: "删除成功!", icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
}
}, this);
},
getAllowOperationDetail: function () {
var BsStatus = this.EditRecord.get('BSSTATUS');
if (BsStatus == '0')
return true;
else {
Ext.Msg.show({ title: '错误', msg: "此票主票已业务锁定,不允许操作分票!", icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return false;
}
},
CheckDelete: function (records) {
for (var i = 0; i < records.length; i++) {
var rec = records[i];
var BsStatus = rec.data.BSSTATUS;
if (BsStatus == true) {
Ext.Msg.show({ title: '提示',
msg: '已业务锁定无法修改或删除!',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
return false;
}
if (BsStatus != true) {
var op = rec.data.OP;
var inputby = rec.data.INPUTBY;
var records = DsStoreQueryBy(_thisfenlist.StoreOpRange, 'OPID', op);
if (records.getCount() > 0) {
canedit = true;
} else {
var recordins = DsStoreQueryBy(_thisfenlist.StoreOpRange, 'OPID', inputby);
if (recordins.getCount() > 0) {
canedit = true;
} else {
Ext.Msg.show({ title: '提示', msg: '你没有权限删除或修改' + op + '录入的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return false;
}
}
if (canedit == false) {
Ext.Msg.show({ title: '提示', msg: '你没有权限删除或修改' + op + '录入的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return false;
}
}
}
},
cellEditingBeforeEdit: function (editor, e) {
var allow = this.getAllowOperationDetail();
if (allow == false) {
return;
}
var chfeefeeStatus = e.record.get('BSSTATUS');
var canedit = chfeefeeStatus != true;
if (canedit) {
var op = e.record.get('OP');
var inputby = e.record.get('INPUTBY');
var records = DsStoreQueryBy(_thisfenlist.StoreOpRange, 'OPID', op);
if (records.getCount() > 0) {
canedit = true;
} else {
var recordins = DsStoreQueryBy(_thisfenlist.StoreOpRange, 'OPID', inputby);
if (recordins.getCount() > 0) {
canedit = true;
} else {
Ext.Msg.show({ title: '提示', msg: '你没有权限删除或修改' + op + '录入的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
canedit = false;
}
}
}
return canedit;
},
gridListAfterEdit: function (editor, e, eOpts) {
if (e.value == e.originalValue) return;
if (e.field == 'CUSTOMERNAME') {
var records = DsStoreQueryBy(this.storeCustCode, 'CustName', e.value);
if (records.getCount() > 0) {
var data = records.getAt(0).data;
e.record.set('SALE', data.SALE);
}
} else if (e.field == 'PKGS') {
var PKGS = e.value;
var KINDPKGS = e.record.data['KINDPKGS'];
e.record.set('NOPKGS', PKGS + KINDPKGS);
e.record.set('TOTALNO', 'SAY:' + ToEn(PKGS).toUpperCase() + ' ' + KINDPKGS + ' ONLY.');
this.calcDetailTotal();
} else if (e.field == 'KINDPKGS') {
var PKGS = e.record.data['PKGS'];
var KINDPKGS = e.value
e.record.set('NOPKGS', PKGS + KINDPKGS);
e.record.set('TOTALNO', 'SAY:' + ToEn(PKGS).toUpperCase() + ' ' + KINDPKGS + ' ONLY.');
} else if (e.field == 'BLFRT') {
if (e.value == "FREIGHT PREPAID") {
var portload = e.record.data['PORTLOAD'];
e.record.set('PREPARDAT', portload);
e.record.set('PAYABLEAT', '');
} else if (e.value == "FREIGHT COLLECT") {
var PORTDISCHARGE = e.record.data['PORTDISCHARGE'];
e.record.set('PREPARDAT', '');
e.record.set('PAYABLEAT', PORTDISCHARGE);
}
} else if (e.field == 'CBM') {
this.calcDetailTotal();
} else if (e.field == 'KGS') {
this.calcDetailTotal();
} else if (e.field == 'FEEKGS') {
this.calcDetailTotal();
}
},
calcDetailTotal: function () {
var blcount = 0;
var ttlpkgs = 0;
var ttlkgs = 0;
var ttlcbm = 0;
var ttlfeekgs = 0;
for (var i = 0; i < this.storeBodyList.getCount(); i += 1) {
var member = this.storeBodyList.getAt(i);
var PKGS = member.get('PKGS');
var KGS = member.get('KGS');
var CBM = member.get('CBM');
var FEEKGS = member.get('FEEKGS');
ttlpkgs = Add(parseFloat(ttlpkgs), PKGS);
ttlkgs = Add(parseFloat(ttlkgs), KGS);
ttlcbm = Add(parseFloat(ttlcbm), CBM);
ttlfeekgs = Add(parseFloat(ttlfeekgs), FEEKGS);
blcount = blcount + 1;
}
var memberyf = this.storeSumList.getAt(0);
memberyf.set("NOBILL", blcount);
memberyf.set("PKGS", ttlpkgs);
memberyf.set("KGS", ttlkgs);
memberyf.set("CBM", ttlcbm);
memberyf.set("FEEKGS", ttlfeekgs);
memberyf.commit();
},
OprationSwap: function () {
var ret = new Array();
ret[0] = this.OprationStatus;
ret[1] = this.storeBodyList;
ret[2] = this.SelectedRecord;
ret[3] = this.EditRecord;
return ret;
},
onFenFeeEditClick: function (menu, event) {
var selections = this.gridList.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var record = selections[0];
this.SelectedRecord = record;
this.OprationStatus = 'edit';
DsOpenEditWin('/MvcShipping/MsOpAiri/PiLiangFenFee', '分票费用');
},
Print: function () {
var printType = 'MSOPAIRIFENLIST';
var sql1 = "select * from op_airi WHERE BSNO='" + this.BsNo + "'";
var sql2 = "select * from op_airi where MASTERNO='" + this.BsNo + "' AND BSNO<>MASTERNO ORDER BY HBLNO";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
}
});