// budgetierung
// 
// budgetierung
// 
// history:
// R 574: alles beim alten, Gruppierung, etc

var budgetierung =  new fClass({
	
	
	// =============
	// = Variablen =
	// =============
	
	view: 			null,
	container: 		null,
	comboStores: 	null,
	gridComponents: null,
	grid: 			null,
	state: 			new Object(),
	stateRaw: 		new Object(),
	
	
	// ======================
	// = private Funktionen =
	// ======================
	
	
	buildView:function(){		

		this.tbar = new Ext.FormPanel({
			border:false,
			head:false,
			id:'maskeBudgetierung',
			bodyStyle:'padding:4px',
			items:{
	            layout:'column',
				border:false,
				defaults:{
					border:false
				},
	            items:[{
	                columnWidth:.4,
	                layout: 'form',
					
	                items: [
					
					{
	                    xtype:'combo',
	                    fieldLabel: 'Kostenebene',
						store:rcm.Application.multiStores['bcm_kostenebenen_name'],
						triggerAction:'all',
						mode:'local',						
						editable:false,
						valueField:'id',
						displayField:'name',
	                    name: 'kostenebene',
	                    anchor:'95%',
						allowBlank:false,
						id:'kostenebene',
						validator:function(value){

							var ebenenIndex = rcm.Application.multiStores['bcm_kostenebenen_name'].find('name',value);
							if(ebenenIndex +1 == rcm.Application.multiStores['bcm_kostenebenen_name'].getCount() && Ext.getCmp('showChilds').getValue()){
								return "Hier gibt es keine Kindeinträge.";
							}else{
								return true;
							}
								
						},
						value:rcm.Application.getIdOfFirstItemInMultiStore(rcm.Application.multiStores['bcm_kostenebenen_name'])
	                },

					{
						xtype:'checkbox',
						hideLabel:true,
						boxLabel:'darunter liegende Kostenebenen anzeigen',
						// disabled:true,
						id:'showChilds',
						hidden:true,
						hideLabel:true
						
					},
	
					{
						xtype:'checkbox',
						hideLabel:true,
						boxLabel:'Kommentare anzeigen',
						id:'kommentareAnzeigen'
					}					
					]
	            },{
	                columnWidth:.3,
	                layout: 'form',
	                items: [
					{
		                xtype:'monthfield',
		                fieldLabel: 'Stichmonat',
					
		
				        format: 'm.Y',
						width:120,
		
						// format:'m.Y',
						
						allowBlank:false,
						id:'stichtag',
						value:function(){
							
							var heute = new Date();
							
							var heute_jahr = heute.getFullYear();
							var heute_monat = heute.getMonth();
							
							heute_monat = heute_monat -1;
							if(heute_monat == 0){
								heute_monat = 12;
								heute_jahr = heute_jahr -1;
							}
							
							return new Date(heute_jahr,heute_monat,15);
						}()
					},
					{
						xtype:'checkbox',
						hideLabel:true,
						boxLabel:'Berücksichtigung des Budgets für Berechnung der Hochrechnung',
						id:'considerBudget',
						listeners:{
							'check':{
									fn:function(field, value){
										// spalten verstecken oder zeigen

										if(rcm.Application.budgetierung.grid != null){
											var colModel = rcm.Application.budgetierung.grid.getColumnModel();
											// index suchen

											colModel.setHidden(colModel.getIndexById('col_hochrechnung'),value);
											colModel.setHidden(colModel.getIndexById('col_pc_budget'),value);

											colModel.setHidden(colModel.getIndexById('col_hochrechnung_wb'),!value);
											colModel.setHidden(colModel.getIndexById('col_pc_budget_wb'),!value);
											

										}

										
										
										// console.log('field',field);
										// console.log('value',value);
									},
									scope:this
									}
						},
						
						checked:true
						

					}]
	            },
				{
	                columnWidth:.3,
	                layout: 'form',
					labelWidth:150,
					items: new Ext.form.CheckboxGroup({
						columns:1,
						id:'werte_rg',
						fieldLabel:'anzeigen',
						hideLabel:true,
						items:[
						{
							xtype:'checkbox',
							boxLabel: 'Kostenhistorie',
							value:'absolut',
		                    name: 'werte',
		                    anchor:'95%',
							hideLabel:true,
							id:'showKostenhistorie',
							ctCls:'farbe1',
							checked: false
		                },	
						{
							xtype:'checkbox',
							boxLabel: 'aktuelle Planung',
							value:'absolut',
							checked: true,
		                    name: 'werte',
		                    anchor:'95%',
							hideLabel:true,
							id:'showAktuellePlanung',
							ctCls:'farbe2'

		                },	
						{
							xtype:'checkbox',
							boxLabel: 'mittelfristige Planung',
							value:'absolut',
		                    name: 'werte',
		                    anchor:'95%',
							checked: false,
							hideLabel:true,
							id:'showMittelfristigePlanung',
							ctCls:'farbe3'
		                }

	]
					})
	                
	            }]
	        },
			buttonAlign:'left',
			buttons:[
			{
				text:'Start',
				iconCls:'startIcon',
				scope:this,
				handler:function(){
						if(this.tbar.getForm().isValid()){
							this.buildTable();		
						}
							
				}
			}
			]
			
			
			
		});
		

		
		
		this.view = new Ext.Panel({
			title:'Budgetierung ('+rcm.Application.state.kostenstruktur.name+')',
			iconCls:'winBudgetierung',
			layout:'border',
			border:false,
			items:[{
				region:'north',
				items:this.tbar,
				height:120,
				layout:'fit'
			},
			{
				region:'center',
				layout:'fit',
				id:'auswertungContent'
				
			}]
			
			
		});
		
		

		

	},

	buildGrafikChooseWindowYear:function(jahr){
				
		this.radioGroupType = new Ext.form.RadioGroup({
			fieldLabel: 'Diagramm Typ',
            itemCls: 'x-check-group-alt',
			id:'radioType',
            // Put all controls in a single column with width 100%
            columns: 1,
            items: [
                {boxLabel: 'Kuchen', name: 'type', value:'pie', checked:true},
                {boxLabel: 'Balken', id:'cb_type', name: 'type', value:'bar'}
            ]

		});
		
		this.radioGroupWerte = new Ext.form.RadioGroup({
			fieldLabel: 'Werte',
            itemCls: 'x-check-group-alt',
			id:'radioWerte',
            // Put all controls in a single column with width 100%
            columns: 1,
            items: [
                {boxLabel: 'absolut', id:'cb_wert', name: 'werte', value:'absolute', checked:true},
                {boxLabel: 'prozentual', name: 'werte', value:'relative'}
            ]

		});
	
	
		this.grafikChoosePanel = new Ext.FormPanel({
			head:false,
			items:[this.radioGroupType, this.radioGroupWerte],
			bodyStyle:'padding:10px'
		});
	
	
	
		this.grafikChooseWindow = new Ext.Window({
			title:'Optionen für Grafik Ausgabe',
			width:230,
			height:230,
			modal:true,
			layout:'fit',
			items:this.grafikChoosePanel,
			buttons:[{
				text:'Grafik erstellen',
				scope:this,
				handler:function(){
					var wert = false;
					var typ = false;
					
					if(Ext.getCmp('cb_wert').getValue()){
						wert = 'absolute';
					}else{
						wert = 'relative';
					}
					
					if(Ext.getCmp('cb_type').getValue()){
						typ = 'bar';
					}else{
						typ = 'pie';
					}
					

					
					var url = cfg_backend_url + "jahreskostenauswertung/getKostenverteilungGraphHtmlView/"+this.state.institut + '/' + this.state.kostenebene + '/' + jahr + "/" + typ + "/" + wert;
					
					
					this.ausgabeWindow = new Ext.Window({
						width:800,
						height:600,
						autoLoad:url,
						modal:true,
						title:'Kostenverteilung '+this.stateRaw.institut + ' ' + this.stateRaw.kostenebene + ' ' + jahr,
						tools:[
						{
							id:'print',
							handler:function(){
								rcm.Application.print(cfg_backend_url + "frontend/printGrafik");
							}
						},{
							id:'save',
							handler:function(){
								rcm.Application.print(cfg_backend_url + "frontend/saveGrafik",true);
							}
						}]
					});
					this.ausgabeWindow.show();
					this.ausgabeWindow.center();
					this.grafikChooseWindow.destroy();
					
					
				}
				
				
			}]
			
		});
		
		this.grafikChooseWindow.show();
		
	},
	
	
	buildTable:function(daten){
		Ext.QuickTips.init();
		//request verarbeiten
		
		this.justBuilt = true;


		
		// eigenschaften sammeln
		this.requestOptions = new Object();
		this.requestOptions.kostenebene = Ext.getCmp('kostenebene').getValue();
		this.requestOptions.entry_level = Ext.getCmp('kostenebene').getValue();
		this.requestOptions.kostenebeneRaw = Ext.getCmp('kostenebene').getRawValue();
		
		this.requestOptions.kommentareAnzeigen = Ext.getCmp('kommentareAnzeigen').getValue();
		this.requestOptions.showChilds = Ext.getCmp('showChilds').getValue();
		this.requestOptions.considerBudget = Ext.getCmp('considerBudget').getValue();
		
		
		this.requestOptions.stichtag = Ext.getCmp('stichtag').getValue();	
		
		
		//anzeigen
		this.requestOptions.showKostenhistorie = Ext.getCmp('showKostenhistorie').getValue();
		this.requestOptions.showMittelfristigePlanung = Ext.getCmp('showMittelfristigePlanung').getValue();
		this.requestOptions.showAktuellePlanung = Ext.getCmp('showAktuellePlanung').getValue();
		



		this.gridComponents = new Object();
		this.gridComponents.store = false; //der Datastore
		this.gridComponents.columnModel = false;
		this.gridComponents.proxy = false;
		this.gridComponents.reader = false;
		
		// spalten
		this.gridComponents.readerFields = new Array();

		

		this.gridComponents.readerFields.push({name:'kostenebene'});
		this.gridComponents.readerFields.push({name:'_parent'});
		this.gridComponents.readerFields.push({name:'_is_leaf'});
		this.gridComponents.readerFields.push({name:'id'});
		
		
		var fullYear = this.requestOptions.stichtag.getFullYear();

		
		if(this.requestOptions.showKostenhistorie){
			
			this.gridComponents.readerFields.push({name:'saldo_'+(fullYear-3)});
			this.gridComponents.readerFields.push({name:'saldo_'+(fullYear-2)});
			this.gridComponents.readerFields.push({name:'saldo_'+(fullYear-1)});
			
		}
		
		
		if(this.requestOptions.showAktuellePlanung){
			
			this.gridComponents.readerFields.push({name:'ap_budget'});
			this.gridComponents.readerFields.push({name:'ap_saldo_stichtag'});
			this.gridComponents.readerFields.push({name:'ap_saldo_pc_vorjahr'});
			
			// ohne budget
			this.gridComponents.readerFields.push({name:'ap_hochrechnung'});
			this.gridComponents.readerFields.push({name:'ap_saldo_pc_stichjahr'});
			
			// mit budget
			this.gridComponents.readerFields.push({name:'ap_hochrechnung_wb'});
			this.gridComponents.readerFields.push({name:'ap_saldo_pc_stichjahr_wb'});
			
		}
		
		if(this.requestOptions.showMittelfristigePlanung){
			this.gridComponents.readerFields.push({name:'mp_'+(fullYear+1)});
			this.gridComponents.readerFields.push({name:'mp_'+(fullYear+2)});
			this.gridComponents.readerFields.push({name:'mp_'+(fullYear+3)});
			this.gridComponents.readerFields.push({name:'mp_'+(fullYear+4)});
			this.gridComponents.readerFields.push({name:'mp_'+(fullYear+5)});
		}
		
		
		// Grouping
		if(this.requestOptions.showChilds){
			this.gridComponents.readerFields.push({name:'groupingColumn'});
		}
		
		
		// array mit ids der spalten historische werte, mittelfristige planung
		var columnsToHideIDs = ['col_kh_saldo_0', 'col_kh_saldo_1', 'col_kh_saldo_2', 'col_mp_0', 'col_mp_1', 'col_mp_2', 'col_mp_3', 'col_mp_4'];
		
		var summenRenderer = function(value, metadata, record, rowIndex, colIndex, store){
			if(record.data.kostenebene == "Summe"){
				metadata.attr = "style='font-weight:bold'";
				
				// SpaltenID holen
				var colId = rcm.Application.budgetierung.grid.getColumnModel().getColumnId(colIndex);
				
				// überprüfen ob spaltenid in columnsToHideIDs enthalten ist
				if(columnsToHideIDs.indexOf(colId)!=-1){
					// es handelt sich darum - und nur, wenn auf start gedrückt wurde
					if(value == 0 && rcm.Application.budgetierung.justBuilt){
						rcm.Application.budgetierung.grid.getColumnModel().setHidden(colIndex, true);
						

					}

				}
				

			}
			
			// console.log(rcm.Application.budgetierung.gridComponents.modelFields.length);
			// 
			// // ist es die letzte zu beachtenden spalte? dann justBuilt = false
			// if(colIndex == rcm.Application.budgetierung.gridComponents.modelFields.length-1){
			// 
			// 	justBuilt = false;
			// 	console.log('colIndex',colIndex);
			// 	console.log('letzte Spalte');
			// }else{
			// 	console.log('colIndex',colIndex);
			// }
			

			
			if(value != null){
				if(value.indexOf('r3hidden')!=-1){
					metadata.css='hasComment';
					
					var startSnip = value.indexOf('<div class="r3hidden">');
					var stopSnip = value.indexOf('</div>');
					var comment = value.substring(startSnip + 22, stopSnip);					
					metadata.attr = 'ext:qtip="' + comment + '"';
					
				}
				
			}
			
			return value;
		};
		
		
		// col model erstellen
		this.gridComponents.modelFields = new Array();
		
		
		
		this.gridComponents.modelFields.push({renderer:summenRenderer, header:'Kostenebenen', width:275, sortable:false, dataIndex:'kostenebene',id:'kostenebene'});


		
		
		if(this.requestOptions.showKostenhistorie){
			
			this.gridComponents.modelFields.push({renderer:summenRenderer, id:'col_kh_saldo_0', css:'background-color:#FFD48E !important; text-align:right !important;', header:'Saldo '+(fullYear-3),width:100, sortable:false, dataIndex:'saldo_'+(fullYear-3)});
			this.gridComponents.modelFields.push({renderer:summenRenderer, id:'col_kh_saldo_1',css:'background-color:#FFD48E !important; text-align:right !important;', header:'Saldo '+(fullYear-2),width:100, sortable:false, dataIndex:'saldo_'+(fullYear-2)});
			this.gridComponents.modelFields.push({renderer:summenRenderer, id:'col_kh_saldo_2',css:'background-color:#FFD48E !important; text-align:right !important;', header:'Saldo '+(fullYear-1),width:100, sortable:false, dataIndex:'saldo_'+(fullYear-1)});
			
		}
		
		
		if(this.requestOptions.showAktuellePlanung){
			
			this.gridComponents.modelFields.push({renderer:summenRenderer, css:'background-color:#F6FF68 !important; text-align:right !important;', sortable:false,width:120, header:'Budget '+fullYear, dataIndex:'ap_budget', renderer:function(value,metadata, record){
				if(value.indexOf('r3hidden')!=-1){
					metadata.css='hasComment';
					
					
					
					var startSnip = value.indexOf('<div class="r3hidden">');
					var stopSnip = value.indexOf('</div>');
					var comment = value.substring(startSnip + 22, stopSnip);					
					metadata.attr = 'ext:qtip="' + comment + '"';
					
					
				}
				if(record.data.kostenebene == "Summe"){
					metadata.attr = "style='font-weight:bold'";
				}
				return value;
			}});
			
			this.gridComponents.modelFields.push({renderer:summenRenderer, css:'background-color:#F6FF68 !important; text-align:right !important;', sortable:false,width:120, header:'Saldo per '+(this.requestOptions.stichtag.getMonth()+1)+'.'+fullYear, dataIndex:'ap_saldo_stichtag'});
			this.gridComponents.modelFields.push({renderer:summenRenderer, css:'background-color:#F6FF68 !important; text-align:right !important;', sortable:false,width:120, header:'% von Saldo '+(fullYear-1), dataIndex:'ap_saldo_pc_vorjahr'});
			
			// übeprüfen welche Zeile versteckt werden soll
			var showWithBudget = Ext.getCmp('considerBudget').getValue();
			
			// ohne Budget
			this.gridComponents.modelFields.push({hidden:showWithBudget, renderer:summenRenderer, css:'background-color:#F6FF68 !important; text-align:right !important;', sortable:false,width:120, header:'Hochrechnung '+fullYear, dataIndex:'ap_hochrechnung', id:'col_hochrechnung'});
			this.gridComponents.modelFields.push({hidden:showWithBudget, renderer:summenRenderer, css:'background-color:#F6FF68 !important; text-align:right !important;', sortable:false,width:120, header:'% vom Budget '+fullYear, dataIndex:'ap_saldo_pc_stichjahr',  id:'col_pc_budget'});
			
			// mit Budget
			this.gridComponents.modelFields.push({hidden:!showWithBudget, renderer:summenRenderer, css:'background-color:#F6FF68 !important; text-align:right !important;', sortable:false,width:120, header:'Hochrechnung '+fullYear, dataIndex:'ap_hochrechnung_wb', id:'col_hochrechnung_wb'});
			this.gridComponents.modelFields.push({hidden:!showWithBudget, renderer:summenRenderer, css:'background-color:#F6FF68 !important; text-align:right !important;', sortable:false,width:120, header:'% vom Budget '+fullYear, dataIndex:'ap_saldo_pc_stichjahr_wb', id:'col_pc_budget_wb'});
			
		}
		
		if(this.requestOptions.showMittelfristigePlanung){
			this.gridComponents.modelFields.push({renderer:summenRenderer, id:'col_mp_0', css:'background-color:#A2E9FF !important; text-align:right !important;',width:100, sortable:false, header:'Budget '+(fullYear+1), dataIndex:'mp_'+(fullYear+1)});
			this.gridComponents.modelFields.push({renderer:summenRenderer, id:'col_mp_1', css:'background-color:#A2E9FF !important; text-align:right !important;',width:100, sortable:false, header:'Budget '+(fullYear+2), dataIndex:'mp_'+(fullYear+2)});
			this.gridComponents.modelFields.push({renderer:summenRenderer, id:'col_mp_2', css:'background-color:#A2E9FF !important; text-align:right !important;',width:100, sortable:false, header:'Budget '+(fullYear+3), dataIndex:'mp_'+(fullYear+3)});
			this.gridComponents.modelFields.push({renderer:summenRenderer, id:'col_mp_3', css:'background-color:#A2E9FF !important; text-align:right !important;',width:100, sortable:false, header:'Budget '+(fullYear+4), dataIndex:'mp_'+(fullYear+4)});
			this.gridComponents.modelFields.push({renderer:summenRenderer, id:'col_mp_4', css:'background-color:#A2E9FF !important; text-align:right !important;',width:100, sortable:false, header:'Budget '+(fullYear+5), dataIndex:'mp_'+(fullYear+5)});
		}
		
		
		this.gridComponents.modelFields.push({hidden:true,dataIndex:'_is_leaf', header:'blatt'});
		this.gridComponents.modelFields.push({hidden:true,dataIndex:'_parent', header:'parent'});
		this.gridComponents.modelFields.push({hidden:true,dataIndex:'id', header:'ID'});	
		
		
		// proxy erstellen
		this.gridComponents.proxy = new Ext.data.HttpProxy({
			url:cfg_backend_url + 'budgetierung/json/getBudgetierungFrontend',
			method:'POST'
		});
		
		
		// reader erstellen
		this.gridComponents.reader = new Ext.data.JsonReader({
			root:'results',
			totalProperty:'total',
			id:'id',
			successProperty:'success'
		},this.gridComponents.readerFields);
		
		


			this.gridComponents.store =  new Ext.ux.maximgb.treegrid.AdjacencyListStore({

				remoteSort:true,
				proxy:this.gridComponents.proxy,
				reader:this.gridComponents.reader
			});

			
		// }
		
		this.gridComponents.store.on('beforeload',function(){
			Ext.MessageBox.wait('Daten werden geladen...',false,waitDialogConfig);
		});
		
		
		this.gridComponents.store.on('load',function(){
			Ext.MessageBox.hide();
			//kommentare
		    var view = this.grid.getView();
		    			var counter = this.gridComponents.modelFields.length;
		    						for (var i=0; i < counter; i++) {
		    		
		    							for (var j=0; j < this.gridComponents.store.getCount(); j++) {
		    								var cell = Ext.fly(view.getCell(j,i));
		    								
		    								if(cell.child('.r3hidden')){
			
			    								var cellDom = view.getCell(j,i);

			
			
		    									cell.dummyTip = new Ext.ToolTip({
		    								        target: cell ,
		    										autoWidth:true,
		    							        	html: 'Test'
		    									});
		    								    
		    									
		    								}	
		    								
		    								
		    							};
		    						};
		
			rcm.Application.budgetierung.grid.getView().refresh();
			this.justBuilt = false;

		},this);


		
		
		
		
		// this.gridComponents.columnModel = new Ext.grid.ColumnModel(this.gridComponents.modelFields);
		var printTool = {id:'print', scope:this, handler:function(){
			if(this.requestOptions!=null){
				
			var ro = this.requestOptions;

			ro.dir = false;
			ro.sort = false;

			var url = cfg_backend_url + "budgetierung/getBudgetierungFrontendPrintView/"+ro.kostenebene+ "/"+ro.showChilds+"/"+ro.stichtag.getTime()+"/"+ro.kommentareAnzeigen+"/"+Ext.getCmp('considerBudget').getValue()+"/"+ro.showKostenhistorie+"/"+ro.showAktuellePlanung+"/"+ro.showMittelfristigePlanung +"/"+ro.sort+ "/"+ro.dir;


			rcm.Application.print(url);
			}
		}};
		
		
		var saveTool = {id:'save', scope:this, handler:function(){
			if(this.requestOptions!=null){
				var ro = this.requestOptions;
				
				ro.dir = false;
				ro.sort = false;
				var url = cfg_backend_url + "budgetierung/getBudgetierungFrontendPrintView/"+ro.kostenebene+ "/"+ro.showChilds+"/"+ro.stichtag.getTime()+"/"+ro.kommentareAnzeigen+"/"+Ext.getCmp('considerBudget').getValue()+"/"+ro.showKostenhistorie+"/"+ro.showAktuellePlanung+"/"+ro.showMittelfristigePlanung +"/"+ro.sort+ "/"+ro.dir+"/true";

				window.location.href = url;

			}
		}};
			
		this.grid = new Ext.ux.maximgb.treegrid.GridPanel({
	      store: this.gridComponents.store,
	      master_column_id : 'kostenebene',
	      columns:this.gridComponents.modelFields,
	      stripeRows: true,
	      title: ' 	',
			viewConfig:{                       // damit das ding nach dem laden nicht nach oben springt
				  scrollToTop: Ext.emptyFn,
				  focusRow: Ext.emptyFn,
				  ensureVisible: Ext.emptyFn
			},
		
			

		  border:false,
	      root_title: 'Kostenebenen',
		  tools:[printTool,saveTool]
	    });
	
	
	
		this.gridComponents.store.on('expandnode',function(store, record){
			Ext.Ajax.request({
				method:'post',
				url:cfg_backend_url+'budgetierung/expandNode/'+record.data.id
			});
		});
		
		
		this.gridComponents.store.on('collapsenode',function(store, record){
			Ext.Ajax.request({
				method:'post',
				url:cfg_backend_url+'budgetierung/collapseNode/'+record.data.id
			});
		});
		    
			

		
		if(!Ext.isEmpty(Ext.getCmp('auswertungContent').items)){
			Ext.getCmp('auswertungContent').remove(Ext.getCmp('auswertungContent').getComponent(0));
		}
		
		Ext.getCmp('auswertungContent').add(this.grid);
		Ext.getCmp('auswertungContent').doLayout();
		
		
		
		var params = new Object();

		params['kostenebene'] = rcm.Application.budgetierung.requestOptions.kostenebene;
		params['zeige_kindelemente'] = rcm.Application.budgetierung.requestOptions.showChilds;
		params['stichtag'] = rcm.Application.budgetierung.requestOptions.stichtag.getTime();
		params['kommentare_anzeigen'] = rcm.Application.budgetierung.requestOptions.kommentareAnzeigen;
		params['hochrechnung_planwerte'] = rcm.Application.budgetierung.requestOptions.considerBudget;
		params['kostenhistorie'] = rcm.Application.budgetierung.requestOptions.showKostenhistorie;
		params['aktuelle_planung'] = rcm.Application.budgetierung.requestOptions.showAktuellePlanung;
		params['mittelfristige_planung'] = rcm.Application.budgetierung.requestOptions.showMittelfristigePlanung;
		params['entry_level'] = rcm.Application.budgetierung.requestOptions.entry_level;
		
		
		if(rcm.Application.budgetierung.gridComponents.store.lastOptions != null){
			
			if(rcm.Application.budgetierung.gridComponents.store.lastOptions.params.dir != null){
				params['dir'] = rcm.Application.budgetierung.gridComponents.store.lastOptions.params.dir;
			}

			if(rcm.Application.budgetierung.gridComponents.store.lastOptions.params.sort != null){
				params['sort'] = rcm.Application.budgetierung.gridComponents.store.lastOptions.params.sort;
			}


		}
		
		
		this.gridComponents.store.load({
					
					params:params
					}
					
				);
		

		
		
		
		
	},
	

	
	// ==========================
	// = öffentliche Funktionen =
	// ==========================
	
	
	init:function(){
		this.buildView();
		// this.buildGrafikChooseWindow();
		
		
		return this;
	}
	
	
	
});

