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/MsOpBill/MsOpFeeView.js

673 lines
26 KiB
JavaScript

2 years ago
Ext.namespace('Shipping');
Shipping.MsOpFeeView= function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsOpFeeView.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsOpFeeView, Ext.Panel, {
ParentWin: null,
OpStatus: 'add',
StoreList: null,
editRecord: null,
region: 'north',
bsno: '',
AccDate: null,
IsAccDate: '',
initUIComponents: function () {
//枚举参照相关
//编辑form
this.storebill = Ext.create('Ext.data.Store', {
model: 'MsOpBill',
remoteSort: false,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsOpBill/GetBLData',
reader: {
id: 'GId',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.bsno = getUrlParam('bsno');
this.StoreCargoid = Ext.create('Ext.data.Store', {
fields: ['ID', 'NAME']
});
this.StoreCargoid.add({ "ID": "S", "NAME": "S普通货" });
this.StoreCargoid.add({ "ID": "R", "NAME": "R冻柜" });
this.StoreCargoid.add({ "ID": "D", "NAME": "D危险品" });
this.StoreCargoid.add({ "ID": "O", "NAME": "O超限箱" });
this.comboxCargoid = Ext.create('DsExt.ux.RefTableCombox', {
store: this.StoreCargoid,
fieldLabel: "货物标示",
forceSelection: true,
readOnly:true,
name: 'CARGOID',
valueField: 'ID',
displayField: 'NAME'
});
//按钮Toolbar
this.formHead = Ext.widget('form', {
id: 'FeeHead',
region: 'center',
frame: true,
bodyPadding: 5,
trackResetOnLoad: true,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 70,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'fieldset',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
{
fieldLabel: '业务编号',
name: 'BSNO', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: 'OPLB',
name: 'OPLB', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: 'PARENTID',
name: 'PARENTID', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: '委托编号',
readOnly: true,
name: 'CUSTNO'
}, {
fieldLabel: '主提单号',
readOnly: true,
name: 'MBLNO'
}, {
fieldLabel: '业务锁定',
readOnly: true,
name: 'BSSTATUSREF'
}, {
fieldLabel: '费用锁定',
readOnly: true,
name: 'FEESTATUSREF'
}, {
fieldLabel: '会计期间',
readOnly: true,
xtype: 'monthfield',
name: 'ACCDATE'
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '委托单位',
readOnly: true,
name: 'CUSTOMERNAME'
}, {
fieldLabel: '业务来源',
readOnly: true,
name: 'BSSOURCE'
}, {
fieldLabel: '来源明细',
readOnly: true,
name: 'BSSOURCEDETAIL'
}, {
fieldLabel: '揽货人',
readOnly: true,
name: 'SALE'
}, {
fieldLabel: '操 作',
readOnly: true,
name: 'OP'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '业务日期',
readOnly: true,
name: 'ETD'
}, {
fieldLabel: '卸货港',
readOnly: true,
name: 'PORTDISCHARGE'
}, {
fieldLabel: '目的港',
readOnly: true,
name: 'DESTINATION'
}, {
fieldLabel: '报关单号',
readOnly: true,
name: 'CUSTOMNO'
}, {
fieldLabel: '起运港',
readOnly: true,
name: 'PORTLOAD'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '分提单号',
readOnly: true,
name: 'HBLNO'
}, {
fieldLabel: '放箱申请号',
readOnly: true,
name: 'APPLYNO'
}, {
fieldLabel: '类型',
readOnly: true,
name: 'OPTYPE'
}, {
fieldLabel: '运输类型',
readOnly: true,
name: 'OPLBNAME'
}, this.comboxCargoid]
}]//end items(fieldset 1)
}]//end root items
}); //end this.formEdit
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [
{
text: "退出",
handler: function (button, event) {
window.close();
},
scope: this
},'-' , {
text: "查看业务信息",
handler: function (button, event) {
var bsno = this.formHead.getForm().findField('PARENTID').getValue();
var OPLBNAME = this.formHead.getForm().findField('OPLBNAME').getValue();
var openSet = "height=700, width=1024, toolbar=no, menubar=no,scrollbars=1, resizable=1,location=no, status=no,Top= " + (screen.height - 750) / 2 + ",Left= " + (screen.width - 1100) / 2
var openType = "_blank";
var openUrl = "";
if (OPLBNAME == "海运出口") {
openUrl = "../../MvcShipping/MsOpSeae/EditView?handle=check&bsno=" + bsno;
}
else if (OPLBNAME == "海运进口" ||OPLBNAME == "海运进口散货") {
openUrl = "../../MvcShipping/MsOpSeai/EditView?handle=check&bsno=" + bsno;
} else if (OPLBNAME == "空运出口") {
openUrl = "../../MvcShipping/MsOpAire/EditView?handle=check&bsno=" + bsno;
} else if (OPLBNAME == "空运进口") {
openUrl = "../../MvcShipping/MsOpAiri/EditView?handle=check&bsno=" + bsno;
} else if (OPLBNAME== "报关业务") {
openUrl = "../../MvcShipping/MsOpApply/EditView?handle=check&bsno=" + bsno;
2 years ago
} else if (OPLBNAME == "综合业务") {
openUrl = "../../MvcShipping/MsOpOther/EditView?handle=check&bsno=" + bsno;
8 months ago
} else if (OPLBNAME == "陆运派车单") {
openUrl = "../../TruckMng/PcHeadEdit_WFSD/TaskView?GID=" + bsno;
2 years ago
}
window.open(openUrl, openType, openSet);
},
scope: this
}
]
});
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 180,
id: "BillHead",
items: [this.panelBtn,this.formHead]
});
this.panelFee = new Shipping.FeeViewGrid({
region: 'center',
layout: 'border'
});
Ext.apply(this, {
items: [this.panelTop, this.panelFee]
});
this.InitData();
}, //end initUIComponents
//#region 加载数据
InitData: function () {
var condition = '';
this.opStatus = 'edit';
_this = this;
this.LoadData(this.bsno);
}, //end InitData
LoadData: function (bsno) {
_this = this;
var condition = "BSNO='" + bsno + "'";
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/MvcShipping/MsOpBill/GetBLData',
params: {
handle: 'edit',
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;
}
data = result.data;
this.formHead.getForm().reset();
this.formHead.getForm().setValues(data);
var bsno = _this.bsno;
var bstype = data.OPLBNAME;
oplb = 'op_other';
oplbdrOp = 'modOtherRecvFeeManagement';
oplbCrOp = 'modOtherPayFeeManagement';
if (bstype == '海运出口') {
oplb = 'op_Seae';
oplbdrOp = 'modRecvFeeManagement';
oplbCrOp = 'modPayFeeManagement';
}
if (bstype == '海运进口') {
oplb = 'op_Seai';
oplbdrOp = 'modSeaiRecvFeeManagement';
oplbCrOp = 'modSeaiPayFeeManagement';
}
if (bstype == '综合业务') {
oplb = 'op_other';
oplbdrOp = 'modOtherRecvFeeManagement';
oplbCrOp = 'modOtherPayFeeManagement';
}
if (bstype == '大宗散货') {
oplb = 'op_Bulk';
oplbdrOp = 'modBulkRecvFeeManagement';
oplbCrOp = 'modBulkPayFeeManagement';
}
if (bstype == '报关业务') {
oplb = 'op_Apply';
oplbdrOp = 'modApplyRecvFeeManagement';
oplbCrOp = 'modApplyPayFeeManagement';
}
if (bstype == '铁路运输') {
oplb = 'op_railway';
oplbdrOp = 'modRailwayRecvFeeManagement';
oplbCrOp = 'modRailwayPayFeeManagement';
}
if (bstype == '空运出口') {
oplb = 'op_Aire';
oplbdrOp = 'modRailwayRecvFeeManagement';
oplbCrOp = 'modRailwayPayFeeManagement';
}
if (bstype == '空运进口') {
oplb = 'op_Airi';
oplbdrOp = 'modAiriRecvFeeManagement';
oplbCrOp = 'modAiriPayFeeManagement';
}
this.panelFee.stroplb = oplb;
this.panelFee.strBSNO = bsno;
this.panelFee.StoreDrOpRange.load({ params: { optype: oplbdrOp} });
this.panelFee.StoreCrOpRange.load({ params: { optype: oplbCrOp} });
if (data.OPTYPE == '更改单') {
this.panelFee.storeDrChFee.load({ params: { billno: bsno, type: 1, optype: oplb, condition: " FeeType=1 and exists (select 1 from v_op_bill b where b.BSNO=ch_fee.BSNO and b.BSNO='" + bsno + "')" } });
this.panelFee.storeCrChFee.load({ params: { billno: bsno, type: 2, optype: oplb, condition: " FeeType=2 and exists (select 1 from v_op_bill b where b.BSNO=ch_fee.BSNO and b.BSNO='" + bsno + "')" } });
} else {
this.panelFee.storeDrChFee.load({ params: { billno: bsno, type: 1, optype: oplb, condition: " FeeType=1 and exists (select 1 from v_op_bill b where b.BSNO=ch_fee.BSNO and b.PARENTID='" + bsno + "')" } });
this.panelFee.storeCrChFee.load({ params: { billno: bsno, type: 2, optype: oplb, condition: " FeeType=2 and exists (select 1 from v_op_bill b where b.BSNO=ch_fee.BSNO and b.PARENTID='" + bsno + "')" } });
}
this.panelFee.storeBodySum.load({ params: { bsno: this.bsno, optype: oplb} });
this.panelFee.storeChFeeGain.load({ params: { bsno: this.bsno, optype: oplb} });
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
},
onSelLockClick: function (button, event, type) {
var GidStr = '';
var oplb = this.formHead.getForm().findField('OPLB').getValue();
_this = this;
Ext.Ajax.request({
waitMsg: '正在锁定...',
url: '/Account/Chfee_lock/SelLockBsNo',
params: {
bsno: this.bsno,
type: type,
oplb: oplb
},
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;
} else {
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/MvcShipping/MsOpBill/GetBLData',
params: {
handle: 'edit',
condition: "BSNO='" + _this.bsno + "'"
},
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;
}
data = result.data;
_this.formHead.getForm().reset();
_this.formHead.getForm().setValues(data);
var editp = Ext.create('MsOpBill', data);
_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();
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
Ext.Msg.show({ title: '提示', msg: result.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
},
onSelFeeLockClick: function (button, event, type) {
var GidStr = '';
if (this.CheckAccMonth.checked) {
this.IsAccDate = '1'
} else this.IsAccDate = '0'
var oplb = this.formHead.getForm().findField('OPLB').getValue();
_this = this;
Ext.Ajax.request({
waitMsg: '正在锁定...',
url: '/Account/Chfee_lock/SelFeeLockBsNo',
params: {
bsno: this.bsno,
isAccDate: _this.IsAccDate,
AccDate: _this.AccDate,
oplb: oplb
},
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;
} else {
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/MvcShipping/MsOpBill/GetBLData',
params: {
handle: 'edit',
condition: "BSNO='" + _this.bsno + "'"
},
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;
}
data = result.data;
_this.formHead.getForm().reset();
_this.formHead.getForm().setValues(data);
var editp = Ext.create('MsOpBill', data);
_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();
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
Ext.Msg.show({ title: '提示', msg: result.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
_this.winFeeCloseShow.close();
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
},
onSelUnLockClick: function (button, event, type) {
var GidStr = '';
var oplb = this.formHead.getForm().findField('OPLB').getValue();
Ext.Ajax.request({
waitMsg: '正在解除锁定...',
url: '/Account/Chfee_lock/SelUnLockBsNo',
params: {
bsno: this.bsno,
type: type,
oplb: oplb
},
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;
} else {
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/MvcShipping/MsOpBill/GetBLData',
params: {
handle: 'edit',
condition: "BSNO='" + _this.bsno + "'"
},
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;
}
data = result.data;
_this.formHead.getForm().reset();
_this.formHead.getForm().setValues(data);
var editp = Ext.create('MsOpBill', data);
_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();
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
Ext.Msg.show({ title: '提示', msg: "解除锁定成功!", icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
},
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');
var bstype = this.editRecord.get('OPLBNAME');
this.LoadData(this.bsno, bstype);
},
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');
var bstype = this.editRecord.get('OPLBNAME');
this.LoadData(this.bsno, bstype);
}
});