$myrow = db_fetch_row($result); if ($myrow[0] > 0) { display_error(tr("Cannot delete this tax type because tax groups been created referring to it.")); return false; } return true; } //----------------------------------------------------------------------------------- if (isset($_GET['delete'])) { if (can_delete($selected_id)) { delete_tax_type($selected_id); meta_forward($_SERVER['PHP_SELF']); } } //----------------------------------------------------------------------------------- $result = get_all_tax_types(); start_table($table_style); $th = array(tr("Description"), tr("Default Rate (%)"), tr("Sales GL Account"), tr("Purchasing GL Account"), "", ""); table_header($th); $k = 0; while ($myrow = db_fetch($result)) { alt_table_row_color($k); label_cell($myrow["name"]); label_cell(percent_format($myrow["rate"]), "align=right"); 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(); } end_table();
//----------------------------------------------------------------------------------- if ($Mode == 'Delete') { if (can_delete($selected_id)) { delete_tax_type($selected_id); display_notification(_('Selected tax type has been deleted')); } $Mode = 'RESET'; } if ($Mode == 'RESET') { $selected_id = -1; $sav = get_post('show_inactive'); unset($_POST); $_POST['show_inactive'] = $sav; } //----------------------------------------------------------------------------------- $result = get_all_tax_types(check_value('show_inactive')); start_form(); display_note(_("To avoid problems with manual journal entry all tax types should have unique Sales/Purchasing GL accounts."), 0, 1); start_table(TABLESTYLE); $th = array(_("Description"), _("Default Rate (%)"), _("Sales GL Account"), _("Purchasing GL Account"), "", ""); inactive_control_column($th); table_header($th); $k = 0; while ($myrow = db_fetch($result)) { alt_table_row_color($k); label_cell($myrow["name"]); label_cell(percent_format($myrow["rate"]), "align=right"); label_cell($myrow["sales_gl_code"] . " " . $myrow["SalesAccountName"]); label_cell($myrow["purchasing_gl_code"] . " " . $myrow["PurchasingAccountName"]); inactive_control_cell($myrow["id"], $myrow["inactive"], 'tax_types', 'id'); edit_button_cell("Edit" . $myrow["id"], _("Edit"));