alpha_full/pages/panier/_recap/recapFacture.php
2026-04-06 22:58:51 +02:00

141 lines
5.8 KiB
PHP
Executable File

<?php
$nomFicAppelant = basename(__FILE__);
// ---------------------------------------------------
// Recup client
// ---------------------------------------------------
$cliMail=$idMail;
include ("./admin/cdes/req/factReqSelectClient.php");
// ---------------------------------------------------
// Recup commande
// ---------------------------------------------------
// recup date + mode de livraison + moyen paiement + tva
// ---------------------------------------------------
include ("./admin/cdes/req/reqSelectFromCde_fromPanier.php");
// recup des lignes cde
include ("./admin/cdes/req/reqSelectFromLignesCde.php");
// ---------------------------------------------------
// Recup le reste
// ---------------------------------------------------
// recup libelle mode de livraison
// ---------------------------------------------------
include ("./admin/cdes/req/reqSelectModeLivFrom.php");
// recup libelle moyen de paiement
include ("./admin/cdes/req/reqSelectModePaieFrom.php");
// libellé pays liv
include ("./admin/cdes/req/reqSelectLibellePaysLiv.php");
// libellé pays fact
include ("./admin/cdes/req/reqSelectLibellePaysFact.php");
// les messages contact
include ("./_include/req/13-init.contactMsgList.php");
// ---------------------------------------------------
// Instanciation de la classe
// ---------------------------------------------------
require_once "fpdf184/fpdf.php";
require "./admin/cdes/makeFact/factPdf_contenu.php";
// require "./admin/cdes/makeFact/html2pdf.php";
if (isset($libelleModeLiveCde))
// ---------------------------------------------------
// Appel de la function
// ---------------------------------------------------
// Recup date + mode de livraison + moyen paiement + tva
// ---------------------------------------------------
include ("./admin/cdes/req/reqSelectFromCde.php");
require_once("./_include/_fonctions/fonctions.gene.php");
$_SESSION['siretAff']=mb_convert_encoding($contactMsg[2], 'ISO-8859-1', 'UTF-8'). ''.mb_convert_encoding($contactMsg[11], 'ISO-8859-1', 'UTF-8');
$telAff=formatTelAff($telCli);
$telAdmin=formatTelAff($contactMsg[16]);
$factPdf = new pdf();
$factPdf->AliasNbPages();
$factPdf->AddPage();
$factPdf->hautDePage(
mb_convert_encoding(ltrim($_SESSION['nomSiteAff']), 'ISO-8859-1', 'UTF-8'),
mb_convert_encoding($contactMsg[12], 'ISO-8859-1', 'UTF-8'),
mb_convert_encoding($contactMsg[13], 'ISO-8859-1', 'UTF-8'),
mb_convert_encoding($contactMsg[14], 'ISO-8859-1', 'UTF-8'),
mb_convert_encoding($contactMsg[6]. '' .$contactMsg[15], 'ISO-8859-1', 'UTF-8'),
mb_convert_encoding($contactMsg[7]. '' .$telAdmin, 'ISO-8859-1', 'UTF-8'),
$idCde,
$dateCdeCrea,
mb_convert_encoding($descriptionMP, 'ISO-8859-1', 'UTF-8'),
mb_convert_encoding($civ, 'ISO-8859-1', 'UTF-8'),
mb_convert_encoding($nom, 'ISO-8859-1', 'UTF-8'),
mb_convert_encoding($prenom, 'ISO-8859-1', 'UTF-8'),
mb_convert_encoding($adresseCli, 'ISO-8859-1', 'UTF-8'),
mb_convert_encoding($adresseCli2, 'ISO-8859-1', 'UTF-8'),
$codePostCli,
mb_convert_encoding($ville, 'ISO-8859-1', 'UTF-8'),
mb_convert_encoding($libPaysFact, 'ISO-8859-1', 'UTF-8'),
mb_convert_encoding($civLiv, 'ISO-8859-1', 'UTF-8'),
mb_convert_encoding($nomLiv, 'ISO-8859-1', 'UTF-8'),
mb_convert_encoding($prenomLiv, 'ISO-8859-1', 'UTF-8'),
mb_convert_encoding($adrLiv, 'ISO-8859-1', 'UTF-8'),
mb_convert_encoding($adrLiv2, 'ISO-8859-1', 'UTF-8'),
$codePostLiv,
mb_convert_encoding($villeLiv, 'ISO-8859-1', 'UTF-8'),
mb_convert_encoding($libellepaysliv, 'ISO-8859-1', 'UTF-8'),
$txRemiseCli,
$adresseLivOui,
mb_convert_encoding($contactMsg[7], 'ISO-8859-1', 'UTF-8') .$telAff,
mb_convert_encoding($cdeMsg[93], 'ISO-8859-1', 'UTF-8')
);
$refresh='Oui';
include ("./_include/req/07-init.cdeMsgList.php");
include ("./_include/req/04-init.catMsgList.php");
$refresh='N';
if (!isset($prixTotHT)) $prixTotHT='';
if (!isset($tvaMontant)) $tvaMontant='';
if (!isset($datasOpt)) $datasOpt='';
// $prixUnitRemiseHtTab=formatNB($prixUnitRemiseHtTab,$lg);
// $montantTvaLigneTab=formatNB($montantTvaLigneTab,$lg);
// $ttcLignesTab=formatNB($ttcLignesTab,$lg);
// $totalCde=formatNB($totalCde,$lg);
// $prixTotHT=formatNB($prixTotHT,$lg);
// $fpCdeTVA=formatNB($fpCdeTVA,$lg);
// $fpCdeTTC=formatNB($fpCdeTTC,$lg);
$fpCdeHt=formatNB($fpCdeHt,$lg);
$fpCdeTVA=formatNB($fpCdeTVA,$lg);
$fpCdeTTC=formatNB($fpCdeTTC,$lg);
// $prixTotTTC=formatNB($prixTotTTC,$lg);
$factPdf->tableArticles($refPrdTab, $nomPrdTab, $prixUnitRemiseHtTab, $qteLigneTab, $nbLignes, $montantTvaLigneTab, $ttcLignesTab, $totalCde, $libelleModeLiveCde, $fpCdeHt, $fpCdeTVA, $fpCdeTTC, $catalogMsg[15], $catalogMsg[9], $cdeMsg[25], $cdeMsg[26], $cdeMsg[0], $cdeMsg[16], $cdeMsg[90], $cdeMsg[91], $cdeMsg[92], $cdeMsg[31], $libTraduit, $quantite, $prixTotTTC, $prixTotHT, $tvaMontant, $lg);
// I: send the file inline to the browser. The PDF viewer is used if available.
// D: send to the browser and force a file download with the name given by name.
// F: save to a local file with the name given by name (may include a path).
// S: return the document as a string.
// $pdf->Output($pdfPath,'F');
$fpdfFile=$_SESSION['nomSiteAff']. '_' .$_SESSION['nom_facture']. '_' .$idCde. '.pdf';
// Essai avec chemin absolu, mais a priori pas besoin fonctionne en relatif
// $test=str_replace("./","/",$includePathVar);
// $fpdfPath = "/datas/07Prod/wwwRoot/" .$_SESSION['siteDossier'].$test. "/facturesSite/" .$fpdfFile;
$fpdfPath = $includePathVar. "/facturesSite/" .$fpdfFile;
try {
$test=$factPdf->Output($fpdfPath,'F');
}
catch (Exception $e) {
if (isset($debug[2]) && $debug[2] == '1' ) $debugMsg .= '<br>Erreur lors de la génération de la facture ' .$e;
}
if (isset($debug[2]) && $debug[2] == '1' ) $debugMsg .= '<br>Facture faite ? (test) =' .$test. ' | Chemin = ' .$fpdfPath;
$_SESSION['fpdfPath']=$fpdfPath;
$_SESSION['fpdfFile']=$fpdfFile;
?>