|
|
Ext.namespace('Shipping');
|
|
|
|
|
|
Shipping.MsCodeFeeTemplateEdit = function (config) {
|
|
|
Ext.applyIf(this, config);
|
|
|
this.initUIComponents();
|
|
|
window.Shipping.MsCodeFeeTemplateEdit.superclass.constructor.call(this);
|
|
|
};
|
|
|
|
|
|
Ext.extend(Shipping.MsCodeFeeTemplateEdit, Ext.Panel, {
|
|
|
|
|
|
ParentWin: null,
|
|
|
OpStatus: 'add',
|
|
|
StoreList: null,
|
|
|
EditRecord: null,
|
|
|
feeType: 0,
|
|
|
StoreFee: null,
|
|
|
|
|
|
//需求编号:SR2017061200005-3
|
|
|
initUIComponents: function () {
|
|
|
this.serialNo = 0;
|
|
|
this.workSerialNo = 0;
|
|
|
this.bodyDel = [];
|
|
|
|
|
|
this.feeaddtemplate = getUrlParam('feeaddtemplate');
|
|
|
|
|
|
//#region 编辑form
|
|
|
|
|
|
//枚举参照相关(编辑form)
|
|
|
|
|
|
this.StoreOpLb = Ext.create('Ext.data.Store', {
|
|
|
fields: ['OPLB', 'OPLBNAME']
|
|
|
});
|
|
|
this.StoreOpLb.add({ "OPLB": 1, "OPLBNAME": "海运出口" });
|
|
|
this.StoreOpLb.add({ "OPLB": 2, "OPLBNAME": "海运进口" });
|
|
|
this.StoreOpLb.add({ "OPLB": 3, "OPLBNAME": "空运出口" });
|
|
|
this.StoreOpLb.add({ "OPLB": 7, "OPLBNAME": "空运进口" });
|
|
|
this.StoreOpLb.add({ "OPLB": 4, "OPLBNAME": "报关业务" });
|
|
|
this.StoreOpLb.add({ "OPLB": 5, "OPLBNAME": "大宗散货" });
|
|
|
this.StoreOpLb.add({ "OPLB": 6, "OPLBNAME": "综合业务" });
|
|
|
this.StoreOpLb.add({ "OPLB": 8, "OPLBNAME": "陆运业务" });
|
|
|
|
|
|
this.comboxOpLb = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: Zi.LAN.OPTYPE, //'业务类别',
|
|
|
store: this.StoreOpLb,
|
|
|
valueField: 'OPLB',
|
|
|
displayField: 'OPLBNAME',
|
|
|
forceSelection: true,
|
|
|
name: 'OPTYPE'
|
|
|
});
|
|
|
|
|
|
|
|
|
this.storeAddDCType = Ext.create('Ext.data.Store', {
|
|
|
fields: ['DC', 'NAME']
|
|
|
});
|
|
|
this.storeAddDCType.add({ "DC": 1, "NAME": "应收" });
|
|
|
this.storeAddDCType.add({ "DC": 2, "NAME": "应付" });
|
|
|
|
|
|
this.comboxaddDCType = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: Zi.LAN.FEETYPE, //'费用类型',
|
|
|
store: this.storeAddDCType,
|
|
|
valueField: 'DC',
|
|
|
displayField: 'NAME',
|
|
|
forceSelection: true,
|
|
|
name: 'FEETYPE'
|
|
|
});
|
|
|
this.storeISPUBLIC = Ext.create('Ext.data.Store', {
|
|
|
fields: ['DC', 'NAME']
|
|
|
});
|
|
|
this.storeISPUBLIC.add({ "DC": "是", "NAME": "是" });
|
|
|
this.storeISPUBLIC.add({ "DC": "否", "NAME": "否" });
|
|
|
|
|
|
this.comboxISPUBLIC = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: Zi.LAN.ISPUBLIC, //'是否公共',
|
|
|
store: this.storeISPUBLIC,
|
|
|
valueField: 'DC',
|
|
|
displayField: 'NAME',
|
|
|
name: 'ISPUBLIC'
|
|
|
});
|
|
|
|
|
|
|
|
|
//表参照相关(编辑form)
|
|
|
|
|
|
//编辑form
|
|
|
this.formEdit = Ext.widget('form', {
|
|
|
region: 'center',
|
|
|
frame: true,
|
|
|
bodyPadding: 5,
|
|
|
autoScroll: true,
|
|
|
fieldDefaults: {
|
|
|
margins: '2 2 2 2',
|
|
|
labelAlign: 'right',
|
|
|
flex: 1,
|
|
|
labelWidth: 90,
|
|
|
msgTarget: 'qtip'
|
|
|
},
|
|
|
|
|
|
items: [
|
|
|
{//fieldset 1
|
|
|
xtype: 'fieldset',
|
|
|
defaultType: 'textfield',
|
|
|
layout: 'anchor',
|
|
|
defaults: {
|
|
|
anchor: '100%'
|
|
|
},
|
|
|
items: [{
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [{
|
|
|
fieldLabel: Zi.LAN.GID, //'GID',
|
|
|
name: 'GID', flex: 0, hidden: true, margins: '0'
|
|
|
}, {
|
|
|
fieldLabel: Zi.LAN.CORPID, //'CORPID',
|
|
|
name: 'CORPID', flex: 0, hidden: true, margins: '0'
|
|
|
}, {
|
|
|
fieldLabel: Zi.LAN.CREATEUSER, //'CREATEUSER',
|
|
|
name: 'CREATEUSER', flex: 0, hidden: true, margins: '0'
|
|
|
}, this.comboxOpLb, this.comboxaddDCType, {
|
|
|
fieldLabel: Zi.LAN.CREATEUSERREF, //'录入人',
|
|
|
readOnly: true,
|
|
|
name: 'CREATEUSERREF'
|
|
|
}, {
|
|
|
fieldLabel: Zi.LAN.CREATETIME, //'录入日期',
|
|
|
readOnly: true,
|
|
|
name: 'CREATETIME'
|
|
|
}
|
|
|
]
|
|
|
}, {
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [{
|
|
|
fieldLabel: Zi.LAN.NAME, //'模板名称',
|
|
|
name: 'NAME',
|
|
|
allowBlank: false
|
|
|
}, {
|
|
|
fieldLabel: Zi.LAN.DESCRIPTION, //'模板说明',
|
|
|
flex: 2, name: 'DESCRIPTION'
|
|
|
}, this.comboxISPUBLIC]
|
|
|
|
|
|
}, {
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [{
|
|
|
fieldLabel: Zi.LAN.REMARK, //'备注',
|
|
|
name: 'REMARK'
|
|
|
}]
|
|
|
|
|
|
}
|
|
|
]//end items(fieldset 1)
|
|
|
}//end fieldset 1
|
|
|
]//end root items
|
|
|
}); //end this.formEdit
|
|
|
|
|
|
//#endregion
|
|
|
|
|
|
//#region 按钮Toolbar
|
|
|
this.panelBtn = new Ext.Panel({
|
|
|
region: "north",
|
|
|
tbar: [
|
|
|
{
|
|
|
text: Zi.LAN.btnSave, //"保存",
|
|
|
iconCls: "btnsave",
|
|
|
handler: function (button, event) {
|
|
|
this.Save('0');
|
|
|
},
|
|
|
scope: this
|
|
|
},
|
|
|
{
|
|
|
text: Zi.LAN.btnSaveAndClose, //"保存并关闭",
|
|
|
handler: function (button, event) {
|
|
|
this.Save('1');
|
|
|
},
|
|
|
scope: this
|
|
|
},
|
|
|
'-',
|
|
|
{
|
|
|
text: Zi.LAN.btnSaveAndNew, //"保存并新建",
|
|
|
handler: function (button, event) {
|
|
|
this.Save('2');
|
|
|
},
|
|
|
scope: this
|
|
|
},
|
|
|
'-',
|
|
|
{
|
|
|
text: Zi.LAN.btnCopyAndNew, //"复制新建",
|
|
|
handler: function (button, event) {
|
|
|
|
|
|
var basicForm = this.formEdit.getForm();
|
|
|
this.opStatus = 'add';
|
|
|
basicForm.findField('GID').setDisabled(false);
|
|
|
var field = basicForm.findField('GID');
|
|
|
field.setValue(NewGuid());
|
|
|
basicForm.findField('GID').setDisabled(true);
|
|
|
field = basicForm.findField('CREATEUSERREF');
|
|
|
field.setValue('');
|
|
|
field = basicForm.findField('NAME');
|
|
|
field.setValue('');
|
|
|
|
|
|
for (var j = 0; j < this.storeBodyList.getCount(); j += 1) {
|
|
|
var memberbody = this.storeBodyList.getAt(j);
|
|
|
memberbody.set("TEMPLATEID", '*');
|
|
|
memberbody.commit();
|
|
|
};
|
|
|
},
|
|
|
scope: this
|
|
|
}
|
|
|
]
|
|
|
}); //end 按钮Toolbar
|
|
|
|
|
|
//#endregion
|
|
|
|
|
|
//#region 明细表
|
|
|
|
|
|
//明细表表格相关
|
|
|
|
|
|
|
|
|
//明细表-数据集
|
|
|
this.storeBodyList = Ext.create('Ext.data.Store', {
|
|
|
model: 'MsCodeFeeTemplateDetail',
|
|
|
remoteSort: true,
|
|
|
proxy: {
|
|
|
type: 'ajax',
|
|
|
url: '/MvcShipping/MsCodeFeeTemplate/GetBodyList',
|
|
|
reader: {
|
|
|
root: 'data',
|
|
|
totalProperty: 'totalCount'
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
//明细表表格
|
|
|
this.gridListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
|
|
|
clicksToEdit: 1
|
|
|
});
|
|
|
|
|
|
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.storeCustomerNameRef = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'DsShipping.ux.CustomRefModel',
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
|
|
|
});
|
|
|
this.storeCustomerNameRef.load({ params: { condition: ""} });
|
|
|
|
|
|
|
|
|
this.comboxCustomerNameRef = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
store: this.storeCustomerNameRef,
|
|
|
forceSelection: true,
|
|
|
name: 'CUSTOMERNAME',
|
|
|
valueField: 'CustName',
|
|
|
displayField: 'CodeAndName'
|
|
|
});
|
|
|
|
|
|
this.storeCustType = Ext.create('Ext.data.Store', {
|
|
|
fields: ['CLIENT', 'NAME']
|
|
|
});
|
|
|
this.storeCustType.add({ "CLIENT": 1, "NAME": "船公司" });
|
|
|
this.storeCustType.add({ "CLIENT": 2, "NAME": "订舱代理" });
|
|
|
this.storeCustType.add({ "CLIENT": 3, "NAME": "场站" });
|
|
|
this.storeCustType.add({ "CLIENT": 4, "NAME": "车队" });
|
|
|
this.storeCustType.add({ "CLIENT": 5, "NAME": "委托单位" });
|
|
|
this.storeCustType.add({ "CLIENT": 6, "NAME": "报关行" });
|
|
|
this.storeCustType.add({ "CLIENT": 7, "NAME": "代理" });
|
|
|
this.storeCustType.add({ "CLIENT": 8, "NAME": "航空公司" });
|
|
|
this.storeCustType.add({ "CLIENT": 9, "NAME": "发货人" });
|
|
|
this.storeCustType.add({ "CLIENT": 10, "NAME": "收货人" });
|
|
|
this.storeCustType.add({ "CLIENT": 11, "NAME": "船代" });
|
|
|
this.storeCustType.add({ "CLIENT": 12, "NAME": "码头" });
|
|
|
this.storeCustType.add({ "CLIENT": 13, "NAME": "其他" });
|
|
|
|
|
|
this.comboxCustType = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
store: this.storeCustType,
|
|
|
valueField: 'CLIENT',
|
|
|
displayField: 'NAME',
|
|
|
forceSelection: true,
|
|
|
name: 'CLIENT'
|
|
|
});
|
|
|
|
|
|
this.storeFeeUnit = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
fields: ['UNIT'],
|
|
|
proxy: { url: '/MvcShipping/MsCodeFeeTemplate/GetFeeUnit' }
|
|
|
});
|
|
|
this.storeFeeUnit.load({ params: { condition: ""} });
|
|
|
|
|
|
|
|
|
this.comboxFeeUnit = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
store: this.storeFeeUnit,
|
|
|
forceSelection: true,
|
|
|
name: 'UNIT',
|
|
|
valueField: 'UNIT',
|
|
|
displayField: 'UNIT'
|
|
|
});
|
|
|
|
|
|
this.storeIsCtn = Ext.create('Ext.data.Store', {
|
|
|
fields: ['DC', 'NAME']
|
|
|
});
|
|
|
this.storeIsCtn.add({ "DC": true, "NAME": "是" });
|
|
|
this.storeIsCtn.add({ "DC": false, "NAME": "否" });
|
|
|
|
|
|
this.comboxIsCtn = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
store: this.storeIsCtn,
|
|
|
valueField: 'DC',
|
|
|
displayField: 'NAME',
|
|
|
forceSelection: true,
|
|
|
name: 'ISCTN'
|
|
|
});
|
|
|
|
|
|
this.storeIsExChange = Ext.create('Ext.data.Store', {
|
|
|
fields: ['DC', 'NAME']
|
|
|
});
|
|
|
this.storeIsExChange.add({ "DC": 0, "NAME": "根据汇率设置" });
|
|
|
|
|
|
this.comboxIsExChange = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
store: this.storeIsExChange,
|
|
|
valueField: 'DC',
|
|
|
displayField: 'NAME',
|
|
|
// forceSelection: true,
|
|
|
name: 'EXCHANGERATE'
|
|
|
});
|
|
|
this.StoreFeeFrt = Ext.create('Ext.data.Store', {
|
|
|
fields: ['Frt']
|
|
|
});
|
|
|
this.StoreFeeFrt.add({ "Frt": "PP" });
|
|
|
this.StoreFeeFrt.add({ "Frt": "CC" });
|
|
|
|
|
|
this.comboxFeeFrt = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
store: this.StoreFeeFrt,
|
|
|
forceSelection: true,
|
|
|
name: 'FeeFrt',
|
|
|
valueField: 'Frt',
|
|
|
displayField: 'Frt'
|
|
|
});
|
|
|
|
|
|
this.gridList = new Ext.grid.GridPanel({
|
|
|
store: this.storeBodyList,
|
|
|
enableHdMenu: false,
|
|
|
region: 'center',
|
|
|
loadMask: { msg: Zi.LAN.ShuJuJiaZaiZhong },
|
|
|
trackMouseOver: true,
|
|
|
disableSelection: false,
|
|
|
plugins: [this.gridListCellEditing],
|
|
|
selType: 'cellmodel',
|
|
|
tbar: [{
|
|
|
text: Zi.LAN.btnAddDetail, //'增加费用明细',
|
|
|
tooltip: Zi.LAN.btnAddDetail, //'增加费用明细',
|
|
|
iconCls: "btnadddetail",
|
|
|
handler: function (button, event) {
|
|
|
this.onAddDetailClick(button, event, 1);
|
|
|
},
|
|
|
scope: this
|
|
|
}, '-', {
|
|
|
text: Zi.LAN.btnDeleteDetail, //'删除费用明细',
|
|
|
tooltip: Zi.LAN.btnDeleteDetail, //'删除费用明细',
|
|
|
iconCls: "btndeletedetail",
|
|
|
handler: function (button, event) {
|
|
|
this.onDelDetailClick(button, event, 1);
|
|
|
},
|
|
|
scope: this
|
|
|
}],
|
|
|
columns: [{
|
|
|
sortable: true,
|
|
|
dataIndex: 'GID',
|
|
|
header: Zi.LAN.GID, //'GID',
|
|
|
hidden: true,
|
|
|
width: 100
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'TEMPLATEID',
|
|
|
header: Zi.LAN.TEMPLATEID, //'TEMPLATEID',
|
|
|
hidden: true,
|
|
|
width: 100
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'FEENAME',
|
|
|
header: Zi.LAN.FEENAME, //'费用名称',
|
|
|
editor: this.comboxFeeNameRef,
|
|
|
width: 140
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'CLIENT',
|
|
|
header: Zi.LAN.CLIENT, //'结算对象类型',
|
|
|
editor: this.comboxCustType,
|
|
|
renderer: function (value, p, record) {
|
|
|
return record.data.CLIENTREF;
|
|
|
},
|
|
|
width: 80
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'CUSTOMERNAME',
|
|
|
header: Zi.LAN.CUSTOMERNAME, //'结算对象',
|
|
|
editor: this.comboxCustomerNameRef,
|
|
|
width: 110
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'UNIT',
|
|
|
header: Zi.LAN.UNIT, //'标准',
|
|
|
editor: this.comboxFeeUnit,
|
|
|
width: 80
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'ISCTN',
|
|
|
header: Zi.LAN.ISCTN, //'是否箱型',
|
|
|
editor: this.comboxIsCtn,
|
|
|
renderer: function (value, p, record) {
|
|
|
return record.data.ISCTNREF;
|
|
|
},
|
|
|
width: 80
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'CURRENCY',
|
|
|
header: Zi.LAN.CURRENCY, //'币别',
|
|
|
editor: this.comboxCurr,
|
|
|
width: 100
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'UNITPRICE',
|
|
|
header: Zi.LAN.UNITPRICE, //'单价',
|
|
|
editor: {
|
|
|
xtype: 'numberfield',
|
|
|
keyNavEnabled: false,
|
|
|
selectOnFocus: true,
|
|
|
hideTrigger: true,
|
|
|
mouseWheelEnabled: false,
|
|
|
enableKeyEvents: true
|
|
|
},
|
|
|
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
|
|
|
try {
|
|
|
var lsValue = usMoney(value, 2, '', false);
|
|
|
if (lsValue != "NaN") {
|
|
|
value = lsValue; if (parseFloat(lsValue) < 0) {
|
|
|
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
return value;
|
|
|
}
|
|
|
}
|
|
|
catch (e) {
|
|
|
return value;
|
|
|
}
|
|
|
return value;
|
|
|
},
|
|
|
align: 'right',
|
|
|
width: 80
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'EXCHANGERATE',
|
|
|
header: Zi.LAN.EXCHANGERATE, //'汇率',
|
|
|
editor: this.comboxIsExChange,
|
|
|
renderer: function (value, p, record) {
|
|
|
if (value == 0)
|
|
|
return Zi.LAN.GenJuSheZhiHuiLvShengCheng; //'根据设置汇率生成';
|
|
|
else return value;
|
|
|
},
|
|
|
// {
|
|
|
// xtype: 'numberfield',
|
|
|
// keyNavEnabled: false,
|
|
|
// selectOnFocus: true,
|
|
|
// hideTrigger: true,
|
|
|
// mouseWheelEnabled: false,
|
|
|
// decimalPrecision: 6,
|
|
|
// enableKeyEvents: true
|
|
|
// },
|
|
|
// renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 6, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>'; } } else { return value; } } catch (e) { return value; } return value; },
|
|
|
align: 'right',
|
|
|
width: 180
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'TAXRATE',
|
|
|
header: Zi.LAN.TAXRATE, //'单价',
|
|
|
editor: {
|
|
|
xtype: 'numberfield',
|
|
|
keyNavEnabled: false,
|
|
|
selectOnFocus: true,
|
|
|
hideTrigger: true,
|
|
|
mouseWheelEnabled: false,
|
|
|
enableKeyEvents: true
|
|
|
},
|
|
|
align: 'right',
|
|
|
width: 80
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'TAX',
|
|
|
header: Zi.LAN.TAX, //'单价',
|
|
|
editor: {
|
|
|
xtype: 'numberfield',
|
|
|
keyNavEnabled: false,
|
|
|
selectOnFocus: true,
|
|
|
hideTrigger: true,
|
|
|
mouseWheelEnabled: false,
|
|
|
enableKeyEvents: true
|
|
|
},
|
|
|
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
|
|
|
try {
|
|
|
var lsValue = usMoney(value, 2, '', false);
|
|
|
if (lsValue != "NaN") {
|
|
|
value = lsValue; if (parseFloat(lsValue) < 0) {
|
|
|
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
return value;
|
|
|
}
|
|
|
}
|
|
|
catch (e) {
|
|
|
return value;
|
|
|
}
|
|
|
return value;
|
|
|
},
|
|
|
align: 'right',
|
|
|
width: 80
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'FEEFRT',
|
|
|
header: Zi.LAN.FEEFRT, //'FRT',
|
|
|
editor: this.comboxFeeFrt,
|
|
|
width: 40
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'ISADVANCEDPAY',
|
|
|
header: Zi.LAN.ISADVANCEDPAY, //'垫付',
|
|
|
editor: {
|
|
|
xtype: 'checkboxfield',
|
|
|
inputValue: '1',
|
|
|
uncheckedValue: '0'
|
|
|
// selectOnFocus: true
|
|
|
},
|
|
|
renderer: function (value, cellmeta) {
|
|
|
if (value == '1') {
|
|
|
return "是";
|
|
|
}
|
|
|
},
|
|
|
width: 60
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'ISINVOICE',
|
|
|
header: Zi.LAN.ISINVOICE, //'不开发票',
|
|
|
editor: {
|
|
|
xtype: 'checkboxfield',
|
|
|
inputValue: '1',
|
|
|
uncheckedValue: '0'
|
|
|
// selectOnFocus: true
|
|
|
},
|
|
|
renderer: function (value, cellmeta) {
|
|
|
if (value == '1') {
|
|
|
return "是";
|
|
|
}
|
|
|
},
|
|
|
width: 60
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'SORT',
|
|
|
header: Zi.LAN.SORT, //'排序',
|
|
|
editor: {
|
|
|
xtype: 'numberfield',
|
|
|
keyNavEnabled: false,
|
|
|
selectOnFocus: true,
|
|
|
hideTrigger: true,
|
|
|
mouseWheelEnabled: false,
|
|
|
enableKeyEvents: true
|
|
|
},
|
|
|
align: 'right',
|
|
|
width: 80
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'REMARK',
|
|
|
header: Zi.LAN.REMARK, //'备注',
|
|
|
editor: {
|
|
|
xtype: 'textfield',
|
|
|
selectOnFocus: true,
|
|
|
enableKeyEvents: true
|
|
|
|
|
|
},
|
|
|
width: 150
|
|
|
}
|
|
|
]
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.panelService = new Ext.Panel({
|
|
|
title: Zi.LAN.FeeField, //'费用字段',
|
|
|
layout: "border",
|
|
|
region: 'center',
|
|
|
margin: '5 10',
|
|
|
|
|
|
items: [this.gridList]
|
|
|
});
|
|
|
|
|
|
|
|
|
this.paneldetail = new Ext.Panel({
|
|
|
layout: "border",
|
|
|
region: "center",
|
|
|
items: [
|
|
|
this.panelService
|
|
|
]
|
|
|
});
|
|
|
|
|
|
//#endregion 明细表
|
|
|
|
|
|
//#region 布局
|
|
|
//控件布局
|
|
|
this.panelTop = new Ext.Panel({
|
|
|
layout: "border",
|
|
|
region: "north",
|
|
|
height: 140,
|
|
|
items: [this.panelBtn, this.formEdit]
|
|
|
});
|
|
|
|
|
|
Ext.apply(this, {
|
|
|
items: [this.panelTop, this.paneldetail]
|
|
|
});
|
|
|
|
|
|
//#endregion
|
|
|
|
|
|
//绑定查询窗体
|
|
|
|
|
|
//初始化数据
|
|
|
|
|
|
if (this.feeaddtemplate == undefined) {
|
|
|
this.ParentWin = window.parent.opener;
|
|
|
this.InitData();
|
|
|
} else {
|
|
|
this.opStatus = 'add';
|
|
|
this.parentWin = window.parent.opener._thisfee;
|
|
|
if (this.parentWin) {
|
|
|
this.feeType = this.parentWin.feeType;
|
|
|
if (this.feeType == 1) {
|
|
|
this.StoreFee = this.parentWin.storeDrChFee;
|
|
|
} else if (this.feeType == 2) {
|
|
|
this.StoreFee = this.parentWin.storeCrChFee;
|
|
|
}
|
|
|
this.stroplb = this.parentWin.stroplb;
|
|
|
this.formEdit.getForm().findField('FEETYPE').setValue(this.feeType);
|
|
|
var myDate = new Date();
|
|
|
var mydatestr = Ext.util.Format.date(myDate, 'Y-m-d');
|
|
|
this.formEdit.getForm().findField('CREATETIME').setValue(mydatestr);
|
|
|
this.formEdit.getForm().findField('CREATEUSERREF').setValue(SHOWNAME);
|
|
|
var GID=NewGuid();
|
|
|
this.formEdit.getForm().findField('GID').setValue(GID);
|
|
|
this.formEdit.getForm().findField('ISPUBLIC').setValue('否');
|
|
|
|
|
|
if (this.stroplb == 'op_Seae') {
|
|
|
this.formEdit.getForm().findField('OPTYPE').setValue(1);
|
|
|
} else if (this.stroplb == 'op_Seai') {
|
|
|
this.formEdit.getForm().findField('OPTYPE').setValue(2);
|
|
|
} else if (this.stroplb == 'op_Aire') {
|
|
|
this.formEdit.getForm().findField('OPTYPE').setValue(3);
|
|
|
} else if (this.stroplb == 'op_Airi') {
|
|
|
this.formEdit.getForm().findField('OPTYPE').setValue(7);
|
|
|
} else if (this.stroplb == 'op_Apply') {
|
|
|
this.formEdit.getForm().findField('OPTYPE').setValue(4);
|
|
|
} else if (this.stroplb == 'op_Bulk') {
|
|
|
this.formEdit.getForm().findField('OPTYPE').setValue(5);
|
|
|
} else if (this.stroplb == 'op_other') {
|
|
|
this.formEdit.getForm().findField('OPTYPE').setValue(6);
|
|
|
}
|
|
|
for (i = 0; i < this.StoreFee.getCount(); i += 1) {
|
|
|
var memberyf = this.StoreFee.getAt(i);
|
|
|
var newSerialno = this.GetHandleSerialNo(this.storeBodyList);
|
|
|
var CustomerType = memberyf.data.CustomerType;
|
|
|
var records = DsStoreQueryBy(this.storeCustType, 'NAME', CustomerType);
|
|
|
var CLIENT = '';
|
|
|
if (records.getCount() > 0) {
|
|
|
var data = records.getAt(0).data;
|
|
|
CLIENT = data.CLIENT;
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
var Currency = memberyf.data.Currency;
|
|
|
var ExChangerate = 0;
|
|
|
if (Currency == 'RMB') ExChangerate = 1;
|
|
|
|
|
|
|
|
|
var record = Ext.create('MsCodeFeeTemplateDetail', {
|
|
|
GID: '',
|
|
|
TEMPLATEID: '',
|
|
|
FEENAME: memberyf.data.FeeName,
|
|
|
CUSTOMERNAME: memberyf.data.CustomerName,
|
|
|
CLIENT: CLIENT,
|
|
|
CLIENTREF: CustomerType,
|
|
|
UNIT: memberyf.data.Unit,
|
|
|
CURRENCY: memberyf.data.Currency,
|
|
|
UNITPRICE: memberyf.data.UnitPrice,
|
|
|
SORT: newSerialno,
|
|
|
EXCHANGERATE: ExChangerate,
|
|
|
CREATEUSER: "",
|
|
|
REMARK: memberyf.data.Remark,
|
|
|
FEEFRT: memberyf.data.FeeFrt,
|
|
|
ISCTN: false,
|
|
|
ISCTNREF: "否"
|
|
|
|
|
|
});
|
|
|
|
|
|
this.storeBodyList.add(record);
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
//绑定事件
|
|
|
this.gridList.on('edit', function (editor, e, eOpts) {
|
|
|
this.gridAfterEdit(editor, e, eOpts);
|
|
|
}, this);
|
|
|
|
|
|
this.storeBodyList.on('beforeload', function (store) {
|
|
|
var cargoid = 0;
|
|
|
if (this.opStatus == 'edit') {
|
|
|
cargoid = this.editRecord.get('GID');
|
|
|
|
|
|
}
|
|
|
var sql = " TEMPLATEID='" + cargoid + "'";
|
|
|
Ext.apply(store.proxy.extraParams, { condition: sql });
|
|
|
}, this);
|
|
|
|
|
|
|
|
|
}, //end initUIComponents
|
|
|
|
|
|
InitData: function () {
|
|
|
this.opStatus = 'add';
|
|
|
var condition = '';
|
|
|
if (this.ParentWin) {
|
|
|
var ret = this.ParentWin.OprationSwap();
|
|
|
this.opStatus = ret[0];
|
|
|
this.StoreList = ret[1];
|
|
|
this.editRecord = ret[2];
|
|
|
}
|
|
|
|
|
|
if (this.opStatus == 'edit')
|
|
|
condition = " GID='" + this.editRecord.get('GID') + "'";
|
|
|
|
|
|
this.LoadData(this.opStatus, condition);
|
|
|
|
|
|
}, //end InitData
|
|
|
|
|
|
LoadData: function (opstatus, condition) {
|
|
|
this.serialNo = 0;
|
|
|
this.workSerialNo = 0;
|
|
|
this.bodyDel = [];
|
|
|
|
|
|
this.opStatus = opstatus;
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: Zi.LAN.ZhengZaiChaXunShuJu, //'正在查询主表数据...',
|
|
|
url: '/MvcShipping/MsCodeFeeTemplate/GetData',
|
|
|
params: {
|
|
|
handle: opstatus,
|
|
|
condition: condition
|
|
|
},
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
var result = Ext.JSON.decode(response.responseText);
|
|
|
if (!result.Success) {
|
|
|
Ext.Msg.show({
|
|
|
title: Zi.LAN.TiShi, //'提示',
|
|
|
msg: result.Message,
|
|
|
icon: Ext.MessageBox.ERROR,
|
|
|
buttons: Ext.Msg.OK
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
var data = result.data;
|
|
|
this.formEdit.getForm().reset();
|
|
|
this.formEdit.getForm().setValues(data);
|
|
|
|
|
|
} else {
|
|
|
Ext.MessageBox.alert(Zi.LAN.FuWuQiXiangYingChuCuo, response.responseText);
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
});
|
|
|
|
|
|
var billno = '*';
|
|
|
var cargoid = 0;
|
|
|
if (this.opStatus == 'edit') {
|
|
|
cargoid = this.editRecord.get('GID');
|
|
|
|
|
|
}
|
|
|
this.storeBodyList.load({ params: { condition: " TEMPLATEID='" + cargoid + "'"} });
|
|
|
}, // end LoadDate
|
|
|
|
|
|
|
|
|
Save: function (type) {
|
|
|
var basicForm = this.formEdit.getForm();
|
|
|
|
|
|
if (!basicForm.isValid()) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
//判断表格数据是否合法
|
|
|
if (!validateEditorGridPanel(this.gridList)) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
basicForm.findField('GID').setDisabled(false);
|
|
|
var data = basicForm.getValues();
|
|
|
basicForm.findField('GID').setDisabled(true);
|
|
|
if (this.opStatus == 'add') {
|
|
|
data.DM_ID = NewGuid();
|
|
|
}
|
|
|
var bodydatas = [];
|
|
|
for (var i = 0; i < this.storeBodyList.getCount(); i += 1) {
|
|
|
var member = this.storeBodyList.getAt(i);
|
|
|
bodydatas.push(member);
|
|
|
}
|
|
|
|
|
|
var jsonBody = ConvertRecordsToJsonAll(bodydatas);
|
|
|
|
|
|
|
|
|
Ext.Msg.wait(Zi.LAN.ZhengZaiCaoZuoShuJu);
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: Zi.LAN.ZhengZaiCaoZuoShuJu, //'正在保存数据...',
|
|
|
url: '/MvcShipping/MsCodeFeeTemplate/Save',
|
|
|
scope: this,
|
|
|
params: {
|
|
|
opstatus: this.opStatus,
|
|
|
data: Ext.JSON.encode(data),
|
|
|
body: jsonBody
|
|
|
},
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
Ext.MessageBox.hide();
|
|
|
var jsonresult = Ext.JSON.decode(response.responseText);
|
|
|
if (jsonresult.Success) {
|
|
|
var returnData = jsonresult.Data;
|
|
|
this.formEdit.getForm().setValues(returnData);
|
|
|
|
|
|
if (this.opStatus == 'add') {
|
|
|
if (this.feeaddtemplate == undefined) {
|
|
|
} else {
|
|
|
var arrNewRecords = this.StoreList.add(returnData);
|
|
|
this.editRecord = arrNewRecords[0];
|
|
|
}
|
|
|
}
|
|
|
else if (this.opStatus == 'edit') {
|
|
|
var editp = Ext.create('MsCodeFeeTemplate', returnData);
|
|
|
this.editRecord.fields.each(function (field) {
|
|
|
if (field.persist) {
|
|
|
name = field.name;
|
|
|
if (name != 'id')
|
|
|
this.editRecord.set(name, editp.get(name));
|
|
|
}
|
|
|
}, this);
|
|
|
this.editRecord.commit();
|
|
|
}
|
|
|
if (type == '0') {
|
|
|
this.opStatus = 'edit';
|
|
|
|
|
|
basicForm.findField('GID').setDisabled(true);
|
|
|
|
|
|
for (var j = 0; j < this.storeBodyList.getCount(); j += 1) {
|
|
|
var memberbody = this.storeBodyList.getAt(j);
|
|
|
memberbody.set("GID", this.editRecord.get('GID'));
|
|
|
memberbody.commit();
|
|
|
};
|
|
|
|
|
|
} else if (type == '1') {
|
|
|
window.close();
|
|
|
} else {
|
|
|
this.LoadData('add', '');
|
|
|
basicForm.findField('GID').setDisabled(false);
|
|
|
}
|
|
|
} else {
|
|
|
Ext.Msg.show({ title: Zi.LAN.CuoWu, msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
|
|
|
}
|
|
|
} else {
|
|
|
Ext.Msg.show({ title: Zi.LAN.TiShi,
|
|
|
msg: Zi.LAN.FuWuQiXiangYingChuCuo,
|
|
|
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
}, //end save
|
|
|
|
|
|
onAddDetailClick: function (button, event, type) {
|
|
|
this.addDetail(type);
|
|
|
}, //end onAddDetailClick
|
|
|
|
|
|
onDelDetailClick: function (button, event, type) {
|
|
|
this.deleteDetail(type);
|
|
|
}, //onDelDetailClick
|
|
|
|
|
|
|
|
|
|
|
|
gridAfterEdit: function (editor, e, eOpts) {
|
|
|
//需要自己实现里面的事件
|
|
|
if (e.field == 'CLIENT') {
|
|
|
var records = DsStoreQueryBy(this.storeCustType, 'CLIENT', e.value);
|
|
|
if (records.getCount() > 0) {
|
|
|
var data = records.getAt(0).data;
|
|
|
var CLIENTNAME = data.NAME;
|
|
|
e.record.set('CLIENTREF', CLIENTNAME);
|
|
|
}
|
|
|
}
|
|
|
if (e.field == 'ISCTN') {
|
|
|
var isctn = e.value;
|
|
|
if (isctn == true)
|
|
|
e.record.set('ISCTNREF', "是");
|
|
|
else
|
|
|
e.record.set('ISCTNREF', "否");
|
|
|
}
|
|
|
if (e.field == 'CURRENCY') {
|
|
|
var isctn = e.value;
|
|
|
if (isctn == 'RMB')
|
|
|
e.record.set('EXCHANGERATE', 1);
|
|
|
else
|
|
|
e.record.set('EXCHANGERATE', 0);
|
|
|
}
|
|
|
},
|
|
|
|
|
|
addDetail: function (type) {
|
|
|
var newSerialno = 0;
|
|
|
|
|
|
store = this.storeBodyList;
|
|
|
var newSerialno = this.GetHandleSerialNo(store);
|
|
|
|
|
|
var record = Ext.create('MsCodeFeeTemplateDetail', {
|
|
|
GID: '',
|
|
|
TEMPLATEID: '',
|
|
|
FEENAME: "",
|
|
|
CUSTOMERNAME: "",
|
|
|
CLIENT: 5,
|
|
|
CLIENTREF: "委托单位",
|
|
|
UNIT: "单票",
|
|
|
CURRENCY: "RMB",
|
|
|
UNITPRICE: 0,
|
|
|
SORT: newSerialno,
|
|
|
EXCHANGERATE: 1,
|
|
|
CREATEUSER: "",
|
|
|
FEEFRT: "PP",
|
|
|
REMARK: "",
|
|
|
ISCTN: false,
|
|
|
ISCTNREF: "否"
|
|
|
|
|
|
});
|
|
|
|
|
|
store.add(record);
|
|
|
|
|
|
|
|
|
this.gridListCellEditing.startEditByPosition({ row: n - 1, column: 1 });
|
|
|
|
|
|
},
|
|
|
|
|
|
GetHandleSerialNo: function (store) {
|
|
|
var result = 0;
|
|
|
|
|
|
if (result == 0) {
|
|
|
for (var i = 0; i < store.getCount(); i += 1) {
|
|
|
var member = store.getAt(i);
|
|
|
if (parseInt(member.data.SORT) > parseInt(result)) {
|
|
|
result = member.data.SORT;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
result = parseInt(result) + 1;
|
|
|
return result;
|
|
|
},
|
|
|
|
|
|
deleteDetail: function (type) {
|
|
|
|
|
|
var selectedRecords = this.gridList.selModel.getSelection();
|
|
|
|
|
|
for (var i = 0; i < selectedRecords.length; i++) {
|
|
|
var rec = selectedRecords[i];
|
|
|
|
|
|
this.storeBodyList.remove(rec);
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
});
|
|
|
|
|
|
|