[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb: [1523] trunk
- Subject: SF.net SVN: ledger-smb: [1523] trunk
- From: ..hidden..
- Date: Thu, 06 Sep 2007 13:54:42 -0700
Revision: 1523
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=1523&view=rev
Author: tetragon
Date: 2007-09-06 13:54:42 -0700 (Thu, 06 Sep 2007)
Log Message:
-----------
Adjusting statements for batch printing (1789160)
Modified Paths:
--------------
trunk/bin/rp.pl
trunk/templates/demo/statement.html
trunk/templates/demo/statement.tex
Modified: trunk/bin/rp.pl
===================================================================
--- trunk/bin/rp.pl 2007-09-06 19:56:31 UTC (rev 1522)
+++ trunk/bin/rp.pl 2007-09-06 20:54:42 UTC (rev 1523)
@@ -2156,34 +2156,53 @@
if ( $form->{format} !~ /(postscript|pdf)/ );
}
+ my @batch_data = ();
+
for $i ( 1 .. $form->{rowcount} ) {
+
if ( $form->{"statement_$i"} ) {
$form->{"$form->{ct}_id"} = $form->{"$form->{ct}_id_$i"};
$language_code = $form->{"language_code_$i"};
$curr = $form->{"curr_$i"};
$selected = 1;
- last;
+
+ if ( $form->{media} !~ /(screen|email)/ ) {
+ # SC: I may not need this anymore...
+ # But I'll wait until lpr output is working before deciding
+ $form->{OUT} = "${LedgerSMB::Sysconfig::printer}{$form->{media}}";
+ $form->{"$form->{ct}_id"} = "";
+ $SIG{INT} = 'IGNORE';
+ }
+ else {
+ $form->{"statement_1"} = 1;
+ $form->{"language_code_1"} = $language_code;
+ $form->{"curr_1"} = $curr;
+ }
+
+ RP->aging( \%myconfig, \%$form );
+
+ $printhash = &print_form;
+
+ push @batch_data, $printhash;
}
}
$form->error( $locale->text('Nothing selected!') ) unless $selected;
-
- if ( $form->{media} !~ /(screen|email)/ ) {
- $form->{OUT} = "${LedgerSMB::Sysconfig::printer}{$form->{media}}";
- $form->{printmode} = '|-';
- $form->{"$form->{ct}_id"} = "";
- $SIG{INT} = 'IGNORE';
+
+ my $template = LedgerSMB::Template->new(
+ user => \%myconfig,
+ template => $form->{'formname'} || $form->{'type'},
+ format => uc $form->{format}
+ );
+ try {
+ $template->render({data => ..hidden..);
+ $template->output($form);
}
- else {
- $form->{"statement_1"} = 1;
- $form->{"language_code_1"} = $language_code;
- $form->{"curr_1"} = $curr;
- }
+ catch Error::Simple with {
+ my $E = shift;
+ $form->error( $E->stacktrace );
+ };
- RP->aging( \%myconfig, \%$form );
-
- &print_form;
-
$form->redirect( $locale->text('Statements sent to printer!') )
if ( $form->{media} !~ /(screen|email)/ );
@@ -2276,18 +2295,11 @@
$form->format_amount( \%myconfig, $form->{"${_}total"},
2 );
}
+
+ my $printhash = {};
+ for (keys %$form) { $printhash->{$_} = $form->{$_}}
- my $template = LedgerSMB::Template->new( user => \%myconfig,
- template => $form->{'formname'} || $form->{'type'},
- format => uc $form->{format} );
- try {
- $template->render($form);
- $template->output(%{$form});
- }
- catch Error::Simple with {
- my $E = shift;
- $form->error( $E->stacktrace );
- };
+ return $printhash;
}
}
}
Modified: trunk/templates/demo/statement.html
===================================================================
--- trunk/templates/demo/statement.html 2007-09-06 19:56:31 UTC (rev 1522)
+++ trunk/templates/demo/statement.html 2007-09-06 20:54:42 UTC (rev 1523)
@@ -1,6 +1,9 @@
<body bgcolor=ffffff>
+<?lsmb FOREACH customer IN data ?>
+<?lsmb import(customer) ?>
+
<table width="100%">
<?lsmb INCLUDE letterhead.html ?>
@@ -133,6 +136,7 @@
</table>
+<?lsmb END ?>
</body>
</html>
Modified: trunk/templates/demo/statement.tex
===================================================================
--- trunk/templates/demo/statement.tex 2007-09-06 19:56:31 UTC (rev 1522)
+++ trunk/templates/demo/statement.tex 2007-09-06 20:54:42 UTC (rev 1523)
@@ -7,6 +7,8 @@
\begin{document}
+<?lsmb FOREACH customer IN data ?>
+<?lsmb import(customer) ?>
\pagestyle{myheadings}
\thispagestyle{empty}
@@ -82,5 +84,9 @@
Please make check payable to \textbf{<?lsmb company ?>}
+<?lsmb IF NOT loop.last ?>
+\pagebreak
+<?lsmb END ?>
+<?lsmb END ?>
\end{document}
<?lsmb END ?>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.