public function updateDBValue($sender, $param)
 {
     $MaskField = CustomMaskFieldRecord::finder()->find("cuf_maskenname = ? AND cuf_maskenid = ?", $this->cuf_maskenname->Text, $sender->parent->Id);
     //als erstes lese ich die Periode aus
     $Periode = PeriodenRecord::finder()->findByidta_perioden($MaskField->idta_perioden);
     $w_monat = $Periode->per_intern;
     $w_jahr = $this->getYearByMonth($w_monat);
     //auslesen des roots, damit ich den linken und den rechten wert habe...
     $parent_idtm_struktur = StrukturRecord::finder()->findByidtm_struktur($this->idtm_struktur->Text);
     //jetzt suche ich die entsprechende dimension innerhalb der selektion
     $idtm_struktur = StrukturRecord::finder()->find('(struktur_lft BETWEEN ? AND ?) AND idtm_stammdaten = ?', $parent_idtm_struktur->struktur_lft, $parent_idtm_struktur->struktur_rgt, $MaskField->idtm_stammdaten)->idtm_struktur;
     //hier startet jetzt der Part, wo ich nur eine Periode habe -> entweder SubJahr oder Jahr...
     $PFBackCalculator = new PFBackCalculator();
     $PFBackCalculator->setVariante($MaskField->idta_variante);
     /* Folgende Parameter sind zur Berechnung der Werte notwendig...
      * @param idta_periode -> die interne Periodenbezeichnung -> 10001 für 1. Jahr oder 1 für 1 Monat (Bsp)
      * @param idtm_struktur -> die Struktur ID, auf der die Werte nachher gespreichert werden sollen
      * @param w_dimkey -> der Schlüssel, der angehängt werden soll...
      * @param assoc_array(feldbezug=>wert) -> array mit den Werten, die als "neu" betrachtet werden sollen...
      */
     $PFBackCalculator->setStartPeriod($w_monat);
     $PFBackCalculator->setStartNode($idtm_struktur);
     //vorbereiten des Wertearrays, damit die bestehenden Werte in der Datenbank, mit den neuen Uerberschrieben werden koennen
     //jetzt laden wir die einzelnen Werte
     $NEWWerteRecord = WerteRecord::finder()->findBySql("SELECT w_wert FROM tt_werte WHERE idtm_struktur = '" . $idtm_struktur . "' AND idta_feldfunktion = '" . $MaskField->idta_feldfunktion . "' AND w_jahr = '" . $w_jahr . "' AND w_monat = '" . $w_monat . "' AND w_id_variante = '" . $MaskField->idta_variante . "' LIMIT 1");
     $w_wert[$MaskField->idta_feldfunktion] = $this->cleanInputValue($sender->Text, $MaskField, 1);
     $PFBackCalculator->setNewValues($w_wert);
     $PFBackCalculator->run();
 }
 public function dtgList_deleteCommand($sender, $param)
 {
     $item = $param->Item;
     $finder = StrukturRecord::finder();
     $finder->deleteAll('idtm_struktur = ?', $item->lst_org_idtm_struktur->Text);
     $this->bindListOrgListe();
 }
 public function importDimensions($data)
 {
     if (is_array($data)) {
         $tt_idta_variante = $data[0];
         $tt_per_month = $data[2];
         $tt_idta_feldfunktion = $data[4];
         $new_value = $data[6];
         //zuerst suchen wir den wechselknoten
         $WSql = "SELECT * FROM tm_struktur WHERE idtm_stammdaten = " . $data[3];
         $WechselKnoten = StrukturRecord::finder()->findBySQL($WSql);
         if (is_object($WechselKnoten)) {
             $sql = "SELECT idtm_struktur FROM tm_struktur WHERE idtm_stammdaten = " . $data[5] . " AND (struktur_lft BETWEEN " . $WechselKnoten->struktur_lft . " AND " . $WechselKnoten->struktur_rgt . ")";
             $tt_idtm_struktur = StrukturRecord::finder()->findBySQL($sql)->idtm_struktur;
             $ObjSaver = new PFBackCalculator();
             $ObjSaver->setVariante($tt_idta_variante);
             $ObjSaver->setStartPeriod($tt_per_month);
             $ObjSaver->setStartNode($tt_idtm_struktur);
             $arr_newValues[$tt_idta_feldfunktion] = $new_value;
             $ObjSaver->setNewValues($arr_newValues);
             $ObjSaver->run();
             unset($ObjSaver);
         }
         unset($WechselKnoten);
     }
 }
