|
|
Ext.namespace('Shipping');
|
|
|
|
|
|
Shipping.CRM_QUOTATIONEdit = function (config) {
|
|
|
Ext.applyIf(this, config);
|
|
|
this.initUIComponents();
|
|
|
window.Shipping.CRM_QUOTATIONEdit.superclass.constructor.call(this);
|
|
|
};
|
|
|
|
|
|
|
|
|
Date.prototype.format = function (format) {
|
|
|
var o = {
|
|
|
"M+": this.getMonth() + 1, //month
|
|
|
"d+": this.getDate(), //day
|
|
|
"h+": this.getHours(), //hour
|
|
|
"m+": this.getMinutes(), //minute
|
|
|
"s+": this.getSeconds(), //second
|
|
|
"q+": Math.floor((this.getMonth() + 3) / 3), //quarter
|
|
|
"S": this.getMilliseconds() //millisecond
|
|
|
}
|
|
|
if (/(y+)/.test(format)) format = format.replace(RegExp.$1,
|
|
|
(this.getFullYear() + "").substr(4 - RegExp.$1.length));
|
|
|
for (var k in o) if (new RegExp("(" + k + ")").test(format))
|
|
|
format = format.replace(RegExp.$1,
|
|
|
RegExp.$1.length == 1 ? o[k] :
|
|
|
("00" + o[k]).substr(("" + o[k]).length));
|
|
|
return format;
|
|
|
}
|
|
|
|
|
|
var xhr = new XMLHttpRequest();
|
|
|
var currdate = new Date();
|
|
|
if (!xhr) {
|
|
|
//...其他生成xmlhttprequest方法
|
|
|
}
|
|
|
xhr.open("HEAD", location.href, true);
|
|
|
xhr.onreadystatechange = function () {
|
|
|
if (xhr.readyState == 4 && xhr.status == 200) {
|
|
|
var datestr = xhr.getResponseHeader("Date");
|
|
|
currdate = new Date(datestr);
|
|
|
// alert(currdate.format('yyyy-MM-dd'));
|
|
|
}
|
|
|
}
|
|
|
xhr.send(null);
|
|
|
|
|
|
Ext.extend(Shipping.CRM_QUOTATIONEdit, Ext.Panel, {
|
|
|
ParentWin: null,
|
|
|
OpStatus: 'add',
|
|
|
StoreList: null,
|
|
|
editRecord: null,
|
|
|
Editdata: null,
|
|
|
MainEditRecord: null,
|
|
|
stroplb: '客户询价',
|
|
|
isfen: false,
|
|
|
MainOpStatus: 'add',
|
|
|
//HBLNO:"",
|
|
|
initUIComponents: function () {
|
|
|
this.serialNo = 0;
|
|
|
//this.bodyDel = [];
|
|
|
this.itemindex = 1;
|
|
|
this.initloaddata = 0;
|
|
|
this.DetailDel = [];
|
|
|
this.CHILDGID = "";
|
|
|
this.CARRIER = "";
|
|
|
//#region 枚举参照
|
|
|
|
|
|
//客户加载_委托单位
|
|
|
this.storeCustCode = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'DsShipping.ux.CustomRefModel',
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
|
|
|
});
|
|
|
|
|
|
//委托单位
|
|
|
this.comboxCustCode = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: '客户名称',
|
|
|
store: this.storeCustCode,
|
|
|
forceSelection: true,
|
|
|
name: 'CLIENTGID', id: "CLIENTGID",
|
|
|
valueField: 'GId',
|
|
|
displayField: 'CodeAndName',
|
|
|
allowBlank: false,
|
|
|
listeners: {
|
|
|
scope: this,
|
|
|
'select': function (combo, records, eOpts) {
|
|
|
if (records.length > 0) {
|
|
|
var data = combo.value;
|
|
|
this.formEdit.getForm().findField('SALE').setValue(records[0].data.SALE);
|
|
|
this.formEdit.getForm().findField('SHORTNAME').setValue(records[0].data.CustName);
|
|
|
this.formEdit.getForm().findField('DESCRIPTION').setValue(records[0].data.DESCRIPTION);
|
|
|
|
|
|
var s = " LINKID ='" + combo.value + "'";
|
|
|
this.storeInfoClientContact.load({ params: { condition: s },
|
|
|
callback: function (r, options, success) {
|
|
|
if (success) {
|
|
|
if (this.storeInfoClientContact.getCount() > 0) {
|
|
|
var member = this.storeInfoClientContact.getAt(0);
|
|
|
this.comboxInfoClientContact.setValue(member.data.SHOWNAME);
|
|
|
//this.formHead.getForm().findField('OPERATOREMAIL').setValue(member.data.EMAIL);
|
|
|
//this.formHead.getForm().findField('OPERATORTEL').setValue(member.data.TEL);
|
|
|
//this.formHead.getForm().findField('OPERATORFAX').setValue(member.data.FAX);
|
|
|
} else {
|
|
|
this.comboxInfoClientContact.setValue('');
|
|
|
//this.formHead.getForm().findField('OPERATOREMAIL').setValue('');
|
|
|
//this.formHead.getForm().findField('OPERATORTEL').setValue('');
|
|
|
//this.formHead.getForm().findField('OPERATORFAX').setValue('');
|
|
|
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
});
|
|
|
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
//委托单位_联系人
|
|
|
this.storeInfoClientContact = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'DsShipping.ux.InfoClientContactModel',
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetInfoClientContactList' }
|
|
|
});
|
|
|
|
|
|
this.comboxInfoClientContact = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: '联系人',
|
|
|
store: this.storeInfoClientContact,
|
|
|
forceSelection: true,
|
|
|
name: 'CONTACTNAME', id: "CONTACTNAME",
|
|
|
valueField: 'SHOWNAME',
|
|
|
displayField: 'SHOWNAME',
|
|
|
listeners: {
|
|
|
blur: function (field, eOpts) {
|
|
|
//alert(field.displayTplData[0].EMAIL);
|
|
|
Ext.getCmp("BJEMAIL").setValue(field.displayTplData[0].EMAIL);
|
|
|
},
|
|
|
scope: this
|
|
|
}
|
|
|
});
|
|
|
|
|
|
this.storeInfoClientContact2 = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'DsShipping.ux.InfoClientContactModel',
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetInfoClientContactList' }
|
|
|
});
|
|
|
|
|
|
this.comboxInfoClientContact2 = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
//fieldLabel: '联系人',
|
|
|
store: this.storeInfoClientContact2,
|
|
|
forceSelection: true,
|
|
|
name: 'CONTACTNAME',
|
|
|
valueField: 'SHOWNAME',
|
|
|
displayField: 'SHOWNAME'
|
|
|
});
|
|
|
|
|
|
this.storeOpCode = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'DsShipping.ux.UserRefModel',
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetUserLinkRefList' }
|
|
|
});
|
|
|
this.comboxSALE = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: '揽货人',
|
|
|
store: this.storeOpCode,
|
|
|
forceSelection: true,
|
|
|
name: 'SALE',
|
|
|
valueField: 'UserName',
|
|
|
displayField: 'CodeAndName'
|
|
|
});
|
|
|
|
|
|
this.storeOpCode2 = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'DsShipping.ux.UserRefModel',
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetUserLinkRefList' }
|
|
|
});
|
|
|
this.comboxOP = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: '创建人', readOnly: true, labelWidth: 70,
|
|
|
store: this.storeOpCode2,
|
|
|
forceSelection: true,
|
|
|
name: 'CREATEUSER',
|
|
|
valueField: 'UserName',
|
|
|
displayField: 'CodeAndName',
|
|
|
value: SHOWNAME
|
|
|
});
|
|
|
|
|
|
this.storeCodeLoadport = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'DsShipping.ux.CodeLoadportModel',
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetCodeLoadportList' }
|
|
|
});
|
|
|
this.storeCodeLoadport.load();
|
|
|
this.comboxPORTLOAD = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: '装货港',
|
|
|
allowBlank: false,
|
|
|
store: this.storeCodeLoadport,
|
|
|
name: 'PORTLOAD', id: "PORTLOAD",
|
|
|
valueField: 'EDICODE',
|
|
|
displayField: 'CodeAndName',
|
|
|
forceSelection: true,
|
|
|
matchFieldWidth: false
|
|
|
});
|
|
|
|
|
|
this.storeCodeLoadport2 = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'DsShipping.ux.CodeLoadportModel',
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetCodeLoadportList' }
|
|
|
});
|
|
|
this.storeCodeLoadport2.load();
|
|
|
this.comboxPORTLOAD2 = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
//fieldLabel: '装货港',
|
|
|
store: this.storeCodeLoadport2,
|
|
|
name: 'PORTLOAD', //id: "PORTLOAD",
|
|
|
valueField: 'EDICODE',
|
|
|
displayField: 'CodeAndName',
|
|
|
forceSelection: true,
|
|
|
matchFieldWidth: false
|
|
|
});
|
|
|
|
|
|
this.storeCodeDisport = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'DsShipping.ux.CodeDisportModel',
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetCodeDisportList' }
|
|
|
});
|
|
|
this.storeCodeDisport.load();
|
|
|
this.comboxPORTDISCHARGE = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: '卸货港',
|
|
|
allowBlank: false,
|
|
|
store: this.storeCodeDisport,
|
|
|
name: 'PORTDISCHARGE', id: "PORTDISCHARGE",
|
|
|
forceSelection: true,
|
|
|
valueField: 'EDICODE',
|
|
|
queryMode: 'local',
|
|
|
displayField: 'CodeAndName'
|
|
|
});
|
|
|
|
|
|
this.storeCodeDisport2 = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'DsShipping.ux.CodeDisportModel',
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetCodeDisportList' }
|
|
|
});
|
|
|
this.storeCodeDisport2.load();
|
|
|
this.comboxPORTDISCHARGE2 = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
//fieldLabel: '卸货港',
|
|
|
store: this.storeCodeDisport2,
|
|
|
name: 'PORTDISCHARGE', // id: "PORTDISCHARGE",
|
|
|
forceSelection: true,
|
|
|
valueField: 'EDICODE',
|
|
|
displayField: 'CodeAndName',
|
|
|
forceSelection: true,
|
|
|
matchFieldWidth: false
|
|
|
});
|
|
|
|
|
|
this.storeENTREPORT = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'DsShipping.ux.CodeDisportModel',
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetCodeDisportList' }
|
|
|
});
|
|
|
this.storeENTREPORT.load();
|
|
|
this.comboxENTREPORT = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: '中转港',
|
|
|
store: this.storeENTREPORT,
|
|
|
name: 'ENTREPORT',
|
|
|
forceSelection: true,
|
|
|
valueField: 'EDICODE',
|
|
|
queryMode: 'local',
|
|
|
displayField: 'CodeAndName'
|
|
|
});
|
|
|
|
|
|
this.storeBLSTATUS = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'DsExtEnumModel',
|
|
|
proxy: { url: '/CommMng/PubSys/GetEnumValueList' }
|
|
|
});
|
|
|
this.storeBLSTATUS.load({ params: { enumTypeId: 39} });
|
|
|
|
|
|
this.comboxBLSTATUS = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: '询价状态', readOnly: true,
|
|
|
store: this.storeBLSTATUS,
|
|
|
forceSelection: true,
|
|
|
name: 'BLSTATUS',
|
|
|
valueField: 'EnumValueId',
|
|
|
displayField: 'EnumValueName'
|
|
|
});
|
|
|
|
|
|
this.StoreBLTYPE = Ext.create('Ext.data.Store', {
|
|
|
fields: ['BLTYPE']
|
|
|
});
|
|
|
//this.StoreBLTYPE.add({ "BLTYPE": "空运单票" });
|
|
|
this.StoreBLTYPE.add({ "BLTYPE": "客户询价" });
|
|
|
this.StoreBLTYPE.add({ "BLTYPE": "供应商报价" });
|
|
|
|
|
|
|
|
|
this.comboxBLTYPE = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: '报价单类型',
|
|
|
readOnly: true,
|
|
|
store: this.StoreBLTYPE,
|
|
|
forceSelection: true,
|
|
|
name: 'BLTYPE',
|
|
|
valueField: 'BLTYPE',
|
|
|
displayField: 'BLTYPE',
|
|
|
value: BLTYPE
|
|
|
});
|
|
|
|
|
|
this.storeCompany = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'companymb', proxy: { url: '/CommMng/BasicDataRef/GetcompanyList' }
|
|
|
});
|
|
|
this.storeCompany.load({ params: { condition: ""} });
|
|
|
this.comboxCompany = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: '所属分公司', hidden: true,
|
|
|
forceSelection: true,
|
|
|
store: this.storeCompany,
|
|
|
name: 'CORPID',
|
|
|
valueField: 'gid',
|
|
|
displayField: 'name'
|
|
|
});
|
|
|
|
|
|
this.storeCARRIER = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'DsShipping.ux.CustomRefModel',
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
|
|
|
});
|
|
|
|
|
|
//船公司
|
|
|
this.comboxCARRIER = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: '船公司', hidden: true,
|
|
|
store: this.storeCARRIER,
|
|
|
forceSelection: true,
|
|
|
name: 'CARRIER',
|
|
|
valueField: 'CustName',
|
|
|
displayField: 'CodeAndName'
|
|
|
});
|
|
|
this.comboxCARRIER4 = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
//fieldLabel: '船公司',
|
|
|
store: this.storeCARRIER,
|
|
|
forceSelection: true,
|
|
|
name: 'CARRIER',
|
|
|
valueField: 'CustName',
|
|
|
displayField: 'CodeAndName'
|
|
|
});
|
|
|
|
|
|
|
|
|
this.storeCtn = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'DsShipping.ux.CodeCtnModel',
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetCodeCtnList' }
|
|
|
});
|
|
|
this.storeCtn2 = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'DsShipping.ux.CodeCtnModel',
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetCodeCtnList' }
|
|
|
});
|
|
|
|
|
|
this.comboxCTN = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: '其它箱型1', flex: 4,
|
|
|
store: this.storeCtn, id: "CTN",
|
|
|
forceSelection: true,
|
|
|
name: 'CTN',
|
|
|
valueField: 'CTN',
|
|
|
displayField: 'CTN',
|
|
|
listeners: {
|
|
|
change: function (field, newValue, oldValue) {
|
|
|
if (newValue == "") {
|
|
|
this.DosetCTNhidden("CTNPRICE", newValue, 0);
|
|
|
} else {
|
|
|
this.DosetCTNhidden("CTNPRICE", newValue, 1);
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
}
|
|
|
});
|
|
|
this.comboxCTN2 = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: '其它箱型2', flex: 4,
|
|
|
store: this.storeCtn2, id: "CTN2",
|
|
|
forceSelection: true,
|
|
|
name: 'CTN2',
|
|
|
valueField: 'CTN',
|
|
|
displayField: 'CTN',
|
|
|
listeners: {
|
|
|
change: function (field, newValue, oldValue) {
|
|
|
if (newValue == "") {
|
|
|
this.DosetCTNhidden("CTNPRICE2", newValue, 0);
|
|
|
} else {
|
|
|
this.DosetCTNhidden("CTNPRICE2", newValue, 1);
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
}
|
|
|
});
|
|
|
|
|
|
|
|
|
//#endregion
|
|
|
|
|
|
//#region 编辑formEdit 基本信息
|
|
|
var _this = this;
|
|
|
this.formEdit = Ext.widget('form', {
|
|
|
region: 'north', id: "formEdit",
|
|
|
frame: true,
|
|
|
bodyPadding: 5,
|
|
|
//height:500,
|
|
|
|
|
|
trackResetOnLoad: true,
|
|
|
fieldDefaults: {
|
|
|
margins: '2 2 2 2',
|
|
|
labelAlign: 'right',
|
|
|
flex: 1,
|
|
|
labelWidth: 70,
|
|
|
msgTarget: 'qtip'
|
|
|
},
|
|
|
|
|
|
items: [{
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [{
|
|
|
fieldLabel: 'GID',
|
|
|
name: 'GID', hidden: true
|
|
|
}, {
|
|
|
fieldLabel: '时间戳',
|
|
|
name: 'TimeMark', flex: 0, hidden: true, margins: '0'
|
|
|
}, this.comboxBLTYPE
|
|
|
, this.comboxBLSTATUS
|
|
|
, this.comboxCustCode
|
|
|
, {
|
|
|
fieldLabel: '客户简称',
|
|
|
name: 'SHORTNAME', hidden: true
|
|
|
}, {
|
|
|
fieldLabel: '客户全称',
|
|
|
name: 'DESCRIPTION', flex: 1
|
|
|
}, this.comboxSALE]
|
|
|
}, {
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [
|
|
|
{
|
|
|
fieldLabel: '询价日期',
|
|
|
name: 'ASKDATE',
|
|
|
format: 'Y-m-d',
|
|
|
flex: 1,
|
|
|
xtype: 'datefield'
|
|
|
},
|
|
|
{
|
|
|
fieldLabel: '报价日期',
|
|
|
format: 'Y-m-d',
|
|
|
flex: 1,
|
|
|
xtype: 'datefield',
|
|
|
name: 'QUOTATIONDATE'
|
|
|
}, {
|
|
|
fieldLabel: '有效期', hidden: true,
|
|
|
name: 'VALIDDATE',
|
|
|
format: 'Y-m-d',
|
|
|
flex: 1,
|
|
|
xtype: 'datefield'
|
|
|
}, this.comboxInfoClientContact
|
|
|
, {
|
|
|
fieldLabel: 'EMAIL', hidden: true,
|
|
|
name: 'EMAIL',
|
|
|
flex: 1, id: "BJEMAIL"
|
|
|
},
|
|
|
, this.comboxCompany
|
|
|
, this.comboxPORTLOAD
|
|
|
, this.comboxPORTDISCHARGE
|
|
|
|
|
|
]
|
|
|
}, {
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [
|
|
|
|
|
|
this.comboxCARRIER, {
|
|
|
fieldLabel: '航线', hidden: true,
|
|
|
name: 'LANE'
|
|
|
}, {
|
|
|
fieldLabel: 'ETD',
|
|
|
allowBlank: false,
|
|
|
format: 'Y-m-d',
|
|
|
xtype: 'datefield',
|
|
|
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
|
|
|
name: 'ETD',
|
|
|
listeners: {
|
|
|
scope: this,
|
|
|
'change': function (field, newValue, oldValue) {
|
|
|
var _d = new Date(field.rawValue);
|
|
|
var week = "星期" + "日一二三四五六".split("")[_d.getDay()];
|
|
|
_this.formEdit.getForm().findField('WEEK').setValue(week);
|
|
|
|
|
|
var form = Ext.getCmp("formEdit");
|
|
|
if (form.getForm().findField('ETA').getRawValue() != "") {
|
|
|
var startdate = form.getForm().findField('ETD').getRawValue();
|
|
|
var enddate = form.getForm().findField('ETA').getRawValue();
|
|
|
|
|
|
|
|
|
var _e = Ext.util.Format.date(startdate); //格式化日期控件值
|
|
|
var _s = Ext.util.Format.date(enddate); //格式化日期控件值
|
|
|
|
|
|
var end = new Date(_s);
|
|
|
var start = new Date(_e);
|
|
|
|
|
|
var elapsed = Math.round((end.getTime() - start.getTime()) / (86400000)) + 1; // 计算间隔日数
|
|
|
//e.record.set('text',_s);
|
|
|
|
|
|
form.getForm().findField('TT').setValue(elapsed);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}, {
|
|
|
fieldLabel: '开船日周几', readOnly: true,
|
|
|
name: 'WEEK'
|
|
|
}
|
|
|
, {
|
|
|
fieldLabel: 'ETA',
|
|
|
format: 'Y-m-d',
|
|
|
xtype: 'datefield',
|
|
|
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
|
|
|
name: 'ETA',
|
|
|
listeners: {
|
|
|
//添加日期选择事件
|
|
|
"change": function () {
|
|
|
|
|
|
var form = Ext.getCmp("formEdit");
|
|
|
if (form.getForm().findField('ETD').getRawValue() != "") {
|
|
|
var startdate = form.getForm().findField('ETD').getRawValue();
|
|
|
var enddate = form.getForm().findField('ETA').getRawValue();
|
|
|
|
|
|
var _e = Ext.util.Format.date(startdate); //格式化日期控件值
|
|
|
var _s = Ext.util.Format.date(enddate); //格式化日期控件值
|
|
|
|
|
|
var end = new Date(_s);
|
|
|
var start = new Date(_e);
|
|
|
|
|
|
var elapsed = Math.round((end.getTime() - start.getTime()) / (86400000)) + 1; // 计算间隔日数
|
|
|
//e.record.set('text',_s);
|
|
|
|
|
|
form.getForm().findField('TT').setValue(elapsed);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}, this.comboxENTREPORT, { xtype: 'hiddenfield', flex: 1 }
|
|
|
|
|
|
]
|
|
|
}, {
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox', labelWidth: 70,
|
|
|
defaultType: 'textfield',
|
|
|
items: [
|
|
|
|
|
|
|
|
|
{
|
|
|
fieldLabel: '航程',
|
|
|
name: 'TT'
|
|
|
}, {
|
|
|
fieldLabel: '品名',
|
|
|
name: 'GOODSNAME'
|
|
|
}//, { xtype: 'hiddenfield', flex: 1 }
|
|
|
, {
|
|
|
//xtype: 'textareafield',
|
|
|
fieldLabel: '备注',
|
|
|
//grow: true,
|
|
|
//height: 80,
|
|
|
//labelWidth: 55,
|
|
|
name: 'REMARK', flex: 3
|
|
|
}
|
|
|
|
|
|
]
|
|
|
}, {
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox', labelWidth: 70,
|
|
|
defaultType: 'numberfield',
|
|
|
items: [
|
|
|
{
|
|
|
fieldLabel: '20GP',
|
|
|
name: '_20GP',
|
|
|
minValue: 0,
|
|
|
listeners: {
|
|
|
change: function (field, newValue, oldValue) {
|
|
|
|
|
|
this.DosetCTNhidden("_20GP", "20GP", newValue);
|
|
|
},
|
|
|
scope: this
|
|
|
}
|
|
|
}, {
|
|
|
fieldLabel: '40GP',
|
|
|
name: '_40GP',
|
|
|
minValue: 0,
|
|
|
listeners: {
|
|
|
change: function (field, newValue, oldValue) {
|
|
|
this.DosetCTNhidden("_40GP", "40GP", newValue);
|
|
|
},
|
|
|
scope: this
|
|
|
}
|
|
|
}, {
|
|
|
fieldLabel: '40HC',
|
|
|
name: '_40HC',
|
|
|
minValue: 0,
|
|
|
listeners: {
|
|
|
change: function (field, newValue, oldValue) {
|
|
|
this.DosetCTNhidden("_40HC", "40HC", newValue);
|
|
|
},
|
|
|
scope: this
|
|
|
}
|
|
|
}, this.comboxOP
|
|
|
, {
|
|
|
fieldLabel: '创建时间', labelWidth: 70,
|
|
|
name: 'CREATETIME', readOnly: true,
|
|
|
format: 'Y-m-d H:i:s',
|
|
|
xtype: 'datefield',
|
|
|
renderer: Ext.util.Format.dateRenderer('Y-m-d H:i:s')
|
|
|
}//, { xtype: 'hiddenfield', flex: 1 }
|
|
|
]
|
|
|
}, {
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox', labelWidth: 70,
|
|
|
defaultType: 'textfield',
|
|
|
items: [
|
|
|
{
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
flex: 1,
|
|
|
defaultType: 'textfield',
|
|
|
items: [this.comboxCTN,
|
|
|
{
|
|
|
xtype: 'numberfield',
|
|
|
name: 'CTNNUM',
|
|
|
id: "CTNNUM",
|
|
|
value: "0",
|
|
|
minValue: 0,
|
|
|
flex: 1
|
|
|
}
|
|
|
]
|
|
|
}
|
|
|
,
|
|
|
{
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
flex: 1,
|
|
|
defaultType: 'textfield',
|
|
|
items: [this.comboxCTN2,
|
|
|
{
|
|
|
xtype: 'numberfield',
|
|
|
name: 'CTNNUM2',
|
|
|
id: "CTNNUM2",
|
|
|
value: "0",
|
|
|
minValue: 0,
|
|
|
flex: 1
|
|
|
}
|
|
|
]
|
|
|
}, {
|
|
|
xtype: 'numberfield',
|
|
|
fieldLabel: '45GP',
|
|
|
name: '_45',
|
|
|
minValue: 0,
|
|
|
listeners: {
|
|
|
change: function (field, newValue, oldValue) {
|
|
|
this.DosetCTNhidden("_45", "45GP", newValue);
|
|
|
},
|
|
|
scope: this
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
fieldLabel: '最后更新人', labelWidth: 70,
|
|
|
name: 'MODIFIEDUSER', readOnly: true
|
|
|
},
|
|
|
{
|
|
|
fieldLabel: '最后更新', labelWidth: 70,
|
|
|
format: 'Y-m-d H:i:s', readOnly: true,
|
|
|
xtype: 'datefield',
|
|
|
renderer: Ext.util.Format.dateRenderer('Y-m-d H:i:s'),
|
|
|
name: 'MODIFIEDTIME'
|
|
|
}//, { xtype: 'hiddenfield', flex: 1 }
|
|
|
|
|
|
]
|
|
|
}, {
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [
|
|
|
|
|
|
|
|
|
{ xtype: 'hiddenfield', flex: 3 }
|
|
|
]
|
|
|
}
|
|
|
|
|
|
]//end items(fieldset 1)
|
|
|
|
|
|
}); //end this.formEdit
|
|
|
//#endregion
|
|
|
|
|
|
//#region 费用明细信息
|
|
|
//数据集
|
|
|
this.storeDetail = Ext.create('Ext.data.Store', {
|
|
|
model: 'CRM_QUOTATION_DETAILmb',
|
|
|
remoteSort: false,
|
|
|
pruneModifiedRecords: true,
|
|
|
//groupField: 'CARRIER',
|
|
|
proxy: {
|
|
|
type: 'ajax',
|
|
|
url: '/MvcShipping/CRM_QUOTATION_CUST/GetDetailList',
|
|
|
reader: {
|
|
|
id: 'GID',
|
|
|
root: 'data',
|
|
|
totalProperty: 'totalCount'
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
|
|
|
//#region 枚举类型
|
|
|
|
|
|
this.StoreUnit = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'MsFeeUnit',
|
|
|
proxy: { url: '/MvcShipping/MsChFee/GetCtnUnitList' }
|
|
|
});
|
|
|
this.StoreUnit.load({ params: { bsno: "1234567890123", bstype: ""} });
|
|
|
this.comboxUnit = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
store: this.StoreUnit,
|
|
|
name: 'UNIT',
|
|
|
valueField: 'UNIT',
|
|
|
displayField: 'SUNIT'
|
|
|
});
|
|
|
|
|
|
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.storeCodeCtn = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'DsShipping.ux.CodeCtnModel',
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetCodeCtnList' }
|
|
|
});
|
|
|
//this.storeCodeCtn.load();
|
|
|
this.comboxCTNALL = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
//fieldLabel: '箱型',
|
|
|
store: this.storeCodeCtn,
|
|
|
forceSelection: true,
|
|
|
name: 'CTN',
|
|
|
valueField: 'CTN',
|
|
|
displayField: 'CTN'
|
|
|
});
|
|
|
|
|
|
this.storeCodeCtn2 = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'DsShipping.ux.CodeCtnModel',
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetCodeCtnList' }
|
|
|
});
|
|
|
//this.storeCodeCtn.load();
|
|
|
this.comboxCTNALL2 = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
//fieldLabel: '箱型',
|
|
|
store: this.storeCodeCtn2,
|
|
|
forceSelection: true,
|
|
|
name: 'CTN2',
|
|
|
valueField: 'CTN',
|
|
|
displayField: 'CTN'
|
|
|
});
|
|
|
|
|
|
|
|
|
//#endregion
|
|
|
//表格
|
|
|
this.DetailColumns = [
|
|
|
{
|
|
|
sortable: true, hidden: true,
|
|
|
dataIndex: 'GID',
|
|
|
header: 'GID',
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
sortable: true, hidden: true,
|
|
|
dataIndex: 'LINKGID',
|
|
|
header: 'LINKGID',
|
|
|
width: 80
|
|
|
}, {
|
|
|
sortable: true, hidden: true,
|
|
|
dataIndex: 'LINKGID2',
|
|
|
header: 'LINKGID2',
|
|
|
width: 80
|
|
|
}, {
|
|
|
sortable: true, hidden: true,
|
|
|
dataIndex: 'CARRIER_REF',
|
|
|
header: 'CARRIER_REF',
|
|
|
width: 200
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'CARRIER',
|
|
|
header: '船公司',
|
|
|
width: 100
|
|
|
},
|
|
|
{
|
|
|
dataIndex: 'ETD', hidden: true,
|
|
|
header: 'ETD',
|
|
|
width: 90,
|
|
|
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
|
|
|
editor: {
|
|
|
xtype: 'datefield',
|
|
|
selectOnFocus: true
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
sortable: true, hidden: true,
|
|
|
dataIndex: 'FEETYPE',
|
|
|
header: '费用类型',
|
|
|
width: 80,
|
|
|
editor: {
|
|
|
xtype: 'textfield',
|
|
|
selectOnFocus: true
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'FEENAME',
|
|
|
header: '费用中文名称',
|
|
|
width: 80,
|
|
|
editor: this.comboxFeeNameRef
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'UNIT',
|
|
|
header: '单位标准',
|
|
|
width: 80,
|
|
|
editor: this.comboxUnit
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: '_20GP',
|
|
|
header: '20GP',
|
|
|
width: 80,
|
|
|
editor: {
|
|
|
xtype: 'numberfield', //numberfield textfield
|
|
|
selectOnFocus: true
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: '_40GP',
|
|
|
header: '40GP',
|
|
|
width: 80,
|
|
|
editor: {
|
|
|
xtype: 'numberfield', //numberfield textfield
|
|
|
selectOnFocus: true
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: '_40HC',
|
|
|
header: '40HC',
|
|
|
width: 80,
|
|
|
editor: {
|
|
|
xtype: 'numberfield', //numberfield textfield
|
|
|
selectOnFocus: true
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: '_45',
|
|
|
header: '45GP',
|
|
|
width: 80,
|
|
|
editor: {
|
|
|
xtype: 'numberfield', //numberfield textfield
|
|
|
selectOnFocus: true
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
sortable: true, hidden: true,
|
|
|
dataIndex: 'CTN',
|
|
|
header: 'CTN',
|
|
|
width: 80
|
|
|
}, {
|
|
|
sortable: true, hidden: true,
|
|
|
dataIndex: 'CTNPRICE',
|
|
|
header: 'CTNPRICE',
|
|
|
width: 80,
|
|
|
editor: {
|
|
|
xtype: 'numberfield', //numberfield textfield
|
|
|
selectOnFocus: true
|
|
|
}
|
|
|
}, {
|
|
|
sortable: true, hidden: true,
|
|
|
dataIndex: 'CTN2',
|
|
|
header: 'CTN2',
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
sortable: true, hidden: true,
|
|
|
dataIndex: 'CTNPRICE2',
|
|
|
header: 'CTNPRICE2',
|
|
|
width: 80,
|
|
|
editor: {
|
|
|
xtype: 'numberfield', //numberfield textfield
|
|
|
selectOnFocus: true
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'UNITPRICE',
|
|
|
header: '单票',
|
|
|
width: 80,
|
|
|
editor: {
|
|
|
xtype: 'numberfield', //numberfield textfield
|
|
|
selectOnFocus: true
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'CURRENCY',
|
|
|
header: '币别',
|
|
|
width: 80,
|
|
|
editor: this.comboxCurr
|
|
|
},
|
|
|
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'REMARK',
|
|
|
header: '备注',
|
|
|
width: 200,
|
|
|
editor: {
|
|
|
xtype: 'textfield',
|
|
|
selectOnFocus: true
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'CREATEUSER',
|
|
|
header: '创建人',
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'CREATETIME',
|
|
|
header: '创建时间',
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'MODIFIEDUSER',
|
|
|
header: '最后一次更新操作人',
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'MODIFIEDTIME',
|
|
|
header: '最后一次更新时间',
|
|
|
width: 80
|
|
|
}
|
|
|
|
|
|
];
|
|
|
|
|
|
this.cellEditingDetail = Ext.create('Ext.grid.plugin.CellEditing', {
|
|
|
clicksToEdit: 1
|
|
|
});
|
|
|
this.DetailCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
|
|
|
var _this = this;
|
|
|
this.formDetail = new Ext.grid.GridPanel({
|
|
|
store: this.storeDetail,
|
|
|
enableHdMenu: false,
|
|
|
layout: 'border',
|
|
|
region: 'center', //bodyStyle: 'background:#FFF',
|
|
|
trackResetOnLoad: true,
|
|
|
//height: 160,
|
|
|
autoScroll: true,
|
|
|
//title: '商品信息',
|
|
|
loadMask: { msg: "数据加载中,请稍等..." },
|
|
|
trackMouseOver: true,
|
|
|
//disableSelection: true,
|
|
|
plugins: [this.cellEditingDetail],
|
|
|
/*features: [{
|
|
|
id: 'group',
|
|
|
ftype: 'groupingsummary',
|
|
|
groupHeaderTpl: '{name}',
|
|
|
hideGroupedHeader: true,
|
|
|
enableGroupingMenu: true
|
|
|
}],*/
|
|
|
selModel: this.DetailCheckBoxModel,
|
|
|
selType: 'cellmodel',
|
|
|
tbar: [{
|
|
|
xtype: 'label',
|
|
|
width: 60,
|
|
|
text: '报价明细'
|
|
|
}, {
|
|
|
text: '增加明细',
|
|
|
tooltip: '增加明细',
|
|
|
iconCls: "btnadddetail", id: "Add1",
|
|
|
handler: function (button, event) {
|
|
|
this.onAddDetailClick(button, event);
|
|
|
},
|
|
|
scope: this
|
|
|
}, '-', {
|
|
|
text: '删除明细',
|
|
|
tooltip: '删除明细',
|
|
|
iconCls: "btndeletedetail",
|
|
|
handler: function (button, event) {
|
|
|
this.onDelDetailClick(button, event);
|
|
|
},
|
|
|
scope: this
|
|
|
}],
|
|
|
columns: this.DetailColumns
|
|
|
});
|
|
|
//#endregion
|
|
|
|
|
|
//#region 船公司明细信息
|
|
|
//数据集
|
|
|
this.storeCARRIERList = Ext.create('Ext.data.Store', {
|
|
|
model: 'CRM_QUOTATION_CARRIERmb',
|
|
|
remoteSort: false,
|
|
|
pruneModifiedRecords: true,
|
|
|
proxy: {
|
|
|
type: 'ajax',
|
|
|
url: '/MvcShipping/CRM_QUOTATION_CUST/GetCARRIERList',
|
|
|
reader: {
|
|
|
id: 'GID',
|
|
|
root: 'data',
|
|
|
totalProperty: 'totalCount'
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
//#region 枚举类型
|
|
|
|
|
|
this.storeCARRIER2 = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'DsShipping.ux.CustomRefModel',
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
|
|
|
});
|
|
|
|
|
|
//船公司
|
|
|
this.comboxCARRIER2 = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
//fieldLabel: '船公司',
|
|
|
store: this.storeCARRIER2,
|
|
|
forceSelection: true,
|
|
|
name: 'CARRIER',
|
|
|
valueField: 'CustName',
|
|
|
displayField: 'CodeAndName'
|
|
|
});
|
|
|
|
|
|
//#endregion
|
|
|
//表格
|
|
|
this.CARRIERColumns = [
|
|
|
{
|
|
|
sortable: true, hidden: true,
|
|
|
dataIndex: 'GID',
|
|
|
header: 'GID',
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
sortable: true, hidden: true,
|
|
|
dataIndex: 'LINKGID',
|
|
|
header: 'LINKGID',
|
|
|
width: 80
|
|
|
}, {
|
|
|
sortable: true, hidden: true,
|
|
|
dataIndex: 'LINKGID2',
|
|
|
header: 'LINKGID2',
|
|
|
width: 80
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'CARRIER',
|
|
|
header: '船公司',
|
|
|
width: 80,
|
|
|
editor: this.comboxCARRIER2
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'FREEDAYS',
|
|
|
header: '免箱期',
|
|
|
width: 45,
|
|
|
editor: {
|
|
|
xtype: 'numberfield',
|
|
|
minValue: 0,
|
|
|
selectOnFocus: true
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
dataIndex: 'VALIDDATE',
|
|
|
header: '有效期起',
|
|
|
width: 90,
|
|
|
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
|
|
|
editor: {
|
|
|
xtype: 'datefield',
|
|
|
selectOnFocus: true
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
dataIndex: 'VALIDDATE_END',
|
|
|
header: '有效期止',
|
|
|
width: 90,
|
|
|
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
|
|
|
editor: {
|
|
|
xtype: 'datefield',
|
|
|
selectOnFocus: true
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'REMARK',
|
|
|
header: '备注',
|
|
|
width: 200,
|
|
|
editor: {
|
|
|
xtype: 'textfield',
|
|
|
selectOnFocus: true
|
|
|
}
|
|
|
}
|
|
|
|
|
|
];
|
|
|
|
|
|
this.cellEditingCARRIER = Ext.create('Ext.grid.plugin.CellEditing', {
|
|
|
clicksToEdit: 1
|
|
|
});
|
|
|
this.CARRIERCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
|
|
|
var _this = this;
|
|
|
this.formCARRIER = new Ext.grid.GridPanel({
|
|
|
store: this.storeCARRIERList,
|
|
|
enableHdMenu: false,
|
|
|
layout: 'border',
|
|
|
region: 'center', //bodyStyle: 'background:#FFF',
|
|
|
trackResetOnLoad: true,
|
|
|
//height: 160,
|
|
|
autoScroll: true,
|
|
|
//title: '商品信息',
|
|
|
loadMask: { msg: "数据加载中,请稍等..." },
|
|
|
trackMouseOver: true,
|
|
|
disableSelection: false,
|
|
|
plugins: [this.cellEditingCARRIER],
|
|
|
selModel: this.CARRIERCheckBoxModel,
|
|
|
selType: 'cellmodel',
|
|
|
tbar: [{
|
|
|
xtype: 'label',
|
|
|
width: 60,
|
|
|
text: '船公司'
|
|
|
}, {
|
|
|
text: '增加明细',
|
|
|
tooltip: '增加明细',
|
|
|
iconCls: "btnadddetail", id: "Add5",
|
|
|
handler: function (button, event) {
|
|
|
this.onAddCARRIERClick(button, event);
|
|
|
},
|
|
|
scope: this
|
|
|
}, '-', {
|
|
|
text: '删除明细',
|
|
|
tooltip: '删除明细',
|
|
|
iconCls: "btndeletedetail", id: "Del5",
|
|
|
handler: function (button, event) {
|
|
|
this.onDelCARRIERClick(button, event);
|
|
|
},
|
|
|
scope: this
|
|
|
}],
|
|
|
columns: this.CARRIERColumns
|
|
|
});
|
|
|
//#endregion
|
|
|
|
|
|
//#region 中间的关联供应商报价单
|
|
|
this.storeChildList = Ext.create('Ext.data.Store', {
|
|
|
pageSize: this.PageSize,
|
|
|
model: 'CRM_QUOTATIONmb',
|
|
|
remoteSort: false,
|
|
|
proxy: {
|
|
|
type: 'ajax',
|
|
|
url: '/MvcShipping/CRM_QUOTATION_CUST/GetDataList',
|
|
|
reader: {
|
|
|
id: 'GID',
|
|
|
root: 'data',
|
|
|
totalProperty: 'totalCount'
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
//#region 枚举参照
|
|
|
this.storeChildCust = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'DsShipping.ux.CustomRefModel',
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
|
|
|
});
|
|
|
this.storeChildCust.load();
|
|
|
//船公司
|
|
|
this.comboxChildCust = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
//fieldLabel: '船公司',
|
|
|
store: this.storeChildCust,
|
|
|
forceSelection: true,
|
|
|
name: 'CLIENTGID',
|
|
|
valueField: 'GId',
|
|
|
displayField: 'CodeAndName',
|
|
|
matchFieldWidth: false
|
|
|
});
|
|
|
//#endregion
|
|
|
|
|
|
this.initChildcolums = [
|
|
|
{
|
|
|
sortable: true, //hidden: true,
|
|
|
dataIndex: 'GID',
|
|
|
header: '询价单编号',
|
|
|
width: 115
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'BLTYPE',
|
|
|
header: '报价单类型',
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
sortable: true, hidden: true,
|
|
|
dataIndex: 'BLSTATUS',
|
|
|
header: 'BLSTATUS',
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
sortable: true, hidden: true,
|
|
|
dataIndex: 'BLSTATUS_REF',
|
|
|
header: '报价单状态',
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'CLIENTGID',
|
|
|
header: '询价对象',
|
|
|
width: 80,
|
|
|
renderer: function (value, p, record) {
|
|
|
if (value == null || value == '') return '';
|
|
|
else return record.data.SHORTNAME;
|
|
|
},
|
|
|
editor: this.comboxChildCust
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'CONTACTNAME',
|
|
|
header: '联系人',
|
|
|
width: 80,
|
|
|
editor: this.comboxInfoClientContact2
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'EMAIL',
|
|
|
header: '联系人Email',
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
sortable: true, hidden: true,
|
|
|
dataIndex: 'SHORTNAME',
|
|
|
header: 'SHORTNAME',
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
sortable: true, hidden: true,
|
|
|
dataIndex: 'DESCRIPTION',
|
|
|
header: 'DESCRIPTION',
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
sortable: true, hidden: true,
|
|
|
dataIndex: 'SALE',
|
|
|
header: '销售',
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'ASKDATE',
|
|
|
header: '询价日期',
|
|
|
width: 80,
|
|
|
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
|
|
|
editor: {
|
|
|
xtype: 'datefield',
|
|
|
selectOnFocus: true
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
sortable: true, hidden: true,
|
|
|
dataIndex: 'QUOTATIONDATE',
|
|
|
header: '报价日期',
|
|
|
width: 80,
|
|
|
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
|
|
|
editor: {
|
|
|
xtype: 'datefield',
|
|
|
selectOnFocus: true
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
sortable: true, hidden: true,
|
|
|
dataIndex: 'VALIDDATE',
|
|
|
header: '有效期起',
|
|
|
width: 80,
|
|
|
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
|
|
|
editor: {
|
|
|
xtype: 'datefield',
|
|
|
selectOnFocus: true
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
sortable: true, hidden: true,
|
|
|
dataIndex: 'VALIDDATE_END',
|
|
|
header: '有效期止',
|
|
|
width: 80,
|
|
|
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
|
|
|
editor: {
|
|
|
xtype: 'datefield',
|
|
|
selectOnFocus: true
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
sortable: true, hidden: true,
|
|
|
dataIndex: 'CORPID',
|
|
|
header: '所属分公司代码',
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
sortable: true, hidden: true,
|
|
|
dataIndex: 'PORTLOAD',
|
|
|
header: '装货港',
|
|
|
width: 80,
|
|
|
renderer: function (value, p, record) {
|
|
|
if (value == null || value == '') return '';
|
|
|
else return record.data.PORTLOAD_REF;
|
|
|
},
|
|
|
editor: this.comboxPORTLOAD2
|
|
|
},
|
|
|
{
|
|
|
sortable: true, hidden: true,
|
|
|
dataIndex: 'PORTDISCHARGE',
|
|
|
header: '卸货港',
|
|
|
width: 80,
|
|
|
renderer: function (value, p, record) {
|
|
|
if (value == null || value == '') return '';
|
|
|
else return record.data.PORTDISCHARGE_REF;
|
|
|
},
|
|
|
editor: this.comboxPORTDISCHARGE2
|
|
|
},
|
|
|
{
|
|
|
sortable: true, hidden: true,
|
|
|
dataIndex: 'PORTLOAD_REF',
|
|
|
header: 'PORTLOAD_REF',
|
|
|
hidden: true,
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
sortable: true, hidden: true,
|
|
|
dataIndex: 'PORTDISCHARGE_REF',
|
|
|
header: 'PORTDISCHARGE_REF',
|
|
|
hidden: true,
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
sortable: true, hidden: true,
|
|
|
dataIndex: 'LANE',
|
|
|
header: '航线',
|
|
|
hidden: true,
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
sortable: true, hidden: true,
|
|
|
dataIndex: 'CARRIER',
|
|
|
header: '船公司',
|
|
|
width: 80,
|
|
|
editor: this.comboxCARRIER4
|
|
|
},
|
|
|
{
|
|
|
sortable: true, hidden: true,
|
|
|
dataIndex: 'ETD',
|
|
|
header: 'ETD',
|
|
|
width: 80,
|
|
|
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
|
|
|
editor: {
|
|
|
xtype: 'datefield',
|
|
|
selectOnFocus: true
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
sortable: true, hidden: true,
|
|
|
dataIndex: 'ETA',
|
|
|
header: 'ETA',
|
|
|
width: 80,
|
|
|
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
|
|
|
editor: {
|
|
|
xtype: 'datefield',
|
|
|
selectOnFocus: true
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
sortable: true, hidden: true,
|
|
|
dataIndex: 'ENTREPORT',
|
|
|
header: '中转港',
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
sortable: true, hidden: true,
|
|
|
dataIndex: 'TT',
|
|
|
header: '航程',
|
|
|
width: 80,
|
|
|
editor: {
|
|
|
xtype: 'numberfield',
|
|
|
selectOnFocus: true
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
sortable: true, hidden: true,
|
|
|
dataIndex: 'GOODSNAME',
|
|
|
header: '品名',
|
|
|
width: 80,
|
|
|
editor: {
|
|
|
xtype: 'textfield',
|
|
|
selectOnFocus: true
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
sortable: true, hidden: true,
|
|
|
dataIndex: 'REMARK',
|
|
|
header: '备注',
|
|
|
width: 200,
|
|
|
editor: {
|
|
|
xtype: 'textfield',
|
|
|
selectOnFocus: true
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
sortable: true, hidden: true,
|
|
|
dataIndex: 'CREATEUSER',
|
|
|
header: '创建人',
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
sortable: true, hidden: true,
|
|
|
dataIndex: 'CREATETIME',
|
|
|
header: '创建时间',
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
sortable: true, hidden: true,
|
|
|
dataIndex: 'MODIFIEDUSER',
|
|
|
header: '最后一次更新操作人',
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
sortable: true, hidden: true,
|
|
|
dataIndex: 'MODIFIEDTIME',
|
|
|
header: '最后一次更新时间',
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
sortable: true, hidden: true,
|
|
|
dataIndex: 'WEEK',
|
|
|
header: '开船日期所属星期几',
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
sortable: true, hidden: true,
|
|
|
dataIndex: 'TimeMark',
|
|
|
header: 'TimeMark',
|
|
|
width: 80
|
|
|
}];
|
|
|
|
|
|
this.Childcolums = this.initChildcolums;
|
|
|
|
|
|
this.cellEditingChild = Ext.create('Ext.grid.plugin.CellEditing', {
|
|
|
clicksToEdit: 1
|
|
|
});
|
|
|
this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
|
|
|
//定义Grid
|
|
|
this.formChild = new Ext.grid.GridPanel({
|
|
|
store: this.storeChildList,
|
|
|
enableHdMenu: false,
|
|
|
|
|
|
region: 'center',
|
|
|
loadMask: { msg: "数据加载中,请稍等..." },
|
|
|
trackMouseOver: true,
|
|
|
disableSelection: false,
|
|
|
plugins: [this.cellEditingChild],
|
|
|
selModel: this.GridCheckBoxModel,
|
|
|
viewConfig: {
|
|
|
enableTextSelection: true, //允许复制数据
|
|
|
autoFill: true
|
|
|
},
|
|
|
tbar: [{
|
|
|
xtype: 'label',
|
|
|
width: 80,
|
|
|
text: '向供应商询价'
|
|
|
}, {
|
|
|
text: '增加明细',
|
|
|
tooltip: '增加明细',
|
|
|
iconCls: "btnadddetail", id: "Add2",
|
|
|
handler: function (button, event) {
|
|
|
//this.onSaveChildClick(button, event);
|
|
|
//this.onAddChildClick(button, event);
|
|
|
this.onSaveandAddChildClick();
|
|
|
},
|
|
|
scope: this
|
|
|
}, '-', {
|
|
|
text: '删除明细',
|
|
|
tooltip: '删除明细',
|
|
|
iconCls: "btndeletedetail", id: "Del1",
|
|
|
handler: function (button, event) {
|
|
|
this.onDelChildClick(button, event);
|
|
|
},
|
|
|
scope: this
|
|
|
}, '-', {
|
|
|
text: '保存修改', hidden: true,
|
|
|
tooltip: '保存修改',
|
|
|
iconCls: "btnsave",
|
|
|
handler: function (button, event) {
|
|
|
this.onSaveChildClick(button, event);
|
|
|
},
|
|
|
scope: this
|
|
|
}, {
|
|
|
text: '发送询价邮件',
|
|
|
tooltip: '发送询价邮件',
|
|
|
iconCls: "btnupload", id: "SendBtn",
|
|
|
handler: function (button, event) {
|
|
|
this.onSendMailClick(button, event);
|
|
|
},
|
|
|
scope: this
|
|
|
}],
|
|
|
listeners: {
|
|
|
cellclick: function (thisTab, record, item, index, e, eOpts) {
|
|
|
if (index == 10) {//设置按钮列
|
|
|
// alert('用户编号=' + this.getStore().getAt
|
|
|
//(rowIndex).data.usercode);
|
|
|
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
columns: this.Childcolums
|
|
|
});
|
|
|
|
|
|
this.formChild.on('edit', function (editor, e, eOpts) {
|
|
|
this.ChildAfterEdit(editor, e, eOpts);
|
|
|
}, this);
|
|
|
this.cellEditingChild.on('beforeedit', function (editor, e) {
|
|
|
return this.ChildBeforeEdit(editor, e);
|
|
|
}, this);
|
|
|
|
|
|
|
|
|
//选择load
|
|
|
this.formChild.getSelectionModel().on('select', function (model, record, index) {
|
|
|
|
|
|
//this.CHILDEGID = record.data.GID;
|
|
|
if (record.data.GID != "" && this.CHILDEGID != record.data.GID) {
|
|
|
this.CHILDEGID = record.data.GID;
|
|
|
//this.CARRIER = record.data.CARRIER;
|
|
|
this.storeAddDetail.removeAll();
|
|
|
if (record.data.BLSTATUS == "2" || record.data.BLSTATUS == "3") {
|
|
|
|
|
|
this.storeAddDetail.load({ params: { start: 0, limit: 9999, sort: '', condition: " LINKGID='" + this.CHILDEGID + "' "} });
|
|
|
|
|
|
} else {
|
|
|
this.CHILDEGID = "";
|
|
|
this.storeAddDetail.removeAll();
|
|
|
}
|
|
|
} else {
|
|
|
|
|
|
}
|
|
|
|
|
|
if (record.data.GID == "") {
|
|
|
this.CHILDEGID = record.data.GID;
|
|
|
//this.CARRIER = record.data.CARRIER;
|
|
|
this.storeAddDetail.removeAll();
|
|
|
}
|
|
|
//点中同一行的话什么都不做。
|
|
|
|
|
|
//
|
|
|
}, this);
|
|
|
|
|
|
this.formCARRIER.getSelectionModel().on('select', function (model, record, index) {
|
|
|
|
|
|
this.CARRIER = record.data.CARRIER;
|
|
|
}, this);
|
|
|
|
|
|
//#endregion
|
|
|
|
|
|
//#region 待添加明细信息
|
|
|
//数据集
|
|
|
this.storeAddDetail = Ext.create('Ext.data.Store', {
|
|
|
model: 'CRM_QUOTATION_DETAILmb',
|
|
|
remoteSort: false,
|
|
|
pruneModifiedRecords: true,
|
|
|
groupField: 'CARRIER_REF',
|
|
|
proxy: {
|
|
|
type: 'ajax',
|
|
|
url: '/MvcShipping/CRM_QUOTATION_CUST/GetDetailList',
|
|
|
reader: {
|
|
|
id: 'GID',
|
|
|
root: 'data',
|
|
|
totalProperty: 'totalCount'
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
//#region 相关控件
|
|
|
var _this = this;
|
|
|
|
|
|
this.APSearch = new Ext.form.Checkbox({
|
|
|
fieldLabel: '只显示关联报价单报价', hidden: true,
|
|
|
tooltip: '取消选中时,可以查找其他供应商报价单中,有相同装货港、卸货港的报价信息。',
|
|
|
labelwidth: 80, id: "APSearch",
|
|
|
width: 120,
|
|
|
//value:'1',
|
|
|
listeners: {
|
|
|
change: function (newValue, oldValue, eOpts)//change事件
|
|
|
{
|
|
|
var GID = _this.formEdit.getForm().findField('GID').getValue();
|
|
|
|
|
|
var sql = "";
|
|
|
if (newValue.checked) {
|
|
|
|
|
|
/*
|
|
|
var GID = _this.formEdit.getForm().findField('GID').getValue();
|
|
|
_this.storeAddDetail.load({
|
|
|
params: { start: 0, limit: 9999, sort: '', condition: "LINKGID in(select CARRIERCQGID from CRM_QUOTATION_LINK where CUSTCQGID='" + GID + "')" },
|
|
|
waitMsg: "正在查询数据...",
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
});*/
|
|
|
} else {
|
|
|
/*
|
|
|
sql = _this.getCondition2();
|
|
|
_this.storeAddDetail.load({ params: { start: 0, limit: 9999, sort: '', condition: sql} });
|
|
|
*/
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
this.storeCARRIER3 = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'DsShipping.ux.CustomRefModel',
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
|
|
|
});
|
|
|
|
|
|
//船公司
|
|
|
this.comboxCARRIER3 = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: '船公司', hidden: true,
|
|
|
width: 110, labelWidth: 50,
|
|
|
store: this.storeCARRIER3,
|
|
|
forceSelection: true,
|
|
|
name: 'CARRIER', id: "add_CARRIER",
|
|
|
valueField: 'CustName',
|
|
|
displayField: 'CodeAndName'
|
|
|
,
|
|
|
listeners: {
|
|
|
specialkey: function (field, e) {
|
|
|
if (e.getKey() == e.ENTER) {
|
|
|
_this.onRefreshClick2();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
//#endregion
|
|
|
|
|
|
//表格
|
|
|
this.AddColumns = [
|
|
|
{
|
|
|
sortable: true, hidden: true,
|
|
|
dataIndex: 'GID',
|
|
|
header: 'GID',
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
sortable: true, hidden: true,
|
|
|
dataIndex: 'LINKGID',
|
|
|
header: 'LINKGID',
|
|
|
width: 80
|
|
|
}, {
|
|
|
sortable: true, hidden: true,
|
|
|
dataIndex: 'CARRIER_REF',
|
|
|
header: '询价对象_船公司',
|
|
|
width: 100
|
|
|
}, {
|
|
|
sortable: true, hidden: true,
|
|
|
dataIndex: 'SHORTNAME',
|
|
|
header: '询价对象',
|
|
|
width: 100
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'CARRIER',
|
|
|
header: '船公司',
|
|
|
width: 100,
|
|
|
editor: this.comboxCARRIER2
|
|
|
},
|
|
|
{
|
|
|
sortable: true, hidden: true,
|
|
|
dataIndex: 'CTNNUM',
|
|
|
header: '箱量',
|
|
|
width: 60,
|
|
|
editor: {
|
|
|
xtype: 'numberfield', //numberfield textfield
|
|
|
selectOnFocus: true
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
dataIndex: 'ETD', hidden: true,
|
|
|
header: 'ETD',
|
|
|
width: 90,
|
|
|
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
|
|
|
editor: {
|
|
|
xtype: 'datefield',
|
|
|
selectOnFocus: true
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
sortable: true, hidden: true,
|
|
|
dataIndex: 'FEETYPE',
|
|
|
header: '费用类型',
|
|
|
width: 80,
|
|
|
editor: {
|
|
|
xtype: 'textfield',
|
|
|
selectOnFocus: true
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'FEENAME',
|
|
|
header: '费用中文名称',
|
|
|
width: 80,
|
|
|
editor: this.comboxFeeNameRef
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'UNIT',
|
|
|
header: '单位标准',
|
|
|
width: 80,
|
|
|
editor: this.comboxUnit
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: '_20GP',
|
|
|
header: '20GP',
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: '_40GP',
|
|
|
header: '40GP',
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: '_40HC',
|
|
|
header: '40HC',
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: '_45',
|
|
|
header: '45GP',
|
|
|
width: 80
|
|
|
}, {
|
|
|
sortable: true, hidden: true,
|
|
|
dataIndex: 'CTN',
|
|
|
header: 'CTN',
|
|
|
width: 80
|
|
|
}, {
|
|
|
sortable: true, hidden: true,
|
|
|
dataIndex: 'CTNPRICE',
|
|
|
header: 'CTNPRICE',
|
|
|
width: 80
|
|
|
}, {
|
|
|
sortable: true, hidden: true,
|
|
|
dataIndex: 'CTN2',
|
|
|
header: 'CTN2',
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
sortable: true, hidden: true,
|
|
|
dataIndex: 'CTNPRICE2',
|
|
|
header: 'CTNPRICE2',
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'UNITPRICE',
|
|
|
header: '单票',
|
|
|
width: 80,
|
|
|
editor: {
|
|
|
xtype: 'numberfield', //numberfield textfield
|
|
|
selectOnFocus: true
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'CURRENCY',
|
|
|
header: '币别',
|
|
|
width: 80,
|
|
|
editor: this.comboxCurr
|
|
|
},
|
|
|
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'REMARK',
|
|
|
header: '备注',
|
|
|
width: 200,
|
|
|
editor: {
|
|
|
xtype: 'textfield',
|
|
|
selectOnFocus: true
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'CREATEUSER',
|
|
|
header: '创建人',
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'CREATETIME',
|
|
|
header: '创建时间',
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'MODIFIEDUSER',
|
|
|
header: '最后更新人',
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'MODIFIEDTIME',
|
|
|
header: '最后更新时间',
|
|
|
width: 80
|
|
|
}
|
|
|
|
|
|
];
|
|
|
|
|
|
this.DetailCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
|
|
|
var _this = this;
|
|
|
this.formAdd = new Ext.grid.GridPanel({
|
|
|
store: this.storeAddDetail,
|
|
|
enableHdMenu: false,
|
|
|
layout: 'border',
|
|
|
region: 'center', //bodyStyle: 'background:#FFF',
|
|
|
trackResetOnLoad: true,
|
|
|
//height: 160,
|
|
|
autoScroll: true,
|
|
|
//title: '商品信息',
|
|
|
loadMask: { msg: "数据加载中,请稍等..." },
|
|
|
trackMouseOver: true,
|
|
|
disableSelection: false,
|
|
|
//plugins: [this.cellEditingDetail],
|
|
|
selModel: this.DetailCheckBoxModel,
|
|
|
features: [{
|
|
|
id: 'group',
|
|
|
ftype: 'grouping',
|
|
|
groupHeaderTpl: '{name}',
|
|
|
hideGroupedColumn: true,
|
|
|
enableGroupingMenu: true
|
|
|
}],
|
|
|
viewConfig: {
|
|
|
enableTextSelection: true,
|
|
|
autoFill: true,
|
|
|
getRowClass: function (record, rowIndex, rowParams, store) {
|
|
|
var ISUSE = record.get('ISUSE');
|
|
|
return Shipping.GetRowClass(ISUSE);
|
|
|
}
|
|
|
},
|
|
|
selType: 'cellmodel',
|
|
|
tbar: [{
|
|
|
xtype: 'label',
|
|
|
width: 60,
|
|
|
text: '供应商报价'
|
|
|
}, '-', {
|
|
|
text: '设置中标价格',
|
|
|
tooltip: '将选中的报价设为中标价格,或将选中的中标价格取消。',
|
|
|
iconCls: "",
|
|
|
handler: function (button, event) {
|
|
|
this.onMarkClick(button, event);
|
|
|
},
|
|
|
scope: this
|
|
|
}, '-', {
|
|
|
text: '向客户报价单添加报价',
|
|
|
tooltip: '将勾选的供应商报价加入对客户报价明细。',
|
|
|
iconCls: "edit_down", id: "Add3",
|
|
|
handler: function (button, event) {
|
|
|
this.onAddClick(button, event);
|
|
|
},
|
|
|
scope: this
|
|
|
}, {
|
|
|
text: '',
|
|
|
tooltip: '查询刷新',
|
|
|
iconCls: "btnrefresh",
|
|
|
handler: function (button, event) {
|
|
|
this.onRefreshClick2(button, event);
|
|
|
},
|
|
|
scope: this
|
|
|
}, this.APSearch, '-'
|
|
|
, this.comboxCARRIER3
|
|
|
, { id: "add_ETD", hidden: true,
|
|
|
fieldLabel: "ETD",
|
|
|
width: 155, labelWidth: 50,
|
|
|
format: 'Y-m-d',
|
|
|
xtype: 'datefield',
|
|
|
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
|
|
|
name: 'ETD',
|
|
|
listeners: {
|
|
|
specialkey: function (field, e) {
|
|
|
if (e.getKey() == e.ENTER) {
|
|
|
_this.onRefreshClick2();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}],
|
|
|
columns: this.AddColumns
|
|
|
});
|
|
|
//#endregion
|
|
|
|
|
|
//#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
|
|
|
}, {
|
|
|
id: 'btnESave',
|
|
|
text: "保存",
|
|
|
iconCls: "btnsave", id: "SaveButton",
|
|
|
handler: function (button, event) {
|
|
|
this.Save('0');
|
|
|
},
|
|
|
scope: this
|
|
|
}, {
|
|
|
id: 'btnESaveAndClose',
|
|
|
text: "保存并关闭", id: "SaveButton2",
|
|
|
handler: function (button, event) {
|
|
|
this.Save('1');
|
|
|
},
|
|
|
scope: this
|
|
|
}, {
|
|
|
id: 'btnESaveAndNew',
|
|
|
text: "保存并新建", id: "SaveButton3",
|
|
|
handler: function (button, event) {
|
|
|
this.Save('2');
|
|
|
},
|
|
|
scope: this
|
|
|
}, {
|
|
|
id: 'btnECopyNew', hidden: true,
|
|
|
text: "复制新建",
|
|
|
handler: function (button, event) {
|
|
|
//this.Save('0');
|
|
|
this.CopyNew();
|
|
|
},
|
|
|
scope: this
|
|
|
}, '-', {
|
|
|
text: "关闭",
|
|
|
handler: function (button, event) {
|
|
|
window.close();
|
|
|
},
|
|
|
scope: this
|
|
|
}, {
|
|
|
text: "新建",
|
|
|
handler: function (button, event) {
|
|
|
this.LoadData('add', '');
|
|
|
var basicForm = this.formEdit.getForm();
|
|
|
basicForm.findField('BsNo').setDisabled(false);
|
|
|
},
|
|
|
scope: this
|
|
|
}, '-', {
|
|
|
text: "打印",
|
|
|
iconCls: "btnprint",
|
|
|
handler: function (button, event) {
|
|
|
this.Print();
|
|
|
},
|
|
|
scope: this
|
|
|
}, '-',
|
|
|
{
|
|
|
text: "提交审核",
|
|
|
disabled: true, id: "StartAudit",
|
|
|
handler: function (button, event) {
|
|
|
this.StartAudit(button, event);
|
|
|
},
|
|
|
scope: this
|
|
|
},
|
|
|
{
|
|
|
text: "撤回提交",
|
|
|
disabled: true, id: "ResetAudit",
|
|
|
handler: function (button, event) {
|
|
|
this.ResetAudit(button, event);
|
|
|
},
|
|
|
scope: this
|
|
|
},
|
|
|
{
|
|
|
text: "审核通过", disabled: true,
|
|
|
//iconCls: "btnreset",
|
|
|
id: "Audit",
|
|
|
handler: function (button, event) {
|
|
|
this.Audit(button, event);
|
|
|
},
|
|
|
scope: this
|
|
|
},
|
|
|
{
|
|
|
text: "驳回提交", disabled: true,
|
|
|
//iconCls: "btnreset",
|
|
|
id: "AuditBack",
|
|
|
handler: function (button, event) {
|
|
|
this.AuditBack(button, event);
|
|
|
},
|
|
|
scope: this
|
|
|
}, '-', {
|
|
|
text: '发送报价邮件', disabled: true,
|
|
|
tooltip: '发送报价邮件',
|
|
|
iconCls: "btnupload", id: "SendBtn2",
|
|
|
handler: function (button, event) {
|
|
|
this.onSendMail2Click(button, event);
|
|
|
},
|
|
|
scope: this
|
|
|
}, '-', {
|
|
|
text: "生成海运出口业务", disabled: true,
|
|
|
tooltip: '', id: "MakeSeae",
|
|
|
iconCls: "",
|
|
|
handler: function (button, event) {
|
|
|
this.onMakeOpseaeClick();
|
|
|
},
|
|
|
scope: this
|
|
|
}
|
|
|
]
|
|
|
}); //end 按钮Toolbar
|
|
|
//#endregion
|
|
|
|
|
|
//#region 框架结构
|
|
|
|
|
|
|
|
|
this.panelCARRIER = new Ext.Panel({
|
|
|
//title: '实际核销明细',
|
|
|
layout: "border",
|
|
|
region: 'west',
|
|
|
width: 360,
|
|
|
margin: '1 1',
|
|
|
split: true,
|
|
|
items: [this.formCARRIER]
|
|
|
});
|
|
|
this.panelDetail = new Ext.Panel({
|
|
|
//title: '委托详细信息',
|
|
|
layout: "border",
|
|
|
region: 'center',
|
|
|
animate: true,
|
|
|
//autoScroll: true,
|
|
|
//containerScroll: true,
|
|
|
frame: false, split: true,
|
|
|
items: [this.formDetail]
|
|
|
});
|
|
|
|
|
|
this.panel2 = new Ext.Panel({
|
|
|
//title: '委托详细信息',
|
|
|
layout: "border",
|
|
|
region: 'south',
|
|
|
height: 260,
|
|
|
animate: true,
|
|
|
frame: false, split: true,
|
|
|
items: [this.panelCARRIER, this.panelDetail]
|
|
|
});
|
|
|
|
|
|
|
|
|
this.panelEdit = new Ext.Panel({
|
|
|
//title: '委托详细信息',
|
|
|
layout: "border",
|
|
|
region: 'north',
|
|
|
height: 200,
|
|
|
animate: true,
|
|
|
frame: false, split: true,
|
|
|
collapsed: false,
|
|
|
collapsible: true,
|
|
|
items: [this.formEdit]
|
|
|
});
|
|
|
this.panelAddList = new Ext.Panel({
|
|
|
//title: '供应商报价',
|
|
|
layout: "border",
|
|
|
region: 'center',
|
|
|
//width: 650,
|
|
|
margin: '1 1',
|
|
|
split: true,
|
|
|
items: [this.formAdd]
|
|
|
});
|
|
|
this.panelChild = new Ext.Panel({
|
|
|
//title: '向供应商询价',
|
|
|
layout: "border",
|
|
|
region: 'west',
|
|
|
width: 440,
|
|
|
animate: true,
|
|
|
frame: false, split: true,
|
|
|
items: [this.formChild]
|
|
|
});
|
|
|
this.panelMain = new Ext.Panel({
|
|
|
//title: '委托详细信息',
|
|
|
layout: "border",
|
|
|
region: 'center',
|
|
|
//height: 400,
|
|
|
animate: true,
|
|
|
frame: false, split: true,
|
|
|
items: [this.panelEdit, this.panelAddList, this.panelChild]
|
|
|
});
|
|
|
/*
|
|
|
this.panelpage = new Ext.Panel({
|
|
|
//title: '委托详细信息',
|
|
|
layout: "border",
|
|
|
region: 'center',
|
|
|
animate: true,
|
|
|
//autoScroll: true,
|
|
|
// containerScroll: true,
|
|
|
frame: false, split: true,
|
|
|
items: [this.panelEdit, this.panel2]
|
|
|
});*/
|
|
|
|
|
|
|
|
|
this.panelSeae = new Ext.Panel({
|
|
|
title: '客户询价/报价信息',
|
|
|
id: 'pnlmodNewOpAirnInfo',
|
|
|
layout: "border",
|
|
|
region: 'center',
|
|
|
animate: true,
|
|
|
//autoScroll: true,
|
|
|
frame: false,
|
|
|
//closable:true,
|
|
|
items: [this.panelBtn, this.panelMain, this.panel2]
|
|
|
});
|
|
|
|
|
|
this.treestore = new Ext.data.TreeStore({
|
|
|
model: 'DsShipping.ux.ModuleModel',
|
|
|
nodeParam: 'PARENTID',
|
|
|
proxy: {
|
|
|
type: 'ajax',
|
|
|
url: '/MvcShipping/MsBaseInfo/GetModuTreeRefList',
|
|
|
reader: {
|
|
|
id: 'GID',
|
|
|
root: 'data',
|
|
|
totalProperty: 'totalCount'
|
|
|
}
|
|
|
},
|
|
|
autoLoad: true,
|
|
|
root: {
|
|
|
name: '根节点',
|
|
|
expanded: true,
|
|
|
id: 'AEF2D94A-DCCB-4ECB-9332-5D1ED3E7A877'
|
|
|
}
|
|
|
});
|
|
|
|
|
|
|
|
|
this.tabtree = new Ext.tree.Panel({
|
|
|
region: 'west',
|
|
|
title: '业务信息',
|
|
|
split: true,
|
|
|
width: 180,
|
|
|
collapsible: true,
|
|
|
margins: '0 0 0 0',
|
|
|
store: this.treestore,
|
|
|
rootVisible: false,
|
|
|
hideHeaders: true,
|
|
|
animate: false,
|
|
|
lines: false,
|
|
|
columns: [{
|
|
|
xtype: 'treecolumn',
|
|
|
text: '模块名称',
|
|
|
width: 178,
|
|
|
dataIndex: 'DESCRIPTION'
|
|
|
}],
|
|
|
|
|
|
listeners: {
|
|
|
scope: this,
|
|
|
'itemclick': function (_this, record, item, index, e, eOpts) {
|
|
|
var finded = false;
|
|
|
if (record.data.MODULEURL == '@') {
|
|
|
this.tabSeaepanel.setActiveTab(0);
|
|
|
} else if (record.data.MODULEURL != '#') {
|
|
|
var children = this.tabSeaepanel.items;
|
|
|
if (children) {
|
|
|
for (var i = 0, len = children.length; i < len; i++) {
|
|
|
if (children.items[i].id) {
|
|
|
if (children.items[i].id == 'pnl' + record.data.NAME) {
|
|
|
this.tabSeaepanel.setActiveTab(i);
|
|
|
finded = true;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if (finded == false) {
|
|
|
|
|
|
if (this.formEdit.getForm().findField('GID').getValue() == "") {
|
|
|
Ext.Msg.show({ title: '注意', msg: '请先保存业务信息后再打开其他模块!', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
|
|
|
} else {
|
|
|
if (record.data.NAME == 'modLinkCRMQUOTATIONInfo') {
|
|
|
var paneltabitems = new Shipping.LinkCRMList({
|
|
|
id: 'pnlLinkCRMQUOTATIONInfo',
|
|
|
layout: "border",
|
|
|
region: "center",
|
|
|
//autoScroll: true,
|
|
|
frame: false,
|
|
|
closable: true,
|
|
|
title: record.data.DESCRIPTION
|
|
|
});
|
|
|
} else {
|
|
|
var paneltabitems = new Ext.Panel({
|
|
|
id: 'pnl' + record.data.NAME,
|
|
|
layout: "fit",
|
|
|
region: "center",
|
|
|
//autoScroll: true,
|
|
|
frame: false,
|
|
|
closable: true,
|
|
|
title: record.data.DESCRIPTION,
|
|
|
html: ' <iframe scrolling="auto" frameborder="0" width="100%" height="100%" src="' + record.data.MODULEURL + '"> </iframe>'
|
|
|
});
|
|
|
}
|
|
|
this.tabSeaepanel.add(paneltabitems);
|
|
|
this.tabSeaepanel.setActiveTab(paneltabitems);
|
|
|
this.tabSeaepanel.doLayout();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
this.tabSeaepanel = new Ext.TabPanel({
|
|
|
activeTab: 0,
|
|
|
autoWidth: true,
|
|
|
border: true,
|
|
|
frame: false,
|
|
|
region: 'center',
|
|
|
id: "TabSeaePanel",
|
|
|
enableTabScroll: true,
|
|
|
items:
|
|
|
[
|
|
|
this.panelSeae
|
|
|
],
|
|
|
listeners: {
|
|
|
scope: this,
|
|
|
'beforetabchange': function (tabPanel, newCard, oldCard, eOpts) {
|
|
|
/*
|
|
|
if (oldCard.id == "modLinkCRMQUOTATIONInfo") {
|
|
|
var feemodify = oldCard.panelFee.getModifyStatus();
|
|
|
if (feemodify) {
|
|
|
Ext.Msg.show({ title: '警告', msg: '费用未保存,请先保存费用!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
if (oldCard.id == "pnlmodAirnAmendFee") {
|
|
|
var feemodify = oldCard.panelFee.getModifyStatus();
|
|
|
if (feemodify) {
|
|
|
Ext.Msg.show({ title: '警告', msg: '费用未保存,请先保存费用!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
*/
|
|
|
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
Ext.apply(this, {
|
|
|
items: [this.tabtree, this.tabSeaepanel]
|
|
|
});
|
|
|
//#endregion
|
|
|
|
|
|
|
|
|
|
|
|
//#region 其他
|
|
|
//parentWin = window.parent.opener._this;
|
|
|
parentWin = window.parent.opener;
|
|
|
if (parentWin == NaN || parentWin == null) {
|
|
|
parentWin = window.parent.opener._this;
|
|
|
|
|
|
} else {
|
|
|
this.isfen = true;
|
|
|
}
|
|
|
|
|
|
this.LoadInitData();
|
|
|
|
|
|
this.InitData();
|
|
|
|
|
|
this.formDetail.on('edit', function (editor, e, eOpts) {
|
|
|
this.DetailAfterEdit(editor, e, eOpts);
|
|
|
}, this);
|
|
|
|
|
|
}, //end initUIComponents
|
|
|
|
|
|
//#region 加载事件
|
|
|
InitData: function () {
|
|
|
this.OpStatus = 'add';
|
|
|
var condition = '';
|
|
|
_this = this;
|
|
|
if (parentWin) {
|
|
|
var ret = parentWin.OprationSwap();
|
|
|
this.OpStatus = ret[0];
|
|
|
this.StoreList = ret[1];
|
|
|
this.editRecord = ret[2];
|
|
|
if (this.isfen) this.MainEditRecord = ret[3];
|
|
|
}
|
|
|
|
|
|
if (this.OpStatus == 'edit') {
|
|
|
condition = " CQ.GID='" + this.editRecord.get('GID') + "'";
|
|
|
//this.storeBodyList.load({ params: { condition: condition} });
|
|
|
}
|
|
|
|
|
|
if (this.OpStatus == 'copyadd') {
|
|
|
this.CopyNewData();
|
|
|
} else {
|
|
|
this.LoadData(this.OpStatus, condition);
|
|
|
}
|
|
|
|
|
|
//this.LoadMustBe();
|
|
|
// if (this.initloaddata == 0) {
|
|
|
// this.LoadInitData();
|
|
|
// this.initloaddata = 1;
|
|
|
// };
|
|
|
|
|
|
}, //end InitData
|
|
|
|
|
|
LoadData: function (OpStatus, condition) {
|
|
|
this.serialNo = 0;
|
|
|
//this.bodyDel = [];
|
|
|
this.OpStatus = OpStatus;
|
|
|
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在查询主表数据...',
|
|
|
url: '/MvcShipping/CRM_QUOTATION_CUST/GetData',
|
|
|
params: {
|
|
|
handle: OpStatus,
|
|
|
condition: condition,
|
|
|
BLTYPE: BLTYPE
|
|
|
},
|
|
|
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;
|
|
|
data.BLTYPE = BLTYPE;
|
|
|
|
|
|
if (data.CREATETIME == "") { data.CREATETIME = currdate.format('yyyy-MM-dd hh:mm:ss') };
|
|
|
if (data.CREATEUSER == "") { data.CREATEUSER = SHOWNAME };
|
|
|
if (data.PORTLOAD == "") { data.PORTLOAD = "CNTAO" };
|
|
|
if (data.ASKDATE == "") { data.ASKDATE = currdate.format('yyyy-MM-dd hh:mm:ss') };
|
|
|
|
|
|
if (data._20GP == "") { data._20GP = "0" };
|
|
|
if (data._40GP == "") { data._40GP = "0" };
|
|
|
if (data._40HC == "") { data._40HC = "0" };
|
|
|
if (data._45 == "") { data._45 = "0" };
|
|
|
if (data.CTNNUM == "") { data.CTNNUM = "0" };
|
|
|
if (data.CTNNUM2 == "") { data.CTNNUM2 = "0" };
|
|
|
|
|
|
if (data.BLSTATUS == "2" || data.BLSTATUS == "3") {
|
|
|
//alert("注意,供应商报价(提交审核)、向客户报价(审核通过)的询价单不能保存修改。");
|
|
|
Ext.getCmp("SaveButton").disable();
|
|
|
Ext.getCmp("SaveButton2").disable();
|
|
|
Ext.getCmp("SaveButton3").disable();
|
|
|
Ext.getCmp("Add1").disable();
|
|
|
Ext.getCmp("Del1").disable();
|
|
|
Ext.getCmp("Add2").disable();
|
|
|
Ext.getCmp("SendBtn").disable();
|
|
|
Ext.getCmp("Add3").disable();
|
|
|
|
|
|
} else {
|
|
|
Ext.getCmp("SaveButton").enable();
|
|
|
Ext.getCmp("SaveButton2").enable();
|
|
|
Ext.getCmp("SaveButton3").enable();
|
|
|
Ext.getCmp("Add1").enable();
|
|
|
Ext.getCmp("Del1").enable();
|
|
|
Ext.getCmp("Add2").enable();
|
|
|
Ext.getCmp("SendBtn").enable();
|
|
|
Ext.getCmp("Add3").enable();
|
|
|
}
|
|
|
|
|
|
this.formEdit.getForm().reset();
|
|
|
//data.CTN = this.splitStrValue(data.CTN);
|
|
|
this.formEdit.getForm().setValues(data);
|
|
|
|
|
|
this.LoadInit(data);
|
|
|
this.Editdata = data;
|
|
|
this.GetEditStatus();
|
|
|
this.storeDetail.load({ params: { start: 0, limit: 9999, sort: '', condition: " LINKGID='" + data.GID + "'"} });
|
|
|
this.storeCARRIERList.load({ params: { condition: " LINKGID='" + data.GID + "'"} });
|
|
|
this.storeChildList.load({ params: { start: 0, limit: 9999, sort: '', condition: " CQ.GID in(select CARRIERCQGID from crm_QUOTATION_LINK where CUSTCQGID='" + data.GID + "' )"} });
|
|
|
|
|
|
document.title = "" + BLTYPE + ":" + data.SHORTNAME + " " + data.PORTDISCHARGE + " ETD" + data.ETD;
|
|
|
|
|
|
Ext.getCmp("APSearch").setValue("1");
|
|
|
this.formEdit.getForm().setValues(data);
|
|
|
|
|
|
this.storeCARRIERList.load({ params: { condition: " LINKGID='" + data.GID + "'"} });
|
|
|
|
|
|
//this.CHILDEGID = record.data.GID;
|
|
|
if (data.BLSTATUS == "0" || data.BLSTATUS == "1") {
|
|
|
//可以提交
|
|
|
Ext.getCmp("StartAudit").enable();
|
|
|
Ext.getCmp("ResetAudit").disable();
|
|
|
Ext.getCmp("Audit").disable();
|
|
|
Ext.getCmp("AuditBack").disable();
|
|
|
Ext.getCmp("SendBtn2").disable();
|
|
|
Ext.getCmp("MakeSeae").disable();
|
|
|
} else
|
|
|
if (data.BLSTATUS == "2") {
|
|
|
//可以审核 可以驳回
|
|
|
Ext.getCmp("StartAudit").disable();
|
|
|
Ext.getCmp("ResetAudit").enable();
|
|
|
Ext.getCmp("Audit").enable();
|
|
|
Ext.getCmp("AuditBack").enable();
|
|
|
Ext.getCmp("SendBtn2").disable();
|
|
|
Ext.getCmp("MakeSeae").disable();
|
|
|
} else
|
|
|
if (data.BLSTATUS == "3") {
|
|
|
//可以驳回
|
|
|
Ext.getCmp("StartAudit").disable();
|
|
|
Ext.getCmp("ResetAudit").disable();
|
|
|
Ext.getCmp("Audit").disable();
|
|
|
Ext.getCmp("AuditBack").enable();
|
|
|
Ext.getCmp("SendBtn2").enable();
|
|
|
Ext.getCmp("MakeSeae").enable();
|
|
|
}
|
|
|
//点中同一行的话什么都不做。
|
|
|
|
|
|
} else {
|
|
|
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
});
|
|
|
|
|
|
var billno = '*';
|
|
|
var gid = '*';
|
|
|
|
|
|
}, // end LoadDate
|
|
|
//#endregion
|
|
|
|
|
|
|
|
|
LoadInitData: function () {
|
|
|
this.storeCustCode.load({ params: { condition: "ISCONTROLLER='1'"} });
|
|
|
this.storeOpCode.load();
|
|
|
this.storeOpCode2.load();
|
|
|
var _this = this;
|
|
|
this.storeCARRIER.load({ params: { condition: "ISCARRIER='1'" }
|
|
|
, callback: function (r, options, success) {
|
|
|
if (success) {
|
|
|
_this.storeCARRIER2.add(r);
|
|
|
_this.storeCARRIER3.add(r);
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
//this.storeCARRIER2.load({ params: { condition: "ISCARRIER='1'"} });
|
|
|
//this.storeCARRIER3.load({ params: { condition: "ISCARRIER='1'"} });
|
|
|
|
|
|
this.storeCtn.load({ params: { condition: " CTN not in('20GP','40GP','45GP','40HC') " }
|
|
|
, callback: function (r, options, success) {
|
|
|
if (success) {
|
|
|
_this.storeCtn2.add(r);
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
this.storeCodeCtn.load({ params: { condition: " CTN not in('20GP','40GP','45GP','40HC') " }
|
|
|
, callback: function (r, options, success) {
|
|
|
if (success) {
|
|
|
_this.storeCodeCtn2.add(r);
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
LoadInit: function (data) {
|
|
|
var CLIENTGID = this.formEdit.getForm().findField('CLIENTGID').getValue();
|
|
|
|
|
|
var s = " LINKID ='" + CLIENTGID + "'";
|
|
|
this.storeInfoClientContact.load({ params: { condition: s} });
|
|
|
|
|
|
var BLTYPE = this.formEdit.getForm().findField('BLTYPE').getValue();
|
|
|
|
|
|
var CREATETIME = this.formEdit.getForm().findField('CREATETIME').getValue();
|
|
|
if (CREATETIME == "") { this.formEdit.getForm().findField('BLTYPE').setValue(currdate.format('yyyy-MM-dd hh:mm:ss')) };
|
|
|
|
|
|
var CREATEUSER = this.formEdit.getForm().findField('CREATEUSER').getValue();
|
|
|
if (CREATEUSER == "") { this.formEdit.getForm().findField('CREATEUSER').setValue(SHOWNAME) };
|
|
|
|
|
|
var ASKDATE = this.formEdit.getForm().findField('ASKDATE').getValue();
|
|
|
if (ASKDATE == "") { this.formEdit.getForm().findField('ASKDATE').setValue(currdate.format('yyyy-MM-dd hh:mm:ss')) };
|
|
|
|
|
|
if (BLTYPE == "客户询价" || BLTYPE == "供应商报价") {
|
|
|
|
|
|
}
|
|
|
else {
|
|
|
|
|
|
}
|
|
|
},
|
|
|
//#region 保存
|
|
|
Save: function (type) {
|
|
|
|
|
|
var basicForm = this.formEdit.getForm();
|
|
|
if (!basicForm.isValid()) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
var data = this.formEdit.getForm().getValues(false, false, false);
|
|
|
|
|
|
//var _ctn = this.getStrValue(this.comboxCtn.getValue());
|
|
|
|
|
|
//data.CTN = _ctn;
|
|
|
|
|
|
var Detaildatas = [];
|
|
|
for (var i = 0; i < this.storeDetail.getCount(); i += 1) {
|
|
|
var member = this.storeDetail.getAt(i);
|
|
|
Detaildatas.push(member);
|
|
|
}
|
|
|
|
|
|
//商品明细
|
|
|
var DetailBody = ConvertRecordsToJson(Detaildatas);
|
|
|
var DetailDelBody = ConvertRecordsToJsonAll(this.DetailDel);
|
|
|
|
|
|
var CARRIERdatas = [];
|
|
|
for (var i = 0; i < this.storeCARRIERList.getCount(); i += 1) {
|
|
|
var member = this.storeCARRIERList.getAt(i);
|
|
|
CARRIERdatas.push(member);
|
|
|
}
|
|
|
|
|
|
//商品明细
|
|
|
var CARRIERBody = ConvertRecordsToJson(CARRIERdatas);
|
|
|
//var DetailDelBody = ConvertRecordsToJsonAll(this.DetailDel);
|
|
|
|
|
|
var bodyChildDatas = [];
|
|
|
for (i = 0; i < this.storeChildList.getCount(); i += 1) {
|
|
|
var memberyf = this.storeChildList.getAt(i);
|
|
|
bodyChildDatas.push(memberyf);
|
|
|
};
|
|
|
var jsonChildBody = ConvertRecordsToJson(bodyChildDatas);
|
|
|
if (jsonChildBody == "") {
|
|
|
|
|
|
Ext.Msg.wait('正在保存数据, 请稍侯..');
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在保存数据...',
|
|
|
url: '/MvcShipping/CRM_QUOTATION_CUST/Save',
|
|
|
scope: this,
|
|
|
params: {
|
|
|
opstatus: this.OpStatus,
|
|
|
data: Ext.JSON.encode(data),
|
|
|
DetailBody: DetailBody,
|
|
|
DetailDelBody: DetailDelBody,
|
|
|
CARRIERBody: CARRIERBody
|
|
|
},
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
this.DetailDel = [];
|
|
|
Ext.MessageBox.hide();
|
|
|
var jsonresult = Ext.JSON.decode(response.responseText);
|
|
|
if (jsonresult.Success) {
|
|
|
var returnData = jsonresult.Data;
|
|
|
this.formEdit.getForm().reset();
|
|
|
//returnData.CTN = this.splitStrValue(returnData.CTN);
|
|
|
this.formEdit.getForm().setValues(returnData);
|
|
|
|
|
|
this.Editdata = returnData;
|
|
|
|
|
|
//
|
|
|
if (this.OpStatus == 'add') {
|
|
|
var arrNewRecords = this.StoreList.insert(0, returnData);
|
|
|
this.editRecord = this.StoreList.getAt(0);
|
|
|
if (type == '0') {
|
|
|
this.OpStatus = 'edit';
|
|
|
//basicForm2.findField('BSNO').setDisabled(true);
|
|
|
//var data = this.formEdit.getForm().getValues(false, false, false);
|
|
|
|
|
|
this.storeDetail.load({ params: { condition: " LINKGID='" + this.editRecord.get('GID') + "'"} });
|
|
|
this.storeCARRIERList.load({ params: { condition: " LINKGID='" + this.editRecord.get('GID') + "'"} });
|
|
|
} else if (type == '1') {
|
|
|
window.close();
|
|
|
} else if (type == '2') {
|
|
|
this.LoadData('add', '');
|
|
|
}
|
|
|
if (type == '0') {
|
|
|
this.OpStatus = 'edit';
|
|
|
//basicForm2.findField('BSNO').setDisabled(true);
|
|
|
|
|
|
} else if (type == '1') {
|
|
|
window.close();
|
|
|
} else if (type == '2') {
|
|
|
this.LoadData('add', '');
|
|
|
}
|
|
|
}
|
|
|
else if (this.OpStatus == 'edit') {
|
|
|
var editp = Ext.create('CRM_QUOTATIONmb', returnData);
|
|
|
this.editRecord.fields.each(function (field) {
|
|
|
if (field.persist) {
|
|
|
name = field.name;
|
|
|
if (name != 'GID')
|
|
|
this.editRecord.set(name, editp.get(name));
|
|
|
}
|
|
|
}, this);
|
|
|
this.editRecord.commit();
|
|
|
if (type == '0') {
|
|
|
this.OpStatus = 'edit';
|
|
|
//basicForm2.findField('BSNO').setDisabled(true);
|
|
|
this.storeDetail.load({ params: { condition: " LINKGID='" + this.editRecord.get('GID') + "'"} });
|
|
|
this.storeChildList.load({ params: { start: 0, limit: 9999, sort: '', condition: " CQ.GID in(select CARRIERCQGID from crm_QUOTATION_LINK where CUSTCQGID='" + this.editRecord.get('GID') + "' )"} });
|
|
|
this.storeCARRIERList.load({ params: { condition: " LINKGID='" + this.editRecord.get('GID') + "'"} });
|
|
|
} else if (type == '1') {
|
|
|
window.close();
|
|
|
} else if (type == '2') {
|
|
|
this.LoadData('add', '');
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} 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
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
return;
|
|
|
} else {
|
|
|
Ext.Msg.wait('正在保存数据, 请稍侯..');
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在保存数据...',
|
|
|
url: '/MvcShipping/CRM_QUOTATION_CUST/SaveChild2',
|
|
|
scope: this,
|
|
|
async: false,
|
|
|
params: {
|
|
|
ChildBody: jsonChildBody
|
|
|
},
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
Ext.MessageBox.hide();
|
|
|
var jsonresult = Ext.JSON.decode(response.responseText);
|
|
|
if (jsonresult.Success) {
|
|
|
//alert("保存成功");
|
|
|
|
|
|
|
|
|
//////////////
|
|
|
|
|
|
Ext.Msg.wait('正在保存数据, 请稍侯..');
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在保存数据...',
|
|
|
url: '/MvcShipping/CRM_QUOTATION_CUST/Save',
|
|
|
scope: this,
|
|
|
params: {
|
|
|
opstatus: this.OpStatus,
|
|
|
data: Ext.JSON.encode(data),
|
|
|
DetailBody: DetailBody,
|
|
|
DetailDelBody: DetailDelBody
|
|
|
},
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
this.DetailDel = [];
|
|
|
Ext.MessageBox.hide();
|
|
|
var jsonresult = Ext.JSON.decode(response.responseText);
|
|
|
if (jsonresult.Success) {
|
|
|
var returnData = jsonresult.Data;
|
|
|
this.formEdit.getForm().reset();
|
|
|
//returnData.CTN = this.splitStrValue(returnData.CTN);
|
|
|
this.formEdit.getForm().setValues(returnData);
|
|
|
//this.formHead.getForm().reset();
|
|
|
//this.formHead.getForm().setValues(returnData);
|
|
|
this.Editdata = returnData;
|
|
|
|
|
|
//
|
|
|
if (this.OpStatus == 'add') {
|
|
|
var arrNewRecords = this.StoreList.insert(0, returnData);
|
|
|
this.editRecord = this.StoreList.getAt(0);
|
|
|
if (type == '0') {
|
|
|
this.OpStatus = 'edit';
|
|
|
//basicForm2.findField('BSNO').setDisabled(true);
|
|
|
this.storeDetail.load({ params: { condition: " LINKGID='" + this.editRecord.get('GID') + "'"} });
|
|
|
} else if (type == '1') {
|
|
|
window.close();
|
|
|
} else if (type == '2') {
|
|
|
this.LoadData('add', '');
|
|
|
}
|
|
|
if (type == '0') {
|
|
|
this.OpStatus = 'edit';
|
|
|
//basicForm2.findField('BSNO').setDisabled(true);
|
|
|
|
|
|
} else if (type == '1') {
|
|
|
window.close();
|
|
|
} else if (type == '2') {
|
|
|
this.LoadData('add', '');
|
|
|
}
|
|
|
}
|
|
|
else if (this.OpStatus == 'edit') {
|
|
|
var editp = Ext.create('CRM_QUOTATIONmb', returnData);
|
|
|
this.editRecord.fields.each(function (field) {
|
|
|
if (field.persist) {
|
|
|
name = field.name;
|
|
|
if (name != 'GID')
|
|
|
this.editRecord.set(name, editp.get(name));
|
|
|
}
|
|
|
}, this);
|
|
|
this.editRecord.commit();
|
|
|
if (type == '0') {
|
|
|
this.OpStatus = 'edit';
|
|
|
//basicForm2.findField('BSNO').setDisabled(true);
|
|
|
this.storeDetail.load({ params: { condition: " LINKGID='" + this.editRecord.get('GID') + "'"} });
|
|
|
|
|
|
var form = this.formEdit.getForm();
|
|
|
var _GID = form.findField('GID').getValue();
|
|
|
this.storeChildList.load({ params: { start: 0, limit: 9999, sort: '', condition: " CQ.GID in(select CARRIERCQGID from crm_QUOTATION_LINK where CUSTCQGID='" + _GID + "' )"} });
|
|
|
|
|
|
} else if (type == '1') {
|
|
|
window.close();
|
|
|
} else if (type == '2') {
|
|
|
this.LoadData('add', '');
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} 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
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
//////////////
|
|
|
|
|
|
} 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
|
|
|
});
|
|
|
}
|
|
|
//alert('03');
|
|
|
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
}, //end save
|
|
|
|
|
|
onMarkClick: function () {
|
|
|
|
|
|
var USEBody = [];
|
|
|
var selectedRecords = this.formAdd.selModel.getSelection();
|
|
|
if (selectedRecords.length == 0) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
for (var i = 0; i < selectedRecords.length; i++) {
|
|
|
var rec = selectedRecords[i];
|
|
|
USEBody.push(rec);
|
|
|
}
|
|
|
|
|
|
//商品明细
|
|
|
var DetailBody = ConvertRecordsToJsonAll(USEBody);
|
|
|
|
|
|
Ext.Msg.wait('正在保存数据, 请稍侯..');
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在保存数据...',
|
|
|
url: '/MvcShipping/CRM_QUOTATION_CUST/SetUse',
|
|
|
scope: this,
|
|
|
params: {
|
|
|
DetailBody: DetailBody
|
|
|
},
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
Ext.MessageBox.hide();
|
|
|
this.onRefreshClick2();
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
}, //end save
|
|
|
|
|
|
|
|
|
//#endregion
|
|
|
getStrValue: function (list) {
|
|
|
var _list = "";
|
|
|
for (var _i = 0; _i < list.length; _i++) {
|
|
|
//_list.push("'" + list[_i] + "'");
|
|
|
if (_list == "") { _list = list[_i] } else { _list = _list + "," + list[_i] }
|
|
|
}
|
|
|
return _list;
|
|
|
},
|
|
|
splitStrValue: function (Str) {
|
|
|
var strs = new Array(); //定义一数组
|
|
|
|
|
|
strs = Str.split(","); //字符分割
|
|
|
return strs;
|
|
|
},
|
|
|
//#region 复制新建
|
|
|
CopyNewData: function () {
|
|
|
var data = this.editRecord.data;
|
|
|
var basicForm = this.formEdit.getForm();
|
|
|
|
|
|
this.formEdit.getForm().reset();
|
|
|
//data.CTN = this.splitStrValue(data.CTN);
|
|
|
this.formEdit.getForm().setValues(data);
|
|
|
|
|
|
this.storeDetail.load({ params: { condition: " LINKGID='" + data.GID + "'"} });
|
|
|
|
|
|
this.SetCopyNewDate();
|
|
|
},
|
|
|
|
|
|
|
|
|
CopyNew: function () {
|
|
|
var basicForm = this.formEdit.getForm();
|
|
|
|
|
|
var data = this.formEdit.getForm().getValues(false, false, false);
|
|
|
|
|
|
var Detaildatas = [];
|
|
|
for (var i = 0; i < this.storeDetail.getCount(); i += 1) {
|
|
|
var member = this.storeDetail.getAt(i);
|
|
|
Detaildatas.push(member);
|
|
|
}
|
|
|
|
|
|
//商品明细
|
|
|
var DetailBody = ConvertRecordsToJson(Detaildatas);
|
|
|
var DetailDelBody = ConvertRecordsToJsonAll(this.DetailDel);
|
|
|
|
|
|
Ext.Msg.wait('正在保存数据, 请稍侯..');
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在保存数据...',
|
|
|
url: '/MvcShipping/CRM_QUOTATION_CUST/Save',
|
|
|
scope: this,
|
|
|
params: {
|
|
|
opstatus: this.OpStatus,
|
|
|
data: Ext.JSON.encode(data),
|
|
|
DetailBody: DetailBody,
|
|
|
DetailDelBody: DetailDelBody
|
|
|
},
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
this.DetailDel = [];
|
|
|
Ext.MessageBox.hide();
|
|
|
var jsonresult = Ext.JSON.decode(response.responseText);
|
|
|
if (jsonresult.Success) {
|
|
|
var returnData = jsonresult.Data;
|
|
|
this.formEdit.getForm().reset();
|
|
|
//returnData.CTN = this.splitStrValue(returnData.CTN);
|
|
|
this.formEdit.getForm().setValues(returnData);
|
|
|
//this.formHead.getForm().reset();
|
|
|
//this.formHead.getForm().setValues(returnData);
|
|
|
this.Editdata = returnData;
|
|
|
|
|
|
this.SetCopyNewDate();
|
|
|
|
|
|
} 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
|
|
|
|
|
|
SetCopyNewDate: function () {
|
|
|
this.OpStatus = 'add';
|
|
|
var basicForm = this.formEdit.getForm();
|
|
|
field = basicForm.findField('GID');
|
|
|
field.setValue('');
|
|
|
|
|
|
field = basicForm.findField('CREATEUSER');
|
|
|
field.setValue(SHOWNAME);
|
|
|
field = basicForm.findField('CREATETIME');
|
|
|
field.setValue(currdate.format('yyyy-MM-dd hh:mm:ss'));
|
|
|
|
|
|
field = basicForm.findField('MODIFIEDUSER');
|
|
|
field.setValue(SHOWNAME);
|
|
|
field = basicForm.findField('MODIFIEDTIME');
|
|
|
field.setValue(currdate.format('yyyy-MM-dd hh:mm:ss'));
|
|
|
|
|
|
field = basicForm.findField('BLSTATUS');
|
|
|
field.setValue("0");
|
|
|
|
|
|
for (var i = 0; i < this.storeDetail.getCount(); i += 1) {
|
|
|
this.storeDetail.getAt(i).set("LINKGID", "");
|
|
|
this.storeDetail.getAt(i).set("GID", NewGuid());
|
|
|
}
|
|
|
},
|
|
|
//#endregion
|
|
|
|
|
|
DetailAfterEdit: function (editor, e, eOpts) {
|
|
|
|
|
|
},
|
|
|
|
|
|
//#region 中间的供应商询价
|
|
|
onAddChildClick: function () {
|
|
|
|
|
|
var data = this.formEdit.getForm().getValues(false, false, false);
|
|
|
//var _ctn = this.getStrValue(this.comboxCtn.getValue());
|
|
|
//data.CTN = _ctn;
|
|
|
|
|
|
Ext.Msg.wait('正在保存数据, 请稍侯..');
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在保存数据...',
|
|
|
url: '/MvcShipping/CRM_QUOTATION_CUST/AddChild',
|
|
|
scope: this,
|
|
|
params: {
|
|
|
opstatus: this.OpStatus,
|
|
|
data: Ext.JSON.encode(data)
|
|
|
},
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
this.DetailDel = [];
|
|
|
this.OpStatus = 'edit';
|
|
|
Ext.MessageBox.hide();
|
|
|
var jsonresult = Ext.JSON.decode(response.responseText);
|
|
|
if (jsonresult.Success) {
|
|
|
var returnData = jsonresult.Data;
|
|
|
this.formEdit.getForm().reset();
|
|
|
//returnData.CTN = this.splitStrValue(returnData.CTN);
|
|
|
this.formEdit.getForm().setValues(returnData);
|
|
|
this.Editdata = returnData;
|
|
|
|
|
|
this.storeChildList.load({ params: { start: 0, limit: 9999, sort: '', condition: " CQ.GID in(select CARRIERCQGID from crm_QUOTATION_LINK where CUSTCQGID='" + returnData.GID + "' )"} });
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
}, //end save
|
|
|
|
|
|
onDelChildClick: function (button, event) {
|
|
|
var selectedRecords = this.formChild.selModel.getSelection();
|
|
|
Ext.MessageBox.confirm('提示', '确定删除记录吗?', function (btn) {
|
|
|
if (btn == 'yes') {
|
|
|
var form = this.formEdit.getForm();
|
|
|
var _GID = form.findField('GID').getValue();
|
|
|
|
|
|
for (var i = 0; i < selectedRecords.length; i++) {
|
|
|
var rec = selectedRecords[i];
|
|
|
|
|
|
//Ext.Msg.wait('正在保存数据, 请稍侯..');
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在删除数据...',
|
|
|
url: '/MvcShipping/CRM_QUOTATION_CUST/Delete',
|
|
|
scope: this,
|
|
|
params: {
|
|
|
data: Ext.JSON.encode(rec.data)
|
|
|
},
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
this.DetailDel = [];
|
|
|
|
|
|
Ext.MessageBox.hide();
|
|
|
var jsonresult = Ext.JSON.decode(response.responseText);
|
|
|
if (jsonresult.Success) {
|
|
|
var returnData = jsonresult.Data;
|
|
|
this.formEdit.getForm().reset();
|
|
|
//returnData.CTN = this.splitStrValue(returnData.CTN);//
|
|
|
this.formEdit.getForm().setValues(returnData);
|
|
|
this.Editdata = returnData;
|
|
|
|
|
|
this.storeChildList.load({ params: { start: 0, limit: 9999, sort: '', condition: " CQ.GID in(select CARRIERCQGID from crm_QUOTATION_LINK where CUSTCQGID='" + _GID + "' )"} });
|
|
|
} else {
|
|
|
alert(jsonresult.Message);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
}
|
|
|
}
|
|
|
}, this);
|
|
|
//aftereditform();
|
|
|
},
|
|
|
|
|
|
onSaveChildClick: function (button, event) {
|
|
|
|
|
|
var bodyChildDatas = [];
|
|
|
for (i = 0; i < this.storeChildList.getCount(); i += 1) {
|
|
|
var memberyf = this.storeChildList.getAt(i);
|
|
|
bodyChildDatas.push(memberyf);
|
|
|
};
|
|
|
var jsonChildBody = ConvertRecordsToJson(bodyChildDatas);
|
|
|
if (jsonChildBody == "") {
|
|
|
return;
|
|
|
}
|
|
|
Ext.Msg.wait('正在保存数据, 请稍侯..');
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在保存数据...',
|
|
|
url: '/MvcShipping/CRM_QUOTATION_CUST/SaveChild2',
|
|
|
scope: this,
|
|
|
async: false,
|
|
|
params: {
|
|
|
ChildBody: jsonChildBody
|
|
|
},
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
Ext.MessageBox.hide();
|
|
|
var jsonresult = Ext.JSON.decode(response.responseText);
|
|
|
if (jsonresult.Success) {
|
|
|
var returnData = jsonresult.Data;
|
|
|
this.formEdit.getForm().reset();
|
|
|
//returnData.CTN = this.splitStrValue(returnData.CTN);
|
|
|
this.formEdit.getForm().setValues(returnData);
|
|
|
this.Editdata = returnData;
|
|
|
|
|
|
var form = this.formEdit.getForm();
|
|
|
var _GID = form.findField('GID').getValue();
|
|
|
|
|
|
this.storeChildList.load({ params: { start: 0, limit: 9999, sort: '', condition: " CQ.GID in(select CARRIERCQGID from crm_QUOTATION_LINK where CUSTCQGID='" + _GID + "' )"} });
|
|
|
} 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
|
|
|
});
|
|
|
}
|
|
|
//alert('03');
|
|
|
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
|
|
|
ChildAfterEdit: function (editor, e, eOpts) {
|
|
|
if (e.field == 'CLIENTGID') {
|
|
|
//alert(e.field);
|
|
|
var currrecords = DsStoreQueryBy(this.storeChildCust, 'GId', e.value);
|
|
|
if (currrecords.getCount() > 0) {
|
|
|
var currdata = currrecords.getAt(0).data;
|
|
|
e.record.set('SHORTNAME', currdata.CustName);
|
|
|
e.record.set('DESCRIPTION', currdata.DESCRIPTION);
|
|
|
} else {
|
|
|
e.record.set('SHORTNAME', '');
|
|
|
e.record.set('DESCRIPTION', '');
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (e.field == 'PORTLOAD') {
|
|
|
//alert(e.field);
|
|
|
var currrecords = DsStoreQueryBy(this.storeCodeLoadport2, 'EDICODE', e.value);
|
|
|
if (currrecords.getCount() > 0) {
|
|
|
var currdata = currrecords.getAt(0).data;
|
|
|
e.record.set('PORTLOAD_REF', currdata.CodeAndName);
|
|
|
|
|
|
} else {
|
|
|
e.record.set('PORTLOAD_REF', "");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (e.field == 'PORTDISCHARGE') {
|
|
|
//alert(e.field);
|
|
|
var currrecords = DsStoreQueryBy(this.storeCodeDisport2, 'EDICODE', e.value);
|
|
|
if (currrecords.getCount() > 0) {
|
|
|
var currdata = currrecords.getAt(0).data;
|
|
|
e.record.set('PORTDISCHARGE_REF', currdata.CodeAndName);
|
|
|
|
|
|
} else {
|
|
|
e.record.set('PORTDISCHARGE_REF', "");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (e.field == 'CONTACTNAME') {
|
|
|
//alert(e.field);
|
|
|
var currrecords = DsStoreQueryBy(this.storeInfoClientContact2, 'SHOWNAME', e.value);
|
|
|
if (currrecords.getCount() > 0) {
|
|
|
var currdata = currrecords.getAt(0).data;
|
|
|
e.record.set('EMAIL', currdata.EMAIL);
|
|
|
|
|
|
} else {
|
|
|
e.record.set('EMAIL', "");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (e.field == 'CARRIER') {
|
|
|
|
|
|
this.CARRIER = e.value;
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
ChildBeforeEdit: function (editor, e, eOpts) {
|
|
|
|
|
|
if (e.field == 'CONTACTNAME') {
|
|
|
var s = " LINKID ='" + e.record.get('CLIENTGID') + "'";
|
|
|
this.storeInfoClientContact2.load({ params: { condition: s} });
|
|
|
}
|
|
|
|
|
|
if (e.record.get('BLSTATUS') == "1" || e.record.get('BLSTATUS') == "2" || e.record.get('BLSTATUS') == "3") {
|
|
|
return false;
|
|
|
}
|
|
|
},
|
|
|
|
|
|
onSaveandAddChildClick: function (button, event) {
|
|
|
|
|
|
var bodyChildDatas = [];
|
|
|
for (i = 0; i < this.storeChildList.getCount(); i += 1) {
|
|
|
var memberyf = this.storeChildList.getAt(i);
|
|
|
bodyChildDatas.push(memberyf);
|
|
|
};
|
|
|
var jsonChildBody = ConvertRecordsToJson(bodyChildDatas);
|
|
|
if (jsonChildBody == "") {
|
|
|
this.onAddChildClick();
|
|
|
return;
|
|
|
}
|
|
|
Ext.Msg.wait('正在保存数据, 请稍侯..');
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在保存数据...',
|
|
|
url: '/MvcShipping/CRM_QUOTATION_CUST/SaveChild2',
|
|
|
scope: this,
|
|
|
async: false,
|
|
|
params: {
|
|
|
ChildBody: jsonChildBody
|
|
|
},
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
Ext.MessageBox.hide();
|
|
|
var jsonresult = Ext.JSON.decode(response.responseText);
|
|
|
if (jsonresult.Success) {
|
|
|
/*
|
|
|
var returnData = jsonresult.Data;
|
|
|
this.formEdit.getForm().reset();
|
|
|
this.formEdit.getForm().setValues(returnData);
|
|
|
this.Editdata = returnData;
|
|
|
*/
|
|
|
this.storeChildList.commitChanges();
|
|
|
this.onAddChildClick();
|
|
|
} 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
|
|
|
});
|
|
|
}
|
|
|
//alert('03');
|
|
|
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
onSendMailClick: function (button, event) {
|
|
|
var basicForm = this.formEdit.getForm();
|
|
|
var data2 = this.formEdit.getForm().getValues(false, false, false);
|
|
|
|
|
|
var type = '0';
|
|
|
//var selectedRecords = this.formChild.selModel.getSelection();
|
|
|
Ext.MessageBox.confirm('提示', '确定发送邮件吗?', function (btn) {
|
|
|
if (btn == 'yes') {
|
|
|
var form = this.formEdit.getForm();
|
|
|
var _GID = form.findField('GID').getValue();
|
|
|
var _j = 0;
|
|
|
|
|
|
for (var i = 0; i < this.storeChildList.getCount(); i += 1) {
|
|
|
var rec = this.storeChildList.getAt(i);
|
|
|
|
|
|
if (rec.data.EMAIL == "") {
|
|
|
alert(rec.data.CONTACTNAME + " 没有设定邮箱地址");
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if (rec.data.ETD == "" || rec.data.PORTLOAD == "" || rec.data.PORTDISCHARGE == "") {
|
|
|
alert("需要有对供应商询价的ETD、装货港、卸货港");
|
|
|
return;
|
|
|
}
|
|
|
//Ext.Msg.wait('正在保存数据, 请稍侯..');
|
|
|
var URLID = "id=" + encrypt(rec.data.GID, decrypt("8cdd29a091e29cc101042f65", "^id548f@^fueam##54325jfs")) + "&cid=" + encrypt(COMPANYID, decrypt("8cdd29a091e29cc101042f65", "^id548f@^fueam##54325jfs"));
|
|
|
|
|
|
|
|
|
///////////////
|
|
|
var basicForm = this.formEdit.getForm();
|
|
|
if (!basicForm.isValid()) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
var data = this.formEdit.getForm().getValues(false, false, false);
|
|
|
|
|
|
//var _ctn = this.getStrValue(this.comboxCtn.getValue());
|
|
|
|
|
|
//data.CTN = _ctn;
|
|
|
|
|
|
var Detaildatas = [];
|
|
|
for (var i = 0; i < this.storeDetail.getCount(); i += 1) {
|
|
|
var member = this.storeDetail.getAt(i);
|
|
|
Detaildatas.push(member);
|
|
|
}
|
|
|
|
|
|
//商品明细
|
|
|
var DetailBody = ConvertRecordsToJson(Detaildatas);
|
|
|
var DetailDelBody = ConvertRecordsToJsonAll(this.DetailDel);
|
|
|
|
|
|
var CARRIERdatas = [];
|
|
|
for (var i = 0; i < this.storeCARRIERList.getCount(); i += 1) {
|
|
|
var member = this.storeCARRIERList.getAt(i);
|
|
|
CARRIERdatas.push(member);
|
|
|
}
|
|
|
|
|
|
//商品明细
|
|
|
var CARRIERBody = ConvertRecordsToJson(CARRIERdatas);
|
|
|
//var DetailDelBody = ConvertRecordsToJsonAll(this.DetailDel);
|
|
|
|
|
|
var bodyChildDatas = [];
|
|
|
for (i = 0; i < this.storeChildList.getCount(); i += 1) {
|
|
|
var memberyf = this.storeChildList.getAt(i);
|
|
|
bodyChildDatas.push(memberyf);
|
|
|
};
|
|
|
var jsonChildBody = ConvertRecordsToJson(bodyChildDatas);
|
|
|
if (jsonChildBody == "") {
|
|
|
|
|
|
Ext.Msg.wait('正在保存数据, 请稍侯..');
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在保存数据...',
|
|
|
url: '/MvcShipping/CRM_QUOTATION_CUST/Save',
|
|
|
scope: this,
|
|
|
params: {
|
|
|
opstatus: this.OpStatus,
|
|
|
data: Ext.JSON.encode(data),
|
|
|
DetailBody: DetailBody,
|
|
|
DetailDelBody: DetailDelBody,
|
|
|
CARRIERBody: CARRIERBody
|
|
|
},
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
this.DetailDel = [];
|
|
|
Ext.MessageBox.hide();
|
|
|
var jsonresult = Ext.JSON.decode(response.responseText);
|
|
|
if (jsonresult.Success) {
|
|
|
var returnData = jsonresult.Data;
|
|
|
this.formEdit.getForm().reset();
|
|
|
//returnData.CTN = this.splitStrValue(returnData.CTN);
|
|
|
this.formEdit.getForm().setValues(returnData);
|
|
|
|
|
|
this.Editdata = returnData;
|
|
|
|
|
|
//
|
|
|
if (this.OpStatus == 'add') {
|
|
|
var arrNewRecords = this.StoreList.insert(0, returnData);
|
|
|
this.editRecord = this.StoreList.getAt(0);
|
|
|
if (type == '0') {
|
|
|
this.OpStatus = 'edit';
|
|
|
//basicForm2.findField('BSNO').setDisabled(true);
|
|
|
//var data = this.formEdit.getForm().getValues(false, false, false);
|
|
|
|
|
|
this.storeDetail.load({ params: { condition: " LINKGID='" + this.editRecord.get('GID') + "'"} });
|
|
|
this.storeCARRIERList.load({ params: { condition: " LINKGID='" + this.editRecord.get('GID') + "'"} });
|
|
|
} else if (type == '1') {
|
|
|
window.close();
|
|
|
} else if (type == '2') {
|
|
|
this.LoadData('add', '');
|
|
|
}
|
|
|
if (type == '0') {
|
|
|
this.OpStatus = 'edit';
|
|
|
//basicForm2.findField('BSNO').setDisabled(true);
|
|
|
|
|
|
} else if (type == '1') {
|
|
|
window.close();
|
|
|
} else if (type == '2') {
|
|
|
this.LoadData('add', '');
|
|
|
}
|
|
|
}
|
|
|
else if (this.OpStatus == 'edit') {
|
|
|
var editp = Ext.create('CRM_QUOTATIONmb', returnData);
|
|
|
this.editRecord.fields.each(function (field) {
|
|
|
if (field.persist) {
|
|
|
name = field.name;
|
|
|
if (name != 'GID')
|
|
|
this.editRecord.set(name, editp.get(name));
|
|
|
}
|
|
|
}, this);
|
|
|
this.editRecord.commit();
|
|
|
if (type == '0') {
|
|
|
this.OpStatus = 'edit';
|
|
|
//basicForm2.findField('BSNO').setDisabled(true);
|
|
|
this.storeDetail.load({ params: { condition: " LINKGID='" + this.editRecord.get('GID') + "'"} });
|
|
|
this.storeChildList.load({ params: { start: 0, limit: 9999, sort: '', condition: " CQ.GID in(select CARRIERCQGID from crm_QUOTATION_LINK where CUSTCQGID='" + this.editRecord.get('GID') + "' )"} });
|
|
|
this.storeCARRIERList.load({ params: { condition: " LINKGID='" + this.editRecord.get('GID') + "'"} });
|
|
|
} else if (type == '1') {
|
|
|
window.close();
|
|
|
} else if (type == '2') {
|
|
|
this.LoadData('add', '');
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
////////////////
|
|
|
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在发送邮件...',
|
|
|
url: '/MvcShipping/CRM_QUOTATION_CUST/SendMailXJ',
|
|
|
scope: this,
|
|
|
params: {
|
|
|
data: Ext.JSON.encode(rec.data), data2: Ext.JSON.encode(data2), URLID: URLID
|
|
|
},
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
//this.DetailDel = [];
|
|
|
|
|
|
Ext.MessageBox.hide();
|
|
|
|
|
|
var jsonresult = Ext.JSON.decode(response.responseText);
|
|
|
if (jsonresult.Success) {
|
|
|
_j = _j + 1;
|
|
|
if (_j == this.storeChildList.getCount()) {
|
|
|
this.storeChildList.load({ params: { start: 0, limit: 9999, sort: '', condition: " CQ.GID in(select CARRIERCQGID from crm_QUOTATION_LINK where CUSTCQGID='" + _GID + "' )"} });
|
|
|
alert("发送成功");
|
|
|
//this.Save('0');
|
|
|
}
|
|
|
} else {
|
|
|
alert(jsonresult.Message);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
|
|
|
////////////////
|
|
|
} 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
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
return;
|
|
|
} else {
|
|
|
Ext.Msg.wait('正在保存数据, 请稍侯..');
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在保存数据...',
|
|
|
url: '/MvcShipping/CRM_QUOTATION_CUST/SaveChild2',
|
|
|
scope: this,
|
|
|
async: false,
|
|
|
params: {
|
|
|
ChildBody: jsonChildBody
|
|
|
},
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
Ext.MessageBox.hide();
|
|
|
var jsonresult = Ext.JSON.decode(response.responseText);
|
|
|
if (jsonresult.Success) {
|
|
|
//alert("保存成功");
|
|
|
|
|
|
|
|
|
//////////////
|
|
|
|
|
|
Ext.Msg.wait('正在保存数据, 请稍侯..');
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在保存数据...',
|
|
|
url: '/MvcShipping/CRM_QUOTATION_CUST/Save',
|
|
|
scope: this,
|
|
|
params: {
|
|
|
opstatus: this.OpStatus,
|
|
|
data: Ext.JSON.encode(data),
|
|
|
DetailBody: DetailBody,
|
|
|
DetailDelBody: DetailDelBody
|
|
|
},
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
this.DetailDel = [];
|
|
|
Ext.MessageBox.hide();
|
|
|
var jsonresult = Ext.JSON.decode(response.responseText);
|
|
|
if (jsonresult.Success) {
|
|
|
var returnData = jsonresult.Data;
|
|
|
this.formEdit.getForm().reset();
|
|
|
//returnData.CTN = this.splitStrValue(returnData.CTN);
|
|
|
this.formEdit.getForm().setValues(returnData);
|
|
|
//this.formHead.getForm().reset();
|
|
|
//this.formHead.getForm().setValues(returnData);
|
|
|
this.Editdata = returnData;
|
|
|
|
|
|
//
|
|
|
if (this.OpStatus == 'add') {
|
|
|
var arrNewRecords = this.StoreList.insert(0, returnData);
|
|
|
this.editRecord = this.StoreList.getAt(0);
|
|
|
if (type == '0') {
|
|
|
this.OpStatus = 'edit';
|
|
|
//basicForm2.findField('BSNO').setDisabled(true);
|
|
|
this.storeDetail.load({ params: { condition: " LINKGID='" + this.editRecord.get('GID') + "'"} });
|
|
|
} else if (type == '1') {
|
|
|
window.close();
|
|
|
} else if (type == '2') {
|
|
|
this.LoadData('add', '');
|
|
|
}
|
|
|
if (type == '0') {
|
|
|
this.OpStatus = 'edit';
|
|
|
//basicForm2.findField('BSNO').setDisabled(true);
|
|
|
|
|
|
} else if (type == '1') {
|
|
|
window.close();
|
|
|
} else if (type == '2') {
|
|
|
this.LoadData('add', '');
|
|
|
}
|
|
|
}
|
|
|
else if (this.OpStatus == 'edit') {
|
|
|
var editp = Ext.create('CRM_QUOTATIONmb', returnData);
|
|
|
this.editRecord.fields.each(function (field) {
|
|
|
if (field.persist) {
|
|
|
name = field.name;
|
|
|
if (name != 'GID')
|
|
|
this.editRecord.set(name, editp.get(name));
|
|
|
}
|
|
|
}, this);
|
|
|
this.editRecord.commit();
|
|
|
if (type == '0') {
|
|
|
this.OpStatus = 'edit';
|
|
|
//basicForm2.findField('BSNO').setDisabled(true);
|
|
|
this.storeDetail.load({ params: { condition: " LINKGID='" + this.editRecord.get('GID') + "'"} });
|
|
|
|
|
|
var form = this.formEdit.getForm();
|
|
|
var _GID = form.findField('GID').getValue();
|
|
|
this.storeChildList.load({ params: { start: 0, limit: 9999, sort: '', condition: " CQ.GID in(select CARRIERCQGID from crm_QUOTATION_LINK where CUSTCQGID='" + _GID + "' )"} });
|
|
|
|
|
|
} else if (type == '1') {
|
|
|
window.close();
|
|
|
} else if (type == '2') {
|
|
|
this.LoadData('add', '');
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在发送邮件...',
|
|
|
url: '/MvcShipping/CRM_QUOTATION_CUST/SendMailXJ',
|
|
|
scope: this,
|
|
|
params: {
|
|
|
data: Ext.JSON.encode(rec.data), data2: Ext.JSON.encode(data2), URLID: URLID
|
|
|
},
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
//this.DetailDel = [];
|
|
|
|
|
|
Ext.MessageBox.hide();
|
|
|
|
|
|
var jsonresult = Ext.JSON.decode(response.responseText);
|
|
|
if (jsonresult.Success) {
|
|
|
_j = _j + 1;
|
|
|
if (_j == this.storeChildList.getCount()) {
|
|
|
this.storeChildList.load({ params: { start: 0, limit: 9999, sort: '', condition: " CQ.GID in(select CARRIERCQGID from crm_QUOTATION_LINK where CUSTCQGID='" + _GID + "' )"} });
|
|
|
alert("发送成功");
|
|
|
//this.Save('0');
|
|
|
}
|
|
|
} else {
|
|
|
alert(jsonresult.Message);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
} 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
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
//////////////
|
|
|
|
|
|
} 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
|
|
|
});
|
|
|
}
|
|
|
//alert('03');
|
|
|
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
|
|
|
///////////////
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
}
|
|
|
}, this);
|
|
|
//aftereditform();
|
|
|
},
|
|
|
|
|
|
onSendMail2Click: function (button, event) {
|
|
|
var basicForm = this.formEdit.getForm();
|
|
|
|
|
|
//首先判断是否有船公司重复 有则return
|
|
|
var _CList = [];
|
|
|
for (var i = 0; i < this.storeCARRIERList.getCount(); i += 1) {
|
|
|
var member = this.storeCARRIERList.getAt(i);
|
|
|
if (_CList.indexOf(member.CARRIER) > 0) {
|
|
|
alert("报价中有重复的船公司信息");
|
|
|
return;
|
|
|
} else {
|
|
|
_CList.push(member.CARRIER);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//商品明细
|
|
|
//var CARRIERBody = ConvertRecordsToJson(CARRIERdatas);
|
|
|
|
|
|
Ext.MessageBox.confirm('提示', '确定发送邮件吗?', function (btn) {
|
|
|
if (btn == 'yes') {
|
|
|
//var form = this.formEdit.getForm().getValues(false, false, false);
|
|
|
|
|
|
//alert(form.data.EMAIL);
|
|
|
//return;
|
|
|
//var _GID = form.findField('GID').getValue();
|
|
|
//var _j = 0;
|
|
|
|
|
|
//for (var i = 0; i < this.storeChildList.getCount(); i += 1) {
|
|
|
var rec = this.formEdit.getForm().getValues(false, false, false);
|
|
|
|
|
|
if (rec.EMAIL == "") {
|
|
|
alert(rec.CONTACTNAME + " 联系人 " + "没有设定邮箱地址");
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if (rec.ETD == "" || rec.PORTLOAD == "" || rec.PORTDISCHARGE == "") {
|
|
|
alert("需要有ETD、装货港、卸货港");
|
|
|
return;
|
|
|
}
|
|
|
//Ext.Msg.wait('正在保存数据, 请稍侯..');
|
|
|
//var URLID = "id=" + encrypt(rec.data.GID, decrypt("8cdd29a091e29cc101042f65", "^id548f@^fueam##54325jfs")) + "&cid=" + encrypt(COMPANYID, decrypt("8cdd29a091e29cc101042f65", "^id548f@^fueam##54325jfs"));
|
|
|
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在发送邮件...',
|
|
|
url: '/MvcShipping/CRM_QUOTATION_CUST/SendMailBJ',
|
|
|
scope: this,
|
|
|
params: {
|
|
|
data: Ext.JSON.encode(rec)
|
|
|
},
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
//this.DetailDel = [];
|
|
|
|
|
|
Ext.MessageBox.hide();
|
|
|
|
|
|
var jsonresult = Ext.JSON.decode(response.responseText);
|
|
|
if (jsonresult.Success) {
|
|
|
//_j = _j + 1;
|
|
|
//if (_j == this.storeChildList.getCount()) {
|
|
|
//this.storeChildList.load({ params: { start: 0, limit: 9999, sort: '', condition: " CQ.GID in(select CARRIERCQGID from crm_QUOTATION_LINK where CUSTCQGID='" + _GID + "' )"} });
|
|
|
alert("发送成功");
|
|
|
//}
|
|
|
} else {
|
|
|
alert(jsonresult.Message);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
//}
|
|
|
}
|
|
|
}, this);
|
|
|
//aftereditform();
|
|
|
},
|
|
|
//#endregion
|
|
|
|
|
|
//#region 生成海运出口业务
|
|
|
onMakeOpseaeClick: function () {
|
|
|
|
|
|
var data = this.formEdit.getForm().getValues(false, false, false);
|
|
|
if (data.ETD == "" || data.PORTLOAD == "" || data.PORTDISCHARGE == "" || this.storeDetail.getCount() == 0) {
|
|
|
alert("生成海运进口业务,必须有ETD、装货港、卸货港,和至少一条报价明细");
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
|
|
|
Ext.Msg.wait('正在保存数据, 请稍侯..');
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在保存数据...',
|
|
|
url: '/MvcShipping/CRM_QUOTATION_CUST/MakeOpseae',
|
|
|
scope: this,
|
|
|
params: {
|
|
|
opstatus: this.OpStatus,
|
|
|
data: Ext.JSON.encode(data)
|
|
|
},
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
this.DetailDel = [];
|
|
|
this.OpStatus = 'edit';
|
|
|
Ext.MessageBox.hide();
|
|
|
|
|
|
var jsonresult = Ext.JSON.decode(response.responseText);
|
|
|
if (jsonresult.Success) {
|
|
|
alert("生成成功");
|
|
|
var returnData = jsonresult.Data;
|
|
|
/*
|
|
|
this.formEdit.getForm().reset();
|
|
|
this.formEdit.getForm().setValues(returnData);
|
|
|
this.Editdata = returnData;
|
|
|
|
|
|
this.storeChildList.load({ params: { start: 0, limit: 9999, sort: '', condition: " GID in(select CARRIERCQGID from crm_QUOTATION_LINK where CUSTCQGID='" + returnData.GID + "' )"} });
|
|
|
*/
|
|
|
} else {
|
|
|
alert(jsonresult.Message)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
//#endregion
|
|
|
|
|
|
//#region 编辑时按钮等的状态
|
|
|
GetEditStatus: function () {
|
|
|
var canedit = false;
|
|
|
//var bsStatus = this.formHead.getForm().findField('BSSTATUS').getValue();
|
|
|
//var BLSTATUS = this.formEdit.getForm().findField('BLSTATUS').getValue();
|
|
|
//var inputby = this.formEdit.getForm().findField('INPUTBY').getValue();
|
|
|
//var op = this.formHead.getForm().findField('OP').getValue();
|
|
|
/*
|
|
|
_this = this;
|
|
|
if (BLSTATUS == '锁定') {
|
|
|
canedit = false;
|
|
|
this.setSaveBtnStatus(canedit);
|
|
|
} else {
|
|
|
this.StoreOpRange.load({ params: { optype: "modOpAirnList" },
|
|
|
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 {
|
|
|
var recordins = DsStoreQueryBy(_this.StoreOpRange, 'OPID', inputby);
|
|
|
if (recordins.getCount() > 0) {
|
|
|
canedit = true;
|
|
|
} else {
|
|
|
canedit = false;
|
|
|
}
|
|
|
}
|
|
|
} else { canedit = false; }
|
|
|
|
|
|
_this.setSaveBtnStatus(canedit);
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
_this = this;
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在查询委托编号状态...',
|
|
|
url: '/MvcShipping/MsSysBillNoSet/GetData',
|
|
|
params: {
|
|
|
condition: "OPLBNAME='空运出口' AND RULEBLNO='委托编号'",
|
|
|
handle: 'edit'
|
|
|
},
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
var result = Ext.JSON.decode(response.responseText);
|
|
|
if (result.Success != true) {
|
|
|
var custno = _this.formHead.getForm().findField('CUSTNO');
|
|
|
custno.setReadOnly(true);
|
|
|
} else {
|
|
|
var data = result.data;
|
|
|
if (data.ISEDIT == '1') {
|
|
|
var custno = _this.formHead.getForm().findField('CUSTNO');
|
|
|
custno.setReadOnly(false);
|
|
|
} else {
|
|
|
if (data.RULEBLNO == '') {
|
|
|
var custno = _this.formHead.getForm().findField('CUSTNO');
|
|
|
custno.setReadOnly(false);
|
|
|
} else {
|
|
|
|
|
|
var custno = _this.formHead.getForm().findField('CUSTNO');
|
|
|
custno.setReadOnly(true);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
} else {
|
|
|
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
});
|
|
|
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在查询委托编号状态...',
|
|
|
url: '/MvcShipping/MsBaseInfo/GetRuleEdit',
|
|
|
params: {
|
|
|
rulename: '分提单号',
|
|
|
ruletype: '1'
|
|
|
},
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
var result = Ext.JSON.decode(response.responseText);
|
|
|
if (result.Success != true) {
|
|
|
var hblno = _this.formHead.getForm().findField('HBLNO');
|
|
|
hblno.setReadOnly(true);
|
|
|
}
|
|
|
} else {
|
|
|
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
});
|
|
|
*/
|
|
|
},
|
|
|
|
|
|
GetStringNum: function (str) {
|
|
|
var num = 0;
|
|
|
if (str == null || str == '') return num;
|
|
|
if (str.length == 0) return num;
|
|
|
var if_find = false;
|
|
|
var str_num = '';
|
|
|
for (var i = 0; i < str.length; i += 1) {
|
|
|
var member = str.substr(i, 1);
|
|
|
if ((member == '0') || (member == '1') || (member == '2') || (member == '3')
|
|
|
|| (member == '4') || (member == '5') || (member == '6') || (member == '7')
|
|
|
|| (member == '8') || (member == '9') || (member == '.') || (member == '-')) {
|
|
|
if (!if_find) {
|
|
|
str_num = str_num + member;
|
|
|
}
|
|
|
} else {
|
|
|
if_find = true;
|
|
|
}
|
|
|
}
|
|
|
return str_num;
|
|
|
|
|
|
},
|
|
|
|
|
|
setSaveBtnStatus: function (enable) {
|
|
|
var btnESave = Ext.getCmp('btnESave');
|
|
|
var btnESaveAndClose = Ext.getCmp('btnESaveAndClose');
|
|
|
var btnESaveAndNew = Ext.getCmp('btnESaveAndNew');
|
|
|
|
|
|
|
|
|
if (enable) {
|
|
|
btnESave.enable();
|
|
|
btnESaveAndClose.enable();
|
|
|
btnESaveAndNew.enable();
|
|
|
|
|
|
} else {
|
|
|
btnESave.disable();
|
|
|
btnESaveAndClose.disable();
|
|
|
btnESaveAndNew.disable();
|
|
|
}
|
|
|
},
|
|
|
//#endregion
|
|
|
|
|
|
//#region 打印
|
|
|
Print: function () {
|
|
|
|
|
|
var basicForm = this.formEdit.getForm();
|
|
|
var billNo = basicForm.findField('BSNO').value;
|
|
|
if (billNo == '*' || billNo == '') {
|
|
|
Ext.Msg.show({ title: '错误', msg: '单据还没有保存,请保存后再打印', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
var printType = 'MsOpAirn';
|
|
|
var sql1 = "SET LANGUAGE 'us_english' SELECT * FROM op_Airn WHERE BSNO = '" + billNo + "'";
|
|
|
var sql2 = "";
|
|
|
var sql3 = "";
|
|
|
var sql4 = "";
|
|
|
var sql5 = "";
|
|
|
var sql6 = "";
|
|
|
|
|
|
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
|
|
|
|
|
|
},
|
|
|
//#endregion
|
|
|
|
|
|
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 children = this.tabSeaepanel.items;
|
|
|
if (children) {
|
|
|
for (var i = children.length - 1, len = 0; i >= len; i--) {
|
|
|
if (children.items[i].id) {
|
|
|
if (children.items[i].id == 'pnlmodNewOpAirnInfo') {
|
|
|
|
|
|
} else {
|
|
|
children.items[i].close();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
this.tabSeaepanel.doLayout();
|
|
|
|
|
|
j = j - 1;
|
|
|
this.editRecord = this.StoreList.getAt(j);
|
|
|
if (this.OpStatus == 'edit') {
|
|
|
condition = " CQ.GID='" + this.editRecord.get('GID') + "'";
|
|
|
//this.storeBodyList.load({ params: { condition: condition} });
|
|
|
}
|
|
|
this.LoadData(this.OpStatus, condition);
|
|
|
},
|
|
|
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 children = this.tabSeaepanel.items;
|
|
|
if (children) {
|
|
|
for (var i = children.length - 1, len = 0; i >= len; i--) {
|
|
|
if (children.items[i].id) {
|
|
|
if (children.items[i].id == 'pnlmodNewOpAirnInfo') {
|
|
|
// this.tabSeaepanel.setActiveTab(i);
|
|
|
} else {
|
|
|
children.items[i].close();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
this.tabSeaepanel.doLayout();
|
|
|
|
|
|
j = j + 1;
|
|
|
this.editRecord = this.StoreList.getAt(j);
|
|
|
if (this.OpStatus == 'edit') {
|
|
|
condition = " CQ.GID='" + this.editRecord.get('GID') + "'";
|
|
|
//this.storeBodyList.load({ params: { condition: condition} });
|
|
|
}
|
|
|
this.LoadData(this.OpStatus, condition);
|
|
|
},
|
|
|
|
|
|
reLine: function (button, event) {
|
|
|
var _L = 1;
|
|
|
this.storeDetail.each(function (record) {
|
|
|
var ln = _L + "";
|
|
|
_L = _L + 1;
|
|
|
record.set('SEQUENCE', ln);
|
|
|
});
|
|
|
}
|
|
|
|
|
|
,
|
|
|
|
|
|
onAddDetailClick: function (button, event) {
|
|
|
|
|
|
var data = this.formEdit.getForm().getValues(false, false, false);
|
|
|
if (data.GID == "") {
|
|
|
|
|
|
return;
|
|
|
}
|
|
|
if (this.CARRIER == "") {
|
|
|
alert("请先选中一个船公司,没有的话请先在左下方窗口内添加。");
|
|
|
}
|
|
|
|
|
|
else {
|
|
|
|
|
|
record = Ext.create('CRM_QUOTATION_DETAILmb', {
|
|
|
'GID': NewGuid(),
|
|
|
'LINKGID': "",
|
|
|
'LINKGID2': "",
|
|
|
'FEETYPE': "",
|
|
|
'FEENAME': "",
|
|
|
'UNIT': "",
|
|
|
'UNITPRICE': "0",
|
|
|
'CURRENCY': "",
|
|
|
'CARRIER': this.CARRIER,
|
|
|
// CARRIER_REF: "",
|
|
|
'REMARK': "",
|
|
|
'CREATEUSER': "",
|
|
|
'CREATETIME': "",
|
|
|
'MODIFIEDUSER': "",
|
|
|
'MODIFIEDTIME': "",
|
|
|
'CTN': "",
|
|
|
'CTN2': "",
|
|
|
'CTNPRICE': "0",
|
|
|
'CTNPRICE2': "0",
|
|
|
'_20GP': "0",
|
|
|
'_40GP': "0",
|
|
|
'_40HC': "0",
|
|
|
'_45': "0",
|
|
|
'CTNPRICE': "0",
|
|
|
'CTNPRICE2': "0",
|
|
|
'ISUSE': "0"
|
|
|
});
|
|
|
this.storeDetail.add(record);
|
|
|
var n = this.storeDetail.getCount();
|
|
|
this.cellEditingDetail.startEditByPosition({ row: n - 1, column: 6 });
|
|
|
}
|
|
|
//aftereditform();
|
|
|
}
|
|
|
|
|
|
, onDelDetailClick: function (button, event) {
|
|
|
var selectedRecords = this.formDetail.selModel.getSelection();
|
|
|
Ext.MessageBox.confirm('提示', '确定删除记录吗?', function (btn) {
|
|
|
if (btn == 'yes') {
|
|
|
var bill = "";
|
|
|
for (var i = 0; i < selectedRecords.length; i++) {
|
|
|
record = selectedRecords[i];
|
|
|
if (record.data.GID != "") {
|
|
|
if (bill == "") {
|
|
|
bill = record.data.GID;
|
|
|
} else {
|
|
|
bill = bill + "," + record.data.GID;
|
|
|
}
|
|
|
}
|
|
|
this.storeDetail.remove(selectedRecords[i]);
|
|
|
}
|
|
|
if (bill != "") {
|
|
|
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在提交数据...',
|
|
|
url: '/MvcShipping/CRM_QUOTATION_CUST/DelDetail',
|
|
|
params: {
|
|
|
bill: bill
|
|
|
},
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
//var data = this.formEdit.getForm().getValues(false, false, false);
|
|
|
|
|
|
//this.storeDetail.load({ params: { condition: " LINKGID='" + data.GID + "'"} });
|
|
|
}
|
|
|
},
|
|
|
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);
|
|
|
//aftereditform();
|
|
|
}
|
|
|
, onAddCARRIERClick: function (button, event) {
|
|
|
|
|
|
var data = this.formEdit.getForm().getValues(false, false, false);
|
|
|
|
|
|
var record = Ext.create('CRM_QUOTATION_CARRIERmb', {
|
|
|
'GID': NewGuid(),
|
|
|
'LINKGID': "",
|
|
|
'LINKGID2': "",
|
|
|
'CARRIER': "",
|
|
|
'FREEDAYS': "7",
|
|
|
'REMARK': "",
|
|
|
'VALIDDATE': "",
|
|
|
'VALIDDATE_END': ""
|
|
|
});
|
|
|
this.storeCARRIERList.add(record);
|
|
|
|
|
|
var n = this.storeCARRIERList.getCount();
|
|
|
this.cellEditingCARRIER.startEditByPosition({ row: n - 1, column: 3 });
|
|
|
|
|
|
//aftereditform();
|
|
|
}
|
|
|
,
|
|
|
onDelCARRIERClick: function (button, event) {
|
|
|
var selectedRecords = this.formCARRIER.selModel.getSelection();
|
|
|
if (selectedRecords.length <= 0) {
|
|
|
return;
|
|
|
}
|
|
|
Ext.MessageBox.confirm('提示', '确定删除船公司吗?', function (btn) {
|
|
|
if (btn == 'yes') {
|
|
|
var bill = "";
|
|
|
for (var i = 0; i < selectedRecords.length; i++) {
|
|
|
record = selectedRecords[i];
|
|
|
if (bill == "") {
|
|
|
bill = record.data.GID;
|
|
|
} else {
|
|
|
bill = bill + "," + record.data.GID;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在提交数据...',
|
|
|
url: '/MvcShipping/CRM_QUOTATION_CUST/DelCARRIER',
|
|
|
params: {
|
|
|
bill: bill
|
|
|
},
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
var data = this.formEdit.getForm().getValues(false, false, false);
|
|
|
|
|
|
this.storeCARRIERList.load({ params: { condition: " LINKGID='" + data.GID + "'"} });
|
|
|
|
|
|
this.storeDetail.load({ params: { condition: " LINKGID='" + data.GID + "'"} });
|
|
|
}
|
|
|
},
|
|
|
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);
|
|
|
//aftereditform();
|
|
|
}
|
|
|
,
|
|
|
OprationSwap: function () {
|
|
|
var ret = new Array();
|
|
|
ret[0] = this.MainOpStatus;
|
|
|
ret[1] = [];
|
|
|
ret[2] = [];
|
|
|
ret[3] = this.formEdit.getForm();
|
|
|
return ret;
|
|
|
}
|
|
|
,
|
|
|
|
|
|
onRefreshClick2: function (button, event) {
|
|
|
var sql = this.getCondition2();
|
|
|
this.storeAddDetail.load({
|
|
|
params: { start: 0, limit: 9999, sort: '', condition: sql },
|
|
|
waitMsg: "正在查询数据...",
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
//alert("");
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
});
|
|
|
}
|
|
|
,
|
|
|
getCondition2: function () {
|
|
|
|
|
|
|
|
|
|
|
|
var sql = " (select BLTYPE from CRM_QUOTATION where GID=LINKGID)='供应商报价' and ((select BLSTATUS from CRM_QUOTATION where GID=LINKGID) in (2,3)) ";
|
|
|
|
|
|
var APSearch = Ext.getCmp("APSearch").getValue();
|
|
|
if (APSearch == true) {
|
|
|
var GID = this.formEdit.getForm().findField('GID').getValue();
|
|
|
sql = sql + "and LINKGID in(select CARRIERCQGID from CRM_QUOTATION_LINK where CUSTCQGID='" + GID + "') ";
|
|
|
}
|
|
|
|
|
|
var add_CARRIER = Ext.getCmp("add_CARRIER").getValue();
|
|
|
sql = sql + getAndConSql(sql, add_CARRIER, " CARRIER= '" + add_CARRIER + "' ");
|
|
|
|
|
|
var add_ETD = Ext.getCmp("add_ETD").getRawValue();
|
|
|
sql = sql + getAndConSql(sql, add_ETD, " dbo.trimdate(ETD) = '" + add_ETD + "' ");
|
|
|
|
|
|
var PORTDISCHARGE = Ext.getCmp("PORTDISCHARGE").getValue();
|
|
|
var PORTLOAD = Ext.getCmp("PORTLOAD").getValue();
|
|
|
sql = sql + getAndConSql(sql, PORTDISCHARGE, " LINKGID in (select GID from crm_quotation where PORTDISCHARGE='" + PORTDISCHARGE + "' and PORTLOAD='" + PORTLOAD + "') ");
|
|
|
|
|
|
return sql;
|
|
|
},
|
|
|
|
|
|
onAddClick: function () {
|
|
|
var GID = this.formEdit.getForm().findField('GID').getValue();
|
|
|
if (GID == "") {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
|
|
|
var selectedRecords = this.formAdd.selModel.getSelection();
|
|
|
for (var i = 0; i < selectedRecords.length; i++) {
|
|
|
var _d = selectedRecords[i].data;
|
|
|
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在审核通过...',
|
|
|
url: '/MvcShipping/CRM_QUOTATION_CUST/AddDetail',
|
|
|
params: {
|
|
|
BJ_GID: GID, //向客户报价
|
|
|
XJ_GID: _d.LINKGID, //向供应商询价
|
|
|
CARRIER: _d.CARRIER
|
|
|
},
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
//condition = " CQ.GID='" + bill + "'";
|
|
|
|
|
|
this.storeCARRIERList.load({ params: { condition: " LINKGID='" + GID + "'"} });
|
|
|
}
|
|
|
},
|
|
|
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
|
|
|
|
|
|
var record = Ext.create('CRM_QUOTATION_DETAILmb', {
|
|
|
'GID': NewGuid(),
|
|
|
'LINKGID': "",
|
|
|
'FEETYPE': _d.FEETYPE,
|
|
|
'FEENAME': _d.FEENAME,
|
|
|
'UNIT': _d.UNIT,
|
|
|
'UNITPRICE': _d.UNITPRICE,
|
|
|
'_20GP': _d._20GP,
|
|
|
'_40GP': _d._40GP,
|
|
|
'_40HC': _d._40HC,
|
|
|
'_45': _d._45,
|
|
|
'CTNPRICE': _d.CTNPRICE,
|
|
|
'CTNPRICE2': _d.CTNPRICE2,
|
|
|
'CURRENCY': _d.CURRENCY,
|
|
|
'CARRIER': _d.CARRIER,
|
|
|
'REMARK': _d.REMARK,
|
|
|
'ETD': _d.ETD,
|
|
|
'CREATEUSER': "",
|
|
|
'CREATETIME': currdate.format('yyyy-MM-dd hh:mm:ss'),
|
|
|
'MODIFIEDUSER': "",
|
|
|
'MODIFIEDTIME': currdate.format('yyyy-MM-dd hh:mm:ss')
|
|
|
});
|
|
|
this.storeDetail.add(record);
|
|
|
|
|
|
var n = this.storeDetail.getCount();
|
|
|
this.cellEditingDetail.startEditByPosition({ row: n - 1, column: 2 });
|
|
|
|
|
|
if (i == selectedRecords.length - 1) {
|
|
|
for (var j = 0; j < this.storeDetail.getCount(); j++) {
|
|
|
_f = this.storeDetail.getAt(j); //遍历每一行
|
|
|
if (_f.get('CREATEUSER') == "") {
|
|
|
_f.set('CREATEUSER', SHOWNAME);
|
|
|
_f.set('MODIFIEDUSER', SHOWNAME);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
this.Save('0');
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
getIsModify: function () {
|
|
|
|
|
|
return '';
|
|
|
}
|
|
|
/*
|
|
|
, setCTNhidden: function () {
|
|
|
|
|
|
var data = this.formEdit.getForm().getValues(false, false, false);
|
|
|
|
|
|
if (parseInt(data._20GP) != 0 ) {
|
|
|
this.DosetCTNhidden("_20GP", "20GP", false);
|
|
|
} else {
|
|
|
this.DosetCTNhidden("_20GP", "20GP", true);
|
|
|
}
|
|
|
|
|
|
if (parseInt(data._40GP) != 0) {
|
|
|
this.DosetCTNhidden("_40GP", "40GP", false);
|
|
|
} else {
|
|
|
this.DosetCTNhidden("_40GP", "40GP", true);
|
|
|
}
|
|
|
|
|
|
if (parseInt(data._40HC) != 0) {
|
|
|
this.DosetCTNhidden("_40HC", "40HC", false);
|
|
|
} else {
|
|
|
this.DosetCTNhidden("_40HC", "40HC", true);
|
|
|
}
|
|
|
|
|
|
if (parseInt(data._45) != 0) {
|
|
|
this.DosetCTNhidden("_45", "45GP", false);
|
|
|
} else {
|
|
|
this.DosetCTNhidden("_45", "45GP", true);
|
|
|
}
|
|
|
|
|
|
if (data.CTN != "") {
|
|
|
this.DosetCTNhidden("CTNPRICE", data.CTN, false);
|
|
|
} else {
|
|
|
this.DosetCTNhidden("CTNPRICE", data.CTN, true);
|
|
|
}
|
|
|
|
|
|
if (data.CTN2 != "") {
|
|
|
this.DosetCTNhidden("CTNPRICE2", data.CTN2, false);
|
|
|
} else {
|
|
|
this.DosetCTNhidden("CTNPRICE2", data.CTN2, true);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
, setCTNFieldhidden: function (fieldname,header,value) {
|
|
|
|
|
|
var data = this.formEdit.getForm().getValues(false, false, false);
|
|
|
|
|
|
if (parseInt(data._20GP) != 0) {
|
|
|
this.DosetCTNhidden("_20GP", "20GP", false);
|
|
|
} else {
|
|
|
this.DosetCTNhidden("_20GP", "20GP", true);
|
|
|
}
|
|
|
|
|
|
if (parseInt(data._40GP) != 0) {
|
|
|
this.DosetCTNhidden("_40GP", "40GP", false);
|
|
|
} else {
|
|
|
this.DosetCTNhidden("_40GP", "40GP", true);
|
|
|
}
|
|
|
|
|
|
if (parseInt(data._40HC) != 0) {
|
|
|
this.DosetCTNhidden("_40HC", "40HC", false);
|
|
|
} else {
|
|
|
this.DosetCTNhidden("_40HC", "40HC", true);
|
|
|
}
|
|
|
|
|
|
if (parseInt(data._45) != 0) {
|
|
|
this.DosetCTNhidden("_45", "45GP", false);
|
|
|
} else {
|
|
|
this.DosetCTNhidden("_45", "45GP", true);
|
|
|
}
|
|
|
|
|
|
if (data.CTN != "") {
|
|
|
this.DosetCTNhidden("CTNPRICE", data.CTN, false);
|
|
|
} else {
|
|
|
this.DosetCTNhidden("CTNPRICE", data.CTN, true);
|
|
|
}
|
|
|
|
|
|
if (data.CTN2 != "") {
|
|
|
this.DosetCTNhidden("CTNPRICE2", data.CTN2, false);
|
|
|
} else {
|
|
|
this.DosetCTNhidden("CTNPRICE2", data.CTN2, true);
|
|
|
}
|
|
|
}
|
|
|
*/
|
|
|
, DosetCTNhidden: function (fieldname, fieldvalue, value) {
|
|
|
|
|
|
var ishidden = false;
|
|
|
if (parseInt(value) <= 0) {
|
|
|
ishidden = true;
|
|
|
}
|
|
|
|
|
|
for (var i = 0; i < this.DetailColumns.length; i++) {
|
|
|
if (this.DetailColumns[i].dataIndex == fieldname) {
|
|
|
this.DetailColumns[i].header = fieldvalue;
|
|
|
this.DetailColumns[i].text = fieldvalue;
|
|
|
this.DetailColumns[i].hidden = ishidden;
|
|
|
}
|
|
|
}
|
|
|
this.formDetail.reconfigure(this.storeDetail, this.DetailColumns);
|
|
|
|
|
|
for (var i = 0; i < this.AddColumns.length; i++) {
|
|
|
if (this.AddColumns[i].dataIndex == fieldname) {
|
|
|
this.AddColumns[i].header = fieldvalue;
|
|
|
this.AddColumns[i].text = fieldvalue;
|
|
|
this.AddColumns[i].hidden = ishidden;
|
|
|
}
|
|
|
}
|
|
|
this.formAdd.reconfigure(this.storeAddDetail, this.AddColumns);
|
|
|
|
|
|
}
|
|
|
|
|
|
, StartAudit: function () {
|
|
|
var data = this.formEdit.getForm().getValues(false, false, false);
|
|
|
if (data.GID == "") {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if (data.BLSTATUS == "2" || data.BLSTATUS == "3") {
|
|
|
alert("已提交或已审核的报价不需要再次提交");
|
|
|
return;
|
|
|
} else {
|
|
|
bill = data.GID;
|
|
|
}
|
|
|
|
|
|
//var bill = record.data.GID;
|
|
|
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在审核通过...',
|
|
|
url: '/MvcShipping/CRM_QUOTATION_CUST/StartAudit',
|
|
|
params: {
|
|
|
USERID: USERID,
|
|
|
bill: bill
|
|
|
},
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
condition = " CQ.GID='" + bill + "'";
|
|
|
this.LoadData('edit', condition);
|
|
|
|
|
|
}
|
|
|
},
|
|
|
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
|
|
|
}
|
|
|
|
|
|
, Audit: function () {
|
|
|
var data = this.formEdit.getForm().getValues(false, false, false);
|
|
|
if (data.GID == "") {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if (data.BLSTATUS != "2") {
|
|
|
alert("只能撤回未审核的报价单");
|
|
|
return;
|
|
|
} else {
|
|
|
bill = data.GID;
|
|
|
}
|
|
|
|
|
|
//var bill = record.data.GID;
|
|
|
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在审核通过...',
|
|
|
url: '/MvcShipping/CRM_QUOTATION_CUST/Audit',
|
|
|
params: {
|
|
|
USERID: USERID,
|
|
|
bill: bill
|
|
|
},
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
condition = " CQ.GID='" + bill + "'";
|
|
|
this.LoadData('edit', condition);
|
|
|
this.onSendMail2Click();
|
|
|
}
|
|
|
},
|
|
|
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
|
|
|
}
|
|
|
|
|
|
, ResetAudit: function () {
|
|
|
var data = this.formEdit.getForm().getValues(false, false, false);
|
|
|
if (data.GID == "") {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if (data.BLSTATUS != "2") {
|
|
|
alert("只能撤回未审核的报价单");
|
|
|
return;
|
|
|
} else {
|
|
|
bill = data.GID;
|
|
|
}
|
|
|
|
|
|
//var bill = record.data.GID;
|
|
|
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在撤回...',
|
|
|
url: '/MvcShipping/CRM_QUOTATION_CUST/ResetAudit',
|
|
|
params: {
|
|
|
USERID: USERID,
|
|
|
bill: bill
|
|
|
},
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
condition = " CQ.GID='" + bill + "'";
|
|
|
this.LoadData('edit', condition);
|
|
|
}
|
|
|
},
|
|
|
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
|
|
|
}
|
|
|
|
|
|
, AuditBack: function () {
|
|
|
var data = this.formEdit.getForm().getValues(false, false, false);
|
|
|
if (data.GID == "") {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if (data.BLSTATUS == "1" || data.BLSTATUS == "0") {
|
|
|
//alert("已提交或已审核的报价不需要再次提交");
|
|
|
return;
|
|
|
} else {
|
|
|
bill = data.GID;
|
|
|
}
|
|
|
|
|
|
//var bill = record.data.GID;
|
|
|
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在审核通过...',
|
|
|
url: '/MvcShipping/CRM_QUOTATION_CUST/AuditBack',
|
|
|
params: {
|
|
|
USERID: USERID,
|
|
|
bill: bill
|
|
|
},
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
condition = " CQ.GID='" + bill + "'";
|
|
|
this.LoadData('edit', condition);
|
|
|
}
|
|
|
},
|
|
|
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
|
|
|
}
|
|
|
});
|
|
|
|
|
|
|