Revision 4895d0c6
Von Moritz Bunkus vor fast 17 Jahren hinzugefügt
SL/WH.pm | ||
---|---|---|
# build the select clauses.
|
||
# take all the requested ones from the first hash and overwrite them from the out/in hashes if present.
|
||
for my $i ('trans', 'out', 'in') {
|
||
$select{$i} = join ', ', map { +/l_/; ($select_tokens{$i}{"$'"} || $select_tokens{'trans'}{"$'"}) . " AS r_$'" }
|
||
( grep( { !/qty$/ and /l_/ and $form->{$_} eq 'Y' } keys %$form), qw(l_parts_id l_qty l_partunit l_itime) );
|
||
$select{$i} = join ', ', map { +/^l_/; ($select_tokens{$i}{"$'"} || $select_tokens{'trans'}{"$'"}) . " AS r_$'" }
|
||
( grep( { !/qty$/ and /^l_/ and $form->{$_} eq 'Y' } keys %$form), qw(l_parts_id l_qty l_partunit l_itime) );
|
||
}
|
||
|
||
my $group_clause = join ", ", map { +/^l_/; "r_$'" }
|
||
( grep( { !/qty$/ and /l_/ and $form->{$_} eq 'Y' } keys %$form), qw(l_parts_id l_partunit l_itime) );
|
||
( grep( { !/qty$/ and /^l_/ and $form->{$_} eq 'Y' } keys %$form), qw(l_parts_id l_partunit l_itime) );
|
||
|
||
my $query =
|
||
qq|SELECT DISTINCT $select{trans}
|
||
... | ... | |
"warehousedescription" => "w.description",
|
||
"partunit" => "p.unit",
|
||
);
|
||
my $select_clause = join ', ', map { +/l_/; "$select_tokens{$'} AS $'" }
|
||
( grep( { !/qty/ and /l_/ and $form->{$_} eq 'Y' } keys %$form),
|
||
my $select_clause = join ', ', map { +/^l_/; "$select_tokens{$'} AS $'" }
|
||
( grep( { !/qty/ and /^l_/ and $form->{$_} eq 'Y' } keys %$form),
|
||
qw(l_parts_id l_qty l_partunit) );
|
||
|
||
my $group_clause = join ", ", map { +/^l_/; "$'" }
|
||
( grep( { !/qty/ and /l_/ and $form->{$_} eq 'Y' } keys %$form),
|
||
( grep( { !/qty/ and /^l_/ and $form->{$_} eq 'Y' } keys %$form),
|
||
qw(l_parts_id l_partunit) );
|
||
|
||
my $query =
|
Auch abrufbar als: Unified diff
Lagerbericht: Bei der Auswahl der Keys aus $form, die für die Auswahl der aus den Tabellen auszulesenden Spalten verwantwortlich sind, strenger sein. Der Key muss mit "l_" beginnen. Wird "l_" auch in der Mitte zugelassen, so schlägt dies fehl, wenn per ReportGenerator exportiert wird. Grund ist, dass diese Variablen auch nochmal mit dem Präfix "report_generator_hidden_*" in $form vorhanden sind. Dadurch würden Spalten selektiert, die es in der Datenbank nicht gibt.