my $dbh = $form->get_standard_dbh($myconfig);
- my $query = qq|SELECT id, partnumber, description, unit FROM parts WHERE id IN (| . join(', ', ('?') x scalar(@ids)) . qq|)|;
+ my $query = qq|SELECT * FROM parts WHERE id IN (| . join(', ', ('?') x scalar(@ids)) . qq|)|;
my $info = selectall_hashref_query($form, $dbh, $query, map { conv_i($_) } @ids);
if $form->{"id_$i"} && ($form->{type} =~ /^sales_/ || $form->{type} =~ /invoice/) && !$is_delivery_order;
# / marge calculations ending
+# calculate onhand
+ if ($form->{"id_$i"}) {
+ my $part = IC->get_basic_part_info(id => $form->{"id_$i"});
+ my $onhand_color = 'color="#ff0000"' if $part->{onhand} < $part->{rop};
+ push @ROW2, { value => sprintf "<b>%s</b> <font %s>%s %s</font>",
+ $locale->text('On Hand'),
+ $onhand_color,
+ $form->format_amount(\%myconfig, $part->{onhand}, 2),
+ $part->{unit}
+ };
+ }
+# / calculate onhand
+
my @hidden_vars;
if ($is_delivery_order) {
'Number missing in Row' => 'Nummer fehlt in Zeile',
'Oct' => 'Okt',
'October' => 'Oktober',
+ 'On Hand' => 'Auf Lager',
'OpenDocument/OASIS' => 'OpenDocument/OASIS',
'Order Date missing!' => 'Auftragsdatum fehlt!',
'Order Number missing!' => 'Auftragsnummer fehlt!',
'Number missing in Row' => 'Nummer fehlt in Zeile',
'Oct' => 'Okt',
'October' => 'Oktober',
+ 'On Hand' => 'Auf Lager',
'Open' => 'Offen',
'OpenDocument/OASIS' => 'OpenDocument/OASIS',
'Order' => 'Auftrag',
'Number missing in Row' => 'Nummer fehlt in Zeile',
'Oct' => 'Okt',
'October' => 'Oktober',
+ 'On Hand' => 'Auf Lager',
'OpenDocument/OASIS' => 'OpenDocument/OASIS',
'Order Date missing!' => 'Auftragsdatum fehlt!',
'Order Number missing!' => 'Auftragsnummer fehlt!',
'Number missing in Row' => 'Nummer fehlt in Zeile',
'Oct' => 'Okt',
'October' => 'Oktober',
+ 'On Hand' => 'Auf Lager',
'OpenDocument/OASIS' => 'OpenDocument/OASIS',
'Order Date' => 'Auftragsdatum',
'Order Date missing!' => 'Auftragsdatum fehlt!',
'Number missing in Row' => 'Nummer fehlt in Zeile',
'Oct' => 'Okt',
'October' => 'Oktober',
+ 'On Hand' => 'Auf Lager',
'OpenDocument/OASIS' => 'OpenDocument/OASIS',
'Order' => 'Auftrag',
'Order Date' => 'Auftragsdatum',
'Number missing in Row' => 'Nummer fehlt in Zeile',
'Oct' => 'Okt',
'October' => 'Oktober',
+ 'On Hand' => 'Auf Lager',
'Only due follow-ups' => 'Nur fällige Wiedervorlagen',
'Open' => 'Offen',
'OpenDocument/OASIS' => 'OpenDocument/OASIS',
'Number missing in Row' => 'Nummer fehlt in Zeile',
'Oct' => 'Okt',
'October' => 'Oktober',
+ 'On Hand' => 'Auf Lager',
'Open' => 'Offen',
'OpenDocument/OASIS' => 'OpenDocument/OASIS',
'Order' => 'Auftrag',
'Number missing in Row' => 'Nummer fehlt in Zeile',
'Oct' => 'Okt',
'October' => 'Oktober',
+ 'On Hand' => 'Auf Lager',
'Only due follow-ups' => 'Nur fällige Wiedervorlagen',
'Open' => 'Offen',
'OpenDocument/OASIS' => 'OpenDocument/OASIS',