|
|
///<reference path="../../../../Views/../TruckMng/Scripts/vswd-ext_2.0.2.js" />
|
|
|
Ext.namespace('DsTruck');
|
|
|
|
|
|
var C_cargoinfo_id="";
|
|
|
var HTHCount=0;
|
|
|
var APPUsingCount=0;
|
|
|
var _this = null;
|
|
|
|
|
|
DsTruck.createEdit = function (config) {
|
|
|
Ext.applyIf(this, config);
|
|
|
this.initUIComponents();
|
|
|
window.DsTruck.createEdit.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);
|
|
|
|
|
|
function getSaved(){
|
|
|
var cargodirty=DsTruck.GetDirty(panelEdit.storeCargo,panelEdit.CargoDel);
|
|
|
|
|
|
if (panelEdit.formEdit.getForm().isDirty()== true || cargodirty==true)
|
|
|
{
|
|
|
return true;
|
|
|
}
|
|
|
else return false;
|
|
|
}
|
|
|
|
|
|
Ext.extend(DsTruck.createEdit, Ext.Panel, {
|
|
|
parentWin: null,
|
|
|
OpStatus: 'add',
|
|
|
StoreList: null,
|
|
|
editRecord: null,
|
|
|
// parentfunction: null,
|
|
|
_First: true,
|
|
|
initUIComponents: function () {
|
|
|
|
|
|
this.bodyDel = [];
|
|
|
this.CargoDel = [];
|
|
|
this.AppstateDel = [];
|
|
|
this.KCDel = [];
|
|
|
|
|
|
this.feeSerialNo = 0;
|
|
|
this.feeBodyDel = [];
|
|
|
this.CargoListName="CargoList_Create";
|
|
|
|
|
|
this.FactoryNo = "";
|
|
|
|
|
|
|
|
|
parentWin = window.parent.opener;
|
|
|
|
|
|
mainWin = getMainForm(parentWin);
|
|
|
|
|
|
//#region 枚举参照相关(编辑form)
|
|
|
|
|
|
this.comboxMainstate = getEnumcombox({ LABEL: '合同状态', NAME: 'Mainstate', enumTypeId: 3 });
|
|
|
|
|
|
//this.storeMainstate = Ext.create('DsExt.ux.RefEnumStore', {});
|
|
|
//this.storeMainstate.load({ params: { enumTypeId: 3} });
|
|
|
//this.comboxMainstate = Ext.create('DsExt.ux.RefEnumCombox', {
|
|
|
// fieldLabel: '合同状态',
|
|
|
// forceSelection: true,
|
|
|
// store: this.storeMainstate,
|
|
|
// name: 'Mainstate'
|
|
|
//});
|
|
|
|
|
|
|
|
|
this.storePrinted = Ext.create('DsExt.ux.RefEnumStore', {});
|
|
|
this.storePrinted.load({ params: { enumTypeId: 0} });
|
|
|
this.comboxPrinted = Ext.create('DsExt.ux.RefEnumCombox', {
|
|
|
fieldLabel: '发票打印完成',
|
|
|
forceSelection: true,
|
|
|
store: this.storePrinted,
|
|
|
name: 'Printed'
|
|
|
});
|
|
|
|
|
|
this.storeBillType = Ext.create('DsExt.ux.RefEnumStore', {});
|
|
|
this.storeBillType.load({ params: { enumTypeId: 6} });
|
|
|
this.comboxBillType = Ext.create('DsExt.ux.RefEnumCombox', {
|
|
|
fieldLabel: '提单提交方式',
|
|
|
forceSelection: true,
|
|
|
store: this.storeBillType,
|
|
|
name: 'BillType'
|
|
|
});
|
|
|
|
|
|
this.storeShipCompany = Ext.create('DsExt.ux.RefEnumStore', {});
|
|
|
this.storeShipCompany.load({ params: { enumTypeId: 5} });
|
|
|
this.comboxShipCompany = Ext.create('DsExt.ux.RefEnumCombox', {
|
|
|
fieldLabel: '船公司',
|
|
|
forceSelection: true,
|
|
|
store: this.storeShipCompany,
|
|
|
name: 'ShipCompany_id'
|
|
|
});
|
|
|
|
|
|
this.storeSeller = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'Tradermb',
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetTrader' }
|
|
|
});
|
|
|
//this.storeSeller.load({ params: { condition: " isagent=1"} });
|
|
|
this.storeSeller.loadData(mainWin.GetPubStore("IMPORT_SELLER").data.items);
|
|
|
this.comboxSeller = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: '贸易商',
|
|
|
forceSelection: true,
|
|
|
store: this.storeSeller,
|
|
|
name: 'seller',
|
|
|
valueField: 'name',
|
|
|
displayField: 'codename',
|
|
|
listeners: {
|
|
|
blur: function (field, newValue, oldValue) {
|
|
|
//if (field.displayTplData[0].ISSTOP=="True"){
|
|
|
// alert("该往来单位已经停用");
|
|
|
//}
|
|
|
/*
|
|
|
if (field.displayTplData[0].EDICODE2!=""){
|
|
|
//设置收单据模式
|
|
|
var _rawvalue=field.displayTplData[0].EDICODE2;
|
|
|
var RCVModes = DsStoreQueryBy(this.storeRCVMode, 'EnumValueName', _rawvalue);
|
|
|
if (RCVModes.getCount() > 0) {
|
|
|
var RCVMode = RCVModes.getAt(0).data;
|
|
|
Ext.getCmp("RCVMode").setValue(RCVMode.EnumValueId);
|
|
|
}
|
|
|
}
|
|
|
*/
|
|
|
if (field.displayTplData[0].RCVMode != "0") {
|
|
|
Ext.getCmp("RCVMode").setValue(field.displayTplData[0].RCVMode);
|
|
|
}
|
|
|
|
|
|
},
|
|
|
focus: function (field, newValue, oldValue) {
|
|
|
//在focus时 如果记录数为1 则载入
|
|
|
//if (this.storeSeller.getCount() <= 1) {
|
|
|
// this.storeSeller.load({ params: { condition: " isagent=1 " } });
|
|
|
//}
|
|
|
},
|
|
|
beforequery: function (e) {
|
|
|
return FilterCombox(e);
|
|
|
},
|
|
|
scope: this
|
|
|
}
|
|
|
});
|
|
|
|
|
|
this.storeBuyer = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'Tradermb',
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetTrader' }
|
|
|
});
|
|
|
//this.storeBuyer.load({ params: { condition: " isagentcn=1"} });
|
|
|
this.storeBuyer.loadData(mainWin.GetPubStore("IMPORT_BUYER").data.items);
|
|
|
this.comboxBuyer = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: '客户(购货方)',
|
|
|
forceSelection: true,
|
|
|
store: this.storeBuyer,
|
|
|
name: 'buyer',
|
|
|
valueField: 'name',
|
|
|
displayField: 'codename',
|
|
|
listeners: {
|
|
|
blur: function (field, newValue, oldValue) {
|
|
|
//if (field.displayTplData[0].ISSTOP=="True"){
|
|
|
// alert("该往来单位已经停用");
|
|
|
//}
|
|
|
/*
|
|
|
if (field.displayTplData[0].EDICODE2!=""){
|
|
|
//设置收单据模式
|
|
|
var _rawvalue=field.displayTplData[0].EDICODE2;
|
|
|
var RCVModes = DsStoreQueryBy(this.storeRCVMode, 'EnumValueName', _rawvalue);
|
|
|
if (RCVModes.getCount() > 0) {
|
|
|
var RCVMode = RCVModes.getAt(0).data;
|
|
|
Ext.getCmp("RCVMode").setValue(RCVMode.EnumValueId);
|
|
|
}
|
|
|
}
|
|
|
*/
|
|
|
},
|
|
|
focus: function (field, newValue, oldValue) {
|
|
|
//在focus时 如果记录数为1 则载入
|
|
|
//if (this.storeBuyer.getCount() <= 1) {
|
|
|
// this.storeBuyer.load({ params: { condition: " isagentcn=1 " } });
|
|
|
//}
|
|
|
},
|
|
|
beforequery: function (e) {
|
|
|
return FilterCombox(e);
|
|
|
},
|
|
|
scope: this
|
|
|
}
|
|
|
});
|
|
|
|
|
|
this.storeTRADINGAGENCY = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'Tradermb',
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetTrader' }
|
|
|
});
|
|
|
//this.storeTRADINGAGENCY.load({ params: { condition: " ISTRADINGAGENCY=1"} });
|
|
|
this.comboxTRADINGAGENCY = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: '订货方(中间商)',
|
|
|
forceSelection: true,
|
|
|
store: this.storeTRADINGAGENCY,
|
|
|
name: 'TRADINGAGENCY', id: "cmbTRADINGAGENCY",
|
|
|
matchFieldWidth: false,
|
|
|
valueField: 'name',
|
|
|
displayField: 'codename',
|
|
|
listeners: {
|
|
|
blur: function (field, newValue, oldValue) {
|
|
|
//if (field.displayTplData[0].ISSTOP=="True"){
|
|
|
// alert("该往来单位已经停用");
|
|
|
//}
|
|
|
},
|
|
|
focus: function (field, newValue, oldValue) {
|
|
|
//在focus时 如果记录数为1 则载入
|
|
|
if (this.storeTRADINGAGENCY.getCount() <= 1) {
|
|
|
this.storeTRADINGAGENCY.load({ params: { condition: " ISTRADINGAGENCY=1 " } });
|
|
|
}
|
|
|
},
|
|
|
beforequery: function (e) {
|
|
|
return FilterCombox(e);
|
|
|
},
|
|
|
scope: this
|
|
|
}
|
|
|
});
|
|
|
|
|
|
this.storeSecurityDeposit = Ext.create('DsExt.ux.RefEnumStore', {});
|
|
|
this.storeSecurityDeposit.load({ params: { enumTypeId: 0} });
|
|
|
this.comboxSecurityDeposit = Ext.create('DsExt.ux.RefEnumCombox', {
|
|
|
fieldLabel: '是否已交保证金',
|
|
|
forceSelection: true,
|
|
|
store: this.storeSecurityDeposit,
|
|
|
name: 'SecurityDeposit'
|
|
|
});
|
|
|
this.storeTransactionMethod = Ext.create('DsExt.ux.RefEnumStore', {});
|
|
|
this.storeTransactionMethod.load({ params: { enumTypeId: 1} });
|
|
|
this.comboxTransactionMethod = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: '成交方式',
|
|
|
forceSelection: true,
|
|
|
store: this.storeTransactionMethod,
|
|
|
name: 'TransactionMethod',
|
|
|
valueField: 'EnumValueId',
|
|
|
displayField: 'EnumValueName',
|
|
|
triggerAction: 'all',
|
|
|
selectOnFocus: true,
|
|
|
listeners: {
|
|
|
change: function (field, newValue, oldValue) {
|
|
|
this.setBaolv(field, newValue, oldValue);
|
|
|
},
|
|
|
scope: this
|
|
|
},
|
|
|
flex:1
|
|
|
});
|
|
|
|
|
|
this.storePaymentMethods = Ext.create('DsExt.ux.RefEnumStore', {});
|
|
|
this.storePaymentMethods.load({ params: { enumTypeId: 4} });
|
|
|
this.comboxPaymentMethods = Ext.create('DsExt.ux.RefEnumCombox', {
|
|
|
fieldLabel: '付款方式',
|
|
|
forceSelection: true,
|
|
|
store: this.storePaymentMethods,
|
|
|
name: 'PaymentMethods'
|
|
|
});
|
|
|
this.storeport = Ext.create('DsExt.ux.RefEnumStore', {});
|
|
|
this.storeport.load({ params: { enumTypeId: 10} });
|
|
|
this.comboxport = Ext.create('DsExt.ux.RefEnumCombox', {
|
|
|
fieldLabel: '目的港',
|
|
|
forceSelection: true,
|
|
|
store: this.storeport,
|
|
|
name: 'port',
|
|
|
listeners: {
|
|
|
blur: function (field, newValue, oldValue) {
|
|
|
|
|
|
//alert(field.displayTplData[0].VerNo);
|
|
|
//Ext.getCmp("Agent").setValue(field.displayTplData[0].VerNo);
|
|
|
},
|
|
|
change:function(field, newValue, oldValue){
|
|
|
var cgid = '';
|
|
|
var sname = field.rawValue;
|
|
|
var smodle;
|
|
|
if (sname=='天津') {
|
|
|
var comlist = this.storeCompany.data.items;
|
|
|
for (var i = 0; i < comlist.length; i++) {
|
|
|
var cname = comlist[i].data.NAME;
|
|
|
smodle = comlist[i];
|
|
|
if (cname=='天津誉恒') {
|
|
|
cgid = comlist[i].data.GID;
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}else if (sname=='上海') {
|
|
|
var comlist = this.storeCompany.data.items;
|
|
|
for (var i = 0; i < comlist.length; i++) {
|
|
|
var cname = comlist[i].data.NAME;
|
|
|
smodle = comlist[i];
|
|
|
if (cname=='上海同华') {
|
|
|
cgid = comlist[i].data.GID;
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}else if (sname=='青岛') {
|
|
|
var comlist = this.storeCompany.data.items;
|
|
|
for (var i = 0; i < comlist.length; i++) {
|
|
|
var cname = comlist[i].data.NAME;
|
|
|
smodle = comlist[i];
|
|
|
if (cname=='青岛泽岳') {
|
|
|
cgid = comlist[i].data.GID;
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}else if (sname=='大连') {
|
|
|
var comlist = this.storeCompany.data.items;
|
|
|
for (var i = 0; i < comlist.length; i++) {
|
|
|
var cname = comlist[i].data.NAME;
|
|
|
smodle = comlist[i];
|
|
|
if (cname=='大连可莱尔') {
|
|
|
cgid = comlist[i].data.GID;
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
this.comboxAgent.value=cgid;
|
|
|
this.comboxAgent.select(smodle);
|
|
|
|
|
|
},
|
|
|
scope: this
|
|
|
}
|
|
|
});
|
|
|
//表参照相关
|
|
|
this.storeCountry = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'ConutryRef',
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetCountryRefList' }
|
|
|
});
|
|
|
//this.storeCountry.load({ params: { condition: ""} });
|
|
|
this.comboxCountry = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: '进口国',
|
|
|
forceSelection: true,
|
|
|
matchFieldWidth: false,
|
|
|
store: this.storeCountry,
|
|
|
name: 'countryid',
|
|
|
valueField: 'countryid',
|
|
|
displayField: 'country_idandname',
|
|
|
listeners: {
|
|
|
focus: function (field, newValue, oldValue) {
|
|
|
if (this.storeCountry.getCount() <= 1) {
|
|
|
this.storeCountry.load({ params: { condition: "" } });
|
|
|
}
|
|
|
},
|
|
|
beforequery: function (e) {
|
|
|
return FilterCombox(e);
|
|
|
},
|
|
|
scope: this
|
|
|
}
|
|
|
});
|
|
|
this.storeFactoryNo = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'FactoryNomb',
|
|
|
proxy: { url: '/Import/CargoName/GetFactoryNoList' }
|
|
|
});
|
|
|
this.comboxCountry.addListener('select', function (combo, record, index) {
|
|
|
var s = " countryid='" + combo.value+"'";
|
|
|
//alert(s);
|
|
|
//this.storeCargoinfo.removeAll();
|
|
|
this.storeCargoinfo.load({ params: { condition: s } });
|
|
|
this.storeFactoryNo.load({ params: { start: 0, limit: 5000, condition: s } });
|
|
|
//this.comboxCargoinfo.clearValue();
|
|
|
}, this);
|
|
|
this.comboxCountry.addListener('afterrender', function (combo, record, index) {
|
|
|
var s = " countryid='" + combo.value + "'";
|
|
|
//alert(s);
|
|
|
//this.storeCargoinfo.removeAll();
|
|
|
if (combo.value != null) {
|
|
|
this.storeCargoinfo.load({ params: { condition: s } });
|
|
|
this.storeFactoryNo.load({ params: { start: 0, limit: 5000, condition: s } });
|
|
|
}
|
|
|
//this.comboxCargoinfo.clearValue();
|
|
|
}, this);
|
|
|
this.storeUser = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'DsTruckMng.ux.UserRefModel',
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' }
|
|
|
});
|
|
|
this.storeUser.load({ params: { condition: "(ISDELETED=0 and ISDISABLE=0)"} });
|
|
|
this.comboxCreator = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: '接单人',
|
|
|
forceSelection: true,
|
|
|
store: this.storeUser,
|
|
|
name: 'creator',
|
|
|
valueField: 'UserCode',
|
|
|
displayField: 'CodeAndName',
|
|
|
allowBlank: false
|
|
|
});
|
|
|
|
|
|
this.comboxAuditor = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: '审单人',
|
|
|
forceSelection: true,
|
|
|
store: this.storeUser,
|
|
|
name: 'Auditor',
|
|
|
valueField: 'UserCode',
|
|
|
displayField: 'CodeAndName'
|
|
|
});
|
|
|
|
|
|
this.storeOP = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'DsTruckMng.ux.UserRefModel',
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' }
|
|
|
});
|
|
|
this.storeOP.load({ params: { condition: "(ISDELETED=0 and ISDISABLE=0)"} });
|
|
|
this.comboxOP = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: '操作人',
|
|
|
forceSelection: true,
|
|
|
store: this.storeOP,
|
|
|
name: 'OP',
|
|
|
valueField: 'UserName',
|
|
|
displayField: 'CodeAndName'
|
|
|
});
|
|
|
|
|
|
this.storePaymentMethods = Ext.create('DsExt.ux.RefEnumStore', {});
|
|
|
this.storePaymentMethods.load({ params: { enumTypeId: 4 } });
|
|
|
this.comboxPaymentMethods = Ext.create('DsExt.ux.RefEnumCombox', {
|
|
|
fieldLabel: '付款方式',
|
|
|
forceSelection: true,
|
|
|
store: this.storePaymentMethods,
|
|
|
name: 'PaymentMethods'
|
|
|
});
|
|
|
this.storeFStatus = Ext.create('DsExt.ux.RefEnumStore', {});
|
|
|
this.storeFStatus.load({ params: { enumTypeId: 16} });
|
|
|
this.comboxFStatus = Ext.create('DsExt.ux.RefEnumCombox', {
|
|
|
fieldLabel: '融资状态',
|
|
|
forceSelection: true,
|
|
|
store: this.storeFStatus,
|
|
|
name: 'FinanceStatus'
|
|
|
});
|
|
|
|
|
|
this.storeRCVMode = Ext.create('DsExt.ux.RefEnumStore', {});
|
|
|
this.storeRCVMode.load({ params: { enumTypeId: 23 } });
|
|
|
this.comboxRCVMode = Ext.create('DsExt.ux.RefEnumCombox', {
|
|
|
fieldLabel: '收单据模式',id:"RCVMode",
|
|
|
forceSelection: true,
|
|
|
store: this.storeRCVMode,
|
|
|
name: 'RCVMode'
|
|
|
});
|
|
|
|
|
|
this.storeBUZTYPE = Ext.create('DsExt.ux.RefEnumStore', {});
|
|
|
this.storeBUZTYPE.load({ params: { enumTypeId: 27 } });
|
|
|
this.comboxBUZTYPE = Ext.create('DsExt.ux.RefEnumCombox', {
|
|
|
fieldLabel: '业务类型',
|
|
|
forceSelection: true,
|
|
|
store: this.storeBUZTYPE,
|
|
|
name: 'BUZTYPE'
|
|
|
});
|
|
|
|
|
|
this.storeContainerType = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'DsTruckMng.ux.CtnRefModel',
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetCtnDispList' }
|
|
|
});
|
|
|
this.storeContainerType.load({ params: { condition: ""} });
|
|
|
this.comboxContainerType = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: '箱型',
|
|
|
store: this.storeContainerType,
|
|
|
name: 'CTN',
|
|
|
valueField: 'CtnName',
|
|
|
//disabled: true,
|
|
|
displayField: 'CtnName'
|
|
|
});
|
|
|
|
|
|
this.storeagent = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'DsShipping.ux.CustomRefModel',
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
|
|
|
});
|
|
|
//this.storeagent.load({ params: { condition: "" } }); //国内代理 代理商
|
|
|
|
|
|
this.storeCompany = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'MsCompanysEntity',
|
|
|
proxy: { url: '/MvcShipping/MsCompanys/GetNoPicDataList' }
|
|
|
});
|
|
|
this.storeCompany.load({ params: { condition: " isDelegate = 1 " } });
|
|
|
|
|
|
this.storeCompanyFull = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'CompanyModel',
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetcompanyList' }
|
|
|
});
|
|
|
//this.storeCompanyFull.load();
|
|
|
|
|
|
this.comboxCompany = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: '用证公司',
|
|
|
store: this.storeCompanyFull,
|
|
|
forceSelection: true,
|
|
|
name: 'company',
|
|
|
id: "company",
|
|
|
valueField: 'gid',
|
|
|
displayField: 'name',
|
|
|
listeners: {
|
|
|
blur: function (field, newValue, oldValue) {
|
|
|
//20191008 鑫鹏威 选择用证公司后将中间商填写成相同名字
|
|
|
zjs = Ext.getCmp("cmbTRADINGAGENCY").getValue('name');
|
|
|
|
|
|
if (field.displayTplData[0].name != "")
|
|
|
{
|
|
|
if (zjs == "")
|
|
|
{
|
|
|
Ext.getCmp("cmbTRADINGAGENCY").setValue(field.displayTplData[0].name);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
},
|
|
|
focus: function (field, newValue, oldValue) {
|
|
|
if (this.storeCompanyFull.getCount() <= 1) {
|
|
|
this.storeCompanyFull.load();
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
}
|
|
|
});
|
|
|
this.comboxAgent = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: '代理公司',
|
|
|
store: this.storeCompany,
|
|
|
forceSelection: true,
|
|
|
name: 'Agent', id: "Agent",
|
|
|
valueField: 'GID',
|
|
|
displayField: 'NAME'
|
|
|
});
|
|
|
this.comboxAgent2 = Ext.create('DsExt.ux.DCombox', {
|
|
|
fieldLabel: '代理公司2',
|
|
|
store: this.storeagent,
|
|
|
forceSelection: true,
|
|
|
name: 'Agent2', id: "Agent2",
|
|
|
valueField: 'CustName',
|
|
|
displayField: 'CodeAndName'
|
|
|
});
|
|
|
this.comboxAgent3 = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: '代理公司3',
|
|
|
store: this.storeagent,
|
|
|
forceSelection: true,
|
|
|
name: 'Agent3', id: "Agent3",
|
|
|
valueField: 'CustName',
|
|
|
displayField: 'CodeAndName'
|
|
|
});
|
|
|
|
|
|
//国内港口(出口装货港、进口卸货港)
|
|
|
this.storeCodeLoadport = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'DsShipping.ux.CodeLoadportModel',
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetCodeLoadportList' }
|
|
|
});
|
|
|
this.storeCodeLoadport.load();
|
|
|
this.comboxPORTDISCHARGE = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: '起运港',
|
|
|
store: this.storeCodeLoadport,
|
|
|
name: 'PORTLOAD',
|
|
|
valueField: 'PORT',
|
|
|
queryMode: 'remote',
|
|
|
minChars: 1,
|
|
|
queryParam: 'PORT',
|
|
|
displayField: 'PORT'
|
|
|
});
|
|
|
|
|
|
//#endregion
|
|
|
|
|
|
//编辑form:formEdit
|
|
|
this.formEdit = Ext.widget('form', {
|
|
|
// layout: "border",
|
|
|
region: 'center',
|
|
|
frame: true,
|
|
|
bodyPadding: 5,
|
|
|
trackResetOnLoad: true,//不加的话load之后isdirty即变为true
|
|
|
fieldDefaults: {
|
|
|
margins: '2 2 2 2',
|
|
|
labelAlign: 'right',
|
|
|
flex: 1,
|
|
|
labelWidth: 90,
|
|
|
msgTarget: 'qtip'
|
|
|
//,split:true
|
|
|
},
|
|
|
|
|
|
items: [
|
|
|
{//fieldset 1
|
|
|
xtype: 'fieldset',
|
|
|
defaultType: 'textfield',
|
|
|
layout: 'anchor',
|
|
|
defaults: {
|
|
|
anchor: '100%'
|
|
|
},
|
|
|
items: [{//container_1
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [{
|
|
|
fieldLabel: '合同序列号',
|
|
|
// allowBlank: false,
|
|
|
disabled: true,
|
|
|
name: 'ContractNo'
|
|
|
}, {
|
|
|
fieldLabel: '合同号',
|
|
|
// allowBlank: false,
|
|
|
name: 'HTH'
|
|
|
}, {
|
|
|
fieldLabel: '合同日期',
|
|
|
format: 'Y-m-d',
|
|
|
xtype: 'datefield',
|
|
|
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
|
|
|
name: 'HTDATE'
|
|
|
},{
|
|
|
fieldLabel: '双抬头',
|
|
|
name: 'STT'
|
|
|
},
|
|
|
/**/{
|
|
|
fieldLabel: 'id',
|
|
|
name: 'id', flex: 0, hidden: true, margins: '0'
|
|
|
}, {
|
|
|
fieldLabel: 'cgid',
|
|
|
name: 'cgid', flex: 0, hidden: true, margins: '0'
|
|
|
}, {
|
|
|
fieldLabel: '时间戳',
|
|
|
name: 'TimeMark', flex: 0, hidden: true, margins: '0'
|
|
|
}
|
|
|
]
|
|
|
}, //container_1 end
|
|
|
{
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [
|
|
|
this.comboxMainstate,
|
|
|
this.comboxCountry,
|
|
|
this.comboxPORTDISCHARGE,
|
|
|
this.comboxport
|
|
|
]
|
|
|
},
|
|
|
{
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [this.comboxSeller,this.comboxBuyer,this.comboxTRADINGAGENCY ]
|
|
|
}, {
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [this.comboxCreator
|
|
|
, {
|
|
|
fieldLabel: '接单时间',
|
|
|
format: 'Y-m-d',
|
|
|
xtype: 'datefield',
|
|
|
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
|
|
|
name: 'creattime',
|
|
|
allowBlank: false
|
|
|
},{
|
|
|
fieldLabel: '预计开船日',
|
|
|
format: 'Y-m-d',
|
|
|
xtype: 'datefield',
|
|
|
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
|
|
|
name: 'Ex_sailingdate'
|
|
|
}]
|
|
|
}, {
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [this.comboxTransactionMethod,
|
|
|
this.comboxPaymentMethods,
|
|
|
this.comboxFStatus]
|
|
|
}, {
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [this.comboxRCVMode,this.comboxOP,this.comboxContainerType
|
|
|
|
|
|
]
|
|
|
}, {
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [{
|
|
|
fieldLabel: '备注1',
|
|
|
name: 'remark'
|
|
|
}]
|
|
|
},{
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [{
|
|
|
xtype : 'checkbox',
|
|
|
fieldLabel: '财务锁定',
|
|
|
name: 'ContractStatus'
|
|
|
},this.comboxBUZTYPE,
|
|
|
{
|
|
|
xtype : 'checkbox',flex:1,
|
|
|
fieldLabel: '已有合同',
|
|
|
name: 'HaveContract'
|
|
|
},
|
|
|
{
|
|
|
xtype : 'checkbox',flex:1,
|
|
|
fieldLabel: '有商品标签',
|
|
|
name: 'HaveCargoMark'
|
|
|
}]
|
|
|
},{
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [
|
|
|
{
|
|
|
fieldLabel: '备注2',
|
|
|
name: 'remark_2'
|
|
|
}]
|
|
|
},{
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [
|
|
|
this.comboxCompany,
|
|
|
this.comboxAgent
|
|
|
,this.comboxAgent2
|
|
|
,this.comboxAgent3]
|
|
|
}, {
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [
|
|
|
{
|
|
|
fieldLabel: '修改人',
|
|
|
disabled: true,
|
|
|
name: 'MODIFIEDUSER'
|
|
|
},{
|
|
|
fieldLabel: '修改时间',
|
|
|
disabled: true,
|
|
|
format: 'Y-m-d',
|
|
|
xtype: 'datefield',
|
|
|
renderer: Ext.util.Format.dateRenderer('Y-m-d H:i:s'),
|
|
|
name: 'MODIFIEDTIME'
|
|
|
}, {
|
|
|
xtype: 'hidden', flex: 1
|
|
|
}
|
|
|
, {
|
|
|
xtype: 'hidden', flex: 1
|
|
|
}]
|
|
|
}]
|
|
|
}]
|
|
|
});
|
|
|
|
|
|
//////////////////////////////////
|
|
|
//#region 明细 <<<< 商品 >>>>
|
|
|
//#region 相关参照
|
|
|
this.storeCargoinfo = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'CargoTax',
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetCargoTax' }
|
|
|
});
|
|
|
// this.storeCargoinfo.load({ params: { condition: ""} });
|
|
|
|
|
|
this.comboxCargoinfo = Ext.create('DsExt.ux.DCombox', {
|
|
|
store: this.storeCargoinfo,
|
|
|
forceSelection: true,
|
|
|
matchFieldWidth: false,
|
|
|
name: 'cargoinfo_id',
|
|
|
valueField: 'id',
|
|
|
displayField: 'codeandname'
|
|
|
//HS代码
|
|
|
});
|
|
|
|
|
|
this.storeCargociq = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'CargociqRef',
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetCargociqRefList' }
|
|
|
});
|
|
|
//this.storeCargociq.load({ params: { condition: ""} });
|
|
|
this.comboxCargociq = Ext.create('DsExt.ux.DCombox', {
|
|
|
store: this.storeCargociq,
|
|
|
forceSelection: true,
|
|
|
matchFieldWidth: false,
|
|
|
name: 'Cargociq_id',
|
|
|
valueField: 'id',
|
|
|
displayField: 'codeandname',
|
|
|
async : false
|
|
|
//ciq代码
|
|
|
});
|
|
|
|
|
|
|
|
|
///币别代码币别
|
|
|
this.storecurr = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'currRef',
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetcurrRefList' }
|
|
|
});
|
|
|
this.storecurr.load({ params: { condition: ""} });
|
|
|
this.comboxcurr = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
store: this.storecurr,
|
|
|
name: 'currid',
|
|
|
valueField: 'gid',
|
|
|
displayField: 'codename'
|
|
|
//币别
|
|
|
});
|
|
|
|
|
|
/////汇率区间币别
|
|
|
this.storecurrQZ = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'MsFeeCurr',
|
|
|
proxy: { url: '/MvcShipping/MsChFee/GetCurrList' }
|
|
|
});
|
|
|
this.storecurrQZ.load({ params: { condition: ""} });
|
|
|
|
|
|
|
|
|
/*
|
|
|
this.comboxcurr = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
store: this.storecurr,
|
|
|
name: 'currid',
|
|
|
valueField: 'GID',
|
|
|
displayField: 'CURR'
|
|
|
//币别
|
|
|
}); */
|
|
|
//枚举参照
|
|
|
this.storeUnit = Ext.create('DsExt.ux.RefEnumStore', {});
|
|
|
this.storeUnit.load({ params: { enumTypeId: 11} });
|
|
|
this.comboxUnit = Ext.create('DsExt.ux.RefEnumCombox', {
|
|
|
store: this.storeUnit,
|
|
|
forceSelection: true,
|
|
|
name: 'Unit'
|
|
|
,value:'2'
|
|
|
});
|
|
|
|
|
|
this.storepaypart = Ext.create('DsExt.ux.RefEnumStore', {});
|
|
|
this.storepaypart.load({ params: { enumTypeId: 12} });
|
|
|
this.comboxpaypart = Ext.create('DsExt.ux.RefEnumCombox', {
|
|
|
store: this.storepaypart,
|
|
|
forceSelection: true,
|
|
|
name: 'paypart'
|
|
|
});
|
|
|
|
|
|
this.storeExporter = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'Tradermb',
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetTrader' }
|
|
|
});
|
|
|
this.storeExporter.load({ params: { condition: " isenterp=1 and isnull(ISSTOP,0)=0 "} });
|
|
|
this.comboxExporter = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
//出口商
|
|
|
store: this.storeExporter,
|
|
|
name: 'Exporter',
|
|
|
matchFieldWidth: false,
|
|
|
valueField: 'name',
|
|
|
displayField: 'codename'
|
|
|
});
|
|
|
this.comboxFactoryNo = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
//fieldLabel: '厂号',
|
|
|
//autosize: true,
|
|
|
//bodyPadding: 5,
|
|
|
//flex: 1,
|
|
|
width: 100,
|
|
|
//labelWidth: 90,
|
|
|
store: this.storeFactoryNo,
|
|
|
//queryMode: 'local',
|
|
|
//triggerOnClick: false,
|
|
|
name: 'FactoryNo',
|
|
|
matchFieldWidth: false,
|
|
|
valueField: 'FACTORYNO',
|
|
|
displayField: 'FACTORYNO'
|
|
|
});
|
|
|
|
|
|
this.storeCargoName = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'CargoName_Cnmb',
|
|
|
proxy: { url: '/Import/CargoName/GetCargoNameList' }
|
|
|
});
|
|
|
//this.storeCargoName.load({ params: { condition: ""} });
|
|
|
this.comboxCargoName = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
//fieldLabel: '商品名称',
|
|
|
//forceSelection: true,
|
|
|
store: this.storeCargoName,
|
|
|
matchFieldWidth:false,
|
|
|
name: 'name',
|
|
|
valueField: 'CNNAME',
|
|
|
displayField: 'CNNAME'
|
|
|
});
|
|
|
|
|
|
this.storeCargoName_EN = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'CargoName_Enmb',
|
|
|
proxy: { url: '/Import/CargoName/GetCargoNameList' }
|
|
|
});
|
|
|
this.comboxCargoENName = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
//forceSelection: true,
|
|
|
store: this.storeCargoName_EN,
|
|
|
name: 'Ename',
|
|
|
valueField: 'ENNAME',
|
|
|
displayField: 'ENNAME'
|
|
|
});
|
|
|
|
|
|
|
|
|
this.storeCargoType = Ext.create('DsExt.ux.RefEnumStore', {});
|
|
|
this.storeCargoType.load({ params: { enumTypeId: 30} });
|
|
|
this.comboxCargoType = Ext.create('DsExt.ux.RefEnumCombox', {
|
|
|
store: this.storeCargoType,
|
|
|
forceSelection: true,
|
|
|
name: 'CargoType',
|
|
|
valueField: 'EnumValueName',
|
|
|
displayField: 'EnumValueName'
|
|
|
});
|
|
|
|
|
|
//商品规格 20160420
|
|
|
this.storeSPECIFICATIONS = Ext.create('DsExt.ux.RefEnumStore', {});
|
|
|
this.storeSPECIFICATIONS.load({ params: { enumTypeId: 34} });
|
|
|
this.comboxSPECIFICATIONS = Ext.create('DsExt.ux.RefEnumCombox', {
|
|
|
store: this.storeSPECIFICATIONS,
|
|
|
forceSelection: true,
|
|
|
name: 'SPECIFICATIONS',
|
|
|
valueField: 'EnumValueName',
|
|
|
displayField: 'EnumValueName'
|
|
|
});
|
|
|
//#endregion
|
|
|
|
|
|
//数据集
|
|
|
this.storeCargo = Ext.create('Ext.data.Store', {
|
|
|
model: 'Cargomb',
|
|
|
remoteSort: false,
|
|
|
pruneModifiedRecords:true,
|
|
|
proxy: {
|
|
|
type: 'ajax',
|
|
|
url: '/Import/XXH/GetCargoList_Audit',
|
|
|
reader: {
|
|
|
id: 'id,ContractNo',
|
|
|
root: 'data',
|
|
|
totalProperty: 'totalCount'
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
//表格
|
|
|
_this = this;
|
|
|
this.CargoColumns=[
|
|
|
{
|
|
|
dataIndex: 'id',
|
|
|
header: '自增序列号',
|
|
|
width: 80,
|
|
|
hidden: true,
|
|
|
editor: {
|
|
|
xtype: 'textfield',
|
|
|
listeners: {
|
|
|
|
|
|
specialkey: function (field, e) {
|
|
|
//将回车13转义成tab9
|
|
|
//if (e.getKey() == e.ENTER) {
|
|
|
// e.keyCode = 9;
|
|
|
//}
|
|
|
//if (e.keyCode == 9) {
|
|
|
// //将combo
|
|
|
// //alert(field.value);
|
|
|
// if (field.value == null) {
|
|
|
// _name = this.store.data.keys[0];
|
|
|
// this.setValue(_name);
|
|
|
// } else {
|
|
|
// if (field.value.replace(/\s*/g, "") == "") {
|
|
|
// _name = this.store.data.keys[0];
|
|
|
// this.setValue(_name);
|
|
|
// }
|
|
|
// }
|
|
|
//}
|
|
|
alert(e.target.clientLeft);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
,
|
|
|
{
|
|
|
dataIndex: 'ContractNo',
|
|
|
header: '合同号',
|
|
|
width: 80,
|
|
|
hidden: true
|
|
|
},
|
|
|
{
|
|
|
dataIndex: 'SEQUENCE',
|
|
|
header: '序号',
|
|
|
width: 44,
|
|
|
editor: {
|
|
|
xtype: 'numberfield', //numberfield textfield
|
|
|
selectOnFocus: true,
|
|
|
enableKeyEvents: true,
|
|
|
keyNavEnabled: false,
|
|
|
listeners: {
|
|
|
keydown: function (textfield, e) {
|
|
|
_this.onCargoCellKey(textfield, e);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
},{
|
|
|
dataIndex: 'Exporter',
|
|
|
header: '出口商',
|
|
|
width: 110,
|
|
|
editor: this.comboxExporter
|
|
|
},{
|
|
|
dataIndex: 'FactoryNo',
|
|
|
header: '厂号',
|
|
|
width: 80,
|
|
|
editor: this.comboxFactoryNo
|
|
|
},
|
|
|
{
|
|
|
dataIndex: 'ICP',
|
|
|
header: '备案号',//hidden:true,
|
|
|
width: 80
|
|
|
},{
|
|
|
dataIndex: 'Ename',
|
|
|
header: '英文品名',
|
|
|
width: 100,
|
|
|
editor: this.comboxCargoENName
|
|
|
},{
|
|
|
dataIndex: 'name',
|
|
|
header: '标签品名',
|
|
|
width: 80,
|
|
|
editor: this.comboxCargoName
|
|
|
}, {
|
|
|
dataIndex: 'TAGPICURL',
|
|
|
header: '标签图片',
|
|
|
width: 60,
|
|
|
renderer: function (value, p, record) {
|
|
|
if (value == '' || typeof (value) == "undefined") {
|
|
|
//return '<input type="button" value="上传" onClick="javascript:this.UpLoadFile('+record.data.BillNo+')"';
|
|
|
return '';
|
|
|
} else
|
|
|
return '<a href="' + value + '" style=' + '"text-decoration:none" target="_blank"' + ' > 下载图片 </a>';
|
|
|
}
|
|
|
},{
|
|
|
dataIndex: 'SPECIFICATIONS',
|
|
|
header: '商品规格',
|
|
|
width: 60,
|
|
|
editor: this.comboxSPECIFICATIONS
|
|
|
}, {
|
|
|
dataIndex: 'CargoType',
|
|
|
header: '产品类型',
|
|
|
width: 50,
|
|
|
editor: this.comboxCargoType
|
|
|
},
|
|
|
{
|
|
|
dataIndex: 'cargoinfo_id',
|
|
|
header: 'HS代码',
|
|
|
renderer: function(value, p, record) {
|
|
|
if (value == null || value == '') return '';
|
|
|
else return record.data.cicodeandname;
|
|
|
},
|
|
|
editor: this.comboxCargoinfo,
|
|
|
width: 140
|
|
|
},
|
|
|
{
|
|
|
dataIndex: 'cargociq_id',
|
|
|
header: 'CIQ代码',
|
|
|
renderer: function(value, p, record) {
|
|
|
if (value == null || value == '') return '';
|
|
|
else return record.data.ciqcodeandname;
|
|
|
},
|
|
|
editor: this.comboxCargociq,
|
|
|
width: 140
|
|
|
},{
|
|
|
dataIndex: 'SBYS',
|
|
|
header: '申报要素',
|
|
|
width: 160,
|
|
|
editor: {
|
|
|
xtype: 'textfield',
|
|
|
selectOnFocus: true,
|
|
|
enableKeyEvents: true,
|
|
|
keyNavEnabled: false,
|
|
|
listeners: {
|
|
|
keydown: function (textfield, e) {
|
|
|
_this.onCargoCellKey(textfield, e);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}, {
|
|
|
dataIndex: 'AGENCRATE',
|
|
|
header: '代理费率(元/吨)',
|
|
|
width: 80,
|
|
|
editor: {
|
|
|
xtype: 'numberfield',
|
|
|
selectOnFocus: true,
|
|
|
enableKeyEvents: true,
|
|
|
keyNavEnabled: false,
|
|
|
listeners: {
|
|
|
keydown: function (textfield, e) {
|
|
|
_this.onCargoCellKey(textfield, e);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
},{
|
|
|
dataIndex: 'Unit',
|
|
|
header: '重量单位',
|
|
|
renderer: function(value, p, record) {
|
|
|
if (value == null || value == '') return '';
|
|
|
else return record.data.UnitRef;
|
|
|
},
|
|
|
editor: this.comboxUnit,
|
|
|
width: 60
|
|
|
},{
|
|
|
dataIndex: 'currid',
|
|
|
header: '币别',
|
|
|
renderer: function(value, p, record) {
|
|
|
if (value == null || value == '') return '';
|
|
|
else return record.data.codename;
|
|
|
},
|
|
|
editor: this.comboxcurr,
|
|
|
width: 50
|
|
|
},{
|
|
|
dataIndex: 'Exchangerate',
|
|
|
header: '汇率_商务',
|
|
|
width: 75,
|
|
|
editor: {
|
|
|
xtype: 'textfield',
|
|
|
selectOnFocus: true,
|
|
|
enableKeyEvents: true,
|
|
|
keyNavEnabled: false,
|
|
|
listeners: {
|
|
|
keydown: function (textfield, e) {
|
|
|
_this.onCargoCellKey(textfield, e);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
},{
|
|
|
dataIndex: 'Exchangerate_Customs',
|
|
|
header: '汇率_海关',
|
|
|
width: 75,
|
|
|
editor: {
|
|
|
xtype: 'textfield',
|
|
|
selectOnFocus: true,
|
|
|
enableKeyEvents: true,
|
|
|
keyNavEnabled: false,
|
|
|
listeners: {
|
|
|
keydown: function (textfield, e) {
|
|
|
_this.onCargoCellKey(textfield, e);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
},{
|
|
|
dataIndex: 'U_PRICE',
|
|
|
header: '单价(重量单位)',
|
|
|
width: 80,
|
|
|
//hidden: true,
|
|
|
editor: {
|
|
|
xtype: 'textfield',
|
|
|
selectOnFocus: true,
|
|
|
enableKeyEvents: true,
|
|
|
keyNavEnabled: false,
|
|
|
listeners: {
|
|
|
keydown: function (textfield, e) {
|
|
|
_this.onCargoCellKey(textfield, e);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
},{
|
|
|
dataIndex: 'U_weight',
|
|
|
header: '净重(重量单位)',
|
|
|
width: 80,
|
|
|
editor: {
|
|
|
xtype: 'numberfield',
|
|
|
allowDecimals: true,
|
|
|
decimalPrecision: 6,
|
|
|
selectOnFocus: true,
|
|
|
enableKeyEvents: true,
|
|
|
keyNavEnabled: false,
|
|
|
listeners: {
|
|
|
keydown: function (textfield, e) {
|
|
|
_this.onCargoCellKey(textfield, e);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
},{
|
|
|
dataIndex: 'price',
|
|
|
header: '单价(币别/kg)',
|
|
|
width: 80,
|
|
|
allowBlank:false,
|
|
|
editor: {
|
|
|
xtype: 'textfield',
|
|
|
selectOnFocus: true,
|
|
|
enableKeyEvents: true,
|
|
|
keyNavEnabled: false,
|
|
|
listeners: {
|
|
|
keydown: function (textfield, e) {
|
|
|
_this.onCargoCellKey(textfield, e);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
},{
|
|
|
dataIndex: 'weight',
|
|
|
header: '净重(kg)',
|
|
|
width: 80,
|
|
|
editor: {
|
|
|
xtype: 'textfield',
|
|
|
selectOnFocus: true,
|
|
|
enableKeyEvents: true,
|
|
|
keyNavEnabled: false,
|
|
|
listeners: {
|
|
|
keydown: function (textfield, e) {
|
|
|
_this.onCargoCellKey(textfield, e);
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
summaryType: 'sum'
|
|
|
},{
|
|
|
dataIndex: 'm_weight',
|
|
|
header: '毛重',
|
|
|
width: 50,
|
|
|
editor: {
|
|
|
xtype: 'textfield',
|
|
|
selectOnFocus: true,
|
|
|
enableKeyEvents: true,
|
|
|
keyNavEnabled: false,
|
|
|
listeners: {
|
|
|
keydown: function (textfield, e) {
|
|
|
_this.onCargoCellKey(textfield, e);
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
summaryType: 'sum'
|
|
|
},{
|
|
|
dataIndex: 'BoxCount',
|
|
|
header: '箱/件数',
|
|
|
width: 80,
|
|
|
editor: {
|
|
|
xtype: 'textfield',
|
|
|
selectOnFocus: true,
|
|
|
enableKeyEvents: true,
|
|
|
keyNavEnabled: false,
|
|
|
listeners: {
|
|
|
keydown: function (textfield, e) {
|
|
|
_this.onCargoCellKey(textfield, e);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
},{
|
|
|
dataIndex: 'BoxWeight',
|
|
|
header: '规格',
|
|
|
width: 50,
|
|
|
editor: {
|
|
|
xtype: 'textfield',
|
|
|
selectOnFocus: true,
|
|
|
enableKeyEvents: true,
|
|
|
keyNavEnabled: false,
|
|
|
listeners: {
|
|
|
keydown: function (textfield, e) {
|
|
|
_this.onCargoCellKey(textfield, e);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
},{
|
|
|
dataIndex: 'price_agio',
|
|
|
header: '差价',
|
|
|
width: 50,
|
|
|
editor: {
|
|
|
xtype: 'textfield',
|
|
|
selectOnFocus: true,
|
|
|
enableKeyEvents: true,
|
|
|
keyNavEnabled: false,
|
|
|
listeners: {
|
|
|
keydown: function (textfield, e) {
|
|
|
_this.onCargoCellKey(textfield, e);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
},{
|
|
|
dataIndex: 'price_limit',
|
|
|
header: '海关估价',
|
|
|
width: 60,
|
|
|
editor: {
|
|
|
xtype: 'textfield',
|
|
|
selectOnFocus: true,
|
|
|
enableKeyEvents: true,
|
|
|
keyNavEnabled: false,
|
|
|
listeners: {
|
|
|
keydown: function (textfield, e) {
|
|
|
_this.onCargoCellKey(textfield, e);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
},{
|
|
|
dataIndex: 'Amount',
|
|
|
header: '合同金额',
|
|
|
width: 80,
|
|
|
editor: {
|
|
|
xtype: 'textfield',
|
|
|
selectOnFocus: true,
|
|
|
enableKeyEvents: true,
|
|
|
keyNavEnabled: false,
|
|
|
listeners: {
|
|
|
keydown: function (textfield, e) {
|
|
|
_this.onCargoCellKey(textfield, e);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
},{
|
|
|
dataIndex: 'tax_Amount',
|
|
|
header: '完税价格',
|
|
|
width: 80,
|
|
|
editor: {
|
|
|
xtype: 'textfield',
|
|
|
selectOnFocus: true,
|
|
|
enableKeyEvents: true,
|
|
|
keyNavEnabled: false,
|
|
|
listeners: {
|
|
|
keydown: function (textfield, e) {
|
|
|
_this.onCargoCellKey(textfield, e);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
},{
|
|
|
dataIndex: 'baolv',
|
|
|
header: '保率',
|
|
|
width: 55
|
|
|
},{
|
|
|
dataIndex: 'pay_Amount',
|
|
|
header: '购货款$(对贸易商)',
|
|
|
width: 120,
|
|
|
editor: {
|
|
|
xtype: 'textfield',
|
|
|
selectOnFocus: true,
|
|
|
enableKeyEvents: true,
|
|
|
keyNavEnabled: false,
|
|
|
listeners: {
|
|
|
keydown: function (textfield, e) {
|
|
|
_this.onCargoCellKey(textfield, e);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
},{
|
|
|
dataIndex: 'PreProportion',
|
|
|
header: '付预付比例(%)',
|
|
|
width: 80,
|
|
|
//hidden: true,
|
|
|
editor: {
|
|
|
xtype: 'numberfield',
|
|
|
allowDecimals: true, //允许输入小数
|
|
|
decimalPrecision: 2,
|
|
|
nanText: '请输入有效小数',
|
|
|
keyNavEnabled: false,
|
|
|
selectOnFocus: true,
|
|
|
mouseWheelEnabled: false,
|
|
|
enableKeyEvents: true,
|
|
|
listeners: {
|
|
|
keydown: function (textfield, e) {
|
|
|
if (e.getKey() == 40) {
|
|
|
_this.onNextKeyClick(9)
|
|
|
} else if (e.getKey() == 38) {
|
|
|
_this.onUpKeyClick(9)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
}, {
|
|
|
dataIndex: 'RecProportion',
|
|
|
header: '收预付比例(%)',
|
|
|
width: 80,
|
|
|
//hidden: true,
|
|
|
editor: {
|
|
|
xtype: 'numberfield',
|
|
|
allowDecimals: true, //允许输入小数
|
|
|
decimalPrecision: 2,
|
|
|
nanText: '请输入有效小数',
|
|
|
keyNavEnabled: false,
|
|
|
selectOnFocus: true,
|
|
|
mouseWheelEnabled: false,
|
|
|
enableKeyEvents: true,
|
|
|
listeners: {
|
|
|
keydown: function (textfield, e) {
|
|
|
if (e.getKey() == 40) {
|
|
|
_this.onNextKeyClick(9)
|
|
|
} else if (e.getKey() == 38) {
|
|
|
_this.onUpKeyClick(9)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
},{
|
|
|
dataIndex: 'prepayments',
|
|
|
header: '预付款(应收)',
|
|
|
width: 80,
|
|
|
editor: {
|
|
|
xtype: 'textfield',
|
|
|
selectOnFocus: true,
|
|
|
enableKeyEvents: true,
|
|
|
keyNavEnabled: false,
|
|
|
listeners: {
|
|
|
keydown: function (textfield, e) {
|
|
|
_this.onCargoCellKey(textfield, e);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
},{
|
|
|
dataIndex: 'balance',
|
|
|
header: '尾款(应收)',
|
|
|
width: 80,
|
|
|
editor: {
|
|
|
xtype: 'textfield',
|
|
|
selectOnFocus: true,
|
|
|
enableKeyEvents: true,
|
|
|
keyNavEnabled: false,
|
|
|
listeners: {
|
|
|
keydown: function (textfield, e) {
|
|
|
_this.onCargoCellKey(textfield, e);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
},{
|
|
|
dataIndex: 'pay_prepayments',
|
|
|
header: '预付款(应付)',
|
|
|
width: 80,
|
|
|
editor: {
|
|
|
xtype: 'textfield',
|
|
|
selectOnFocus: true,
|
|
|
enableKeyEvents: true,
|
|
|
keyNavEnabled: false,
|
|
|
listeners: {
|
|
|
keydown: function (textfield, e) {
|
|
|
_this.onCargoCellKey(textfield, e);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
},{
|
|
|
dataIndex: 'pay_balance',
|
|
|
header: '尾款(应付)',
|
|
|
width: 80,
|
|
|
editor: {
|
|
|
xtype: 'textfield',
|
|
|
selectOnFocus: true,
|
|
|
enableKeyEvents: true,
|
|
|
keyNavEnabled: false,
|
|
|
listeners: {
|
|
|
keydown: function (textfield, e) {
|
|
|
_this.onCargoCellKey(textfield, e);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
},{
|
|
|
dataIndex: 'Paypart',
|
|
|
header: '付款方式',
|
|
|
renderer: function(value, p, record) {
|
|
|
if (value == null || value == '') return '';
|
|
|
else return record.data.paypartRef;
|
|
|
},
|
|
|
editor: this.comboxpaypart,
|
|
|
width: 50
|
|
|
},{
|
|
|
dataIndex: 'tariff',
|
|
|
header: '关税类型',
|
|
|
width: 80,
|
|
|
editor: {
|
|
|
xtype: 'textfield',
|
|
|
selectOnFocus: true,
|
|
|
enableKeyEvents: true,
|
|
|
keyNavEnabled: false,
|
|
|
listeners: {
|
|
|
keydown: function (textfield, e) {
|
|
|
_this.onCargoCellKey(textfield, e);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
},{
|
|
|
dataIndex: 'tax',
|
|
|
header: '关税税率',
|
|
|
width: 80,
|
|
|
editor: {
|
|
|
xtype: 'textfield',
|
|
|
selectOnFocus: true,
|
|
|
enableKeyEvents: true,
|
|
|
keyNavEnabled: false,
|
|
|
listeners: {
|
|
|
keydown: function (textfield, e) {
|
|
|
_this.onCargoCellKey(textfield, e);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}, {
|
|
|
dataIndex: 'tax_cl',
|
|
|
header: '从量税率',
|
|
|
tooltip:'如从量税率不为零,则关税按照此标准(分/kg),而非关税税率进行计算',
|
|
|
width: 60,
|
|
|
editor: {
|
|
|
xtype: 'textfield',
|
|
|
selectOnFocus: true,
|
|
|
enableKeyEvents: true,
|
|
|
keyNavEnabled: false,
|
|
|
listeners: {
|
|
|
keydown: function (textfield, e) {
|
|
|
_this.onCargoCellKey(textfield, e);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
},{
|
|
|
dataIndex: 'tax_zz',
|
|
|
header: '增值税税率',
|
|
|
width: 80,
|
|
|
editor: {
|
|
|
xtype: 'textfield',
|
|
|
selectOnFocus: true,
|
|
|
enableKeyEvents: true,
|
|
|
keyNavEnabled: false,
|
|
|
listeners: {
|
|
|
keydown: function (textfield, e) {
|
|
|
_this.onCargoCellKey(textfield, e);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
},{
|
|
|
dataIndex: 'tax_1',
|
|
|
header: '关税(应收)',
|
|
|
width: 80,
|
|
|
editor: {
|
|
|
xtype: 'numberfield',
|
|
|
selectOnFocus: true,
|
|
|
allowDecimals: true,
|
|
|
decimalPrecision: 2,
|
|
|
enableKeyEvents: true,
|
|
|
keyNavEnabled: false,
|
|
|
listeners: {
|
|
|
keydown: function (textfield, e) {
|
|
|
_this.onCargoCellKey(textfield, e);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
},{
|
|
|
dataIndex: 'tax_zz_1',
|
|
|
header: '增值税(应收)',
|
|
|
width: 80,
|
|
|
editor: {
|
|
|
xtype: 'numberfield',
|
|
|
selectOnFocus: true,
|
|
|
allowDecimals: true,
|
|
|
decimalPrecision: 2,
|
|
|
enableKeyEvents: true,
|
|
|
keyNavEnabled: false,
|
|
|
listeners: {
|
|
|
keydown: function (textfield, e) {
|
|
|
_this.onCargoCellKey(textfield, e);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
},{
|
|
|
dataIndex: 'tax_2',
|
|
|
header: '关税(应付)',
|
|
|
width: 80,
|
|
|
editor: {
|
|
|
xtype: 'numberfield',
|
|
|
selectOnFocus: true,
|
|
|
allowDecimals: true,
|
|
|
decimalPrecision: 2,
|
|
|
enableKeyEvents: true,
|
|
|
keyNavEnabled: false,
|
|
|
listeners: {
|
|
|
keydown: function (textfield, e) {
|
|
|
_this.onCargoCellKey(textfield, e);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
dataIndex: 'tax_zz_2',
|
|
|
header: '增值税(应付)',
|
|
|
width: 80,
|
|
|
editor: {
|
|
|
xtype: 'numberfield',
|
|
|
selectOnFocus: true,
|
|
|
allowDecimals: true,
|
|
|
decimalPrecision: 2,
|
|
|
enableKeyEvents: true,
|
|
|
keyNavEnabled: false,
|
|
|
listeners: {
|
|
|
keydown: function (textfield, e) {
|
|
|
_this.onCargoCellKey(textfield, e);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
},{
|
|
|
dataIndex: 'Productiondate',
|
|
|
header: '生产日期',
|
|
|
width: 80,
|
|
|
editor: {
|
|
|
xtype: 'textfield',
|
|
|
selectOnFocus: true,
|
|
|
enableKeyEvents: true,
|
|
|
keyNavEnabled: false,
|
|
|
listeners: {
|
|
|
keydown: function (textfield, e) {
|
|
|
_this.onCargoCellKey(textfield, e);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
dataIndex: 'BZTCHNO',
|
|
|
header: '批号',
|
|
|
width: 80,
|
|
|
editor: {
|
|
|
xtype: 'textfield',
|
|
|
selectOnFocus: true,
|
|
|
enableKeyEvents: true,
|
|
|
keyNavEnabled: false,
|
|
|
listeners: {
|
|
|
keydown: function (textfield, e) {
|
|
|
_this.onCargoCellKey(textfield, e);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
dataIndex: 'Declarenumber',
|
|
|
header: '报关单号',
|
|
|
width: 80,
|
|
|
editor: {
|
|
|
xtype: 'textfield',
|
|
|
selectOnFocus: true,
|
|
|
enableKeyEvents: true,
|
|
|
keyNavEnabled: false,
|
|
|
listeners: {
|
|
|
keydown: function (textfield, e) {
|
|
|
_this.onCargoCellKey(textfield, e);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
},{
|
|
|
dataIndex: 'AMOUNT_WRITEOFFS',
|
|
|
header: '申证金额',
|
|
|
width: 80
|
|
|
},{
|
|
|
dataIndex: 'REMARK',
|
|
|
header: '备注',
|
|
|
width: 140,
|
|
|
editor: {
|
|
|
xtype: 'textfield',
|
|
|
selectOnFocus: true,
|
|
|
enableKeyEvents: true,
|
|
|
keyNavEnabled: false,
|
|
|
listeners: {
|
|
|
keydown: function (textfield, e) {
|
|
|
_this.onCargoCellKey(textfield, e);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
];
|
|
|
|
|
|
this.cellEditingCargo = Ext.create('Ext.grid.plugin.CellEditing', {
|
|
|
clicksToEdit: 1
|
|
|
});
|
|
|
this.cargoCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
|
|
|
//#region 附件上传
|
|
|
this.storeChfeeFile = Ext.create('Ext.data.Store', {
|
|
|
model: 'FeeFileModel',
|
|
|
remoteSort: false,
|
|
|
proxy: {
|
|
|
type: 'ajax',
|
|
|
url: '/Account/Chfee_payapplication/GetFileList',
|
|
|
reader: {
|
|
|
id: 'GID',
|
|
|
root: 'data',
|
|
|
totalProperty: 'totalCount'
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
|
|
|
//表格
|
|
|
this.FeeFileColumns = [
|
|
|
{
|
|
|
sortable: true, hidden: true,
|
|
|
dataIndex: 'GID', readOnly: true,
|
|
|
header: 'GID',
|
|
|
width: 80
|
|
|
}, {
|
|
|
sortable: true, hidden: false,
|
|
|
dataIndex: 'File_OriginalName', readOnly: true,
|
|
|
header: Zi.LAN.FileName, //文件名称
|
|
|
width: 80
|
|
|
}, {
|
|
|
sortable: true, hidden: false,
|
|
|
dataIndex: 'UpdateTime', readOnly: true,
|
|
|
header: Zi.LAN.FileDate, //上传日期
|
|
|
width: 80
|
|
|
}, {
|
|
|
sortable: true, hidden: false,
|
|
|
dataIndex: 'Operator', readOnly: true,
|
|
|
header: Zi.LAN.FilePerson, //上传者
|
|
|
width: 80
|
|
|
}, {
|
|
|
sortable: true, hidden: true,
|
|
|
dataIndex: 'File_Name', readOnly: true,
|
|
|
header: Zi.LAN.FileWName, //文件物理名称
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
sortable: true, hidden: true,
|
|
|
dataIndex: 'File_Path',
|
|
|
header: 'File_Path',
|
|
|
width: 80
|
|
|
}, {
|
|
|
xtype: 'actioncolumn',
|
|
|
width: 50,
|
|
|
text: Zi.LAN.Operating, //操作
|
|
|
items: [{
|
|
|
icon: '/images/icons/btnSearch.gif', // Use a URL in the icon config
|
|
|
tooltip: '预览',
|
|
|
handler: function (grid, rowIndex, colIndex) {
|
|
|
var rec = grid.getStore().getAt(rowIndex);
|
|
|
var filePath = "/Areas/Account/Files/" + rec.get('BillNo') + '/' + rec.get('File_Name') + '?a=' + Math.random();
|
|
|
var imgView = new Shipping.FileView({ filePath: filePath });
|
|
|
imgView.show();
|
|
|
}
|
|
|
}]
|
|
|
}
|
|
|
];
|
|
|
var selCertModel = Ext.create('Ext.selection.CheckboxModel');
|
|
|
this.fileGrid = new Ext.grid.GridPanel({
|
|
|
store: this.storeChfeeFile,
|
|
|
enableHdMenu: false,
|
|
|
layout: 'border',
|
|
|
region: 'center',
|
|
|
loadMask: { msg: Zi.LAN.LoadData }, //数据加载中,请稍等...
|
|
|
trackMouseOver: true,
|
|
|
disableSelection: false,
|
|
|
selModel: selCertModel,
|
|
|
singleSelect: true,
|
|
|
selType: 'rowmodel',
|
|
|
|
|
|
tbar: [{
|
|
|
text: Zi.LAN.filetp, //上传图片
|
|
|
tooltip: Zi.LAN.filetp,
|
|
|
iconCls: "btnadddetail",
|
|
|
handler: function (button, event) {
|
|
|
this.onAddFileClick(button, event);
|
|
|
},
|
|
|
scope: this
|
|
|
}, '-', {
|
|
|
text: Zi.LAN.delete1, //删除
|
|
|
tooltip: Zi.LAN.delete1, //删除图片
|
|
|
iconCls: "btndeletedetail",
|
|
|
handler: function (button, event) {
|
|
|
this.onDelFileClick(button, event);
|
|
|
},
|
|
|
scope: this
|
|
|
}],
|
|
|
columns: this.FeeFileColumns
|
|
|
});
|
|
|
//#endregion
|
|
|
this.formCargo = new Ext.grid.GridPanel({
|
|
|
store: this.storeCargo,
|
|
|
enableHdMenu: false,
|
|
|
layout: 'border',
|
|
|
region: 'center', //bodyStyle: 'background:#FFF',
|
|
|
trackResetOnLoad: true,
|
|
|
autoScroll: true,
|
|
|
//height: 160,
|
|
|
title: '商品信息',
|
|
|
loadMask: { msg: "数据加载中,请稍等..." },
|
|
|
trackMouseOver: true,
|
|
|
disableSelection: false,
|
|
|
plugins: [this.cellEditingCargo],
|
|
|
selModel: this.cargoCheckBoxModel,
|
|
|
selType: 'cellmodel',
|
|
|
features: [{
|
|
|
ftype: 'summary'//Ext.grid.feature.Summary表格汇总特性
|
|
|
}],
|
|
|
tbar: [{
|
|
|
text: '增加明细',
|
|
|
tooltip: '增加明细',
|
|
|
iconCls: "btnadddetail",
|
|
|
handler: function (button, event) {
|
|
|
this.onAddCargoClick(button, event);
|
|
|
},
|
|
|
scope: this
|
|
|
}, '-', {
|
|
|
text: '删除明细',
|
|
|
tooltip: '删除明细',
|
|
|
iconCls: "btndeletedetail",
|
|
|
handler: function (button, event) {
|
|
|
this.onDelCargoClick(button, event);
|
|
|
},
|
|
|
scope: this
|
|
|
}, {
|
|
|
text: '库存初始化',
|
|
|
tooltip: '库存初始化',
|
|
|
iconCls: "btnKCStart",hidden:true,
|
|
|
handler: function (button, event) {
|
|
|
this.onKCStartClick(button, event);
|
|
|
},
|
|
|
scope: this
|
|
|
}, {
|
|
|
text: '生成应收应付',
|
|
|
tooltip: '生成应收应付',
|
|
|
iconCls: "btnCWStart",hidden:true,
|
|
|
handler: function (button, event) {
|
|
|
this.onbtnCWStartClick(button, event);
|
|
|
},
|
|
|
scope: this
|
|
|
}, {
|
|
|
text: "保存列表样式",
|
|
|
id: "btnsavelist",
|
|
|
handler: function (button, event) {
|
|
|
|
|
|
var tempcolumns = this.formCargo.columns;
|
|
|
DsTruck.SaveGridPanel(USERID, _this.CargoListName, tempcolumns);
|
|
|
},
|
|
|
scope: this
|
|
|
}],
|
|
|
columns: this.CargoColumns
|
|
|
});//列表编辑
|
|
|
this.file = new Ext.Panel({//附件上传
|
|
|
id: "page_file",
|
|
|
title: "附件上传",
|
|
|
autoScroll: true,
|
|
|
layout: "border",
|
|
|
region: 'center',
|
|
|
//closable:true,
|
|
|
items: [this.fileGrid]
|
|
|
});
|
|
|
|
|
|
this.CargoColumns= DsTruck.GetGridPanel(USERID, this.CargoListName, this.CargoColumns);
|
|
|
//使用者id,表名 ,中间column数组,跳过一开始的几列
|
|
|
this.formCargo.reconfigure(this.storeCargo, this.CargoColumns);
|
|
|
|
|
|
//#endregion
|
|
|
////////////////////////////////////////////明细<<<< 商品 >>>>结束
|
|
|
|
|
|
//////////////////////////////////
|
|
|
//#region 明细 <<<< 许可证使用 >>>>
|
|
|
//表参照 可用许可证
|
|
|
|
|
|
this.storeApp = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'Appmb',
|
|
|
proxy: { url: '/Import/XXH/GetApp' }
|
|
|
});
|
|
|
this.comboxApp = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
store: this.storeApp,
|
|
|
name: 'app_id',
|
|
|
valueField: 'app_id',
|
|
|
displayField: 'info'
|
|
|
});
|
|
|
|
|
|
this.comboxCargo = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
store: this.storeCargo,
|
|
|
name: 'cargo_id',
|
|
|
valueField: 'id',
|
|
|
displayField: 'name'
|
|
|
});
|
|
|
|
|
|
this.storecancellation = Ext.create('DsExt.ux.RefEnumStore', {});
|
|
|
this.storecancellation.load({ params: { enumTypeId: 13} });
|
|
|
this.comboxcancellation = Ext.create('DsExt.ux.RefEnumCombox', {
|
|
|
//fieldLabel: '许可证使用',
|
|
|
store: this.storecancellation,
|
|
|
name: 'cancellation'
|
|
|
});
|
|
|
|
|
|
//结果集
|
|
|
this.storeAppstate = Ext.create('Ext.data.Store', {
|
|
|
model: 'Appstatemb',
|
|
|
remoteSort: false,
|
|
|
proxy: {
|
|
|
type: 'ajax',
|
|
|
url: '/Import/XXH/GetAppstate',
|
|
|
reader: {
|
|
|
id: 'id',
|
|
|
root: 'data',
|
|
|
totalProperty: 'totalCount'
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
//表格
|
|
|
|
|
|
this.cellEditingAppstate = Ext.create('Ext.grid.plugin.CellEditing', {
|
|
|
clicksToEdit: 1
|
|
|
});
|
|
|
this.formAppstate = new Ext.grid.GridPanel({
|
|
|
store: this.storeAppstate,
|
|
|
enableHdMenu: false,
|
|
|
region: 'north',
|
|
|
//height: 140,
|
|
|
title: '许可证使用 (注意,商品信息保存后才能选择使用许可证和商品)',
|
|
|
loadMask: { msg: "数据加载中,请稍等..." },
|
|
|
trackMouseOver: true,
|
|
|
disableSelection: false,
|
|
|
plugins: [this.cellEditingAppstate],
|
|
|
selType: 'cellmodel',
|
|
|
tbar: [{
|
|
|
text: '增加明细',
|
|
|
tooltip: '增加明细',
|
|
|
iconCls: "btnadddetail",
|
|
|
handler: function (button, event) {
|
|
|
this.onAddAppstateClick(button, event);
|
|
|
},
|
|
|
scope: this
|
|
|
}, '-', {
|
|
|
text: '删除明细',
|
|
|
tooltip: '删除明细',
|
|
|
iconCls: "btndeletedetail",
|
|
|
handler: function (button, event) {
|
|
|
this.onDelAppstateClick(button, event);
|
|
|
},
|
|
|
scope: this
|
|
|
}],
|
|
|
columns: [
|
|
|
{ hidden: true, dataIndex: 'id', header: 'id', width: 80 },
|
|
|
{ hidden: true, dataIndex: 'ContractNo', header: 'ContractNo', width: 80 },
|
|
|
{
|
|
|
dataIndex: 'app_id',
|
|
|
header: '许可证号',
|
|
|
allowBlank: false,
|
|
|
renderer: function (value, p, record) {
|
|
|
if (value == null || value == '')
|
|
|
return '';
|
|
|
else
|
|
|
return record.data.appno;
|
|
|
},
|
|
|
editor: this.comboxApp,
|
|
|
width: 180
|
|
|
},
|
|
|
// { hidden: true, dataIndex: 'app_id', header: 'app_id', width: 80 },
|
|
|
{
|
|
|
dataIndex: 'name',
|
|
|
header: '商品手册名称',
|
|
|
width: 80,
|
|
|
},
|
|
|
//this.comboxCargo,
|
|
|
{
|
|
|
dataIndex: 'cargo_id',
|
|
|
header: '货名',
|
|
|
allowBlank: false,
|
|
|
renderer: function (value, p, record) {
|
|
|
if (value == null || value == '')
|
|
|
return '';
|
|
|
else
|
|
|
return record.data.cargoname;
|
|
|
},
|
|
|
editor: this.comboxCargo,
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
dataIndex: 'appweight',
|
|
|
header: '许可证额度(吨)',
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
dataIndex: 'appremain',
|
|
|
header: '未核销(吨)',
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
dataIndex: 'country',
|
|
|
header: '进口国',
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
dataIndex: 'weight',
|
|
|
header: '使用重量(KG)',
|
|
|
editor: {
|
|
|
xtype: 'textfield',
|
|
|
selectOnFocus: true
|
|
|
}
|
|
|
},{
|
|
|
dataIndex: 'cancellation',
|
|
|
header: '许可证使用状态',
|
|
|
allowBlank: false,
|
|
|
renderer: function (value, p, record) {
|
|
|
if (value == null || value == '')
|
|
|
return '';
|
|
|
else
|
|
|
return record.data.cancellationRef;
|
|
|
},
|
|
|
editor: this.comboxcancellation,
|
|
|
width: 100
|
|
|
},{
|
|
|
dataIndex: 'validdate',
|
|
|
header: '有效期',
|
|
|
width: 80
|
|
|
}
|
|
|
]
|
|
|
});
|
|
|
|
|
|
//#endregion --------------------------------------------------
|
|
|
//明细<<<< 许可证使用 >>>>结束
|
|
|
|
|
|
//////////////////////////////////
|
|
|
//#region 明细 <<<< 库存管理 >>>>
|
|
|
//枚举参照 库存流程
|
|
|
|
|
|
this.storeczstate = Ext.create('DsExt.ux.RefEnumStore', {});
|
|
|
this.storeczstate.load({ params: { enumTypeId: 8} });
|
|
|
this.comboxczstate = Ext.create('DsExt.ux.RefEnumCombox', {
|
|
|
store: this.storeczstate,
|
|
|
name: 'czstate'
|
|
|
});
|
|
|
|
|
|
this.storekfstate = Ext.create('DsExt.ux.RefEnumStore', {});
|
|
|
this.storekfstate.load({ params: { enumTypeId: 9} });
|
|
|
this.comboxkfstate = Ext.create('DsExt.ux.RefEnumCombox', {
|
|
|
store: this.storekfstate,
|
|
|
name: 'kfstate'
|
|
|
});
|
|
|
|
|
|
this.comboxCargo = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
store: this.storeCargo,
|
|
|
forceSelection: true,
|
|
|
name: 'cargo_id',
|
|
|
valueField: 'id',
|
|
|
displayField: 'name'
|
|
|
});
|
|
|
|
|
|
|
|
|
//结果集
|
|
|
this.storeKC = Ext.create('Ext.data.Store', {
|
|
|
model: 'KCmb',
|
|
|
remoteSort: false,
|
|
|
proxy: {
|
|
|
type: 'ajax',
|
|
|
url: '/Import/XXH/GetKC',
|
|
|
reader: {
|
|
|
id: 'id',
|
|
|
root: 'data',
|
|
|
totalProperty: 'totalCount'
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
//表格
|
|
|
|
|
|
this.cellEditingKC = Ext.create('Ext.grid.plugin.CellEditing', {
|
|
|
clicksToEdit: 1
|
|
|
});
|
|
|
this.formKC = new Ext.grid.GridPanel({
|
|
|
store: this.storeKC,
|
|
|
enableHdMenu: false,
|
|
|
region: 'north',
|
|
|
title: '许可证使用 (注意,商品信息保存后才能选择使用许可证和商品)',
|
|
|
loadMask: { msg: "数据加载中,请稍等..." },
|
|
|
trackMouseOver: true,
|
|
|
disableSelection: false,
|
|
|
plugins: [this.cellEditingKC],
|
|
|
selType: 'cellmodel',
|
|
|
tbar: [{
|
|
|
text: '增加明细',
|
|
|
tooltip: '增加明细',
|
|
|
iconCls: "btnadddetail",
|
|
|
handler: function (button, event) {
|
|
|
this.onAddKCClick(button, event);
|
|
|
},
|
|
|
scope: this
|
|
|
}, '-', {
|
|
|
text: '删除明细',
|
|
|
tooltip: '删除明细',
|
|
|
iconCls: "btndeletedetail",
|
|
|
handler: function (button, event) {
|
|
|
this.onDelKCClick(button, event);
|
|
|
},
|
|
|
scope: this
|
|
|
}],
|
|
|
columns: [
|
|
|
{ hidden: true, dataIndex: 'id', header: 'id', width: 80 },
|
|
|
{ hidden: true, dataIndex: 'ContractNo', header: 'ContractNo', width: 80 },
|
|
|
{
|
|
|
dataIndex: 'cargo_id',
|
|
|
header: '货名',
|
|
|
allowBlank: false,
|
|
|
renderer: function (value, p, record) {
|
|
|
if (value == null || value == '')
|
|
|
return '';
|
|
|
else
|
|
|
return record.data.cargoname;
|
|
|
},
|
|
|
editor: this.comboxCargo,
|
|
|
width: 180
|
|
|
},
|
|
|
{
|
|
|
dataIndex: 'czstate',
|
|
|
header: '操作状态',
|
|
|
renderer: function (value, p, record) {
|
|
|
if (value == null || value == '')
|
|
|
return '';
|
|
|
else
|
|
|
return record.data.czref;
|
|
|
},
|
|
|
editor: this.comboxczstate,
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
dataIndex: 'innum',
|
|
|
header: '入库数量',
|
|
|
width: 80,
|
|
|
editor: {
|
|
|
xtype: 'textfield',
|
|
|
selectOnFocus: true
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
dataIndex: 'outnum',
|
|
|
header: '出库数量',
|
|
|
width: 80,
|
|
|
editor: {
|
|
|
xtype: 'textfield',
|
|
|
selectOnFocus: true
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
dataIndex: 'kfstate',
|
|
|
header: '库房',
|
|
|
renderer: function (value, p, record) {
|
|
|
if (value == null || value == '')
|
|
|
return '';
|
|
|
else
|
|
|
return record.data.kfref;
|
|
|
},
|
|
|
editor: this.comboxkfstate,
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
dataIndex: 'czdate',
|
|
|
header: '操作时间',
|
|
|
width: 110,
|
|
|
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
|
|
|
editor: {
|
|
|
xtype: 'datefield',
|
|
|
selectOnFocus: true
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
dataIndex: 'text',
|
|
|
header: '备注',
|
|
|
width: 200,
|
|
|
editor: {
|
|
|
xtype: 'textfield',
|
|
|
selectOnFocus: true
|
|
|
}
|
|
|
}
|
|
|
]
|
|
|
});
|
|
|
|
|
|
//#endregion
|
|
|
//--------------------------------------------------//明细<<<< 库存管理 >>>>结束
|
|
|
|
|
|
////////////////////////////////////////////////
|
|
|
//#region 明细<<<< 单据表 >>>>
|
|
|
|
|
|
//单据表表格相关
|
|
|
//单据表用 枚举参照
|
|
|
this.storePaymentMethods = Ext.create('DsExt.ux.RefEnumStore', {});
|
|
|
this.storePaymentMethods.load({ params: { enumTypeId: 4} });
|
|
|
this.comboxPaymentMethods = Ext.create('DsExt.ux.RefEnumCombox', {
|
|
|
fieldLabel: '付款方式',
|
|
|
store: this.storePaymentMethods,
|
|
|
name: 'PaymentMethods'
|
|
|
});
|
|
|
|
|
|
this.storeReceiptid = Ext.create('DsExt.ux.RefEnumStore', {});
|
|
|
this.storeReceiptid.load({ params: { enumTypeId: 2} });
|
|
|
this.comboxReceiptid = Ext.create('DsExt.ux.RefEnumCombox', {
|
|
|
store: this.storeReceiptid,
|
|
|
name: 'Receiptid'
|
|
|
});
|
|
|
|
|
|
this.storeReceiptstate = Ext.create('DsExt.ux.RefEnumStore', {});
|
|
|
this.storeReceiptstate.load({ params: { enumTypeId: 7} });
|
|
|
this.comboxReceiptstate = Ext.create('DsExt.ux.RefEnumCombox', {
|
|
|
store: this.storeReceiptstate,
|
|
|
name: 'state'
|
|
|
});
|
|
|
|
|
|
//单据表-数据集
|
|
|
this.storeReceipt = Ext.create('Ext.data.Store', {
|
|
|
model: 'Receiptmb',
|
|
|
remoteSort: false,
|
|
|
proxy: {
|
|
|
type: 'ajax',
|
|
|
url: '/Import/XXH/GetReceiptList',
|
|
|
reader: {
|
|
|
id: 'id,ContractNo',
|
|
|
root: 'data',
|
|
|
totalProperty: 'totalCount'
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
//单据表表格
|
|
|
this.cellEditingReceipt = Ext.create('Ext.grid.plugin.CellEditing', {
|
|
|
clicksToEdit: 1
|
|
|
});
|
|
|
// this.ReceiptGridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
|
|
|
|
|
|
this.gridListReceipt = new Ext.grid.GridPanel({
|
|
|
store: this.storeReceipt,
|
|
|
enableHdMenu: false,
|
|
|
region: 'center',
|
|
|
loadMask: { msg: "数据加载中,请稍等..." },
|
|
|
trackMouseOver: true,
|
|
|
disableSelection: false,
|
|
|
plugins: [this.cellEditingReceipt],
|
|
|
selType: 'cellmodel',
|
|
|
tbar: [{
|
|
|
text: '增加明细',
|
|
|
tooltip: '增加明细',
|
|
|
iconCls: "btnadddetail",
|
|
|
handler: function (button, event) {
|
|
|
this.onAddReceiptClick(button, event);
|
|
|
},
|
|
|
scope: this
|
|
|
}, '-', {
|
|
|
text: '删除明细',
|
|
|
tooltip: '删除明细',
|
|
|
iconCls: "btndeletedetail",
|
|
|
handler: function (button, event) {
|
|
|
this.onDelReceiptClick(button, event);
|
|
|
},
|
|
|
scope: this
|
|
|
}, {
|
|
|
text: 'AA',
|
|
|
tooltip: 'AA',
|
|
|
handler: function (button, event) {
|
|
|
var selectedRecords = this.gridListReceipt.selModel.getSelection();
|
|
|
|
|
|
// alert(selectedRecords.length);
|
|
|
},
|
|
|
scope: this
|
|
|
}],
|
|
|
columns: [
|
|
|
{
|
|
|
sortable: true,
|
|
|
hidden: true,
|
|
|
dataIndex: 'id',
|
|
|
header: 'id',
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
hidden: true,
|
|
|
dataIndex: 'ContractNo',
|
|
|
header: 'ContractNo',
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'Receiptid',
|
|
|
header: '单据类型/名称',
|
|
|
renderer: function (value, p, record) {
|
|
|
if (value == null || value == '')
|
|
|
return '';
|
|
|
else
|
|
|
return record.data.ReceiptName;
|
|
|
},
|
|
|
editor: this.comboxReceiptid,
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'ReceiptNo',
|
|
|
header: '单据编号',
|
|
|
width: 100,
|
|
|
editor: {
|
|
|
xtype: 'textfield',
|
|
|
selectOnFocus: true
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'state',
|
|
|
header: '收发状态',
|
|
|
renderer: function (value, p, record) {
|
|
|
if (value == null || value == '')
|
|
|
return '';
|
|
|
else
|
|
|
return record.data.statename;
|
|
|
},
|
|
|
editor: this.comboxReceiptstate,
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'Send_date',
|
|
|
header: '发出时间',
|
|
|
width: 80,
|
|
|
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
|
|
|
editor: {
|
|
|
format: 'Y-m-d',
|
|
|
xtype: 'datefield',
|
|
|
selectOnFocus: true
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'receive_date',
|
|
|
header: '收到时间',
|
|
|
editor: {
|
|
|
xtype: 'datefield',
|
|
|
format: 'Y-m-d',
|
|
|
selectOnFocus: true
|
|
|
},
|
|
|
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'repeat_date',
|
|
|
header: '回复时间',
|
|
|
width: 80,
|
|
|
renderer: Ext.util.Format.dateRenderer('Y-n-j'),
|
|
|
editor: {
|
|
|
format: 'Y-n-j',
|
|
|
xtype: 'datefield'
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'trancer',
|
|
|
header: '快递公司',
|
|
|
width: 80,
|
|
|
editor: {
|
|
|
xtype: 'textfield'
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'trancNo',
|
|
|
header: '快递号',
|
|
|
width: 80,
|
|
|
editor: {
|
|
|
xtype: 'textfield'
|
|
|
}
|
|
|
}
|
|
|
]
|
|
|
});
|
|
|
//#endregion
|
|
|
///////---------------------------------/明细 <<<< 单据表 >>>> over
|
|
|
|
|
|
//#region 明细表<<<应收应付/费用表>>>
|
|
|
|
|
|
//明细表表格相关
|
|
|
this.storeFeeTypeRef = Ext.create('DsExt.ux.RefEnumStore', {});
|
|
|
this.storeFeeTypeRef.load({ params: { enumTypeId: 99020} });
|
|
|
|
|
|
this.comboxFeeTypeRef = Ext.create('DsExt.ux.RefEnumCombox', {
|
|
|
store: this.storeFeeTypeRef,
|
|
|
name: 'FeeType'
|
|
|
});
|
|
|
|
|
|
this.storeFeeNameRef = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'DsTruckMng.ux.FeeTypeRefModel',
|
|
|
proxy: { url: '/CommMng/BasicDataRef/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.storeCustomerNameRef = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'DsTruckMng.ux.CustomRefModel',
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetTrader' }
|
|
|
});
|
|
|
this.storeCustomerNameRef.load({ params: { condition: "isnull(ISSTOP,0)=0"} });
|
|
|
this.comboxCustomerNameRef = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
store: this.storeCustomerNameRef,
|
|
|
forceSelection: true,
|
|
|
name: 'CustomerName',
|
|
|
valueField: 'name',
|
|
|
displayField: 'codename'
|
|
|
});
|
|
|
|
|
|
|
|
|
//明细表-数据集
|
|
|
this.storeBodyChFee = Ext.create('Ext.data.Store', {
|
|
|
model: 'MsChFee',
|
|
|
remoteSort: false,
|
|
|
proxy: {
|
|
|
type: 'ajax',
|
|
|
url: '/Import/MsChFee/GetDataList',
|
|
|
reader: {
|
|
|
id: 'GId',
|
|
|
root: 'data',
|
|
|
totalProperty: 'totalCount'
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
//明细表表格
|
|
|
this.cellEditingChFee = Ext.create('Ext.grid.plugin.CellEditing', {
|
|
|
clicksToEdit: 1
|
|
|
});
|
|
|
this.feeGridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
|
|
|
|
|
|
this.gridListChFee = new Ext.grid.GridPanel({
|
|
|
store: this.storeBodyChFee,
|
|
|
enableHdMenu: false,
|
|
|
region: 'center',
|
|
|
loadMask: { msg: "数据加载中,请稍等..." },
|
|
|
trackMouseOver: true,
|
|
|
disableSelection: false,
|
|
|
plugins: [this.cellEditingChFee],
|
|
|
selModel: this.feeGridCheckBoxModel,
|
|
|
selType: 'cellmodel',
|
|
|
viewConfig: {
|
|
|
autoFill: true,
|
|
|
getRowClass: function (record, rowIndex, rowParams, store) {
|
|
|
var feeStatus = record.get('FeeStatus');
|
|
|
return DsTruck.MsChFeeGetRowClass(feeStatus);
|
|
|
}
|
|
|
},
|
|
|
tbar: [{
|
|
|
text: '增加明细',
|
|
|
tooltip: '增加明细',
|
|
|
iconCls: "btnadddetail",
|
|
|
handler: function (button, event) {
|
|
|
this.onAddDetailClick(button, event, '2');
|
|
|
},
|
|
|
scope: this
|
|
|
}, '-', {
|
|
|
text: '删除明细',
|
|
|
tooltip: '删除明细',
|
|
|
iconCls: "btndeletedetail",
|
|
|
handler: function (button, event) {
|
|
|
this.onDelDetailClick(button, event, '2');
|
|
|
},
|
|
|
scope: this
|
|
|
}, '-', {
|
|
|
text: '提交审核',
|
|
|
tooltip: '提交审核',
|
|
|
iconCls: 'btnsubmitaudit',
|
|
|
handler: function (button, event) {
|
|
|
this.onSubmitAuditClick(button, event);
|
|
|
},
|
|
|
scope: this
|
|
|
}],
|
|
|
columns: [{
|
|
|
sortable: true,
|
|
|
dataIndex: 'GId',
|
|
|
header: '惟一编号',
|
|
|
hidden: true,
|
|
|
width: 160
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'BsNo',
|
|
|
header: '业务编号',
|
|
|
hidden: true,
|
|
|
width: 200
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'FeeStatus',
|
|
|
header: '费用状态',
|
|
|
renderer: function (value, p, record) {
|
|
|
return record.data.FeeStatus_Ref;
|
|
|
},
|
|
|
width: 66
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'FeeName',
|
|
|
header: '费用名称',
|
|
|
editor: this.comboxFeeNameRef,
|
|
|
width: 80
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'FeeType',
|
|
|
header: '收付方式',
|
|
|
renderer: function (value, p, record) {
|
|
|
if (value == null || value == '')
|
|
|
return '';
|
|
|
else
|
|
|
return value + '-' + record.data.FeeType_Ref;
|
|
|
},
|
|
|
editor: this.comboxFeeTypeRef,
|
|
|
width: 66
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'FeeDescription',
|
|
|
header: '费用英文名称',
|
|
|
hidden: true,
|
|
|
width: 200
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'CustomerType',
|
|
|
header: '客户类别',
|
|
|
hidden: true,
|
|
|
width: 200
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'CustomerName',
|
|
|
header: '结算对象',
|
|
|
editor: this.comboxCustomerNameRef,
|
|
|
width: 120
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'Unit',
|
|
|
header: '单位标准',
|
|
|
hidden: true,
|
|
|
width: 200
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'UnitPrice',
|
|
|
header: '单价',
|
|
|
editor: {
|
|
|
xtype: 'numberfield',
|
|
|
selectOnFocus: true
|
|
|
},
|
|
|
width: 60,
|
|
|
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;
|
|
|
}
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'Quantity',
|
|
|
header: '数量',
|
|
|
editor: {
|
|
|
xtype: 'numberfield',
|
|
|
selectOnFocus: true
|
|
|
},
|
|
|
width: 60
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'Amount',
|
|
|
header: '金额',
|
|
|
width: 60,
|
|
|
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;
|
|
|
}
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'Currency',
|
|
|
header: '币别',
|
|
|
//hidden: true,
|
|
|
width: 50
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'ExChangerate',
|
|
|
header: '汇率',
|
|
|
//hidden: true,
|
|
|
editor: {
|
|
|
xtype: 'numberfield',
|
|
|
selectOnFocus: true
|
|
|
},
|
|
|
width: 60
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'Reason',
|
|
|
header: '原因',
|
|
|
hidden: true,
|
|
|
width: 200
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'Remark',
|
|
|
header: '备注',
|
|
|
editor: {
|
|
|
xtype: 'textfield',
|
|
|
selectOnFocus: true
|
|
|
},
|
|
|
width: 550
|
|
|
}
|
|
|
]
|
|
|
});
|
|
|
|
|
|
this.gridListChFee.on('edit', function (editor, e, eOpts) {
|
|
|
this.gridListChFeeAfterEdit(editor, e, eOpts);
|
|
|
}, this);
|
|
|
|
|
|
this.cellEditingChFee.on('beforeedit', function (editor, e) {
|
|
|
return this.cellEditingChFeeBeforeEdit(editor, e);
|
|
|
}, this);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//#endregion---------------------明细表<<<应收应付/费用>>> over
|
|
|
|
|
|
|
|
|
//公共按钮Toolbar:panelBtn
|
|
|
this.panelBtn = new Ext.Panel({
|
|
|
region: "north",
|
|
|
tbar: [
|
|
|
{
|
|
|
// id: "saveandclose",
|
|
|
text: "保存",disabled: true,id:"SAVE1",
|
|
|
handler: function (button, event) {
|
|
|
this.Save('0');
|
|
|
},
|
|
|
scope: this
|
|
|
}, {
|
|
|
// id: "saveandclose",
|
|
|
text: "保存并关闭",disabled: true,id:"SAVE2",
|
|
|
handler: function (button, event) {
|
|
|
this.Save('1');
|
|
|
},
|
|
|
scope: this
|
|
|
},
|
|
|
{
|
|
|
// id: "saveandclose",
|
|
|
text: "保存并新建",disabled: true,id:"SAVE3",
|
|
|
handler: function (button, event) {
|
|
|
this.Save('2');
|
|
|
},
|
|
|
scope: this
|
|
|
},{
|
|
|
// id: "saveandclose",
|
|
|
text: "保存并新建类似合同",disabled: true,id:"SAVE4",
|
|
|
handler: function (button, event) {
|
|
|
this.Save('3');
|
|
|
},
|
|
|
scope: this
|
|
|
}, '-',
|
|
|
{
|
|
|
// id: "saveandclose",
|
|
|
text: "关闭",
|
|
|
handler: function (button, event) {
|
|
|
window.close();
|
|
|
},
|
|
|
scope: this
|
|
|
}, '-',
|
|
|
{
|
|
|
// id: "saveandclose",
|
|
|
//text: "打印",
|
|
|
//handler: function (button, event) {
|
|
|
// this.Print();
|
|
|
//},
|
|
|
//scope: this
|
|
|
}
|
|
|
]
|
|
|
}); //end 按钮Toolbar
|
|
|
|
|
|
//布局
|
|
|
/* 3 */
|
|
|
this.panelTop = new Ext.Panel({
|
|
|
layout: "border",
|
|
|
region: "north",
|
|
|
height: 340,
|
|
|
items: [this.panelBtn, this.formEdit]
|
|
|
});
|
|
|
|
|
|
this.panelCargoandApp = new Ext.tab.Panel({
|
|
|
layout: "border",
|
|
|
region: 'center',
|
|
|
split: true,
|
|
|
height: 500,
|
|
|
margin: '1 1',
|
|
|
items: [this.formCargo, this.file
|
|
|
]
|
|
|
});
|
|
|
|
|
|
Ext.apply(this, {
|
|
|
items: [this.panelTop, this.panelCargoandApp]
|
|
|
});
|
|
|
|
|
|
|
|
|
this.InitData();
|
|
|
|
|
|
//集中绑定编辑后事件
|
|
|
|
|
|
this.gridListReceipt.on('edit', function (editor, e, eOpts) {
|
|
|
this.ReceiptAfterEdit(editor, e, eOpts);
|
|
|
}, this);
|
|
|
|
|
|
this.formCargo.on('edit', function (editor, e, eOpts) {
|
|
|
this.CargoAfterEdit(editor, e, eOpts);
|
|
|
}, this);
|
|
|
this.cellEditingCargo.on('beforeedit', function (editor, e) {
|
|
|
return this.CargoBeforeEdit(editor, e);
|
|
|
}, this);
|
|
|
|
|
|
this.formAppstate.on('edit', function (editor, e, eOpts) {
|
|
|
this.AppstateAfterEdit(editor, e, eOpts);
|
|
|
}, this);
|
|
|
|
|
|
this.formKC.on('edit', function (editor, e, eOpts) {
|
|
|
this.KCAfterEdit(editor, e, eOpts);
|
|
|
}, this);
|
|
|
|
|
|
this.formCargo.getSelectionModel().on('select',
|
|
|
function (model, record, index) {
|
|
|
this.C_cargoinfo_id = record.data.cargoinfo_id;
|
|
|
//alert(this.C_cargoinfo_id);
|
|
|
},
|
|
|
this);
|
|
|
_this = this;
|
|
|
}, //end initUIComponents
|
|
|
onAddFileClick: function () {
|
|
|
var winAccess = new Shipping.FileUpload({});
|
|
|
winAccess.BillNo = this.editRecord.get('ContractNo');
|
|
|
winAccess.Obj = this;
|
|
|
winAccess.CallBackFun = function (obj) {
|
|
|
obj.storeChfeeFile.load({
|
|
|
params: {
|
|
|
BillNo: obj.editRecord.get('ContractNo')
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
winAccess.show();
|
|
|
},
|
|
|
|
|
|
onDelFileClick: function () {
|
|
|
var selections = this.fileGrid.getSelectionModel().getSelection();
|
|
|
if (selections.length == 0) {//提示', msg: '请先选择要删除的数据!
|
|
|
Ext.Msg.show({ title: Zi.LAN.Prompt, msg: Zi.LAN.selectdelete, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
|
return;
|
|
|
}
|
|
|
var record = new Array();
|
|
|
for (var i = 0; i < selections.length; i++) {
|
|
|
record.push(selections[i].data);
|
|
|
} //提示', '确定删除该记录吗?'
|
|
|
Ext.MessageBox.confirm(Zi.LAN.Prompt, Zi.LAN.suredelete, function (btn) {
|
|
|
if (btn == 'yes') {
|
|
|
Ext.Msg.wait(Zi.LAN.nowdelete); //正在删除数据
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: Zi.LAN.nowdelete,
|
|
|
url: '/Account/Chfee_payapplication/CertDel',
|
|
|
params: {
|
|
|
data: Ext.JSON.encode(record)
|
|
|
},
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
var jsonresult = Ext.JSON.decode(response.responseText);
|
|
|
if (jsonresult.Success) {
|
|
|
this.storeChfeeFile.load({
|
|
|
params: {
|
|
|
BillNo: window.parent.opener.OprationSwap()[2].get('ContractNo')
|
|
|
}
|
|
|
});
|
|
|
Ext.Msg.show({ title: Zi.LAN.Prompt, msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
|
} //提示
|
|
|
else {
|
|
|
Ext.Msg.show({ title: Zi.LAN.Prompt, msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
failure: function (response, options) {//'警告', msg: '服务器响应出错,请重试'
|
|
|
Ext.Msg.show({ title: Zi.LAN.Caveat, msg: Zi.LAN.FuWuQiError, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
|
},
|
|
|
success: function (response, options) {
|
|
|
},
|
|
|
scope: this
|
|
|
}); //end Ext.Ajax.request
|
|
|
}
|
|
|
}, this);
|
|
|
},
|
|
|
////////<<<商品>>>明细表相关方法
|
|
|
reLine: function (button, event) {
|
|
|
var _L=1;
|
|
|
this.storeCargo.each(function(record) {
|
|
|
var ln=_L+"";
|
|
|
_L=_L+1;
|
|
|
record.set('SEQUENCE',ln);
|
|
|
});
|
|
|
},
|
|
|
|
|
|
|
|
|
CanAdd: function (countryid) {
|
|
|
|
|
|
if (countryid == "") {
|
|
|
alert("添加货物之前必须先选择进口国");
|
|
|
return false;
|
|
|
} else return true;
|
|
|
},
|
|
|
getBaoLv: function (TransactionMethod) {
|
|
|
var baolv = '1.000';
|
|
|
if (TransactionMethod == 'CFR') {
|
|
|
baolv = '1.003';
|
|
|
}
|
|
|
return baolv;
|
|
|
},
|
|
|
|
|
|
onAddCargoClick: function (button, event) {
|
|
|
//20191009 首先判断是否已选中一行 如有 则将其作为参数 传递给onCopyCargoClick 以实现复制添加
|
|
|
var selectedRecords = this.formCargo.selModel.getSelection();
|
|
|
if (selectedRecords.length > 0) {
|
|
|
record = selectedRecords[0];
|
|
|
this.onCopyAddCargoClick(record.data);
|
|
|
//return;
|
|
|
} else {
|
|
|
|
|
|
if (!this.CanAdd(this.formEdit.getForm().findField('countryid').getRawValue())) return;
|
|
|
|
|
|
var baolv = this.getBaoLv(this.formEdit.getForm().findField('TransactionMethod').getRawValue());
|
|
|
|
|
|
var USDGID = "740DF21C-BDE4-4C3E-A258-683A183AD3B4";
|
|
|
|
|
|
var Exchangerate = "1";
|
|
|
|
|
|
var currrecords = DsStoreQueryBy(this.storecurrQZ, 'GID', USDGID);
|
|
|
if (currrecords.getCount() > 0) {
|
|
|
currdata = currrecords.getAt(0).data;
|
|
|
Exchangerate = currdata.DEFRATE;
|
|
|
} else {
|
|
|
var currrecords = DsStoreQueryBy(this.storecurr, 'gid', USDGID);
|
|
|
if (currrecords.getCount() > 0) {
|
|
|
currdata = currrecords.getAt(0).data;
|
|
|
Exchangerate = currdata.defaultrate;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
var linenum = this.storeCargo.getCount() + 1;
|
|
|
var _r = this.reLine();
|
|
|
var record = Ext.create('Cargomb', {
|
|
|
'id': '',
|
|
|
'GID': NewGuid(),
|
|
|
'ContractNo': '',
|
|
|
'SEQUENCE': linenum,
|
|
|
'cargoinfo_id': '',
|
|
|
'name': '',
|
|
|
'Ename': '',
|
|
|
'SBYS': '部位: 瘦肉率: % 带肉率: %',
|
|
|
'price': '0',
|
|
|
'price_agio': '0',
|
|
|
'price_limit': '0',
|
|
|
'amount': '0',
|
|
|
'weight': '0',
|
|
|
'Unit': '2',
|
|
|
'UnitRate': '1000',
|
|
|
'BoxCount': '0',
|
|
|
'BoxWeight': '0',
|
|
|
'Exporter': '',
|
|
|
'FactoryNo': '',
|
|
|
'Productiondate': '',
|
|
|
'baolv': baolv,
|
|
|
'tax': '0.0',
|
|
|
'tax_zz': '0.0',
|
|
|
'tax_1': '0.0',
|
|
|
'tax_zz_1': '0.0',
|
|
|
'tax_2': '0.0',
|
|
|
'tax_zz_2': '0.0',
|
|
|
'currid': '740DF21C-BDE4-4C3E-A258-683A183AD3B4',
|
|
|
'UnitRef': '吨',
|
|
|
'codename': 'USD',
|
|
|
'Exchangerate': Exchangerate,
|
|
|
'prepayments': '0',
|
|
|
'balance': '0',
|
|
|
'pay_prepayments': '0',
|
|
|
'pay_balance': '0',
|
|
|
'PreProportion': '0',
|
|
|
'RecProportion': '0',
|
|
|
'AMOUNT_WRITEOFFS': '0',
|
|
|
'AGENCRATE': '0'
|
|
|
});
|
|
|
this.storeCargo.add(record);
|
|
|
|
|
|
var n = this.storeCargo.getCount();
|
|
|
this.cellEditingCargo.startEditByPosition({ row: n - 1, column: 4 });
|
|
|
}
|
|
|
//aftereditform();
|
|
|
},
|
|
|
|
|
|
onCopyAddCargoClick: function (oldrecord) {
|
|
|
|
|
|
if (!this.CanAdd(this.formEdit.getForm().findField('countryid').getRawValue())) return;
|
|
|
|
|
|
var baolv = this.getBaoLv(this.formEdit.getForm().findField('TransactionMethod').getRawValue());
|
|
|
|
|
|
var USDGID = "740DF21C-BDE4-4C3E-A258-683A183AD3B4";
|
|
|
|
|
|
var Exchangerate = "1";
|
|
|
|
|
|
var currrecords = DsStoreQueryBy(this.storecurrQZ, 'GID', USDGID);
|
|
|
if (currrecords.getCount() > 0) {
|
|
|
currdata = currrecords.getAt(0).data;
|
|
|
Exchangerate = currdata.DEFRATE;
|
|
|
} else {
|
|
|
var currrecords = DsStoreQueryBy(this.storecurr, 'gid', USDGID);
|
|
|
if (currrecords.getCount() > 0) {
|
|
|
currdata = currrecords.getAt(0).data;
|
|
|
Exchangerate = currdata.defaultrate;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
var linenum = this.storeCargo.getCount() + 1;
|
|
|
var _r = this.reLine();
|
|
|
var record = Ext.create('Cargomb', {
|
|
|
'id': '',
|
|
|
'GID': NewGuid(),
|
|
|
'ContractNo': '',
|
|
|
'SEQUENCE': linenum,
|
|
|
'CargoType': oldrecord.CargoType,
|
|
|
|
|
|
'name': '',
|
|
|
'Ename': '',
|
|
|
'SBYS': '部位: 瘦肉率: % 带肉率: %',
|
|
|
'price': '0',
|
|
|
'price_agio': '0',
|
|
|
'price_limit': '0',
|
|
|
'amount': '0',
|
|
|
'weight': '0',
|
|
|
'Unit': '2',
|
|
|
'UnitRate': '1000',
|
|
|
'BoxCount': '0',
|
|
|
'BoxWeight': '0',
|
|
|
'Exporter': oldrecord.Exporter,
|
|
|
'ICP': oldrecord.ICP,
|
|
|
'SPECIFICATIONS': oldrecord.SPECIFICATIONS,
|
|
|
'cargoinfo_id': oldrecord.cargoinfo_id,
|
|
|
'cicode': oldrecord.cicode,
|
|
|
'cicodeandname': oldrecord.cicodeandname,
|
|
|
'cargociq_id': oldrecord.cargociq_id,
|
|
|
'ciqcodeandname': oldrecord.ciqcodeandname,
|
|
|
'AGENCRATE': oldrecord.AGENCRATE,
|
|
|
'FactoryNo': '',
|
|
|
'Productiondate': '',
|
|
|
'baolv': baolv,
|
|
|
'tax_1': '0.0',
|
|
|
'tax_zz_1': '0.0',
|
|
|
'tax_2': '0.0',
|
|
|
'tax_zz_2': '0.0',
|
|
|
'currid': oldrecord.currid,
|
|
|
'UnitRef': '吨',
|
|
|
'codename': 'USD',
|
|
|
'Exchangerate': Exchangerate,
|
|
|
'Exchangerate_Customs': oldrecord.Exchangerate_Customs,
|
|
|
'prepayments': '0',
|
|
|
'balance': '0',
|
|
|
'pay_prepayments': '0',
|
|
|
'pay_balance': '0',
|
|
|
'PreProportion': oldrecord.PreProportion,
|
|
|
'AMOUNT_WRITEOFFS': '0',
|
|
|
'Paypart': oldrecord.Paypart,
|
|
|
'paypartRef': oldrecord.paypartRef,
|
|
|
'tariff': oldrecord.tariff,
|
|
|
'tax': oldrecord.tax,
|
|
|
'tax_cl': oldrecord.tax_cl,
|
|
|
'tax_zz': oldrecord.tax_zz,
|
|
|
'Declarenumber': oldrecord.Declarenumber
|
|
|
});
|
|
|
this.storeCargo.add(record);
|
|
|
|
|
|
var n = this.storeCargo.getCount();
|
|
|
this.cellEditingCargo.startEditByPosition({ row: n - 1, column: 4 });
|
|
|
//aftereditform();
|
|
|
},
|
|
|
|
|
|
onDelCargoClick: function (button, event) {
|
|
|
var selectedRecords = this.formCargo.selModel.getSelection();
|
|
|
if (selectedRecords.length == 0) return;
|
|
|
Ext.MessageBox.confirm('提示', '确定删除记录吗?', function (btn) {
|
|
|
if (btn == 'yes') {
|
|
|
var _Used=0;
|
|
|
for (var i = 0; i < selectedRecords.length; i++) {
|
|
|
var rec = selectedRecords[i];
|
|
|
var cargo_id=rec.data.id;
|
|
|
if (cargo_id==""||cargo_id==null){
|
|
|
//continue;
|
|
|
}else{
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在查询数据...',
|
|
|
url: '/CommMng/BasicDataRef/GeneralSelect',
|
|
|
scope: this,
|
|
|
async:false,
|
|
|
params: {condition: "select Count(*) GVALUE,'' as GID from Import_appstate where isnull(cancellation,0)=0 and cargo_id="+cargo_id+" "} ,
|
|
|
callback: function (options, success, response) {
|
|
|
var result = Ext.JSON.decode(response.responseText);
|
|
|
_Used=parseFloat(result.data[0].GVALUE);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
|
|
|
if (parseFloat( _Used)>0){
|
|
|
alert("此商品已配证,不能删除");
|
|
|
}else{
|
|
|
|
|
|
if (rec.data.ContractNo !== "" && rec.data.ContractNo !== "*") //如果是新增但没有保存的数据,没有必要提交到后台
|
|
|
{
|
|
|
this.CargoDel.push(rec);
|
|
|
}
|
|
|
this.storeCargo.remove(selectedRecords[i]);
|
|
|
}
|
|
|
}
|
|
|
var _r=this.reLine();
|
|
|
}
|
|
|
}, this);
|
|
|
//aftereditform();
|
|
|
},
|
|
|
|
|
|
onKCStartClick: function (button,event){//初始化库存,
|
|
|
Ext.MessageBox.confirm('提示', '这将会清空该货物的所有库存重新开始记录。确定初始化库存吗?', function (btn) {
|
|
|
if (btn == 'yes') {
|
|
|
var selectedRecords = this.formCargo.selModel.getSelection();
|
|
|
if (selectedRecords.length==0){
|
|
|
alert('请选择至少一条商品记录');
|
|
|
return;
|
|
|
}
|
|
|
var cargoidlist='';
|
|
|
for (var i = 0; i < selectedRecords.length; i++) {
|
|
|
var rec = selectedRecords[i];
|
|
|
if (i==0) {
|
|
|
cargoidlist=rec.get('id');
|
|
|
}
|
|
|
else {
|
|
|
cargoidlist=cargoidlist+','+rec.get('id');
|
|
|
}
|
|
|
}
|
|
|
Ext.Ajax.request({//
|
|
|
waitMsg: '正在初始化库存数据...',
|
|
|
url: '/Import/XXH/KCStart',
|
|
|
params: {
|
|
|
cargo_id: cargoidlist
|
|
|
},
|
|
|
callback: function (_count) {
|
|
|
//alert('初始化完成');
|
|
|
//重新load库存表的store
|
|
|
this.storeKC.load({ params: { condition: this.editRecord.get('ContractNo')} });
|
|
|
},
|
|
|
scope: this
|
|
|
});//request over
|
|
|
}
|
|
|
}, this);//确认窗口over
|
|
|
},
|
|
|
onbtnCWStartClick: function(button, event) { //初始化应收应付,
|
|
|
Ext.MessageBox.confirm('提示', '这将会在应收应付列表增加一些内容,如不保存就不会真正增加。确定吗?',
|
|
|
function(btn) {
|
|
|
if (btn == 'yes') {
|
|
|
// addChFee: function(FeeType,Currency,FeeName,price,Quantity)
|
|
|
|
|
|
/* var selectedRecords = this.formCargo.selModel.getSelection();
|
|
|
Ext.MessageBox.confirm('提示', '确定删除记录吗?',
|
|
|
function(btn) {
|
|
|
if (btn == 'yes') {
|
|
|
for (var i = 0; i < selectedRecords.length; i++) {
|
|
|
var rec = selectedRecords[i];
|
|
|
alert(rec.ContractNo);
|
|
|
if (rec.ContractNo != "" || rec.ContractNo != "*") //如果是新增但没有保存的数据,没有必要提交到后台
|
|
|
{
|
|
|
this.CargoDel.push(rec);
|
|
|
}
|
|
|
this.storeCargo.remove(selectedRecords[i]);
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
this);*/
|
|
|
var selectedRecords = this.formCargo.selModel.getSelection();
|
|
|
|
|
|
for (var i = 0; i < selectedRecords.length; i++) {
|
|
|
var rec = selectedRecords[i];
|
|
|
this.addChFee(1,rec.get('codename'),'预付款',rec.get('prepayments'),1,'单价'+rec.get('price')+'*重量'+rec.get('weight')+'='+rec.get('Amount'));
|
|
|
this.addChFee(1,rec.get('codename'),'尾款',rec.get('balance'),1,'');
|
|
|
this.addChFee(2,rec.get('codename'),'预付款',rec.get('prepayments'),1,'');
|
|
|
|
|
|
var Buybalance=parseFloat(rec.get('pay_Amount'))-parseFloat(rec.get('prepayments'))
|
|
|
this.addChFee(2,rec.get('codename'),'尾款',Buybalance,1,'差价'+rec.get('price_agio')+' 付贸易商购货款'+rec.get('pay_Amount'));
|
|
|
this.addChFee(1,'RMB','代理费',300,(rec.get('weight')/1000).toFixed(4));
|
|
|
this.addChFee(1,'RMB','THC',1280,1);
|
|
|
this.addChFee(1,'RMB','拖车费',1400,1);
|
|
|
this.addChFee(1,'RMB','验货费',620,1);
|
|
|
|
|
|
//var tax=parseFloat(rec.get('tax_Amount'))*parseFloat(rec.get('tax'));
|
|
|
var priceandtax=parseFloat(rec.get('tax_Amount'))*(1+parseFloat(rec.get('tax')));
|
|
|
var tax=parseFloat(rec.get('tax_Amount'))*(parseFloat(rec.get('tax')));
|
|
|
|
|
|
this.addChFee(1,rec.get('codename'),'关税',rec.get('tax_Amount'),rec.get('tax'));
|
|
|
this.addChFee(1,rec.get('codename'),'增值税',priceandtax.toFixed(2),rec.get('tax_zz'),'完税价格'+rec.get('tax_Amount')+'+关税'+tax.toFixed(2)+'='+priceandtax.toFixed(2));
|
|
|
|
|
|
}
|
|
|
/*
|
|
|
//alert(this.editRecord.get('ContractNo'))
|
|
|
Ext.Ajax.request({ //
|
|
|
waitMsg: '正在初始化应收应付...',
|
|
|
url: '/Import/XXH/CWStart',
|
|
|
params: {
|
|
|
ContractNo: this.editRecord.get('ContractNo')
|
|
|
},
|
|
|
callback: function(_count) {
|
|
|
//alert('初始化完成');
|
|
|
//重新load库存表的store
|
|
|
this.storeBodyChFee.load({
|
|
|
params: {
|
|
|
billno: this.editRecord.get('ContractNo')
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
scope: this
|
|
|
}); //request over
|
|
|
*/
|
|
|
}
|
|
|
},
|
|
|
this); //确认窗口over
|
|
|
},
|
|
|
|
|
|
addChFee: function(FeeType,Currency,FeeName,price,Quantity,Remark) {
|
|
|
var _CustomerName='';
|
|
|
if (FeeType==1)
|
|
|
{
|
|
|
var _FeeType=1;
|
|
|
var _FeeType_Ref='应收';
|
|
|
_CustomerName=this.getCustName();
|
|
|
}
|
|
|
else {
|
|
|
var _FeeType=2;
|
|
|
var _FeeType_Ref='应付';
|
|
|
_CustomerName=this.getSellerName();
|
|
|
if (FeeName=='关税'||FeeName=='增值税'){_CustomerName='报关行';}
|
|
|
//CustomerName: this.formEdit.getForm().findField('seller');
|
|
|
};
|
|
|
|
|
|
//var _Amount=price*Quantity;
|
|
|
var _Amount=0;
|
|
|
|
|
|
record = Ext.create('MsChFee', {
|
|
|
GId: NewGuid(),
|
|
|
BsNo: '*',
|
|
|
FeeStatus: 1,
|
|
|
FeeStatus_Ref: '录入状态',
|
|
|
FeeType: _FeeType,
|
|
|
FeeType_Ref: _FeeType_Ref,
|
|
|
FeeName: FeeName,
|
|
|
FeeName_Ref: '',
|
|
|
FeeDescription: '',
|
|
|
CustomerType: '',
|
|
|
CustomerName: _CustomerName,
|
|
|
//this.formEdit.getForm().findField('buyer');
|
|
|
CustomerName_Ref: '',
|
|
|
Unit: '',
|
|
|
price: 0,
|
|
|
UnitPrice: price,
|
|
|
Quantity: Quantity,
|
|
|
Amount: _Amount,
|
|
|
Currency: Currency,
|
|
|
ExChangerate: 1,
|
|
|
Reason: '',
|
|
|
Remark: Remark,
|
|
|
Commissionrate: 0,
|
|
|
Settlement: 0,
|
|
|
Invoice: 0,
|
|
|
OrderAmount: 0,
|
|
|
OrderInvoice: 0,
|
|
|
SubmitDate: null,
|
|
|
Auditoperator: '',
|
|
|
AuditDate: null,
|
|
|
EnteroPerator: GetCookie_UserId(),
|
|
|
EnterDate: null,
|
|
|
DebitNo: '',
|
|
|
IsDebit: "0",
|
|
|
IsOpen: "0",
|
|
|
IsAdvancedpay: "0",
|
|
|
Sort: "0",
|
|
|
IsInvoice: "0",
|
|
|
FeeFrt: '',
|
|
|
IsCrmOrderFee: "0",
|
|
|
AuditStatus: 0,
|
|
|
InvoiceNum: '',
|
|
|
ChequeNum: '',
|
|
|
WmsOutBsNo: ''
|
|
|
});
|
|
|
|
|
|
this.storeBodyChFee.add(record);
|
|
|
},
|
|
|
|
|
|
CargoBeforeEdit: function (editor, e) {
|
|
|
//alert(e.colIdx);
|
|
|
var cargo_id = e.record.get('id');
|
|
|
if (cargo_id==""||cargo_id==null) {cargo_id=-1;}
|
|
|
var canedit=true;
|
|
|
this.APPUsingCount=0;
|
|
|
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在查询数据...',
|
|
|
url: '/Import/UseApproval/Getused',
|
|
|
scope: this,
|
|
|
async:false,
|
|
|
params: {cargo_id: cargo_id },
|
|
|
waitMsg: "正在查询数据...",
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
var jsonresult = Ext.JSON.decode(response.responseText);
|
|
|
var returnData = jsonresult.data;
|
|
|
//alert(returnData.Count);
|
|
|
this.APPUsingCount=parseInt(returnData.Count);
|
|
|
} else {
|
|
|
Ext.Msg.show({ title: '请重试',
|
|
|
msg: '服务器响应出错',
|
|
|
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
if (e.field == 'cargoinfo_id'||e.field == 'cargociq_id'||e.field == 'Unit'
|
|
|
||e.field == 'U_weight'||e.field == 'FactoryNo'||e.field == 'Exporter')
|
|
|
{
|
|
|
if (this.APPUsingCount>0) {
|
|
|
canedit=false;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
if (e.field == 'cargociq_id'){
|
|
|
//20150112
|
|
|
var cargoinfoid=e.record.get('cargoinfo_id');
|
|
|
if (cargoinfoid!="" && cargoinfoid!= null)
|
|
|
{
|
|
|
var s=" cargoinfoid="+cargoinfoid;
|
|
|
this.storeCargociq.load({ params: { condition: s} });
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
if (e.field == 'FactoryNo'){
|
|
|
if (e.record.get('Exporter')==""){
|
|
|
//canedit=false;
|
|
|
//alert("请先选择出口商!");
|
|
|
}else{
|
|
|
//this.storeFactoryNo.load({ params: { condition: " CLIENTGID=(select gid from info_client where shortname='"+e.record.get('Exporter')+"') "} });
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
if (e.field == 'name'){
|
|
|
var HS_ID=e.record.get('cargoinfo_id');
|
|
|
if (HS_ID==null){HS_ID="";}
|
|
|
if (e.record.get('FactoryNo')==""||e.record.get('FactoryNo')==null){
|
|
|
|
|
|
var Ename = e.record.get('Ename');
|
|
|
|
|
|
if (Ename==""||Ename==null)
|
|
|
{
|
|
|
if (HS_ID=="" || this.APPUsingCount==0)
|
|
|
{
|
|
|
this.storeCargoName.load({ params: {
|
|
|
start: 0, limit: 5000, sort: '',
|
|
|
condition: ""}
|
|
|
});
|
|
|
}else{
|
|
|
this.storeCargoName.load({ params: {
|
|
|
start: 0, limit: 5000, sort: '',
|
|
|
condition: "HS_ID="+e.record.get('cargoinfo_id')}
|
|
|
});
|
|
|
}
|
|
|
}else{
|
|
|
if (HS_ID==""|| this.APPUsingCount==0)
|
|
|
{
|
|
|
this.storeCargoName.load({ params: {
|
|
|
start: 0, limit: 5000, sort: '',
|
|
|
condition: " ENNAME='"+Ename+"'"}
|
|
|
});
|
|
|
}else{
|
|
|
this.storeCargoName.load({ params: {
|
|
|
start: 0, limit: 5000, sort: '',
|
|
|
condition: " ENNAME='"+Ename+"' and HS_ID="+e.record.get('cargoinfo_id')}
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}else{
|
|
|
//if (this.FactoryNo!=e.record.get('FactoryNo'))
|
|
|
if (HS_ID==""|| this.APPUsingCount==0)
|
|
|
{
|
|
|
this.storeCargoName.load({ params: {
|
|
|
start: 0, limit: 5000, sort: '',
|
|
|
condition: " FACTORYNOGID=(select gid from import_factoryno where factoryno='"+e.record.get('FactoryNo')+"') "} //
|
|
|
});
|
|
|
}else{
|
|
|
this.storeCargoName.load({ params: {
|
|
|
start: 0, limit: 5000, sort: '',
|
|
|
condition: " FACTORYNOGID=(select gid from import_factoryno where factoryno='"+e.record.get('FactoryNo')+"') and HS_ID="+e.record.get('cargoinfo_id')} //
|
|
|
});
|
|
|
}
|
|
|
|
|
|
this.FactoryNo=e.record.get('FactoryNo');
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (e.field == 'Ename'){
|
|
|
var HS_ID=e.record.get('cargoinfo_id');
|
|
|
if (HS_ID==null){HS_ID="";}
|
|
|
if (e.record.get('FactoryNo')==""||e.record.get('FactoryNo')==null){
|
|
|
|
|
|
var name = e.record.get('name');
|
|
|
|
|
|
if (name==""||name==null)
|
|
|
{
|
|
|
if (HS_ID=="" || this.APPUsingCount==0)
|
|
|
{
|
|
|
this.storeCargoName.load({ params: {
|
|
|
start: 0, limit: 5000, sort: '',
|
|
|
condition: ""}
|
|
|
});
|
|
|
}else{
|
|
|
this.storeCargoName.load({ params: {
|
|
|
start: 0, limit: 5000, sort: '',
|
|
|
condition: "HS_ID="+e.record.get('cargoinfo_id')}
|
|
|
});
|
|
|
}
|
|
|
}else{
|
|
|
if (HS_ID==""|| this.APPUsingCount==0)
|
|
|
{
|
|
|
this.storeCargoName.load({ params: {
|
|
|
start: 0, limit: 5000, sort: '',
|
|
|
condition: " CNNAME='"+Ename+"'"}
|
|
|
});
|
|
|
}else{
|
|
|
this.storeCargoName.load({ params: {
|
|
|
start: 0, limit: 5000, sort: '',
|
|
|
condition: " CNNAME='"+Ename+"' and HS_ID="+e.record.get('cargoinfo_id')}
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}else{
|
|
|
//if (this.FactoryNo!=e.record.get('FactoryNo'))
|
|
|
if (HS_ID==""|| this.APPUsingCount==0)
|
|
|
{
|
|
|
this.storeCargoName.load({ params: {
|
|
|
start: 0, limit: 5000, sort: '',
|
|
|
condition: " FACTORYNOGID=(select gid from import_factoryno where factoryno='"+e.record.get('FactoryNo')+"') "} //
|
|
|
});
|
|
|
}else{
|
|
|
this.storeCargoName.load({ params: {
|
|
|
start: 0, limit: 5000, sort: '',
|
|
|
condition: " FACTORYNOGID=(select gid from import_factoryno where factoryno='"+e.record.get('FactoryNo')+"') and HS_ID="+e.record.get('cargoinfo_id')} //
|
|
|
});
|
|
|
}
|
|
|
|
|
|
this.FactoryNo=e.record.get('FactoryNo');
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//20150505 当合同状态为审单或更往后的状态 禁止修改单价和重量。
|
|
|
if (this.opStatus == 'edit'){
|
|
|
var Mainstate = parseInt(this.editRecord.get('Mainstate'));
|
|
|
if (Mainstate>1 && (e.field == 'weight'||e.field == 'price'||e.field == 'price_agio'||e.field == 'price_limit'))
|
|
|
{
|
|
|
canedit=false;
|
|
|
alert("审单之后即不能修改重量和价格");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (e.field == 'Cargoinfo_id'||e.field =='Cargociq_id'){
|
|
|
var countryid = this.formEdit.getForm().findField('countryid').getRawValue();
|
|
|
if (countryid=="") {
|
|
|
alert("添加货物之前必须先选择进口国");
|
|
|
canedit=false;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (e.field == 'SPECIFICATIONS'){
|
|
|
var cicode=e.record.get('cicode');
|
|
|
if (cicode == "0203290090" || cicode == "0306120000" || cicode == "03051900" || cicode == "0306171900" || cicode == "0306172900" ){
|
|
|
//alert("只有HS代码为0203290090的商品才能修改规格");
|
|
|
if (this.APPUsingCount > 0) {
|
|
|
canedit = true;
|
|
|
}
|
|
|
}else{
|
|
|
canedit = false;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (e.field == 'cargoinfo_id'){
|
|
|
var FactoryNo = e.record.get('FactoryNo');
|
|
|
var name = e.record.get('name');
|
|
|
if ((FactoryNo=="" || FactoryNo==null)&&(name!="" && name!=null)){
|
|
|
//如果没选厂号 选了中文品名
|
|
|
//根据品名确定范围
|
|
|
var s=" countryid='"+this.formEdit.getForm().findField('countryid').getValue()+"'";
|
|
|
|
|
|
s=s+" and ci.id in(select hs_id from Import_Cargoname where CNNAME='"+name+"')"
|
|
|
this.storeCargoinfo.load({ params: { condition: s} });
|
|
|
}else
|
|
|
if ((FactoryNo!="" && FactoryNo!=null)&&(name!="" && name!=null)){
|
|
|
//如果选了厂号 选了中文品名
|
|
|
//根据厂号和品名确定范围
|
|
|
var s=" countryid='"+this.formEdit.getForm().findField('countryid').getValue()+"'";
|
|
|
|
|
|
s=s+" and ci.id in(select hs_id from Import_Cargoname where CNNAME='"+name+"' and FactoryNoGID in(select GID from Import_Factoryno where FactoryNo='"+FactoryNo+"')) "
|
|
|
this.storeCargoinfo.load({ params: { condition: s} });
|
|
|
}else{
|
|
|
this.storeCargoinfo.load({ params: { condition: ""} });
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return canedit;
|
|
|
},
|
|
|
|
|
|
|
|
|
CargoAfterEdit: function(editor, e, eOpts) {
|
|
|
if (e.record.get('AGENCRATE') === "") e.record.set('AGENCRATE','0');
|
|
|
function round2(number,fractionDigits){
|
|
|
with(Math){
|
|
|
return round(number*pow(10,fractionDigits))/pow(10,fractionDigits);
|
|
|
}
|
|
|
}
|
|
|
if (e.field == 'weight'){
|
|
|
var cargo_id = e.record.get('id');
|
|
|
APPUsing=0;
|
|
|
if (cargo_id==""||cargo_id==null)
|
|
|
{}
|
|
|
else
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在查询数据...',
|
|
|
url: '/Import/UseApproval/Getused',
|
|
|
scope: this,
|
|
|
async:false,
|
|
|
params: {cargo_id: cargo_id },
|
|
|
waitMsg: "正在查询数据...",
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
var jsonresult = Ext.JSON.decode(response.responseText);
|
|
|
var returnData = jsonresult.data;
|
|
|
//alert(returnData.Count);
|
|
|
this.APPUsing=parseFloat(returnData.Count);
|
|
|
} else {
|
|
|
Ext.Msg.show({ title: '请重试',
|
|
|
msg: '服务器响应出错',
|
|
|
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
//var a1=Cut(parseFloat(e.value),1000);
|
|
|
//var a2=parseFloat(e.value);
|
|
|
// alert(a1+','+a2);
|
|
|
if (Div(parseFloat(e.value),1000,6)>this.APPUsing && this.APPUsing>0 ) {//
|
|
|
alert("重量大于许可证用证重量:"+ this.APPUsing);
|
|
|
e.record.set('weight', e.originalValue);
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//
|
|
|
if (e.field == 'cargoinfo_id') {
|
|
|
var Cargoinforecords = DsStoreQueryBy(this.storeCargoinfo, 'id', e.value);
|
|
|
if (Cargoinforecords.getCount() > 0) {
|
|
|
var Cargoinfodata = Cargoinforecords.getAt(0).data;
|
|
|
e.record.set('cicodeandname', Cargoinfodata.codeandname);
|
|
|
var str_before = Cargoinfodata.codeandname.split("_")[0];
|
|
|
e.record.set('cicode', str_before);
|
|
|
|
|
|
this.SPECIFICATIONSAfterSet(e);
|
|
|
|
|
|
//if (Cargoinfodata.codeandname!="0203290090_其他冻藏猪肉" ){
|
|
|
// //alert("只有HS代码为0203290090的商品才能修改规格");
|
|
|
// e.record.set('SPECIFICATIONS','');
|
|
|
// }
|
|
|
//20131017 以下改变前台显示的税率
|
|
|
e.record.set('tariff', Cargoinfodata.tariff);
|
|
|
e.record.set('tax', Cargoinfodata.tax);
|
|
|
e.record.set('tax_zz', Cargoinfodata.tax_zz);
|
|
|
e.record.set('tax_cl', Cargoinfodata.tax_cl);
|
|
|
if (e.value!=e.originalValue){
|
|
|
e.record.set('cargociq_id', '');
|
|
|
e.record.set('ciqcodeandname', '');
|
|
|
}
|
|
|
} else {
|
|
|
e.record.set('cicodeandname', '');
|
|
|
e.record.set('SPECIFICATIONS','');
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (e.field == 'cargociq_id') {
|
|
|
var Cargociqrecords = DsStoreQueryBy(this.storeCargociq, 'id', e.value);
|
|
|
if (Cargociqrecords.getCount() > 0) {
|
|
|
var Cargociqdata = Cargociqrecords.getAt(0).data;
|
|
|
e.record.set('ciqcodeandname', Cargociqdata.codeandname);
|
|
|
} else {
|
|
|
e.record.set('ciqcodeandname', '');
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (e.field == 'Exchangerate' && e.record.get('Exchangerate_Customs') == 0) {
|
|
|
e.record.set('Exchangerate_Customs', parseFloat(e.record.get('Exchangerate')))
|
|
|
}
|
|
|
|
|
|
if (e.field == 'Unit') {
|
|
|
function decimal(num, v) {
|
|
|
var vv = Math.pow(10, v);
|
|
|
return Math.round(num * vv) / vv;
|
|
|
}
|
|
|
var U_weight = parseFloat(e.record.get('U_weight'));
|
|
|
|
|
|
var Unitrecords = DsStoreQueryBy(this.storeUnit, 'EnumValueId', e.value);
|
|
|
if (Unitrecords.getCount() > 0) {
|
|
|
var Unitdata = Unitrecords.getAt(0).data;
|
|
|
e.record.set('UnitRef', Unitdata.EnumValueName);
|
|
|
if (Unitdata.EnumValueName == '磅') {
|
|
|
e.record.set('UnitRate', '0.4535970244035199');
|
|
|
var weight = decimal(U_weight * 0.4535970244035199, 2);
|
|
|
e.record.set('weight', weight);
|
|
|
}
|
|
|
if (Unitdata.EnumValueName == '吨') {
|
|
|
e.record.set('UnitRate', '1000');
|
|
|
var weight = decimal(U_weight * 1000, 2);
|
|
|
e.record.set('weight', weight);
|
|
|
}
|
|
|
if (Unitdata.EnumValueName == 'KG') {
|
|
|
e.record.set('UnitRate', '1');
|
|
|
var weight = decimal(U_weight, 2);
|
|
|
e.record.set('weight', weight);
|
|
|
}
|
|
|
|
|
|
var price = parseFloat(e.record.get('price'));
|
|
|
var price_agio = parseFloat(e.record.get('price_agio'));
|
|
|
var price_limit = parseFloat(e.record.get('price_limit'));
|
|
|
var baolv = parseFloat(e.record.get('baolv'));
|
|
|
var amount = decimal(weight * price, 2);
|
|
|
if (price_limit != 0 && price_limit > (price - price_agio)) {
|
|
|
var tax_amount = decimal(price_limit * weight * baolv, 2);
|
|
|
} else {
|
|
|
var tax_amount = decimal((price - price_agio) * weight * baolv, 2);
|
|
|
}
|
|
|
var pay_amount = decimal((price - price_agio) * weight, 2);
|
|
|
|
|
|
e.record.set('Amount', amount);
|
|
|
e.record.set('tax_Amount', tax_amount);
|
|
|
e.record.set('pay_Amount', pay_amount);
|
|
|
} else {
|
|
|
e.record.set('UnitRef', '');
|
|
|
e.record.set('UnitRate', '1');
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (e.field == 'U_weight') {
|
|
|
function decimal(num, v) {
|
|
|
var vv = Math.pow(10, v);
|
|
|
return Math.round(num * vv) / vv;
|
|
|
}
|
|
|
var U_weight = parseFloat(e.record.get('U_weight'));
|
|
|
var U_PRICE = parseFloat(e.record.get('U_PRICE'));
|
|
|
var UnitRate = parseFloat(e.record.get('UnitRate'));
|
|
|
|
|
|
var weight = decimal(U_weight * UnitRate, 2);
|
|
|
e.record.set('weight', weight);
|
|
|
|
|
|
var price = decimal(U_PRICE / UnitRate, 4);
|
|
|
e.record.set('price', price);
|
|
|
var price_agio = parseFloat(e.record.get('price_agio'));
|
|
|
var price_limit = parseFloat(e.record.get('price_limit'));
|
|
|
var baolv = parseFloat(e.record.get('baolv'));
|
|
|
|
|
|
var amount = decimal(U_weight * U_PRICE, 2);
|
|
|
|
|
|
var UNIT= e.record.get('UnitRef');
|
|
|
if ((UNIT=='磅')&&(price_agio==0)) {
|
|
|
if (price_limit != 0 && price_limit > (price)) {
|
|
|
var tax_amount = decimal(price_limit * weight * baolv, 2);
|
|
|
} else {
|
|
|
var tax_amount = decimal(U_weight * U_PRICE * baolv, 2);
|
|
|
}
|
|
|
var pay_amount = decimal(U_weight * U_PRICE, 2);
|
|
|
}else{
|
|
|
if (price_limit != 0 && price_limit > (price - price_agio)) {
|
|
|
var tax_amount = decimal(price_limit * weight * baolv, 2);
|
|
|
} else {
|
|
|
var tax_amount = decimal((price - price_agio) * weight * baolv, 2);
|
|
|
}
|
|
|
var pay_amount = decimal((price - price_agio) * weight, 2);
|
|
|
}
|
|
|
e.record.set('Amount', amount);
|
|
|
e.record.set('tax_Amount', tax_amount);
|
|
|
e.record.set('pay_Amount', pay_amount);
|
|
|
}
|
|
|
|
|
|
if (e.field == 'U_PRICE') {
|
|
|
function decimal(num, v) {
|
|
|
var vv = Math.pow(10, v);
|
|
|
return Math.round(num * vv) / vv;
|
|
|
}
|
|
|
var U_weight = parseFloat(e.record.get('U_weight'));
|
|
|
var U_PRICE = parseFloat(e.record.get('U_PRICE'));
|
|
|
var UnitRate = parseFloat(e.record.get('UnitRate'));
|
|
|
|
|
|
var weight = e.record.get('weight');
|
|
|
//e.record.set('weight', weight);
|
|
|
|
|
|
var price = decimal(U_PRICE / UnitRate, 4);
|
|
|
e.record.set('price', price);
|
|
|
var price_agio = parseFloat(e.record.get('price_agio'));
|
|
|
var price_limit = parseFloat(e.record.get('price_limit'));
|
|
|
var baolv = parseFloat(e.record.get('baolv'));
|
|
|
|
|
|
var amount = decimal(U_weight * U_PRICE, 2);
|
|
|
|
|
|
var UNIT= e.record.get('UnitRef');
|
|
|
if ((UNIT=='磅')&&(price_agio==0)) {
|
|
|
if (price_limit != 0 && price_limit > (price)) {
|
|
|
var tax_amount = decimal(price_limit * weight * baolv, 2);
|
|
|
} else {
|
|
|
var tax_amount = decimal(U_weight * U_PRICE * baolv, 2);
|
|
|
}
|
|
|
var pay_amount = decimal(U_weight * U_PRICE, 2);
|
|
|
}else{
|
|
|
if (price_limit != 0 && price_limit > (price - price_agio)) {
|
|
|
var tax_amount = decimal(price_limit * weight * baolv, 2);
|
|
|
} else {
|
|
|
var tax_amount = decimal((price - price_agio) * weight * baolv, 2);
|
|
|
}
|
|
|
var pay_amount = decimal((price - price_agio) * weight, 2);
|
|
|
}
|
|
|
e.record.set('Amount', amount);
|
|
|
e.record.set('tax_Amount', tax_amount);
|
|
|
e.record.set('pay_Amount', pay_amount);
|
|
|
}
|
|
|
|
|
|
if (e.field == 'currid') {
|
|
|
//alert(e.field);
|
|
|
var currrecords = DsStoreQueryBy(this.storecurr, 'gid', e.value);
|
|
|
if (currrecords.getCount() > 0) {
|
|
|
var currdata = currrecords.getAt(0).data;
|
|
|
|
|
|
var curr = DsStoreQueryBy(this.storecurrQZ, 'CURR', currdata.codename);
|
|
|
if (curr.getCount() > 0) {
|
|
|
var _curr= curr.getAt(0).data;
|
|
|
e.record.set('codename', currdata.codename);
|
|
|
e.record.set('Exchangerate', _curr.DEFRATE);
|
|
|
}else
|
|
|
{
|
|
|
e.record.set('codename', currdata.codename);
|
|
|
e.record.set('Exchangerate', currdata.defaultrate);
|
|
|
}
|
|
|
} else {
|
|
|
e.record.set('codename', '');
|
|
|
}
|
|
|
|
|
|
/*
|
|
|
var currrecords = DsStoreQueryBy(this.storecurr, 'GID', e.value);
|
|
|
if (currrecords.getCount() > 0) {
|
|
|
var currdata = currrecords.getAt(0).data;
|
|
|
e.record.set('codename', currdata.CURR);
|
|
|
e.record.set('Exchangerate', currdata.DEFRATE);
|
|
|
} else {
|
|
|
e.record.set('codename', '');
|
|
|
}*/
|
|
|
}
|
|
|
|
|
|
//price price_agio price_limit weight baolv
|
|
|
//单价 差价 估价 净重 保率
|
|
|
//amount tax_amount pax_amount
|
|
|
//合同金额 完税价格 购货价
|
|
|
if (e.field == 'price' || e.field == 'price_agio' || e.field == 'price_limit' || e.field == 'baolv'
|
|
|
|| e.field == 'weight'||e.field == 'Exchangerate'||e.field == 'Exchangerate_Customs') {
|
|
|
function decimal(num, v) {
|
|
|
var vv = Math.pow(10, v);
|
|
|
return Math.round(num * vv) / vv;
|
|
|
}
|
|
|
|
|
|
var UNIT= e.record.get('UnitRef');
|
|
|
if (UNIT!='磅') {
|
|
|
|
|
|
var price = parseFloat(e.record.get('price'));
|
|
|
var price_agio = parseFloat(e.record.get('price_agio'));
|
|
|
var price_limit = parseFloat(e.record.get('price_limit'));
|
|
|
var baolv = parseFloat(e.record.get('baolv'));
|
|
|
var weight = parseFloat(e.record.get('weight'));
|
|
|
|
|
|
if (price_agio==0){
|
|
|
var amount = decimal(weight * price, 2);}
|
|
|
else{amount = decimal(weight * price_agio, 2);}
|
|
|
|
|
|
if (price_limit != 0 && price_limit > price) {
|
|
|
var tax_amount = decimal(price_limit * weight * baolv, 2);
|
|
|
} else {
|
|
|
var tax_amount = decimal((price) * weight * baolv, 2);
|
|
|
}
|
|
|
var pay_amount = decimal(price * weight, 2);//贸易商价格x重量x单价
|
|
|
|
|
|
e.record.set('Amount', amount);
|
|
|
e.record.set('tax_Amount', tax_amount);
|
|
|
e.record.set('pay_Amount', pay_amount);
|
|
|
}else{
|
|
|
function decimal(num, v) {
|
|
|
var vv = Math.pow(10, v);
|
|
|
return Math.round(num * vv) / vv;
|
|
|
}
|
|
|
var U_weight = parseFloat(e.record.get('U_weight'));
|
|
|
var U_PRICE = parseFloat(e.record.get('U_PRICE'));
|
|
|
var UnitRate = parseFloat(e.record.get('UnitRate'));
|
|
|
|
|
|
var weight = decimal(U_weight * UnitRate, 2);
|
|
|
e.record.set('weight', weight);
|
|
|
|
|
|
var price = decimal(U_PRICE / UnitRate, 4);
|
|
|
e.record.set('price', price);
|
|
|
var price_agio = parseFloat(e.record.get('price_agio'));
|
|
|
var price_limit = parseFloat(e.record.get('price_limit'));
|
|
|
var baolv = parseFloat(e.record.get('baolv'));
|
|
|
|
|
|
var amount = decimal(U_weight * U_PRICE, 2);
|
|
|
|
|
|
var UNIT= e.record.get('UnitRef');
|
|
|
if ((UNIT=='磅')&&(price_agio==0)) {
|
|
|
if (price_limit != 0 && price_limit > (price)) {
|
|
|
var tax_amount = decimal(price_limit * weight * baolv, 2);
|
|
|
} else {
|
|
|
var tax_amount = decimal(U_weight * U_PRICE * baolv, 2);
|
|
|
}
|
|
|
var pay_amount = decimal(U_weight * U_PRICE, 2);
|
|
|
}else{
|
|
|
if (price_limit != 0 && price_limit > (price - price_agio)) {
|
|
|
var tax_amount = decimal(price_limit * weight * baolv, 2);
|
|
|
} else {
|
|
|
var tax_amount = decimal((price - price_agio) * weight * baolv, 2);
|
|
|
}
|
|
|
var pay_amount = decimal((price - price_agio) * weight, 2);
|
|
|
}
|
|
|
e.record.set('Amount', amount);
|
|
|
e.record.set('tax_Amount', tax_amount);
|
|
|
e.record.set('pay_Amount', pay_amount);
|
|
|
|
|
|
amount=parseFloat(e.record.get('Amount'));
|
|
|
tax_amount=parseFloat(e.record.get('tax_Amount'));
|
|
|
pay_amount=parseFloat(e.record.get('pay_Amount'));
|
|
|
}
|
|
|
//if (amount>tax_amount){tax_amount=amount;}//确保tax_amount为给客户显示并使用的完税价格
|
|
|
var tax = e.record.get('tax')
|
|
|
var tax_zz = e.record.get('tax_zz')
|
|
|
var Exchangerate_Customs = e.record.get('Exchangerate_Customs')
|
|
|
|
|
|
var HS = e.record.get('cicode');
|
|
|
var isChicken = false;
|
|
|
var ChickenTax = parseFloat('0.0');
|
|
|
if (HS == '0207142100' || HS == '0207142200' || HS == '0207142900') {
|
|
|
isChicken = true;
|
|
|
if (HS == '0207142100') {
|
|
|
ChickenTax = parseFloat('0.8');
|
|
|
} else if (HS == '0207142200') {
|
|
|
ChickenTax = parseFloat('1.0');
|
|
|
} else if (HS == '0207142900') {
|
|
|
ChickenTax = parseFloat('1.3');
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (isChicken) {
|
|
|
|
|
|
var priceandtax = parseFloat(decimal(tax_amount * Exchangerate_Customs,2) + decimal(weight * ChickenTax,2));
|
|
|
|
|
|
var tax_1 = round2(weight * ChickenTax,2);
|
|
|
var tax_zz_1 = round2(priceandtax * parseFloat(tax_zz),2);
|
|
|
var tax_2 = tax_1;
|
|
|
var tax_zz_2 = tax_zz_1;
|
|
|
|
|
|
} else {
|
|
|
var priceandtax = tax_amount * (1.0 + tax);
|
|
|
|
|
|
//应付的
|
|
|
var tax_2 = round2(tax_amount * tax * Exchangerate_Customs,2); //关税
|
|
|
var tax_zz_2 = round2(tax_amount * (1.0 + tax) * tax_zz * Exchangerate_Customs,2); //增值税
|
|
|
|
|
|
//向客户收取的
|
|
|
if (tax_amount > amount) {
|
|
|
var tax_1 = round2(tax_amount * tax * Exchangerate_Customs,2); //关税
|
|
|
var tax_zz_1 = round2(tax_amount * (1.0 + tax) * tax_zz * Exchangerate_Customs,2); //增值税
|
|
|
} else {
|
|
|
var tax_1 = round2(amount * tax * Exchangerate_Customs,2); //关税
|
|
|
var tax_zz_1 = round2(amount * (1.0 + tax) * tax_zz * Exchangerate_Customs,2); //增值税
|
|
|
}
|
|
|
}
|
|
|
|
|
|
e.record.set('tax_1', tax_1);
|
|
|
e.record.set('tax_zz_1', tax_zz_1);
|
|
|
e.record.set('tax_2', tax_2);
|
|
|
e.record.set('tax_zz_2', tax_zz_2);
|
|
|
|
|
|
var prepayments = round2(parseFloat( e.record.get('prepayments')),2);
|
|
|
var balance = amount - prepayments;
|
|
|
e.record.set('balance', balance);
|
|
|
}
|
|
|
|
|
|
if (e.field == 'prepayments'||e.field == 'Amount') {
|
|
|
//alert(e.field);
|
|
|
var prepayments = e.record.get('prepayments');
|
|
|
var Amount = e.record.get('Amount');
|
|
|
var balance = Amount - prepayments;
|
|
|
e.record.set('balance', balance);
|
|
|
}
|
|
|
|
|
|
if (e.field == 'PreProportion') {
|
|
|
//alert(e.field);
|
|
|
var Amount =parseFloat(e.record.get('Amount'));
|
|
|
var prepayments = round2(Amount*parseFloat(e.record.get('PreProportion'))*0.01,2);
|
|
|
var balance = Amount - prepayments;
|
|
|
e.record.set('pay_prepayments', prepayments);
|
|
|
e.record.set('pay_balance', balance);
|
|
|
}
|
|
|
if (e.field == 'RecProportion') {
|
|
|
//alert(e.field);
|
|
|
var Amount = parseFloat(e.record.get('Amount'));
|
|
|
var prepayments = round2(Amount * parseFloat(e.record.get('RecProportion')) * 0.01, 2);
|
|
|
var balance = Amount - prepayments;
|
|
|
e.record.set('prepayments', prepayments);
|
|
|
e.record.set('balance', balance);
|
|
|
}
|
|
|
|
|
|
|
|
|
if (e.field == 'name') {
|
|
|
var CargoNamerecords = DsStoreQueryBy(this.storeCargoName, 'CNNAME', e.value);
|
|
|
if (CargoNamerecords.getCount() > 0) {
|
|
|
|
|
|
|
|
|
var _CNRec = CargoNamerecords.getAt(0).data;
|
|
|
//1 载入Ename
|
|
|
this.storeCargoName_EN.load({ params: {
|
|
|
start: 0, limit: 5000, sort: '',
|
|
|
condition: " CNNAME='"+e.value+"'"}
|
|
|
});
|
|
|
|
|
|
//2 载入HS代码
|
|
|
var FactoryNo = e.record.get('FactoryNo');
|
|
|
var name = e.record.get('name');
|
|
|
if ((FactoryNo=="" || FactoryNo==null)&&(name!="" && name!=null)){
|
|
|
//如果没选厂号 选了中文品名
|
|
|
//根据品名确定范围
|
|
|
var s=" countryid='"+this.formEdit.getForm().findField('countryid').getValue()+"'";
|
|
|
|
|
|
s=s+" and ci.id in(select hs_id from Import_Cargoname where CNNAME='"+name+"')"
|
|
|
this.storeCargoinfo.load({ params: { condition: s}
|
|
|
,
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
if (_this.storeCargoinfo.getCount()==1){
|
|
|
var rec = _this.storeCargoinfo.getAt(0).data;
|
|
|
e.record.set('cargoinfo_id', rec.id);
|
|
|
e.record.set('cicodeandname', rec.codeandname);
|
|
|
e.record.set('cargociq_id', _CNRec.CIQ_ID);
|
|
|
e.record.set('ciqcodeandname', _CNRec.CIQREF);
|
|
|
e.record.set('tariff', rec.tariff);
|
|
|
e.record.set('tax', rec.tax);
|
|
|
e.record.set('tax_zz', rec.tax_zz);
|
|
|
e.record.set('CargoType', _CNRec.CARGOTYPE);
|
|
|
e.record.set('Ename', _CNRec.ENNAME);
|
|
|
}
|
|
|
} else {
|
|
|
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
});
|
|
|
}
|
|
|
if ((FactoryNo!="" && FactoryNo!=null)&&(name!="" && name!=null)){
|
|
|
//如果选了厂号 选了中文品名
|
|
|
//根据厂号和品名确定范围
|
|
|
var s=" countryid='"+this.formEdit.getForm().findField('countryid').getValue()+"'";
|
|
|
|
|
|
s=s+" and ci.id in(select hs_id from Import_Cargoname where CNNAME='"+name+"' and FactoryNoGID in(select GID from Import_Factoryno where FactoryNo='"+FactoryNo+"')) "
|
|
|
this.storeCargoinfo.load({ params: { condition: s}
|
|
|
,
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
if (_this.storeCargoinfo.getCount()==1){
|
|
|
var rec = _this.storeCargoinfo.getAt(0).data;
|
|
|
e.record.set('cargoinfo_id', rec.id);
|
|
|
e.record.set('cicodeandname', rec.codeandname);
|
|
|
e.record.set('cargociq_id', _CNRec.CIQ_ID);
|
|
|
e.record.set('ciqcodeandname', _CNRec.CIQREF);
|
|
|
e.record.set('tariff', rec.tariff);
|
|
|
e.record.set('tax', rec.tax);
|
|
|
e.record.set('tax_zz', rec.tax_zz);
|
|
|
e.record.set('CargoType', _CNRec.CARGOTYPE);
|
|
|
e.record.set('Ename', _CNRec.ENNAME);
|
|
|
}
|
|
|
} else {
|
|
|
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
});
|
|
|
}
|
|
|
} else {
|
|
|
//e.record.set('Ename', '');
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (e.field == 'FactoryNo') {
|
|
|
var FactoryNo = e.record.get('FactoryNo');
|
|
|
var name = e.record.get('name');
|
|
|
|
|
|
if ((FactoryNo!="" && FactoryNo!=null)&&(name!="" && name!=null)){
|
|
|
//如果选了厂号 选了中文品名
|
|
|
//根据厂号和品名确定范围
|
|
|
var s=" countryid='"+this.formEdit.getForm().findField('countryid').getValue()+"'";
|
|
|
|
|
|
s=s+" and ci.id in(select hs_id from Import_Cargoname where CNNAME='"+name+"' and FactoryNoGID in(select GID from Import_Factoryno where FactoryNo='"+FactoryNo+"')) "
|
|
|
|
|
|
this.storeCargoinfo.load({ params: { condition: s}
|
|
|
,
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
if (_this.storeCargoinfo.getCount()==1){
|
|
|
var rec = _this.storeCargoinfo.getAt(0).data;
|
|
|
e.record.set('cargoinfo_id', rec.id);
|
|
|
e.record.set('cicodeandname', rec.codeandname);
|
|
|
e.record.set('cargociq_id', _CNRec.CIQ_ID);
|
|
|
e.record.set('ciqcodeandname', _CNRec.CIQREF);
|
|
|
e.record.set('tariff', rec.tariff);
|
|
|
e.record.set('tax', rec.tax);
|
|
|
e.record.set('tax_zz', rec.tax_zz);
|
|
|
e.record.set('CargoType', _CNRec.CARGOTYPE);
|
|
|
e.record.set('Ename', _CNRec.ENNAME);
|
|
|
}
|
|
|
} else {
|
|
|
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
|
|
|
},
|
|
|
/////////////明细表<<<商品>>>的相关方法
|
|
|
|
|
|
////////<<<许可证使用>>>明细表相关方法
|
|
|
onAddAppstateClick: function (button, event) {
|
|
|
var record = Ext.create('Appstatemb', {
|
|
|
'id': '',
|
|
|
'appno': '',
|
|
|
'cargoinfo_id': '',
|
|
|
'app_id': '',
|
|
|
'name': ' ',
|
|
|
'cargo_id': ' ',
|
|
|
'cargoname': ' ',
|
|
|
'appweight': '0 ',
|
|
|
'appremain': ' ',
|
|
|
'country': ' ',
|
|
|
'ValidDate': '',
|
|
|
'weight': '',
|
|
|
'info': ''
|
|
|
});
|
|
|
this.storeAppstate.add(record);
|
|
|
|
|
|
var n = this.storeAppstate.getCount();
|
|
|
this.cellEditingAppstate.startEditByPosition({ row: n - 1, column: 4 });
|
|
|
},
|
|
|
|
|
|
onDelAppstateClick: function (button, event) {
|
|
|
var selectedRecords = this.formAppstate.selModel.getSelection();
|
|
|
|
|
|
for (var i = 0; i < selectedRecords.length; i++) {
|
|
|
var rec = selectedRecords[i];
|
|
|
// alert(rec.ContractNo);
|
|
|
if (rec.ContractNo != "" || rec.ContractNo != "*") //如果是新增但没有保存的数据,没有必要提交到后台
|
|
|
{
|
|
|
this.AppstateDel.push(rec);
|
|
|
}
|
|
|
//alert(i);
|
|
|
this.storeAppstate.remove(selectedRecords[i]);
|
|
|
}
|
|
|
},
|
|
|
AppstateAfterEdit: function (editor, e, eOpts) {
|
|
|
//需要自己实现里面的事件
|
|
|
|
|
|
if (e.field == 'app_id') {
|
|
|
var apprecords = DsStoreQueryBy(this.storeApp, 'app_id', e.value);
|
|
|
if (apprecords.getCount() > 0) {
|
|
|
var appdata = apprecords.getAt(0).data;
|
|
|
e.record.set('app_id', appdata.app_id);
|
|
|
e.record.set('appno', appdata.appno);
|
|
|
e.record.set('name', appdata.name);
|
|
|
e.record.set('appweight', appdata.appweight);
|
|
|
e.record.set('appremain', appdata.appremain);
|
|
|
e.record.set('country', appdata.country);
|
|
|
e.record.set('ValidDate', appdata.ValidDate);
|
|
|
} else {
|
|
|
e.record.set('name', ' ');
|
|
|
e.record.set('appweight', ' ');
|
|
|
e.record.set('appremain', ' ');
|
|
|
e.record.set('country', ' ');
|
|
|
e.record.set('ValidDate', ' ');
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (e.field == 'cargo_id') {
|
|
|
var cargo = DsStoreQueryBy(this.storeCargo, 'id', e.value);
|
|
|
if (cargo.getCount() > 0) {
|
|
|
var cargodata = cargo.getAt(0).data;
|
|
|
e.record.set('cargo_id',cargodata.id);
|
|
|
e.record.set('cargoname', cargodata.name);
|
|
|
//alert(e.record.get('cargo_id'));
|
|
|
} else {
|
|
|
//alert(cargodata.name);
|
|
|
e.record.set('cargoname', ' ');
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (e.field == 'cancellation') {
|
|
|
var cancellationrecords = DsStoreQueryBy(this.storecancellation, 'EnumValueId', e.value);
|
|
|
if (cancellationrecords.getCount() > 0) {
|
|
|
var cancellationdata = cancellationrecords.getAt(0).data;
|
|
|
e.record.set('cancellationRef', cancellationdata.EnumValueName);
|
|
|
} else {
|
|
|
e.record.set('cancellationRef', '');
|
|
|
}
|
|
|
}
|
|
|
|
|
|
},
|
|
|
//-------------明细表<<<许可证使用>>>的相关方法 over
|
|
|
|
|
|
////////<<<库存记录>>>明细表相关方法
|
|
|
onAddKCClick: function (button, event) {
|
|
|
var record = Ext.create('Appstatemb', {
|
|
|
'id': '',
|
|
|
'ContractNo': '',
|
|
|
'cargo_id': '',
|
|
|
'name': '',
|
|
|
'czstate': ' ',
|
|
|
'innum': '0',
|
|
|
'outnum': '0',
|
|
|
'kfstate': ' ',
|
|
|
'czdate': ' ',
|
|
|
'text': ' ',
|
|
|
'czref': ' ',
|
|
|
'kfref': ' '
|
|
|
});
|
|
|
this.storeKC.add(record);
|
|
|
|
|
|
var n = this.storeKC.getCount();
|
|
|
this.cellEditingKC.startEditByPosition({ row: n - 1, column: 4 });
|
|
|
},
|
|
|
|
|
|
onDelKCClick: function (button, event) {
|
|
|
var selectedRecords = this.formKC.selModel.getSelection();
|
|
|
|
|
|
for (var i = 0; i < selectedRecords.length; i++) {
|
|
|
var rec = selectedRecords[i];
|
|
|
// alert(rec.ContractNo);
|
|
|
if (rec.ContractNo != "" || rec.ContractNo != "*") //如果是新增但没有保存的数据,没有必要提交到后台
|
|
|
{
|
|
|
this.KCDel.push(rec);
|
|
|
}
|
|
|
//alert(i);
|
|
|
this.storeKC.remove(selectedRecords[i]);
|
|
|
}
|
|
|
},
|
|
|
KCAfterEdit: function (editor, e, eOpts) {
|
|
|
if (e.field == 'czstate') {
|
|
|
var czstaterecords = DsStoreQueryBy(this.storeczstate, 'EnumValueId', e.value);
|
|
|
if (czstaterecords.getCount() > 0) {
|
|
|
var czstatedata = czstaterecords.getAt(0).data;
|
|
|
e.record.set('czref', czstatedata.EnumValueName);
|
|
|
} else {
|
|
|
e.record.set('czref', '');
|
|
|
}
|
|
|
}
|
|
|
if (e.field == 'kfstate') {
|
|
|
var kfstaterecords = DsStoreQueryBy(this.storekfstate, 'EnumValueId', e.value);
|
|
|
if (kfstaterecords.getCount() > 0) {
|
|
|
var kfstatedata = kfstaterecords.getAt(0).data;
|
|
|
e.record.set('kfref', kfstatedata.EnumValueName);
|
|
|
} else {
|
|
|
e.record.set('kfref', '');
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (e.field == 'cargo_id') {
|
|
|
var cargo = DsStoreQueryBy(this.storeCargo, 'id', e.value);
|
|
|
if (cargo.getCount() > 0) {
|
|
|
var cargodata = cargo.getAt(0).data;
|
|
|
e.record.set('cargo_id',cargodata.id);
|
|
|
e.record.set('cargoname', cargodata.name);
|
|
|
//alert(e.record.get('cargo_id'));
|
|
|
} else {
|
|
|
//alert(cargodata.name);
|
|
|
e.record.set('cargoname', ' ');
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
},
|
|
|
///-------------明细表<<<库存记录>>>的相关方法 over
|
|
|
|
|
|
//单据表 明细表相关方法
|
|
|
onAddReceiptClick: function (button, event) {
|
|
|
this.addDetail();
|
|
|
}, //end onAddDetailClick
|
|
|
|
|
|
onDelReceiptClick: function (button, event) {
|
|
|
this.deleteDetail();
|
|
|
}, //onDelDetailClick
|
|
|
ReceiptAfterEdit: function (editor, e, eOpts) {
|
|
|
//需要自己实现里面的事件
|
|
|
if (e.field == 'Receiptid') {
|
|
|
var Receiptrecords = DsStoreQueryBy(this.storeReceiptid, 'EnumValueId', e.value);
|
|
|
if (Receiptrecords.getCount() > 0) {
|
|
|
var Receiptdata = Receiptrecords.getAt(0).data;
|
|
|
e.record.set('ReceiptName', Receiptdata.EnumValueName);
|
|
|
} else {
|
|
|
e.record.set('ReceiptName', '');
|
|
|
}
|
|
|
}
|
|
|
if (e.field == 'state') {
|
|
|
var staterecords = DsStoreQueryBy(this.storeReceiptstate, 'EnumValueId', e.value);
|
|
|
if (staterecords.getCount() > 0) {
|
|
|
var statedata = staterecords.getAt(0).data;
|
|
|
e.record.set('statename', statedata.EnumValueName);
|
|
|
} else {
|
|
|
e.record.set('statename', '');
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
addDetail: function () {
|
|
|
|
|
|
// var newSerialno = DsGetNewSerialNo(this.storeBodyList, this.serialNo);
|
|
|
// this.serialNo = newSerialno;
|
|
|
var record = Ext.create('Receiptmb', {
|
|
|
'id': '',
|
|
|
'ContractNo': '',
|
|
|
'Receiptid': '0',
|
|
|
'ReceiptName': '',
|
|
|
'ReceiptNo': '',
|
|
|
'state': '0',
|
|
|
'Send_date': '',
|
|
|
'receive_date': '',
|
|
|
'repeat_date': '',
|
|
|
'trancer': '',
|
|
|
'trancNo': ''
|
|
|
});
|
|
|
|
|
|
this.storeReceipt.add(record);
|
|
|
|
|
|
var n = this.storeReceipt.getCount();
|
|
|
this.cellEditingReceipt.startEditByPosition({ row: n - 1, column: 4 });
|
|
|
},
|
|
|
|
|
|
deleteDetail: function () {
|
|
|
var selectedRecords = this.gridListReceipt.selModel.getSelection();
|
|
|
|
|
|
for (var i = 0; i < selectedRecords.length; i++) {
|
|
|
var rec = selectedRecords[i];
|
|
|
// alert(rec.ContractNo);
|
|
|
if (rec.ContractNo != "" || rec.ContractNo != "*") //如果是新增但没有保存的数据,没有必要提交到后台
|
|
|
{
|
|
|
this.bodyDel.push(rec);
|
|
|
}
|
|
|
//alert(i);
|
|
|
this.storeReceipt.remove(selectedRecords[i]);
|
|
|
}
|
|
|
},
|
|
|
//end 单据表 明细表相关方法
|
|
|
|
|
|
// 明细表 <<<<<<<<<<<<<费用表相关方法
|
|
|
onAddDetailClick: function (button, event, type) {
|
|
|
var allow = this.getAllowOperationDetail();
|
|
|
if (allow == false) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
var store = null;
|
|
|
if (type == 1) {
|
|
|
store = this.storeBodyFix;
|
|
|
} else if (type == 2) {
|
|
|
store = this.storeBodyChFee;
|
|
|
} else {
|
|
|
alert('函数(onAddDetailClick)的参数type类型设置的不对');
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
var newSerialno = this.GetHandleSerialNo(store, type);
|
|
|
|
|
|
var record = null;
|
|
|
if (type == 1) {
|
|
|
record = Ext.create('MsWlPcFixed', {
|
|
|
GId: NewGuid(),
|
|
|
BillNo: '*',
|
|
|
SerialNo: newSerialno,
|
|
|
FeeStatus: 1,
|
|
|
FeeStatus_Ref: '录入状态',
|
|
|
AuditStatus: 0,
|
|
|
CreditDebit: "2",
|
|
|
CreditDebit_Ref: "应付",
|
|
|
FeeTypeCode: '',
|
|
|
FeeTypeCode_Ref: '',
|
|
|
FeeTypeName: '',
|
|
|
DistCount: 0,
|
|
|
Price: 0,
|
|
|
FsTotal: 0,
|
|
|
JsTotal: 0,
|
|
|
Remark: ''
|
|
|
});
|
|
|
|
|
|
} else if (type == 2) {//////////////////////
|
|
|
record = Ext.create('MsChFee', {
|
|
|
GId: NewGuid(),
|
|
|
BsNo: '*',
|
|
|
FeeStatus: 1,
|
|
|
FeeStatus_Ref: '录入状态',
|
|
|
FeeType: 1,
|
|
|
FeeType_Ref: '应收',
|
|
|
FeeName: '',
|
|
|
FeeName_Ref: '',
|
|
|
FeeDescription: '',
|
|
|
CustomerType: '',
|
|
|
CustomerName: this.getCustName(),
|
|
|
CustomerName_Ref: '',
|
|
|
Unit: '',
|
|
|
UnitPrice: 0,
|
|
|
Quantity: 1,
|
|
|
Amount: 0,
|
|
|
Currency: 'RMB',
|
|
|
ExChangerate: 1,
|
|
|
Reason: '',
|
|
|
Remark: '',
|
|
|
Commissionrate: 0,
|
|
|
Settlement: 0,
|
|
|
Invoice: 0,
|
|
|
OrderAmount: 0,
|
|
|
OrderInvoice: 0,
|
|
|
SubmitDate: null,
|
|
|
Auditoperator: '',
|
|
|
AuditDate: null,
|
|
|
EnteroPerator: GetCookie_UserId(),
|
|
|
EnterDate: null,
|
|
|
DebitNo: '',
|
|
|
IsDebit: "0",
|
|
|
IsOpen: "0",
|
|
|
IsAdvancedpay: "0",
|
|
|
Sort: "0",
|
|
|
IsInvoice: "0",
|
|
|
FeeFrt: '',
|
|
|
IsCrmOrderFee: "0",
|
|
|
AuditStatus: 0,
|
|
|
InvoiceNum: '',
|
|
|
ChequeNum: '',
|
|
|
WmsOutBsNo: ''
|
|
|
});
|
|
|
}
|
|
|
|
|
|
store.add(record);
|
|
|
|
|
|
var editColumnIndex = 0;
|
|
|
var cellediting = null;
|
|
|
if (type == 1) {
|
|
|
cellediting = this.cellEditingFix;
|
|
|
editColumnIndex = 2;
|
|
|
} else if (type == 2) {
|
|
|
cellediting = this.cellEditingChFee;
|
|
|
editColumnIndex = 4;
|
|
|
}
|
|
|
var n = store.getCount();
|
|
|
cellediting.startEditByPosition({ row: n - 1, column: editColumnIndex });
|
|
|
},
|
|
|
|
|
|
GetHandleSerialNo: function (store, type) {
|
|
|
var result = 0;
|
|
|
if (type == 1) {
|
|
|
result = this.fixSerialNo;
|
|
|
} else if (type == 2) {
|
|
|
result = this.feeSerialNo;
|
|
|
}
|
|
|
|
|
|
if (result == 0) {
|
|
|
for (var i = 0; i < store.getCount(); i += 1) {
|
|
|
var member = store.getAt(i);
|
|
|
if (member.data.SerialNo > result) {
|
|
|
result = member.data.SerialNo;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
result = result + 1;
|
|
|
if (type == 1) {
|
|
|
this.fixSerialNo = result;
|
|
|
} else if (type == 2) {
|
|
|
this.feeSerialNo = result;
|
|
|
}
|
|
|
return result;
|
|
|
},
|
|
|
|
|
|
onDelDetailClick: function (button, event, type) {
|
|
|
var allow = this.getAllowOperationDetail();
|
|
|
if (allow == false) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
var store = null;
|
|
|
if (type == 1) {
|
|
|
store = this.storeBodyFix;
|
|
|
} else if (type == 2) {
|
|
|
store = this.storeBodyChFee;
|
|
|
} else {
|
|
|
alert('函数(onAddDetailClick)的参数type类型设置的不对');
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
var result = 0;
|
|
|
if (type == '1') {
|
|
|
result = this.fixSerialNo;
|
|
|
} else if (type == '2') {
|
|
|
result = this.feeSerialNo;
|
|
|
}
|
|
|
|
|
|
if (result == 0) {
|
|
|
for (var i = 0; i < store.getCount(); i += 1) {
|
|
|
var member = store.getAt(i);
|
|
|
if (member.data.SerialNo > this.giSerialNo) {
|
|
|
result = member.data.SerialNo;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (type == '1') {
|
|
|
this.fixSerialNo = result;
|
|
|
} else if (type == '2') {
|
|
|
this.feeSerialNo = result;
|
|
|
}
|
|
|
|
|
|
var selectedRecords = [];
|
|
|
if (type == '1') {
|
|
|
selectedRecords = this.gridListFix.selModel.getSelection();
|
|
|
} else if (type == '2') {
|
|
|
selectedRecords = this.gridListChFee.selModel.getSelection();
|
|
|
var candelete = DsTruck.CheckChFeeDelete(selectedRecords);
|
|
|
if (candelete == false)
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if (selectedRecords.length > 0) {
|
|
|
for (var i = 0; i < selectedRecords.length; i++) {
|
|
|
var rec = selectedRecords[i];
|
|
|
if (rec.BillNo != "" || rec.BillNo != "*") //如果是新增但没有保存的数据,没有必要提交到后台
|
|
|
{
|
|
|
if (type == '1') {
|
|
|
this.fixBodyDel.push(rec);
|
|
|
} else if (type == '2') {
|
|
|
this.feeBodyDel.push(rec);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (type == '1') {
|
|
|
this.storeBodyFix.remove(selectedRecords[i]);
|
|
|
} else if (type == '2') {
|
|
|
this.storeBodyChFee.remove(selectedRecords[i]);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
|
|
|
onSubmitAuditClick: function (button, event) {
|
|
|
var records = this.feeGridCheckBoxModel.selected.items;
|
|
|
|
|
|
DsTruck.MsChFeeAudit(records, 2, '正在提交审核数据, 请稍侯..');
|
|
|
},
|
|
|
getCustName: function () {
|
|
|
var custName = this.formEdit.getForm().findField('buyer');
|
|
|
return custName.getValue();
|
|
|
},
|
|
|
|
|
|
|
|
|
getAllowOperationDetail: function () {
|
|
|
/* var feeStatus = this.getFeeStatus();
|
|
|
if (feeStatus == '0')
|
|
|
return true;
|
|
|
else {
|
|
|
Ext.Msg.show({ title: '错误', msg: "费用已锁定,不允许操作费用!", icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
|
|
|
return false;
|
|
|
}*/
|
|
|
return true;
|
|
|
},
|
|
|
getFeeStatus: function () {
|
|
|
//var basicForm = this.formEdit.getForm();
|
|
|
//var feeStatus = basicForm.findField('FeeStatus').value;
|
|
|
//return feeStatus;
|
|
|
return 0;
|
|
|
},
|
|
|
cellEditingChFeeBeforeEdit: function (editor, e) {
|
|
|
/*var chfeefeeStatus = e.record.get('FeeStatus');
|
|
|
var canedit = chfeefeeStatus == 1 || chfeefeeStatus == 6;
|
|
|
|
|
|
if (canedit) {
|
|
|
var feeStatus = this.getFeeStatus();
|
|
|
var billStatus = this.getBillStatus();
|
|
|
canedit = feeStatus == '0' && billStatus == '0';
|
|
|
}
|
|
|
|
|
|
return canedit;*/
|
|
|
return true;
|
|
|
},
|
|
|
gridListChFeeAfterEdit: function (editor, e, eOpts) {
|
|
|
|
|
|
if (e.field == 'FeeType') {
|
|
|
var records = DsStoreQueryBy(this.storeFeeTypeRef, 'EnumValueId', e.value);
|
|
|
|
|
|
if (records.getCount() > 0) {
|
|
|
var data = records.getAt(0).data;
|
|
|
e.record.set('FeeType_Ref', data.EnumValueName);
|
|
|
} else {
|
|
|
e.record.set('FeeType_Ref', '');
|
|
|
}
|
|
|
} else if (e.field = 'UnitPrice' || e.field == 'Quantity' || e.field == 'ExChangerate') {
|
|
|
var unitPrice = e.record.data['UnitPrice'];
|
|
|
var quantity = e.record.data['Quantity'];
|
|
|
var ExChangerate= e.record.data['ExChangerate'];
|
|
|
e.record.set('Amount', (unitPrice * quantity * ExChangerate).toFixed(2));
|
|
|
}
|
|
|
},
|
|
|
// 明细表 费用表相关方法 end
|
|
|
|
|
|
parentfunction: function (button, event) {
|
|
|
var ret1 = window.parent.opener.OprationSwap();
|
|
|
// alert(this.First);
|
|
|
ret1[3]();
|
|
|
},
|
|
|
|
|
|
setBaolv: function(field, newValue, oldValue){
|
|
|
if (newValue==0) {
|
|
|
this.storeCargo.each(function(record) {
|
|
|
//alert(record.get('baolv'));
|
|
|
record.set('baolv','1.0030');
|
|
|
});
|
|
|
}else{
|
|
|
this.storeCargo.each(function(record) {
|
|
|
//alert(record.get('baolv'));
|
|
|
record.set('baolv','1.0000');
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
|
|
|
InitData: function () {
|
|
|
|
|
|
this.opStatus = 'add';
|
|
|
var condition = '';
|
|
|
|
|
|
|
|
|
if (parentWin) {
|
|
|
var ret = parentWin.OprationSwap();
|
|
|
this.opStatus = ret[0];
|
|
|
this.StoreList = ret[1];
|
|
|
this.editRecord = ret[2];
|
|
|
// this.parentfunction = ret[3];
|
|
|
}
|
|
|
|
|
|
if (this.opStatus == 'edit' || this.opStatus == 'copyadd') {
|
|
|
condition = " m.id='" + this.editRecord.get('id') + "'";
|
|
|
this.storeChfeeFile.load({
|
|
|
params: {
|
|
|
BillNo: window.parent.opener.OprationSwap()[2].get('ContractNo')
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
|
|
|
this.LoadData(this.opStatus, condition);
|
|
|
|
|
|
}, //end InitData
|
|
|
|
|
|
//载入数据
|
|
|
LoadData: function (opstatus, condition)
|
|
|
{
|
|
|
if (opstatus == 'edit' || opstatus == "copyadd")
|
|
|
{
|
|
|
this.formEdit.getForm().setValues(this.editRecord.data);
|
|
|
|
|
|
}
|
|
|
|
|
|
this.opStatus = opstatus;
|
|
|
var opstatus1 = opstatus == "copyadd" ? "edit" : opstatus;
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在查询主表数据...',
|
|
|
url: '/Import/XXH/GetData',
|
|
|
params: {
|
|
|
handle: opstatus1,
|
|
|
condition: condition
|
|
|
},
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
var result = Ext.JSON.decode(response.responseText);
|
|
|
if (!result.Success) {
|
|
|
Ext.Msg.show({
|
|
|
title: '提示',
|
|
|
msg: result.Message,
|
|
|
icon: Ext.MessageBox.ERROR,
|
|
|
buttons: Ext.Msg.OK
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
var data = result.data;
|
|
|
// this.formEdit.getForm().reset();
|
|
|
if (data.creattime == "") { data.creattime = currdate.format('yyyy-MM-dd') };
|
|
|
if (data.creator == "") { data.creator = usercode };
|
|
|
|
|
|
if (data.ContractStatus=='True'){
|
|
|
data.ContractStatus='1';
|
|
|
}else{data.ContractStatus='0'};
|
|
|
|
|
|
if (data.HaveContract=='True'){
|
|
|
data.HaveContract='1';
|
|
|
}else{data.HaveContract='0'};
|
|
|
|
|
|
if (data.HaveCargoMark=='True'){
|
|
|
data.HaveCargoMark='1';
|
|
|
}else{data.HaveCargoMark='0'};
|
|
|
|
|
|
if(data.cgid==""){
|
|
|
data.cgid="0";
|
|
|
}
|
|
|
|
|
|
this.LoadCMB(data);
|
|
|
|
|
|
|
|
|
this.formEdit.getForm().setValues(data);
|
|
|
if (opstatus == "copyadd") {
|
|
|
this.formEdit.getForm().findField('creattime').setValue(currdate.format('yyyy-MM-dd'));
|
|
|
this.opStatus = "add";
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
Ext.getCmp("SAVE1").enable();
|
|
|
Ext.getCmp("SAVE2").enable();
|
|
|
Ext.getCmp("SAVE3").enable();
|
|
|
Ext.getCmp("SAVE4").enable();
|
|
|
|
|
|
/*由于载入后修改form内值会导致其isDirty返回True,故不能使用这办法
|
|
|
if (data.ContractStatus=='True'){
|
|
|
this.formEdit.getForm().findField('ContractStatus').setValue('1');
|
|
|
}else{this.formEdit.getForm().findField('ContractStatus').setValue('0');}
|
|
|
*/
|
|
|
/*
|
|
|
var task = new Ext.util.DelayedTask(setsave);
|
|
|
task.delay(500);*/
|
|
|
} else {
|
|
|
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
});//request over
|
|
|
|
|
|
if (this.opStatus == 'edit') {
|
|
|
|
|
|
this.formEdit.getForm().findField('ContractNo').setDisabled(false);
|
|
|
|
|
|
//alert(this.editRecord.get('ContractNo'));
|
|
|
//this.storeReceipt.load({ params: { condition: this.editRecord.get('ContractNo')} });
|
|
|
this.storeCargo.load({ params: { condition: this.editRecord.get('ContractNo')} });
|
|
|
//this.storeApp.load({ params: { condition: this.editRecord.get('ContractNo')} });
|
|
|
//this.storeAppstate.load({ params: { condition: this.editRecord.get('ContractNo')} });
|
|
|
//this.storeKC.load({ params: { condition: this.editRecord.get('ContractNo')} });
|
|
|
//this.storeBodyChFee.load({ params: { billno: this.editRecord.get('ContractNo')} });
|
|
|
|
|
|
this.storeFactoryNo.load({ params: { condition: "countryid='" + this.editRecord.get('countryid')+"'" } });
|
|
|
|
|
|
|
|
|
var s=" countryid='"+this.editRecord.get('countryid')+"'";
|
|
|
//alert(s);
|
|
|
this.storeCargoinfo.load({ params: { condition: s} });
|
|
|
//this.storeCargoinfo.load({ params: { condition: ""} });
|
|
|
this.formEdit.getForm().findField('ContractNo').setDisabled(true);
|
|
|
}
|
|
|
|
|
|
}, // end LoadDate
|
|
|
|
|
|
LoadCMB: function (data) {
|
|
|
|
|
|
Data_storeCountry = { countryid: data.countryid, country_idandname: data.country };
|
|
|
this.storeCountry.add(Data_storeCountry);
|
|
|
|
|
|
Data_TRADINGAGENCY = { name: data.TRADINGAGENCY, codename: data.TRADINGAGENCY };
|
|
|
this.storeTRADINGAGENCY.add(Data_TRADINGAGENCY);
|
|
|
|
|
|
//Data_Buyer = { name: data.buyer, codename: data.buyer};
|
|
|
//this.storeBuyer.add(Data_Buyer);
|
|
|
|
|
|
//Data_Seller = { name: data.seller, codename: data.seller };
|
|
|
//this.storeSeller.add(Data_Seller);
|
|
|
|
|
|
Data_Company = { gid: data.company, name: data.companyname };
|
|
|
this.storeCompanyFull.add(Data_Company);
|
|
|
|
|
|
//alert(data.creattime);
|
|
|
},
|
|
|
checkedit: function (){
|
|
|
var _r=true;
|
|
|
|
|
|
if(this.HTHCount>0){
|
|
|
alert("合同号重复");
|
|
|
_r= false;
|
|
|
}else{
|
|
|
var ContractStatus = this.formEdit.getForm().findField('ContractStatus').getValue()?1:0
|
|
|
if (ContractStatus==1) {
|
|
|
alert("已经锁定");
|
|
|
_r= false;
|
|
|
}else
|
|
|
{}//return true;
|
|
|
}
|
|
|
|
|
|
if (this.storeCargo.getCount()==0){}//return true;
|
|
|
else{
|
|
|
for (var i = 0; i < this.storeCargo.getCount(); i += 1) {
|
|
|
var cargomember = this.storeCargo.getAt(i).data;
|
|
|
if (cargomember.weight=="0") {
|
|
|
alert("请填写货物重量,请注意单位是千克");
|
|
|
_r= false;
|
|
|
}else
|
|
|
if (cargomember.name=="") {
|
|
|
alert("请填写货名。");
|
|
|
_r= false;
|
|
|
}
|
|
|
|
|
|
//else
|
|
|
//if (cargomember.cicodeandname == '0203290090_其他冻藏猪肉' && (cargomember.SPECIFICATIONS=="" || cargomember.SPECIFICATIONS==null))
|
|
|
//{
|
|
|
// //alert("0203290090_其他冻藏猪肉的商品必须选择商品规格(去骨/带骨)");
|
|
|
// _r=false;
|
|
|
//}
|
|
|
}//end for
|
|
|
}//end if
|
|
|
/* if (e.field == 'SPECIFICATIONS'){
|
|
|
var cicodeandname=e.record.get('cicodeandname');
|
|
|
if (cicodeandname!="0202300090_其他冻藏猪肉" ){
|
|
|
//alert("只有HS代码为0203290090的商品才能修改规格");
|
|
|
canedit=false;
|
|
|
}else{
|
|
|
//canedit=true;
|
|
|
}
|
|
|
}*/
|
|
|
|
|
|
_form = this.formEdit.getForm();
|
|
|
|
|
|
var seller_name=_form.findField('seller').getValue();
|
|
|
if (CheckISSTOP(this.storeSeller, 'name',seller_name)==true)
|
|
|
{
|
|
|
alert("你选择的贸易商已经停用");
|
|
|
_r=false;
|
|
|
}
|
|
|
|
|
|
var buyer_name=_form.findField('buyer').getValue();
|
|
|
var buyer = DsStoreQueryBy(this.storeBuyer, 'name', buyer_name);
|
|
|
if (buyer.getCount() > 0) {
|
|
|
var buyerdata = buyer.getAt(0).data;
|
|
|
if (buyerdata.ISSTOP=="True"){
|
|
|
alert("你选择的购货商已经停用");
|
|
|
//return;
|
|
|
_r=false;
|
|
|
}
|
|
|
}
|
|
|
var TRADINGAGENCY_name=_form.findField('TRADINGAGENCY').getValue();
|
|
|
var TRADINGAGENCY = DsStoreQueryBy(this.storeTRADINGAGENCY, 'name', TRADINGAGENCY_name);
|
|
|
if (TRADINGAGENCY.getCount() > 0) {
|
|
|
var buyerdata = TRADINGAGENCY.getAt(0).data;
|
|
|
if (buyerdata.ISSTOP=="True"){
|
|
|
alert("你选择的中间商已经停用");
|
|
|
//return;
|
|
|
_r=false;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return _r;
|
|
|
},
|
|
|
Save: function (type) {
|
|
|
var basicForm = this.formEdit.getForm();
|
|
|
if (!basicForm.isValid()) {
|
|
|
return;
|
|
|
}
|
|
|
if (!validateEditorGridPanel(this.gridListReceipt)) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
basicForm.findField('ContractNo').setDisabled(false);
|
|
|
var data = this.formEdit.getForm().getValues();
|
|
|
var HTH = data.HTH;
|
|
|
var ContractNo = data.ContractNo;
|
|
|
basicForm.findField('ContractNo').setDisabled(true);
|
|
|
|
|
|
if (HTH!=""){
|
|
|
if (this.opStatus == 'add'){
|
|
|
var sql = " HTH ='"+ HTH + "' ";
|
|
|
} else {
|
|
|
var sql = " HTH ='"+ HTH + "' and ContractNo<>'"+ContractNo+"'";
|
|
|
}
|
|
|
}
|
|
|
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在查询数据...',
|
|
|
url: '/Import/XXH/GetData_HT',
|
|
|
scope: this,
|
|
|
async:false,
|
|
|
params: {condition: sql },
|
|
|
waitMsg: "正在查询数据...",
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
var jsonresult = Ext.JSON.decode(response.responseText);
|
|
|
var returnData = jsonresult.data;
|
|
|
//alert(returnData.Count);
|
|
|
this.HTHCount=parseInt(returnData.Count);
|
|
|
} else {
|
|
|
Ext.Msg.show({ title: '请重试',
|
|
|
msg: '服务器响应出错',
|
|
|
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
if (HTH!=""){
|
|
|
if (!this.checkedit()) {
|
|
|
return;
|
|
|
}}
|
|
|
basicForm.findField('ContractNo').setDisabled(false);
|
|
|
basicForm.findField('ContractStatus').setDisabled(false);
|
|
|
var data = this.formEdit.getForm().getValues();
|
|
|
basicForm.findField('ContractNo').setDisabled(true);
|
|
|
basicForm.findField('ContractStatus').setDisabled(true);
|
|
|
/*
|
|
|
var bodydatas = [];
|
|
|
for (var i = 0; i < this.storeReceipt.getCount(); i += 1) {
|
|
|
var member = this.storeReceipt.getAt(i);
|
|
|
bodydatas.push(member);
|
|
|
}*/
|
|
|
var Cargodatas = [];
|
|
|
for (var i = 0; i < this.storeCargo.getCount(); i += 1) {
|
|
|
var member = this.storeCargo.getAt(i);
|
|
|
Cargodatas.push(member);
|
|
|
}
|
|
|
|
|
|
//商品明细
|
|
|
var CargoBody = ConvertRecordsToJson(Cargodatas);
|
|
|
var CargoDelBody = ConvertRecordsToJsonAll(this.CargoDel);
|
|
|
|
|
|
//将复选框值转化为1/0
|
|
|
data.ContractStatus=this.formEdit.getForm().findField('ContractStatus').getValue()?1:0;
|
|
|
data.HaveContract=this.formEdit.getForm().findField('HaveContract').getValue()?1:0;
|
|
|
data.HaveCargoMark=this.formEdit.getForm().findField('HaveCargoMark').getValue()?1:0;
|
|
|
|
|
|
if (data.cgid==="") data.cgid = "0";
|
|
|
Ext.Msg.wait('正在保存数据, 请稍侯..');
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在保存数据...',
|
|
|
url: '/Import/create/Save',
|
|
|
scope: this,
|
|
|
params: {
|
|
|
opstatus: this.opStatus,
|
|
|
data: Ext.JSON.encode(data),
|
|
|
CargoBody: CargoBody,
|
|
|
CargoDelBody: CargoDelBody
|
|
|
},
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
Ext.MessageBox.hide();
|
|
|
var jsonresult = Ext.JSON.decode(response.responseText);
|
|
|
if (jsonresult.Success) {
|
|
|
this.storeCargo.commitChanges();
|
|
|
|
|
|
var returnData = jsonresult.Data;
|
|
|
this.formEdit.getForm().setValues(returnData);
|
|
|
|
|
|
if (this.opStatus == 'add') {
|
|
|
var arrNewRecords = this.StoreList.add(returnData);
|
|
|
this.editRecord = arrNewRecords[0];
|
|
|
// alert(editRecord.get('ContractNo'));
|
|
|
}
|
|
|
else if (this.opStatus == 'edit') {
|
|
|
var editp = Ext.create('XXHmb', returnData);
|
|
|
this.editRecord.fields.each(function (field) {
|
|
|
if (field.persist) {
|
|
|
name = field.name;
|
|
|
//alert(name + ' -- ' + editp.get(name));
|
|
|
//if (name != 'id')
|
|
|
this.editRecord.set(name, editp.get(name));
|
|
|
}
|
|
|
}, this);
|
|
|
this.editRecord.commit();
|
|
|
}
|
|
|
if (type == '0') {
|
|
|
this.opStatus = 'edit';
|
|
|
basicForm.findField('ContractNo').setDisabled(false);
|
|
|
this.storeApp.load({ params: { condition: this.editRecord.get('ContractNo')} });
|
|
|
this.storeCargo.load({ params: { condition: this.editRecord.get('ContractNo')} });
|
|
|
basicForm.findField('ContractNo').setDisabled(true);
|
|
|
} else if (type == '1') {//保存并关闭
|
|
|
window.close();
|
|
|
} else if (type == '2'){//保存并全部新建
|
|
|
this.LoadData('add', '');
|
|
|
//this.opStatus = 'add';
|
|
|
//this.formEdit.getForm().reset();
|
|
|
//this.LoadData('add', '');
|
|
|
//basicForm.findField('ContractNo').setDisabled(true);
|
|
|
this.storeCargo.removeAll();
|
|
|
} else if (type == '3'){//保存并新建,同时保留合同基础信息、货物信息、许可证使用信息
|
|
|
this.formEdit.getForm().setValues({ContractNo:''});
|
|
|
this.opStatus = 'add';
|
|
|
//this.LoadData('add', '');
|
|
|
this.formEdit.getForm().findField('ContractNo').setDisabled(true);
|
|
|
//this.storeKC.removeAll();
|
|
|
//this.storeReceipt.removeAll();
|
|
|
|
|
|
this.CargoDel = [];
|
|
|
for (var i = 0; i < this.storeCargo.getCount(); i += 1) {
|
|
|
this.storeCargo.getAt(i).set("ContractNo","");
|
|
|
this.storeCargo.getAt(i).set("GID",NewGuid());
|
|
|
}
|
|
|
//var Appstatedatas = [];
|
|
|
//for (var i = 0; i < this.storeAppstate.getCount(); i += 1) {
|
|
|
// var member = this.storeAppstate.getAt(i).set("ContractNo","");
|
|
|
//}
|
|
|
alert('注意,提单号、箱号、铅封号等信息不要重复');
|
|
|
}
|
|
|
|
|
|
|
|
|
} 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
|
|
|
Print: function () {
|
|
|
var basicForm = this.formEdit.getForm();
|
|
|
var ContractNo = this.editRecord.get('ContractNo')
|
|
|
if (ContractNo == '*' || ContractNo == '') {
|
|
|
Ext.Msg.show({ title: '错误', msg: '单据还没有保存,请保存后再打印', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
var printType = 'XXH_CW_YS';
|
|
|
//
|
|
|
var sql1 = "SET LANGUAGE 'us_english' SELECT price,weight,6.1667 as exchange FROM import_cargo WHERE contractno = '" + ContractNo + "' ";
|
|
|
var sql2 = "";
|
|
|
var sql3 = "";
|
|
|
var sql4 = "";
|
|
|
var sql5 = "";
|
|
|
var sql6 = "";
|
|
|
|
|
|
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
|
|
|
}
|
|
|
|
|
|
,
|
|
|
onCargoCellKey: function (textfield, e) {
|
|
|
var rows = _this.formCargo.getSelectionModel().getSelection();
|
|
|
var row = rows[rows.length - 1];
|
|
|
var s = _this.formCargo.getStore();
|
|
|
var number = s.indexOf(row);
|
|
|
if (e.getKey() === 40) {
|
|
|
if (number + 1 === _this.formCargo.getStore().getCount()) {
|
|
|
|
|
|
_this.onCopyAddCargoClick( row.data);
|
|
|
} else {
|
|
|
_this.cellEditingCargo.startEditByPosition({ row: number + 1, column: 4 });
|
|
|
}
|
|
|
} else if (e.getKey() === 38) {
|
|
|
_this.cellEditingCargo.startEditByPosition({ row: number - 1, column: 4 });
|
|
|
}
|
|
|
}
|
|
|
,
|
|
|
SPECIFICATIONSAfterSet:function(e) {
|
|
|
cicode = e.record.get('cicode');
|
|
|
if (cicode == "0203290090" || cicode == "0306120000" || cicode == "03051900" || cicode == "0306171900" || cicode == "0306172900") {
|
|
|
//alert("只有HS代码为0203290090的商品才能修改规格");
|
|
|
|
|
|
} else {
|
|
|
e.record.set('SPECIFICATIONS', '');
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|