dojo.provide("parus.balancePrimaryReportFormingDialog");dojo.require("dijit.Dialog");dojo.require("dijit.form.Button");dojo.require("parus.parus8");dojo.require("parus.dialog");dojo.declare("parus.balancePrimaryReportFormingDialog",[parus.Dialog],{_agentCodeLoaded:false,_agentNameLoaded:false,formCode:null,agentsChanged:function(a){if(a){if(a.disabled){return}}if((this.agentCodeEdit.value=="")&&(this.agentNameEdit.value=="")){this.agentCodeEdit.attr("disabled",false);this.agentNameEdit.attr("disabled",false)}else{if((this.agentCodeEdit.value!="")&&(a.dojoAttachPoint=="agentCodeEdit")){if(this._agentCodeLoaded){this._agentCodeLoaded=false}else{this.agentNameEdit.attr("disabled",true);this.agentNameEdit.attr("value",null)}}else{if((this.agentNameEdit.value!="")&&(a.dojoAttachPoint=="agentNameEdit")){if(this._agentNameLoaded){this._agentNameLoaded=false}else{this.agentCodeEdit.attr("disabled",true);this.agentCodeEdit.attr("value",null)}}}}setTimeout(dojo.hitch(this,function(){var b=parus.parus8.rowNodes(parus.database.execute("getAgentInfo",{AGENT_CODE:this.agentCodeEdit.disabled?"":this.agentCodeEdit.value,AGENT_NAME:this.agentNameEdit.disabled?"":this.agentNameEdit.value}))[0];if(this.agentCodeEdit.disabled){this.agentCodeEdit.attr("value",parus.parus8.nodeField(b,"RAGNABBR"))}if(this.agentNameEdit.disabled){this.agentNameEdit.attr("value",parus.parus8.nodeField(b,"RAGNNAME"))}if(this.agentHeadEdit.disabled){this.agentHeadEdit.attr("value",parus.parus8.nodeField(b,"RHEAD"))}if((this.agentCodeEdit.value=="")&&(this.agentNameEdit.value=="")){this.agentCodeEdit.attr("disabled",false);this.agentNameEdit.attr("disabled",false)}}),100)},getDatesCondition:function(){return{FORM_CODE:this.formCode||parus.parus8.CLASS_EmptyData}},onShow:function(){this.restoreFormLastValues()},onClose:function(){this.saveFormLastValues()},saveFormLastValues:function(){this._lastValues.userSize=this.userSize;this._lastValues.catalogInput=this.catalogInput.attr("value");parus.userdata.set(this.declaredClass,this._lastValues)},restoreFormLastValues:function(){this._lastValues=parus.userdata.get(this.declaredClass)||{};this.userSize=this._lastValues.userSize||null;this.catalogInput.attr("value",this._lastValues.catalogInput)}});