Commits

ITHE committed 7baeeac Merge

Merge

Comments (0)

Files changed (5)

application/language/english/mcb_lang.php

File contents unchanged.

application/modules_core/invoices/models/mdl_invoice_amounts.php

 
 class Mdl_Invoice_Amounts extends CI_Model {
 
-	/**
-	 * TABLE: mcb_invoice_items
-	 * invoice_item_id
-	 * invoice_id
-	 * item_name
-	 * item_qty
-	 * item_price
-	 * tax_rate_id
-	 * item_is_taxable
-	 */
+    /**
+     * TABLE: mcb_invoice_items
+     * invoice_item_id
+     * invoice_id
+     * item_name
+     * item_qty
+     * item_price
+     * tax_rate_id
+     * item_is_taxable
+     */
 
-	/**
-	 * TABLE: mcb_invoice_item_amounts
-	 * invoice_item_amount_id
-	 * invoice_item_id
-	 * item_subtotal
-	 * item_tax
-	 * item_total
-	 */
+    /**
+     * TABLE: mcb_invoice_item_amounts
+     * invoice_item_amount_id
+     * invoice_item_id
+     * item_subtotal
+     * item_tax
+     * item_total
+     */
 
-	/**
-	 * TABLE: mcb_tax_rates
-	 * tax_rate_id
-	 * tax_rate_name
-	 * tax_rate_percent
-	 */
+    /**
+     * TABLE: mcb_tax_rates
+     * tax_rate_id
+     * tax_rate_name
+     * tax_rate_percent
+     */
 
-	/**
-	 * TABLE: mcb_invoice_tax_rates	Global taxes
-	 * invoice_tax_rate_id
-	 * invoice_id
-	 * tax_rate_id
-	 * tax_rate_option				1 = Normal, 2 = After last tax
-	 * tax_amount					Calculated amt of tax
-	 * taxed_amount					Current invoice total
-	 */
+    /**
+     * TABLE: mcb_invoice_tax_rates	Global taxes
+     * invoice_tax_rate_id
+     * invoice_id
+     * tax_rate_id
+     * tax_rate_option				1 = Normal, 2 = After last tax
+     * tax_amount					Calculated amt of tax
+     * taxed_amount					Current invoice total
+     */
 
-	/**
-	 * TABLE: mcb_invoice_amounts
-	 * invoice_amount_id
-	 * invoice_id
-	 * invoice_item_subtotal	Sum of mcb_invoice_item_amounts.item_total
-	 * invoice_item_taxable		Sum of mcb_invoice_item_amounts.item_total where is_taxable = 1
-	 * invoice_item_tax			Sum of mcb_invoice_item_amounts.item_tax
-	 * invoice_subtotal			(invoice_item_subtotal + invoice_item_tax)
-	 * invoice_tax				Sum of global invoice tax amounts
-	 * invoice_shipping			invoice_shipping
-	 * invoice_discount			invoice_discount
-	 * invoice_paid				Sum of mcb_payments.payment_amount
-	 * invoice_total			invoice_subtotal + invoice_tax + invoice_shipping - invoice_discount
-	 * invoice_balance			invoice_total - invoice_paid
-	 */
+    /**
+     * TABLE: mcb_invoice_amounts
+     * invoice_amount_id
+     * invoice_id
+     * invoice_item_subtotal	Sum of mcb_invoice_item_amounts.item_total
+     * invoice_item_taxable		Sum of mcb_invoice_item_amounts.item_total where is_taxable = 1
+     * invoice_item_tax			Sum of mcb_invoice_item_amounts.item_tax
+     * invoice_subtotal			(invoice_item_subtotal + invoice_item_tax)
+     * invoice_tax				Sum of global invoice tax amounts
+     * invoice_shipping			invoice_shipping
+     * invoice_discount			invoice_discount
+     * invoice_paid				Sum of mcb_payments.payment_amount
+     * invoice_total			invoice_subtotal + invoice_tax + invoice_shipping - invoice_discount
+     * invoice_balance			invoice_total - invoice_paid
+     */
 
-	function adjust($invoice_id = NULL) {
+    /** ITEM TAX OPTION
+     * 0 - add to total
+     * 1 - include in total
+     */
 
-		if ($invoice_id) {
+    function adjust($invoice_id = NULL) {
 
-			/* Adjust a single invoice */
-			$this->_adjust($invoice_id);
+        if ($invoice_id) {
 
-		}
+            /* Adjust a single invoice */
+            $this->_adjust($invoice_id);
 
-		else {
+        }
 
-			/* Adjust all invoices */
-			$this->db->select('invoice_id, client_id');
+        else {
 
-			$invoices = $this->db->get('mcb_invoices')->result();
+            /* Adjust all invoices */
+            $this->db->select('invoice_id, client_id');
 
-			foreach ($invoices as $invoice) {
+            $invoices = $this->db->get('mcb_invoices')->result();
 
-				$this->_adjust($invoice->invoice_id);
+            foreach ($invoices as $invoice) {
 
-			}
+                $this->_adjust($invoice->invoice_id);
 
-		}
+            }
 
-	}
+        }
 
-	function _adjust($invoice_id) {
+    }
 
-		$this->db->join('mcb_tax_rates', 'mcb_tax_rates.tax_rate_id = mcb_invoice_items.tax_rate_id', 'left');
+    function _adjust($invoice_id) {
 
-		$this->db->where('invoice_id', $invoice_id);
+        $this->db->join('mcb_tax_rates', 'mcb_tax_rates.tax_rate_id = mcb_invoice_items.tax_rate_id', 'left');
 
-		$invoice_items = $this->db->get('mcb_invoice_items')->result();
+        $this->db->where('invoice_id', $invoice_id);
 
-		foreach ($invoice_items as $item) {
+        $invoice_items = $this->db->get('mcb_invoice_items')->result();
 
-			$this->_update_invoice_item_amounts($item);
+        foreach ($invoice_items as $item) {
 
-		}
+            $this->_update_invoice_item_amounts($item);
 
-		$this->_update_invoice_amounts($invoice_id);
+        }
 
-		$this->_update_invoice_taxes($invoice_id);
+        $this->_update_invoice_amounts($invoice_id);
 
-		$this->_update_invoice_status($invoice_id);
+        $this->_update_invoice_taxes($invoice_id);
 
-	}
+        $this->_update_invoice_status($invoice_id);
 
-	function _update_invoice_item_amounts($item) {
+    }
 
-		/* Calculations for mcb_invoice_item_amounts table */
+    function _update_invoice_item_amounts($item) {
 
-		$db_array = array(
-			'invoice_item_id'	=>	$item->invoice_item_id,
-			'item_subtotal'		=>	$item->item_qty * $item->item_price
-		);
+        /* Calculations for mcb_invoice_item_amounts table */
 
-		if ($item->tax_rate_percent and $item->is_taxable) {
+        $db_array = array(
+            'invoice_item_id'	=>	$item->invoice_item_id,
+            'item_subtotal'		=>	$item->item_qty * $item->item_price,
+            'item_tax'          =>  '0.00'
+        );
 
-			$db_array['item_tax'] = $db_array['item_subtotal'] * ($item->tax_rate_percent / 100);
+        if ($item->tax_rate_percent and $item->is_taxable) {
 
-		}
+            if ($item->item_tax_option == 0) {
 
-		else {
+                $db_array['item_tax'] = $db_array['item_subtotal'] * ($item->tax_rate_percent / 100);
 
-			$db_array['item_tax'] = '0.00';
+                $db_array['item_total'] = $db_array['item_subtotal'] + $db_array['item_tax'];
 
-		}
+            }
 
-		$db_array['item_total'] = $db_array['item_subtotal'] + $db_array['item_tax'];
+            elseif ($item->item_tax_option == 1) {
 
-		$this->db->where('invoice_item_id', $item->invoice_item_id);
+                $tax_calc = ($item->tax_rate_percent / 100) + 1;
 
-		if ($this->db->get('mcb_invoice_item_amounts')->num_rows()) {
+                $db_array['item_subtotal'] = $db_array['item_subtotal'] / $tax_calc;
 
-			$this->db->where('invoice_item_id', $item->invoice_item_id);
+                $db_array['item_tax'] = $db_array['item_subtotal'] * ($item->tax_rate_percent / 100);
 
-			$this->db->update('mcb_invoice_item_amounts', $db_array);
+                $db_array['item_total'] = $db_array['item_subtotal'] + $db_array['item_tax'];
 
-		}
+            }
 
-		else {
+        }
 
-			$this->db->insert('mcb_invoice_item_amounts', $db_array);
+        $this->db->where('invoice_item_id', $item->invoice_item_id);
 
-		}
+        if ($this->db->get('mcb_invoice_item_amounts')->num_rows()) {
 
-	}
+            $this->db->where('invoice_item_id', $item->invoice_item_id);
 
-	function _update_invoice_amounts($invoice_id) {
+            $this->db->update('mcb_invoice_item_amounts', $db_array);
 
-		/* Calculations for mcb_invoice_amounts table */
+        }
 
-		/**
-		 * TABLE: mcb_invoice_item_amounts
-		 * invoice_item_amount_id
-		 * invoice_item_id
-		 * item_subtotal
-		 * item_tax
-		 * item_total
-		 */
+        else {
 
-		/**
-		 * invoice_amount_id
-		 * invoice_id
-		 * invoice_item_subtotal	Sum of mcb_invoice_item_amounts.item_total
-		 * invoice_item_taxable		Sum of mcb_invoice_item_amounts.item_total where is_taxable = 1
-		 * invoice_item_tax			Sum of mcb_invoice_item_amounts.item_tax
-		 * invoice_subtotal			(invoice_item_subtotal + invoice_item_tax)
-		 * invoice_tax				Sum of global invoice tax amounts
-		 * invoice_shipping			invoice_shipping
-		 * invoice_discount			invoice_discount
-		 * invoice_paid				Sum of mcb_payments.payment_amount
-		 * invoice_total			invoice_subtotal + invoice_tax + invoice_shipping - invoice_discount
-		 * invoice_balance			invoice_total - invoice_paid
-		 */
+            $this->db->insert('mcb_invoice_item_amounts', $db_array);
 
-		$this->db->select(
-			'IFNULL(SUM(item_subtotal),0.00) AS invoice_item_subtotal, ' .
-			'IFNULL(SUM(IF(is_taxable = 1, item_subtotal, 0.00)),0.00) AS invoice_item_taxable, ' .
-			'IFNULL(SUM(item_tax),0.00) AS invoice_item_tax, ' .
-			'IFNULL((SELECT SUM(payment_amount) FROM mcb_payments WHERE invoice_id = ' . $invoice_id . '),0.00) AS invoice_paid',
-			FALSE
-		);
+        }
 
-		$this->db->join('mcb_invoice_items', 'mcb_invoice_items.invoice_item_id = mcb_invoice_item_amounts.invoice_item_id');
+    }
 
-		$this->db->where('invoice_id', $invoice_id);
+    function _update_invoice_amounts($invoice_id) {
 
-		$invoice_amounts = $this->db->get('mcb_invoice_item_amounts')->result();
+        /* Calculations for mcb_invoice_amounts table */
 
-		foreach ($invoice_amounts as $invoice_amount) {
-			
-			$db_array = array(
-				'invoice_id'				=>	$invoice_id,
-				'invoice_item_subtotal'		=>	$invoice_amount->invoice_item_subtotal,
-				'invoice_item_taxable'		=>	$invoice_amount->invoice_item_taxable,
-				'invoice_item_tax'			=>	$invoice_amount->invoice_item_tax,
-				'invoice_subtotal'			=>	$invoice_amount->invoice_item_subtotal + $invoice_amount->invoice_item_tax,
-				'invoice_paid'				=>	$invoice_amount->invoice_paid
-			);
+        /**
+         * TABLE: mcb_invoice_item_amounts
+         * invoice_item_amount_id
+         * invoice_item_id
+         * item_subtotal
+         * item_tax
+         * item_total
+         */
 
-			$this->db->where('invoice_id', $invoice_id);
+        /**
+         * invoice_amount_id
+         * invoice_id
+         * invoice_item_subtotal	Sum of mcb_invoice_item_amounts.item_total
+         * invoice_item_taxable		Sum of mcb_invoice_item_amounts.item_total where is_taxable = 1
+         * invoice_item_tax			Sum of mcb_invoice_item_amounts.item_tax
+         * invoice_subtotal			(invoice_item_subtotal + invoice_item_tax)
+         * invoice_tax				Sum of global invoice tax amounts
+         * invoice_shipping			invoice_shipping
+         * invoice_discount			invoice_discount
+         * invoice_paid				Sum of mcb_payments.payment_amount
+         * invoice_total			invoice_subtotal + invoice_tax + invoice_shipping - invoice_discount
+         * invoice_balance			invoice_total - invoice_paid
+         */
 
-			if ($this->db->get('mcb_invoice_amounts')->num_rows()) {
+        $this->db->select(
+            'IFNULL(SUM(item_subtotal),0.00) AS invoice_item_subtotal, ' .
+            'IFNULL(SUM(IF(is_taxable = 1, item_subtotal, 0.00)),0.00) AS invoice_item_taxable, ' .
+            'IFNULL(SUM(item_tax),0.00) AS invoice_item_tax, ' .
+            'IFNULL((SELECT SUM(payment_amount) FROM mcb_payments WHERE invoice_id = ' . $invoice_id . '),0.00) AS invoice_paid',
+            FALSE
+        );
 
-				$this->db->where('invoice_id', $invoice_id);
+        $this->db->join('mcb_invoice_items', 'mcb_invoice_items.invoice_item_id = mcb_invoice_item_amounts.invoice_item_id');
 
-				$this->db->update('mcb_invoice_amounts', $db_array);
+        $this->db->where('invoice_id', $invoice_id);
 
-			}
+        $invoice_amounts = $this->db->get('mcb_invoice_item_amounts')->result();
 
-			else {
+        foreach ($invoice_amounts as $invoice_amount) {
 
-				$this->db->insert('mcb_invoice_amounts', $db_array);
+            $db_array = array(
+                'invoice_id'				=>	$invoice_id,
+                'invoice_item_subtotal'		=>	$invoice_amount->invoice_item_subtotal,
+                'invoice_item_taxable'		=>	$invoice_amount->invoice_item_taxable,
+                'invoice_item_tax'			=>	$invoice_amount->invoice_item_tax,
+                'invoice_subtotal'			=>	$invoice_amount->invoice_item_subtotal + $invoice_amount->invoice_item_tax,
+                'invoice_paid'				=>	$invoice_amount->invoice_paid
+            );
 
-			}
+            $this->db->where('invoice_id', $invoice_id);
 
-		}
+            if ($this->db->get('mcb_invoice_amounts')->num_rows()) {
 
-	}
+                $this->db->where('invoice_id', $invoice_id);
 
-	function _update_invoice_status($invoice_id) {
+                $this->db->update('mcb_invoice_amounts', $db_array);
 
-		$this->load->model('invoices/mdl_invoices');
+            }
 
-		$params = array(
-			'where'	=>	array(
-				'mcb_invoices.invoice_id'	=>	$invoice_id
-			)
-		);
+            else {
 
-		$invoice = $this->mdl_invoices->get($params);
+                $this->db->insert('mcb_invoice_amounts', $db_array);
 
-		if ($invoice->invoice_balance > 0) {
+            }
 
-			/* This invoice has a balance */
+        }
 
-			if ($invoice->invoice_status_type == 3) {
+    }
 
-				/* This invoice currently has a closed status. Update it. */
+    function _update_invoice_status($invoice_id) {
 
-				$db_array = array(
-					'invoice_status_id'	=>	$this->mdl_mcb_data->setting('default_open_status_id')
-				);
+        $this->load->model('invoices/mdl_invoices');
 
-				$this->db->where('invoice_id', $invoice_id);
+        $params = array(
+            'where'	=>	array(
+                'mcb_invoices.invoice_id'	=>	$invoice_id
+            )
+        );
 
-				$this->db->update('mcb_invoices', $db_array);
+        $invoice = $this->mdl_invoices->get($params);
 
-			}
+        if ($invoice->invoice_balance > 0) {
 
-		}
+            /* This invoice has a balance */
 
-		else {
+            if ($invoice->invoice_status_type == 3) {
 
-			/* This invoice has no balance */
+                /* This invoice currently has a closed status. Update it. */
 
-			if ($invoice->invoice_status_type <> 3 and $invoice->invoice_total > 0) {
+                $db_array = array(
+                    'invoice_status_id'	=>	$this->mdl_mcb_data->setting('default_open_status_id')
+                );
 
-				/* This invoice needs a closed status */
+                $this->db->where('invoice_id', $invoice_id);
 
-				$db_array = array(
-					'invoice_status_id'	=>	$this->mdl_mcb_data->setting('default_closed_status_id')
-				);
+                $this->db->update('mcb_invoices', $db_array);
 
-				$this->db->where('invoice_id', $invoice_id);
+            }
 
-				$this->db->update('mcb_invoices', $db_array);
+        }
 
-			}
+        else {
 
-		}
+            /* This invoice has no balance */
 
-	}
+            if ($invoice->invoice_status_type <> 3 and $invoice->invoice_total > 0) {
 
-	function _update_invoice_taxes($invoice_id) {
+                /* This invoice needs a closed status */
 
-		/**
-		 * invoice_tax				Sum of global invoice tax amounts
-		 * invoice_total			invoice_subtotal + invoice_tax + invoice_shipping - invoice_discount
-		 * invoice_balance			invoice_total - invoice_paid
-		 */
+                $db_array = array(
+                    'invoice_status_id'	=>	$this->mdl_mcb_data->setting('default_closed_status_id')
+                );
 
-		/**
-		 * invoice_amount_id
-		 * invoice_id
-		 * invoice_item_subtotal	Sum of mcb_invoice_item_amounts.item_total
-		 * invoice_item_taxable		Sum of mcb_invoice_item_amounts.item_total where is_taxable = 1
-		 * invoice_item_tax			Sum of mcb_invoice_item_amounts.item_tax
-		 * invoice_subtotal			(invoice_item_subtotal + invoice_item_tax)
-		 * invoice_tax				Sum of global invoice tax amounts
-		 * invoice_shipping			invoice_shipping
-		 * invoice_discount			invoice_discount
-		 * invoice_paid				Sum of mcb_payments.payment_amount
-		 * invoice_total			invoice_subtotal + invoice_tax + invoice_shipping - invoice_discount
-		 * invoice_balance			invoice_total - invoice_paid
-		 */
+                $this->db->where('invoice_id', $invoice_id);
 
-		$this->db->join('mcb_invoice_amounts', 'mcb_invoice_amounts.invoice_id = mcb_invoice_tax_rates.invoice_id');
+                $this->db->update('mcb_invoices', $db_array);
 
-		$this->db->join('mcb_tax_rates', 'mcb_tax_rates.tax_rate_id = mcb_invoice_tax_rates.tax_rate_id');
+            }
 
-		$this->db->where('mcb_invoice_tax_rates.invoice_id', $invoice_id);
+        }
 
-		$invoice_tax_rates = $this->db->get('mcb_invoice_tax_rates')->result();
+    }
 
-		foreach ($invoice_tax_rates as $rate) {
+    function _update_invoice_taxes($invoice_id) {
 
-			if ($rate->tax_rate_option == 1) {
+        /**
+         * invoice_tax				Sum of global invoice tax amounts
+         * invoice_total			invoice_subtotal + invoice_tax + invoice_shipping - invoice_discount
+         * invoice_balance			invoice_total - invoice_paid
+         */
 
-				/* Calculate w/o item taxes */
+        /**
+         * invoice_amount_id
+         * invoice_id
+         * invoice_item_subtotal	Sum of mcb_invoice_item_amounts.item_total
+         * invoice_item_taxable		Sum of mcb_invoice_item_amounts.item_total where is_taxable = 1
+         * invoice_item_tax			Sum of mcb_invoice_item_amounts.item_tax
+         * invoice_subtotal			(invoice_item_subtotal + invoice_item_tax)
+         * invoice_tax				Sum of global invoice tax amounts
+         * invoice_shipping			invoice_shipping
+         * invoice_discount			invoice_discount
+         * invoice_paid				Sum of mcb_payments.payment_amount
+         * invoice_total			invoice_subtotal + invoice_tax + invoice_shipping - invoice_discount
+         * invoice_balance			invoice_total - invoice_paid
+         */
 
-				$db_array = array(
-					'tax_amount'	=>	$rate->invoice_item_taxable * ($rate->tax_rate_percent / 100)
-				);
+        $this->db->join('mcb_invoice_amounts', 'mcb_invoice_amounts.invoice_id = mcb_invoice_tax_rates.invoice_id');
 
-				$this->db->where('invoice_tax_rate_id', $rate->invoice_tax_rate_id);
+        $this->db->join('mcb_tax_rates', 'mcb_tax_rates.tax_rate_id = mcb_invoice_tax_rates.tax_rate_id');
 
-				$this->db->update('mcb_invoice_tax_rates', $db_array);
+        $this->db->where('mcb_invoice_tax_rates.invoice_id', $invoice_id);
 
-			}
+        $invoice_tax_rates = $this->db->get('mcb_invoice_tax_rates')->result();
 
-			elseif ($rate->tax_rate_option == 2) {
+        foreach ($invoice_tax_rates as $rate) {
 
-				/* Calculate with item taxes */
+            if ($rate->tax_rate_option == 1) {
 
-				$db_array = array(
-					'tax_amount'	=>	$rate->invoice_subtotal * ($rate->tax_rate_percent / 100)
-				);
+                /* Calculate w/o item taxes */
 
-				$this->db->where('invoice_tax_rate_id', $rate->invoice_tax_rate_id);
+                $db_array = array(
+                    'tax_amount'	=>	$rate->invoice_item_taxable * ($rate->tax_rate_percent / 100)
+                );
 
-				$this->db->update('mcb_invoice_tax_rates', $db_array);
+                $this->db->where('invoice_tax_rate_id', $rate->invoice_tax_rate_id);
 
-			}
+                $this->db->update('mcb_invoice_tax_rates', $db_array);
 
-			$this->db->select('SUM(tax_amount) AS invoice_tax');
+            }
 
-			$this->db->where('invoice_id', $invoice_id);
+            elseif ($rate->tax_rate_option == 2) {
 
-			$invoice_tax = $this->db->get('mcb_invoice_tax_rates')->row()->invoice_tax;
+                /* Calculate with item taxes */
 
-			$this->db->where('invoice_id', $invoice_id);
+                $db_array = array(
+                    'tax_amount'	=>	$rate->invoice_subtotal * ($rate->tax_rate_percent / 100)
+                );
 
-			$this->db->set('invoice_tax', $invoice_tax);
+                $this->db->where('invoice_tax_rate_id', $rate->invoice_tax_rate_id);
 
-			$this->db->set('invoice_total', 'invoice_subtotal + invoice_tax - invoice_discount + invoice_shipping', FALSE);
+                $this->db->update('mcb_invoice_tax_rates', $db_array);
 
-			$this->db->set('invoice_balance', 'invoice_total - invoice_paid', FALSE);
+            }
 
-			$this->db->update('mcb_invoice_amounts');
+            $this->db->select('SUM(tax_amount) AS invoice_tax');
 
-			$this->db->where('invoice_balance <', '0.00');
+            $this->db->where('invoice_id', $invoice_id);
 
-			$db_array = array(
-				'invoice_balance'	=>	'0.00'
-			);
+            $invoice_tax = $this->db->get('mcb_invoice_tax_rates')->row()->invoice_tax;
 
-			$this->db->update('mcb_invoice_amounts', $db_array);
+            $this->db->where('invoice_id', $invoice_id);
 
-		}
+            $this->db->set('invoice_tax', $invoice_tax);
 
-	}
+            $this->db->set('invoice_total', 'invoice_subtotal + invoice_tax - invoice_discount + invoice_shipping', FALSE);
+
+            $this->db->set('invoice_balance', 'invoice_total - invoice_paid', FALSE);
+
+            $this->db->update('mcb_invoice_amounts');
+
+            $this->db->where('invoice_balance <', '0.00');
+
+            $db_array = array(
+                'invoice_balance'	=>	'0.00'
+            );
+
+            $this->db->update('mcb_invoice_amounts', $db_array);
+
+        }
+
+    }
 
 }
 
