summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/invoice-class/doc/invoice-class.tex
blob: 4e1e09ad7b4ceaaf0fa110adda078bda7d96f971 (plain)
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
\documentclass[11pt]{article}
\title{\textbf{Using the Invoice Class}}
\author{\textbf{Alan Munn}\\Department of Linguistics and Languages\\\texttt{\href{mailto:amunn@msu.edu}{amunn@msu.edu}}}
\date{Version 1.0\\January 17, 2019}
\usepackage{fontspec}
\setmainfont[]{Linux Libertine O}
\setsansfont[]{Linux Biolinum O}
\setmonofont[Scale=MatchLowercase]{Linux Libertine Mono O}
\usepackage[lmargin=1in,rmargin=1in,tmargin=1.25in,bmargin=1in]{geometry}
\usepackage{titling}
\usepackage{array, booktabs, multicol, xspace,tabularx}
\usepackage{enumitem}
\usepackage{caption}
\usepackage{fancyvrb,listings,url}
\usepackage{pdfpages}
\usepackage[sf]{titlesec}
\usepackage{titleps}
\newpagestyle{main}{%
\setfoot{\itshape Invoice Class}{}{\thepage}}
\pagestyle{main}

\usepackage[colorlinks=true]{hyperref}

\DefineShortVerb{\|}
\newcommand*\bs{\textbackslash}
  
\lstset{%
    basicstyle=\ttfamily\small,
    commentstyle=\itshape\ttfamily\small,
    showspaces=false,
    showstringspaces=false,
    breaklines=true,
    breakautoindent=true,
    frame=single
    captionpos=t
    language=TeX
}
  
\newcommand*{\pkg}[1]{\texttt{#1}\xspace}
\setitemize[1]{label={}}
\setitemize[2]{label={}}
\setdescription{font={\normalfont}}
\setlength{\droptitle}{-1in}



\begin{document}
\maketitle
\thispagestyle{empty}
\section{Introduction}
The \pkg{invoice-class} class allows printing of a standard US commercial invoice using invoice data from a CSV spreadsheet. Invoices can span multiple pages.

\section{Class document commands}
The main class commands specify the parts of the form that need to be filled in.  Each command except |\weight| takes a single argument.

\begin{center}
\begin{tabularx}{.8\textwidth}{>{\ttfamily\bs}l<{\{\}}X}
\toprule
\multicolumn{1}{c}{Command name} & \multicolumn{1}{l}{Description}\\
\midrule
{waybill}& waybill number\\
{shippingdate}& shipping date (default is \texttt{\bs today})\\
{carrier}& name of the freight carrier\\
{destination}& destination country\\
{toaddress}& Destination address\\
\multicolumn{1}{>{\ttfamily\bs}l}{weight\{<lbs>\}\{<oz>\}} & weight in pounds and ounces\\
{packages}{1} & number of packages in the shipment\\
{shippingcost}& total cost of shipping (default = 0.00)\\
{packingcost} & total cost of packing (default = 0.00)\\
{insurancecost} & total cost of insurance (default is 0.00)\\
{InputFile} & name of the CSV file for item date\\
\bottomrule
\end{tabularx}
\captionof{table}{Invoice document commands}\label{commands}
\end{center}

\subsection{Producing the invoice}
Once all the required elements  are specified (which can be done in the preamble), there is a single command to produce the invoice:
\begin{center}
\begin{tabularx}{.8\textwidth}{>{\ttfamily\bs}lX}
{printinvoice} & Prints the invoice\\
\end{tabularx}
\end{center}

\section{Class configuration commands}
Since an invoice will generally have a fixed From address, shipper and location, these values are best set in a separate configuration file (although they can also be set within the document.) The class will look for the file |invoice.cfg| or, |<prefix>invoice.cfg| where |<prefix>| is specified using the document command |\ConfigPrefix|. This allows multiple configuration files with different information within them.
Each configuration file should contain an instance of |\fromaddress|, |\shipper|, and |\location|.
\begin{center}
\begin{tabularx}{.8\textwidth}{>{\ttfamily\bs}l<{\{\}}X}
\toprule
\multicolumn{1}{c}{Command name} & \multicolumn{1}{l}{Description}\\
\midrule
{fromaddresss}& shipper's address\\
{shipper}& name of shipper\\
{location}& location\\
{ConfigPrefix} & configuration file prefix (default is none)\\
\bottomrule
\end{tabularx}
\captionof{table}{Invoice configuration commands}\label{config-commands}
\end{center}


\section{\pkg{datatool} details}
The uses the \pkg{datatool} package to produce the invoice using a CSV file. The CSV file requires the following column headings to be present. All other columns are ignored. (Heading names are case-sensitive.)
\begin{center}
\begin{tabularx}{.8\textwidth}{>{\ttfamily}lX}
\toprule
\multicolumn{1}{c}{Column name} & \multicolumn{1}{l}{Description}\\
\midrule
{Description} &  Item description\\
{Country} & Country of origin\\
{Quantity} & unit quantity\\
{UnitValue} & per unit value\\
{Amount} & total value for item\\
\bottomrule
\end{tabularx}
\captionof{table}{Required CSV Column labels}\label{CSV}
\end{center}
\subsection{Sample CSV file}
\lstinputlisting{ducks.csv}
\clearpage
\section{Sample Configuration file}
\lstinputlisting{duck-invoice.cfg}

\section{Sample document}
\lstinputlisting{ducks.tex}
\section{Bugs and support}
This package is released as is, and although I will accept bug reports, fixing them may not be a priority. You're free to fork the project to modify it as you wish.


\includepdf[]{ducks.pdf}
\end{document}