On 1st October (in New Zealand) we had an increase in GST from 12.5% to 15%. It was no problem to increase the rate, however all existing orders in the system were changed to reflect the new rate when they should not have been changed at all. ie. If the orders were created using the 12.5% rate then they should remain as such, even when the GST rate is changed. See file attachment... the order in question was created prior the GST rate being increased. The net amount was $400.00, GST of $50.00 (at 12.5%), now shows at the 15% rate.

CommentFileSizeAuthor
drupal_gst_bug.jpg10.91 KBjussiep

Comments

jm.federico’s picture

Status: Active » Needs work

This issue is a bit complex. I came acroess this problem a while ago.
The initial blame comes form how Ubercart Tax system is designed.

The tax system was designed for countries like USA, where the price of an item never includes the tax. ONly at checkout tax is calculated, and then the system stores tho Tax total for the order, but not for individual items.

Now, displaying prices with tax included is handeled by the uc_price module.

What the GST module is doing is simply taking the TAX value and modifying the prices of the products, using HOOK_uc_price_handler().

Didn't try this, but a solution could be to change uc_gst_price_handler_alter() so that when the context is 'order_product' nothing gets changed.

Change :

function uc_gst_price_handler_alter(&$price, &$context, &$options) {
  switch ($context['type']) {
    case 'product':
    case 'cart_item':
    case 'order_product':
      $node = node_load($context['subject']['node']->nid);
      $options['suffixes'][] = t(' GST inc.');
      // Ensure that all the parts are there when the data comes from Views.
      if (!isset($node->type) || !isset($node->sell_price) || !isset($node->shippable)) {
        $node = node_load($node->nid);
      }
      break;

    case 'attribute_option': // Attributes
      $node = $context['subject']['option'];
      // Fake the node type to be the same as the node that this attribute applies to. Implies the same tax.
      $tmp = node_load($node->nid);
      $node->type = $tmp->type;
      break;

    case 'line_item':
      uc_gst_line_item_price_alter($price, $context, $options);
      return;

    default:
      // Don't modify other types of prices.
      return;
  }

to

function uc_gst_price_handler_alter(&$price, &$context, &$options) {
  switch ($context['type']) {
    case 'product':
    case 'cart_item':
      $node = node_load($context['subject']['node']->nid);
      $options['suffixes'][] = t(' GST inc.');
      // Ensure that all the parts are there when the data comes from Views.
      if (!isset($node->type) || !isset($node->sell_price) || !isset($node->shippable)) {
        $node = node_load($node->nid);
      }
      break;

    case 'attribute_option': // Attributes
      $node = $context['subject']['option'];
      // Fake the node type to be the same as the node that this attribute applies to. Implies the same tax.
      $tmp = node_load($node->nid);
      $node->type = $tmp->type;
      break;

    case 'line_item':
      uc_gst_line_item_price_alter($price, $context, $options);
      return;

    default:
      // Don't modify other types of prices.
      return;
  }

This way individual prices in old order will show up without modification, (no TAX), but the total TAX for the order will remain (Ubercart stores that)

I'm not attaching patch cause haven't tested.

Cheers