if ($form->{type} eq 'purchase_delivery_order') {
IR->retrieve_item(\%myconfig, $form);
if ($form->{type} eq 'purchase_delivery_order') {
IR->retrieve_item(\%myconfig, $form);
- if ($form->{discount}){ # Falls wir einen Lieferanten-/Kundenrabatt haben
- # und keinen anderen discount wert an $i ...
- $form->{"discount_$i"} ||= $form->{discount}*100; # ... nehmen wir diesen Rabatt
+ unless ($form->{"ordnumber"}) {
+ if ($form->{discount}) { # Falls wir einen Lieferanten-/Kundenrabatt haben
+ # und rabattfähig sind, dann
+ unless ($form->{"not_discountable_$i"}) {
+ $form->{"discount_$i"} = $form->{discount}*100; # ... nehmen wir diesen Rabatt
+ }
+ }
$vc_discount = $form->{vendor_discount};
} else {
IS->get_customer(\%myconfig, \%$form);
$vc_discount = $form->{vendor_discount};
} else {
IS->get_customer(\%myconfig, \%$form);
my $in_out = $form->{type} =~ /^sales/ ? 'out' : 'in';
my $sinfo = DO->unpack_stock_information('packed' => $form->{"stock_${in_out}_${i}"});
my $in_out = $form->{type} =~ /^sales/ ? 'out' : 'in';
my $sinfo = DO->unpack_stock_information('packed' => $form->{"stock_${in_out}_${i}"});
my $content = $form->format_amount_units('amount' => $sum * 1,
'part_unit' => $form->{"partunit_$i"},
'amount_unit' => $all_units->{$form->{"partunit_$i"}}->{base_unit},
'conv_units' => 'convertible_not_smaller',
'max_places' => 2);
my $content = $form->format_amount_units('amount' => $sum * 1,
'part_unit' => $form->{"partunit_$i"},
'amount_unit' => $all_units->{$form->{"partunit_$i"}}->{base_unit},
'conv_units' => 'convertible_not_smaller',
'max_places' => 2);
if (@{ $form->{ERRORS} }) {
push @{ $form->{ERRORS} }, $locale->text('The delivery order has not been marked as delivered. The warehouse contents have not changed.');
if (@{ $form->{ERRORS} }) {
push @{ $form->{ERRORS} }, $locale->text('The delivery order has not been marked as delivered. The warehouse contents have not changed.');
DO->transfer_in_out('direction' => 'in',
'requests' => \@all_requests);
DO->transfer_in_out('direction' => 'in',
'requests' => \@all_requests);
# if ($do_base_qty != $row_sum_base_qty) {
# push @{ $form->{ERRORS} }, $locale->text('Error in position #1: You must either assign no transfer at all or the full quantity of #2 #3.',
# if ($do_base_qty != $row_sum_base_qty) {
# push @{ $form->{ERRORS} }, $locale->text('Error in position #1: You must either assign no transfer at all or the full quantity of #2 #3.',
if (@{ $form->{ERRORS} }) {
push @{ $form->{ERRORS} }, $locale->text('The delivery order has not been marked as delivered. The warehouse contents have not changed.');
if (@{ $form->{ERRORS} }) {
push @{ $form->{ERRORS} }, $locale->text('The delivery order has not been marked as delivered. The warehouse contents have not changed.');
DO->transfer_in_out('direction' => 'out',
'requests' => \@all_requests);
DO->transfer_in_out('direction' => 'out',
'requests' => \@all_requests);