DROP TABLE IF EXISTS `commandes_kbis`;
CREATE TABLE `commandes_kbis` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `idUser` int(11) NOT NULL,
  `login` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `email` varchar(82) COLLATE utf8_unicode_ci NOT NULL,
  `societe` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
  `nom` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
  `adresse` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
  `cp` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
  `ville` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
  `siren` int(9) NOT NULL,
  `raisonSociale` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
  `type` char(1) COLLATE utf8_unicode_ci NOT NULL,
  `document` varchar(200) COLLATE utf8_unicode_ci DEFAULT NULL,
  `statutCommande` int(11) NOT NULL DEFAULT '0',
  `info` varchar(200) COLLATE utf8_unicode_ci DEFAULT NULL,
  `dateCommande` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `dateReception` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COMMENT='Kbis original courrier' ;

DROP TABLE IF EXISTS `commandes_pieces`;
CREATE TABLE `commandes_pieces` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `idUser` int(11) NOT NULL,
  `login` varchar(32) NOT NULL,
  `email` varchar(80) NOT NULL,
  `raisonSociale` varchar(200) NOT NULL,
  `siren` varchar(9) NOT NULL,
  `type` char(1) NOT NULL,
  `document` varchar(200) NOT NULL,
  `info` text NOT NULL,
  `statutCommande` int(11) NOT NULL,
  `dateCommande` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `dateReception` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;

DROP TABLE IF EXISTS `commandes_statut`;
CREATE TABLE `commandes_statut` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `libStatut` varchar(200) NOT NULL,
  `typeCommande` char(1) NOT NULL,
  `ordre` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 ;

INSERT INTO `commandes_statut` (`id`, `libStatut`, `typeCommande`, `ordre`) VALUES
(1, 'Demande de cheque à la comptabilité', 'C', 1),
(2, 'Chéque reçu en production', 'C', 2),
(3, 'Edition du courrier', 'C', 3),
(4, 'Courrier envoyé', 'C', 4),
(5, 'Commande receptionné des greffes', 'C', 5),
(6, 'Commande en cours', 'G', 1),
(7, 'Commande reçu', 'G', 2),
(9, 'Erreur', 'G', 0);
