get_taxes (Tax_lib)

ospos · pos, tax-calculation, origin-destination, finance

Calculates sales taxes for cart items, handling origin/destination-based rules, included/excluded tax, and line-item tax details while updating taxed flags.

// Source: https://github.com/Pmbamungu/ospos | License: MIT | Copyright 2013-2021 jekkos
// Provided via justclaw.it.com; keep this notice with the code.
	public function get_taxes(&$cart, $sale_id = -1)
	{
		$register_mode = $this->CI->sale_lib->get_mode();
		$tax_decimals = tax_decimals();
		$customer_id = $this->CI->sale_lib->get_customer();
		$customer_info = $this->CI->Customer->get_info($customer_id);
		$taxes = array();
		$item_taxes = array();

		// Charge sales tax if customer is not selected (walk-in) or customer is flagged as taxable
		if($customer_id == -1 || $customer_info->taxable)
		{
			foreach($cart as $line => $item)
			{
				$taxed = FALSE;

				if(!($this->CI->config->item('use_destination_based_tax')))
				{
					// Start of current Base System tax calculations

					

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search 40K more like it.

Get a free API key