X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fio.pl;h=022f039ee5106dda5168e6c3bcda2cbbfed544a3;hb=91a33368cea2f0c618b59fa533ea24c94e443104;hp=0e10b22122b762a657c421c8a71e5abf8962d1c0;hpb=d0535d474013611f57691dee2e4542115a4f0123;p=kivitendo-erp.git diff --git a/bin/mozilla/io.pl b/bin/mozilla/io.pl index 0e10b2212..022f039ee 100644 --- a/bin/mozilla/io.pl +++ b/bin/mozilla/io.pl @@ -341,7 +341,19 @@ sub display_row { $form->{"marge_percent_$i"} = 0; my $marge_color; - my $real_sellprice = $linetotal; + my $real_sellprice; + if ( $form->{taxincluded} and $form->{"qty_$i"} * 1 and $form->{$form->{"taxaccounts_$i"} . "_rate"} * 1) { + # if we use taxincluded we need to calculate the marge from the net_value + # all the marge calculations are based on linetotal which we need to + # convert to net first + + # there is no direct form value for the tax_rate of the item, but + # form->{taxaccounts_$i} gives the tax account (e.g. 3806) and 3806_rate + # gives the tax percentage (e.g. 0.19) + $real_sellprice = $linetotal / (1 + $form->{$form->{"taxaccounts_$i"} . "_rate"}); + } else { + $real_sellprice = $linetotal; + }; my $real_lastcost = $form->{"lastcost_$i"} * $form->{"qty_$i"} / ( $form->{"marge_price_factor_$i"} || 1 ); my $marge_percent_warn = $myconfig{marge_percent_warn} * 1 || 15; my $marge_adjust_credit_note = $form->{type} eq 'credit_note' ? -1 : 1; @@ -388,7 +400,7 @@ sub display_row { if ($is_delivery_order) { map { $form->{"${_}_${i}"} = $form->format_amount(\%myconfig, $form->{"${_}_${i}"}) } qw(sellprice discount lastcost); - push @hidden_vars, qw(sellprice discount not_discountable price_factor_id lastcost); + push @hidden_vars, qw(sellprice discount not_discountable price_factor_id lastcost pricegroup_id); push @hidden_vars, "stock_${stock_in_out}_sum_qty", "stock_${stock_in_out}"; } @@ -543,6 +555,11 @@ sub item_selected { $form->{"sellprice_$i"} = $form->round_amount($form->{"sellprice_$i"}, $decimalplaces); } + + # tradediscount + if ($::form->{tradediscount}) { + $::form->{"sellprice_$i"} *= 1 - $::form->{tradediscount}; + } } map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) } @@ -945,6 +962,9 @@ sub edit_e_mail { $form->{"email"} = $form->{"cp_email"} if $form->{"cp_email"}; } + $form->{language} = $form->get_template_language(\%myconfig); + $form->{language} = "_" . $form->{language} if $form->{language}; + my $title = $locale->text('E-mail') . " " . $form->get_formname_translation(); $form->{oldmedia} = $form->{media}; @@ -1328,12 +1348,14 @@ sub print_form { my $salesman_id_saved = $form->{salesman_id}; my $cp_id_saved = $form->{cp_id}; my $taxzone_id_saved = $form->{taxzone_id}; + my $currency_saved = $form->{currency}; call_sub("$form->{vc}_details") if ($form->{vc}); $form->{language_id} = $language_saved; $form->{payment_id} = $payment_id_saved; $form->{taxzone_id} = $taxzone_id_saved; + $form->{currency} = $currency_saved; $form->{"email"} = $saved_email if ($saved_email); $form->{"cc"} = $saved_cc if ($saved_cc); @@ -1378,7 +1400,7 @@ sub print_form { $form->get_shipto(\%myconfig); } - my @a = qw(name street zipcode city country contact); + my @a = qw(name department_1 department_2 street zipcode city country contact phone fax email); my $shipto = 1; @@ -1427,7 +1449,7 @@ sub print_form { format_dates($output_dateformat, $output_longdates, qw(invdate orddate quodate pldate duedate reqdate transdate shippingdate deliverydate validitydate paymentdate - datepaid transdate_oe deliverydate_oe + datepaid transdate_oe deliverydate_oe dodate employee_startdate employee_enddate ), grep({ /^datepaid_\d+$/ || @@ -1498,7 +1520,6 @@ sub print_form { delete $form->{OUT}; if ($form->{media} eq 'printer') { - #$form->{OUT} = "| $form->{printer_command} &>/dev/null"; $form->{OUT} = $form->{printer_command}; $form->{OUT_MODE} = '|-'; $form->{printed} .= " $form->{formname}"; @@ -1566,6 +1587,7 @@ sub print_form { media => $form->{media}, extension => $extension, printer => SL::DB::Manager::Printer->find_by_or_create(id => $form->{printer_id}), + today => DateTime->today, }; $form->parse_template(\%myconfig);