} hidden('selected_id', $selected_id); } text_row_ex(tr("Description:"), 'name', 40); yesno_list_row(tr("Tax Shipping:"), 'tax_shipping', null, "", "", true); end_table(); display_note(tr("Select the taxes that are included in this group."), 1); start_table($table_style2); $th = array(tr("Tax"), tr("Default Rate (%)"), tr("Rate (%)")); table_header($th); for ($i = 0; $i < 5; $i++) { start_row(); if (!isset($_POST['tax_type_id' . $i])) { $_POST['tax_type_id' . $i] = 0; } tax_types_list_cells(null, 'tax_type_id' . $i, $_POST['tax_type_id' . $i], true, tr("None"), true); if ($_POST['tax_type_id' . $i] != 0 && $_POST['tax_type_id' . $i] != reserved_words::get_all_numeric()) { $default_rate = get_tax_type_default_rate($_POST['tax_type_id' . $i]); label_cell(percent_format($default_rate), "nowrap align=right"); if (!isset($_POST['rate' . $i]) || $_POST['rate' . $i] == "") { $_POST['rate' . $i] = percent_format($default_rate); } small_amount_cells(null, 'rate' . $i, $_POST['rate' . $i], null, null, user_percent_dec()); } end_row(); } end_table(1); submit_add_or_update_center(!isset($selected_id)); end_form(); //------------------------------------------------------------------------------------ end_page();
//----------------------------------------------------------------------------------- if ($Mode == 'ADD_ITEM' || $Mode == 'UPDATE_ITEM') { //initialise no input errors assumed initially before we test $input_error = 0; if (strlen($_POST['name']) == 0) { $input_error = 1; display_error(_("The tax group name cannot be empty.")); set_focus('name'); } if ($input_error != 1) { // create an array of the taxes and array of rates $taxes = array(); $rates = array(); while (($id = find_submit('tax_type_id')) != -1) { $taxes[] = $id; $rates[] = get_tax_type_default_rate($id); unset($_POST['tax_type_id' . $id]); } if ($selected_id != -1) { update_tax_group($selected_id, $_POST['name'], $_POST['tax_shipping'], $taxes, $rates); display_notification(_('Selected tax group has been updated')); } else { add_tax_group($_POST['name'], $_POST['tax_shipping'], $taxes, $rates); display_notification(_('New tax group has been added')); } $Mode = 'RESET'; } } //----------------------------------------------------------------------------------- function can_delete($selected_id) {