text: /*
  Created		23-08-21
  Modified	23-08-21
  Project		
  Model		
  Company		
  Author		
  Version		4.1
  Database	Firebird 
  */
  
  
  Drop Table "T_PLANNINGS";
  Drop Table "T_EPHEMERIDES";
  Drop Table "T_ANNEESSCOLAIRES";
  Drop Table "T_TRAJETS";
  Drop Table "T_GROUPES";
  Drop Table "T_DATESPLANNINGS";
  Drop Table "T_TYPESPLANNINGS";
  Drop Table "T_HEURESPLANNINGS";
  Drop Table "T_ETAPES";
  Drop Table "T_TRANSPORTS";
  Drop Table "T_CHAUFEURS";
  Drop Table "T_VEHICULES";
  
  
  Create Table "T_VEHICULES"  (
  	"IDX_VEHICULE" Bigint NOT NULL,
  	"MARQUEVEHICULE" Varchar(30) NOT NULL,
  	"MODELEVEHICULE" Varchar(30) NOT NULL,
  	"NOMVEHICULE" Varchar(30) NOT NULL,
  	"PLACESVEHICULE" Integer NOT NULL,
   Primary Key ("IDX_VEHICULE")
  );
  
  Create Table "T_CHAUFEURS"  (
  	"IDX_CHAUFFEUR" Bigint NOT NULL,
  	"IDX_VEHICULE" Bigint NOT NULL,
  	"PRENOMCHAUFFEUR" Varchar(30) NOT NULL,
   Primary Key ("IDX_CHAUFFEUR")
  );
  
  Create Table "T_TRANSPORTS"  (
  	"IDX_TRANSPORT" Bigint NOT NULL,
  	"IDX_ANNEESCOLAIRE" Bigint NOT NULL,
  	"IDX_PLANNING" Bigint NOT NULL,
  	"IDX_VEHICULE" Bigint NOT NULL,
  	"IDX_CHAUFFEUR" Bigint NOT NULL,
  	"IDX_GROUPE" Bigint NOT NULL,
  	"IDX_TRAJET" Bigint NOT NULL,
  	"NBRACCOMPAGNATEURTRAJET" Integer NOT NULL,
  	"NOMACCOMPAGNATEURTRAJET" Varchar(30) NOT NULL,
   Primary Key ("IDX_TRANSPORT")
  );
  
  Create Table "T_ETAPES"  (
  	"IDX_ETAPE" Bigint NOT NULL,
  	"NOMETAPE" Varchar(60) NOT NULL,
  	"ADRESSEETAPE" Varchar(100) NOT NULL,
  	"PRINTEDETAPE" BOOLEAN DEFAULT FALSE,
   Primary Key ("IDX_ETAPE")
  );
  
  Create Table "T_HEURESPLANNINGS"  (
  	"IDX_HEURESPLANNING" Bigint NOT NULL,
  	"HEUREPLANNING" Time NOT NULL,
   Primary Key ("IDX_HEURESPLANNING")
  );
  
  Create Table "T_TYPESPLANNINGS"  (
  	"IDX_TYPEPLANNING" Bigint NOT NULL,
  	"NOMTYPEPLANNING" Varchar(20) NOT NULL,
   Primary Key ("IDX_TYPEPLANNING")
  );
  
  Create Table "T_DATESPLANNINGS"  (
  	"IDX_DATEPLANNING" Bigint NOT NULL,
  	"DATEDATEPLANNING" Date NOT NULL,
  	"CODESEMAINEDATEPLANNING" Char(1) NOT NULL UNIQUE,
   Primary Key ("IDX_DATEPLANNING")
  );
  
  Create Table "T_GROUPES"  (
  	"IDX_GROUPE" Bigint NOT NULL,
  	"NOMGROUPE" Varchar(20) NOT NULL,
  	"NOMBREGROUPE" Integer NOT NULL,
   Primary Key ("IDX_GROUPE")
  );
  
  Create Table "T_TRAJETS"  (
  	"IDX_TRAJET" Bigint NOT NULL,
  	"IDX_ETAPEDEPART" Bigint NOT NULL,
  	"IDX_ETAPEARRIVEE" Bigint NOT NULL,
  	"NOMTRAJET" Varchar(50) NOT NULL,
  	"TEMPSTRAJET" Time NOT NULL,
  	"KMTRAJET" Float NOT NULL,
   Primary Key ("IDX_TRAJET")
  );
  
  Create Table "T_ANNEESSCOLAIRES"  (
  	"IDX_ANNEESCOLAIRE" Bigint NOT NULL,
  	"ANNEEANNEESCOLAIRE" Integer NOT NULL,
   Primary Key ("IDX_ANNEESCOLAIRE")
  );
  
  Create Table "T_EPHEMERIDES"  (
  	"IDX_EPHEMERIDE" Bigint NOT NULL,
  	"IDX_ANNEESCOLAIRE" Bigint NOT NULL,
  	"INTITULEEPHEMERIDE" Varchar(60) NOT NULL,
  	"DATEDEBUTEPHEMERIDE" Date NOT NULL,
  	"DATEFINEPHEMERIDE" Date NOT NULL,
   Primary Key ("IDX_EPHEMERIDE")
  );
  
  Create Table "T_PLANNINGS"  (
  	"IDX_PLANNING" Bigint NOT NULL,
  	"IDX_DATEPLANNING" Bigint NOT NULL,
  	"IDX_HEURESPLANNING" Bigint NOT NULL,
  	"IDX_TYPEPLANNING" Bigint NOT NULL,
   Primary Key ("IDX_PLANNING")
  );
  
  
  Alter Table "T_CHAUFEURS" add Foreign Key ("IDX_VEHICULE") references "T_VEHICULES" ("IDX_VEHICULE") on update no action on delete no action ;
  Alter Table "T_TRANSPORTS" add Foreign Key ("IDX_VEHICULE") references "T_VEHICULES" ("IDX_VEHICULE") on update no action on delete no action ;
  Alter Table "T_TRANSPORTS" add Foreign Key ("IDX_CHAUFFEUR") references "T_CHAUFEURS" ("IDX_CHAUFFEUR") on update no action on delete no action ;
  Alter Table "T_TRAJETS" add Foreign Key ("IDX_ETAPEDEPART") references "T_ETAPES" ("IDX_ETAPE") on update no action on delete no action ;
  Alter Table "T_TRAJETS" add Foreign Key ("IDX_ETAPEARRIVEE") references "T_ETAPES" ("IDX_ETAPE") on update no action on delete no action ;
  Alter Table "T_PLANNINGS" add Foreign Key ("IDX_HEURESPLANNING") references "T_HEURESPLANNINGS" ("IDX_HEURESPLANNING") on update no action on delete no action ;
  Alter Table "T_PLANNINGS" add Foreign Key ("IDX_TYPEPLANNING") references "T_TYPESPLANNINGS" ("IDX_TYPEPLANNING") on update no action on delete no action ;
  Alter Table "T_PLANNINGS" add Foreign Key ("IDX_DATEPLANNING") references "T_DATESPLANNINGS" ("IDX_DATEPLANNING") on update no action on delete no action ;
  Alter Table "T_TRANSPORTS" add Foreign Key ("IDX_GROUPE") references "T_GROUPES" ("IDX_GROUPE") on update no action on delete no action ;
  Alter Table "T_TRANSPORTS" add Foreign Key ("IDX_TRAJET") references "T_TRAJETS" ("IDX_TRAJET") on update no action on delete no action ;
  Alter Table "T_EPHEMERIDES" add Foreign Key ("IDX_ANNEESCOLAIRE") references "T_ANNEESSCOLAIRES" ("IDX_ANNEESCOLAIRE") on update no action on delete no action ;
  Alter Table "T_TRANSPORTS" add Foreign Key ("IDX_ANNEESCOLAIRE") references "T_ANNEESSCOLAIRES" ("IDX_ANNEESCOLAIRE") on update no action on delete no action ;
  Alter Table "T_TRANSPORTS" add Foreign Key ("IDX_PLANNING") references "T_PLANNINGS" ("IDX_PLANNING") on update no action on delete no action ;
  
  
  Create Exception "except_del_p" 'Children still exist in child table. Cannot delete parent.';
  Create Exception "except_ins_ch" 'Parent does not exist. Cannot create child.';
  Create Exception "except_upd_ch" 'Parent does not exist. Cannot update child.';
  Create Exception "except_upd_p" 'Children still exist in child table. Cannot update parent.';
  Create Exception "except_ins_ch_card" 'Maximum cardinality exceeded. Cannot insert into child.';
  Create Exception "except_upd_ch_card" 'Maximum cardinality exceeded. Cannot update child.';
  
  
  set term ^;
  
  
  set term ;^
  
  
  /* Roles permissions */
  
  
  /* Users permissions */
  
  
  /* "Autoinc" functionality for T_CHAUFEURS_IDX_CHAUFFEUR*/ 
  CREATE SEQUENCE "SEQ_T_CHAUFEURS_IDX_CHAUFFEUR";
  SET TERM ^ ;
  CREATE TRIGGER "TR_BI_T_CHAUFEURS_IDX_CHAUFFEUR" FOR "T_CHAUFEURS"
  ACTIVE BEFORE INSERT POSITION 0
  AS
  BEGIN
    IF (NEW."IDX_CHAUFFEUR" IS NULL) THEN NEW."IDX_CHAUFFEUR" = GEN_ID("SEQ_T_CHAUFEURS_IDX_CHAUFFEUR",1); 
  END
  ^
  CREATE PROCEDURE "P_T_CHAUFEURS_IDX_CHAUFFEUR"
  RETURNS (
      "AUTOINC" INTEGER)
  AS
  BEGIN  
  	"AUTOINC" = GEN_ID("SEQ_T_CHAUFEURS_IDX_CHAUFFEUR",1);
     SUSPEND;
  END
  ^
  SET TERM ; ^
  /* "Autoinc" functionality for T_GROUPES_IDX_GROUPE*/ 
  CREATE SEQUENCE "SEQ_T_GROUPES_IDX_GROUPE";
  SET TERM ^ ;
  CREATE TRIGGER "TR_BI_T_GROUPES_IDX_GROUPE" FOR "T_GROUPES"
  ACTIVE BEFORE INSERT POSITION 0
  AS
  BEGIN
    IF (NEW."IDX_GROUPE" IS NULL) THEN NEW."IDX_GROUPE" = GEN_ID("SEQ_T_GROUPES_IDX_GROUPE",1); 
  END
  ^
  CREATE PROCEDURE "P_T_GROUPES_IDX_GROUPE"
  RETURNS (
      "AUTOINC" INTEGER)
  AS
  BEGIN  
  	"AUTOINC" = GEN_ID("SEQ_T_GROUPES_IDX_GROUPE",1);
     SUSPEND;
  END
  ^
  SET TERM ; ^
  /* "Autoinc" functionality for T_TYPESPLANNINGS_IDX_TYPEPLA*/ 
  CREATE SEQUENCE "SEQ_T_TYPESPLANNINGS_IDX_TYPEPLA";
  SET TERM ^ ;
  CREATE TRIGGER "TR_BI_T_TYPESPLANNINGS_IDX_TYPEPLA" FOR "T_TYPESPLANNINGS"
  ACTIVE BEFORE INSERT POSITION 0
  AS
  BEGIN
    IF (NEW."IDX_TYPEPLANNING" IS NULL) THEN NEW."IDX_TYPEPLANNING" = GEN_ID("SEQ_T_TYPESPLANNINGS_IDX_TYPEPLA",1); 
  END
  ^
  CREATE PROCEDURE "P_T_TYPESPLANNINGS_IDX_TYPEPLA"
  RETURNS (
      "AUTOINC" INTEGER)
  AS
  BEGIN  
  	"AUTOINC" = GEN_ID("SEQ_T_TYPESPLANNINGS_IDX_TYPEPLA",1);
     SUSPEND;
  END
  ^
  SET TERM ; ^
  /* "Autoinc" functionality for T_ANNEESSCOLAIRES_IDX_ANNEES*/ 
  CREATE SEQUENCE "SEQ_T_ANNEESSCOLAIRES_IDX_ANNEES";
  SET TERM ^ ;
  CREATE TRIGGER "TR_BI_T_ANNEESSCOLAIRES_IDX_ANNEES" FOR "T_ANNEESSCOLAIRES"
  ACTIVE BEFORE INSERT POSITION 0
  AS
  BEGIN
    IF (NEW."IDX_ANNEESCOLAIRE" IS NULL) THEN NEW."IDX_ANNEESCOLAIRE" = GEN_ID("SEQ_T_ANNEESSCOLAIRES_IDX_ANNEES",1); 
  END
  ^
  CREATE PROCEDURE "P_T_ANNEESSCOLAIRES_IDX_ANNEES"
  RETURNS (
      "AUTOINC" INTEGER)
  AS
  BEGIN  
  	"AUTOINC" = GEN_ID("SEQ_T_ANNEESSCOLAIRES_IDX_ANNEES",1);
     SUSPEND;
  END
  ^
  SET TERM ; ^
  /* "Autoinc" functionality for T_EPHEMERIDES_IDX_EPHEMERIDE*/ 
  CREATE SEQUENCE "SEQ_T_EPHEMERIDES_IDX_EPHEMERIDE";
  SET TERM ^ ;
  CREATE TRIGGER "TR_BI_T_EPHEMERIDES_IDX_EPHEMERIDE" FOR "T_EPHEMERIDES"
  ACTIVE BEFORE INSERT POSITION 0
  AS
  BEGIN
    IF (NEW."IDX_EPHEMERIDE" IS NULL) THEN NEW."IDX_EPHEMERIDE" = GEN_ID("SEQ_T_EPHEMERIDES_IDX_EPHEMERIDE",1); 
  END
  ^
  CREATE PROCEDURE "P_T_EPHEMERIDES_IDX_EPHEMERIDE"
  RETURNS (
      "AUTOINC" INTEGER)
  AS
  BEGIN  
  	"AUTOINC" = GEN_ID("SEQ_T_EPHEMERIDES_IDX_EPHEMERIDE",1);
     SUSPEND;
  END
  ^
  SET TERM ; ^
  /* "Autoinc" functionality for T_VEHICULES_IDX_VEHICULE*/ 
  CREATE SEQUENCE "SEQ_T_VEHICULES_IDX_VEHICULE";
  SET TERM ^ ;
  CREATE TRIGGER "TR_BI_T_VEHICULES_IDX_VEHICULE" FOR "T_VEHICULES"
  ACTIVE BEFORE INSERT POSITION 0
  AS
  BEGIN
    IF (NEW."IDX_VEHICULE" IS NULL) THEN NEW."IDX_VEHICULE" = GEN_ID("SEQ_T_VEHICULES_IDX_VEHICULE",1); 
  END
  ^
  CREATE PROCEDURE "P_T_VEHICULES_IDX_VEHICULE"
  RETURNS (
      "AUTOINC" INTEGER)
  AS
  BEGIN  
  	"AUTOINC" = GEN_ID("SEQ_T_VEHICULES_IDX_VEHICULE",1);
     SUSPEND;
  END
  ^
  SET TERM ; ^
  /* "Autoinc" functionality for T_TRAJETS_IDX_TRAJET*/ 
  CREATE SEQUENCE "SEQ_T_TRAJETS_IDX_TRAJET";
  SET TERM ^ ;
  CREATE TRIGGER "TR_BI_T_TRAJETS_IDX_TRAJET" FOR "T_TRAJETS"
  ACTIVE BEFORE INSERT POSITION 0
  AS
  BEGIN
    IF (NEW."IDX_TRAJET" IS NULL) THEN NEW."IDX_TRAJET" = GEN_ID("SEQ_T_TRAJETS_IDX_TRAJET",1); 
  END
  ^
  CREATE PROCEDURE "P_T_TRAJETS_IDX_TRAJET"
  RETURNS (
      "AUTOINC" INTEGER)
  AS
  BEGIN  
  	"AUTOINC" = GEN_ID("SEQ_T_TRAJETS_IDX_TRAJET",1);
     SUSPEND;
  END
  ^
  SET TERM ; ^
  /* "Autoinc" functionality for T_DATESPLANNINGS_IDX_DATEPLA*/ 
  CREATE SEQUENCE "SEQ_T_DATESPLANNINGS_IDX_DATEPLA";
  SET TERM ^ ;
  CREATE TRIGGER "TR_BI_T_DATESPLANNINGS_IDX_DATEPLA" FOR "T_DATESPLANNINGS"
  ACTIVE BEFORE INSERT POSITION 0
  AS
  BEGIN
    IF (NEW."IDX_DATEPLANNING" IS NULL) THEN NEW."IDX_DATEPLANNING" = GEN_ID("SEQ_T_DATESPLANNINGS_IDX_DATEPLA",1); 
  END
  ^
  CREATE PROCEDURE "P_T_DATESPLANNINGS_IDX_DATEPLA"
  RETURNS (
      "AUTOINC" INTEGER)
  AS
  BEGIN  
  	"AUTOINC" = GEN_ID("SEQ_T_DATESPLANNINGS_IDX_DATEPLA",1);
     SUSPEND;
  END
  ^
  SET TERM ; ^
  /* "Autoinc" functionality for T_ETAPES_IDX_ETAPE*/ 
  CREATE SEQUENCE "SEQ_T_ETAPES_IDX_ETAPE";
  SET TERM ^ ;
  CREATE TRIGGER "TR_BI_T_ETAPES_IDX_ETAPE" FOR "T_ETAPES"
  ACTIVE BEFORE INSERT POSITION 0
  AS
  BEGIN
    IF (NEW."IDX_ETAPE" IS NULL) THEN NEW."IDX_ETAPE" = GEN_ID("SEQ_T_ETAPES_IDX_ETAPE",1); 
  END
  ^
  CREATE PROCEDURE "P_T_ETAPES_IDX_ETAPE"
  RETURNS (
      "AUTOINC" INTEGER)
  AS
  BEGIN  
  	"AUTOINC" = GEN_ID("SEQ_T_ETAPES_IDX_ETAPE",1);
     SUSPEND;
  END
  ^
  SET TERM ; ^
  /* "Autoinc" functionality for T_HEURESPLANNINGS_IDX_HEURES*/ 
  CREATE SEQUENCE "SEQ_T_HEURESPLANNINGS_IDX_HEURES";
  SET TERM ^ ;
  CREATE TRIGGER "TR_BI_T_HEURESPLANNINGS_IDX_HEURES" FOR "T_HEURESPLANNINGS"
  ACTIVE BEFORE INSERT POSITION 0
  AS
  BEGIN
    IF (NEW."IDX_HEURESPLANNING" IS NULL) THEN NEW."IDX_HEURESPLANNING" = GEN_ID("SEQ_T_HEURESPLANNINGS_IDX_HEURES",1); 
  END
  ^
  CREATE PROCEDURE "P_T_HEURESPLANNINGS_IDX_HEURES"
  RETURNS (
      "AUTOINC" INTEGER)
  AS
  BEGIN  
  	"AUTOINC" = GEN_ID("SEQ_T_HEURESPLANNINGS_IDX_HEURES",1);
     SUSPEND;
  END
  ^
  SET TERM ; ^
  /* "Autoinc" functionality for T_PLANNINGS_IDX_PLANNING*/ 
  CREATE SEQUENCE "SEQ_T_PLANNINGS_IDX_PLANNING";
  SET TERM ^ ;
  CREATE TRIGGER "TR_BI_T_PLANNINGS_IDX_PLANNING" FOR "T_PLANNINGS"
  ACTIVE BEFORE INSERT POSITION 0
  AS
  BEGIN
    IF (NEW."IDX_PLANNING" IS NULL) THEN NEW."IDX_PLANNING" = GEN_ID("SEQ_T_PLANNINGS_IDX_PLANNING",1); 
  END
  ^
  CREATE PROCEDURE "P_T_PLANNINGS_IDX_PLANNING"
  RETURNS (
      "AUTOINC" INTEGER)
  AS
  BEGIN  
  	"AUTOINC" = GEN_ID("SEQ_T_PLANNINGS_IDX_PLANNING",1);
     SUSPEND;
  END
  ^
  SET TERM ; ^
  /* "Autoinc" functionality for T_TRANSPORTS_IDX_TRANSPORT*/ 
  CREATE SEQUENCE "SEQ_T_TRANSPORTS_IDX_TRANSPORT";
  SET TERM ^ ;
  CREATE TRIGGER "TR_BI_T_TRANSPORTS_IDX_TRANSPORT" FOR "T_TRANSPORTS"
  ACTIVE BEFORE INSERT POSITION 0
  AS
  BEGIN
    IF (NEW."IDX_TRANSPORT" IS NULL) THEN NEW."IDX_TRANSPORT" = GEN_ID("SEQ_T_TRANSPORTS_IDX_TRANSPORT",1); 
  END
  ^
  CREATE PROCEDURE "P_T_TRANSPORTS_IDX_TRANSPORT"
  RETURNS (
      "AUTOINC" INTEGER)
  AS
  BEGIN  
  	"AUTOINC" = GEN_ID("SEQ_T_TRANSPORTS_IDX_TRANSPORT",1);
     SUSPEND;
  END
  ^
  SET TERM ; ^
  
  CREATE VIEW "V_EPHEMERIDES-FULL"
  (
    IDX_EPHEMERIDE,
    IDX_ANNEESCOLAIRE,
    INTITULEEPHEMERIDE,
    DATEDEBUTEPHEMERIDE,
    DATEFINEPHEMERIDE,
    ANNEEANNEESCOLAIRE
  )
  AS
  SELECT 
    T_EPHEMERIDES.IDX_EPHEMERIDE,
    T_EPHEMERIDES.IDX_ANNEESCOLAIRE,
    T_EPHEMERIDES.INTITULEEPHEMERIDE,
    T_EPHEMERIDES.DATEDEBUTEPHEMERIDE,
    T_EPHEMERIDES.DATEFINEPHEMERIDE,
    T_ANNEESSCOLAIRES.ANNEEANNEESCOLAIRE
  FROM 
    T_EPHEMERIDES
    LEFT OUTER JOIN T_ANNEESSCOLAIRES ON (T_EPHEMERIDES.IDX_ANNEESCOLAIRE = T_ANNEESSCOLAIRES.IDX_ANNEESCOLAIRE);
  
  CREATE VIEW "V_TRAJETS-FULL"
  (
    IDX_TRAJET,
    IDX_ETAPEDEPART,
    IDX_ETAPEARRIVEE,
    NOMTRAJET,
    TEMPSTRAJET,
    KMTRAJET,
    NOMETAPEDEPART,
    NOMETAPEARRIVEE,
    ADRESSEETAPEDEPART,
    ADRESSEETAPEARRIVEE
  )
  AS
  SELECT  
    T_TRAJETS.IDX_TRAJET,
    T_TRAJETS.IDX_ETAPEDEPART,
    T_TRAJETS.IDX_ETAPEARRIVEE,
    T_TRAJETS.NOMTRAJET,
    T_TRAJETS.TEMPSTRAJET,
    T_TRAJETS.KMTRAJET,
    T_ETAPES.NOMETAPE as NOMETAPEDEPART,
    T_ETAPES1.NOMETAPE as NOMETAPEARRIVEE,
    T_ETAPES.ADRESSEETAPE as ADRESSEETAPEDEPART,
    T_ETAPES1.ADRESSEETAPE as ADRESSEETAPEARRIVEE  
  FROM 
    T_TRAJETS
    INNER JOIN T_ETAPES ON (T_TRAJETS.IDX_ETAPEDEPART = T_ETAPES.IDX_ETAPE)
    INNER JOIN T_ETAPES T_ETAPES1 ON (T_TRAJETS.IDX_ETAPEARRIVEE = T_ETAPES1.IDX_ETAPE);
    
    CREATE VIEW "V_PLANNINGS-FULL"
  (
    IDX_PLANNING,
    IDX_DATEPLANNING,
    IDX_HEURESPLANNING,
    IDX_TYPEPLANNING,
    DATEDATEPLANNING,
    CODESEMAINEDATEPLANNING,
    HEUREPLANNING,
    NOMTYPEPLANNING
  )
  AS
  SELECT 
    T_PLANNINGS.IDX_PLANNING,
    T_PLANNINGS.IDX_DATEPLANNING,
    T_PLANNINGS.IDX_HEURESPLANNING,
    T_PLANNINGS.IDX_TYPEPLANNING,
    T_DATESPLANNINGS.DATEDATEPLANNING,
    T_DATESPLANNINGS.CODESEMAINEDATEPLANNING,
    T_HEURESPLANNINGS.HEUREPLANNING,
    T_TYPESPLANNINGS.NOMTYPEPLANNING
  FROM 
    T_PLANNINGS
    LEFT OUTER JOIN T_DATESPLANNINGS ON (T_PLANNINGS.IDX_DATEPLANNING = T_DATESPLANNINGS.IDX_DATEPLANNING)
    LEFT OUTER JOIN T_HEURESPLANNINGS ON (T_PLANNINGS.IDX_HEURESPLANNING = T_HEURESPLANNINGS.IDX_HEURESPLANNING)
    LEFT OUTER JOIN T_TYPESPLANNINGS ON (T_PLANNINGS.IDX_TYPEPLANNING = T_TYPESPLANNINGS.IDX_TYPEPLANNING);
  