Files
scripts_serv/ledger/custom/invoice.tex
T
2026-10-02 22:35:11 +02:00

258 lines
6.0 KiB
TeX

<?lsmb# This is a comment block; it's ignored by the template engine.
Version: 1.3
Date: 2024-08-14
File: invoice.tex
Set: demo
Template version numbers are explicitly not aligned across templates or
releases. No explicit versioning was applied before 2021-01-04.
Version Changes
1.1 Fix spelling mistake (acrue -> accrue)
1.2 Merged xelatex targetting templates with those targetting pdflatex
1.3 Extended with 'shiptoattn' (at the attention of)
The "$FORMAT($PROCESSOR)" below evaluates to e.g. "pdf(pdflatex)".
-?>
<?lsmb FILTER latex { format="$FORMAT($PROCESSOR)" };
# Uncomment the next line to overrule the value from System > Defaults;
# The value should be without the 'paper' suffix. E.g. "a4" for "a4paper"
# SETTINGS.papersize = "<your-format>";
INCLUDE "preamble.tex"; -?>
\setlength\LTleft{0pt}
\setlength\LTright{0pt}
\begin{document}
\pagestyle{myheadings}
\thispagestyle{empty}
\ifpdftex
%% (pdf)latex
\fontfamily{cmss}\fontsize{10pt}{12pt}\selectfont
\fi
<?lsmb BLOCK multiline -?>
\begin{minipage}{2in}
\medskip
\raggedright
<?lsmb string ?>
\end{minipage}
<?lsmb- END -?>
\newsavebox{\ftr}
\sbox{\ftr}{
\parbox{\textwidth}{
\tiny
\rule[1.5em]{\textwidth}{0.5pt}
<?lsmb text('Payment due NET [_1] Days from date of Invoice.', terms) ?>
<?lsmb text('Interest on overdue amounts will accrue at the rate of 12% per annum starting from [_1] until paid in full. Items returned are subject to a 10% restocking charge.', duedate) ?>
<?lsmb text('A return authorization must be obtained from [_1] before goods are returned. Returns must be shipped prepaid and properly insured. [_1] will not be responsible for damages during transit.', company) ?>
}
}
<?lsmb INCLUDE letterhead ?>
\markboth{<?lsmb company ?>\hfill <?lsmb invnumber ?>}{<?lsmb company ?>\hfill <?lsmb invnumber ?>}
\vspace*{0.5cm}
\parbox[t]{.5\textwidth}{
\textbf{To}
\vspace{0.3cm}
<?lsmb name ?>
<?lsmb address1 ?>
<?lsmb address2 ?>
<?lsmb city ?>
<?lsmb IF state -?>
\hspace{-0.1cm}, <?lsmb state ?> <?lsmb END ?> <?lsmb zipcode ?>
<?lsmb country ?>
\vspace{0.3cm}
<?lsmb IF contact ?>
<?lsmb contact ?>
\vspace{0.2cm}
<?lsmb END ?>
<?lsmb IF customerphone ?>
Tel: <?lsmb customerphone ?>
<?lsmb END ?>
<?lsmb IF customerfax ?>
Fax: <?lsmb customerfax ?>
<?lsmb END ?>
<?lsmb email ?>
}
\parbox[t]{.5\textwidth}{
\textbf{<?lsmb text('Ship To') ?>}
\vspace{0.3cm}
<?lsmb shiptoname ?>
<?lsmb IF shiptoattn -?>
<?lsmb shiptoattn ?>
<?lsmb END -?>
<?lsmb shiptoaddress1 ?>
<?lsmb shiptoaddress2 ?>
<?lsmb shiptocity ?>
<?lsmb IF shiptostate -?>
\hspace{-0.1cm}, <?lsmb shiptostate ?><?lsmb END ?> <?lsmb shiptozipcode ?>
<?lsmb shiptocountry ?>
\vspace{0.3cm}
<?lsmb IF shiptocontact ?>
<?lsmb shiptocontact ?>
\vspace{0.2cm}
<?lsmb END ?>
<?lsmb IF shiptophone ?>
Tel: <?lsmb shiptophone ?>
<?lsmb END ?>
<?lsmb IF shiptofax ?>
Fax: <?lsmb shiptofax ?>
<?lsmb END ?>
<?lsmb shiptoemail ?>
}
\hfill
\vspace{1cm}
\textbf{\MakeUppercase{<?lsmb
IF reverse;
text('Credit Invoice');
ELSE;
text('Invoice');
END; ?>}}
\hfill
\vspace{1cm}
\begin{tabularx}{\textwidth}{*{7}{|X}|} \hline
\textbf{<?lsmb text('Invoice #') ?>} & \textbf{<?lsmb text('Date') ?>}
& \textbf{<?lsmb text('Due') ?>} & \textbf{<?lsmb text('Order #') ?>}
& \textbf{<?lsmb text('Salesperson') ?>}
& \textbf{<?lsmb text('Shipping Point') ?>}
& \textbf{<?lsmb text('Ship via') ?>} \\ [0.5em]
\hline
<?lsmb invnumber ?> & <?lsmb invdate ?> & <?lsmb duedate ?> & <?lsmb ordnumber ?> & <?lsmb employee ?>
& <?lsmb shippingpoint ?> & <?lsmb shipvia ?> \\
\hline
\end{tabularx}
\vspace{1cm}
\begin{longtable}{@{\extracolsep{\fill}}r|llcrlrr|r}
\textbf{<?lsmb text('Item') ?>}
& \textbf{<?lsmb text('Number') ?>}
& \textbf{<?lsmb text('Description') ?>}
& \textbf{<?lsmb text('Delivery') ?>}
& \textbf{<?lsmb text('Qty') ?>}
& \textbf{<?lsmb text('Unit') ?>}
& \textbf{<?lsmb text('Price') ?>}
& \textbf{<?lsmb text('Disc %') ?>}
& \textbf{<?lsmb text('Amount') ?>} \\
\hline
\endhead
<?lsmb FOREACH number ?>
<?lsmb lc = loop.index ?>
<?lsmb runningnumber.${lc} ?> &
<?lsmb number.${lc} ?> &
<?lsmb INCLUDE multiline string = item_description.${lc} ?> &
<?lsmb deliverydate.${lc} ?> &
<?lsmb qty.${lc} ?> &
<?lsmb unit.${lc} ?> &
<?lsmb sellprice.${lc} ?> &
<?lsmb discountrate.${lc} ?> &
<?lsmb linetotal.${lc} ?> \\
<?lsmb END ?>
<?lsmb IF tax ?>
\hline \hline
\multicolumn{8}{r|}{<?lsmb text('Subtotal') ?>} & <?lsmb subtotal ?> \\*
<?lsmb FOREACH tax ?>
<?lsmb lc = loop.index ?>
\multicolumn{8}{r|}{<?lsmb taxdescription.${lc}
?> on <?lsmb taxbase.${lc} ?> }
& <?lsmb tax.${lc} ?> \\*
<?lsmb END ?>
<?lsmb END ?>
\hline \hline
\multicolumn{8}{r|}{<?lsmb text('Total') ?>} & <?lsmb invtotal ?> \\*
<?lsmb IF paymentdate.0 ?>
\multicolumn{8}{r|}{ <?lsmb text('Paid') ?> } & - <?lsmb paid ?> \\*
\hline
\hline
\multicolumn{8}{r|}{<?lsmb text('Balance') ?>} & <?lsmb total ?>\\
<?lsmb END ?>
\end{longtable}
\parbox{\textwidth}{
\vspace{0.2cm}
\hfill
\vspace{0.3cm}
<?lsmb text_amount ?> ***** <?lsmb decimal ?>/100
\hfill
<?lsmb text('All prices in [_1].', currency) ?>
\vspace{12pt}
<?lsmb FOREACH P IN notes.split('\n\n+') ?>
<?lsmb P ?>\medskip
<?lsmb END ?>
}
\vfill
<?lsmb IF paymentdate.0 ?>
\begin{tabularx}{10cm}{@{}lXlr@{}}
\textbf{<?lsmb text('Payments') ?>} & & & \\
\hline
\textbf{<?lsmb text('Date') ?>} & & \textbf{<?lsmb text('Source') ?>}
& \textbf{<?lsmb text('Amount') ?>} \\
<?lsmb FOREACH payment ?>
<?lsmb lc = loop.index ?>
<?lsmb paymentdate.${lc} ?> & <?lsmb paymentaccount.${lc} ?> & <?lsmb paymentsource.${lc} ?> & <?lsmb payment.${lc} ?> \\
<?lsmb END ?>
\end{tabularx}
<?lsmb END ?>
<?lsmb FOR FILE IN file_list ?>
\includegraphics[scale=0.3]{<?lsmb file_path _ '/' _ FILE.file_name ?>}
<?lsmb END ?>
\vspace{1cm}
\centerline{\textbf{<?lsmb text('Thank You for your valued business!') ?>}}
\rule{\textwidth}{0.5pt}
\usebox{\ftr}
\end{document}
<?lsmb END -?>