[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb: [1023] trunk



Revision: 1023
          http://svn.sourceforge.net/ledger-smb/?rev=1023&view=rev
Author:   tetragon
Date:     2007-04-03 19:35:26 -0700 (Tue, 03 Apr 2007)

Log Message:
-----------
First round of template changes for new TT system

Modified Paths:
--------------
    trunk/Build.PL
    trunk/LedgerSMB/Form.pm
    trunk/LedgerSMB.pm
    trunk/bin/arapprn.pl
    trunk/bin/cp.pl
    trunk/bin/io.pl
    trunk/bin/jc.pl
    trunk/bin/pos.pl
    trunk/bin/rp.pl
    trunk/menu.pl
    trunk/templates/demo/ap_transaction.html
    trunk/templates/demo/ar_transaction.html
    trunk/templates/demo/balance_sheet.html
    trunk/templates/demo/bin_list.html
    trunk/templates/demo/income_statement.html
    trunk/templates/demo/invoice.html
    trunk/templates/demo/packing_list.html
    trunk/templates/demo/pick_list.html
    trunk/templates/demo/purchase_order.html
    trunk/templates/demo/request_quotation.html
    trunk/templates/demo/sales_order.html
    trunk/templates/demo/sales_quotation.html
    trunk/templates/demo/statement.html
    trunk/templates/demo/timecard.html
    trunk/templates/demo/work_order.html

Added Paths:
-----------
    trunk/LedgerSMB/Template/
    trunk/LedgerSMB/Template/HTML.pm
    trunk/LedgerSMB/Template.pm

Modified: trunk/Build.PL
===================================================================
--- trunk/Build.PL	2007-04-03 15:12:46 UTC (rev 1022)
+++ trunk/Build.PL	2007-04-04 02:35:26 UTC (rev 1023)
@@ -26,6 +26,8 @@
 		'Cwd'				=> 0,
 		'Config::Std'			=> 0,
 		'MIME::Lite'			=> 0,
+		'Error'				=> 0,
+		'Template'			=> 0,
 		},
 	recommends => {
 		'HTML::LinkExtor'		=> 0,

Modified: trunk/LedgerSMB/Form.pm
===================================================================
--- trunk/LedgerSMB/Form.pm	2007-04-03 15:12:46 UTC (rev 1022)
+++ trunk/LedgerSMB/Form.pm	2007-04-04 02:35:26 UTC (rev 1023)
@@ -88,7 +88,7 @@
 
 	}
 
