<commit_before><?php
use_helper('Float');
use_helper('Date');
$nb_ligne = 0;
?>
\documentclass[6pt]{article}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage{units}
\usepackage{geometry}
\usepackage{graphicx}
\usepackage{fancyhdr}
\usepackage{fp}
\usepackage[table]{xcolor}
\usepackage{tikz}
\usepackage{array}
\usepackage{multicol}
\usepackage{textcomp}
\usepackage{marvosym}
\usepackage{lastpage}



\usetikzlibrary{fit}

\renewcommand\sfdefault{phv}

\newcommand{\CutlnPapillon}{
  	\multicolumn{7}{c}{ \Rightscissors \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline  \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline  \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline  \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline  \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline  \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline  \Cutline  }
\\   	  
}

\renewcommand{\familydefault}{\sfdefault}


\setlength{\oddsidemargin}{-2cm}
\setlength{\evensidemargin}{-2cm}
\setlength{\textwidth}{19cm}
\setlength{\headheight}{5cm}

\setlength{\topmargin}{-3.5cm}

\def\TVA{19.60} 
\def\InterloireAdresse{<?php echo $facture->emetteur->adresse; ?> \\
		       <?php echo $facture->emetteur->code_postal.' '.$facture->emetteur->ville; ?> - France} 
\def\InterloireFacturation{Service facturation : <?php echo $facture->emetteur->service_facturation; ?> Tél. : <?php echo $facture->emetteur->telephone; ?>} 
\def\InterloireSIRET{429 164 072 00077}
\def\InterloireAPE{APE 9499 Z} 
\def\InterloireTVAIntracomm{FR 73 429164072}
\def\InterloireBANQUE{Crédit agricole de la tourraine et du poitou}
\def\InterloireBIC{XXXXX}
\def\InterloireIBAN{XXXX XXXXX XXXX XXXXX XX}

\def\FactureNum{<?php echo $facture->identifiant; ?>}
\def\FactureDate{<?php echo $facture->date_emission; ?>}
\def\FactureRefClient{<?php echo $facture->client_reference; ?>}

\def\FactureClientNom{<?php echo ($facture->client->raison_sociale == '')? 'Raison Sociale' : $facture->client->raison_sociale; ?>}
\def\FactureClientAdresse{<?php echo ($facture->client->adresse == '')? 'Adresse' : $facture->client->adresse; ?>}
\def\FactureClientCP{<?php echo $facture->client->code_postal; ?>}
\def\FactureClientVille{<?php echo $facture->client->ville; ?>}

\pagestyle{fancy}
\renewcommand{\headrulewidth}{0pt}

\fancyhf{}

\lhead{
 \textbf{InterLoire} \\
 \InterloireAdresse \\
 \InterloireFacturation \\
 \begin{tiny}
         RIB~:~\InterloireBANQUE~(BIC:~\InterloireBIC~IBAN:~\InterloireIBAN) 
 \end{tiny} \\
 \begin{tiny}
         SIRET~\InterloireSIRET ~-~\InterloireAPE ~- TVA~Intracommunutaire~\InterloireTVAIntracomm
\end{tiny}
 }
\rhead{\includegraphics[scale=0.6]{<?php echo realpath(dirname(__FILE__)."/../../../../../web/data")."/logo.jpg"; ?>}}



\begin{document}

\noindent{
\begin{minipage}[t]{0.5\textwidth}
	\begin{flushleft}
	
	\textbf{FACTURE} \\
	\vspace{0.3cm}
	\begin{tikzpicture}
		\node[inner sep=1pt] (tab0){
			\begin{tabular}{*{2}{c|}c}
  				\rowcolor{lightgray} \textbf{NUMERO} & \textbf{DATE} & \textbf{REF CLIENT} \\
  				\hline
  				\FactureNum & \FactureDate & \FactureRefClient
			\end{tabular}
		};
		\node[draw=gray, inner sep=0pt, rounded corners=3pt, line width=2pt, fit=(tab0.north west) (tab0.north east) (tab0.south east) (tab0.south west)] {};	
	\end{tikzpicture}
	\\
	\begin{small}
	Cotisation selon Accord interprofessionnel en vigueur
	\end{small}		
	\end{flushleft}
\end{minipage}
}
\hspace{2cm}
\begin{minipage}[t]{0.5\textwidth}
		\begin{flushleft}		
			\textbf{\FactureClientNom \\}				
				\FactureClientAdresse \\
				\FactureClientCP ~\FactureClientVille \\
			\end{flushleft}
		\hspace{6cm}
		page \thepage / <?php echo $facture->nb_page; ?>
\end{minipage}

