diff options
author | Karl Berry <karl@freefriends.org> | 2011-09-26 00:45:20 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2011-09-26 00:45:20 +0000 |
commit | fbee1a3798fb7649597e715858e9f03bfaa21da6 (patch) | |
tree | 6777bc4d708e3dcdcb31745da59b9f22e75f1921 /Master/texmf-dist/tex | |
parent | 94ec53bd37e1f36540195f3aadee0aa1be7830ee (diff) |
new latex package facture
git-svn-id: svn://tug.org/texlive/trunk@24092 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r-- | Master/texmf-dist/tex/xelatex/facture/facture.cls | 219 |
1 files changed, 219 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/xelatex/facture/facture.cls b/Master/texmf-dist/tex/xelatex/facture/facture.cls new file mode 100644 index 00000000000..a0c99ab02c6 --- /dev/null +++ b/Master/texmf-dist/tex/xelatex/facture/facture.cls @@ -0,0 +1,219 @@ +%% +%% This is file `facture.cls', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% facture.dtx (with options: `facture') +%% +%% Droit d'auteur : Maïeul Rouquette 2011, +%% Licence Creative Commons - Paternité - Partage des Conditions Initiales à l'identique +%% http://creativecommons.org/licenses/by-sa/2.0/fr/ +%% +\NeedsTeXFormat{LaTeX2e} +\ProvidesClass{facture}[2011/09/10 v1.0] +\LoadClass{article}%On se base sur la classe article +\RequirePackage{fontspec} +\RequirePackage{xunicode} +\RequirePackage{polyglossia} +\setmainlanguage{french} +\RequirePackage{numprint}%Pour gérer l'affichage des nombres +\RequirePackage{fltpoint}% Pour faire les calculs dans le tableau +\RequirePackage{tikz} % tikz est utilisé pour tracer des boites, par exemple +\RequirePackage{graphicx} % Pour insérer des images. Utiliser le format jpg pour plus de simplicité. +\RequirePackage{fancyhdr} % Pour entête et pied de page +\RequirePackage[paper=a4paper,top=2 cm, bottom=2 cm, left=1.5 cm, right=2.5 cm]{geometry} % On peut modifier ces valeurs pour augmenter ou réduire les marges. +\RequirePackage{ifthen} +\RequirePackage{array} +\RequirePackage{longtable} +\RequirePackage{colortbl} +\RequirePackage{advdate}%Pour manipuler les dates +\RequirePackage{xargs}%Pour des arguments conditionnels +\newif\ifsansTVA +\sansTVAfalse +\DeclareOption{sansTVA}{\sansTVAtrue} +\ProcessOptions +\definecolor{entetes}{HTML}{888888} +\definecolor{encadre}{RGB}{111,111,111} +\newcommand{\libelle}[1]{\textcolor{entetes}{\textbf#1}} +\setlength{\tabcolsep}{1pt} +\newcommand{\codeclient}{Code client :} +\newcommand{\datetxt}{Date:} +\newcommand{\datelimitetxt}{À payer avant:} +\newcommand{\facturation}{Facturation} +\newcommand{\facturetxt}{Facture} +\newcommand{\livraison}{Livraison} +\newcommand{\livraisonfacturation}{Livraison et Facturation} +\newcommand{\ntxt}{~n°} +\newcommand{\produit}{Produit} +\newcommand{\quantite}{Quantité} +\newcommand{\remise}{Remise} +\newcommand{\unite}{€} +\ifsansTVA% + \newcommand{\tottxt}{Total} + \newcommand{\prixtxt}{Prix} + \newcommand{\postTotaux}{\hfill TVA non applicable, art. 293 B} +\else% + \newcommand{\prixHT}{Prix HT} + \newcommand{\TVAtxt}{TVA} + \newcommand{\prixTTC}{Prix TTC} + \newcommand{\totHTtxt}{Total HT} + \newcommand{\totTVAtxt}{Total TVA} + \newcommand{\totTTCtxt}{Total TTC} + \newcommand{\postTotaux}{} +\fi +\npaddmissingzero +\nprounddigits{2} +\gdef\@TVAdefaut{19,6} +\gdef\@type{\facturetxt} +\renewcommand{\date}[1]{\SetDate[#1]} +\newcommand{\TVAdefaut}[1]{\gdef\@TVAdefaut{#1}} +\newcommand{\datelimite}[1]{\newcommand{\@datelimite}{#1}} +\newcommand{\dest}[1]{\newcommand{\@dest}{#1}} +\newcommand{\fact}[1]{\newcommand{\@fact}{#1}} +\newcommand{\adresseemet}[1]{\gdef\@adresseemet{#1}} +\newcommand{\nomemet}[1]{\gdef\@nomemet{#1}} +\newcommand{\type}[1]{\gdef\@type{#1}} +\newcommand{\numero}[1]{\gdef\@numero{#1}} +\newcommand{\codedest}[1]{\gdef\@codedest{#1}} + +\newcommand{\entete}{ + + \noindent\begin{tikzpicture} + + \noindent\node [font=\bf\Huge,text width=0.5\textwidth,text=entetes,text centered]{% + \@nomemet% + }; + + \noindent\node (b)[xshift=0.5\textwidth,text width=0.5\textwidth, right]{% + \@adresseemet% + }; + \coordinate[xshift=-1\textwidth,yshift=1ex] (a) at (b.north); + \coordinate[xshift=1em,yshift=-1ex] (c) at (b.south); + \draw[color=encadre,line width=1.5mm] (a) rectangle (c); + \end{tikzpicture} + + \vspace{3ex} + + \begin{flushright} + + {\Huge\libelle{\@type}} + + \end{flushright} + + \vspace{3ex} + + \begin{tikzpicture} + + \ifdef{\@fact}{ + \node[text width=0.33\textwidth,anchor=base]{ + \libelle{\facturation} + + \@fact + }; + }{} + + \node[xshift=0.33\textwidth,text width=0.33\textwidth,anchor=base]{\ifdef{\@fact}{ + \libelle{\livraison}} + {\libelle{\livraisonfacturation}} + + \@dest + }; + \node[text width=0.33\textwidth,xshift=0.66\textwidth,anchor=base]{ + \libelle{{\datetxt}} \today \\ + \ifdef{\@numero}{% + \libelle{{\@type\ntxt}} \@numero + }{} + \\ + \ifdef{\@codedest}{% + \libelle{{\codeclient}} \@codedest + }{} + \ifdef{\@datelimite}{\\\AdvanceDate[\@datelimite]\libelle{{\datelimitetxt}} \today}{} + }; + + \end{tikzpicture} + +} +\ifsansTVA + \xdef\tot{} +\else + \xdef\totTVA{} + \xdef\totHT{} + \xdef\totTTC{} +\fi +\newcolumntype{P}[1]{>{\raggedleft}p{#1}} +\newenvironment{facture}{% + \setlength{\extrarowheight}{0.5ex} + \setlength{\tabcolsep}{0.5em} + \arrayrulecolor{encadre} + \ifsansTVA% + \begin{longtable}{|p{0.2\textwidth}|P{0.2\textwidth}|P{0.2\textwidth}|P{0.2\textwidth}|P{0.2\textwidth}|}% + \hline% + \rowcolor{entetes}\centering\textbf\produit & \centering\textbf\quantite & \centering\textbf\prixtxt & \centering\textbf\remise & \centering\textbf\tottxt \tabularnewline[1ex]% + \else% + \begin{longtable}{|p{0.2\textwidth}|P{0.1\textwidth}|P{0.1\textwidth}|P{0.1\textwidth}|P{0.1\textwidth}|P{0.2\textwidth}|P{0.1\textwidth}|}% + \hline% + \rowcolor{entetes}\centering\textbf\produit & \centering\textbf\quantite & \centering\textbf\prixHT & \centering\textbf\remise & \centering\textbf\totHTtxt & \centering\textbf\TVAtxt & \textbf\prixTTC \tabularnewline[1ex]% + \fi% + \endhead% + \endfoot% + + }% +{% + \end{longtable} + \begin{tikzpicture} + \draw[color=white] (0,0) circle (0.001); + \node[right,xshift=0.66\textwidth,text width=0.33\textwidth]{% + \ifsansTVA% + \hfill \libelle{\tottxt:} \numprint[\unite]{\tot}\\% + \else% + \libelle{\totHTtxt:}\hfill \numprint[\unite]{\totHT} \\% + \libelle{\totTVAtxt:}\hfill \numprint[\unite]{\totTVA} \\% + \libelle{\totTTCtxt:}\hfill \numprint[\unite]{\totTTC} \\ + \fi + \postTotaux}; + \end{tikzpicture} + + } +\newcommand{\lignesansTVA}[5]{#1 & #2 & #3 & #4 & #5 \tabularnewline[1ex]} +\newcommand{\afficheTVA}[1]{\raggedleft{\numprint[\%]{#1}} \hfill $\triangleright$ \numprint[\unite]{\TVA}} +\newcommandx{\ligne}[5][2=1,5=\@TVAdefaut,4=0,usedefault]{% + \ifsansTVA + \fpMul{\prix}{#3}{#2}% + \fpSub{\prix}{\prix}{#4}% + \fpAdd{\tot}{\prix}{\tot}% + \xdef\tot{\tot}% + \xdef\prix{\prix}% + %Affichage + \lignesansTVA{#1}{#2}{\numprint[\unite]{#3}}{\numprint[\unite]{#4}}{\numprint[\unite]{\prix}}% + \else + % Prix hors taxe + \fpMul{\HT}{#3}{#2}% + \fpSub{\HT}{\HT}{#4}% + \xdef\HT{\HT}%retenons + \fpAdd{\totHT}{\totHT}{\HT}% + \xdef\totHT{\totHT}% + % Calcul de la TVA + \fpDiv{\centieme}{#5}{100}% + \fpMul{\TVA}{\centieme}{\HT}% + \xdef\TVA{\TVA}%retenons + \fpAdd{\totTVA}{\totTVA}{\TVA}% + \xdef\totTVA{\totTVA}% + % Prix TTC + \fpAdd{\TTC}{\HT}{\TVA}% + \xdef\TTC{\TTC}% + \fpAdd{\totTTC}{\totTTC}{\TTC}% + \xdef\totTTC{\totTTC}% + % Affichage + #1 & #2 & \numprint[\unite]{#3} & \numprint[\unite]{#4} & \numprint[\unite]{\HT} & \afficheTVA{#5} & \numprint[\unite]{\TTC} \tabularnewline[1ex]% + \fi + \hline +} +\pagestyle{fancy} +\fancyhf{} +\renewcommand{\headrule}{}%Pas de règle après l'entête +\lfoot{\ifnumgreater{\thepage}{1}{\thepage}{}}%Indiquer le numéro de page, sauf sur la première +\newcommand{\pied}[1]{\rfoot{#1}}%Le pied définissable par l'utilisateur +\endinput +%% +%% End of file `facture.cls'. |