$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;
'Include in Report' => 'In Bericht aufnehmen',
'Include in drop-down menus' => 'In Aufklappmenü aufnehmen',
'Includeable in reports' => 'In Berichten anzeigbar',
+ 'Including' => 'Enthaltene',
'Income Statement' => 'GuV',
'Income accno' => 'Erlöskonto',
'Incoming Payments' => 'Zahlungseingänge',
'National' => 'Inand',
'National Expenses' => 'Aufwand Inland',
'National Revenues' => 'Erlöse Inland',
+ 'Net amount' => 'Nettobetrag',
'Netto Terms' => 'Zahlungsziel netto',
'New Buchungsgruppe #1' => 'Neue Buchungsgruppe #1',
'New Templates' => 'Erzeuge Vorlagen, Name',
[% SET total_ref = item _ '_total' %]
[% SET netto_ref = item _ '_netto' %]
<tr>
- <th align="right">Enthaltene [% $description_ref | html %] [% $rate_ref * 100 %]%</th>
+ <th align="right">[% 'Including' | $T8 %] [% $description_ref | html %] [% $rate_ref * 100 %]%</th>
<td align="right">[% LxERP.format_amount($total_ref, 2) %]</td>
</tr>
[%- IF taxincluded %]
<tr>
- <th align="right">Nettobetrag</th>
+ <th align="right">[% 'Net amount' | $T8 %]</th>
<td align="right">[% LxERP.format_amount($netto_ref, 2) %]</td>
</tr>
[%- END %]
[% SET total_ref = item _ '_total' %]
[% SET netto_ref = item _ '_netto' %]
<tr>
- <th align="right">Enthaltene [% $description_ref | html %] [% $rate_ref * 100 %]%</th>
+ <th align="right">[% 'Including' | $T8 %] [% $description_ref | html %] [% $rate_ref * 100 %]%</th>
<td align="right">[% LxERP.format_amount($total_ref, 2) %]</td>
</tr>
[%- IF taxincluded %]
<tr>
- <th align="right">Nettobetrag</th>
+ <th align="right">[% 'Net amount' | $T8 %]</th>
<td align="right">[% LxERP.format_amount($netto_ref, 2) %]</td>
</tr>
[%- END %]