Beispiel #4
0
 public function onInit($param)
 {
     parent::onInit($param);
     //Globale definition f�r dieses Dokument
     $this->finder = StrukturRecord::finder();
     $this->MASTERRECORD = new StrukturRecord();
     if (!$this->isPostBack && !$this->isCallback) {
         switch ($this->Request['modus']) {
             case 0:
                 $sql = "SELECT idta_struktur_type, struktur_type_name FROM ta_struktur_type";
                 $data = PFH::convertdbObjectArray(StrukturTypeRecord::finder()->findAllBySql($sql), array("idta_struktur_type", "struktur_type_name"));
                 $this->idta_struktur_type->DataSource = $data;
                 $this->idta_struktur_type->dataBind();
                 $HRKEYTest = new PFHierarchyPullDown();
                 $HRKEYTest->setStructureTable("tm_struktur");
                 $HRKEYTest->setRecordClass(StrukturRecord::finder());
                 $HRKEYTest->setPKField("idtm_struktur");
                 $HRKEYTest->setField("struktur_name");
                 $HRKEYTest->letsrun();
                 $this->parent_idtm_struktur->DataSource = $HRKEYTest->myTree;
                 $this->parent_idtm_struktur->dataBind();
                 $this->idtm_stammdaten->DataSource = PFH::build_SQLPullDown(StammdatenRecord::finder(), "tm_stammdaten", array("idtm_stammdaten", "stammdaten_name"));
                 $this->idtm_stammdaten->dataBind();
                 break;
             case 1:
                 $sql = "SELECT idta_struktur_type, struktur_type_name FROM ta_struktur_type";
                 $data = PFH::convertdbObjectArray(StrukturTypeRecord::finder()->findAllBySql($sql), array("idta_struktur_type", "struktur_type_name"));
                 $this->edidta_struktur_type->DataSource = $data;
                 $this->edidta_struktur_type->dataBind();
                 if ($this->Request[$this->primarykey] != 1) {
                     $HRKEYTest = new PFHierarchyPullDown();
                     $HRKEYTest->setStructureTable("tm_struktur");
                     $HRKEYTest->setRecordClass(StrukturRecord::finder());
                     $HRKEYTest->setPKField("idtm_struktur");
                     $HRKEYTest->setField("struktur_name");
                     $HRKEYTest->letsrun();
                     $data = $HRKEYTest->myTree;
                 } else {
                     $data = array();
                     $data[0] = "START";
                 }
                 $this->edparent_idtm_struktur->DataSource = $data;
                 $this->edparent_idtm_struktur->dataBind();
                 $this->fillValues($this->getSelected($this->Request[$this->primarykey]));
                 $this->edidtm_stammdaten->DataSource = PFH::build_SQLPullDown(StammdatenRecord::finder(), "tm_stammdaten", array("idtm_stammdaten", "stammdaten_name"));
                 $this->edidtm_stammdaten->dataBind();
                 $Usersql = "SELECT idtm_user, user_name FROM tm_user";
                 $Userdata = PFH::convertdbObjectArray(UserRecord::finder()->findAllBySql($Usersql), array("idtm_user", "user_name"));
                 $this->idtm_user->DataSource = $Userdata;
                 $this->idtm_user->dataBind();
                 $this->loadBerechtigung();
                 break;
             default:
                 break;
         }
         $this->viewPanel->ActiveViewIndex = $this->Request['modus'];
         $this->StrukturStammdatenGroupContainer->RCedidtm_struktur->Text = $this->Request[$this->primarykey];
     }
 }
 public function buildStrukturStrukturPullDown()
 {
     $this->SSedidta_feldfunktion->DataSource = PFH::build_SQLPullDown(FeldfunktionRecord::finder(), "ta_feldfunktion", array("idta_feldfunktion", "ff_name"), "idta_struktur_type = " . $this->page->idta_struktur_type->Text);
     $this->SSedidta_feldfunktion->DataBind();
     $StrukRec = StrukturRecord::finder()->findByidtm_struktur($this->user->getStartNode($this->user->getUserId($this->user->Name), "tm_struktur"));
     $this->SSedidtm_struktur_to->DataSource = PFH::build_SQLPullDown(StrukturRecord::finder(), "tm_struktur INNER JOIN ta_feldfunktion ON tm_struktur.idta_struktur_type = ta_feldfunktion.idta_struktur_type", array("idtm_struktur", "struktur_name"), "ff_type=3 AND struktur_lft BETWEEN " . $StrukRec->struktur_lft . " AND " . $StrukRec->struktur_rgt);
     $this->SSedidtm_struktur_to->DataBind();
 }
 public function check_forChildren($Id)
 {
     $Result = count(StrukturRecord::finder()->findAllByparent_idtm_struktur($Id));
     if ($Result >= 1) {
         return "true";
     } else {
         return "false";
     }
 }
Beispiel #7
0
 public function check_forChildren($Node)
 {
     $SQL = "SELECT * FROM tm_struktur WHERE parent_idtm_struktur = '" . $Node->idtm_struktur . "'";
     $Result = count(StrukturRecord::finder()->findAllBySQL($SQL));
     if ($Result >= 1) {
         return true;
     } else {
         return false;
     }
 }
