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; }
protected function setFilter() { $cmd = $this->db->createCommand(SQL::SQL_GET_EXPORT); $cmd->bindValue(":id", $this->Request['id']); $data = $cmd->query(); $data = $data->read(); $sql = $data['sql']; $expreg = "(:\\w*_\\w*)"; $jsParams = "var param = '&id=" . $this->Request['id'] . "'"; if (preg_match_all($expreg, $sql, $catches)) { foreach ($catches[0] as $catch) { $type = explode("_", $catch); $this->catches[] = substr($catch, 1, strlen($catch) - 1); if (count($type) == 2) { $fName = $type[1]; } else { $fName = 'TBD'; } $label = new TLabel(); $label->setText($fName . ' '); $this->filtre->Controls[] = $label; switch ($type[0]) { case ':date': $date = new TActiveDatePicker(); $date->setText(''); $date->setMode('ImageButton'); $date->setID(substr($catch, 1, strlen($catch) - 1)); $date->OnCallBack = array($this, "filterChange"); $this->filtre->Controls[] = $date; $this->jsPrint .= "var {$fName} = document.getElementById('" . $date->getClientID() . "');\n"; $jsParams .= "+ '&" . substr($catch, 1, strlen($catch) - 1) . "=' + {$fName}.value"; break; case ':int': $int = new TActiveTextBox(); $int->setID(substr($catch, 1, strlen($catch) - 1)); $int->setText(0); $int->OnCallBack = array($this, "filterChange"); $this->filtre->Controls[] = $int; $this->jsPrint .= "var {$fName} = document.getElementById('" . $int->getClientID() . "');\n"; $jsParams .= "+ '&" . substr($catch, 1, strlen($catch) - 1) . "=' + {$fName}.value"; break; case ':string': $string = new TActiveTextBox(); $string->setID(substr($catch, 1, strlen($catch) - 1)); $string->setText(''); $string->setAutoPostBack(true); $string->OnCallBack = array($this, "filterChange"); $this->filtre->Controls[] = $string; $this->jsPrint .= "var {$fName} = document.getElementById('" . $string->getClientID() . "');\n"; $jsParams .= "+ '&" . substr($catch, 1, strlen($catch) - 1) . "=' + {$fName}.value"; break; } $label = new TLabel(); $label->setText(' '); $this->filtre->Controls[] = $label; } } $jsParams .= "+ '&pdf=' + document.getElementById('" . $this->pdfExport->getClientID() . "').checked"; $jsParams .= "+ '&excel=' + document.getElementById('" . $this->excelExport->getClientID() . "').checked"; $jsParams .= "+ '&csv=' + document.getElementById('" . $this->csvExport->getClientID() . "').checked"; $this->jsPrint .= $jsParams . ";\n"; $this->jsPrint .= 'window.open( "' . $this->Service->constructUrl($this->getApplication()->getService()->getRequestedPagePath()) . '&action=print" + param, target="_blank" ) ;'; }