summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2023-10-03 14:26:03 +0100
committerSean Whitton <spwhitton@spwhitton.name>2023-10-03 14:26:26 +0100
commit2fb9d8f7f2a52ab4c0f597ff7f4006fbc73c3e10 (patch)
tree08373672d2cb55a71039e91f1a453a2e956839b1
parentd0403792c38afb17fb5c3807d0f18d1cbe47de61 (diff)
downloaddotfiles-2fb9d8f7f2a52ab4c0f597ff7f4006fbc73c3e10.tar.gz
commit invoice template
-rw-r--r--texmf/tex/latex/CSMinimalInvoice/CSMinimalInvoice.cls248
-rw-r--r--texmf/tex/latex/CSMinimalInvoice/template.tex185
2 files changed, 433 insertions, 0 deletions
diff --git a/texmf/tex/latex/CSMinimalInvoice/CSMinimalInvoice.cls b/texmf/tex/latex/CSMinimalInvoice/CSMinimalInvoice.cls
new file mode 100644
index 00000000..c6814f96
--- /dev/null
+++ b/texmf/tex/latex/CSMinimalInvoice/CSMinimalInvoice.cls
@@ -0,0 +1,248 @@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% Minimal Invoice
+% LaTeX Class
+% Version 1.1 (April 22, 2022)
+%
+% This class originates from:
+% https://www.LaTeXTemplates.com
+%
+% Author:
+% Vel (vel@latextemplates.com)
+%
+% License:
+% CC BY-NC-SA 4.0 (https://creativecommons.org/licenses/by-nc-sa/4.0/)
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+%----------------------------------------------------------------------------------------
+% CLASS CONFIGURATION
+%----------------------------------------------------------------------------------------
+
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesClass{CSMinimalInvoice}[2022/04/22 Creodocs Minimal Invoice Class v1.1]
+
+\DeclareOption*{\PassOptionsToClass{\CurrentOption}{extarticle}} % Pass through any extra options specified to the base class
+\ProcessOptions\relax % Process class options
+
+\LoadClass{extarticle} % Load the base class
+
+%----------------------------------------------------------------------------------------
+% REQUIRED PACKAGES AND MISC CONFIGURATIONS
+%----------------------------------------------------------------------------------------
+
+\usepackage{fp} % Required for invoice calculations
+
+\usepackage[ % Required for automatically formatting numbers with \num{}, such as adding commas for numbers like: 1200 -> 1,200
+ detect-all, text-rm, % Detect the weight, family and shape of the current font and match it when outputting a number with \num{}
+]{siunitx}
+
+\usepackage{setspace} % Required to enable changing line spacing
+
+\usepackage{etoolbox} % Required for conditional logic and easily changing commands
+
+\usepackage[hidelinks]{hyperref} % For clickable links (e.g. emails and URLs)
+
+\pagestyle{empty} % Suppress all headers and footers
+
+\newlength{\negativesign}
+\settowidth{\negativesign}{--} % Calculate and save the width of the negative sign for subtraction
+
+\setlength\parindent{0pt} % Stop paragraph indentation
+
+\usepackage[document]{ragged2e} % Left align all text in the document (i.e. have a ragged right margin)
+
+%----------------------------------------------------------------------------------------
+% MARGINS
+%----------------------------------------------------------------------------------------
+
+\usepackage[
+ top=2.5cm, % Top margin
+ bottom=2.25cm, % Bottom margin
+ left=2cm, % Left margin
+ right=2cm, % Right margin
+ %showframe % Uncomment to show frames around the margins for debugging purposes
+]{geometry}
+
+%----------------------------------------------------------------------------------------
+% FONTS
+%----------------------------------------------------------------------------------------
+
+\usepackage[utf8]{inputenc} % Required for inputting international characters
+\usepackage[T1]{fontenc} % Output font encoding for international characters
+
+\usepackage[default]{lato} % Use the Lato sans serif font
+
+\usepackage{textcomp} % Required for currency symbols
+\usepackage{tfrupee} % Required for the rupee symbol
+
+%----------------------------------------------------------------------------------------
+% TABLES
+%----------------------------------------------------------------------------------------
+
+\usepackage{longtable} % Required for tables that can span multiple pages
+\setlength{\LTpre}{0pt} % Whitespace above longtables
+\setlength{\LTpost}{0pt} % Whitespace below longtables
+\setlength{\LTleft}{0pt} % Whitespace to the left of longtables
+
+%----------------------------------------
+
+\usepackage{array} % Required for manipulating table columns
+
+\renewcommand{\arraystretch}{1.7} % Increase the space between table rows
+
+\newcolumntype{R}[1]{>{\raggedleft\arraybackslash}p{#1}} % Define a new right-aligned column type
+\newcolumntype{L}[1]{>{\raggedright\arraybackslash}p{#1}} % Define a new left-aligned (no justification) column type
+\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}} % Define a new centered column type
+
+%----------------------------------------
+
+\setlength{\tabcolsep}{4pt} % Decrease default padding between columns (6pt is the default)
+
+%----------------------------------------------------------------------------------------
+% DETERMINE CURRENCY SYMBOL
+%----------------------------------------------------------------------------------------
+
+\newcommand{\currencysymbol}{\$} % The default currency symbol is a dollar sign
+
+\newcommand{\determinecurrencysymbol}[1]{ % Uses the user-submitted currency to determine the symbol to use
+ \expandafter\ifstrequal\expandafter{#1}{GBP}{\renewcommand{\currencysymbol}{\textsterling}}{} % GBP (English pounds)
+
+ \ifboolexpr{ test {\expandafter\ifstrequal\expandafter{#1}{JPY}} or test {\expandafter\ifstrequal\expandafter{#1}{CNY}} }{\renewcommand{\currencysymbol}{\textyen}}{} % JPY or CNY (yen)
+
+ \expandafter\ifstrequal\expandafter{#1}{EUR}{\renewcommand{\currencysymbol}{\texteuro}}{} % EUR (European euro)
+
+ \expandafter\ifstrequal\expandafter{#1}{BRL}{\renewcommand{\currencysymbol}{R\$}}{} % BRL (Brazilian real)
+
+ \expandafter\ifstrequal\expandafter{#1}{INR}{\renewcommand{\currencysymbol}{\rupee}}{} % INR (Indian rupee)
+}
+
+%----------------------------------------------------------------------------------------
+% DUE DATE CALCULATION
+%----------------------------------------------------------------------------------------
+
+\usepackage{datenumber} % Required for date calculations
+
+\newcommand{\duedatedays}[1]{% Command to calculate and output the due date from the number of days from today
+ \addtocounter{datenumber}{#1}% Number of days from today
+ \setdatebynumber{\thedatenumber}% Calculate into the future using the number of days from today
+ \datedate % Output the calculated date
+}
+
+%----------------------------------------------------------------------------------------
+% INVOICE ENTRIES
+%----------------------------------------------------------------------------------------
+
+% Define global variables that get updated for each new invoice item for various invoice totals
+\gdef\currentsubtotalglobal{0} % Variable to store the current invoice item's subtotal
+\gdef\totalbeforetaxglobal{0} % Cumulative variable storing the total before tax
+\gdef\totaltaxglobal{0} % Cumulative variable storing the total tax
+\gdef\totalaftertaxglobal{0} % Cumulative variable storing the total after tax
+
+%----------------------------------------
+
+% Command to calculate the subtotal for an invoice item and add it to the running totals for the whole invoice
+\newcommand{\calculatesubtotalandupdatetotals}[2]{% Takes 2 arguments: 1) quantity 2) unit price
+ \FPmul{\subtotal}{#1}{#2}% Calculate the subtotal by multiplying the quantity by the unit price
+ \FPround{\subtotal}{\subtotal}{\roundcurrencytodecimals}% Round the subtotal to the specified number of decimal places for display and further calculations
+ \global\let\currentsubtotalglobal\subtotal% Set the global current subtotal variable for further use and output to the invoice
+ %----------------------------------------
+ \FPeval{\beforetax}{round(\totalbeforetaxglobal + \currentsubtotalglobal, \roundcurrencytodecimals)}% Calculate the cumulative before tax total for the whole invoice by adding the current line's subtotal to the previous cumulative before tax total and round to the specified number of decimal places for display
+ \global\let\totalbeforetaxglobal\beforetax% Update the global cumulative before tax total variable for further use and output to the invoice
+ %----------------------------------------
+ \ifdefempty{\taxrate}{}{% If a tax rate was set
+ \FPeval{\tax}{round(\totalbeforetaxglobal * (\taxrate / 100), \roundcurrencytodecimals)}% Calculate the cumulative total tax for the whole invoice using the total cumulative before tax total and the tax rate, rounded to the specified number of decimal places for display
+ \global\let\totaltaxglobal\tax% Update the global tax total variable for further use and output to the invoice
+ }%
+ %----------------------------------------
+ \FPeval{\aftertax}{round(\totalbeforetaxglobal + \totaltaxglobal, \roundcurrencytodecimals)}% Calculate the cumulative after tax total for the whole invoice by adding the before tax total to the total tax and rounding to the specified number of decimal places for display
+ \global\let\totalaftertaxglobal\aftertax% Update the global after tax total variable for further use and output to the invoice
+}
+
+%----------------------------------------
+
+% Command to correctly output a currency number to the invoice, taking into account negatives and currency symbol positioning
+\newcommand{\outputcurrency}[1]{%
+ \FPifneg{#1}% If the number is negative
+ \FPmul{\positivenumber}{#1}{-1}% Make the negative number positive
+ \hspace{-\negativesign}--\currencysymbol\FPeval{\roundedpositivenumber}{round(\positivenumber, \roundcurrencytodecimals)}\num{\roundedpositivenumber}\currencysuffix% Output the negative sign before the currency symbol (pulled left in case of left aligned table columns), otherwise it would be e.g. $-55.00, and round to the specified number of decimal places
+ \else% If the number is positive
+ \currencysymbol\FPeval{\roundednumber}{round(#1, \roundcurrencytodecimals)}\num{\roundednumber}\currencysuffix% Round to the specified number of decimal places
+ \fi%
+}
+
+%----------------------------------------
+
+\newcommand{\invoiceitem}[4]{ % Arguments: 1) description 2) quantity 3) unit price 4) note
+ \calculatesubtotalandupdatetotals{#2}{#3}% Calculate the subtotal for the current item and update totals for the whole invoice
+ #1 & % Output the item description
+ \FPeval{\roundedquantity}{round(#2, \roundquantitytodecimals)}\num{\roundedquantity} & % Output the quantity to a table cell, rounded to the specified number of decimal places
+ \outputcurrency{#3} & % Output the unit price to a table cell
+ \outputcurrency{\currentsubtotalglobal} & % Output the subtotal to a table cell
+ {\small #4}\\ % Output the item note to a table cell
+}
+
+%----------------------------------------------------------------------------------------
+% INVOICE TABLE ENVIRONMENT
+%----------------------------------------------------------------------------------------
+
+\newenvironment{invoicetable}{
+ \vspace{0.02\textheight} % Fixed vertical whitespace in case the table uses up all the stretch space
+
+ \begin{longtable}[H]{@{} L{0.38\textwidth} R{0.15\textwidth} R{0.15\textwidth} R{0.15\textwidth} @{\hspace{16pt}} L{0.15\textwidth} @{}} % Define invoice table column widths and alignments (L, R or C for left, right or center alignment)
+ \textbf{DESCRIPTION} & \textbf{QUANTITY} & \textbf{UNIT PRICE} & \textbf{SUBTOTAL} & \\ % Header row
+}{
+ \\ % Extra line before the summary numbers
+ \ifdefempty{\taxrate}{}{& & \textbf{BEFORE TAX} & \outputcurrency{\totalbeforetaxglobal}\\} % Don't output the before tax line if no tax has been set
+ \ifdefempty{\taxrate}{}{& & \textbf{TAX (\taxrate\%)} & \outputcurrency{\totaltaxglobal}\\} % Don't output the total tax line if no tax has been set
+ & & \textbf{TOTAL\ifdefempty{\currencycode}{}{ (\currencycode)}} & \outputcurrency{\totalaftertaxglobal}\\ % Don't output the currency code if it has not been set
+ \end{longtable}
+
+ \vspace{0.02\textheight} % Fixed vertical whitespace in case the table uses up all the stretch space
+}
+
+%----------------------------------------------------------------------------------------
+% INVOICE HEADER DEFINITION
+%----------------------------------------------------------------------------------------
+
+\newcommand{\outputheader}[2]{
+ {\Huge\MakeUppercase{#1}} % Document title
+
+ \vspace{0.015\textheight} % Vertical whitespace
+
+ \expandafter\ifstrequal\expandafter{#2}{}{}{{\large #2}} % Invoice date (won't be output if empty)
+
+ \vspace{0.1\textheight} % Vertical whitespace
+}
+
+%----------------------------------------------------------------------------------------
+% INVOICE NUMBER
+%----------------------------------------------------------------------------------------
+
+\newcommand{\outputinvoicenum}{
+ \ifdefempty{\invoicenumber}{}{ % If the invoice number has been set
+ {\Huge\#\invoicenumber} % Output the invoice number
+ \smallskip % Vertical whitespace
+ }
+}
+
+%----------------------------------------------------------------------------------------
+% INVOICE CONDITIONS
+%----------------------------------------------------------------------------------------
+
+\newcommand{\invoiceconditions}[1]{
+ \expandafter\ifstrequal\expandafter{#1}{}{}{
+ {\justifying #1 \par} % Justify the text
+ }
+ \vspace{0.05\textheight} % Vertical whitespace
+}
+
+%----------------------------------------------------------------------------------------
+% CUSTOM COMMANDS
+%----------------------------------------------------------------------------------------
+
+\newcommand{\taxrate}[1]{\renewcommand{\taxrate}{#1}}
+\newcommand{\currencycode}[1]{\renewcommand{\currencycode}{#1}}
+\newcommand{\invoicenumber}[1]{\renewcommand{\invoicenumber}{#1}}
+\newcommand{\currencysuffix}[1]{\renewcommand{\currencysuffix}{#1}}
+\newcommand{\roundquantitytodecimals}[1]{\renewcommand{\roundquantitytodecimals}{#1}}
+\newcommand{\roundcurrencytodecimals}[1]{\renewcommand{\roundcurrencytodecimals}{#1}}
diff --git a/texmf/tex/latex/CSMinimalInvoice/template.tex b/texmf/tex/latex/CSMinimalInvoice/template.tex
new file mode 100644
index 00000000..8245ece9
--- /dev/null
+++ b/texmf/tex/latex/CSMinimalInvoice/template.tex
@@ -0,0 +1,185 @@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% Minimal Invoice
+% LaTeX Template
+% Version 1.1 (April 22, 2022)
+%
+% This template originates from:
+% https://www.LaTeXTemplates.com
+%
+% Author:
+% Vel (vel@latextemplates.com)
+%
+% License:
+% CC BY-NC-SA 4.0 (https://creativecommons.org/licenses/by-nc-sa/4.0/)
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+%----------------------------------------------------------------------------------------
+% CLASS, PACKAGES AND OTHER DOCUMENT CONFIGURATIONS
+%----------------------------------------------------------------------------------------
+
+\documentclass[
+ a4paper, % Paper size, use 'a4paper' for A4 or 'letterpaper' for US letter
+ 10pt, % Default font size, available sizes are: 8pt, 9pt, 10pt, 11pt, 12pt, 14pt, 17pt and 20pt
+]{CSMinimalInvoice}
+
+%---------------------------------------------------------------------------------
+% INVOICE SETTINGS
+%---------------------------------------------------------------------------------
+
+% The tax rate for automatically calculating tax, do one of the following:
+% 1) Leave command empty (i.e. \taxrate{}) for no tax and no before tax and total tax lines at the bottom of the invoice
+% 2) Enter 0 (i.e. \taxrate{0}) for no tax but before tax and total tax lines explicitly saying 0% tax are output at the bottom of the invoice
+% 3) Enter a whole number (with or without a decimal) to calculate tax and output before tax and total tax lines at the bottom of the invoice, e.g. \taxrate{10} = 10% tax and \taxrate{15.5} = 15.5% tax
+\taxrate{12.5}
+
+% The currency code (e.g. USD is United States Dollars), do one of the following:
+% 1) Enter a 3 letter code to have it appear at the bottom of the invoice
+% 2) Leave the command empty (i.e. \currencycode{}) if you don't want the code to appear on the invoice
+\currencycode{USD}
+
+% The default currency symbol for the invoice is the dollar sign, if you would like to change this, do one of the following:
+% 1) Uncomment the line below and enter one of the following currency codes to change it to the corresponding symbol for that currency: GBP, CNY, JPY, EUR, BRL or INR
+%\determinecurrencysymbol{GBP}
+% 2) Uncomment the line below and leave it blank for no currency symbol or use another character/symbol for your currency
+%\renewcommand{\currencysymbol}{}
+
+% The invoice number, do one of the following:
+% 1) Enter an invoice number, it may include any text you'd like such as '13-A'
+% 2) Leave command empty (i.e. \invoicenumber{}) and no invoice number will be output in the invoice
+\invoicenumber{40}
+
+%---------------------------------------------------------------------------------
+% ADVANCED INVOICE SETTINGS
+%---------------------------------------------------------------------------------
+
+\roundcurrencytodecimals{2} % The number of decimal places to round currency numbers
+\roundquantitytodecimals{2} % The number of decimal places to round quantity numbers
+
+% Advanced settings for changing how numbers are output
+\sisetup{group-minimum-digits=4} % Delimit numbers (e.g. 4000 -> 4,000) when there are this number of digits or more
+\sisetup{group-separator={,}} % Character to use for delimiting digit groups
+\sisetup{output-decimal-marker={.}} % Character to use for specifying decimals
+
+\currencysuffix{} % Some currencies output the currency symbol after the number, such as Sweden's krona specified with a 'kr' suffix. Specify a suffix here if required, otherwise leave this command empty.
+
+%---------------------------------------------------------------------------------
+
+\begin{document}
+
+\setstretch{1.2} % Increase line spacing
+
+%---------------------------------------------------------------------------------
+% INVOICE HEADER
+%---------------------------------------------------------------------------------
+
+\outputheader{Invoice}{\today} % Output the invoice title (automatically all caps) and date (can be empty if not needed)
+
+%---------------------------------------------------------------------------------
+% INVOICE AND PAYEE INFORMATION
+%---------------------------------------------------------------------------------
+
+\outputinvoicenum % Output the invoice number if one has been set
+
+% Invoice information section
+\begin{minipage}[t]{0.38\textwidth}
+ \textbf{Due:} \duedatedays{30} % Use the \duedatedays{<number>} command to automatically determine the date when the invoice is due using the number of days from today in the single parameter to the command, or remove it and enter a due date manually
+
+ \textbf{Project:} Pest control % Project name
+
+ \textbf{Description:} Consulting and supplies for the eradication of unwanted birds % Project description
+\end{minipage}
+% Fixed minimum horizontal whitespace between sections
+\begin{minipage}[t]{0.03\textwidth}
+ ~ % Populate the minipage with a dummy space so it is spaced correctly
+\end{minipage}
+% Payee information section
+\begin{minipage}[t]{0.56\textwidth}
+ \textbf{Wile E. Coyote} % Payee name
+
+ 1 Monument Valley \\ % Payee contact lines
+ Arizona, United States \\
+ \href{mailto:wile.e.coyote@latextemplates.com}{wile.e.coyote@latextemplates.com} % Payee email
+\end{minipage}
+
+%---------------------------------------------------------------------------------
+
+\setstretch{1} % Restore single line spacing
+
+\vfill % Vertical alignment whitespace
+
+%---------------------------------------------------------------------------------
+% INVOICE ITEMS TABLE
+%---------------------------------------------------------------------------------
+
+% Use the \invoiceitem command to output invoice items. It requires 4 parameters described below:
+% 1) Item description; this should be kept reasonably short so as not to span too many lines
+% 2) Item quantity (or hours); this should be a positive number (with no commas or other symbols) and decimals are allowed
+% 3) Item unit price (or hourly rate); this should be a positive or negative number (with no commas or other symbols) and decimals are allowed
+% 4) Item note; this can be left empty but, if used, it should be kept very short
+
+\begin{invoicetable}
+ \invoiceitem{Heavy wrought anvil}{1}{5600}{}
+ \invoiceitem{Dynamite (6pk)}{25}{24.99}{}
+ \invoiceitem{ACME TNT detonator}{1}{0}{Complimentary}
+ \invoiceitem{Hi-speed tonic}{10}{102.99}{}
+ \invoiceitem{Do-it yourself tornado kit}{1}{3495}{}
+ \invoiceitem{Refund for defective rocket}{1}{-1000}{Final settlement}
+ \invoiceitem{ACME Consulting: project planning and pest control ornithologist consulting}{23.5}{120}{}
+\end{invoicetable}
+
+%---------------------------------------------------------------------------------
+
+\vfill\vfill % Vertical alignment whitespace
+
+%---------------------------------------------------------------------------------
+% INVOICE CONDITIONS
+%---------------------------------------------------------------------------------
+
+\invoiceconditions{Terms and Conditions: Products sold by ACME Corporation come with no guarantees or warranties of any kind, expressed or implied. ACME specifically disclaims all implied warranties of any kind or nature, including any implied warranty of merchantability and/or any implied warranty of fitness for a particular purpose.} % Leave command empty (i.e. \invoiceconditions{}) if not required
+
+%---------------------------------------------------------------------------------
+% MERCHANT (YOUR) INFORMATION
+%---------------------------------------------------------------------------------
+
+% Company/individual name and address section
+\begin{minipage}[t]{0.3\textwidth}
+ \itshape % Italic text
+
+ \textbf{ACME Corporation} % Company/individual name
+
+ 2295 Horseneck Road \\ % Merchant address lines
+ Fairfield, NJ 07004 \\
+ United States \\
+\end{minipage}
+% Fixed minimum horizontal whitespace between sections
+\begin{minipage}[t]{0.03\textwidth}
+ ~ % Populate the minipage with a dummy space so it is spaced correctly
+\end{minipage}
+% Merchant contact information section
+\begin{minipage}[t]{0.3\textwidth}
+ \itshape % Italic text
+
+ \textbf{Contact}
+
+ \href{https://www.latextemplates.com}{ACME.com} \\ % Merchant contact information lines
+ \href{mailto:sales@acme.com}{sales@acme.com} \\
+\end{minipage}
+% Fixed minimum horizontal whitespace between sections
+\begin{minipage}[t]{0.03\textwidth}
+ ~ % Populate the minipage with a dummy space so it is spaced correctly
+\end{minipage}
+% Merchant payment information
+\begin{minipage}[t]{0.3\textwidth}
+ \itshape % Italic text
+
+ \textbf{Payment}
+
+ Bank of the United States \\ % Payment information lines
+ Sort Code: 010-110 \\
+ Account: 10011001110 \\
+\end{minipage}
+
+%---------------------------------------------------------------------------------
+
+\end{document}