<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[FrontAccounting forum — retrieve tax from item]]></title>
		<link>https://frontaccounting.com/punbb/viewtopic.php?id=5608</link>
		<atom:link href="https://frontaccounting.com/punbb/extern.php?action=feed&amp;tid=5608&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in retrieve tax from item.]]></description>
		<lastBuildDate>Fri, 13 Mar 2015 14:43:14 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: retrieve tax from item]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=22877#p22877</link>
			<description><![CDATA[<p>The SQL is:<br /></p><div class="codebox"><pre><code>SELECT tt.rate
FROM `0_stock_master` sm LEFT JOIN `0_tax_types` tt
        ON (`sm`.`tax_type_id` = `tt`.`id`)
WHERE stock_id=&quot;MY_ITEM&quot;;</code></pre></div><p>Tax rates are not that straightforward. The items may be having different tax rates depending on the actual invoice where a Customer may have tax overrides.</p><p>Attached is the ERD for the SQL provided here.</p><p>Will the <strong>function <em>get_item_tax_type_for_item($stock_id)</em></strong><br /></p><div class="codebox"><pre><code>function get_item_tax_type_for_item($stock_id)
{
    $sql = &quot;SELECT &quot;.TB_PREF.&quot;item_tax_types.* FROM &quot;.TB_PREF.&quot;item_tax_types,&quot;.TB_PREF.&quot;stock_master WHERE 
        &quot;.TB_PREF.&quot;stock_master.stock_id=&quot;.db_escape($stock_id).&quot;
        AND &quot;.TB_PREF.&quot;item_tax_types.id=&quot;.TB_PREF.&quot;stock_master.tax_type_id&quot;;
    
    $result = db_query($sql, &quot;could not get item tax type&quot;);
    
    return db_fetch($result);    
}</code></pre></div><p>in lines 61 to 70 in<strong>taxes/db/item_tax_types_db.inc</strong> suffice or would you like to clone it by replacing the sql?</p>]]></description>
			<author><![CDATA[null@example.com (apmuthu)]]></author>
			<pubDate>Fri, 13 Mar 2015 14:43:14 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=22877#p22877</guid>
		</item>
		<item>
			<title><![CDATA[retrieve tax from item]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=22867#p22867</link>
			<description><![CDATA[<p>Hi.</p><p>I need to create a function in PHP but I&#039;m not very familiar.<br />Can you help?</p><p>What I need is to pass to a function the stock_id (from stock_master.stock_id) and get the value of tax_types.rate associated.</p><p>I understand that for a PHP programmer is a walk in the park but I&#039;m not such a thing.</p><p>Thanks for any help you may provide.</p><p>Best,<br />Carlo</p>]]></description>
			<author><![CDATA[null@example.com (carlo)]]></author>
			<pubDate>Wed, 11 Mar 2015 18:42:58 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=22867#p22867</guid>
		</item>
	</channel>
</rss>
