175 lines
5.2 KiB
PHP
175 lines
5.2 KiB
PHP
<?php
|
|
require_once 'Framework/Controleurrequete.php'; // OK
|
|
require_once 'Modele/Statistique.php';
|
|
|
|
class ControleurAjaxdetailrapportspgarantiemail extends Controleur
|
|
{
|
|
private $detailsp;
|
|
private $mail_C;
|
|
|
|
public function __construct() {
|
|
$this->detailsp = new Statistique();
|
|
require_once 'Framework/Ebenegmail.php';
|
|
$this->mail_C = $mail;
|
|
}
|
|
|
|
public function index()
|
|
{
|
|
|
|
$dateAnalyse = $_SESSION['dateAnalyse'];
|
|
|
|
$idPolice = $this->requete->getParametreFormulaire("idPolice");
|
|
|
|
$email = $this->requete->getParametreFormulaire("emailRapport");
|
|
|
|
$entete = $this->detailsp->detailrapportsppdfentete($idPolice);
|
|
|
|
$detailsps = $this->detailsp->detailrapportspgarantiepdf($idPolice);
|
|
|
|
$pdf = new FPDF();
|
|
|
|
$pdf->AliasNbPages();
|
|
$pdf->AddPage();
|
|
|
|
$pdf->SetMargins(15, 15, 15) ;
|
|
$pdf->SetFont('Arial','BU',10);
|
|
|
|
// $pdf->AliasNbPages();
|
|
$pdf->Cell(0,6,convertirc($entete['nomAssureur']." : "._('DETAIL DES FACTURES')),0,1,'C',false);
|
|
|
|
$pdf->Ln(2);
|
|
|
|
$pdf->SetFont('Arial','B',7);
|
|
|
|
$pdf->Cell(0,5,convertirc(_('Souscripteur').' : '.$entete['souscripteur']),0,1,'L',false);
|
|
$pdf->Cell(0,5,convertirc(_('No Police').' : '.$entete['numeroPolice']),0,1,'L',false);
|
|
$pdf->Cell(0,5,convertirc('E-mail : '.$email),0,1,'L',false);
|
|
$pdf->Cell(0,5,convertirc(_('Couverture').' : '.$entete['dateEffetPolice'].' '._('au').' '.$entete['dateFinPolice']),0,1,'L',false);
|
|
$pdf->Cell(0,5,convertirc(_('Date Analyse').' : '.$entete['dateAnalyse']),0,0,'L',false);
|
|
$pdf->Cell(0,5,'Edition : '.heureCouranteLang($_SESSION['lang']),0,1,'R',false);
|
|
|
|
$pdf->Ln(2);
|
|
|
|
$hl=5;
|
|
|
|
$pdf->Cell(40,$hl,convertirc(_('Adhérent')),"1",0,'C');
|
|
$pdf->Cell(40,$hl,convertirc(_('Bénéficiaire')),"1",0,'C');
|
|
$pdf->Cell(35,$hl,convertirc(_('College')),"1",0,'C');
|
|
$pdf->Cell(13,$hl,convertirc("Date"),"1",0,'C');
|
|
$pdf->Cell(35,$hl,convertirc(_('Prestataire')),"1",0,'C');
|
|
$pdf->Cell(5,$hl,convertirc(_('Gar')),"1",0,'C');
|
|
$pdf->Cell(13,$hl,convertirc(_('Montant')),"1",0,'C');
|
|
$pdf->Cell(9,$hl,convertirc(_('Fact')),"1",1,'C');
|
|
|
|
$pdf->SetFont('Arial','I',6);
|
|
$montantTotal = 0;
|
|
foreach ($detailsps as $detailsp)
|
|
{
|
|
$pdf->Cell(40,$hl,convertirc($detailsp['adherent']),"1",0,'L');
|
|
$pdf->Cell(40,$hl,convertirc($detailsp['beneficiaire']),"1",0,'L');
|
|
$pdf->Cell(35,$hl,convertirc($detailsp['college']),"1",0,'L');
|
|
$pdf->Cell(13,$hl,convertirc($detailsp['dateFacture']),"1",0,'C');
|
|
// $pdf->Cell(40,$hl,convertirc($detailsp['prestataire']),"1",0,'L');
|
|
$pdf->Cell(35,$hl,convertirc(substr($detailsp['prestataire'], 0, 28)),"1",0,'L');
|
|
$pdf->Cell(5,$hl,convertirc($detailsp['gar']),"1",0,'C');
|
|
$pdf->Cell(13,$hl,format_N($detailsp['montant']),"1",0,'C');
|
|
$pdf->Cell(9,$hl,convertirc($detailsp['facture']),"1",1,'C');
|
|
$montantTotal = $detailsp['montantTotal'];
|
|
}
|
|
$fichier="Temp/DET_GAR_".$idPolice."_".$dateAnalyse."_".uniqid().".pdf";
|
|
$pdf->Output($fichier,"F");
|
|
|
|
$mail_C = $this->mail_C;
|
|
|
|
$mail_C->ClearAllRecipients();
|
|
$mail_C->clearAttachments();
|
|
|
|
$addr = explode(';', $email);
|
|
|
|
foreach ($addr as $ad)
|
|
{
|
|
if(tester_une_adresse_email($ad))
|
|
{
|
|
$mail_C->AddAddress(trim($ad) );
|
|
}
|
|
}
|
|
|
|
$obejt = $_SESSION['nomSociete']." : "._('DETAIL DES GARANTIES');
|
|
|
|
if (est_anglophone())
|
|
{
|
|
$fichier="Temp/DET_BENEF_".$idPolice."_".$dateAnalyse."_".uniqid().".pdf";
|
|
$pdf->Output($fichier,"F");
|
|
|
|
$body = convertirc("Dear Customer,");
|
|
|
|
$body .= "<br/> <br/>";
|
|
|
|
$body .= convertirc("Hope this email find you well,");
|
|
|
|
$body .= "<br/> <br/>";
|
|
|
|
$body .= convertirc("Attached file is claims report of your staff by benefits and family from starting date up to ".$dateAnalyse).'.';
|
|
|
|
$body .= "<br/> <br/>";
|
|
|
|
$body .= convertirc("You can share those informations with every one and if any more clarification do not hesitate to contact us for more details.");
|
|
|
|
$body .= "<br/> <br/>";
|
|
|
|
$body .= convertirc("Kind Regards.");
|
|
|
|
$altbody = "SEE ATTACHMENT";
|
|
}
|
|
else
|
|
{
|
|
$fichier="Temp/DET_GAR_".$idPolice."_".$dateAnalyse."_".uniqid().".pdf";
|
|
$pdf->Output($fichier,"F");
|
|
|
|
$body = convertirc("Cher Client,");
|
|
|
|
$body .= "<br/> <br/>";
|
|
|
|
$body .= convertirc("Nous vous prions de trouver en pièce jointe votre rapport de consommations détaillé par garantie et par famille à la date du ".$dateAnalyse).'.';
|
|
|
|
$body .= "<br/> <br/>";
|
|
|
|
$body .= convertirc("Vous pouvez partager ces informations avec tout le monde et si vous avez besoin de précisions,");
|
|
|
|
$body .= "<br/> <br/>";
|
|
|
|
$body .= convertirc("N'hésitez pas à nous contacter pour plus de détails.");
|
|
|
|
$body .= "<br/> <br/>";
|
|
|
|
$body .= convertirc("Cordialement!");
|
|
|
|
$altbody = "VOIR PIECE JOINTE";
|
|
}
|
|
|
|
$obejt = convertirc($obejt);
|
|
|
|
$pj = $fichier;
|
|
|
|
$mail_C->Subject = $obejt;
|
|
|
|
$mail_C->AltBody = $altbody;
|
|
$mail_C->Body=$body;
|
|
|
|
$mail_C->addAttachment($pj);
|
|
|
|
if (!$mail_C->send())
|
|
{
|
|
// echo "Erreur mail : " . $mail_C->ErrorInfo;
|
|
}
|
|
else
|
|
{
|
|
// echo "Message envoyé!";
|
|
}
|
|
|
|
// FIN ENVOI DU MAIL AVEC PIECE JOINTE
|
|
|
|
// supprimons le fichier
|
|
unlink ($pj);
|
|
}
|
|
} |