dojo.provide("parus.balanceCheckReportDialog");dojo.require("dijit.Dialog");dojo.require("dijit.form.Button");dojo.require("dijit.form.RadioButton");dojo.require("parus.parus8");dojo.require("parus.dialog");dojo.require("parus.dictEdit");dojo.declare("parus.balanceCheckReportDialog",[parus.Dialog],{grid:null,kind:null,isSubReport:null,rn:null,formedRn:null,reportRn:null,checks:null,_lastValues:null,applyProgressLabel:"Проверка значений показателей...",onShow:function(){this._lastValues=parus.userdata.get(this.declaredClass)||{};this.checkResults.attr("checked",this._lastValues.checkResults);this.useAgnCheckLists.attr("checked",this._lastValues.useAgnCheckLists);this.showReportCheckBox.attr("checked",this._lastValues.showReportCheckBox);this.protocolChanged();this.showResultReportCheckBox.attr("checked",this._lastValues.showResultReportCheckBox);this.userSize=this._lastValues.userSize||null},onApply:function(){var k="checkReport";if(this.isSubReport){k="checkSubReport"}var j={RESULT:(this.checkResults.checked?"1":"0"),USE_AGNCHKLST:(this.useAgnCheckLists.checked?"1":"0"),CHECKS:this.checks};var i=this.showReportCheckBox.checked;var g=this.grid;var c=this.rn;var f=c[0];var e=this.kind;var d=this.isSubReport;var b=this.showResultReportCheckBox.checked;var a=this.checks;var h=true;parus.progressDialog.iterateOverArray(this.applyProgressLabel,c,function(l){dojo.mixin(j,{RN:l});if(h){if(!parus.database.execute(k,j)){h=false}}},function(){if(h){if(i){parus.balance.balanceShowCheckReportProtocol(g,e,d,b,c,a)}else{parus.parus8.notificationMessage("Проверка завершена.")}}if(g){parus.balance.refreshGrid(g,"RN",f)}});this._lastValues.checkResults=this.checkResults.attr("checked");this._lastValues.useAgnCheckLists=this.useAgnCheckLists.attr("checked");this._lastValues.showReportCheckBox=this.showReportCheckBox.attr("checked");this._lastValues.showResultReportCheckBox=this.showResultReportCheckBox.attr("checked");this._lastValues.userSize=this.userSize;parus.userdata.set(this.declaredClass,this._lastValues);return true},showProtocol:function(){parus.balance.balanceShowCheckReportProtocol(this.grid,this.kind,this.isSubReport,this.showResultReportCheckBox.checked,this.rn,this.checks)},selectCheckList:function(){var b;var a=parus.dictionaries.BalanceReportsChecks;dojo.mixin(a,{multiselect:true,dictionary:a,gridConditions:{REPORTS:this.reportRn.join(";"),BLREPFORMED:this.formedRn.join(";"),USE_AGNCHKLST:(this.useAgnCheckLists.checked?"1":"0"),onComplete:dojo.hitch(this,function(){setTimeout(function(){b.grid.selection.selectRange(0,b.grid.rowCount-1)},1)})},onApply:dojo.hitch(this,function(c){this.checks=c.getValue();return true})});b=new parus.dictionaryDialog(a);b.show()},protocolChanged:function(){if(this.showReportCheckBox.checked){this.showResultReportCheckBox.attr("disabled",false);this.showResultReportCheckBoxText.style.color="";dojo.removeClass(this.showResultReportCheckBoxText,"balanceReadOnlyHeader")}else{this.showResultReportCheckBox.attr("disabled",true);this.showResultReportCheckBox.attr("checked",false);dojo.addClass(this.showResultReportCheckBoxText,"balanceReadOnlyHeader")}}});