-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinvoice.sty
More file actions
231 lines (205 loc) · 6.27 KB
/
invoice.sty
File metadata and controls
231 lines (205 loc) · 6.27 KB
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
% Invoice Style Package
% A clean and simple invoice template
%
% USAGE GUIDE:
% 1. Include the package: \usepackage{invoice}
%
% 2. Set your information using these commands:
% \myname{Your Name}
% \myaddress{Your Address \\ Line 2 \\ City, Postal Code}
% \myemail{your@email.com}
% \myphone{+XX XXX XXX XXXX}
%
% 3. Set invoice details:
% \invoicenumber{INV-2024-11-001}
% \invoicedate{November 28, 2024}
% \duedate{December 28, 2024}
%
% 4. Set client information:
% \clientname{Client Name}
% \clientcompany{Client Company Name} % Optional
% \clientaddress{Address \\ Line 2 \\ City, Country}
%
% 5. Set payment information:
% \bankname{Your Bank}
% \accountholder{Account Holder Name}
% \iban{XX00 0000 0000 0000 0000 00}
% \bic{XXXXXXXXX}
%
% 6. Set financial details:
% \hourlyrate{75.00}
% \currency{EUR} % Optional, defaults to EUR
% \taxrate{0} % Optional, percentage
% \subtotal{2,325.00}
% \taxamount{0.00}
% \totaldue{2,325.00}
%
% 7. In document body, use these macros:
% \makeinvoiceheader - Creates INVOICE title and From/To sections
% \makebillto - Creates Bill To section
% \makesummary - Creates subtotal/tax/total summary
% \makepaymentterms - Creates payment terms section
% \makepaymentinfo - Creates bank details and thank you message
%
% 8. For the services table, use standard tabularx:
% \begin{tabularx}{\textwidth}{|l|X|r|r|r|}
% \hline
% \textbf{Date} & \textbf{Description} & \textbf{Hours} & \textbf{Rate} & \textbf{Amount} \\
% \hline
% Nov 1 & Service description & 8.0 & 75.00 & 600.00 \\
% \hline
% \end{tabularx}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{invoice}[2024/11/28 Simple Invoice Template]
% Required packages
\RequirePackage[top=2cm, bottom=2cm, left=2.5cm, right=2.5cm]{geometry}
\RequirePackage{fontspec}
\RequirePackage{xcolor}
\RequirePackage{array}
\RequirePackage{tabularx}
\RequirePackage{booktabs}
\RequirePackage{graphicx}
\RequirePackage{calc}
% Font setup
\setmainfont{Roboto}
% Colors
\definecolor{headercolor}{RGB}{51, 51, 51}
\definecolor{linecolor}{RGB}{200, 200, 200}
% Remove page numbers
\pagestyle{empty}
% Command definitions for personal information
\newcommand{\myname}[1]{\def\@myname{#1}}
\newcommand{\myaddress}[1]{\def\@myaddress{#1}}
\newcommand{\myemail}[1]{\def\@myemail{#1}}
\newcommand{\myphone}[1]{\def\@myphone{#1}}
% Invoice information
\newcommand{\invoicenumber}[1]{\def\@invoicenumber{#1}}
\newcommand{\invoicedate}[1]{\def\@invoicedate{#1}}
\newcommand{\duedate}[1]{\def\@duedate{#1}}
% Client information
\newcommand{\clientname}[1]{\def\@clientname{#1}}
\newcommand{\clientcompany}[1]{\def\@clientcompany{#1}}
\newcommand{\clientaddress}[1]{\def\@clientaddress{#1}}
% Payment information
\newcommand{\bankname}[1]{\def\@bankname{#1}}
\newcommand{\accountholder}[1]{\def\@accountholder{#1}}
\newcommand{\iban}[1]{\def\@iban{#1}}
\newcommand{\bic}[1]{\def\@bic{#1}}
% Financial information
\newcommand{\hourlyrate}[1]{\def\@hourlyrate{#1}}
\newcommand{\currency}[1]{\def\@currency{#1}}
\newcommand{\taxrate}[1]{\def\@taxrate{#1}}
\newcommand{\subtotal}[1]{\def\@subtotal{#1}}
\newcommand{\taxamount}[1]{\def\@taxamount{#1}}
\newcommand{\totaldue}[1]{\def\@totaldue{#1}}
% Default values
\currency{EUR}
\taxrate{0}
% Macro to create invoice header
\newcommand{\makeinvoiceheader}{%
\begin{center}
{\Huge\bfseries\color{headercolor} INVOICE}
\end{center}
\vspace{0.5cm}
\noindent
\begin{minipage}[t]{0.48\textwidth}
\textbf{From:} \\
\@myname \\
\@myaddress \\[0.3cm]
Email: \@myemail \\
Phone: \@myphone
\end{minipage}
\hfill
\begin{minipage}[t]{0.48\textwidth}
\raggedleft
\textbf{Invoice \#:} \@invoicenumber \\
\textbf{Date:} \@invoicedate \\
\textbf{Due Date:} \@duedate
\end{minipage}
\vspace{0.8cm}
}
% Macro to create bill to section
\newcommand{\makebillto}{%
\noindent
\textbf{Bill To:} \\
\@clientname \\
\ifdefined\@clientcompany
\@clientcompany \\
\fi
\@clientaddress
\vspace{1cm}
}
% Macro to start invoice items table
\newcommand{\startinvoiceitems}{%
\noindent
{\large\bfseries Services Rendered}
\vspace{0.3cm}
\noindent
\begin{tabularx}{\textwidth}{|l|X|r|r|r|}
\hline
\textbf{Date} & \textbf{Description} & \textbf{Hours} & \textbf{Rate (\@currency)} & \textbf{Amount (\@currency)} \\
\hline
}
% Macro to end invoice items table
\newcommand{\closeinvoiceitems}{%
\end{tabularx}
\vspace{1cm}
}
% Command to add an invoice item
\newcommand{\invoiceitem}[5]{%
#1 & #2 & #3 & #4 & #5 \\
\hline
}
% Macro to create summary
\newcommand{\makesummary}{%
\noindent
\hfill
\begin{tabular}{lr}
\textbf{Subtotal:} & \@subtotal\ \@currency \\
\textbf{Tax (\@taxrate\%):} & \@taxamount\ \@currency \\
\hline
\textbf{Total Due:} & \textbf{\@totaldue\ \@currency} \\
\end{tabular}
\vspace{1.5cm}
}
% Payment terms storage
\newcounter{paymenttermscount}
\setcounter{paymenttermscount}{0}
% Command to add a payment term
\newcommand{\paymentterm}[1]{%
\stepcounter{paymenttermscount}%
\expandafter\def\csname @paymentterm\roman{paymenttermscount}\endcsname{#1}%
}
% Macro to create payment terms
\newcommand{\makepaymentterms}{%
\ifnum\value{paymenttermscount}>0
\noindent
{\large\bfseries Payment Terms}
\vspace{0.3cm}
\begin{itemize}
\setlength\itemsep{0.2em}
\newcounter{termcounter}
\setcounter{termcounter}{0}
\loop\ifnum\value{termcounter}<\value{paymenttermscount}
\stepcounter{termcounter}
\item \csname @paymentterm\romannumeral\value{termcounter}\endcsname
\repeat
\end{itemize}
\vspace{0.8cm}
\fi
}
% Macro to create payment information
\newcommand{\makepaymentinfo}{%
\noindent
{\large\bfseries Payment Information}
\vspace{0.3cm}
\noindent
\begin{tabular}{@{}ll@{}}
\textbf{Bank Name:} & \@bankname \\
\textbf{Account Holder:} & \@accountholder \\
\textbf{IBAN:} & \@iban \\
\textbf{BIC/SWIFT:} & \@bic \\
\end{tabular}
\vspace{1.5cm}
}
\endinput