98 lines
5.6 KiB
PHP
Executable File
98 lines
5.6 KiB
PHP
Executable File
<?php
|
|
$nomFicAppelant = basename(__FILE__);
|
|
$idCde=$_SESSION['idCde'];
|
|
|
|
if ($lg=='') $lg='FRA';
|
|
|
|
// -----------------------------------------------------
|
|
// Mode test
|
|
// -----------------------------------------------------
|
|
include ("../../_include/dataBaseConnect.php");
|
|
if (isset($_SESSION['modeTest'])) $modeTest=$_SESSION['modeTest']; else $modeTest=1;
|
|
if ($modeTest==2) include ($includePathConf. "/prod.dbConnect.php");
|
|
|
|
// -----------------------------------------------------
|
|
// Préparer infos + cde client servira aussi pour le mail
|
|
// -----------------------------------------------------
|
|
// Recup client
|
|
// -----------------------------------------------------
|
|
$mailCli=$_SESSION['mailCli'];
|
|
include ("./cdes/req/factReqSelectClient.php");
|
|
|
|
// recup date + mode de livraison + moyen paiement + tva
|
|
include ("./cdes/req/reqSelectFromCde.php");
|
|
|
|
// recup des lignes cde
|
|
include ("./cdes/req/reqSelectFromLignesCde.php");
|
|
|
|
// -----------------------------------------------------
|
|
// Recup le reste
|
|
// -----------------------------------------------------
|
|
// recup libelle mode de livraison
|
|
// -----------------------------------------------------
|
|
include ("./cdes/req/reqSelectModeLivFrom.php");
|
|
|
|
// recup libelle moyen de paiement
|
|
include ("./cdes/req/reqSelectModePaieFrom.php");
|
|
|
|
// libellé pays liv
|
|
include ("./cdes/req/reqSelectLibellePaysLiv.php");
|
|
|
|
// libellé pays fact
|
|
include ("./cdes/req/reqSelectLibellePaysFact.php");
|
|
|
|
// les messages contact
|
|
include ("../../_include/req/13-init.contactMsgList.php");
|
|
|
|
// -----------------------------------------------------
|
|
// Instanciation de la classe
|
|
// -----------------------------------------------------
|
|
require "fpdf184/fpdf.php";
|
|
require "./makeFact/factPdf_contenu.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]);
|
|
$pdf = new pdf();
|
|
$pdf->AliasNbPages();
|
|
|
|
$pdf->AddPage();
|
|
// function hautDePage($raisonSoc, $add, $villeAdm, $cp, $pays, $tel, $idCde, $dateCdeCrea, $descriptionMP, $civ, $nom, $prenom, $adresseCli, $adresseCli2, $codePostCli, $ville, $libPaysFact, $civLiv, $nomLiv, $prenomLiv, $adrLiv, $adrLiv2, $codePostLiv, $villeLiv, $libellepaysliv, $txRemiseCli, $adresseLivOui, $telCli, $libDateEmission) {
|
|
$pdf->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');
|
|
|
|
// define("TVA",0.055);
|
|
$refresh='Oui';
|
|
// atester sans refresh, je pense qu'à l'époque le nom du fichier etait faux.
|
|
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='';
|
|
|
|
$fpCdeHt=formatNB($fpCdeHt,$lg);
|
|
$fpCdeTVA=formatNB($fpCdeTVA,$lg);
|
|
$fpCdeTTC=formatNB($fpCdeTTC,$lg);
|
|
// $prixTotTTC=formatNB($prixTotTTC,$lg);
|
|
|
|
$pdf->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);
|
|
|
|
|
|
|
|
$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=$pdf->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;
|
|
?>
|