X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=sales%2Fmanage%2Fsales_points.php;h=c76196e50d557926d8a0b0c1ebc034810a530474;hb=3f361f69940fa9c2e0ff68657c6345ca0f14256f;hp=7aaac3580fbce0e3a5f14ad9cdd2f0431d77b316;hpb=7321070db48d99d322968e6e10d3ee96dc7c082d;p=fa-stable.git diff --git a/sales/manage/sales_points.php b/sales/manage/sales_points.php index 7aaac358..c76196e5 100644 --- a/sales/manage/sales_points.php +++ b/sales/manage/sales_points.php @@ -1,7 +1,16 @@ . +***********************************************************************/ +$page_security = 'SA_POSSETUP'; +$path_to_root = "../.."; include_once($path_to_root . "/includes/session.inc"); page(_("POS settings")); @@ -55,25 +64,34 @@ if ($Mode=='UPDATE_ITEM' && can_process()) if ($Mode == 'Delete') { - delete_sales_point($selected_id); - display_notification(_('Selected point of sale has been deleted')); - $Mode = 'RESET'; + $sql = "SELECT * FROM ".TB_PREF."users WHERE print_profile=".db_escape($selected_id); + $res = db_query($sql, "canot check pos usage"); + if (db_num_rows($res)) { + display_error(_("Cannot delete this POS because it is used in users setup.")); + } else { + delete_sales_point($selected_id); + display_notification(_('Selected point of sale 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_sales_points(); +$result = get_all_sales_points(check_value('show_inactive')); start_form(); start_table("$table_style"); $th = array (_('POS Name'), _('Credit sale'), _('Cash sale'), _('Location'), _('Default account'), '',''); +inactive_control_column($th); table_header($th); $k = 0; @@ -85,19 +103,21 @@ while ($myrow = db_fetch($result)) label_cell($myrow['cash_sale'] ? _('Yes') : _('No')); label_cell($myrow["location_name"], ""); label_cell($myrow["bank_account_name"], ""); + inactive_control_cell($myrow["id"], $myrow["inactive"], "sales_pos", 'id'); edit_button_cell("Edit".$myrow['id'], _("Edit")); - edit_button_cell("Delete".$myrow['id'], _("Delete")); + delete_button_cell("Delete".$myrow['id'], _("Delete")); end_row(); } -end_table(); -end_form(); -echo '
'; +inactive_control_row($th); +end_table(1); //---------------------------------------------------------------------------------------------------- -start_form(); +$cash = db_has_cash_accounts(); + +if (!$cash) display_note(_("To have cash POS first define at least one cash bank account.")); -start_table("$table_style2 width=30%"); +start_table($table_style2); if ($selected_id != -1) { @@ -115,14 +135,20 @@ if ($selected_id != -1) } text_row_ex(_("Point of Sale Name").':', 'name', 20, 30); -check_row(_('Allowed credit sale'), 'credit', check_value('credit_sale')); -check_row(_('Allowed cash sale'), 'cash', check_value('cash_sale')); -locations_list_row(_("POS location").':', 'location'); -cash_accounts_list_row(_("Default cash account").':', 'account'); +if($cash) { + check_row(_('Allowed credit sale'), 'credit', check_value('credit_sale')); + check_row(_('Allowed cash sale'), 'cash', check_value('cash_sale')); + cash_accounts_list_row(_("Default cash account").':', 'account'); +} else { + hidden('credit', 1); + hidden('cash', 0); + hidden('account', 0); +} +locations_list_row(_("POS location").':', 'location'); end_table(1); -submit_add_or_update_center($selected_id == -1, '', true); +submit_add_or_update_center($selected_id == -1, '', 'both'); end_form();