About
Shop
LaTeX
Software
Books
Gallery
News
Contact
Blog
Settings
Account
Latest news 2024-10-15: New blog post: Tales for Our Times Book Launch.


4.1 Writing an Invoice Using the isodoc Class

The isodoc class [21] can be used to create either letters (see §3.4 Writing a Letter Using the isodoc Class) or invoices. To generate an invoice you need to use:

\invoice[options]{contents}

This is analogous to isodoc's \letter command discussed in §3.4 Writing a Letter Using the isodoc Class. As with \letterkey=value list of options can be set using the optional argument ⟨options⟩ or using the command:

\setupdocument{options}

In addition to those described in §3.4 Writing a Letter Using the isodoc Class, there are also some options that relate to invoices. Some of these are described below. See the isodoc user guide [21] for details of the options not described in this book, which are omitted for brevity.

Some of the options that set payment information are listed below:

term
The payment term in days.
currency
Currency (default is euro).
accountno
Bank account number.
routingno
The bank's routing number (may be omitted).
accountname
Bank account name (may be omitted).
iban
Your International Bank Account Number (enter in lower case).
bic
Your Bank Identifier Code (enter in lower case).
vatno
Your VAT number.

The options that set the payment acceptance part:

accept
Show the acceptance data.
acceptaccount
Payer's bank account number.
acceptaddress
Payer's address (separate lines with \\).
accepteuros
Euros (or equivalent) part of the amount to be paid.
acceptcents
Cents (or equivalent) part of the amount to be paid.
acceptdescription
Description.
acceptreference
Reference.

As with \letter you may have multiple \invoice commands within a document, but the ⟨contents⟩ part is more complicated. This argument will typically contain:

\itable{contents}

This creates a two-column tabular-like environment with the given contents. You may use & and \\ but the isodoc class provides some convenient commands to do this for you:

\iitem{item description}{amount}

This puts ⟨item description⟩ in the first column and ⟨amount⟩ in the second column.

\itotal[tag]{amount}

This adds a row for the total amount. The optional argument may be used to insert a tag, such as “Subtotal”.

In addition to \itable, you can also use

\accountdata

To generate a table containing the account information needed to pay the invoice.

Example 22. An Invoice (isodoc class)

The above can be put together to create a simple invoice, listed below. Some of the options used in this example were introduced in §3.4 Writing a Letter Using the isodoc Class.

\documentclass{isodoc}

\setupdocument
{
  language={en-GB},
  company={University of Somewhere},
  who={Mr Big Head},
  street={Academic Lane},
  city={Some City},
  zip={AB3 4YZ},
  country={United Kingdom},
  countrycode={GB},
  areacode={44},
  cityzip,
  date=2014-03-01,
  subject=Sample Project,
  currency={\pounds}
}

\begin{document}
\invoice
[
  ourref=1234,
  to={Miss Polly Parrot\\42 The Lane\\Some Town\\Noshire AB1 2XY}
]
{%
  \itable
  {%
    \iitem{Proof-reading}{300.00}
    \iitem{Train Fare}{43.95}
    \itotal{342.95}
  }
  \\[3ex]\accountdata}
\end{document}

(You can download or view this example.) The resulting document is shown in Figure 4.1.

Figure 4.1: Invoice Using the isodoc Class
 

University of Somewhere


Mr Big Head
Academic Lane
Some City AB3 4YZ

Miss Polly Parrot
42 The Lane
Some Town
Noshire AB1 2XY

Your letter of Your reference Our reference Date
    1234 1st March 2014

Subject: Sample Project

invoice

Description Amount (£)
Proof-reading 300.00
Train Fare 43.95
Total 342.95

Banking data:
Reference: 1234

(There is a horizontal rule in the invoice table after the header row spanning both columns and a horizontal rule just spanning the second column above the total amount. There is also a vertical rule between the two columns.)

End of Image.

Exercise 12. Creating an Invoice for a Customer (isodoc class)

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 will need to calculate the total for yourself.

You can download or view a solution.

For the More Adventurous

Instead of explicitly writing the customer and order information, fetch the values either from the sample CSV files (§2.5.1 Sample CSV Files) or via two join statements on the tables in the samples SQL database (§2.5.3 Sample SQL Tables). This order can be identified by the row with the “id” field equal to 2 in the sample ordergroups.csv file or ordergroups SQL table. If you use the SQL database, you can perform the summations in the SELECT statement. If you use the CSV data, then it's more complicated. Although you can perform calculations using the commands described in §2.1.3 Arithmetic, those commands can't be used within \itable as it uses the tabularx package [13] to layout the table which processes its contents multiple times which will throw the calculations out. Instead you will need to employ the type of method described in Exercise 11 or perform two iterations over the data.

You can download or view a solution using the CSV files or download or view a solution using the SQL database.


This book is also available as A4 PDF or 12.8cm x 9.6cm PDF or paperback (ISBN 978-1-909440-07-4).

© 2015 Dickimaw Books. "Dickimaw", "Dickimaw Books" and the Dickimaw parrot logo are trademarks. The Dickimaw parrot was painted by Magdalene Pritchett.

Terms of Use Privacy Policy Cookies Site Map FAQs