The problem lies specifically in this file:
includes/modules/order_total/ot_cat_qvb_discount.php
THIS is the file that calculates the total, subtotal, tax, and discount - in that order. So basically, this file needs to be change to caluculate in order of total, discount, subtotal, tax.
The original order total file (no modifactions) is ot_total.php. These two functions do the work:
function ot_total() {
$this->code = 'ot_total';
$this->title = MODULE_ORDER_TOTAL_TOTAL_TITLE;
$this->description = MODULE_ORDER_TOTAL_TOTAL_DESCRIPTION;
$this->enabled = ((MODULE_ORDER_TOTAL_TOTAL_STATUS == 'true') ? true : false);
$this->sort_order = MODULE_ORDER_TOTAL_TOTAL_SORT_ORDER;
$this->output = array();
}
function process() {
global $order, $currencies;
$this->output[] = array('title' => $this->title . ':',
'text' => '<b>' . $currencies->format($order->info['total'], true, $order->info['currency'], $order->info['currency_value']) . '</b>',
'value' => $order->info['total']);
}
... Sorry, but I tried and failed many times trying to modify includes/modules/order_total/ot_cat_qvb_discount.php. Maybe someone else can figure it out!
ETA: Regarding the "Sort Order" - that's just the display order, not the calculation order. The file above does the actual calculations.