The SQL is:
SELECT tt.rate
FROM `0_stock_master` sm LEFT JOIN `0_tax_types` tt
ON (`sm`.`tax_type_id` = `tt`.`id`)
WHERE stock_id="MY_ITEM";
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.
Attached is the ERD for the SQL provided here.
Will the function get_item_tax_type_for_item($stock_id)
function get_item_tax_type_for_item($stock_id)
{
$sql = "SELECT ".TB_PREF."item_tax_types.* FROM ".TB_PREF."item_tax_types,".TB_PREF."stock_master WHERE
".TB_PREF."stock_master.stock_id=".db_escape($stock_id)."
AND ".TB_PREF."item_tax_types.id=".TB_PREF."stock_master.tax_type_id";
$result = db_query($sql, "could not get item tax type");
return db_fetch($result);
}
in lines 61 to 70 intaxes/db/item_tax_types_db.inc suffice or would you like to clone it by replacing the sql?
Post's attachmentsstock_id_TO_tax_rate.png 9.5 kb, file has never been downloaded.
You don't have the permssions to download the attachments of this post.