function getinfo($id, $initiales, $typefacture) { $Mysqli = new mysqli(DBSERVER, DBUSER, DBPWD, DB); switch ($typefacture) { case "cantine": $query = "SELECT *,`paiements`.`obs` AS `observations` FROM `paiements` JOIN `factures_cantine` ON `paiements`.`idfacture`=`factures_cantine`.`idfacture` WHERE `idpaiement`= {$id}"; break; case "etal": $query = "SELECT *,`paiements`.`obs` AS `observations` FROM `paiements` JOIN `factures_etal` ON `paiements`.`idfacture`=`factures_etal`.`idfacture` WHERE `idpaiement`= {$id}"; break; case "amarrage": $query = "SELECT *,`paiements`.`obs` AS `observations` FROM `paiements` JOIN `factures_amarrage` ON `paiements`.`idfacture`=`factures_amarrage`.`idfacture` WHERE `idpaiement`= {$id}"; break; } $result = $Mysqli->query($query); $row = $result->fetch_array(MYSQLI_ASSOC); $date = $row['date_paiement']; $payeur = $row['payeur']; $type = $row['type']; $mode = $row['mode']; $montant = $row['montantcfp']; $idpaiement = $row['idpaiement']; $idfacture = $row['communeid']; $no_cheque = $row['numero_cheque']; $organisme = $row['organisme']; $obs = $row['observations']; $Mysqli->close(); genpdf($idfacture, $idpaiement, $date, $payeur, $type, $mode, $montant, $initiales, $no_cheque, $organisme, $obs); }
case "Mlle": $civilite = "Mademoiselle"; break; } $client = $civilite . " " . $client; } else { $query = "SELECT `mandataires`.`mandataireprefix`,`mandataires`.`mandataireRS`,`mandataires`.`mandatairenom`,`mandataires`.`mandataireprenom`,`mandataires`.`mandatairebp`,`mandataires`.`mandatairecp`,`mandataires`.`mandataireville` FROM `mandataires` INNER JOIN `factures_amarrage` ON `factures_amarrage`.`idclient` = `mandataires`.`mandataireid` WHERE `factures_amarrage`.`idfacture` = '{$idfacture}'"; $result = $mysqli->query($query); $row = $result->fetch_array(MYSQLI_ASSOC); $client = $row["mandataireprefix"] . " " . $row["mandataireRS"] . "\nAttn : " . $row["mandatairenom"] . " " . $row["mandataireprenom"]; $contact = "BP " . $row['mandatairebp'] . " - " . $row['mandatairecp'] . " " . $row['mandataireville']; $civilite = "Monsieur, Madame"; } break; } genpdf($typefacture, $datefacture, $nofacture, $montant, $civilite, $client, $contact, $chrono, $today); $mysqli->close(); function genpdf($typefacture, $datefacture, $nofacture, $montant, $civilite, $client, $contact, $chrono, $today) { $pdf = new FPDF("P", "mm", "A4"); $pdf->AddPage(); $pdf->SetMargins(20, 20); $pdf->AddFont("Arialb", "", "arialb.php"); //$pdf->AddFont("Courier","","arialb.php"); /////////////////////////////////////en tete//////////////////////////////////////// //logo $pdf->SetXY(18, 24); $X = $pdf->GetX(); $Y = $pdf->GetY(); $pdf->Image("img/logo.jpg", $X, $Y, 23, 19, "jpg"); //Commune de Faa"a