Beispiel #8
0
 public function searchOrg($sender, $param)
 {
     $criteria = new TActiveRecordCriteria();
     $criteria->Condition = "struktur_name LIKE :suchtext";
     $criteria->Parameters[':suchtext'] = "%" . $this->find_org->Text . "%";
     $criteria->setLimit($this->OrgListe->PageSize);
     $criteria->setOffset($this->OrgListe->PageSize * $this->OrgListe->CurrentPageIndex);
     $this->OrgListe->DataKeyField = 'idtm_struktur';
     $this->OrgListe->VirtualItemCount = count(StrukturRecord::finder()->withstrtype()->find($criteria));
     $this->OrgListe->DataSource = StrukturRecord::finder()->withstrtype()->findAll($criteria);
     $this->OrgListe->dataBind();
 }
 public function onPreInit($param)
 {
     //error_reporting(E_ALL ^ E_NOTICE);
     $request_user = $_GET['user'];
     $request_password = $_GET['pass'];
     $authManager = $this->Application->getModule('auth');
     if (!$authManager->login($request_user, $request_password)) {
         exit;
     }
     $this->getResponse()->appendHeader("Content-Type:" . $this->header);
     echo '<?xml version="1.0" ?><tm_struktur>';
     $SQL = "SELECT * FROM tm_struktur";
     $Results = StrukturRecord::finder()->findAllBySQL($SQL);
     foreach ($Results as $Result) {
         echo "<row idtm_struktur='" . $Result->idtm_struktur . "'>";
         echo "<parent_idtm_struktur>" . $Result->parent_idtm_struktur . "</parent_idtm_struktur>";
         echo "<struktur_name>" . $Result->struktur_name . "</struktur_name>";
         echo "<idtm_stammdaten>" . $Result->idtm_stammdaten . "</idtm_stammdaten>";
         echo "</row>";
     }
     echo '</tm_struktur>';
     exit;
 }
 private function getParentID($Node)
 {
     $Result = StrukturRecord::finder()->findByPK($Node->parent_idtm_struktur);
     if (count($Result) == 1) {
         $Result->idtm_stammdaten != '' ? $temp = "xx" . $Result->idtm_stammdaten . "xx" : ($temp = '');
         $this->DIMKEY .= $temp;
         if ($this->check_forParent($Result)) {
             $this->getParentID($Result);
         }
     }
 }
 private function draw_cells_dimension($PFCALCULATOR, $name = "Summe", $ORDER = 0, $DetailRow = "0")
 {
     if ($DetailRow == 0) {
         //$TESTDETAIL = StammdatenGroupRecord::finder()->findByidta_stammdaten_group((StammdatenRecord::finder()->findByidtm_stammdaten($PFCALCULATOR->dimension)->idta_stammdaten_group))->stammdaten_group_original;
         //$DetailChecker = $TESTDETAIL==1?1:0;
         $DetailChecker = 0;
     } else {
         $DetailChecker = 1;
     }
     $PFCALCULATOR->executeDimensionSQL($name, $DetailChecker, $this->InputBericht);
     $ROWS = $PFCALCULATOR->getValues();
     $ROWSPLAIN = $PFCALCULATOR->getPlainValues();
     $ALTERNATING = $this->sheetrow;
     $ROWCOUNTER = 0;
     //here comes the part for the iniputfield
     if ($this->InputBericht == 1) {
         $inp_idta_feldfunktion = $PFCALCULATOR->FeldFunktion;
         $inp_idta_variante = $this->Variante;
     }
     $temparray = array();
     //hier speicher ich die werte fuer das zwischenergebnis
     $WorkRowID = "";
     //empty an init var
     foreach ($ROWS as $row) {
         $jj = 1;
         $ROWCOUNTER++;
         $DDRowCounter = 1;
         //hier bauen wir die einzelnen Zeilen
         $ControlListCell = array();
         //clean the children
         $WorkRow = new TActiveTableRow();
         if ($this->InputBericht == 1) {
             $walkerCheck = count($ROWS) > 2 ? count($ROWS) - 1 : count($ROWS);
         } else {
             $walkerCheck = count($ROWS);
         }
         if ($ROWCOUNTER < $walkerCheck or $DetailChecker == 0 and $this->InputBericht == 0 or $this->InputBericht == 1) {
             $WorkRowID = "R" . $this->sheetrow;
             //new for grouping
             $this->resulttable->Rows[] = $WorkRow;
             $ColumnCounter = 0;
             foreach ($row as $value) {
                 $ControlListCellChildren = array();
                 //clean the children
                 $cell = new TActiveTableCell();
                 $cell->setID("R" . $this->sheetrow . "C" . $jj);
                 $jj++;
                 $cell->EnableViewState = true;
                 if ($this->InputBericht == 0 or $DDRowCounter == 1) {
                     if ($this->InputBericht == 1) {
                         $tmpText = preg_split("/xxx/", $value);
                         $cell->Text = $tmpText[1];
                         $inp_idtm_struktur = $tmpText[2];
                         $inp_idta_struktur_type = StrukturRecord::finder()->findByidtm_struktur($inp_idtm_struktur)->idta_struktur_type;
                     } else {
                         $cell->Text = $value;
                     }
                 } else {
                     $inp_per_month = $this->Perioden[$ColumnCounter - 1];
                     $inp_per_year = $PFCALCULATOR->getYearByMonth($inp_per_month);
                     $inputfield = new TActiveTextBox();
                     $UniqueID = 'xxx' . $inp_per_year . 'xxx' . $inp_per_month . 'xxx' . $inp_idta_struktur_type . 'xxx' . $inp_idta_feldfunktion . 'xxx' . $inp_idtm_struktur . 'xxx' . $inp_idta_variante . 'xxx';
                     if (!$this->page->isPostBack && !$this->page->isCallback && $this->InputBericht == 1) {
                         $inputfield->setText($value);
                         $MyUserFelderRecord = new UserFelderRecord();
                         $MyUserFelderRecord->user_id = $this->User->getUserId($this->User->Name);
                         $MyUserFelderRecord->tuf_feldname = $UniqueID;
                         $MyUserFelderRecord->save();
                     }
                     //$local_jahr."xxx".$local_jahr."xxx".$local_type."xxx".$local_ff."xxx".$local_id;
                     $inputfield->setId($UniqueID);
                     $inputfield->setCssClass("inputgrid");
                     //$this->page->registerObject($UniqueID,$inputfield);
                     $cell->Controls->add($inputfield);
                     $ControlListCellChildren[] = array("class" => "TActiveTextBox", "id" => $UniqueID, "OnCallback" => "", "CommandParameter" => "");
                 }
                 $WorkRow->Cells[] = $cell;
                 $ControlListCell[] = array("class" => "TActiveTableCell", "id" => "R" . $this->sheetrow . "C" . $jj, "OnCallback" => "", "CommandParameter" => "", "children" => $ControlListCellChildren);
                 $DDRowCounter++;
                 $ColumnCounter++;
             }
             fmod($ALTERNATING, 2) == 0 ? $WorkRow->setCssClass('listalternating') : $WorkRow->setCssClass('listnonealternating');
             $ALTERNATING++;
         } else {
             $WorkRowID = "R" . $this->sheetrow . "G";
             //new for grouping
             $this->resulttable->Rows[] = $WorkRow;
             $jj = 1;
             if ($this->InputBericht == 0) {
                 $ControlListCellChildren = array();
                 foreach ($row as $value) {
                     $cell = new TActiveTableCell();
                     $cell->setID("R" . $this->sheetrow . "C" . $jj);
                     $jj++;
                     $cell->EnableViewState = true;
                     $cell->Text = $value;
                     $cell->setCssClass('calculatedsumme');
                     $WorkRow->Cells[] = $cell;
                     $ControlListCell[] = array("class" => "TActiveTableCell", "id" => "R" . $this->sheetrow . "C" . $jj, "OnCallback" => "", "CommandParameter" => "", "children" => $ControlListCellChildren);
                 }
             }
         }
         $WorkRow->setID($WorkRowID);
         $this->dynamicControlList[] = array("class" => "TActiveTableRow", "id" => $WorkRowID, "OnCallback" => "", "CommandParameter" => "", "children" => $ControlListCell);
         $this->sheetrow++;
         //increment rowcounter
     }
     $ALTERNATING = 0;
     $labelcounter = 0;
     foreach ($ROWSPLAIN as $rowplain) {
         $ALTERNATING++;
         if ($ALTERNATING == count($ROWSPLAIN)) {
             foreach ($rowplain as $valueplain) {
                 $labelcounter == 0 ? $labelcounter++ : array_push($temparray, $valueplain * 1);
             }
         }
     }
     $this->zwischenergebnisse[$name] = $temparray;
 }
