summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Build.PL1
-rwxr-xr-xLedgerSMB/Template.pm67
-rwxr-xr-xLedgerSMB/Template/HTML.pm31
-rwxr-xr-xLedgerSMB/Template/PDF.pm82
-rwxr-xr-xLedgerSMB/Template/PS.pm83
-rwxr-xr-xLedgerSMB/Template/TXT.pm83
-rw-r--r--Makefile.PL1
-rw-r--r--bin/arapprn.pl58
-rw-r--r--bin/cp.pl27
-rw-r--r--bin/io.pl28
-rw-r--r--bin/jc.pl11
-rw-r--r--bin/pos.pl25
-rw-r--r--bin/rp.pl80
-rw-r--r--t/01-load.t4
-rw-r--r--t/04-template-handling.t32
-rw-r--r--templates/demo/ap_transaction.tex69
-rw-r--r--templates/demo/ar_transaction.tex74
-rw-r--r--templates/demo/bin_list.tex65
-rw-r--r--templates/demo/check.tex15
-rw-r--r--templates/demo/invoice.tex127
-rw-r--r--templates/demo/packing_list.tex67
-rw-r--r--templates/demo/pick_list.tex60
-rw-r--r--templates/demo/purchase_order.tex99
-rw-r--r--templates/demo/receipt.tex15
-rw-r--r--templates/demo/request_quotation.tex89
-rw-r--r--templates/demo/sales_order.tex107
-rw-r--r--templates/demo/sales_quotation.tex88
-rw-r--r--templates/demo/statement.tex31
-rw-r--r--templates/demo/timecard.tex4
-rw-r--r--templates/demo/work_order.tex72
30 files changed, 973 insertions, 622 deletions
diff --git a/Build.PL b/Build.PL
index 0c2bf50c..c0065bb8 100644
--- a/Build.PL
+++ b/Build.PL
@@ -28,6 +28,7 @@ my $build = Module::Build->new (
'MIME::Lite' => 0,
'Error' => 0,
'Template' => 0,
+ 'Template::Latex' => 0,
'Test::More' => 0,
'Test::Trap' => 0,
'Test::Exception' => 0,
diff --git a/LedgerSMB/Template.pm b/LedgerSMB/Template.pm
index 77c7a78a..0a822f7d 100755
--- a/LedgerSMB/Template.pm
+++ b/LedgerSMB/Template.pm
@@ -3,10 +3,9 @@
LedgerSMB::Template - Template support module for LedgerSMB
-=head1 SYOPSIS
+=head1 SYNOPSIS
-This module renders templates to provide HTML interfaces. LaTeX support
-forthcoming.
+This module renders templates.
=head1 METHODS
@@ -25,6 +24,10 @@ include_path allows one to override the template directory and use this with use
This command renders the template and writes the result to standard output.
Currently email and server-side printing are not supported.
+=item output
+
+This function outputs the rendered file in an appropriate manner.
+
=item my $bool = _valid_language()
This command checks for valid langages. Returns 1 if the language is valid,
@@ -43,7 +46,6 @@ your software.
package LedgerSMB::Template;
use Error qw(:try);
-use Template;
use LedgerSMB::Sysconfig;
sub new {
@@ -55,7 +57,13 @@ sub new {
$self->{template} = $args{template};
$self->{format} = $args{format};
$self->{language} = $args{language};
- $self->{output} = '';
+ if ($args{outputfile}) {
+ $self->{outputfile} =
+ "${LedgerSMB::Sysconfig::tempdir}/$args{outputfile}";
+ } else {
+ $self->{outputfile} =
+ "${LedgerSMB::Sysconfig::tempdir}/$args{template}-output";
+ }
$self->{include_path} = $args{path};
$self->{locale} = $args{locale};
@@ -89,16 +97,8 @@ sub _valid_language {
sub render {
my $self = shift;
my $vars = shift;
- my $template;
my $format = "LedgerSMB::Template::$self->{format}";
- $template = Template->new({
- INCLUDE_PATH => $self->{include_path},
- START_TAG => quotemeta('<?lsmb'),
- END_TAG => quotemeta('?>'),
- DELIMITER => ';',
- }) || throw Error::Simple Template->error();
-
eval "require $format";
if ($@) {
throw Error::Simple $@;
@@ -108,15 +108,44 @@ sub render {
if (UNIVERSAL::isa($self->{locale}, 'LedgerSMB::Locale')){
$cleanvars->{text} = $self->{locale}->text();
}
- if (not $template->process(
- $format->can('get_template')->($self->{template}),
- $cleanvars, \$self->{output}, binmode => ':utf8')) {
- throw Error::Simple $template->error();
+
+ $format->can('process')->($self, $cleanvars);
+ return $format->can('postprocess')->($self);
+}
+
+sub output {
+ my $self = shift;
+ my $method = shift;
+
+ if ('mail' eq lc $method) {
+ #XXX do something
+ $self->_http_output;
+ } elsif ('print' eq lc $method) {
+ #XXX do something
+ $self->_http_output;
+ } else {
+ $self->_http_output;
}
+}
- $format->can('postprocess')->($self);
+sub _http_output {
+ my $self = shift;
+ my $FH;
- return $self->{output};
+ if ($self->{mimetype} =~ /^text/) {
+ print "Content-Type: $self->{mimetype}; charset=utf-8\n\n";
+ } else {
+ print "Content-Type: $self->{mimetype}\n\n";
+ }
+ open($FH, '<', $self->{rendered}) or
+ throw Error::Simple 'Unable to open rendered file';
+ while (<$FH>) {
+ print $_;
+ }
+ close($FH);
+ unlink($self->{rendered}) or
+ throw Error::Simple 'Unable to delete output file';
+ exit;
}
1;
diff --git a/LedgerSMB/Template/HTML.pm b/LedgerSMB/Template/HTML.pm
index d052319d..d02000a9 100755
--- a/LedgerSMB/Template/HTML.pm
+++ b/LedgerSMB/Template/HTML.pm
@@ -7,7 +7,7 @@ LedgerSMB::Template::HTML Template support module for LedgerSMB
=over
-=item get_template ()
+=item get_template ($name)
Returns the appropriate template filename for this format.
@@ -16,7 +16,11 @@ Returns the appropriate template filename for this format.
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 ()
+=item process ($parent, $cleanvars)
+
+Processes the template for HTML.
+
+=item postprocess ($parent)
Currently does nothing.
@@ -37,6 +41,7 @@ package LedgerSMB::Template::HTML;
use Error qw(:try);
use CGI;
+use Template;
sub get_template {
my $name = shift;
@@ -65,9 +70,29 @@ sub preprocess {
return $vars;
}
+sub process {
+ my $parent = shift;
+ my $cleanvars = shift;
+ my $template;
+
+ $template = Template->new({
+ INCLUDE_PATH => $parent->{include_path},
+ START_TAG => quotemeta('<?lsmb'),
+ END_TAG => quotemeta('?>'),
+ DELIMITER => ';',
+ }) || throw Error::Simple Template->error();
+ if (not $template->process(
+ get_template($parent->{template}),
+ $cleanvars, "$parent->{outputfile}.html", binmode => ':utf8')) {
+ throw Error::Simple $template->error();
+ }
+ $parent->{mimetype} = 'text/html';
+}
+
sub postprocess {
my $parent = shift;
- return;
+ $parent->{rendered} = "$parent->{outputfile}.html";
+ return "$parent->{outputfile}.html";
}
1;
diff --git a/LedgerSMB/Template/PDF.pm b/LedgerSMB/Template/PDF.pm
new file mode 100755
index 00000000..72c080c6
--- /dev/null
+++ b/LedgerSMB/Template/PDF.pm
@@ -0,0 +1,82 @@
+
+=head1 NAME
+
+LedgerSMB::Template::PDF Template support module for LedgerSMB
+
+=head1 METHODS
+
+=over
+
+=item get_template ($name)
+
+Returns the appropriate template filename for this format.
+
+=item preprocess ($vars)
+
+Currently does nothing.
+
+=item process ($parent, $cleanvars)
+
+Processes the template for PDF.
+
+=item postprocess ($parent)
+
+Currently does nothing.
+
+=back
+
+=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
+
+package LedgerSMB::Template::PDF;
+
+use Error qw(:try);
+use Template::Latex;
+
+sub get_template {
+ my $name = shift;
+ return "${name}.tex";
+}
+sub preprocess {
+ my $rawvars = shift;
+ my $vars;
+ my $type = ref $rawvars;
+ return $vars;
+}
+
+sub process {
+ my $parent = shift;
+ my $cleanvars = shift;
+ my $template;
+
+ $template = Template::Latex->new({
+ LATEX_FORMAT => 'pdf',
+ INCLUDE_PATH => $parent->{include_path},
+ START_TAG => quotemeta('<?lsmb'),
+ END_TAG => quotemeta('?>'),
+ DELIMITER => ';',
+ }) || throw Error::Simple Template::Latex->error();
+
+ if (not $template->process(
+ get_template($parent->{template}),
+ $cleanvars, "$parent->{outputfile}.pdf", binmode => ':utf8')) {
+ throw Error::Simple $template->error();
+ }
+ $parent->{mimetype} = 'application/pdf';
+}
+
+sub postprocess {
+ my $parent = shift;
+ $parent->{rendered} = "$parent->{outputfile}.pdf";
+ return "$parent->{outputfile}.pdf";
+}
+
+1;
diff --git a/LedgerSMB/Template/PS.pm b/LedgerSMB/Template/PS.pm
new file mode 100755
index 00000000..55349113
--- /dev/null
+++ b/LedgerSMB/Template/PS.pm
@@ -0,0 +1,83 @@
+
+=head1 NAME
+
+LedgerSMB::Template::PS Template support module for LedgerSMB
+
+=head1 METHODS
+
+=over
+
+=item get_template ($name)
+
+Returns the appropriate template filename for this format.
+
+=item preprocess ($vars)
+
+Currently does nothing.
+
+=item process ($parent, $cleanvars)
+
+Processes the template for Postscript.
+
+=item postprocess ($parent)
+
+Currently does nothing.
+
+=back
+
+=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
+
+package LedgerSMB::Template::PS;
+
+use Error qw(:try);
+use Template::Latex;
+
+sub get_template {
+ my $name = shift;
+ return "${name}.tex";
+}
+
+sub preprocess {
+ my $rawvars = shift;
+ my $vars;
+ my $type = ref $rawvars;
+ return $vars;
+}
+
+sub process {
+ my $parent = shift;
+ my $cleanvars = shift;
+ my $template;
+
+ $template = Template::Latex->new({
+ LATEX_FORMAT => 'ps',
+ INCLUDE_PATH => $parent->{include_path},
+ START_TAG => quotemeta('<?lsmb'),
+ END_TAG => quotemeta('?>'),
+ DELIMITER => ';',
+ }) || throw Error::Simple Template::Latex->error();
+
+ if (not $template->process(
+ get_template($parent->{template}),
+ $cleanvars, "$parent->{outputfile}.ps", binmode => ':utf8')) {
+ throw Error::Simple $template->error();
+ }
+ $parent->{mimetype} = 'application/postscript';
+}
+
+sub postprocess {
+ my $parent = shift;
+ $parent->{rendered} = "$parent->{outputfile}.ps";
+ return "$parent->{outputfile}.ps";
+}
+
+1;
diff --git a/LedgerSMB/Template/TXT.pm b/LedgerSMB/Template/TXT.pm
new file mode 100755
index 00000000..d7a76430
--- /dev/null
+++ b/LedgerSMB/Template/TXT.pm
@@ -0,0 +1,83 @@
+
+=head1 NAME
+
+LedgerSMB::Template::TXT Template support module for LedgerSMB
+
+=head1 METHODS
+
+=over
+
+=item get_template ($name)
+
+Returns the appropriate template filename for this format.
+
+=item preprocess ($vars)
+
+Currently does nothing.
+
+=item process ($parent, $cleanvars)
+
+Processes the template for text.
+
+=item postprocess ($parent)
+
+Currently does nothing.
+
+=back
+
+=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
+
+package LedgerSMB::Template::TXT;
+
+use Error qw(:try);
+use Template;
+
+sub get_template {
+ my $name = shift;
+ return "${name}.txt";
+}
+
+sub preprocess {
+ my $rawvars = shift;
+ my $vars;
+ my $type = ref $rawvars;
+
+ return $vars;
+}
+
+sub process {
+ my $parent = shift;
+ my $cleanvars = shift;
+ my $template;
+
+ $template = Template->new({
+ INCLUDE_PATH => $parent->{include_path},
+ START_TAG => quotemeta('<?lsmb'),
+ END_TAG => quotemeta('?>'),
+ DELIMITER => ';',
+ }) || throw Error::Simple Template->error();
+
+ if (not $template->process(
+ get_template($parent->{template}),
+ $cleanvars, "$parent->{outputfile}.txt", binmode => ':utf8')) {
+ throw Error::Simple $template->error();
+ }
+ $parent->{mimetype} = 'text/plain';
+}
+
+sub postprocess {
+ my $parent = shift;
+ $parent->{rendered} = "$parent->{outputfile}.txt";
+ return "$parent->{outputfile}.txt";
+}
+
+1;
diff --git a/Makefile.PL b/Makefile.PL
index 3b1c58f5..c3c2c821 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -28,6 +28,7 @@ requires 'Cwd';
requires 'Config::Std';
requires 'MIME::Lite';
requires 'Template';
+requires 'Template::Latex';
requires 'Error';
build_requires 'Test::More';
diff --git a/bin/arapprn.pl b/bin/arapprn.pl
index 0d256c28..845d829a 100644
--- a/bin/arapprn.pl
+++ b/bin/arapprn.pl
@@ -285,24 +285,17 @@ sub print_check {
$form->{fileid} = $invnumber;
$form->{fileid} =~ s/(\s|\W)+//g;
- if ( ( $form->{'media'} eq 'screen' ) and ( $form->{'format'} eq 'html' ) )
- {
- my $template =
- LedgerSMB::Template->new(
- user => \%myconfig, template => $form->{'formname'},
- format => '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 );
+ my $template = LedgerSMB::Template->new(
+ user => \%myconfig, template => $form->{'formname'},
+ format => uc $form->{'format'} );
+ try {
+ $template->render($form);
+ $template->output($form->{'media'});
+ }
+ catch Error::Simple with {
+ my $E = shift;
+ $form->error( $E->stacktrace );
+ };
if ( $form->{previousform} ) {
@@ -560,24 +553,17 @@ sub print_transaction {
$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(
- user => \%myconfig, template => $form->{'formname'},
- format => '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 );
+ my $template = LedgerSMB::Template->new(
+ user => \%myconfig, template => $form->{'formname'},
+ format => uc $form->{format} );
+ try {
+ $template->render($form);
+ $template->output($form->{media});
+ }
+ catch Error::Simple with {
+ my $E = shift;
+ $form->error( $E->stacktrace );
+ };
if (%$old_form) {
$old_form->{invnumber} = $form->{invnumber};
diff --git a/bin/cp.pl b/bin/cp.pl
index d21fa18b..d9316fea 100644
--- a/bin/cp.pl
+++ b/bin/cp.pl
@@ -1473,23 +1473,16 @@ sub print_form {
$form->{printmode} = '|-';
}
- if ( ( $form->{'media'} eq 'screen' ) and ( $form->{'format'} eq 'html' ) )
- {
- my $template =
- LedgerSMB::Template->new( user => \%myconfig,
- template => $form->{'formname'}, format => '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} );
+ my $template = LedgerSMB::Template->new( user => \%myconfig,
+ template => $form->{'formname'}, format => uc $form->{format} );
+ try {
+ $template->render($form);
+ $template->output($form->{media});
+ }
+ catch Error::Simple with {
+ my $E = shift;
+ $form->error( $E->stacktrace );
+ };
}
diff --git a/bin/io.pl b/bin/io.pl
index d1a00af9..6b21c95a 100644
--- a/bin/io.pl
+++ b/bin/io.pl
@@ -1767,24 +1767,16 @@ sub print_form {
$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( user => \%myconfig,
- template => $form->{'formname'}, format => '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} );
+ my $template = LedgerSMB::Template->new( user => \%myconfig,
+ template => $form->{'formname'}, format => uc $form->{format} );
+ try {
+ $template->render($form);
+ $template->output($form->{media});
+ }
+ catch Error::Simple with {
+ my $E = shift;
+ $form->error( $E->stacktrace );
+ };
# if we got back here restore the previous form
if ( defined %$old_form ) {
diff --git a/bin/jc.pl b/bin/jc.pl
index 0675c2cd..9f6c0015 100644
--- a/bin/jc.pl
+++ b/bin/jc.pl
@@ -2205,7 +2205,16 @@ qq|$form->{"${item}hour"}:$form->{"${item}min"}:$form->{"${item}sec"}|;
$form->audittrail( "", \%myconfig, \%audittrail );
}
- $form->parse_template( \%myconfig, ${LedgerSMB::Sysconfig::userspath} );
+ my $template = LedgerSMB::Template->new( user => \%myconfig,
+ template => $form->{'formname'}, format => uc $form->{format} );
+ try {
+ $template->render($form);
+ $template->output($form->{media});
+ }
+ catch Error::Simple with {
+ my $E = shift;
+ $form->error( $E->stacktrace );
+ };
if ( defined %$old_form ) {
diff --git a/bin/pos.pl b/bin/pos.pl
index 87787d08..3071bf33 100644
--- a/bin/pos.pl
+++ b/bin/pos.pl
@@ -1001,23 +1001,16 @@ sub print_form {
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(user => \%myconfig,
- template => $form->{'formname'}, format => 'HTML' );
- try {
- $template->render($form);
- $form->header;
- print $template->{'output'};
- exit;
- }
- catch Error::Simple with {
- my $E = shift;
- $form->error( $E->stacktrace );
- };
+ my $template = LedgerSMB::Template->new(user => \%myconfig,
+ template => $form->{'formname'}, format => uc $form->{format} );
+ try {
+ $template->render($form);
+ $template->output($form->{media});
}
- $form->parse_template( \%myconfig, ${LedgerSMB::Sysconfig::userspath} );
+ catch Error::Simple with {
+ my $E = shift;
+ $form->error( $E->stacktrace );
+ };
if ( $form->{printed} !~ /$form->{formname}/ ) {
$form->{printed} .= " $form->{formname}";
diff --git a/bin/rp.pl b/bin/rp.pl
index a5c906d3..5886c2da 100644
--- a/bin/rp.pl
+++ b/bin/rp.pl
@@ -1080,23 +1080,16 @@ sub generate_income_statement {
$form->{IN} = "income_statement.html";
- if ( ( $form->{'media'} eq 'screen' ) and ( $form->{'format'} eq 'html' ) )
- {
- my $template =
- LedgerSMB::Template->new( user => \%myconfig,
- template => $form->{'formname'}, format => 'HTML' );
- try {
- $template->render($form);
- $form->header;
- print $template->{'output'};
- exit;
- }
- catch Error::Simple with {
- my $E = shift;
- $form->error( $E->stacktrace );
- };
+ my $template = LedgerSMB::Template->new( user => \%myconfig,
+ template => $form->{'formname'}, format => uc $form->{format} );
+ try {
+ $template->render($form);
+ $template->output($form->{media});
}
- $form->parse_template;
+ catch Error::Simple with {
+ my $E = shift;
+ $form->error( $E->stacktrace );
+ };
}
@@ -1137,23 +1130,16 @@ sub generate_balance_sheet {
$form->{templates} = $myconfig{templates};
- if ( ( $form->{'media'} eq 'screen' ) and ( $form->{'format'} eq 'html' ) )
- {
- my $template =
- LedgerSMB::Template->new( user => \%myconfig,
- template => $form->{'formname'}, format => 'HTML' );
- try {
- $template->render($form);
- $form->header;
- print $template->{'output'};
- exit;
- }
- catch Error::Simple with {
- my $E = shift;
- $form->error( $E->stacktrace );
- };
+ my $template = LedgerSMB::Template->new( user => \%myconfig,
+ template => $form->{'formname'}, format => uc $form->{format} );
+ try {
+ $template->render($form);
+ $template->output($form->{media});
}
- $form->parse_template;
+ catch Error::Simple with {
+ my $E = shift;
+ $form->error( $E->stacktrace );
+ };
}
@@ -2291,27 +2277,17 @@ sub print_form {
2 );
}
- if ( ( $form->{'media'} eq 'screen' )
- and ( $form->{'format'} eq 'html' ) )
- {
- my $template =
- LedgerSMB::Template->new( user => \%myconfig,
- template => $form->{'formname'},
- format => 'HTML' );
- try {
- $template->render($form);
- $form->header;
- print $template->{'output'};
- exit;
- }
- catch Error::Simple with {
- my $E = shift;
- $form->error( $E->stacktrace );
- };
+ my $template = LedgerSMB::Template->new( user => \%myconfig,
+ template => $form->{'formname'},
+ format => uc $form->{format} );
+ try {
+ $template->render($form);
+ $template->output($form->{media});
}
- $form->parse_template( \%myconfig,
- ${LedgerSMB::Sysconfig::userspath} );
-
+ catch Error::Simple with {
+ my $E = shift;
+ $form->error( $E->stacktrace );
+ };
}
}
}
diff --git a/t/01-load.t b/t/01-load.t
index d2cde8f1..ac7c970d 100644
--- a/t/01-load.t
+++ b/t/01-load.t
@@ -2,7 +2,7 @@
use strict;
use warnings;
-use Test::More tests => 32;
+use Test::More tests => 34;
use_ok('LedgerSMB');
use_ok('LedgerSMB::AA');
@@ -34,6 +34,8 @@ use_ok('LedgerSMB::Sysconfig');
use_ok('LedgerSMB::Tax');
use_ok('LedgerSMB::Template');
use_ok('LedgerSMB::Template::HTML');
+use_ok('LedgerSMB::Template::PDF');
+use_ok('LedgerSMB::Template::PS');
use_ok('LedgerSMB::User');
SKIP: {
diff --git a/t/04-template-handling.t b/t/04-template-handling.t
index f9b458f9..04048b10 100644
--- a/t/04-template-handling.t
+++ b/t/04-template-handling.t
@@ -18,6 +18,8 @@ use LedgerSMB::Locale;
use LedgerSMB::Template;
use LedgerSMB::Template::HTML;
+$LedgerSMB::Sysconfig::tempdir = 't/var';
+
my @r;
my $temp;
my $form;
@@ -131,8 +133,8 @@ is_deeply(LedgerSMB::Template::HTML::preprocess({'fruit' => '&veggies',
'test' => ['nest', 'bird', '0 < 15', 1]}),
{'fruit' => '&amp;veggies', 'test' => ['nest', 'bird', '0 &lt; 15', 1]},
'HTML, preprocess: Returned properly escaped nested contents');
-is(LedgerSMB::Template::HTML::postprocess('04-template'), undef,
- 'HTML, postprocess: Return undef');
+is(LedgerSMB::Template::HTML::postprocess({outputfile => '04-template'}),
+ '04-template.html', 'HTML, postprocess: Return output filename');
# Template->new
$myconfig = {'templates' => 't/data'};
@@ -173,9 +175,19 @@ isa_ok($template, 'LedgerSMB::Template',
'Template, new: Object creation with format and template');
is($template->{include_path}, 't/data',
'Template, new: Object creation with format and template');
-is($template->render({'login' => 'foo'}),
- "I am a template.\nLook at me foo.\n",
- 'Template, render: Simple HTML template');
+is($template->render({'login' => 'foo&bar'}), 't/var/04-template-output.html',
+ 'Template, render: Simple HTML template, default filename');
+ok(-e 't/var/04-template-output.html', 'Template, render (HTML): File created');
+open($FH, '<', 't/var/04-template-output.html');
+@r = <$FH>;
+close($FH);
+chomp(@r);
+is(join("\n", @r), "I am a template.\nLook at me foo&amp;bar.",
+ 'Template, render (HTML): Simple HTML template, correct output');
+is(unlink('t/var/04-template-output.html'), 1,
+ 'Template, render: removing testfile');
+ok(!-e 't/var/04-template-output.html',
+ 'Template, render (HTML): testfile removed');
$template = undef;
$template = new LedgerSMB::Template('user' => $myconfig, 'format' => 'HTML',
@@ -184,12 +196,6 @@ ok(defined $template,
'Template, new: Object creation with locale');
isa_ok($template, 'LedgerSMB::Template',
'Template, new: Object creation with locale');
-TODO: {
- local $TODO = 'gettext substitution of passed in data';
- is($template->render({'login' => 'April'}),
- "I am a template.\nLook at me Avril.\n",
- 'Template, render: HTML template with locale');
-}
$template = undef;
$template = new LedgerSMB::Template('user' => $myconfig, 'format' => 'HTML',
@@ -197,7 +203,7 @@ $template = new LedgerSMB::Template('user' => $myconfig, 'format' => 'HTML',
ok(defined $template,
'Template, new: Object creation with non-existent template');
throws_ok{$template->render({'login' => 'foo'})} qr/not found/,
- 'render: File not found caught';
+ 'Template, render: File not found caught';
$template = undef;
$template = new LedgerSMB::Template('user' => $myconfig, 'format' => 'TODO',
@@ -205,4 +211,4 @@ $template = new LedgerSMB::Template('user' => $myconfig, 'format' => 'TODO',
ok(defined $template,
'Template, new: Object creation with non-existent format');
throws_ok{$template->render({'login' => 'foo'})} qr/Can't locate/,
- 'render: Invalid format caught';
+ 'Template, render: Invalid format caught';
diff --git a/templates/demo/ap_transaction.tex b/templates/demo/ap_transaction.tex
index 7df57017..c8edaf4c 100644
--- a/templates/demo/ap_transaction.tex
+++ b/templates/demo/ap_transaction.tex
@@ -1,5 +1,5 @@
\documentclass{scrartcl}
-\usepackage[latin1]{inputenc}
+\usepackage[utf8]{inputenc}
\usepackage{tabularx}
\usepackage[letterpaper,top=2cm,bottom=1.5cm,left=1.1cm,right=1.5cm]{geometry}
\usepackage{graphicx}
@@ -12,7 +12,7 @@
\fontfamily{cmss}\fontsize{10pt}{12pt}\selectfont
-<?lsmb include letterhead.tex ?>
+<?lsmb INCLUDE letterhead.tex ?>
\centerline{\textbf{A P} \hspace{0.3cm} \textbf{T R A N S A C T I O N}}
@@ -26,58 +26,64 @@
<?lsmb address2 ?>
<?lsmb city ?>
-<?lsmb if state>
+<?lsmb IF state>
\hspace{-0.1cm}, <?lsmb state ?>
-<?lsmb end state ?> <?lsmb zipcode ?>
+<?lsmb END ?> <?lsmb zipcode ?>
<?lsmb country ?>
\vspace{0.3cm}
-<?lsmb if contact ?>
+<?lsmb IF contact ?>
<?lsmb contact ?>
\vspace{0.2cm}
-<?lsmb end contact ?>
+<?lsmb END ?>
-<?lsmb if vendorphone ?>
+<?lsmb IF vendorphone ?>
Tel: <?lsmb vendorphone ?>
-<?lsmb end vendorphone ?>
+<?lsmb END ?>
-<?lsmb if vendorfax ?>
+<?lsmb IF vendorfax ?>
Fax: <?lsmb vendorfax ?>
-<?lsmb end vendorfax ?>
+<?lsmb END ?>
<?lsmb email ?>
-<?lsmb if vendortaxnumber ?>
+<?lsmb IF vendortaxnumber ?>
Tax Number: <?lsmb vendortaxnumber ?>
-<?lsmb end vendortaxnumber ?>
+<?lsmb END ?>
}
\hfill
\begin{tabular}[t]{ll}
\textbf{Invoice \#} & <?lsmb invnumber ?> \\
\textbf{Date} & <?lsmb invdate ?> \\
\textbf{Due} & <?lsmb duedate ?> \\
- <?lsmb if ponumber ?>
+ <?lsmb IF ponumber ?>
\textbf{PO \#} & <?lsmb ponumber ?> \\
- <?lsmb end ponumber ?>
- <?lsmb if ordnumber ?>
+ <?lsmb END ?>
+ <?lsmb IF ordnumber ?>
\textbf{Order \#} & <?lsmb ordnumber ?> \\
- <?lsmb end ordnumber ?>
+ <?lsmb END ?>
\textbf{Employee} & <?lsmb employee ?> \\
\end{tabular}
\vspace{1cm}
\begin{tabularx}{\textwidth}[t]{@{}llrX@{\hspace{1cm}}l@{}}
-<?lsmb foreach amount ?>
- <?lsmb accno ?> & <?lsmb account ?> & <?lsmb amount ?> & <?lsmb description ?> & <?lsmb projectnumber ?> \\
-<?lsmb end amount ?>
+<?lsmb FOREACH amount ?>
+<?lsmb lc = loop.count - 1 ?>
+ <?lsmb accno.${lc} ?> &
+ <?lsmb account.${lc} ?> &
+ <?lsmb amount.${lc} ?> &
+ <?lsmb description.${lc} ?> &
+ <?lsmb projectnumber.${lc} ?> \\
+<?lsmb END ?>
\multicolumn{2}{r}{\textbf{Subtotal}} & <?lsmb subtotal ?> & \\
-<?lsmb foreach tax ?>
- \multicolumn{2}{r}{\textbf{<?lsmb taxdescription ?> @ <?lsmb taxrate ?> \%}} & <?lsmb tax ?> & \\
-<?lsmb end tax ?>
+<?lsmb FOREACH tax ?>
+<?lsmb lc = loop.count - 1 ?>
+ \multicolumn{2}{r}{\textbf{<?lsmb taxdescription.${lc} ?> @ <?lsmb taxrate.${lc} ?> \%}} & <?lsmb tax.${lc} ?> & \\
+<?lsmb END ?>
\multicolumn{2}{r}{\textbf{Total}} & <?lsmb invtotal ?> & \\
@@ -87,25 +93,26 @@ Tax Number: <?lsmb vendortaxnumber ?>
<?lsmb text_amount ?> ***** <?lsmb decimal ?>/100 <?lsmb currency ?>
-<?lsmb if notes ?>
+<?lsmb IF notes ?>
\vspace{0.3cm}
<?lsmb notes ?>
-<?lsmb end notes ?>
+<?lsmb END ?>
\vspace{0.3cm}
-<?lsmb if paid_1 ?>
+<?lsmb IF paid_1 ?>
\begin{tabular}{@{}llllr@{}}
\multicolumn{5}{c}{\textbf{Payments}} \\
\hline
\textbf{Date} & & \textbf{Source} & \textbf{Memo} & \textbf{Amount} \\
-<?lsmb end paid_1 ?>
-<?lsmb foreach payment ?>
- <?lsmb paymentdate ?> & <?lsmb paymentaccount ?> & <?lsmb paymentsource ?> & <?lsmb paymentmemo ?> & <?lsmb payment ?> \\
-<?lsmb end payment ?>
-<?lsmb if paid_1 ?>
+<?lsmb END ?>
+<?lsmb FOREACH payment ?>
+<?lsmb lc = loop.count - 1 ?>
+ <?lsmb paymentdate.${lc} ?> & <?lsmb paymentaccount.${lc} ?> & <?lsmb paymentsource.${lc} ?> & <?lsmb paymentmemo.${lc} ?> & <?lsmb payment.${lc} ?> \\
+<?lsmb END ?>
+<?lsmb IF paid_1 ?>
\end{tabular}
-<?lsmb end paid_1 ?>
+<?lsmb END ?>
\end{document}
diff --git a/templates/demo/ar_transaction.tex b/templates/demo/ar_transaction.tex
index 95f9160d..19834aaf 100644
--- a/templates/demo/ar_transaction.tex
+++ b/templates/demo/ar_transaction.tex
@@ -1,5 +1,5 @@
\documentclass{scrartcl}
-\usepackage[latin1]{inputenc}
+\usepackage[utf8]{inputenc}
\usepackage{tabularx}
\usepackage[top=2cm,bottom=1.5cm,left=2cm,right=1cm]{geometry}
\usepackage{graphicx}
@@ -40,60 +40,66 @@
<?lsmb address2 ?>
<?lsmb city ?>
-<?lsmb if state ?>
+<?lsmb IF state ?>
, <?lsmb state ?>
-<?lsmb end state ?>
+<?lsmb END ?>
<?lsmb zipcode ?>
<?lsmb country ?>
\vspace{0.3cm}
-<?lsmb if contact ?>
+<?lsmb IF contact ?>
<?lsmb contact ?>
-<?lsmb end contact ?>
+<?lsmb END ?>
\vspace{0.2cm}
-<?lsmb if customerphone ?>
+<?lsmb IF customerphone ?>
Tel: <?lsmb customerphone ?>
-<?lsmb end customerphone ?>
+<?lsmb END ?>
-<?lsmb if customerfax ?>
+<?lsmb IF customerfax ?>
Fax: <?lsmb customerfax ?>
-<?lsmb end customerfax ?>
+<?lsmb END ?>
<?lsmb email ?>
-<?lsmb if customertaxnumber ?>
+<?lsmb IF customertaxnumber ?>
Tax Number: <?lsmb customertaxnumber ?>
-<?lsmb end customertaxnumber ?>
+<?lsmb END ?>
}
\hfill
\begin{tabular}[t]{ll}
\textbf{Invoice \#} & <?lsmb invnumber ?> \\
\textbf{Date} & <?lsmb invdate ?> \\
\textbf{Due} & <?lsmb duedate ?> \\
- <?lsmb if ponumber ?>
+ <?lsmb IF ponumber ?>
\textbf{PO \#} & <?lsmb ponumber ?> \\
- <?lsmb end ponumber ?>
- <?lsmb if ordnumber ?>
+ <?lsmb END ?>
+ <?lsmb IF ordnumber ?>
\textbf{Order \#} & <?lsmb ordnumber ?> \\
- <?lsmb end ordnumber ?>
+ <?lsmb END ?>
\textbf{Employee} & <?lsmb employee ?> \\
\end{tabular}
\vspace{1cm}
\begin{tabularx}{\textwidth}[t]{@{}llrX@{\hspace{1cm}}l@{}}
-<?lsmb foreach amount ?>
- <?lsmb accno ?> & <?lsmb account ?> & <?lsmb amount ?> & <?lsmb description ?> & <?lsmb projectnumber ?> \\
-<?lsmb end amount ?>
+<?lsmb FOREACH amount ?>
+<?lsmb lc = loop.count - 1 ?>
+ <?lsmb accno.${lc} ?> &
+ <?lsmb account.${lc} ?> &
+ <?lsmb amount.${lc} ?> &
+ <?lsmb description.${lc} ?> &
+ <?lsmb projectnumber.${lc} ?> \\
+<?lsmb END ?>
\multicolumn{2}{r}{\textbf{Subtotal}} & <?lsmb subtotal ?> & \\
-<?lsmb foreach tax ?>
- \multicolumn{2}{r}{\textbf{<?lsmb taxdescription ?> @ <?lsmb taxrate ?> \%}} & <?lsmb tax ?> & \\
-<?lsmb end tax ?>
+<?lsmb FOREACH tax ?>
+<?lsmb lc = loop.count - 1 ?>
+ \multicolumn{2}{r}{\textbf{<?lsmb taxdescription.${lc} ?> @ <?lsmb taxrate.${lc} ?> \%}} & <?lsmb tax.${lc} ?> & \\
+<?lsmb END ?>
\multicolumn{2}{r}{\textbf{Total}} & <?lsmb invtotal ?> & \\
@@ -103,31 +109,33 @@ Tax Number: <?lsmb customertaxnumber ?>
<?lsmb text_amount ?> ***** <?lsmb decimal ?>/100 <?lsmb currency ?>
-<?lsmb if notes ?>
+<?lsmb IF notes ?>
\vspace{0.3cm}
<?lsmb notes ?>
-<?lsmb end notes ?>
+<?lsmb END ?>
\vspace{0.3cm}
-<?lsmb if paid_1 ?>
+<?lsmb IF paid_1 ?>
\begin{tabular}{@{}lllr@{}}
\multicolumn{5}{c}{\textbf{Payments}} \\
\hline
\textbf{Date} & & \textbf{Source} & \textbf{Amount} \\
-<?lsmb end paid_1 ?>
-<?lsmb foreach payment ?>
- <?lsmb paymentdate ?> & <?lsmb paymentaccount ?> & <?lsmb paymentsource ?> & <?lsmb payment ?> \\
-<?lsmb end payment ?>
-<?lsmb if paid_1 ?>
+<?lsmb END ?>
+<?lsmb FOREACH payment ?>
+<?lsmb lc = loop.count - 1 ?>
+ <?lsmb paymentdate.${lc} ?> & <?lsmb paymentaccount.${lc} ?> & <?lsmb paymentsource.${lc} ?> & <?lsmb payment.${lc} ?> \\
+<?lsmb END ?>
+<?lsmb IF paid_1 ?>
\end{tabular}
-<?lsmb end paid_1 ?>
+<?lsmb END ?>
\vspace{0.5cm}
-<?lsmb foreach tax ?>
-\textbf{\scriptsize <?lsmb taxdescription ?> Registration <?lsmb taxnumber ?>} \\
-<?lsmb end tax ?>
+<?lsmb FOREACH tax ?>
+<?lsmb lc = loop.count - 1 ?>
+\textbf{\scriptsize <?lsmb taxdescription.${lc} ?> Registration <?lsmb taxnumber.${lc} ?>} \\
+<?lsmb END ?>
\end{document}
diff --git a/templates/demo/bin_list.tex b/templates/demo/bin_list.tex
index 88d4b3ce..8b96825c 100644
--- a/templates/demo/bin_list.tex
+++ b/templates/demo/bin_list.tex
@@ -1,5 +1,5 @@
\documentclass{scrartcl}
-\usepackage[latin1]{inputenc}
+\usepackage[utf8]{inputenc}
\usepackage{tabularx}
\usepackage[letterpaper,top=2cm,bottom=1.5cm,left=1.1cm,right=1.5cm]{geometry}
\usepackage{graphicx}
@@ -11,19 +11,20 @@
\fontfamily{cmss}\fontsize{10pt}{12pt}\selectfont
-<?lsmb include letterhead.tex ?>
+<?lsmb INCLUDE letterhead.tex ?>
-
-<?lsmb pagebreak 65 27 37 ?>
-\end{tabularx}
-
-\newpage
-
-\markboth{<?lsmb company ?>\hfill <?lsmb ordnumber ?>}{<?lsmb company ?>\hfill <?lsmb ordnumber ?>}
-\begin{tabularx}{\textwidth}{@{}rlXllrrll@{}}
- \textbf{Item} & \textbf{Number} & \textbf{Description} & \textbf{Serial Number} & & \textbf{Qty} & \textbf{Recd} & & \textbf{Bin} \\
-<?lsmb end pagebreak ?>
+% Breaking old pagebreak directives
+%<?xlsmb pagebreak 65 27 37 ?>
+%\end{tabularx}
+%
+%\newpage
+%
+%\markboth{<?xlsmb company ?>\hfill <?xlsmb ordnumber ?>}{<?xlsmb company ?>\hfill <?xlsmb ordnumber ?>}
+%
+%\begin{tabularx}{\textwidth}{@{}rlXllrrll@{}}
+% \textbf{Item} & \textbf{Number} & \textbf{Description} & \textbf{Serial Number} & & \textbf{Qty} & \textbf{Recd} & & \textbf{Bin} \\
+%<?xlsmb end pagebreak ?>
\vspace*{0.5cm}
@@ -39,9 +40,9 @@
<?lsmb address2 ?>
<?lsmb city ?>
-<?lsmb if state ?>
+<?lsmb IF state ?>
\hspace{-0.1cm}, <?lsmb state ?>
-<?lsmb end state ?>
+<?lsmb END ?>
<?lsmb zipcode ?>
<?lsmb country ?>
@@ -57,9 +58,9 @@
<?lsmb shiptoaddress2 ?>
<?lsmb shiptocity ?>
-<?lsmb if shiptostate ?>
+<?lsmb IF shiptostate ?>
\hspace{-0.1cm}, <?lsmb shiptostate ?>
-<?lsmb end shiptostate ?>
+<?lsmb END ?>
<?lsmb shiptozipcode ?>
<?lsmb shiptocountry ?>
@@ -75,23 +76,23 @@
\begin{tabularx}{\textwidth}{*{6}{|X}|} \hline
\textbf{Order \#} & \textbf{Date} & \textbf{Contact}
- <?lsmb if warehouse ?>
+ <?lsmb IF warehouse ?>
& \textbf{Warehouse}
- <?lsmb end warehouse ?>
+ <?lsmb END ?>
& \textbf{Shipping Point} & \textbf{Ship via} \\ [0.5em]
\hline
<?lsmb ordnumber ?>
- <?lsmb if shippingdate ?>
+ <?lsmb IF shippingdate ?>
& <?lsmb shippingdate ?>
- <?lsmb end shippingdate ?>
- <?lsmb if not shippingdate ?>
+ <?lsmb END ?>
+ <?lsmb IF NOT shippingdate ?>
& <?lsmb orddate ?>
- <?lsmb end shippingdate ?>
+ <?lsmb END ?>
& <?lsmb employee ?>
- <?lsmb if warehouse ?>
+ <?lsmb IF warehouse ?>
& <?lsmb warehouse ?>
- <?lsmb end warehouse ?>
+ <?lsmb END ?>
& <?lsmb shippingpoint ?> & <?lsmb shipvia ?> \\
\hline
\end{tabularx}
@@ -101,10 +102,18 @@
\begin{tabularx}{\textwidth}{@{}rlXllrrll@{}}
\textbf{Item} & \textbf{Number} & \textbf{Description} & \textbf{Serial Number} & & \textbf{Qty} & \textbf{Recd} & & \textbf{Bin} \\
-<?lsmb foreach number ?>
- <?lsmb runningnumber ?> & <?lsmb number ?> & <?lsmb description ?> & <?lsmb serialnumber ?> &
- <?lsmb deliverydate ?> & <?lsmb qty ?> & <?lsmb ship ?> & <?lsmb unit ?> & <?lsmb bin ?> \\
-<?lsmb end number ?>
+<?lsmb FOREACH number ?>
+<?lsmb lc = loop.count - 1 ?>
+ <?lsmb runningnumber.${lc} ?> &
+ <?lsmb number.${lc} ?> &
+ <?lsmb description.${lc} ?> &
+ <?lsmb serialnumber.${lc} ?> &
+ <?lsmb deliverydate.${lc} ?> &
+ <?lsmb qty.${lc} ?> &
+ <?lsmb ship.${lc} ?> &
+ <?lsmb unit.${lc} ?> &
+ <?lsmb bin.${lc} ?> \\
+<?lsmb END ?>
\end{tabularx}
diff --git a/templates/demo/check.tex b/templates/demo/check.tex
index a0298580..b5c8a31c 100644
--- a/templates/demo/check.tex
+++ b/templates/demo/check.tex
@@ -1,5 +1,5 @@
\documentclass{scrartcl}
-\usepackage[latin1]{inputenc}
+\usepackage[utf8]{inputenc}
\usepackage{tabularx}
\usepackage[letterpaper,top=2cm,bottom=1.5cm,left=1.1cm,right=1.5cm]{geometry}
\usepackage{graphicx}
@@ -38,9 +38,9 @@
<?lsmb address2 ?>
<?lsmb city ?>
-<?lsmb if state ?>
+<?lsmb IF state ?>
\hspace{-0.1cm}, <?lsmb state ?>
-<?lsmb end state ?>
+<?lsmb END ?>
<?lsmb zipcode ?>
<?lsmb country ?>
@@ -61,10 +61,11 @@
\begin{tabularx}{\textwidth}{lXrr@{}}
\textbf{Invoice \#} & \textbf{Invoice Date}
& \textbf{Amount Due} & \textbf{Applied} \\
-<?lsmb foreach invnumber ?>
-<?lsmb invnumber ?> & <?lsmb invdate ?> \dotfill
- & <?lsmb due ?> & <?lsmb paid ?> \\
-<?lsmb end invnumber ?>
+<?lsmb FOREACH invnumber ?>
+<?lsmb lc = loop.count - 1 ?>
+<?lsmb invnumber.${lc} ?> & <?lsmb invdate.${lc} ?> \dotfill
+ & <?lsmb due.${lc} ?> & <?lsmb paid.${lc} ?> \\
+<?lsmb END ?>
\end{tabularx}
\vspace{1cm}
diff --git a/templates/demo/invoice.tex b/templates/demo/invoice.tex
index a34120fb..36af8d88 100644
--- a/templates/demo/invoice.tex
+++ b/templates/demo/invoice.tex
@@ -1,5 +1,5 @@
\documentclass{scrartcl}
-\usepackage[latin1]{inputenc}
+\usepackage[utf8]{inputenc}
\usepackage{tabularx}
\usepackage[letterpaper,top=2cm,bottom=1.5cm,left=1.1cm,right=1.5cm]{geometry}
\usepackage{graphicx}
@@ -22,29 +22,30 @@ A return authorization must be obtained from <?lsmb company ?> before goods are
}
}
-<?lsmb include letterhead.tex ?>
-
-<?lsmb pagebreak 65 27 37 ?>
-\end{tabularx}
-
- \rule{\textwidth}{2pt}
-
- \vspace{0.2cm}
-
- \hfill
- \begin{tabularx}{\textwidth}{Xr@{\hspace{1cm}}r@{}}
- & Subtotal & <?lsmb sumcarriedforward ?> \\
- \end{tabularx}
-
-\newpage
-
-\markboth{<?lsmb company ?>\hfill <?lsmb invnumber ?>}{<?lsmb company ?>\hfill <?lsmb invnumber ?>}
-
-\begin{tabularx}{\textwidth}{@{}rlXlrlrrr@{}}
- \textbf{Pos} & \textbf{Number} & \textbf{Description} & & \textbf{Qt'y} &
- \textbf{Unit} & \textbf{Price} & \textbf{Disc \%} & \textbf{Amount} \\ [0.5em]
- & carried forward from page <?lsmb lastpage ?> & & & & & & & <?lsmb sumcarriedforward ?> \\ [0.5em]
-<?lsmb end pagebreak ?>
+<?lsmb INCLUDE letterhead.tex ?>
+
+% Disable old pagebreak handling
+%<?xlsmb pagebreak 65 27 37 ?>
+%\end{tabularx}
+%
+% \rule{\textwidth}{2pt}
+%
+% \vspace{0.2cm}
+%
+% \hfill
+% \begin{tabularx}{\textwidth}{Xr@{\hspace{1cm}}r@{}}
+% & Subtotal & <?xlsmb sumcarriedforward ?> \\
+% \end{tabularx}
+%
+%\newpage
+%
+%\markboth{<?xlsmb company ?>\hfill <?xlsmb invnumber ?>}{<?xlsmb company ?>\hfill <?xlsmb invnumber ?>}
+%
+%\begin{tabularx}{\textwidth}{@{}rlXlrlrrr@{}}
+% \textbf{Pos} & \textbf{Number} & \textbf{Description} & & \textbf{Qt'y} &
+% \textbf{Unit} & \textbf{Price} & \textbf{Disc \%} & \textbf{Amount} \\ [0.5em]
+% & carried forward from page <?xlsmb lastpage ?> & & & & & & & <?xlsmb sumcarriedforward ?> \\ [0.5em]
+%<?xlsmb end pagebreak ?>
\vspace*{0.5cm}
@@ -60,27 +61,27 @@ A return authorization must be obtained from <?lsmb company ?> before goods are
<?lsmb address2 ?>
<?lsmb city ?>
-<?lsmb if state ?>
+<?lsmb IF state ?>
\hspace{-0.1cm}, <?lsmb state ?>
-<?lsmb end state ?>
+<?lsmb END ?>
<?lsmb zipcode ?>
<?lsmb country ?>
\vspace{0.3cm}
-<?lsmb if contact ?>
+<?lsmb IF contact ?>
<?lsmb contact ?>
\vspace{0.2cm}
-<?lsmb end contact ?>
+<?lsmb END ?>
-<?lsmb if customerphone ?>
+<?lsmb IF customerphone ?>
Tel: <?lsmb customerphone ?>
-<?lsmb end customerphone ?>
+<?lsmb END ?>
-<?lsmb if customerfax ?>
+<?lsmb IF customerfax ?>
Fax: <?lsmb customerfax ?>
-<?lsmb end customerfax ?>
+<?lsmb END ?>
<?lsmb email ?>
}
@@ -95,27 +96,27 @@ Fax: <?lsmb customerfax ?>
<?lsmb shiptoaddress2 ?>
<?lsmb shiptocity ?>
-<?lsmb if shiptostate ?>
+<?lsmb IF shiptostate ?>
\hspace{-0.1cm}, <?lsmb shiptostate ?>
-<?lsmb end shiptostate ?>
+<?lsmb END ?>
<?lsmb shiptozipcode ?>
<?lsmb shiptocountry ?>
\vspace{0.3cm}
-<?lsmb if shiptocontact ?>
+<?lsmb IF shiptocontact ?>
<?lsmb shiptocontact ?>
\vspace{0.2cm}
-<?lsmb end shiptocontact ?>
+<?lsmb END ?>
-<?lsmb if shiptophone ?>
+<?lsmb IF shiptophone ?>
Tel: <?lsmb shiptophone ?>
-<?lsmb end shiptophone ?>
+<?lsmb END ?>
-<?lsmb if shiptofax ?>
+<?lsmb IF shiptofax ?>
Fax: <?lsmb shiptofax ?>
-<?lsmb end shiptofax ?>
+<?lsmb END ?>
<?lsmb shiptoemail ?>
}
@@ -142,10 +143,18 @@ Fax: <?lsmb shiptofax ?>
\begin{tabularx}{\textwidth}{@{}rlXlrlrrr@{}}
\textbf{Pos} & \textbf{Number} & \textbf{Description} & & \textbf{Qt'y} &
\textbf{Unit} & \textbf{Price} & \textbf{Disc \%} & \textbf{Amount} \\ [0.5em]
-<?lsmb foreach number ?>
- <?lsmb runningnumber ?> & <?lsmb number ?> & <?lsmb description ?> & <?lsmb deliverydate ?> &
- <?lsmb qty ?> & <?lsmb unit ?> & <?lsmb sellprice ?> & <?lsmb discountrate ?> & <?lsmb linetotal ?> \\
-<?lsmb end number ?>
+<?lsmb FOREACH number ?>
+<?lsmb lc = loop.count - 1 ?>
+ <?lsmb runningnumber.${lc} ?> &
+ <?lsmb number.${lc} ?> &
+ <?lsmb description.${lc} ?> &
+ <?lsmb deliverydate.${lc} ?> &
+ <?lsmb qty.${lc} ?> &
+ <?lsmb unit.${lc} ?> &
+ <?lsmb sellprice.${lc} ?> &
+ <?lsmb discountrate.${lc} ?> &
+ <?lsmb linetotal.${lc} ?> \\
+<?lsmb END ?>
\end{tabularx}
@@ -157,16 +166,17 @@ Fax: <?lsmb shiptofax ?>
\hfill
\begin{tabularx}{7cm}{Xr@{\hspace{1cm}}r@{}}
& Subtotal & <?lsmb subtotal ?> \\
-<?lsmb foreach tax ?>
- & <?lsmb taxdescription ?> on <?lsmb taxbase ?> & <?lsmb tax ?> \\
-<?lsmb end tax ?>
-<?lsmb if paid ?>
+<?lsmb FOREACH tax ?>
+<?lsmb lc = loop.count - 1 ?>
+ & <?lsmb taxdescription.${lc} ?> on <?lsmb taxbase.${lc} ?> & <?lsmb tax.${lc} ?> \\
+<?lsmb END ?>
+<?lsmb IF paid ?>
& Paid & - <?lsmb paid ?> \\
-<?lsmb end paid ?>
+<?lsmb END ?>
\hline
-<?lsmb if total ?>
+<?lsmb IF total ?>
& Balance Due & <?lsmb total ?>
-<?lsmb end total ?>
+<?lsmb END ?>
\end{tabularx}
\vspace{0.3cm}
@@ -182,18 +192,19 @@ All prices in \textbf{<?lsmb currency ?>}.
\vfill
-<?lsmb if paid_1 ?>
+<?lsmb IF paid_1 ?>
\begin{tabularx}{10cm}{@{}lXlr@{}}
\textbf{Payments} & & & \\
\hline
\textbf{Date} & & \textbf{Source} & \textbf{Amount} \\
-<?lsmb end paid_1 ?>
-<?lsmb foreach payment ?>
- <?lsmb paymentdate ?> & <?lsmb paymentaccount ?> & <?lsmb paymentsource ?> & <?lsmb payment ?> \\
-<?lsmb end payment ?>
-<?lsmb if paid_1 ?>
+<?lsmb END ?>
+<?lsmb FOREACH payment ?>
+<?lsmb lc = loop.count - 1 ?>
+ <?lsmb paymentdate.${lc} ?> & <?lsmb paymentaccount.${lc} ?> & <?lsmb paymentsource.${lc} ?> & <?lsmb payment.${lc} ?> \\
+<?lsmb END ?>
+<?lsmb IF paid_1 ?>
\end{tabularx}
-<?lsmb end paid_1 ?>
+<?lsmb END ?>
\vspace{1cm}
diff --git a/templates/demo/packing_list.tex b/templates/demo/packing_list.tex
index 71d90b53..a1b638ec 100644
--- a/templates/demo/packing_list.tex
+++ b/templates/demo/packing_list.tex
@@ -1,5 +1,5 @@
\documentclass{scrartcl}
-\usepackage[latin1]{inputenc}
+\usepackage[utf8]{inputenc}
\usepackage{tabularx}
\usepackage[letterpaper,top=2cm,bottom=1.5cm,left=1.1cm,right=1.5cm]{geometry}
\usepackage{graphicx}
@@ -23,18 +23,19 @@ returned. Returns must be shipped prepaid and properly insured.
}
}
-<?lsmb include letterhead.tex ?>
+<?lsmb INCLUDE letterhead.tex ?>
-<?lsmb pagebreak 65 27 37 ?>
-\end{tabularx}
-
-\newpage
-
-\markboth{<?lsmb company ?>\hfill <?lsmb ordnumber ?>}{<?lsmb company ?>\hfill <?lsmb ordnumber ?>}
-
-\begin{tabularx}{\textwidth}{@{}rlXllrrl@{}}
- \textbf{Item} & \textbf{Number} & \textbf{Description} & \textbf{Serial Number} & & \textbf{Qty} & \textbf{Ship} & \\
-<?lsmb end pagebreak ?>
+% Breaking old pagebreak directive
+%<?xlsmb pagebreak 65 27 37 ?>
+%\end{tabularx}
+%
+%\newpage
+%
+%\markboth{<?xlsmb company ?>\hfill <?xlsmb ordnumber ?>}{<?xlsmb company ?>\hfill <?xlsmb ordnumber ?>}
+%
+%\begin{tabularx}{\textwidth}{@{}rlXllrrl@{}}
+% \textbf{Item} & \textbf{Number} & \textbf{Description} & \textbf{Serial Number} & & \textbf{Qty} & \textbf{Ship} & \\
+%<?xlsmb end pagebreak ?>
\vspace*{0.5cm}
@@ -53,9 +54,9 @@ returned. Returns must be shipped prepaid and properly insured.
<?lsmb shiptoaddress2 ?>
<?lsmb shiptocity ?>
-<?lsmb if shiptostate ?>
+<?lsmb IF shiptostate ?>
\hspace{-0.1cm}, <?lsmb shiptostate ?>
-<?lsmb end shiptostate ?>
+<?lsmb END ?>
<?lsmb shiptozipcode ?>
<?lsmb shiptocountry ?>
@@ -63,13 +64,13 @@ returned. Returns must be shipped prepaid and properly insured.
\parbox[t]{.5\textwidth}{
<?lsmb shiptocontact ?>
- <?lsmb if shiptophone ?>
+ <?lsmb IF shiptophone ?>
Tel: <?lsmb shiptophone ?>
- <?lsmb end shiptophone ?>
+ <?lsmb END ?>
- <?lsmb if shiptofax ?>
+ <?lsmb IF shiptofax ?>
Fax: <?lsmb shiptofax ?>
- <?lsmb end shiptofax ?>
+ <?lsmb END ?>
<?lsmb shiptoemail ?>
}
@@ -84,23 +85,22 @@ returned. Returns must be shipped prepaid and properly insured.
\begin{tabularx}{\textwidth}{*{7}{|X}|} \hline
\textbf{Invoice \#} & \textbf{Order \#} & \textbf{Date} & \textbf{Contact}
- <?lsmb if warehouse ?>
+ <?lsmb IF warehouse ?>
& \textbf{Warehouse}
- <?lsmb end warehouse ?>
+ <?lsmb END ?>
& \textbf{Shipping Point} & \textbf{Ship via} \\ [0.5em]
\hline
<?lsmb invnumber ?> & <?lsmb ordnumber ?>
- <?lsmb if shippingdate ?>
+ <?lsmb IF shippingdate ?>
& <?lsmb shippingdate ?>
- <?lsmb end shippingdate ?>
- <?lsmb if not shippingdate ?>
+ <?lsmb ELSE ?>
& <?lsmb transdate ?>
- <?lsmb end shippingdate ?>
+ <?lsmb END shippingdate ?>
& <?lsmb employee ?>
- <?lsmb if warehouse ?>
+ <?lsmb IF warehouse ?>
& <?lsmb warehouse ?>
- <?lsmb end warehouse ?>
+ <?lsmb END ?>
& <?lsmb shippingpoint ?> & <?lsmb shipvia ?> \\
\hline
\end{tabularx}
@@ -110,10 +110,17 @@ returned. Returns must be shipped prepaid and properly insured.
\begin{tabularx}{\textwidth}{@{}rlXllrrl@{}}
\textbf{Item} & \textbf{Number} & \textbf{Description} & \textbf{Serial Number} & & \textbf{Qty} & \textbf{Ship} & \\
-<?lsmb foreach number ?>
- <?lsmb runningnumber ?> & <?lsmb number ?> & <?lsmb description ?> & <?lsmb serialnumber ?> &
- <?lsmb deliverydate ?> & <?lsmb qty ?> & <?lsmb ship ?> & <?lsmb unit ?> \\
-<?lsmb end number ?>
+<?lsmb FOREACH number ?>
+<?lsmb lc = loop.count - 1 ?>
+ <?lsmb runningnumber.${lc} ?> &
+ <?lsmb number.${lc} ?> &
+ <?lsmb description.${lc} ?> &
+ <?lsmb serialnumber.${lc} ?> &
+ <?lsmb deliverydate.${lc} ?> &
+ <?lsmb qty.${lc} ?> &
+ <?lsmb ship.${lc} ?> &
+ <?lsmb unit.${lc} ?> \\
+<?lsmb END ?>
\end{tabularx}
diff --git a/templates/demo/pick_list.tex b/templates/demo/pick_list.tex
index 1b88041f..cc7f67fd 100644
--- a/templates/demo/pick_list.tex
+++ b/templates/demo/pick_list.tex
@@ -1,5 +1,5 @@
\documentclass{scrartcl}
-\usepackage[latin1]{inputenc}
+\usepackage[utf8]{inputenc}
\usepackage{tabularx}
\usepackage[letterpaper,top=2cm,bottom=1.5cm,left=1.1cm,right=1.5cm]{geometry}
\usepackage{graphicx}
@@ -11,21 +11,22 @@
\fontfamily{cmss}\fontsize{10pt}{12pt}\selectfont
-<?lsmb include letterhead.tex ?>
+<?lsmb INCLUDE letterhead.tex ?>
-
-<?lsmb pagebreak 65 27 37 ?>
-\end{tabularx}
-
-\newpage
-
-\markboth{<?lsmb company ?>\hfill <?lsmb ordnumber ?>}{<?lsmb company ?>\hfill <?lsmb ordnumber ?>}
-
-\begin{tabularx}{\textwidth}{@{}rlXrcll@{}}
- \textbf{Item} & \textbf{Number} & \textbf{Description} &
- \textbf{Qty} & \textbf{Ship} & & \textbf{Bin} \\
-<?lsmb end pagebreak ?>
+% Breaking old pagebreak directive
+%<?xlsmb pagebreak 65 27 37 ?>
+%\end{tabularx}
+%
+%\newpage
+%
+%\markboth{<?xlsmb company ?>\hfill <?xlsmb ordnumber ?>}{<?xlsmb company ?>\hfill <?xlsmb ordnumber ?>}
+%
+%\begin{tabularx}{\textwidth}{@{}rlXrcll@{}}
+% \textbf{Item} & \textbf{Number} & \textbf{Description} &
+% \textbf{Qty} & \textbf{Ship} & & \textbf{Bin} \\
+%
+%<?xlsmb end pagebreak ?>
\vspace*{0.5cm}
@@ -44,9 +45,9 @@
<?lsmb shiptoaddress2 ?>
<?lsmb shiptocity ?>
-<?lsmb if shiptostate ?>
+<?lsmb IF shiptostate ?>
\hspace{-0.1cm}, <?lsmb shiptostate ?>
-<?lsmb end shiptostate ?>
+<?lsmb END ?>
<?lsmb shiptozipcode ?>
<?lsmb shiptocountry ?>
@@ -54,13 +55,13 @@
\parbox[t]{.5\textwidth}{
<?lsmb shiptocontact ?>
- <?lsmb if shiptophone ?>
+ <?lsmb IF shiptophone ?>
Tel: <?lsmb shiptophone ?>
- <?lsmb end shiptophone ?>
+ <?lsmb END ?>
- <?lsmb if shiptofax ?>
+ <?lsmb IF shiptofax ?>
Fax: <?lsmb shiptofax ?>
- <?lsmb end shiptofax ?>
+ <?lsmb END ?>
<?lsmb shiptoemail ?>
}
@@ -78,12 +79,11 @@
& \textbf{Warehouse} & \textbf{Shipping Point} & \textbf{Ship via} \\ [0.5em]
\hline
<?lsmb invnumber ?> & <?lsmb ordnumber ?>
- <?lsmb if shippingdate ?>
+ <?lsmb IF shippingdate ?>
& <?lsmb shippingdate ?>
- <?lsmb end shippingdate ?>
- <?lsmb if not shippingdate ?>
+ <?lsmb ELSE ?>
& <?lsmb transdate ?>
- <?lsmb end shippingdate ?>
+ <?lsmb END ?>
& <?lsmb employee ?> & <?lsmb warehouse ?> & <?lsmb shippingpoint ?> & <?lsmb shipvia ?> \\
\hline
\end{tabularx}
@@ -93,10 +93,14 @@
\begin{tabularx}{\textwidth}{@{}rlXrcll@{}}
\textbf{Item} & \textbf{Number} & \textbf{Description} &
\textbf{Qty} & \textbf{Ship} & & \textbf{Bin} \\
-<?lsmb foreach number ?>
- <?lsmb runningnumber ?> & <?lsmb number ?> & <?lsmb description ?> &
- <?lsmb qty ?> & [\hspace{1cm}] & <?lsmb unit ?> & <?lsmb bin ?> \\
-<?lsmb end number ?>
+<?lsmb FOREACH number ?>
+<?lsmb lc = loop.count - 1 ?>
+ <?lsmb runningnumber.${lc} ?> &
+ <?lsmb number.${lc} ?> &
+ <?lsmb description.${lc} ?> &
+ <?lsmb qty.${lc} ?> & [\hspace{1cm}] &
+ <?lsmb unit.${lc} ?> & <?lsmb bin.${lc} ?> \\
+<?lsmb END ?>
\end{tabularx}
diff --git a/templates/demo/purchase_order.tex b/templates/demo/purchase_order.tex
index 59511743..c60073a6 100644
--- a/templates/demo/purchase_order.tex
+++ b/templates/demo/purchase_order.tex
@@ -1,5 +1,5 @@
\documentclass{scrartcl}
-\usepackage[latin1]{inputenc}
+\usepackage[utf8]{inputenc}
\usepackage{tabularx}
\usepackage[letterpaper,top=2cm,bottom=1.5cm,left=1.1cm,right=1.5cm]{geometry}
\usepackage{graphicx}
@@ -12,28 +12,29 @@
\fontfamily{cmss}\fontsize{10pt}{12pt}\selectfont
-<?lsmb include letterhead.tex ?>
-
-
-<?lsmb pagebreak 65 27 48 ?>
-\end{tabularx}
-
- \rule{\textwidth}{2pt}
-
- \hfill
- \begin{tabularx}{7cm}{Xr@{\hspace{1cm}r@{}}
- & Subtotal & <?lsmb sumcarriedforward ?> \\
- \end{tabularx}
-
-\newpage
-
-\markboth{<?lsmb company ?>\hfill <?lsmb ordnumber ?>}{<?lsmb company ?>\hfill <?lsmb ordnumber ?>}
-
-\begin{tabularx}{\textwidth}{@{}lXrlrr@{}}
- \textbf{Number} & \textbf{Description} & \textbf{Qt'y} &
- \textbf{Unit} & \textbf{Price} & \textbf{Amount} \\
- & carried forward from <?lsmb lastpage ?> & & & & <?lsmb sumcarriedforward ?> \\
-<?lsmb end pagebreak ?>
+<?lsmb INCLUDE letterhead.tex ?>
+
+
+% Breaking old pagebreak directive
+%<?xlsmb pagebreak 65 27 48 ?>
+%\end{tabularx}
+%
+% \rule{\textwidth}{2pt}
+%
+% \hfill
+% \begin{tabularx}{7cm}{Xr@{\hspace{1cm}r@{}}
+% & Subtotal & <?xlsmb sumcarriedforward ?> \\
+% \end{tabularx}
+%
+%\newpage
+%
+%\markboth{<?xlsmb company ?>\hfill <?xlsmb ordnumber ?>}{<?xlsmb company ?>\hfill <?xlsmb ordnumber ?>}
+%
+%\begin{tabularx}{\textwidth}{@{}lXrlrr@{}}
+% \textbf{Number} & \textbf{Description} & \textbf{Qt'y} &
+% \textbf{Unit} & \textbf{Price} & \textbf{Amount} \\
+% & carried forward from <?xlsmb lastpage ?> & & & & <?xlsmb sumcarriedforward ?> \\
+%<?xlsmb end pagebreak ?>
\vspace*{0.5cm}
@@ -49,27 +50,27 @@
<?lsmb address2 ?>
<?lsmb city ?>
-<?lsmb if state ?>
+<?lsmb IF state ?>
\hspace{-0.1cm}, <?lsmb state ?>
-<?lsmb end state ?>
+<?lsmb END ?>
<?lsmb zipcode ?>
<?lsmb country ?>
\vspace{0.3cm}
-<?lsmb if contact ?>
+<?lsmb IF contact ?>
Attn: <?lsmb contact ?>
\vspace{0.2cm}
-<?lsmb end contact ?>
+<?lsmb END ?>
-<?lsmb if vendorphone ?>
+<?lsmb IF vendorphone ?>
Tel: <?lsmb vendorphone ?>
-<?lsmb end vendorphone ?>
+<?lsmb END ?>
-<?lsmb if vendorfax ?>
+<?lsmb IF vendorfax ?>
Fax: <?lsmb vendorfax ?>
-<?lsmb end vendorfax ?>
+<?lsmb END ?>
<?lsmb email ?>
}
@@ -84,27 +85,27 @@ Fax: <?lsmb vendorfax ?>
<?lsmb shiptoaddress2 ?>
<?lsmb shiptocity ?>
-<?lsmb if shiptostate ?>
+<?lsmb IF shiptostate ?>
\hspace{-0.1cm}, <?lsmb shiptostate ?>
-<?lsmb end shiptostate ?>
+<?lsmb END ?>
<?lsmb shiptozipcode ?>
<?lsmb shiptocountry ?>
\vspace{0.3cm}
-<?lsmb if shiptocontact ?>
+<?lsmb IF shiptocontact ?>
Attn: <?lsmb shiptocontact ?>
\vspace{0.2cm}
-<?lsmb end shiptocontact ?>
+<?lsmb END ?>
-<?lsmb if shiptophone ?>
+<?lsmb IF shiptophone ?>
Tel: <?lsmb shiptophone ?>
-<?lsmb end shiptophone ?>
+<?lsmb END ?>
-<?lsmb if shiptofax ?>
+<?lsmb IF shiptofax ?>
Fax: <?lsmb shiptofax ?>
-<?lsmb end shiptofax ?>
+<?lsmb END ?>
<?lsmb shiptoemail ?>
}
@@ -128,10 +129,15 @@ Fax: <?lsmb shiptofax ?>
\begin{tabularx}{\textwidth}{@{}lXrlrr@{}}
\textbf{Number} & \textbf{Description} & \textbf{Qt'y} &
\textbf{Unit} & \textbf{Price} & \textbf{Amount} \\
-<?lsmb foreach number ?>
- <?lsmb number ?> & <?lsmb description ?> & <?lsmb qty ?> &
- <?lsmb unit ?> & <?lsmb sellprice ?> & <?lsmb linetotal ?> \\
-<?lsmb end number ?>
+<?lsmb FOREACH number ?>
+<?lsmb lc = loop.count - 1 ?>
+ <?lsmb number.${lc} ?> &
+ <?lsmb description.${lc} ?> &
+ <?lsmb qty.${lc} ?> &
+ <?lsmb unit.${lc} ?> &
+ <?lsmb sellprice.${lc} ?> &
+ <?lsmb linetotal.${lc} ?> \\
+<?lsmb END ?>
\end{tabularx}
@@ -143,9 +149,10 @@ Fax: <?lsmb shiptofax ?>
\hfill
\begin{tabularx}{7cm}{Xr@{\hspace{1cm}}r@{}}
& Subtotal & <?lsmb subtotal ?> \\
-<?lsmb foreach tax ?>
- & <?lsmb taxdescription ?> on <?lsmb taxbase ?> & <?lsmb tax ?>\\
-<?lsmb end tax ?>
+<?lsmb FOREACH tax ?>
+<?lsmb lc = loop.count - 1 ?>
+ & <?lsmb taxdescription.${lc} ?> on <?lsmb taxbase.${lc} ?> & <?lsmb tax.${lc} ?>\\
+<?lsmb END ?>
\hline
& Total & <?lsmb ordtotal ?>\\
\end{tabularx}
diff --git a/templates/demo/receipt.tex b/templates/demo/receipt.tex
index 7bd4decd..16e88ed0 100644
--- a/templates/demo/receipt.tex
+++ b/templates/demo/receipt.tex
@@ -1,5 +1,5 @@
\documentclass{scrartcl}
-\usepackage[latin1]{inputenc}
+\usepackage[utf8]{inputenc}
\usepackage{tabularx}
\usepackage[letterpaper,top=2cm,bottom=1.5cm,left=1.1cm,right=1.5cm]{geometry}
\usepackage{graphicx}
@@ -38,9 +38,9 @@
<?lsmb address2 ?>
<?lsmb city ?>
-<?lsmb if state ?>
+<?lsmb IF state ?>
\hspace{-0.1cm}, <?lsmb state ?>
-<?lsmb end state ?>
+<?lsmb END ?>
<?lsmb zipcode ?>
<?lsmb country ?>
@@ -61,10 +61,11 @@
\begin{tabularx}{\textwidth}{lXrr@{}}
\textbf{Invoice No.} & \textbf{Invoice Date}
& \textbf{Due} & \textbf{Applied} \\
-<?lsmb foreach invnumber ?>
-<?lsmb invnumber ?> & <?lsmb invdate ?> \dotfill
- & <?lsmb due ?> & <?lsmb paid ?> \\
-<?lsmb end invnumber ?>
+<?lsmb FOREACH invnumber ?>
+<?lsmb lc = loop.count - 1 ?>
+<?lsmb invnumber.${lc} ?> & <?lsmb invdate.${lc} ?> \dotfill
+ & <?lsmb due.${lc} ?> & <?lsmb paid.${lc} ?> \\
+<?lsmb END ?>
\end{tabularx}
\vspace{1cm}
diff --git a/templates/demo/request_quotation.tex b/templates/demo/request_quotation.tex
index f866911e..feccc631 100644
--- a/templates/demo/request_quotation.tex
+++ b/templates/demo/request_quotation.tex
@@ -1,5 +1,5 @@
\documentclass{scrartcl}
-\usepackage[latin1]{inputenc}
+\usepackage[utf8]{inputenc}
\usepackage{tabularx}
\usepackage[letterpaper,top=2cm,bottom=1.5cm,left=1.1cm,right=1.5cm]{geometry}
\usepackage{graphicx}
@@ -11,28 +11,29 @@
\fontfamily{cmss}\fontsize{10pt}{12pt}\selectfont
-<?lsmb include letterhead.tex ?>
-
-
-<?lsmb pagebreak 65 27 48 ?>
-\end{tabularx}
-
- \rule{\textwidth}{2pt}
-
- \hfill
- \begin{tabularx}{7cm}{Xr@{\hspace{1cm}}r@{}}
- & \textbf{Subtotal} & \textbf{<?lsmb sumcarriedforward ?>} \\
- \end{tabularx}
-
-\newpage
-
-\markboth{<?lsmb company ?>\hfill <?lsmb ordnumber ?>}{<?lsmb company ?>\hfill <?lsmb ordnumber ?>}
-
-\begin{tabularx}{\textwidth}{@{}lXrlrr@{}}
- \textbf{Number} & \textbf{Description} & \textbf{Qt'y} &
- \textbf{Unit} & \textbf{Price} & \textbf{Extended} \\
- & carried forward from <?lsmb lastpage ?> & & & & <?lsmb sumcarriedforward ?> \\
-<?lsmb end pagebreak ?>
+<?lsmb INCLUDE letterhead.tex ?>
+
+
+% Breaking old pagebreak directive
+%<?xlsmb pagebreak 65 27 48 ?>
+%\end{tabularx}
+%
+% \rule{\textwidth}{2pt}
+%
+% \hfill
+% \begin{tabularx}{7cm}{Xr@{\hspace{1cm}}r@{}}
+% & \textbf{Subtotal} & \textbf{<?xlsmb sumcarriedforward ?>} \\
+% \end{tabularx}
+%
+%\newpage
+%
+%\markboth{<?xlsmb company ?>\hfill <?xlsmb ordnumber ?>}{<?xlsmb company ?>\hfill <?xlsmb ordnumber ?>}
+%
+%\begin{tabularx}{\textwidth}{@{}lXrlrr@{}}
+% \textbf{Number} & \textbf{Description} & \textbf{Qt'y} &
+% \textbf{Unit} & \textbf{Price} & \textbf{Extended} \\
+% & carried forward from <?xlsmb lastpage ?> & & & & <?xlsmb sumcarriedforward ?> \\
+%<?xlsmb end pagebreak ?>
\vspace*{0.5cm}
@@ -48,27 +49,27 @@
<?lsmb address2 ?>
<?lsmb city ?>
-<?lsmb if state ?>
+<?lsmb IF state ?>
\hspace{-0.1cm}, <?lsmb state ?>
-<?lsmb end state ?>
+<?lsmb END ?>
<?lsmb zipcode ?>
<?lsmb country ?>
\vspace{0.3cm}
-<?lsmb if contact ?>
+<?lsmb IF contact ?>
<?lsmb contact ?>
\vspace{0.2cm}
-<?lsmb end contact ?>
+<?lsmb END ?>
-<?lsmb if vendorphone ?>
+<?lsmb IF vendorphone ?>
Tel: <?lsmb vendorphone ?>
-<?lsmb end vendorphone ?>
+<?lsmb END ?>
-<?lsmb if vendorfax ?>
+<?lsmb IF vendorfax ?>
Fax: <?lsmb vendorfax ?>
-<?lsmb end vendorfax ?>
+<?lsmb END ?>
<?lsmb email ?>
}
@@ -83,27 +84,27 @@ Fax: <?lsmb vendorfax ?>
<?lsmb shiptoaddress2 ?>
<?lsmb shiptocity ?>
-<?lsmb if shiptostate ?>
+<?lsmb IF shiptostate ?>
\hspace{-0.1cm}, <?lsmb shiptostate ?>
-<?lsmb end shiptostate ?>
+<?lsmb END ?>
<?lsmb shiptozipcode ?>
<?lsmb shiptocountry ?>
\vspace{0.3cm}
-<?lsmb if shiptocontact ?>
+<?lsmb IF shiptocontact ?>
<?lsmb shiptocontact ?>
\vspace{0.2cm}
-<?lsmb end shiptocontact ?>
+<?lsmb END ?>
-<?lsmb if shiptophone ?>
+<?lsmb IF shiptophone ?>
Tel: <?lsmb shiptophone ?>
-<?lsmb end shiptophone ?>
+<?lsmb END ?>
-<?lsmb if shiptofax ?>
+<?lsmb IF shiptofax ?>
Fax: <?lsmb shiptofax ?>
-<?lsmb end shiptofax ?>
+<?lsmb END ?>
<?lsmb shiptoemail ?>
}
@@ -132,9 +133,13 @@ Please provide price and delivery time for the following items:
\begin{tabularx}{\textwidth}{@{}lXrllrr@{}}
\textbf{Number} & \textbf{Description} & \textbf{Qt'y} & &
\textbf{Delivery} & \textbf{Unit Price} & \textbf{Extended} \\
-<?lsmb foreach number ?>
- <?lsmb number ?> & <?lsmb description ?> & <?lsmb qty ?> & <?lsmb unit ?> \\
-<?lsmb end number ?>
+<?lsmb FOREACH number ?>
+<?lsmb lc = loop.count - 1 ?>
+ <?lsmb number.${lc} ?> &
+ <?lsmb description.${lc} ?> &
+ <?lsmb qty.${lc} ?> &
+ <?lsmb unit.${lc} ?> \\
+<?lsmb END ?>
\end{tabularx}
diff --git a/templates/demo/sales_order.tex b/templates/demo/sales_order.tex
index 7bcb0dce..2d382cb2 100644
--- a/templates/demo/sales_order.tex
+++ b/templates/demo/sales_order.tex
@@ -1,5 +1,5 @@
\documentclass{scrartcl}
-\usepackage[latin1]{inputenc}
+\usepackage[utf8]{inputenc}
\usepackage{tabularx}
\usepackage[letterpaper,top=2cm,bottom=1.5cm,left=1.1cm,right=1.5cm]{geometry}
\usepackage{graphicx}
@@ -11,29 +11,30 @@
\fontfamily{cmss}\fontsize{10pt}{12pt}\selectfont
-<?lsmb include letterhead.tex ?>
-
-
-<?lsmb pagebreak 65 27 48 ?>
-\end{tabularx}
-
- \rule{\textwidth}{2pt}
-
- \hfill
- \begin{tabularx}{7cm}{Xr@{\hspace{1cm}}r@{}}
- & \textbf{Subtotal} & \textbf{<?lsmb sumcarriedforward ?>} \\
- \end{tabularx}
-
-\newpage
-
-\markboth{<?lsmb company ?>\hfill <?lsmb ordnumber ?>}{<?lsmb company ?>\hfill <?lsmb ordnumber ?>}
-
-
-\begin{tabularx}{\textwidth}{@{}rlXrlrrr@{}}
- \textbf{Item} & \textbf{Number} & \textbf{Description} & \textbf{Qt'y} &
- \textbf{Unit} & \textbf{Price} & \textbf{Disc \%} & \textbf{Amount} \\
- & carried forward from <?lsmb lastpage ?> & & & & & <?lsmb sumcarriedforward ?> \\
-<?lsmb end pagebreak ?>
+<?lsmb INCLUDE letterhead.tex ?>
+
+
+% Breaking old pagebreak directive
+%<?xlsmb pagebreak 65 27 48 ?>
+%\end{tabularx}
+%
+% \rule{\textwidth}{2pt}
+%
+% \hfill
+% \begin{tabularx}{7cm}{Xr@{\hspace{1cm}}r@{}}
+% & \textbf{Subtotal} & \textbf{<?xlsmb sumcarriedforward ?>} \\
+% \end{tabularx}
+%
+%\newpage
+%
+%\markboth{<?xlsmb company ?>\hfill <?xlsmb ordnumber ?>}{<?xlsmb company ?>\hfill <?xlsmb ordnumber ?>}
+%
+%
+%\begin{tabularx}{\textwidth}{@{}rlXrlrrr@{}}
+% \textbf{Item} & \textbf{Number} & \textbf{Description} & \textbf{Qt'y} &
+% \textbf{Unit} & \textbf{Price} & \textbf{Disc \%} & \textbf{Amount} \\
+% & carried forward from <?xlsmb lastpage ?> & & & & & <?xlsmb sumcarriedforward ?> \\
+%<?xlsmb end pagebreak ?>
\vspace*{0.5cm}
@@ -49,27 +50,27 @@
<?lsmb address2 ?>
<?lsmb city ?>
-<?lsmb if state ?>
+<?lsmb IF state ?>
\hspace{-0.1cm}, <?lsmb state ?>
-<?lsmb end state ?>
+<?lsmb END ?>
<?lsmb zipcode ?>
<?lsmb country ?>
\vspace{0.3cm}
-<?lsmb if contact ?>
+<?lsmb IF contact ?>
<?lsmb contact ?>
\vspace{0.2cm}
-<?lsmb end contact ?>
+<?lsmb END ?>
-<?lsmb if customerphone ?>
+<?lsmb IF customerphone ?>
Tel: <?lsmb customerphone ?>
-<?lsmb end customerphone ?>
+<?lsmb END ?>
-<?lsmb if customerfax ?>
+<?lsmb IF customerfax ?>
Fax: <?lsmb customerfax ?>
-<?lsmb end customerfax ?>
+<?lsmb END ?>
<?lsmb email ?>
}
@@ -84,27 +85,27 @@ Fax: <?lsmb customerfax ?>
<?lsmb shiptoaddress2 ?>
<?lsmb shiptocity ?>
-<?lsmb if shiptostate ?>
+<?lsmb IF shiptostate ?>
\hspace{-0.1cm}, <?lsmb shiptostate ?>
-<?lsmb end shiptostate ?>
+<?lsmb END ?>
<?lsmb shiptozipcode ?>
<?lsmb shiptocountry ?>
\vspace{0.3cm}
-<?lsmb if shiptocontact ?>
+<?lsmb IF shiptocontact ?>
<?lsmb shiptocontact ?>
\vspace{0.2cm}
-<?lsmb end shiptocontact ?>
+<?lsmb END ?>
-<?lsmb if shiptophone ?>
+<?lsmb IF shiptophone ?>
Tel: <?lsmb shiptophone ?>
-<?lsmb end shiptophone ?>
+<?lsmb END ?>
-<?lsmb if shiptofax ?>
+<?lsmb IF shiptofax ?>
Fax: <?lsmb shiptofax ?>
-<?lsmb end shiptofax ?>
+<?lsmb END ?>
<?lsmb shiptoemail ?>
}
@@ -129,10 +130,17 @@ Fax: <?lsmb shiptofax ?>
\begin{tabularx}{\textwidth}{@{}rlXrlrrr@{}}
\textbf{Item} & \textbf{Number} & \textbf{Description} & \textbf{Qt'y} &
\textbf{Unit} & \textbf{Price} & \textbf{Disc \%} & \textbf{Amount} \\
-<?lsmb foreach number ?>
- <?lsmb runningnumber ?> & <?lsmb number ?> & <?lsmb description ?> & <?lsmb qty ?> &
- <?lsmb unit ?> & <?lsmb sellprice ?> & <?lsmb discountrate ?> & <?lsmb linetotal ?> \\
-<?lsmb end number ?>
+<?lsmb FOREACH number ?>
+<?lsmb lc = loop.count - 1 ?>
+ <?lsmb runningnumber.${lc} ?> &
+ <?lsmb number.${lc} ?> &
+ <?lsmb description.${lc} ?> &
+ <?lsmb qty.${lc} ?> &
+ <?lsmb unit.${lc} ?> &
+ <?lsmb sellprice.${lc} ?> &
+ <?lsmb discountrate.${lc} ?> &
+ <?lsmb linetotal.${lc} ?> \\
+<?lsmb END ?>
\end{tabularx}
@@ -144,9 +152,10 @@ Fax: <?lsmb shiptofax ?>
\hfill
\begin{tabularx}{7cm}{Xr@{\hspace{1cm}}r@{}}
& Subtotal & <?lsmb subtotal ?> \\
-<?lsmb foreach tax ?>
- & <?lsmb taxdescription ?> on <?lsmb taxbase ?> & <?lsmb tax ?>\\
-<?lsmb end tax ?>
+<?lsmb FOREACH tax ?>
+<?lsmb lc = loop.count - 1 ?>
+ & <?lsmb taxdescription.${lc} ?> on <?lsmb taxbase.${lc} ?> & <?lsmb tax.${lc} ?>\\
+<?lsmb END ?>
\hline
& Total & <?lsmb ordtotal ?>\\
\end{tabularx}
@@ -157,9 +166,9 @@ Fax: <?lsmb shiptofax ?>
\hfill
All prices in \textbf{<?lsmb currency ?>}.
-<?lsmb if terms ?>
+<?lsmb IF terms ?>
Terms: <?lsmb terms ?> days
-<?lsmb end terms ?>
+<?lsmb END ?>
\vspace{12pt}
diff --git a/templates/demo/sales_quotation.tex b/templates/demo/sales_quotation.tex
index b80ffacc..43a9fdfc 100644
--- a/templates/demo/sales_quotation.tex
+++ b/templates/demo/sales_quotation.tex
@@ -1,5 +1,5 @@
\documentclass{scrartcl}
-\usepackage[latin1]{inputenc}
+\usepackage[utf8]{inputenc}
\usepackage{tabularx}
\usepackage[letterpaper,top=2cm,bottom=1.5cm,left=1.1cm,right=1.5cm]{geometry}
\usepackage{graphicx}
@@ -20,28 +20,29 @@ Special order items are subject to a 10\% cancellation fee.
}
}
-<?lsmb include letterhead.tex ?>
-
-
-<?lsmb pagebreak 65 27 48 ?>
-\end{tabularx}
-
- \rule{\textwidth}{2pt}
-
- \hfill
- \begin{tabularx}{7cm}{Xr@{\hspace{1cm}}r@{}}
- & \textbf{Subtotal} & \textbf{<?lsmb sumcarriedforward ?>} \\
- \end{tabularx}
-
-\newpage
-
-\markboth{<?lsmb company ?>\hfill <?lsmb quonumber ?>}{<?lsmb company ?>\hfill <?lsmb quonumber ?>}
-
-\begin{tabularx}{\textwidth}{@{}lXrlrrr@{}}
- \textbf{Number} & \textbf{Description} & \textbf{Qt'y} &
- \textbf{Unit} & \textbf{Price} & \textbf{Disc \%} & \textbf{Amount} \\
- & carried forward from <?lsmb lastpage ?> & & & & & <?lsmb sumcarriedforward ?> \\
-<?lsmb end pagebreak ?>
+<?lsmb INCLUDE letterhead.tex ?>
+
+
+% Breaking old pagebreak directive
+%<?xlsmb pagebreak 65 27 48 ?>
+%\end{tabularx}
+%
+% \rule{\textwidth}{2pt}
+%
+% \hfill
+% \begin{tabularx}{7cm}{Xr@{\hspace{1cm}}r@{}}
+% & \textbf{Subtotal} & \textbf{<?xlsmb sumcarriedforward ?>} \\
+% \end{tabularx}
+%
+%\newpage
+%
+%\markboth{<?xlsmb company ?>\hfill <?xlsmb quonumber ?>}{<?xlsmb company ?>\hfill <?xlsmb quonumber ?>}
+%
+%\begin{tabularx}{\textwidth}{@{}lXrlrrr@{}}
+% \textbf{Number} & \textbf{Description} & \textbf{Qt'y} &
+% \textbf{Unit} & \textbf{Price} & \textbf{Disc \%} & \textbf{Amount} \\
+% & carried forward from <?xlsmb lastpage ?> & & & & & <?xlsmb sumcarriedforward ?> \\
+%<?xlsmb end pagebreak ?>
\vspace*{0.5cm}
@@ -55,27 +56,27 @@ Special order items are subject to a 10\% cancellation fee.
<?lsmb address2 ?>
<?lsmb city ?>
-<?lsmb if state ?>
+<?lsmb IF state ?>
\hspace{-0.1cm}, <?lsmb state ?>
-<?lsmb end state ?>
+<?lsmb END ?>
<?lsmb zipcode ?>
<?lsmb country ?>
\vspace{0.3cm}
-<?lsmb if contact ?>
+<?lsmb IF contact ?>
<?lsmb contact ?>
\vspace{0.2cm}
-<?lsmb end contact ?>
+<?lsmb END ?>
-<?lsmb if customerphone ?>
+<?lsmb IF customerphone ?>
Tel: <?lsmb customerphone ?>
-<?lsmb end customerphone ?>
+<?lsmb END ?>
-<?lsmb if customerfax ?>
+<?lsmb IF customerfax ?>
Fax: <?lsmb customerfax ?>
-<?lsmb end customerfax ?>
+<?lsmb END ?>
<?lsmb email ?>
}
@@ -99,10 +100,16 @@ Fax: <?lsmb customerfax ?>
\begin{tabularx}{\textwidth}{@{}lXrlrrr@{}}
\textbf{Number} & \textbf{Description} & \textbf{Qt'y} &
\textbf{Unit} & \textbf{Price} & \textbf{Disc \%} & \textbf{Amount} \\
-<?lsmb foreach number ?>
- <?lsmb number ?> & <?lsmb description ?> & <?lsmb qty ?> &
- <?lsmb unit ?> & <?lsmb sellprice ?> & <?lsmb discountrate ?> & <?lsmb linetotal ?> \\
-<?lsmb end number ?>
+<?lsmb FOREACH number ?>
+<?lsmb lc = loop.count - 1 ?>
+ <?lsmb number.${lc} ?> &
+ <?lsmb description.${lc} ?> &
+ <?lsmb qty.${lc} ?> &
+ <?lsmb unit.${lc} ?> &
+ <?lsmb sellprice.${lc} ?> &
+ <?lsmb discountrate.${lc} ?> &
+ <?lsmb linetotal.${lc} ?> \\
+<?lsmb END ?>
\end{tabularx}
@@ -114,9 +121,10 @@ Fax: <?lsmb customerfax ?>
\hfill
\begin{tabularx}{7cm}{Xr@{\hspace{1cm}}r@{}}
& Subtotal & <?lsmb subtotal ?> \\
-<?lsmb foreach tax ?>
- & <?lsmb taxdescription ?> on <?lsmb taxbase ?> & <?lsmb tax ?>\\
-<?lsmb end tax ?>
+<?lsmb FOREACH tax ?>
+<?lsmb lc = loop.count - 1 ?>
+ & <?lsmb taxdescription.${lc} ?> on <?lsmb taxbase.${lc} ?> & <?lsmb tax.${lc} ?>\\
+<?lsmb END ?>
\hline
& Total & <?lsmb quototal ?>\\
\end{tabularx}
@@ -126,9 +134,9 @@ Fax: <?lsmb customerfax ?>
\hfill
All prices in \textbf{<?lsmb currency ?>}.
-<?lsmb if terms ?>
+<?lsmb IF terms ?>
Terms: <?lsmb terms ?> days
-<?lsmb end terms ?>
+<?lsmb END ?>
\vspace{12pt}
diff --git a/templates/demo/statement.tex b/templates/demo/statement.tex
index 4343c5c6..8fedc55f 100644
--- a/templates/demo/statement.tex
+++ b/templates/demo/statement.tex
@@ -1,5 +1,5 @@
\documentclass{scrartcl}
-\usepackage[latin1]{inputenc}
+\usepackage[utf8]{inputenc}
\usepackage{tabularx}
\usepackage[letterpaper,top=2cm,bottom=1.5cm,left=1.1cm,right=1.5cm]{geometry}
\usepackage{graphicx}
@@ -11,7 +11,7 @@
\fontfamily{cmss}\fontsize{10pt}{12pt}\selectfont
-<?lsmb include letterhead.tex ?>
+<?lsmb INCLUDE letterhead.tex ?>
\parbox[t]{.5\textwidth}{
<?lsmb name ?>
@@ -21,21 +21,21 @@
<?lsmb address2 ?>
<?lsmb city ?>
-<?lsmb if state ?>
+<?lsmb IF state ?>
\hspace{-0.1cm}, <?lsmb state ?>
-<?lsmb end state ?>
+<?lsmb END ?>
<?lsmb zipcode ?>
<?lsmb country ?>
}
\parbox[t]{.5\textwidth}{
-<?lsmb if customerphone ?>
+<?lsmb IF customerphone ?>
Tel: <?lsmb customerphone ?>
-<?lsmb end customerphone ?>
+<?lsmb END ?>
-<?lsmb if customerfax ?>
+<?lsmb IF customerfax ?>
Fax: <?lsmb customerfax ?>
-<?lsmb end customerfax ?>
+<?lsmb END ?>
<?lsmb email ?>
}
@@ -52,10 +52,17 @@ Fax: <?lsmb customerfax ?>
\textbf{Invoice \#} & \textbf{Order \#} & \textbf{Date} & \textbf{Due} &
\textbf{Current} & \textbf{30} & \textbf{60} & \textbf{90} \\
\hline
-<?lsmb foreach invnumber ?>
- <?lsmb invnumber ?> & <?lsmb ordnumber ?> & <?lsmb invdate ?> & <?lsmb duedate ?> &
- <?lsmb c0 ?> & <?lsmb c30 ?> & <?lsmb c60 ?> & <?lsmb c90 ?> \\
-<?lsmb end invnumber ?>
+<?lsmb FOREACH invnumber ?>
+<?lsmb lc = loop.count - 1 ?>
+ <?lsmb invnumber.${lc} ?> &
+ <?lsmb ordnumber.${lc} ?> &
+ <?lsmb invdate.${lc} ?> &
+ <?lsmb duedate.${lc} ?> &
+ <?lsmb c0.${lc} ?> &
+ <?lsmb c30.${lc} ?> &
+ <?lsmb c60.${lc} ?> &
+ <?lsmb c90.${lc} ?> \\
+<?lsmb END ?>
\multicolumn{8}{|l|}{\mbox{}} \\
\hline
\textbf{Subtotal} & & & & <?lsmb c0total ?> & <?lsmb c30total ?> & <?lsmb c60total ?> & <?lsmb c90total ?> \\
diff --git a/templates/demo/timecard.tex b/templates/demo/timecard.tex
index 1c54eb4f..e303ac10 100644
--- a/templates/demo/timecard.tex
+++ b/templates/demo/timecard.tex
@@ -1,5 +1,5 @@
\documentclass{scrartcl}
-\usepackage[latin1]{inputenc}
+\usepackage[utf8]{inputenc}
\usepackage{tabularx}
\usepackage[letterpaper,top=2cm,bottom=1.5cm,left=1.1cm,right=1.5cm]{geometry}
\usepackage{graphicx}
@@ -11,7 +11,7 @@
\fontfamily{cmss}\fontsize{10pt}{12pt}\selectfont
-<?lsmb include letterhead.tex ?>
+<?lsmb INCLUDE letterhead.tex ?>
\centerline{\textbf{T I M E}\hspace{0.5cm}\textbf{C A R D}}
diff --git a/templates/demo/work_order.tex b/templates/demo/work_order.tex
index d3ca6959..c08a2da5 100644
--- a/templates/demo/work_order.tex
+++ b/templates/demo/work_order.tex
@@ -1,5 +1,5 @@
\documentclass{scrartcl}
-\usepackage[latin1]{inputenc}
+\usepackage[utf8]{inputenc}
\usepackage{tabularx}
\usepackage[letterpaper,top=2cm,bottom=1.5cm,left=1.1cm,right=1.5cm]{geometry}
\usepackage{graphicx}
@@ -11,20 +11,21 @@
\fontfamily{cmss}\fontsize{10pt}{12pt}\selectfont
-<?lsmb include letterhead.tex ?>
+<?lsmb INCLUDE letterhead.tex ?>
-<?lsmb pagebreak 65 27 48 ?>
-\end{tabularx}
-
-\newpage
-
-\markboth{<?lsmb company ?>\hfill <?lsmb ordnumber ?>}{<?lsmb company ?>\hfill <?lsmb ordnumber ?>}
-
-\begin{tabularx}{\textwidth}{@{}rlXrll@{}}
- \textbf{Item} & \textbf{Number} & \textbf{Description} & \textbf{Qt'y} &
- & \textbf{Serial Number} \\
-<?lsmb end pagebreak ?>
+% Break old pagebreak directive
+%<?xlsmb pagebreak 65 27 48 ?>
+%\end{tabularx}
+%
+%\newpage
+%
+%\markboth{<?xlsmb company ?>\hfill <?xlsmb ordnumber ?>}{<?xlsmb company ?>\hfill <?xlsmb ordnumber ?>}
+%
+%\begin{tabularx}{\textwidth}{@{}rlXrll@{}}
+% \textbf{Item} & \textbf{Number} & \textbf{Description} & \textbf{Qt'y} &
+% & \textbf{Serial Number} \\
+%<?xlsmb end pagebreak ?>
\vspace*{0.5cm}
@@ -40,27 +41,27 @@
<?lsmb address2 ?>
<?lsmb city ?>
-<?lsmb if state ?>
+<?lsmb IF state ?>
\hspace{-0.1cm}, <?lsmb state ?>
-<?lsmb end state ?>
+<?lsmb END ?>
<?lsmb zipcode ?>
<?lsmb country ?>
\vspace{0.3cm}
-<?lsmb if contact ?>
+<?lsmb IF contact ?>
<?lsmb contact ?>
\vspace{0.2cm}
-<?lsmb end contact ?>
+<?lsmb END ?>
-<?lsmb if customerphone ?>
+<?lsmb IF customerphone ?>
Tel: <?lsmb customerphone ?>
-<?lsmb end customerphone ?>
+<?lsmb END ?>
-<?lsmb if customerfax ?>
+<?lsmb IF customerfax ?>
Fax: <?lsmb customerfax ?>
-<?lsmb end customerfax ?>
+<?lsmb END ?>
<?lsmb email ?>
}
@@ -75,27 +76,27 @@ Fax: <?lsmb customerfax ?>
<?lsmb shiptoaddress2 ?>
<?lsmb shiptocity ?>
-<?lsmb if shiptostate ?>
+<?lsmb IF shiptostate ?>
\hspace{-0.1cm}, <?lsmb shiptostate ?>
-<?lsmb end shiptostate ?>
+<?lsmb END ?>
<?lsmb shiptozipcode ?>
<?lsmb shiptocountry ?>
\vspace{0.3cm}
-<?lsmb if shiptocontact ?>
+<?lsmb IF shiptocontact ?>
<?lsmb shiptocontact ?>
\vspace{0.2cm}
-<?lsmb end shiptocontact ?>
+<?lsmb END ?>
-<?lsmb if shiptophone ?>
+<?lsmb IF shiptophone ?>
Tel: <?lsmb shiptophone ?>
-<?lsmb end shiptophone ?>
+<?lsmb END ?>
-<?lsmb if shiptofax ?>
+<?lsmb IF shiptofax ?>
Fax: <?lsmb shiptofax ?>
-<?lsmb end shiptofax ?>
+<?lsmb END ?>
<?lsmb shiptoemail ?>
}
@@ -120,10 +121,15 @@ Fax: <?lsmb shiptofax ?>
\begin{tabularx}{\textwidth}{@{}rlXrll@{}}
\textbf{Item} & \textbf{Number} & \textbf{Description} & \textbf{Qt'y} &
& \textbf{Serial Number} \\
-<?lsmb foreach number ?>
- <?lsmb runningnumber ?> & <?lsmb number ?> & <?lsmb description ?> & <?lsmb qty ?> &
- <?lsmb unit ?> & <?lsmb serialnumber ?> \\
-<?lsmb end number ?>
+<?lsmb FOREACH number ?>
+<?lsmb lc = loop.count - 1 ?>
+ <?lsmb runningnumber.${lc} ?> &
+ <?lsmb number.${lc} ?> &
+ <?lsmb description.${lc} ?> &
+ <?lsmb qty.${lc} ?> &
+ <?lsmb unit.${lc} ?> &
+ <?lsmb serialnumber.${lc} ?> \\
+<?lsmb END ?>
\end{tabularx}