From 7e4b86b179adfce5575093004846b11a61eb65ac Mon Sep 17 00:00:00 2001 From: "G. Richardson" Date: Thu, 19 May 2011 14:25:51 +0200 Subject: [PATCH] VK Bericht um Filter nach Kundennummer erweitert MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Kundennummer kann zusätzlich als Spalte ausgegeben werden. --- SL/VK.pm | 6 +++++- bin/mozilla/vk.pl | 10 +++++++--- templates/webpages/vk/search_invoice.html | 8 ++++++++ 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/SL/VK.pm b/SL/VK.pm index 458c35158..13c7d7f99 100644 --- a/SL/VK.pm +++ b/SL/VK.pm @@ -51,7 +51,7 @@ sub invoice_transactions { my @values; my $query = - qq|SELECT cus.name,ar.invnumber,ar.id,ar.transdate,p.partnumber,i.parts_id,i.qty,i.price_factor,i.discount,i.description,i.lastcost,i.sellprice,i.marge_total,i.marge_percent,i.unit | . + qq|SELECT cus.name,cus.customernumber,ar.invnumber,ar.id,ar.transdate,p.partnumber,i.parts_id,i.qty,i.price_factor,i.discount,i.description,i.lastcost,i.sellprice,i.marge_total,i.marge_percent,i.unit | . qq|FROM invoice i | . qq|join ar on (i.trans_id = ar.id) | . qq|join parts p on (i.parts_id = p.id) | . @@ -71,6 +71,10 @@ sub invoice_transactions { $where .= " AND ar.customer_id = ?"; push(@values, $form->{customer_id}); }; + if ($form->{customernumber}) { + $where .= qq| AND cus.customernumber = ? |; + push(@values, $form->{customernumber}); + } if ($form->{partnumber}) { $where .= qq| AND (p.partnumber ILIKE ?)|; push(@values, '%' . $form->{partnumber} . '%'); diff --git a/bin/mozilla/vk.pl b/bin/mozilla/vk.pl index 652a0cd24..f7335a361 100644 --- a/bin/mozilla/vk.pl +++ b/bin/mozilla/vk.pl @@ -125,12 +125,12 @@ sub invoice_transactions { $form->{title} = $locale->text('Sales Report'); @columns = - qw(description invnumber partnumber parts_id transdate qty unit sellprice sellprice_total discount lastcost lastcost_total marge_total marge_percent); + qw(description invnumber transdate customernumber partnumber transdate qty unit sellprice sellprice_total discount lastcost lastcost_total marge_total marge_percent); # hidden variables für pdf/csv export übergeben # einmal mit l_ um zu bestimmen welche Spalten ausgegeben werden sollen # einmal optionen für die Überschrift (z.B. transdatefrom, partnumber, ...) - my @hidden_variables = (qw(l_headers l_subtotal l_total transdatefrom transdateto decimalplaces customer customername customer_id department partnumber description project_id), "$form->{db}number", map { "l_$_" } @columns); + my @hidden_variables = (qw(l_headers l_subtotal l_total l_customernumber transdatefrom transdateto decimalplaces customer customername customer_id department partnumber description project_id customernumber), "$form->{db}number", map { "l_$_" } @columns); my @hidden_nondefault = grep({ $form->{$_} } @hidden_variables); # Variablen werden dann als Hidden Variable mitgegeben, z.B. # @@ -152,6 +152,7 @@ sub invoice_transactions { 'lastcost' => { 'text' => $locale->text('Purchase price'), }, 'marge_total' => { 'text' => $locale->text('Sales margin'), }, 'marge_percent' => { 'text' => $locale->text('Sales margin %'), }, + 'customernumber' => { 'text' => $locale->text('Customer Number'), }, ); my %column_alignment = map { $_ => 'right' } qw(lastcost sellprice sellprice_total lastcost_total unit discount marge_total marge_percent qty); @@ -167,6 +168,9 @@ sub invoice_transactions { if ($form->{customer}) { push @options, $locale->text('Customer') . " : $form->{customername}"; } + if ($form->{customernumber}) { + push @options, $locale->text('Customer Number') . " : $form->{customernumber}"; + } if ($form->{department}) { my ($department) = split /--/, $form->{department}; push @options, $locale->text('Department') . " : $department"; @@ -335,7 +339,7 @@ sub invoice_transactions { $name = 'name'; }; - if ($form->{l_subtotal} eq 'Y' ) { + if ($form->{l_subtotal} eq 'Y') { push @{ $row_set }, create_subtotal_row_invoice(\%subtotals2, \@columns, \%column_alignment, \@subtotal_columns, 'listsubsortsubtotal', $ar->{$name}) ; push @{ $row_set }, insert_empty_row(); }; diff --git a/templates/webpages/vk/search_invoice.html b/templates/webpages/vk/search_invoice.html index 70815b58c..098cd40fb 100644 --- a/templates/webpages/vk/search_invoice.html +++ b/templates/webpages/vk/search_invoice.html @@ -38,6 +38,10 @@ -%] + + [% 'Customer Number' | $T8 %] + + [% 'Department' | $T8 %] @@ -140,6 +144,10 @@ [% 'Headings' | $T8 %] + + + [% 'Customer Number' | $T8 %] + [% 'Decimalplaces' | $T8 %] -- 2.20.1