You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

8045 lines
290 KiB
JavaScript

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

///<reference path="../../../../Views/../TruckMng/Scripts/vswd-ext_2.0.2.js" />
Ext.namespace('DsTruck');
var APPUsing=0;
DsTruck.XXHEdit = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.DsTruck.XXHEdit.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);
var ReceiptDirty=DsTruck.GetDirty(panelEdit.storeReceipt,panelEdit.bodyDel);
var KCDirty=DsTruck.GetDirty(panelEdit.storeKC,panelEdit.KCDel);
var ChfeeDirty=DsTruck.GetDirty(panelEdit.storeBodyChFee,panelEdit.feeBodyDel);
var Chfee_YFDirty=DsTruck.GetDirty(panelEdit.storeBodyChFee_YF,panelEdit.feeBodyDel);
if (panelEdit.formEdit.getForm().isDirty()== true || CargoDirty==true|| ReceiptDirty==true
|| KCDirty==true|| ChfeeDirty==true||Chfee_YFDirty==true)
{
return true;
}
else return false;
}
Ext.extend(DsTruck.XXHEdit, Ext.Panel, {
parentWin: null,
OpStatus: 'edit',
StoreList: null,
editRecord: null,
// parentfunction: null,
_First: true,
_buyer:"",
initUIComponents: function () {
this.bodyDel = [];
this.CargoDel = [];
this.AppstateDel = [];
this.KCDel = [];
this.Loading = true;
this.seller="";
this.buyer="";
this.TRADINGAGENCY="";
this.BSNO="";
this.feeSerialNo = 0;
this.feeBodyDel = [];
this.CargoListName="CargoList_Port"
this.StoreDrOpRange = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsFeeOP',
proxy: { url: '/MvcShipping/MsChFee/GetFeeOpRang' }
});
this.StoreCrOpRange = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsFeeOP',
proxy: { url: '/MvcShipping/MsChFee/GetFeeOpRang' }
});
this.StoreDrOpRange.load({ params: { optype: "modImport_Fee"} });
this.StoreCrOpRange.load({ params: { optype: "modImport_Fee"} });
//#region 枚举参照相关(编辑form)
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.comboxMainstate2 = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '合同状态',
forceSelection: true,readOnly: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,
//readOnly:true,
store: this.storePrinted,
name: 'Printed'
});
this.comboxPrinted2 = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '发票打印完成',
forceSelection: true,
readOnly:true,
store: this.storePrinted,
name: 'Printed'
});
this.storeWriteoffs = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeWriteoffs.load({ params: { enumTypeId: 0 } });
this.comboxWriteoffs = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '核销完成',hidden:true,
forceSelection: true,
store: this.storeWriteoffs,
name: 'Writeoffs'
});
this.comboxWriteoffs2 = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '核销完成',readOnly:true,
forceSelection: true,
store: this.storeWriteoffs,
name: 'Writeoffs'
});
this.storeCIQ_canbesearch = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeCIQ_canbesearch.load({ params: { enumTypeId: 0} });
this.comboxCIQ_canbesearch = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '卫生证是否可查',
forceSelection: true,
store: this.storeCIQ_canbesearch,
name: 'CIQ_canbesearch'
});
this.comboxCIQ_canbesearch2 = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '卫生证是否可查',
forceSelection: true,readOnly:true,
store: this.storeCIQ_canbesearch,
name: 'CIQ_canbesearch'
});
this.storeAutoAPP = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeAutoAPP.load({ params: { enumTypeId: 0 } });
this.comboxAutoAPP = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '自动证',
forceSelection: true,
store: this.storeAutoAPP,
name: 'AutoAPP'
});
this.comboxAutoAPP2 = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '自动证',
forceSelection: true,readOnly:true,
store: this.storeAutoAPP,
name: 'AutoAPP'
});
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',flex:1
});
this.comboxBillType2 = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '提单提交方式',
forceSelection: true,readOnly:true,
store: this.storeBillType,
name: 'BillType',flex:1
});
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.storeSecurityDeposit = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeSecurityDeposit.load({ params: { enumTypeId: 0 } });
this.comboxSecurityDeposit = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '是否已交保证金',flex:1,
forceSelection: true,
store: this.storeSecurityDeposit,
name: 'SecurityDeposit'
});
this.comboxSecurityDeposit2 = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '是否已交保证金',flex:1,
forceSelection: true,readOnly:true,
store: this.storeSecurityDeposit,
name: 'SecurityDeposit'
});
this.storePaymentMethods = Ext.create('DsExt.ux.RefEnumStore', {});
this.storePaymentMethods.load({ params: { enumTypeId: 4} });
this.comboxPaymentMethods = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '付款方式',flex:1,
forceSelection: true,
store: this.storePaymentMethods,
name: 'PaymentMethods'
});
this.comboxPaymentMethods2 = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '付款方式',flex:1,
forceSelection: true,readOnly:true,
store: this.storePaymentMethods,
name: 'PaymentMethods'
});
this.storeTransactionMethod = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeTransactionMethod.load({ params: { enumTypeId: 1} });
this.comboxTransactionMethod = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '成交方式',readOnly:true,flex:1,
forceSelection: true,
store: this.storeTransactionMethod,
name: 'TransactionMethod',
valueField: 'EnumValueId',
displayField: 'EnumValueName',
triggerAction: 'all',
selectOnFocus: true
});
this.comboxTransactionMethod2 = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '成交方式',readOnly:true,
flex:1,
forceSelection: true,
store: this.storeTransactionMethod,
name: 'TransactionMethod',
valueField: 'EnumValueId',
displayField: 'EnumValueName',
triggerAction: 'all',
selectOnFocus: true
});
this.storeport = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeport.load({ params: { enumTypeId: 10}});
this.comboxport = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '目的港',readOnly:true,
flex:1,
forceSelection: true,
store: this.storeport,
name: 'port'
});
//表参照相关
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: '进口国',flex:1,
forceSelection: true,
store: this.storeCountry,
name: 'countryid',
valueField: 'countryid',
displayField: 'country_idandname'
});
this.storeSeller = Ext.create('DsExt.ux.RefTableStore', {
model: 'Tradermb',
proxy: { url: '/CommMng/BasicDataRef/GetTrader' } });
this.storeSeller.load({ params: { condition: " isagent=1 " } });
this.storeSeller2 = Ext.create('DsExt.ux.RefTableStore', {
model: 'Tradermb',
proxy: { url: '/CommMng/BasicDataRef/GetTrader' } });
this.storeSeller2.load({ params: { condition: " isagent=1 and isnull(isstop,0)=0 " } });
this.comboxSeller = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '贸易商',flex:1,
forceSelection: true,
store: this.storeSeller,
name: 'seller',id:"seller",
valueField: 'name',
displayField: 'codename',
listeners: {
focus: function (field, newValue, oldValue) {
_this.seller = field.value;
_this.comboxSeller.store=_this.storeSeller2;
},
blur: function (field, newValue, oldValue) {
_this.comboxSeller.store=_this.storeSeller;
if (field.value == "") {
field.value = _this.seller;
}
if (field.displayTplData[0].ISSTOP == "True") {
alert("该往来单位已经停用");
}
},
scope: this
}
});
this.comboxSeller2 = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '贸易商',
flex:1,
store: this.storeSeller,
name: 'seller',readOnly:true,
valueField: 'name',
displayField: 'codename'
});
var _this=this;
this.storeBuyer = Ext.create('DsExt.ux.RefTableStore', {
model: 'Tradermb',
proxy: {url: '/CommMng/BasicDataRef/GetTrader'}});
this.storeBuyer.load({params: {condition: " isagentcn=1 "}});
this.storeBuyer2 = Ext.create('DsExt.ux.RefTableStore', {
model: 'Tradermb',
proxy: {url: '/CommMng/BasicDataRef/GetTrader'}});
this.storeBuyer2.load({params: {condition: " isagentcn=1 and isnull(isstop,0)=0 "}});
this.comboxBuyer = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '客户(购货方)',readOnly:true,
forceSelection: true,flex:1,
store: this.storeBuyer,
name: 'buyer',
valueField: 'name',
displayField: 'codename',
listeners: {
focus: function (field, newValue, oldValue) {
_this.buyer = field.value;
_this.comboxBuyer.store=_this.storeBuyer2;
},
blur: function (field, newValue, oldValue) {
_this.comboxBuyer.store=_this.storeBuyer;
if (field.value == "") {
field.value = _this.buyer;
}
if (field.displayTplData[0].ISSTOP == "True") {
alert("该往来单位已经停用");
}
},
scope: this
}
});
this.comboxBuyer2 = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '客户(购货方)',readOnly:true,
flex:1,
store: this.storeBuyer,
name: 'buyer',
valueField: 'name',
displayField: 'codename'
});
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',
valueField: 'name',
displayField: 'codename',
flex:1,
listeners: {
blur: function (field, newValue, oldValue) {
//alert(newValue);
if (field.displayTplData[0].ISSTOP=="True"){
alert("该往来单位已经停用");
}
},
scope: this
}
});
this.comboxTRADINGAGENCY2 = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '订货方(中间商)',
forceSelection: true,
store: this.storeTRADINGAGENCY,
name: 'TRADINGAGENCY',
valueField: 'name',
displayField: 'codename',
flex:1,
listeners: {
blur: function (field, newValue, oldValue) {
//alert(newValue);
if (field.displayTplData[0].ISSTOP=="True"){
alert("该往来单位已经停用");
}
},
scope: this
}
});
//this.comboxSeller,this.comboxBuyer
this.comboxCountry.addListener('select',
function(combo, record, index) {
var s = " countryid='" + combo.value + "'";
this.storeCargoinfo.load({ params: { condition: s } });
},
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: '接单人',readOnly:true,
forceSelection: true,
store: this.storeUser,
name: 'creator',
valueField: 'UserCode',
displayField: 'CodeAndName'
});
this.comboxAuditor = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '审单人',readOnly:true,
forceSelection: true,
store: this.storeUser,
name: 'Auditor',
valueField: 'UserCode',
displayField: 'CodeAndName'
});
this.storeCompany = Ext.create('DsExt.ux.RefTableStore', {
model: 'companymb',proxy: { url: '/CommMng/BasicDataRef/GetcompanyList' } });
this.storeCompany.load({params: {condition: ""}});
this.comboxCompany = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '用证公司',readOnly:true,
forceSelection: true,flex:1,
store: this.storeCompany,
name: 'company',
valueField: 'gid',
displayField: 'name'
});
this.comboxCompany2 = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '用证公司',readOnly:true,
forceSelection: true,
store: this.storeCompany,
name: 'company',
valueField: 'gid',
displayField: 'name'
});
this.storeFStatus = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeFStatus.load({ params: { enumTypeId: 16} });
this.comboxFStatus = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '融资状态',
forceSelection: true,
readOnly:true,
store: this.storeFStatus,
name: 'FinanceStatus'
});
this.storeSampling_need = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeSampling_need.load({ params: { enumTypeId: 44 } });
this.comboxSampling_need = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '海关是否验货',flex:1,
forceSelection: true,
store: this.storeSampling_need,
name: 'Sampling_need'
});
this.comboxSampling_need2 = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '海关是否验货',flex:1,
forceSelection: true,readOnly:true,
store: this.storeSampling_need,
name: 'Sampling_need'
});
this.storeInspection_Storage = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeInspection_Storage.load({ params: { enumTypeId: 0 } });
this.comboxInspection_Storage = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '是否商检慢检',flex:0.5,
labelWidth:77,
forceSelection: true,
store: this.storeInspection_Storage,
name: 'Inspection_Storage'
});
this.comboxInspection_Storage2 = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '是否商检慢检',flex:0.5,
labelWidth:77,
forceSelection: true,readOnly:true,
store: this.storeInspection_Storage,
name: 'Inspection_Storage'
});
this.storeISREFORM = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeISREFORM.load({ params: { enumTypeId: 0 } });
this.comboxISREFORM = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '是否整改',flex:0.5,
labelWidth:77,
forceSelection: true,
store: this.storeISREFORM,
name: 'ISREFORM'
});
this.comboxISREFORM2 = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '是否整改',flex:0.5,
labelWidth:77,
forceSelection: true,readOnly:true,
store: this.storeISREFORM,
name: 'ISREFORM'
});
this.storeReceiptStatus = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeReceiptStatus.load({ params: { enumTypeId: 0 } });
this.comboxReceiptStatus = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '单据是否完备',
forceSelection: true,
store: this.storeReceiptStatus,
name: 'ReceiptStatus',
flex:1
});
this.comboxReceiptStatus2 = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '单据是否完备',
forceSelection: true,
store: this.storeReceiptStatus,
name: 'ReceiptStatus',
flex:1
});
this.storeRCVMode = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeRCVMode.load({ params: { enumTypeId: 23 } });
this.comboxRCVMode = Ext.create('DsExt.ux.RefEnumCombox', {
//labelWidth:70,
fieldLabel: '收单据模式',
forceSelection: true,
store: this.storeRCVMode,flex:2,
name: 'RCVMode'
});
this.comboxRCVMode2 = Ext.create('DsExt.ux.RefEnumCombox', {
//labelWidth:70,
fieldLabel: '收单据模式',
forceSelection: true,
store: this.storeRCVMode,flex:2,
name: 'RCVMode'
});
this.storeBUZTYPE = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeBUZTYPE.load({ params: { enumTypeId: 27 } });
this.comboxBUZTYPE = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '业务类型',readOnly:true,
forceSelection: true,
store: this.storeBUZTYPE,
name: 'BUZTYPE',flex:2
});
this.comboxBUZTYPE2 = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '业务类型',readOnly:true,
forceSelection: true,
store: this.storeBUZTYPE,
name: 'BUZTYPE',flex:2
});
this.storeInspection_Buyer = Ext.create('DsExt.ux.RefTableStore', {
model: 'Tradermb',
proxy: { url: '/CommMng/BasicDataRef/GetTrader' } });
this.storeInspection_Buyer.load({ params: { condition: "" } });
this.comboxInspection_Buyer = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '商检收货单位',flex:2,
forceSelection: true,
store: this.storeInspection_Buyer,
name: 'Inspection_Buyer',
valueField: 'name',
displayField: 'codename',
listeners: {
blur: function (field, newValue, oldValue) {
//alert(newValue);
if (field.displayTplData[0].ISSTOP=="True"){
alert("该往来单位已经停用");
}
},
scope: this
}
});
this.comboxInspection_Buyer2 = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '商检收货单位',flex:2,
//forceSelection: true,
readOnly:true,
store: this.storeInspection_Buyer,
name: 'Inspection_Buyer',
valueField: 'name',
displayField: 'codename',
listeners: {
blur: function (field, newValue, oldValue) {
//alert(newValue);
if (field.displayTplData[0].ISSTOP=="True"){
alert("该往来单位已经停用");
}
},
scope: this
}
});
this.comboxYARD = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '押箱堆场',flex:1,
forceSelection: true,
store: this.storeInspection_Buyer,
name: 'YARD',
valueField: 'name',
displayField: 'codename',
listeners: {
blur: function (field, newValue, oldValue) {
//alert(newValue);
if (field.displayTplData[0].ISSTOP=="True"){
alert("该往来单位已经停用");
}
},
scope: this
}
});
this.StoreDateCurr = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsFeeCurr',
proxy: { url: '/MvcShipping/MsChFee/GetFeeDateCurrList' }
});
this.StoreDateCurr.load();
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',
flex:1,
displayField: 'CtnName'
});
this.comboxContainerType2 = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '箱型',readOnly:true,
store: this.storeContainerType,
name: 'CTN',
valueField: 'CtnName',
flex:1,
displayField: 'CtnName'
});
//#endregion
//////////////////
//#region 编辑form:formEdit
this.formEdit = Ext.widget('form', {
// layout: "border",
region: 'center',id:"formEdit",
frame: true,
bodyPadding: 2,
trackResetOnLoad: true,
fieldDefaults: {
margins: '1 1 1 1',
labelAlign: 'right',
flex: 6,
//labelWidth: 90,//label标签宽度
msgTarget: 'qtip',
sourcelabelWidth :'100'
//,split:true
},
items: [{ //fieldset 1
xtype: 'fieldset',
defaultType: 'textfield',
layout: 'anchor',
//readOnly:true,
defaults: {
anchor: '100%'
},
items: [
{ //container_1
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '合同序列号',
// allowBlank: false,
//disabled: true,
readOnly:true,
name: 'ContractNo'
}, this.comboxCreator,{
fieldLabel: '接单时间',
format: 'Y-m-d H:i:s',
xtype: 'datefield',readOnly:true,
renderer: Ext.util.Format.dateRenderer('Y-m-d H:i:s'),
name: 'creattime'
}, this.comboxAuditor,{
fieldLabel: '审单时间',
format: 'Y-m-d H:i:s',
xtype: 'datefield',readOnly:true,
renderer: Ext.util.Format.dateRenderer('Y-m-d H:i:s'),
name: 'Audittime'
}/*,{
fieldLabel: '转单时间',
format: 'Y-m-d H:i:s',
xtype: 'datefield',readOnly:true,
renderer: Ext.util.Format.dateRenderer('Y-m-d H:i:s'),
name: 'ResendTime'
}*/,{xtype:'hiddenfield'},
{
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'
},
{
fieldLabel: '提单号是否可重复',
name: 'MBLNOREPEAT',
flex: 0,
hidden: true,
margins: '0',
listeners: {
//添加日期选择事件
"change": function () {
//alert("MBLNOREPEAT");
},
scope: this
}
}]
},
//container_1 end
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
this.comboxSeller,
this.comboxBuyer,
{
fieldLabel: '双抬头',flex:1,
name: 'STT'
},{
fieldLabel: '用证公司',flex:1,
name: 'company'
}
,this.comboxCountry
,this.comboxTRADINGAGENCY
]
},
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: 'port',
readOnly:true,hidden:true,
name: 'port'
},{
fieldLabel: '目的港',
readOnly:true,
name: 'portRef'
},{
fieldLabel: '合同号',
readOnly:true,
name: 'HTH'
},{
fieldLabel: '供应商合同号',
readOnly:true,
name: 'Supplier_Billno'
},{
fieldLabel: '提单号',
readOnly:true,
name: 'BillNo'
},{
fieldLabel: '箱号',
readOnly:true,
name: 'ContainerNo'
},
{
fieldLabel: '铅封号',
//readOnly:true,
name: 'SealNo'
}
]
},
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
{
fieldLabel: '自贸区',
readOnly: true,
name: 'ZMQ'
} ,{
fieldLabel: 'ShipCompany_id',
readOnly: true,hidden:true,
name: 'ShipCompany_id'
} ,{
fieldLabel: '船公司',
readOnly: true,
name: 'ShipCompanyRef'
} ,{
fieldLabel: '船代',
//readOnly: true,
name: 'ShipAgent'
} ,{
fieldLabel: '免箱期',
//readOnly: true,
name: 'Freetime'
},{
fieldLabel: '船名',
//readOnly: true,
name: 'Vessel'
},
{
fieldLabel: '航次',
//readOnly: true,
name: 'Voyage'
}]
},
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '预计开船日',
format: 'Y-m-d',
xtype: 'datefield',
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
flex:1,//readOnly: true,
name: 'Ex_sailingdate'
},{
fieldLabel: '开船日期',
format: 'Y-m-d',//readOnly: true,
xtype: 'datefield',
name: 'Sailingdate',flex:1
},
{
fieldLabel: '到港日期',
format: 'Y-m-d',//readOnly: true,
xtype: 'datefield',
name: 'ArrivalDate',flex:1
}, this.comboxPaymentMethods
, this.comboxTransactionMethod
,{xtype:'hiddenfield',flex:1}
]
},
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
{
fieldLabel: '付货款时间(预付)',
format: 'Y-m-d',//readOnly: true,
xtype: 'datefield',
name: 'Prepaydate'
},{
fieldLabel: '电放时间',
format: 'Y-m-d',//readOnly: true,
xtype: 'datefield',
name: 'E_Billtime'
},{
fieldLabel: '正本时间',
format: 'Y-m-d',//readOnly: true,
xtype: 'datefield',
name: 'BillTime'
},{
fieldLabel: '放单时间',
format: 'Y-m-d',//readOnly: true,
xtype: 'datetimefield',
name: 'BillReleaseDate'
},{
fieldLabel: '换单时间',
format: 'Y-m-d',//readOnly: true,
xtype: 'datetimefield',
name: 'HDtime'
},this.comboxFStatus]
},
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '付货款时间(尾款)',
format: 'Y-m-d',//readOnly: true,
xtype: 'datefield',
name: 'Paydate',flex:1},
this.comboxBillType,
this.comboxReceiptStatus,
{
fieldLabel: '转提单日期',
format: 'Y-m-d',//readOnly: true,
xtype: 'datefield',
name: 'FUNDDATE_1',flex:1}
, {
xtype: 'checkbox', flex: 1,
//readOnly:true,
fieldLabel: '是否换小单', flex: 1,
name: 'IsLBill'
}
,{
fieldLabel: '小单船代', flex: 1,
//readOnly: true,
name: 'LBillShipAgent'
}]
},
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '寄单情况',//readOnly: true,
name: 'Receiptremark',
flex:5
}//,this.comboxTRADINGAGENCY2
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '分公司接单日期',flex: 1,
format: 'Y-m-d H:i:s',//readOnly: true,
xtype: 'datefield',
name: 'CreateTime_2'
}, {
fieldLabel: '分公司转单日期', flex: 1,
format: 'Y-m-d H:i:s',//readOnly: true,
xtype: 'datefield',
name: 'ResendTime'
}, {
fieldLabel: '靠泊码头',flex: 1,
//readOnly: true,
name: 'Dock'
}, {
xtype: 'checkbox', flex: 1,
//readOnly:true,
fieldLabel: '是否内至线',
name: 'IsInnerLine'
}, {
fieldLabel: '内至线启运港',flex: 1,
//readOnly: true,//hidden:true,
name: 'InnerLinePort'
},{
fieldLabel: '报关单号',flex:1,
//readOnly:true,
name: 'DeclareNumber'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [ this.comboxContainerType
,this.comboxYARD
,{
fieldLabel: '国外寄单快递号',
//readOnly:true,
name: 'BILLTRANCNO'//,id:"BILLTRANCNO"
,flex:1
} , {
xtype: 'checkbox', flex: 1,
//readOnly:true,
fieldLabel: '是否锁汇',
name: 'LOCK_EXCHANGERATE'
}, {
flex: 1,
fieldLabel: '锁汇汇率',
//readOnly:true,
name: 'EXCHANGERATE'
}
,{xtype:'hiddenfield',flex:1}]
},
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '____备注1',
//readOnly:true,
name: 'remark',flex:3
}]
},
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxMainstate,
this.comboxCIQ_canbesearch,
{
fieldLabel: '卫生许可证(ciq)',
name: 'CIQ_licence'//,//readOnly:true
},
this.comboxPrinted,
{
fieldLabel: '询回价格日期',
format: 'Y-m-d',
xtype: 'datefield',//readOnly:true,
name: 'PriceLimitDate'
},{
fieldLabel: '询回价格',
//format: 'Y-m-d',
xtype: 'textfield',//readOnly:true,
name: 'PriceLimitRemark'
}
]
},
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [ {
fieldLabel: '报检日期',
format: 'Y-m-d H:i:s',
xtype: 'datefield',//readOnly:true,
name: 'inspection_Signup_date'
},{
fieldLabel: '报检号',
//readOnly:true,
name: 'inspection_no'
},{
fieldLabel: '通关单号',
name: 'ClearanceNo'
},{
fieldLabel: '出通关单时间',
format: 'Y-m-d H:i:s',
xtype: 'datefield',
name: 'ClearanceDate'
},{
fieldLabel: '转检时间',
format: 'Y-m-d',//readOnly: true,
xtype: 'datetimefield',
name: 'ResendTime2'
}
,this.comboxWriteoffs
,this.comboxAutoAPP
]
},
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '____备注2(核销单备注)',
//readOnly:true,
name: 'remark_2'
}]
},
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '出税日期',flex:1,
//readOnly:true,
format: 'Y-m-d H:i:s',
xtype: 'datefield',
name: 'tax_date'
},
{
fieldLabel: '付税日期',flex:1,
//readOnly:true,
format: 'Y-m-d H:i:s',
xtype: 'datefield',
name: 'tax_paydate'
},{
fieldLabel: '备注',flex:1,
//readOnly:true,
name: 'TaxPayRemark'
},
{
fieldLabel: '税金收回日期',flex:1,
//readOnly:true,
format: 'Y-m-d H:i:s',
xtype: 'datefield',
name: 'TaxRecvDate'
}, {
fieldLabel: '备注',flex:1,
//readOnly:true,
name: 'TaxRecvRemark'
},
this.comboxSecurityDeposit
]
},
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [ {
fieldLabel: '海关确定抽检',flex:1,
format: 'Y-m-d',
//readOnly:true,
xtype: 'datefield',
name: 'SamplingDate_Plan'
},
{
fieldLabel: '海关实际验货',flex:1,
format: 'Y-m-d',
//readOnly:true,
xtype: 'datefield',
name: 'SamplingDate_Act'
},{
fieldLabel: '海关放行日期',flex:1,
format: 'Y-m-d',
//readOnly:true,
xtype: 'datetimefield',
name: 'CustomsReleaseDate'
},{
fieldLabel: '回空日期',flex:1,
format: 'Y-m-d',
//readOnly:true,
xtype: 'datefield',
name: 'RecDate'
},
{
fieldLabel: '港口天数',flex:1,
name: 'PortDays'//,
//readOnly:true
},this.comboxSampling_need]
},
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '____备注3',
//readOnly:true,
name: 'remark_3'
}]
},
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '商检验货日期',
//readOnly:true,
format: 'Y-m-d',
xtype: 'datefield',
name: 'inspection_date',flex:1
},{
fieldLabel: '启封/整改放行日',
//readOnly:true,
format: 'Y-m-d',
xtype: 'datefield',
name: 'Unsealdate',flex:1
},
this.comboxInspection_Storage,
this.comboxISREFORM,
//TRUCKNO
{
fieldLabel: '提货车号',
xtype: 'textfield',
name: 'TRUCKNO',flex:1
},{
fieldLabel: '车队提箱日期',
//readOnly:true,
format: 'Y-m-d',
xtype: 'datefield',
name: 'GetBoxDate',flex:1
},{
xtype : 'checkbox',flex:1,
fieldLabel: '车队未当日回空',
//readOnly:true,
name: 'IsRec'
}
]
},
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '联系人',
//readOnly:true,
name: 'Contacter',
flex:1
},{
fieldLabel: '电话',
//readOnly:true,
name: 'Tel',flex:1
},
{
fieldLabel: '送货日',
//readOnly:true,
format: 'Y-m-d',
xtype: 'datefield',
name: 'DeliveryDate',flex:1
},{
fieldLabel: '送货地址',
//readOnly:true,
name: 'DeliveryAddress',flex:1
},{
fieldLabel: '溢短装',
//readOnly:true,
name: 'Overfilled',flex:2
}]
},
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '备注4',
//readOnly:true,
name: 'remark_4'
}]
},
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
xtype : 'checkbox',flex:1,
fieldLabel: '库存清空',
//readOnly:true,
name: 'KCClear'
},//this.comboxBUZTYPE2,
this.comboxInspection_Buyer2,
{
xtype : 'checkbox',flex:1,
//readOnly:true,
fieldLabel: '已有合同',
name: 'HaveContract'
},
{
xtype : 'checkbox',flex:1,
//readOnly:true,
fieldLabel: '有商品标签',
name: 'HaveCargoMark'
},
{
fieldLabel: 'hiddenfield',
xtype: 'hiddenfield',
name: 'hidden3',flex:0
},
{
fieldLabel: 'MZBZ',
name: 'MZBZ',hidden:true,
listeners: {
//添加日期选择事件
"change": function () {
//alert("MZBZ");
},
scope: this
}
},
{
fieldLabel: 'LOADFINISH',
name: 'LOADFINISH',hidden:true,
listeners: {
//添加日期选择事件
"change": function () {
this.setSaveBtnEnable(true);
},
scope: this
}
}
]
}]
}]
});
//#endregion this.formEdit
//#region 编辑formLocal
this.formLocal = Ext.widget('form', {
// layout: "border",
region: 'center',id:"formLocal",
frame: true,
bodyPadding: 2,
trackResetOnLoad: true,
fieldDefaults: {
margins: '1 1 1 1',
labelAlign: 'right',
flex: 5,
//labelWidth: 90,//label标签宽度
msgTarget: 'qtip',
sourcelabelWidth :'100'
//,split:true
},
items: [{ //fieldset 1
xtype: 'fieldset',
defaultType: 'textfield',
layout: 'anchor',
readOnly:true,
defaults: {
anchor: '100%'
},
items: [
{ //container_1
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '合同序列号',
readOnly:true,hidden:true,
disabled: false,
name: 'ContractNo'
},{
fieldLabel: '合同序列号',
readOnly:true,
disabled: false,
name: 'Local_ContractNo'
}, {
fieldLabel: '接单人',readOnly:true,
readOnly:true,
disabled: false,
name: 'Creator'
},{
fieldLabel: '接单时间',
format: 'Y-m-d H:i:s',
xtype: 'datefield',readOnly:true,
renderer: Ext.util.Format.dateRenderer('Y-m-d H:i:s'),
name: 'creattime'
}, {
fieldLabel: '审单人',readOnly:true,
readOnly:true,
disabled: false,
name: 'Auditor'
},{
fieldLabel: '审单时间',
format: 'Y-m-d H:i:s',
xtype: 'datefield',readOnly:true,
renderer: Ext.util.Format.dateRenderer('Y-m-d H:i:s'),
name: 'Audittime'
},
/**/
{
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'
},
{
fieldLabel: '提单号是否可重复',
name: 'MBLNOREPEAT',
flex: 0,
hidden: true,
margins: '0',
listeners: {
//添加日期选择事件
"change": function () {
//alert("MBLNOREPEAT");
},
scope: this
}
}]
},
//container_1 end
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
this.comboxSeller2,
this.comboxBuyer2,
this.comboxCompany2,{
fieldLabel: '双抬头',
readOnly:true,flex:1,
name: 'STT'
},{
fieldLabel: '进口国',
readOnly:true,flex:1,
name: 'countryid'
}]
},
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: 'port',
readOnly:true,hidden:true,
name: 'port'
},{
fieldLabel: '目的港',
readOnly:true,
name: 'portRef'
},{
fieldLabel: '合同号',
readOnly:true,
name: 'HTH'
},{
fieldLabel: '提单号',
readOnly:true,
name: 'BillNo'
},{
fieldLabel: '箱号',
readOnly:true,
name: 'ContainerNo'
},
{
fieldLabel: '铅封号',
readOnly:true,
name: 'SealNo'
}
]
},
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
{
fieldLabel: '自贸区',
readOnly: true,
name: 'ZMQ'
} ,{
fieldLabel: 'ShipCompany_id',
readOnly: true,hidden:true,
name: 'ShipCompany_id'
} ,{
fieldLabel: '船公司',
readOnly: true,
name: 'ShipCompanyRef'
} ,{
fieldLabel: '免箱期',
readOnly: true,
name: 'Freetime'
},{
fieldLabel: '船名',
readOnly: true,
name: 'Vessel'
},
{
fieldLabel: '航次',
readOnly: true,
name: 'Voyage'
}]
},
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '预计开船日',
format: 'Y-m-d',
xtype: 'datefield',
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
flex:1,readOnly: true,
name: 'Ex_sailingdate'
},{
fieldLabel: '开船日期',
format: 'Y-m-d',readOnly: true,
xtype: 'datefield',
name: 'Sailingdate',flex:1
},
{
fieldLabel: '到港日期',
format: 'Y-m-d',readOnly: true,
xtype: 'datefield',
name: 'ArrivalDate',flex:1
}, this.comboxPaymentMethods2
, this.comboxTransactionMethod2
]
},
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
{
fieldLabel: '付货款时间(预付)',
format: 'Y-m-d',readOnly: true,
xtype: 'datefield',
name: 'Prepaydate'
},{
fieldLabel: '电放时间',
format: 'Y-m-d',readOnly: true,
xtype: 'datefield',
name: 'E_Billtime'
},{
fieldLabel: '正本时间',
format: 'Y-m-d',readOnly: true,
xtype: 'datefield',
name: 'BillTime'
},{
fieldLabel: '换单时间',
format: 'Y-m-d',readOnly: true,
xtype: 'datefield',
name: 'HDtime'
},{xtype:'hiddenfield'}]
},
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '付货款时间(尾款)',
format: 'Y-m-d',readOnly: true,
xtype: 'datefield',
name: 'Paydate',flex:1},
this.comboxBillType2,
this.comboxReceiptStatus2,
this.comboxRCVMode2]
},
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '寄单情况',readOnly: true,
name: 'Receiptremark',
flex:4
},this.comboxTRADINGAGENCY2 ]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '分公司接单日期',flex: 1,
format: 'Y-m-d H:i:s',readOnly: true,
xtype: 'datefield',
name: 'CreateTime_2'
}, {
fieldLabel: '分公司转单日期', flex: 1,
format: 'Y-m-d H:i:s',readOnly: true,
xtype: 'datefield',
name: 'ResendTime'
}, {
fieldLabel: '靠泊码头',flex: 1,
readOnly: true,
name: 'Dock'
}, {
fieldLabel: '报关行',flex: 1,
readOnly: true,
name: 'Customs_broker'
}, {
fieldLabel: '报检行',flex: 1,
readOnly: true,
name: 'inspection_broker'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [ this.comboxContainerType2
,{
fieldLabel: '国外寄单快递号',
readOnly:true,
name: 'BILLTRANCNO'//,id:"BILLTRANCNO"
,flex:1
} , {
xtype: 'checkbox', flex: 1,
readOnly:true,
fieldLabel: '是否锁汇',
name: 'LOCK_EXCHANGERATE'
}, {
flex: 1,
fieldLabel: '锁汇汇率',
readOnly:true,
name: 'EXCHANGERATE'
}
,{xtype:'hiddenfield',flex:1}]
},
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '____备注1',
readOnly:true,
name: 'remark',flex:3
}]
},
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxMainstate2,
this.comboxCIQ_canbesearch2,
{
fieldLabel: '卫生许可证(ciq)',
name: 'CIQ_licence',readOnly:true
},
this.comboxPrinted2
]
},
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [ {
fieldLabel: '报检日期',
format: 'Y-m-d H:i:s',
xtype: 'datefield',//readOnly:true,
name: 'inspection_Signup_date'
},{
fieldLabel: '报检号',
readOnly:true,
name: 'inspection_no'
},this.comboxWriteoffs2
,this.comboxAutoAPP2
]
},
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '____备注2',
readOnly:true,
name: 'remark_2'
}]
},
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '出税日期',flex:1,
readOnly:true,
format: 'Y-m-d H:i:s',
xtype: 'datefield',
name: 'tax_date'
},
{
fieldLabel: '付税日期',flex:1,
readOnly:true,
format: 'Y-m-d H:i:s',
xtype: 'datefield',
name: 'tax_paydate'
},this.comboxSampling_need2,
this.comboxSecurityDeposit2,
{
fieldLabel: '报关单号',
readOnly:true,
name: 'DeclareNumber'
}
]
},
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [ {
fieldLabel: '海关确定抽检',
format: 'Y-m-d',
readOnly:true,
xtype: 'datefield',
name: 'SamplingDate_Plan'
},
{
fieldLabel: '海关实际验货',
format: 'Y-m-d',
readOnly:true,
xtype: 'datefield',
name: 'SamplingDate_Act'
},{
fieldLabel: '海关放行日期',
format: 'Y-m-d',
readOnly:true,
xtype: 'datefield',
name: 'CustomsReleaseDate'
},{
fieldLabel: '回空日期',
format: 'Y-m-d',
readOnly:true,
xtype: 'datefield',
name: 'RecDate'
},
{
fieldLabel: '港口天数',
name: 'PortDays',
readOnly:true
}]
},
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '____备注3',
readOnly:true,
name: 'remark_3'
}]
},
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '商检验货日期',
readOnly:true,
format: 'Y-m-d',
xtype: 'datefield',
name: 'inspection_date',flex:2
},{
fieldLabel: '启封/整改放行日',
readOnly:true,
format: 'Y-m-d',
xtype: 'datefield',
name: 'Unsealdate',flex:2
},
this.comboxInspection_Storage2,
this.comboxISREFORM2,
{
fieldLabel: '送货日',
readOnly:true,
format: 'Y-m-d',
xtype: 'datefield',
name: 'DeliveryDate',flex:2
},{
fieldLabel: '送货地址',
readOnly:true,
name: 'DeliveryAddress',flex:2
}
]
},
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '联系人',
readOnly:true,
name: 'Contacter',
flex:1
},{
fieldLabel: '电话',
readOnly:true,
name: 'Tel',flex:1
},{
fieldLabel: '溢短装',
readOnly:true,
name: 'Overfilled',flex:3
}]
},
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '备注4',
readOnly:true,
name: 'remark_4'
}]
},
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
xtype : 'checkbox',flex:1,
fieldLabel: '库存清空',
readOnly:true,
name: 'KCClear'
},this.comboxBUZTYPE2,
this.comboxInspection_Buyer2,
{
xtype : 'checkbox',flex:1,
readOnly:true,
fieldLabel: '已有合同',
name: 'HaveContract'
},
{
xtype : 'checkbox',flex:1,
readOnly:true,
fieldLabel: '有商品标签',
name: 'HaveCargoMark'
},
{
fieldLabel: 'hiddenfield',
xtype: 'hiddenfield',
name: 'hidden3',flex:0
},
{
fieldLabel: 'MZBZ',
name: 'MZBZ',hidden:true,
listeners: {
//添加日期选择事件
"change": function () {
//alert("MZBZ");
},
scope: this
}
},
{
fieldLabel: 'LOADFINISH',
name: 'LOADFINISH',hidden:true,
listeners: {
//添加日期选择事件
"change": function () {
this.setSaveBtnEnable(true);
},
scope: this
}
}
]
}]
}]
});
//#region 双击更新事件
//提单号
var _form=this.formLocal.getForm();
_this=this;
_form.findField('BillNo').on('render', function(c){
c.getEl().on('dblclick', function(){
var Value = _this.formLocal.getForm().findField('BillNo').getValue();
_this.SetDiffValue('BillNo',Value);
});
});
//箱号
_form.findField('ContainerNo').on('render', function(c){
c.getEl().on('dblclick', function(){
var Value = _this.formLocal.getForm().findField('ContainerNo').getValue();
_this.SetDiffValue('ContainerNo',Value);
});
});
//封号
_form.findField('SealNo').on('render', function(c){
c.getEl().on('dblclick', function(){
var Value = _this.formLocal.getForm().findField('SealNo').getValue();
_this.SetDiffValue('SealNo',Value);
});
});
//船公司
_form.findField('ShipCompany_id').on('render', function(c){
c.getEl().on('dblclick', function(){
var Value = _this.formLocal.getForm().findField('ShipCompany_id').getValue();
_this.SetDiffValue('ShipCompany_id',Value);
});
});
//船名
_form.findField('Vessel').on('render', function(c){
c.getEl().on('dblclick', function(){
var Value = _this.formLocal.getForm().findField('Vessel').getValue();
_this.SetDiffValue('Vessel',Value);
});
});
//航次
_form.findField('Voyage').on('render', function(c){
c.getEl().on('dblclick', function(){
var Value = _this.formLocal.getForm().findField('Voyage').getValue();
_this.SetDiffValue('Voyage',Value);
});
});
//预计开船日
_form.findField('Ex_sailingdate').on('render', function(c){
c.getEl().on('dblclick', function(){
var Value = _this.formLocal.getForm().findField('Ex_sailingdate').getValue();
_this.SetDiffValue('Ex_sailingdate',Value);
});
});
//开船日
_form.findField('Sailingdate').on('render', function(c){
c.getEl().on('dblclick', function(){
var Value = _this.formLocal.getForm().findField('Sailingdate').getValue();
_this.SetDiffValue('Sailingdate',Value);
});
});
//到港日
_form.findField('ArrivalDate').on('render', function(c){
c.getEl().on('dblclick', function(){
var Value = _this.formLocal.getForm().findField('ArrivalDate').getValue();
_this.SetDiffValue('ArrivalDate',Value);
});
});
//回空日期
_form.findField('RecDate').on('render', function(c){
c.getEl().on('dblclick', function(){
var Value = _this.formLocal.getForm().findField('RecDate').getValue();
_this.SetDiffValue('RecDate',Value);
});
});
//出税日期
_form.findField('tax_date').on('render', function(c){
c.getEl().on('dblclick', function(){
var Value = _this.formLocal.getForm().findField('tax_date').getValue();
_this.SetDiffValue('tax_date',Value);
});
});
//付税日期
_form.findField('tax_paydate').on('render', function(c){
c.getEl().on('dblclick', function(){
var Value = _this.formLocal.getForm().findField('tax_paydate').getValue();
_this.SetDiffValue('tax_paydate',Value);
});
});
//海关验货日
_form.findField('SamplingDate_Act').on('render', function(c){
c.getEl().on('dblclick', function(){
var Value = _this.formLocal.getForm().findField('SamplingDate_Act').getValue();
_this.SetDiffValue('SamplingDate_Act',Value);
});
});
//海关放行日
_form.findField('CustomsReleaseDate').on('render', function(c){
c.getEl().on('dblclick', function(){
var Value = _this.formLocal.getForm().findField('CustomsReleaseDate').getValue();
_this.SetDiffValue('CustomsReleaseDate',Value);
});
});
//港口天数
_form.findField('PortDays').on('render', function(c){
c.getEl().on('dblclick', function(){
var Value = _this.formLocal.getForm().findField('PortDays').getValue();
_this.SetDiffValue('PortDays',Value);
});
});
//商检验货日
_form.findField('inspection_date').on('render', function(c){
c.getEl().on('dblclick', function(){
var Value = _this.formLocal.getForm().findField('inspection_date').getValue();
_this.SetDiffValue('inspection_date',Value);
});
});
//合同号
_form.findField('HTH').on('render', function(c){
c.getEl().on('dblclick', function(){
var Value = _this.formLocal.getForm().findField('HTH').getValue();
_this.SetDiffValue('HTH',Value);
});
});
//贸易商(国外销售者)
_form.findField('seller').on('render', function(c){
c.getEl().on('dblclick', function(){
var Value = _this.formLocal.getForm().findField('seller').getValue();
_this.SetDiffValue('seller',Value);
});
});
//购货方
_form.findField('buyer').on('render', function(c){
c.getEl().on('dblclick', function(){
var Value = _this.formLocal.getForm().findField('buyer').getValue();
_this.SetDiffValue('buyer',Value);
});
});
//用证公司
_form.findField('company').on('render', function(c){
c.getEl().on('dblclick', function(){
var Value = _this.formLocal.getForm().findField('company').getValue();
_this.SetDiffValue('company',Value);
});
});
//双抬头
_form.findField('STT').on('render', function(c){
c.getEl().on('dblclick', function(){
var Value = _this.formLocal.getForm().findField('STT').getValue();
_this.SetDiffValue('STT',Value);
});
});
//国家代码
_form.findField('countryid').on('render', function(c){
c.getEl().on('dblclick', function(){
var Value = _this.formLocal.getForm().findField('countryid').getValue();
_this.SetDiffValue('countryid',Value);
});
});
//免箱期
_form.findField('Freetime').on('render', function(c){
c.getEl().on('dblclick', function(){
var Value = _this.formLocal.getForm().findField('Freetime').getValue();
_this.SetDiffValue('Freetime',Value);
});
});
//成交方式
_form.findField('TransactionMethod').on('render', function(c){
c.getEl().on('dblclick', function(){
var Value = _this.formLocal.getForm().findField('TransactionMethod').getValue();
_this.SetDiffValue('TransactionMethod',Value);
});
});
//付款方式
_form.findField('PaymentMethods').on('render', function(c){
c.getEl().on('dblclick', function(){
var Value = _this.formLocal.getForm().findField('PaymentMethods').getValue();
_this.SetDiffValue('PaymentMethods',Value);
});
});
//是否已交保证金
_form.findField('SecurityDeposit').on('render', function(c){
c.getEl().on('dblclick', function(){
var Value = _this.formLocal.getForm().findField('SecurityDeposit').getValue();
_this.SetDiffValue('SecurityDeposit',Value);
});
});
//报检日期
_form.findField('inspection_Signup_date').on('render', function(c){
c.getEl().on('dblclick', function(){
var Value = _this.formLocal.getForm().findField('inspection_Signup_date').getValue();
_this.SetDiffValue('inspection_Signup_date',Value);
});
});
//报检号
_form.findField('inspection_no').on('render', function(c){
c.getEl().on('dblclick', function(){
var Value = _this.formLocal.getForm().findField('inspection_no').getValue();
_this.SetDiffValue('inspection_no',Value);
});
});
//寄单情况
_form.findField('Receiptremark').on('render', function(c){
c.getEl().on('dblclick', function(){
var Value = _this.formLocal.getForm().findField('Receiptremark').getValue();
_this.SetDiffValue('Receiptremark',Value);
});
});
//提单提交方式
_form.findField('BillType').on('render', function(c){
c.getEl().on('dblclick', function(){
var Value = _this.formLocal.getForm().findField('BillType').getValue();
_this.SetDiffValue('BillType',Value);
});
});
//分公司接单日期
_form.findField('CreateTime_2').on('render', function(c){
c.getEl().on('dblclick', function(){
var Value = _this.formLocal.getForm().findField('CreateTime_2').getValue();
_this.SetDiffValue('CreateTime_2',Value);
});
});
//分公司转单日期
_form.findField('ResendTime').on('render', function(c){
c.getEl().on('dblclick', function(){
var Value = _this.formLocal.getForm().findField('ResendTime').getValue();
_this.SetDiffValue('ResendTime',Value);
});
});
//国外寄单快递号
_form.findField('BILLTRANCNO').on('render', function(c){
c.getEl().on('dblclick', function(){
var Value = _this.formLocal.getForm().findField('BILLTRANCNO').getValue();
_this.SetDiffValue('BILLTRANCNO',Value);
});
});
//换单时间
_form.findField('HDtime').on('render', function(c){
c.getEl().on('dblclick', function(){
var Value = _this.formLocal.getForm().findField('HDtime').getValue();
_this.SetDiffValue('HDtime',Value);
});
});
//备注1
_form.findField('remark').on('render', function(c){
c.getEl().on('dblclick', function(){
var Value = _this.formLocal.getForm().findField('remark').getValue();
_this.SetDiffValue('remark',Value);
});
});
//备注2
_form.findField('remark_2').on('render', function(c){
c.getEl().on('dblclick', function(){
var Value = _this.formLocal.getForm().findField('remark_2').getValue();
_this.SetDiffValue('remark_2',Value);
});
});
//备注3
_form.findField('remark_3').on('render', function(c){
c.getEl().on('dblclick', function(){
var Value = _this.formLocal.getForm().findField('remark_3').getValue();
_this.SetDiffValue('remark_3',Value);
});
});
//是否整改
_form.findField('ISREFORM').on('render', function(c){
c.getEl().on('dblclick', function(){
var Value = _this.formLocal.getForm().findField('ISREFORM').getValue();
_this.SetDiffValue('ISREFORM',Value);
});
});
//正本时间
_form.findField('BillTime').on('render', function(c){
c.getEl().on('dblclick', function(){
var Value = _this.formLocal.getForm().findField('BillTime').getValue();
_this.SetDiffValue('BillTime',Value);
});
});
//卫生证是否可查
_form.findField('CIQ_canbesearch').on('render', function(c){
c.getEl().on('dblclick', function(){
var Value = _this.formLocal.getForm().findField('CIQ_canbesearch').getValue();
_this.SetDiffValue('CIQ_canbesearch',Value);
});
});
//#endregion
//#endregion this.formLocal
//#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.RefTableCombox', {
store: this.storeCargoinfo,
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.RefTableCombox', {
store: this.storeCargociq,
name: 'Cargociq_id',
valueField: 'id',
displayField: 'codeandname'
//ciq代码
});
/*
this.storecurr = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsFeeCurr',
proxy: { url: '/MvcShipping/MsChFee/GetCurrList' }
});
this.storecurr.load({ params: { condition: ""} });*/
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'
//币别
});
Ext.define('Exchangeratemb', {
extend: 'Ext.data.Model',
fields: [
{ name: 'VALUE', type: 'string' },
{ name: 'SOURACE', type: 'string' }
]
});
/* var ISPAYEDData = [{ "ID": "0", "ISPAYED": "全部" },
{ "ID": "1", "ISPAYED": "已支付" },
{ "ID": "2", "ISPAYED": "未支付"}];*/
this.storeExchangerate = Ext.create('Ext.data.Store', {
model: 'Exchangeratemb'
});
this.comboxExchangerate = Ext.create('DsExt.ux.RefTableCombox', {
//fieldLabel: '支付状态',
store: this.storeExchangerate,
name: 'Exchangerate', //id: "ISPAYED",
valueField: 'VALUE',
displayField: 'SOURACE'
});
this.storecurrQZ = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsFeeCurr',
proxy: { url: '/MvcShipping/MsChFee/GetCurrList' }
});
this.storecurrQZ.load({ params: { condition: ""} });
this.comboxcurr_2 = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storecurr,
name: 'Currency',
valueField: 'codename',
displayField: 'codename'
//币别
});
//枚举参照
this.storeUnit = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeUnit.load({ params: { enumTypeId: 11} });
this.comboxUnit = Ext.create('DsExt.ux.RefEnumCombox', {
store: this.storeUnit,
name: 'Unit'
});
this.storepaypart = Ext.create('DsExt.ux.RefEnumStore', {});
this.storepaypart.load({ params: { enumTypeId: 12} });
this.comboxpaypart = Ext.create('DsExt.ux.RefEnumCombox', {
store: this.storepaypart,
name: 'paypart'
});
//商品规格 20160420
this.storeSPECIFICATIONS = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeSPECIFICATIONS.load({ params: { enumTypeId: 34} });
this.comboxSPECIFICATIONS = Ext.create('DsExt.ux.RefEnumCombox', {
store: this.storeSPECIFICATIONS,
readOnly:true,
name: 'SPECIFICATIONS',
valueField: 'EnumValueName',
displayField: 'EnumValueName'
});
//#endregion
//数据集
this.storeCargo = Ext.create('Ext.data.Store', {
model: 'Cargomb',
remoteSort: false,
proxy: {
type: 'ajax',
url: '/Import/XXH/GetCargoList',
reader: {
id: 'id,ContractNo',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//表格
this.cellEditingCargo = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.cargoCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
this.column=[{
dataIndex: 'id',
header: '自增序列号',
width: 80,
hidden: true,
editor: {
xtype: 'textfield'
}
},
{
dataIndex: 'ContractNo',
header: '合同号',
width: 80,
hidden: true
},
{
dataIndex: 'SEQUENCE',
header: '序号',
width: 44
},
{
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: 'name',
header: '货名',
width: 80
},{
dataIndex: 'Ename',
header: '英文品名',
width: 100
},{
dataIndex: 'SPECIFICATIONS',
header: '商品规格',
width: 60,
editor: this.comboxSPECIFICATIONS
}, {
dataIndex: 'CargoType',
header: '产品类型',
width: 50
},{
dataIndex: 'SBYS',
header: '申报要素',
width: 160,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}, {
dataIndex: 'AGENCRATE',
header: '代理费率(元/吨)',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},
{
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: this.comboxExchangerate
},{
dataIndex: 'Exchangerate_Customs',
header: '汇率_海关',
width: 75,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},
{
dataIndex: 'U_PRICE',
header: '单价(重量单位)',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},
{
dataIndex: 'U_weight',
header: '净重(重量单位)',
width: 80,
editor: {
xtype: 'numberfield',
allowDecimals: true,
decimalPrecision: 6,
selectOnFocus: true
}
},
{
dataIndex: 'price',
header: '单价(币别/kg)',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},
{
dataIndex: 'weight',
header: '净重(kg)',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},
{
dataIndex: 'm_weight',
header: '毛重',
width: 50,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},
{
dataIndex: 'BoxCount',
header: '箱/件数',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},
{
dataIndex: 'BoxWeight',
header: '规格',
width: 50,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},
{
dataIndex: 'price_agio',
header: '单价(差价价格)',
width: 50,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},
{
dataIndex: 'price_limit',
header: '海关估价',
width: 60,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},
{
dataIndex: 'pay_Amount',
header: '合同金额',
width: 120/*,
editor: {
xtype: 'textfield',
selectOnFocus: true
}*/
},
{
dataIndex: 'tax_Amount',
header: '完税价格(外币)',
width: 87/*,
editor: {
xtype: 'textfield',
selectOnFocus: true
*/
},
{
dataIndex: 'tax_Amount_RMB',
header: '完税价格(RMB)',
width: 87
},
{
dataIndex: 'baolv',
header: '保率',
width: 55
},
{
dataIndex: 'Amount',
header: '合同金额(对客户)',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},
{
dataIndex: 'PreProportion',
header: '预付比例%',
width: 80,
//hidden: true,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},{
dataIndex: 'prepayments',
header: '预付款(应收)',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},{
dataIndex: 'balance',
header: '尾款(应收)',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},{
dataIndex: 'pay_prepayments',
header: '预付款(应付)',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},{
dataIndex: 'pay_balance',
header: '尾款(应付)',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},
{
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
}
},
{
dataIndex: 'tax',
header: '关税税率',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},
{
dataIndex: 'tax_zz',
header: '增值税税率',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},{
dataIndex: 'tax_1',
header: '关税(应收)',
width: 80
},
{
dataIndex: 'tax_zz_1',
header: '增值税(应收)',
width: 80
},{
dataIndex: 'tax_2',
header: '关税(应付)',
width: 80
},
{
dataIndex: 'tax_zz_2',
header: '增值税(应付)',
width: 80
},
{
dataIndex: 'Exporter',
header: '出口商',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},
{
dataIndex: 'FactoryNo',
header: '厂号',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},
{
dataIndex: 'Productiondate',
header: '生产日期',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},
{
dataIndex: 'BZTCHNO',
header: '批号',
width: 80
},
{
dataIndex: 'Declarenumber',
header: '报关单号',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},
{
dataIndex: 'AMOUNT_WRITEOFFS',
header: '申证金额',
width: 80
},{
dataIndex: 'REMARK',
header: '备注',
width: 140,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},{
dataIndex: 'SHIJIGUANSHUI',
header: '实际关税',
width: 140,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},{
dataIndex: 'SHIJIZENGZHISHUI',
header: '实际增值税',
width: 140,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},{
dataIndex: 'XIANJIAJINE',
header: '现价金额',
width: 140,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},{
dataIndex: 'BAOZHENGJIN',
header: '保证金',
width: 140,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},{
dataIndex: 'ZHIBAOJIN',
header: '滞报金',
width: 140,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},{
dataIndex: 'ZONGJINE',
header: '总金额',
width: 140
}];
var _this=this;
this.formCargo = new Ext.grid.GridPanel({
store: this.storeCargo,
enableHdMenu: false,
region: 'center',
//height: 160,
title: '商品信息',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
plugins: [this.cellEditingCargo],
selModel: this.cargoCheckBoxModel,
selType: 'cellmodel',
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: '库存初始化',id:"KCStart",
iconCls: "btnKCStart",
handler: function (button, event) {
this.onKCStartClick(button, event);
},
scope: this
}, '-', {
text: '生成应收应付',
tooltip: '生成应收应付',
iconCls: "btnCWStart",id:"CWStart",
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.column
});
this.column= DsTruck.GetGridPanel(USERID, this.CargoListName, this.column);
//使用者id表名 中间column数组跳过一开始的几列
this.formCargo.reconfigure(this.storeList, this.column);
this.formCargo.addListener('cellclick', function(view, cell, cellIdx, record, row, rowIdx, eOpts) {
if(cellIdx === 4){
//alert(record.get('cargoinfo_id'));
//if (!record.get('cargoinfo_id')>=0) return;
var s=" cargoinfoid="+record.get('cargoinfo_id');
//alert(s);
this.storeCargociq.load({ params: { condition: s} });
}
}, this);
/* listeners: {
beforecellmousedown: function(view, cell, cellIdx, record, row, rowIdx, eOpts){
if(cellIdx === 1){
alert("dfd");
}
}
} */
//#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_CHFEE = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeCargo,
name: 'cargo_id',
valueField: 'GID',
displayField: 'NAME_REF'
});
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
}
]
});
//end--------------------------------------------------//明细<<<< 许可证使用 >>>>结束
//#endregion////////////////////////////////
//#region 明细 库存管理
//#region 枚举参照
this.storeczstate = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeczstate.load({ params: { enumTypeId: 8} });
this.comboxczstate = Ext.create('DsExt.ux.RefEnumCombox', {
forceSelection: true,
store: this.storeczstate,
name: 'czstate'
});
this.storekfstate = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsTruckMng.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' } });
this.storekfstate.load({ params: { condition: " ISWAREHOUSE=1" } });
this.comboxkfstate = Ext.create('DsExt.ux.RefTableCombox', {
forceSelection: true,
store: this.storekfstate,
name: 'kfstate',
valueField: 'CustName',
displayField: 'KFCodename'
});
this.comboxCargo = Ext.create('DsExt.ux.RefTableCombox', {
forceSelection: true,
store: this.storeCargo,
name: 'cargo_id',
valueField: 'id',
displayField: 'NAME_REF'
});
this.storeKCFeeName = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsTruckMng.ux.FeeTypeRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetFeeTypeRefList' }
});
this.storeKCFeeName.load({ params: { condition: ""} });
this.comboxKCFeeName = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeKCFeeName,
name: 'FeeName',
valueField: 'Name',
displayField: 'CodeAndName'
});
this.storeSended = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeSended.load({ params: { enumTypeId: 0 } });
this.comboxSended = Ext.create('DsExt.ux.RefEnumCombox', {
//fieldLabel: '是否已生成费用',
store: this.storeSended,
name: 'Sended'
});
this.storePLEDGE = Ext.create('DsExt.ux.RefTableStore', {
model: 'Tradermb',
proxy: { url: '/CommMng/BasicDataRef/GetTrader' }
});
this.storePLEDGE.load({ params: { condition: " 1=1 "} });
this.comboxPLEDGE = Ext.create('DsExt.ux.RefTableCombox', {
//fieldLabel: '质押权',
forceSelection: true,
store: this.storePLEDGE,
name: 'PLEDGE',
valueField: 'name',
displayField: 'codename'
});
this.comboxNEWPLEDGE = Ext.create('DsExt.ux.RefTableCombox', {
//fieldLabel: '质押权',
forceSelection: true,
store: this.storePLEDGE,
name: 'NEWPLEDGE',
valueField: 'name',
displayField: 'codename'
});
//#endregion
//结果集
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.KCModel = Ext.create('Ext.selection.CheckboxModel');
this.formKC = new Ext.grid.GridPanel({
store: this.storeKC,
enableHdMenu: false,
region: 'center',
title: '库存 (注意,商品信息保存后才能选择使用许可证和商品)',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
plugins: [this.cellEditingKC],
selType: 'cellmodel',
selModel: this.KCModel,
autoScroll: true,
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
}, '-', {
text: '生成选定费用',
tooltip: '生成选定费用',id:"ApplicationAdd",
iconCls: "ApplicationAdd",
handler: function (button, event) {
this.onKCFeeClick(button, event);
},
scope: this
}, {
text: '选定货物质押权转给:',
tooltip: '必须选择入库货物和新质押人',id:"PLEDGEChange",
iconCls: "ApplicationAdd",
handler: function (button, event) {
this.onPLEDGEClick(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: 120
},
{
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.kfstate;
},
editor: this.comboxkfstate,
width: 110
},
{
dataIndex: 'PLEDGE',
header: '质押权',
renderer: function (value, p, record) {
if (value == null || value == '')
return '';
else
return record.data.PLEDGE;
},
editor: this.comboxPLEDGE,
width: 110
},
{
dataIndex: 'czdate',
header: '操作时间',
width: 90,
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
editor: {
xtype: 'datefield',
selectOnFocus: true
}
},{
dataIndex: 'days',
header: '天数',
width: 45,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},{
sortable: true,
dataIndex: 'FeeName',
header: '费用名称',
editor: this.comboxKCFeeName,
width: 80
},{
dataIndex: 'UnitPrice',
header: '单价',
width: 45,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},{
dataIndex: 'Quantity',
header: '数量(吨)',
width: 65,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},{
dataIndex: 'Amount',
header: '金额',
width: 45,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},{
dataIndex: 'Sended',
header: '已生成费用',
renderer: function (value, p, record) {
if (value == null || value == '')
return '';
else
return record.data.Sended;
},
editor: this.comboxSended,
width: 80
},
{
dataIndex: 'TRUCKNO',
header: '车号',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},
{
dataIndex: 'TRUCKTEL',
header: '司机电话',
width: 100,
editor: {
xtype: 'textfield',
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: '付款方式',flex:1,
forceSelection: true,
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.storeReceiptName = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeReceiptName.load({ params: { enumTypeId: 2} });
this.comboxReceiptName = Ext.create('DsExt.ux.RefEnumCombox', {
//fieldLabel: '单据类型',
store: this.storeReceiptName,
name: 'RECEIPTNAME',
valueField: 'EnumValueName',
displayField: 'EnumValueName'
});
//单据表-数据集
this.storeReceipt = Ext.create('Ext.data.Store', {
model: 'MsOpReceiptEntity',
remoteSort: false,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsOpReceipt/GetDataList',
reader: {
id: 'GID',
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: 'north',
height:240,
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
}],
columns: [
{
sortable: true,
dataIndex: 'GID',
header: '惟一编号',
hidden: true,
width: 0
}, {
sortable: true,
dataIndex: 'BSNO',
header: '业务编号',
hidden: true,
width: 0
}, {
sortable: true,
dataIndex: 'RECEIPTNO',
header: '单据编号',
editor: {
xtype: 'textfield',
selectOnFocus: true,
enableKeyEvents: true,
listeners: {
keydown: function (textfield, e) {
if (e.getKey() == 40) {
_this.onNextKeyClick(17)
}
}
}
},
width: 100
}, {
sortable: true,
dataIndex: 'RECEIPTTYPE',
header: '单据类型',
editor: this.comboxReceiptName,
width: 80
}, {
sortable: true,
dataIndex: 'RECEIVE_MAN',
header: '接单人',
//editor: SHOWNAME,
editor: {
xtype: 'textfield',
selectOnFocus: true,
enableKeyEvents: true,
listeners: {
keydown: function (textfield, e) {
if (e.getKey() == 40) {
_this.onNextKeyClick(17)
}
}
}
},
width: 80
}, {
sortable: true,
dataIndex: 'RECEIVE_DATE',
header: '接单日期',
renderer: Ext.util.Format.dateRenderer('Y-m-d'), //format是'm/d/Y'结果是”09/24/2008”
editor: {
//dateFormat: Ext.util.Format.dateRenderer('Y-m-d'),
format: 'Y-m-d',
xtype: 'datefield',
selectOnFocus: true
},
width: 80
}, {
sortable: true,
dataIndex: 'SEND_MAN',
header: '送单人',
//editor: SHOWNAME,
editor: {
xtype: 'textfield',
selectOnFocus: true,
enableKeyEvents: true,
listeners: {
keydown: function (textfield, e) {
if (e.getKey() == 40) {
_this.onNextKeyClick(17)
}
}
}
},
width: 80
}, {
sortable: true,
dataIndex: 'SEND_DATE',
header: '送单日期',
renderer: Ext.util.Format.dateRenderer('Y-m-d'), //format是'm/d/Y'结果是”09/24/2008”
editor: {
//dateFormat: Ext.util.Format.dateRenderer('Y-m-d'),
format: 'Y-m-d',
xtype: 'datefield',
selectOnFocus: true
},
width: 80
}, {
sortable: true,
dataIndex: 'TRANCER',
header: '送单快递公司',
editor: {
xtype: 'textfield',
selectOnFocus: true,
enableKeyEvents: true,
listeners: {
keydown: function (textfield, e) {
if (e.getKey() == 40) {
_this.onNextKeyClick(17)
}
}
}
},
width: 80
}, {
sortable: true,
dataIndex: 'TRANCNO',
header: '送单快递单号',
editor: {
xtype: 'textfield',
selectOnFocus: true,
enableKeyEvents: true,
listeners: {
keydown: function (textfield, e) {
if (e.getKey() == 40) {
_this.onNextKeyClick(17)
}
}
}
},
width: 80
}, {
sortable: true,
dataIndex: 'ISREPEAT',
header: '是否回单',
//xtype: "checkboxfield",
//xtype:"booleancolumn",
//trueText: "是",
//falseText: " ",
editor: {
xtype: 'checkboxfield'
},
width: 60
}, {
sortable: true,
dataIndex: 'REPEAT_MAN',
header: '回单人',
//editor: SHOWNAME,
editor: {
xtype: 'textfield',
selectOnFocus: true,
enableKeyEvents: true,
listeners: {
keydown: function (textfield, e) {
if (e.getKey() == 40) {
_this.onNextKeyClick(17)
}
}
}
},
width: 80
}, {
sortable: true,
dataIndex: 'REPEAT_DATE',
header: '回单日期',
renderer: Ext.util.Format.dateRenderer('Y-m-d'), //format是'm/d/Y'结果是”09/24/2008”
editor: {
//dateFormat: Ext.util.Format.dateRenderer('Y-m-d'),
format: 'Y-m-d',
xtype: 'datefield',
selectOnFocus: true
},
width: 80
}, {
sortable: true,
dataIndex: 'ISRECEIVE',
header: '是否还单',
editor: {
xtype: 'checkboxfield'
},
width: 60
}, {
sortable: true,
dataIndex: 'RETURN_MAN',
header: '还单人',
//editor: SHOWNAME,
editor: {
xtype: 'textfield',
selectOnFocus: true,
enableKeyEvents: true,
listeners: {
keydown: function (textfield, e) {
if (e.getKey() == 40) {
_this.onNextKeyClick(17)
}
}
}
},
width: 80
}, {
sortable: true,
dataIndex: 'RETURN_DATE',
header: '还单日期',
renderer: Ext.util.Format.dateRenderer('Y-m-d'), //format是'm/d/Y'结果是”09/24/2008”
editor: {
//dateFormat: Ext.util.Format.dateRenderer('Y-m-d'),
format: 'Y-m-d',
xtype: 'datefield',
selectOnFocus: true
},
width: 80
}, {
sortable: true,
dataIndex: 'RETURN_TRANCER',
header: '还单的快递公司',
editor: {
xtype: 'textfield',
selectOnFocus: true,
enableKeyEvents: true,
listeners: {
keydown: function (textfield, e) {
if (e.getKey() == 40) {
_this.onNextKeyClick(17)
}
}
}
},
width: 100
}, {
sortable: true,
dataIndex: 'RETURN_TRANCNO',
header: '还单的快递单号',
editor: {
xtype: 'textfield',
selectOnFocus: true,
enableKeyEvents: true,
listeners: {
keydown: function (textfield, e) {
if (e.getKey() == 40) {
_this.onNextKeyClick(17)
}
}
}
},
width: 100
}, {
sortable: true,
dataIndex: 'REMARK',
header: '备注',
editor: {
xtype: 'textfield',
selectOnFocus: true,
enableKeyEvents: true,
listeners: {
keydown: function (textfield, e) {
if (e.getKey() == 40) {
_this.onNextKeyClick(17)
}
}
}
},
width: 200
}, {
sortable: true,
dataIndex: 'CORPID',
header: '分公司代码',
hidden: true,
width: 0
}, {
sortable: true,
dataIndex: 'CREATEUSER',
header: '创建人',
width: 0
}, {
sortable: true,
dataIndex: 'CREATETIME',
header: '创建时间',
width: 0
}, {
sortable: true,
dataIndex: 'MODIFIEDUSER',
header: '最后更改人',
width: 0
}, {
sortable: true,
dataIndex: 'MODIFIEDTIME',
header: '最后更改时间',
width: 0
}
]
});
//#endregion
//#region 明细表-单据图片档案管理
this.storeReceiptid_DOC = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeReceiptid_DOC.load({ params: { enumTypeId: 2} });
this.comboxReceiptid_DOC = Ext.create('DsExt.ux.RefEnumCombox', {
store: this.storeReceiptid_DOC,
name: 'RECEIPTTYPE',
valueField: 'EnumValueName',
displayField: 'EnumValueName'
});
this.storeDocList = Ext.create('Ext.data.Store', {
model: 'ReceiptDocmb',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/Import/ReceiptDoc/GetDocList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//明细表表格
this.DocListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.DocCM = Ext.create('Ext.selection.CheckboxModel');
this.gridDocList = new Ext.grid.GridPanel({
store: this.storeDocList,
enableHdMenu: false,
region: 'west',
width: 350,
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
plugins: [this.DocListCellEditing],
selModel: this.DocCM,
selType: 'cellmodel',
tbar: [{
text: '添加',
tooltip: '添加',
iconCls: "btnadddetail",
handler: function (button, event) {
this.onAddFileClick(button, event);
},
scope: this
}, '-', {
text: '删除',
tooltip: '删除',
iconCls: "btndeletedetail",
handler: function (button, event) {
this.onDelFileClick(button, event);
},
scope: this
}, '-', {
text: '保存',
tooltip: '保存',
iconCls: "btnsave",
handler: function (button, event) {
this.onPostFileClick(button, event);
},
scope: this
}, '-', {
text: '上传附件',
tooltip: '上传附件',
iconCls: "btnadddetail",
handler: function (button, event) {
this.onUpLoadFileClick(button, event);
},
scope: this
}],
columns: [{
sortable: true, hidden: true,
dataIndex: 'GID',
header: 'GID',
width: 80
},
{
sortable: true,
dataIndex: 'RECEIPTTYPE',
header: '单据类型',
editor: this.comboxReceiptid_DOC,
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'R_GID',
header: 'R_GID',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'BSNO',
header: 'BSNO',
width: 80
},
{
sortable: true,
dataIndex: 'URL',
header: '文件名',
width: 140,
editor: {
xtype: 'textfield'
}
},
{
sortable: true, hidden: true,
dataIndex: 'Driect_URL',
header: 'Driect_URL',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'MODIFIEDUSER',
header: 'MODIFIEDUSER',
width: 80
},
{
sortable: true,
dataIndex: 'MODIFIEDUSERRef',
header: '修改人',
width: 80
},
{
sortable: true,
dataIndex: 'MODIFIEDTIME',
header: '修改时间',
width: 85
}
]
});
this.gridDocList.getSelectionModel().on('select', function (model, record, index) {
if (this.Loading == true) {
return;
}
var PICURL = record.data.Driect_URL;
Ext.getCmp('panelPic').body.update(' <iframe scrolling="auto" frameborder="0" width="100%" height="100%" src="' + PICURL + '"> </iframe>');
}, this);
//#endregion
//#region 明细表<<<应收应付/费用表>>>
//#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: 'Tradermb',
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,
allowBlank: false,
name: 'CustomerName',
valueField: 'name',
displayField: 'codename'
});
Ext.define('DeductibleMd', {
extend: 'Ext.data.Model',
fields: [
{ name: 'IsOpen', type: 'string' },
{ name: 'IsOpen_Ref', type: 'string' }
]
});
var IsOpenData = [{ "IsOpen": "0", "IsOpen_Ref": "否" },
{ "IsOpen": "1", "IsOpen_Ref": "是"}];
this.storeIsOpenType = Ext.create('Ext.data.Store', {
model: 'DeductibleMd',
data: IsOpenData
});
this.comboxIsOpen = Ext.create('DsExt.ux.RefEnumCombox', {
//fieldLabel: '是否机密费用',
forceSelection: true,
store: this.storeIsOpenType,
name: 'IsOpen',
valueField: 'IsOpen',
displayField: 'IsOpen_Ref'
});
//#endregion
//明细表-数据集
this.storeBodyChFee = Ext.create('Ext.data.Store', {
model: 'MsChFee',
remoteSort: false,
proxy: {
type: 'ajax',
url: '/Import/XXH/GetFeeList',
reader: {
id: 'GId',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.storeBodyChFee_YF = Ext.create('Ext.data.Store', {
model: 'MsChFee',
remoteSort: false,
proxy: {
type: 'ajax',
url: '/Import/XXH/GetFeeList',
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: [{xtype: 'label', id: 'label1', text: "应收费用"}, '-',{
text: '增加明细',
tooltip: '增加明细',id:"addChfee",
iconCls: "btnadddetail",
handler: function (button, event) {
this.onAddDetailClick(button, event, '1');
},
scope: this
}, {
text: '删除明细',
tooltip: '删除明细',id:"delChfee",
iconCls: "btndeletedetail",
handler: function (button, event) {
this.onDelDetailClick(button, event, '1');
},
scope: this
}, '-', {
text: '提交审核',
tooltip: '提交审核',id:"YSsubmitaudit",
iconCls: 'btnsubmitaudit',
handler: function (button, event) {
this.onSubmitAuditClick(button, event,"1");
},
scope: this
}, {
text: '撤回提交',
tooltip: '撤回提交',id:"YSsubmitauditback",
iconCls: 'btncomm',
handler: function (button, event) {
this.onRetractClick(button, event, "1");
},
scope: this
}, '-', {
text: '提交融资',
tooltip: '提交融资',id:"YSsubmitFinance",
iconCls: 'btnsubmitaudit',
handler: function (button, event) {
this.onSubmitRZClick(button, event,"1");
},
scope: this
}, {
text: '撤销融资',
tooltip: '撤销融资',id:"YSsubmitFinanceback",
iconCls: 'btncomm',
handler: function (button, event) {
this.onRetractRZClick(button, event, "1");
},
scope: this
},{ xtype: "label", id: "zongshu", text: "",
handler: function () { ; }
}],
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: '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: 'textfield',//numberfield
selectOnFocus: true
},
width: 120
}, {
sortable: true,
dataIndex: 'Quantity',
header: '数量',
editor: {
xtype: 'textfield',
selectOnFocus: true
},
width: 60
}, {
sortable: true,
dataIndex: 'Amount',
header: '金额',
width: 120
}, {
sortable: true,
dataIndex: 'Currency',
header: '币别',
editor:this.comboxcurr_2,
width: 50
}, {
sortable: true,
dataIndex: 'ExChangerate',
header: '汇率',
//hidden: true,
editor: {
xtype: 'textfield',
selectOnFocus: true
},
width: 60
}, {
sortable: true,
dataIndex: 'EnterDate',
header: '时间',
width: 80,
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
editor: {
format: 'Y-m-d',
xtype: 'datefield',
selectOnFocus: true
}
}, {
sortable: true,
dataIndex: 'Remark',
header: '备注',
editor: {
xtype: 'textfield',
selectOnFocus: true
},
width: 250
}, {
sortable: true,
dataIndex: 'CARGO_GID',
header: '商品信息',
editor: this.comboxCargo_CHFEE,
width: 120,
renderer: function (value, p, record) {
return record.data.CARGO_NAME;
}
}, {
sortable: true,hidden:true,
dataIndex: 'CARGO_NAME',
header: 'CARGO_NAME'
}, {
sortable: true,
dataIndex: 'IsOpen',
header: '是否机密费用',
editor: this.comboxIsOpen,
width: 80,
renderer: function (value, p, record) {
return record.data.IsOpen_Ref;
}
}, {
sortable: true,hidden:true,
dataIndex: 'IsOpen_Ref',
header: 'IsOpen_Ref'
}
]
});
this.cellEditingChFee_YF = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.feeGridCheckBoxModel_YF = Ext.create('Ext.selection.CheckboxModel');
this.gridListChFee_YF = new Ext.grid.GridPanel({
store: this.storeBodyChFee_YF,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
plugins: [this.cellEditingChFee_YF],
selModel: this.feeGridCheckBoxModel_YF,
selType: 'cellmodel',
viewConfig: {
autoFill: true,
getRowClass: function (record, rowIndex, rowParams, store) {
var feeStatus = record.get('FeeStatus');
return DsTruck.MsChFeeGetRowClass(feeStatus);
}
},
tbar: [{xtype: 'label', id: 'label2', text: "应付费用"}, '-',{
text: '增加明细',
tooltip: '增加明细',id:"addChfee_YF",
iconCls: "btnadddetail",
handler: function (button, event) {
this.onAddDetailClick(button, event, '2');
},
scope: this
}, '-', {
text: '删除明细',
tooltip: '删除明细',id:"delChfee_YF",
iconCls: "btndeletedetail",
handler: function (button, event) {
this.onDelDetailClick(button, event, '2');
},
scope: this
}, '-', {
text: '提交审核',
tooltip: '提交审核',id:"YFsubmitaudit",
iconCls: 'btnsubmitaudit',
handler: function (button, event) {
this.onSubmitAuditClick(button, event,"2");
},
scope: this
}, {
text: '撤回提交',
tooltip: '撤回提交',id:"YFsubmitauditback",
iconCls: 'btncomm',
handler: function (button, event) {
this.onRetractClick(button, event, "2");
},
scope: this
}, '-', {
text: '提交融资',
tooltip: '提交融资',id:"YFsubmitFinance",
iconCls: 'btnsubmitaudit',
handler: function (button, event) {
this.onSubmitRZClick(button, event,"2");
},
scope: this
}, {
text: '撤销融资',
tooltip: '撤销融资',id:"YFsubmitFinanceback",
iconCls: 'btncomm',
handler: function (button, event) {
this.onRetractRZClick(button, event, "2");
},
scope: this
},
{ xtype: "label", id: "zongshu_YF", text: "",
handler: function () { ; }
}],
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: 'textfield',//xtype: 'numberfield',
selectOnFocus: true
},
width: 120
}, {
sortable: true,
dataIndex: 'Quantity',
header: '数量',
editor: {
xtype: 'textfield',//xtype: 'numberfield',
selectOnFocus: true
},
width: 60
}, {
sortable: true,
dataIndex: 'Amount',
header: '金额',
width: 120
}, {
sortable: true,
dataIndex: 'Currency',
header: '币别',
editor:this.comboxcurr_2,
width: 50
}, {
sortable: true,
dataIndex: 'ExChangerate',
header: '汇率',
//hidden: true,
editor: {
xtype: 'textfield',
selectOnFocus: true
},
width: 60
}, {
sortable: true,
dataIndex: 'EnterDate',
header: '时间',
width: 80,
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
editor: {
format: 'Y-m-d',
xtype: 'datefield',
selectOnFocus: true
}
}, {
sortable: true,
dataIndex: 'Remark',
header: '备注',
editor: {
xtype: 'textfield',
selectOnFocus: true
},
width: 250
}, {
sortable: true,
dataIndex: 'CARGO_GID',
header: '商品信息',
editor: this.comboxCargo_CHFEE,
width: 120,
renderer: function (value, p, record) {
return record.data.CARGO_NAME;
}
}, {
sortable: true,hidden:true,
dataIndex: 'CARGO_NAME',
header: 'CARGO_NAME'
}, {
sortable: true,
dataIndex: 'IsOpen',
header: '是否机密费用',
editor: this.comboxIsOpen,
width: 80,
renderer: function (value, p, record) {
return record.data.IsOpen_Ref;
}
}, {
sortable: true,hidden:true,
dataIndex: 'IsOpen_Ref',
header: 'IsOpen_Ref'
}
]
});
//#endregion 明细表<<<应收应付/费用表>>>
//#region 下方显示毛利窗口
this.formML = Ext.widget('form', { // layout: "border",
region: 'center',
frame: true,
bodyPadding: 2,
fieldDefaults: {
margins: '1 1 1 1',
labelAlign: 'right',
flex: 5,
//labelWidth: 90,//label标签宽度
msgTarget: 'qtip',
sourcelabelWidth: '100' //,split:true
},
items: [
{ //fieldset 1
xtype: 'fieldset',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{ //1
//container_1
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{//0
fieldLabel: '人民币应收',
// allowBlank: false,
readOnly: true,
name: 'RMBYS'
},{
fieldLabel: '人民币应付',
// allowBlank: false,
readOnly: true,
name: 'RMBYF'
},{
fieldLabel: '人民币毛利',
// allowBlank: false,
readOnly: true,
name: 'RMBML'
}]//0
},
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '美元应收',
// allowBlank: false,
readOnly: true,
name: 'USDYS'
},{
fieldLabel: '美元应付',
// allowBlank: false,
readOnly: true,
name: 'USDYF'
},{
fieldLabel: '美元毛利',
// allowBlank: false,
readOnly: true,
name: 'USDML'
}]
},{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '毛利',
// allowBlank: false,
readOnly: true,
name: 'ML'
}]
}
]//container_1 //1
}//fieldset 1
]
}); //end this.formEdit
//#endregion --------显示毛利 end
//公共按钮Toolbar:panelBtn
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [
{
// id: "saveandclose",
text: "保存",
id:"btnSave",disabled: true,id:"SAVE1",
handler: function (button, event) {
this.Save('0');
},
scope: this
}, {
// id: "saveandclose",
text: "保存并关闭",
id:"btnSaveClose",disabled: true,id:"SAVE2",
handler: function (button, event) {
this.Save('1');
},
scope: this
}, '-',
{
// id: "saveandclose",
text: "关闭",
handler: function (button, event) {
window.close();
},
scope: this
}, '-',
{
// id: "saveandclose",
text: "打印",
handler: function (button, event) {
this.DoPrint();
},
scope: this
}, '-',
{
// id: "saveandclose",
text: "获取合同信息",
handler: function (button, event) {
this.OnClickXML();
},
scope: this
}
]
}); //end 按钮Toolbar
//#region 布局
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 32,
items: [this.panelBtn]//, this.formEdit]
});
// title: '货物信息和许可证使用',
this.panelCargoandApp = new Ext.Panel({
layout: "border",
region: 'south',
margin: '3 3',
height: 350,
autoScroll: true,
items: [this.formCargo/*, this.formAppstate*/]
});
this.panelYS = new Ext.Panel({
layout: "border",
region: "center",
height: 260,
split: true,
items: [this.gridListChFee]
});
this.panelYF = new Ext.Panel({
layout: "border",
region: "center",
height: 260,
split: true,
items: [this.gridListChFee_YF]
});
this.panelFEE = new Ext.Panel({
layout: "anchor",
region: "center",
//height: 510,
split: true,
items: [this.panelYS,this.panelYF]
});
this.panelML = new Ext.Panel({
layout: "border",id:"formML",
region: 'south',
height: 90,
margin: '1 2',
split: true,
items: [this.formML]
});
this.panelPic = new Ext.Panel({
id: "panelPic",
layout: "fit",
region: "center",
autoScroll: true,
frame: false,
html: ' <iframe scrolling="auto" frameborder="0" width="100%" height="100%" src="' + this.PICURL + '"> </iframe>'//ftp://bjes:@120.27.53.37/dhm-11111/2.jpg
});
this.panelDoc =new Ext.Panel({
id: "panelDoc",
layout: "border",
region: "center",
//autoScroll: true,
frame: false,
split: true,
items: [this.gridDocList,this.panelPic]
});
this.page_1 = new Ext.Panel({
id:"page_1",
title: "合同基础信息",
autoScroll: true,
//closable:true,
items: [this.formEdit, this.panelCargoandApp]
});
this.page_2 = new Ext.Panel({
id:"page_2",
title: "库存管理",
region: 'center',
layout: "border",
items: [this.formKC]
});
this.page_3 = new Ext.Panel({
id:"page_3",
title: "票据管理",
region: 'center',
layout: "border",
items: [this.gridListReceipt,this.panelDoc]
});
this.page_4 = new Ext.Panel({
id:"page_4",split: true,
title: "应收应付录入",
items: [this.panelFEE,this.panelML
]
});
this.page_5 = new Ext.Panel({
id:"page_5",
title: "本地同步合同基础信息",
autoScroll: true,
//closable:true,
items: [this.formLocal]
});
this.MainTab = new Ext.tab.Panel({
layout: "border",
region: "center",split:true,
items: [this.page_1, this.page_2, this.page_3, this.page_4,this.page_5
]
});
Ext.apply(this, {
items: [this.panelTop, this.MainTab]
});
//#endregion
parentWin = window.parent.opener;
this.InitData();
//#region 集中绑定 事件
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.gridListChFee.on('edit', function (editor, e, eOpts) {
this.gridListChFeeAfterEdit(editor, e, eOpts);
}, this);
this.gridListChFee_YF.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);
this.cellEditingChFee_YF.on('beforeedit', function (editor, e) {
return this.cellEditingChFeeBeforeEdit(editor, e);
}, this);
this.gridListChFee.getSelectionModel().on('select', function (button, event) {
//Ext.getCmp("zongshu").setText("1234");
this.onSelectFee(button, event);
}, this);
this.gridListChFee_YF.getSelectionModel().on('select', function (button, event) {
//Ext.getCmp("zongshu").setText("1234");
this.onSelectFee(button, event);
}, this);
this.gridListChFee.on('cellclick', function (button, event) {
//Ext.getCmp("zongshu").setText("1234");
this.onSelectFee(button, event);
}, this);
this.gridListChFee_YF.on('cellclick', function (button, event) {
//Ext.getCmp("zongshu").setText("1234");
this.onSelectFee(button, event);
}, this);
//#endregion
}, //end initUIComponents
////////<<<商品>>>明细表相关方法
onAddCargoClick: function (button, event) {
var TransactionMethod = this.formEdit.getForm().findField('TransactionMethod').getRawValue();
var baolv='1.000';
if (TransactionMethod=='CFR') {
baolv='1.003';
}
var USDGID="740DF21C-BDE4-4C3E-A258-683A183AD3B4";
var Exchangerate="1";
var currrecords = DsStoreQueryBy(this.storecurr, 'GID', USDGID);
if (currrecords.getCount() > 0) {
Exchangerate=currdata.DEFRATE;
}
var record = Ext.create('Cargomb', {
'id': '',
'ContractNo': '',
'cargoinfo_id': '',
'name': '',
'price': '0',
'price_agio': '0',
'price_limit': '0',
'amount': '0',
'BoxCount': '0',
'BoxWeight': '0',
'Exporter': '',
'FactoryNo': '',
'Productiondate': '',
'baolv':'1.000',
'tax':'0.0',
'tax_zz':'0.0',
'Unit':'0',
'currid':'740DF21C-BDE4-4C3E-A258-683A183AD3B4',
'Exchangerate':Exchangerate,
'UnitRef':'KG',
'codename':'USD'
});
this.storeCargo.add(record);
var n = this.storeCargo.getCount();
this.cellEditingCargo.startEditByPosition({ row: n - 1, column: 2 });
},
onDelCargoClick: function (button, event) {
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];
if (this.getCargoAPPUsed(rec.id)!=true){
alert("此商品已配证,不能删除");
}
if (rec.ContractNo != "" || rec.ContractNo != "*") //如果是新增但没有保存的数据,没有必要提交到后台
{
this.CargoDel.push(rec);
}
this.storeCargo.remove(selectedRecords[i]);
}
}
}, this);
},
getCargoAPPUsed:function(cargo_id){
this.storeBank = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsTruckMng.ux.GeneralValue',proxy: { url: '/CommMng/BasicDataRef/GeneralSelect' } });
this.storeBank.load({
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) {
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;
if (parseFloat(data.GVALUE)>0){
return false;
}else
return true;
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
}
});
},
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:"K.ContractNo = '" + this.editRecord.get('ContractNo')+ "' and K.corpid='"+COMPANYID+"'"} });
},
scope: this
});//request over
}
}, this);//确认窗口over
},
onbtnCWStartClick: function(button, event) { //初始化应收应付,
Ext.MessageBox.confirm('提示', '这将会在应收应付列表增加一些内容,如不保存就不会真正增加。确定吗?',
function(btn) {
if (btn == 'yes') {
////////////////////////////////////////
var selectedRecords = this.formCargo.selModel.getSelection();
var prepayments_1=0;
var prepayments_2=0;
var preRemark='';
var balance_1=0;
var balance_2=0;
var balanceRemark='';
var taxAmount=0;
var tax=0;var taxRemark='';
var tax_zz=0;var tax_zzRemark='';
var weight=0;
var Paytax=0; var Gettax=0;
var Paytax_zz=0; var Gettax_zz=0;
var Exchangerate=0;
var taxprice=0;var sellprice=0;var payprice=0;
var usd_tax_1=0; var usd_tax_zz_1=0;
var usd_tax_2=0; var usd_tax_zz_2=0;
var isChicken= false;
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (rec.get('cicode')=='0207142100'||rec.get('cicode')=='0207142200'||rec.get('cicode')=='0207142900'||rec.get('cicode')=='0207141100' )
{
isChicken= true;
}
}//判断参与生成的货物中是否有鸡制品。如有则关税增值税用RMB表示否则用美元表示。
var codename="";
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
weight=weight+parseFloat(rec.get('weight'));
taxAmount=rec.get('tax_Amount');
Amount=rec.get('Amount');
preRemark=preRemark+rec.get('prepayments')+' ';
prepayments_1=Add(prepayments_1, rec.get('prepayments'));
prepayments_2=Add(prepayments_2, rec.get('pay_prepayments'));
Exchangerate=parseFloat(rec.get('Exchangerate'));
Exchangerate_customs=parseFloat(rec.get('Exchangerate_Customs'));
balance_1=Add(balance_1, rec.get('balance'));
balance_2=Add(balance_2, rec.get('pay_balance'));
/*
if (parseFloat(rec.get('price_agio'))==0){
//有差价时,预付收付金额相同,尾款收付金额不相同
balance_2=balance_2+ parseFloat(rec.get('pay_Amount'))-parseFloat(rec.get('prepayments'));
}else
//预付与尾款有差价时同比例的算法
{
balance_2=balance_2+ parseFloat(rec.get('pay_Amount'))-(round2(parseFloat(rec.get('pay_Amount'))*parseFloat(rec.get('PreProportion'))/100,2));
}*/
if (parseFloat(rec.get('price_agio'))>0) {
balanceRemark=balanceRemark+'差价'+rec.get('price_agio')+' ';}
tax=parseFloat(rec.get('tax'));
tax_zz=parseFloat(rec.get('tax_zz'));
//alert(rec.get('cicode'));
var HS=rec.get('cicode');
/*鸡翅 800/吨 HS编码 0207142100
鸡爪 1000/吨 HS编码 0207142200
鸡胗 1300/吨 HS编码 0207142900
鸡腿 600/吨 HS编码 0207141100
*/
var tax_weight=parseFloat(rec.get('weight'));
Paytax=Paytax+parseFloat(rec.get('tax_2'));
Paytax_zz=Paytax_zz+parseFloat(rec.get('tax_zz_2'));
Gettax=Gettax+parseFloat(rec.get('tax_1'));
Gettax_zz=Gettax_zz+parseFloat(rec.get('tax_zz_1'));
//if (taxAmount>Amount){
usd_tax_1=Add(usd_tax_1, Mul(taxAmount,tax));
usd_tax_zz_1=Add(usd_tax_zz_1, Mul(taxAmount,Mul(Add(1,tax),tax_zz)));
/*}else
{
usd_tax_1=usd_tax_1+ round2(Amount*tax,2);
usd_tax_zz_1=usd_tax_zz_1+ round2(Amount*(1+tax)*tax_zz,2);
} */
usd_tax_2=Add(usd_tax_2, Mul(taxAmount,tax));
usd_tax_zz_2=Add(usd_tax_zz_2,Mul(taxAmount,Mul(Add(1,tax),tax_zz)));
codename=rec.get('codename');
}
if (parseFloat(prepayments_1)>0){
this.addChFee(1,'RMB',1,'预付款',Mul(prepayments_1,Exchangerate,2),1,prepayments_1+codename+' 其中:'+preRemark);
}
this.addChFee(1,'RMB',1,'尾款',Mul(balance_1,Exchangerate,2),1,balance_1+codename);
if (parseFloat(prepayments_2)>0){
this.addChFee(2,codename,Exchangerate,'预付款',prepayments_2,1,prepayments_2+codename);
}
this.addChFee(2,codename,Exchangerate,'尾款',balance_2,1,balance_2+codename+" "+balanceRemark);
if (isChicken){
this.addChFee(2,'RMB',1,'关税',round2(Paytax,2),1,'' );
this.addChFee(2,'RMB',1,'增值税',round2(Paytax_zz,2),1,'');
this.addChFee(1,'RMB',1,'关税',round2(Gettax,2),1,'' );
this.addChFee(1,'RMB',1,'增值税',round2(Gettax_zz,2),1,'');
}else{
this.addChFee(2,'RMB',1,'关税',round2(Paytax,2),1,usd_tax_2+' USD');
this.addChFee(2,'RMB',1,'增值税',round2(Paytax_zz,2),1,usd_tax_zz_2+' USD');
this.addChFee(1,'RMB',1,'关税',round2(Gettax,2),1,usd_tax_1+' USD');
this.addChFee(1,'RMB',1,'增值税',round2(Gettax_zz,2),1,usd_tax_zz_1+' USD');
}
this.addChFee(1,'RMB',1,'代理费',rec.get('AGENCRATE'),(weight/1000).toFixed(4));
/*this.addChFee(1,'RMB',1,'THC',1360,1);
this.addChFee(1,'RMB',1,'拖车费',700,1);*/
//this.addChFee(1,'RMB',1,'验货费',620,1);
this.addChFee(1,'RMB',1,'电汇费',150,1,'尾款电汇费');
this.addChFee(1,'RMB',1,'手续费',round2((balance_1*Exchangerate)/1000,2),1,'尾款手续费');
if (parseFloat(prepayments_1)>0){
this.addChFee(1,'RMB',1,'电汇费',150,1,'预付款电汇费');
this.addChFee(1,'RMB',1,'手续费',round2((prepayments_1*Exchangerate)/1000,2),1,'预付款手续费');
}
/////////////////////////////////////////////////
}
},
this); //确认窗口over
}
,
onKCFeeClick: function(button, event) { //初始化应收应付,
Ext.MessageBox.confirm('提示', '这将会在应收应付列表增加一些内容,如不保存就不会真正增加。确定吗?',
function(btn) {
if (btn == 'yes') {
function GetDateStr(AddDayCount) {
var dd = new Date();
dd.setDate(dd.getDate()+AddDayCount);//获取AddDayCount天后的日期
var y = dd.getFullYear();
var m = dd.getMonth()+1;//获取当前月份的日期
var d = dd.getDate();
return y+"-"+m+"-"+d;
}
var EnterDate = GetDateStr(0);
var selectedRecords = this.formKC.selModel.getSelection();
var CRK=0.0;
var LC=0.0;
var CustomerName="";
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
var FeeName=rec.get('FeeName');
var Amount=rec.get('Amount');
var UnitPrice= rec.get('UnitPrice');
var Quantity= rec.get('Quantity');
var days= rec.get('days');
if (CustomerName==""){
CustomerName=rec.get('kfstate');
}else{
if(CustomerName!= rec.get('kfstate')){
alert("不能同时生成多个库房的费用")
}
}
var dt = new Date(rec.get('czdate'));
var _dt=Ext.util.Format.date(dt, 'Y-m-d')
if (FeeName=='出入库费'){
//this.addChFee(1,'RMB',1,'出入库费',round2(Amount,2),1,'',rec.get('id'),rec.get('czdate'));
//this.addChFee(2,'RMB',1,'出入库费',round2(Amount,2),1,'',rec.get('id'),rec.get('czdate'));
CRK=CRK+round2(Amount,2);
}else if (FeeName=='冷藏费'){
//this.addChFee(1,'RMB',1,FeeName,parseFloat(UnitPrice)*parseFloat(Quantity),parseFloat(days),'',rec.get('id'),rec.get('czdate'));
//this.addChFee(2,'RMB',1,FeeName,parseFloat(UnitPrice)*parseFloat(Quantity),parseFloat(days),'',rec.get('id'),rec.get('czdate'));
LC=LC+Mul(parseFloat(UnitPrice)*parseFloat(Quantity),parseFloat(days));
}else{
this.addChFee(1,'RMB',1,FeeName,parseFloat(UnitPrice)*parseFloat(Quantity),parseFloat(days),_dt+" "+FeeName,rec.get('id'),EnterDate,this.getCustName());
this.addChFee(2,'RMB',1,FeeName,parseFloat(UnitPrice)*parseFloat(Quantity),parseFloat(days),_dt+" "+FeeName,rec.get('id'),EnterDate,CustomerName);
}
}
if (CRK>0){
this.addChFee(1,'RMB',1,'出入库费',CRK,1,_dt+" 出入库费",rec.get('id'),EnterDate,this.getCustName());
this.addChFee(2,'RMB',1,'出入库费',CRK,1,_dt+" 出入库费",rec.get('id'),EnterDate,CustomerName);
}
if (LC>0){
this.addChFee(1,'RMB',1,'冷藏费',LC,1,_dt+" 冷藏费",rec.get('id'),EnterDate,this.getCustName());
this.addChFee(2,'RMB',1,'冷藏费',LC,1,_dt+" 冷藏费",rec.get('id'),EnterDate,CustomerName);
}
}
},
this); //确认窗口over
},
onPLEDGEClick: function(button, event) { //初始化应收应付,
Ext.MessageBox.confirm('提示', '将根据选中的入库信息生成质押权转移记录,。确定吗?',
function(btn) {
if (btn == 'yes') {
var selectedRecords = this.formKC.selModel.getSelection();
for (var i = 0; i < selectedRecords.length; i++) {
//查询剩余数量
//增加一个原质押者质押权转移 出库数量
var r_out = selectedRecords[i];
r_out.set('czstate',"7");
//r_out.
//增加一个新质押者质押权转移 入库数量
}
}
},
this); //确认窗口over
},
addChFee: function(FeeType,Currency,Exchangerate,FeeName,price,Quantity,Remark,FeeDescription,feedate,CustomerName) {
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='';}
if (FeeName=='冷藏费'||FeeName=='仓储费'||FeeName=='出入库费'||FeeName=='超期制冷费'||FeeName=='倒柜费'){_CustomerName=CustomerName;}
//CustomerName: this.formEdit.getForm().findField('seller');
};
var Sort="0";
if (FeeName=='购货款'){
Sort="1";
}else
if (FeeName=='预付款'){
Sort="2";
}else
if (FeeName=='尾款'){
Sort="3";
}else
if (FeeName=='关税'){
Sort="4";
}else
if (FeeName=='增值税'){
Sort="5";
}else
if (FeeName=='电汇费'){
Sort="6";
}else
if (FeeName=='手续费'){
Sort="7";
}else
if (FeeName=='代理费'){
Sort="8";
}else
if (FeeName=='拖车费'){
Sort="9";
}else
if (FeeName=='商检验货费'){
Sort="10";
}else
if (FeeName=='出入库费'){
Sort="11";
}else
if (FeeName=='冷藏费'){
Sort="12";
}else
if (FeeName=='超期制冷费'){
Sort="13";
}else
if (FeeName=='看货费'){
Sort="14";
}else{
Sort="999";
}
//var _Amount=price*Quantity;
var _Amount=0;
function GetDateStr(AddDayCount) {
var dd = new Date();
dd.setDate(dd.getDate()+AddDayCount);//获取AddDayCount天后的日期
var y = dd.getFullYear();
var m = dd.getMonth()+1;//获取当前月份的日期
var d = dd.getDate();
return y+"-"+m+"-"+d;
}
var EnterDate = GetDateStr(0);
if (feedate=="" || typeof(feedate)=="undefined"){
EnterDate = GetDateStr(0);
}else{
EnterDate = feedate;
}
record = Ext.create('MsChFee', {
GId: NewGuid(),
BsNo: '*',
FeeStatus: 1,
FeeStatus_Ref: '录入状态',
FeeType: _FeeType,
FeeType_Ref: _FeeType_Ref,
FeeName: FeeName,
FeeName_Ref: '',
FeeDescription: FeeDescription,
CustomerType: '',
CustomerName: _CustomerName,
//this.formEdit.getForm().findField('buyer');
CustomerName_Ref: '',
Unit: '',
price: 0,
UnitPrice: price,
Quantity: Quantity,
Amount: _Amount,
Currency: Currency,
ExChangerate: Exchangerate,
Reason: '',
Remark: Remark,
Commissionrate: 0,
Settlement: 0,
Invoice: 0,
OrderAmount: 0,
OrderInvoice: 0,
SubmitDate: null,
Auditoperator: '',
AuditDate: null,
EnteroPerator: USERID,
EnterDate: EnterDate,
DebitNo: '',
IsDebit: "0",
IsOpen: "0",
IsAdvancedpay: "0",
Sort: Sort,
IsInvoice: "0",
FeeFrt: 'PP',
IsCrmOrderFee: "0",
AuditStatus: 0,
InvoiceNum: '',
ChequeNum: '',
WmsOutBsNo: ''
});
if (FeeType==1)
{
this.storeBodyChFee.add(record);
for(var i =0;i<this.storeBodyChFee.getCount();i++){
_f=this.storeBodyChFee.getAt(i); //遍历每一行
if (_f.get('Amount')==0||_f.get('Amount')==""){
_f.set('Amount',Mul(_f.get('UnitPrice'),_f.get('Quantity')) );
}
}
}
else{
this.storeBodyChFee_YF.add(record);
for(var i =0;i<this.storeBodyChFee_YF.getCount();i++){
_f=this.storeBodyChFee_YF.getAt(i); //遍历每一行
if (_f.get('Amount')==0||_f.get('Amount')==""){
_f.set('Amount',Mul(_f.get('UnitPrice'),_f.get('Quantity')) );
}
}
}
},
CargoBeforeEdit: function (editor, e) {
var cargo_id = e.record.get('id');
var canedit=true;
this.APPUsing=0;
if (e.field == 'cargoinfo_id'||e.field == 'cargociq_id'||e.field == 'Unit'
||e.field == 'U_weight'||e.field == 'U_PRICE'/*||e.field == 'weight'*/)
//Unit U_weight weight
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=parseInt(returnData.Count);
} else {
Ext.Msg.show({ title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
return;
}
}
});
/*
if (this.APPUsing>0) {
canedit=false;
}*/
//20150505 当合同状态为审单或更往后的状态 禁止修改单价和重量。
var Mainstate = parseInt(this.editRecord.get('Mainstate'));
if (Mainstate>1 && (e.field == 'weight'||e.field == 'price'||e.field == 'Unit'||e.field == 'U_weight'||e.field == 'U_PRICE'))//||e.field == 'price_agio'
{
canedit=false;
alert("审单之后即不能修改重量、重量单位和价格");
}
var USDGID=e.record.get('currid');
var Exchangerate="1";
this.storeExchangerate.removeAll();
var currrecords = DsStoreQueryBy(this.storecurrQZ, 'GID', USDGID);
if (currrecords.getCount() > 0) {
currdata=currrecords.getAt(0).data;
this.storeExchangerate.add(new Exchangeratemb({
Value: currdata.DEFRATE,
SOURACE: currdata.DEFRATE+"_日期区间汇率"
}));
}
var currrecords = DsStoreQueryBy(this.storecurr, 'gid', USDGID);
if (currrecords.getCount() > 0) {
currdata=currrecords.getAt(0).data;
//Exchangerate=currdata.defaultrate;
this.storeExchangerate.add(new Exchangeratemb({
Value: currdata.defaultrate,
SOURACE: currdata.defaultrate+"_默认汇率"
}));
}
var LOCK_EXCHANGERATE = this.formEdit.getForm().findField('LOCK_EXCHANGERATE').getValue();
if (LOCK_EXCHANGERATE==true && (e.field == 'Exchangerate'||e.field == 'currid'))//||e.field == 'price_agio'
{
canedit=false;
alert("锁汇状态下不能修改汇率");
}
return canedit;
},
CargoAfterEdit: function(editor, e, eOpts) {
//if (e.value==e.originalValue){return;}
function decimal(str,length){
var _r=round2(str,length);
return(_r);
}
if (e.field == 'weight'){
var cargo_id = e.record.get('id');
APPUsing=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.APPUsing=parseFloat(returnData.Count);
} else {
Ext.Msg.show({ title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
return;
}
}
});
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 == 'Exchangerate' && e.record.get('Exchangerate_Customs') == 0) {
e.record.set('Exchangerate_Customs', parseFloat(e.record.get('Exchangerate')))
}
if (e.field == 'Unit') {
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 = Mul(U_weight,0.4535970244035199);
e.record.set('weight', weight);
}
if (Unitdata.EnumValueName == '吨') {
e.record.set('UnitRate', '1000');
var weight = Mul(U_weight,1000);
e.record.set('weight', weight);
}
if (Unitdata.EnumValueName == 'KG') {
e.record.set('UnitRate', '1');
var weight = Mul(U_weight,1);
e.record.set('weight', weight);
}
} else {
e.record.set('UnitRef', '');
e.record.set('UnitRate', '1');
}
}
if (e.field == 'U_weight'||e.field == 'U_PRICE') {
if (parseFloat(e.value)==0){
return;
}
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'));
//if (e.record.get('Unit') != '1') {//不是磅
var weight = Mul(U_weight,UnitRate);
//decimal(U_weight * UnitRate, 2);
e.record.set('weight', weight);
var price = Div(U_PRICE,UnitRate,4);
e.record.set('price', price);
//}
/*
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 = Mul(U_weight,U_PRICE);
//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 = Mul3(price_limit , weight , baolv,2);
//decimal(price_limit * weight * baolv, 2);
} else {
var tax_amount = Mul3(U_weight , U_PRICE , baolv,2);
//decimal(U_weight * U_PRICE * baolv, 2);
}
var pay_amount = Mul(U_weight , U_PRICE );
}else{
if (price_limit != 0 && price_limit > (price - price_agio)) {
var tax_amount = Mul3(price_limit , weight , baolv,2);
//decimal(price_limit * weight * baolv, 2);
} else {
var tax_amount = Mul3(price , weight , baolv,2);
//decimal((price - price_agio) * weight * baolv, 2);
}
var pay_amount = Mul(price,weight);
//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);
var prepayments = parseFloat(parseFloat( e.record.get('prepayments')).toFixed(2));
var balance = Cut(amount,prepayments);
e.record.set('balance', balance);
var pay_prepayments = parseFloat(parseFloat( e.record.get('pay_prepayments')).toFixed(2));
var pay_balance = Cut(pay_amount,pay_prepayments);
e.record.set('pay_balance', pay_balance);
*/
}
if (e.field == 'Unit'||e.field == 'U_weight'||e.field == 'weight'||e.field == 'BoxCount'){
//计算规格 只舍不进
var BoxCount=e.record.get('BoxCount');
var weight=e.record.get('weight');
var _boxcount=Div(weight,BoxCount,0);
if (parseFloat(_boxcount)>Div(weight,BoxCount,2)){
_boxcount=Cut(_boxcount,1,0);
}else{
}
e.record.set('BoxWeight', _boxcount);
}
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;
e.record.set('codename', currdata.codename);
//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 == 'U_weight'||e.field == 'U_PRICE'
|| e.field == 'weight'||e.field == 'Exchangerate'||e.field == 'Exchangerate_Customs'||e.field == 'tax'||e.field == 'tax_zz'||e.field == 'Unit') {
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 = Mul(weight,price);} //Mul(price_limit,weight,baolv,2)
else {amount = Mul(weight,price_agio);} //amount=对国内客户的合同金额
var amount_writeoffs=Mul(weight,price);
//get_tax_amount 用于向客户收税金的完税价格
//tax_amount 用于向海关交税金的完税价格
if (price_limit != 0 && price_limit > price) {
var tax_amount = Mul3(price_limit,weight,baolv,2);
if (price_agio!=0 && price_limit>price_agio){//海关限价最高
var get_tax_amount=tax_amount;
}else{var get_tax_amount= Mul3(price_agio,weight,baolv,2);}//差价(对国内客户)高于限价
} else {
var tax_amount = Mul3(price,weight,baolv,2);
if (price_agio!=0 ){
var get_tax_amount=Mul3(price_agio,weight,baolv,2);
}else{var get_tax_amount= tax_amount;}//差价(对国内客户)高于限价
}
var pay_amount = Mul(weight,price);//贸易商价格x重量x单价
e.record.set('Amount', amount);
e.record.set('tax_Amount', tax_amount);
e.record.set('pay_Amount', pay_amount);
}
else{
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 = Mul(U_weight,UnitRate);
var weight = parseFloat(e.record.get('weight'));
//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 = Mul(U_weight,U_PRICE);
var amount_writeoffs=Mul(weight,price);
var tax_amount =0;
var pay_amount=Mul(U_weight,U_PRICE);
var UNIT= e.record.get('UnitRef');
if ((UNIT=='磅')&&(price_agio==0)) {
if (price_limit != 0 && price_limit > (price)) {
tax_amount = Mul3(price_limit,weight,baolv,2);
} else {
tax_amount = Mul3(U_weight,U_PRICE,baolv,2);
}
//var pay_amount = Mul(U_weight,U_PRICE);
}else{
if (price_limit != 0 && price_limit > price_agio) {
tax_amount = Mul3(price_limit,weight,baolv,2);
} else {
tax_amount = Mul3(U_weight,U_PRICE,baolv,2);
}
if (price_agio>price)
{
amount = Mul(weight,price_agio);
//pay_amount = Mul(U_weight,U_PRICE);
}else{
//amount = Mul(U_weight,U_PRICE);
//pay_amount = Mul(U_weight,U_PRICE);
}
}
e.record.set('Amount', amount);
e.record.set('AMOUNT_WRITEOFFS',amount_writeoffs);
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 = parseFloat(e.record.get('tax'));//关税税率
var tax_zz = parseFloat(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'|| HS == '02071200'|| HS == '0207141100'||HS=='0207110000' ) {
isChicken = true;
if (HS == '0207142100') {
ChickenTax = parseFloat('0.8');
} else if (HS == '0207142200') {
ChickenTax = parseFloat('1.0');
} else if ( HS == '02071200'||HS=='0207110000') {//HS == '0207142900'|| 20160912 姜清秀要求修改 鸡杂碎不是1300是500
ChickenTax = parseFloat('1.3');
} else if (HS == '0207141100') {
ChickenTax = parseFloat('0.6');
} else if (HS == '0207142900') {
ChickenTax = parseFloat('0.5');
}
}
if (isChicken) {
//Mul(weight,price);
var priceandtax = Mul(tax_amount,Exchangerate_Customs) + Mul(weight,ChickenTax);
var tax_1 = Mul(weight,ChickenTax);
var tax_zz_1 = Mul(priceandtax,tax_zz);
var tax_2 = tax_1;
var tax_zz_2 = tax_zz_1;
} else {
var priceandtax =Mul(tax_amount,(1.0 + tax)); //完税价格x(1+关税税率)=含关税价格
//应付的
var tax_2 =Mul3(tax_amount,tax,Exchangerate_Customs,2); //关税
var tax_zz_2 =Mul4(tax_amount,(1.0 + tax) ,tax_zz,Exchangerate_Customs); //decimal(tax_amount * (1.0 + tax) * tax_zz * Exchangerate_Customs,2); //增值税
//向客户收取的
var weight = parseFloat(e.record.get('weight'));
var price_agio = parseFloat(e.record.get('price_agio'));
if (price_agio != 0 && price_agio>price_limit){//如果“差价(对国内客户价格)”不为零而且高于限价 关税的完税价格依据差价价格计算
var tax_1 = Mul3(Mul3(weight,price_agio,baolv),tax,Exchangerate_Customs); //应收关税
var tax_zz_1 = Mul4(Mul3(weight,price_agio,baolv),(1.0 + tax),tax_zz,Exchangerate_Customs);//应收增值税
}else
{
var tax_1 = tax_2;
var tax_zz_1 = tax_zz_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 = parseFloat(parseFloat( e.record.get('prepayments')).toFixed(2));
var balance = Cut(amount,prepayments);
e.record.set('balance', balance);
var pay_prepayments = parseFloat(parseFloat( e.record.get('pay_prepayments')).toFixed(2));
var pay_balance = Cut(pay_amount,pay_prepayments);
e.record.set('pay_balance', pay_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 = Cut(Amount,prepayments);
e.record.set('balance', balance);
}
if (e.field == 'pay_prepayments'||e.field == 'pay_Amount') {
//alert(e.field);
var pay_prepayments = e.record.get('pay_prepayments');
var pay_Amount = e.record.get('pay_Amount');
var pay_balance = Cut(pay_Amount,pay_prepayments);
e.record.set('pay_balance', pay_balance);
}
if (e.field == 'PreProportion') {
//alert(e.field);
var Amount =parseFloat(e.record.get('Amount'));
var prepayments = Mul3(Amount,e.record.get('PreProportion'),0.01,2);
var balance = Cut(Amount,prepayments);
e.record.set('prepayments', prepayments);
e.record.set('balance', balance);
var pay_Amount =parseFloat(e.record.get('pay_Amount'));
var pay_prepayments = Mul3(pay_Amount,e.record.get('PreProportion'),0.01,2);
var pay_balance = Cut(pay_Amount,pay_prepayments);
e.record.set('pay_prepayments', pay_prepayments);
e.record.set('pay_balance', pay_balance);
}
var BAOZHENGJIN = e.record.data.BAOZHENGJIN;
var ZHIBAOJIN = e.record.data.ZHIBAOJIN;
var tax_1 = e.record.data.tax_1;
var tax_zz_1 = e.record.data.tax_zz_1;
var ZONGJINE = Number(BAOZHENGJIN)+Number(ZHIBAOJIN)+ Number(tax_1)+Number(tax_zz_1);
e.record.set('ZONGJINE', ZONGJINE);
},
/////////////明细表<<<商品>>>的相关方法
////////<<<许可证使用>>>明细表相关方法
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: 2 });
},
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.name);
e.record.set('cargoname', cargodata.name);
//alert(e.record.get('cargo_id'));
} else {
//alert(cargodata.name);
e.record.set('cargoname', ' ');
}
}
},
//-------------明细表<<<许可证使用>>>的相关方法 over
////////<<<库存记录>>>明细表相关方法
onAddKCClick: function (button, event) {
//var _date= currdate.format('yyyy-MM-dd HH:mm:ss');
var record = Ext.create('KCmb', {
'id': '',
'ContractNo': '',
'cargo_id': '',
'name': '',
'czstate': '',
'innum': '0',
'outnum': '0',
'kfstate': '',
'czdate': '',
'Quantity': '0',
'text': '',
'czref': '',
'kfref': '',
'CORPID': COMPANYID,
'ENTEROPERATOR': USERID
});
this.storeKC.add(record);
var n = this.storeKC.getCount();
this.cellEditingKC.startEditByPosition({ row: n - 1, column: 2 });
},
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);
if (czstatedata.EnumValueName=="入库"){
e.record.set('FeeName',"出入库费");
}
if (czstatedata.EnumValueName=="出库"){
e.record.set('FeeName',"冷藏费");
}
if (czstatedata.EnumValueName=="倒柜"){
e.record.set('FeeName',"倒柜费");
}
if (czstatedata.EnumValueName=="结费(未出库)"){
e.record.set('FeeName',"冷藏费");
}
} else {
e.record.set('czref', '');
}
}
if (e.field == 'kfstate') {
var kfstaterecords = DsStoreQueryBy(this.storekfstate, 'CustName', e.value);
if (kfstaterecords.getCount() > 0) {
var kfstatedata = kfstaterecords.getAt(0).data;
e.record.set('kfstate', kfstatedata.CustName);
} else {
e.record.set('kfstate', '');
}
//将单价更新到单价里
if (parseFloat(e.record.get('UnitPrice'))<=0){
e.record.set('UnitPrice',kfstatedata.UNITPRICE);
}
}
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_REF);
} else {
//alert(cargodata.name);
e.record.set('cargoname', ' ');
}
}
if (e.field == 'czstate'||e.field == 'cargo_id') {
var czstate=e.record.get('czstate');
var cargo_id=e.record.get('cargo_id');
if(czstate==""||cargo_id==""){
}else{
var cargo = DsStoreQueryBy(this.storeCargo, 'id', e.record.get('cargo_id'));
var weight=0;
var BoxCount=0;
if (cargo.getCount() > 0) {
var cargodata = cargo.getAt(0).data;
weight = parseFloat(Div(cargodata.weight,1000,6));
if (this.formEdit.getForm().findField('port').getRawValue()=="天津"){
BoxCount = Cut(cargodata.BoxCount,1);
}else{
BoxCount=cargodata.BoxCount;
}
}
var czstate=e.record.get('czstate');
//////////////////////////////////////////////
var remind=0;
var weight_remind=0;
for (var i = 0; i < this.storeKC.getCount(); i += 1) {
var member = this.storeKC.getAt(i).data;
if (member.cargo_id==e.record.get('cargo_id') && member.id!=e.record.get('id'))
{
remind=Add(remind,parseFloat(member.innum));
remind=Cut(remind,parseFloat(member.outnum));
if (member.czstate=="1"){
weight_remind=Add(weight_remind,member.Quantity,6);
}
if (member.czstate=="3"){
weight_remind=Cut(weight_remind,member.Quantity,6);
}
}
}
var cargo = DsStoreQueryBy(this.storeCargo, 'id', e.record.get('cargo_id'));
var m_weight=0;//中间值
//var BoxCount=0;
if (cargo.getCount() > 0) {
var cargodata = cargo.getAt(0).data;
m_weight = parseFloat(Div(cargodata.weight,1000,6));
//BoxCount = Cut(cargodata.BoxCount,1);
}
_weight=weight_remind;
//e.record.set('Quantity',_weight);
///////////////////////////////////////////////////
//1 入库 innum写入BoxCount Quantity写入weight
if (czstate=="1"){
e.record.set('Quantity',weight);
e.record.set('innum',BoxCount);
e.record.set('outnum',0);
}
//2 转移库存 innumoutnum写入BoxCount Quantity写入weight
if (czstate=="2"){
e.record.set('innum',BoxCount);
e.record.set('outnum',BoxCount);
e.record.set('Quantity',weight);
}
//3 出库 outnum写入BoxCount Quantity写入weight
if (czstate=="3"){
e.record.set('innum',0);
e.record.set('outnum',remind);
e.record.set('Quantity',_weight);
}
//4 倒柜 Quantity写入weight
if (czstate=="4"){
e.record.set('innum',BoxCount);
e.record.set('outnum',BoxCount);
e.record.set('Quantity',weight);
}
//5 直送 Quantity写入weight
if (czstate=="5"){
e.record.set('innum',0);
e.record.set('outnum',0);
e.record.set('Quantity',weight);
}
//6 结费未出库 Quantity写入weight
if (czstate=="6"){
e.record.set('innum',0);
e.record.set('outnum',0);
e.record.set('Quantity',_weight);
}
//7 质押权转移
}
}
if (e.field == 'outnum'){
var czstate=e.record.get('czstate');
if (czstate=="3" || czstate=="6" )
{
var remind=0;
var weight_remind=0;
var RealInNum=0;
var firstOut=false;//用于标记是否出库过。第一次入库之外的操作,入库值都当作最初实际入库计算
for (var i = 0; i < this.storeKC.getCount(); i += 1) {
var member = this.storeKC.getAt(i).data;
if (member.cargo_id==e.record.get('cargo_id') && member.id!=e.record.get('id'))
{
remind=Add(remind,parseFloat(member.innum));
remind=Cut(remind,parseFloat(member.outnum));
if (member.czstate=="1"){
weight_remind=Add(weight_remind,member.Quantity,6);
}
if (member.czstate=="3"){
weight_remind=Cut(weight_remind,member.Quantity,6);
}
if(member.czstate!="1"){
firstOut=true;
}
if(firstOut==false){
RealInNum=Add(RealInNum,member.innum);
}
}
}
var cargo = DsStoreQueryBy(this.storeCargo, 'id', e.record.get('cargo_id'));
var weight=0;
//var BoxCount=0;
if (cargo.getCount() > 0) {
var cargodata = cargo.getAt(0).data;
weight = parseFloat(Div(cargodata.weight,1000,6));
//BoxCount = Cut(cargodata.BoxCount,1);
}
if (e.value!=remind){
_weight=Mul(Div(e.value,RealInNum),weight);
}else{
_weight=weight_remind;
}
e.record.set('Quantity',_weight);
}
}
/* for (var i = 0; i < this.storeKC.getCount(); i += 1) {
var member = this.storeKC.getAt(i).data;
if (member.czdate==null||member.czdate=="" ) {
alert("操作时间不应为空");
_r= false;
}else{_r= true;}
}*/
if (e.field == 'czstate' || e.field == 'czdate') {
if (!e.record.get('czdate') && e.field == 'czdate'){
alert("操作时间不应为空");
} else
if (e.record.get('czstate')=="3"||e.record.get('czstate')=="6"){//出库或结费
//获取此条出库之前最近的一条入库操作时间,
var ContractNo = this.editRecord.get('ContractNo');
var LastCZDate = "";
var LastCZState= "";
Ext.Ajax.request({
waitMsg: '正在查询数据...',
url: '/Import/XXH/GetLastCZ',
scope: this,
async:false,
params: {condition: ContractNo,id: e.record.get('id'),cargo_id:e.record.get('cargo_id') },
waitMsg: "正在查询数据...",
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
var returnData = jsonresult.data;
//alert(returnData.CZDate);
LastCZDate=returnData.CZDate;
LastCZState=returnData.CZstate;
var _e = Ext.util.Format.date(e.record.get('czdate'), 'Y-m-d'); //格式化日期控件值
var _s = Ext.util.Format.date(LastCZDate, 'Y-m-d'); //格式化日期控件值
var arr = _s.split("-");
var LastCZ = new Date(Number(arr[0]),Number(arr[1])-1,Number(arr[2])+1);
var nextday = LastCZ.getFullYear() + "-" + (LastCZ.getMonth()+1) + "-" + LastCZ.getDate();
var end = new Date(_e);
var start = new Date(_s);
if ( LastCZState =="1" ){
var elapsed = Math.round((end.getTime() - start.getTime()) / (86400000)) + 1; // 计算间隔日数
//alert(nextday);
e.record.set('text',_s);
}else
var elapsed = Math.round((end.getTime() - start.getTime()) / (86400000)) ; // 计算间隔日数
//alert(_s);
e.record.set('days',elapsed);
e.record.set('text',nextday);
} else {
Ext.Msg.show({ title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
return;
}
}
});
}
}
if (e.field == 'days' || e.field == 'UnitPrice'||e.field == 'Quantity') {
var days=parseFloat(e.record.get('days'));
var UnitPrice=parseFloat(e.record.get('UnitPrice'));
var Quantity=parseFloat(e.record.get('Quantity'));
var feename=e.record.get('FeeName');
if (feename=="出入库费"){
days=1;
}
e.record.set('Amount', days*UnitPrice*Quantity);
}
},
///-------------明细表<<<库存记录>>>的相关方法 over
//单据表 明细表相关方法
onAddReceiptClick: function (button, event) {
// var newSerialno = DsGetNewSerialNo(this.storeBodyList, this.serialNo);
// this.serialNo = newSerialno;
var record = Ext.create('RECEIPTmb', {
'id': '',
'ContractNo': '',
'GID':NewGuid(),
'BSNO':'',
'RECEIPTNO':'',
'RECEIPTTYPE':'',
'RECEIVE_MAN':'',
'RECEIVE_DATE':'',
'SEND_MAN':'',
'SEND_DATE':'',
'TRANCER':'',
'TRANCNO':'',
'ISREPEAT':'false',
'REPEAT_MAN':'',
'REPEAT_DATE':'',
'ISRECEIVE':'false',
'RETURN_MAN':'',
'RETURN_DATE':'',
'RETURN_TRANCER':'',
'RETURN_TRANCNO':'',
'REMARK':'',
'CORPID':'',
'CREATEUSER':'',
'CREATETIME':'',
'MODIFIEDUSER':USERID,
'MODIFIEDTIME':''
});
this.storeReceipt.add(record);
var n = this.storeReceipt.getCount();
this.cellEditingReceipt.startEditByPosition({ row: n - 1, column: 2 });
}, //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', '');
}
}
},
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 单据表 明细表相关方法
// 明细表 <<<<<<<<<<<<<费用表相关方法
cellEditingChFeeBeforeEdit: function (editor, e) {
var chfeefeeStatus = e.record.get('FeeStatus');
var canedit = chfeefeeStatus == 1 || chfeefeeStatus == 6;
if (canedit==true) {
var type = e.record.get('FeeType');
var op = e.record.get('EnteroPerator');
var opname = e.record.get('OpName');
if (type == 1) {
var records = DsStoreQueryBy(this.StoreDrOpRange, 'OPID', op);
if (records.getCount() > 0) {
} else {
Ext.Msg.show({ title: '提示', msg: '你没有权限修改' + opname + '录入的费用!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
canedit = false;
}
} else if (type == 2) {
var records = DsStoreQueryBy(this.StoreCrOpRange, 'OPID', op);
if (records.getCount() > 0) {
} else {
Ext.Msg.show({ title: '提示', msg: '你没有权限修改' + opname + '录入的费用!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
canedit = false;
}
}
}
if (e.record.get('IsDebit')=="1")
{
Ext.Msg.show({ title: '提示', msg: '当前费用已对账,无法修改!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
canedit = false;
}
return canedit;
},
onAddDetailClick: function (button, event, type) {
var allow = this.getAllowOperationDetail();
if (allow == false) {
return;
}
var store = null;
if (type == 1) {
store = this.storeBodyChFee;
} else if (type == 2) {
store = this.storeBodyChFee_YF;
} else {
alert('函数(onAddDetailClick)的参数type类型设置的不对');
return;
}
var newSerialno = this.GetHandleSerialNo(store, type);
var record = null;
function GetDateStr(AddDayCount) {
var dd = new Date();
dd.setDate(dd.getDate()+AddDayCount);//获取AddDayCount天后的日期
var y = dd.getFullYear();
var m = dd.getMonth()+1;//获取当前月份的日期
var d = dd.getDate();
return y+"-"+m+"-"+d;
}
var EnterDate = GetDateStr(0);
if (USERID==""||USERID==null){
alert("登陆数据丢失,请重新登陆");
return;
}
record = Ext.create('MsChFee', {
GId: NewGuid(),
BsNo: '*',
FeeStatus: 1,
FeeStatus_Ref: '录入状态',
FeeType: type,
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: USERID,
EnterDate: EnterDate,
DebitNo: '',
IsDebit: "0",
IsOpen: "0",
IsAdvancedpay: "0",
Sort: "0",
IsInvoice: "0",
FeeFrt: 'pp',
IsCrmOrderFee: "0",
AuditStatus: 0,
InvoiceNum: '',
ChequeNum: '',
WmsOutBsNo: ''
});
//store.add(record);
var _this=this;
var editColumnIndex = 4;
var cellediting = null;
if (type == 1) {
_this.storeBodyChFee.add(record);
var n = _this.storeBodyChFee.getCount();
_this.cellEditingChFee.startEditByPosition({ row: n - 1, column: editColumnIndex });
} else
if (type == 2) {
_this.storeBodyChFee_YF.add(record);
var n = _this.storeBodyChFee_YF.getCount();
_this.cellEditingChFee_YF.startEditByPosition({ row: n - 1, column: editColumnIndex });
}
//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.storeBodyChFee;
} else if (type == 2) {
store = this.storeBodyChFee_YF;
} else {
alert('函数(onAddDetailClick)的参数type类型设置的不对');
return;
}
var result = 0;
if (type == '1') {
result = this.feeSerialNo;
} 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.feeSerialNo = result;
} else if (type == '2') {
this.feeSerialNo = result;
}
var selectedRecords = [];
if (type == '1') {
selectedRecords = this.gridListChFee.selModel.getSelection();
var candelete = DsTruck.CheckChFeeDelete(selectedRecords, this.StoreDrOpRange);
if (candelete == false)
return;
} else if (type == '2') {
selectedRecords = this.gridListChFee_YF.selModel.getSelection();
var candelete = DsTruck.CheckChFeeDelete(selectedRecords, this.StoreCrOpRange);
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 (rec.IsDebit == "True"||rec.IsDebit == "1"){
alert("已经对账的费用不能删除");
continue;
}
if (type == '1') {
this.feeBodyDel.push(rec);
} else if (type == '2') {
this.feeBodyDel.push(rec);
}
}
if (type == '1') {
this.storeBodyChFee.remove(selectedRecords[i]);
} else if (type == '2') {
this.storeBodyChFee_YF.remove(selectedRecords[i]);
}
}
}
},
onSubmitAuditClick: function (button, event,type) {
this.Save('0');
if (type == '1') {
var records = this.feeGridCheckBoxModel.selected.items;
DsTruck.MsChFeeAudit(records, 2, '正在提交审核数据, 请稍侯..',USERID,"False");
} else if (type == '2') {
var selectedRecords = this.gridListChFee_YF.selModel.getSelection();
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if ((rec.get('FeeName')=="预付款"||rec.get('FeeName')=="购货款"||rec.get('FeeName')=="尾款") && ( rec.get('Currency')=="RMB"))
{
if (!confirm("货款类费用币别为RMB确认吗")) {
//点击取消
return false;
}
}
}
var records = this.feeGridCheckBoxModel_YF.selected.items;
DsTruck.MsChFeeAudit(records, 2, '正在提交审核数据, 请稍侯..',USERID,"False");
}
},
onShenModifyClick: function (button, event, type) {
var allow = this.getAllowOperationDetail();
if (allow == false) {
return;
}
var selectedRecords = [];
if (type == '1') {
selectedRecords = this.feeGridCheckBoxModel.selected.items;
} else if (type == '2') {
selectedRecords = this.feeGridCheckBoxModel_YF.selected.items;
}
if (selectedRecords.count == 0) {
Ext.Msg.show({ title: '提示', msg: '没有选择要申请修改的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var rec = selectedRecords[0];
if (rec.data.FeeStatus != 0) {
Ext.Msg.show({ title: '提示', msg: '当前费用状态无法申请修改!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
if (rec.data.Settlement != 0) {
Ext.Msg.show({ title: '提示', msg: '当前费用已结算无法申请修改!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
if (rec.data.IsDebit == 'True') {
Ext.Msg.show({ title: '提示', msg: '当前费用已对帐无法申请修改!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
if (rec.data.Invoice != 0) {
Ext.Msg.show({ title: '提示', msg: '当前费用已开出发票无法申请修改!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
if (rec.data.OrderAmount != 0) {
Ext.Msg.show({ title: '提示', msg: '当前费用已申请费用无法申请修改!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
if (rec.data.OrderInvoice != 0) {
Ext.Msg.show({ title: '提示', msg: '当前费用已申请开票无法申请修改!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
this.DataLoading = true;
this.NewFeeEdit.getForm().loadRecord(rec);
this.OldFee.getForm().loadRecord(rec);
this.DataLoading = false;
this.winShenModifyShow.show();
},
onRetractClick: function (button, event, type) {
var records = [];
if (type == '1') {
var selectedRecords = this.feeGridCheckBoxModel.selected.items;
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (rec.get('FeeStatus') == "2"||rec.get('FeeStatus') == "0") {
if (rec.get('OrderAmount')>0){
alert(rec.get('FeeName')+"还未取消申请,请撤回申请或重新加载。");
return;
}
records.push(rec);
}
}
} else if (type == '2') {
var selectedRecords = this.feeGridCheckBoxModel_YF.selected.items;
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (rec.get('FeeStatus') == "2"||rec.get('FeeStatus') == "0") {
if (rec.get('OrderAmount')>0){
alert(rec.get('FeeName')+"还未取消申请,请撤回申请或重新加载。");
return;
}
records.push(rec);
}
}
}
if (records.length > 0) {
DsTruck.MsChFeeAudit(records, 6, '正在提交审核数据, 请稍侯..',"False");
}
},
onSubmitRZClick: function (button, event, type) {
var records = [];
if (type == '1') {
var selectedRecords = this.feeGridCheckBoxModel.selected.items;
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (rec.get('FeeStatus') == "0"||rec.get('FeeStatus') == "1"||rec.get('FeeStatus') == "2") {
records.push(rec);
}
}
} else if (type == '2') {
var selectedRecords = this.feeGridCheckBoxModel_YF.selected.items;
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (rec.get('FeeStatus') == "0"||rec.get('FeeStatus') == "1"||rec.get('FeeStatus') == "2") {
records.push(rec);
}
}
}
if (records.length > 0) {
DsTruck.MsChFeeAudit(records, 10, '正在撤销提交融资数据, 请稍侯..',"False");
}
},
onRetractRZClick: function (button, event, type) {
var records = [];
if (type == '1') {
var selectedRecords = this.feeGridCheckBoxModel.selected.items;
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (rec.get('FeeStatus') == "10") {
records.push(rec);
}
}
} else if (type == '2') {
var selectedRecords = this.feeGridCheckBoxModel_YF.selected.items;
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (rec.get('FeeStatus') == "10") {
records.push(rec);
}
}
}
if (records.length > 0) {
DsTruck.MsChFeeAudit(records, 0, '正在撤销提交融资数据, 请稍侯..',"False");
}
},
getCustName: function() {
var custName = this.formEdit.getForm().findField('buyer');
return custName.getValue();
},
getSellerName: function() {
var custName = this.formEdit.getForm().findField('seller');
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;
}*/
//var data = this.formEdit.getForm().getValues();
//if data.ContractStatus=="1"
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 ).toFixed(2));
}
if (e.field=='Currency'){
//var ExChangerate = parseFloat(e.record.get('ExChangerate'));
if (e.record.get('Currency')=='RMB'){
e.record.set('ExChangerate', '1');
}
}
if (e.field=='FeeName'){
var FeeName=e.record.get('FeeName');
if (FeeName=='购货款'){
e.record.set('Sort', '1');
}else
if (FeeName=='预付款'){
e.record.set('Sort', '2');
}else
if (FeeName=='尾款'){
e.record.set('Sort', '3');
}else
if (FeeName=='关税'){
e.record.set('Sort', '4');
}else
if (FeeName=='增值税'){
e.record.set('Sort', '5');
}else
if (FeeName=='电汇费'){
e.record.set('Sort', '6');
}else
if (FeeName=='手续费'){
e.record.set('Sort', '7');
}else
if (FeeName=='代理费'){
e.record.set('Sort', '8');
}else
if (FeeName=='拖车费'){
e.record.set('Sort', '9');
}else
if (FeeName=='商检验货费'){
e.record.set('Sort', '10');
}else
if (FeeName=='出入库费'){
e.record.set('Sort', '11');
}else
if (FeeName=='冷藏费'){
e.record.set('Sort', '12');
}else
if (FeeName=='超期制冷费'){
e.record.set('Sort', '13');
}else
if (FeeName=='看货费'){
e.record.set('Sort', '14');
}else{
e.record.set('Sort', '999');
}
}
if (e.field == 'CARGO_GID') {
var cargo = DsStoreQueryBy(this.storeCargo, 'GID', e.value);
if (cargo.getCount() > 0) {
var cargodata = cargo.getAt(0).data;
e.record.set('CARGO_NAME', cargodata.name);
} else {
//alert(cargodata.name);
e.record.set('CARGO_NAME', '');
}
}
if (e.field == 'IsOpen') {
var records = DsStoreQueryBy(this.storeIsOpenType, 'IsOpen', e.value);
if (records.getCount() > 0) {
var data = records.getAt(0).data;
e.record.set('IsOpen_Ref', data.IsOpen_Ref);
} else {
e.record.set('IsOpen_Ref', '');
}
}
},
onSelectFee: function (button, event) {
//Ext.getCmp("zongshu").setText("1234");
var selectedRecords = this.gridListChFee.selModel.getSelection();
var sum = 0;
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
sum = sum + rec.get("Amount");
}
sum = sum.toFixed(2);
Ext.getCmp("zongshu").setText(" 选中金额:" + sum);
var selectedRecords_YF = this.gridListChFee_YF.selModel.getSelection();
var sum_YF = 0;
for (var i = 0; i < selectedRecords_YF.length; i++) {
var rec = selectedRecords_YF[i];
sum_YF = sum_YF + rec.get("Amount");
}
sum_YF = sum_YF.toFixed(2);
Ext.getCmp("zongshu_YF").setText(" 选中金额:" + sum_YF);
},
// 明细表 费用表相关方法 end
//--------更改单相关方法
onAddAmendClick: function (button, event) {
var store = this.storeAmendBill;
var newbsno = NewGuid();
this.strAmendBSNO = newbsno;
var ContractNo=this.editRecord.get('ContractNo');
var record = null;
record = Ext.create('MsOpFeeAmend', {
GID:DsTruck.newID(),
BSNO: '',
PARENTID: ContractNo,
FEESTATUS: "false",
FEESTATUSREF: '未锁定',
ACCDATE: '',
REASON: '',
REMARKS: '',
CREATETIME: currdate.format('yyyy-MM-dd hh:mm:ss'),
CREATEUSER: SHOWNAME
});
store.add(record);
var editColumnIndex = 4;
cellediting = this.cellEditingAmend;
var n = store.getCount();
cellediting.startEditByPosition({ row: n - 1, column: editColumnIndex });
},
onDeleteAmendClick: function (button, event) {
var selections = this.gridAmendList.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var record = selections[0];
if (record.data.FEESTATUS == '1') {
Ext.Msg.show({ title: '警告', msg: '费用已锁定,不允许删除!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
}
if (this.storeAmendChFee.getCount() > 0) {
Ext.Msg.show({ title: '警告', msg: '存在费用信息,不允许删除,请先删除费用信息!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
}
Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在删除数据...');
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/MvcShipping/MsChFee/DeleteAmend',
params: {
data: Ext.JSON.encode(record.data)
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.storeAmendBill.remove(record);
Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
}
},
failure: function (response, options) {
Ext.Msg.show({ title: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
},
success: function (response, options) {
},
scope: this
}); //end Ext.Ajax.request
}
}, this);
},
onPostAmendClick: function (button, event) {
var selections = this.gridAmendList.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var record = selections[0];
//alert(record.data.feestatus);
this.strAmendBSNO = record.data.BSNO;
var bodyDrChFeeDatas = [];
var bodyCrChFeeDatas = [];
var i;
_this = this;
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/Import/PortOperate/SaveAmend',
scope: this,
params: {
bsno: _this.strAmendBSNO,
data: Ext.JSON.encode(record.data),
chfeeBody: "",
chfeeBodyDel: ""
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
_this.storeAmend.load({ params: { billno: _this.ContractNo} });
} else {
Ext.Msg.show({ title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
}
});
}, //end save
//--------
parentfunction: function (button, event) {
var ret1 = window.parent.opener.OprationSwap();
// alert(this.First);
ret1[3]();
},
InitData: function () {
this.opStatus = 'edit';
var condition = '';
if (parentWin) {
var ret = parentWin.OprationSwap();
this.opStatus = ret[0];
if (ret[0]=='view'){
this.editRecord = ret[1];
}else{
this.StoreList = ret[1];
this.editRecord = ret[2];
}
}
if (this.opStatus == 'edit')
condition = " m.id='" + this.editRecord.get('id') + "'";
if (this.opStatus == 'view'){
condition = " m.ContractNo='" + this.editRecord + "'";
Ext.getCmp("btnSave").disable();
Ext.getCmp("btnSaveClose").disable();
}
this.LoadData(this.opStatus, condition);
}, //end InitData
//载入数据
LoadData: function (opstatus, condition) {
this.formEdit.getForm().setValues(this.editRecord.data);
this.opStatus = opstatus;
var data= '';
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/Import/XXH/GetData_HD',
params: {
handle: opstatus,
condition: condition
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title: '提示',
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
}
data = result.data;
// this.formEdit.getForm().reset();
if (data.KCClear=='True'){
data.KCClear='1';
}else{data.KCClear='0'};
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.LOCK_EXCHANGERATE=="1"){
data.LOCK_EXCHANGERATE='1';
}else{data.LOCK_EXCHANGERATE='0'};
if (_R=this.formEdit.getForm().setValues(data)){
//this.setSaveBtnEnable(true);
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});//request over
var ContractNo="";
if (this.opStatus == 'edit') {
ContractNo=this.editRecord.get('ContractNo');
this.getLocalData(ContractNo);
}
if (this.opStatus == 'view') {
ContractNo=this.editRecord;
}
this.formEdit.getForm().findField('ContractNo').setDisabled(false);
this.storeReceipt.load({ params: { billno: ContractNo} });
this.storeCargo.load({ params: { condition: ContractNo} });
this.storeApp.load({ params: { condition: ContractNo} });
this.storeAppstate.load({ params: { condition: ContractNo} });
//this.storeKC.load({ params: { condition: ContractNo} });
this.storeKC.load({ params: { condition:"K.ContractNo = '" + ContractNo+ "' and K.corpid='"+COMPANYID+"'"} });
this.storeBodyChFee.load({ params: { billno: ContractNo,Feetype:'1'} });
this.storeBodyChFee_YF.load({ params: { billno: ContractNo,Feetype:'2'} });
if (this.opStatus == 'edit') {
var s=" countryid='"+this.editRecord.get('countryid')+"'";
this.storeCargoinfo.load({ params: { condition: s} });
this.formEdit.getForm().findField('ContractNo').setDisabled(true);
var ContractStatus = this.editRecord.get('ContractStatus');
if (ContractStatus == "True") {
Ext.getCmp("KCStart").disable() ;
Ext.getCmp("CWStart").disable();
Ext.getCmp("addChfee").disable() ;
Ext.getCmp("delChfee").disable();
Ext.getCmp("addChfee_YF").disable() ;
Ext.getCmp("delChfee_YF").disable();
Ext.getCmp("ApplicationAdd").disable();
}
}
if (this.opStatus == 'view') {
var s=" countryid=(select countryid from import_main where contractno='"+ContractNo+"')";
this.storeCargoinfo.load({ params: { condition: s} });
Ext.getCmp("KCStart").disable() ;
Ext.getCmp("CWStart").disable();
Ext.getCmp("addChfee").disable() ;
Ext.getCmp("delChfee").disable();
Ext.getCmp("addChfee_YF").disable() ;
Ext.getCmp("delChfee_YF").disable();
Ext.getCmp("ApplicationAdd").disable();
//Ext.getCmp("YSsubmitaudit").disable() ;
//Ext.getCmp("YSsubmitauditback").disable() ;
Ext.getCmp("YSsubmitFinance").disable() ;
Ext.getCmp("YSsubmitFinanceback").disable() ;
//Ext.getCmp("YFsubmitaudit").disable() ;
//Ext.getCmp("YFsubmitauditback").disable() ;
Ext.getCmp("YFsubmitFinance").disable() ;
Ext.getCmp("YFsubmitFinanceback").disable() ;
}
this.formEdit.getForm().findField('ContractNo').setDisabled(true);
//////////////////////
var condition2 = " BSNO='" + ContractNo + "' ";
this.Loading = true;
this.storeDocList.load({
params: { condition: condition2 },
waitMsg: "正在查询数据...",
scope: this,
callback: function () {
this.Loading = false;
}
});
Ext.Ajax.request({
waitMsg: '正在查询毛利数据...',
url: '/Import/XXH/GetML',
params: {
contractno: ContractNo
},
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.formML.getForm().setValues(data);
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});//request over
var me = this;
Ext.Ajax.request({
waitMsg: '正在查询用户权限...',
url: '/CommMng/BasicDataRef/GetAuthorityRange',
params: {
modName: "modImport_Fee",
USERID: USERID
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
rec = result.data;
this.VISIBLERANGE = rec.VISIBLERANGE;
this.OPERATERANGE = rec.OPERATERANGE;
//this.setBtnEnable();
if (this.OPERATERANGE=="0"){
Ext.getCmp("formML").show();
}else{
Ext.getCmp("formML").hide();
}
}
else
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
},
scope: this
}); //request over
}, // end LoadDate
setSaveBtnEnable:function (_enable){
if (_enable==true){
Ext.getCmp("SAVE1").enable();
Ext.getCmp("SAVE2").enable();
}else{
Ext.getCmp("SAVE1").disable();
Ext.getCmp("SAVE2").disable();
}
},
DoSetDifferent:function (data){
this.setdifferent('HTH','');
this.setdifferent('BillNo','');
this.setdifferent('ContainerNo','');
this.setdifferent('SealNo','');
this.setdifferent('ShipCompany_id','ShipCompany');
this.setdifferent('company','');
this.setdifferent('Vessel','');
this.setdifferent('Voyage','');
this.setdifferent('Ex_sailingdate','');
this.setdifferent('Sailingdate','');
this.setdifferent('ArrivalDate','');
this.setdifferent('RecDate','');
this.setdifferent('tax_date','');
this.setdifferent('tax_paydate','');
this.setdifferent('Sampling_need','');
this.setdifferent('SamplingDate_Act','');
this.setdifferent('CustomsReleaseDate','');
this.setdifferent('PortDays','');
this.setdifferent('inspection_date','');
this.setdifferent('seller','');
this.setdifferent('buyer','');
this.setdifferent('STT','');
this.setdifferent('countryid','countryid');
this.setdifferent('creattime','');
this.setdifferent('Audittime','');
this.setdifferent('Mainstate','');
this.setdifferent('Printed','');
this.setdifferent('AutoAPP','');
this.setdifferent('BillTime','');
this.setdifferent('Freetime','');
this.setdifferent('TransactionMethod','');
this.setdifferent('PaymentMethods','');
this.setdifferent('SecurityDeposit','');
this.setdifferent('SamplingDate_Plan','');
this.setdifferent('inspection_Signup_date','');
this.setdifferent('inspection_no','');
this.setdifferent('CIQ_licence','');
this.setdifferent('CIQ_canbesearch','');
this.setdifferent('remark','');
this.setdifferent('port','port_Ref');
this.setdifferent('Paydate','');
this.setdifferent('E_Billtime','');
this.setdifferent('HDtime','');
this.setdifferent('remark_2','');
this.setdifferent('remark_3','');
this.setdifferent('remark_4','');
this.setdifferent('Sampling_need','');
this.setdifferent('DeclareNumber','');
this.setdifferent('Inspection_Storage','');
this.setdifferent('DeliveryDate','');
this.setdifferent('DeliveryAddress','');
this.setdifferent('Contacter','');
this.setdifferent('Tel','');
this.setdifferent('Overfilled','');
this.setdifferent('ReceiptStatus','');
this.setdifferent('Receiptremark','');
this.setdifferent('Prepaydate','');
this.setdifferent('TRADINGAGENCY','');
this.setdifferent('KCClear','');
this.setdifferent('RCVMode','');
this.setdifferent('MZBZ','');
this.setdifferent('Inspection_Buyer','');
//this.setdifferent('Inspection_Contacter','');
//this.setdifferent('Inspection_Tel','');
//this.setdifferent('Inspection_DeliveryAddress','');
this.setdifferent('HaveContract','');
this.setdifferent('HaveCargoMark','');
//this.setdifferent('HAVESAMPLE','');
//this.setdifferent('CHECKSAMPLE','');
this.setdifferent('CTN','');
this.setdifferent('BILLTRANCNO','');
this.setdifferent('LOCK_EXCHANGERATE','');
this.setdifferent('EXCHANGERATE','');
this.setdifferent('Unsealdate','');
this.setdifferent('ISREFORM','');
this.setdifferent('BillType','');
this.setdifferent('CreateTime_2','');
this.setdifferent('ResendTime','');
this.setdifferent('Dock','');
this.setdifferent('Customs_broker','');
this.setdifferent('inspection_broker','');
},
setdifferent:function(FieldName,FieldName_REF){
if(FieldName_REF!=''){
EditField=this.formEdit.getForm().findField(FieldName);
LocalField=this.formLocal.getForm().findField(FieldName);
LocalField_REF=this.formLocal.getForm().findField(FieldName_REF);
EditValue=EditField.getValue();
LocalValue=LocalField.getValue();
if(EditValue==LocalValue){
}else{
LocalField.setFieldStyle({ background: '#ffc' });
if(LocalField.getValue()!=""){
EditField.setFieldStyle({ background: '#ffc' });
}
}
}else{
EditField=this.formEdit.getForm().findField(FieldName);
LocalField=this.formLocal.getForm().findField(FieldName);
if (EditField!=null){
EditValue=EditField.getRawValue();
LocalValue=LocalField.getRawValue();
if(EditValue==LocalValue){
}else{
LocalField.setFieldStyle({ background: '#ffc' });
if(LocalField.getValue()!=""){
EditField.setFieldStyle({ background: '#ffc' });
}
}
}
}
},
SetDiffValue:function (FieldName,Value){
EditField=this.formEdit.getForm().findField(FieldName);
EditField.setValue(Value);
LocalField=this.formLocal.getForm().findField(FieldName);
LocalField.setFieldStyle({ background: '#fff' });
EditField.setFieldStyle({ background: '#fff' });
},
OnClickXML: function () {
//商检销售记录
var ContractNo=this.formLocal.getForm().findField('ContractNo').getValue();
var Local_ContractNo=this.formLocal.getForm().findField('Local_ContractNo').getValue();
if (ContractNo!="" && typeof(ContractNo)!="undefined"){
var condition = " m.ContractNo='"+ContractNo+"' ";
Ext.Msg.wait('正在从远程服务器上获取数据, 请稍侯..');
Ext.Ajax.timeout = 9000000; //90秒
Ext.Ajax.request({
waitMsg: '正在从远程服务器上获取数据...',
url: '/Import/XXH/SendXML',
scope: this,
params: {
condition: condition
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult._r) {
this.getLocalData(Local_ContractNo);
} 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');
}
});
}
},
getLocalData:function(Local_Contractno){
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/Import/ImportSync/GetSyncData_Local',
params: {
Local_Contractno: Local_Contractno
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title: '提示',
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
}
data = result.data;
// this.formEdit.getForm().reset();
if (data.KCClear=='True'){
data.KCClear='1';
}else{data.KCClear='0'};
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.LOCK_EXCHANGERATE=="1"){
data.LOCK_EXCHANGERATE='1';
}else{data.LOCK_EXCHANGERATE='0'};
if (_R=this.formLocal.getForm().setValues(data)){
//this.setSaveBtnEnable(true);
}
//设置项目不同的背景色
this.DoSetDifferent(data);
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});//request over
},
checkedit: function (){
var _r=false;
if (this.storeBodyChFee.getCount()==0){_r= true;}
else{
for (var i = 0; i < this.storeBodyChFee.getCount(); i += 1) {
var member = this.storeBodyChFee.getAt(i).data;
if (member.FeeName=="") {
alert("请填写费用名称");
_r= false;
}else{_r= true;}
}}
for (var i = 0; i < this.storeKC.getCount(); i += 1) {
var member = this.storeKC.getAt(i).data;
if (member.czdate==null||member.czdate=="" ) {
alert("操作时间不应为空");
_r= false;
}else{_r= true;}
}
var _L =this.formEdit.getForm().findField('LOCK_EXCHANGERATE').getValue();
if (_L=="True"){
_E=this.formEdit.getForm().findField('EXCHANGERATE').getValue();
for (var i = 0; i < this.storeCargo.getCount(); i += 1) {
var member = this.storeKC.getAt(i).data;
if (parseFloat( member.exchangerate)!=parseFloat(_E) ) {
alert("锁汇汇率与商品信息的汇率不一致");
//_r= false;
}else{_r= true;}
}
}
_form = this.formEdit.getForm();
var seller_name=_form.findField('seller').getValue();
var seller = DsStoreQueryBy(this.storeSeller, 'name',seller_name );
if (seller.getCount() > 0) {
var sellerdata = seller.getAt(0).data;
if (sellerdata.ISSTOP=="True"){
alert("你选择的贸易商已经停用");
_r=false;
//return;
}
}
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) {
//alert(this.opStatus);
if (!this.checkedit()) {
return;
}
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();
basicForm.findField('ContractNo').setDisabled(true);
var _MBLNOREPEAT=data.MBLNOREPEAT;
if (_MBLNOREPEAT==0){
this.BillNoCount=0;
Ext.Ajax.request({
waitMsg: '正在查询数据...',
url: '/CommMng/BasicDataRef/GeneralSelect',
scope: this,
async:false,
params: {condition: "select BillNo as GVALUE,ContractNo as GID from Import_Main where BillNo='"+data.BillNo+"' and isnull(BillNo,'')<>'' and ContractNo<>'"+data.ContractNo+"'"},
//params: {condition: "select BillNo as GVALUE,ContractNo as GID from Import_Main "},
waitMsg: "正在查询数据...",
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.success==false){
}else{
var returnData = jsonresult.data;
//alert(returnData.Count);
this.BillNoCount=parseInt(returnData.length);
}
} else {
Ext.Msg.show({ title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
return;
}
}
});
if (this.BillNoCount>0){
alert("提单号重复!");
return;
}
}
// #region 防止合同号重复
var HTHCount=0;
Ext.Ajax.request({
waitMsg: '正在查询数据...',
url: '/CommMng/BasicDataRef/GeneralSelect',
scope: this,
async:false,
params: {condition: "select HTH as GVALUE,ContractNo as GID from Import_Main where HTH='"+data.HTH+"' and isnull(HTH,'')<>'' and ContractNo<>'"+data.ContractNo+"'"},
//params: {condition: "select BillNo as GVALUE,ContractNo as GID from Import_Main "},
waitMsg: "正在查询数据...",
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.success==false){
}else{
var returnData = jsonresult.data;
HTHCount=parseInt(returnData.length);
}
} else {
Ext.Msg.show({ title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
return;
}
}
});
if (HTHCount>0){
alert("合同号重复!");
return;
}
//#endregion
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 Appstatedatas = [];
for (var i = 0; i < this.storeAppstate.getCount(); i += 1) {
var member = this.storeAppstate.getAt(i);
Appstatedatas.push(member);
}
var KCdatas = [];
for (var i = 0; i < this.storeKC.getCount(); i += 1) {
var member = this.storeKC.getAt(i);
KCdatas.push(member);
}
//票据明细用
var jsonBody = ConvertRecordsToJson(bodydatas);
var jsonDelBody = ConvertRecordsToJsonAll(this.bodyDel);
//商品明细
var CargoBody = ConvertRecordsToJson(Cargodatas);
var CargoDelBody = ConvertRecordsToJsonAll(this.CargoDel);
//许可证使用
var AppstateBody = ConvertRecordsToJson(Appstatedatas);
var AppstateDelBody = ConvertRecordsToJsonAll(this.AppstateDel);
//库存记录
var KCBody = ConvertRecordsToJson(KCdatas);
var KCDelBody = ConvertRecordsToJsonAll(this.KCDel);
//费用
var bodyChFeeDatas = [];
for (i = 0; i < this.storeBodyChFee.getCount(); i += 1) {
var memberyf = this.storeBodyChFee.getAt(i);
bodyChFeeDatas.push(memberyf);
var amount = memberyf.data.Amount;
var CustomerName = memberyf.data.CustomerName;
if (amount == 0) {
Ext.Msg.show({ title: '警告',
msg: '费用的金额不允许为0请修改后再保存',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
return;
}
if (CustomerName == '') {
Ext.Msg.show({ title: '警告',
msg: '结算对象不能为空,请修改后再保存',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
return;
}
/*
var FeeStatus = memberyf.data.FeeStatus;
if(FeeStatus=="10"||FeeStatus=="11"||FeeStatus=="12"){
}else{*/
if (parseFloat(ExChangerate) == 1 && Currency!="RMB") {
Ext.Msg.show({ title: '警告',
msg: '汇率错误,不能保存',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
return;
}
if (parseFloat(ExChangerate) != 1 && Currency=="RMB") {
Ext.Msg.show({ title: '警告',
msg: '汇率错误,不能保存',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
return;
}
//}
};
for (i = 0; i < this.storeBodyChFee_YF.getCount(); i += 1) {
var memberyf = this.storeBodyChFee_YF.getAt(i);
bodyChFeeDatas.push(memberyf);
var amount = memberyf.data.Amount;
var CustomerName = memberyf.data.CustomerName;
var ExChangerate = memberyf.data.ExChangerate;
var Currency = memberyf.data.Currency;
if (amount == 0) {
Ext.Msg.show({ title: '警告',
msg: '费用的金额不允许为0请修改后再保存',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
return;
}
if (CustomerName == '') {
Ext.Msg.show({ title: '警告',
msg: '结算对象不能为空,请修改后再保存',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
return;
}
if (parseFloat(ExChangerate) == 1 && Currency!="RMB") {
Ext.Msg.show({ title: '警告',
msg: '汇率错误,不能保存',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
return;
}
if (parseFloat(ExChangerate) != 1 && Currency=="RMB") {
Ext.Msg.show({ title: '警告',
msg: '汇率错误,不能保存',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
return;
}
};
var jsonChFeeBody = ConvertRecordsToJson(bodyChFeeDatas);
var jsonChFeeDelBody = ConvertRecordsToJsonAll(this.feeBodyDel);
data.KCClear=this.formEdit.getForm().findField('KCClear').getValue()?1:0;
data.HaveContract=this.formEdit.getForm().findField('HaveContract').getValue()?1:0;
data.HaveCargoMark=this.formEdit.getForm().findField('HaveCargoMark').getValue()?1:0;
data.LOCK_EXCHANGERATE=this.formEdit.getForm().findField('LOCK_EXCHANGERATE').getValue()?1:0;
data.IsLBill=this.formEdit.getForm().findField('IsLBill').getValue()?1:0;
data.IsInnerLine=this.formEdit.getForm().findField('IsInnerLine').getValue()?1:0;
data.IsRec=this.formEdit.getForm().findField('IsRec').getValue()?1:0;
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/Import/XXH/Save_HD',
scope: this,
params: {
opstatus: this.opStatus,
data: Ext.JSON.encode(data),
Receiptbody: jsonBody,
Receiptdelbody: jsonDelBody,
CargoBody: CargoBody,
CargoDelBody: CargoDelBody,
AppstateBody: AppstateBody,
AppstateDelBody: AppstateDelBody,
KCBody: KCBody,
KCDelBody: KCDelBody,
chfeebody: jsonChFeeBody,
chfeedelbody: jsonChFeeDelBody
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.storeCargo.commitChanges();
this.storeReceipt.commitChanges();
this.storeAppstate.commitChanges();
this.storeKC.commitChanges();
this.storeBodyChFee.commitChanges();
this.storeBodyChFee_YF.commitChanges();
var returnData = jsonresult.Data;
if (returnData.KCClear=='True'){
returnData.KCClear='1';
}else{returnData.KCClear='0'};
if (returnData.ContractStatus=='True'){
returnData.ContractStatus='1';
}else{returnData.ContractStatus='0'};
if (returnData.HaveContract=='True'){
returnData.HaveContract='1';
}else{returnData.HaveContract='0'};
if (returnData.HaveCargoMark=='True'){
returnData.HaveCargoMark='1';
}else{returnData.HaveCargoMark='0'};
if (returnData.LOCK_EXCHANGERATE=="1"){
returnData.LOCK_EXCHANGERATE='1';
}else{returnData.LOCK_EXCHANGERATE='0'};
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));
if (name == 'ISREFORM'){
if (editp.get(name)=="1"){
this.editRecord.set(name, "是");
}else{
this.editRecord.set(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')} });
this.storeKC.load({ params: { condition:"K.ContractNo = '" + this.editRecord.get('ContractNo')+ "' and K.corpid='"+COMPANYID+"'"} });
this.storeReceipt.load({ params: { billno: this.editRecord.get('ContractNo')} });
//this.storeBodyChFee.load({ params: { billno: this.editRecord.get('ContractNo'),Feetype:'1'} });
//this.storeBodyChFee_YF.load({ params: { billno: this.editRecord.get('ContractNo'),Feetype:'2'} });
//改为将所有费用的data里的BSNO改成 this.editRecord.get('ContractNo')
//而不是重新加载,以保持选中信息
for(var i =0;i<this.storeBodyChFee.getCount();i++){
_f=this.storeBodyChFee.getAt(i).data; //遍历每一行
_f.BsNo=this.editRecord.get('ContractNo');
}
for(var i =0;i<this.storeBodyChFee_YF.getCount();i++){
_f=this.storeBodyChFee_YF.getAt(i).data; //遍历每一行
_f.BsNo=this.editRecord.get('ContractNo');
}
basicForm.findField('ContractNo').setDisabled(true);
} else if (type == '1') {//保存并关闭
window.close();
} else if (type == '2'){//保存并全部新建
this.opStatus = 'add';
this.formEdit.getForm().reset();
//this.LoadData('add', '');
basicForm.findField('ContractNo').setDisabled(false);
this.storeCargo.removeAll();
this.storeApp.removeAll();
this.storeAppstate.removeAll();
this.storeKC.removeAll();
this.storeReceipt.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();
var Cargodatas = [];
for (var i = 0; i < this.storeCargo.getCount(); i += 1) {
this.storeCargo.getAt(i).set("ContractNo","");
}
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
onAddFileClick: function (button, event) {
var billno = this.formEdit.getForm().findField('ContractNo').value;
//var myDate = new Date();
var record = Ext.create('ReceiptDocmb', {
GID: NewGuid(),
RECEIPTTYPE: '',
R_GID: '',
BSNO: '', //ContractNo
URL: '',
Driect_URL: '',
MODIFIEDUSER: SHOWNAME,
MODIFIEDTIME: currdate.format('yyyy-MM-dd hh:mm:ss')
});
this.storeDocList.add(record);
var n = this.storeDocList.getCount();
this.DocListCellEditing.startEditByPosition({ row: n - 1, column: 5 });
}
, onPostFileClick: function (button, event) {
if (USERID == "") {
alert("登录信息不全,请退出重新登录");
return;
}
var billno = this.formEdit.getForm().findField('ContractNo').value;
var bodyDatas = [];
var i;
for (i = 0; i < this.storeDocList.getCount(); i += 1) {
var memberyf = this.storeDocList.getAt(i);
bodyDatas.push(memberyf);
var FILENAME = memberyf.data.FILENAME;
if (FILENAME == '') {
Ext.Msg.show({ title: '警告',
msg: '文件名称不能为空',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
return;
}
};
var DocBody = ConvertRecordsToJsonAll(bodyDatas);
_this = this;
//var Docdatas = [];
//var DocBody = ConvertRecordsToJson(Docdatas);
//var DocBodyDel = ConvertRecordsToJsonAll(this.DocDel);
var _this = this;
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/Import/ReceiptDoc/SaveDoc',
scope: this,
params: {
BSNO: billno,
DocBody: DocBody
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var condition = _this.editRecord.get('ContractNo');
var condition2 = " BSNO='" + condition + "' ";
_this.Loading = true;
_this.storeDocList.load({
params: { condition: condition2 },
waitMsg: "正在查询数据...",
scope: this,
callback: function () {
_this.Loading = false;
}
});
} else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
} else {
Ext.Msg.show({ title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
//alert('03');
}
});
} //end save
, onDelFileClick: function (button, event) {
var feeGidSql = '';
var selectedRecords = [];
selectedRecords = this.DocCM.selected.items;
if (selectedRecords.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择要删除的附件!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
Ext.MessageBox.confirm('提示', '确定要删除选中的附件吗?', function (btn) {
if (btn == 'yes') {
if (selectedRecords.length > 0) {
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (rec.data.GID == "*") //如果是新增但没有保存的数据,没有必要提交到后台
{
this.storeDocList.remove(selectedRecords[i]);
} else {
var feeGId = "'" + rec.data.GID + "'";
if (feeGidSql == '') {
feeGidSql = feeGId;
} else {
feeGidSql = feeGidSql + "," + feeGId;
}
}
}
}
_this = this;
Ext.Msg.wait('正在删除数据...');
if (feeGidSql != '') {
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/Import/ImportTrade/DeleteUploadFile',
params: {
data: feeGidSql
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
for (var i = 0; i < selectedRecords.length; i++) {
this.storeDocList.remove(selectedRecords[i]);
}
Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
}
},
failure: function (response, options) {
Ext.Msg.show({ title: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
},
success: function (response, options) {
},
scope: this
}); //end Ext.Ajax.request
} else {
Ext.Msg.show({ title: '提示', msg: "删除成功!", icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
}
}, this);
}
, onUpLoadFileClick: function (button, event) {
var billno = this.formEdit.getForm().findField('ContractNo').value;
var selections = this.gridDocList.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择要上传的单据类型!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var record = selections[0];
var BSNO = record.data.BSNO;
var HTH = this.editRecord.get('HTH');
var RECEIPTTYPE = record.data.RECEIPTTYPE;
if (BSNO == '') {
Ext.Msg.show({ title: '提示', msg: '请先保存,再上传!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var GID = record.data.GID;
me = this;
var imgform = new Ext.FormPanel({
region: 'center',
labelWidth: 40,
frame: true,
bodyStyle: 'padding:5px 5px 0',
autoScroll: true,
border: false,
fileUpload: true,
items: [{
xtype: 'fileuploadfield',
id: 'LoadImage',
name: 'LoadImage',
emptyText: '请选择图片',
fieldLabel: '图片',
buttonText: '选择文件',
allowBlank: false,
buttonCfg:
{
iconCls: 'uploaddialog'
},
anchor: '98%'
}, {
xtype: 'textfield',
id: 'fileName_EX',
name: 'fileName_EX',
emptyText: '请填写文件后缀(如_g等)',
fieldLabel: '文件后缀名',
allowBlank: true
}],
buttons: [{
text: '上传',
type: 'submit',
handler: function () {
var UserFilePath = Ext.getCmp('LoadImage').getValue();
if (!CheckFileExt(UserFilePath, /.jpg|.gif|.png|.bmp|.pdf/i)) {
Ext.Msg.show({ title: '错误', msg: '请确认你上传的文件为图片文件!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
if (!imgform.form.isValid()) { return; }
imgform.form.submit({
url: '/Import/ImportTrade/UploadFile',
waitMsg: '正在上传',
method: 'POST',
submitEmptyText: false,
async:false,
params: {
fileGid: GID
, HTH: HTH
, RECEIPTTYPE: RECEIPTTYPE
},
success: function (form, action) {
win.close(this);
Ext.Msg.show({ title: '提示', msg: '上传成功!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
var condition = me.editRecord.get('ContractNo');
var condition2 = " BSNO='" + condition + "' ";
me.Loading = true;
me.storeDocList.load({
params: { condition: condition2 },
waitMsg: "正在查询数据...",
scope: this,
callback: function () {
me.Loading = false;
}
});
},
failure: function (form, action) {
form.reset();
if (action.failureType == Ext.form.Action.SERVER_INVALID)
Ext.MessageBox.alert('警告', action.result.errors.msg);
}
});
}
}, {
text: '关闭',
type: 'submit',
handler: function () {
win.close(this);
}
}]
});
var win = new Ext.Window({
title: "上传图片",
width: 360,
height: 120,
modal: true,
resizable: false,
border: false,
items: imgform
});
win.show();
}
,
Print: function () {
var selectedRecords = this.gridListChFee.selModel.getSelection();
var chfeeList = "";
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (chfeeList=="") {
chfeeList="'"+rec.get('GId')+"'";
}
else {
chfeeList=chfeeList+",'"+rec.get('GId')+"'";
}
}
var selectedRecords = this.gridListChFee_YF.selModel.getSelection();
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (chfeeList=="") {
chfeeList="'"+rec.get('GId')+"'";
}
else {
chfeeList=chfeeList+",'"+rec.get('GId')+"'";
}
}
if (chfeeList=="") {
Ext.Msg.show({ title: '错误', msg: '至少选择一项费用', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
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;
}
function GetDateStr(AddDayCount) {
var dd = new Date();
dd.setDate(dd.getDate()+AddDayCount);//获取AddDayCount天后的日期
var y = dd.getFullYear();
var m = dd.getMonth()+1;//获取当前月份的日期
var d = dd.getDate();
return y+"-"+m+"-"+d;
}
//alert(GetDateStr(+5));
var needdate = GetDateStr(+5);
var printdate = GetDateStr(0);
var printType = 'XXH_Port_KHDZ';//单笔客户对账
//
var sql1 = " select *, ";
var sql1 = sql1+"(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=10 and EnumValueID=M.port) as portRef ";
var sql1 = sql1+" ,(select country from code_country where COUNTRYID=m.countryid) country ";
var sql1 = sql1+" ,dbo.f_str(m.contractno) cargoname,dbo.F_FactoryNo(M.contractno) FactoryNo from import_main m where contractno='"+ContractNo+"' ";
var sql2 = " select feename,unitprice,quantity,currency,exchangerate, ";
var sql2 = sql2+" case feetype when '1' then amount else 0-amount end Amount,remark ";
var sql2 = sql2+" from ch_fee where gid in( ";
var sql2 = sql2+chfeeList+" ) order by sort";
var sql3 = "select * from [user] where codename='"+usercode+"'";
var sql4 = "select '"+needdate+"' needdate,'"+printdate+"' printdate";
var sql5 = "select prtheadxml3 name,prtheadxml4 ZH,prtheadxml5 YH from company where gid=(select company from import_main where contractno='"+ContractNo+"')";
var sql6 = "select dbo.f_str('"+ContractNo+"'),sum(weight) [weight] from import_cargo where contractno='"+ContractNo+"'";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
}
,
PrintKCFee: function () {
var selectedRecords = this.formKC.selModel.getSelection();
var KCList = "";
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (KCList=="") {
KCList=rec.get('id');
}
else {
KCList=KCList+","+rec.get('id');
}
}
if (KCList=="") {
Ext.Msg.show({ title: '错误', msg: '至少选择一条库存记录', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
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;
}
function GetDateStr(AddDayCount) {
var dd = new Date();
dd.setDate(dd.getDate()+AddDayCount);//获取AddDayCount天后的日期
var y = dd.getFullYear();
var m = dd.getMonth()+1;//获取当前月份的日期
var d = dd.getDate();
return y+"-"+m+"-"+d;
}
//alert(GetDateStr(+5));
var needdate = GetDateStr(+5);
var printdate = GetDateStr(0);
var printType = 'XXH_Port_KHDZ_KC';//客户对账_KC
//
var sql1 = " select *, ";
var sql1 = sql1+"(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=10 and EnumValueID=M.port) as portRef ";
var sql1 = sql1+" from import_main m where contractno='"+ContractNo+"' ";
var sql2 = "SELECT [id],[ContractNo],[cargo_id],[CZState],[InNum],[OutNum],[KFstate],dbo.trimdate(CZdate) czdate ";
var sql2 = sql2+",[text],[days],[FeeName],[UnitPrice],[Quantity],[Amount],[Sended],[Weight],(select name from import_cargo where id=import_kc.cargo_id) cargoname ";
var sql2 = sql2+" FROM [Shippingweb].[dbo].[Import_KC] ";
var sql2 = sql2+" where id in( " +KCList+" ) order by czdate";
var sql3 = "select * from [user] where codename='"+usercode+"'";
var sql4 = "select '"+needdate+"' needdate,'"+printdate+"' printdate";
var sql5 = "select prtheadxml3 name,prtheadxml4 ZH,prtheadxml5 YH from company where gid=(select company from import_main where contractno='"+ContractNo+"')";
var sql6 = " select m.hth 合同号,k.outnum 出库数量,k.Weight 出库重量,k.kfstate 库房,k.czdate 出库日期 ";
sql6 = sql6 + " ,m.inspection_no 报检号,m.BillNo 提单号,m.ContainerNo 箱号,k.cargo_id 商品名称 ";
sql6 = sql6 + " ,(select top 1 isnull(name,'') from import_cargo where convert(varchar,id)=k.cargo_id) 商品名称_原 ";
sql6 = sql6 + " ,m.Buyer 客户名称,(select enumvaluename from tSysEnumValue where enumtypeid=8 and enumvalueid=k.czstate ) 作业内容 ";
sql6 = sql6 + " ,k.czdate 作业时间,substring((select top 1 country from code_country where countryid= m.countryid),0,(charindex('(',(select top 1 country from code_country where countryid= m.countryid))) ) 进口国 ";
sql6 = sql6 + " ,m.sealno 铅封号,M.Contacter 联系人,M.Tel 联系电话,K.text 备注,M.op 操作人,M.DeliveryAddress 送货地址,K.TRUCKNO 车号,K.TRUCKTEL 司机电话 ";
sql6 = sql6 + " ,(select EnumValueName from tSysEnumValue where EnumTypeID=8 and EnumValueID=K.CZSTATE) 业务类型 ";
sql6 = sql6 + " from import_kc k ";
sql6 = sql6 + " left join import_main m on m.contractno=k.contractno where k.id in(" + KCList + ")";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
}
,DoPrint: function(){
var _p = this.MainTab.getActiveTab().id;
if (_p == "page_2") {
//打印仓储费对账单
this.PrintKCFee();
}
if (_p == "page_4") {
//打印应收应付
this.Print();
}
}
});