-- http://www.phpmyadmin.net
--
-- Client :  127.0.0.1
-- Généré le :  Jeu 23 Mai 2019 à 16:36
-- Version du serveur :  5.6.17
-- Version de PHP :  5.5.12




--
-- Base de données :  `dbxed`
--

-- --------------------------------------------------------

--
-- Structure de la table `adresse`
--

CREATE TABLE IF NOT EXISTS `adresse` (
  `idAdresse` int(11) NOT NULL AUTO_INCREMENT,
  `libelle` text NOT NULL,
  `latitude` varchar(80) NOT NULL,
  `longitude` varchar(80) NOT NULL,
  `description` text NOT NULL,
  `isPrincipale` int(11) NOT NULL,
  `idUtilisateur` int(11) NOT NULL,
  `dateAjout` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `etat` int(11) NOT NULL DEFAULT '1',
  PRIMARY KEY (`idAdresse`),
  KEY `idUtilisateur` (`idUtilisateur`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=27 ;

--
-- Contenu de la table `adresse`
--

INSERT INTO `adresse` (`idAdresse`, `libelle`, `latitude`, `longitude`, `description`, `isPrincipale`, `idUtilisateur`, `dateAjout`, `etat`) VALUES
(5, 'lat, lng', 'lat', ' lng', '', 0, 1, '2019-05-08 11:18:34', 1),
(6, '654ss', '0', '0', '', 0, 1, '2019-05-08 11:18:34', 1),
(7, '654ss', '0', '0', '', 0, 1, '2019-05-08 11:24:47', 1),
(8, '654ss', '0', '0', '', 0, 1, '2019-05-08 11:26:02', 1),
(9, 'kossovo', '0', '0', '', 0, 1, '2019-05-09 11:35:45', 1),
(10, 'giomloi', '0', '0', '', 0, 1, '2019-05-09 11:35:45', 1),
(11, '14.724351, -17.4705542', '14.724351', ' -17.4705542', '', 0, 1, '2019-05-11 19:57:05', 1),
(12, 'Ouakam', '0', '0', '', 0, 1, '2019-05-11 19:57:05', 1),
(13, 'Ouakam', '0', '0', '', 0, 1, '2019-05-11 19:57:09', 1),
(14, 'VDN, derrière Hyundai', '0', '0', '', 0, 0, '2019-05-13 08:49:30', 1),
(15, 'Ouakam, comico', '0', '0', '', 0, 0, '2019-05-13 08:49:30', 1),
(16, 'gfh', '14.748033', ' -17.448983', '', 0, 1, '2019-05-13 08:58:55', 1),
(17, 'Pikine', '14.764960', ' -17.368969', '', 0, 9, '2019-05-13 08:58:55', 1),
(18, 'VDN, derrière Hyundai', '14.724351', '-17.4705542', '', 0, 1, '2019-05-13 09:01:29', 1),
(19, 'Ouakam Comico', '14.726996', '-17.483286', '', 0, 10, '2019-05-13 09:01:29', 1),
(21, 'Almadies', '546', '    654', '', 1, 17, '2019-05-21 09:10:57', 1),
(22, 'Goro loki', '546', '      654', '', 1, 13, '2019-05-21 09:10:57', 1),
(23, 'Groto folo', '546', '    654', '', 1, 14, '2019-05-21 09:10:57', 1),
(24, 'Zac Mbao', '12457', ' 54684', '', 1, 18, '2019-05-21 10:35:33', 1),
(25, 'Oukam, Camp de police', '0', '0', '', 0, 20, '2019-05-23 13:52:33', 1),
(26, 'Madina, Rue 6x4', '0', '0', '', 0, 1, '2019-05-23 13:58:05', 1);

-- --------------------------------------------------------

--
-- Structure de la table `affectationcommerce`
--

CREATE TABLE IF NOT EXISTS `affectationcommerce` (
  `idAffectationcommerce` int(11) NOT NULL AUTO_INCREMENT,
  `codeAffectation` varchar(80) NOT NULL,
  `idLivreur` int(11) NOT NULL,
  `idCommerce` int(11) NOT NULL,
  `idUtilisateur` int(11) NOT NULL,
  `dateDebut` varchar(80) NOT NULL,
  `heureDebut` varchar(80) DEFAULT NULL,
  `heureFin` varchar(80) DEFAULT NULL,
  `idEtataffectation` int(11) NOT NULL,
  `dateAjout` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `etat` int(11) NOT NULL DEFAULT '1',
  PRIMARY KEY (`idAffectationcommerce`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=6 ;

--
-- Contenu de la table `affectationcommerce`
--

INSERT INTO `affectationcommerce` (`idAffectationcommerce`, `codeAffectation`, `idLivreur`, `idCommerce`, `idUtilisateur`, `dateDebut`, `heureDebut`, `heureFin`, `idEtataffectation`, `dateAjout`, `etat`) VALUES
(1, 'AFC01', 14, 1, 11, '24/05/2019', '11:00', '14:00', 1, '2019-05-23 10:28:48', 1),
(2, 'AFC01', 18, 1, 11, '24/05/2019', '14:00', '15:00', 1, '2019-05-23 10:28:48', 1),
(3, 'AFC02', 13, 2, 11, '25/05/2019', '08:30', '12:30', 1, '2019-05-23 13:44:03', 1),
(4, 'AFC02', 14, 2, 11, '25/05/2019', '12:30', '16:30', 1, '2019-05-23 13:44:03', 1),
(5, 'AFC02', 18, 2, 11, '25/05/2019', '16:30', '17:45', 1, '2019-05-23 13:44:03', 1);

-- --------------------------------------------------------

--
-- Structure de la table `bilancourse`
--

CREATE TABLE IF NOT EXISTS `bilancourse` (
  `idBlancourse` int(11) NOT NULL AUTO_INCREMENT,
  `idCourse` int(11) NOT NULL,
  `idUtilisateur` int(11) NOT NULL,
  `note` int(11) NOT NULL,
  `commentaire` text NOT NULL,
  `dateAjout` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `etat` int(11) NOT NULL DEFAULT '1',
  PRIMARY KEY (`idBlancourse`),
  KEY `idCourse` (`idCourse`),
  KEY `idDestinataire` (`idUtilisateur`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Structure de la table `commerce`
--

CREATE TABLE IF NOT EXISTS `commerce` (
  `idCommerce` int(11) NOT NULL AUTO_INCREMENT,
  `nom` varchar(80) NOT NULL,
  `telephone1` varchar(80) NOT NULL,
  `telephone2` varchar(80) NOT NULL,
  `adresse` text NOT NULL,
  `email` varchar(80) NOT NULL,
  `debutPlage` varchar(11) NOT NULL,
  `finPlage` varchar(11) NOT NULL,
  `idTranchehoraire` int(11) NOT NULL,
  `idTypetarif` int(11) NOT NULL,
  `montant` varchar(80) NOT NULL,
  `contact` varchar(80) NOT NULL,
  `telephoneContact` varchar(80) NOT NULL,
  `idUtilisateur` int(11) NOT NULL,
  `dateAjout` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `etat` int(11) NOT NULL DEFAULT '1',
  `position` varchar(80) NOT NULL,
  PRIMARY KEY (`idCommerce`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;

--
-- Contenu de la table `commerce`
--

INSERT INTO `commerce` (`idCommerce`, `nom`, `telephone1`, `telephone2`, `adresse`, `email`, `debutPlage`, `finPlage`, `idTranchehoraire`, `idTypetarif`, `montant`, `contact`, `telephoneContact`, `idUtilisateur`, `dateAjout`, `etat`, `position`) VALUES
(1, 'Carré d''or', '781254645', '7745132165', 'Rufisque', 'carredor@yahoo.fr', '11:00', '15:00', 1, 2, '1500', 'Parra Polin', '776665544', 16, '2019-05-20 10:23:43', 1, '14.716453, -17.271787'),
(2, 'Graine d''Or', '33 820 85 73', '', 'Route de l''aéroport, Ngor Dakar, Sénégal', 'contact@patisseriegrainedor.com', '08:30', '17:45', 2, 1, '', 'M. Follo Gabi', '771254958', 19, '2019-05-22 11:45:37', 1, '14.7494956,-17.5081087');

-- --------------------------------------------------------

--
-- Structure de la table `compte`
--

CREATE TABLE IF NOT EXISTS `compte` (
  `idCompte` int(11) NOT NULL AUTO_INCREMENT,
  `idUtilisateur` int(11) NOT NULL,
  `idRole` int(11) NOT NULL,
  `login` varchar(80) NOT NULL,
  `motDePasse` text NOT NULL,
  `dateAjout` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `etat` int(11) NOT NULL DEFAULT '1',
  PRIMARY KEY (`idCompte`),
  KEY `idUtilisateur` (`idUtilisateur`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=12 ;

--
-- Contenu de la table `compte`
--

INSERT INTO `compte` (`idCompte`, `idUtilisateur`, `idRole`, `login`, `motDePasse`, `dateAjout`, `etat`) VALUES
(1, 7, 1, '7815869967', '40bd001563085fc35165329ea1ff5c5ecbdbbeef', '2019-05-10 14:27:22', 1),
(2, 1, 1, '781586996', '40bd001563085fc35165329ea1ff5c5ecbdbbeef', '2019-05-10 14:27:22', 1),
(3, 11, 5, 'agent', '40bd001563085fc35165329ea1ff5c5ecbdbbeef', '2019-05-13 11:42:39', 1),
(4, 12, 5, 'agent1', '40bd001563085fc35165329ea1ff5c5ecbdbbeef', '2019-05-13 11:42:39', 1),
(5, 13, 3, 'livreur1', '40bd001563085fc35165329ea1ff5c5ecbdbbeef', '2019-05-16 12:05:41', 1),
(6, 14, 3, 'livreur2', '40bd001563085fc35165329ea1ff5c5ecbdbbeef', '2019-05-16 12:05:41', 1),
(8, 16, 4, '776665544', '40bd001563085fc35165329ea1ff5c5ecbdbbeef', '2019-05-20 10:23:43', 1),
(9, 17, 2, 'axa', '40bd001563085fc35165329ea1ff5c5ecbdbbeef', '2019-05-21 09:10:57', 1),
(10, 18, 3, 'livreur3', '40bd001563085fc35165329ea1ff5c5ecbdbbeef', '2019-05-21 10:35:33', 1),
(11, 19, 4, 'gd', '40bd001563085fc35165329ea1ff5c5ecbdbbeef', '2019-05-22 11:45:37', 1);

-- --------------------------------------------------------

--
-- Structure de la table `contactclientpro`
--

CREATE TABLE IF NOT EXISTS `contactclientpro` (
  `idContactclientpro` int(11) NOT NULL AUTO_INCREMENT,
  `contact` varchar(80) NOT NULL,
  `telephoneContact` varchar(80) NOT NULL,
  `idUtilisateur` int(11) NOT NULL,
  `dateAjout` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `etat` int(11) NOT NULL DEFAULT '1',
  PRIMARY KEY (`idContactclientpro`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;

--
-- Contenu de la table `contactclientpro`
--

INSERT INTO `contactclientpro` (`idContactclientpro`, `contact`, `telephoneContact`, `idUtilisateur`, `dateAjout`, `etat`) VALUES
(1, 'axa contact', '231213546', 17, '2019-05-21 09:10:57', 1);

-- --------------------------------------------------------

--
-- Structure de la table `course`
--

CREATE TABLE IF NOT EXISTS `course` (
  `idCourse` int(11) NOT NULL AUTO_INCREMENT,
  `idDemande` int(11) NOT NULL,
  `idExpediteur` int(11) NOT NULL,
  `idDestinataire` int(11) NOT NULL,
  `dateAssignation` varchar(80) NOT NULL,
  `idLivreur` int(11) NOT NULL,
  `dateAjout` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `etat` int(11) NOT NULL DEFAULT '1',
  PRIMARY KEY (`idCourse`),
  KEY `idDemande` (`idDemande`),
  KEY `idExpediteur` (`idExpediteur`),
  KEY `idDestinataire` (`idDestinataire`),
  KEY `idLivreur` (`idLivreur`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;

--
-- Contenu de la table `course`
--

INSERT INTO `course` (`idCourse`, `idDemande`, `idExpediteur`, `idDestinataire`, `dateAssignation`, `idLivreur`, `dateAjout`, `etat`) VALUES
(3, 63, 1, 10, '2019-05-21 12:13:12', 18, '2019-05-21 11:13:12', 1);

-- --------------------------------------------------------

--
-- Structure de la table `demande`
--

CREATE TABLE IF NOT EXISTS `demande` (
  `idDemande` int(11) NOT NULL AUTO_INCREMENT,
  `idAdresseexpedition` int(11) DEFAULT NULL,
  `idAdressedestination` int(11) DEFAULT NULL,
  `idExpediteur` int(11) DEFAULT NULL,
  `idDestinataire` int(11) DEFAULT NULL,
  `isInprogress` int(11) DEFAULT NULL,
  `isReady` int(11) NOT NULL DEFAULT '0',
  `commentaire` text,
  `dateCourse` varchar(80) DEFAULT NULL,
  `idResponsable` int(11) DEFAULT NULL,
  `dateDebutraitement` varchar(80) DEFAULT NULL,
  `dateFintraitement` varchar(80) DEFAULT NULL,
  `dateAjout` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `etat` int(11) NOT NULL DEFAULT '1',
  PRIMARY KEY (`idDemande`),
  KEY `idAdresseexpedition` (`idAdresseexpedition`),
  KEY `idAdressedestination` (`idAdressedestination`,`idExpediteur`,`idDestinataire`,`idResponsable`),
  KEY `idExpediteur` (`idExpediteur`),
  KEY `idDestinataire` (`idDestinataire`),
  KEY `idResponsable` (`idResponsable`),
  KEY `idAdressedestination_2` (`idAdressedestination`,`idExpediteur`,`idDestinataire`,`idResponsable`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=66 ;

--
-- Contenu de la table `demande`
--

INSERT INTO `demande` (`idDemande`, `idAdresseexpedition`, `idAdressedestination`, `idExpediteur`, `idDestinataire`, `isInprogress`, `isReady`, `commentaire`, `dateCourse`, `idResponsable`, `dateDebutraitement`, `dateFintraitement`, `dateAjout`, `etat`) VALUES
(1, 5, 6, 1, 5, 0, 0, '', '', NULL, '', '', '2019-05-08 11:18:34', 1),
(3, 5, 8, 1, 4, 0, 0, '', '', NULL, '', '', '2019-05-08 11:26:02', 1),
(4, 9, 10, 1, 6, 0, 0, '', '', NULL, '', '', '2019-05-09 11:35:45', 1),
(5, 9, 10, 1, 6, 0, 0, '', '', NULL, '', '', '2019-05-09 11:35:45', 1),
(6, 5, 8, 1, 4, 0, 0, '', '', NULL, '', '', '2019-05-08 11:26:02', 1),
(7, 5, 6, 1, 5, 0, 0, '', '', NULL, '', '', '2019-05-08 11:18:34', 1),
(8, 5, 6, 1, 5, 0, 0, '', '', NULL, '', '', '2019-05-08 11:18:34', 1),
(9, 5, 6, 1, 5, 0, 0, '', '', NULL, '', '', '2019-05-08 11:18:34', 1),
(10, 5, 6, 1, 5, 0, 0, '', '', NULL, '', '', '2019-05-08 11:18:34', 1),
(11, 5, 6, 1, 5, 0, 0, '', '', NULL, '', '', '2019-05-08 11:18:34', 1),
(12, 5, 6, 1, 5, 0, 0, '', '', NULL, '', '', '2019-05-08 11:18:34', 1),
(13, 5, 6, 1, 5, 0, 0, '', '', NULL, '', '', '2019-05-08 11:18:34', 1),
(14, 5, 6, 1, 5, 0, 0, '', '', NULL, '', '', '2019-05-08 11:18:34', 1),
(15, 5, 6, 1, 5, 0, 0, '', '', NULL, '', '', '2019-05-08 11:18:34', 1),
(16, 5, 6, 1, 5, 0, 0, '', '', NULL, '', '', '2019-05-08 11:18:34', 1),
(17, 5, 6, 1, 5, 0, 0, '', '', NULL, '', '', '2019-05-08 11:18:34', 1),
(18, 5, 6, 1, 5, 0, 0, '', '', NULL, '', '', '2019-05-08 11:18:34', 1),
(19, 5, 6, 1, 5, 0, 0, '', '', NULL, '', '', '2019-05-08 11:18:34', 1),
(20, 5, 6, 1, 5, 0, 0, '', '', NULL, '', '', '2019-05-08 11:18:34', 1),
(21, 5, 6, 1, 5, 0, 0, '', '', NULL, '', '', '2019-05-08 11:18:34', 1),
(22, 5, 6, 1, 5, 0, 0, '', '', NULL, '', '', '2019-05-08 11:18:34', 1),
(23, 5, 6, 1, 5, 0, 0, '', '', NULL, '', '', '2019-05-08 11:18:34', 1),
(24, 5, 6, 1, 5, 0, 0, '', '', NULL, '', '', '2019-05-08 11:18:34', 1),
(25, 5, 6, 1, 5, 0, 0, '', '', NULL, '', '', '2019-05-08 11:18:34', 1),
(26, 5, 6, 1, 5, 0, 0, '', '', NULL, '', '', '2019-05-08 11:18:34', 1),
(27, 5, 6, 1, 5, 0, 0, '', '', NULL, '', '', '2019-05-08 11:18:34', 1),
(28, 5, 6, 1, 5, 0, 0, '', '', NULL, '', '', '2019-05-08 11:18:34', 1),
(29, 5, 6, 1, 5, 0, 0, '', '', NULL, '', '', '2019-05-08 11:18:34', 1),
(30, 5, 6, 1, 5, 0, 0, '', '', NULL, '', '', '2019-05-08 11:18:34', 1),
(31, 5, 6, 1, 5, 0, 0, '', '', NULL, '', '', '2019-05-08 11:18:34', 1),
(32, 5, 6, 1, 5, 0, 0, '', '', NULL, '', '', '2019-05-08 11:18:34', 1),
(33, 5, 6, 1, 5, 0, 0, '', '', NULL, '', '', '2019-05-08 11:18:34', 1),
(34, 5, 6, 1, 5, 0, 0, '', '', NULL, '', '', '2019-05-08 11:18:34', 1),
(35, 5, 6, 1, 5, 0, 0, '', '', NULL, '', '', '2019-05-08 11:18:34', 1),
(36, 5, 6, 1, 5, 0, 0, '', '', NULL, '', '', '2019-05-08 11:18:34', 1),
(37, 5, 6, 1, 5, 0, 0, '', '', NULL, '', '', '2019-05-08 11:18:34', 1),
(38, 5, 6, 1, 5, 0, 0, '', '', NULL, '', '', '2019-05-08 11:18:34', 1),
(39, 5, 6, 1, 5, 0, 0, '', '', NULL, '', '', '2019-05-08 11:18:34', 1),
(40, 5, 6, 1, 5, 0, 0, '', '', NULL, '', '', '2019-05-08 11:18:34', 1),
(41, 5, 6, 1, 5, 0, 0, '', '', NULL, '', '', '2019-05-08 11:18:34', 1),
(42, 5, 6, 1, 5, 0, 0, '', '', NULL, '', '', '2019-05-08 11:18:34', 1),
(43, 5, 6, 1, 5, 0, 0, '', '', NULL, '', '', '2019-05-08 11:18:34', 1),
(44, 5, 6, 1, 5, 0, 0, '', '', NULL, '', '', '2019-05-08 11:18:34', 1),
(45, 5, 6, 1, 5, 0, 0, '', '', NULL, '', '', '2019-05-08 11:18:34', 1),
(46, 5, 6, 1, 5, 0, 0, '', '', NULL, '', '', '2019-05-08 11:18:34', 1),
(47, 5, 6, 1, 5, 0, 0, '', '', NULL, '', '', '2019-05-08 11:18:34', 1),
(48, 5, 6, 1, 5, 0, 0, '', '', NULL, '', '', '2019-05-08 11:18:34', 1),
(49, 5, 6, 1, 5, 0, 0, '', '', NULL, '', '', '2019-05-08 11:18:34', 1),
(50, 5, 6, 1, 5, 0, 0, '', '', NULL, '', '', '2019-05-08 11:18:34', 1),
(51, 5, 6, 1, 5, 0, 0, '', '', NULL, '', '', '2019-05-08 11:18:34', 1),
(52, 5, 6, 1, 5, 0, 0, '', '', NULL, '', '', '2019-05-08 11:18:34', 1),
(53, 5, 6, 1, 5, 0, 0, '', '', NULL, '', '', '2019-05-08 11:18:34', 1),
(54, 5, 6, 1, 5, 0, 0, '', '', NULL, '', '', '2019-05-08 11:18:34', 1),
(55, 5, 6, 1, 5, 0, 0, '', '', NULL, '', '', '2019-05-08 11:18:34', 1),
(56, 5, 6, 1, 5, 0, 0, '', '', NULL, '', '', '2019-05-08 11:18:34', 1),
(57, 5, 6, 1, 5, 0, 0, '', '', NULL, '', '', '2019-05-08 11:18:34', 1),
(58, 10, 6, 1, 5, 0, 0, '', '', NULL, '', '', '2019-05-08 11:18:34', 1),
(59, 11, 12, 1, 8, 0, 0, '', '', NULL, '', '', '2019-05-11 19:57:05', 1),
(60, 11, 13, 1, 8, 1, 0, '', '', 11, '2019-05-18 13:34:57', '', '2019-05-11 19:57:09', 1),
(61, 14, 15, 0, 8, 0, 0, '', '', NULL, '', '', '2019-05-13 08:49:30', 1),
(62, 16, 17, 1, 9, 1, 1, '', '', 11, '2019-05-17 11:51:10', '2019-05-17 11:57:22', '2019-05-13 08:58:55', 1),
(63, 18, 19, 1, 10, 1, 1, 'Just for test', '', 11, '2019-05-15 11:20:05', '2019-05-16 09:30:58', '2019-05-13 09:01:29', 1),
(65, 26, 25, 1, 20, 0, 0, '', '', NULL, '', '', '2019-05-23 13:58:05', 1);

-- --------------------------------------------------------

--
-- Structure de la table `detailsdemande`
--

CREATE TABLE IF NOT EXISTS `detailsdemande` (
  `idDetailsdemande` int(11) NOT NULL AUTO_INCREMENT,
  `idDemande` int(11) NOT NULL,
  `idPayeur` int(11) NOT NULL,
  `paiementRecupcolis` int(11) NOT NULL,
  `montant` text NOT NULL,
  `commentaire` text NOT NULL,
  `dateAjout` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `etat` int(11) NOT NULL DEFAULT '1',
  PRIMARY KEY (`idDetailsdemande`),
  KEY `idDemande` (`idDemande`),
  KEY `idPayeur` (`idPayeur`),
  KEY `idDemande_2` (`idDemande`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;

--
-- Contenu de la table `detailsdemande`
--

INSERT INTO `detailsdemande` (`idDetailsdemande`, `idDemande`, `idPayeur`, `paiementRecupcolis`, `montant`, `commentaire`, `dateAjout`, `etat`) VALUES
(1, 63, 10, 1, '150000', 'com montant', '2019-05-15 09:52:24', 1),
(2, 62, 9, 0, '', '', '2019-05-17 10:53:16', 1);

-- --------------------------------------------------------

--
-- Structure de la table `etataffection`
--

CREATE TABLE IF NOT EXISTS `etataffection` (
  `idEtataffectation` int(11) NOT NULL AUTO_INCREMENT,
  `libelle` varchar(80) NOT NULL,
  `dateAjout` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `etat` int(11) NOT NULL DEFAULT '1',
  PRIMARY KEY (`idEtataffectation`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;

--
-- Contenu de la table `etataffection`
--

INSERT INTO `etataffection` (`idEtataffectation`, `libelle`, `dateAjout`, `etat`) VALUES
(1, 'En attente', '2019-05-23 09:47:12', 1),
(2, 'En cours', '2019-05-23 09:47:12', 1),
(3, 'Terminée', '2019-05-23 09:47:12', 1);

-- --------------------------------------------------------

--
-- Structure de la table `etatcourse`
--

CREATE TABLE IF NOT EXISTS `etatcourse` (
  `idEtatcourse` int(11) NOT NULL AUTO_INCREMENT,
  `libelle` varchar(80) NOT NULL,
  PRIMARY KEY (`idEtatcourse`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ;

--
-- Contenu de la table `etatcourse`
--

INSERT INTO `etatcourse` (`idEtatcourse`, `libelle`) VALUES
(1, 'Démarrée'),
(2, 'Colis récupéré'),
(3, 'Colis livré'),
(4, 'Confirmation de réception');

-- --------------------------------------------------------

--
-- Structure de la table `role`
--

CREATE TABLE IF NOT EXISTS `role` (
  `idRole` int(11) NOT NULL AUTO_INCREMENT,
  `libelle` varchar(80) NOT NULL,
  PRIMARY KEY (`idRole`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=7 ;

--
-- Contenu de la table `role`
--

INSERT INTO `role` (`idRole`, `libelle`) VALUES
(1, 'Particulier'),
(2, 'Entreprise'),
(3, 'Livreur'),
(4, 'Commerce'),
(5, 'Agent'),
(6, 'Administrateur');

-- --------------------------------------------------------

--
-- Structure de la table `rolecourse`
--

CREATE TABLE IF NOT EXISTS `rolecourse` (
  `idRolecourse` int(11) NOT NULL AUTO_INCREMENT,
  `libelle` varchar(80) NOT NULL,
  PRIMARY KEY (`idRolecourse`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;

--
-- Contenu de la table `rolecourse`
--

INSERT INTO `rolecourse` (`idRolecourse`, `libelle`) VALUES
(1, 'Expéditeur'),
(2, 'Récepteur');

-- --------------------------------------------------------

--
-- Structure de la table `suivicourse`
--

CREATE TABLE IF NOT EXISTS `suivicourse` (
  `idSuivicourse` int(11) NOT NULL AUTO_INCREMENT,
  `idLivreur` int(11) NOT NULL,
  `idRoleCourse` int(11) NOT NULL,
  `idExpediteur` int(11) NOT NULL,
  `idDestinataire` int(11) NOT NULL,
  `idEtatcourse` int(11) NOT NULL,
  `idCourse` int(11) NOT NULL,
  `dateDebutcourse` varchar(80) NOT NULL,
  `dateFincourse` varchar(80) NOT NULL,
  `dateAjout` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `etat` int(11) NOT NULL DEFAULT '1',
  PRIMARY KEY (`idSuivicourse`),
  KEY `idLivreur` (`idLivreur`),
  KEY `idRoleCourse` (`idRoleCourse`),
  KEY `idExpediteur` (`idExpediteur`),
  KEY `idDestinataire` (`idDestinataire`),
  KEY `idCourse` (`idCourse`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Structure de la table `trackinglivreur`
--

CREATE TABLE IF NOT EXISTS `trackinglivreur` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `idLivreur` int(11) NOT NULL,
  `latitude` varchar(80) NOT NULL,
  `longitude` varchar(80) NOT NULL,
  `dateEnregistrement` varchar(80) NOT NULL,
  `dateAjout` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `etat` int(11) NOT NULL DEFAULT '1',
  PRIMARY KEY (`id`),
  KEY `idLivreur` (`idLivreur`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=6 ;

--
-- Contenu de la table `trackinglivreur`
--

INSERT INTO `trackinglivreur` (`id`, `idLivreur`, `latitude`, `longitude`, `dateEnregistrement`, `dateAjout`, `etat`) VALUES
(1, 13, '14.775213', '-17.354132', '', '2019-05-16 12:29:40', 1),
(2, 14, '14.683617', '-17.457465', '', '2019-05-16 12:29:40', 1),
(3, 13, '14.754892', '-17.435416', '', '2019-05-16 12:29:58', 1),
(4, 14, '14.744231', '-17.491768', '', '2019-05-16 12:29:58', 1),
(5, 18, '14.705708', '-17.452888', '', '2019-05-16 12:29:58', 1);

-- --------------------------------------------------------

--
-- Structure de la table `trackinglivreurcourse`
--

CREATE TABLE IF NOT EXISTS `trackinglivreurcourse` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `idLivreur` int(11) NOT NULL,
  `idCourse` int(11) NOT NULL,
  `latitude` varchar(80) NOT NULL,
  `longitude` varchar(80) NOT NULL,
  `dateEnregistrement` varchar(80) NOT NULL,
  `dateAjout` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `etat` int(11) NOT NULL DEFAULT '1',
  PRIMARY KEY (`id`),
  KEY `idLivreur` (`idLivreur`),
  KEY `idCourse` (`idCourse`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Structure de la table `tranchehoraire`
--

CREATE TABLE IF NOT EXISTS `tranchehoraire` (
  `idTranchehoraire` int(11) NOT NULL AUTO_INCREMENT,
  `libelle` text NOT NULL,
  `valeur` int(11) NOT NULL,
  `dateAjout` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `etat` int(11) NOT NULL DEFAULT '1',
  PRIMARY KEY (`idTranchehoraire`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;

--
-- Contenu de la table `tranchehoraire`
--

INSERT INTO `tranchehoraire` (`idTranchehoraire`, `libelle`, `valeur`, `dateAjout`, `etat`) VALUES
(1, 'Tranches de 3 heures', 3, '2019-05-20 09:10:41', 1),
(2, 'Tranches de 4 heures', 4, '2019-05-20 09:10:41', 1),
(3, 'Tranches de 5 heures', 5, '2019-05-20 11:40:26', 1);

-- --------------------------------------------------------

--
-- Structure de la table `typetarif`
--

CREATE TABLE IF NOT EXISTS `typetarif` (
  `idTypetarif` int(11) NOT NULL AUTO_INCREMENT,
  `libelle` varchar(80) NOT NULL,
  `dateAjout` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `etat` int(11) NOT NULL DEFAULT '1',
  PRIMARY KEY (`idTypetarif`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;

--
-- Contenu de la table `typetarif`
--

INSERT INTO `typetarif` (`idTypetarif`, `libelle`, `dateAjout`, `etat`) VALUES
(1, 'Variable', '2019-05-20 09:02:25', 1),
(2, 'Fixe', '2019-05-20 09:02:25', 1);

-- --------------------------------------------------------

--
-- Structure de la table `utilisateur`
--

CREATE TABLE IF NOT EXISTS `utilisateur` (
  `idUtilisateur` int(11) NOT NULL AUTO_INCREMENT,
  `nom` varchar(80) NOT NULL,
  `prenom` varchar(80) NOT NULL,
  `telephone` varchar(80) NOT NULL,
  `email` varchar(300) NOT NULL,
  `tokenFcm` text NOT NULL,
  `dateAjout` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `etat` int(11) NOT NULL DEFAULT '1',
  PRIMARY KEY (`idUtilisateur`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=21 ;

--
-- Contenu de la table `utilisateur`
--

INSERT INTO `utilisateur` (`idUtilisateur`, `nom`, `prenom`, `telephone`, `email`, `tokenFcm`, `dateAjout`, `etat`) VALUES
(1, 'Koro Taker ', 'Koro', '781586996', 'koro@yahoo.fr', '', '2019-05-08 09:18:48', 1),
(4, 'sss', '', '4948', '', '', '2019-05-08 11:11:51', 1),
(5, 'kok', '', '879645', '', '', '2019-05-08 11:18:34', 1),
(6, 'alogov', '', '4564454', '', '', '2019-05-09 11:35:44', 1),
(7, 'gfdf', '', '7815869967', 'dgf@gdfg.gdf', '', '2019-05-10 14:27:22', 1),
(8, 'yao', '', '771753811', '', '', '2019-05-11 19:57:05', 1),
(9, 'hgfh ', '', '4545', '', '', '2019-05-13 08:58:55', 1),
(10, 'Ginette ANTOINETTE  ', '', '781753811', 'ginette@yahoo.fr', '', '2019-05-13 09:01:29', 1),
(11, 'Roland', 'KOSSI', '', '', '', '2019-05-13 11:41:48', 1),
(12, 'Agent 1', '', '', '', '', '2019-05-13 11:41:48', 1),
(13, 'Livreur 1', '', '78846545', 'livreur1@gmail.com', '', '2019-05-13 11:41:48', 1),
(14, 'Livreur 2', '', '54687464', 'livreur2@gmail.com', '', '2019-05-13 11:41:48', 1),
(16, 'Carré d''or', '', '776665544', 'carredor@yahoo.fr', '', '2019-05-20 10:23:43', 1),
(17, 'Axa Assurances', '', '131213546', 'axa@axa.com', '', '2019-05-21 09:10:57', 1),
(18, 'Livreur 3', '', '782356548', 'livreur3@gmail.com', '', '2019-05-21 10:35:33', 1),
(19, 'Graine d''Or', '', '771254958', 'contact@patisseriegrainedor.com', '', '2019-05-22 11:45:37', 1),
(20, 'ALiou Salamé', '', '789872516', '', '', '2019-05-23 13:52:33', 1);

-- --------------------------------------------------------

--
-- Doublure de structure pour la vue `vaffectationcommerce`
--
CREATE TABLE IF NOT EXISTS `vaffectationcommerce` (
`idAffectationcommerce` int(11)
,`codeAffectation` varchar(80)
,`idLivreur` int(11)
,`idCommerce` int(11)
,`idUtilisateur` int(11)
,`dateDebut` varchar(80)
,`heureDebut` varchar(80)
,`heureFin` varchar(80)
,`idEtataffectation` int(11)
,`dateAjout` timestamp
,`etat` int(11)
,`nom` varchar(80)
,`telephone1` varchar(80)
,`telephone2` varchar(80)
,`adresse` text
,`position` varchar(80)
,`idTypetarif` int(11)
,`montant` varchar(80)
,`contact` varchar(80)
,`telephoneContact` varchar(80)
);
-- --------------------------------------------------------

--
-- Doublure de structure pour la vue `vclientpro`
--
CREATE TABLE IF NOT EXISTS `vclientpro` (
`nom` varchar(80)
,`telephone` varchar(80)
,`email` varchar(300)
,`tokenFcm` text
,`idContactclientpro` int(11)
,`contact` varchar(80)
,`telephoneContact` varchar(80)
,`idUtilisateur` int(11)
,`dateAjout` timestamp
,`etat` int(11)
,`login` varchar(80)
,`motDePasse` text
,`idAdresse` int(11)
,`libelle` text
,`latitude` varchar(80)
,`longitude` varchar(80)
);
-- --------------------------------------------------------

--
-- Doublure de structure pour la vue `vcommerce`
--
CREATE TABLE IF NOT EXISTS `vcommerce` (
`idCommerce` int(11)
,`nom` varchar(80)
,`telephone1` varchar(80)
,`telephone2` varchar(80)
,`adresse` text
,`email` varchar(80)
,`debutPlage` varchar(11)
,`finPlage` varchar(11)
,`idTranchehoraire` int(11)
,`idTypetarif` int(11)
,`montant` varchar(80)
,`contact` varchar(80)
,`telephoneContact` varchar(80)
,`idUtilisateur` int(11)
,`dateAjout` timestamp
,`etat` int(11)
,`position` varchar(80)
,`valeur` int(11)
,`login` varchar(80)
,`motDePasse` text
);
-- --------------------------------------------------------

--
-- Doublure de structure pour la vue `vcourse`
--
CREATE TABLE IF NOT EXISTS `vcourse` (
`idCourse` int(11)
,`idDemande` int(11)
,`idExpediteur` int(11)
,`idDestinataire` int(11)
,`dateAssignation` varchar(80)
,`idLivreur` int(11)
,`idRoleCourse` bigint(11)
,`idEtatcourse` bigint(11)
,`dateDebutcourse` varchar(80)
,`dateFincourse` varchar(80)
,`etatCourse` int(11)
,`idAdresseexpedition` int(11)
,`idAdressedestination` int(11)
,`isInprogress` int(11)
,`commentaireDemande` text
,`dateCourse` varchar(80)
,`idResponsable` int(11)
,`dateDebutraitement` varchar(80)
,`dateDemande` timestamp
,`etatDemande` int(11)
,`nomExpediteur` varchar(80)
,`prenomExpediteur` varchar(80)
,`telephoneExpediteur` varchar(80)
,`emailExpediteur` varchar(300)
,`tokenFcmExpediteur` text
,`nomDestinataire` varchar(80)
,`prenomDestinataire` varchar(80)
,`telephoneDestinataire` varchar(80)
,`emailDestinataire` varchar(300)
,`tokenFcmDestinataire` text
,`nomLivreur` varchar(80)
,`prenomLivreur` varchar(80)
,`telephoneLivreur` varchar(80)
,`emailLivreur` varchar(300)
,`tokenFcmLivreur` text
,`libelleExpedition` text
,`latitudeExpedition` varchar(80)
,`longitudeExpedition` varchar(80)
,`descriptionExpedition` text
,`libelleDestination` text
,`latitudeDestination` varchar(80)
,`longitudeDestination` varchar(80)
,`descriptionDestination` text
,`nomResponsable` varchar(80)
,`prenomResponsable` varchar(80)
,`telephoneResponsable` varchar(80)
,`emailResponsable` varchar(300)
,`tokenFcmResponsable` text
,`idPayeur` int(11)
,`paiementRecupcolis` int(11)
,`montant` text
,`commentaireDetail` text
);
-- --------------------------------------------------------

--
-- Doublure de structure pour la vue `vdemande`
--
CREATE TABLE IF NOT EXISTS `vdemande` (
`idCourse` int(1)
,`idDemande` int(11)
,`idExpediteur` int(11)
,`idDestinataire` int(11)
,`dateAssignation` varchar(6)
,`idLivreur` int(1)
,`idRoleCourse` int(1)
,`idEtatcourse` int(1)
,`dateDebutcourse` int(1)
,`dateFincourse` int(1)
,`etatCourse` int(11)
,`idAdresseexpedition` int(11)
,`idAdressedestination` int(11)
,`isInprogress` int(11)
,`isReady` int(11)
,`commentaireDemande` text
,`dateCourse` varchar(80)
,`idResponsable` int(11)
,`dateDebutraitement` varchar(80)
,`dateDemande` timestamp
,`etatDemande` int(11)
,`nomExpediteur` varchar(80)
,`prenomExpediteur` varchar(80)
,`telephoneExpediteur` varchar(80)
,`emailExpediteur` varchar(300)
,`tokenFcmExpediteur` text
,`nomDestinataire` varchar(80)
,`prenomDestinataire` varchar(80)
,`telephoneDestinataire` varchar(80)
,`emailDestinataire` varchar(300)
,`tokenFcmDestinataire` text
,`nomLivreur` int(1)
,`prenomLivreur` int(1)
,`telephoneLivreur` int(1)
,`emailLivreur` int(1)
,`tokenFcmLivreur` int(1)
,`libelleExpedition` text
,`latitudeExpedition` varchar(80)
,`longitudeExpedition` varchar(80)
,`descriptionExpedition` text
,`libelleDestination` text
,`latitudeDestination` varchar(80)
,`longitudeDestination` varchar(80)
,`descriptionDestination` text
,`nomResponsable` int(1)
,`prenomResponsable` int(1)
,`telephoneResponsable` int(1)
,`emailResponsable` int(1)
,`tokenFcmResponsable` int(1)
,`idPayeur` bigint(11)
,`paiementRecupcolis` bigint(11)
,`montant` text
,`commentaireDetail` text
);
-- --------------------------------------------------------

--
-- Doublure de structure pour la vue `vutilisateur`
--
CREATE TABLE IF NOT EXISTS `vutilisateur` (
`idUtilisateur` int(11)
,`nom` varchar(80)
,`prenom` varchar(80)
,`telephone` varchar(80)
,`email` varchar(300)
,`tokenFcm` text
,`dateAjout` timestamp
,`etat` int(11)
,`role` varchar(80)
,`login` varchar(80)
,`motDePasse` text
);
-- --------------------------------------------------------

--
-- Structure de la vue `vaffectationcommerce`
--

CREATE VIEW `vaffectationcommerce` AS select `a`.`idAffectationcommerce` AS `idAffectationcommerce`,`a`.`codeAffectation` AS `codeAffectation`,`a`.`idLivreur` AS `idLivreur`,`a`.`idCommerce` AS `idCommerce`,`a`.`idUtilisateur` AS `idUtilisateur`,`a`.`dateDebut` AS `dateDebut`,`a`.`heureDebut` AS `heureDebut`,`a`.`heureFin` AS `heureFin`,`a`.`idEtataffectation` AS `idEtataffectation`,`a`.`dateAjout` AS `dateAjout`,`a`.`etat` AS `etat`,`c`.`nom` AS `nom`,`c`.`telephone1` AS `telephone1`,`c`.`telephone2` AS `telephone2`,`c`.`adresse` AS `adresse`,`c`.`position` AS `position`,`c`.`idTypetarif` AS `idTypetarif`,`c`.`montant` AS `montant`,`c`.`contact` AS `contact`,`c`.`telephoneContact` AS `telephoneContact` from ((`affectationcommerce` `a` join `commerce` `c`) join `etataffection` `e`) where ((`a`.`idCommerce` = `c`.`idCommerce`) and (`a`.`idEtataffectation` = `e`.`idEtataffectation`));

-- --------------------------------------------------------

--
-- Structure de la vue `vclientpro`
--

CREATE VIEW `vclientpro` AS select `u`.`nom` AS `nom`,`u`.`telephone` AS `telephone`,`u`.`email` AS `email`,`u`.`tokenFcm` AS `tokenFcm`,`c`.`idContactclientpro` AS `idContactclientpro`,`c`.`contact` AS `contact`,`c`.`telephoneContact` AS `telephoneContact`,`c`.`idUtilisateur` AS `idUtilisateur`,`c`.`dateAjout` AS `dateAjout`,`c`.`etat` AS `etat`,`cpt`.`login` AS `login`,`cpt`.`motDePasse` AS `motDePasse`,`a`.`idAdresse` AS `idAdresse`,`a`.`libelle` AS `libelle`,`a`.`latitude` AS `latitude`,`a`.`longitude` AS `longitude` from (((`contactclientpro` `c` join `utilisateur` `u`) join `compte` `cpt`) join `adresse` `a`) where ((`c`.`idUtilisateur` = `cpt`.`idUtilisateur`) and (`c`.`idUtilisateur` = `u`.`idUtilisateur`) and (`c`.`idUtilisateur` = `a`.`idUtilisateur`) and (`a`.`isPrincipale` = 1));

-- --------------------------------------------------------

--
-- Structure de la vue `vcommerce`
--

CREATE VIEW `vcommerce` AS select `c`.`idCommerce` AS `idCommerce`,`c`.`nom` AS `nom`,`c`.`telephone1` AS `telephone1`,`c`.`telephone2` AS `telephone2`,`c`.`adresse` AS `adresse`,`c`.`email` AS `email`,`c`.`debutPlage` AS `debutPlage`,`c`.`finPlage` AS `finPlage`,`c`.`idTranchehoraire` AS `idTranchehoraire`,`c`.`idTypetarif` AS `idTypetarif`,`c`.`montant` AS `montant`,`c`.`contact` AS `contact`,`c`.`telephoneContact` AS `telephoneContact`,`c`.`idUtilisateur` AS `idUtilisateur`,`c`.`dateAjout` AS `dateAjout`,`c`.`etat` AS `etat`,`c`.`position` AS `position`,`t`.`valeur` AS `valeur`,`cpt`.`login` AS `login`,`cpt`.`motDePasse` AS `motDePasse` from ((`commerce` `c` join `compte` `cpt`) join `tranchehoraire` `t`) where ((`c`.`idUtilisateur` = `cpt`.`idUtilisateur`) and (`t`.`idTranchehoraire` = `c`.`idTranchehoraire`));

-- --------------------------------------------------------

--
-- Structure de la vue `vcourse`
--

CREATE VIEW `vcourse` AS select `c`.`idCourse` AS `idCourse`,`c`.`idDemande` AS `idDemande`,`c`.`idExpediteur` AS `idExpediteur`,`c`.`idDestinataire` AS `idDestinataire`,`c`.`dateAssignation` AS `dateAssignation`,`c`.`idLivreur` AS `idLivreur`,if((select `suivicourse`.`idRoleCourse` from `suivicourse` where ((`suivicourse`.`idCourse` = `c`.`idCourse`) <> NULL)),(select `suivicourse`.`idRoleCourse` from `suivicourse` where (`suivicourse`.`idCourse` = `c`.`idCourse`)),0) AS `idRoleCourse`,if((select `suivicourse`.`idEtatcourse` from `suivicourse` where ((`suivicourse`.`idCourse` = `c`.`idCourse`) <> NULL)),(select `suivicourse`.`idEtatcourse` from `suivicourse` where (`suivicourse`.`idCourse` = `c`.`idCourse`)),0) AS `idEtatcourse`,if((select `suivicourse`.`dateDebutcourse` from `suivicourse` where ((`suivicourse`.`idCourse` = `c`.`idCourse`) <> NULL)),(select `suivicourse`.`dateDebutcourse` from `suivicourse` where (`suivicourse`.`idCourse` = `c`.`idCourse`)),0) AS `dateDebutcourse`,if((select `suivicourse`.`dateFincourse` from `suivicourse` where ((`suivicourse`.`idCourse` = `c`.`idCourse`) <> NULL)),(select `suivicourse`.`dateFincourse` from `suivicourse` where (`suivicourse`.`idCourse` = `c`.`idCourse`)),0) AS `dateFincourse`,`d`.`etat` AS `etatCourse`,`d`.`idAdresseexpedition` AS `idAdresseexpedition`,`d`.`idAdressedestination` AS `idAdressedestination`,`d`.`isInprogress` AS `isInprogress`,`d`.`commentaire` AS `commentaireDemande`,`d`.`dateCourse` AS `dateCourse`,`d`.`idResponsable` AS `idResponsable`,`d`.`dateDebutraitement` AS `dateDebutraitement`,`d`.`dateAjout` AS `dateDemande`,`d`.`etat` AS `etatDemande`,`ex`.`nom` AS `nomExpediteur`,`ex`.`prenom` AS `prenomExpediteur`,`ex`.`telephone` AS `telephoneExpediteur`,`ex`.`email` AS `emailExpediteur`,`ex`.`tokenFcm` AS `tokenFcmExpediteur`,`des`.`nom` AS `nomDestinataire`,`des`.`prenom` AS `prenomDestinataire`,`des`.`telephone` AS `telephoneDestinataire`,`des`.`email` AS `emailDestinataire`,`des`.`tokenFcm` AS `tokenFcmDestinataire`,`li`.`nom` AS `nomLivreur`,`li`.`prenom` AS `prenomLivreur`,`li`.`telephone` AS `telephoneLivreur`,`li`.`email` AS `emailLivreur`,`li`.`tokenFcm` AS `tokenFcmLivreur`,`adrex`.`libelle` AS `libelleExpedition`,`adrex`.`latitude` AS `latitudeExpedition`,`adrex`.`longitude` AS `longitudeExpedition`,`adrex`.`description` AS `descriptionExpedition`,`adrdes`.`libelle` AS `libelleDestination`,`adrdes`.`latitude` AS `latitudeDestination`,`adrdes`.`longitude` AS `longitudeDestination`,`adrdes`.`description` AS `descriptionDestination`,`res`.`nom` AS `nomResponsable`,`res`.`prenom` AS `prenomResponsable`,`res`.`telephone` AS `telephoneResponsable`,`res`.`email` AS `emailResponsable`,`res`.`tokenFcm` AS `tokenFcmResponsable`,`dd`.`idPayeur` AS `idPayeur`,`dd`.`paiementRecupcolis` AS `paiementRecupcolis`,`dd`.`montant` AS `montant`,`dd`.`commentaire` AS `commentaireDetail` from ((((((((`course` `c` join `demande` `d`) join `utilisateur` `ex`) join `utilisateur` `des`) join `utilisateur` `li`) join `adresse` `adrex`) join `adresse` `adrdes`) join `utilisateur` `res`) join `detailsdemande` `dd`) where ((`c`.`idDemande` = `d`.`idDemande`) and (`c`.`idExpediteur` = `ex`.`idUtilisateur`) and (`c`.`idDestinataire` = `des`.`idUtilisateur`) and (`c`.`idLivreur` = `li`.`idUtilisateur`) and (`d`.`idAdresseexpedition` = `adrex`.`idAdresse`) and (`d`.`idAdressedestination` = `adrdes`.`idAdresse`) and (`d`.`idResponsable` = `res`.`idUtilisateur`) and (`d`.`idDemande` = `dd`.`idDemande`));

-- --------------------------------------------------------

--
-- Structure de la vue `vdemande`
--

CREATE VIEW `vdemande` AS select 0 AS `idCourse`,`d`.`idDemande` AS `idDemande`,`d`.`idExpediteur` AS `idExpediteur`,`d`.`idDestinataire` AS `idDestinataire`,'Aucune' AS `dateAssignation`,0 AS `idLivreur`,0 AS `idRoleCourse`,0 AS `idEtatcourse`,0 AS `dateDebutcourse`,0 AS `dateFincourse`,`d`.`etat` AS `etatCourse`,`d`.`idAdresseexpedition` AS `idAdresseexpedition`,`d`.`idAdressedestination` AS `idAdressedestination`,`d`.`isInprogress` AS `isInprogress`,`d`.`isReady` AS `isReady`,`d`.`commentaire` AS `commentaireDemande`,`d`.`dateCourse` AS `dateCourse`,`d`.`idResponsable` AS `idResponsable`,`d`.`dateDebutraitement` AS `dateDebutraitement`,`d`.`dateAjout` AS `dateDemande`,`d`.`etat` AS `etatDemande`,`ex`.`nom` AS `nomExpediteur`,`ex`.`prenom` AS `prenomExpediteur`,`ex`.`telephone` AS `telephoneExpediteur`,`ex`.`email` AS `emailExpediteur`,`ex`.`tokenFcm` AS `tokenFcmExpediteur`,`des`.`nom` AS `nomDestinataire`,`des`.`prenom` AS `prenomDestinataire`,`des`.`telephone` AS `telephoneDestinataire`,`des`.`email` AS `emailDestinataire`,`des`.`tokenFcm` AS `tokenFcmDestinataire`,0 AS `nomLivreur`,0 AS `prenomLivreur`,0 AS `telephoneLivreur`,0 AS `emailLivreur`,0 AS `tokenFcmLivreur`,`adrex`.`libelle` AS `libelleExpedition`,`adrex`.`latitude` AS `latitudeExpedition`,`adrex`.`longitude` AS `longitudeExpedition`,`adrex`.`description` AS `descriptionExpedition`,`adrdes`.`libelle` AS `libelleDestination`,`adrdes`.`latitude` AS `latitudeDestination`,`adrdes`.`longitude` AS `longitudeDestination`,`adrdes`.`description` AS `descriptionDestination`,0 AS `nomResponsable`,0 AS `prenomResponsable`,0 AS `telephoneResponsable`,0 AS `emailResponsable`,0 AS `tokenFcmResponsable`,(select `detailsdemande`.`idPayeur` from `detailsdemande` where (`detailsdemande`.`idDemande` = `d`.`idDemande`)) AS `idPayeur`,(select `detailsdemande`.`paiementRecupcolis` from `detailsdemande` where (`detailsdemande`.`idDemande` = `d`.`idDemande`)) AS `paiementRecupcolis`,(select `detailsdemande`.`montant` from `detailsdemande` where (`detailsdemande`.`idDemande` = `d`.`idDemande`)) AS `montant`,(select `detailsdemande`.`commentaire` from `detailsdemande` where (`detailsdemande`.`idDemande` = `d`.`idDemande`)) AS `commentaireDetail` from ((((`demande` `d` join `utilisateur` `ex`) join `utilisateur` `des`) join `adresse` `adrex`) join `adresse` `adrdes`) where ((`d`.`idExpediteur` = `ex`.`idUtilisateur`) and (`d`.`idDestinataire` = `des`.`idUtilisateur`) and (`d`.`idAdresseexpedition` = `adrex`.`idAdresse`) and (`d`.`idAdressedestination` = `adrdes`.`idAdresse`));

-- --------------------------------------------------------

--
-- Structure de la vue `vutilisateur`
--

CREATE VIEW `vutilisateur` AS select `u`.`idUtilisateur` AS `idUtilisateur`,`u`.`nom` AS `nom`,`u`.`prenom` AS `prenom`,`u`.`telephone` AS `telephone`,`u`.`email` AS `email`,`u`.`tokenFcm` AS `tokenFcm`,`u`.`dateAjout` AS `dateAjout`,`u`.`etat` AS `etat`,`r`.`libelle` AS `role`,`c`.`login` AS `login`,`c`.`motDePasse` AS `motDePasse` from ((`utilisateur` `u` join `role` `r`) join `compte` `c`) where ((`u`.`idUtilisateur` = `c`.`idUtilisateur`) and (`r`.`idRole` = `c`.`idRole`));

--
-- Contraintes pour les tables exportées
--

--
-- Contraintes pour la table `course`
--
ALTER TABLE `course`
  ADD CONSTRAINT `course_ibfk_1` FOREIGN KEY (`idDemande`) REFERENCES `demande` (`idDemande`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Contraintes pour la table `detailsdemande`
--
ALTER TABLE `detailsdemande`
  ADD CONSTRAINT `detailsdemande_ibfk_1` FOREIGN KEY (`idDemande`) REFERENCES `demande` (`idDemande`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Contraintes pour la table `suivicourse`
--
ALTER TABLE `suivicourse`
  ADD CONSTRAINT `suivicourse_ibfk_1` FOREIGN KEY (`idCourse`) REFERENCES `course` (`idCourse`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Contraintes pour la table `trackinglivreurcourse`
--
ALTER TABLE `trackinglivreurcourse`
  ADD CONSTRAINT `trackinglivreurcourse_ibfk_1` FOREIGN KEY (`idCourse`) REFERENCES `course` (`idCourse`) ON DELETE CASCADE ON UPDATE CASCADE;

