<?lsmb#   This is a comment block; it's ignored by the template engine.

   Version:  1.2
   Date:     2022-07-22
   File:     ar_transaction.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 line descriptions not shown in AR/AP transaction prints
1.2       Merged xelatex targetting templates with those targetting 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"; -?>

\begin{document}

\pagestyle{empty}

\ifpdftex
  %% (pdf)latex
  \fontfamily{cmss}\fontsize{10pt}{12pt}\selectfont
\fi

\parbox{\textwidth}{%
  \parbox[b]{.42\textwidth}{%
    <?lsmb company ?>
   
    <?lsmb address ?>
  }
  %\parbox[b]{.2\textwidth}{
    %\includegraphics[scale=0.3]{ledger-smb}
  %}
  \hfill
  \begin{tabular}[b]{rr@{}}
  <?lsmb text('Tel:') ?> & <?lsmb tel ?>\\
  <?lsmb text('Fax:') ?> & <?lsmb fax ?>
  \end{tabular}

  \rule[1.5em]{\textwidth}{0.5pt}
}

\centerline{\MakeUppercase{<?lsmb text('AR Transaction') ?>}}

\vspace*{0.5cm}

\parbox[t]{.5\textwidth}{
<?lsmb name ?>

<?lsmb address1 ?>

<?lsmb address2 ?>

<?lsmb city ?>
<?lsmb IF state ?>
, <?lsmb state ?>
<?lsmb END ?>
<?lsmb zipcode ?>

<?lsmb country ?>

\vspace{0.3cm}

<?lsmb IF contact ?>
<?lsmb contact ?>
<?lsmb END ?>

\vspace{0.2cm}

<?lsmb IF customerphone ?>
<?lsmb text('Tel: [_1]', customerphone) ?>
<?lsmb END ?>

<?lsmb IF customerfax ?>
<?lsmb text('Fax: [_1]', customerfax) ?>
<?lsmb END ?>

<?lsmb email ?>

<?lsmb IF customertaxnumber ?>
<?lsmb text('Tax Number: [_1]', customertaxnumber) ?>
<?lsmb END ?>
}
\hfill
\begin{tabular}[t]{ll}
  \textbf{<?lsmb text('Invoice #') ?>} & <?lsmb invnumber ?> \\
  \textbf{<?lsmb text('Date') ?>} & <?lsmb invdate ?> \\
  \textbf{<?lsmb text('Due') ?>} & <?lsmb duedate ?> \\
  <?lsmb IF ponumber ?>
    \textbf{PO \#} & <?lsmb ponumber ?> \\
  <?lsmb END ?>
  <?lsmb IF ordnumber ?>
    \textbf{<?lsmb text('Order #') ?>} & <?lsmb ordnumber ?> \\
  <?lsmb END ?>
  \textbf{<?lsmb text('Employee') ?>} & <?lsmb employee ?> \\
\end{tabular}

\vspace{1cm}

\begin{tabularx}{\textwidth}[t]{@{}llrX@{\hspace{1cm}}l@{}}
<?lsmb FOREACH amount ?>
<?lsmb lc = loop.index ?>
  <?lsmb accno.${lc} ?> &
  <?lsmb account.${lc} ?> &
  <?lsmb amount.${lc} ?> &
  <?lsmb linedescription.${lc} ?> &
  <?lsmb projectnumber.${lc} ?> \\
<?lsmb END ?>

  \multicolumn{2}{r}{\textbf{Subtotal}} & <?lsmb subtotal ?> & \\
<?lsmb FOREACH tax ?>
<?lsmb lc = loop.index ?>
  \multicolumn{2}{r}{\textbf{<?lsmb taxdescription.${lc} ?> @ <?lsmb taxrate.${lc} ?> \%}} & <?lsmb tax.${lc} ?> & \\
<?lsmb END ?>

  \multicolumn{2}{r}{\textbf{Total}} & <?lsmb invtotal ?> & \\
  
\end{tabularx}

\vspace{0.3cm}

<?lsmb text_amount ?> ***** <?lsmb decimal ?>/100 <?lsmb currency ?>

<?lsmb IF notes ?>
\vspace{0.3cm}
<?lsmb FOREACH P IN notes.split('\n\n+') ?>
<?lsmb P ?>\medskip

<?lsmb END ?>
<?lsmb END ?>

\vspace{0.3cm}

<?lsmb IF paid_1 ?>
\begin{tabular}{@{}lllr@{}}
  \multicolumn{5}{c}{\textbf{<?lsmb text('Payments') ?>}} \\
  \hline
  \textbf{<?lsmb text('Date') ?>} & & \textbf{<?lsmb text('Source') ?>} & 
        \textbf{<?lsmb text('Amount') ?>} \\
<?lsmb END ?>
<?lsmb FOREACH payment ?>
<?lsmb lc = loop.index ?>
  <?lsmb paymentdate.${lc} ?> & <?lsmb paymentaccount.${lc} ?> & <?lsmb paymentsource.${lc} ?> & <?lsmb payment.${lc} ?> \\
<?lsmb END ?>
<?lsmb IF paid_1 ?>
\end{tabular}
<?lsmb END ?>

\vspace{0.5cm}

<?lsmb FOREACH tax ?>
<?lsmb lc = loop.index ?>
\textbf{\scriptsize <?lsmb taxdescription.${lc} _ ' ' _ text('Registration') _ ' ' _  taxnumber.${lc} ?>} \\
<?lsmb END ?>
  
\end{document}
<?lsmb END -?>
