Thanks for this useful module, here is my suggestion :
i saw you try to add "hook_line_item" but doesn't seems to work, but it would be a better integration than make a pane, here is my code (update, better way and show on bill):
<?php
/**
* Implementation of hook_line_item
*/
function uc_vat_line_item() {
$items[] = array(
'id' => 'vat',
'title' => t('VAT'),
'weight' => 2,
'default' => FALSE,
'stored' => FALSE,
'calculated' => FALSE,
'display_only' => TRUE,
'callback' => 'uc_vat_item_vat',
);
return $items;
}
function uc_vat_item_vat($op, $order) {
switch ($op) {
case 'display':
$vat_items = uc_vat_calculate($order->products);
$vat_amount = 0;
foreach ($vat_items as $rate => $vat) {
$vat_name = $vat['name'];
$vat_amount += $vat['amount'];
}
$lines[] = array(
'id' => 'vat',
'title' => t('contains ').$vat_name,
'amount' => $vat_amount,
);
$lines[] = array(
'id' => 'total_no_vat',
'title' => t('Total without VAT'),
'amount' => $order->order_total-$vat_amount,
);
return $lines;
break;
case 'cart-preview':
$vat_items = uc_vat_calculate($order);
$vat_amount = 0;
foreach ($vat_items as $rate => $vat) {
$vat_name = $vat['name'];
$vat_amount += $vat['amount'];
}
foreach ($order as $item) {
$total += ($item->qty) ? $item->qty * $item->price : $item->price;
}
$total = $total-$vat_amount;
if ($vat_amount > 0) {
drupal_add_js("\$(document).ready( function() { set_line_item('subtotal', '". t('Total without VAT') ."', ". $total .", -1); } );", 'inline');
drupal_add_js("\$(document).ready( function() { set_line_item('taxe', '". $vat_name ."', ". $vat_amount .", 0); } );", 'inline');
}
break;
}
}
?>it works, but sometimes, on checkout page, need some refresh to get good line, saw post about this, i'll look tomorow.
