summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/profcollege/latex/PfCTicketCaisse.tex
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/profcollege/latex/PfCTicketCaisse.tex')
-rw-r--r--macros/latex/contrib/profcollege/latex/PfCTicketCaisse.tex210
1 files changed, 210 insertions, 0 deletions
diff --git a/macros/latex/contrib/profcollege/latex/PfCTicketCaisse.tex b/macros/latex/contrib/profcollege/latex/PfCTicketCaisse.tex
new file mode 100644
index 0000000000..1c460e3693
--- /dev/null
+++ b/macros/latex/contrib/profcollege/latex/PfCTicketCaisse.tex
@@ -0,0 +1,210 @@
+%%%
+% Ticket de caisse
+%%%
+\newcounter{PfCNbInsulte}%
+\setcounter{PfCNbInsulte}{0}%
+
+\NewDocumentCommand\PfCPrixInsulte{sm}{%
+ \setsepchar{,}\ignoreemptyitems%
+ \readlist*\PfCListeInsulte{\%,!,§,\#,*,@,-}%
+ \reademptyitems%
+ \IfBooleanTF{#1}{%
+ \MelangeListe{1,2,3,4,5,6,7}{5}%
+ }{%
+ \stepcounter{PfCNbInsulte}%
+ \MelangeListe{1,2,3,4,5,6,7}{3}%
+ }%
+ \setsepchar{,}\ignoreemptyitems%
+ \readlist*\ListeInsulteMelange{\faa}%
+ \reademptyitems%
+ \ifboolKV[TicketCaisse]{Solution}{\textcolor{PfCTicketCouleurSolution}{#2}}{%
+ \xintFor* ##1 in{\xintSeq{1}{\ListeInsulteMelangelen}}\do{%
+ \xdef\Titi{\ListeInsulteMelange[##1]}%
+ \PfCListeInsulte[\Titi]%
+ }%
+ }%
+}%
+
+\makeatletter
+\NewDocumentCommand\PrixTicket{om}{%
+ \ifboolKV[TicketCaisse]{CHF}{%
+ \DeclareSIUnit{\Tempo}{\PfCCHF}%
+ }{%
+ \ifboolKV[TicketCaisse]{CFA}{%
+ \DeclareSIUnit{\Tempo}{\PfCCFA}%
+ }{%
+ \ifboolKV[TicketCaisse]{CFP}{%
+ \DeclareSIUnit{\Tempo}{\PfCCFP}%
+ }{%
+ \ifboolKV[TicketCaisse]{US}{%
+ \DeclareSIUnit{\Tempo}{\Dollar}%
+ }{%
+ \ifboolKV[TicketCaisse]{UK}{%
+ \DeclareSIUnit{\Tempo}{\LivreSterling}%
+ }{%
+ \ifboolKV[TicketCaisse]{Euro}{%
+ \DeclareSIUnit{\Tempo}{\EuRo}%
+ }{%
+ \if@CHF%
+ \setKV[TicketCaisse]{CHF}%
+ \fi%
+ \DeclareSIUnit{\Tempo}{\DeviseDefaut}%
+ }%
+ }%
+ }%
+ }%
+ }%
+ }%
+ \IfInteger{#2}{%
+ \ifboolKV[TicketCaisse]{CHF}{%
+ \si{\PfCCHF}~\num{#2}.-%
+ }{%
+ \SI[round-mode=places,round-precision=2]{#2}{\Tempo}%
+ }%
+ }{%
+ \SI[round-mode=places,round-precision=2]{#2}{\Tempo}%
+ }%
+}%
+\makeatother
+
+\setKVdefault[TicketCaisse]{Largeur=222,Especes=50,Enseigne=Au comptoir des maths,DateAchat=\today,HeureAchat=15:13:34,Taches=false,Rendu,Total,UK=false,US=false,CFA=false,CFP=false,CHF=false,Euro=false,Solution=false}
+\defKV[TicketCaisse]{Couleur=\colorlet{PfCTicketCouleurSolution}{#1}\setKV[TicketCaisse]{Solution}}
+
+\NewDocumentCommand\TicketCaisse{om}{%
+ \setcounter{PfCNbInsulte}{0}%
+ \useKVdefault[TicketCaisse]%
+ \setKV[TicketCaisse]{#1}%
+ \setsepchar[*]{,*/}%
+ \readlist*\ListeAchats{#2}%
+ % On fait trois listes pour les retenir
+ % Liste Quantités
+ \xdef\PfCFooQuantites{}%
+ \foreachitem\compteur\in\ListeAchats{%
+ \StrChar{\ListeAchats[\compteurcnt,1]}{1}[\MyLetter]%
+ \IfStrEq{\MyLetter}{!}{%
+ \StrBehind{\ListeAchats[\compteurcnt,1]}{!}[\Titi]%
+ \xdef\PfCFooQuantites{\PfCFooQuantites,\Titi}%
+ }{%
+ \xdef\PfCFooQuantites{\PfCFooQuantites,\ListeAchats[\compteurcnt,1]}%
+ }%
+ }%
+ % Liste Elements
+ \xdef\PfCFooElements{}%
+ \foreachitem\compteur\in\ListeAchats{%
+ \xdef\PfCFooElements{\PfCFooElements,\ListeAchats[\compteurcnt,2]}%
+ }%
+ % Liste Prix Unitaire
+ \xdef\PfCFooPUnitaires{}%
+ \foreachitem\compteur\in\ListeAchats{%
+ \StrChar{\ListeAchats[\compteurcnt,3]}{1}[\MyLetter]%
+ \IfStrEqCase{\MyLetter}{%
+ {!}{%
+ \StrBehind{\ListeAchats[\compteurcnt,3]}{!}[\Titi]%
+ \StrChar{\Titi}{1}[\Toto]%
+ \IfStrEq{\Toto}{*}{%
+ \StrBehind{\ListeAchats[\compteurcnt,3]}{!*}[\Tata]%
+ \xdef\PfCFooPUnitaires{\PfCFooPUnitaires,\Tata}%
+ }{%
+ \xdef\PfCFooPUnitaires{\PfCFooPUnitaires,\Titi}%
+ }%
+ }%
+ {*}{\StrBehind{\ListeAchats[\compteurcnt,3]}{*}[\Titi]%
+ \xdef\PfCFooPUnitaires{\PfCFooPUnitaires,\Titi}}%
+ }[\xdef\PfCFooPUnitaires{\PfCFooPUnitaires,\ListeAchats[\compteurcnt,3]}]%
+ }%
+ % On les lit
+ \setsepchar{,}\ignoreemptyitems%
+ \readlist*\ListeQuantites{\PfCFooQuantites}%
+ \readlist*\ListeElements{\PfCFooElements}%
+ \readlist*\ListePUnitaires{\PfCFooPUnitaires}%
+ % On calcul le coût total
+ \xdef\PfCTCTotal{0}%
+ \xintFor* ##1 in{\xintSeq{1}{\ListeAchatslen}}\do{%
+ \xdef\PfCTCTotal{\fpeval{\PfCTCTotal+\ListeQuantites[##1]*\ListePUnitaires[##1]}}%
+ }%
+% Le coût total est \PfCTCTotal\\
+ {\ttfamily%
+ \begin{NiceTabular}{m{107pt}m{29pt}m{36pt}m{50pt}}%
+ \CodeBefore
+ \tikz\node[opacity=0.2,yshift=-1.5cm] at ($(1-|1)!0.5!(1-|last)$) {\Large\bfseries\reflectbox{
+ \begin{tabular}{c}
+ Papier garanti\\
+ sans Phénol
+ \end{tabular}
+ }
+ };
+ \tikz\node[opacity=0.2,anchor=center,yshift=1cm] at ($(last-|1)!0.5!(last-|last)$) {\Large\bfseries\reflectbox{%
+ \faRecycle~Pensez à trier.%
+ }%
+ };%
+ \tikz\node[opacity=0.5,anchor=center,yshift=2cm] at ($(last-|1)!0.5!(last-|last)$) {\Large\bfseries\reflectbox{
+ \LogoRecyclage[Couleur=0.8white]%
+ }%
+ };%
+ \tikz\draw[fill=Ivory,opacity=0.5] (1-|1) rectangle (last-|last);%
+ \Body
+ &&&\\%
+ \Block{1-4}{\Large\bfseries\useKV[TicketCaisse]{Enseigne}}&&&\\%
+ \\%
+ \Cdots\\%
+ \\%
+ \Block[l]{}{\footnotesize\sc Description}&\Block{}{\footnotesize\sc Qte.}&\Block{}{\footnotesize\sc P.u.}&\Block[r]{}{\footnotesize\sc Prix Net}\\%
+ \\%
+ \xintFor* ##1 in{\xintSeq{1}{\ListeAchatslen}}\do{%
+ \ListeElements[##1]&%
+ \Block{}{%
+ \footnotesize%
+ \StrChar{\ListeAchats[##1,1]}{1}[\MyLetter]%
+ \IfStrEq{\MyLetter}{!}{\PfCPrixInsulte*{\ListeQuantites[##1]}}{\xintifboolexpr{\fpeval{\ListeQuantites[##1]}==1}{}{\num{\ListeQuantites[##1]}}}%
+ }&
+ \Block[r]{}{%
+ \footnotesize
+ %Savoir si le nombre d'articles est affiché
+ \StrChar{\ListeAchats[##1,1]}{1}[\MyLetter]%
+ % Si le nombre d'articles n'est pas affiché, il faut impérativement afficher le prix unitaire
+ \IfStrEq{\MyLetter}{!}{%
+ \PrixTicket{\ListePUnitaires[##1]}%
+ }{%
+ % On regarde si on affiche le prix unitaire
+ \StrChar{\ListeAchats[##1,3]}{1}[\MyLettera]%
+ % Si c'est un !, on affiche pas
+ % Sinon, on affiche
+ \IfStrEq{\MyLettera}{!}{%
+ \PfCPrixInsulte*{\PrixTicket{\ListePUnitaires[##1]}}%
+ }{%
+ \xintifboolexpr{\fpeval{\ListeQuantites[##1]}==1}{}{%
+ \PrixTicket{\ListePUnitaires[##1]}%
+ }%
+ }%
+ }%
+ }%
+ &\Block[r]{}{%
+ \StrChar{\ListeAchats[##1,3]}{1}[\MyLetter]%
+ % Si le premier caractère est !, il faut regarder si le deuxième caractère est une étoile
+ \IfStrEq{\MyLetter}{!}{%
+ \StrChar{\ListeAchats[##1,3]}{2}[\MyLettera]%
+ \IfStrEq{\MyLettera}{*}{%
+ \PfCPrixInsulte*{\PrixTicket{\fpeval{\ListeQuantites[##1]*\ListePUnitaires[##1]}}}%
+ }{%
+ \PrixTicket{\fpeval{\ListeQuantites[##1]*\ListePUnitaires[##1]}}%
+ }%
+ }{%il faut regarder si c'est une étoile
+ \StrChar{\ListeAchats[##1,3]}{1}[\MyLettera]%
+ \IfStrEq{\MyLettera}{*}{%
+ \PfCPrixInsulte{\PrixTicket{\fpeval{\ListeQuantites[##1]*\ListePUnitaires[##1]}}}%
+ }{%
+ \PrixTicket{\fpeval{\ListeQuantites[##1]*\ListePUnitaires[##1]}}%
+ }%
+ }%
+ }\\
+ }%
+ \\%
+ \Cdots\\%
+ Total&&&\Block[r]{}{\ifboolKV[TicketCaisse]{Total}{\ifnum\thePfCNbInsulte=0\relax\PrixTicket{\PfCTCTotal}\else\PfCPrixInsulte*{\PrixTicket{\PfCTCTotal}}\fi}{\PfCPrixInsulte*{\PrixTicket{\PfCTCTotal}}}}\\%
+ Espèces&&&\Block[r]{}{\PrixTicket{\useKV[TicketCaisse]{Especes}}}\\%
+ Rendu&&&\Block[r]{}{\ifboolKV[TicketCaisse]{Rendu}{\PrixTicket{\fpeval{\useKV[TicketCaisse]{Especes}-\PfCTCTotal}}}{\PfCPrixInsulte*{\PrixTicket{\fpeval{\useKV[TicketCaisse]{Especes}-\PfCTCTotal}}}}}\\%
+ \\%
+ \Block{1-4}{\footnotesize\useKV[TicketCaisse]{DateAchat}\qquad\useKV[TicketCaisse]{HeureAchat}}&&&\\%
+ \end{NiceTabular}
+ }%
+}% \ No newline at end of file