/**
  * Edition du haut de la relance
  *
  * @return void
  */
 function editRelanceEntete()
 {
     $this->loadAllElements();
     $this->pdf->AddPage();
     $colonne1 = 10;
     $colonne2 = 120;
     $tab[$colonne1] = array("40" => "Auteur facture", $this->auteur["nom"], $this->auteur["adresse1"], $this->auteur["adresse2"], $this->auteur["cp"] . " " . $this->auteur["ville"]);
     $patient_adrr = $this->traitements($this->patient->adresse);
     //Destinataire de la facture
     $tab[$colonne2] = array("40" => "Patient", "n° AVS: " . $this->patient->avs, $this->patient->_view, $patient_adrr["group1"], $patient_adrr["group2"], $this->patient->cp . " " . $this->patient->ville);
     if (CAppUI::conf("ref_pays") != 2) {
         unset($tab[$colonne2][41]);
     }
     // Ecriture de C, D, E, F
     $this->pdf->setFont($this->font, '', 8);
     $x = $y = 0;
     foreach ($tab as $k => $v) {
         foreach ($v as $key => $value) {
             if ($value) {
                 if ($key == "40") {
                     $y = $key;
                     $x = 0;
                 }
                 $this->editCell($k, $y + $x, 30, $value);
                 $x = $key == "40" ? $x + 5 : $x + 3;
             }
         }
     }
     $this->editCell(20, $this->pdf->getY() + 20, 35, CAppUI::tr("CRelance.statut." . $this->relance->statut), "C", 1, 4);
     $this->pdf->setX(110);
     if (CAppUI::conf("ref_pays") == 2) {
         $this->pdf->Write(4, CAppUI::conf("dPfacturation CEditPdf home_ville", CGroups::loadCurrent()) . ", le " . CMbDT::format(CMbDT::date(), "%d %B %Y"));
     }
     $frais = 0;
     $messages = array(0 => "", 1 => "");
     $assurance_patient = $this->destinataire[0];
     $type = isset($assurance_patient->type_pec) ? "assur" : "patient";
     switch ($this->relance->statut) {
         case "first":
             $frais = CAppUI::conf("dPfacturation CRelance add_first_relance");
             $messages = explode('/*****/', CAppUI::conf("dPfacturation CRelance message_relance1_{$type}"));
             break;
         case "second":
             $frais = CAppUI::conf("dPfacturation CRelance add_second_relance");
             $messages = explode('/*****/', CAppUI::conf("dPfacturation CRelance message_relance2_{$type}"));
             break;
         case "third":
             $frais = CAppUI::conf("dPfacturation CRelance add_third_relance");
             $messages = explode('/*****/', CAppUI::conf("dPfacturation CRelance message_relance3_{$type}"));
             break;
     }
     if (count($messages) == 1) {
         $messages[1] = "";
     }
     $this->pdf->setXY(10, $this->pdf->getY() + 18);
     $this->pdf->Write(3, "Madame, Monsieur,");
     $this->pdf->setXY(10, $this->pdf->getY() + 8);
     $this->pdf->Write(4, $messages[0]);
     $y = 122;
     $col1 = 40;
     $col2 = 80;
     $col3 = 30;
     $this->pdf->setFont($this->fontb, '', 8);
     $this->editCell(20, $y, $col1, "Facture", "C", 1, 4);
     $this->editCell(20, $y + 4, $col1, "N°: " . $this->facture->_id, null, "LBR", 15);
     $this->editCell($this->pdf->getX(), $y, 80, "Désignation", "C", 1, 4);
     $this->editCell(60, $y + 4, $col2, "Du " . CMbDT::format($this->facture->cloture, "%d %B %Y"), null, "R", 5);
     $this->pdf->setFont($this->font, '', 8);
     $this->editCell(60, $y + 9, $col2, "Frais", null, "R", 4);
     $this->pdf->setFont($this->fontb, '', 8);
     $this->editCell(60, $y + 13, $col2, "Solde à payer", null, "BR", 6);
     $this->editCell($this->pdf->getX(), $y, 30, "Montant (CHF)", "C", 1, 4);
     $this->editCell(140, $y + 4, $col3, sprintf('%0.2f', $this->relance->_montant - $frais), "R", "R", 5);
     $this->pdf->setFont($this->font, '', 8);
     $this->editCell(140, $y + 9, $col3, sprintf('%0.2f', $frais), "R", "R", 4);
     $this->pdf->setFont($this->fontb, '', 8);
     $this->editCell(140, $y + 13, $col3, sprintf('%0.2f', $this->relance->_montant), "R", "BR", 6);
     $this->pdf->setFont($this->font, '', 8);
     $this->pdf->setXY(10, $this->pdf->getY() + 14);
     $this->pdf->Write(4, $messages[1]);
     $this->pdf->setXY(120, $this->pdf->getY() + 14);
     if (CAppUI::conf("ref_pays") == 2) {
         $this->pdf->Write(4, CAppUI::conf("dPfacturation CEditPdf home_nom", CGroups::loadCurrent()));
     }
     $this->pdf->setXY(120, $this->pdf->getY() + 4);
     $this->pdf->Write(3, "Service comptabilité");
 }