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) | .
$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} . '%');
$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.
# <input type="hidden" name="report_generator_hidden_transdateto" value="21.05.2010">
'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);
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";
$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();
};
-%]
</td>
</tr>
+ <tr>
+ <th align="right" nowrap>[% 'Customer Number' | $T8 %]</th>
+ <td><input name="customernumber" size="20"></td>
+ </tr>
<tr>
<th align=right nowrap>[% 'Department' | $T8 %]</th>
<td>
<td align=right><input name="l_headers" class=checkbox type=checkbox value="Y" checked></td>
<td nowrap>[% 'Headings' | $T8 %]</td>
</tr>
+ <tr>
+ <td align=right><input name="l_customernumber" class=checkbox type=checkbox value=Y checked></td>
+ <td nowrap>[% 'Customer Number' | $T8 %]</td>
+ </tr>
<tr>
<th align="right" nowrap>[% 'Decimalplaces' | $T8 %]</th>
<td colspan="4"><input name="decimalplaces" size="2" value="2"></td>