public function RCSavedButtonClicked($sender, $param)
 {
     $tempus = 'RCed' . $this->RCprimarykey;
     if ($this->RCedvariante_edit_status->Text == '1') {
         $RCEditRecord = VarianteRecord::finder()->findByPK($this->{$tempus}->Text);
     } else {
         $RCEditRecord = new VarianteRecord();
     }
     //HIDDEN
     foreach ($this->RChiddenfields as $recordfield) {
         $edrecordfield = 'RCed' . $recordfield;
         $RCEditRecord->{$recordfield} = $this->{$edrecordfield}->Value;
     }
     //DATUM
     foreach ($this->RCdatfields as $recordfield) {
         $edrecordfield = 'RCed' . $recordfield;
         $RCEditRecord->{$recordfield} = date('Y-m-d', $this->{$edrecordfield}->TimeStamp);
     }
     //BOOL
     foreach ($this->RCboolfields as $recordfield) {
         $edrecordfield = 'RCed' . $recordfield;
         $RCEditRecord->{$recordfield} = $this->{$edrecordfield}->Checked ? 1 : 0;
     }
     foreach ($this->RCfields as $recordfield) {
         $edrecordfield = 'RCed' . $recordfield;
         $RCEditRecord->{$recordfield} = $this->{$edrecordfield}->Text;
     }
     $RCEditRecord->save();
     $this->bindListVariantenValue();
 }
 public function buildPivotBerichtPullDown()
 {
     $this->PBedidta_feldfunktion->DataSource = PFH::build_SQLPullDownAdvanced(FeldfunktionRecord::finder(), "ta_feldfunktion", array("idta_feldfunktion", "idta_struktur_type", "ff_name"));
     $this->PBedidta_feldfunktion->dataBind();
     $this->PBedidta_variante->DataSource = PFH::build_SQLPullDown(VarianteRecord::finder(), "ta_variante", array("idta_variante", "var_descr"));
     $this->PBedidta_variante->dataBind();
     $data = array('SUM' => "SUM", "AVG" => "AVG", "MAX" => "MAX", "MIN" => "MIN");
     $this->PBedpivot_bericht_operator->DataSource = $data;
     $this->PBedpivot_bericht_operator->DataBind();
 }
 public function onLoad($param)
 {
     parent::onLoad($param);
     if (!$this->page->isPostBack && !$this->page->isCallback) {
         $this->bindListStammdatenValue();
         $this->RCedidta_stammdaten_group->DataSource = PFH::build_SQLPullDown(StammdatenGroupRecord::finder(), "ta_stammdaten_group", array("idta_stammdaten_group", "stammdaten_group_name"));
         $this->RCedidta_stammdaten_group->dataBind();
         $this->RCTedidta_variante->DataSource = PFH::build_SQLPullDown(VarianteRecord::finder(), "ta_variante", array("idta_variante", "var_descr"));
         $this->RCTedidta_variante->dataBind();
         $this->RCTedidta_periode->DataSource = PFH::build_SQLPullDown(PeriodenRecord::finder(), "ta_perioden", array("idta_perioden", "per_extern"));
         $this->RCTedidta_periode->dataBind();
     }
 }
 public function onLoad($param)
 {
     parent::onLoad($param);
     //if(!$this->isPostBack && !$this->isCallback){
     $this->DWH_idta_variante->DataSource = PFH::build_SQLPullDown(VarianteRecord::finder(), "ta_variante", array("idta_variante", "var_descr"));
     $this->DWH_idta_variante->dataBind();
     $this->DWH_idta_perioden->DataSource = PFH::build_SQLPullDown(PeriodenRecord::finder(), "ta_perioden", array("per_intern", "per_extern"));
     $this->DWH_idta_perioden->dataBind();
     $tree = $this->MyTree;
     //$this->addContextMenu($tree->getID());
     $node = new StrukturRecord();
     $this->fullInTreeStrukturRecord($tree, $node);
     //}
 }
 public function onLoad($param)
 {
     if (!$this->page->IsPostBack && !$this->page->isCallback) {
         $this->DWH_idta_variante->DataSource = PFH::build_SQLPullDown(VarianteRecord::finder(), "ta_variante", array("idta_variante", "var_descr"));
         $this->DWH_idta_variante->dataBind();
         $this->DWH_idta_stammdatensicht->DataSource = PFH::build_SQLPullDown(StammdatensichtRecord::finder(), "ta_stammdatensicht", array("idta_stammdatensicht", "sts_name"));
         $this->DWH_idta_stammdatensicht->dataBind();
         $this->DWH_idta_struktur_bericht->DataSource = PFH::build_SQLPullDownAdvanced(StrukturBerichtRecord::finder(), "ta_struktur_bericht", array("idta_struktur_bericht", "sb_order", "pivot_struktur_name"), '', 'sb_order');
         $this->DWH_idta_struktur_bericht->dataBind();
         //first we need to check the szenario, because we recieve the startperiod from the variante...
         if ($this->Request['idta_variante'] != "") {
             $this->DWH_idta_variante->Text = $this->Request['idta_variante'];
         } else {
             $this->DWH_idta_variante->Text = VarianteRecord::finder()->findByvar_default(1)->idta_variante;
             $this->DWH_idta_variante->Text == "" ? $this->DWH_idta_variante->Text = 1 : '';
         }
         if ($this->Request['idta_stammdatensicht'] != "") {
             $this->DWH_idta_stammdatensicht->Text = $this->Request['idta_stammdatensicht'];
         } else {
             $this->DWH_idta_stammdatensicht->Text == "" ? $this->DWH_idta_stammdatensicht->Text = 1 : '';
         }
         if ($this->Request['periode'] != "") {
             $this->DWH_idta_perioden->Text = $this->Request['periode'];
         } else {
             $sec_per = "10001";
             $this->DWH_idta_perioden->Text = VarianteRecord::finder()->findByidta_variante($this->DWH_idta_variante->Text)->idta_perioden;
             $this->DWH_idta_perioden->Text == '' ? $this->DWH_idta_perioden->Text = $sec_per : '';
         }
         $this->Request['per_single'] != "" ? $this->DWH_per_single->setChecked($this->Request['per_single']) : $this->DWH_per_single->setChecked(0);
         if ($this->Request['idta_struktur_bericht'] != '') {
             $this->DWH_idta_struktur_bericht->Text = $this->Request['idta_struktur_bericht'];
         } else {
             $this->DWH_idta_struktur_bericht->Text = StrukturBerichtRecord::finder()->findBysb_startbericht(1)->idta_struktur_bericht;
         }
         if ($this->checkPeriodeArea($this->DWH_idta_struktur_bericht->Text)) {
             $this->DWH_PERIODAREA->setVisible($this->checkPeriodeArea($this->DWH_idta_struktur_bericht->Text));
         } else {
             $this->DWH_PERIODAREA->setVisible($this->checkPeriodeArea($this->DWH_idta_struktur_bericht->Text));
             //$this->getPage()->getClientScript()->registerEndScript('XXX','dhxinTab.hideTab("tab2",true);');
         }
         $this->Request['idta_struktur_type'] != "" ? $this->Request['idta_struktur_type'] = 1 : '';
         if ($this->Request['idtm_struktur'] != '') {
             $this->DWH_idtm_struktur->Text = $this->Request['idtm_struktur'];
         } else {
             $this->DWH_idtm_struktur->Text = $this->user->getStartNode($this->user->getUserId($this->user->Name), "tm_struktur");
             $this->DWH_idtm_struktur->Text == '' ? $this->DWH_idtm_struktur->Text = 1 : '';
         }
     }
 }
 public function bindListBox()
 {
     $this->for_idta_feldfunktion->DataSource = PFH::build_SQLPullDownAdvanced(FeldfunktionRecord::finder(), "ta_feldfunktion", array("idta_feldfunktion", "ff_name", "idta_struktur_type"));
     $this->for_idta_feldfunktion->DataBind();
     $this->for_from_idta_periode->DataSource = PFH::build_SQLPullDown(PeriodenRecord::finder(), "ta_perioden", array("per_intern", "per_extern"));
     $this->for_from_idta_periode->dataBind();
     $this->for_to_idta_periode->DataSource = PFH::build_SQLPullDown(PeriodenRecord::finder(), "ta_perioden", array("per_intern", "per_extern"));
     $this->for_to_idta_periode->dataBind();
     $this->for_idta_variante->DataSource = PFH::build_SQLPullDown(VarianteRecord::finder(), "ta_variante", array("idta_variante", "var_descr"));
     $this->for_idta_variante->dataBind();
     //definition der wachstumstypen...
     // 1 = year to year
     $growthtypes = array(1 => 'year to year');
     $this->for_idta_fortschreibungs_type->DataSource = $growthtypes;
     $this->for_idta_fortschreibungs_type->dataBind();
 }
 public function buildStrukturBerichtSpaltenPullDown()
 {
     $this->SBSedidta_variante->DataSource = PFH::build_SQLPullDown(VarianteRecord::finder(), "ta_variante", array("idta_variante", "var_descr"));
     $this->SBSedidta_variante->DataBind();
     $sbs_struktur_switch_type = array(0 => "none", 1 => "fix", 2 => "variable");
     $this->SBSedsbs_struktur_switch_type->DataSource = $sbs_struktur_switch_type;
     $this->SBSedsbs_struktur_switch_type->dataBind();
     $sbs_bericht_operator = array("SUM" => "SUM", "AVG" => "AVG", "COUNT" => "COUNT", "MAX" => "MAX", "MIN" => "MIN", "MEDIAN" => "MEDIAN", "STDDEV" => "STDDEV");
     $this->SBSedsbs_bericht_operator->DataSource = $sbs_bericht_operator;
     $this->SBSedsbs_bericht_operator->dataBind();
 }
 public function initTable()
 {
     //this needs to be loaded before the period, because we need the variant_id for the startperiod
     if ($this->Request['idta_variante'] != '') {
         $this->Variante = $this->Request['idta_variante'];
     } else {
         $this->Variante = VarianteRecord::finder()->findByvar_default(1)->idta_variante;
         $this->Variante == "" ? $this->Variante = 1 : '';
     }
     if ($this->Request['periode'] != '') {
         $this->Periode = $this->Request['periode'];
     } else {
         $sec_per = $this->Periode;
         $this->Periode = VarianteRecord::finder()->findByidta_variante($this->Variante)->idta_perioden;
         $this->Periode == '' ? $this->Periode = $sec_per : '';
     }
     if ($this->Request['idtm_struktur'] != '') {
         $this->idtm_struktur = $this->Request['idtm_struktur'];
     } else {
         $this->idtm_struktur = $this->user->getStartNode($this->user->getUserId($this->user->Name), "tm_struktur");
         $this->idtm_struktur == '' ? $this->idtm_struktur = 1 : '';
     }
     if ($this->Request['per_single'] != '') {
         $this->SinglePeriode = $this->Request['per_single'];
     }
     if ($this->Request['idta_struktur_bericht'] != '') {
         $this->idta_struktur_bericht = $this->Request['idta_struktur_bericht'];
     } else {
         $this->idta_struktur_bericht = StrukturBerichtRecord::finder()->findBysb_startbericht(1)->idta_struktur_bericht;
     }
     $this->ccom_id->Text = $this->idtm_struktur;
     $this->cidta_variante->Text = $this->Variante;
     $this->cidta_periode->Text = $this->Periode;
     //setting up the db-connection
     $myDBConnection = new TDbConnection($this->Application->getModule('db1')->database->getConnectionString(), $this->Application->getModule('db1')->database->getUsername(), $this->Application->getModule('db1')->database->getPassword());
     $myDBConnection->Active = true;
     //this calculator is used to build the subcats
     $mySubcatsCalculator = new PFCalculator();
     $mySubcatsCalculator->setDBConnection($myDBConnection);
     $mySubcatsCalculator->setStartNode($this->idtm_struktur, 1);
     if (!$this->Nested) {
         $mySubcatsCalculator->load_all_cats();
         $mySubcatsCalculator->setsubcats($mySubcatsCalculator->getsubcats());
     }
     //THE REPORT HEADER
     $this->sheetrow++;
     $this->StrukturPfad->Text = $mySubcatsCalculator->getCurrentPath($this->idtm_struktur);
     //here we build the statements nthat a stored inside the database
     $Report = StrukturBerichtRecord::finder()->findByPK($this->idta_struktur_bericht);
     $this->ttpivot_struktur_name->Text = $Report->pivot_struktur_name;
     $ColumnCriteria = new TActiveRecordCriteria();
     $ColumnCriteria->Condition = "idta_struktur_bericht = :suchtextcolumn";
     $ColumnCriteria->Parameters[':suchtextcolumn'] = $this->idta_struktur_bericht;
     $ColumnCriteria->OrdersBy['sbs_order'] = 'ASC';
     $ReportColumns = StrukturBerichtSpaltenRecord::finder()->findAll($ColumnCriteria);
     $idta_struktur_bericht_spalten = array();
     foreach ($ReportColumns as $ReportColumn) {
         $this->GraphOffset++;
         $this->InputBericht = $ReportColumn->sbs_input;
         $this->StrukturBerichtSaveButton->Visible = $this->InputBericht;
         $this->StrukturBerichtSaveImageButton->Visible = $this->InputBericht;
         //wenn die Variante fix uebergeben wurde
         if ($ReportColumn->sbs_idta_variante_fix) {
             $this->Varianten[$ReportColumn->idta_struktur_bericht_spalten] = $ReportColumn->idta_variante;
         } else {
             $this->Varianten[$ReportColumn->idta_struktur_bericht_spalten] = $this->Variante;
         }
         //hier befuelle ich die variablenliste pro
         if ($ReportColumn->sbs_struktur_switch_type == 1) {
             $mySubcatsCalculator->setStartNode($ReportColumn->sbs_idtm_struktur, $this->Nested);
         } else {
             $mySubcatsCalculator->setStartNode($this->idtm_struktur, $this->Nested);
         }
         //das brauchen wir, fuer den fall dass wir die nested informationen noch nicht im modell haben
         if (!$this->Nested) {
             $ChildrenNodes[$ReportColumn->idta_struktur_bericht_spalten] = $mySubcatsCalculator->ChildrenNodes;
             $tmpInString = '';
             if (count($ChildrenNodes[$ReportColumn->idta_struktur_bericht_spalten]) > 0) {
                 $counter = 0;
                 foreach ($ChildrenNodes[$ReportColumn->idta_struktur_bericht_spalten] as $key => $value) {
                     if ($value != '') {
                         $counter == 0 ? $tmpInString .= "'" . $value . "' " : ($tmpInString .= ",'" . $value . "' ");
                         $counter++;
                         $this->STRcounter == 0 ? $this->ReportIDsInStringAll .= "'" . $value . "' " : ($this->ReportIDsInStringAll .= ",'" . $value . "' ");
                         $this->STRcounter++;
                     }
                 }
             }
             $this->ReportIDsInString[$ReportColumn->idta_struktur_bericht_spalten] = $tmpInString;
         } else {
             if ($ReportColumn->sbs_struktur_switch_type == 1) {
                 $StartRecord = StrukturRecord::finder()->findByidtm_struktur($ReportColumn->sbs_idtm_struktur);
             } else {
                 $StartRecord = StrukturRecord::finder()->findByidtm_struktur($this->idtm_struktur);
             }
             $this->ReportIDsLeft[$ReportColumn->idta_struktur_bericht_spalten] = $StartRecord->struktur_lft;
             $this->ReportIDsRight[$ReportColumn->idta_struktur_bericht_spalten] = $StartRecord->struktur_rgt;
         }
         //falls eine zeitliche abweichung festgestellt wurde
         if ($ReportColumn->sbs_perioden_fix == 1 or !$ReportColumn->idta_perioden_gap == 0 and !$ReportColumn->idta_perioden_gap == '') {
             $mySubcatsCalculator->setStartPeriod($ReportColumn->idta_perioden_gap, $ReportColumn->sbs_perioden_fix);
             $this->ReportPerioden[$ReportColumn->idta_struktur_bericht_spalten] = $mySubcatsCalculator->Perioden;
         } else {
             $mySubcatsCalculator->setStartPeriod($this->Periode, $this->SinglePeriode);
             $this->ReportPerioden[$ReportColumn->idta_struktur_bericht_spalten] = $mySubcatsCalculator->Perioden;
         }
         $this->ReportOperator[$ReportColumn->idta_struktur_bericht_spalten] = $ReportColumn->sbs_bericht_operator;
     }
     foreach ($this->ReportPerioden as $tempPerioden) {
         foreach ($tempPerioden as $key => $value) {
             $this->Perioden[] = $value[0];
         }
     }
     //print_r($this->Perioden);
     if ($this->InputBericht || !$this->page->isCallback && !$this->page->isPostBack) {
         $criteria = new TActiveRecordCriteria();
         $criteria->Condition = "idta_struktur_bericht = :suchbedingung1";
         $criteria->Parameters[':suchbedingung1'] = $this->idta_struktur_bericht;
         $criteria->OrdersBy['sbz_order'] = "ASC";
         $ReportRows = StrukturBerichtZeilenRecord::finder()->findAll($criteria);
         $rowcounter = 0;
         foreach ($ReportRows as $SingleRow) {
             ${$SingleRow->idta_struktur_bericht_zeilen . "RObj"} = new PFCalculator();
             ${$SingleRow->idta_struktur_bericht_zeilen . "RObj"}->setDBConnection($myDBConnection);
             //${$SingleRow->idta_struktur_bericht_zeilen."RObj"}->setsubcats($mySubcats);
             ${$SingleRow->idta_struktur_bericht_zeilen . "RObj"}->setInputReport($this->InputBericht);
             //Perioden muss vor CALCCOLUMNS kommen, sonst ergebnis nicht richtig
             ${$SingleRow->idta_struktur_bericht_zeilen . "RObj"}->Varianten = $this->Varianten;
             //aus der zeile
             ${$SingleRow->idta_struktur_bericht_zeilen . "RObj"}->Perioden = $this->ReportPerioden;
             //aus der zeile
             //this needs to be set, before we calc the number of columns
             ${$SingleRow->idta_struktur_bericht_zeilen . "RObj"}->setColumns($ReportColumns);
             ${$SingleRow->idta_struktur_bericht_zeilen . "RObj"}->calcColumns();
             ${$SingleRow->idta_struktur_bericht_zeilen . "RObj"}->setFeldFunktion($SingleRow->idta_feldfunktion);
             ${$SingleRow->idta_struktur_bericht_zeilen . "RObj"}->setVariante($this->Variante);
             //muss noch aus der definition der spalte geholt werden
             ${$SingleRow->idta_struktur_bericht_zeilen . "RObj"}->idta_struktur_bericht_spalten = $idta_struktur_bericht_spalten;
             //aus der zeile
             ${$SingleRow->idta_struktur_bericht_zeilen . "RObj"}->ReportOperator = $this->ReportOperator;
             //uebergabe des operators an den calculator
             //hier uebergeben wir die entsprechenden spaltenwerte...
             if ($this->Nested) {
                 ${$SingleRow->idta_struktur_bericht_zeilen . "RObj"}->ReportIDsLeft = $this->ReportIDsLeft;
                 ${$SingleRow->idta_struktur_bericht_zeilen . "RObj"}->ReportIDsRight = $this->ReportIDsRight;
             } else {
                 ${$SingleRow->idta_struktur_bericht_zeilen . "RObj"}->ReportIDsInString = $this->ReportIDsInString;
                 ${$SingleRow->idta_struktur_bericht_zeilen . "RObj"}->ReportIDsInStringAll = $this->ReportIDsInStringAll;
                 ${$SingleRow->idta_struktur_bericht_zeilen . "RObj"}->ChildrenNodes = $ChildrenNodes;
                 //aus der zeile
             }
             //${$SingleRow->idta_struktur_bericht_zeilen."RObj"}->setStartNode($this->Request['idtm_struktur']);
             if ($rowcounter == 0) {
                 $this->load_header(${$SingleRow->idta_struktur_bericht_zeilen . "RObj"});
                 $rowcounter++;
             }
             if ($SingleRow->sbz_spacer_label != "" or !$SingleRow->sbz_spacer_label == 0) {
                 if ($SingleRow->sbz_type == 4) {
                 } else {
                     $this->draw_spacer(${$SingleRow->idta_struktur_bericht_zeilen . "RObj"}, $SingleRow->sbz_spacer_label);
                 }
             }
             if ($SingleRow->sbz_type == 0) {
                 //type == 0 bedeutet die normale listenabfrage
                 $this->draw_cells(${$SingleRow->idta_struktur_bericht_zeilen . "RObj"}, $SingleRow->sbz_label, $SingleRow->sbz_detail);
             }
             if ($SingleRow->sbz_type == 1) {
                 //type == 1 bedeutet die dimensionsabfrage
                 ${$SingleRow->idta_struktur_bericht_zeilen . "RObj"}->dimension = $SingleRow->idtm_stammdaten;
                 $this->draw_cells_dimension(${$SingleRow->idta_struktur_bericht_zeilen . "RObj"}, $SingleRow->sbz_label, $SingleRow->sbz_order, $SingleRow->sbz_detail);
             }
             if ($SingleRow->sbz_type == 3) {
                 //type == 3 Bedeutet eine Berechnung auf bereits existierende Objekte
                 $this->build_difference_zwischenergebnisse($SingleRow->idta_struktur_bericht_zeilen, $SingleRow->sbz_label);
             }
             if ($SingleRow->sbz_type == 4) {
                 //type == 4 bedeutet einen graphen
                 $this->draw_graph(${$SingleRow->idta_struktur_bericht_zeilen . "RObj"}, $SingleRow->sbz_label, $SingleRow->sbz_spacer_label);
             }
         }
     }
 }
 public function initPullDowns()
 {
     $this->from_idta_stammdaten_group->DataSource = PFH::build_SQLPullDown(StammdatenGroupRecord::finder(), "ta_stammdaten_group", array("idta_stammdaten_group", "stammdaten_group_name"));
     $this->from_idta_stammdaten_group->dataBind();
     $this->to_idta_stammdaten_group->DataSource = PFH::build_SQLPullDown(StammdatenGroupRecord::finder(), "ta_stammdaten_group", array("idta_stammdaten_group", "stammdaten_group_name"));
     $this->to_idta_stammdaten_group->dataBind();
     $this->from_idta_feldfunktion->DataSource = PFH::build_SQLPullDown(FeldfunktionRecord::finder(), "ta_feldfunktion", array("idta_feldfunktion", "ff_name"));
     $this->from_idta_feldfunktion->dataBind();
     $this->to_idta_feldfunktion->DataSource = PFH::build_SQLPullDown(FeldfunktionRecord::finder(), "ta_feldfunktion", array("idta_feldfunktion", "ff_name"));
     $this->to_idta_feldfunktion->dataBind();
     $PeriodPullDown = new PFPeriodPullDown();
     $PeriodPullDown->setStructureTable("ta_perioden");
     $PeriodPullDown->setRecordClass(PeriodenRecord::finder());
     $PeriodPullDown->setPKField("idta_perioden");
     $PeriodPullDown->setSQLCondition("per_intern > 9999");
     $PeriodPullDown->setField("per_extern");
     $PeriodPullDown->letsrun();
     $this->DWH_idta_perioden->DataSource = $PeriodPullDown->myTree;
     $this->DWH_idta_perioden->dataBind();
     $this->DWH_idta_variante->DataSource = PFH::build_SQLPullDown(VarianteRecord::finder(), "ta_variante", array("idta_variante", "var_descr"));
     $this->DWH_idta_variante->dataBind();
 }
 public function initPullDowns($sender, $param)
 {
     $this->idta_variante->DataSource = VarianteRecord::finder()->findAll();
     $this->idta_variante->dataBind();
     $this->idta_perioden->DataSource = PeriodenRecord::finder()->findAll();
     $this->idta_perioden->dataBind();
     $this->idta_feldfunktion->DataSource = FeldfunktionRecord::finder()->findAll();
     $this->idta_feldfunktion->dataBind();
     $this->cuf_numberformat->DataSource = array("0" => "Ganzzahl", "1" => "Prozent", "2" => "Zahl");
     $this->cuf_numberformat->dataBind();
     $criteria = new TActiveRecordCriteria();
     $criteria->OrdersBy['idta_stammdaten_group'] = 'desc';
     $this->idtm_stammdaten->DataSource = StammdatenRecord::finder()->findAll($criteria);
     $this->idtm_stammdaten->dataBind();
 }