4.2⁑Writing an Invoice Using the invoice Package

At the time of writing, the current version of invoice is 0.9 (dated 2011-10-01). This loads the fp package using \input rather than \usepackage, which has unfortunate side-effects as it indirectly loads fp.sty through fp.tex but fp.tex is intended for Plain TeX and messes with the definition of \ProvidesPackage and \RequirePackage. Until this is fixed, you need to make sure that you load invoice after all your other packages.

The invoice package [17] defines the invoice environment that's used to generate the invoice.

\begin{invoice}{base currency}{VAT}

The first argument ⟨base currency⟩ is the currency name and the second argument ⟨VAT⟩ is the VAT percentage (without the percent sign). The ⟨VAT⟩ may be 0, in which case the VAT entries are hidden from the invoice, or 0.0, in which case the VAT entries are displayed but show zero-rated VAT.

Take care if you want to use a dollar sign. An error will occur if you use \$as the base currency unless you also load the fontenc package with the T1 option. [Why bother with inputenc and fontenc?] (Other options may also work, but the default OT1 font type fails.) This problem can also happen with other currency commands, such as \textdollar (textcomp package [59]) and \pounds, so where possible use fontenc with invoice. If for some reason you don't want to load fontenc, then you can use \string$ instead of \\$ as a workaround. However, it's a good idea in general to use the fontenc package anyway. If you use fontenc remember to use inputenc as well.

Within the invoice environment you can set the project title using:

\ProjectTitle{title}

You must have at least one project title in your invoice environment.

After the project title you specify the fees using:

\Fee{description}{rate/unit}{count}

the local expenses using:

\EBC{description}{amount}

and the foreign expenses using:

\EFC{description}{foreign currency}{amount}{conversion rate}{base currency result}

You may have multiple instances of these commands. Either the fees or the expenses may be omitted, but if both are present the fees must come first.

The fees must have a description (first argument), the rate per unit of work (second argument) and the number of units (third argument). For example, a fee for proof-reading a document at a cost of £150 per day for two days:

\Fee{Proof-reading}{150}{2} 

The local expenses must have a description (first argument) and the amount (second argument). For example, to claim the cost of a £43.95 train ticket:

\EBC{Train fare}{43.95} 

The foreign expenses must have a description (first argument), the name of the foreign currency (second argument), the cost in terms of the foreign currency unit (third argument), the conversion rate (fourth argument) and the result of the currency conversion (the fifth argument). One or other of the last two arguments may be empty.

For example, to charge for hotel accommodation at €300 with an exchange rate of 0.82:

\EFC{Hotel}{\texteuro}{300}{0.82}{} 

or to charge for hotel accommodation at €300 with a local currency value of 246.67:

\EFC{Hotel}{\texteuro}{300}{}{246.67} 

(Note that if you want to use \texteuro as in this example, you need to load the textcomp package [59].)

You can hide expenses that should contribute to the total but don't need to be itemized using:

\EBCi{⟨description⟩}{⟨amount⟩} 

for local expenses and

\EFCi{⟨description⟩}{⟨foreign currency⟩}{⟨amount⟩}{⟨conversion rate⟩}{⟨base currency result⟩} 

for foreign expenses. The arguments are the same as for \EBC and \EFC. You can make a subtotal appear for all the hidden expenses using:

You may also specify a discount using:

\Discount{description}{amount}

where ⟨description⟩ is a description about the discount and ⟨amount⟩ is the amount of the discount in terms of the base currency unit.

Example 23. An Invoice (invoice package)

The above can be put together to form a simple invoice:

\begin{invoice}{\pounds}{20}
\ProjectTitle{Sample Project}
\EBC{Train fare}{43.95}
\EFC{Hotel}{\texteuro}{300}{0.82}{}
\end{invoice}


This produces the invoice shown in Figure 4.2. You can download or view this example.

Figure 4.2: Sample Invoice (invoice package)

The invoice package provides some multilingual support so you can use it with babel [7]. If there is no support for your language, follow the instructions in the file invoice.def which is located in the same directory as invoice.sty. Alternatively, you can redefine the command names that generate the invoice tags if they don't suit your purpose. For example:

\renewcommand{\Fees}{Products}
\renewcommand{\UnitRate}{Price}
\renewcommand{\Count}{Quantity}
\renewcommand{\Activity}{Product}


Exercise 13. Creating an Invoice for a Customer (invoice package)

This exercise is like Exercise 12 except that now you need to create the document using the invoice package instead of the isodoc class (and you don't need to compute the total here as the invoice package does it for you).

Create an invoice to be sent to José Arara at Nenhuma Rua, São Paulo, 123457, Brazil for 1 copy of the hardback book “‘Duck and Goose’: an allegory for modern times?” at 59.99, 20 copies of the paperback book “My Friend is a Duck” at 14.99 per copy, and 1 copy of the ebook “Annotated Notes on the ‘Duck and Goose’ chronicles” at 8.99. There is a promotional discount of 2.50 for this order. The cost of postage and packaging is 20.00.

You can choose the currency unit to suit your location, although some exchange rates might make these seem either very cheap or very expensive books, but don't worry about that. (Remember to use textcomp and fontenc packages for the currency symbol.) In the UK, physical books are zero-rated but ebooks are subject to the standard 20% VAT rate, so for simplicity assume that the ebook price includes VAT and just use 0 to hide VAT from the invoice.

(Remember that invoice is a package not a class file, so you need to choose an appropriate class to use with it. For example, you might want to use it with the letter class so you can print it on headed paper.) You can download or view a solution.