garant/Controleur/ControleurAjaximprimerdemandereglement.php
2025-12-05 10:57:03 +00:00

248 lines
8.6 KiB
PHP
Executable File

<?php
require_once 'Framework/Controleurrequete.php';
require_once 'Modele/Reglement.php';
class ControleurAjaximprimerdemandereglement extends Controleurrequete
{
private $reglement;
public function __construct()
{
$this->reglement = new Reglement();
}
public function index()
{
$idReglement = $_SESSION['idReglement_C'];
$numeroDecompte = $_SESSION['numeroDecompte_C'];
$reglement = $this->reglement->getreglement($idReglement);
$pdf = new FPDF();
$pdf->AliasNbPages();
$pdf->AddPage();
$ht=10;
$lg=60;
$pdf->SetMargins(10, 10, 10) ;
$pdf->SetFont('Arial','B', 15);
$pdf->SetY(30);
$pdf->Cell(0,10,convertirc("RADIANT INSURANCE COMPANY "),1,1,'C',false);
$pdf->Ln(10);
$pdf->SetFont('Arial','BU', 15);
$pdf->SetFontSize(12);
$pdf->Cell(0,10,convertirc("DEMANDE DE REGLEMENT POUR DECOMPTE N° ".$reglement['numeroDecompte']),0,1,'C',false);
$pdf->Ln(10);
$pdf->SetFont('Arial','B', 12);
$pdf->Cell($lg,10,convertirc("PRESTATAIRE"),0,0,'L',false);
$pdf->SetFont('Arial','I',12);
$pdf->Cell(0,10,convertirc(': '.$reglement['prestataire']),0,1,'L');
$pdf->SetFont('Arial','B', 12);
$pdf->Cell($lg,10,convertirc("MONTANT EN CHIFFRE"),0,0,'L',false);
$pdf->SetFont('Arial','I',12);
$pdf->Cell(0,10,": ".format_N($reglement['montantApayer']).convertirc(' FRW'),0,1,'L');
$pdf->SetFont('Arial','B', 12);
$pdf->Cell($lg,10,convertirc("MONATANT EN LETTRE"),0,0,'L',false);
$pdf->SetFont('Arial','I',12);
$pdf->Cell(0,10,": ".asLetters($reglement['montantApayer']).convertirc(' FRW'),0,1,'L');
$pdf->SetFont('Arial','B', 12);
$pdf->Cell($lg,10,convertirc("SERVICE DEMANDEUR"),0,0,'L',false);
$pdf->SetFont('Arial','I',12);
$pdf->Cell(0,10,convertirc(": DIRECTION MEDICARE"),0,1,'L');
$pdf->SetFont('Arial','B', 12);
$pdf->Cell($lg,10,convertirc("A VERSER AU COMPTE N°"),0,0,'L',false);
$pdf->SetFont('Arial','I',12);
$pdf->Cell(0,10,convertirc(":"),0,1,'L');
$pdf->SetFont('Arial','B', 12);
$pdf->Cell($lg,10,convertirc("SUR"),0,0,'L',false);
$pdf->SetFont('Arial','I',12);
$pdf->Cell(0,10,convertirc(":"),0,1,'L');
$pdf->Ln(10);
$pdf->Cell(0,10,convertirc('Fait à KIGALI, le ').heureCourante(),0,1,'C',false);
$pdf->Ln(10);
$pdf->SetFont('Arial','B', 12);
$pdf->Cell($lg,10,convertirc("VISA DIRECTION MEDICARE"),0,0,'L',false);
$pdf->Cell(0,10,convertirc("VISA DAF"),0,1,'R');
$pdf->Ln(20);
$pdf->SetFont('Arial','I',12);
$pdf->Cell(0,10,convertirc("Chèque N° :"),0,1,'L');
$pdf->Cell(0,10,convertirc("Sur :"),0,1,'L');
$pdf->SetFont('Arial','BU', 15);
$pdf->SetFontSize(12);
$pdf->Cell(0,20,convertirc("REMISE CHEQUE"),0,1,'C',false);
$pdf->SetFont('Arial','I',12);
$pdf->Cell(0,10,convertirc("Nom et Prénoms :"),0,1,'L');
$pdf->Cell(0,10,convertirc("Carte d'identité N° :"),0,1,'L');
$pdf->Cell(0,10,convertirc("Délivrée à :"),0,1,'L');
$pdf->Cell(0,10,convertirc("Siganture :"),0,1,'L');
$fichier="Temp/demande_regelement"."_".uniqid().".pdf";
$pdf->Output($fichier,"F");
$t_html =' <div id ="div_wait" class="alert alert-info"> ';
$t_html .=' <a style="font-size:15pt;" href="'.$fichier.'" target="_blank" > '._("TELECHARGER").' </a> ';
$t_html .=' </div ';
echo $t_html;
}
public function imprimerbordereaudecompte()
{
$idReglement = $_SESSION['idReglement_C'];
$numeroDecompte = $_SESSION['numeroDecompte_C'];
$reglement = $this->reglement->getreglement($idReglement);
$codeTypePrestataire = $reglement['codeTypePrestataire'];
if($codeTypePrestataire=="CSO")
{
$factures = $this->reglement->getdetaildecompteexportcso($numeroDecompte);
}
elseif($codeTypePrestataire=="PHA")
{
$factures = $this->reglement->getdetaildecompteexportpha($numeroDecompte);
}
elseif($codeTypePrestataire=="OPT")
{
$factures = $this->reglement->getdetaildecompteexportopt($numeroDecompte);
}
elseif($codeTypePrestataire=="LAB")
{
$factures = $this->reglement->getdetaildecompteexportlab($numeroDecompte);
}
elseif($codeTypePrestataire=="SEA")
{
$factures = $this->reglement->getdetaildecompteexportsea($numeroDecompte);
}
$pdf = new FPDF('L');
$pdf->AliasNbPages();
$pdf->AddPage();
$ht=4;
$pdf->SetMargins(10, 10, 10) ;
$pdf->SetFont('Arial','BI', 7);
$pdf->Cell(0,$ht,convertirc("RADIANT INSURANCE COMPANY : KIGALI"),0,0,'L',false);
$pdf->Cell(0,$ht,convertirc("BORDERAU POUR DECOMPTE N° ".$reglement['numeroDecompte']." => "."PRESTATAIRE ".$reglement['prestataire']),0,1,'R',false);
$pdf->SetFont('Arial','', 7);
$pdf->Cell(60,$ht,convertirc('Edité le : '.heureCourante()),0,0,'L',false);
$pdf->Cell(60,$ht,convertirc($reglement['etatdecompte']),0,0,'C',false);
$pdf->Cell(60,$ht,convertirc("PERIODE : ".$reglement['periode']),0,0,'C',false);
$pdf->Cell(0,$ht,convertirc('No Lot : '.$reglement['numeroLotDecompte']),0,1,'R',false);
$pdf->SetFont('Arial','', 6);
$pdf->Cell(7,$ht,convertirc(""),1,0,'C',false);
$pdf->Cell(7,$ht,convertirc("Dt"),1,0,'C',false);
$pdf->Cell(14,$ht,convertirc("Police"),1,0,'C',false);
$pdf->Cell(36,$ht,convertirc("Souscripteur"),1,0,'L',false);
$pdf->Cell(44,$ht,convertirc("Adhérent"),1,0,'L',false);
$pdf->Cell(14,$ht,convertirc("N° Bén"),1,0,'C',false);
$pdf->Cell(44,$ht,convertirc("Bénéficiaire"),1,0,'L',false);
$pdf->Cell(14,$ht,convertirc("Bon"),1,0,'C',false);
$pdf->Cell(17,$ht,convertirc("Actes Méd"),1,0,'R',false);
$pdf->Cell(17,$ht,convertirc("Méd & cons"),1,0,'R',false);
$pdf->Cell(17,$ht,convertirc("Coût"),1,0,'R',false);
$pdf->Cell(12,$ht,convertirc("TM"),1,0,'R',false);
$pdf->Cell(17,$ht,convertirc("Charge"),1,0,'R',false);
$pdf->Cell(17,$ht,convertirc("Retenu"),1,1,'R',false);
$ordre = "0";
$fraisReel_acte_med = "0";
$fraisReel_phar_cons = "0";
$fraisReel = "0";
$montantTm = "0";
$montantArembourser = "0";
$montantApayer = "0";
foreach ($factures as $facture)
{
$ordre++;
$pdf->Cell(7,$ht,$ordre,1,0,'C',false);
$pdf->Cell(7,$ht,$facture['jourFacture'],1,0,'C',false);
$pdf->Cell(14,$ht,convertirc($facture['numeroPolice']),1,0,'C',false);
$pdf->Cell(36,$ht,convertirc(substr($facture['souscripteur'], 0, 30)),1,0,'L',false);
// $pdf->Cell(44,$ht,convertirc(substr($facture['adherent'], 0, 30)),1,0,'L',false);
$pdf->Cell(44,$ht,substr($facture['adherent'], 0, 30),1,0,'L',false);
$pdf->Cell(14,$ht,convertirc($facture['numeroBeneficiaire']),1,0,'C',false);
// $pdf->Cell(44,$ht,convertirc(substr($facture['beneficiaire'], 0, 30)),1,0,'L',false);
$pdf->Cell(44,$ht,substr($facture['beneficiaire'], 0, 30),1,0,'L',false);
$pdf->Cell(14,$ht,convertirc($facture['numeroBon']),1,0,'C',false);
$pdf->Cell(17,$ht,format_N($facture['fraisReel_acte_med']),1,0,'R',false);
$pdf->Cell(17,$ht,format_N($facture['fraisReel_phar_cons']),1,0,'R',false);
$pdf->Cell(17,$ht,format_N($facture['fraisReel']),1,0,'R',false);
$pdf->Cell(12,$ht,format_N($facture['montantTm']),1,0,'R',false);
$pdf->Cell(17,$ht,format_N($facture['montantArembourser']),1,0,'R',false);
$pdf->Cell(17,$ht,format_N($facture['montantApayer']),1,1,'R',false);
$fraisReel_acte_med += $facture['fraisReel_acte_med'];
$fraisReel_phar_cons += $facture['fraisReel_phar_cons'];
$fraisReel += $facture['fraisReel'];
$montantTm += $facture['montantTm'];
$montantArembourser += $facture['montantArembourser'];
$montantApayer += $facture['montantApayer'];
}
$pdf->SetFont('Arial','B', 6);
$pdf->Cell(180,$ht,convertirc("TOTAUX : "),1,0,'C',false);
$pdf->Cell(17,$ht,format_N($fraisReel_acte_med),1,0,'R',false);
$pdf->Cell(17,$ht,format_N($fraisReel_phar_cons),1,0,'R',false);
$pdf->Cell(17,$ht,format_N($fraisReel),1,0,'R',false);
$pdf->Cell(12,$ht,format_N($montantTm),1,0,'R',false);
$pdf->Cell(17,$ht,format_N($montantArembourser),1,0,'R',false);
$pdf->Cell(17,$ht,format_N($montantApayer),1,1,'R',false);
$pdf->SetFontSize(8);
$pdf->Cell(0,6,convertirc('Imprimé par le prestataire / Printed by the provider'),0,1,'C',false);
$fichier="Temp/borderau_decompte"."_".uniqid().".pdf";
$pdf->Output($fichier,"F");
$t_html =' <div id ="div_wait" class="alert alert-info"> ';
$t_html .=' <a style="font-size:15pt;" href="'.$fichier.'" target="_blank" > '._("TELECHARGER").' </a> ';
$t_html .=' </div ';
echo $t_html;
}
}