Revision 480d9a56
Von Moritz Bunkus vor mehr als 16 Jahren hinzugefügt
SL/DO.pm | ||
---|---|---|
161 | 161 |
my $sth = prepare_query($form, $dbh, $query); |
162 | 162 |
|
163 | 163 |
foreach my $dord (@{ $form->{DO} }) { |
164 |
next unless ($dord->{ordnumber}); |
|
164 | 165 |
do_statement($form, $sth, $query, $dord->{ordnumber}); |
165 | 166 |
($dord->{oe_id}) = $sth->fetchrow_array(); |
166 | 167 |
} |
... | ... | |
903 | 904 |
$main::lxdebug->leave_sub(); |
904 | 905 |
} |
905 | 906 |
|
907 |
sub get_shipped_qty { |
|
908 |
$main::lxdebug->enter_sub(); |
|
909 |
|
|
910 |
my $self = shift; |
|
911 |
my %params = @_; |
|
912 |
|
|
913 |
Common::check_params(\%params, qw(type ordnumber)); |
|
914 |
|
|
915 |
my $myconfig = \%main::myconfig; |
|
916 |
my $form = $main::form; |
|
917 |
|
|
918 |
my $dbh = $params{dbh} || $form->get_standard_dbh($myconfig); |
|
919 |
|
|
920 |
my $notsales = $params{type} eq 'sales' ? '' : 'NOT'; |
|
921 |
|
|
922 |
my $query = |
|
923 |
qq|SELECT doi.parts_id, doi.qty, doi.unit, p.unit AS partunit |
|
924 |
FROM delivery_order_items doi |
|
925 |
LEFT JOIN delivery_orders o ON (doi.delivery_order_id = o.id) |
|
926 |
LEFT JOIN parts p ON (doi.parts_id = p.id) |
|
927 |
WHERE ($notsales o.is_sales) |
|
928 |
AND (o.ordnumber = ?)|; |
|
929 |
|
|
930 |
my %ship = (); |
|
931 |
my $entries = selectall_hashref_query($form, $dbh, $query, $params{ordnumber}); |
|
932 |
my $all_units = AM->retrieve_all_units(); |
|
933 |
|
|
934 |
foreach my $entry (@{ $entries }) { |
|
935 |
$entry->{qty} *= $all_units->{$entry->{unit}}->{factor} / $all_units->{$entry->{partunit}}->{factor}; |
|
936 |
|
|
937 |
if (!$ship{$entry->{parts_id}}) { |
|
938 |
$ship{$entry->{parts_id}} = $entry; |
|
939 |
} else { |
|
940 |
$ship{$entry->{parts_id}}->{qty} += $entry->{qty}; |
|
941 |
} |
|
942 |
} |
|
943 |
|
|
944 |
$main::lxdebug->leave_sub(); |
|
945 |
|
|
946 |
return %ship; |
|
947 |
} |
|
948 |
|
|
906 | 949 |
1; |
Auch abrufbar als: Unified diff
Anzeige der bereits gelieferten Menge in Aufträgen im Ein- und Verkauf.