Revision 0e470b13
Von Bernd Bleßmann vor mehr als 9 Jahren hinzugefügt
SL/DO.pm | ||
---|---|---|
892 | 892 |
my $ic_cvar_configs = CVar->get_configs(module => 'IC'); |
893 | 893 |
my $project_cvar_configs = CVar->get_configs(module => 'Projects'); |
894 | 894 |
|
895 |
# get some values of parts from db on store them in extra array, |
|
896 |
# so that they can be sorted in later |
|
897 |
my %prepared_template_arrays = IC->prepare_parts_for_printing(myconfig => $myconfig, form => $form); |
|
898 |
my @prepared_arrays = keys %prepared_template_arrays; |
|
899 |
|
|
895 | 900 |
$form->{TEMPLATE_ARRAYS} = { }; |
896 |
IC->prepare_parts_for_printing(myconfig => $myconfig, form => $form); |
|
897 | 901 |
|
898 | 902 |
my @arrays = |
899 |
qw(runningnumber number description longdescription qty unit |
|
903 |
qw(runningnumber number description longdescription qty qty_nofmt unit
|
|
900 | 904 |
partnotes serialnumber reqdate projectnumber projectdescription |
901 |
weight lineweight
|
|
905 |
weight weight_nofmt lineweight lineweight_nofmt
|
|
902 | 906 |
si_runningnumber si_number si_description |
903 | 907 |
si_warehouse si_bin si_chargenumber si_bestbefore |
904 | 908 |
si_qty si_qty_nofmt si_unit); |
905 | 909 |
|
906 |
map { $form->{TEMPLATE_ARRAYS}->{$_} = [] } (@arrays); |
|
910 |
map { $form->{TEMPLATE_ARRAYS}->{$_} = [] } (@arrays, @prepared_arrays);
|
|
907 | 911 |
|
908 | 912 |
push @arrays, map { "ic_cvar_$_->{name}" } @{ $ic_cvar_configs }; |
909 | 913 |
push @arrays, map { "project_cvar_$_->{name}" } @{ $project_cvar_configs }; |
... | ... | |
919 | 923 |
next if (!$form->{"id_$i"}); |
920 | 924 |
|
921 | 925 |
if ($item->[1] ne $sameitem) { |
926 |
push(@{ $form->{TEMPLATE_ARRAYS}->{entry_type} }, 'partsgroup'); |
|
922 | 927 |
push(@{ $form->{TEMPLATE_ARRAYS}->{description} }, qq|$item->[1]|); |
923 | 928 |
$sameitem = $item->[1]; |
924 | 929 |
|
925 |
map({ push(@{ $form->{TEMPLATE_ARRAYS}->{$_} }, "") } grep({ $_ ne "description" && $_ !~ /^si_/} @arrays));
|
|
930 |
map({ push(@{ $form->{TEMPLATE_ARRAYS}->{$_} }, "") } grep({ $_ ne "description" && $_ !~ /^si_/} (@arrays, @prepared_arrays)));
|
|
926 | 931 |
map({ push(@{ $form->{TEMPLATE_ARRAYS}->{$_} }, []) } grep({ $_ =~ /^si_/} @arrays)); |
927 | 932 |
$si_position++; |
928 | 933 |
} |
... | ... | |
949 | 954 |
my $price_factor = $price_factors{$form->{"price_factor_id_$i"}} || { 'factor' => 1 }; |
950 | 955 |
my $project = $projects_by_id{$form->{"project_id_$i"}} || SL::DB::Project->new; |
951 | 956 |
|
957 |
push(@{ $form->{TEMPLATE_ARRAYS}{$_} }, $prepared_template_arrays{$_}[$i - 1]) for @prepared_arrays; |
|
958 |
|
|
959 |
push @{ $form->{TEMPLATE_ARRAYS}{entry_type} }, 'normal'; |
|
952 | 960 |
push @{ $form->{TEMPLATE_ARRAYS}{runningnumber} }, $position; |
953 | 961 |
push @{ $form->{TEMPLATE_ARRAYS}{number} }, $form->{"partnumber_$i"}; |
954 | 962 |
push @{ $form->{TEMPLATE_ARRAYS}{description} }, $form->{"description_$i"}; |
... | ... | |
1009 | 1017 |
|
1010 | 1018 |
while (my $ref = $h_pg->fetchrow_hashref("NAME_lc")) { |
1011 | 1019 |
if ($form->{groupitems} && $ref->{partsgroup} ne $sameitem) { |
1012 |
map({ push(@{ $form->{TEMPLATE_ARRAYS}->{$_} }, "") } grep({ $_ ne "description" && $_ !~ /^si_/} @arrays));
|
|
1020 |
map({ push(@{ $form->{TEMPLATE_ARRAYS}->{$_} }, "") } grep({ $_ ne "description" && $_ !~ /^si_/} (@arrays, @prepared_arrays)));
|
|
1013 | 1021 |
map({ push(@{ $form->{TEMPLATE_ARRAYS}->{$_} }, []) } grep({ $_ =~ /^si_/} @arrays)); |
1014 | 1022 |
$sameitem = ($ref->{partsgroup}) ? $ref->{partsgroup} : "--"; |
1023 |
push(@{ $form->{TEMPLATE_ARRAYS}->{entry_type} }, 'assembly-item-partsgroup'); |
|
1015 | 1024 |
push(@{ $form->{TEMPLATE_ARRAYS}->{description} }, $sameitem); |
1016 | 1025 |
$si_position++; |
1017 | 1026 |
} |
1018 | 1027 |
|
1019 |
push(@{ $form->{TEMPLATE_ARRAYS}->{"description"} }, $form->format_amount($myconfig, $ref->{qty} * $form->{"qty_$i"}) . qq| -- $ref->{partnumber}, $ref->{description}|); |
|
1020 |
map({ push(@{ $form->{TEMPLATE_ARRAYS}->{$_} }, "") } grep({ $_ ne "description" && $_ !~ /^si_/} @arrays)); |
|
1028 |
push(@{ $form->{TEMPLATE_ARRAYS}->{entry_type} }, 'assembly-item'); |
|
1029 |
push(@{ $form->{TEMPLATE_ARRAYS}->{description} }, $form->format_amount($myconfig, $ref->{qty} * $form->{"qty_$i"}) . qq| -- $ref->{partnumber}, $ref->{description}|); |
|
1030 |
map({ push(@{ $form->{TEMPLATE_ARRAYS}->{$_} }, "") } grep({ $_ ne "description" && $_ !~ /^si_/} (@arrays, @prepared_arrays))); |
|
1021 | 1031 |
map({ push(@{ $form->{TEMPLATE_ARRAYS}->{$_} }, []) } grep({ $_ =~ /^si_/} @arrays)); |
1022 | 1032 |
$si_position++; |
1023 | 1033 |
} |
SL/IC.pm | ||
---|---|---|
1721 | 1721 |
|
1722 | 1722 |
my %data = selectall_as_map($form, $dbh, $query, 'id', \@columns, @part_ids); |
1723 | 1723 |
|
1724 |
map { $form->{TEMPLATE_ARRAYS}{$_} = [] } (qw(make model), @columns); |
|
1724 |
my %template_arrays; |
|
1725 |
map { $template_arrays{$_} = [] } (qw(make model), @columns); |
|
1725 | 1726 |
|
1726 | 1727 |
foreach my $i (1 .. $rowcount) { |
1727 | 1728 |
my $id = $form->{"${prefix}${i}"}; |
... | ... | |
1729 | 1730 |
next if (!$id); |
1730 | 1731 |
|
1731 | 1732 |
foreach (@columns) { |
1732 |
push @{ $form->{TEMPLATE_ARRAYS}{$_} }, $data{$id}->{$_};
|
|
1733 |
push @{ $template_arrays{$_} }, $data{$id}->{$_};
|
|
1733 | 1734 |
} |
1734 | 1735 |
|
1735 |
push @{ $form->{TEMPLATE_ARRAYS}{make} }, [];
|
|
1736 |
push @{ $form->{TEMPLATE_ARRAYS}{model} }, [];
|
|
1736 |
push @{ $template_arrays{make} }, [];
|
|
1737 |
push @{ $template_arrays{model} }, [];
|
|
1737 | 1738 |
|
1738 | 1739 |
next if (!$makemodel{$id}); |
1739 | 1740 |
|
1740 | 1741 |
foreach my $ref (@{ $makemodel{$id} }) { |
1741 |
map { push @{ $form->{TEMPLATE_ARRAYS}{$_}->[-1] }, $ref->{$_} } qw(make model);
|
|
1742 |
map { push @{ $template_arrays{$_}->[-1] }, $ref->{$_} } qw(make model);
|
|
1742 | 1743 |
} |
1743 | 1744 |
} |
1744 | 1745 |
|
... | ... | |
1749 | 1750 |
my $id = $form->{"${prefix}${i}"}; |
1750 | 1751 |
next unless $id; |
1751 | 1752 |
|
1752 |
push @{ $form->{TEMPLATE_ARRAYS}{part_type} }, $parts_by_id{$id}->type;
|
|
1753 |
push @{ $template_arrays{part_type} }, $parts_by_id{$id}->type;
|
|
1753 | 1754 |
} |
1754 | 1755 |
|
1756 |
return %template_arrays; |
|
1755 | 1757 |
$main::lxdebug->leave_sub(); |
1756 | 1758 |
} |
1757 | 1759 |
|
SL/IS.pm | ||
---|---|---|
144 | 144 |
|
145 | 145 |
$form->{discount} = []; |
146 | 146 |
|
147 |
IC->prepare_parts_for_printing(myconfig => $myconfig, form => $form); |
|
147 |
# get some values of parts from db on store them in extra array, |
|
148 |
# so that they can be sorted in later |
|
149 |
my %prepared_template_arrays = IC->prepare_parts_for_printing(myconfig => $myconfig, form => $form); |
|
150 |
my @prepared_arrays = keys %prepared_template_arrays; |
|
148 | 151 |
|
149 | 152 |
my $ic_cvar_configs = CVar->get_configs(module => 'IC'); |
150 | 153 |
my $project_cvar_configs = CVar->get_configs(module => 'Projects'); |
151 | 154 |
|
152 | 155 |
my @arrays = |
153 |
qw(runningnumber number description longdescription qty ship unit bin
|
|
154 |
deliverydate_oe ordnumber_oe donumber_do transdate_oe validuntil
|
|
155 |
partnotes serialnumber reqdate sellprice listprice netprice
|
|
156 |
discount p_discount discount_sub nodiscount_sub
|
|
157 |
linetotal nodiscount_linetotal tax_rate projectnumber projectdescription
|
|
158 |
price_factor price_factor_name partsgroup weight lineweight);
|
|
156 |
qw(runningnumber number description longdescription qty qty_nofmt unit bin
|
|
157 |
deliverydate_oe ordnumber_oe donumber_do transdate_oe invnumber invdate
|
|
158 |
partnotes serialnumber reqdate sellprice sellprice_nofmt listprice listprice_nofmt netprice netprice_nofmt
|
|
159 |
discount discount_nofmt p_discount discount_sub discount_sub_nofmt nodiscount_sub nodiscount_sub_nofmt
|
|
160 |
linetotal linetotal_nofmt nodiscount_linetotal nodiscount_linetotal_nofmt tax_rate projectnumber projectdescription
|
|
161 |
price_factor price_factor_name partsgroup weight weight_nofmt lineweight lineweight_nofmt);
|
|
159 | 162 |
|
160 | 163 |
push @arrays, map { "ic_cvar_$_->{name}" } @{ $ic_cvar_configs }; |
161 | 164 |
push @arrays, map { "project_cvar_$_->{name}" } @{ $project_cvar_configs }; |
... | ... | |
164 | 167 |
|
165 | 168 |
my @payment_arrays = qw(payment paymentaccount paymentdate paymentsource paymentmemo); |
166 | 169 |
|
167 |
map { $form->{TEMPLATE_ARRAYS}->{$_} = [] } (@arrays, @tax_arrays, @payment_arrays); |
|
170 |
map { $form->{TEMPLATE_ARRAYS}->{$_} = [] } (@arrays, @tax_arrays, @payment_arrays, @prepared_arrays);
|
|
168 | 171 |
|
169 | 172 |
my $totalweight = 0; |
170 | 173 |
foreach $item (sort { $a->[1] cmp $b->[1] } @partsgroup) { |
171 | 174 |
$i = $item->[0]; |
172 | 175 |
|
173 | 176 |
if ($item->[1] ne $sameitem) { |
177 |
push(@{ $form->{TEMPLATE_ARRAYS}->{entry_type} }, 'partsgroup'); |
|
174 | 178 |
push(@{ $form->{TEMPLATE_ARRAYS}->{description} }, qq|$item->[1]|); |
175 | 179 |
$sameitem = $item->[1]; |
176 | 180 |
|
177 |
map({ push(@{ $form->{TEMPLATE_ARRAYS}->{$_} }, "") } grep({ $_ ne "description" } @arrays));
|
|
181 |
map({ push(@{ $form->{TEMPLATE_ARRAYS}->{$_} }, "") } grep({ $_ ne "description" } (@arrays, @prepared_arrays)));
|
|
178 | 182 |
} |
179 | 183 |
|
180 | 184 |
$form->{"qty_$i"} = $form->parse_amount($myconfig, $form->{"qty_$i"}); |
... | ... | |
198 | 202 |
|
199 | 203 |
my $price_factor = $price_factors{$form->{"price_factor_id_$i"}} || { 'factor' => 1 }; |
200 | 204 |
|
205 |
push(@{ $form->{TEMPLATE_ARRAYS}->{$_} }, $prepared_template_arrays{$_}[$i - 1]) for @prepared_arrays; |
|
206 |
|
|
207 |
push @{ $form->{TEMPLATE_ARRAYS}->{entry_type} }, 'normal'; |
|
201 | 208 |
push @{ $form->{TEMPLATE_ARRAYS}->{runningnumber} }, $position; |
202 | 209 |
push @{ $form->{TEMPLATE_ARRAYS}->{number} }, $form->{"partnumber_$i"}; |
203 | 210 |
push @{ $form->{TEMPLATE_ARRAYS}->{serialnumber} }, $form->{"serialnumber_$i"}; |
... | ... | |
357 | 364 |
|
358 | 365 |
while (my $ref = $sth->fetchrow_hashref('NAME_lc')) { |
359 | 366 |
if ($form->{groupitems} && $ref->{partsgroup} ne $sameitem) { |
360 |
map({ push(@{ $form->{TEMPLATE_ARRAYS}->{$_} }, "") } grep({ $_ ne "description" } @arrays));
|
|
367 |
map({ push(@{ $form->{TEMPLATE_ARRAYS}->{$_} }, "") } grep({ $_ ne "description" } (@arrays, @prepared_arrays)));
|
|
361 | 368 |
$sameitem = ($ref->{partsgroup}) ? $ref->{partsgroup} : "--"; |
369 |
push(@{ $form->{TEMPLATE_ARRAYS}->{entry_type} }, 'assembly-item-partsgroup'); |
|
362 | 370 |
push(@{ $form->{TEMPLATE_ARRAYS}->{description} }, $sameitem); |
363 | 371 |
} |
364 | 372 |
|
365 | 373 |
map { $form->{"a_$_"} = $ref->{$_} } qw(partnumber description); |
366 | 374 |
|
375 |
push(@{ $form->{TEMPLATE_ARRAYS}->{entry_type} }, 'assembly-item'); |
|
367 | 376 |
push(@{ $form->{TEMPLATE_ARRAYS}->{description} }, |
368 | 377 |
$form->format_amount($myconfig, $ref->{qty} * $form->{"qty_$i"} |
369 | 378 |
) |
370 | 379 |
. qq| -- $form->{"a_partnumber"}, $form->{"a_description"}|); |
371 |
map({ push(@{ $form->{TEMPLATE_ARRAYS}->{$_} }, "") } grep({ $_ ne "description" } @arrays));
|
|
380 |
map({ push(@{ $form->{TEMPLATE_ARRAYS}->{$_} }, "") } grep({ $_ ne "description" } (@arrays, @prepared_arrays)));
|
|
372 | 381 |
|
373 | 382 |
} |
374 | 383 |
$sth->finish; |
SL/OE.pm | ||
---|---|---|
1226 | 1226 |
|
1227 | 1227 |
$form->{discount} = []; |
1228 | 1228 |
|
1229 |
# get some values of parts from db on store them in extra array, |
|
1230 |
# so that they can be sorted in later |
|
1231 |
my %prepared_template_arrays = IC->prepare_parts_for_printing(myconfig => $myconfig, form => $form); |
|
1232 |
my @prepared_arrays = keys %prepared_template_arrays; |
|
1233 |
|
|
1229 | 1234 |
$form->{TEMPLATE_ARRAYS} = { }; |
1230 |
IC->prepare_parts_for_printing(myconfig => $myconfig, form => $form); |
|
1231 | 1235 |
|
1232 | 1236 |
my $ic_cvar_configs = CVar->get_configs(module => 'IC'); |
1233 | 1237 |
my $project_cvar_configs = CVar->get_configs(module => 'Projects'); |
1234 | 1238 |
|
1235 | 1239 |
my @arrays = |
1236 |
qw(runningnumber number description longdescription qty ship unit bin
|
|
1237 |
partnotes serialnumber reqdate sellprice listprice netprice
|
|
1238 |
discount p_discount discount_sub nodiscount_sub
|
|
1239 |
linetotal nodiscount_linetotal tax_rate projectnumber projectdescription
|
|
1240 |
price_factor price_factor_name partsgroup weight lineweight);
|
|
1240 |
qw(runningnumber number description longdescription qty qty_nofmt ship ship_nofmt unit bin
|
|
1241 |
partnotes serialnumber reqdate sellprice sellprice_nofmt listprice listprice_nofmt netprice netprice_nofmt
|
|
1242 |
discount discount_nofmt p_discount discount_sub discount_sub_nofmt nodiscount_sub nodiscount_sub_nofmt
|
|
1243 |
linetotal linetotal_nofmt nodiscount_linetotal nodiscount_linetotal_nofmt tax_rate projectnumber projectdescription
|
|
1244 |
price_factor price_factor_name partsgroup weight weight_nofmt lineweight lineweight_nofmt);
|
|
1241 | 1245 |
|
1242 | 1246 |
push @arrays, map { "ic_cvar_$_->{name}" } @{ $ic_cvar_configs }; |
1243 | 1247 |
push @arrays, map { "project_cvar_$_->{name}" } @{ $project_cvar_configs }; |
1244 | 1248 |
|
1245 | 1249 |
my @tax_arrays = qw(taxbase tax taxdescription taxrate taxnumber); |
1246 | 1250 |
|
1247 |
map { $form->{TEMPLATE_ARRAYS}->{$_} = [] } (@arrays, @tax_arrays); |
|
1251 |
map { $form->{TEMPLATE_ARRAYS}->{$_} = [] } (@arrays, @tax_arrays, @prepared_arrays);
|
|
1248 | 1252 |
|
1249 | 1253 |
my $totalweight = 0; |
1250 | 1254 |
my $sameitem = ""; |
... | ... | |
1252 | 1256 |
$i = $item->[0]; |
1253 | 1257 |
|
1254 | 1258 |
if ($item->[1] ne $sameitem) { |
1259 |
push(@{ $form->{TEMPLATE_ARRAYS}->{entry_type} }, 'partsgroup'); |
|
1255 | 1260 |
push(@{ $form->{TEMPLATE_ARRAYS}->{description} }, qq|$item->[1]|); |
1256 | 1261 |
$sameitem = $item->[1]; |
1257 | 1262 |
|
1258 |
map({ push(@{ $form->{TEMPLATE_ARRAYS}->{$_} }, "") } grep({ $_ ne "description" } @arrays));
|
|
1263 |
map({ push(@{ $form->{TEMPLATE_ARRAYS}->{$_} }, "") } grep({ $_ ne "description" } (@arrays, @prepared_arrays)));
|
|
1259 | 1264 |
} |
1260 | 1265 |
|
1261 | 1266 |
$form->{"qty_$i"} = $form->parse_amount($myconfig, $form->{"qty_$i"}); |
... | ... | |
1280 | 1285 |
|
1281 | 1286 |
my $price_factor = $price_factors{$form->{"price_factor_id_$i"}} || { 'factor' => 1 }; |
1282 | 1287 |
|
1288 |
push(@{ $form->{TEMPLATE_ARRAYS}->{$_} }, $prepared_template_arrays{$_}[$i - 1]) for @prepared_arrays; |
|
1289 |
|
|
1290 |
push @{ $form->{TEMPLATE_ARRAYS}->{entry_type} }, 'normal'; |
|
1283 | 1291 |
push @{ $form->{TEMPLATE_ARRAYS}->{runningnumber} }, $position; |
1284 | 1292 |
push @{ $form->{TEMPLATE_ARRAYS}->{number} }, $form->{"partnumber_$i"}; |
1285 | 1293 |
push @{ $form->{TEMPLATE_ARRAYS}->{description} }, $form->{"description_$i"}; |
... | ... | |
1420 | 1428 |
|
1421 | 1429 |
while (my $ref = $sth->fetchrow_hashref("NAME_lc")) { |
1422 | 1430 |
if ($form->{groupitems} && $ref->{partsgroup} ne $sameitem) { |
1423 |
map({ push(@{ $form->{TEMPLATE_ARRAYS}->{$_} }, "") } grep({ $_ ne "description" } @arrays));
|
|
1431 |
map({ push(@{ $form->{TEMPLATE_ARRAYS}->{$_} }, "") } grep({ $_ ne "description" } (@arrays, @prepared_arrays)));
|
|
1424 | 1432 |
$sameitem = ($ref->{partsgroup}) ? $ref->{partsgroup} : "--"; |
1433 |
push(@{ $form->{TEMPLATE_ARRAYS}->{entry_type} }, 'assembly-item-partsgroup'); |
|
1425 | 1434 |
push(@{ $form->{TEMPLATE_ARRAYS}->{description} }, $sameitem); |
1426 | 1435 |
} |
1427 | 1436 |
|
1437 |
push(@{ $form->{TEMPLATE_ARRAYS}->{entry_type} }, 'assembly-item'); |
|
1428 | 1438 |
push(@{ $form->{TEMPLATE_ARRAYS}->{description} }, $form->format_amount($myconfig, $ref->{qty} * $form->{"qty_$i"}) . qq|, $ref->{partnumber}, $ref->{description}|); |
1429 |
map({ push(@{ $form->{TEMPLATE_ARRAYS}->{$_} }, "") } grep({ $_ ne "description" } @arrays));
|
|
1439 |
map({ push(@{ $form->{TEMPLATE_ARRAYS}->{$_} }, "") } grep({ $_ ne "description" } (@arrays, @prepared_arrays)));
|
|
1430 | 1440 |
} |
1431 | 1441 |
$sth->finish; |
1432 | 1442 |
} |
Auch abrufbar als: Unified diff
Ausdruck Erzeugnisse mit Stückliste und Lieferantenartikelnummer repariert.
Betraf wohl auch andere Felder zu Artikeln, die vor der Aufbereitung des
TEMPLATE_ARRAYS aus der DB gelesen wurden. Diese werden jetzt richtig in
TEMPLATE_ARRAYS einsortiert.
Um auch die Einträge für Erzeugnis-Teile und Warengruppen (beim Gruppieren
der Waren) in den Druckvorlagen unterscheiden zu können, gibt es ein Feld
'entry_type', dass die Werte 'normal', 'partsgroup', 'assembly-item' und
'assembly-item-partsgroup' annehmen kann.