# retrieve assembly items
$query =
qq|SELECT p.id, p.partnumber, p.description,
- p.sellprice, p.weight, a.qty, a.bom, p.unit,
+ p.sellprice, p.lastcost, p.weight, a.qty, a.bom, p.unit,
pg.partsgroup
FROM parts p
JOIN assembly a ON (a.parts_id = p.id)
our ($deliverydate); # ToDO: cjeck if this indeed comes from global context
@column_index =
- qw(runningnumber qty unit bom partnumber description partsgroup total);
+ qw(runningnumber qty unit bom partnumber description partsgroup lastcost total);
if ($form->{previousform}) {
$nochange = 1;
$form->{callback} = $callback;
$form->{assemblytotal} = 0;
+ $form->{assembly_purchase_price_total} = 0;
$form->{weight} = 0;
}
. qq|</th>|;
$column_header{description} =
qq|<th nowrap width=50%>| . $locale->text('Part Description') . qq|</th>|;
+ $column_header{lastcost} =
+ qq|<th nowrap width=50%>| . $locale->text('Purchase Price') . qq|</th>|;
$column_header{total} =
qq|<th align=right nowrap>| . $locale->text('Extended') . qq|</th>|;
$column_header{bom} = qq|<th>| . $locale->text('BOM') . qq|</th>|;
$linetotal =
$form->round_amount($form->{"sellprice_$i"} * $form->{"qty_$i"}, 2);
+ $line_purchase_price =
+ $form->round_amount($form->{"lastcost_$i"} * $form->{"qty_$i"}, 2); #lastcost == purchase_price | ungenaue datenbankfeld-übersetzung
$form->{assemblytotal} += $linetotal;
+ $form->{assembly_purchase_price_total} += $line_purchase_price;
$form->{"qty_$i"} = $form->format_amount(\%myconfig, $form->{"qty_$i"});
$linetotal = $form->format_amount(\%myconfig, $linetotal, 2);
+ $line_purchase_price = $form->format_amount(\%myconfig, $line_purchase_price, 2);
if (($i >= 1) && ($i == $numrows)) {
qq|<td><input type=hidden name="description_$i" value="$form->{"description_$i"}">$form->{"description_$i"}</td>|;
}
+ $column_data{lastcost} = qq|<td align=right>$line_purchase_price</td>|;
$column_data{total} = qq|<td align=right>$linetotal</td>|;
$column_data{deliverydate} = qq|<td align=right>$deliverydate</td>|;
[%- IF item == 'assembly' %]
<tr>
<td>
- <table width="100%">
+ <table border="0" width="100%">
<tr>
- <th colspan="2" align="right">Summe</th>
- <th align="right">[% LxERP.format_amount(assemblytotal, 2) %]</th>
+ <th colspan="2" align=right>Summe </th>
+ <th align=right>Purchase Price:[% LxERP.format_amount(assembly_purchase_price_total, 2) %] Verkaufspreis: [% LxERP.format_amount(assemblytotal, 2) %]</th>
</tr>
</table>
</td>
[%- IF item == 'assembly' %]
<tr>
<td>
- <table width="100%">
+ <table border="0" width="100%">
<tr>
- <th colspan="2" align="right"><translate>Total</translate></th>
- <th align="right">[% LxERP.format_amount(assemblytotal, 2) %]</th>
+ <th colspan="2" align=right><translate>Total</translate> </th>
+ <th align=right><translate>Purchase Price</translate>:[% LxERP.format_amount(assembly_purchase_price_total, 2) %] <translate>Sell Price</translate>: [% LxERP.format_amount(assemblytotal, 2) %]</th>
</tr>
</table>
</td>