-	if (($self->{script} =~ m#(..|\\|/)#)){
+	if (($self->{script} =~ m#(\.\.|\\|/)#)){
 		$self->error("Access Denied");
 	}
 		
@@ -601,6 +601,7 @@
 
 	my ($chars_per_line, $lines_on_first_page, $lines_on_second_page) = (0, 0, 0);
 	my ($current_page, $current_line) = (1, 1);
+	print STDERR "Using deprecated Form::parse_template function\n";
 	my $pagebreak = "";
 	my $sum = 0;
 

Added: trunk/LedgerSMB/Template/HTML.pm
===================================================================
--- trunk/LedgerSMB/Template/HTML.pm	                        (rev 0)
+++ trunk/LedgerSMB/Template/HTML.pm	2007-04-04 02:35:26 UTC (rev 1023)
@@ -0,0 +1,57 @@
+=head1 NAME
+
+LedgerSMB::Template::HTML  Template support module for LedgerSMB
+
+=head1 METHODS
+
+=item get_template ()
+
+=item preprocess ($vars)
+This method returns a reference to a hash that contains a copy of the passed
+hashref's data with HTML entities converted to escapes. 
+
+=item postprocess ()
+
+=head1 Copyright (C) 2007, The LedgerSMB core team.
+
+# This work contains copyrighted information from a number of sources all used
+# with permission.  
+#
+# It is released under the GNU General Public License Version 2 or, at your 
+# option, any later version.  See COPYRIGHT file for details.  For a full list 
+# including contact information of contributors, maintainers, and copyright 
+# holders, see the CONTRIBUTORS file.
+=cut
+
+use Error qw(:try);
+use CGI;
+
+package LedgerSMB::Template::HTML;
+
+sub get_template {
+	my $name = shift;
+	return "${name}.html";
+}
+
+sub preprocess {
+	my $rawvars = shift;
+	my $vars;
+	my $type = ref $rawvars;
+
+#XXX fix escaping function
+	if ($type eq 'ARRAY') {
+	} elsif ($type eq 'HASH') {
+		for (keys %{$rawvars}) {
+			$vars->{$_} = preprocess($rawvars[$_]);
+		}
+	} else {
+		return CGI::escapeHTML($rawvars); 
+	}
+}
+
+sub postprocess {
+	my $parent = shift;
+	return;
+}
+
+1;


Property changes on: trunk/LedgerSMB/Template/HTML.pm
___________________________________________________________________
Name: svn:executable
   + *

Added: trunk/LedgerSMB/Template.pm
===================================================================
--- trunk/LedgerSMB/Template.pm	                        (rev 0)
+++ trunk/LedgerSMB/Template.pm	2007-04-04 02:35:26 UTC (rev 1023)
@@ -0,0 +1,87 @@
+#=====================================================================
+#
+# Template support module for LedgerSMB
+# LedgerSMB::Template
+#
+# LedgerSMB 
+# Small Medium Business Accounting software
+# http://www.ledgersmb.org/
+# 
+#
+# Copyright (C) 2007
+# This work contains copyrighted information from a number of sources all used
+# with permission.  It is released under the GNU General Public License 
+# Version 2 or, at your option, any later version.  See COPYRIGHT file for 
+# details.
+#
+#
+#======================================================================
+# This package contains template related functions:
+#
+#
+#====================================================================
+use Error qw(:try);
+use Template;
+use LedgerSMB::Sysconfig;
+
+package LedgerSMB::Template;
+
+sub new {
+	my $class = shift;
+	my $self = {};
+	$self->{myconfig} = shift;
+	$self->{template} = shift;
+	$self->{format} = shift;
+	$self->{language} = shift;
+	$self->{output} = '';
+	bless $self, $class;
+	return $self;
+}
+
+sub valid_language {
+	my $self = shift;
+	# XXX Actually perform validity checks
+	return 1;
+}
+
+sub render {
+	my $self = shift;
+	my $vars = shift;
+	my $template;
+
+	if (not defined $self->{language}) {
+		$template = Template->new({
+			INCLUDE_PATH => $self->{'myconfig'}->{'templates'},
+			START_TAG => quotemeta('<?lsmb'),
+			END_TAG => quotemeta('?>'),
+			DELIMITER => ';',
+			}) || throw Error::Simple Template->error(); 
+	} elsif ($self->valid_language()) {
+		$template = Template->new({
+			INCLUDE_PATH => "$self->{'myconfig'}->{'templates'}/$self->{language};$self->{'myconfig'}->{'templates'}",
+			START_TAG => quotemeta('<?lsmb'),
+			END_TAG => quotemeta('?>'),
+			DELIMITER => ';',
+			}) || throw Error::Simple Template->error();
+	} else {
+		throw Error::Simple 'Invalid language';
+	}
+
+	eval "require LedgerSMB::Template::$self->{format}";
+	if ($@) {
+		throw Error::Simple $@;
+	}
+
+	my $cleanvars = &{"LedgerSMB::Template::$self->{format}::preprocess"}($vars);
+	if (not $template->process(
+		&{"LedgerSMB::Template::$self->{format}::get_template"}($self->{template}), 
+			$cleanvars, \$self->{output}, binmode => ':utf8')) {
+		throw Error::Simple $template->error();
+	}
+
+	&{"LedgerSMB::Template::$self->{format}::postprocess"}($self);
+
+	return $self->{output};
+}
+
+1;


Property changes on: trunk/LedgerSMB/Template.pm
___________________________________________________________________
Name: svn:executable
   + *

Modified: trunk/LedgerSMB.pm
===================================================================
--- trunk/LedgerSMB.pm	2007-04-03 15:12:46 UTC (rev 1022)
+++ trunk/LedgerSMB.pm	2007-04-04 02:35:26 UTC (rev 1023)
@@ -136,7 +136,7 @@
 
 	}
 
-	if (($self->{script} =~ m#(..|\\|/)#)){
+	if (($self->{script} =~ m#(\.\.|\\|/)#)){
 		$self->error("Access Denied");
 	}
 		

Modified: trunk/bin/arapprn.pl
===================================================================
--- trunk/bin/arapprn.pl	2007-04-03 15:12:46 UTC (rev 1022)
+++ trunk/bin/arapprn.pl	2007-04-04 02:35:26 UTC (rev 1023)
@@ -39,6 +39,9 @@
 # printing routines for ar, ap
 #
 
+use Error qw(:try);
+use LedgerSMB::Template;
+
 # any custom scripts for this one
 if (-f "bin/custom/arapprn.pl") {
     eval { require "bin/custom/arapprn.pl"; };
@@ -258,6 +261,18 @@
   $form->{fileid} = $invnumber;
   $form->{fileid} =~ s/(\s|\W)+//g;
 
+  if (($form->{'media'} eq 'screen') and ($form->{'format'} eq 'html')) {
+    my $template = LedgerSMB::Template->new(\%myconfig, $form->{'formname'}, 'HTML');
+    try {
+      $template->render($form);
+      $form->header;
+      print $template->{'output'};
+      exit;
+    } catch Error::Simple with {
+      my $E = shift;
+      $form->error($E->stacktrace);
+    };
+  }
   $form->parse_template(\%myconfig);
 
   if ($form->{previousform}) {
@@ -476,6 +491,18 @@
   $form->{fileid} = $form->{invnumber};
   $form->{fileid} =~ s/(\s|\W)+//g;
 
+  if (($form->{'media'} eq 'screen') and ($form->{'format'} eq 'html')) {
+    my $template = LedgerSMB::Template->new(\%myconfig, $form->{'formname'}, 'HTML');
+    try {
+      $template->render($form);
+      $form->header;
+      print $template->{'output'};
+      exit;
+    } catch Error::Simple with {
+      my $E = shift;
+      $form->error($E->stacktrace);
+    };
+  }
   $form->parse_template(\%myconfig);
 
   if (%$old_form) {

Modified: trunk/bin/cp.pl
===================================================================
--- trunk/bin/cp.pl	2007-04-03 15:12:46 UTC (rev 1022)
+++ trunk/bin/cp.pl	2007-04-04 02:35:26 UTC (rev 1023)
@@ -45,7 +45,9 @@
 #
 #======================================================================
 
+use Error qw(:try);
 
+use LedgerSMB::Template;
 use LedgerSMB::CP;
 use LedgerSMB::OP;
 use LedgerSMB::IS;
@@ -1277,6 +1279,18 @@
     $form->{printmode} = '|-';
   }
 
+  if (($form->{'media'} eq 'screen') and ($form->{'format'} eq 'html')) {
+    my $template = LedgerSMB::Template->new(\%myconfig, $form->{'formname'}, 'HTML');
+    try {
+      $template->render($form);
+      $form->header;
+      print $template->{'output'};
+      exit;
+    } catch Error::Simple with {
+      my $E = shift;
+      $form->error($E->stacktrace);
+    };
+  }
   $form->parse_template(\%myconfig, ${LedgerSMB::Sysconfig::userspath});
 
 }

Modified: trunk/bin/io.pl
===================================================================
--- trunk/bin/io.pl	2007-04-03 15:12:46 UTC (rev 1022)
+++ trunk/bin/io.pl	2007-04-04 02:35:26 UTC (rev 1023)
@@ -38,7 +38,10 @@
 #
 #######################################################################
 
+use Error qw(:try); 
+
 use LedgerSMB::Tax;
+use LedgerSMB::Template;
 use LedgerSMB::Sysconfig;
 
 # any custom scripts for this one
@@ -1544,9 +1547,21 @@
  
   $form->{fileid} = $form->{"${inv}number"};
   $form->{fileid} =~ s/(\s|\W)+//g;
-  
+ 
+  if (($form->{'media'} eq 'screen') and ($form->{'format'} eq 'html')) {
+    my $template = LedgerSMB::Template->new(\%myconfig, $form->{'formname'}, 'HTML');
+    try {
+      $template->render($form);
+      $form->header;
+      print $template->{'output'};
+      exit;
+    } catch Error::Simple with {
+      my $E = shift;
+      $form->error($E->stacktrace);
+    };
+  }
+
   $form->parse_template(\%myconfig, ${LedgerSMB::Sysconfig::userspath});
-
   # if we got back here restore the previous form
   if (defined %$old_form) {
     

Modified: trunk/bin/jc.pl
===================================================================
--- trunk/bin/jc.pl	2007-04-03 15:12:46 UTC (rev 1022)
+++ trunk/bin/jc.pl	2007-04-04 02:35:26 UTC (rev 1023)
@@ -39,6 +39,9 @@
 #
 #======================================================================
 
+use Error qw(:try);
+
+use LedgerSMB::Template;
 use LedgerSMB::JC;
 
 1;
@@ -1913,6 +1916,18 @@
     $status{audittrail} .= $form->audittrail("", \%myconfig, \%audittrail);
   }
 
+  if (($form->{'media'} eq 'screen') and ($form->{'format'} eq 'html')) {
+    my $template = LedgerSMB::Template->new(\%myconfig, $form->{'formname'}, 'HTML');
+    try {
+      $template->render($form);
+      $form->header;
+      print $template->{'output'};
+      exit;
+    } catch Error::Simple with {
+      my $E = shift;
+      $form->error($E->stacktrace);
+    };
+  }
   $form->parse_template(\%myconfig, ${LedgerSMB::Sysconfig::userspath});
 
   if (defined %$old_form) {

Modified: trunk/bin/pos.pl
===================================================================
--- trunk/bin/pos.pl	2007-04-03 15:12:46 UTC (rev 1022)
+++ trunk/bin/pos.pl	2007-04-04 02:35:26 UTC (rev 1023)
@@ -40,6 +40,9 @@
 #
 #=====================================================================
 
+use Error qw(:try);
+
+use LedgerSMB::Template;
 use LedgerSMB::Tax;
 
 1;
@@ -872,6 +875,18 @@
   delete $form->{stylesheet};
   $form->{cd_open} = $pos_config{rp_cash_drawer_open};
   
+  if (($form->{'media'} eq 'screen') and ($form->{'format'} eq 'html')) {
+    my $template = LedgerSMB::Template->new(\%myconfig, $form->{'formname'}, 'HTML');
+    try {
+      $template->render($form);
+      $form->header;
+      print $template->{'output'};
+      exit;
+    } catch Error::Simple with {
+      my $E = shift;
+      $form->error($E->stacktrace);
+    };
+  }
   $form->parse_template(\%myconfig, ${LedgerSMB::Sysconfig::userspath});
 
   if ($form->{printed} !~ /$form->{formname}/) {

Modified: trunk/bin/rp.pl
===================================================================
--- trunk/bin/rp.pl	2007-04-03 15:12:46 UTC (rev 1022)
+++ trunk/bin/rp.pl	2007-04-04 02:35:26 UTC (rev 1023)
@@ -41,9 +41,11 @@
 # 
 #======================================================================
 
+use Error qw(:try);
 
 require "bin/arap.pl";
 
+use LedgerSMB::Template;
 use LedgerSMB::PE;
 use LedgerSMB::RP;
 
@@ -993,6 +995,18 @@
 
   $form->{IN} = "income_statement.html";
   
+  if (($form->{'media'} eq 'screen') and ($form->{'format'} eq 'html')) {
+    my $template = LedgerSMB::Template->new(\%myconfig, $form->{'formname'}, 'HTML');
+    try {
+      $template->render($form);
+      $form->header;
+      print $template->{'output'};
+      exit;
+    } catch Error::Simple with {
+      my $E = shift;
+      $form->error($E->stacktrace);
+    };
+  }
   $form->parse_template;
 
 }
@@ -1027,6 +1041,18 @@
 
   $form->{templates} = $myconfig{templates};
 	  
+  if (($form->{'media'} eq 'screen') and ($form->{'format'} eq 'html')) {
+    my $template = LedgerSMB::Template->new(\%myconfig, $form->{'formname'}, 'HTML');
+    try {
+      $template->render($form);
+      $form->header;
+      print $template->{'output'};
+      exit;
+    } catch Error::Simple with {
+      my $E = shift;
+      $form->error($E->stacktrace);
+    };
+  }
   $form->parse_template;
 
 }
@@ -2022,6 +2048,18 @@
 	
 	for ("c0", "c30", "c60", "c90", "") { $form->{"${_}total"} = $form->format_amount(\%myconfig, $form->{"${_}total"}, 2) }
 
+        if (($form->{'media'} eq 'screen') and ($form->{'format'} eq 'html')) {
+          my $template = LedgerSMB::Template->new(\%myconfig, $form->{'formname'}, 'HTML');
+          try {
+            $template->render($form);
+            $form->header;
+            print $template->{'output'};
+            exit;
+          } catch Error::Simple with {
+            my $E = shift;
+            $form->error($E->stacktrace);
+          };
+        }
 	$form->parse_template(\%myconfig, ${LedgerSMB::Sysconfig::userspath});
 	
       }

Modified: trunk/menu.pl
===================================================================
--- trunk/menu.pl	2007-04-03 15:12:46 UTC (rev 1022)
+++ trunk/menu.pl	2007-04-04 02:35:26 UTC (rev 1023)
@@ -48,6 +48,7 @@
 
 use LedgerSMB::Sysconfig;
 use Digest::MD5;
+use Error qw(:try);
 
 $| = 1;
 

Modified: trunk/templates/demo/ap_transaction.html
===================================================================
--- trunk/templates/demo/ap_transaction.html	2007-04-03 15:12:46 UTC (rev 1022)
+++ trunk/templates/demo/ap_transaction.html	2007-04-04 02:35:26 UTC (rev 1023)
@@ -3,7 +3,7 @@
 
 <table width="100%">
 
-  <?lsmb include letterhead.html ?>
+  <?lsmb INCLUDE letterhead.html ?>
   
   <tr>
     <td width=10>&nbsp;</td>
@@ -21,39 +21,39 @@
         <tr valign=top>
           <td><?lsmb name ?>
           <br><?lsmb address1 ?>
-	  <?lsmb if address2 ?>
+	  <?lsmb IF address2 ?>
           <br><?lsmb address2 ?>
-	  <?lsmb end address2 ?>
+	  <?lsmb END ?>
           <br><?lsmb city ?>
-	  <?lsmb if state ?>
+	  <?lsmb IF state ?>
 	  , <?lsmb state ?>
-	  <?lsmb end state ?>
+	  <?lsmb END ?>
 	  <?lsmb zipcode ?>
-	  <?lsmb if country ?>
+	  <?lsmb IF country ?>
 	  <br><?lsmb country ?>
-	  <?lsmb end country ?>
+	  <?lsmb END ?>
           <br>
 
-          <?lsmb if contact ?>
+          <?lsmb IF contact ?>
           <br><?lsmb contact ?>
           <br>
-          <?lsmb end contact ?>
+          <?lsmb END ?>
 
-          <?lsmb if vendorphone ?>
+          <?lsmb IF vendorphone ?>
           <br>Tel: <?lsmb vendorphone ?>
-          <?lsmb end vendorphone ?>
+          <?lsmb END ?>
 
-          <?lsmb if vendorfax ?>
+          <?lsmb IF vendorfax ?>
           <br>Fax: <?lsmb vendorfax ?>
-          <?lsmb end vendorfax ?>
+          <?lsmb END ?>
 
-          <?lsmb if email ?>
+          <?lsmb IF email ?>
           <br><?lsmb email ?>
-          <?lsmb end email ?>
+          <?lsmb END ?>
 
-          <?lsmb if vendortaxnumber ?>
+          <?lsmb IF vendortaxnumber ?>
           <p>Taxnumber: <?lsmb vendortaxnumber ?>
-          <?lsmb end vendortaxnumber ?>
+          <?lsmb END ?>
           </td>
    
 	  <td align=right>
@@ -70,18 +70,18 @@
 		<th align=left nowrap>Due</th>
 		<td><?lsmb duedate ?></td>
 	      </tr>
-	      <?lsmb if ponumber ?>
+	      <?lsmb IF ponumber ?>
               <tr>
                 <th align=left>PO #</th>
 		<td><?lsmb ponumber ?>&nbsp;</td>
 	      </tr>
-	      <?lsmb end ponumber ?>
-	      <?lsmb if ordnumber ?>
+	      <?lsmb END ?>
+	      <?lsmb IF ordnumber ?>
 	      <tr>
 		<th align=left>Order #</th>
 		<td><?lsmb ordnumber ?>&nbsp;</td>
 	      </tr>
-	      <?lsmb end ordnumber ?>
+	      <?lsmb END ?>
 	      <tr>
 		<th align=left nowrap>Employee</th>
 		<td><?lsmb employee ?>&nbsp;</td>
@@ -100,48 +100,48 @@
   
     <td>
       <table>
-	<?lsmb foreach account ?>
+	<?lsmb FOREACH account ?>
+	<?lsmb loop_count = loop.count - 1 ?>
 	<tr valign=top>
-	  <td><?lsmb accno ?></td>
-	  <td><?lsmb account ?></td>
+	  <td><?lsmb accno.${loop_count} ?></td>
+	  <td><?lsmb account.${loop_count} ?></td>
 	  <td width=10> </td>
-	  <td align=right><?lsmb amount ?></td>
+	  <td align=right><?lsmb amount.${loop_count} ?></td>
 	  <td width=10> </td>
-	  <td><?lsmb description ?></td>
+	  <td><?lsmb description.${loop_count} ?></td>
 	  <td width=10> </td>
-	  <td><?lsmb projectnumber ?></td>
+	  <td><?lsmb projectnumber.${loop_count} ?></td>
 	</tr>
-	<?lsmb end account ?>
+	<?lsmb END ?>
 
 	<tr>
-	  <?lsmb if taxincluded ?>
+	  <?lsmb IF taxincluded ?>
 	  <th colspan=2 align=right>Total</th>
 	  <td width=10> </td>
 	  <td align=right><?lsmb invtotal ?></td>
-	  <?lsmb end taxincluded ?>
-
-	  <?lsmb if not taxincluded ?>
+	  <?lsmb ELSE ?>
 	  <th colspan=2 align=right>Subtotal</th>
 	  <td width=10> </td>
 	  <td align=right><?lsmb subtotal ?></td>
-	  <?lsmb end taxincluded ?>
+	  <?lsmb END ?>
 	</tr>
 
-	<?lsmb foreach tax ?>
+	<?lsmb FOREACH tax ?>
+	<?lsmb loop_count = loop.count - 1 ?>
 	<tr>
-	  <th colspan=2 align=right><?lsmb taxdescription ?> @ <?lsmb taxrate ?> %</th>
+	  <th colspan=2 align=right><?lsmb taxdescription.${loop_count} ?> @ <?lsmb taxrate.${loop_count} ?> %</th>
 	  <td width=10> </td>
-	  <td align=right><?lsmb tax ?></td>
+	  <td align=right><?lsmb tax.${loop_count} ?></td>
 	</tr>
-	<?lsmb end tax ?>
+	<?lsmb END ?>
 	
-	<?lsmb if not taxincluded ?>
+	<?lsmb IF NOT taxincluded ?>
 	<tr>
 	  <th colspan=2 align=right>Total</th>
 	  <td width=10> </td>
 	  <td align=right><?lsmb invtotal ?></td>
 	</tr>
-	<?lsmb end taxincluded ?>
+	<?lsmb END ?>
       </table>
     </td>
   </tr>
@@ -162,7 +162,7 @@
     </td>
   </tr>
 
-  <?lsmb if paid_1 ?>
+  <?lsmb IF paid_1 ?>
   <tr>
     <td>&nbsp;</td>
 
@@ -188,30 +188,31 @@
 		<th>Memo</th>
 		<th>Amount</th>
 	      </tr>
-  <?lsmb end paid_1 ?>
+  <?lsmb END ?>
 
-        <?lsmb foreach payment ?>
+        <?lsmb FOREACH payment ?>
+        <?lsmb loop_count = loop.count - 1 ?>
 	      <tr>
-		<td><?lsmb paymentdate ?></td>
-		<td><?lsmb paymentaccount ?></td>
-		<td><?lsmb paymentsource ?></td>
-		<td><?lsmb paymentmemo ?></td>
-		<td align=right><?lsmb payment ?></td>
+		<td><?lsmb paymentdate.${loop_count} ?></td>
+		<td><?lsmb paymentaccount.${loop_count} ?></td>
+		<td><?lsmb paymentsource.${loop_count} ?></td>
+		<td><?lsmb paymentmemo.${loop_count} ?></td>
+		<td align=right><?lsmb payment.${loop_count} ?></td>
 	      </tr>
-        <?lsmb end payment ?>
+        <?lsmb END ?>
 
-  <?lsmb if paid_1 ?>
+  <?lsmb IF paid_1 ?>
 	    </table>
 	  </td>
         </tr>
       </table>
     </td>
   </tr>
-  <?lsmb end paid_1 ?>
+  <?lsmb END ?>
 
   <tr height=10></tr>
 
-  <?lsmb if taxincluded ?>
+  <?lsmb IF taxincluded ?>
   <tr>
     <td>&nbsp;</td>
   </tr>
@@ -219,7 +220,7 @@
   <tr>
     <th colspan=3 align=left><font size=-2>Taxes shown are included in price.</th>
   </tr>
-  <?lsmb end taxincluded ?>
+  <?lsmb END ?>
 
 </table>
 

Modified: trunk/templates/demo/ar_transaction.html
===================================================================
--- trunk/templates/demo/ar_transaction.html	2007-04-03 15:12:46 UTC (rev 1022)
+++ trunk/templates/demo/ar_transaction.html	2007-04-04 02:35:26 UTC (rev 1023)
@@ -3,7 +3,7 @@
 
 <table width="100%">
 
-  <?lsmb include letterhead.html ?>
+  <?lsmb INCLUDE letterhead.html ?>
 
   <tr>
     <td width=10>&nbsp;</td>
@@ -21,39 +21,39 @@
         <tr valign=top>
           <td><?lsmb name ?>
           <br><?lsmb address1 ?>
-	  <?lsmb if address2 ?>
+	  <?lsmb IF address2 ?>
           <br><?lsmb address2 ?>
-	  <?lsmb end address2 ?>
+	  <?lsmb END ?>
           <br><?lsmb city ?>
-	  <?lsmb if state ?>
+	  <?lsmb IF state ?>
 	  , <?lsmb state ?>
-	  <?lsmb end state ?>
+	  <?lsmb END ?>
 	  <?lsmb zipcode ?>
-	  <?lsmb if country ?>
+	  <?lsmb IF country ?>
 	  <br><?lsmb country ?>
-	  <?lsmb end country ?>
+	  <?lsmb END ?>
           <br>
 
-          <?lsmb if contact ?>
+          <?lsmb IF contact ?>
           <br><?lsmb contact ?>
           <br>
-          <?lsmb end contact ?>
+          <?lsmb END ?>
 
-          <?lsmb if customerphone ?>
+          <?lsmb IF customerphone ?>
           <br>Tel: <?lsmb customerphone ?>
-          <?lsmb end customerphone ?>
+          <?lsmb END ?>
 
-          <?lsmb if customerfax ?>
+          <?lsmb IF customerfax ?>
           <br>Fax: <?lsmb customerfax ?>
-          <?lsmb end customerfax ?>
+          <?lsmb END ?>
 
-          <?lsmb if email ?>
+          <?lsmb IF email ?>
           <br><?lsmb email ?>
-          <?lsmb end email ?>
+          <?lsmb END ?>
 
-          <?lsmb if customertaxnumber ?>
+          <?lsmb IF customertaxnumber ?>
           <br>Taxnumber: <?lsmb customertaxnumber ?>
-          <?lsmb end customertaxnumber ?>
+          <?lsmb END ?>
           </td>
    
 	  <td align=right>
@@ -70,18 +70,18 @@
 		<th align=left nowrap>Due</th>
 		<td><?lsmb duedate ?></td>
 	      </tr>
-	      <?lsmb if ponumber ?>
+	      <?lsmb IF ponumber ?>
               <tr>
                 <th align=left>PO #</th>
 		<td><?lsmb ponumber ?>&nbsp;</td>
 	      </tr>
-	      <?lsmb end ponumber ?>
-	      <?lsmb if ordnumber ?>
+	      <?lsmb END ?>
+	      <?lsmb IF ordnumber ?>
 	      <tr>
 		<th align=left>Order #</th>
 		<td><?lsmb ordnumber ?>&nbsp;</td>
 	      </tr>
-	      <?lsmb end ordnumber ?>
+	      <?lsmb END ?>
 	      <tr>
 		<th align=left nowrap>Salesperson</th>
 		<td><?lsmb employee ?>&nbsp;</td>
@@ -100,48 +100,48 @@
   
     <td>
       <table>
-	<?lsmb foreach account ?>
+	<?lsmb FOREACH account ?>
+        <?lsmb loop_count = loop.count - 1 ?>
 	<tr valign=top>
-	  <td><?lsmb accno ?></td>
-	  <td><?lsmb account ?></td>
-	  <td width=10>&nbsp</td>
-	  <td align=right><?lsmb amount ?></td>
-	  <td width=10>&nbsp</td>
-	  <td><?lsmb description ?></td>
-	  <td width=10>&nbsp</td>
-	  <td><?lsmb projectnumber ?></td>
+	  <td><?lsmb accno.${loop_count} ?></td>
+	  <td><?lsmb account.${loop_count} ?></td>
+	  <td width=10>&nbsp;</td>
+	  <td align=right><?lsmb amount.${loop_count} ?></td>
+	  <td width=10>&nbsp;</td>
+	  <td><?lsmb description.${loop_count} ?></td>
+	  <td width=10>&nbsp;</td>
+	  <td><?lsmb projectnumber.${loop_count} ?></td>
 	</tr>
-	<?lsmb end account ?>
+	<?lsmb END ?>
 
 	<tr>
-	  <?lsmb if taxincluded ?>
+	  <?lsmb IF taxincluded ?>
 	  <th colspan=2 align=right>Total</th>
-	  <td width=10>&nbsp</td>
+	  <td width=10>&nbsp;</td>
 	  <td align=right><?lsmb invtotal ?></td>
-	  <?lsmb end taxincluded ?>
-
-	  <?lsmb if not taxincluded ?>
+	  <?lsmb ELSE ?>
 	  <th colspan=2 align=right>Subtotal</th>
-	  <td width=10>&nbsp</td>
+	  <td width=10>&nbsp;</td>
 	  <td align=right><?lsmb subtotal ?></td>
-	  <?lsmb end taxincluded ?>
+	  <?lsmb END ?>
 	</tr>
 
-	<?lsmb foreach tax ?>
+	<?lsmb FOREACH tax ?>
+	<?lsmb loop_count = loop.count - 1 ?>
 	<tr>
-	  <th colspan=2 align=right><?lsmb taxdescription ?> @ <?lsmb taxrate ?> %</th>
-	  <td width=10>&nbsp</td>
-	  <td align=right><?lsmb tax ?></td>
+	  <th colspan=2 align=right><?lsmb taxdescription.${loop_count} ?> @ <?lsmb taxrate.${loop_count} ?> %</th>
+	  <td width=10>&nbsp;</td>
+	  <td align=right><?lsmb tax.${loop_count} ?></td>
 	</tr>
-	<?lsmb end tax ?>
+	<?lsmb END ?>
 	
-	<?lsmb if not taxincluded ?>
+	<?lsmb IF NOT taxincluded ?>
 	<tr>
 	  <th colspan=2 align=right>Total</th>
-	  <td width=10>&nbsp</td>
+	  <td width=10>&nbsp;</td>
 	  <td align=right><?lsmb invtotal ?></td>
 	</tr>
-	<?lsmb end taxincluded ?>
+	<?lsmb END ?>
       </table>
     </td>
   </tr>
@@ -162,7 +162,7 @@
     </td>
   </tr>
 
-  <?lsmb if paid_1 ?>
+  <?lsmb IF paid_1 ?>
   <tr>
     <td>&nbsp;</td>
 
@@ -187,37 +187,39 @@
 		<th>Source</th>
 		<th>Amount</th>
 	      </tr>
-  <?lsmb end paid_1 ?>
+  <?lsmb END ?>
 
-        <?lsmb foreach payment ?>
+        <?lsmb FOREACH payment ?>
+	<?lsmb loop_count = loop.count - 1 ?>
 	      <tr>
-		<td><?lsmb paymentdate ?></td>
-		<td><?lsmb paymentaccount ?></td>
-		<td><?lsmb paymentsource ?></td>
-		<td align=right><?lsmb payment ?></td>
+		<td><?lsmb paymentdate.${loop_count} ?></td>
+		<td><?lsmb paymentaccount.${loop_count} ?></td>
+		<td><?lsmb paymentsource.${loop_count} ?></td>
+		<td align=right><?lsmb payment.${loop_count} ?></td>
 	      </tr>
-        <?lsmb end payment ?>
+        <?lsmb END ?>
 
-  <?lsmb if paid_1 ?>
+  <?lsmb IF paid_1 ?>
 	    </table>
 	  </td>
         </tr>
       </table>
     </td>
   </tr>
-  <?lsmb end paid_1 ?>
+  <?lsmb END ?>
 
   <tr height=10></tr>
 
-  <?lsmb foreach tax ?>
+  <?lsmb FOREACH tax ?>
+  <?lsmb loop_count = loop.count - 1 ?>
   <tr>
     <td>&nbsp;</td>
 
-    <th colspan=9 align=left><font size=-2><?lsmb taxdescription ?> Registration <?lsmb taxnumber ?></th>
+    <th colspan=9 align=left><font size=-2><?lsmb taxdescription.${loop_count} ?> Registration <?lsmb taxnumber.${loop_count} ?></th>
   </tr>
-  <?lsmb end tax ?>
+  <?lsmb END ?>
 
-  <?lsmb if taxincluded ?>
+  <?lsmb IF taxincluded ?>
   <tr>
     <td>&nbsp;</td>
   </tr>
@@ -225,7 +227,7 @@
   <tr>
     <th colspan=3 align=left><font size=-2>Taxes shown are included in price.</th>
   </tr>
-  <?lsmb end taxincluded ?>
+  <?lsmb END ?>
 
 </table>
 

Modified: trunk/templates/demo/balance_sheet.html
===================================================================
--- trunk/templates/demo/balance_sheet.html	2007-04-03 15:12:46 UTC (rev 1022)
+++ trunk/templates/demo/balance_sheet.html	2007-04-04 02:35:26 UTC (rev 1023)
@@ -9,9 +9,9 @@
 <br>as at <?lsmb this_period ?>
 </h2>
 
-<?lsmb if department ?>
+<?lsmb IF department ?>
 <h4>Department: <?lsmb department ?></h4>
-<?lsmb end department ?>
+<?lsmb END ?>
 
 <table border=0>
 <tr>
@@ -20,14 +20,15 @@
   <th><?lsmb last_period ?></th>
 </tr>
 
-<?lsmb foreach asset_account ?>
+<?lsmb FOREACH asset_account ?>
+<?lsmb loop_count = loop.count - 1 ?>
 <tr>
   <td> </td>
-  <td><?lsmb asset_account ?></td>
-  <td align=right><?lsmb asset_this_period ?></td>
-  <td align=right><?lsmb asset_last_period ?></td>
+  <td><?lsmb asset_account.${loop_count} ?></td>
+  <td align=right><?lsmb asset_this_period.${loop_count} ?></td>
+  <td align=right><?lsmb asset_last_period.${loop_count} ?></td>
 </tr>
-<?lsmb end asset_account ?>
+<?lsmb END ?>
 
 <tr>
   <td colspan=2> </td>
@@ -45,14 +46,15 @@
   <th align=left colspan=4>LIABILITIES<b><hr align=left width=250 size=5 noshade></th>
 </tr>
 
-<?lsmb foreach liability_account ?>
+<?lsmb FOREACH liability_account ?>
+<?lsmb loop_count = loop.count - 1 ?>
 <tr>
   <td></td>
-  <td><?lsmb liability_account ?></td>
-  <td align=right><?lsmb liability_this_period ?></td>
-  <td align=right><?lsmb liability_last_period ?></td>
+  <td><?lsmb liability_account.${loop_count} ?></td>
+  <td align=right><?lsmb liability_this_period.${loop_count} ?></td>
+  <td align=right><?lsmb liability_last_period.${loop_count} ?></td>
 </tr>
-<?lsmb end liability_account ?>
+<?lsmb END ?>
 
 <tr>
   <td colspan=2> </td>
@@ -71,14 +73,15 @@
   <th align=left colspan=4>SHAREHOLDER'S EQUITY<br><hr align=left width=250 size=5 noshade></th>
 </tr>
 
-<?lsmb foreach equity_account ?>
+<?lsmb FOREACH equity_account ?>
+<?lsmb loop_count = loop.count - 1 ?>
 <tr>
   <td></td>
-  <td><?lsmb equity_account ?></td>
-  <td align=right><?lsmb equity_this_period ?></td>
-  <td align=right><?lsmb equity_last_period ?></td>
+  <td><?lsmb equity_account.${loop_count} ?></td>
+  <td align=right><?lsmb equity_this_period.${loop_count} ?></td>
+  <td align=right><?lsmb equity_last_period.${loop_count} ?></td>
 </tr>
-<?lsmb end equity_account ?>
+<?lsmb END ?>
 
 <tr>
   <td colspan=2> </td>

Modified: trunk/templates/demo/bin_list.html
===================================================================
--- trunk/templates/demo/bin_list.html	2007-04-03 15:12:46 UTC (rev 1022)
+++ trunk/templates/demo/bin_list.html	2007-04-04 02:35:26 UTC (rev 1023)
@@ -3,7 +3,7 @@
 
 <table width="100%">
 
-  <?lsmb include letterhead.html ?>
+  <?lsmb INCLUDE letterhead.html ?>
 
   <tr>
     <td width=10>&nbsp;</td>
@@ -26,63 +26,63 @@
 	<tr valign=top>
 	  <td><?lsmb name ?>
 	  <br><?lsmb address1 ?>
-	  <?lsmb if address2 ?>
+	  <?lsmb IF address2 ?>
           <br><?lsmb address2 ?>
-          <?lsmb end address2 ?>
+          <?lsmb END ?>
 	  <br><?lsmb city ?>
-	  <?lsmb if state ?>
+	  <?lsmb IF state ?>
 	  , <?lsmb state ?>
-	  <?lsmb end state ?>
+	  <?lsmb END ?>
 	  <?lsmb zipcode ?>
-	  <?lsmb if country ?>
+	  <?lsmb IF country ?>
           <?lsmb country ?>
-          <?lsmb end country ?>
+          <?lsmb END ?>
 	  <br>
 
-	  <?lsmb if contact ?>
+	  <?lsmb IF contact ?>
 	  <br>Attn: <?lsmb contact ?>
-	  <?lsmb end contact ?>
+	  <?lsmb END ?>
 
-	  <?lsmb if vendorphone ?>
+	  <?lsmb IF vendorphone ?>
 	  <br>Tel: <?lsmb vendorphone ?>
-	  <?lsmb end vendorphone ?>
+	  <?lsmb END ?>
 
-	  <?lsmb if vendorfax ?>
+	  <?lsmb IF vendorfax ?>
 	  <br>Fax: <?lsmb vendorfax ?>
-	  <?lsmb end vendorfax ?>
+	  <?lsmb END ?>
 
-	  <?lsmb if email ?>
+	  <?lsmb IF email ?>
 	  <br><?lsmb email ?>
-	  <?lsmb end email ?>
+	  <?lsmb END ?>
 	  
 	  </td>
 	  
 	  <td><?lsmb shiptoname ?>
 	  <br><?lsmb shiptoaddress1 ?>
-	  <?lsmb if shiptoaddress2 ?>
+	  <?lsmb IF shiptoaddress2 ?>
           <br><?lsmb shiptoaddress2 ?>
-          <?lsmb end shiptoaddress2 ?>
+          <?lsmb END ?>
 	  <br><?lsmb shiptocity ?>
-	  <?lsmb if shiptostate ?>
+	  <?lsmb IF shiptostate ?>
 	  , <?lsmb shiptostate ?>
-	  <?lsmb end shiptostate ?>
+	  <?lsmb END ?>
 	  <?lsmb shiptozipcode ?>
-	  <?lsmb if shiptocountry ?>
+	  <?lsmb IF shiptocountry ?>
           <?lsmb shiptocountry ?>
-          <?lsmb end shiptocountry ?>
+          <?lsmb END ?>
 
 	  <br>
-	  <?lsmb if shiptocontact ?>
+	  <?lsmb IF shiptocontact ?>
 	  <br>Attn: <?lsmb shiptocontact ?>
-	  <?lsmb end shiptocontact ?>
+	  <?lsmb END ?>
 	  
-	  <?lsmb if shiptophone ?>
+	  <?lsmb IF shiptophone ?>
 	  <br>Tel: <?lsmb shiptophone ?>
-	  <?lsmb end shiptophone ?>
+	  <?lsmb END ?>
 
-	  <?lsmb if shiptofax ?>
+	  <?lsmb IF shiptofax ?>
 	  <br>Fax: <?lsmb shiptofax ?>
-	  <?lsmb end shiptofax ?>
+	  <?lsmb END ?>
 	  </td>
 	</tr>
       </table>
@@ -100,9 +100,9 @@
 	  <th width=17% align=left nowrap>Order #</th>
 	  <th width=17% align=left nowrap>Date</th>
 	  <th width=17% align=left nowrap>Contact</th>
-	  <?lsmb if warehouse ?>
+	  <?lsmb IF warehouse ?>
 	  <th width=17% align=left nowrap>Warehouse</th>
-	  <?lsmb end warehouse ?>
+	  <?lsmb END ?>
 	  <th width=17% align=left>Shipping Point</th>
 	  <th width=15% align=left>Ship via</th>
 	</tr>
@@ -110,19 +110,17 @@
 	<tr>
 	  <td><?lsmb ordnumber ?>&nbsp;</td>
 	  
-	  <?lsmb if shippingdate ?>
+	  <?lsmb IF shippingdate ?>
 	  <td><?lsmb shippingdate ?></td>
-	  <?lsmb end shippingdate ?>
-	  
-	  <?lsmb if not shippingdate ?>
+	  <?lsmb ELSE ?>
 	  <td><?lsmb orddate ?></td>
-	  <?lsmb end shippingdate ?>
+	  <?lsmb END ?>
 	  
 	  <td><?lsmb employee ?>&nbsp;</td>
 
-	  <?lsmb if warehouse ?>
+	  <?lsmb IF warehouse ?>
 	  <td><?lsmb warehouse ?></td>
-	  <?lsmb end warehouse ?>
+	  <?lsmb END ?>
   
 	  <td><?lsmb shippingpoint ?>&nbsp;</td>
 	  <td><?lsmb shipvia ?>&nbsp;</td>
@@ -148,19 +146,20 @@
 	  <th><font color=ffffff>Bin</th>
 	</tr>
 
-	<?lsmb foreach number ?>
+	<?lsmb FOREACH number ?>
+	<?lsmb loop_count = loop.count - 1 ?>
 	<tr valign=top>
-	  <td><?lsmb runningnumber ?></td>
-	  <td><?lsmb number ?></td>
-	  <td><?lsmb description ?></td>
-	  <td><?lsmb serialnumber ?></td>
-	  <td><?lsmb deliverydate ?></td>
-	  <td align=right><?lsmb qty ?></td>
-	  <td align=right><?lsmb ship ?></td>
-	  <td><?lsmb unit ?></td>
-	  <td><?lsmb bin ?></td>
+	  <td><?lsmb runningnumber.${loop_count} ?></td>
+	  <td><?lsmb number.${loop_count} ?></td>
+	  <td><?lsmb description.${loop_count} ?></td>
+	  <td><?lsmb serialnumber.${loop_count} ?></td>
+	  <td><?lsmb deliverydate.${loop_count} ?></td>
+	  <td align=right><?lsmb qty.${loop_count} ?></td>
+	  <td align=right><?lsmb ship.${loop_count} ?></td>
+	  <td><?lsmb unit.${loop_count} ?></td>
+	  <td><?lsmb bin.${loop_count} ?></td>
 	</tr>
-	<?lsmb end number ?>
+	<?lsmb END ?>
 
       </table>
     </td>

Modified: trunk/templates/demo/income_statement.html
===================================================================
--- trunk/templates/demo/income_statement.html	2007-04-03 15:12:46 UTC (rev 1022)
+++ trunk/templates/demo/income_statement.html	2007-04-04 02:35:26 UTC (rev 1023)
@@ -9,13 +9,13 @@
 <br><?lsmb period ?>
 </h2>
 
-<?lsmb if department ?>
+<?lsmb IF department ?>
 <h4>Department: <?lsmb department ?></h4>
-<?lsmb end department ?>
+<?lsmb END ?>
 
-<?lsmb if projectnumber ?>
+<?lsmb IF projectnumber ?>
 <h4>Project Number: <?lsmb projectnumber ?></h4>
-<?lsmb end projectnumber ?>
+<?lsmb END ?>
 
 <table width=100% border=0>
 <tr>
@@ -24,14 +24,15 @@
   <th><?lsmb last_period ?></th>
 </tr>
 
-<?lsmb foreach income_account ?>
+<?lsmb FOREACH income_account ?>
+<?lsmb loop_count = loop.count - 1 ?>
 <tr>
   <td width=4> </td>
-  <td><?lsmb income_account ?></td>
-  <td align=right><?lsmb income_this_period ?></td>
-  <td align=right><?lsmb income_last_period ?></td>
+  <td><?lsmb income_account.${loop_count} ?></td>
+  <td align=right><?lsmb income_this_period.${loop_count} ?></td>
+  <td align=right><?lsmb income_last_period.${loop_count} ?></td>
 </tr>
-<?lsmb end income_account ?>
+<?lsmb END ?>
 
 <tr>
   <td colspan=2> </td>
@@ -50,14 +51,15 @@
   <th align=left colspan=2>EXPENSES<br><hr width=300 size=5 align=left noshade></th>
 </tr>
 
-<?lsmb foreach expense_account ?>
+<?lsmb FOREACH expense_account ?>
+<?lsmb loop_count = loop.count - 1 ?>
 <tr>
   <td> </td>
-  <td><?lsmb expense_account ?></td>
-  <td align=right><?lsmb expenses_this_period ?></td>
-  <td align=right><?lsmb expenses_last_period ?></td>
+  <td><?lsmb expense_account.${loop_count} ?></td>
+  <td align=right><?lsmb expenses_this_period.${loop_count} ?></td>
+  <td align=right><?lsmb expenses_last_period.${loop_count} ?></td>
 </tr>
-<?lsmb end expense_account ?>
+<?lsmb END ?>
 
 <tr>
   <td colspan=2> </td>

Modified: trunk/templates/demo/invoice.html
===================================================================
--- trunk/templates/demo/invoice.html	2007-04-03 15:12:46 UTC (rev 1022)
+++ trunk/templates/demo/invoice.html	2007-04-04 02:35:26 UTC (rev 1023)
@@ -3,7 +3,7 @@
 
 <table width="100%">
 
-  <?lsmb include letterhead.html ?>
+  <?lsmb INCLUDE letterhead.html ?>
   
   <tr>
     <td width=10>&nbsp;</td>
@@ -26,68 +26,68 @@
         <tr valign=top>
           <td><?lsmb name ?>
           <br><?lsmb address1 ?>
-	  <?lsmb if address2 ?>
+	  <?lsmb IF address2 ?>
           <br><?lsmb address2 ?>
-	  <?lsmb end address2 ?>
+	  <?lsmb END ?>
           <br><?lsmb city ?>
-	  <?lsmb if state ?>
+	  <?lsmb IF state ?>
 	  , <?lsmb state ?>
-	  <?lsmb end state ?>
+	  <?lsmb END ?>
 	  <?lsmb zipcode ?>
-	  <?lsmb if country ?>
+	  <?lsmb IF country ?>
 	  <br><?lsmb country ?>
-	  <?lsmb end country ?>
+	  <?lsmb END ?>
           <br>
 
-          <?lsmb if contact ?>
+          <?lsmb IF contact ?>
           <br><?lsmb contact ?>
           <br>
-          <?lsmb end contact ?>
+          <?lsmb END ?>
 
-          <?lsmb if customerphone ?>
+          <?lsmb IF customerphone ?>
           <br>Tel: <?lsmb customerphone ?>
-          <?lsmb end customerphone ?>
+          <?lsmb END ?>
 
-          <?lsmb if customerfax ?>
+          <?lsmb IF customerfax ?>
           <br>Fax: <?lsmb customerfax ?>
-          <?lsmb end customerfax ?>
+          <?lsmb END ?>
 
-          <?lsmb if email ?>
+          <?lsmb IF email ?>
           <br><?lsmb email ?>
-          <?lsmb end email ?>
+          <?lsmb END ?>
           </td>
 
           <td><?lsmb shiptoname ?>
           <br><?lsmb shiptoaddress1 ?>
-	  <?lsmb if shiptoaddress2 ?>
+	  <?lsmb IF shiptoaddress2 ?>
           <br><?lsmb shiptoaddress2 ?>
-	  <?lsmb end shiptoaddress2 ?>
+	  <?lsmb END ?>
           <br><?lsmb shiptocity ?>
-	  <?lsmb if shiptostate ?>
+	  <?lsmb IF shiptostate ?>
 	  , <?lsmb shiptostate ?>
-	  <?lsmb end shiptostate ?>
+	  <?lsmb END ?>
 	  <?lsmb shiptozipcode ?>
-	  <?lsmb if shiptocountry ?>
+	  <?lsmb IF shiptocountry ?>
 	  <br><?lsmb shiptocountry ?>
-	  <?lsmb end shiptocountry ?>
+	  <?lsmb END ?>
           <br>
 
-          <?lsmb if shiptocontact ?>
+          <?lsmb IF shiptocontact ?>
           <br><?lsmb shiptocontact ?>
           <br>
-          <?lsmb end shiptocontact ?>
+          <?lsmb END ?>
 
-          <?lsmb if shiptophone ?>
+          <?lsmb IF shiptophone ?>
           <br>Tel: <?lsmb shiptophone ?>
-          <?lsmb end shiptophone ?>
+          <?lsmb END ?>
 
-          <?lsmb if shiptofax ?>
+          <?lsmb IF shiptofax ?>
           <br>Fax: <?lsmb shiptofax ?>
-          <?lsmb end shiptofax ?>
+          <?lsmb END ?>
 
-          <?lsmb if shiptoemail ?>
+          <?lsmb IF shiptoemail ?>
           <br><?lsmb shiptoemail ?>
-          <?lsmb end shiptoemail ?>
+          <?lsmb END ?>
           </td>
         </tr>
       </table>
@@ -141,62 +141,62 @@
           <th align=right><font color=ffffff>Extended</th>
         </tr>
 
-        <?lsmb foreach number ?>
+        <?lsmb FOREACH number ?>
+        <?lsmb loop_count = loop.count - 1 ?>
         <tr valign=top>
-          <td align=right><?lsmb runningnumber ?>.</td>
-          <td><?lsmb number ?></td>
-          <td><?lsmb description ?></td>
-          <td><?lsmb deliverydate ?></td>
-          <td align=right><?lsmb qty ?></td>
-          <td><?lsmb unit ?></td>
-          <td align=right><?lsmb sellprice ?></td>
-          <td align=right><?lsmb discountrate ?></td>
-          <td align=right><?lsmb linetotal ?></td>
+          <td align=right><?lsmb runningnumber.${loop_count} ?>.</td>
+          <td><?lsmb number.${loop_count} ?></td>
+          <td><?lsmb description.${loop_count} ?></td>
+          <td><?lsmb deliverydate.${loop_count} ?></td>
+          <td align=right><?lsmb qty.${loop_count} ?></td>
+          <td><?lsmb unit.${loop_count} ?></td>
+          <td align=right><?lsmb sellprice.${loop_count} ?></td>
+          <td align=right><?lsmb discountrate.${loop_count} ?></td>
+          <td align=right><?lsmb linetotal.${loop_count} ?></td>
         </tr>
-        <?lsmb end number ?>
+        <?lsmb END ?>
 
         <tr>
           <td colspan=9><hr noshade></td>
         </tr>
     
         <tr>
-          <?lsmb if taxincluded ?>
+          <?lsmb IF taxincluded ?>
           <th colspan=7 align=right>Total</th>
           <td colspan=2 align=right><?lsmb invtotal ?></td>
-          <?lsmb end taxincluded ?>
-
-          <?lsmb if not taxincluded ?>
+          <?lsmb ELSE ?>
           <th colspan=7 align=right>Subtotal</th>
           <td colspan=2 align=right><?lsmb subtotal ?></td>
-          <?lsmb end taxincluded ?>
+          <?lsmb END ?>
         </tr>
 
-        <?lsmb foreach tax ?>
+        <?lsmb FOREACH tax ?>
+	<?lsmb loop_count = loop.count - 1 ?>
         <tr>
-          <th colspan=7 align=right><?lsmb taxdescription ?> on <?lsmb taxbase ?> @ <?lsmb taxrate ?> %</th>
-          <td colspan=2 align=right><?lsmb tax ?></td>
+          <th colspan=7 align=right><?lsmb taxdescription.${loop_count} ?> on <?lsmb taxbase.${loop_count} ?> @ <?lsmb taxrate.${loop_count} ?> %</th>
+          <td colspan=2 align=right><?lsmb tax.${loop_count} ?></td>
         </tr>
-        <?lsmb end tax ?>
+        <?lsmb END ?>
 
-        <?lsmb if paid ?>
+        <?lsmb IF paid ?>
         <tr>
           <th colspan=7 align=right>Paid</th>
           <td colspan=2 align=right>- <?lsmb paid ?></td>
         </tr>
-        <?lsmb end paid ?>
+        <?lsmb END ?>
 
         <tr>
           <td colspan=5>&nbsp;</td>
           <td colspan=4><hr noshade></td>
         </tr>
 
-        <?lsmb if total ?>
+        <?lsmb IF total ?>
         <tr>
           <td colspan=5>&nbsp;</td>
           <th colspan=2 align=right nowrap>Balance Due</th>
           <th colspan=2 align=right><?lsmb total ?></th>
         </tr>
-        <?lsmb end total ?>
+        <?lsmb END ?>
 
         <tr>
       </table>
@@ -209,9 +209,9 @@
     <td>
       <table width="100%">
         <tr valign=top>
-          <?lsmb if notes ?>
+          <?lsmb IF notes ?>
           <td><?lsmb notes ?></td>
-          <?lsmb end notes ?>
+          <?lsmb END ?>
 
 	  <td><?lsmb text_amount ?> ***** <?lsmb decimal ?>/100</td>
 	  
@@ -223,7 +223,7 @@
     </td>
   </tr>
 
-  <?lsmb if paid_1 ?>
+  <?lsmb IF paid_1 ?>
   <tr>
     <td>&nbsp;</td>
 
@@ -246,22 +246,23 @@
           <th align=left>Source</th>
           <th align=left>Amount</th>
         </tr>
-  <?lsmb end paid_1 ?>
+  <?lsmb END ?>
 
-        <?lsmb foreach payment ?>
+        <?lsmb FOREACH payment ?>
+	<?lsmb loop_count = loop.count - 1 ?>
         <tr>
-          <td><?lsmb paymentdate ?></td>
-          <td><?lsmb paymentaccount ?></td>
-          <td><?lsmb paymentsource ?></td>
-          <td><?lsmb payment ?></td>
+          <td><?lsmb paymentdate.${loop_count} ?></td>
+          <td><?lsmb paymentaccount.${loop_count} ?></td>
+          <td><?lsmb paymentsource.${loop_count} ?></td>
+          <td><?lsmb payment.${loop_count} ?></td>
         </tr>
-        <?lsmb end payment ?>
+        <?lsmb END ?>
 
-  <?lsmb if paid_1 ?>
+  <?lsmb IF paid_1 ?>
       </table>
     </td>
   </tr>
-  <?lsmb end paid_1 ?>
+  <?lsmb END ?>
 
   <tr height=10></tr>
 
@@ -293,15 +294,16 @@
     </td>
   </tr>
 
-  <?lsmb foreach tax ?>
+  <?lsmb FOREACH tax ?>
+  <?lsmb loop_count = loop.count - 1 ?>
   <tr>
     <td>&nbsp;</td>
 
-    <th colspan=9 align=left><font size=-2><?lsmb taxdescription ?> Registration <?lsmb taxnumber ?></th>
+    <th colspan=9 align=left><font size=-2><?lsmb taxdescription.${loop_count} ?> Registration <?lsmb taxnumber.${loop_count} ?></th>
   </tr>
-  <?lsmb end tax ?>
+  <?lsmb END ?>
 
-  <?lsmb if taxincluded ?>
+  <?lsmb IF taxincluded ?>
   <tr>
     <td>&nbsp;</td>
   </tr>
@@ -309,7 +311,7 @@
   <tr>
     <th colspan=8 align=left><font size=-2>Taxes shown are included in price.</th>
   </tr>
-  <?lsmb end taxincluded ?>
+  <?lsmb END ?>
 
 </table>
 

Modified: trunk/templates/demo/packing_list.html
===================================================================
--- trunk/templates/demo/packing_list.html	2007-04-03 15:12:46 UTC (rev 1022)
+++ trunk/templates/demo/packing_list.html	2007-04-04 02:35:26 UTC (rev 1023)
@@ -3,7 +3,7 @@
 
 <table width="100%">
 
-  <?lsmb include letterhead.html ?>
+  <?lsmb INCLUDE letterhead.html ?>
   
   <tr>
     <td width=10>&nbsp;</td> 
@@ -26,31 +26,31 @@
 	<tr valign=top>
 	  <td><?lsmb shiptoname ?>
 	  <br><?lsmb shiptoaddress1 ?>
-	  <?lsmb if shiptoaddress2 ?>
+	  <?lsmb IF shiptoaddress2 ?>
 	  <br><?lsmb shiptoaddress2 ?>
-	  <?lsmb end shiptoaddress2 ?>
+	  <?lsmb END ?>
 	  <br><?lsmb shiptocity ?>
-	  <?lsmb if shiptostate ?>
+	  <?lsmb IF shiptostate ?>
 	  , <?lsmb shiptostate ?>
-	  <?lsmb end shiptostate ?>
+	  <?lsmb END ?>
 	  <?lsmb shiptozipcode ?>
-	  <?lsmb if shiptocountry ?>
+	  <?lsmb IF shiptocountry ?>
 	  <br><?lsmb shiptocountry ?>
-	  <?lsmb end shiptocountry ?>
+	  <?lsmb END ?>
 	  </td>
 	
 	  <td>
-	  <?lsmb if shiptocontact ?>
+	  <?lsmb IF shiptocontact ?>
 	  <br>Attn: <?lsmb shiptocontact ?>
-	  <?lsmb end shiptocontact ?>
+	  <?lsmb END ?>
 	  
-	  <?lsmb if shiptophone ?>
+	  <?lsmb IF shiptophone ?>
 	  <br>Tel: <?lsmb shiptophone ?>
-	  <?lsmb end shiptophone ?>
+	  <?lsmb END ?>
 	  
-	  <?lsmb if shiptofax ?>
+	  <?lsmb IF shiptofax ?>
 	  <br>Fax: <?lsmb shiptofax ?>
-	  <?lsmb end shiptofax ?>
+	  <?lsmb END ?>
 
 	  <?lsmb shiptoemail ?>
 	  </td>
@@ -71,9 +71,9 @@
 	  <th width=17% align=left>Order #</th>
 	  <th width=17% align=left>Date</th>
 	  <th width=17% align=left nowrap>Contact</th>
-	  <?lsmb if warehouse ?>
+	  <?lsmb IF warehouse ?>
 	  <th width=17% align=left>Warehouse</th>
-	  <?lsmb end warehouse ?>
+	  <?lsmb END ?>
 	  <th width=17% align=left>Shipping Point</th>
 	  <th width=15% align=left>Ship via</th>
 	</tr>
@@ -82,19 +82,17 @@
 	  <td><?lsmb invnumber ?>&nbsp;</td>
 	  <td><?lsmb ordnumber ?>&nbsp;</td>
 	  
-	  <?lsmb if shippingdate ?>
+	  <?lsmb IF shippingdate ?>
 	  <td><?lsmb shippingdate ?></td>
-	  <?lsmb end shippingdate ?>
-	  
-	  <?lsmb if not shippingdate ?>
+	  <?lsmb ELSE ?>
 	  <td><?lsmb transdate ?></td>
-	  <?lsmb end shippingdate ?>
+	  <?lsmb END ?>
   
           <td><?lsmb employee ?>&nbsp;</td>
 	  
-	  <?lsmb if warehouse ?>
+	  <?lsmb IF warehouse ?>
 	  <td><?lsmb warehouse ?>&nbsp;</td>
-	  <?lsmb end warehouse ?>
+	  <?lsmb END ?>
 
 	  <td><?lsmb shippingpoint ?>&nbsp;</td>
 	  <td><?lsmb shipvia ?>&nbsp;</td>
@@ -119,18 +117,19 @@
 	  <th>&nbsp;</th>
 	</tr>
 
-	<?lsmb foreach number ?>
+	<?lsmb FOREACH number ?>
+	<?lsmb loop_count = loop.count - 1 ?>
 	<tr valign=top>
-	  <td><?lsmb runningnumber ?></td>
-	  <td><?lsmb number ?></td>
-	  <td><?lsmb description ?></td>
-	  <td><?lsmb serialnumber ?></td>
-	  <td><?lsmb deliverydate ?></td>
-	  <td align=right><?lsmb qty ?></td>
-	  <td align=right><?lsmb ship ?></td>
-	  <td><?lsmb unit ?></td>
+	  <td><?lsmb runningnumber.${loop_count} ?></td>
+	  <td><?lsmb number.${loop_count} ?></td>
+	  <td><?lsmb description.${loop_count} ?></td>
+	  <td><?lsmb serialnumber.${loop_count} ?></td>
+	  <td><?lsmb deliverydate.${loop_count} ?></td>
+	  <td align=right><?lsmb qty.${loop_count} ?></td>
+	  <td align=right><?lsmb ship.${loop_count} ?></td>
+	  <td><?lsmb unit.${loop_count} ?></td>
 	</tr>
-	<?lsmb end number ?>
+	<?lsmb END ?>
 
       </table>
     </td>
@@ -142,7 +141,7 @@
     <td><hr noshade></td>
   </tr>
 
-  <?lsmb if notes ?>
+  <?lsmb IF notes ?>
   <tr>
     <td>&nbsp;</td>
     
@@ -155,7 +154,7 @@
       </table>
     </td>
   </tr>
-  <?lsmb end notes ?>
+  <?lsmb END ?>
 
   <tr>
     <td>&nbsp;</td>

Modified: trunk/templates/demo/pick_list.html
===================================================================
--- trunk/templates/demo/pick_list.html	2007-04-03 15:12:46 UTC (rev 1022)
+++ trunk/templates/demo/pick_list.html	2007-04-04 02:35:26 UTC (rev 1023)
@@ -3,7 +3,7 @@
 
 <table width="100%">
 
-  <?lsmb include letterhead.html ?>
+  <?lsmb INCLUDE letterhead.html ?>
 
   <tr>
     <td width=10>&nbsp;</td>
@@ -26,31 +26,31 @@
 	<tr valign=top>
 	  <td><?lsmb shiptoname ?>
 	  <br><?lsmb shiptoaddress1 ?>
-	  <?lsmb if shiptoaddress2 ?>
+	  <?lsmb IF shiptoaddress2 ?>
 	  <br><?lsmb shiptoaddress2 ?>
-	  <?lsmb end shiptoaddress2 ?>
+	  <?lsmb END ?>
 	  <br><?lsmb shiptocity ?>
-	  <?lsmb if shiptostate ?>
+	  <?lsmb IF shiptostate ?>
 	  , <?lsmb shiptostate ?>
-	  <?lsmb end shiptostate ?>
+	  <?lsmb END ?>
 	  <?lsmb shiptozipcode ?>
-	  <?lsmb if shiptocountry ?>
+	  <?lsmb IF shiptocountry ?>
 	  <br><?lsmb shiptocountry ?>
-	  <?lsmb end shiptocountry ?>
+	  <?lsmb END ?>
 	  </td>
 
 	  <td>
-	  <?lsmb if shiptocontact ?>
+	  <?lsmb IF shiptocontact ?>
 	  <br>Attn: <?lsmb shiptocontact ?>
-	  <?lsmb end shiptocontact ?>
+	  <?lsmb END ?>
 
-	  <?lsmb if shiptophone ?>
+	  <?lsmb IF shiptophone ?>
 	  <br>Tel: <?lsmb shiptophone ?>
-	  <?lsmb end shiptophone ?>
+	  <?lsmb END ?>
 
-	  <?lsmb if shiptofax ?>
+	  <?lsmb IF shiptofax ?>
 	  <br>Fax: <?lsmb shiptofax ?>
-	  <?lsmb end shiptofax ?>
+	  <?lsmb END ?>
 
 	  <?lsmb shiptoemail ?>
 	  </td>
@@ -79,13 +79,11 @@
         <tr>
 	  <td><?lsmb invnumber ?>&nbsp;</td>
 	  <td><?lsmb ordnumber ?>&nbsp;</td>
-          <?lsmb if shippingdate ?>
+          <?lsmb IF shippingdate ?>
 	  <td><?lsmb shippingdate ?></td>
-          <?lsmb end shippingdate ?>
-
-	  <?lsmb if not shippingdate ?>
+          <?lsmb ELSE ?>
 	  <td><?lsmb transdate ?></td>
-	  <?lsmb end shippingdate ?>
+	  <?lsmb END ?>
 
 	  <td><?lsmb employee ?>&nbsp;</td>
 	  <td><?lsmb warehouse ?>&nbsp;</td>
@@ -111,17 +109,18 @@
 	  <th><font color=ffffff>Bin</th>
 	</tr>
 
-        <?lsmb foreach number ?>
+        <?lsmb FOREACH number ?>
+	<?lsmb loop_count = loop.count - 1 ?>
 	<tr valign=top>
-	  <td><?lsmb runningnumber ?>
-	  <td><?lsmb number ?></td>
-	  <td><?lsmb description ?></td>
-	  <td align=right><?lsmb qty ?></td>
+	  <td><?lsmb runningnumber.${loop_count} ?></td>
+	  <td><?lsmb number.${loop_count} ?></td>
+	  <td><?lsmb description.${loop_count} ?></td>
+	  <td align=right><?lsmb qty.${loop_count} ?></td>
 	  <td align=right>[&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;]</td>
-	  <td><?lsmb unit ?></td>
-	  <td align=right><?lsmb bin ?></td>
+	  <td><?lsmb unit.${loop_count} ?></td>
+	  <td align=right><?lsmb bin.${loop_count} ?></td>
 	</tr>
-	<?lsmb end number ?>
+	<?lsmb END ?>
       </table>
     </td>
   </tr>

Modified: trunk/templates/demo/purchase_order.html
===================================================================
--- trunk/templates/demo/purchase_order.html	2007-04-03 15:12:46 UTC (rev 1022)
+++ trunk/templates/demo/purchase_order.html	2007-04-04 02:35:26 UTC (rev 1023)
@@ -3,7 +3,7 @@
 
 <table width="100%">
 
-  <?lsmb include letterhead.html ?>
+  <?lsmb INCLUDE letterhead.html ?>
   
   <tr>
     <td width=10>&nbsp;</td>
@@ -26,58 +26,58 @@
 	<tr valign=top>
 	  <td><?lsmb name ?>
 	  <br><?lsmb address1 ?>
-	  <?lsmb if address2 ?>
+	  <?lsmb IF address2 ?>
 	  <br><?lsmb address2 ?>
-	  <?lsmb end address2 ?>
+	  <?lsmb END ?>
 	  <br><?lsmb city ?>
-	  <?lsmb if state ?>
+	  <?lsmb IF state ?>
 	  , <?lsmb state ?>
-	  <?lsmb end state ?>
+	  <?lsmb END ?>
 	  <?lsmb zipcode ?>
-	  <?lsmb if country ?>
+	  <?lsmb IF country ?>
 	  <br><?lsmb country ?>
-	  <?lsmb end country ?>
+	  <?lsmb END ?>
           <br>
 
-	  <?lsmb if contact ?>
+	  <?lsmb IF contact ?>
 	  <br>Attn: <?lsmb contact ?>
-	  <?lsmb end contact ?>
+	  <?lsmb END ?>
 	  
-	  <?lsmb if vendorphone ?>
+	  <?lsmb IF vendorphone ?>
 	  <br>Tel: <?lsmb vendorphone ?>
-	  <?lsmb end vendorphone ?>
+	  <?lsmb END ?>
 	  
-	  <?lsmb if vendorfax ?>
+	  <?lsmb IF vendorfax ?>
 	  <br>Fax: <?lsmb vendorfax ?>
-	  <?lsmb end vendorfax ?>
+	  <?lsmb END ?>
 	  </td>
 
 	  <td><?lsmb shiptoname ?>
 	  <br><?lsmb shiptoaddress1 ?>
-	  <?lsmb if shiptoaddress2 ?>
+	  <?lsmb IF shiptoaddress2 ?>
 	  <br><?lsmb shiptoaddress2 ?>
-	  <?lsmb end shiptoaddress2 ?>
+	  <?lsmb END ?>
 	  <br><?lsmb shiptocity ?>
-	  <?lsmb if shiptostate ?>
+	  <?lsmb IF shiptostate ?>
 	  , <?lsmb shiptostate ?>
-	  <?lsmb end shiptostate ?>
+	  <?lsmb END ?>
 	  <?lsmb shiptozipcode ?>
-	  <?lsmb if shiptocountry ?>
+	  <?lsmb IF shiptocountry ?>
 	  <br><?lsmb shiptocountry ?>
-	  <?lsmb end shiptocountry ?>
+	  <?lsmb END ?>
           <br>
 
-	  <?lsmb if shiptocontact ?>
+	  <?lsmb IF shiptocontact ?>
 	  <br>Attn: <?lsmb shiptocontact ?>
-	  <?lsmb end shiptocontact ?>
+	  <?lsmb END ?>
 	  
-	  <?lsmb if shiptophone ?>
+	  <?lsmb IF shiptophone ?>
 	  <br>Tel: <?lsmb shiptophone ?>
-	  <?lsmb end shiptophone ?>
+	  <?lsmb END ?>
 	  
-	  <?lsmb if shiptofax ?>
+	  <?lsmb IF shiptofax ?>
 	  <br>Fax: <?lsmb shiptofax ?>
-	  <?lsmb end shiptofax ?>
+	  <?lsmb END ?>
 	  </td>
 	</tr>
       </table>
@@ -126,83 +126,83 @@
 	  <th><font color=ffffff>Amount</th>
 	</tr>
 
-        <?lsmb foreach number ?>
+        <?lsmb FOREACH number ?>
+	<?lsmb loop_count = loop.count - 1 ?>
 	<tr valign=top>
-	  <td align=right><?lsmb runningnumber ?>.</td>
-	  <td><?lsmb number ?></td>
-	  <td><?lsmb description ?></td>
-	  <td align=right><?lsmb qty ?></td>
-	  <td><?lsmb unit ?></td>
-	  <td align=right><?lsmb sellprice ?></td>
-	  <td align=right><?lsmb discountrate ?></th>
-	  <td align=right><?lsmb linetotal ?></td>
+	  <td align=right><?lsmb runningnumber.${loop_count} ?>.</td>
+	  <td><?lsmb number.${loop_count} ?></td>
+	  <td><?lsmb description.${loop_count} ?></td>
+	  <td align=right><?lsmb qty.${loop_count} ?></td>
+	  <td><?lsmb unit.${loop_count} ?></td>
+	  <td align=right><?lsmb sellprice.${loop_count} ?></td>
+	  <td align=right><?lsmb discountrate.${loop_count} ?></th>
+	  <td align=right><?lsmb linetotal.${loop_count} ?></td>
 	</tr>
-        <?lsmb end number ?>
+        <?lsmb END ?>
 
 	<tr>
 	  <td colspan=8><hr noshade></td>
 	</tr>
 	
 	<tr>
-          <?lsmb if taxincluded ?>
+          <?lsmb IF taxincluded ?>
 	  <th colspan=7 align=right>Total</th>
 	  <th colspan=1 align=right><?lsmb ordtotal ?></th>
-          <?lsmb end taxincluded ?>
-	 
-          <?lsmb if not taxincluded ?>
+          <?lsmb ELSE ?>
 	  <th colspan=7 align=right>Subtotal</th>
 	  <td colspan=1 align=right><?lsmb subtotal ?></td>
-          <?lsmb end taxincluded ?>
+          <?lsmb END ?>
 	</tr>
 
-        <?lsmb foreach tax ?>
+        <?lsmb FOREACH tax ?>
+	<?lsmb loop_count = loop.count - 1 ?>
 	<tr>
-	  <th colspan=7 align=right><?lsmb taxdescription ?> on <?lsmb taxbase ?> @ <?lsmb taxrate ?> %</th>
-	  <td colspan=1 align=right><?lsmb tax ?></td>
+	  <th colspan=7 align=right><?lsmb taxdescription.${loop_count} ?> on <?lsmb taxbase.${loop_count} ?> @ <?lsmb taxrate.${loop_count} ?> %</th>
+	  <td colspan=1 align=right><?lsmb tax.${loop_count} ?></td>
 	</tr>
-        <?lsmb end tax ?>
+        <?lsmb END ?>
 
 	<tr>
 	  <td colspan=4>&nbsp;</td>
 	  <td colspan=4><hr noshade></td>
 	</tr>
 	
-        <?lsmb if not taxincluded ?>
+        <?lsmb IF NOT taxincluded ?>
 	  <th colspan=7 align=right>Total</th>
 	  <td colspan=1 align=right><?lsmb ordtotal ?></td>
-        <?lsmb end taxincluded ?>
+        <?lsmb END ?>
 
-        <?lsmb if terms ?>
+        <?lsmb IF terms ?>
 	<tr>
 	  <td colspan=4>Terms Net <b><?lsmb terms ?></b> days</td>
 	  <th colspan=3 align=right>Total</th>
 	  <th colspan=1 align=right><?lsmb ordtotal ?></th>
 	</tr>
-        <?lsmb end terms ?>
+        <?lsmb END ?>
 
-        <?lsmb if taxincluded ?>
+        <?lsmb IF taxincluded ?>
 	<tr>
 	  <td colspan=2>Tax included</td>
 	</tr>
-        <?lsmb end taxincluded ?>
+        <?lsmb END ?>
 
 	<tr>
 	  <td>&nbsp;</td>
 	</tr>
 	
-        <?lsmb if ordtotal ?>
+        <?lsmb IF ordtotal ?>
 	<tr>
 	  <td colspan=8 align=right>
 	  All prices in <b><?lsmb currency ?></b> Funds
 	  </td>
 	</tr>
-        <?lsmb end ordtotal ?>
+        <?lsmb END ?>
 
       </table>
     </td>
   </tr>
 
-  <?lsmb if notes ?>
+  <?lsmb IF notes ?>
   <tr>
     <td>&nbsp;</td>
     
@@ -216,7 +216,7 @@
     </table>
     </td>
   </tr>
-  <?lsmb end notes ?>
+  <?lsmb END ?>
 
   <tr>
     <td>&nbsp;</td>

Modified: trunk/templates/demo/request_quotation.html
===================================================================
--- trunk/templates/demo/request_quotation.html	2007-04-03 15:12:46 UTC (rev 1022)
+++ trunk/templates/demo/request_quotation.html	2007-04-04 02:35:26 UTC (rev 1023)
@@ -3,7 +3,7 @@
 
 <table width="100%">
 
-  <?lsmb include letterhead.html ?>
+  <?lsmb INCLUDE letterhead.html ?>
   
   <tr>
     <td width=10>&nbsp;</td>
@@ -26,58 +26,58 @@
 	<tr valign=top>
 	  <td><?lsmb name ?>
 	  <br><?lsmb address1 ?>
-	  <?lsmb if address2 ?>
+	  <?lsmb IF address2 ?>
 	  <br><?lsmb address2 ?>
-	  <?lsmb end address2 ?>
+	  <?lsmb END ?>
 	  <br><?lsmb city ?>
-	  <?lsmb if state ?>
+	  <?lsmb IF state ?>
 	  , <?lsmb state ?>
-	  <?lsmb end state ?>
+	  <?lsmb END ?>
 	  <?lsmb zipcode ?>
-	  <?lsmb if country ?>
+	  <?lsmb IF country ?>
 	  <br><?lsmb country ?>
-	  <?lsmb end country ?>
+	  <?lsmb END ?>
           <br>
 	  
-	  <?lsmb if contact ?>
+	  <?lsmb IF contact ?>
 	  <br>Attn: <?lsmb contact ?>
-	  <?lsmb end contact ?>
+	  <?lsmb END ?>
 	  
-	  <?lsmb if vendorphone ?>
+	  <?lsmb IF vendorphone ?>
 	  <br>Tel: <?lsmb vendorphone ?>
-	  <?lsmb end vendorphone ?>
+	  <?lsmb END ?>
 	  
-	  <?lsmb if vendorfax ?>
+	  <?lsmb IF vendorfax ?>
 	  <br>Fax: <?lsmb vendorfax ?>
-	  <?lsmb end vendorfax ?>
+	  <?lsmb END ?>
 	  </td>
 
 	  <td><?lsmb shiptoname ?>
 	  <br><?lsmb shiptoaddress1 ?>
-	  <?lsmb if shiptoaddress2 ?>
+	  <?lsmb IF shiptoaddress2 ?>
 	  <br><?lsmb shiptoaddr2 ?>
-	  <?lsmb end shiptoaddress2 ?>
+	  <?lsmb END ?>
 	  <br><?lsmb shiptocity ?>
-	  <?lsmb if shiptostate ?>
+	  <?lsmb IF shiptostate ?>
 	  , <?lsmb shiptostate ?>
-	  <?lsmb end shiptostate ?>
+	  <?lsmb END ?>
 	  <?lsmb shiptozipcode ?>
-	  <?lsmb if shiptocountry ?>
+	  <?lsmb IF shiptocountry ?>
 	  <br><?lsmb shiptocountry ?>
-	  <?lsmb end shiptocountry ?>
+	  <?lsmb END ?>
           <br>
 
-	  <?lsmb if shiptocontact ?>
+	  <?lsmb IF shiptocontact ?>
 	  <br>Attn: <?lsmb shiptocontact ?>
-	  <?lsmb end shiptocontact ?>
+	  <?lsmb END ?>
 	  
-	  <?lsmb if shiptophone ?>
+	  <?lsmb IF shiptophone ?>
 	  <br>Tel: <?lsmb shiptophone ?>
-	  <?lsmb end shiptophone ?>
+	  <?lsmb END ?>
 	  
-	  <?lsmb if shiptofax ?>
+	  <?lsmb IF shiptofax ?>
 	  <br>Fax: <?lsmb shiptofax ?>
-	  <?lsmb end shiptofax ?>
+	  <?lsmb END ?>
 	  </td>
 	</tr>
       </table>
@@ -138,15 +138,16 @@
 	  <th>Extended</th>
 	</tr>
 
-        <?lsmb foreach number ?>
+        <?lsmb FOREACH number ?>
+	<?lsmb loop_count = loop.count - 1 ?>
         <tr valign=top>
-          <td align=right><?lsmb runningnumber ?>.</td>
-	  <td><?lsmb number ?></td>
-	  <td><?lsmb description ?></td>
-	  <td align=right><?lsmb qty ?></td>
-	  <td><?lsmb unit ?></td>
+          <td align=right><?lsmb runningnumber.${loop_count} ?>.</td>
+	  <td><?lsmb number.${loop_count} ?></td>
+	  <td><?lsmb description.${loop_count} ?></td>
+	  <td align=right><?lsmb qty.${loop_count} ?></td>
+	  <td><?lsmb unit.${loop_count} ?></td>
 	</tr>
-	<?lsmb end number ?>
+	<?lsmb END ?>
 
 	<tr>
 	  <td colspan=8><hr noshade></td>
@@ -156,7 +157,7 @@
     </td>
   </tr>
 
-  <?lsmb if notes ?>
+  <?lsmb IF notes ?>
   <tr>
     <td>&nbsp;</td>
     
@@ -170,7 +171,7 @@
       </table>
     </td>
   </tr>
-  <?lsmb end notes ?>
+  <?lsmb END ?>
 
 </table>
 

Modified: trunk/templates/demo/sales_order.html
===================================================================
--- trunk/templates/demo/sales_order.html	2007-04-03 15:12:46 UTC (rev 1022)
+++ trunk/templates/demo/sales_order.html	2007-04-04 02:35:26 UTC (rev 1023)
@@ -3,7 +3,7 @@
 
 <table width="100%">
 
-  <?lsmb include letterhead.html ?>
+  <?lsmb INCLUDE letterhead.html ?>
   
   <tr>
     <td width=10>&nbsp;</td>
@@ -26,58 +26,58 @@
 	<tr valign=top>
 	  <td><?lsmb name ?>
 	  <br><?lsmb address1 ?>
-	  <?lsmb if address2 ?>
+	  <?lsmb IF address2 ?>
 	  <br><?lsmb address2 ?>
-	  <?lsmb end address2 ?>
+	  <?lsmb END ?>
 	  <br><?lsmb city ?>
-	  <?lsmb if state ?>
+	  <?lsmb IF state ?>
 	  , <?lsmb state ?>
-	  <?lsmb end state ?>
+	  <?lsmb END ?>
           <?lsmb zipcode ?>
-	  <?lsmb if country ?>
+	  <?lsmb IF country ?>
 	  <br><?lsmb country ?>
-	  <?lsmb end country ?>
+	  <?lsmb END ?>
           <br>
-	  <?lsmb if contact ?>
+	  <?lsmb IF contact ?>
 	  <br>Attn: <?lsmb contact ?>
-	  <?lsmb end contact ?>
-	  <?lsmb if customerphone ?>
+	  <?lsmb END ?>
+	  <?lsmb IF customerphone ?>
 	  <br>Tel: <?lsmb customerphone ?>
-	  <?lsmb end customerphone ?>
-	  <?lsmb if customerfax ?>
+	  <?lsmb END ?>
+	  <?lsmb IF customerfax ?>
 	  <br>Fax: <?lsmb customerfax ?>
-	  <?lsmb end customerfax ?>
-	  <?lsmb if email ?>
+	  <?lsmb END ?>
+	  <?lsmb IF email ?>
 	  <br><?lsmb email ?>
-	  <?lsmb end email ?>
+	  <?lsmb END ?>
 	  </td>
 
 	  <td><?lsmb shiptoname ?>
 	  <br><?lsmb shiptoaddress1 ?>
-	  <?lsmb if shiptoaddress2 ?>
+	  <?lsmb IF shiptoaddress2 ?>
 	  <br><?lsmb shiptoaddress2 ?>
-	  <?lsmb end shiptoaddress2 ?>
+	  <?lsmb END ?>
 	  <br><?lsmb shiptocity ?>
-	  <?lsmb if shiptostate ?>
+	  <?lsmb IF shiptostate ?>
 	  , <?lsmb shiptostate ?>
-	  <?lsmb end shiptostate ?>
+	  <?lsmb END ?>
           <?lsmb shiptozipcode ?>
-	  <?lsmb if shiptocountry ?>
+	  <?lsmb IF shiptocountry ?>
 	  <br><?lsmb shiptocountry ?>
-	  <?lsmb end shiptocountry ?>
+	  <?lsmb END ?>
 	  <br>
-          <?lsmb if shiptocontact ?>
+          <?lsmb IF shiptocontact ?>
           <br><?lsmb shiptocontact ?>
-          <?lsmb end shiptocontact ?>
-	  <?lsmb if shiptophone ?>
+          <?lsmb END ?>
+	  <?lsmb IF shiptophone ?>
 	  <br>Tel: <?lsmb shiptophone ?>
-	  <?lsmb end shiptophone ?>
-	  <?lsmb if shiptofax ?>
+	  <?lsmb END ?>
+	  <?lsmb IF shiptofax ?>
 	  <br>Fax: <?lsmb shiptofax ?>
-	  <?lsmb end shiptofax ?>
-	  <?lsmb if shiptoemail ?>
+	  <?lsmb END ?>
+	  <?lsmb IF shiptoemail ?>
 	  <br><?lsmb shiptoemail ?>
-	  <?lsmb end shiptoemail ?>
+	  <?lsmb END ?>
 	  </td>
 	</tr>
       </table>
@@ -128,41 +128,41 @@
 	  <th><font color=ffffff>Amount</th>
 	</tr>
 
-	<?lsmb foreach number ?>
+	<?lsmb FOREACH number ?>
+	<?lsmb loop_count = loop.count - 1 ?>
 	<tr valign=top>
-          <td align=right><?lsmb runningnumber ?>.</td>
-	  <td><?lsmb number ?></td>
-	  <td><?lsmb description ?></td>
-	  <td align=right><?lsmb qty ?></td>
-	  <td><?lsmb unit ?></td>
-	  <td align=right><?lsmb sellprice ?></td>
-	  <td align=right><?lsmb discountrate ?></td>
-	  <td align=right><?lsmb linetotal ?></td>
+          <td align=right><?lsmb runningnumber.${loop_count} ?>.</td>
+	  <td><?lsmb number.${loop_count} ?></td>
+	  <td><?lsmb description.${loop_count} ?></td>
+	  <td align=right><?lsmb qty.${loop_count} ?></td>
+	  <td><?lsmb unit.${loop_count} ?></td>
+	  <td align=right><?lsmb sellprice.${loop_count} ?></td>
+	  <td align=right><?lsmb discountrate.${loop_count} ?></td>
+	  <td align=right><?lsmb linetotal.${loop_count} ?></td>
 	</tr>
-	<?lsmb end number ?>
+	<?lsmb END ?>
 
 	<tr>
 	  <td colspan=8><hr noshade></td>
 	</tr>
 	
 	<tr>
-	  <?lsmb if taxincluded ?>
+	  <?lsmb IF taxincluded ?>
 	  <th colspan=6 align=right>Total</th>
 	  <td colspan=2 align=right><?lsmb invtotal ?></td>
-	  <?lsmb end taxincluded ?>
-
-	  <?lsmb if not taxincluded ?>
+	  <?lsmb ELSE ?>
 	  <th colspan=6 align=right>Subtotal</th>
 	  <td colspan=2 align=right><?lsmb subtotal ?></td>
-	  <?lsmb end taxincluded ?>
+	  <?lsmb END ?>
 	</tr>
 
-	<?lsmb foreach tax ?>
+	<?lsmb FOREACH tax ?>
+	<?lsmb loop_count = loop.count - 1 ?>
 	<tr>
-	  <th colspan=6 align=right><?lsmb taxdescription ?> on <?lsmb taxbase ?> @ <?lsmb taxrate ?> %</th>
-	  <td colspan=2 align=right><?lsmb tax ?></td>
+	  <th colspan=6 align=right><?lsmb taxdescription.${loop_count} ?> on <?lsmb taxbase.${loop_count} ?> @ <?lsmb taxrate.${loop_count} ?> %</th>
+	  <td colspan=2 align=right><?lsmb tax.${loop_count} ?></td>
 	</tr>
-	<?lsmb end tax ?>
+	<?lsmb END ?>
 
 	<tr>
 	  <td colspan=4>&nbsp;</td>
@@ -172,9 +172,9 @@
 	<tr>
 	  <td colspan=4>
           <?lsmb text_amount ?> ***** <?lsmb decimal ?>/100
-	  <?lsmb if terms ?>
+	  <?lsmb IF terms ?>
 	  <br>Terms Net <b><?lsmb terms ?></b> days
-	  <?lsmb end terms ?>
+	  <?lsmb END ?>
 	  </td>
 	  <th colspan=2 align=right>Total</th>
 	  <th colspan=2 align=right><?lsmb ordtotal ?></th>
@@ -194,10 +194,10 @@
     <td>
       <table width="100%">
 	<tr valign=top>
-	  <?lsmb if notes ?>
+	  <?lsmb IF notes ?>
 	  <td>Notes</td>
 	  <td><?lsmb notes ?></td>
-	  <?lsmb end notes ?>
+	  <?lsmb END ?>
 	  <td align=right nowrap>
 	  All prices in <?lsmb currency ?> Funds</b>
 	  </td>

Modified: trunk/templates/demo/sales_quotation.html
===================================================================
--- trunk/templates/demo/sales_quotation.html	2007-04-03 15:12:46 UTC (rev 1022)
+++ trunk/templates/demo/sales_quotation.html	2007-04-04 02:35:26 UTC (rev 1023)
@@ -3,7 +3,7 @@
 
 <table width="100%">
 
-  <?lsmb include letterhead.html ?>
+  <?lsmb INCLUDE letterhead.html ?>
   
   <tr>
     <td width=10>&nbsp;</td>
@@ -22,34 +22,34 @@
 	<tr valign=top>
 	  <td><?lsmb name ?>
 	  <br><?lsmb address1 ?>
-	  <?lsmb if address2 ?>
+	  <?lsmb IF address2 ?>
 	  <br><?lsmb address2 ?>
-	  <?lsmb end address2 ?>
+	  <?lsmb END ?>
 	  <br><?lsmb city ?>
-	  <?lsmb if state ?>
+	  <?lsmb IF state ?>
 	  , <?lsmb state ?>
-	  <?lsmb end state ?>
+	  <?lsmb END ?>
 	  <?lsmb zipcode ?>
-	  <?lsmb if country ?>
+	  <?lsmb IF country ?>
 	  <br><?lsmb country ?>
-	  <?lsmb end country ?>
+	  <?lsmb END ?>
 
 	  <br>
-	  <?lsmb if contact ?>
+	  <?lsmb IF contact ?>
 	  <br>Attn: <?lsmb contact ?>
-	  <?lsmb end contact ?>
+	  <?lsmb END ?>
 
-	  <?lsmb if customerphone ?>
+	  <?lsmb IF customerphone ?>
 	  <br>Tel: <?lsmb customerphone ?>
-	  <?lsmb end customerphone ?>
+	  <?lsmb END ?>
 
-	  <?lsmb if customerfax ?>
+	  <?lsmb IF customerfax ?>
 	  <br>Fax: <?lsmb customerfax ?>
-	  <?lsmb end customerfax ?>
+	  <?lsmb END ?>
 
-	  <?lsmb if email ?>
+	  <?lsmb IF email ?>
 	  <br><?lsmb email ?>
-	  <?lsmb end email ?>
+	  <?lsmb END ?>
 	  </td>
 
 	</tr>
@@ -99,41 +99,41 @@
 	  <th><font color=ffffff>Amount</th>
 	</tr>
 
-        <?lsmb foreach number ?>
+        <?lsmb FOREACH number ?>
+	<?lsmb loop_count = loop.count - 1 ?>
 	<tr valign=top>
-	  <td align=right><?lsmb runningnumber ?></td>
-	  <td><?lsmb number ?></td>
-	  <td><?lsmb description ?></td>
-	  <td align=right><?lsmb qty ?></td>
-	  <td><?lsmb unit ?></td>
-	  <td align=right><?lsmb sellprice ?></td>
-	  <td align=right><?lsmb discountrate ?></td>
-	  <td align=right><?lsmb linetotal ?></td>
+	  <td align=right><?lsmb runningnumber.${loop_count} ?></td>
+	  <td><?lsmb number.${loop_count} ?></td>
+	  <td><?lsmb description.${loop_count} ?></td>
+	  <td align=right><?lsmb qty.${loop_count} ?></td>
+	  <td><?lsmb unit.${loop_count} ?></td>
+	  <td align=right><?lsmb sellprice.${loop_count} ?></td>
+	  <td align=right><?lsmb discountrate.${loop_count} ?></td>
+	  <td align=right><?lsmb linetotal.${loop_count} ?></td>
 	</tr>
-        <?lsmb end number ?>
+        <?lsmb END ?>
 
 	<tr>
 	  <td colspan=8><hr noshade></td>
 	</tr>
 	
 	<tr>
-	  <?lsmb if taxincluded ?>
+	  <?lsmb IF taxincluded ?>
 	  <th colspan=6 align=right>Total</th>
 	  <td colspan=2 align=right><?lsmb invtotal ?></td>
-	  <?lsmb end taxincluded ?>
-
-	  <?lsmb if not taxincluded ?>
+	  <?lsmb ELSE ?>
 	  <th colspan=6 align=right>Subtotal</th>
 	  <td colspan=2 align=right><?lsmb subtotal ?></td>
-	  <?lsmb end taxincluded ?>
+	  <?lsmb END ?>
 	</tr>
 
-	<?lsmb foreach tax ?>
+	<?lsmb FOREACH tax ?>
+	<?lsmb loop_count = loop.count - 1 ?>
 	<tr>
-	  <th colspan=6 align=right><?lsmb taxdescription ?> on <?lsmb taxbase ?> @ <?lsmb taxrate ?> %</th>
-	  <td colspan=2 align=right><?lsmb tax ?></td>
+	  <th colspan=6 align=right><?lsmb taxdescription.${loop_count} ?> on <?lsmb taxbase.${loop_count} ?> @ <?lsmb taxrate.${loop_count} ?> %</th>
+	  <td colspan=2 align=right><?lsmb tax.${loop_count} ?></td>
 	</tr>
-	<?lsmb end tax ?>
+	<?lsmb END ?>
 
 	<tr>
 	  <td colspan=4>&nbsp;</td>
@@ -142,9 +142,9 @@
 
 	<tr>
 	  <td colspan=4>&nbsp;
-	  <?lsmb if terms ?>
+	  <?lsmb IF terms ?>
 	  Terms Net <b><?lsmb terms ?></b> days
-	  <?lsmb end terms ?>
+	  <?lsmb END ?>
 	  </td>
 	  <th colspan=2 align=right>Total</th>
 	  <th colspan=2 align=right><?lsmb quototal ?></th>
@@ -164,10 +164,10 @@
     <td>
       <table width="100%">
 	<tr valign=top>
-          <?lsmb if notes ?>
+          <?lsmb IF notes ?>
 	  <td>Notes</td>
 	  <td><?lsmb notes ?></td>
-          <?lsmb end notes ?>
+          <?lsmb END ?>
 	  <td align=right>
 	  All prices in <b><?lsmb currency ?></b> Funds
 	  </td>

Modified: trunk/templates/demo/statement.html
===================================================================
--- trunk/templates/demo/statement.html	2007-04-03 15:12:46 UTC (rev 1022)
+++ trunk/templates/demo/statement.html	2007-04-04 02:35:26 UTC (rev 1023)
@@ -3,7 +3,7 @@
 
 <table width="100%">
 
-  <?lsmb include letterhead.html ?>
+  <?lsmb INCLUDE letterhead.html ?>
   
   <tr>
     <td width=10>&nbsp;</td>
@@ -26,27 +26,27 @@
 	<tr valign=top>
 	  <td><?lsmb name ?>
 	  <br><?lsmb address1 ?>
-	  <?lsmb if address2 ?>
+	  <?lsmb IF address2 ?>
 	  <br><?lsmb address2 ?>
-	  <?lsmb end address2 ?>
+	  <?lsmb END ?>
 	  <br><?lsmb city ?>
-	  <?lsmb if state ?>
+	  <?lsmb IF state ?>
 	  , <?lsmb state ?>
-	  <?lsmb end state ?>
+	  <?lsmb END ?>
 	  <?lsmb zipcode ?>
-	  <?lsmb if country ?>
+	  <?lsmb IF country ?>
 	  <br><?lsmb country ?>
-	  <?lsmb end country ?>
+	  <?lsmb END ?>
 	  <br>
-          <?lsmb if customerphone ?>
+          <?lsmb IF customerphone ?>
 	  <br>Tel: <?lsmb customerphone ?>
-          <?lsmb end customerphone ?>
-          <?lsmb if customerfax ?>
+          <?lsmb END ?>
+          <?lsmb IF customerfax ?>
 	  <br>Fax: <?lsmb customerfax ?>
-          <?lsmb end customerfax ?>
-          <?lsmb if email ?>
+          <?lsmb END ?>
+          <?lsmb IF email ?>
 	  <br><?lsmb email ?>
-          <?lsmb end email ?>
+          <?lsmb END ?>
 	  </td>
 	</tr>
       </table>
@@ -71,18 +71,19 @@
 	  <th width="10%">90</th>
 	</tr>
         
-	<?lsmb foreach invnumber ?>
+	<?lsmb FOREACH invnumber ?>
+	<?lsmb loop_count = loop.count - 1 ?>
 	<tr>
-	  <td><?lsmb invnumber ?></td>
-          <td><?lsmb ordnumber ?></td>
-	  <td><?lsmb invdate ?></td>
-	  <td><?lsmb duedate ?></td>
-	  <td align=right><?lsmb c0 ?></td>
-	  <td align=right><?lsmb c30 ?></td>
-	  <td align=right><?lsmb c60 ?></td>
-	  <td align=right><?lsmb c90 ?></td>
+	  <td><?lsmb invnumber.${loop_count} ?></td>
+          <td><?lsmb ordnumber.${loop_count} ?></td>
+	  <td><?lsmb invdate.${loop_count} ?></td>
+	  <td><?lsmb duedate.${loop_count} ?></td>
+	  <td align=right><?lsmb c0.${loop_count} ?></td>
+	  <td align=right><?lsmb c30.${loop_count} ?></td>
+	  <td align=right><?lsmb c60.${loop_count} ?></td>
+	  <td align=right><?lsmb c90.${loop_count} ?></td>
 	</tr>
-        <?lsmb end invnumber ?>
+        <?lsmb END ?>
 	
         <tr>
 	  <td colspan=8><hr size=1></td>

Modified: trunk/templates/demo/timecard.html
===================================================================
--- trunk/templates/demo/timecard.html	2007-04-03 15:12:46 UTC (rev 1022)
+++ trunk/templates/demo/timecard.html	2007-04-04 02:35:26 UTC (rev 1023)
@@ -2,7 +2,7 @@
 
 <table width="100%">
 
-  <?lsmb include letterhead.html ?>
+  <?lsmb INCLUDE letterhead.html ?>
   
   <tr>
     <td width=10>&nbsp;</td>
@@ -105,7 +105,7 @@
     </td>
   </tr>
 
-  <?lsmb if notes ?>
+  <?lsmb IF notes ?>
   <tr height=5></tr>
   
   <tr>
@@ -115,7 +115,7 @@
       <?lsmb notes ?>
     </td>
   </tr>
-  <?lsmb end notes ?>
+  <?lsmb END ?>
 
 </table>
 

Modified: trunk/templates/demo/work_order.html
===================================================================
--- trunk/templates/demo/work_order.html	2007-04-03 15:12:46 UTC (rev 1022)
+++ trunk/templates/demo/work_order.html	2007-04-04 02:35:26 UTC (rev 1023)
@@ -3,7 +3,7 @@
 
 <table width="100%">
 
-  <?lsmb include letterhead.html ?>
+  <?lsmb INCLUDE letterhead.html ?>
   
   <tr>
     <td width=10>&nbsp;</td>
@@ -26,58 +26,58 @@
 	<tr valign=top>
 	  <td><?lsmb name ?>
 	  <br><?lsmb address1 ?>
-	  <?lsmb if address2 ?>
+	  <?lsmb IF address2 ?>
 	  <br><?lsmb address2 ?>
-	  <?lsmb end address2 ?>
+	  <?lsmb END ?>
 	  <br><?lsmb city ?>
-	  <?lsmb if state ?>
+	  <?lsmb IF state ?>
 	  , <?lsmb state ?>
-	  <?lsmb end state ?>
+	  <?lsmb END ?>
           <?lsmb zipcode ?>
-	  <?lsmb if country ?>
+	  <?lsmb IF country ?>
 	  <br><?lsmb country ?>
-	  <?lsmb end country ?>
+	  <?lsmb END ?>
           <br>
-	  <?lsmb if contact ?>
+	  <?lsmb IF contact ?>
 	  <br>Attn: <?lsmb contact ?>
-	  <?lsmb end contact ?>
-	  <?lsmb if customerphone ?>
+	  <?lsmb END ?>
+	  <?lsmb IF customerphone ?>
 	  <br>Tel: <?lsmb customerphone ?>
-	  <?lsmb end customerphone ?>
-	  <?lsmb if customerfax ?>
+	  <?lsmb END ?>
+	  <?lsmb IF customerfax ?>
 	  <br>Fax: <?lsmb customerfax ?>
-	  <?lsmb end customerfax ?>
-	  <?lsmb if email ?>
+	  <?lsmb END ?>
+	  <?lsmb IF email ?>
 	  <br><?lsmb email ?>
-	  <?lsmb end email ?>
+	  <?lsmb END ?>
 	  </td>
 
 	  <td><?lsmb shiptoname ?>
 	  <br><?lsmb shiptoaddress1 ?>
-	  <?lsmb if shiptoaddress2 ?>
+	  <?lsmb IF shiptoaddress2 ?>
 	  <br><?lsmb shiptoaddress2 ?>
-	  <?lsmb end shiptoaddress2 ?>
+	  <?lsmb END ?>
 	  <br><?lsmb shiptocity ?>
-	  <?lsmb if shiptostate ?>
+	  <?lsmb IF shiptostate ?>
 	  , <?lsmb shiptostate ?>
-	  <?lsmb end shiptostate ?>
+	  <?lsmb END ?>
           <?lsmb shiptozipcode ?>
-	  <?lsmb if shiptocountry ?>
+	  <?lsmb IF shiptocountry ?>
 	  <br><?lsmb shiptocountry ?>
-	  <?lsmb end shiptocountry ?>
+	  <?lsmb END ?>
 	  <br>
-          <?lsmb if shiptocontact ?>
+          <?lsmb IF shiptocontact ?>
           <br><?lsmb shiptocontact ?>
-          <?lsmb end shiptocontact ?>
-	  <?lsmb if shiptophone ?>
+          <?lsmb END ?>
+	  <?lsmb IF shiptophone ?>
 	  <br>Tel: <?lsmb shiptophone ?>
-	  <?lsmb end shiptophone ?>
-	  <?lsmb if shiptofax ?>
+	  <?lsmb END ?>
+	  <?lsmb IF shiptofax ?>
 	  <br>Fax: <?lsmb shiptofax ?>
-	  <?lsmb end shiptofax ?>
-	  <?lsmb if shiptoemail ?>
+	  <?lsmb END ?>
+	  <?lsmb IF shiptoemail ?>
 	  <br><?lsmb shiptoemail ?>
-	  <?lsmb end shiptoemail ?>
+	  <?lsmb END ?>
 	  </td>
 	</tr>
       </table>
@@ -127,17 +127,18 @@
 	  <th><font color=ffffff>Serial #</th>
 	</tr>
 
-	<?lsmb foreach number ?>
+	<?lsmb FOREACH number ?>
+	<?lsmb loop_count = loop.count - 1 ?>
 	<tr valign=top>
-          <td align=right><?lsmb runningnumber ?>.</td>
-	  <td><?lsmb number ?></td>
-	  <td><?lsmb description ?></td>
-	  <td align=right><?lsmb qty ?></td>
-	  <td><?lsmb unit ?></td>
-           <td><?lsmb bin ?></td>
-	  <td><?lsmb serialnumber ?></td>
+          <td align=right><?lsmb runningnumber.${loop_count} ?>.</td>
+	  <td><?lsmb number.${loop_count} ?></td>
+	  <td><?lsmb description.${loop_count} ?></td>
+	  <td align=right><?lsmb qty.${loop_count} ?></td>
+	  <td><?lsmb unit.${loop_count} ?></td>
+           <td><?lsmb bin.${loop_count} ?></td>
+	  <td><?lsmb serialnumber.${loop_count} ?></td>
 	</tr>
-	<?lsmb end number ?>
+	<?lsmb END ?>
 
 	<tr>
 	  <td colspan=7><hr noshade></td>
@@ -150,9 +151,9 @@
   <tr>
     <td>&nbsp;</td>
 
-    <?lsmb if notes ?>
+    <?lsmb IF notes ?>
     <td><?lsmb notes ?></td>
-    <?lsmb end notes ?>
+    <?lsmb END ?>
   </tr>
 </table>
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.