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

   Version:  1.4
   Date:     2024-04-21
   File:     1099-MISC.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.4       Fix 'latexpdf' errors with missing data
1.3       Correct values passed into 'taxformpart' block
1.2       Document available variables; replace deprecated ones
1.1       Merged xelatex targetting templates with those targetting pdflatex


This template has the following variables available:

SETTINGS:
  company_name
  company_address
  company_phone
  company_fax
  company_email
  businessnumber
results:
  - id
    legal_name
    entity_id
    entity_class
    control_code
    meta_number
    tax_id
    sales_tax_id
    acc_sum
    invoice_sum
    total_sum
    invnumber  (1)
    duedate    (1)
    invoice_id (1)
    line_one
    line_two
    line_three
    city
    state
    mail_code

(1): These fields are only available when the report being printed
     is a detailed report (as opposed to a summary report).

-?>
<?lsmb FILTER latex { format="$FORMAT($PROCESSOR)" } ?>

\documentclass[usletter]{article}
\usepackage{textpos}
\usepackage[top=0.0in, bottom=0in, left=0in, right=0in]{geometry}
\setlength{\parindent}{0pt}
\setlength{\TPHorizModule}{1in}
\setlength{\TPVertModule}{1in}

<?lsmb BLOCK taxformpart
 # Defines a repeatable block of TeX commands
?>
\begin{textblock}{4}[0,1](1, 1.5)
<?lsmb SETTINGS.company_name || 'No Company Name set in System Defaults' ?>\\
<?lsmb SETTINGS.company_address || 'No Company Address set in System Defaults' ?>\\
Tel: <?lsmb SETTINGS.company_phone ?>
\end{textblock}

\begin{textblock}{2}[0,1](1, 3.5)
<?lsmb SETTINGS.businessnumber ?>
\end{textblock}

\begin{textblock}{2}[0,1](3, 3.5)
<?lsmb taxnumber ?>
\end{textblock}

\begin{textblock}{4}[0,1](1, 4)
<?lsmb legal_name ?>\\
<?lsmb IF street1 ?>
<?lsmb street1 ?>\\
<?lsmb IF street2 ?><?lsmb street2 ?>\\ <?lsmb END ?>
<?lsmb IF street3 ?><?lsmb street3 ?>\\ <?lsmb END ?>
<?lsmb ELSE -?>
No billing or physical address set \\
<?lsmb END # street1 ?>
<?lsmb city ?>, <?lsmb state ?> <?lsmb mail_code ?>
\end{textblock}

\begin{textblock}{2}[0,1](4.5, 4.5)
<?lsmb total_sum ?>
\end{textblock}
<?lsmb END # Block taxformpart ?>

<?lsmb BLOCK taxform
  # Defines a repeatable block of TeX commands
?>
<?lsmb PROCESS taxformpart ?>
\clearpage
<?lsmb PROCESS taxformpart ?>
\clearpage
<?lsmb PROCESS taxformpart ?>
\clearpage
<?lsmb PROCESS taxformpart ?>
\clearpage
<?lsmb END #BLOCK taxform ?>



\begin{document}
<?lsmb
  # Executes the actual form

   FOREACH tf IN results;
     INCLUDE taxform
       legal_name = tf.legal_name
       street1 = tf.line_one
       street2 = tf.line_two
       street3 = tf.line_three
       city = tf.city
       state = tf.state
       mail_code = tf.mail_code
       taxnumber = tf.taxnumber
       total_sum = tf.total_sum;
   END # FOR tf  ?>
\end{document}
<?lsmb END # FILTER latex -?>