+
 ?>

application/modules_core/invoices/models/mdl_items.php

 		$this->form_validation->set_rules('item_price', $this->lang->line('unit_price'), 'required');
 		$this->form_validation->set_rules('is_taxable', $this->lang->line('taxable'));
 		$this->form_validation->set_rules('tax_rate_id', $this->lang->line('tax_rate'), 'required');
+        $this->form_validation->set_rules('item_tax_option', $this->lang->line('item_tax_option'));
 
 		foreach ($this->custom_fields as $custom_field) {
 

application/modules_core/invoices/views/item_form.php

                 </dl>
 
 				<dl>
-					<dt><label><?php echo $this->lang->line('tax_rate'); ?>: </label></dt>
+					<dt><label><?php echo $this->lang->line('taxable'); ?>: </label></dt>
+					<dd><input type="checkbox" name="is_taxable" value="1" <?php if ($this->mdl_items->form_value('is_taxable')) { ?>checked="checked"<?php } ?> /></dd>
+				</dl>
+
+				<dl>
+					<dt><label><?php echo $this->lang->line('item_tax_rate'); ?>: </label></dt>
 					<dd>
 						<select name="tax_rate_id">
 							<?php foreach ($tax_rates as $tax_rate) { ?>
 					</dd>
 				</dl>
 
-				<dl>
-					<dt><label><?php echo $this->lang->line('taxable'); ?>: </label></dt>
-					<dd><input type="checkbox" name="is_taxable" value="1" <?php if ($this->mdl_items->form_value('is_taxable')) { ?>checked="checked"<?php } ?> /></dd>
-				</dl>
+                <dl>
+                    <dt><label><?php echo $this->lang->line('item_tax_option'); ?></label></dt>
+                    <dd>
+                        <select name="item_tax_option">
+                            <option value="0" <?php if (!$this->mdl_items->form_value('item_tax_option')) { ?>selected="selected"<?php } ?>><?php echo $this->lang->line('item_tax_option_0'); ?></option>
+                            <option value="1" <?php if ($this->mdl_items->form_value('item_tax_option') == 1) { ?>selected="selected"<?php } ?>><?php echo $this->lang->line('item_tax_option_1'); ?></option>
+                        </select>
+                    </dd>
+                </dl>
 
 				<?php foreach ($custom_fields as $field) { ?>
 				<dl>

application/modules_core/setup/models/mdl_setup.php

 
 class Mdl_Setup extends MY_Model {
 
-    public $install_version = '0.9.4';
+    public $install_version = '0.9.4.1';
 
     var $upgrade_path;
 
                 'from'      =>  '0.9.3.3',
                 'to'        =>  '0.9.4',
                 'function'  =>  'u094'
+            ),
+            array(
+                'from'      =>  '0.9.4',
+                'to'        =>  '0.9.4.1',
+                'function'  =>  'u0941'
             )
         );
 
 			`item_price` decimal(10,2) NOT NULL DEFAULT '0.00',
 			`tax_rate_id` int(11) NOT NULL,
 			`is_taxable` int(1) NOT NULL DEFAULT 0,
+            `item_tax_option` int(1) NOT NULL DEFAULT 0,
 			PRIMARY KEY (`invoice_item_id`),
 			KEY `invoice_id` (`invoice_id`),
 			KEY `tax_rate_id` (`tax_rate_id`)
 
     }
 
+    function u0941() {
+
+        $queries = array(
+            "ALTER TABLE `mcb_invoice_items` ADD `item_tax_option` INT( 1 ) NOT NULL DEFAULT '0'"
+        );
+
+        $this->run_queries($queries);
+
+        $this->mdl_mcb_data->save('version', '0.9.4.1');
+
+        return TRUE;
+
+    }
+
     function mcb_data_prev() {
 
         $this->load->model('tax_rates/mdl_tax_rates');