<?php
/**********************************************************************
Copyright (C) FrontAccounting, LLC.
<?php
/**********************************************************************
Copyright (C) FrontAccounting, LLC.
- Released under the terms of the GNU Affero General Public License,
- AGPL, as published by the Free Software Foundation, either version
- 3 of the License, or (at your option) any later version.
+ Released under the terms of the GNU General Public License, GPL,
+ as published by the Free Software Foundation, either version 3
+ of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
include_once($path_to_root . "/includes/ui.inc");
include_once($path_to_root . "/taxes/db/tax_types_db.inc");
include_once($path_to_root . "/includes/ui.inc");
include_once($path_to_root . "/taxes/db/tax_types_db.inc");
+ if (!is_tax_gl_unique(get_post('sales_gl_code'), get_post('purchasing_gl_code'), $selected_id)) {
+ display_error( _("Selected GL Accounts cannot be used by another tax type."));
+ set_focus('sales_gl_code');
+ return false;
+ }
- $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 (key_in_foreign_table($selected_id, 'tax_group_items', 'tax_type_id'))
start_table($table_style);
$th = array(_("Description"), _("Default Rate (%)"),
_("Sales GL Account"), _("Purchasing GL Account"), "", "");
start_table($table_style);
$th = array(_("Description"), _("Default Rate (%)"),
_("Sales GL Account"), _("Purchasing GL Account"), "", "");
label_cell($myrow["sales_gl_code"] . " " . $myrow["SalesAccountName"]);
label_cell($myrow["purchasing_gl_code"] . " " . $myrow["PurchasingAccountName"]);
label_cell($myrow["sales_gl_code"] . " " . $myrow["SalesAccountName"]);
label_cell($myrow["purchasing_gl_code"] . " " . $myrow["PurchasingAccountName"]);
edit_button_cell("Edit".$myrow["id"], _("Edit"));
delete_button_cell("Delete".$myrow["id"], _("Delete"));
end_row();
}
edit_button_cell("Edit".$myrow["id"], _("Edit"));
delete_button_cell("Delete".$myrow["id"], _("Delete"));
end_row();
}