| 1 |
\documentclass[10pt]{ltxdoc} |
| 2 |
\usepackage[]{invoice} |
| 3 |
%\usepackage{hyperref} |
| 4 |
|
| 5 |
\title{\texttt{invoice \InvoiceVersion}\\ |
| 6 |
A Package for Writing Invoices} |
| 7 |
\author{Oliver Corff} |
| 8 |
\date{August 6th, 2018} |
| 9 |
\begin{document} |
| 10 |
\maketitle |
| 11 |
|
| 12 |
\tableofcontents |
| 13 |
|
| 14 |
\section{Introduction} |
| 15 |
|
| 16 |
The \texttt{invoice} package was conceived in late 2000 when the |
| 17 |
author had to dig through a truly aweful pile of expense bills |
| 18 |
without having a spreadsheet featuring \LaTeXe-compliant output (or |
| 19 |
any spreadsheet, for that purpose) available. After several |
| 20 |
miscalculations with a pocket calculator due to forgotten or |
| 21 |
double entries the idea came up to have \LaTeXe\ do the calculation |
| 22 |
work. As such, the package in its present stage is highly |
| 23 |
specialized with regard to the documents it generates. The |
| 24 |
\texttt{invoice} package is basically a tailor-made solution for a |
| 25 |
consultant who charges fees and claims all sorts of expenses, |
| 26 |
sometimes working on different assignments for the same client. |
| 27 |
|
| 28 |
The author expresses his gratitude to |
| 29 |
Robert Inder, |
| 30 |
Thilo Barth, |
| 31 |
Jacco Kok, |
| 32 |
Fred Donck, |
| 33 |
Jacopo, |
| 34 |
Katrin Mittelbach, |
| 35 |
Johann Spies, |
| 36 |
Petr Svarny, |
| 37 |
Ian Wormsbecker, |
| 38 |
Vincent Tougait |
| 39 |
and |
| 40 |
Robin Fairbairns |
| 41 |
who contributed ideas, corrections, |
| 42 |
bugfixes and caption translations after the first discussions on |
| 43 |
\texttt{comp.text.tex} and the initial release of \texttt{invoice} as well as |
| 44 |
later on by providing patch suggestions and label translations. |
| 45 |
|
| 46 |
Given the current capabilities of \texttt{invoice}, it should well |
| 47 |
be possible to extend the capabilities of this package in the future |
| 48 |
or to rewrite it in a generalized fashion. |
| 49 |
|
| 50 |
\section{Software Requirements} |
| 51 |
|
| 52 |
The \texttt{invoice} environment runs under \LaTeXe\ and relies on the |
| 53 |
\texttt{calc.sty} (providing infix arithmetic) and \texttt{fp} |
| 54 |
(providing fixed point arithmetic) utilities to do its work which can be found |
| 55 |
at CTAN% |
| 56 |
\footnote{The \texttt{fp} package is found at |
| 57 |
\texttt{CTAN:macros/latex/contrib/fp}, |
| 58 |
and \texttt{calc} is found at |
| 59 |
\texttt{CTAN:macros/latex/required/tools/}.}. |
| 60 |
Compile and read \texttt{00README.tex} for further information if |
| 61 |
you are not sure whether these packages are installed at your site. |
| 62 |
|
| 63 |
\section{The \texttt{invoice} Environment} |
| 64 |
|
| 65 |
Within a given document, invoices are built with the |
| 66 |
\texttt{invoice} environment\footnote{Users of the KOMA-Script |
| 67 |
class \texttt{scrlettr.cls} are kindly requested to use |
| 68 |
\texttt{invoiceenv} instead; see also page~\pageref{koma}.}. |
| 69 |
Figure~\ref{structure} on page~\pageref{structure} shows the |
| 70 |
logical structure of an invoice as well as its basic commands. |
| 71 |
In case a full-fledged invoice stationary is needed, it is recommended |
| 72 |
to use the \texttt{invoice} environment within existing business |
| 73 |
letters which may have been pre-defined already. The \texttt{invoice} |
| 74 |
package itself does not provide tools for including company logos, |
| 75 |
recipient's addresses, bank account numbers etc. as these are usually |
| 76 |
covered by the various \texttt{letter} classes available for \LaTeXe. |
| 77 |
|
| 78 |
\begin{figure}[h] |
| 79 |
\begin{center} |
| 80 |
\fbox{ |
| 81 |
\begin{minipage}{8.5cm}% |
| 82 |
\textbf{\huge --- Invoice ---\\[2mm]} |
| 83 |
\texttt{\Large \char92 begin\{invoice\}\{...\}\{...\}\\[2mm]} |
| 84 |
\fbox{ |
| 85 |
\begin{minipage}{7.0cm} |
| 86 |
\textbf{\Large --- Project ---\\[1.5mm]} |
| 87 |
\texttt{\large\char92 ProjectTitle\{...\}\\[1.5mm]} |
| 88 |
\fbox{ |
| 89 |
\begin{minipage}{5.5cm} |
| 90 |
\textbf{\large --- Fees ---\\} |
| 91 |
\texttt{\char92 Fee\{...\}\{...\}\{...\}}\\ |
| 92 |
...\\ |
| 93 |
...\\ |
| 94 |
\end{minipage} |
| 95 |
}\\[2mm] |
| 96 |
\fbox{ |
| 97 |
\begin{minipage}{5.5cm} |
| 98 |
\textbf{\large --- Expenses (local) ---\\} |
| 99 |
\texttt{\char92 EBC\{...\}\{...\}}\\ |
| 100 |
...\\ |
| 101 |
...\\ |
| 102 |
\textbf{\large --- Expenses (foreign) ---\\} |
| 103 |
\texttt{\char92 EFC\{...\}\{...\}\{...\}\{...\}\{...\}}\\ |
| 104 |
...\\ |
| 105 |
...\\ |
| 106 |
\end{minipage} |
| 107 |
}\\[2mm] |
| 108 |
\end{minipage} |
| 109 |
}\\[2mm] |
| 110 |
\fbox{ |
| 111 |
\begin{minipage}{7.0cm} |
| 112 |
\textbf{\Large --- \dots\ More Projects\dots\ ---} |
| 113 |
\end{minipage} |
| 114 |
}\\[2mm] |
| 115 |
% \fbox{ |
| 116 |
% \begin{minipage}{7.0cm} |
| 117 |
% \textbf{\Large --- Project ---} |
| 118 |
% \end{minipage} |
| 119 |
% }\\ |
| 120 |
\texttt{\Large\char92 end\{invoice\}} |
| 121 |
\end{minipage} |
| 122 |
} |
| 123 |
\end{center} |
| 124 |
\caption{The \texttt{invoice} Environment |
| 125 |
and its Logical Structure\label{structure}} |
| 126 |
\end{figure} |
| 127 |
|
| 128 |
Invoices contain one or more projects which in return contain the charged |
| 129 |
items, either fees (plus tax, if applicable) and/or expenses. An |
| 130 |
invoice with one project is announced by saying |
| 131 |
|
| 132 |
\begin{verbatim} |
| 133 |
\begin{invoice}{<Base Currency>}{<VAT>} |
| 134 |
\ProjectTitle{...}% |
| 135 |
\end{invoice} |
| 136 |
\end{verbatim} |
| 137 |
|
| 138 |
There is no limit for the number of projects in an invoice, as there |
| 139 |
is no limit for the number of invoices per document. |
| 140 |
|
| 141 |
The \texttt{invoice} environment requires two arguments: |
| 142 |
\begin{enumerate} |
| 143 |
\item \texttt{<Base Currency>} is the name of the currency |
| 144 |
in which the invoice is charged, e.\,g. DM, Euro, |
| 145 |
US\$, RMB etc. |
| 146 |
\item \texttt{<VAT>} is the percentage rate of VAT which is charged; |
| 147 |
in Germany this is currently (autumn 2011) 19\%. If |
| 148 |
no VAT is required, enter a \texttt{0} |
| 149 |
(\textit{zero}) here. It is neither necessary nor |
| 150 |
permissible to use a percent sign here. As some |
| 151 |
countries (e.\,g. France) have fractions of |
| 152 |
percentages (like 16.9\%), you would in this case |
| 153 |
enter \verb|16.9| (without any percent sign). |
| 154 |
|
| 155 |
Setting the VAT rate to \verb-0- produces the side |
| 156 |
effect that the lines stating the VAT subtotals and |
| 157 |
totals disappear. |
| 158 |
|
| 159 |
If it is, however, desired to show the VAT results |
| 160 |
even if they amount to zero, enter \verb-0.0- instead. |
| 161 |
\end{enumerate} |
| 162 |
|
| 163 |
|
| 164 |
\subsection{Projects} |
| 165 |
|
| 166 |
An invoice contains items which are usually, in the case of e.\,g. |
| 167 |
consultancy fees and related expenses like hotel bills and air |
| 168 |
fares, attributed to a given case or \textit{project}, or |
| 169 |
cost center, or ``Kostenstelle'' (in German). |
| 170 |
|
| 171 |
A project contains any of three different types of charged items: |
| 172 |
\begin{enumerate} |
| 173 |
\item \textbf{Fees}. A tax can be added, if applicable. Fees |
| 174 |
are always charged in the |
| 175 |
base currency |
| 176 |
of the invoice. |
| 177 |
\item \textbf{Local Expenses}. Local expenses are charged in |
| 178 |
units of the |
| 179 |
base currency |
| 180 |
of the invoice. |
| 181 |
\item \textbf{Foreign Expenses}. Foreign expenses are charged in |
| 182 |
units of any given foreign currency. Either the |
| 183 |
base currency |
| 184 |
equivalent is known (as taken from a credit card |
| 185 |
billing statement, for example), or, if not, an |
| 186 |
exchange rate between foreign currency and base |
| 187 |
currency has to be stated. |
| 188 |
\end{enumerate} |
| 189 |
|
| 190 |
\textbf{Nota bene:} The order of fees and expenses is fixed. Either fees or |
| 191 |
expenses can be omitted, but expenses must be charged \textit{after} |
| 192 |
fees. |
| 193 |
|
| 194 |
|
| 195 |
\section{The First Example: How to Charge Fees} |
| 196 |
|
| 197 |
|
| 198 |
A consultant charges fees per day, hour or any other unit. Usually |
| 199 |
this unit is agreed upon in a contract and there is no further need |
| 200 |
to refer to this unit but by its count. This is done by the |
| 201 |
\verb-\Fee{}{}{}- command: |
| 202 |
|
| 203 |
\begin{verbatim} |
| 204 |
\Fee{<Contents>}{<Rate/Unit>}{<Count>} |
| 205 |
\end{verbatim} |
| 206 |
|
| 207 |
Let's assume an interim manager |
| 208 |
charges Euro 1818.00 a day for 12 working days while |
| 209 |
negotiating a major project, nicknamed \textit{Project Phenix}. |
| 210 |
He also charges Euro 2750.00 a day for analysing and negotiating |
| 211 |
the restructuring of the sales division, a work he spent 9 days with. |
| 212 |
|
| 213 |
\subsection{Invoices with VAT} |
| 214 |
|
| 215 |
We further assume that the consultant is required to charge VAT. |
| 216 |
All information above would be entered into the invoice as follows: |
| 217 |
|
| 218 |
\begin{verbatim} |
| 219 |
\begin{invoice}{Euro}{19} |
| 220 |
\ProjectTitle{Project Phenix}% |
| 221 |
% Contents Rate/Unit Count |
| 222 |
\Fee{Some really lengthy and utterly |
| 223 |
tedious negotiation} {1818.00} {12} |
| 224 |
|
| 225 |
\ProjectTitle{Sales Restructuring}% |
| 226 |
% Contents Rate/Unit Count |
| 227 |
\Fee{Sales Structure Analysis} {2750.00} { 6} |
| 228 |
\Fee{Negotiation with Agents} {2750.00} { 3} |
| 229 |
\end{invoice} |
| 230 |
\end{verbatim} |
| 231 |
|
| 232 |
And here is how the result looks like: |
| 233 |
|
| 234 |
\begin{invoice}{Euro}{19} |
| 235 |
\ProjectTitle{Project Phenix}% |
| 236 |
\Fee{Some really lengthy and utterly |
| 237 |
tedious negotiation} {1818.00} {12} |
| 238 |
|
| 239 |
\ProjectTitle{Sales Restructuring}% |
| 240 |
\Fee{Sales Structure Analysis} {2750.00} { 6} |
| 241 |
\Fee{Negotiation with Agents} {2750.00} { 3} |
| 242 |
\end{invoice} |
| 243 |
|
| 244 |
Hints: If the base currency is to contain a dollar sign (\$), then |
| 245 |
dollar sign must be entered in the form of \verb|\string$| |
| 246 |
or otherwise the command writing the log file data will fail. The |
| 247 |
contents of each fee may be verbose; while the column width is |
| 248 |
limited, text contents longer than the column width wraps over |
| 249 |
several columns, if necessary. |
| 250 |
|
| 251 |
The astute observer will note that a line beginning with ``Subtotal~Fees'' |
| 252 |
appeared in the output of the Sales Restructuring Project without explicit |
| 253 |
input to this effect from the user's side. The full grammar of the Fee block |
| 254 |
requires that all fees are closed by a fee subtotal. Internally, |
| 255 |
\texttt{invoice} is defined as a finite state automaton providing |
| 256 |
mechanisms to insert a fee subtotal if logic requires it, and print |
| 257 |
its value if it makes sense to humans, which is the case if there is more |
| 258 |
than one fee. |
| 259 |
|
| 260 |
Note that there is an explicit command \texttt{\char92 STFee} which will |
| 261 |
produce a subtotal of the fees charged so far. This can be used if |
| 262 |
you want to show fee subtotals within the same project. |
| 263 |
|
| 264 |
|
| 265 |
\subsection{Invoices without VAT} |
| 266 |
|
| 267 |
As mentioned above, an invoice may be calculated without any VAT. |
| 268 |
The VAT lines may completely disappear, as in the following |
| 269 |
example: |
| 270 |
\begin{verbatim} |
| 271 |
\begin{invoice}{Euro}{0} |
| 272 |
\ProjectTitle{Project Phenix}% |
| 273 |
% Contents Rate/Unit Count |
| 274 |
\Fee{Some really lengthy and utterly |
| 275 |
tedious negotiation} {1818.00} {12} |
| 276 |
|
| 277 |
\ProjectTitle{Sales Restructuring}% |
| 278 |
% Contents Rate/Unit Count |
| 279 |
\Fee{Sales Structure Analysis} {2750.00} { 6} |
| 280 |
\Fee{Negotiation with Agents} {2750.00} { 3} |
| 281 |
\end{invoice} |
| 282 |
\end{verbatim} |
| 283 |
|
| 284 |
|
| 285 |
Figure~\ref{invoice_without_VAT} on |
| 286 |
page~\pageref{invoice_without_VAT} |
| 287 |
shows the result. |
| 288 |
|
| 289 |
\begin{figure}[h] |
| 290 |
\begin{invoice}{Euro}{0} |
| 291 |
\ProjectTitle{Project Phenix}% |
| 292 |
\Fee{Some really lengthy and utterly |
| 293 |
tedious negotiation} {1818.00} {12} |
| 294 |
|
| 295 |
\ProjectTitle{Sales Restructuring}% |
| 296 |
\Fee{Sales Structure Analysis} {2750.00} { 6} |
| 297 |
\Fee{Negotiation with Agents} {2750.00} { 3} |
| 298 |
\end{invoice} |
| 299 |
\caption{A complete invoice |
| 300 |
with fees but no VAT.\label{invoice_without_VAT}} |
| 301 |
\end{figure} |
| 302 |
|
| 303 |
In contrast, if for any reason the VAT subtotals and totals should |
| 304 |
be kept visible despite a \textit{value} of zero, then use a VAT |
| 305 |
value of \verb-0.0- as in the following example: |
| 306 |
\begin{verbatim} |
| 307 |
\begin{invoice}{Euro}{0.0} |
| 308 |
\ProjectTitle{Project Phenix}% |
| 309 |
% Contents Rate/Unit Count |
| 310 |
\Fee{Some really lengthy and utterly |
| 311 |
tedious negotiation} {1818.00} {12} |
| 312 |
|
| 313 |
\ProjectTitle{Sales Restructuring}% |
| 314 |
% Contents Rate/Unit Count |
| 315 |
\Fee{Sales Structure Analysis} {2750.00} { 6} |
| 316 |
\Fee{Negotiation with Agents} {2750.00} { 3} |
| 317 |
\end{invoice} |
| 318 |
\end{verbatim} |
| 319 |
|
| 320 |
|
| 321 |
Figure~\ref{invoice_with_zero_VAT} on |
| 322 |
page~\pageref{invoice_with_zero_VAT} |
| 323 |
shows the result. |
| 324 |
|
| 325 |
\begin{figure}[h] |
| 326 |
\begin{invoice}{Euro}{0.0} |
| 327 |
\ProjectTitle{Project Phenix}% |
| 328 |
\Fee{Some really lengthy and utterly |
| 329 |
tedious negotiation} {1818.00} {12} |
| 330 |
|
| 331 |
\ProjectTitle{Sales Restructuring}% |
| 332 |
\Fee{Sales Structure Analysis} {2750.00} { 6} |
| 333 |
\Fee{Negotiation with Agents} {2750.00} { 3} |
| 334 |
\end{invoice} |
| 335 |
\caption{A complete invoice |
| 336 |
with fees but zero VAT.\label{invoice_with_zero_VAT}} |
| 337 |
\end{figure} |
| 338 |
|
| 339 |
|
| 340 |
\section{The Second Example: How to Claim Expenses} |
| 341 |
|
| 342 |
Expenses can be charged in base currency or in any foreign currency. |
| 343 |
The base currency's name should be announced once at the beginning |
| 344 |
of the invoice. |
| 345 |
|
| 346 |
\subsection{Expenses in Base Currency} |
| 347 |
|
| 348 |
The shape of an expense item in base currency is simple: |
| 349 |
|
| 350 |
\begin{verbatim} |
| 351 |
\EBC{<Contents>} {<Amount>} |
| 352 |
\end{verbatim} |
| 353 |
|
| 354 |
Both fields contain mandatory arguments: |
| 355 |
|
| 356 |
\begin{enumerate} |
| 357 |
\item \texttt{<Contents>} contains a description of the |
| 358 |
charged item, e.\,g. ``Hotel'', ``Airport Tax'' or |
| 359 |
whatever. |
| 360 |
\item \texttt{<Amount>} contains the amount in base currency |
| 361 |
units. |
| 362 |
\end{enumerate} |
| 363 |
|
| 364 |
|
| 365 |
\subsection{Expenses in Foreign Currency} |
| 366 |
|
| 367 |
Charging an expense in foreign currency is only slightly more |
| 368 |
complicated. The command is: |
| 369 |
|
| 370 |
\begin{verbatim} |
| 371 |
\EFC{<Contents>} |
| 372 |
{<Foreign Currency>}{<Amount>} |
| 373 |
{<Conversion Rate>}{<Base Currency Result>} |
| 374 |
\end{verbatim} |
| 375 |
|
| 376 |
Arguments to the five fields are partially mandatory, partially optional: |
| 377 |
\begin{enumerate} |
| 378 |
\item \texttt{<Contents>} contains a description of the |
| 379 |
charged item, e.\,g. ``Hotel'', ``Airport Tax'' or |
| 380 |
whatever. |
| 381 |
|
| 382 |
\item \texttt{<Foreign Currency>} contains the name of the |
| 383 |
foreign currency. |
| 384 |
|
| 385 |
\item \texttt{<Amount>} contains the amount in foreign currency |
| 386 |
units. |
| 387 |
|
| 388 |
\item \texttt{<Conversion Rate>} contains the factor by |
| 389 |
which the foreign currency amount has to be |
| 390 |
multiplied in order to achieve the base currency |
| 391 |
result. If the base currency result is stated, |
| 392 |
then, and only then, the Conversion Rate can be |
| 393 |
omitted. |
| 394 |
|
| 395 |
\item \texttt{<Base Currency Result>} contains an optional |
| 396 |
amount in base currency units. Credit card billing |
| 397 |
statements show this amount which usually contains |
| 398 |
certain service charges of the credit card issuer; |
| 399 |
the base currency result is thus the true amount of |
| 400 |
money to be charged. If a \texttt{<Conversion Rate>} |
| 401 |
is given, stating a base currency result becomes |
| 402 |
optional. This is usually applied for expenses made |
| 403 |
with cash money. |
| 404 |
\end{enumerate} |
| 405 |
|
| 406 |
|
| 407 |
Since some of the arguments given to \verb-\EFC- are optional, |
| 408 |
there are basically two different forms of using this command. |
| 409 |
With the variant |
| 410 |
|
| 411 |
\begin{verbatim} |
| 412 |
\EFC{<Contents>}{<Foreign Currency>}{<Amount>} |
| 413 |
{<Conversion Rate>} % Conversion rate |
| 414 |
{} % Base currency empty! |
| 415 |
\end{verbatim} |
| 416 |
|
| 417 |
(amount in foreign currency given, as well as exchange rate stated), |
| 418 |
the command will automatically calculate the resulting amount in |
| 419 |
base currency. |
| 420 |
|
| 421 |
\begin{verbatim} |
| 422 |
\EFC{<Contents>} |
| 423 |
{<Foreign Currency>}{<Amount>} |
| 424 |
{} % Conversion rate empty! |
| 425 |
{<Base Currency Result>} % Base currency |
| 426 |
\end{verbatim} |
| 427 |
|
| 428 |
If, however, the exchange rate is omitted and the target amount in |
| 429 |
base currency is given, then this value is taken directly. Stating |
| 430 |
the resulting amount overrides the internal calculation mechanism. |
| 431 |
Examples are given below. We use our interim manager's invoice |
| 432 |
again, assuming this time that she spent working on Project Phenix |
| 433 |
12 days in her home country while the Sales Restructuring effort |
| 434 |
took her to Hong Kong. The taxi bills are paid in cash, hence she |
| 435 |
enters the (fictive) conversion rate, whereas the hotel is paid by |
| 436 |
credit card. She can then take the final amount from her credit card |
| 437 |
billing statement; an example input would look as follows: |
| 438 |
|
| 439 |
\begin{verbatim} |
| 440 |
\begin{invoice}{Euro}{19} |
| 441 |
\ProjectTitle{Project Phenix}% |
| 442 |
% Contents Rate/Unit Count |
| 443 |
\Fee{Negotiation} {1818.00} {12} |
| 444 |
% |
| 445 |
% Contents Amount |
| 446 |
\EBC{Hotel, 12 nights} {2400.00} |
| 447 |
|
| 448 |
\ProjectTitle{Sales Restructuring}% |
| 449 |
% Contents Rate/Unit Count |
| 450 |
\Fee{Sales Structure Analysis} {2750.00} { 6} |
| 451 |
\Fee{Negotiation with Agents} {2750.00} { 3} |
| 452 |
% |
| 453 |
% Contents Currency Amount Conv.Rate Result |
| 454 |
\EFC{Taxi Airport -- Hotel} {HK\$} {325.00} {0.2354} {} |
| 455 |
\EFC{Hotel, 9 nights} {HK\$} {9180.00} {} {2111.40} |
| 456 |
\end{invoice} |
| 457 |
\end{verbatim} |
| 458 |
|
| 459 |
Figure~\ref{full_invoice} on |
| 460 |
page~\pageref{full_invoice} |
| 461 |
shows the result. |
| 462 |
|
| 463 |
\begin{figure}[h] |
| 464 |
\begin{invoice}{Euro}{19} |
| 465 |
\ProjectTitle{Project Phenix}% |
| 466 |
\Fee{Negotiation} {1818.00} {12} |
| 467 |
% |
| 468 |
% Contents Amount |
| 469 |
\EBC{Hotel, 12 nights} {2400.00} |
| 470 |
|
| 471 |
\ProjectTitle{Sales Restructuring}% |
| 472 |
\Fee{Sales Structure Analysis} {2750.00} { 6} |
| 473 |
\Fee{Negotiation with Agents} {2750.00} { 3} |
| 474 |
% |
| 475 |
% Contents Currency Amount Conv.Rate Result |
| 476 |
\EFC{Taxi Airport -- Hotel} {HK\$} {325.00} {0.2354} {} |
| 477 |
\EFC{Hotel, 9 nights} {HK\$} {9180.00} {} {2111.40} |
| 478 |
\end{invoice} |
| 479 |
\caption{A complete invoice with fees and expenses.\label{full_invoice}} |
| 480 |
\end{figure} |
| 481 |
|
| 482 |
Again, a subtotal of the expenses appears only if there is more than |
| 483 |
one expense item in a project. |
| 484 |
|
| 485 |
|
| 486 |
\subsection{Hidden Expense Details} |
| 487 |
|
| 488 |
Occasionally it may be desirable to list only the total of expenses |
| 489 |
incurred, while hiding the structure of expenses. In such a case, |
| 490 |
the expense commands can be modified by attaching an \verb|i| to |
| 491 |
their names (as in \textit{invisible}). |
| 492 |
|
| 493 |
A hidden expense in base currency is thus declared as: |
| 494 |
|
| 495 |
\begin{verbatim} |
| 496 |
\EBCi{<Contents>} {<Amount>} |
| 497 |
\end{verbatim} |
| 498 |
|
| 499 |
A hidden expense in foreign currency is declared as: |
| 500 |
|
| 501 |
\begin{verbatim} |
| 502 |
\EFCi{<Contents>} |
| 503 |
{<Foreign Currency>}{<Amount>} |
| 504 |
{<Conversion Rate>}{<Base Currency Result>} |
| 505 |
\end{verbatim} |
| 506 |
|
| 507 |
Both commands accept and require exactly the same arguments as their |
| 508 |
visible counterparts. The expenses will be added to the expense subtotals |
| 509 |
and the invoice total in the same way as if they were visible. If there |
| 510 |
is no visible expense stated at all it may be useful to have at least |
| 511 |
a line with the expense subtotal appear; this is done by the \verb|STExpenses| |
| 512 |
command, as shown in the following example: |
| 513 |
|
| 514 |
\begin{verbatim} |
| 515 |
\begin{invoice}{Euro}{19} |
| 516 |
\ProjectTitle{Project Phenix}% |
| 517 |
% Contents Rate/Unit Count |
| 518 |
\Fee{Negotiation} {1818.00} {12} |
| 519 |
% |
| 520 |
% Contents Amount |
| 521 |
\EBCi{Hotel, 12 nights} {2400.00} |
| 522 |
% |
| 523 |
\STExpenses |
| 524 |
|
| 525 |
\ProjectTitle{Sales Restructuring}% |
| 526 |
% Contents Rate/Unit Count |
| 527 |
\Fee{Sales Structure Analysis} {2750.00} { 6} |
| 528 |
\Fee{Negotiation with Agents} {2750.00} { 3} |
| 529 |
% |
| 530 |
% Contents Currency Amount Conv.Rate Result |
| 531 |
\EFCi{Taxi Airport -- Hotel} {HK\$} {325.00} {0.2354} {} |
| 532 |
\EFCi{Hotel, 9 nights} {HK\$} {9180.00} {} {2111.40} |
| 533 |
\STExpenses |
| 534 |
\end{invoice} |
| 535 |
\end{verbatim} |
| 536 |
|
| 537 |
Figure~\ref{invoice_with_hidden_expenses} on |
| 538 |
page~\pageref{invoice_with_hidden_expenses} |
| 539 |
shows the result. |
| 540 |
|
| 541 |
\begin{figure}[h] |
| 542 |
\begin{invoice}{Euro}{19} |
| 543 |
\ProjectTitle{Project Phenix}% |
| 544 |
\Fee{Negotiation} {1818.00} {12} |
| 545 |
% |
| 546 |
% Contents Amount |
| 547 |
\EBCi{Hotel, 12 nights} {2400.00} |
| 548 |
% |
| 549 |
\STExpenses |
| 550 |
|
| 551 |
\ProjectTitle{Sales Restructuring}% |
| 552 |
\Fee{Sales Structure Analysis} {2750.00} { 6} |
| 553 |
\Fee{Negotiation with Agents} {2750.00} { 3} |
| 554 |
% |
| 555 |
% Contents Currency Amount Conv.Rate Result |
| 556 |
\EFCi{Taxi Airport -- Hotel} {HK\$} {325.00} {0.2354} {} |
| 557 |
\EFCi{Hotel, 9 nights} {HK\$} {9180.00} {} {2111.40} |
| 558 |
\STExpenses |
| 559 |
\end{invoice} |
| 560 |
\caption{A complete invoice with visible fees |
| 561 |
but invisible expenses.\label{invoice_with_hidden_expenses}} |
| 562 |
\end{figure} |
| 563 |
|
| 564 |
|
| 565 |
\section{Deduction of Discounts and Downpayments} |
| 566 |
|
| 567 |
Finally, it may be possible that previous downpayments etc. have to |
| 568 |
be considered for the invoice total. An optional discount line |
| 569 |
can state the item and deduct the amount from the invoice total. |
| 570 |
Deductions are always stated in base currency. They follow the following |
| 571 |
syntax: |
| 572 |
|
| 573 |
|
| 574 |
\begin{verbatim} |
| 575 |
\Discount{<Contents>} {<Amount>} |
| 576 |
\end{verbatim} |
| 577 |
|
| 578 |
Both fields contain mandatory arguments: |
| 579 |
|
| 580 |
\begin{enumerate} |
| 581 |
\item \texttt{<Contents>} contains a description of the |
| 582 |
discount item, e.\,g. ``Downpayment'', ``Tickets for |
| 583 |
private use'' or whatever. |
| 584 |
\item \texttt{<Amount>} contains the amount in base currency |
| 585 |
units. |
| 586 |
\end{enumerate} |
| 587 |
|
| 588 |
Figure~\ref{full_and_discounted_invoice} on |
| 589 |
page~\pageref{full_and_discounted_invoice} |
| 590 |
shows the result. |
| 591 |
|
| 592 |
\begin{figure}[h] |
| 593 |
\begin{invoice}{Euro}{19} |
| 594 |
\ProjectTitle{Project Phenix}% |
| 595 |
\Fee{Negotiation} {1818.00} {12} |
| 596 |
% |
| 597 |
% Contents Amount |
| 598 |
\EBC{Hotel, 12 nights} {2400.00} |
| 599 |
|
| 600 |
\ProjectTitle{Sales Restructuring}% |
| 601 |
\Fee{Sales Structure Analysis} {2750.00} { 6} |
| 602 |
\Fee{Negotiation with Agents} {2750.00} { 3} |
| 603 |
% |
| 604 |
% Contents Currency Amount Conv.Rate Result |
| 605 |
\EFC{Taxi Airport -- Hotel} {HK\$} {325.00} {0.2354} {} |
| 606 |
\EFC{Hotel, 9 nights} {HK\$} {9180.00} {} {2111.40} |
| 607 |
\Discount{Downpayment received} {2000.00} |
| 608 |
\end{invoice} |
| 609 |
\caption{A complete invoice with fees, |
| 610 |
expenses and a deduction.\label{full_and_discounted_invoice}} |
| 611 |
\end{figure} |
| 612 |
|
| 613 |
\section{Postprocessing} |
| 614 |
|
| 615 |
In order to allow the further processing of |
| 616 |
\texttt{invoice}-generated data, the log file contains the totals of |
| 617 |
fees, expenses and taxes in the form of \verb-key:value- pairs. This |
| 618 |
information appears also on the terminal while \LaTeXe\ runs. Please |
| 619 |
note that the key appearing in the log file is expressed in the same |
| 620 |
language as that of the master document. |
| 621 |
|
| 622 |
\section{Document Language} |
| 623 |
|
| 624 |
All column headers appearing in \texttt{invoice} can be redefined in |
| 625 |
order to match the language of the master document. E.\,g., headings |
| 626 |
like ``Total'' will automatically appear as ``Gesamtsumme'' if the |
| 627 |
document language is set to German (either via \texttt{babel} or |
| 628 |
\verb-\usepackage{german}-). |
| 629 |
|
| 630 |
Please observe that the \texttt{invoice} package must be called {\em |
| 631 |
after} the document language has been selected. |
| 632 |
|
| 633 |
This is correct: |
| 634 |
|
| 635 |
\begin{verbatim} |
| 636 |
\documentclass[10pt]{ltxdoc} |
| 637 |
\usepackage{german} |
| 638 |
\usepackage{invoice} % labels will now appear in German! |
| 639 |
\end{verbatim} |
| 640 |
|
| 641 |
This will not work: |
| 642 |
|
| 643 |
\begin{verbatim} |
| 644 |
\documentclass[10pt]{ltxdoc} |
| 645 |
\usepackage{invoice} |
| 646 |
\usepackage{german} % labels will still appear in English! |
| 647 |
\end{verbatim} |
| 648 |
|
| 649 |
|
| 650 |
\subsection{Specifying the Desired Language} |
| 651 |
|
| 652 |
It is also possible to ignore the global language settings and select |
| 653 |
a language local to the \texttt{invoice} package by specifying the |
| 654 |
desired language as an option: |
| 655 |
|
| 656 |
\begin{verbatim} |
| 657 |
\documentclass[10pt]{ltxdoc} |
| 658 |
\usepackage[german]{invoice} % labels in German, rest |
| 659 |
% of document in English |
| 660 |
\end{verbatim} |
| 661 |
|
| 662 |
This is useful whenever the desired language is not provided by the |
| 663 |
installation base where \texttt{invoice} is executed. |
| 664 |
|
| 665 |
At present, column labels produced by \texttt{invoice} can appear |
| 666 |
in ten languages: |
| 667 |
Afrikaans (use \verb|afrikaans|), |
| 668 |
Czech (use \verb|czech|), |
| 669 |
Dutch (use \verb|dutch|), |
| 670 |
English (use \verb|english|), |
| 671 |
Estonian (use \verb|estonian|), |
| 672 |
Finnish (use \verb|finnish|), |
| 673 |
French (use \verb|french|), |
| 674 |
German (use \verb|german| or \verb|ngerman|), |
| 675 |
Italian (use \verb|italian|), |
| 676 |
Spanish (use \verb|spanish|, \verb|spanishe| or \verb|spanishv|) and |
| 677 |
Swedish (use \verb|swedish|). |
| 678 |
|
| 679 |
German accommodates for both \verb|german| and \verb|ngerman|, |
| 680 |
however the output is the same. |
| 681 |
Spanish is exceptional as there are three different versions |
| 682 |
with differences in lexicon and grammar. There is one `traditional' |
| 683 |
version, the second is said to demonstrate a strong `New World' influence, |
| 684 |
and the third one is considered a variation in style, albeit |
| 685 |
traditional. |
| 686 |
|
| 687 |
\subsection{Setting the Decimal Separator} |
| 688 |
|
| 689 |
In most Continental European languages and typesetting conventions, |
| 690 |
the decimal separator is a comma \verb|,|, not a decimal point. |
| 691 |
In order to produce invoices with the comma as decimal separator, |
| 692 |
simply use \verb|comma| as a package option. |
| 693 |
|
| 694 |
\begin{verbatim} |
| 695 |
\documentclass[10pt]{ltxdoc} |
| 696 |
\usepackage{german} |
| 697 |
\usepackage[german,comma]{invoice} |
| 698 |
\end{verbatim} |
| 699 |
|
| 700 |
\subsection{Adding Labels in a New Language} |
| 701 |
|
| 702 |
Other languages can be added easily by editing the file |
| 703 |
\verb-invoicelabels.sty-. Language-dependent definitions are contained in |
| 704 |
the \verb-\if--clause. Extending the file is simple: |
| 705 |
|
| 706 |
\begin{enumerate} |
| 707 |
\item Copy the labels template to the end of the file. |
| 708 |
\item Remove the comments (\verb-%-) in column 1. |
| 709 |
\item Fill each label definition with the appropriate |
| 710 |
foreign language translation. |
| 711 |
\item Put the correct internal name of the foreign language |
| 712 |
into the condition expression of the \verb-\ifx-- |
| 713 |
and \verb-\ifnum--clauses. |
| 714 |
\end{enumerate} |
| 715 |
|
| 716 |
\begin{sloppypar} |
| 717 |
Whenever you create your own foreign language extension please kindly |
| 718 |
consider sending your modified \verb-invoicelabels.sty- file to the author |
| 719 |
(at \[email protected]+) |
| 720 |
so that it can be included in the next update. Future users can then |
| 721 |
share your work. |
| 722 |
\end{sloppypar} |
| 723 |
|
| 724 |
\section{Bugs} |
| 725 |
|
| 726 |
Certainly there are bugs. After all, this is not Moon, but Earth |
| 727 |
(where life is supposed to exist, as opposed to Moon). The author |
| 728 |
has not conducted extensive tests on the algebraic functions, and |
| 729 |
there may be rounding and truncating errors. |
| 730 |
|
| 731 |
The author considers it a bug that the decimal point cannot be |
| 732 |
replaced by a comma at present, while entering dollar signs |
| 733 |
requires the \verb|\string$| notation. |
| 734 |
|
| 735 |
Spurious spaces may distort the table layout. It is especially |
| 736 |
recommended to close all \verb"\ProjectTitle{...}%" lines with a |
| 737 |
percent mark, as shown. If the percent mark is omitted, the first |
| 738 |
column header is not properly aligned to the left. |
| 739 |
|
| 740 |
Breaking long invoice statements with many projects over several |
| 741 |
pages results in many orphans and widows. |
| 742 |
|
| 743 |
\subsection{\label{koma}Compatibility with KOMA-Script} |
| 744 |
|
| 745 |
Unfortunately, when first writing this package the author was not aware |
| 746 |
of the KOMA-Script classes, notably the class \texttt{scrlettr.cls} |
| 747 |
which defines its own \verb-\invoice{#1}- command, albeit with completely |
| 748 |
different scope, usage and syntax. KOMA-Script's \verb-\invoice{#1}- command |
| 749 |
accepts a number and prints ``Invoice no. \#1'' in a letter |
| 750 |
opening. Now that the names of the \texttt{invoice} package and |
| 751 |
environment have stuck it is easier to think of a workaround than to |
| 752 |
conceive a new name. Therefore, If the class \texttt{scrlettr.cls} is |
| 753 |
used, the environment \texttt{invoice} is automatically renamed to |
| 754 |
\texttt{invoiceenv}. Writing |
| 755 |
|
| 756 |
\begin{verbatim} |
| 757 |
\documentclass[10pt]{scrlettr} |
| 758 |
\usepackage{invoice} |
| 759 |
\begin{invoice}{Euro}{19} |
| 760 |
... |
| 761 |
... |
| 762 |
\end{verbatim} |
| 763 |
|
| 764 |
will result in an error message. Say \verb-\begin{invoiceenv}{Euro}{19}- |
| 765 |
instead. KOMA-Script's own \verb-\invoice{#1}- command is renamed to |
| 766 |
\verb-\invoiceno{#1}-, while \verb-\invoice{#1}- now generates an |
| 767 |
error message reminding KOMA-Script users to apply the renamed |
| 768 |
commands. |
| 769 |
|
| 770 |
\section{Desiderata} |
| 771 |
|
| 772 |
The \verb-invoice- package is far from complete. Future expansions |
| 773 |
should aim at making the package more flexible. How taxes are |
| 774 |
treated, etc., is at present a rather particular arrangement |
| 775 |
suitable for the author's immediate needs, but a more general |
| 776 |
solution can be designed as soon as more users reflect their needs |
| 777 |
to the author. |
| 778 |
\end{document} |