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/Account/Viewsjs/Chfee_lock/Chfee_lockDetail.js

826 lines
30 KiB
JavaScript

2 years ago
Ext.namespace('Shipping');
Shipping.Chfee_lockDetail = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.Chfee_lockDetail.superclass.constructor.call(this);
};
Ext.extend(Shipping.Chfee_lockDetail, Ext.Panel, {
ParentWin: null,
OpStatus: 'add',
StoreList: null,
editRecord: null,
region: 'north',
bsno: '',
AccDate: null,
IsAccDate: '',
isbslock:'',
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'
}
}
});
//按钮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: 'OPLBNAME'
}, {
fieldLabel: '报关单号',
readOnly: true,
name: 'CUSTOMNO'
}, {
fieldLabel: '分提单号',
readOnly: true,
name: 'HBLNO'
}]
}]//end items(fieldset 1)
}]//end root items
}); //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: "费用锁定",
id: "btnFeeLock",
handler: function (button, event) {
this.winFeeCloseShow.show();
},
scope: this
}, {
text: "费用解锁",
id: "btnFeeUnLock",
handler: function (button, event) {
this.onSelUnLockClick(button, event, 1);
},
scope: this
}, {
text: "业务锁定",
id: "btnBsLock",
handler: function (button, event) {
this.onSelLockClick(button, event, 2);
},
scope: this
}, {
text: "业务解锁",
id: "btnBsUnLock",
handler: function (button, event) {
this.onSelUnLockClick(button, event, 2);
},
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 == "海运进口") {
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;
} else if (OPLBNAME == "综合业务") {
openUrl = "../../MvcShipping/MsOpOther/EditView?handle=check&bsno=" + bsno;
}
window.open(openUrl, openType, openSet);
},
scope: this
}, '-', {
text: "关闭",
handler: function (button, event) {
window.close();
},
scope: this
}]
}); //end 按钮Toolbar
//#endregion
this.CheckAccMonth = new Ext.form.Checkbox({
fieldLabel: '修改会计期间',
checked: false,
width: 120
});
this.CheckBsClose = new Ext.form.Checkbox({
fieldLabel: '同时业务封账',
checked: false,
width: 100
});
this.formAccMonthShow = Ext.widget('form', {
frame: true,
region: 'center',
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 85,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.CheckAccMonth, {
fieldLabel: '会计期间',
xtype: 'monthfield',
name: 'AccDate'
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.CheckBsClose
]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
me = this;
this.winFeeCloseShow = Ext.create('Ext.window.Window', {
title: "费用封帐",
width: 420,
//height : 120,
//plain : true,
iconCls: "addicon",
resizable: false,
// 是否可以拖动
// draggable:false,
collapsible: true, // 允许缩放条
closeAction: 'close',
closable: true,
modal: 'true',
buttonAlign: "center",
bodyStyle: "padding:0 0 0 0",
items: [this.formAccMonthShow],
buttons: [{
text: "确认封帐",
minWidth: 70,
handler: function () {
var form = me.formAccMonthShow.getForm();
if (me.CheckAccMonth.checked) {
me.AccDate = form.findField('AccDate').getRawValue();
if (me.AccDate == '' || me.AccDate == null || me.AccDate == undefined) {
Ext.Msg.show({ title: '提示', msg: '必须会计期间!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
me.IsAccDate = '1';
} else me.IsAccDate = '0';
_this.onSelFeeLockClick()
}
}, {
text: "关闭",
minWidth: 70,
handler: function () {
me.winFeeCloseShow.close();
}
}]
});
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 145,
id: "BillHead",
items: [this.panelBtn, this.formHead]
});
this.panelFee = new Shipping.FeeViewGrid({
region: 'center',
layout: 'border'
});
Ext.apply(this, {
items: [this.panelTop, this.panelFee]
});
parentWin = window.parent.opener;
this.InitData();
}, //end initUIComponents
//#region 加载数据
InitData: function () {
var condition = '';
this.opStatus = 'edit';
_this = this;
if (parentWin) {
var ret = parentWin.OprationSwap();
this.opStatus = ret[0];
this.StoreList = ret[1];
this.editRecord = ret[2];
}
var btnFeeLock = Ext.getCmp('btnFeeLock');
var btnFeeUnLock = Ext.getCmp('btnFeeUnLock');
var btnBsLock = Ext.getCmp('btnBsLock');
var btnBsUnLock = Ext.getCmp('btnBsUnLock');
if (this.locktype == 'BS') {
btnBsLock.setVisible(true);
btnBsUnLock.setVisible(true);
btnFeeLock.setVisible(false);
btnFeeUnLock.setVisible(false);
} else if (this.locktype == 'FEE') {
btnBsLock.setVisible(false);
btnBsUnLock.setVisible(false);
btnFeeLock.setVisible(true);
btnFeeUnLock.setVisible(true);
}
Ext.Ajax.request({
waitMsg: '',
url: '/MvcShipping/MsBaseInfo/GetUserModuleEnable',
params: {
modulename: "modBsUnLock"
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (result.Success != true) {
if (this.locktype == 'BS') {
btnBsUnLock.setVisible(false);
} else {
btnFeeUnLock.setVisible(false);
}
} else {
if (this.locktype == 'BS') {
btnBsUnLock.setVisible(true);
} else {
btnFeeUnLock.setVisible(true);
}
}
} else {
}
},
scope: this
});
this.bsno = this.editRecord.get('BSNO');
var bstype = this.editRecord.get('OPLBNAME');
this.LoadData(this.bsno, bstype);
}, //end InitData
LoadData: function (bsno, bstype) {
_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);
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
var oplb = '';
var oplbdrOp = '';
var oplbCrOp = '';
if (bstype == '海运出口') {
oplb = 'op_Seae';
oplbdrOp = 'modRecvFeeManagement';
oplbCrOp = 'modPayFeeManagement';
}
if (bstype == '海运进口') {
oplb = 'op_Seai';
oplbdrOp = 'modSeaiRecvFeeManagement';
oplbCrOp = 'modSeaiPayFeeManagement';
}
if (bstype == '空运出口') {
oplb = 'op_Aire';
oplbdrOp = 'modAireRecvFeeManagement';
oplbCrOp = 'modAirePayFeeManagement';
}
if (bstype == '空运进口') {
oplb = 'op_Airi';
oplbdrOp = 'modAiriRecvFeeManagement';
oplbCrOp = 'modAiriPayFeeManagement';
}
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';
}
this.panelFee.stroplb = oplb;
this.panelFee.strBSNO = bsno;
this.panelFee.StoreDrOpRange.load({ params: { optype: oplbdrOp} });
this.panelFee.StoreCrOpRange.load({ params: { optype: oplbCrOp} });
this.panelFee.storeDrChFee.load({ params: { billno: bsno, type: 1, optype: oplb} });
this.panelFee.storeCrChFee.load({ params: { billno: bsno, type: 2, optype: oplb} });
this.panelFee.storeBodySum.load({ params: { bsno: bsno} });
this.panelFee.storeChFeeGain.load({ params: { bsno: bsno} });
},
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 == 'BSSTATUS' || name == 'BSSTATUSREF' || name == 'FEESTATUS' || name == 'FEESTATUSREF')
_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'
if (_this.CheckBsClose.checked) {
_this.isbslock = '1'
} else _this.isbslock = '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,
isbslock: _this.isbslock
},
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 == 'BSSTATUS' || name == 'BSSTATUSREF' || name == 'FEESTATUS' || name == 'FEESTATUSREF')
_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 == 'BSSTATUS' || name == 'BSSTATUSREF' || name == 'FEESTATUS' || name == 'FEESTATUSREF')
_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);
}
});