diff options
author | Paul Cochrane <paul@liekut.de> | 2015-09-12 20:55:53 +0200 |
---|---|---|
committer | Paul Cochrane <paul@liekut.de> | 2015-09-12 20:55:53 +0200 |
commit | de18bd01aa0b0c43c8cc848e9116fc7393f84118 (patch) | |
tree | a1864b20f58612b047f112e841c82972651213de | |
parent | 729e263f879aa9dd3378021af8582322d884a2f5 (diff) |
Handle dollar, euro and pound currencies
... by adding a "currency" option to the documentclass, which can
(currently) take either "dollar" (the default), "euro" or "pound" as a
value and then use the relevant currency symbol within the invoice text.
-rw-r--r-- | dapper-invoice.cls | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/dapper-invoice.cls b/dapper-invoice.cls index 0f5e915..45015c2 100644 --- a/dapper-invoice.cls +++ b/dapper-invoice.cls @@ -4,6 +4,25 @@ \NeedsTeXFormat{LaTeX2e} \LoadClass[11pt]{article} +% For page number calculations +\RequirePackage{ifthen} + +% To handle key=value options in class definition +\RequirePackage{kvoptions} +\SetupKeyvalOptions{% + prefix=dapper@ +} +% Default currency option is "dollar" +\DeclareStringOption[dollar]{currency}[dollar] +\ProcessKeyvalOptions* + +\RequirePackage{eurosym} + +\ifthenelse{\equal{\dapper@currency}{dollar}}{\newcommand{\currencysym}{\$}}{} +\ifthenelse{\equal{\dapper@currency}{euro}}{\newcommand{\currencysym}{\euro}}{} +\ifthenelse{\equal{\dapper@currency}{pound}}{\newcommand{\currencysym}{\textsterling}}{} + +% Set the standard geometry \RequirePackage[hmargin=.75in,vmargin=1in]{geometry} % For links and metadata @@ -15,9 +34,6 @@ % For "At*" hooks \RequirePackage{etoolbox} -% For page number calculations -\RequirePackage{ifthen} - % For adjusting footer \RequirePackage{fancyhdr} @@ -206,8 +222,8 @@ \end{minipage} & {\itemizationRowStyle \@formatHoursLeft{#2}} & {\itemizationRowStyle \@formatHoursRight{#2}} & - {\itemizationRowStyle \$#3} & - {\itemizationRowStyle \$\calcamount{#2}{#3}} + {\itemizationRowStyle \currencysym#3} & + {\itemizationRowStyle \currencysym\calcamount{#2}{#3}} \\ \noalign{\medskip} } @@ -220,8 +236,8 @@ \end{minipage} & {\itemizationRowStyle \@formatHoursLeft{#2}} & {\itemizationRowStyle \@formatHoursRight{#2}} & - {\itemizationRowStyle \$#3} & - {\itemizationRowStyle \$\calcamount{#2}{#3}} + {\itemizationRowStyle \currencysym#3} & + {\itemizationRowStyle \currencysym\calcamount{#2}{#3}} \\ \noalign{\medskip} } |