Revision fd2e0902
Von Martin Helmling martin.helmling@octosoft.eu vor fast 8 Jahren hinzugefügt
SL/Helper/GlAttachments.pm | ||
---|---|---|
1 |
# |
|
2 |
# Helper for General Ledger Reports |
|
3 |
# |
|
4 |
# 1. Fetch the Count of PDF-Documents of one item of a General Ledger Report |
|
5 |
# 2. Append the contents of all items of a General Ledger Report |
|
6 |
|
|
7 |
package SL::Helper::GlAttachments; |
|
8 |
|
|
9 |
use strict; |
|
10 |
|
|
11 |
use Exporter 'import'; |
|
12 |
our @EXPORT_OK = qw(count_gl_attachments append_gl_pdf_attachments); |
|
13 |
our %EXPORT_TAGS = ( |
|
14 |
all => \@EXPORT_OK, |
|
15 |
); |
|
16 |
use SL::File; |
|
17 |
|
|
18 |
my %gl_types = ( |
|
19 |
'ar' => 'invoice', |
|
20 |
'ap' => 'purchase_invoice', |
|
21 |
'gl' => 'gl_transaction', |
|
22 |
); |
|
23 |
|
|
24 |
# |
|
25 |
# Fetch the Count of PDF-Documents with are related to the $id parameter |
|
26 |
# The parameter $gltype may be 'ar','ap' or 'gl'. |
|
27 |
# |
|
28 |
sub count_gl_pdf_attachments { |
|
29 |
my ($self,$id,$gltype) = @_; |
|
30 |
return SL::File->get_all_count(object_id => $id, |
|
31 |
object_type => $gl_types{$gltype}, |
|
32 |
mime_type => 'application/pdf', |
|
33 |
); |
|
34 |
} |
|
35 |
|
|
36 |
# Append the contents of all PDF-Documents to the base $content |
|
37 |
# This Method is only used in SL/Reportgenerator.pm if the $form->{GD} array is set. |
|
38 |
# The elements of the array need the two elements $ref->{type},$ref->{id} |
|
39 |
# |
|
40 |
sub append_gl_pdf_attachments { |
|
41 |
my ($self,$form,$content) = @_; |
|
42 |
my @filelist; |
|
43 |
foreach my $ref (@{ $form->{GL} }) { |
|
44 |
my @files = SL::File->get_all(object_id => $ref->{id}, |
|
45 |
object_type => $gl_types{$ref->{type}}, |
|
46 |
mime_type => 'application/pdf', |
|
47 |
); |
|
48 |
push @filelist, $_->get_file for @files; |
|
49 |
} |
|
50 |
return $self->merge_pdfs(file_names => \@filelist , inp_content => $content ); |
|
51 |
} |
|
52 |
|
|
53 |
1; |
|
54 |
|
|
55 |
__END__ |
|
56 |
|
|
57 |
=encoding utf-8 |
|
58 |
|
|
59 |
=head1 NAME |
|
60 |
|
|
61 |
SL::Helper::GlAttachments - Helper for General Ledger Reports |
|
62 |
|
|
63 |
=head1 SYNOPSIS |
|
64 |
|
|
65 |
$self->count_gl_pdf_attachments($ref->{id},$ref->{type}); |
|
66 |
$self->append_gl_pdf_attachments($form,$base_content); |
|
67 |
|
|
68 |
|
|
69 |
=head1 DESCRIPTION |
|
70 |
|
|
71 |
Helper for General Ledger Reports |
|
72 |
|
|
73 |
1. Fetch the Count of PDF-Documents of one item of a General Ledger Report |
|
74 |
|
|
75 |
2. Append the contents of all items of a General Ledger Report |
|
76 |
|
|
77 |
|
|
78 |
=head1 METHODS |
|
79 |
|
|
80 |
=head2 C<count_gl_pdf_attachments> |
|
81 |
|
|
82 |
count_gl_pdf_attachments($id,$type); |
|
83 |
|
|
84 |
Fetch the Count of PDF-Documents with are related to the $id parameter |
|
85 |
The parameter $type may be 'ar','ap' or 'gl'. |
|
86 |
|
|
87 |
=head2 C<append_gl_pdf_attachments> |
|
88 |
|
|
89 |
append_gl_pdf_attachments($form,$content); |
|
90 |
|
|
91 |
Append the contents of all PDF-Documents to the base $content |
|
92 |
This Method is only used in SL/Reportgenerator.pm if the $form->{GD} array is set. |
|
93 |
The elements of the array need the two elements $ref->{type},$ref->{id} |
|
94 |
|
|
95 |
=head1 AUTHOR |
|
96 |
|
|
97 |
Martin Helmling E<lt>martin.helmling@opendynamic.deE<gt> |
|
98 |
|
|
99 |
|
|
100 |
=cut |
|
101 |
|
SL/ReportGenerator.pm | ||
---|---|---|
7 | 7 |
#use PDF::Table; |
8 | 8 |
|
9 | 9 |
use strict; |
10 |
use SL::Helper::GlAttachments qw(append_gl_pdf_attachments); |
|
11 |
use SL::Helper::CreatePDF qw(merge_pdfs); |
|
10 | 12 |
|
11 | 13 |
# Cause locales.pl to parse these files: |
12 | 14 |
# parse_html_template('report_generator/html_report') |
... | ... | |
656 | 658 |
|
657 | 659 |
my $content = $pdf->stringify(); |
658 | 660 |
|
661 |
$main::lxdebug->message(LXDebug->DEBUG2(),"addattachments ?? =".$form->{report_generator_addattachments}." GL=".$form->{GL}); |
|
662 |
if ( $form->{report_generator_addattachments} eq 'yes' && $form->{GL}) { |
|
663 |
$content = $self->append_gl_pdf_attachments($form,$content); |
|
664 |
} |
|
665 |
|
|
659 | 666 |
my $printer_command; |
660 | 667 |
if ($pdfopts->{print} && $pdfopts->{printer_id}) { |
661 | 668 |
$form->{printer_id} = $pdfopts->{printer_id}; |
bin/mozilla/gl.pl | ||
---|---|---|
48 | 48 |
use SL::DBUtils qw(selectrow_query selectall_hashref_query); |
49 | 49 |
use SL::Webdav; |
50 | 50 |
use SL::Locale::String qw(t8); |
51 |
use SL::Helper::GlAttachments qw(count_gl_attachments); |
|
51 | 52 |
|
52 | 53 |
require "bin/mozilla/common.pl"; |
53 | 54 |
require "bin/mozilla/reportgenerator.pl"; |
... | ... | |
411 | 412 |
|
412 | 413 |
my @columns = qw( |
413 | 414 |
gldate transdate id reference description |
414 |
notes source debit debit_accno
|
|
415 |
notes source doccnt debit debit_accno
|
|
415 | 416 |
credit credit_accno debit_tax debit_tax_accno |
416 | 417 |
credit_tax credit_tax_accno projectnumbers balance employee |
417 | 418 |
); |
... | ... | |
451 | 452 |
$form->{l_datesort} = 'Y'; |
452 | 453 |
$form->{l_debit_tax_accno} = 'Y'; |
453 | 454 |
$form->{l_balance} = $form->{accno} ? 'Y' : ''; |
455 |
$form->{l_doccnt} = $form->{l_source} ? 'Y' : ''; |
|
454 | 456 |
|
455 | 457 |
my %column_defs = ( |
456 | 458 |
'id' => { 'text' => $locale->text('ID'), }, |
... | ... | |
458 | 460 |
'gldate' => { 'text' => $locale->text('Booking Date'), }, |
459 | 461 |
'reference' => { 'text' => $locale->text('Reference'), }, |
460 | 462 |
'source' => { 'text' => $locale->text('Source'), }, |
463 |
'doccnt' => { 'text' => $locale->text('Document Count'), }, |
|
461 | 464 |
'description' => { 'text' => $locale->text('Description'), }, |
462 | 465 |
'notes' => { 'text' => $locale->text('Notes'), }, |
463 | 466 |
'debit' => { 'text' => $locale->text('Debit'), }, |
... | ... | |
493 | 496 |
$report->set_columns(%column_defs); |
494 | 497 |
$report->set_column_order(@columns); |
495 | 498 |
|
496 |
$report->set_export_options('generate_report', @hidden_variables, qw(sort sortdir)); |
|
499 |
$form->{l_attachments} = 'Y'; |
|
500 |
$report->set_export_options('generate_report', @hidden_variables, qw(sort sortdir l_attachments)); |
|
497 | 501 |
|
498 | 502 |
$report->set_sort_indicator($form->{sort} eq 'accno' ? 'debit_accno' : $form->{sort}, $form->{sortdir}); |
499 | 503 |
|
... | ... | |
542 | 546 |
my $row = { }; |
543 | 547 |
map { $row->{$_} = { 'data' => '', 'align' => $column_alignment{$_} } } @columns; |
544 | 548 |
|
549 |
if ( $form->{l_doccnt} ) { |
|
550 |
$row->{doccnt}->{data} = SL::Helper::GlAttachments->count_gl_pdf_attachments($ref->{id},$ref->{type}); |
|
551 |
} |
|
552 |
|
|
545 | 553 |
my $sh = ""; |
546 | 554 |
if ($form->{balance} < 0) { |
547 | 555 |
$sh = " S"; |
bin/mozilla/reportgenerator.pl | ||
---|---|---|
64 | 64 |
$form->{copies} = max $myconfig{copies} * 1, 1; |
65 | 65 |
|
66 | 66 |
my $allow_font_selection = 1; |
67 |
my $allow_attachments = 0; |
|
67 | 68 |
eval { require PDF::API2; }; |
68 | 69 |
$allow_font_selection = 0 if ($@); |
70 |
$allow_attachments = 1 if $form->{report_generator_hidden_l_attachments}; |
|
69 | 71 |
|
70 | 72 |
$form->{title} = $locale->text('PDF export -- options'); |
71 | 73 |
$form->header(); |
72 | 74 |
print $form->parse_html_template('report_generator/pdf_export_options', { 'HIDDEN' => \@form_values, |
75 |
'ALLOW_ATTACHMENTS' => $allow_attachments, |
|
73 | 76 |
'ALLOW_FONT_SELECTION' => $allow_font_selection, }); |
74 | 77 |
|
75 | 78 |
$main::lxdebug->leave_sub(); |
locale/de/all | ||
---|---|---|
992 | 992 |
'Do you want to set the account number "#1" to "#2" and the name "#3" to "#4"?' => 'Soll die Kontonummer "#1" zu "#2" und den Name "#3" zu "#4" geändert werden?', |
993 | 993 |
'Do you want to store the existing onhand values into a new warehouse?' => 'Möchten Sie die vorhandenen Mengendaten in ein Lager übertragen?', |
994 | 994 |
'Document' => 'Dokument', |
995 |
'Document Count' => 'Anz. PDF Belege', |
|
995 | 996 |
'Document Project (database ID)' => 'Projektnummer des Belegs (Datenbank-ID)', |
996 | 997 |
'Document Project (description)' => 'Projektnummer des Belegs (Beschreibung)', |
997 | 998 |
'Document Project (number)' => 'Projektnummer des Belegs', |
... | ... | |
1287 | 1288 |
'Export Stammdaten' => 'Export Stammdaten', |
1288 | 1289 |
'Export as CSV' => 'Als CSV exportieren', |
1289 | 1290 |
'Export as PDF' => 'Als PDF exportieren', |
1291 |
'Export as PDF with attachments' => 'Als PDF mit Anhängen exportieren', |
|
1290 | 1292 |
'Export date' => 'Exportdatum', |
1291 | 1293 |
'Export date from' => 'Exportdatum von', |
1292 | 1294 |
'Export date to' => 'Exportdatum bis', |
... | ... | |
3682 | 3684 |
'found' => 'Gefunden', |
3683 | 3685 |
'found_br' => 'Gef.', |
3684 | 3686 |
'from (time)' => 'von', |
3685 |
'general_ledger_list' => 'buchungsjournal',
|
|
3687 |
'general_ledger_list' => 'Buchungsjournal',
|
|
3686 | 3688 |
'generate cb/ob transactions for selected charts' => 'Buchungen erstellen', |
3687 | 3689 |
'gobd-#1-#2.zip' => 'gobd-#1-#2.zip', |
3688 | 3690 |
'h' => 'h', |
templates/webpages/report_generator/pdf_export_options.html | ||
---|---|---|
14 | 14 |
|
15 | 15 |
<input type="hidden" name="report_generator_pdf_options_set" value="1"> |
16 | 16 |
<input type="hidden" name="report_generator_dispatch_to" value=""> |
17 |
<input type="hidden" name="report_generator_addattachments" value=""> |
|
17 | 18 |
|
18 | 19 |
<table> |
19 | 20 |
<tr> |
... | ... | |
134 | 135 |
[%- ELSE %] |
135 | 136 |
<p> |
136 | 137 |
<input type="hidden" name="action" value="report_generator_dispatcher"> |
137 |
<input type="submit" class="submit" onclick="submit_report_generator_form('report_generator_export_as_pdf')" value="[% 'Export as PDF' | $T8 %]"> |
|
138 |
<input type="submit" class="submit" onclick="submit_report_generator_form('report_generator_export_as_pdf','')" value="[% 'Export as PDF' | $T8 %]"> |
|
139 |
[%- IF ALLOW_ATTACHMENTS %] |
|
140 |
<input type="submit" class="submit" |
|
141 |
onclick="submit_report_generator_form('report_generator_export_as_pdf','yes')" |
|
142 |
value="[% 'Export as PDF with attachments' | $T8 %]"> |
|
143 |
[%- END %] |
|
138 | 144 |
<input type="submit" class="submit" onclick="submit_report_generator_form('report_generator_back')" value="[% 'Back' | $T8 %]"> |
139 | 145 |
</p> |
140 | 146 |
<script type="text/javascript"><!-- |
141 |
function submit_report_generator_form(nextsub) { |
|
147 |
function submit_report_generator_form(nextsub,att) {
|
|
142 | 148 |
document.report_generator_form.report_generator_dispatch_to.value = nextsub; |
149 |
document.report_generator_form.report_generator_addattachments.value = att; |
|
143 | 150 |
document.report_generator_form.submit(); |
144 | 151 |
} // --> |
145 | 152 |
</script> |
Auch abrufbar als: Unified diff
Dateimanagement: PDF Buchungsjournal mit Anhängen der Buchungen
Optinal kann beim Erzeugen eines PDF alle an den einzelnen Buchungen
angehängte PDF-Belege/Dokumente angehängt werden.
In der HTML/CSV/PDF-Tabelle gibt es eine weitere Spalte über die Anzahl der Belege.
Somit kann gesehen werden wo noch Belege fehlen.
Die Spalte wird implizit dazugeschaltet wenn "Beleg" in der Liste miterscheinen soll.
Die zusätzlichen Methoden ist in einem Helper ausgelagert.