-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinvoice.tex
264 lines (219 loc) · 6.36 KB
/
invoice.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
%!TEX TS-program = xelatex
%!TEX encoding = UTF-8 Unicode
\documentclass[$fontsize$, a4paper]{article}
% LAYOUT
%--------------------------------
\usepackage{geometry}
\geometry{$geometry$, top=4.5cm, left=2.5cm, bottom=4.5cm, footskip=0cm, headsep=2cm}
% Footer
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\renewcommand{\headrulewidth}{0pt}
% No page numbers
\pagenumbering{gobble}
% Left align
\usepackage[document]{ragged2e}
$if(letterhead)$
% To include the letterhead
\usepackage{wallpaper}
\ULCornerWallPaper{1}{letterhead.pdf}
$endif$
% TYPOGRAPHY
%--------------------------------
\usepackage{fontspec}
\usepackage{xunicode}
\usepackage{xltxtra}
\usepackage{multirow}
% converts LaTeX specials (quotes, dashes etc.) to Unicode
\defaultfontfeatures{Mapping=tex-text}
\setromanfont [Ligatures={Common}, Numbers={OldStyle}]{$seriffont$}
\setsansfont[Scale=0.9]{$sansfont$}
% Set paragraph break
\setlength{\parskip}{1em}
% Custom ampersand
\newcommand{\amper}{{\fontspec[Scale=.95]{$seriffont$}\selectfont\itshape\&}}
$if(seriffont)$
\setmainfont[SmallCapsFeatures={LetterSpace=5,Letters=SmallCaps}]{$seriffont$}
$endif$
$if(sansfont)$
\setsansfont{$sansfont$}
$endif$
% Command required by how Pandoc handles the list conversion
\providecommand{\tightlist}{%
\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
% TABLE CUSTOMIZATION
%--------------------------------
\usepackage{tabularx}
\usepackage[compact]{titlesec} % For customizing title sections
\titlespacing*{\section}{0pt}{3pt}{-7pt} % Remove margin bottom from the title
\usepackage{arydshln} % For the dotted line on the table
\renewcommand{\arraystretch}{1.5} % Apply vertical padding to table cells
\usepackage{hhline} % For single-cell borders
\usepackage{enumitem} % For customizing lists
\setlist{nolistsep} % No whitespace around list items
\setlist[itemize]{leftmargin=0.5cm} % Reduce list left indent
\setlength{\tabcolsep}{9pt} % Larger gutter between columns
\usepackage{longtable}
\usepackage{fp}
\usepackage{booktabs}
\usepackage{numprint}
\npthousandsep{\,}
\newcounter{cnt}
\setcounter{cnt}{0}
\def\inc{\stepcounter{cnt}\thecnt}
\gdef\TotalHT{0}
% LANGUAGE
%--------------------------------
$if(lang)$
\usepackage{polyglossia}
\setmainlanguage{$polyglossia-lang.name$}
$endif$
% PDF SETUP
%--------------------------------
\usepackage[xetex, bookmarks, colorlinks, breaklinks]{hyperref}
\hypersetup
{
pdfauthor={$author.name$},
pdfsubject=Invoice Nr. $invoice-nr$,
pdftitle=Invoice Nr. $invoice-nr$,
linkcolor=blue,
citecolor=blue,
filecolor=black,
urlcolor=blue
}
% To display custom date
\usepackage[nodayofweek]{datetime}
% \newdate{date}{01}{12}{1867}
% \date{\displaydate{date}}
% Use this instead of \today: % \displaydate{date}
\def\mydate{\leavevmode\hbox{\twodigits\day.\twodigits\month.\the\year}}
\def\twodigits#1{\ifnum#1<10 0\fi\the#1}
\def\isodate{\leavevmode\hbox{\shortyear{\the\year}\twodigits\month\twodigits\day}}
\def\shortyear#1{\ifnum#1=2020 20\else \StrSubstitute{#1}{20}{} \fi}
% To split words
\usepackage{xstring}
% DOCUMENT
%--------------------------------
\begin{document}
\rhead{
\includegraphics[width=0.35\linewidth]{FragHenri.png}
}
\small
\textsc{\textbf{$author.name$}}
$for(from)$
\textbullet{} \textsc{$from$}
$endfor$
\vspace{1em}
\normalsize \sffamily
$for(to)$
$to$\\
$endfor$
\vspace{6em}
\begin{flushright}
\small
$if(date.year)$
% if a date is given
\newdate{date}{$date.day$}{$date.month$}{$date.year$}
\date{\displaydate{date}}
$author.city$, \displaydate{date}
$else$
% otherwise use current date
$author.city$, \today
$endif$
\end{flushright}
\vspace{1em}
$if(invoice-nr)$
\section*{\textsc{Rechnung} \textsc{\#$invoice-nr$}}
$else$
$if(date.year)$
% Short or extend every number to two digits. Add bill of the day
\section*{\textsc{Rechnung} \textsc{\#\shortyear{$date.year$}\ifnum $date.month$<10 0\fi $date.month$\ifnum $date.day$<10 0\fi $date.day$-\ifnum $billoftheday$<10 00\else \ifnum $billoftheday$<100 0\fi\fi $billoftheday$}}
$else$
\section*{\textsc{Rechnung} \textsc{\#\isodate-\ifnum $billoftheday$<10 00\else \ifnum $billoftheday$<100 0\fi\fi $billoftheday$}}
$endif$
$endif$
\footnotesize
\renewcommand\arraystretch{1.5}
\newcounter{pos}
\setcounter{pos}{0}
\setlength\dashlinedash{0.2pt}
\setlength\dashlinegap{1.5pt}
\setlength\arrayrulewidth{0.3pt}
$for(service)$
\FPmul\temp{$service.price$}{$service.quantity$}
\FPround\temp{\temp}{2}
\FPadd\total{\TotalHT}{\temp}
\FPround\total{\total}{2}
\global\let\TotalHT\total
$endfor$
\begin{tabularx}{\linewidth}{ccXcrr}
\hdashline[1pt/1pt]
\noalign{\vskip 2mm}
\textbf{Pos.} &
\textbf{Datum} &
\textbf{Beschreibung} &
\multicolumn{1}{l}{\textbf{Menge}} &
\multicolumn{1}{l}{\textbf{Einzelpreis}} &
\multicolumn{1}{c}{\textbf{Gesamt}} \\
\hline
$for(service)$
\noalign{\vskip 2mm}
\inc
& $if(service.date)$
$service.date$
$else$
\mydate
$endif$
& $service.description$
$if(service.details)$
\begin{itemize}
$for(service.details)$
\scriptsize
\item $service.details$
$endfor$
\end{itemize}
\vspace*{-\baselineskip}\leavevmode
$endif$
& \numprint{$service.quantity$}
& \FPround\two{$service.price$}{2}
\numprint{\two}~$currency$
& \FPmul\temp{$service.price$}{$service.quantity$}
\FPround\temp{\temp}{2}
\numprint{\temp}~$currency$
\\
$endfor$
\noalign{\vskip 2mm}
\hline
\multicolumn{5}{r@{~~~}}{\textbf{Gesamtbetrag:}} & \numprint{\TotalHT}~$currency$\\
\noalign{\vskip 2mm}
\end{tabularx}
\vspace{15mm}
\sffamily
\small
$closingnote$
\medskip
\IfFileExists{signature.pdf}
{
\includegraphics[height=3.5\baselineskip]{signature.pdf} \par
$author.name$
}
\cfoot{
\sffamily
\begin{flushleft}
Es wird gemäß §19 Abs. 1 Umsatzsteuergesetz keine Umsatzsteuer erhoben.\medskip\\
\end{flushleft}
\footnotesize
\renewcommand{\arraystretch}{1}
\parindent=0cm
\begin{tabularx}{\textwidth}{
@{}
llll}
\hline\\
$author.name$ & Tel.: $author.phone$ & $bank.name$ & Steuernummer:\\
\multirow{2}{*}{\parbox{3.5cm}{$for(from)$ $from$ \\ $endfor$}} & E-Mail: $author.email$ & Inhaber: $bank.owner$ & $author.taxnumber$\\
& Internet: $author.website$ & IBAN: $bank.iban$ & \\
&& BIC: $bank.bic$&
\end{tabularx}
}
\end{document}