|
|
///<reference path="../../../../Views/../TruckMng/Scripts/vswd-ext_2.0.2.js" />
|
|
|
Ext.namespace('DsTruck');
|
|
|
|
|
|
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)
|
|
|
{
|
|
|
return true;
|
|
|
}
|
|
|
else return false;
|
|
|
}
|
|
|
|
|
|
Ext.extend(DsTruck.XXHEdit, Ext.Panel, {
|
|
|
parentWin: null,
|
|
|
OpStatus: 'add',
|
|
|
StoreList: null,
|
|
|
editRecord: null,
|
|
|
// parentfunction: null,
|
|
|
_First: true,
|
|
|
initUIComponents: function () {
|
|
|
|
|
|
this.bodyDel = [];
|
|
|
this.CargoDel = [];
|
|
|
this.AppstateDel = [];
|
|
|
this.KCDel = [];
|
|
|
|
|
|
this.feeSerialNo = 0;
|
|
|
this.feeBodyDel = [];
|
|
|
//枚举参照相关(编辑form)
|
|
|
this.storeMainstate = Ext.create('DsExt.ux.RefEnumStore', {});
|
|
|
this.storeMainstate.load({ params: { enumTypeId: 3 } });
|
|
|
this.comboxMainstate = Ext.create('DsExt.ux.RefEnumCombox', {
|
|
|
fieldLabel: '合同状态',
|
|
|
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: '是否打印',
|
|
|
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: '核销完成',
|
|
|
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: '卫生证是否可查',
|
|
|
store: this.storeCIQ_canbesearch,
|
|
|
name: 'CIQ_canbesearch'
|
|
|
});
|
|
|
|
|
|
this.storeWriteoffs = Ext.create('DsExt.ux.RefEnumStore', {});
|
|
|
this.storeWriteoffs.load({params: {enumTypeId: 0}});
|
|
|
this.comboxWriteoffs = Ext.create('DsExt.ux.RefEnumCombox', {
|
|
|
fieldLabel: '核销完成',
|
|
|
store: this.storeWriteoffs,
|
|
|
name: 'Writeoffs'
|
|
|
});
|
|
|
this.storeAutoAPP = Ext.create('DsExt.ux.RefEnumStore', {});
|
|
|
this.storeAutoAPP.load({ params: { enumTypeId: 0 } });
|
|
|
this.comboxAutoAPP = Ext.create('DsExt.ux.RefEnumCombox', {
|
|
|
fieldLabel: '自动证',
|
|
|
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: '提单提交方式',
|
|
|
store: this.storeBillType,
|
|
|
name: 'BillType'
|
|
|
});
|
|
|
|
|
|
this.storeShipCompany = Ext.create('DsExt.ux.RefEnumStore', {});
|
|
|
this.storeShipCompany.load({ params: { enumTypeId: 5 } });
|
|
|
this.comboxShipCompany = Ext.create('DsExt.ux.RefEnumCombox', {
|
|
|
fieldLabel: '船公司',
|
|
|
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: '是否已交保证金',
|
|
|
store: this.storeSecurityDeposit,
|
|
|
name: 'SecurityDeposit'
|
|
|
});
|
|
|
|
|
|
|
|
|
this.storeTransactionMethod = Ext.create('DsExt.ux.RefEnumStore', {});
|
|
|
this.storeTransactionMethod.load({ params: { enumTypeId: 1} });
|
|
|
this.comboxTransactionMethod = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: '成交方式',
|
|
|
store: this.storeTransactionMethod,
|
|
|
name: 'TransactionMethod',
|
|
|
valueField: 'EnumValueId',
|
|
|
displayField: 'EnumValueName',
|
|
|
triggerAction: 'all',
|
|
|
selectOnFocus: true,
|
|
|
listeners: {
|
|
|
change: function (field, newValue, oldValue) {
|
|
|
this.setBaolv(field, newValue, oldValue);
|
|
|
},
|
|
|
scope: this
|
|
|
},
|
|
|
flex:1
|
|
|
});
|
|
|
|
|
|
this.storePaymentMethods = Ext.create('DsExt.ux.RefEnumStore', {});
|
|
|
this.storePaymentMethods.load({ params: { enumTypeId: 4 }});
|
|
|
this.comboxPaymentMethods = Ext.create('DsExt.ux.RefEnumCombox', {
|
|
|
fieldLabel: '付款方式',
|
|
|
store: this.storePaymentMethods,
|
|
|
name: 'PaymentMethods'
|
|
|
});
|
|
|
|
|
|
this.storeport = Ext.create('DsExt.ux.RefEnumStore', {});
|
|
|
this.storeport.load({ params: { enumTypeId: 10}});
|
|
|
this.comboxport = Ext.create('DsExt.ux.RefEnumCombox', {
|
|
|
fieldLabel: '目的港',
|
|
|
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: '进口国',
|
|
|
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.comboxSeller = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: '贸易商',
|
|
|
store: this.storeSeller,
|
|
|
name: 'seller',
|
|
|
valueField: 'name',
|
|
|
displayField: 'codename'
|
|
|
});
|
|
|
|
|
|
this.storeBuyer = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'Tradermb',
|
|
|
proxy: {url: '/CommMng/BasicDataRef/GetTrader'}});
|
|
|
this.storeBuyer.load({params: {condition: " isagentcn=1"}});
|
|
|
this.comboxBuyer = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: '客户(购货方)',
|
|
|
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: '订货方(中间商)',
|
|
|
store: this.storeTRADINGAGENCY,
|
|
|
name: 'TRADINGAGENCY',
|
|
|
valueField: 'name',
|
|
|
displayField: 'codename',
|
|
|
flex:1
|
|
|
});
|
|
|
|
|
|
//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: "" } });
|
|
|
this.comboxCreator = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: '接单人',
|
|
|
store: this.storeUser,
|
|
|
name: 'creator',
|
|
|
valueField: 'UserCode',
|
|
|
displayField: 'CodeAndName'
|
|
|
});
|
|
|
this.comboxAuditor = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: '审单人',
|
|
|
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: '用证公司',
|
|
|
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: '融资状态',
|
|
|
store: this.storeFStatus,
|
|
|
name: 'FinanceStatus'
|
|
|
});
|
|
|
this.storeSampling_need = Ext.create('DsExt.ux.RefEnumStore', {});
|
|
|
this.storeSampling_need.load({ params: { enumTypeId: 0 } });
|
|
|
this.comboxSampling_need = Ext.create('DsExt.ux.RefEnumCombox', {
|
|
|
fieldLabel: '海关是否验货',
|
|
|
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: '是否采样入库',
|
|
|
store: this.storeInspection_Storage,
|
|
|
name: 'Inspection_Storage'
|
|
|
});
|
|
|
|
|
|
this.storeReceiptStatus = Ext.create('DsExt.ux.RefEnumStore', {});
|
|
|
this.storeReceiptStatus.load({ params: { enumTypeId: 0 } });
|
|
|
this.comboxReceiptStatus = Ext.create('DsExt.ux.RefEnumCombox', {
|
|
|
fieldLabel: '单据是否完备',
|
|
|
store: this.storeReceiptStatus,
|
|
|
name: 'ReceiptStatus',
|
|
|
flex:1
|
|
|
});
|
|
|
|
|
|
//////////////////
|
|
|
//编辑form:formEdit
|
|
|
this.formEdit = Ext.widget('form', {
|
|
|
// layout: "border",
|
|
|
region: 'center',
|
|
|
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',
|
|
|
defaults: {
|
|
|
anchor: '100%'
|
|
|
},
|
|
|
items: [{ //container_1
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [{
|
|
|
fieldLabel: '合同序列号',
|
|
|
// allowBlank: false,
|
|
|
disabled: true,
|
|
|
name: 'ContractNo'
|
|
|
}, this.comboxCreator,{
|
|
|
fieldLabel: '接单时间',
|
|
|
format: 'Y-m-d H:i:s',
|
|
|
xtype: 'datefield',
|
|
|
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',
|
|
|
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'
|
|
|
}]
|
|
|
},
|
|
|
//container_1 end
|
|
|
{
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [
|
|
|
this.comboxSeller,
|
|
|
this.comboxBuyer,
|
|
|
this.comboxCompany,{
|
|
|
fieldLabel: '双抬头',
|
|
|
name: 'STT'
|
|
|
},this.comboxCountry]
|
|
|
},
|
|
|
{
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [this.comboxport,{
|
|
|
fieldLabel: '合同号',
|
|
|
// allowBlank: false,
|
|
|
name: 'HTH'
|
|
|
},{
|
|
|
fieldLabel: '提单号',
|
|
|
name: 'BillNo'
|
|
|
},{
|
|
|
fieldLabel: '箱号',
|
|
|
name: 'ContainerNo'
|
|
|
},
|
|
|
{
|
|
|
fieldLabel: '铅封号',
|
|
|
name: 'SealNo'
|
|
|
}
|
|
|
]
|
|
|
},
|
|
|
{
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [ this.comboxShipCompany,{
|
|
|
fieldLabel: '免箱期',
|
|
|
name: 'Freetime'
|
|
|
},{
|
|
|
fieldLabel: '船名',
|
|
|
name: 'Vessel'
|
|
|
},
|
|
|
{
|
|
|
fieldLabel: '航次',
|
|
|
name: 'Voyage'
|
|
|
},{
|
|
|
fieldLabel: '预计开船日',
|
|
|
format: 'Y-m-d',
|
|
|
xtype: 'datefield',
|
|
|
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
|
|
|
name: 'Ex_sailingdate'
|
|
|
}/*,
|
|
|
{
|
|
|
fieldLabel: '提单时间',
|
|
|
format: 'Y-m-d',
|
|
|
xtype: 'datefield',
|
|
|
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
|
|
|
name: 'BillTime'
|
|
|
},
|
|
|
this.comboxWriteoffs,*/ ]
|
|
|
},
|
|
|
{
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [{
|
|
|
fieldLabel: '开船日期',
|
|
|
format: 'Y-m-d',
|
|
|
xtype: 'datefield',
|
|
|
name: 'Sailingdate'
|
|
|
},
|
|
|
{
|
|
|
fieldLabel: '到港日期',
|
|
|
format: 'Y-m-d',
|
|
|
xtype: 'datefield',
|
|
|
name: 'ArrivalDate'
|
|
|
}, this.comboxPaymentMethods
|
|
|
, this.comboxTransactionMethod
|
|
|
, this.comboxBillType ]
|
|
|
},
|
|
|
{
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [
|
|
|
{
|
|
|
fieldLabel: '付货款时间(预付)',
|
|
|
format: 'Y-m-d',
|
|
|
xtype: 'datefield',
|
|
|
name: 'Prepaydate'
|
|
|
},{
|
|
|
fieldLabel: '电放时间',
|
|
|
format: 'Y-m-d',
|
|
|
xtype: 'datefield',
|
|
|
name: 'E_Billtime'
|
|
|
},{
|
|
|
fieldLabel: '正本时间',
|
|
|
format: 'Y-m-d',
|
|
|
xtype: 'datefield',
|
|
|
name: 'BillTime'
|
|
|
},{
|
|
|
fieldLabel: '换单时间',
|
|
|
format: 'Y-m-d',
|
|
|
xtype: 'datefield',
|
|
|
name: 'HDtime'
|
|
|
},this.comboxFStatus]
|
|
|
},
|
|
|
{
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [{
|
|
|
fieldLabel: '付货款时间(尾款)',
|
|
|
format: 'Y-m-d',
|
|
|
xtype: 'datefield',
|
|
|
name: 'Paydate',flex:1},
|
|
|
this.comboxReceiptStatus,this.comboxTRADINGAGENCY,{
|
|
|
fieldLabel: '寄单情况',
|
|
|
name: 'Receiptremark',
|
|
|
flex:2
|
|
|
}]
|
|
|
},
|
|
|
{
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [{
|
|
|
fieldLabel: '____备注1',
|
|
|
name: 'remark'
|
|
|
}]
|
|
|
},
|
|
|
{
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [this.comboxMainstate,{
|
|
|
fieldLabel: '卫生许可证(ciq)',
|
|
|
name: 'CIQ_licence'
|
|
|
},this.comboxCIQ_canbesearch,
|
|
|
this.comboxPrinted
|
|
|
]
|
|
|
},
|
|
|
{
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [ {
|
|
|
fieldLabel: '报检日期',
|
|
|
format: 'Y-m-d H:i:s',
|
|
|
xtype: 'datefield',
|
|
|
name: 'inspection_Signup_date'
|
|
|
},{
|
|
|
fieldLabel: '报检号',
|
|
|
name: 'inspection_no'
|
|
|
},this.comboxWriteoffs
|
|
|
,this.comboxAutoAPP
|
|
|
]
|
|
|
},
|
|
|
{
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [{
|
|
|
fieldLabel: '____备注2',
|
|
|
name: 'remark_2'
|
|
|
}]
|
|
|
},
|
|
|
{
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [{
|
|
|
fieldLabel: '出税日期',
|
|
|
format: 'Y-m-d H:i:s',
|
|
|
xtype: 'datefield',
|
|
|
name: 'tax_date'
|
|
|
},
|
|
|
{
|
|
|
fieldLabel: '付税日期',
|
|
|
format: 'Y-m-d H:i:s',
|
|
|
xtype: 'datefield',
|
|
|
name: 'tax_paydate'
|
|
|
},this.comboxSampling_need,
|
|
|
this.comboxSecurityDeposit
|
|
|
]
|
|
|
},
|
|
|
{
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [ {
|
|
|
fieldLabel: '海关确定抽检',
|
|
|
format: 'Y-m-d H:i:s',
|
|
|
xtype: 'datefield',
|
|
|
name: 'SamplingDate_Plan'
|
|
|
},
|
|
|
{
|
|
|
fieldLabel: '海关实际验货',
|
|
|
format: 'Y-m-d H:i:s',
|
|
|
xtype: 'datefield',
|
|
|
name: 'SamplingDate_Act'
|
|
|
},{
|
|
|
fieldLabel: '海关放行日期',
|
|
|
format: 'Y-m-d H:i:s',
|
|
|
xtype: 'datefield',
|
|
|
name: 'CustomsReleaseDate'
|
|
|
},{
|
|
|
fieldLabel: '报关单号',
|
|
|
name: 'DeclareNumber'
|
|
|
}]
|
|
|
},
|
|
|
{
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [{
|
|
|
fieldLabel: '____备注3',
|
|
|
name: 'remark_3'
|
|
|
}]
|
|
|
},
|
|
|
{
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [{
|
|
|
fieldLabel: '商检验货日期',
|
|
|
format: 'Y-m-d',
|
|
|
xtype: 'datefield',
|
|
|
name: 'inspection_date'
|
|
|
},this.comboxInspection_Storage,
|
|
|
{
|
|
|
fieldLabel: '送货日',
|
|
|
format: 'Y-m-d',
|
|
|
xtype: 'datefield',
|
|
|
name: 'DeliveryDate'
|
|
|
},{
|
|
|
fieldLabel: '送货地址',
|
|
|
name: 'DeliveryAddress'
|
|
|
}
|
|
|
]
|
|
|
},
|
|
|
{
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [{
|
|
|
fieldLabel: '联系人',
|
|
|
name: 'Contacter',
|
|
|
flex:1
|
|
|
},{
|
|
|
fieldLabel: '电话',
|
|
|
name: 'Tel',flex:1
|
|
|
},{
|
|
|
fieldLabel: '溢短装',
|
|
|
name: 'Overfilled',flex:2
|
|
|
}]
|
|
|
},
|
|
|
{
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [{
|
|
|
fieldLabel: '备注4',
|
|
|
name: 'remark_4'
|
|
|
}]
|
|
|
},
|
|
|
{
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [{
|
|
|
xtype : 'checkbox',flex:1,
|
|
|
fieldLabel: '财务锁定',
|
|
|
name: 'ContractStatus'
|
|
|
},{
|
|
|
fieldLabel: '会计期间',
|
|
|
//allowBlank: false,
|
|
|
xtype: 'monthfield',
|
|
|
name: 'ACCDATE',
|
|
|
flex: 1
|
|
|
}]
|
|
|
}]
|
|
|
}]
|
|
|
}); //end this.formEdit
|
|
|
|
|
|
//////////////////////////////////
|
|
|
//明细 <<<< 商品 >>>>
|
|
|
//相关
|
|
|
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: 'currRef',
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetcurrRefList' }
|
|
|
});
|
|
|
this.storecurr.load({ params: { condition: ""} });
|
|
|
this.comboxcurr = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
store: this.storecurr,
|
|
|
name: 'currid',
|
|
|
valueField: 'gid',
|
|
|
displayField: 'codename'
|
|
|
//币别
|
|
|
});
|
|
|
this.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'
|
|
|
});
|
|
|
//数据集
|
|
|
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.formCargo = new Ext.grid.GridPanel({
|
|
|
store: this.storeCargo,
|
|
|
enableHdMenu: false,
|
|
|
region: 'north',
|
|
|
//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: '库存初始化',
|
|
|
iconCls: "btnKCStart",
|
|
|
handler: function (button, event) {
|
|
|
this.onKCStartClick(button, event);
|
|
|
},
|
|
|
scope: this
|
|
|
}, '-', {
|
|
|
text: '生成应收应付',
|
|
|
tooltip: '生成应收应付',
|
|
|
iconCls: "btnCWStart",
|
|
|
handler: function (button, event) {
|
|
|
this.onbtnCWStartClick(button, event);
|
|
|
},
|
|
|
scope: this
|
|
|
}],
|
|
|
columns: [{
|
|
|
dataIndex: 'id',
|
|
|
header: '自增序列号',
|
|
|
width: 80,
|
|
|
hidden: true,
|
|
|
editor: {
|
|
|
xtype: 'textfield'
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
dataIndex: 'ContractNo',
|
|
|
header: '合同号',
|
|
|
width: 80,
|
|
|
hidden: true,
|
|
|
editor: {
|
|
|
xtype: 'textfield'
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
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/*,
|
|
|
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: {
|
|
|
xtype: 'textfield',
|
|
|
selectOnFocus: true
|
|
|
}
|
|
|
},{
|
|
|
dataIndex: 'Exchangerate_Customs',
|
|
|
header: '汇率_海关',
|
|
|
width: 75,
|
|
|
editor: {
|
|
|
xtype: 'textfield',
|
|
|
selectOnFocus: true
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
dataIndex: 'U_PRICE',
|
|
|
header: '单价(重量单位)',
|
|
|
width: 80,
|
|
|
//hidden: true,
|
|
|
editor: {
|
|
|
xtype: 'textfield',
|
|
|
selectOnFocus: true
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
dataIndex: 'U_weight',
|
|
|
header: '净重(重量单位)',
|
|
|
width: 80,
|
|
|
editor: {
|
|
|
xtype: 'textfield',
|
|
|
selectOnFocus: true
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
dataIndex: 'price',
|
|
|
header: '单价(币别/kg)',
|
|
|
width: 80,
|
|
|
allowBlank:false,
|
|
|
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: 80,
|
|
|
editor: {
|
|
|
xtype: 'textfield',
|
|
|
selectOnFocus: true
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
dataIndex: 'baolv',
|
|
|
header: '保率',
|
|
|
width: 55,
|
|
|
editor: {
|
|
|
xtype: 'textfield',
|
|
|
selectOnFocus: true
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
dataIndex: 'Amount',
|
|
|
header: '合同金额(对客户)',
|
|
|
width: 80,
|
|
|
editor: {
|
|
|
xtype: 'textfield',
|
|
|
selectOnFocus: true
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
dataIndex: 'prepayments',
|
|
|
header: '预付款',
|
|
|
width: 60,
|
|
|
//hidden: true,
|
|
|
editor: {
|
|
|
xtype: 'textfield',
|
|
|
selectOnFocus: true
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
dataIndex: 'balance',
|
|
|
header: '尾款',
|
|
|
width: 60,
|
|
|
//hidden: true,
|
|
|
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: 'Declarenumber',
|
|
|
header: '报关单号',
|
|
|
width: 80,
|
|
|
editor: {
|
|
|
xtype: 'textfield',
|
|
|
selectOnFocus: true
|
|
|
}
|
|
|
}]
|
|
|
});
|
|
|
|
|
|
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");
|
|
|
}
|
|
|
}
|
|
|
} */
|
|
|
|
|
|
//////////////////////////////////////////////明细<<<< 商品 >>>>结束
|
|
|
|
|
|
//////////////////////////////////
|
|
|
//明细 <<<< 许可证使用 >>>>
|
|
|
//表参照 可用许可证
|
|
|
|
|
|
this.storeApp = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'Appmb',
|
|
|
proxy: { url: '/Import/XXH/GetApp' }
|
|
|
});
|
|
|
this.comboxApp = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
store: this.storeApp,
|
|
|
name: 'app_id',
|
|
|
valueField: 'app_id',
|
|
|
displayField: 'info'
|
|
|
});
|
|
|
|
|
|
this.comboxCargo = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
store: this.storeCargo,
|
|
|
name: 'cargo_id',
|
|
|
valueField: 'id',
|
|
|
displayField: 'name'
|
|
|
});
|
|
|
|
|
|
this.storecancellation = Ext.create('DsExt.ux.RefEnumStore', {});
|
|
|
this.storecancellation.load({ params: { enumTypeId: 13} });
|
|
|
this.comboxcancellation = Ext.create('DsExt.ux.RefEnumCombox', {
|
|
|
//fieldLabel: '许可证使用',
|
|
|
store: this.storecancellation,
|
|
|
name: 'cancellation'
|
|
|
});
|
|
|
|
|
|
//结果集
|
|
|
this.storeAppstate = Ext.create('Ext.data.Store', {
|
|
|
model: 'Appstatemb',
|
|
|
remoteSort: false,
|
|
|
proxy: {
|
|
|
type: 'ajax',
|
|
|
url: '/Import/XXH/GetAppstate',
|
|
|
reader: {
|
|
|
id: 'id',
|
|
|
root: 'data',
|
|
|
totalProperty: 'totalCount'
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
//表格
|
|
|
|
|
|
this.cellEditingAppstate = Ext.create('Ext.grid.plugin.CellEditing', {
|
|
|
clicksToEdit: 1
|
|
|
});
|
|
|
this.formAppstate = new Ext.grid.GridPanel({
|
|
|
store: this.storeAppstate,
|
|
|
enableHdMenu: false,
|
|
|
region: 'north',
|
|
|
//height: 140,
|
|
|
title: '许可证使用 (注意,商品信息保存后才能选择使用许可证和商品)',
|
|
|
loadMask: { msg: "数据加载中,请稍等..." },
|
|
|
trackMouseOver: true,
|
|
|
disableSelection: false,
|
|
|
plugins: [this.cellEditingAppstate],
|
|
|
selType: 'cellmodel',
|
|
|
tbar: [{
|
|
|
text: '增加明细',
|
|
|
tooltip: '增加明细',
|
|
|
iconCls: "btnadddetail",
|
|
|
handler: function (button, event) {
|
|
|
this.onAddAppstateClick(button, event);
|
|
|
},
|
|
|
scope: this
|
|
|
}, '-', {
|
|
|
text: '删除明细',
|
|
|
tooltip: '删除明细',
|
|
|
iconCls: "btndeletedetail",
|
|
|
handler: function (button, event) {
|
|
|
this.onDelAppstateClick(button, event);
|
|
|
},
|
|
|
scope: this
|
|
|
}],
|
|
|
columns: [
|
|
|
{ hidden: true, dataIndex: 'id', header: 'id', width: 80 },
|
|
|
{ hidden: true, dataIndex: 'ContractNo', header: 'ContractNo', width: 80 },
|
|
|
{
|
|
|
dataIndex: 'app_id',
|
|
|
header: '许可证号',
|
|
|
allowBlank: false,
|
|
|
renderer: function (value, p, record) {
|
|
|
if (value == null || value == '')
|
|
|
return '';
|
|
|
else
|
|
|
return record.data.appno;
|
|
|
},
|
|
|
editor: this.comboxApp,
|
|
|
width: 180
|
|
|
},
|
|
|
// { hidden: true, dataIndex: 'app_id', header: 'app_id', width: 80 },
|
|
|
{
|
|
|
dataIndex: 'name',
|
|
|
header: '商品手册名称',
|
|
|
width: 80,
|
|
|
},
|
|
|
//this.comboxCargo,
|
|
|
{
|
|
|
dataIndex: 'cargo_id',
|
|
|
header: '货名',
|
|
|
allowBlank: false,
|
|
|
renderer: function (value, p, record) {
|
|
|
if (value == null || value == '')
|
|
|
return '';
|
|
|
else
|
|
|
return record.data.cargoname;
|
|
|
},
|
|
|
editor: this.comboxCargo,
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
dataIndex: 'appweight',
|
|
|
header: '许可证额度(吨)',
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
dataIndex: 'appremain',
|
|
|
header: '未核销(吨)',
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
dataIndex: 'country',
|
|
|
header: '进口国',
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
dataIndex: 'weight',
|
|
|
header: '使用重量(KG)',
|
|
|
editor: {
|
|
|
xtype: 'textfield',
|
|
|
selectOnFocus: true
|
|
|
}
|
|
|
},{
|
|
|
dataIndex: 'cancellation',
|
|
|
header: '许可证使用状态',
|
|
|
allowBlank: false,
|
|
|
renderer: function (value, p, record) {
|
|
|
if (value == null || value == '')
|
|
|
return '';
|
|
|
else
|
|
|
return record.data.cancellationRef;
|
|
|
},
|
|
|
editor: this.comboxcancellation,
|
|
|
width: 100
|
|
|
},{
|
|
|
dataIndex: 'validdate',
|
|
|
header: '有效期',
|
|
|
width: 80
|
|
|
}
|
|
|
]
|
|
|
});
|
|
|
|
|
|
//end--------------------------------------------------//明细<<<< 许可证使用 >>>>结束
|
|
|
|
|
|
//////////////////////////////////
|
|
|
//明细 <<<< 库存管理 >>>>
|
|
|
//枚举参照 库存流程
|
|
|
|
|
|
this.storeczstate = Ext.create('DsExt.ux.RefEnumStore', {});
|
|
|
this.storeczstate.load({ params: { enumTypeId: 8} });
|
|
|
this.comboxczstate = Ext.create('DsExt.ux.RefEnumCombox', {
|
|
|
store: this.storeczstate,
|
|
|
name: 'czstate'
|
|
|
});
|
|
|
|
|
|
this.storekfstate = Ext.create('DsExt.ux.RefEnumStore', {});
|
|
|
this.storekfstate.load({ params: { enumTypeId: 9} });
|
|
|
this.comboxkfstate = Ext.create('DsExt.ux.RefEnumCombox', {
|
|
|
store: this.storekfstate,
|
|
|
name: 'kfstate'
|
|
|
});
|
|
|
|
|
|
this.comboxCargo = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
store: this.storeCargo,
|
|
|
name: 'cargo_id',
|
|
|
valueField: 'id',
|
|
|
displayField: 'name'
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
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.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: 'north',
|
|
|
title: '库存 (注意,商品信息保存后才能选择使用许可证和商品)',
|
|
|
loadMask: { msg: "数据加载中,请稍等..." },
|
|
|
trackMouseOver: true,
|
|
|
disableSelection: false,
|
|
|
plugins: [this.cellEditingKC],
|
|
|
selType: 'cellmodel',
|
|
|
selModel: this.KCModel,
|
|
|
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: '生成选定费用',
|
|
|
iconCls: "ApplicationAdd",
|
|
|
handler: function (button, event) {
|
|
|
this.onKCFeeClick(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: 80
|
|
|
},
|
|
|
{
|
|
|
dataIndex: 'czstate',
|
|
|
header: '操作状态',
|
|
|
renderer: function (value, p, record) {
|
|
|
if (value == null || value == '')
|
|
|
return '';
|
|
|
else
|
|
|
return record.data.czref;
|
|
|
},
|
|
|
editor: this.comboxczstate,
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
dataIndex: 'innum',
|
|
|
header: '入库数量(箱件数)',
|
|
|
width: 80,
|
|
|
editor: {
|
|
|
xtype: 'textfield',
|
|
|
selectOnFocus: true
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
dataIndex: 'outnum',
|
|
|
header: '出库数量(箱件数)',
|
|
|
width: 80,
|
|
|
editor: {
|
|
|
xtype: 'textfield',
|
|
|
selectOnFocus: true
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
dataIndex: 'kfstate',
|
|
|
header: '库房',
|
|
|
renderer: function (value, p, record) {
|
|
|
if (value == null || value == '')
|
|
|
return '';
|
|
|
else
|
|
|
return record.data.kfref;
|
|
|
},
|
|
|
editor: this.comboxkfstate,
|
|
|
width: 120
|
|
|
},
|
|
|
{
|
|
|
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: 45,
|
|
|
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: 'text',
|
|
|
header: '备注',
|
|
|
width: 200,
|
|
|
editor: {
|
|
|
xtype: 'textfield',
|
|
|
selectOnFocus: true
|
|
|
}
|
|
|
}
|
|
|
]
|
|
|
});
|
|
|
|
|
|
//end--------------------------------------------------//明细<<<< 库存管理 >>>>结束
|
|
|
|
|
|
////////////////////////////////////////////////
|
|
|
//明细<<<< 单据表 >>>>
|
|
|
|
|
|
//单据表表格相关
|
|
|
//单据表用 枚举参照
|
|
|
this.storePaymentMethods = Ext.create('DsExt.ux.RefEnumStore', {});
|
|
|
this.storePaymentMethods.load({ params: { enumTypeId: 4} });
|
|
|
this.comboxPaymentMethods = Ext.create('DsExt.ux.RefEnumCombox', {
|
|
|
fieldLabel: '付款方式',
|
|
|
store: this.storePaymentMethods,
|
|
|
name: 'PaymentMethods'
|
|
|
});
|
|
|
|
|
|
this.storeReceiptid = Ext.create('DsExt.ux.RefEnumStore', {});
|
|
|
this.storeReceiptid.load({ params: { enumTypeId: 2} });
|
|
|
this.comboxReceiptid = Ext.create('DsExt.ux.RefEnumCombox', {
|
|
|
store: this.storeReceiptid,
|
|
|
name: 'Receiptid'
|
|
|
});
|
|
|
|
|
|
this.storeReceiptstate = Ext.create('DsExt.ux.RefEnumStore', {});
|
|
|
this.storeReceiptstate.load({ params: { enumTypeId: 7} });
|
|
|
this.comboxReceiptstate = Ext.create('DsExt.ux.RefEnumCombox', {
|
|
|
store: this.storeReceiptstate,
|
|
|
name: 'state'
|
|
|
});
|
|
|
|
|
|
//单据表-数据集
|
|
|
this.storeReceipt = Ext.create('Ext.data.Store', {
|
|
|
model: 'Receiptmb',
|
|
|
remoteSort: false,
|
|
|
proxy: {
|
|
|
type: 'ajax',
|
|
|
url: '/Import/XXH/GetReceiptList',
|
|
|
reader: {
|
|
|
id: 'id,ContractNo',
|
|
|
root: 'data',
|
|
|
totalProperty: 'totalCount'
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
//单据表表格
|
|
|
this.cellEditingReceipt = Ext.create('Ext.grid.plugin.CellEditing', {
|
|
|
clicksToEdit: 1
|
|
|
});
|
|
|
// this.ReceiptGridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
|
|
|
|
|
|
this.gridListReceipt = new Ext.grid.GridPanel({
|
|
|
store: this.storeReceipt,
|
|
|
enableHdMenu: false,
|
|
|
region: 'center',
|
|
|
loadMask: { msg: "数据加载中,请稍等..." },
|
|
|
trackMouseOver: true,
|
|
|
disableSelection: false,
|
|
|
plugins: [this.cellEditingReceipt],
|
|
|
selType: 'cellmodel',
|
|
|
tbar: [{
|
|
|
text: '增加明细',
|
|
|
tooltip: '增加明细',
|
|
|
iconCls: "btnadddetail",
|
|
|
handler: function (button, event) {
|
|
|
this.onAddReceiptClick(button, event);
|
|
|
},
|
|
|
scope: this
|
|
|
}, '-', {
|
|
|
text: '删除明细',
|
|
|
tooltip: '删除明细',
|
|
|
iconCls: "btndeletedetail",
|
|
|
handler: function (button, event) {
|
|
|
this.onDelReceiptClick(button, event);
|
|
|
},
|
|
|
scope: this
|
|
|
}/*, {
|
|
|
text: 'AA',
|
|
|
tooltip: 'AA',
|
|
|
handler: function (button, event) {
|
|
|
var selectedRecords = this.gridListReceipt.selModel.getSelection();
|
|
|
|
|
|
// alert(selectedRecords.length);
|
|
|
},
|
|
|
scope: this
|
|
|
}*/],
|
|
|
columns: [
|
|
|
{
|
|
|
sortable: true,
|
|
|
hidden: true,
|
|
|
dataIndex: 'id',
|
|
|
header: 'id',
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
hidden: true,
|
|
|
dataIndex: 'ContractNo',
|
|
|
header: 'ContractNo',
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'Receiptid',
|
|
|
header: '单据类型/名称',
|
|
|
renderer: function (value, p, record) {
|
|
|
if (value == null || value == '')
|
|
|
return '';
|
|
|
else
|
|
|
return record.data.ReceiptName;
|
|
|
},
|
|
|
editor: this.comboxReceiptid,
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'ReceiptNo',
|
|
|
header: '单据编号',
|
|
|
width: 100,
|
|
|
editor: {
|
|
|
xtype: 'textfield',
|
|
|
selectOnFocus: true
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'state',
|
|
|
header: '收发状态',
|
|
|
renderer: function (value, p, record) {
|
|
|
if (value == null || value == '')
|
|
|
return '';
|
|
|
else
|
|
|
return record.data.statename;
|
|
|
},
|
|
|
editor: this.comboxReceiptstate,
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'Send_date',
|
|
|
header: '发出时间',
|
|
|
width: 80,
|
|
|
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
|
|
|
editor: {
|
|
|
format: 'Y-m-d',
|
|
|
xtype: 'datefield',
|
|
|
selectOnFocus: true
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'receive_date',
|
|
|
header: '收到时间',
|
|
|
editor: {
|
|
|
xtype: 'datefield',
|
|
|
format: 'Y-m-d',
|
|
|
selectOnFocus: true
|
|
|
},
|
|
|
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'repeat_date',
|
|
|
header: '回复时间',
|
|
|
width: 80,
|
|
|
renderer: Ext.util.Format.dateRenderer('Y-n-j'),
|
|
|
editor: {
|
|
|
format: 'Y-n-j',
|
|
|
xtype: 'datefield'
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'trancer',
|
|
|
header: '快递公司',
|
|
|
width: 80,
|
|
|
editor: {
|
|
|
xtype: 'textfield'
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'trancNo',
|
|
|
header: '快递号',
|
|
|
width: 80,
|
|
|
editor: {
|
|
|
xtype: 'textfield'
|
|
|
}
|
|
|
}
|
|
|
]
|
|
|
});
|
|
|
//#endregion
|
|
|
///////---------------------------------/明细 <<<< 单据表 >>>> over
|
|
|
|
|
|
///////明细表<<<应收应付/费用表>>>
|
|
|
|
|
|
//明细表表格相关
|
|
|
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,
|
|
|
name: 'FeeName',
|
|
|
valueField: 'Name',
|
|
|
displayField: 'CodeAndName'
|
|
|
});
|
|
|
|
|
|
this.storeCustomerNameRef = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'DsTruckMng.ux.CustomRefModel',
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
|
|
|
});
|
|
|
this.storeCustomerNameRef.load({ params: { condition: ""} });
|
|
|
|
|
|
this.comboxCustomerNameRef = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
store: this.storeCustomerNameRef,
|
|
|
name: 'CustomerName',
|
|
|
valueField: 'CustName',
|
|
|
displayField: 'CodeAndName'
|
|
|
});
|
|
|
|
|
|
|
|
|
//明细表-数据集
|
|
|
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: '增加明细',
|
|
|
iconCls: "btnadddetail",
|
|
|
handler: function (button, event) {
|
|
|
this.onAddDetailClick(button, event, '1');
|
|
|
},
|
|
|
scope: this
|
|
|
}, {
|
|
|
text: '删除明细',
|
|
|
tooltip: '删除明细',
|
|
|
iconCls: "btndeletedetail",
|
|
|
handler: function (button, event) {
|
|
|
this.onDelDetailClick(button, event, '1');
|
|
|
},
|
|
|
scope: this
|
|
|
}, '-', {
|
|
|
text: '提交审核',
|
|
|
tooltip: '提交审核',
|
|
|
iconCls: 'btnsubmitaudit',
|
|
|
handler: function (button, event) {
|
|
|
this.onSubmitAuditClick(button, event,"1");
|
|
|
},
|
|
|
scope: this
|
|
|
}],
|
|
|
columns: [{
|
|
|
sortable: true,
|
|
|
dataIndex: 'GId',
|
|
|
header: '惟一编号',
|
|
|
hidden: true,
|
|
|
width: 160
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'BsNo',
|
|
|
header: '业务编号',
|
|
|
hidden: true,
|
|
|
width: 200
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'FeeStatus',
|
|
|
header: '费用状态',
|
|
|
renderer: function (value, p, record) {
|
|
|
return record.data.FeeStatus_Ref;
|
|
|
},
|
|
|
width: 66
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'FeeName',
|
|
|
header: '费用名称',
|
|
|
//editor: this.comboxFeeNameRef,
|
|
|
width: 80
|
|
|
}, /*{
|
|
|
sortable: true,
|
|
|
dataIndex: 'FeeType',
|
|
|
header: '收付方式',
|
|
|
renderer: function (value, p, record) {
|
|
|
if (value == null || value == '')
|
|
|
return '';
|
|
|
else
|
|
|
return value + '-' + record.data.FeeType_Ref;
|
|
|
},
|
|
|
editor: this.comboxFeeTypeRef,
|
|
|
width: 66
|
|
|
}, */{
|
|
|
sortable: true,
|
|
|
dataIndex: 'FeeDescription',
|
|
|
header: '费用英文名称',
|
|
|
hidden: true,
|
|
|
width: 200
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'CustomerType',
|
|
|
header: '客户类别',
|
|
|
hidden: true,
|
|
|
width: 200
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'CustomerName',
|
|
|
header: '结算对象',
|
|
|
//editor: this.comboxCustomerNameRef,
|
|
|
width: 120
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'Unit',
|
|
|
header: '单位标准',
|
|
|
hidden: true,
|
|
|
width: 200
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'UnitPrice',
|
|
|
header: '单价',
|
|
|
/*editor: {
|
|
|
xtype: 'numberfield',
|
|
|
selectOnFocus: true
|
|
|
},*/
|
|
|
width: 120
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'Quantity',
|
|
|
header: '数量',
|
|
|
/*editor: {
|
|
|
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
|
|
|
}
|
|
|
]
|
|
|
});
|
|
|
|
|
|
|
|
|
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: '增加明细',
|
|
|
iconCls: "btnadddetail",
|
|
|
handler: function (button, event) {
|
|
|
this.onAddDetailClick(button, event, '2');
|
|
|
},
|
|
|
scope: this
|
|
|
}, '-', {
|
|
|
text: '删除明细',
|
|
|
tooltip: '删除明细',
|
|
|
iconCls: "btndeletedetail",
|
|
|
handler: function (button, event) {
|
|
|
this.onDelDetailClick(button, event, '2');
|
|
|
},
|
|
|
scope: this
|
|
|
}, '-', {
|
|
|
text: '提交审核',
|
|
|
tooltip: '提交审核',
|
|
|
iconCls: 'btnsubmitaudit',
|
|
|
handler: function (button, event) {
|
|
|
this.onSubmitAuditClick(button, event,"2");
|
|
|
},
|
|
|
scope: this
|
|
|
}],
|
|
|
columns: [{
|
|
|
sortable: true,
|
|
|
dataIndex: 'GId',
|
|
|
header: '惟一编号',
|
|
|
hidden: true,
|
|
|
width: 160
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'BsNo',
|
|
|
header: '业务编号',
|
|
|
hidden: true,
|
|
|
width: 200
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'FeeStatus',
|
|
|
header: '费用状态',
|
|
|
renderer: function (value, p, record) {
|
|
|
return record.data.FeeStatus_Ref;
|
|
|
},
|
|
|
width: 66
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'FeeName',
|
|
|
header: '费用名称',
|
|
|
editor: this.comboxFeeNameRef,
|
|
|
width: 80
|
|
|
}, /*{
|
|
|
sortable: true,
|
|
|
dataIndex: 'FeeType',
|
|
|
header: '收付方式',
|
|
|
renderer: function (value, p, record) {
|
|
|
if (value == null || value == '')
|
|
|
return '';
|
|
|
else
|
|
|
return value + '-' + record.data.FeeType_Ref;
|
|
|
},
|
|
|
editor: this.comboxFeeTypeRef,
|
|
|
width: 66
|
|
|
},*/ {
|
|
|
sortable: true,
|
|
|
dataIndex: 'FeeDescription',
|
|
|
header: '费用英文名称',
|
|
|
hidden: true,
|
|
|
width: 200
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'CustomerType',
|
|
|
header: '客户类别',
|
|
|
hidden: true,
|
|
|
width: 200
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'CustomerName',
|
|
|
header: '结算对象',
|
|
|
editor: this.comboxCustomerNameRef,
|
|
|
width: 120
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'Unit',
|
|
|
header: '单位标准',
|
|
|
hidden: true,
|
|
|
width: 200
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'UnitPrice',
|
|
|
header: '单价',
|
|
|
editor: {
|
|
|
xtype: 'numberfield',
|
|
|
selectOnFocus: true
|
|
|
},
|
|
|
width: 120
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'Quantity',
|
|
|
header: '数量',
|
|
|
editor: {
|
|
|
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
|
|
|
}
|
|
|
]
|
|
|
});
|
|
|
/////////---------------------明细表<<<应收应付/费用>>> over
|
|
|
|
|
|
////////--------显示毛利 begin
|
|
|
|
|
|
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,
|
|
|
disabled: true,
|
|
|
name: 'RMBYS'
|
|
|
},{
|
|
|
fieldLabel: '人民币应付',
|
|
|
// allowBlank: false,
|
|
|
disabled: true,
|
|
|
name: 'RMBYF'
|
|
|
},{
|
|
|
fieldLabel: '人民币毛利',
|
|
|
// allowBlank: false,
|
|
|
disabled: true,
|
|
|
name: 'RMBML'
|
|
|
}]//0
|
|
|
},
|
|
|
{
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [{
|
|
|
fieldLabel: '美元应收',
|
|
|
// allowBlank: false,
|
|
|
disabled: true,
|
|
|
name: 'USDYS'
|
|
|
},{
|
|
|
fieldLabel: '美元应付',
|
|
|
// allowBlank: false,
|
|
|
disabled: true,
|
|
|
name: 'USDYF'
|
|
|
},{
|
|
|
fieldLabel: '美元毛利',
|
|
|
// allowBlank: false,
|
|
|
disabled: true,
|
|
|
name: 'USDML'
|
|
|
}]
|
|
|
},
|
|
|
]//container_1 //1
|
|
|
}//fieldset 1
|
|
|
]
|
|
|
}); //end this.formEdit
|
|
|
////////--------显示毛利 end
|
|
|
|
|
|
|
|
|
|
|
|
//公共按钮Toolbar:panelBtn
|
|
|
this.panelBtn = new Ext.Panel({
|
|
|
region: "north",
|
|
|
tbar: [
|
|
|
{
|
|
|
// id: "saveandclose",
|
|
|
text: "保存",
|
|
|
handler: function (button, event) {
|
|
|
this.Save('0');
|
|
|
},
|
|
|
scope: this
|
|
|
}, {
|
|
|
// id: "saveandclose",
|
|
|
text: "保存并关闭",
|
|
|
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
|
|
|
}
|
|
|
]
|
|
|
}); //end 按钮Toolbar
|
|
|
|
|
|
//布局
|
|
|
/* 3 */
|
|
|
this.panelTop = new Ext.Panel({
|
|
|
layout: "border",
|
|
|
region: "north",
|
|
|
height: 32,
|
|
|
items: [this.panelBtn]//, this.formEdit]
|
|
|
});
|
|
|
|
|
|
this.panelBodyReceipt = new Ext.Panel({
|
|
|
title: '票据管理',
|
|
|
layout: "border",
|
|
|
region: 'center',
|
|
|
margin: '5 10',
|
|
|
items: [this.gridListReceipt]
|
|
|
});
|
|
|
|
|
|
this.panelCargoandApp = new Ext.Panel({
|
|
|
// title: '货物信息和许可证使用',
|
|
|
layout: "border",
|
|
|
region: 'center',
|
|
|
margin: '3 3',
|
|
|
height: 450,
|
|
|
items: [this.formCargo/*, this.formAppstate*/]
|
|
|
});
|
|
|
|
|
|
this.page_1 = new Ext.Panel({
|
|
|
id:"page_1",
|
|
|
title: "合同基础信息",
|
|
|
items: [this.formEdit, this.panelCargoandApp]
|
|
|
});
|
|
|
this.page_2 = new Ext.Panel({
|
|
|
id:"page_2",
|
|
|
title: "库存管理",
|
|
|
items: [this.formKC]
|
|
|
});
|
|
|
this.page_3 = new Ext.Panel({
|
|
|
id:"page_3",
|
|
|
title: "票据管理",
|
|
|
items: [this.gridListReceipt]
|
|
|
});
|
|
|
this.page_4 = new Ext.Panel({
|
|
|
id:"page_4",
|
|
|
title: "应收应付录入",
|
|
|
items: [this.gridListChFee,this.gridListChFee_YF,this.formML
|
|
|
]
|
|
|
});
|
|
|
|
|
|
this.panelReceipt = new Ext.Panel({
|
|
|
layout: "border",
|
|
|
region: "center",
|
|
|
items: [this.panelBodyReceipt]
|
|
|
});
|
|
|
|
|
|
this.MainTab = new Ext.tab.Panel({
|
|
|
layout: "border",
|
|
|
region: "center",
|
|
|
items: [this.page_1, this.page_2, this.page_3, this.page_4]
|
|
|
})
|
|
|
|
|
|
Ext.apply(this, {
|
|
|
items: [this.panelTop, this.MainTab]
|
|
|
});
|
|
|
|
|
|
parentWin = window.parent.opener;
|
|
|
this.InitData();
|
|
|
|
|
|
//集中绑定 事件
|
|
|
|
|
|
this.gridListReceipt.on('edit', function (editor, e, eOpts) {
|
|
|
this.ReceiptAfterEdit(editor, e, eOpts);
|
|
|
}, this);
|
|
|
|
|
|
this.formCargo.on('edit', function (editor, e, eOpts) {
|
|
|
this.CargoAfterEdit(editor, e, eOpts);
|
|
|
}, this);
|
|
|
|
|
|
|
|
|
this.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);
|
|
|
}, //end initUIComponents
|
|
|
|
|
|
|
|
|
////////<<<商品>>>明细表相关方法
|
|
|
onAddCargoClick: function (button, event) {
|
|
|
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',
|
|
|
'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 (rec.ContractNo != "" || rec.ContractNo != "*") //如果是新增但没有保存的数据,没有必要提交到后台
|
|
|
{
|
|
|
this.CargoDel.push(rec);
|
|
|
}
|
|
|
this.storeCargo.remove(selectedRecords[i]);
|
|
|
}
|
|
|
}
|
|
|
}, this);
|
|
|
},
|
|
|
onKCStartClick: function (button,event){//初始化库存,
|
|
|
Ext.MessageBox.confirm('提示', '这将会清空该货物的所有库存重新开始记录。确定初始化库存吗?', function (btn) {
|
|
|
if (btn == 'yes') {
|
|
|
var selectedRecords = this.formCargo.selModel.getSelection();
|
|
|
if (selectedRecords.length==0){
|
|
|
alert('请选择至少一条商品记录');
|
|
|
return;
|
|
|
}
|
|
|
var cargoidlist='';
|
|
|
for (var i = 0; i < selectedRecords.length; i++) {
|
|
|
var rec = selectedRecords[i];
|
|
|
if (i==0) {
|
|
|
cargoidlist=rec.get('id');
|
|
|
}
|
|
|
else {
|
|
|
cargoidlist=cargoidlist+','+rec.get('id');
|
|
|
}
|
|
|
}
|
|
|
Ext.Ajax.request({//
|
|
|
waitMsg: '正在初始化库存数据...',
|
|
|
url: '/Import/XXH/KCStart',
|
|
|
params: {
|
|
|
cargo_id: cargoidlist
|
|
|
},
|
|
|
callback: function (_count) {
|
|
|
//alert('初始化完成');
|
|
|
//重新load库存表的store
|
|
|
this.storeKC.load({ params: { condition: this.editRecord.get('ContractNo')} });
|
|
|
},
|
|
|
scope: this
|
|
|
});//request over
|
|
|
}
|
|
|
}, this);//确认窗口over
|
|
|
},
|
|
|
onbtnCWStartClick: function(button, event) { //初始化应收应付,
|
|
|
Ext.MessageBox.confirm('提示', '这将会在应收应付列表增加一些内容,如不保存就不会真正增加。确定吗?',
|
|
|
function(btn) {
|
|
|
if (btn == 'yes') {
|
|
|
// addChFee: function(FeeType,Currency,FeeName,price,Quantity)
|
|
|
|
|
|
/* var selectedRecords = this.formCargo.selModel.getSelection();
|
|
|
Ext.MessageBox.confirm('提示', '确定删除记录吗?',
|
|
|
function(btn) {
|
|
|
if (btn == 'yes') {
|
|
|
for (var i = 0; i < selectedRecords.length; i++) {
|
|
|
var rec = selectedRecords[i];
|
|
|
alert(rec.ContractNo);
|
|
|
if (rec.ContractNo != "" || rec.ContractNo != "*") //如果是新增但没有保存的数据,没有必要提交到后台
|
|
|
{
|
|
|
this.CargoDel.push(rec);
|
|
|
}
|
|
|
this.storeCargo.remove(selectedRecords[i]);
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
this);*/
|
|
|
var selectedRecords = this.formCargo.selModel.getSelection();
|
|
|
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;
|
|
|
|
|
|
function round2(number,fractionDigits){
|
|
|
with(Math){
|
|
|
return round(number*pow(10,fractionDigits))/pow(10,fractionDigits);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
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')
|
|
|
{
|
|
|
isChicken= true;
|
|
|
}
|
|
|
}//判断参与生成的货物中是否有鸡制品。如有则关税增值税用RMB表示,否则用美元表示。
|
|
|
|
|
|
|
|
|
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=prepayments_1+ parseFloat(rec.get('prepayments'));
|
|
|
prepayments_2=prepayments_2+ parseFloat(rec.get('prepayments'));
|
|
|
Exchangerate=parseFloat(rec.get('Exchangerate'));
|
|
|
Exchangerate_customs=parseFloat(rec.get('Exchangerate_Customs'));
|
|
|
balance_1=balance_1+ parseFloat(rec.get('balance'));
|
|
|
balance_2=balance_2+ parseFloat(rec.get('pay_Amount'))-parseFloat(rec.get('prepayments'));
|
|
|
if (parseFloat(rec.get('price_agid'))>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*/
|
|
|
var tax_weight=parseFloat(rec.get('weight'));
|
|
|
|
|
|
Paytax=Paytax+parseFloat(rec.get('tax_2'));
|
|
|
Paytax_zz=Paytax+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=usd_tax_1+ round2(taxAmount*tax,2);
|
|
|
usd_tax_zz_1=usd_tax_zz_1+ round2(taxAmount*(1+tax)*tax_zz,2);
|
|
|
}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=usd_tax_2+ round2(taxAmount*tax,2);
|
|
|
usd_tax_zz_2=usd_tax_zz_2+ round2(taxAmount*(1+tax)*tax_zz,2);
|
|
|
}
|
|
|
|
|
|
|
|
|
this.addChFee(1,'RMB',1,'预付款',round2(prepayments_1*Exchangerate,2),1,prepayments_1+rec.get('codename')+' 其中:'+preRemark);
|
|
|
this.addChFee(1,'RMB',1,'尾款',round2(balance_1*Exchangerate,2),1,balance_1+rec.get('codename'));
|
|
|
|
|
|
this.addChFee(2,rec.get('codename'),Exchangerate,'预付款',round2(prepayments_2,2),1,prepayments_2+rec.get('codename'));
|
|
|
this.addChFee(2,rec.get('codename'),Exchangerate,'尾款',round2(balance_2,2),1,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,'代理费',300,(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,'尾款手续费');
|
|
|
this.addChFee(1,'RMB',1,'电汇费',150,1,'预付款电汇费');
|
|
|
this.addChFee(1,'RMB',1,'手续费',round2((prepayments_1*Exchangerate)/1000,2),1,'预付款手续费');
|
|
|
|
|
|
/*
|
|
|
//alert(this.editRecord.get('ContractNo'))
|
|
|
Ext.Ajax.request({ //
|
|
|
waitMsg: '正在初始化应收应付...',
|
|
|
url: '/Import/XXH/CWStart',
|
|
|
params: {
|
|
|
ContractNo: this.editRecord.get('ContractNo')
|
|
|
},
|
|
|
callback: function(_count) {
|
|
|
//alert('初始化完成');
|
|
|
//重新load库存表的store
|
|
|
this.storeBodyChFee.load({
|
|
|
params: {
|
|
|
billno: this.editRecord.get('ContractNo')
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
scope: this
|
|
|
}); //request over
|
|
|
*/
|
|
|
}
|
|
|
},
|
|
|
this); //确认窗口over
|
|
|
},
|
|
|
onKCFeeClick: function(button, event) { //初始化应收应付,
|
|
|
Ext.MessageBox.confirm('提示', '这将会在应收应付列表增加一些内容,如不保存就不会真正增加。确定吗?',
|
|
|
function(btn) {
|
|
|
if (btn == 'yes') {
|
|
|
|
|
|
var selectedRecords = this.formKC.selModel.getSelection();
|
|
|
|
|
|
function round2(number,fractionDigits){
|
|
|
with(Math){
|
|
|
return round(number*pow(10,fractionDigits))/pow(10,fractionDigits);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
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 (FeeName=='出入库费'){
|
|
|
this.addChFee(1,'RMB',1,'出入库费',round2(Amount,2),1,'');
|
|
|
this.addChFee(2,'RMB',1,'出入库费',round2(Amount,2),1,'');
|
|
|
}else{
|
|
|
this.addChFee(1,'RMB',1,FeeName,parseFloat(UnitPrice)*parseFloat(Quantity),parseFloat(days),'');
|
|
|
this.addChFee(2,'RMB',1,FeeName,parseFloat(UnitPrice)*parseFloat(Quantity),parseFloat(days),'');
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
this); //确认窗口over
|
|
|
},
|
|
|
|
|
|
addChFee: function(FeeType,Currency,Exchangerate,FeeName,price,Quantity,Remark) {
|
|
|
var _CustomerName='';
|
|
|
if (FeeType==1)
|
|
|
{
|
|
|
var _FeeType=1;
|
|
|
var _FeeType_Ref='应收';
|
|
|
_CustomerName=this.getCustName();
|
|
|
}
|
|
|
else {
|
|
|
var _FeeType=2;
|
|
|
var _FeeType_Ref='应付';
|
|
|
_CustomerName=this.getSellerName();
|
|
|
if (FeeName=='关税'||FeeName=='增值税'){_CustomerName='报关行';}
|
|
|
if (FeeName=='冷藏费'||FeeName=='仓储费'||FeeName=='出入库费'||FeeName=='超期制冷费'){_CustomerName='';}
|
|
|
//CustomerName: this.formEdit.getForm().findField('seller');
|
|
|
};
|
|
|
|
|
|
|
|
|
//var _Amount=price*Quantity;
|
|
|
var _Amount=0;
|
|
|
|
|
|
record = Ext.create('MsChFee', {
|
|
|
GId: NewGuid(),
|
|
|
BsNo: '*',
|
|
|
FeeStatus: 1,
|
|
|
FeeStatus_Ref: '录入状态',
|
|
|
FeeType: _FeeType,
|
|
|
FeeType_Ref: _FeeType_Ref,
|
|
|
FeeName: FeeName,
|
|
|
FeeName_Ref: '',
|
|
|
FeeDescription: '',
|
|
|
CustomerType: '',
|
|
|
CustomerName: _CustomerName,
|
|
|
//this.formEdit.getForm().findField('buyer');
|
|
|
CustomerName_Ref: '',
|
|
|
Unit: '',
|
|
|
price: 0,
|
|
|
UnitPrice: price,
|
|
|
Quantity: Quantity,
|
|
|
Amount: _Amount,
|
|
|
Currency: Currency,
|
|
|
ExChangerate: Exchangerate,
|
|
|
Reason: '',
|
|
|
Remark: Remark,
|
|
|
Commissionrate: 0,
|
|
|
Settlement: 0,
|
|
|
Invoice: 0,
|
|
|
OrderAmount: 0,
|
|
|
OrderInvoice: 0,
|
|
|
SubmitDate: null,
|
|
|
Auditoperator: '',
|
|
|
AuditDate: null,
|
|
|
EnteroPerator: GetCookie_UserId(),
|
|
|
EnterDate: null,
|
|
|
DebitNo: '',
|
|
|
IsDebit: "0",
|
|
|
IsOpen: "0",
|
|
|
IsAdvancedpay: "0",
|
|
|
Sort: "0",
|
|
|
IsInvoice: "0",
|
|
|
FeeFrt: 'PP',
|
|
|
IsCrmOrderFee: "0",
|
|
|
AuditStatus: 0,
|
|
|
InvoiceNum: '',
|
|
|
ChequeNum: '',
|
|
|
WmsOutBsNo: ''
|
|
|
});
|
|
|
|
|
|
if (FeeType==1)
|
|
|
{
|
|
|
this.storeBodyChFee.add(record);}
|
|
|
else{
|
|
|
this.storeBodyChFee_YF.add(record);
|
|
|
}
|
|
|
},
|
|
|
|
|
|
CargoAfterEdit: function(editor, e, eOpts) {
|
|
|
|
|
|
function round2(number,fractionDigits){
|
|
|
with(Math){
|
|
|
return round(number*pow(10,fractionDigits))/pow(10,fractionDigits);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (e.field == 'cargoinfo_id') {
|
|
|
var Cargoinforecords = DsStoreQueryBy(this.storeCargoinfo, 'id', e.value);
|
|
|
if (Cargoinforecords.getCount() > 0) {
|
|
|
var Cargoinfodata = Cargoinforecords.getAt(0).data;
|
|
|
e.record.set('cicodeandname', Cargoinfodata.codeandname);
|
|
|
//20131017 以下改变前台显示的税率
|
|
|
e.record.set('tariff', Cargoinfodata.tariff);
|
|
|
e.record.set('tax', Cargoinfodata.tax);
|
|
|
e.record.set('tax_zz', Cargoinfodata.tax_zz);
|
|
|
} else {
|
|
|
e.record.set('cicodeandname', '');
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (e.field == 'cargociq_id') {
|
|
|
var Cargociqrecords = DsStoreQueryBy(this.storeCargociq, 'id', e.value);
|
|
|
if (Cargociqrecords.getCount() > 0) {
|
|
|
var Cargociqdata = Cargociqrecords.getAt(0).data;
|
|
|
e.record.set('ciqcodeandname', Cargociqdata.codeandname);
|
|
|
} else {
|
|
|
e.record.set('ciqcodeandname', '');
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (e.field == 'Exchangerate' && e.record.get('Exchangerate_Customs') == 0) {
|
|
|
e.record.set('Exchangerate_Customs', parseFloat(e.record.get('Exchangerate')))
|
|
|
}
|
|
|
|
|
|
if (e.field == 'Unit') {
|
|
|
function decimal(num, v) {
|
|
|
var vv = Math.pow(10, v);
|
|
|
return Math.round(num * vv) / vv;
|
|
|
}
|
|
|
var U_weight = parseFloat(e.record.get('U_weight'));
|
|
|
|
|
|
var Unitrecords = DsStoreQueryBy(this.storeUnit, 'EnumValueId', e.value);
|
|
|
if (Unitrecords.getCount() > 0) {
|
|
|
var Unitdata = Unitrecords.getAt(0).data;
|
|
|
e.record.set('UnitRef', Unitdata.EnumValueName);
|
|
|
if (Unitdata.EnumValueName == '磅') {
|
|
|
e.record.set('UnitRate', '0.4536');
|
|
|
var weight = decimal(U_weight * 0.4536, 2);
|
|
|
e.record.set('weight', weight);
|
|
|
}
|
|
|
if (Unitdata.EnumValueName == '吨') {
|
|
|
e.record.set('UnitRate', '1000');
|
|
|
var weight = decimal(U_weight * 1000, 2);
|
|
|
e.record.set('weight', weight);
|
|
|
}
|
|
|
if (Unitdata.EnumValueName == 'KG') {
|
|
|
e.record.set('UnitRate', '1');
|
|
|
var weight = decimal(U_weight, 2);
|
|
|
e.record.set('weight', weight);
|
|
|
}
|
|
|
|
|
|
var price = parseFloat(e.record.get('price'));
|
|
|
var price_agio = parseFloat(e.record.get('price_agio'));
|
|
|
var price_limit = parseFloat(e.record.get('price_limit'));
|
|
|
var baolv = parseFloat(e.record.get('baolv'));
|
|
|
var amount = decimal(weight * price, 2);
|
|
|
if (price_limit != 0 && price_limit > (price - price_agio)) {
|
|
|
var tax_amount = decimal(price_limit * weight * baolv, 2);
|
|
|
} else {
|
|
|
var tax_amount = decimal((price - price_agio) * weight * baolv, 2);
|
|
|
}
|
|
|
var pay_amount = decimal((price - price_agio) * weight, 2);
|
|
|
|
|
|
e.record.set('Amount', amount);
|
|
|
e.record.set('tax_Amount', tax_amount);
|
|
|
e.record.set('pay_Amount', pay_amount);
|
|
|
} else {
|
|
|
e.record.set('UnitRef', '');
|
|
|
e.record.set('UnitRate', '1');
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (e.field == 'U_weight') {
|
|
|
function decimal(num, v) {
|
|
|
var vv = Math.pow(10, v);
|
|
|
return Math.round(num * vv) / vv;
|
|
|
}
|
|
|
var U_weight = parseFloat(e.record.get('U_weight'));
|
|
|
var UnitRate = parseFloat(e.record.get('UnitRate'));
|
|
|
|
|
|
var weight = decimal(U_weight * UnitRate, 2);
|
|
|
e.record.set('weight', weight);
|
|
|
|
|
|
var price = parseFloat(e.record.get('price'));
|
|
|
var price_agio = parseFloat(e.record.get('price_agio'));
|
|
|
var price_limit = parseFloat(e.record.get('price_limit'));
|
|
|
var baolv = parseFloat(e.record.get('baolv'));
|
|
|
var amount = decimal(weight * price, 2);
|
|
|
if (price_limit != 0 && price_limit > (price - price_agio)) {
|
|
|
var tax_amount = decimal(price_limit * weight * baolv, 2);
|
|
|
} else {
|
|
|
var tax_amount = decimal((price - price_agio) * weight * baolv, 2);
|
|
|
}
|
|
|
var pay_amount = decimal((price - price_agio) * weight, 2);
|
|
|
|
|
|
e.record.set('Amount', amount);
|
|
|
e.record.set('tax_Amount', tax_amount);
|
|
|
e.record.set('pay_Amount', pay_amount);
|
|
|
}
|
|
|
|
|
|
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);
|
|
|
} else {
|
|
|
e.record.set('codename', '');
|
|
|
}
|
|
|
}
|
|
|
//price price_agio price_limit weight baolv
|
|
|
//单价 差价 估价 净重 保率
|
|
|
//amount tax_amount pax_amount
|
|
|
//合同金额 完税价格 购货价
|
|
|
if (e.field == 'price' || e.field == 'price_agio' || e.field == 'price_limit' || e.field == 'baolv'
|
|
|
|| e.field == 'weight'||e.field == 'Exchangerate'||e.field == 'Exchangerate_Customs') {
|
|
|
function decimal(num, v) {
|
|
|
var vv = Math.pow(10, v);
|
|
|
return Math.round(num * vv) / vv;
|
|
|
}
|
|
|
|
|
|
var price = parseFloat(e.record.get('price'));
|
|
|
var price_agio = parseFloat(e.record.get('price_agio'));
|
|
|
var price_limit = parseFloat(e.record.get('price_limit'));
|
|
|
var baolv = parseFloat(e.record.get('baolv'));
|
|
|
var weight = parseFloat(e.record.get('weight'));
|
|
|
|
|
|
if (price_agio==0){
|
|
|
var amount = decimal(weight * price, 2);}
|
|
|
else{amount = decimal(weight * price_agio, 2);}
|
|
|
|
|
|
if (price_limit != 0 && price_limit > price) {
|
|
|
var tax_amount = decimal(price_limit * weight * baolv, 2);
|
|
|
} else {
|
|
|
var tax_amount = decimal((price) * weight * baolv, 2);
|
|
|
}
|
|
|
var pay_amount = decimal(price * weight, 2);//贸易商价格x重量x单价
|
|
|
|
|
|
e.record.set('Amount', amount);
|
|
|
e.record.set('tax_Amount', tax_amount);
|
|
|
e.record.set('pay_Amount', pay_amount);
|
|
|
|
|
|
//if (amount>tax_amount){tax_amount=amount;}//确保tax_amount为给客户显示并使用的完税价格
|
|
|
var tax = e.record.get('tax')
|
|
|
var tax_zz = e.record.get('tax_zz')
|
|
|
var Exchangerate_Customs = e.record.get('Exchangerate_Customs')
|
|
|
|
|
|
var HS = e.record.get('cicode');
|
|
|
var isChicken = false;
|
|
|
var ChickenTax = parseFloat('0.0');
|
|
|
if (HS == '0207142100' || HS == '0207142200' || HS == '0207142900') {
|
|
|
isChicken = true;
|
|
|
if (HS == '0207142100') {
|
|
|
ChickenTax = parseFloat('0.8');
|
|
|
} else if (HS == '0207142200') {
|
|
|
ChickenTax = parseFloat('1.0');
|
|
|
} else if (HS == '0207142900') {
|
|
|
ChickenTax = parseFloat('1.3');
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (isChicken) {
|
|
|
|
|
|
var priceandtax = parseFloat(decimal(tax_amount * Exchangerate_Customs,2) + decimal(weight * ChickenTax,2));
|
|
|
|
|
|
var tax_1 = round2(weight * ChickenTax,2);
|
|
|
var tax_zz_1 = round2(priceandtax * parseFloat(tax_zz),2);
|
|
|
var tax_2 = tax_1;
|
|
|
var tax_zz_2 = tax_zz_1;
|
|
|
|
|
|
} else {
|
|
|
var priceandtax = tax_amount * (1.0 + tax);
|
|
|
|
|
|
//应付的
|
|
|
var tax_2 = round2(tax_amount * tax * Exchangerate_Customs,2); //关税
|
|
|
var tax_zz_2 = round2(tax_amount * (1.0 + tax) * tax_zz * Exchangerate_Customs,2); //增值税
|
|
|
|
|
|
//向客户收取的
|
|
|
if (tax_amount > amount) {
|
|
|
var tax_1 = round2(tax_amount * tax * Exchangerate_Customs,2); //关税
|
|
|
var tax_zz_1 = round2(tax_amount * (1.0 + tax) * tax_zz * Exchangerate_Customs,2); //增值税
|
|
|
} else {
|
|
|
var tax_1 = round2(amount * tax * Exchangerate_Customs,2); //关税
|
|
|
var tax_zz_1 = round2(amount * (1.0 + tax) * tax_zz * Exchangerate_Customs,2); //增值税
|
|
|
}
|
|
|
}
|
|
|
|
|
|
e.record.set('tax_1', tax_1);
|
|
|
e.record.set('tax_zz_1', tax_zz_1);
|
|
|
e.record.set('tax_2', tax_2);
|
|
|
e.record.set('tax_zz_2', tax_zz_2);
|
|
|
|
|
|
var prepayments = e.record.get('prepayments');
|
|
|
var balance = amount - prepayments;
|
|
|
e.record.set('balance', balance);
|
|
|
|
|
|
}
|
|
|
|
|
|
if (e.field == 'prepayments') {
|
|
|
//alert(e.field);
|
|
|
var prepayments = e.record.get('prepayments');
|
|
|
var Amount = e.record.get('Amount');
|
|
|
var balance = Amount - prepayments;
|
|
|
e.record.set('balance', balance);
|
|
|
}
|
|
|
/*
|
|
|
if (e.field == 'balance') {
|
|
|
//alert(e.field);
|
|
|
var balance = e.record.get('balance');
|
|
|
var Amount = e.record.get('Amount');
|
|
|
var prepayments = Amount - balance;
|
|
|
e.record.set('prepayments', prepayments);
|
|
|
}*/
|
|
|
},
|
|
|
/////////////明细表<<<商品>>>的相关方法
|
|
|
|
|
|
////////<<<许可证使用>>>明细表相关方法
|
|
|
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.id);
|
|
|
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 record = Ext.create('KCmb', {
|
|
|
'id': '',
|
|
|
'ContractNo': '',
|
|
|
'cargo_id': '',
|
|
|
'name': '',
|
|
|
'czstate': ' ',
|
|
|
'innum': '0',
|
|
|
'outnum': '0',
|
|
|
'kfstate': ' ',
|
|
|
'czdate': ' ',
|
|
|
'text': ' ',
|
|
|
'czref': ' ',
|
|
|
'kfref': ' '
|
|
|
});
|
|
|
this.storeKC.add(record);
|
|
|
|
|
|
var n = this.storeKC.getCount();
|
|
|
this.cellEditingKC.startEditByPosition({ row: n - 1, column: 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);
|
|
|
} else {
|
|
|
e.record.set('czref', '');
|
|
|
}
|
|
|
}
|
|
|
if (e.field == 'kfstate') {
|
|
|
var kfstaterecords = DsStoreQueryBy(this.storekfstate, 'EnumValueId', e.value);
|
|
|
if (kfstaterecords.getCount() > 0) {
|
|
|
var kfstatedata = kfstaterecords.getAt(0).data;
|
|
|
e.record.set('kfref', kfstatedata.EnumValueName);
|
|
|
} else {
|
|
|
e.record.set('kfref', '');
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (e.field == 'cargo_id') {
|
|
|
var cargo = DsStoreQueryBy(this.storeCargo, 'id', e.value);
|
|
|
if (cargo.getCount() > 0) {
|
|
|
var cargodata = cargo.getAt(0).data;
|
|
|
e.record.set('cargo_id',cargodata.id);
|
|
|
e.record.set('cargoname', cargodata.name);
|
|
|
//alert(e.record.get('cargo_id'));
|
|
|
} else {
|
|
|
//alert(cargodata.name);
|
|
|
e.record.set('cargoname', ' ');
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (e.field == 'czstate' || e.field == 'czdate') {
|
|
|
if (!e.record.get('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 },
|
|
|
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 end = new Date(_e);
|
|
|
var start = new Date(_s);
|
|
|
if ( LastCZState =="1" ){
|
|
|
var elapsed = Math.round((end.getTime() - start.getTime()) / (86400000)) + 1; // 计算间隔日数
|
|
|
}else
|
|
|
var elapsed = Math.round((end.getTime() - start.getTime()) / (86400000)) ; // 计算间隔日数
|
|
|
|
|
|
//alert(elapsed);
|
|
|
e.record.set('days',elapsed);
|
|
|
|
|
|
} 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'));
|
|
|
e.record.set('Amount', days*UnitPrice*Quantity);
|
|
|
}
|
|
|
},
|
|
|
///-------------明细表<<<库存记录>>>的相关方法 over
|
|
|
|
|
|
//单据表 明细表相关方法
|
|
|
onAddReceiptClick: function (button, event) {
|
|
|
this.addDetail();
|
|
|
}, //end onAddDetailClick
|
|
|
|
|
|
onDelReceiptClick: function (button, event) {
|
|
|
this.deleteDetail();
|
|
|
}, //onDelDetailClick
|
|
|
ReceiptAfterEdit: function (editor, e, eOpts) {
|
|
|
//需要自己实现里面的事件
|
|
|
if (e.field == 'Receiptid') {
|
|
|
var Receiptrecords = DsStoreQueryBy(this.storeReceiptid, 'EnumValueId', e.value);
|
|
|
if (Receiptrecords.getCount() > 0) {
|
|
|
var Receiptdata = Receiptrecords.getAt(0).data;
|
|
|
e.record.set('ReceiptName', Receiptdata.EnumValueName);
|
|
|
} else {
|
|
|
e.record.set('ReceiptName', '');
|
|
|
}
|
|
|
}
|
|
|
if (e.field == 'state') {
|
|
|
var staterecords = DsStoreQueryBy(this.storeReceiptstate, 'EnumValueId', e.value);
|
|
|
if (staterecords.getCount() > 0) {
|
|
|
var statedata = staterecords.getAt(0).data;
|
|
|
e.record.set('statename', statedata.EnumValueName);
|
|
|
} else {
|
|
|
e.record.set('statename', '');
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
addDetail: function () {
|
|
|
|
|
|
// var newSerialno = DsGetNewSerialNo(this.storeBodyList, this.serialNo);
|
|
|
// this.serialNo = newSerialno;
|
|
|
var record = Ext.create('Receiptmb', {
|
|
|
'id': '',
|
|
|
'ContractNo': '',
|
|
|
'Receiptid': '0',
|
|
|
'ReceiptName': '',
|
|
|
'ReceiptNo': '',
|
|
|
'state': '0',
|
|
|
'Send_date': '',
|
|
|
'receive_date': '',
|
|
|
'repeat_date': '',
|
|
|
'trancer': '',
|
|
|
'trancNo': ''
|
|
|
});
|
|
|
|
|
|
this.storeReceipt.add(record);
|
|
|
|
|
|
var n = this.storeReceipt.getCount();
|
|
|
this.cellEditingReceipt.startEditByPosition({ row: n - 1, column: 2 });
|
|
|
},
|
|
|
|
|
|
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 != 8 && chfeefeeStatus != 9 && chfeefeeStatus != 10;
|
|
|
//alert(chfeefeeStatus);
|
|
|
/*
|
|
|
if (canedit) {
|
|
|
var feeStatus = this.getFeeStatus();
|
|
|
var billStatus = this.getBillStatus();
|
|
|
canedit = feeStatus == '0' && billStatus == '0';
|
|
|
}*/
|
|
|
|
|
|
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;
|
|
|
|
|
|
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: GetCookie_UserId(),
|
|
|
EnterDate: null,
|
|
|
DebitNo: '',
|
|
|
IsDebit: "0",
|
|
|
IsOpen: "0",
|
|
|
IsAdvancedpay: "0",
|
|
|
Sort: "0",
|
|
|
IsInvoice: "0",
|
|
|
FeeFrt: 'pp',
|
|
|
IsCrmOrderFee: "0",
|
|
|
AuditStatus: 0,
|
|
|
InvoiceNum: '',
|
|
|
ChequeNum: '',
|
|
|
WmsOutBsNo: ''
|
|
|
});
|
|
|
|
|
|
store.add(record);
|
|
|
|
|
|
var editColumnIndex = 0;
|
|
|
var cellediting = null;
|
|
|
if (type == 1) {
|
|
|
cellediting = this.cellEditingChFee;
|
|
|
editColumnIndex = 2;
|
|
|
} else if (type == 2) {
|
|
|
cellediting = this.cellEditingChFee_YF;
|
|
|
editColumnIndex = 4;
|
|
|
}
|
|
|
var n = store.getCount();
|
|
|
cellediting.startEditByPosition({ row: n - 1, column: editColumnIndex });
|
|
|
},
|
|
|
|
|
|
GetHandleSerialNo: function (store, type) {
|
|
|
var result = 0;
|
|
|
if (type == 1) {
|
|
|
result = this.fixSerialNo;
|
|
|
} else if (type == 2) {
|
|
|
result = this.feeSerialNo;
|
|
|
}
|
|
|
|
|
|
if (result == 0) {
|
|
|
for (var i = 0; i < store.getCount(); i += 1) {
|
|
|
var member = store.getAt(i);
|
|
|
if (member.data.SerialNo > result) {
|
|
|
result = member.data.SerialNo;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
result = result + 1;
|
|
|
if (type == 1) {
|
|
|
this.fixSerialNo = result;
|
|
|
} else if (type == 2) {
|
|
|
this.feeSerialNo = result;
|
|
|
}
|
|
|
return result;
|
|
|
},
|
|
|
|
|
|
onDelDetailClick: function (button, event, type) {
|
|
|
var allow = this.getAllowOperationDetail();
|
|
|
if (allow == false) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
var store = null;
|
|
|
if (type == 1) {
|
|
|
store = this.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);
|
|
|
if (candelete == false)
|
|
|
return;
|
|
|
} else if (type == '2') {
|
|
|
selectedRecords = this.gridListChFee_YF.selModel.getSelection();
|
|
|
var candelete = DsTruck.CheckChFeeDelete(selectedRecords);
|
|
|
if (candelete == false)
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if (selectedRecords.length > 0) {
|
|
|
for (var i = 0; i < selectedRecords.length; i++) {
|
|
|
var rec = selectedRecords[i];
|
|
|
if (rec.BillNo != "" || rec.BillNo != "*") //如果是新增但没有保存的数据,没有必要提交到后台
|
|
|
{
|
|
|
if (type == '1') {
|
|
|
this.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) {
|
|
|
if (type == '1') {
|
|
|
var records = this.feeGridCheckBoxModel.selected.items;
|
|
|
} else if (type == '2') {
|
|
|
var records = this.feeGridCheckBoxModel_YF.selected.items;
|
|
|
}
|
|
|
DsTruck.MsChFeeAudit(records, 2, '正在提交审核数据, 请稍侯..');
|
|
|
},
|
|
|
getCustName: function() {
|
|
|
var custName = this.formEdit.getForm().findField('buyer');
|
|
|
return custName.getValue();
|
|
|
},
|
|
|
getSellerName: function() {
|
|
|
var custName = this.formEdit.getForm().findField('seller');
|
|
|
return custName.getValue();
|
|
|
},
|
|
|
|
|
|
//获取GID
|
|
|
/*
|
|
|
GetHandleSerialNo: function (store, type) {
|
|
|
var result = 0;
|
|
|
if (type == 0) {
|
|
|
result = this.ctnSerialNo;
|
|
|
} else 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 == 0) {
|
|
|
this.ctnSerialNo = result;
|
|
|
} else if (type == 1) {
|
|
|
this.fixSerialNo = result;
|
|
|
} else if (type == 2) {
|
|
|
this.feeSerialNo = result;
|
|
|
}
|
|
|
return result;
|
|
|
},*/
|
|
|
|
|
|
getAllowOperationDetail: function () {
|
|
|
/* var feeStatus = this.getFeeStatus();
|
|
|
if (feeStatus == '0')
|
|
|
return true;
|
|
|
else {
|
|
|
Ext.Msg.show({ title: '错误', msg: "费用已锁定,不允许操作费用!", icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
|
|
|
return false;
|
|
|
}*/
|
|
|
return true;
|
|
|
},
|
|
|
/* getFeeStatus: function () {
|
|
|
//var basicForm = this.formEdit.getForm();
|
|
|
//var feeStatus = basicForm.findField('FeeStatus').value;
|
|
|
//return feeStatus;
|
|
|
return 0;
|
|
|
},
|
|
|
cellEditingChFeeBeforeEdit: function (editor, e) {
|
|
|
/*var chfeefeeStatus = e.record.get('FeeStatus');
|
|
|
var canedit = chfeefeeStatus == 1 || chfeefeeStatus == 6;
|
|
|
|
|
|
if (canedit) {
|
|
|
var feeStatus = this.getFeeStatus();
|
|
|
var billStatus = this.getBillStatus();
|
|
|
canedit = feeStatus == '0' && billStatus == '0';
|
|
|
}
|
|
|
|
|
|
return canedit;*/
|
|
|
// return true;
|
|
|
//},*/
|
|
|
gridListChFeeAfterEdit: function (editor, e, eOpts) {
|
|
|
|
|
|
if (e.field == 'FeeType') {
|
|
|
var records = DsStoreQueryBy(this.storeFeeTypeRef, 'EnumValueId', e.value);
|
|
|
|
|
|
if (records.getCount() > 0) {
|
|
|
var data = records.getAt(0).data;
|
|
|
e.record.set('FeeType_Ref', data.EnumValueName);
|
|
|
} else {
|
|
|
e.record.set('FeeType_Ref', '');
|
|
|
}
|
|
|
} else if (e.field = 'UnitPrice' || e.field == 'Quantity' || e.field == 'ExChangerate') {
|
|
|
var unitPrice = e.record.data['UnitPrice'];
|
|
|
var quantity = e.record.data['Quantity'];
|
|
|
var ExChangerate= e.record.data['ExChangerate'];
|
|
|
e.record.set('Amount', (unitPrice * quantity ).toFixed(2));
|
|
|
}
|
|
|
},
|
|
|
// 明细表 费用表相关方法 end
|
|
|
|
|
|
parentfunction: function (button, event) {
|
|
|
var ret1 = window.parent.opener.OprationSwap();
|
|
|
// alert(this.First);
|
|
|
ret1[3]();
|
|
|
},
|
|
|
setBaolv: function(field, newValue, oldValue){
|
|
|
if (newValue==0) {
|
|
|
this.storeCargo.each(function(record) {
|
|
|
//alert(record.get('baolv'));
|
|
|
record.set('baolv',1.003);
|
|
|
});
|
|
|
}else{
|
|
|
this.storeCargo.each(function(record) {
|
|
|
//alert(record.get('baolv'));
|
|
|
record.set('baolv',1.000);
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
|
|
|
InitData: function () {
|
|
|
|
|
|
this.opStatus = 'add';
|
|
|
var condition = '';
|
|
|
|
|
|
|
|
|
if (parentWin) {
|
|
|
var ret = parentWin.OprationSwap();
|
|
|
this.opStatus = ret[0];
|
|
|
this.StoreList = ret[1];
|
|
|
this.editRecord = ret[2];
|
|
|
// this.parentfunction = ret[3];
|
|
|
}
|
|
|
|
|
|
if (this.opStatus == 'edit')
|
|
|
condition = " m.id='" + this.editRecord.get('id') + "'";
|
|
|
|
|
|
this.LoadData(this.opStatus, condition);
|
|
|
|
|
|
}, //end InitData
|
|
|
|
|
|
|
|
|
//载入数据
|
|
|
LoadData: function (opstatus, condition) {
|
|
|
this.opStatus = opstatus;
|
|
|
var data= '';
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在查询主表数据...',
|
|
|
url: '/Import/XXH/GetData',
|
|
|
params: {
|
|
|
handle: opstatus,
|
|
|
condition: condition
|
|
|
},
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
var result = Ext.JSON.decode(response.responseText);
|
|
|
if (!result.Success) {
|
|
|
Ext.Msg.show({
|
|
|
title: '提示',
|
|
|
msg: result.Message,
|
|
|
icon: Ext.MessageBox.ERROR,
|
|
|
buttons: Ext.Msg.OK
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
data = result.data;
|
|
|
|
|
|
if (data.ContractStatus=='True'){
|
|
|
data.ContractStatus='1';
|
|
|
}else{data.ContractStatus='0'};
|
|
|
|
|
|
this.formEdit.getForm().setValues(data);
|
|
|
|
|
|
} else {
|
|
|
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
});//request over
|
|
|
|
|
|
if (this.opStatus == 'edit') {
|
|
|
|
|
|
this.formEdit.getForm().findField('ContractNo').setDisabled(false);
|
|
|
var ContractNo=this.editRecord.get('ContractNo');
|
|
|
//alert(this.editRecord.get('ContractNo'));
|
|
|
this.storeReceipt.load({ params: { condition: 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.storeBodyChFee.load({ params: { billno: ContractNo,Feetype:'1'} });
|
|
|
this.storeBodyChFee_YF.load({ params: { billno: ContractNo,Feetype:'2'} });
|
|
|
|
|
|
var s=" countryid='"+this.editRecord.get('countryid')+"'";
|
|
|
//alert(s);
|
|
|
this.storeCargoinfo.load({ params: { condition: s} });
|
|
|
//this.storeCargoinfo.load({ params: { condition: ""} });
|
|
|
this.formEdit.getForm().findField('ContractNo').setDisabled(true);
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
}, // end LoadDate
|
|
|
checkedit: function (){
|
|
|
if (this.storeBodyChFee.getCount()==0){return true;}
|
|
|
else{
|
|
|
for (var i = 0; i < this.storeBodyChFee.getCount(); i += 1) {
|
|
|
var member = this.storeBodyChFee.getAt(i).data;
|
|
|
if (member.FeeName=="") {
|
|
|
alert("请填写费用名称");
|
|
|
return false;
|
|
|
}else{return true;}
|
|
|
}}
|
|
|
|
|
|
},
|
|
|
|
|
|
Save: function (type) {
|
|
|
//alert(this.opStatus);
|
|
|
if (!this.checkedit()) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
var basicForm = this.formEdit.getForm();
|
|
|
if (!basicForm.isValid()) {
|
|
|
return;
|
|
|
}
|
|
|
if (!validateEditorGridPanel(this.gridListReceipt)) {
|
|
|
return;
|
|
|
}
|
|
|
// alert('save');
|
|
|
basicForm.findField('ContractNo').setDisabled(false);
|
|
|
var data = this.formEdit.getForm().getValues();
|
|
|
basicForm.findField('ContractNo').setDisabled(true);
|
|
|
|
|
|
var bodydatas = [];
|
|
|
for (var i = 0; i < this.storeReceipt.getCount(); i += 1) {
|
|
|
var member = this.storeReceipt.getAt(i);
|
|
|
bodydatas.push(member);
|
|
|
}
|
|
|
var Cargodatas = [];
|
|
|
for (var i = 0; i < this.storeCargo.getCount(); i += 1) {
|
|
|
var member = this.storeCargo.getAt(i);
|
|
|
Cargodatas.push(member);
|
|
|
}
|
|
|
/*
|
|
|
var 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;
|
|
|
if (amount == 0) {
|
|
|
Ext.Msg.show({ title: '警告',
|
|
|
msg: '费用的金额不允许为0,请修改后再保存',
|
|
|
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;
|
|
|
if (amount == 0) {
|
|
|
Ext.Msg.show({ title: '警告',
|
|
|
msg: '费用的金额不允许为0,请修改后再保存',
|
|
|
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
};
|
|
|
var jsonChFeeBody = ConvertRecordsToJson(bodyChFeeDatas);
|
|
|
var jsonChFeeDelBody = ConvertRecordsToJsonAll(this.feeBodyDel);
|
|
|
|
|
|
data.ContractStatus=this.formEdit.getForm().findField('ContractStatus').getValue()?1:0;
|
|
|
|
|
|
Ext.Msg.wait('正在保存数据, 请稍侯..');
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在保存数据...',
|
|
|
url: '/Import/XXH/Save_Lock',
|
|
|
scope: this,
|
|
|
params: {
|
|
|
opstatus: this.opStatus,
|
|
|
data: Ext.JSON.encode(data),
|
|
|
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.storeBodyChFee.commitChanges();
|
|
|
this.storeBodyChFee_YF.commitChanges();
|
|
|
|
|
|
var returnData = jsonresult.Data;
|
|
|
|
|
|
if (returnData.ContractStatus=='True'){
|
|
|
returnData.ContractStatus='1';
|
|
|
}else{returnData.ContractStatus='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 == 'ContractStatus')
|
|
|
{
|
|
|
if (editp.get(name)=='True')
|
|
|
{this.editRecord.set(name,'True');}
|
|
|
else{this.editRecord.set(name,'0');}
|
|
|
} */
|
|
|
}
|
|
|
}, this);
|
|
|
|
|
|
this.editRecord.commit();
|
|
|
}
|
|
|
if (type == '0') {
|
|
|
this.opStatus = 'edit';
|
|
|
basicForm.findField('ContractNo').setDisabled(false);
|
|
|
this.storeApp.load({ params: { condition: this.editRecord.get('ContractNo')} });
|
|
|
this.storeCargo.load({ params: { condition: this.editRecord.get('ContractNo')} });
|
|
|
basicForm.findField('ContractNo').setDisabled(true);
|
|
|
|
|
|
} else if (type == '1') {//保存并关闭
|
|
|
|
|
|
window.close();
|
|
|
}
|
|
|
} else {
|
|
|
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
|
|
|
}
|
|
|
} else {
|
|
|
Ext.Msg.show({ title: '请重试',
|
|
|
msg: '服务器响应出错',
|
|
|
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
|
|
|
});
|
|
|
}
|
|
|
//alert('03');
|
|
|
|
|
|
}
|
|
|
});
|
|
|
}, //end save
|
|
|
|
|
|
Print: function () {
|
|
|
var 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+" dbo.f_str(m.contractno) cargoname,dbo.F_factoryno(M.contractno) 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+" )";
|
|
|
|
|
|
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 = "";
|
|
|
|
|
|
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 * from Import_KC where id in( ";
|
|
|
var sql2 = sql2+KCList+" )";
|
|
|
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 = "";
|
|
|
|
|
|
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();
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|