Ext . namespace ( 'Shipping' ) ;
//#region 获取 YYYY-mm-dd 格式的日期
//var xhr = new XMLHttpRequest();
//var currdate = new Date();
//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);
// }
//}
//xhr.send(null);
//#endregion
Shipping . MsOpCtnrDynaEdit = function ( config ) {
Ext . applyIf ( this , config ) ;
this . initUIComponents ( ) ;
window . Shipping . MsOpCtnrDynaEdit . superclass . constructor . call ( this ) ;
} ;
Ext . extend ( Shipping . MsOpCtnrDynaEdit , Ext . Panel , {
parentWin : null ,
OpStatus : 'add' ,
StoreList : null ,
EditRecord : null ,
parentRecord : null ,
initUIComponents : function ( ) {
this . formname = 'MsCtnrDynaEdit' ;
this . CtnrDynaBodyDel = [ ] ;
this . MsPeriod = null ;
//#region 数据集定义
//空重
this . storeCodeLoadport = Ext . create ( 'DsExt.ux.RefTableStore' , {
model : 'DsShipping.ux.CodeLoadportModel' ,
proxy : { url : '/CommMng/BasicDataRef/GetCodeLoadportList' }
} ) ;
this . storeCodeLoadport . load ( ) ;
this . comboxPORT = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : '所在港口' ,
store : this . storeCodeLoadport ,
//forceSelection: true,
id : 'PORT' ,
name : 'PORT' ,
valueField : 'PORT' ,
displayField : 'CodeAndName' ,
matchFieldWidth : false //下拉款自适应宽度
//
} ) ;
//场站
this . storeYARD = Ext . create ( 'DsExt.ux.RefTableStore' , {
model : 'DsShipping.ux.CustomRefModel' ,
proxy : { url : '/CommMng/BasicDataRef/GetCustomRefListYARD' }
} ) ;
this . storeYARD . load ( ) ;
//
this . comboxYARD = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : '场站' ,
store : this . storeYARD ,
forceSelection : true ,
queryMode : 'remote' ,
minChars : 0 ,
queryParam : 'CODENAME' ,
name : 'YARD' ,
valueField : 'CustName' ,
displayField : 'CodeAndName'
} ) ;
//人员信息加载
this . storeOpCode = Ext . create ( 'DsExt.ux.RefTableStore' , {
model : 'DsShipping.ux.UserRefModel' ,
proxy : { url : '/CommMng/BasicDataRef/GetUserRefList' }
} ) ;
this . storeOpCode . load ( ) ;
//操 作
this . comboxOP = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : '操作' ,
store : this . storeOpCode ,
forceSelection : true ,
name : 'OP' ,
valueField : 'UserName' ,
displayField : 'CodeAndName' ,
enableKeyEvents : true
} ) ;
//箱动态类型
this . storeCTNSTATUS = Ext . create ( 'DsExt.ux.RefEnumStore' , { } ) ;
this . storeCTNSTATUS . load ( { params : { enumTypeId : 99060 } } ) ;
this . comboxCTNSTATUS = Ext . create ( 'DsExt.ux.RefEnumCombox' , {
store : this . storeCTNSTATUS ,
fieldLabel : '箱动态' ,
name : 'CTNSTATUS' ,
valueField : 'EnumValueName' ,
displayField : 'EnumValueName'
} ) ;
this . storeCodeCtnr = Ext . create ( 'DsExt.ux.RefTableStore' , {
model : 'MsOpCtnrDetail' ,
proxy : { url : '/MvcContainer/MsOpCtnr/GetCtnrList' }
} ) ;
this . storeCodeCtnr . on ( 'beforeload' , function ( store ) {
Ext . apply ( store . proxy . extraParams , { isdata : "1" } ) ;
} , this ) ;
this . comboxCNTRNO = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : '箱号' , //'船公司',
store : this . storeCodeCtnr ,
//forceSelection: true,
queryMode : 'remote' ,
labelWidth : 120 ,
minChars : 1 ,
queryParam : 'CNTRNO' ,
name : 'CNTRNO' ,
valueField : 'CNTRNO' ,
displayField : 'CNTRNO' ,
listeners : {
scope : this ,
'select' : function ( combo , records , eOpts ) {
if ( records . length > 0 ) {
this . formEdit . getForm ( ) . findField ( 'CTNGID' ) . setValue ( records [ 0 ] . data . CTNGID ) ;
this . formEdit . getForm ( ) . findField ( 'CTNALL' ) . setValue ( records [ 0 ] . data . CTNALL ) ;
this . formEdit . getForm ( ) . findField ( 'CTNEF' ) . setValue ( records [ 0 ] . data . CTNEF ) ;
}
}
}
} ) ;
this . storeCTNEF = Ext . create ( 'Ext.data.Store' , {
fields : [ 'FType' , 'NAME' ]
} ) ;
this . storeCTNEF . add ( { "FType" : 'E' , "NAME" : "空" } ) ;
this . storeCTNEF . add ( { "FType" : 'F' , "NAME" : "重" } ) ;
this . comboxCTNEF = Ext . create ( 'DsExt.ux.RefTableCombox' , {
store : this . storeCTNEF ,
fieldLabel : '空重' ,
labelWidth : 120 ,
valueField : 'FType' ,
displayField : 'NAME' ,
forceSelection : true ,
name : 'CTNEF'
} ) ;
this . storeCodeDisport = Ext . create ( 'DsExt.ux.RefTableStore' , {
model : 'DsShipping.ux.CodeDisportModel' ,
autoLoad : true ,
proxy : { url : '/CommMng/BasicDataRef/GetCodeDisportListRm' }
} ) ;
this . storeCodeDisport3 = Ext . create ( 'DsExt.ux.RefTableStore' , {
model : 'DsShipping.ux.CodeDisportModel' ,
autoLoad : true ,
proxy : { url : '/CommMng/BasicDataRef/GetCodeDisportListRm' }
} ) ;
this . comboxPORTDISCHARGE = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : '目的港' ,
store : this . storeCodeDisport ,
queryMode : 'remote' ,
labelWidth : 120 ,
minChars : 1 ,
queryParam : 'CODENAME' ,
name : 'DESTPORT' ,
valueField : 'PORT' ,
displayField : 'PORT'
} ) ;
this . comboxPORTLOAD = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : '起运港' ,
store : this . storeCodeDisport3 ,
labelWidth : 120 ,
queryMode : 'remote' ,
minChars : 1 ,
queryParam : 'CODENAME' ,
name : 'PORTLOAD' ,
valueField : 'PORT' ,
displayField : 'PORT'
} ) ;
//客户加载_场站
this . store _PORTLOAD _STATOIN = Ext . create ( 'DsExt.ux.RefTableStore' , {
model : 'DsShipping.ux.CustomRefModel' ,
proxy : { url : '/CommMng/BasicDataRef/GetCustomRefListYARD' }
} ) ;
this . store _PORTLOAD _STATOIN . load ( ) ;
//场站
this . comboxPORTLOAD _STATOIN = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : '起运港场站' ,
store : this . store _PORTLOAD _STATOIN ,
forceSelection : true ,
queryMode : 'remote' ,
minChars : 0 ,
queryParam : 'CODENAME' ,
name : 'YARD' ,
name : 'PORTLOAD_STATOIN' ,
valueField : 'CustName' ,
displayField : 'CodeAndName'
} ) ;
this . storeDESTPORT _STATOIN = Ext . create ( 'DsExt.ux.RefTableStore' , {
model : 'DsShipping.ux.CustomRefModel' ,
proxy : { url : '/CommMng/BasicDataRef/GetCustomRefListYARD' }
} ) ;
this . storeDESTPORT _STATOIN . load ( ) ;
//场站
this . comboxDESTPORT _STATOIN = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : '目的港场站' ,
store : this . storeDESTPORT _STATOIN ,
forceSelection : true ,
queryMode : 'remote' ,
minChars : 0 ,
queryParam : 'CODENAME' ,
name : 'YARD' ,
name : 'DESTPORT_STATOIN' ,
valueField : 'CustName' ,
displayField : 'CodeAndName'
} ) ;
this . StoreTRANSTYPE = Ext . create ( 'Ext.data.Store' , {
fields : [ 'OpLb' ]
} ) ;
this . StoreTRANSTYPE . add ( { "OpLb" : "配货" } ) ;
this . StoreTRANSTYPE . add ( { "OpLb" : "空返" } ) ;
this . StoreTRANSTYPE . add ( { "OpLb" : "调拨" } ) ;
this . comboxTRANSTYPE = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : '运输类型' ,
store : this . StoreTRANSTYPE ,
//flex: 0.5,
labelWidth : 120 ,
forceSelection : true ,
name : 'TRANSTYPE' ,
valueField : 'OpLb' ,
displayField : 'OpLb'
} ) ;
this . storeAGENT = Ext . create ( 'DsExt.ux.RefTableStore' , {
model : 'DsShipping.ux.CustomRefModel' ,
proxy : { url : '/CommMng/BasicDataRef/GetCustomRefListAgent' }
} ) ;
this . storeAGENT . load ( ) ;
this . comboxAgent = Ext . create ( 'DsExt.ux.RefTableCombox' , {
fieldLabel : '目的港代理' ,
store : this . storeAGENT ,
forceSelection : true ,
labelWidth : 120 ,
queryMode : 'remote' ,
minChars : 1 ,
queryParam : 'CODENAME' ,
name : 'AGENTNAME' ,
valueField : 'CustName' ,
displayField : 'CodeAndName'
} ) ;
//#endregion
//#region form定义
//编辑form:formEdit
this . formEdit = Ext . widget ( 'form' , {
// layout: "border",
region : 'north' ,
height : 218 ,
frame : true ,
bodyPadding : 1 ,
trackResetOnLoad : true ,
fieldDefaults : {
margins : '1 1 1 1' ,
labelAlign : 'right' ,
flex : 1 ,
labelWidth : 80 ,
msgTarget : 'qtip'
//,split:true
} ,
items : [
{ //fieldset 1
xtype : 'fieldset' ,
defaultType : 'textfield' ,
layout : 'anchor' ,
defaults : {
anchor : '100%'
} ,
items : [ { //container_1
xtype : 'container' ,
layout : 'hbox' ,
defaultType : 'textfield' ,
items : [ {
fieldLabel : 'GID' ,
hidden : true ,
name : 'GID'
} , {
fieldLabel : 'CTNGID' ,
hidden : true ,
name : 'CTNGID'
} , this . comboxCNTRNO
,
{
fieldLabel : '箱型' , flex : 1 ,
readOnly : true ,
name : 'CTNALL'
} , {
fieldLabel : '业务状态' ,
readOnly : true ,
name : 'BSSTATUSREF' ,
value : '未锁定'
} , {
fieldLabel : '费用状态' ,
readOnly : true ,
name : 'FEESTATUSREF' ,
value : '未锁定'
} , {
fieldLabel : '会计期间' ,
flex : 1 ,
name : 'ACCDATE' ,
xtype : 'monthfield' ,
format : 'Y-m' ,
value : Ext . util . Format . date ( currdate , 'Y-m' ) ,
editable : false ,
allowBlank : false
}
]
} , { //container_1
xtype : 'container' ,
layout : 'hbox' ,
defaultType : 'textfield' ,
items : [ this . comboxCTNEF , {
fieldLabel : '当前动态' , flex : 1 ,
readOnly : true ,
name : 'CTNSTATUS'
} ,
{
fieldLabel : '动态日期' ,
name : 'CTNSTATUSTIME' ,
format : 'Y-m-d' ,
labelWidth : 90 ,
readOnly : true ,
xtype : 'datefield' ,
enableKeyEvents : true
} , {
fieldLabel : '当前港口' , flex : 1 ,
readOnly : true ,
name : 'PORT'
} , {
fieldLabel : '当前场站' , flex : 1 ,
readOnly : true ,
name : 'YARD'
}
]
} ,
{
xtype : 'container' ,
layout : 'hbox' ,
defaultType : 'textfield' ,
items : [ {
fieldLabel : '委托编号' ,
labelWidth : 120 ,
name : 'CUSTNO'
} , {
fieldLabel : '提单号' ,
name : 'MBLNO'
} , {
fieldLabel : '分提单号' ,
name : 'HBLNO'
} , {
fieldLabel : '船名' ,
name : 'VESSEL'
} , {
fieldLabel : '航次' ,
name : 'VOYNO'
}
]
} ,
{
xtype : 'container' ,
layout : 'hbox' ,
defaultType : 'textfield' ,
items : [ this . comboxTRANSTYPE , this . comboxPORTLOAD _STATOIN , {
fieldLabel : '起运港提箱日期' ,
labelWidth : 120 ,
format : 'Y-m-d' ,
flex : 1 ,
xtype : 'datefield' ,
name : 'PORTLOAD_CNT_TIME'
} , this . comboxPORTLOAD , {
fieldLabel : '开船日期' ,
labelWidth : 120 ,
format : 'Y-m-d' ,
flex : 1 ,
xtype : 'datefield' ,
name : 'ETD'
}
]
} ,
{
xtype : 'container' ,
layout : 'hbox' ,
defaultType : 'textfield' ,
items : [ this . comboxPORTDISCHARGE , {
fieldLabel : '到港日期' ,
labelWidth : 120 ,
format : 'Y-m-d' ,
flex : 1 ,
xtype : 'datefield' ,
name : 'ETA'
} , this . comboxDESTPORT _STATOIN , {
fieldLabel : '目的港提箱日期' ,
format : 'Y-m-d' ,
labelWidth : 120 ,
flex : 1 ,
xtype : 'datefield' ,
name : 'DEST_CNT_TIME'
} , {
fieldLabel : '目的港还箱日期' ,
format : 'Y-m-d' ,
labelWidth : 120 ,
flex : 1 ,
xtype : 'datefield' ,
name : 'DEST_RTCNT_TIME'
}
]
} ,
{
xtype : 'container' ,
layout : 'hbox' ,
defaultType : 'textfield' ,
items : [ this . comboxAgent , {
fieldLabel : '起运港免箱使天数' ,
labelWidth : 120 ,
name : 'PORTLOAD_FREE_DAYS'
} , {
fieldLabel : '起运港超期天数' ,
readOnly : true ,
labelWidth : 120 ,
name : 'PORTLOAD_OVER_DAYS'
} , {
fieldLabel : '起运港箱使费/天' ,
labelWidth : 120 ,
name : 'PORTLOAD_OVER_DAYS_FEE'
} , {
labelWidth : 120 ,
readOnly : true ,
fieldLabel : '起运港箱使费' ,
name : 'PORTLOAD_OVER_DAYS_AMT'
}
]
} ,
{
xtype : 'container' ,
layout : 'hbox' ,
defaultType : 'textfield' ,
items : [ {
fieldLabel : '目的港免箱使天数' ,
labelWidth : 120 ,
name : 'DESTPORT_FREE_DAYS'
} , {
fieldLabel : '目的港超期天数' ,
labelWidth : 120 ,
readOnly : true ,
name : 'DESTPORT_OVER_DAYS'
} , {
fieldLabel : '目的港箱使费/天' ,
labelWidth : 120 ,
name : 'DESTPORT_OVER_DAYS_FEE'
} , {
fieldLabel : '目的港箱使费' ,
labelWidth : 120 ,
readOnly : true ,
name : 'DESTPORT_OVER_DAYS_AMT'
} , { xtype : 'hiddenfield' }
]
} ,
{
xtype : 'container' ,
layout : 'hbox' ,
defaultType : 'textfield' ,
items : [ {
fieldLabel : '备注' ,
labelWidth : 120 ,
name : 'REMARK'
}
]
}
]
}
]
} ) ;
//#endregion
//公共按钮Toolbar:panelBtn
this . panelBtn = new Ext . Panel ( {
region : "north" ,
tbar : [
{
// id: "saveandclose",
text : "保存" ,
iconCls : "btnsave" ,
handler : function ( button , event ) {
this . Save ( '0' ) ;
} ,
scope : this
} , {
// id: "saveandclose",
text : "保存并关闭" ,
handler : function ( button , event ) {
this . Save ( '1' ) ;
} ,
scope : this
} , {
id : 'btnESaveAndNew' ,
text : "保存并新建" ,
handler : function ( button , event ) {
this . Save ( '2' ) ;
}
} , {
id : 'btnECopyAndNew' ,
text : "复制新建" ,
handler : function ( button , event ) {
var basicForm = this . formEdit . getForm ( ) ;
this . opStatus = 'add' ;
basicForm . findField ( 'GID' ) . setDisabled ( false ) ;
var field = basicForm . findField ( 'GID' ) ;
var oldbsno = field . getValue ( ) ;
this . LoadCopyData ( oldbsno , false ) ; }
} , '-' ,
{
// id: "saveandclose",
text : "关闭" ,
handler : function ( button , event ) {
window . close ( ) ;
} ,
scope : this
}
]
} ) ; //end 按钮Toolbar
this . panelFee = new Shipping . FeeEditGrid ( {
region : 'center' ,
layout : 'border'
} ) ;
this . panelFee . stroplb = 'op_other' ;
this . panelFee . StoreCustType . add ( { "SCUSTTYPE" : "WTDW-委托单位" , "CUSTTYPE" : "委托单位" , "CUSTNAME" : "" } ) ;
this . panelFee . StoreCustType . add ( { "SCUSTTYPE" : "BGH-报关行" , "CUSTTYPE" : "报关行" , "CUSTNAME" : "" } ) ;
this . panelFee . StoreCustType . add ( { "SCUSTTYPE" : "HG-海关" , "CUSTTYPE" : "海关" , "CUSTNAME" : "" } ) ;
this . panelFee . StoreCustType . add ( { "SCUSTTYPE" : "DCDL-订舱代理" , "CUSTTYPE" : "订舱代理" , "CUSTNAME" : "" } ) ;
this . panelFee . StoreDrOpRange . load ( { params : { optype : "modOtherRecvFeeManagement" } } ) ;
this . panelFee . StoreCrOpRange . load ( { params : { optype : "modOtherPayFeeManagement" } } ) ;
this . panelFee . storeFeeNameRef . load ( { params : { condition : "" } } ) ;
this . panelFee . storeBodyList _GuDingFeeWeiHu . load ( ) ;
this . panelpage = new Ext . Panel ( {
// title: '订舱说明',
layout : "border" ,
region : 'center' ,
animate : true ,
autoScroll : true ,
// containerScroll: true,
frame : false ,
items : [ this . formEdit , this . panelFee ]
} ) ;
//#region//布局
parentWin = window . parent . opener ;
//if (parentWin) {
// var ret = parentWin.OprationSwap();
// this.OpStatus = ret[0]; //edit
// this.StoreList = ret[1];
// this.EditRecord = ret[2]; //SelectedRecord
// this.parentRecord = ret[3];
//}
Ext . apply ( this , {
items : [ this . panelBtn , this . panelpage ]
} ) ;
this . InitData ( ) ;
//#endregion
//集中绑定事件
} , //end initUIComponents
parentfunction : function ( button , event ) {
var ret1 = window . parent . opener . OprationSwap ( ) ;
ret1 [ 3 ] ( ) ;
} ,
getLinenum : function ( button , event ) {
var _L = 0 ;
for ( var i = 0 ; i < this . storeCtnrDyna . getCount ( ) ; i ++ ) {
var _t = parseInt ( this . storeCtnrDyna . getAt ( i ) . get ( "LINENUM" ) ) ;
if ( _t > _L ) { _L = _t ; }
}
_L ++ ;
return _L ;
} ,
InitData : function ( ) {
this . OpStatus = 'add' ;
var condition = '' ;
if ( parentWin ) {
var ret = parentWin . OprationSwap ( ) ;
this . OpStatus = ret [ 0 ] ; //edit
this . StoreList = ret [ 1 ] ;
this . EditRecord = ret [ 2 ] ; //SelectedRecord
this . parentRecord = ret [ 3 ] ;
}
if ( this . OpStatus == 'edit' )
condition = " GID='" + this . EditRecord . get ( 'GID' ) + "'" ;
this . LoadData ( this . OpStatus , condition ) ;
//this.LoadMustBe();
} , //end InitData
//载入数据
LoadData : function ( OpStatus , condition ) {
if ( COMPANYID == "" || DEPTGID == "" ) {
alert ( "登录信息不全,请退出重新登录" ) ;
return ;
}
this . OpStatus = OpStatus ;
Ext . Ajax . request ( {
waitMsg : '正在查询主表数据...' ,
url : '/MvcContainer/MsOpCtnr/GetDyna' ,
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 ;
}
var data = result . data ;
this . formEdit . getForm ( ) . reset ( ) ;
this . formEdit . getForm ( ) . setValues ( data ) ;
this . panelFee . EditRecord = this . EditRecord ;
this . panelFee . strBSNO = data . GID ;
if ( this . OpStatus == 'edit' ) {
this . panelFee . StoreDateCurr . load ( { params : { optype : "op_other" , bsno : this . panelFee . strBSNO } } ) ;
this . panelFee . storeDrChFee . load ( { params : { billno : this . panelFee . strBSNO , type : 1 , optype : "op_other" , condition : "((BSNO = '" + data . GID + "' OR WMSOUTBSNO='" + data . GID + "') and feetype=1) " } } ) ;
this . panelFee . storeCrChFee . load ( { params : { billno : this . panelFee . strBSNO , type : 2 , optype : "op_other" , condition : "((BSNO = '" + data . GID + "' OR WMSOUTBSNO='" + data . GID + "') and feetype=2)" } } ) ;
this . panelFee . storeBodySum . load ( {
params : { bsno : this . panelFee . strBSNO , optype : "op_other" } ,
callback : function ( r , options , success ) {
if ( success ) {
_this . panelFee . setTotalHead ( ) ;
}
}
} ) ;
this . panelFee . storeChFeeGain . load ( { params : { bsno : this . panelFee . strBSNO , optype : "op_other" } } ) ;
} else {
this . panelFee . storeDrChFee . removeAll ( ) ;
this . panelFee . storeCrChFee . removeAll ( ) ;
}
} else {
Ext . MessageBox . alert ( '请求出现错误,请重试' , response . responseText ) ;
}
} ,
scope : this
} ) ;
} , // end LoadDate
Save : function ( type ) {
var basicForm = this . formEdit . getForm ( ) ;
var CTNGID = basicForm . findField ( 'CTNGID' ) . value ;
if ( ! basicForm . isValid ( ) ) {
return ;
}
var data = this . formEdit . getForm ( ) . getValues ( ) ;
if ( COMPANYID == "" || DEPTGID == "" ) {
Ext . MessageBox . alert ( "提示" , "登录信息不全,请退出重新登录" ) ;
return ;
}
var _this = this ;
Ext . Msg . wait ( '正在更新动态数据, 请稍侯..' ) ;
Ext . Ajax . request ( {
waitMsg : '正在更新动态数据...' ,
url : '/MvcContainer/MsOpCtnr/SaveDyna' ,
scope : this ,
async : false ,
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 . Editdata = returnData ;
var basicForm = this . formEdit . getForm ( ) ;
basicForm . setValues ( returnData ) ;
if ( this . OpStatus == 'add' ) {
var arrNewRecords = this . StoreList . add ( returnData ) ;
this . EditRecord = arrNewRecords [ 0 ] ;
}
else if ( this . OpStatus == 'edit' ) {
var editp = Ext . create ( 'CtnrDyDetail' , 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 . panelFee . EditRecord = this . EditRecord ;
this . panelFee . strBSNO = returnData . GID ;
this . panelFee . storeDrChFee . load ( { params : { billno : this . panelFee . strBSNO , type : 1 , optype : "op_other" , condition : "((BSNO = '" + returnData . GID + "' OR WMSOUTBSNO='" + returnData . GID + "') and feetype=1) " } } ) ;
this . panelFee . storeCrChFee . load ( { params : { billno : this . panelFee . strBSNO , type : 2 , optype : "op_other" , condition : "((BSNO = '" + returnData . GID + "' OR WMSOUTBSNO='" + returnData . GID + "') and feetype=2)" } } ) ;
this . panelFee . storeBodySum . load ( {
params : { bsno : this . panelFee . strBSNO , optype : "op_other" } ,
callback : function ( r , options , success ) {
if ( success ) {
_this . panelFee . setTotalHead ( ) ;
}
}
} ) ;
this . panelFee . storeChFeeGain . load ( { params : { bsno : this . panelFee . strBSNO , optype : "op_other" } } ) ;
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
} ) ;
}
//alert('03');
}
} ) ;
} ,
//end save
LoadCopyData : function ( bsno , CopyFee ) {
Ext . Ajax . request ( {
waitMsg : '正在查询主表数据...' ,
url : '/MvcContainer/MsOpCtnr/GetCopyDynaData' ,
params : {
condition : "GID='" + bsno + "'" ,
copyfee : CopyFee
} ,
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 ;
var basicForm = this . formEdit . getForm ( ) ;
basicForm . setValues ( data ) ;
this . opStatus = 'add' ;
var arrNewRecords = this . storePLList . add ( data ) ;
this . EditRecord = arrNewRecords [ 0 ] ;
this . Editdata = data ;
//this.GetEditStatus();
this . LoadPeriod ( this . opStatus ) ;
this . panelFee . EditRecord = this . EditRecord ;
this . panelFee . strBSNO = this . EditRecord . get ( 'GID' ) ;
this . panelFee . StoreDateCurr . load ( { params : { optype : "op_other" , bsno : this . panelFee . strBSNO } } ) ;
this . panelFee . storeDrChFee . load ( { params : { billno : this . panelFee . strBSNO , type : 1 , optype : "op_other" , condition : "((BSNO = '" + this . panelFee . strBSNO + "' OR WMSOUTBSNO='" + this . panelFee . strBSNO + "') and feetype=1) " } } ) ;
this . panelFee . storeCrChFee . load ( { params : { billno : this . panelFee . strBSNO , type : 2 , optype : "op_other" , condition : "((BSNO = '" + this . panelFee . strBSNO + "' OR WMSOUTBSNO='" + this . panelFee . strBSNO + "') and feetype=2)" } } ) ;
this . panelFee . storeBodySum . load ( {
params : { bsno : data . GID , optype : "op_other" } ,
callback : function ( r , options , success ) {
if ( success ) {
_thisfee . setTotalHead ( ) ;
}
}
} ) ;
this . panelFee . storeChFeeGain . load ( { params : { bsno : data . GID , optype : "op_other" } } ) ;
} else {
Ext . MessageBox . alert ( '请求出现错误,请重试' , response . responseText ) ;
}
} ,
scope : this
} ) ;
} ,
LoadPeriod : function ( opstatus ) {
Ext . Ajax . request ( {
waitMsg : '正在查询主表数据...' ,
url : '/Account/ChMonthClose/GetNowPeriod' ,
params : {
condition : ''
} ,
callback : function ( options , success , response ) {
if ( success ) {
var result = Ext . JSON . decode ( response . responseText ) ;
if ( ! result . Success ) {
return ;
}
data = result . data ;
this . MsPeriod = data ;
this . LoadPeriodStatus ( opstatus ) ;
} else {
Ext . MessageBox . alert ( '请求出现错误,请重试' , response . responseText ) ;
}
} ,
scope : this
} ) ;
} ,
LoadPeriodStatus : function ( opstatus ) {
var ACCDATE = this . formEdit . getForm ( ) . findField ( 'ACCDATE' ) . getValue ( ) ;
var oDate1 = new Date ( ACCDATE + '-01' ) ;
var oDate2 = new Date ( this . MsPeriod . PERIOD + '-01' ) ;
if ( oDate1 . getTime ( ) >= oDate2 . getTime ( ) ) {
this . formEdit . getForm ( ) . findField ( 'ACCDATE' ) . setMinValue ( this . MsPeriod . PERIOD ) ;
this . formEdit . getForm ( ) . findField ( 'ACCDATE' ) . setReadOnly ( false ) ;
} else {
if ( opstatus == 'add' || opstatus == 'copyadd' ) {
this . formEdit . getForm ( ) . findField ( 'ACCDATE' ) . setMinValue ( this . MsPeriod . PERIOD ) ;
this . formEdit . getForm ( ) . findField ( 'ACCDATE' ) . setValue ( this . MsPeriod . PERIOD ) ;
this . formEdit . getForm ( ) . findField ( 'ACCDATE' ) . setReadOnly ( false ) ;
}
else {
this . formEdit . getForm ( ) . findField ( 'ACCDATE' ) . setMinValue ( '' ) ;
this . formEdit . getForm ( ) . findField ( 'ACCDATE' ) . setReadOnly ( true ) ;
}
}
} ,
getLinenum : function ( button , event ) {
var _L = 0 ;
for ( var i = 0 ; i < this . storeWMSIN . getCount ( ) ; i ++ ) {
var _t = parseInt ( this . storeWMSIN . getAt ( i ) . get ( "LINENUM" ) ) ;
if ( _t > _L ) { _L = _t ; }
}
_L ++ ;
return _L ;
} ,
//#endregion
} ) ;