X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=taxes%2Ftax_types.php;h=d70493c847080d206d2442149a834f9f5bd1dd01;hb=dc45c23788aef82de242efa67ad47979099b1e97;hp=101144d2da378140722637d3ca0cc4cc37374371;hpb=da8311619dd73feae101d246a1957b972e00cbd2;p=fa-stable.git diff --git a/taxes/tax_types.php b/taxes/tax_types.php index 101144d2..d70493c8 100644 --- a/taxes/tax_types.php +++ b/taxes/tax_types.php @@ -3,7 +3,6 @@ $page_security = 3; $path_to_root=".."; include($path_to_root . "/includes/session.inc"); - page(_("Tax Types")); include_once($path_to_root . "/includes/ui.inc"); @@ -12,26 +11,26 @@ include_once($path_to_root . "/taxes/db/tax_types_db.inc"); if (isset($_GET['selected_id'])) { $selected_id = $_GET['selected_id']; -} +} elseif(isset($_POST['selected_id'])) { $selected_id = $_POST['selected_id']; } //----------------------------------------------------------------------------------- -function can_process() +function can_process() { - if (strlen($_POST['name']) == 0) + if (strlen($_POST['name']) == 0) { display_error(_("The tax type name cannot be empty.")); return false; - } - elseif (!is_numeric($_POST['rate'])) + } + elseif (!is_numeric($_POST['rate'])) { display_error( _("The default tax rate must be numeric.")); return false; - } - elseif ($_POST['rate'] < 0) + } + elseif ($_POST['rate'] < 0) { display_error( _("The default tax rate cannot be less than zero.")); return false; @@ -42,21 +41,21 @@ function can_process() //----------------------------------------------------------------------------------- -if (isset($_POST['ADD_ITEM']) && can_process()) +if (isset($_POST['ADD_ITEM']) && can_process()) { add_tax_type($_POST['name'], $_POST['sales_gl_code'], - $_POST['purchasing_gl_code'], $_POST['rate'], check_value('out')); + $_POST['purchasing_gl_code'], $_POST['rate']); meta_forward($_SERVER['PHP_SELF']); } //----------------------------------------------------------------------------------- -if (isset($_POST['UPDATE_ITEM']) && can_process()) +if (isset($_POST['UPDATE_ITEM']) && can_process()) { update_tax_type($selected_id, $_POST['name'], - $_POST['sales_gl_code'], $_POST['purchasing_gl_code'], $_POST['rate'], check_value('out')); + $_POST['sales_gl_code'], $_POST['purchasing_gl_code'], $_POST['rate']); meta_forward($_SERVER['PHP_SELF']); } @@ -67,7 +66,7 @@ function can_delete($selected_id) $sql= "SELECT COUNT(*) FROM ".TB_PREF."tax_group_items WHERE tax_type_id=$selected_id"; $result = db_query($sql, "could not query tax groups"); $myrow = db_fetch_row($result); - if ($myrow[0] > 0) + if ($myrow[0] > 0) { display_error(_("Cannot delete this tax type because tax groups been created referring to it.")); return false; @@ -79,7 +78,7 @@ function can_delete($selected_id) //----------------------------------------------------------------------------------- -if (isset($_GET['delete'])) +if (isset($_GET['delete'])) { if (can_delete($selected_id)) @@ -96,27 +95,23 @@ $result = get_all_tax_types(); start_table($table_style); $th = array(_("Description"), _("Default Rate (%)"), - _("Sales GL Account"), _("Purchasing GL Account"), _("Outstanding"), "", ""); -table_header($th); + _("Sales GL Account"), _("Purchasing GL Account"), "", ""); +table_header($th); $k = 0; -while ($myrow = db_fetch($result)) +while ($myrow = db_fetch($result)) { - if ($myrow['out'] == 1) - $out = _("Yes"); - else - $out = _("No"); alt_table_row_color($k); label_cell($myrow["name"]); label_cell(number_format2($myrow["rate"],user_percent_dec()), "align=right"); - label_cell($myrow["sales_gl_code"] . " " . $myrow["SalesAccountName"]); - label_cell($myrow["purchasing_gl_code"] . " " . $myrow["PurchasingAccountName"]); - label_cell($out); + label_cell($myrow["sales_gl_code"] . " " . $myrow["SalesAccountName"]); + label_cell($myrow["purchasing_gl_code"] . " " . $myrow["PurchasingAccountName"]); edit_link_cell("selected_id=".$myrow["id"]); delete_link_cell("selected_id=".$myrow["id"]."&delete=1"); + end_row(); } @@ -132,7 +127,7 @@ start_form(); start_table($table_style2); -if (isset($selected_id)) +if (isset($selected_id)) { //editing an existing status code @@ -142,7 +137,6 @@ if (isset($selected_id)) $_POST['rate'] = $myrow["rate"]; $_POST['sales_gl_code'] = $myrow["sales_gl_code"]; $_POST['purchasing_gl_code'] = $myrow["purchasing_gl_code"]; - $_POST['out'] = $myrow["out"]; hidden('selected_id', $selected_id); } @@ -152,8 +146,6 @@ text_row_ex(_("Default Rate:"), 'rate', 10, 10, "", "%"); gl_all_accounts_list_row(_("Sales GL Account:"), 'sales_gl_code', null); gl_all_accounts_list_row(_("Purchasing GL Account:"), 'purchasing_gl_code', null); -check_row(_("Outstanding:"), 'out', null); - end_table(1); submit_add_or_update_center(!isset($selected_id));