 -- devis et devis_ligne
ALTER TABLE `devis`
RENAME TO `_devis`;

ALTER TABLE `devis_lignes`
RENAME TO `_devis_lignes`;

-- fournisseurs_contact
ALTER TABLE `fournisseurs_contact`
CHANGE `mdp` `mdp` varchar(200) COLLATE 'utf8_general_ci' NOT NULL AFTER `mobile`;


-- fournisseurs_devis
CREATE TABLE `fournisseurs_devis` (
  `id_devis` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
  `id_fournisseur_fk` int(11) NOT NULL,
  `id_client_fk` int(11) NOT NULL,
  `id_service_type_fk` int(5) NOT NULL,
  `devis_upload` text COLLATE 'utf8_general_ci' NULL,
  `devis_date` date NOT NULL,
  `devis_ht` varchar(45) COLLATE 'utf8_general_ci' NULL,
  `devis_tva` varchar(45) COLLATE 'utf8_general_ci' NULL,
  `devis_remis_client` date NULL COMMENT '1=Oui, 0=Non',
  `devis_type_envoi` int(1) NOT NULL COMMENT '1= Remis en main propre, 2 = Envoyé par email, 3=Envoyé par courrier',
  `devis_date_projet` date NULL,
  `devis_valide` int(1) NOT NULL COMMENT '1 =Oui, 0=Non, 2=En attente',
  `devis_date_intervention` date NULL COMMENT 'Date d’intervention du prestataire',
  `devis_motif_refus` text COLLATE 'utf8_general_ci' NULL,
  `devis_cloture` int(1) NOT NULL COMMENT '1=Oui, 0=Non',
  `devis_date_cloture` date NULL,
  `devis_commentaire` text COLLATE 'utf8_general_ci' NULL
) ENGINE='InnoDB' COLLATE 'utf8_general_ci';


ALTER TABLE `fournisseurs_devis`
ADD `devis_ttc` varchar(45) COLLATE 'utf8_general_ci' NULL AFTER `devis_tva`;


ALTER TABLE `fournisseurs_devis`
CHANGE `id_fournisseur_fk` `id_fournisseur_fk` int(11) NULL AFTER `id_devis`,
CHANGE `id_client_fk` `id_client_fk` int(11) NULL AFTER `id_fournisseur_fk`,
CHANGE `devis_type_envoi` `devis_type_envoi` int(1) NULL COMMENT '1= Remis en main propre, 2 = Envoyé par email, 3=Envoyé par courrier' AFTER `devis_remis_client`;


ALTER TABLE `fournisseurs_devis`
ADD `devis_qui` text COLLATE 'utf8_general_ci' NOT NULL DEFAULT '1' COMMENT '1=PGE, 2=client';

ALTER TABLE `fournisseurs_devis`
ADD `devis_relance` text COLLATE 'utf8_general_ci' NULL;


ALTER TABLE `fournisseurs_devis`
ADD `devis_remis_client_date` date NULL AFTER `devis_remis_client`,
CHANGE `devis_type_envoi` `devis_type_envoi` int(5) NULL COMMENT '1= Remis en main propre, 2 = Envoyé par email, 3=Envoyé par courrier' AFTER `devis_remis_client_date`;


ALTER TABLE `fournisseurs_devis`
ADD `devis_valide_date` int(1) NULL AFTER `devis_valide`;

ALTER TABLE `fournisseurs_devis`
CHANGE `devis_valide_date` `devis_valide_date` date NULL AFTER `devis_valide`;



-- services_type
CREATE TABLE `services_type` (
  `id_service_type` int(5) NOT NULL AUTO_INCREMENT PRIMARY KEY,
  `service_type` varchar(80) COLLATE 'utf8_general_ci' NOT NULL
) ENGINE='InnoDB' COLLATE 'utf8_general_ci';


ALTER TABLE `services_type`
CHANGE `service_type` `service_type` varchar(45) COLLATE 'utf8_general_ci' NOT NULL AFTER `id_service_type`;


INSERT INTO `services_type` (`service_type`)
VALUES ('Climatisation');

INSERT INTO `services_type` (`service_type`)
VALUES ('Pompe à chaleur');

INSERT INTO `services_type` (`service_type`)
VALUES ('Ballon d’eau chaude thermodynamique');

INSERT INTO `services_type` (`service_type`)
VALUES ('Chaudière gaz');

INSERT INTO `services_type` (`service_type`)
VALUES ('Chaudière à granulé');

INSERT INTO `services_type` (`service_type`)
VALUES ('Panneaux solaires');

INSERT INTO `services_type` (`service_type`)
VALUES ('Panneaux photovoltaique');

INSERT INTO `services_type` (`service_type`)
VALUES ('Panneaux Aéro photovoltaique');

INSERT INTO `services_type` (`service_type`)
VALUES ('Chantiers isolation');

INSERT INTO `services_type` (`service_type`)
VALUES ('Chantiers menuiserie');

INSERT INTO `services_type` (`service_type`)
VALUES ('Vente de poêle');


-- type
-- Remplacer métrage par devis
UPDATE `type` SET
`id_type` = '6',
`type` = 'Devis'
WHERE `id_type` = '6';


-- clients
ALTER TABLE `clients`
CHANGE `mdp` `mdp` varchar(255) COLLATE 'utf8_general_ci' NULL AFTER `datec`;


-- Mise à jour de la table ramonages
ALTER TABLE `ramonages`
ADD `transfert_dolibarr` int(1) NULL DEFAULT '0';



CREATE TABLE `fournisseurs_rdv` (
  `id_rdv` int(10) NOT NULL AUTO_INCREMENT,
  `id_devis_fk` int(10) NOT NULL,
  `date_rdv` date NOT NULL,
  `heure_rdv` varchar(5) NOT NULL,
  PRIMARY KEY (`id_rdv`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;



CREATE TABLE `fournisseurs_rdv_photo` (
  `id_photo` int(10) NOT NULL AUTO_INCREMENT,
  `id_rdv_fk` int(10) NOT NULL,
  `photo` text NOT NULL,
  PRIMARY KEY (`id_photo`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;



# Pages
Connections/Loc.php

includes/_carousel.inc.php
includes/carousel.inc.php

connexion-fournisseurs.php
mot-de-passe-envoyer-ok.php


# Dossiers 
/espacef/


espaces/_index.php
espaces/index.php
espaces/devis-ajouter.php
espaces/devis-valider.php


bo-pge/includes/menu.inc.php
bo-pge/includes/menu-devis.inc.php
bo-pge/_old/includes/menu-devis.inc.php

bo-pge/devis
