public function onPreInit($param) { //error_reporting(E_ALL ^ E_NOTICE); $request_user = $_GET['user']; $request_password = $_GET['pass']; $idta_variante = $_GET['idta_variante']; $per_intern = $_GET['per_intern']; $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" ?><tt_werte>'; $SQL = "SELECT * FROM tt_werte WHERE w_id_variante = " . $idta_variante . " AND w_monat = " . $per_intern; $Results = WerteRecord::finder()->findAllBySQL($SQL); foreach ($Results as $Result) { echo "<row idtt_werte='" . $Result->idtt_werte . "'>"; echo "<per_intern>" . $Result->w_monat . "</per_intern>"; echo "<w_wert>" . $Result->w_wert . "</w_wert>"; echo "<idtm_struktur>" . $Result->idtm_struktur . "</idtm_struktur>"; echo "<idta_variante>" . $Result->w_id_variante . "</idta_variante>"; echo "<w_dimkey>" . $Result->w_dimkey . "</w_dimkey>"; echo "<idta_feldfunktion>" . $Result->idta_feldfunktion . "</idta_feldfunktion>"; echo "</row>"; } echo '</tt_werte>'; exit; }
public function FFDeleteButtonClicked($sender, $param) { $tempus = 'FFed' . $this->FFprimarykey; if ($this->FFedfeldfunktion_edit_status->Text == '1') { $WerteRecord = WerteRecord::finder()->findAllByidta_feldfunktion($this->{$tempus}->Text); foreach ($WerteRecord as $Werte) { $TmpRec = WerteRecord::finder()->FindByPK($Werte->idtt_werte); $TmpRec->delete(); } $FFeditRecord = FeldfunktionRecord::finder()->findByPK($this->{$tempus}->Text); $FFeditRecord->delete(); } $this->bindListFeldfunktionValue(); }
public static function cleanStrukturStruktur() { //sql statement to find elements without matching parent $sql = "SELECT idtm_struktur FROM tm_struktur WHERE idtm_struktur NOT IN (SELECT a.idtm_struktur FROM tm_struktur a INNER JOIN tm_struktur b ON a.parent_idtm_struktur = b.idtm_struktur) AND idtm_struktur > 1"; $StrukturElements = StrukturRecord::finder()->findAllBySql($sql); foreach ($StrukturElements as $StrukturElement) { WerteRecord::finder()->deleteAll('idtm_struktur = ?', $StrukturElement->idtm_struktur); StrukturRecord::finder()->deleteByidtm_struktur($StrukturElement->idtm_struktur); //debug only echo "DE\n"; } unset($StrukturElements); //null-Werte entfernen $sql = "SELECT idtm_struktur FROM tm_struktur WHERE ISNULL(struktur_lft)"; $StrukturElements = StrukturRecord::finder()->findAllBySql($sql); foreach ($StrukturElements as $StrukturElement) { WerteRecord::finder()->deleteAll('idtm_struktur = ?', $StrukturElement->idtm_struktur); StrukturRecord::finder()->deleteByidtm_struktur($StrukturElement->idtm_struktur); //debug only echo "DE\n"; } unset($StrukturElements); }
public function SCRunSeasonsButtonClicked($sender, $param) { //Step One, find all relevant IDs $FieldstToChange = array(); //inside this array, the fields that needed to be changed are listed $idta_variante = $this->Request['idta_variante']; $idta_struktur_type = FeldfunktionRecord::finder()->findByidta_feldfunktion($this->sai_idta_feldfunktion->Text)->idta_struktur_type; $idta_feldfunktion = $this->sai_idta_feldfunktion->Text; $FieldsToChange[] = $idta_feldfunktion; //this value needs always to be included $this->load_all_cats(); $SQLINCondition = $this->subCategory_Inlist($this->subcats, $this->sai_idtm_struktur->Text); //the two must be replaced with the value from the usermanager $sql = "SELECT idtm_struktur FROM tm_struktur WHERE idtm_struktur IN (" . $SQLINCondition . ") AND idta_struktur_type = " . $idta_struktur_type; //here I recieve the array of values containing the elements to be changed $ElementsToChange = StrukturRecord::finder()->findAllBySQL($sql); //before the change can start, I need to identify the affected rows $FieldsToChangeBrutto = CollectorRecord::finder()->findAllBycol_idtafeldfunktion($idta_feldfunktion); foreach ($FieldsToChangeBrutto as $TmpField) { $FieldsToChange[] = $TmpField->idta_feldfunktion; } $SeasonToWrite = TTSaisonRecord::finder()->findAllByidta_saisonalisierung($this->sai_idta_saisonalisierung->Text); foreach ($ElementsToChange as $Element) { foreach ($FieldsToChange as $Field) { foreach ($SeasonToWrite as $Season) { $year_idta_periode = PeriodenRecord::finder()->find('idta_perioden = ?', PeriodenRecord::finder()->findByPK($Season->idta_periode)->parent_idta_perioden)->per_intern; $sqlYEAR = "SELECT w_wert FROM tt_werte WHERE w_jahr = " . $year_idta_periode . " AND w_monat = " . $year_idta_periode . " AND idtm_struktur = " . $Element->idtm_struktur . " AND w_id_variante = " . $idta_variante . " AND idta_feldfunktion = " . $Field; $YEARValue = WerteRecord::finder()->findBySQL($sqlYEAR)->w_wert; $newMonthValue = $YEARValue * $Season->sai_wert; //$sqlMONTH = "SELECT w_wert FROM tt_werte WHERE w_jahr = ".$year_idta_periode." AND w_monat = ".PeriodenRecord::finder()->findByPK($Season->idta_periode)->per_intern." AND idtm_struktur = ".$Element->idtm_struktur." AND w_id_variante = ".$idta_variante." AND idta_feldfunktion = ".$Field; if (count(WerteRecord::finder()->find('w_jahr = ? AND w_monat = ? AND idtm_struktur = ? AND w_id_variante = ? AND idta_feldfunktion = ?', $year_idta_periode, PeriodenRecord::finder()->findByPK($Season->idta_periode)->per_intern, $Element->idtm_struktur, $idta_variante, $Field))) { $RecordToUpdate = WerteRecord::finder()->find('w_jahr = ? AND w_monat = ? AND idtm_struktur = ? AND w_id_variante = ? AND idta_feldfunktion = ?', $year_idta_periode, PeriodenRecord::finder()->findByPK($Season->idta_periode)->per_intern, $Element->idtm_struktur, $idta_variante, $Field); $RecordToUpdate->w_wert = $newMonthValue; $RecordToUpdate->save(); } } } } }
public function saveValues($idtm_struktur, $idta_struktur_type) { $jahr = 0; $monat = 0; //hier werden jetzt die einzelnen Werte geladen foreach ($this->Perioden as $tmpPeriode) { if ($tmpPeriode[0] > 10000) { $jahr = $tmpPeriode[0]; $monat = $tmpPeriode[0]; } else { $jahr = $this->getYearByMonth($tmpPeriode[0]); $monat = $tmpPeriode[0]; } $SQL = "SELECT * FROM ta_feldfunktion WHERE idta_struktur_type = '" . $idta_struktur_type . "'"; $Fields = FeldfunktionRecord::finder()->findAllBySQL($SQL); foreach ($Fields as $Field) { $myUniquID = $jahr . 'xxx' . $monat . 'xxx' . $Field->idta_feldfunktion . 'xxx' . $idtm_struktur; $NEWWerteRecord = WerteRecord::finder()->findBySql("SELECT * FROM tt_werte WHERE idtm_struktur = '" . $idtm_struktur . "' AND idta_feldfunktion = '" . $Field->idta_feldfunktion . "' AND w_jahr = '" . $jahr . "' AND w_monat = '" . $monat . "' AND w_id_variante = '" . $this->GLOBALVARIANTE . "'LIMIT 1"); $NEWWerteRecord->w_wert = $this->TTWERTE[$myUniquID]; count($NEWWerteRecord) == 1 ? $NEWWerteRecord->save() : ''; } } }
public function FCRunSeasonsButtonClicked($sender, $param) { //Step One, find all relevant IDs $FieldstToChange = array(); //inside this array, the fields that needed to be changed are listed $FieldsToKeep = array(); //inside this array, the fields that needed to be keept are listed $idta_variante = $this->Request['idta_variante']; $to_idta_variante = $this->for_idta_variante->Text; $this->load_ta_perioden($this->for_from_idta_periode->Text, $this->for_to_idta_periode->Text); $idta_struktur_type = FeldfunktionRecord::finder()->findByidta_feldfunktion($this->for_idta_feldfunktion->Text)->idta_struktur_type; $idta_feldfunktion = $this->for_idta_feldfunktion->Text; $FieldsToChange[] = $idta_feldfunktion; //this value needs always to be included $this->load_all_cats(); $SQLINCondition = $this->subCategory_Inlist($this->subcats, $this->for_idtm_struktur->Text); //the two must be replaced with the value from the usermanager $sql = "SELECT idtm_struktur FROM tm_struktur WHERE idtm_struktur IN (" . $SQLINCondition . ") AND idta_struktur_type = " . $idta_struktur_type; //here I recieve the array of values containing the elements to be changed $ElementsToChange = StrukturRecord::finder()->findAllBySQL($sql); //before the change can start, I need to identify the affected rows $FieldsToChangeBrutto = CollectorRecord::finder()->findAllBycol_idtafeldfunktion($idta_feldfunktion); foreach ($FieldsToChangeBrutto as $TmpField) { $FieldsToChange[] = $TmpField->idta_feldfunktion; } $FieldsToKeepBrutto = FeldfunktionRecord::finder()->findAllByidta_struktur_type($idta_struktur_type); foreach ($FieldsToKeepBrutto as $MyTmpField) { if (!in_array($MyTmpField->idta_feldfunktion, $FieldsToChange)) { $FieldsToKeep[] = $MyTmpField->idta_feldfunktion; } } foreach ($ElementsToChange as $Element) { foreach ($this->Perioden as $key => $value) { foreach ($FieldsToChange as $Field) { $year_idta_periode = $this->getYearByMonth($key); $sqlYEAR = "SELECT w_wert FROM tt_werte WHERE w_jahr = " . $year_idta_periode . " AND w_monat = " . $key . " AND idtm_struktur = " . $Element->idtm_struktur . " AND w_id_variante = " . $idta_variante . " AND idta_feldfunktion = " . $Field; $YEARValue = WerteRecord::finder()->findBySQL($sqlYEAR)->w_wert; $newValue = $YEARValue * (1 + $this->for_for_faktor->Text / 100); //$sqlMONTH = "SELECT w_wert FROM tt_werte WHERE w_jahr = ".$year_idta_periode." AND w_monat = ".PeriodenRecord::finder()->findByPK($Season->idta_periode)->per_intern." AND idtm_struktur = ".$Element->idtm_struktur." AND w_id_variante = ".$idta_variante." AND idta_feldfunktion = ".$Field; $year_to_idta_periode = $this->getYearByMonth($value); if (count(WerteRecord::finder()->find('w_jahr = ? AND w_monat = ? AND idtm_struktur = ? AND w_id_variante = ? AND idta_feldfunktion = ?', $year_to_idta_periode, $value, $Element->idtm_struktur, $to_idta_variante, $Field))) { $RecordToUpdate = WerteRecord::finder()->find('w_jahr = ? AND w_monat = ? AND idtm_struktur = ? AND w_id_variante = ? AND idta_feldfunktion = ?', $year_to_idta_periode, $value, $Element->idtm_struktur, $to_idta_variante, $Field); if ($RecordToUpdate->w_wert != $newValue) { $RecordToUpdate->w_wert = $newValue; $RecordToUpdate->save(); } } else { $RecordToWrite = new WerteRecord(); $RecordToWrite->w_jahr = $year_to_idta_periode; $RecordToWrite->w_monat = $value; $RecordToWrite->idtm_struktur = $Element->idtm_struktur; $RecordToWrite->w_id_variante = $to_idta_variante; $RecordToWrite->w_wert = $newValue; $RecordToWrite->idta_feldfunktion = $Field; $RecordToWrite->w_dimkey = $this->build_DIMKEY($Element->idtm_struktur); $RecordToWrite->save(); } } foreach ($FieldsToKeep as $Field) { $year_idta_periode = $this->getYearByMonth($key); $sqlYEAR = "SELECT w_wert FROM tt_werte WHERE w_jahr = " . $year_idta_periode . " AND w_monat = " . $key . " AND idtm_struktur = " . $Element->idtm_struktur . " AND w_id_variante = " . $idta_variante . " AND idta_feldfunktion = " . $Field; $YEARValue = WerteRecord::finder()->findBySQL($sqlYEAR)->w_wert; $newValue = $YEARValue; //$sqlMONTH = "SELECT w_wert FROM tt_werte WHERE w_jahr = ".$year_idta_periode." AND w_monat = ".PeriodenRecord::finder()->findByPK($Season->idta_periode)->per_intern." AND idtm_struktur = ".$Element->idtm_struktur." AND w_id_variante = ".$idta_variante." AND idta_feldfunktion = ".$Field; $year_to_idta_periode = $this->getYearByMonth($value); if (count(WerteRecord::finder()->find('w_jahr = ? AND w_monat = ? AND idtm_struktur = ? AND w_id_variante = ? AND idta_feldfunktion = ?', $year_to_idta_periode, $value, $Element->idtm_struktur, $to_idta_variante, $Field))) { $RecordToUpdate = WerteRecord::finder()->find('w_jahr = ? AND w_monat = ? AND idtm_struktur = ? AND w_id_variante = ? AND idta_feldfunktion = ?', $year_to_idta_periode, $value, $Element->idtm_struktur, $to_idta_variante, $Field); $RecordToUpdate->w_wert = $newValue; $RecordToUpdate->save(); } else { $RecordToWrite = new WerteRecord(); $RecordToWrite->w_jahr = $year_to_idta_periode; $RecordToWrite->w_monat = $value; $RecordToWrite->idtm_struktur = $Element->idtm_struktur; $RecordToWrite->w_id_variante = $to_idta_variante; $RecordToWrite->w_wert = $newValue; $RecordToWrite->idta_feldfunktion = $Field; $RecordToWrite->w_dimkey = $this->build_DIMKEY($Element->idtm_struktur); $RecordToWrite->save(); } } } } }
public function saveStrukturBericht($sender, $param) { $mySession = ""; $mySession = UserFelderRecord::finder()->findAllBy_user_id($this->User->getUserId($this->User->Name)); foreach ($mySession as $myFieldRecord) { $arr_newValues = array(); //very important!!! otherwise we have values which dont exist $arr_MyFields = array(); $uniqueID = $myFieldRecord->tuf_feldname; //lets start the saving //$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'; //$SaveString = $jahr."xxx".$monat."xxx".$local_ff."xxx".$local_id; definition of the string to pass $arr_MyFields = preg_split("/xxx/", $uniqueID); $tt_per_year = $arr_MyFields[1]; $tt_per_month = $arr_MyFields[2]; $tt_idta_struktur_type = $arr_MyFields[3]; $tt_idta_feldfunktion = $arr_MyFields[4]; $tt_idtm_struktur = $arr_MyFields[5]; $tt_idta_variante = $arr_MyFields[6]; //abrufen des aktuellen DB-Wertes $ExistingValue = WerteRecord::finder()->findBySql("SELECT w_wert FROM tt_werte WHERE idtm_struktur = '" . $tt_idtm_struktur . "' AND idta_feldfunktion = '" . $tt_idta_feldfunktion . "' AND w_jahr = '" . $tt_per_year . "' AND w_monat = '" . $tt_per_month . "' AND w_id_variante = '" . $tt_idta_variante . "' LIMIT 1"); //formatieren, damit es mit dem inhalt aus der zelle vergleichbar wird //CHECKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK if (is_Object($ExistingValue)) { $CompareValue = number_format($ExistingValue->w_wert, 2, '.', ''); } else { $CompareValue = "0.00"; } //here I start the magic server calculation;) if ($CompareValue === $this->page->ACTPanel->FindControl($uniqueID)->Text) { } else { $ObjSaver = new PFBackCalculator(); $ObjSaver->setVariante($tt_idta_variante); $ObjSaver->setStartPeriod($tt_per_month); $ObjSaver->setStartNode($tt_idtm_struktur); //$SaveString = $tt_per_year."xxx".$tt_per_month."xxx".$tt_idta_feldfunktion."xxx".$tt_idtm_struktur; //$NEWWerteRecord = WerteRecord::finder()->findBySql("SELECT * FROM tt_werte WHERE idtm_struktur = '".$tt_idtm_struktur."' AND idta_feldfunktion = '".$tt_idta_feldfunktion."' AND w_jahr = '".$tt_per_year."' AND w_monat = '".$tt_per_month."' AND w_id_variante = '".$tt_idta_variante."' LIMIT 1"); $arr_newValues[$tt_idta_feldfunktion] = $this->page->ACTPanel->FindControl($uniqueID)->Text; $ObjSaver->setNewValues($arr_newValues); $ObjSaver->run(); unset($ObjSaver); } } $sender->Text = "Saved"; }
private function update_DIMKEY($strukturID, $dimKey) { $Results = WerteRecord::finder()->findAllByidtm_struktur($strukturID); foreach ($Results as $Row) { $Record = WerteRecord::finder()->findByidtt_werte($Row->idtt_werte); $Record->w_dimkey = $dimKey; $Record->save(); } }
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 }
public function deleteButtonClicked($sender, $param) { $tempus = 'ed' . $this->primarykey; foreach ($this->finder->findAllByparent_idtm_struktur($this->{$tempus}->Value) as $TRec) { WerteRecord::finder()->deleteAll('idtm_struktur = ?', $TRec->idtm_struktur); } WerteRecord::finder()->deleteAll('idtm_struktur = ?', $this->{$tempus}->Value); $this->finder->deleteAll('parent_idtm_struktur = ?', $this->{$tempus}->Value); $this->finder->deleteAll('idtm_struktur = ?', $this->{$tempus}->Value); $this->Response->redirect($this->getRequest()->constructUrl('page', $this->exitURL)); }
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 calcOpeningBalance($local_ff, $local_id) { $key = 0; //init of the variable $temp_periode = 0; //init of the variable foreach ($this->Perioden as $tmpPeriode) { $key = $tmpPeriode[0]; $my_jahr = $this->getYearByMonth($key); $temp_periode = $this->getPeriodeBefore($key); if ($temp_periode < 10000 and $key < 10000) { $trecord = FeldfunktionRecord::finder()->findByidta_feldfunktion($local_ff); $jahr = $this->getYearByMonth($temp_periode); $PreviousString = $jahr . "xxx" . $temp_periode . "xxx" . $trecord->pre_idta_feldfunktion . "xxx" . $local_id; if (isset($this->TTWERTE[$PreviousString]) and $jahr == $my_jahr) { $valuefillin = number_format($this->TTWERTE[$PreviousString], 2, '.', ''); } else { $valuefillin = WerteRecord::finder()->findAllBySql("SELECT w_wert FROM tt_werte WHERE idtm_struktur = '" . $local_id . "' AND idta_feldfunktion = '" . $trecord->pre_idta_feldfunktion . "' AND w_jahr = '" . $jahr . "' AND w_monat = '" . $temp_periode . "' AND w_id_variante = '" . $this->GLOBALVARIANTE . "' LIMIT 1"); } $this->update_w_wert($my_jahr, $key, $local_ff, $local_id, $valuefillin); $this->check_collector($local_ff, $key, $my_jahr, $local_id); } else { $jahr = $temp_periode; //pruefung ob 10001 nicht vergessen if ($my_jahr == 10001) { if ($key > 12 and $key < 10000) { $jahr += 1; $temp_periode += 1; } $PreviousString = $jahr . "xxx" . $temp_periode . "xxx" . $local_ff . "xxx" . $local_id; if (isset($this->TTWERTE[$PreviousString])) { $valuefillin = number_format($this->TTWERTE[$PreviousString], 2, '.', ''); } else { $valuefillin = number_format(0, 2, '.', ''); } //echo "Sp8x"; $this->update_w_wert($my_jahr, $key, $local_ff, $local_id, $valuefillin); $this->check_collector($local_ff, $key, $my_jahr, $local_id); } else { $jahr = $this->getYearByMonth($temp_periode); $ttrecord = FeldfunktionRecord::finder()->findByidta_feldfunktion($local_ff); $myWerteString = $jahr . "xxx" . $temp_periode . "xxx" . $local_ff . "xxx" . $local_id; if (isset($this->TTWERTE[$myWerteString]) and $jahr == $my_jahr) { $valuefillin = number_format($this->TTWERTE[$myWerteString], 2, '.', ''); } else { $ResultWert = WerteRecord::finder()->findBySql("SELECT w_wert FROM tt_werte WHERE idtm_struktur = '" . $local_id . "' AND idta_feldfunktion = '" . $ttrecord->pre_idta_feldfunktion . "' AND w_jahr = '" . $jahr . "' AND w_monat = '" . $jahr . "' AND w_id_variante = '" . $this->GLOBALVARIANTE . "' LIMIT 1"); if (is_object($ResultWert)) { $valuefillin = number_format($ResultWert->w_wert, 2, '.', ''); } else { $valuefillin = number_format(0, 2, '.', ''); } } //echo "Sp9x"; $this->update_w_wert($my_jahr, $key, $local_ff, $local_id, $valuefillin); $this->check_collector($local_ff, $key, $my_jahr, $local_id); } } } }