CREATE TABLE `fonction` (
  `NoGroupe` int(10) unsigned NOT NULL,
  `NoFonction` int(10) unsigned NOT NULL,
  `Description` varchar(64) NOT NULL,
  `Type` int(10) unsigned NOT NULL,
  `Sous_Type` int(10) unsigned NOT NULL,
  `Extra` varchar(255) default NULL,
  PRIMARY KEY  (`NoGroupe`,`NoFonction`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

CREATE TABLE `groupefonction` (
  `NoGroupe` int(10) unsigned NOT NULL,
  `Description` varchar(20) NOT NULL,
  PRIMARY KEY  (`NoGroupe`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1;

CREATE TABLE `groupeusers` (
  `NoGroupeUsers` int(10) unsigned NOT NULL auto_increment,
  `Description` varchar(20) NOT NULL,
  `Admin` tinyint(4) NOT NULL,
  `Banque` tinyint(4) NOT NULL,
  PRIMARY KEY  (`NoGroupeUsers`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1;

CREATE TABLE `groupeusersfonction` (
  `NoGroupeUsers` int(11) NOT NULL,
  `NoGroupe` int(11) NOT NULL,
  `NoFonction` int(11) NOT NULL,
  PRIMARY KEY  (`NoGroupeUsers`,`NoGroupe`,`NoFonction`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

ALTER TABLE `users` ADD
  `NoGroupeUsers` int(10) unsigned NOT NULL default '2';


INSERT INTO `fonction` (`NoGroupe`, `NoFonction`, `Description`, `Type`, `Sous_Type`, `Extra`) VALUES 
(1, 1, 'Afficher article', 1, 1, NULL),
(1, 2, 'Modifier article', 1, 2, NULL),
(1, 3, 'Nouvel article', 1, 3, NULL),
(1, 4, 'Copier article', 1, 4, NULL),
(1, 5, 'Supprimer article', 1, 5, NULL),
(1, 6, 'Liste articles', 1, 6, NULL),
(1, 7, 'Importation maj articles', 1, 7, NULL),
(1, 8, 'Liste mouvements article', 1, 8, NULL),
(1, 10, 'R�c�ption commande', 1, 10, NULL),
(1, 11, 'Cat�gories shop', 1, 11, NULL),
(1, 91, 'Inventaire - Remise � z�ro', 1, 91, NULL),
(1, 92, 'Inventaire - Ajouter', 1, 92, NULL),
(2, 1, 'Afficher vehicule', 2, 1, NULL),
(2, 2, 'Modifier vehicule', 2, 2, NULL),
(2, 3, 'Nouveau vehicule', 2, 3, NULL),
(2, 4, 'Copier vehicule', 2, 4, NULL),
(2, 5, 'Supprimer vehicule', 2, 5, NULL),
(2, 6, 'Liste vehicules', 2, 6, NULL),
(2, 7, 'Vehicules location - Nouveau', 2, 7, NULL),
(2, 8, 'Vehicules location - Modifier', 2, 8, NULL),
(2, 9, 'Vehicules location - Supprimer', 2, 9, NULL),
(2, 10, 'Vehicules occasion', 2, 10, NULL),
(2, 11, 'Vehicules neufs', 2, 11, NULL),
(2, 12, 'Vehicules location - Tri', 2, 12, NULL),
(3, 1, 'Afficher client', 3, 1, NULL),
(3, 2, 'Modifier client', 3, 2, NULL),
(3, 3, 'Nouveau client', 3, 3, NULL),
(3, 4, 'Copier client', 3, 4, NULL),
(3, 5, 'Supprimer client', 3, 5, NULL),
(3, 6, 'Liste clients', 3, 6, NULL),
(3, 7, 'Nettoyage clients', 3, 7, NULL),
(3, 8, 'Rabais client', 3, 8, NULL),
(4, 1, 'Modifier commande', 4, 1, NULL),
(4, 201, 'Facture - Facture d�taill�e', 4, 1, '&Etape=2&New=1&NewType=FD'),
(4, 202, 'Facture - Bulletin de livraison', 4, 1, '&Etape=2&New=1&NewType=BP'),
(4, 203, 'Facture - Facture bulletin de livraison', 4, 1, '&Etape=2&New=1&NewType=FB'),
(4, 204, 'Facture - Facture vehicule neuf', 4, 1, '&Etape=2&New=1&NewType=FV'),
(4, 205, 'Facture - Facture vehicule occasion', 4, 1, '&Etape=2&New=1&NewType=FO'),
(4, 206, 'Facture - Facture location', 4, 1, '&Etape=2&New=1&NewType=FL'),
(4, 207, 'Facture - Facture interne', 4, 1, '&Etape=2&New=1&NewType=FI'),
(4, 208, 'Devis - Nouveau', 4, 1, '&Etape=2&New=1&NewType=DP'),
(4, 209, 'Devis - Transformer', 4, 22, NULL),
(4, 210, 'Offre pieces - Nouvelle', 4, 1, '&Etape=2&New=1&NewType=OP'),
(4, 211, 'Offre pieces - Transformer', 4, 24, NULL),
(4, 212, 'Offre vehivule - Nouvelle', 4, 1, '&Etape=2&New=1&NewType=OV'),
(4, 213, 'Offre vehivule - Transformer', 4, 26, NULL),
(4, 214, 'Commande - Commande', 4, 1, '&Etape=2&New=1&NewType=CP'),
(4, 215, 'Commande - Retour commande', 4, 1, '&Etape=2&New=1&NewType=RC'),
(4, 216, 'Commande - Achat marchandise', 4, 1, '&Etape=2&New=1&NewType=AM'),
(4, 217, 'Garantie - Garantie fourniseur', 4, 1, '&Etape=2&New=1&NewType=GF'),
(4, 218, 'Garantie - Garantie garage', 4, 1, '&Etape=2&New=1&NewType=GG'),
(4, 219, 'Reprise - Reprise vehicule', 4, 1, '&Etape=2&New=1&NewType=RV'),
(4, 220, 'Note de cr�dit - Facture d�taill�e', 4, 1, '&Etape=2&New=1&NewType=ND'),
(4, 221, 'Note de cr�dit - Facture de bulletins de livraison', 4, 1, '&Etape=2&New=1&NewType=NB'),
(4, 222, 'Note de cr�dit - Facture vehicule neuf', 4, 1, '&Etape=2&New=1&NewType=NV'),
(4, 223, 'Note de cr�dit - Facture vehicule occasion', 4, 1, '&Etape=2&New=1&NewType=NO'),
(4, 224, 'Note de cr�dit - Facture location', 4, 1, '&Etape=2&New=1&NewType=NL'),
(5, 1, 'Calendrier locations', 5, 1, NULL),
(5, 2, 'Calendrier atelier', 5, 2, NULL),
(5, 3, 'Calendrier enploy�s', 5, 3, NULL);

-- 
-- Contenu de la table `groupefonction`
-- 

INSERT INTO `groupefonction` (`NoGroupe`, `Description`) VALUES 
(1, 'Articles'),
(2, 'V�hicules'),
(3, 'Clients'),
(4, 'Commandes'),
(5, 'Calendriers'),
(6, 'Comptabilit�'),
(10, 'Configuration');

-- 
-- Contenu de la table `groupeusers`
-- 

INSERT INTO `groupeusers` (`NoGroupeUsers`, `Description`, `Admin`, `Banque`) VALUES 
(1, 'Admin', 1, 1),
(2, 'Utilisateur', 0, 0);

-- 
-- Contenu de la table `groupeusersfonction`
-- 

INSERT INTO `groupeusersfonction` (`NoGroupeUsers`, `NoGroupe`, `NoFonction`) VALUES 
(1, 1, 1),
(1, 1, 2),
(1, 1, 3),
(1, 1, 4),
(1, 1, 5),
(1, 1, 6),
(1, 1, 7),
(1, 1, 8),
(1, 1, 10),
(1, 1, 11),
(1, 1, 91),
(1, 1, 92),
(1, 2, 1),
(1, 2, 2),
(1, 2, 3),
(1, 2, 4),
(1, 2, 5),
(1, 2, 6),
(1, 2, 7),
(1, 2, 8),
(1, 2, 9),
(1, 2, 10),
(1, 2, 11),
(1, 2, 12),
(1, 3, 1),
(1, 3, 2),
(1, 3, 3),
(1, 3, 4),
(1, 3, 5),
(1, 3, 6),
(1, 3, 7),
(1, 3, 8),
(1, 4, 1),
(1, 4, 201),
(1, 4, 202),
(1, 4, 203),
(1, 4, 204),
(1, 4, 205),
(1, 4, 206),
(1, 4, 207),
(1, 4, 208),
(1, 4, 209),
(1, 4, 210),
(1, 4, 211),
(1, 4, 212),
(1, 4, 213),
(1, 4, 214),
(1, 4, 215),
(1, 4, 216),
(1, 4, 217),
(1, 4, 218),
(1, 4, 219),
(1, 4, 220),
(1, 4, 221),
(1, 4, 222),
(1, 4, 223),
(1, 4, 224),
(1, 5, 1),
(1, 5, 2),
(1, 5, 3),
(2, 1, 1),
(2, 2, 1),
(2, 2, 2),
(2, 2, 3),
(2, 2, 4),
(2, 2, 5),
(2, 2, 6),
(2, 2, 7),
(2, 2, 8),
(2, 2, 9),
(2, 2, 10),
(2, 2, 11),
(2, 2, 12),
(2, 3, 1),
(2, 3, 2),
(2, 3, 3),
(2, 3, 4),
(2, 3, 5),
(2, 3, 6),
(2, 3, 7),
(2, 3, 8),
(2, 4, 1),
(2, 4, 201),
(2, 4, 202),
(2, 4, 203),
(2, 4, 204),
(2, 4, 205),
(2, 4, 206),
(2, 4, 207),
(2, 4, 208),
(2, 4, 209),
(2, 4, 210),
(2, 4, 211),
(2, 4, 212),
(2, 4, 213),
(2, 4, 214),
(2, 4, 215),
(2, 4, 216),
(2, 4, 217),
(2, 4, 218),
(2, 4, 219),
(2, 4, 220),
(2, 4, 221),
(2, 4, 222),
(2, 4, 223),
(2, 4, 224),
(2, 5, 1),
(2, 5, 2),
(2, 5, 3);
