X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=taxes%2Fdb%2Ftax_types_db.inc;h=ae2cb01700da5fe42633a07d2ce3b2ce76d6c5f1;hb=51f9e62242aa3697a2d9350d6d1040d5c647c7a5;hp=ce73935f61b95c17756865ac824b3ebf605b211c;hpb=95ff74b5722826544743a01daf527aa3c9efe11a;p=fa-stable.git diff --git a/taxes/db/tax_types_db.inc b/taxes/db/tax_types_db.inc index ce73935f..ae2cb017 100644 --- a/taxes/db/tax_types_db.inc +++ b/taxes/db/tax_types_db.inc @@ -34,11 +34,9 @@ function get_all_tax_types($all=false) $sql = "SELECT tax_type.*, Chart1.account_name AS SalesAccountName, Chart2.account_name AS PurchasingAccountName - FROM ".TB_PREF."tax_types tax_type," - .TB_PREF."chart_master AS Chart1," - .TB_PREF."chart_master AS Chart2 - WHERE tax_type.sales_gl_code = Chart1.account_code - AND tax_type.purchasing_gl_code = Chart2.account_code"; + FROM ".TB_PREF."tax_types tax_type LEFT JOIN " + .TB_PREF."chart_master AS Chart1 ON tax_type.sales_gl_code = Chart1.account_code LEFT JOIN " + .TB_PREF."chart_master AS Chart2 ON tax_type.purchasing_gl_code = Chart2.account_code"; if (!$all) $sql .= " AND !tax_type.inactive"; return db_query($sql, "could not get all tax types"); @@ -56,11 +54,10 @@ function get_tax_type($type_id) $sql = "SELECT tax_type.*, Chart1.account_name AS SalesAccountName, Chart2.account_name AS PurchasingAccountName - FROM ".TB_PREF."tax_types tax_type," - .TB_PREF."chart_master AS Chart1," - .TB_PREF."chart_master AS Chart2 - WHERE tax_type.sales_gl_code = Chart1.account_code - AND tax_type.purchasing_gl_code = Chart2.account_code AND id=".db_escape($type_id); + FROM ".TB_PREF."tax_types tax_type LEFT JOIN " + .TB_PREF."chart_master AS Chart1 ON tax_type.sales_gl_code = Chart1.account_code LEFT JOIN " + .TB_PREF."chart_master AS Chart2 ON tax_type.purchasing_gl_code = Chart2.account_code + WHERE id=".db_escape($type_id); $result = db_query($sql, "could not get tax type"); return db_fetch($result); @@ -73,7 +70,7 @@ function get_tax_type_rate($type_id) $result = db_query($sql, "could not get tax type rate"); $row = db_fetch_row($result); - return $row[0]; + return is_array($row) ? $row[0] : false; } function delete_tax_type($type_id)