Beispiel #12
0
 public static function initStrukturLink()
 {
     //als erstes holen wir uns die Definitionen aus ta_stammdaten_link
     $StammdatenLinks = StammdatenLinkRecord::finder()->findAll();
     foreach ($StammdatenLinks as $StammdatenLink) {
         //als nächstes hole ich mit die Werte der Dimensionsgruppe in der gesucht werden soll, diese gilt dann als suchkriterium...
         $StammdatenGroups = StammdatenRecord::finder()->findAllByidta_stammdaten_group($StammdatenLink->idta_stammdaten_group);
         foreach ($StammdatenGroups as $StammdatenGroup) {
             //als nächstes muss ich in der Struktur suchen, welcher Bereich für die jeweiligen Kennungen gilt...
             $StrukturWechselKnoten = StrukturRecord::finder()->findByidtm_stammdaten($StammdatenGroup->idtm_stammdaten);
             if (is_object($StrukturWechselKnoten)) {
                 //da lft und rgt jetzt bekannt sind, kann ich mit dem folgenden SQL die entsprechenden Elemente fuer idtm_str_from und idtm_str_to finden
                 $SQL = "SELECT idtm_struktur FROM tm_struktur WHERE (struktur_lft BETWEEN " . $StrukturWechselKnoten->struktur_lft . " AND " . $StrukturWechselKnoten->struktur_rgt . ") AND idtm_stammdaten='" . $StammdatenLink->idtm_stammdaten_from . "'";
                 $idtm_struktur_from = StrukturRecord::finder()->findBySql($SQL)->idtm_struktur;
                 $SQL = "SELECT idtm_struktur FROM tm_struktur WHERE (struktur_lft BETWEEN " . $StrukturWechselKnoten->struktur_lft . " AND " . $StrukturWechselKnoten->struktur_rgt . ") AND idtm_stammdaten='" . $StammdatenLink->idtm_stammdaten_to . "'";
                 $idtm_struktur_to = StrukturRecord::finder()->findBySql($SQL)->idtm_struktur;
                 //jetzt haben wir alle informationen um den Datensatz zu schreiben
                 $TestRecord = StrukturStrukturRecord::finder()->count("idtm_struktur_from = ? AND idtm_struktur_to = ? AND idta_feldfunktion = ?", $idtm_struktur_from, $idtm_struktur_to, $StammdatenLink->idta_feldfunktion_from);
                 if ($TestRecord == 1) {
                     $ChangeRecord = StrukturStrukturRecord::finder()->find("idtm_struktur_from = ? AND idtm_struktur_to = ? AND idta_feldfunktion = ?", $idtm_struktur_from, $idtm_struktur_to, $StammdatenLink->idta_feldfunktion_from);
                 } else {
                     $ChangeRecord = new StrukturStrukturRecord();
                 }
                 $ChangeRecord->idtm_struktur_from = $idtm_struktur_from;
                 $ChangeRecord->idtm_struktur_to = $idtm_struktur_to;
                 $ChangeRecord->idta_feldfunktion = $StammdatenLink->idta_feldfunktion_from;
                 $ChangeRecord->save();
                 unset($TestRecord);
                 unset($ChangeRecord);
             }
         }
         unset($StammdatenGroups);
     }
 }
