diff options
author | tetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46> | 2007-09-06 20:54:42 +0000 |
---|---|---|
committer | tetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46> | 2007-09-06 20:54:42 +0000 |
commit | 030b169a8f85ba045fb1c0385c49b3e41084289f (patch) | |
tree | 2514643066b0c099d1d53951a773b658aa61aeff /bin | |
parent | 3319160e3a08e39f3fdb356beaf240c4acc81268 (diff) |
Adjusting statements for batch printing (1789160)
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@1523 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 'bin')
-rw-r--r-- | bin/rp.pl | 66 |
1 files changed, 39 insertions, 27 deletions
@@ -2156,33 +2156,52 @@ sub print { 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'; - } - else { - $form->{"statement_1"} = 1; - $form->{"language_code_1"} = $language_code; - $form->{"curr_1"} = $curr; + + my $template = LedgerSMB::Template->new( + user => \%myconfig, + template => $form->{'formname'} || $form->{'type'}, + format => uc $form->{format} + ); + try { + $template->render({data => \@batch_data}); + $template->output($form); } - - RP->aging( \%myconfig, \%$form ); - - &print_form; + catch Error::Simple with { + my $E = shift; + $form->error( $E->stacktrace ); + }; $form->redirect( $locale->text('Statements sent to printer!') ) if ( $form->{media} !~ /(screen|email)/ ); @@ -2276,18 +2295,11 @@ sub print_form { $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; } } } |