From 31c79a2d7cc29c18ac1bfa92cf070857a5b9fe98 Mon Sep 17 00:00:00 2001 From: Joe Hunt Date: Tue, 18 Aug 2009 00:13:02 +0000 Subject: [PATCH] Quick Entries uses Tax Groups instead of Item Tax Types for calculating taxes (Please change the item lines for tax). --- CHANGELOG.txt | 7 +++++++ gl/includes/db/gl_db_bank_accounts.inc | 6 +++--- gl/manage/gl_quick_entries.php | 9 +++++---- includes/ui/ui_view.inc | 6 +++++- taxes/tax_calc.inc | 4 +++- 5 files changed, 23 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index d3312c15..e512760d 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -19,6 +19,13 @@ Legend: ! -> Note $ -> Affected files +18-Aug-2009 Joe Hunt +! Quick Entries uses Tax Groups instead of Item Tax Types for calculating taxes (Please change the item lines for tax). +$ /gl/includes/db/gl_db_bank_accounts.inc + /gl/manage/gl_quick_entries.php + /includes/ui/ui_view.inc + /taxes/tax_calc.inc + 17-Aug-2009 Janusz Dobrowolski # [0000158] Added missing check for POS usage before deletion. $ /sales/manage/sales_points.php diff --git a/gl/includes/db/gl_db_bank_accounts.inc b/gl/includes/db/gl_db_bank_accounts.inc index 2a285805..c6b71cf3 100644 --- a/gl/includes/db/gl_db_bank_accounts.inc +++ b/gl/includes/db/gl_db_bank_accounts.inc @@ -166,12 +166,12 @@ function get_quick_entry($selected_id) function get_quick_entry_lines($qid) { $sql = "SELECT ".TB_PREF."quick_entry_lines.*, ".TB_PREF."chart_master.account_name, - ".TB_PREF."item_tax_types.name as tax_name + ".TB_PREF."tax_groups.name as tax_name FROM ".TB_PREF."quick_entry_lines LEFT JOIN ".TB_PREF."chart_master ON ".TB_PREF."quick_entry_lines.dest_id = ".TB_PREF."chart_master.account_code - LEFT JOIN ".TB_PREF."item_tax_types ON - ".TB_PREF."quick_entry_lines.dest_id = ".TB_PREF."item_tax_types.id + LEFT JOIN ".TB_PREF."tax_groups ON + ".TB_PREF."quick_entry_lines.dest_id = ".TB_PREF."tax_groups.id WHERE qid=$qid ORDER by id"; diff --git a/gl/manage/gl_quick_entries.php b/gl/manage/gl_quick_entries.php index 137cfaa4..de19943f 100644 --- a/gl/manage/gl_quick_entries.php +++ b/gl/manage/gl_quick_entries.php @@ -229,11 +229,11 @@ if ($selected_id != -1) start_table($table_style2); $dim = get_company_pref('use_dimension'); if ($dim == 2) - $th = array(_("Post"), _("Account/Tax Type"), _("Amount"), _("Dimension"), _("Dimension")." 2", "", ""); + $th = array(_("Post"), _("Account") . "/" . _("Tax Group"), _("Amount"), _("Dimension"), _("Dimension")." 2", "", ""); else if ($dim == 1) - $th = array(_("Post"), _("Account/Tax Type"), _("Amount"), _("Dimension"), "", ""); + $th = array(_("Post"), _("Account") . "/" . _("Tax Group"), _("Amount"), _("Dimension"), "", ""); else - $th = array(_("Post"), _("Account/Tax Type"), _("Amount"), "", ""); + $th = array(_("Post"), _("Account") . "/" . _("Tax Group"), _("Amount"), "", ""); table_header($th); $k = 0; @@ -302,7 +302,8 @@ if ($selected_id != -1) if ($actn == 't') { - item_tax_types_list_row(_("Item Tax Type").":",'dest_id', null); + //item_tax_types_list_row(_("Item Tax Type").":",'dest_id', null); + tax_groups_list_row(_("Tax Group").":", 'dest_id', null); } else { diff --git a/includes/ui/ui_view.inc b/includes/ui/ui_view.inc index 86062acb..d9a33af9 100644 --- a/includes/ui/ui_view.inc +++ b/includes/ui/ui_view.inc @@ -596,7 +596,11 @@ function display_quick_entries(&$cart, $id, $base, $type, $descr='') case "t": // post taxes calculated on base amount case "t+": // ditto & increase base amount case "t-": // ditto & reduce base amount - $taxes = get_taxes_for_item_tax($qe_line['dest_id']); + //$taxes = get_taxes_for_item_tax($qe_line['dest_id']); + $taxes = array(); + $res = get_tax_group_items($qe_line['dest_id']); + while ($row = db_fetch($res)) + $taxes[] = $row; $tax_total = 0; $totrate = 0; // find total tax diff --git a/taxes/tax_calc.inc b/taxes/tax_calc.inc index 397c5f50..088be56d 100644 --- a/taxes/tax_calc.inc +++ b/taxes/tax_calc.inc @@ -237,6 +237,8 @@ function get_tax_for_items($items, $prices, $shipping_cost, $tax_group, $tax_inc // no tax group exemptions are active (local sales). // To be used in quick entries. // +// Redundant 18.08.2009 Joe Hunt (Tax Groups instead). +/* function get_taxes_for_item_tax($tax_type_id) { $item_tax_type = get_item_tax_type($tax_type_id); @@ -283,7 +285,7 @@ function get_taxes_for_item_tax($tax_type_id) return $ret_tax_array; } - +*/ function is_tax_account($account_code) { $sql= "SELECT id FROM ".TB_PREF."tax_types WHERE -- 2.30.2