Harmonized sales tax headaches

Posted by JonYork on Stack Overflow See other posts from Stack Overflow or by JonYork
Published on 2010-05-06T00:31:53Z Indexed on 2010/05/06 0:38 UTC
Read the original article Hit count: 215

Filed under:
|
|
|
|

Alright Im using the BambooInvoice software, and where I am, we have two sales taxes.

This is how they work

price of item * tax1 = Sum1Tax1 Sum1tax1 *tax2 = Final sales price

Currently, Bamboo invoice does this

Price of Item * tax1 = pricetax1
price of item * tax2 = pricetax2
Price of item + pricetax1 + pricetax2

and this is its code

$this->db->select('(SELECT SUM('.$this->db->dbprefix('invoice_items').'.amount * '.$this->db->dbprefix('invoice_items').'.quantity * ('.$this->db->dbprefix('invoices').'.tax1_rate/100 * '.$this->db->dbprefix('invoice_items').'.taxable)) FROM '.$this->db->dbprefix('invoice_items').' WHERE '.$this->db->dbprefix('invoice_items').'.invoice_id=' . $invoice_id . ') AS total_tax1', FALSE);
  $this->db->select('(SELECT SUM('.$this->db->dbprefix('invoice_items').'.amount * '.$this->db->dbprefix('invoice_items').'.quantity * ('.$this->db->dbprefix('invoices').'.tax2_rate/100 * '.$this->db->dbprefix('invoice_items').'.taxable)) FROM '.$this->db->dbprefix('invoice_items').' WHERE '.$this->db->dbprefix('invoice_items').'.invoice_id=' . $invoice_id . ') AS total_tax2', FALSE);
  $this->db->select('(SELECT SUM('.$this->db->dbprefix('invoice_items').'.amount * '.$this->db->dbprefix('invoice_items').'.quantity + ROUND(('.$this->db->dbprefix('invoice_items').'.amount * '.$this->db->dbprefix('invoice_items').'.quantity * ('.$this->db->dbprefix('invoices').'.tax1_rate/100 + '.$this->db->dbprefix('invoices').'.tax2_rate/100) * '.$this->db->dbprefix('invoice_items').'.taxable), 2)) FROM '.$this->db->dbprefix('invoice_items').' WHERE '.$this->db->dbprefix('invoice_items').'.invoice_id=' . $invoice_id . ') AS total_with_tax', FALSE);

How would we modify this code to reflect the actual taxation scheme for my area?

Thanks

© Stack Overflow or respective owner

Related posts about tax

Related posts about bamboo