SetY(-15); $this->SetFont('Arial', 'I', 9); $this->SetTextColor(100, 100, 100); $this->Cell(0, 10, 'Page ' . $this->PageNo() . '/{nb}', 0, 0, 'C'); $this->SetTextColor(0); } } class ControleurAjaxstatsmaladiefichetechniqueseptpdf extends Controleur { private $detailsp; private $pdf; private $maxLinesPerPage = 25; // Nombre maximum de lignes par page public function __construct() { $this->detailsp = new Statistique(); } // Méthode Footer pour la numérotation des pages private function addFooter() { $this->pdf->SetY(-15); $this->pdf->SetFont('Arial', 'I', 8); $this->pdf->Cell(0, 10, 'Page ' . $this->pdf->PageNo() . '/{nb}', 0, 0, 'C'); } // Méthode pour vérifier si on doit ajouter une nouvelle page private function checkPageBreak($currentLine, $lineHeight = 7) { // Vérifier le nombre maximum de lignes par page if ($currentLine >= $this->maxLinesPerPage) { $this->addNewPage(); return true; } // Vérifier si on dépasse la hauteur de page (marge basse incluse) $yPosition = $this->pdf->GetY(); if ($yPosition + $lineHeight > 280) { // 297mm - marge basse $this->addNewPage(); return true; } return false; } // Méthode pour ajouter une nouvelle page avec en-tête private function addNewPage() { $this->pdf->AddPage('L'); // Réafficher l'en-tête du tableau sur les nouvelles pages $this->displayTableHeader(); } // Méthode pour afficher l'en-tête du tableau private function displayTableHeader() { $hl = 7; $this->pdf->SetFont('Arial', '', 7); $this->pdf->SetFillColor(182, 216, 242); $this->pdf->Cell(15, $hl, convertirc(_('Matricule')), 1, 0, 'C', true); $this->pdf->Cell(60, $hl, convertirc(_("Famille")), 1, 0, 'C', true); $this->pdf->Cell(16, $hl, convertirc(_("Janvier")), 1, 0, 'C', true); $this->pdf->Cell(16, $hl, convertirc(_("Février")), 1, 0, 'C', true); $this->pdf->Cell(15, $hl, convertirc(_("Mars")), 1, 0, 'C', true); $this->pdf->Cell(15, $hl, convertirc(_("Avril")), 1, 0, 'C', true); $this->pdf->Cell(15, $hl, convertirc(_("Mai")), 1, 0, 'C', true); $this->pdf->Cell(15, $hl, convertirc(_("Juin")), 1, 0, 'C', true); $this->pdf->Cell(16, $hl, convertirc(_("Juillet")), 1, 0, 'C', true); $this->pdf->Cell(15, $hl, convertirc(_("Août")), 1, 0, 'C', true); $this->pdf->Cell(16, $hl, convertirc(_("Septembre")), 1, 0, 'C', true); $this->pdf->Cell(16, $hl, convertirc(_("Octobre")), 1, 0, 'C', true); $this->pdf->Cell(16, $hl, convertirc(_("Novembre")), 1, 0, 'C', true); $this->pdf->Cell(16, $hl, convertirc(_("Décembre")), 1, 0, 'C', true); $this->pdf->Cell(16, $hl, convertirc(_("Totaux")), 1, 1, 'C', true); } // Méthode pour créer l'en-tête du document private function createDocumentHeader($entete, $debutStat, $finStat, $depenses, $idPolice, $codeGcAssureur) { $this->pdf->SetMargins(10, 10, 10); $this->pdf->Image($_SESSION['lienLogo'], 140, 3, 15); $this->pdf->SetFont('Arial', 'B', 7); $this->pdf->Cell(0, 5, convertirc(_('FICHE TECHNIQUE No 7')), 0, 1, 'L', false); $this->pdf->SetY(10); $this->pdf->SetFont('Arial', '', 7); $this->pdf->Cell(0, 5, convertirc(_('Edition du') . ': ' . heureCouranteLang($_SESSION['lang'])), 0, 1, 'R', false); $this->pdf->Ln(2); $this->pdf->SetFont('Arial', 'B', 13); $this->pdf->SetFillColor(182, 216, 242); $this->pdf->Cell(0, 8, convertirc(_("EVOLUTION MENSUELLE DES DEPENSES PAR FAMILLE D'ASSURE")), 1, 0, 'C', true); $this->pdf->Ln(8); $this->pdf->SetFont('Arial', 'B', 11); $this->pdf->SetTextColor(0); $this->pdf->Ln(8); $this->pdf->Cell(0, 6, convertirc(_('PERIODE COMPTABLE CONSIDEREE') . ' : ' . dateLang($debutStat, $_SESSION['lang']) . ' ' . _('AU') . ' ' . dateLang($finStat, $_SESSION['lang'])), 0, 1, 'C', false); if ($idPolice != null) { $this->pdf->Ln(8); $this->pdf->SetFont('Arial', 'BUI', 11); $this->pdf->Cell(35, 8, convertirc(_('GARANT') . ': '), 0, 0, 'L', false); $this->pdf->SetFont('Arial', 'BI', 11); $this->pdf->Cell(0, 8, convertirc($entete['garant']), 0, 1, 'L', false); $this->pdf->SetFont('Arial', 'BUI', 11); $this->pdf->Cell(35, 8, convertirc(_('SOUSCRIPTEUR') . ': '), 0, 0, 'L', false); $this->pdf->SetFont('Arial', 'BI', 11); $this->pdf->Cell(0, 8, convertirc($entete['souscripteur']), 0, 1, 'L', false); $this->pdf->SetFont('Arial', 'BUI', 11); $this->pdf->Cell(35, 8, convertirc(_('POLICE No') . ': '), 0, 0, 'L', false); $this->pdf->SetFont('Arial', 'BI', 11); $this->pdf->Cell(0, 8, convertirc($entete['numeroPolice'] . ' / ' . $entete['libellePolice']), 0, 1, 'L', false); $this->pdf->SetFont('Arial', 'BUI', 11); $this->pdf->Cell(35, 8, convertirc(_('COURTIER') . ': '), 0, 0, 'L', false); $this->pdf->SetFont('Arial', 'BI', 11); $this->pdf->Cell(0, 8, convertirc($entete['courtier']), 0, 1, 'L', false); } else { $this->pdf->Ln(8); $this->pdf->SetFont('Arial', 'BUI', 11); $this->pdf->Cell(35, 8, convertirc(_('GARANT') . ': '), 0, 0, 'L', false); $this->pdf->SetFont('Arial', 'BI', 11); $this->pdf->Cell(0, 8, convertirc($codeGcAssureur), 0, 1, 'L', false); } $this->pdf->Ln(4); $this->pdf->SetX(65); $this->pdf->Cell(170, 6, convertirc(_('DEPENSES SUPERIEURES A') . ': ' . format_N($depenses) . ' ' . $_SESSION['devise_C']), 1, 1, 'C', false); $this->pdf->Ln(2); } public function index() { // Vérification 1: Données de base nécessaires $idPolice = $this->requete->getParametreFormulaire("idPolice"); $debutStat = $this->requete->getParametreDate("debutStat"); $finStat = $this->requete->getParametreDate("finStat"); $depenses = $this->requete->getParametreFormulaire("depenses", "numerique"); if ($idPolice == '') { $idPolice = null; } // Vérification des données avant création PDF if (empty($debutStat) || empty($finStat) || empty($idPolice)) { echo '