X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FOE.pm;h=a2dea99ec36199ba994edd1d70f4cb64038e38d0;hb=2fe6237c8b09d2f5a83145673c15be84bdfadf8a;hp=a51d0cb2eb313ac4f002ee2c3d3d4d430513f930;hpb=65d2537d658b99b005a18c6663bc1293b41a1d83;p=kivitendo-erp.git diff --git a/SL/OE.pm b/SL/OE.pm index a51d0cb2e..a2dea99ec 100644 --- a/SL/OE.pm +++ b/SL/OE.pm @@ -1279,7 +1279,6 @@ sub order_details { push(@project_ids, $form->{"globalproject_id"}) if ($form->{"globalproject_id"}); $form->get_lists('price_factors' => 'ALL_PRICE_FACTORS'); - $form->{ALL_DEPARTMENTS} = SL::DB::Manager::Department->get_all; my %price_factors; foreach my $pfac (@{ $form->{ALL_PRICE_FACTORS} }) { @@ -1320,6 +1319,7 @@ sub order_details { # so that they can be sorted in later my %prepared_template_arrays = IC->prepare_parts_for_printing(myconfig => $myconfig, form => $form); my @prepared_arrays = keys %prepared_template_arrays; + my @separate_totals = qw(non_separate_subtotal); $form->{TEMPLATE_ARRAYS} = { }; @@ -1426,6 +1426,17 @@ sub order_details { push @{ $form->{TEMPLATE_ARRAYS}->{discount_nofmt} }, ($discount != 0) ? $discount * -1 : ''; push @{ $form->{TEMPLATE_ARRAYS}->{p_discount} }, $form->{"discount_$i"}; + if ( $prepared_template_arrays{separate}[$i - 1] ) { + my $pabbr = $prepared_template_arrays{separate}[$i - 1]; + if ( ! $form->{"separate_${pabbr}_subtotal"} ) { + push @separate_totals , "separate_${pabbr}_subtotal"; + $form->{"separate_${pabbr}_subtotal"} = 0; + } + $form->{"separate_${pabbr}_subtotal"} += $linetotal; + } else { + $form->{non_separate_subtotal} += $linetotal; + } + $form->{ordtotal} += $linetotal; $form->{nodiscount_total} += $nodiscount_linetotal; $form->{discount_total} += $discount; @@ -1494,7 +1505,7 @@ sub order_details { $tax_rate = $taxrate * 100; push(@{ $form->{TEMPLATE_ARRAYS}->{tax_rate} }, qq|$tax_rate|); - if ($form->{"assembly_$i"}) { + if ($form->{"part_type_$i"} eq 'assembly') { $sameitem = ""; # get parts and push them onto the stack @@ -1595,10 +1606,12 @@ sub order_details { $form->{username} = $myconfig->{name}; + $form->{department} = SL::DB::Manager::Department->find_by(id => $form->{department_id})->description if $form->{department_id}; $form->{delivery_term} = SL::DB::Manager::DeliveryTerm->find_by(id => $form->{delivery_term_id} || undef); $form->{delivery_term}->description_long($form->{delivery_term}->translated_attribute('description_long', $form->{language_id})) if $form->{delivery_term} && $form->{language_id}; $form->{order} = SL::DB::Manager::Order->find_by(id => $form->{id}) if $form->{id}; + $form->{$_} = $form->format_amount($myconfig, $form->{$_}, 2) for @separate_totals; $main::lxdebug->leave_sub(); }