\centering
\fontsize{8}{8}\selectfont
    \begin{tikzpicture}
		\node[inner sep=1pt] (tab1){
			\begin{tabular}{p{120mm} |p{12mm}|p{14mm}|p{18mm}|p{15mm}p{0mm}}

  			\rowcolor{lightgray}
                        \centering \small{\textbf{Libellé}} &
   			\centering \small{\textbf{Volume en hl}} &
                        \centering \small{\textbf{Cotisation}} &
   			\centering \small{\textbf{Montant H.T Euros}} &
   			\centering \small{\textbf{Code \\ Echéance}} & 
                        \multicolumn{1}{c}{\small{}}\\
  
  			\hline
                <?php 
                $nb_ligne += count($facture->lignes);
                foreach ($facture->lignes as $type => $typeLignes) :
                ?>
                \textbf{Sortie de <?php echo FactureClient::getInstance()->getTypeLignePdfLibelle($type); ?>} & ~ & ~ & ~ & ~ &\\
            <?php 
                 $produits = FactureClient::getInstance()->getProduitsFromTypeLignes($typeLignes);
                 $nb_ligne += count($produits);
                 
                 foreach ($produits as $prodHash => $p) :   
                     foreach ($p as $produit):
                            $produit = $produit->getRawValue();
                        ?>      
                ~~~~<?php echo $produit->produit_libelle.' \begin{tiny}'.$produit->origine_libelle.'\end{tiny}'; ?> &
                            \multicolumn{1}{r|}{<?php echoFloat($produit->volume); ?>} &
                            \multicolumn{1}{r|}{<?php echoFloat($produit->cotisation_taux); ?>} & 
                            \multicolumn{1}{r|}{<?php echoFloat($produit->montant_ht); ?>\texteuro{}} & 
                            \multicolumn{1}{c}{<?php echo $produit->echeance_code ?>} &\\

                <?php 
                    endforeach;
                    endforeach;
                endforeach;
                
               
                for($i=0; $i<($total_rows - $nb_ligne);$i++):
                ?>
        ~ & ~ & ~ & ~ & ~ & \\
                <?php 
                endfor;
                ?>
	 \multicolumn{6}{c}{Aucun escompte n\'est prévu pour paiment anticipé. Pénalités de retard : 3 fois le taux d\'intér\^{e}t légal} \\
	 ~ & ~ & ~ & ~ & ~ & \\
			\end{tabular}
		};
		\node[draw=gray, inner sep=0pt, rounded corners=3pt, line width=2pt, fit=(tab1.north west) (tab1.north east) (tab1.south east) (tab1.south west)] {};	<commit_msg>les volumes des pdfs sont POSITIF<commit_after><?php
use_helper('Float');
use_helper('Date');
$nb_ligne = 0;
?>
\documentclass[6pt]{article}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage{units}
\usepackage{geometry}
\usepackage{graphicx}
\usepackage{fancyhdr}
\usepackage{fp}
\usepackage[table]{xcolor}
\usepackage{tikz}
\usepackage{array}
\usepackage{multicol}
\usepackage{textcomp}
\usepackage{marvosym}
\usepackage{lastpage}



\usetikzlibrary{fit}

\renewcommand\sfdefault{phv}

\newcommand{\CutlnPapillon}{
  	\multicolumn{7}{c}{ \Rightscissors \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline  \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline  \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline  \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline  \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline  \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline \Cutline  \Cutline  }
\\   	  
}

\renewcommand{\familydefault}{\sfdefault}


\setlength{\oddsidemargin}{-2cm}
\setlength{\evensidemargin}{-2cm}
\setlength{\textwidth}{19cm}
\setlength{\headheight}{5cm}

\setlength{\topmargin}{-3.5cm}

\def\TVA{19.60} 
\def\InterloireAdresse{<?php echo $facture->emetteur->adresse; ?> \\
		       <?php echo $facture->emetteur->code_postal.' '.$facture->emetteur->ville; ?> - France} 
\def\InterloireFacturation{Service facturation : <?php echo $facture->emetteur->service_facturation; ?> Tél. : <?php echo $facture->emetteur->telephone; ?>} 
\def\InterloireSIRET{429 164 072 00077}
\def\InterloireAPE{APE 9499 Z} 
\def\InterloireTVAIntracomm{FR 73 429164072}
\def\InterloireBANQUE{Crédit agricole de la tourraine et du poitou}
\def\InterloireBIC{XXXXX}
\def\InterloireIBAN{XXXX XXXXX XXXX XXXXX XX}

\def\FactureNum{<?php echo $facture->identifiant; ?>}
\def\FactureDate{<?php echo $facture->date_emission; ?>}
\def\FactureRefClient{<?php echo $facture->client_reference; ?>}

\def\FactureClientNom{<?php echo ($facture->client->raison_sociale == '')? 'Raison Sociale' : $facture->client->raison_sociale; ?>}
\def\FactureClientAdresse{<?php echo ($facture->client->adresse == '')? 'Adresse' : $facture->client->adresse; ?>}
\def\FactureClientCP{<?php echo $facture->client->code_postal; ?>}
\def\FactureClientVille{<?php echo $facture->client->ville; ?>}

\pagestyle{fancy}
\renewcommand{\headrulewidth}{0pt}

\fancyhf{}

\lhead{
 \textbf{InterLoire} \\
 \InterloireAdresse \\
 \InterloireFacturation \\
 \begin{tiny}
         RIB~:~\InterloireBANQUE~(BIC:~\InterloireBIC~IBAN:~\InterloireIBAN) 
 \end{tiny} \\
 \begin{tiny}
         SIRET~\InterloireSIRET ~-~\InterloireAPE ~- TVA~Intracommunutaire~\InterloireTVAIntracomm
\end{tiny}
 }
\rhead{\includegraphics[scale=0.6]{<?php echo realpath(dirname(__FILE__)."/../../../../../web/data")."/logo.jpg"; ?>}}



\begin{document}

\noindent{
\begin{minipage}[t]{0.5\textwidth}
	\begin{flushleft}
	
	\textbf{FACTURE} \\
	\vspace{0.3cm}
	\begin{tikzpicture}
		\node[inner sep=1pt] (tab0){
			\begin{tabular}{*{2}{c|}c}
  				\rowcolor{lightgray} \textbf{NUMERO} & \textbf{DATE} & \textbf{REF CLIENT} \\
  				\hline
  				\FactureNum & \FactureDate & \FactureRefClient
			\end{tabular}
		};
		\node[draw=gray, inner sep=0pt, rounded corners=3pt, line width=2pt, fit=(tab0.north west) (tab0.north east) (tab0.south east) (tab0.south west)] {};	
	\end{tikzpicture}
	\\
	\begin{small}
	Cotisation selon Accord interprofessionnel en vigueur
	\end{small}		
	\end{flushleft}
\end{minipage}
}
\hspace{2cm}
\begin{minipage}[t]{0.5\textwidth}
		\begin{flushleft}		
			\textbf{\FactureClientNom \\}				
				\FactureClientAdresse \\
				\FactureClientCP ~\FactureClientVille \\
			\end{flushleft}
		\hspace{6cm}
		page \thepage / <?php echo $facture->nb_page; ?>
\end{minipage}

\centering
\fontsize{8}{8}\selectfont
    \begin{tikzpicture}
		\node[inner sep=1pt] (tab1){
			\begin{tabular}{p{120mm} |p{12mm}|p{14mm}|p{18mm}|p{15mm}p{0mm}}

  			\rowcolor{lightgray}
                        \centering \small{\textbf{Libellé}} &
   			\centering \small{\textbf{Volume en hl}} &
                        \centering \small{\textbf{Cotisation}} &
   			\centering \small{\textbf{Montant H.T Euros}} &
   			\centering \small{\textbf{Code \\ Echéance}} & 
                        \multicolumn{1}{c}{\small{}}\\
  
  			\hline
                <?php 
                $nb_ligne += count($facture->lignes);
                foreach ($facture->lignes as $type => $typeLignes) :
                ?>
                \textbf{Sortie de <?php echo FactureClient::getInstance()->getTypeLignePdfLibelle($type); ?>} & ~ & ~ & ~ & ~ &\\
            <?php 
                 $produits = FactureClient::getInstance()->getProduitsFromTypeLignes($typeLignes);
                 $nb_ligne += count($produits);
                 
                 foreach ($produits as $prodHash => $p) :   
                     foreach ($p as $produit):
                            $produit = $produit->getRawValue();
                        ?>      
                ~~~~<?php echo $produit->produit_libelle.' \begin{tiny}'.$produit->origine_libelle.'\end{tiny}'; ?> &
                            \multicolumn{1}{r|}{<?php echoFloat($produit->volume*-1); ?>} &
                            \multicolumn{1}{r|}{<?php echoFloat($produit->cotisation_taux); ?>} & 
                            \multicolumn{1}{r|}{<?php echoFloat($produit->montant_ht); ?>\texteuro{}} & 
                            \multicolumn{1}{c}{<?php echo $produit->echeance_code ?>} &\\

                <?php 
                    endforeach;
                    endforeach;
                endforeach;
                
               
                for($i=0; $i<($total_rows - $nb_ligne);$i++):
                ?>
        ~ & ~ & ~ & ~ & ~ & \\
                <?php 
                endfor;
                ?>
	 \multicolumn{6}{c}{Aucun escompte n\'est prévu pour paiment anticipé. Pénalités de retard : 3 fois le taux d\'intér\^{e}t légal} \\
	 ~ & ~ & ~ & ~ & ~ & \\
			\end{tabular}
		};
		\node[draw=gray, inner sep=0pt, rounded corners=3pt, line width=2pt, fit=(tab1.north west) (tab1.north east) (tab1.south east) (tab1.south west)] {};	
{'fraction_non_alphanumeric': 0.16989296287861536, 'fraction_numerical': 0.014651180444849313, 'mean_word_length': 2.84193642461359, 'pattern_counts': {'":': 0, '<': 53, '<?xml version=': 0, '>': 129, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5034360', 'n_tokens_mistral': 4910, 'n_tokens_neox': 4646, 'n_words': 761}