Beispiel #13
0
 public function buildStructureOLD($node = '')
 {
     $itemsopen = ",'items':[";
     $itemsclose = "]}";
     if (!$node->idtm_struktur) {
         $this->structure = "var struct = [";
         $subNodes = StrukturRecord::finder()->findAllBy_parent_idtm_struktur('0');
         $this->structure .= "{'id':'0', 'txt':'Struktur','img':'str1.gif'" . $itemsopen;
         $this->counteritems++;
     } else {
         $criteria = new TActiveRecordCriteria();
         $criteria->Condition = "parent_idtm_struktur = :suchtext";
         $criteria->Parameters[':suchtext'] = $node->idtm_struktur;
         $criteria->OrdersBy["parent_idtm_struktur"] = 'asc';
         $subNodes = StrukturRecord::finder()->findAll($criteria);
         $this->structure .= "{'id':'" . $node->idtm_struktur . "', 'page':'" . $setToPage . "', 'txt':'" . $node->struktur_name . "','img':'str" . $node->idta_struktur_type . ".gif'";
         if ($this->check_forChildren($node)) {
             $this->structure .= $itemsopen;
             $this->counteritems++;
         } else {
             $this->structure .= '}';
         }
     }
     foreach ($subNodes as $subN) {
         if ($this->check_forChildren($node)) {
             if ($this->check_forChildren($subN)) {
                 $this->buildStructure($subN);
                 $this->counterorg < count($subNodes) ? $this->counterorg++ : ($this->counterorg = 1);
             }
         }
     }
     foreach ($subNodes as $subN) {
         if (!$this->check_forChildren($subN)) {
             $this->buildStructure($subN);
             $this->counter < count($subNodes) - 1 ? $this->structure .= "," : ($this->structure .= ']},');
             $this->counter < count($subNodes) - 1 ? '' : $this->counteritems--;
             $this->counter < count($subNodes) - 1 ? $this->counter++ : ($this->counter = 0);
         }
     }
 }
 public function calcPayables($local_type, $local_ff, $local_id, $local_jahr, $local_prefix)
 {
     $counter = 0;
     //reset of the existing values -> filled with value in w_endwert default zero if values from former periods, they will be filled in
     foreach ($this->Perioden as $key => $value) {
         $my_jahr = $this->getYearByMonth($key);
         $current_field = "RLIQXXX" . $my_jahr . "XXX" . $key . "XXX" . $local_type . "XXX" . $local_ff . "XXX" . $local_id;
         $follow_value_record = WerteRecord::finder()->findBySql("SELECT w_endwert FROM tt_werte WHERE idtm_struktur = '" . $local_id . "' AND idta_feldfunktion = '" . $local_ff . "' AND w_jahr = '" . $my_jahr . "' AND w_monat = '" . $key . "' AND w_id_variante = '" . $this->GLOBALVARIANTE . "' LIMIT 1");
         $this->page->ACTPanel->FindControl($current_field)->Text = number_format($follow_value_record->w_endwert, $this->NumberOfDigits, '.', '');
     }
     //I need to reset the values for the following Period
     if ($this->ResetCalcpayables == 0) {
         $cleanyear = $my_jahr + 1;
         $ResetRecords = WerteRecord::finder()->findAllBySql("SELECT * FROM tt_werte WHERE idtm_struktur = '" . $local_id . "' AND idta_feldfunktion = '" . $local_ff . "' AND w_jahr = '" . $cleanyear . "' AND w_id_variante = '" . $this->GLOBALVARIANTE . "'");
         foreach ($ResetRecords as $ResetRecord) {
             $ResetRecord->w_endwert = 0;
             $ResetRecord->save();
         }
         $this->ResetCalcpayables++;
     }
     foreach ($this->Perioden as $key => $value) {
         $counter++;
         // hier erhoehen wir die info, dass die erste periode vorbei ist
         if ($key < 10000) {
             $my_jahr = $this->getYearByMonth($key);
             $current_field = "RLIQXXX" . $my_jahr . "XXX" . $key . "XXX" . $local_type . "XXX" . $local_ff . "XXX" . $local_id;
             $current_value = number_format($this->page->ACTPanel->FindControl($current_field)->Text, $this->NumberOfDigits, '.', '');
             $days_for_factor = 360 / $this->getNumberPerIntern($my_jahr);
             //here we get the value of the field, that contains the value for the base factor
             $tresult = CollectorRecord::finder()->findBySql("SELECT col_idtafeldfunktion,col_operator FROM ta_collector INNER JOIN ta_feldfunktion ON ta_collector.col_idtafeldfunktion = ta_feldfunktion.idta_feldfunktion WHERE ta_collector.idta_feldfunktion = '" . $local_ff . "' AND ff_type='3' LIMIT 1");
             //3 ist der struktursammler
             $base_field = "RLIQXXX" . $my_jahr . "XXX" . $key . "XXX" . $local_type . "XXX" . $tresult->col_idtafeldfunktion . "XXX" . $local_id;
             $base_value = number_format($this->page->ACTPanel->FindControl($base_field)->Text, $this->NumberOfDigits, '.', '');
             $factor_per_day = $base_value / $days_for_factor;
             $ttresult = CollectorRecord::finder()->findBySql("SELECT col_idtafeldfunktion,col_operator FROM ta_collector INNER JOIN ta_feldfunktion ON ta_collector.col_idtafeldfunktion = ta_feldfunktion.idta_feldfunktion WHERE ta_collector.idta_feldfunktion = '" . $local_ff . "' AND ff_type<>'3' LIMIT 1");
             //3 ist der struktursammler
             $day_field = "RLIQXXX" . $my_jahr . "XXX" . $key . "XXX" . $local_type . "XXX" . $ttresult->col_idtafeldfunktion . "XXX" . $local_id;
             $day_value = $this->page->ACTPanel->FindControl($day_field)->Text;
             $temp_compare = $day_value / $days_for_factor;
             $untergrenze = 0;
             //der untere laufer
             $obergrenze = 1;
             //der obere laufwert
             $monat = $key;
             for ($ii = 0; $ii < 10000; $ii++) {
                 if ($temp_compare >= $untergrenze and $temp_compare < $obergrenze) {
                     $tmpcurrent_field = "RLIQXXX" . $my_jahr . "XXX" . $monat . "XXX" . $local_type . "XXX" . $local_ff . "XXX" . $local_id;
                     if ($this->page->ACTPanel->FindControl($tmpcurrent_field)) {
                         $tmpcurrent_value = number_format($this->page->ACTPanel->FindControl($tmpcurrent_field)->Text, $this->NumberOfDigits, '.', '');
                     } else {
                         $tmpcurrent_value = 0;
                     }
                     $faktor_periode = $obergrenze - $temp_compare;
                     $valuefillin = $faktor_periode * $base_value;
                     $counter == 1 ? '' : ($valuefillin += $tmpcurrent_value);
                     $this->update_w_wert($my_jahr, $monat, $local_type, $local_ff, $local_id, $valuefillin);
                     $this->page->ACTPanel->FindControl($tmpcurrent_field)->Text = number_format($valuefillin, $this->NumberOfDigits, '.', '');
                     if ($faktor_periode < 1 and $faktor_periode > 0) {
                         $monat++;
                         $target_year = $this->getYearByMonth($monat);
                         //this is new because a value needs to be passed to the following year
                         $valuefillin = (1 - $faktor_periode) * $base_value;
                         $follow_field = "RLIQXXX" . $target_year . "XXX" . $monat . "XXX" . $local_type . "XXX" . $local_ff . "XXX" . $local_id;
                         if ($target_year == $my_jahr) {
                             $follow_value = number_format($this->page->ACTPanel->FindControl($follow_field)->Text, $this->NumberOfDigits, '.', '');
                             $counter == 1 ? '' : ($valuefillin += $follow_value);
                             $this->update_w_wert($target_year, $monat, $local_type, $local_ff, $local_id, $valuefillin);
                             $this->page->ACTPanel->FindControl($follow_field)->Text = number_format($valuefillin, $this->NumberOfDigits, '.', '');
                             break;
                         } else {
                             $follow_value_record = WerteRecord::finder()->findBySql("SELECT idtt_werte FROM tt_werte WHERE idtm_struktur = '" . $local_id . "' AND idta_feldfunktion = '" . $local_ff . "' AND w_jahr = '" . $target_year . "' AND w_monat = '" . $monat . "' AND w_id_variante = '" . $this->GLOBALVARIANTE . "' LIMIT 1");
                             if (count($follow_value_record) > 0) {
                                 $MyWerteRecord = WerteRecord::finder()->findByidtt_werte($follow_value_record->idtt_werte);
                                 $follow_value = $MyWerteRecord->w_endwert * 1;
                                 $MyWerteRecord->w_endwert = $valuefillin;
                                 $MyWerteRecord->save();
                                 break;
                             } else {
                                 $tmp = 0;
                                 $NEWWerteRecord = new WerteRecord();
                                 $NEWWerteRecord->w_jahr = $target_year;
                                 $NEWWerteRecord->w_monat = $monat;
                                 $this->getInitialValue($local_ff, StrukturRecord::finder()->findByPK($local_id)->idtm_stammdaten, $monat, $this->GLOBALVARIANTE, $tmp);
                                 $NEWWerteRecord->w_wert = $tmp;
                                 $NEWWerteRecord->w_endwert = $valuefillin;
                                 $NEWWerteRecord->idta_feldfunktion = $local_ff;
                                 $NEWWerteRecord->idtm_struktur = $local_id;
                                 $NEWWerteRecord->w_id_variante = $this->GLOBALVARIANTE;
                                 $NEWWerteRecord->save();
                                 break;
                             }
                         }
                     }
                 }
                 $untergrenze++;
                 $obergrenze++;
                 $monat++;
             }
             $this->check_collector($local_ff, $current_field, $local_prefix, $key, $local_jahr, $local_id);
         }
     }
     $this->update_w_wert($local_jahr, $local_jahr, $local_type, $local_ff, $local_id, $this->sum_up($local_jahr, $local_jahr, $local_ff, $local_id));
     $resultField = "RLIQXXX" . $local_jahr . "XXX" . $local_jahr . "XXX" . $local_type . "XXX" . $local_ff . "XXX" . $local_id;
     $this->page->ACTPanel->FindControl($resultField)->Text = number_format($this->sum_up($local_jahr, $local_jahr, $local_ff, $local_id), $this->NumberOfDigits, '.', '');
     //hier muss die berechnung der erroeffnungsbilanz hin
 }
 private function load_all_cats()
 {
     $rows = StrukturRecord::finder()->findAll();
     foreach ($rows as $row) {
         $this->subcats[$row->parent_idtm_struktur][] = $row->idtm_struktur;
         //$this->parentcats[$row->idtm_struktur]=$row->parent_idtm_struktur;
     }
 }
 public function applyAutoMap()
 {
     //hier kommt dann der Part, wo ich das Automapping laufen lasse...
     $StructureRecords = StrukturRecord::finder()->findAll();
     foreach ($StructureRecords as $Row) {
         $this->TreeArray[$Row->parent_idtm_struktur][] = $Row->idtm_struktur;
     }
     $cond0 = " idtm_struktur IN (" . $this->subcategory_list($this->TreeArray, $this->StartNode) . ") AND";
     $ImporterRecords = ImportMappingRecord::finder()->findAll('ima_name = ?', $this->MappingName->Text);
     foreach ($ImporterRecords as $ImportRecord) {
         for ($j = 1; $j <= $this->NumberID->Text; $j++) {
             //to ensure no older conditions are stored inside
             $clearCon = "cond" . $j;
             ${$clearCon} = "";
             $tempCon = "cond" . ($j - 1);
             $sql1 = "SELECT * FROM tm_struktur WHERE" . ${$tempCon};
             $AMRecord = AutoMappingRecord::finder()->find('ti_id = ? AND ima_name = ?', $ImportRecord->{"ima_id" . $j}, $this->MappingName->Text);
             $tmpSQL = $sql1 . " idtm_stammdaten=" . $AMRecord->idtm_stammdaten;
             if (count(StrukturRecord::finder()->findBySQL($tmpSQL)) == 1) {
                 $NewStartNode = StrukturRecord::finder()->findBySQL($tmpSQL)->idtm_struktur;
                 ${$clearCon} = " idtm_struktur IN (" . $this->subcategory_list($this->TreeArray, $NewStartNode) . ") AND";
                 $ima_source = "A";
                 $idta_feldfunktion = $AMRecord->idta_feldfunktion;
             } else {
                 $NewStartNode = 0;
                 $ima_source = "";
                 $idta_feldfunktion = "";
                 break 1;
             }
         }
         $ImportRecord->idtm_struktur = $NewStartNode;
         $ImportRecord->idta_feldfunktion = $idta_feldfunktion;
         $ImportRecord->ima_source = $ima_source;
         $ImportRecord->save();
         $NewStartNode = 0;
     }
     //$this->bindListImportMapping();
 }
 private function parentCategory_list_Nested($catID)
 {
     $lst = $catID;
     //id des ersten Startelements...
     while (StrukturRecord::finder()->findByidtm_struktur(StrukturRecord::finder()->findByPK($catID)->parent_idtm_struktur)->idtm_struktur != NULL) {
         $catID = StrukturRecord::finder()->findByidtm_struktur(StrukturRecord::finder()->findByPK($catID)->parent_idtm_struktur)->idtm_struktur;
         $lst .= ", " . $catID;
     }
     return $lst;
 }
 function rebuild_NestedInformation($parent, $left)
 {
     // the right value of this node is the left value + 1
     $right = $left + 1;
     // get all children of this node
     $TreeRecords = StrukturRecord::finder()->findAllByparent_idtm_struktur($parent);
     if (count($TreeRecords) >= 1) {
         foreach ($TreeRecords as $TreeRecord) {
             // recursive execution of this function for each
             // child of this node
             // $right is the current right value, which is
             // incremented by the rebuild_tree function
             $right = $this->rebuild_NestedInformation($TreeRecord->idtm_struktur, $right);
         }
     }
     // we've got the left value, and now that we've processed
     // the children of this node we also know the right value
     if ($parent != 0) {
         $TreeChangeRecord = StrukturRecord::finder()->findByidtm_struktur($parent);
         $TreeChangeRecord->struktur_lft = $left;
         $TreeChangeRecord->struktur_rgt = $right;
         $TreeChangeRecord->save();
     }
     // return the right value of this node + 1
     return $right + 1;
 }
 public function runStructureCollector($idtm_struktur, $periode = '10001', $variante = '1')
 {
     //diese info benoetige ich, damit keine doppelten felder geladen werden
     $existingFieldfunktionen = array();
     $existingFieldfunktionen = $this->FunktionsFelder;
     $Records = StrukturStrukturRecord::finder()->findAllBySQL("SELECT idtm_struktur_to FROM tm_struktur_tm_struktur WHERE idtm_struktur_from = '" . $idtm_struktur . "' GROUP BY idtm_struktur_to");
     $counter = 0;
     foreach ($Records as $Record) {
         //leeren der bestehenden Funktionsfelder
         $this->FunktionsFelder = array();
         $counter++;
         $this->TTWERTE = array();
         $this->WerteListe = array();
         //hier leere ich das Array, sonst klappt das nicht
         $Company = $this->findFirstCompany($Record->idtm_struktur_to);
         $counter == 1 ? $this->setStartNode($Company) : '';
         $counter == 1 ? $this->setStartPeriod($periode) : '';
         //hier muss ich checken, ob aus einer struktur 2 werte auf den gleichen Punkt verweisen...
         foreach (StrukturStrukturRecord::finder()->findAllByidtm_struktur_to($Record->idtm_struktur_to) as $temp) {
             array_push($this->FunktionsFelder, $temp->idta_feldfunktion);
         }
         //here we run the SQL-Statement
         $this->buildStructureCollectorSQL($Record->idtm_struktur_to);
         $this->setStartNode($Record->idtm_struktur_to);
         //diese info benoetige ich, damit keine doppelten felder geladen werden
         $this->FunktionsFelder = $existingFieldfunktionen;
         $command = $this->DBConnection->createCommand($this->mySQL);
         $dataReader = $command->query();
         $this->WerteListe = $dataReader->readAll();
         //hier befuellen wir den ram record
         $this->TTWERTE = array();
         //DB: leeres array print_r($this->TTWERTE);
         $this->initTTWerte($Record->idtm_struktur_to, StrukturRecord::finder()->findByPK($Record->idtm_struktur_to)->idta_struktur_type);
         $Result = StrukturRecord::finder()->findByPK($Record->idtm_struktur_to);
         $SQL = "SELECT * FROM ta_feldfunktion WHERE idta_struktur_type = '" . $Result->idta_struktur_type . "' AND ff_type='3'";
         $FieldToChange = FeldfunktionRecord::finder()->findBySQL($SQL);
         foreach ($this->Perioden as $tmpPeriode) {
             if ($tmpPeriode[0] > 10000) {
                 $jahr = $tmpPeriode[0];
                 $monat = $tmpPeriode[0];
             } else {
                 $jahr = $this->getYearByMonth($tmpPeriode[0]);
                 $monat = $tmpPeriode[0];
             }
             //$this->valueChanged($jahr,$monat,$Result->idta_struktur_type,$FieldToChange->idta_feldfunktion,$Record->idtm_struktur_to,$this->WerteListe[0][$monat]);
             $this->update_w_wert($jahr, $monat, $FieldToChange->idta_feldfunktion, $Record->idtm_struktur_to, $this->WerteListe[0][$monat]);
         }
         $this->mySQL = '';
         //former saveValues()
         $this->valueChanged($jahr, $jahr, $Result->idta_struktur_type, $FieldToChange->idta_feldfunktion, $Record->idtm_struktur_to, $this->WerteListe[0][$jahr]);
         $this->check_collector($FieldToChange->idta_feldfunktion, $jahr, $jahr, $Record->idtm_struktur_to);
         $this->saveValues("NOSC");
     }
 }
 public function create_StammdatenAll($sender, $param)
 {
     $StammdatenGroupRecord = StammdatenGroupRecord::finder()->findByidta_stammdaten_group($this->RCedidta_stammdaten_group->Text);
     $AllStammdatenRecord = StammdatenRecord::finder()->findAllByidta_stammdaten_group($this->RCedidta_stammdaten_group->Text);
     foreach ($AllStammdatenRecord as $SRecord) {
         $StammdatenRecord = StammdatenRecord::finder()->findByidtm_stammdaten($SRecord->idtm_stammdaten);
         if (count(StrukturRecord::finder()->find("idtm_stammdaten = ? AND parent_idtm_struktur = ?", $StammdatenRecord->idtm_stammdaten, $this->RCedidtm_struktur->Text)) < 1) {
             $StrukturRecord = new StrukturRecord();
             $StrukturRecord->idta_struktur_type = $StammdatenGroupRecord->idta_struktur_type;
             $StrukturRecord->idtm_stammdaten = $StammdatenRecord->idtm_stammdaten;
             $StrukturRecord->struktur_name = $StammdatenRecord->stammdaten_name;
             $StrukturRecord->parent_idtm_struktur = $this->RCedidtm_struktur->Text;
             $StrukturRecord->struktur_lft = 2;
             $StrukturRecord->struktur_rgt = 2;
             $StrukturRecord->save();
         }
     }
     $this->bindListStammdatenValue($this->RCedidta_stammdaten_group->Text);
 }
 public function onPreInit($param)
 {
     $myTheme = $this->User->getUserTheme($this->User->getUserId(), 'mod_theme');
     $this->setTheme($myTheme);
     parent::onPreInit($param);
     $this->workbook = new PHPExcel();
     $this->sheet = $this->workbook->getActiveSheet();
     $this->sheet->getPageSetup()->setOrientation(PHPExcel_Worksheet_PageSetup::ORIENTATION_DEFAULT);
     $this->sheet->getPageSetup()->setPaperSize(PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4);
     if ($this->Request['periode'] != '') {
         $this->Periode = $this->Request['periode'];
     }
     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), "idtm_struktur");
         $this->idtm_struktur == '' ? $this->idtm_struktur = 1 : '';
     }
     if ($this->Request['per_single'] != '') {
         $this->SinglePeriode = $this->Request['per_single'];
     }
     if ($this->Request['idta_variante'] != '') {
         $this->Variante = $this->Request['idta_variante'];
     }
     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;
     }
     //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++;
     $local_column = $this->sheetleftgap;
     $local_cell = '';
     $local_cell = $this->ColumnArray[$local_column] . $this->sheetrow;
     $this->sheet->setCellValue($local_cell, $mySubcatsCalculator->getCurrentPath($this->idtm_struktur));
     $this->workbook->getActiveSheet()->getStyle($local_cell)->getFont()->setSize(14);
     $this->workbook->getActiveSheet()->getStyle($local_cell)->getFont()->getColor()->setRGB('999900');
     $this->sheetrow++;
     //Adjusting the size
     $this->sheet->getColumnDimension($this->ColumnArray[$local_column])->setWidth(30);
     $local_column++;
     for ($ii = $local_column; $ii < count($this->ColumnArray); $ii++) {
         $this->sheet->getColumnDimension($this->ColumnArray[$ii])->setWidth(12);
     }
     //here we build the statements nthat a stored inside the database
     $Report = StrukturBerichtRecord::finder()->findByPK($this->idta_struktur_bericht);
     $this->sheet->setTitle($Report->pivot_struktur_name);
     $ReportColumns = StrukturBerichtSpaltenRecord::finder()->findAllByidta_struktur_bericht($this->idta_struktur_bericht);
     $idta_struktur_bericht_spalten = array();
     foreach ($ReportColumns as $ReportColumn) {
         $this->GraphOffset++;
         $this->InputBericht = $ReportColumn->sbs_input;
         //$this->StrukturBerichtSaveButton->Visible = $this->InputBericht;
         //wenn die Variante fix uebergeben wurde
         if ($ReportColumn->sbs_idta_variante_fix) {
             $this->Variante = $ReportColumn->idta_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);
             //hier immer auf 1, da sonst die formate nicht passen...
             //Perioden muss vor CALCCOLUMNS kommen, sonst ergebnis nicht richtig
             ${$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);
             }
         }
     }
     $this->generate('Excel5', 'planlogIQ');
 }
 public function onLoad($param)
 {
     parent::onLoad($param);
     //Globale definition f�r dieses Dokument
     $this->finder = ProzessStepRecord::finder();
     $this->MASTERRECORD = new ProzessStepRecord();
     if (!$this->isPostBack && !$this->isCallback) {
         switch ($this->Request['modus']) {
             case 0:
                 //hier checken wir, wieviele schritte noch den gleichen Vater haben
                 $myPreStepOne = ProzessStepRecord::finder()->findAllBySql("SELECT idtm_prozess FROM tm_prozess_step WHERE idtm_prozess_step = '" . $this->Request[$this->primarykey] . "'");
                 $prozess_counter = count(ProzessStepRecord::finder()->findAllBySql("SELECT idtm_prozess_step FROM tm_prozess_step WHERE idtm_prozess = '" . $myPreStepOne[0]->idtm_prozess . "'"));
                 $this->idtm_prozess->DataSource = PFH::build_SQLPullDown(ProzessRecord::finder(), "tm_prozess", array("idtm_prozess", "pro_name"), "idta_prozess_type = 3");
                 $this->idtm_prozess->dataBind();
                 $this->idtm_struktur->DataSource = PFH::build_SQLPullDown(StrukturRecord::finder(), "tm_struktur", array("idtm_struktur", "struktur_name"));
                 $this->idtm_struktur->dataBind();
                 if ($this->Request[$this->primarykey] != 1 and $prozess_counter >= 1) {
                     $sql = "SELECT idtm_prozess_step, prostep_name FROM tm_prozess_step WHERE idtm_prozess = '" . $myPreStepOne[0]->idtm_prozess . "'";
                     $data = PFH::convertdbObjectArray(ProzessStepRecord::finder()->findAllBySql($sql), array("idtm_prozess_step", "prostep_name"));
                     $data[0] = "START";
                 } else {
                     $data = array();
                     $data[0] = "START";
                 }
                 $this->parent_idtm_prozess_step->DataSource = $data;
                 $this->parent_idtm_prozess_step->dataBind();
                 $sql = "SELECT idtm_organisation, org_name FROM tm_organisation WHERE idta_organisation_type = 4";
                 $data = PFH::convertdbObjectArray(OrganisationRecord::finder()->findAllBySql($sql), array("idtm_organisation", "org_name"));
                 $this->idtm_organisation->DataSource = $data;
                 $this->idtm_organisation->dataBind();
                 if ($this->Request[$this->primarykey] != 1 and $prozess_counter >= 1) {
                     $sql = "SELECT idtm_prozess_step, prostep_name FROM tm_prozess_step WHERE idtm_prozess = '" . $myPreStepOne[0]->idtm_prozess . "'";
                     $data = PFH::convertdbObjectArray(ProzessStepRecord::finder()->findAllBySql($sql), array("idtm_prozess_step", "prostep_name"));
                     $data[0] = "START";
                 } else {
                     $data = array();
                     $data[0] = "START";
                 }
                 $this->error_idtm_prozess_step->DataSource = $data;
                 $this->error_idtm_prozess_step->dataBind();
                 break;
             case 1:
                 //hier checken wir, wieviele schritte noch den gleichen Vater haben
                 $myPreStepOne = ProzessStepRecord::finder()->findAllBySql("SELECT idtm_prozess FROM tm_prozess_step WHERE idtm_prozess_step = '" . $this->Request[$this->primarykey] . "'");
                 $prozess_counter = count(ProzessStepRecord::finder()->findAllBySql("SELECT * FROM tm_prozess_step WHERE idtm_prozess = '" . $myPreStepOne[0]->idtm_prozess . "'"));
                 $this->edidtm_prozess->DataSource = PFH::build_SQLPullDown(ProzessRecord::finder(), "tm_prozess", array("idtm_prozess", "pro_name"), "idta_prozess_type = 3");
                 $this->edidtm_prozess->dataBind();
                 $this->edidtm_struktur->DataSource = PFH::build_SQLPullDown(StrukturRecord::finder(), "tm_struktur", array("idtm_struktur", "struktur_name"));
                 $this->edidtm_struktur->dataBind();
                 $sql = "SELECT idtm_prozess_step, prostep_name FROM tm_prozess_step WHERE idtm_prozess = '" . $myPreStepOne[0]->idtm_prozess . "'";
                 $data = PFH::convertdbObjectArray(ProzessStepRecord::finder()->findAllBySql($sql), array("idtm_prozess_step", "prostep_name"));
                 $data[0] = "START";
                 $this->edparent_idtm_prozess_step->DataSource = $data;
                 $this->edparent_idtm_prozess_step->dataBind();
                 $this->edidtm_organisation->DataSource = PFH::build_SQLPullDown(OrganisationRecord::finder(), "tm_organisation", array("idtm_organisation", "org_name"), "idta_organisation_type=4");
                 $this->edidtm_organisation->dataBind();
                 $sql = "SELECT idtm_prozess_step, prostep_name FROM tm_prozess_step WHERE idtm_prozess = '" . $myPreStepOne[0]->idtm_prozess . "'";
                 $data = PFH::convertdbObjectArray(ProzessStepRecord::finder()->findAllBySql($sql), array("idtm_prozess_step", "prostep_name"));
                 $data[0] = "START";
                 $this->ederror_idtm_prozess_step->DataSource = $data;
                 $this->ederror_idtm_prozess_step->dataBind();
                 $this->Aedidtm_organisation->DataSource = PFH::build_SQLPullDown(OrganisationRecord::finder(), "tm_organisation", array("idtm_organisation", "org_name"), "idta_organisation_type=4");
                 $this->Aedidtm_organisation->dataBind();
                 $this->fillValues($this->getSelected($this->Request[$this->primarykey]));
                 $this->Aedauf_id->Text = $this->Request[$this->primarykey];
                 $this->RCedrcv_id->Text = $this->Request[$this->primarykey];
                 $this->bindListAufgaben();
                 $this->createRiskPullDown();
                 $this->bindListRCValue();
                 break;
             default:
                 break;
         }
         $this->viewPanel->ActiveViewIndex = $this->Request['modus'];
     }
 }