dojo.provide("parus.designerReportTableDialog");dojo.require("dijit.Dialog");dojo.require("dijit.form.Button");dojo.require("dijit.form.ValidationTextBox");dojo.require("dijit.form.SimpleTextarea");dojo.require("parus.parus8");dojo.require("parus.dialog");dojo.require("parus.dictEdit");dojo.require("parus.formats");dojo.require("parus.controlActions");dojo.require("parus.editableDictionaryDialog");dojo.require("parus.editDictionaryDialog");dojo.require("parus.designerTableModelsDictionaryDialog");dojo.declare("parus.designerReportTableDialog",[parus.editDictionaryDialog],{onLoadParams:function(c,b,a){this.inherited(arguments);if(!this.prn){this.prn=this.getParentDialogCondition("PRN")}if(c&&b){this.tableEdit.attr("value",c.getValue(b,"CODE"));this.nameEdit.attr("value",c.getValue(b,"NAME"));this.priorityEdit.attr("value",c.getValue(b,"PRIORITY"));this.signTotalsCheckBox.attr("checked",c.getValue(b,"SIGN_TOTALS")=="1");this.sourceToResultCheckBox.attr("checked",c.getValue(b,"SOURCE_TO_RESULT")=="1");this.sourceToUnionCheckBox.attr("checked",c.getValue(b,"SOURCE_TO_UNION")=="1");if(this.editMode){this.tableEdit.attr("disabled",true)}}this.tableEdit.onApplyDictionary=dojo.hitch(this,this.tableChanged)},tableChanged:function(a){if(a){this.nameEdit.attr("value",a.getFieldValue("NAME"))}else{if(!this.tableEdit.showingDictionary&&!this.tableEdit.attr("value")){this.nameEdit.attr("value","")}}},signTotalsChanged:function(){var a=this.signTotalsCheckBox.attr("checked");parus.controlActions.setDisabled(this.sourceToResultCheckBox,!a);parus.controlActions.setDisabled(this.sourceToUnionCheckBox,!a&&!this.sourceToResultCheckBox.attr("checked"))},sourceToResultChanged:function(){parus.controlActions.setDisabled(this.sourceToUnionCheckBox,!this.sourceToResultCheckBox.attr("checked"))},executeInsert:function(b){var a=parus.database.execute("designer.BalanceTables.Insert",{RN:b?this.rn:null,PRN:this.prn,TABLEMODELS:this.tableEdit.attr("value"),NAME:this.nameEdit.attr("value"),PRIORITY:this.priorityEdit.attr("value"),SIGN_TOTALS:this.signTotalsCheckBox.attr("checked")?"1":"0",SOURCE_TO_RESULT:this.sourceToResultCheckBox.attr("checked")?"1":"0",SOURCE_TO_UNION:this.sourceToUnionCheckBox.attr("checked")?"1":"0"});if(a){return parus.parus8.nodeField(parus.parus8.rowNodes(a)[0],"NRN")}},executeUpdate:function(){var a=parus.database.execute("designer.BalanceTables.Update",{RN:this.rn,TABLEMODELS:this.tableEdit.attr("value"),NAME:this.nameEdit.attr("value"),PRIORITY:this.priorityEdit.attr("value"),SIGN_TOTALS:this.signTotalsCheckBox.attr("checked")?"1":"0",SOURCE_TO_RESULT:this.sourceToResultCheckBox.attr("checked")?"1":"0",SOURCE_TO_UNION:this.sourceToUnionCheckBox.attr("checked")?"1":"0"});return !!a},executeDelete:function(a,c){var b=parus.database.execute("designer.BalanceTables.Delete",{RN:a.getValue(c,"RN")});return !!b}});