public function addAdresse($sender, $param) { if ($this->RCedorganisation_edit_status->Text == '0') { $this->RCSavedButtonClicked($sender, $param); } $Adresse = new AdresseRecord(); $Adresse->adresse_ismain = $this->RCedadresse_ismain->Checked ? 1 : 0; $Adresse->adresse_street = $this->RCedadresse_street->Text; $Adresse->adresse_town = $this->RCedadresse_town->Text; $Adresse->adresse_zip = $this->RCedadresse_zip->Text; //lets add the coordinates $myGTranslator = new GoogleAdressTranslator(); $mapparams = $myGTranslator->getLatAndLong(implode(",", array($this->RCedadresse_street->Text, $this->RCedadresse_town->Text))); $myLatandLong = explode(",", $mapparams); //here we check, if the coordinates have been found if ($myLatandLong[1] != 0) { $Adresse->adresse_lat = $myLatandLong[1]; $Adresse->adresse_long = $myLatandLong[0]; } else { $Adresse->adresse_lat = 0.0; $Adresse->adresse_long = 0.0; } $Adresse->idtm_country = 1; $Adresse->save(); $OrganisationAdresse = new OrganisationAdresseRecord(); $OrganisationAdresse->idta_adresse = $Adresse->idta_adresse; $OrganisationAdresse->idtm_organisation = $this->RCedidtm_organisation->Text; $OrganisationAdresse->save(); $this->bindListAdress(); }
private function ProtokollHeader($idtm_organisation) { $komType = array(1 => 'Telefon', 'Fax', 'Mail'); $Organisation = OrganisationRecord::finder()->findBy_idtm_organisation($idtm_organisation); //Criteria for selection in joins $criteria = new TActiveRecordCriteria(); $criteria->Condition = "idtm_organisation = :suchtext"; $criteria->Parameters[':suchtext'] = $idtm_organisation; $this->pdf->SetY(38); //$this->pdf->SetX(20); $this->pdf->SetFillColor(234, 242, 220); $this->pdf->SetDrawColor(234, 242, 220); $this->pdf->SetFont('Helvetica', 'B', 12); $this->pdf->Cell(185, 6, utf8_decode($Organisation->org_name) . ' ' . utf8_decode($Organisation->org_vorname), 1, 0, 'B', 1); $this->pdf->Ln(7); //$this->pdf->SetX(28); $this->pdf->SetFont('Arial', '', 10); $this->pdf->Cell(30, 5, 'Matchcode: ', 0); $this->pdf->SetFont('Arial', 'B', 10); $this->pdf->Cell(60, 5, utf8_decode($Organisation->org_matchkey), 0); $this->pdf->Ln(); //$this->pdf->SetX(20); $this->pdf->SetFillColor(234, 242, 220); $this->pdf->SetDrawColor(234, 242, 220); $this->pdf->SetFont('Arial', 'B', 12); $this->pdf->Cell(185, 6, 'Adressen ', 1, 0, 'B', 1); $this->pdf->Ln(7); $Adressen = OrganisationAdresseRecord::finder()->findAll($criteria); foreach ($Adressen as $Adresse) { $Adr = AdresseRecord::finder()->findByidta_adresse($Adresse->idta_adresse); $this->pdf->SetX(20); $this->pdf->SetFont('Arial', '', 10); $this->pdf->Cell(20, 5, utf8_decode($Adr->adresse_zip), 0); $this->pdf->SetFont('Arial', '', 10); $this->pdf->Cell(60, 5, utf8_decode($Adr->adresse_town), 0); $this->pdf->SetFont('Arial', '', 10); $this->pdf->Cell(60, 5, utf8_decode($Adr->adresse_street), 0); $this->pdf->Ln(); unset($Adr); } //$this->pdf->SetX(20); $this->pdf->SetFillColor(234, 242, 220); $this->pdf->SetDrawColor(234, 242, 220); $this->pdf->SetFont('Arial', 'B', 12); $this->pdf->Cell(185, 6, 'Kommunikation ', 1, 0, 'B', 1); $this->pdf->Ln(7); $criteria->OrdersBy["idtm_organisation"] = 'asc'; $Kommunikation = KommunikationRecord::finder()->findAll($criteria); foreach ($Kommunikation as $Komm) { $this->pdf->SetX(20); $this->pdf->SetFont('Arial', '', 10); $this->pdf->Cell(30, 5, utf8_decode($komType[$Komm->kom_type]), 0); $this->pdf->SetFont('Arial', 'B', 10); $this->pdf->Cell(60, 5, utf8_decode($Komm->kom_information), 0); $this->pdf->Ln(); } }
private function importPARTEI($data) { $Organisation = OrganisationRecord::finder()->findorg_fk_internal("HTC" . trim($data[0])); if (count($Organisation) != 1) { $Organisation = new OrganisationRecord(); } $Organisation->org_fk_internal = trim("HTC" . trim($data[0])); $Organisation->parent_idtm_organisation = OrganisationRecord::finder()->findByorg_fk_internal('08500')->idtm_organisation; $Organisation->idta_organisation_type = 8; $Organisation->idtm_ressource = 1; $Organisation->org_anrede = utf8_encode($data[3]); $Organisation->org_briefanrede = utf8_encode(""); $Organisation->org_name = utf8_encode($data[1]); $Organisation->org_vorname = utf8_encode($data[2]); $Organisation->org_name1 = utf8_encode(""); $Organisation->org_matchkey = utf8_encode($data[1] . " " . $data[2]); $Organisation->org_uid = ""; $Organisation->org_aktiv = $data[19] == "ja" ? 1 : 0; $Organisation->save(); //Bankkonto laden $Bankkonto = BankkontoRecord::finder()->findByidtm_organisation($Organisation->idtm_organisation); if (count($Bankkonto) != 1) { $Bankkonto = new BankkontoRecord(); } $Bankkonto->idtm_organisation = $Organisation->idtm_organisation; //$Bankkonto->bak_kontowortlaut = utf8_encode($data["38"]); $Bankkonto->bak_geldinstitut = utf8_encode(""); $Bankkonto->bak_blz = ""; $Bankkonto->bak_konto = ""; $Bankkonto->bak_bic = ""; $Bankkonto->bak_iban = ""; $Bankkonto->save(); //Kommunikation 1 Telefon $Kommunikation = KommunikationRecord::finder()->find("kom_type = 1 AND kom_ismain = 1 AND idtm_organisation = ?", $Organisation->idtm_organisation); if (count($Kommunikation) != 1) { $Kommunikation = new KommunikationRecord(); } $Kommunikation->kom_type = 1; $Kommunikation->kom_information = $data[9]; $Kommunikation->kom_ismain = 1; $Kommunikation->idtm_organisation = $Organisation->idtm_organisation; $Kommunikation->save(); //Kommunikation 1 Fax2 $Kommunikation = KommunikationRecord::finder()->find("kom_type = 2 AND kom_ismain = 1 AND idtm_organisation = ?", $Organisation->idtm_organisation); if (count($Kommunikation) != 1) { $Kommunikation = new KommunikationRecord(); } $Kommunikation->kom_type = 2; $Kommunikation->kom_information = $data[10]; $Kommunikation->kom_ismain = 1; $Kommunikation->idtm_organisation = $Organisation->idtm_organisation; $Kommunikation->save(); //Kommunikation 1 Mail $Kommunikation = KommunikationRecord::finder()->find("kom_type = 3 AND kom_ismain = 1 AND idtm_organisation = ?", $Organisation->idtm_organisation); if (count($Kommunikation) != 1) { $Kommunikation = new KommunikationRecord(); } $Kommunikation->kom_type = 3; $Kommunikation->kom_information = $data[11]; $Kommunikation->kom_ismain = 1; $Kommunikation->idtm_organisation = $Organisation->idtm_organisation; $Kommunikation->save(); //adresse 1 $sql = "SELECT ta_adresse.* FROM ta_adresse INNER JOIN tm_organisation_has_ta_adresse ON ta_adresse.idta_adresse = tm_organisation_has_ta_adresse.idta_adresse WHERE tm_organisation_has_ta_adresse.idtm_organisation = " . $Organisation->idtm_organisation . " AND ta_adresse.adresse_ismain = 1"; $Adresse = AdresseRecord::finder()->findBySQL($sql); if (count($Adresse) != 1) { $Adresse = new AdresseRecord(); } $Adresse->adresse_street = utf8_encode($data[6]); $Adresse->adresse_zip = $data[7]; $Adresse->adresse_town = $data[8]; $Adresse->adresse_ismain = 1; $Adresse->idtm_country = 1; $Adresse->save(); $OrganisationAdresse = OrganisationAdresseRecord::finder()->find('idtm_organisation = ? AND idta_adresse = ?', $Organisation->idtm_organisation, $Adresse->idta_adresse); if (count($OrganisationAdresse) != 1) { $OrganisationAdresse = new OrganisationAdresseRecord(); } $OrganisationAdresse->idta_adresse = $Adresse->idta_adresse; $OrganisationAdresse->idtm_organisation = $Organisation->idtm_organisation; $OrganisationAdresse->save(); unset($Organisation, $Bankkonto, $Kommunikation, $Adresse, $OrganisationAdresse, $sql); }
private function importOBJ($data) { $Organisation = OrganisationRecord::finder()->findByorg_fk_internal(trim($data[6])); if (count($Organisation) != 1) { $Organisation = new OrganisationRecord(); } $Organisation->org_fk_internal = trim($data["6"]); $Organisation->parent_idtm_organisation = OrganisationRecord::finder()->findByorg_fk_internal('Objekt')->idtm_organisation; $Organisation->idtm_ressource = 1; $Organisation->idta_organisation_type = 7; $Organisation->org_name = utf8_encode($data["7"]); $Organisation->org_matchkey = $data["4"]; $Organisation->org_uid = $data["18"]; $Organisation->org_finanzamt = $data["19"]; $Organisation->org_referat = $data["20"]; $Organisation->org_gemeinde = $data["23"]; $Organisation->org_katastragemeinde = $data["24"]; $Organisation->org_grundstuecksnummer = $data["25"]; $Organisation->org_einlagezahl = $data["26"]; $Organisation->org_baujahr = $data["27"]; $Organisation->org_wohnungen = $data["28"]; $Organisation->org_aktiv = 1; $Organisation->save(); $Bankkonto = BankkontoRecord::finder()->findByidtm_organisation($Organisation->idtm_organisation); if (count($Bankkonto) != 1) { $Bankkonto = new BankkontoRecord(); } $Bankkonto->idtm_organisation = $Organisation->idtm_organisation; $Bankkonto->bak_kontowortlaut = $data["10"]; $Bankkonto->bak_geldinstitut = $data["11"]; $Bankkonto->bak_blz = $data["12"]; $Bankkonto->bak_konto = $data["13"]; $Bankkonto->bak_bic = $data["14"]; $Bankkonto->bak_iban = $data["15"]; $Bankkonto->save(); $sql = "SELECT ta_adresse.* FROM ta_adresse INNER JOIN tm_organisation_has_ta_adresse ON ta_adresse.idta_adresse = tm_organisation_has_ta_adresse.idta_adresse WHERE tm_organisation_has_ta_adresse.idtm_organisation = " . $Organisation->idtm_organisation . " AND ta_adresse.adresse_ismain = 1"; $Adresse = AdresseRecord::finder()->findBySQL($sql); if (count($Adresse) != 1) { $Adresse = new AdresseRecord(); } $Adresse->adresse_street = utf8_encode($data["8"]); $Adresse->adresse_town = $data["9"]; $Adresse->adresse_ismain = 1; $Adresse->idtm_country = 1; $Adresse->save(); $OrganisationAdresse = OrganisationAdresseRecord::finder()->find('idtm_organisation = ? AND idta_adresse = ?', $Organisation->idtm_organisation, $Adresse->idta_adresse); if (count($OrganisationAdresse) != 1) { $OrganisationAdresse = new OrganisationAdresseRecord(); } $OrganisationAdresse->idta_adresse = $Adresse->idta_adresse; $OrganisationAdresse->idtm_organisation = $Organisation->idtm_organisation; $OrganisationAdresse->save(); unset($Organisation, $Bankkonto, $Adresse, $OrganisationAdresse, $sql); }