dojo.provide("parus.designerTableModelTotalDialog");dojo.require("dijit.Dialog");dojo.require("dijit.form.Button");dojo.require("dijit.form.ValidationTextBox");dojo.require("dijit.form.SimpleTextarea");dojo.require("dijit.form.RadioButton");dojo.require("parus.parus8");dojo.require("parus.dialog");dojo.require("parus.dictEdit");dojo.require("parus.controlActions");dojo.require("parus.editableDictionaryDialog");dojo.require("parus.editDictionaryDialog");dojo.require("parus.designerTableModelIndexDialog");dojo.require("parus.designerTableModelIndexesDictionaryDialog");dojo.declare("parus.designerTableModelTotalDialog",[parus.editDictionaryDialog],{priority:null,index:null,formula:null,onLoadParams:function(c,b,a){this.inherited(arguments);if(!this.prn){this.prn=this.getParentDialogCondition("PRN")}if(c&&b){this.intermediateKindRadio.attr("checked",c.getValue(b,"KIND")=="0");this.totalKindRadio.attr("checked",c.getValue(b,"KIND")=="1");this.priorityEdit.attr("value",c.getValue(b,"PRIORITY"));this.indexEdit.attr("value",c.getValue(b,"BALANCEINDEX"));this.formulaEdit.attr("value",c.getValue(b,"FORMULA"));this.underDataRadio.attr("checked",c.getValue(b,"LOCATION")=="0");this.overDataRadio.attr("checked",c.getValue(b,"LOCATION")=="1");if(this.editMode){this.priority=c.getValue(b,"PRIORITY");this.index=this.indexEdit.attr("value");this.formula=this.formulaEdit.attr("value")}}this.kindChanged(this.totalKindRadio.attr("checked"))},kindChanged:function(b){if(b){this.index=this.indexEdit.attr("value");this.formula=this.formulaEdit.attr("value")}parus.controlActions.setDisabled(this.indexEdit,b);parus.controlActions.setDisabled(this.formulaEdit,b);if(b){this.priorityEdit.attr("value",0)}if(!b){this.indexEdit.attr("value",this.index);this.formulaEdit.attr("value",this.formula);var a=this.priority;if(!this.editMode||a==0){a=this.executeGetNextPriority()}this.priorityEdit.attr("value",a)}},getIndexCondition:function(){return{PRN:this.prn}},getExecParams:function(){return{KIND:this.totalKindRadio.attr("checked")?"1":"0",BALANCEINDEX:this.indexEdit.attr("value"),PRIORITY:this.priorityEdit.attr("value"),FORMULA:this.formulaEdit.attr("value"),LOCATION:this.underDataRadio.attr("checked")?"0":"1"}},executeInsert:function(b){var a=parus.database.execute("designer.BalanceTableModels.Totals.Insert",dojo.mixin(this.getExecParams(),{PRN:this.prn}));if(a){return parus.parus8.nodeField(parus.parus8.rowNodes(a)[0],"NRN")}},executeUpdate:function(){var a=parus.database.execute("designer.BalanceTableModels.Totals.Update",dojo.mixin(this.getExecParams(),{RN:this.rn}));return !!a},executeDelete:function(a,c){var b=parus.database.execute("designer.BalanceTableModels.Totals.Delete",{RN:a.getValue(c,"RN")});return !!b},executeChangePriority:function(c,b,a){var d=parus.database.execute("designer.BalanceTableModels.Totals.ChangePriority",{RN:c.getValue(b,"RN"),DIRECT:a?"-1":"1"});return !!d},executeGetNextPriority:function(){var a=parus.database.execute("designer.BalanceTableModels.Totals.GetNextPriority",{PRN:this.prn});if(a){return parus.parus8.nodeField(parus.parus8.rowNodes(a)[0],"PRIORITY")}}});