From 28dbe018d6e767ada91df6854db0f2e120f2079a Mon Sep 17 00:00:00 2001 From: David McMackins II Date: Wed, 3 Jan 2018 17:28:34 -0600 Subject: Make Delwink modifications --- .gitignore | 1 + LICENSE.txt | 1 + dapper-invoice.cls | 59 ++++++++++++++----------------------- delwinkr.png | Bin 0 -> 10800 bytes example.tex | 84 +++++++++++++++++++++++++++-------------------------- 5 files changed, 66 insertions(+), 79 deletions(-) create mode 100644 delwinkr.png diff --git a/.gitignore b/.gitignore index e97f79a..2dc6aa1 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ *.out *.pdf .vagrant/ +invoice-* \ No newline at end of file diff --git a/LICENSE.txt b/LICENSE.txt index 384e204..b29d812 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,6 +1,7 @@ The MIT License (MIT) Copyright (c) 2015 Michael Kropat +Copyright (c) 2018 Delwink, LLC Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/dapper-invoice.cls b/dapper-invoice.cls index 97a0300..b9e4d4c 100644 --- a/dapper-invoice.cls +++ b/dapper-invoice.cls @@ -18,9 +18,14 @@ \RequirePackage{eurosym} +\newboolean{csymafter} +\setboolean{csymafter}{false} \ifthenelse{\equal{\dapper@currency}{dollar}}{\newcommand{\currencysym}{\$}}{} \ifthenelse{\equal{\dapper@currency}{euro}}{\newcommand{\currencysym}{\euro}}{} \ifthenelse{\equal{\dapper@currency}{pound}}{\newcommand{\currencysym}{\textsterling}}{} +\ifthenelse{\equal{\dapper@currency}{btc}}{\newcommand{\currencysym}{BTC} \setboolean{csymafter}{true}}{} +\ifthenelse{\equal{\dapper@currency}{ltc}}{\newcommand{\currencysym}{LTC} \setboolean{csymafter}{true}}{} +\ifthenelse{\equal{\dapper@currency}{doge}}{\newcommand{\currencysym}{DOGE} \setboolean{csymafter}{true}}{} % Set the standard geometry \RequirePackage[hmargin=.75in,vmargin=1in]{geometry} @@ -129,42 +134,16 @@ \newcounter{colskipcount} -\newenvironment{hoursItemization}{ +\newenvironment{qtyItemization}{ \setcounter{colskipcount}{5} \setlength\LTleft{0pt} \setlength\LTright{0pt} - \begin{longtable}{c @{\hspace{1.5em}} p{.6\textwidth} r @{} l r r} + \begin{longtable}{c p{.5\textwidth} r @{} l r r} \hline \noalign{\smallskip} {\itemizationHeaderStyle Date} & {\itemizationHeaderStyle Description} & - \multicolumn{2}{l}{\itemizationHeaderStyle Hours} & - {\itemizationHeaderStyle Rate} & - {\itemizationHeaderStyle Amount} - \\ - \noalign{\smallskip} - \hline - \noalign{\bigskip} - \endhead - \noalign{\bigskip} - \hline - \endfoot - \endlastfoot -}{ - \end{longtable} -} - -\newenvironment{hoursItemizationWithProject}{ - \setcounter{colskipcount}{6} - \setlength\LTleft{0pt} - \setlength\LTright{0pt} - \begin{longtable}{c c @{\hspace{1.5em}} p{.5\textwidth} r @{} l r r} - \hline - \noalign{\smallskip} - {\itemizationHeaderStyle Date} & - {\itemizationHeaderStyle Project} & - {\itemizationHeaderStyle Description} & - \multicolumn{2}{l}{\itemizationHeaderStyle Hours} & + \multicolumn{2}{l}{\itemizationHeaderStyle Qty/Hrs} & {\itemizationHeaderStyle Rate} & {\itemizationHeaderStyle Amount} \\ @@ -217,13 +196,11 @@ \newcommand{\lineitem}[4]{ {\itemizationRowStyle #1} & - \begin{minipage}[t]{.6\textwidth} - \begin{itemize}[leftmargin=0pt, labelsep=1pt, itemsep=0pt] \itemizationRowStyle #4 \end{itemize} - \end{minipage} & + {\itemizationRowStyle #4} & {\itemizationRowStyle \@formatHoursLeft{#2}} & {\itemizationRowStyle \@formatHoursRight{#2}} & - {\itemizationRowStyle \currencysym#3} & - {\itemizationRowStyle \currencysym\calcamount{#2}{#3}} + {\itemizationRowStyle \formatcurrency{#3}} & + {\itemizationRowStyle \calcamount{#2}{#3}} \\ \noalign{\medskip} } @@ -236,8 +213,8 @@ \end{minipage} & {\itemizationRowStyle \@formatHoursLeft{#2}} & {\itemizationRowStyle \@formatHoursRight{#2}} & - {\itemizationRowStyle \currencysym#3} & - {\itemizationRowStyle \currencysym\calcamount{#2}{#3}} + {\itemizationRowStyle \formatcurrency{#3}} & + {\itemizationRowStyle \calcamount{#2}{#3}} \\ \noalign{\medskip} } @@ -261,8 +238,14 @@ } } -\newcommand*{\formatcurrency}[1]{% - \num[group-separator={,}, group-minimum-digits=3, round-mode=places, round-precision=2]{#1}% +\newcommand*{\formatnum}[1]{% + \num[group-separator={,}, group-minimum-digits=3, round-mode=places, round-precision=2]{#1} +} + +\newcommand*{\formatcurrency}[1]{ + \ifthenelse{\boolean{csymafter}} + {\formatnum{#1}~\currencysym} + {\currencysym\formatnum{#1}} } % Implementation by Werner (http://tex.stackexchange.com/a/176815/35707) diff --git a/delwinkr.png b/delwinkr.png new file mode 100644 index 0000000..739989a Binary files /dev/null and b/delwinkr.png differ diff --git a/example.tex b/example.tex index 0330cf7..d86f2ed 100644 --- a/example.tex +++ b/example.tex @@ -1,73 +1,75 @@ -\documentclass[letterpaper]{dapper-invoice} -%\documentclass[letterpaper,currency=dollar]{dapper-invoice} +%\documentclass[letterpaper]{dapper-invoice} +\documentclass[letterpaper,currency=dollar]{dapper-invoice} %\documentclass[letterpaper,currency=euro]{dapper-invoice} %\documentclass[letterpaper,currency=pound]{dapper-invoice} +%\documentclass[letterpaper,currency=btc]{dapper-invoice} +%\documentclass[letterpaper,currency=ltc]{dapper-invoice} +%\documentclass[letterpaper,currency=doge]{dapper-invoice} -\newcommand{\invoiceNo}{101} +\newcommand{\invoiceNo}{1001} \newcommand{\balance}{137.50} -\newcommand{\duein}{15}% days +\newcommand{\duein}{14}% days -\newcommand{\me}{Your~Name} +\newcommand{\me}{David~McMackins} \newcommand{\clientName}{Sample~Client} -\setmetadata{\me}{Your Biz}{\invoiceNo}{\clientName} +\setmetadata{\me}{Delwink, LLC}{\invoiceNo}{\clientName} \defaultfontfeatures{ Path = ./Fonts/ } \usepackage{fontawesome} +\usepackage{graphicx} + \begin{document} \newfontface\mainLightItalic{OpenSans-LightItalic} -\makeheader{Your\ \mainLightItalic Biz}{\invoiceNo} +\makeheader{\includegraphics[width=8cm]{delwinkr}}{\invoiceNo} \twocolumnlayout{ - \begin{infoSection} - \infoBox{Client}{\clientName \\ - 123 Street Address \\ - City, State 55555 } - \infoBox{Project}{\#123.456} - \infoBox{Contact}{Jane Smith} - \infoSub{\faMobilePhone}{\small\slshape +1~(555)~555-5555} - \noalign{\addvspace{8ex}} - \infoBox{}{ - {\large\raisebox{.55\height}\currencysym\huge\formatcurrency{\balance} \arrowbase} \\ - {\small\color{subduedColor} due \duedate{\duein}} - } - \end{infoSection} + \begin{infoSection} + \infoBox{Client}{\clientName \\ + 123 Street Address \\ + City, State 55555 } + \infoBox{Project}{\#123.456} + \infoBox{Contact}{Jane Smith} + \infoSub{\faMobilePhone}{\small\slshape +1~(555)~555-5555} + \noalign{\addvspace{8ex}} + \infoBox{}{ + {\huge\formatcurrency{\balance} \arrowbase} \\ + {\small\color{subduedColor} due \duedate{\duein}} + } + \end{infoSection} }{ - \begin{infoSection} - \infoBox{\arrowtarget Payable To}{ - \me \\ - 1234 Sycamore Ave \\ - Blacksburg, VA 24060 - } - \infoSub{\faMobilePhone}{\small\slshape +1~(555)~555-5555} - \infoSub{\tiny\faEnvelope}{\small\slshape \emaillink{you@example.com}} - \end{infoSection} + \begin{infoSection} + \infoBox{\arrowtarget Payable To}{ + \me \\ + 2000 My Dr \\ + City, ST 00000 + } + \infoSub{\faMobilePhone}{\small\slshape +1~(800)~335-9465} + \infoSub{\tiny\faEnvelope}{\small\slshape \emaillink{sales@delwink.com}} + \end{infoSection} } \drawarrow \addvspace{4ex} -\begin{hoursItemizationWithProject} +\begin{qtyItemization} - \lineitemp{2015/4/11}{2}{50}{Invoice}{ - \item Discussed requirements with client} + \lineitem{2015/4/11}{2}{50}{Discussed requirements with client} - \lineitemp{2015/4/11}{1.25}{50}{Invoice}{ - \item Wrote Invoice in LaTeX} + \lineitem{2015/4/11}{1.25}{50}{Wrote Invoice in LaTeX} - \lineitemp{2015/4/11}{0.5}{50}{Invoice}{ - \item Packaged Invoice in .cls file} + \lineitem{2015/4/11}{0.5}{50}{Packaged Invoice in .cls file} - \beginsummary + \beginsummary - \summaryline{Total}{\currencysym\formatcurrency{\InvoiceTotal}} + \summaryline{Total}{\formatcurrency{\InvoiceTotal}} - \summaryline{Paid}{\currencysym\formatcurrency{50}} - \summaryline{Balance Due}{\currencysym\formatcurrency{\balance}} % not really any math support (yet) + \summaryline{Paid}{\formatcurrency{50}} + \summaryline{Balance Due}{\formatcurrency{\balance}} % not really any math support (yet) -\end{hoursItemizationWithProject} +\end{qtyItemization} \end{document} -- cgit v1.2.3