Ext . namespace ( 'Shipping' ) ;
Shipping . MsOpAireBillEdit = function ( config ) {
Ext . applyIf ( this , config ) ;
this . initUIComponents ( ) ;
window . Shipping . MsOpAireBillEdit . superclass . constructor . call ( this ) ;
} ;
Ext . extend ( Shipping . MsOpAireBillEdit , Ext . Panel , {
ParentWin : null ,
MParentWin : null ,
OpStatus : 'add' ,
StoreList : null ,
EditRecord : null ,
Editdata : null ,
MainEditRecord : null ,
BsNo : '' ,
initUIComponents : function ( ) {
this . serialNo = 0 ;
//this.bodyDel = [];
this . itemindex = 1 ;
this . isload = false ;
var mainform = window . parent . panelEdit ;
if ( mainform ) {
this . MainEditRecord = mainform . editRecord ;
this . BsNo = this . MainEditRecord . get ( 'BSNO' ) ;
}
_this = this ;
//#region 信息加载
//权限范围
this . StoreOpRange = Ext . create ( 'DsExt.ux.RefTableStore' , {
model : 'MsOP' ,
proxy : { url : '/MvcShipping/MsBaseInfo/GetOpRang' }
} ) ;
this . StoreOpRange . load ( { params : { optype : "modOpAireList" } } ) ;
//品名
this . storeCodeGoodsList = Ext . create ( 'DsExt.ux.RefTableStore' , {
model : 'DsShipping.ux.CodeGoodsModel' ,
proxy : { url : '/CommMng/BasicDataRef/GetCodeGoodsList' }
} ) ;
this . storeCodeGoodsList . load ( ) ;
this . comboxGOODSNAME = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : 'Description of Goods' ,
store : this . storeCodeGoodsList ,
flex : 1.5 ,
labelWidth : 120 ,
forceSelection : true ,
name : 'GOODSNAME' ,
valueField : 'GOODNAME' ,
displayField : 'CodeAndName'
} ) ;
//客户加载_发货人
this . storeShipper = Ext . create ( 'DsExt.ux.RefTableStore' , {
model : 'OpSeaeShipper' ,
proxy : { url : '/MvcShipping/MsOpSeae/GetShipperListRm' }
} ) ;
// this.storeShipper.load({ params: { condition: "ISCONTROLLER='1'"} });
//发货人
this . comboxShipper = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : 'Shipper (发货人)' ,
store : this . storeShipper ,
forceSelection : true ,
labelWidth : 150 ,
labelAlign : 'left' ,
queryMode : 'remote' ,
minChars : 0 ,
queryParam : 'CODENAME' ,
name : 'SHIPPERID' ,
valueField : 'SHORTNAME' ,
displayField : 'CodeAndName' ,
listeners : {
scope : this ,
'select' : function ( combo , records , eOpts ) {
if ( records . length > 0 ) {
var selectrecords = DsStoreQueryBy ( this . storeShipper , 'SHORTNAME' , combo . value ) ;
if ( selectrecords . getCount ( ) > 0 ) {
var selectdata = selectrecords . getAt ( 0 ) . data ;
this . formEdit . getForm ( ) . findField ( 'SHIPPER' ) . setValue ( selectdata . SHIPPERDETAIL ) ;
} else {
this . formEdit . getForm ( ) . findField ( 'SHIPPER' ) . setValue ( '' ) ;
}
}
}
}
} ) ;
//客户加载_收货人
this . storeConsignee = Ext . create ( 'DsExt.ux.RefTableStore' , {
model : 'OpSeaeShipper' ,
proxy : { url : '/MvcShipping/MsOpSeae/GetShipperListRm' }
} ) ;
// this.storeShipper.load({ params: { condition: "ISCONTROLLER='1'"} });
//收货人
this . comboxConsignee = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : 'Consignee (收货人)' ,
labelWidth : 150 ,
labelAlign : 'left' ,
store : this . storeConsignee ,
forceSelection : true ,
name : 'CONSIGNEEID' ,
queryMode : 'remote' ,
minChars : 0 ,
queryParam : 'CODENAME' ,
valueField : 'SHORTNAME' ,
displayField : 'CodeAndName' ,
listeners : {
scope : this ,
'select' : function ( combo , records , eOpts ) {
if ( records . length > 0 ) {
var selectrecords = DsStoreQueryBy ( this . storeConsignee , 'SHORTNAME' , combo . value ) ;
if ( selectrecords . getCount ( ) > 0 ) {
var selectdata = selectrecords . getAt ( 0 ) . data ;
this . formEdit . getForm ( ) . findField ( 'CONSIGNEE' ) . setValue ( selectdata . SHIPPERDETAIL ) ;
} else {
this . formEdit . getForm ( ) . findField ( 'CONSIGNEE' ) . setValue ( '' ) ;
}
}
}
}
} ) ;
//客户加载_通知人
this . storenotifyparty = Ext . create ( 'DsExt.ux.RefTableStore' , {
model : 'OpSeaeShipper' ,
proxy : { url : '/MvcShipping/MsOpSeae/GetShipperListRm' }
} ) ;
// this.storeShipper.load({ params: { condition: "ISCONTROLLER='1'"} });
//通知人
this . comboxNotifyParty = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : 'Notify Party (通知人)' ,
store : this . storenotifyparty ,
labelWidth : 150 ,
labelAlign : 'left' ,
forceSelection : true ,
name : 'NOTIFYPARTYID' ,
queryMode : 'remote' ,
minChars : 0 ,
queryParam : 'CODENAME' ,
valueField : 'SHORTNAME' ,
displayField : 'CodeAndName' ,
listeners : {
scope : this ,
'select' : function ( combo , records , eOpts ) {
if ( records . length > 0 ) {
var selectrecords = DsStoreQueryBy ( this . storenotifyparty , 'SHORTNAME' , combo . value ) ;
if ( selectrecords . getCount ( ) > 0 ) {
var selectdata = selectrecords . getAt ( 0 ) . data ;
this . formEdit . getForm ( ) . findField ( 'NOTIFYPARTY' ) . setValue ( selectdata . SHIPPERDETAIL ) ;
} else {
this . formEdit . getForm ( ) . findField ( 'NOTIFYPARTY' ) . setValue ( '' ) ;
}
}
}
}
} ) ;
//客户加载_代理
this . storeagent = Ext . create ( 'DsExt.ux.RefTableStore' , {
model : 'OpSeaeShipper' ,
proxy : { url : '/MvcShipping/MsOpSeae/GetShipperList' }
} ) ;
// this.storeShipper.load({ params: { condition: "ISCONTROLLER='1'"} });
//收货人
this . comboxAgent = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : '代 理' ,
store : this . storeagent ,
forceSelection : true ,
name : 'AGENTID' ,
valueField : 'SHORTNAME' ,
displayField : 'CodeAndName' ,
listeners : {
scope : this ,
'select' : function ( combo , records , eOpts ) {
if ( records . length > 0 ) {
var selectrecords = DsStoreQueryBy ( this . storeagent , 'SHORTNAME' , combo . value ) ;
if ( selectrecords . getCount ( ) > 0 ) {
var selectdata = selectrecords . getAt ( 0 ) . data ;
this . formEdit . getForm ( ) . findField ( 'AGENT' ) . setValue ( selectdata . SHIPPERDETAIL ) ;
} else {
this . formEdit . getForm ( ) . findField ( 'AGENT' ) . setValue ( '' ) ;
}
}
}
}
} ) ;
//#endregion
//国际港口(进口装货港、出口卸货港)
//客户加载_船公司
this . storeAIRLINES = Ext . create ( 'DsExt.ux.RefTableStore' , {
model : 'DsShipping.ux.CustomRefModel' ,
proxy : { url : '/CommMng/BasicDataRef/GetCustomRefList' }
} ) ;
this . storeAIRLINES . load ( { params : { condition : "ISAIRLINES='1'" } } ) ;
//船公司
this . comboxAIRLINES = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : '航空公司' ,
store : this . storeAIRLINES ,
forceSelection : true ,
name : 'AIRLINES' ,
valueField : 'CustName' ,
displayField : 'CodeAndName'
} ) ;
this . storeCodeDisport = Ext . create ( 'DsExt.ux.RefTableStore' , {
model : 'MsCodeAirPort' ,
proxy : { url : '/MvcShipping/MsCodeAirPort/GetDataList' }
} ) ;
this . storeCodeDisport . load ( ) ;
this . storeCodeDisport2 = Ext . create ( 'DsExt.ux.RefTableStore' , {
model : 'MsCodeAirPort' ,
proxy : { url : '/MvcShipping/MsCodeAirPort/GetDataList' }
} ) ;
this . storeCodeDisport2 . load ( ) ;
this . comboxPORTLOADID = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : '起运港' ,
store : this . storeCodeDisport ,
name : 'PORTLOADID' ,
valueField : 'PORTID' ,
displayField : 'CODEANDNAME' ,
listeners : {
scope : this ,
'select' : function ( combo , records , eOpts ) {
if ( records . length > 0 ) {
var selectrecords = DsStoreQueryBy ( this . storeCodeDisport , 'PORTID' , combo . value ) ;
if ( selectrecords . getCount ( ) > 0 ) {
var selectdata = selectrecords . getAt ( 0 ) . data ;
this . formEdit . getForm ( ) . findField ( 'PORTLOAD' ) . setValue ( selectdata . PORTENAME ) ;
} else {
this . formEdit . getForm ( ) . findField ( 'PORTLOAD' ) . setValue ( '' ) ;
}
}
}
}
} ) ;
this . comboxPORTDISCHARGEID = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : '目的港' ,
store : this . storeCodeDisport2 ,
name : 'PORTDISCHARGEID' ,
valueField : 'PORTID' ,
displayField : 'CODEANDNAME' ,
listeners : {
scope : this ,
'select' : function ( combo , records , eOpts ) {
if ( records . length > 0 ) {
var selectrecords = DsStoreQueryBy ( this . storeCodeDisport , 'PORTID' , combo . value ) ;
if ( selectrecords . getCount ( ) > 0 ) {
var selectdata = selectrecords . getAt ( 0 ) . data ;
this . formEdit . getForm ( ) . findField ( 'PORTDISCHARGE' ) . setValue ( selectdata . PORTENAME ) ;
} else {
this . formEdit . getForm ( ) . findField ( 'PORTDISCHARGE' ) . setValue ( '' ) ;
}
}
}
}
} ) ;
//付费方式
this . storeFrt = Ext . create ( 'Ext.data.Store' , {
fields : [ 'FRT' ]
} ) ;
this . storeFrt . add ( { "FRT" : "PP" } ) ;
this . storeFrt . add ( { "FRT" : "CC" } ) ;
this . comboxBLFRT = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : '运费' ,
store : this . storeFrt ,
forceSelection : true ,
name : 'BLFRT' ,
valueField : 'FRT' ,
displayField : 'FRT' ,
listeners : {
scope : this ,
change : function ( field , newValue , oldValue , eOpts ) {
var ttl = parseFloatDef ( this . formEdit . getForm ( ) . findField ( 'TTLFREIGHT' ) . getValue ( ) , 0 ) ;
var BLFRT = this . formEdit . getForm ( ) . findField ( 'BLFRT' ) . getValue ( ) ;
if ( BLFRT == 'PP' ) {
if ( ttl != 0 )
this . formEdit . getForm ( ) . findField ( 'PFREIGHT' ) . setValue ( ttl ) ;
} else if ( BLFRT == 'CC' ) {
if ( ttl != 0 )
this . formEdit . getForm ( ) . findField ( 'PFREIGHT' ) . setValue ( ttl ) ;
}
}
}
} ) ;
this . comboxOTBLFRT = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : '杂费' ,
store : this . storeFrt ,
forceSelection : true ,
name : 'OTFRT' ,
valueField : 'FRT' ,
displayField : 'FRT' ,
listeners : {
scope : this ,
change : function ( field , newValue , oldValue , eOpts ) {
this . otfeechange ( field , newValue , oldValue , eOpts ) ;
}
}
} ) ;
this . comboxHBLBLFRT = Ext . create ( 'DsExt.ux.RefTableCombox' , {
store : this . storeFrt ,
forceSelection : true ,
name : 'HBLBLFRT' ,
valueField : 'FRT' ,
displayField : 'FRT'
} ) ;
this . comboxHBLOTBLFRT = Ext . create ( 'DsExt.ux.RefTableCombox' , {
store : this . storeFrt ,
forceSelection : true ,
name : 'HBLOTBLFRT' ,
valueField : 'FRT' ,
displayField : 'FRT'
} ) ;
//提单模板
this . storeTemplate = Ext . create ( 'DsExt.ux.RefTableStore' , {
model : 'CODETEMPLATE' ,
proxy : { url : '/CommMng/BasicDataRef/GetCodeTemplateList' }
} ) ;
this . storeTemplate . load ( { params : { condition : "" } } ) ;
this . comboxTemplate = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : '提单模板' ,
store : this . storeTemplate ,
forceSelection : true ,
name : 'TEMPLATE' ,
valueField : 'TEMPLATEID' ,
displayField : 'TEMPLATE'
} ) ;
this . StoreBILLTYPE = Ext . create ( 'Ext.data.Store' , {
fields : [ 'BLTYPE' ]
} ) ;
this . StoreBILLTYPE . add ( { "BLTYPE" : "分单" } ) ;
this . StoreBILLTYPE . add ( { "BLTYPE" : "主单" } ) ;
this . comboxBILLTYPE = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : '提单类型' ,
store : this . StoreBILLTYPE ,
forceSelection : true ,
name : 'BILLTYPE' ,
valueField : 'BLTYPE' ,
displayField : 'BLTYPE'
} ) ;
//#region 编辑formEdit 基本信息
this . panelAIRLINES = new Ext . Panel ( {
layout : 'anchor' ,
bodyPadding : 5 ,
frame : true ,
trackResetOnLoad : true ,
fieldDefaults : {
margins : '2 2 2 2' ,
labelAlign : 'right' ,
flex : 1 ,
labelWidth : 70 ,
msgTarget : 'qtip'
} ,
items : [ {
xtype : 'container' ,
layout : 'anchor' ,
flex : 3 ,
defaultType : 'textfield' ,
items : [ {
xtype : 'container' ,
layout : 'hbox' ,
flex : 1 ,
defaultType : 'textfield' ,
items : [ {
fieldLabel : '主单号' ,
name : 'MBLNO' ,
listeners : {
scope : this ,
change : function ( field , newValue , oldValue , eOpts ) {
if ( newValue != oldValue ) {
_this . formEdit . getForm ( ) . findField ( 'MBLNO' ) . setValue ( newValue . toUpperCase ( ) ) ;
}
}
}
} , {
xtype : 'container' ,
layout : 'hbox' ,
flex : 1 ,
defaultType : 'textfield' ,
items : [ {
fieldLabel : '分单号' ,
name : 'HBLNO' ,
listeners : {
scope : this ,
change : function ( field , newValue , oldValue , eOpts ) {
if ( newValue != oldValue ) {
_this . formEdit . getForm ( ) . findField ( 'HBLNO' ) . setValue ( newValue . toUpperCase ( ) ) ;
}
}
}
} , {
xtype : 'button' ,
id : 'btnHBLNO' ,
iconCls : "btncancel" ,
handler : function ( button , event ) {
this . GetHBLNo ( ) ;
} ,
scope : this
} ]
} ]
} , {
xtype : 'container' ,
layout : 'hbox' ,
flex : 1 ,
defaultType : 'textfield' ,
items : [ {
fieldLabel : '航班' ,
flex : 1 ,
name : 'VESSEL'
} , this . comboxAIRLINES ]
} , {
xtype : 'container' ,
layout : 'hbox' ,
flex : 1 ,
defaultType : 'textfield' ,
items : [ this . comboxPORTLOADID , {
name : 'PORTLOAD'
} , {
fieldLabel : '开航日期' ,
format : 'Y-m-d' ,
flex : 1 ,
xtype : 'datefield' ,
name : 'ETD'
} ]
} , {
xtype : 'container' ,
layout : 'hbox' ,
flex : 1 ,
defaultType : 'textfield' ,
items : [ this . comboxPORTDISCHARGEID , {
name : 'PORTDISCHARGE'
} , {
fieldLabel : '到港日期' ,
format : 'Y-m-d' ,
flex : 1 ,
xtype : 'datefield' ,
name : 'ETA'
} ]
} ]
} ]
} ) ;
this . StoreCURR = Ext . create ( 'Ext.data.Store' , {
fields : [ 'CURR' ]
} ) ;
this . StoreCURR . add ( { "CURR" : "USD" } ) ;
this . StoreCURR . add ( { "CURR" : "JPY" } ) ;
this . StoreCURR . add ( { "CURR" : "RMB" } ) ;
this . StoreCURR . add ( { "CURR" : "HKD" } ) ;
this . comboxCURR = Ext . create ( 'DsExt.ux.RefTableCombox' , {
store : this . StoreCURR ,
fieldLabel : '币制' ,
name : 'CURR' ,
valueField : 'CURR' ,
displayField : 'CURR'
} ) ;
this . panelVALUE = new Ext . Panel ( {
layout : 'anchor' ,
bodyPadding : 5 ,
frame : true ,
trackResetOnLoad : true ,
fieldDefaults : {
margins : '2 2 2 2' ,
labelAlign : 'right' ,
flex : 1 ,
labelWidth : 70 ,
msgTarget : 'qtip'
} ,
items : [ {
xtype : 'container' ,
layout : 'anchor' ,
flex : 3 ,
defaultType : 'textfield' ,
items : [ , {
xtype : 'container' ,
layout : 'hbox' ,
flex : 1 ,
defaultType : 'textfield' ,
items : [ this . comboxCURR , this . comboxBLFRT , this . comboxOTBLFRT ]
} , {
xtype : 'container' ,
layout : 'hbox' ,
flex : 1 ,
defaultType : 'textfield' ,
items : [ {
fieldLabel : '运输申明价' ,
flex : 1 ,
name : 'CUSTVALUE'
} , {
fieldLabel : '海关申明价' ,
flex : 1 ,
name : 'CUSTOMVALUE'
} , {
fieldLabel : '保险金额' ,
flex : 1 ,
name : 'INAMOUNT' ,
renderer : function ( value , cellmeta , record , rowIndex , columnIndex , store ) {
try {
var lsValue = usMoney ( value , 2 , '' , false ) ;
if ( lsValue != "NaN" ) {
value = lsValue ; if ( parseFloat ( lsValue ) < 0 ) {
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>' ;
}
}
else {
return value ;
}
}
catch ( e ) {
return value ;
}
return value ;
}
} ]
} ]
} ]
} ) ;
this . panelKGS = new Ext . Panel ( {
layout : 'anchor' ,
bodyPadding : 5 ,
frame : true ,
trackResetOnLoad : true ,
fieldDefaults : {
margins : '2 2 2 2' ,
labelAlign : 'right' ,
flex : 1 ,
labelWidth : 70 ,
msgTarget : 'qtip'
} ,
items : [ {
xtype : 'container' ,
layout : 'anchor' ,
flex : 3 ,
defaultType : 'textfield' ,
items : [ , {
xtype : 'container' ,
layout : 'hbox' ,
flex : 1 ,
defaultType : 'textfield' ,
items : [ {
fieldLabel : '件数' ,
flex : 1 ,
name : 'PKGS'
} , {
fieldLabel : '重量' ,
flex : 1 ,
name : 'KGS' ,
listeners : {
scope : this ,
change : function ( field , newValue , oldValue , eOpts ) {
if ( newValue == null || newValue == '' ) return ;
if ( newValue != oldValue ) {
this . SetFEEKGSChangeNew ( ) ;
}
}
}
} , {
fieldLabel : '体积' ,
flex : 1 ,
name : 'CBM' ,
listeners : {
scope : this ,
change : function ( field , newValue , oldValue , eOpts ) {
if ( newValue == null || newValue == '' ) return ;
if ( newValue != oldValue ) {
this . SetFEEKGSChangeNew ( ) ;
}
}
}
} , {
fieldLabel : '货物单位' ,
flex : 1 ,
name : 'KINDPKGS'
} ]
} , {
xtype : 'container' ,
layout : 'hbox' ,
flex : 1 ,
defaultType : 'textfield' ,
items : [ {
fieldLabel : '等级' ,
flex : 1 ,
name : 'CLASS'
} , {
fieldLabel : '计费重量' ,
flex : 1 ,
name : 'FEEKGS' ,
listeners : {
scope : this ,
change : function ( field , newValue , oldValue , eOpts ) {
if ( newValue == null || newValue == '' ) return ;
if ( newValue != oldValue ) {
var feekgs = newValue ;
var price = this . formEdit . getForm ( ) . findField ( 'PRICE' ) . getValue ( ) ;
var ttl = Mul ( feekgs , price ) ;
this . formEdit . getForm ( ) . findField ( 'TTLFREIGHT' ) . setValue ( ttl ) ;
}
}
}
} , {
fieldLabel : 'X运价' ,
flex : 1 ,
name : 'PRICE' ,
listeners : {
scope : this ,
change : function ( field , newValue , oldValue , eOpts ) {
if ( newValue == null || newValue == '' ) return ;
if ( newValue != oldValue ) {
var feekgs = newValue ;
var price = this . formEdit . getForm ( ) . findField ( 'FEEKGS' ) . getValue ( ) ;
var ttl = Mul ( feekgs , price ) ;
this . formEdit . getForm ( ) . findField ( 'TTLFREIGHT' ) . setValue ( ttl ) ;
}
}
}
} , {
fieldLabel : '=总价' ,
flex : 1 ,
name : 'TTLFREIGHT' ,
listeners : {
scope : this ,
change : function ( field , newValue , oldValue , eOpts ) {
if ( newValue == oldValue ) return ;
var ttl = parseFloatDef ( newValue , 0 ) ;
var BLFRT = this . formEdit . getForm ( ) . findField ( 'BLFRT' ) . getValue ( ) ;
if ( BLFRT == 'PP' ) {
if ( ttl != 0 )
this . formEdit . getForm ( ) . findField ( 'PFREIGHT' ) . setValue ( ttl ) ;
} else if ( BLFRT == 'CC' ) {
if ( ttl != 0 )
this . formEdit . getForm ( ) . findField ( 'PFREIGHT' ) . setValue ( ttl ) ;
}
}
}
} ]
} ]
} ]
} ) ;
this . panelOTFEE = new Ext . Panel ( {
layout : 'anchor' ,
bodyPadding : 5 ,
frame : true ,
trackResetOnLoad : true ,
fieldDefaults : {
margins : '2 2 2 2' ,
labelAlign : 'right' ,
flex : 1 ,
labelWidth : 0 ,
msgTarget : 'qtip'
} ,
items : [ {
xtype : 'container' ,
layout : 'anchor' ,
flex : 3 ,
defaultType : 'textfield' ,
items : [ {
xtype : 'container' ,
layout : 'hbox' ,
flex : 1 ,
defaultType : 'textfield' ,
items : [ {
xtype : 'label' ,
flex : 1 ,
text : '费用名称'
} , {
xtype : 'label' ,
flex : 1 ,
text : '金额' ,
renderer : function ( value , cellmeta , record , rowIndex , columnIndex , store ) {
try {
var lsValue = usMoney ( value , 2 , '' , false ) ;
if ( lsValue != "NaN" ) {
value = lsValue ; if ( parseFloat ( lsValue ) < 0 ) {
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>' ;
}
}
else {
return value ;
}
}
catch ( e ) {
return value ;
}
return value ;
}
} , {
xtype : 'label' ,
flex : 1 ,
text : '费用名称'
} , {
xtype : 'label' ,
flex : 1 ,
text : '金额' ,
renderer : function ( value , cellmeta , record , rowIndex , columnIndex , store ) {
try {
var lsValue = usMoney ( value , 2 , '' , false ) ;
if ( lsValue != "NaN" ) {
value = lsValue ; if ( parseFloat ( lsValue ) < 0 ) {
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>' ;
}
}
else {
return value ;
}
}
catch ( e ) {
return value ;
}
return value ;
}
} , {
xtype : 'label' ,
flex : 1 ,
text : '费用名称'
} , {
xtype : 'label' ,
flex : 1 ,
text : '金额' ,
renderer : function ( value , cellmeta , record , rowIndex , columnIndex , store ) {
try {
var lsValue = usMoney ( value , 2 , '' , false ) ;
if ( lsValue != "NaN" ) {
value = lsValue ; if ( parseFloat ( lsValue ) < 0 ) {
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>' ;
}
}
else {
return value ;
}
}
catch ( e ) {
return value ;
}
return value ;
}
} , {
xtype : 'label' ,
flex : 1 ,
text : '费用名称'
} , {
xtype : 'label' ,
flex : 1 ,
text : '金额' ,
renderer : function ( value , cellmeta , record , rowIndex , columnIndex , store ) {
try {
var lsValue = usMoney ( value , 2 , '' , false ) ;
if ( lsValue != "NaN" ) {
value = lsValue ; if ( parseFloat ( lsValue ) < 0 ) {
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>' ;
}
}
else {
return value ;
}
}
catch ( e ) {
return value ;
}
return value ;
}
} ]
} , {
xtype : 'container' ,
layout : 'hbox' ,
flex : 1 ,
defaultType : 'textfield' ,
items : [ {
flex : 1 ,
name : 'OTFEE1'
} , {
flex : 1 ,
name : 'OTFEE1AMOUNT' ,
listeners : {
scope : this ,
change : function ( field , newValue , oldValue , eOpts ) {
this . otfeechange ( field , newValue , oldValue , eOpts ) ;
}
}
} , {
flex : 1 ,
name : 'OTFEE2'
} , {
flex : 1 ,
name : 'OTFEE2AMOUNT' ,
listeners : {
scope : this ,
change : function ( field , newValue , oldValue , eOpts ) {
this . otfeechange ( field , newValue , oldValue , eOpts ) ;
}
}
} , {
flex : 1 ,
name : 'OTFEE3'
} , {
flex : 1 ,
name : 'OTFEE3AMOUNT' ,
listeners : {
scope : this ,
change : function ( field , newValue , oldValue , eOpts ) {
this . otfeechange ( field , newValue , oldValue , eOpts ) ;
}
}
} , {
flex : 1 ,
name : 'OTFEE4'
} , {
flex : 1 ,
name : 'OTFEE4AMOUNT' ,
listeners : {
scope : this ,
change : function ( field , newValue , oldValue , eOpts ) {
this . otfeechange ( field , newValue , oldValue , eOpts ) ;
}
}
} ]
} , {
xtype : 'container' ,
layout : 'hbox' ,
flex : 1 ,
defaultType : 'textfield' ,
items : [ {
flex : 1 ,
name : 'OTFEE5'
} , {
flex : 1 ,
name : 'OTFEE5AMOUNT' ,
listeners : {
scope : this ,
change : function ( field , newValue , oldValue , eOpts ) {
this . otfeechange ( field , newValue , oldValue , eOpts ) ;
}
}
} , {
flex : 1 ,
name : 'OTFEE6'
} , {
flex : 1 ,
name : 'OTFEE6AMOUNT' ,
listeners : {
scope : this ,
change : function ( field , newValue , oldValue , eOpts ) {
this . otfeechange ( field , newValue , oldValue , eOpts ) ;
}
}
} , {
flex : 1 ,
name : 'OTFEE7'
} , {
flex : 1 ,
name : 'OTFEE7AMOUNT' ,
listeners : {
scope : this ,
change : function ( field , newValue , oldValue , eOpts ) {
this . otfeechange ( field , newValue , oldValue , eOpts ) ;
}
}
} , {
flex : 1 ,
name : 'OTFEE8'
} , {
flex : 1 ,
name : 'OTFEE8AMOUNT' ,
listeners : {
scope : this ,
change : function ( field , newValue , oldValue , eOpts ) {
this . otfeechange ( field , newValue , oldValue , eOpts ) ;
}
}
} ]
} ]
} ]
} ) ;
this . panelFEETOTAL = new Ext . Panel ( {
layout : 'anchor' ,
bodyPadding : 5 ,
frame : true ,
trackResetOnLoad : true ,
fieldDefaults : {
margins : '2 2 2 2' ,
labelAlign : 'right' ,
flex : 1 ,
labelWidth : 70 ,
msgTarget : 'qtip'
} ,
items : [ {
xtype : 'container' ,
layout : 'anchor' ,
flex : 3 ,
defaultType : 'textfield' ,
items : [ , {
xtype : 'container' ,
layout : 'hbox' ,
flex : 1 ,
defaultType : 'textfield' ,
items : [ {
fieldLabel : '运费预付' ,
flex : 1 ,
name : 'PFREIGHT' ,
listeners : {
scope : this ,
change : function ( field , newValue , oldValue , eOpts ) {
if ( newValue == null || newValue == '' ) return ;
if ( newValue != oldValue ) {
var pfreight = parseFloatDef ( newValue , 0 ) ;
var PCARRIEROT = this . formEdit . getForm ( ) . findField ( 'PCARRIEROT' ) . getValue ( ) ;
var ttl = Add ( pfreight , parseFloatDef ( PCARRIEROT , 0 ) ) ;
var POTFREIGHT = this . formEdit . getForm ( ) . findField ( 'POTFREIGHT' ) . getValue ( ) ;
ttl = Add ( ttl , parseFloatDef ( POTFREIGHT , 0 ) ) ;
if ( ttl != 0 )
this . formEdit . getForm ( ) . findField ( 'PTOTAL' ) . setValue ( ttl ) ;
}
}
}
} , {
fieldLabel : '运费到付' ,
flex : 1 ,
name : 'CFREIGHT' ,
listeners : {
scope : this ,
change : function ( field , newValue , oldValue , eOpts ) {
if ( newValue == null || newValue == '' ) return ;
if ( newValue != oldValue ) {
var pfreight = parseFloatDef ( newValue , 0 ) ;
var PCARRIEROT = this . formEdit . getForm ( ) . findField ( 'CCARRIEROT' ) . getValue ( ) ;
var ttl = Add ( pfreight , parseFloatDef ( PCARRIEROT , 0 ) ) ;
var POTFREIGHT = this . formEdit . getForm ( ) . findField ( 'COTFREIGHT' ) . getValue ( ) ;
ttl = Add ( ttl , parseFloatDef ( POTFREIGHT , 0 ) ) ;
if ( ttl != 0 )
this . formEdit . getForm ( ) . findField ( 'CTOTAL' ) . setValue ( ttl ) ;
}
}
}
} ]
} , {
xtype : 'container' ,
layout : 'hbox' ,
flex : 1 ,
defaultType : 'textfield' ,
items : [ {
fieldLabel : '杂费预付' ,
flex : 1 ,
name : 'PCARRIEROT' ,
listeners : {
scope : this ,
change : function ( field , newValue , oldValue , eOpts ) {
if ( newValue == null || newValue == '' ) return ;
if ( newValue != oldValue ) {
var PCARRIEROT = newValue ;
var pfreight = this . formEdit . getForm ( ) . findField ( 'PFREIGHT' ) . getValue ( ) ;
var ttl = Add ( parseFloatDef ( pfreight , 0 ) , parseFloatDef ( PCARRIEROT , 0 ) ) ;
var POTFREIGHT = this . formEdit . getForm ( ) . findField ( 'POTFREIGHT' ) . getValue ( ) ;
ttl = Add ( ttl , parseFloatDef ( POTFREIGHT , 0 ) ) ;
if ( ttl != 0 )
this . formEdit . getForm ( ) . findField ( 'PTOTAL' ) . setValue ( ttl ) ;
}
}
}
} , {
fieldLabel : '杂费到付' ,
flex : 1 ,
name : 'CCARRIEROT' ,
listeners : {
scope : this ,
change : function ( field , newValue , oldValue , eOpts ) {
if ( newValue == null || newValue == '' ) return ;
if ( newValue != oldValue ) {
var PCARRIEROT = newValue ;
var pfreight = this . formEdit . getForm ( ) . findField ( 'CFREIGHT' ) . getValue ( ) ;
var ttl = Add ( parseFloatDef ( pfreight , 0 ) , parseFloatDef ( PCARRIEROT , 0 ) ) ;
var POTFREIGHT = this . formEdit . getForm ( ) . findField ( 'COTFREIGHT' ) . getValue ( ) ;
ttl = Add ( ttl , parseFloatDef ( POTFREIGHT , 0 ) ) ;
if ( ttl != 0 )
this . formEdit . getForm ( ) . findField ( 'CTOTAL' ) . setValue ( ttl ) ;
}
}
}
} ]
} , {
xtype : 'container' ,
layout : 'hbox' ,
flex : 1 ,
defaultType : 'textfield' ,
items : [ {
fieldLabel : '其他预付' ,
flex : 1 ,
name : 'POTFREIGHT' ,
listeners : {
scope : this ,
change : function ( field , newValue , oldValue , eOpts ) {
if ( newValue == null || newValue == '' ) return ;
if ( newValue != oldValue ) {
var POTFREIGHT = newValue ;
var pfreight = this . formEdit . getForm ( ) . findField ( 'PFREIGHT' ) . getValue ( ) ;
var ttl = Add ( parseFloatDef ( pfreight , 0 ) , parseFloatDef ( POTFREIGHT , 0 ) ) ;
var PCARRIEROT = this . formEdit . getForm ( ) . findField ( 'PCARRIEROT' ) . getValue ( ) ;
ttl = Add ( ttl , parseFloatDef ( PCARRIEROT , 0 ) ) ;
if ( ttl != 0 )
this . formEdit . getForm ( ) . findField ( 'PTOTAL' ) . setValue ( ttl ) ;
}
}
}
} , {
fieldLabel : '其他到付' ,
flex : 1 ,
name : 'COTFREIGHT' ,
listeners : {
scope : this ,
change : function ( field , newValue , oldValue , eOpts ) {
if ( newValue == null || newValue == '' ) return ;
if ( newValue != oldValue ) {
var POTFREIGHT = newValue ;
var pfreight = this . formEdit . getForm ( ) . findField ( 'CFREIGHT' ) . getValue ( ) ;
var ttl = Add ( parseFloatDef ( pfreight , 0 ) , parseFloatDef ( POTFREIGHT , 0 ) ) ;
var PCARRIEROT = this . formEdit . getForm ( ) . findField ( 'CCARRIEROT' ) . getValue ( ) ;
ttl = Add ( ttl , parseFloatDef ( PCARRIEROT , 0 ) ) ;
if ( ttl != 0 )
this . formEdit . getForm ( ) . findField ( 'CTOTAL' ) . setValue ( ttl ) ;
}
}
}
} ]
} , {
xtype : 'container' ,
layout : 'hbox' ,
flex : 1 ,
defaultType : 'textfield' ,
items : [ {
fieldLabel : '合计预付' ,
flex : 1 ,
name : 'PTOTAL'
} , {
fieldLabel : '合计到付' ,
flex : 1 ,
name : 'CTOTAL'
} ]
} ]
} ]
} ) ;
this . formEdit = Ext . widget ( 'form' , {
region : 'north' ,
frame : true ,
bodyPadding : 5 ,
layout : 'anchor' ,
trackResetOnLoad : true ,
fieldDefaults : {
margins : '2 2 2 2' ,
labelAlign : 'right' ,
flex : 1 ,
labelWidth : 70 ,
msgTarget : 'qtip'
} ,
items : [ {
xtype : 'fieldset' ,
defaultType : 'textfield' ,
layout : 'hbox' ,
defaults : {
anchor : '96%'
} ,
items : [ {
xtype : 'container' ,
layout : 'anchor' ,
flex : 2 ,
defaultType : 'textfield' ,
items : [ {
fieldLabel : '业务编号' ,
name : 'BSNO' , hidden : true
} , {
fieldLabel : 'INPUTBY' ,
name : 'INPUTBY' , hidden : true
} , {
fieldLabel : 'AS_ID' ,
name : 'AS_ID' , hidden : true
} , this . comboxShipper , {
xtype : 'textareafield' ,
grow : true ,
labelWidth : 0 ,
height : 70 ,
name : 'SHIPPER' ,
anchor : '100%' ,
listeners : {
scope : this ,
change : function ( field , newValue , oldValue , eOpts ) {
if ( newValue != oldValue ) {
_this . formEdit . getForm ( ) . findField ( 'SHIPPER' ) . setValue ( newValue . toUpperCase ( ) ) ;
}
}
}
} , this . comboxConsignee , {
xtype : 'textareafield' ,
grow : true ,
labelWidth : 0 ,
height : 70 ,
name : 'CONSIGNEE' ,
anchor : '100%' ,
listeners : {
scope : this ,
change : function ( field , newValue , oldValue , eOpts ) {
if ( newValue != oldValue ) {
_this . formEdit . getForm ( ) . findField ( 'CONSIGNEE' ) . setValue ( newValue . toUpperCase ( ) ) ;
}
}
}
} , this . comboxNotifyParty , {
xtype : 'textareafield' ,
grow : true ,
labelWidth : 0 ,
height : 70 ,
name : 'NOTIFYPARTY' ,
anchor : '100%' ,
listeners : {
scope : this ,
change : function ( field , newValue , oldValue , eOpts ) {
if ( newValue != oldValue ) {
_this . formEdit . getForm ( ) . findField ( 'NOTIFYPARTY' ) . setValue ( newValue . toUpperCase ( ) ) ;
}
}
}
} , this . comboxAgent , {
xtype : 'textareafield' ,
grow : true ,
labelWidth : 0 ,
height : 70 ,
name : 'AGENT' ,
anchor : '100%'
}
]
} , {
xtype : 'container' ,
layout : 'anchor' ,
flex : 3 ,
defaultType : 'textfield' ,
items : [ this . panelAIRLINES , this . panelVALUE , this . panelKGS , this . panelOTFEE , {
xtype : 'label' ,
text : ''
} , {
xtype : 'textareafield' ,
// grow: true,
fieldLabel : '其他费用' ,
height : 70 ,
name : 'OTFEE' ,
anchor : '100%'
}
]
}
]
} , {
xtype : 'container' ,
layout : 'anchor' ,
flex : 1 ,
defaultType : 'textfield' ,
defaults : {
anchor : '99%'
} ,
items : [ {
xtype : 'container' ,
defaultType : 'textfield' ,
layout : 'hbox' ,
items : [ {
xtype : 'container' ,
layout : 'anchor' ,
flex : 1 ,
defaultType : 'textfield' ,
items : [ {
xtype : 'label' ,
html : '<html>唛头</html>'
} , {
xtype : 'textareafield' ,
grow : true ,
height : 100 ,
name : 'MARKS' ,
anchor : '100%' ,
listeners : {
scope : this ,
change : function ( field , newValue , oldValue , eOpts ) {
if ( newValue != oldValue ) {
_this . formEdit . getForm ( ) . findField ( 'MARKS' ) . setValue ( newValue . toUpperCase ( ) ) ;
}
}
}
}
]
} , {
xtype : 'container' ,
layout : 'anchor' ,
flex : 2 ,
defaultType : 'textfield' ,
items : [ {
xtype : 'container' ,
defaultType : 'textfield' ,
layout : 'hbox' ,
defaults : {
anchor : '100%'
} ,
items : [ {
xtype : 'label' ,
html : '<html>货物描述</html>'
} , this . comboxGOODSNAME , {
fieldLabel : 'HS编码' ,
name : 'HSCODE'
} ]
} , {
xtype : 'textareafield' ,
grow : true ,
fieldLabel : '  ' ,
labelSeparator : '' ,
labelWidth : 20 ,
height : 100 ,
name : 'DESCRIPTION' ,
anchor : '100%' ,
listeners : {
scope : this ,
change : function ( field , newValue , oldValue , eOpts ) {
if ( newValue != oldValue ) {
_this . formEdit . getForm ( ) . findField ( 'DESCRIPTION' ) . setValue ( newValue . toUpperCase ( ) ) ;
}
}
}
} ]
} , this . panelFEETOTAL
]
} , {
xtype : 'container' ,
defaultType : 'textfield' ,
layout : 'hbox' ,
items : [ {
fieldLabel : '签单日期' ,
format : 'Y-m-d' ,
xtype : 'datefield' ,
name : 'ISSUEDATE'
} , {
fieldLabel : '签单地点' ,
name : 'ISSUEPLACE'
} ]
} , {
xtype : 'textareafield' ,
grow : true ,
fieldLabel : '备 注' ,
height : 60 ,
name : 'REMARK' ,
anchor : '100%'
} ]
}
]
} ) ; //end this.formEdit
//#endregion
//#region 按钮Toolbar
this . panelBtn = new Ext . Panel ( {
region : "north" ,
tbar : [ {
id : 'btnESave' ,
text : "保存" ,
iconCls : "btnsave" ,
handler : function ( button , event ) {
this . Save ( '0' ) ;
} ,
scope : this
} , {
id : 'btnESaveAndClose' ,
text : "保存并关闭" ,
handler : function ( button , event ) {
this . Save ( '1' ) ;
} ,
scope : this
} , {
id : 'btnESaveAndNew' ,
text : "保存并新建" ,
handler : function ( button , event ) {
this . Save ( '2' ) ;
} ,
scope : this
} , {
id : 'btnECopyNew' ,
text : "复制新建" ,
handler : function ( button , event ) {
var basicForm = this . formEdit . getForm ( ) ;
this . opStatus = 'add' ;
basicForm . findField ( 'AS_ID' ) . setDisabled ( false ) ;
var field = basicForm . findField ( 'AS_ID' ) ;
field . setValue ( '*' ) ;
basicForm . findField ( 'AS_ID' ) . setDisabled ( true ) ;
field = basicForm . findField ( 'INPUTBY' ) ;
field . setValue ( SHOWNAME ) ;
this . GetEditStatus ( ) ;
} ,
scope : this
} , '-' , {
id : 'btnEHistryCopy' ,
text : "历史引入" ,
handler : function ( button , event ) {
DsOpenEditWin ( '/MvcShipping/MsOpAire/HistryBillIndex' , "提单历史引入" , "600" , "940" , "10" , "10" ) ;
} ,
scope : this
} , '-' , {
text : "关闭" ,
handler : function ( button , event ) {
window . close ( ) ;
} ,
scope : this
} , {
text : "新建" ,
handler : function ( button , event ) {
this . LoadData ( 'add' , '' ) ;
} ,
scope : this
} , '-' , {
text : "删除" ,
iconCls : "btndelete" ,
handler : function ( button , event ) {
this . onDeleteClick ( button , event ) ;
} ,
scope : this
} , '-' , {
text : "打印" ,
iconCls : "btnprint" ,
handler : function ( button , event ) {
this . Print ( ) ;
} ,
scope : this
} , '-' , {
text : "其他操作" ,
menu : [ { text : "转换成大写字母" ,
handler : function ( menu , event ) {
_this . onUpCaseClick ( menu , event ) ;
}
}
] ,
scope : this
} ]
} ) ; //end 按钮Toolbar
//#endregion
this . storeList = Ext . create ( 'Ext.data.Store' , {
pageSize : this . PageSize ,
model : 'MsOpBillModel' ,
remoteSort : true ,
proxy : {
type : 'ajax' ,
url : '/MvcShipping/MsOpAire/GetBillList' ,
reader : {
id : 'AS_ID' ,
root : 'data' ,
totalProperty : 'totalCount'
}
}
} ) ;
//#region List列表显示信息
Ext . grid . RowNumberer = Ext . extend ( Ext . grid . RowNumberer , {
width : 30
} ) ;
this . girdcolums = [ {
sortable : true ,
dataIndex : 'AS_ID' ,
header : 'AS_ID' ,
hidden : true ,
width : 0
} , {
sortable : true ,
dataIndex : 'BSNO' ,
hidden : true ,
header : '业务编号' ,
width : 0
} ,
{
sortable : true ,
dataIndex : 'MBLNO' ,
header : '主单号' ,
width : 140
} ,
{
sortable : true ,
dataIndex : 'HBLNO' ,
header : '分单号' ,
width : 140
} , {
sortable : true ,
dataIndex : 'TEMPLATE' ,
header : '模板名称' ,
width : 120
} ,
{
sortable : true ,
dataIndex : 'BILLTYPE' ,
header : '提单类型' ,
width : 120
} ,
{
sortable : true ,
dataIndex : 'INPUTBY' ,
header : '录入人' ,
width : 80
} ,
{
sortable : true ,
dataIndex : 'INPUTTIME' ,
header : '录入时间' ,
width : 80
} ,
{
sortable : true ,
dataIndex : 'MODIFYTIME' ,
header : '修改时间' ,
width : 80
} ] ;
this . GridCheckBoxModel = Ext . create ( 'Ext.selection.CheckboxModel' ) ;
//定义Grid
this . gridList = new Ext . grid . GridPanel ( {
store : this . storeList ,
enableHdMenu : false ,
region : 'west' ,
width : 160 ,
loadMask : { msg : "数据加载中,请稍等..." } ,
trackMouseOver : true ,
disableSelection : false ,
columns : this . girdcolums ,
selModel : this . GridCheckBoxModel ,
// paging bar on the bottom
bbar : Ext . create ( 'Ext.PagingToolbar' , {
store : this . storeList ,
displayInfo : true ,
displayMsg : '当前显示 {0} - {1}条记录 /共 {2}条记录' ,
emptyMsg : "没有数据"
} )
} ) ;
// /////////////以下部分为获取存储的gridpanel显示样式
// this.column = DsTruck.GetGridPanel(USERID, this.formname, this.girdcolums, 1); //使用者id, 表名, 中间column数组, 跳过一开始的几列
this . gridList . reconfigure ( this . storeList , this . girdcolums ) ;
this . gridList . columns [ 0 ] = new Ext . grid . RowNumberer ( ) ;
////////////////////////////////////////////////
this . gridList . addListener ( 'itemclick' , function ( dataview , record , item , index , e , b ) {
_this . editRecord = record ;
_this . OpStatus = 'edit' ;
_this . LoadData ( "edit" , "AS_ID='" + record . data . AS _ID + "'" ) ;
} , this ) ;
//#region 框架结构
this . panelpage = new Ext . Panel ( {
title : '提单信息' ,
layout : "border" ,
region : 'center' ,
animate : true ,
autoScroll : true ,
// containerScroll: true,
frame : false ,
items : [ this . formEdit ]
} ) ;
Ext . apply ( this , {
items : [ this . panelBtn , this . gridList , this . panelpage ]
} ) ;
//#endregion
//#region 其他
// parentWin = window.parent.opener._this.tabSeaepanel.activeTab;
// MparentWin = window.parent.opener._this;
if ( mainform ) {
this . InitData ( ) ;
}
} , //end initUIComponents
//#region 加载事件
InitData : function ( ) {
var condition = '' ;
_this = this ;
this . storeList . load ( { params : { condition : " BSNO='" + this . BsNo + "'" } ,
callback : function ( r , options , success ) {
if ( success ) {
if ( this . storeList . getCount ( ) > 0 ) {
var member = this . storeList . getAt ( 0 ) ;
_this . editRecord = member ;
_this . LoadData ( "edit" , "AS_ID='" + member . data . AS _ID + "'" ) ;
} else {
_this . LoadData ( 'add' , '' ) ;
}
}
} ,
scope : this
} ) ;
} , //end InitData
LoadData : function ( opstatus , condition ) {
this . serialNo = 0 ;
//this.bodyDel = [];
this . opStatus = opstatus ;
_this = this ;
if ( this . opStatus == 'add' ) {
this . formEdit . getForm ( ) . reset ( ) ;
this . formEdit . getForm ( ) . setValues ( this . MainEditRecord . data ) ;
this . LoadInit ( this . MainEditRecord . data ) ;
} else {
Ext . Ajax . request ( {
waitMsg : '正在查询主表数据...' ,
url : '/MvcShipping/MsOpAire/GetBillData' ,
params : {
handle : opstatus ,
condition : condition
} ,
callback : function ( options , success , response ) {
if ( success ) {
var result = Ext . JSON . decode ( response . responseText ) ;
if ( ! result . Success ) {
Ext . Msg . show ( {
title : '提示' ,
msg : result . Message ,
icon : Ext . MessageBox . ERROR ,
buttons : Ext . Msg . OK
} ) ;
return ;
}
data = result . data ;
this . isload = true ;
this . formEdit . getForm ( ) . reset ( ) ;
this . formEdit . getForm ( ) . setValues ( data ) ;
this . isload = false ;
this . LoadInit ( data ) ;
// this.GetEditStatus();
} else {
Ext . MessageBox . alert ( '请求出现错误,请重试' , response . responseText ) ;
}
} ,
scope : this
} ) ;
}
} , // end LoadDate
//#endregion
//#region 保存
Save : function ( type ) {
var basicForm = this . formEdit . getForm ( ) ;
if ( ! basicForm . isValid ( ) ) {
return ;
}
var data = this . formEdit . getForm ( ) . getValues ( false , false , false ) ;
//
Ext . Msg . wait ( '正在保存数据, 请稍侯..' ) ;
Ext . Ajax . request ( {
waitMsg : '正在保存数据...' ,
url : '/MvcShipping/MsOpAire/BillSave' ,
scope : this ,
params : {
opstatus : this . opStatus ,
data : Ext . JSON . encode ( data )
} ,
callback : function ( options , success , response ) {
if ( success ) {
Ext . MessageBox . hide ( ) ;
var jsonresult = Ext . JSON . decode ( response . responseText ) ;
if ( jsonresult . Success ) {
var returnData = jsonresult . Data ;
this . isload = true ;
this . formEdit . getForm ( ) . reset ( ) ;
this . formEdit . getForm ( ) . setValues ( returnData ) ;
this . isload = false ;
//
if ( this . opStatus == 'add' ) {
var arrNewRecords = this . storeList . insert ( 0 , returnData ) ;
this . editRecord = this . storeList . getAt ( 0 ) ;
}
else if ( this . opStatus == 'edit' ) {
var editp = Ext . create ( 'MsOpBillModel' , returnData ) ;
this . editRecord . fields . each ( function ( field ) {
if ( field . persist ) {
name = field . name ;
if ( name != 'id' )
this . editRecord . set ( name , editp . get ( name ) ) ;
}
} , this ) ;
this . editRecord . commit ( ) ;
this . LoadInit ( returnData ) ;
}
if ( type == '0' ) {
this . opStatus = 'edit' ;
} else if ( type == '1' ) {
window . close ( ) ;
} else if ( type == '2' ) {
this . LoadData ( 'add' , '' ) ;
}
} else {
Ext . Msg . show ( { title : '错误' , msg : jsonresult . Message , icon : Ext . Msg . ERROR , buttons : Ext . Msg . OK } ) ;
}
} else {
Ext . Msg . show ( { title : '请重试' ,
msg : '服务器响应出错' ,
icon : Ext . Msg . ERROR , buttons : Ext . Msg . OK
} ) ;
}
}
} ) ;
} , //end save
//#endregion
onDeleteClick : function ( button , event ) {
var selections = this . gridList . getSelectionModel ( ) . getSelection ( ) ;
if ( selections . length == 0 ) {
Ext . Msg . show ( { title : '提示' , msg : '请先选择业务!' , icon : Ext . Msg . INFO , buttons : Ext . Msg . OK } ) ;
return ;
}
var record = selections [ 0 ] ;
if ( this . StoreOpRange . getCount ( ) == 0 ) {
Ext . Msg . show ( { title : '警告' , msg : '权限不足,不允许删除!' , icon : Ext . Msg . WARNING , buttons : Ext . Msg . OK } ) ;
return ;
} else {
var inputby = record . data . INPUTBY ;
var records = DsStoreQueryBy ( this . StoreOpRange , 'OPID' , inputby ) ;
if ( records . getCount ( ) > 0 ) {
} else {
canedit = false ;
Ext . Msg . show ( { title : '警告' , msg : '权限不足,不允许删除!' , icon : Ext . Msg . WARNING , buttons : Ext . Msg . OK } ) ;
return ;
}
}
Ext . MessageBox . confirm ( '提示' , '确定删除该记录吗?' , function ( btn ) {
if ( btn == 'yes' ) {
Ext . Msg . wait ( '正在删除数据...' ) ;
Ext . Ajax . request ( {
waitMsg : '正在删除数据...' ,
url : '/MvcShipping/MsOpAire/BillDelete' ,
params : {
data : Ext . JSON . encode ( record . data )
} ,
callback : function ( options , success , response ) {
if ( success ) {
var jsonresult = Ext . JSON . decode ( response . responseText ) ;
if ( jsonresult . Success ) {
this . storeList . remove ( record ) ;
if ( this . storeList . getCount ( ) > 0 ) {
var member = this . storeList . getAt ( 0 ) ;
this . LoadData ( "edit" , "AS_ID='" + member . data . AS _ID + "'" ) ;
this . editRecord = member ;
} else {
this . LoadData ( 'add' , '' ) ;
}
Ext . Msg . show ( { title : '提示' , msg : jsonresult . Message , icon : Ext . Msg . INFO , buttons : Ext . Msg . OK } ) ;
}
else {
Ext . Msg . show ( { title : '错误' , msg : jsonresult . Message , icon : Ext . Msg . ERROR , buttons : Ext . Msg . OK } ) ;
}
}
} ,
failure : function ( response , options ) {
Ext . Msg . show ( { title : '警告' , msg : '服务器响应出错,请重试' , icon : Ext . Msg . INFO , buttons : Ext . Msg . OK } ) ;
} ,
success : function ( response , options ) { } ,
scope : this
} ) ; //end Ext.Ajax.request
}
} , this ) ;
} ,
otfeechange : function ( field , newValue , oldValue , eOpts ) {
if ( newValue == oldValue ) return ;
var s = '' ;
var ttl = 0.0 ;
var otfee1amount = parseFloatDef ( this . formEdit . getForm ( ) . findField ( 'OTFEE1AMOUNT' ) . getValue ( ) , 0 ) ;
var otfee1 = this . formEdit . getForm ( ) . findField ( 'OTFEE1' ) . getValue ( ) ;
if ( otfee1 != '' && otfee1amount != 0 ) {
s = s + otfee1 + ':' + otfee1amount + ';' ;
ttl = Add ( ttl , otfee1amount ) ;
}
otfee1amount = parseFloatDef ( this . formEdit . getForm ( ) . findField ( 'OTFEE2AMOUNT' ) . getValue ( ) , 0 ) ;
otfee1 = this . formEdit . getForm ( ) . findField ( 'OTFEE2' ) . getValue ( ) ;
if ( otfee1 != '' && otfee1amount != 0 ) {
s = s + otfee1 + ':' + otfee1amount + ';' ;
ttl = Add ( ttl , otfee1amount ) ;
}
otfee1amount = parseFloatDef ( this . formEdit . getForm ( ) . findField ( 'OTFEE3AMOUNT' ) . getValue ( ) , 0 ) ;
otfee1 = this . formEdit . getForm ( ) . findField ( 'OTFEE3' ) . getValue ( ) ;
if ( otfee1 != '' && otfee1amount != 0 ) {
s = s + otfee1 + ':' + otfee1amount + ';' ;
ttl = Add ( ttl , otfee1amount ) ;
}
otfee1amount = parseFloatDef ( this . formEdit . getForm ( ) . findField ( 'OTFEE4AMOUNT' ) . getValue ( ) , 0 ) ;
otfee1 = this . formEdit . getForm ( ) . findField ( 'OTFEE4' ) . getValue ( ) ;
if ( otfee1 != '' && otfee1amount != 0 ) {
s = s + otfee1 + ':' + otfee1amount + ';' ;
ttl = Add ( ttl , otfee1amount ) ;
}
otfee1amount = parseFloatDef ( this . formEdit . getForm ( ) . findField ( 'OTFEE5AMOUNT' ) . getValue ( ) , 0 ) ;
otfee1 = this . formEdit . getForm ( ) . findField ( 'OTFEE5' ) . getValue ( ) ;
if ( otfee1 != '' && otfee1amount != 0 ) {
s = s + otfee1 + ':' + otfee1amount + ';' ;
ttl = Add ( ttl , otfee1amount ) ;
}
otfee1amount = parseFloatDef ( this . formEdit . getForm ( ) . findField ( 'OTFEE6AMOUNT' ) . getValue ( ) , 0 ) ;
otfee1 = this . formEdit . getForm ( ) . findField ( 'OTFEE6' ) . getValue ( ) ;
if ( otfee1 != '' && otfee1amount != 0 ) {
s = s + otfee1 + ':' + otfee1amount + ';' ;
ttl = Add ( ttl , otfee1amount ) ;
}
otfee1amount = parseFloatDef ( this . formEdit . getForm ( ) . findField ( 'OTFEE7AMOUNT' ) . getValue ( ) , 0 ) ;
otfee1 = this . formEdit . getForm ( ) . findField ( 'OTFEE7' ) . getValue ( ) ;
if ( otfee1 != '' && otfee1amount != 0 ) {
s = s + otfee1 + ':' + otfee1amount + ';' ;
ttl = Add ( ttl , otfee1amount ) ;
}
otfee1amount = parseFloatDef ( this . formEdit . getForm ( ) . findField ( 'OTFEE8AMOUNT' ) . getValue ( ) , 0 ) ;
otfee1 = this . formEdit . getForm ( ) . findField ( 'OTFEE8' ) . getValue ( ) ;
if ( otfee1 != '' && otfee1amount != 0 ) {
s = s + otfee1 + ':' + otfee1amount + ';' ;
ttl = Add ( ttl , otfee1amount ) ;
}
var OTFRT = this . formEdit . getForm ( ) . findField ( 'OTFRT' ) . getValue ( ) ;
if ( OTFRT == 'PP' ) {
if ( ttl != 0 )
this . formEdit . getForm ( ) . findField ( 'PCARRIEROT' ) . setValue ( ttl ) ;
} else if ( OTFRT == 'CC' ) {
if ( ttl != 0 )
this . formEdit . getForm ( ) . findField ( 'CCARRIEROT' ) . setValue ( ttl ) ;
}
this . formEdit . getForm ( ) . findField ( 'OTFEE' ) . setValue ( s ) ;
} ,
SetFEEKGSChangeNew : function ( ) {
if ( this . isload ) return ;
var KGS = this . formEdit . getForm ( ) . findField ( 'KGS' ) . getValue ( ) ;
var CBM = this . formEdit . getForm ( ) . findField ( 'CBM' ) . getValue ( ) ;
var ACBM = Div ( CBM , 0.006 ) ;
var ACBMSTR = ACBM . toString ( ) ;
if ( ACBMSTR . indexOf ( '.' ) > 0 ) {
var arr1 = ACBMSTR . split ( "." ) ;
var postr = arr1 [ 1 ] . substr ( 1 , 1 ) ;
var acbm = Number ( arr1 [ 0 ] ) ;
if ( postr == '0' ) ACBMSTR = arr1 [ 0 ] ;
else if ( postr == '1' || postr == '2' || postr == '3' || postr == '4' || postr == '5' ) ACBMSTR = arr1 [ 0 ] + '.5' ;
else if ( postr == '6' || postr == '7' || postr == '8' || postr == '9' ) ACBMSTR = Add ( acbm , 1 ) ;
}
ACBM = Number ( ACBMSTR ) ;
var feekgs = 0 ;
if ( ACBM >= KGS ) { feekgs = ACBM } else feekgs = KGS ;
this . formEdit . getForm ( ) . findField ( 'FEEKGS' ) . setValue ( feekgs ) ;
var price = this . formEdit . getForm ( ) . findField ( 'PRICE' ) . getValue ( ) ;
if ( price == '' ) price = '0' ;
var ttl = Mul ( feekgs , price ) ;
this . formEdit . getForm ( ) . findField ( 'TTLFREIGHT' ) . setValue ( ttl ) ;
} ,
//#region
LoadInit : function ( data ) {
var CUSTOMERNAME = this . MainEditRecord . CUSTOMERNAME ;
this . storeShipper . load ( { params : { condition : "shippertype=2 AND (ISPUBLIC=1 OR CODENAME IN (SELECT CODENAME FROM info_client WHERE SHORTNAME='" + CUSTOMERNAME + "') )" } ,
callback : function ( r , options , success ) {
if ( success ) {
this . formEdit . getForm ( ) . findField ( 'SHIPPERID' ) . setValue ( data . SHIPPERID ) ;
}
} ,
scope : this
} ) ;
this . storeConsignee . load ( { params : { condition : "shippertype=1 AND (ISPUBLIC=1 OR CODENAME IN (SELECT CODENAME FROM info_client WHERE SHORTNAME='" + CUSTOMERNAME + "') )" } ,
callback : function ( r , options , success ) {
if ( success ) {
this . formEdit . getForm ( ) . findField ( 'CONSIGNEEID' ) . setValue ( data . CONSIGNEEID ) ;
}
} ,
scope : this
} ) ;
this . storenotifyparty . load ( { params : { condition : "shippertype=3 AND (ISPUBLIC=1 OR CODENAME IN (SELECT CODENAME FROM info_client WHERE SHORTNAME='" + CUSTOMERNAME + "') )" } ,
callback : function ( r , options , success ) {
if ( success ) {
this . formEdit . getForm ( ) . findField ( 'NOTIFYPARTYID' ) . setValue ( data . NOTIFYPARTYID ) ;
}
} ,
scope : this
} ) ;
this . storeagent . load ( { params : { condition : "shippertype=4 AND (ISPUBLIC=1 OR CODENAME IN (SELECT CODENAME FROM info_client WHERE SHORTNAME='" + CUSTOMERNAME + "') )" } ,
callback : function ( r , options , success ) {
if ( success ) {
this . formEdit . getForm ( ) . findField ( 'AGENTID' ) . setValue ( data . AGENTID ) ;
}
} ,
scope : this
} ) ;
} ,
//#endregion
//#region 转换成大写字符
onUpCaseClick : function ( menu , event ) {
this . formEdit . getForm ( ) . findField ( 'SHIPPER' ) . setValue ( this . formEdit . getForm ( ) . findField ( 'SHIPPER' ) . getValue ( ) . toUpperCase ( ) ) ;
this . formEdit . getForm ( ) . findField ( 'CONSIGNEE' ) . setValue ( this . formEdit . getForm ( ) . findField ( 'CONSIGNEE' ) . getValue ( ) . toUpperCase ( ) ) ;
this . formEdit . getForm ( ) . findField ( 'NOTIFYPARTY' ) . setValue ( this . formEdit . getForm ( ) . findField ( 'NOTIFYPARTY' ) . getValue ( ) . toUpperCase ( ) ) ;
this . formEdit . getForm ( ) . findField ( 'AGENT' ) . setValue ( this . formEdit . getForm ( ) . findField ( 'AGENT' ) . getValue ( ) . toUpperCase ( ) ) ;
this . formEdit . getForm ( ) . findField ( 'MARKS' ) . setValue ( this . formEdit . getForm ( ) . findField ( 'MARKS' ) . getValue ( ) . toUpperCase ( ) ) ;
this . formEdit . getForm ( ) . findField ( 'DESCRIPTION' ) . setValue ( this . formEdit . getForm ( ) . findField ( 'DESCRIPTION' ) . getValue ( ) . toUpperCase ( ) ) ;
} ,
//#endregion
//#region 编辑时按钮等的状态
GetHBLNo : function ( ) {
var HBLNO = this . formEdit . getForm ( ) . findField ( 'HBLNO' ) . getValue ( ) ;
var ETD = this . formEdit . getForm ( ) . findField ( 'ETD' ) . getValue ( ) ;
Ext . Ajax . request ( {
waitMsg : '正在查询委托编号状态...' , //'正在查询委托编号状态...',
url : '/MvcShipping/MsSysBillNoSet/GetNewNo' ,
params : {
bltype : '空运出口' ,
ruleblno : '分提单号' ,
etd : ETD ,
accdate : ETD
} ,
callback : function ( options , success , response ) {
if ( success ) {
var result = Ext . JSON . decode ( response . responseText ) ;
if ( result . Success != true ) {
} else {
this . formEdit . getForm ( ) . findField ( 'HBLNO' ) . setValue ( result . Message ) ;
}
} else {
Ext . MessageBox . alert ( '请求出现错误,请重试' , response . responseText ) ;
}
} ,
scope : this
} ) ;
} ,
GetEditStatus : function ( ) {
var canedit = false ;
//var bsStatus = this.formHead.getForm().findField('BSSTATUS').getValue();
var BSSTATUS = this . formHead . getForm ( ) . findField ( 'BSSTATUSREF' ) . getValue ( ) ;
var inputby = this . formHead . getForm ( ) . findField ( 'INPUTBY' ) . getValue ( ) ;
var op = this . formHead . getForm ( ) . findField ( 'OP' ) . getValue ( ) ;
_this = this ;
if ( BSSTATUS == '锁定' ) {
canedit = false ;
this . setSaveBtnStatus ( canedit ) ;
} else {
this . StoreOpRange . load ( { params : { optype : "modOrderManagement" } ,
callback : function ( r , options , success ) {
if ( success ) {
if ( r . length != 0 ) {
var records = DsStoreQueryBy ( _this . StoreOpRange , 'OPID' , op ) ;
if ( records . getCount ( ) > 0 ) {
canedit = true ;
} else {
var recordins = DsStoreQueryBy ( _this . StoreOpRange , 'OPID' , inputby ) ;
if ( recordins . getCount ( ) > 0 ) {
canedit = true ;
} else {
canedit = false ;
}
}
} else { canedit = false ; }
_this . setSaveBtnStatus ( canedit ) ;
}
}
} ) ;
}
_this = this ;
Ext . Ajax . request ( {
waitMsg : '正在查询委托编号状态...' ,
url : '/MvcShipping/MsBaseInfo/GetRuleEdit' ,
params : {
rulename : '委托编号' ,
ruletype : '1'
} ,
callback : function ( options , success , response ) {
if ( success ) {
var custno = _this . formHead . getForm ( ) . findField ( 'CUSTNO' ) ;
custno . setReadOnly ( true ) ;
} else {
Ext . MessageBox . alert ( '请求出现错误,请重试' , response . responseText ) ;
}
} ,
scope : this
} ) ;
Ext . Ajax . request ( {
waitMsg : '正在查询委托编号状态...' ,
url : '/MvcShipping/MsBaseInfo/GetRuleEdit' ,
params : {
rulename : '分提单号' ,
ruletype : '1'
} ,
callback : function ( options , success , response ) {
if ( success ) {
var hblno = _this . formHead . getForm ( ) . findField ( 'HBLNO' ) ;
hblno . setReadOnly ( true ) ;
} else {
Ext . MessageBox . alert ( '请求出现错误,请重试' , response . responseText ) ;
}
} ,
scope : this
} ) ;
} ,
GetStringNum : function ( str ) {
var num = 0 ;
if ( str == null || str == '' ) return num ;
if ( str . length == 0 ) return num ;
var if _find = false ;
var str _num = '' ;
for ( var i = 0 ; i < str . length ; i += 1 ) {
var member = str . substr ( i , 1 ) ;
if ( ( member == '0' ) || ( member == '1' ) || ( member == '2' ) || ( member == '3' )
|| ( member == '4' ) || ( member == '5' ) || ( member == '6' ) || ( member == '7' )
|| ( member == '8' ) || ( member == '9' ) || ( member == '.' ) || ( member == '-' ) ) {
if ( ! if _find ) {
str _num = str _num + member ;
}
} else {
if _find = true ;
}
}
return str _num ;
} ,
setSaveBtnStatus : function ( enable ) {
var btnESave = Ext . getCmp ( 'btnESave' ) ;
var btnESaveAndClose = Ext . getCmp ( 'btnESaveAndClose' ) ;
var btnESaveAndNew = Ext . getCmp ( 'btnESaveAndNew' ) ;
var btnEAddDetail = Ext . getCmp ( 'btnadddetail' ) ;
var btnEDeleteDetail = Ext . getCmp ( 'btndeldetail' ) ;
if ( enable ) {
btnESave . enable ( ) ;
btnESaveAndClose . enable ( ) ;
btnESaveAndNew . enable ( ) ;
btnEAddDetail . enable ( ) ;
btnEDeleteDetail . enable ( ) ;
} else {
btnESave . disable ( ) ;
btnESaveAndClose . disable ( ) ;
btnESaveAndNew . disable ( ) ;
btnEAddDetail . disable ( ) ;
btnEDeleteDetail . disable ( ) ;
}
} ,
//#endregion
//#region 打印
Print : function ( ) {
var basicForm = this . formEdit . getForm ( ) ;
var billNo = basicForm . findField ( 'AS_ID' ) . value ;
var bsNo = basicForm . findField ( 'BSNO' ) . value ;
if ( billNo == '*' || billNo == '' || billNo == NaN ) {
Ext . Msg . show ( { title : '错误' , msg : '提单还没有保存,请保存后再打印' , icon : Ext . Msg . ERROR , buttons : Ext . Msg . OK } ) ;
return ;
}
var MBLNO = basicForm . findField ( 'MBLNO' ) . value ;
var printType = 'MSOPBILLAIR' ;
var sql1 = "SET LANGUAGE 'us_english' SELECT * FROM op_aire_bill WHERE AS_ID = '" + billNo + "'" ;
var sql2 = "SET LANGUAGE 'us_english' SELECT * FROM op_aire WHERE BSNO = '" + bsNo + "'" ;
var sql3 = "" ;
var sql4 = "" ;
var sql5 = "" ;
var sql6 = "" ;
PrintComm ( printType , sql1 , sql2 , sql3 , sql4 , sql5 , sql6 , MBLNO ) ;
}
// #endregion
} ) ;