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/MvcContainer/Viewsjs/MsOpCtnApply/MsOpCtnApplyCostAuditEdit.js

3560 lines
130 KiB
JavaScript

3 years ago
Ext.namespace('Shipping');
Shipping.MsOpCtnApplyCostAuditEdit = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsOpCtnApplyCostAuditEdit.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsOpCtnApplyCostAuditEdit, Ext.Panel, {
ParentWin: null,
OpStatus: 'add',
StoreList: null,
editRecord: null,
editFactryRecord: null,
FactryStatus: 'add',
initUIComponents: function () {
this.serialNo = 0;
this.workSerialNo = 0;
this.bodyDel = [];
//#region 成本审核编辑form
//枚举参照相关(编辑form)
//权限范围
this.openertype = getUrlParam("opener");
this.editGID = "";
this.storeListGood = Ext.create('Ext.data.Store', {
model: 'MsCodeMSDS',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcContainer/MsCodeMSDS/GetDataList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.storeListGood.load({ params: { start: 0, limit: 20000, condition: "" } });
this.comboxGoods = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeListGood,
fieldLabel: '品名',
allowBlank: true,
// forceSelection: true,
readOnly: true,
flex: 2,
name: 'GOODSNAME',
valueField: 'CHEMICALCGOODSNAME',
displayField: 'GOODNAMEANDCNAME',
listeners: {
'render': function (_field, eOpts) {//自定义函数,定义双击事件
var _this = this;
_field.getEl().on('dblclick', function (e, t, eOpts) {
var openSet = "height=700, width=1224, 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 = "";
openUrl = "../MsCodeMSDS/MsdsView?handle=check&goodsname=" + t.value;
window.open(openUrl, openType, openSet);
});
},
'select': function (combo, records, eOpts) {
if (records.length > 0) {
this.loadFactry();
}
}
}
});
//人员信息加载
this.storeOpCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserLinkRefList' }
});
this.storeOpCode.load();
//客服
this.comboxAGENTINPUTBY = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '代理维护人',
store: this.storeOpCode,
forceSelection: true,
name: 'AGENTINPUTBY',
valueField: 'UserName',
displayField: 'CodeAndName'
});
this.storeAGENT = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeAGENT.load({ params: { condition: "ISAGENT='1'"} });
this.comboxAgent = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '目的港代理',
store: this.storeAGENT,
forceSelection: true,
name: 'AGENTNAME',
valueField: 'CustName',
displayField: 'CodeAndName',
listeners: {
'render': function (_field, eOpts) {//自定义函数,定义双击事件
var _this = this;
_field.getEl().on('dblclick', function (e, t, eOpts) {
var openSet = "height=700, width=1224, 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 = "";
openUrl = "../../MvcShipping/MsInfoClient/ClientView?handle=check&custname=" + _field.value;
window.open(openUrl, openType, openSet);
});
}
}
});
this.StoreCurr2 = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsFeeCurr',
proxy: { url: '/MvcShipping/MsChFee/GetFeeCurrList' }
});
this.StoreCurr2.load({ params: { condition: "" } });
this.comboxCurr2 = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '币别',
store: this.StoreCurr2,
forceSelection: true,
name: 'CURRENCY',
valueField: 'CURR',
displayField: 'CURR'
});
this.StoreCurr3 = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsFeeCurr',
proxy: { url: '/MvcShipping/MsChFee/GetFeeCurrList' }
});
this.StoreCurr3.load({ params: { condition: "" } });
this.comboxCurr3 = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '币别', flex: 1,
labelWidth: 100,
store: this.StoreCurr3,
forceSelection: true,
name: 'CURRENCY',
valueField: 'CURR',
displayField: 'CURR',
listeners: {
blur: function (field, eOpts) {
_this.onCtnPriceChange();
},
scope: this
}
});
this.StoreCurr = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsFeeCurr',
proxy: { url: '/MvcShipping/MsChFee/GetFeeCurrList' }
});
this.StoreCurr.load({ params: { condition: "" } });
//表参照相关(编辑form)
this.formGoodsAudit = Ext.widget('form', {
region: 'north',
title: '适货审核',
region: 'north',
frame: true,
bodyPadding: 5,
autoScroll: true,
collapsed: false,
collapsible: true,
trackResetOnLoad: true,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 90,
msgTarget: 'qtip'
},
items: [{
xtype: 'container',
layout: 'anchor',
defaultType: 'textfield',
items: [{
xtype: 'container',
layout: 'hbox',
flex: 1,
defaultType: 'textfield',
items: [{
fieldLabel: '货物是否与MSDS一致',
inputValue: true,
labelWidth: 180,
xtype: 'checkboxfield',
name: 'ISGOODSNAMESAME'
}, {
fieldLabel: '工厂其他产品',
flex: 3,
name: 'PRODUCTGOODSNAME'
}, {
fieldLabel: 'PH',
readOnly: true,
name: 'PH'
}]
}, {
xtype: 'container',
layout: 'hbox',
flex: 1,
defaultType: 'textfield',
items: [{
fieldLabel: '密度',
readOnly: true,
name: 'DENSITY'
}, {
fieldLabel: 'UN',
readOnly: true,
name: 'UNNO'
}, {
fieldLabel: '危险品等级',
readOnly: true,
name: 'DCLASS'
}, {
fieldLabel: '副危险品等级',
readOnly: true,
name: 'SDCLASS'
}, {
fieldLabel: 'PACKING GROUP',
labelWidth: 110, readOnly: true,
name: 'PACKINGGROUP'
}]
}, {
xtype: 'container',
layout: 'hbox',
flex: 1,
defaultType: 'textfield',
items: [{
fieldLabel: '是否海洋污染物',
inputValue: true,
readOnly: true,
xtype: 'checkboxfield',
name: 'ISPOLLUTEOCEAN'
}, {
fieldLabel: '是否存在危险',
inputValue: true,
readOnly: true,
xtype: 'checkboxfield',
name: 'ISDANGEROUS'
}, {
fieldLabel: '熔点',
readOnly: true,
name: 'MELTINGPOINT'
}, {
fieldLabel: '沸点',
readOnly: true,
name: 'BOILINGPOINT'
}, {
fieldLabel: '闪点',
readOnly: true,
name: 'FLASHPOINT'
}, {
fieldLabel: 'IMDG',
readOnly: true,
name: 'IMDG'
}]
}, {
xtype: 'container',
layout: 'hbox',
flex: 1,
defaultType: 'textfield',
items: [{
fieldLabel: '提交时间',
readOnly: true,
name: 'SUBMITTIME'
}, {
fieldLabel: '箱管审核状态',
readOnly: true,
name: 'AUDITSTATUS'
}, {
fieldLabel: '审核人',
readOnly: true,
name: 'AUDITBYREF'
}, {
fieldLabel: '审核时间',
readOnly: true,
name: 'AUDITTIME'
}, {
fieldLabel: '审核反馈',
name: 'AUDITRESULT'
}]
}]//end items(fieldset 1)
}]
}); //end this.formEdit
this.formCost = Ext.widget('form', {
region: 'north',
title: '成本核算',
region: 'north',
frame: true,
bodyPadding: 5,
// autoScroll: true,
trackResetOnLoad: true,
collapsed: false,
collapsible: true,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 90,
msgTarget: 'qtip'
},
items: [{
xtype: 'container',
layout: 'anchor',
defaultType: 'textfield',
items: [{
xtype: 'container',
layout: 'hbox',
flex: 1,
defaultType: 'textfield',
items: [this.comboxAGENTINPUTBY, {
fieldLabel: '周期',
name: 'CYCLEDAYS',
listeners: {
blur: function (field, eOpts) {
_this.onCtnPriceChange();
},
scope: this
}
}, {
fieldLabel: '超期箱使费佣金比例',
labelWidth: 115, name: 'CHANGERATE'
}, {
fieldLabel: '重箱免堆天数',
labelWidth: 100, name: 'FULL_CTN_FREE_STORAGE_DAY'
}, {
fieldLabel: '重箱超期堆存费',
labelWidth: 100, name: 'FULL_CTN_OVER_STORAGE_RATE'
}]
}, {
xtype: 'container',
layout: 'hbox',
flex: 1,
defaultType: 'textfield',
items: [{
fieldLabel: '清洗免堆天数',
labelWidth: 100, name: 'CLEAR_CTN_FREE_STORAGE_DAY'
}, {
fieldLabel: '清洗超期堆存费',
labelWidth: 100, name: 'CLEAR_CTN_OVER_STORAGE_RATE'
}, {
fieldLabel: '不清洗免堆天数',
labelWidth: 100, name: 'NO_CLEAR_CTN_FREE_STORAGE_DAY'
}, {
fieldLabel: '不清洗超期堆存费',
labelWidth: 110, name: 'NO_CLEAR_CTN_OVER_STORAGE_RATE'
}, this.comboxAgent]
}, {
xtype: 'container',
layout: 'hbox',
flex: 1,
defaultType: 'textfield',
items: [{
fieldLabel: '目的港还箱堆场',
labelWidth: 100, name: 'DESTPORT_STATOIN'
}, {
xtype: 'hiddenfield', flex: 4
}]
}]//end items(fieldset 1)
}]
}); //end this.formEdit
this.storeOWNERCTN = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeOWNERCTN.load({ params: { condition: "1=1" } });
this.comboxOWNERCTN = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '罐箱费结算单位',
store: this.storeOWNERCTN,
forceSelection: true,
name: 'OWNERCTN',
valueField: 'CustName',
displayField: 'CodeAndName'
});
this.formAudit = Ext.widget('form', {
region: 'north',
title: '成本审批',
region: 'north',
frame: true,
bodyPadding: 5,
// autoScroll: true,
trackResetOnLoad: true,
collapsed: false,
collapsible: true,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 90,
msgTarget: 'qtip'
},
items: [{
xtype: 'container',
layout: 'anchor',
defaultType: 'textfield',
items: [ {
xtype: 'container',
layout: 'hbox',
flex: 1,
defaultType: 'textfield',
items: [{
fieldLabel: '提交人',
readOnly: true,
name: 'COSTSUBMITBYREF'
}, {
fieldLabel: '提交时间',
readOnly: true,
name: 'COSTSUBMITTIME'
}, { xtype: 'hiddenfield', flex: 1 }
, this.comboxOWNERCTN
,this.comboxCurr3
]
}, {
xtype: 'container',
layout: 'hbox',
flex: 1,
defaultType: 'textfield',
items: [{
fieldLabel: 'COSTTTL',
name: 'COSTTTL', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: '箱管审核状态',
readOnly: true,
name: 'COSTAUDITSTATUS'
}, {
fieldLabel: '审核人',
readOnly: true,
name: 'COSTAUDITBYREF'
}, {
fieldLabel: '审核时间',
readOnly: true,
name: 'COSTAUDITTIME'
}, {
fieldLabel: '审核反馈',
readOnly: true,
name: 'COSTAUDITRESULT'
}, {
fieldLabel: '罐箱价格',
labelWidth: 100, name: 'CTN_PRICE',
listeners: {
blur: function (field, eOpts) {
_this.onCtnPriceChange();
},
scope: this
}
}]
}, {
xtype: 'container',
layout: 'hbox',
flex: 1,
defaultType: 'textfield',
items: [{
fieldLabel: '内部租金收入',
labelWidth: 100, name: 'CTN_INCOME'
}, {
fieldLabel: '起运港免箱使天数',
labelWidth: 110, name: 'LOAD_FREE_USECTNE_DAY'
}, {
fieldLabel: '起运港超期箱使费',
labelWidth: 110, name: 'LOAD_OVER_USECTNE_RATE'
}, {
fieldLabel: '目的港免箱使天数',
labelWidth: 110, name: 'DEST_FREE_USECTNE_DAY'
}, {
fieldLabel: '目的港超期箱使费',
labelWidth: 110, name: 'DEST_OVER_USECTNE_RATE'
}]
}, {
xtype: 'container',
layout: 'hbox',
flex: 1,
defaultType: 'textfield',
items: [{
fieldLabel: '操作审核状态',
readOnly: true,
name: 'ACCAUDITSTATUS'
}, {
fieldLabel: '操作审核人',
readOnly: true,
name: 'ACCAUDITBYREF'
}, {
fieldLabel: '操作审核时间',
readOnly: true,
name: 'ACCAUDITTIME'
}
, {
fieldLabel: '审核反馈',
readOnly: false,
name: 'ACCAUDITRESULT'
}, { xtype: 'hiddenfield'}]
}, {
xtype: 'container',
layout: 'hbox',
flex: 1,
defaultType: 'textfield',
items: [{
fieldLabel: '业务审核状态',
readOnly: true,
name: 'BSAUDITSTATUS'
}, {
fieldLabel: '业务审核人',
readOnly: true,
name: 'BSAUDITBYREF'
}, {
fieldLabel: '业务审核时间',
readOnly: true,
name: 'BSAUDITTIME'
}
, {
fieldLabel: '审核反馈',
readOnly: false,
name: 'BSAUDITRESULT'
}, { xtype: 'hiddenfield'}]
}, {
xtype: 'container',
layout: 'hbox',
flex: 1,
defaultType: 'textfield',
items: [, {
fieldLabel: '总经理审核状态',
readOnly: true,
name: 'MNGAUDITSTATUS'
}, {
fieldLabel: '审核人',
readOnly: true,
name: 'MNGAUDITBYREF'
}, {
fieldLabel: '审核时间',
readOnly: true,
name: 'MNGAUDITTIME'
}
, {
fieldLabel: '审核反馈',
readOnly: false,
name: 'MNGAUDITRESULT'
}, { xtype: 'hiddenfield'}]
}]//end items(fieldset 1)
}]
}); //end this.formEdit
//编辑form
this.formEdit = Ext.widget('form', {
region: 'center',
frame: true,
bodyPadding: 5,
// height: 160,
// autoScroll: true,
trackResetOnLoad: true,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 90,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: 'GID',
name: 'GID', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: 'COMPANYID',
name: 'COMPANYID', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: 'ADDCTNSTATUS',
name: 'ADDCTNSTATUS', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: 'INPUTBY',
name: 'INPUTBY', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: '申请编号',
readOnly: true,
allowBlank: true,
name: 'BSNO'
}, {
fieldLabel: '申请日期',
readOnly: true,
name: 'BSDATE'
}, {
fieldLabel: '揽货人',
readOnly: true,
name: 'SALE'
}, {
fieldLabel: '操作',
readOnly: true,
name: 'OP'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '委托单位',
readOnly: true,
name: 'CUSTOMERNAME'
}, this.comboxGoods, {
fieldLabel: '货物类别',
flex: 0.5,
readOnly: true,
name: 'GOODTYPE'
}, {
fieldLabel: '起运港',
labelWidth: 60,
flex: 0.5,
readOnly: true,
name: 'PORTLOAD'
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '目的港',
readOnly: true,
name: 'PORTDISCHARGE'
}, {
fieldLabel: '是否我司订舱',
inputValue: true,
readOnly: true,
xtype: 'checkboxfield',
name: 'ISOWNERBOOKING'
}, {
fieldLabel: '箱型',
readOnly: true,
name: 'CTNALL'
}, {
fieldLabel: '箱量',
readOnly: true,
name: 'CTNNUM'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [, {
fieldLabel: '计划用箱日期',
format: 'Y-m-d',
readOnly: true,
flex: 1,
xtype: 'datefield',
name: 'PLANCTNDATE'
}, {
fieldLabel: '工厂名称',
readOnly: true,
name: 'FACTORYNAME'
}, {
fieldLabel: '工厂地址',
readOnly: true,
name: 'FACTORYADDR'
}, {
fieldLabel: '申请状态',
readOnly: true,
name: 'BSSTATUS'
}]
}, {
xtype: 'container',
layout: 'hbox',
flex: 1,
defaultType: 'textfield',
items: [{
fieldLabel: '起运港免箱使天数', readOnly: true,
labelWidth: 120, name: 'SLOAD_FREE_USECTNE_DAY'
}, {
fieldLabel: '起运港超期箱使费', readOnly: true,
labelWidth: 120, name: 'SLOAD_OVER_USECTNE_RATE'
}, {
fieldLabel: '目的港免箱使天数', readOnly: true,
labelWidth: 120, name: 'SDEST_FREE_USECTNE_DAY'
}, {
fieldLabel: '目的港超期箱使费', readOnly: true,
labelWidth: 120, name: 'SDEST_OVER_USECTNE_RATE'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '录入人',
readOnly: true,
disabled: true,
name: 'INPUTBYREF'
}, {
fieldLabel: '录入日期',
readOnly: true,
disabled: true,
name: 'INPUTTIME'
}, {
fieldLabel: '按进港日计算超期箱使',
inputValue: true,
labelWidth: 140,
flex: 1, readOnly: true,
xtype: 'checkboxfield',
name: 'ISPORTLOADDATE'
}, {
fieldLabel: '运输条款',
flex: 1, readOnly: true,
name: 'SERVICE'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
{
fieldLabel: '是否加热',
flex: 1, readOnly: true,
inputValue: true,
xtype: 'checkboxfield',
name: 'NEEDBEHEATED'
}, {
fieldLabel: '重量',
flex: 1, readOnly: true,
xtype: 'numberfield',
allowDecimals: true, //允许输入小数
decimalPrecision: 3,
name: 'WEIGHT'
}, {
fieldLabel: '预计开船日期',
format: 'Y-m-d',
allowBlank: true,
flex: 1, readOnly: true,
xtype: 'datefield',
name: 'PREI_ETD'
}, {
fieldLabel: '空箱调拨',
flex: 1, readOnly: true,
inputValue: true,
xtype: 'checkboxfield',
name: 'EMPTYCTNALLOCATION'
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '备注',
flex: 2, readOnly: true,
name: 'REMARKS'
}]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
}); //end this.formEdit
//#endregion
//#region 按钮Toolbar
if (CostAudit == "1") {
this.tbuttons = [{
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: "btnsave",
id: 'btnsave',
handler: function (button, event) {
this.onSaveAuditCostClick();
},
scope: this
}, '-', {
id: 'btnSubmitAudit',
text: '提交审核',
hidden: true,
tooltip: '提交审核',
handler: function (button, event) {
this.onSubmitAuditClick();
},
scope: this
}, '-', {
id: 'btnSubmitAuditBack',
text: '撤销提交',
hidden: true,
tooltip: '撤销提交',
handler: function (button, event) {
this.onSubmitAuditBackClick();
},
scope: this
}, '-', {
text: "审核通过",
iconCls: "btnadd",
id: 'btnAuditPass',
hidden: false,
handler: function (button, event) {
this.onAuditCostPassClick();
},
scope: this
},
'-',
{
text: "驳回提交",
iconCls: "btndelete",
hidden: false,
id: 'btnAuditBack',
handler: function (button, event) {
this.onAuditCostBackClick();
},
scope: this
}, '-',
{
text: "操作审核",
id: 'AccAudit',
menu: [
{ text: "审核通过",
handler: function (menu, event) {
_this.onACCAuditClick('1');
}
}, { text: "撤销审核",
handler: function (menu, event) {
_this.onACCAuditClick('0');
}
}],
scope: this
}, '-',
{
text: "业务审核",
id: 'BsAudit',
menu: [
{ text: "审核通过",
handler: function (menu, event) {
_this.onBSAuditClick('1');
}
}, { text: "撤销审核",
handler: function (menu, event) {
_this.onBSAuditClick('0');
}
}],
scope: this
}, '-', {
text: "总经理审核通过",
iconCls: "btnadd",
id: 'btnMNGAuditPass',
handler: function (button, event) {
this.onMNGAuditPassClick();
},
scope: this
},
'-',
{
text: "总经理驳回提交",
iconCls: "btndelete",
id: 'btnMNGAuditBack',
handler: function (button, event) {
this.onMNGAuditBackClick();
},
scope: this
}
];
} else {
this.tbuttons = [{
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: "btnsave",
hidden: false,
id: 'btnsave',
handler: function (button, event) {
this.Save('0');
},
scope: this
}, '-', {
id: 'btnSubmitAudit',
text: '提交审核',
hidden: false,
tooltip: '提交审核',
handler: function (button, event) {
this.onSubmitAuditClick();
},
scope: this
}, '-', {
id: 'btnSubmitAuditBack',
text: '撤销提交',
hidden: false,
tooltip: '撤销提交',
handler: function (button, event) {
this.onSubmitAuditBackClick();
},
scope: this
}, '-', {
text: "审核通过",
iconCls: "btnadd",
id: 'btnAuditPass',
hidden: true,
handler: function (button, event) {
this.onAuditGoodsPassClick();
},
scope: this
},
'-',
{
text: "驳回提交",
iconCls: "btndelete",
hidden: true,
id: 'btnAuditBack',
handler: function (button, event) {
this.onAuditGoodsBackClick();
},
scope: this
}, '-', {
id: 'btnOpSubmitAudit',
text: '操作完成',
hidden: false,
tooltip: '操作完成',
handler: function (button, event) {
this.onOpAuditClick();
},
scope: this
}, '-',
{
text: "申请修改",
id: 'ShenModify',
menu: [
{ text: "申请修改",
handler: function (menu, event) {
_this.onShenModifyClick();
}
}, { text: "撤销申请修改",
handler: function (menu, event) {
_this.onShenModifyDelCancelClick('6');
}
}],
scope: this
}
];
}
this.panelBtn = new Ext.Panel({
region: "north",
tbar: this.tbuttons
}); //end 按钮Toolbar
//#endregion
//#region 明细
this.storeBodyList = Ext.create('Ext.data.Store', {
model: 'MsOpCtnApplySaleItems',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcContainer/MsOpCtnApply/GetCtnApplySaleItemsList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//明细表表格
this.gridListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.gridListBody = new Ext.grid.GridPanel({
store: this.storeBodyList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
plugins: [this.gridListCellEditing],
selType: 'cellmodel',
columns: [{
sortable: true,
dataIndex: 'GID',
header: '编号',
hidden: true,
width: 0
}, {
sortable: true,
dataIndex: 'LINKGID',
header: '业务编号',
hidden: true,
width: 0
}, {
sortable: true,
dataIndex: 'ITEMSNO',
header: '序号',
align: 'right',
width: 30
}, {
sortable: true,
dataIndex: 'ITEMNAME',
header: '项目名称',
width: 140
}, {
sortable: true,
dataIndex: 'REMARKS',
header: '备注',
width: 250
}]
});
this.gridListBody.on('edit', function (editor, e, eOpts) {
this.gridListAfterEdit(editor, e, eOpts);
}, this);
this.panelBody = new Ext.Panel({
title: '改装要求',
layout: "border",
region: 'east',
width: 200,
animate: true,
// autoScroll: true,
// containerScroll: true,
frame: false,
items: [this.gridListBody]
});
this.panelEDIpage = new Ext.Panel({
title: '申请内容',
layout: "border",
region: 'north',
animate: true,
autoScroll: true,
collapsed: false,
collapsible: true,
height: 250, // containerScroll: true,
frame: false,
items: [this.formEdit, this.panelBody]
});
//#endregion
//#region 报价信息
this.storeBodyCostList = Ext.create('Ext.data.Store', {
model: 'MsOpCtnApplyCostItems',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcContainer/MsOpCtnApply/GetCtnApplyCostItemsList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.storeFeeNameRef = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.FeeTypeRefModel',
proxy: { url: '/MvcShipping/MsChFee/GetFeeTypeRefList' }
});
this.storeFeeNameRef.load({ params: { condition: ""} });
this.comboxFeeNameRef = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeFeeNameRef,
forceSelection: true,
name: 'FEENAME',
valueField: 'Name',
displayField: 'CodeAndName'
});
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.StoreDateCurr = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsFeeCurr',
proxy: { url: '/MvcShipping/MsChFee/GetFeeDateCurrList' }
});
this.StoreDateCurr.load();
this.storeFeeUnit = Ext.create('DsExt.ux.RefTableStore', {
fields: ['UNIT'],
proxy: { url: '/MvcShipping/MsCodeFeeTemplate/GetFeeUnit' }
});
this.storeFeeUnit.load({ params: { condition: ""} });
this.comboxFeeUnit = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeFeeUnit,
forceSelection: true,
name: 'UNIT',
valueField: 'UNIT',
displayField: 'UNIT'
});
this.initgirdcolums = [{
sortable: true,
dataIndex: 'GID',
header: '编号',
hidden: true,
width: 0
}, {
sortable: true,
dataIndex: 'LINKGID',
header: '业务编号',
hidden: true,
width: 0
}, {
sortable: true,
dataIndex: 'FEENAME',
header: '费用名称',
//editor: this.comboxFeeNameRef,
width: 140
}, {
sortable: true,
dataIndex: 'UNIT',
header: '标准',
//editor: this.comboxFeeUnit,
width: 80
}, {
sortable: true,
dataIndex: 'CURRENCY',
header: '币别',
//editor: this.comboxCurr,
width: 60
}, {
sortable: true,
dataIndex: 'UNITPRICE',
header: '单价',
//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: 100
}, {
sortable: true,
dataIndex: 'QUANTITY',
header: '数量',
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: 90
}, {
sortable: true,
dataIndex: 'AMOUNT',
header: '金额',
//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: 100
}, {
sortable: true,
dataIndex: 'EXCHANGERATE',
header: '汇率',
//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: 100
}, {
sortable: true,
dataIndex: 'CUSTOMERNAME',
header: '付款方',
editor: this.comboxCustomerNameRef,
width: 130
}, {
sortable: true,
dataIndex: 'REMARKS',
header: '备注',
editor: {
xtype: 'textfield',
selectOnFocus: true,
enableKeyEvents: true
},
width: 250
}, {
sortable: true,
dataIndex: 'INPUTBYREF',
header: '引入人',
width: 80
}, {
sortable: true,
dataIndex: 'INPUTTIME',
header: '引入时间',
width: 100
}, {
sortable: true,
dataIndex: 'GOODSNAME',
header: '品名',
//editor: {
// xtype: 'textfield',
// selectOnFocus: true,
// enableKeyEvents: true
//},
width: 250
},
{
sortable: true,
id: '',
dataIndex: 'PRICETYPE',
header: '运价来源',
align: 'center',
width: 120,
renderer: function (value, cellmeta) {
if (value == '1') {
return '海运出口报价';
} else if (value == '2') {
return '海运进口报价';
} else if (value == '3') {
return '代理报价';
} else if (value == '4') {
return '场站报价';
}
}
}];
this.girdcolums = this.initgirdcolums;
_this = this;
this.girdcolums = DsTruck.GetGridPanel(USERID, this.formname, this.girdcolums, 1); //使用者id表名中间column数组跳过一开始的几列
//明细表表格
this.gridListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
if (CostAudit == "1") {
this.dbtns = [{
text: '引入运价',
tooltip: '引入运价',
id: "btnadddetail",
hidden: true,
iconCls: "btnadddetail",
handler: function (button, event) {
this.addDetail();
},
scope: this
}, '-', {
text: '删除明细',
tooltip: '删除明细',
hidden: true,
id: "btndeldetail",
iconCls: "btndeletedetail",
handler: function (button, event) {
this.onDeletePriceItemsClick();
},
scope: this
}]
} else {
this.dbtns = [{
text: '引入运价',
tooltip: '引入运价',
id: "btnadddetail",
iconCls: "btnadddetail",
handler: function (button, event) {
this.addDetail();
},
scope: this
}, '-', {
text: '删除明细',
tooltip: '删除明细',
id: "btndeldetail",
iconCls: "btndeletedetail",
handler: function (button, event) {
this.onDeletePriceItemsClick();
},
scope: this
}, '-', {
text: "保存列表样式",
menu: [
{ text: "保存",
handler: function (button, event) {
this.girdcolums = DsTruck.SaveGridPanel(USERID, _this.formname, _this.gridListCostBody.columns, _this.girdcolums, 1, true);
}
}, { text: "初始化",
handler: function (menu, event) {
_this.InitGrid(_this.initgirdcolums);
_this.girdcolums = DsTruck.SaveGridPanel(USERID, _this.formname, _this.gridListCostBody.columns, _this.initgirdcolums, 1, true);
}
}],
scope: this
}]
}
this.storeCustomerNameRef = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeCustomerNameRef.load({ params: { condition: ""} });
this.comboxCustomerNameRef = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeCustomerNameRef,
forceSelection: true,
name: 'CUSTOMERNAME',
valueField: 'CustName',
displayField: 'CodeAndName'
});
this.gridListCostBody = new Ext.grid.GridPanel({
store: this.storeBodyCostList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
plugins: [this.gridListCellEditing],
selType: 'cellmodel',
columns: this.girdcolums,
tbar: this.dbtns
});
this.gridListCostBody.on('edit', function (editor, e, eOpts) {
this.gridListAfterEdit(editor, e, eOpts);
}, this);
this.storeBodyCostSum = Ext.create('Ext.data.Store', {
model: 'MsOpCtnApplyCostItems',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcContainer/MsOpCtnApply/GetCtnApplyCostSum',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.gridListCostSum = new Ext.grid.GridPanel({
store: this.storeBodyCostSum,
enableHdMenu: false,
region: 'east',
width: 240,
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
selType: 'cellmodel',
tbar: [{ xtype: 'label', text: '费用合计',
style: 'font-size:18px',
labelColor: '#000',
//style:'background-color: #4b9bf5',
x: '5%',
y: '5%'
}],
columns: [{
sortable: false,
dataIndex: 'CURRENCY',
header: '币别',
width: 100
}, {
sortable: false,
dataIndex: 'AMOUNT',
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: 110
}]
});
this.panelCostBody = new Ext.Panel({
title: '成本核算明细',
layout: "border",
region: 'center',
animate: true,
minHeight: 280,
// autoScroll: true,
// containerScroll: true,
frame: false,
items: [this.gridListCostBody, this.gridListCostSum]
});
//#endregion
// //#region 布局
// //控件布局
// this.panelTop = new Ext.Panel({
// layout: "border",
// region: "north",
// height: 220,
// items: [this.panelBtn, ]
// });
this.panelBodyAll = new Ext.Panel({
layout: "border",
region: 'center',
animate: true,
autoScroll: true,
containerScroll: true,
frame: false,
items: [this.panelEDIpage, this.formGoodsAudit, this.formCost, this.formAudit, this.panelCostBody]
});
Ext.apply(this, {
items: [this.panelBtn, this.panelBodyAll]
});
//#endregion
//绑定查询窗体
this.storeBodyList.on('beforeload', function (store) {
var acondition = " LINKGID='" + this.editGID + "'";
Ext.apply(store.proxy.extraParams, { condition: acondition });
}, this);
this.storeBodyCostList.on('beforeload', function (store) {
var acondition = " LINKGID='" + this.editGID + "'";
Ext.apply(store.proxy.extraParams, { condition: acondition });
}, this);
this.ParentWin = window.parent.opener;
//初始化数据
this.InitData();
//绑定事件
//#region 申请修改
//人员信息加载
this.storeOpCodeM = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserLinkRefList' }
});
this.storeOpCodeM.load();
//客服
this.comboxAGENTINPUTBYM = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '代理维护人',
store: this.storeOpCodeM,
forceSelection: true,
name: 'AGENTINPUTBY',
valueField: 'UserName',
displayField: 'CodeAndName'
});
this.storeAGENTM = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeAGENTM.load({ params: { condition: "ISAGENT='1'"} });
this.comboxAgentM = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '目的港代理',
store: this.storeAGENTM,
forceSelection: true,
name: 'AGENTNAME',
valueField: 'CustName',
displayField: 'CodeAndName',
listeners: {
'render': function (_field, eOpts) {//自定义函数,定义双击事件
var _this = this;
_field.getEl().on('dblclick', function (e, t, eOpts) {
var openSet = "height=700, width=1224, 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 = "";
openUrl = "../../MvcShipping/MsInfoClient/ClientView?handle=check&custname=" + _field.value;
window.open(openUrl, openType, openSet);
});
}
}
});
this.formMDEdit = Ext.widget('form', {
region: 'north',
frame: true,
bodyPadding: 5,
// autoScroll: true,
trackResetOnLoad: true,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 90,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'fieldset',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: 'GID',
name: 'GID', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: 'APPLYID',
name: 'APPLYID', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: 'MODIFYTYPE',
name: 'MODIFYTYPE', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: 'COMPANYID',
name: 'COMPANYID', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: 'INPUTBY',
name: 'INPUTBY', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: 'PH',
hidden: true,
name: 'PH'
}, {
fieldLabel: 'DENSITY',
hidden: true,
name: 'DENSITY'
}, {
fieldLabel: 'UNNO',
hidden: true,
name: 'UNNO'
}, {
fieldLabel: 'DCLASS',
hidden: true,
name: 'DCLASS'
}, {
fieldLabel: 'SDCLASS',
hidden: true,
name: 'SDCLASS'
}, {
fieldLabel: 'PACKINGGROUP',
hidden: true,
name: 'PACKINGGROUP'
}, {
fieldLabel: 'ISPOLLUTEOCEAN',
hidden: true,
name: 'ISPOLLUTEOCEAN'
}, {
fieldLabel: 'MELTINGPOINT',
hidden: true,
name: 'MELTINGPOINT'
}, {
fieldLabel: 'BOILINGPOINT',
hidden: true,
name: 'BOILINGPOINT'
}, {
fieldLabel: 'FLASHPOINT',
hidden: true,
name: 'FLASHPOINT'
}, {
fieldLabel: 'IMDG',
hidden: true,
name: 'IMDG'
}, {
fieldLabel: 'SALE',
hidden: true,
name: 'SALE'
}, {
fieldLabel: 'OP',
hidden: true,
name: 'OP'
}, {
fieldLabel: 'GOODSNAME',
hidden: true,
name: 'GOODSNAME'
}, {
fieldLabel: 'GOODTYPE',
hidden: true,
name: 'GOODTYPE'
}, {
fieldLabel: 'PORTLOAD',
hidden: true,
name: 'PORTLOAD'
}, {
fieldLabel: 'PORTDISCHARGE',
hidden: true,
name: 'PORTDISCHARGE'
}, {
fieldLabel: 'CTNNUM',
hidden: true,
name: 'CTNNUM'
}, {
fieldLabel: 'ISOWNERBOOKING',
hidden: true,
name: 'ISOWNERBOOKING'
}, {
fieldLabel: 'ISPORTLOADDATE',
hidden: true,
name: 'ISPORTLOADDATE'
}, {
fieldLabel: 'PLANCTNDATE',
hidden: true,
name: 'PLANCTNDATE'
}, {
fieldLabel: 'SLOAD_FREE_USECTNE_DAY',
hidden: true,
name: 'SLOAD_FREE_USECTNE_DAY'
}, {
fieldLabel: 'SLOAD_OVER_USECTNE_RATE',
hidden: true,
name: 'SLOAD_OVER_USECTNE_RATE'
}, {
fieldLabel: 'SDEST_FREE_USECTNE_DAY',
hidden: true,
name: 'SDEST_FREE_USECTNE_DAY'
}, {
fieldLabel: 'SDEST_OVER_USECTNE_RATE',
hidden: true,
name: 'SDEST_OVER_USECTNE_RATE'
}, {
fieldLabel: '申请编号',
labelWidth: 70,
readOnly: true,
hidden: true,
allowBlank: true,
name: 'BSNO'
}, {
fieldLabel: '申请日期',
readOnly: true,
hidden: true,
name: 'BSDATE'
}]
}, {
xtype: 'container',
layout: 'hbox',
flex: 1,
defaultType: 'textfield',
items: [this.comboxAGENTINPUTBYM, {
fieldLabel: '周期',
name: 'CYCLEDAYS'
}, {
fieldLabel: '超期箱使费佣金比例',
labelWidth: 115, name: 'CHANGERATE'
}, {
fieldLabel: '重箱免堆天数',
labelWidth: 100, name: 'FULL_CTN_FREE_STORAGE_DAY'
}, {
fieldLabel: '重箱超期堆存费',
labelWidth: 100, name: 'FULL_CTN_OVER_STORAGE_RATE'
}]
}, {
xtype: 'container',
layout: 'hbox',
flex: 1,
defaultType: 'textfield',
items: [{
fieldLabel: '清洗免堆天数',
labelWidth: 100, name: 'CLEAR_CTN_FREE_STORAGE_DAY'
}, {
fieldLabel: '清洗超期堆存费',
labelWidth: 100, name: 'CLEAR_CTN_OVER_STORAGE_RATE'
}, {
fieldLabel: '不清洗免堆天数',
labelWidth: 100, name: 'NO_CLEAR_CTN_FREE_STORAGE_DAY'
}, {
fieldLabel: '不清洗超期堆存费',
labelWidth: 110, name: 'NO_CLEAR_CTN_OVER_STORAGE_RATE'
}, this.comboxAgentM]
}, {
xtype: 'container',
layout: 'hbox',
flex: 1,
defaultType: 'textfield',
items: [{
fieldLabel: '目的港还箱堆场',
labelWidth: 100, name: 'DESTPORT_STATOIN'
}, {
xtype:'hiddenfield',flex:4
}]
}, {
xtype: 'container',
layout: 'hbox',
flex: 1,
defaultType: 'textfield',
items: [{
fieldLabel: '内部租金收入',
labelWidth: 100, name: 'CTN_INCOME'
}, {
fieldLabel: '起运港免箱使天数',
labelWidth: 110, name: 'LOAD_FREE_USECTNE_DAY'
}, {
fieldLabel: '起运港超期箱使费',
labelWidth: 110, name: 'LOAD_OVER_USECTNE_RATE'
}, {
fieldLabel: '目的港免箱使天数',
labelWidth: 110, name: 'DEST_FREE_USECTNE_DAY'
}, {
fieldLabel: '目的港超期箱使费',
labelWidth: 110, name: 'DEST_OVER_USECTNE_RATE'
}]
}, {
xtype: 'container',
layout: 'hbox',
flex: 1,
defaultType: 'textfield',
items: [{
fieldLabel: '罐箱价格',
labelWidth: 100, name: 'CTN_PRICE'
}, this.comboxCurr2, {
fieldLabel: '修改原因',
flex: 3,
name: 'REASON'
}]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
}); //end this.formEdit
this.winShenModifyShow = Ext.create('Ext.window.Window', {
title: "申请修改",
width: 980,
height: 260,
//plain : true,
layout: "border",
iconCls: "addicon",
resizable: false,
// 是否可以拖动
// draggable:false,
collapsible: true, // 允许缩放条
closeAction: 'close',
closable: true,
modal: 'true',
buttonAlign: "center",
bodyStyle: "padding:0 0 0 0",
items: [this.formMDEdit],
buttons: [{
text: "确认修改",
minWidth: 70,
handler: function () {
_this.onShenModifyClickfn()
}
}, {
text: "关闭",
minWidth: 70,
handler: function () {
_this.winShenModifyShow.close();
}
}]
});
//#endregion
}, //end initUIComponents
InitData: function () {
this.opStatus = 'add';
var condition = '';
if (this.isotheropen()) {
opstatus = "edit";
condition = " GID=(select gid from op_ctnapply where BSNO='" + getUrlParam("APPLYNO") + "') ";
this.LoadData(opstatus, condition);
}
else {
if (this.ParentWin) {
var ret = this.ParentWin.OprationSwap();
this.opStatus = ret[0];
this.StoreList = ret[1];
this.editRecord = ret[2];
}
if (this.opStatus == 'edit')
condition = " GID='" + this.editRecord.get('GID') + "'";
this.LoadData(this.opStatus, condition);
}
}, //end InitData
LoadData: function (opstatus, condition) {
this.serialNo = 0;
this.workSerialNo = 0;
this.bodyDel = [];
this.opStatus = opstatus;
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/MvcContainer/MsOpCtnApply/GetData',
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;
}
var data = result.data;
this.formEdit.getForm().reset();
this.formEdit.getForm().setValues(data);
this.formGoodsAudit.getForm().reset();
this.formGoodsAudit.getForm().setValues(data);
this.formCost.getForm().reset();
this.formCost.getForm().setValues(data);
this.formAudit.getForm().reset();
this.formAudit.getForm().setValues(data);
var acondition = "";
if (this.opStatus == 'edit') {
this.editGID = data.GID;
acondition = " LINKGID='" + this.editGID + "'";
}
else
acondition = " LINKGID='11111'";
this.storeBodyList.load({ params: { condition: acondition} });
this.storeBodyCostList.load({ params: { condition: acondition} });
this.storeBodyCostSum.load({ params: { condition: acondition} });
this.GetEditStatus();
this.LoadGoodsData("CHEMICALCGOODSNAME='" + data.GOODSNAME + "'");
this.SetAuditForm();
document.title = MODULENAME + "-" + data.BSNO;
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}, // end LoadDate
LoadGoodsData: function (condition) {
this.serialNo = 0;
this.workSerialNo = 0;
this.bodyDel = [];
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/MvcContainer/MsCodeMSDS/GetData',
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;
}
var data = result.data;
this.formGoodsAudit.getForm().reset();
this.formGoodsAudit.getForm().setValues(data);
this.formGoodsAudit.getForm().findField('MELTINGPOINT').setValue(data.MELTINGPOINTB + '~' + data.MELTINGPOINTE);
this.formGoodsAudit.getForm().findField('BOILINGPOINT').setValue(data.BOILINGPOINTB + '~' + data.BOILINGPOINTE);
this.formGoodsAudit.getForm().findField('FLASHPOINT').setValue(data.FLASHPOINTB + '~' + data.FLASHPOINTE);
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}, // end LoadDate
Save: function (type) {
var basicForm = this.formEdit.getForm();
if (!basicForm.isValid()) {
return;
}
this.opStatus == 'edit'
basicForm.findField('GID').setDisabled(false);
var data = basicForm.getValues(false, false, false);
basicForm.findField('GID').setDisabled(true);
var data2 = this.formCost.getForm().getValues(false, false, false);
var data3 = this.formAudit.getForm().getValues(false, false, false);
var j = 0;
var bodydatas = [];
for (var i = 0; i < this.storeBodyCostList.getCount(); i += 1) {
var member = this.storeBodyCostList.getAt(i);
j = j + 1;
bodydatas.push(member);
}
/*
if (j == 0) {
Ext.Msg.show({ title: '提示', msg: '运价信息不能为空,请先录入运价信息!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}*/
//
var jsonBody = ConvertRecordsToJsonAll(bodydatas);
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/MvcContainer/MsOpCtnApply/SaveCost',
scope: this,
params: {
data: Ext.JSON.encode(data),
data2: Ext.JSON.encode(data2),
data3: Ext.JSON.encode(data3),
body: jsonBody
},
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().setValues(returnData);
this.formGoodsAudit.getForm().reset();
this.formGoodsAudit.getForm().setValues(returnData);
this.formCost.getForm().reset();
this.formCost.getForm().setValues(returnData);
this.formAudit.getForm().reset();
this.formAudit.getForm().setValues(returnData);
this.LoadGoodsData("CHEMICALCGOODSNAME='" + returnData.GOODSNAME + "'");
if (this.opStatus == 'add') {
var arrNewRecords = this.StoreList.add(returnData);
this.editRecord = arrNewRecords[0];
}
else if (this.opStatus == 'edit') {
var editp = Ext.create('MsOpCtnApply', 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';
basicForm.findField('GID').setDisabled(true);
this.storeBodyCostList.load({ params: { condition: "LINKGID='" + this.editRecord.get('GID') + "'"} });
this.storeBodyCostSum.load({ params: { condition: "LINKGID='" + this.editRecord.get('GID') + "'"} });
} else if (type == '1') {
this.opStatus = 'edit';
basicForm.findField('GID').setDisabled(true);
this.storeBodyCostList.load({ params: { condition: "LINKGID='" + this.editRecord.get('GID') + "'"} });
window.close();
} else {
this.LoadData('add', '');
basicForm.findField('GID').setDisabled(false);
}
} 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
addDetail: function () {
window.open('/MvcContainer/MsOpPrice/AddIndex', "引入报价", 'width=1200,height=760,top=0,left=0,resizable=yes,status=yes,menubar=no,scrollbars=yes');
},
GetHandleSerialNo: function (store) {
var result = 0;
if (result == 0) {
for (var i = 0; i < store.getCount(); i += 1) {
var member = store.getAt(i);
if (parseInt(member.data.ITEMSNO) > parseInt(result)) {
result = member.data.ITEMSNO;
}
}
}
result = parseInt(result) + 1;
return result;
},
setHeadFieldValue: function (fieldName, value) {
var field = this.formCostAudit.getForm().findField(fieldName);
field.setValue(value);
},
setHeadCostFieldValue: function (fieldName, value) {
var field = this.formCost.getForm().findField(fieldName);
field.setValue(value);
},
gridListAfterEdit: function (editor, e, eOpts) {
if (e.value == e.originalValue) return;
if (e.field == 'UNITPRICE' || e.field == 'QUANTITY') {
var unitPrice = e.record.data['UNITPRICE'];
var quantity = e.record.data['QUANTITY'];
var amount = Mul(unitPrice, quantity);
e.record.set('AMOUNT', amount);
} else if (e.field == 'CURRENCY') {
if (e.value == 'RMB') {
e.record.set('EXCHANGERATE', 1);
} else {
var FFrecords = DsStoreQueryBy(this.StoreDateCurr, 'CURR', e.value);
if (FFrecords.getCount() > 0) {
var ffdata = FFrecords.getAt(0).data;
var DEFRATE = ffdata.DEFRATE;
e.record.set('EXCHANGERATE', DEFRATE);
} else {
var DFrecords = DsStoreQueryBy(this.StoreCurr, 'CURR', e.value);
if (DFrecords.getCount() > 0) {
var dfdata = DFrecords.getAt(0).data;
var DEFRATE = dfdata.DEFRATE;
e.record.set('EXCHANGERATE', DEFRATE);
} else {
e.record.set('EXCHANGERATE', 0);
}
}
}
}
},
calExchange: function (curr) {
var result = 1;
if (curr != 'RMB') {
var FFrecords = DsStoreQueryBy(this.StoreDateCurr, 'CURR', curr);
if (FFrecords.getCount() > 0) {
var ffdata = FFrecords.getAt(0).data;
result = ffdata.DEFRATE;
} else {
var DFrecords = DsStoreQueryBy(this.StoreCurr, 'CURR', curr);
if (DFrecords.getCount() > 0) {
var dfdata = DFrecords.getAt(0).data;
result = dfdata.DEFRATE;
} else {
}
}
}
return result;
},
onDeletePriceItemsClick: function () {
var selections = this.gridListCostBody.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择要删除的费用信息!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var record = selections[0];
Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) {
if (btn == 'yes') {
var bodyAddDatas = [];
for (var i = 0; i < selections.length; i++) {
var rec = selections[i];
bodyAddDatas.push(rec);
}
var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas);
Ext.Msg.wait('正在删除数据...');
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/MvcContainer/MsOpCtnApply/DeleteOpCtnApplyCostItems',
params: {
data: jsonbodyAddDatas
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var acondition = " LINKGID='" + this.editRecord.get('GID') + "'";
this.storeBodyCostList.load({ params: { condition: acondition} });
this.storeBodyCostSum.load({ params: { condition: acondition} });
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
}
}, this);
},
onCtnPriceChange: function () {
var basicForm = this.formAudit.getForm();
var COSTTTL = basicForm.findField('COSTTTL').getValue();
var CURR = basicForm.findField('CURRENCY').getValue();
var CYCLEDAYS = this.formCost.getForm().findField('CYCLEDAYS').getValue();
var newValue = basicForm.findField('CTN_PRICE').getValue();
var CTN_INCOME = 0
if (CURR == 'USD') {
if ((CYCLEDAYS != 0) && (CYCLEDAYS != null))
CTN_INCOME = Div(Add(newValue, -COSTTTL), CYCLEDAYS, 2);
else CTN_INCOME = 0;
} else {
var DEFRATE = 0;
var USDDEFRATE = 0;
var DFrecords = DsStoreQueryBy(this.StoreCurr, 'CURR', CURR);
if (DFrecords.getCount() > 0) {
var dfdata = DFrecords.getAt(0).data;
DEFRATE = dfdata.DEFRATE;
}
var DFrecords = DsStoreQueryBy(this.StoreCurr, 'CURR', 'USD');
if (DFrecords.getCount() > 0) {
var dfdata = DFrecords.getAt(0).data;
USDDEFRATE = dfdata.DEFRATE;
}
if ((CYCLEDAYS != 0) && (CYCLEDAYS != null)) {
var ttldr = Mul(newValue, DEFRATE, 4);
ttldr = Div(ttldr, USDDEFRATE, 4);
CTN_INCOME = Div(Add(ttldr, -COSTTTL), CYCLEDAYS, 2);
}
else CTN_INCOME = 0;
}
basicForm.findField('CTN_INCOME').setValue(CTN_INCOME); //CYCLEDAYS 周期
},
onOpAuditClick: function () {
var basicForm = this.formEdit.getForm();
var Duino = this.formEdit.getForm().findField('BSNO').getValue();
var GID = this.formEdit.getForm().findField('GID').getValue();
var billstatus = this.formAudit.getForm().findField('COSTAUDITSTATUS').getValue();
if ((billstatus != '未提交') && (billstatus != '驳回提交') && (billstatus != '')) {
Ext.Msg.show({ title: '提示', msg: '当前状态无法提交审核!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
basicForm.findField('GID').setDisabled(false);
var data = basicForm.getValues(false, false, false);
basicForm.findField('GID').setDisabled(true);
var data2 = this.formCost.getForm().getValues(false, false, false);
var data3 = this.formAudit.getForm().getValues(false, false, false);
var j = 0;
var bodydatas = [];
for (var i = 0; i < this.storeBodyCostList.getCount(); i += 1) {
var member = this.storeBodyCostList.getAt(i);
j = j + 1;
bodydatas.push(member);
}
// if (j == 0) {
// Ext.Msg.show({ title: '提示', msg: '运价信息不能为空,请先录入运价信息!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
// return;
// }
//
var jsonBody = ConvertRecordsToJsonAll(bodydatas);
_this = this;
Ext.Ajax.request({
waitMsg: '正在添加数据...',
url: '/MvcContainer/MsOpCtnApply/SubmitOpAudit',
params: {
data: Ext.JSON.encode(data),
data2: Ext.JSON.encode(data2),
data3: Ext.JSON.encode(data3),
body: jsonBody,
Audit: true
},
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: '/MvcContainer/MsOpCtnApply/GetData',
params: {
handle: 'edit',
condition: " GID='" + GID + "'"
},
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;
}
var data = result.data;
_this.formEdit.getForm().reset();
_this.formEdit.getForm().setValues(data);
// this.formGoodsAudit.getForm().reset();
// this.formGoodsAudit.getForm().setValues(data);
this.formCost.getForm().reset();
this.formCost.getForm().setValues(data);
this.formAudit.getForm().reset();
this.formAudit.getForm().setValues(data);
var editp = Ext.create('MsOpCtnApply', 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();
this.GetEditStatus();
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
},
onSubmitAuditClick: function () {
var basicForm = this.formEdit.getForm();
var Duino = this.formEdit.getForm().findField('BSNO').getValue();
var GID = this.formEdit.getForm().findField('GID').getValue();
var billstatus = this.formAudit.getForm().findField('COSTAUDITSTATUS').getValue();
if ((billstatus != '未提交') && (billstatus != '驳回提交') && (billstatus != '') ) {
Ext.Msg.show({ title: '提示', msg: '当前状态无法提交审核!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
basicForm.findField('GID').setDisabled(false);
var data = basicForm.getValues(false, false, false);
basicForm.findField('GID').setDisabled(true);
var data2 = this.formCost.getForm().getValues(false, false, false);
var data3 = this.formAudit.getForm().getValues(false, false, false);
var j = 0;
var bodydatas = [];
for (var i = 0; i < this.storeBodyCostList.getCount(); i += 1) {
var member = this.storeBodyCostList.getAt(i);
j = j + 1;
bodydatas.push(member);
}
if (j == 0) {
Ext.Msg.show({ title: '提示', msg: '运价信息不能为空,请先录入运价信息!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
//
var jsonBody = ConvertRecordsToJsonAll(bodydatas);
_this = this;
Ext.Ajax.request({
waitMsg: '正在添加数据...',
url: '/MvcContainer/MsOpCtnApply/SubmitCostAudit',
params: {
data: Ext.JSON.encode(data),
data2: Ext.JSON.encode(data2),
data3: Ext.JSON.encode(data3),
body: jsonBody,
Audit: true
},
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: '/MvcContainer/MsOpCtnApply/GetData',
params: {
handle: 'edit',
condition: " GID='" + GID + "'"
},
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;
}
var data = result.data;
_this.formEdit.getForm().reset();
_this.formEdit.getForm().setValues(data);
this.formGoodsAudit.getForm().reset();
this.formGoodsAudit.getForm().setValues(data);
this.formCost.getForm().reset();
this.formCost.getForm().setValues(data);
this.formAudit.getForm().reset();
this.formAudit.getForm().setValues(data);
var editp = Ext.create('MsOpCtnApply', 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();
this.GetEditStatus();
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
},
onSubmitAuditBackClick: function () {
var Duino = this.formEdit.getForm().findField('BSNO').getValue();
var GID = this.formEdit.getForm().findField('GID').getValue();
var billstatus = this.formAudit.getForm().findField('COSTAUDITSTATUS').getValue();
if (billstatus != '提交审核') {
Ext.Msg.show({ title: '提示', msg: '当前状态无法撤销提交!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
_this = this;
Ext.Ajax.request({
waitMsg: '正在添加数据...',
url: '/MvcContainer/MsOpCtnApply/SubmitCostAuditBack',
params: {
bill: GID
},
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: '/MvcContainer/MsOpCtnApply/GetData',
params: {
handle: 'edit',
condition: " GID='" + GID + "'"
},
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;
}
var data = result.data;
_this.formEdit.getForm().reset();
_this.formEdit.getForm().setValues(data);
this.formGoodsAudit.getForm().reset();
this.formGoodsAudit.getForm().setValues(data);
this.formCost.getForm().reset();
this.formCost.getForm().setValues(data);
this.formAudit.getForm().reset();
this.formAudit.getForm().setValues(data);
var editp = Ext.create('MsOpCtnApply', 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();
this.GetEditStatus();
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
},
onSaveAuditCostClick: function () {
var Duino = this.formEdit.getForm().findField('BSNO').getValue();
var GID = this.formEdit.getForm().findField('GID').getValue();
var basicForm = this.formEdit.getForm();
basicForm.findField('GID').setDisabled(false);
var data = basicForm.getValues(false, false, false);
basicForm.findField('GID').setDisabled(true);
var data2 = this.formCost.getForm().getValues(false, false, false);
var data3 = this.formAudit.getForm().getValues(false, false, false);
_this = this;
Ext.Ajax.request({
waitMsg: '正在添加数据...',
url: '/MvcContainer/MsOpCtnApply/SaveAuditCost',
params: {
data: Ext.JSON.encode(data),
data2: Ext.JSON.encode(data2),
data3: Ext.JSON.encode(data3)
},
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 {
this.LoadData('edit', " GID='" + GID + "'");
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
},
onAuditCostPassClick: function () {
var Duino = this.formEdit.getForm().findField('BSNO').getValue();
var GID = this.formEdit.getForm().findField('GID').getValue();
var billstatus = this.formAudit.getForm().findField('COSTAUDITSTATUS').getValue();
if (billstatus != '提交审核') {
Ext.Msg.show({ title: '提示', msg: '当前状态无法审核!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var basicForm = this.formEdit.getForm();
basicForm.findField('GID').setDisabled(false);
var data = basicForm.getValues(false, false, false);
basicForm.findField('GID').setDisabled(true);
var data2 = this.formCost.getForm().getValues(false, false, false);
var data3 = this.formAudit.getForm().getValues(false, false, false);
_this = this;
Ext.Ajax.request({
waitMsg: '正在添加数据...',
url: '/MvcContainer/MsOpCtnApply/AuditCostPass',
params: {
data: Ext.JSON.encode(data),
data2: Ext.JSON.encode(data2),
data3: Ext.JSON.encode(data3)
},
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 {
this.LoadData('edit', " GID='" + GID + "'");
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
},
onAuditCostBackClick: function () {
var Duino = this.formEdit.getForm().findField('BSNO').getValue();
var GID = this.formEdit.getForm().findField('GID').getValue();
var billstatus = this.formAudit.getForm().findField('MNGAUDITSTATUS').getValue();
if (billstatus == '审核通过') {
Ext.Msg.show({ title: '提示', msg: '总经理已审核,当前状态无法驳回!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
if (Duino == '*') {
Ext.Msg.show({ title: '提示', msg: '请先保存申请,然后才能提交审核!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
var AUDITRESULT = this.formAudit.getForm().findField('COSTAUDITRESULT').getValue();
if (AUDITRESULT == '') {
Ext.Msg.show({ title: '提示', msg: '驳回提交时,请把驳回原因录入审核反馈中!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
_this = this;
var basicForm = this.formEdit.getForm();
basicForm.findField('GID').setDisabled(false);
var data = basicForm.getValues(false, false, false);
basicForm.findField('GID').setDisabled(true);
var data2 = this.formCost.getForm().getValues(false, false, false);
var data3 = this.formAudit.getForm().getValues(false, false, false);
Ext.Ajax.request({
waitMsg: '正在添加数据...',
url: '/MvcContainer/MsOpCtnApply/AuditCostBack',
params: {
data: Ext.JSON.encode(data),
data2: Ext.JSON.encode(data2),
data3: Ext.JSON.encode(data3)
},
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 {
this.LoadData('edit', " GID='" + GID + "'");
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
},
onShenModifyClick: function () {
var Duino = this.formEdit.getForm().findField('BSNO').getValue();
var GID = this.formEdit.getForm().findField('GID').getValue();
var billstatus = this.formAudit.getForm().findField('COSTAUDITSTATUS').getValue();
if ((billstatus != '审核通过')&& (billstatus != '驳回申请修改')) {
Ext.Msg.show({ title: '提示', msg: '当前状态无法申请修改!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
this.formMDEdit.getForm().loadRecord(this.editRecord);
this.winShenModifyShow.show();
},
onShenModifyClickfn: function () {
var basicForm = this.formMDEdit.getForm();
if (!basicForm.isValid()) {
return;
}
basicForm.findField('GID').setDisabled(false);
var data = basicForm.getValues();
basicForm.findField('GID').setDisabled(true);
_this = this;
Ext.Ajax.request({
waitMsg: '正在添加数据...',
url: '/MvcContainer/MsOpCtnApply/ShenModifyCost',
params: {
type: '5',
data: Ext.JSON.encode(data)
},
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 {
var data = result.Data;
_this.formEdit.getForm().reset();
_this.formEdit.getForm().setValues(data);
this.formGoodsAudit.getForm().reset();
this.formGoodsAudit.getForm().setValues(data);
this.formCost.getForm().reset();
this.formCost.getForm().setValues(data);
this.formAudit.getForm().reset();
this.formAudit.getForm().setValues(data);
var editp = Ext.create('MsOpCtnApply', 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();
this.GetEditStatus();
_this.winShenModifyShow.close();
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
},
onShenModifyDelCancelClick: function (type) {
var Duino = this.formEdit.getForm().findField('BSNO').getValue();
var GID = this.formEdit.getForm().findField('GID').getValue();
var billstatus = this.formAudit.getForm().findField('COSTAUDITSTATUS').getValue();
if (type == '0') {
if ((billstatus != '申请修改')) {
Ext.Msg.show({ title: '提示', msg: '当前状态无法撤销申请修改!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
} else if (type == '3') {
if ((billstatus != '申请删除')) {
Ext.Msg.show({ title: '提示', msg: '当前状态无法撤销申请删除!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
}
_this = this;
Ext.Ajax.request({
waitMsg: '正在添加数据...',
url: '/MvcContainer/MsOpCtnApply/ShenModifyCostCancel',
params: {
GID: GID,
type: type
},
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 {
var data = result.Data;
_this.formEdit.getForm().reset();
_this.formEdit.getForm().setValues(data);
this.formGoodsAudit.getForm().reset();
this.formGoodsAudit.getForm().setValues(data);
this.formCost.getForm().reset();
this.formCost.getForm().setValues(data);
this.formAudit.getForm().reset();
this.formAudit.getForm().setValues(data);
var editp = Ext.create('MsOpCtnApply', 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();
this.GetEditStatus();
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
},
onACCAuditClick: function (type) {
var Duino = this.formEdit.getForm().findField('BSNO').getValue();
var GID = this.formEdit.getForm().findField('GID').getValue();
var billstatus = this.formAudit.getForm().findField('ACCAUDITSTATUS').getValue();
if (type == '1') {
if (billstatus == '审核通过') {
Ext.Msg.show({ title: '提示', msg: '当前状态无法审核!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
} else {
var mngstatus = this.formAudit.getForm().findField('MNGAUDITSTATUS').getValue();
if (billstatus != '审核通过' || mngstatus=='审核通过') {
Ext.Msg.show({ title: '提示', msg: '当前状态无法审核!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
}
var basicForm = this.formEdit.getForm();
basicForm.findField('GID').setDisabled(false);
var data = basicForm.getValues(false, false, false);
basicForm.findField('GID').setDisabled(true);
var data2 = this.formCost.getForm().getValues(false, false, false);
var data3 = this.formAudit.getForm().getValues(false, false, false);
_this = this;
Ext.Ajax.request({
waitMsg: '正在添加数据...',
url: '/MvcContainer/MsOpCtnApply/AccAudit',
params: {
data: Ext.JSON.encode(data),
data2: Ext.JSON.encode(data2),
data3: Ext.JSON.encode(data3),
type: type
},
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 {
this.LoadData('edit', " GID='" + GID + "'");
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
},
onBSAuditClick: function (type) {
var Duino = this.formEdit.getForm().findField('BSNO').getValue();
var GID = this.formEdit.getForm().findField('GID').getValue();
var billstatus = this.formAudit.getForm().findField('BSAUDITSTATUS').getValue();
if (type == '1') {
if (billstatus == '审核通过') {
Ext.Msg.show({ title: '提示', msg: '当前状态无法审核!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
} else {
var mngstatus = this.formAudit.getForm().findField('MNGAUDITSTATUS').getValue();
if (billstatus != '审核通过' || mngstatus=='审核通过') {
Ext.Msg.show({ title: '提示', msg: '当前状态无法审核!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
}
var basicForm = this.formEdit.getForm();
basicForm.findField('GID').setDisabled(false);
var data = basicForm.getValues(false, false, false);
basicForm.findField('GID').setDisabled(true);
var data2 = this.formCost.getForm().getValues(false, false, false);
var data3 = this.formAudit.getForm().getValues(false, false, false);
_this = this;
Ext.Ajax.request({
waitMsg: '正在添加数据...',
url: '/MvcContainer/MsOpCtnApply/BsAudit',
params: {
data: Ext.JSON.encode(data),
data2: Ext.JSON.encode(data2),
data3: Ext.JSON.encode(data3),
type: type
},
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 {
this.LoadData('edit', " GID='" + GID + "'");
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
},
onMNGAuditPassClick: function () {
var Duino = this.formEdit.getForm().findField('BSNO').getValue();
var GID = this.formEdit.getForm().findField('GID').getValue();
var billstatus = this.formAudit.getForm().findField('MNGAUDITSTATUS').getValue();
if (billstatus != '提交审核') {
Ext.Msg.show({ title: '提示', msg: '当前状态无法审核!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var basicForm = this.formEdit.getForm();
basicForm.findField('GID').setDisabled(false);
var data = basicForm.getValues(false, false, false);
basicForm.findField('GID').setDisabled(true);
var data2 = this.formCost.getForm().getValues(false, false, false);
var data3 = this.formAudit.getForm().getValues(false, false, false);
_this = this;
Ext.Ajax.request({
waitMsg: '正在添加数据...',
url: '/MvcContainer/MsOpCtnApply/MNGAuditPass',
params: {
data: Ext.JSON.encode(data),
data2: Ext.JSON.encode(data2),
data3: Ext.JSON.encode(data3)
},
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 {
this.LoadData('edit', " GID='" + GID + "'");
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
},
onMNGAuditBackClick: function () {
var Duino = this.formEdit.getForm().findField('BSNO').getValue();
var GID = this.formEdit.getForm().findField('GID').getValue();
var billstatus = this.formEdit.getForm().findField('ADDCTNSTATUS').getValue();
if (billstatus == '配箱完成') {
Ext.Msg.show({ title: '提示', msg: '配箱完成无法驳回!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var AUDITRESULT = this.formAudit.getForm().findField('MNGAUDITRESULT').getValue();
if (AUDITRESULT == '') {
Ext.Msg.show({ title: '提示', msg: '驳回提交时,请把驳回原因录入审核反馈中!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
_this = this;
var basicForm = this.formEdit.getForm();
basicForm.findField('GID').setDisabled(false);
var data = basicForm.getValues(false, false, false);
basicForm.findField('GID').setDisabled(true);
var data2 = this.formCost.getForm().getValues(false, false, false);
var data3 = this.formAudit.getForm().getValues(false, false, false);
Ext.Ajax.request({
waitMsg: '正在添加数据...',
url: '/MvcContainer/MsOpCtnApply/MNGAuditBack',
params: {
data: Ext.JSON.encode(data),
data2: Ext.JSON.encode(data2),
data3: Ext.JSON.encode(data3)
},
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 {
this.LoadData('edit', " GID='" + GID + "'");
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
},
SetAuditForm: function () {
if (CostAudit == "1") {
SetFormReadOnly(this.formCost, true);
this.formAudit.getForm().findField('COSTAUDITRESULT').setReadOnly(false);
this.formAudit.getForm().findField('CTN_PRICE').setReadOnly(false);
this.formAudit.getForm().findField('CURRENCY').setReadOnly(false);
this.formAudit.getForm().findField('CTN_INCOME').setReadOnly(false);
this.formAudit.getForm().findField('LOAD_FREE_USECTNE_DAY').setReadOnly(false);
this.formAudit.getForm().findField('LOAD_OVER_USECTNE_RATE').setReadOnly(false);
this.formAudit.getForm().findField('DEST_FREE_USECTNE_DAY').setReadOnly(false);
this.formAudit.getForm().findField('DEST_OVER_USECTNE_RATE').setReadOnly(false);
} else {
SetFormReadOnly(this.formCost, false);
// this.formAudit.getForm().findField('CTN_PRICE').setReadOnly(true);
//this.formAudit.getForm().findField('CTN_INCOME').setReadOnly(true);
//this.formAudit.getForm().findField('LOAD_FREE_USECTNE_DAY').setReadOnly(true);
// this.formAudit.getForm().findField('LOAD_OVER_USECTNE_RATE').setReadOnly(true);
// this.formAudit.getForm().findField('DEST_FREE_USECTNE_DAY').setReadOnly(true);
//this.formAudit.getForm().findField('DEST_OVER_USECTNE_RATE').setReadOnly(true);
}
},
PrevRecord: function () {
var modifystr = this.getIsModify();
if (modifystr != "") {
Ext.Msg.show({ title: '警告', msg: modifystr + '未保存,如果离开此页,将丢失未保存的更改 ', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
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;
}
var condition = '';
j = j - 1;
this.editRecord = this.StoreList.getAt(j);
if (this.opStatus == 'edit') {
condition = "GID='" + this.editRecord.get('GID') + "'";
//this.storeBodyList.load({ params: { condition: condition} });
}
this.LoadData(this.opStatus, condition);
},
// #region 编辑时按钮等的状态
GetEditStatus: function () {
var canedit = false;
var op = this.formEdit.getForm().findField('INPUTBY').getValue();
var modustr = "modOpCtnApply";
this.StoreOpRange = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsOP',
proxy: { url: '/MvcShipping/MsBaseInfo/GetOpIDRang' }
});
_this = this;
this.StoreOpRange.load({ params: { optype: modustr },
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;
}
} else { canedit = false; }
_this.setSaveBtnStatus(canedit);
}
}
});
if (this.isotheropen()) {
_this.setSaveBtnStatus(false);
}
},
setSaveBtnStatus: function (enable) {
var btnESave = Ext.getCmp('btnsave');
var btnSubmitAudit = Ext.getCmp('btnSubmitAudit');
var btnSubmitAuditBack = Ext.getCmp('btnSubmitAuditBack');
var btnAuditPass = Ext.getCmp('btnAuditPass');
var btnAuditBack = Ext.getCmp('btnAuditBack');
var btnadddetail = Ext.getCmp('btnadddetail');
var btndeldetail = Ext.getCmp('btndeldetail');
var btnAccAudit = Ext.getCmp('AccAudit');
var btnBsAudit = Ext.getCmp('BsAudit');
if (enable) {
var COSTAUDITSTATUS = this.formAudit.getForm().findField('COSTAUDITSTATUS').getValue();
if (CostAudit == "1") {
if (COSTAUDITSTATUS == '审核通过' || COSTAUDITSTATUS == '驳回申请修改' || COSTAUDITSTATUS == '申请修改') {
btnAuditPass.disable();
btnAuditBack.enable();
btnESave.disable();
} else {
btnAuditPass.enable();
btnAuditBack.enable();
btnESave.enable();
}
btnSubmitAudit.disable();
btnSubmitAuditBack.disable();
btnadddetail.disable();
btndeldetail.disable();
} else {
var btnOpSubmitAudit = Ext.getCmp('btnOpSubmitAudit');
if (COSTAUDITSTATUS == '审核通过' || COSTAUDITSTATUS == '驳回申请修改' || COSTAUDITSTATUS == '申请修改') {
btnESave.disable();
btnSubmitAudit.disable();
btnSubmitAuditBack.disable();
btnadddetail.disable();
btndeldetail.disable();
btnAuditPass.disable();
btnAuditBack.disable();
btnOpSubmitAudit.disable();
} else {
if (COSTAUDITSTATUS == '提交审核') {
btnESave.disable();
btnSubmitAudit.disable();
btnSubmitAuditBack.enable();
btnadddetail.disable();
btndeldetail.disable();
btnAuditPass.disable();
btnAuditBack.disable();
btnOpSubmitAudit.disable();
} else {
btnESave.enable();
btnSubmitAudit.enable();
btnSubmitAuditBack.disable();
btnadddetail.enable();
btndeldetail.enable();
btnAuditPass.disable();
btnAuditBack.disable();
btnOpSubmitAudit.enable();
}
}
}
} else {
btnESave.disable();
btnSubmitAudit.disable();
btnSubmitAuditBack.disable();
btnadddetail.disable();
btndeldetail.disable();
btnAuditPass.disable();
btnAuditBack.disable();
if (!isNullorEmpty(btnAccAudit))
btnAccAudit.disable();
if (!isNullorEmpty(btnBsAudit))
btnBsAudit.disable();
}
if (CostAudit == "1") {
var btnMNGAuditPass = Ext.getCmp('btnMNGAuditPass');
var btnMNGAuditBack = Ext.getCmp('btnMNGAuditBack');
Ext.Ajax.request({
waitMsg: '',
url: '/MvcShipping/MsBaseInfo/GetUserModuleEnable',
params: {
modulename: "APPLYMNGAUDIT"
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (result.Success != true) {
btnMNGAuditPass.disable();
btnMNGAuditBack.disable();
} else {
btnMNGAuditPass.enable();
btnMNGAuditBack.enable();
}
} else {
}
},
scope: this
});
Ext.Ajax.request({
waitMsg: '',
url: '/MvcShipping/MsBaseInfo/GetUserModuleEnable',
params: {
modulename: "APPLYACCAUDIT"
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (result.Success != true) {
btnAccAudit.disable();
} else {
btnAccAudit.enable();
}
} else {
}
},
scope: this
});
Ext.Ajax.request({
waitMsg: '',
url: '/MvcShipping/MsBaseInfo/GetUserModuleEnable',
params: {
modulename: "APPLYBSAUDIT"
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (result.Success != true) {
btnBsAudit.disable();
} else {
btnBsAudit.enable();
}
} else {
}
},
scope: this
});
}
},
//#endregion
NextRecord: function () {
var modifystr = this.getIsModify();
if (modifystr != "") {
Ext.Msg.show({ title: '警告', msg: modifystr + '未保存,如果离开此页,将丢失未保存的更改 ', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
var j = this.StoreList.indexOf(this.editRecord);
if (j == (this.StoreList.data.length - 1)) {
Ext.Msg.show({ title: '警告', msg: '已是最后一票', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
var condition = '';
j = j + 1;
this.editRecord = this.StoreList.getAt(j);
if (this.opStatus == 'edit') {
condition = "GID='" + this.editRecord.get('GID') + "'";
//this.storeBodyList.load({ params: { condition: condition} });
}
this.LoadData(this.opStatus, condition);
},
getIsModify: function () {
var drmodify = this.storeBodyCostList.getModifiedRecords();
if (drmodify.length != 0)
return '成本明细';
var isadd = false;
for (i = 0; i < this.storeBodyCostList.getCount(); i += 1) {
var memberyf = this.storeBodyCostList.getAt(i);
if (memberyf.data.LINKGID == "*") isadd = true;
};
if (isadd) return '成本明细';
if (panelEdit.formEdit.getForm().isDirty() == true)
return '申请信息';
else return '';
} //
, isotheropen: function () {
if (isNullorEmpty(this.openertype)) return false;
return true;
}
, opener: function () {
return this.openertype;
}
});