#ifndef C_BDM_THERIAQUEPLUGIN_H
#define C_BDM_THERIAQUEPLUGIN_H

#include <QObject>
#include <QDate>
#include <QSqlDatabase>
#include <QSqlQuery>
#include <QVariant>
#include <QObject>

#include "../C_BaseCommon.h"
#include "../../MedinTuxTools-QT4/medicabase/C_Theriaque_DBVar.h"
#include "../../MedinTuxTools-QT4/medicabase/C_BDM_Api.h"
#include "../../MedinTuxTools-QT4/CGestIni.h"
#include "../../MedinTuxTools-QT4/medicabase/C_InterResultPair.h"
/*
SELECT * FROM cimcdf_cim10_codif ,
              cim10,
              cdf_codif
where  CIMCDF_CIM_CODE_FK_PK=CIM_CODE_PK      and
       CDF_CODE_PK= CIMCDF_CDF_CODE_FK_PK   and
       CDF_NUMERO_PK =           CIMCDF_CDF_NUMERO_FK_PK
        -- and CIM_CODE_PK = 'N40'
        -- and CDF_CODE_PK like 'NE%'
        and CDF_CODE_PK like 'TJ%'

SELECT SP_CIPUCD    as CIP,
       IPO_DOSEMIN  as dose_max,
       IPO_DOSEMAX,
       t0.CDF_NOM   as unite_max,
       SP_NOM
FROM ipo_infoposo ,
     sp_specialite,
     cdf_codif t0
where IPO_FPO_CODE_FK_PK=SP_CODE_SQ_PK
and   IPO_CDF_FREQMAX_CODE_FK = t0.CDF_CODE_PK



*/


class C_InterResultPair;
//================================== C_BDM_TheriaquePlugin =======================================
class C_BDM_TheriaquePlugin :  public  C_BaseCommon /*, C_Theriaque_DBVar */,  public C_BDM_PluginI
{
    Q_OBJECT
public:
    C_BDM_TheriaquePlugin(const QString &confData, QObject *parent = 0, QTextEdit *logWidget=0, QProgressBar *pQProgressBar=0);
   ~C_BDM_TheriaquePlugin();
    //------------------ INTERFACE VIRTUELLE -----------------
    int           init              ( const QString &confData     );
    void          setLogWidget      ( QTextEdit *logWidget        );
    void          setProgressWidget ( QProgressBar *pQProgressBar );
    QProgressBar* progressWidget()  { return C_BaseCommon::progressWidget(); }
    QString       dataSourceVersion();
    QString       lang();
    QString       owner();
    QString       getLastError();

    //--------------------------- get_CIS_RCP_From_CIP -----------------------------------------------------------
    /*! \brief return ANSM (ex afssaps) CIS ans RCP code from CIP code, to use in html request with ANSM (ex afssaps) web site.
     *  \param const QString cip is drug cip code.
     *  \param QString *rcp is pointer on QString to return RCP result if not zero .
     *  \return CIS code string
    */
    QString get_CIS_and_RCP_From_CIP(const QString &cip, QString *rcp =0 );
    //-------------------------------- isStupefiant ------------------------------------------------------
    /*! \brief return if the product identified par Id is a stupefiant
     *  \param const QString &cip      code CIP of the drug from wich wee want datas.
     *  \return 1 is stupefiant
     */
    int isStupefiant ( const QString &cip );
    //-------------------------------- code_ATC_To_Name ------------------------------------------------------
    /*! \brief return if ATC libelle from code ATC
     *  \param const QString &code      code ATC .
     *  \return QString return libelle
     */
    QString code_ATC_To_Name(const QString &code);
    //-------------------------------- getDefinedDailyDoseFromCIP ------------------------------------------------------
    /*! \brief return the defined daily dose from cip.
     *  \param const QString &cip      code CIP of the drug from wich wee want datas.
     *  \return QString defined daily dose
     */
    QString   getDefinedDailyDoseFromCIP ( const QString &cip);
    //-------------------------------- getDrugRouteFromCIP ------------------------------------------------------
    /*! \brief return the drug route from cip.
     *  \param const QString &cip      code CIP of the drug from wich wee want datas.
     *  \return QString with the drug route
     */
    QString   getDrugRouteFromCIP ( const QString &cip);
    //-------------------------------- getPosologiesFromCIP ------------------------------------------------------
    /*! \brief return posologies list as posologie grammar QString
     *  \param const QString &cip      code CIP of the drug from wich wee want datas.
     *  \return QStringList with grammar QString list
     */
    QStringList   getPosologiesFromCIP ( const QString &cip );
    //-------------------------------- getInteractionCim10 ------------------------------------------------------
    /*! \brief return physiopath interactions from patient and drug.
     *  \param const QString& cip drug cip identification .
     *  \param const QStringList &cim10List cim10 pathologies list .
     *  \param QString drugName (default empty) the drug name.
     *  \return QList<C_InterResultPair> result interaction pair list
     */
    QList<C_InterResultPair> getInteractionCim10(const QString &cip, const QStringList &cim10List , QString drugName  = ""  );
    //-------------------------------- getInteractionPairFromCipList ------------------------------------------------------
    /*! \brief return interactions xml results from a cip list.
     *  \param const QStringList &cipList      drugs CIP codes list to test.
     *  \param QString drugName (default empty) the drug name.
     *  \return result interaction pair list
     */
    QList<C_InterResultPair> getInteractionPairFromCipList ( const QStringList &cipList);
    //-------------------------------- getInteractionFromCipList ------------------------------------------------------
    /*! \brief return interactions xml results from a cip list.
     *  \param const QStringList &cipList      drugs CIP codes list to test.
     *  \return QStringList where each line is a xml result interaction
     *   each interaction line is a xml structure where :
     *   <itli>           </itli> delimits each interaction line structured as follows.
     *   <itli_code1>     </itli_code1>       delimits first  term code (if exists)
     *   <itli_typcode1>  </itli_typcode1>    delimits first  term codetyp examples "CIP ATC CIM10 CISP NONE AL PO"
     *   <itli_terme1>    </itli_terme1>      delimits first  term libelle text
     *   <itli_code2>     </itli_code2>       delimits second term code (if exists)
     *   <itli_typcode2>  </itli_typcode2>    delimits second term codetyp examples "CIP ATC CIM10 CISP NONE"
     *   <itli_terme2>    </itli_terme2>      delimits second term libelle text
     *   <itli_terme2>    </itli_terme2>      delimits second term libelle text
     *   <itli_texte>     </itli_texte>       delimits text interaction information
     *   <itli_ityp>      </itli_ityp>        delimits interaction type (RESERVED)
     *   <itli_level>     </itli_level>       interraction level
     */
    // QStringList   getInteractionFromCipList ( const QStringList &cipList);
    //-------------------------------- getInteractionAgeSexePoidsSportVigil ------------------------------------------------------
    /*! \brief return physiopath interactions from patient and drug.
     *  \param const QString& cip drug cip identification .
     *  \param const QString &age patient age .
     *  \param const QString &sexe patient sexe F-M-I.
     *  \param const QString &poids patient poids .
     *  \param const QString &taille patient size .
     *  \param bool sport if true particular attention for doping drugs is required  .
     *  \param bool vigil if true particular attention for drugs which vigilance  alteration is required  .
     *  \param QString drugName (default empty) the drug name.
     *  \return QList<C_InterResultPair> result interaction pair list
     */
     QList<C_InterResultPair>        getInteractionAgeSexePoidsSportVigil( const QString &cip,
                                                                           const QString &age ,
                                                                           const QString &sexe,
                                                                           const QString &poids,
                                                                           const QString &taille,
                                                                           bool  sport = true,
                                                                           bool  vigil = true,
                                                                           QString drugName  = ""  );

    //....................... classification ATC .....................................
    int           nextATC_Code(QString &codeAtc, QString &libelle);

    //.................. liste des medicaments ................
    long          drugsList_Count();
    int           getDrugList_Start();
    int           getDrugList_NextRecord(C_BDM_DrugListRecord &rC_BDM_DrugListRecord);

    //------------------------------ getNextSmrInfoForCIP ------------------------------------------
    /*! \brief select SMR and ASM informations for a drug. You must call this methode While returns true.
     *  \param const QString &cip      code CIP of the drug from wich wee want datas.
     *  \param QString &date           it will contains date        of SMR ASM.
     *  \param QString &level          it will contains level       of SMR ASM..
     *  \param QString &indication     it will contains indication  of SMR ASM..
     *  \param QString &descriptif     it will contains description of SMR ASM..
     *  \param QString &codeCimx       it will contains code CIM10  of SMR ASM..
     *  \return true while datas are presents.. You must loop while returns true.
     */
    bool          getNextSmrInfoForCIP(      const QString &cip,
                                             QString &date,
                                             QString &level,
                                             QString &levelLibelle,
                                             QString &indication,
                                             QString &descriptif,
                                             QString &codeCimx
                                      );

    //------------------------------ getMonographieFromCIP ------------------------------------------
    /*! \brief select monographie for a drug.
     *  \param const QString &cip            code CIP of the drug from wich wee want datas.
     *  \param  bool dataMustBeReadInCache   if TRUE datas are read in internal cache else there are computed and after placed in cache.
     *  \return QString contains monographie
     */
    QString             getMonographieFromCIP (    const QString &cip   , bool dataMustBeReadInCache /* = TRUE */ );
    //-------------------------------- getPriseUnitFormFromCIP ------------------------------------------------------
    /*! \brief return the prise unit form from cip. (comprimés, suppositoires sachets,ampoules,doses kg, cuillères à café etc...)
     *  \param const QString &cip      code CIP of the drug from wich wee want datas.
     *  \return QString with unit form
     */
    QString             getPriseUnitFormFromCIP ( const QString &cip , const QString &commercialName = 0);

    //------------------ INTERFACE PRIVEE IMPLEMENTEE --------------------------------------------------------------------------------

private:
    //------------------------------------ addCollapsibleJSPanel -------------------------------
    /*! \brief create  hmtl block which is a collapsible panel which works with JS SpryCollapsiblePanel.js.
     *  \param int   index of panel (for identification anchor).
     *  \param QString &date           it will contains date        of panel.
     *  \param QString &level          it will contains level       of SMR ASM if present (right information).
     *  \param QString &indication     it will contains indication  red text .
     *  \param QString &descriptif     it will contains description which is collapsible .
     *  \param QString &codeCimx       it will contains code CIM10  of SMR ASM if present.
     *  \param QString &path           path of the JS script and images.
     *  \param QString &javaS_CreatePanel_Body      JS instanciation panels Widget list on wich append panel instance.
     *  \return QString which is html block to append.
     */

    QString             addCollapsibleJSPanel       ( int   index,
                                                      const QString &date,
                                                      const QString &level,
                                                      const QString &Libelle,
                                                      const QString &codeCimx,
                                                      const QString &indication,
                                                      const QString &path,
                                                      QString &descriptif,
                                                      QString &javaS_CreatePanel_Body ,
                                                      const QString &className  = "CollapsiblePanelTab"  );
    //--------------------------- getInteractionVigilance -----------------------------------------------------------
    /*! \brief return drugs interactions with vigilance.
     *  \param const QStringList &cip      drug CIP code to test.
     *  \param QString drugName (default empty) the drug name.
     *  \return QList<C_InterResultPair> result interaction pair list
     */
    QList<C_InterResultPair>  getInteractionVigilance   (const QString &cip,       QString drugName   = "" );
    QList<C_InterResultPair>  getInteractionVigilanceSpe(const QString &cip, const QString &s_codeId, QString drugName   = "");
    //--------------------------- CIP_to_ID -----------------------------------------------------------
    /*! \brief return theriaque ID code from CIP code.
     *  \param const QString cip is drug cip code.
     *  \return theriaque ID code
    */
   int           CIP_to_ID(const QString &cip);
   //--------------------------- isThisCim10Code_in_Cim10List -----------------------------------------------------------
   /*! \brief return theriaque if a cim10 code is in cim10 list codes.
    *  \param const QString &cim10 cim10 code can be N85-N90.
    *  \param const QStringList &Cim10List cim10 list codes where find cim10 code.
    *  \return bool if find;
   */
   bool                             isThisCim10Code_in_Cim10List(const QString &cim10, const QStringList &Cim10List);
   QMap<QString, C_InterResultPair> get_Cim10_InterResultPair_Map(const QString &s_codeId, const QString &level,const QString &cip, const QStringList &cim10List , QString drugName);
   QString                          ciTextLevelToLevel( QString level);
   QString                          gitiamLevelToBdmLevel ( const QString &niveau );
   //---------------------------- createAdditionnalTables ----------------------------------------------------------------------
   /*! \brief create monographie cache in intermediate QSqlDatabase (prefixed with dbi_  ) which contains additionals services tables as :
    *    'bdm_druglist' 'my_cache_monographie' .
   */
   int           createAdditionnalTables();

   //---------------------------- parseHtmlGestionDesRisques ---------------------------------------
   /*! \brief create an init the pgr table for gestion des risques (not found in theriaque database)
    *  \param const QString &file     HAS html file from wich extracts and parses data.
    *  \return records number
    */
   int           parseHtmlGestionDesRisques(const QString &file) ;
   QString       insertHtmlLink(const QString text, const QString &url);
   QString       makeLigneGenerique(const QString &nom, const QString &code_id);
   QString       makePosologiesBlock(QString &html,  const QString &s_codeId,
                                     int &indexCollapsiblePanel , const QString & path , QString & javaS_CreatePanel_Body );
   QString       makeEffetsIndesirablesBlock(QString &html, double codeId,
                                           int &indexCollapsiblePanel , const QString & path , QString & javaS_CreatePanel_Body );
   QString       makeEffetsIndesirables_subBlock( double codeId, int type,
                                                 int &indexCollapsiblePanel , const QString & path , QString &javaS_CreatePanel_Body);
   QString       makeEffetsIndesirablesSurdosage_subBlock( double codeId, int type,
                                                           int &indexCollapsiblePanel , const QString & path , QString &javaS_CreatePanel_Body);
   QString       makeUtilReconstAdminBlock(QString &html, double codeId,
                                           int &indexCollapsiblePanel , const QString & path , QString & javaS_CreatePanel_Body );
   QString       makeInteractionBlock(QString &html, double codeId,
                                       int &indexCollapsiblePanel , const QString & path , QString & javaS_CreatePanel_Body );
   QString       makeConservationBlock(QString &html, QString cip,
                                       int &indexCollapsiblePanel , const QString & path , QString & javaS_CreatePanel_Body );
   QString       makeEffetConduiteBlock(QString &html, const QString &s_codeId,
                                        int &indexCollapsiblePanel , const QString & path , QString & javaS_CreatePanel_Body );
   QString       makePharmacoDynamiqueBlock(QString &html, int codeId,
                                            int &indexCollapsiblePanel , const QString & path , QString & javaS_CreatePanel_Body );
   QString       makeCinetiqueBlock( QString &html, int codeId,
                                     int &indexCollapsiblePanel , const QString & path , QString & javaS_CreatePanel_Body );
   QString       makeSecuritePrecliniqueBlock(QString &html, int codeId,
                                              int &indexCollapsiblePanel, const QString &path, QString &javaS_CreatePanel_Body);
   QString       makeGrossesseAllaitementProcreationBlock(QString &html, int codeId,
                                                          int &indexCollapsiblePanel, const QString &path, QString &javaS_CreatePanel_Body);

   QString       makeCIBlock(QString &html, const QString &s_codeId, const QString &type,
                             int &indexCollapsiblePanel, const QString &path, QString &javaS_CreatePanel_Body);
   QString       makeFichEtRefOfficiellesBlock(QString &html, const QString &s_codeId,
                                               int &indexCollapsiblePanel , const QString & path , QString &javaS_CreatePanel_Body);

   QString       codeNatureCi_to_Text(char code);
   int           smrList_Count();
   int           getSmrList_Start();
   int           getSmrList_NextRecord (C_BDM_SmrListRecord  &rC_BDM_SmrListRecord);
   QStringList   getDciValuesFromCIP(const QString &cip_code);
   int           getSmrList_Start(const QString &cip);
   QString       getPrixUCDFromCIP(const QString &cip_code);
   QString       getDispVilleHopitalFromCIP(const QString &cip_code);
   QString       posoToGrammar(                 const QString &cip,                  // code cip
                                                const QString &codeTerrain,          // pour l'indication
                                                const QString &codeTypTerrain,       // pour l'indication
                                                const QString &terrain,              // pour l'indication
                                                const QString &voie,                 // orale intraveineuse sous cutanee rectale
                                                const QString &unitFormPrise,        // comprime sachet seringue preremplie etc...
                                                const QString &min_poso,             // 100
                                                const QString &max_poso,             // 200
                                                const QString &unit_poso,            // UI mg ml
                                                const QString &par_facteurCorporel,  // 40
                                                const QString &unit_facteurCorporel, // kg (40 UI/kg)
                                                const QString &q_unitPosoByUnitForm, // 100  (100 mg / comprime)
                                                const QString &min_fce,              // 2
                                                const QString &max_fce,              // 6
                                                const QString &unit_fce,             // jour  (2 a 6 cp par jour)
                                                const QString &min_duree,            // 10
                                                const QString &max_duree,            // 30
                                                const QString &unit_duree            // jour  (pendant 10 a 30 jours)
                                               );
   QString      toNum(const QString &text, const QString &cutFirstStr_in  = "", int *next_pos  = 0);
   //------------------------------ datas ----------------------------
   QSqlQuery    *m_pQSqlQuery;
   QSqlQuery    *m_pQSqlQuery2;
   QSqlQuery    *m_pQSqlQuery3;
   int           m_position;
   QString       m_pathAppli;
   QString       m_pathIni;
   QString       m_datasIni;
   QString       m_dataSourceVersion;
   bool          m_firstTimeGetNextSmrInfoForCIP;
   QMap <QString, QString> m_PgrMap;
public slots:
  void Slot_On_TheriaqueCursorError(const QSqlQuery &sqlquery, const QString &from, const QString &query, const QString &file, int line);
};

//================================== C_OCI_TO_QT_CUR   =========================================
 class C_OCI_TO_QT_CUR : public QObject, public QSqlQuery
 {
     Q_OBJECT

  public:
       C_OCI_TO_QT_CUR(QSqlDatabase db, QObject *parent)
                 : QObject(parent), QSqlQuery(db)
                { m_isNextData   =  0;
                  if (parent)
                     {  connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                                 parent, SLOT   (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  ))
                               );
                     }
                }
      ~C_OCI_TO_QT_CUR()
                {
                }
   bool exec (const QString &sql_query, const QString &className, int line )
        {QSqlQuery::exec(sql_query);
         if ( ! isActive() )
            { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : %1 </b></font>").arg(className), sql_query, __FILE__, line  );
              return false;
            }
         return true;
        }

   bool next()
        {  if ( QSqlQuery::next() )
              { ++m_isNextData;
                return true;
              }
           return false;
        }
protected:
   bool isQueryExecToDo(){return (m_isNextData == 0);}
   int  resetCursor()    {m_isNextData=0; return 0;}
   int  getPosition()    {return m_isNextData;}

 signals:
    void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   //.......... datas .......................
  private:
   int        m_isNextData;
 };

 ///////////////////////////////////////////// MES CLASSES THERIAQUES PERSO //////////////////////////////////////////////////////////////
 //================================== C_GET_SPE_FROM_INDICATION_TEXT_CUR   -A0-   ==================================
 /***************************************************************************
 *   Nom           :  C_GET_SPE_FROM_INDICATION_TEXT_CUR
 -----------------------------------------------------------------------------
 *   Date creation : 20/05/2012
 -----------------------------------------------------------------------------
 *   Description   : cette procedure nous renvoie les specialites selon
 *                   le texte d'indication fourni en entree
 ****************************************************************************/
 /*........................ usage .......................................
     C_GET_SPE_FROM_INDICATION_TEXT_CUR  C_GET_SPE_FROM_INDICATION_TEXT ( database(), this );
     while ( C_GET_SPE_FROM_INDICATION_TEXT.next( "%asthme%") )
           { html += tr("<br><b> C_GET_SPE_FROM_INDICATION_TEXT_CUR : </b>  ") + C_GET_SPE_FROM_INDICATION_TEXT.SPE_NOM() + " code : " + C_GET_SPE_FROM_INDICATION_TEXT.SPE_CODE_ID();
           }
 */
 class C_GET_SPE_FROM_INDICATION_TEXT_CUR : public QObject, public QSqlQuery
 {
    Q_OBJECT
 public:
     C_GET_SPE_FROM_INDICATION_TEXT_CUR(QSqlDatabase db, QObject *parent)
           : QObject(parent), QSqlQuery(db)
         { m_isNextData = 0;
           if (parent)
              {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                        parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
              }
         }
     int next(const QString &TEXT)
     {   if ( m_isNextData == 0 )
            {  QString sql_query = "";
               sql_query        += " SELECT  SP_NOM         AS SPE_NOM,                \n"
                                   "         SP_CODE_SQ_PK  AS SPE_CODE_ID,            \n"
                                   "         FIN_TEXTE      AS IND_TEXTE,              \n"
                                   "         FIN_CODE_SQ_PK AS IND_PK                  \n"
                                   " FROM finsp_indspe, sp_specialite,fin_ficheindic   \n"
                                   " WHERE SP_CODE_SQ_PK        = FINSP_SP_CODE_FK_PK  \n"
                                   " AND   FINSP_FIN_CODE_FK_PK = FIN_CODE_SQ_PK       \n"
                                   " AND   FIN_TEXTE LIKE '"+TEXT+"'                   \n";
               exec(sql_query);
               if ( ! isActive() )
                  { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_SPE_FROM_INDICATION_TEXT() </b></font>"), sql_query, __FILE__, __LINE__  );
                    return 0;
                  }
            }
         if (QSqlQuery::next())
            {  ++m_isNextData;
               m_SPE_NOM     = value(0).toString();
               m_SPE_CODE_ID = value(1).toString();
               m_IND_TEXT    = value(2).toString();
               m_IND_PK      = value(3).toString();
               return m_isNextData;
            }
         m_isNextData = 0;
         return 0;
     }
     QString SPE_CODE_ID() {return m_SPE_CODE_ID;}
     QString SPE_NOM()     {return m_SPE_NOM;}
     QString IND_TEXT()    {return m_IND_TEXT;}
     QString IND_PK()      {return m_IND_PK;}
  signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);
  private:
      //.......... procedure datas .............................
      int     m_isNextData;
      //.......... cursor datas ...................
      QString m_SPE_CODE_ID;
      QString m_SPE_NOM;
      QString m_IND_TEXT;
      QString m_IND_PK;
 };
 //================================== C_GET_THE_CODE_FROM_CIP_CUR   -A1-   ==================================
 /***************************************************************************
 *   Nom           :  C_GET_THE_CODE_FROM_CIP_CUR
 -----------------------------------------------------------------------------
 *   Date creation : 24/05/2012
 -----------------------------------------------------------------------------
 *   Description   : cette procedure nous renvoie le code theriaque
 *                   a partir du code cip
 ****************************************************************************/
 /*........................ usage .......................................
     C_GET_THE_CODE_FROM_CIP_CUR  C_GET_THE_CODE_FROM_CIP ( database(), this );
     while ( C_GET_THE_CODE_FROM_CIP.next( "%asthme%") )
           { html += tr("<br><b> C_GET_THE_CODE_FROM_CIP : CodeID : </b>  ")  + C_GET_THE_CODE_FROM_CIP.SPE_CODE_ID();
           }
 */
 class C_GET_THE_CODE_FROM_CIP_CUR : public QObject, public QSqlQuery
 {
    Q_OBJECT
 public:
     C_GET_THE_CODE_FROM_CIP_CUR(QSqlDatabase db, QObject *parent)
           : QObject(parent), QSqlQuery(db)
         { m_isNextData = 0;
           if (parent)
              {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                        parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
              }
         }
     int next(const QString &cip)
     {   if ( m_isNextData == 0 )          // int SP_CODE_SQ_PK = C_GET_THE_SPECIALITE.SP_CODE_SQ_PK();    // id theriaque
            {  QString sql_query  = "";
                       sql_query += " SELECT SP_CODE_SQ_PK                    \n"
                                    " FROM   sp_specialite,                   \n"
                                    " pre_presentation                        \n"
                                    " WHERE   PRE_SP_CODE_FK = SP_CODE_SQ_PK  \n"
                                    " AND     PRE_CODE_PK    =  '" + cip + "' \n";

               exec(sql_query);
               if ( ! isActive() )
                  { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_SPE_CODE_FROM_CIP() </b></font>"), sql_query, __FILE__, __LINE__  );
                    return 0;
                  }
            }
         if (QSqlQuery::next())
            {  ++m_isNextData;
               m_THE_CODE = value(0).toString();
               return m_isNextData;
            }
         m_isNextData = 0;
         return 0;
     }
     QString THE_CODE() {return m_THE_CODE;}
  signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);
  private:
      //.......... procedure datas .............................
      int     m_isNextData;
      //.......... cursor datas ...................
      QString m_THE_CODE;
 };

 //================================== C_GET_INDICATIONS_FROM_SPE_AND_SMR_CUR   -A2-   ==================================
 /***************************************************************************
 *   Nom           :  C_GET_INDICATIONS_FROM_SPE_AND_SMR_CUR
 -----------------------------------------------------------------------------
 *   Date creation : 24/05/2012
 -----------------------------------------------------------------------------
 *   Description   : renvoie les indication CIM10 a partir du code cip (typ_id=="CIP")
 *                   ou Theriaque (typ_id== "THE") et d'un filtre SMR "'2','4','3','1'"
 *                   dont il ne sera pas tenu compte si vide
 ****************************************************************************/
 /*........................ usage .......................................
     C_GET_INDICATIONS_FROM_SPE_AND_SMR_CUR  C_GET_INDICATIONS_FROM_SPE_AND_SMR ( database(), this );
     while ( C_GET_INDICATIONS_FROM_SPE_AND_SMR.next(codeId, typ_id, smrFilter) )
           { html += tr("<br><b> C_GET_INDICATIONS_FROM_SPE_AND_SMR : CodeID : </b>  ")  + C_GET_INDICATIONS_FROM_SPE_AND_SMR.CODE_CIM();
           }
 */
 class C_GET_INDICATIONS_FROM_SPE_AND_SMR_CUR : public QObject, public QSqlQuery
 {
    Q_OBJECT
 public:
     //-------------------------- C_GET_INDICATIONS_FROM_SPE_AND_SMR_CUR ---------------------
     C_GET_INDICATIONS_FROM_SPE_AND_SMR_CUR (QSqlDatabase db, QObject *parent)
           : QObject(parent), QSqlQuery(db)
         { m_isNextData = 0;
           m_smrList.clear(); // paranoiac attitude
           m_smrList.append(tr("sans objet"));          // 0 sans objet 1 faible 2 important 3 insuffisant 4 modéré
           m_smrList.append(tr("FAIBLE"));              // 1 faible
           m_smrList.append(tr("IMPORTANT"));           // 2 important
           m_smrList.append(tr("INSUFFISANT"));         // 3 insuffisant
           m_smrList.append(tr("MODERE"));              // 4 modere
           if (parent)
              {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                        parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
              }
         }
     //-------------------------- next ---------------------
     int next(const QString &codeId, const QString &typ_id, const QString &smrFilter="", const QString &typIndic="CIM")          // CIM ""
     {   if ( m_isNextData == 0 )
            {  QString sql_query  = "";
                       sql_query += " SELECT DISTINCT                                                  \n"
                                    " FIN_TEXTE                               ,                        \n";    // 0       // 0        texte de l'indication
               if (smrFilter.length())
                  {    sql_query += "   FINSMR_CDF_SMR_CODE_FK_PK             ,                        \n"     // 1                   code smr
                                    "   FINSMR_DATE_SMR_PK                    ,                        \n";    // 2                   date smr
                  }
                       sql_query += " CIM_LIBELLE_LONG                        ,                        \n"     // 3       // 1        libelle long cim
                                    " T1.CIM_CODE_PK                                                   \n"     // 4       // 2        code cim
                                    " FROM                                                             \n";
               if (typ_id[0] != 'T')             //....... CIP version ................
                  {    sql_query += " sp_specialite,                                                   \n"
                                    " pre_presentation,                                                \n";
                  }
                       sql_query += " finsp_indspe,                                                    \n"
                                    " fin_ficheindic T3,                                               \n";
               if (smrFilter.length())
                      sql_query  += "      finsmr_indic_smr_atr,                                       \n";
                      sql_query  += " cim10               T1,                                          \n"
                                    " cimcdf_cim10_codif  T2                                           \n"
                                    " WHERE  FIN_CODE_SQ_PK              = FINSP_FIN_CODE_FK_PK        \n";
               if (smrFilter.length())
                      sql_query  += "    AND    FINSMR_FIN_CODE_FK_PK     = T3.FIN_CODE_SQ_PK          \n";
                      sql_query  += " AND    T1.CIM_CODE_PK               = T2.CIMCDF_CIM_CODE_FK_PK   \n"
                                    " AND    T2.CIMCDF_CDF_CODE_FK_PK     = T3.FIN_CDF_NAIN_CODE_FK_PK \n"
                                    " AND    T2.CIMCDF_CDF_NUMERO_FK_PK   = 'NN'                       \n"
                                    " AND    T1.CIM_CODE_PK              !='.'                         \n"
                                    " AND    T1.CIM_CODE_PK              !='..'                        \n";
               if (typ_id[0] == 'T')
                  {   sql_query  += " AND    FINSP_SP_CODE_FK_PK          = '" + codeId + "'           \n";
                  }
               else
                  {   sql_query  += " AND    PRE_SP_CODE_FK               = SP_CODE_SQ_PK              \n"
                                    " AND    FINSP_SP_CODE_FK_PK          = PRE_SP_CODE_FK             \n"
                                    " AND    PRE_CODE_PK                  = '" + codeId + "'           \n";
                  }
               if (smrFilter.length())
                      sql_query  += "    AND    FINSMR_CDF_SMR_CODE_FK_PK IN (" + smrFilter + ")       \n";
               //CGestIni::Param_UpdateToDisk("/home/ro/query.sql",sql_query);
               exec(sql_query);
               if ( ! isActive() )
                  { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_INDICATIONS_FROM_SPE_AND_SMR_CUR() </b></font>"), sql_query, __FILE__, __LINE__  );
                    return 0;
                  }
            }
         if (QSqlQuery::next())
            {  ++m_isNextData;
               if (smrFilter.length())
                  { m_INDTEXT  = value(0).toString();
                    m_SMRCODE  = value(1).toString();
                    m_SMRTEXT  = m_smrList[m_SMRCODE.toInt()];
                    m_SMRDATE  = value(2).toDate().toString("dd-MM-yyyy");
                    m_CIMTEXT  = value(3).toString();
                    m_CIMCODE  = value(4).toString();
                  }
               else
                  { m_INDTEXT  = value(0).toString();
                    m_SMRCODE  = "";
                    m_SMRTEXT  = "";
                    m_SMRDATE  = "";
                    m_CIMTEXT  = value(1).toString();
                    m_CIMCODE  = value(2).toString();
                  }
               return m_isNextData;
            }
         m_isNextData = 0;
         return 0;
     }
     //-------------------------- acces aux donnees ----------------------------------------------
     QString INDTEXT() {return m_INDTEXT;}
     QString SMRCODE() {return m_SMRCODE;}
     QString SMRTEXT() {return m_SMRTEXT;}
     QString CIMTEXT() {return m_CIMTEXT;}
     QString CIMCODE() {return m_CIMCODE;}
     QString SMRDATE() {return m_SMRDATE;}
     //-------------------------- error gesticulation --------------------------------------
  signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);
  private:
      //.......... procedure datas .............................
      QStringList    m_smrList;
      int            m_isNextData;
      //.......... cursor datas ................................
      QString m_INDTEXT;
      QString m_SMRCODE;
      QString m_SMRTEXT;
      QString m_CIMTEXT;
      QString m_CIMCODE;
      QString m_SMRDATE;
 };

 //================================== C_GET_MARCHE_PUBLIC_SPE_CUR   -A3-   ==================================
 /***************************************************************************
 *   Nom           :  C_GET_MARCHE_PUBLIC_SPE_CUR
 -----------------------------------------------------------------------------
 *   Date creation : 27/05/2012
 -----------------------------------------------------------------------------
 *   Description   : cette procedure nous renvoie le code du marche public
 *                   a partir du code de specialite
 ****************************************************************************/
 /*........................ usage .......................................
     C_GET_MARCHE_PUBLIC_SPE_CUR  C_GET_MARCHE_PUBLIC_SPE ( database(), this );
     while ( C_GET_MARCHE_PUBLIC_SPE.next( codeId) )
           { html += tr("<br><b> C_GET_MARCHE_PUBLIC_SPE : CodeID : </b>  ")  + C_GET_MARCHE_PUBLIC_SPE.CMP_LIBELLE();
           }
 */
 class C_GET_MARCHE_PUBLIC_SPE_CUR : public QObject, public QSqlQuery
 {
    Q_OBJECT
 public:
     //-------------------------- C_GET_MARCHE_PUBLIC_SPE_CUR ---------------------
     C_GET_MARCHE_PUBLIC_SPE_CUR(QSqlDatabase db, QObject *parent)
           : QObject(parent), QSqlQuery(db)
         { m_isNextData = 0;
           if (parent)
              {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                        parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
              }
         }
     //-------------------------- next ----------------------------------------------------
     int next(const QString &CodeId)
     {   if ( m_isNextData == 0 )          // int SP_CODE_SQ_PK = C_GET_THE_SPECIALITE.SP_CODE_SQ_PK();    // id theriaque
            {  QString sql_query  = "";
                       sql_query += " SELECT CMP_LIBELLE                              \n"
                                    " FROM cmp_marchepublic, spcmp_spe_marchepublic   \n"
                                    " WHERE CMP_CODE_SQ_PK=SPCMP_CMP_CODE_FK_PK       \n"
                                    " AND SPCMP_SP_CODE_FK_PK = '" + CodeId + "'      \n";
               exec(sql_query);
               if ( ! isActive() )
                  { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_MARCHE_PUBLIC_SPE_CUR() </b></font>"), sql_query, __FILE__, __LINE__  );
                    return 0;
                  }
            }
         if (QSqlQuery::next())
            {  ++m_isNextData;
               m_CMP_LIBELLE = value(0).toString();
               return m_isNextData;
            }
         m_isNextData = 0;
         return 0;
     }
     //-------------------------- acces aux donnees ----------------------------------------------
     QString CMP_LIBELLE() {return m_CMP_LIBELLE;}
     //-------------------------- error gesticulation --------------------------------------
  signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);
  private:
      //.......... procedure datas .............................
      int     m_isNextData;
      //.......... cursor datas ...................
      QString m_CMP_LIBELLE;
 };

 //================================== C_GET_CIPEMG_SPE_CUR   -A4-   ==================================
 /***************************************************************************
 *   Nom           :  C_GET_CIPEMG_SPE_CUR
 -----------------------------------------------------------------------------
 *   Date creation : 27/05/2012
 -----------------------------------------------------------------------------
 *   Description   : cette procedure nous renvoie les codes de contre indication d'un produit
 *                   a partir du code de specialite
 ****************************************************************************/
 /*........................ usage .......................................
     C_GET_CIPEMG_SPE_CUR  C_GET_CIPEMG_SPE ( database(), this );
     while ( C_GET_CIPEMG_SPE.next( codeId, "'C', 'P', 'N'") )
           { html += tr("<br><b> C_GET_CIPEMG_SPE : codeID : </b>  ")  + C_GET_CIPEMG_SPE.LIBELLE()      + " "
                                                                       + C_GET_CIPEMG_SPE.CODE_CIPEMG()  + " "
                                                                       + C_GET_CIPEMG_SPE.CODE_TERRAIN() + " "
                                                                       + C_GET_CIPEMG_SPE.NUM_SEQ()      + " "
                                                                       + C_GET_CIPEMG_SPE.CODE_NATURE();
           }
 */
 class C_GET_CIPEMG_SPE_CUR : public QObject, public QSqlQuery
 {
    Q_OBJECT
 public:
     //-------------------------- C_GET_CIPEMG_SPE_CUR ---------------------
     C_GET_CIPEMG_SPE_CUR(QSqlDatabase db, QObject *parent)
           : QObject(parent), QSqlQuery(db)
         { m_isNextData = 0;
           if (parent)
              {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                        parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
              }
         }
     //-------------------------- next ----------------------------------------------------
     int next(const QString &CodeId, const QString &NatureCiCodes="", const QString &includedTerrCodes="", const QString &excludedTerrCodes="")
     {   if ( m_isNextData == 0 )
            {  QString sql_query  = "";
               sql_query         += " SELECT                          \n"
                                    " f.FCPMTER_FCPM_CODE_FK_PK,      \n"     // 0 m_CODE_CIPEMG
                                    " f.FCPMTER_CDF_TER_CODE_FK_PK,   \n"     // 1 m_CODE_TERRAIN
                                    " f.FCPMTER_NUMSEQ_PK,            \n"     // 2 m_NUM_SEQ
                                    " f.FCPMTER_NATURE_CIPEMG_PK,     \n"     // 3 m_CODE_NATURE
                                    " c.CDF_NOM                       \n"     // 4 m_LIBELLE
                                    " FROM                            \n"
                                    " fcpmter_fcpm_terrain f,         \n"
                                    " fcpmsp_cipemg_spe fs,           \n"
                                    " cdf_codif c                     \n"
                                    " WHERE f.`FCPMTER_FCPM_CODE_FK_PK`  = fs.`FCPMSP_FCPM_CODE_FK_PK`  \n"
                                    " AND c.`CDF_NUMERO_PK`              = 'CS'                         \n"
                                    " AND f.`FCPMTER_CDF_TER_CODE_FK_PK` =  c.`CDF_CODE_PK`             \n";
               if (NatureCiCodes.length())
                  { sql_query    += " AND f.FCPMTER_NATURE_CIPEMG_PK   IN     ("   + NatureCiCodes     + ")\n";
                  }
               if (includedTerrCodes.length())
                  {sql_query     += " AND f.FCPMTER_CDF_TER_CODE_FK_PK IN     ("   + includedTerrCodes + ")\n";
                  }
               if (excludedTerrCodes.length())
                  {sql_query     += " AND f.FCPMTER_CDF_TER_CODE_FK_PK NOT IN ("   + excludedTerrCodes + ")\n";
                  }
               sql_query         += " AND fs.`FCPMSP_SP_CODE_FK_PK`     = '"       + CodeId            + "'\n"
                                    " ORDER BY f.FCPMTER_NATURE_CIPEMG_PK";
               exec(sql_query);
               if ( ! isActive() )
                  { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_CIPEMG_SPE_CUR() </b></font>"), sql_query, __FILE__, __LINE__  );
                    return 0;
                  }
            }
         if (QSqlQuery::next())
            {  ++m_isNextData;
               m_CODE_CIPEMG  = value(0).toInt();
               m_CODE_TERRAIN = value(1).toString();
               m_NUM_SEQ      = value(2).toInt();
               m_CODE_NATURE  = value(3).toString();
               m_LIBELLE      = value(4).toString();
               return m_isNextData;
            }
         m_isNextData = 0;
         return 0;
     }
     //-------------------------- acces aux donnees ----------------------------------------------
     int     CODE_CIPEMG()  {return m_CODE_CIPEMG;}
     QString CODE_TERRAIN() {return m_CODE_TERRAIN;}
     int     NUM_SEQ()      {return m_NUM_SEQ;}
     QString CODE_NATURE()  {return m_CODE_NATURE;}
     QString LIBELLE()      {return m_LIBELLE;}

     //-------------------------- error gesticulation --------------------------------------
  signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);
  private:
      //.......... procedure datas .............................
      int     m_isNextData;
      //.......... cursor datas ...................
      int     m_CODE_CIPEMG;
      QString m_CODE_TERRAIN;
      int     m_NUM_SEQ;
      QString m_CODE_NATURE;
      QString m_LIBELLE;
 };
 //================================== C_GET_FORFAIT_PRE_SPE_CUR   -A5-   ==================================
 /***************************************************************************
 *   Nom           :  C_GET_FORFAIT_PRE_SPE_CUR
 -----------------------------------------------------------------------------
 *   Date creation : 27/05/2012
 -----------------------------------------------------------------------------
 *   Description   : cette procedure nous renvoie le forfait pre
 *                   a partir du code de specialite
 ****************************************************************************/
 /*........................ usage .......................................
     C_GET_FORFAIT_PRE_SPE_CUR  C_GET_FORFAIT_PRE_SPE ( database(), this );
     while ( C_GET_FORFAIT_PRE_SPE.next( cip,1, "2012-08-23 00:00:00") )
           { html += tr("<br><b> C_GET_FORFAIT_PRE_SPE </b>  ")       + C_GET_FORFAIT_PRE_SPE.TARIF()  + " "
                                                                      + C_GET_FORFAIT_PRE_SPE.DATE()   + " "
                                                                      + C_GET_FORFAIT_PRE_SPE.VALIDE() ;
           }
 */
 class C_GET_FORFAIT_PRE_SPE_CUR : public QObject, public QSqlQuery
 {
    Q_OBJECT
 public:
     //-------------------------- C_GET_FORFAIT_PRE_SPE_CUR ---------------------
     C_GET_FORFAIT_PRE_SPE_CUR(QSqlDatabase db, QObject *parent)
           : QObject(parent), QSqlQuery(db)
         { m_isNextData = 0;
           if (parent)
              {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                        parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
              }
         }
     //-------------------------- next ----------------------------------------------------
     int next(const QString &cip, int valid=-1, QString date="")  // forme yyyy-MM-dd hh:mm:ss
     {   if ( m_isNextData == 0 )
            {  QString sql_query  = "";
               sql_query         += " SELECT                                 \n"
                                    " FORPRE_DATE_PK,                        \n"     // 0
                                    " FORPRE_FORFAIT,                        \n"     // 1
                                    " FORPRE_Valide                          \n"     // 2
                                    " FROM                                   \n"
                                    " forpre_forfait_pre                     \n"
                                    " WHERE                                  \n"
                                    " FORPRE_PRE_CODE_FK_PK  = '" + cip + "' \n";
               if (valid==0)
                  { sql_query    += " AND  FORPRE_Valide = '0'\n";          //  0 recherche prix valide = 0 à la derniere date valide
                  }
               else if (valid==1)
                  { sql_query    += " AND  FORPRE_Valide = '1'\n";          //  1 recherche prix valide = 1 à la derniere date valide
                  }
               else if (valid==-1)                                        // -1 recherche prix à la derniere date valide
                  { date          = "";
                  }
               if (valid!=-2)                                        // -2 recherche tous les prix quelque soit la date ou la validite
                  {if (date.length()==0)
                      { sql_query    += " AND  FORPRE_DATE_PK = ( SELECT MAX(FORPRE_DATE_PK)         \n"
                                        "                         FROM forpre_forfait_pre            \n"
                                        "                         WHERE                              \n"
                                        "                         FORPRE_PRE_CODE_FK_PK  = '"+ cip+"'\n" +
                       ((valid==-1)   ?  "                       )\n":
                           QString     (" AND FORPRE_Valide = '%1')\n").arg(QString::number(valid)));
                      }
                  else
                      { sql_query    += " AND  FORPRE_DATE_PK   = '" + date + "'\n";
                      }
                  }
               exec(sql_query);
               if ( ! isActive() )
                  { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_FORFAIT_PRE_SPE_CUR() </b></font>"), sql_query, __FILE__, __LINE__  );
                    return 0;
                  }
            }
         if (QSqlQuery::next())
            {  ++m_isNextData;
               m_FORPRE_DATE        = value(0).toDate();
               m_FORPRE_FORFAIT     = value(1).toString();
               m_FORPRE_Valide      = value(2).toInt();
               return m_isNextData;
            }
         m_isNextData = 0;
         return 0;
     }
     //-------------------------- acces aux donnees ----------------------------------------------
     QDate     DATE()                      {return m_FORPRE_DATE;}
     QString   DATE(const QString &format) {return m_FORPRE_DATE.toString(format);}
     QString   TARIF()                     {return m_FORPRE_FORFAIT;}
     int       VALIDE()                    {return m_FORPRE_Valide;}
     //-------------------------- error gesticulation --------------------------------------
  signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);
  private:
      //.......... procedure datas .............................
      int     m_isNextData;
      //.......... cursor datas ...................
      QDate   m_FORPRE_DATE;
      QString m_FORPRE_FORFAIT;
      int     m_FORPRE_Valide;
 };
 //================================== C_GET_PRIX_FROM_CIP_CUR   -A6-   ==================================
 /***************************************************************************
 *   Nom           :  C_GET_PRIX_FROM_CIP_CUR
 -----------------------------------------------------------------------------
 *   Date creation : 20/05/2012
 -----------------------------------------------------------------------------
 *   Description   : cette procedure nous renvoie le prix selon
 *                   le CIP
 ****************************************************************************/
 /*........................ usage .......................................
     C_GET_PRIX_FROM_CIP_CUR  C_GET_PRIX_FROM_CIP ( database(), this );
     while ( C_GET_PRIX_FROM_CIP.next( "3241106") )
           { html += tr("<br><b> C_GET_PRIX_FROM_CIP prix : </b>  ") + C_GET_PRIX_FROM_CIP.PRIX() + " en date du " + C_GET_PRIX_FROM_CIP.DATE();
           }
 */
 class C_GET_PRIX_FROM_CIP_CUR :  public C_OCI_TO_QT_CUR
 {
     Q_OBJECT
 public:
     //............................. constructor ...............................
     C_GET_PRIX_FROM_CIP_CUR(QSqlDatabase db, QObject *parent) : C_OCI_TO_QT_CUR( db, parent ) { }
     //............................. extract datas ...............................
     int next(const QString &cip)
     {
         if ( isQueryExecToDo() ) //executer la sql_query que si besoin (premier passage ou fin des donnes)
            {
              if  (exec (QString (" SELECT                               \n"
                                  " PRIPRE_PRIX_EURO,                    \n"
                                  " PRIPRE_DATE_APPLI_PK                 \n"
                                  " FROM pripre_prix_presentation        \n"
                                  " WHERE PRIPRE_PRE_CODE_FK_PK = '%1'   \n"
                                  " AND  PRIPRE_DATE_APPLI_PK   = ( SELECT MAX(PRIPRE_DATE_APPLI_PK)         \n"
                                  "                                 FROM pripre_prix_presentation            \n"
                                  "                                 WHERE PRIPRE_DATE_APPLI_PK  <= NOW()     \n"
                                  "                                 AND PRIPRE_PRE_CODE_FK_PK  = '%1'        \n"
                                  "                               )\n").arg(cip), "C_GET_PRIX_FROM_CIP()", __LINE__ )==0
                  ) return 0;
            }
         //...... extraire les donnees suivantes ................
         if ( C_OCI_TO_QT_CUR::next() )                // si donnees presentes on les extrait et retourne la position
            {  m_PRIX        = value(0).toString();
               m_DATE        = value(1).toDate();
               return getPosition();
            }
         return resetCursor();                         // si donnees non presentes retourne 0
     }
     //.......... access datas ...................
     QString PRIX()                          { int p = m_PRIX.indexOf('.');
                                               if (p != -1)
                                                  {m_PRIX  = m_PRIX+"0000";
                                                   m_PRIX  = m_PRIX.left(p+3);
                                                  }
                                               else
                                                  {m_PRIX += ".00";
                                                  }
                                               return m_PRIX;
                                             }
     QDate   DATE()                          {return m_DATE;}
     QString DATE(const QString &format)     {return m_DATE.toString(format);}

  private:
     //.......... cursor datas ...................
     QString m_PRIX;
     QDate   m_DATE;
 };

 //================================== C_GET_RES_HOP_FROM_CIP_CUR   -A7-   ==================================
 /***************************************************************************
 *   Nom           :  C_GET_RES_HOP_FROM_CIP_CUR
 -----------------------------------------------------------------------------
 *   Date creation : 20/05/2012
 -----------------------------------------------------------------------------
 *   Description   : cette procedure nous renvoie le prix selon
 *                   le CIP
 ****************************************************************************/
 /*........................ usage .......................................
     C_GET_RES_HOP_FROM_CIP_CUR  C_GET_RES_HOP_FROM_CIP ( database(), this );
     while ( C_GET_RES_HOP_FROM_CIP.next( "3241106") )
           { html += tr("<br><b> Reservé à l'hopital : </b>  ") + C_GET_RES_HOP_FROM_CIP.RESULT();
           }
 */
 class C_GET_RES_HOP_FROM_CIP_CUR :  public C_OCI_TO_QT_CUR
 {
     Q_OBJECT
 public:
     //............................. constructor ...............................
     C_GET_RES_HOP_FROM_CIP_CUR(QSqlDatabase db, QObject *parent) : C_OCI_TO_QT_CUR( db, parent ) { }
     //............................. extract datas ...............................
     int next(const QString &cip)
     {
         if ( isQueryExecToDo() ) //executer la sql_query que si besoin (premier passage ou fin des donnes)
            {
              if  (exec (QString (" SELECT                                  \n"
                                  " CDF_NOM                                 \n"
                                  " FROM pre_presentation,                  \n"
                                  " cdf_codif                               \n"
                                  " WHERE CDF_NUMERO_PK      = '13'         \n"
                                  " AND   PRE_CDF_RH_CODE_FK = CDF_CODE_PK  \n"
                                  " AND   PRE_CODE_PK        = '%1'         \n").arg(cip), "C_GET_RES_HOP_FROM_CIP()", __LINE__ )==0
                  ) return 0;
            }
         //...... extraire les donnees suivantes ................
         if ( C_OCI_TO_QT_CUR::next() )                // si donnees presentes on les extrait et retourne la position
            {  m_RESULT        = value(0).toString();
               return getPosition();
            }
         return resetCursor();                         // si donnees non presentes retourne 0
     }
     //.......... access datas ...................
     QString RESULT()     {return m_RESULT;}
  private:
     //.......... cursor datas ...................
     QString m_RESULT;
 };

 //================================== C_GET_COND_FROM_CIP_CUR   -A8-   ==================================
 /***************************************************************************
 *   Nom           :  C_GET_COND_FROM_CIP_CUR
 -----------------------------------------------------------------------------
 *   Date creation : 20/05/2012
 -----------------------------------------------------------------------------
 *   Description   : cette procedure nous renvoie le conditonnement
 *                   à partir du CIP
 ****************************************************************************/
 /*........................ usage .......................................
     C_GET_COND_FROM_CIP_CUR  C_GET_COND_FROM_CIP ( database(), this );
     while ( C_GET_COND_FROM_CIP.next( "3241106") )
           { html += tr("<br><b> C_GET_COND_FROM_CIP : </b>  ")
                        + C_GET_COND_FROM_CIP.PRE_NAME() + " "
                        + C_GET_COND_FROM_CIP.NB_UNITE() + " "
                        + C_GET_COND_FROM_CIP.UNITE_NAME();
           }
 */
 class C_GET_COND_FROM_CIP_CUR :  public C_OCI_TO_QT_CUR
 {
     Q_OBJECT
 public:
     //............................. constructor ...............................
     C_GET_COND_FROM_CIP_CUR(QSqlDatabase db, QObject *parent) : C_OCI_TO_QT_CUR( db, parent ) { }
     //............................. extract datas ...............................
     int next(const QString &code_Id, const QString &typeCodeId = "CIP")
     {
         if ( isQueryExecToDo() ) //executer la sql_query que si besoin (premier passage ou fin des donnes)
            { QString sql_query ="";
              if (typeCodeId=="CIP")
                 { sql_query =   QString (" SELECT                                  \n"
                                          " PRE_NBUNITE,                            \n"
                                          " PRE_CDF_UP_CODE_FK ,                    \n"
                                          " PRE_LIB_CEPS,                           \n"
                                          " CDF_NOM                                 \n"
                                          " FROM pre_presentation,                  \n"
                                          " cdf_codif                               \n"
                                          " WHERE CDF_NUMERO_PK      = '20'         \n"
                                          " AND   PRE_CDF_UP_CODE_FK = CDF_CODE_PK  \n"
                                          " AND   PRE_CODE_PK        = '%1'         \n").arg(code_Id);
                 }
              else
                 {sql_query =   QString (" SELECT                                   \n"
                                         " PRE_NBUNITE,                             \n"
                                         " PRE_CDF_UP_CODE_FK ,                     \n"
                                         " PRE_LIB_CEPS,                            \n"
                                         " CDF_NOM                                  \n"
                                         " FROM pre_presentation,                   \n"
                                         "      sp_specialite,                      \n"
                                         "      cdf_codif                           \n"
                                         " WHERE CDF_NUMERO_PK      = '20'          \n"
                                         " AND   PRE_CDF_UP_CODE_FK = CDF_CODE_PK   \n"
                                         " AND   PRE_SP_CODE_FK     = SP_CODE_SQ_PK \n"
                                         " AND   SP_CODE_SQ_PK      = '%1'          \n").arg(code_Id);

                 }

              if  (exec (sql_query, "C_GET_COND_FROM_CIP_CUR()", __LINE__ )==0 ) return 0;
            }
         //...... extraire les donnees suivantes ................
         if ( C_OCI_TO_QT_CUR::next() )                // si donnees presentes on les extrait et retourne la position
            {  m_NB_UNITE      = value(0).toString();
               m_UNITE_CODE    = value(1).toString();
               m_PRE_NAME      = value(2).toString();
               m_UNITE_NAME    = value(3).toString();
               return getPosition();
            }
         return resetCursor();                         // si donnees non presentes retourne 0
     }
     //.......... access datas ...................
     QString NB_UNITE()       {return m_NB_UNITE;}
     QString UNITE_CODE()     {return m_UNITE_CODE;}
     QString PRE_NAME()       {return m_PRE_NAME;}
     QString UNITE_NAME()     {return m_UNITE_NAME;}
  private:
     //.......... cursor datas ...................
     QString m_NB_UNITE;
     QString m_UNITE_CODE;
     QString m_PRE_NAME;
     QString m_UNITE_NAME;
 };

 //================================== C_GET_PRE_COND_PRIM_CUR   -A9-   ==================================
 /***************************************************************************
 *   Nom           :  C_GET_PRE_COND_PRIM_CUR
 -----------------------------------------------------------------------------
 *   Date creation : 20/05/2012
 -----------------------------------------------------------------------------
 *   Description   : cette procedure nous renvoie l'agrément aux collectiviés
 *                   le CIP
 ****************************************************************************/
 /*........................ usage .......................................
     C_GET_PRE_COND_PRIM_CUR  C_GET_PRE_COND_PRIM ( database(), this );
     while ( C_GET_PRE_COND_PRIM.next( cip) )
           { html += tr("<br><b> C_GET_PRE_COND_PRIM : </b>  ") + C_GET_PRE_COND_PRIM.NB_UP();
           }
 */
 class C_GET_PRE_COND_PRIM_CUR :  public C_OCI_TO_QT_CUR
 {
     Q_OBJECT
 public:
     //............................. constructor ...............................
     C_GET_PRE_COND_PRIM_CUR(QSqlDatabase db, QObject *parent) : C_OCI_TO_QT_CUR( db, parent ) { }
     //............................. extract datas ...............................
     int next(const QString &cip)
     {
         if ( isQueryExecToDo() ) //executer la sql_query que si besoin (premier passage ou fin des donnes)
            {
              if  (exec (QString (" SELECT                                                    \n"
                                  " '1'                                AS TYP,                \n"
                                  " t1.PRECONT_PRE_CODE_FK_PK          AS PRE_CODE,           \n"
                                  " IFNULL(t1.PRECONT_NBCONTENANT,1)   AS NB_CONTENANT ,      \n"
                                  " t2.CDF_NOM                         AS EMBALLAGE   ,       \n"
                                  " NULL                               AS QUANTITE ,          \n"
                                  " NULL                               AS QUANTITE_UNITE,     \n"
                                  " PRECONT_VOLCONTENANT               AS VOLUME_CONTENANT,   \n"
                                  " PRECONT_NBCONTENANT_REEL           AS NB_CONTENANT_REEL   \n"
                                  " FROM     precont_pre_contenant  t1 ,                      \n"
                                  " cdf_codif                       t2 ,                      \n"
                                  " cdf_codif                       t3                        \n"
                                  " WHERE  t1.PRECONT_CDF_COCDT_CODE_FK   = t2.CDF_CODE_PK    \n"
                                  " AND    t2.CDF_NUMERO_PK               = '04'              \n"
                                  " AND    t3.CDF_NUMERO_PK               = '21'              \n"
                                  " AND    t1.PRECONT_PRE_CODE_FK_PK      = '%1'              \n"
                                  " UNION                                                     \n"
                                  " SELECT                                                    \n"
                                  " '2'                                AS TYP,                \n"
                                  " t1.PRECONT_PRE_CODE_FK_PK          AS PRE_CODE,           \n"
                                  " IFNULL(t1.PRECONT_NBCONTENANT,1)   AS NB_CONTENANT ,      \n"
                                  " t2.CDF_NOM                         AS EMBALLAGE   ,       \n"
                                  " t1.PRECONT_NBCONTENANCE            AS QUANTITE ,          \n"
                                  " t3.CDF_NOM                         AS QUANTITE_UNITE,     \n"
                                  " PRECONT_VOLCONTENANT               AS VOLUME_CONTENANT,   \n"
                                  " PRECONT_NBCONTENANT_REEL           AS NB_CONTENANT_REEL   \n"
                                  " FROM     precont_pre_contenant  t1 ,                      \n"
                                  " cdf_codif                       t2 ,                      \n"
                                  " cdf_codif                       t3                        \n"
                                  " WHERE  t1.PRECONT_CDF_COCDT_CODE_FK   = t2.CDF_CODE_PK    \n"
                                  " AND    t2.CDF_NUMERO_PK               = '04'              \n"
                                  " AND    t1.PRECONT_CDF_COCE_CODE_FK    = t3.CDF_CODE_PK    \n"
                                  " AND    t3.CDF_NUMERO_PK               = '21'              \n"
                                  " AND    t1.PRECONT_PRE_CODE_FK_PK      = '%1'              \n"
                                  " UNION                                                     \n"
                                  " SELECT                                                    \n"
                                  " '3'                                AS TYP,                \n"
                                  " t1.PRECONT_PRE_CODE_FK_PK          AS PRE_CODE,           \n"
                                  " IFNULL(t1.PRECONT_NBCONTENANT,1)   AS NB_CONTENANT ,      \n"
                                  " t2.CDF_NOM                         AS EMBALLAGE   ,       \n"
                                  " t1.PRECONT_NBCONTENANCE            AS QUANTITE ,          \n"
                                  " t4.CDF_NOM                         AS QUANTITE_UNITE   ,  \n"
                                  " PRECONT_VOLCONTENANT               AS VOLUME_CONTENANT ,  \n"
                                  " PRECONT_NBCONTENANT_REEL           AS NB_CONTENANT_REEL   \n"
                                  " FROM     precont_pre_contenant  t1 ,                      \n"
                                  " cdf_codif                       t2 ,                      \n"
                                  " cdf_codif                       t4                        \n"
                                  " WHERE  t1.PRECONT_CDF_COCDT_CODE_FK   = t2.CDF_CODE_PK    \n"
                                  " AND    t2.CDF_NUMERO_PK               = '04'              \n"
                                  " AND    t1.PRECONT_CDF_VOLCONT_CODE_FK = t4.CDF_CODE_PK    \n"
                                  " AND    t4.CDF_NUMERO_PK               = '21'              \n"
                                  " AND    t1.PRECONT_PRE_CODE_FK_PK      = '%1'  \n").arg(cip), "C_GET_PRE_COND_PRIM_CUR()", __LINE__ )==0
                  ) return 0;
            }
         //...... extraire les donnees suivantes ................
         if ( C_OCI_TO_QT_CUR::next() )                // si donnees presentes on les extrait et retourne la position
            {  m_TYP                 = value(0).toString();
               m_PRE_CODE            = value(1).toString();
               m_NB_CONTENANT        = value(2).toString();
               m_EMBALLAGE           = value(3).toString();
               m_QUANTITE            = value(4).toString();
               m_QUANTITE_UNITE      = value(5).toString();
               m_VOLUME_CONTENANT    = value(6).toString();
               m_NB_CONTENANT_REEL   = value(7).toString();
               return getPosition();
            }
         return resetCursor();                         // si donnees non presentes retourne 0
     }
     //.......... access datas ...................
     QString TYP()                   {return m_TYP;}
     QString PRE_CODE()              {return m_PRE_CODE;}
     QString NB_CONTENANT()          {return m_NB_CONTENANT;}
     QString EMBALLAGE()             {return m_EMBALLAGE;}
     QString QUANTITE()              {return m_QUANTITE;}
     QString QUANTITE_UNITE()        {return m_QUANTITE_UNITE;}
     QString VOLUME_CONTENANT()      {return m_VOLUME_CONTENANT;}
     QString NB_CONTENANT_REEL()     {return m_NB_CONTENANT_REEL;}

  private:
     //.......... cursor datas ...................
     QString m_TYP;
     QString m_PRE_CODE;
     QString m_NB_CONTENANT;
     QString m_EMBALLAGE;
     QString m_QUANTITE;
     QString m_QUANTITE_UNITE;
     QString m_VOLUME_CONTENANT;
     QString m_NB_CONTENANT_REEL;

 };

 //================================== C_GET_AGR_COLLECT_FROM_CIP_CUR   -A10-   ==================================
 /***************************************************************************
 *   Nom           :  C_GET_AGR_COLLECT_FROM_CIP_CUR
 -----------------------------------------------------------------------------
 *   Date creation : 20/05/2012
 -----------------------------------------------------------------------------
 *   Description   : cette procedure nous renvoie l'agrément aux collectiviés
 *                   le CIP
 ****************************************************************************/
 /*........................ usage .......................................
     C_GET_AGR_COLLECT_FROM_CIP_CUR  C_GET_AGR_COLLECT_FROM_CIP ( database(), this );
     while ( C_GET_AGR_COLLECT_FROM_CIP.next( cip) )
           { html += tr("<br><b> C_GET_AGR_COLLECT_FROM_CIP : </b>  ") + C_GET_AGR_COLLECT_FROM_CIP.NB_UP();
           }
 */
 class C_GET_AGR_COLLECT_FROM_CIP_CUR :  public C_OCI_TO_QT_CUR
 {
     Q_OBJECT
 public:
     //............................. constructor ...............................
     C_GET_AGR_COLLECT_FROM_CIP_CUR(QSqlDatabase db, QObject *parent) : C_OCI_TO_QT_CUR( db, parent ) { }
     //............................. extract datas ...............................
     int next(const QString &cip)
     {
         if ( isQueryExecToDo() ) //executer la sql_query que si besoin (premier passage ou fin des donnes)
            {
              if  (exec (QString (" SELECT                   \n"
                                  " PRE_AGRCOLL           ,  \n"
                                  " PRE_DATEJOCOLL        ,  \n"
                                  " PRE_DATEFINCOLL       ,  \n"
                                  " PRE_DATE_APPLIFINCOLL    \n"
                                  " FROM pre_presentation    \n"
                                  " WHERE PRE_CODE_PK = '%1' \n").arg(cip), "C_GET_AGR_COLLECT_FROM_CIP_CUR()", __LINE__ )==0
                  ) return 0;
            }
         //...... extraire les donnees suivantes ................
         if ( C_OCI_TO_QT_CUR::next() )                // si donnees presentes on les extrait et retourne la position
            {  m_AGRCOLL           = value(0).toString();
               m_DATEJOCOLL        = value(1).toDate();
               m_DATEFINCOLL       = value(2).toDate();
               m_DATE_APPLIFINCOLL = value(3).toDate();
               return getPosition();
            }
         return resetCursor();                         // si donnees non presentes retourne 0
     }
     //.......... access datas ...................
     QString AGRCOLL()                                 {return m_AGRCOLL;}
     QDate   DATEJOCOLL()                              {return m_DATEJOCOLL;}
     QString DATEJOCOLL(const QString &format)         {return m_DATEJOCOLL.toString(format);}
     QDate   DATEFINCOLL()                             {return m_DATEFINCOLL;}
     QString DATEFINCOLL(const QString &format)        {return m_DATEFINCOLL.toString(format);}
     QDate   DATE_APPLIFINCOLL()                       {return m_DATE_APPLIFINCOLL;}
     QString DATE_APPLIFINCOLL(const QString &format)  {return m_DATE_APPLIFINCOLL.toString(format);}
  private:
     //.......... cursor datas ...................
     QString m_AGRCOLL;
     QDate   m_DATEJOCOLL;
     QDate   m_DATEFINCOLL;
     QDate   m_DATE_APPLIFINCOLL;
 };

 //================================== C_CODE_SPE_TO_CIP_CUR   -A11-   ==================================
 /***************************************************************************
 *   Nom           :  C_CODE_SPE_TO_CIP_CUR
 -----------------------------------------------------------------------------
 *   Date creation : 20/05/2012
 -----------------------------------------------------------------------------
 *   Description   : cette procedure nous renvoie le code de specialite
 *                   à partir du  CIP
 ****************************************************************************/
 /*........................ usage .......................................
     C_CODE_SPE_TO_CIP_CUR  C_CODE_SPE_TO_CIP ( database(), this );
     while ( C_CODE_SPE_TO_CIP.next( cip) )
           { html += tr("<br><b> C_CODE_SPE_TO_CIP : </b>  ") + C_CODE_SPE_TO_CIP.CIP();
           }
 */
 class C_CODE_SPE_TO_CIP_CUR :  public C_OCI_TO_QT_CUR
 {
     Q_OBJECT
 public:
     //............................. constructor ...............................
     C_CODE_SPE_TO_CIP_CUR(QSqlDatabase db, QObject *parent) : C_OCI_TO_QT_CUR( db, parent ) { }
     //............................. extract datas ...............................
     int next(const QString &codeId, const QString &name)
     {
         if ( isQueryExecToDo() ) //executer la sql_query que si besoin (premier passage ou fin des donnes)
            {
              if  (exec (QString (//" SELECT                                   \n"
                                  //" PRE_CODE_PK                              \n"
                                  //" FROM pre_presentation,                   \n"
                                  //"      sp_specialite,                      \n"
                                  //"      cdf_codif A,                        \n"
                                  //"      cdf_codif B                         \n"
                                  //" WHERE PRE_SP_CODE_FK     = '%1'          \n"
                                  //" AND  SP_CDF_SLAB_CODE_FK = A.CDF_CODE_PK \n"
                                  //" AND    SP_CDF_LI_CODE_FK = B.CDF_CODE_PK \n"
                                  //" AND    A.CDF_NUMERO_PK   = '15'          \n"
                                  //" AND    B.CDF_NUMERO_PK   = '08'          \n"
                                  //" AND    PRE_ETAT_COMMER   = 'D'           \n"
                                  //" AND    PRE_SP_CODE_FK    = SP_CODE_SQ_PK "
                                  //" AND   SP_NOM             = '%2'          \n"
                                  //" AND   SP_CODE_SQ_PK      = '%1'"

                                  " SELECT                                   \n"
                                  " PRE_CODE_PK                              \n"
                                  " FROM pre_presentation,                   \n"
                                  " WHERE PRE_SP_CODE_FK     = '%1'          \n"

                                ).arg(codeId, name), "C_CODE_SPE_TO_CIP_CUR()", __LINE__ )==0
                  ) return 0;
            }
         //...... extraire les donnees suivantes ................
         if ( C_OCI_TO_QT_CUR::next() )                // si donnees presentes on les extrait et retourne la position
            {  m_CIP           = value(0).toString();
               return getPosition();
            }
         return resetCursor();                         // si donnees non presentes retourne 0
     }
     //.......... access datas ...................
     QString CIP()     {return m_CIP;}
  private:
     //.......... cursor datas ...................
     QString m_CIP;
 };
 //================================== C_GET_DETAIL_EFFIND_SURDOSAGE_CUR   -A12-   ==================================
 /***************************************************************************
 *   Nom           :  C_GET_DETAIL_EFFIND_SURDOSAGE_CUR
 -----------------------------------------------------------------------------
 *   Date creation : 12/06/2012
 -----------------------------------------------------------------------------
 *   Description   : cette procedure nous renvoie les details des effets indésirables
 *                   à partir du code effet indésirable 'codeEI' et
 *                   du type d'information recherchee deuxieme parametre 'typeInfo'
 *                   de next( codeEI, typeInfo )
 ****************************************************************************/
 /*........................ usage .......................................
     codeEI est obtenu avec C_GET_THE_EFFIND_SPE(codeSpecialite, 3)  effets cliniques
     codeEI est obtenu avec C_GET_THE_EFFIND_SPE(codeSpecialite, 4)  effets paracliniques

     deuxième parametre (type d'information recherchee)
     // 1 -- classe chimique
     // 2 -- classe pharmacotherapeutique
     // 3 -- nature du surdosage clinique
     // 4 -- nature du surdosage paraclinique
     // 5 -- commentaire nature du surdosage
     // 6 -- conduite à tenir nature du surdosage
     // 7 -- texte nature du surdosage
     // 8 -- texte conduite à tenir

     C_GET_DETAIL_EFFIND_SURDOSAGE_CUR  GET_DETAIL_EFFIND_SURDOSAGE ( database(), this );
     while ( GET_DETAIL_EFFIND_SURDOSAGE.next( codeEI, 1) )
           { html += tr("<br><b> GET_DETAIL_EFFIND_SURDOSAGE : </b>  ")
                    + QString::number(GET_DETAIL_EFFIND_SURDOSAGE.NOFIC()) + "  "
                    + GET_DETAIL_EFFIND_SURDOSAGE.GRP()                    + "  "
                    + GET_DETAIL_EFFIND_SURDOSAGE.INFO_01()                + "  "
                    + GET_DETAIL_EFFIND_SURDOSAGE.TXT();
           }
 */
 class C_GET_DETAIL_EFFIND_SURDOSAGE_CUR :  public C_OCI_TO_QT_CUR
 {
     Q_OBJECT
 public:
     //............................. constructor ...............................
     C_GET_DETAIL_EFFIND_SURDOSAGE_CUR(QSqlDatabase db, QObject *parent) : C_OCI_TO_QT_CUR( db, parent ) { }
     //............................. extract datas ...............................
     int next(double codeEI, int typeInfo)
     {   QString s_codeEI = QString::number(codeEI);
         if ( isQueryExecToDo() ) //executer la sql_query que si besoin (premier passage ou fin des donnes)
            {QString sql_query = "";
             switch (typeInfo)
             { case 1 :         // 1 -- classe chimique
                 { sql_query += " SELECT t1.FEICCH_FEI_CODE_FK_PK    NOFIC   ,"
                                " '1'                                GRP     ,"
                                " t2.CCH_NOM                         TXT "
                                " FROM   feicch_effindclch           t1, "
                                " cch_classechimique                 t2  "
                                " WHERE  t2.CCH_CODE_PK            = t1.FEICCH_CCH_CODE_FK_PK"
                                " AND    t1.FEICCH_FEI_CODE_FK_PK  = '"+s_codeEI+"'";
                 }  break;
               case 2 :         // 2 -- classe pharmacotherapeutique
                 { sql_query += " SELECT t2.FEICPH_FEI_CODE_FK_PK    NOFIC   ,"
                                " '2'                                GRP     ,"
                                " t1.CPH_NOM                         TXT "
                                " FROM   cph_classepharmther         t1, "
                                " feicph_effindclph                  t2  "
                                " WHERE  t1.CPH_CODE_PK            = t2.FEICPH_CPH_CODE_FK_PK"
                                " AND    t2.FEICPH_FEI_CODE_FK_PK  = '"+s_codeEI+"'";
                 }  break;
               case 3 :         // 3 -- nature du surdosage clinique
                 { sql_query += " SELECT  t1.FEINACS_FEI_CODE_FK_PK      NOFIC   ,"
                                " concat('3.',t1.FEINACS_NUMORD)         GRP     ,"
                                " t2.CDF_NOM                             TXT "
                                " FROM    feinacs_natursurdos_eiclin     t1, "
                                " cdf_codif                              t2  "
                                " WHERE t1.FEINACS_CDF_NAEI_CODE_FK_PK = t2.CDF_CODE_PK"
                                " AND     t2.CDF_NUMERO_PK             = 'EN'"
                                " AND     t1.FEINACS_FEI_CODE_FK_PK    = '"+s_codeEI+"'";
                 }  break;
               case 4 :          // 4 -- nature du surdosage paraclinique
                 { sql_query +=  " SELECT  t1.FEINAPS_FEI_CODE_FK_PK        NOFIC   ,"
                                 " concat('4.',t1.FEINAPS_NUMORD)           GRP     ,"
                                 " t2.CDF_NOM                               TXT "
                                 " FROM    feinaps_natursurdos_eiparaclin   t1, "
                                 " cdf_codif                                t2  "
                                 " WHERE  t1.FEINAPS_CDF_NAEI_CODE_FK_PK  = t2.CDF_CODE_PK"
                                 " AND    t2.CDF_NUMERO_PK                = 'EN'"
                                 " AND    t1.FEINAPS_FEI_CODE_FK_PK       = '"+s_codeEI+"'";
                 }  break;
               case 5 :           // 5 -- commentaire nature du surdosage
                 { sql_query +=   " SELECT  t1.FEINAS_FEI_CODE_FK_PK       NOFIC   ,"
                                  " concat('5.',t1.FEINAS_NUMORD)          GRP     ,"
                                  " t2.CDF_NOM                             TXT "
                                  " FROM   feinas_comment_naturesurdosag   t1 ,"
                                  " cdf_codif                              t2"
                                  " WHERE  t1.FEINAS_CDF_COEI_CODE_FK_PK  = t2.CDF_CODE_PK"
                                  " AND    t2.CDF_NUMERO_PK               = 'EC'"
                                  " AND    t1.FEINAS_FEI_CODE_FK_PK       = '"+s_codeEI+"'";
                 }  break;
               case 6 :           // 6 -- conduite à tenir nature du surdosage
                 { sql_query +=   " SELECT  t1.FEICTS_FEI_CODE_FK_PK       NOFIC   ,"
                                  " concat('6.',t1.FEICTS_NUMORD)          GRP     ,"
                                  " t2.CDF_NOM                             TXT "
                                  " FROM    feicts_comment_catsurdos       t1, "
                                  " cdf_codif                              t2  "
                                  " WHERE  t1.FEICTS_CDF_COEI_CODE_FK_PK   = t2.CDF_CODE_PK"
                                  " AND    t2.CDF_NUMERO_PK                = 'EC'"
                                  " AND    t1.FEICTS_FEI_CODE_FK_PK        = '"+s_codeEI+"'";
                 }  break;
               case 7 :           // 7 -- texte nature du surdosage
                 { sql_query +=   " SELECT t1.FEITX3_FEI_CODE_FK_PK  NOFIC,"
                                  " '7'                              GRP ,"
                                  " t1.FEITX3_TEXTE                  TXT "
                                  " FROM   feitx3_ei_txnatsurdos     t1 "
                                  " WHERE  t1.FEITX3_FEI_CODE_FK_PK  = '"+s_codeEI+"'";
                 }  break;
               case 8 :           // 8 -- texte conduite à tenir
                 { sql_query +=   " SELECT t1.FEITX6_FEI_CODE_FK_PK NOFIC,"
                                  " '8'                              GRP ,"
                                  " t1.FEITX6_TEXTE                  TXT "
                                  " FROM   feitx6_ei_txcondsurdos    t1 "
                                  " WHERE  t1.FEITX6_FEI_CODE_FK_PK  = '"+s_codeEI+"'";
                 }  break;
               default :
                  return 0;
             }
          if  (exec (sql_query, QString("GET_DETAIL_EFFIND_SURDOSAGE( %1 )").arg(QString::number(typeInfo)), __LINE__ )==0) return 0;
         } // if ( isQueryExecToDo() )


         //...... extraire les donnees suivantes ................
         if ( C_OCI_TO_QT_CUR::next() )                // si donnees presentes on les extrait et retourne la position
            {  m_NOFIC   = value(0).toDouble();
               m_GRP     = value(1).toString();
               m_TXT     = value(2).toString();
               return getPosition();
            }
         return resetCursor();                         // si donnees non presentes retourne 0
     } // end int next(const QString &codeEI, int typeInfo)

     //.......... access datas ............................................................
     double  NOFIC()   {return m_NOFIC;}
     QString GRP()     {return m_GRP;}
     QString TXT()     {return m_TXT;}
  private:
     //.......... cursor datas ............................................................
     double  m_NOFIC;
     QString m_GRP;
     QString m_TXT;
 };
 //================================== C_GET_POSOLOGIE_CUR   -A13-   ==================================
 /***************************************************************************
 *   Nom           :  C_GET_POSOLOGIE_CUR
 -----------------------------------------------------------------------------
 *   Date creation : 12/06/2012
 -----------------------------------------------------------------------------
 *   Description   : cette procedure nous renvoie les posologies selon
 *                   le code specialite fourni en entree
 ****************************************************************************/
 /*........................ usage .......................................
     QString s_codeId = "1033";          // code specialite
     int     typeInfo = 1;               // type d'infromation recherchee
                                         //          -- 0 fiche posologie
                                         //          -- 1 voies d'administration
                                         //          -- 2 Terrain
                                         //          -- 3 nature indication
                                         //          -- 4 complement nature indication
                                         //          -- 5 référence officielle

     C_GET_POSOLOGIE_CUR  C_GET_POSOLOGIE ( database(), this );
     while ( C_GET_POSOLOGIE.next( s_codeId,  typeInfo ) )
           { html += tr("<br><b> C_GET_POSOLOGIE : </b>  ")
                     + " MY_NOFIC    " + C_GET_POSOLOGIE.MY_NOFIC()
                     + " MY_INFO_01  " + C_GET_POSOLOGIE.MY_INFO_01()
                     + " VALEUR_01   " + C_GET_POSOLOGIE.VALEUR_01 ()
                     + " DATE_01     " + C_GET_POSOLOGIE.DATE_01("dd-MM-yyyy");
           }
 */
 class C_GET_POSOLOGIE_CUR :  public C_OCI_TO_QT_CUR
 {
     Q_OBJECT
 public:
     //............................. constructor ...............................
     C_GET_POSOLOGIE_CUR(QSqlDatabase db, QObject *parent) : C_OCI_TO_QT_CUR( db, parent ) { }
     //............................. extract datas ...............................
     int next(QString s_codeId, int typeInfo)
     {
         if ( isQueryExecToDo() ) //executer la sql_query que si besoin (premier passage ou fin des donnes)
            {QString sql_query = "";
             switch (typeInfo)
             {
              case 1 :
                 { sql_query += // 0 -- fiche posologie
                                " SELECT t1.FPOSP_FPO_CODE_FK_PK    AS NOFIC,"
                                " NULL                              AS INFO_01,"
                                " NULL                              AS VALEUR_01,"
                                " NULL                              AS DATE_01"
                                " FROM    fposp_poso_spe  t1"
                                " WHERE   t1.FPOSP_SP_CODE_FK_PK = '"+s_codeId+"'";

                 }  break;
               case 2 :
                 { sql_query += // 1 -- voies d'administration
                                " SELECT t1.FPOSP_FPO_CODE_FK_PK AS NOFIC,"
                                " t3.CDF_NOM                     AS INFO_01,"
                                " NULL                           AS VALEUR_01,"
                                " NULL                           AS DATE_01"
                                " FROM   fposp_poso_spe   t1,fpovo_fposo_voie t2,cdf_codif t3"
                                " WHERE  t2.FPOVO_CDF_VO_CODE_FK_PK = t3.CDF_CODE_PK"
                                " AND    t3.CDF_NUMERO_PK           = '18'"
                                " AND    t2.FPOVO_FPO_CODE_FK_PK    = t1.FPOSP_FPO_CODE_FK_PK"
                                " AND    t1.FPOSP_SP_CODE_FK_PK     = '"+s_codeId+"'";
                 }  break;
               case 3 :
                 { sql_query += // 2 -- Terrain"
                                " SELECT  t1.FPOSP_FPO_CODE_FK_PK    AS NOFIC,"
                                " t3.CDF_NOM                         AS INFO_01,"
                                " t2.FPOTE_GRP_CODE_PK               AS VALEUR_01,"
                                " NULL                               AS DATE_01"
                                " FROM    fposp_poso_spe t1,fpote_fposo_terrain t2,cdf_codif t3"
                                " WHERE   t1.FPOSP_FPO_CODE_FK_PK  = t2.FPOTE_FPO_CODE_FK_PK"
                                " AND     t3.CDF_CODE_PK           = t2.FPOTE_CDF_TEPO_CODE_FK_PK"
                                " AND     t3.CDF_NUMERO_PK         = 'PT'"
                                " AND     t1.FPOSP_SP_CODE_FK_PK   = '"+s_codeId+"'";
                 }  break;
               case 4 :
                 { sql_query +=  // 3 -- nature indication"
                                 " SELECT t1.FPOSP_FPO_CODE_FK_PK    AS NOFIC,"
                                 " t3.CDF_NOM                        AS INFO_01,"
                                 " NULL                              AS VALEUR_01,"
                                 " NULL                              AS DATE_01"
                                 " FROM  fposp_poso_spe t1,fpout_fposo_utilth  t2,cdf_codif t3"
                                 " WHERE  t1.FPOSP_FPO_CODE_FK_PK  = t2.FPOUT_FPO_CODE_FK_PK"
                                 " AND    t3.CDF_CODE_PK           = t2.FPOUT_CDF_UTPO_CODE_FK_PK"
                                 " AND    t3.CDF_NUMERO_PK         = 'NN'"
                                 " AND    t1.FPOSP_SP_CODE_FK_PK   = '"+s_codeId+"'";
                 }  break;
               case 5 :
                 { sql_query +=   // 4 -- complement nature indication"
                                  " SELECT  t1.FPOSP_FPO_CODE_FK_PK  AS NOFIC,"
                                  " t3.CDF_NOM                       AS INFO_01,"
                                  " t2.FPOCOUT_NUM_ORD               AS VALEUR_01,"
                                  " NULL                             AS DATE_01"
                                  " FROM    fposp_poso_spe t1,fpocout_fposo_commentutilth  t2,cdf_codif t3"
                                  " WHERE   t1.FPOSP_FPO_CODE_FK_PK  = t2.FPOCOUT_FPO_CODE_FK_PK"
                                  " AND     t3.CDF_CODE_PK           = t2.FPOCOUT_CDF_COUT_CODE_FK_PK"
                                  " AND     t3.CDF_NUMERO_PK         = 'PC'"
                                  " AND     t1.FPOSP_SP_CODE_FK_PK   = '"+s_codeId+"'";
                 }  break;
               case 6 :
                 { sql_query +=   // 5 -- référence officielle"
                                  " SELECT t1.FPOSP_FPO_CODE_FK_PK    AS NOFIC,"
                                  " t3.CDF_NOM                        AS INFO_01,"
                                  " NULL                              AS VALEUR_01,"
                                  " t2.FPOAFS_DATE_PK                 AS DATE_01"
                                  " FROM   fposp_poso_spe t1,fpoafs_poso_afssaps t2,cdf_codif t3"
                                  " WHERE  t1.FPOSP_SP_CODE_FK_PK   = t2.FPOAFS_SP_CODE_FK_PK"
                                  " AND    t1.FPOSP_FPO_CODE_FK_PK  = t2.FPOAFS_FPO_CODE_FK_PK"
                                  " AND    t3.CDF_CODE_PK           = t2.FPOAFS_CDF_DOCUMENT_FK_PK"
                                  " AND    t3.CDF_NUMERO_PK         = '25'"
                                  " AND    t1.FPOSP_SP_CODE_FK_PK   = '"+s_codeId+"'"
                                  " AND    t2.FPOAFS_DATE_PK        IN (SELECT MAX(t2.FPOAFS_DATE_PK)"
                                  "                                     FROM   fposp_poso_spe t1,fpoafs_poso_afssaps t2,cdf_codif t3"
                                  "                                     WHERE  t1.FPOSP_SP_CODE_FK_PK   = t2.FPOAFS_SP_CODE_FK_PK"
                                  "                                     AND    t1.FPOSP_FPO_CODE_FK_PK  = t2.FPOAFS_FPO_CODE_FK_PK"
                                  "                                     AND    t3.CDF_CODE_PK           = t2.FPOAFS_CDF_DOCUMENT_FK_PK"
                                  "                                     AND    t3.CDF_NUMERO_PK         = '25'"
                                  "                                     AND    t1.FPOSP_SP_CODE_FK_PK   =  '"+s_codeId+"')";
                 }  break;
               default :
                    return 0;
             }
             if  (exec (sql_query, QString("C_GET_POSOLOGIE_CUR( %1 )").arg(QString::number(typeInfo)), __LINE__ )==0) return 0;
         } // if ( isQueryExecToDo() )


         //...... extraire les donnees suivantes ................
         if ( C_OCI_TO_QT_CUR::next() )                // si donnees presentes on les extrait et retourne la position
            {
               m_MY_NOFIC   = value(0).toString();
               m_MY_INFO_01 = value(1).toString();
               m_VALEUR_01  = value(2).toString();
               m_DATE_01    = value(3).toDate();
               return getPosition();
            }
         return resetCursor();                         // si donnees non presentes retourne 0
     } // end int next(const QString &codeEI, int typeInfo)

     //.......... access datas ............................................................
     QString MY_NOFIC()   {return m_MY_NOFIC;}
     QString MY_INFO_01() {return m_MY_INFO_01;}
     QString VALEUR_01()  {return m_VALEUR_01;}
     QDate   DATE_01()                         {return m_DATE_01;}
     QString DATE_01(const QString &format)    {return m_DATE_01.toString(format);}
  private:
     //.......... cursor datas ............................................................
     QString m_MY_NOFIC;
     QString m_MY_INFO_01;
     QString m_VALEUR_01;
     QDate   m_DATE_01;
 };
 //================================== C_GET_MY_PGR_CUR   -A14-   ==================================
 /***************************************************************************
 *   Nom           :  C_GET_MY_PGR_CUR
 -----------------------------------------------------------------------------
 *   Date creation : 15/06/2012
 -----------------------------------------------------------------------------
 *   Description   : cette procedure nous renvoie les donnees du plan de gestion des risque
 *                   selon le nom de specialite et ou le nom de la substance active
 ****************************************************************************/
 /*........................ usage .......................................
     QString spe_name = "PRADAXA";          // nom specialite
     C_GET_MY_PGR_CUR  C_GET_MY_PGR ( database(), this );
     while ( C_GET_MY_PGR.next( spe_name) )
           { html += tr("<br><b> C_GET_MY_PGR  </b>  ")
                     + " libelle : " + C_GET_MY_PGR.LIBELLE()
                     + " pdf     : " + C_GET_MY_PGR.PDF()
                     + " url     : " + C_GET_MY_PGR.URL()
                     + " date    : " + C_GET_MY_PGR.DATE("dd-MM-yyyy");
           }
 */
 class C_GET_MY_PGR_CUR :  public C_OCI_TO_QT_CUR
 {
     Q_OBJECT
 public:
     //............................. constructor ...............................
     C_GET_MY_PGR_CUR(QSqlDatabase db, QObject *parent) : C_OCI_TO_QT_CUR( db, parent ) { }
     //............................. extract datas ...............................
     int next(const QString &spe_name,  QString subActive_1="")
     {   int      pos   = -1;
         subActive_1    = subActive_1.replace("'","''");
         if ( isQueryExecToDo() ) //executer la sql_query que si besoin (premier passage ou fin des donnes)
            {  QString name   = spe_name;
               if ( (pos = name.indexOf(' ')) != -1 ) name = name.left(pos) ;  // couper au premier espace trouve dans le nom
               QString sql_query = "";
               sql_query        += " SELECT              "
                                   " my_sp_pgr_libelle,  "
                                   " my_sp_pgr_url,      "
                                   " my_sp_pgr_pdf       "
                                   " FROM    my_sp_pgr   "
                                   " WHERE   my_sp_pgr_libelle = '" + name        + "'";
               if  (subActive_1.length())
                   { sql_query +=  " OR      my_sp_pgr_libelle = '" + subActive_1 + "'";
                   }
               if  (exec (sql_query, QString("C_GET_MY_PGR_CUR()"), __LINE__ )==0) return 0;
         } // if ( isQueryExecToDo() )
         //...... extraire les donnees suivantes ................
         if ( C_OCI_TO_QT_CUR::next() )                // si donnees presentes on les extrait et retourne la position
            {  QString s_date   = "";
               m_LIBELLE        = value(0).toString();
               m_URL            = value(1).toString();
               m_PDF            = value(2).toString();
               if ( (pos        = m_URL.indexOf(')')) != -1 )
                  { s_date      = m_URL.left (pos).remove('(').remove(')');
                    m_URL       = m_URL.mid  (pos+1);
                    m_DATE      = QDate::fromString(s_date,"dd/MM/yyyy");
                  }
               return getPosition();
            }
         return resetCursor();                         // si donnees non presentes retourne 0
     } // end int next(const QString &codeEI, int typeInfo)

     //.......... access datas ............................................................
     QString LIBELLE()   {return m_LIBELLE;}
     QString URL()       {return m_URL;}
     QString PDF()       {return m_PDF;}
     QDate   DATE()      {return m_DATE;}
     QString DATE(const QString &format)    {return m_DATE.toString(format);}
  private:
     //.......... cursor datas ............................................................
     QString m_LIBELLE;
     QString m_URL;
     QString m_PDF;
     QDate   m_DATE;
 };

 //================================== C_GET_MY_MONO_INCACHE_CUR   -A15-   ==================================
 /***************************************************************************
 *   Nom           :  C_GET_MY_MONO_INCACHE_CUR
 -----------------------------------------------------------------------------
 *   Date creation : 22/06/2012
 -----------------------------------------------------------------------------
 *   Description   : cette procedure nous renvoie l'eventuelle monographie
 *                   presente dans le cache.
 ****************************************************************************/
 /*........................ usage .......................................
     C_GET_MY_MONO_INCACHE_CUR  C_GET_MY_MONO_INCACHE ( database(), this );
     while ( C_GET_MY_MONO_INCACHE.next( cip) )
           { html += tr("<br><b> C_GET_MY_MONO_INCACHE : </b>  ") + C_GET_MY_MONO_INCACHE.MONOGRAPHIE();
           }
 */
 class C_GET_MY_MONO_INCACHE_CUR :  public C_OCI_TO_QT_CUR
 {
     Q_OBJECT
 public:
     //............................. constructor ...............................
     C_GET_MY_MONO_INCACHE_CUR(QSqlDatabase db, QObject *parent) : C_OCI_TO_QT_CUR( db, parent ) { }
     //............................. extract datas ...............................
     int next(const QString &cip)
     {   m_MONOGRAPHIE = "";
         qDebug()<< QString("---------------- monographie cip : %1 --------------------").arg(cip );
         if ( isQueryExecToDo() )                                              //executer la sql_query que si besoin (premier passage ou fin des donnes)
            {  QString sql_query = "";
               sql_query        += " SELECT              "
                                   " my_cache_monographie_mono_No,"
                                   " my_cache_monographie_mono  "
                                   " FROM    my_cache_monographie   "
                                   " WHERE   my_cache_monographie_cip = '" + cip  + "'; //  ORDER BY my_cache_monographie_No ";
               if  (exec (sql_query, QString("C_GET_MY_MONO_INCACHE_CUR()"), __LINE__ )==0) return 0;
            } // if ( isQueryExecToDo() )
         //...... extraire les donnees suivantes ................
         while  ( C_OCI_TO_QT_CUR::next() )                // si donnees presentes on les extrait et retourne la position
                {  m_MONOGRAPHIE    += CGestIni::Utf8_Query(*this, 1); // value(1).toString(); //CGestIni::Utf8_Query(*this, 1);
                   qDebug()<< QString("°     Part : %1").arg( value(0).toString() );
                }
         resetCursor();                         // si donnees non presentes retourne 0
         return m_MONOGRAPHIE.length();
         qDebug()<< QString("length monographie : %1 ").arg(m_MONOGRAPHIE.length());
     } // end int next(const QString &codeEI, int typeInfo)

     //.......... access datas ............................................................
     QString MONOGRAPHIE()   {return m_MONOGRAPHIE;}
  private:
     //.......... cursor datas ............................................................
     QString m_MONOGRAPHIE;
 };

 //================================== C_SET_MY_MONO_INCACHE_CUR   -A16-   ==================================
 /***************************************************************************
 *   Nom           :  C_SET_MY_MONO_INCACHE_CUR
 -----------------------------------------------------------------------------
 *   Date creation : 22/06/2012
 -----------------------------------------------------------------------------
 *   Description   : cette procedure place dans le cache SQL la monographie
 ****************************************************************************/
 /*........................ usage .......................................
     C_SET_MY_MONO_INCACHE_CUR  C_SET_MY_MONO_INCACHE ( database(), this );
     if (C_SET_MY_MONO_INCACHE.setData(cip, html, owner, lang)==0) qDebug()<< "there is an error";
 */
 class C_SET_MY_MONO_INCACHE_CUR : public QObject, public QSqlQuery
 {
     Q_OBJECT
 public:
     //............................. constructor ...............................
     C_SET_MY_MONO_INCACHE_CUR(QSqlDatabase db, QObject *parent)
           : QObject(parent), QSqlQuery(db)
         { if (parent)
              {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                        parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
              }
         }
     //............................. set datas ...............................
     int setData(const QString &cip, const QString &html, int maxLenPaquet, const QString &owner="TH", const QString &lang = "fr")
     {       QString s_prepare   =    " INSERT INTO `my_cache_monographie` ( "
                                      " my_cache_monographie_owner,"     // 0
                                      " my_cache_monographie_lang,"      // 1
                                      " my_cache_monographie_mono_No,"   // 2
                                      " my_cache_monographie_cip,"       // 3
                                      " my_cache_monographie_mono "      // 4
                                     ") VALUES (?,?,?,?,?)";
             int numOrdre = 0;
             int pos      = 0;
             while (pos < html.length())
                { prepare(s_prepare);
                  bindValue(0,  owner);
                  bindValue(1,  lang) ;
                  bindValue(2,  QString::number(numOrdre) ) ;
                  bindValue(3,  cip) ;
                  bindValue(4,  html.mid(pos, maxLenPaquet)) ;
                  ++numOrdre;
                  pos += maxLenPaquet;
                  if ( !exec())
                     { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_SET_MY_MONO_INCACHE_CUR() </b></font>"), s_prepare, __FILE__, __LINE__  );
                       return 0;
                     }
                }
             return 1;
     } // end int setData(const QString &cip, const QString &html, const QString &owner="TH", const QString &lang = "fr")

 signals:
     void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

 };

 //================================== C_GET_PRISE_UNIT_FROM_CODE_ID_CUR   -A17-   ==================================
 /***************************************************************************
 *   Nom           :  C_GET_PRISE_UNIT_FROM_CODE_ID_CUR
 -----------------------------------------------------------------------------
 *   Date creation : 01/01/2013
 -----------------------------------------------------------------------------
 *   Description   : cette procedure retourne la forme des unites de prises
 *                   ainsi que les doses maxi et mini
 *                   selon le code theriaque CodeId
 ****************************************************************************/
 /*........................ usage .......................................
     C_GET_PRISE_UNIT_FROM_CODE_ID_CUR  C_GET_PRISE_UNIT_FROM_CODE_ID ( database(), this );
     while ( C_GET_PRISE_UNIT_FROM_CODE_ID.next( CodeId ) )
           { QString ret = QString ("NOFIC %1 \n NATURE %2 \n MINI %3 \n FORME %4 \n MAXI %5 \n").arg(
             C_GET_PRISE_UNIT_FROM_CODE_ID.NOFIC(),
             C_GET_PRISE_UNIT_FROM_CODE_ID.NATURE(),
             C_GET_PRISE_UNIT_FROM_CODE_ID.MINI(),
             C_GET_PRISE_UNIT_FROM_CODE_ID.FORME(),
             C_GET_PRISE_UNIT_FROM_CODE_ID.MAXI());
           }
 */
 class C_GET_PRISE_UNIT_FROM_CODE_ID_CUR :  public C_OCI_TO_QT_CUR
 {
     Q_OBJECT
 public:
     //............................. constructor ...............................
     C_GET_PRISE_UNIT_FROM_CODE_ID_CUR(QSqlDatabase db, QObject *parent) : C_OCI_TO_QT_CUR( db, parent ) { }
     //............................. extract datas ...............................
     int next(int CodeId)
     {
         if ( isQueryExecToDo() ) //executer la sql_query que si besoin (premier passage ou fin des donnes)
            {
              if  (exec (QString (" SELECT DISTINCT t1.IPO_FPO_CODE_FK_PK   AS NOFIC,   \n"    // 0
                                  " t2.CDF_NOM                              AS NATURE,  \n"    // 1
                                  " t1.IPO_DOSEMIN                          AS MINI,    \n"    // 2
                                  " t3.CDF_NOM                              AS FORME,   \n"    // 3
                                  " t1.IPO_DOSEMAX                          AS MAXI     \n"    // 4
                                  " FROM    ipo_infoposo t1, cdf_codif t2, cdf_codif t3, fposp_poso_spe t4 \n"
                                  " WHERE   t1.IPO_FPO_CODE_FK_PK       = t4.FPOSP_FPO_CODE_FK_PK          \n"
                                  " AND     t1.IPO_CDF_NAPO_CODE_FK     = t2.CDF_CODE_PK                   \n"
                                  " AND     t2.CDF_NUMERO_PK            = 'PN'                             \n"
                                  " AND     t1.IPO_CDF_UNPO_CODE_FK     = t3.CDF_CODE_PK                   \n"
                                  " AND     t3.CDF_NUMERO_PK            = 'PP'                             \n"
                                  " AND     (t1.IPO_DOSEMIN IS NOT NULL OR t1.IPO_DOSEMAX IS NOT NULL)     \n"
                                  " AND     t4.FPOSP_SP_CODE_FK_PK      = '%1'                             \n").arg(QString::number(CodeId)), "C_GET_PRISE_UNIT_FROM_CODE_ID_CUR()", __LINE__ )==0
                  ) return 0;
            }
         //...... extraire les donnees suivantes ................
         if ( C_OCI_TO_QT_CUR::next() )                // si donnees presentes on les extrait et retourne la position
            {  m_NOFIC             = value(0).toString();
               m_NATURE            = value(1).toString();
               m_MINI              = value(2).toString();
               m_FORME             = value(3).toString();
               m_MAXI              = value(4).toString();
               return getPosition();
            }
         return resetCursor();                         // si donnees non presentes retourne 0
     }
     //.......... access datas ...................
     QString NOFIC()                             {return m_NOFIC;}
     QString NATURE()                            {return m_NATURE;}
     QString MINI()                              {return m_MINI;}
     QString FORME()                             {return m_FORME;}
     QString MAXI()                              {return m_MAXI;}

  private:
     //.......... cursor datas ...................
     QString m_NOFIC;
     QString m_NATURE;
     QString m_MINI;
     QString m_FORME;
     QString m_MAXI;
 };

 //================================== C_GET_PRISE_FREQUENCE_FROM_CODE_ID_CUR   -A18-   ==================================
 /***************************************************************************
 *   Nom           :  C_GET_PRISE_FREQUENCE_FROM_CODE_ID_CUR
 -----------------------------------------------------------------------------
 *   Date creation : 01/01/2013
 -----------------------------------------------------------------------------
 *   Description   : cette procedure retourne la frequence Maxi et Mini des unites de prises
 *                   selon le code theriaque CodeId
 ****************************************************************************/
 /*........................ usage .......................................
     C_GET_PRISE_FREQUENCE_FROM_CODE_ID_CUR  C_GET_PRISE_FREQUENCE_FROM_CODE_ID ( database(), this );
     while ( C_GET_PRISE_FREQUENCE_FROM_CODE_ID.next( CodeId ) )
           { QString ret = QString ("NOFIC %1 \n MINI %2 \n INFOMINI %3 \n MAXI %4 \n INFOMAXI %5 \n").arg(
             C_GET_PRISE_FREQUENCE_FROM_CODE_ID.NOFIC(),
             C_GET_PRISE_FREQUENCE_CODE_ID.MINI(),
             C_GET_PRISE_FREQUENCE_CODE_ID.INFOMINI(),
             C_GET_PRISE_FREQUENCE_CODE_ID.MAXI());
             C_GET_PRISE_FREQUENCE_CODE_ID.INFOMAXI(),
           }
 */

 class C_GET_PRISE_FREQUENCE_FROM_CODE_ID_CUR :  public C_OCI_TO_QT_CUR
 {
     Q_OBJECT
 public:
     //............................. constructor ...............................
     C_GET_PRISE_FREQUENCE_FROM_CODE_ID_CUR(QSqlDatabase db, QObject *parent) : C_OCI_TO_QT_CUR( db, parent ) { }
     //............................. extract datas ...............................
     int next(int CodeId)
     {
         if ( isQueryExecToDo() ) //executer la sql_query que si besoin (premier passage ou fin des donnes)
            {
             if  (exec (QString (//--- frequence minimum et maximum"
                                 " SELECT DISTINCT t1.IPO_FPO_CODE_FK_PK   AS NOFIC,"
                                 " t1.IPO_FREQMIN                          AS MINI,"
                                 " t2.CDF_NOM                              AS INFO_02,"
                                 " t1.IPO_FREQMAX                          AS MAXI,"
                                 " t3.CDF_NOM                              AS INFO_03"
                                 " FROM    ipo_infoposo            t1,"
                                 " cdf_codif                       t2,"
                                 " cdf_codif                       t3,"
                                 " fposp_poso_spe                  t4"
                                 " WHERE   t1.IPO_FPO_CODE_FK_PK          = t4.FPOSP_FPO_CODE_FK_PK"
                                 " AND     t1.IPO_CDF_FREQMIN_CODE_FK     = t2.CDF_CODE_PK"
                                 " AND     t2.CDF_NUMERO_PK               = 'PF'"
                                 " AND     t1.IPO_CDF_FREQMAX_CODE_FK     = t3.CDF_CODE_PK"
                                 " AND     t3.CDF_NUMERO_PK               = 'PF'"
                                 " AND     (t1.IPO_FREQMIN IS NOT NULL OR t1.IPO_FREQMAX IS NOT NULL)"
                                 " AND     t4.FPOSP_SP_CODE_FK_PK          = '%1'").arg(QString::number(CodeId)), "C_GET_PRISE_FREQUENCE_FROM_CODE_ID_CUR()", __LINE__ )==0
                  ) return 0;
            }

         //...... extraire les donnees suivantes ................
         if ( C_OCI_TO_QT_CUR::next() )                // si donnees presentes on les extrait et retourne la position
            {  m_NOFIC             = value(0).toString();
               m_MINI              = value(1).toString();
               m_INFOMINI          = value(2).toString();
               m_MAXI              = value(3).toString();
               m_INFOMAXI          = value(4).toString();
               return getPosition();
            }
         return resetCursor();                         // si donnees non presentes retourne 0
     }
     //.......... access datas ...................
     QString NOFIC()                           {return m_NOFIC;}
     QString MINI()                            {return m_MINI;}
     QString INFOMINI()                        {return m_INFOMINI;}
     QString MAXI()                            {return m_MAXI;}
     QString INFOMAXI()                        {return m_INFOMAXI;}

  private:
     //.......... cursor datas ...................
     QString m_NOFIC;
     QString m_MINI;
     QString m_INFOMINI;
     QString m_MAXI;
     QString m_INFOMAXI;

 };

 //================================== C_GET_PRISE_DUREE_FROM_CODE_ID_CUR   -A19-   ==================================
 /***************************************************************************
 *   Nom           :  C_GET_PRISE_DUREE_FROM_CODE_ID_CUR
 -----------------------------------------------------------------------------
 *   Date creation : 01/01/2013
 -----------------------------------------------------------------------------
 *   Description   : cette procedure retourne la duree Maxi et Mini des unites de prises
 *                   selon le code theriaque CodeId
 ****************************************************************************/
 /*........................ usage .......................................
     C_GET_PRISE_DUREE_FROM_CODE_ID_CUR  C_GET_PRISE_DUREE_FROM_CODE_ID ( database(), this );
     while ( C_GET_PRISE_DUREE_FROM_CODE_ID.next( CodeId ) )
           { QString ret = QString ("NOFIC %1 \n MINI %2 \n INFOMINI %3 \n MAXI %4 \n INFOMAXI %5 \n").arg(
             C_GET_PRISE_DUREE_FROM_CODE_ID.NOFIC(),
             C_GET_PRISE_DUREE_FROM_CODE_ID.MINI(),
             C_GET_PRISE_DUREE_FROM_CODE_ID.INFOMINI(),
             C_GET_PRISE_DUREE_FROM_CODE_ID.MAXI());
             C_GET_PRISE_DUREE_FROM_CODE_ID.INFOMAXI(),
           }
 */

 class C_GET_PRISE_DUREE_FROM_CODE_ID_CUR :  public C_OCI_TO_QT_CUR
 {
     Q_OBJECT
 public:
     //............................. constructor ...............................
     C_GET_PRISE_DUREE_FROM_CODE_ID_CUR(QSqlDatabase db, QObject *parent) : C_OCI_TO_QT_CUR( db, parent ) { }
     //............................. extract datas ...............................
     int next(int CodeId)
     {
         if ( isQueryExecToDo() ) //executer la sql_query que si besoin (premier passage ou fin des donnes)
            {
             if  (exec (QString ( " "  //--- durée minimum et durée maximum"
                                  " SELECT DISTINCT t1.IPO_FPO_CODE_FK_PK  AS NOFIC,"
                                  " (t1.IPO_DUREEMIN)                      AS MINI, "  //-- removing TO_CHAR  may bee replace by ?  lpad(format(i, 0), 4, '0') ou CAST(nombre as char) "
                                  " t2.CDF_NOM                             AS INFO_01,"
                                  " (t1.IPO_DUREEMAX)                      AS MAXI, "  //-- removing TO_CHAR  may bee replace by ?  lpad(format(i, 0), 4, '0') ou CAST(nombre as char) "
                                  " t3.CDF_NOM                             AS INFO_02"
                                  " FROM    ipo_infoposo    t1,"
                                  " cdf_codif               t2,"
                                  " cdf_codif               t3,"
                                  " fposp_poso_spe          t4"
                                  " WHERE   t1.IPO_FPO_CODE_FK_PK          = t4.FPOSP_FPO_CODE_FK_PK"
                                  " AND     t1.IPO_CDF_UTMIN_CODE_FK       = t2.CDF_CODE_PK"
                                  " AND     t2.CDF_NUMERO_PK               = 'PU'"
                                  " AND     t1.IPO_CDF_UTMAX_CODE_FK       = t3.CDF_CODE_PK"
                                  " AND     t3.CDF_NUMERO_PK               = 'PU'"
                                  " AND     (t1.IPO_DUREEMIN IS NOT NULL OR t1.IPO_DUREEMAX IS NOT NULL)"
                                  " AND     t4.FPOSP_SP_CODE_FK_PK         = '%1'").arg(QString::number(CodeId)), "C_GET_PRISE_DUREE_FROM_CODE_ID_CUR()", __LINE__ )==0
                  ) return 0;
            }

         //...... extraire les donnees suivantes ................
         if ( C_OCI_TO_QT_CUR::next() )                // si donnees presentes on les extrait et retourne la position
            {  m_NOFIC             = value(0).toString();
               m_MINI              = value(1).toString();
               m_INFOMINI          = value(2).toString();
               m_MAXI              = value(3).toString();
               m_INFOMAXI          = value(4).toString();
               return getPosition();
            }
         return resetCursor();                         // si donnees non presentes retourne 0
     }
     //.......... access datas ...................
     QString NOFIC()                           {return m_NOFIC;}
     QString MINI()                            {return m_MINI;}
     QString INFOMINI()                        {return m_INFOMINI;}
     QString MAXI()                            {return m_MAXI;}
     QString INFOMAXI()                        {return m_INFOMAXI;}

  private:
     //.......... cursor datas ...................
     QString m_NOFIC;
     QString m_MINI;
     QString m_INFOMINI;
     QString m_MAXI;
     QString m_INFOMAXI;

 };
 //================================== C_GET_ATC_LIBELLE_CUR   -A20-   ==================================
 /***************************************************************************
 *   Nom           :  C_GET_ATC_LIBELLE_CUR
 -----------------------------------------------------------------------------
 *   Date creation : 01/02/2013
 -----------------------------------------------------------------------------
 *   Description   : cette procedure retourne le libelle ATC
 *                   selon le code ATC donne en entree
 ****************************************************************************/
 /*........................ usage .......................................
     C_GET_ATC_LIBELLE_CUR  C_GET_ATC_LIBELLE ( database(), this );
     while ( C_GET_ATC_LIBELLE.next( code ) )
           { QString ret = QString ("Libelle ATC %1 \n").arg( C_GET_ATC_LIBELLE.LIBELLE() );
           }
 */

 class C_GET_ATC_LIBELLE_CUR :  public C_OCI_TO_QT_CUR
 {
     Q_OBJECT
 public:
     //............................. constructor ...............................
     C_GET_ATC_LIBELLE_CUR(QSqlDatabase db, QObject *parent) : C_OCI_TO_QT_CUR( db, parent ) { }
     //............................. extract datas ...............................
     int next(const QString &code)
     {
         if ( isQueryExecToDo() ) //executer la sql_query que si besoin (premier passage ou fin des donnes)
            {
              if  (exec (QString (" SELECT CATC_NOMF, CATC_TEXTE FROM catc_classeatc  "
                                  " WHERE CATC_CODE_PK=\"%1\"").arg(code), "C_GET_ATC_LIBELLE_CUR()", __LINE__ )==0
                  ) return 0;
            }
         //...... extraire les donnees suivantes ................
         if ( C_OCI_TO_QT_CUR::next() )                // si donnees presentes on les extrait et retourne la position
            {  m_LIBELLE      = value(0).toString();
               m_TEXTE        = value(1).toString();
                    return getPosition();
            }
         return resetCursor();                         // si donnees non presentes retourne 0
     }
     //.......... access datas ...................
     QString LIBELLE()                       {return m_LIBELLE; }
     QString TEXTE()                         {return m_TEXTE;   }

  private:
     //.......... cursor datas ...................
     QString m_LIBELLE;
     QString m_TEXTE;
 };

 ///////////////////////////////////////////// CONVERSION OCI vers QT MYSQL //////////////////////////////////////////////////////////////
 //================================== C_GET_THE_INFOS_CUR   -1- ==================================
 /***************************************************************************
 *   Nom           :  GET_THE_INFOS
 -----------------------------------------------------------------------------
 *   Date creation : 04/07/2008
 -----------------------------------------------------------------------------
 *   Description   : cette procedure nous renvoie les informations concernant
 *                   la version et date de la base de donnees Theriaque
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_INFOS_CUR  C_GET_THE_INFOS ( database(), this );
      while ( C_GET_THE_INFOS.next( NA  ) )
            { html += tr("<br><b> GET_THE_INFOS : </b>  ") + C_GET_THE_INFOS.MEMBER();
            }
  */
  class C_GET_THE_INFOS_CUR : public QObject , public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_INFOS_CUR ---------------------
      C_GET_THE_INFOS_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( QString /*NA*/ )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............

 //+    SELECT dextr_ver_ther_pk   AS VERS,
 //+           dextr_date_extr_pk  AS DATE_EXT
 //+    FROM   DEXTR_DATE_EXTRACTION ;
                sql_query += " SELECT DEXTR_VER_THER_PK   AS VERS,"
                     " DEXTR_DATE_EXTR_PK  AS DATE_EXT"
                     " FROM   dextr_date_extraction ;";
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_INFOS() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_VERS     = value(0).toString();
                m_DATE_EXT = value(1).toDate();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      QString VERS()     {return m_VERS;}
      QDate   DATE_EXT() {return m_DATE_EXT;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      QString m_VERS;
      QDate   m_DATE_EXT;
 };

 //================================== C_GET_THE_SPE_TXT_CUR   -2- ==================================
 /***************************************************************************
 *   Nom           :  GET_THE_SPE_TXT
 -----------------------------------------------------------------------------
 *   Date creation : 04/07/2008
 -----------------------------------------------------------------------------
 *   Description   : cette procedure nous renvoie les fiche specialité selon le critere
 *                   de recherche qui est une partie du nom de medicament
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_SPE_TXT_CUR  C_GET_THE_SPE_TXT ( database(), this );
      while ( C_GET_THE_SPE_TXT.next( LIBPROD , MonoVir  ) )
            { html += tr("<br><b> GET_THE_SPE_TXT : </b>  ") + C_GET_THE_SPE_TXT.MEMBER();
            }
  */
  class C_GET_THE_SPE_TXT_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_SPE_TXT_CUR ---------------------
      C_GET_THE_SPE_TXT_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( QString LIBPROD , double MonoVir )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............
 //+SQL_QUERY := ' SELECT SP_CODE_SQ_PK, '||
 //+          ' SP_GSP_CODE_FK   ,       '||
 //+          ' A.CDF_NOM        AS STATUT_LAB , '||
 //+          ' B.CDF_NOM        AS SP_LISTE   , '||
 //+          ' SP_CATC_CODE_FK  ,    '||
 //+          ' SP_CEPH_CODE_FK  ,    '||
 //+          ' SP_CGE_CODE_FK   ,    '||
 //+          ' SP_PR_CODE_FK    ,    '||
 //+          ' SP_TYPE_SPE      ,    '||
 //+          ' SP_GREF_FK       ,    '||
 //+          ' SP_GREF_DATECR_FK,    '||
 //+          ' SP_NOM           ,    '||
 //+          ' SP_NOMCOMP       ,    '||
 //+          ' SP_PH            ,    '||
 //+          ' SP_CIPUCD        ,    '||
 //+          ' SP_DATECR        ,    '||
 //+          ' SP_DATEMJ        ,    '||
 //+          ' SP_NL            ,    '||
 //+          ' SP_APHP          ,    '||
 //+          ' SP_DATEJOGENE    ,    '||
 //+          ' SP_ORIGINE_GENE  ,    '||
 //+          ' SP_NOMLONG       ,    '||
 //+          ' SP_CDT_PRESCR_TEXTE,  '||
 //+          ' SP_ATC_DDD_TEXTE,     '||
 //+       ' SP_CIPUCD13,     '||
 //+       ' SP_MONO_VIRTUELLE AS MONO_VIR         '||
 //+     ' FROM   SP_SPECIALITE, CDF_CODIF A, CDF_CODIF B  '||
 //+     ' WHERE  SP_CDF_SLAB_CODE_FK = A.CDF_CODE_PK     '||
 //+    ' AND    SP_CDF_LI_CODE_FK = B.CDF_CODE_PK      '||
 //+    ' AND    A.CDF_NUMERO_PK = ''15''  '||
 //+    ' AND    B.CDF_NUMERO_PK = ''08'' '||
 //+    ' AND    UPPER(SP_NOM) LIKE TRIM(UPPER('''||LIBPROD||'''))';
                sql_query += " SELECT SP_CODE_SQ_PK,"
                     " SP_GSP_CODE_FK   ,"
                     " A.CDF_NOM        AS STATUT_LAB ,"
                     " B.CDF_NOM        AS SP_LISTE   ,"
                     " SP_CATC_CODE_FK  ,"
                     " SP_CEPH_CODE_FK  ,"
                     " SP_CGE_CODE_FK   ,"
                     " SP_PR_CODE_FK    ,"
                     " SP_TYPE_SPE      ,"
                     " SP_GREF_FK       ,"
                     " SP_GREF_DATECR_FK,"
                     " SP_NOM           ,"
                     " SP_NOMCOMP       ,"
                     " SP_PH            ,"
                     " SP_CIPUCD        ,"
                     " SP_DATECR        ,"
                     " SP_DATEMJ        ,"
                     " SP_NL            ,"
                     " SP_APHP          ,"
                     " SP_DATEJOGENE    ,"
                     " SP_ORIGINE_GENE  ,"
                     " SP_NOMLONG       ,"
                     " SP_CDT_PRESCR_TEXTE,"
                     " SP_ATC_DDD_TEXTE,"
                     " SP_CIPUCD13,"
                     " SP_MONO_VIRTUELLE AS MONO_VIR"
                     " FROM   sp_specialite, cdf_codif A, cdf_codif B"
                     " WHERE  SP_CDF_SLAB_CODE_FK = A.CDF_CODE_PK"
                     " AND    SP_CDF_LI_CODE_FK = B.CDF_CODE_PK"
                     " AND    A.CDF_NUMERO_PK = '15'"
                     " AND    B.CDF_NUMERO_PK = '08'"
                     " AND    UPPER(SP_NOM) LIKE TRIM(UPPER('"+LIBPROD+"')) ";


       if ( MonoVir == 0) {
 //+  SQL_QUERY := SQL_QUERY || ' AND (SP_MONO_VIRTUELLE = 0 OR SP_MONO_VIRTUELLE IS NULL) ORDER BY SP_NOM ASC ';
                sql_query += " AND (SP_MONO_VIRTUELLE = 0 OR SP_MONO_VIRTUELLE IS NULL) ORDER BY SP_NOM ASC;";

       } else if ( MonoVir == 1) {
 //+  SQL_QUERY := SQL_QUERY || ' AND SP_MONO_VIRTUELLE = 1 ORDER BY SP_NOM ASC ';
                sql_query += " AND SP_MONO_VIRTUELLE = 1 ORDER BY SP_NOM ASC;";

       } else {
 //+  SQL_QUERY := SQL_QUERY || ' ORDER BY SP_NOM ASC ';
                sql_query += " ORDER BY SP_NOM ASC;";

       }
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_SPE_TXT() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_SP_CODE_SQ_PK       = value(0).toDouble();
                m_SP_GSP_CODE_FK      = value(1).toDouble();
                m_STATUT_LAB          = value(2).toString();
                m_SP_LISTE            = value(3).toString();
                m_SP_CATC_CODE_FK     = value(4).toString();
                m_SP_CEPH_CODE_FK     = value(5).toString();
                m_SP_CGE_CODE_FK      = value(6).toDouble();
                m_SP_PR_CODE_FK       = value(7).toDouble();
                m_SP_TYPE_SPE         = value(8).toString();
                m_SP_GREF_FK          = value(9).toDouble();
                m_SP_GREF_DATECR_FK   = value(10).toDate();
                m_SP_NOM              = value(11).toString();
                m_SP_NOMCOMP          = value(12).toString();
                m_SP_PH               = value(13).toString();
                m_SP_CIPUCD           = value(14).toString();
                m_SP_DATECR           = value(15).toDate();
                m_SP_DATEMJ           = value(16).toDate();
                m_SP_NL               = value(17).toString();
                m_SP_APHP             = value(18).toString();
                m_SP_DATEJOGENE       = value(19).toDate();
                m_SP_ORIGINE_GENE     = value(20).toString();
                m_SP_NOMLONG          = value(21).toString();
                m_SP_CDT_PRESCR_TEXTE = value(22).toString();
                m_SP_ATC_DDD_TEXTE    = value(23).toString();
                m_SP_CIPUCD13         = value(24).toString();
                m_MONO_VIR            = value(25).toDouble();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      double  SP_CODE_SQ_PK()       {return m_SP_CODE_SQ_PK;}
      double  SP_GSP_CODE_FK()      {return m_SP_GSP_CODE_FK;}
      QString STATUT_LAB()          {return m_STATUT_LAB;}
      QString SP_LISTE()            {return m_SP_LISTE;}
      QString SP_CATC_CODE_FK()     {return m_SP_CATC_CODE_FK;}
      QString SP_CEPH_CODE_FK()     {return m_SP_CEPH_CODE_FK;}
      double  SP_CGE_CODE_FK()      {return m_SP_CGE_CODE_FK;}
      double  SP_PR_CODE_FK()       {return m_SP_PR_CODE_FK;}
      QString SP_TYPE_SPE()         {return m_SP_TYPE_SPE;}
      double  SP_GREF_FK()          {return m_SP_GREF_FK;}
      QDate   SP_GREF_DATECR_FK()   {return m_SP_GREF_DATECR_FK;}
      QString SP_NOM()              {return m_SP_NOM;}
      QString SP_NOMCOMP()          {return m_SP_NOMCOMP;}
      QString SP_PH()               {return m_SP_PH;}
      QString SP_CIPUCD()           {return m_SP_CIPUCD;}
      QDate   SP_DATECR()           {return m_SP_DATECR;}
      QDate   SP_DATEMJ()           {return m_SP_DATEMJ;}
      QString SP_NL()               {return m_SP_NL;}
      QString SP_APHP()             {return m_SP_APHP;}
      QDate   SP_DATEJOGENE()       {return m_SP_DATEJOGENE;}
      QString SP_ORIGINE_GENE()     {return m_SP_ORIGINE_GENE;}
      QString SP_NOMLONG()          {return m_SP_NOMLONG;}
      QString SP_CDT_PRESCR_TEXTE() {return m_SP_CDT_PRESCR_TEXTE;}
      QString SP_ATC_DDD_TEXTE()    {return m_SP_ATC_DDD_TEXTE;}
      QString SP_CIPUCD13()         {return m_SP_CIPUCD13;}
      double  MONO_VIR()            {return m_MONO_VIR;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      double  m_SP_CODE_SQ_PK;
      double  m_SP_GSP_CODE_FK;
      QString m_STATUT_LAB;
      QString m_SP_LISTE;
      QString m_SP_CATC_CODE_FK;
      QString m_SP_CEPH_CODE_FK;
      double  m_SP_CGE_CODE_FK;
      double  m_SP_PR_CODE_FK;
      QString m_SP_TYPE_SPE;
      double  m_SP_GREF_FK;
      QDate   m_SP_GREF_DATECR_FK;
      QString m_SP_NOM;
      QString m_SP_NOMCOMP;
      QString m_SP_PH;
      QString m_SP_CIPUCD;
      QDate   m_SP_DATECR;
      QDate   m_SP_DATEMJ;
      QString m_SP_NL;
      QString m_SP_APHP;
      QDate   m_SP_DATEJOGENE;
      QString m_SP_ORIGINE_GENE;
      QString m_SP_NOMLONG;
      QString m_SP_CDT_PRESCR_TEXTE;
      QString m_SP_ATC_DDD_TEXTE;
      QString m_SP_CIPUCD13;
      double  m_MONO_VIR;
 };

 //================================== C_GET_THE_SPECIALITE_CUR   -3- ==================================
 /***************************************************************************
 *   Nom           :  GET_THE_SPECIALITE
 -----------------------------------------------------------------------------
 *   Date creation : 07/07/2008
 -----------------------------------------------------------------------------
 *   Description   : cette procedure nous renvoie les fiche specialité selon un critere
 *                   de recherche bien determiné
 *   MAJ           : 28/10/2008
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_SPECIALITE_CUR  C_GET_THE_SPECIALITE ( database(), this );
      while ( C_GET_THE_SPECIALITE.next( CodeId , VarTyp , MonoVir  ) )
            { html += tr("<br><b> GET_THE_SPECIALITE : </b>  ") + C_GET_THE_SPECIALITE.MEMBER();
            }
  */
  class C_GET_THE_SPECIALITE_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_SPECIALITE_CUR ---------------------
      C_GET_THE_SPECIALITE_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( QString CodeId , double VarTyp=3 , double MonoVir= 0) // par defaut CodeId =3 code cip      MonoVir=0
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............
 //+--- VarTyp = 1 : recherche suivant le critere de l'Id theriaque

 //+--- VarTyp = 2 : recherche suivant le critere de code UCD

 //+--- VarTyp = 3 : recherche suivant le critere de code CIP

 //+--- VarTyp = 4 : recherche suivant le critere de laboratoire titulaire AMM

 //+--- VarTyp = 5 : recherche suivant le critere de laboratoire exploitant

 //+--- VarTyp = 6 : recherche suivant le critere de code fiche indication

 //+--- VarTyp = 7 : recherche suivant le critere de substance actif

 //+--- VarTyp = 8 : recherche suivant le critere de Exipient

 //+--- VarTyp = 9 : recherche suivant le critere de classe EPHMRA

 //+--- VarTyp = 10 : recherche suivant le critere de classe ATC

 //+--- VarTyp = 11 : recherche suivant le critere de classe Pharmaco therapeutique

 //+--- VarTyp = 12 : recherche suivant le critere de classe AP_HP

 //+--- VarTyp = 13 : recherche suivant le critere de classe Génerique theriaque

 //+--- VarTyp = 14 : recherche suivant le critere de classe Génerique Effssaps

 //+--- VarTyp = 15 : recherche suivant le critere de nom de specialité

 //+--- VarTyp = 16 : recherche suivant le critere de l'UCD13

 //+--- VarTyp = 17 : recherche suivant le code EAN

       if ( VarTyp == 1) {
 //+      SQL_QUERY := 'SELECT sp_code_sq_pk    , '||
 //+                ' sp_gsp_code_fk   , '||
 //+                ' A.CDF_NOM        AS STATUT_LABO , '||
 //+                ' B.CDF_NOM        AS SP_LISTE    , '||
 //+                ' sp_catc_code_fk  , '||
 //+                ' sp_ceph_code_fk  , '||
 //+                ' sp_cge_code_fk   , '||
 //+                ' sp_pr_code_fk    , '||
 //+                ' sp_type_spe      , '||
 //+                ' sp_gref_fk       , '||
 //+                ' sp_nom           , '||
 //+                ' sp_nomcomp       , '||
 //+                ' sp_ph            , '||
 //+                ' sp_cipucd        , '||
 //+                ' sp_datecr        , '||
 //+                ' sp_datemj        , '||
 //+                ' sp_nl            , '||
 //+                ' sp_aphp          , '||
 //+                ' sp_origine_gene  , '||
 //+                ' sp_nomlong  , '||
 //+       ' SP_CIPUCD13   ,   '||
 //+          ' SP_MONO_VIRTUELLE AS MONO_VIR  '||
 //+         ' FROM   SP_SPECIALITE, '||
 //+                ' CDF_CODIF A, '||
 //+                ' CDF_CODIF B  '||
 //+         ' WHERE  SP_CDF_SLAB_CODE_FK = A.CDF_CODE_PK '||
 //+         ' AND    SP_CDF_LI_CODE_FK   = B.CDF_CODE_PK '||
 //+         ' AND    A.CDF_NUMERO_PK     = ''15''  '||
 //+         ' AND    B.CDF_NUMERO_PK     = ''08''  '||
 //+         ' AND    SP_CODE_SQ_PK       = ' || CodeId ;
                sql_query += " SELECT SP_CODE_SQ_PK    ,"
                     " SP_GSP_CODE_FK   ,"
                     " A.CDF_NOM        AS STATUT_LABO ,"
                     " B.CDF_NOM        AS SP_LISTE    ,"
                     " SP_CATC_CODE_FK  ,"
                     " SP_CEPH_CODE_FK  ,"
                     " SP_CGE_CODE_FK   ,"
                     " SP_PR_CODE_FK    ,"
                     " SP_TYPE_SPE      ,"
                     " SP_GREF_FK       ,"
                     " SP_NOM           ,"
                     " SP_NOMCOMP       ,"
                     " SP_PH            ,"
                     " SP_CIPUCD        ,"
                     " SP_DATECR        ,"
                     " SP_DATEMJ        ,"
                     " SP_NL            ,"
                     " SP_APHP          ,"
                     " SP_ORIGINE_GENE  ,"
                     " SP_NOMLONG  ,"
                     " SP_CIPUCD13   ,"
                     " SP_MONO_VIRTUELLE AS MONO_VIR"
                     " FROM   sp_specialite,"
                     " cdf_codif A,"
                     " cdf_codif B"
                     " WHERE  SP_CDF_SLAB_CODE_FK = A.CDF_CODE_PK"
                     " AND    SP_CDF_LI_CODE_FK   = B.CDF_CODE_PK"
                     " AND    A.CDF_NUMERO_PK     = '15'"
                     " AND    B.CDF_NUMERO_PK     = '08'"
                     " AND    SP_CODE_SQ_PK       = '"+CodeId+"' ";

           if ( MonoVir == 0) {
 //+    SQL_QUERY := SQL_QUERY || ' AND (SP_MONO_VIRTUELLE = 0 OR SP_MONO_VIRTUELLE IS NULL) ORDER BY SP_NOM ASC ';
                sql_query += " AND (SP_MONO_VIRTUELLE = 0 OR SP_MONO_VIRTUELLE IS NULL) ORDER BY SP_NOM ASC ";

           } else if ( MonoVir == 1) {
 //+    SQL_QUERY := SQL_QUERY || ' AND SP_MONO_VIRTUELLE = 1 ORDER BY SP_NOM ASC ';
                sql_query += " AND SP_MONO_VIRTUELLE = 1 ORDER BY SP_NOM ASC ";

           } else {
 //+    SQL_QUERY := SQL_QUERY || ' ORDER BY SP_NOM ASC ';
                sql_query += " ORDER BY SP_NOM ASC ";

           }


       } else if ( VarTyp == 2) {
 //+      SQL_QUERY := 'SELECT SP_CODE_SQ_PK    ,  '||
 //+                ' SP_GSP_CODE_FK   ,  '||
 //+                ' A.CDF_NOM        AS STATUT_LABO ,  '||
 //+                ' B.CDF_NOM        AS SP_LISTE    , '||
 //+                ' SP_CATC_CODE_FK  ,   '||
 //+                ' SP_CEPH_CODE_FK  ,   '||
 //+                ' SP_CGE_CODE_FK   ,   '||
 //+                ' SP_PR_CODE_FK    ,  '||
 //+                ' SP_TYPE_SPE      ,  '||
 //+                ' SP_GREF_FK       ,   '||
 //+                ' SP_NOM           ,   '||
 //+                ' SP_NOMCOMP       ,   '||
 //+                ' SP_PH            ,   '||
 //+                ' SP_CIPUCD        ,  '||
 //+                ' SP_DATECR        ,   '||
 //+                ' SP_DATEMJ        ,  '||
 //+                ' SP_NL            ,  '||
 //+                ' SP_APHP          ,  '||
 //+                ' SP_ORIGINE_GENE  ,  '||
 //+                ' SP_NOMLONG  ,  '||
 //+       ' SP_CIPUCD13   , '||
 //+          ' SP_MONO_VIRTUELLE AS MONO_VIR    '||
 //+         ' FROM   SP_SPECIALITE,  '||
 //+                ' CDF_CODIF A,  '||
 //+                ' CDF_CODIF B  '||
 //+         ' WHERE  SP_CDF_SLAB_CODE_FK = A.CDF_CODE_PK '||
 //+         ' AND    SP_CDF_LI_CODE_FK   = B.CDF_CODE_PK '||
 //+         ' AND    A.CDF_NUMERO_PK     = ''15'' '||
 //+         ' AND    B.CDF_NUMERO_PK     = ''08'' '||
 //+         ' AND    SP_CIPUCD           = '''||CodeId||'''' ;
                sql_query += " SELECT SP_CODE_SQ_PK    ,"
                     " SP_GSP_CODE_FK   ,"
                     " A.CDF_NOM        AS STATUT_LABO ,"
                     " B.CDF_NOM        AS SP_LISTE    ,"
                     " SP_CATC_CODE_FK  ,"
                     " SP_CEPH_CODE_FK  ,"
                     " SP_CGE_CODE_FK   ,"
                     " SP_PR_CODE_FK    ,"
                     " SP_TYPE_SPE      ,"
                     " SP_GREF_FK       ,"
                     " SP_NOM           ,"
                     " SP_NOMCOMP       ,"
                     " SP_PH            ,"
                     " SP_CIPUCD        ,"
                     " SP_DATECR        ,"
                     " SP_DATEMJ        ,"
                     " SP_NL            ,"
                     " SP_APHP          ,"
                     " SP_ORIGINE_GENE  ,"
                     " SP_NOMLONG  ,"
                     " SP_CIPUCD13   ,"
                     " SP_MONO_VIRTUELLE AS MONO_VIR"
                     " FROM   sp_specialite,"
                     " cdf_codif A,"
                     " cdf_codif B"
                     " WHERE  SP_CDF_SLAB_CODE_FK = A.CDF_CODE_PK"
                     " AND    SP_CDF_LI_CODE_FK   = B.CDF_CODE_PK"
                     " AND    A.CDF_NUMERO_PK     = '15'"
                     " AND    B.CDF_NUMERO_PK     = '08'"
                     " AND    SP_CIPUCD           = '"+CodeId+"' ";


           if ( MonoVir == 0) {
 //+    SQL_QUERY := SQL_QUERY || ' AND (SP_MONO_VIRTUELLE = 0 OR SP_MONO_VIRTUELLE IS NULL) ORDER BY SP_NOM ASC ';
                sql_query += " AND (SP_MONO_VIRTUELLE = 0 OR SP_MONO_VIRTUELLE IS NULL) ORDER BY SP_NOM ASC ";

           } else if ( MonoVir == 1) {
 //+    SQL_QUERY := SQL_QUERY || ' AND SP_MONO_VIRTUELLE = 1 ORDER BY SP_NOM ASC ';
                sql_query += " AND SP_MONO_VIRTUELLE = 1 ORDER BY SP_NOM ASC ";

           } else {
 //+    SQL_QUERY := SQL_QUERY || ' ORDER BY SP_NOM ASC ';
                sql_query += " ORDER BY SP_NOM ASC ";

           }


       } else if ( VarTyp == 3) {
 //+   SQL_QUERY := 'SELECT SP_CODE_SQ_PK , '||
 //+               ' SP_GSP_CODE_FK , '||
 //+               ' A.CDF_NOM        AS STATUT_LABO , '||
 //+               ' B.CDF_NOM        AS SP_LISTE    , '||
 //+               ' SP_CATC_CODE_FK  , '||
 //+               ' SP_CEPH_CODE_FK  , '||
 //+               ' SP_CGE_CODE_FK   , '||
 //+               ' SP_PR_CODE_FK    , '||
 //+               ' SP_TYPE_SPE      , '||
 //+               ' SP_GREF_FK       , '||
 //+               ' SP_NOM           , '||
 //+               ' SP_NOMCOMP       , '||
 //+               ' SP_PH            , '||
 //+               ' SP_CIPUCD        , '||
 //+               ' SP_DATECR        , '||
 //+               ' SP_DATEMJ        , '||
 //+               ' SP_NL            , '||
 //+               ' SP_APHP          , '||
 //+               ' SP_ORIGINE_GENE  , '||
 //+               ' SP_NOMLONG  , '||
 //+      ' SP_CIPUCD13     , '||
 //+         ' SP_MONO_VIRTUELLE AS MONO_VIR '||
 //+        ' FROM   SP_SPECIALITE, '||
 //+               ' CDF_CODIF A, '||
 //+               ' CDF_CODIF B, '||
 //+               ' PRE_PRESENTATION '||
 //+        ' WHERE  SP_CDF_SLAB_CODE_FK = A.CDF_CODE_PK '||
 //+        ' AND    SP_CDF_LI_CODE_FK   = B.CDF_CODE_PK '||
 //+        ' AND    A.CDF_NUMERO_PK     = ''15'' '||
 //+        ' AND    B.CDF_NUMERO_PK     = ''08'' '||
 //+        ' AND    PRE_SP_CODE_FK      = SP_CODE_SQ_PK '||
 //+        ' AND    PRE_CODE_PK         =  '''||CodeId||'''';
                sql_query +=
                     " SELECT SP_CODE_SQ_PK ,"
                     " SP_GSP_CODE_FK ,"
                     " A.CDF_NOM        AS STATUT_LABO ,"
                     " B.CDF_NOM        AS SP_LISTE    ,"
                     " SP_CATC_CODE_FK  ,"
                     " SP_CEPH_CODE_FK  ,"
                     " SP_CGE_CODE_FK   ,"
                     " SP_PR_CODE_FK    ,"
                     " SP_TYPE_SPE      ,"
                     " SP_GREF_FK       ,"
                     " SP_NOM           ,"
                     " SP_NOMCOMP       ,"
                     " SP_PH            ,"
                     " SP_CIPUCD        ,"
                     " SP_DATECR        ,"
                     " SP_DATEMJ        ,"
                     " SP_NL            ,"
                     " SP_APHP          ,"
                     " SP_ORIGINE_GENE  ,"
                     " SP_NOMLONG  ,"
                     " SP_CIPUCD13     ,"
                     " SP_MONO_VIRTUELLE AS MONO_VIR"
                     " FROM   sp_specialite,"
                     " cdf_codif A,"
                     " cdf_codif B,"
                     " pre_presentation"
                     " WHERE  SP_CDF_SLAB_CODE_FK = A.CDF_CODE_PK"
                     " AND    SP_CDF_LI_CODE_FK   = B.CDF_CODE_PK"
                     " AND    A.CDF_NUMERO_PK     = '15'"
                     " AND    B.CDF_NUMERO_PK     = '08'"
                     " AND    PRE_SP_CODE_FK      = SP_CODE_SQ_PK"
                     " AND    PRE_CODE_PK         =  '"+CodeId+"' ";


           if ( MonoVir == 0) {
 //+    SQL_QUERY := SQL_QUERY || ' AND (SP_MONO_VIRTUELLE = 0 OR SP_MONO_VIRTUELLE IS NULL) ORDER BY SP_NOM ASC ';
                sql_query += " AND (SP_MONO_VIRTUELLE = 0 OR SP_MONO_VIRTUELLE IS NULL) ORDER BY SP_NOM ASC ";

           } else if ( MonoVir == 1) {
 //+    SQL_QUERY := SQL_QUERY || ' AND SP_MONO_VIRTUELLE = 1 ORDER BY SP_NOM ASC ';
                sql_query += " AND SP_MONO_VIRTUELLE = 1 ORDER BY SP_NOM ASC ";

           } else {
 //+    SQL_QUERY := SQL_QUERY || ' ORDER BY SP_NOM ASC ';
                sql_query += " ORDER BY SP_NOM ASC ";

           }

       } else if ( VarTyp == 4) {
 //+   SQL_QUERY := 'SELECT SP_CODE_SQ_PK,  '||
 //+               ' SP_GSP_CODE_FK   , '||
 //+               ' A.CDF_NOM        AS STATUT_LABO , '||
 //+               ' B.CDF_NOM        AS SP_LISTE    ,'||
 //+               ' SP_CATC_CODE_FK  , '||
 //+               ' SP_CEPH_CODE_FK  ,'||
 //+               ' SP_CGE_CODE_FK   , '||
 //+               ' SP_PR_CODE_FK    , '||
 //+               ' SP_TYPE_SPE      , '||
 //+               ' SP_GREF_FK       , '||
 //+               ' SP_NOM           ,'||
 //+               ' SP_NOMCOMP       , '||
 //+               ' SP_PH            , '||
 //+               ' SP_CIPUCD        ,'||
 //+               ' SP_DATECR        , '||
 //+               ' SP_DATEMJ        ,'||
 //+               ' SP_NL            ,'||
 //+               ' SP_APHP          ,'||
 //+               ' SP_ORIGINE_GENE  ,'||
 //+               ' SP_NOMLONG  ,'||
 //+      ' SP_CIPUCD13   ,'||
 //+         ' SP_MONO_VIRTUELLE AS MONO_VIR '||
 //+        ' FROM   SP_SPECIALITE,'||
 //+               ' CDF_CODIF A, '||
 //+               ' CDF_CODIF B,'||
 //+               ' SPLAB_SPECIALITE_LABO '||
 //+        ' WHERE  SP_CDF_SLAB_CODE_FK      = A.CDF_CODE_PK '||
 //+        ' AND    SP_CDF_LI_CODE_FK        = B.CDF_CODE_PK '||
 //+        ' AND    A.CDF_NUMERO_PK          = ''15'' '||
 //+        ' AND    B.CDF_NUMERO_PK          = ''08'' '||
 //+        ' AND    SPLAB_SP_CODE_FK_PK      = SP_CODE_SQ_PK '||
 //+        ' AND    SPLAB_CDF_LAB_CODE_FK_PK = '''||CodeId||'''';
                sql_query += " SELECT SP_CODE_SQ_PK,"
                     " SP_GSP_CODE_FK   ,"
                     " A.CDF_NOM        AS STATUT_LABO ,"
                     " B.CDF_NOM        AS SP_LISTE    ,"
                     " SP_CATC_CODE_FK  ,"
                     " SP_CEPH_CODE_FK  ,"
                     " SP_CGE_CODE_FK   ,"
                     " SP_PR_CODE_FK    ,"
                     " SP_TYPE_SPE      ,"
                     " SP_GREF_FK       ,"
                     " SP_NOM           ,"
                     " SP_NOMCOMP       ,"
                     " SP_PH            ,"
                     " SP_CIPUCD        ,"
                     " SP_DATECR        ,"
                     " SP_DATEMJ        ,"
                     " SP_NL            ,"
                     " SP_APHP          ,"
                     " SP_ORIGINE_GENE  ,"
                     " SP_NOMLONG  ,"
                     " SP_CIPUCD13   ,"
                     " SP_MONO_VIRTUELLE AS MONO_VIR"
                     " FROM   sp_specialite,"
                     " cdf_codif A,"
                     " cdf_codif B,"
                     " splab_specialite_labo"
                     " WHERE  SP_CDF_SLAB_CODE_FK      = A.CDF_CODE_PK"
                     " AND    SP_CDF_LI_CODE_FK        = B.CDF_CODE_PK"
                     " AND    A.CDF_NUMERO_PK          = '15'"
                     " AND    B.CDF_NUMERO_PK          = '08'"
                     " AND    SPLAB_SP_CODE_FK_PK      = SP_CODE_SQ_PK"
                     " AND    SPLAB_CDF_LAB_CODE_FK_PK = '"+CodeId+"' ";


           if ( MonoVir == 0) {
 //+    SQL_QUERY := SQL_QUERY || ' AND (SP_MONO_VIRTUELLE = 0 OR SP_MONO_VIRTUELLE IS NULL) ORDER BY SP_NOM ASC ';
                sql_query += " AND (SP_MONO_VIRTUELLE = 0 OR SP_MONO_VIRTUELLE IS NULL) ORDER BY SP_NOM ASC ";

           } else if ( MonoVir == 1) {
 //+    SQL_QUERY := SQL_QUERY || ' AND SP_MONO_VIRTUELLE = 1 ORDER BY SP_NOM ASC ';
                sql_query += " AND SP_MONO_VIRTUELLE = 1 ORDER BY SP_NOM ASC ";

           } else {
 //+    SQL_QUERY := SQL_QUERY || ' ORDER BY SP_NOM ASC ';
                sql_query += " ORDER BY SP_NOM ASC ";

           }

       } else if ( VarTyp == 5) {
 //+   SQL_QUERY := 'SELECT SP_CODE_SQ_PK    , '||
 //+               ' SP_GSP_CODE_FK   , '||
 //+               ' A.CDF_NOM        AS STATUT_LABO , '||
 //+               ' B.CDF_NOM        AS SP_LISTE , '||
 //+               ' SP_CATC_CODE_FK  , '||
 //+               ' SP_CEPH_CODE_FK  , '||
 //+               ' SP_CGE_CODE_FK   , '||
 //+               ' SP_PR_CODE_FK    , '||
 //+               ' SP_TYPE_SPE      , '||
 //+               ' SP_GREF_FK       ,  '||
 //+               ' SP_NOM           ,  '||
 //+               ' SP_NOMCOMP       ,  '||
 //+               ' SP_PH            , '||
 //+               ' SP_CIPUCD        , '||
 //+               ' SP_DATECR        , '||
 //+               ' SP_DATEMJ        ,  '||
 //+               ' SP_NL            ,  '||
 //+               ' SP_APHP          ,  '||
 //+               ' SP_ORIGINE_GENE  ,  '||
 //+               ' SP_NOMLONG  , '||
 //+      ' SP_CIPUCD13   , '||
 //+         ' SP_MONO_VIRTUELLE AS MONO_VIR '||
 //+        ' FROM   SP_SPECIALITE,  '||
 //+               ' CDF_CODIF A,  '||
 //+               ' CDF_CODIF B,  '||
 //+               ' SPLABEX_SPE_LABO_EXPLOITANT '||
 //+        ' WHERE  SP_CDF_SLAB_CODE_FK        = A.CDF_CODE_PK  '||
 //+        ' AND    SP_CDF_LI_CODE_FK          = B.CDF_CODE_PK '||
 //+        ' AND    A.CDF_NUMERO_PK            = ''15''  '||
 //+        ' AND    B.CDF_NUMERO_PK            = ''08''  '||
 //+        ' AND    SPLABEX_SP_CODE_FK_PK      = SP_CODE_SQ_PK '||
 //+        ' AND    SPLABEX_CDF_LAB_CODE_FK_PK = '''||CodeId||'''';
                sql_query += " SELECT SP_CODE_SQ_PK    ,"
                     " SP_GSP_CODE_FK   ,"
                     " A.CDF_NOM        AS STATUT_LABO ,"
                     " B.CDF_NOM        AS SP_LISTE ,"
                     " SP_CATC_CODE_FK  ,"
                     " SP_CEPH_CODE_FK  ,"
                     " SP_CGE_CODE_FK   ,"
                     " SP_PR_CODE_FK    ,"
                     " SP_TYPE_SPE      ,"
                     " SP_GREF_FK       ,"
                     " SP_NOM           ,"
                     " SP_NOMCOMP       ,"
                     " SP_PH            ,"
                     " SP_CIPUCD        ,"
                     " SP_DATECR        ,"
                     " SP_DATEMJ        ,"
                     " SP_NL            ,"
                     " SP_APHP          ,"
                     " SP_ORIGINE_GENE  ,"
                     " SP_NOMLONG  ,"
                     " SP_CIPUCD13   ,"
                     " SP_MONO_VIRTUELLE AS MONO_VIR"
                     " FROM   sp_specialite,"
                     " cdf_codif A,"
                     " cdf_codif B,"
                     " splabex_spe_labo_exploitant"
                     " WHERE  SP_CDF_SLAB_CODE_FK        = A.CDF_CODE_PK"
                     " AND    SP_CDF_LI_CODE_FK          = B.CDF_CODE_PK"
                     " AND    A.CDF_NUMERO_PK            = '15'"
                     " AND    B.CDF_NUMERO_PK            = '08'"
                     " AND    SPLABEX_SP_CODE_FK_PK      = SP_CODE_SQ_PK"
                     " AND    SPLABEX_CDF_LAB_CODE_FK_PK = '"+CodeId+"' ";


           if ( MonoVir == 0) {
 //+    SQL_QUERY := SQL_QUERY || ' AND (SP_MONO_VIRTUELLE = 0 OR SP_MONO_VIRTUELLE IS NULL) ORDER BY SP_NOM ASC ';
                sql_query += " AND (SP_MONO_VIRTUELLE = 0 OR SP_MONO_VIRTUELLE IS NULL) ORDER BY SP_NOM ASC ";

           } else if ( MonoVir == 1) {
 //+    SQL_QUERY := SQL_QUERY || ' AND SP_MONO_VIRTUELLE = 1 ORDER BY SP_NOM ASC ';
                sql_query += " AND SP_MONO_VIRTUELLE = 1 ORDER BY SP_NOM ASC ";

           } else {
 //+    SQL_QUERY := SQL_QUERY || ' ORDER BY SP_NOM ASC ';
                sql_query += " ORDER BY SP_NOM ASC ";

           }

       } else if ( VarTyp == 6) {
 //+   SQL_QUERY := 'SELECT SP_CODE_SQ_PK   , '||
 //+               ' SP_GSP_CODE_FK   , '||
 //+               ' A.CDF_NOM        AS STATUT_LABO , '||
 //+               ' B.CDF_NOM        AS SP_LISTE    , '||
 //+               ' SP_CATC_CODE_FK  , '||
 //+               ' SP_CEPH_CODE_FK  , '||
 //+               ' SP_CGE_CODE_FK   , '||
 //+               ' SP_PR_CODE_FK    , '||
 //+               ' SP_TYPE_SPE      , '||
 //+               ' SP_GREF_FK       , '||
 //+               ' SP_NOM           , '||
 //+               ' SP_NOMCOMP       , '||
 //+               ' SP_PH            , '||
 //+               ' SP_CIPUCD        , '||
 //+               ' SP_DATECR        , '||
 //+               ' SP_DATEMJ        , '||
 //+               ' SP_NL            , '||
 //+               ' SP_APHP          , '||
 //+               ' SP_ORIGINE_GENE  , '||
 //+               ' SP_NOMLONG  , '||
 //+      ' SP_CIPUCD13   , '||
 //+         ' SP_MONO_VIRTUELLE AS MONO_VIR '||
 //+        ' FROM   SP_SPECIALITE, '||
 //+               ' CDF_CODIF A,  '||
 //+               ' CDF_CODIF B, '||
 //+               ' FINSP_INDSPE '||
 //+        ' WHERE  SP_CDF_SLAB_CODE_FK  = A.CDF_CODE_PK '||
 //+        ' AND    SP_CDF_LI_CODE_FK    = B.CDF_CODE_PK '||
 //+        ' AND    A.CDF_NUMERO_PK      = ''15'' '||
 //+        ' AND    B.CDF_NUMERO_PK      = ''08'' '||
 //+        ' AND    FINSP_SP_CODE_FK_PK  = SP_CODE_SQ_PK '||
 //+        ' AND    FINSP_FIN_CODE_FK_PK = ' ||CodeId;
                sql_query += " SELECT SP_CODE_SQ_PK   ,"
                     " SP_GSP_CODE_FK   ,"
                     " A.CDF_NOM        AS STATUT_LABO ,"
                     " B.CDF_NOM        AS SP_LISTE    ,"
                     " SP_CATC_CODE_FK  ,"
                     " SP_CEPH_CODE_FK  ,"
                     " SP_CGE_CODE_FK   ,"
                     " SP_PR_CODE_FK    ,"
                     " SP_TYPE_SPE      ,"
                     " SP_GREF_FK       ,"
                     " SP_NOM           ,"
                     " SP_NOMCOMP       ,"
                     " SP_PH            ,"
                     " SP_CIPUCD        ,"
                     " SP_DATECR        ,"
                     " SP_DATEMJ        ,"
                     " SP_NL            ,"
                     " SP_APHP          ,"
                     " SP_ORIGINE_GENE  ,"
                     " SP_NOMLONG  ,"
                     " SP_CIPUCD13   ,"
                     " SP_MONO_VIRTUELLE AS MONO_VIR"
                     " FROM   sp_specialite,"
                     " cdf_codif A,"
                     " cdf_codif B,"
                     " finsp_indspe"
                     " WHERE  SP_CDF_SLAB_CODE_FK  = A.CDF_CODE_PK"
                     " AND    SP_CDF_LI_CODE_FK    = B.CDF_CODE_PK"
                     " AND    A.CDF_NUMERO_PK      = '15'"
                     " AND    B.CDF_NUMERO_PK      = '08'"
                     " AND    FINSP_SP_CODE_FK_PK  = SP_CODE_SQ_PK"
                     " AND    FINSP_FIN_CODE_FK_PK = '"+CodeId+"' ";

           if ( MonoVir == 0) {
 //+    SQL_QUERY := SQL_QUERY || ' AND (SP_MONO_VIRTUELLE = 0 OR SP_MONO_VIRTUELLE IS NULL) ORDER BY SP_NOM ASC ';
                sql_query += " AND (SP_MONO_VIRTUELLE = 0 OR SP_MONO_VIRTUELLE IS NULL) ORDER BY SP_NOM ASC ";

           } else if ( MonoVir == 1) {
 //+    SQL_QUERY := SQL_QUERY || ' AND SP_MONO_VIRTUELLE = 1 ORDER BY SP_NOM ASC ';
                sql_query += " AND SP_MONO_VIRTUELLE = 1 ORDER BY SP_NOM ASC ";

           } else {
 //+    SQL_QUERY := SQL_QUERY || ' ORDER BY SP_NOM ASC ';
                sql_query += " ORDER BY SP_NOM ASC ";

           }

       } else if ( VarTyp == 7) {
 //+   SQL_QUERY := 'SELECT SP_CODE_SQ_PK   , '||
 //+               ' SP_GSP_CODE_FK   , '||
 //+               ' A.CDF_NOM  AS STATUT_LABO  , '||
 //+               ' B.CDF_NOM  AS SP_LISTE     , '||
 //+               ' SP_CATC_CODE_FK  , '||
 //+               ' SP_CEPH_CODE_FK  , '||
 //+               ' SP_CGE_CODE_FK   , '||
 //+               ' SP_PR_CODE_FK    , '||
 //+               ' SP_TYPE_SPE      , '||
 //+               ' SP_GREF_FK       , '||
 //+               ' SP_NOM           , '||
 //+               ' SP_NOMCOMP       , '||
 //+               ' SP_PH            , '||
 //+               ' SP_CIPUCD        , '||
 //+               ' SP_DATECR        , '||
 //+               ' SP_DATEMJ        , '||
 //+               ' SP_NL            , '||
 //+               ' SP_APHP          , '||
 //+               ' SP_ORIGINE_GENE  , '||
 //+               ' SP_NOMLONG  , '||
 //+      ' SP_CIPUCD13   , '||
 //+         ' SP_MONO_VIRTUELLE AS MONO_VIR  '||
 //+        ' FROM   SP_SPECIALITE,'||
 //+               ' CDF_CODIF A,  '||
 //+               ' CDF_CODIF B,  '||
 //+               ' COSAC_COMPO_SUBACT '||
 //+        ' WHERE  COSAC_SP_CODE_FK_PK  = SP_CODE_SQ_PK '||
 //+        ' AND    SP_CDF_SLAB_CODE_FK  = A.CDF_CODE_PK '||
 //+        ' AND    SP_CDF_LI_CODE_FK    = B.CDF_CODE_PK '||
 //+        ' AND    A.CDF_NUMERO_PK      = ''15'' '||
 //+        ' AND    B.CDF_NUMERO_PK      = ''08'' '||
 //+        ' AND    COSAC_SAC_CODE_FK_PK = ' || CodeId;
                sql_query += " SELECT SP_CODE_SQ_PK   ,"
                     " SP_GSP_CODE_FK   ,"
                     " A.CDF_NOM  AS STATUT_LABO  ,"
                     " B.CDF_NOM  AS SP_LISTE     ,"
                     " SP_CATC_CODE_FK  ,"
                     " SP_CEPH_CODE_FK  ,"
                     " SP_CGE_CODE_FK   ,"
                     " SP_PR_CODE_FK    ,"
                     " SP_TYPE_SPE      ,"
                     " SP_GREF_FK       ,"
                     " SP_NOM           ,"
                     " SP_NOMCOMP       ,"
                     " SP_PH            ,"
                     " SP_CIPUCD        ,"
                     " SP_DATECR        ,"
                     " SP_DATEMJ        ,"
                     " SP_NL            ,"
                     " SP_APHP          ,"
                     " SP_ORIGINE_GENE  ,"
                     " SP_NOMLONG  ,"
                     " SP_CIPUCD13   ,"
                     " SP_MONO_VIRTUELLE AS MONO_VIR"
                     " FROM   sp_specialite,"
                     " cdf_codif A,"
                     " cdf_codif B,"
                     " cosac_compo_subact"
                     " WHERE  COSAC_SP_CODE_FK_PK  = SP_CODE_SQ_PK"
                     " AND    SP_CDF_SLAB_CODE_FK  = A.CDF_CODE_PK"
                     " AND    SP_CDF_LI_CODE_FK    = B.CDF_CODE_PK"
                     " AND    A.CDF_NUMERO_PK      = '15'"
                     " AND    B.CDF_NUMERO_PK      = '08'"
                     " AND    COSAC_SAC_CODE_FK_PK = '"+CodeId+"' ";


           if ( MonoVir == 0) {
 //+    SQL_QUERY := SQL_QUERY || ' AND (SP_MONO_VIRTUELLE = 0 OR SP_MONO_VIRTUELLE IS NULL) ORDER BY SP_NOM ASC ';
                sql_query += " AND (SP_MONO_VIRTUELLE = 0 OR SP_MONO_VIRTUELLE IS NULL) ORDER BY SP_NOM ASC ";

           } else if ( MonoVir == 1) {
 //+    SQL_QUERY := SQL_QUERY || ' AND SP_MONO_VIRTUELLE = 1 ORDER BY SP_NOM ASC ';
                sql_query += " AND SP_MONO_VIRTUELLE = 1 ORDER BY SP_NOM ASC ";

           } else {
 //+    SQL_QUERY := SQL_QUERY || ' ORDER BY SP_NOM ASC ';
                sql_query += " ORDER BY SP_NOM ASC ";

           }

       } else if ( VarTyp == 8) {
 //+   SQL_QUERY := 'SELECT SP_CODE_SQ_PK    , '||
 //+               ' SP_GSP_CODE_FK   , '||
 //+               ' A.CDF_NOM        AS STATUT_LABO , '||
 //+               ' B.CDF_NOM        AS SP_LISTE    , '||
 //+               ' SP_CATC_CODE_FK  , '||
 //+               ' SP_CEPH_CODE_FK  , '||
 //+               ' SP_CGE_CODE_FK   , '||
 //+               ' SP_PR_CODE_FK    , '||
 //+               ' SP_TYPE_SPE      , '||
 //+               ' SP_GREF_FK       , '||
 //+               ' SP_NOM           , '||
 //+               ' SP_NOMCOMP       , '||
 //+               ' SP_PH            , '||
 //+               ' SP_CIPUCD        , '||
 //+               ' SP_DATECR        , '||
 //+               ' SP_DATEMJ        , '||
 //+               ' SP_NL            , '||
 //+               ' SP_APHP          , '||
 //+               ' SP_ORIGINE_GENE  , '||
 //+               ' SP_NOMLONG  , '||
 //+      ' SP_CIPUCD13   , '||
 //+         ' SP_MONO_VIRTUELLE AS MONO_VIR   '||
 //+        ' FROM   SP_SPECIALITE, '||
 //+               ' CDF_CODIF A,  '||
 //+               ' CDF_CODIF B '||
 //+        ' WHERE  SP_CDF_SLAB_CODE_FK = A.CDF_CODE_PK  '||
 //+        ' AND    SP_CDF_LI_CODE_FK   = B.CDF_CODE_PK '||
 //+        ' AND    A.CDF_NUMERO_PK     = ''15'' '||
 //+        ' AND    B.CDF_NUMERO_PK     = ''08'' '||
 //+        ' AND    SP_CODE_SQ_PK IN (SELECT DISTINCT COSAU_SP_CODE_FK_PK '||
 //+                                 ' FROM   COSAU_COMPO_SUBAUX '||
 //+                                 ' WHERE  COSAU_SAU_CODE_FK_PK = '||CodeId||')';
                sql_query += " SELECT SP_CODE_SQ_PK    ,"
                     " SP_GSP_CODE_FK   ,"
                     " A.CDF_NOM        AS STATUT_LABO ,"
                     " B.CDF_NOM        AS SP_LISTE    ,"
                     " SP_CATC_CODE_FK  ,"
                     " SP_CEPH_CODE_FK  ,"
                     " SP_CGE_CODE_FK   ,"
                     " SP_PR_CODE_FK    ,"
                     " SP_TYPE_SPE      ,"
                     " SP_GREF_FK       ,"
                     " SP_NOM           ,"
                     " SP_NOMCOMP       ,"
                     " SP_PH            ,"
                     " SP_CIPUCD        ,"
                     " SP_DATECR        ,"
                     " SP_DATEMJ        ,"
                     " SP_NL            ,"
                     " SP_APHP          ,"
                     " SP_ORIGINE_GENE  ,"
                     " SP_NOMLONG  ,"
                     " SP_CIPUCD13   ,"
                     " SP_MONO_VIRTUELLE AS MONO_VIR"
                     " FROM   sp_specialite,"
                     " cdf_codif A,"
                     " cdf_codif B"
                     " WHERE  SP_CDF_SLAB_CODE_FK = A.CDF_CODE_PK"
                     " AND    SP_CDF_LI_CODE_FK   = B.CDF_CODE_PK"
                     " AND    A.CDF_NUMERO_PK     = '15'"
                     " AND    B.CDF_NUMERO_PK     = '08'"
                     " AND    SP_CODE_SQ_PK IN (SELECT DISTINCT COSAU_SP_CODE_FK_PK"
                     " FROM   cosau_compo_subaux"
                     " WHERE  COSAU_SAU_CODE_FK_PK = '"+CodeId+"') ";

           if ( MonoVir == 0) {
 //+     SQL_QUERY := SQL_QUERY || ' AND (SP_MONO_VIRTUELLE = 0 OR SP_MONO_VIRTUELLE IS NULL) ORDER BY SP_NOM ASC ';
                sql_query += " AND (SP_MONO_VIRTUELLE = 0 OR SP_MONO_VIRTUELLE IS NULL) ORDER BY SP_NOM ASC ";

           } else if ( MonoVir == 1) {
 //+     SQL_QUERY := SQL_QUERY || ' AND SP_MONO_VIRTUELLE = 1 ORDER BY SP_NOM ASC ';
                sql_query += " AND SP_MONO_VIRTUELLE = 1 ORDER BY SP_NOM ASC ";

           } else {
 //+     SQL_QUERY := SQL_QUERY || ' ORDER BY SP_NOM ASC ';
                sql_query += " ORDER BY SP_NOM ASC ";

           }


       } else if ( VarTyp == 9) {
 //+   SQL_QUERY := 'SELECT SP_CODE_SQ_PK , '||
 //+               ' SP_GSP_CODE_FK , '||
 //+               ' A.CDF_NOM AS STATUT_LABO , '||
 //+               ' B.CDF_NOM AS SP_LISTE    , '||
 //+               ' SP_CATC_CODE_FK  , '||
 //+               ' SP_CEPH_CODE_FK  , '||
 //+               ' SP_CGE_CODE_FK   , '||
 //+               ' SP_PR_CODE_FK    , '||
 //+               ' SP_TYPE_SPE      , '||
 //+               ' SP_GREF_FK       , '||
 //+               ' SP_NOM           , '||
 //+               ' SP_NOMCOMP       , '||
 //+               ' SP_PH            , '||
 //+               ' SP_CIPUCD        , '||
 //+               ' SP_DATECR        , '||
 //+               ' SP_DATEMJ        , '||
 //+               ' SP_NL            , '||
 //+               ' SP_APHP          , '||
 //+               ' SP_ORIGINE_GENE  , '||
 //+               ' SP_NOMLONG  , '||
 //+      ' SP_CIPUCD13   , '||
 //+         ' SP_MONO_VIRTUELLE AS MONO_VIR  '||
 //+        ' FROM   SP_SPECIALITE, '||
 //+               ' CDF_CODIF A,   '||
 //+               ' CDF_CODIF B    '||
 //+        ' WHERE  SP_CDF_SLAB_CODE_FK = A.CDF_CODE_PK '||
 //+        ' AND    SP_CDF_LI_CODE_FK   = B.CDF_CODE_PK '||
 //+        ' AND    A.CDF_NUMERO_PK     = ''15'' '||
 //+        ' AND    B.CDF_NUMERO_PK     = ''08'' '||
 //+        ' AND    SP_CEPH_CODE_FK LIKE TRIM(UPPER('''||CodeId||'%''))';
                sql_query += " SELECT SP_CODE_SQ_PK ,"
                     " SP_GSP_CODE_FK ,"
                     " A.CDF_NOM AS STATUT_LABO ,"
                     " B.CDF_NOM AS SP_LISTE    ,"
                     " SP_CATC_CODE_FK  ,"
                     " SP_CEPH_CODE_FK  ,"
                     " SP_CGE_CODE_FK   ,"
                     " SP_PR_CODE_FK    ,"
                     " SP_TYPE_SPE      ,"
                     " SP_GREF_FK       ,"
                     " SP_NOM           ,"
                     " SP_NOMCOMP       ,"
                     " SP_PH            ,"
                     " SP_CIPUCD        ,"
                     " SP_DATECR        ,"
                     " SP_DATEMJ        ,"
                     " SP_NL            ,"
                     " SP_APHP          ,"
                     " SP_ORIGINE_GENE  ,"
                     " SP_NOMLONG  ,"
                     " SP_CIPUCD13   ,"
                     " SP_MONO_VIRTUELLE AS MONO_VIR"
                     " FROM   sp_specialite,"
                     " cdf_codif A,"
                     " cdf_codif B"
                     " WHERE  SP_CDF_SLAB_CODE_FK = A.CDF_CODE_PK"
                     " AND    SP_CDF_LI_CODE_FK   = B.CDF_CODE_PK"
                     " AND    A.CDF_NUMERO_PK     = '15'"
                     " AND    B.CDF_NUMERO_PK     = '08'"
                     " AND    SP_CEPH_CODE_FK LIKE TRIM(UPPER('"+CodeId+"'%')) ";


           if ( MonoVir == 0) {
 //+     SQL_QUERY := SQL_QUERY || ' AND (SP_MONO_VIRTUELLE = 0 OR SP_MONO_VIRTUELLE IS NULL) ORDER BY SP_NOM ASC ';
                sql_query += " AND (SP_MONO_VIRTUELLE = 0 OR SP_MONO_VIRTUELLE IS NULL) ORDER BY SP_NOM ASC ";

           } else if ( MonoVir == 1) {
 //+     SQL_QUERY := SQL_QUERY || ' AND SP_MONO_VIRTUELLE = 1 ORDER BY SP_NOM ASC ';
                sql_query += " AND SP_MONO_VIRTUELLE = 1 ORDER BY SP_NOM ASC ";

           } else {
 //+     SQL_QUERY := SQL_QUERY || ' ORDER BY SP_NOM ASC ';
                sql_query += " ORDER BY SP_NOM ASC ";

           }

       } else if ( VarTyp == 10) {
 //+      SQL_QUERY := 'SELECT SP_CODE_SQ_PK    , '||
 //+                ' SP_GSP_CODE_FK   , '||
 //+                ' A.CDF_NOM        AS STATUT_LABO  , '||
 //+                ' B.CDF_NOM        AS SP_LISTE     , '||
 //+                ' SP_CATC_CODE_FK  , '||
 //+                ' SP_CEPH_CODE_FK  , '||
 //+                ' SP_CGE_CODE_FK   , '||
 //+                ' SP_PR_CODE_FK    , '||
 //+                ' SP_TYPE_SPE      , '||
 //+                ' SP_GREF_FK       , '||
 //+                ' SP_NOM           , '||
 //+                ' SP_NOMCOMP       , '||
 //+                ' SP_PH            , '||
 //+                ' SP_CIPUCD        , '||
 //+                ' SP_DATECR        , '||
 //+                ' SP_DATEMJ        , '||
 //+                ' SP_NL            , '||
 //+                ' SP_APHP          , '||
 //+                ' SP_ORIGINE_GENE  , '||
 //+                ' SP_NOMLONG  , '||
 //+       ' SP_CIPUCD13     , '||
 //+          ' SP_MONO_VIRTUELLE AS MONO_VIR '||
 //+         ' FROM   SP_SPECIALITE,  '||
 //+                ' CDF_CODIF A,  '||
 //+                ' CDF_CODIF B '||
 //+         ' WHERE  SP_CDF_SLAB_CODE_FK = A.CDF_CODE_PK  '||
 //+         ' AND    SP_CDF_LI_CODE_FK   = B.CDF_CODE_PK '||
 //+         ' AND    A.CDF_NUMERO_PK     = ''15''  '||
 //+         ' AND    B.CDF_NUMERO_PK     = ''08'' '||
 //+         ' AND    SP_CATC_CODE_FK LIKE '''||CodeId||'''';
                sql_query += " SELECT SP_CODE_SQ_PK    ,"
                     " SP_GSP_CODE_FK   ,"
                     " A.CDF_NOM        AS STATUT_LABO  ,"
                     " B.CDF_NOM        AS SP_LISTE     ,"
                     " SP_CATC_CODE_FK  ,"
                     " SP_CEPH_CODE_FK  ,"
                     " SP_CGE_CODE_FK   ,"
                     " SP_PR_CODE_FK    ,"
                     " SP_TYPE_SPE      ,"
                     " SP_GREF_FK       ,"
                     " SP_NOM           ,"
                     " SP_NOMCOMP       ,"
                     " SP_PH            ,"
                     " SP_CIPUCD        ,"
                     " SP_DATECR        ,"
                     " SP_DATEMJ        ,"
                     " SP_NL            ,"
                     " SP_APHP          ,"
                     " SP_ORIGINE_GENE  ,"
                     " SP_NOMLONG  ,"
                     " SP_CIPUCD13     ,"
                     " SP_MONO_VIRTUELLE AS MONO_VIR"
                     " FROM   sp_specialite,"
                     " cdf_codif A,"
                     " cdf_codif B"
                     " WHERE  SP_CDF_SLAB_CODE_FK = A.CDF_CODE_PK"
                     " AND    SP_CDF_LI_CODE_FK   = B.CDF_CODE_PK"
                     " AND    A.CDF_NUMERO_PK     = '15'"
                     " AND    B.CDF_NUMERO_PK     = '08'"
                     " AND    SP_CATC_CODE_FK LIKE '"+CodeId+"' ";


           if ( MonoVir == 0) {
 //+     SQL_QUERY := SQL_QUERY || ' AND (SP_MONO_VIRTUELLE = 0 OR SP_MONO_VIRTUELLE IS NULL) ORDER BY SP_NOM ASC ';
                sql_query += " AND (SP_MONO_VIRTUELLE = 0 OR SP_MONO_VIRTUELLE IS NULL) ORDER BY SP_NOM ASC ";

           } else if ( MonoVir == 1) {
 //+     SQL_QUERY := SQL_QUERY || ' AND SP_MONO_VIRTUELLE = 1 ORDER BY SP_NOM ASC ';
                sql_query += " AND SP_MONO_VIRTUELLE = 1 ORDER BY SP_NOM ASC ";

           } else {
 //+     SQL_QUERY := SQL_QUERY || ' ORDER BY SP_NOM ASC ';
                sql_query += " ORDER BY SP_NOM ASC ";

           }

       } else if ( VarTyp == 11) {
 //+      SQL_QUERY := 'SELECT SP_CODE_SQ_PK    , '||
 //+                ' SP_GSP_CODE_FK   , '||
 //+                ' A.CDF_NOM AS STATUT_LABO, '||
 //+                ' B.CDF_NOM AS SP_LISTE   , '||
 //+                ' SP_CATC_CODE_FK  , '||
 //+                ' SP_CEPH_CODE_FK  , '||
 //+                ' SP_CGE_CODE_FK   , '||
 //+                ' SP_PR_CODE_FK    , '||
 //+                ' SP_TYPE_SPE      , '||
 //+                ' SP_GREF_FK       , '||
 //+                ' SP_NOM           , '||
 //+                ' SP_NOMCOMP       , '||
 //+                ' SP_PH            , '||
 //+                ' SP_CIPUCD        , '||
 //+                ' SP_DATECR        , '||
 //+                ' SP_DATEMJ        , '||
 //+                ' SP_NL            , '||
 //+                ' SP_APHP          , '||
 //+                ' SP_ORIGINE_GENE  , '||
 //+                ' SP_NOMLONG  , '||
 //+       ' SP_CIPUCD13   , '||
 //+          ' SP_MONO_VIRTUELLE AS MONO_VIR '||
 //+         ' FROM   SP_SPECIALITE,  '||
 //+                ' CDF_CODIF A,  '||
 //+                ' CDF_CODIF B, '||
 //+                ' SPCPH_SPECIALITE_CLASSEPH '||
 //+         ' WHERE  SP_CDF_SLAB_CODE_FK  = A.CDF_CODE_PK  '||
 //+         ' AND    SP_CDF_LI_CODE_FK    = B.CDF_CODE_PK '||
 //+         ' AND    A.CDF_NUMERO_PK      = ''15'' '||
 //+         ' AND    B.CDF_NUMERO_PK      = ''08'' '||
 //+         ' AND    SP_CODE_SQ_PK        = SPCPH_SP_CODE_FK_PK '||
 //+         ' AND    SPCPH_CPH_CODE_FK_PK = TRIM(UPPER('''||CodeId||'''))';
                sql_query += " SELECT SP_CODE_SQ_PK    ,"
                     " SP_GSP_CODE_FK   ,"
                     " A.CDF_NOM AS STATUT_LABO,"
                     " B.CDF_NOM AS SP_LISTE   ,"
                     " SP_CATC_CODE_FK  ,"
                     " SP_CEPH_CODE_FK  ,"
                     " SP_CGE_CODE_FK   ,"
                     " SP_PR_CODE_FK    ,"
                     " SP_TYPE_SPE      ,"
                     " SP_GREF_FK       ,"
                     " SP_NOM           ,"
                     " SP_NOMCOMP       ,"
                     " SP_PH            ,"
                     " SP_CIPUCD        ,"
                     " SP_DATECR        ,"
                     " SP_DATEMJ        ,"
                     " SP_NL            ,"
                     " SP_APHP          ,"
                     " SP_ORIGINE_GENE  ,"
                     " SP_NOMLONG  ,"
                     " SP_CIPUCD13   ,"
                     " SP_MONO_VIRTUELLE AS MONO_VIR"
                     " FROM   sp_specialite,"
                     " cdf_codif A,"
                     " cdf_codif B,"
                     " spcph_specialite_classeph"
                     " WHERE  SP_CDF_SLAB_CODE_FK  = A.CDF_CODE_PK"
                     " AND    SP_CDF_LI_CODE_FK    = B.CDF_CODE_PK"
                     " AND    A.CDF_NUMERO_PK      = '15'"
                     " AND    B.CDF_NUMERO_PK      = '08'"
                     " AND    SP_CODE_SQ_PK        = SPCPH_SP_CODE_FK_PK"
                     " AND    SPCPH_CPH_CODE_FK_PK = TRIM(UPPER('"+CodeId+"')) ";

           if ( MonoVir == 0) {
 //+     SQL_QUERY := SQL_QUERY || ' AND (SP_MONO_VIRTUELLE = 0 OR SP_MONO_VIRTUELLE IS NULL) ORDER BY SP_NOM ASC ';
                sql_query += " AND (SP_MONO_VIRTUELLE = 0 OR SP_MONO_VIRTUELLE IS NULL) ORDER BY SP_NOM ASC ";

           } else if ( MonoVir == 1) {
 //+     SQL_QUERY := SQL_QUERY || ' AND SP_MONO_VIRTUELLE = 1 ORDER BY SP_NOM ASC ';
                sql_query += " AND SP_MONO_VIRTUELLE = 1 ORDER BY SP_NOM ASC ";

           } else {
 //+     SQL_QUERY := SQL_QUERY || ' ORDER BY SP_NOM ASC ';
                sql_query += " ORDER BY SP_NOM ASC ";

           }

       } else if ( VarTyp == 12) {
 //+   SQL_QUERY := 'SELECT SP_CODE_SQ_PK    , '||
 //+               ' SP_GSP_CODE_FK   , '||
 //+               ' A.CDF_NOM        AS STATUT_LABO , '||
 //+               ' B.CDF_NOM        AS SP_LISTE    , '||
 //+               ' SP_CATC_CODE_FK  , '||
 //+               ' SP_CEPH_CODE_FK  , '||
 //+               ' SP_CGE_CODE_FK   , '||
 //+               ' SP_PR_CODE_FK    , '||
 //+               ' SP_TYPE_SPE      , '||
 //+               ' SP_GREF_FK       , '||
 //+               ' SP_NOM           , '||
 //+               ' SP_NOMCOMP       , '||
 //+               ' SP_PH            , '||
 //+               ' SP_CIPUCD        , '||
 //+               ' SP_DATECR        , '||
 //+               ' SP_DATEMJ        , '||
 //+               ' SP_NL            , '||
 //+               ' SP_APHP          , '||
 //+               ' SP_ORIGINE_GENE  , '||
 //+               ' SP_NOMLONG  , '||
 //+      ' SP_CIPUCD13   , '||
 //+         ' SP_MONO_VIRTUELLE AS MONO_VIR  '||
 //+        ' FROM   SP_SPECIALITE,  '||
 //+               ' CDF_CODIF A, '||
 //+               ' CDF_CODIF B '||
 //+        ' WHERE  SP_CDF_SLAB_CODE_FK = A.CDF_CODE_PK  '||
 //+        ' AND    SP_CDF_LI_CODE_FK   = B.CDF_CODE_PK '||
 //+        ' AND    A.CDF_NUMERO_PK     = ''15''  '||
 //+        ' AND    B.CDF_NUMERO_PK     = ''08'' '||
 //+        ' AND    SP_CGE_CODE_FK      = '||CodeId;
                sql_query += " SELECT SP_CODE_SQ_PK    ,"
                     " SP_GSP_CODE_FK   ,"
                     " A.CDF_NOM        AS STATUT_LABO ,"
                     " B.CDF_NOM        AS SP_LISTE    ,"
                     " SP_CATC_CODE_FK  ,"
                     " SP_CEPH_CODE_FK  ,"
                     " SP_CGE_CODE_FK   ,"
                     " SP_PR_CODE_FK    ,"
                     " SP_TYPE_SPE      ,"
                     " SP_GREF_FK       ,"
                     " SP_NOM           ,"
                     " SP_NOMCOMP       ,"
                     " SP_PH            ,"
                     " SP_CIPUCD        ,"
                     " SP_DATECR        ,"
                     " SP_DATEMJ        ,"
                     " SP_NL            ,"
                     " SP_APHP          ,"
                     " SP_ORIGINE_GENE  ,"
                     " SP_NOMLONG  ,"
                     " SP_CIPUCD13   ,"
                     " SP_MONO_VIRTUELLE AS MONO_VIR"
                     " FROM   sp_specialite,"
                     " cdf_codif A,"
                     " cdf_codif B"
                     " WHERE  SP_CDF_SLAB_CODE_FK = A.CDF_CODE_PK"
                     " AND    SP_CDF_LI_CODE_FK   = B.CDF_CODE_PK"
                     " AND    A.CDF_NUMERO_PK     = '15'"
                     " AND    B.CDF_NUMERO_PK     = '08'"
                     " AND    SP_CGE_CODE_FK      = '"+CodeId+"' ";

           if ( MonoVir == 0) {
 //+    SQL_QUERY := SQL_QUERY || ' AND (SP_MONO_VIRTUELLE = 0 OR SP_MONO_VIRTUELLE IS NULL) ORDER BY SP_NOM ASC ';
                sql_query += " AND (SP_MONO_VIRTUELLE = 0 OR SP_MONO_VIRTUELLE IS NULL) ORDER BY SP_NOM ASC ";

           } else if ( MonoVir == 1) {
 //+    SQL_QUERY := SQL_QUERY || ' AND SP_MONO_VIRTUELLE = 1 ORDER BY SP_NOM ASC ';
                sql_query += " AND SP_MONO_VIRTUELLE = 1 ORDER BY SP_NOM ASC ";

           } else {
 //+    SQL_QUERY := SQL_QUERY || ' ORDER BY SP_NOM ASC ';
                sql_query += " ORDER BY SP_NOM ASC ";

           }

       } else if ( VarTyp == 13) {
 //+   SQL_QUERY := 'SELECT A.SP_CODE_SQ_PK, '||
 //+                ' A.SP_GSP_CODE_FK,  '||
 //+                ' C.CDF_NOM         AS STATUT_LABO , '||
 //+                ' D.CDF_NOM         AS SP_LISTE ,  '||
 //+                ' A.SP_CATC_CODE_FK, '||
 //+                ' A.SP_CEPH_CODE_FK, '||
 //+                ' A.SP_CGE_CODE_FK, '||
 //+                ' A.SP_PR_CODE_FK, '||
 //+                ' A.SP_TYPE_SPE, '||
 //+                ' A.SP_GREF_FK, '||
 //+                ' A.SP_NOM, '||
 //+                ' A.SP_NOMCOMP, '||
 //+                ' A.SP_PH,  '||
 //+                ' A.SP_CIPUCD, '||
 //+                ' A.SP_DATECR, '||
 //+                ' A.SP_DATEMJ,  '||
 //+                ' A.SP_NL,  '||
 //+                ' A.SP_APHP,  '||
 //+                ' A.SP_ORIGINE_GENE, '||
 //+                ' A.SP_NOMLONG  , '||
 //+       ' A.SP_CIPUCD13   , '||
 //+          ' A.SP_MONO_VIRTUELLE AS MONO_VIR '||
 //+         ' FROM   SP_SPECIALITE A, '||
 //+                ' SP_SPECIALITE B, '||
 //+                ' CDF_CODIF C, '||
 //+                ' CDF_CODIF D '||
 //+         ' WHERE  B.SP_GSP_CODE_FK      = A.SP_GSP_CODE_FK '||
 //+         ' AND    A.SP_CDF_SLAB_CODE_FK = C.CDF_CODE_PK '||
 //+         ' AND    A.SP_CDF_LI_CODE_FK   = D.CDF_CODE_PK '||
 //+         ' AND    C.CDF_NUMERO_PK = ''15'' '||
 //+         ' AND    D.CDF_NUMERO_PK = ''08'' '||
 //+         ' AND    B.SP_CODE_SQ_PK = ' || CodeId;
                sql_query += " SELECT A.SP_CODE_SQ_PK,"
                     " A.SP_GSP_CODE_FK,"
                     " C.CDF_NOM         AS STATUT_LABO ,"
                     " D.CDF_NOM         AS SP_LISTE ,"
                     " A.SP_CATC_CODE_FK,"
                     " A.SP_CEPH_CODE_FK,"
                     " A.SP_CGE_CODE_FK,"
                     " A.SP_PR_CODE_FK,"
                     " A.SP_TYPE_SPE,"
                     " A.SP_GREF_FK,"
                     " A.SP_NOM,"
                     " A.SP_NOMCOMP,"
                     " A.SP_PH,"
                     " A.SP_CIPUCD,"
                     " A.SP_DATECR,"
                     " A.SP_DATEMJ,"
                     " A.SP_NL,"
                     " A.SP_APHP,"
                     " A.SP_ORIGINE_GENE,"
                     " A.SP_NOMLONG  ,"
                     " A.SP_CIPUCD13   ,"
                     " A.SP_MONO_VIRTUELLE AS MONO_VIR"
                     " FROM   sp_specialite A,"
                     " sp_specialite B,"
                     " cdf_codif C,"
                     " cdf_codif D"
                     " WHERE  B.SP_GSP_CODE_FK      = A.SP_GSP_CODE_FK"
                     " AND    A.SP_CDF_SLAB_CODE_FK = C.CDF_CODE_PK"
                     " AND    A.SP_CDF_LI_CODE_FK   = D.CDF_CODE_PK"
                     " AND    C.CDF_NUMERO_PK = '15'"
                     " AND    D.CDF_NUMERO_PK = '08'"
                     " AND    B.SP_CODE_SQ_PK = '"+CodeId+"' ";


           if ( MonoVir == 0) {
 //+    SQL_QUERY := SQL_QUERY || ' AND (B.SP_MONO_VIRTUELLE = 0 OR B.SP_MONO_VIRTUELLE IS NULL) ORDER BY A.SP_NOM ASC ';
                sql_query += " AND (B.SP_MONO_VIRTUELLE = 0 OR B.SP_MONO_VIRTUELLE IS NULL) ORDER BY A.SP_NOM ASC ";

           } else if ( MonoVir == 1) {
 //+    SQL_QUERY := SQL_QUERY || ' AND B.SP_MONO_VIRTUELLE = 1 ORDER BY A.SP_NOM ASC ';
                sql_query += " AND B.SP_MONO_VIRTUELLE = 1 ORDER BY A.SP_NOM ASC ";

           } else {
 //+    SQL_QUERY := SQL_QUERY || ' ORDER BY A.SP_NOM ASC ';
                sql_query += " ORDER BY A.SP_NOM ASC ";

           }

       } else if ( VarTyp == 14) {
 //+   SQL_QUERY := 'SELECT B.SP_CODE_SQ_PK, '||
 //+                ' B.SP_GSP_CODE_FK,'||
 //+                ' C.CDF_NOM AS STATUT_LABO ,'||
 //+                ' D.CDF_NOM AS SP_LISTE    ,'||
 //+                ' B.SP_CATC_CODE_FK,'||
 //+                ' B.SP_CEPH_CODE_FK,'||
 //+                ' B.SP_CGE_CODE_FK,'||
 //+                ' B.SP_PR_CODE_FK, '||
 //+                ' B.SP_TYPE_SPE,'||
 //+                ' B.SP_GREF_FK, '||
 //+                ' B.SP_NOM, '||
 //+                ' B.SP_NOMCOMP, '||
 //+                ' B.SP_PH, '||
 //+                ' B.SP_CIPUCD,'||
 //+                ' B.SP_DATECR,'||
 //+                ' B.SP_DATEMJ,'||
 //+                ' B.SP_NL,'||
 //+                ' B.SP_APHP, '||
 //+                ' B.SP_ORIGINE_GENE,'||
 //+                ' B.SP_NOMLONG,'||
 //+       ' B.SP_CIPUCD13 ,'||
 //+          ' B.SP_MONO_VIRTUELLE AS MONO_VIR'||
 //+     ' FROM SPGREFG_GROUPE_SPE_GENE, '||
 //+            ' SP_SPECIALITE B,'||
 //+            ' SP_SPECIALITE A,'||
 //+            ' CDF_CODIF C, '||
 //+            ' CDF_CODIF D '||
 //+     ' WHERE SPGREFG_SP_CODE_FK_PK     = B.SP_CODE_SQ_PK '||
 //+     ' AND  B.SP_CDF_SLAB_CODE_FK     = C.CDF_CODE_PK '||
 //+     ' AND  B.SP_CDF_LI_CODE_FK       = D.CDF_CODE_PK '||
 //+     ' AND  C.CDF_NUMERO_PK           = ''15''  '||
 //+     ' AND  D.CDF_NUMERO_PK           = ''08'' '||
 //+     ' AND  SPGREFG_GREF_CODE_FK_PK   = B.SP_GREF_FK '||
 //+     ' AND  SPGREFG_GREF_DATECR_FK_PK = B.SP_GREF_DATECR_FK '||
 //+     ' AND  SPGREFG_DATESG  IS NULL '||
 //+     ' AND  SPGREFG_GREF_CODE_FK_PK   = A.SP_GREF_FK '||
 //+     ' AND  A.SP_CODE_SQ_PK           = '||CodeId;
                sql_query += " SELECT B.SP_CODE_SQ_PK,"
                     " B.SP_GSP_CODE_FK,"
                     " C.CDF_NOM AS STATUT_LABO ,"
                     " D.CDF_NOM AS SP_LISTE    ,"
                     " B.SP_CATC_CODE_FK,"
                     " B.SP_CEPH_CODE_FK,"
                     " B.SP_CGE_CODE_FK,"
                     " B.SP_PR_CODE_FK,"
                     " B.SP_TYPE_SPE,"
                     " B.SP_GREF_FK,"
                     " B.SP_NOM,"
                     " B.SP_NOMCOMP,"
                     " B.SP_PH,"
                     " B.SP_CIPUCD,"
                     " B.SP_DATECR,"
                     " B.SP_DATEMJ,"
                     " B.SP_NL,"
                     " B.SP_APHP,"
                     " B.SP_ORIGINE_GENE,"
                     " B.SP_NOMLONG,"
                     " B.SP_CIPUCD13 ,"
                     " B.SP_MONO_VIRTUELLE AS MONO_VIR"
                     " FROM spgrefg_groupe_spe_gene,"
                     " sp_specialite B,"
                     " sp_specialite A,"
                     " cdf_codif C,"
                     " cdf_codif D"
                     " WHERE SPGREFG_SP_CODE_FK_PK     = B.SP_CODE_SQ_PK"
                     " AND  B.SP_CDF_SLAB_CODE_FK     = C.CDF_CODE_PK"
                     " AND  B.SP_CDF_LI_CODE_FK       = D.CDF_CODE_PK"
                     " AND  C.CDF_NUMERO_PK           = '15'"
                     " AND  D.CDF_NUMERO_PK           = '08'"
                     " AND  SPGREFG_GREF_CODE_FK_PK   = B.SP_GREF_FK"
                     " AND  SPGREFG_GREF_DATECR_FK_PK = B.SP_GREF_DATECR_FK"
                     " AND  SPGREFG_DATESG  IS NULL"
                     " AND  SPGREFG_GREF_CODE_FK_PK   = A.SP_GREF_FK"
                     " AND  A.SP_CODE_SQ_PK           = '"+CodeId+"' ";

           if ( MonoVir == 0) {
 //+    SQL_QUERY := SQL_QUERY || ' AND (A.SP_MONO_VIRTUELLE = 0 OR A.SP_MONO_VIRTUELLE IS NULL)';
                sql_query += " AND (A.SP_MONO_VIRTUELLE = 0 OR A.SP_MONO_VIRTUELLE IS NULL) ";

           } else if ( MonoVir == 1) {
 //+    SQL_QUERY := SQL_QUERY || ' AND A.SP_MONO_VIRTUELLE = 1 ';
                sql_query += " AND A.SP_MONO_VIRTUELLE = 1 ";

           }
 //+   SQL_QUERY := SQL_QUERY || ' UNION '||
                sql_query += " UNION";

 //+    ' SELECT  B.SP_CODE_SQ_PK, '||
 //+                 ' B.SP_GSP_CODE_FK,  '||
 //+                 ' C.CDF_NOM         AS STATUT_LABO , '||
 //+                 ' D.CDF_NOM         AS SP_LISTE    , '||
 //+                 ' B.SP_CATC_CODE_FK, '||
 //+                 ' B.SP_CEPH_CODE_FK,  '||
 //+                 ' B.SP_CGE_CODE_FK, '||
 //+                 ' B.SP_PR_CODE_FK, '||
 //+                 ' B.SP_TYPE_SPE, '||
 //+                 ' B.SP_GREF_FK, '||
 //+                 ' B.SP_NOM,  '||
 //+                 ' B.SP_NOMCOMP,  '||
 //+                 ' B.SP_PH, '||
 //+                 ' B.SP_CIPUCD,  '||
 //+                 ' B.SP_DATECR, '||
 //+                 ' B.SP_DATEMJ, '||
 //+                 ' B.SP_NL,  '||
 //+                 ' B.SP_APHP, '||
 //+                 ' B.SP_ORIGINE_GENE, '||
 //+                 ' B.SP_NOMLONG, '||
 //+        ' B.SP_CIPUCD13 , '||
 //+           ' B.SP_MONO_VIRTUELLE AS MONO_VIR '||
 //+    ' FROM  SPGREFR_GROUPE_SPE_REF, '||
 //+             ' SP_SPECIALITE B, '||
 //+             ' SP_SPECIALITE A, '||
 //+             ' CDF_CODIF C,  '||
 //+             ' CDF_CODIF D '||
 //+    ' WHERE    SPGREFR_SP_CODE_FK_PK     = B.SP_CODE_SQ_PK '||
 //+      ' AND      B.SP_CDF_SLAB_CODE_FK     = C.CDF_CODE_PK '||
 //+      ' AND      B.SP_CDF_LI_CODE_FK       = D.CDF_CODE_PK '||
 //+      ' AND      C.CDF_NUMERO_PK           = ''15''  '||
 //+      ' AND      D.CDF_NUMERO_PK           = ''08'' '||
 //+      ' AND      SPGREFR_GREF_CODE_FK_PK   = B.SP_GREF_FK '||
 //+      ' AND      SPGREFR_GREF_DATECR_FK_PK = B.SP_GREF_DATECR_FK '||
 //+      ' AND      SPGREFR_GREF_CODE_FK_PK   = A.SP_GREF_FK '||
 //+      ' AND      A.SP_CODE_SQ_PK           = '  ||CodeId;
                sql_query += " SELECT  B.SP_CODE_SQ_PK,"
                     " B.SP_GSP_CODE_FK,"
                     " C.CDF_NOM         AS STATUT_LABO ,"
                     " D.CDF_NOM         AS SP_LISTE    ,"
                     " B.SP_CATC_CODE_FK,"
                     " B.SP_CEPH_CODE_FK,"
                     " B.SP_CGE_CODE_FK,"
                     " B.SP_PR_CODE_FK,"
                     " B.SP_TYPE_SPE,"
                     " B.SP_GREF_FK,"
                     " B.SP_NOM,"
                     " B.SP_NOMCOMP,"
                     " B.SP_PH,"
                     " B.SP_CIPUCD,"
                     " B.SP_DATECR,"
                     " B.SP_DATEMJ,"
                     " B.SP_NL,"
                     " B.SP_APHP,"
                     " B.SP_ORIGINE_GENE,"
                     " B.SP_NOMLONG,"
                     " B.SP_CIPUCD13 ,"
                     " B.SP_MONO_VIRTUELLE AS MONO_VIR"
                     " FROM  spgrefr_groupe_spe_ref,"
                     " sp_specialite B,"
                     " sp_specialite A,"
                     " cdf_codif C,"
                     " cdf_codif D"
                     " WHERE    SPGREFR_SP_CODE_FK_PK     = B.SP_CODE_SQ_PK"
                     " AND      B.SP_CDF_SLAB_CODE_FK     = C.CDF_CODE_PK"
                     " AND      B.SP_CDF_LI_CODE_FK       = D.CDF_CODE_PK"
                     " AND      C.CDF_NUMERO_PK           = '15'"
                     " AND      D.CDF_NUMERO_PK           = '08'"
                     " AND      SPGREFR_GREF_CODE_FK_PK   = B.SP_GREF_FK"
                     " AND      SPGREFR_GREF_DATECR_FK_PK = B.SP_GREF_DATECR_FK"
                     " AND      SPGREFR_GREF_CODE_FK_PK   = A.SP_GREF_FK"
                     " AND      A.SP_CODE_SQ_PK           = '"+CodeId+"' ";


           if ( MonoVir == 0) {
 //+    SQL_QUERY := SQL_QUERY || ' AND (A.SP_MONO_VIRTUELLE = 0 OR A.SP_MONO_VIRTUELLE IS NULL) ';
                sql_query += " AND (A.SP_MONO_VIRTUELLE = 0 OR A.SP_MONO_VIRTUELLE IS NULL) ";

           } else if ( MonoVir == 1) {
 //+    SQL_QUERY := SQL_QUERY || ' AND A.SP_MONO_VIRTUELLE = 1 ';
                sql_query += " AND A.SP_MONO_VIRTUELLE = 1 ";

           } else {
 //+    SQL_QUERY := SQL_QUERY || ' ORDER BY 11 ASC ';
                sql_query += " ORDER BY 11 ASC ";

           }


       } else if ( VarTyp == 15) {
 //+     SQL_QUERY := 'SELECT SP_CODE_SQ_PK    , '||
 //+                ' SP_GSP_CODE_FK  , '||
 //+                ' A.CDF_NOM AS STATUT_LABO , '||
 //+                ' B.CDF_NOM AS SP_LISTE    , '||
 //+                ' SP_CATC_CODE_FK  , '||
 //+                ' SP_CEPH_CODE_FK  , '||
 //+                ' SP_CGE_CODE_FK   , '||
 //+                ' SP_PR_CODE_FK    , '||
 //+                ' SP_TYPE_SPE      , '||
 //+                ' SP_GREF_FK       , '||
 //+                ' SP_NOM           , '||
 //+                ' SP_NOMCOMP       , '||
 //+                ' SP_PH            , '||
 //+                ' SP_CIPUCD        , '||
 //+                ' SP_DATECR        , '||
 //+                ' SP_DATEMJ        , '||
 //+                ' SP_NL            , '||
 //+                ' SP_APHP          , '||
 //+                ' SP_ORIGINE_GENE  , '||
 //+                ' SP_NOMLONG     , '||
 //+       ' SP_CIPUCD13     , '||
 //+          ' SP_MONO_VIRTUELLE AS MONO_VIR '||
 //+         ' FROM   SP_SPECIALITE, '||
 //+                ' CDF_CODIF A, '||
 //+                ' CDF_CODIF B '||
 //+         ' WHERE  SP_CDF_SLAB_CODE_FK = A.CDF_CODE_PK '||
 //+         ' AND    SP_CDF_LI_CODE_FK   = B.CDF_CODE_PK '||
 //+         ' AND    A.CDF_NUMERO_PK     = ''15'' '||
 //+         ' AND    B.CDF_NUMERO_PK     = ''08'' '||
 //+         ' AND    UPPER(SP_NOM) LIKE TRIM(UPPER('''||CodeId||'''))';
                sql_query += " SELECT SP_CODE_SQ_PK    ,"
                     " SP_GSP_CODE_FK  ,"
                     " A.CDF_NOM AS STATUT_LABO ,"
                     " B.CDF_NOM AS SP_LISTE    ,"
                     " SP_CATC_CODE_FK  ,"
                     " SP_CEPH_CODE_FK  ,"
                     " SP_CGE_CODE_FK   ,"
                     " SP_PR_CODE_FK    ,"
                     " SP_TYPE_SPE      ,"
                     " SP_GREF_FK       ,"
                     " SP_NOM           ,"
                     " SP_NOMCOMP       ,"
                     " SP_PH            ,"
                     " SP_CIPUCD        ,"
                     " SP_DATECR        ,"
                     " SP_DATEMJ        ,"
                     " SP_NL            ,"
                     " SP_APHP          ,"
                     " SP_ORIGINE_GENE  ,"
                     " SP_NOMLONG     ,"
                     " SP_CIPUCD13     ,"
                     " SP_MONO_VIRTUELLE AS MONO_VIR"
                     " FROM   sp_specialite,"
                     " cdf_codif A,"
                     " cdf_codif B"
                     " WHERE  SP_CDF_SLAB_CODE_FK = A.CDF_CODE_PK"
                     " AND    SP_CDF_LI_CODE_FK   = B.CDF_CODE_PK"
                     " AND    A.CDF_NUMERO_PK     = '15'"
                     " AND    B.CDF_NUMERO_PK     = '08'"
                     " AND    UPPER(SP_NOM) LIKE TRIM(UPPER('"+CodeId+"')) ";

           if ( MonoVir == 0) {
 //+    SQL_QUERY := SQL_QUERY || ' AND (SP_MONO_VIRTUELLE = 0 OR SP_MONO_VIRTUELLE IS NULL) ORDER BY SP_NOM ASC';
                sql_query += " AND (SP_MONO_VIRTUELLE = 0 OR SP_MONO_VIRTUELLE IS NULL) ORDER BY SP_NOM ASC ";

           } else if ( MonoVir == 1) {
 //+    SQL_QUERY := SQL_QUERY || ' AND SP_MONO_VIRTUELLE = 1 ORDER BY SP_NOM ASC ';
                sql_query += " AND SP_MONO_VIRTUELLE = 1 ORDER BY SP_NOM ASC ";

           } else {
 //+    SQL_QUERY := SQL_QUERY || ' ORDER BY SP_NOM ASC ';
                sql_query += " ORDER BY SP_NOM ASC ";

           }


       } else if ( VarTyp == 16) {
 //+      SQL_QUERY := 'SELECT SP_CODE_SQ_PK    , '||
 //+                ' SP_GSP_CODE_FK   , '||
 //+                ' A.CDF_NOM        AS STATUT_LABO , '||
 //+                ' B.CDF_NOM        AS SP_LISTE    , '||
 //+                ' SP_CATC_CODE_FK  , '||
 //+                ' SP_CEPH_CODE_FK  , '||
 //+                ' SP_CGE_CODE_FK   , '||
 //+                ' SP_PR_CODE_FK    , '||
 //+                ' SP_TYPE_SPE      , '||
 //+                ' SP_GREF_FK       , '||
 //+                ' SP_NOM           , '||
 //+                ' SP_NOMCOMP       , '||
 //+                ' SP_PH            , '||
 //+                ' SP_CIPUCD        , '||
 //+                ' SP_DATECR        , '||
 //+                ' SP_DATEMJ        , '||
 //+                ' SP_NL            , '||
 //+                ' SP_APHP          , '||
 //+                ' SP_ORIGINE_GENE  , '||
 //+                ' SP_NOMLONG  , '||
 //+       ' SP_CIPUCD13     , '||
 //+          ' SP_MONO_VIRTUELLE AS MONO_VIR '||
 //+         ' FROM   SP_SPECIALITE       , '||
 //+                ' CDF_CODIF A         , '||
 //+                ' CDF_CODIF B '||
 //+         ' WHERE  SP_CDF_SLAB_CODE_FK = A.CDF_CODE_PK '||
 //+         ' AND    SP_CDF_LI_CODE_FK   = B.CDF_CODE_PK '||
 //+         ' AND    A.CDF_NUMERO_PK     = ''15''  '||
 //+         ' AND    B.CDF_NUMERO_PK     = ''08'' '||
 //+         ' AND    SP_CIPUCD13  = '''||CodeId||'''';
                sql_query += " SELECT SP_CODE_SQ_PK    ,"
                     " SP_GSP_CODE_FK   ,"
                     " A.CDF_NOM        AS STATUT_LABO ,"
                     " B.CDF_NOM        AS SP_LISTE    ,"
                     " SP_CATC_CODE_FK  ,"
                     " SP_CEPH_CODE_FK  ,"
                     " SP_CGE_CODE_FK   ,"
                     " SP_PR_CODE_FK    ,"
                     " SP_TYPE_SPE      ,"
                     " SP_GREF_FK       ,"
                     " SP_NOM           ,"
                     " SP_NOMCOMP       ,"
                     " SP_PH            ,"
                     " SP_CIPUCD        ,"
                     " SP_DATECR        ,"
                     " SP_DATEMJ        ,"
                     " SP_NL            ,"
                     " SP_APHP          ,"
                     " SP_ORIGINE_GENE  ,"
                     " SP_NOMLONG  ,"
                     " SP_CIPUCD13     ,"
                     " SP_MONO_VIRTUELLE AS MONO_VIR"
                     " FROM   sp_specialite       ,"
                     " cdf_codif A         ,"
                     " cdf_codif B"
                     " WHERE  SP_CDF_SLAB_CODE_FK = A.CDF_CODE_PK"
                     " AND    SP_CDF_LI_CODE_FK   = B.CDF_CODE_PK"
                     " AND    A.CDF_NUMERO_PK     = '15'"
                     " AND    B.CDF_NUMERO_PK     = '08'"
                     " AND    SP_CIPUCD13  = '"+CodeId+"' ";

           if ( MonoVir == 0) {
 //+    SQL_QUERY := SQL_QUERY || ' AND (SP_MONO_VIRTUELLE = 0 OR SP_MONO_VIRTUELLE IS NULL) ORDER BY SP_NOM ASC';
                sql_query += " AND (SP_MONO_VIRTUELLE = 0 OR SP_MONO_VIRTUELLE IS NULL) ORDER BY SP_NOM ASC ";

           } else if ( MonoVir == 1) {
 //+    SQL_QUERY := SQL_QUERY || ' AND SP_MONO_VIRTUELLE = 1 ORDER BY SP_NOM ASC ';
                sql_query += " AND SP_MONO_VIRTUELLE = 1 ORDER BY SP_NOM ASC ";

           } else {
 //+    SQL_QUERY := SQL_QUERY || ' ORDER BY SP_NOM ASC ';
                sql_query += " ORDER BY SP_NOM ASC ";

           }


       } else if ( VarTyp == 17) {
 //+   SQL_QUERY := 'SELECT SP_CODE_SQ_PK , '||
 //+               ' SP_GSP_CODE_FK , '||
 //+               ' A.CDF_NOM        AS STATUT_LABO , '||
 //+               ' B.CDF_NOM        AS SP_LISTE    , '||
 //+               ' SP_CATC_CODE_FK  , '||
 //+               ' SP_CEPH_CODE_FK  , '||
 //+               ' SP_CGE_CODE_FK   , '||
 //+               ' SP_PR_CODE_FK    , '||
 //+               ' SP_TYPE_SPE      , '||
 //+               ' SP_GREF_FK       , '||
 //+               ' SP_NOM           , '||
 //+               ' SP_NOMCOMP       , '||
 //+               ' SP_PH            , '||
 //+               ' SP_CIPUCD        , '||
 //+               ' SP_DATECR        , '||
 //+               ' SP_DATEMJ        , '||
 //+               ' SP_NL            , '||
 //+               ' SP_APHP          , '||
 //+               ' SP_ORIGINE_GENE  , '||
 //+               ' SP_NOMLONG  , '||
 //+      ' SP_CIPUCD13     , '||
 //+         ' SP_MONO_VIRTUELLE AS MONO_VIR '||
 //+        ' FROM   SP_SPECIALITE, '||
 //+               ' CDF_CODIF A, '||
 //+               ' CDF_CODIF B, '||
 //+               ' PRE_PRESENTATION '||
 //+        ' WHERE  SP_CDF_SLAB_CODE_FK = A.CDF_CODE_PK '||
 //+        ' AND    SP_CDF_LI_CODE_FK   = B.CDF_CODE_PK '||
 //+        ' AND    A.CDF_NUMERO_PK     = ''15'' '||
 //+        ' AND    B.CDF_NUMERO_PK     = ''08'' '||
 //+        ' AND    PRE_SP_CODE_FK      = SP_CODE_SQ_PK '||
 //+        ' AND    PRE_EAN_REF         =  '''||CodeId||'''';
                sql_query += " SELECT SP_CODE_SQ_PK ,"
                     " SP_GSP_CODE_FK ,"
                     " A.CDF_NOM        AS STATUT_LABO ,"
                     " B.CDF_NOM        AS SP_LISTE    ,"
                     " SP_CATC_CODE_FK  ,"
                     " SP_CEPH_CODE_FK  ,"
                     " SP_CGE_CODE_FK   ,"
                     " SP_PR_CODE_FK    ,"
                     " SP_TYPE_SPE      ,"
                     " SP_GREF_FK       ,"
                     " SP_NOM           ,"
                     " SP_NOMCOMP       ,"
                     " SP_PH            ,"
                     " SP_CIPUCD        ,"
                     " SP_DATECR        ,"
                     " SP_DATEMJ        ,"
                     " SP_NL            ,"
                     " SP_APHP          ,"
                     " SP_ORIGINE_GENE  ,"
                     " SP_NOMLONG  ,"
                     " SP_CIPUCD13     ,"
                     " SP_MONO_VIRTUELLE AS MONO_VIR"
                     " FROM   sp_specialite,"
                     " cdf_codif A,"
                     " cdf_codif B,"
                     " pre_presentation"
                     " WHERE  SP_CDF_SLAB_CODE_FK = A.CDF_CODE_PK"
                     " AND    SP_CDF_LI_CODE_FK   = B.CDF_CODE_PK"
                     " AND    A.CDF_NUMERO_PK     = '15'"
                     " AND    B.CDF_NUMERO_PK     = '08'"
                     " AND    PRE_SP_CODE_FK      = SP_CODE_SQ_PK"
                     " AND    PRE_EAN_REF         =  '"+CodeId+"' ";


           if ( MonoVir == 0) {
 //+    SQL_QUERY := SQL_QUERY || ' AND (SP_MONO_VIRTUELLE = 0 OR SP_MONO_VIRTUELLE IS NULL) ORDER BY SP_NOM ASC ';
                sql_query += " AND (SP_MONO_VIRTUELLE = 0 OR SP_MONO_VIRTUELLE IS NULL) ORDER BY SP_NOM ASC;";

           } else if ( MonoVir == 1) {
 //+    SQL_QUERY := SQL_QUERY || ' AND SP_MONO_VIRTUELLE = 1 ORDER BY SP_NOM ASC ';
                sql_query += " AND SP_MONO_VIRTUELLE = 1 ORDER BY SP_NOM ASC;";

           } else {
 //+    SQL_QUERY := SQL_QUERY || ' ORDER BY SP_NOM ASC ';
                sql_query += " ORDER BY SP_NOM ASC;";

           }

       } else {
 //+    C_GET_THE_SPECIALITE := NULL;
         return 0;
       }
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_SPECIALITE() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_SP_CODE_SQ_PK   = value(0).toDouble();
                m_SP_GSP_CODE_FK  = value(1).toDouble();
                m_STATUT_LABO     = value(2).toString();
                m_SP_LISTE        = value(3).toString();
                m_SP_CATC_CODE_FK = value(4).toString();
                m_SP_CEPH_CODE_FK = value(5).toString();
                m_SP_CGE_CODE_FK  = value(6).toDouble();
                m_SP_PR_CODE_FK   = value(7).toDouble();
                m_SP_TYPE_SPE     = value(8).toString();
                m_SP_GREF_FK      = value(9).toDouble();
                m_SP_NOM          = value(10).toString();
                m_SP_NOMCOMP      = value(11).toString();
                m_SP_PH           = value(12).toString();
                m_SP_CIPUCD       = value(13).toString();
                m_SP_DATECR       = value(14).toDate();
                m_SP_DATEMJ       = value(15).toDate();
                m_SP_NL           = value(16).toString();
                m_SP_APHP         = value(17).toString();
                m_SP_ORIGINE_GENE = value(18).toString();
                m_SP_NOMLONG      = value(19).toString();
                m_SP_CIPUCD13     = value(20).toString();
                m_MONO_VIR        = value(21).toInt();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      double  SP_CODE_SQ_PK()   {return m_SP_CODE_SQ_PK;}
      double  SP_GSP_CODE_FK()  {return m_SP_GSP_CODE_FK;}
      QString STATUT_LABO()     {return m_STATUT_LABO;}
      QString SP_LISTE()        {return m_SP_LISTE;}
      QString SP_CATC_CODE_FK() {return m_SP_CATC_CODE_FK;}
      QString SP_CEPH_CODE_FK() {return m_SP_CEPH_CODE_FK;}
      double  SP_CGE_CODE_FK()  {return m_SP_CGE_CODE_FK;}
      double  SP_PR_CODE_FK()   {return m_SP_PR_CODE_FK;}
      QString SP_TYPE_SPE()     {return m_SP_TYPE_SPE;}
      double  SP_GREF_FK()      {return m_SP_GREF_FK;}
      QString SP_NOM()          {return m_SP_NOM;}
      QString SP_NOMCOMP()      {return m_SP_NOMCOMP;}
      QString SP_PH()           {return m_SP_PH;}
      QString SP_CIPUCD()       {return m_SP_CIPUCD;}
      QDate   SP_DATECR()       {return m_SP_DATECR;}
      QDate   SP_DATEMJ()       {return m_SP_DATEMJ;}
      QString SP_NL()           {return m_SP_NL;}
      QString SP_APHP()         {return m_SP_APHP;}
      QString SP_ORIGINE_GENE() {return m_SP_ORIGINE_GENE;}
      QString SP_NOMLONG()      {return m_SP_NOMLONG;}
      QString SP_CIPUCD13()     {return m_SP_CIPUCD13;}
      int     MONO_VIR()        {return m_MONO_VIR;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      double  m_SP_CODE_SQ_PK;
      double  m_SP_GSP_CODE_FK;
      QString m_STATUT_LABO;
      QString m_SP_LISTE;
      QString m_SP_CATC_CODE_FK;
      QString m_SP_CEPH_CODE_FK;
      double  m_SP_CGE_CODE_FK;
      double  m_SP_PR_CODE_FK;
      QString m_SP_TYPE_SPE;
      double  m_SP_GREF_FK;
      QString m_SP_NOM;
      QString m_SP_NOMCOMP;
      QString m_SP_PH;
      QString m_SP_CIPUCD;
      QDate   m_SP_DATECR;
      QDate   m_SP_DATEMJ;
      QString m_SP_NL;
      QString m_SP_APHP;
      QString m_SP_ORIGINE_GENE;
      QString m_SP_NOMLONG;
      QString m_SP_CIPUCD13;
      int     m_MONO_VIR;
 };

 //================================== C_GET_THE_VOIE_SPE_CUR   -4- ==================================
 /****************************************************************************
 *   Nom           :  GET_THE_VOIE_SPE
 -----------------------------------------------------------------------------
 *   Date creation : 08/07/2008
 -----------------------------------------------------------------------------
 *   Description   :  cette procédure nous renvoie les voies d'administration
 *                    associées au code spécialité passé en paramétre
 *
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_VOIE_SPE_CUR  C_GET_THE_VOIE_SPE ( database(), this );
      while ( C_GET_THE_VOIE_SPE.next( CodeId  ) )
            { html += tr("<br><b> GET_THE_VOIE_SPE : </b>  ") + C_GET_THE_VOIE_SPE.MEMBER();
            }
  */
  class C_GET_THE_VOIE_SPE_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_VOIE_SPE_CUR ---------------------
      C_GET_THE_VOIE_SPE_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( double CodeId )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............

 //+       SELECT cdf_code_pk       AS CODEVOIE  ,
 //+              cdf_nom           AS TXTVOIE
 //+       FROM   SPVO_SPECIALITE_VOIE,
 //+              CDF_CODIF
 //+       WHERE  SPVO_CDF_VO_CODE_FK_PK = CDF_CODE_PK
 //+       AND    CDF_NUMERO_PK          = '18'
 //+       AND    SPVO_SP_CODE_FK_PK     = CodeId;
                sql_query += " SELECT CDF_CODE_PK       AS CODEVOIE  ,"
                     " CDF_NOM           AS TXTVOIE"
                     " FROM   spvo_specialite_voie,"
                     " cdf_codif"
                     " WHERE  SPVO_CDF_VO_CODE_FK_PK = CDF_CODE_PK"
                     " AND    CDF_NUMERO_PK          = '18'"
                     " AND    SPVO_SP_CODE_FK_PK      = '"+ QString::number( CodeId ) +"';";
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_VOIE_SPE() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_CODEVOIE = value(0).toString();
                m_TXTVOIE  = value(1).toString();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      QString CODEVOIE() {return m_CODEVOIE;}
      QString TXTVOIE()  {return m_TXTVOIE;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      QString m_CODEVOIE;
      QString m_TXTVOIE;
 };

 //================================== C_GET_THE_FORME_SPE_CUR   -5- ==================================
 /***************************************************************************
 *   Nom           :  GET_THE_FORME_SPE
 -----------------------------------------------------------------------------
 *   Date creation : 08/07/2008
 -----------------------------------------------------------------------------
 *   Description   :  cette procédure nous renvoie les formes pharmaceutiques
 *                    associées au code spécialité passé en paramétre
 *
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_FORME_SPE_CUR  C_GET_THE_FORME_SPE ( database(), this );
      while ( C_GET_THE_FORME_SPE.next( CodeId  ) )
            { html += tr("<br><b> GET_THE_FORME_SPE : </b>  ") + C_GET_THE_FORME_SPE.MEMBER();
            }
  */
  class C_GET_THE_FORME_SPE_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_FORME_SPE_CUR ---------------------
      C_GET_THE_FORME_SPE_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( double CodeId )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............

 //+       SELECT spfo_cdf_fo_code_fk_pk   AS CODEFO ,
 //+              a.cdf_nom                AS LIBFO
 //+       FROM   CDF_CODIF A,
 //+              SPFO_SPECIALITE_FORME,
 //+              SPFOTX_SPE_FORME_TEXTE
 //+       WHERE  SPFO_CDF_FO_CODE_FK_PK = A.CDF_CODE_PK
 //+       AND    A.CDF_NUMERO_PK        = '06'
 //+       AND    SPFO_SP_CODE_FK_PK     = SPFOTX_SP_CODE_FK_PK
 //+       AND    SPFO_SP_CODE_FK_PK     = CodeId
 //+       ORDER BY SPFO_NUMSEQ_PK;
                sql_query += " SELECT SPFO_CDF_FO_CODE_FK_PK   AS CODEFO ,"
                     " A.CDF_NOM                AS LIBFO"
                     " FROM   cdf_codif A,"
                     " spfo_specialite_forme,"
                     " spfotx_spe_forme_texte"
                     " WHERE  SPFO_CDF_FO_CODE_FK_PK = A.CDF_CODE_PK"
                     " AND    A.CDF_NUMERO_PK        = '06'"
                     " AND    SPFO_SP_CODE_FK_PK     = SPFOTX_SP_CODE_FK_PK"
                     " AND    SPFO_SP_CODE_FK_PK     = '"+ QString::number( CodeId ) +"'"
                     " ORDER BY SPFO_NUMSEQ_PK;";
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_FORME_SPE() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_CODEFO = value(0).toString();
                m_LIBFO  = value(1).toString();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      QString CODEFO() {return m_CODEFO;}
      QString LIBFO()  {return m_LIBFO;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      QString m_CODEFO;
      QString m_LIBFO;
 };

 //================================== C_GET_THE_FORME_COMP_SPE_CUR   -6- ==================================
 /****************************************************************************
 *   Nom           :  GET_THE_FORME_COMP_SPE
 -----------------------------------------------------------------------------
 *   Date creation : 09/07/2008
 -----------------------------------------------------------------------------
 *   Description   :  cette procédure nous renvoie soit les informations complementaires,
 *                    soit le complément lié au forme d'une specialité
 *   MAJ           :  04/02/2009 - Mourad
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_FORME_COMP_SPE_CUR  C_GET_THE_FORME_COMP_SPE ( database(), this );
      while ( C_GET_THE_FORME_COMP_SPE.next( CodeId , TYPID  ) )
            { html += tr("<br><b> GET_THE_FORME_COMP_SPE : </b>  ") + C_GET_THE_FORME_COMP_SPE.MEMBER();
            }
  */
  class C_GET_THE_FORME_COMP_SPE_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_FORME_COMP_SPE_CUR ---------------------
      C_GET_THE_FORME_COMP_SPE_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( double CodeId , double TYPID )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............
       if ( TYPID == 1) {

 //+         SELECT   spfocpi_cdf_fo_code_fk_pk     AS CODEFO,
 //+                  spfocpi_cdf_cpi_code_fk_pk    AS CODECP,
 //+                  SPFOCPI_SPFO_NUMSEQ_FK_PK  AS NUMSEQ,
 //+                  cdf_nom      AS LIBFO
 //+         FROM     SPFOCPI_SPE_FORME_COMPINFO,
 //+                  CDF_CODIF
 //+         WHERE    SPFOCPI_CDF_CPI_CODE_FK_PK = CDF_CODE_PK
 //+         AND      CDF_NUMERO_PK = '26'
 //+         AND      SPFOCPI_SP_CODE_FK_PK = CodeId
 //+         ORDER BY SPFOCPI_SPFO_NUMSEQ_FK_PK;
                sql_query += " SELECT   SPFOCPI_CDF_FO_CODE_FK_PK     AS CODEFO,"
                     " SPFOCPI_CDF_CPI_CODE_FK_PK    AS CODECP,"
                     " SPFOCPI_SPFO_NUMSEQ_FK_PK  AS NUMSEQ,"
                     " CDF_NOM      AS LIBFO"
                     " FROM     spfocpi_spe_forme_compinfo,"
                     " cdf_codif"
                     " WHERE    SPFOCPI_CDF_CPI_CODE_FK_PK = CDF_CODE_PK"
                     " AND      CDF_NUMERO_PK = '26'"
                     " AND      SPFOCPI_SP_CODE_FK_PK  = '"+ QString::number( CodeId ) +"'"
                     " ORDER BY SPFOCPI_SPFO_NUMSEQ_FK_PK;";

       } else if ( TYPID == 2) {

 //+         SELECT   spfocfo_cdf_fo_code_fk_pk     AS CODEFO,
 //+                  spfocfo_cdf_cfo_code_fk_pk    AS CODECP,
 //+                  SPFOCFO_SPFO_NUMSEQ_FK_PK  AS NUMSEQ,
 //+                  cdf_nom   AS LIBFO
 //+         FROM     SPFOCFO_SPE_FORME_COMPFORME,
 //+                  CDF_CODIF
 //+         WHERE    SPFOCFO_CDF_CFO_CODE_FK_PK = CDF_CODE_PK
 //+         AND      CDF_NUMERO_PK              = '02'
 //+         AND      SPFOCFO_SP_CODE_FK_PK      = CodeId
 //+         ORDER BY SPFOCFO_SPFO_NUMSEQ_FK_PK;
                sql_query += " SELECT   SPFOCFO_CDF_FO_CODE_FK_PK     AS CODEFO,"
                     " SPFOCFO_CDF_CFO_CODE_FK_PK    AS CODECP,"
                     " SPFOCFO_SPFO_NUMSEQ_FK_PK  AS NUMSEQ,"
                     " CDF_NOM   AS LIBFO"
                     " FROM     spfocfo_spe_forme_compforme,"
                     " cdf_codif"
                     " WHERE    SPFOCFO_CDF_CFO_CODE_FK_PK = CDF_CODE_PK"
                     " AND      CDF_NUMERO_PK              = '02'"
                     " AND      SPFOCFO_SP_CODE_FK_PK       = '"+ QString::number( CodeId ) +"'"
                     " ORDER BY SPFOCFO_SPFO_NUMSEQ_FK_PK;";

       } else {
 //+       C_GET_THE_FORME_COMP_SPE := NULL;
         return 0;
       }
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_FORME_COMP_SPE() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_CODEFO = value(0).toString();
                m_CODECP = value(1).toString();
                m_NUMSEQ = value(2).toString();
                m_LIBFO  = value(3).toString();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      QString CODEFO() {return m_CODEFO;}
      QString CODECP() {return m_CODECP;}
      QString NUMSEQ() {return m_NUMSEQ;}
      QString LIBFO()  {return m_LIBFO;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      QString m_CODEFO;
      QString m_CODECP;
      QString m_NUMSEQ;
      QString m_LIBFO;
 };

 //================================== C_GET_THE_REF_FORME_CUR   -7- ==================================
 /***************************************************************************
 *   Nom           :  GET_THE_REF_FORME
 -----------------------------------------------------------------------------
 *   Date creation : 09/07/2008
 -----------------------------------------------------------------------------
 *   Description   :  cette procédure nous renvoie les formes pharmaceutiques
 *                    associées au code spécialité passé en paramétre
 *
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_REF_FORME_CUR  C_GET_THE_REF_FORME ( database(), this );
      while ( C_GET_THE_REF_FORME.next( CodeId  ) )
            { html += tr("<br><b> GET_THE_REF_FORME : </b>  ") + C_GET_THE_REF_FORME.MEMBER();
            }
  */
  class C_GET_THE_REF_FORME_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_REF_FORME_CUR ---------------------
      C_GET_THE_REF_FORME_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( double CodeId )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............

 //+     SELECT   cdf_nom      AS REFOF ,
 //+              spafs_date_pk  AS DTREF
 //+     FROM     CDF_CODIF,
 //+              SPAFS_SPECIALITE_AFSSAPS
 //+     WHERE    (SPAFS_RUBCDF_NUMERO_PK = '06' OR SPAFS_RUBCDF_NUMERO_PK = 'SP')
 //+     AND      CDF_CODE_PK             = SPAFS_CDF_CODE_DOC_FK_PK
 //+     AND      CDF_NUMERO_PK           = '25'
 //+     AND      SPAFS_SP_CODE_FK_PK     = CodeId
 //+     ORDER BY SPAFS_DATE_PK  DESC;
                sql_query += " SELECT   CDF_NOM      AS REFOF ,"
                     " SPAFS_DATE_PK  AS DTREF"
                     " FROM     cdf_codif,"
                     " spafs_specialite_afssaps"
                     " WHERE    (SPAFS_RUBCDF_NUMERO_PK = '06' OR SPAFS_RUBCDF_NUMERO_PK = 'SP')"
                     " AND      CDF_CODE_PK             = SPAFS_CDF_CODE_DOC_FK_PK"
                     " AND      CDF_NUMERO_PK           = '25'"
                     " AND      SPAFS_SP_CODE_FK_PK      = '"+ QString::number( CodeId ) +"'"
                     " ORDER BY SPAFS_DATE_PK  DESC;";
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_REF_FORME() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_REFOF = value(0).toString();
                m_DTREF = value(1).toDate();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      QString REFOF() {return m_REFOF;}
      QDate   DTREF() {return m_DTREF;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      QString m_REFOF;
      QDate   m_DTREF;
 };

 //================================== C_GET_THE_FORME_TXT_SPE_CUR   -8- ==================================
 /***************************************************************************
 *   Nom           :  GET_THE_FORME_TXT_SPE
 -----------------------------------------------------------------------------
 *   Date creation : 09/07/2008
 -----------------------------------------------------------------------------
 *   Description   :  cette procédure affiche le texte concernant la forme
 *                    pharmaceutique
 *
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_FORME_TXT_SPE_CUR  C_GET_THE_FORME_TXT_SPE ( database(), this );
      while ( C_GET_THE_FORME_TXT_SPE.next( CodeId  ) )
            { html += tr("<br><b> GET_THE_FORME_TXT_SPE : </b>  ") + C_GET_THE_FORME_TXT_SPE.MEMBER();
            }
  */
  class C_GET_THE_FORME_TXT_SPE_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_FORME_TXT_SPE_CUR ---------------------
      C_GET_THE_FORME_TXT_SPE_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( double CodeId )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............

 //+      SELECT SPFOTX_TEXTE  AS TEXTFO
 //+      FROM   SPFOTX_SPE_FORME_TEXTE
 //+      WHERE  SPFOTX_SP_CODE_FK_PK = CodeId;
                sql_query += " SELECT SPFOTX_TEXTE  AS TEXTFO"
                     " FROM   spfotx_spe_forme_texte"
                     " WHERE  SPFOTX_SP_CODE_FK_PK  = '"+ QString::number( CodeId ) +"';";
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_FORME_TXT_SPE() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_TEXTFO = value(0).toString();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      QString TEXTFO() {return m_TEXTFO;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      QString m_TEXTFO;
 };

 //================================== C_GET_THE_LAB_TXT_CUR   -9- ==================================
 /***************************************************************************
 *   Nom           :  GET_THE_LAB_TXT
 -----------------------------------------------------------------------------
 *   Date creation : 09/07/2008
 -----------------------------------------------------------------------------
 *   Description   :  cette procédure renvoie les fiches laboratoires repondant
 *                    au critere de recherche passé en parametre (une parti du nom du lab)
 *
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_LAB_TXT_CUR  C_GET_THE_LAB_TXT ( database(), this );
      while ( C_GET_THE_LAB_TXT.next( LIBTXT  ) )
            { html += tr("<br><b> GET_THE_LAB_TXT : </b>  ") + C_GET_THE_LAB_TXT.MEMBER();
            }
  */
  class C_GET_THE_LAB_TXT_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_LAB_TXT_CUR ---------------------
      C_GET_THE_LAB_TXT_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( QString LIBTXT )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............

 //+      SELECT   CDF_NUMERO_PK  ,
 //+               CDF_CODE_PK    ,
 //+               CDF_NOM        ,
 //+               CDF_DATECR     ,
 //+               CDF_DATEMJ
 //+      FROM     CDF_CODIF
 //+      WHERE    CDF_NUMERO_PK = '07'
 //+      AND      UPPER(CDF_NOM) LIKE UPPER(LIBTXT)
 //+      ORDER BY CDF_NOM ASC ;
                sql_query += " SELECT   CDF_NUMERO_PK  ,"
                     " CDF_CODE_PK    ,"
                     " CDF_NOM        ,"
                     " CDF_DATECR     ,"
                     " CDF_DATEMJ"
                     " FROM     cdf_codif"
                     " WHERE    CDF_NUMERO_PK = '07'"
                     " AND      UPPER(CDF_NOM) LIKE UPPER('"+LIBTXT+"')"
                     " ORDER BY CDF_NOM ASC ;";
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_LAB_TXT() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_CDF_NUMERO_PK = value(0).toString();
                m_CDF_CODE_PK   = value(1).toString();
                m_CDF_NOM       = value(2).toString();
                m_CDF_DATECR    = value(3).toDate();
                m_CDF_DATEMJ    = value(4).toDate();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      QString CDF_NUMERO_PK() {return m_CDF_NUMERO_PK;}
      QString CDF_CODE_PK()   {return m_CDF_CODE_PK;}
      QString CDF_NOM()       {return m_CDF_NOM;}
      QDate   CDF_DATECR()    {return m_CDF_DATECR;}
      QDate   CDF_DATEMJ()    {return m_CDF_DATEMJ;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      QString m_CDF_NUMERO_PK;
      QString m_CDF_CODE_PK;
      QString m_CDF_NOM;
      QDate   m_CDF_DATECR;
      QDate   m_CDF_DATEMJ;
 };

 //================================== C_GET_THE_LAB_ID_CUR   -10- ==================================
 /***************************************************************************
 *   Nom           :  GET_THE_LAB_ID
 -----------------------------------------------------------------------------
 *   Date creation : 09/07/2008
 -----------------------------------------------------------------------------
 *   Description   :  cette procédure renvoie les fiches laboratoires repondant
 *                    au critere du code laboratoire
 *
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_LAB_ID_CUR  C_GET_THE_LAB_ID ( database(), this );
      while ( C_GET_THE_LAB_ID.next( CodeId  ) )
            { html += tr("<br><b> GET_THE_LAB_ID : </b>  ") + C_GET_THE_LAB_ID.MEMBER();
            }
  */
  class C_GET_THE_LAB_ID_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_LAB_ID_CUR ---------------------
      C_GET_THE_LAB_ID_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( QString CodeId )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............

 //+      SELECT   CDF_NUMERO_PK   ,
 //+               CDF_CODE_PK     ,
 //+               CDF_NOM         ,
 //+               CDF_DATECR      ,
 //+               CDF_DATEMJ
 //+      FROM     CDF_CODIF
 //+      WHERE    CDF_NUMERO_PK = '07'
 //+      AND      CDF_CODE_PK   = CodeId
 //+      ORDER BY CDF_NOM ASC;
                sql_query += " SELECT   CDF_NUMERO_PK   ,"
                     " CDF_CODE_PK     ,"
                     " CDF_NOM         ,"
                     " CDF_DATECR      ,"
                     " CDF_DATEMJ"
                     " FROM     cdf_codif"
                     " WHERE    CDF_NUMERO_PK = '07'"
                     " AND      CDF_CODE_PK    = '"+CodeId+"'"
                     " ORDER BY CDF_NOM ASC;";
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_LAB_ID() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_CDF_NUMERO_PK = value(0).toString();
                m_CDF_CODE_PK   = value(1).toString();
                m_CDF_NOM       = value(2).toString();
                m_CDF_DATECR    = value(3).toDate();
                m_CDF_DATEMJ    = value(4).toDate();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      QString CDF_NUMERO_PK() {return m_CDF_NUMERO_PK;}
      QString CDF_CODE_PK()   {return m_CDF_CODE_PK;}
      QString CDF_NOM()       {return m_CDF_NOM;}
      QDate   CDF_DATECR()    {return m_CDF_DATECR;}
      QDate   CDF_DATEMJ()    {return m_CDF_DATEMJ;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      QString m_CDF_NUMERO_PK;
      QString m_CDF_CODE_PK;
      QString m_CDF_NOM;
      QDate   m_CDF_DATECR;
      QDate   m_CDF_DATEMJ;
 };

 //================================== C_GET_THE_LAB_SPE_CUR   -11- ==================================
 /****************************************************************************
 *   Nom           :  GET_THE_LAB_SPE
 -----------------------------------------------------------------------------
 *   Date creation : 09/07/2008
 -----------------------------------------------------------------------------
 *   Description   :  cette procédure nous renvoie soit les informations complementaires,
 *                    soit le complément lié au forme d'une specialité
 *   MAJ           :  06/10/2008
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_LAB_SPE_CUR  C_GET_THE_LAB_SPE ( database(), this );
      while ( C_GET_THE_LAB_SPE.next( CodeId , TypId  ) )
            { html += tr("<br><b> GET_THE_LAB_SPE : </b>  ") + C_GET_THE_LAB_SPE.MEMBER();
            }
  */
  class C_GET_THE_LAB_SPE_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_LAB_SPE_CUR ---------------------
      C_GET_THE_LAB_SPE_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( double CodeId , double TypId )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............
       if ( TypId == 1) {

 //+         SELECT DISTINCT SPLAB_CDF_LAB_CODE_FK_PK     AS CodeLab ,
 //+                         a.CDF_NOM                    AS NomLab  ,
 //+                         b.CDF_NOM                 AS RefOf   ,
 //+                         SPAFS_DATE_PK              AS DateRef
 //+         FROM  CDF_CODIF a,
 //+               SPLAB_SPECIALITE_LABO sp,
 //+               SPAFS_SPECIALITE_AFSSAPS,
 //+               CDF_CODIF b
 //+         WHERE SPLAB_SP_CODE_FK_PK      = SPAFS_SP_CODE_FK_PK
 //+         AND   SPAFS_RUBCDF_NUMERO_PK IN ('07','CPH','SP')
 //+         AND   SPAFS_DATE_PK            =  ( SELECT MAX(SPAFS_DATE_PK)
 //+                                             FROM   SPAFS_SPECIALITE_AFSSAPS
 //+                                             WHERE  SPAFS_SP_CODE_FK_PK = sp.splab_sp_code_fk_pk
 //+                                             AND    SPAFS_RUBCDF_NUMERO_PK IN ('07','CPH','SP'))
 //+        AND    SPAFS_CDF_CODE_DOC_FK_PK = b.CDF_CODE_PK
 //+        AND    b.CDF_NUMERO_PK          = '25'
 //+        AND    SPLAB_CDF_LAB_CODE_FK_PK = a.CDF_CODE_PK
 //+        AND    a.CDF_NUMERO_PK          = '07'
 //+        AND    SPLAB_SP_CODE_FK_PK      = CodeId;
                sql_query += " SELECT DISTINCT SPLAB_CDF_LAB_CODE_FK_PK     AS CodeLab ,"
                     " a.CDF_NOM                    AS NomLab  ,"
                     " b.CDF_NOM                 AS RefOf   ,"
                     " SPAFS_DATE_PK              AS DateRef"
                     " FROM  cdf_codif a,"
                     " splab_specialite_labo sp,"
                     " spafs_specialite_afssaps,"
                     " cdf_codif b"
                     " WHERE SPLAB_SP_CODE_FK_PK      = SPAFS_SP_CODE_FK_PK"
                     " AND   SPAFS_RUBCDF_NUMERO_PK IN ('07','CPH','SP')"
                     " AND   SPAFS_DATE_PK            =  ( SELECT MAX(SPAFS_DATE_PK)"
                     " FROM   spafs_specialite_afssaps"
                     " WHERE  SPAFS_SP_CODE_FK_PK = sp.splab_sp_code_fk_pk"
                     " AND    SPAFS_RUBCDF_NUMERO_PK IN ('07','CPH','SP'))"
                     " AND    SPAFS_CDF_CODE_DOC_FK_PK = b.CDF_CODE_PK"
                     " AND    b.CDF_NUMERO_PK          = '25'"
                     " AND    SPLAB_CDF_LAB_CODE_FK_PK = a.CDF_CODE_PK"
                     " AND    a.CDF_NUMERO_PK          = '07'"
                     " AND    SPLAB_SP_CODE_FK_PK       = '"+ QString::number( CodeId ) +"';";

       } else if ( TypId == 2) {

 //+         SELECT DISTINCT SPLABEX_CDF_LAB_CODE_FK_PK    AS CodeLab ,
 //+                         a.CDF_NOM                     AS NomLab  ,
 //+                         b.CDF_NOM              AS RefOf   ,
 //+                         SPAFS_DATE_PK             AS DateRef
 //+         FROM  CDF_CODIF a,
 //+               SPLABEX_SPE_LABO_EXPLOITANT sp,
 //+               SPAFS_SPECIALITE_AFSSAPS,
 //+               CDF_CODIF b
 //+         WHERE SPLABEX_SP_CODE_FK_PK    = SPAFS_SP_CODE_FK_PK
 //+         AND   SPAFS_RUBCDF_NUMERO_PK IN ('07E','SP')
 //+         AND   SPAFS_DATE_PK            =  ( SELECT MAX(SPAFS_DATE_PK)
 //+                                             FROM   SPAFS_SPECIALITE_AFSSAPS
 //+                                             WHERE  SPAFS_SP_CODE_FK_PK = sp.SPLABEX_SP_CODE_FK_PK
 //+                                             AND    SPAFS_RUBCDF_NUMERO_PK IN ('07E','SP'))
 //+        AND    SPAFS_CDF_CODE_DOC_FK_PK = b.CDF_CODE_PK
 //+        AND    b.CDF_NUMERO_PK          = '25'
 //+        AND    SPLABEX_CDF_LAB_CODE_FK_PK = a.CDF_CODE_PK
 //+        AND    a.CDF_NUMERO_PK          = '07'
 //+        AND    SPLABEX_SP_CODE_FK_PK    = CodeId;
                sql_query += " SELECT DISTINCT SPLABEX_CDF_LAB_CODE_FK_PK    AS CodeLab ,"
                     " a.CDF_NOM                     AS NomLab  ,"
                     " b.CDF_NOM              AS RefOf   ,"
                     " SPAFS_DATE_PK             AS DateRef"
                     " FROM  cdf_codif a,"
                     " splabex_spe_labo_exploitant sp,"
                     " spafs_specialite_afssaps,"
                     " cdf_codif b"
                     " WHERE SPLABEX_SP_CODE_FK_PK    = SPAFS_SP_CODE_FK_PK"
                     " AND   SPAFS_RUBCDF_NUMERO_PK IN ('07E','SP')"
                     " AND   SPAFS_DATE_PK            =  ( SELECT MAX(SPAFS_DATE_PK)"
                     " FROM   spafs_specialite_afssaps"
                     " WHERE  SPAFS_SP_CODE_FK_PK = sp.SPLABEX_SP_CODE_FK_PK"
                     " AND    SPAFS_RUBCDF_NUMERO_PK IN ('07E','SP'))"
                     " AND    SPAFS_CDF_CODE_DOC_FK_PK = b.CDF_CODE_PK"
                     " AND    b.CDF_NUMERO_PK          = '25'"
                     " AND    SPLABEX_CDF_LAB_CODE_FK_PK = a.CDF_CODE_PK"
                     " AND    a.CDF_NUMERO_PK          = '07'"
                     " AND    SPLABEX_SP_CODE_FK_PK     = '"+ QString::number( CodeId ) +"';";

       } else {
 //+       C_GET_THE_LAB_SPE := NULL;
         return 0;
       }
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_LAB_SPE() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_CodeLab = value(0).toDouble();
                m_NomLab  = value(1).toString();
                m_RefOf   = value(2).toString();
                m_DateRef = value(3).toDate();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      double  CodeLab() {return m_CodeLab;}
      QString NomLab()  {return m_NomLab;}
      QString RefOf()   {return m_RefOf;}
      QDate   DateRef() {return m_DateRef;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      double  m_CodeLab;
      QString m_NomLab;
      QString m_RefOf;
      QDate   m_DateRef;
 };

 //================================== C_GET_THE_PDT_TXT_CUR   -12- ==================================
 /***************************************************************************
 *   Nom           :  GET_THE_PDT_TXT
 -----------------------------------------------------------------------------
 *   Date creation : 10/07/2008
 -----------------------------------------------------------------------------
 *   Description   :  cette procédure renvoie les fiches spécialité repondant
 *                    au libéllé produit passé en paramétre ,le nom peut contenir
 *                    le caractere '%'
 *
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_PDT_TXT_CUR  C_GET_THE_PDT_TXT ( database(), this );
      while ( C_GET_THE_PDT_TXT.next( LIBTXT , MonoVir  ) )
            { html += tr("<br><b> GET_THE_PDT_TXT : </b>  ") + C_GET_THE_PDT_TXT.MEMBER();
            }
  */
  class C_GET_THE_PDT_TXT_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_PDT_TXT_CUR ---------------------
      C_GET_THE_PDT_TXT_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( QString LIBTXT , double MonoVir )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............
 //+   SQL_QUERY := 'SELECT SP_CODE_SQ_PK , '||
 //+             ' SP_GSP_CODE_FK      ,'||
 //+             ' SP_CDF_SLAB_CODE_FK ,'||
 //+             ' SP_CDF_LI_CODE_FK   ,'||
 //+             ' SP_CATC_CODE_FK     ,'||
 //+             ' SP_CEPH_CODE_FK     ,'||
 //+             ' SP_CGE_CODE_FK      ,'||
 //+             ' SP_PR_CODE_FK       ,'||
 //+             ' SP_TYPE_SPE         ,'||
 //+             ' SP_GREF_FK          ,'||
 //+             ' SP_GREF_DATECR_FK   ,'||
 //+             ' SP_NOM              ,'||
 //+             ' SP_NOMCOMP          ,'||
 //+             ' SP_PH               ,'||
 //+             ' SP_CIPUCD           ,'||
 //+             ' SP_DATECR           ,'||
 //+             ' SP_DATEMJ           ,'||
 //+             ' SP_NL               ,'||
 //+             ' SP_APHP             ,'||
 //+             ' SP_DATEJOGENE       ,'||
 //+             ' SP_ORIGINE_GENE     ,'||
 //+             ' SP_NOMLONG          ,'||
 //+             ' SP_CDT_PRESCR_TEXTE ,'||
 //+             ' SP_ATC_DDD_TEXTE,    '||
 //+    ' SP_CIPUCD13      '||
 //+      ' FROM   SP_SPECIALITE,PR_PRODUIT      '||
 //+      ' WHERE  SP_PR_CODE_FK = PR_CODE_SQ_PK '||
 //+      ' AND    UPPER(PR_NOM) LIKE UPPER('''||LIBTXT||''')';
                sql_query += " SELECT SP_CODE_SQ_PK ,"
                     " SP_GSP_CODE_FK      ,"
                     " SP_CDF_SLAB_CODE_FK ,"
                     " SP_CDF_LI_CODE_FK   ,"
                     " SP_CATC_CODE_FK     ,"
                     " SP_CEPH_CODE_FK     ,"
                     " SP_CGE_CODE_FK      ,"
                     " SP_PR_CODE_FK       ,"
                     " SP_TYPE_SPE         ,"
                     " SP_GREF_FK          ,"
                     " SP_GREF_DATECR_FK   ,"
                     " SP_NOM              ,"
                     " SP_NOMCOMP          ,"
                     " SP_PH               ,"
                     " SP_CIPUCD           ,"
                     " SP_DATECR           ,"
                     " SP_DATEMJ           ,"
                     " SP_NL               ,"
                     " SP_APHP             ,"
                     " SP_DATEJOGENE       ,"
                     " SP_ORIGINE_GENE     ,"
                     " SP_NOMLONG          ,"
                     " SP_CDT_PRESCR_TEXTE ,"
                     " SP_ATC_DDD_TEXTE,"
                     " SP_CIPUCD13"
                     " FROM   sp_specialite,pr_produit"
                     " WHERE  SP_PR_CODE_FK = PR_CODE_SQ_PK"
                     " AND    UPPER(PR_NOM) LIKE UPPER('"+LIBTXT+"') ";


       if ( MonoVir == 0) {
 //+    SQL_QUERY := SQL_QUERY || ' AND (SP_MONO_VIRTUELLE = 0 OR SP_MONO_VIRTUELLE IS NULL) ';
                sql_query += " AND (SP_MONO_VIRTUELLE = 0 OR SP_MONO_VIRTUELLE IS NULL);";

       } else if ( MonoVir == 1) {
 //+    SQL_QUERY := SQL_QUERY || ' AND SP_MONO_VIRTUELLE = 1 ';
                sql_query += " AND SP_MONO_VIRTUELLE = 1;";

       }
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_PDT_TXT() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_SP_CODE_SQ_PK       = value(0).toDouble();
                m_SP_GSP_CODE_FK      = value(1).toDouble();
                m_SP_CDF_SLAB_CODE_FK = value(2).toString();
                m_SP_CDF_LI_CODE_FK   = value(3).toString();
                m_SP_CATC_CODE_FK     = value(4).toString();
                m_SP_CEPH_CODE_FK     = value(5).toString();
                m_SP_CGE_CODE_FK      = value(6).toDouble();
                m_SP_PR_CODE_FK       = value(7).toDouble();
                m_SP_TYPE_SPE         = value(8).toString();
                m_SP_GREF_FK          = value(9).toDouble();
                m_SP_GREF_DATECR_FK   = value(10).toDate();
                m_SP_NOM              = value(11).toString();
                m_SP_NOMCOMP          = value(12).toString();
                m_SP_PH               = value(13).toString();
                m_SP_CIPUCD           = value(14).toString();
                m_SP_DATECR           = value(15).toDate();
                m_SP_DATEMJ           = value(16).toDate();
                m_SP_NL               = value(17).toString();
                m_SP_APHP             = value(18).toString();
                m_SP_DATEJOGENE       = value(19).toDate();
                m_SP_ORIGINE_GENE     = value(20).toString();
                m_SP_NOMLONG          = value(21).toString();
                m_SP_CDT_PRESCR_TEXTE = value(22).toString();
                m_SP_ATC_DDD_TEXTE    = value(23).toString();
                m_SP_CIPUCD13         = value(24).toString();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      double  SP_CODE_SQ_PK()       {return m_SP_CODE_SQ_PK;}
      double  SP_GSP_CODE_FK()      {return m_SP_GSP_CODE_FK;}
      QString SP_CDF_SLAB_CODE_FK() {return m_SP_CDF_SLAB_CODE_FK;}
      QString SP_CDF_LI_CODE_FK()   {return m_SP_CDF_LI_CODE_FK;}
      QString SP_CATC_CODE_FK()     {return m_SP_CATC_CODE_FK;}
      QString SP_CEPH_CODE_FK()     {return m_SP_CEPH_CODE_FK;}
      double  SP_CGE_CODE_FK()      {return m_SP_CGE_CODE_FK;}
      double  SP_PR_CODE_FK()       {return m_SP_PR_CODE_FK;}
      QString SP_TYPE_SPE()         {return m_SP_TYPE_SPE;}
      double  SP_GREF_FK()          {return m_SP_GREF_FK;}
      QDate   SP_GREF_DATECR_FK()   {return m_SP_GREF_DATECR_FK;}
      QString SP_NOM()              {return m_SP_NOM;}
      QString SP_NOMCOMP()          {return m_SP_NOMCOMP;}
      QString SP_PH()               {return m_SP_PH;}
      QString SP_CIPUCD()           {return m_SP_CIPUCD;}
      QDate   SP_DATECR()           {return m_SP_DATECR;}
      QDate   SP_DATEMJ()           {return m_SP_DATEMJ;}
      QString SP_NL()               {return m_SP_NL;}
      QString SP_APHP()             {return m_SP_APHP;}
      QDate   SP_DATEJOGENE()       {return m_SP_DATEJOGENE;}
      QString SP_ORIGINE_GENE()     {return m_SP_ORIGINE_GENE;}
      QString SP_NOMLONG()          {return m_SP_NOMLONG;}
      QString SP_CDT_PRESCR_TEXTE() {return m_SP_CDT_PRESCR_TEXTE;}
      QString SP_ATC_DDD_TEXTE()    {return m_SP_ATC_DDD_TEXTE;}
      QString SP_CIPUCD13()         {return m_SP_CIPUCD13;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      double  m_SP_CODE_SQ_PK;
      double  m_SP_GSP_CODE_FK;
      QString m_SP_CDF_SLAB_CODE_FK;
      QString m_SP_CDF_LI_CODE_FK;
      QString m_SP_CATC_CODE_FK;
      QString m_SP_CEPH_CODE_FK;
      double  m_SP_CGE_CODE_FK;
      double  m_SP_PR_CODE_FK;
      QString m_SP_TYPE_SPE;
      double  m_SP_GREF_FK;
      QDate   m_SP_GREF_DATECR_FK;
      QString m_SP_NOM;
      QString m_SP_NOMCOMP;
      QString m_SP_PH;
      QString m_SP_CIPUCD;
      QDate   m_SP_DATECR;
      QDate   m_SP_DATEMJ;
      QString m_SP_NL;
      QString m_SP_APHP;
      QDate   m_SP_DATEJOGENE;
      QString m_SP_ORIGINE_GENE;
      QString m_SP_NOMLONG;
      QString m_SP_CDT_PRESCR_TEXTE;
      QString m_SP_ATC_DDD_TEXTE;
      QString m_SP_CIPUCD13;
 };

 //================================== C_GET_THE_PDT_ID_CUR   -13- ==================================
 /***************************************************************************
 *   Nom           :  GET_THE_PDT_ID
 -----------------------------------------------------------------------------
 *   Date creation : 10/07/2008
 -----------------------------------------------------------------------------
 *   Description   :  cette procédure renvoie la fiches spécialité repondant
 *                    au code produit passé en paramétre
 *
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_PDT_ID_CUR  C_GET_THE_PDT_ID ( database(), this );
      while ( C_GET_THE_PDT_ID.next( CodeId  ) )
            { html += tr("<br><b> GET_THE_PDT_ID : </b>  ") + C_GET_THE_PDT_ID.MEMBER();
            }
  */
  class C_GET_THE_PDT_ID_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_PDT_ID_CUR ---------------------
      C_GET_THE_PDT_ID_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( double CodeId )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............

 //+      SELECT SP_CODE_SQ_PK       ,
 //+             SP_GSP_CODE_FK      ,
 //+             SP_CDF_SLAB_CODE_FK ,
 //+             SP_CDF_LI_CODE_FK   ,
 //+             SP_CATC_CODE_FK     ,
 //+             SP_CEPH_CODE_FK     ,
 //+             SP_CGE_CODE_FK      ,
 //+             SP_PR_CODE_FK       ,
 //+             SP_TYPE_SPE         ,
 //+             SP_GREF_FK          ,
 //+             SP_GREF_DATECR_FK   ,
 //+             SP_NOM              ,
 //+             SP_NOMCOMP          ,
 //+             SP_PH               ,
 //+             SP_CIPUCD           ,
 //+             SP_DATECR           ,
 //+             SP_DATEMJ           ,
 //+             SP_NL               ,
 //+             SP_APHP             ,
 //+             SP_DATEJOGENE       ,
 //+             SP_ORIGINE_GENE     ,
 //+             SP_NOMLONG          ,
 //+             SP_CDT_PRESCR_TEXTE ,
 //+             SP_ATC_DDD_TEXTE,
 //+    SP_CIPUCD13
 //+      FROM   SP_SPECIALITE
 //+      WHERE  SP_PR_CODE_FK = CodeId;
                sql_query += " SELECT SP_CODE_SQ_PK       ,"
                     " SP_GSP_CODE_FK      ,"
                     " SP_CDF_SLAB_CODE_FK ,"
                     " SP_CDF_LI_CODE_FK   ,"
                     " SP_CATC_CODE_FK     ,"
                     " SP_CEPH_CODE_FK     ,"
                     " SP_CGE_CODE_FK      ,"
                     " SP_PR_CODE_FK       ,"
                     " SP_TYPE_SPE         ,"
                     " SP_GREF_FK          ,"
                     " SP_GREF_DATECR_FK   ,"
                     " SP_NOM              ,"
                     " SP_NOMCOMP          ,"
                     " SP_PH               ,"
                     " SP_CIPUCD           ,"
                     " SP_DATECR           ,"
                     " SP_DATEMJ           ,"
                     " SP_NL               ,"
                     " SP_APHP             ,"
                     " SP_DATEJOGENE       ,"
                     " SP_ORIGINE_GENE     ,"
                     " SP_NOMLONG          ,"
                     " SP_CDT_PRESCR_TEXTE ,"
                     " SP_ATC_DDD_TEXTE,"
                     " SP_CIPUCD13"
                     " FROM   sp_specialite"
                     " WHERE  SP_PR_CODE_FK  = '"+ QString::number( CodeId ) +"';";
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_PDT_ID() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_SP_CODE_SQ_PK       = value(0).toDouble();
                m_SP_GSP_CODE_FK      = value(1).toDouble();
                m_SP_CDF_SLAB_CODE_FK = value(2).toString();
                m_SP_CDF_LI_CODE_FK   = value(3).toString();
                m_SP_CATC_CODE_FK     = value(4).toString();
                m_SP_CEPH_CODE_FK     = value(5).toString();
                m_SP_CGE_CODE_FK      = value(6).toDouble();
                m_SP_PR_CODE_FK       = value(7).toDouble();
                m_SP_TYPE_SPE         = value(8).toString();
                m_SP_GREF_FK          = value(9).toDouble();
                m_SP_GREF_DATECR_FK   = value(10).toDate();
                m_SP_NOM              = value(11).toString();
                m_SP_NOMCOMP          = value(12).toString();
                m_SP_PH               = value(13).toString();
                m_SP_CIPUCD           = value(14).toString();
                m_SP_DATECR           = value(15).toDate();
                m_SP_DATEMJ           = value(16).toDate();
                m_SP_NL               = value(17).toString();
                m_SP_APHP             = value(18).toString();
                m_SP_DATEJOGENE       = value(19).toDate();
                m_SP_ORIGINE_GENE     = value(20).toString();
                m_SP_NOMLONG          = value(21).toString();
                m_SP_CDT_PRESCR_TEXTE = value(22).toString();
                m_SP_ATC_DDD_TEXTE    = value(23).toString();
                m_SP_CIPUCD13         = value(24).toString();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      double  SP_CODE_SQ_PK()       {return m_SP_CODE_SQ_PK;}
      double  SP_GSP_CODE_FK()      {return m_SP_GSP_CODE_FK;}
      QString SP_CDF_SLAB_CODE_FK() {return m_SP_CDF_SLAB_CODE_FK;}
      QString SP_CDF_LI_CODE_FK()   {return m_SP_CDF_LI_CODE_FK;}
      QString SP_CATC_CODE_FK()     {return m_SP_CATC_CODE_FK;}
      QString SP_CEPH_CODE_FK()     {return m_SP_CEPH_CODE_FK;}
      double  SP_CGE_CODE_FK()      {return m_SP_CGE_CODE_FK;}
      double  SP_PR_CODE_FK()       {return m_SP_PR_CODE_FK;}
      QString SP_TYPE_SPE()         {return m_SP_TYPE_SPE;}
      double  SP_GREF_FK()          {return m_SP_GREF_FK;}
      QDate   SP_GREF_DATECR_FK()   {return m_SP_GREF_DATECR_FK;}
      QString SP_NOM()              {return m_SP_NOM;}
      QString SP_NOMCOMP()          {return m_SP_NOMCOMP;}
      QString SP_PH()               {return m_SP_PH;}
      QString SP_CIPUCD()           {return m_SP_CIPUCD;}
      QDate   SP_DATECR()           {return m_SP_DATECR;}
      QDate   SP_DATEMJ()           {return m_SP_DATEMJ;}
      QString SP_NL()               {return m_SP_NL;}
      QString SP_APHP()             {return m_SP_APHP;}
      QDate   SP_DATEJOGENE()       {return m_SP_DATEJOGENE;}
      QString SP_ORIGINE_GENE()     {return m_SP_ORIGINE_GENE;}
      QString SP_NOMLONG()          {return m_SP_NOMLONG;}
      QString SP_CDT_PRESCR_TEXTE() {return m_SP_CDT_PRESCR_TEXTE;}
      QString SP_ATC_DDD_TEXTE()    {return m_SP_ATC_DDD_TEXTE;}
      QString SP_CIPUCD13()         {return m_SP_CIPUCD13;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      double  m_SP_CODE_SQ_PK;
      double  m_SP_GSP_CODE_FK;
      QString m_SP_CDF_SLAB_CODE_FK;
      QString m_SP_CDF_LI_CODE_FK;
      QString m_SP_CATC_CODE_FK;
      QString m_SP_CEPH_CODE_FK;
      double  m_SP_CGE_CODE_FK;
      double  m_SP_PR_CODE_FK;
      QString m_SP_TYPE_SPE;
      double  m_SP_GREF_FK;
      QDate   m_SP_GREF_DATECR_FK;
      QString m_SP_NOM;
      QString m_SP_NOMCOMP;
      QString m_SP_PH;
      QString m_SP_CIPUCD;
      QDate   m_SP_DATECR;
      QDate   m_SP_DATEMJ;
      QString m_SP_NL;
      QString m_SP_APHP;
      QDate   m_SP_DATEJOGENE;
      QString m_SP_ORIGINE_GENE;
      QString m_SP_NOMLONG;
      QString m_SP_CDT_PRESCR_TEXTE;
      QString m_SP_ATC_DDD_TEXTE;
      QString m_SP_CIPUCD13;
 };

 //================================== C_GET_THE_SUB_TXT_CUR   -14- ==================================
 /****************************************************************************
 *   Nom           :  GET_THE_SUB_TXT
 -----------------------------------------------------------------------------
 *   Date creation : 10/07/2008
 -----------------------------------------------------------------------------
 *   Description   :  cette procédure nous renvoie les substances actives ou excipient
 *                    le choix se fait a l'aide de parametre type (1 active,2 exipient,0 les deux)
 *                    repondant au libellé du nom passé en paramétre
 *
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_SUB_TXT_CUR  C_GET_THE_SUB_TXT ( database(), this );
      while ( C_GET_THE_SUB_TXT.next( LibTxt , VarType  ) )
            { html += tr("<br><b> GET_THE_SUB_TXT : </b>  ") + C_GET_THE_SUB_TXT.MEMBER();
            }
  */
  class C_GET_THE_SUB_TXT_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_SUB_TXT_CUR ---------------------
      C_GET_THE_SUB_TXT_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( QString LibTxt , double VarType )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............
       if ( VarType == 1) {

 //+         SELECT   sac_code_sq_pk       AS CODE_SQ_PK       ,
 //+                  sac_cdf_orn_code_fk  AS CDF_ORN_CODE_FK  ,
 //+                  sac_sau_code_fk      AS CODE_FK          ,
 //+                  sac_gsac_code_fk     AS GSAC_CODE_FK      ,
 //+                  sac_nom              AS NOM              ,
 //+                  sac_noma             AS NOMA             ,
 //+                  sac_datecr           AS DATECR           ,
 //+                  sac_datemj           AS DATEMJ           ,
 //+                  'A'                  AS TYPE_SUB
 //+         FROM     SAC_SUBACTIVE
 //+         WHERE    UPPER(sac_nom) LIKE UPPER(LibTxt)
 //+         ORDER BY SAC_NOM ASC;
                sql_query += " SELECT   SAC_CODE_SQ_PK       AS CODE_SQ_PK       ,"
                     " SAC_CDF_ORN_CODE_FK  AS CDF_ORN_CODE_FK  ,"
                     " SAC_SAU_CODE_FK      AS CODE_FK          ,"
                     " SAC_GSAC_CODE_FK     AS GSAC_CODE_FK      ,"
                     " SAC_NOM              AS NOM              ,"
                     " SAC_NOMA             AS NOMA             ,"
                     " SAC_DATECR           AS DATECR           ,"
                     " SAC_DATEMJ           AS DATEMJ           ,"
                     " 'A'                  AS TYPE_SUB"
                     " FROM     sac_subactive"
                     " WHERE    UPPER(sac_nom) LIKE UPPER('"+LibTxt+"')"
                     " ORDER BY SAC_NOM ASC;";

       } else if ( VarType == 2) {

 //+         SELECT   sau_code_sq_pk      AS CODE_SQ_PK       ,
 //+                  ''                  AS CDF_ORN_CODE_FK  ,
 //+                  sau_sac_code_fk     AS CODE_FK          ,
 //+                  sau_gsau_code_fk    AS GSA_CODE_FK      ,
 //+                  sau_nom             AS NOM              ,
 //+                  ''                  AS NOMA             ,
 //+                  sau_datecr          AS DATECR           ,
 //+                  sau_datemj          AS DATEMJ           ,
 //+                  'E'        AS TYPE_SUB
 //+         FROM     SAU_SUBAUXILIAIRE
 //+         WHERE    UPPER(SAU_NOM) LIKE UPPER(LibTxt)
 //+         ORDER BY SAU_NOM ASC;
                sql_query += " SELECT   SAU_CODE_SQ_PK      AS CODE_SQ_PK       ,"
                     " ''                  AS CDF_ORN_CODE_FK  ,"
                     " SAU_SAC_CODE_FK     AS CODE_FK          ,"
                     " SAU_GSAU_CODE_FK    AS GSA_CODE_FK      ,"
                     " SAU_NOM             AS NOM              ,"
                     " ''                  AS NOMA             ,"
                     " SAU_DATECR          AS DATECR           ,"
                     " SAU_DATEMJ          AS DATEMJ           ,"
                     " 'E'        AS TYPE_SUB"
                     " FROM     sau_subauxiliaire"
                     " WHERE    UPPER(SAU_NOM) LIKE UPPER('"+LibTxt+"')"
                     " ORDER BY SAU_NOM ASC;";

       } else if ( VarType == 0) {

 //+         SELECT   sac_code_sq_pk       AS CODE_SQ_PK       ,
 //+                  sac_cdf_orn_code_fk  AS CDF_ORN_CODE_FK  ,
 //+                  sac_sau_code_fk      AS CODE_FK          ,
 //+                  sac_gsac_code_fk     AS GSA_CODE_FK      ,
 //+                  sac_nom              AS NOM              ,
 //+                  sac_noma             AS NOMA             ,
 //+                  sac_datecr           AS DATECR           ,
 //+                  sac_datemj           AS DATEMJ           ,
 //+                  'A'         AS TYPE_SUB
 //+         FROM     SAC_SUBACTIVE
 //+         WHERE    UPPER(sac_nom) LIKE UPPER(LibTxt)
 //+         UNION
 //+         SELECT   sau_code_sq_pk      AS CODE_SQ_PK       ,
 //+                  ''                  AS CDF_ORN_CODE_FK  ,
 //+                  sau_sac_code_fk     AS CODE_FK          ,
 //+                  sau_gsau_code_fk    AS GSA_CODE_FK      ,
 //+                  sau_nom             AS NOM              ,
 //+                  ''                  AS NOMA             ,
 //+                  sau_datecr          AS DATECR           ,
 //+                  sau_datemj          AS DATEMJ           ,
 //+                  'E'        AS TYPE_SUB
 //+         FROM     SAU_SUBAUXILIAIRE
 //+         WHERE    UPPER(SAU_NOM) LIKE UPPER(LibTxt);
                sql_query += " SELECT   SAC_CODE_SQ_PK       AS CODE_SQ_PK       ,"
                     " SAC_CDF_ORN_CODE_FK  AS CDF_ORN_CODE_FK  ,"
                     " SAC_SAU_CODE_FK      AS CODE_FK          ,"
                     " SAC_GSAC_CODE_FK     AS GSA_CODE_FK      ,"
                     " SAC_NOM              AS NOM              ,"
                     " SAC_NOMA             AS NOMA             ,"
                     " SAC_DATECR           AS DATECR           ,"
                     " SAC_DATEMJ           AS DATEMJ           ,"
                     " 'A'         AS TYPE_SUB"
                     " FROM     sac_subactive"
                     " WHERE    UPPER(sac_nom) LIKE UPPER('"+LibTxt+"')"
                     " UNION"
                     " SELECT   sau_code_sq_pk      AS CODE_SQ_PK       ,"
                     " ''                  AS CDF_ORN_CODE_FK  ,"
                     " SAU_SAC_CODE_FK     AS CODE_FK          ,"
                     " SAU_GSAU_CODE_FK    AS GSA_CODE_FK      ,"
                     " SAU_NOM             AS NOM              ,"
                     " ''                  AS NOMA             ,"
                     " SAU_DATECR          AS DATECR           ,"
                     " SAU_DATEMJ          AS DATEMJ           ,"
                     " 'E'        AS TYPE_SUB"
                     " FROM     sau_subauxiliaire"
                     " WHERE    UPPER(SAU_NOM) LIKE UPPER('"+LibTxt+"');";

       } else {
 //+       C_GET_THE_SUB_TXT := NULL;
         return 0;
       }
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_SUB_TXT() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_CODE_SQ_PK      = value(0).toDouble();
                m_CDF_ORN_CODE_FK = value(1).toString();
                m_CODE_FK         = value(2).toDouble();
                m_GSAC_CODE_FK    = value(3).toDouble();
                m_NOM             = value(4).toString();
                m_NOMA            = value(5).toString();
                m_DATECR          = value(6).toDate();
                m_DATEMJ          = value(7).toDate();
                m_TYPE_SUB        = value(8).toString();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      double  CODE_SQ_PK()      {return m_CODE_SQ_PK;}
      QString CDF_ORN_CODE_FK() {return m_CDF_ORN_CODE_FK;}
      double  CODE_FK()         {return m_CODE_FK;}
      double  GSAC_CODE_FK()    {return m_GSAC_CODE_FK;}
      QString NOM()             {return m_NOM;}
      QString NOMA()            {return m_NOMA;}
      QDate   DATECR()          {return m_DATECR;}
      QDate   DATEMJ()          {return m_DATEMJ;}
      QString TYPE_SUB()        {return m_TYPE_SUB;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      double  m_CODE_SQ_PK;
      QString m_CDF_ORN_CODE_FK;
      double  m_CODE_FK;
      double  m_GSAC_CODE_FK;
      QString m_NOM;
      QString m_NOMA;
      QDate   m_DATECR;
      QDate   m_DATEMJ;
      QString m_TYPE_SUB;
 };

 //================================== C_GET_THE_SUB_ID_CUR   -15- ==================================
 /****************************************************************************
 *   Nom           :  GET_THE_SUB_ID
 -----------------------------------------------------------------------------
 *   Date creation : 10/07/2008
 -----------------------------------------------------------------------------
 *   Description   :  cette procédure nous renvoie les substances actives ou excipient,
 *                    repondant au code passé en paramétre
 *
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_SUB_ID_CUR  C_GET_THE_SUB_ID ( database(), this );
      while ( C_GET_THE_SUB_ID.next( CodeId , VarType  ) )
            { html += tr("<br><b> GET_THE_SUB_ID : </b>  ") + C_GET_THE_SUB_ID.MEMBER();
            }
  */
  class C_GET_THE_SUB_ID_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_SUB_ID_CUR ---------------------
      C_GET_THE_SUB_ID_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( double CodeId , double VarType )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............
       if ( VarType == 1) {

 //+         SELECT   SAC_CODE_SQ_PK      ,
 //+                  SAC_CDF_ORN_CODE_FK ,
 //+                  SAC_SAU_CODE_FK     ,
 //+                  SAC_GSAC_CODE_FK    ,
 //+                  SAC_NOM             ,
 //+                  SAC_NOMA            ,
 //+                  SAC_DATECR          ,
 //+                  SAC_DATEMJ    ,
 //+      'A'    AS TYPE_SUB
 //+         FROM     SAC_SUBACTIVE
 //+         WHERE    SAC_CODE_SQ_PK = CodeId
 //+         ORDER BY SAC_NOM ASC;
                sql_query += " SELECT   SAC_CODE_SQ_PK      ,"
                     " SAC_CDF_ORN_CODE_FK ,"
                     " SAC_SAU_CODE_FK     ,"
                     " SAC_GSAC_CODE_FK    ,"
                     " SAC_NOM             ,"
                     " SAC_NOMA            ,"
                     " SAC_DATECR          ,"
                     " SAC_DATEMJ    ,"
                     " 'A'    AS TYPE_SUB"
                     " FROM     sac_subactive"
                     " WHERE    SAC_CODE_SQ_PK  = '"+ QString::number( CodeId ) +"'"
                     " ORDER BY SAC_NOM ASC;";

       } else if ( VarType == 2) {

 //+         SELECT   sau_code_sq_pk      AS SAC_CODE_SQ_PK      ,
 //+                  NULL                AS SAC_CDF_ORN_CODE_FK ,
 //+                  sau_sac_code_fk     AS SAC_SAU_CODE_FK     ,
 //+                  sau_gsau_code_fk    AS SAC_GSAC_CODE_FK    ,
 //+                  sau_nom             AS SAC_NOM             ,
 //+                  NULL                AS SAC_NOMA            ,
 //+                  sau_datecr          AS SAC_DATECR          ,
 //+                  sau_datemj          AS SAC_DATEMJ          ,
 //+      'E'         AS TYPE_SUB
 //+         FROM     SAU_SUBAUXILIAIRE
 //+         WHERE    SAU_CODE_SQ_PK = CodeId
 //+         ORDER BY SAU_NOM ASC;
                sql_query += " SELECT   SAU_CODE_SQ_PK      AS SAC_CODE_SQ_PK      ,"
                     " NULL                AS SAC_CDF_ORN_CODE_FK ,"
                     " SAU_SAC_CODE_FK     AS SAC_SAU_CODE_FK     ,"
                     " SAU_GSAU_CODE_FK    AS SAC_GSAC_CODE_FK    ,"
                     " SAU_NOM             AS SAC_NOM             ,"
                     " NULL                AS SAC_NOMA            ,"
                     " SAU_DATECR          AS SAC_DATECR          ,"
                     " SAU_DATEMJ          AS SAC_DATEMJ          ,"
                     " 'E'         AS TYPE_SUB"
                     " FROM     sau_subauxiliaire"
                     " WHERE    SAU_CODE_SQ_PK  = '"+ QString::number( CodeId ) +"'"
                     " ORDER BY SAU_NOM ASC;";

       } else {
 //+       C_GET_THE_SUB_ID := NULL;
         return 0;
       }
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_SUB_ID() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_SAC_CODE_SQ_PK      = value(0).toDouble();
                m_SAC_CDF_ORN_CODE_FK = value(1).toString();
                m_SAC_SAU_CODE_FK     = value(2).toDouble();
                m_SAC_GSAC_CODE_FK    = value(3).toDouble();
                m_SAC_NOM             = value(4).toString();
                m_SAC_NOMA            = value(5).toString();
                m_SAC_DATECR          = value(6).toDate();
                m_SAC_DATEMJ          = value(7).toDate();
                m_TYPE_SUB            = value(8).toString();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      double  SAC_CODE_SQ_PK()      {return m_SAC_CODE_SQ_PK;}
      QString SAC_CDF_ORN_CODE_FK() {return m_SAC_CDF_ORN_CODE_FK;}
      double  SAC_SAU_CODE_FK()     {return m_SAC_SAU_CODE_FK;}
      double  SAC_GSAC_CODE_FK()    {return m_SAC_GSAC_CODE_FK;}
      QString SAC_NOM()             {return m_SAC_NOM;}
      QString SAC_NOMA()            {return m_SAC_NOMA;}
      QDate   SAC_DATECR()          {return m_SAC_DATECR;}
      QDate   SAC_DATEMJ()          {return m_SAC_DATEMJ;}
      QString TYPE_SUB()            {return m_TYPE_SUB;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      double  m_SAC_CODE_SQ_PK;
      QString m_SAC_CDF_ORN_CODE_FK;
      double  m_SAC_SAU_CODE_FK;
      double  m_SAC_GSAC_CODE_FK;
      QString m_SAC_NOM;
      QString m_SAC_NOMA;
      QDate   m_SAC_DATECR;
      QDate   m_SAC_DATEMJ;
      QString m_TYPE_SUB;
 };

 //================================== C_GET_THE_EXP_ID_CUR   -16- ==================================
 /***************************************************************************
 *   Nom           :  GET_THE_EXP_ID
 -----------------------------------------------------------------------------
 *   Date creation : 10/07/2008
 -----------------------------------------------------------------------------
 *   Description   :  cette procédure renvoie la substance de type excipient
 *                    repondant au code passé en parametre
 *   Maj           :  04/02/2009 - Mourad
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_EXP_ID_CUR  C_GET_THE_EXP_ID ( database(), this );
      while ( C_GET_THE_EXP_ID.next( CodeId  ) )
            { html += tr("<br><b> GET_THE_EXP_ID : </b>  ") + C_GET_THE_EXP_ID.MEMBER();
            }
  */
  class C_GET_THE_EXP_ID_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_EXP_ID_CUR ---------------------
      C_GET_THE_EXP_ID_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( double CodeId )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............

 //+       SELECT   SAU_CODE_SQ_PK     ,
 //+                SAU_SAC_CODE_FK    ,
 //+                SAU_GSAU_CODE_FK   ,
 //+                SAU_NOM            ,
 //+                SAU_DATECR         ,
 //+                SAU_DATEMJ         ,
 //+                SAU_EFFETNOTOIRE   ,
 //+                CDF_NOM            ,
 //+                SAU_DOC_DATE       ,
 //+                SAU_TEXTE
 //+       FROM     SAU_SUBAUXILIAIRE  ,
 //+                CDF_CODIF
 //+       WHERE    CDF_CODE_PK   (+) =  SAU_CDF_DOC_CODE_FK
 //+       AND      CDF_NUMERO_PK (+) = '25'
 //+       AND      SAU_CODE_SQ_PK = CodeId
 //+       ORDER BY SAU_NOM ASC;
                sql_query += " SELECT   SAU_CODE_SQ_PK     ,"
                     " SAU_SAC_CODE_FK    ,"
                     " SAU_GSAU_CODE_FK   ,"
                     " SAU_NOM            ,"
                     " SAU_DATECR         ,"
                     " SAU_DATEMJ         ,"
                     " SAU_EFFETNOTOIRE   ,"
                     " CDF_NOM            ,"
                     " SAU_DOC_DATE       ,"
                     " SAU_TEXTE"
                     " FROM     sau_subauxiliaire  ,"
                     " cdf_codif"
                     " WHERE    CDF_CODE_PK    =  SAU_CDF_DOC_CODE_FK"
                     " AND      CDF_NUMERO_PK  = '25'"
                     " AND      SAU_CODE_SQ_PK  = '"+ QString::number( CodeId ) +"'"
                     " ORDER BY SAU_NOM ASC;";
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_EXP_ID() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_SAU_CODE_SQ_PK   = value(0).toDouble();
                m_SAU_SAC_CODE_FK  = value(1).toDouble();
                m_SAU_GSAU_CODE_FK = value(2).toDouble();
                m_SAU_NOM          = value(3).toString();
                m_SAU_DATECR       = value(4).toDate();
                m_SAU_DATEMJ       = value(5).toDate();
                m_SAU_EFFETNOTOIRE = value(6).toString();
                m_CDF_NOM          = value(7).toString();
                m_SAU_DOC_DATE     = value(8).toDate();
                m_SAU_TEXTE        = value(9).toString();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      double  SAU_CODE_SQ_PK()   {return m_SAU_CODE_SQ_PK;}
      double  SAU_SAC_CODE_FK()  {return m_SAU_SAC_CODE_FK;}
      double  SAU_GSAU_CODE_FK() {return m_SAU_GSAU_CODE_FK;}
      QString SAU_NOM()          {return m_SAU_NOM;}
      QDate   SAU_DATECR()       {return m_SAU_DATECR;}
      QDate   SAU_DATEMJ()       {return m_SAU_DATEMJ;}
      QString SAU_EFFETNOTOIRE() {return m_SAU_EFFETNOTOIRE;}
      QString CDF_NOM()          {return m_CDF_NOM;}
      QDate   SAU_DOC_DATE()     {return m_SAU_DOC_DATE;}
      QString SAU_TEXTE()        {return m_SAU_TEXTE;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      double  m_SAU_CODE_SQ_PK;
      double  m_SAU_SAC_CODE_FK;
      double  m_SAU_GSAU_CODE_FK;
      QString m_SAU_NOM;
      QDate   m_SAU_DATECR;
      QDate   m_SAU_DATEMJ;
      QString m_SAU_EFFETNOTOIRE;
      QString m_CDF_NOM;
      QDate   m_SAU_DOC_DATE;
      QString m_SAU_TEXTE;
 };

 //================================== C_GET_THE_SUB_SPE_CUR   -17- ==================================
 /****************************************************************************
 *   Nom           :  GET_THE_SUB_SPE
 -----------------------------------------------------------------------------
 *   Date creation : 10/07/2008
 -----------------------------------------------------------------------------
 *   Description   :  cette procédure nous renvoie la composition,
 *                    pour le code identifiant specialité passé en parametre
 *   MAJ           :  04/02/2009 - Mourad
         16/02/2009
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_SUB_SPE_CUR  C_GET_THE_SUB_SPE ( database(), this );
      while ( C_GET_THE_SUB_SPE.next( CodeId , TypId  ) )
            { html += tr("<br><b> GET_THE_SUB_SPE : </b>  ") + C_GET_THE_SUB_SPE.MEMBER();
            }
  */
  class C_GET_THE_SUB_SPE_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_SUB_SPE_CUR ---------------------
      C_GET_THE_SUB_SPE_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( double CodeId , double TypId )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............
       if ( TypId == 1) {

 //+        SELECT   'E'                    AS TYPSUBST    ,
 //+                 ex.sau_code_sq_pk      AS CODESUBST   ,
 //+                 cp.cosau_dosage        AS DOSESUBST   ,
 //+                 cp.cosau_unitedosage   AS UDOSESUBST  ,
 //+                 ex.sau_gsau_code_fk    AS SUBACTPERE  ,
 //+                 ex.sau_nom             AS LIBSUBST    ,
 //+     cp.cosau_numord        AS NUMORDRE    ,
 //+                 cp.cosau_compo_num_pk  AS COMPORDRE
 //+        FROM     COSAU_COMPO_SUBAUX cp,
 //+                 SAU_SUBAUXILIAIRE  ex
 //+        WHERE    cp.COSAU_SAU_CODE_FK_PK = ex.SAU_CODE_SQ_PK
 //+        AND      cp.COSAU_SP_CODE_FK_PK  = CodeId
 //+        ORDER BY cp.COSAU_NUMORD ;
                sql_query += " SELECT   'E'                    AS TYPSUBST    ,"
                     " ex.SAU_CODE_SQ_PK      AS CODESUBST   ,"
                     " cp.COSAU_DOSAGE        AS DOSESUBST   ,"
                     " cp.COSAU_UNITEDOSAGE   AS UDOSESUBST  ,"
                     " ex.SAU_GSAU_CODE_FK    AS SUBACTPERE  ,"
                     " ex.SAU_NOM             AS LIBSUBST    ,"
                     " cp.COSAU_NUMORD        AS NUMORDRE    ,"
                     " cp.COSAU_COMPO_NUM_PK  AS COMPORDRE"
                     " FROM     cosau_compo_subaux cp,"
                     " sau_subauxiliaire  ex"
                     " WHERE    cp.COSAU_SAU_CODE_FK_PK = ex.SAU_CODE_SQ_PK"
                     " AND      cp.COSAU_SP_CODE_FK_PK   = '"+ QString::number( CodeId ) +"'"
                     " ORDER BY cp.COSAU_NUMORD ;";

       } else if ( TypId == 2) {

 //+         SELECT  'A.'||cp.cosac_compo_num_pk||'.'||cp.cosac_numord||'.A'  AS TYPSUBST  ,
 //+                  sa.sac_code_sq_pk  AS CODESUBST  ,
 //+                  cp.cosac_dosage  AS DOSESUBST  ,
 //+                  cp.cosac_unitedosage AS UDOSESUBST ,
 //+                  sa.sac_gsac_code_fk AS SUBACTPERE ,
 //+                  sa.sac_nom   AS LIBSUBST   ,
 //+      cp.cosac_numord       AS NUMORDRE   ,
 //+                  cp.cosac_compo_num_pk AS COMPORDRE
 //+         FROM     COSAC_COMPO_SUBACT cp,
 //+                  SAC_SUBACTIVE sa
 //+         WHERE    cp.COSAC_SAC_CODE_FK_PK = sa.SAC_CODE_SQ_PK
 //+         AND      cp.COSAC_SP_CODE_FK_PK  = CodeId
 //+         UNION
 //+         SELECT  'A.'||cp.cosac_compo_num_pk||'.'||cp.cosac_numord||'.B'   AS TYPSUBST   ,
 //+                  cp.COSAC_SAC_CODE_FK_PK  AS CODESUBST  ,
 //+                  TO_CHAR(cp.cosac_dosage_base) AS DOSESUBST  ,
 //+                  cp.cosac_unitedosage AS UDOSESUBST ,
 //+                  sa.sac_gsac_code_fk AS SUBACTPERE ,
 //+                  sa.sac_nom   AS LIBSUBST   ,
 //+      cp.COSAC_NUMORD       AS NUMORDRE   ,
 //+                  cp.COSAC_COMPO_NUM_PK AS COMPORDRE
 //+         FROM     COSAC_COMPO_SUBACT cp,
 //+                  SAC_SUBACTIVE sa
 //+         WHERE    cp.COSAC_SAC_BASE_CODE_FK     = sa.SAC_CODE_SQ_PK
 //+         AND      cp.COSAC_SP_CODE_FK_PK        = CodeId
 //+         AND      NVL( cp.COSAC_DOSAGE_BASE,0) != 0
 //+  ORDER BY 1 ;
                sql_query += " SELECT  COSAC_COMPO_NUM_PK   AS TYPSUBST  ,"
                     " sa.SAC_CODE_SQ_PK  AS CODESUBST  ,"
                     " cp.COSAC_DOSAGE  AS DOSESUBST  ,"
                     " cp.COSAC_UNITEDOSAGE AS UDOSESUBST ,"
                     " sa.SAC_GSAC_CODE_FK AS SUBACTPERE ,"
                     " sa.SAC_NOM   AS LIBSUBST   ,"
                     " cp.COSAC_NUMORD       AS NUMORDRE   ,"
                     " cp.COSAC_COMPO_NUM_PK AS COMPORDRE"
                     " FROM     cosac_compo_subact cp,"
                     " sac_subactive sa"
                     " WHERE    cp.COSAC_SAC_CODE_FK_PK = sa.SAC_CODE_SQ_PK"
                     " AND      cp.COSAC_SP_CODE_FK_PK   = '"+ QString::number( CodeId ) +"'"
                     " UNION"
                     " SELECT  COSAC_COMPO_NUM_PK   AS TYPSUBST   ,"
                     " cp.COSAC_SAC_CODE_FK_PK  AS CODESUBST  ,"
                     " (cp.COSAC_DOSAGE_BASE) AS DOSESUBST  , "  //-- removing TO_CHAR  may bee replace by ?  lpad(format(i, 0), 4, '0') ou CAST(nombre as char) "
                     " cp.COSAC_UNITEDOSAGE AS UDOSESUBST ,"
                     " sa.SAC_GSAC_CODE_FK AS SUBACTPERE ,"
                     " sa.SAC_NOM   AS LIBSUBST   ,"
                     " cp.COSAC_NUMORD       AS NUMORDRE   ,"
                     " cp.COSAC_COMPO_NUM_PK AS COMPORDRE"
                     " FROM     cosac_compo_subact cp,"
                     " sac_subactive sa"
                     " WHERE    cp.COSAC_SAC_BASE_CODE_FK     = sa.SAC_CODE_SQ_PK"
                     " AND      cp.COSAC_SP_CODE_FK_PK         = '"+ QString::number( CodeId ) +"'"
                     " AND      IFNULL( cp.COSAC_DOSAGE_BASE,0) != 0 "  //-- replace NVL  by   IFNULL"
                     " ORDER BY 1 ;";

       } else if ( TypId == 3) {

 //+       SELECT    'E'   AS TYPSUBST ,
 //+                 ex.sau_code_sq_pk      AS CODESUBST ,
 //+                 cp.cosau_dosage        AS DOSESUBST ,
 //+                 cp.cosau_unitedosage   AS UDOSESUBST,
 //+                 ex.sau_gsau_code_fk    AS SUBACTPERE,
 //+                 ex.sau_nom             AS LIBSUBST  ,
 //+     cp.cosau_numord        AS NUMORDRE  ,
 //+                 cp.cosau_compo_num_pk  AS COMPORDRE
 //+        FROM     COSAU_COMPO_SUBAUX cp,
 //+                 SAU_SUBAUXILIAIRE  ex
 //+        WHERE    cp.COSAU_SAU_CODE_FK_PK = ex.SAU_CODE_SQ_PK
 //+        AND      cp.COSAU_SP_CODE_FK_PK  = CodeId
 //+        UNION
 //+        SELECT   'A.'||cp.cosac_compo_num_pk||'.'||cp.cosac_numord||'.A'  AS TYPSUBST   ,
 //+                  sa.sac_code_sq_pk AS CODESUBST  ,
 //+                  cp.cosac_dosage AS DOSESUBST  ,
 //+                  cp.cosac_unitedosage AS UDOSESUBST ,
 //+                  sa.sac_gsac_code_fk AS SUBACTPERE ,
 //+                  sa.sac_nom            AS LIBSUBST   ,
 //+      cp.cosac_numord       AS NUMORDRE   ,
 //+      cp.cosac_compo_num_pk AS COMPORDRE
 //+         FROM     COSAC_COMPO_SUBACT cp,
 //+                  SAC_SUBACTIVE sa
 //+         WHERE    cp.COSAC_SAC_CODE_FK_PK = sa.SAC_CODE_SQ_PK
 //+         AND      cp.COSAC_SP_CODE_FK_PK  = CodeId
 //+         UNION
 //+         SELECT  'A.'||cp.cosac_compo_num_pk||'.'||cp.cosac_numord||'.B'   AS TYPSUBST   ,
 //+                  cp.COSAC_SAC_CODE_FK_PK AS CODESUBST  ,
 //+                  TO_CHAR(cp.cosac_dosage_base) AS DOSESUBST  ,
 //+                  cp.cosac_unitedosage AS UDOSESUBST ,
 //+                  sa.sac_gsac_code_fk AS SUBACTPERE ,
 //+                  sa.sac_nom   AS LIBSUBST  ,
 //+      cp.cosac_numord       AS NUMORDRE   ,
 //+      cp.cosac_compo_num_pk AS COMPORDRE
 //+         FROM     COSAC_COMPO_SUBACT cp,
 //+                  SAC_SUBACTIVE sa
 //+         WHERE    cp.COSAC_SAC_BASE_CODE_FK     = sa.SAC_CODE_SQ_PK
 //+         AND      cp.COSAC_SP_CODE_FK_PK        = CodeId
 //+         AND      NVL( cp.COSAC_DOSAGE_BASE,0) != 0
 //+  ORDER BY 1 ;
                sql_query += " SELECT    'E'   AS TYPSUBST ,"
                     " ex.SAU_CODE_SQ_PK      AS CODESUBST ,"
                     " cp.COSAU_DOSAGE        AS DOSESUBST ,"
                     " cp.COSAU_UNITEDOSAGE   AS UDOSESUBST,"
                     " ex.SAU_GSAU_CODE_FK    AS SUBACTPERE,"
                     " ex.SAU_NOM             AS LIBSUBST  ,"
                     " cp.COSAU_NUMORD        AS NUMORDRE  ,"
                     " cp.COSAU_COMPO_NUM_PK  AS COMPORDRE"
                     " FROM     cosau_compo_subaux cp,"
                     " sau_subauxiliaire  ex"
                     " WHERE    cp.COSAU_SAU_CODE_FK_PK = ex.SAU_CODE_SQ_PK"
                     " AND      cp.COSAU_SP_CODE_FK_PK   = '"+ QString::number( CodeId ) +"'"
                     " UNION"
                     " SELECT   'A.'cp.cosac_compo_num_pk.'cp.cosac_numord.A'  AS TYPSUBST   ,"
                     " sa.SAC_CODE_SQ_PK AS CODESUBST  ,"
                     " cp.COSAC_DOSAGE AS DOSESUBST  ,"
                     " cp.COSAC_UNITEDOSAGE AS UDOSESUBST ,"
                     " sa.SAC_GSAC_CODE_FK AS SUBACTPERE ,"
                     " sa.SAC_NOM            AS LIBSUBST   ,"
                     " cp.COSAC_NUMORD       AS NUMORDRE   ,"
                     " cp.COSAC_COMPO_NUM_PK AS COMPORDRE"
                     " FROM     cosac_compo_subact cp,"
                     " sac_subactive sa"
                     " WHERE    cp.COSAC_SAC_CODE_FK_PK = sa.SAC_CODE_SQ_PK"
                     " AND      cp.COSAC_SP_CODE_FK_PK   = '"+ QString::number( CodeId ) +"'"
                     " UNION"
                     " SELECT  'A.'cp.cosac_compo_num_pk.'cp.cosac_numord.B'   AS TYPSUBST   ,"
                     " cp.COSAC_SAC_CODE_FK_PK AS CODESUBST  ,"
                     " (cp.COSAC_DOSAGE_BASE) AS DOSESUBST  , "  //-- removing TO_CHAR  may bee replace by ?  lpad(format(i, 0), 4, '0') ou CAST(nombre as char) "
                     " cp.COSAC_UNITEDOSAGE AS UDOSESUBST ,"
                     " sa.SAC_GSAC_CODE_FK AS SUBACTPERE ,"
                     " sa.SAC_NOM   AS LIBSUBST  ,"
                     " cp.COSAC_NUMORD       AS NUMORDRE   ,"
                     " cp.COSAC_COMPO_NUM_PK AS COMPORDRE"
                     " FROM     cosac_compo_subact cp,"
                     " sac_subactive sa"
                     " WHERE    cp.COSAC_SAC_BASE_CODE_FK     = sa.SAC_CODE_SQ_PK"
                     " AND      cp.COSAC_SP_CODE_FK_PK         = '"+ QString::number( CodeId ) +"'"
                     " AND      IFNULL( cp.COSAC_DOSAGE_BASE,0) != 0 "  //-- replace NVL  by   IFNULL"
                     " ORDER BY 1 ;";

       } else if ( TypId == 4) {

 //+         SELECT  'E'    AS TYPSUBST   ,
 //+                 NULL AS CODESUBST  ,
 //+                 NULL AS DOSESUBST  ,
 //+                 NULL AS UDOSESUBST ,
 //+                 NULL   AS SUBACTPERE ,
 //+                 t2.CDF_NOM      AS LIBSUBST   ,
 //+     t1.COMPO_NUM_PK AS NUMORDRE   ,
 //+     NULL            AS COMPORDRE
 //+        FROM     COMPO_COMPOSITION  t1,
 //+             CDF_CODIF          t2
 //+        WHERE    t1.COMPO_CDF_GAL_CODE_FK = t2.CDF_CODE_PK
 //+    AND      t2.CDF_NUMERO_PK         = '22'
 //+    AND      t1.COMPO_SP_CODE_FK_PK   = CodeId ;
                sql_query += " SELECT  'E'    AS TYPSUBST   ,"
                     " NULL AS CODESUBST  ,"
                     " NULL AS DOSESUBST  ,"
                     " NULL AS UDOSESUBST ,"
                     " NULL   AS SUBACTPERE ,"
                     " t2.CDF_NOM      AS LIBSUBST   ,"
                     " t1.COMPO_NUM_PK AS NUMORDRE   ,"
                     " NULL            AS COMPORDRE"
                     " FROM     compo_composition  t1,"
                     " cdf_codif          t2"
                     " WHERE    t1.COMPO_CDF_GAL_CODE_FK = t2.CDF_CODE_PK"
                     " AND      t2.CDF_NUMERO_PK         = '22'"
                     " AND      t1.COMPO_SP_CODE_FK_PK    = '"+ QString::number( CodeId ) +"' ;";

       } else {
 //+       C_GET_THE_SUB_SPE := NULL;
         return 0;
       }
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_SUB_SPE() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_TYPSUBST   = value(0).toString();
                m_CODESUBST  = value(1).toDouble();
                m_DOSESUBST  = value(2).toString();
                m_UDOSESUBST = value(3).toString();
                m_SUBACTPERE = value(4).toDouble();
                m_LIBSUBST   = value(5).toString();
                m_NUMORDRE   = value(6).toDouble();
                m_COMPORDRE  = value(7).toDouble();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      QString TYPSUBST()   {return m_TYPSUBST;}
      double  CODESUBST()  {return m_CODESUBST;}
      QString DOSESUBST()  {return m_DOSESUBST;}
      QString UDOSESUBST() {return m_UDOSESUBST;}
      double  SUBACTPERE() {return m_SUBACTPERE;}
      QString LIBSUBST()   {return m_LIBSUBST;}
      double  NUMORDRE()   {return m_NUMORDRE;}
      double  COMPORDRE()  {return m_COMPORDRE;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      QString m_TYPSUBST;
      double  m_CODESUBST;
      QString m_DOSESUBST;
      QString m_UDOSESUBST;
      double  m_SUBACTPERE;
      QString m_LIBSUBST;
      double  m_NUMORDRE;
      double  m_COMPORDRE;
 };

 //================================== C_GET_THE_SUB_PRECCOMP_SPE_CUR   -18- ==================================
 /***************************************************************************
 *   Nom           :  GET_THE_SUB_PRECCOMP_SPE
 -----------------------------------------------------------------------------
 *   Date creation : 14/07/2008
 -----------------------------------------------------------------------------
 *   Description   :  Cette procédure renvoie la précision de composition
 *                    pour le code identifiant spécialité passé en paramètre.
 *   MAJ           :  08/07/2008
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_SUB_PRECCOMP_SPE_CUR  C_GET_THE_SUB_PRECCOMP_SPE ( database(), this );
      while ( C_GET_THE_SUB_PRECCOMP_SPE.next( CodeId  ) )
            { html += tr("<br><b> GET_THE_SUB_PRECCOMP_SPE : </b>  ") + C_GET_THE_SUB_PRECCOMP_SPE.MEMBER();
            }
  */
  class C_GET_THE_SUB_PRECCOMP_SPE_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_SUB_PRECCOMP_SPE_CUR ---------------------
      C_GET_THE_SUB_PRECCOMP_SPE_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( double CodeId )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............

 //+  SELECT t3.spten_libelle    AS TEXTPREC ,
 //+     t2.CDF_NOM        AS REF_OFF  ,
 //+     t1.SPAFS_DATE_PK  AS DAT_OFF
 //+  FROM  SPAFS_SPECIALITE_AFSSAPS t1,
 //+    CDF_CODIF              t2,
 //+    SPTEN_SPECIALITE_TENEUR  t3
 //+  WHERE t1.SPAFS_RUBCDF_NUMERO_PK IN ('SX','SP')
 //+  AND t1.SPAFS_DATE_PK = ( SELECT  MAX(SPAFS_DATE_PK)
 //+           FROM    SPAFS_SPECIALITE_AFSSAPS
 //+           WHERE   SPAFS_RUBCDF_NUMERO_PK IN ('SX','SP')
 //+           AND     SPAFS_SP_CODE_FK_PK    = CodeId
 //+            )
 //+  AND t1.SPAFS_SP_CODE_FK_PK = t3.SPTEN_SP_CODE_FK_PK
 //+  AND t2.CDF_CODE_PK         = t1.SPAFS_CDF_CODE_DOC_FK_PK
 //+  AND t2.CDF_NUMERO_PK       = '25'
 //+  AND t3.SPTEN_SP_CODE_FK_PK = CodeId ;
                sql_query += " SELECT t3.SPTEN_LIBELLE    AS TEXTPREC ,"
                     " t2.CDF_NOM        AS REF_OFF  ,"
                     " t1.SPAFS_DATE_PK  AS DAT_OFF"
                     " FROM  spafs_specialite_afssaps t1,"
                     " cdf_codif              t2,"
                     " spten_specialite_teneur  t3"
                     " WHERE t1.SPAFS_RUBCDF_NUMERO_PK IN ('SX','SP')"
                     " AND t1.SPAFS_DATE_PK = ( SELECT  MAX(SPAFS_DATE_PK)"
                     " FROM    spafs_specialite_afssaps"
                     " WHERE   SPAFS_RUBCDF_NUMERO_PK IN ('SX','SP')"
                     " AND     SPAFS_SP_CODE_FK_PK     = '"+ QString::number( CodeId ) +"'"
                     " )"
                     " AND t1.SPAFS_SP_CODE_FK_PK = t3.SPTEN_SP_CODE_FK_PK"
                     " AND t2.CDF_CODE_PK         = t1.SPAFS_CDF_CODE_DOC_FK_PK"
                     " AND t2.CDF_NUMERO_PK       = '25'"
                     " AND t3.SPTEN_SP_CODE_FK_PK  = '"+ QString::number( CodeId ) +"' ;";
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_SUB_PRECCOMP_SPE() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_TEXTPREC = value(0).toString();
                m_REF_OFF  = value(1).toString();
                m_DAT_OFF  = value(2).toDate();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      QString TEXTPREC() {return m_TEXTPREC;}
      QString REF_OFF()  {return m_REF_OFF;}
      QDate   DAT_OFF()  {return m_DAT_OFF;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      QString m_TEXTPREC;
      QString m_REF_OFF;
      QDate   m_DAT_OFF;
 };

 //================================== C_GET_THE_SUB_TENEUR_SPE_CUR   -19- ==================================
 /***************************************************************************
 *   Nom           :  GET_THE_SUB_TENEUR_SPE
 -----------------------------------------------------------------------------
 *   Date creation : 11/07/2008
 -----------------------------------------------------------------------------
 *   Description   :  cette procédure renvoie la teneur en composant pour le code identifiant
 *                    specialité passé en parametre
 *   Maj           :  04/02/2009 - Mourad
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_SUB_TENEUR_SPE_CUR  C_GET_THE_SUB_TENEUR_SPE ( database(), this );
      while ( C_GET_THE_SUB_TENEUR_SPE.next( CodeId  ) )
            { html += tr("<br><b> GET_THE_SUB_TENEUR_SPE : </b>  ") + C_GET_THE_SUB_TENEUR_SPE.MEMBER();
            }
  */
  class C_GET_THE_SUB_TENEUR_SPE_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_SUB_TENEUR_SPE_CUR ---------------------
      C_GET_THE_SUB_TENEUR_SPE_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( double CodeId )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............

 //+      SELECT t2.cdf_nom     AS TENEUR,
 //+             t1.coten_qualificatif  AS QUALIFICATIF,
 //+             t1.coten_dosage   AS DOSAGE,
 //+             t1.coten_cdf_ud_code_fk AS UNITECODE,
 //+             t3.cdf_nom        AS UNITENOM,
 //+             t1.coten_dosage_equiv  AS DOSAGE_EQUIV    ,
 //+             t1.coten_cdf_ud_equiv_code_fk AS UNITECODE_EQUIV ,
 //+             t4.cdf_nom      AS UNITENOM_EQUIV
 //+     FROM    COTEN_COMPO_TENEUR T1,
 //+      CDF_CODIF T2,
 //+             CDF_CODIF T3,
 //+      CDF_CODIF T4
 //+     WHERE t2.CDF_CODE_PK  (+)     =  t1.COTEN_CDF_TEN_CODE_FK_PK
 //+     AND   t2.CDF_NUMERO_PK(+)     = '24'
 //+     AND   t3.CDF_CODE_PK  (+)     =  t1.COTEN_CDF_UD_CODE_FK
 //+     AND   t3.CDF_NUMERO_PK(+)     = '19'
 //+     AND   t4.CDF_CODE_PK  (+)     =  t1.COTEN_CDF_UD_EQUIV_CODE_FK
 //+     AND   t4.CDF_NUMERO_PK(+)     = '19'
 //+     AND   t1.COTEN_SP_CODE_FK_PK  = CodeId;
                sql_query += " SELECT t2.CDF_NOM     AS TENEUR,"
                     " t1.COTEN_QUALIFICATIF  AS QUALIFICATIF,"
                     " t1.COTEN_DOSAGE   AS DOSAGE,"
                     " t1.COTEN_CDF_UD_CODE_FK AS UNITECODE,"
                     " t3.CDF_NOM        AS UNITENOM,"
                     " t1.COTEN_DOSAGE_EQUIV  AS DOSAGE_EQUIV    ,"
                     " t1.COTEN_CDF_UD_EQUIV_CODE_FK AS UNITECODE_EQUIV ,"
                     " t4.CDF_NOM      AS UNITENOM_EQUIV"
                     " FROM    coten_compo_teneur T1,"
                     " cdf_codif T2,"
                     " cdf_codif T3,"
                     " cdf_codif T4"
                     " WHERE t2.CDF_CODE_PK       =  t1.COTEN_CDF_TEN_CODE_FK_PK"
                     " AND   t2.CDF_NUMERO_PK     = '24'"
                     " AND   t3.CDF_CODE_PK       =  t1.COTEN_CDF_UD_CODE_FK"
                     " AND   t3.CDF_NUMERO_PK     = '19'"
                     " AND   t4.CDF_CODE_PK       =  t1.COTEN_CDF_UD_EQUIV_CODE_FK"
                     " AND   t4.CDF_NUMERO_PK     = '19'"
                     " AND   t1.COTEN_SP_CODE_FK_PK   = '"+ QString::number( CodeId ) +"';";
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_SUB_TENEUR_SPE() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_TENEUR          = value(0).toString();
                m_QUALIFICATIF    = value(1).toString();
                m_DOSAGE          = value(2).toDouble();
                m_UNITECODE       = value(3).toString();
                m_UNITENOM        = value(4).toString();
                m_DOSAGE_EQUIV    = value(5).toDouble();
                m_UNITECODE_EQUIV = value(6).toString();
                m_UNITENOM_EQUIV  = value(7).toString();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      QString TENEUR()          {return m_TENEUR;}
      QString QUALIFICATIF()    {return m_QUALIFICATIF;}
      double  DOSAGE()          {return m_DOSAGE;}
      QString UNITECODE()       {return m_UNITECODE;}
      QString UNITENOM()        {return m_UNITENOM;}
      double  DOSAGE_EQUIV()    {return m_DOSAGE_EQUIV;}
      QString UNITECODE_EQUIV() {return m_UNITECODE_EQUIV;}
      QString UNITENOM_EQUIV()  {return m_UNITENOM_EQUIV;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      QString m_TENEUR;
      QString m_QUALIFICATIF;
      double  m_DOSAGE;
      QString m_UNITECODE;
      QString m_UNITENOM;
      double  m_DOSAGE_EQUIV;
      QString m_UNITECODE_EQUIV;
      QString m_UNITENOM_EQUIV;
 };

 //================================== C_GET_THE_DET_EXP_CUR   -20- ==================================
 /****************************************************************************
 *   Nom           :  GET_THE_DET_EXP
 -----------------------------------------------------------------------------
 *   Date creation : 14/07/2008
 -----------------------------------------------------------------------------
 *   Description   :  cette procédure nous renvoie la composition,
 *                    pour le code excipient passé en parametre
 *
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_DET_EXP_CUR  C_GET_THE_DET_EXP ( database(), this );
      while ( C_GET_THE_DET_EXP.next( CodeId , TYPID  ) )
            { html += tr("<br><b> GET_THE_DET_EXP : </b>  ") + C_GET_THE_DET_EXP.MEMBER();
            }
  */
  class C_GET_THE_DET_EXP_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_DET_EXP_CUR ---------------------
      C_GET_THE_DET_EXP_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( double CodeId , double TYPID )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............
       if ( TYPID == 1) {

 //+         SELECT cdf_nom           AS LIBDET    ,
 //+                sauvo_doseseuil   AS DOSESEUIL
 //+         FROM   SAUVO_SUBAUXVOIE_SUBAUX  ,
 //+                CDF_CODIF
 //+         WHERE  SAUVO_CDF_VOIE_CODE_FK_PK = CDF_CODE_PK
 //+         AND    CDF_NUMERO_PK             = '18'
 //+         AND    SAUVO_SAU_CODE_FK_PK      = CodeId;
                sql_query += " SELECT CDF_NOM           AS LIBDET    ,"
                     " SAUVO_DOSESEUIL   AS DOSESEUIL"
                     " FROM   sauvo_subauxvoie_subaux  ,"
                     " cdf_codif"
                     " WHERE  SAUVO_CDF_VOIE_CODE_FK_PK = CDF_CODE_PK"
                     " AND    CDF_NUMERO_PK             = '18'"
                     " AND    SAUVO_SAU_CODE_FK_PK       = '"+ QString::number( CodeId ) +"';";

       } else if ( TYPID == 2) {

 //+         SELECT cdf_nom     AS LIBDET    ,
 //+                NULL        AS DOSESEUIL
 //+         FROM   SAUNAT_SUBAUX_NATURE,
 //+                CDF_CODIF
 //+         WHERE  SAUNAT_CDF_NASAU_CODE_FK_PK = CDF_CODE_PK
 //+         AND    CDF_NUMERO_PK               = '10'
 //+         AND    SAUNAT_SAU_CODE_FK_PK       = CodeId;
                sql_query += " SELECT CDF_NOM     AS LIBDET    ,"
                     " NULL        AS DOSESEUIL"
                     " FROM   saunat_subaux_nature,"
                     " cdf_codif"
                     " WHERE  SAUNAT_CDF_NASAU_CODE_FK_PK = CDF_CODE_PK"
                     " AND    CDF_NUMERO_PK               = '10'"
                     " AND    SAUNAT_SAU_CODE_FK_PK        = '"+ QString::number( CodeId ) +"';";

       } else if ( TYPID == 3) {

 //+       SELECT cch_nom     AS LIBDET  ,
 //+              NULL        AS DOSESEUIL
 //+       FROM   SAUCCH_SUBAUX_CLASSECH ,
 //+              CCH_CLASSECHIMIQUE
 //+       WHERE  SAUCCH_CCH_CODE_FK_PK  = cch_code_pk
 //+       AND    saucch_sau_code_fk_pk  = CodeId ;
                sql_query += " SELECT CCH_NOM     AS LIBDET  ,"
                     " NULL        AS DOSESEUIL"
                     " FROM   saucch_subaux_classech ,"
                     " cch_classechimique"
                     " WHERE  SAUCCH_CCH_CODE_FK_PK  = cch_code_pk"
                     " AND    saucch_sau_code_fk_pk   = '"+ QString::number( CodeId ) +"' ;";

       } else if ( TYPID == 4) {

 //+         SELECT cdf_nom    AS LIBDET ,
 //+                NULL       AS DOSESEUIL
 //+         FROM   SAUNAV_SUBAUX_NATURE_VECT,
 //+                CDF_CODIF
 //+         WHERE  SAUNAV_CDF_NAV_CODE_FK_PK = CDF_CODE_PK
 //+         AND    CDF_NUMERO_PK             = '28'
 //+         AND    SAUNAV_SAU_CODE_FK_PK     = CodeId ;
                sql_query += " SELECT CDF_NOM    AS LIBDET ,"
                     " NULL       AS DOSESEUIL"
                     " FROM   saunav_subaux_nature_vect,"
                     " cdf_codif"
                     " WHERE  SAUNAV_CDF_NAV_CODE_FK_PK = CDF_CODE_PK"
                     " AND    CDF_NUMERO_PK             = '28'"
                     " AND    SAUNAV_SAU_CODE_FK_PK      = '"+ QString::number( CodeId ) +"' ;";

       } else {
 //+       C_GET_THE_DET_EXP := NULL;
         return 0;
       }
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_DET_EXP() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_LIBDET    = value(0).toString();
                m_DOSESEUIL = value(1).toString();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      QString LIBDET()    {return m_LIBDET;}
      QString DOSESEUIL() {return m_DOSESEUIL;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      QString m_LIBDET;
      QString m_DOSESEUIL;
 };

 //================================== C_GET_THE_DET_SUBACT_CUR   -21- ==================================
 /****************************************************************************
 *   Nom           :  GET_THE_DET_SUBACT
 -----------------------------------------------------------------------------
 *   Date creation : 08/09/2008
 -----------------------------------------------------------------------------
 *   Description   : Cette procédure renvoie les classes
 *                   pour le code substance passé en paramètre.
 *   MAJ           : 07/10/2008
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_DET_SUBACT_CUR  C_GET_THE_DET_SUBACT ( database(), this );
      while ( C_GET_THE_DET_SUBACT.next( CodeId , TypId  ) )
            { html += tr("<br><b> GET_THE_DET_SUBACT : </b>  ") + C_GET_THE_DET_SUBACT.MEMBER();
            }
  */
  class C_GET_THE_DET_SUBACT_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_DET_SUBACT_CUR ---------------------
      C_GET_THE_DET_SUBACT_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( double CodeId , double TypId )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............
       if ( TypId == 1) {

 //+   SELECT t1.SACCAS_SAC_CODE_FK_PK  AS CODE,
 //+          t1.SACCAS_CAS_CODE_PK     AS LIBDET
 //+   FROM   SACCAS_SUBACT_CAS t1
 //+   WHERE  t1.SACCAS_SAC_CODE_FK_PK  = CodeId ;
                sql_query += " SELECT t1.SACCAS_SAC_CODE_FK_PK  AS CODE,"
                     " t1.SACCAS_CAS_CODE_PK     AS LIBDET"
                     " FROM   saccas_subact_cas t1"
                     " WHERE  t1.SACCAS_SAC_CODE_FK_PK   = '"+ QString::number( CodeId ) +"' ;";

       } else if ( TypId == 2) {

 //+   SELECT t2.CPH_CODE_PK       AS CODE,
 //+      t2.CPH_NOM           AS LIBDET
 //+   FROM   SACCPH_SUBACT_CLASSEPH t1,
 //+      CPH_CLASSEPHARMTHER    t2
 //+   WHERE  t1.SACCPH_CPH_CODE_FK_PK = t2.CPH_CODE_PK
 //+   AND    t1.SACCPH_SAC_CODE_FK_PK = CodeId;
                sql_query += " SELECT t2.CPH_CODE_PK       AS CODE,"
                     " t2.CPH_NOM           AS LIBDET"
                     " FROM   saccph_subact_classeph t1,"
                     " cph_classepharmther    t2"
                     " WHERE  t1.SACCPH_CPH_CODE_FK_PK = t2.CPH_CODE_PK"
                     " AND    t1.SACCPH_SAC_CODE_FK_PK  = '"+ QString::number( CodeId ) +"';";

       } else if ( TypId == 3) {

 //+   SELECT t2.CCH_CODE_PK        AS CODE,
 //+      t2.CCH_NOM         AS LIBDET
 //+   FROM   SACCCH_SUBACT_CLASSECH t1,
 //+      CCH_CLASSECHIMIQUE     t2
 //+   WHERE  t1.SACCCH_CCH_CODE_FK_PK  = t2.CCH_CODE_PK
 //+   AND    t1.SACCCH_SAC_CODE_FK_PK  = CodeId ;
                sql_query += " SELECT t2.CCH_CODE_PK        AS CODE,"
                     " t2.CCH_NOM         AS LIBDET"
                     " FROM   saccch_subact_classech t1,"
                     " cch_classechimique     t2"
                     " WHERE  t1.SACCCH_CCH_CODE_FK_PK  = t2.CCH_CODE_PK"
                     " AND    t1.SACCCH_SAC_CODE_FK_PK   = '"+ QString::number( CodeId ) +"' ;";

       } else if ( TypId == 4) {

 //+   SELECT t2.CATC_CODE_PK       AS CODE,
 //+      t2.CATC_NOMF         AS LIBDET
 //+   FROM   SACCATC_SUBACT_CLASSEATC t1,
 //+      CATC_CLASSEATC           t2
 //+   WHERE  t1.SACCATC_CATC_CODE_FK_PK = t2.CATC_CODE_PK
 //+   AND    t1.SACCATC_SAC_CODE_FK_PK = CodeId ;
                sql_query += " SELECT t2.CATC_CODE_PK       AS CODE,"
                     " t2.CATC_NOMF         AS LIBDET"
                     " FROM   saccatc_subact_classeatc t1,"
                     " catc_classeatc           t2"
                     " WHERE  t1.SACCATC_CATC_CODE_FK_PK = t2.CATC_CODE_PK"
                     " AND    t1.SACCATC_SAC_CODE_FK_PK  = '"+ QString::number( CodeId ) +"' ;";

       }
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_DET_SUBACT() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_CODE   = value(0).toString();
                m_LIBDET = value(1).toString();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      QString CODE()   {return m_CODE;}
      QString LIBDET() {return m_LIBDET;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      QString m_CODE;
      QString m_LIBDET;
 };

 //================================== C_GET_THE_IND_TXT_CUR   -22- ==================================
 /***************************************************************************
 *   Nom           :  GET_THE_IND_TXT
 -----------------------------------------------------------------------------
 *   Date creation : 14/07/2008
 -----------------------------------------------------------------------------
 *   Description   :  cette procédure renvoie les fiches indication repondant
 *                    au libéllé de nature indication passé en paramétre ,le nom peut contenir
 *                    le caractere '%'
 *
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_IND_TXT_CUR  C_GET_THE_IND_TXT ( database(), this );
      while ( C_GET_THE_IND_TXT.next( LibTxt  ) )
            { html += tr("<br><b> GET_THE_IND_TXT : </b>  ") + C_GET_THE_IND_TXT.MEMBER();
            }
  */
  class C_GET_THE_IND_TXT_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_IND_TXT_CUR ---------------------
      C_GET_THE_IND_TXT_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( QString LibTxt )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............

 //+     SELECT    FIN_CODE_SQ_PK    AS CODEIND
 //+     FROM      FIN_FICHEINDIC,
 //+               CDF_CODIF
 //+     WHERE     FIN_CDF_NAIN_CODE_FK_PK = CDF_CODE_PK
 //+     AND       CDF_NUMERO_PK           = 'NN'
 //+     AND       UPPER(CDF_NOM) LIKE UPPER(LibTxt)
 //+     ORDER BY  FIN_CODE_SQ_PK;
                sql_query += " SELECT    FIN_CODE_SQ_PK    AS CODEIND"
                     " FROM      fin_ficheindic,"
                     " cdf_codif"
                     " WHERE     FIN_CDF_NAIN_CODE_FK_PK = CDF_CODE_PK"
                     " AND       CDF_NUMERO_PK           = 'NN'"
                     " AND       UPPER(CDF_NOM) LIKE UPPER('"+LibTxt+"')"
                     " ORDER BY  FIN_CODE_SQ_PK;";
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_IND_TXT() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_CODEIND = value(0).toDouble();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      double  CODEIND() {return m_CODEIND;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      double  m_CODEIND;
 };

 //================================== C_GET_THE_IND_SPE_CUR   -23- ==================================
 /***************************************************************************
 *   Nom           :  GET_THE_IND_SPE
 -----------------------------------------------------------------------------
 *   Date creation : 14/07/2008
 -----------------------------------------------------------------------------
 *   Description   :  cette procédure renvoie les identifiants de fiches indication
 *                    pour une specialité dont le code passé en paramétre
 *
 -----------------------------------------------------------------------------
 *   Date Maj : 16/0762009 - Mourad
 -----------------------------------------------------------------------------
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_IND_SPE_CUR  C_GET_THE_IND_SPE ( database(), this );
      while ( C_GET_THE_IND_SPE.next( CodeId  ) )
            { html += tr("<br><b> GET_THE_IND_SPE : </b>  ") + C_GET_THE_IND_SPE.MEMBER();
            }
  */
  class C_GET_THE_IND_SPE_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_IND_SPE_CUR ---------------------
      C_GET_THE_IND_SPE_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( double CodeId )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............

 //+       SELECT fin_code_sq_pk  AS CODEIND ,
 //+              fin_texte       AS FIN_TEXT
 //+       FROM   FINSP_INDSPE ,
 //+              FIN_FICHEINDIC
 //+       WHERE  FIN_CODE_SQ_PK      = FINSP_FIN_CODE_FK_PK
 //+       AND    FINSP_SP_CODE_FK_PK = CODEID ;
                sql_query += " SELECT FIN_CODE_SQ_PK  AS CODEIND ,"
                     " FIN_TEXTE       AS FIN_TEXT"
                     " FROM   finsp_indspe ,"
                     " fin_ficheindic"
                     " WHERE  FIN_CODE_SQ_PK      = FINSP_FIN_CODE_FK_PK"
                     " AND    FINSP_SP_CODE_FK_PK  = '"+ QString::number( CodeId ) +"' ;";
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_IND_SPE() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_CODEIND  = value(0).toDouble();
                m_FIN_TEXT = value(1).toString();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      double  CODEIND()  {return m_CODEIND;}
      QString FIN_TEXT() {return m_FIN_TEXT;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      double  m_CODEIND;
      QString m_FIN_TEXT;
 };

 //================================== C_GET_THE_IND_SPE_PRF_CUR   -24- ==================================
 /***************************************************************************
 *   Nom           :  GET_THE_IND_SPE_PRF
 -----------------------------------------------------------------------------
 *   Date creation : 14/07/2008
 -----------------------------------------------------------------------------
 *   Description   :  cette procédure retourne le texte rattaché à une fiche indication
 *                    dont l'identifiant fiche indication passé en paramétre
 *
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_IND_SPE_PRF_CUR  C_GET_THE_IND_SPE_PRF ( database(), this );
      while ( C_GET_THE_IND_SPE_PRF.next( IDFIC  ) )
            { html += tr("<br><b> GET_THE_IND_SPE_PRF : </b>  ") + C_GET_THE_IND_SPE_PRF.MEMBER();
            }
  */
  class C_GET_THE_IND_SPE_PRF_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_IND_SPE_PRF_CUR ---------------------
      C_GET_THE_IND_SPE_PRF_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( double IDFIC )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............

 //+     SELECT fin_code_sq_pk AS NOFIC   ,
 //+            fin_texte      AS TXT_FIC
 //+     FROM   FIN_FICHEINDIC
 //+     WHERE  fin_code_sq_pk  = IDFIC ;
                sql_query += " SELECT FIN_CODE_SQ_PK AS NOFIC   ,"
                     " FIN_TEXTE      AS TXT_FIC"
                     " FROM   fin_ficheindic"
                     " WHERE  fin_code_sq_pk   = '"+ QString::number( IDFIC ) +"' ;";
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_IND_SPE_PRF() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_NOFIC   = value(0).toDouble();
                m_TXT_FIC = value(1).toString();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      double  NOFIC()   {return m_NOFIC;}
      QString TXT_FIC() {return m_TXT_FIC;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      double  m_NOFIC;
      QString m_TXT_FIC;
 };

 //================================== C_GET_THE_DET_IND_CUR   -25- ==================================
 /****************************************************************************
 *   Nom           :  GET_THE_DET_IND
 -----------------------------------------------------------------------------
 *   Date creation : 15/07/2008
 -----------------------------------------------------------------------------
 *   Description   :  cette procédure affiche les informations rattachées à une fiche
 *                    indication passé en paramétre ,le deusiéme paramétre renseigne sur
 *                    l'information à retourner
 *
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_DET_IND_CUR  C_GET_THE_DET_IND ( database(), this );
      while ( C_GET_THE_DET_IND.next( CodeId , TYPID  ) )
            { html += tr("<br><b> GET_THE_DET_IND : </b>  ") + C_GET_THE_DET_IND.MEMBER();
            }
  */
  class C_GET_THE_DET_IND_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_DET_IND_CUR ---------------------
      C_GET_THE_DET_IND_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( double CodeId , double TYPID )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............
       if ( TYPID == 1) {

 //+          SELECT   finco_fin_code_fk_pk AS CODEDOC   ,
 //+                   cdf_nom              AS LIBCOURT  ,
 //+                   NULL                 AS LIBLONG   ,
 //+                   NULL                 AS CODEFILS
 //+          FROM     FINCO_FINDCOMMENT,
 //+                   CDF_CODIF
 //+          WHERE    FINCO_CDF_COIN_CODE_FK_PK = CDF_CODE_PK
 //+          AND      CDF_NUMERO_PK             = 'NC'
 //+          AND      FINCO_FIN_CODE_FK_PK      = CodeId
 //+          ORDER BY FINCO_NUMORD  ;
                sql_query +=
                     " SELECT   FINCO_FIN_CODE_FK_PK AS CODEDOC   ,"
                     " CDF_NOM                       AS LIBCOURT  ,"
                     " NULL                          AS LIBLONG   ,"
                     " NULL                          AS CODEFILS"
                     " FROM    finco_findcomment,"
                     " cdf_codif"
                     " WHERE    FINCO_CDF_COIN_CODE_FK_PK = CDF_CODE_PK"
                     " AND      CDF_NUMERO_PK             = 'NC'"
                     " AND      FINCO_FIN_CODE_FK_PK       = '"+ QString::number( CodeId ) +"'"
                     " ORDER BY FINCO_NUMORD  ;";

       } else if ( TYPID == 2) {

 //+          SELECT   fincon_fin_code_fk_pk  AS CODEDOC,
 //+                   cdf_nom                AS LIBCOURT  ,
 //+                   NULL                   AS LIBLONG ,
 //+                   NULL                    AS CODEFILS
 //+          FROM     FINCON_FINDCOMMENT_NATURE,
 //+                   CDF_CODIF
 //+          WHERE    FINCON_CDF_COIN_CODE_FK_PK  = CDF_CODE_PK
 //+          AND      CDF_NUMERO_PK               = 'NC'
 //+          AND      FINCON_FIN_CODE_FK_PK       = CodeId
 //+          ORDER BY FINCON_NUMORD ;
                sql_query +=
                     " SELECT   FINCON_FIN_CODE_FK_PK  AS CODEDOC,"
                     " CDF_NOM                         AS LIBCOURT  ,"
                     " NULL                            AS LIBLONG ,"
                     " NULL                            AS CODEFILS"
                     " FROM     fincon_findcomment_nature,"
                     " cdf_codif"
                     " WHERE    FINCON_CDF_COIN_CODE_FK_PK  = CDF_CODE_PK"
                     " AND      CDF_NUMERO_PK               = 'NC'"
                     " AND      FINCON_FIN_CODE_FK_PK        = '"+ QString::number( CodeId ) +"'"
                     " ORDER BY FINCON_NUMORD ;";

       } else if ( TYPID == 3) {

 //+          SELECT   finty_fin_code_fk_pk   AS CODEDOC  ,
 //+                   cdf_nom                AS LIBCOURT ,
 //+                   NULL                   AS LIBLONG  ,
 //+                   NULL     AS CODEFILS
 //+          FROM     FINTY_FINDTYPE,
 //+                   CDF_CODIF
 //+          WHERE    FINTY_CDF_TYIN_CODE_FK_PK   = CDF_CODE_PK
 //+          AND      CDF_NUMERO_PK               = 'NY'
 //+          AND      FINTY_FIN_CODE_FK_PK        = CodeId
 //+          ORDER BY FINTY_NUMORD ;
                sql_query +=
                     " SELECT   FINTY_FIN_CODE_FK_PK   AS CODEDOC  ,"
                     " CDF_NOM                         AS LIBCOURT ,"
                     " NULL                            AS LIBLONG  ,"
                     " NULL                            AS CODEFILS"
                     " FROM     finty_findtype,"
                     " cdf_codif"
                     " WHERE    FINTY_CDF_TYIN_CODE_FK_PK   = CDF_CODE_PK"
                     " AND      CDF_NUMERO_PK               = 'NY'"
                     " AND      FINTY_FIN_CODE_FK_PK         = '"+ QString::number( CodeId ) +"'"
                     " ORDER BY FINTY_NUMORD ;";

       } else if ( TYPID == 4) {

 //+          SELECT   finet_fin_code_fk_pk    AS CODEDOC  ,
 //+                   cdf_nom                 AS LIBCOURT ,
 //+                   NULL                    AS LIBLONG  ,
 //+                   NULL                    AS CODEFILS
 //+          FROM     FINET_FINDETIOL,
 //+                   CDF_CODIF
 //+          WHERE    FINET_CDF_ETIN_CODE_FK_PK    = CDF_CODE_PK
 //+          AND      CDF_NUMERO_PK                = 'NA'
 //+          AND      FINET_FIN_CODE_FK_PK         = CodeId
 //+          ORDER BY FINET_NUMORD ;
                sql_query += " SELECT   FINET_FIN_CODE_FK_PK    AS CODEDOC  ,"
                     " CDF_NOM                 AS LIBCOURT ,"
                     " NULL                    AS LIBLONG  ,"
                     " NULL                    AS CODEFILS"
                     " FROM     finet_findetiol,"
                     " cdf_codif"
                     " WHERE    FINET_CDF_ETIN_CODE_FK_PK    = CDF_CODE_PK"
                     " AND      CDF_NUMERO_PK                = 'NA'"
                     " AND      FINET_FIN_CODE_FK_PK          = '"+ QString::number( CodeId ) +"'"
                     " ORDER BY FINET_NUMORD ;";

       } else if ( TYPID == 5) {

 //+          SELECT FIN_code_sq_pk       AS CODEDOC  ,
 //+                 cim_libelle_court    AS LIBCOURT ,
 //+                 cim_libelle_long     AS LIBLONG ,
 //+                 t1.cim_code_pk    AS CODEFILS
 //+          FROM   CIM10 T1,
 //+                 CIMCDF_CIM10_CODIF T2,
 //+                 FIN_FICHEINDIC T3
 //+          WHERE  T1.CIM_CODE_PK             = T2.CIMCDF_CIM_CODE_FK_PK
 //+          AND    T2.CIMCDF_CDF_CODE_FK_PK   = T3.FIN_CDF_NAIN_CODE_FK_PK
 //+          AND    T2.CIMCDF_CDF_NUMERO_FK_PK = 'NN'
 //+          AND    T3.FIN_CODE_SQ_PK          = CodeId;
                sql_query += " SELECT FIN_CODE_SQ_PK       AS CODEDOC  ,"
                     " CIM_LIBELLE_COURT    AS LIBCOURT ,"
                     " CIM_LIBELLE_LONG     AS LIBLONG ,"
                     " T1.CIM_CODE_PK    AS CODEFILS"
                     " FROM   cim10 T1,"
                     " cimcdf_cim10_codif T2,"
                     " fin_ficheindic T3"
                     " WHERE  T1.CIM_CODE_PK             = T2.CIMCDF_CIM_CODE_FK_PK"
                     " AND    T2.CIMCDF_CDF_CODE_FK_PK   = T3.FIN_CDF_NAIN_CODE_FK_PK"
                     " AND    T2.CIMCDF_CDF_NUMERO_FK_PK = 'NN'"
                     " AND    T3.FIN_CODE_SQ_PK           = '"+ QString::number( CodeId ) +"';";

       } else if ( TYPID == 6) {

 //+          SELECT finbib_fin_code_fk_pk     AS CODEDOC  ,
 //+                 finbib_texte            AS LIBCOURT ,
 //+                 NULL        AS LIBLONG  ,
 //+                 NULL        AS CODEFILS
 //+          FROM   FINBIB_REFERENCE_BIBLIO
 //+          WHERE  FINBIB_FIN_CODE_FK_PK   = CodeId;
                sql_query += " SELECT FINBIB_FIN_CODE_FK_PK     AS CODEDOC  ,"
                     " FINBIB_TEXTE            AS LIBCOURT ,"
                     " NULL        AS LIBLONG  ,"
                     " NULL        AS CODEFILS"
                     " FROM   finbib_reference_biblio"
                     " WHERE  FINBIB_FIN_CODE_FK_PK    = '"+ QString::number( CodeId ) +"';";

       } else if ( TYPID == 7) {

 //+          SELECT fin_code_sq_pk      AS CODEDOC,
 //+                 cdf_nom             AS LIBCOURT,
 //+                 NULL                AS LIBLONG ,
 //+                 NULL      AS CODEFILS
 //+          FROM   FIN_FICHEINDIC  ,
 //+                 CDF_CODIF
 //+          WHERE  FIN_CDF_NAIN_CODE_FK_PK =  CDF_CODE_PK
 //+          AND    CDF_NUMERO_PK           = 'NN'
 //+          AND    FIN_CODE_SQ_PK          = CodeId ;
                sql_query += " SELECT FIN_CODE_SQ_PK      AS CODEDOC,"
                     " CDF_NOM             AS LIBCOURT,"
                     " NULL                AS LIBLONG ,"
                     " NULL      AS CODEFILS"
                     " FROM   fin_ficheindic  ,"
                     " cdf_codif"
                     " WHERE  FIN_CDF_NAIN_CODE_FK_PK =  CDF_CODE_PK"
                     " AND    CDF_NUMERO_PK           = 'NN'"
                     " AND    FIN_CODE_SQ_PK           = '"+ QString::number( CodeId ) +"' ;";

       } else if ( TYPID == 8) {

 //+          SELECT fin_code_sq_pk       AS CODEDOC  ,
 //+                 cdf_nom              AS LIBCOURT ,
 //+                 NULL                 AS LIBLONG  ,
 //+                 NULL      AS CODEFILS
 //+          FROM   FIN_FICHEINDIC  ,
 //+                 CDF_CODIF
 //+          WHERE  FIN_CDF_NVIN_CODE_FK_PK =  CDF_CODE_PK
 //+          AND    CDF_NUMERO_PK           = 'NV'
 //+          AND    FIN_CODE_SQ_PK          = CodeId ;
                sql_query += " SELECT FIN_CODE_SQ_PK       AS CODEDOC  ,"
                     " CDF_NOM              AS LIBCOURT ,"
                     " NULL                 AS LIBLONG  ,"
                     " NULL                 AS CODEFILS"
                     " FROM   fin_ficheindic  ,"
                     " cdf_codif"
                     " WHERE  FIN_CDF_NVIN_CODE_FK_PK =  CDF_CODE_PK"
                     " AND    CDF_NUMERO_PK           = 'NV'"
                     " AND    FIN_CODE_SQ_PK           = '"+ QString::number( CodeId ) +"' ;";

       } else if ( TYPID == 9) {

 //+        SELECT  fin_code_sq_pk  AS CODEDOC  ,
 //+                fin_texte       AS LIBCOURT,
 //+                NULL            AS LIBLONG ,
 //+                NULL            AS CODEFILS
 //+        FROM   FIN_FICHEINDIC
 //+        WHERE  FIN_CODE_SQ_PK = CodeId ;
                sql_query += " SELECT  FIN_CODE_SQ_PK  AS CODEDOC  ,"
                     " FIN_TEXTE       AS LIBCOURT,"
                     " NULL            AS LIBLONG ,"
                     " NULL            AS CODEFILS"
                     " FROM   fin_ficheindic"
                     " WHERE  FIN_CODE_SQ_PK  = '"+ QString::number( CodeId ) +"' ;";

       } else {
 //+       C_GET_THE_DET_IND := NULL;
         return 0;
       }
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_DET_IND() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_CODEDOC  = value(0).toString();
                m_LIBCOURT = value(1).toString();
                m_LIBLONG  = value(2).toString();
                m_CODEFILS = value(3).toString();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      QString CODEDOC()  {return m_CODEDOC;}
      QString LIBCOURT() {return m_LIBCOURT;}
      QString LIBLONG()  {return m_LIBLONG;}
      QString CODEFILS() {return m_CODEFILS;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      QString m_CODEDOC;
      QString m_LIBCOURT;
      QString m_LIBLONG;
      QString m_CODEFILS;
 };

 //================================== C_GET_THE_REF_IND_CUR   -26- ==================================
 /***************************************************************************
 *   Nom           :  GET_THE_REF_IND
 -----------------------------------------------------------------------------
 *   Date creation : 15/07/2008
 -----------------------------------------------------------------------------
 *   Description   :  cette procédure affiche la derniere reference officielle
 *                    en passant comme parametre le code identifiant de la fiche
 *                    indication et le code specialité
 *
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_REF_IND_CUR  C_GET_THE_REF_IND ( database(), this );
      while ( C_GET_THE_REF_IND.next( CodeInd , CodeSpe  ) )
            { html += tr("<br><b> GET_THE_REF_IND : </b>  ") + C_GET_THE_REF_IND.MEMBER();
            }
  */
  class C_GET_THE_REF_IND_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_REF_IND_CUR ---------------------
      C_GET_THE_REF_IND_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( double CodeInd , double CodeSpe )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............

 //+      SELECT cdf_nom            AS REFERIND ,
 //+             finafs_date_pk     AS DTREFIND
 //+      FROM   FINAFS_FIN_AFSSAPS ,
 //+             CDF_CODIF
 //+      WHERE  FINAFS_CDF_DOCUMENT_FK_PK = CDF_CODE_PK
 //+      AND    CDF_NUMERO_PK             = '25'
 //+      AND    FINAFS_SP_CODE_FK_PK      = CodeSpe
 //+      AND    FINAFS_FIN_CODE_FK_PK     = CodeInd
 //+      AND    FINAFS_DATE_PK            = (SELECT MAX(finafs_date_pk)
 //+                                          FROM  FINAFS_FIN_AFSSAPS
 //+                                          WHERE FINAFS_SP_CODE_FK_PK    = CodeSpe
 //+                                          AND   FINAFS_FIN_CODE_FK_PK   = CodeInd );
                sql_query += " SELECT CDF_NOM            AS REFERIND ,"
                     " FINAFS_DATE_PK     AS DTREFIND"
                     " FROM   finafs_fin_afssaps ,"
                     " cdf_codif"
                     " WHERE  FINAFS_CDF_DOCUMENT_FK_PK = CDF_CODE_PK"
                     " AND    CDF_NUMERO_PK             = '25'"
                     " AND    FINAFS_SP_CODE_FK_PK       = '"+ QString::number( CodeSpe ) +"'"
                     " AND    FINAFS_FIN_CODE_FK_PK      = '"+ QString::number( CodeInd ) +"'"
                     " AND    FINAFS_DATE_PK            = (SELECT MAX(finafs_date_pk)"
                     " FROM  finafs_fin_afssaps"
                     " WHERE FINAFS_SP_CODE_FK_PK     = '"+ QString::number( CodeSpe ) +"'"
                     " AND   FINAFS_FIN_CODE_FK_PK    = '"+ QString::number( CodeInd ) +"' );";
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_REF_IND() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_REFERIND = value(0).toString();
                m_DTREFIND = value(1).toDate();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      QString REFERIND() {return m_REFERIND;}
      QDate   DTREFIND() {return m_DTREFIND;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      QString m_REFERIND;
      QDate   m_DTREFIND;
 };

 //================================== C_GET_THE_SMR_SPE_CUR   -27- ==================================
 /***************************************************************************
 *   Nom           :  GET_THE_SMR_SPE
 -----------------------------------------------------------------------------
 *   Date creation : 15/07/2008
 -----------------------------------------------------------------------------
 *   Description   :  cette procédure affiche les informations SMR
 *                    en passant comme parametre le code identifiant de la fiche
 *                    indication et le code specialité
 *
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_SMR_SPE_CUR  C_GET_THE_SMR_SPE ( database(), this );
      while ( C_GET_THE_SMR_SPE.next( CodeInd , CodeSpe  ) )
            { html += tr("<br><b> GET_THE_SMR_SPE : </b>  ") + C_GET_THE_SMR_SPE.MEMBER();
            }
  */
  class C_GET_THE_SMR_SPE_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_SMR_SPE_CUR ---------------------
      C_GET_THE_SMR_SPE_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( double CodeInd , double CodeSpe )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............

 //+      SELECT finsmr_atr_code_fk_pk AS CODEATR ,
 //+             finsmr_date_smr_pk    AS DTSMR   ,
 //+             cdf_nom       AS TEXTSMR
 //+      FROM   FINSMR_INDIC_SMR_ATR,
 //+             CDF_CODIF
 //+      WHERE  FINSMR_CDF_SMR_CODE_FK_PK  = CDF_CODE_PK
 //+      AND    CDF_NUMERO_PK              = '27'
 //+      AND    FINSMR_FIN_CODE_FK_PK      = CodeInd
 //+      AND    FINSMR_SP_CODE_FK_PK       = CodeSpe;
                sql_query += " SELECT FINSMR_ATR_CODE_FK_PK AS CODEATR ,"
                     " FINSMR_DATE_SMR_PK    AS DTSMR   ,"
                     " CDF_NOM       AS TEXTSMR"
                     " FROM   finsmr_indic_smr_atr,"
                     " cdf_codif"
                     " WHERE  FINSMR_CDF_SMR_CODE_FK_PK  = CDF_CODE_PK"
                     " AND    CDF_NUMERO_PK              = '27'"
                     " AND    FINSMR_FIN_CODE_FK_PK       = '"+ QString::number( CodeInd ) +"'"
                     " AND    FINSMR_SP_CODE_FK_PK        = '"+ QString::number( CodeSpe ) +"';";
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_SMR_SPE() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_CODEATR = value(0).toString();
                m_DTSMR   = value(1).toDate();
                m_TEXTSMR = value(2).toString();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      QString CODEATR() {return m_CODEATR;}
      QDate   DTSMR()   {return m_DTSMR;}
      QString TEXTSMR() {return m_TEXTSMR;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      QString m_CODEATR;
      QDate   m_DTSMR;
      QString m_TEXTSMR;
 };

 //================================== C_GET_THE_ATR_SPE_CUR   -28- ==================================
 /***************************************************************************
 *   Nom           :  GET_THE_ATR_SPE
 -----------------------------------------------------------------------------
 *   Date creation : 16/07/2008
 -----------------------------------------------------------------------------
 *   Description   :  cette procédure renvoie l'acces aux avis en fonction du code
 *                    la fiche
 *   MAJ           :  24/11/2008
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_ATR_SPE_CUR  C_GET_THE_ATR_SPE ( database(), this );
      while ( C_GET_THE_ATR_SPE.next( CODEFIC  ) )
            { html += tr("<br><b> GET_THE_ATR_SPE : </b>  ") + C_GET_THE_ATR_SPE.MEMBER();
            }
  */
  class C_GET_THE_ATR_SPE_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_ATR_SPE_CUR ---------------------
      C_GET_THE_ATR_SPE_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( double CODEFIC )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............

 //+  SELECT t1.ATRASMR_NUMORD          AS TITRE,
 //+       t2.CDF_NOM                AS AVIS ,
 //+       t3.ATR_DATE_REDACTION     AS DATE_AVIS
 //+  FROM   ATRASMR_AVISCOMTRANS_ASMR      t1 ,
 //+         CDF_CODIF                      t2 ,
 //+       ATR_AVISCOMMISSIONTRANSPARENCE t3
 //+  WHERE  t1.ATRASMR_CDF_ASMR_CODE_FK_PK = t2.CDF_CODE_PK
 //+  AND    t2.CDF_NUMERO_PK               = '23'
 //+  AND    t1.ATRASMR_ATR_CODE_FK_PK      = t3.ATR_CODE_SQ_PK
 //+  AND    t1.ATRASMR_ATR_CODE_FK_PK      = CODEFIC ;
                sql_query += " SELECT t1.ATRASMR_NUMORD          AS TITRE,"
                     " t2.CDF_NOM                AS AVIS ,"
                     " t3.ATR_DATE_REDACTION     AS DATE_AVIS"
                     " FROM   atrasmr_aviscomtrans_asmr      t1 ,"
                     " cdf_codif                      t2 ,"
                     " atr_aviscommissiontransparence t3"
                     " WHERE  t1.ATRASMR_CDF_ASMR_CODE_FK_PK = t2.CDF_CODE_PK"
                     " AND    t2.CDF_NUMERO_PK               = '23'"
                     " AND    t1.ATRASMR_ATR_CODE_FK_PK      = t3.ATR_CODE_SQ_PK"
                     " AND    t1.ATRASMR_ATR_CODE_FK_PK       = '"+ QString::number( CODEFIC ) +"' ;";
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_ATR_SPE() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_TITRE     = value(0).toDouble();
                m_AVIS      = value(1).toString();
                m_DATE_AVIS = value(2).toDate();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      double  TITRE()     {return m_TITRE;}
      QString AVIS()      {return m_AVIS;}
      QDate   DATE_AVIS() {return m_DATE_AVIS;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      double  m_TITRE;
      QString m_AVIS;
      QDate   m_DATE_AVIS;
 };

 //================================== C_GET_THE_NIV_GRAV_CUR   -29- ==================================
 /***************************************************************************
 *   Nom           :  GET_THE_NIV_GRAV
 -----------------------------------------------------------------------------
 *   Date creation : 16/07/2008
 -----------------------------------------------------------------------------
 *   Description   :  cette procédure renvoie l'acces aux avis en fonction du code
 *                    la fiche
 *
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_NIV_GRAV_CUR  C_GET_THE_NIV_GRAV ( database(), this );
      while ( C_GET_THE_NIV_GRAV.next( VARTYP  ) )
            { html += tr("<br><b> GET_THE_NIV_GRAV : </b>  ") + C_GET_THE_NIV_GRAV.MEMBER();
            }
  */
  class C_GET_THE_NIV_GRAV_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_NIV_GRAV_CUR ---------------------
      C_GET_THE_NIV_GRAV_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( double VARTYP )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............

 //+      SELECT CDF_CODE_PK  ,
 //+             CDF_NOM
 //+      FROM   CDF_CODIF
 //+      WHERE  CDF_NUMERO_PK    = 'CC'
 //+      AND    CDF_CODE_PK LIKE 'X%';
                sql_query += " SELECT CDF_CODE_PK  ,"
                     " CDF_NOM"
                     " FROM   cdf_codif"
                     " WHERE  CDF_NUMERO_PK    = 'CC'"
                     " AND    CDF_CODE_PK LIKE 'X%';";
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_NIV_GRAV() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_CDF_CODE_PK = value(0).toString();
                m_CDF_NOM     = value(1).toString();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      QString CDF_CODE_PK() {return m_CDF_CODE_PK;}
      QString CDF_NOM()     {return m_CDF_NOM;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      QString m_CDF_CODE_PK;
      QString m_CDF_NOM;
 };

 //================================== C_GET_THE_CIPEMG_CUR   -30- ==================================
 /****************************************************************************
 *   Nom           :  GET_THE_CIPEMG
 -----------------------------------------------------------------------------
 *   Date creation : 16/07/2008
 -----------------------------------------------------------------------------
 *   Description   :  cette procédure renvoie les fiches contre-indication repondant
 *                    au libellé passé en paramétre ,le libellé peut contenir le caractére '%'
 *                    le deusiéme parametre indique la situation recherché
 *
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_CIPEMG_CUR  C_GET_THE_CIPEMG ( database(), this );
      while ( C_GET_THE_CIPEMG.next( LibTxt , TypCi  ) )
            { html += tr("<br><b> GET_THE_CIPEMG : </b>  ") + C_GET_THE_CIPEMG.MEMBER();
            }
  */
  class C_GET_THE_CIPEMG_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_CIPEMG_CUR ---------------------
      C_GET_THE_CIPEMG_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( QString LibTxt , double TypCi )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............
       if ( TypCi == 1) {

 //+          SELECT CDF_NUMERO_PK            ,
 //+                 CDF_CODE_PK              ,
 //+                 CDF_NOM                  ,
 //+                 CDF_DATECR               ,
 //+                 CDF_DATEMJ               ,
 //+                 SP_NOM                   ,
 //+                 FCPMSP_SP_CODE_FK_PK     ,
 //+                 FCPMTX_TEXTE             ,
 //+                 FCPMTX_NATURECIPEMG_FK_PK
 //+          FROM   FCPMSP_CIPEMG_SPE        ,
 //+                 FCPMTX_FICHECIPEMG_TEXTE ,
 //+                 CDF_CODIF                ,
 //+                 SP_SPECIALITE
 //+          WHERE  FCPMTX_CDF_TER_CODE_FK_PK = CDF_CODE_PK
 //+          AND    FCPMSP_SP_CODE_FK_PK      = SP_CODE_SQ_PK
 //+          AND    UPPER(CDF_NOM)          LIKE UPPER(LibTxt)
 //+          AND    CDF_NUMERO_PK             = 'CS'
 //+          AND    FCPMTX_FCPM_CODE_FK_PK    = FCPMSP_FCPM_CODE_FK_PK
 //+          AND    FCPMTX_NATURECIPEMG_FK_PK = 'C'
 //+          ORDER BY SP_NOM ASC ;
                sql_query +=
                     " SELECT CDF_NUMERO_PK      ,"
                     " CDF_CODE_PK               ,"
                     " CDF_NOM                   ,"
                     " CDF_DATECR                ,"
                     " CDF_DATEMJ                ,"
                     " SP_NOM                    ,"
                     " FCPMSP_SP_CODE_FK_PK      ,"
                     " FCPMTX_TEXTE              ,"
                     " FCPMTX_NATURECIPEMG_FK_PK  "
                     " FROM   fcpmsp_cipemg_spe  ,"
                     " fcpmtx_fichecipemg_texte  ,"
                     " cdf_codif                 ,"
                     " sp_specialite"
                     " WHERE  FCPMTX_CDF_TER_CODE_FK_PK = CDF_CODE_PK"
                     " AND    FCPMSP_SP_CODE_FK_PK      = SP_CODE_SQ_PK"
                     " AND    UPPER(CDF_NOM)          LIKE UPPER('"+LibTxt+"')"
                     " AND    CDF_NUMERO_PK             = 'CS'"
                     " AND    FCPMTX_FCPM_CODE_FK_PK    = FCPMSP_FCPM_CODE_FK_PK"
                     " AND    FCPMTX_NATURECIPEMG_FK_PK = 'C'"
                     " ORDER BY SP_NOM ASC ;";

       } else if ( TypCi == 2) {

 //+          SELECT CDF_NUMERO_PK                ,
 //+                 CDF_CODE_PK                  ,
 //+                 CDF_NOM                      ,
 //+                 CDF_DATECR                   ,
 //+                 CDF_DATEMJ                   ,
 //+                 SP_NOM                       ,
 //+                 FCPMSP_SP_CODE_FK_PK         ,
 //+                 FCPMTX_TEXTE                 ,
 //+                 FCPMTX_NATURECIPEMG_FK_PK
 //+          FROM   FCPMSP_CIPEMG_SPE            ,
 //+                 FCPMTX_FICHECIPEMG_TEXTE     ,
 //+                 CDF_CODIF                    ,
 //+                 SP_SPECIALITE
 //+          WHERE  FCPMTX_CDF_TER_CODE_FK_PK = CDF_CODE_PK
 //+          AND    FCPMSP_SP_CODE_FK_PK      = SP_CODE_SQ_PK
 //+          AND    UPPER(CDF_NOM)          LIKE UPPER(LibTxt)
 //+          AND    CDF_NUMERO_PK             = 'CS'
 //+          AND    FCPMTX_FCPM_CODE_FK_PK    = FCPMSP_FCPM_CODE_FK_PK
 //+          AND    FCPMTX_NATURECIPEMG_FK_PK = 'P'
 //+          ORDER BY SP_NOM ASC ;
                sql_query +=
                     " SELECT CDF_NUMERO_PK         ,"
                     " CDF_CODE_PK                  ,"
                     " CDF_NOM                      ,"
                     " CDF_DATECR                   ,"
                     " CDF_DATEMJ                   ,"
                     " SP_NOM                       ,"
                     " FCPMSP_SP_CODE_FK_PK         ,"
                     " FCPMTX_TEXTE                 ,"
                     " FCPMTX_NATURECIPEMG_FK_PK     "
                     " FROM   fcpmsp_cipemg_spe     ,"
                     " fcpmtx_fichecipemg_texte     ,"
                     " cdf_codif                    ,"
                     " sp_specialite"
                     " WHERE  FCPMTX_CDF_TER_CODE_FK_PK = CDF_CODE_PK"
                     " AND    FCPMSP_SP_CODE_FK_PK      = SP_CODE_SQ_PK"
                     " AND    UPPER(CDF_NOM)          LIKE UPPER('"+LibTxt+"')"
                     " AND    CDF_NUMERO_PK             = 'CS'"
                     " AND    FCPMTX_FCPM_CODE_FK_PK    = FCPMSP_FCPM_CODE_FK_PK"
                     " AND    FCPMTX_NATURECIPEMG_FK_PK = 'P'"
                     " ORDER BY SP_NOM ASC ;";

       } else if ( TypCi == 3) {

 //+       SELECT    CDF_NUMERO_PK            ,
 //+                 CDF_CODE_PK           ,
 //+                 CDF_NOM               ,
 //+                 CDF_DATECR            ,
 //+                 CDF_DATEMJ            ,
 //+                 SP_NOM                ,
 //+                 FCPMSP_SP_CODE_FK_PK  ,
 //+                 FCPMTX_TEXTE,
 //+                 FCPMTX_NATURECIPEMG_FK_PK
 //+          FROM   FCPMSP_CIPEMG_SPE     ,
 //+                 FCPMTX_FICHECIPEMG_TEXTE,
 //+                 CDF_CODIF             ,
 //+                 SP_SPECIALITE
 //+          WHERE  FCPMTX_CDF_TER_CODE_FK_PK = CDF_CODE_PK
 //+          AND    FCPMSP_SP_CODE_FK_PK      = SP_CODE_SQ_PK
 //+          AND    UPPER(CDF_NOM)          LIKE UPPER(LibTxt)
 //+          AND    CDF_NUMERO_PK             = 'CS'
 //+          AND    FCPMTX_FCPM_CODE_FK_PK    = FCPMSP_FCPM_CODE_FK_PK
 //+          AND    FCPMTX_NATURECIPEMG_FK_PK = 'N'
 //+          ORDER BY SP_NOM ASC ;
                sql_query +=
                     " SELECT    CDF_NUMERO_PK  ,"
                     " CDF_CODE_PK              ,"
                     " CDF_NOM                  ,"
                     " CDF_DATECR               ,"
                     " CDF_DATEMJ               ,"
                     " SP_NOM                   ,"
                     " FCPMSP_SP_CODE_FK_PK     ,"
                     " FCPMTX_TEXTE,"
                     " FCPMTX_NATURECIPEMG_FK_PK"
                     " FROM   fcpmsp_cipemg_spe     ,"
                     " fcpmtx_fichecipemg_texte,"
                     " cdf_codif             ,"
                     " sp_specialite"
                     " WHERE  FCPMTX_CDF_TER_CODE_FK_PK = CDF_CODE_PK"
                     " AND    FCPMSP_SP_CODE_FK_PK      = SP_CODE_SQ_PK"
                     " AND    UPPER(CDF_NOM)          LIKE UPPER('"+LibTxt+"')"
                     " AND    CDF_NUMERO_PK             = 'CS'"
                     " AND    FCPMTX_FCPM_CODE_FK_PK    = FCPMSP_FCPM_CODE_FK_PK"
                     " AND    FCPMTX_NATURECIPEMG_FK_PK = 'N'"
                     " ORDER BY SP_NOM ASC ;";

       } else if ( TypCi == 4) {

 //+        SELECT   CDF_NUMERO_PK,
 //+                 CDF_CODE_PK,
 //+                 CDF_NOM,
 //+                 CDF_DATECR,
 //+                 CDF_DATEMJ,
 //+                 SP_NOM,
 //+                 FCPMSP_SP_CODE_FK_PK,
 //+                 FCPMTX_TEXTE,
 //+                 FCPMTX_NATURECIPEMG_FK_PK
 //+          FROM   FCPMSP_CIPEMG_SPE,
 //+                 FCPMTX_FICHECIPEMG_TEXTE,
 //+                 CDF_CODIF,
 //+                 SP_SPECIALITE
 //+          WHERE  FCPMTX_CDF_TER_CODE_FK_PK = CDF_CODE_PK
 //+          AND    FCPMSP_SP_CODE_FK_PK      = SP_CODE_SQ_PK
 //+          AND    UPPER(CDF_NOM)          LIKE UPPER(LibTxt)
 //+          AND    CDF_NUMERO_PK             = 'CS'
 //+          AND    FCPMTX_FCPM_CODE_FK_PK    = FCPMSP_FCPM_CODE_FK_PK
 //+          AND    FCPMTX_NATURECIPEMG_FK_PK = 'I'
 //+          ORDER BY SP_NOM ASC ;
                sql_query +=
                     " SELECT   CDF_NUMERO_PK,"
                     " CDF_CODE_PK,"
                     " CDF_NOM,"
                     " CDF_DATECR,"
                     " CDF_DATEMJ,"
                     " SP_NOM,"
                     " FCPMSP_SP_CODE_FK_PK,"
                     " FCPMTX_TEXTE,"
                     " FCPMTX_NATURECIPEMG_FK_PK"
                     " FROM   fcpmsp_cipemg_spe,"
                     " fcpmtx_fichecipemg_texte,"
                     " cdf_codif,"
                     " sp_specialite"
                     " WHERE  FCPMTX_CDF_TER_CODE_FK_PK = CDF_CODE_PK"
                     " AND    FCPMSP_SP_CODE_FK_PK      = SP_CODE_SQ_PK"
                     " AND    UPPER(CDF_NOM)          LIKE UPPER('"+LibTxt+"')"
                     " AND    CDF_NUMERO_PK             = 'CS'"
                     " AND    FCPMTX_FCPM_CODE_FK_PK    = FCPMSP_FCPM_CODE_FK_PK"
                     " AND    FCPMTX_NATURECIPEMG_FK_PK = 'I'"
                     " ORDER BY SP_NOM ASC ;";

       } else if ( TypCi == 5) {

 //+          SELECT CDF_NUMERO_PK,
 //+                 CDF_CODE_PK,
 //+                 CDF_NOM,
 //+                 CDF_DATECR,
 //+                 CDF_DATEMJ,
 //+                 SP_NOM,
 //+                 FCPMSP_SP_CODE_FK_PK,
 //+                 FCPMTX_TEXTE,
 //+                 FCPMTX_NATURECIPEMG_FK_PK
 //+          FROM   FCPMSP_CIPEMG_SPE,
 //+                 FCPMTX_FICHECIPEMG_TEXTE,
 //+                 CDF_CODIF,
 //+                 SP_SPECIALITE
 //+          WHERE  FCPMTX_CDF_TER_CODE_FK_PK = CDF_CODE_PK
 //+          AND    FCPMSP_SP_CODE_FK_PK      = SP_CODE_SQ_PK
 //+          AND    UPPER(CDF_NOM)          LIKE UPPER(LibTxt)
 //+          AND    CDF_NUMERO_PK             = 'CS'
 //+          AND    FCPMTX_FCPM_CODE_FK_PK    = FCPMSP_FCPM_CODE_FK_PK
 //+          AND    FCPMTX_NATURECIPEMG_FK_PK IN ('C', 'P','I','N')
 //+          ORDER BY SP_NOM ASC ;
                sql_query +=
                     " SELECT CDF_NUMERO_PK,"
                     " CDF_CODE_PK,"
                     " CDF_NOM,"
                     " CDF_DATECR,"
                     " CDF_DATEMJ,"
                     " SP_NOM,"
                     " FCPMSP_SP_CODE_FK_PK,"
                     " FCPMTX_TEXTE,"
                     " FCPMTX_NATURECIPEMG_FK_PK"
                     " FROM   fcpmsp_cipemg_spe,"
                     " fcpmtx_fichecipemg_texte,"
                     " cdf_codif,"
                     " sp_specialite"
                     " WHERE  FCPMTX_CDF_TER_CODE_FK_PK = CDF_CODE_PK"
                     " AND    FCPMSP_SP_CODE_FK_PK      = SP_CODE_SQ_PK"
                     " AND    UPPER(CDF_NOM)          LIKE UPPER('"+LibTxt+"')"
                     " AND    CDF_NUMERO_PK             = 'CS'"
                     " AND    FCPMTX_FCPM_CODE_FK_PK    = FCPMSP_FCPM_CODE_FK_PK"
                     " AND    FCPMTX_NATURECIPEMG_FK_PK IN ('C', 'P','I','N')"
                     " ORDER BY SP_NOM ASC ;";

       } else {
 //+       C_GET_THE_CIPEMG := NULL;
         return 0;
       }
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_CIPEMG() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_CDF_NUMERO_PK             = value(0).toString();
                m_CDF_CODE_PK               = value(1).toString();
                m_CDF_NOM                   = value(2).toString();
                m_CDF_DATECR                = value(3).toDate();
                m_CDF_DATEMJ                = value(4).toDate();
                m_SP_NOM                    = value(5).toString();
                m_FCPMSP_SP_CODE_FK_PK      = value(6).toDouble();
                m_FCPMTX_TEXTE              = value(7).toString();
                m_FCPMTX_NATURECIPEMG_FK_PK = value(8).toString();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      QString CDF_NUMERO_PK()             {return m_CDF_NUMERO_PK;}
      QString CDF_CODE_PK()               {return m_CDF_CODE_PK;}
      QString CDF_NOM()                   {return m_CDF_NOM;}
      QDate   CDF_DATECR()                {return m_CDF_DATECR;}
      QDate   CDF_DATEMJ()                {return m_CDF_DATEMJ;}
      QString SP_NOM()                    {return m_SP_NOM;}
      double  FCPMSP_SP_CODE_FK_PK()      {return m_FCPMSP_SP_CODE_FK_PK;}
      QString FCPMTX_TEXTE()              {return m_FCPMTX_TEXTE;}
      QString FCPMTX_NATURECIPEMG_FK_PK() {return m_FCPMTX_NATURECIPEMG_FK_PK;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      QString m_CDF_NUMERO_PK;
      QString m_CDF_CODE_PK;
      QString m_CDF_NOM;
      QDate   m_CDF_DATECR;
      QDate   m_CDF_DATEMJ;
      QString m_SP_NOM;
      double  m_FCPMSP_SP_CODE_FK_PK;
      QString m_FCPMTX_TEXTE;
      QString m_FCPMTX_NATURECIPEMG_FK_PK;
 };

 //================================== C_GET_THE_DET_CIPEMG_CUR   -31- ==================================
 /****************************************************************************
 *   Nom           :  GET_THE_DET_CIPEMG
 -----------------------------------------------------------------------------
 *   Date creation : 16/07/2008
 -----------------------------------------------------------------------------
 *   Description   :  cette procédure donne les informations complémentaire rattachées à une fiche
 *                    indication passé en paramétre et le terrain
 *
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_DET_CIPEMG_CUR  C_GET_THE_DET_CIPEMG ( database(), this );
      while ( C_GET_THE_DET_CIPEMG.next( IdCipemg , CodeTer , Nature , IdSeq , TypId  ) )
            { html += tr("<br><b> GET_THE_DET_CIPEMG : </b>  ") + C_GET_THE_DET_CIPEMG.MEMBER();
            }
  */
  class C_GET_THE_DET_CIPEMG_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_DET_CIPEMG_CUR ---------------------
      C_GET_THE_DET_CIPEMG_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( double IdCipemg , QString CodeTer , QString Nature , double IdSeq , double TypId )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............
       if ( TypId == 1) {                 // COMMENTAIRES TERRAINS
                sql_query +=
                     " SELECT CDF_NOM  AS TEXTDET ,"
                     " NULL            AS INFO_01"
                     " FROM   tercom_terrain_commentaire,"
                     " cdf_codif"
                     " WHERE  TERCOM_FCPM_CODE_FK_PK      = '"+ QString::number( IdCipemg ) +"'"
                     " AND    TERCOM_CDF_TER_CODE_FK_PK   = '"+CodeTer+"'"
                     " AND    TERCOM_NUMSEQ_TER_FK_PK     = '"+ QString::number( IdSeq ) +"'"
                     " AND    TERCOM_NATURE_CIPEMG_FK_PK  = '"+Nature+"'"
                     " AND    CDF_CODE_PK                = TERCOM_CDF_COM_CODE_FK_PK"
                     " AND    CDF_NUMERO_PK              = 'CC'"
                     " ORDER BY TERCOM_NUMSEQ  ;";
       } else if ( TypId == 2) {          // NIVEAU CIPEMG
                sql_query +=
                     " SELECT CDF_NOM    AS TEXTDET ,"
                     " NULL              AS INFO_01"
                     " FROM   nivcom_niveau_commentaire,"
                     " cdf_codif"
                     " WHERE  NIVCOM_FCPM_CODE_FK_PK      = '"+ QString::number( IdCipemg ) +"'"
                     " AND    NIVCOM_CDF_TER_CODE_FK_PK   = '"+CodeTer+"'"
                     " AND    NIVCOM_NUMSEQ_TER_FK_PK     = '"+ QString::number( IdSeq ) +"'"
                     " AND    NIVCOM_NATURE_CIPEMG_FK_PK  = '"+Nature+"'"
                     " AND    CDF_CODE_PK                = NIVCOM_CDF_COM_CODE_FK_PK"
                     " AND    CDF_NUMERO_PK              = 'CC'"
                     " ORDER BY NIVCOM_NUMSEQ ;";
       } else if ( TypId == 3) {        //  RECOMMANDATIONS
                sql_query +=
                     " SELECT CDF_NOM     AS TEXTDET ,"
                     " NULL               AS INFO_01"
                     " FROM   autcom_autre_commentaire,"
                     " cdf_codif"
                     " WHERE  AUTCOM_FCPM_CODE_FK_PK      = '"+ QString::number( IdCipemg ) +"'"
                     " AND    AUTCOM_CDF_TER_CODE_FK_PK   = '"+CodeTer+"'"
                     " AND    AUTCOM_NUMSEQ_TER_FK_PK     = '"+ QString::number( IdSeq ) +"'"
                     " AND    AUTCOM_NATURE_CIPEMG_FK_PK  = '"+Nature+"'"
                     " AND    CDF_CODE_PK                = AUTCOM_CDF_COM_CODE_FK_PK"
                     " AND    CDF_NUMERO_PK              = 'CC'"
                     " ORDER BY AUTCOM_NUMSEQ    ;";
       } else if ( TypId == 4) {       //   texte
                sql_query +=
                     " SELECT FCPMTX_TEXTE  AS TEXTDET ,"
                     " NULL                 AS INFO_01"
                     " FROM   fcpmter_fcpm_terrain, fcpmtx_fichecipemg_texte"
                     " WHERE  FCPMTER_CDF_TER_CODE_FK_PK  = FCPMTX_CDF_TER_CODE_FK_PK"
                     " AND    FCPMTX_FCPM_CODE_FK_PK      = FCPMTER_FCPM_CODE_FK_PK"
                     " AND    FCPMTER_NATURE_CIPEMG_PK    = FCPMTX_NATURECIPEMG_FK_PK"
                     " AND    FCPMTER_NATURE_CIPEMG_PK     = '"+Nature+"'"
                     " AND    FCPMTER_CDF_TER_CODE_FK_PK   = '"+CodeTer+"'"
                     " AND    FCPMTER_FCPM_CODE_FK_PK      = '"+ QString::number( IdCipemg ) +"'"
                     " AND    FCPMTER_NUMSEQ_PK            = '"+ QString::number( IdSeq ) +"'"
                     " AND    FCPMTER_NUMSEQ_PK           = FCPMTX_NUMSEQ_TER_FK_PK ;";
       } else if ( TypId == 5) {     // CIM10 relié au terrain
                sql_query +=
                     " SELECT CIM_LIBELLE_LONG          AS TEXTDET ,"
                     " CIM_CODE_PK                      AS INFO_01"
                     " FROM   fcpmter_fcpm_terrain,"
                     " cimcdf_cim10_codif,"
                     " cim10"
                     " WHERE  FCPMTER_FCPM_CODE_FK_PK       = '"+ QString::number( IdCipemg ) +"'"
                     " AND    FCPMTER_CDF_TER_CODE_FK_PK    = '"+CodeTer+"'"
                     " AND    FCPMTER_NUMSEQ_PK             = '"+ QString::number( IdSeq ) +"'"
                     " AND    FCPMTER_NATURE_CIPEMG_PK      = '"+Nature+"'"
                     " AND    CIMCDF_CDF_CODE_FK_PK        = FCPMTER_CDF_TER_CODE_FK_PK"
                     " AND    CIMCDF_CDF_NUMERO_FK_PK      = 'CS'"
                     " AND    CIM_CODE_PK                  = CIMCDF_CIM_CODE_FK_PK  ;";
       } else if ( TypId == 6) {      // CIM10 relié au commentaires terrain
                sql_query +=
                     " SELECT DISTINCT cim_libelle_long  AS TEXTDET ,"
                     " CIM_CODE_PK                       AS INFO_01"
                     " FROM   tercom_terrain_commentaire,"
                     " cimcdf_cim10_codif        ,"
                     " cim10                     ,"
                     " cdf_codif"
                     " WHERE  TERCOM_FCPM_CODE_FK_PK      = '"+ QString::number( IdCipemg ) +"'"
                     " AND    TERCOM_CDF_TER_CODE_FK_PK   = '"+CodeTer+"'"
                     " AND    TERCOM_NUMSEQ_TER_FK_PK     = '"+ QString::number( IdSeq ) +"'"
                     " AND    TERCOM_NATURE_CIPEMG_FK_PK  = '"+Nature+"'"
                     " AND    CDF_CODE_PK                = TERCOM_CDF_COM_CODE_FK_PK"
                     " AND    CDF_NUMERO_PK              = 'CC'"
                     " AND    CIMCDF_CDF_CODE_FK_PK      = TERCOM_CDF_COM_CODE_FK_PK"
                     " AND    CIMCDF_CDF_NUMERO_FK_PK    = 'CC'"
                     " AND    CIM_CODE_PK                = CIMCDF_CIM_CODE_FK_PK"
                     " GROUP BY CIM_LIBELLE_LONG,CIM_CODE_PK"
                     " ORDER BY 1 ;";
       } else {
         return 0;
       }
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_DET_CIPEMG() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_TEXTDET = value(0).toString();
                m_INFO_01 = value(1).toString();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      QString TEXTDET() {return m_TEXTDET;}
      QString INFO_01() {return m_INFO_01;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      QString m_TEXTDET;
      QString m_INFO_01;
 };

 //================================== C_GET_THE_REF_CIPEMG_CUR   -32- ==================================
 /****************************************************************************
 *   Nom           :  GET_THE_REF_CIPEMG
 -----------------------------------------------------------------------------
 *   Date creation : 17/07/2008
 -----------------------------------------------------------------------------
 *   Description   :  cette procédure affiche les réferences pour une fiche
 *                    contre-indication et un code spécialité en paramétre
 ----------------------------------------------------------------------------
 *   Date Maj      : 16/02/2009 - Mourad
 -----------------------------------------------------------------------------
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_REF_CIPEMG_CUR  C_GET_THE_REF_CIPEMG ( database(), this );
      while ( C_GET_THE_REF_CIPEMG.next( CodeId , IdCipemg  ) )
            { html += tr("<br><b> GET_THE_REF_CIPEMG : </b>  ") + C_GET_THE_REF_CIPEMG.MEMBER();
            }
  */
  class C_GET_THE_REF_CIPEMG_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_REF_CIPEMG_CUR ---------------------
      C_GET_THE_REF_CIPEMG_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( double CodeId , double IdCipemg )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............

 //+          SELECT cdf_nom           AS REFOFF,
 //+                 fcpmafs_date_pk   AS DTREFOFF
 //+          FROM   CDF_CODIF, FCPMAFS_CIPEMG_AFSSAPS
 //+          WHERE  FCPMAFS_CDF_DOCUMENT_FK_PK  = CDF_CODE_PK
 //+          AND    FCPMAFS_FCPM_CODE_FK_PK     = IdCipemg
 //+          AND    FCPMAFS_SP_CODE_FK_PK       = Codeid
 //+          AND    CDF_NUMERO_PK               = '25'
 //+          AND    FCPMAFS_DATE_PK IN ( SELECT MAX (FCPMAFS_DATE_PK)
 //+                                      FROM   FCPMAFS_CIPEMG_AFSSAPS
 //+                                      WHERE  FCPMAFS_FCPM_CODE_FK_PK = IdCipemg
 //+                                      AND    FCPMAFS_SP_CODE_FK_PK   = Codeid);
                sql_query += " SELECT CDF_NOM           AS REFOFF,"
                     " FCPMAFS_DATE_PK   AS DTREFOFF"
                     " FROM   cdf_codif, fcpmafs_cipemg_afssaps"
                     " WHERE  FCPMAFS_CDF_DOCUMENT_FK_PK  = CDF_CODE_PK"
                     " AND    FCPMAFS_FCPM_CODE_FK_PK      = '"+ QString::number( IdCipemg ) +"'"
                     " AND    FCPMAFS_SP_CODE_FK_PK        = '"+ QString::number( CodeId ) +"'"
                     " AND    CDF_NUMERO_PK               = '25'"
                     " AND    FCPMAFS_DATE_PK IN ( SELECT MAX(FCPMAFS_DATE_PK)"    // ATTENTION MAX( et non MAX (
                     " FROM   fcpmafs_cipemg_afssaps"
                     " WHERE  FCPMAFS_FCPM_CODE_FK_PK  = '"+ QString::number( IdCipemg ) +"'"
                     " AND    FCPMAFS_SP_CODE_FK_PK    = '"+ QString::number( CodeId ) +"');";
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_REF_CIPEMG() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_REFOFF   = value(0).toString();
                m_DTREFOFF = value(1).toDate();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      QString REFOFF()   {return m_REFOFF;}
      QDate   DTREFOFF() {return m_DTREFOFF;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      QString m_REFOFF;
      QDate   m_DTREFOFF;
 };

 //================================== C_GET_THE_REF_CIPEMG_RCP_CUR   -33- ==================================
 /****************************************************************************
 *   Nom           :  GET_THE_REF_CIPEMG_RCP
 -----------------------------------------------------------------------------
 *   Date creation : 17/07/2008
 -----------------------------------------------------------------------------
 *   Description   :  cette procédure renvoie les fiches RCP pour un identifiant de spécialité
 *                    a une date donné
 *   MAJ           :  07/10/2008 - Anis
         16/02/2009 - Mourad
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_REF_CIPEMG_RCP_CUR  C_GET_THE_REF_CIPEMG_RCP ( database(), this );
      while ( C_GET_THE_REF_CIPEMG_RCP.next( IDSPE  , TYP, DT_REF , NOFIC ) )
            { html += tr("<br><b> GET_THE_REF_CIPEMG_RCP : </b>  ") + C_GET_THE_REF_CIPEMG_RCP.MEMBER();
            }
  */
  class C_GET_THE_REF_CIPEMG_RCP_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_REF_CIPEMG_RCP_CUR ---------------------
      C_GET_THE_REF_CIPEMG_RCP_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( const QString &IDSPE   , int TYP, const QString &DT_REF="0" , const QString &NOFIC="")     // NOFIC = CODE_CIPEMG()
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............
       if ( TYP== 1 && DT_REF.toInt() != 0) {

 //+          SELECT  'RCP'        AS STATUT ,
 //+        FCPTAFS_FCPT_CODE_FK_PK AS RCPFIC ,
 //+        cdf_nom                AS REF    ,
 //+                  fcptafs_date_pk        AS DAT_REF,
 //+                  fcpttx1_txtci          AS REF_TXT
 //+          FROM    FCPTAFS_CIPEMG_AFSSAPS ,
 //+        FCPMAFS_CIPEMG_AFSSAPS ,
 //+                  CDF_CODIF              ,
 //+                  FCPTTX1_CIPEMG_TXCI    ,
 //+      FCPT_FICHECIPEMG
 //+          WHERE  FCPT_CODE_SQ_PK          = FCPTTX1_FCPT_CODE_FK_PK
 //+     AND  FCPT_CODE_SQ_PK      = FCPTAFS_FCPT_CODE_FK_PK
 //+   AND  FCPMAFS_SP_CODE_FK_PK       = FCPTAFS_SP_CODE_FK_PK
 //+   AND  FCPMAFS_DATE_PK             = FCPTAFS_DATE_PK
 //+   AND  FCPTAFS_CDF_DOCUMENT_FK_PK  = CDF_CODE_PK
 //+           AND  CDF_NUMERO_PK               = '25'
 //+      AND  FCPMAFS_FCPM_CODE_FK_PK     = NOFIC
 //+            AND  FCPTAFS_SP_CODE_FK_PK       = IDSPE
 //+      AND  FCPMAFS_DATE_PK     = TO_DATE(DT_REF, 'DD/MM/YYYY');
                sql_query +=
                     " SELECT  'RCP'             AS STATUT ,"
                     " FCPTAFS_FCPT_CODE_FK_PK   AS RCPFIC ,"
                     " CDF_NOM                   AS REF    ,"
                     " FCPTAFS_DATE_PK           AS DAT_REF,"
                     " FCPTTX1_TXTCI             AS REF_TXT"
                     " FROM    fcptafs_cipemg_afssaps ,"
                     " fcpmafs_cipemg_afssaps ,"
                     " cdf_codif              ,"
                     " fcpttx1_cipemg_txci    ,"
                     " fcpt_fichecipemg"
                     " WHERE  FCPT_CODE_SQ_PK            = FCPTTX1_FCPT_CODE_FK_PK"
                     " AND  FCPT_CODE_SQ_PK              = FCPTAFS_FCPT_CODE_FK_PK"
                     " AND  FCPMAFS_SP_CODE_FK_PK        = FCPTAFS_SP_CODE_FK_PK"
                     " AND  FCPMAFS_DATE_PK              = FCPTAFS_DATE_PK"
                     " AND  FCPTAFS_CDF_DOCUMENT_FK_PK   = CDF_CODE_PK"
                     " AND  CDF_NUMERO_PK                = '25'"
                     " AND  FCPMAFS_FCPM_CODE_FK_PK      = '"+ NOFIC +"'"
                     " AND  FCPTAFS_SP_CODE_FK_PK        = '"+ IDSPE +"'"
                     " AND  FCPMAFS_DATE_PK     = STR_TO_DATE("+DT_REF+", '%d%m%Y');";    // TO_DATE DD/MM/YYYY

       } else if ( TYP == 1 && DT_REF.toInt() == 0) {

 //+     SELECT  'AFS'       AS STATUT,
 //+      FCPTAFS_FCPT_CODE_FK_PK AS RCPFIC ,
 //+        cdf_nom                AS REF    ,
 //+                  fcptafs_date_pk        AS DAT_REF,
 //+                  fcpttx1_txtci          AS REF_TXT
 //+          FROM    FCPTAFS_CIPEMG_AFSSAPS ,
 //+        CDF_CODIF              ,
 //+                  FCPTTX1_CIPEMG_TXCI    ,
 //+      FCPT_FICHECIPEMG
 //+          WHERE  FCPT_CODE_SQ_PK          = FCPTTX1_FCPT_CODE_FK_PK
 //+     AND  FCPT_CODE_SQ_PK      = FCPTAFS_FCPT_CODE_FK_PK
 //+   AND  FCPTAFS_CDF_DOCUMENT_FK_PK  = CDF_CODE_PK
 //+            AND  CDF_NUMERO_PK               = '25'
 //+      AND  FCPTAFS_SP_CODE_FK_PK       = IDSPE
 //+      AND  FCPTAFS_DATE_PK = (SELECT MAX(FCPTAFS_DATE_PK) FROM FCPTAFS_CIPEMG_AFSSAPS WHERE FCPTAFS_SP_CODE_FK_PK = IDSPE);
                sql_query +=
                     " SELECT  'AFS'             AS STATUT,"
                     " FCPTAFS_FCPT_CODE_FK_PK   AS RCPFIC ,"
                     " CDF_NOM                   AS REF    ,"
                     " FCPTAFS_DATE_PK           AS DAT_REF,"
                     " FCPTTX1_TXTCI             AS REF_TXT"
                     " FROM    fcptafs_cipemg_afssaps ,"
                     " cdf_codif              ,"
                     " fcpttx1_cipemg_txci    ,"
                     " fcpt_fichecipemg"
                     " WHERE  FCPT_CODE_SQ_PK           = FCPTTX1_FCPT_CODE_FK_PK"
                     " AND  FCPT_CODE_SQ_PK             = FCPTAFS_FCPT_CODE_FK_PK"
                     " AND  FCPTAFS_CDF_DOCUMENT_FK_PK  = CDF_CODE_PK"
                     " AND  CDF_NUMERO_PK               = '25'"
                     " AND  FCPTAFS_SP_CODE_FK_PK       = '"+  IDSPE  +"'"
                     " AND  FCPTAFS_DATE_PK = (SELECT MAX(FCPTAFS_DATE_PK) FROM fcptafs_cipemg_afssaps WHERE FCPTAFS_SP_CODE_FK_PK  = '"+  IDSPE  +"');";

       } else if ( TYP == 2 && DT_REF.toInt() != 0) {

 //+          SELECT  'RCP'          AS STATUT,
 //+        FCPTAFS_FCPT_CODE_FK_PK AS RCPFIC,
 //+        cdf_nom                 AS REF      ,
 //+                  fcptafs_date_pk         AS DAT_REF  ,
 //+                  fcpttx2_txtpemg         AS REF_TXT
 //+          FROM    FCPTAFS_CIPEMG_AFSSAPS ,
 //+        FCPMAFS_CIPEMG_AFSSAPS ,
 //+                  CDF_CODIF              ,
 //+                  FCPTTX2_CIPEMG_TXPEMG  ,
 //+      FCPT_FICHECIPEMG
 //+         WHERE  FCPT_CODE_SQ_PK          = FCPTTX2_FCPT_CODE_FK_PK
 //+     AND  FCPT_CODE_SQ_PK      = FCPTAFS_FCPT_CODE_FK_PK
 //+   AND  FCPMAFS_SP_CODE_FK_PK       = FCPTAFS_SP_CODE_FK_PK
 //+   AND  FCPMAFS_DATE_PK             = FCPTAFS_DATE_PK
 //+   AND  FCPTAFS_CDF_DOCUMENT_FK_PK  = CDF_CODE_PK
 //+      AND  CDF_NUMERO_PK              = '25'
 //+      AND  FCPMAFS_FCPM_CODE_FK_PK    = NOFIC
 //+      AND  FCPTAFS_SP_CODE_FK_PK      = IDSPE
 //+            AND  FCPMAFS_DATE_PK     = TO_DATE(DT_REF, 'DD/MM/YYYY');
                sql_query +=
                     " SELECT  'RCP'            AS STATUT,"
                     " FCPTAFS_FCPT_CODE_FK_PK  AS RCPFIC,"
                     " CDF_NOM                  AS REF      ,"
                     " FCPTAFS_DATE_PK          AS DAT_REF  ,"
                     " FCPTTX2_TXTPEMG          AS REF_TXT"
                     " FROM    fcptafs_cipemg_afssaps ,"
                     " fcpmafs_cipemg_afssaps ,"
                     " cdf_codif              ,"
                     " fcpttx2_cipemg_txpemg  ,"
                     " fcpt_fichecipemg"
                     " WHERE  FCPT_CODE_SQ_PK           = FCPTTX2_FCPT_CODE_FK_PK"
                     " AND  FCPT_CODE_SQ_PK             = FCPTAFS_FCPT_CODE_FK_PK"
                     " AND  FCPMAFS_SP_CODE_FK_PK       = FCPTAFS_SP_CODE_FK_PK"
                     " AND  FCPMAFS_DATE_PK             = FCPTAFS_DATE_PK"
                     " AND  FCPTAFS_CDF_DOCUMENT_FK_PK  = CDF_CODE_PK"
                     " AND  CDF_NUMERO_PK               = '25'"
                     " AND  FCPMAFS_FCPM_CODE_FK_PK     = '"+  NOFIC  +"'"
                     " AND  FCPTAFS_SP_CODE_FK_PK       = '"+  IDSPE  +"'"
                     " AND  FCPMAFS_DATE_PK             = STR_TO_DATE("+DT_REF+", '%d%m%Y');";    // DD/MM/YYYY

       } else if ( TYP == 2 && DT_REF.toInt() == 0) {

 //+          SELECT  'AFS'          AS  STATUT,
 //+        FCPTAFS_FCPT_CODE_FK_PK AS RCPFIC,
 //+        cdf_nom                 AS REF      ,
 //+                  fcptafs_date_pk         AS DAT_REF  ,
 //+                  fcpttx2_txtpemg         AS REF_TXT
 //+          FROM    FCPTAFS_CIPEMG_AFSSAPS ,
 //+                  CDF_CODIF              ,
 //+                  FCPT_FICHECIPEMG       ,
 //+                  FCPTTX2_CIPEMG_TXPEMG
 //+          WHERE  FCPT_CODE_SQ_PK          = FCPTTX2_FCPT_CODE_FK_PK
 //+     AND  FCPT_CODE_SQ_PK      = FCPTAFS_FCPT_CODE_FK_PK
 //+   AND  FCPTAFS_CDF_DOCUMENT_FK_PK  = CDF_CODE_PK
 //+      AND  CDF_NUMERO_PK               = '25'
 //+      AND  FCPTAFS_SP_CODE_FK_PK       = IDSPE
 //+            AND  FCPTAFS_DATE_PK = (SELECT MAX(FCPTAFS_DATE_PK) FROM FCPTAFS_CIPEMG_AFSSAPS WHERE FCPTAFS_SP_CODE_FK_PK = IDSPE);
                sql_query +=
                     " SELECT  'AFS'           AS STATUT,"
                     " FCPTAFS_FCPT_CODE_FK_PK AS RCPFIC,"
                     " CDF_NOM                 AS REF      ,"
                     " FCPTAFS_DATE_PK         AS DAT_REF  ,"
                     " FCPTTX2_TXTPEMG         AS REF_TXT"
                     " FROM    fcptafs_cipemg_afssaps ,"
                     " cdf_codif              ,"
                     " fcpt_fichecipemg       ,"
                     " fcpttx2_cipemg_txpemg"
                     " WHERE  FCPT_CODE_SQ_PK           = FCPTTX2_FCPT_CODE_FK_PK"
                     " AND  FCPT_CODE_SQ_PK             = FCPTAFS_FCPT_CODE_FK_PK"
                     " AND  FCPTAFS_CDF_DOCUMENT_FK_PK  = CDF_CODE_PK"
                     " AND  CDF_NUMERO_PK               = '25'"
                     " AND  FCPTAFS_SP_CODE_FK_PK       = '"+  IDSPE  +"'"
                     " AND  FCPTAFS_DATE_PK = (SELECT MAX(FCPTAFS_DATE_PK) FROM fcptafs_cipemg_afssaps WHERE FCPTAFS_SP_CODE_FK_PK  = '"+  IDSPE  +"');";

       } else {
 //+       C_GET_THE_REF_CIPEMG_RCP := NULL;
         return 0;
       }
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_REF_CIPEMG_RCP() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_STATUT  = value(0).toString();
                m_RCPFIC  = value(1).toDouble();
                m_REF     = value(2).toString();
                m_DAT_REF = value(3).toDate();
                m_REF_TXT = value(4).toString();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      QString STATUT()  {return m_STATUT;}
      double  RCPFIC()  {return m_RCPFIC;}
      QString REF()     {return m_REF;}
      QDate   DAT_REF() {return m_DAT_REF;}
      QString REF_TXT() {return m_REF_TXT;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      QString m_STATUT;
      double  m_RCPFIC;
      QString m_REF;
      QDate   m_DAT_REF;
      QString m_REF_TXT;
 };

 //================================== C_GET_THE_CIPEMG_SPE_CUR   -34- ==================================
 /****************************************************************************
 *   Nom           :  GET_THE_CIPEMG_SPE
 -----------------------------------------------------------------------------
 *   Date creation : 17/07/2008
 -----------------------------------------------------------------------------
 *   Description   :  cette procédure renvoie les contre-indication pour le code
 *                    spécialité passé en paramétre ,le deusieme parametre indique
 *                    le nivau de la contre indication souhaité
 *   MAJ           :  08/09/2008
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_CIPEMG_SPE_CUR  C_GET_THE_CIPEMG_SPE ( database(), this );
      while ( C_GET_THE_CIPEMG_SPE.next( CodeId , TypId  ) )
            { html += tr("<br><b> GET_THE_CIPEMG_SPE : </b>  ") + C_GET_THE_CIPEMG_SPE.MEMBER();
            }
  */
  class C_GET_THE_CIPEMG_SPE_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_CIPEMG_SPE_CUR ---------------------
      C_GET_THE_CIPEMG_SPE_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( double CodeId , QString TypId )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............
       if ( TypId.toInt() == 1) {

 //+   SELECT t4.FCPMTER_FCPM_CODE_FK_PK      AS IDCIPEMG,
 //+      t4.FCPMTER_NATURE_CIPEMG_PK    AS NATURE,
 //+      t3.cdf_code_pk                 AS CODETER,
 //+      t3.cdf_nom                     AS TERRAIN,
 //+      t2.fcpmtx_texte                AS TEXT,
 //+      t4.FCPMTER_NUMSEQ_PK           AS NO_SEQ
 //+     FROM   FCPMSP_CIPEMG_SPE         t1,
 //+      FCPMTX_FICHECIPEMG_TEXTE  t2,
 //+      CDF_CODIF                 t3,
 //+      FCPMTER_FCPM_TERRAIN      t4
 //+   WHERE  t4.FCPMTER_CDF_TER_CODE_FK_PK = t3.CDF_CODE_PK
 //+   AND    t3.CDF_NUMERO_PK              = 'CS'
 //+   AND    t4.FCPMTER_FCPM_CODE_FK_PK    = t1.FCPMSP_FCPM_CODE_FK_PK
 //+   AND    t4.FCPMTER_NATURE_CIPEMG_PK   = 'C'
 //+   AND    t4.FCPMTER_FCPM_CODE_FK_PK    = t2.FCPMTX_FCPM_CODE_FK_PK   (+)
 //+   AND    t4.FCPMTER_CDF_TER_CODE_FK_PK = t2.FCPMTX_CDF_TER_CODE_FK_PK(+)
 //+   AND    t4.FCPMTER_NATURE_CIPEMG_PK   = t2.FCPMTX_NATURECIPEMG_FK_PK(+)
 //+   AND    t4.FCPMTER_NUMSEQ_PK          = t2.FCPMTX_NUMSEQ_TER_FK_PK  (+)
 //+   AND    t1.FCPMSP_SP_CODE_FK_PK       = CodeId
 //+   ORDER BY 1 ;
                sql_query +=
                     " SELECT t4.FCPMTER_FCPM_CODE_FK_PK      AS IDCIPEMG,"         // -- CONTRE-INDICATION  'C'
                     " t4.FCPMTER_NATURE_CIPEMG_PK            AS NATURE,"
                     " t3.CDF_CODE_PK                 AS CODETER,"
                     " t3.CDF_NOM                     AS TERRAIN,"
                     " t2.FCPMTX_TEXTE                AS TEXT,"
                     " t4.FCPMTER_NUMSEQ_PK           AS NO_SEQ"
                     " FROM   fcpmsp_cipemg_spe         t1,"
                     " fcpmtx_fichecipemg_texte  t2,"
                     " cdf_codif                 t3,"
                     " fcpmter_fcpm_terrain      t4"
                     " WHERE  t4.FCPMTER_CDF_TER_CODE_FK_PK = t3.CDF_CODE_PK"
                     " AND    t3.CDF_NUMERO_PK              = 'CS'"
                     " AND    t4.FCPMTER_FCPM_CODE_FK_PK    = t1.FCPMSP_FCPM_CODE_FK_PK"
                     " AND    t4.FCPMTER_NATURE_CIPEMG_PK   = 'C'"
                     " AND    t4.FCPMTER_FCPM_CODE_FK_PK    = t2.FCPMTX_FCPM_CODE_FK_PK"
                     " AND    t4.FCPMTER_CDF_TER_CODE_FK_PK = t2.FCPMTX_CDF_TER_CODE_FK_PK"
                     " AND    t4.FCPMTER_NATURE_CIPEMG_PK   = t2.FCPMTX_NATURECIPEMG_FK_PK"
                     " AND    t4.FCPMTER_NUMSEQ_PK          = t2.FCPMTX_NUMSEQ_TER_FK_PK"
                     " AND    t1.FCPMSP_SP_CODE_FK_PK        = '"+ QString::number( CodeId ) +"'"
                     " ORDER BY 1 ;";

       } else if ( TypId.toInt() == 2) {

 //+         SELECT t4.FCPMTER_FCPM_CODE_FK_PK        AS IDCIPEMG,
 //+      t4.FCPMTER_NATURE_CIPEMG_PK    AS NATURE,
 //+      t3.cdf_code_pk                 AS CODETER,
 //+      t3.cdf_nom                     AS TERRAIN,
 //+      t2.fcpmtx_texte                AS TEXT,
 //+      t4.FCPMTER_NUMSEQ_PK           AS NO_SEQ
 //+     FROM   FCPMSP_CIPEMG_SPE         t1,
 //+      FCPMTX_FICHECIPEMG_TEXTE  t2,
 //+      CDF_CODIF                 t3,
 //+      FCPMTER_FCPM_TERRAIN      t4
 //+   WHERE  t4.FCPMTER_CDF_TER_CODE_FK_PK = t3.CDF_CODE_PK
 //+   AND    t3.CDF_NUMERO_PK              = 'CS'
 //+   AND    t4.FCPMTER_FCPM_CODE_FK_PK    = t1.FCPMSP_FCPM_CODE_FK_PK
 //+   AND    t4.FCPMTER_NATURE_CIPEMG_PK   = 'P'
 //+   AND    t4.FCPMTER_FCPM_CODE_FK_PK    = t2.FCPMTX_FCPM_CODE_FK_PK   (+)
 //+   AND    t4.FCPMTER_CDF_TER_CODE_FK_PK = t2.FCPMTX_CDF_TER_CODE_FK_PK(+)
 //+   AND    t4.FCPMTER_NATURE_CIPEMG_PK   = t2.FCPMTX_NATURECIPEMG_FK_PK(+)
 //+   AND    t4.FCPMTER_NUMSEQ_PK          = t2.FCPMTX_NUMSEQ_TER_FK_PK  (+)
 //+   AND    t1.FCPMSP_SP_CODE_FK_PK       = CodeId
 //+   ORDER BY 1 ;
                sql_query +=
                     " SELECT t4.FCPMTER_FCPM_CODE_FK_PK        AS IDCIPEMG,"  // -- PRECAUTION D'EMPLOI / MISE EN GARDE 'P'
                     " t4.FCPMTER_NATURE_CIPEMG_PK    AS NATURE,"
                     " t3.CDF_CODE_PK                 AS CODETER,"
                     " t3.CDF_NOM                     AS TERRAIN,"
                     " t2.FCPMTX_TEXTE                AS TEXT,"
                     " t4.FCPMTER_NUMSEQ_PK           AS NO_SEQ"
                     " FROM   fcpmsp_cipemg_spe         t1,"
                     " fcpmtx_fichecipemg_texte  t2,"
                     " cdf_codif                 t3,"
                     " fcpmter_fcpm_terrain      t4"
                     " WHERE  t4.FCPMTER_CDF_TER_CODE_FK_PK = t3.CDF_CODE_PK"
                     " AND    t3.CDF_NUMERO_PK              = 'CS'"
                     " AND    t4.FCPMTER_FCPM_CODE_FK_PK    = t1.FCPMSP_FCPM_CODE_FK_PK"
                     " AND    t4.FCPMTER_NATURE_CIPEMG_PK   = 'P'"
                     " AND    t4.FCPMTER_FCPM_CODE_FK_PK    = t2.FCPMTX_FCPM_CODE_FK_PK"
                     " AND    t4.FCPMTER_CDF_TER_CODE_FK_PK = t2.FCPMTX_CDF_TER_CODE_FK_PK"
                     " AND    t4.FCPMTER_NATURE_CIPEMG_PK   = t2.FCPMTX_NATURECIPEMG_FK_PK"
                     " AND    t4.FCPMTER_NUMSEQ_PK          = t2.FCPMTX_NUMSEQ_TER_FK_PK"
                     " AND    t1.FCPMSP_SP_CODE_FK_PK        = '"+ QString::number( CodeId ) +"'"
                     " ORDER BY 1 ;";

       } else if ( TypId.toInt() == 3) {

 //+         SELECT t4.FCPMTER_FCPM_CODE_FK_PK       AS IDCIPEMG,
 //+      t4.FCPMTER_NATURE_CIPEMG_PK    AS NATURE,
 //+      t3.cdf_code_pk                 AS CODETER,
 //+      t3.cdf_nom                     AS TERRAIN,
 //+      t2.fcpmtx_texte                AS TEXT,
 //+      t4.FCPMTER_NUMSEQ_PK           AS NO_SEQ
 //+     FROM   FCPMSP_CIPEMG_SPE         t1,
 //+      FCPMTX_FICHECIPEMG_TEXTE  t2,
 //+      CDF_CODIF                 t3,
 //+      FCPMTER_FCPM_TERRAIN      t4
 //+   WHERE  t4.FCPMTER_CDF_TER_CODE_FK_PK = t3.CDF_CODE_PK
 //+   AND    t3.CDF_NUMERO_PK              = 'CS'
 //+   AND    t4.FCPMTER_FCPM_CODE_FK_PK    = t1.FCPMSP_FCPM_CODE_FK_PK
 //+   AND    t4.FCPMTER_NATURE_CIPEMG_PK   = 'N'
 //+   AND    t4.FCPMTER_FCPM_CODE_FK_PK    = t2.FCPMTX_FCPM_CODE_FK_PK   (+)
 //+   AND    t4.FCPMTER_CDF_TER_CODE_FK_PK = t2.FCPMTX_CDF_TER_CODE_FK_PK(+)
 //+   AND    t4.FCPMTER_NATURE_CIPEMG_PK   = t2.FCPMTX_NATURECIPEMG_FK_PK(+)
 //+   AND    t4.FCPMTER_NUMSEQ_PK          = t2.FCPMTX_NUMSEQ_TER_FK_PK  (+)
 //+   AND    t1.FCPMSP_SP_CODE_FK_PK       = CodeId
 //+   ORDER BY 1 ;
                sql_query +=
                     " SELECT t4.FCPMTER_FCPM_CODE_FK_PK       AS IDCIPEMG,"       // -- NON CONTRE-INDICATION    'N'
                     " t4.FCPMTER_NATURE_CIPEMG_PK    AS NATURE,"
                     " t3.CDF_CODE_PK                 AS CODETER,"
                     " t3.CDF_NOM                     AS TERRAIN,"
                     " t2.FCPMTX_TEXTE                AS TEXT,"
                     " t4.FCPMTER_NUMSEQ_PK           AS NO_SEQ"
                     " FROM   fcpmsp_cipemg_spe         t1,"
                     " fcpmtx_fichecipemg_texte  t2,"
                     " cdf_codif                 t3,"
                     " fcpmter_fcpm_terrain      t4"
                     " WHERE  t4.FCPMTER_CDF_TER_CODE_FK_PK = t3.CDF_CODE_PK"
                     " AND    t3.CDF_NUMERO_PK              = 'CS'"
                     " AND    t4.FCPMTER_FCPM_CODE_FK_PK    = t1.FCPMSP_FCPM_CODE_FK_PK"
                     " AND    t4.FCPMTER_NATURE_CIPEMG_PK   = 'N'"
                     " AND    t4.FCPMTER_FCPM_CODE_FK_PK    = t2.FCPMTX_FCPM_CODE_FK_PK"
                     " AND    t4.FCPMTER_CDF_TER_CODE_FK_PK = t2.FCPMTX_CDF_TER_CODE_FK_PK"
                     " AND    t4.FCPMTER_NATURE_CIPEMG_PK   = t2.FCPMTX_NATURECIPEMG_FK_PK"
                     " AND    t4.FCPMTER_NUMSEQ_PK          = t2.FCPMTX_NUMSEQ_TER_FK_PK"
                     " AND    t1.FCPMSP_SP_CODE_FK_PK        = '"+ QString::number( CodeId ) +"'"
                     " ORDER BY 1 ;";

       } else if ( TypId.toInt() == 4) {

 //+         SELECT t4.FCPMTER_FCPM_CODE_FK_PK          AS IDCIPEMG,
 //+      t4.FCPMTER_NATURE_CIPEMG_PK    AS NATURE,
 //+      t3.cdf_code_pk                 AS CODETER,
 //+      t3.cdf_nom                     AS TERRAIN,
 //+      t2.fcpmtx_texte                AS  TEXT,
 //+      t4.FCPMTER_NUMSEQ_PK           AS NO_SEQ
 //+     FROM   FCPMSP_CIPEMG_SPE         t1,
 //+      FCPMTX_FICHECIPEMG_TEXTE  t2,
 //+      CDF_CODIF                 t3,
 //+      FCPMTER_FCPM_TERRAIN      t4
 //+   WHERE  t4.FCPMTER_CDF_TER_CODE_FK_PK = t3.CDF_CODE_PK
 //+   AND    t3.CDF_NUMERO_PK              = 'CS'
 //+   AND    t4.FCPMTER_FCPM_CODE_FK_PK    = t1.FCPMSP_FCPM_CODE_FK_PK
 //+   AND    t4.FCPMTER_NATURE_CIPEMG_PK   = 'I'
 //+   AND    t4.FCPMTER_FCPM_CODE_FK_PK    = t2.FCPMTX_FCPM_CODE_FK_PK   (+)
 //+   AND    t4.FCPMTER_CDF_TER_CODE_FK_PK = t2.FCPMTX_CDF_TER_CODE_FK_PK(+)
 //+   AND    t4.FCPMTER_NATURE_CIPEMG_PK   = t2.FCPMTX_NATURECIPEMG_FK_PK(+)
 //+   AND    t4.FCPMTER_NUMSEQ_PK          = t2.FCPMTX_NUMSEQ_TER_FK_PK  (+)
 //+   AND    t1.FCPMSP_SP_CODE_FK_PK       = CodeId
 //+   ORDER BY 1 ;
                sql_query +=
                     " SELECT t4.FCPMTER_FCPM_CODE_FK_PK          AS IDCIPEMG,"     // -- NON INDICAION  'I'
                     " t4.FCPMTER_NATURE_CIPEMG_PK    AS NATURE,"
                     " t3.CDF_CODE_PK                 AS CODETER,"
                     " t3.CDF_NOM                     AS TERRAIN,"
                     " t2.FCPMTX_TEXTE                AS  TEXT,"
                     " t4.FCPMTER_NUMSEQ_PK           AS NO_SEQ"
                     " FROM   fcpmsp_cipemg_spe         t1,"
                     " fcpmtx_fichecipemg_texte  t2,"
                     " cdf_codif                 t3,"
                     " fcpmter_fcpm_terrain      t4"
                     " WHERE  t4.FCPMTER_CDF_TER_CODE_FK_PK = t3.CDF_CODE_PK"
                     " AND    t3.CDF_NUMERO_PK              = 'CS'"
                     " AND    t4.FCPMTER_FCPM_CODE_FK_PK    = t1.FCPMSP_FCPM_CODE_FK_PK"
                     " AND    t4.FCPMTER_NATURE_CIPEMG_PK   = 'I'"
                     " AND    t4.FCPMTER_FCPM_CODE_FK_PK    = t2.FCPMTX_FCPM_CODE_FK_PK"
                     " AND    t4.FCPMTER_CDF_TER_CODE_FK_PK = t2.FCPMTX_CDF_TER_CODE_FK_PK"
                     " AND    t4.FCPMTER_NATURE_CIPEMG_PK   = t2.FCPMTX_NATURECIPEMG_FK_PK"
                     " AND    t4.FCPMTER_NUMSEQ_PK          = t2.FCPMTX_NUMSEQ_TER_FK_PK"
                     " AND    t1.FCPMSP_SP_CODE_FK_PK        = '"+ QString::number( CodeId ) +"'"
                     " ORDER BY 1 ;";

       } else if ( TypId.toInt() == 5) {

 //+        SELECT t4.FCPMTER_FCPM_CODE_FK_PK           AS IDCIPEMG,
 //+      t4.FCPMTER_NATURE_CIPEMG_PK    AS NATURE,
 //+      t3.cdf_code_pk                 AS CODETER,
 //+      t3.cdf_nom                     AS TERRAIN,
 //+      t2.fcpmtx_texte                AS TEXT,
 //+      t4.FCPMTER_NUMSEQ_PK           AS NO_SEQ
 //+     FROM   FCPMSP_CIPEMG_SPE         t1,
 //+      FCPMTX_FICHECIPEMG_TEXTE  t2,
 //+      CDF_CODIF                 t3,
 //+      FCPMTER_FCPM_TERRAIN      t4
 //+   WHERE  t4.FCPMTER_CDF_TER_CODE_FK_PK = t3.CDF_CODE_PK
 //+   AND    t3.CDF_NUMERO_PK              = 'CS'
 //+   AND    t4.FCPMTER_FCPM_CODE_FK_PK    = t1.FCPMSP_FCPM_CODE_FK_PK
 //+   AND    t4.FCPMTER_NATURE_CIPEMG_PK  IN ('C', 'P','I','N')
 //+   AND    t4.FCPMTER_FCPM_CODE_FK_PK    = t2.FCPMTX_FCPM_CODE_FK_PK   (+)
 //+   AND    t4.FCPMTER_CDF_TER_CODE_FK_PK = t2.FCPMTX_CDF_TER_CODE_FK_PK(+)
 //+   AND    t4.FCPMTER_NATURE_CIPEMG_PK   = t2.FCPMTX_NATURECIPEMG_FK_PK(+)
 //+   AND    t4.FCPMTER_NUMSEQ_PK          = t2.FCPMTX_NUMSEQ_TER_FK_PK  (+)
 //+   AND    t1.FCPMSP_SP_CODE_FK_PK       = CodeId
 //+   ORDER BY 1 ;
                sql_query +=
                     " SELECT t4.FCPMTER_FCPM_CODE_FK_PK           AS IDCIPEMG,"     // -- TOUTES LES SITUATIONS
                     " t4.FCPMTER_NATURE_CIPEMG_PK    AS NATURE,"
                     " t3.CDF_CODE_PK                 AS CODETER,"
                     " t3.CDF_NOM                     AS TERRAIN,"
                     " t2.FCPMTX_TEXTE                AS TEXT,"
                     " t4.FCPMTER_NUMSEQ_PK           AS NO_SEQ"
                     " FROM   fcpmsp_cipemg_spe         t1,"
                     " fcpmtx_fichecipemg_texte  t2,"
                     " cdf_codif                 t3,"
                     " fcpmter_fcpm_terrain      t4"
                     " WHERE  t4.FCPMTER_CDF_TER_CODE_FK_PK = t3.CDF_CODE_PK"
                     " AND    t3.CDF_NUMERO_PK              = 'CS'"
                     " AND    t4.FCPMTER_FCPM_CODE_FK_PK    = t1.FCPMSP_FCPM_CODE_FK_PK"
                     " AND    t4.FCPMTER_NATURE_CIPEMG_PK  IN ('C', 'P','I','N')"
                     " AND    t4.FCPMTER_FCPM_CODE_FK_PK    = t2.FCPMTX_FCPM_CODE_FK_PK"
                     " AND    t4.FCPMTER_CDF_TER_CODE_FK_PK = t2.FCPMTX_CDF_TER_CODE_FK_PK"
                     " AND    t4.FCPMTER_NATURE_CIPEMG_PK   = t2.FCPMTX_NATURECIPEMG_FK_PK"
                     " AND    t4.FCPMTER_NUMSEQ_PK          = t2.FCPMTX_NUMSEQ_TER_FK_PK"
                     " AND    t1.FCPMSP_SP_CODE_FK_PK        = '"+ QString::number( CodeId ) +"'"
                     " ORDER BY 1 ;";

       } else {
 //+       C_GET_THE_CIPEMG_SPE := NULL;
         return 0;
       }
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_CIPEMG_SPE() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_IDCIPEMG = value(0).toDouble();
                m_NATURE   = value(1).toString();
                m_CODETER  = value(2).toString();
                m_TERRAIN  = value(3).toString();
                m_TEXT     = value(4).toString();
                m_NO_SEQ   = value(5).toDouble();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      double  IDCIPEMG() {return m_IDCIPEMG;}
      QString NATURE()   {return m_NATURE;}
      QString CODETER()  {return m_CODETER;}
      QString TERRAIN()  {return m_TERRAIN;}
      QString TEXT()     {return m_TEXT;}
      double  NO_SEQ()   {return m_NO_SEQ;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      double  m_IDCIPEMG;
      QString m_NATURE;
      QString m_CODETER;
      QString m_TERRAIN;
      QString m_TEXT;
      double  m_NO_SEQ;
 };

 //================================== C_GET_THE_CIPEMG_SPE_TER_CUR   -35- ==================================
 /****************************************************************************
 *   Nom           :  GET_THE_CIPEMG_SPE_TER
 -----------------------------------------------------------------------------
 *   Date creation : 17/07/2008
 -----------------------------------------------------------------------------
 *   Description   :  cette procédure renvoie les contre-indication pour le code
 *                    spécialité passé en paramétre ,le deusieme parametre indique
 *                    le nivau de la contre indication souhaité
 *  MAJ             : 08/09/2008
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_CIPEMG_SPE_TER_CUR  C_GET_THE_CIPEMG_SPE_TER ( database(), this );
      while ( C_GET_THE_CIPEMG_SPE_TER.next( CodeId , TypId , LSTTER  ) )
            { html += tr("<br><b> GET_THE_CIPEMG_SPE_TER : </b>  ") + C_GET_THE_CIPEMG_SPE_TER.MEMBER();
            }
  */
  class C_GET_THE_CIPEMG_SPE_TER_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_CIPEMG_SPE_TER_CUR ---------------------
      C_GET_THE_CIPEMG_SPE_TER_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( double CodeId , QString TypId , QString LSTTER )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............
       if ( TypId.toInt() == 1) {

 //+         ' SELECT t4.FCPMTER_FCPM_CODE_FK_PK       AS IDCIPEMG,         '||
 //+   '       t4.FCPMTER_NATURE_CIPEMG_PK    AS NATURE,          '||
 //+   '       t3.cdf_code_pk                 AS CODETER,          '||
 //+   '       t3.cdf_nom                     AS TERRAIN,          '||
 //+   '       t2.fcpmtx_texte                AS TEXT,           '||
 //+   '       t4.FCPMTER_NUMSEQ_PK           AS NO_SEQ             '||
 //+   ' FROM  FCPMSP_CIPEMG_SPE         t1,             '||
 //+   ' FCPMTX_FICHECIPEMG_TEXTE  t2,               '||
 //+   ' CDF_CODIF                 t3,               '||
 //+   ' FCPMTER_FCPM_TERRAIN      t4               '||
 //+   ' WHERE  t4.FCPMTER_CDF_TER_CODE_FK_PK = t3.CDF_CODE_PK       '||
 //+   ' AND    t3.CDF_NUMERO_PK              = ''CS''          '||
 //+   ' AND    t4.FCPMTER_FCPM_CODE_FK_PK    = t1.FCPMSP_FCPM_CODE_FK_PK   '||
 //+   ' AND    t4.FCPMTER_NATURE_CIPEMG_PK   = ''C''          '||
 //+   ' AND    t4.FCPMTER_FCPM_CODE_FK_PK    = t2.FCPMTX_FCPM_CODE_FK_PK   (+) '||
 //+   ' AND    t4.FCPMTER_CDF_TER_CODE_FK_PK = t2.FCPMTX_CDF_TER_CODE_FK_PK(+) '||
 //+   ' AND    t4.FCPMTER_NATURE_CIPEMG_PK   = t2.FCPMTX_NATURECIPEMG_FK_PK(+) '||
 //+   ' AND    t4.FCPMTER_NUMSEQ_PK          = t2.FCPMTX_NUMSEQ_TER_FK_PK  (+) '||
 //+   ' AND    t1.FCPMSP_SP_CODE_FK_PK       = '||CodeId||
 //+   ' AND    t4.FCPMTER_CDF_TER_CODE_FK_PK IN ('||LSTTER||')'||
 //+   ' ORDER BY 1 ';
                sql_query += " SELECT t4.FCPMTER_FCPM_CODE_FK_PK       AS IDCIPEMG,"
                     " t4.FCPMTER_NATURE_CIPEMG_PK    AS NATURE,"
                     " t3.CDF_CODE_PK                 AS CODETER,"
                     " t3.CDF_NOM                     AS TERRAIN,"
                     " t2.FCPMTX_TEXTE                AS TEXT,"
                     " t4.FCPMTER_NUMSEQ_PK           AS NO_SEQ"
                     " FROM  fcpmsp_cipemg_spe         t1,"
                     " fcpmtx_fichecipemg_texte  t2,"
                     " cdf_codif                 t3,"
                     " fcpmter_fcpm_terrain      t4"
                     " WHERE  t4.FCPMTER_CDF_TER_CODE_FK_PK = t3.CDF_CODE_PK"
                     " AND    t3.CDF_NUMERO_PK              = 'CS'"
                     " AND    t4.FCPMTER_FCPM_CODE_FK_PK    = t1.FCPMSP_FCPM_CODE_FK_PK"
                     " AND    t4.FCPMTER_NATURE_CIPEMG_PK   = 'C'"
                     " AND    t4.FCPMTER_FCPM_CODE_FK_PK    = t2.FCPMTX_FCPM_CODE_FK_PK"
                     " AND    t4.FCPMTER_CDF_TER_CODE_FK_PK = t2.FCPMTX_CDF_TER_CODE_FK_PK"
                     " AND    t4.FCPMTER_NATURE_CIPEMG_PK   = t2.FCPMTX_NATURECIPEMG_FK_PK"
                     " AND    t4.FCPMTER_NUMSEQ_PK          = t2.FCPMTX_NUMSEQ_TER_FK_PK"
                     " AND    t1.FCPMSP_SP_CODE_FK_PK       = '"+ QString::number( CodeId ) +"'"
                     " AND    t4.FCPMTER_CDF_TER_CODE_FK_PK IN ('"+LSTTER+"')"
                     " ORDER BY 1;";

       } else if ( TypId.toInt() == 2) {

 //+         ' SELECT t4.FCPMTER_FCPM_CODE_FK_PK       AS IDCIPEMG,                '||
 //+   '       t4.FCPMTER_NATURE_CIPEMG_PK    AS NATURE,                        '||
 //+   '       t3.cdf_code_pk                 AS CODETER,                       '||
 //+   '       t3.cdf_nom                     AS TERRAIN,                       '||
 //+   '       t2.fcpmtx_texte                AS TEXT,                          '||
 //+   '       t4.FCPMTER_NUMSEQ_PK           AS NO_SEQ                          '||
 //+   ' FROM  FCPMSP_CIPEMG_SPE         t1,                                 '||
 //+   ' FCPMTX_FICHECIPEMG_TEXTE  t2,                                       '||
 //+   ' CDF_CODIF                 t3,                                       '||
 //+   ' FCPMTER_FCPM_TERRAIN      t4                                        '||
 //+   ' WHERE  t4.FCPMTER_CDF_TER_CODE_FK_PK = t3.CDF_CODE_PK               '||
 //+   ' AND    t3.CDF_NUMERO_PK              = ''CS''                       '||
 //+   ' AND    t4.FCPMTER_FCPM_CODE_FK_PK    = t1.FCPMSP_FCPM_CODE_FK_PK    '||
 //+   ' AND    t4.FCPMTER_NATURE_CIPEMG_PK   = ''P''                        '||
 //+   ' AND    t4.FCPMTER_FCPM_CODE_FK_PK    = t2.FCPMTX_FCPM_CODE_FK_PK   (+) '||
 //+   ' AND    t4.FCPMTER_CDF_TER_CODE_FK_PK = t2.FCPMTX_CDF_TER_CODE_FK_PK(+) '||
 //+   ' AND    t4.FCPMTER_NATURE_CIPEMG_PK   = t2.FCPMTX_NATURECIPEMG_FK_PK(+) '||
 //+   ' AND    t4.FCPMTER_NUMSEQ_PK          = t2.FCPMTX_NUMSEQ_TER_FK_PK  (+) '||
 //+   ' AND    t1.FCPMSP_SP_CODE_FK_PK       = '||CodeId||
 //+   ' AND    t4.FCPMTER_CDF_TER_CODE_FK_PK IN ('||LSTTER||')'||
 //+   ' ORDER BY 1 ';
                sql_query += " SELECT t4.FCPMTER_FCPM_CODE_FK_PK       AS IDCIPEMG,"
                     " t4.FCPMTER_NATURE_CIPEMG_PK    AS NATURE,"
                     " t3.CDF_CODE_PK                 AS CODETER,"
                     " t3.CDF_NOM                     AS TERRAIN,"
                     " t2.FCPMTX_TEXTE                AS TEXT,"
                     " t4.FCPMTER_NUMSEQ_PK           AS NO_SEQ"
                     " FROM  fcpmsp_cipemg_spe         t1,"
                     " fcpmtx_fichecipemg_texte  t2,"
                     " cdf_codif                 t3,"
                     " fcpmter_fcpm_terrain      t4"
                     " WHERE  t4.FCPMTER_CDF_TER_CODE_FK_PK = t3.CDF_CODE_PK"
                     " AND    t3.CDF_NUMERO_PK              = 'CS'"
                     " AND    t4.FCPMTER_FCPM_CODE_FK_PK    = t1.FCPMSP_FCPM_CODE_FK_PK"
                     " AND    t4.FCPMTER_NATURE_CIPEMG_PK   = 'P'"
                     " AND    t4.FCPMTER_FCPM_CODE_FK_PK    = t2.FCPMTX_FCPM_CODE_FK_PK"
                     " AND    t4.FCPMTER_CDF_TER_CODE_FK_PK = t2.FCPMTX_CDF_TER_CODE_FK_PK"
                     " AND    t4.FCPMTER_NATURE_CIPEMG_PK   = t2.FCPMTX_NATURECIPEMG_FK_PK"
                     " AND    t4.FCPMTER_NUMSEQ_PK          = t2.FCPMTX_NUMSEQ_TER_FK_PK"
                     " AND    t1.FCPMSP_SP_CODE_FK_PK       = '"+ QString::number( CodeId ) +"'"
                     " AND    t4.FCPMTER_CDF_TER_CODE_FK_PK IN ('"+LSTTER+"')"
                     " ORDER BY 1;";

       } else if ( TypId.toInt() == 3) {

 //+         ' SELECT t4.FCPMTER_FCPM_CODE_FK_PK       AS IDCIPEMG,                '||
 //+   '       t4.FCPMTER_NATURE_CIPEMG_PK    AS NATURE,                        '||
 //+   '       t3.cdf_code_pk                 AS CODETER,                       '||
 //+   '       t3.cdf_nom                     AS TERRAIN,                       '||
 //+   '       t2.fcpmtx_texte                AS TEXT,                          '||
 //+   '       t4.FCPMTER_NUMSEQ_PK           AS NO_SEQ                          '||
 //+   ' FROM  FCPMSP_CIPEMG_SPE         t1,                                 '||
 //+   ' FCPMTX_FICHECIPEMG_TEXTE  t2,                                       '||
 //+   ' CDF_CODIF                 t3,                                       '||
 //+   ' FCPMTER_FCPM_TERRAIN      t4                                        '||
 //+   ' WHERE  t4.FCPMTER_CDF_TER_CODE_FK_PK = t3.CDF_CODE_PK               '||
 //+   ' AND    t3.CDF_NUMERO_PK              = ''CS''                       '||
 //+   ' AND    t4.FCPMTER_FCPM_CODE_FK_PK    = t1.FCPMSP_FCPM_CODE_FK_PK    '||
 //+   ' AND    t4.FCPMTER_NATURE_CIPEMG_PK   = ''N''                        '||
 //+   ' AND    t4.FCPMTER_FCPM_CODE_FK_PK    = t2.FCPMTX_FCPM_CODE_FK_PK   (+) '||
 //+   ' AND    t4.FCPMTER_CDF_TER_CODE_FK_PK = t2.FCPMTX_CDF_TER_CODE_FK_PK(+) '||
 //+   ' AND    t4.FCPMTER_NATURE_CIPEMG_PK   = t2.FCPMTX_NATURECIPEMG_FK_PK(+) '||
 //+   ' AND    t4.FCPMTER_NUMSEQ_PK          = t2.FCPMTX_NUMSEQ_TER_FK_PK  (+) '||
 //+   ' AND    t1.FCPMSP_SP_CODE_FK_PK       = '||CodeId||
 //+   ' AND    t4.FCPMTER_CDF_TER_CODE_FK_PK IN ('||LSTTER||')'||
 //+   ' ORDER BY 1 ';
                sql_query += " SELECT t4.FCPMTER_FCPM_CODE_FK_PK       AS IDCIPEMG,"
                     " t4.FCPMTER_NATURE_CIPEMG_PK    AS NATURE,"
                     " t3.CDF_CODE_PK                 AS CODETER,"
                     " t3.CDF_NOM                     AS TERRAIN,"
                     " t2.FCPMTX_TEXTE                AS TEXT,"
                     " t4.FCPMTER_NUMSEQ_PK           AS NO_SEQ"
                     " FROM  fcpmsp_cipemg_spe         t1,"
                     " fcpmtx_fichecipemg_texte  t2,"
                     " cdf_codif                 t3,"
                     " fcpmter_fcpm_terrain      t4"
                     " WHERE  t4.FCPMTER_CDF_TER_CODE_FK_PK = t3.CDF_CODE_PK"
                     " AND    t3.CDF_NUMERO_PK              = 'CS'"
                     " AND    t4.FCPMTER_FCPM_CODE_FK_PK    = t1.FCPMSP_FCPM_CODE_FK_PK"
                     " AND    t4.FCPMTER_NATURE_CIPEMG_PK   = 'N'"
                     " AND    t4.FCPMTER_FCPM_CODE_FK_PK    = t2.FCPMTX_FCPM_CODE_FK_PK"
                     " AND    t4.FCPMTER_CDF_TER_CODE_FK_PK = t2.FCPMTX_CDF_TER_CODE_FK_PK"
                     " AND    t4.FCPMTER_NATURE_CIPEMG_PK   = t2.FCPMTX_NATURECIPEMG_FK_PK"
                     " AND    t4.FCPMTER_NUMSEQ_PK          = t2.FCPMTX_NUMSEQ_TER_FK_PK"
                     " AND    t1.FCPMSP_SP_CODE_FK_PK       = '"+ QString::number( CodeId ) +"'"
                     " AND    t4.FCPMTER_CDF_TER_CODE_FK_PK IN ('"+LSTTER+"')"
                     " ORDER BY 1;";

       } else if ( TypId.toInt() == 4) {

 //+         ' SELECT t4.FCPMTER_FCPM_CODE_FK_PK       AS IDCIPEMG,                '||
 //+   '       t4.FCPMTER_NATURE_CIPEMG_PK    AS NATURE,                        '||
 //+   '       t3.cdf_code_pk                 AS CODETER,                       '||
 //+   '       t3.cdf_nom                     AS TERRAIN,                       '||
 //+   '       t2.fcpmtx_texte                AS TEXT,                          '||
 //+   '       t4.FCPMTER_NUMSEQ_PK           AS NO_SEQ                          '||
 //+   ' FROM  FCPMSP_CIPEMG_SPE         t1,                                 '||
 //+   ' FCPMTX_FICHECIPEMG_TEXTE  t2,                                       '||
 //+   ' CDF_CODIF                 t3,                                       '||
 //+   ' FCPMTER_FCPM_TERRAIN      t4                                        '||
 //+   ' WHERE  t4.FCPMTER_CDF_TER_CODE_FK_PK = t3.CDF_CODE_PK               '||
 //+   ' AND    t3.CDF_NUMERO_PK              = ''CS''                       '||
 //+   ' AND    t4.FCPMTER_FCPM_CODE_FK_PK    = t1.FCPMSP_FCPM_CODE_FK_PK    '||
 //+   ' AND    t4.FCPMTER_NATURE_CIPEMG_PK   = ''I''                        '||
 //+   ' AND    t4.FCPMTER_FCPM_CODE_FK_PK    = t2.FCPMTX_FCPM_CODE_FK_PK   (+) '||
 //+   ' AND    t4.FCPMTER_CDF_TER_CODE_FK_PK = t2.FCPMTX_CDF_TER_CODE_FK_PK(+) '||
 //+   ' AND    t4.FCPMTER_NATURE_CIPEMG_PK   = t2.FCPMTX_NATURECIPEMG_FK_PK(+) '||
 //+   ' AND    t4.FCPMTER_NUMSEQ_PK          = t2.FCPMTX_NUMSEQ_TER_FK_PK  (+) '||
 //+   ' AND    t1.FCPMSP_SP_CODE_FK_PK        = '||CodeId||
 //+   ' AND    t4.FCPMTER_CDF_TER_CODE_FK_PK IN ('||LSTTER||')'||
 //+   ' ORDER BY 1 ';
                sql_query += " SELECT t4.FCPMTER_FCPM_CODE_FK_PK       AS IDCIPEMG,"
                     " t4.FCPMTER_NATURE_CIPEMG_PK    AS NATURE,"
                     " t3.CDF_CODE_PK                 AS CODETER,"
                     " t3.CDF_NOM                     AS TERRAIN,"
                     " t2.FCPMTX_TEXTE                AS TEXT,"
                     " t4.FCPMTER_NUMSEQ_PK           AS NO_SEQ"
                     " FROM  fcpmsp_cipemg_spe         t1,"
                     " fcpmtx_fichecipemg_texte  t2,"
                     " cdf_codif                 t3,"
                     " fcpmter_fcpm_terrain      t4"
                     " WHERE  t4.FCPMTER_CDF_TER_CODE_FK_PK = t3.CDF_CODE_PK"
                     " AND    t3.CDF_NUMERO_PK              = 'CS'"
                     " AND    t4.FCPMTER_FCPM_CODE_FK_PK    = t1.FCPMSP_FCPM_CODE_FK_PK"
                     " AND    t4.FCPMTER_NATURE_CIPEMG_PK   = 'I'"
                     " AND    t4.FCPMTER_FCPM_CODE_FK_PK    = t2.FCPMTX_FCPM_CODE_FK_PK"
                     " AND    t4.FCPMTER_CDF_TER_CODE_FK_PK = t2.FCPMTX_CDF_TER_CODE_FK_PK"
                     " AND    t4.FCPMTER_NATURE_CIPEMG_PK   = t2.FCPMTX_NATURECIPEMG_FK_PK"
                     " AND    t4.FCPMTER_NUMSEQ_PK          = t2.FCPMTX_NUMSEQ_TER_FK_PK"
                     " AND    t1.FCPMSP_SP_CODE_FK_PK        = '"+ QString::number( CodeId ) +"'"
                     " AND    t4.FCPMTER_CDF_TER_CODE_FK_PK IN ('"+LSTTER+"')"
                     " ORDER BY 1;";

       } else if ( TypId.toInt() == 5) {

 //+                  ' SELECT t4.FCPMTER_FCPM_CODE_FK_PK    AS IDCIPEMG,                '||
 //+   '       t4.FCPMTER_NATURE_CIPEMG_PK    AS NATURE,                        '||
 //+   '       t3.cdf_code_pk                 AS CODETER,                       '||
 //+   '       t3.cdf_nom                     AS TERRAIN,                       '||
 //+   '       t2.fcpmtx_texte                AS TEXT,                          '||
 //+   '       t4.FCPMTER_NUMSEQ_PK           AS NO_SEQ                          '||
 //+   ' FROM  FCPMSP_CIPEMG_SPE         t1,                                 '||
 //+   ' FCPMTX_FICHECIPEMG_TEXTE  t2,                                       '||
 //+   ' CDF_CODIF                 t3,                                       '||
 //+   ' FCPMTER_FCPM_TERRAIN      t4                                        '||
 //+   ' WHERE  t4.FCPMTER_CDF_TER_CODE_FK_PK = t3.CDF_CODE_PK               '||
 //+   ' AND    t3.CDF_NUMERO_PK              = ''CS''                       '||
 //+   ' AND    t4.FCPMTER_FCPM_CODE_FK_PK    = t1.FCPMSP_FCPM_CODE_FK_PK    '||
 //+   ' AND    t4.FCPMTER_NATURE_CIPEMG_PK   IN (''C'', ''P'',''I'',''N'')  '||
 //+   ' AND    t4.FCPMTER_FCPM_CODE_FK_PK    = t2.FCPMTX_FCPM_CODE_FK_PK   (+) '||
 //+   ' AND    t4.FCPMTER_CDF_TER_CODE_FK_PK = t2.FCPMTX_CDF_TER_CODE_FK_PK(+) '||
 //+   ' AND    t4.FCPMTER_NATURE_CIPEMG_PK   = t2.FCPMTX_NATURECIPEMG_FK_PK(+) '||
 //+   ' AND    t4.FCPMTER_NUMSEQ_PK          = t2.FCPMTX_NUMSEQ_TER_FK_PK  (+) '||
 //+   ' AND    t1.FCPMSP_SP_CODE_FK_PK        = '||CodeId||
 //+   ' AND    t4.FCPMTER_CDF_TER_CODE_FK_PK IN ('||LSTTER||')'||
 //+   ' ORDER BY 1 ';
                sql_query += " SELECT t4.FCPMTER_FCPM_CODE_FK_PK    AS IDCIPEMG,"
                     " t4.FCPMTER_NATURE_CIPEMG_PK    AS NATURE,"
                     " t3.CDF_CODE_PK                 AS CODETER,"
                     " t3.CDF_NOM                     AS TERRAIN,"
                     " t2.FCPMTX_TEXTE                AS TEXT,"
                     " t4.FCPMTER_NUMSEQ_PK           AS NO_SEQ"
                     " FROM  fcpmsp_cipemg_spe         t1,"
                     " fcpmtx_fichecipemg_texte  t2,"
                     " cdf_codif                 t3,"
                     " fcpmter_fcpm_terrain      t4"
                     " WHERE  t4.FCPMTER_CDF_TER_CODE_FK_PK = t3.CDF_CODE_PK"
                     " AND    t3.CDF_NUMERO_PK              = 'CS'"
                     " AND    t4.FCPMTER_FCPM_CODE_FK_PK    = t1.FCPMSP_FCPM_CODE_FK_PK"
                     " AND    t4.FCPMTER_NATURE_CIPEMG_PK   IN ('C', 'P','I','N')"
                     " AND    t4.FCPMTER_FCPM_CODE_FK_PK    = t2.FCPMTX_FCPM_CODE_FK_PK"
                     " AND    t4.FCPMTER_CDF_TER_CODE_FK_PK = t2.FCPMTX_CDF_TER_CODE_FK_PK"
                     " AND    t4.FCPMTER_NATURE_CIPEMG_PK   = t2.FCPMTX_NATURECIPEMG_FK_PK"
                     " AND    t4.FCPMTER_NUMSEQ_PK          = t2.FCPMTX_NUMSEQ_TER_FK_PK"
                     " AND    t1.FCPMSP_SP_CODE_FK_PK        = '"+ QString::number( CodeId ) +"'"
                     " AND    t4.FCPMTER_CDF_TER_CODE_FK_PK IN ('"+LSTTER+"')"
                     " ORDER BY 1;";

       } else {
 //+       C_GET_THE_CIPEMG_SPE_TER := NULL;
         return 0;
       }
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_CIPEMG_SPE_TER() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_IDCIPEMG = value(0).toDouble();
                m_NATURE   = value(1).toString();
                m_CODETER  = value(2).toString();
                m_TERRAIN  = value(3).toString();
                m_TEXT     = value(4).toString();
                m_NO_SEQ   = value(5).toDouble();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      double  IDCIPEMG() {return m_IDCIPEMG;}
      QString NATURE()   {return m_NATURE;}
      QString CODETER()  {return m_CODETER;}
      QString TERRAIN()  {return m_TERRAIN;}
      QString TEXT()     {return m_TEXT;}
      double  NO_SEQ()   {return m_NO_SEQ;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      double  m_IDCIPEMG;
      QString m_NATURE;
      QString m_CODETER;
      QString m_TERRAIN;
      QString m_TEXT;
      double  m_NO_SEQ;
 };

 //================================== C_GET_THE_ATC_TXT_CUR   -36- ==================================
 /****************************************************************************
 *   Nom           :  GET_THE_ATC_TXT
 -----------------------------------------------------------------------------
 *   Date creation : 18/07/2008
 -----------------------------------------------------------------------------
 *   Description   :  cette procédure renvoie la classification ATC repondant au terme passé
 *                    en parametre,le deusieme parametre permet de preciser si le terme a chercher
 *                    est en Anglais ou en Francais
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_ATC_TXT_CUR  C_GET_THE_ATC_TXT ( database(), this );
      while ( C_GET_THE_ATC_TXT.next( LibTxt , CODELG  ) )
            { html += tr("<br><b> GET_THE_ATC_TXT : </b>  ") + C_GET_THE_ATC_TXT.MEMBER();
            }
  */
  class C_GET_THE_ATC_TXT_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_ATC_TXT_CUR ---------------------
      C_GET_THE_ATC_TXT_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( QString LibTxt , double CODELG )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............
       if ( CODELG == 1) {

 //+         SELECT CATC_CODE_PK       ,
 //+                CATC_CATC_CODE_FK  ,
 //+                CATC_NOMF          ,
 //+                CATC_NOMA          ,
 //+                CATC_DATECR        ,
 //+                CATC_DATEMJ        ,
 //+                CATC_TEXTE
 //+        FROM    CATC_CLASSEATC
 //+        WHERE   UPPER(CATC_NOMF) LIKE UPPER(LibTxt)
 //+        ORDER BY  CATC_CODE_PK  ;
                sql_query += " SELECT CATC_CODE_PK       ,"
                     " CATC_CATC_CODE_FK  ,"
                     " CATC_NOMF          ,"
                     " CATC_NOMA          ,"
                     " CATC_DATECR        ,"
                     " CATC_DATEMJ        ,"
                     " CATC_TEXTE"
                     " FROM    catc_classeatc"
                     " WHERE   UPPER(CATC_NOMF) LIKE UPPER('"+LibTxt+"')"
                     " ORDER BY  CATC_CODE_PK  ;";

       } else if ( CODELG == 2) {

 //+         SELECT CATC_CODE_PK       ,
 //+                 CATC_CATC_CODE_FK  ,
 //+                 CATC_NOMF          ,
 //+                 CATC_NOMA          ,
 //+                 CATC_DATECR        ,
 //+                 CATC_DATEMJ        ,
 //+                 CATC_TEXTE
 //+          FROM   CATC_CLASSEATC
 //+          WHERE  UPPER(CATC_NOMA) LIKE UPPER(LibTxt)
 //+          ORDER BY  CATC_CODE_PK  ;
                sql_query += " SELECT CATC_CODE_PK       ,"
                     " CATC_CATC_CODE_FK  ,"
                     " CATC_NOMF          ,"
                     " CATC_NOMA          ,"
                     " CATC_DATECR        ,"
                     " CATC_DATEMJ        ,"
                     " CATC_TEXTE"
                     " FROM   catc_classeatc"
                     " WHERE  UPPER(CATC_NOMA) LIKE UPPER('"+LibTxt+"')"
                     " ORDER BY  CATC_CODE_PK  ;";

       } else {
 //+       C_GET_THE_ATC_TXT := NULL;
         return 0;
       }
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_ATC_TXT() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_CATC_CODE_PK      = value(0).toString();
                m_CATC_CATC_CODE_FK = value(1).toString();
                m_CATC_NOMF         = value(2).toString();
                m_CATC_NOMA         = value(3).toString();
                m_CATC_DATECR       = value(4).toDate();
                m_CATC_DATEMJ       = value(5).toDate();
                m_CATC_TEXTE        = value(6).toString();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      QString CATC_CODE_PK()      {return m_CATC_CODE_PK;}
      QString CATC_CATC_CODE_FK() {return m_CATC_CATC_CODE_FK;}
      QString CATC_NOMF()         {return m_CATC_NOMF;}
      QString CATC_NOMA()         {return m_CATC_NOMA;}
      QDate   CATC_DATECR()       {return m_CATC_DATECR;}
      QDate   CATC_DATEMJ()       {return m_CATC_DATEMJ;}
      QString CATC_TEXTE()        {return m_CATC_TEXTE;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      QString m_CATC_CODE_PK;
      QString m_CATC_CATC_CODE_FK;
      QString m_CATC_NOMF;
      QString m_CATC_NOMA;
      QDate   m_CATC_DATECR;
      QDate   m_CATC_DATEMJ;
      QString m_CATC_TEXTE;
 };

 //================================== C_GET_THE_ATC_ID_CUR   -37- ==================================
 /****************************************************************************
 *   Nom           :  GET_THE_ATC_ID
 -----------------------------------------------------------------------------
 *   Date creation : 18/07/2008
 -----------------------------------------------------------------------------
 *   Description   :  cette procédure renvoie la classification ATC repondant au terme passé
 *                    en parametre qui est l'identifiant de la classe
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_ATC_ID_CUR  C_GET_THE_ATC_ID ( database(), this );
      while ( C_GET_THE_ATC_ID.next( CodeId  ) )
            { html += tr("<br><b> GET_THE_ATC_ID : </b>  ") + C_GET_THE_ATC_ID.MEMBER();
            }
  */
  class C_GET_THE_ATC_ID_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_ATC_ID_CUR ---------------------
      C_GET_THE_ATC_ID_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( QString CodeId )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............

 //+         SELECT CATC_CODE_PK       ,
 //+                CATC_CATC_CODE_FK  ,
 //+                CATC_NOMF          ,
 //+                CATC_NOMA          ,
 //+                CATC_DATECR        ,
 //+                CATC_DATEMJ        ,
 //+                CATC_TEXTE
 //+        FROM    CATC_CLASSEATC
 //+        WHERE   CATC_CODE_PK  = Codeid
 //+        ORDER BY  CATC_CODE_PK  ;
                sql_query += " SELECT CATC_CODE_PK       ,"
                     " CATC_CATC_CODE_FK  ,"
                     " CATC_NOMF          ,"
                     " CATC_NOMA          ,"
                     " CATC_DATECR        ,"
                     " CATC_DATEMJ        ,"
                     " CATC_TEXTE"
                     " FROM    catc_classeatc"
                     " WHERE   CATC_CODE_PK   = '"+CodeId+"'"
                     " ORDER BY  CATC_CODE_PK  ;";
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_ATC_ID() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_CATC_CODE_PK      = value(0).toString();
                m_CATC_CATC_CODE_FK = value(1).toString();
                m_CATC_NOMF         = value(2).toString();
                m_CATC_NOMA         = value(3).toString();
                m_CATC_DATECR       = value(4).toDate();
                m_CATC_DATEMJ       = value(5).toDate();
                m_CATC_TEXTE        = value(6).toString();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      QString CATC_CODE_PK()      {return m_CATC_CODE_PK;}
      QString CATC_CATC_CODE_FK() {return m_CATC_CATC_CODE_FK;}
      QString CATC_NOMF()         {return m_CATC_NOMF;}
      QString CATC_NOMA()         {return m_CATC_NOMA;}
      QDate   CATC_DATECR()       {return m_CATC_DATECR;}
      QDate   CATC_DATEMJ()       {return m_CATC_DATEMJ;}
      QString CATC_TEXTE()        {return m_CATC_TEXTE;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      QString m_CATC_CODE_PK;
      QString m_CATC_CATC_CODE_FK;
      QString m_CATC_NOMF;
      QString m_CATC_NOMA;
      QDate   m_CATC_DATECR;
      QDate   m_CATC_DATEMJ;
      QString m_CATC_TEXTE;
 };

 //================================== C_GET_THE_ATC_ATC_CUR   -38- ==================================
 /****************************************************************************
 *   Nom           :  GET_THE_ATC_ATC
 -----------------------------------------------------------------------------
 *   Date creation : 18/07/2008
 -----------------------------------------------------------------------------
 *   Description   :  cette procédure renvoie la classification ATC repondant au terme passé
 *                    en parametre qui est le code ATC pere
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_ATC_ATC_CUR  C_GET_THE_ATC_ATC ( database(), this );
      while ( C_GET_THE_ATC_ATC.next( CodeId  ) )
            { html += tr("<br><b> GET_THE_ATC_ATC : </b>  ") + C_GET_THE_ATC_ATC.MEMBER();
            }
  */
  class C_GET_THE_ATC_ATC_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_ATC_ATC_CUR ---------------------
      C_GET_THE_ATC_ATC_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( QString CodeId )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............

 //+         SELECT CATC_CODE_PK       ,
 //+                CATC_CATC_CODE_FK  ,
 //+                CATC_NOMF          ,
 //+                CATC_NOMA          ,
 //+                CATC_DATECR        ,
 //+                CATC_DATEMJ        ,
 //+                CATC_TEXTE
 //+        FROM    CATC_CLASSEATC
 //+        WHERE   CATC_CATC_CODE_FK  = Codeid
 //+        ORDER BY  CATC_CODE_PK  ;
                sql_query += " SELECT CATC_CODE_PK       ,"
                     " CATC_CATC_CODE_FK  ,"
                     " CATC_NOMF          ,"
                     " CATC_NOMA          ,"
                     " CATC_DATECR        ,"
                     " CATC_DATEMJ        ,"
                     " CATC_TEXTE"
                     " FROM    catc_classeatc"
                     " WHERE   CATC_CATC_CODE_FK   = '"+CodeId+"'"
                     " ORDER BY  CATC_CODE_PK  ;";
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_ATC_ATC() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_CATC_CODE_PK      = value(0).toString();
                m_CATC_CATC_CODE_FK = value(1).toString();
                m_CATC_NOMF         = value(2).toString();
                m_CATC_NOMA         = value(3).toString();
                m_CATC_DATECR       = value(4).toDate();
                m_CATC_DATEMJ       = value(5).toDate();
                m_CATC_TEXTE        = value(6).toString();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      QString CATC_CODE_PK()      {return m_CATC_CODE_PK;}
      QString CATC_CATC_CODE_FK() {return m_CATC_CATC_CODE_FK;}
      QString CATC_NOMF()         {return m_CATC_NOMF;}
      QString CATC_NOMA()         {return m_CATC_NOMA;}
      QDate   CATC_DATECR()       {return m_CATC_DATECR;}
      QDate   CATC_DATEMJ()       {return m_CATC_DATEMJ;}
      QString CATC_TEXTE()        {return m_CATC_TEXTE;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      QString m_CATC_CODE_PK;
      QString m_CATC_CATC_CODE_FK;
      QString m_CATC_NOMF;
      QString m_CATC_NOMA;
      QDate   m_CATC_DATECR;
      QDate   m_CATC_DATEMJ;
      QString m_CATC_TEXTE;
 };

 //================================== C_GET_THE_ATC_SPE_CUR   -39- ==================================
 /****************************************************************************
 *   Nom           :  GET_THE_ATC_SPE
 -----------------------------------------------------------------------------
 *   Date creation : 18/07/2008
 -----------------------------------------------------------------------------
 *   Description   :  cette procédure renvoie la classification ATC repondant au terme passé
 *                    en parametre qui est le code ATC pere
 *   MAJ           :  24/11/2008
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_ATC_SPE_CUR  C_GET_THE_ATC_SPE ( database(), this );
      while ( C_GET_THE_ATC_SPE.next( CodeId  ) )
            { html += tr("<br><b> GET_THE_ATC_SPE : </b>  ") + C_GET_THE_ATC_SPE.MEMBER();
            }
  */
  class C_GET_THE_ATC_SPE_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_ATC_SPE_CUR ---------------------
      C_GET_THE_ATC_SPE_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( double CodeId )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............

 //+       SELECT catc_code_pk       AS CATCFILS,
 //+              catc_catc_code_fk  AS CATCPERE,
 //+              catc_nomf          AS CATCLIBF,
 //+              catc_noma          AS CATCLIBA,
 //+              sp_atc_ddd_texte   AS CATCTEXT
 //+       FROM   SP_SPECIALITE,
 //+              CATC_CLASSEATC
 //+       WHERE  SP_CATC_CODE_FK = CATC_CODE_PK
 //+       AND    SP_CODE_SQ_PK   =  CodeId ;
                sql_query += " SELECT CATC_CODE_PK       AS CATCFILS,"
                     " CATC_CATC_CODE_FK  AS CATCPERE,"
                     " CATC_NOMF          AS CATCLIBF,"
                     " CATC_NOMA          AS CATCLIBA,"
                     " SP_ATC_DDD_TEXTE   AS CATCTEXT"
                     " FROM   sp_specialite,"
                     " catc_classeatc"
                     " WHERE  SP_CATC_CODE_FK = CATC_CODE_PK"
                     " AND    SP_CODE_SQ_PK    = '"+ QString::number( CodeId ) +"' ;";
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_ATC_SPE() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_CATCFILS = value(0).toString();
                m_CATCPERE = value(1).toString();
                m_CATCLIBF = value(2).toString();
                m_CATCLIBA = value(3).toString();
                m_CATCTEXT = value(4).toString();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      QString CATCFILS() {return m_CATCFILS;}
      QString CATCPERE() {return m_CATCPERE;}
      QString CATCLIBF() {return m_CATCLIBF;}
      QString CATCLIBA() {return m_CATCLIBA;}
      QString CATCTEXT() {return m_CATCTEXT;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      QString m_CATCFILS;
      QString m_CATCPERE;
      QString m_CATCLIBF;
      QString m_CATCLIBA;
      QString m_CATCTEXT;
 };

 //================================== C_GET_THE_ATC_DDD_CUR   -40- ==================================
 /****************************************************************************
 *   Nom           :  GET_THE_ATC_DDD
 -----------------------------------------------------------------------------
 *   Date creation : 18/07/2008
 -----------------------------------------------------------------------------
 *   Description   :  Cette procédure renvoie les informations DDD
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_ATC_DDD_CUR  C_GET_THE_ATC_DDD ( database(), this );
      while ( C_GET_THE_ATC_DDD.next( CodeId , TYPID  ) )
            { html += tr("<br><b> GET_THE_ATC_DDD : </b>  ") + C_GET_THE_ATC_DDD.MEMBER();
            }
  */
  class C_GET_THE_ATC_DDD_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_ATC_DDD_CUR ---------------------
      C_GET_THE_ATC_DDD_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( QString CodeId , double TYPID )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............
       if ( TYPID == 1) {

 //+          SELECT  atcddd_catc_code_fk_pk      AS CATC,
 //+                  atcddd_dosage_pk            AS DOSAGE,
 //+                  atcddd_cdf_vo_code_fk_pk    AS CODEVOIE,
 //+                  V.cdf_nom                   AS NOMVOIE,
 //+                  atcddd_cdf_ud_code_fk_pk    AS CODEUNITE,
 //+                  U.cdf_nom                   AS NOMUNITE
 //+         FROM     ATCDDD_DOSE_USUELLE_JOUR,
 //+                  CDF_CODIF V,
 //+                  CDF_CODIF U
 //+         WHERE    ATCDDD_CATC_CODE_FK_PK   = CodeId
 //+         AND      ATCDDD_CDF_VO_CODE_FK_PK = V.CDF_CODE_PK
 //+         AND      V.CDF_NUMERO_PK          = '18'
 //+         AND      ATCDDD_CDF_UD_CODE_FK_PK = U.CDF_CODE_PK
 //+         AND      U.CDF_NUMERO_PK          = '19';
                sql_query += " SELECT  ATCDDD_CATC_CODE_FK_PK      AS CATC,"
                     " ATCDDD_DOSAGE_PK            AS DOSAGE,"
                     " ATCDDD_CDF_VO_CODE_FK_PK    AS CODEVOIE,"
                     " V.CDF_NOM                   AS NOMVOIE,"
                     " ATCDDD_CDF_UD_CODE_FK_PK    AS CODEUNITE,"
                     " U.CDF_NOM                   AS NOMUNITE"
                     " FROM     atcddd_dose_usuelle_jour,"
                     " cdf_codif V,"
                     " cdf_codif U"
                     " WHERE    ATCDDD_CATC_CODE_FK_PK    = '"+CodeId+"'"
                     " AND      ATCDDD_CDF_VO_CODE_FK_PK = V.CDF_CODE_PK"
                     " AND      V.CDF_NUMERO_PK          = '18'"
                     " AND      ATCDDD_CDF_UD_CODE_FK_PK = U.CDF_CODE_PK"
                     " AND      U.CDF_NUMERO_PK          = '19';";

       } else if ( TYPID == 2) {

 //+          SELECT spddd_atcddd_catc_code_fk_pk     AS CATC,
 //+                 spddd_atcddd_dosage_pk           AS DOSAGE,
 //+                 spddd_atcddd_cdf_vo_code_fk_pk   AS CODEVOIE,
 //+                 V.cdf_nom                        AS NOMVOIE,
 //+                 spddd_atcddd_cdf_ud_code_fk_pk   AS CODEUNITE,
 //+                 U.cdf_nom                        AS NOMUNITE
 //+          FROM   SPDDD_DOSE_USUELLE_JOUR               ,
 //+                 CDF_CODIF V                           ,
 //+                 CDF_CODIF U
 //+          WHERE  SPDDD_SP_CODE_FK_PK            = CodeId
 //+          AND    SPDDD_ATCDDD_CDF_VO_CODE_FK_PK = V.CDF_CODE_PK
 //+          AND    V.CDF_NUMERO_PK                = '18'
 //+          AND    SPDDD_ATCDDD_CDF_UD_CODE_FK_PK = U.CDF_CODE_PK
 //+          AND    U.CDF_NUMERO_PK                = '19';
                sql_query += " SELECT SPDDD_ATCDDD_CATC_CODE_FK_PK     AS CATC,"
                     " SPDDD_ATCDDD_DOSAGE_PK           AS DOSAGE,"
                     " SPDDD_ATCDDD_CDF_VO_CODE_FK_PK   AS CODEVOIE,"
                     " V.CDF_NOM                        AS NOMVOIE,"
                     " SPDDD_ATCDDD_CDF_UD_CODE_FK_PK   AS CODEUNITE,"
                     " U.CDF_NOM                        AS NOMUNITE"
                     " FROM   spddd_dose_usuelle_jour               ,"
                     " cdf_codif V                           ,"
                     " cdf_codif U"
                     " WHERE  SPDDD_SP_CODE_FK_PK             = '"+CodeId+"'"
                     " AND    SPDDD_ATCDDD_CDF_VO_CODE_FK_PK = V.CDF_CODE_PK"
                     " AND    V.CDF_NUMERO_PK                = '18'"
                     " AND    SPDDD_ATCDDD_CDF_UD_CODE_FK_PK = U.CDF_CODE_PK"
                     " AND    U.CDF_NUMERO_PK                = '19';";

       } else {
 //+       C_GET_THE_ATC_DDD := NULL;
         return 0;
       }
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_ATC_DDD() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_CATC      = value(0).toString();
                m_DOSAGE    = value(1).toString();
                m_CODEVOIE  = value(2).toDouble();
                m_NOMVOIE   = value(3).toString();
                m_CODEUNITE = value(4).toDouble();
                m_NOMUNITE  = value(5).toString();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      QString CATC()      {return m_CATC;}
      QString DOSAGE()    {return m_DOSAGE;}
      double  CODEVOIE()  {return m_CODEVOIE;}
      QString NOMVOIE()   {return m_NOMVOIE;}
      double  CODEUNITE() {return m_CODEUNITE;}
      QString NOMUNITE()  {return m_NOMUNITE;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      QString m_CATC;
      QString m_DOSAGE;
      double  m_CODEVOIE;
      QString m_NOMVOIE;
      double  m_CODEUNITE;
      QString m_NOMUNITE;
 };

 //================================== C_GET_THE_EPHMRA_TXT_CUR   -41- ==================================
 /****************************************************************************
 *   Nom           :  GET_THE_EPHMRA_TXT
 -----------------------------------------------------------------------------
 *   Date creation : 21/07/2008
 -----------------------------------------------------------------------------
 *   Description   :  cette procédure renvoie la classification EPHMRA repondant au terme passé
 *                    en parametre,le deusieme parametre permet de preciser si le terme a chercher
 *                    est en Anglais ou en Francais
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_EPHMRA_TXT_CUR  C_GET_THE_EPHMRA_TXT ( database(), this );
      while ( C_GET_THE_EPHMRA_TXT.next( LibTxt , CODELG  ) )
            { html += tr("<br><b> GET_THE_EPHMRA_TXT : </b>  ") + C_GET_THE_EPHMRA_TXT.MEMBER();
            }
  */
  class C_GET_THE_EPHMRA_TXT_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_EPHMRA_TXT_CUR ---------------------
      C_GET_THE_EPHMRA_TXT_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( QString LibTxt , double CODELG )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............
       if ( CODELG == 1) {

 //+          SELECT CEPH_CODE_PK        ,
 //+                 CEPH_CEPH_CODE_FK   ,
 //+                 CEPH_NOMF           ,
 //+                 CEPH_NOMA           ,
 //+                 CEPH_DATECR         ,
 //+                 CEPH_DATEMJ
 //+          FROM   CEPH_CLASSEEPHMRA
 //+          WHERE  UPPER(CEPH_NOMF) LIKE UPPER(LibTxt)
 //+          ORDER BY CEPH_CODE_PK ;
                sql_query += " SELECT CEPH_CODE_PK        ,"
                     " CEPH_CEPH_CODE_FK   ,"
                     " CEPH_NOMF           ,"
                     " CEPH_NOMA           ,"
                     " CEPH_DATECR         ,"
                     " CEPH_DATEMJ"
                     " FROM   ceph_classeephmra"
                     " WHERE  UPPER(CEPH_NOMF) LIKE UPPER('"+LibTxt+"')"
                     " ORDER BY CEPH_CODE_PK ;";

       } else if ( CODELG == 2) {

 //+          SELECT CEPH_CODE_PK        ,
 //+                 CEPH_CEPH_CODE_FK   ,
 //+                 CEPH_NOMF           ,
 //+                 CEPH_NOMA           ,
 //+                 CEPH_DATECR         ,
 //+                 CEPH_DATEMJ
 //+          FROM   CEPH_CLASSEEPHMRA
 //+          WHERE  UPPER(CEPH_NOMA) LIKE UPPER(LibTxt)
 //+          ORDER BY CEPH_CODE_PK ;
                sql_query += " SELECT CEPH_CODE_PK        ,"
                     " CEPH_CEPH_CODE_FK   ,"
                     " CEPH_NOMF           ,"
                     " CEPH_NOMA           ,"
                     " CEPH_DATECR         ,"
                     " CEPH_DATEMJ"
                     " FROM   ceph_classeephmra"
                     " WHERE  UPPER(CEPH_NOMA) LIKE UPPER('"+LibTxt+"')"
                     " ORDER BY CEPH_CODE_PK ;";

       } else {
 //+       C_GET_THE_EPHMRA_TXT := NULL;
         return 0;
       }
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_EPHMRA_TXT() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_MY_CEPH_CODE_PK   = value(0).toString();
                m_CEPH_CEPH_CODE_FK = value(1).toString();
                m_CEPH_NOMF         = value(2).toString();
                m_CEPH_NOMA         = value(3).toString();
                m_CEPH_DATECR       = value(4).toDate();
                m_CEPH_DATEMJ       = value(5).toDate();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      QString MY_CEPH_CODE_PK()   {return m_MY_CEPH_CODE_PK;}
      QString CEPH_CEPH_CODE_FK() {return m_CEPH_CEPH_CODE_FK;}
      QString CEPH_NOMF()         {return m_CEPH_NOMF;}
      QString CEPH_NOMA()         {return m_CEPH_NOMA;}
      QDate   CEPH_DATECR()       {return m_CEPH_DATECR;}
      QDate   CEPH_DATEMJ()       {return m_CEPH_DATEMJ;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      QString m_MY_CEPH_CODE_PK;
      QString m_CEPH_CEPH_CODE_FK;
      QString m_CEPH_NOMF;
      QString m_CEPH_NOMA;
      QDate   m_CEPH_DATECR;
      QDate   m_CEPH_DATEMJ;
 };

 //================================== C_GET_THE_EPHMRA_ID_CUR   -42- ==================================
 /****************************************************************************
 *   Nom           :  GET_THE_EPHMRA_ID
 -----------------------------------------------------------------------------
 *   Date creation : 21/07/2008
 -----------------------------------------------------------------------------
 *   Description   :  cette procédure renvoie la classification EPHMRA repondant au terme passé
 *                    en parametre qui est l'identifiant de la classe
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_EPHMRA_ID_CUR  C_GET_THE_EPHMRA_ID ( database(), this );
      while ( C_GET_THE_EPHMRA_ID.next( CodeId  ) )
            { html += tr("<br><b> GET_THE_EPHMRA_ID : </b>  ") + C_GET_THE_EPHMRA_ID.MEMBER();
            }
  */
  class C_GET_THE_EPHMRA_ID_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_EPHMRA_ID_CUR ---------------------
      C_GET_THE_EPHMRA_ID_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( QString CodeId )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............

 //+        SELECT CEPH_CODE_PK,
 //+               CEPH_CEPH_CODE_FK,
 //+               CEPH_NOMF,
 //+               CEPH_NOMA,
 //+               CEPH_DATECR,
 //+               CEPH_DATEMJ
 //+        FROM   CEPH_CLASSEEPHMRA
 //+        WHERE  CEPH_CODE_PK = Codeid;
                sql_query += " SELECT CEPH_CODE_PK,"
                     " CEPH_CEPH_CODE_FK,"
                     " CEPH_NOMF,"
                     " CEPH_NOMA,"
                     " CEPH_DATECR,"
                     " CEPH_DATEMJ"
                     " FROM   ceph_classeephmra"
                     " WHERE  CEPH_CODE_PK  = '"+CodeId+"';";
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_EPHMRA_ID() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_MY_CEPH_CODE_PK   = value(0).toString();
                m_CEPH_CEPH_CODE_FK = value(1).toString();
                m_CEPH_NOMF         = value(2).toString();
                m_CEPH_NOMA         = value(3).toString();
                m_CEPH_DATECR       = value(4).toDate();
                m_CEPH_DATEMJ       = value(5).toDate();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      QString MY_CEPH_CODE_PK()   {return m_MY_CEPH_CODE_PK;}
      QString CEPH_CEPH_CODE_FK() {return m_CEPH_CEPH_CODE_FK;}
      QString CEPH_NOMF()         {return m_CEPH_NOMF;}
      QString CEPH_NOMA()         {return m_CEPH_NOMA;}
      QDate   CEPH_DATECR()       {return m_CEPH_DATECR;}
      QDate   CEPH_DATEMJ()       {return m_CEPH_DATEMJ;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      QString m_MY_CEPH_CODE_PK;
      QString m_CEPH_CEPH_CODE_FK;
      QString m_CEPH_NOMF;
      QString m_CEPH_NOMA;
      QDate   m_CEPH_DATECR;
      QDate   m_CEPH_DATEMJ;
 };

 //================================== C_GET_THE_EPHMRA_SPE_CUR   -43- ==================================
 /****************************************************************************
 *   Nom           :  GET_THE_EPHMRA_SPE
 -----------------------------------------------------------------------------
 *   Date creation : 21/07/2008
 -----------------------------------------------------------------------------
 *   Description   :  cette procédure renvoie la classification EPHMRA repondant au terme passé
 *                    en parametre qui est le code specialite
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_EPHMRA_SPE_CUR  C_GET_THE_EPHMRA_SPE ( database(), this );
      while ( C_GET_THE_EPHMRA_SPE.next( CodeId  ) )
            { html += tr("<br><b> GET_THE_EPHMRA_SPE : </b>  ") + C_GET_THE_EPHMRA_SPE.MEMBER();
            }
  */
  class C_GET_THE_EPHMRA_SPE_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_EPHMRA_SPE_CUR ---------------------
      C_GET_THE_EPHMRA_SPE_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( double CodeId )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............

 //+       SELECT ceph_ceph_code_fk   AS CEPHPERE,
 //+              sp_ceph_code_fk     AS CEPHFILS,
 //+              ceph_nomf           AS CEPHLIBF,
 //+              ceph_noma           AS CEPHLIBA
 //+       FROM   SP_SPECIALITE       ,
 //+              CEPH_CLASSEEPHMRA
 //+       WHERE  SP_CODE_SQ_PK  = CodeId
 //+       AND    CEPH_CODE_PK   = SP_CEPH_CODE_FK;
                sql_query += " SELECT CEPH_CEPH_CODE_FK   AS CEPHPERE,"
                     " SP_CEPH_CODE_FK     AS CEPHFILS,"
                     " CEPH_NOMF           AS CEPHLIBF,"
                     " CEPH_NOMA           AS CEPHLIBA"
                     " FROM   sp_specialite       ,"
                     " ceph_classeephmra"
                     " WHERE  SP_CODE_SQ_PK   = '"+ QString::number( CodeId ) +"'"
                     " AND    CEPH_CODE_PK   = SP_CEPH_CODE_FK;";
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_EPHMRA_SPE() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_MY_CEPHPERE = value(0).toString();
                m_CEPHFILS    = value(1).toString();
                m_CEPHLIBF    = value(2).toString();
                m_CEPHLIBA    = value(3).toString();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      QString MY_CEPHPERE() {return m_MY_CEPHPERE;}
      QString CEPHFILS()    {return m_CEPHFILS;}
      QString CEPHLIBF()    {return m_CEPHLIBF;}
      QString CEPHLIBA()    {return m_CEPHLIBA;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      QString m_MY_CEPHPERE;
      QString m_CEPHFILS;
      QString m_CEPHLIBF;
      QString m_CEPHLIBA;
 };

 //================================== C_GET_THE_CPH_TXT_CUR   -44- ==================================
 /****************************************************************************
 *   Nom           :  GET_THE_CPH_TXT
 -----------------------------------------------------------------------------
 *   Date creation : 21/07/2008
 -----------------------------------------------------------------------------
 *   Description   :  cette procédure renvoie la classification CPH repondant au terme passé
 *                    en parametre
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_CPH_TXT_CUR  C_GET_THE_CPH_TXT ( database(), this );
      while ( C_GET_THE_CPH_TXT.next( LibTxt  ) )
            { html += tr("<br><b> GET_THE_CPH_TXT : </b>  ") + C_GET_THE_CPH_TXT.MEMBER();
            }
  */
  class C_GET_THE_CPH_TXT_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_CPH_TXT_CUR ---------------------
      C_GET_THE_CPH_TXT_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( QString LibTxt )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............

 //+    SELECT CPH_CODE_PK       ,
 //+           CPH_CPH_CODE_FK   ,
 //+           CPH_NOM           ,
 //+           CPH_DATECR        ,
 //+           CPH_DATEMJ
 //+    FROM   CPH_CLASSEPHARMTHER
 //+    WHERE  UPPER(CPH_NOM) LIKE UPPER(LibTxt) ;
                sql_query += " SELECT CPH_CODE_PK       ,"
                     " CPH_CPH_CODE_FK   ,"
                     " CPH_NOM           ,"
                     " CPH_DATECR        ,"
                     " CPH_DATEMJ"
                     " FROM   cph_classepharmther"
                     " WHERE  UPPER(CPH_NOM) LIKE UPPER('"+LibTxt+"') ;";
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_CPH_TXT() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_MY_CPH_CODE_PK  = value(0).toString();
                m_CPH_CPH_CODE_FK = value(1).toString();
                m_CPH_NOM         = value(2).toString();
                m_CPH_DATECR      = value(3).toDate();
                m_CPH_DATEMJ      = value(4).toDate();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      QString MY_CPH_CODE_PK()  {return m_MY_CPH_CODE_PK;}
      QString CPH_CPH_CODE_FK() {return m_CPH_CPH_CODE_FK;}
      QString CPH_NOM()         {return m_CPH_NOM;}
      QDate   CPH_DATECR()      {return m_CPH_DATECR;}
      QDate   CPH_DATEMJ()      {return m_CPH_DATEMJ;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      QString m_MY_CPH_CODE_PK;
      QString m_CPH_CPH_CODE_FK;
      QString m_CPH_NOM;
      QDate   m_CPH_DATECR;
      QDate   m_CPH_DATEMJ;
 };

 //================================== C_GET_THE_CPH_SPE_CUR   -45- ==================================
 /****************************************************************************
 *   Nom           :  GET_THE_CPH_SPE
 -----------------------------------------------------------------------------
 *   Date creation : 21/07/2008
 -----------------------------------------------------------------------------
 *   Description   :  cette procédure renvoie la classification CPH repondant au terme passé
 *                    en parametre qui est le code specialité
 *   Maj           :  04/02/2009 - Mourad
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_CPH_SPE_CUR  C_GET_THE_CPH_SPE ( database(), this );
      while ( C_GET_THE_CPH_SPE.next( CodeId  ) )
            { html += tr("<br><b> GET_THE_CPH_SPE : </b>  ") + C_GET_THE_CPH_SPE.MEMBER();
            }
  */
  class C_GET_THE_CPH_SPE_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_CPH_SPE_CUR ---------------------
      C_GET_THE_CPH_SPE_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( double CodeId )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............

 //+    SELECT cph_cph_code_fk        AS CPHPERE,
 //+           cph_code_pk            AS CPHFILS,
 //+           cph_nom                AS LIBCPH
 //+    FROM   CPH_CLASSEPHARMTHER    ,
 //+           SPCPH_SPECIALITE_CLASSEPH
 //+    WHERE  CPH_CODE_PK         = SPCPH_CPH_CODE_FK_PK
 //+    AND    SPCPH_SP_CODE_FK_PK = CodeId
 //+    ORDER BY CPH_NOM ;
                sql_query += " SELECT CPH_CPH_CODE_FK        AS CPHPERE,"
                     " CPH_CODE_PK            AS CPHFILS,"
                     " CPH_NOM                AS LIBCPH"
                     " FROM   cph_classepharmther    ,"
                     " spcph_specialite_classeph"
                     " WHERE  CPH_CODE_PK         = SPCPH_CPH_CODE_FK_PK"
                     " AND    SPCPH_SP_CODE_FK_PK  = '"+ QString::number( CodeId ) +"'"
                     " ORDER BY CPH_NOM ;";
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_CPH_SPE() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_MY_CPHPERE = value(0).toString();
                m_CPHFILS    = value(1).toString();
                m_LIBCPH     = value(2).toString();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      QString MY_CPHPERE() {return m_MY_CPHPERE;}
      QString CPHFILS()    {return m_CPHFILS;}
      QString LIBCPH()     {return m_LIBCPH;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      QString m_MY_CPHPERE;
      QString m_CPHFILS;
      QString m_LIBCPH;
 };

 //================================== C_GET_THE_APHP_TXT_CUR   -46- ==================================
 /****************************************************************************
 *   Nom           :  GET_THE_APHP_TXT
 -----------------------------------------------------------------------------
 *   Date creation : 21/07/2008
 -----------------------------------------------------------------------------
 *   Description   :  cette procédure renvoie la classification AP-HP repondant au terme passé
 *                    en parametre
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_APHP_TXT_CUR  C_GET_THE_APHP_TXT ( database(), this );
      while ( C_GET_THE_APHP_TXT.next( LibTxt  ) )
            { html += tr("<br><b> GET_THE_APHP_TXT : </b>  ") + C_GET_THE_APHP_TXT.MEMBER();
            }
  */
  class C_GET_THE_APHP_TXT_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_APHP_TXT_CUR ---------------------
      C_GET_THE_APHP_TXT_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( QString LibTxt )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............

 //+     SELECT CGE_CODE_SQ_PK   ,
 //+            CGE_NOM          ,
 //+            CGE_DATECR       ,
 //+            CGE_DATEMJ
 //+     FROM   CGE_CLASSEGESTION
 //+     WHERE  UPPER(CGE_NOM) LIKE UPPER(LibTxt) ;
                sql_query += " SELECT CGE_CODE_SQ_PK   ,"
                     " CGE_NOM          ,"
                     " CGE_DATECR       ,"
                     " CGE_DATEMJ"
                     " FROM   cge_classegestion"
                     " WHERE  UPPER(CGE_NOM) LIKE UPPER('"+LibTxt+"') ;";
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_APHP_TXT() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_MY_CGE_CODE_SQ_PK = value(0).toString();
                m_CGE_NOM           = value(1).toString();
                m_CGE_DATECR        = value(2).toDate();
                m_CGE_DATEMJ        = value(3).toDate();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      QString MY_CGE_CODE_SQ_PK() {return m_MY_CGE_CODE_SQ_PK;}
      QString CGE_NOM()           {return m_CGE_NOM;}
      QDate   CGE_DATECR()        {return m_CGE_DATECR;}
      QDate   CGE_DATEMJ()        {return m_CGE_DATEMJ;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      QString m_MY_CGE_CODE_SQ_PK;
      QString m_CGE_NOM;
      QDate   m_CGE_DATECR;
      QDate   m_CGE_DATEMJ;
 };

 //================================== C_GET_THE_APHP_ID_CUR   -47- ==================================
 /****************************************************************************
 *   Nom           :  GET_THE_APHP_ID
 -----------------------------------------------------------------------------
 *   Date creation : 21/07/2008
 -----------------------------------------------------------------------------
 *   Description   :  cette procédure renvoie la classification EPHMRA repondant au terme passé
 *                    en parametre qui est l'identifiant de la classe
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_APHP_ID_CUR  C_GET_THE_APHP_ID ( database(), this );
      while ( C_GET_THE_APHP_ID.next( CodeId  ) )
            { html += tr("<br><b> GET_THE_APHP_ID : </b>  ") + C_GET_THE_APHP_ID.MEMBER();
            }
  */
  class C_GET_THE_APHP_ID_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_APHP_ID_CUR ---------------------
      C_GET_THE_APHP_ID_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( double CodeId )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............

 //+       SELECT  CGE_CODE_SQ_PK    ,
 //+               CGE_NOM           ,
 //+               CGE_DATECR        ,
 //+               CGE_DATEMJ
 //+       FROM    CGE_CLASSEGESTION
 //+       WHERE   CGE_CODE_SQ_PK   = Codeid ;
                sql_query += " SELECT  CGE_CODE_SQ_PK    ,"
                     " CGE_NOM           ,"
                     " CGE_DATECR        ,"
                     " CGE_DATEMJ"
                     " FROM    cge_classegestion"
                     " WHERE   CGE_CODE_SQ_PK    = '"+ QString::number( CodeId ) +"' ;";
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_APHP_ID() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_MY_CGE_CODE_SQ_PK = value(0).toString();
                m_CGE_NOM           = value(1).toString();
                m_CGE_DATECR        = value(2).toDate();
                m_CGE_DATEMJ        = value(3).toDate();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      QString MY_CGE_CODE_SQ_PK() {return m_MY_CGE_CODE_SQ_PK;}
      QString CGE_NOM()           {return m_CGE_NOM;}
      QDate   CGE_DATECR()        {return m_CGE_DATECR;}
      QDate   CGE_DATEMJ()        {return m_CGE_DATEMJ;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      QString m_MY_CGE_CODE_SQ_PK;
      QString m_CGE_NOM;
      QDate   m_CGE_DATECR;
      QDate   m_CGE_DATEMJ;
 };

 //================================== C_GET_THE_CHOIX_CUR   -48- ==================================
 /****************************************************************************
 *   Nom           :  GET_THE_CHOIX
 -----------------------------------------------------------------------------
 *   Date creation : 22/07/2008
 -----------------------------------------------------------------------------
 *   Description   :  cette procédure restitue les choix possible pour une specialité
 *                    donnée parmi ASMR/SMR, RAPPE,EPAR,FIT,RMO ou recommandation .
 *   MAJ           :  08/09/2008
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_CHOIX_CUR  C_GET_THE_CHOIX ( database(), this );
      while ( C_GET_THE_CHOIX.next( CodeId , Typ  ) )
            { html += tr("<br><b> GET_THE_CHOIX : </b>  ") + C_GET_THE_CHOIX.MEMBER();
            }
  */
  class C_GET_THE_CHOIX_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_CHOIX_CUR ---------------------
      C_GET_THE_CHOIX_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( QString CodeId , double Typ )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............
       if ( Typ == 1) {

 //+  SELECT  DISTINCT 'A_TRANS'       AS LIB_CHOIX,
 //+      t2.atr_titre           AS TITRE,
 //+      t4.cdf_nom             AS PRECISION1,
 //+      t3.SPSMR_NUM_ORD_PK    AS PRECISION2,
 //+      t2.atr_code_sq_pk      AS NU_FICHE,
 //+      t2.atr_date_redaction  AS DATE_TEXTE
 //+  FROM   SPATR_SPEC_AVISTRANSPARENCE    t1,
 //+     ATR_AVISCOMMISSIONTRANSPARENCE t2,
 //+     SPSMR_SERVICE_MEDICAL_RENDU    t3,
 //+     CDF_CODIF                      t4
 //+  WHERE  t1.SPATR_ATR_CODE_FK_PK     = t2.ATR_CODE_SQ_PK
 //+  AND    t1.SPATR_SP_CODE_FK_PK      = t3.SPSMR_SP_CODE_FK_PK
 //+  AND    t3.SPSMR_CDF_SMR_CODE_FK_PK = t4.CDF_CODE_PK(+)
 //+  AND    t4.CDF_NUMERO_PK(+)         = '27'
 //+  AND    t1.SPATR_SP_CODE_FK_PK      = CodeId
 //+  ORDER BY 5 ;
                sql_query += " SELECT  DISTINCT 'A_TRANS'       AS LIB_CHOIX,"
                     " t2.ATR_TITRE           AS TITRE,"
                     " t4.CDF_NOM             AS PRECISION1,"
                     " t3.SPSMR_NUM_ORD_PK    AS PRECISION2,"
                     " t2.ATR_CODE_SQ_PK      AS NU_FICHE,"
                     " t2.ATR_DATE_REDACTION  AS DATE_TEXTE"
                     " FROM   spatr_spec_avistransparence    t1,"
                     " atr_aviscommissiontransparence t2,"
                     " spsmr_service_medical_rendu    t3,"
                     " cdf_codif                      t4"
                     " WHERE  t1.SPATR_ATR_CODE_FK_PK     = t2.ATR_CODE_SQ_PK"
                     " AND    t1.SPATR_SP_CODE_FK_PK      = t3.SPSMR_SP_CODE_FK_PK"
                     " AND    t3.SPSMR_CDF_SMR_CODE_FK_PK = t4.CDF_CODE_PK"
                     " AND    t4.CDF_NUMERO_PK         = '27'"
                     " AND    t1.SPATR_SP_CODE_FK_PK       = '"+CodeId+"'"
                     " ORDER BY 5 ;";

       } else if ( Typ == 2) {

 //+        SELECT 'F_TRANS'            AS LIB_CHOIX,
 //+                ftr_titre           AS TITRE,
 //+                NULL                AS PRECISION1,
 //+                NULL                AS PRECISION2,
 //+                ftr_code_sq_pk      AS NU_FICHE,
 //+                ftr_date_redaction  AS DATE_TEXTE
 //+         FROM   SPFTR_SPECIALITE_TRANSPARENCE    ,
 //+                FTR_FICHETRANSPARENCE
 //+         WHERE  SPFTR_FTR_CODE_FK_PK  = FTR_CODE_SQ_PK
 //+         AND    SPFTR_SP_CODE_FK_PK   = CodeId ;
                sql_query += " SELECT 'F_TRANS'            AS LIB_CHOIX,"
                     " FTR_TITRE           AS TITRE,"
                     " NULL                AS PRECISION1,"
                     " NULL                AS PRECISION2,"
                     " FTR_CODE_SQ_PK      AS NU_FICHE,"
                     " FTR_DATE_REDACTION  AS DATE_TEXTE"
                     " FROM   spftr_specialite_transparence    ,"
                     " ftr_fichetransparence"
                     " WHERE  SPFTR_FTR_CODE_FK_PK  = FTR_CODE_SQ_PK"
                     " AND    SPFTR_SP_CODE_FK_PK    = '"+CodeId+"' ;";

       } else if ( Typ == 3) {

 //+   SELECT 'AFS_ANA'                       AS LIB_CHOIX,
 //+     t2.ch_titre1                   AS TITRE,
 //+     t3.CHTIT_CDF_TIT_CODE_FK_PK    AS PRECISION1,
 //+     t4.CDF_NOM                     AS PRECISION2,
 //+     t2.ch_code_sq_pk               AS NU_FICHE,
 //+     t2.ch_date                     AS DATE_TEXTE
 //+   FROM   SPCH_SPECIALITE_CHOIX  t1,
 //+     CH_CHOIX               t2,
 //+     CHTIT_CH_TITRE2        t3,
 //+     CDF_CODIF              t4
 //+   WHERE  t1.SPCH_CH_CODE_FK_PK       = t3.CHTIT_CH_CODE_FK_PK
 //+   AND    t3.CHTIT_CH_CODE_FK_PK      = t2.CH_CODE_SQ_PK
 //+   AND    t3.CHTIT_CDF_TIT_CODE_FK_PK = t4.CDF_CODE_PK
 //+   AND    t4.CDF_NUMERO_PK            = '30'
 //+   AND    t3.CHTIT_CDF_TIT_CODE_FK_PK NOT IN ('T1','T2','T3')
 //+   AND    t1.SPCH_SP_CODE_FK_PK       = CodeId ;
                sql_query += " SELECT 'AFS_ANA'                       AS LIB_CHOIX,"
                     " t2.CH_TITRE1                   AS TITRE,"
                     " t3.CHTIT_CDF_TIT_CODE_FK_PK    AS PRECISION1,"
                     " t4.CDF_NOM                     AS PRECISION2,"
                     " t2.CH_CODE_SQ_PK               AS NU_FICHE,"
                     " t2.CH_DATE                     AS DATE_TEXTE"
                     " FROM   spch_specialite_choix  t1,"
                     " ch_choix               t2,"
                     " chtit_ch_titre2        t3,"
                     " cdf_codif              t4"
                     " WHERE  t1.SPCH_CH_CODE_FK_PK       = t3.CHTIT_CH_CODE_FK_PK"
                     " AND    t3.CHTIT_CH_CODE_FK_PK      = t2.CH_CODE_SQ_PK"
                     " AND    t3.CHTIT_CDF_TIT_CODE_FK_PK = t4.CDF_CODE_PK"
                     " AND    t4.CDF_NUMERO_PK            = '30'"
                     " AND    t3.CHTIT_CDF_TIT_CODE_FK_PK NOT IN ('T1','T2','T3')"
                     " AND    t1.SPCH_SP_CODE_FK_PK        = '"+CodeId+"' ;";

       } else if ( Typ == 4) {

 //+        SELECT 'RAPPE'                            AS LIB_CHOIX,
 //+     t2.ch_titre1                   AS TITRE,
 //+     t3.CHTIT_CDF_TIT_CODE_FK_PK    AS PRECISION1,
 //+     t4.CDF_NOM                     AS PRECISION2,
 //+     t2.ch_code_sq_pk               AS NU_FICHE,
 //+     t2.ch_date                     AS DATE_TEXTE
 //+   FROM   SPCH_SPECIALITE_CHOIX  t1,
 //+      CH_CHOIX               t2,
 //+      CHTIT_CH_TITRE2        t3,
 //+      CDF_CODIF              t4
 //+   WHERE  t1.SPCH_CH_CODE_FK_PK       = t3.CHTIT_CH_CODE_FK_PK
 //+   AND    t3.CHTIT_CH_CODE_FK_PK      = t2.CH_CODE_SQ_PK
 //+   AND    t3.CHTIT_CDF_TIT_CODE_FK_PK = t4.CDF_CODE_PK
 //+   AND    t4.CDF_NUMERO_PK            = '30'
 //+   AND    t3.CHTIT_CDF_TIT_CODE_FK_PK IN ('T1','T2')
 //+   AND    t1.SPCH_SP_CODE_FK_PK       = CodeId ;
                sql_query += " SELECT 'RAPPE'                            AS LIB_CHOIX,"
                     " t2.CH_TITRE1                   AS TITRE,"
                     " t3.CHTIT_CDF_TIT_CODE_FK_PK    AS PRECISION1,"
                     " t4.CDF_NOM                     AS PRECISION2,"
                     " t2.CH_CODE_SQ_PK               AS NU_FICHE,"
                     " t2.CH_DATE                     AS DATE_TEXTE"
                     " FROM   spch_specialite_choix  t1,"
                     " ch_choix               t2,"
                     " chtit_ch_titre2        t3,"
                     " cdf_codif              t4"
                     " WHERE  t1.SPCH_CH_CODE_FK_PK       = t3.CHTIT_CH_CODE_FK_PK"
                     " AND    t3.CHTIT_CH_CODE_FK_PK      = t2.CH_CODE_SQ_PK"
                     " AND    t3.CHTIT_CDF_TIT_CODE_FK_PK = t4.CDF_CODE_PK"
                     " AND    t4.CDF_NUMERO_PK            = '30'"
                     " AND    t3.CHTIT_CDF_TIT_CODE_FK_PK IN ('T1','T2')"
                     " AND    t1.SPCH_SP_CODE_FK_PK        = '"+CodeId+"' ;";

       } else if ( Typ == 5) {

 //+         SELECT 'C_PAT'                      AS LIB_CHOIX,
 //+               t2.ch_titre1                       AS TITRE,
 //+     t3.CHTIT_CDF_TIT_CODE_FK_PK    AS PRECISION1,
 //+     t4.CDF_NOM                     AS PRECISION2,
 //+     t2.ch_code_sq_pk               AS NU_FICHE,
 //+     t2.ch_date                     AS DATE_TEXTE
 //+   FROM   SPCH_SPECIALITE_CHOIX  t1,
 //+      CH_CHOIX               t2,
 //+      CHTIT_CH_TITRE2        t3,
 //+      CDF_CODIF              t4
 //+   WHERE  t1.SPCH_CH_CODE_FK_PK       = t3.CHTIT_CH_CODE_FK_PK
 //+   AND    t3.CHTIT_CH_CODE_FK_PK      = t2.CH_CODE_SQ_PK
 //+   AND    t3.CHTIT_CDF_TIT_CODE_FK_PK = t4.CDF_CODE_PK
 //+   AND    t4.CDF_NUMERO_PK            = '30'
 //+   AND    t3.CHTIT_CDF_TIT_CODE_FK_PK = 'T3'
 //+   AND    t1.SPCH_SP_CODE_FK_PK       = CodeId ;
                sql_query += " SELECT 'C_PAT'                      AS LIB_CHOIX,"
                     " t2.CH_TITRE1                       AS TITRE,"
                     " t3.CHTIT_CDF_TIT_CODE_FK_PK    AS PRECISION1,"
                     " t4.CDF_NOM                     AS PRECISION2,"
                     " t2.CH_CODE_SQ_PK               AS NU_FICHE,"
                     " t2.CH_DATE                     AS DATE_TEXTE"
                     " FROM   spch_specialite_choix  t1,"
                     " ch_choix               t2,"
                     " chtit_ch_titre2        t3,"
                     " cdf_codif              t4"
                     " WHERE  t1.SPCH_CH_CODE_FK_PK       = t3.CHTIT_CH_CODE_FK_PK"
                     " AND    t3.CHTIT_CH_CODE_FK_PK      = t2.CH_CODE_SQ_PK"
                     " AND    t3.CHTIT_CDF_TIT_CODE_FK_PK = t4.CDF_CODE_PK"
                     " AND    t4.CDF_NUMERO_PK            = '30'"
                     " AND    t3.CHTIT_CDF_TIT_CODE_FK_PK = 'T3'"
                     " AND    t1.SPCH_SP_CODE_FK_PK        = '"+CodeId+"' ;";

       } else if ( Typ == 6) {

 //+         SELECT 'F_TER'            AS LIB_CHOIX,
 //+                NULL               AS TITRE,
 //+                fth_titre          AS PRECISION1,
 //+                NULL               AS PRECISION2,
 //+                fth_code_sq_pk     AS NU_FICHE,
 //+                fth_date_jo        AS DATE_TEXTE
 //+          FROM  SPFTH_SPEC_INFOTHERAPEUTIQUE,
 //+                FTH_FICHEINFOTHERAPEUTIQUE
 //+          WHERE SPFTH_FTH_CODE_FK_PK = FTH_CODE_SQ_PK
 //+          AND   SPFTH_SP_CODE_FK_PK  = CodeId;
                sql_query += " SELECT 'F_TER'            AS LIB_CHOIX,"
                     " NULL               AS TITRE,"
                     " FTH_TITRE          AS PRECISION1,"
                     " NULL               AS PRECISION2,"
                     " FTH_CODE_SQ_PK     AS NU_FICHE,"
                     " FTH_DATE_JO        AS DATE_TEXTE"
                     " FROM  spfth_spec_infotherapeutique,"
                     " fth_ficheinfotherapeutique"
                     " WHERE SPFTH_FTH_CODE_FK_PK = FTH_CODE_SQ_PK"
                     " AND   SPFTH_SP_CODE_FK_PK   = '"+CodeId+"';";

       } else if ( Typ == 7) {

 //+         SELECT 'RMO'          AS LIB_CHOIX,
 //+                rmo_titre1     AS TITRE,
 //+                 RMO_TITRE2    AS PRECISION1,
 //+                NULL           AS PRECISION2,
 //+                rmo_code_pk    AS NU_FICHE,
 //+                rmo_datejo     AS DATE_TEXTE
 //+         FROM   SPRMO_SPECIALITE_RMO    ,
 //+                RMO
 //+         WHERE  SPRMO_RMO_CODE_FK_PK = RMO_CODE_PK
 //+         AND    SPRMO_SP_CODE_FK_PK  = CodeId;
                sql_query += " SELECT 'RMO'          AS LIB_CHOIX,"
                     " RMO_TITRE1     AS TITRE,"
                     " RMO_TITRE2    AS PRECISION1,"
                     " NULL           AS PRECISION2,"
                     " RMO_CODE_PK    AS NU_FICHE,"
                     " RMO_DATEJO     AS DATE_TEXTE"
                     " FROM   sprmo_specialite_rmo    ,"
                     " rmo"
                     " WHERE  SPRMO_RMO_CODE_FK_PK = RMO_CODE_PK"
                     " AND    SPRMO_SP_CODE_FK_PK   = '"+CodeId+"';";

       } else {
 //+    C_GET_THE_CHOIX := NULL;
         return 0;
       }
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_CHOIX() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_MY_LIB_CHOIX = value(0).toString();
                m_TITRE        = value(1).toString();
                m_PRECISION1   = value(2).toString();
                m_PRECISION2   = value(3).toString();
                m_NU_FICHE     = value(4).toDouble();
                m_DATE_TEXTE   = value(5).toDate();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      QString MY_LIB_CHOIX() {return m_MY_LIB_CHOIX;}
      QString TITRE()        {return m_TITRE;}
      QString PRECISION1()   {return m_PRECISION1;}
      QString PRECISION2()   {return m_PRECISION2;}
      double  NU_FICHE()     {return m_NU_FICHE;}
      QDate   DATE_TEXTE()   {return m_DATE_TEXTE;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      QString m_MY_LIB_CHOIX;
      QString m_TITRE;
      QString m_PRECISION1;
      QString m_PRECISION2;
      double  m_NU_FICHE;
      QDate   m_DATE_TEXTE;
 };

 //================================== C_GET_THE_DOC_SPE_CUR   -49- ==================================
 /****************************************************************************
 *   Nom           :  GET_THE_DOC_SPE
 -----------------------------------------------------------------------------
 *   Date creation : 23/07/2008
 -----------------------------------------------------------------------------
 *   Description   :  cette procédure permet l'acces aux differents textes attribué a un
 *                    medicament theriaque dont l'identifiant est passé en parametre
 *   MAJ           : 24/11/2008
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_DOC_SPE_CUR  C_GET_THE_DOC_SPE ( database(), this );
      while ( C_GET_THE_DOC_SPE.next( CodeFic , VARTYP  ) )
            { html += tr("<br><b> GET_THE_DOC_SPE : </b>  ") + C_GET_THE_DOC_SPE.MEMBER();
            }
  */
  class C_GET_THE_DOC_SPE_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_DOC_SPE_CUR ---------------------
      C_GET_THE_DOC_SPE_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( double CodeFic , double VARTYP )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............
       if ( VARTYP == 1) {

 //+         SELECT 'A_TRANS'           AS TYPE_DOC_SPE,
 //+                atr_titre           AS TITRE,
 //+                atr_texte           AS TEXTE,
 //+                NULL                AS NO_ORD,
 //+                atr_code_sq_pk      AS PRECISION_DOC_SPE,
 //+                atr_date_redaction  AS DATE_TEXTE
 //+         FROM   ATR_AVISCOMMISSIONTRANSPARENCE
 //+         WHERE  ATR_CODE_SQ_PK    = CodeFic ;
                sql_query += " SELECT 'A_TRANS'           AS TYPE_DOC_SPE,"
                     " ATR_TITRE           AS TITRE,"
                     " ATR_TEXTE           AS TEXTE,"
                     " NULL                AS NO_ORD,"
                     " ATR_CODE_SQ_PK      AS PRECISION_DOC_SPE,"
                     " ATR_DATE_REDACTION  AS DATE_TEXTE"
                     " FROM   atr_aviscommissiontransparence"
                     " WHERE  ATR_CODE_SQ_PK     = '"+ QString::number( CodeFic ) +"' ;";

       } else if ( VARTYP == 2) {

 //+          SELECT 'F_TRANS'          AS TYPE_DOC_SPE,
 //+                ftr_titre           AS TITRE,
 //+                ftr_texte           AS TEXTE,
 //+                NULL                AS NO_ORD,
 //+                NULL                AS PRECISION_DOC_SPE,
 //+                ftr_date_redaction  AS DATE_TEXTE
 //+         FROM   FTR_FICHETRANSPARENCE
 //+         WHERE  FTR_CODE_SQ_PK  = CodeFic ;
                sql_query += " SELECT 'F_TRANS'          AS TYPE_DOC_SPE,"
                     " FTR_TITRE           AS TITRE,"
                     " FTR_TEXTE           AS TEXTE,"
                     " NULL                AS NO_ORD,"
                     " NULL                AS PRECISION_DOC_SPE,"
                     " FTR_DATE_REDACTION  AS DATE_TEXTE"
                     " FROM   ftr_fichetransparence"
                     " WHERE  FTR_CODE_SQ_PK   = '"+ QString::number( CodeFic ) +"' ;";

       } else if ( VARTYP == 3) {

 //+        SELECT 'AFS_ANA'       AS TYPE_DOC_SPE,
 //+               ch_titre1       AS TITRE,
 //+               ch_texte        AS TEXTE,
 //+               chtit_numord    AS NO_ORD,
 //+               cdf_nom         AS PRECISION_DOC_SPE,
 //+               ch_date         AS DATE_TEXTE
 //+        FROM   CH_CHOIX,
 //+               CHTIT_CH_TITRE2,
 //+               CDF_CODIF
 //+        WHERE  CHTIT_CH_CODE_FK_PK      = CodeFic
 //+        AND    CHTIT_CH_CODE_FK_PK      = CH_CODE_SQ_PK
 //+        AND    CHTIT_CDF_TIT_CODE_FK_PK NOT IN ('T1','T2','T3')
 //+        AND    CHTIT_CDF_TIT_CODE_FK_PK = CDF_CODE_PK
 //+        AND    CDF_NUMERO_PK            = '30';
                sql_query += " SELECT 'AFS_ANA'       AS TYPE_DOC_SPE,"
                     " CH_TITRE1       AS TITRE,"
                     " CH_TEXTE        AS TEXTE,"
                     " CHTIT_NUMORD    AS NO_ORD,"
                     " CDF_NOM         AS PRECISION_DOC_SPE,"
                     " CH_DATE         AS DATE_TEXTE"
                     " FROM   ch_choix,"
                     " chtit_ch_titre2,"
                     " cdf_codif"
                     " WHERE  CHTIT_CH_CODE_FK_PK       = '"+ QString::number( CodeFic ) +"'"
                     " AND    CHTIT_CH_CODE_FK_PK      = CH_CODE_SQ_PK"
                     " AND    CHTIT_CDF_TIT_CODE_FK_PK NOT IN ('T1','T2','T3')"
                     " AND    CHTIT_CDF_TIT_CODE_FK_PK = CDF_CODE_PK"
                     " AND    CDF_NUMERO_PK            = '30';";

       } else if ( VARTYP == 4) {

 //+        SELECT 'RAPPE'        AS TYPE_DOC_SPE,
 //+               ch_titre1      AS TITRE,
 //+               ch_texte       AS TEXTE,
 //+               chtit_numord   AS NO_ORD,
 //+               cdf_nom        AS PRECISION_DOC_SPE,
 //+               ch_date        AS DATE_TEXTE
 //+        FROM   CH_CHOIX,
 //+               CHTIT_CH_TITRE2,
 //+               CDF_CODIF
 //+        WHERE  CHTIT_CH_CODE_FK_PK      = CodeFic
 //+        AND    CHTIT_CH_CODE_FK_PK      = CH_CODE_SQ_PK
 //+        -- Anis : le 25/08/2008
 //+     AND    CHTIT_CDF_TIT_CODE_FK_PK IN ('T1','T2')
 //+        AND    CHTIT_CDF_TIT_CODE_FK_PK = CDF_CODE_PK
 //+        AND    cdf_numero_pk            = '30';
                sql_query += " SELECT 'RAPPE'        AS TYPE_DOC_SPE,"
                     " CH_TITRE1      AS TITRE,"
                     " CH_TEXTE       AS TEXTE,"
                     " CHTIT_NUMORD   AS NO_ORD,"
                     " CDF_NOM        AS PRECISION_DOC_SPE,"
                     " CH_DATE        AS DATE_TEXTE"
                     " FROM   ch_choix,"
                     " chtit_ch_titre2,"
                     " cdf_codif"
                     " WHERE  CHTIT_CH_CODE_FK_PK       = '"+ QString::number( CodeFic ) +"'"
                     " AND    CHTIT_CH_CODE_FK_PK      = CH_CODE_SQ_PK"
                     " "  //-- Anis : le 25/08/2008"
                     " AND    CHTIT_CDF_TIT_CODE_FK_PK IN ('T1','T2')"
                     " AND    CHTIT_CDF_TIT_CODE_FK_PK = CDF_CODE_PK"
                     " AND    cdf_numero_pk            = '30';";

       } else if ( VARTYP == 5) {

 //+        SELECT 'C_PAT'        AS TYPE_DOC_SPE, -- Conseil patient
 //+               ch_titre1      AS TITRE,
 //+               ch_texte       AS TEXTE,
 //+               chtit_numord   AS NO_ORD,
 //+               cdf_nom        AS PRECISION_DOC_SPE,
 //+               ch_date        AS DATE_TEXTE
 //+        FROM   CH_CHOIX,
 //+               CHTIT_CH_TITRE2,
 //+               CDF_CODIF
 //+        WHERE  CHTIT_CH_CODE_FK_PK      = CodeFic
 //+        AND    CHTIT_CH_CODE_FK_PK      = CH_CODE_SQ_PK
 //+        AND    CHTIT_CDF_TIT_CODE_FK_PK = 'T3'
 //+        AND    CHTIT_CDF_TIT_CODE_FK_PK = CDF_CODE_PK
 //+        AND    cdf_numero_pk            = '30' ;
                sql_query += " SELECT 'C_PAT'        AS TYPE_DOC_SPE, "  //-- Conseil patient"
                     " CH_TITRE1      AS TITRE,"
                     " CH_TEXTE       AS TEXTE,"
                     " CHTIT_NUMORD   AS NO_ORD,"
                     " CDF_NOM        AS PRECISION_DOC_SPE,"
                     " CH_DATE        AS DATE_TEXTE"
                     " FROM   ch_choix,"
                     " chtit_ch_titre2,"
                     " cdf_codif"
                     " WHERE  CHTIT_CH_CODE_FK_PK       = '"+ QString::number( CodeFic ) +"'"
                     " AND    CHTIT_CH_CODE_FK_PK      = CH_CODE_SQ_PK"
                     " AND    CHTIT_CDF_TIT_CODE_FK_PK = 'T3'"
                     " AND    CHTIT_CDF_TIT_CODE_FK_PK = CDF_CODE_PK"
                     " AND    cdf_numero_pk            = '30' ;";

       } else if ( VARTYP == 6) {

 //+          SELECT 'F_TER'           AS TYPE_DOC_SPE     ,
 //+                fth_titre          AS TITRE    ,
 //+                fth_texte          AS TEXTE    ,
 //+                NULL               AS NO_ORD   ,
 //+                NULL               AS PRECISION_DOC_SPE ,
 //+                fth_date_jo        AS DATE_TEXTE
 //+          FROM  FTH_FICHEINFOTHERAPEUTIQUE
 //+          WHERE FTH_CODE_SQ_PK  = CodeFic;
                sql_query += " SELECT 'F_TER'           AS TYPE_DOC_SPE     ,"
                     " FTH_TITRE          AS TITRE    ,"
                     " FTH_TEXTE          AS TEXTE    ,"
                     " NULL               AS NO_ORD   ,"
                     " NULL               AS PRECISION_DOC_SPE ,"
                     " FTH_DATE_JO        AS DATE_TEXTE"
                     " FROM  fth_ficheinfotherapeutique"
                     " WHERE FTH_CODE_SQ_PK   = '"+ QString::number( CodeFic ) +"';";

       } else if ( VARTYP == 7) {

 //+         SELECT 'RMO'          AS TYPE_DOC_SPE     ,
 //+                rmo_titre1     AS TITRE    ,
 //+                rmo_texte      AS TEXTE    ,
 //+                NULL           AS NO_ORD   ,
 //+                NULL           AS PRECISION_DOC_SPE,
 //+                rmo_datejo     AS DATE_TEXTE
 //+         FROM   RMO
 //+         WHERE  RMO_CODE_PK  = CodeFic ;
                sql_query += " SELECT 'RMO'          AS TYPE_DOC_SPE     ,"
                     " RMO_TITRE1     AS TITRE    ,"
                     " RMO_TEXTE      AS TEXTE    ,"
                     " NULL           AS NO_ORD   ,"
                     " NULL           AS PRECISION_DOC_SPE,"
                     " RMO_DATEJO     AS DATE_TEXTE"
                     " FROM   rmo"
                     " WHERE  RMO_CODE_PK   = '"+ QString::number( CodeFic ) +"' ;";

       } else {
 //+    C_GET_THE_DOC_SPE := NULL;
         return 0;
       }
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_DOC_SPE() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_MY_TYPE_DOC_SPE   = value(0).toString();
                m_TITRE             = value(1).toString();
                m_TEXTE             = value(2).toString();
                m_NO_ORD            = value(3).toDouble();
                m_PRECISION_DOC_SPE = value(4).toString();
                m_DATE_TEXTE        = value(5).toDate();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      QString MY_TYPE_DOC_SPE()   {return m_MY_TYPE_DOC_SPE;}
      QString TITRE()             {return m_TITRE;}
      QString TEXTE()             {return m_TEXTE;}
      double  NO_ORD()            {return m_NO_ORD;}
      QString PRECISION_DOC_SPE() {return m_PRECISION_DOC_SPE;}
      QDate   DATE_TEXTE()        {return m_DATE_TEXTE;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      QString m_MY_TYPE_DOC_SPE;
      QString m_TITRE;
      QString m_TEXTE;
      double  m_NO_ORD;
      QString m_PRECISION_DOC_SPE;
      QDate   m_DATE_TEXTE;
 };

 //================================== C_GET_THE_ATR_COMPL_CUR   -50- ==================================
 /****************************************************************************
 *   Nom           :  GET_THE_ATR_COMPL
 -----------------------------------------------------------------------------
 *   Date creation : 23/07/2008
 -----------------------------------------------------------------------------
 *   Description   :  cette procédure sert a recuperer les informations détaillé
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_ATR_COMPL_CUR  C_GET_THE_ATR_COMPL ( database(), this );
      while ( C_GET_THE_ATR_COMPL.next( CodeAv  ) )
            { html += tr("<br><b> GET_THE_ATR_COMPL : </b>  ") + C_GET_THE_ATR_COMPL.MEMBER();
            }
  */
  class C_GET_THE_ATR_COMPL_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_ATR_COMPL_CUR ---------------------
      C_GET_THE_ATR_COMPL_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( double CodeAv )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............

 //+    SELECT 'A_TRANS'               AS TYPE_ATR_COMPL     ,
 //+              presmr_pre_code_fk_pk   AS PRESMR_PRE_CODE ,
 //+              presmr_date_smr_pk      AS PRESMR_DATE_SMR ,
 //+              cdf_nom           AS NATURE
 //+       FROM   PRESMR_PRE_SMR_ATR      ,
 //+              CDF_CODIF
 //+       WHERE  PRESMR_ATR_CODE_FK_PK = CodeAv
 //+       AND    CDF_CODE_PK           = PRESMR_CDF_SMR_CODE_FK_PK
 //+       AND    CDF_NUMERO_PK         = '27' ;
                sql_query += " SELECT 'A_TRANS'               AS TYPE_ATR_COMPL     ,"
                     " PRESMR_PRE_CODE_FK_PK   AS PRESMR_PRE_CODE ,"
                     " PRESMR_DATE_SMR_PK      AS PRESMR_DATE_SMR ,"
                     " CDF_NOM           AS NATURE"
                     " FROM   presmr_pre_smr_atr      ,"
                     " cdf_codif"
                     " WHERE  PRESMR_ATR_CODE_FK_PK  = '"+ QString::number( CodeAv ) +"'"
                     " AND    CDF_CODE_PK           = PRESMR_CDF_SMR_CODE_FK_PK"
                     " AND    CDF_NUMERO_PK         = '27' ;";
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_ATR_COMPL() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_MY_TYPE_ATR_COMPL = value(0).toString();
                m_PRESMR_PRE_CODE   = value(1).toString();
                m_PRESMR_DATE_SMR   = value(2).toDate();
                m_NATURE            = value(3).toString();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      QString MY_TYPE_ATR_COMPL() {return m_MY_TYPE_ATR_COMPL;}
      QString PRESMR_PRE_CODE()   {return m_PRESMR_PRE_CODE;}
      QDate   PRESMR_DATE_SMR()   {return m_PRESMR_DATE_SMR;}
      QString NATURE()            {return m_NATURE;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      QString m_MY_TYPE_ATR_COMPL;
      QString m_PRESMR_PRE_CODE;
      QDate   m_PRESMR_DATE_SMR;
      QString m_NATURE;
 };

 //================================== C_GET_THE_GEN_SPE_CUR   -51- ==================================
 /****************************************************************************
 *   Nom           :  GET_THE_GEN_SPE
 -----------------------------------------------------------------------------
 *   Date creation : 24/07/2008
 -----------------------------------------------------------------------------
 *   Description   :  cette procédure affiche les specialités generiques pour le
 *                    code specialite passé en parametre,le deusieme parametre permet
 *                    de selectionné les similaires theriaque ou générique AFFSAPS
 *   MAJ           :  18/12/2008 - Anis
                   :  04/02/2009 - Mourad
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_GEN_SPE_CUR  C_GET_THE_GEN_SPE ( database(), this );
      while ( C_GET_THE_GEN_SPE.next( CodeId , VarTyp  ) )
            { html += tr("<br><b> GET_THE_GEN_SPE : </b>  ") + C_GET_THE_GEN_SPE.MEMBER();
            }
  */
  class C_GET_THE_GEN_SPE_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_GEN_SPE_CUR ---------------------
      C_GET_THE_GEN_SPE_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( double CodeId , double VarTyp )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............
       if ( VarTyp == 1) {            // -- generique theriaque

 //+   SELECT A.SP_NOM         AS GSP_NOM,
 //+          A.SP_CODE_SQ_PK  AS SP_CODE,
 //+       NULL             AS SP_GREF_DATECR,
 //+       NULL             AS SP_DATEJOGENE,
 //+       GSP_CODE_SP_REFERENCE AS GEN_REF
 //+   FROM   SP_SPECIALITE A,
 //+          PRE_PRESENTATION,
 //+       SP_SPECIALITE B,
 //+       GSP_GENERIQUE_SPECIALITE
 //+   WHERE  B.SP_GSP_CODE_FK = A.SP_GSP_CODE_FK
 //+   AND    A.SP_CODE_SQ_PK = PRE_SP_CODE_FK
 //+   AND    GSP_CODE_SQ_PK = B.SP_GSP_CODE_FK
 //+   AND    B.SP_CODE_SQ_PK =  CodeId
 //+   AND    A.SP_CODE_SQ_PK <> CodeId
 //+   UNION
 //+   SELECT SP_NOM        AS GSP_NOM,
 //+          SP_CODE_SQ_PK AS SP_CODE_SQ_PK,
 //+       NULL          AS SP_GREF_DATECR,
 //+       NULL          AS SP_DATEJOGENE,
 //+       GSP_CODE_SP_REFERENCE AS GEN_REF
 //+   FROM   SP_SPECIALITE,
 //+       GSP_GENERIQUE_SPECIALITE
 //+   WHERE  GSP_CODE_SQ_PK = SP_GSP_CODE_FK
 //+   AND    SP_CODE_SQ_PK  = CodeId;
                sql_query +=                                          // -- generique theriaque
                     " SELECT A.SP_NOM       AS GSP_NOM,"             // 0
                     " A.SP_CODE_SQ_PK       AS SP_CODE,"             // 1
                     " NULL                  AS SP_GREF_DATECR,"      // 2
                     " NULL                  AS SP_DATEJOGENE,"       // 3
                     " GSP_CODE_SP_REFERENCE AS GEN_REF,"             // 4
                     " A.SP_TYPE_SPE         AS GEN_TYPE,"            // 5
                     " PRE_CODE_PK           AS PRE_CODE "            // 6
                     " FROM   sp_specialite A,"
                     " pre_presentation,"
                     " sp_specialite B,"
                     " gsp_generique_specialite"
                     " WHERE  B.SP_GSP_CODE_FK = A.SP_GSP_CODE_FK"
                     " AND    A.SP_CODE_SQ_PK  = PRE_SP_CODE_FK"
                     " AND    GSP_CODE_SQ_PK   = B.SP_GSP_CODE_FK"
                     " AND    B.SP_CODE_SQ_PK  = '"+ QString::number( CodeId ) +"'"
                     " AND    A.SP_CODE_SQ_PK <> '"+ QString::number( CodeId ) +"'"
                     " UNION"
                     " SELECT SP_NOM         AS GSP_NOM,"
                     " SP_CODE_SQ_PK         AS SP_CODE_SQ_PK,"
                     " NULL                  AS SP_GREF_DATECR,"
                     " NULL                  AS SP_DATEJOGENE,"
                     " GSP_CODE_SP_REFERENCE AS GEN_REF,"
                     " SP_TYPE_SPE           AS GEN_TYPE,"
                     " NULL                  AS PRE_CODE "
                     " FROM   sp_specialite,"
                     " gsp_generique_specialite"
                     " WHERE  GSP_CODE_SQ_PK = SP_GSP_CODE_FK"
                     " AND    SP_CODE_SQ_PK   = '"+ QString::number( CodeId ) +"';";

       } else if ( VarTyp == 2) {     // -- generique affsapps

 //+   SELECT B.SP_NOM            AS GSP_NOM,
 //+          B.SP_CODE_SQ_PK     AS SP_CODE_SQ_PK,
 //+       B.SP_GREF_DATECR_FK AS SP_GREF_DATECR,
 //+       B.SP_DATEJOGENE     AS SP_DATEJOGENE,
 //+       NULL       AS GEN_REF
 //+       --GSP_CODE_SP_REFERENCE AS GEN_REF
 //+   FROM   SPGREFG_GROUPE_SPE_GENE,
 //+          SP_SPECIALITE B,
 //+       SP_SPECIALITE A,
 //+       PREGREF_PRE_GROUPE_REF,
 //+          PRE_PRESENTATION
 //+       --GSP_GENERIQUE_SPECIALITE
 //+   WHERE  SPGREFG_SP_CODE_FK_PK      = B.SP_CODE_SQ_PK
 //+   AND    SPGREFG_GREF_CODE_FK_PK    = B.SP_GREF_FK
 //+   AND    SPGREFG_GREF_DATECR_FK_PK  = B.SP_GREF_DATECR_FK
 //+   AND    SPGREFG_GREF_CODE_FK_PK = A.SP_GREF_FK
 //+   AND    B.SP_CODE_SQ_PK = PRE_SP_CODE_FK
 //+   AND    PREGREF_PRE_CODE_FK_PK = PRE_CODE_PK
 //+   --AND    GSP_CODE_SQ_PK = A.SP_GSP_CODE_FK
 //+   AND    PREGREF_DATESORTIE IS  NULL
 //+   AND    A.SP_CODE_SQ_PK = CodeId;
                sql_query +=                                         // -- generique affsapps
                     " SELECT B.SP_NOM     AS GSP_NOM,"              // 0
                     " B.SP_CODE_SQ_PK     AS SP_CODE_SQ_PK,"        // 1
                     " B.SP_GREF_DATECR_FK AS SP_GREF_DATECR,"       // 2
                     " B.SP_DATEJOGENE     AS SP_DATEJOGENE,"        // 3
                     " NULL                AS GEN_REF,"              // 4
                     " A.SP_TYPE_SPE       AS GEN_TYPE,"             // 5
                     " PRE_CODE_PK         AS PRE_CODE "             // 6
                     " "  //--GSP_CODE_SP_REFERENCE AS GEN_REF"
                     " FROM   spgrefg_groupe_spe_gene,"
                     " sp_specialite B,"
                     " sp_specialite A,"
                     " pregref_pre_groupe_ref,"
                     " pre_presentation"
                     " "  //--gsp_generique_specialite"
                     " WHERE  SPGREFG_SP_CODE_FK_PK      = B.SP_CODE_SQ_PK"
                     " AND    SPGREFG_GREF_CODE_FK_PK    = B.SP_GREF_FK"
                     " AND    SPGREFG_GREF_DATECR_FK_PK  = B.SP_GREF_DATECR_FK"
                     " AND    SPGREFG_GREF_CODE_FK_PK    = A.SP_GREF_FK"
                     " AND    B.SP_CODE_SQ_PK            = PRE_SP_CODE_FK"
                     " AND    PREGREF_PRE_CODE_FK_PK     = PRE_CODE_PK"
                     " "  //--AND    GSP_CODE_SQ_PK      = A.SP_GSP_CODE_FK"
                     " AND    PREGREF_DATESORTIE IS  NULL"
                     " AND    A.SP_CODE_SQ_PK  = '"+ QString::number( CodeId ) +"';";

       } else if ( VarTyp == 3) {    // -- generique pour un medicament virtuelle

 //+        SELECT SP_NOM        AS GSP_NOM,
 //+         SP_CODE_SQ_PK AS SP_CODE_SQ_PK,
 //+      NULL          AS SP_GREF_DATECR,
 //+      NULL          AS SP_DATEJOGENE,
 //+      GSP_CODE_SP_REFERENCE  AS GEN_REF
 //+        FROM SP_SPECIALITE,
 //+    GSP_GENERIQUE_SPECIALITE
 //+        WHERE GSP_CODE_SQ_PK = SP_GSP_CODE_FK
 //+  AND   SP_GSP_CODE_FK = CodeId;
                sql_query +=
                     " SELECT SP_NOM          AS GSP_NOM,"
                     " SP_CODE_SQ_PK          AS SP_CODE_SQ_PK,"
                     " NULL                   AS SP_GREF_DATECR,"
                     " NULL                   AS SP_DATEJOGENE,"
                     " GSP_CODE_SP_REFERENCE  AS GEN_REF,"
                     " SP_TYPE_SPE            AS GEN_TYPE,"
                     " NULL                   AS PRE_CODE"
                     " FROM sp_specialite,"
                     " gsp_generique_specialite"
                     " WHERE GSP_CODE_SQ_PK = SP_GSP_CODE_FK"
                     " AND   SP_GSP_CODE_FK  = '"+ QString::number( CodeId ) +"';";

       } else if ( VarTyp == 4) {

 //+    SELECT DISTINCT(t2.GSP_NOM) AS GSP_NOM,
 //+     t2.GSP_CODE_SQ_PK    AS SP_CODE_SQ_PK,
 //+     NULL                 AS SP_GREF_DATECR,
 //+     NULL                 AS SP_DATEJOGENE,
 //+        t2.GSP_CODE_SP_REFERENCE AS GEN_REF
 //+    FROM   SP_SPECIALITE t1,
 //+     GSP_GENERIQUE_SPECIALITE t2
 //+    WHERE  t2.GSP_CODE_SQ_PK    = t1.SP_GSP_CODE_FK
 //+    AND    t1.SP_CODE_SQ_PK     = CodeId;
                sql_query +=
                     " SELECT DISTINCT(t2.GSP_NOM) AS GSP_NOM,"
                     " t2.GSP_CODE_SQ_PK           AS SP_CODE_SQ_PK,"
                     " NULL                        AS SP_GREF_DATECR,"
                     " NULL                        AS SP_DATEJOGENE,"
                     " t2.GSP_CODE_SP_REFERENCE    AS GEN_REF,"
                     " t1.SP_TYPE_SPE              AS GEN_TYPE,"
                     " NULL                        AS PRE_CODE"
                     " FROM   sp_specialite t1,"
                     " gsp_generique_specialite t2"
                     " WHERE  t2.GSP_CODE_SQ_PK    = t1.SP_GSP_CODE_FK"
                     " AND    t1.SP_CODE_SQ_PK     = '"+ QString::number( CodeId ) +"';";

       } else {
         return 0;
       }
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_GEN_SPE() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_MY_GSP_NOM     = value(0).toString();
                m_SP_CODE        = value(1).toDouble();
                m_SP_GREF_DATECR = value(2).toDate();
                m_SP_DATEJOGENE  = value(3).toDate();
                m_GEN_REF        = value(4).toDouble();
                m_GEN_TYPE       = value(5).toString();
                m_PRE_CODE       = value(6).toString();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      QString MY_GSP_NOM()     {return m_MY_GSP_NOM;}
      double  SP_CODE()        {return m_SP_CODE;}
      QDate   SP_GREF_DATECR() {return m_SP_GREF_DATECR;}
      QDate   SP_DATEJOGENE()  {return m_SP_DATEJOGENE;}
      double  GEN_REF()        {return m_GEN_REF;}
      QString GEN_TYPE()       {return m_GEN_TYPE;}
      QString PRE_CODE()       {return m_PRE_CODE;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      QString m_MY_GSP_NOM;
      double  m_SP_CODE;
      QDate   m_SP_GREF_DATECR;
      QDate   m_SP_DATEJOGENE;
      double  m_GEN_REF;
      QString m_GEN_TYPE;
      QString m_PRE_CODE;
 };

 //================================== C_GET_THE_GEN_VIR_TXT_CUR   -52- ==================================
 /****************************************************************************
 *   Nom           :  GET_THE_GEN_VIR_TXT
 -----------------------------------------------------------------------------
 *   Date creation : 28/07/2008
 -----------------------------------------------------------------------------
 *   Description   :  cette procédure affiche les medicaments virtuel pour
 *                    le texte passé en argument
 -----------------------------------------------------------------------------
 *   Date modification : 27/04/2009 - Mourad (Ticket Mantis 0000026)
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_GEN_VIR_TXT_CUR  C_GET_THE_GEN_VIR_TXT ( database(), this );
      while ( C_GET_THE_GEN_VIR_TXT.next( TXT , PRES_DC  ) )
            { html += tr("<br><b> GET_THE_GEN_VIR_TXT : </b>  ") + C_GET_THE_GEN_VIR_TXT.MEMBER();
            }
  */
  class C_GET_THE_GEN_VIR_TXT_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_GEN_VIR_TXT_CUR ---------------------
      C_GET_THE_GEN_VIR_TXT_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( QString TXT , double PRES_DC )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............
       if ( PRES_DC > 1) {

 //+  SELECT   GSP_NOM ,
 //+           GSP_CODE_SQ_PK  AS ID,
 //+        GSP_PRESCRIPTION_DC AS PRES_DC,
 //+      GSP_CODE_VIRTUEL13 AS ID13,
 //+      GSP_INFO_GENERAL_TEXTE AS GEN_TEXT
 //+  FROM  GSP_GENERIQUE_SPECIALITE
 //+       WHERE UPPER(gsp_nom) LIKE UPPER(TXT)
 //+  ORDER BY GSP_CODE_SQ_PK ;
                sql_query += " SELECT   GSP_NOM ,"
                     " GSP_CODE_SQ_PK  AS ID,"
                     " GSP_PRESCRIPTION_DC AS PRES_DC,"
                     " GSP_CODE_VIRTUEL13 AS ID13,"
                     " GSP_INFO_GENERAL_TEXTE AS GEN_TEXT"
                     " FROM  gsp_generique_specialite"
                     " WHERE UPPER(gsp_nom) LIKE UPPER('"+TXT+"')"
                     " ORDER BY GSP_CODE_SQ_PK ;";

       } else if ( PRES_DC == 0 || PRES_DC == 1) {

 //+    SELECT GSP_NOM ,
 //+           GSP_CODE_SQ_PK  AS ID,
 //+      GSP_PRESCRIPTION_DC AS PRES_DC,
 //+      GSP_CODE_VIRTUEL13 AS ID13,
 //+      GSP_INFO_GENERAL_TEXTE AS GEN_TEXT
 //+     FROM     GSP_GENERIQUE_SPECIALITE
 //+     WHERE    UPPER(gsp_nom) LIKE UPPER(TXT)
 //+     AND   GSP_PRESCRIPTION_DC = PRES_DC
 //+     ORDER BY GSP_CODE_SQ_PK ;
                sql_query += " SELECT GSP_NOM ,"
                     " GSP_CODE_SQ_PK  AS ID,"
                     " GSP_PRESCRIPTION_DC AS PRES_DC,"
                     " GSP_CODE_VIRTUEL13 AS ID13,"
                     " GSP_INFO_GENERAL_TEXTE AS GEN_TEXT"
                     " FROM     gsp_generique_specialite"
                     " WHERE    UPPER(gsp_nom) LIKE UPPER('"+TXT+"')"
                     " AND   GSP_PRESCRIPTION_DC  = '"+ QString::number( PRES_DC ) +"'"
                     " ORDER BY GSP_CODE_SQ_PK ;";

       }
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_GEN_VIR_TXT() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_MY_GSP_NOM = value(0).toString();
                m_ID         = value(1).toDouble();
                m_PRES_DC    = value(2).toInt();
                m_ID13       = value(3).toString();
                m_GEN_TEXT   = value(4).toString();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      QString MY_GSP_NOM() {return m_MY_GSP_NOM;}
      double  ID()         {return m_ID;}
      int     PRES_DC()    {return m_PRES_DC;}
      QString ID13()       {return m_ID13;}
      QString GEN_TEXT()   {return m_GEN_TEXT;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      QString m_MY_GSP_NOM;
      double  m_ID;
      int     m_PRES_DC;
      QString m_ID13;
      QString m_GEN_TEXT;
 };

 //================================== C_GET_THE_POSO_CUR   -53- ==================================
 /****************************************************************************
 *   Nom           :  GET_THE_POSO
 -----------------------------------------------------------------------------
 *   Date creation : 29/07/2008
 -----------------------------------------------------------------------------
 *   Description   :  cette procédure retourne pour un code specialité donné
 *                    et une liste de terrain les infos suivantes :
 *                     - les fiches
 *                     - voies d'administration
 *                     - Terrain
 *                        * terrain
 *                        * code groupe
 *                     - indication rattaché a la posologie
 *                        * nature indication
 *                        * complement nature indication
 *                     - référence officielle
 *   MAJ : 23/08/2008
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_POSO_CUR  C_GET_THE_POSO ( database(), this );
      while ( C_GET_THE_POSO.next( IDSPE , LSTTER  ) )
            { html += tr("<br><b> GET_THE_POSO : </b>  ") + C_GET_THE_POSO.MEMBER();
            }
  */
  class C_GET_THE_POSO_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_POSO_CUR ---------------------
      C_GET_THE_POSO_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( QString IDSPE , QString LSTTER="" )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............
       if ( LSTTER.length() == 0) {

 //+         -- fiche posologie
 //+         ' SELECT t1.fposp_fpo_code_fk_pk    AS NOFIC,  '||
 //+         '       ''0''           AS TYP ,               '||
 //+   '        null           AS INFO_01,      '||
 //+   '        null           AS VALEUR_01,          '||
 //+   '        null           AS VALEUR_02,          '||
 //+   '        null           AS DATE_01             '||
 //+         ' FROM    FPOSP_POSO_SPE  t1              '||
 //+         ' WHERE   t1.FPOSP_SP_CODE_FK_PK = '||IDSPE||
 //+         ' UNION                              '||
 //+         -- voies d'administration
 //+         ' SELECT t1.fposp_fpo_code_fk_pk AS NOFIC,  '||
 //+         '        ''1''       AS TYP ,               '||
 //+   '        t3.cdf_nom  AS INFO_01,            '||
 //+   '        null        AS VALEUR_01,          '||
 //+   '        null        AS VALEUR_02,          '||
 //+   '        null        AS DATE_01             '||
 //+         ' FROM   FPOSP_POSO_SPE   t1,FPOVO_FPOSO_VOIE t2,CDF_CODIF t3 '||
 //+         ' WHERE  t2.FPOVO_CDF_VO_CODE_FK_PK = t3.CDF_CODE_PK          '||
 //+         ' AND    t3.CDF_NUMERO_PK           = ''18''                  '||
 //+         ' AND    t2.FPOVO_FPO_CODE_FK_PK    = t1.FPOSP_FPO_CODE_FK_PK '||
 //+         ' AND    t1.FPOSP_SP_CODE_FK_PK     = '||IDSPE||
 //+         ' UNION                                                       '||
 //+         -- Terrain
 //+         ' SELECT  t1.fposp_fpo_code_fk_pk    AS NOFIC,  '||
 //+         '         ''2''                AS TYP ,         '||
 //+   '         t3.cdf_nom           AS INFO_01,    '||
 //+   '         t2.fpote_grp_code_pk AS VALEUR_01,    '||
 //+   '         t2.fpote_numord      AS VALEUR_02,    '||
 //+   '         null                 AS DATE_01       '||
 //+         ' FROM    FPOSP_POSO_SPE t1,FPOTE_FPOSO_TERRAIN t2,CDF_CODIF t3   '||
 //+         ' WHERE   t1.FPOSP_FPO_CODE_FK_PK  = t2.FPOTE_FPO_CODE_FK_PK      '||
 //+         ' AND     t3.CDF_CODE_PK           = t2.FPOTE_CDF_TEPO_CODE_FK_PK '||
 //+         ' AND     t3.CDF_NUMERO_PK         = ''PT''                       '||
 //+         ' AND     t1.FPOSP_SP_CODE_FK_PK   = '||IDSPE||
 //+         ' UNION                                  '||
 //+         -- nature indication
 //+         ' SELECT t1.fposp_fpo_code_fk_pk    AS NOFIC,  '||
 //+         '       ''3''           AS TYP ,         '||
 //+     '       t3.cdf_nom      AS INFO_01,   '||
 //+     '       null            AS VALEUR_01,    '||
 //+     '       null            AS VALEUR_02,    '||
 //+     '       null            AS DATE_01       '||
 //+         ' FROM  FPOSP_POSO_SPE t1,FPOUT_FPOSO_UTILTH  t2,CDF_CODIF t3    '||
 //+         ' WHERE  t1.FPOSP_FPO_CODE_FK_PK  = t2.FPOUT_FPO_CODE_FK_PK      '||
 //+         ' AND    t3.CDF_CODE_PK           = t2.FPOUT_CDF_UTPO_CODE_FK_PK '||
 //+         ' AND    t3.CDF_NUMERO_PK         = ''NN''                       '||
 //+         ' AND    t1.FPOSP_SP_CODE_FK_PK   = '||IDSPE||
 //+         ' UNION                                  '||
 //+         -- complement nature indication
 //+         ' SELECT  t1.fposp_fpo_code_fk_pk  AS NOFIC,  '||
 //+         '        ''4''               AS TYP ,         '||
 //+   '        t3.cdf_nom          AS INFO_01,      '||
 //+   '        null                AS VALEUR_01,    '||
 //+   '        t2.fpocout_num_ord  AS VALEUR_02,    '||
 //+   '        null                AS DATE_01       '||
 //+         'FROM    FPOSP_POSO_SPE t1,FPOCOUT_FPOSO_COMMENTUTILTH  t2,CDF_CODIF t3 '||
 //+         'WHERE   t1.FPOSP_FPO_CODE_FK_PK  = t2.FPOCOUT_FPO_CODE_FK_PK           '||
 //+         'AND     t3.CDF_CODE_PK           = t2.FPOCOUT_CDF_COUT_CODE_FK_PK      '||
 //+         'AND     t3.CDF_NUMERO_PK         = ''PC''  '||
 //+         'AND     t1.FPOSP_SP_CODE_FK_PK   =  '||IDSPE||
 //+         ' UNION                                     '||
 //+         -- référence officielle
 //+         ' SELECT t1.fposp_fpo_code_fk_pk    AS NOFIC,        '||
 //+         '       ''5''                       AS TYP ,         '||
 //+   '       t3.cdf_nom                  AS INFO_01,      '||
 //+   '       null                        AS VALEUR_01,    '||
 //+   '       null                        AS VALEUR_02,    '||
 //+   '       t2.fpoafs_date_pk           AS DATE_01       '||
 //+         ' FROM   FPOSP_POSO_SPE t1,FPOAFS_POSO_AFSSAPS t2,CDF_CODIF t3   '||
 //+         ' WHERE  t1.FPOSP_SP_CODE_FK_PK  = t2.FPOAFS_SP_CODE_FK_PK       '||
 //+         ' AND    t1.FPOSP_FPO_CODE_FK_PK = t2.FPOAFS_FPO_CODE_FK_PK      '||
 //+         ' AND    t3.CDF_CODE_PK           = t2.FPOAFS_CDF_DOCUMENT_FK_PK '||
 //+         ' AND    t3.CDF_NUMERO_PK         = ''25''  '||
 //+         ' AND    t1.FPOSP_SP_CODE_FK_PK   =  '||IDSPE||
 //+         ' AND    t2.fpoafs_date_pk        IN (select max(t2.fpoafs_date_pk)                                   '||
 //+                                          'FROM   FPOSP_POSO_SPE t1,FPOAFS_POSO_AFSSAPS t2,CDF_CODIF t3    '||
 //+                         ' WHERE  t1.FPOSP_SP_CODE_FK_PK  = t2.FPOAFS_SP_CODE_FK_PK       '||
 //+                 ' AND    t1.FPOSP_FPO_CODE_FK_PK = t2.FPOAFS_FPO_CODE_FK_PK      '||
 //+                                               ' AND    t3.CDF_CODE_PK           = t2.FPOAFS_CDF_DOCUMENT_FK_PK '||
 //+                                               ' AND    t3.CDF_NUMERO_PK         = ''25''                       '||
 //+                                               ' AND    t1.FPOSP_SP_CODE_FK_PK   =  '||IDSPE||')'||
 //+         ' ORDER BY 1,2,5 ';
                sql_query +=
                     " SELECT t1.FPOSP_FPO_CODE_FK_PK    AS NOFIC,"
                     " '0'                               AS TYP ,"
                     " NULL                              AS INFO_01,"
                     " NULL                              AS VALEUR_01,"
                     " NULL                              AS VALEUR_02,"
                     " NULL                              AS DATE_01"
                     " FROM    fposp_poso_spe  t1"
                     " WHERE   t1.FPOSP_SP_CODE_FK_PK = '"+IDSPE+"'"
                     " UNION"
                     " "  //-- voies d'administration"
                     " SELECT t1.FPOSP_FPO_CODE_FK_PK AS NOFIC,"
                     " '1'                            AS TYP ,"
                     " t3.CDF_NOM                     AS INFO_01,"
                     " NULL                           AS VALEUR_01,"
                     " NULL                           AS VALEUR_02,"
                     " NULL                           AS DATE_01"
                     " FROM   fposp_poso_spe   t1,fpovo_fposo_voie t2,cdf_codif t3"
                     " WHERE  t2.FPOVO_CDF_VO_CODE_FK_PK = t3.CDF_CODE_PK"
                     " AND    t3.CDF_NUMERO_PK           = '18'"
                     " AND    t2.FPOVO_FPO_CODE_FK_PK    = t1.FPOSP_FPO_CODE_FK_PK"
                     " AND    t1.FPOSP_SP_CODE_FK_PK     = '"+IDSPE+"'"
                     " UNION"
                     " "  //-- Terrain"
                     " SELECT  t1.FPOSP_FPO_CODE_FK_PK    AS NOFIC,"
                     " '2'                                AS TYP ,"
                     " t3.CDF_NOM                         AS INFO_01,"
                     " t2.FPOTE_GRP_CODE_PK               AS VALEUR_01,"
                     " t2.FPOTE_NUMORD                    AS VALEUR_02,"
                     " NULL                               AS DATE_01"
                     " FROM    fposp_poso_spe t1,fpote_fposo_terrain t2,cdf_codif t3"
                     " WHERE   t1.FPOSP_FPO_CODE_FK_PK  = t2.FPOTE_FPO_CODE_FK_PK"
                     " AND     t3.CDF_CODE_PK           = t2.FPOTE_CDF_TEPO_CODE_FK_PK"
                     " AND     t3.CDF_NUMERO_PK         = 'PT'"
                     " AND     t1.FPOSP_SP_CODE_FK_PK   = '"+IDSPE+"'"
                     " UNION"
                     " "  //-- nature indication"
                     " SELECT t1.FPOSP_FPO_CODE_FK_PK    AS NOFIC,"
                     " '3'                               AS TYP ,"
                     " t3.CDF_NOM                        AS INFO_01,"
                     " NULL                              AS VALEUR_01,"
                     " NULL                              AS VALEUR_02,"
                     " NULL                              AS DATE_01"
                     " FROM  fposp_poso_spe t1,fpout_fposo_utilth  t2,cdf_codif t3"
                     " WHERE  t1.FPOSP_FPO_CODE_FK_PK  = t2.FPOUT_FPO_CODE_FK_PK"
                     " AND    t3.CDF_CODE_PK           = t2.FPOUT_CDF_UTPO_CODE_FK_PK"
                     " AND    t3.CDF_NUMERO_PK         = 'NN'"
                     " AND    t1.FPOSP_SP_CODE_FK_PK   = '"+IDSPE+"'"
                     " UNION"
                     " "  //-- complement nature indication"
                     " SELECT  t1.FPOSP_FPO_CODE_FK_PK  AS NOFIC,"
                     " '4'                              AS TYP ,"
                     " t3.CDF_NOM                       AS INFO_01,"
                     " NULL                             AS VALEUR_01,"
                     " t2.FPOCOUT_NUM_ORD               AS VALEUR_02,"
                     " NULL                             AS DATE_01"
                     " FROM    fposp_poso_spe t1,fpocout_fposo_commentutilth  t2,cdf_codif t3"
                     " WHERE   t1.FPOSP_FPO_CODE_FK_PK  = t2.FPOCOUT_FPO_CODE_FK_PK"
                     " AND     t3.CDF_CODE_PK           = t2.FPOCOUT_CDF_COUT_CODE_FK_PK"
                     " AND     t3.CDF_NUMERO_PK         = 'PC'"
                     " AND     t1.FPOSP_SP_CODE_FK_PK   = '"+IDSPE+"'"
                     " UNION"
                     " "  //-- référence officielle"
                     " SELECT t1.FPOSP_FPO_CODE_FK_PK    AS NOFIC,"
                     " '5'                               AS TYP ,"
                     " t3.CDF_NOM                        AS INFO_01,"
                     " NULL                              AS VALEUR_01,"
                     " NULL                              AS VALEUR_02,"
                     " t2.FPOAFS_DATE_PK                 AS DATE_01"
                     " FROM   fposp_poso_spe t1,fpoafs_poso_afssaps t2,cdf_codif t3"
                     " WHERE  t1.FPOSP_SP_CODE_FK_PK   = t2.FPOAFS_SP_CODE_FK_PK"
                     " AND    t1.FPOSP_FPO_CODE_FK_PK  = t2.FPOAFS_FPO_CODE_FK_PK"
                     " AND    t3.CDF_CODE_PK           = t2.FPOAFS_CDF_DOCUMENT_FK_PK"
                     " AND    t3.CDF_NUMERO_PK         = '25'"
                     " AND    t1.FPOSP_SP_CODE_FK_PK   = '"+IDSPE+"'"
                     " AND    t2.FPOAFS_DATE_PK        IN (SELECT MAX(t2.FPOAFS_DATE_PK)"
                     "                                     FROM   fposp_poso_spe t1,fpoafs_poso_afssaps t2,cdf_codif t3"
                     "                                     WHERE  t1.FPOSP_SP_CODE_FK_PK   = t2.FPOAFS_SP_CODE_FK_PK"
                     "                                     AND    t1.FPOSP_FPO_CODE_FK_PK  = t2.FPOAFS_FPO_CODE_FK_PK"
                     "                                     AND    t3.CDF_CODE_PK           = t2.FPOAFS_CDF_DOCUMENT_FK_PK"
                     "                                     AND    t3.CDF_NUMERO_PK         = '25'"
                     "                                     AND    t1.FPOSP_SP_CODE_FK_PK   =  '"+IDSPE+"')"
                     " ORDER BY 1,2,5;";

       } else {

 //+         ' SELECT t1.fposp_fpo_code_fk_pk AS NOFIC,     '||
 //+         '       ''0''           AS TYP ,               '||
 //+   '        null           AS INFO_01,            '||
 //+   '        null           AS VALEUR_01,          '||
 //+   '        null           AS VALEUR_02,          '||
 //+   '        null           AS DATE_01             '||
 //+         ' FROM   FPOSP_POSO_SPE t1,FPOTE_FPOSO_TERRAIN   t2 '||
 //+         ' WHERE  t1.FPOSP_SP_CODE_FK_PK  = '||IDSPE||
 //+         ' AND    t1.FPOSP_FPO_CODE_FK_PK = t2.FPOTE_FPO_CODE_FK_PK '||
 //+         ' AND    t2.FPOTE_CDF_TEPO_CODE_FK_PK IN ('||LSTTER||')'||
 //+         ' UNION                            '||
 //+         ' SELECT t1.FPOSP_FPO_CODE_FK_PK    AS NOFIC, '||
 //+         '       ''1''              AS TYP ,       '||
 //+       '        t3.cdf_nom        AS INFO_01,    '||
 //+       '        null     AS VALEUR_01,      '||
 //+       '        null     AS VALEUR_02,      '||
 //+       '        null     AS DATE_01         '||
 //+         ' FROM   FPOSP_POSO_SPE t1,       '||
 //+         '       FPOVO_FPOSO_VOIE t2,CDF_CODIF t3,FPOTE_FPOSO_TERRAIN t4 '||
 //+         ' WHERE  T2.FPOVO_CDF_VO_CODE_FK_PK = T3.CDF_CODE_PK '||
 //+         ' AND    T3.CDF_NUMERO_PK           = ''18''         '||
 //+         ' AND    T2.FPOVO_FPO_CODE_FK_PK    = T1.FPOSP_FPO_CODE_FK_PK   '||
 //+         ' AND    T1.FPOSP_SP_CODE_FK_PK     = '||IDSPE||
 //+         ' AND    T1.FPOSP_FPO_CODE_FK_PK    = T4.FPOTE_FPO_CODE_FK_PK   '||
 //+         ' AND    t4.FPOTE_CDF_TEPO_CODE_FK_PK IN ('||LSTTER||')         '||
 //+         'UNION                           '||
 //+         'SELECT t1.fposp_fpo_code_fk_pk     AS NOFIC,     '||
 //+         '      ''2''                        AS TYP ,      '||
 //+   '       t3.cdf_nom                  AS INFO_01,   '||
 //+   '       t2.fpote_grp_code_pk        AS VALEUR_01, '||
 //+   '       t2.FPOTE_NUMORD             AS VALEUR_02, '||
 //+   '        null                       AS DATE_01    '||
 //+         ' FROM   FPOSP_POSO_SPE t1,FPOTE_FPOSO_TERRAIN t2,CDF_CODIF t3    '||
 //+         ' WHERE  t1.FPOSP_FPO_CODE_FK_PK  = t2.FPOTE_FPO_CODE_FK_PK       '||
 //+         ' AND    t3.CDF_CODE_PK           = t2.FPOTE_CDF_TEPO_CODE_FK_PK  '||
 //+         ' AND    t3.CDF_NUMERO_PK         = ''PT''                        '||
 //+         ' AND    t2.FPOTE_CDF_TEPO_CODE_FK_PK IN ('||LSTTER||')           '||
 //+         ' AND    t1.fposp_sp_code_fk_pk   = '||IDSPE||
 //+         ' UNION                                 '||
 //+         ' SELECT t1.fposp_fpo_code_fk_pk     AS NOFIC,     '||
 //+         '       ''3''                        AS TYP ,      '||
 //+   '        t3.cdf_nom                  AS INFO_01,   '||
 //+   '        null           AS VALEUR_01,          '||
 //+   '        null           AS VALEUR_02,          '||
 //+   '        null           AS DATE_01             '||
 //+         ' FROM  FPOSP_POSO_SPE    t1,                  '||
 //+         '       FPOUT_FPOSO_UTILTH  t2,CDF_CODIF t3,FPOTE_FPOSO_TERRAIN t4   '||
 //+         'WHERE  t1.FPOSP_FPO_CODE_FK_PK  = t2.FPOUT_FPO_CODE_FK_PK           '||
 //+         ' AND    t3.CDF_CODE_PK           = t2.FPOUT_CDF_UTPO_CODE_FK_PK     '||
 //+         ' AND    t3.CDF_NUMERO_PK         = ''NN''                           '||
 //+         ' AND    t1.FPOSP_SP_CODE_FK_PK   = '||IDSPE||
 //+         ' AND    t1.FPOSP_FPO_CODE_FK_PK  = t4.FPOTE_FPO_CODE_FK_PK          '||
 //+         ' AND    t4.FPOTE_CDF_TEPO_CODE_FK_PK IN ('||LSTTER||')              '||
 //+         ' UNION                     '||
 //+         ' SELECT  t1.fposp_fpo_code_fk_pk     AS NOFIC,     '||
 //+         '       ''4''                         AS TYP ,      '||
 //+     '       t3.cdf_nom                    AS INFO_01,   '||
 //+     '       null                          AS VALEUR_01, '||
 //+     '       t2.FPOCOUT_NUM_ORD            AS VALEUR_02, '||
 //+     '       null                          AS DATE_01    '||
 //+         'FROM   FPOSP_POSO_SPE t1,fpocout_fposo_commentutilth t2,CDF_CODIF t3,'||
 //+         '       FPOTE_FPOSO_TERRAIN         t4                                '||
 //+         'WHERE  t1.FPOSP_FPO_CODE_FK_PK  = t2.FPOCOUT_FPO_CODE_FK_PK          '||
 //+         'AND    t3.CDF_CODE_PK           = t2.FPOCOUT_CDF_COUT_CODE_FK_PK     '||
 //+         'AND    t3.CDF_NUMERO_PK         = ''PC''                             '||
 //+         'AND    t1.FPOSP_SP_CODE_FK_PK   = '||IDSPE||
 //+         'AND    t1.FPOSP_FPO_CODE_FK_PK  = t4.FPOTE_FPO_CODE_FK_PK            '||
 //+         'AND    t4.FPOTE_CDF_TEPO_CODE_FK_PK IN ('||LSTTER||')                '||
 //+         'UNION                                       '||
 //+         'SELECT t1.fposp_fpo_code_fk_pk     AS NOFIC,     '||
 //+         '     ''5''                         AS TYP ,      '||
 //+     '     t3.cdf_nom                    AS INFO_01,   '||
 //+     '     null                          AS VALEUR_01, '||
 //+     '     null                          AS VALEUR_02, '||
 //+     '     t2.FPOAFS_DATE_PK             AS DATE_01    '||
 //+         ' FROM  FPOSP_POSO_SPE              t1,  '||
 //+         '       FPOAFS_POSO_AFSSAPS         t2,  '||
 //+         '       CDF_CODIF                   t3,  '||
 //+         '       FPOTE_FPOSO_TERRAIN         t4   '||
 //+         ' WHERE  t1.FPOSP_SP_CODE_FK_PK  = t2.FPOAFS_SP_CODE_FK_PK       '||
 //+         ' AND    t1.FPOSP_FPO_CODE_FK_PK = t2.FPOAFS_FPO_CODE_FK_PK      '||
 //+         ' AND    t3.CDF_CODE_PK           = t2.FPOAFS_CDF_DOCUMENT_FK_PK '||
 //+         ' AND    t3.CDF_NUMERO_PK         = ''25''                       '||
 //+         ' AND    t1.FPOSP_SP_CODE_FK_PK   = '||IDSPE||
 //+         ' AND    t1.FPOSP_FPO_CODE_FK_PK  = t4.FPOTE_FPO_CODE_FK_PK      '||
 //+         ' AND    t4.FPOTE_CDF_TEPO_CODE_FK_PK IN ('||LSTTER||')          '||
 //+         ' AND    t2.FPOAFS_DATE_PK       IN ( SELECT MAX(t2.FPOAFS_DATE_PK)          '||
 //+                                             ' FROM  FPOSP_POSO_SPE              t1,  '||
 //+                                             '       FPOAFS_POSO_AFSSAPS         t2,  '||
 //+                                             '       CDF_CODIF                   t3,  '||
 //+                                             '       FPOTE_FPOSO_TERRAIN         t4   '||
 //+                                             ' WHERE  t1.FPOSP_SP_CODE_FK_PK  = t2.FPOAFS_SP_CODE_FK_PK       '||
 //+                                             ' AND    t1.FPOSP_FPO_CODE_FK_PK = t2.FPOAFS_FPO_CODE_FK_PK      '||
 //+                                             ' AND    t3.CDF_CODE_PK           = t2.FPOAFS_CDF_DOCUMENT_FK_PK '||
 //+                                             ' AND    t3.CDF_NUMERO_PK         = ''25''                       '||
 //+                                             ' AND    t1.FPOSP_SP_CODE_FK_PK   = '||IDSPE||
 //+                                             ' AND    t1.FPOSP_FPO_CODE_FK_PK  = t4.FPOTE_FPO_CODE_FK_PK      '||
 //+                                             ' AND    t4.FPOTE_CDF_TEPO_CODE_FK_PK IN ('||LSTTER||'))         '||
 //+         ' ORDER BY 1,2,5 ' ;
                sql_query += " SELECT t1.FPOSP_FPO_CODE_FK_PK AS NOFIC,"
                     " '0'           AS TYP ,"
                     " NULL           AS INFO_01,"
                     " NULL           AS VALEUR_01,"
                     " NULL           AS VALEUR_02,"
                     " NULL           AS DATE_01"
                     " FROM   fposp_poso_spe t1,fpote_fposo_terrain   t2"
                     " WHERE  t1.FPOSP_SP_CODE_FK_PK  = '"+IDSPE+"'"
                     " AND    t1.FPOSP_FPO_CODE_FK_PK = t2.FPOTE_FPO_CODE_FK_PK"
                     " AND    t2.FPOTE_CDF_TEPO_CODE_FK_PK IN ('"+LSTTER+"')"
                     " UNION"
                     " SELECT t1.FPOSP_FPO_CODE_FK_PK    AS NOFIC,"
                     " '1'              AS TYP ,"
                     " t3.CDF_NOM        AS INFO_01,"
                     " NULL     AS VALEUR_01,"
                     " NULL     AS VALEUR_02,"
                     " NULL     AS DATE_01"
                     " FROM   fposp_poso_spe t1,"
                     " fpovo_fposo_voie t2,CDF_CODIF t3,FPOTE_FPOSO_TERRAIN t4"
                     " WHERE  T2.FPOVO_CDF_VO_CODE_FK_PK = T3.CDF_CODE_PK"
                     " AND    T3.CDF_NUMERO_PK           = '18'"
                     " AND    T2.FPOVO_FPO_CODE_FK_PK    = T1.FPOSP_FPO_CODE_FK_PK"
                     " AND    T1.FPOSP_SP_CODE_FK_PK     = '"+IDSPE+"'"
                     " AND    T1.FPOSP_FPO_CODE_FK_PK    = T4.FPOTE_FPO_CODE_FK_PK"
                     " AND    t4.FPOTE_CDF_TEPO_CODE_FK_PK IN ('"+LSTTER+"')"
                     " UNION"
                     " SELECT t1.fposp_fpo_code_fk_pk     AS NOFIC,"
                     " '2'                        AS TYP ,"
                     " t3.CDF_NOM                  AS INFO_01,"
                     " t2.FPOTE_GRP_CODE_PK        AS VALEUR_01,"
                     " t2.FPOTE_NUMORD             AS VALEUR_02,"
                     " NULL                       AS DATE_01"
                     " FROM   fposp_poso_spe t1,fpote_fposo_terrain t2,cdf_codif t3"
                     " WHERE  t1.FPOSP_FPO_CODE_FK_PK  = t2.FPOTE_FPO_CODE_FK_PK"
                     " AND    t3.CDF_CODE_PK           = t2.FPOTE_CDF_TEPO_CODE_FK_PK"
                     " AND    t3.CDF_NUMERO_PK         = 'PT'"
                     " AND    t2.FPOTE_CDF_TEPO_CODE_FK_PK IN ('"+LSTTER+"')"
                     " AND    t1.fposp_sp_code_fk_pk   = '"+IDSPE+"'"
                     " UNION"
                     " SELECT t1.fposp_fpo_code_fk_pk     AS NOFIC,"
                     " '3'                        AS TYP ,"
                     " t3.CDF_NOM                  AS INFO_01,"
                     " NULL           AS VALEUR_01,"
                     " NULL           AS VALEUR_02,"
                     " NULL           AS DATE_01"
                     " FROM  fposp_poso_spe    t1,"
                     " fpout_fposo_utilth  t2,CDF_CODIF t3,FPOTE_FPOSO_TERRAIN t4"
                     " WHERE  t1.FPOSP_FPO_CODE_FK_PK  = t2.FPOUT_FPO_CODE_FK_PK"
                     " AND    t3.CDF_CODE_PK           = t2.FPOUT_CDF_UTPO_CODE_FK_PK"
                     " AND    t3.CDF_NUMERO_PK         = 'NN'"
                     " AND    t1.FPOSP_SP_CODE_FK_PK   = '"+IDSPE+"'"
                     " AND    t1.FPOSP_FPO_CODE_FK_PK  = t4.FPOTE_FPO_CODE_FK_PK"
                     " AND    t4.FPOTE_CDF_TEPO_CODE_FK_PK IN ('"+LSTTER+"')"
                     " UNION"
                     " SELECT  t1.fposp_fpo_code_fk_pk     AS NOFIC,"
                     " '4'                         AS TYP ,"
                     " t3.CDF_NOM                    AS INFO_01,"
                     " NULL                          AS VALEUR_01,"
                     " t2.FPOCOUT_NUM_ORD            AS VALEUR_02,"
                     " NULL                          AS DATE_01"
                     " FROM   fposp_poso_spe t1,fpocout_fposo_commentutilth t2,cdf_codif t3,"
                     " fpote_fposo_terrain         t4"
                     " WHERE  t1.FPOSP_FPO_CODE_FK_PK  = t2.FPOCOUT_FPO_CODE_FK_PK"
                     " AND    t3.CDF_CODE_PK           = t2.FPOCOUT_CDF_COUT_CODE_FK_PK"
                     " AND    t3.CDF_NUMERO_PK         = 'PC'"
                     " AND    t1.FPOSP_SP_CODE_FK_PK   = '"+IDSPE+"'"
                     " AND    t1.FPOSP_FPO_CODE_FK_PK  = t4.FPOTE_FPO_CODE_FK_PK"
                     " AND    t4.FPOTE_CDF_TEPO_CODE_FK_PK IN ('"+LSTTER+"')"
                     " UNION"
                     " SELECT t1.fposp_fpo_code_fk_pk     AS NOFIC,"
                     " '5'                         AS TYP ,"
                     " t3.CDF_NOM                    AS INFO_01,"
                     " NULL                          AS VALEUR_01,"
                     " NULL                          AS VALEUR_02,"
                     " t2.FPOAFS_DATE_PK             AS DATE_01"
                     " FROM  fposp_poso_spe              t1,"
                     " fpoafs_poso_afssaps         t2,"
                     " cdf_codif                   t3,"
                     " fpote_fposo_terrain         t4"
                     " WHERE  t1.FPOSP_SP_CODE_FK_PK  = t2.FPOAFS_SP_CODE_FK_PK"
                     " AND    t1.FPOSP_FPO_CODE_FK_PK = t2.FPOAFS_FPO_CODE_FK_PK"
                     " AND    t3.CDF_CODE_PK           = t2.FPOAFS_CDF_DOCUMENT_FK_PK"
                     " AND    t3.CDF_NUMERO_PK         = '25'"
                     " AND    t1.FPOSP_SP_CODE_FK_PK   = '"+IDSPE+"'"
                     " AND    t1.FPOSP_FPO_CODE_FK_PK  = t4.FPOTE_FPO_CODE_FK_PK"
                     " AND    t4.FPOTE_CDF_TEPO_CODE_FK_PK IN ('"+LSTTER+"')"
                     " AND    t2.FPOAFS_DATE_PK       IN ( SELECT MAX(t2.FPOAFS_DATE_PK)"
                     " FROM  fposp_poso_spe              t1,"
                     " fpoafs_poso_afssaps         t2,"
                     " cdf_codif                   t3,"
                     " fpote_fposo_terrain         t4"
                     " WHERE  t1.FPOSP_SP_CODE_FK_PK  = t2.FPOAFS_SP_CODE_FK_PK"
                     " AND    t1.FPOSP_FPO_CODE_FK_PK = t2.FPOAFS_FPO_CODE_FK_PK"
                     " AND    t3.CDF_CODE_PK           = t2.FPOAFS_CDF_DOCUMENT_FK_PK"
                     " AND    t3.CDF_NUMERO_PK         = '25'"
                     " AND    t1.FPOSP_SP_CODE_FK_PK   = '"+IDSPE+"'"
                     " AND    t1.FPOSP_FPO_CODE_FK_PK  = t4.FPOTE_FPO_CODE_FK_PK"
                     " AND    t4.FPOTE_CDF_TEPO_CODE_FK_PK IN ('"+LSTTER+"'))"
                     " ORDER BY 1,2,5 ';";

       }
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_POSO() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_MY_NOFIC   = value(0).toString();
                m_TYP        = value(1).toInt();
                m_MY_INFO_01 = value(2).toString();
                m_VALEUR_01  = value(3).toString();
                m_VALEUR_02  = value(4).toString();
                m_DATE_01    = value(5).toDate();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      QString MY_NOFIC()   {return m_MY_NOFIC;}
      int     TYP()        {return m_TYP;}
      QString MY_INFO_01() {return m_MY_INFO_01;}
      QString VALEUR_01()  {return m_VALEUR_01;}
      QString VALEUR_02()  {return m_VALEUR_02;}
      QDate   DATE_01()                         {return m_DATE_01;}
      QString DATE_01(const QString &format)    {return m_DATE_01.toString(format);}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      QString m_MY_NOFIC;
      int     m_TYP;
      QString m_MY_INFO_01;
      QString m_VALEUR_01;
      QString m_VALEUR_02;
      QDate   m_DATE_01;
 };

 //================================== C_GET_THE_POSO_COM_UTI_CUR   -54- ==================================
 /****************************************************************************
 *   Nom           :  GET_THE_POSO_COM_UTI
 -----------------------------------------------------------------------------
 *   Date creation : 30/07/2008
 -----------------------------------------------------------------------------
 *   Description   :  cette procédure renvoie les informations utilisation ,
 *                    manipulation ,elimination et mode d'administration
 *   MAJ           :  12/12/2008
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_POSO_COM_UTI_CUR  C_GET_THE_POSO_COM_UTI ( database(), this );
      while ( C_GET_THE_POSO_COM_UTI.next( IDSPE , TYP  ) )
            { html += tr("<br><b> GET_THE_POSO_COM_UTI : </b>  ") + C_GET_THE_POSO_COM_UTI.MEMBER();
            }
  */
  class C_GET_THE_POSO_COM_UTI_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_POSO_COM_UTI_CUR ---------------------
      C_GET_THE_POSO_COM_UTI_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( double IDSPE , double TYP )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............
       if ( TYP == 1) {

 //+        -- GRP 1 : Commentaire utilisation / manipulation / élimination
 //+        SELECT  DISTINCT frecafs_frec_code_fk_pk AS NOFIC ,
 //+                '1.'||freccor_num_ord_pk         AS GRP,
 //+                cdf_nom                          AS INFO_01,
 //+                NULL                             AS DATE_01,
 //+                NULL                             AS TEXTE
 //+        FROM    FRECAFS_FREC_AFSSAPS             ,
 //+            FRECCOR_FREC_COMRECS             ,
 //+        CDF_CODIF
 //+        WHERE   FRECAFS_SP_CODE_FK_PK   = IDSPE
 //+        AND     FRECCOR_FREC_CODE_FK_PK = FRECAFS_FREC_CODE_FK_PK
 //+        AND     CDF_CODE_PK             = FRECCOR_CDF_COMRECS_FK_PK
 //+        AND     CDF_NUMERO_PK           = 'RC'
 //+        UNION
 //+        -- GRP 2 : Commentaire mode d'administration
 //+        SELECT FREC_CODE_SQ_PK            AS NOFIC ,
 //+     '2.'||FRECCOA_NUM_ORD_PK   AS GRP,
 //+     CDF_NOM                    AS INFO_01,
 //+     NULL                       AS DATE_01,
 //+     NULL                       AS TEXTE
 //+        FROM   FRECSP_RECONST_SPEC ,
 //+           FREC_RECONSADM      ,
 //+         FRECCOA_FREC_COMADM ,
 //+         CDF_CODIF
 //+        WHERE  FRECSP_SP_CODE_FK_PK = IDSPE
 //+        AND    FREC_CODE_SQ_PK = FRECSP_FREC_CODE_FK_PK
 //+        AND    FRECCOA_FREC_CODE_FK_PK = FREC_CODE_SQ_PK
 //+        AND    CDF_CODE_PK = FRECCOA_CDF_COMADM_FK_PK
 //+        AND    CDF_NUMERO_PK = 'RC'
 //+        UNION
 //+        -- GRP 3 : Référence officielle
 //+        SELECT FRECAFS_FREC_CODE_FK_PK   AS NOFIC ,
 //+     '3'                       AS GRP,
 //+     CDF_NOM                   AS INFO_01,
 //+     FRECAFS_DATE_PK           AS DATE_01,
 //+     NULL                      AS TEXTE
 //+        FROM   FRECSP_RECONST_SPEC,
 //+           FRECAFS_FREC_AFSSAPS,
 //+         CDF_CODIF
 //+        WHERE  FRECSP_SP_CODE_FK_PK    = IDSPE
 //+        AND    FRECAFS_FREC_CODE_FK_PK = FRECSP_FREC_CODE_FK_PK
 //+        AND    FRECAFS_SP_CODE_FK_PK   = FRECSP_SP_CODE_FK_PK
 //+        AND    FRECAFS_DATE_PK         =(SELECT MAX(FRECAFS_DATE_PK)
 //+                                   FROM   FRECSP_RECONST_SPEC,
 //+                            FRECAFS_FREC_AFSSAPS
 //+                                   WHERE  FRECSP_SP_CODE_FK_PK    = IDSPE
 //+                                   AND    FRECAFS_FREC_CODE_FK_PK = FRECSP_FREC_CODE_FK_PK)
 //+        AND    CDF_CODE_PK             = FRECAFS_CDF_DOCUMENT_FK_PK
 //+        AND    CDF_NUMERO_PK           = '25'
 //+        ORDER BY 1,2 ;
                sql_query +=
                     " SELECT  DISTINCT frecafs_frec_code_fk_pk AS NOFIC ,"
                     " '1.'FRECCOR_NUM_ORD_PK         AS GRP,"
                     " CDF_NOM                          AS INFO_01,"
                     " NULL                             AS DATE_01,"
                     " NULL                             AS TEXTE"
                     " FROM    frecafs_frec_afssaps             ,"
                     " freccor_frec_comrecs             ,"
                     " cdf_codif"
                     " WHERE   FRECAFS_SP_CODE_FK_PK    = '"+ QString::number( IDSPE ) +"'"
                     " AND     FRECCOR_FREC_CODE_FK_PK = FRECAFS_FREC_CODE_FK_PK"
                     " AND     CDF_CODE_PK             = FRECCOR_CDF_COMRECS_FK_PK"
                     " AND     CDF_NUMERO_PK           = 'RC'"
                     " UNION"
                     " "  //-- GRP 2 : Commentaire mode d'administration"
                     " SELECT FREC_CODE_SQ_PK            AS NOFIC ,"
                     " '2.'FRECCOA_NUM_ORD_PK   AS GRP,"
                     " CDF_NOM                    AS INFO_01,"
                     " NULL                       AS DATE_01,"
                     " NULL                       AS TEXTE"
                     " FROM   frecsp_reconst_spec ,"
                     " frec_reconsadm      ,"
                     " freccoa_frec_comadm ,"
                     " cdf_codif"
                     " WHERE  FRECSP_SP_CODE_FK_PK  = '"+ QString::number( IDSPE ) +"'"
                     " AND    FREC_CODE_SQ_PK = FRECSP_FREC_CODE_FK_PK"
                     " AND    FRECCOA_FREC_CODE_FK_PK = FREC_CODE_SQ_PK"
                     " AND    CDF_CODE_PK = FRECCOA_CDF_COMADM_FK_PK"
                     " AND    CDF_NUMERO_PK = 'RC'"
                     " UNION"
                     " "  //-- GRP 3 : Référence officielle"
                     " SELECT FRECAFS_FREC_CODE_FK_PK   AS NOFIC ,"
                     " '3'                       AS GRP,"
                     " CDF_NOM                   AS INFO_01,"
                     " FRECAFS_DATE_PK           AS DATE_01,"
                     " NULL                      AS TEXTE"
                     " FROM   frecsp_reconst_spec,"
                     " frecafs_frec_afssaps,"
                     " cdf_codif"
                     " WHERE  FRECSP_SP_CODE_FK_PK     = '"+ QString::number( IDSPE ) +"'"
                     " AND    FRECAFS_FREC_CODE_FK_PK = FRECSP_FREC_CODE_FK_PK"
                     " AND    FRECAFS_SP_CODE_FK_PK   = FRECSP_SP_CODE_FK_PK"
                     " AND    FRECAFS_DATE_PK         =(SELECT MAX(FRECAFS_DATE_PK)"
                     " FROM   frecsp_reconst_spec,"
                     " frecafs_frec_afssaps"
                     " WHERE  FRECSP_SP_CODE_FK_PK     = '"+ QString::number( IDSPE ) +"'"
                     " AND    FRECAFS_FREC_CODE_FK_PK = FRECSP_FREC_CODE_FK_PK)"
                     " AND    CDF_CODE_PK             = FRECAFS_CDF_DOCUMENT_FK_PK"
                     " AND    CDF_NUMERO_PK           = '25'"
                     " ORDER BY 1,2 ;";

       } else if ( TYP == 3) {

 //+     SELECT FREC_CODE_SQ_PK       AS NOFIC ,
 //+                 NULL                  AS GRP   ,
 //+                 NULL                  AS INFO_01,
 //+                 NULL                  AS DATE_01,
 //+                 FRECTXR_TXTRECS       AS TEXTE
 //+          FROM   FRECSP_RECONST_SPEC   ,
 //+                 FREC_RECONSADM        ,
 //+                 FRECTXR_FREC_TXTRECS
 //+          WHERE  FRECSP_SP_CODE_FK_PK    = IDSPE
 //+          AND    FREC_CODE_SQ_PK         = FRECSP_FREC_CODE_FK_PK
 //+          AND    FRECTXR_FREC_CODE_FK_PK = FREC_CODE_SQ_PK ;
                sql_query += " SELECT FREC_CODE_SQ_PK       AS NOFIC ,"
                     " NULL                  AS GRP   ,"
                     " NULL                  AS INFO_01,"
                     " NULL                  AS DATE_01,"
                     " FRECTXR_TXTRECS       AS TEXTE"
                     " FROM   frecsp_reconst_spec   ,"
                     " frec_reconsadm        ,"
                     " frectxr_frec_txtrecs"
                     " WHERE  FRECSP_SP_CODE_FK_PK     = '"+ QString::number( IDSPE ) +"'"
                     " AND    FREC_CODE_SQ_PK         = FRECSP_FREC_CODE_FK_PK"
                     " AND    FRECTXR_FREC_CODE_FK_PK = FREC_CODE_SQ_PK ;";

       } else if ( TYP == 2) {

 //+    SELECT FREC_CODE_SQ_PK    AS NOFIC ,
 //+      NULL               AS GRP   ,
 //+      NULL               AS INFO_01,
 //+      NULL               AS DATE_01,
 //+      FRECTXA_TXTADM     AS TEXTE
 //+   FROM   FRECSP_RECONST_SPEC,
 //+      FREC_RECONSADM     ,
 //+      FRECTXA_FREC_TXTADM
 //+   WHERE  FRECSP_SP_CODE_FK_PK     = IDSPE
 //+   AND    FREC_CODE_SQ_PK          = FRECSP_FREC_CODE_FK_PK
 //+   AND    FRECTXA_FREC_CODE_FK_PK  = FREC_CODE_SQ_PK;
                sql_query += " SELECT FREC_CODE_SQ_PK    AS NOFIC ,"
                     " NULL               AS GRP   ,"
                     " NULL               AS INFO_01,"
                     " NULL               AS DATE_01,"
                     " FRECTXA_TXTADM     AS TEXTE"
                     " FROM   frecsp_reconst_spec,"
                     " frec_reconsadm     ,"
                     " frectxa_frec_txtadm"
                     " WHERE  FRECSP_SP_CODE_FK_PK      = '"+ QString::number( IDSPE ) +"'"
                     " AND    FREC_CODE_SQ_PK          = FRECSP_FREC_CODE_FK_PK"
                     " AND    FRECTXA_FREC_CODE_FK_PK  = FREC_CODE_SQ_PK;";

       }
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_POSO_COM_UTI() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_MY_NOFIC = value(0).toString();
                m_GRP      = value(1).toString();
                m_INFO_01  = value(2).toString();
                m_DATE_01  = value(3).toString();
                m_TEXTE    = value(4).toString();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      QString MY_NOFIC() {return m_MY_NOFIC;}
      QString GRP()      {return m_GRP;}
      QString INFO_01()  {return m_INFO_01;}
      QString DATE_01()  {return m_DATE_01;}
      QString TEXTE()    {return m_TEXTE;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      QString m_MY_NOFIC;
      QString m_GRP;
      QString m_INFO_01;
      QString m_DATE_01;
      QString m_TEXTE;
 };

 //================================== C_GET_THE_POSO_TEXT_CUR   -55- ==================================
 /****************************************************************************
 *   Nom           :  GET_THE_POSO_TEXT
 -----------------------------------------------------------------------------
 *   Date creation : 31/07/2008
 -----------------------------------------------------------------------------
 *   Description   :  cette procédure renvoie pour une fiche posologique donnée
 *                    ou une liste de fiche posologique ,le texte posologique associé
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_POSO_TEXT_CUR  C_GET_THE_POSO_TEXT ( database(), this );
      while ( C_GET_THE_POSO_TEXT.next( LSTIDPOS  ) )
            { html += tr("<br><b> GET_THE_POSO_TEXT : </b>  ") + C_GET_THE_POSO_TEXT.MEMBER();
            }
  */
  class C_GET_THE_POSO_TEXT_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_POSO_TEXT_CUR ---------------------
      C_GET_THE_POSO_TEXT_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( QString LSTIDPOS )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";
                //............. zone de construction de la requete DEBUT ...............
                sql_query +=
                     " SELECT FPO_CODE_SQ_PK AS NOFIC,"
                     " FPO_DATECR AS DATE_01,"
                     " FPO_DATEMJ AS DATE_02,"
                     " FPO_TEXTE  AS TEXTE"
                     " FROM   fpo_ficheposo"
                     " WHERE  FPO_CODE_SQ_PK IN ('"+LSTIDPOS+"');";
                //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_POSO_TEXT() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_MY_NOFIC = value(0).toString();
                m_DATE_01  = value(1).toDate();
                m_DATE_02  = value(2).toDate();
                m_TEXTE    = value(3).toString();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      QString MY_NOFIC() {return m_MY_NOFIC;}
      QDate   DATE_01()  {return m_DATE_01;}
      QDate   DATE_02()  {return m_DATE_02;}
      QString TEXTE()    {return m_TEXTE;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      QString m_MY_NOFIC;
      QDate   m_DATE_01;
      QDate   m_DATE_02;
      QString m_TEXTE;
 };

 //================================== C_GET_THE_DET_POSO_SPE_CUR   -56- ==================================
 /**********************************************************************************
 *   Nom           :  GET_THE_DET_POSO_SPE
 -------------------------------------------------------------------------------------
 *   Date creation : 04/08/2008
 -------------------------------------------------------------------------------------
 *   Description   :  cette procédure affiche les détails des posologies par specialite
 *   MAJ           :  18/12/2008 - Anis
                   :  05/02/2009 - Mourad
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_DET_POSO_SPE_CUR  C_GET_THE_DET_POSO_SPE ( database(), this );
      while ( C_GET_THE_DET_POSO_SPE.next( CODE , TYP  ) )
            { html += tr("<br><b> GET_THE_DET_POSO_SPE : </b>  ") + C_GET_THE_DET_POSO_SPE.MEMBER();
            }
  */
  class C_GET_THE_DET_POSO_SPE_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_DET_POSO_SPE_CUR ---------------------
      C_GET_THE_DET_POSO_SPE_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( QString CODE , int TYP )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............
       if ( TYP == 1) {    // --- recherche des details posologies selon LE CODE SPECIALITE
                sql_query +=
                     " SELECT  DISTINCT IPOCOTE_IPO_CODE_FK_PK    AS NOFIC,"
                     " CONCAT('1.',IPO_NUM_ORD, '.0.',IPOCOTE_NUM_ORD_PK)     AS GRP,"
                     " NULL                          AS NATURE,"
                     " CDF_NOM                       AS INFO_01,"
                     " NULL                          AS MINI,"
                     " NULL                          AS INFO_02,"
                     " NULL                          AS MAXI,"
                     " NULL                          AS INFO_03"
                     " FROM   ipocote_infpo_comment_terrain ,"
                     " fposp_poso_spe                ,"
                     " cdf_codif                     ,"
                     " ipo_infoposo"
                     " WHERE IPOCOTE_IPO_CODE_FK_PK      = FPOSP_FPO_CODE_FK_PK"
                     " AND   IPOCOTE_CDF_COTE_CODE_FK_PK = CDF_CODE_PK"
                     " AND   CDF_NUMERO_PK             = 'PC'"
                     " AND   IPO_FPO_CODE_FK_PK        = IPOCOTE_IPO_CODE_FK_PK"
                     " AND   IPOCOTE_IPO_NUM_SEQ_FK_PK = IPO_NUM_SEQ_PK"
                     " AND   FPOSP_SP_CODE_FK_PK       = '"+ CODE  +"'"
                     " UNION"
                     " "  //--- minimum et maximum de la posologie"
                     " SELECT DISTINCT t1.IPO_FPO_CODE_FK_PK   AS NOFIC,"
                     " CONCAT('1.',IPO_NUM_ORD,'.1.0')    AS GRP,"
                     " t2.CDF_NOM              AS NATURE,"
                     " NULL                    AS INFO_01,"
                     " t1.IPO_DOSEMIN          AS MINI,"
                     " t3.CDF_NOM              AS INFO_02,"
                     " t1.IPO_DOSEMAX          AS MAXI,"
                     " NULL                    AS INFO_03"
                     " FROM    ipo_infoposo    t1,"
                     " cdf_codif       t2,"
                     " cdf_codif       t3,"
                     " fposp_poso_spe  t4"
                     " WHERE   t1.IPO_FPO_CODE_FK_PK       = t4.FPOSP_FPO_CODE_FK_PK"
                     " AND     t1.IPO_CDF_NAPO_CODE_FK     = t2.CDF_CODE_PK"
                     " AND     t2.CDF_NUMERO_PK            = 'PN'"
                     " AND     t1.IPO_CDF_UNPO_CODE_FK     = t3.CDF_CODE_PK"
                     " AND     t3.CDF_NUMERO_PK            = 'PP'"
                     " AND     (t1.IPO_DOSEMIN IS NOT NULL OR t1.IPO_DOSEMAX IS NOT NULL)"
                     " AND     t4.FPOSP_SP_CODE_FK_PK      = '"+  CODE  +"'"
                     " UNION"
                     " "  //--- frequence minimum et maximum"
                     " SELECT DISTINCT t1.IPO_FPO_CODE_FK_PK   AS NOFIC,"
                     " CONCAT('1.',IPO_NUM_ORD,'.2.0')       AS GRP,"
                     " NULL                    AS NATURE,"
                     " NULL                    AS INFO_01,"
                     " t1.IPO_FREQMIN          AS MINI,"
                     " t2.CDF_NOM              AS INFO_02,"
                     " t1.IPO_FREQMAX          AS MAXI,"
                     " t3.CDF_NOM              AS INFO_03"
                     " FROM    ipo_infoposo            t1,"
                     " cdf_codif                 t2,"
                     " cdf_codif                 t3,"
                     " fposp_poso_spe                 t4"
                     " WHERE   t1.IPO_FPO_CODE_FK_PK          = t4.FPOSP_FPO_CODE_FK_PK"
                     " AND     t1.IPO_CDF_FREQMIN_CODE_FK     = t2.CDF_CODE_PK"
                     " AND     t2.CDF_NUMERO_PK            = 'PF'"
                     " AND     t1.IPO_CDF_FREQMAX_CODE_FK     = t3.CDF_CODE_PK"
                     " AND     t3.CDF_NUMERO_PK            = 'PF'"
                     " AND     (t1.IPO_FREQMIN IS NOT NULL OR t1.IPO_FREQMAX IS NOT NULL)"
                     " AND     t4.FPOSP_SP_CODE_FK_PK          = '"+  CODE  +"'"
                     " UNION"
                     " "  //--- commentaire frequence"
                     " SELECT   DISTINCT IPOCOFQ_IPO_CODE_FK_PK  AS NOFIC,"
                     " CONCAT('1.',IPO_NUM_ORD,'.2.1.',IPOCOFQ_NUM_ORD_PK)   AS GRP,"
                     " NULL                             AS NATURE,"
                     " CDF_NOM                          AS INFO_01,"
                     " NULL                             AS MINI,"
                     " NULL                             AS INFO_02,"
                     " NULL                             AS MAXI,"
                     " NULL                             AS INFO_03"
                     " FROM   ipocofq_infpo_comment_freq      ,"
                     " fposp_poso_spe                  ,"
                     " cdf_codif                       ,"
                     " ipo_infoposo"
                     " WHERE  IPOCOFQ_IPO_CODE_FK_PK      = FPOSP_FPO_CODE_FK_PK"
                     " AND    IPOCOFQ_CDF_COFQ_CODE_FK_PK = CDF_CODE_PK"
                     " AND    CDF_NUMERO_PK               = 'PC'"
                     " AND    IPO_FPO_CODE_FK_PK          = IPOCOFQ_IPO_CODE_FK_PK"
                     " AND    IPOCOFQ_IPO_NUM_SEQ_FK_PK   = IPO_NUM_SEQ_PK"
                     " AND    FPOSP_SP_CODE_FK_PK         = '"+  CODE  +"'"
                     " UNION"
                     " "  //--- durée minimum et durée maximum"
                     " SELECT DISTINCT t1.IPO_FPO_CODE_FK_PK  AS NOFIC,"
                     " CONCAT('1.',IPO_NUM_ORD,'.2.2')      AS GRP,"
                     " NULL                           AS NATURE,"
                     " NULL                           AS INFO_01,"
                     " (t1.IPO_DUREEMIN)       AS MINI, "  //-- removing TO_CHAR  may bee replace by ?  lpad(format(i, 0), 4, '0') ou CAST(nombre as char) "
                     " t2.CDF_NOM                     AS INFO_02,"
                     " (t1.IPO_DUREEMAX)       AS MAXI, "  //-- removing TO_CHAR  may bee replace by ?  lpad(format(i, 0), 4, '0') ou CAST(nombre as char) "
                     " t3.CDF_NOM                     AS INFO_03"
                     " FROM    ipo_infoposo            t1,"
                     " cdf_codif                 t2,"
                     " cdf_codif                 t3,"
                     " fposp_poso_spe                t4"
                     " WHERE   t1.IPO_FPO_CODE_FK_PK          = t4.FPOSP_FPO_CODE_FK_PK"
                     " AND     t1.IPO_CDF_UTMIN_CODE_FK       = t2.CDF_CODE_PK"
                     " AND     t2.CDF_NUMERO_PK            = 'PU'"
                     " AND     t1.IPO_CDF_UTMAX_CODE_FK       = t3.CDF_CODE_PK"
                     " AND     t3.CDF_NUMERO_PK            = 'PU'"
                     " AND     (t1.IPO_DUREEMIN IS NOT NULL OR t1.IPO_DUREEMAX IS NOT NULL)"
                     " AND     t4.FPOSP_SP_CODE_FK_PK          = '"+  CODE  +"'"
                     " UNION"
                     " "  //--- commentaire durée"
                     " SELECT DISTINCT IPOCOD_IPO_CODE_FK_PK   AS NOFIC ,"
                     " CONCAT('1.',IPO_NUM_ORD,'.3.',IPOCOD_NUM_ORD_PK)      AS GRP,"
                     " NULL                             AS NATURE,"
                     " CDF_NOM                          AS INFO_01,"
                     " NULL                             AS MINI,"
                     " NULL                             AS INFO_02,"
                     " NULL                             AS MAXI,"
                     " NULL                             AS INFO_03"
                     " FROM   ipocod_infpo_comment_duree      ,"
                     " fposp_poso_spe                  ,"
                     " cdf_codif  ,"
                     " ipo_infoposo"
                     " WHERE  IPOCOD_IPO_CODE_FK_PK       = FPOSP_FPO_CODE_FK_PK"
                     " AND    IPOCOD_CDF_COD_CODE_FK_PK   = CDF_CODE_PK"
                     " AND    CDF_NUMERO_PK            = 'PC'"
                     " AND    IPOCOD_IPO_NUM_SEQ_FK_PK  = IPO_NUM_SEQ_PK"
                     " AND    IPO_FPO_CODE_FK_PK         = IPOCOD_IPO_CODE_FK_PK"
                     " AND    FPOSP_SP_CODE_FK_PK          = '"+  CODE  +"'"
                     " UNION"
                     " "  //--- Commentaire Adaptation"
                     " SELECT DISTINCT FPOCOAD_FPO_CODE_FK_PK  AS NOFIC,"
                     " CONCAT('2.0.1.',FPOCOAD_NUM_ORD_PK)     AS GRP,"
                     " NULL                             AS NATURE,"
                     " CDF_NOM                          AS INFO_01,"
                     " NULL                             AS MINI,"
                     " NULL                             AS INFO_02,"
                     " NULL                             AS MAXI,"
                     " NULL                             AS INFO_03"
                     " FROM   fpocoad_fposo_comment_adapt     ,"
                     " fposp_poso_spe                  ,"
                     " cdf_codif                       ,"
                     " ipo_infoposo"
                     " WHERE  FPOCOAD_FPO_CODE_FK_PK      = FPOSP_FPO_CODE_FK_PK"
                     " AND    IPO_FPO_CODE_FK_PK          = FPOSP_FPO_CODE_FK_PK"
                     " AND    FPOCOAD_CDF_COAD_CODE_FK_PK = CDF_CODE_PK"
                     " AND    CDF_NUMERO_PK            = 'PC'"
                     " AND    FPOSP_SP_CODE_FK_PK          = '"+  CODE  +"'"
                     " UNION"
                     " "  //--- Commentaire surveillance"
                     " SELECT DISTINCT FPOCOSU_FPO_CODE_FK_PK   AS NOFIC,"
                     " CONCAT('2.1.1.',FPOCOSU_NUM_ORD_PK)      AS GRP,"
                     " NULL                              AS NATURE,"
                     " CDF_NOM                           AS INFO_01,"
                     " NULL                              AS MINI,"
                     " NULL                              AS INFO_02,"
                     " NULL                              AS MAXI,"
                     " NULL                              AS INFO_03"
                     " FROM   fpocosu_fposo_comment_surveil   ,"
                     " fposp_poso_spe                  ,"
                     " cdf_codif                       ,"
                     " ipo_infoposo"
                     " WHERE  FPOCOSU_FPO_CODE_FK_PK      = FPOSP_FPO_CODE_FK_PK"
                     " AND    IPO_FPO_CODE_FK_PK          = FPOSP_FPO_CODE_FK_PK"
                     " AND    FPOCOSU_CDF_COSU_CODE_FK_PK = CDF_CODE_PK"
                     " AND    CDF_NUMERO_PK            = 'PC'"
                     " AND    FPOSP_SP_CODE_FK_PK          = '"+  CODE  +"'"
                     " "  //--- Commentaire recommandation"
                     " UNION"
                     " SELECT DISTINCT FPOCOAU_FPO_CODE_FK_PK   AS NOFIC,"
                     " CONCAT('2.2.1.',FPOCOAU_NUM_ORD_PK)      AS GRP,"
                     " NULL                              AS NATURE,"
                     " CDF_NOM                           AS INFO_01,"
                     " NULL                              AS MINI,"
                     " NULL                              AS INFO_02,"
                     " NULL                              AS MAXI,"
                     " NULL                              AS INFO_03"
                     " FROM   fpocoau_fposo_comment_autre     ,"
                     " fposp_poso_spe                  ,"
                     " cdf_codif                       ,"
                     " ipo_infoposo"
                     " WHERE  FPOCOAU_FPO_CODE_FK_PK      = FPOSP_FPO_CODE_FK_PK"
                     " AND    IPO_FPO_CODE_FK_PK         = FPOSP_FPO_CODE_FK_PK"
                     " AND    FPOCOAU_CDF_COAU_CODE_FK_PK = CDF_CODE_PK"
                     " AND    CDF_NUMERO_PK            = 'PC'"
                     " AND    FPOSP_SP_CODE_FK_PK          = '"+ CODE  +"'"
                     " ORDER BY 1,2;";

       } else if ( TYP == 2) {       // --- recherche des details posologies selon LE CODE FICHE POSOLOGIE
                sql_query +=
                     // --- complement nature de dose                                  1.N°.0.IPOCOTE_NUM_ORD_PK
                     " SELECT DISTINCT IPOCOTE_IPO_CODE_FK_PK   AS NOFIC,"
                     " CONCAT('1.',IPO_NUM_ORD,'.0.',IPOCOTE_NUM_ORD_PK)  AS GRP,"
                     " NULL                              AS NATURE,"
                     " CDF_NOM                           AS INFO_01,"
                     " NULL                              AS MINI,"
                     " NULL                              AS INFO_02,"
                     " NULL                              AS MAXI,"
                     " NULL                              AS INFO_03"
                     " FROM   ipocote_infpo_comment_terrain ,"
                     " cdf_codif  ,"
                     " ipo_infoposo"
                     " WHERE  IPOCOTE_CDF_COTE_CODE_FK_PK = CDF_CODE_PK"
                     " AND    CDF_NUMERO_PK            = 'PC'"
                     " AND    IPO_FPO_CODE_FK_PK          = IPOCOTE_IPO_CODE_FK_PK"
                     " AND    IPOCOTE_IPO_NUM_SEQ_FK_PK   = IPO_NUM_SEQ_PK"
                     " AND    IPOCOTE_IPO_CODE_FK_PK       = '"+  CODE  +"'"
                     " UNION"
                     " "  //--- minimum et maximum de la posologie                   1.N°.1.0
                     " SELECT DISTINCT t1.IPO_FPO_CODE_FK_PK   AS NOFIC,"
                     " CONCAT('1.',IPO_NUM_ORD,'.1.0')   AS GRP,"
                     " t2.CDF_NOM              AS NATURE,"
                     " NULL                    AS INFO_01,"
                     " t1.IPO_DOSEMIN          AS MINI,"
                     " t3.CDF_NOM              AS INFO_02,"
                     " t1.IPO_DOSEMAX          AS MAXI,"
                     " NULL                    AS INFO_03"
                     " FROM    ipo_infoposo    t1,"
                     " cdf_codif       t2,"
                     " cdf_codif       t3"
                     " WHERE   t1.IPO_CDF_NAPO_CODE_FK     = t2.CDF_CODE_PK"
                     " AND     t2.CDF_NUMERO_PK         = 'PN'"
                     " AND     t1.IPO_CDF_UNPO_CODE_FK     = t3.CDF_CODE_PK"
                     " AND     t3.CDF_NUMERO_PK         = 'PP'"
                     " AND     (t1.IPO_DOSEMIN IS NOT NULL OR t1.IPO_DOSEMAX IS NOT NULL)"
                     " AND     t1.IPO_FPO_CODE_FK_PK        = '"+  CODE  +"'"
                     " UNION"
                     " "  //--- frequence minimum et maximum                      1.N°.2.0
                     " SELECT DISTINCT t1.IPO_FPO_CODE_FK_PK   AS NOFIC,"
                     " CONCAT('1.',IPO_NUM_ORD,'.2.0')   AS GRP,"
                     " NULL                    AS NATURE,"
                     " NULL                    AS INFO_01,"
                     " t1.IPO_FREQMIN          AS MINI,"
                     " t2.CDF_NOM              AS INFO_02,"
                     " t1.IPO_FREQMAX          AS MAXI,"
                     " t3.CDF_NOM              AS INFO_03"
                     " FROM    ipo_infoposo            t1,"
                     " cdf_codif                 t2,"
                     " cdf_codif                 t3"
                     " WHERE   t1.IPO_CDF_FREQMIN_CODE_FK     = t2.CDF_CODE_PK"
                     " AND     t2.CDF_NUMERO_PK            = 'PF'"
                     " AND     t1.IPO_CDF_FREQMAX_CODE_FK     = t3.CDF_CODE_PK"
                     " AND     t3.CDF_NUMERO_PK            = 'PF'"
                     " AND     (t1.IPO_FREQMIN IS NOT NULL OR t1.IPO_FREQMAX IS NOT NULL)"
                     " AND     t1.IPO_FPO_CODE_FK_PK           = '"+  CODE  +"'"
                     " UNION"
                     " "  //--- commentaire frequence                           1.N°.2.1
                     " SELECT DISTINCT IPOCOFQ_IPO_CODE_FK_PK   AS NOFIC,"
                     " CONCAT('1.',IPO_NUM_ORD,'.2.1.',IPOCOFQ_NUM_ORD_PK)   AS GRP,"
                     " NULL                              AS NATURE,"
                     " CDF_NOM                           AS INFO_01,"
                     " NULL                              AS MINI,"
                     " NULL                              AS INFO_02,"
                     " NULL                              AS MAXI,"
                     " NULL                              AS INFO_03"
                     " FROM   ipocofq_infpo_comment_freq      ,"
                     " cdf_codif  ,"
                     " ipo_infoposo"
                     " WHERE  IPOCOFQ_CDF_COFQ_CODE_FK_PK = CDF_CODE_PK"
                     " AND    CDF_NUMERO_PK            = 'PC'"
                     " AND    IPOCOFQ_IPO_NUM_SEQ_FK_PK   = IPO_NUM_SEQ_PK"
                     " AND    IPO_FPO_CODE_FK_PK          = IPOCOFQ_IPO_CODE_FK_PK"
                     " AND    IPOCOFQ_IPO_CODE_FK_PK       = '"+  CODE  +"'"
                     " UNION"
                     " "  //--- durée minimum et durée maximum               1.N°.2.2
                     " SELECT DISTINCT t1.IPO_FPO_CODE_FK_PK   AS NOFIC,"
                     " CONCAT('1.',IPO_NUM_ORD,'.2.2')      AS GRP,"
                     " NULL                      AS NATURE,"
                     " NULL                      AS INFO_01,"
                     " (t1.IPO_DUREEMIN)         AS MINI, "  //-- removing TO_CHAR  may bee replace by ?  lpad(format(i, 0), 4, '0') ou CAST(nombre as char) ou CAST(nombre as char)"
                     " t2.CDF_NOM                AS INFO_02,"
                     " (t1.IPO_DUREEMAX)         AS MAXI, "  //-- removing TO_CHAR  may bee replace by ?  lpad(format(i, 0), 4, '0') ou CAST(nombre as char) "
                     " t3.CDF_NOM                AS INFO_03"
                     " FROM    ipo_infoposo            t1,"
                     " cdf_codif                 t2,"
                     " cdf_codif                 t3"
                     " WHERE   t1.IPO_CDF_UTMIN_CODE_FK       = t2.CDF_CODE_PK"
                     " AND     t2.CDF_NUMERO_PK            = 'PU'"
                     " AND     t1.IPO_CDF_UTMAX_CODE_FK       = t3.CDF_CODE_PK"
                     " AND     t3.CDF_NUMERO_PK            = 'PU'"
                     " AND     (t1.IPO_DUREEMIN IS NOT NULL OR t1.IPO_DUREEMAX IS NOT NULL)"
                     " AND     t1.IPO_FPO_CODE_FK_PK           = '"+  CODE  +"'"
                     " UNION"
                     " "  //--- commentaire durée                                    1.N°.3.IPOCOD_NUM_ORD_PK
                     " SELECT DISTINCT IPOCOD_IPO_CODE_FK_PK   AS NOFIC,"
                     " CONCAT('1.',IPO_NUM_ORD,'.3.',IPOCOD_NUM_ORD_PK)  AS GRP,"
                     " NULL                             AS NATURE,"
                     " CDF_NOM                          AS INFO_01,"
                     " NULL                             AS MINI,"
                     " NULL                             AS INFO_02,"
                     " NULL                             AS MAXI,"
                     " NULL                             AS INFO_03"
                     " FROM   ipocod_infpo_comment_duree      ,"
                     " cdf_codif  ,"
                     " ipo_infoposo"
                     " WHERE  IPOCOD_CDF_COD_CODE_FK_PK   = CDF_CODE_PK"
                     " AND    CDF_NUMERO_PK            = 'PC'"
                     " AND    IPO_FPO_CODE_FK_PK          = IPOCOD_IPO_CODE_FK_PK"
                     " AND    IPOCOD_IPO_NUM_SEQ_FK_PK    = IPO_NUM_SEQ_PK"
                     " AND    IPOCOD_IPO_CODE_FK_PK        = '"+  CODE  +"'"
                     " UNION"
                     " "  //--- Commentaire Adaptation                          2.0.1.FPOCOAD_NUM_ORD_PK
                     " SELECT DISTINCT FPOCOAD_FPO_CODE_FK_PK   AS NOFIC,"
                     " CONCAT('2.0.1.',FPOCOAD_NUM_ORD_PK)      AS GRP,"
                     " NULL                              AS NATURE,"
                     " CDF_NOM                           AS INFO_01,"
                     " NULL                              AS MINI,"
                     " NULL                              AS INFO_02,"
                     " NULL                              AS MAXI,"
                     " NULL                              AS INFO_03"
                     " FROM   fpocoad_fposo_comment_adapt     ,"
                     " cdf_codif"
                     " WHERE  FPOCOAD_CDF_COAD_CODE_FK_PK = CDF_CODE_PK"
                     " AND    CDF_NUMERO_PK            = 'PC'"
                     " AND    FPOCOAD_FPO_CODE_FK_PK       = '"+  CODE  +"'"
                     " UNION"
                     " "  //--- Commentaire surveillance                         2.1.1.FPOCOSU_NUM_ORD_PK
                     " SELECT DISTINCT FPOCOSU_FPO_CODE_FK_PK AS NOFIC,"
                     " CONCAT('2.1.1.',FPOCOSU_NUM_ORD_PK)      AS GRP,"
                     " NULL                            AS NATURE,"
                     " CDF_NOM                         AS INFO_01,"
                     " NULL                            AS MINI,"
                     " NULL                            AS INFO_02,"
                     " NULL                            AS MAXI,"
                     " NULL                            AS INFO_03"
                     " FROM   fpocosu_fposo_comment_surveil   ,"
                     " cdf_codif"
                     " WHERE  FPOCOSU_CDF_COSU_CODE_FK_PK = CDF_CODE_PK"
                     " AND    CDF_NUMERO_PK              = 'PC'"
                     " AND    FPOCOSU_FPO_CODE_FK_PK       = '"+  CODE  +"'"
                     " "  //--- Commentaire recommandation                        2.2.1.FPOCOAU_NUM_ORD_PK
                     " UNION"
                     " SELECT DISTINCT FPOCOAU_FPO_CODE_FK_PK  AS NOFIC,"
                     " CONCAT('2.2.1.',FPOCOAU_NUM_ORD_PK)       AS GRP,"
                     " NULL                             AS NATURE,"
                     " CDF_NOM                          AS INFO_01,"
                     " NULL                             AS MINI,"
                     " NULL                             AS INFO_02,"
                     " NULL                             AS MAXI,"
                     " NULL                             AS INFO_03"
                     " FROM   fpocoau_fposo_comment_autre     ,"
                     " cdf_codif"
                     " WHERE  FPOCOAU_CDF_COAU_CODE_FK_PK = CDF_CODE_PK"
                     " AND    CDF_NUMERO_PK               = 'PC'"
                     " AND    FPOCOAU_FPO_CODE_FK_PK      = '"+  CODE  +"'"
                     " ORDER BY 1,2;";
       }
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_DET_POSO_SPE() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_MY_NOFIC = value(0).toString();
                m_GRP      = value(1).toString();
                m_NATURE   = value(2).toString();
                m_INFO_01  = value(3).toString();
                m_MINI     = value(4).toString();
                m_INFO_02  = value(5).toString();
                m_MAXI     = value(6).toString();
                m_INFO_03  = value(7).toString();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      QString MY_NOFIC() {return m_MY_NOFIC;}
      QString GRP()      {return m_GRP;}
      QString NATURE()   {return m_NATURE;}
      QString INFO_01()  {return m_INFO_01;}
      QString MINI()     {return m_MINI;}
      QString INFO_02()  {return m_INFO_02;}
      QString MAXI()     {return m_MAXI;}
      QString INFO_03()  {return m_INFO_03;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      QString m_MY_NOFIC;
      QString m_GRP;
      QString m_NATURE;
      QString m_INFO_01;
      QString m_MINI;
      QString m_INFO_02;
      QString m_MAXI;
      QString m_INFO_03;
 };

 //================================== C_GET_THE_GTIAM_ID_CUR   -57- ==================================
 /****************************************************************************
 *   Nom           :  GET_THE_GTIAM_ID
 -----------------------------------------------------------------------------
 *   Date creation : 05/08/2008
 -----------------------------------------------------------------------------
 *   Description   :  cette procédure renvoie le numero des fiches d'interaction
 *                    pour une liste de specialité
 *   MAJ           :  24/09/2008
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_GTIAM_ID_CUR  C_GET_THE_GTIAM_ID ( database(), this );
      while ( C_GET_THE_GTIAM_ID.next( LISTESP , GRAVITE  ) )
            { html += tr("<br><b> GET_THE_GTIAM_ID : </b>  ") + C_GET_THE_GTIAM_ID.MEMBER();
            }
  */
  class C_GET_THE_GTIAM_ID_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_GTIAM_ID_CUR ---------------------
      C_GET_THE_GTIAM_ID_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( QString LISTESP , QString GRAVITE )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............
     /*
        '	SELECT  t1.IT1SP_FIT_CODE_FK_PK 	AS IDINTER ,                                                                                  	'||
        '	t5.CDF_NOM                			AS VALIDE   ,                                                                                         	'||
        '	CASE WHEN t1.IT1SP_SP_CODE_FK_PK < t2.IT2SP_SP_CODE_FK_PK  THEN t6.SP_NOM ELSE t7.SP_NOM END AS TERME_1 ,                         	'||
        '	CASE WHEN t1.IT1SP_SP_CODE_FK_PK < t2.IT2SP_SP_CODE_FK_PK  THEN t7.SP_NOM ELSE t6.SP_NOM END AS TERME_2 ,                         	'||
        '	CASE WHEN t1.IT1SP_SP_CODE_FK_PK < t2.IT2SP_SP_CODE_FK_PK  THEN t1.IT1SP_SP_CODE_FK_PK ELSE t2.IT2SP_SP_CODE_FK_PK END   AS ID_T1 , 	'||
        '	CASE WHEN t1.IT1SP_SP_CODE_FK_PK < t2.IT2SP_SP_CODE_FK_PK  THEN t2.IT2SP_SP_CODE_FK_PK  ELSE t1.IT1SP_SP_CODE_FK_PK END  AS ID_T2 ,	'||
        '	t3.FITNA_CDF_NAIT_CODE_FK_PK 	AS NIVEAU                              '||
        '	FROM   IT1SP_TERME1SPECIALITE   t1,                                  '||
        '	IT2SP_TERME2SPECIALITE   t2,                                         '||
        '	FITNA_INTERACTION_NATURE t3,                                         '||
        '	FITVA_NIVEAU_VALIDATION  t4,                                         '||
        '	CDF_CODIF                t5,                                         '||
        '	SP_SPECIALITE            t6,                                         '||
        '	SP_SPECIALITE            t7                                          '||
        '	WHERE  t1.IT1SP_FIT_CODE_FK_PK      = t2.IT2SP_FIT_CODE_FK_PK        '||
        '	AND    t3.FITNA_FIT_CODE_FK_PK      = t1.IT1SP_FIT_CODE_FK_PK        '||
        '	AND    t4.FITVA_FIT_CODE_FK_PK      = t1.IT1SP_FIT_CODE_FK_PK        '||
        '	AND    t5.CDF_CODE_PK               = t4.FITVA_CDF_VAIT_CODE_FK_PK   '||
        '	AND    t6.SP_CODE_SQ_PK             = t1.IT1SP_SP_CODE_FK_PK         '||
        '	AND    t7.SP_CODE_SQ_PK             = t2.IT2SP_SP_CODE_FK_PK         '||
        '	AND    t4.FITVA_CDF_VAIT_CODE_FK_PK = ''1''                          '||
        '	AND    t5.CDF_NUMERO_PK             = ''IV''                         '||
        '	AND    t1.IT1SP_SP_CODE_FK_PK       <> t2.IT2SP_SP_CODE_FK_PK        '||
        '	AND    t1.IT1SP_SP_CODE_FK_PK       IN ('||LISTESP||')               '||
        '	AND    t2.IT2SP_SP_CODE_FK_PK        IN ('||LISTESP||')              '||
        '	AND    t3.FITNA_CDF_NAIT_CODE_FK_PK  <= '||GRAVITE||
        '	AND    EXISTS ( SELECT  IT1SP_FIT_CODE_FK_PK ,                       '||
        '	IT1SP_SP_CODE_FK_PK                                                  '||
        '	FROM   IT1SP_TERME1SPECIALITE                                        '||
        '	WHERE  t2.IT2SP_SP_CODE_FK_PK  = IT1SP_SP_CODE_FK_PK                 '||
        '	AND    t1.IT1SP_FIT_CODE_FK_PK = IT1SP_FIT_CODE_FK_PK                '||
        '	)	   		  		                                                  	'||
        '	GROUP BY t1.IT1SP_FIT_CODE_FK_PK 	 ,                              	'||
        '	t5.CDF_NOM                  ,                                        '||
        '	CASE WHEN t1.IT1SP_SP_CODE_FK_PK < t2.IT2SP_SP_CODE_FK_PK  THEN t6.SP_NOM ELSE t7.SP_NOM END   ,                         	'||
        '	CASE WHEN t1.IT1SP_SP_CODE_FK_PK < t2.IT2SP_SP_CODE_FK_PK  THEN t7.SP_NOM ELSE t6.SP_NOM END   ,                         	'||
        '	CASE WHEN t1.IT1SP_SP_CODE_FK_PK < t2.IT2SP_SP_CODE_FK_PK  THEN t1.IT1SP_SP_CODE_FK_PK ELSE t2.IT2SP_SP_CODE_FK_PK END   , '||
        '	CASE WHEN t1.IT1SP_SP_CODE_FK_PK < t2.IT2SP_SP_CODE_FK_PK  THEN t2.IT2SP_SP_CODE_FK_PK  ELSE t1.IT1SP_SP_CODE_FK_PK END   ,'||
        '	t3.FITNA_CDF_NAIT_CODE_FK_PK 	                                       '||
        '	UNION                                                                '||
        '	SELECT  t1.IT1SP_FIT_CODE_FK_PK 	AS IDINTER ,                        '||
        '	t5.CDF_NOM                     		AS VALIDE   ,                         '||
        '	t6.SP_NOM 	                  		AS TERME_1   ,                           '||
        '	t7.SP_NOM 	            	  		AS TERME_2    ,                           '||
        '	t1.IT1SP_SP_CODE_FK_PK         		AS ID_T1    ,                         '||
        '	t2.IT2SP_SP_CODE_FK_PK  			AS ID_T2          ,                       '||
        '	t3.FITNA_CDF_NAIT_CODE_FK_PK 		AS NIVEAU                              '||
        '	FROM   IT1SP_TERME1SPECIALITE   t1,                                  '||
        '	IT2SP_TERME2SPECIALITE   t2,                                         '||
        '	FITNA_INTERACTION_NATURE t3,                                         '||
        '	FITVA_NIVEAU_VALIDATION  t4,                                         '||
        '	CDF_CODIF                t5,                                         '||
        '	SP_SPECIALITE            t6,                                         '||
        '	SP_SPECIALITE            t7                                          '||
        '	WHERE  t1.IT1SP_FIT_CODE_FK_PK      = t2.IT2SP_FIT_CODE_FK_PK        '||
        '	AND    t3.FITNA_FIT_CODE_FK_PK      = t1.IT1SP_FIT_CODE_FK_PK        '||
        '	AND    t4.FITVA_FIT_CODE_FK_PK      = t1.IT1SP_FIT_CODE_FK_PK        '||
        '	AND    t5.CDF_CODE_PK               = t4.FITVA_CDF_VAIT_CODE_FK_PK   '||
        '	AND    t6.SP_CODE_SQ_PK             = t1.IT1SP_SP_CODE_FK_PK         '||
        '	AND    t7.SP_CODE_SQ_PK             = t2.IT2SP_SP_CODE_FK_PK         '||
        '	AND    t4.FITVA_CDF_VAIT_CODE_FK_PK = '1'                          '||
        '	AND    t5.CDF_NUMERO_PK             = 'IV'                         '||
        '	AND    t1.IT1SP_SP_CODE_FK_PK       <> t2.IT2SP_SP_CODE_FK_PK        '||
        '	AND    t1.IT1SP_SP_CODE_FK_PK       IN ('||LISTESP||')               '||
        '	AND    t2.IT2SP_SP_CODE_FK_PK       IN ('||LISTESP||')               '||
        '	AND    t3.FITNA_CDF_NAIT_CODE_FK_PK  <= '||GRAVITE||
        '	AND    NOT EXISTS  ( SELECT  IT1SP_FIT_CODE_FK_PK ,                  '||
        '	IT1SP_SP_CODE_FK_PK                                                  '||
        '	FROM   IT1SP_TERME1SPECIALITE                                        '||
        '	WHERE  t2.IT2SP_SP_CODE_FK_PK  = IT1SP_SP_CODE_FK_PK                 '||
        '	AND    t1.IT1SP_FIT_CODE_FK_PK = IT1SP_FIT_CODE_FK_PK                '||
        '	)	   		  		                                                   '||
        '	ORDER BY 1 ' ;

     */      sql_query +=
                     " SELECT  t1.IT1SP_FIT_CODE_FK_PK    AS IDINTER , \n"
                     " t5.CDF_NOM                         AS VALIDE  , \n"
                     " CASE WHEN t1.IT1SP_SP_CODE_FK_PK < t2.IT2SP_SP_CODE_FK_PK  THEN t6.SP_NOM ELSE t7.SP_NOM END AS TERME_1 ,\n"
                     " CASE WHEN t1.IT1SP_SP_CODE_FK_PK < t2.IT2SP_SP_CODE_FK_PK  THEN t7.SP_NOM ELSE t6.SP_NOM END AS TERME_2 ,\n"
                     " CASE WHEN t1.IT1SP_SP_CODE_FK_PK < t2.IT2SP_SP_CODE_FK_PK  THEN t1.IT1SP_SP_CODE_FK_PK ELSE t2.IT2SP_SP_CODE_FK_PK END   AS ID_T1 , \n"
                     " CASE WHEN t1.IT1SP_SP_CODE_FK_PK < t2.IT2SP_SP_CODE_FK_PK  THEN t2.IT2SP_SP_CODE_FK_PK  ELSE t1.IT1SP_SP_CODE_FK_PK END  AS ID_T2 , \n"
                     " t3.FITNA_CDF_NAIT_CODE_FK_PK       AS NIVEAU \n"
                     " FROM     it1sp_terme1specialite    t1,       \n"
                     "          it2sp_terme2specialite    t2,       \n"
                     "          fitna_interaction_nature  t3,       \n"
                     "          fitva_niveau_validation   t4,       \n"
                     "          cdf_codif                 t5,       \n"
                     "          sp_specialite             t6,       \n"
                     "          sp_specialite             t7        \n"
                     " WHERE  t1.IT1SP_FIT_CODE_FK_PK      = t2.IT2SP_FIT_CODE_FK_PK         \n"
                     " AND    t3.FITNA_FIT_CODE_FK_PK      = t1.IT1SP_FIT_CODE_FK_PK         \n"
                     " AND    t4.FITVA_FIT_CODE_FK_PK      = t1.IT1SP_FIT_CODE_FK_PK         \n"
                     " AND    t5.CDF_CODE_PK               = t4.FITVA_CDF_VAIT_CODE_FK_PK    \n"
                     " AND    t6.SP_CODE_SQ_PK             = t1.IT1SP_SP_CODE_FK_PK          \n"
                     " AND    t7.SP_CODE_SQ_PK             = t2.IT2SP_SP_CODE_FK_PK          \n"
                     " AND    t4.FITVA_CDF_VAIT_CODE_FK_PK = '1'                             \n"
                     " AND    t5.CDF_NUMERO_PK             = 'IV'                            \n"
                     " AND    t1.IT1SP_SP_CODE_FK_PK       <> t2.IT2SP_SP_CODE_FK_PK         \n"
                     " AND    t1.IT1SP_SP_CODE_FK_PK        IN ('"+LISTESP+"')               \n"
                     " AND    t2.IT2SP_SP_CODE_FK_PK        IN ('"+LISTESP+"')               \n"
                     " AND    t3.FITNA_CDF_NAIT_CODE_FK_PK  <=  '"+GRAVITE+"'                \n"   //valeur possibles :  1 2 3 4 7 11
                     " AND    EXISTS ( SELECT  IT1SP_FIT_CODE_FK_PK ,                        \n"
                     "                         IT1SP_SP_CODE_FK_PK                           \n"
                     "                         FROM   it1sp_terme1specialite                 \n"
                     "                         WHERE  t2.IT2SP_SP_CODE_FK_PK  = IT1SP_SP_CODE_FK_PK   \n"
                     "                         AND    t1.IT1SP_FIT_CODE_FK_PK = IT1SP_FIT_CODE_FK_PK  \n"
                     "               )	   		  		                     \n"
                     " GROUP BY t1.IT1SP_FIT_CODE_FK_PK ,                                    \n"
                     " t5.CDF_NOM ,                                                          \n"
                     " CASE WHEN t1.IT1SP_SP_CODE_FK_PK < t2.IT2SP_SP_CODE_FK_PK  THEN t6.SP_NOM ELSE t7.SP_NOM END   , \n"
                     " CASE WHEN t1.IT1SP_SP_CODE_FK_PK < t2.IT2SP_SP_CODE_FK_PK  THEN t7.SP_NOM ELSE t6.SP_NOM END   , \n"
                     " CASE WHEN t1.IT1SP_SP_CODE_FK_PK < t2.IT2SP_SP_CODE_FK_PK  THEN t1.IT1SP_SP_CODE_FK_PK ELSE t2.IT2SP_SP_CODE_FK_PK END   , \n"
                     " CASE WHEN t1.IT1SP_SP_CODE_FK_PK < t2.IT2SP_SP_CODE_FK_PK  THEN t2.IT2SP_SP_CODE_FK_PK  ELSE t1.IT1SP_SP_CODE_FK_PK END  , \n"
                     " t3.FITNA_CDF_NAIT_CODE_FK_PK 	                                     \n"
                     " UNION                                                                 \n"
                     " SELECT  t1.IT1SP_FIT_CODE_FK_PK          AS IDINTER   ,               \n"
                     " t5.CDF_NOM                               AS VALIDE    ,               \n"
                     " t6.SP_NOM                                AS TERME_1   ,               \n"
                     " t7.SP_NOM                                AS TERME_2   ,               \n"
                     " t1.IT1SP_SP_CODE_FK_PK                   AS ID_T1     ,               \n"
                     " t2.IT2SP_SP_CODE_FK_PK                   AS ID_T2     ,               \n"
                     " t3.FITNA_CDF_NAIT_CODE_FK_PK             AS NIVEAU                    \n"
                     " FROM   it1sp_terme1specialite         t1,                             \n"
                     "        it2sp_terme2specialite         t2,                             \n"
                     "        fitna_interaction_nature       t3,                             \n"
                     "        fitva_niveau_validation        t4,                             \n"
                     "        cdf_codif                      t5,                             \n"
                     "        sp_specialite                  t6,                             \n"
                     "        sp_specialite                  t7                              \n"
                     " WHERE  t1.IT1SP_FIT_CODE_FK_PK      = t2.IT2SP_FIT_CODE_FK_PK         \n"
                     " AND    t3.FITNA_FIT_CODE_FK_PK      = t1.IT1SP_FIT_CODE_FK_PK         \n"
                     " AND    t4.FITVA_FIT_CODE_FK_PK      = t1.IT1SP_FIT_CODE_FK_PK         \n"
                     " AND    t5.CDF_CODE_PK               = t4.FITVA_CDF_VAIT_CODE_FK_PK    \n"
                     " AND    t6.SP_CODE_SQ_PK             = t1.IT1SP_SP_CODE_FK_PK          \n"
                     " AND    t7.SP_CODE_SQ_PK             = t2.IT2SP_SP_CODE_FK_PK          \n"
                     " AND    t4.FITVA_CDF_VAIT_CODE_FK_PK = '1'                             \n"
                     " AND    t5.CDF_NUMERO_PK             = 'IV'                            \n"
                     " AND    t1.IT1SP_SP_CODE_FK_PK       <> t2.IT2SP_SP_CODE_FK_PK         \n"
                     " AND    t1.IT1SP_SP_CODE_FK_PK       IN ('"+LISTESP+"')                \n"
                     " AND    t2.IT2SP_SP_CODE_FK_PK       IN ('"+LISTESP+"')                \n"
                     " AND    t3.FITNA_CDF_NAIT_CODE_FK_PK  <= '"+GRAVITE+"'                 \n"
                     " AND    NOT EXISTS  ( SELECT  IT1SP_FIT_CODE_FK_PK ,                   \n"
                     "                      IT1SP_SP_CODE_FK_PK                              \n"
                     "                      FROM   it1sp_terme1specialite                    \n"
                     "                      WHERE  t2.IT2SP_SP_CODE_FK_PK  = IT1SP_SP_CODE_FK_PK   \n"
                     "                      AND    t1.IT1SP_FIT_CODE_FK_PK = IT1SP_FIT_CODE_FK_PK  \n"
                     "                    )	   		  		                   \n"
                     " ORDER BY 1  ;                                                               \n";
                     //............. zone de construction de la requete FIN ...............
                // CGestIni::Param_UpdateToDisk("/home/ro/inter.sql",sql_query);
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_GTIAM_ID() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_MY_IDINTER = value(0).toString();
                m_VALIDE     = value(1).toString();
                m_TERME_1    = value(2).toString();
                m_TERME_2    = value(3).toString();
                m_ID_T1      = value(4).toDouble();
                m_ID_T2      = value(5).toDouble();
                m_NIVEAU     = value(6).toString();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      QString MY_IDINTER() {return m_MY_IDINTER;}
      QString VALIDE()     {return m_VALIDE;}
      QString TERME_1()    {return m_TERME_1;}
      QString TERME_2()    {return m_TERME_2;}
      double  ID_T1()      {return m_ID_T1;}
      double  ID_T2()      {return m_ID_T2;}
      QString NIVEAU()     {return m_NIVEAU;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      QString m_MY_IDINTER;
      QString m_VALIDE;
      QString m_TERME_1;
      QString m_TERME_2;
      double  m_ID_T1;
      double  m_ID_T2;
      QString m_NIVEAU;
 };

 //================================== C_GET_THE_GTIAM_TXT_CUR   -58- ==================================
 /****************************************************************************
 *   Nom           :  GET_THE_GTIAM_TXT
 -----------------------------------------------------------------------------
 *   Date creation : 05/08/2008
 -----------------------------------------------------------------------------
 *   Description   :  cette procédure renvoie le texte des fiches interactions
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_GTIAM_TXT_CUR  C_GET_THE_GTIAM_TXT ( database(), this );
      while ( C_GET_THE_GTIAM_TXT.next( LISTFIC  ) )
            { html += tr("<br><b> GET_THE_GTIAM_TXT : </b>  ") + C_GET_THE_GTIAM_TXT.MEMBER();
            }
  */
  class C_GET_THE_GTIAM_TXT_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_GTIAM_TXT_CUR ---------------------
      C_GET_THE_GTIAM_TXT_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( QString LISTFIC )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............

 //+    ' SELECT   FIT_CODE_SQ_PK      AS NOFIT,       '||
 //+    '          FIT_TEXTE           AS TEXTE,       '||
 //+    '          FIT_DATECR     AS DATE_TXT          '||
 //+    ' FROM     FIT_FICHEINTERAC                    '||
 //+    ' WHERE    FIT_CODE_SQ_PK  IN ('||LISTFIC||')  '||
 //+    ' ORDER BY FIT_CODE_SQ_PK ';
                sql_query +=
                     " SELECT   FIT_CODE_SQ_PK      AS NOFIT,"
                     " FIT_TEXTE                    AS TEXTE,"
                     " FIT_DATECR                   AS DATE_TXT"
                     " FROM     fit_ficheinterac"
                     " WHERE    FIT_CODE_SQ_PK  IN ('"+LISTFIC+"')"
                     " ORDER BY FIT_CODE_SQ_PK;";
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_GTIAM_TXT() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_MY_NOFIT    = value(0).toString();
                m_MY_TEXTE    = value(1).toString();
                m_MY_DATE_TXT = value(2).toString();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      QString MY_NOFIT()    {return m_MY_NOFIT;}
      QString MY_TEXTE()    {return m_MY_TEXTE;}
      QString MY_DATE_TXT() {return m_MY_DATE_TXT;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      QString m_MY_NOFIT;
      QString m_MY_TEXTE;
      QString m_MY_DATE_TXT;
 };

 //================================== C_GET_THE_GTIAM_DET_CUR   -59- ==================================
 /****************************************************************************
 *   Nom           :  GET_THE_GTIAM_DET
 -----------------------------------------------------------------------------
 *   Date creation : 06/08/2008
 -----------------------------------------------------------------------------
 *   Description   :  cette API renvoie les informations detaillées autour d'une ou plusieurs
 *                    fiches d'interaction
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_GTIAM_DET_CUR  C_GET_THE_GTIAM_DET ( database(), this );
      while ( C_GET_THE_GTIAM_DET.next( LISTFIC  ) )
            { html += tr("<br><b> GET_THE_GTIAM_DET : </b>  ") + C_GET_THE_GTIAM_DET.MEMBER();
            }
  */
  class C_GET_THE_GTIAM_DET_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_GTIAM_DET_CUR ---------------------
      C_GET_THE_GTIAM_DET_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( QString LISTFIC )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............

 //+     --- Dose et Voie de l'administration (TERME 1)
 //+     ' SELECT t1.FITVD1_FIT_CODE_FK_PK        as NOFIC ,    '||
 //+     '        ''1A.''||t1.FITVD1_NUMORD       as GRP  ,     '||
 //+     '        t1.FITVD1_QUALIFICATIF_DOSE1    as INFO_01,   '||
 //+     '        t2.CDF_NOM                     as INFO_02,   '||
 //+     '        t1.FITVD1_DOSE1               as VALEUR_01, '||
 //+     '        t3.CDF_NOM                   as INFO_03 ,  '||
 //+     '        NULL                            as DATE_01    '||
 //+     ' FROM   FITVD1_INTERACTION_VOIE_DOSE   t1,    '||
 //+     '        CDF_CODIF                      t2,    '||
 //+     '        CDF_CODIF     t3     '||
 //+     ' WHERE  t1.FITVD1_FIT_CODE_FK_PK     IN ('||LISTFIC||')  '||
 //+     ' AND    t1.FITVD1_CDF_VO_CODE1_FK    = t2.CDF_CODE_PK(+) '||
 //+     ' AND    t2.CDF_NUMERO_PK(+)          = ''18''            '||
 //+     ' AND    t1.FITVD1_CDF_PP_CODE1_FK    = t3.CDF_CODE_PK(+) '||
 //+     ' AND    t3.CDF_NUMERO_PK(+)          = ''PP''            '||
 //+     --- Dose et Voie de l'administration (TERME 2)
 //+     ' UNION                                                   '||
 //+     ' SELECT t1.FITVD2_FIT_CODE_FK_PK        as NOFIC ,    '||
 //+     '        ''1B.''||t1.FITVD2_NUMORD       as GRP  ,     '||
 //+     '        t1.FITVD2_QUALIFICATIF_DOSE2    as INFO_01,   '||
 //+     '        t2.CDF_NOM                     as INFO_02,   '||
 //+     '        t1.FITVD2_DOSE2       as VALEUR_01, '||
 //+     '        t3.CDF_NOM                      as INFO_03 ,  '||
 //+     '        NULL                            as DATE_01    '||
 //+     ' FROM   FITVD2_INTERACTION_VOIE_DOSE   t1,               '||
 //+     '        CDF_CODIF                      t2,               '||
 //+     '        CDF_CODIF        t3               '||
 //+     ' WHERE  t1.FITVD2_FIT_CODE_FK_PK     IN ('||LISTFIC||')  '||
 //+     ' AND    t1.FITVD2_CDF_VO_CODE2_FK    = t2.CDF_CODE_PK(+) '||
 //+     ' AND    t2.CDF_NUMERO_PK(+)          = ''18''            '||
 //+     ' AND    t1.FITVD2_CDF_PP_CODE2_FK    = t3.CDF_CODE_PK(+) '||
 //+     ' AND    t3.CDF_NUMERO_PK(+)          = ''PP''            '||
 //+     ' UNION                                                   '||
 //+     --- Terrains favorisants
 //+     ' SELECT t1.FITTER_FIT_CODE_FK_PK        as NOFIC ,    '||
 //+     '        ''2.''||t1.FITTER_NUMORD        as GRP  ,     '||
 //+     '        t2.CDF_NOM        as INFO_01,   '||
 //+     '        NULL                            as INFO_02,   '||
 //+     '        NULL                            as VALEUR_01, '||
 //+     '        NULL                            as INFO_03 ,  '||
 //+     '        NULL                            as DATE_01    '||
 //+     ' FROM   FITTER_TERRAINFAVORISANT       t1,               '||
 //+     '        CDF_CODIF                      t2                '||
 //+     ' WHERE  t1.FITTER_FIT_CODE_FK_PK     IN ('||LISTFIC||')  '||
 //+     ' AND    t1.FITTER_CDF_TER_CODE_FK_PK = t2.CDF_CODE_PK    '||
 //+     ' AND    t2.CDF_NUMERO_PK             = ''CS''            '||
 //+     ' UNION                                                   '||
 //+     --- Sens de l'interaction
 //+     ' SELECT t1.FITSE_FIT_CODE_FK_PK         as NOFIC ,    '||
 //+     '        ''3.''||t1.FITSE_NUMORD         as GRP  ,     '||
 //+     '        t2.CDF_NOM        as INFO_01,   '||
 //+     '        NULL                            as INFO_02,   '||
 //+     '        NULL                            as VALEUR_01, '||
 //+     '        NULL                            as INFO_03 ,  '||
 //+     '        NULL                            as DATE_01    '||
 //+     ' FROM   FITSE_INTERACTION_SENS         t1,               '||
 //+     '        CDF_CODIF                      t2                '||
 //+     ' WHERE  t1.FITSE_FIT_CODE_FK_PK     IN ('||LISTFIC||')   '||
 //+     ' AND    t1.FITSE_CDF_SEIT_CODE_FK_PK  = t2.CDF_CODE_PK   '||
 //+     ' AND    t2.CDF_NUMERO_PK              = ''IS''           '||
 //+     ' UNION                                                   '||
 //+     --- Mécanisme de l'interaction
 //+     ' SELECT t1.FITTY_FIT_CODE_FK_PK         as NOFIC ,    '||
 //+     '        ''4.''||t1.FITTY_NUMORD         as GRP  ,     '||
 //+     '        t2.CDF_NOM        as INFO_01,   '||
 //+     '        NULL                            as INFO_02,   '||
 //+     '        NULL                            as VALEUR_01, '||
 //+     '        NULL                            as INFO_03 ,  '||
 //+     '        NULL                            as DATE_01    '||
 //+     ' FROM   FITTY_TYPEINTERACTION          t1,               '||
 //+     '        CDF_CODIF                      t2                '||
 //+     ' WHERE  t1.FITTY_FIT_CODE_FK_PK      IN ('||LISTFIC||')  '||
 //+     ' AND    t1.FITTY_CDF_TYPE_CODE_FK_PK  = t2.CDF_CODE_PK   '||
 //+     ' AND    t2.CDF_NUMERO_PK              = ''IY''           '||
 //+     ' UNION                                                   '||
 //+     --- reference officielle
 //+     ' SELECT t1.FITROF_FIT_CODE_FK_PK        as NOFIC ,    '||
 //+     '        ''5.''||t1.FITROF_NUM_DOC_PK    as GRP  ,     '||
 //+     '        t2.CDF_NOM        as INFO_01,   '||
 //+     '        NULL                            as INFO_02,   '||
 //+     '        FITROF_NUM_DOC_PK       as VALEUR_01, '||
 //+     '       NULL                           as INFO_03 ,  '||
 //+     '        FITROF_DATE_PK                  as DATE_01    '||
 //+     ' FROM   FITROF_REF_OFFICIELLE          t1,               '||
 //+     '        CDF_CODIF                      t2                '||
 //+     ' WHERE  t1.FITROF_FIT_CODE_FK_PK       IN ('||LISTFIC||')'||
 //+     ' AND    t1.FITROF_CDF_DOC_CODE_FK_PK   = t2.CDF_CODE_PK  '||
 //+     ' AND    t2.CDF_NUMERO_PK               = ''25''          '||
 //+     ' ORDER BY 1,2 ';
                sql_query += " SELECT t1.FITVD1_FIT_CODE_FK_PK        as NOFIC ,"
                     " '1A.'T1.FITVD1_NUMORD       as GRP  ,"
                     " t1.FITVD1_QUALIFICATIF_DOSE1    as INFO_01,"
                     " t2.CDF_NOM                     as INFO_02,"
                     " t1.FITVD1_DOSE1               as VALEUR_01,"
                     " t3.CDF_NOM                   as INFO_03 ,"
                     " NULL                            as DATE_01"
                     " FROM   fitvd1_interaction_voie_dose   t1,"
                     " cdf_codif                      t2,"
                     " cdf_codif     t3"
                     " WHERE  t1.FITVD1_FIT_CODE_FK_PK     IN ('"+LISTFIC+"')"
                     " AND    t1.FITVD1_CDF_VO_CODE1_FK    = t2.CDF_CODE_PK"
                     " AND    t2.CDF_NUMERO_PK          = '18'"
                     " AND    t1.FITVD1_CDF_PP_CODE1_FK    = t3.CDF_CODE_PK"
                     " AND    t3.CDF_NUMERO_PK          = 'PP'"
                     " "  //--- Dose et Voie de l'administration (TERME 2)"
                     " UNION"
                     " SELECT t1.FITVD2_FIT_CODE_FK_PK        as NOFIC ,"
                     " '1B.'T1.FITVD2_NUMORD       as GRP  ,"
                     " t1.FITVD2_QUALIFICATIF_DOSE2    as INFO_01,"
                     " t2.CDF_NOM                     as INFO_02,"
                     " t1.FITVD2_DOSE2       as VALEUR_01,"
                     " t3.CDF_NOM                      as INFO_03 ,"
                     " NULL                            as DATE_01"
                     " FROM   fitvd2_interaction_voie_dose   t1,"
                     " cdf_codif                      t2,"
                     " cdf_codif        t3"
                     " WHERE  t1.FITVD2_FIT_CODE_FK_PK     IN ('"+LISTFIC+"')"
                     " AND    t1.FITVD2_CDF_VO_CODE2_FK    = t2.CDF_CODE_PK"
                     " AND    t2.CDF_NUMERO_PK          = '18'"
                     " AND    t1.FITVD2_CDF_PP_CODE2_FK    = t3.CDF_CODE_PK"
                     " AND    t3.CDF_NUMERO_PK          = 'PP'"
                     " UNION"
                     " "  //--- Terrains favorisants"
                     " SELECT t1.FITTER_FIT_CODE_FK_PK        as NOFIC ,"
                     " '2.'T1.FITTER_NUMORD        as GRP  ,"
                     " t2.CDF_NOM        as INFO_01,"
                     " NULL                            as INFO_02,"
                     " NULL                            as VALEUR_01,"
                     " NULL                            as INFO_03 ,"
                     " NULL                            as DATE_01"
                     " FROM   fitter_terrainfavorisant       t1,"
                     " cdf_codif                      t2"
                     " WHERE  t1.FITTER_FIT_CODE_FK_PK     IN ('"+LISTFIC+"')"
                     " AND    t1.FITTER_CDF_TER_CODE_FK_PK = t2.CDF_CODE_PK"
                     " AND    t2.CDF_NUMERO_PK             = 'CS'"
                     " UNION"
                     " "  //--- Sens de l'interaction"
                     " SELECT t1.FITSE_FIT_CODE_FK_PK         as NOFIC ,"
                     " '3.'T1.FITSE_NUMORD         as GRP  ,"
                     " t2.CDF_NOM        as INFO_01,"
                     " NULL                            as INFO_02,"
                     " NULL                            as VALEUR_01,"
                     " NULL                            as INFO_03 ,"
                     " NULL                            as DATE_01"
                     " FROM   fitse_interaction_sens         t1,"
                     " cdf_codif                      t2"
                     " WHERE  t1.FITSE_FIT_CODE_FK_PK     IN ('"+LISTFIC+"')"
                     " AND    t1.FITSE_CDF_SEIT_CODE_FK_PK  = t2.CDF_CODE_PK"
                     " AND    t2.CDF_NUMERO_PK              = 'IS'"
                     " UNION"
                     " "  //--- Mécanisme de l'interaction"
                     " SELECT t1.FITTY_FIT_CODE_FK_PK         as NOFIC ,"
                     " '4.'T1.FITTY_NUMORD         as GRP  ,"
                     " t2.CDF_NOM        as INFO_01,"
                     " NULL                            as INFO_02,"
                     " NULL                            as VALEUR_01,"
                     " NULL                            as INFO_03 ,"
                     " NULL                            as DATE_01"
                     " FROM   fitty_typeinteraction          t1,"
                     " cdf_codif                      t2"
                     " WHERE  t1.FITTY_FIT_CODE_FK_PK      IN ('"+LISTFIC+"')"
                     " AND    t1.FITTY_CDF_TYPE_CODE_FK_PK  = t2.CDF_CODE_PK"
                     " AND    t2.CDF_NUMERO_PK              = 'IY'"
                     " UNION"
                     " "  //--- reference officielle"
                     " SELECT t1.FITROF_FIT_CODE_FK_PK        as NOFIC ,"
                     " '5.'T1.FITROF_NUM_DOC_PK    as GRP  ,"
                     " t2.CDF_NOM        as INFO_01,"
                     " NULL                            as INFO_02,"
                     " FITROF_NUM_DOC_PK       as VALEUR_01,"
                     " NULL                           as INFO_03 ,"
                     " FITROF_DATE_PK                  as DATE_01"
                     " FROM   fitrof_ref_officielle          t1,"
                     " cdf_codif                      t2"
                     " WHERE  t1.FITROF_FIT_CODE_FK_PK       IN ('"+LISTFIC+"')"
                     " AND    t1.FITROF_CDF_DOC_CODE_FK_PK   = t2.CDF_CODE_PK"
                     " AND    t2.CDF_NUMERO_PK               = '25'"
                     " ORDER BY 1,2;";
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_GTIAM_DET() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_MY_NOFIC  = value(0).toString();
                m_GRP       = value(1).toString();
                m_INFO_01   = value(2).toString();
                m_INFO_02   = value(3).toString();
                m_VALEUR_01 = value(4).toDouble();
                m_INFO_03   = value(5).toString();
                m_DATE_01   = value(6).toDate();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      QString MY_NOFIC()  {return m_MY_NOFIC;}
      QString GRP()       {return m_GRP;}
      QString INFO_01()   {return m_INFO_01;}
      QString INFO_02()   {return m_INFO_02;}
      double  VALEUR_01() {return m_VALEUR_01;}
      QString INFO_03()   {return m_INFO_03;}
      QDate   DATE_01()   {return m_DATE_01;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      QString m_MY_NOFIC;
      QString m_GRP;
      QString m_INFO_01;
      QString m_INFO_02;
      double  m_VALEUR_01;
      QString m_INFO_03;
      QDate   m_DATE_01;
 };

 //================================== C_GET_THE_INTER_SPE_CUR   -60- ==================================
 /****************************************************************************
 *   Nom           :  GET_THE_INTER_SPE
 -----------------------------------------------------------------------------
 *   Date creation : 07/08/2008
 -----------------------------------------------------------------------------
 *   Description   :  cette procédure renvoie a la rubrique interaction RCP
 *                    pour le code specialite passé en parametre
 *   MAJ           :  07/10/2008
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_INTER_SPE_CUR  C_GET_THE_INTER_SPE ( database(), this );
      while ( C_GET_THE_INTER_SPE.next( CodeId  ) )
            { html += tr("<br><b> GET_THE_INTER_SPE : </b>  ") + C_GET_THE_INTER_SPE.MEMBER();
            }
  */
  class C_GET_THE_INTER_SPE_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_INTER_SPE_CUR ---------------------
      C_GET_THE_INTER_SPE_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( double CodeId )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

                //............. zone de construction de la requete DEBUT ...............
                sql_query +=
                     " SELECT t1.FIRCP_CODE_SQ_PK        AS CODEINTER ,"
                     " t1.FIRCP_TXT                      AS TEXTINTER ,"
                     " t2.FIRCPAFS_DATE_PK               AS DTREF     ,"
                     " t3.CDF_NOM                        AS REFOFF"
                     " FROM   fircp_interactionrcp       t1,"
                     " fircpafs_fircp_afssaps            t2,"
                     " cdf_codif                         t3"
                     " WHERE  t1.FIRCP_CODE_SQ_PK            = t2.FIRCPAFS_FIRCP_CODE_FK_PK"
                     " AND    t2.FIRCPAFS_CDF_DOCUMENT_FK_PK = t3.CDF_CODE_PK"
                     " AND    t3.CDF_NUMERO_PK               = '25'"
                     " AND    t2.FIRCPAFS_DATE_PK            = (SELECT MAX(FIRCPAFS_DATE_PK)"
                     " FROM  fircpafs_fircp_afssaps,"
                     " fircp_interactionrcp"
                     " WHERE FIRCP_CODE_SQ_PK                 = FIRCPAFS_FIRCP_CODE_FK_PK"
                     " AND   FIRCPAFS_SP_CODE_FK_PK           = '"+ QString::number( CodeId ) +"')"
                     " AND    t2.FIRCPAFS_SP_CODE_FK_PK       = '"+ QString::number( CodeId ) +"' ;";
                //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_INTER_SPE() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_MY_CODEINTER = value(0).toString();
                m_TEXTINTER    = value(1).toString();
                m_DTREF        = value(2).toDate();
                m_REFOFF       = value(3).toString();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      QString MY_CODEINTER()                      {return m_MY_CODEINTER;}
      QString TEXTINTER()                         {return m_TEXTINTER;}
      QDate   DTREF()                             {return m_DTREF;}
      QString DTREF(const QString &format)        {return m_DTREF.toString(format);}
      QString REFOFF()                            {return m_REFOFF;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      QString m_MY_CODEINTER;
      QString m_TEXTINTER;
      QDate   m_DTREF;
      QString m_REFOFF;
 };

 //================================== C_GET_THE_INCOMP_ID_CUR   -61- ==================================
 /****************************************************************************
 *   Nom           :  GET_THE_INCOMP_ID
 -----------------------------------------------------------------------------
 *   Date creation : 08/08/2008
 -----------------------------------------------------------------------------
 *   Description   :  cette procédure renvoie pour une liste d'id de specialite
 *                    les fiches compatibilité ou incomptabilité associé
 *   MAJ           :  10/10/2008
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_INCOMP_ID_CUR  C_GET_THE_INCOMP_ID ( database(), this );
      while ( C_GET_THE_INCOMP_ID.next( LISTEID , VTY  ) )
            { html += tr("<br><b> GET_THE_INCOMP_ID : </b>  ") + C_GET_THE_INCOMP_ID.MEMBER();
            }
  */
  class C_GET_THE_INCOMP_ID_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_INCOMP_ID_CUR ---------------------
      C_GET_THE_INCOMP_ID_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( QString LISTEID , QString VTY )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............

 //+      '      SELECT t1.IC1SP_FIC_CODE_FK_PK  as IDINCOMP,       '||
 //+      '             t3.SP_NOM                as TERME_1,                   '||
 //+      '             t4.SP_NOM                as TERME_2,       '||
 //+      '             t1.IC1SP_SP_CODE_FK_PK   as ID_T1,                     '||
 //+      '             t2.IC2SP_SP_CODE_FK_PK   as ID_T2        '||
 //+      '      FROM   IC1SP_TERME1SPECIALITE   t1,                           '||
 //+      '             IC2SP_TERME2SPECIALITE   t2,                           '||
 //+      '             SP_SPECIALITE            t3,                           '||
 //+      '             SP_SPECIALITE            t4,                           '||
 //+      '             FIC_INCOMPATIBILITE      t5                            '||
 //+      '      WHERE  t1.IC1SP_FIC_CODE_FK_PK    =  t2.IC2SP_FIC_CODE_FK_PK  '||
 //+      '      AND    t1.IC1SP_FIC_CODE_FK_PK    =  t5.FIC_CODE_SQ_PK        '||
 //+      '      AND    t1.IC1SP_SP_CODE_FK_PK     <> t2.IC2SP_SP_CODE_FK_PK   '||
 //+      '      AND    t1.IC1SP_SP_CODE_FK_PK     =  t3.SP_CODE_SQ_PK         '||
 //+      '      AND    t2.IC2SP_SP_CODE_FK_PK     =  t4.SP_CODE_SQ_PK         '||
 //+      '      AND    t1.IC1SP_SP_CODE_FK_PK     IN ('||LISTEID||')          '||
 //+      '      AND    t2.IC2SP_SP_CODE_FK_PK     IN ('||LISTEID||')          '||
 //+      '      AND    t5.FIC_TYPE                =   '''||VTY||'''           '||
 //+      '      ORDER BY t1.IC1SP_FIC_CODE_FK_PK ';
                sql_query += " SELECT t1.IC1SP_FIC_CODE_FK_PK  as IDINCOMP,"
                     " t3.SP_NOM                as TERME_1,"
                     " t4.SP_NOM                as TERME_2,"
                     " t1.IC1SP_SP_CODE_FK_PK   as ID_T1,"
                     " t2.IC2SP_SP_CODE_FK_PK   as ID_T2"
                     " FROM   ic1sp_terme1specialite   t1,"
                     " ic2sp_terme2specialite   t2,"
                     " sp_specialite            t3,"
                     " sp_specialite            t4,"
                     " fic_incompatibilite      t5"
                     " WHERE  t1.IC1SP_FIC_CODE_FK_PK    =  t2.IC2SP_FIC_CODE_FK_PK"
                     " AND    t1.IC1SP_FIC_CODE_FK_PK    =  t5.FIC_CODE_SQ_PK"
                     " AND    t1.IC1SP_SP_CODE_FK_PK     <> t2.IC2SP_SP_CODE_FK_PK"
                     " AND    t1.IC1SP_SP_CODE_FK_PK     =  t3.SP_CODE_SQ_PK"
                     " AND    t2.IC2SP_SP_CODE_FK_PK     =  t4.SP_CODE_SQ_PK"
                     " AND    t1.IC1SP_SP_CODE_FK_PK     IN ('"+LISTEID+"')"
                     " AND    t2.IC2SP_SP_CODE_FK_PK     IN ('"+LISTEID+"')"
                     " AND    t5.FIC_TYPE                =   '"+VTY+"'"
                     " ORDER BY t1.IC1SP_FIC_CODE_FK_PK;";
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_INCOMP_ID() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_IDINCOMP = value(0).toDouble();
                m_TERME_1  = value(1).toString();
                m_TERME_2  = value(2).toString();
                m_ID_T1    = value(3).toDouble();
                m_ID_T2    = value(4).toDouble();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      double  IDINCOMP() {return m_IDINCOMP;}
      QString TERME_1()  {return m_TERME_1;}
      QString TERME_2()  {return m_TERME_2;}
      double  ID_T1()    {return m_ID_T1;}
      double  ID_T2()    {return m_ID_T2;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      double  m_IDINCOMP;
      QString m_TERME_1;
      QString m_TERME_2;
      double  m_ID_T1;
      double  m_ID_T2;
 };

 //================================== C_GET_THE_INCOMP_ID_UN_CUR   -62- ==================================
 /****************************************************************************
 *   Nom           :  GET_THE_INCOMP_ID_UN
 -----------------------------------------------------------------------------
 *   Date creation : 18/08/2008
 -----------------------------------------------------------------------------
 *   Description   :  cette procédure renvoie pour un id de specialite
 *                    les fiches compatibilité ou incomptabilité associé
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_INCOMP_ID_UN_CUR  C_GET_THE_INCOMP_ID_UN ( database(), this );
      while ( C_GET_THE_INCOMP_ID_UN.next( IDSPE , VTY  ) )
            { html += tr("<br><b> GET_THE_INCOMP_ID_UN : </b>  ") + C_GET_THE_INCOMP_ID_UN.MEMBER();
            }
  */
  class C_GET_THE_INCOMP_ID_UN_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_INCOMP_ID_UN_CUR ---------------------
      C_GET_THE_INCOMP_ID_UN_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( double IDSPE , QString VTY )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............

 //+     SELECT t1.IC1SP_FIC_CODE_FK_PK  AS IDINCOMP  ,
 //+            t2.SP_NOM                AS TERME_1
 //+     FROM   IC1SP_TERME1SPECIALITE   t1,
 //+            SP_SPECIALITE            t2,
 //+   FIC_INCOMPATIBILITE      t3
 //+     WHERE  t1.IC1SP_FIC_CODE_FK_PK    =  t3.FIC_CODE_SQ_PK
 //+  AND    t1.IC1SP_SP_CODE_FK_PK     =  t2.SP_CODE_SQ_PK
 //+  AND    t1.IC1SP_SP_CODE_FK_PK     = IDSPE
 //+     AND    t3.FIC_TYPE                = VTY
 //+     UNION
 //+  SELECT t1.IC2SP_FIC_CODE_FK_PK   AS IDINCOMP,
 //+      t2.SP_NOM                  AS TERME_1
 //+     FROM IC2SP_TERME2SPECIALITE  t1,
 //+       SP_SPECIALITE           t2,
 //+    FIC_INCOMPATIBILITE     t3
 //+  WHERE t1.IC2SP_FIC_CODE_FK_PK = t3.FIC_CODE_SQ_PK
 //+  AND   t1.IC2SP_SP_CODE_FK_PK =  t2.SP_CODE_SQ_PK
 //+  AND   t1.IC2SP_SP_CODE_FK_PK = IDSPE
 //+  AND   t3.FIC_TYPE            = VTY
 //+  ORDER BY 1 ;
                sql_query +=
                     " SELECT t1.IC1SP_FIC_CODE_FK_PK  AS IDINCOMP  ,"
                     " t2.SP_NOM                AS TERME_1"
                     " FROM   ic1sp_terme1specialite   t1,"
                     " sp_specialite            t2,"
                     " fic_incompatibilite      t3"
                     " WHERE  t1.IC1SP_FIC_CODE_FK_PK    =  t3.FIC_CODE_SQ_PK"
                     " AND    t1.IC1SP_SP_CODE_FK_PK     =  t2.SP_CODE_SQ_PK"
                     " AND    t1.IC1SP_SP_CODE_FK_PK      = '"+ QString::number( IDSPE ) +"'"
                     " AND    t3.FIC_TYPE                 = '"+VTY+"'"
                     " UNION"
                     " SELECT t1.IC2SP_FIC_CODE_FK_PK   AS IDINCOMP,"
                     " t2.SP_NOM                  AS TERME_1"
                     " FROM ic2sp_terme2specialite  t1,"
                     " sp_specialite           t2,"
                     " fic_incompatibilite     t3"
                     " WHERE t1.IC2SP_FIC_CODE_FK_PK = t3.FIC_CODE_SQ_PK"
                     " AND   t1.IC2SP_SP_CODE_FK_PK =  t2.SP_CODE_SQ_PK"
                     " AND   t1.IC2SP_SP_CODE_FK_PK  = '"+ QString::number( IDSPE ) +"'"
                     " AND   t3.FIC_TYPE             = '"+VTY+"'"
                     " ORDER BY 1 ;";
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_INCOMP_ID_UN() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_IDINCOMP = value(0).toDouble();
                m_TERME_1  = value(1).toString();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      double  IDINCOMP() {return m_IDINCOMP;}
      QString TERME_1()  {return m_TERME_1;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      double  m_IDINCOMP;
      QString m_TERME_1;
 };

 //================================== C_GET_THE_INCOMP_TXT_CUR   -63- ==================================
 /****************************************************************************
 *   Nom           :  GET_THE_INCOMP_TXT
 -----------------------------------------------------------------------------
 *   Date creation : 18/08/2008
 -----------------------------------------------------------------------------
 *   Description   :  cette procédure renvoie pour pour une liste id de fiche
 *                    les fiches textes compatibilité ou incomptabilité associé
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_INCOMP_TXT_CUR  C_GET_THE_INCOMP_TXT ( database(), this );
      while ( C_GET_THE_INCOMP_TXT.next( LISTFIC  ) )
            { html += tr("<br><b> GET_THE_INCOMP_TXT : </b>  ") + C_GET_THE_INCOMP_TXT.MEMBER();
            }
  */
  class C_GET_THE_INCOMP_TXT_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_INCOMP_TXT_CUR ---------------------
      C_GET_THE_INCOMP_TXT_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( QString LISTFIC )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............

 //+      ' SELECT t1.FIC_CODE_SQ_PK  as NOFIC  ,          '||
 //+      '        t1.FIC_TEXTE       as TEXTE  ,            '||
 //+      '        t1.FIC_DATECR      as DATE_TXT          '||
 //+      ' FROM   FIC_INCOMPATIBILITE      t1               '||
 //+      ' WHERE  t1.FIC_CODE_SQ_PK  IN   ('||LISTFIC||')   '||
 //+      ' ORDER BY t1.FIC_CODE_SQ_PK                       ' ;
                sql_query += " SELECT t1.FIC_CODE_SQ_PK  as NOFIC  ,"
                     " t1.FIC_TEXTE       as TEXTE  ,"
                     " t1.FIC_DATECR      as DATE_TXT"
                     " FROM   fic_incompatibilite      t1"
                     " WHERE  t1.FIC_CODE_SQ_PK  IN   ('"+LISTFIC+"')"
                     " ORDER BY t1.FIC_CODE_SQ_PK                       ';";
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_INCOMP_TXT() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_NOFIC    = value(0).toDouble();
                m_TEXTE    = value(1).toString();
                m_DATE_TXT = value(2).toDate();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      double  NOFIC()    {return m_NOFIC;}
      QString TEXTE()    {return m_TEXTE;}
      QDate   DATE_TXT() {return m_DATE_TXT;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      double  m_NOFIC;
      QString m_TEXTE;
      QDate   m_DATE_TXT;
 };

 //================================== C_GET_THE_INCOMP_DET_CUR   -64- ==================================
 /****************************************************************************
 *   Nom           :  GET_THE_INCOMP_DET
 -----------------------------------------------------------------------------
 *   Date creation : 19/08/2008
 -----------------------------------------------------------------------------
 *   Description   :  cette procédure renvoie pour pour un id de fiche
 *                    compatibilité ou incomptabilité associé a un couple ID_T1
 *                    et ID_T2
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_INCOMP_DET_CUR  C_GET_THE_INCOMP_DET ( database(), this );
      while ( C_GET_THE_INCOMP_DET.next( NOFIC , ID_T1 , ID_T2  ) )
            { html += tr("<br><b> GET_THE_INCOMP_DET : </b>  ") + C_GET_THE_INCOMP_DET.MEMBER();
            }
  */
  class C_GET_THE_INCOMP_DET_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_INCOMP_DET_CUR ---------------------
      C_GET_THE_INCOMP_DET_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( double NOFIC , double ID_T1 , double ID_T2 )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............

 //+         SELECT '01'        AS TYP          ,
 //+                NULL        AS VALEUR_1     ,
 //+                SP_NOM      AS DATA_1       ,
 //+                0           AS NOORD
 //+         FROM   SP_SPECIALITE t1
 //+         WHERE  t1.SP_CODE_SQ_PK = ID_T1
 //+         UNION
 //+         SELECT '02'                        AS TYP       ,
 //+                T1.ICCT1_CONCENTRATION1     AS VALEUR_1  ,
 //+                T2.CDF_NOM                  AS DATA_1    ,
 //+                T1.ICCT1_NUMORD             AS NOORD
 //+         FROM   ICCT1_CONCENTRATION1 T1,
 //+                CDF_CODIF T2
 //+         WHERE  T1.ICCT1_FIC_CODE_FK_PK     = NOFIC
 //+         AND    T1.ICCT1_CDF_UDOSE_CODE_FK  = T2.CDF_CODE_PK
 //+         AND    T2.CDF_NUMERO_PK            = '19'
 //+         UNION
 //+         SELECT '03'         AS TYP        ,
 //+                NULL         AS VALEUR_1   ,
 //+                t2.CDF_NOM   AS DATA_1     ,
 //+                0            AS NOORD
 //+         FROM   IC1VE_INCOMPATIBILITE_VECTEUR1 T1,
 //+                CDF_CODIF T2
 //+         WHERE  T1.IC1VE_FIC_CODE_FK_PK       = NOFIC
 //+         AND    T1.IC1VE_CDF_VEIC_CODE_FK_PK  = T2.CDF_CODE_PK
 //+         AND    T2.CDF_NUMERO_PK              = 'MV'
 //+         UNION
 //+         SELECT '04'        AS TYP          ,
 //+                NULL        AS VALEUR_1     ,
 //+                SP_NOM      AS DATA_1       ,
 //+                0           AS NOORD
 //+         FROM   SP_SPECIALITE t1
 //+         WHERE  t1.SP_CODE_SQ_PK = ID_T2
 //+         UNION
 //+         SELECT '05'                        AS TYP       ,
 //+                T1.ICCT2_CONCENTRATION2     AS VALEUR_1  ,
 //+                T2.CDF_NOM                  AS DATA_1    ,
 //+                T1.ICCT2_NUMORD             AS NOORD
 //+         FROM   ICCT2_CONCENTRATION2 T1,
 //+                CDF_CODIF T2
 //+         WHERE  T1.ICCT2_FIC_CODE_FK_PK     = NOFIC
 //+         AND    T1.ICCT2_CDF_UDOSE_CODE_FK  = T2.CDF_CODE_PK
 //+         AND    T2.CDF_NUMERO_PK            = '19'
 //+         UNION
 //+         SELECT '06'         AS TYP        ,
 //+                NULL         AS VALEUR_1   ,
 //+                t2.CDF_NOM   AS DATA_1     ,
 //+                0            AS NOORD
 //+         FROM   IC2VE_INCOMPATIBILITE_VECTEUR2 T1,
 //+                CDF_CODIF T2
 //+         WHERE  T1.IC2VE_FIC_CODE_FK_PK       = NOFIC
 //+         AND    T1.IC2VE_CDF_VEIC_CODE_FK_PK  = T2.CDF_CODE_PK
 //+         AND    T2.CDF_NUMERO_PK              = 'MV'
 //+         UNION
 //+         SELECT  '07'       AS   TYP        ,
 //+                 NULL             AS   VALEUR_1   ,
 //+                 t2.CDF_NOM       AS   DATA_1     ,
 //+                 t1.ICDUR_NUMORD  AS   NOORD
 //+         FROM    ICDUR_INCOMPATIBILITE_DUREE t1,
 //+                 CDF_CODIF              t2
 //+         WHERE   t1.ICDUR_FIC_CODE_FK_PK         = NOFIC
 //+         AND   t1.ICDUR_CDF_DUR_CODE_FK_PK     = t2.CDF_CODE_PK
 //+         AND     t2.CDF_NUMERO_PK                = 'MD'
 //+         UNION
 //+         SELECT  '08'        AS   TYP        ,
 //+                 NULL              AS   VALEUR_1   ,
 //+                 t2.CDF_NOM        AS   DATA_1     ,
 //+                 t1.ICNA_NUMORD    AS   NOORD
 //+         FROM    ICNA_INCOMPATIBILITE_NATURE t1,
 //+                 CDF_CODIF       t2
 //+         WHERE   t1.ICNA_FIC_CODE_FK_PK          = NOFIC
 //+         AND   t1.ICNA_CDF_NAIC_CODE_FK_PK    = t2.CDF_CODE_PK
 //+         AND     t2.CDF_NUMERO_PK                = 'MN'
 //+         UNION
 //+         SELECT  '09'       AS   TYP        ,
 //+                 NULL             AS   VALEUR_1   ,
 //+                 t2.CDF_NOM       AS   DATA_1     ,
 //+                 t1.ICTMP_NUMORD  AS   NOORD
 //+         FROM    ICTMP_INCOMPA_TEMPERATURE t1,
 //+                 CDF_CODIF     t2
 //+         WHERE   t1.ICTMP_FIC_CODE_FK_PK         = NOFIC
 //+         AND   t1.ICTMP_CDF_TEMP_CODE_FK_PK   = t2.CDF_CODE_PK
 //+         AND     t2.CDF_NUMERO_PK                = 'MT'
 //+         UNION
 //+         SELECT  '10'       AS   TYP        ,
 //+                 NULL       AS   VALEUR_1   ,
 //+                 t2.CDF_NOM         AS   DATA_1     ,
 //+                 t1.ICLUM_NUMORD    AS   NOORD
 //+         FROM    ICLUM_INCOMPATIBILITE_LUMIERE t1,
 //+                 CDF_CODIF         t2
 //+         WHERE   t1.ICLUM_FIC_CODE_FK_PK         = NOFIC
 //+         AND   t1.ICLUM_CDF_LUM_CODE_FK_PK     = t2.CDF_CODE_PK
 //+         AND     t2.CDF_NUMERO_PK                = 'ML'
 //+         UNION
 //+         SELECT  '11'       AS   TYP        ,
 //+                 NULL             AS   VALEUR_1   ,
 //+                 t2.CDF_NOM       AS   DATA_1     ,
 //+                 0                AS   NOORD
 //+         FROM    ICMA_INCOMPATIBILITE_MATERIAU t1,
 //+                 CDF_CODIF         t2
 //+         WHERE   t1.ICMA_FIC_CODE_FK_PK        = NOFIC
 //+         AND   t1.ICMA_CDF_MAIC_CODE_FK_PK   = t2.CDF_CODE_PK
 //+         AND     t2.CDF_NUMERO_PK              = '09'
 //+         UNION
 //+         SELECT  '12'       AS   TYP        ,
 //+                 NULL             AS   VALEUR_1   ,
 //+                 t2.CDF_NOM       AS   DATA_1     ,
 //+                 0                AS   NOORD
 //+         FROM    ICCO_INCOMPATIBILITE_CONTENANT   t1,
 //+                 CDF_CODIF            t2
 //+         WHERE   t1.ICCO_FIC_CODE_FK_PK        = NOFIC
 //+         AND  t1.ICCO_CDF_COIC_CODE_FK_PK   = t2.CDF_CODE_PK
 //+         AND     t2.CDF_NUMERO_PK              = '04'
 //+         ORDER BY 1;
                sql_query += " SELECT '01'        AS TYP          ,"
                     " NULL        AS VALEUR_1     ,"
                     " SP_NOM      AS DATA_1       ,"
                     " 0           AS NOORD"
                     " FROM   sp_specialite t1"
                     " WHERE  t1.SP_CODE_SQ_PK  = '"+ QString::number( ID_T1 ) +"'"
                     " UNION"
                     " SELECT '02'                        AS TYP       ,"
                     " T1.ICCT1_CONCENTRATION1     AS VALEUR_1  ,"
                     " T2.CDF_NOM                  AS DATA_1    ,"
                     " T1.ICCT1_NUMORD             AS NOORD"
                     " FROM   icct1_concentration1 T1,"
                     " cdf_codif T2"
                     " WHERE  T1.ICCT1_FIC_CODE_FK_PK      = '"+ QString::number( NOFIC ) +"'"
                     " AND    T1.ICCT1_CDF_UDOSE_CODE_FK  = T2.CDF_CODE_PK"
                     " AND    T2.CDF_NUMERO_PK            = '19'"
                     " UNION"
                     " SELECT '03'         AS TYP        ,"
                     " NULL         AS VALEUR_1   ,"
                     " t2.CDF_NOM   AS DATA_1     ,"
                     " 0            AS NOORD"
                     " FROM   ic1ve_incompatibilite_vecteur1 T1,"
                     " cdf_codif T2"
                     " WHERE  T1.IC1VE_FIC_CODE_FK_PK        = '"+ QString::number( NOFIC ) +"'"
                     " AND    T1.IC1VE_CDF_VEIC_CODE_FK_PK  = T2.CDF_CODE_PK"
                     " AND    T2.CDF_NUMERO_PK              = 'MV'"
                     " UNION"
                     " SELECT '04'        AS TYP          ,"
                     " NULL        AS VALEUR_1     ,"
                     " SP_NOM      AS DATA_1       ,"
                     " 0           AS NOORD"
                     " FROM   sp_specialite t1"
                     " WHERE  t1.SP_CODE_SQ_PK  = '"+ QString::number( ID_T2 ) +"'"
                     " UNION"
                     " SELECT '05'                        AS TYP       ,"
                     " T1.ICCT2_CONCENTRATION2     AS VALEUR_1  ,"
                     " T2.CDF_NOM                  AS DATA_1    ,"
                     " T1.ICCT2_NUMORD             AS NOORD"
                     " FROM   icct2_concentration2 T1,"
                     " cdf_codif T2"
                     " WHERE  T1.ICCT2_FIC_CODE_FK_PK      = '"+ QString::number( NOFIC ) +"'"
                     " AND    T1.ICCT2_CDF_UDOSE_CODE_FK  = T2.CDF_CODE_PK"
                     " AND    T2.CDF_NUMERO_PK            = '19'"
                     " UNION"
                     " SELECT '06'         AS TYP        ,"
                     " NULL         AS VALEUR_1   ,"
                     " t2.CDF_NOM   AS DATA_1     ,"
                     " 0            AS NOORD"
                     " FROM   ic2ve_incompatibilite_vecteur2 T1,"
                     " cdf_codif T2"
                     " WHERE  T1.IC2VE_FIC_CODE_FK_PK        = '"+ QString::number( NOFIC ) +"'"
                     " AND    T1.IC2VE_CDF_VEIC_CODE_FK_PK  = T2.CDF_CODE_PK"
                     " AND    T2.CDF_NUMERO_PK              = 'MV'"
                     " UNION"
                     " SELECT  '07'       AS   TYP        ,"
                     " NULL             AS   VALEUR_1   ,"
                     " t2.CDF_NOM       AS   DATA_1     ,"
                     " t1.ICDUR_NUMORD  AS   NOORD"
                     " FROM    icdur_incompatibilite_duree t1,"
                     " cdf_codif              t2"
                     " WHERE   t1.ICDUR_FIC_CODE_FK_PK          = '"+ QString::number( NOFIC ) +"'"
                     " AND   t1.ICDUR_CDF_DUR_CODE_FK_PK     = t2.CDF_CODE_PK"
                     " AND     t2.CDF_NUMERO_PK                = 'MD'"
                     " UNION"
                     " SELECT  '08'        AS   TYP        ,"
                     " NULL              AS   VALEUR_1   ,"
                     " t2.CDF_NOM        AS   DATA_1     ,"
                     " t1.ICNA_NUMORD    AS   NOORD"
                     " FROM    icna_incompatibilite_nature t1,"
                     " cdf_codif       t2"
                     " WHERE   t1.ICNA_FIC_CODE_FK_PK           = '"+ QString::number( NOFIC ) +"'"
                     " AND   t1.ICNA_CDF_NAIC_CODE_FK_PK    = t2.CDF_CODE_PK"
                     " AND     t2.CDF_NUMERO_PK                = 'MN'"
                     " UNION"
                     " SELECT  '09'       AS   TYP        ,"
                     " NULL             AS   VALEUR_1   ,"
                     " t2.CDF_NOM       AS   DATA_1     ,"
                     " t1.ICTMP_NUMORD  AS   NOORD"
                     " FROM    ictmp_incompa_temperature t1,"
                     " cdf_codif     t2"
                     " WHERE   t1.ICTMP_FIC_CODE_FK_PK          = '"+ QString::number( NOFIC ) +"'"
                     " AND   t1.ICTMP_CDF_TEMP_CODE_FK_PK   = t2.CDF_CODE_PK"
                     " AND     t2.CDF_NUMERO_PK                = 'MT'"
                     " UNION"
                     " SELECT  '10'       AS   TYP        ,"
                     " NULL       AS   VALEUR_1   ,"
                     " t2.CDF_NOM         AS   DATA_1     ,"
                     " t1.ICLUM_NUMORD    AS   NOORD"
                     " FROM    iclum_incompatibilite_lumiere t1,"
                     " cdf_codif         t2"
                     " WHERE   t1.ICLUM_FIC_CODE_FK_PK          = '"+ QString::number( NOFIC ) +"'"
                     " AND   t1.ICLUM_CDF_LUM_CODE_FK_PK     = t2.CDF_CODE_PK"
                     " AND     t2.CDF_NUMERO_PK                = 'ML'"
                     " UNION"
                     " SELECT  '11'       AS   TYP        ,"
                     " NULL             AS   VALEUR_1   ,"
                     " t2.CDF_NOM       AS   DATA_1     ,"
                     " 0                AS   NOORD"
                     " FROM    icma_incompatibilite_materiau t1,"
                     " cdf_codif         t2"
                     " WHERE   t1.ICMA_FIC_CODE_FK_PK         = '"+ QString::number( NOFIC ) +"'"
                     " AND   t1.ICMA_CDF_MAIC_CODE_FK_PK   = t2.CDF_CODE_PK"
                     " AND     t2.CDF_NUMERO_PK              = '09'"
                     " UNION"
                     " SELECT  '12'       AS   TYP        ,"
                     " NULL             AS   VALEUR_1   ,"
                     " t2.CDF_NOM       AS   DATA_1     ,"
                     " 0                AS   NOORD"
                     " FROM    icco_incompatibilite_contenant   t1,"
                     " cdf_codif            t2"
                     " WHERE   t1.ICCO_FIC_CODE_FK_PK         = '"+ QString::number( NOFIC ) +"'"
                     " AND  t1.ICCO_CDF_COIC_CODE_FK_PK   = t2.CDF_CODE_PK"
                     " AND     t2.CDF_NUMERO_PK              = '04'"
                     " ORDER BY 1;";
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_INCOMP_DET() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_TYP      = value(0).toString();
                m_VALEUR_1 = value(1).toString();
                m_DATA_1   = value(2).toString();
                m_NOORD    = value(3).toDouble();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      QString TYP()      {return m_TYP;}
      QString VALEUR_1() {return m_VALEUR_1;}
      QString DATA_1()   {return m_DATA_1;}
      double  NOORD()    {return m_NOORD;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      QString m_TYP;
      QString m_VALEUR_1;
      QString m_DATA_1;
      double  m_NOORD;
 };

 //================================== C_GET_THE_INC_CUR   -65- ==================================
 /****************************************************************************
 *   Nom           :  GET_THE_INCOMP_ID
 -----------------------------------------------------------------------------
 *   Date creation : 08/08/2008
 -----------------------------------------------------------------------------
 *   Description   :  cette procédure renvoie pour une liste d'id de specialite
 *                    les fiches compatibilité ou incomptabilité associé
 *   MAJ           :  10/10/2008
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_INC_CUR  C_GET_THE_INC ( database(), this );
      while ( C_GET_THE_INC.next( Code1 , Code2 , TypIC , TypId  ) )
            { html += tr("<br><b> GET_THE_INC : </b>  ") + C_GET_THE_INC.MEMBER();
            }
  */
  class C_GET_THE_INC_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_INC_CUR ---------------------
      C_GET_THE_INC_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( QString Code1 , QString Code2 , QString TypIC , double TypId )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............
       if ( TypId == 1) {

 //+     SELECT  t3.FIC_CODE_SQ_PK        AS IDFIC   ,
 //+       t3.FIC_TYPE              AS TYPEIC  ,
 //+       t3.FIC_TEXTE             AS TEXTEIC ,
 //+       t3.FIC_DATECR            AS DATECR  ,
 //+       t3.FIC_DATEMJ            AS DATEMJ
 //+    FROM   FIC_INCOMPATIBILITE      t3
 //+    WHERE  t3.FIC_TYPE  = TypIC
 //+    AND    t3.FIC_CODE_SQ_PK IN (  SELECT  t1.IC1SP_FIC_CODE_FK_PK
 //+    FROM   IC1SP_TERME1SPECIALITE   t1,
 //+       IC2SP_TERME2SPECIALITE      t2
 //+    WHERE  t1.IC1SP_FIC_CODE_FK_PK    =  t2.IC2SP_FIC_CODE_FK_PK
 //+    AND    t1.IC1SP_SP_CODE_FK_PK     =  Code1
 //+    AND    t2.IC2SP_SP_CODE_FK_PK     =  Code2
 //+    UNION
 //+    SELECT t1.IC2SP_FIC_CODE_FK_PK
 //+    FROM   IC2SP_TERME2SPECIALITE   t1,
 //+       IC1SP_TERME1SPECIALITE   t2
 //+    WHERE  t1.IC2SP_FIC_CODE_FK_PK    =  t2.IC1SP_FIC_CODE_FK_PK
 //+    AND    t1.IC2SP_SP_CODE_FK_PK     =  Code1
 //+    AND    t2.IC1SP_SP_CODE_FK_PK     =  Code2 ) ;
                sql_query += " SELECT  t3.FIC_CODE_SQ_PK        AS IDFIC   ,"
                     " t3.FIC_TYPE              AS TYPEIC  ,"
                     " t3.FIC_TEXTE             AS TEXTEIC ,"
                     " t3.FIC_DATECR            AS DATECR  ,"
                     " t3.FIC_DATEMJ            AS DATEMJ"
                     " FROM   fic_incompatibilite      t3"
                     " WHERE  t3.FIC_TYPE   = '"+TypIC+"'"
                     " AND    t3.FIC_CODE_SQ_PK IN (  SELECT  t1.IC1SP_FIC_CODE_FK_PK"
                     " FROM   ic1sp_terme1specialite   t1,"
                     " ic2sp_terme2specialite      t2"
                     " WHERE  t1.IC1SP_FIC_CODE_FK_PK    =  t2.IC2SP_FIC_CODE_FK_PK"
                     " AND    t1.IC1SP_SP_CODE_FK_PK      = '"+Code1+"'"
                     " AND    t2.IC2SP_SP_CODE_FK_PK      = '"+Code2+"'"
                     " UNION"
                     " SELECT t1.IC2SP_FIC_CODE_FK_PK"
                     " FROM   ic2sp_terme2specialite   t1,"
                     " ic1sp_terme1specialite   t2"
                     " WHERE  t1.IC2SP_FIC_CODE_FK_PK    =  t2.IC1SP_FIC_CODE_FK_PK"
                     " AND    t1.IC2SP_SP_CODE_FK_PK      = '"+Code1+"'"
                     " AND    t2.IC1SP_SP_CODE_FK_PK      = '"+Code2+"' ) ;";

       } else if ( TypId == 2) {

 //+       SELECT  t3.FIC_CODE_SQ_PK        AS IDFIC   ,
 //+       t3.FIC_TYPE              AS TYPEIC  ,
 //+       t3.FIC_TEXTE             AS TEXTEIC ,
 //+       t3.FIC_DATECR            AS DATECR  ,
 //+       t3.FIC_DATEMJ            AS DATEMJ
 //+    FROM   FIC_INCOMPATIBILITE      t3
 //+    WHERE  t3.FIC_TYPE  = TypIC
 //+    AND    t3.FIC_CODE_SQ_PK IN (  SELECT  t1.IC1SP_FIC_CODE_FK_PK
 //+    FROM   IC1SP_TERME1SPECIALITE   t1,
 //+       IC2SAC_TERME2SUBACT      t2
 //+    WHERE  t1.IC1SP_FIC_CODE_FK_PK    =  t2.IC2SAC_FIC_CODE_FK_PK
 //+    AND    t1.IC1SP_SP_CODE_FK_PK     =  Code1
 //+    AND    t2.IC2SAC_SAC_CODE_FK_PK   =  Code2
 //+    UNION
 //+    SELECT t1.IC2SP_FIC_CODE_FK_PK
 //+    FROM   IC2SP_TERME2SPECIALITE   t1,
 //+       IC1SAC_TERME1SUBACT      t2
 //+    WHERE  t1.IC2SP_FIC_CODE_FK_PK    =  t2.IC1SAC_FIC_CODE_FK_PK
 //+    AND    t1.IC2SP_SP_CODE_FK_PK     =  Code1
 //+    AND    t2.IC1SAC_SAC_CODE_FK_PK   =  Code2
 //+    );
                sql_query += " SELECT  t3.FIC_CODE_SQ_PK        AS IDFIC   ,"
                     " t3.FIC_TYPE              AS TYPEIC  ,"
                     " t3.FIC_TEXTE             AS TEXTEIC ,"
                     " t3.FIC_DATECR            AS DATECR  ,"
                     " t3.FIC_DATEMJ            AS DATEMJ"
                     " FROM   fic_incompatibilite      t3"
                     " WHERE  t3.FIC_TYPE   = '"+TypIC+"'"
                     " AND    t3.FIC_CODE_SQ_PK IN (  SELECT  t1.IC1SP_FIC_CODE_FK_PK"
                     " FROM   ic1sp_terme1specialite   t1,"
                     " ic2sac_terme2subact      t2"
                     " WHERE  t1.IC1SP_FIC_CODE_FK_PK    =  t2.IC2SAC_FIC_CODE_FK_PK"
                     " AND    t1.IC1SP_SP_CODE_FK_PK      = '"+Code1+"'"
                     " AND    t2.IC2SAC_SAC_CODE_FK_PK    = '"+Code2+"'"
                     " UNION"
                     " SELECT t1.IC2SP_FIC_CODE_FK_PK"
                     " FROM   ic2sp_terme2specialite   t1,"
                     " ic1sac_terme1subact      t2"
                     " WHERE  t1.IC2SP_FIC_CODE_FK_PK    =  t2.IC1SAC_FIC_CODE_FK_PK"
                     " AND    t1.IC2SP_SP_CODE_FK_PK      = '"+Code1+"'"
                     " AND    t2.IC1SAC_SAC_CODE_FK_PK    = '"+Code2+"'"
                     " );";

       } else if ( TypId == 3) {

 //+   SELECT t3.FIC_CODE_SQ_PK        AS IDFIC   ,
 //+      t3.FIC_TYPE              AS TYPEIC  ,
 //+      t3.FIC_TEXTE             AS TEXTEIC ,
 //+      t3.FIC_DATECR            AS DATECR  ,
 //+      t3.FIC_DATEMJ            AS DATEMJ
 //+   FROM   FIC_INCOMPATIBILITE      t3
 //+   WHERE  t3.FIC_TYPE  = TypIC
 //+   AND    t3.FIC_CODE_SQ_PK IN (  SELECT  t1.IC1SP_FIC_CODE_FK_PK
 //+   FROM   IC1SP_TERME1SPECIALITE   t1,
 //+          IC2SAU_TERME2SUBAUX      t2
 //+   WHERE  t1.IC1SP_FIC_CODE_FK_PK    =  t2.IC2SAU_FIC_CODE_FK_PK
 //+   AND    t1.IC1SP_SP_CODE_FK_PK     =  Code1
 //+   AND    t2.IC2SAU_SAU_CODE_FK_PK   =  Code2
 //+   UNION
 //+   SELECT  t1.IC2SP_FIC_CODE_FK_PK
 //+   FROM    IC2SP_TERME2SPECIALITE   t1,
 //+           IC1SAU_TERME1SUBAUX      t2
 //+   WHERE   t1.IC2SP_FIC_CODE_FK_PK    =  t2.IC1SAU_FIC_CODE_FK_PK
 //+   AND     t1.IC2SP_SP_CODE_FK_PK     =  Code1
 //+   AND     t2.IC1SAU_SAU_CODE_FK_PK   =  Code2 );
                sql_query += " SELECT t3.FIC_CODE_SQ_PK        AS IDFIC   ,"
                     " t3.FIC_TYPE              AS TYPEIC  ,"
                     " t3.FIC_TEXTE             AS TEXTEIC ,"
                     " t3.FIC_DATECR            AS DATECR  ,"
                     " t3.FIC_DATEMJ            AS DATEMJ"
                     " FROM   fic_incompatibilite      t3"
                     " WHERE  t3.FIC_TYPE   = '"+TypIC+"'"
                     " AND    t3.FIC_CODE_SQ_PK IN (  SELECT  t1.IC1SP_FIC_CODE_FK_PK"
                     " FROM   ic1sp_terme1specialite   t1,"
                     " ic2sau_terme2subaux      t2"
                     " WHERE  t1.IC1SP_FIC_CODE_FK_PK    =  t2.IC2SAU_FIC_CODE_FK_PK"
                     " AND    t1.IC1SP_SP_CODE_FK_PK      = '"+Code1+"'"
                     " AND    t2.IC2SAU_SAU_CODE_FK_PK    = '"+Code2+"'"
                     " UNION"
                     " SELECT  t1.IC2SP_FIC_CODE_FK_PK"
                     " FROM    ic2sp_terme2specialite   t1,"
                     " ic1sau_terme1subaux      t2"
                     " WHERE   t1.IC2SP_FIC_CODE_FK_PK    =  t2.IC1SAU_FIC_CODE_FK_PK"
                     " AND     t1.IC2SP_SP_CODE_FK_PK      = '"+Code1+"'"
                     " AND     t2.IC1SAU_SAU_CODE_FK_PK    = '"+Code2+"' );";

       } else if ( TypId == 4) {

 //+   SELECT  t3.FIC_CODE_SQ_PK        AS IDFIC   ,
 //+       t3.FIC_TYPE              AS TYPEIC  ,
 //+       t3.FIC_TEXTE             AS TEXTEIC ,
 //+       t3.FIC_DATECR            AS DATECR  ,
 //+       t3.FIC_DATEMJ            AS DATEMJ
 //+   FROM    FIC_INCOMPATIBILITE      t3
 //+   WHERE   t3.FIC_TYPE  = TypIC
 //+   AND     t3.FIC_CODE_SQ_PK IN ( SELECT  t1.IC1SP_FIC_CODE_FK_PK
 //+   FROM    IC1SP_TERME1SPECIALITE   t1,
 //+       IC2VE_INCOMPATIBILITE_VECTEUR2      t2
 //+   WHERE   t1.IC1SP_FIC_CODE_FK_PK       =  t2.IC2VE_FIC_CODE_FK_PK
 //+   AND     t1.IC1SP_SP_CODE_FK_PK        =  Code1
 //+   AND     t2.IC2VE_CDF_VEIC_CODE_FK_PK  =  Code2
 //+   UNION
 //+   SELECT  t1.IC2SP_FIC_CODE_FK_PK
 //+   FROM    IC2SP_TERME2SPECIALITE   t1,
 //+       IC1VE_INCOMPATIBILITE_VECTEUR1      t2
 //+   WHERE   t1.IC2SP_FIC_CODE_FK_PK      =  t2.IC1VE_FIC_CODE_FK_PK
 //+   AND     t1.IC2SP_SP_CODE_FK_PK       =  Code1
 //+   AND     t2.IC1VE_CDF_VEIC_CODE_FK_PK =  Code2
 //+   UNION
 //+   SELECT  t1.IC1SP_FIC_CODE_FK_PK
 //+   FROM    IC1SP_TERME1SPECIALITE   t1,
 //+       IC1VE_INCOMPATIBILITE_VECTEUR1      t2
 //+   WHERE   t1.IC1SP_FIC_CODE_FK_PK      =  t2.IC1VE_FIC_CODE_FK_PK
 //+   AND     t1.IC1SP_SP_CODE_FK_PK       =  Code1
 //+   AND     t2.IC1VE_CDF_VEIC_CODE_FK_PK =  Code2);
                sql_query += " SELECT  t3.FIC_CODE_SQ_PK        AS IDFIC   ,"
                     " t3.FIC_TYPE              AS TYPEIC  ,"
                     " t3.FIC_TEXTE             AS TEXTEIC ,"
                     " t3.FIC_DATECR            AS DATECR  ,"
                     " t3.FIC_DATEMJ            AS DATEMJ"
                     " FROM    fic_incompatibilite      t3"
                     " WHERE   t3.FIC_TYPE   = '"+TypIC+"'"
                     " AND     t3.FIC_CODE_SQ_PK IN ( SELECT  t1.IC1SP_FIC_CODE_FK_PK"
                     " FROM    ic1sp_terme1specialite   t1,"
                     " ic2ve_incompatibilite_vecteur2      t2"
                     " WHERE   t1.IC1SP_FIC_CODE_FK_PK       =  t2.IC2VE_FIC_CODE_FK_PK"
                     " AND     t1.IC1SP_SP_CODE_FK_PK         = '"+Code1+"'"
                     " AND     t2.IC2VE_CDF_VEIC_CODE_FK_PK   = '"+Code2+"'"
                     " UNION"
                     " SELECT  t1.IC2SP_FIC_CODE_FK_PK"
                     " FROM    ic2sp_terme2specialite   t1,"
                     " ic1ve_incompatibilite_vecteur1      t2"
                     " WHERE   t1.IC2SP_FIC_CODE_FK_PK      =  t2.IC1VE_FIC_CODE_FK_PK"
                     " AND     t1.IC2SP_SP_CODE_FK_PK        = '"+Code1+"'"
                     " AND     t2.IC1VE_CDF_VEIC_CODE_FK_PK  = '"+Code2+"'"
                     " UNION"
                     " SELECT  t1.IC1SP_FIC_CODE_FK_PK"
                     " FROM    ic1sp_terme1specialite   t1,"
                     " ic1ve_incompatibilite_vecteur1      t2"
                     " WHERE   t1.IC1SP_FIC_CODE_FK_PK      =  t2.IC1VE_FIC_CODE_FK_PK"
                     " AND     t1.IC1SP_SP_CODE_FK_PK        = '"+Code1+"'"
                     " AND     t2.IC1VE_CDF_VEIC_CODE_FK_PK  = '"+Code2+"');";

       } else if ( TypId == 5) {

 //+   SELECT  t3.FIC_CODE_SQ_PK        AS IDFIC   ,
 //+       t3.FIC_TYPE              AS TYPEIC  ,
 //+       t3.FIC_TEXTE             AS TEXTEIC ,
 //+       t3.FIC_DATECR            AS DATECR  ,
 //+       t3.FIC_DATEMJ            AS DATEMJ
 //+   FROM    FIC_INCOMPATIBILITE      t3
 //+   WHERE   t3.FIC_TYPE  = TypIC
 //+   AND     t3.FIC_CODE_SQ_PK IN (  SELECT t1.IC1SP_FIC_CODE_FK_PK
 //+   FROM    IC1SP_TERME1SPECIALITE   t1,
 //+           ICCO_INCOMPATIBILITE_CONTENANT      t2
 //+   WHERE   t1.IC1SP_FIC_CODE_FK_PK        =   t2.ICCO_FIC_CODE_FK_PK
 //+   AND     t1.IC1SP_SP_CODE_FK_PK         =  Code1
 //+   AND     t2.ICCO_CDF_COIC_CODE_FK_PK    =  Code2
 //+   UNION
 //+   SELECT  t1.IC2SP_FIC_CODE_FK_PK
 //+   FROM    IC2SP_TERME2SPECIALITE          t1,
 //+           ICCO_INCOMPATIBILITE_CONTENANT  t2
 //+   WHERE   t1.IC2SP_FIC_CODE_FK_PK       =   t2.ICCO_FIC_CODE_FK_PK
 //+   AND     t1.IC2SP_SP_CODE_FK_PK        =  Code1
 //+   AND     t2.ICCO_CDF_COIC_CODE_FK_PK   =  Code2 ) ;
                sql_query += " SELECT  t3.FIC_CODE_SQ_PK        AS IDFIC   ,"
                     " t3.FIC_TYPE              AS TYPEIC  ,"
                     " t3.FIC_TEXTE             AS TEXTEIC ,"
                     " t3.FIC_DATECR            AS DATECR  ,"
                     " t3.FIC_DATEMJ            AS DATEMJ"
                     " FROM    fic_incompatibilite      t3"
                     " WHERE   t3.FIC_TYPE   = '"+TypIC+"'"
                     " AND     t3.FIC_CODE_SQ_PK IN (  SELECT t1.IC1SP_FIC_CODE_FK_PK"
                     " FROM    ic1sp_terme1specialite   t1,"
                     " icco_incompatibilite_contenant      t2"
                     " WHERE   t1.IC1SP_FIC_CODE_FK_PK        =   t2.ICCO_FIC_CODE_FK_PK"
                     " AND     t1.IC1SP_SP_CODE_FK_PK          = '"+Code1+"'"
                     " AND     t2.ICCO_CDF_COIC_CODE_FK_PK     = '"+Code2+"'"
                     " UNION"
                     " SELECT  t1.IC2SP_FIC_CODE_FK_PK"
                     " FROM    ic2sp_terme2specialite          t1,"
                     " icco_incompatibilite_contenant  t2"
                     " WHERE   t1.IC2SP_FIC_CODE_FK_PK       =   t2.ICCO_FIC_CODE_FK_PK"
                     " AND     t1.IC2SP_SP_CODE_FK_PK         = '"+Code1+"'"
                     " AND     t2.ICCO_CDF_COIC_CODE_FK_PK    = '"+Code2+"' ) ;";

       } else if ( TypId == 6) {

 //+   SELECT  t3.FIC_CODE_SQ_PK        AS IDFIC   ,
 //+       t3.FIC_TYPE              AS TYPEIC  ,
 //+       t3.FIC_TEXTE             AS TEXTEIC ,
 //+       t3.FIC_DATECR            AS DATECR  ,
 //+       t3.FIC_DATEMJ            AS DATEMJ
 //+   FROM    FIC_INCOMPATIBILITE      t3
 //+   WHERE   t3.FIC_TYPE  = TypIC
 //+   AND     t3.FIC_CODE_SQ_PK IN (  SELECT  t1.IC1SP_FIC_CODE_FK_PK
 //+   FROM    IC1SP_TERME1SPECIALITE   t1,
 //+           ICMA_INCOMPATIBILITE_MATERIAU       t2
 //+   WHERE   t1.IC1SP_FIC_CODE_FK_PK        =   t2.ICMA_FIC_CODE_FK_PK
 //+   AND     t1.IC1SP_SP_CODE_FK_PK         =  Code1
 //+   AND     t2.ICMA_CDF_MAIC_CODE_FK_PK    =  Code2
 //+   UNION
 //+   SELECT  t1.IC2SP_FIC_CODE_FK_PK
 //+   FROM    IC2SP_TERME2SPECIALITE   t1,
 //+           ICMA_INCOMPATIBILITE_MATERIAU       t2
 //+   WHERE   t1.IC2SP_FIC_CODE_FK_PK       =  t2.ICMA_FIC_CODE_FK_PK
 //+   AND     t1.IC2SP_SP_CODE_FK_PK        =  Code1
 //+   AND     t2.ICMA_CDF_MAIC_CODE_FK_PK   =  Code2 );
                sql_query += " SELECT  t3.FIC_CODE_SQ_PK        AS IDFIC   ,"
                     " t3.FIC_TYPE              AS TYPEIC  ,"
                     " t3.FIC_TEXTE             AS TEXTEIC ,"
                     " t3.FIC_DATECR            AS DATECR  ,"
                     " t3.FIC_DATEMJ            AS DATEMJ"
                     " FROM    fic_incompatibilite      t3"
                     " WHERE   t3.FIC_TYPE   = '"+TypIC+"'"
                     " AND     t3.FIC_CODE_SQ_PK IN (  SELECT  t1.IC1SP_FIC_CODE_FK_PK"
                     " FROM    ic1sp_terme1specialite   t1,"
                     " icma_incompatibilite_materiau       t2"
                     " WHERE   t1.IC1SP_FIC_CODE_FK_PK        =   t2.ICMA_FIC_CODE_FK_PK"
                     " AND     t1.IC1SP_SP_CODE_FK_PK          = '"+Code1+"'"
                     " AND     t2.ICMA_CDF_MAIC_CODE_FK_PK     = '"+Code2+"'"
                     " UNION"
                     " SELECT  t1.IC2SP_FIC_CODE_FK_PK"
                     " FROM    ic2sp_terme2specialite   t1,"
                     " icma_incompatibilite_materiau       t2"
                     " WHERE   t1.IC2SP_FIC_CODE_FK_PK       =  t2.ICMA_FIC_CODE_FK_PK"
                     " AND     t1.IC2SP_SP_CODE_FK_PK         = '"+Code1+"'"
                     " AND     t2.ICMA_CDF_MAIC_CODE_FK_PK    = '"+Code2+"' );";

       } else if ( TypId == 7) {

 //+   SELECT  t3.FIC_CODE_SQ_PK        AS IDFIC   ,
 //+       t3.FIC_TYPE              AS TYPEIC  ,
 //+       t3.FIC_TEXTE             AS TEXTEIC ,
 //+       t3.FIC_DATECR            AS DATECR  ,
 //+       t3.FIC_DATEMJ            AS DATEMJ
 //+   FROM    FIC_INCOMPATIBILITE      t3
 //+   WHERE   t3.FIC_TYPE  = TypIC
 //+   AND     t3.FIC_CODE_SQ_PK IN (  SELECT   t1.IC1SAC_FIC_CODE_FK_PK
 //+   FROM    IC1SAC_TERME1SUBACT                 t1,
 //+           IC2VE_INCOMPATIBILITE_VECTEUR2      t2
 //+   WHERE   t1.IC1SAC_FIC_CODE_FK_PK     =   t2.IC2VE_FIC_CODE_FK_PK
 //+   AND     t1.IC1SAC_SAC_CODE_FK_PK     =  Code1
 //+   AND     t2.IC2VE_CDF_VEIC_CODE_FK_PK =  Code2
 //+   UNION
 //+   SELECT  t1.IC2SAC_FIC_CODE_FK_PK
 //+   FROM    IC2SAC_TERME2SUBACT                 t1,
 //+           IC1VE_INCOMPATIBILITE_VECTEUR1      t2
 //+   WHERE   t1.IC2SAC_FIC_CODE_FK_PK       =  t2.IC1VE_FIC_CODE_FK_PK
 //+   AND     t1.IC2SAC_SAC_CODE_FK_PK       =  Code1
 //+   AND     t2.IC1VE_CDF_VEIC_CODE_FK_PK   =  Code2
 //+   UNION
 //+   SELECT  t1.IC1SAC_FIC_CODE_FK_PK
 //+   FROM    IC1SAC_TERME1SUBACT                 t1,
 //+           IC1VE_INCOMPATIBILITE_VECTEUR1      t2
 //+   WHERE   t1.IC1SAC_FIC_CODE_FK_PK       =  t2.IC1VE_FIC_CODE_FK_PK
 //+   AND     t1.IC1SAC_SAC_CODE_FK_PK       =  Code1
 //+   AND     t2.IC1VE_CDF_VEIC_CODE_FK_PK   =  Code2 );
                sql_query += " SELECT  t3.FIC_CODE_SQ_PK        AS IDFIC   ,"
                     " t3.FIC_TYPE              AS TYPEIC  ,"
                     " t3.FIC_TEXTE             AS TEXTEIC ,"
                     " t3.FIC_DATECR            AS DATECR  ,"
                     " t3.FIC_DATEMJ            AS DATEMJ"
                     " FROM    fic_incompatibilite      t3"
                     " WHERE   t3.FIC_TYPE   = '"+TypIC+"'"
                     " AND     t3.FIC_CODE_SQ_PK IN (  SELECT   t1.IC1SAC_FIC_CODE_FK_PK"
                     " FROM    ic1sac_terme1subact                 t1,"
                     " ic2ve_incompatibilite_vecteur2      t2"
                     " WHERE   t1.IC1SAC_FIC_CODE_FK_PK     =   t2.IC2VE_FIC_CODE_FK_PK"
                     " AND     t1.IC1SAC_SAC_CODE_FK_PK      = '"+Code1+"'"
                     " AND     t2.IC2VE_CDF_VEIC_CODE_FK_PK  = '"+Code2+"'"
                     " UNION"
                     " SELECT  t1.IC2SAC_FIC_CODE_FK_PK"
                     " FROM    ic2sac_terme2subact                 t1,"
                     " ic1ve_incompatibilite_vecteur1      t2"
                     " WHERE   t1.IC2SAC_FIC_CODE_FK_PK       =  t2.IC1VE_FIC_CODE_FK_PK"
                     " AND     t1.IC2SAC_SAC_CODE_FK_PK        = '"+Code1+"'"
                     " AND     t2.IC1VE_CDF_VEIC_CODE_FK_PK    = '"+Code2+"'"
                     " UNION"
                     " SELECT  t1.IC1SAC_FIC_CODE_FK_PK"
                     " FROM    ic1sac_terme1subact                 t1,"
                     " ic1ve_incompatibilite_vecteur1      t2"
                     " WHERE   t1.IC1SAC_FIC_CODE_FK_PK       =  t2.IC1VE_FIC_CODE_FK_PK"
                     " AND     t1.IC1SAC_SAC_CODE_FK_PK        = '"+Code1+"'"
                     " AND     t2.IC1VE_CDF_VEIC_CODE_FK_PK    = '"+Code2+"' );";

       } else if ( TypId == 8) {

 //+   SELECT  t3.FIC_CODE_SQ_PK        AS IDFIC   ,
 //+       t3.FIC_TYPE              AS TYPEIC  ,
 //+       t3.FIC_TEXTE             AS TEXTEIC ,
 //+       t3.FIC_DATECR            AS DATECR  ,
 //+       t3.FIC_DATEMJ            AS DATEMJ
 //+   FROM   FIC_INCOMPATIBILITE      t3
 //+   WHERE  t3.FIC_TYPE  = TypIC
 //+   AND    t3.FIC_CODE_SQ_PK IN (  SELECT  t1.IC1SAC_FIC_CODE_FK_PK
 //+   FROM   IC1SAC_TERME1SUBACT   t1,
 //+          IC2SAC_TERME2SUBACT      t2
 //+   WHERE  t1.IC1SAC_FIC_CODE_FK_PK    =  t2.IC2SAC_FIC_CODE_FK_PK
 //+   AND    t1.IC1SAC_SAC_CODE_FK_PK    =  Code1
 //+   AND    t2.IC2SAC_SAC_CODE_FK_PK    =  Code2
 //+   UNION
 //+   SELECT t1.IC2SAC_FIC_CODE_FK_PK
 //+   FROM   IC2SAC_TERME2SUBACT   t1,
 //+          IC1SAC_TERME1SUBACT  t2
 //+   WHERE  t1.IC2SAC_FIC_CODE_FK_PK    =  t2.IC1SAC_FIC_CODE_FK_PK
 //+   AND    t1.IC2SAC_SAC_CODE_FK_PK    =  Code1
 //+   AND    t2.IC1SAC_SAC_CODE_FK_PK    =  Code2
 //+   ) ;
                sql_query += " SELECT  t3.FIC_CODE_SQ_PK        AS IDFIC   ,"
                     " t3.FIC_TYPE              AS TYPEIC  ,"
                     " t3.FIC_TEXTE             AS TEXTEIC ,"
                     " t3.FIC_DATECR            AS DATECR  ,"
                     " t3.FIC_DATEMJ            AS DATEMJ"
                     " FROM   fic_incompatibilite      t3"
                     " WHERE  t3.FIC_TYPE   = '"+TypIC+"'"
                     " AND    t3.FIC_CODE_SQ_PK IN (  SELECT  t1.IC1SAC_FIC_CODE_FK_PK"
                     " FROM   ic1sac_terme1subact   t1,"
                     " ic2sac_terme2subact      t2"
                     " WHERE  t1.IC1SAC_FIC_CODE_FK_PK    =  t2.IC2SAC_FIC_CODE_FK_PK"
                     " AND    t1.IC1SAC_SAC_CODE_FK_PK     = '"+Code1+"'"
                     " AND    t2.IC2SAC_SAC_CODE_FK_PK     = '"+Code2+"'"
                     " UNION"
                     " SELECT t1.IC2SAC_FIC_CODE_FK_PK"
                     " FROM   ic2sac_terme2subact   t1,"
                     " ic1sac_terme1subact  t2"
                     " WHERE  t1.IC2SAC_FIC_CODE_FK_PK    =  t2.IC1SAC_FIC_CODE_FK_PK"
                     " AND    t1.IC2SAC_SAC_CODE_FK_PK     = '"+Code1+"'"
                     " AND    t2.IC1SAC_SAC_CODE_FK_PK     = '"+Code2+"'"
                     " ) ;";

       } else if ( TypId == 9) {

 //+   SELECT  t3.FIC_CODE_SQ_PK        AS IDFIC   ,
 //+       t3.FIC_TYPE              AS TYPEIC  ,
 //+       t3.FIC_TEXTE             AS TEXTEIC ,
 //+       t3.FIC_DATECR            AS DATECR  ,
 //+       t3.FIC_DATEMJ            AS DATEMJ
 //+   FROM    FIC_INCOMPATIBILITE      t3
 //+   WHERE   t3.FIC_TYPE  = TypIC
 //+   AND     t3.FIC_CODE_SQ_PK IN (  SELECT  t1.IC1SAC_FIC_CODE_FK_PK
 //+   FROM    IC1SAC_TERME1SUBACT                 t1,
 //+           IC2SAU_TERME2SUBAUX                 t2
 //+   WHERE   t1.IC1SAC_FIC_CODE_FK_PK     =   t2.IC2SAU_FIC_CODE_FK_PK
 //+   AND     t1.IC1SAC_SAC_CODE_FK_PK     =  Code1
 //+   AND     t2.IC2SAU_SAU_CODE_FK_PK     =  Code2
 //+   UNION
 //+   SELECT  t1.IC2SAC_FIC_CODE_FK_PK
 //+   FROM    IC2SAC_TERME2SUBACT                 t1,
 //+           IC1SAU_TERME1SUBAUX                 t2
 //+   WHERE   t1.IC2SAC_FIC_CODE_FK_PK       =  t2.IC1SAU_FIC_CODE_FK_PK
 //+   AND     t1.IC2SAC_SAC_CODE_FK_PK       =  Code1
 //+   AND     t2.IC1SAU_SAU_CODE_FK_PK       =  Code2);
                sql_query += " SELECT  t3.FIC_CODE_SQ_PK        AS IDFIC   ,"
                     " t3.FIC_TYPE              AS TYPEIC  ,"
                     " t3.FIC_TEXTE             AS TEXTEIC ,"
                     " t3.FIC_DATECR            AS DATECR  ,"
                     " t3.FIC_DATEMJ            AS DATEMJ"
                     " FROM    fic_incompatibilite      t3"
                     " WHERE   t3.FIC_TYPE   = '"+TypIC+"'"
                     " AND     t3.FIC_CODE_SQ_PK IN (  SELECT  t1.IC1SAC_FIC_CODE_FK_PK"
                     " FROM    ic1sac_terme1subact                 t1,"
                     " ic2sau_terme2subaux                 t2"
                     " WHERE   t1.IC1SAC_FIC_CODE_FK_PK     =   t2.IC2SAU_FIC_CODE_FK_PK"
                     " AND     t1.IC1SAC_SAC_CODE_FK_PK      = '"+Code1+"'"
                     " AND     t2.IC2SAU_SAU_CODE_FK_PK      = '"+Code2+"'"
                     " UNION"
                     " SELECT  t1.IC2SAC_FIC_CODE_FK_PK"
                     " FROM    ic2sac_terme2subact                 t1,"
                     " ic1sau_terme1subaux                 t2"
                     " WHERE   t1.IC2SAC_FIC_CODE_FK_PK       =  t2.IC1SAU_FIC_CODE_FK_PK"
                     " AND     t1.IC2SAC_SAC_CODE_FK_PK        = '"+Code1+"'"
                     " AND     t2.IC1SAU_SAU_CODE_FK_PK        = '"+Code2+"');";

       } else if ( TypId == 10) {

 //+       SELECT  t3.FIC_CODE_SQ_PK        AS IDFIC   ,
 //+       t3.FIC_TYPE              AS TYPEIC  ,
 //+       t3.FIC_TEXTE             AS TEXTEIC ,
 //+       t3.FIC_DATECR            AS DATECR  ,
 //+       t3.FIC_DATEMJ            AS DATEMJ
 //+    FROM   FIC_INCOMPATIBILITE      t3
 //+    WHERE  t3.FIC_TYPE  = TypIC
 //+    AND    t3.FIC_CODE_SQ_PK IN (  SELECT  t1.IC1SAU_FIC_CODE_FK_PK
 //+    FROM   IC1SAU_TERME1SUBAUX    t1,
 //+       IC2SAU_TERME2SUBAUX    t2
 //+    WHERE  t1.IC1SAU_FIC_CODE_FK_PK    =  t2.IC2SAU_FIC_CODE_FK_PK
 //+    AND    t1.IC1SAU_SAU_CODE_FK_PK    =  Code1
 //+    AND    t2.IC2SAU_SAU_CODE_FK_PK    =  Code2
 //+    UNION
 //+    SELECT t1.IC2SAU_FIC_CODE_FK_PK
 //+    FROM   IC2SAU_TERME2SUBAUX   t1,
 //+       IC1SAU_TERME1SUBAUX t2
 //+    WHERE  t1.IC2SAU_FIC_CODE_FK_PK    =  t2.IC1SAU_FIC_CODE_FK_PK
 //+    AND    t1.IC2SAU_SAU_CODE_FK_PK    =  Code1
 //+    AND    t2.IC1SAU_SAU_CODE_FK_PK    =  Code2
 //+      );
                sql_query += " SELECT  t3.FIC_CODE_SQ_PK        AS IDFIC   ,"
                     " t3.FIC_TYPE              AS TYPEIC  ,"
                     " t3.FIC_TEXTE             AS TEXTEIC ,"
                     " t3.FIC_DATECR            AS DATECR  ,"
                     " t3.FIC_DATEMJ            AS DATEMJ"
                     " FROM   fic_incompatibilite      t3"
                     " WHERE  t3.FIC_TYPE   = '"+TypIC+"'"
                     " AND    t3.FIC_CODE_SQ_PK IN (  SELECT  t1.IC1SAU_FIC_CODE_FK_PK"
                     " FROM   ic1sau_terme1subaux    t1,"
                     " ic2sau_terme2subaux    t2"
                     " WHERE  t1.IC1SAU_FIC_CODE_FK_PK    =  t2.IC2SAU_FIC_CODE_FK_PK"
                     " AND    t1.IC1SAU_SAU_CODE_FK_PK     = '"+Code1+"'"
                     " AND    t2.IC2SAU_SAU_CODE_FK_PK     = '"+Code2+"'"
                     " UNION"
                     " SELECT t1.IC2SAU_FIC_CODE_FK_PK"
                     " FROM   ic2sau_terme2subaux   t1,"
                     " ic1sau_terme1subaux t2"
                     " WHERE  t1.IC2SAU_FIC_CODE_FK_PK    =  t2.IC1SAU_FIC_CODE_FK_PK"
                     " AND    t1.IC2SAU_SAU_CODE_FK_PK     = '"+Code1+"'"
                     " AND    t2.IC1SAU_SAU_CODE_FK_PK     = '"+Code2+"'"
                     " );";

       } else if ( TypId == 11) {

 //+   SELECT  t3.FIC_CODE_SQ_PK        AS IDFIC   ,
 //+      t3.FIC_TYPE              AS TYPEIC  ,
 //+       t3.FIC_TEXTE             AS TEXTEIC ,
 //+       t3.FIC_DATECR            AS DATECR  ,
 //+       t3.FIC_DATEMJ            AS DATEMJ
 //+   FROM    FIC_INCOMPATIBILITE      t3
 //+   WHERE   t3.FIC_TYPE  = TypIC
 //+   AND     t3.FIC_CODE_SQ_PK IN (  SELECT  t1.IC1SAU_FIC_CODE_FK_PK
 //+   FROM    IC1SAU_TERME1SUBAUX                 t1,
 //+           IC2VE_INCOMPATIBILITE_VECTEUR2                 t2
 //+   WHERE   t1.IC1SAU_FIC_CODE_FK_PK      =   t2.IC2VE_FIC_CODE_FK_PK
 //+   AND     t1.IC1SAU_SAU_CODE_FK_PK      =  Code1
 //+   AND     t2.IC2VE_CDF_VEIC_CODE_FK_PK  =  Code2
 //+   UNION
 //+   SELECT  t1.IC2SAU_FIC_CODE_FK_PK
 //+   FROM    IC2SAU_TERME2SUBAUX                  t1,
 //+           IC1VE_INCOMPATIBILITE_VECTEUR1       t2
 //+   WHERE   t1.IC2SAU_FIC_CODE_FK_PK       =  t2.IC1VE_FIC_CODE_FK_PK
 //+   AND     t1.IC2SAU_SAU_CODE_FK_PK       =  Code1
 //+   AND     t2.IC1VE_CDF_VEIC_CODE_FK_PK   =  Code2
 //+   UNION
 //+   SELECT  t1.IC1SAU_FIC_CODE_FK_PK
 //+   FROM    IC1SAU_TERME1SUBAUX                  t1,
 //+           IC1VE_INCOMPATIBILITE_VECTEUR1       t2
 //+   WHERE   t1.IC1SAU_FIC_CODE_FK_PK       =  t2.IC1VE_FIC_CODE_FK_PK
 //+   AND     t1.IC1SAU_SAU_CODE_FK_PK       =  Code1
 //+   AND     t2.IC1VE_CDF_VEIC_CODE_FK_PK   =  Code2) ;
                sql_query += " SELECT  t3.FIC_CODE_SQ_PK        AS IDFIC   ,"
                     " t3.FIC_TYPE              AS TYPEIC  ,"
                     " t3.FIC_TEXTE             AS TEXTEIC ,"
                     " t3.FIC_DATECR            AS DATECR  ,"
                     " t3.FIC_DATEMJ            AS DATEMJ"
                     " FROM    fic_incompatibilite      t3"
                     " WHERE   t3.FIC_TYPE   = '"+TypIC+"'"
                     " AND     t3.FIC_CODE_SQ_PK IN (  SELECT  t1.IC1SAU_FIC_CODE_FK_PK"
                     " FROM    ic1sau_terme1subaux                 t1,"
                     " ic2ve_incompatibilite_vecteur2                 t2"
                     " WHERE   t1.IC1SAU_FIC_CODE_FK_PK      =   t2.IC2VE_FIC_CODE_FK_PK"
                     " AND     t1.IC1SAU_SAU_CODE_FK_PK       = '"+Code1+"'"
                     " AND     t2.IC2VE_CDF_VEIC_CODE_FK_PK   = '"+Code2+"'"
                     " UNION"
                     " SELECT  t1.IC2SAU_FIC_CODE_FK_PK"
                     " FROM    ic2sau_terme2subaux                  t1,"
                     " ic1ve_incompatibilite_vecteur1       t2"
                     " WHERE   t1.IC2SAU_FIC_CODE_FK_PK       =  t2.IC1VE_FIC_CODE_FK_PK"
                     " AND     t1.IC2SAU_SAU_CODE_FK_PK        = '"+Code1+"'"
                     " AND     t2.IC1VE_CDF_VEIC_CODE_FK_PK    = '"+Code2+"'"
                     " UNION"
                     " SELECT  t1.IC1SAU_FIC_CODE_FK_PK"
                     " FROM    ic1sau_terme1subaux                  t1,"
                     " ic1ve_incompatibilite_vecteur1       t2"
                     " WHERE   t1.IC1SAU_FIC_CODE_FK_PK       =  t2.IC1VE_FIC_CODE_FK_PK"
                     " AND     t1.IC1SAU_SAU_CODE_FK_PK        = '"+Code1+"'"
                     " AND     t2.IC1VE_CDF_VEIC_CODE_FK_PK    = '"+Code2+"') ;";

       } else if ( TypId == 12) {

 //+   SELECT  t3.FIC_CODE_SQ_PK        AS IDFIC   ,
 //+       t3.FIC_TYPE              AS TYPEIC  ,
 //+       t3.FIC_TEXTE             AS TEXTEIC ,
 //+       t3.FIC_DATECR            AS DATECR  ,
 //+       t3.FIC_DATEMJ            AS DATEMJ
 //+   FROM    FIC_INCOMPATIBILITE      t3
 //+   WHERE   t3.FIC_TYPE  = TypIC
 //+   AND     t3.FIC_CODE_SQ_PK IN (  SELECT   t1.IC1SAC_FIC_CODE_FK_PK
 //+   FROM    IC1SAC_TERME1SUBACT                 t1,
 //+           IC2VE_INCOMPATIBILITE_VECTEUR2      t2
 //+   WHERE   t1.IC1SAC_FIC_CODE_FK_PK     =   t2.IC2VE_FIC_CODE_FK_PK
 //+   AND     t1.IC1SAC_SAC_CODE_FK_PK     =  Code1
 //+   AND     t2.IC2VE_CDF_VEIC_CODE_FK_PK =  Code2
 //+   UNION
 //+   SELECT  t1.IC2SAC_FIC_CODE_FK_PK
 //+   FROM    IC2SAC_TERME2SUBACT                 t1,
 //+           IC1VE_INCOMPATIBILITE_VECTEUR1      t2
 //+   WHERE   t1.IC2SAC_FIC_CODE_FK_PK       =  t2.IC1VE_FIC_CODE_FK_PK
 //+   AND     t1.IC2SAC_SAC_CODE_FK_PK       =  Code1
 //+   AND     t2.IC1VE_CDF_VEIC_CODE_FK_PK   =  Code2 );
                sql_query += " SELECT  t3.FIC_CODE_SQ_PK        AS IDFIC   ,"
                     " t3.FIC_TYPE              AS TYPEIC  ,"
                     " t3.FIC_TEXTE             AS TEXTEIC ,"
                     " t3.FIC_DATECR            AS DATECR  ,"
                     " t3.FIC_DATEMJ            AS DATEMJ"
                     " FROM    fic_incompatibilite      t3"
                     " WHERE   t3.FIC_TYPE   = '"+TypIC+"'"
                     " AND     t3.FIC_CODE_SQ_PK IN (  SELECT   t1.IC1SAC_FIC_CODE_FK_PK"
                     " FROM    ic1sac_terme1subact                 t1,"
                     " ic2ve_incompatibilite_vecteur2      t2"
                     " WHERE   t1.IC1SAC_FIC_CODE_FK_PK     =   t2.IC2VE_FIC_CODE_FK_PK"
                     " AND     t1.IC1SAC_SAC_CODE_FK_PK      = '"+Code1+"'"
                     " AND     t2.IC2VE_CDF_VEIC_CODE_FK_PK  = '"+Code2+"'"
                     " UNION"
                     " SELECT  t1.IC2SAC_FIC_CODE_FK_PK"
                     " FROM    ic2sac_terme2subact                 t1,"
                     " ic1ve_incompatibilite_vecteur1      t2"
                     " WHERE   t1.IC2SAC_FIC_CODE_FK_PK       =  t2.IC1VE_FIC_CODE_FK_PK"
                     " AND     t1.IC2SAC_SAC_CODE_FK_PK        = '"+Code1+"'"
                     " AND     t2.IC1VE_CDF_VEIC_CODE_FK_PK    = '"+Code2+"' );";

       } else if ( TypId == 13) {

 //+   SELECT  t3.FIC_CODE_SQ_PK        AS IDFIC   ,
 //+       t3.FIC_TYPE              AS TYPEIC  ,
 //+       t3.FIC_TEXTE             AS TEXTEIC ,
 //+       t3.FIC_DATECR            AS DATECR  ,
 //+       t3.FIC_DATEMJ            AS DATEMJ
 //+   FROM    FIC_INCOMPATIBILITE      t3
 //+   WHERE   t3.FIC_TYPE  = TypIC
 //+   AND     t3.FIC_CODE_SQ_PK IN (  SELECT   t1.IC1SAC_FIC_CODE_FK_PK
 //+   FROM    IC1SAC_TERME1SUBACT                 t1,
 //+       ICCO_INCOMPATIBILITE_CONTENANT      t2
 //+   WHERE   t1.IC1SAC_FIC_CODE_FK_PK     =   t2.ICCO_FIC_CODE_FK_PK
 //+   AND     t1.IC1SAC_SAC_CODE_FK_PK     =  Code1
 //+   AND     t2.ICCO_CDF_COIC_CODE_FK_PK  =  Code2
 //+   UNION
 //+   SELECT  t1.IC2SAC_FIC_CODE_FK_PK
 //+   FROM    IC2SAC_TERME2SUBACT                 t1,
 //+       ICCO_INCOMPATIBILITE_CONTENANT      t2
 //+   WHERE   t1.IC2SAC_FIC_CODE_FK_PK       =  t2.ICCO_FIC_CODE_FK_PK
 //+   AND     t1.IC2SAC_SAC_CODE_FK_PK       =  Code1
 //+   AND     t2.ICCO_CDF_COIC_CODE_FK_PK    =  Code2 );
                sql_query += " SELECT  t3.FIC_CODE_SQ_PK        AS IDFIC   ,"
                     " t3.FIC_TYPE              AS TYPEIC  ,"
                     " t3.FIC_TEXTE             AS TEXTEIC ,"
                     " t3.FIC_DATECR            AS DATECR  ,"
                     " t3.FIC_DATEMJ            AS DATEMJ"
                     " FROM    fic_incompatibilite      t3"
                     " WHERE   t3.FIC_TYPE   = '"+TypIC+"'"
                     " AND     t3.FIC_CODE_SQ_PK IN (  SELECT   t1.IC1SAC_FIC_CODE_FK_PK"
                     " FROM    ic1sac_terme1subact                 t1,"
                     " icco_incompatibilite_contenant      t2"
                     " WHERE   t1.IC1SAC_FIC_CODE_FK_PK     =   t2.ICCO_FIC_CODE_FK_PK"
                     " AND     t1.IC1SAC_SAC_CODE_FK_PK      = '"+Code1+"'"
                     " AND     t2.ICCO_CDF_COIC_CODE_FK_PK   = '"+Code2+"'"
                     " UNION"
                     " SELECT  t1.IC2SAC_FIC_CODE_FK_PK"
                     " FROM    ic2sac_terme2subact                 t1,"
                     " icco_incompatibilite_contenant      t2"
                     " WHERE   t1.IC2SAC_FIC_CODE_FK_PK       =  t2.ICCO_FIC_CODE_FK_PK"
                     " AND     t1.IC2SAC_SAC_CODE_FK_PK        = '"+Code1+"'"
                     " AND     t2.ICCO_CDF_COIC_CODE_FK_PK     = '"+Code2+"' );";

       } else if ( TypId == 14) {

 //+         SELECT  t3.FIC_CODE_SQ_PK        AS IDFIC   ,
 //+       t3.FIC_TYPE              AS TYPEIC  ,
 //+       t3.FIC_TEXTE             AS TEXTEIC ,
 //+       t3.FIC_DATECR            AS DATECR  ,
 //+       t3.FIC_DATEMJ            AS DATEMJ
 //+   FROM    FIC_INCOMPATIBILITE      t3
 //+   WHERE   t3.FIC_TYPE  = TypIC
 //+   AND     t3.FIC_CODE_SQ_PK IN (  SELECT  t1.IC1SAU_FIC_CODE_FK_PK
 //+   FROM    IC1SAU_TERME1SUBAUX                 t1,
 //+           ICCO_INCOMPATIBILITE_CONTENANT                 t2
 //+   WHERE   t1.IC1SAU_FIC_CODE_FK_PK      =  t2.ICCO_FIC_CODE_FK_PK
 //+   AND     t1.IC1SAU_SAU_CODE_FK_PK      =  Code1
 //+   AND     t2.ICCO_CDF_COIC_CODE_FK_PK   =  Code2
 //+   UNION
 //+   SELECT  t1.IC2SAU_FIC_CODE_FK_PK
 //+   FROM    IC2SAU_TERME2SUBAUX                  t1,
 //+           ICCO_INCOMPATIBILITE_CONTENANT       t2
 //+   WHERE   t1.IC2SAU_FIC_CODE_FK_PK       =  t2.ICCO_FIC_CODE_FK_PK
 //+   AND     t1.IC2SAU_SAU_CODE_FK_PK       =  Code1
 //+   AND     t2.ICCO_CDF_COIC_CODE_FK_PK    =  Code2);
                sql_query += " SELECT  t3.FIC_CODE_SQ_PK        AS IDFIC   ,"
                     " t3.FIC_TYPE              AS TYPEIC  ,"
                     " t3.FIC_TEXTE             AS TEXTEIC ,"
                     " t3.FIC_DATECR            AS DATECR  ,"
                     " t3.FIC_DATEMJ            AS DATEMJ"
                     " FROM    fic_incompatibilite      t3"
                     " WHERE   t3.FIC_TYPE   = '"+TypIC+"'"
                     " AND     t3.FIC_CODE_SQ_PK IN (  SELECT  t1.IC1SAU_FIC_CODE_FK_PK"
                     " FROM    ic1sau_terme1subaux                 t1,"
                     " icco_incompatibilite_contenant                 t2"
                     " WHERE   t1.IC1SAU_FIC_CODE_FK_PK      =  t2.ICCO_FIC_CODE_FK_PK"
                     " AND     t1.IC1SAU_SAU_CODE_FK_PK       = '"+Code1+"'"
                     " AND     t2.ICCO_CDF_COIC_CODE_FK_PK    = '"+Code2+"'"
                     " UNION"
                     " SELECT  t1.IC2SAU_FIC_CODE_FK_PK"
                     " FROM    ic2sau_terme2subaux                  t1,"
                     " icco_incompatibilite_contenant       t2"
                     " WHERE   t1.IC2SAU_FIC_CODE_FK_PK       =  t2.ICCO_FIC_CODE_FK_PK"
                     " AND     t1.IC2SAU_SAU_CODE_FK_PK        = '"+Code1+"'"
                     " AND     t2.ICCO_CDF_COIC_CODE_FK_PK     = '"+Code2+"');";

       } else if ( TypId == 15) {

 //+   SELECT  t3.FIC_CODE_SQ_PK        AS IDFIC   ,
 //+       t3.FIC_TYPE              AS TYPEIC  ,
 //+       t3.FIC_TEXTE             AS TEXTEIC ,
 //+       t3.FIC_DATECR            AS DATECR  ,
 //+       t3.FIC_DATEMJ            AS DATEMJ
 //+   FROM    FIC_INCOMPATIBILITE      t3
 //+   WHERE   t3.FIC_TYPE  = TypIC
 //+   AND     t3.FIC_CODE_SQ_PK IN (  SELECT  t1.IC1SAU_FIC_CODE_FK_PK
 //+   FROM    IC1SAU_TERME1SUBAUX                 t1,
 //+           ICMA_INCOMPATIBILITE_MATERIAU                  t2
 //+   WHERE   t1.IC1SAU_FIC_CODE_FK_PK      =  t2.ICMA_FIC_CODE_FK_PK
 //+   AND     t1.IC1SAU_SAU_CODE_FK_PK      =  Code1
 //+   AND      t2.ICMA_CDF_MAIC_CODE_FK_PK  =  Code2
 //+   UNION
 //+   SELECT  t1.IC2SAU_FIC_CODE_FK_PK
 //+   FROM    IC2SAU_TERME2SUBAUX                  t1,
 //+           ICMA_INCOMPATIBILITE_MATERIAU        t2
 //+   WHERE   t1.IC2SAU_FIC_CODE_FK_PK       =  t2.ICMA_FIC_CODE_FK_PK
 //+   AND     t1.IC2SAU_SAU_CODE_FK_PK       =  Code1
 //+   AND      t2.ICMA_CDF_MAIC_CODE_FK_PK   =  Code2) ;
                sql_query += " SELECT  t3.FIC_CODE_SQ_PK        AS IDFIC   ,"
                     " t3.FIC_TYPE              AS TYPEIC  ,"
                     " t3.FIC_TEXTE             AS TEXTEIC ,"
                     " t3.FIC_DATECR            AS DATECR  ,"
                     " t3.FIC_DATEMJ            AS DATEMJ"
                     " FROM    fic_incompatibilite      t3"
                     " WHERE   t3.FIC_TYPE   = '"+TypIC+"'"
                     " AND     t3.FIC_CODE_SQ_PK IN (  SELECT  t1.IC1SAU_FIC_CODE_FK_PK"
                     " FROM    ic1sau_terme1subaux                 t1,"
                     " icma_incompatibilite_materiau                  t2"
                     " WHERE   t1.IC1SAU_FIC_CODE_FK_PK      =  t2.ICMA_FIC_CODE_FK_PK"
                     " AND     t1.IC1SAU_SAU_CODE_FK_PK       = '"+Code1+"'"
                     " AND      t2.ICMA_CDF_MAIC_CODE_FK_PK   = '"+Code2+"'"
                     " UNION"
                     " SELECT  t1.IC2SAU_FIC_CODE_FK_PK"
                     " FROM    ic2sau_terme2subaux                  t1,"
                     " icma_incompatibilite_materiau        t2"
                     " WHERE   t1.IC2SAU_FIC_CODE_FK_PK       =  t2.ICMA_FIC_CODE_FK_PK"
                     " AND     t1.IC2SAU_SAU_CODE_FK_PK        = '"+Code1+"'"
                     " AND      t2.ICMA_CDF_MAIC_CODE_FK_PK    = '"+Code2+"') ;";

       } else if ( TypId == 16) {

 //+   SELECT  t3.FIC_CODE_SQ_PK        AS IDFIC   ,
 //+       t3.FIC_TYPE              AS TYPEIC  ,
 //+       t3.FIC_TEXTE             AS TEXTEIC ,
 //+       t3.FIC_DATECR            AS DATECR  ,
 //+       t3.FIC_DATEMJ            AS DATEMJ
 //+   FROM    FIC_INCOMPATIBILITE      t3
 //+   WHERE   t3.FIC_TYPE  = TypIC
 //+   AND     t3.FIC_CODE_SQ_PK IN (  SELECT   t1.IC1SAC_FIC_CODE_FK_PK
 //+   FROM    IC1SAC_TERME1SUBACT                 t1,
 //+       ICMA_INCOMPATIBILITE_MATERIAU      t2
 //+   WHERE   t1.IC1SAC_FIC_CODE_FK_PK     =   t2.ICMA_FIC_CODE_FK_PK
 //+   AND     t1.IC1SAC_SAC_CODE_FK_PK     =  Code1
 //+   AND     t2.ICMA_CDF_MAIC_CODE_FK_PK  =  Code2
 //+   UNION
 //+   SELECT  t1.IC2SAC_FIC_CODE_FK_PK
 //+   FROM    IC2SAC_TERME2SUBACT                 t1,
 //+       ICMA_INCOMPATIBILITE_MATERIAU      t2
 //+   WHERE   t1.IC2SAC_FIC_CODE_FK_PK       =  t2.ICMA_FIC_CODE_FK_PK
 //+   AND     t1.IC2SAC_SAC_CODE_FK_PK       =  Code1
 //+   AND     t2.ICMA_CDF_MAIC_CODE_FK_PK    =  Code2 );
                sql_query += " SELECT  t3.FIC_CODE_SQ_PK        AS IDFIC   ,"
                     " t3.FIC_TYPE              AS TYPEIC  ,"
                     " t3.FIC_TEXTE             AS TEXTEIC ,"
                     " t3.FIC_DATECR            AS DATECR  ,"
                     " t3.FIC_DATEMJ            AS DATEMJ"
                     " FROM    fic_incompatibilite      t3"
                     " WHERE   t3.FIC_TYPE   = '"+TypIC+"'"
                     " AND     t3.FIC_CODE_SQ_PK IN (  SELECT   t1.IC1SAC_FIC_CODE_FK_PK"
                     " FROM    ic1sac_terme1subact                 t1,"
                     " icma_incompatibilite_materiau      t2"
                     " WHERE   t1.IC1SAC_FIC_CODE_FK_PK     =   t2.ICMA_FIC_CODE_FK_PK"
                     " AND     t1.IC1SAC_SAC_CODE_FK_PK      = '"+Code1+"'"
                     " AND     t2.ICMA_CDF_MAIC_CODE_FK_PK   = '"+Code2+"'"
                     " UNION"
                     " SELECT  t1.IC2SAC_FIC_CODE_FK_PK"
                     " FROM    ic2sac_terme2subact                 t1,"
                     " icma_incompatibilite_materiau      t2"
                     " WHERE   t1.IC2SAC_FIC_CODE_FK_PK       =  t2.ICMA_FIC_CODE_FK_PK"
                     " AND     t1.IC2SAC_SAC_CODE_FK_PK        = '"+Code1+"'"
                     " AND     t2.ICMA_CDF_MAIC_CODE_FK_PK     = '"+Code2+"' );";

       }
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_INC() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_IDFIC   = value(0).toDouble();
                m_TYPEIC  = value(1).toString();
                m_TEXTEIC = value(2).toString();
                m_DATECR  = value(3).toDate();
                m_DATEMJ  = value(4).toDate();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      double  IDFIC()   {return m_IDFIC;}
      QString TYPEIC()  {return m_TYPEIC;}
      QString TEXTEIC() {return m_TEXTEIC;}
      QDate   DATECR()  {return m_DATECR;}
      QDate   DATEMJ()  {return m_DATEMJ;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      double  m_IDFIC;
      QString m_TYPEIC;
      QString m_TEXTEIC;
      QDate   m_DATECR;
      QDate   m_DATEMJ;
 };

 //================================== C_GET_THE_DET_INC_CUR   -66- ==================================
 /****************************************************************************
 *   Nom           :  GET_THE_DET_INC
 -----------------------------------------------------------------------------
 *   Date creation : 27/08/2008
 -----------------------------------------------------------------------------
 *   Description   :  Cette procédure affiche le détail entrée par entrée
 *                    de la fiche Compatibilité ou incompatibilité dont le
 *                    code est passé paramètre
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_DET_INC_CUR  C_GET_THE_DET_INC ( database(), this );
      while ( C_GET_THE_DET_INC.next( CodeId , TypId  ) )
            { html += tr("<br><b> GET_THE_DET_INC : </b>  ") + C_GET_THE_DET_INC.MEMBER();
            }
  */
  class C_GET_THE_DET_INC_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_DET_INC_CUR ---------------------
      C_GET_THE_DET_INC_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( double CodeId , double TypId )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............
       if ( TypId == 1 ) {

 //+   SELECT t1.ICCT1_CONCENTRATION1||' '||t2.CDF_NOM  AS TEXTDET
 //+   FROM   ICCT1_CONCENTRATION1 t1,
 //+      CDF_CODIF            t2
 //+   WHERE  t1.ICCT1_CDF_UDOSE_CODE_FK = t2.CDF_CODE_PK
 //+   AND    t2.CDF_NUMERO_PK           = '19'
 //+   AND    t1.ICCT1_FIC_CODE_FK_PK    = CodeId ;
                sql_query += " SELECT t1.ICCT1_CONCENTRATION1 't2.CDF_NOM  AS TEXTDET"
                     " FROM   icct1_concentration1 t1,"
                     " cdf_codif            t2"
                     " WHERE  t1.ICCT1_CDF_UDOSE_CODE_FK = t2.CDF_CODE_PK"
                     " AND    t2.CDF_NUMERO_PK           = '19'"
                     " AND    t1.ICCT1_FIC_CODE_FK_PK     = '"+ QString::number( CodeId ) +"' ;";

       } else if ( TypId == 2) {

 //+   SELECT t1.ICCT2_CONCENTRATION2||' '||t2.CDF_NOM  AS TEXTDET
 //+   FROM   ICCT2_CONCENTRATION2 t1,
 //+      CDF_CODIF            t2
 //+   WHERE  t1.ICCT2_CDF_UDOSE_CODE_FK = t2.CDF_CODE_PK
 //+   AND    t2.CDF_NUMERO_PK           = '19'
 //+   AND    t1.ICCT2_FIC_CODE_FK_PK    = CodeId;
                sql_query += " SELECT t1.ICCT2_CONCENTRATION2 't2.CDF_NOM  AS TEXTDET"
                     " FROM   icct2_concentration2 t1,"
                     " cdf_codif            t2"
                     " WHERE  t1.ICCT2_CDF_UDOSE_CODE_FK = t2.CDF_CODE_PK"
                     " AND    t2.CDF_NUMERO_PK           = '19'"
                     " AND    t1.ICCT2_FIC_CODE_FK_PK     = '"+ QString::number( CodeId ) +"';";

       } else if ( TypId == 3) {

 //+   SELECT t2.CDF_NOM    AS TEXTDET
 //+   FROM   ICNA_INCOMPATIBILITE_NATURE t1,
 //+      CDF_CODIF                   t2
 //+   WHERE  t1.ICNA_CDF_NAIC_CODE_FK_PK = t2.CDF_CODE_PK
 //+   AND    t2.CDF_NUMERO_PK            = 'MN'
 //+   AND    t1.ICNA_FIC_CODE_FK_PK      = CodeId ;
                sql_query += " SELECT t2.CDF_NOM    AS TEXTDET"
                     " FROM   icna_incompatibilite_nature t1,"
                     " cdf_codif                   t2"
                     " WHERE  t1.ICNA_CDF_NAIC_CODE_FK_PK = t2.CDF_CODE_PK"
                     " AND    t2.CDF_NUMERO_PK            = 'MN'"
                     " AND    t1.ICNA_FIC_CODE_FK_PK       = '"+ QString::number( CodeId ) +"' ;";

       } else if ( TypId == 4) {

 //+   SELECT t2.CDF_NOM  AS TEXTDET
 //+   FROM   ICDUR_INCOMPATIBILITE_DUREE t1,
 //+      CDF_CODIF                   t2
 //+   WHERE  t1.ICDUR_CDF_DUR_CODE_FK_PK = t2.CDF_CODE_PK
 //+   AND    t2.CDF_NUMERO_PK            = 'MD'
 //+   AND    t1.ICDUR_FIC_CODE_FK_PK     = CodeId ;
                sql_query += " SELECT t2.CDF_NOM  AS TEXTDET"
                     " FROM   icdur_incompatibilite_duree t1,"
                     " cdf_codif                   t2"
                     " WHERE  t1.ICDUR_CDF_DUR_CODE_FK_PK = t2.CDF_CODE_PK"
                     " AND    t2.CDF_NUMERO_PK            = 'MD'"
                     " AND    t1.ICDUR_FIC_CODE_FK_PK      = '"+ QString::number( CodeId ) +"' ;";

       } else if ( TypId == 5) {

 //+   SELECT t2.CDF_NOM  AS TEXTDET
 //+   FROM   ICTMP_INCOMPA_TEMPERATURE  t1,
 //+      CDF_CODIF                  t2
 //+   WHERE  t1.ICTMP_CDF_TEMP_CODE_FK_PK = t2.CDF_CODE_PK
 //+   AND    t2.CDF_NUMERO_PK             = 'MT'
 //+   AND    t1.ICTMP_FIC_CODE_FK_PK      = CodeId ;
                sql_query += " SELECT t2.CDF_NOM  AS TEXTDET"
                     " FROM   ictmp_incompa_temperature  t1,"
                     " cdf_codif                  t2"
                     " WHERE  t1.ICTMP_CDF_TEMP_CODE_FK_PK = t2.CDF_CODE_PK"
                     " AND    t2.CDF_NUMERO_PK             = 'MT'"
                     " AND    t1.ICTMP_FIC_CODE_FK_PK       = '"+ QString::number( CodeId ) +"' ;";

       } else if ( TypId == 6) {

 //+   SELECT t2.CDF_NOM  AS TEXTDET
 //+   FROM   ICLUM_INCOMPATIBILITE_LUMIERE  t1,
 //+      CDF_CODIF                      t2
 //+   WHERE  t1.ICLUM_CDF_LUM_CODE_FK_PK  = t2.CDF_CODE_PK
 //+   AND    t2.CDF_NUMERO_PK             = 'ML'
 //+   AND    t1.ICLUM_FIC_CODE_FK_PK      = CodeId ;
                sql_query += " SELECT t2.CDF_NOM  AS TEXTDET"
                     " FROM   iclum_incompatibilite_lumiere  t1,"
                     " cdf_codif                      t2"
                     " WHERE  t1.ICLUM_CDF_LUM_CODE_FK_PK  = t2.CDF_CODE_PK"
                     " AND    t2.CDF_NUMERO_PK             = 'ML'"
                     " AND    t1.ICLUM_FIC_CODE_FK_PK       = '"+ QString::number( CodeId ) +"' ;";

       } else if ( TypId == 7) {

 //+   SELECT t2.CDF_NOM  AS TEXTDET
 //+   FROM   IC1VE_INCOMPATIBILITE_VECTEUR1  t1,
 //+      CDF_CODIF                       t2
 //+   WHERE  t1.IC1VE_CDF_VEIC_CODE_FK_PK  = t2.CDF_CODE_PK
 //+   AND    t2.CDF_NUMERO_PK              = 'MV'
 //+   AND    t1.IC1VE_FIC_CODE_FK_PK       = CodeId ;
                sql_query += " SELECT t2.CDF_NOM  AS TEXTDET"
                     " FROM   ic1ve_incompatibilite_vecteur1  t1,"
                     " cdf_codif                       t2"
                     " WHERE  t1.IC1VE_CDF_VEIC_CODE_FK_PK  = t2.CDF_CODE_PK"
                     " AND    t2.CDF_NUMERO_PK              = 'MV'"
                     " AND    t1.IC1VE_FIC_CODE_FK_PK        = '"+ QString::number( CodeId ) +"' ;";

       } else if ( TypId == 8) {

 //+   SELECT t2.CDF_NOM  AS TEXTDET
 //+   FROM   IC2VE_INCOMPATIBILITE_VECTEUR2  t1,
 //+      CDF_CODIF                       t2
 //+   WHERE  t1.IC2VE_CDF_VEIC_CODE_FK_PK  = t2.CDF_CODE_PK
 //+   AND    t2.CDF_NUMERO_PK              = 'MV'
 //+   AND    t1.IC2VE_FIC_CODE_FK_PK       = CodeId ;
                sql_query += " SELECT t2.CDF_NOM  AS TEXTDET"
                     " FROM   ic2ve_incompatibilite_vecteur2  t1,"
                     " cdf_codif                       t2"
                     " WHERE  t1.IC2VE_CDF_VEIC_CODE_FK_PK  = t2.CDF_CODE_PK"
                     " AND    t2.CDF_NUMERO_PK              = 'MV'"
                     " AND    t1.IC2VE_FIC_CODE_FK_PK        = '"+ QString::number( CodeId ) +"' ;";

       } else if ( TypId == 9) {

 //+   SELECT t2.CDF_NOM  AS TEXTDET
 //+   FROM   ICMA_INCOMPATIBILITE_MATERIAU   t1 ,
 //+      CDF_CODIF                       t2
 //+   WHERE  t1.ICMA_CDF_MAIC_CODE_FK_PK   = t2.CDF_CODE_PK
 //+   AND    t2.CDF_NUMERO_PK              = '09'
 //+   AND    t1.ICMA_FIC_CODE_FK_PK        = CodeId ;
                sql_query += " SELECT t2.CDF_NOM  AS TEXTDET"
                     " FROM   icma_incompatibilite_materiau   t1 ,"
                     " cdf_codif                       t2"
                     " WHERE  t1.ICMA_CDF_MAIC_CODE_FK_PK   = t2.CDF_CODE_PK"
                     " AND    t2.CDF_NUMERO_PK              = '09'"
                     " AND    t1.ICMA_FIC_CODE_FK_PK         = '"+ QString::number( CodeId ) +"' ;";

       } else if ( TypId == 10) {

 //+   SELECT t2.CDF_NOM  AS TEXTDET
 //+   FROM   ICCO_INCOMPATIBILITE_CONTENANT  t1,
 //+      CDF_CODIF                       t2
 //+   WHERE  t1.ICCO_CDF_COIC_CODE_FK_PK   = t2.CDF_CODE_PK
 //+   AND    t2.CDF_NUMERO_PK              = '04'
 //+   AND    t1.ICCO_FIC_CODE_FK_PK        = CodeId ;
                sql_query += " SELECT t2.CDF_NOM  AS TEXTDET"
                     " FROM   icco_incompatibilite_contenant  t1,"
                     " cdf_codif                       t2"
                     " WHERE  t1.ICCO_CDF_COIC_CODE_FK_PK   = t2.CDF_CODE_PK"
                     " AND    t2.CDF_NUMERO_PK              = '04'"
                     " AND    t1.ICCO_FIC_CODE_FK_PK         = '"+ QString::number( CodeId ) +"' ;";

       }
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_DET_INC() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_TEXTDET = value(0).toString();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      QString TEXTDET() {return m_TEXTDET;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      QString m_TEXTDET;
 };

 //================================== C_GET_THE_CIM10_CUR   -67- ==================================
 /****************************************************************************
 *   Nom           :  GET_THE_CIM10
 -----------------------------------------------------------------------------
 *   Date creation : 28/08/2008
 -----------------------------------------------------------------------------
 *   Description   :  Cette procédure renvoi la codification CIM10 en regard
 *                    de l¿identifiant terrain passé en paramètre.
 *   MAJ           :  18/12/2008  - Anis
                   :  11/02/2009  - Mourad
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_CIM10_CUR  C_GET_THE_CIM10 ( database(), this );
      while ( C_GET_THE_CIM10.next( CodeId  ) )
            { html += tr("<br><b> GET_THE_CIM10 : </b>  ") + C_GET_THE_CIM10.MEMBER();
            }
  */
  class C_GET_THE_CIM10_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_CIM10_CUR ---------------------
      C_GET_THE_CIM10_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( double CodeId )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............

 //+  SELECT CIMCDF_CIM_CODE_FK_PK AS CODE_CIM10,
 //+         CIMCDF_CDF_NUMERO_FK_PK AS CODE_TERRAIN,
 //+     CIM_LIBELLE_COURT,
 //+     CIM_LIBELLE_LONG
 //+  FROM   CIMCDF_CIM10_CODIF,
 //+         CIM10,
 //+      FIN_FICHEINDIC F
 //+  WHERE  CIMCDF_CDF_CODE_FK_PK         = F.FIN_CDF_NAIN_CODE_FK_PK
 //+  AND    CIMCDF_CDF_NUMERO_FK_PK       = 'NN'
 //+  AND    F.FIN_CODE_SQ_PK = CodeId
 //+  AND    CIMCDF_CIM_CODE_FK_PK         = CIM_CODE_PK
 //+  UNION
 //+  SELECT  CIMCDF_CIM_CODE_FK_PK AS CODE_CIM10,
 //+          CIMCDF_CDF_NUMERO_FK_PK AS CODE_TERRAIN ,
 //+      CIM_LIBELLE_COURT,
 //+      CIM_LIBELLE_LONG
 //+  FROM    CIMCDF_CIM10_CODIF,
 //+          CIM10,
 //+      FINCO_FINDCOMMENT
 //+  WHERE   CIMCDF_CDF_CODE_FK_PK   = FINCO_CDF_COIN_CODE_FK_PK
 //+  AND     FINCO_FIN_CODE_FK_PK    = CodeId
 //+  AND     CIMCDF_CDF_NUMERO_FK_PK = 'NC'
 //+  AND     CIMCDF_CIM_CODE_FK_PK   = CIM_CODE_PK
 //+  AND     CIM_CODE_PK NOT IN  ( SELECT  CIMCDF_CIM_CODE_FK_PK
 //+            FROM    CIMCDF_CIM10_CODIF, FIN_FICHEINDIC F
 //+            WHERE   CIMCDF_CDF_CODE_FK_PK         =  F.FIN_CDF_NAIN_CODE_FK_PK
 //+            AND     CIMCDF_CDF_NUMERO_FK_PK       = 'NN'
 //+            AND     F.FIN_CODE_SQ_PK = CodeId)
 //+  UNION
 //+  SELECT CIMCDF_CIM_CODE_FK_PK AS CODE_CIM10,
 //+         CIMCDF_CDF_NUMERO_FK_PK AS CODE_TERRAIN,
 //+     CIM_LIBELLE_COURT,
 //+     CIM_LIBELLE_LONG
 //+  FROM   CIMCDF_CIM10_CODIF,
 //+         CIM10,
 //+     FINCON_FINDCOMMENT_NATURE
 //+  WHERE  CIMCDF_CDF_CODE_FK_PK   = FINCON_CDF_COIN_CODE_FK_PK
 //+  AND    FINCON_FIN_CODE_FK_PK   = CodeId
 //+  AND    CIMCDF_CDF_NUMERO_FK_PK = 'NC'
 //+  AND    CIMCDF_CIM_CODE_FK_PK   = CIM_CODE_PK
 //+  AND    CIM_CODE_PK NOT IN (SELECT CIMCDF_CIM_CODE_FK_PK
 //+           FROM   CIMCDF_CIM10_CODIF,
 //+                  FIN_FICHEINDIC F
 //+           WHERE  CIMCDF_CDF_CODE_FK_PK         = F.FIN_CDF_NAIN_CODE_FK_PK
 //+           AND    CIMCDF_CDF_NUMERO_FK_PK       = 'NN'
 //+           AND    F.FIN_CODE_SQ_PK = CodeId)
 //+  ORDER BY 2 DESC,1;
                sql_query += " SELECT CIMCDF_CIM_CODE_FK_PK AS CODE_CIM10,"
                     " CIMCDF_CDF_NUMERO_FK_PK AS CODE_TERRAIN,"
                     " CIM_LIBELLE_COURT,"
                     " CIM_LIBELLE_LONG"
                     " FROM   cimcdf_cim10_codif,"
                     " cim10,"
                     " fin_ficheindic F"
                     " WHERE  CIMCDF_CDF_CODE_FK_PK         = F.FIN_CDF_NAIN_CODE_FK_PK"
                     " AND    CIMCDF_CDF_NUMERO_FK_PK       = 'NN'"
                     " AND    F.FIN_CODE_SQ_PK  = '"+ QString::number( CodeId ) +"'"
                     " AND    CIMCDF_CIM_CODE_FK_PK         = CIM_CODE_PK"
                     " UNION"
                     " SELECT  CIMCDF_CIM_CODE_FK_PK AS CODE_CIM10,"
                     " CIMCDF_CDF_NUMERO_FK_PK AS CODE_TERRAIN ,"
                     " CIM_LIBELLE_COURT,"
                     " CIM_LIBELLE_LONG"
                     " FROM    cimcdf_cim10_codif,"
                     " cim10,"
                     " finco_findcomment"
                     " WHERE   CIMCDF_CDF_CODE_FK_PK   = FINCO_CDF_COIN_CODE_FK_PK"
                     " AND     FINCO_FIN_CODE_FK_PK     = '"+ QString::number( CodeId ) +"'"
                     " AND     CIMCDF_CDF_NUMERO_FK_PK = 'NC'"
                     " AND     CIMCDF_CIM_CODE_FK_PK   = CIM_CODE_PK"
                     " AND     CIM_CODE_PK NOT IN  ( SELECT  CIMCDF_CIM_CODE_FK_PK"
                     " FROM    cimcdf_cim10_codif, fin_ficheindic F"
                     " WHERE   CIMCDF_CDF_CODE_FK_PK         =  F.FIN_CDF_NAIN_CODE_FK_PK"
                     " AND     CIMCDF_CDF_NUMERO_FK_PK       = 'NN'"
                     " AND     F.FIN_CODE_SQ_PK  = '"+ QString::number( CodeId ) +"')"
                     " UNION"
                     " SELECT CIMCDF_CIM_CODE_FK_PK AS CODE_CIM10,"
                     " CIMCDF_CDF_NUMERO_FK_PK AS CODE_TERRAIN,"
                     " CIM_LIBELLE_COURT,"
                     " CIM_LIBELLE_LONG"
                     " FROM   cimcdf_cim10_codif,"
                     " cim10,"
                     " fincon_findcomment_nature"
                     " WHERE  CIMCDF_CDF_CODE_FK_PK   = FINCON_CDF_COIN_CODE_FK_PK"
                     " AND    FINCON_FIN_CODE_FK_PK    = '"+ QString::number( CodeId ) +"'"
                     " AND    CIMCDF_CDF_NUMERO_FK_PK = 'NC'"
                     " AND    CIMCDF_CIM_CODE_FK_PK   = CIM_CODE_PK"
                     " AND    CIM_CODE_PK NOT IN (SELECT CIMCDF_CIM_CODE_FK_PK"
                     " FROM   cimcdf_cim10_codif,"
                     " fin_ficheindic F"
                     " WHERE  CIMCDF_CDF_CODE_FK_PK         = F.FIN_CDF_NAIN_CODE_FK_PK"
                     " AND    CIMCDF_CDF_NUMERO_FK_PK       = 'NN'"
                     " AND    F.FIN_CODE_SQ_PK  = '"+ QString::number( CodeId ) +"')"
                     " ORDER BY 2 DESC,1;";
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_CIM10() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_CODE_CIM10        = value(0).toString();
                m_CODE_TERRAIN      = value(1).toString();
                m_CIM_LIBELLE_COURT = value(2).toString();
                m_CIM_LIBELLE_LONG  = value(3).toString();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      QString CODE_CIM10()        {return m_CODE_CIM10;}
      QString CODE_TERRAIN()      {return m_CODE_TERRAIN;}
      QString CIM_LIBELLE_COURT() {return m_CIM_LIBELLE_COURT;}
      QString CIM_LIBELLE_LONG()  {return m_CIM_LIBELLE_LONG;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      QString m_CODE_CIM10;
      QString m_CODE_TERRAIN;
      QString m_CIM_LIBELLE_COURT;
      QString m_CIM_LIBELLE_LONG;
 };

 //================================== C_GET_THE_TERRAIN_CUR   -68- ==================================
 /****************************************************************************
 *   Nom           :  GET_THE_TERRAIN
 -----------------------------------------------------------------------------
 *   Date creation : 28/08/2008
 -----------------------------------------------------------------------------
 *   Description   :  Cette procédure renvoie les fiches terrain correspondant
 *                    au terme passé en paramètre, le terme peut
 *                    contenir les jokers compatibles avec SQL (% ¿.).
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_TERRAIN_CUR  C_GET_THE_TERRAIN ( database(), this );
      while ( C_GET_THE_TERRAIN.next( LIBTXT , TYP  ) )
            { html += tr("<br><b> GET_THE_TERRAIN : </b>  ") + C_GET_THE_TERRAIN.MEMBER();
            }
  */
  class C_GET_THE_TERRAIN_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_TERRAIN_CUR ---------------------
      C_GET_THE_TERRAIN_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( QString LIBTXT , double TYP )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............
       if ( TYP == 1) {

 //+   SELECT CDF_CODE_PK   ,
 //+      CDF_NOM       ,
 //+      CDF_DATECR    ,
 //+      CDF_DATEMJ
 //+   FROM   CDF_CODIF
 //+   WHERE  CDF_NUMERO_PK = 'CS'
 //+   AND    CDF_NOM  LIKE (LIBTXT) ;
                sql_query += " SELECT CDF_CODE_PK   ,"
                     " CDF_NOM       ,"
                     " CDF_DATECR    ,"
                     " CDF_DATEMJ"
                     " FROM   cdf_codif"
                     " WHERE  CDF_NUMERO_PK = 'CS'"
                     " AND    CDF_NOM  LIKE ('"+LIBTXT+"') ;";

       } else if ( TYP == 2) {

 //+   SELECT CDF_CODE_PK   ,
 //+      CDF_NOM       ,
 //+      CDF_DATECR    ,
 //+      CDF_DATEMJ
 //+   FROM   CDF_CODIF
 //+   WHERE  CDF_NUMERO_PK = 'PT'
 //+   AND    CDF_NOM  LIKE (LIBTXT) ;
                sql_query += " SELECT CDF_CODE_PK   ,"
                     " CDF_NOM       ,"
                     " CDF_DATECR    ,"
                     " CDF_DATEMJ"
                     " FROM   cdf_codif"
                     " WHERE  CDF_NUMERO_PK = 'PT'"
                     " AND    CDF_NOM  LIKE ('"+LIBTXT+"') ;";

       }
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_TERRAIN() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_CDF_CODE_PK = value(0).toString();
                m_CDF_NOM     = value(1).toString();
                m_CDF_DATECR  = value(2).toDate();
                m_CDF_DATEMJ  = value(3).toDate();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      QString CDF_CODE_PK() {return m_CDF_CODE_PK;}
      QString CDF_NOM()     {return m_CDF_NOM;}
      QDate   CDF_DATECR()  {return m_CDF_DATECR;}
      QDate   CDF_DATEMJ()  {return m_CDF_DATEMJ;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      QString m_CDF_CODE_PK;
      QString m_CDF_NOM;
      QDate   m_CDF_DATECR;
      QDate   m_CDF_DATEMJ;
 };

 //================================== C_GET_THE_PRESENTATION_CUR   -69- ==================================
 /****************************************************************************
 *   Nom           :  GET_THE_PRESENTATION
 -----------------------------------------------------------------------------
 *   Date creation : 28/08/2008
 -----------------------------------------------------------------------------
 *   Description   :  Cette procédure renvoie les fiches terrain correspondant
 *                    au terme passé en paramètre, le terme peut
 *                    contenir les jokers compatibles avec SQL (% ¿.).
 *   MAJ           :  11/12/2008
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_PRESENTATION_CUR  C_GET_THE_PRESENTATION ( database(), this );
      while ( C_GET_THE_PRESENTATION.next( CodeId , TYPID  ) )
            { html += tr("<br><b> GET_THE_PRESENTATION : </b>  ") + C_GET_THE_PRESENTATION.MEMBER();
            }
  */
  class C_GET_THE_PRESENTATION_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_PRESENTATION_CUR ---------------------
      C_GET_THE_PRESENTATION_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( QString CodeId , double TYPID )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............
       if ( TYPID == 1) {                // -- Code Specialite

 //+   SELECT PRE_CODE_PK       ,
 //+      PRE_SP_CODE_FK       ,
 //+      PRE_NBUNITE           ,
 //+       t3.CDF_NOM            AS UNIT_PRISE ,
 //+       PRE_ADMIN             AS PRE_ADM    ,
 //+      t4.CDF_NOM            AS RESERVHOP  ,
 //+      t5.CDF_NOM            AS LISTE      ,
 //+      PRE_ETAT_COMMER       ,
 //+      PRE_DATECOMMER       ,
 //+      PRE_DATESUP       ,
 //+      t6.CDF_NOM            AS PRESUNIT  ,
 //+      PRE_CEPH_CODE_FK      ,
 //+      PRE_CATC_CODE_FK      ,
 //+      PRE_DATEJOCIP       ,
 //+      PRE_AGRCOLL       ,
 //+      PRE_DATEJOCOLL       ,
 //+      PRE_DATEFINCOLL       ,
 //+      PRE_DATE_APPLIFINCOLL ,
 //+      PRE_PARTSTATUT       ,
 //+      PRE_TSS_TEXTE         ,
 //+      PRE_CONSAPOUV       ,
 //+      PRE_DATECR       ,
 //+      PRE_DATEMJ            ,
 //+      PRE_CACDT_TEXTE       ,
 //+      PRE_LIB_CEPS          AS PRE_CEPS,
 //+      t7.CDF_NOM            AS PRE_NAT,
 //+      PRE_EAN_REF
 //+   FROM   PRE_PRESENTATION  t1  ,
 //+      --SP_SPECIALITE     t2  ,
 //+      CDF_CODIF         t3  ,
 //+      CDF_CODIF         t4  ,
 //+      CDF_CODIF         t5  ,
 //+      CDF_CODIF         t6  ,
 //+      CDF_CODIF         t7
 //+   WHERE   --t1.PRE_SP_CODE_FK           = t2.SP_CODE_SQ_PK
 //+   t1.PRE_CDF_UP_CODE_FK       = t3.CDF_CODE_PK(+)
 //+   AND     t3.CDF_NUMERO_PK(+)         = '20'
 //+   AND     t1.PRE_CDF_RH_CODE_FK       = t4.CDF_CODE_PK(+)
 //+   AND     t4.CDF_NUMERO_PK(+)         = '13'
 //+   AND     t1.PRE_CDF_LI_CODE_FK       = t5.CDF_CODE_PK(+)
 //+   AND     t5.CDF_NUMERO_PK(+)         = '08'
 //+   AND     t1.PRE_CDF_PU_CODE_FK       = t6.CDF_CODE_PK(+)
 //+   AND     t6.CDF_NUMERO_PK(+)         = '12'
 //+   AND     t1.PRE_NATUCD_CDF_CODE_FK   = t7.CDF_CODE_PK(+)
 //+   AND     t7.CDF_NUMERO_PK(+)         = t1.PRE_NATUCD_CDF_NUM_FK
 //+   AND     t1.PRE_SP_CODE_FK            = CodeId ;
                sql_query += " SELECT PRE_CODE_PK       ,"
                     " PRE_SP_CODE_FK       ,"
                     " PRE_NBUNITE           ,"
                     " t3.CDF_NOM            AS UNIT_PRISE ,"
                     " PRE_ADMIN             AS PRE_ADM    ,"
                     " t4.CDF_NOM            AS RESERVHOP  ,"
                     " t5.CDF_NOM            AS LISTE      ,"
                     " PRE_ETAT_COMMER       ,"
                     " PRE_DATECOMMER       ,"
                     " PRE_DATESUP       ,"
                     " t6.CDF_NOM            AS PRESUNIT  ,"
                     " PRE_CEPH_CODE_FK      ,"
                     " PRE_CATC_CODE_FK      ,"
                     " PRE_DATEJOCIP       ,"
                     " PRE_AGRCOLL       ,"
                     " PRE_DATEJOCOLL       ,"
                     " PRE_DATEFINCOLL       ,"
                     " PRE_DATE_APPLIFINCOLL ,"
                     " PRE_PARTSTATUT       ,"
                     " PRE_TSS_TEXTE         ,"
                     " PRE_CONSAPOUV       ,"
                     " PRE_DATECR       ,"
                     " PRE_DATEMJ            ,"
                     " PRE_CACDT_TEXTE       ,"
                     " PRE_LIB_CEPS          AS PRE_CEPS,"
                     " t7.CDF_NOM            AS PRE_NAT,"
                     " PRE_EAN_REF"
                     " FROM   pre_presentation  t1  ,"
                     " "  //--sp_specialite     t2  ,"
                     " cdf_codif         t3  ,"
                     " cdf_codif         t4  ,"
                     " cdf_codif         t5  ,"
                     " cdf_codif         t6  ,"
                     " cdf_codif         t7"
                     " WHERE   "  //--t1.PRE_SP_CODE_FK           = t2.SP_CODE_SQ_PK"
                     " t1.PRE_CDF_UP_CODE_FK       = t3.CDF_CODE_PK"
                     " AND     t3.CDF_NUMERO_PK         = '20'"
                     " AND     t1.PRE_CDF_RH_CODE_FK       = t4.CDF_CODE_PK"
                     " AND     t4.CDF_NUMERO_PK         = '13'"
                     " AND     t1.PRE_CDF_LI_CODE_FK       = t5.CDF_CODE_PK"
                     " AND     t5.CDF_NUMERO_PK         = '08'"
                     " AND     t1.PRE_CDF_PU_CODE_FK       = t6.CDF_CODE_PK"
                     " AND     t6.CDF_NUMERO_PK         = '12'"
                     " AND     t1.PRE_NATUCD_CDF_CODE_FK   = t7.CDF_CODE_PK"
                     " AND     t7.CDF_NUMERO_PK         = t1.PRE_NATUCD_CDF_NUM_FK"
                     " AND     t1.PRE_SP_CODE_FK             = '"+CodeId+"' ;";

       } else if ( TYPID == 2) {                // -- Code CIP

 //+         SELECT PRE_CODE_PK       ,
 //+      PRE_SP_CODE_FK       ,
 //+        PRE_NBUNITE           ,
 //+        t3.CDF_NOM            AS UNIT_PRISE ,
 //+      PRE_ADMIN             AS PRE_ADM    ,
 //+      t4.CDF_NOM            AS RESERVHOP  ,
 //+      t5.CDF_NOM            AS LISTE      ,
 //+      PRE_ETAT_COMMER       ,
 //+      PRE_DATECOMMER       ,
 //+      PRE_DATESUP       ,
 //+      t6.CDF_NOM           AS PRESUNIT  ,
 //+      PRE_CEPH_CODE_FK      ,
 //+      PRE_CATC_CODE_FK      ,
 //+      PRE_DATEJOCIP       ,
 //+      PRE_AGRCOLL       ,
 //+      PRE_DATEJOCOLL       ,
 //+      PRE_DATEFINCOLL       ,
 //+      PRE_DATE_APPLIFINCOLL ,
 //+      PRE_PARTSTATUT       ,
 //+      PRE_TSS_TEXTE         ,
 //+      PRE_CONSAPOUV       ,
 //+      PRE_DATECR       ,
 //+      PRE_DATEMJ            ,
 //+      PRE_CACDT_TEXTE       ,
 //+      PRE_LIB_CEPS          AS PRE_CEPS,
 //+      t7.CDF_NOM            AS PRE_NAT,
 //+      PRE_EAN_REF
 //+   FROM     PRE_PRESENTATION  t1  ,
 //+      --SP_SPECIALITE     t2  ,
 //+      CDF_CODIF         t3  ,
 //+      CDF_CODIF         t4  ,
 //+      CDF_CODIF         t5  ,
 //+      CDF_CODIF         t6  ,
 //+      CDF_CODIF         t7
 //+   WHERE   --t1.PRE_SP_CODE_FK           = t2.SP_CODE_SQ_PK AND
 //+   t1.PRE_CDF_UP_CODE_FK       = t3.CDF_CODE_PK(+)
 //+   AND     t3.CDF_NUMERO_PK(+)         = '20'
 //+   AND     t1.PRE_CDF_RH_CODE_FK       = t4.CDF_CODE_PK(+)
 //+   AND     t4.CDF_NUMERO_PK(+)         = '13'
 //+   AND     t1.PRE_CDF_LI_CODE_FK       = t5.CDF_CODE_PK(+)
 //+   AND     t5.CDF_NUMERO_PK(+)         = '08'
 //+   AND     t1.PRE_CDF_PU_CODE_FK       = t6.CDF_CODE_PK(+)
 //+   AND     t6.CDF_NUMERO_PK(+)         = '12'
 //+   AND     t1.PRE_NATUCD_CDF_CODE_FK   = t7.CDF_CODE_PK(+)
 //+   AND     t7.CDF_NUMERO_PK(+)         = t1.PRE_NATUCD_CDF_NUM_FK
 //+   AND     t1.PRE_CODE_PK              = CodeId ;
                sql_query +=
                     " SELECT PRE_CODE_PK       ,"
                     " PRE_SP_CODE_FK       ,"
                     " PRE_NBUNITE           ,"
                     " t3.CDF_NOM            AS UNIT_PRISE ,"
                     " PRE_ADMIN             AS PRE_ADM    ,"
                     " t4.CDF_NOM            AS RESERVHOP  ,"
                     " t5.CDF_NOM            AS LISTE      ,"
                     " PRE_ETAT_COMMER       ,"
                     " PRE_DATECOMMER       ,"
                     " PRE_DATESUP       ,"
                     " t6.CDF_NOM           AS PRESUNIT  ,"
                     " PRE_CEPH_CODE_FK      ,"
                     " PRE_CATC_CODE_FK      ,"
                     " PRE_DATEJOCIP       ,"
                     " PRE_AGRCOLL       ,"
                     " PRE_DATEJOCOLL       ,"
                     " PRE_DATEFINCOLL       ,"
                     " PRE_DATE_APPLIFINCOLL ,"
                     " PRE_PARTSTATUT       ,"
                     " PRE_TSS_TEXTE         ,"
                     " PRE_CONSAPOUV       ,"
                     " PRE_DATECR       ,"
                     " PRE_DATEMJ            ,"
                     " PRE_CACDT_TEXTE       ,"
                     " PRE_LIB_CEPS          AS PRE_CEPS,"
                     " t7.CDF_NOM            AS PRE_NAT,"
                     " PRE_EAN_REF"
                     " FROM     pre_presentation  t1  ,"
                     " cdf_codif         t3  ,"
                     " cdf_codif         t4  ,"
                     " cdf_codif         t5  ,"
                     " cdf_codif         t6  ,"
                     " cdf_codif         t7"
                     " WHERE   "
                     " t1.PRE_CDF_UP_CODE_FK       = t3.CDF_CODE_PK"
                     " AND     t3.CDF_NUMERO_PK         = '20'"
                     " AND     t1.PRE_CDF_RH_CODE_FK       = t4.CDF_CODE_PK"
                     " AND     t4.CDF_NUMERO_PK         = '13'"
                     " AND     t1.PRE_CDF_LI_CODE_FK       = t5.CDF_CODE_PK"
                     " AND     t5.CDF_NUMERO_PK         = '08'"
                     " AND     t1.PRE_CDF_PU_CODE_FK       = t6.CDF_CODE_PK"
                     " AND     t6.CDF_NUMERO_PK         = '12'"
                     " AND     t1.PRE_NATUCD_CDF_CODE_FK   = t7.CDF_CODE_PK"
                     " AND     t7.CDF_NUMERO_PK         = t1.PRE_NATUCD_CDF_NUM_FK"
                     " AND     t1.PRE_CODE_PK               = '"+CodeId+"' ;";

       } else if ( TYPID == 3) {            //-- Code UCD

 //+         SELECT  PRE_CODE_PK       ,
 //+    PRE_SP_CODE_FK       ,
 //+    PRE_NBUNITE           ,
 //+    t3.CDF_NOM            AS UNIT_PRISE ,
 //+    PRE_ADMIN             AS PRE_ADM    ,
 //+    t4.CDF_NOM            AS RESERVHOP  ,
 //+    t5.CDF_NOM            AS LISTE      ,
 //+    PRE_ETAT_COMMER       ,
 //+    PRE_DATECOMMER       ,
 //+    PRE_DATESUP       ,
 //+    t6.CDF_NOM            AS PRESUNIT  ,
 //+    PRE_CEPH_CODE_FK      ,
 //+    PRE_CATC_CODE_FK      ,
 //+    PRE_DATEJOCIP       ,
 //+    PRE_AGRCOLL       ,
 //+    PRE_DATEJOCOLL       ,
 //+    PRE_DATEFINCOLL       ,
 //+    PRE_DATE_APPLIFINCOLL ,
 //+    PRE_PARTSTATUT       ,
 //+    PRE_TSS_TEXTE         ,
 //+    PRE_CONSAPOUV       ,
 //+    PRE_DATECR       ,
 //+    PRE_DATEMJ            ,
 //+    PRE_CACDT_TEXTE       ,
 //+    PRE_LIB_CEPS          AS PRE_CEPS,
 //+    t7.CDF_NOM            AS PRE_NAT,
 //+    PRE_EAN_REF
 //+ FROM  PRE_PRESENTATION  t1  ,
 //+   SP_SPECIALITE     t2  ,
 //+   CDF_CODIF         t3  ,
 //+   CDF_CODIF         t4  ,
 //+   CDF_CODIF         t5  ,
 //+   CDF_CODIF         t6  ,
 //+   CDF_CODIF         t7
 //+ WHERE t1.PRE_SP_CODE_FK           = t2.SP_CODE_SQ_PK
 //+ AND   t1.PRE_CDF_UP_CODE_FK       = t3.CDF_CODE_PK(+)
 //+ AND   t3.CDF_NUMERO_PK(+)         = '20'
 //+ AND   t1.PRE_CDF_RH_CODE_FK       = t4.CDF_CODE_PK(+)
 //+ AND   t4.CDF_NUMERO_PK(+)         = '13'
 //+ AND   t1.PRE_CDF_LI_CODE_FK       = t5.CDF_CODE_PK(+)
 //+ AND   t5.CDF_NUMERO_PK(+)         = '08'
 //+ AND   t1.PRE_CDF_PU_CODE_FK       = t6.CDF_CODE_PK(+)
 //+ AND   t6.CDF_NUMERO_PK(+)         = '12'
 //+ AND   t1.PRE_NATUCD_CDF_CODE_FK   = t7.CDF_CODE_PK(+)
 //+    AND   t7.CDF_NUMERO_PK(+)         = t1.PRE_NATUCD_CDF_NUM_FK
 //+ AND   t2.SP_CIPUCD                = CodeId ;
                sql_query += " SELECT  PRE_CODE_PK       ,"
                     " PRE_SP_CODE_FK       ,"
                     " PRE_NBUNITE           ,"
                     " t3.CDF_NOM            AS UNIT_PRISE ,"
                     " PRE_ADMIN             AS PRE_ADM    ,"
                     " t4.CDF_NOM            AS RESERVHOP  ,"
                     " t5.CDF_NOM            AS LISTE      ,"
                     " PRE_ETAT_COMMER       ,"
                     " PRE_DATECOMMER       ,"
                     " PRE_DATESUP       ,"
                     " t6.CDF_NOM            AS PRESUNIT  ,"
                     " PRE_CEPH_CODE_FK      ,"
                     " PRE_CATC_CODE_FK      ,"
                     " PRE_DATEJOCIP       ,"
                     " PRE_AGRCOLL       ,"
                     " PRE_DATEJOCOLL       ,"
                     " PRE_DATEFINCOLL       ,"
                     " PRE_DATE_APPLIFINCOLL ,"
                     " PRE_PARTSTATUT       ,"
                     " PRE_TSS_TEXTE         ,"
                     " PRE_CONSAPOUV       ,"
                     " PRE_DATECR       ,"
                     " PRE_DATEMJ            ,"
                     " PRE_CACDT_TEXTE       ,"
                     " PRE_LIB_CEPS          AS PRE_CEPS,"
                     " t7.CDF_NOM            AS PRE_NAT,"
                     " PRE_EAN_REF"
                     " FROM  pre_presentation  t1  ,"
                     " sp_specialite     t2  ,"
                     " cdf_codif         t3  ,"
                     " cdf_codif         t4  ,"
                     " cdf_codif         t5  ,"
                     " cdf_codif         t6  ,"
                     " cdf_codif         t7"
                     " WHERE t1.PRE_SP_CODE_FK           = t2.SP_CODE_SQ_PK"
                     " AND   t1.PRE_CDF_UP_CODE_FK       = t3.CDF_CODE_PK"
                     " AND   t3.CDF_NUMERO_PK         = '20'"
                     " AND   t1.PRE_CDF_RH_CODE_FK       = t4.CDF_CODE_PK"
                     " AND   t4.CDF_NUMERO_PK         = '13'"
                     " AND   t1.PRE_CDF_LI_CODE_FK       = t5.CDF_CODE_PK"
                     " AND   t5.CDF_NUMERO_PK         = '08'"
                     " AND   t1.PRE_CDF_PU_CODE_FK       = t6.CDF_CODE_PK"
                     " AND   t6.CDF_NUMERO_PK         = '12'"
                     " AND   t1.PRE_NATUCD_CDF_CODE_FK   = t7.CDF_CODE_PK"
                     " AND   t7.CDF_NUMERO_PK         = t1.PRE_NATUCD_CDF_NUM_FK"
                     " AND   t2.SP_CIPUCD                 = '"+CodeId+"' ;";

       } else if ( TYPID == 4) {          // -- Code EAN

 //+         SELECT PRE_CODE_PK       ,
 //+     PRE_SP_CODE_FK       ,
 //+       PRE_NBUNITE           ,
 //+       t3.CDF_NOM            AS UNIT_PRISE ,
 //+     PRE_ADMIN             AS PRE_ADM    ,
 //+     t4.CDF_NOM            AS RESERVHOP  ,
 //+     t5.CDF_NOM            AS LISTE      ,
 //+     PRE_ETAT_COMMER       ,
 //+     PRE_DATECOMMER       ,
 //+     PRE_DATESUP       ,
 //+     t6.CDF_NOM           AS PRESUNIT  ,
 //+     PRE_CEPH_CODE_FK      ,
 //+     PRE_CATC_CODE_FK      ,
 //+     PRE_DATEJOCIP       ,
 //+     PRE_AGRCOLL       ,
 //+     PRE_DATEJOCOLL       ,
 //+     PRE_DATEFINCOLL       ,
 //+     PRE_DATE_APPLIFINCOLL ,
 //+     PRE_PARTSTATUT       ,
 //+     PRE_TSS_TEXTE         ,
 //+     PRE_CONSAPOUV       ,
 //+     PRE_DATECR       ,
 //+     PRE_DATEMJ            ,
 //+     PRE_CACDT_TEXTE       ,
 //+     PRE_LIB_CEPS          AS PRE_CEPS,
 //+     t7.CDF_NOM            AS PRE_NAT,
 //+     PRE_EAN_REF
 //+   FROM     PRE_PRESENTATION  t1  ,
 //+      --SP_SPECIALITE     t2  ,
 //+      CDF_CODIF         t3  ,
 //+      CDF_CODIF         t4  ,
 //+      CDF_CODIF         t5  ,
 //+      CDF_CODIF         t6  ,
 //+      CDF_CODIF         t7
 //+   WHERE   --t1.PRE_SP_CODE_FK           = t2.SP_CODE_SQ_PK AND
 //+   t1.PRE_CDF_UP_CODE_FK       = t3.CDF_CODE_PK(+)
 //+   AND     t3.CDF_NUMERO_PK(+)         = '20'
 //+   AND     t1.PRE_CDF_RH_CODE_FK       = t4.CDF_CODE_PK(+)
 //+   AND     t4.CDF_NUMERO_PK(+)         = '13'
 //+   AND     t1.PRE_CDF_LI_CODE_FK       = t5.CDF_CODE_PK(+)
 //+   AND     t5.CDF_NUMERO_PK(+)         = '08'
 //+   AND     t1.PRE_CDF_PU_CODE_FK       = t6.CDF_CODE_PK(+)
 //+   AND     t6.CDF_NUMERO_PK(+)         = '12'
 //+   AND     t1.PRE_NATUCD_CDF_CODE_FK   = t7.CDF_CODE_PK(+)
 //+   AND     t7.CDF_NUMERO_PK(+)         = t1.PRE_NATUCD_CDF_NUM_FK
 //+   AND     t1.PRE_EAN_REF              = CodeId ;
                sql_query += " SELECT PRE_CODE_PK       ,"
                     " PRE_SP_CODE_FK       ,"
                     " PRE_NBUNITE           ,"
                     " t3.CDF_NOM            AS UNIT_PRISE ,"
                     " PRE_ADMIN             AS PRE_ADM    ,"
                     " t4.CDF_NOM            AS RESERVHOP  ,"
                     " t5.CDF_NOM            AS LISTE      ,"
                     " PRE_ETAT_COMMER       ,"
                     " PRE_DATECOMMER       ,"
                     " PRE_DATESUP       ,"
                     " t6.CDF_NOM           AS PRESUNIT  ,"
                     " PRE_CEPH_CODE_FK      ,"
                     " PRE_CATC_CODE_FK      ,"
                     " PRE_DATEJOCIP       ,"
                     " PRE_AGRCOLL       ,"
                     " PRE_DATEJOCOLL       ,"
                     " PRE_DATEFINCOLL       ,"
                     " PRE_DATE_APPLIFINCOLL ,"
                     " PRE_PARTSTATUT       ,"
                     " PRE_TSS_TEXTE         ,"
                     " PRE_CONSAPOUV       ,"
                     " PRE_DATECR       ,"
                     " PRE_DATEMJ            ,"
                     " PRE_CACDT_TEXTE       ,"
                     " PRE_LIB_CEPS          AS PRE_CEPS,"
                     " t7.CDF_NOM            AS PRE_NAT,"
                     " PRE_EAN_REF"
                     " FROM     pre_presentation  t1  ,"
                     " "  //--sp_specialite     t2  ,"
                     " cdf_codif         t3  ,"
                     " cdf_codif         t4  ,"
                     " cdf_codif         t5  ,"
                     " cdf_codif         t6  ,"
                     " cdf_codif         t7"
                     " WHERE   "  //--t1.PRE_SP_CODE_FK           = t2.SP_CODE_SQ_PK AND"
                     " t1.PRE_CDF_UP_CODE_FK       = t3.CDF_CODE_PK"
                     " AND     t3.CDF_NUMERO_PK         = '20'"
                     " AND     t1.PRE_CDF_RH_CODE_FK       = t4.CDF_CODE_PK"
                     " AND     t4.CDF_NUMERO_PK         = '13'"
                     " AND     t1.PRE_CDF_LI_CODE_FK       = t5.CDF_CODE_PK"
                     " AND     t5.CDF_NUMERO_PK         = '08'"
                     " AND     t1.PRE_CDF_PU_CODE_FK       = t6.CDF_CODE_PK"
                     " AND     t6.CDF_NUMERO_PK         = '12'"
                     " AND     t1.PRE_NATUCD_CDF_CODE_FK   = t7.CDF_CODE_PK"
                     " AND     t7.CDF_NUMERO_PK         = t1.PRE_NATUCD_CDF_NUM_FK"
                     " AND     t1.PRE_EAN_REF               = '"+CodeId+"' ;";

       } else if ( TYPID == 5) {    // -- Code UCD13

 //+         SELECT  PRE_CODE_PK       ,
 //+    PRE_SP_CODE_FK       ,
 //+    PRE_NBUNITE           ,
 //+    t3.CDF_NOM            AS UNIT_PRISE ,
 //+    PRE_ADMIN             AS PRE_ADM    ,
 //+    t4.CDF_NOM            AS RESERVHOP  ,
 //+    t5.CDF_NOM            AS LISTE      ,
 //+    PRE_ETAT_COMMER       ,
 //+    PRE_DATECOMMER       ,
 //+    PRE_DATESUP       ,
 //+    t6.CDF_NOM            AS PRESUNIT  ,
 //+    PRE_CEPH_CODE_FK      ,
 //+    PRE_CATC_CODE_FK      ,
 //+    PRE_DATEJOCIP       ,
 //+    PRE_AGRCOLL       ,
 //+    PRE_DATEJOCOLL       ,
 //+    PRE_DATEFINCOLL       ,
 //+    PRE_DATE_APPLIFINCOLL ,
 //+    PRE_PARTSTATUT       ,
 //+    PRE_TSS_TEXTE         ,
 //+    PRE_CONSAPOUV       ,
 //+    PRE_DATECR       ,
 //+    PRE_DATEMJ            ,
 //+    PRE_CACDT_TEXTE       ,
 //+    PRE_LIB_CEPS          AS PRE_CEPS,
 //+    t7.CDF_NOM            AS PRE_NAT,
 //+    PRE_EAN_REF
 //+ FROM  PRE_PRESENTATION  t1  ,
 //+   SP_SPECIALITE     t2  ,
 //+   CDF_CODIF         t3  ,
 //+   CDF_CODIF         t4  ,
 //+   CDF_CODIF         t5  ,
 //+   CDF_CODIF         t6  ,
 //+   CDF_CODIF         t7
 //+ WHERE t1.PRE_SP_CODE_FK           = t2.SP_CODE_SQ_PK
 //+ AND   t1.PRE_CDF_UP_CODE_FK       = t3.CDF_CODE_PK(+)
 //+ AND   t3.CDF_NUMERO_PK(+)         = '20'
 //+ AND   t1.PRE_CDF_RH_CODE_FK       = t4.CDF_CODE_PK(+)
 //+ AND   t4.CDF_NUMERO_PK(+)         = '13'
 //+ AND   t1.PRE_CDF_LI_CODE_FK       = t5.CDF_CODE_PK(+)
 //+ AND   t5.CDF_NUMERO_PK(+)         = '08'
 //+ AND   t1.PRE_CDF_PU_CODE_FK       = t6.CDF_CODE_PK(+)
 //+ AND   t6.CDF_NUMERO_PK(+)         = '12'
 //+ AND   t1.PRE_NATUCD_CDF_CODE_FK   = t7.CDF_CODE_PK(+)
 //+    AND   t7.CDF_NUMERO_PK(+)         = t1.PRE_NATUCD_CDF_NUM_FK
 //+ AND   t2.SP_CIPUCD13              = CodeId ;
                sql_query += " SELECT  PRE_CODE_PK       ,"
                     " PRE_SP_CODE_FK       ,"
                     " PRE_NBUNITE           ,"
                     " t3.CDF_NOM            AS UNIT_PRISE ,"
                     " PRE_ADMIN             AS PRE_ADM    ,"
                     " t4.CDF_NOM            AS RESERVHOP  ,"
                     " t5.CDF_NOM            AS LISTE      ,"
                     " PRE_ETAT_COMMER       ,"
                     " PRE_DATECOMMER       ,"
                     " PRE_DATESUP       ,"
                     " t6.CDF_NOM            AS PRESUNIT  ,"
                     " PRE_CEPH_CODE_FK      ,"
                     " PRE_CATC_CODE_FK      ,"
                     " PRE_DATEJOCIP       ,"
                     " PRE_AGRCOLL       ,"
                     " PRE_DATEJOCOLL       ,"
                     " PRE_DATEFINCOLL       ,"
                     " PRE_DATE_APPLIFINCOLL ,"
                     " PRE_PARTSTATUT       ,"
                     " PRE_TSS_TEXTE         ,"
                     " PRE_CONSAPOUV       ,"
                     " PRE_DATECR       ,"
                     " PRE_DATEMJ            ,"
                     " PRE_CACDT_TEXTE       ,"
                     " PRE_LIB_CEPS          AS PRE_CEPS,"
                     " t7.CDF_NOM            AS PRE_NAT,"
                     " PRE_EAN_REF"
                     " FROM  pre_presentation  t1  ,"
                     " sp_specialite     t2  ,"
                     " cdf_codif         t3  ,"
                     " cdf_codif         t4  ,"
                     " cdf_codif         t5  ,"
                     " cdf_codif         t6  ,"
                     " cdf_codif         t7"
                     " WHERE t1.PRE_SP_CODE_FK           = t2.SP_CODE_SQ_PK"
                     " AND   t1.PRE_CDF_UP_CODE_FK       = t3.CDF_CODE_PK"
                     " AND   t3.CDF_NUMERO_PK         = '20'"
                     " AND   t1.PRE_CDF_RH_CODE_FK       = t4.CDF_CODE_PK"
                     " AND   t4.CDF_NUMERO_PK         = '13'"
                     " AND   t1.PRE_CDF_LI_CODE_FK       = t5.CDF_CODE_PK"
                     " AND   t5.CDF_NUMERO_PK         = '08'"
                     " AND   t1.PRE_CDF_PU_CODE_FK       = t6.CDF_CODE_PK"
                     " AND   t6.CDF_NUMERO_PK         = '12'"
                     " AND   t1.PRE_NATUCD_CDF_CODE_FK   = t7.CDF_CODE_PK"
                     " AND   t7.CDF_NUMERO_PK         = t1.PRE_NATUCD_CDF_NUM_FK"
                     " AND   t2.SP_CIPUCD13               = '"+CodeId+"' ;";

       }
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_PRESENTATION() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_PRE_CODE_PK           = value(0).toString();
                m_PRE_SP_CODE_FK        = value(1).toDouble();
                m_PRE_NBUNITE           = value(2).toDouble();
                m_UNIT_PRISE            = value(3).toString();
                m_PRE_ADM               = value(4).toString();
                m_RESERVHOP             = value(5).toString();
                m_LISTE                 = value(6).toString();
                m_PRE_ETAT_COMMER       = value(7).toString();
                m_PRE_DATECOMMER        = value(8).toDate();
                m_PRE_DATESUP           = value(9).toDate();
                m_PRESUNIT              = value(10).toString();
                m_PRE_CEPH_CODE_FK      = value(11).toString();
                m_PRE_CATC_CODE_FK      = value(12).toString();
                m_PRE_DATEJOCIP         = value(13).toDate();
                m_PRE_AGRCOLL           = value(14).toString();
                m_PRE_DATEJOCOLL        = value(15).toDate();
                m_PRE_DATEFINCOLL       = value(16).toDate();
                m_PRE_DATE_APPLIFINCOLL = value(17).toDate();
                m_PRE_PARTSTATUT        = value(18).toString();
                m_PRE_TSS_TEXTE         = value(19).toString();
                m_PRE_CONSAPOUV         = value(20).toString();
                m_PRE_DATECR            = value(21).toDate();
                m_PRE_DATEMJ            = value(22).toDate();
                m_PRE_CACDT_TEXTE       = value(23).toString();
                m_PRE_CEPS              = value(24).toString();
                m_PRE_NAT               = value(25).toString();
                m_PRE_EAN_REF           = value(26).toString();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      QString PRE_CODE_PK()           {return m_PRE_CODE_PK;}
      double  PRE_SP_CODE_FK()        {return m_PRE_SP_CODE_FK;}
      double  PRE_NBUNITE()           {return m_PRE_NBUNITE;}
      QString UNIT_PRISE()            {return m_UNIT_PRISE;}
      QString PRE_ADM()               {return m_PRE_ADM;}
      QString RESERVHOP()             {return m_RESERVHOP;}
      QString LISTE()                 {return m_LISTE;}
      QString PRE_ETAT_COMMER()       {return m_PRE_ETAT_COMMER;}
      QDate   PRE_DATECOMMER()        {return m_PRE_DATECOMMER;}
      QDate   PRE_DATESUP()           {return m_PRE_DATESUP;}
      QString PRESUNIT()              {return m_PRESUNIT;}
      QString PRE_CEPH_CODE_FK()      {return m_PRE_CEPH_CODE_FK;}
      QString PRE_CATC_CODE_FK()      {return m_PRE_CATC_CODE_FK;}
      QDate   PRE_DATEJOCIP()         {return m_PRE_DATEJOCIP;}
      QString PRE_AGRCOLL()           {return m_PRE_AGRCOLL;}
      QDate   PRE_DATEJOCOLL()        {return m_PRE_DATEJOCOLL;}
      QDate   PRE_DATEFINCOLL()       {return m_PRE_DATEFINCOLL;}
      QDate   PRE_DATE_APPLIFINCOLL() {return m_PRE_DATE_APPLIFINCOLL;}
      QString PRE_PARTSTATUT()        {return m_PRE_PARTSTATUT;}
      QString PRE_TSS_TEXTE()         {return m_PRE_TSS_TEXTE;}
      QString PRE_CONSAPOUV()         {return m_PRE_CONSAPOUV;}
      QDate   PRE_DATECR()            {return m_PRE_DATECR;}
      QDate   PRE_DATEMJ()            {return m_PRE_DATEMJ;}
      QString PRE_CACDT_TEXTE()       {return m_PRE_CACDT_TEXTE;}
      QString PRE_CEPS()              {return m_PRE_CEPS;}
      QString PRE_NAT()               {return m_PRE_NAT;}
      QString PRE_EAN_REF()           {return m_PRE_EAN_REF;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      QString m_PRE_CODE_PK;
      double  m_PRE_SP_CODE_FK;
      double  m_PRE_NBUNITE;
      QString m_UNIT_PRISE;
      QString m_PRE_ADM;
      QString m_RESERVHOP;
      QString m_LISTE;
      QString m_PRE_ETAT_COMMER;
      QDate   m_PRE_DATECOMMER;
      QDate   m_PRE_DATESUP;
      QString m_PRESUNIT;
      QString m_PRE_CEPH_CODE_FK;
      QString m_PRE_CATC_CODE_FK;
      QDate   m_PRE_DATEJOCIP;
      QString m_PRE_AGRCOLL;
      QDate   m_PRE_DATEJOCOLL;
      QDate   m_PRE_DATEFINCOLL;
      QDate   m_PRE_DATE_APPLIFINCOLL;
      QString m_PRE_PARTSTATUT;
      QString m_PRE_TSS_TEXTE;
      QString m_PRE_CONSAPOUV;
      QDate   m_PRE_DATECR;
      QDate   m_PRE_DATEMJ;
      QString m_PRE_CACDT_TEXTE;
      QString m_PRE_CEPS;
      QString m_PRE_NAT;
      QString m_PRE_EAN_REF;
 };

 //================================== C_GET_THE_PRE_CDT_CUR   -70- ==================================
    /****************************************************************************
 *   Nom           :  GET_THE_PRE_CDT
 -----------------------------------------------------------------------------
 *   Date creation : 01/09/2008
 -----------------------------------------------------------------------------
 *   Description   :  Cette procédure renvoie les informations concernant
 *                    le conditionnement pour le CIP passé en paramètre.
 *   MAJ           :  Mail du  lundi 15 septembre 2008 18:03
 *                    18/12/2008 notion d'ordre - Anis
                   :  05/02/2009 - Mourad
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_PRE_CDT_CUR  C_GET_THE_PRE_CDT ( database(), this );
      while ( C_GET_THE_PRE_CDT.next( CODECIP , VarType  ) )
            { html += tr("<br><b> GET_THE_PRE_CDT : </b>  ") + C_GET_THE_PRE_CDT.MEMBER();
            }
  */
  class C_GET_THE_PRE_CDT_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_PRE_CDT_CUR ---------------------
      C_GET_THE_PRE_CDT_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( QString CODECIP , double VarType )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............
       if ( VarType == 1) {    // --Code CIP 7

 //+  SELECT '1'                                AS TYPE_PRE_CDT,
 //+      t1.PREDISP_UNITEDISP            AS VALEUR_1 ,
 //+      t2.CDF_NOM                      AS INFO_1   ,
 //+      NULL                            AS VALEUR_2 ,
 //+      t3.SAC_NOM                      AS INFO_2   ,
 //+      NULL                            AS VALEUR_3 ,
 //+      NULL                            AS INFO_3   ,
 //+      NULL                            AS VALEUR_4
 //+  FROM    PREDISP_PRE_DISPENSATION t1,
 //+      CDF_CODIF                t2 ,
 //+      SAC_SUBACTIVE            t3
 //+  WHERE   t1.PREDISP_CDF_UD_CODE_FK    = t2.CDF_CODE_PK(+)
 //+  AND     t2.CDF_NUMERO_PK(+)          = '19'
 //+  AND     t3.SAC_CODE_SQ_PK            = t1.PREDISP_SAC_CODE_FK
 //+  AND     t1.PREDISP_PRE_CODE_FK_PK    = CODECIP
 //+  UNION
 //+  SELECT '1.'||t1.PREUCD_NUMORD           AS TYPE_PRE_CDT     ,
 //+     NULL                           AS VALEUR_1 ,
 //+     t2.CDF_NOM                     AS INFO_1   ,
 //+     NULL                           AS VALEUR_2 ,
 //+     NULL                           AS INFO_2   ,
 //+     NULL                          AS VALEUR_3 ,
 //+     NULL                           AS INFO_3   ,
 //+     NULL                           AS VALEUR_4
 //+  FROM   PREUCD_COMMENT_DOSEUCD    t1 ,
 //+     CDF_CODIF                 t2
 //+  WHERE  t1.PREUCD_CDF_COMUCD_CODE_FK_PK     = t2.CDF_CODE_PK(+)
 //+  AND    t2.CDF_NUMERO_PK(+)                 = '31'
 //+  AND    t1.PREUCD_PRE_CODE_FK_PK            = CODECIP
 //+  UNION
 //+  SELECT '2.'||t1.COCONT_NUM_PK          AS TYPE_PRE_CDT     ,
 //+     NULL                           AS VALEUR_1 ,
 //+     t2.CDF_NOM                     AS INFO_1   ,
 //+     NULL                           AS VALEUR_2 ,
 //+     NULL                           AS INFO_2   ,
 //+     NULL                          AS VALEUR_3 ,
 //+     NULL                           AS INFO_3   ,
 //+     NULL                           AS VALEUR_4
 //+  FROM   COCONT_COMPO_CONTENANT t1,
 //+       CDF_CODIF        t2
 //+  WHERE  t1.COCONT_CDF_GAL_CODE_FK   = t2.CDF_CODE_PK
 //+  AND    t2.CDF_NUMERO_PK            = '22'
 //+  AND    t1.COCONT_PRE_CODE_FK_PK    = CODECIP
 //+  UNION
 //+  SELECT '2.'||t1.PRECONT_COCONT_NUM_FK_PK AS TYPE_PRE_CDT     ,
 //+     NVL(t1.PRECONT_NBCONTENANT,1)   AS VALEUR_1 ,
 //+     t2.CDF_NOM                      AS INFO_1   ,
 //+     t1.PRECONT_NBCONTENANCE         AS VALEUR_2 ,
 //+     t3.CDF_NOM                      AS INFO_2   ,
 //+     PRECONT_VOLCONTENANT            AS VALEUR_3 ,
 //+     t4.cdf_nom       AS INFO_3   ,
 //+     PRECONT_NBCONTENANT_REEL        AS VALEUR_4
 //+  FROM     PRECONT_PRE_CONTENANT    t1 ,
 //+       CDF_CODIF                t2 ,
 //+       CDF_CODIF                t3,
 //+    CDF_CODIF     t4
 //+  WHERE  t1.PRECONT_CDF_COCDT_CODE_FK = t2.CDF_CODE_PK(+)
 //+  AND    t2.CDF_NUMERO_PK(+)          = '04'
 //+  AND    t1.PRECONT_CDF_COCE_CODE_FK = t3.CDF_CODE_PK(+)
 //+  AND    t3.CDF_NUMERO_PK(+)          = '21'
 //+  AND    t1.PRECONT_CDF_VOLCONT_CODE_FK = t4.CDF_CODE_PK(+)
 //+  AND    t4.CDF_NUMERO_PK(+)          = '21'
 //+     AND    t1.PRECONT_PRE_CODE_FK_PK    = CODECIP
 //+  UNION
 //+  SELECT  '2.'||t1.PREMAT_COCONT_NUM_FK_PK||'.'||t1.PREMAT_NUMORD   AS TYPE_PRE_CDT     ,
 //+     NULL                           AS VALEUR_1 ,
 //+     t2.CDF_NOM                     AS INFO_1   ,
 //+     t1.PREMAT_NUMORD               AS VALEUR_2 ,
 //+     NULL                           AS INFO_2   ,
 //+     NULL                          AS VALEUR_3 ,
 //+     NULL                           AS INFO_3   ,
 //+     NULL                           AS VALEUR_4
 //+  FROM   PREMAT_PRE_MATERIAU  t1,
 //+     CDF_CODIF            t2
 //+  WHERE  t1.PREMAT_CDF_MACDT_CODE_FK_PK     = t2.CDF_CODE_PK
 //+  AND    t2.CDF_NUMERO_PK                   = '09'
 //+  AND    t1.PREMAT_PRE_CODE_FK_PK           = CODECIP
 //+    UNION
 //+  SELECT '2.2.'||t1.PRECAR_COCONT_NUM_FK_PK||'.'||t1.PRECAR_NUMORD  AS TYPE_PRE_CDT     ,
 //+     NULL                          AS VALEUR_1 ,
 //+     t2.CDF_NOM                    AS INFO_1   ,
 //+     t1.PRECAR_NUMORD              AS VALEUR_2 ,
 //+     NULL                          AS INFO_2   ,
 //+     NULL                         AS VALEUR_3 ,
 //+     NULL                          AS INFO_3   ,
 //+     NULL                          AS VALEUR_4
 //+  FROM   PRECAR_PRESENTATION_CARACTCOMP  t1,
 //+     CDF_CODIF                       t2
 //+  WHERE  t1.PRECAR_CDF_CODE_CACDT_FK_PK     = t2.CDF_CODE_PK
 //+  AND    t2.CDF_NUMERO_PK                   = '01'
 //+  AND    t1.PRECAR_PRE_CODE_FK_PK           = CODECIP
 //+  UNION
 //+  SELECT '3.'||t1.PRECEMB_NUMORD         AS TYPE_PRE_CDT     ,
 //+     NULL                           AS VALEUR_1 ,
 //+     t2.CDF_NOM                     AS INFO_1   ,
 //+     t1.PRECEMB_NUMORD              AS VALEUR_2 ,
 //+     NULL                           AS INFO_2   ,
 //+     NULL                          AS VALEUR_3 ,
 //+     NULL                           AS INFO_3   ,
 //+     NULL                           AS VALEUR_4
 //+  FROM   PRECEMB_PRE_CAREMBALLAGE        t1,
 //+     CDF_CODIF                       t2
 //+  WHERE  t1.PRECEMB_CDF_CAREMB_CODE_FK_PK   = t2.CDF_CODE_PK
 //+  AND    t2.CDF_NUMERO_PK                   = '01'
 //+  AND    t1.PRECEMB_PRE_CODE_FK_PK          = CODECIP
 //+  UNION
 //+  SELECT  DISTINCT
 //+          '4'                           AS TYPE_PRE_CDT     ,
 //+     NULL                           AS VALEUR_1 ,
 //+     t3.CDF_NOM                     AS INFO_1   ,
 //+     NULL                           AS VALEUR_2 ,
 //+     TO_CHAR(t1.SPAFS_DATE_PK)      AS INFO_2   ,
 //+     NULL                         AS VALEUR_3 ,
 //+     NULL                           AS INFO_3   ,
 //+     NULL                           AS VALEUR_4
 //+  FROM   SPAFS_SPECIALITE_AFSSAPS t1 ,
 //+     PRE_PRESENTATION         t2 ,
 //+     CDF_CODIF                t3
 //+  WHERE  t1.SPAFS_RUBCDF_NUMERO_PK IN ('SP','04')
 //+  AND    t1.SPAFS_SP_CODE_FK_PK    = t2.PRE_SP_CODE_FK
 //+  AND    t1.SPAFS_DATE_PK          = (SELECT MAX(SPAFS_DATE_PK)
 //+  FROM   SPAFS_SPECIALITE_AFSSAPS
 //+  WHERE  SPAFS_SP_CODE_FK_PK     = t2.PRE_SP_CODE_FK
 //+  AND    SPAFS_RUBCDF_NUMERO_PK  IN ('SP','04'))
 //+  --AND    SPAFS_DATE_REVIS IS NULL)
 //+  AND    t3.CDF_CODE_PK          = t1.SPAFS_CDF_CODE_DOC_FK_PK
 //+  AND    t3.CDF_NUMERO_PK        = '25'
 //+  AND    t2.PRE_CODE_PK          = CODECIP
 //+  ORDER BY 1;
      sql_query +=
                " SELECT '1'                       AS TYPE_PRE_CDT,  \n"
                " t1.PREDISP_UNITEDISP             AS VALEUR_1 ,     \n"
                " t2.CDF_NOM                       AS INFO_1   ,     \n"
                " NULL                             AS VALEUR_2 ,     \n"
                " t3.SAC_NOM                       AS INFO_2   ,     \n"
                " NULL                             AS VALEUR_3 ,     \n"
                " NULL                             AS INFO_3   ,     \n"
                " NULL                             AS VALEUR_4       \n"
                " FROM    predisp_pre_dispensation t1,   \n"
                " cdf_codif                        t2 ,  \n"
                " sac_subactive                    t3    \n"
                " WHERE   t1.PREDISP_CDF_UD_CODE_FK    = t2.CDF_CODE_PK          \n"
                " AND     t2.CDF_NUMERO_PK             = '19'                    \n"
                " AND     t3.SAC_CODE_SQ_PK            = t1.PREDISP_SAC_CODE_FK  \n"
                " AND     t1.PREDISP_PRE_CODE_FK_PK    = '"+CODECIP+"'           \n"
                " UNION  \n"
                " SELECT '2'                       AS TYPE_PRE_CDT , \n"
                " NULL                             AS VALEUR_1 ,     \n"
                " t2.CDF_NOM                       AS INFO_1   ,     \n"
                " NULL                             AS VALEUR_2 ,     \n"
                " NULL                             AS INFO_2   ,     \n"
                " NULL                             AS VALEUR_3 ,     \n"
                " NULL                             AS INFO_3   ,     \n"
                " NULL                             AS VALEUR_4       \n"
                " FROM   preucd_comment_doseucd    t1 ,   \n"
                " cdf_codif                        t2     \n"
                " WHERE  t1.PREUCD_CDF_COMUCD_CODE_FK_PK     = t2.CDF_CODE_PK  \n"
                " AND    t2.CDF_NUMERO_PK                    = '31'            \n"
                " AND    t1.PREUCD_PRE_CODE_FK_PK            = '"+CODECIP+"'   \n"
                " UNION  \n"
                " SELECT '3'                     AS TYPE_PRE_CDT , \n"
                " NULL                           AS VALEUR_1 ,     \n"
                " t2.CDF_NOM                     AS INFO_1   ,     \n"
                " NULL                           AS VALEUR_2 ,     \n"
                " NULL                           AS INFO_2   ,     \n"
                " NULL                           AS VALEUR_3 ,     \n"
                " NULL                           AS INFO_3   ,     \n"
                " NULL                           AS VALEUR_4       \n"
                " FROM   cocont_compo_contenant  t1,  \n"
                " cdf_codif                      t2   \n"
                " WHERE  t1.COCONT_CDF_GAL_CODE_FK   = t2.CDF_CODE_PK  \n"
                " AND    t2.CDF_NUMERO_PK            = '22'            \n"
                " AND    t1.COCONT_PRE_CODE_FK_PK    = '"+CODECIP+"'   \n"
                " UNION  \n"
                " SELECT '4'                         AS TYPE_PRE_CDT, \n"
                " IFNULL(t1.PRECONT_NBCONTENANT,1)   AS VALEUR_1 ,    \n"
                " t2.CDF_NOM                         AS INFO_1   ,    \n"
                " t1.PRECONT_NBCONTENANCE            AS VALEUR_2 ,    \n"
                " t3.CDF_NOM                         AS INFO_2   ,    \n"
                " PRECONT_VOLCONTENANT               AS VALEUR_3 ,    \n"
                " t4.CDF_NOM                         AS INFO_3   ,    \n"
                " PRECONT_NBCONTENANT_REEL           AS VALEUR_4      \n"
                " FROM     precont_pre_contenant  t1 ,  \n"
                " cdf_codif                       t2 ,  \n"
                " cdf_codif                       t3,   \n"
                " cdf_codif                       t4    \n"
                " WHERE  t1.PRECONT_CDF_COCDT_CODE_FK   = t2.CDF_CODE_PK  \n"
                " AND    t2.CDF_NUMERO_PK               = '04'            \n"
                " AND    t1.PRECONT_CDF_COCE_CODE_FK    = t3.CDF_CODE_PK  \n"
                " AND    t3.CDF_NUMERO_PK               = '21'            \n"
                " AND    t1.PRECONT_CDF_VOLCONT_CODE_FK = t4.CDF_CODE_PK  \n"
                " AND    t4.CDF_NUMERO_PK               = '21'            \n"
                " AND    t1.PRECONT_PRE_CODE_FK_PK      = '"+CODECIP+"'   \n"
                " UNION  \n"
                " SELECT  '5'                    AS TYPE_PRE_CDT , \n"
                " NULL                           AS VALEUR_1 ,     \n"
                " t2.CDF_NOM                     AS INFO_1   ,     \n"
                " t1.PREMAT_NUMORD               AS VALEUR_2 ,     \n"
                " NULL                           AS INFO_2   ,     \n"
                " NULL                           AS VALEUR_3 ,     \n"
                " NULL                           AS INFO_3   ,     \n"
                " NULL                           AS VALEUR_4       \n"
                " FROM   premat_pre_materiau     t1,  \n"
                " cdf_codif                      t2   \n"
                " WHERE  t1.PREMAT_CDF_MACDT_CODE_FK_PK     = t2.CDF_CODE_PK  \n"
                " AND    t2.CDF_NUMERO_PK                   = '09'            \n"
                " AND    t1.PREMAT_PRE_CODE_FK_PK           = '"+CODECIP+"'   \n"
                " UNION  \n"
                " SELECT '6'                    AS TYPE_PRE_CDT,  \n"
                " NULL                          AS VALEUR_1 ,     \n"
                " t2.CDF_NOM                    AS INFO_1   ,     \n"
                " t1.PRECAR_NUMORD              AS VALEUR_2 ,     \n"
                " NULL                          AS INFO_2   ,     \n"
                " NULL                          AS VALEUR_3 ,     \n"
                " NULL                          AS INFO_3   ,     \n"
                " NULL                          AS VALEUR_4       \n"
                " FROM   precar_presentation_caractcomp  t1,  \n"
                " cdf_codif                              t2   \n"
                " WHERE  t1.PRECAR_CDF_CODE_CACDT_FK_PK     = t2.CDF_CODE_PK  \n"
                " AND    t2.CDF_NUMERO_PK                   = '01'            \n"
                " AND    t1.PRECAR_PRE_CODE_FK_PK           = '"+CODECIP+"'   \n"
                " UNION  \n"
                " SELECT '7'                     AS TYPE_PRE_CDT, \n"
                " NULL                           AS VALEUR_1 ,    \n"
                " t2.CDF_NOM                     AS INFO_1   ,    \n"
                " t1.PRECEMB_NUMORD              AS VALEUR_2 ,    \n"
                " NULL                           AS INFO_2   ,    \n"
                " NULL                           AS VALEUR_3 ,    \n"
                " NULL                           AS INFO_3   ,    \n"
                " NULL                           AS VALEUR_4      \n"
                " FROM   precemb_pre_caremballage        t1,      \n"
                " cdf_codif                              t2       \n"
                " WHERE  t1.PRECEMB_CDF_CAREMB_CODE_FK_PK   = t2.CDF_CODE_PK  \n"
                " AND    t2.CDF_NUMERO_PK                   = '01'            \n"
                " AND    t1.PRECEMB_PRE_CODE_FK_PK          = '"+CODECIP+"'   \n"
                " UNION  \n"
                " SELECT  DISTINCT  \n"
                " '8'                            AS TYPE_PRE_CDT, \n"
                " NULL                           AS VALEUR_1 ,    \n"
                " t3.CDF_NOM                     AS INFO_1   ,    \n"
                " NULL                           AS VALEUR_2 ,    \n"
                " (t1.SPAFS_DATE_PK)             AS INFO_2   ,    \n"
                " NULL                           AS VALEUR_3 ,    \n"
                " NULL                           AS INFO_3   ,    \n"
                " NULL                           AS VALEUR_4      \n"
                " FROM   spafs_specialite_afssaps t1 ,  \n"
                " pre_presentation                t2 ,  \n"
                " cdf_codif                       t3    \n"
                " WHERE  t1.SPAFS_RUBCDF_NUMERO_PK IN ('SP','04')       \n"
                " AND    t1.SPAFS_SP_CODE_FK_PK    = t2.PRE_SP_CODE_FK  \n"
                " AND    t1.SPAFS_DATE_PK          = (SELECT MAX(SPAFS_DATE_PK)        \n"
                "                                     FROM   spafs_specialite_afssaps  \n"
                "                                     WHERE  SPAFS_SP_CODE_FK_PK  = t2.PRE_SP_CODE_FK  \n"
                "                                     AND    SPAFS_RUBCDF_NUMERO_PK  IN ('SP','04'))   \n"
                " AND    t3.CDF_CODE_PK            = t1.SPAFS_CDF_CODE_DOC_FK_PK                       \n"
                " AND    t3.CDF_NUMERO_PK          = '25'           \n"
                " AND    t2.PRE_CODE_PK            = '"+CODECIP+"'  \n"
                " ORDER BY 1;   \n";

       } else if ( VarType == 2) {   // --Code CIP 13

 //+     SELECT '1'                    AS TYPE_PRE_CDT     ,
 //+     t1.PREDISP_UNITEDISP   AS VALEUR_1 ,
 //+     t2.CDF_NOM             AS INFO_1   ,
 //+     NULL                   AS VALEUR_2 ,
 //+     t3.SAC_NOM             AS INFO_2   ,
 //+     NULL                   AS VALEUR_3 ,
 //+     NULL                   AS INFO_3   ,
 //+     NULL                   AS VALEUR_4
 //+  FROM PREDISP_PRE_DISPENSATION t1,
 //+    PRE_PRESENTATION     t4,
 //+    CDF_CODIF                t2,
 //+    SAC_SUBACTIVE            t3
 //+  WHERE t1.PREDISP_PRE_CODE_FK_PK = t4.PRE_CODE_PK
 //+  AND   t1.PREDISP_CDF_UD_CODE_FK = t2.CDF_CODE_PK(+)
 //+  AND   t2.CDF_NUMERO_PK(+)       = '19'
 //+  AND   t3.SAC_CODE_SQ_PK         = t1.PREDISP_SAC_CODE_FK
 //+  AND   t4.PRE_EAN_REF      = CODECIP
 //+  UNION
 //+  SELECT '1.'||t1.PREUCD_NUMORD  AS TYPE_PRE_CDT     ,
 //+      NULL                    AS VALEUR_1 ,
 //+      t2.CDF_NOM              AS INFO_1   ,
 //+      NULL                    AS VALEUR_2 ,
 //+      NULL                    AS INFO_2   ,
 //+      NULL                 AS VALEUR_3 ,
 //+      NULL                    AS INFO_3   ,
 //+      NULL                    AS VALEUR_4
 //+  FROM PREUCD_COMMENT_DOSEUCD    t1 ,
 //+    CDF_CODIF                 t2 ,
 //+    PRE_PRESENTATION      t3
 //+  WHERE t1.PREUCD_PRE_CODE_FK_PK      = t3.PRE_CODE_PK
 //+  AND   t1.PREUCD_CDF_COMUCD_CODE_FK_PK  = t2.CDF_CODE_PK(+)
 //+  AND   t2.CDF_NUMERO_PK(+)              = '31'
 //+  AND   t3.PRE_EAN_REF              = CODECIP
 //+  UNION
 //+  SELECT '2.'||t1.COCONT_NUM_PK          AS TYPE_PRE_CDT     ,
 //+    NULL                           AS VALEUR_1 ,
 //+    t2.CDF_NOM                     AS INFO_1   ,
 //+    NULL                           AS VALEUR_2 ,
 //+    NULL                           AS INFO_2   ,
 //+    NULL                          AS VALEUR_3 ,
 //+    NULL                           AS INFO_3   ,
 //+    NULL                           AS VALEUR_4
 //+  FROM COCONT_COMPO_CONTENANT t1,
 //+    CDF_CODIF          t2,
 //+    PRE_PRESENTATION   t3
 //+  WHERE t1.COCONT_CDF_GAL_CODE_FK = t2.CDF_CODE_PK
 //+  AND   t1.COCONT_PRE_CODE_FK_PK = t3.PRE_CODE_PK
 //+  AND   t2.CDF_NUMERO_PK          = '22'
 //+  AND   t3.PRE_EAN_REF      = CODECIP
 //+  UNION
 //+  SELECT '2.'||t1.PRECONT_COCONT_NUM_FK_PK AS TYPE_PRE_CDT     ,
 //+     NVL(t1.PRECONT_NBCONTENANT,1)   AS VALEUR_1 ,
 //+     t2.CDF_NOM                      AS INFO_1   ,
 //+     t1.PRECONT_NBCONTENANCE         AS VALEUR_2 ,
 //+     t3.CDF_NOM                      AS INFO_2   ,
 //+     PRECONT_VOLCONTENANT            AS VALEUR_3 ,
 //+      t4.cdf_nom       AS INFO_3   ,
 //+     PRECONT_NBCONTENANT_REEL        AS VALEUR_4
 //+  FROM PRECONT_PRE_CONTENANT    t1 ,
 //+    CDF_CODIF                t2 ,
 //+    CDF_CODIF                t3,
 //+    CDF_CODIF      t4,
 //+    PRE_PRESENTATION     t5
 //+  WHERE t1.PRECONT_PRE_CODE_FK_PK  = t5.PRE_CODE_PK
 //+  AND t1.PRECONT_CDF_COCDT_CODE_FK = t2.CDF_CODE_PK(+)
 //+  AND t2.CDF_NUMERO_PK(+)          = '04'
 //+  AND t1.PRECONT_CDF_COCE_CODE_FK  = t3.CDF_CODE_PK(+)
 //+  AND t3.CDF_NUMERO_PK(+)          = '21'
 //+  AND t1.PRECONT_CDF_VOLCONT_CODE_FK = t4.CDF_CODE_PK(+)
 //+  AND t4.CDF_NUMERO_PK(+)          = '21'
 //+     AND t5.PRE_EAN_REF        = CODECIP
 //+  UNION
 //+  SELECT  '2.'||t1.PREMAT_COCONT_NUM_FK_PK||'.'||t1.PREMAT_NUMORD   AS TYPE_PRE_CDT     ,
 //+     NULL                           AS VALEUR_1 ,
 //+     t2.CDF_NOM                     AS INFO_1   ,
 //+     t1.PREMAT_NUMORD               AS VALEUR_2 ,
 //+     NULL                           AS INFO_2   ,
 //+     NULL                          AS VALEUR_3 ,
 //+     NULL                           AS INFO_3   ,
 //+     NULL                           AS VALEUR_4
 //+  FROM PREMAT_PRE_MATERIAU  t1,
 //+    CDF_CODIF            t2,
 //+    PRE_PRESENTATION    t3
 //+  WHERE  t1.PREMAT_PRE_CODE_FK_PK    = t3.PRE_CODE_PK
 //+  AND t1.PREMAT_CDF_MACDT_CODE_FK_PK = t2.CDF_CODE_PK
 //+  AND t2.CDF_NUMERO_PK               = '09'
 //+  AND t3.PRE_EAN_REF                 = CODECIP
 //+     UNION
 //+  SELECT '2.2.'||t1.PRECAR_COCONT_NUM_FK_PK||'.'||t1.PRECAR_NUMORD  AS TYPE_PRE_CDT     ,
 //+    NULL              AS VALEUR_1 ,
 //+    t2.CDF_NOM        AS INFO_1   ,
 //+    t1.PRECAR_NUMORD  AS VALEUR_2 ,
 //+    NULL              AS INFO_2   ,
 //+    NULL            AS VALEUR_3 ,
 //+    NULL              AS INFO_3   ,
 //+    NULL              AS VALEUR_4
 //+  FROM PRECAR_PRESENTATION_CARACTCOMP t1,
 //+    CDF_CODIF                      t2,
 //+    PRE_PRESENTATION    t3
 //+  WHERE t1.PRECAR_PRE_CODE_FK_PK    = t3.PRE_CODE_PK
 //+  AND t1.PRECAR_CDF_CODE_CACDT_FK_PK = t2.CDF_CODE_PK
 //+  AND t2.CDF_NUMERO_PK               = '01'
 //+  AND t3.PRE_EAN_REF                 = CODECIP
 //+  UNION
 //+  SELECT '3.'||t1.PRECEMB_NUMORD AS TYPE_PRE_CDT     ,
 //+     NULL                  AS VALEUR_1 ,
 //+     t2.CDF_NOM            AS INFO_1   ,
 //+     t1.PRECEMB_NUMORD     AS VALEUR_2 ,
 //+     NULL                  AS INFO_2   ,
 //+     NULL                 AS VALEUR_3 ,
 //+     NULL                  AS INFO_3   ,
 //+     NULL                  AS VALEUR_4
 //+  FROM PRECEMB_PRE_CAREMBALLAGE t1,
 //+    CDF_CODIF                t2,
 //+    PRE_PRESENTATION    t3
 //+  WHERE t1.PRECEMB_PRE_CODE_FK_PK       = t3.PRE_CODE_PK
 //+  AND t1.PRECEMB_CDF_CAREMB_CODE_FK_PK  = t2.CDF_CODE_PK
 //+  AND t2.CDF_NUMERO_PK                  = '01'
 //+  AND t3.PRE_EAN_REF              = CODECIP
 //+  UNION
 //+  SELECT DISTINCT
 //+         '4'                        AS TYPE_PRE_CDT     ,
 //+    NULL                      AS VALEUR_1 ,
 //+    t3.CDF_NOM                AS INFO_1   ,
 //+    NULL                      AS VALEUR_2 ,
 //+    TO_CHAR(t1.SPAFS_DATE_PK) AS INFO_2   ,
 //+    NULL                    AS VALEUR_3 ,
 //+    NULL                      AS INFO_3   ,
 //+    NULL                      AS VALEUR_4
 //+  FROM SPAFS_SPECIALITE_AFSSAPS t1 ,
 //+    PRE_PRESENTATION         t2 ,
 //+    CDF_CODIF                t3
 //+  WHERE  t1.SPAFS_RUBCDF_NUMERO_PK IN ('SP','04')
 //+  AND    t1.SPAFS_SP_CODE_FK_PK    = t2.PRE_SP_CODE_FK
 //+  AND    t1.SPAFS_DATE_PK          = (SELECT MAX(SPAFS_DATE_PK)
 //+  FROM   SPAFS_SPECIALITE_AFSSAPS
 //+  WHERE  SPAFS_SP_CODE_FK_PK     = t2.PRE_SP_CODE_FK
 //+  AND    SPAFS_RUBCDF_NUMERO_PK  IN ('SP','04'))
 //+  AND    t3.CDF_CODE_PK          = t1.SPAFS_CDF_CODE_DOC_FK_PK
 //+  AND    t3.CDF_NUMERO_PK        = '25'
 //+  AND    t2.PRE_EAN_REF          = CODECIP
 //+  ORDER BY 1;
                sql_query += " SELECT '1'                    AS TYPE_PRE_CDT     ,"
                     " t1.PREDISP_UNITEDISP   AS VALEUR_1 ,"
                     " t2.CDF_NOM             AS INFO_1   ,"
                     " NULL                   AS VALEUR_2 ,"
                     " t3.SAC_NOM             AS INFO_2   ,"
                     " NULL                   AS VALEUR_3 ,"
                     " NULL                   AS INFO_3   ,"
                     " NULL                   AS VALEUR_4"
                     " FROM predisp_pre_dispensation t1,"
                     " pre_presentation     t4,"
                     " cdf_codif                t2,"
                     " sac_subactive            t3"
                     " WHERE t1.PREDISP_PRE_CODE_FK_PK = t4.PRE_CODE_PK"
                     " AND   t1.PREDISP_CDF_UD_CODE_FK = t2.CDF_CODE_PK"
                     " AND   t2.CDF_NUMERO_PK       = '19'"
                     " AND   t3.SAC_CODE_SQ_PK         = t1.PREDISP_SAC_CODE_FK"
                     " AND   t4.PRE_EAN_REF       = '"+CODECIP+"'"
                     " UNION"
                     " SELECT '2'              AS TYPE_PRE_CDT     ,"
                     " NULL                    AS VALEUR_1 ,"
                     " t2.CDF_NOM              AS INFO_1   ,"
                     " NULL                    AS VALEUR_2 ,"
                     " NULL                    AS INFO_2   ,"
                     " NULL                 AS VALEUR_3 ,"
                     " NULL                    AS INFO_3   ,"
                     " NULL                    AS VALEUR_4"
                     " FROM preucd_comment_doseucd    t1 ,"
                     " cdf_codif                 t2 ,"
                     " pre_presentation      t3"
                     " WHERE t1.PREUCD_PRE_CODE_FK_PK      = t3.PRE_CODE_PK"
                     " AND   t1.PREUCD_CDF_COMUCD_CODE_FK_PK  = t2.CDF_CODE_PK"
                     " AND   t2.CDF_NUMERO_PK              = '31'"
                     " AND   t3.PRE_EAN_REF               = '"+CODECIP+"'"
                     " UNION"
                     " SELECT '2.'t1.COCONT_NUM_PK          AS TYPE_PRE_CDT     ,"
                     " NULL                           AS VALEUR_1 ,"
                     " t2.CDF_NOM                     AS INFO_1   ,"
                     " NULL                           AS VALEUR_2 ,"
                     " NULL                           AS INFO_2   ,"
                     " NULL                          AS VALEUR_3 ,"
                     " NULL                           AS INFO_3   ,"
                     " NULL                           AS VALEUR_4"
                     " FROM cocont_compo_contenant t1,"
                     " cdf_codif          t2,"
                     " pre_presentation   t3"
                     " WHERE t1.COCONT_CDF_GAL_CODE_FK = t2.CDF_CODE_PK"
                     " AND   t1.COCONT_PRE_CODE_FK_PK = t3.PRE_CODE_PK"
                     " AND   t2.CDF_NUMERO_PK          = '22'"
                     " AND   t3.PRE_EAN_REF       = '"+CODECIP+"'"
                     " UNION"
                     " SELECT '2.'t1.PRECONT_COCONT_NUM_FK_PK AS TYPE_PRE_CDT     ,"
                     " IFNULL(t1.PRECONT_NBCONTENANT,1)   AS VALEUR_1 , "  //-- replace NVL  by   IFNULL"
                     " t2.CDF_NOM                      AS INFO_1   ,"
                     " t1.PRECONT_NBCONTENANCE         AS VALEUR_2 ,"
                     " t3.CDF_NOM                      AS INFO_2   ,"
                     " PRECONT_VOLCONTENANT            AS VALEUR_3 ,"
                     " t4.CDF_NOM       AS INFO_3   ,"
                     " PRECONT_NBCONTENANT_REEL        AS VALEUR_4"
                     " FROM precont_pre_contenant    t1 ,"
                     " cdf_codif                t2 ,"
                     " cdf_codif                t3,"
                     " cdf_codif      t4,"
                     " pre_presentation     t5"
                     " WHERE t1.PRECONT_PRE_CODE_FK_PK  = t5.PRE_CODE_PK"
                     " AND t1.PRECONT_CDF_COCDT_CODE_FK = t2.CDF_CODE_PK"
                     " AND t2.CDF_NUMERO_PK          = '04'"
                     " AND t1.PRECONT_CDF_COCE_CODE_FK  = t3.CDF_CODE_PK"
                     " AND t3.CDF_NUMERO_PK          = '21'"
                     " AND t1.PRECONT_CDF_VOLCONT_CODE_FK = t4.CDF_CODE_PK"
                     " AND t4.CDF_NUMERO_PK          = '21'"
                     " AND t5.PRE_EAN_REF         = '"+CODECIP+"'"
                     " UNION"
                     " SELECT  '2.'t1.PREMAT_COCONT_NUM_FK_PK.'t1.PREMAT_NUMORD   AS TYPE_PRE_CDT     ,"
                     " NULL                           AS VALEUR_1 ,"
                     " t2.CDF_NOM                     AS INFO_1   ,"
                     " t1.PREMAT_NUMORD               AS VALEUR_2 ,"
                     " NULL                           AS INFO_2   ,"
                     " NULL                          AS VALEUR_3 ,"
                     " NULL                           AS INFO_3   ,"
                     " NULL                           AS VALEUR_4"
                     " FROM premat_pre_materiau  t1,"
                     " cdf_codif            t2,"
                     " pre_presentation    t3"
                     " WHERE  t1.PREMAT_PRE_CODE_FK_PK    = t3.PRE_CODE_PK"
                     " AND t1.PREMAT_CDF_MACDT_CODE_FK_PK = t2.CDF_CODE_PK"
                     " AND t2.CDF_NUMERO_PK               = '09'"
                     " AND t3.PRE_EAN_REF                  = '"+CODECIP+"'"
                     " UNION"
                     " SELECT '2.2.'t1.PRECAR_COCONT_NUM_FK_PK.'t1.PRECAR_NUMORD  AS TYPE_PRE_CDT     ,"
                     " NULL              AS VALEUR_1 ,"
                     " t2.CDF_NOM        AS INFO_1   ,"
                     " t1.PRECAR_NUMORD  AS VALEUR_2 ,"
                     " NULL              AS INFO_2   ,"
                     " NULL            AS VALEUR_3 ,"
                     " NULL              AS INFO_3   ,"
                     " NULL              AS VALEUR_4"
                     " FROM precar_presentation_caractcomp t1,"
                     " cdf_codif                      t2,"
                     " pre_presentation    t3"
                     " WHERE t1.PRECAR_PRE_CODE_FK_PK    = t3.PRE_CODE_PK"
                     " AND t1.PRECAR_CDF_CODE_CACDT_FK_PK = t2.CDF_CODE_PK"
                     " AND t2.CDF_NUMERO_PK               = '01'"
                     " AND t3.PRE_EAN_REF                  = '"+CODECIP+"'"
                     " UNION"
                     " SELECT '3.'t1.PRECEMB_NUMORD AS TYPE_PRE_CDT     ,"
                     " NULL                  AS VALEUR_1 ,"
                     " t2.CDF_NOM            AS INFO_1   ,"
                     " t1.PRECEMB_NUMORD     AS VALEUR_2 ,"
                     " NULL                  AS INFO_2   ,"
                     " NULL                 AS VALEUR_3 ,"
                     " NULL                  AS INFO_3   ,"
                     " NULL                  AS VALEUR_4"
                     " FROM precemb_pre_caremballage t1,"
                     " cdf_codif                t2,"
                     " pre_presentation    t3"
                     " WHERE t1.PRECEMB_PRE_CODE_FK_PK       = t3.PRE_CODE_PK"
                     " AND t1.PRECEMB_CDF_CAREMB_CODE_FK_PK  = t2.CDF_CODE_PK"
                     " AND t2.CDF_NUMERO_PK                  = '01'"
                     " AND t3.PRE_EAN_REF               = '"+CODECIP+"'"
                     " UNION"
                     " SELECT DISTINCT"
                     " '4'                        AS TYPE_PRE_CDT     ,"
                     " NULL                      AS VALEUR_1 ,"
                     " t3.CDF_NOM                AS INFO_1   ,"
                     " NULL                      AS VALEUR_2 ,"
                     " (t1.SPAFS_DATE_PK) AS INFO_2   , "  //-- removing TO_CHAR  may bee replace by ?  lpad(format(i, 0), 4, '0') ou CAST(nombre as char) "
                     " NULL                    AS VALEUR_3 ,"
                     " NULL                      AS INFO_3   ,"
                     " NULL                      AS VALEUR_4"
                     " FROM spafs_specialite_afssaps t1 ,"
                     " pre_presentation         t2 ,"
                     " cdf_codif                t3"
                     " WHERE  t1.SPAFS_RUBCDF_NUMERO_PK IN ('SP','04')"
                     " AND    t1.SPAFS_SP_CODE_FK_PK    = t2.PRE_SP_CODE_FK"
                     " AND    t1.SPAFS_DATE_PK          = (SELECT MAX(SPAFS_DATE_PK)"
                     " FROM   spafs_specialite_afssaps"
                     " WHERE  SPAFS_SP_CODE_FK_PK     = t2.PRE_SP_CODE_FK"
                     " AND    SPAFS_RUBCDF_NUMERO_PK  IN ('SP','04'))"
                     " AND    t3.CDF_CODE_PK          = t1.SPAFS_CDF_CODE_DOC_FK_PK"
                     " AND    t3.CDF_NUMERO_PK        = '25'"
                     " AND    t2.PRE_EAN_REF           = '"+CODECIP+"'"
                     " ORDER BY 1;";

       }
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_PRE_CDT() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_TYPE_PRE_CDT = value(0).toString();
                m_VALEUR_1     = value(1).toDouble();
                m_INFO_1       = value(2).toString();
                m_VALEUR_2     = value(3).toDouble();
                m_INFO_2       = value(4).toString();
                m_VALEUR_3     = value(5).toDouble();
                m_INFO_3       = value(6).toString();
                m_VALEUR_4     = value(7).toDouble();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      QString TYPE_PRE_CDT() {return m_TYPE_PRE_CDT;}
      double  VALEUR_1()     {return m_VALEUR_1;}
      QString INFO_1()       {return m_INFO_1;}
      double  VALEUR_2()     {return m_VALEUR_2;}
      QString INFO_2()       {return m_INFO_2;}
      double  VALEUR_3()     {return m_VALEUR_3;}
      QString INFO_3()       {return m_INFO_3;}
      double  VALEUR_4()     {return m_VALEUR_4;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      QString m_TYPE_PRE_CDT;
      double  m_VALEUR_1;
      QString m_INFO_1;
      double  m_VALEUR_2;
      QString m_INFO_2;
      double  m_VALEUR_3;
      QString m_INFO_3;
      double  m_VALEUR_4;
 };

 //================================== C_GET_THE_PRE_STATUT_CUR   -71- ==================================
 /****************************************************************************
 *   Nom           :  GET_THE_PRE_STATUT
 -----------------------------------------------------------------------------
 *   Date creation : 02/09/2008
 -----------------------------------------------------------------------------
 *   Description   :  Cette procédure renvoie les informations concernant le
 *                    statut de la présentation pour le CIP passé en paramètre.
 *   MAJ           :  19/12/2008
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_PRE_STATUT_CUR  C_GET_THE_PRE_STATUT ( database(), this );
      while ( C_GET_THE_PRE_STATUT.next( CODECIP , VarType  ) )
            { html += tr("<br><b> GET_THE_PRE_STATUT : </b>  ") + C_GET_THE_PRE_STATUT.MEMBER();
            }
  */
  class C_GET_THE_PRE_STATUT_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_PRE_STATUT_CUR ---------------------
      C_GET_THE_PRE_STATUT_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( QString CODECIP , double VarType )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............
       if ( VarType == 1) {               // --Code CIP 7

 //+  SELECT '1'                       AS TYPE_PRE_STATUT            ,
 //+     t2.CDF_NOM              AS REF_OFF         ,
 //+     NULL                    AS IDENT           ,
 //+     t1.PRESTP_DATE_AFSSAPS  AS DAT_REF_OFF     ,
 //+     NULL                    AS DAT_REVISION
 //+  FROM   PRESTP_PRE_STP   t1,
 //+     CDF_CODIF        t2
 //+  WHERE  t1.PRESTP_CDF_STP_CODE_FK_PK = t2.CDF_CODE_PK
 //+  AND    t2.CDF_NUMERO_PK             = '14'
 //+  AND    t1.PRESTP_PRE_CODE_FK_PK     = CODECIP
 //+  UNION
 //+  SELECT '2'                   AS TYPE_PRE_STATUT        ,
 //+     t2.CDF_NOM            AS REF_OFF     ,
 //+     t1.PRESTC_CODE_IDENT  AS IDENT       ,
 //+     NULL                  AS DAT_REF_OFF ,
 //+     NULL                  AS DAT_REVISION
 //+  FROM   PRESTC_STATUTCOMP_PRESENT  t1,
 //+     CDF_CODIF                  t2
 //+  WHERE  t1.PRESTC_CDF_STCOMP_CODE_FK_PK = t2.CDF_CODE_PK
 //+  AND    t2.CDF_NUMERO_PK                = '14'
 //+  AND    t1.PRESTC_PRE_CODE_FK_PK        = CODECIP
 //+  UNION
 //+  SELECT '3'              AS TYPE_PRE_STATUT        ,
 //+     CDF_NOM          AS REF_OFF     ,
 //+     NULL             AS IDENT       ,
 //+     SPAFS_DATE_PK    AS DAT_REF_OFF ,
 //+     SPAFS_DATE_REVIS AS DAT_REVISION
 //+  FROM   PRE_PRESENTATION          t1,
 //+     SPAFS_SPECIALITE_AFSSAPS  t2,
 //+     CDF_CODIF                 t3
 //+  WHERE  t2.SPAFS_SP_CODE_FK_PK     = t1.PRE_SP_CODE_FK
 //+  AND    t2.SPAFS_RUBCDF_NUMERO_PK  = 'SP'
 //+  AND    t2.SPAFS_DATE_PK           = (SELECT MAX(SPAFS_DATE_PK)
 //+               FROM   SPAFS_SPECIALITE_AFSSAPS
 //+               WHERE  SPAFS_SP_CODE_FK_PK     = t1.PRE_SP_CODE_FK
 //+               AND    SPAFS_RUBCDF_NUMERO_PK  IN ('SP','14','CPH')
 //+               AND    SPAFS_DATE_REVIS IS NULL)
 //+  AND    t3.CDF_CODE_PK             = t2.SPAFS_CDF_CODE_DOC_FK_PK
 //+  AND    t3.CDF_NUMERO_PK           = '25'
 //+  AND    t1.PRE_CODE_PK             = CODECIP
 //+  UNION
 //+  SELECT '3'              AS TYPE_PRE_STATUT        ,
 //+     CDF_NOM          AS REF_OFF     ,
 //+     NULL             AS IDENT       ,
 //+     SPAFS_DATE_PK    AS DAT_REF_OFF ,
 //+     SPAFS_DATE_REVIS AS DAT_REVISION
 //+  FROM   PRE_PRESENTATION          t1,
 //+     SPAFS_SPECIALITE_AFSSAPS  t2,
 //+     CDF_CODIF                 t3
 //+  WHERE  t2.SPAFS_SP_CODE_FK_PK     = t1.PRE_SP_CODE_FK
 //+  AND    t2.SPAFS_RUBCDF_NUMERO_PK  IN ('14','CPH')
 //+  AND    t2.SPAFS_DATE_PK           = (SELECT MAX(SPAFS_DATE_PK)
 //+               FROM   SPAFS_SPECIALITE_AFSSAPS
 //+               WHERE  SPAFS_SP_CODE_FK_PK     = t1.PRE_SP_CODE_FK
 //+               AND    SPAFS_RUBCDF_NUMERO_PK IN ('SP','14','CPH')
 //+               AND    SPAFS_DATE_REVIS IS NULL)
 //+  AND    t3.CDF_CODE_PK             = t2.SPAFS_CDF_CODE_DOC_FK_PK
 //+  AND    t3.CDF_NUMERO_PK           = '25'
 //+  AND    t1.PRE_CODE_PK             = CODECIP
 //+  AND    (CDF_NOM,SPAFS_DATE_PK) NOT IN (SELECT CDF_NOM,SPAFS_DATE_PK
 //+  FROM   PRE_PRESENTATION          t1,
 //+     SPAFS_SPECIALITE_AFSSAPS  t2,
 //+     CDF_CODIF                 t3
 //+  WHERE  t2.SPAFS_SP_CODE_FK_PK     = t1.PRE_SP_CODE_FK
 //+  AND    t2.SPAFS_RUBCDF_NUMERO_PK  = ('SP')
 //+  AND    t2.SPAFS_DATE_PK           = (SELECT MAX(SPAFS_DATE_PK)
 //+               FROM   SPAFS_SPECIALITE_AFSSAPS
 //+               WHERE  SPAFS_SP_CODE_FK_PK     = t1.PRE_SP_CODE_FK
 //+               AND    SPAFS_RUBCDF_NUMERO_PK  IN ('SP','14','CPH')
 //+               AND    SPAFS_DATE_REVIS IS NULL)
 //+  AND    t3.CDF_CODE_PK             = t2.SPAFS_CDF_CODE_DOC_FK_PK
 //+  AND    t3.CDF_NUMERO_PK           = '25'
 //+  AND    t1.PRE_CODE_PK             = CODECIP);
                sql_query +=
                     " SELECT '1'              AS TYPE_PRE_STATUT            ,"
                     " t2.CDF_NOM              AS REF_OFF         ,"
                     " NULL                    AS IDENT           ,"
                     " t1.PRESTP_DATE_AFSSAPS  AS DAT_REF_OFF     ,"
                     " NULL                    AS DAT_REVISION"
                     " FROM   prestp_pre_stp   t1,"
                     " cdf_codif        t2"
                     " WHERE  t1.PRESTP_CDF_STP_CODE_FK_PK = t2.CDF_CODE_PK"
                     " AND    t2.CDF_NUMERO_PK             = '14'"
                     " AND    t1.PRESTP_PRE_CODE_FK_PK      = '"+CODECIP+"'"
                     " UNION"
                     " SELECT '2'                   AS TYPE_PRE_STATUT        ,"
                     " t2.CDF_NOM            AS REF_OFF     ,"
                     " t1.PRESTC_CODE_IDENT  AS IDENT       ,"
                     " NULL                  AS DAT_REF_OFF ,"
                     " NULL                  AS DAT_REVISION"
                     " FROM   prestc_statutcomp_present  t1,"
                     " cdf_codif                  t2"
                     " WHERE  t1.PRESTC_CDF_STCOMP_CODE_FK_PK = t2.CDF_CODE_PK"
                     " AND    t2.CDF_NUMERO_PK                = '14'"
                     " AND    t1.PRESTC_PRE_CODE_FK_PK         = '"+CODECIP+"'"
                     " UNION"
                     " SELECT '3'              AS TYPE_PRE_STATUT        ,"
                     " CDF_NOM          AS REF_OFF     ,"
                     " NULL             AS IDENT       ,"
                     " SPAFS_DATE_PK    AS DAT_REF_OFF ,"
                     " SPAFS_DATE_REVIS AS DAT_REVISION"
                     " FROM   pre_presentation          t1,"
                     " spafs_specialite_afssaps  t2,"
                     " cdf_codif                 t3"
                     " WHERE  t2.SPAFS_SP_CODE_FK_PK     = t1.PRE_SP_CODE_FK"
                     " AND    t2.SPAFS_RUBCDF_NUMERO_PK  = 'SP'"
                     " AND    t2.SPAFS_DATE_PK           = (SELECT MAX(SPAFS_DATE_PK)"
                     " FROM   spafs_specialite_afssaps"
                     " WHERE  SPAFS_SP_CODE_FK_PK     = t1.PRE_SP_CODE_FK"
                     " AND    SPAFS_RUBCDF_NUMERO_PK  IN ('SP','14','CPH')"
                     " AND    SPAFS_DATE_REVIS IS NULL)"
                     " AND    t3.CDF_CODE_PK             = t2.SPAFS_CDF_CODE_DOC_FK_PK"
                     " AND    t3.CDF_NUMERO_PK           = '25'"
                     " AND    t1.PRE_CODE_PK              = '"+CODECIP+"'"
                     " UNION"
                     " SELECT '3'              AS TYPE_PRE_STATUT        ,"
                     " CDF_NOM          AS REF_OFF     ,"
                     " NULL             AS IDENT       ,"
                     " SPAFS_DATE_PK    AS DAT_REF_OFF ,"
                     " SPAFS_DATE_REVIS AS DAT_REVISION"
                     " FROM   pre_presentation          t1,"
                     " spafs_specialite_afssaps  t2,"
                     " cdf_codif                 t3"
                     " WHERE  t2.SPAFS_SP_CODE_FK_PK     = t1.PRE_SP_CODE_FK"
                     " AND    t2.SPAFS_RUBCDF_NUMERO_PK  IN ('14','CPH')"
                     " AND    t2.SPAFS_DATE_PK           = (SELECT MAX(SPAFS_DATE_PK)"
                     " FROM   spafs_specialite_afssaps"
                     " WHERE  SPAFS_SP_CODE_FK_PK     = t1.PRE_SP_CODE_FK"
                     " AND    SPAFS_RUBCDF_NUMERO_PK IN ('SP','14','CPH')"
                     " AND    SPAFS_DATE_REVIS IS NULL)"
                     " AND    t3.CDF_CODE_PK             = t2.SPAFS_CDF_CODE_DOC_FK_PK"
                     " AND    t3.CDF_NUMERO_PK           = '25'"
                     " AND    t1.PRE_CODE_PK              = '"+CODECIP+"'"
                     " AND    (CDF_NOM,SPAFS_DATE_PK) NOT IN (SELECT CDF_NOM,SPAFS_DATE_PK"
                     " FROM   pre_presentation          t1,"
                     " spafs_specialite_afssaps  t2,"
                     " cdf_codif                 t3"
                     " WHERE  t2.SPAFS_SP_CODE_FK_PK     = t1.PRE_SP_CODE_FK"
                     " AND    t2.SPAFS_RUBCDF_NUMERO_PK  = ('SP')"
                     " AND    t2.SPAFS_DATE_PK           = (SELECT MAX(SPAFS_DATE_PK)"
                     " FROM   spafs_specialite_afssaps"
                     " WHERE  SPAFS_SP_CODE_FK_PK     = t1.PRE_SP_CODE_FK"
                     " AND    SPAFS_RUBCDF_NUMERO_PK  IN ('SP','14','CPH')"
                     " AND    SPAFS_DATE_REVIS IS NULL)"
                     " AND    t3.CDF_CODE_PK             = t2.SPAFS_CDF_CODE_DOC_FK_PK"
                     " AND    t3.CDF_NUMERO_PK           = '25'"
                     " AND    t1.PRE_CODE_PK              = '"+CODECIP+"');";

       } else if ( VarType == 2) {       // --Code CIP 13

 //+         SELECT '1'             AS TYPE_PRE_STATUT ,
 //+     t2.CDF_NOM              AS REF_OFF         ,
 //+     NULL                    AS IDENT           ,
 //+     t1.PRESTP_DATE_AFSSAPS  AS DAT_REF_OFF     ,
 //+     NULL                    AS DAT_REVISION
 //+  FROM PRESTP_PRE_STP   t1,
 //+    CDF_CODIF        t2,
 //+    PRE_PRESENTATION t3
 //+  WHERE t1.PRESTP_PRE_CODE_FK_PK   = t3.PRE_CODE_PK
 //+  AND t1.PRESTP_CDF_STP_CODE_FK_PK = t2.CDF_CODE_PK
 //+  AND t2.CDF_NUMERO_PK             = '14'
 //+  AND t3.PRE_EAN_REF           = CODECIP
 //+  UNION
 //+  SELECT '2'                   AS TYPE_PRE_STATUT        ,
 //+      t2.CDF_NOM            AS REF_OFF     ,
 //+      t1.PRESTC_CODE_IDENT  AS IDENT       ,
 //+      NULL                  AS DAT_REF_OFF ,
 //+      NULL                  AS DAT_REVISION
 //+  FROM PRESTC_STATUTCOMP_PRESENT  t1,
 //+    CDF_CODIF                  t2,
 //+    PRE_PRESENTATION    t3
 //+  WHERE  t1.PRESTC_PRE_CODE_FK_PK     = t3.PRE_CODE_PK
 //+  AND t1.PRESTC_CDF_STCOMP_CODE_FK_PK = t2.CDF_CODE_PK
 //+  AND t2.CDF_NUMERO_PK                = '14'
 //+  AND t3.PRE_EAN_REF     = CODECIP
 //+  UNION
 //+  SELECT '3'              AS TYPE_PRE_STATUT        ,
 //+      CDF_NOM          AS REF_OFF     ,
 //+      NULL             AS IDENT       ,
 //+      SPAFS_DATE_PK    AS DAT_REF_OFF ,
 //+      SPAFS_DATE_REVIS AS DAT_REVISION
 //+  FROM PRE_PRESENTATION          t1,
 //+    SPAFS_SPECIALITE_AFSSAPS  t2,
 //+    CDF_CODIF                 t3
 //+  WHERE  t2.SPAFS_SP_CODE_FK_PK = t1.PRE_SP_CODE_FK
 //+  AND t3.CDF_CODE_PK   = t2.SPAFS_CDF_CODE_DOC_FK_PK
 //+  AND t2.SPAFS_DATE_PK = (SELECT MAX(SPAFS_DATE_PK)
 //+        FROM   SPAFS_SPECIALITE_AFSSAPS
 //+        WHERE  SPAFS_SP_CODE_FK_PK     = t1.PRE_SP_CODE_FK
 //+        AND    SPAFS_RUBCDF_NUMERO_PK  IN ('SP','14','CPH')
 //+        AND    SPAFS_DATE_REVIS IS NULL)
 //+  AND t2.SPAFS_RUBCDF_NUMERO_PK  = 'SP'
 //+  AND t3.CDF_NUMERO_PK           = '25'
 //+  AND t1.PRE_EAN_REF             = CODECIP
 //+  UNION
 //+  SELECT '3'              AS TYPE_PRE_STATUT        ,
 //+      CDF_NOM          AS REF_OFF     ,
 //+      NULL             AS IDENT       ,
 //+      SPAFS_DATE_PK    AS DAT_REF_OFF ,
 //+      SPAFS_DATE_REVIS AS DAT_REVISION
 //+  FROM PRE_PRESENTATION          t1,
 //+    SPAFS_SPECIALITE_AFSSAPS  t2,
 //+    CDF_CODIF                 t3
 //+  WHERE  t2.SPAFS_SP_CODE_FK_PK     = t1.PRE_SP_CODE_FK
 //+  AND t3.CDF_CODE_PK   = t2.SPAFS_CDF_CODE_DOC_FK_PK
 //+  AND t2.SPAFS_DATE_PK = (SELECT MAX(SPAFS_DATE_PK)
 //+        FROM   SPAFS_SPECIALITE_AFSSAPS
 //+        WHERE  SPAFS_SP_CODE_FK_PK     = t1.PRE_SP_CODE_FK
 //+        AND    SPAFS_RUBCDF_NUMERO_PK IN ('SP','14','CPH')
 //+        AND    SPAFS_DATE_REVIS IS NULL)
 //+  AND (CDF_NOM,SPAFS_DATE_PK) NOT IN (SELECT CDF_NOM,SPAFS_DATE_PK
 //+           FROM PRE_PRESENTATION          t1,
 //+             SPAFS_SPECIALITE_AFSSAPS  t2,
 //+             CDF_CODIF                 t3
 //+           WHERE  t2.SPAFS_SP_CODE_FK_PK = t1.PRE_SP_CODE_FK
 //+           AND t2.SPAFS_RUBCDF_NUMERO_PK  = 'SP'
 //+           AND t2.SPAFS_DATE_PK = (SELECT MAX(SPAFS_DATE_PK)
 //+                 FROM   SPAFS_SPECIALITE_AFSSAPS
 //+                 WHERE  SPAFS_SP_CODE_FK_PK     = t1.PRE_SP_CODE_FK
 //+                 AND    SPAFS_RUBCDF_NUMERO_PK  IN ('SP','14','CPH')
 //+                 AND    SPAFS_DATE_REVIS IS NULL)
 //+           AND t3.CDF_CODE_PK   = t2.SPAFS_CDF_CODE_DOC_FK_PK
 //+           AND t3.CDF_NUMERO_PK = '25'
 //+           AND t1.PRE_EAN_REF   = CODECIP)
 //+  AND t2.SPAFS_RUBCDF_NUMERO_PK  IN ('14','CPH')
 //+  AND t3.CDF_NUMERO_PK = '25'
 //+  AND t1.PRE_EAN_REF   = CODECIP;
                sql_query += " SELECT '1'             AS TYPE_PRE_STATUT ,"
                     " t2.CDF_NOM              AS REF_OFF         ,"
                     " NULL                    AS IDENT           ,"
                     " t1.PRESTP_DATE_AFSSAPS  AS DAT_REF_OFF     ,"
                     " NULL                    AS DAT_REVISION"
                     " FROM prestp_pre_stp   t1,"
                     " cdf_codif        t2,"
                     " pre_presentation t3"
                     " WHERE t1.PRESTP_PRE_CODE_FK_PK   = t3.PRE_CODE_PK"
                     " AND t1.PRESTP_CDF_STP_CODE_FK_PK = t2.CDF_CODE_PK"
                     " AND t2.CDF_NUMERO_PK             = '14'"
                     " AND t3.PRE_EAN_REF            = '"+CODECIP+"'"
                     " UNION"
                     " SELECT '2'                   AS TYPE_PRE_STATUT        ,"
                     " t2.CDF_NOM            AS REF_OFF     ,"
                     " t1.PRESTC_CODE_IDENT  AS IDENT       ,"
                     " NULL                  AS DAT_REF_OFF ,"
                     " NULL                  AS DAT_REVISION"
                     " FROM prestc_statutcomp_present  t1,"
                     " cdf_codif                  t2,"
                     " pre_presentation    t3"
                     " WHERE  t1.PRESTC_PRE_CODE_FK_PK     = t3.PRE_CODE_PK"
                     " AND t1.PRESTC_CDF_STCOMP_CODE_FK_PK = t2.CDF_CODE_PK"
                     " AND t2.CDF_NUMERO_PK                = '14'"
                     " AND t3.PRE_EAN_REF      = '"+CODECIP+"'"
                     " UNION"
                     " SELECT '3'              AS TYPE_PRE_STATUT        ,"
                     " CDF_NOM          AS REF_OFF     ,"
                     " NULL             AS IDENT       ,"
                     " SPAFS_DATE_PK    AS DAT_REF_OFF ,"
                     " SPAFS_DATE_REVIS AS DAT_REVISION"
                     " FROM pre_presentation          t1,"
                     " spafs_specialite_afssaps  t2,"
                     " cdf_codif                 t3"
                     " WHERE  t2.SPAFS_SP_CODE_FK_PK = t1.PRE_SP_CODE_FK"
                     " AND t3.CDF_CODE_PK   = t2.SPAFS_CDF_CODE_DOC_FK_PK"
                     " AND t2.SPAFS_DATE_PK = (SELECT MAX(SPAFS_DATE_PK)"
                     " FROM   spafs_specialite_afssaps"
                     " WHERE  SPAFS_SP_CODE_FK_PK     = t1.PRE_SP_CODE_FK"
                     " AND    SPAFS_RUBCDF_NUMERO_PK  IN ('SP','14','CPH')"
                     " AND    SPAFS_DATE_REVIS IS NULL)"
                     " AND t2.SPAFS_RUBCDF_NUMERO_PK  = 'SP'"
                     " AND t3.CDF_NUMERO_PK           = '25'"
                     " AND t1.PRE_EAN_REF              = '"+CODECIP+"'"
                     " UNION"
                     " SELECT '3'              AS TYPE_PRE_STATUT        ,"
                     " CDF_NOM          AS REF_OFF     ,"
                     " NULL             AS IDENT       ,"
                     " SPAFS_DATE_PK    AS DAT_REF_OFF ,"
                     " SPAFS_DATE_REVIS AS DAT_REVISION"
                     " FROM pre_presentation          t1,"
                     " spafs_specialite_afssaps  t2,"
                     " cdf_codif                 t3"
                     " WHERE  t2.SPAFS_SP_CODE_FK_PK     = t1.PRE_SP_CODE_FK"
                     " AND t3.CDF_CODE_PK   = t2.SPAFS_CDF_CODE_DOC_FK_PK"
                     " AND t2.SPAFS_DATE_PK = (SELECT MAX(SPAFS_DATE_PK)"
                     " FROM   spafs_specialite_afssaps"
                     " WHERE  SPAFS_SP_CODE_FK_PK     = t1.PRE_SP_CODE_FK"
                     " AND    SPAFS_RUBCDF_NUMERO_PK IN ('SP','14','CPH')"
                     " AND    SPAFS_DATE_REVIS IS NULL)"
                     " AND (CDF_NOM,SPAFS_DATE_PK) NOT IN (SELECT CDF_NOM,SPAFS_DATE_PK"
                     " FROM pre_presentation          t1,"
                     " spafs_specialite_afssaps  t2,"
                     " cdf_codif                 t3"
                     " WHERE  t2.SPAFS_SP_CODE_FK_PK = t1.PRE_SP_CODE_FK"
                     " AND t2.SPAFS_RUBCDF_NUMERO_PK  = 'SP'"
                     " AND t2.SPAFS_DATE_PK = (SELECT MAX(SPAFS_DATE_PK)"
                     " FROM   spafs_specialite_afssaps"
                     " WHERE  SPAFS_SP_CODE_FK_PK     = t1.PRE_SP_CODE_FK"
                     " AND    SPAFS_RUBCDF_NUMERO_PK  IN ('SP','14','CPH')"
                     " AND    SPAFS_DATE_REVIS IS NULL)"
                     " AND t3.CDF_CODE_PK   = t2.SPAFS_CDF_CODE_DOC_FK_PK"
                     " AND t3.CDF_NUMERO_PK = '25'"
                     " AND t1.PRE_EAN_REF    = '"+CODECIP+"')"
                     " AND t2.SPAFS_RUBCDF_NUMERO_PK  IN ('14','CPH')"
                     " AND t3.CDF_NUMERO_PK = '25'"
                     " AND t1.PRE_EAN_REF    = '"+CODECIP+"';";

       }
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_PRE_STATUT() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_MY_TYPE_PRE_STATUT = value(0).toString();
                m_REF_OFF            = value(1).toString();
                m_IDENT              = value(2).toString();
                m_DAT_REF_OFF        = value(3).toString();
                m_DAT_REVISION       = value(4).toString();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      QString MY_TYPE_PRE_STATUT() {return m_MY_TYPE_PRE_STATUT;}
      QString REF_OFF()            {return m_REF_OFF;}
      QString IDENT()              {return m_IDENT;}
      QString DAT_REF_OFF()        {return m_DAT_REF_OFF;}
      QString DAT_REVISION()       {return m_DAT_REVISION;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      QString m_MY_TYPE_PRE_STATUT;
      QString m_REF_OFF;
      QString m_IDENT;
      QString m_DAT_REF_OFF;
      QString m_DAT_REVISION;
 };

 //================================== C_GET_THE_PRE_PRI_CUR   -72- ==================================
 /****************************************************************************
 *   Nom           :  GET_THE_PRE_PRI
 -----------------------------------------------------------------------------
 *   Date creation : 03/09/2008
 -----------------------------------------------------------------------------
 *   Description   :  Cette procédure renvoie les informations concernant les
 *                    prix d'une présentation (officine) ou d'un UCD (hôpital).
 *   MAJ           :  15/12/2008
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_PRE_PRI_CUR  C_GET_THE_PRE_PRI ( database(), this );
      while ( C_GET_THE_PRE_PRI.next( CodeId , TYPID  ) )
            { html += tr("<br><b> GET_THE_PRE_PRI : </b>  ") + C_GET_THE_PRE_PRI.MEMBER();
            }
  */
  class C_GET_THE_PRE_PRI_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_PRE_PRI_CUR ---------------------
      C_GET_THE_PRE_PRI_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( QString CodeId , double TYPID )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............
       if ( TYPID == 1) {       // --- CODE CIP 7

 //+   SELECT 'A.0'            AS GRP,
 //+       PRIPRE_PRIX_EURO      AS VALEUR_1,
 //+       'euros TTC'           AS NATURE_1,
 //+       PRIPRE_DATE_APPLI_PK  AS DATE_1,
 //+       NULL                  AS DATA_1,
 //+       PRIPRE_VALIDE   AS VALIDITE
 //+   FROM    PRIPRE_PRIX_PRESENTATION,
 //+     SP_SPECIALITE ,
 //+     PRE_PRESENTATION
 //+   WHERE   PRE_CODE_PK = PRIPRE_PRE_CODE_FK_PK
 //+   AND     SP_CODE_SQ_PK = PRE_SP_CODE_FK
 //+   AND     PRIPRE_DATE_APPLI_PK = (SELECT MAX(PRIPRE_DATE_APPLI_PK)
 //+             FROM   PRIPRE_PRIX_PRESENTATION
 //+             WHERE  PRIPRE_DATE_APPLI_PK <= NOW()
 //+             AND    PRIPRE_PRE_CODE_FK_PK = CODEID)
 //+   AND   PRIPRE_PRE_CODE_FK_PK = CODEID
 //+   UNION
 //+   SELECT 'A.0'                    AS GRP,
 //+     TO_NUMBER(NULL)        AS VALEUR_1,
 //+     'En cours'             AS NATURE_1,
 //+     PRETSS_DATE_APPLIQUEE  AS DATE_1,
 //+     NULL                   AS DATA_1,
 //+     NULL     AS VALIDITE
 //+   FROM   PRETSS_PRESENTATION_TAUX,
 //+     CDF_CODIF
 //+   WHERE  CDF_CODE_PK = PRETSS_CDF_TSS_CODE_FK_PK
 //+   AND NOT EXISTS (SELECT PRIPRE_PRE_CODE_FK_PK
 //+        FROM   PRIPRE_PRIX_PRESENTATION
 //+        WHERE  PRIPRE_PRE_CODE_FK_PK = PRETSS_PRE_CODE_FK_PK
 //+        AND    PRIPRE_DATE_APPLI_PK <= NOW())
 //+   AND PRETSS_DATE_APPLIQUEE = (SELECT MAX(PRETSS_DATE_APPLIQUEE)
 //+            FROM PRETSS_PRESENTATION_TAUX
 //+            WHERE PRETSS_PRE_CODE_FK_PK = CODEID)
 //+   AND EXISTS (SELECT MAX(PRETSS_DATE_APPLIQUEE)
 //+      FROM PRETSS_PRESENTATION_TAUX
 //+      WHERE PRETSS_PRE_CODE_FK_PK = CODEID
 //+      AND PRETSS_DATE_APPLIQUEE <= NOW()
 //+      AND PRETSS_CDF_TSS_CODE_FK_PK = 4)
 //+   AND PRETSS_PRE_CODE_FK_PK = CODEID
 //+   AND CDF_NUMERO_PK  = '17'
 //+   AND CDF_NOM IN ('35%', '35 %','65%', '65 %', '100%', '100 %')
 //+   UNION
 //+   SELECT 'A.0'                   AS GRP,
 //+      TO_NUMBER(NULL)        AS VALEUR_1,
 //+      'En cours'             AS NATURE_1,
 //+      PRETSS_DATE_APPLIQUEE  AS DATE_1,
 //+      NULL                   AS DATA_1,
 //+     NULL     AS VALIDITE
 //+   FROM   PRETSS_PRESENTATION_TAUX,
 //+      CDF_CODIF
 //+   WHERE  CDF_CODE_PK = PRETSS_CDF_TSS_CODE_FK_PK
 //+   AND NOT EXISTS (SELECT PRIPRE_PRE_CODE_FK_PK
 //+         FROM   PRIPRE_PRIX_PRESENTATION
 //+         WHERE  PRIPRE_PRE_CODE_FK_PK = PRETSS_PRE_CODE_FK_PK
 //+         AND    PRIPRE_DATE_APPLI_PK <= NOW())
 //+   AND PRETSS_DATE_APPLIQUEE = (SELECT MAX(PRETSS_DATE_APPLIQUEE)
 //+              FROM PRETSS_PRESENTATION_TAUX
 //+              WHERE PRETSS_PRE_CODE_FK_PK = CODEID)
 //+   AND NOT EXISTS (SELECT MAX(PRETSS_DATE_APPLIQUEE)
 //+         FROM PRETSS_PRESENTATION_TAUX
 //+         WHERE PRETSS_PRE_CODE_FK_PK = CODEID
 //+         AND PRETSS_DATE_APPLIQUEE <= NOW()
 //+         AND PRETSS_CDF_TSS_CODE_FK_PK = 4)
 //+   AND PRETSS_PRE_CODE_FK_PK = CODEID
 //+   AND CDF_NUMERO_PK = '17'
 //+   AND CDF_NOM IN('35%', '35 %','65%', '65 %', '100%', '100 %')
 //+   UNION
 //+   SELECT 'A.0'                  AS GRP,
 //+     TO_NUMBER(NULL)       AS VALEUR_1,
 //+     'Prix libre'          AS NATURE_1,
 //+     PRETSS_DATE_APPLIQUEE AS DATE_1,
 //+     CDF_NOM               AS DATA_1,
 //+     NULL      AS VALIDITE
 //+   FROM   PRETSS_PRESENTATION_TAUX, CDF_CODIF
 //+   WHERE  CDF_CODE_PK = PRETSS_CDF_TSS_CODE_FK_PK
 //+   AND NOT EXISTS (SELECT PRIPRE_PRE_CODE_FK_PK
 //+         FROM   PRIPRE_PRIX_PRESENTATION
 //+         WHERE  PRIPRE_PRE_CODE_FK_PK = PRETSS_PRE_CODE_FK_PK
 //+         AND    PRIPRE_DATE_APPLI_PK <= NOW())
 //+   AND PRETSS_PRE_CODE_FK_PK = CODEID
 //+   AND CDF_NUMERO_PK = '17'
 //+   AND CDF_NOM IN ('0 %', '0%')
 //+   AND PRETSS_NUMSEQ = 1
 //+   UNION
 //+   SELECT 'A.0'            AS GRP,
 //+     TO_NUMBER(NULL) AS VALEUR_1,
 //+     'Non concerné'  AS NATURE_1,
 //+     TO_DATE(NULL)   AS DATE_1,
 //+     NULL            AS DATA_1,
 //+     NULL   AS VALIDITE
 //+   FROM  PRE_PRESENTATION
 //+   WHERE PRE_CODE_PK = CODEID
 //+   AND NOT EXISTS   (SELECT PRETSS_PRE_CODE_FK_PK
 //+         FROM PRETSS_PRESENTATION_TAUX
 //+         WHERE PRETSS_PRE_CODE_FK_PK = CODEID)
 //+   AND NOT EXISTS (SELECT PRIPRE_PRE_CODE_FK_PK
 //+         FROM PRIPRE_PRIX_PRESENTATION
 //+         WHERE PRIPRE_PRE_CODE_FK_PK = PRE_CODE_PK
 //+         AND PRIPRE_DATE_APPLI_PK <= NOW())
 //+   UNION
 //+   SELECT 'A.1'             AS GRP,
 //+      FORPRE_FORFAIT  AS VALEUR_1,
 //+      'euros TTC'     AS NATURE_1,
 //+      FORPRE_DATE_PK  AS DATE_1,
 //+      NULL     AS DATA_1,
 //+      FORPRE_VALIDE   AS VALIDITE
 //+   FROM   FORPRE_FORFAIT_PRE,
 //+       PRE_PRESENTATION,
 //+       SP_SPECIALITE
 //+   WHERE PRE_CODE_PK = FORPRE_PRE_CODE_FK_PK
 //+   AND   SP_CODE_SQ_PK = PRE_SP_CODE_FK
 //+   --AND   FORPRE_DATE_PK <= NOW()
 //+   AND   FORPRE_DATE_PK = (SELECT MAX(FORPRE_DATE_PK)
 //+               FROM   FORPRE_FORFAIT_PRE
 //+               WHERE  FORPRE_DATE_PK <= NOW()
 //+               AND    FORPRE_PRE_CODE_FK_PK = CODEID)
 //+   AND   FORPRE_PRE_CODE_FK_PK = CODEID
 //+   UNION
 //+   SELECT 'A.1'             AS GRP,
 //+      TO_NUMBER(NULL) AS VALEUR_1,
 //+      'Non concerné'  AS NATURE_1,
 //+      TO_DATE(NULL)   AS DATE_1,
 //+      NULL     AS DATA_1,
 //+      NULL      AS VALIDITE
 //+   FROM  PRE_PRESENTATION, SP_SPECIALITE
 //+   WHERE SP_CODE_SQ_PK = PRE_SP_CODE_FK
 //+   AND NOT EXISTS (SELECT FORPRE_PRE_CODE_FK_PK
 //+         FROM FORPRE_FORFAIT_PRE
 //+         WHERE FORPRE_PRE_CODE_FK_PK = PRE_CODE_PK
 //+         AND  FORPRE_DATE_PK <= NOW())
 //+   AND PRE_CODE_PK = CODEID;    '"+CodeId+"'
 sql_query +=


         " SELECT 'A_0'          AS GRP, \n"
         " PRIPRE_PRIX_EURO      AS VALEUR_1,\n"
         " 'EUROS TTC'           AS NATURE_1,\n"
         " PRIPRE_DATE_APPLI_PK  AS DATE_1,\n"
         " NULL                  AS DATA_1,\n"
         " PRIPRE_VALIDE         AS VALIDITE\n"
         " FROM    pripre_prix_presentation,\n"
         "         sp_specialite ,          \n"
         "         pre_presentation         \n"
         " WHERE   PRE_CODE_PK   = PRIPRE_PRE_CODE_FK_PK\n"
         " AND     SP_CODE_SQ_PK = PRE_SP_CODE_FK\n"
         " AND     PRIPRE_DATE_APPLI_PK = (SELECT MAX(PRIPRE_DATE_APPLI_PK)\n"
         "                                 FROM   pripre_prix_presentation\n"
         "                                 WHERE  PRIPRE_DATE_APPLI_PK  <= NOW()\n"
         "                                 AND    PRIPRE_PRE_CODE_FK_PK  = '"+CodeId+"')\n"
         " AND     PRIPRE_PRE_CODE_FK_PK  = '"+CodeId+"'\n"
         " UNION\n"
         " SELECT 'A_0'           AS GRP,\n"
         " NULL                   AS VALEUR_1,\n"
         " 'EN cours'             AS NATURE_1,\n"
         " PRETSS_DATE_APPLIQUEE  AS DATE_1,\n"
         " NULL                   AS DATA_1,\n"
         " NULL                   AS VALIDITE\n"
         " FROM   pretss_presentation_taux,\n"
         "        cdf_codif\n"
         " WHERE  CDF_CODE_PK = PRETSS_CDF_TSS_CODE_FK_PK\n"
         " AND NOT EXISTS (SELECT PRIPRE_PRE_CODE_FK_PK\n"
         "                 FROM   pripre_prix_presentation\n"
         "                 WHERE  PRIPRE_PRE_CODE_FK_PK = PRETSS_PRE_CODE_FK_PK\n"
         "                 AND    PRIPRE_DATE_APPLI_PK <= NOW())\n"
         " AND PRETSS_DATE_APPLIQUEE = (SELECT MAX(PRETSS_DATE_APPLIQUEE)\n"
         "                              FROM pretss_presentation_taux\n"
         "                              WHERE PRETSS_PRE_CODE_FK_PK  = '"+CodeId+"')\n"
         " AND EXISTS (SELECT MAX(PRETSS_DATE_APPLIQUEE)\n"
         "             FROM pretss_presentation_taux\n"
         "             WHERE PRETSS_PRE_CODE_FK_PK  = '"+CodeId+"'\n"
         "             AND PRETSS_DATE_APPLIQUEE <= NOW()\n"
         "             AND PRETSS_CDF_TSS_CODE_FK_PK = 4)\n"
         " AND PRETSS_PRE_CODE_FK_PK  = '"+CodeId+"'\n"
         " AND CDF_NUMERO_PK  = '17'\n"
         " AND CDF_NOM IN ('35%', '35 %','65%', '65 %', '100%', '100 %')\n"
         " UNION\n"
         " SELECT 'A_0'           AS GRP,\n"
         " NULL                   AS VALEUR_1,\n"
         " 'EN cours'             AS NATURE_1,\n"
         " PRETSS_DATE_APPLIQUEE  AS DATE_1,\n"
         " NULL                   AS DATA_1,\n"
         " NULL                   AS VALIDITE\n"
         " FROM   pretss_presentation_taux,\n"
         " cdf_codif\n"
         " WHERE  CDF_CODE_PK = PRETSS_CDF_TSS_CODE_FK_PK\n"
         " AND NOT EXISTS (SELECT PRIPRE_PRE_CODE_FK_PK\n"
         "                 FROM   pripre_prix_presentation\n"
         "                 WHERE  PRIPRE_PRE_CODE_FK_PK = PRETSS_PRE_CODE_FK_PK\n"
         "                 AND    PRIPRE_DATE_APPLI_PK <= NOW())\n"
         " AND PRETSS_DATE_APPLIQUEE = (SELECT MAX(PRETSS_DATE_APPLIQUEE)\n"
         "                              FROM pretss_presentation_taux\n"
         "                              WHERE PRETSS_PRE_CODE_FK_PK  = '"+CodeId+"')\n"
         " AND NOT EXISTS (SELECT MAX(PRETSS_DATE_APPLIQUEE)\n"
         "                 FROM pretss_presentation_taux\n"
         "                 WHERE PRETSS_PRE_CODE_FK_PK  = '"+CodeId+"'\n"
         "                 AND PRETSS_DATE_APPLIQUEE <= NOW()\n"
         "                 AND PRETSS_CDF_TSS_CODE_FK_PK = 4)\n"
         " AND PRETSS_PRE_CODE_FK_PK  = '"+CodeId+"'\n"
         " AND CDF_NUMERO_PK = '17'\n"
         " AND CDF_NOM IN('35%', '35 %','65%', '65 %', '100%', '100 %')\n"
         " UNION\n"
         " SELECT 'A_0'            AS GRP,\n"
         " NULL                    AS VALEUR_1,\n"
         " 'NON concerné'          AS NATURE_1,\n"
         " NULL                    AS DATE_1,\n"
         " NULL                    AS DATA_1,\n"
         " NULL                    AS VALIDITE\n"
         " FROM  pre_presentation\n"
         " WHERE PRE_CODE_PK  = '"+CodeId+"'\n"
         " AND NOT EXISTS   (SELECT PRETSS_PRE_CODE_FK_PK\n"
         "                   FROM pretss_presentation_taux\n"
         "                   WHERE PRETSS_PRE_CODE_FK_PK  = '"+CodeId+"')\n"
         " AND NOT EXISTS (SELECT PRIPRE_PRE_CODE_FK_PK\n"
         "                 FROM pripre_prix_presentation\n"
         "                 WHERE PRIPRE_PRE_CODE_FK_PK = PRE_CODE_PK\n"
         "                 AND PRIPRE_DATE_APPLI_PK <= NOW())\n"
         " UNION\n"
         " SELECT 'A_1'     AS GRP,\n"
         " FORPRE_FORFAIT  AS VALEUR_1,\n"
         " 'EUROS TTC'     AS NATURE_1,\n"
         " FORPRE_DATE_PK  AS DATE_1,\n"
         " NULL            AS DATA_1,\n"
         " FORPRE_VALIDE   AS VALIDITE\n"
         " FROM   forpre_forfait_pre,\n"
         " pre_presentation,\n"
         " sp_specialite\n"
         " WHERE PRE_CODE_PK    = FORPRE_PRE_CODE_FK_PK\n"
         " AND   SP_CODE_SQ_PK  = PRE_SP_CODE_FK\n"
         " AND   FORPRE_DATE_PK = (SELECT MAX(FORPRE_DATE_PK)\n"
         "                         FROM   forpre_forfait_pre\n"
         "                         WHERE  FORPRE_DATE_PK <= NOW()\n"
         "                         AND    FORPRE_PRE_CODE_FK_PK  = '"+CodeId+"')\n"
         " AND   FORPRE_PRE_CODE_FK_PK  = '"+CodeId+"'\n";


                /*::::::::::::::::::::::::::::: boucle infinie !!::::::::::::::::::::::
                sql_query +=
                     " SELECT 'A.0'            AS GRP,"
                     " PRIPRE_PRIX_EURO      AS VALEUR_1,"
                     " 'EUROS TTC'           AS NATURE_1,"
                     " PRIPRE_DATE_APPLI_PK  AS DATE_1,"
                     " NULL                  AS DATA_1,"
                     " PRIPRE_VALIDE   AS VALIDITE"
                     " FROM    pripre_prix_presentation,"
                     " sp_specialite ,"
                     " pre_presentation"
                     " WHERE   PRE_CODE_PK = PRIPRE_PRE_CODE_FK_PK"
                     " AND     SP_CODE_SQ_PK = PRE_SP_CODE_FK"
                     " AND     PRIPRE_DATE_APPLI_PK = (SELECT MAX(PRIPRE_DATE_APPLI_PK)"
                     " FROM   pripre_prix_presentation"
                     " WHERE  PRIPRE_DATE_APPLI_PK <= NOW()"
                     " AND    PRIPRE_PRE_CODE_FK_PK  = '"+CodeId+"')"
                     " AND   PRIPRE_PRE_CODE_FK_PK  = '"+CodeId+"'"
                     " UNION"
                     " SELECT 'A.0'                    AS GRP,"
                     " TO_NUMBER(NULL)        AS VALEUR_1,"
                     " 'EN cours'             AS NATURE_1,"
                     " PRETSS_DATE_APPLIQUEE  AS DATE_1,"
                     " NULL                   AS DATA_1,"
                     " NULL     AS VALIDITE"
                     " FROM   pretss_presentation_taux,"
                     " cdf_codif"
                     " WHERE  CDF_CODE_PK = PRETSS_CDF_TSS_CODE_FK_PK"
                     " AND NOT EXISTS (SELECT PRIPRE_PRE_CODE_FK_PK"
                     " FROM   pripre_prix_presentation"
                     " WHERE  PRIPRE_PRE_CODE_FK_PK = PRETSS_PRE_CODE_FK_PK"
                     " AND    PRIPRE_DATE_APPLI_PK <= NOW())"
                     " AND PRETSS_DATE_APPLIQUEE = (SELECT MAX(PRETSS_DATE_APPLIQUEE)"
                     " FROM pretss_presentation_taux"
                     " WHERE PRETSS_PRE_CODE_FK_PK  = '"+CodeId+"')"
                     " AND EXISTS (SELECT MAX(PRETSS_DATE_APPLIQUEE)"
                     " FROM pretss_presentation_taux"
                     " WHERE PRETSS_PRE_CODE_FK_PK  = '"+CodeId+"'"
                     " AND PRETSS_DATE_APPLIQUEE <= NOW()"
                     " AND PRETSS_CDF_TSS_CODE_FK_PK = 4)"
                     " AND PRETSS_PRE_CODE_FK_PK  = '"+CodeId+"'"
                     " AND CDF_NUMERO_PK  = '17'"
                     " AND CDF_NOM IN ('35%', '35 %','65%', '65 %', '100%', '100 %')"
                     " UNION"
                     " SELECT 'A.0'                   AS GRP,"
                     " TO_NUMBER(NULL)        AS VALEUR_1,"
                     " 'EN cours'             AS NATURE_1,"
                     " PRETSS_DATE_APPLIQUEE  AS DATE_1,"
                     " NULL                   AS DATA_1,"
                     " NULL     AS VALIDITE"
                     " FROM   pretss_presentation_taux,"
                     " cdf_codif"
                     " WHERE  CDF_CODE_PK = PRETSS_CDF_TSS_CODE_FK_PK"
                     " AND NOT EXISTS (SELECT PRIPRE_PRE_CODE_FK_PK"
                     " FROM   pripre_prix_presentation"
                     " WHERE  PRIPRE_PRE_CODE_FK_PK = PRETSS_PRE_CODE_FK_PK"
                     " AND    PRIPRE_DATE_APPLI_PK <= NOW())"
                     " AND PRETSS_DATE_APPLIQUEE = (SELECT MAX(PRETSS_DATE_APPLIQUEE)"
                     " FROM pretss_presentation_taux"
                     " WHERE PRETSS_PRE_CODE_FK_PK  = '"+CodeId+"')"
                     " AND NOT EXISTS (SELECT MAX(PRETSS_DATE_APPLIQUEE)"
                     " FROM pretss_presentation_taux"
                     " WHERE PRETSS_PRE_CODE_FK_PK  = '"+CodeId+"'"
                     " AND PRETSS_DATE_APPLIQUEE <= NOW()"
                     " AND PRETSS_CDF_TSS_CODE_FK_PK = 4)"
                     " AND PRETSS_PRE_CODE_FK_PK  = '"+CodeId+"'"
                     " AND CDF_NUMERO_PK = '17'"
                     " AND CDF_NOM IN('35%', '35 %','65%', '65 %', '100%', '100 %')"
                     " UNION"
                     " SELECT 'A.0'                  AS GRP,"
                     " TO_NUMBER(NULL)       AS VALEUR_1,"
                     " 'PRIX libre'          AS NATURE_1,"
                     " PRETSS_DATE_APPLIQUEE AS DATE_1,"
                     " CDF_NOM               AS DATA_1,"
                     " NULL      AS VALIDITE"
                     " FROM   pretss_presentation_taux, cdf_codif"
                     " WHERE  CDF_CODE_PK = PRETSS_CDF_TSS_CODE_FK_PK"
                     " AND NOT EXISTS (SELECT PRIPRE_PRE_CODE_FK_PK"
                     " FROM   pripre_prix_presentation"
                     " WHERE  PRIPRE_PRE_CODE_FK_PK = PRETSS_PRE_CODE_FK_PK"
                     " AND    PRIPRE_DATE_APPLI_PK <= NOW())"
                     " AND PRETSS_PRE_CODE_FK_PK  = '"+CodeId+"'"
                     " AND CDF_NUMERO_PK = '17'"
                     " AND CDF_NOM IN ('0 %', '0%')"
                     " AND PRETSS_NUMSEQ = 1"
                     " UNION"
                     " SELECT 'A.0'            AS GRP,"
                     " TO_NUMBER(NULL) AS VALEUR_1,"
                     " 'NON concerné'  AS NATURE_1,"
                     " TO_DATE(NULL)   AS DATE_1,"
                     " NULL            AS DATA_1,"
                     " NULL   AS VALIDITE"
                     " FROM  pre_presentation"
                     " WHERE PRE_CODE_PK  = '"+CodeId+"'"
                     " AND NOT EXISTS   (SELECT PRETSS_PRE_CODE_FK_PK"
                     " FROM pretss_presentation_taux"
                     " WHERE PRETSS_PRE_CODE_FK_PK  = '"+CodeId+"')"
                     " AND NOT EXISTS (SELECT PRIPRE_PRE_CODE_FK_PK"
                     " FROM pripre_prix_presentation"
                     " WHERE PRIPRE_PRE_CODE_FK_PK = PRE_CODE_PK"
                     " AND PRIPRE_DATE_APPLI_PK <= NOW())"
                     " UNION"
                     " SELECT 'A.1'             AS GRP,"
                     " FORPRE_FORFAIT  AS VALEUR_1,"
                     " 'EUROS TTC'     AS NATURE_1,"
                     " FORPRE_DATE_PK  AS DATE_1,"
                     " NULL     AS DATA_1,"
                     " FORPRE_VALIDE   AS VALIDITE"
                     " FROM   forpre_forfait_pre,"
                     " pre_presentation,"
                     " sp_specialite"
                     " WHERE PRE_CODE_PK = FORPRE_PRE_CODE_FK_PK"
                     " AND   SP_CODE_SQ_PK = PRE_SP_CODE_FK"
                     " "  //--AND   FORPRE_DATE_PK <= NOW()"
                     " AND   FORPRE_DATE_PK = (SELECT MAX(FORPRE_DATE_PK)"
                     " FROM   forpre_forfait_pre"
                     " WHERE  FORPRE_DATE_PK <= NOW()"
                     " AND    FORPRE_PRE_CODE_FK_PK  = '"+CodeId+"')"
                     " AND   FORPRE_PRE_CODE_FK_PK  = '"+CodeId+"'"
                     " UNION"
                     " SELECT 'A.1'             AS GRP,"
                     " TO_NUMBER(NULL) AS VALEUR_1,"
                     " 'NON concerné'  AS NATURE_1,"
                     " TO_DATE(NULL)   AS DATE_1,"
                     " NULL     AS DATA_1,"
                     " NULL      AS VALIDITE"
                     " FROM  pre_presentation, sp_specialite"
                     " WHERE SP_CODE_SQ_PK = PRE_SP_CODE_FK"
                     " AND NOT EXISTS (SELECT FORPRE_PRE_CODE_FK_PK"
                     " FROM forpre_forfait_pre"
                     " WHERE FORPRE_PRE_CODE_FK_PK = PRE_CODE_PK"
                     " AND  FORPRE_DATE_PK <= NOW())"
                     " AND PRE_CODE_PK  = '"+CodeId+"';";
                     */
       }/*
       else if ( TYPID == 2) {   // --Code UCD

 //+   SELECT 'B.0'  AS GRP,
 //+      TO_NUMBER(NULL) AS VALEUR_1,
 //+      'Non concerné'  AS NATURE_1,
 //+      TO_DATE(NULL)   AS DATE_1,
 //+      NULL            AS DATA_1,
 //+      NULL    AS VALIDITE
 //+   FROM   SP_SPECIALITE,
 //+      PRE_PRESENTATION
 //+   WHERE PRE_SP_CODE_FK = SP_CODE_SQ_PK
 //+   AND NOT EXISTS (SELECT PRIUCD_UCD_CODE_PK
 //+         FROM PRIUCD_PRIX_UCD
 //+         WHERE PRIUCD_DATE_APPLI_PK <= NOW()
 //+         AND   PRIUCD_UCD_CODE_PK = SP_CIPUCD
 //+         AND   PRIUCD_CODE_LISTE_PK = 1)
 //+   AND NOT EXISTS (SELECT PRETSSH_PRE_CODE_FK_PK
 //+         FROM PRETSSH_PRE_TAUX_HOP
 //+         WHERE PRETSSH_PRE_CODE_FK_PK = PRE_CODE_PK
 //+         AND PRETSSH_DATE_APPLIQUEE <= NOW()
 //+         AND PRETSSH_CDF_TSS_CODE_FK_PK = 4)
 //+   AND  SP_CIPUCD = CODEID
 //+   GROUP BY 1
 //+   UNION
 //+   SELECT 'B.0'     AS GRP,
 //+      PRIUCD_PFHT AS VALEUR_1,
 //+      'euros HT'  AS NATURE_1,
 //+      PRIUCD_DATE_APPLI_PK AS DATE_1,
 //+      NULL        AS DATA_1,
 //+      PRIUCD_VALIDE    AS VALIDITE
 //+   FROM  PRIUCD_PRIX_UCD, SP_SPECIALITE
 //+   WHERE SP_CIPUCD = PRIUCD_UCD_CODE_PK
 //+   AND   PRIUCD_DATE_APPLI_PK = (SELECT MAX(PRIUCD_DATE_APPLI_PK)
 //+           FROM   PRIUCD_PRIX_UCD
 //+           WHERE  PRIUCD_DATE_APPLI_PK <= NOW()
 //+           AND    PRIUCD_UCD_CODE_PK = CODEID
 //+           AND   PRIUCD_CODE_LISTE_PK = 1)
 //+   AND   PRIUCD_UCD_CODE_PK = CODEID
 //+   AND   PRIUCD_CODE_LISTE_PK = 1
 //+   UNION
 //+   SELECT 'B.0'                     AS GRP,
 //+      TO_NUMBER(NULL)         AS VALEUR_1,
 //+      'En cours'              AS NATURE_1,
 //+      PRETSSH_DATE_APPLIQUEE  AS DATE_1,
 //+      NULL                    AS DATA_1,
 //+      NULL        AS VALIDITE
 //+   FROM  SP_SPECIALITE,
 //+     PRE_PRESENTATION,
 //+     PRETSSH_PRE_TAUX_HOP,
 //+     CDF_CODIF
 //+   WHERE PRE_SP_CODE_FK = SP_CODE_SQ_PK
 //+   AND   PRETSSH_PRE_CODE_FK_PK = PRE_CODE_PK
 //+   AND   CDF_CODE_PK = PRETSSH_CDF_TSS_CODE_FK_PK
 //+   AND   PRETSSH_DATE_APPLIQUEE = (SELECT MAX(PRETSSH_DATE_APPLIQUEE)
 //+           FROM   PRETSSH_PRE_TAUX_HOP
 //+           WHERE  PRETSSH_PRE_CODE_FK_PK = PRE_CODE_PK
 //+           AND    PRETSSH_DATE_APPLIQUEE <= NOW())
 //+   AND EXISTS ( SELECT MAX(PRETSSH_DATE_APPLIQUEE)
 //+        FROM PRETSSH_PRE_TAUX_HOP
 //+        WHERE PRETSSH_PRE_CODE_FK_PK = PRE_CODE_PK
 //+        AND PRETSSH_DATE_APPLIQUEE <= NOW()
 //+        AND PRETSSH_CDF_TSS_CODE_FK_PK = 4)
 //+   AND NOT EXISTS (SELECT PRIUCD_UCD_CODE_PK
 //+         FROM PRIUCD_PRIX_UCD
 //+         WHERE PRIUCD_UCD_CODE_PK = PRE_CODE_PK)
 //+   AND NOT EXISTS (SELECT PRIUCD_UCD_CODE_PK
 //+         FROM PRIUCD_PRIX_UCD
 //+         WHERE PRIUCD_DATE_APPLI_PK <= NOW()
 //+         AND   PRIUCD_UCD_CODE_PK = SP_CIPUCD
 //+         AND   PRIUCD_CODE_LISTE_PK = 1)
 //+   AND SP_CIPUCD = CODEID
 //+   AND CDF_NUMERO_PK = '17'
 //+   AND CDF_NOM IN('35%', '35 %','65%', '65 %', '100%', '100 %')
 //+   UNION
 //+   SELECT 'B.0'                     AS GRP,
 //+      TO_NUMBER(NULL)         AS VALEUR_1,
 //+      'Prix libre'            AS NATURE_1,
 //+      PRETSSH_DATE_APPLIQUEE  AS DATE_1,
 //+      NULL                    AS DATA_1,
 //+      NULL        AS VALIDITE
 //+   FROM  SP_SPECIALITE,
 //+      PRE_PRESENTATION,
 //+      PRETSSH_PRE_TAUX_HOP,
 //+      CDF_CODIF
 //+   WHERE PRE_SP_CODE_FK = SP_CODE_SQ_PK
 //+   AND   PRETSSH_PRE_CODE_FK_PK = PRE_CODE_PK
 //+   AND   CDF_CODE_PK = PRETSSH_CDF_TSS_CODE_FK_PK
 //+   AND NOT EXISTS (SELECT PRIUCD_UCD_CODE_PK
 //+         FROM PRIUCD_PRIX_UCD
 //+         WHERE PRIUCD_UCD_CODE_PK = PRE_CODE_PK)
 //+   AND PRETSSH_DATE_APPLIQUEE = (SELECT MAX(PRETSSH_DATE_APPLIQUEE)
 //+             FROM PRETSSH_PRE_TAUX_HOP
 //+             WHERE PRETSSH_PRE_CODE_FK_PK = PRE_CODE_PK
 //+             AND PRETSSH_DATE_APPLIQUEE <= NOW())
 //+   AND SP_CIPUCD = CODEID
 //+   AND CDF_NUMERO_PK = '17'
 //+   AND CDF_NOM = '0 %'
 //+   AND NOT EXISTS (SELECT MAX(PRETSSH_DATE_APPLIQUEE)
 //+         FROM PRETSSH_PRE_TAUX_HOP
 //+         WHERE PRETSSH_PRE_CODE_FK_PK = PRE_CODE_PK
 //+         AND PRETSSH_DATE_APPLIQUEE <= NOW()
 //+         AND PRETSSH_CDF_TSS_CODE_FK_PK IN (1, 2, 3))
 //+   UNION
 //+   SELECT 'B.1'    AS GRP,
 //+      PRIUCD_PFHT AS VALEUR_1,
 //+      'euros HT'  AS NATURE_1,
 //+      PRIUCD_DATE_APPLI_PK  AS DATE_1,
 //+      NULL          AS DATA_1,
 //+      PRIUCD_VALIDE     AS VALIDITE
 //+   FROM  PRIUCD_PRIX_UCD
 //+   WHERE PRIUCD_UCD_CODE_PK = CODEID
 //+   AND   PRIUCD_DATE_APPLI_PK = (SELECT MAX(PRIUCD_DATE_APPLI_PK)
 //+            FROM PRIUCD_PRIX_UCD
 //+            WHERE PRIUCD_DATE_APPLI_PK <= NOW()
 //+            AND PRIUCD_UCD_CODE_PK = CODEID
 //+            AND PRIUCD_CODE_LISTE_PK = 2)
 //+   AND   PRIUCD_CODE_LISTE_PK = 2
 //+   UNION
 //+   SELECT 'B.1'       AS GRP,
 //+      TO_NUMBER(NULL) AS VALEUR_1,
 //+      'Prix libre'    AS NATURE_1,
 //+      TO_DATE(NULL)   AS DATE_1,
 //+      NULL            AS DATA_1,
 //+      U.PRIUCD_VALIDE AS VALIDITE
 //+   FROM    SP_SPECIALITE S,
 //+     PRE_PRESENTATION P,
 //+     PRIUCD_PRIX_UCD U
 //+   WHERE P.PRE_SP_CODE_FK = S.SP_CODE_SQ_PK
 //+   AND U.PRIUCD_UCD_CODE_PK = S.SP_CIPUCD
 //+   AND S.SP_CIPUCD = CODEID
 //+   AND P.PRE_AGRCOLL = 'O'
 //+   AND PRIUCD_DATE_APPLI_PK = (SELECT MAX(PRIUCD_DATE_APPLI_PK)
 //+          FROM PRIUCD_PRIX_UCD
 //+          WHERE PRIUCD_UCD_CODE_PK = S.SP_CIPUCD
 //+          AND PRIUCD_DATE_APPLI_PK <= NOW()
 //+          AND S.SP_CIPUCD = CODEID)
 //+   AND NOT EXISTS (SELECT U1.PRIUCD_UCD_CODE_PK
 //+        FROM PRIUCD_PRIX_UCD U1
 //+        WHERE U1.PRIUCD_UCD_CODE_PK = S.SP_CIPUCD
 //+        AND U1.PRIUCD_CODE_LISTE_PK = 2)
 //+   UNION
 //+   SELECT 'B.1'       AS GRP,
 //+      TO_NUMBER(NULL) AS VALEUR_1,
 //+      'Non concerné'  AS NATURE_1,
 //+      TO_DATE(NULL)   AS DATE_1,
 //+      NULL            AS DATA_1,
 //+      PRIUCD_VALIDE  AS VALIDITE
 //+   FROM   SP_SPECIALITE S,
 //+       PRE_PRESENTATION P,
 //+       PRIUCD_PRIX_UCD U
 //+   WHERE  P.PRE_SP_CODE_FK = S.SP_CODE_SQ_PK
 //+   AND  S.SP_CIPUCD = U.PRIUCD_UCD_CODE_PK(+)
 //+   AND S.SP_CIPUCD = CODEID
 //+   AND P.PRE_AGRCOLL != 'O'
 //+   AND PRIUCD_DATE_APPLI_PK = (SELECT MAX(PRIUCD_DATE_APPLI_PK)
 //+          FROM PRIUCD_PRIX_UCD
 //+          WHERE PRIUCD_UCD_CODE_PK = S.SP_CIPUCD
 //+          AND PRIUCD_DATE_APPLI_PK <= NOW()
 //+          AND S.SP_CIPUCD = CODEID)
 //+   AND NOT EXISTS (SELECT U1.PRIUCD_UCD_CODE_PK
 //+         FROM PRIUCD_PRIX_UCD U1
 //+         WHERE U1.PRIUCD_UCD_CODE_PK = S.SP_CIPUCD
 //+         AND U1.PRIUCD_CODE_LISTE_PK = 2)
 //+   GROUP BY 'B.1',PRIUCD_VALIDE;
                sql_query += " SELECT 'B.0'  AS GRP,"
                     " TO_NUMBER(NULL) AS VALEUR_1,"
                     " 'NON concerné'  AS NATURE_1,"
                     " TO_DATE(NULL)   AS DATE_1,"
                     " NULL            AS DATA_1,"
                     " NULL    AS VALIDITE"
                     " FROM   sp_specialite,"
                     " pre_presentation"
                     " WHERE PRE_SP_CODE_FK = SP_CODE_SQ_PK"
                     " AND NOT EXISTS (SELECT PRIUCD_UCD_CODE_PK"
                     " FROM priucd_prix_ucd"
                     " WHERE PRIUCD_DATE_APPLI_PK <= NOW()"
                     " AND   PRIUCD_UCD_CODE_PK = SP_CIPUCD"
                     " AND   PRIUCD_CODE_LISTE_PK = 1)"
                     " AND NOT EXISTS (SELECT PRETSSH_PRE_CODE_FK_PK"
                     " FROM pretssh_pre_taux_hop"
                     " WHERE PRETSSH_PRE_CODE_FK_PK = PRE_CODE_PK"
                     " AND PRETSSH_DATE_APPLIQUEE <= NOW()"
                     " AND PRETSSH_CDF_TSS_CODE_FK_PK = 4)"
                     " AND  SP_CIPUCD  = '"+CodeId+"'"
                     " GROUP BY 1"
                     " UNION"
                     " SELECT 'B.0'     AS GRP,"
                     " PRIUCD_PFHT AS VALEUR_1,"
                     " 'EUROS HT'  AS NATURE_1,"
                     " PRIUCD_DATE_APPLI_PK AS DATE_1,"
                     " NULL        AS DATA_1,"
                     " PRIUCD_VALIDE    AS VALIDITE"
                     " FROM  priucd_prix_ucd, sp_specialite"
                     " WHERE SP_CIPUCD = PRIUCD_UCD_CODE_PK"
                     " AND   PRIUCD_DATE_APPLI_PK = (SELECT MAX(PRIUCD_DATE_APPLI_PK)"
                     " FROM   priucd_prix_ucd"
                     " WHERE  PRIUCD_DATE_APPLI_PK <= NOW()"
                     " AND    PRIUCD_UCD_CODE_PK  = '"+CodeId+"'"
                     " AND   PRIUCD_CODE_LISTE_PK = 1)"
                     " AND   PRIUCD_UCD_CODE_PK  = '"+CodeId+"'"
                     " AND   PRIUCD_CODE_LISTE_PK = 1"
                     " UNION"
                     " SELECT 'B.0'                     AS GRP,"
                     " TO_NUMBER(NULL)         AS VALEUR_1,"
                     " 'EN cours'              AS NATURE_1,"
                     " PRETSSH_DATE_APPLIQUEE  AS DATE_1,"
                     " NULL                    AS DATA_1,"
                     " NULL        AS VALIDITE"
                     " FROM  sp_specialite,"
                     " pre_presentation,"
                     " pretssh_pre_taux_hop,"
                     " cdf_codif"
                     " WHERE PRE_SP_CODE_FK = SP_CODE_SQ_PK"
                     " AND   PRETSSH_PRE_CODE_FK_PK = PRE_CODE_PK"
                     " AND   CDF_CODE_PK = PRETSSH_CDF_TSS_CODE_FK_PK"
                     " AND   PRETSSH_DATE_APPLIQUEE = (SELECT MAX(PRETSSH_DATE_APPLIQUEE)"
                     " FROM   pretssh_pre_taux_hop"
                     " WHERE  PRETSSH_PRE_CODE_FK_PK = PRE_CODE_PK"
                     " AND    PRETSSH_DATE_APPLIQUEE <= NOW())"
                     " AND EXISTS ( SELECT MAX(PRETSSH_DATE_APPLIQUEE)"
                     " FROM pretssh_pre_taux_hop"
                     " WHERE PRETSSH_PRE_CODE_FK_PK = PRE_CODE_PK"
                     " AND PRETSSH_DATE_APPLIQUEE <= NOW()"
                     " AND PRETSSH_CDF_TSS_CODE_FK_PK = 4)"
                     " AND NOT EXISTS (SELECT PRIUCD_UCD_CODE_PK"
                     " FROM priucd_prix_ucd"
                     " WHERE PRIUCD_UCD_CODE_PK = PRE_CODE_PK)"
                     " AND NOT EXISTS (SELECT PRIUCD_UCD_CODE_PK"
                     " FROM priucd_prix_ucd"
                     " WHERE PRIUCD_DATE_APPLI_PK <= NOW()"
                     " AND   PRIUCD_UCD_CODE_PK = SP_CIPUCD"
                     " AND   PRIUCD_CODE_LISTE_PK = 1)"
                     " AND SP_CIPUCD  = '"+CodeId+"'"
                     " AND CDF_NUMERO_PK = '17'"
                     " AND CDF_NOM IN('35%', '35 %','65%', '65 %', '100%', '100 %')"
                     " UNION"
                     " SELECT 'B.0'                     AS GRP,"
                     " TO_NUMBER(NULL)         AS VALEUR_1,"
                     " 'PRIX libre'            AS NATURE_1,"
                     " PRETSSH_DATE_APPLIQUEE  AS DATE_1,"
                     " NULL                    AS DATA_1,"
                     " NULL        AS VALIDITE"
                     " FROM  sp_specialite,"
                     " pre_presentation,"
                     " pretssh_pre_taux_hop,"
                     " cdf_codif"
                     " WHERE PRE_SP_CODE_FK = SP_CODE_SQ_PK"
                     " AND   PRETSSH_PRE_CODE_FK_PK = PRE_CODE_PK"
                     " AND   CDF_CODE_PK = PRETSSH_CDF_TSS_CODE_FK_PK"
                     " AND NOT EXISTS (SELECT PRIUCD_UCD_CODE_PK"
                     " FROM priucd_prix_ucd"
                     " WHERE PRIUCD_UCD_CODE_PK = PRE_CODE_PK)"
                     " AND PRETSSH_DATE_APPLIQUEE = (SELECT MAX(PRETSSH_DATE_APPLIQUEE)"
                     " FROM pretssh_pre_taux_hop"
                     " WHERE PRETSSH_PRE_CODE_FK_PK = PRE_CODE_PK"
                     " AND PRETSSH_DATE_APPLIQUEE <= NOW())"
                     " AND SP_CIPUCD  = '"+CodeId+"'"
                     " AND CDF_NUMERO_PK = '17'"
                     " AND CDF_NOM = '0 %'"
                     " AND NOT EXISTS (SELECT MAX(PRETSSH_DATE_APPLIQUEE)"
                     " FROM pretssh_pre_taux_hop"
                     " WHERE PRETSSH_PRE_CODE_FK_PK = PRE_CODE_PK"
                     " AND PRETSSH_DATE_APPLIQUEE <= NOW()"
                     " AND PRETSSH_CDF_TSS_CODE_FK_PK IN (1, 2, 3))"
                     " UNION"
                     " SELECT 'B.1'    AS GRP,"
                     " PRIUCD_PFHT AS VALEUR_1,"
                     " 'EUROS HT'  AS NATURE_1,"
                     " PRIUCD_DATE_APPLI_PK  AS DATE_1,"
                     " NULL          AS DATA_1,"
                     " PRIUCD_VALIDE     AS VALIDITE"
                     " FROM  priucd_prix_ucd"
                     " WHERE PRIUCD_UCD_CODE_PK  = '"+CodeId+"'"
                     " AND   PRIUCD_DATE_APPLI_PK = (SELECT MAX(PRIUCD_DATE_APPLI_PK)"
                     " FROM priucd_prix_ucd"
                     " WHERE PRIUCD_DATE_APPLI_PK <= NOW()"
                     " AND PRIUCD_UCD_CODE_PK  = '"+CodeId+"'"
                     " AND PRIUCD_CODE_LISTE_PK = 2)"
                     " AND   PRIUCD_CODE_LISTE_PK = 2"
                     " UNION"
                     " SELECT 'B.1'       AS GRP,"
                     " TO_NUMBER(NULL) AS VALEUR_1,"
                     " 'PRIX libre'    AS NATURE_1,"
                     " TO_DATE(NULL)   AS DATE_1,"
                     " NULL            AS DATA_1,"
                     " U.PRIUCD_VALIDE AS VALIDITE"
                     " FROM    sp_specialite S,"
                     " pre_presentation P,"
                     " priucd_prix_ucd U"
                     " WHERE P.PRE_SP_CODE_FK = S.SP_CODE_SQ_PK"
                     " AND U.PRIUCD_UCD_CODE_PK = S.SP_CIPUCD"
                     " AND S.SP_CIPUCD  = '"+CodeId+"'"
                     " AND P.PRE_AGRCOLL = 'O'"
                     " AND PRIUCD_DATE_APPLI_PK = (SELECT MAX(PRIUCD_DATE_APPLI_PK)"
                     " FROM priucd_prix_ucd"
                     " WHERE PRIUCD_UCD_CODE_PK = S.SP_CIPUCD"
                     " AND PRIUCD_DATE_APPLI_PK <= NOW()"
                     " AND S.SP_CIPUCD  = '"+CodeId+"')"
                     " AND NOT EXISTS (SELECT U1.PRIUCD_UCD_CODE_PK"
                     " FROM priucd_prix_ucd U1"
                     " WHERE U1.PRIUCD_UCD_CODE_PK = S.SP_CIPUCD"
                     " AND U1.PRIUCD_CODE_LISTE_PK = 2)"
                     " UNION"
                     " SELECT 'B.1'       AS GRP,"
                     " TO_NUMBER(NULL) AS VALEUR_1,"
                     " 'NON concerné'  AS NATURE_1,"
                     " TO_DATE(NULL)   AS DATE_1,"
                     " NULL            AS DATA_1,"
                     " PRIUCD_VALIDE  AS VALIDITE"
                     " FROM   sp_specialite S,"
                     " pre_presentation P,"
                     " priucd_prix_ucd U"
                     " WHERE  P.PRE_SP_CODE_FK = S.SP_CODE_SQ_PK"
                     " AND  S.SP_CIPUCD = U.PRIUCD_UCD_CODE_PK"
                     " AND S.SP_CIPUCD  = '"+CodeId+"'"
                     " AND P.PRE_AGRCOLL != 'O'"
                     " AND PRIUCD_DATE_APPLI_PK = (SELECT MAX(PRIUCD_DATE_APPLI_PK)"
                     " FROM priucd_prix_ucd"
                     " WHERE PRIUCD_UCD_CODE_PK = S.SP_CIPUCD"
                     " AND PRIUCD_DATE_APPLI_PK <= NOW()"
                     " AND S.SP_CIPUCD  = '"+CodeId+"')"
                     " AND NOT EXISTS (SELECT U1.PRIUCD_UCD_CODE_PK"
                     " FROM priucd_prix_ucd U1"
                     " WHERE U1.PRIUCD_UCD_CODE_PK = S.SP_CIPUCD"
                     " AND U1.PRIUCD_CODE_LISTE_PK = 2)"
                     " GROUP BY 'B.1',PRIUCD_VALIDE;";

       } else if ( TYPID == 3) {   // --Code CIP13

 //+    SELECT 'A.0'            AS GRP,
 //+     PRIPRE_PRIX_EURO      AS VALEUR_1,
 //+     'euros TTC'           AS NATURE_1,
 //+     PRIPRE_DATE_APPLI_PK  AS DATE_1,
 //+     NULL                  AS DATA_1,
 //+     PRIPRE_VALIDE   AS VALIDITE
 //+   FROM    PRIPRE_PRIX_PRESENTATION,
 //+     SP_SPECIALITE ,
 //+     PRE_PRESENTATION
 //+   WHERE   PRE_CODE_PK = PRIPRE_PRE_CODE_FK_PK
 //+   AND     SP_CODE_SQ_PK = PRE_SP_CODE_FK
 //+   AND     PRIPRE_DATE_APPLI_PK = (SELECT MAX(PRIPRE_DATE_APPLI_PK)
 //+             FROM   PRIPRE_PRIX_PRESENTATION,
 //+                PRE_PRESENTATION
 //+             WHERE PRIPRE_PRE_CODE_FK_PK = PRE_CODE_PK
 //+             AND PRIPRE_DATE_APPLI_PK <= NOW()
 //+             AND PRE_EAN_REF    = CODEID)
 //+   AND   PRE_EAN_REF = CODEID
 //+   UNION
 //+   SELECT 'A.0'                    AS GRP,
 //+     TO_NUMBER(NULL)        AS VALEUR_1,
 //+     'En cours'             AS NATURE_1,
 //+     PRETSS_DATE_APPLIQUEE  AS DATE_1,
 //+     NULL                   AS DATA_1,
 //+     NULL     AS VALIDITE
 //+   FROM   PRETSS_PRESENTATION_TAUX,
 //+     CDF_CODIF,
 //+     PRE_PRESENTATION
 //+   WHERE  PRETSS_PRE_CODE_FK_PK = PRE_CODE_PK
 //+   AND CDF_CODE_PK = PRETSS_CDF_TSS_CODE_FK_PK
 //+   AND NOT EXISTS (SELECT PRIPRE_PRE_CODE_FK_PK
 //+        FROM   PRIPRE_PRIX_PRESENTATION
 //+        WHERE  PRIPRE_PRE_CODE_FK_PK = PRETSS_PRE_CODE_FK_PK
 //+        AND    PRIPRE_DATE_APPLI_PK <= NOW())
 //+   AND PRETSS_DATE_APPLIQUEE = (SELECT MAX(PRETSS_DATE_APPLIQUEE)
 //+            FROM PRETSS_PRESENTATION_TAUX,
 //+                PRE_PRESENTATION
 //+            WHERE PRETSS_PRE_CODE_FK_PK = PRE_CODE_PK
 //+            AND PRE_EAN_REF = CODEID)
 //+   AND EXISTS (SELECT MAX(PRETSS_DATE_APPLIQUEE)
 //+      FROM PRETSS_PRESENTATION_TAUX,
 //+        PRE_PRESENTATION
 //+      WHERE PRETSS_PRE_CODE_FK_PK = PRE_CODE_PK
 //+      AND PRETSS_DATE_APPLIQUEE <= NOW()
 //+      AND PRETSS_CDF_TSS_CODE_FK_PK = 4
 //+      AND PRE_EAN_REF = CODEID)
 //+   AND PRE_EAN_REF = CODEID
 //+   AND CDF_NUMERO_PK  = '17'
 //+   AND CDF_NOM IN ('35%', '35 %','65%', '65 %', '100%', '100 %')
 //+   UNION
 //+   SELECT 'A.0'                   AS GRP,
 //+      TO_NUMBER(NULL)        AS VALEUR_1,
 //+      'En cours'             AS NATURE_1,
 //+      PRETSS_DATE_APPLIQUEE  AS DATE_1,
 //+      NULL                   AS DATA_1,
 //+     NULL     AS VALIDITE
 //+   FROM   PRETSS_PRESENTATION_TAUX,
 //+      CDF_CODIF,
 //+      PRE_PRESENTATION
 //+   WHERE  PRETSS_PRE_CODE_FK_PK = PRE_CODE_PK
 //+   AND CDF_CODE_PK = PRETSS_CDF_TSS_CODE_FK_PK
 //+   AND NOT EXISTS (SELECT PRIPRE_PRE_CODE_FK_PK
 //+         FROM   PRIPRE_PRIX_PRESENTATION
 //+         WHERE  PRIPRE_PRE_CODE_FK_PK = PRETSS_PRE_CODE_FK_PK
 //+         AND    PRIPRE_DATE_APPLI_PK <= NOW())
 //+   AND PRETSS_DATE_APPLIQUEE = (SELECT MAX(PRETSS_DATE_APPLIQUEE)
 //+              FROM PRETSS_PRESENTATION_TAUX,
 //+                  PRE_PRESENTATION
 //+              WHERE PRETSS_PRE_CODE_FK_PK = PRE_CODE_PK
 //+              AND PRE_EAN_REF = CODEID)
 //+   AND NOT EXISTS (SELECT MAX(PRETSS_DATE_APPLIQUEE)
 //+         FROM PRETSS_PRESENTATION_TAUX,
 //+            PRE_PRESENTATION
 //+         WHERE PRETSS_PRE_CODE_FK_PK = PRE_CODE_PK
 //+         AND PRE_EAN_REF = CODEID
 //+         AND PRETSS_DATE_APPLIQUEE <= NOW()
 //+         AND PRETSS_CDF_TSS_CODE_FK_PK = 4)
 //+   AND PRE_EAN_REF = CODEID
 //+   AND CDF_NUMERO_PK = '17'
 //+   AND CDF_NOM IN('35%', '35 %','65%', '65 %', '100%', '100 %')
 //+   UNION
 //+   SELECT 'A.0'                  AS GRP,
 //+     TO_NUMBER(NULL)       AS VALEUR_1,
 //+     'Prix libre'          AS NATURE_1,
 //+     PRETSS_DATE_APPLIQUEE AS DATE_1,
 //+     CDF_NOM               AS DATA_1,
 //+     NULL      AS VALIDITE
 //+   FROM   PRETSS_PRESENTATION_TAUX,
 //+       CDF_CODIF,
 //+       PRE_PRESENTATION
 //+   WHERE  PRETSS_PRE_CODE_FK_PK = PRE_CODE_PK
 //+   AND    CDF_CODE_PK = PRETSS_CDF_TSS_CODE_FK_PK
 //+   AND NOT EXISTS (SELECT PRIPRE_PRE_CODE_FK_PK
 //+         FROM   PRIPRE_PRIX_PRESENTATION
 //+         WHERE  PRIPRE_PRE_CODE_FK_PK = PRETSS_PRE_CODE_FK_PK
 //+         AND    PRIPRE_DATE_APPLI_PK <= NOW())
 //+   AND PRE_EAN_REF = CODEID
 //+   AND CDF_NUMERO_PK = '17'
 //+   AND CDF_NOM IN ('0 %', '0%')
 //+   AND PRETSS_NUMSEQ = 1
 //+   UNION
 //+   SELECT 'A.0'            AS GRP,
 //+     TO_NUMBER(NULL) AS VALEUR_1,
 //+     'Non concerné'  AS NATURE_1,
 //+     TO_DATE(NULL)   AS DATE_1,
 //+     NULL            AS DATA_1,
 //+     NULL   AS VALIDITE
 //+   FROM  PRE_PRESENTATION
 //+   WHERE PRE_EAN_REF = CODEID
 //+   AND NOT EXISTS (SELECT PRETSS_PRE_CODE_FK_PK
 //+       FROM PRETSS_PRESENTATION_TAUX,
 //+         PRE_PRESENTATION
 //+       WHERE PRETSS_PRE_CODE_FK_PK = PRE_CODE_PK
 //+       AND   PRE_EAN_REF = CODEID)
 //+   AND NOT EXISTS (SELECT PRIPRE_PRE_CODE_FK_PK
 //+       FROM PRIPRE_PRIX_PRESENTATION
 //+       WHERE PRIPRE_PRE_CODE_FK_PK = PRE_CODE_PK
 //+       AND PRIPRE_DATE_APPLI_PK <= NOW())
 //+   UNION
 //+   SELECT 'A.1'             AS GRP,
 //+      FORPRE_FORFAIT  AS VALEUR_1,
 //+      'euros TTC'     AS NATURE_1,
 //+      FORPRE_DATE_PK  AS DATE_1,
 //+      NULL     AS DATA_1,
 //+      FORPRE_VALIDE   AS VALIDITE
 //+   FROM   FORPRE_FORFAIT_PRE,
 //+       PRE_PRESENTATION
 //+   WHERE PRE_CODE_PK  = FORPRE_PRE_CODE_FK_PK
 //+   AND FORPRE_DATE_PK = (SELECT MAX(FORPRE_DATE_PK)
 //+          FROM   FORPRE_FORFAIT_PRE,
 //+             PRE_PRESENTATION
 //+          WHERE FORPRE_PRE_CODE_FK_PK = PRE_CODE_PK
 //+          AND FORPRE_DATE_PK <= NOW()
 //+          AND PRE_EAN_REF   = CODEID)
 //+   AND PRE_EAN_REF = CODEID
 //+   UNION
 //+   SELECT 'A.1'             AS GRP,
 //+      TO_NUMBER(NULL) AS VALEUR_1,
 //+      'Non concerné'  AS NATURE_1,
 //+      TO_DATE(NULL)   AS DATE_1,
 //+      NULL     AS DATA_1,
 //+      NULL      AS VALIDITE
 //+   FROM  PRE_PRESENTATION
 //+   WHERE NOT EXISTS (SELECT FORPRE_PRE_CODE_FK_PK
 //+         FROM FORPRE_FORFAIT_PRE
 //+         WHERE FORPRE_PRE_CODE_FK_PK = PRE_CODE_PK
 //+         AND  FORPRE_DATE_PK <= NOW())
 //+   AND PRE_EAN_REF = CODEID;
                sql_query += " SELECT 'A.0'            AS GRP,"
                     " PRIPRE_PRIX_EURO      AS VALEUR_1,"
                     " 'EUROS TTC'           AS NATURE_1,"
                     " PRIPRE_DATE_APPLI_PK  AS DATE_1,"
                     " NULL                  AS DATA_1,"
                     " PRIPRE_VALIDE   AS VALIDITE"
                     " FROM    pripre_prix_presentation,"
                     " sp_specialite ,"
                     " pre_presentation"
                     " WHERE   PRE_CODE_PK = PRIPRE_PRE_CODE_FK_PK"
                     " AND     SP_CODE_SQ_PK = PRE_SP_CODE_FK"
                     " AND     PRIPRE_DATE_APPLI_PK = (SELECT MAX(PRIPRE_DATE_APPLI_PK)"
                     " FROM   pripre_prix_presentation,"
                     " pre_presentation"
                     " WHERE PRIPRE_PRE_CODE_FK_PK = PRE_CODE_PK"
                     " AND PRIPRE_DATE_APPLI_PK <= NOW()"
                     " AND PRE_EAN_REF     = '"+CodeId+"')"
                     " AND   PRE_EAN_REF  = '"+CodeId+"'"
                     " UNION"
                     " SELECT 'A.0'                    AS GRP,"
                     " TO_NUMBER(NULL)        AS VALEUR_1,"
                     " 'EN cours'             AS NATURE_1,"
                     " PRETSS_DATE_APPLIQUEE  AS DATE_1,"
                     " NULL                   AS DATA_1,"
                     " NULL     AS VALIDITE"
                     " FROM   pretss_presentation_taux,"
                     " cdf_codif,"
                     " pre_presentation"
                     " WHERE  PRETSS_PRE_CODE_FK_PK = PRE_CODE_PK"
                     " AND CDF_CODE_PK = PRETSS_CDF_TSS_CODE_FK_PK"
                     " AND NOT EXISTS (SELECT PRIPRE_PRE_CODE_FK_PK"
                     " FROM   pripre_prix_presentation"
                     " WHERE  PRIPRE_PRE_CODE_FK_PK = PRETSS_PRE_CODE_FK_PK"
                     " AND    PRIPRE_DATE_APPLI_PK <= NOW())"
                     " AND PRETSS_DATE_APPLIQUEE = (SELECT MAX(PRETSS_DATE_APPLIQUEE)"
                     " FROM pretss_presentation_taux,"
                     " pre_presentation"
                     " WHERE PRETSS_PRE_CODE_FK_PK = PRE_CODE_PK"
                     " AND PRE_EAN_REF  = '"+CodeId+"')"
                     " AND EXISTS (SELECT MAX(PRETSS_DATE_APPLIQUEE)"
                     " FROM pretss_presentation_taux,"
                     " pre_presentation"
                     " WHERE PRETSS_PRE_CODE_FK_PK = PRE_CODE_PK"
                     " AND PRETSS_DATE_APPLIQUEE <= NOW()"
                     " AND PRETSS_CDF_TSS_CODE_FK_PK = 4"
                     " AND PRE_EAN_REF  = '"+CodeId+"')"
                     " AND PRE_EAN_REF  = '"+CodeId+"'"
                     " AND CDF_NUMERO_PK  = '17'"
                     " AND CDF_NOM IN ('35%', '35 %','65%', '65 %', '100%', '100 %')"
                     " UNION"
                     " SELECT 'A.0'                   AS GRP,"
                     " TO_NUMBER(NULL)        AS VALEUR_1,"
                     " 'EN cours'             AS NATURE_1,"
                     " PRETSS_DATE_APPLIQUEE  AS DATE_1,"
                     " NULL                   AS DATA_1,"
                     " NULL     AS VALIDITE"
                     " FROM   pretss_presentation_taux,"
                     " cdf_codif,"
                     " pre_presentation"
                     " WHERE  PRETSS_PRE_CODE_FK_PK = PRE_CODE_PK"
                     " AND CDF_CODE_PK = PRETSS_CDF_TSS_CODE_FK_PK"
                     " AND NOT EXISTS (SELECT PRIPRE_PRE_CODE_FK_PK"
                     " FROM   pripre_prix_presentation"
                     " WHERE  PRIPRE_PRE_CODE_FK_PK = PRETSS_PRE_CODE_FK_PK"
                     " AND    PRIPRE_DATE_APPLI_PK <= NOW())"
                     " AND PRETSS_DATE_APPLIQUEE = (SELECT MAX(PRETSS_DATE_APPLIQUEE)"
                     " FROM pretss_presentation_taux,"
                     " pre_presentation"
                     " WHERE PRETSS_PRE_CODE_FK_PK = PRE_CODE_PK"
                     " AND PRE_EAN_REF  = '"+CodeId+"')"
                     " AND NOT EXISTS (SELECT MAX(PRETSS_DATE_APPLIQUEE)"
                     " FROM pretss_presentation_taux,"
                     " pre_presentation"
                     " WHERE PRETSS_PRE_CODE_FK_PK = PRE_CODE_PK"
                     " AND PRE_EAN_REF  = '"+CodeId+"'"
                     " AND PRETSS_DATE_APPLIQUEE <= NOW()"
                     " AND PRETSS_CDF_TSS_CODE_FK_PK = 4)"
                     " AND PRE_EAN_REF  = '"+CodeId+"'"
                     " AND CDF_NUMERO_PK = '17'"
                     " AND CDF_NOM IN('35%', '35 %','65%', '65 %', '100%', '100 %')"
                     " UNION"
                     " SELECT 'A.0'                  AS GRP,"
                     " TO_NUMBER(NULL)       AS VALEUR_1,"
                     " 'PRIX libre'          AS NATURE_1,"
                     " PRETSS_DATE_APPLIQUEE AS DATE_1,"
                     " CDF_NOM               AS DATA_1,"
                     " NULL      AS VALIDITE"
                     " FROM   pretss_presentation_taux,"
                     " cdf_codif,"
                     " pre_presentation"
                     " WHERE  PRETSS_PRE_CODE_FK_PK = PRE_CODE_PK"
                     " AND    CDF_CODE_PK = PRETSS_CDF_TSS_CODE_FK_PK"
                     " AND NOT EXISTS (SELECT PRIPRE_PRE_CODE_FK_PK"
                     " FROM   pripre_prix_presentation"
                     " WHERE  PRIPRE_PRE_CODE_FK_PK = PRETSS_PRE_CODE_FK_PK"
                     " AND    PRIPRE_DATE_APPLI_PK <= NOW())"
                     " AND PRE_EAN_REF  = '"+CodeId+"'"
                     " AND CDF_NUMERO_PK = '17'"
                     " AND CDF_NOM IN ('0 %', '0%')"
                     " AND PRETSS_NUMSEQ = 1"
                     " UNION"
                     " SELECT 'A.0'            AS GRP,"
                     " TO_NUMBER(NULL) AS VALEUR_1,"
                     " 'NON concerné'  AS NATURE_1,"
                     " TO_DATE(NULL)   AS DATE_1,"
                     " NULL            AS DATA_1,"
                     " NULL   AS VALIDITE"
                     " FROM  pre_presentation"
                     " WHERE PRE_EAN_REF  = '"+CodeId+"'"
                     " AND NOT EXISTS (SELECT PRETSS_PRE_CODE_FK_PK"
                     " FROM pretss_presentation_taux,"
                     " pre_presentation"
                     " WHERE PRETSS_PRE_CODE_FK_PK = PRE_CODE_PK"
                     " AND   PRE_EAN_REF  = '"+CodeId+"')"
                     " AND NOT EXISTS (SELECT PRIPRE_PRE_CODE_FK_PK"
                     " FROM pripre_prix_presentation"
                     " WHERE PRIPRE_PRE_CODE_FK_PK = PRE_CODE_PK"
                     " AND PRIPRE_DATE_APPLI_PK <= NOW())"
                     " UNION"
                     " SELECT 'A.1'             AS GRP,"
                     " FORPRE_FORFAIT  AS VALEUR_1,"
                     " 'EUROS TTC'     AS NATURE_1,"
                     " FORPRE_DATE_PK  AS DATE_1,"
                     " NULL     AS DATA_1,"
                     " FORPRE_VALIDE   AS VALIDITE"
                     " FROM   forpre_forfait_pre,"
                     " pre_presentation"
                     " WHERE PRE_CODE_PK  = FORPRE_PRE_CODE_FK_PK"
                     " AND FORPRE_DATE_PK = (SELECT MAX(FORPRE_DATE_PK)"
                     " FROM   forpre_forfait_pre,"
                     " pre_presentation"
                     " WHERE FORPRE_PRE_CODE_FK_PK = PRE_CODE_PK"
                     " AND FORPRE_DATE_PK <= NOW()"
                     " AND PRE_EAN_REF    = '"+CodeId+"')"
                     " AND PRE_EAN_REF  = '"+CodeId+"'"
                     " UNION"
                     " SELECT 'A.1'             AS GRP,"
                     " TO_NUMBER(NULL) AS VALEUR_1,"
                     " 'NON concerné'  AS NATURE_1,"
                     " TO_DATE(NULL)   AS DATE_1,"
                     " NULL     AS DATA_1,"
                     " NULL      AS VALIDITE"
                     " FROM  pre_presentation"
                     " WHERE NOT EXISTS (SELECT FORPRE_PRE_CODE_FK_PK"
                     " FROM forpre_forfait_pre"
                     " WHERE FORPRE_PRE_CODE_FK_PK = PRE_CODE_PK"
                     " AND  FORPRE_DATE_PK <= NOW())"
                     " AND PRE_EAN_REF  = '"+CodeId+"';";

       } else if ( TYPID == 4) {   // --Code UCD13

 //+       SELECT 'B.0'  AS GRP,
 //+      TO_NUMBER(NULL) AS VALEUR_1,
 //+      'Non concerné'  AS NATURE_1,
 //+      TO_DATE(NULL)   AS DATE_1,
 //+      NULL            AS DATA_1,
 //+      NULL    AS VALIDITE
 //+   FROM SP_SPECIALITE,
 //+     PRE_PRESENTATION
 //+   WHERE PRE_SP_CODE_FK = SP_CODE_SQ_PK
 //+   AND NOT EXISTS (SELECT PRIUCD_UCD_CODE_PK
 //+         FROM PRIUCD_PRIX_UCD
 //+         WHERE PRIUCD_DATE_APPLI_PK <= NOW()
 //+         AND   PRIUCD_UCD_CODE_PK = SP_CIPUCD
 //+         AND   PRIUCD_CODE_LISTE_PK = 1)
 //+   AND NOT EXISTS (SELECT PRETSSH_PRE_CODE_FK_PK
 //+         FROM PRETSSH_PRE_TAUX_HOP
 //+         WHERE PRETSSH_PRE_CODE_FK_PK = PRE_CODE_PK
 //+         AND PRETSSH_DATE_APPLIQUEE <= NOW()
 //+         AND PRETSSH_CDF_TSS_CODE_FK_PK = 4)
 //+   AND SP_CIPUCD13 = CODEID
 //+   UNION
 //+   SELECT 'B.0'     AS GRP,
 //+      PRIUCD_PFHT AS VALEUR_1,
 //+      'euros HT'  AS NATURE_1,
 //+      PRIUCD_DATE_APPLI_PK AS DATE_1,
 //+      NULL        AS DATA_1,
 //+      PRIUCD_VALIDE    AS VALIDITE
 //+   FROM  PRIUCD_PRIX_UCD,
 //+      SP_SPECIALITE
 //+   WHERE SP_CIPUCD = PRIUCD_UCD_CODE_PK
 //+   AND   PRIUCD_DATE_APPLI_PK = (SELECT MAX(PRIUCD_DATE_APPLI_PK)
 //+            FROM   PRIUCD_PRIX_UCD,
 //+               SP_SPECIALITE
 //+           WHERE  SP_CIPUCD = PRIUCD_UCD_CODE_PK
 //+           AND PRIUCD_DATE_APPLI_PK <= NOW()
 //+           AND SP_CIPUCD13 = CODEID
 //+           AND PRIUCD_CODE_LISTE_PK = 1)
 //+   AND SP_CIPUCD13 = CODEID
 //+   AND   PRIUCD_CODE_LISTE_PK = 1
 //+   UNION
 //+   SELECT 'B.0'                     AS GRP,
 //+      TO_NUMBER(NULL)         AS VALEUR_1,
 //+      'En cours'              AS NATURE_1,
 //+      PRETSSH_DATE_APPLIQUEE  AS DATE_1,
 //+      NULL                    AS DATA_1,
 //+      NULL        AS VALIDITE
 //+   FROM SP_SPECIALITE,
 //+     PRE_PRESENTATION,
 //+     PRETSSH_PRE_TAUX_HOP,
 //+     CDF_CODIF
 //+   WHERE PRE_SP_CODE_FK = SP_CODE_SQ_PK
 //+   AND PRETSSH_PRE_CODE_FK_PK = PRE_CODE_PK
 //+   AND CDF_CODE_PK = PRETSSH_CDF_TSS_CODE_FK_PK
 //+   AND PRETSSH_DATE_APPLIQUEE = (SELECT MAX(PRETSSH_DATE_APPLIQUEE)
 //+            FROM   PRETSSH_PRE_TAUX_HOP
 //+            WHERE  PRETSSH_PRE_CODE_FK_PK = PRE_CODE_PK
 //+            AND    PRETSSH_DATE_APPLIQUEE <= NOW())
 //+   AND EXISTS ( SELECT MAX(PRETSSH_DATE_APPLIQUEE)
 //+        FROM PRETSSH_PRE_TAUX_HOP
 //+        WHERE PRETSSH_PRE_CODE_FK_PK = PRE_CODE_PK
 //+        AND PRETSSH_DATE_APPLIQUEE <= NOW()
 //+        AND PRETSSH_CDF_TSS_CODE_FK_PK = 4)
 //+   AND NOT EXISTS (SELECT PRIUCD_UCD_CODE_PK
 //+         FROM PRIUCD_PRIX_UCD
 //+         WHERE PRIUCD_UCD_CODE_PK = PRE_CODE_PK)
 //+   AND NOT EXISTS (SELECT PRIUCD_UCD_CODE_PK
 //+         FROM PRIUCD_PRIX_UCD
 //+         WHERE PRIUCD_DATE_APPLI_PK <= NOW()
 //+         AND   PRIUCD_UCD_CODE_PK = SP_CIPUCD
 //+         AND   PRIUCD_CODE_LISTE_PK = 1)
 //+   AND SP_CIPUCD13 = CODEID
 //+   AND CDF_NUMERO_PK = '17'
 //+   AND CDF_NOM IN('35%', '35 %','65%', '65 %', '100%', '100 %')
 //+   UNION
 //+   SELECT 'B.0'                     AS GRP,
 //+      TO_NUMBER(NULL)         AS VALEUR_1,
 //+      'Prix libre'            AS NATURE_1,
 //+      PRETSSH_DATE_APPLIQUEE  AS DATE_1,
 //+      NULL                    AS DATA_1,
 //+      NULL        AS VALIDITE
 //+   FROM  SP_SPECIALITE,
 //+      PRE_PRESENTATION,
 //+      PRETSSH_PRE_TAUX_HOP,
 //+      CDF_CODIF
 //+   WHERE PRE_SP_CODE_FK = SP_CODE_SQ_PK
 //+   AND   PRETSSH_PRE_CODE_FK_PK = PRE_CODE_PK
 //+   AND   CDF_CODE_PK = PRETSSH_CDF_TSS_CODE_FK_PK
 //+   AND NOT EXISTS (SELECT PRIUCD_UCD_CODE_PK
 //+       FROM PRIUCD_PRIX_UCD
 //+       WHERE PRIUCD_UCD_CODE_PK = PRE_CODE_PK)
 //+   AND PRETSSH_DATE_APPLIQUEE = (SELECT MAX(PRETSSH_DATE_APPLIQUEE)
 //+            FROM PRETSSH_PRE_TAUX_HOP
 //+            WHERE PRETSSH_PRE_CODE_FK_PK = PRE_CODE_PK
 //+            AND PRETSSH_DATE_APPLIQUEE <= NOW())
 //+   AND SP_CIPUCD13 = CODEID
 //+   AND CDF_NUMERO_PK = '17'
 //+   AND CDF_NOM = '0 %'
 //+   AND NOT EXISTS (SELECT MAX(PRETSSH_DATE_APPLIQUEE)
 //+       FROM PRETSSH_PRE_TAUX_HOP
 //+       WHERE PRETSSH_PRE_CODE_FK_PK = PRE_CODE_PK
 //+       AND PRETSSH_DATE_APPLIQUEE <= NOW()
 //+       AND PRETSSH_CDF_TSS_CODE_FK_PK IN (1, 2, 3))
 //+   UNION
 //+   SELECT 'B.1'    AS GRP,
 //+      PRIUCD_PFHT AS VALEUR_1,
 //+      'euros HT'  AS NATURE_1,
 //+      PRIUCD_DATE_APPLI_PK  AS DATE_1,
 //+      NULL          AS DATA_1,
 //+      PRIUCD_VALIDE     AS VALIDITE
 //+   FROM  PRIUCD_PRIX_UCD,
 //+      SP_SPECIALITE
 //+   WHERE SP_CIPUCD = PRIUCD_UCD_CODE_PK
 //+   AND   PRIUCD_DATE_APPLI_PK = (SELECT MAX(PRIUCD_DATE_APPLI_PK)
 //+            FROM PRIUCD_PRIX_UCD,
 //+                SP_SPECIALITE
 //+            WHERE SP_CIPUCD = PRIUCD_UCD_CODE_PK
 //+            AND PRIUCD_DATE_APPLI_PK <= NOW()
 //+            AND SP_CIPUCD13 = CODEID
 //+            AND PRIUCD_CODE_LISTE_PK = 2)
 //+   AND SP_CIPUCD13       = CODEID
 //+   AND PRIUCD_CODE_LISTE_PK = 2
 //+   UNION
 //+   SELECT 'B.1'       AS GRP,
 //+     TO_NUMBER(NULL) AS VALEUR_1,
 //+     'Prix libre'    AS NATURE_1,
 //+     TO_DATE(NULL)   AS DATE_1,
 //+     NULL            AS DATA_1,
 //+     U.PRIUCD_VALIDE  AS VALIDITE
 //+   FROM    SP_SPECIALITE S,
 //+     PRE_PRESENTATION P,
 //+     PRIUCD_PRIX_UCD U
 //+   WHERE   P.PRE_SP_CODE_FK = S.SP_CODE_SQ_PK
 //+   AND U.PRIUCD_UCD_CODE_PK = S.SP_CIPUCD
 //+   AND S.SP_CIPUCD13 = CODEID
 //+   AND P.PRE_AGRCOLL = 'O'
 //+   AND PRIUCD_DATE_APPLI_PK = (SELECT MAX(PRIUCD_DATE_APPLI_PK)
 //+          FROM PRIUCD_PRIX_UCD
 //+          WHERE PRIUCD_UCD_CODE_PK = S.SP_CIPUCD
 //+          AND PRIUCD_DATE_APPLI_PK <= NOW()
 //+          AND S.SP_CIPUCD13 = CODEID)
 //+   AND NOT EXISTS (SELECT U1.PRIUCD_UCD_CODE_PK
 //+        FROM PRIUCD_PRIX_UCD U1
 //+        WHERE U1.PRIUCD_UCD_CODE_PK = S.SP_CIPUCD
 //+        AND U1.PRIUCD_CODE_LISTE_PK = 2)
 //+   UNION
 //+   SELECT 'B.1'       AS GRP,
 //+      TO_NUMBER(NULL) AS VALEUR_1,
 //+      'Non concerné'  AS NATURE_1,
 //+      TO_DATE(NULL)   AS DATE_1,
 //+      NULL            AS DATA_1,
 //+      PRIUCD_VALIDE  AS VALIDITE
 //+   FROM SP_SPECIALITE S,
 //+     PRE_PRESENTATION P,
 //+     PRIUCD_PRIX_UCD U
 //+   WHERE P.PRE_SP_CODE_FK = S.SP_CODE_SQ_PK
 //+   AND U.PRIUCD_UCD_CODE_PK = S.SP_CIPUCD
 //+   AND S.SP_CIPUCD13 = CODEID
 //+   AND P.PRE_AGRCOLL != 'O'
 //+   AND PRIUCD_DATE_APPLI_PK = (SELECT MAX(PRIUCD_DATE_APPLI_PK)
 //+          FROM PRIUCD_PRIX_UCD
 //+          WHERE PRIUCD_UCD_CODE_PK = S.SP_CIPUCD
 //+          AND PRIUCD_DATE_APPLI_PK <= NOW()
 //+          AND S.SP_CIPUCD13 = CODEID)
 //+   AND NOT EXISTS (SELECT U1.PRIUCD_UCD_CODE_PK
 //+         FROM PRIUCD_PRIX_UCD U1
 //+         WHERE U1.PRIUCD_UCD_CODE_PK = S.SP_CIPUCD
 //+         AND U1.PRIUCD_CODE_LISTE_PK = 2)
 //+   GROUP BY 'B.1',PRIUCD_VALIDE;
                sql_query += " SELECT 'B.0'  AS GRP,"
                     " TO_NUMBER(NULL) AS VALEUR_1,"
                     " 'NON concerné'  AS NATURE_1,"
                     " TO_DATE(NULL)   AS DATE_1,"
                     " NULL            AS DATA_1,"
                     " NULL    AS VALIDITE"
                     " FROM sp_specialite,"
                     " pre_presentation"
                     " WHERE PRE_SP_CODE_FK = SP_CODE_SQ_PK"
                     " AND NOT EXISTS (SELECT PRIUCD_UCD_CODE_PK"
                     " FROM priucd_prix_ucd"
                     " WHERE PRIUCD_DATE_APPLI_PK <= NOW()"
                     " AND   PRIUCD_UCD_CODE_PK = SP_CIPUCD"
                     " AND   PRIUCD_CODE_LISTE_PK = 1)"
                     " AND NOT EXISTS (SELECT PRETSSH_PRE_CODE_FK_PK"
                     " FROM pretssh_pre_taux_hop"
                     " WHERE PRETSSH_PRE_CODE_FK_PK = PRE_CODE_PK"
                     " AND PRETSSH_DATE_APPLIQUEE <= NOW()"
                     " AND PRETSSH_CDF_TSS_CODE_FK_PK = 4)"
                     " AND SP_CIPUCD13  = '"+CodeId+"'"
                     " UNION"
                     " SELECT 'B.0'     AS GRP,"
                     " PRIUCD_PFHT AS VALEUR_1,"
                     " 'EUROS HT'  AS NATURE_1,"
                     " PRIUCD_DATE_APPLI_PK AS DATE_1,"
                     " NULL        AS DATA_1,"
                     " PRIUCD_VALIDE    AS VALIDITE"
                     " FROM  priucd_prix_ucd,"
                     " sp_specialite"
                     " WHERE SP_CIPUCD = PRIUCD_UCD_CODE_PK"
                     " AND   PRIUCD_DATE_APPLI_PK = (SELECT MAX(PRIUCD_DATE_APPLI_PK)"
                     " FROM   priucd_prix_ucd,"
                     " sp_specialite"
                     " WHERE  SP_CIPUCD = PRIUCD_UCD_CODE_PK"
                     " AND PRIUCD_DATE_APPLI_PK <= NOW()"
                     " AND SP_CIPUCD13  = '"+CodeId+"'"
                     " AND PRIUCD_CODE_LISTE_PK = 1)"
                     " AND SP_CIPUCD13  = '"+CodeId+"'"
                     " AND   PRIUCD_CODE_LISTE_PK = 1"
                     " UNION"
                     " SELECT 'B.0'                     AS GRP,"
                     " TO_NUMBER(NULL)         AS VALEUR_1,"
                     " 'EN cours'              AS NATURE_1,"
                     " PRETSSH_DATE_APPLIQUEE  AS DATE_1,"
                     " NULL                    AS DATA_1,"
                     " NULL        AS VALIDITE"
                     " FROM sp_specialite,"
                     " pre_presentation,"
                     " pretssh_pre_taux_hop,"
                     " cdf_codif"
                     " WHERE PRE_SP_CODE_FK = SP_CODE_SQ_PK"
                     " AND PRETSSH_PRE_CODE_FK_PK = PRE_CODE_PK"
                     " AND CDF_CODE_PK = PRETSSH_CDF_TSS_CODE_FK_PK"
                     " AND PRETSSH_DATE_APPLIQUEE = (SELECT MAX(PRETSSH_DATE_APPLIQUEE)"
                     " FROM   pretssh_pre_taux_hop"
                     " WHERE  PRETSSH_PRE_CODE_FK_PK = PRE_CODE_PK"
                     " AND    PRETSSH_DATE_APPLIQUEE <= NOW())"
                     " AND EXISTS ( SELECT MAX(PRETSSH_DATE_APPLIQUEE)"
                     " FROM pretssh_pre_taux_hop"
                     " WHERE PRETSSH_PRE_CODE_FK_PK = PRE_CODE_PK"
                     " AND PRETSSH_DATE_APPLIQUEE <= NOW()"
                     " AND PRETSSH_CDF_TSS_CODE_FK_PK = 4)"
                     " AND NOT EXISTS (SELECT PRIUCD_UCD_CODE_PK"
                     " FROM priucd_prix_ucd"
                     " WHERE PRIUCD_UCD_CODE_PK = PRE_CODE_PK)"
                     " AND NOT EXISTS (SELECT PRIUCD_UCD_CODE_PK"
                     " FROM priucd_prix_ucd"
                     " WHERE PRIUCD_DATE_APPLI_PK <= NOW()"
                     " AND   PRIUCD_UCD_CODE_PK = SP_CIPUCD"
                     " AND   PRIUCD_CODE_LISTE_PK = 1)"
                     " AND SP_CIPUCD13  = '"+CodeId+"'"
                     " AND CDF_NUMERO_PK = '17'"
                     " AND CDF_NOM IN('35%', '35 %','65%', '65 %', '100%', '100 %')"
                     " UNION"
                     " SELECT 'B.0'                     AS GRP,"
                     " TO_NUMBER(NULL)         AS VALEUR_1,"
                     " 'PRIX libre'            AS NATURE_1,"
                     " PRETSSH_DATE_APPLIQUEE  AS DATE_1,"
                     " NULL                    AS DATA_1,"
                     " NULL        AS VALIDITE"
                     " FROM  sp_specialite,"
                     " pre_presentation,"
                     " pretssh_pre_taux_hop,"
                     " cdf_codif"
                     " WHERE PRE_SP_CODE_FK = SP_CODE_SQ_PK"
                     " AND   PRETSSH_PRE_CODE_FK_PK = PRE_CODE_PK"
                     " AND   CDF_CODE_PK = PRETSSH_CDF_TSS_CODE_FK_PK"
                     " AND NOT EXISTS (SELECT PRIUCD_UCD_CODE_PK"
                     " FROM priucd_prix_ucd"
                     " WHERE PRIUCD_UCD_CODE_PK = PRE_CODE_PK)"
                     " AND PRETSSH_DATE_APPLIQUEE = (SELECT MAX(PRETSSH_DATE_APPLIQUEE)"
                     " FROM pretssh_pre_taux_hop"
                     " WHERE PRETSSH_PRE_CODE_FK_PK = PRE_CODE_PK"
                     " AND PRETSSH_DATE_APPLIQUEE <= NOW())"
                     " AND SP_CIPUCD13  = '"+CodeId+"'"
                     " AND CDF_NUMERO_PK = '17'"
                     " AND CDF_NOM = '0 %'"
                     " AND NOT EXISTS (SELECT MAX(PRETSSH_DATE_APPLIQUEE)"
                     " FROM pretssh_pre_taux_hop"
                     " WHERE PRETSSH_PRE_CODE_FK_PK = PRE_CODE_PK"
                     " AND PRETSSH_DATE_APPLIQUEE <= NOW()"
                     " AND PRETSSH_CDF_TSS_CODE_FK_PK IN (1, 2, 3))"
                     " UNION"
                     " SELECT 'B.1'    AS GRP,"
                     " PRIUCD_PFHT AS VALEUR_1,"
                     " 'EUROS HT'  AS NATURE_1,"
                     " PRIUCD_DATE_APPLI_PK  AS DATE_1,"
                     " NULL          AS DATA_1,"
                     " PRIUCD_VALIDE     AS VALIDITE"
                     " FROM  priucd_prix_ucd,"
                     " sp_specialite"
                     " WHERE SP_CIPUCD = PRIUCD_UCD_CODE_PK"
                     " AND   PRIUCD_DATE_APPLI_PK = (SELECT MAX(PRIUCD_DATE_APPLI_PK)"
                     " FROM priucd_prix_ucd,"
                     " sp_specialite"
                     " WHERE SP_CIPUCD = PRIUCD_UCD_CODE_PK"
                     " AND PRIUCD_DATE_APPLI_PK <= NOW()"
                     " AND SP_CIPUCD13  = '"+CodeId+"'"
                     " AND PRIUCD_CODE_LISTE_PK = 2)"
                     " AND SP_CIPUCD13        = '"+CodeId+"'"
                     " AND PRIUCD_CODE_LISTE_PK = 2"
                     " UNION"
                     " SELECT 'B.1'       AS GRP,"
                     " TO_NUMBER(NULL) AS VALEUR_1,"
                     " 'PRIX libre'    AS NATURE_1,"
                     " TO_DATE(NULL)   AS DATE_1,"
                     " NULL            AS DATA_1,"
                     " U.PRIUCD_VALIDE  AS VALIDITE"
                     " FROM    sp_specialite S,"
                     " pre_presentation P,"
                     " priucd_prix_ucd U"
                     " WHERE   P.PRE_SP_CODE_FK = S.SP_CODE_SQ_PK"
                     " AND U.PRIUCD_UCD_CODE_PK = S.SP_CIPUCD"
                     " AND S.SP_CIPUCD13  = '"+CodeId+"'"
                     " AND P.PRE_AGRCOLL = 'O'"
                     " AND PRIUCD_DATE_APPLI_PK = (SELECT MAX(PRIUCD_DATE_APPLI_PK)"
                     " FROM priucd_prix_ucd"
                     " WHERE PRIUCD_UCD_CODE_PK = S.SP_CIPUCD"
                     " AND PRIUCD_DATE_APPLI_PK <= NOW()"
                     " AND S.SP_CIPUCD13  = '"+CodeId+"')"
                     " AND NOT EXISTS (SELECT U1.PRIUCD_UCD_CODE_PK"
                     " FROM priucd_prix_ucd U1"
                     " WHERE U1.PRIUCD_UCD_CODE_PK = S.SP_CIPUCD"
                     " AND U1.PRIUCD_CODE_LISTE_PK = 2)"
                     " UNION"
                     " SELECT 'B.1'       AS GRP,"
                     " TO_NUMBER(NULL) AS VALEUR_1,"
                     " 'NON concerné'  AS NATURE_1,"
                     " TO_DATE(NULL)   AS DATE_1,"
                     " NULL            AS DATA_1,"
                     " PRIUCD_VALIDE  AS VALIDITE"
                     " FROM sp_specialite S,"
                     " pre_presentation P,"
                     " priucd_prix_ucd U"
                     " WHERE P.PRE_SP_CODE_FK = S.SP_CODE_SQ_PK"
                     " AND U.PRIUCD_UCD_CODE_PK = S.SP_CIPUCD"
                     " AND S.SP_CIPUCD13  = '"+CodeId+"'"
                     " AND P.PRE_AGRCOLL != 'O'"
                     " AND PRIUCD_DATE_APPLI_PK = (SELECT MAX(PRIUCD_DATE_APPLI_PK)"
                     " FROM priucd_prix_ucd"
                     " WHERE PRIUCD_UCD_CODE_PK = S.SP_CIPUCD"
                     " AND PRIUCD_DATE_APPLI_PK <= NOW()"
                     " AND S.SP_CIPUCD13  = '"+CodeId+"')"
                     " AND NOT EXISTS (SELECT U1.PRIUCD_UCD_CODE_PK"
                     " FROM priucd_prix_ucd U1"
                     " WHERE U1.PRIUCD_UCD_CODE_PK = S.SP_CIPUCD"
                     " AND U1.PRIUCD_CODE_LISTE_PK = 2)"
                     " GROUP BY 'B.1',PRIUCD_VALIDE;";

       }*/
     //............. zone de construction de la requete FIN ...............
       CGestIni::Param_UpdateToDisk("/home/ro/test.sql", sql_query);
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_PRE_PRI() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_MY_GRP   = value(0).toString();
                m_VALEUR_1 = value(1).toDouble();
                m_NATURE_1 = value(2).toString();
                m_DATE_1   = value(3).toDate();
                m_DATA_1   = value(4).toString();
                m_VALIDITE = value(5).toDouble();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      QString MY_GRP()   {return m_MY_GRP;}
      double  VALEUR_1() {return m_VALEUR_1;}
      QString NATURE_1() {return m_NATURE_1;}
      QDate   DATE_1()   {return m_DATE_1;}
      QString DATA_1()   {return m_DATA_1;}
      double  VALIDITE() {return m_VALIDITE;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      QString m_MY_GRP;
      double  m_VALEUR_1;
      QString m_NATURE_1;
      QDate   m_DATE_1;
      QString m_DATA_1;
      double  m_VALIDITE;
 };

 //================================== C_GET_THE_SPE_STATUT_CUR   -73- ==================================
 /****************************************************************************
 *   Nom           :  GET_THE_SPE_STATUT
 -----------------------------------------------------------------------------
 *   Date creation : 04/09/2008
 -----------------------------------------------------------------------------
 *   Description   :  Cette procédure renvoie les informations concernant le statut
 *                    de la spécialité pour l'identifiant de spécialité passé en paramètre.
 *   MAJ           :  12/12/2008
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_SPE_STATUT_CUR  C_GET_THE_SPE_STATUT ( database(), this );
      while ( C_GET_THE_SPE_STATUT.next( IDSPE  ) )
            { html += tr("<br><b> GET_THE_SPE_STATUT : </b>  ") + C_GET_THE_SPE_STATUT.MEMBER();
            }
  */

  class C_GET_THE_SPE_STATUT_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_SPE_STATUT_CUR ---------------------
      C_GET_THE_SPE_STATUT_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( double IDSPE )
      {   QString sql_query = "";
          if ( m_isNextData == 0 )
             {
     //............. zone de construction de la requete DEBUT ...............
 //+   SELECT COUNT(*)
 //+ INTO   w_count
 //+ FROM   SPAFS_SPECIALITE_AFSSAPS t1,
 //+          CDF_CODIF              t2
 //+   WHERE  t1.SPAFS_RUBCDF_NUMERO_PK IN ('SP','14S','CPH')
 //+   AND    t1.SPAFS_DATE_PK = ( SELECT MAX(SPAFS_DATE_PK)
 //+           FROM   SPAFS_SPECIALITE_AFSSAPS
 //+           WHERE  SPAFS_RUBCDF_NUMERO_PK IN ('SP','14S','CPH')
 //+           AND    SPAFS_SP_CODE_FK_PK    = IDSPE
 //+          )
 //+  AND t2.CDF_CODE_PK         = t1.SPAFS_CDF_CODE_DOC_FK_PK
 //+    AND t2.CDF_NUMERO_PK       = '25'
 //+    AND t1.SPAFS_SP_CODE_FK_PK = IDSPE ;
                sql_query += " SELECT COUNT(*)"
                     " FROM   spafs_specialite_afssaps t1,"
                     " cdf_codif              t2"
                     " WHERE  t1.SPAFS_RUBCDF_NUMERO_PK IN ('SP','14S','CPH')"
                     " AND    t1.SPAFS_DATE_PK = ( SELECT MAX(SPAFS_DATE_PK)"
                     " FROM   spafs_specialite_afssaps"
                     " WHERE  SPAFS_RUBCDF_NUMERO_PK IN ('SP','14S','CPH')"
                     " AND    SPAFS_SP_CODE_FK_PK  = '"+ QString::number( IDSPE ) +"'"
                     " )"
                     " AND t2.CDF_CODE_PK          =  t1.SPAFS_CDF_CODE_DOC_FK_PK"
                     " AND t2.CDF_NUMERO_PK        = '25'"
                     " AND t1.SPAFS_SP_CODE_FK_PK  = '"+ QString::number( IDSPE ) +"' ;";
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_SPE_STATUT -1- () </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }

          if (QSqlQuery::next())
             {  //++m_isNextData;
                m_MY_w_count = value(0).toInt();
                //return m_isNextData;
             }
       sql_query = "";
       if ( m_MY_w_count == 1) {
 //+      SELECT '1'              AS TYP      ,
 //+             t2.CDF_NOM       AS INFO_01  ,
 //+             NULL             AS DATE_01  ,
 //+             NULL             AS DATE_02
 //+      FROM   SP_SPECIALITE    t1  ,
 //+             CDF_CODIF        t2
 //+      WHERE  t1.SP_CDF_LI_CODE_FK   = t2.CDF_CODE_PK
 //+      AND    t2.CDF_NUMERO_PK       = '08'
 //+      AND    t1.SP_CODE_SQ_PK       = IDSPE
 //+      UNION
 //+      SELECT '2.'||SPCPD_NUMORD    AS TYP      ,
 //+     t2.CDF_NOM         AS   INFO_01  ,
 //+       NULL                AS  DATE_01  ,
 //+     NULL                 DATE_02
 //+      FROM   SPCPD_SPE_CDT_PRESCR   t1,
 //+     CDF_CODIF              t2
 //+      WHERE  t2.CDF_CODE_PK         = t1.SPCPD_CDF_STP_CODE_FK_PK
 //+      AND    t2.CDF_NUMERO_PK       = '14'
 //+      AND    t1.SPCPD_SP_CODE_FK_PK = IDSPE
 //+      UNION
 //+      SELECT '3'                     AS TYP,
 //+     SP_CDT_PRESCR_TEXTE  AS INFO_01,
 //+     NULL                 AS DATE_01,
 //+     NULL                 AS DATE_02
 //+     FROM    SP_SPECIALITE
 //+     WHERE   SP_CODE_SQ_PK       = IDSPE
 //+   AND     SP_CDT_PRESCR_TEXTE IS NOT NULL
 //+     UNION
 //+     SELECT '4'                     AS TYP     ,
 //+    t2.CDF_NOM           AS INFO_01 ,
 //+    t1.SPAFS_DATE_PK     AS DATE_01 ,
 //+            t1.SPAFS_DATE_REVIS    AS DATE_02
 //+     FROM   SPAFS_SPECIALITE_AFSSAPS t1,
 //+            CDF_CODIF              t2
 //+     WHERE  t1.SPAFS_RUBCDF_NUMERO_PK IN ('SP','14S','CPH')
 //+     AND    t1.SPAFS_DATE_PK = ( SELECT MAX(SPAFS_DATE_PK)
 //+           FROM   SPAFS_SPECIALITE_AFSSAPS
 //+           WHERE  SPAFS_RUBCDF_NUMERO_PK IN ('SP','14S','CPH')
 //+           AND    SPAFS_SP_CODE_FK_PK    = IDSPE
 //+          )
 //+     AND t2.CDF_CODE_PK         = t1.SPAFS_CDF_CODE_DOC_FK_PK
 //+     AND t2.CDF_NUMERO_PK       = '25'
 //+     AND t1.SPAFS_SP_CODE_FK_PK = IDSPE ;
                sql_query += " SELECT '1'              AS TYP      ,"
                     " t2.CDF_NOM       AS INFO_01  ,"
                     " NULL             AS DATE_01  ,"
                     " NULL             AS DATE_02   "
                     " FROM   sp_specialite    t1  ,"
                     " cdf_codif        t2"
                     " WHERE  t1.SP_CDF_LI_CODE_FK   = t2.CDF_CODE_PK"
                     " AND    t2.CDF_NUMERO_PK       = '08'"
                     " AND    t1.SP_CODE_SQ_PK        = '"+ QString::number( IDSPE ) +"'"
                     " UNION"
                     " SELECT  SPCPD_NUMORD    AS TYP      ,"
                     " t2.CDF_NOM         AS   INFO_01  ,"
                     " NULL                AS  DATE_01  ,"
                     " NULL                 DATE_02"
                     " FROM   spcpd_spe_cdt_prescr   t1,"
                     " cdf_codif              t2"
                     " WHERE  t2.CDF_CODE_PK         = t1.SPCPD_CDF_STP_CODE_FK_PK"
                     " AND    t2.CDF_NUMERO_PK       = '14'"
                     " AND    t1.SPCPD_SP_CODE_FK_PK  = '"+ QString::number( IDSPE ) +"'"
                     " UNION"
                     " SELECT '3'                     AS TYP,"
                     " SP_CDT_PRESCR_TEXTE  AS INFO_01,"
                     " NULL                 AS DATE_01,"
                     " NULL                 AS DATE_02"
                     " FROM    sp_specialite"
                     " WHERE   SP_CODE_SQ_PK        = '"+ QString::number( IDSPE ) +"'"
                     " AND     SP_CDT_PRESCR_TEXTE IS NOT NULL"
                     " UNION"
                     " SELECT '4'                     AS TYP     ,"
                     " t2.CDF_NOM           AS INFO_01 ,"
                     " t1.SPAFS_DATE_PK     AS DATE_01 ,"
                     " t1.SPAFS_DATE_REVIS    AS DATE_02"
                     " FROM   spafs_specialite_afssaps t1,"
                     " cdf_codif              t2"
                     " WHERE  t1.SPAFS_RUBCDF_NUMERO_PK IN ('SP','14S','CPH')"
                     " AND    t1.SPAFS_DATE_PK = ( SELECT MAX(SPAFS_DATE_PK)"
                     " FROM   spafs_specialite_afssaps"
                     " WHERE  SPAFS_RUBCDF_NUMERO_PK IN ('SP','14S','CPH')"
                     " AND    SPAFS_SP_CODE_FK_PK     = '"+ QString::number( IDSPE ) +"'"
                     " )"
                     " AND t2.CDF_CODE_PK         = t1.SPAFS_CDF_CODE_DOC_FK_PK"
                     " AND t2.CDF_NUMERO_PK       = '25'"
                     " AND t1.SPAFS_SP_CODE_FK_PK  = '"+ QString::number( IDSPE ) +"' ;";

       } else {

 //+      SELECT '1'              AS TYP      ,
 //+             t2.CDF_NOM       AS INFO_01  ,
 //+             NULL             AS DATE_01  ,
 //+             NULL             AS DATE_02
 //+      FROM   SP_SPECIALITE    t1  ,
 //+             CDF_CODIF        t2
 //+      WHERE  t1.SP_CDF_LI_CODE_FK   = t2.CDF_CODE_PK
 //+      AND    t2.CDF_NUMERO_PK       = '08'
 //+      AND    t1.SP_CODE_SQ_PK       = IDSPE
 //+      UNION
 //+      SELECT '2.'||SPCPD_NUMORD      AS TYP      ,
 //+     t2.CDF_NOM           AS INFO_01  ,
 //+       NULL                  AS DATE_01  ,
 //+     NULL                 AS DATE_02
 //+      FROM   SPCPD_SPE_CDT_PRESCR   t1,
 //+     CDF_CODIF              t2
 //+      WHERE  t2.CDF_CODE_PK         = t1.SPCPD_CDF_STP_CODE_FK_PK
 //+      AND    t2.CDF_NUMERO_PK       = '14'
 //+      AND    t1.SPCPD_SP_CODE_FK_PK = IDSPE
 //+      UNION
 //+      SELECT '3'                     AS TYP,
 //+     SP_CDT_PRESCR_TEXTE  AS INFO_01,
 //+     NULL                 AS DATE_01,
 //+     NULL                 AS DATE_02
 //+     FROM    SP_SPECIALITE
 //+     WHERE   SP_CODE_SQ_PK       = IDSPE
 //+   AND     SP_CDT_PRESCR_TEXTE IS NOT NULL
 //+     UNION
 //+     SELECT '4'                     AS TYP     ,
 //+    t2.CDF_NOM           AS INFO_01 ,
 //+    t1.SPAFS_DATE_PK     AS DATE_01 ,
 //+            t1.SPAFS_DATE_REVIS    AS DATE_02
 //+     FROM   SPAFS_SPECIALITE_AFSSAPS t1,
 //+            CDF_CODIF              t2
 //+     WHERE  t1.SPAFS_RUBCDF_NUMERO_PK IN ('SP','14S','CPH')
 //+     AND    t1.SPAFS_DATE_PK = ( SELECT MAX(SPAFS_DATE_PK)
 //+           FROM   SPAFS_SPECIALITE_AFSSAPS
 //+           WHERE  SPAFS_RUBCDF_NUMERO_PK IN ('SP','14S','CPH')
 //+           AND    SPAFS_SP_CODE_FK_PK    = IDSPE
 //+          )
 //+     AND t2.CDF_CODE_PK         = t1.SPAFS_CDF_CODE_DOC_FK_PK
 //+     AND t2.CDF_NUMERO_PK       = '25'
 //+     AND t1.SPAFS_SP_CODE_FK_PK = IDSPE
 //+   AND t1.SPAFS_DATE_REVIS  =
 //+  (SELECT MAX(t1.SPAFS_DATE_REVIS)
 //+     FROM   SPAFS_SPECIALITE_AFSSAPS t1,
 //+            CDF_CODIF              t2
 //+     WHERE  t1.SPAFS_RUBCDF_NUMERO_PK IN ('SP','14S','CPH')
 //+     AND    t1.SPAFS_DATE_PK = ( SELECT MAX(SPAFS_DATE_PK)
 //+         FROM   SPAFS_SPECIALITE_AFSSAPS
 //+            WHERE  SPAFS_RUBCDF_NUMERO_PK IN ('SP','14S','CPH')
 //+         AND    SPAFS_SP_CODE_FK_PK    = IDSPE
 //+           )
 //+  AND t2.CDF_CODE_PK         = t1.SPAFS_CDF_CODE_DOC_FK_PK
 //+     AND t2.CDF_NUMERO_PK       = '25'
 //+     AND t1.SPAFS_SP_CODE_FK_PK = IDSPE
 //+  )
 //+ AND ROWNUM = 1 ;
                sql_query += " SELECT '1'              AS TYP      ,"
                     " t2.CDF_NOM       AS INFO_01  ,"
                     " NULL             AS DATE_01  ,"
                     " NULL             AS DATE_02"
                     " FROM   sp_specialite    t1  ,"
                     " cdf_codif        t2"
                     " WHERE  t1.SP_CDF_LI_CODE_FK   = t2.CDF_CODE_PK"
                     " AND    t2.CDF_NUMERO_PK       = '08'"
                     " AND    t1.SP_CODE_SQ_PK        = '"+ QString::number( IDSPE ) +"'"
                     " UNION"
                     " SELECT  SPCPD_NUMORD      AS TYP      ,"
                     " t2.CDF_NOM           AS INFO_01  ,"
                     " NULL                  AS DATE_01  ,"
                     " NULL                 AS DATE_02"
                     " FROM   spcpd_spe_cdt_prescr   t1,"
                     " cdf_codif              t2"
                     " WHERE  t2.CDF_CODE_PK         = t1.SPCPD_CDF_STP_CODE_FK_PK"
                     " AND    t2.CDF_NUMERO_PK       = '14'"
                     " AND    t1.SPCPD_SP_CODE_FK_PK  = '"+ QString::number( IDSPE ) +"'"
                     " UNION"
                     " SELECT '3'                     AS TYP,"
                     " SP_CDT_PRESCR_TEXTE  AS INFO_01,"
                     " NULL                 AS DATE_01,"
                     " NULL                 AS DATE_02"
                     " FROM    sp_specialite"
                     " WHERE   SP_CODE_SQ_PK        = '"+ QString::number( IDSPE ) +"'"
                     " AND     SP_CDT_PRESCR_TEXTE IS NOT NULL"
                     " UNION"
                     " SELECT '4'                     AS TYP     ,"
                     " t2.CDF_NOM           AS INFO_01 ,"
                     " t1.SPAFS_DATE_PK     AS DATE_01 ,"
                     " t1.SPAFS_DATE_REVIS    AS DATE_02"
                     " FROM   spafs_specialite_afssaps t1,"
                     " cdf_codif              t2"
                     " WHERE  t1.SPAFS_RUBCDF_NUMERO_PK IN ('SP','14S','CPH')"
                     " AND    t1.SPAFS_DATE_PK = ( SELECT MAX(SPAFS_DATE_PK)"
                     " FROM   spafs_specialite_afssaps"
                     " WHERE  SPAFS_RUBCDF_NUMERO_PK IN ('SP','14S','CPH')"
                     " AND    SPAFS_SP_CODE_FK_PK     = '"+ QString::number( IDSPE ) +"'"
                     " )"
                     " AND t2.CDF_CODE_PK         = t1.SPAFS_CDF_CODE_DOC_FK_PK"
                     " AND t2.CDF_NUMERO_PK       = '25'"
                     " AND t1.SPAFS_SP_CODE_FK_PK  = '"+ QString::number( IDSPE ) +"'"
                     " AND t1.SPAFS_DATE_REVIS  ="
                     " (SELECT MAX(t1.SPAFS_DATE_REVIS)"
                     " FROM   spafs_specialite_afssaps t1,"
                     " cdf_codif              t2"
                     " WHERE  t1.SPAFS_RUBCDF_NUMERO_PK IN ('SP','14S','CPH')"
                     " AND    t1.SPAFS_DATE_PK = ( SELECT MAX(SPAFS_DATE_PK)"
                     " FROM   spafs_specialite_afssaps"
                     " WHERE  SPAFS_RUBCDF_NUMERO_PK IN ('SP','14S','CPH')"
                     " AND    SPAFS_SP_CODE_FK_PK     = '"+ QString::number( IDSPE ) +"'"
                     " )"
                     " AND t2.CDF_CODE_PK         = t1.SPAFS_CDF_CODE_DOC_FK_PK"
                     " AND t2.CDF_NUMERO_PK       = '25'"
                     " AND t1.SPAFS_SP_CODE_FK_PK  = '"+ QString::number( IDSPE ) +"'"
                     " )"
                     " LIMIT 1";
                    // " AND ROWNUM = 1 ;";
       }
       // CGestIni::Param_UpdateToDisk("/home/ro/sql_test.sql", sql_query);
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_SPE_STATUT()-2- </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
                }
                if (QSqlQuery::next())
                   {  ++m_isNextData;
                        m_TYP     = value(0).toDouble();
                        m_INFO_01 = value(1).toString();
                        m_DATE_01 = value(2).toDate();
                        m_DATE_02 = value(3).toDate();
                        return m_isNextData;
                   }
                m_isNextData = 0;
                return 0;
             }
      //-------------------------- acces aux donnees ----------------------------------------------
      int       MY_COUNT()     {return m_MY_w_count;}
      QString   TYP()          {return m_TYP;}
      QString   INFO_01()      {return m_INFO_01;}
      QDate     DATE_01()      {return m_DATE_01;}
      QDate     DATE_02()      {return m_DATE_02;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);
   private:
      //.......... procedure datas .........................................................
      int      m_isNextData;
      //.......... cursor datas ............................................................
      int      m_MY_w_count;
      QString  m_TYP;
      QString  m_INFO_01;
      QDate    m_DATE_01;
      QDate    m_DATE_02;
 };

 //================================== C_GET_THE_PRE_DSP_CUR   -74- ==================================
 /****************************************************************************
 *   Nom           :  GET_THE_PRE_DSP
 -----------------------------------------------------------------------------
 *   Date creation : 04/09/2008
 -----------------------------------------------------------------------------
 *   Description   :  Cette procédure renvoie les informations concernant le conditionnement
 *                    pour le CIP passé en paramètre.
 *   MAJ           :  25/09/2008
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_PRE_DSP_CUR  C_GET_THE_PRE_DSP ( database(), this );
      while ( C_GET_THE_PRE_DSP.next( CODECIP , VarType  ) )
            { html += tr("<br><b> GET_THE_PRE_DSP : </b>  ") + C_GET_THE_PRE_DSP.MEMBER();
            }
  */
  class C_GET_THE_PRE_DSP_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_PRE_DSP_CUR ---------------------
      C_GET_THE_PRE_DSP_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( QString CODECIP , double VarType )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............
       if ( VarType == 1) {

 //+      -- Lieu de dispensation
 //+      SELECT  '1'                     AS TYP      ,
 //+     t2.CDF_NOM         AS INFO_1   ,
 //+     t1.PREDILI_NUMORD  AS VALEUR_1 ,
 //+     NULL               AS TEXTE
 //+  FROM    PREDILI_LIEU_DISPENSAT   t1,
 //+      CDF_CODIF                t2
 //+  WHERE   t1.PREDILI_CDF_LIEU_CODE_FK_PK  = t2.CDF_CODE_PK
 //+  AND     t2.CDF_NUMERO_PK                = '14'
 //+  AND     t1.PREDILI_PRE_CODE_FK_PK       = CODECIP
 //+  UNION
 //+  --Modalité de dispensation
 //+  SELECT  '2'                  AS TYP      ,
 //+      t2.CDF_NOM         AS INFO_1   ,
 //+      t1.PREDICO_NUMORD  AS VALEUR_1 ,
 //+      NULL               AS TEXTE
 //+  FROM    PREDICO_COMMENT_DISPENSAT    t1 ,
 //+      CDF_CODIF                    t2
 //+  WHERE   t1.PREDICO_CDF_COM_CODE_FK_PK   = t2.CDF_CODE_PK
 //+  AND     t2.CDF_NUMERO_PK                = '29'
 //+  AND     t1.PREDICO_PRE_CODE_FK_PK       = CODECIP
 //+  UNION
 //+  -- Texte associé à la modalité de dispensation:
 //+  SELECT  '3'               AS TYP      ,
 //+      NULL            AS INFO_1   ,
 //+      NULL            AS VALEUR_1 ,
 //+      PREDITX_TEXTE   AS TEXTE
 //+  FROM    PREDITX_TEXTE_DISPENSAT
 //+  WHERE   PREDITX_PRE_CODE_FK_PK  = CODECIP
 //+  UNION
 //+  -- Condition de délivrance
 //+  SELECT  '4'                 AS   TYP      ,
 //+      t2.CDF_NOM        AS   INFO_1   ,
 //+      NULL              AS   VALEUR_1 ,
 //+      NULL              AS   TEXTE
 //+  FROM    SP_SPECIALITE     t1 ,
 //+      CDF_CODIF         t2 ,
 //+      PRE_PRESENTATION  t3
 //+  WHERE   t1.SP_CDF_LI_CODE_FK            = t2.CDF_CODE_PK
 //+  AND     t2.CDF_NUMERO_PK                = '08'
 //+  AND     t3.PRE_SP_CODE_FK               = t1.SP_CODE_SQ_PK
 //+  AND     t3.PRE_CODE_PK                  = CODECIP ;
                sql_query += " SELECT  '1'                     AS TYP      ,"
                     " t2.CDF_NOM         AS INFO_1   ,"
                     " t1.PREDILI_NUMORD  AS VALEUR_1 ,"
                     " NULL               AS TEXTE"
                     " FROM    predili_lieu_dispensat   t1,"
                     " cdf_codif                t2"
                     " WHERE   t1.PREDILI_CDF_LIEU_CODE_FK_PK  = t2.CDF_CODE_PK"
                     " AND     t2.CDF_NUMERO_PK                = '14'"
                     " AND     t1.PREDILI_PRE_CODE_FK_PK        = '"+CODECIP+"'"
                     " UNION"
                     " "  //--MODALITÉ de dispensation"
                     " SELECT  '2'                  AS TYP      ,"
                     " t2.CDF_NOM         AS INFO_1   ,"
                     " t1.PREDICO_NUMORD  AS VALEUR_1 ,"
                     " NULL               AS TEXTE"
                     " FROM    predico_comment_dispensat    t1 ,"
                     " cdf_codif                    t2"
                     " WHERE   t1.PREDICO_CDF_COM_CODE_FK_PK   = t2.CDF_CODE_PK"
                     " AND     t2.CDF_NUMERO_PK                = '29'"
                     " AND     t1.PREDICO_PRE_CODE_FK_PK        = '"+CODECIP+"'"
                     " UNION"
                     " "  //-- Texte associé à la modalité de dispensation:"
                     " SELECT  '3'               AS TYP      ,"
                     " NULL            AS INFO_1   ,"
                     " NULL            AS VALEUR_1 ,"
                     " PREDITX_TEXTE   AS TEXTE"
                     " FROM    preditx_texte_dispensat"
                     " WHERE   PREDITX_PRE_CODE_FK_PK   = '"+CODECIP+"'"
                     " UNION"
                     " "  //-- Condition de délivrance"
                     " SELECT  '4'                 AS   TYP      ,"
                     " t2.CDF_NOM        AS   INFO_1   ,"
                     " NULL              AS   VALEUR_1 ,"
                     " NULL              AS   TEXTE"
                     " FROM    sp_specialite     t1 ,"
                     " cdf_codif         t2 ,"
                     " pre_presentation  t3"
                     " WHERE   t1.SP_CDF_LI_CODE_FK            = t2.CDF_CODE_PK"
                     " AND     t2.CDF_NUMERO_PK                = '08'"
                     " AND     t3.PRE_SP_CODE_FK               = t1.SP_CODE_SQ_PK"
                     " AND     t3.PRE_CODE_PK                   = '"+CODECIP+"' ;";

       } else if ( VarType == 2) {

 //+   -- Lieu de dispensation
 //+       SELECT  '1'                     AS TYP      ,
 //+      t2.CDF_NOM         AS INFO_1   ,
 //+      t1.PREDILI_NUMORD  AS VALEUR_1 ,
 //+      NULL               AS TEXTE
 //+   FROM PREDILI_LIEU_DISPENSAT  t1,
 //+       CDF_CODIF               t2,
 //+     PRE_PRESENTATION   t3
 //+   WHERE t1.PREDILI_PRE_CODE_FK_PK   = t3.PRE_CODE_PK
 //+   AND t1.PREDILI_CDF_LIEU_CODE_FK_PK  = t2.CDF_CODE_PK
 //+   AND t2.CDF_NUMERO_PK                = '14'
 //+   AND t3.PRE_EAN_REF      = CODECIP
 //+   UNION
 //+   --Modalité de dispensation
 //+   SELECT  '2'                  AS TYP      ,
 //+       t2.CDF_NOM         AS INFO_1   ,
 //+       t1.PREDICO_NUMORD  AS VALEUR_1 ,
 //+       NULL               AS TEXTE
 //+   FROM PREDICO_COMMENT_DISPENSAT t1 ,
 //+     CDF_CODIF                 t2,
 //+     PRE_PRESENTATION     t3
 //+   WHERE t1.PREDICO_PRE_CODE_FK_PK   = t3.PRE_CODE_PK
 //+   AND t1.PREDICO_CDF_COM_CODE_FK_PK = t2.CDF_CODE_PK
 //+   AND t2.CDF_NUMERO_PK              = '29'
 //+   AND t3.PRE_EAN_REF              = CODECIP
 //+   UNION
 //+   -- Texte associé à la modalité de dispensation:
 //+   SELECT  '3'               AS TYP      ,
 //+       NULL            AS INFO_1   ,
 //+       NULL            AS VALEUR_1 ,
 //+       PREDITX_TEXTE   AS TEXTE
 //+   FROM PREDITX_TEXTE_DISPENSAT t1,
 //+     PRE_PRESENTATION   t2
 //+   WHERE PREDITX_PRE_CODE_FK_PK  = PRE_CODE_PK
 //+   AND PRE_EAN_REF = CODECIP
 //+   UNION
 //+   -- Condition de délivrance
 //+   SELECT  '4'                 AS   TYP      ,
 //+       t2.CDF_NOM        AS   INFO_1   ,
 //+       NULL              AS   VALEUR_1 ,
 //+       NULL              AS   TEXTE
 //+   FROM SP_SPECIALITE     t1 ,
 //+     CDF_CODIF         t2 ,
 //+     PRE_PRESENTATION  t3
 //+   WHERE t1.SP_CDF_LI_CODE_FK          = t2.CDF_CODE_PK
 //+   AND t2.CDF_NUMERO_PK                = '08'
 //+   AND t3.PRE_SP_CODE_FK               = t1.SP_CODE_SQ_PK
 //+   AND t3.PRE_EAN_REF                  = CODECIP ;
                sql_query += " SELECT  '1'                     AS TYP      ,"
                     " t2.CDF_NOM         AS INFO_1   ,"
                     " t1.PREDILI_NUMORD  AS VALEUR_1 ,"
                     " NULL               AS TEXTE"
                     " FROM predili_lieu_dispensat  t1,"
                     " cdf_codif               t2,"
                     " pre_presentation   t3"
                     " WHERE t1.PREDILI_PRE_CODE_FK_PK   = t3.PRE_CODE_PK"
                     " AND t1.PREDILI_CDF_LIEU_CODE_FK_PK  = t2.CDF_CODE_PK"
                     " AND t2.CDF_NUMERO_PK                = '14'"
                     " AND t3.PRE_EAN_REF       = '"+CODECIP+"'"
                     " UNION"
                     " "  //--MODALITÉ de dispensation"
                     " SELECT  '2'                  AS TYP      ,"
                     " t2.CDF_NOM         AS INFO_1   ,"
                     " t1.PREDICO_NUMORD  AS VALEUR_1 ,"
                     " NULL               AS TEXTE"
                     " FROM predico_comment_dispensat t1 ,"
                     " cdf_codif                 t2,"
                     " pre_presentation     t3"
                     " WHERE t1.PREDICO_PRE_CODE_FK_PK   = t3.PRE_CODE_PK"
                     " AND t1.PREDICO_CDF_COM_CODE_FK_PK = t2.CDF_CODE_PK"
                     " AND t2.CDF_NUMERO_PK              = '29'"
                     " AND t3.PRE_EAN_REF               = '"+CODECIP+"'"
                     " UNION"
                     " "  //-- Texte associé à la modalité de dispensation:"
                     " SELECT  '3'               AS TYP      ,"
                     " NULL            AS INFO_1   ,"
                     " NULL            AS VALEUR_1 ,"
                     " PREDITX_TEXTE   AS TEXTE"
                     " FROM preditx_texte_dispensat t1,"
                     " pre_presentation   t2"
                     " WHERE PREDITX_PRE_CODE_FK_PK  = PRE_CODE_PK"
                     " AND PRE_EAN_REF  = '"+CODECIP+"'"
                     " UNION"
                     " "  //-- Condition de délivrance"
                     " SELECT  '4'                 AS   TYP      ,"
                     " t2.CDF_NOM        AS   INFO_1   ,"
                     " NULL              AS   VALEUR_1 ,"
                     " NULL              AS   TEXTE"
                     " FROM sp_specialite     t1 ,"
                     " cdf_codif         t2 ,"
                     " pre_presentation  t3"
                     " WHERE t1.SP_CDF_LI_CODE_FK          = t2.CDF_CODE_PK"
                     " AND t2.CDF_NUMERO_PK                = '08'"
                     " AND t3.PRE_SP_CODE_FK               = t1.SP_CODE_SQ_PK"
                     " AND t3.PRE_EAN_REF                  = '"+CODECIP+"' ;";

       }
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_PRE_DSP() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_TYP      = value(0).toDouble();
                m_INFO_1   = value(1).toString();
                m_VALEUR_1 = value(2).toDouble();
                m_TEXTE    = value(3).toString();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      double  TYP()      {return m_TYP;}
      QString INFO_1()   {return m_INFO_1;}
      double  VALEUR_1() {return m_VALEUR_1;}
      QString TEXTE()    {return m_TEXTE;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      double  m_TYP;
      QString m_INFO_1;
      double  m_VALEUR_1;
      QString m_TEXTE;
 };

 //================================== C_GET_THE_PRE_CSV_CUR   -75- ==================================
 /****************************************************************************
 *   Nom           :  GET_THE_PRE_CSV
 -----------------------------------------------------------------------------
 *   Date creation :  04/09/2008
 -----------------------------------------------------------------------------
 *   Description   :  Cette procédure renvoie les informations concernant
 *                    les durées 1 de conservation pour le CIP
 *                    passé en paramètre.
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_PRE_CSV_CUR  C_GET_THE_PRE_CSV ( database(), this );
      while ( C_GET_THE_PRE_CSV.next( CODECIP , VarType  ) )
            { html += tr("<br><b> GET_THE_PRE_CSV : </b>  ") + C_GET_THE_PRE_CSV.MEMBER();
            }
  */
  class C_GET_THE_PRE_CSV_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_PRE_CSV_CUR ---------------------
      C_GET_THE_PRE_CSV_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( QString CODECIP , double VarType )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............
       if ( VarType == 1) {          // --Code CIP7

 //+ SELECT '1.'||t1.PREPER_NUM_CODE_PK   AS   TYPE_PRE_CSV     ,
 //+    t2.CDF_NOM                  AS  INFO_1   ,
 //+    t1.PREPER_DUREE             AS VALEUR_1 ,
 //+    NULL          AS TEXTE    ,
 //+    NULL       AS VALEUR_2 ,
 //+    NULL       AS DATE_1
 //+ FROM   PREPER_PRESENTATION_PERIO_CSV  t1 ,
 //+        CDF_CODIF                      t2
 //+ WHERE  t1.PREPER_CDF_UT_CODE_FK    = t2.CDF_CODE_PK
 //+ AND    t2.CDF_NUMERO_PK            = 'PU'
 //+ AND    t1.PREPER_PRE_CODE_FK_PK    = CODECIP
 //+ UNION
 //+ SELECT '1.'||t1.PERCS_NUM_CODE_PK||'.'||t1.PERCS_NUMORD   AS TYPE_PRE_CSV     ,
 //+    t2.CDF_NOM                                       AS   INFO_1   ,
 //+    NULL                                             AS   VALEUR_1 ,
 //+    NULL                AS TEXTE    ,
 //+    NULL             AS VALEUR_2 ,
 //+    NULL             AS DATE_1
 //+ FROM   PERCS_PERIODE_COND_CSV         t1 ,
 //+        CDF_CODIF                      t2
 //+ WHERE  t1.PERCS_CDF_CSV_CODE_FK_PK  = t2.CDF_CODE_PK
 //+ AND    t2.CDF_NUMERO_PK             = '03'
 //+ AND    t1.PERCS_PRE_CODE_FK_PK      = CODECIP
 //+ UNION
 //+ SELECT '2'    AS TYPE_PRE_CSV     ,
 //+    NULL             AS INFO_1   ,
 //+    NULL             AS VALEUR_1 ,
 //+    PRECSVTX_TEXTE   AS TEXTE    ,
 //+    NULL             AS VALEUR_2 ,
 //+    NULL             AS DATE_1
 //+ FROM   PRECSVTX_TEXTE_CONSERV
 //+ WHERE  PRECSVTX_PRE_CODE_FK_PK = CODECIP
 //+ UNION
 //+   SELECT '3'    AS TYPE_PRE_CSV     ,
 //+    t2.CDF_NOM        AS INFO_1   ,
 //+    NULL              AS VALEUR_1 ,
 //+    NULL              AS TEXTE    ,
 //+    NULL              AS VALEUR_2 ,
 //+    t1.SPAFS_DATE_PK  AS DATE_1
 //+ FROM  SPAFS_SPECIALITE_AFSSAPS t1,
 //+    CDF_CODIF              t2,
 //+    PRE_PRESENTATION         t3
 //+ WHERE t1.SPAFS_RUBCDF_NUMERO_PK IN ('03','SP','P')
 //+ AND t1.SPAFS_DATE_PK = ( SELECT  MAX(SPAFS_DATE_PK)
 //+          FROM   SPAFS_SPECIALITE_AFSSAPS ,
 //+              PRE_PRESENTATION
 //+          WHERE   SPAFS_RUBCDF_NUMERO_PK IN ('03','SP','P')
 //+          AND     SPAFS_SP_CODE_FK_PK    = PRE_SP_CODE_FK
 //+          AND     PRE_CODE_PK            = CODECIP
 //+          )
 //+ AND t2.CDF_CODE_PK         = t1.SPAFS_CDF_CODE_DOC_FK_PK
 //+ AND t2.CDF_NUMERO_PK       = '25'
 //+ AND t1.SPAFS_SP_CODE_FK_PK = t3.PRE_SP_CODE_FK
 //+ AND t3.PRE_CODE_PK         = CODECIP ;

                sql_query +=
                     " SELECT CONCAT('1',t1.PREPER_NUM_CODE_PK)   AS   TYPE_PRE_CSV     ,"
                     " t2.CDF_NOM                                 AS  INFO_1   ,"
                     " t1.PREPER_DUREE                            AS VALEUR_1 ,"
                     " NULL                                       AS TEXTE    ,"
                     " NULL                                       AS VALEUR_2 ,"
                     " NULL                                       AS DATE_1"
                     " FROM   preper_presentation_perio_csv  t1 ,"
                     " cdf_codif                             t2"
                     " WHERE  t1.PREPER_CDF_UT_CODE_FK    = t2.CDF_CODE_PK"
                     " AND    t2.CDF_NUMERO_PK            = 'PU'"
                     " AND    t1.PREPER_PRE_CODE_FK_PK    = '"+CODECIP+"'"
                     " UNION"
                     " SELECT  CONCAT('2', t1.PERCS_NUM_CODE_PK, t1.PERCS_NUMORD)   AS TYPE_PRE_CSV     ,"
                     " t2.CDF_NOM                                                   AS INFO_1   ,"
                     " NULL                                                         AS VALEUR_1 ,"
                     " NULL                                                         AS TEXTE    ,"
                     " NULL                                                         AS VALEUR_2 ,"
                     " NULL                                                         AS DATE_1"
                     " FROM   percs_periode_cond_csv         t1 ,"
                     " cdf_codif                             t2"
                     " WHERE  t1.PERCS_CDF_CSV_CODE_FK_PK  = t2.CDF_CODE_PK"
                     " AND    t2.CDF_NUMERO_PK             = '03'"
                     " AND    t1.PERCS_PRE_CODE_FK_PK      = '"+CODECIP+"'"
                     " UNION"
                     " SELECT '3'       AS TYPE_PRE_CSV     ,"
                     " NULL             AS INFO_1   ,"
                     " NULL             AS VALEUR_1 ,"
                     " PRECSVTX_TEXTE   AS TEXTE    ,"
                     " NULL             AS VALEUR_2 ,"
                     " NULL             AS DATE_1"
                     " FROM   precsvtx_texte_conserv"
                     " WHERE  PRECSVTX_PRE_CODE_FK_PK  = '"+CODECIP+"'"
                     " UNION"
                     " SELECT '4'        AS TYPE_PRE_CSV     ,"
                     " t2.CDF_NOM        AS INFO_1   ,"
                     " NULL              AS VALEUR_1 ,"
                     " NULL              AS TEXTE    ,"
                     " NULL              AS VALEUR_2 ,"
                     " t1.SPAFS_DATE_PK  AS DATE_1"
                     " FROM  spafs_specialite_afssaps t1,"
                     " cdf_codif                      t2,"
                     " pre_presentation               t3"
                     " WHERE t1.SPAFS_RUBCDF_NUMERO_PK IN ('03','SP','P')"
                     " AND   t1.SPAFS_DATE_PK = ( SELECT  MAX(SPAFS_DATE_PK)"
                     "                            FROM   spafs_specialite_afssaps ,"
                     "                                   pre_presentation"
                     "                            WHERE   SPAFS_RUBCDF_NUMERO_PK IN ('03','SP','P')"
                     "                            AND     SPAFS_SP_CODE_FK_PK    = PRE_SP_CODE_FK"
                     "                            AND     PRE_CODE_PK             = '"+CODECIP+"'"
                     "                         )"
                     " AND t2.CDF_CODE_PK          = t1.SPAFS_CDF_CODE_DOC_FK_PK"
                     " AND t2.CDF_NUMERO_PK        = '25'"
                     " AND t1.SPAFS_SP_CODE_FK_PK  = t3.PRE_SP_CODE_FK"
                     " AND t3.PRE_CODE_PK          = '"+CODECIP+"' ;";

       } else if ( VarType == 2) {    // --Code CIP13

 //+      SELECT '1.'||t1.PREPER_NUM_CODE_PK   AS   TYPE_PRE_CSV     ,
 //+    t2.CDF_NOM      AS  INFO_1   ,
 //+    t1.PREPER_DUREE AS VALEUR_1 ,
 //+    NULL       AS TEXTE    ,
 //+    NULL    AS VALEUR_2 ,
 //+    NULL    AS DATE_1
 //+ FROM   PREPER_PRESENTATION_PERIO_CSV  t1 ,
 //+        CDF_CODIF                      t2,
 //+     PRE_PRESENTATION      t3
 //+ WHERE  t1.PREPER_CDF_UT_CODE_FK    = t2.CDF_CODE_PK
 //+ AND    t2.CDF_NUMERO_PK            = 'PU'
 //+ AND    t1.PREPER_PRE_CODE_FK_PK    = t3.PRE_CODE_PK
 //+ AND    t3.PRE_EAN_REF       = CODECIP
 //+ UNION
 //+ SELECT '1.'||t1.PERCS_NUM_CODE_PK||'.'||t1.PERCS_NUMORD   AS TYPE_PRE_CSV     ,
 //+    t2.CDF_NOM  AS   INFO_1   ,
 //+    NULL        AS   VALEUR_1 ,
 //+    NULL      AS TEXTE    ,
 //+    NULL   AS VALEUR_2 ,
 //+    NULL   AS DATE_1
 //+ FROM   PERCS_PERIODE_COND_CSV         t1 ,
 //+        CDF_CODIF                      t2,
 //+     PRE_PRESENTATION      t3
 //+ WHERE  t1.PERCS_CDF_CSV_CODE_FK_PK  = t2.CDF_CODE_PK
 //+ AND    t2.CDF_NUMERO_PK             = '03'
 //+ AND    t1.PERCS_PRE_CODE_FK_PK      = t3.PRE_CODE_PK
 //+ AND    t3.PRE_EAN_REF        = CODECIP
 //+ UNION
 //+ SELECT '2'    AS TYPE_PRE_CSV     ,
 //+    NULL             AS INFO_1   ,
 //+    NULL             AS VALEUR_1 ,
 //+    PRECSVTX_TEXTE   AS TEXTE    ,
 //+    NULL             AS VALEUR_2 ,
 //+    NULL             AS DATE_1
 //+ FROM   PRECSVTX_TEXTE_CONSERV,
 //+     PRE_PRESENTATION
 //+ WHERE  PRECSVTX_PRE_CODE_FK_PK = PRE_CODE_PK
 //+ AND    PRE_EAN_REF       = CODECIP
 //+ UNION
 //+    SELECT '3'    AS TYPE_PRE_CSV     ,
 //+    t2.CDF_NOM        AS INFO_1   ,
 //+    NULL              AS VALEUR_1 ,
 //+    NULL              AS TEXTE    ,
 //+    NULL              AS VALEUR_2 ,
 //+    t1.SPAFS_DATE_PK  AS DATE_1
 //+  FROM SPAFS_SPECIALITE_AFSSAPS t1,
 //+   CDF_CODIF              t2,
 //+   PRE_PRESENTATION         t3
 //+  WHERE t1.SPAFS_RUBCDF_NUMERO_PK IN ('03','SP','P')
 //+  AND t1.SPAFS_DATE_PK = (SELECT  MAX(SPAFS_DATE_PK)
 //+       FROM SPAFS_SPECIALITE_AFSSAPS ,
 //+         SP_SPECIALITE,
 //+         PRE_PRESENTATION
 //+       WHERE SPAFS_RUBCDF_NUMERO_PK IN ('03','SP','P')
 //+       AND SPAFS_SP_CODE_FK_PK = SP_CODE_SQ_PK
 //+       AND PRE_SP_CODE_FK   = SP_CODE_SQ_PK
 //+       AND PRE_EAN_REF         = CODECIP)
 //+  AND t2.CDF_CODE_PK         = t1.SPAFS_CDF_CODE_DOC_FK_PK
 //+  AND t2.CDF_NUMERO_PK       = '25'
 //+  AND t1.SPAFS_SP_CODE_FK_PK = t3.PRE_SP_CODE_FK
 //+  AND t3.PRE_EAN_REF         = CODECIP ;
                sql_query += " SELECT '1.'T1.PREPER_NUM_CODE_PK   AS   TYPE_PRE_CSV     ,"
                     " t2.CDF_NOM      AS  INFO_1   ,"
                     " t1.PREPER_DUREE AS VALEUR_1 ,"
                     " NULL       AS TEXTE    ,"
                     " NULL    AS VALEUR_2 ,"
                     " NULL    AS DATE_1"
                     " FROM   preper_presentation_perio_csv  t1 ,"
                     " cdf_codif                      t2,"
                     " pre_presentation      t3"
                     " WHERE  t1.PREPER_CDF_UT_CODE_FK    = t2.CDF_CODE_PK"
                     " AND    t2.CDF_NUMERO_PK            = 'PU'"
                     " AND    t1.PREPER_PRE_CODE_FK_PK    = t3.PRE_CODE_PK"
                     " AND    t3.PRE_EAN_REF        = '"+CODECIP+"'"
                     " UNION"
                     " SELECT '1.'t1.PERCS_NUM_CODE_PK.'t1.PERCS_NUMORD   AS TYPE_PRE_CSV     ,"
                     " t2.CDF_NOM  AS   INFO_1   ,"
                     " NULL        AS   VALEUR_1 ,"
                     " NULL      AS TEXTE    ,"
                     " NULL   AS VALEUR_2 ,"
                     " NULL   AS DATE_1"
                     " FROM   percs_periode_cond_csv         t1 ,"
                     " cdf_codif                      t2,"
                     " pre_presentation      t3"
                     " WHERE  t1.PERCS_CDF_CSV_CODE_FK_PK  = t2.CDF_CODE_PK"
                     " AND    t2.CDF_NUMERO_PK             = '03'"
                     " AND    t1.PERCS_PRE_CODE_FK_PK      = t3.PRE_CODE_PK"
                     " AND    t3.PRE_EAN_REF         = '"+CODECIP+"'"
                     " UNION"
                     " SELECT '2'    AS TYPE_PRE_CSV     ,"
                     " NULL             AS INFO_1   ,"
                     " NULL             AS VALEUR_1 ,"
                     " PRECSVTX_TEXTE   AS TEXTE    ,"
                     " NULL             AS VALEUR_2 ,"
                     " NULL             AS DATE_1"
                     " FROM   precsvtx_texte_conserv,"
                     " pre_presentation"
                     " WHERE  PRECSVTX_PRE_CODE_FK_PK = PRE_CODE_PK"
                     " AND    PRE_EAN_REF        = '"+CODECIP+"'"
                     " UNION"
                     " SELECT '3'    AS TYPE_PRE_CSV     ,"
                     " t2.CDF_NOM        AS INFO_1   ,"
                     " NULL              AS VALEUR_1 ,"
                     " NULL              AS TEXTE    ,"
                     " NULL              AS VALEUR_2 ,"
                     " t1.SPAFS_DATE_PK  AS DATE_1"
                     " FROM spafs_specialite_afssaps t1,"
                     " cdf_codif              t2,"
                     " pre_presentation         t3"
                     " WHERE t1.SPAFS_RUBCDF_NUMERO_PK IN ('03','SP','P')"
                     " AND t1.SPAFS_DATE_PK = (SELECT  MAX(SPAFS_DATE_PK)"
                     " FROM spafs_specialite_afssaps ,"
                     " sp_specialite,"
                     " pre_presentation"
                     " WHERE SPAFS_RUBCDF_NUMERO_PK IN ('03','SP','P')"
                     " AND SPAFS_SP_CODE_FK_PK = SP_CODE_SQ_PK"
                     " AND PRE_SP_CODE_FK   = SP_CODE_SQ_PK"
                     " AND PRE_EAN_REF          = '"+CODECIP+"')"
                     " AND t2.CDF_CODE_PK         = t1.SPAFS_CDF_CODE_DOC_FK_PK"
                     " AND t2.CDF_NUMERO_PK       = '25'"
                     " AND t1.SPAFS_SP_CODE_FK_PK = t3.PRE_SP_CODE_FK"
                     " AND t3.PRE_EAN_REF          = '"+CODECIP+"' ;";

       }
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_PRE_CSV() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_TYPE_PRE_CSV = value(0).toString();
                m_INFO_1       = value(1).toString();
                m_VALEUR_1     = value(2).toDouble();
                m_TEXTE        = value(3).toString();
                m_VALEUR_2     = value(4).toDouble();
                m_DATE_1       = value(5).toDate();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      QString TYPE_PRE_CSV()                      {return m_TYPE_PRE_CSV;}
      QString INFO_1()                            {return m_INFO_1;}
      double  VALEUR_1()                          {return m_VALEUR_1;}
      QString TEXTE()                             {return m_TEXTE;}
      double  VALEUR_2()                          {return m_VALEUR_2;}
      QDate   DATE_1()                            {return m_DATE_1;}
      QString DATE_1(const QString &format)       {return m_DATE_1.toString(format);}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      QString m_TYPE_PRE_CSV;
      QString m_INFO_1;
      double  m_VALEUR_1;
      QString m_TEXTE;
      double  m_VALEUR_2;
      QDate   m_DATE_1;
 };

 //================================== C_GET_THE_PRE_RBT_CUR   -76- ==================================
 /****************************************************************************
 *   Nom           :  GET_THE_PRE_RBT
 -----------------------------------------------------------------------------
 *   Date creation : 05/09/2008
 -----------------------------------------------------------------------------
 *   Description   :  Cette procédure renvoie les informations concernant
 *                    les remboursements pour le CIP passé en paramètre.
 *   MAJ           :  06/10/2008
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_PRE_RBT_CUR  C_GET_THE_PRE_RBT ( database(), this );
      while ( C_GET_THE_PRE_RBT.next( CODECIP , VarType  ) )
            { html += tr("<br><b> GET_THE_PRE_RBT : </b>  ") + C_GET_THE_PRE_RBT.MEMBER();
            }
  */
  class C_GET_THE_PRE_RBT_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_PRE_RBT_CUR ---------------------
      C_GET_THE_PRE_RBT_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( QString CODECIP , double VarType )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............
       if ( VarType == 1) {

 //+  SELECT '1'                       TYPE_PRE_RBT     ,
 //+     t2.CDF_NOM                INFO_1   ,
 //+     NULL                      VALEUR_1 ,
 //+     t1.PRETSS_DATE_APPLI_PK   DATE_1   ,
 //+     t1.PRETSS_DATE_APPLIQUEE  DATE_2   ,
 //+     t1.PRETSS_TEXTE           TEXTE
 //+  FROM   PRETSS_PRESENTATION_TAUX  t1,
 //+     CDF_CODIF                 t2
 //+  WHERE  t1.PRETSS_CDF_TSS_CODE_FK_PK = t2.CDF_CODE_PK
 //+  AND    t2.CDF_NUMERO_PK             = '17'
 //+  AND    t1.PRETSS_PRE_CODE_FK_PK     = CODECIP
 //+  UNION
 //+  SELECT '1'               TYPE_PRE_RBT     ,
 //+       'Non concerné'            INFO_1   ,
 //+     NULL                      VALEUR_1 ,
 //+     NULL                      DATE_1   ,
 //+     NULL                      DATE_2   ,
 //+     NULL                      TEXTE
 //+  FROM   PRE_PRESENTATION          t1
 //+  WHERE  NOT EXISTS ( SELECT 1 FROM PRETSS_PRESENTATION_TAUX t2 WHERE t2.PRETSS_PRE_CODE_FK_PK = CODECIP)
 //+  AND    t1.PRE_CODE_PK  = CODECIP
 //+  UNION
 //+  SELECT '1.1'                      TYPE_PRE_RBT     ,
 //+     t2.CDF_NOM                 INFO_1   ,
 //+     NULL                       VALEUR_1 ,
 //+     t1.PRETSSH_DATE_APPLI_PK   DATE_1   ,
 //+     t1.PRETSSH_DATE_APPLIQUEE  DATE_2   ,
 //+     t1.PRETSSH_TEXTE           TEXTE
 //+  FROM   PRETSSH_PRE_TAUX_HOP      t1,
 //+     CDF_CODIF                 t2
 //+  WHERE  t1.PRETSSH_CDF_TSS_CODE_FK_PK = t2.CDF_CODE_PK
 //+  AND    t2.CDF_NUMERO_PK              = '17'
 //+  AND    t1.PRETSSH_PRE_CODE_FK_PK     = CODECIP
 //+  UNION
 //+      SELECT '1.1'                     TYPE_PRE_RBT     ,
 //+       'Non concerné'            INFO_1   ,
 //+     NULL                      VALEUR_1 ,
 //+     NULL                      DATE_1   ,
 //+     NULL                      DATE_2   ,
 //+     NULL                      TEXTE
 //+  FROM   PRE_PRESENTATION          t1
 //+  WHERE  NOT EXISTS ( SELECT 1 FROM PRETSSH_PRE_TAUX_HOP t2 WHERE t2.PRETSSH_PRE_CODE_FK_PK = CODECIP )
 //+  AND    t1.PRE_CODE_PK  = CODECIP
 //+  UNION
 //+  SELECT '2  '               TYPE_PRE_RBT     ,
 //+     NULL                       INFO_1   ,
 //+     t1.FORPRE_FORFAIT          VALEUR_1 ,
 //+     t1.FORPRE_DATE_PK          DATE_1   ,
 //+     NULL                       DATE_2   ,
 //+     NULL                       TEXTE
 //+  FROM   FORPRE_FORFAIT_PRE         t1
 //+  WHERE  t1.FORPRE_PRE_CODE_FK_PK =  CODECIP
 //+      UNION
 //+    SELECT '3'                        TYPE_PRE_RBT     ,
 //+     t2.CDF_NOM                 INFO_1   ,
 //+       t1.PRESTR_NUMORD           VALEUR_1 ,
 //+       NULL                       DATE_1   ,
 //+       NULL                       DATE_2   ,
 //+       NULL                       TEXTE
 //+  FROM   PRESTR_STATUT_REMBOURST      t1,
 //+       CDF_CODIF                 t2
 //+  WHERE  t1.PRESTR_CDF_STR_CODE_FK_PK  = t2.CDF_CODE_PK
 //+  AND    t2.CDF_NUMERO_PK              = '14'
 //+  AND    t1.PRESTR_PRE_CODE_FK_PK      = CODECIP
 //+  UNION
 //+  SELECT '4'                        TYPE_PRE_RBT     ,
 //+     NULL                       INFO_1   ,
 //+     NULL                       VALEUR_1 ,
 //+     NULL                       DATE_1   ,
 //+     NULL                       DATE_2   ,
 //+     t1.PRESTRTX_TEXTE          TEXTE
 //+  FROM   PRESTRTX_TEXTE_STAT_REMBOURST      t1
 //+  WHERE  t1.PRESTRTX_PRE_CODE_FK_PK   =  CODECIP
 //+  ORDER BY  1,3;
                sql_query += " SELECT '1'                       TYPE_PRE_RBT     ,"
                     " t2.CDF_NOM                INFO_1   ,"
                     " NULL                      VALEUR_1 ,"
                     " t1.PRETSS_DATE_APPLI_PK   DATE_1   ,"
                     " t1.PRETSS_DATE_APPLIQUEE  DATE_2   ,"
                     " t1.PRETSS_TEXTE           TEXTE"
                     " FROM   pretss_presentation_taux  t1,"
                     " cdf_codif                 t2"
                     " WHERE  t1.PRETSS_CDF_TSS_CODE_FK_PK = t2.CDF_CODE_PK"
                     " AND    t2.CDF_NUMERO_PK             = '17'"
                     " AND    t1.PRETSS_PRE_CODE_FK_PK      = '"+CODECIP+"'"
                     " UNION"
                     " SELECT '1'               TYPE_PRE_RBT     ,"
                     " 'NON concerné'            INFO_1   ,"
                     " NULL                      VALEUR_1 ,"
                     " NULL                      DATE_1   ,"
                     " NULL                      DATE_2   ,"
                     " NULL                      TEXTE"
                     " FROM   pre_presentation          t1"
                     " WHERE  NOT EXISTS ( SELECT 1 FROM pretss_presentation_taux t2 WHERE t2.PRETSS_PRE_CODE_FK_PK  = '"+CODECIP+"')"
                     " AND    t1.PRE_CODE_PK   = '"+CODECIP+"'"
                     " UNION"
                     " SELECT '1.1'                      TYPE_PRE_RBT     ,"
                     " t2.CDF_NOM                 INFO_1   ,"
                     " NULL                       VALEUR_1 ,"
                     " t1.PRETSSH_DATE_APPLI_PK   DATE_1   ,"
                     " t1.PRETSSH_DATE_APPLIQUEE  DATE_2   ,"
                     " t1.PRETSSH_TEXTE           TEXTE"
                     " FROM   pretssh_pre_taux_hop      t1,"
                     " cdf_codif                 t2"
                     " WHERE  t1.PRETSSH_CDF_TSS_CODE_FK_PK = t2.CDF_CODE_PK"
                     " AND    t2.CDF_NUMERO_PK              = '17'"
                     " AND    t1.PRETSSH_PRE_CODE_FK_PK      = '"+CODECIP+"'"
                     " UNION"
                     " SELECT '1.1'                     TYPE_PRE_RBT     ,"
                     " 'NON concerné'            INFO_1   ,"
                     " NULL                      VALEUR_1 ,"
                     " NULL                      DATE_1   ,"
                     " NULL                      DATE_2   ,"
                     " NULL                      TEXTE"
                     " FROM   pre_presentation          t1"
                     " WHERE  NOT EXISTS ( SELECT 1 FROM pretssh_pre_taux_hop t2 WHERE t2.PRETSSH_PRE_CODE_FK_PK  = '"+CODECIP+"' )"
                     " AND    t1.PRE_CODE_PK   = '"+CODECIP+"'"
                     " UNION"
                     " SELECT '2  '               TYPE_PRE_RBT     ,"
                     " NULL                       INFO_1   ,"
                     " t1.FORPRE_FORFAIT          VALEUR_1 ,"
                     " t1.FORPRE_DATE_PK          DATE_1   ,"
                     " NULL                       DATE_2   ,"
                     " NULL                       TEXTE"
                     " FROM   forpre_forfait_pre         t1"
                     " WHERE  t1.FORPRE_PRE_CODE_FK_PK  = '"+CODECIP+"'"
                     " UNION"
                     " SELECT '3'                        TYPE_PRE_RBT     ,"
                     " t2.CDF_NOM                 INFO_1   ,"
                     " t1.PRESTR_NUMORD           VALEUR_1 ,"
                     " NULL                       DATE_1   ,"
                     " NULL                       DATE_2   ,"
                     " NULL                       TEXTE"
                     " FROM   prestr_statut_rembourst      t1,"
                     " cdf_codif                 t2"
                     " WHERE  t1.PRESTR_CDF_STR_CODE_FK_PK  = t2.CDF_CODE_PK"
                     " AND    t2.CDF_NUMERO_PK              = '14'"
                     " AND    t1.PRESTR_PRE_CODE_FK_PK       = '"+CODECIP+"'"
                     " UNION"
                     " SELECT '4'                        TYPE_PRE_RBT     ,"
                     " NULL                       INFO_1   ,"
                     " NULL                       VALEUR_1 ,"
                     " NULL                       DATE_1   ,"
                     " NULL                       DATE_2   ,"
                     " t1.PRESTRTX_TEXTE          TEXTE"
                     " FROM   prestrtx_texte_stat_rembourst      t1"
                     " WHERE  t1.PRESTRTX_PRE_CODE_FK_PK    = '"+CODECIP+"'"
                     " ORDER BY  1,3;";

       } else if ( VarType == 2) {

 //+    SELECT '1'                        TYPE_PRE_RBT     ,
 //+     t2.CDF_NOM                INFO_1   ,
 //+    NULL                   VALEUR_1 ,
 //+    t1.PRETSS_DATE_APPLI_PK   DATE_1   ,
 //+    t1.PRETSS_DATE_APPLIQUEE  DATE_2   ,
 //+    t1.PRETSS_TEXTE           TEXTE
 //+  FROM PRETSS_PRESENTATION_TAUX  t1,
 //+    CDF_CODIF                 t2,
 //+    PRE_PRESENTATION     t3
 //+  WHERE  t1.PRETSS_CDF_TSS_CODE_FK_PK = t2.CDF_CODE_PK
 //+  AND t2.CDF_NUMERO_PK              = '17'
 //+  AND t1.PRETSS_PRE_CODE_FK_PK      = t3.PRE_CODE_PK
 //+  AND t3.PRE_EAN_REF      = CODECIP
 //+  UNION
 //+  SELECT '1'              TYPE_PRE_RBT     ,
 //+       'Non concerné'  INFO_1   ,
 //+     NULL           VALEUR_1 ,
 //+     NULL           DATE_1   ,
 //+     NULL           DATE_2   ,
 //+     NULL           TEXTE
 //+  FROM  PRE_PRESENTATION t1
 //+  WHERE NOT EXISTS (SELECT 1
 //+              FROM PRETSS_PRESENTATION_TAUX t2,
 //+            PRE_PRESENTATION   t3
 //+        WHERE t2.PRETSS_PRE_CODE_FK_PK = t3.PRE_CODE_PK
 //+        AND t3.PRE_EAN_REF     = CODECIP)
 //+  AND t1.PRE_EAN_REF  = CODECIP
 //+  UNION
 //+  SELECT '1.1'                      TYPE_PRE_RBT     ,
 //+     t2.CDF_NOM                 INFO_1   ,
 //+     NULL                       VALEUR_1 ,
 //+     t1.PRETSSH_DATE_APPLI_PK   DATE_1   ,
 //+     t1.PRETSSH_DATE_APPLIQUEE  DATE_2   ,
 //+     t1.PRETSSH_TEXTE           TEXTE
 //+  FROM PRETSSH_PRE_TAUX_HOP      t1,
 //+    CDF_CODIF                 t2,
 //+    PRE_PRESENTATION     t3
 //+  WHERE t1.PRETSSH_CDF_TSS_CODE_FK_PK = t2.CDF_CODE_PK
 //+  AND t2.CDF_NUMERO_PK              = '17'
 //+  AND t1.PRETSSH_PRE_CODE_FK_PK     = t3.PRE_CODE_PK
 //+  AND t3.PRE_EAN_REF        = CODECIP
 //+  UNION
 //+       SELECT '1.1'                     TYPE_PRE_RBT     ,
 //+       'Non concerné'            INFO_1   ,
 //+     NULL                      VALEUR_1 ,
 //+     NULL                      DATE_1   ,
 //+     NULL                      DATE_2   ,
 //+     NULL                      TEXTE
 //+  FROM PRE_PRESENTATION  t1
 //+  WHERE  NOT EXISTS (SELECT 1
 //+               FROM PRETSSH_PRE_TAUX_HOP t2,
 //+           PRE_PRESENTATION  t3
 //+         WHERE t2.PRETSSH_PRE_CODE_FK_PK = t3.PRE_CODE_PK
 //+         AND t3.PRE_EAN_REF       = CODECIP )
 //+  AND t1.PRE_EAN_REF  = CODECIP
 //+  UNION
 //+  SELECT '2  '               TYPE_PRE_RBT     ,
 //+     NULL                       INFO_1   ,
 //+     t1.FORPRE_FORFAIT          VALEUR_1 ,
 //+     t1.FORPRE_DATE_PK          DATE_1   ,
 //+     NULL                       DATE_2   ,
 //+     NULL                       TEXTE
 //+  FROM FORPRE_FORFAIT_PRE t1,
 //+    PRE_PRESENTATION  t2
 //+  WHERE t1.FORPRE_PRE_CODE_FK_PK = t2.PRE_CODE_PK
 //+  AND t2.PRE_EAN_REF       = CODECIP
 //+        UNION
 //+     SELECT '3'                        TYPE_PRE_RBT     ,
 //+    t2.CDF_NOM                 INFO_1   ,
 //+       t1.PRESTR_NUMORD           VALEUR_1 ,
 //+       NULL                       DATE_1   ,
 //+       NULL                       DATE_2   ,
 //+       NULL                       TEXTE
 //+  FROM PRESTR_STATUT_REMBOURST t1,
 //+    CDF_CODIF               t2,
 //+    PRE_PRESENTATION     t3
 //+  WHERE t1.PRESTR_CDF_STR_CODE_FK_PK  = t2.CDF_CODE_PK
 //+  AND t2.CDF_NUMERO_PK              = '14'
 //+  AND t1.PRESTR_PRE_CODE_FK_PK      = t3.PRE_CODE_PK
 //+  AND t3.PRE_EAN_REF          = CODECIP
 //+  UNION
 //+  SELECT '4'                        TYPE_PRE_RBT     ,
 //+    NULL                       INFO_1   ,
 //+    NULL                       VALEUR_1 ,
 //+    NULL                       DATE_1   ,
 //+    NULL                       DATE_2   ,
 //+    t1.PRESTRTX_TEXTE          TEXTE
 //+  FROM PRESTRTX_TEXTE_STAT_REMBOURST t1,
 //+    PRE_PRESENTATION       t2
 //+  WHERE t1.PRESTRTX_PRE_CODE_FK_PK = t2.PRE_CODE_PK
 //+  AND t2.PRE_EAN_REF         = CODECIP
 //+  ORDER BY  1,3;
                sql_query += " SELECT '1'  TYPE_PRE_RBT   ,"
                     " t2.CDF_NOM                INFO_1   ,"
                     " NULL                    VALEUR_1   ,"
                     " t1.PRETSS_DATE_APPLI_PK   DATE_1   ,"
                     " t1.PRETSS_DATE_APPLIQUEE  DATE_2   ,"
                     " t1.PRETSS_TEXTE           TEXTE"
                     " FROM pretss_presentation_taux  t1,"
                     " cdf_codif                      t2,"
                     " pre_presentation     t3"
                     " WHERE  t1.PRETSS_CDF_TSS_CODE_FK_PK = t2.CDF_CODE_PK"
                     " AND t2.CDF_NUMERO_PK                = '17'"
                     " AND t1.PRETSS_PRE_CODE_FK_PK        = t3.PRE_CODE_PK"
                     " AND t3.PRE_EAN_REF                  = '"+CODECIP+"'"
                     " UNION"
                     " SELECT '1'  TYPE_PRE_RBT ,"
                     " 'NON concerné'  INFO_1   ,"
                     " NULL           VALEUR_1  ,"
                     " NULL           DATE_1    ,"
                     " NULL           DATE_2    ,"
                     " NULL           TEXTE"
                     " FROM  pre_presentation t1"
                     " WHERE NOT EXISTS (SELECT 1"
                     " FROM pretss_presentation_taux t2,"
                     " pre_presentation   t3"
                     " WHERE t2.PRETSS_PRE_CODE_FK_PK = t3.PRE_CODE_PK"
                     " AND t3.PRE_EAN_REF      = '"+CODECIP+"')"
                     " AND t1.PRE_EAN_REF      = '"+CODECIP+"'"
                     " UNION"
                     " SELECT '1.1'               TYPE_PRE_RBT     ,"
                     " t2.CDF_NOM                 INFO_1   ,"
                     " NULL                       VALEUR_1 ,"
                     " t1.PRETSSH_DATE_APPLI_PK   DATE_1   ,"
                     " t1.PRETSSH_DATE_APPLIQUEE  DATE_2   ,"
                     " t1.PRETSSH_TEXTE           TEXTE"
                     " FROM pretssh_pre_taux_hop      t1,"
                     " cdf_codif                 t2,"
                     " pre_presentation     t3"
                     " WHERE t1.PRETSSH_CDF_TSS_CODE_FK_PK = t2.CDF_CODE_PK"
                     " AND t2.CDF_NUMERO_PK                = '17'"
                     " AND t1.PRETSSH_PRE_CODE_FK_PK       = t3.PRE_CODE_PK"
                     " AND t3.PRE_EAN_REF                  = '"+CODECIP+"'"
                     " UNION"
                     " SELECT '1.1'              TYPE_PRE_RBT     ,"
                     " 'NON concerné'            INFO_1   ,"
                     " NULL                      VALEUR_1 ,"
                     " NULL                      DATE_1   ,"
                     " NULL                      DATE_2   ,"
                     " NULL                      TEXTE"
                     " FROM pre_presentation  t1"
                     " WHERE  NOT EXISTS (SELECT 1"
                     " FROM pretssh_pre_taux_hop t2,"
                     " pre_presentation  t3"
                     " WHERE t2.PRETSSH_PRE_CODE_FK_PK = t3.PRE_CODE_PK"
                     " AND t3.PRE_EAN_REF        = '"+CODECIP+"' )"
                     " AND t1.PRE_EAN_REF        = '"+CODECIP+"'"
                     " UNION"
                     " SELECT '2  '               TYPE_PRE_RBT     ,"
                     " NULL                       INFO_1   ,"
                     " t1.FORPRE_FORFAIT          VALEUR_1 ,"
                     " t1.FORPRE_DATE_PK          DATE_1   ,"
                     " NULL                       DATE_2   ,"
                     " NULL                       TEXTE"
                     " FROM forpre_forfait_pre t1,"
                     " pre_presentation  t2"
                     " WHERE t1.FORPRE_PRE_CODE_FK_PK = t2.PRE_CODE_PK"
                     " AND t2.PRE_EAN_REF        = '"+CODECIP+"'"
                     " UNION"
                     " SELECT '3'                 TYPE_PRE_RBT     ,"
                     " t2.CDF_NOM                 INFO_1   ,"
                     " t1.PRESTR_NUMORD           VALEUR_1 ,"
                     " NULL                       DATE_1   ,"
                     " NULL                       DATE_2   ,"
                     " NULL                       TEXTE"
                     " FROM prestr_statut_rembourst t1,"
                     " cdf_codif               t2,"
                     " pre_presentation     t3"
                     " WHERE t1.PRESTR_CDF_STR_CODE_FK_PK  = t2.CDF_CODE_PK"
                     " AND t2.CDF_NUMERO_PK              = '14'"
                     " AND t1.PRESTR_PRE_CODE_FK_PK      = t3.PRE_CODE_PK"
                     " AND t3.PRE_EAN_REF           = '"+CODECIP+"'"
                     " UNION"
                     " SELECT '4'                 TYPE_PRE_RBT     ,"
                     " NULL                       INFO_1   ,"
                     " NULL                       VALEUR_1 ,"
                     " NULL                       DATE_1   ,"
                     " NULL                       DATE_2   ,"
                     " t1.PRESTRTX_TEXTE          TEXTE"
                     " FROM prestrtx_texte_stat_rembourst t1,"
                     " pre_presentation       t2"
                     " WHERE t1.PRESTRTX_PRE_CODE_FK_PK = t2.PRE_CODE_PK"
                     " AND t2.PRE_EAN_REF          = '"+CODECIP+"'"
                     " ORDER BY  1,3;";

       }
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_PRE_RBT() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_TYPE_PRE_RBT = value(0).toString();
                m_INFO_1       = value(1).toString();
                m_VALEUR_1     = value(2).toDouble();
                m_DATE_1       = value(3).toDate();
                m_DATE_2       = value(4).toDate();
                m_TEXTE        = value(5).toString();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      QString TYPE_PRE_RBT() {return m_TYPE_PRE_RBT;}
      QString INFO_1()       {return m_INFO_1;}
      double  VALEUR_1()     {return m_VALEUR_1;}
      QDate   DATE_1()       {return m_DATE_1;}
      QDate   DATE_2()       {return m_DATE_2;}
      QString TEXTE()        {return m_TEXTE;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      QString m_TYPE_PRE_RBT;
      QString m_INFO_1;
      double  m_VALEUR_1;
      QDate   m_DATE_1;
      QDate   m_DATE_2;
      QString m_TEXTE;
 };

 //================================== C_GET_THE_GR_FIC_SPE_CUR   -77- ==================================
 /****************************************************************************
 *   Nom           :  GET_THE_GR_FIC_SPE
 -----------------------------------------------------------------------------
 *   Date creation : 05/09/2008
 -----------------------------------------------------------------------------
 *   Description   :  Cette procédure renvoie le détail la fiche grossesse
 *                    répondant au code identifiant spécialité passé en paramètre.
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_GR_FIC_SPE_CUR  C_GET_THE_GR_FIC_SPE ( database(), this );
      while ( C_GET_THE_GR_FIC_SPE.next( CodeId  ) )
            { html += tr("<br><b> GET_THE_GR_FIC_SPE : </b>  ") + C_GET_THE_GR_FIC_SPE.MEMBER();
            }
  */
  class C_GET_THE_GR_FIC_SPE_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_GR_FIC_SPE_CUR ---------------------
      C_GET_THE_GR_FIC_SPE_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( double CodeId )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............
                sql_query +=
                     " SELECT DISTINCT t1.FGA_CODE_SQ_PK   CODE_FICHE,"
                     " t1.FGA_DATECR                       DATECR,"
                     " t1.FGA_DATEMJ                       DATEMJ,"
                     " t1.FGA_TYPEEFFET                    TYPEEFFET,"
                     " t1.FGA_PASSAGELAIT                  PASSAGELAIT,"
                     " t1.FGA_FIXATIONPROTEIQUE            FIXPROT,"
                     " t1.FGA_FIXATIONPROTEIQUE_MINI       FIXPROTMINI,"
                     " t1.FGA_FIXATIONPROTEIQUE_MAXI       FIXPROTMAXI,"
                     " t1.FGA_PLASMALAIT                   PLASMALAIT,"
                     " t1.FGA_PLASMALAIT_MINI              PLASMALAITMINI,"
                     " t1.FGA_PLASMALAIT_MAXI              PLASMALAITMAXI,"
                     " t1.FGA_CONCENTRATION                CONCENT,"
                     " t1.FGA_CONCENTRATION_MINI           CONCENTMINI,"
                     " t1.FGA_CONCENTRATION_MAXI           CONCENTMAXI"
                 //     " t3.CDF_NOM                     CONCENTUNI"                // marche pas
                     " FROM   fga_fichegral      t1 ,"
                     " fgaafs_fga_afssaps t4,"
                     " fgasp_gralspe      t2 "
                //     " cdf_codif          t3 ,"                                   // marche pas car le plus souvent = NULL
                     " WHERE  t1.FGA_CODE_SQ_PK         = t2.FGASP_FGA_CODE_FK_PK"
                //     " AND    t1.FGA_CDF_UC_CODE_FK    = t3.CDF_CODE_PK"          // marche pas
                //     " AND    t3.CDF_NUMERO_PK         = '19'"                    // marche pas
                     " AND    t2.FGASP_SP_CODE_FK_PK    = t4.FGAAFS_SP_CODE_FK_PK"
                     " AND    t4.FGAAFS_TYPEGRAL_PK     = 'G'"
                     " AND    t2.FGASP_SP_CODE_FK_PK    = '"+ QString::number( CodeId ) +"'"
                     " ORDER BY 1 ;";
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_GR_FIC_SPE() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_MY_CODE_FICHE  = value(0).toDouble();
                m_DATECR         = value(1).toDate();
                m_DATEMJ         = value(2).toDate();
                m_TYPEEFFET      = value(3).toString();
                m_PASSAGELAIT    = value(4).toString();
                m_FIXPROT        = value(5).toString();
                m_FIXPROTMINI    = value(6).toDouble();
                m_FIXPROTMAXI    = value(7).toDouble();
                m_PLASMALAIT     = value(8).toString();
                m_PLASMALAITMINI = value(9).toDouble();
                m_PLASMALAITMAXI = value(10).toDouble();
                m_CONCENT        = value(11).toString();
                m_CONCENTMINI    = value(12).toDouble();
                m_CONCENTMAXI    = value(13).toDouble();
                // m_CONCENTUNI     = value(14).toString();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      double  MY_CODE_FICHE()  {return m_MY_CODE_FICHE;}
      QDate   DATECR()         {return m_DATECR;}
      QDate   DATEMJ()         {return m_DATEMJ;}
      QString TYPEEFFET()      {return m_TYPEEFFET;}
      QString PASSAGELAIT()    {return m_PASSAGELAIT;}
      QString FIXPROT()        {return m_FIXPROT;}
      double  FIXPROTMINI()    {return m_FIXPROTMINI;}
      double  FIXPROTMAXI()    {return m_FIXPROTMAXI;}
      QString PLASMALAIT()     {return m_PLASMALAIT;}
      double  PLASMALAITMINI() {return m_PLASMALAITMINI;}
      double  PLASMALAITMAXI() {return m_PLASMALAITMAXI;}
      QString CONCENT()        {return m_CONCENT;}
      double  CONCENTMINI()    {return m_CONCENTMINI;}
      double  CONCENTMAXI()    {return m_CONCENTMAXI;}
      // QString CONCENTUNI()     {return m_CONCENTUNI;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      double  m_MY_CODE_FICHE;
      QDate   m_DATECR;
      QDate   m_DATEMJ;
      QString m_TYPEEFFET;
      QString m_PASSAGELAIT;
      QString m_FIXPROT;
      double  m_FIXPROTMINI;
      double  m_FIXPROTMAXI;
      QString m_PLASMALAIT;
      double  m_PLASMALAITMINI;
      double  m_PLASMALAITMAXI;
      QString m_CONCENT;
      double  m_CONCENTMINI;
      double  m_CONCENTMAXI;
      // QString m_CONCENTUNI;
 };

 //================================== C_GET_THE_AL_FIC_SPE_CUR   -78- ==================================
 /****************************************************************************
 *   Nom           :  GET_THE_AL_FIC_SPE
 -----------------------------------------------------------------------------
 *   Date creation : 05/09/2008
 -----------------------------------------------------------------------------
 *   Description   : Cette procédure renvoie le détail la fiche allaitement
 *                   répondant au code identifiant spécialité passé en paramètre.
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_AL_FIC_SPE_CUR  C_GET_THE_AL_FIC_SPE ( database(), this );
      while ( C_GET_THE_AL_FIC_SPE.next( CodeId  ) )
            { html += tr("<br><b> GET_THE_AL_FIC_SPE : </b>  ") + C_GET_THE_AL_FIC_SPE.MEMBER();
            }
  */
  class C_GET_THE_AL_FIC_SPE_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_AL_FIC_SPE_CUR ---------------------
      C_GET_THE_AL_FIC_SPE_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( double CodeId )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............
                sql_query +=
                     " SELECT DISTINCT t1.FGA_CODE_SQ_PK   CODE_FICHE,"
                     " t1.FGA_DATECR                       DATECR,"
                     " t1.FGA_DATEMJ                       DATEMJ,"
                     " t1.FGA_TYPEEFFET                    TYPEEFFET,"
                     " t1.FGA_PASSAGELAIT                  PASSAGELAIT,"
                     " t1.FGA_FIXATIONPROTEIQUE            FIXPROT,"
                     " t1.FGA_FIXATIONPROTEIQUE_MINI       FIXPROTMINI,"
                     " t1.FGA_FIXATIONPROTEIQUE_MAXI       FIXPROTMAXI,"
                     " t1.FGA_PLASMALAIT                   PLASMALAIT,"
                     " t1.FGA_PLASMALAIT_MINI              PLASMALAITMINI,"
                     " t1.FGA_PLASMALAIT_MAXI              PLASMALAITMAXI,"
                     " t1.FGA_CONCENTRATION                CONCENT,"
                     " t1.FGA_CONCENTRATION_MINI           CONCENTMINI,"
                     " t1.FGA_CONCENTRATION_MAXI           CONCENTMAXI"
                  //   " t3.CDF_NOM                     CONCENTUNI"
                     " FROM   fga_fichegral t1 ,"
                     " fgasp_gralspe        t2 ,"
                  //   " cdf_codif          t3 ,"
                     " fgaafs_fga_afssaps t4"
                     " WHERE  t1.FGA_CODE_SQ_PK      = t2.FGASP_FGA_CODE_FK_PK"
                  //   " AND    t1.FGA_CDF_UC_CODE_FK  = t3.CDF_CODE_PK"
                  //   " AND    t3.CDF_NUMERO_PK    = '19'"
                     " AND    t2.FGASP_SP_CODE_FK_PK = t4.FGAAFS_SP_CODE_FK_PK"
                     " AND    t4.FGAAFS_TYPEGRAL_PK  = 'A'"
                     " AND    t2.FGASP_SP_CODE_FK_PK  = '"+ QString::number( CodeId ) +"'"
                     " ORDER BY 1 ;";
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_AL_FIC_SPE() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_CODE_FICHE     = value(0).toDouble();
                m_DATECR         = value(1).toDate();
                m_DATEMJ         = value(2).toDate();
                m_TYPEEFFET      = value(3).toString();
                m_PASSAGELAIT    = value(4).toString();
                m_FIXPROT        = value(5).toString();
                m_FIXPROTMINI    = value(6).toDouble();
                m_FIXPROTMAXI    = value(7).toDouble();
                m_PLASMALAIT     = value(8).toString();
                m_PLASMALAITMINI = value(9).toDouble();
                m_PLASMALAITMAXI = value(10).toDouble();
                m_CONCENT        = value(11).toString();
                m_CONCENTMINI    = value(12).toDouble();
                m_CONCENTMAXI    = value(13).toDouble();
               // m_CONCENTUNI     = value(14).toString();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      double  CODE_FICHE()     {return m_CODE_FICHE;}
      QDate   DATECR()         {return m_DATECR;}
      QDate   DATEMJ()         {return m_DATEMJ;}
      QString TYPEEFFET()      {return m_TYPEEFFET;}
      QString PASSAGELAIT()    {return m_PASSAGELAIT;}
      QString FIXPROT()        {return m_FIXPROT;}
      double  FIXPROTMINI()    {return m_FIXPROTMINI;}
      double  FIXPROTMAXI()    {return m_FIXPROTMAXI;}
      QString PLASMALAIT()     {return m_PLASMALAIT;}
      double  PLASMALAITMINI() {return m_PLASMALAITMINI;}
      double  PLASMALAITMAXI() {return m_PLASMALAITMAXI;}
      QString CONCENT()        {return m_CONCENT;}
      double  CONCENTMINI()    {return m_CONCENTMINI;}
      double  CONCENTMAXI()    {return m_CONCENTMAXI;}
     // QString CONCENTUNI()     {return m_CONCENTUNI;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      double  m_CODE_FICHE;
      QDate   m_DATECR;
      QDate   m_DATEMJ;
      QString m_TYPEEFFET;
      QString m_PASSAGELAIT;
      QString m_FIXPROT;
      double  m_FIXPROTMINI;
      double  m_FIXPROTMAXI;
      QString m_PLASMALAIT;
      double  m_PLASMALAITMINI;
      double  m_PLASMALAITMAXI;
      QString m_CONCENT;
      double  m_CONCENTMINI;
      double  m_CONCENTMAXI;
    //  QString m_CONCENTUNI;
 };

 //================================== C_GET_THE_GR_SPE_CUR   -79- ==================================
 /****************************************************************************
 *   Nom           :  GET_THE_GR_SPE
 -----------------------------------------------------------------------------
 *   Date creation : 09/09/2008
 -----------------------------------------------------------------------------
 *   Description   : Cette procédure permet d¿accéder aux informations de la fiche
 *                   grossesse répondant au code identifiant spécialité passé en paramètre,
 *                   le second paramètre permet d¿indiquer l¿information souhaitée.
 *   MAJ            : 12/12/2008
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_GR_SPE_CUR  C_GET_THE_GR_SPE ( database(), this );
      while ( C_GET_THE_GR_SPE.next( CodeId , TYPID , CODEFIC  ) )
            { html += tr("<br><b> GET_THE_GR_SPE : </b>  ") + C_GET_THE_GR_SPE.MEMBER();
            }
  */
  class C_GET_THE_GR_SPE_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_GR_SPE_CUR ---------------------
      C_GET_THE_GR_SPE_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( double CodeId , double TYPID , double CODEFIC )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............
 //+   --- In formations générales de la fiche
       if ( TYPID == 1) {             // -- Id theriaque
                sql_query +=
                     " SELECT DISTINCT t1.FGA_DATEMJ   TEXTGR"
                     " FROM   fga_fichegral            t1 ,"
                     " fgasp_gralspe                   t2 ,"
                     " fgaafs_fga_afssaps              t3"
                     " WHERE  t1.FGA_CODE_SQ_PK        = t2.FGASP_FGA_CODE_FK_PK"
                     " AND    t2.FGASP_SP_CODE_FK_PK   = t3.FGAAFS_SP_CODE_FK_PK"
                     " AND    t3.FGAAFS_TYPEGRAL_PK    = 'G'"
                     " AND    t3.FGAAFS_DATE_PK        = (SELECT MAX(FGAAFS_DATE_PK)"
                     " FROM   fgaafs_fga_afssaps"
                     " WHERE  FGAAFS_SP_CODE_FK_PK     = '"+ QString::number( CodeId ) +"'"
                     " AND    FGAAFS_FGA_CODE_FK_PK    = '"+ QString::number( CODEFIC ) +"')"
                     " AND    t2.FGASP_SP_CODE_FK_PK   = '"+ QString::number( CodeId ) +"'"
                     " AND    t2.FGASP_FGA_CODE_FK_PK  = '"+ QString::number( CODEFIC ) +"' ;";

       } else if ( TYPID == 17) {       // -- Reference officielle
                sql_query +=
                     " SELECT DISTINCT concat(t4.CDF_NOM,' ',t3.FGAAFS_DATE_PK)   TEXTGR"
                     " FROM   fga_fichegral        t1 ,"
                     " fgasp_gralspe      t2 ,"
                     " fgaafs_fga_afssaps t3 ,"
                     " cdf_codif          t4"
                     " WHERE  t1.FGA_CODE_SQ_PK          = t2.FGASP_FGA_CODE_FK_PK"
                     " AND    t2.FGASP_SP_CODE_FK_PK       = t3.FGAAFS_SP_CODE_FK_PK"
                     " AND    t3.FGAAFS_TYPEGRAL_PK        = 'G'"
                     " AND    t3.FGAAFS_DATE_PK            = (SELECT MAX(FGAAFS_DATE_PK)"
                     " FROM fgaafs_fga_afssaps"
                     " WHERE FGAAFS_SP_CODE_FK_PK   = '"+ QString::number( CodeId ) +"'"
                     " AND   FGAAFS_FGA_CODE_FK_PK  = '"+ QString::number( CODEFIC ) +"')"
                     " AND    t3.FGAAFS_CDF_DOCUMENT_FK_PK = t4.CDF_CODE_PK"
                     " AND    t4.CDF_NUMERO_PK             = '25'"
                     " AND    t2.FGASP_SP_CODE_FK_PK        = '"+ QString::number( CodeId ) +"'"
                     " AND    t2.FGASP_FGA_CODE_FK_PK       = '"+ QString::number( CODEFIC ) +"' ;";

 //+   --- Données expérimentales animales :
       } else if ( TYPID == 2) {       // -- Observations
                sql_query +=
                     " SELECT t3.CDF_NOM           TEXTGR"
                     " FROM   fgasp_gralspe        t1,"
                     " fgaoa_observation_animale   t2,"
                     " cdf_codif                   t3"
                     " WHERE  t2.FGAOA_FGA_CODE_FK_PK     = t1.FGASP_FGA_CODE_FK_PK"
                     " AND    t2.FGAOA_CDF_OBS_CODE_FK_PK = t3.CDF_CODE_PK"
                     " AND    t3.CDF_NUMERO_PK            = 'GO'"
                     " AND    t1.FGASP_SP_CODE_FK_PK      = '"+ QString::number( CodeId ) +"'"
                     " AND    t1.FGASP_FGA_CODE_FK_PK     = '"+ QString::number( CODEFIC ) +"'"
                     " ORDER BY t2.FGAOA_NUMORD ;";

       } else if (  TYPID == 3) {          // -- Texte Observation
                sql_query +=
                     " SELECT t2.FGATX1_TEXTE             TEXTGR"
                     " FROM   fgasp_gralspe               t1,"
                     " fgatx1_fga_txobservani             t2"
                     " WHERE  t2.FGATX1_FGA_CODE_FK_PK    = t1.FGASP_FGA_CODE_FK_PK"
                     " AND    t1.FGASP_SP_CODE_FK_PK      = '"+ QString::number( CodeId ) +"'"
                     " AND    t1.FGASP_FGA_CODE_FK_PK     = '"+ QString::number( CODEFIC ) +"' ;";

       } else if (  TYPID == 4) {   // -- Risques
                sql_query +=
                     " SELECT t3.CDF_NOM           TEXTGR"
                     " FROM   fgasp_gralspe        t1,"
                     " fgaria_risque_animale       t2,"
                     " cdf_codif                   t3"
                     " WHERE  t2.FGARIA_FGA_CODE_FK_PK     = t1.FGASP_FGA_CODE_FK_PK"
                     " AND    t2.FGARIA_CDF_RI_CODE_FK_PK  = t3.CDF_CODE_PK"
                     " AND    t3.CDF_NUMERO_PK             = 'GR'"
                     " AND    t1.FGASP_SP_CODE_FK_PK       = '"+ QString::number( CodeId ) +"'"
                     " AND    t1.FGASP_FGA_CODE_FK_PK      = '"+ QString::number( CODEFIC ) +"' ;";

       } else if (  TYPID == 5) {   // -- Circonstances favorisantes
                sql_query +=
                     " SELECT t3.CDF_NOM                TEXTGR"
                     " FROM   fgasp_gralspe             t1,"
                     " fgacfa_circonstfavoris_animale   t2,"
                     " cdf_codif                        t3"
                     " WHERE  t2.FGACFA_FGA_CODE_FK_PK     = t1.FGASP_FGA_CODE_FK_PK"
                     " AND    t2.FGACFA_CDF_CF_CODE_FK_PK  = t3.CDF_CODE_PK"
                     " AND    t3.CDF_NUMERO_PK             = 'GC'"
                     " AND    t1.FGASP_SP_CODE_FK_PK       = '"+ QString::number( CodeId ) +"'"
                     " AND    t1.FGASP_FGA_CODE_FK_PK      = '"+ QString::number( CODEFIC ) +"' ;";

 //+   -- Données cliniques humaines
       } else if (  TYPID == 6) {           // -- Observations
                sql_query +=
                     " SELECT t3.CDF_NOM                   TEXTGR"
                     " FROM   fgasp_gralspe                t1,"
                     " fgaoh_observation_humaine           t2,"
                     " cdf_codif                           t3"
                     " WHERE  t2.FGAOH_FGA_CODE_FK_PK      = t1.FGASP_FGA_CODE_FK_PK"
                     " AND    t2.FGAOH_CDF_OBS_CODE_FK_PK  = t3.CDF_CODE_PK"
                     " AND    t3.CDF_NUMERO_PK             = 'GO'"
                     " AND    t1.FGASP_SP_CODE_FK_PK       = '"+ QString::number( CodeId ) +"'"
                     " AND    t1.FGASP_FGA_CODE_FK_PK      = '"+ QString::number( CODEFIC ) +"'"
                     " ORDER BY t2.FGAOH_NUMORD ;";

       } else if (  TYPID == 7) {        // -- Texte Observation
                sql_query +=
                     " SELECT t2.FGATX3_TEXTE             TEXTGR"
                     " FROM   fgasp_gralspe               t1,"
                     " fgatx3_fga_txobservhum             t2"
                     " WHERE  t2.FGATX3_FGA_CODE_FK_PK    = t1.FGASP_FGA_CODE_FK_PK"
                     " AND    t1.FGASP_SP_CODE_FK_PK      = '"+ QString::number( CodeId ) +"'"
                     " AND    t1.FGASP_FGA_CODE_FK_PK     = '"+ QString::number( CODEFIC ) +"' ;";

       } else if (  TYPID == 8) {   // -- Risques
                sql_query +=
                      " SELECT t3.CDF_NOM          TEXTGR"
                     " FROM   fgasp_gralspe        t1,"
                     " fgarih_risque_humaine       t2,"
                     " cdf_codif                   t3"
                     " WHERE  t2.FGARIH_FGA_CODE_FK_PK     = t1.FGASP_FGA_CODE_FK_PK"
                     " AND    t2.FGARIH_CDF_RI_CODE_FK_PK  = t3.CDF_CODE_PK"
                     " AND    t3.CDF_NUMERO_PK             = 'GR'"
                     " AND    t1.FGASP_SP_CODE_FK_PK       = '"+ QString::number( CodeId ) +"'"
                     " AND    t1.FGASP_FGA_CODE_FK_PK      = '"+ QString::number( CODEFIC ) +"' ;";

       } else if (  TYPID == 9) {    // -- Periodes critiques
                sql_query +=
                     " SELECT t3.CDF_NOM              TEXTGR"
                     " FROM   fgasp_gralspe           t1,"
                     " fgapc_periodecritique_fgral    t2,"
                     " cdf_codif                      t3"
                     " WHERE  t2.FGAPC_FGA_CODE_FK_PK     = t1.FGASP_FGA_CODE_FK_PK"
                     " AND    t2.FGAPC_CDF_PC_CODE_FK_PK  = t3.CDF_CODE_PK"
                     " AND    t3.CDF_NUMERO_PK            = 'GP'"
                     " AND    t1.FGASP_SP_CODE_FK_PK      = '"+ QString::number( CodeId ) +"'"
                     " AND    t1.FGASP_FGA_CODE_FK_PK     = '"+ QString::number( CODEFIC ) +"' ;";

       } else if (  TYPID == 10) {    // -- Circonstances favorisantes
                sql_query +=
                     " SELECT t3.CDF_NOM                  TEXTGR"
                     " FROM   fgasp_gralspe               t1,"
                     " fgacfh_circonstfavoris_humaine     t2,"
                     " cdf_codif                          t3"
                     " WHERE  t2.FGACFH_FGA_CODE_FK_PK    = t1.FGASP_FGA_CODE_FK_PK"
                     " AND    t2.FGACFH_CDF_CF_CODE_FK_PK = t3.CDF_CODE_PK"
                     " AND    t3.CDF_NUMERO_PK            = 'GC'"
                     " AND    t1.FGASP_SP_CODE_FK_PK      = '"+ QString::number( CodeId ) +"'"
                     " AND    t1.FGASP_FGA_CODE_FK_PK     = '"+ QString::number( CODEFIC ) +"' ;";

 //+   --- Recommandations et conduite à tenir :
       } else if (  TYPID == 11) {          // -- Niveau de risque
                sql_query +=
                     " SELECT CONCAT(t3.CDF_NOM,'   ',t4.CDF_NOM) AS   TEXTGR"
                     " FROM   fgasp_gralspe               t1,"
                     " fgarig_risque_grossesse            t2,"
                     " cdf_codif                          t3,"
                     " cdf_codif                          t4"
                     " WHERE  t2.FGARIG_FGA_CODE_FK_PK    = t1.FGASP_FGA_CODE_FK_PK"
                     " AND    t2.FGARIG_CDF_RI_CODE_FK    = t3.CDF_CODE_PK"
                     " AND    t2.FGARIG_CDF_TC_CODE_FK    = t4.CDF_CODE_PK"
                     " AND    t4.CDF_NUMERO_PK            = 'GP'"
                     " AND    t3.CDF_NUMERO_PK            = 'GR'"
                     " AND    t1.FGASP_SP_CODE_FK_PK      = '"+ QString::number( CodeId ) +"'"
                     " AND    t1.FGASP_FGA_CODE_FK_PK     = '"+ QString::number( CODEFIC ) +"' ;";

       } else if (  TYPID == 12) {      // -- Texte recommandation
                sql_query +=
                     " SELECT t2.FGATX7_TEXTE   TEXTGR"
                     " FROM   fgasp_gralspe               t1,"
                     " fgatx7_fga_txrecommandat           t2"
                     " WHERE  t2.FGATX7_FGA_CODE_FK_PK    = t1.FGASP_FGA_CODE_FK_PK"
                     " AND    t1.FGASP_SP_CODE_FK_PK      = '"+ QString::number( CodeId ) +"'"
                     " AND    t1.FGASP_FGA_CODE_FK_PK     = '"+ QString::number( CODEFIC ) +"' ;";

 //+    --- Recommandations et conduite à tenir c hez la femme enceinte:
       } else if (  TYPID == 13) {    // -- conduite a tenir
                sql_query +=
                     " SELECT t3.CDF_NOM   TEXTGR"
                     " FROM   fgasp_gralspe              t1,"
                     " fgacf_catfemmeenceinte            t2,"
                     " cdf_codif                         t3"
                     " WHERE  t2.FGACF_FGA_CODE_FK_PK     = t1.FGASP_FGA_CODE_FK_PK"
                     " AND    t2.FGACF_CDF_CAT_CODE_FK_PK = t3.CDF_CODE_PK"
                     " AND    t3.CDF_NUMERO_PK            = 'GT'"
                     " AND    t1.FGASP_SP_CODE_FK_PK      = '"+ QString::number( CodeId ) +"'"
                     " AND    t1.FGASP_FGA_CODE_FK_PK     = '"+ QString::number( CODEFIC ) +"' ;";

       } else if (  TYPID == 14) {    // -- Texte conduite a tenir
                sql_query +=
                     " SELECT t2.FGATX4_TEXTE  TEXTGR"
                     " FROM   fgasp_gralspe              t1,"
                     " fgatx4_fga_txcondatenircf         t2"
                     " WHERE  t2.FGATX4_FGA_CODE_FK_PK   = t1.FGASP_FGA_CODE_FK_PK"
                     " AND    t1.FGASP_SP_CODE_FK_PK     = '"+ QString::number( CodeId ) +"'"
                     " AND    t1.FGASP_FGA_CODE_FK_PK    = '"+ QString::number( CODEFIC ) +"' ;";

 //+--- Recommandations et conduite à tenir chez le nouveau né
       } else if (  TYPID == 15) {          // -- conduite a tenir
                sql_query +=
                     " SELECT t3.CDF_NOM   TEXTGR"
                     " FROM   fgasp_gralspe        t1,"
                     " fgacn_catnouveaune          t2,"
                     " cdf_codif                   t3"
                     " WHERE  t2.FGACN_FGA_CODE_FK_PK      = t1.FGASP_FGA_CODE_FK_PK"
                     " AND    t2.FGACN_CDF_CAT_CODE_FK_PK  = t3.CDF_CODE_PK"
                     " AND    t3.CDF_NUMERO_PK             = 'GT'"
                     " AND    t1.FGASP_SP_CODE_FK_PK       = '"+ QString::number( CodeId ) +"'"
                     " AND    t1.FGASP_FGA_CODE_FK_PK      = '"+ QString::number( CODEFIC ) +"' ;";
       } else if (  TYPID == 16) {         //  -- Texte conduite a tenir
                sql_query +=
                     " SELECT t2.FGATX5_TEXTE TEXTGR"
                     " FROM   fgasp_gralspe                t1,"
                     " fgatx5_fga_txcondatenircn           t2"
                     " WHERE  t2.FGATX5_FGA_CODE_FK_PK     = t1.FGASP_FGA_CODE_FK_PK"
                     " AND    t1.FGASP_SP_CODE_FK_PK       = '"+ QString::number( CodeId ) +"'"
                     " AND    t1.FGASP_FGA_CODE_FK_PK      = '"+ QString::number( CODEFIC ) +"' ;";
       }
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_GR_SPE() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_TEXTGR = value(0).toString();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      QString TEXTGR() {return m_TEXTGR;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      QString m_TEXTGR;
 };

 //================================== C_GET_THE_AL_SPE_CUR   -80- ==================================
 /****************************************************************************
 *   Nom           :  GET_THE_AL_SPE
 -----------------------------------------------------------------------------
 *   Date creation : 09/09/2008
 -----------------------------------------------------------------------------
 *   Description   : Cette procédure permet d¿accéder aux informations de la fiche
 *                   alaitement répondant au code identifiant spécialité passé en paramètre,
 *                   le second paramètre permet d¿indiquer l¿information souhaitée.
 *   MAJ            : 25/09/2008
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_AL_SPE_CUR  C_GET_THE_AL_SPE ( database(), this );
      while ( C_GET_THE_AL_SPE.next( CodeId , TypId , Codefic  ) )
            { html += tr("<br><b> GET_THE_AL_SPE : </b>  ") + C_GET_THE_AL_SPE.MEMBER();
            }
  */
  class C_GET_THE_AL_SPE_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_AL_SPE_CUR ---------------------
      C_GET_THE_AL_SPE_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( double CodeId , double TypId , double Codefic )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";
     //............. zone de construction de la requete DEBUT ...............
     //+   --- Informations générales de la fiche
       if ( TypId == 7) {             // -- Référence officielle
                sql_query +=
                     " SELECT DISTINCT concat(t4.CDF_NOM,' ',t3.FGAAFS_DATE_PK)    TEXTAL"
                     " FROM   fga_fichegral      t1 ,"
                     " fgasp_gralspe             t2 ,"
                     " fgaafs_fga_afssaps        t3 ,"
                     " cdf_codif                 t4"
                     " WHERE  t1.FGA_CODE_SQ_PK            = t2.FGASP_FGA_CODE_FK_PK"
                     " AND    t2.FGASP_SP_CODE_FK_PK       = t3.FGAAFS_SP_CODE_FK_PK"
                     " AND    t3.FGAAFS_TYPEGRAL_PK        = 'A'"
                     " AND    t3.FGAAFS_DATE_PK            = (SELECT MAX(FGAAFS_DATE_PK)"
                     "                                               FROM fgaafs_fga_afssaps"
                     "                                               WHERE FGAAFS_SP_CODE_FK_PK   = '"+ QString::number( CodeId  ) +"'"
                     "                                               AND   FGAAFS_FGA_CODE_FK_PK  = '"+ QString::number( Codefic ) +"')"
                     " AND    t3.FGAAFS_CDF_DOCUMENT_FK_PK  = t4.CDF_CODE_PK"
                     " AND    t4.CDF_NUMERO_PK              = '25'"
                     " AND    t2.FGASP_SP_CODE_FK_PK        = '"+ QString::number( CodeId  ) +"'"
                     " AND    t2.FGASP_FGA_CODE_FK_PK       = '"+ QString::number( Codefic ) +"' ;";
       } else if ( TypId == 1) {     // -- Conduite a tenir
                sql_query +=
                     " SELECT t3.CDF_NOM   TEXTAL"
                     " FROM   fgasp_gralspe       t1,"
                     " fgaca_catallaitement       t2,"
                     " cdf_codif                  t3"
                     " WHERE  t2.FGACA_FGA_CODE_FK_PK      = t1.FGASP_FGA_CODE_FK_PK"
                     " AND    t2.FGACA_CDF_CAT_CODE_FK_PK  = t3.CDF_CODE_PK"
                     " AND    t3.CDF_NUMERO_PK             = 'GT'"
                     " AND    t1.FGASP_SP_CODE_FK_PK       = '"+ QString::number( CodeId  ) +"'"
                     " AND    t1.FGASP_FGA_CODE_FK_PK      = '"+ QString::number( Codefic ) +"' ;";
       } else if ( TypId == 2) {     // -- Texte conduite a tenir
                sql_query +=
                     " SELECT t2.FGATX6_TEXTE          TEXTAL"
                     " FROM   fgasp_gralspe            t1,"
                     " fgatx6_fga_txcondatenirca       t2"
                     " WHERE  t2.FGATX6_FGA_CODE_FK_PK     = t1.FGASP_FGA_CODE_FK_PK"
                     " AND    t1.FGASP_SP_CODE_FK_PK       = '"+ QString::number( CodeId  )  +"'"
                     " AND    t1.FGASP_FGA_CODE_FK_PK      = '"+ QString::number( Codefic ) +"' ;";
       } else if ( TypId == 3) {     // -- Recommandation
                sql_query +=
                     " SELECT t3.CDF_NOM           TEXTAL"
                     " FROM   fgasp_gralspe        t1,"
                     " fgaril_risque_allaitement   t2,"
                     " cdf_codif                   t3"
                     " WHERE  t2.FGARIL_FGA_CODE_FK_PK     = t1.FGASP_FGA_CODE_FK_PK"
                     " AND    t2.FGARIL_CDF_RI_CODE_FK_PK  = t3.CDF_CODE_PK"
                     " AND    t3.CDF_NUMERO_PK             = 'GR'"
                     " AND    t1.FGASP_SP_CODE_FK_PK       = '"+ QString::number( CodeId  ) +"'"
                     " AND    t1.FGASP_FGA_CODE_FK_PK      = '"+ QString::number( Codefic ) +"' ;";
       } else if ( TypId == 4) {   // -- Texte recommandation
                sql_query +=
                     " SELECT t2.FGATX8_TEXTE         TEXTAL"
                     " FROM   fgasp_gralspe           t1,"
                     " fgatx8_fga_txrecommandat       t2"
                     " WHERE  t2.FGATX8_FGA_CODE_FK_PK     = t1.FGASP_FGA_CODE_FK_PK"
                     " AND    t1.FGASP_SP_CODE_FK_PK       = '"+ QString::number( CodeId  ) +"'"
                     " AND    t1.FGASP_FGA_CODE_FK_PK      = '"+ QString::number( Codefic ) +"' ;";
 //+  -- Nouveau né
       } else if ( TypId == 5) {     // -- Texte observation
                sql_query +=
                     " SELECT t2.FGATX2_TEXTE             TEXTAL"
                     " FROM   fgasp_gralspe               t1,"
                     " fgatx2_fga_txobservnouvne          t2"
                     " WHERE  t2.FGATX2_FGA_CODE_FK_PK    = t1.FGASP_FGA_CODE_FK_PK"
                     " AND    t1.FGASP_SP_CODE_FK_PK      = '"+ QString::number( CodeId  ) +"'"
                     " AND    t1.FGASP_FGA_CODE_FK_PK     = '"+ QString::number( Codefic ) +"' ;";
       } else if ( TypId == 6) {   // -- Texte circonstance favorisante
                sql_query +=
                     " SELECT t3.CDF_NOM                   TEXTAL"
                     " FROM   fgasp_gralspe                t1,"
                     " fgacfn_circonsfavoris_nouveaun      t2,"
                     " cdf_codif                           t3"
                     " WHERE  t2.FGACFN_FGA_CODE_FK_PK     = t1.FGASP_FGA_CODE_FK_PK"
                     " AND    t2.FGACFN_CDF_CF_CODE_FK_PK  = t3.CDF_CODE_PK"
                     " AND    t3.CDF_NUMERO_PK             = 'GC'"
                     " AND    t1.FGASP_SP_CODE_FK_PK       = '"+ QString::number( CodeId  ) +"'"
                     " AND    t1.FGASP_FGA_CODE_FK_PK      = '"+ QString::number( Codefic ) +"' ;";
       } else if ( TypId == 8) {  // -- Observations chez le nouveau-né
                sql_query +=
                     " SELECT t3.CDF_NOM                   TEXTAL"
                     " FROM   fgasp_gralspe                t1,"
                     " fgaon_observation_nouveaune         t2,"
                     " cdf_codif                           t3"
                     " WHERE  t2.FGAON_FGA_CODE_FK_PK      = t1.FGASP_FGA_CODE_FK_PK"
                     " AND    t2.FGAON_CDF_OBS_CODE_FK_PK  = t3.CDF_CODE_PK"
                     " AND    t3.CDF_NUMERO_PK             = 'GO'"
                     " AND    t1.FGASP_SP_CODE_FK_PK       = '"+ QString::number( CodeId  ) +"'"
                     " AND    t1.FGASP_FGA_CODE_FK_PK      = '"+ QString::number( Codefic ) +"' ;";
       }
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_AL_SPE() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_TEXTAL = value(0).toString();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      QString TEXTAL() {return m_TEXTAL;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      QString m_TEXTAL;
 };

 //================================== C_GET_THE_FPRO_SPE_CUR   -81- ==================================
 /****************************************************************************
 *   Nom           :  GET_THE_FPRO_SPE
 -----------------------------------------------------------------------------
 *   Date creation : 10/09/2008
 -----------------------------------------------------------------------------
 *   Description   :  Cette procédure permet d¿accéder aux informations de la fiche
                      Femme en age de procréer répondant au code identifiant spécialité
        passé en paramètre, le second paramètre permet d¿indiquer l¿information souhaitée.
 *   MAJ            : 06/10/2008
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_FPRO_SPE_CUR  C_GET_THE_FPRO_SPE ( database(), this );
      while ( C_GET_THE_FPRO_SPE.next( CodeId , TypId , Codefic  ) )
            { html += tr("<br><b> GET_THE_FPRO_SPE : </b>  ") + C_GET_THE_FPRO_SPE.MEMBER();
            }
  */
  class C_GET_THE_FPRO_SPE_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_FPRO_SPE_CUR ---------------------
      C_GET_THE_FPRO_SPE_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( double CodeId , double TypId , double Codefic )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............
 //+-- Informations générales de la fiche :
       if ( TypId == 1) {                      // -- Conduite a tenir
                sql_query +=
                     " SELECT t3.CDF_NOM   AS TEXTFP"
                     " FROM   fgasp_gralspe           t1,"
                     " fgacfap_catfemmeenage   t2,"
                     " cdf_codif               t3"
                     " WHERE  t2.FGACFAP_FGA_CODE_FK_PK     = t1.FGASP_FGA_CODE_FK_PK"
                     " AND    t2.FGACFAP_CDF_CAT_CODE_FK_PK = t3.CDF_CODE_PK"
                     " AND    t3.CDF_NUMERO_PK              = 'GT'"
                     " AND    t1.FGASP_SP_CODE_FK_PK         = '"+ QString::number( CodeId ) +"'"
                     " AND    t1.FGASP_FGA_CODE_FK_PK        = '"+ QString::number( Codefic ) +"' ;";

       } else if ( TypId == 2) {              // -- Texte conduite a tenir
                sql_query += " SELECT t2.FGATX10_TEXTE AS TEXTFP"
                     " FROM   fgasp_gralspe              t1,"
                     " fgatx10_fga_txrecommandat         t2"
                     " WHERE  t2.FGATX10_FGA_CODE_FK_PK   = t1.FGASP_FGA_CODE_FK_PK"
                     " AND    t1.FGASP_SP_CODE_FK_PK      = '"+ QString::number( CodeId ) +"'"
                     " AND    t1.FGASP_FGA_CODE_FK_PK     = '"+ QString::number( Codefic ) +"' ;";

       } else if ( TypId == 3) {            // -- Recommandations
                sql_query += " SELECT t3.CDF_NOM   AS TEXTFP"
                     " FROM   fgasp_gralspe              t1,"
                     " fgarifap_risquefemmeenage  t2,"
                     " cdf_codif                  t3"
                     " WHERE  t2.FGARIFAP_FGA_CODE_FK_PK     = t1.FGASP_FGA_CODE_FK_PK"
                     " AND    t2.FGARIFAP_CDF_RI_CODE_FK_PK  = t3.CDF_CODE_PK"
                     " AND    t3.CDF_NUMERO_PK               = 'GR'"
                     " AND    t1.FGASP_SP_CODE_FK_PK         = '"+ QString::number( CodeId ) +"'"
                     " AND    t1.FGASP_FGA_CODE_FK_PK        = '"+ QString::number( Codefic ) +"' ;";

       } else if ( TypId == 4) {           // -- Texte Recommandation
                sql_query += " SELECT t2.FGATX9_TEXTE AS TEXTFP"
                     " FROM   fgasp_gralspe                t1,"
                     " fgatx9_fga_txrecommandat            t2"
                     " WHERE  t2.FGATX9_FGA_CODE_FK_PK     = t1.FGASP_FGA_CODE_FK_PK"
                     " AND    t1.FGASP_SP_CODE_FK_PK       = '"+ QString::number( CodeId ) +"'"
                     " AND    t1.FGASP_FGA_CODE_FK_PK      = '"+ QString::number( Codefic ) +"' ;";

       } else if ( TypId == 5) {    // -- Référence officielle
                sql_query +=
                     " SELECT DISTINCT concat(t4.CDF_NOM,' ',t3.FGAAFS_DATE_PK)   AS TEXTFP"
                     " FROM   fga_fichegral      t1 ,"
                     " fgasp_gralspe      t2 ,"
                     " fgaafs_fga_afssaps t3 ,"
                     " cdf_codif          t4"
                     " WHERE  t1.FGA_CODE_SQ_PK            = t2.FGASP_FGA_CODE_FK_PK"
                     " AND    t2.FGASP_SP_CODE_FK_PK       = t3.FGAAFS_SP_CODE_FK_PK"
                     " AND    t3.FGAAFS_TYPEGRAL_PK        = 'G'"
                     " AND    t3.FGAAFS_DATE_PK            = (SELECT MAX(FGAAFS_DATE_PK)"
                     " FROM   fgaafs_fga_afssaps"
                     " WHERE  FGAAFS_SP_CODE_FK_PK   = '"+ QString::number( CodeId ) +"'"
                     " AND    FGAAFS_FGA_CODE_FK_PK  = '"+ QString::number( Codefic ) +"')"
                     " AND    t3.FGAAFS_CDF_DOCUMENT_FK_PK = t4.CDF_CODE_PK"
                     " AND    t4.CDF_NUMERO_PK             = '25'"
                     " AND    t2.FGASP_SP_CODE_FK_PK       = '"+ QString::number( CodeId ) +"'"
                     " AND    t2.FGASP_FGA_CODE_FK_PK      = '"+ QString::number( Codefic ) +"' ;";
       }
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_FPRO_SPE() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_TEXTFP = value(0).toString();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      QString TEXTFP() {return m_TEXTFP;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      QString m_TEXTFP;
 };

 //================================== C_GET_THE_CINETIQUE_SPE_CUR   -82- ==================================
 /****************************************************************************
 *   Nom           :  GET_THE_CINETIQUE_SPE
 -----------------------------------------------------------------------------
 *   Date creation : 10/09/2008
 -----------------------------------------------------------------------------
 *   Description   :  Cette procédure renvoie la fiche pharmacocinétique répondant
 *                    au code identifiant spécialité passé en paramètre.
 *   MAJ           :  25/09/2008
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_CINETIQUE_SPE_CUR  C_GET_THE_CINETIQUE_SPE ( database(), this );
      while ( C_GET_THE_CINETIQUE_SPE.next( CodeId  ) )
            { html += tr("<br><b> GET_THE_CINETIQUE_SPE : </b>  ") + C_GET_THE_CINETIQUE_SPE.MEMBER();
            }
  */
  class C_GET_THE_CINETIQUE_SPE_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_CINETIQUE_SPE_CUR ---------------------
      C_GET_THE_CINETIQUE_SPE_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( double CodeId )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............
                sql_query += " SELECT t1.FPHCO_CODE_SQ_PK  CODEPHARMACO  ,"
                     " t3.FPHCOAFS_DATE_PK  DTREF       ,"
                     " t1.FPHCO_TXT         PHARMACOTEXT  ,"
                     " t4.CDF_NOM           REFOFFICIELLE"
                     " FROM   fphco_pharmacocinetique  t1 ,"
                     " fphcosp_pharmacocin_spec t2 ,"
                     " fphcoafs_fphco_afssaps   t3 ,"
                     " cdf_codif                t4"
                     " WHERE  t1.FPHCO_CODE_SQ_PK          = t2.FPHCOSP_FPHCO_CODE_FK_PK"
                     " AND    t2.FPHCOSP_SP_CODE_FK_PK     = t3.FPHCOAFS_SP_CODE_FK_PK"
                     " AND    t2.FPHCOSP_FPHCO_CODE_FK_PK  = t3.FPHCOAFS_FPHCO_CODE_FK_PK"
                     " AND    t3.FPHCOAFS_DATE_PK      = ( SELECT MAX(FPHCOAFS_DATE_PK)"
                     " FROM   fphcoafs_fphco_afssaps,"
                     " fphcosp_pharmacocin_spec"
                     " WHERE  FPHCOAFS_SP_CODE_FK_PK    = '"+ QString::number( CodeId ) +"'"
                     " AND    FPHCOSP_FPHCO_CODE_FK_PK = FPHCOAFS_FPHCO_CODE_FK_PK"
                     " AND    FPHCOSP_SP_CODE_FK_PK    = FPHCOAFS_SP_CODE_FK_PK   )"
                     " AND    t3.FPHCOAFS_CDF_DOCUMENT_FK_PK = t4.CDF_CODE_PK"
                     " AND    t4.CDF_NUMERO_PK               = '25'"
                     " AND    t2.FPHCOSP_SP_CODE_FK_PK        = '"+ QString::number( CodeId ) +"'"
                     " ORDER BY 1 ;";
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_CINETIQUE_SPE() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_CODEPHARMACO  = value(0).toDouble();
                m_DTREF         = value(1).toDate();
                m_PHARMACOTEXT  = value(2).toString();
                m_REFOFFICIELLE = value(3).toString();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      double  CODEPHARMACO()               {return m_CODEPHARMACO;}
      QDate   DTREF()                      {return m_DTREF;}
      QString DTREF(const QString &format) {return m_DTREF.toString(format);}
      QString PHARMACOTEXT()               {return m_PHARMACOTEXT;}
      QString REFOFFICIELLE()              {return m_REFOFFICIELLE;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      double  m_CODEPHARMACO;
      QDate   m_DTREF;
      QString m_PHARMACOTEXT;
      QString m_REFOFFICIELLE;
 };

 //================================== C_GET_THE_SECUPRECLINIQUE_SPE_CUR   -83- ==================================
 /****************************************************************************
 *   Nom           :  GET_THE_SECUPRECLINIQUE_SPE
 -----------------------------------------------------------------------------
 *   Date creation : 10/09/2008
 -----------------------------------------------------------------------------
 *   Description   :  Cette procédure renvoie les données de sécurité préclinique
 *                    d'une spécialité donnée en paramètre.
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_SECUPRECLINIQUE_SPE_CUR  C_GET_THE_SECUPRECLINIQUE_SPE ( database(), this );
      while ( C_GET_THE_SECUPRECLINIQUE_SPE.next( CodeId  ) )
            { html += tr("<br><b> GET_THE_SECUPRECLINIQUE_SPE : </b>  ") + C_GET_THE_SECUPRECLINIQUE_SPE.MEMBER();
            }
  */
  class C_GET_THE_SECUPRECLINIQUE_SPE_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_SECUPRECLINIQUE_SPE_CUR ---------------------
      C_GET_THE_SECUPRECLINIQUE_SPE_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( double CodeId )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............
                sql_query +=
                     " SELECT t1.FPRCL_CODE_SQ_PK      AS CODEFIC   ,"
                     " t1.FPRCL_TXT                    AS TEXTFIC   ,"
                     " t1.FPRCL_DATECR                 AS DATECRE   ,"
                     " t1.FPRCL_DATEMJ                 AS DATEMAJ"
                     " FROM   fprcl_secpreclin         t1 ,"
                     " fprclsp_secpreclin_spec         t2"
                     " WHERE  t1.FPRCL_CODE_SQ_PK       = t2.FPRCLSP_FPRCL_CODE_FK_PK"
                     " AND    t2.FPRCLSP_SP_CODE_FK_PK  = '"+ QString::number( CodeId ) +"'"
                     " ORDER BY 1 ;";
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_SECUPRECLINIQUE_SPE() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_MY_CODEFIC = value(0).toDouble();
                m_MY_TEXTFIC = value(1).toString();
                m_MY_DATECRE = value(2).toDate();
                m_MY_DATEMAJ = value(3).toDate();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      double  MY_CODEFIC() {return m_MY_CODEFIC;}
      QString MY_TEXTFIC() {return m_MY_TEXTFIC;}
      QDate   MY_DATECRE() {return m_MY_DATECRE;}
      QString MY_DATECRE(const QString &format) {return m_MY_DATECRE.toString(format);}
      QDate   MY_DATEMAJ() {return m_MY_DATEMAJ;}
      QString MY_DATEMAJ(const QString &format) {return m_MY_DATEMAJ.toString(format);}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      double  m_MY_CODEFIC;
      QString m_MY_TEXTFIC;
      QDate   m_MY_DATECRE;
      QDate   m_MY_DATEMAJ;
 };

 //================================== C_GET_THE_REF_SECUPRECLINIQUE_CUR   -84- ==================================
 /****************************************************************************
 *   Nom           :  GET_THE_REF_SECUPRECLINIQUE
 -----------------------------------------------------------------------------
 *   Date creation : 10/09/2008
 -----------------------------------------------------------------------------
 *   Description   :  Cette procédure renvoie les données de sécurité préclinique
 *                    d'une spécialité donnée en paramètre pour une fiche donnée.
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_REF_SECUPRECLINIQUE_CUR  C_GET_THE_REF_SECUPRECLINIQUE ( database(), this );
      while ( C_GET_THE_REF_SECUPRECLINIQUE.next( CodeId , CodeFic  ) )
            { html += tr("<br><b> GET_THE_REF_SECUPRECLINIQUE : </b>  ") + C_GET_THE_REF_SECUPRECLINIQUE.MEMBER();
            }
  */
  class C_GET_THE_REF_SECUPRECLINIQUE_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_REF_SECUPRECLINIQUE_CUR ---------------------
      C_GET_THE_REF_SECUPRECLINIQUE_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( double CodeId , double CodeFic )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............
                sql_query +=
                     " SELECT t2.CDF_NOM              REFOFF  ,"
                     " t1.FPRCLAFS_DATE_PK            DATEREF"
                     " FROM   fprclafs_fprcl_afssaps  t1 ,"
                     " cdf_codif                      t2"
                     " WHERE  t1.FPRCLAFS_DATE_PK     = (SELECT MAX(FPRCLAFS_DATE_PK)"
                     " FROM   fprclafs_fprcl_afssaps"
                     " WHERE  FPRCLAFS_SP_CODE_FK_PK           = '"+ QString::number( CodeId ) +"'"
                     " AND    FPRCLAFS_FPRCL_CODE_FK_PK        = '"+ QString::number( CodeFic ) +"')"
                     " AND    t1.FPRCLAFS_CDF_DOCUMENT_FK_PK   = t2.CDF_CODE_PK"
                     " AND    t2.CDF_NUMERO_PK                 = '25'"
                     " AND    t1.FPRCLAFS_SP_CODE_FK_PK        = '"+ QString::number( CodeId ) +"'"
                     " AND    t1.FPRCLAFS_FPRCL_CODE_FK_PK     = '"+ QString::number( CodeFic ) +"' ;";
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_REF_SECUPRECLINIQUE() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_MY_REFOFF  = value(0).toString();
                m_MY_DATEREF = value(1).toDate();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      QString MY_REFOFF()                       {return m_MY_REFOFF;}
      QDate   MY_DATEREF()                      {return m_MY_DATEREF;}
      QString MY_DATEREF(const QString &format) {return m_MY_DATEREF.toString(format);}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      QString m_MY_REFOFF;
      QDate   m_MY_DATEREF;
 };

 //================================== C_GET_THE_RECADM_SPE_CUR   -85- ==================================
 /****************************************************************************
 *   Nom           :  GET_THE_RECADM_SPE
 -----------------------------------------------------------------------------
 *   Date creation : 10/09/2008
 -----------------------------------------------------------------------------
 *   Description   :  Cette procédure renvoie les fiches de reconstitution administration
 *                    répondant au code identifiant spécialité passé en paramètre.
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_RECADM_SPE_CUR  C_GET_THE_RECADM_SPE ( database(), this );
      while ( C_GET_THE_RECADM_SPE.next( CodeId  ) )
            { html += tr("<br><b> GET_THE_RECADM_SPE : </b>  ") + C_GET_THE_RECADM_SPE.MEMBER();
            }
  */
  class C_GET_THE_RECADM_SPE_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_RECADM_SPE_CUR ---------------------
      C_GET_THE_RECADM_SPE_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( double CodeId )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............

 //+  SELECT t1.FRECSP_FREC_CODE_FK_PK   FICID
 //+  FROM   FRECSP_RECONST_SPEC  t1
 //+  WHERE  t1.FRECSP_SP_CODE_FK_PK  = CodeId
 //+  ORDER BY 1 ;
                sql_query +=
                     " SELECT t1.FRECSP_FREC_CODE_FK_PK   FICID"
                     " FROM   frecsp_reconst_spec  t1"
                     " WHERE  t1.FRECSP_SP_CODE_FK_PK   = '"+ QString::number( CodeId ) +"'"
                     " ORDER BY 1 ;";
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_RECADM_SPE() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_FICID = value(0).toDouble();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      double  FICID() {return m_FICID;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      double  m_FICID;
 };

 //================================== C_GET_THE_RECADM_ID_CUR   -86- ==================================
 /****************************************************************************
 *   Nom           :  GET_THE_RECADM_ID
 -----------------------------------------------------------------------------
 *   Date creation : 10/09/2008
 -----------------------------------------------------------------------------
 *   Description   :  Cette procédure renvoie la fiche reconstitution administration
 *                    répondant au code identifiant spécialité passé en paramètre.
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_RECADM_ID_CUR  C_GET_THE_RECADM_ID ( database(), this );
      while ( C_GET_THE_RECADM_ID.next( CodeId , FicId , TypId  ) )
            { html += tr("<br><b> GET_THE_RECADM_ID : </b>  ") + C_GET_THE_RECADM_ID.MEMBER();
            }
  */
  class C_GET_THE_RECADM_ID_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_RECADM_ID_CUR ---------------------
      C_GET_THE_RECADM_ID_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( double CodeId , double FicId , double TypId )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............
       if ( TypId == 1) {            // -- Mode administration

 //+   SELECT t3.CDF_NOM      AS TEXTRECADM,
 //+      NULL          AS DTRECADM
 //+   FROM   FRECSP_RECONST_SPEC   t1,
 //+      FRECCOA_FREC_COMADM   t2,
 //+      CDF_CODIF             t3
 //+   WHERE  t1.FRECSP_FREC_CODE_FK_PK   = t2.FRECCOA_FREC_CODE_FK_PK
 //+   AND    t2.FRECCOA_CDF_COMADM_FK_PK = t3.CDF_CODE_PK
 //+   AND    t3.CDF_NUMERO_PK            = 'RC'
 //+   AND    t1.FRECSP_SP_CODE_FK_PK     = CodeId
 //+   AND    t1.FRECSP_FREC_CODE_FK_PK   = FicId
 //+   ORDER BY FRECCOA_NUM_ORD_PK  ;
                sql_query +=
                     " SELECT t3.CDF_NOM            AS TEXTRECADM,"
                     " NULL                         AS DTRECADM"
                     " FROM   frecsp_reconst_spec   t1,"
                     " freccoa_frec_comadm          t2,"
                     " cdf_codif                    t3"
                     " WHERE  t1.FRECSP_FREC_CODE_FK_PK   = t2.FRECCOA_FREC_CODE_FK_PK"
                     " AND    t2.FRECCOA_CDF_COMADM_FK_PK = t3.CDF_CODE_PK"
                     " AND    t3.CDF_NUMERO_PK            = 'RC'"
                     " AND    t1.FRECSP_SP_CODE_FK_PK     = '"+ QString::number( CodeId ) +"'"
                     " AND    t1.FRECSP_FREC_CODE_FK_PK   = '"+ QString::number( FicId ) +"'"
                     " ORDER BY FRECCOA_NUM_ORD_PK  ;";

       } else if ( TypId == 2) {           // -- Texte mode Administration

 //+   SELECT t2.FRECTXA_TXTADM    AS TEXTRECADM,
 //+      NULL               AS   DTRECADM
 //+   FROM   FRECSP_RECONST_SPEC   t1,
 //+      FRECTXA_FREC_TXTADM   t2
 //+   WHERE  t1.FRECSP_FREC_CODE_FK_PK   = t2.FRECTXA_FREC_CODE_FK_PK
 //+   AND    t1.FRECSP_SP_CODE_FK_PK     = CodeId
 //+   AND    t1.FRECSP_FREC_CODE_FK_PK   = FicId ;
                sql_query +=
                     " SELECT t2.FRECTXA_TXTADM     AS TEXTRECADM,"
                     " NULL                         AS   DTRECADM"
                     " FROM   frecsp_reconst_spec   t1,"
                     " frectxa_frec_txtadm          t2"
                     " WHERE  t1.FRECSP_FREC_CODE_FK_PK    = t2.FRECTXA_FREC_CODE_FK_PK"
                     " AND    t1.FRECSP_SP_CODE_FK_PK      = '"+ QString::number( CodeId ) +"'"
                     " AND    t1.FRECSP_FREC_CODE_FK_PK    = '"+ QString::number( FicId )  +"';";

       } else if ( TypId == 3) {         // -- Reference officielle

 //+   SELECT t2.CDF_NOM           AS TEXTRECADM  ,
 //+      t1.FRECAFS_DATE_PK  AS  DTRECADM
 //+   FROM   FRECAFS_FREC_AFSSAPS  t1 ,
 //+      CDF_CODIF             t2
 //+   WHERE  t1.FRECAFS_DATE_PK           = (SELECT MAX(FRECAFS_DATE_PK)
 //+                FROM   FRECAFS_FREC_AFSSAPS
 //+                WHERE  FRECAFS_SP_CODE_FK_PK     =  CodeId
 //+                AND    FRECAFS_FREC_CODE_FK_PK   =  FicId  )
 //+   AND    t1.FRECAFS_CDF_DOCUMENT_FK_PK  = t2.CDF_CODE_PK
 //+   AND    t2.CDF_NUMERO_PK               = '25'
 //+   AND    t1.FRECAFS_SP_CODE_FK_PK       = CodeId
 //+   AND    t1.FRECAFS_FREC_CODE_FK_PK     = FicId ;
                sql_query +=
                     " SELECT t2.CDF_NOM           AS TEXTRECADM  ,"
                     " t1.FRECAFS_DATE_PK          AS  DTRECADM"
                     " FROM   frecafs_frec_afssaps  t1 ,"
                     " cdf_codif             t2"
                     " WHERE  t1.FRECAFS_DATE_PK             = (SELECT MAX(FRECAFS_DATE_PK)"
                     "                                          FROM   frecafs_frec_afssaps"
                     "                                          WHERE  FRECAFS_SP_CODE_FK_PK  = '"+ QString::number( CodeId ) +"'"
                     "                                          AND    FRECAFS_FREC_CODE_FK_PK        = '"+ QString::number( FicId ) +"' )"
                     " AND    t1.FRECAFS_CDF_DOCUMENT_FK_PK  = t2.CDF_CODE_PK"
                     " AND    t2.CDF_NUMERO_PK               = '25'"
                     " AND    t1.FRECAFS_SP_CODE_FK_PK       = '"+ QString::number( CodeId ) +"'"
                     " AND    t1.FRECAFS_FREC_CODE_FK_PK     = '"+ QString::number( FicId ) +"' ;";

       } else if ( TypId == 4) {    // -- Texte recommandation utilisation,manipulation et elimination

 //+   SELECT t2.FRECTXR_TXTRECS    AS TEXTRECADM,
 //+      NULL                AS   DTRECADM
 //+   FROM   FRECSP_RECONST_SPEC    t1,
 //+      FRECTXR_FREC_TXTRECS   t2
 //+   WHERE  t1.FRECSP_FREC_CODE_FK_PK   = t2.FRECTXR_FREC_CODE_FK_PK
 //+   AND    t1.FRECSP_SP_CODE_FK_PK     = CodeId
 //+   AND    t1.FRECSP_FREC_CODE_FK_PK   = FicId ;
                sql_query +=
                     " SELECT t2.FRECTXR_TXTRECS    AS TEXTRECADM,"
                     " NULL                         AS   DTRECADM"
                     " FROM   frecsp_reconst_spec    t1,"
                     " frectxr_frec_txtrecs   t2"
                     " WHERE  t1.FRECSP_FREC_CODE_FK_PK   = t2.FRECTXR_FREC_CODE_FK_PK"
                     " AND    t1.FRECSP_SP_CODE_FK_PK      = '"+ QString::number( CodeId ) +"'"
                     " AND    t1.FRECSP_FREC_CODE_FK_PK    = '"+ QString::number( FicId ) +"' ;";

       } else if ( TypId == 5) {     // -- Recommandation utilisation,manipulation et elimination

 //+   SELECT t3.CDF_NOM    AS  TEXTRECADM,
 //+      NULL        AS    DTRECADM
 //+   FROM   FRECSP_RECONST_SPEC    t1,
 //+      FRECCOR_FREC_COMRECS   t2,
 //+      CDF_CODIF              t3
 //+   WHERE  t1.FRECSP_FREC_CODE_FK_PK    = t2.FRECCOR_FREC_CODE_FK_PK
 //+   AND    t2.FRECCOR_CDF_COMRECS_FK_PK = t3.CDF_CODE_PK
 //+   AND    t3.CDF_NUMERO_PK             = 'RC'
 //+   AND    t1.FRECSP_SP_CODE_FK_PK      = CodeId
 //+   AND    t1.FRECSP_FREC_CODE_FK_PK    = FicId
 //+   ORDER BY t2.FRECCOR_NUM_ORD_PK  ;
                sql_query +=
                     " SELECT t3.CDF_NOM    AS  TEXTRECADM,"
                     " NULL                 AS    DTRECADM"
                     " FROM   frecsp_reconst_spec    t1,"
                     " freccor_frec_comrecs   t2,"
                     " cdf_codif              t3"
                     " WHERE  t1.FRECSP_FREC_CODE_FK_PK    = t2.FRECCOR_FREC_CODE_FK_PK"
                     " AND    t2.FRECCOR_CDF_COMRECS_FK_PK = t3.CDF_CODE_PK"
                     " AND    t3.CDF_NUMERO_PK             = 'RC'"
                     " AND    t1.FRECSP_SP_CODE_FK_PK       = '"+ QString::number( CodeId ) +"'"
                     " AND    t1.FRECSP_FREC_CODE_FK_PK     = '"+ QString::number( FicId ) +"'"
                     " ORDER BY t2.FRECCOR_NUM_ORD_PK  ;";

       }
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_RECADM_ID() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_TEXTRECADM = value(0).toString();
                m_DTRECADM   = value(1).toDate();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      QString TEXTRECADM()                      {return m_TEXTRECADM;}
      QDate   DTRECADM()                        {return m_DTRECADM;}
      QString DTRECADM(const QString &format)   {return m_DTRECADM.toString(format);}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      QString m_TEXTRECADM;
      QDate   m_DTRECADM;
 };

 //================================== C_GET_THE_EFFIND_SPE_CUR   -87- ==================================
 /****************************************************************************
 *   Nom           :  GET_THE_EFFIND_SPE
 -----------------------------------------------------------------------------
 *   Date creation : 11/09/2008
 -----------------------------------------------------------------------------
 *   Description   :  Cette procédure renvoie les effets indésirables répondant
 *                    au code spécialité, le deuxième paramètre indique la catégorie, effets indésirables
 *                    cliniques, effets indésirables para cliniques, effets indésirables cliniques en cas
 *                    de surdosage, effets indésirables para cliniques en cas de surdosage.
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_EFFIND_SPE_CUR  C_GET_THE_EFFIND_SPE ( database(), this );
      while ( C_GET_THE_EFFIND_SPE.next( CodeId , TypId  ) )
            { html += tr("<br><b> GET_THE_EFFIND_SPE : </b>  ") + C_GET_THE_EFFIND_SPE.MEMBER();
            }
  */
  class C_GET_THE_EFFIND_SPE_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_EFFIND_SPE_CUR ---------------------
      C_GET_THE_EFFIND_SPE_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( double CodeId , double TypId )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............
       if ( TypId == 1) {           // -- 1 clinique

 //+   SELECT t1.FEISP_FEI_CODE_FK_PK    AS CODEEFFIND  ,
 //+      t3.CDF_NOM               AS TEXTEFFET
 //+   FROM   FEISP_EFFINDSPE           t1  ,
 //+      FEINACT_NATURETHER_EICLIN t2  ,
 //+      CDF_CODIF                 t3
 //+   WHERE  t1.FEISP_FEI_CODE_FK_PK         = t2.FEINACT_FEI_CODE_FK_PK
 //+   AND    t2.FEINACT_CDF_NAEI_CODE_FK_PK  = t3.CDF_CODE_PK
 //+   AND    t3.CDF_NUMERO_PK                = 'EN'
 //+   AND    t1.FEISP_SP_CODE_FK_PK          = CodeId
 //+   ORDER BY t2.FEINACT_FEI_CODE_FK_PK ,t2.FEINACT_NUMORD ;
                sql_query += " SELECT t1.FEISP_FEI_CODE_FK_PK    AS CODEEFFIND  ,"
                     " t3.CDF_NOM               AS TEXTEFFET"
                     " FROM   feisp_effindspe           t1  ,"
                     " feinact_naturether_eiclin t2  ,"
                     " cdf_codif                 t3"
                     " WHERE  t1.FEISP_FEI_CODE_FK_PK         = t2.FEINACT_FEI_CODE_FK_PK"
                     " AND    t2.FEINACT_CDF_NAEI_CODE_FK_PK  = t3.CDF_CODE_PK"
                     " AND    t3.CDF_NUMERO_PK                = 'EN'"
                     " AND    t1.FEISP_SP_CODE_FK_PK           = '"+ QString::number( CodeId ) +"'"
                     " ORDER BY t2.FEINACT_FEI_CODE_FK_PK ,t2.FEINACT_NUMORD ;";

       } else if ( TypId == 2) {           // -- 2 paraclinique

 //+   SELECT t1.FEISP_FEI_CODE_FK_PK  AS CODEEFFIND  ,
 //+      t3.CDF_NOM             AS TEXTEFFET
 //+   FROM   FEISP_EFFINDSPE               t1  ,
 //+      FEINAPT_NATURTHER_EIPARACLIN  t2  ,
 //+      CDF_CODIF                     t3
 //+   WHERE  t1.FEISP_FEI_CODE_FK_PK         = t2.FEINAPT_FEI_CODE_FK_PK
 //+   AND    t2.FEINAPT_CDF_NAEI_CODE_FK_PK  = t3.CDF_CODE_PK
 //+   AND    t3.CDF_NUMERO_PK                = 'EN'
 //+   AND    t1.FEISP_SP_CODE_FK_PK          = CodeId
 //+   ORDER BY t2.FEINAPT_FEI_CODE_FK_PK ,t2.FEINAPT_NUMORD ;
                sql_query += " SELECT t1.FEISP_FEI_CODE_FK_PK  AS CODEEFFIND  ,"
                     " t3.CDF_NOM             AS TEXTEFFET"
                     " FROM   feisp_effindspe               t1  ,"
                     " feinapt_naturther_eiparaclin  t2  ,"
                     " cdf_codif                     t3"
                     " WHERE  t1.FEISP_FEI_CODE_FK_PK         = t2.FEINAPT_FEI_CODE_FK_PK"
                     " AND    t2.FEINAPT_CDF_NAEI_CODE_FK_PK  = t3.CDF_CODE_PK"
                     " AND    t3.CDF_NUMERO_PK                = 'EN'"
                     " AND    t1.FEISP_SP_CODE_FK_PK           = '"+ QString::number( CodeId ) +"'"
                     " ORDER BY t2.FEINAPT_FEI_CODE_FK_PK ,t2.FEINAPT_NUMORD ;";

       } else if ( TypId == 3) {         // -- clinique en cas de surdosage

 //+     SELECT t1.FEISP_FEI_CODE_FK_PK  AS CODEEFFIND  ,
 //+      t3.CDF_NOM            AS TEXTEFFET
 //+   FROM   FEISP_EFFINDSPE               t1  ,
 //+      FEINACS_NATURSURDOS_EICLIN    t2  ,
 //+      CDF_CODIF                     t3
 //+   WHERE  t1.FEISP_FEI_CODE_FK_PK         = t2.FEINACS_FEI_CODE_FK_PK
 //+   AND    t2.FEINACS_CDF_NAEI_CODE_FK_PK  = t3.CDF_CODE_PK
 //+   AND    t3.CDF_NUMERO_PK                = 'EN'
 //+   AND    t1.FEISP_SP_CODE_FK_PK          = CodeId
 //+   ORDER BY t2.FEINACS_FEI_CODE_FK_PK ,t2.FEINACS_NUMORD ;
                sql_query += " SELECT t1.FEISP_FEI_CODE_FK_PK  AS CODEEFFIND  ,"
                     " t3.CDF_NOM            AS TEXTEFFET"
                     " FROM   feisp_effindspe               t1  ,"
                     " feinacs_natursurdos_eiclin    t2  ,"
                     " cdf_codif                     t3"
                     " WHERE  t1.FEISP_FEI_CODE_FK_PK         = t2.FEINACS_FEI_CODE_FK_PK"
                     " AND    t2.FEINACS_CDF_NAEI_CODE_FK_PK  = t3.CDF_CODE_PK"
                     " AND    t3.CDF_NUMERO_PK                = 'EN'"
                     " AND    t1.FEISP_SP_CODE_FK_PK           = '"+ QString::number( CodeId ) +"'"
                     " ORDER BY t2.FEINACS_FEI_CODE_FK_PK ,t2.FEINACS_NUMORD ;";

       } else if ( TypId == 4) {            // para clinique en cas de surdosage

 //+     SELECT t1.FEISP_FEI_CODE_FK_PK  AS CODEEFFIND  ,
 //+      t3.CDF_NOM            AS TEXTEFFET
 //+    FROM  FEISP_EFFINDSPE                 t1  ,
 //+      FEINAPS_NATURSURDOS_EIPARACLIN  t2  ,
 //+      CDF_CODIF                       t3
 //+   WHERE  t1.FEISP_FEI_CODE_FK_PK         = t2.FEINAPS_FEI_CODE_FK_PK
 //+   AND    t2.FEINAPS_CDF_NAEI_CODE_FK_PK  = t3.CDF_CODE_PK
 //+   AND    t3.CDF_NUMERO_PK                = 'EN'
 //+   AND    t1.FEISP_SP_CODE_FK_PK          = CodeId
 //+   ORDER BY t2.FEINAPS_FEI_CODE_FK_PK ,t2.FEINAPS_NUMORD ;
                sql_query += " SELECT t1.FEISP_FEI_CODE_FK_PK  AS CODEEFFIND  ,"
                     " t3.CDF_NOM            AS TEXTEFFET"
                     " FROM  feisp_effindspe                 t1  ,"
                     " feinaps_natursurdos_eiparaclin  t2  ,"
                     " cdf_codif                       t3"
                     " WHERE  t1.FEISP_FEI_CODE_FK_PK         = t2.FEINAPS_FEI_CODE_FK_PK"
                     " AND    t2.FEINAPS_CDF_NAEI_CODE_FK_PK  = t3.CDF_CODE_PK"
                     " AND    t3.CDF_NUMERO_PK                = 'EN'"
                     " AND    t1.FEISP_SP_CODE_FK_PK           = '"+ QString::number( CodeId ) +"'"
                     " ORDER BY t2.FEINAPS_FEI_CODE_FK_PK ,t2.FEINAPS_NUMORD ;";

       }
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_EFFIND_SPE() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_CODEEFFIND = value(0).toDouble();
                m_TEXTEFFET  = value(1).toString();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      double  CODEEFFIND() {return m_CODEEFFIND;}
      QString TEXTEFFET()  {return m_TEXTEFFET;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      double  m_CODEEFFIND;
      QString m_TEXTEFFET;
 };

 //================================== C_GET_THE_DET_EFFIND_CUR   -88- ==================================
 /****************************************************************************
 *   Nom           :  GET_THE_DET_EFFIND
 -----------------------------------------------------------------------------
 *   Date creation : 11/09/2008
 -----------------------------------------------------------------------------
 *   Description   :  Cette procédure renvoie le détail pour la fiche effet indésirable
 *                    dont le code est passé en paramètre, et deuxième paramètre permet d¿indiquer
 *                    l¿information souhaitée.
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_DET_EFFIND_CUR  C_GET_THE_DET_EFFIND ( database(), this );
      while ( C_GET_THE_DET_EFFIND.next( CodeInd , TypId  ) )
            { html += tr("<br><b> GET_THE_DET_EFFIND : </b>  ") + C_GET_THE_DET_EFFIND.MEMBER();
            }
  */
  class C_GET_THE_DET_EFFIND_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_DET_EFFIND_CUR ---------------------
      C_GET_THE_DET_EFFIND_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( double CodeInd , double TypId )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............
       if ( TypId == 1) {           //-- terrain favorisant

 //+   SELECT t1.FEITER_CDF_TER_CODE_FK_PK    AS CODEIND  ,
 //+      t2.CDF_NOM                    AS LIBIND
 //+   FROM   FEITER_TERRAINFAVORISANT     t1  ,
 //+      CDF_CODIF                    t2
 //+   WHERE  t1.FEITER_CDF_TER_CODE_FK_PK  = t2.CDF_CODE_PK
 //+   AND    t2.CDF_NUMERO_PK              = 'CS'
 //+   AND    t1.FEITER_FEI_CODE_FK_PK      = CodeInd
 //+   ORDER BY t1.FEITER_NUMORD  ;
                sql_query += " SELECT t1.FEITER_CDF_TER_CODE_FK_PK    AS CODEIND  ,"
                     " t2.CDF_NOM                    AS LIBIND"
                     " FROM   feiter_terrainfavorisant     t1  ,"
                     " cdf_codif                    t2"
                     " WHERE  t1.FEITER_CDF_TER_CODE_FK_PK  = t2.CDF_CODE_PK"
                     " AND    t2.CDF_NUMERO_PK              = 'CS'"
                     " AND    t1.FEITER_FEI_CODE_FK_PK       = '"+ QString::number( CodeInd ) +"'"
                     " ORDER BY t1.FEITER_NUMORD  ;";

       } else if (  TypId == 2) {    // -- autres circonstances favorisantes

 //+     SELECT t1.FEICF_CDF_COEI_CODE_FK_PK    AS CODEIND  ,
 //+        t2.CDF_NOM                    AS LIBIND
 //+   FROM   FEICF_COMMENT_CIRCONSTFAVORIS      t1  ,
 //+        CDF_CODIF                          t2
 //+   WHERE  t1.FEICF_CDF_COEI_CODE_FK_PK  = t2.CDF_CODE_PK
 //+   AND    t2.CDF_NUMERO_PK              = 'EC'
 //+   AND    t1.FEICF_FEI_CODE_FK_PK      = CodeInd
 //+   ORDER BY t1.FEICF_NUMORD ;
                sql_query += " SELECT t1.FEICF_CDF_COEI_CODE_FK_PK    AS CODEIND  ,"
                     " t2.CDF_NOM                    AS LIBIND"
                     " FROM   feicf_comment_circonstfavoris      t1  ,"
                     " cdf_codif                          t2"
                     " WHERE  t1.FEICF_CDF_COEI_CODE_FK_PK  = t2.CDF_CODE_PK"
                     " AND    t2.CDF_NUMERO_PK              = 'EC'"
                     " AND    t1.FEICF_FEI_CODE_FK_PK       = '"+ QString::number( CodeInd ) +"'"
                     " ORDER BY t1.FEICF_NUMORD ;";

       } else if (  TypId == 3) {   // -- moment survenue

 //+        SELECT t1.FEIMS_CDF_COEI_CODE_FK_PK    AS CODEIND  ,
 //+        t2.CDF_NOM                    AS LIBIND
 //+   FROM   FEIMS_COMMENT_MOMENTSURV           t1  ,
 //+        CDF_CODIF                          t2
 //+   WHERE  t1.FEIMS_CDF_COEI_CODE_FK_PK  = t2.CDF_CODE_PK
 //+   AND    t2.CDF_NUMERO_PK              = 'EC'
 //+   AND    t1.FEIMS_FEI_CODE_FK_PK       = CodeInd
 //+   ORDER BY t1.FEIMS_NUMORD ;
                sql_query += " SELECT t1.FEIMS_CDF_COEI_CODE_FK_PK    AS CODEIND  ,"
                     " t2.CDF_NOM                    AS LIBIND"
                     " FROM   feims_comment_momentsurv           t1  ,"
                     " cdf_codif                          t2"
                     " WHERE  t1.FEIMS_CDF_COEI_CODE_FK_PK  = t2.CDF_CODE_PK"
                     " AND    t2.CDF_NUMERO_PK              = 'EC'"
                     " AND    t1.FEIMS_FEI_CODE_FK_PK        = '"+ QString::number( CodeInd ) +"'"
                     " ORDER BY t1.FEIMS_NUMORD ;";

       } else if (  TypId == 4) {   // -- texte fréquence

 //+   SELECT t1.FEITX4_FEI_CODE_FK_PK    AS CODEIND,
 //+      t1.FEITX4_TEXTE           AS LIBIND
 //+   FROM   FEITX4_EI_TXFREQUENCE t1
 //+   WHERE  t1.FEITX4_FEI_CODE_FK_PK = CodeInd ;
                sql_query += " SELECT t1.FEITX4_FEI_CODE_FK_PK    AS CODEIND,"
                     " t1.FEITX4_TEXTE           AS LIBIND"
                     " FROM   feitx4_ei_txfrequence t1"
                     " WHERE  t1.FEITX4_FEI_CODE_FK_PK  = '"+ QString::number( CodeInd ) +"' ;";

       } else if (  TypId == 5) {   // -- texte survenue

 //+   SELECT t1.FEITX5_FEI_CODE_FK_PK     AS CODEIND,
 //+      t1.FEITX5_TEXTE            AS LIBIND
 //+   FROM   FEITX5_EI_TXSURVENUE t1
 //+   WHERE  t1.FEITX5_FEI_CODE_FK_PK = CodeInd ;
                sql_query += " SELECT t1.FEITX5_FEI_CODE_FK_PK     AS CODEIND,"
                     " t1.FEITX5_TEXTE            AS LIBIND"
                     " FROM   feitx5_ei_txsurvenue t1"
                     " WHERE  t1.FEITX5_FEI_CODE_FK_PK  = '"+ QString::number( CodeInd ) +"' ;";

       } else if (  TypId == 6) {  // -- liste classe chimique

 //+   SELECT t1.FEICCH_CCH_CODE_FK_PK    AS CODEIND,
 //+      t2.CCH_NOM                AS LIBIND
 //+   FROM   FEICCH_EFFINDCLCH    t1,
 //+      CCH_CLASSECHIMIQUE   t2
 //+   WHERE  t2.CCH_CODE_PK = t1.FEICCH_CCH_CODE_FK_PK
 //+   AND    t1.FEICCH_FEI_CODE_FK_PK = CodeInd ;
                sql_query += " SELECT t1.FEICCH_CCH_CODE_FK_PK    AS CODEIND,"
                     " t2.CCH_NOM                AS LIBIND"
                     " FROM   feicch_effindclch    t1,"
                     " cch_classechimique   t2"
                     " WHERE  t2.CCH_CODE_PK = t1.FEICCH_CCH_CODE_FK_PK"
                     " AND    t1.FEICCH_FEI_CODE_FK_PK  = '"+ QString::number( CodeInd ) +"' ;";

       } else if (  TypId == 7) {  // -- texte classe pharmaco

 //+   SELECT t1.CPH_CODE_PK      AS CODEIND,
 //+      t1.CPH_NOM        AS LIBIND
 //+   FROM   CPH_CLASSEPHARMTHER   t1,
 //+      FEICPH_EFFINDCLPH     t2
 //+   WHERE  t1.CPH_CODE_PK = t2.FEICPH_CPH_CODE_FK_PK
 //+   AND    t2.FEICPH_FEI_CODE_FK_PK = CodeInd ;
                sql_query += " SELECT t1.CPH_CODE_PK      AS CODEIND,"
                     " t1.CPH_NOM        AS LIBIND"
                     " FROM   cph_classepharmther   t1,"
                     " feicph_effindclph     t2"
                     " WHERE  t1.CPH_CODE_PK = t2.FEICPH_CPH_CODE_FK_PK"
                     " AND    t2.FEICPH_FEI_CODE_FK_PK  = '"+ QString::number( CodeInd ) +"' ;";

       } else if (  TypId == 8) {   // -- nature(s) des EI cliniques

 //+    SELECT t1.FEINACT_CDF_NAEI_CODE_FK_PK   AS CODEIND  ,
 //+        t2.CDF_NOM                      AS LIBIND
 //+   FROM   FEINACT_NATURETHER_EICLIN          t1  ,
 //+        CDF_CODIF                          t2
 //+   WHERE  t1.FEINACT_CDF_NAEI_CODE_FK_PK  = t2.CDF_CODE_PK
 //+   AND    t2.CDF_NUMERO_PK                = 'EN'
 //+   AND    t1.FEINACT_FEI_CODE_FK_PK       = CodeInd
 //+   ORDER BY t1.FEINACT_NUMORD ;
                sql_query += " SELECT t1.FEINACT_CDF_NAEI_CODE_FK_PK   AS CODEIND  ,"
                     " t2.CDF_NOM                      AS LIBIND"
                     " FROM   feinact_naturether_eiclin          t1  ,"
                     " cdf_codif                          t2"
                     " WHERE  t1.FEINACT_CDF_NAEI_CODE_FK_PK  = t2.CDF_CODE_PK"
                     " AND    t2.CDF_NUMERO_PK                = 'EN'"
                     " AND    t1.FEINACT_FEI_CODE_FK_PK        = '"+ QString::number( CodeInd ) +"'"
                     " ORDER BY t1.FEINACT_NUMORD ;";

       } else if (  TypId == 9) {   // -- nature paraclinique

 //+    SELECT t1.FEINAPT_CDF_NAEI_CODE_FK_PK   AS CODEIND  ,
 //+        t2.CDF_NOM                      AS LIBIND
 //+   FROM   FEINAPT_NATURTHER_EIPARACLIN       t1  ,
 //+        CDF_CODIF                          t2
 //+   WHERE  t1.FEINAPT_CDF_NAEI_CODE_FK_PK  = t2.CDF_CODE_PK
 //+   AND    t2.CDF_NUMERO_PK                = 'EN'
 //+   AND    t1.FEINAPT_FEI_CODE_FK_PK       = CodeInd
 //+   ORDER BY t1.FEINAPT_NUMORD ;
                sql_query += " SELECT t1.FEINAPT_CDF_NAEI_CODE_FK_PK   AS CODEIND  ,"
                     " t2.CDF_NOM                      AS LIBIND"
                     " FROM   feinapt_naturther_eiparaclin       t1  ,"
                     " cdf_codif                          t2"
                     " WHERE  t1.FEINAPT_CDF_NAEI_CODE_FK_PK  = t2.CDF_CODE_PK"
                     " AND    t2.CDF_NUMERO_PK                = 'EN'"
                     " AND    t1.FEINAPT_FEI_CODE_FK_PK        = '"+ QString::number( CodeInd ) +"'"
                     " ORDER BY t1.FEINAPT_NUMORD ;";

       } else if (  TypId == 10) {   // -- commentaire nature

 //+    SELECT t1.FEINA_CDF_COEI_CODE_FK_PK     AS CODEIND  ,
 //+        t2.CDF_NOM                      AS LIBIND
 //+   FROM   FEINA_COMMENT_NATUREDOSETH         t1  ,
 //+        CDF_CODIF                          t2
 //+   WHERE  t1.FEINA_CDF_COEI_CODE_FK_PK = t2.CDF_CODE_PK
 //+   AND    t2.CDF_NUMERO_PK              = 'EC'
 //+   AND    t1.FEINA_FEI_CODE_FK_PK       = CodeInd
 //+   ORDER BY t1.FEINA_NUMORD ;
                sql_query += " SELECT t1.FEINA_CDF_COEI_CODE_FK_PK     AS CODEIND  ,"
                     " t2.CDF_NOM                      AS LIBIND"
                     " FROM   feina_comment_naturedoseth         t1  ,"
                     " cdf_codif                          t2"
                     " WHERE  t1.FEINA_CDF_COEI_CODE_FK_PK = t2.CDF_CODE_PK"
                     " AND    t2.CDF_NUMERO_PK              = 'EC'"
                     " AND    t1.FEINA_FEI_CODE_FK_PK        = '"+ QString::number( CodeInd ) +"'"
                     " ORDER BY t1.FEINA_NUMORD ;";

       } else if (  TypId == 11) {   // -- conduite à tenir

 //+   SELECT t1.FEICT_CDF_COEI_CODE_FK_PK     AS CODEIND  ,
 //+        t2.CDF_NOM                      AS LIBIND
 //+   FROM   FEICT_COMMENT_CATDOSETH            t1  ,
 //+        CDF_CODIF                          t2
 //+   WHERE  t1.FEICT_CDF_COEI_CODE_FK_PK    = t2.CDF_CODE_PK
 //+   AND    t2.CDF_NUMERO_PK                = 'EC'
 //+   AND    t1.FEICT_FEI_CODE_FK_PK         = CodeInd
 //+   ORDER BY t1.FEICT_NUMORD ;
                sql_query += " SELECT t1.FEICT_CDF_COEI_CODE_FK_PK     AS CODEIND  ,"
                     " t2.CDF_NOM                      AS LIBIND"
                     " FROM   feict_comment_catdoseth            t1  ,"
                     " cdf_codif                          t2"
                     " WHERE  t1.FEICT_CDF_COEI_CODE_FK_PK    = t2.CDF_CODE_PK"
                     " AND    t2.CDF_NUMERO_PK                = 'EC'"
                     " AND    t1.FEICT_FEI_CODE_FK_PK          = '"+ QString::number( CodeInd ) +"'"
                     " ORDER BY t1.FEICT_NUMORD ;";

       } else if (  TypId == 12) {   // -- commentaire dose thérapeutique

 //+   SELECT t1.FEIDT_CDF_COEI_CODE_FK_PK      AS CODE  ,
 //+      t2.CDF_NOM                      AS LIBIND
 //+   FROM   FEIDT_COMMENT_DOSETH              t1  ,
 //+      CDF_CODIF                         t2
 //+   WHERE  t1.FEIDT_CDF_COEI_CODE_FK_PK    = t2.CDF_CODE_PK
 //+   AND    t2.CDF_NUMERO_PK                = 'EC'
 //+   AND    t1.FEIDT_FEI_CODE_FK_PK         = CodeInd
 //+   ORDER BY t1.FEIDT_NUMORD ;
                sql_query += " SELECT t1.FEIDT_CDF_COEI_CODE_FK_PK      AS CODE  ,"
                     " t2.CDF_NOM                      AS LIBIND"
                     " FROM   feidt_comment_doseth              t1  ,"
                     " cdf_codif                         t2"
                     " WHERE  t1.FEIDT_CDF_COEI_CODE_FK_PK    = t2.CDF_CODE_PK"
                     " AND    t2.CDF_NUMERO_PK                = 'EC'"
                     " AND    t1.FEIDT_FEI_CODE_FK_PK          = '"+ QString::number( CodeInd ) +"'"
                     " ORDER BY t1.FEIDT_NUMORD ;";

       } else if (  TypId == 13) {   // -- texte Nature(s) EI

 //+   SELECT t1.FEITX2_FEI_CODE_FK_PK    AS CODEIND,
 //+      t1.FEITX2_TEXTE           AS LIBIND
 //+   FROM   FEITX2_EI_TXNATDOSETHER  t1
 //+   WHERE  t1.FEITX2_FEI_CODE_FK_PK = CodeInd ;
                sql_query += " SELECT t1.FEITX2_FEI_CODE_FK_PK    AS CODEIND,"
                     " t1.FEITX2_TEXTE           AS LIBIND"
                     " FROM   feitx2_ei_txnatdosether  t1"
                     " WHERE  t1.FEITX2_FEI_CODE_FK_PK  = '"+ QString::number( CodeInd ) +"' ;";

       } else if (  TypId == 14) {  // -- texte conduite à tenir

 //+   SELECT t1.FEITX7_FEI_CODE_FK_PK CODE,
 //+      t1.FEITX7_TEXTE      LIBIND
 //+   FROM  FEITX7_EI_TXCONDDOSETHER t1
 //+   WHERE  t1.FEITX7_FEI_CODE_FK_PK = CodeInd ;
                sql_query += " SELECT t1.FEITX7_FEI_CODE_FK_PK CODE,"
                     " t1.FEITX7_TEXTE      LIBIND"
                     " FROM  feitx7_ei_txconddosether t1"
                     " WHERE  t1.FEITX7_FEI_CODE_FK_PK  = '"+ QString::number( CodeInd ) +"' ;";

       } else if (  TypId == 15) {  // -- texte conduite à tenir

 //+   SELECT t1.FEITX1_FEI_CODE_FK_PK  AS CODEIND,
 //+      t1.FEITX1_TEXTE         AS LIBIND
 //+   FROM  FEITX1_EI_TXDOSETHER t1
 //+   WHERE  t1.FEITX1_FEI_CODE_FK_PK = CodeInd ;
                sql_query += " SELECT t1.FEITX1_FEI_CODE_FK_PK  AS CODEIND,"
                     " t1.FEITX1_TEXTE         AS LIBIND"
                     " FROM  feitx1_ei_txdosether t1"
                     " WHERE  t1.FEITX1_FEI_CODE_FK_PK  = '"+ QString::number( CodeInd ) +"' ;";

       }
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_DET_EFFIND() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_CODEIND = value(0).toString();
                m_LIBIND  = value(1).toString();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      QString CODEIND() {return m_CODEIND;}
      QString LIBIND()  {return m_LIBIND;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      QString m_CODEIND;
      QString m_LIBIND;
 };

 //================================== C_GET_THE_DET_EFFIND_SD_CUR   -89- ==================================
 /****************************************************************************
 *   Nom           :  GET_THE_DET_EFFIND_SD
 -----------------------------------------------------------------------------
 *   Date creation : 12/09/2008
 -----------------------------------------------------------------------------
 *   Description   :  Cette procédure renvoie le détail pour la fiche effet
 *                    indésirable en surdosage dont le code est passé en
 *                    paramètre, et deuxième paramètre permet d¿indiquer l¿information souhaitée.
 *   MAJ           :  24/10/2008
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_DET_EFFIND_SD_CUR  C_GET_THE_DET_EFFIND_SD ( database(), this );
      while ( C_GET_THE_DET_EFFIND_SD.next( LSTFIC , TYP  ) )
            { html += tr("<br><b> GET_THE_DET_EFFIND_SD : </b>  ") + C_GET_THE_DET_EFFIND_SD.MEMBER();
            }
  */
  class C_GET_THE_DET_EFFIND_SD_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_DET_EFFIND_SD_CUR ---------------------
      C_GET_THE_DET_EFFIND_SD_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( QString LSTFIC , double TYP )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............
       if ( TYP == 1) {

 //+   ' SELECT t1.FEICCH_FEI_CODE_FK_PK  NOFIC   ,              '||
 //+   '        ''0.1''                   GRP     ,              '||
 //+   '       t2.CCH_NOM                INFO_01 ,              '||
 //+   '       NULL                      TXT                    '||
 //+   ' FROM   FEICCH_EFFINDCLCH    t1,                         '||
 //+   '       CCH_CLASSECHIMIQUE   t2                          '||
 //+   ' WHERE  t2.CCH_CODE_PK       = t1.FEICCH_CCH_CODE_FK_PK  '||
 //+   ' AND    t1.FEICCH_FEI_CODE_FK_PK  IN ('||LSTFIC||')'      ||
 //+   ' UNION                                                   '||
 //+   ' SELECT t2.FEICPH_FEI_CODE_FK_PK    NOFIC   ,            '||
 //+   '        ''0.2''                     GRP     ,            '||
 //+   '       t1.CPH_NOM                  INFO_01 ,            '||
 //+   '       NULL                        TXT                  '||
 //+   ' FROM   CPH_CLASSEPHARMTHER   t1,                        '||
 //+   '       FEICPH_EFFINDCLPH     t2                         '||
 //+   ' WHERE  t1.CPH_CODE_PK = t2.FEICPH_CPH_CODE_FK_PK        '||
 //+   ' AND    t2.FEICPH_FEI_CODE_FK_PK  IN ('||LSTFIC||')'      ||
 //+   ' UNION                                                   '||
 //+   ' SELECT  t1.FEINACS_FEI_CODE_FK_PK  NOFIC   ,            '||
 //+   '         ''1.0.''||t1.FEINACS_NUMORD   GRP     ,         '||
 //+   '        t2.CDF_NOM                 INFO_01 ,            '||
 //+   '        NULL                       TXT                  '||
 //+   ' FROM    FEINACS_NATURSURDOS_EICLIN          t1  ,       '||
 //+   '        CDF_CODIF                          t2           '||
 //+   ' WHERE   t1. FEINACS_CDF_NAEI_CODE_FK_PK = t2.CDF_CODE_PK'||
 //+   ' AND     t2.CDF_NUMERO_PK                = ''EN''        '||
 //+   ' AND     t1.FEINACS_FEI_CODE_FK_PK  IN ('||LSTFIC||')'    ||
 //+   ' UNION                                                   '||
 //+   ' SELECT  t1.FEINAPS_FEI_CODE_FK_PK  NOFIC   ,            '||
 //+   '         ''1.1.''||t1.FEINAPS_NUMORD   GRP     ,         '||
 //+   '        t2.CDF_NOM                 INFO_01 ,            '||
 //+   '        NULL                       TXT                  '||
 //+   ' FROM    FEINAPS_NATURSURDOS_EIPARACLIN     t1  ,        '||
 //+   '        CDF_CODIF                          t2           '||
 //+   ' WHERE  t1.FEINAPS_CDF_NAEI_CODE_FK_PK  = t2.CDF_CODE_PK '||
 //+   ' AND    t2.CDF_NUMERO_PK                = ''EN''         '||
 //+   ' AND    t1.FEINAPS_FEI_CODE_FK_PK   IN ('||LSTFIC||')'    ||
 //+   ' UNION                                                   '||
 //+   ' SELECT  t1.FEINAS_FEI_CODE_FK_PK     NOFIC   ,          '||
 //+   '         ''1.2.''||t1.FEINAS_NUMORD   GRP     ,          '||
 //+   '      t2.CDF_NOM                   INFO_01 ,          '||
 //+   '      NULL                         TXT                '||
 //+   ' FROM   FEINAS_COMMENT_NATURESURDOSAG      t1 ,         '||
 //+   '      CDF_CODIF                          t2           '||
 //+   ' WHERE  t1.FEINAS_CDF_COEI_CODE_FK_PK  = t2.CDF_CODE_PK '||
 //+   ' AND    t2.CDF_NUMERO_PK               = ''EC''         '||
 //+   ' AND    t1.FEINAS_FEI_CODE_FK_PK   IN ('||LSTFIC||')'    ||
 //+   ' UNION                                                   '||
 //+   ' SELECT  t1.FEICTS_FEI_CODE_FK_PK   NOFIC   ,            '||
 //+   '    ''1.3.''||t1.FEICTS_NUMORD    GRP     ,               '||
 //+   '      t2.CDF_NOM                 INFO_01 ,             '||
 //+   '      NULL                       TXT                   '||
 //+   ' FROM    FEICTS_COMMENT_CATSURDOS           t1 ,         '||
 //+   '      CDF_CODIF                          t2            '||
 //+   ' WHERE  t1.FEICTS_CDF_COEI_CODE_FK_PK   = t2.CDF_CODE_PK '||
 //+   ' AND    t2.CDF_NUMERO_PK                = ''EC''         '||
 //+   ' AND    t1.FEICTS_FEI_CODE_FK_PK    IN ('||LSTFIC||')';
                sql_query +=
                     " SELECT t1.FEICCH_FEI_CODE_FK_PK  NOFIC   ,"
                     " '0.1'                   GRP     ,"
                     " t2.CCH_NOM                INFO_01 ,"
                     " NULL                      TXT"
                     " FROM   feicch_effindclch    t1,"
                     " cch_classechimique   t2"
                     " WHERE  t2.CCH_CODE_PK       = t1.FEICCH_CCH_CODE_FK_PK"
                     " AND    t1.FEICCH_FEI_CODE_FK_PK  IN ('"+LSTFIC+"')'"
                     " UNION"
                     " SELECT t2.FEICPH_FEI_CODE_FK_PK    NOFIC   ,"
                     " '0.2'                     GRP     ,"
                     " t1.CPH_NOM                  INFO_01 ,"
                     " NULL                        TXT"
                     " FROM   cph_classepharmther   t1,"
                     " feicph_effindclph     t2"
                     " WHERE  t1.CPH_CODE_PK = t2.FEICPH_CPH_CODE_FK_PK"
                     " AND    t2.FEICPH_FEI_CODE_FK_PK  IN ('"+LSTFIC+"')'"
                     " UNION"
                     " SELECT  t1.FEINACS_FEI_CODE_FK_PK  NOFIC   ,"
                     " '1.0.'T1.FEINACS_NUMORD   GRP     ,"
                     " t2.CDF_NOM                 INFO_01 ,"
                     " NULL                       TXT"
                     " FROM    feinacs_natursurdos_eiclin          t1  ,"
                     " cdf_codif                          t2"
                     " WHERE   t1. FEINACS_CDF_NAEI_CODE_FK_PK = t2.CDF_CODE_PK"
                     " AND     t2.CDF_NUMERO_PK                = 'EN'"
                     " AND     t1.FEINACS_FEI_CODE_FK_PK  IN ('"+LSTFIC+"')'"
                     " UNION"
                     " SELECT  t1.FEINAPS_FEI_CODE_FK_PK  NOFIC   ,"
                     " '1.1.'T1.FEINAPS_NUMORD   GRP     ,"
                     " t2.CDF_NOM                 INFO_01 ,"
                     " NULL                       TXT"
                     " FROM    feinaps_natursurdos_eiparaclin     t1  ,"
                     " cdf_codif                          t2"
                     " WHERE  t1.FEINAPS_CDF_NAEI_CODE_FK_PK  = t2.CDF_CODE_PK"
                     " AND    t2.CDF_NUMERO_PK                = 'EN'"
                     " AND    t1.FEINAPS_FEI_CODE_FK_PK   IN ('"+LSTFIC+"')'"
                     " UNION"
                     " SELECT  t1.FEINAS_FEI_CODE_FK_PK     NOFIC   ,"
                     " '1.2.'T1.FEINAS_NUMORD   GRP     ,"
                     " t2.CDF_NOM                   INFO_01 ,"
                     " NULL                         TXT"
                     " FROM   feinas_comment_naturesurdosag      t1 ,"
                     " cdf_codif                          t2"
                     " WHERE  t1.FEINAS_CDF_COEI_CODE_FK_PK  = t2.CDF_CODE_PK"
                     " AND    t2.CDF_NUMERO_PK               = 'EC'"
                     " AND    t1.FEINAS_FEI_CODE_FK_PK   IN ('"+LSTFIC+"')'"
                     " UNION"
                     " SELECT  t1.FEICTS_FEI_CODE_FK_PK   NOFIC   ,"
                     " '1.3.'T1.FEICTS_NUMORD    GRP     ,"
                     " t2.CDF_NOM                 INFO_01 ,"
                     " NULL                       TXT"
                     " FROM    feicts_comment_catsurdos           t1 ,"
                     " cdf_codif                          t2"
                     " WHERE  t1.FEICTS_CDF_COEI_CODE_FK_PK   = t2.CDF_CODE_PK"
                     " AND    t2.CDF_NUMERO_PK                = 'EC'"
                     " AND    t1.FEICTS_FEI_CODE_FK_PK    IN ('"+LSTFIC+"');";

       } else if (  TYP == 2) {

 //+   ' SELECT t1.FEITX3_FEI_CODE_FK_PK  NOFIC, '||
 //+   '        null                      GRP , '||
 //+   '        null                      INFO_01 , '||
 //+   '     t1.FEITX3_TEXTE           TXT    '||
 //+   ' FROM   FEITX3_EI_TXNATSURDOS    t1      '||
 //+   ' WHERE  t1.FEITX3_FEI_CODE_FK_PK IN ('||LSTFIC||')' ;
                sql_query +=
                     " SELECT t1.FEITX3_FEI_CODE_FK_PK  NOFIC,"
                     " NULL                      GRP ,"
                     " NULL                      INFO_01 ,"
                     " t1.FEITX3_TEXTE           TXT"
                     " FROM   feitx3_ei_txnatsurdos    t1"
                     " WHERE  t1.FEITX3_FEI_CODE_FK_PK IN ('"+LSTFIC+"')';";

       } else if (  TYP == 3) {

 //+     ' SELECT t1.FEITX6_FEI_CODE_FK_PK NOFIC,    '||
 //+     '        null                     GRP   ,   '||
 //+     '        null                     INFO_01 , '||
 //+     '    t1.FEITX6_TEXTE      TXT     '||
 //+     ' FROM   FEITX6_EI_TXCONDSURDOS t1          '||
 //+     ' WHERE  t1.FEITX6_FEI_CODE_FK_PK IN ('||LSTFIC||')' ;
                sql_query +=
                     " SELECT t1.FEITX6_FEI_CODE_FK_PK NOFIC,"
                     " NULL                     GRP   ,"
                     " NULL                     INFO_01 ,"
                     " t1.FEITX6_TEXTE      TXT"
                     " FROM   feitx6_ei_txcondsurdos t1"
                     " WHERE  t1.FEITX6_FEI_CODE_FK_PK IN ('"+LSTFIC+"')';";

       }
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_DET_EFFIND_SD() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_NOFIC   = value(0).toDouble();
                m_GRP     = value(1).toString();
                m_INFO_01 = value(2).toString();
                m_TXT     = value(3).toString();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      double  NOFIC()   {return m_NOFIC;}
      QString GRP()     {return m_GRP;}
      QString INFO_01() {return m_INFO_01;}
      QString TXT()     {return m_TXT;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      double  m_NOFIC;
      QString m_GRP;
      QString m_INFO_01;
      QString m_TXT;
 };

 //================================== C_GET_THE_REF_EFFIND_CUR   -90- ==================================
 /****************************************************************************
 *   Nom           :  GET_THE_REF_EFFIND
 -----------------------------------------------------------------------------
 *   Date creation : 12/09/2008
 -----------------------------------------------------------------------------
 *   Description   :   Cette procédure affiche les références officielles pour
 *                     le code effet indésirable et le code spécialité passé en paramètre.
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_REF_EFFIND_CUR  C_GET_THE_REF_EFFIND ( database(), this );
      while ( C_GET_THE_REF_EFFIND.next( CODEIND , CODESPE , TYP  ) )
            { html += tr("<br><b> GET_THE_REF_EFFIND : </b>  ") + C_GET_THE_REF_EFFIND.MEMBER();
            }
  */
  class C_GET_THE_REF_EFFIND_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_REF_EFFIND_CUR ---------------------
      C_GET_THE_REF_EFFIND_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( double CODEIND , double CODESPE , QString TYP )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............

 //+  SELECT t1.FEIAFS_FEI_CODE_FK_PK   NOFIC ,
 //+     t1.FEIAFS_SP_CODE_FK_PK    NOSPE ,
 //+     t2.CDF_NOM       REFOFF  ,
 //+     t1.FEIAFS_DATE_PK    DATREF
 //+  FROM   FEIAFS_EFFETIND_AFSSAPS  t1 ,
 //+     CDF_CODIF                t2
 //+  WHERE  t1.FEIAFS_DATE_PK           = (SELECT MAX(FEIAFS_DATE_PK)
 //+                FROM   FEIAFS_EFFETIND_AFSSAPS
 //+                WHERE  FEIAFS_SP_CODE_FK_PK     =  CODESPE
 //+                AND    FEIAFS_FEI_CODE_FK_PK    =  CODEIND)
 //+  AND    t1.FEIAFS_CDF_DOCUMENT_FK_PK  = t2.CDF_CODE_PK
 //+  AND    t2.CDF_NUMERO_PK               = '25'
 //+  AND    t1.FEIAFS_TYPEDOSE_THSURD_PK   = TYP
 //+  AND    t1.FEIAFS_SP_CODE_FK_PK        = CODESPE
 //+  AND    t1.FEIAFS_FEI_CODE_FK_PK       = CODEIND ;
                sql_query += " SELECT t1.FEIAFS_FEI_CODE_FK_PK   NOFIC ,"
                     " t1.FEIAFS_SP_CODE_FK_PK    NOSPE ,"
                     " t2.CDF_NOM       REFOFF  ,"
                     " t1.FEIAFS_DATE_PK    DATREF"
                     " FROM   feiafs_effetind_afssaps  t1 ,"
                     " cdf_codif                t2"
                     " WHERE  t1.FEIAFS_DATE_PK           = (SELECT MAX(FEIAFS_DATE_PK)"
                     " FROM   feiafs_effetind_afssaps"
                     " WHERE  FEIAFS_SP_CODE_FK_PK      = '"+ QString::number( CODESPE ) +"'"
                     " AND    FEIAFS_FEI_CODE_FK_PK     = '"+ QString::number( CODEIND ) +"')"
                     " AND    t1.FEIAFS_CDF_DOCUMENT_FK_PK  = t2.CDF_CODE_PK"
                     " AND    t2.CDF_NUMERO_PK               = '25'"
                     " AND    t1.FEIAFS_TYPEDOSE_THSURD_PK    = '"+TYP+"'"
                     " AND    t1.FEIAFS_SP_CODE_FK_PK         = '"+ QString::number( CODESPE ) +"'"
                     " AND    t1.FEIAFS_FEI_CODE_FK_PK        = '"+ QString::number( CODEIND ) +"' ;";
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_REF_EFFIND() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_NOFIC  = value(0).toDouble();
                m_NOSPE  = value(1).toDouble();
                m_REFOFF = value(2).toString();
                m_DATREF = value(3).toDate();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      double  NOFIC()  {return m_NOFIC;}
      double  NOSPE()  {return m_NOSPE;}
      QString REFOFF() {return m_REFOFF;}
      QDate   DATREF() {return m_DATREF;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      double  m_NOFIC;
      double  m_NOSPE;
      QString m_REFOFF;
      QDate   m_DATREF;
 };

 //================================== C_GET_THE_EFFIND_ID_CUR   -91- ==================================
 /****************************************************************************
 *   Nom           :  GET_THE_EFFIND_ID
 -----------------------------------------------------------------------------
 *   Date creation : 12/09/2008
 -----------------------------------------------------------------------------
 *   Description   :  Cette procédure affiche les informations générale sur la fiche effet..
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_EFFIND_ID_CUR  C_GET_THE_EFFIND_ID ( database(), this );
      while ( C_GET_THE_EFFIND_ID.next( CodeInd  ) )
            { html += tr("<br><b> GET_THE_EFFIND_ID : </b>  ") + C_GET_THE_EFFIND_ID.MEMBER();
            }
  */
  class C_GET_THE_EFFIND_ID_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_EFFIND_ID_CUR ---------------------
      C_GET_THE_EFFIND_ID_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( double CodeInd )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............

 //+  SELECT FEI_DATEMJ    AS DATE_MAJ_EI,
 //+      FEI_TYPEEFFET AS EFFET_SPECIALITE_CLASSE,
 //+      DECODE(FEI_FREQDOSETH,'1','Rare ou exceptionnel','2','Fréquent') AS FREQUENCE_EI ,
 //+      FEI_DOSETH  AS DOSE_THERAP ,
 //+      FEI_SURDOSE AS SURDOSE
 //+  FROM   FEI_FICHEEFFIND
 //+  WHERE  FEI_CODE_SQ_PK = CodeInd;
                sql_query += " SELECT FEI_DATEMJ    AS DATE_MAJ_EI,"
                     " FEI_TYPEEFFET AS EFFET_SPECIALITE_CLASSE,"
                     " DECODE(FEI_FREQDOSETH,'1','RARE ou exceptionnel','2','Fréquent') AS FREQUENCE_EI ,"
                     " FEI_DOSETH  AS DOSE_THERAP ,"
                     " FEI_SURDOSE AS SURDOSE"
                     " FROM   fei_ficheeffind"
                     " WHERE  FEI_CODE_SQ_PK  = '"+ QString::number( CodeInd ) +"';";
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_EFFIND_ID() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_DATE_MAJ_EI             = value(0).toDate();
                m_EFFET_SPECIALITE_CLASSE = value(1).toString();
                m_MY_DECODEFEI_FREQDOSETH = value(2).toString();
                m_MY_1                    = value(3).toString();
                m_MY_exceptionnel         = value(4).toString();
                m_MY_2                    = value(5).toString();
                m_FREQUENCE_EI            = value(6).toString();
                m_DOSE_THERAP             = value(7).toString();
                m_SURDOSE                 = value(8).toString();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      QDate   DATE_MAJ_EI()             {return m_DATE_MAJ_EI;}
      QString EFFET_SPECIALITE_CLASSE() {return m_EFFET_SPECIALITE_CLASSE;}
      QString MY_DECODEFEI_FREQDOSETH() {return m_MY_DECODEFEI_FREQDOSETH;}
      QString MY_1()                    {return m_MY_1;}
      QString MY_exceptionnel()         {return m_MY_exceptionnel;}
      QString MY_2()                    {return m_MY_2;}
      QString FREQUENCE_EI()            {return m_FREQUENCE_EI;}
      QString DOSE_THERAP()             {return m_DOSE_THERAP;}
      QString SURDOSE()                 {return m_SURDOSE;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      QDate   m_DATE_MAJ_EI;
      QString m_EFFET_SPECIALITE_CLASSE;
      QString m_MY_DECODEFEI_FREQDOSETH;
      QString m_MY_1;
      QString m_MY_exceptionnel;
      QString m_MY_2;
      QString m_FREQUENCE_EI;
      QString m_DOSE_THERAP;
      QString m_SURDOSE;
 };

 //================================== C_GET_THE_DET_PHDYNA_CUR   -92- ==================================
 /****************************************************************************
 *   Nom           :  GET_THE_DET_PHDYNA
 -----------------------------------------------------------------------------
 *   Date creation : 12/09/2008
 -----------------------------------------------------------------------------
 *   Description   :  Cette procédure renvoie les données pharmacodynamiques d'une spécialité
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_DET_PHDYNA_CUR  C_GET_THE_DET_PHDYNA ( database(), this );
      while ( C_GET_THE_DET_PHDYNA.next( CodeId , TYPID  ) )
            { html += tr("<br><b> GET_THE_DET_PHDYNA : </b>  ") + C_GET_THE_DET_PHDYNA.MEMBER();
            }
  */
  class C_GET_THE_DET_PHDYNA_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_DET_PHDYNA_CUR ---------------------
      C_GET_THE_DET_PHDYNA_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( double CodeId , double TYPID )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............
       if ( TYPID == 1) {          // -- donnee pharmacodynamique
                sql_query +=
                     " SELECT t1.SPADM_LIBELLE          AS TEXTEPH ,"
                     " NULL                             AS  DTREF"
                     " FROM   spadm_specialite_modeadm  t1"
                     " WHERE  t1.SPADM_SP_CODE_FK_PK    = '"+ QString::number( CodeId ) +"' ;";

       } else if ( TYPID == 2) {   // -- Référence officielle
                sql_query +=
                     " SELECT t2.CDF_NOM               AS TEXTEPH ,"
                     " t1.SPAFS_DATE_PK                AS DTREF"
                     " FROM   spafs_specialite_afssaps t1,"
                     " cdf_codif                       t2"
                     " WHERE  t1.SPAFS_RUBCDF_NUMERO_PK IN  ('CPH','SP')"
                     " AND    t1.SPAFS_DATE_PK = (SELECT MAX(SPAFS_DATE_PK)"
                     " FROM   spafs_specialite_afssaps"
                     " WHERE  SPAFS_RUBCDF_NUMERO_PK IN ('CPH','SP')"
                     " AND    SPAFS_SP_CODE_FK_PK     = '"+ QString::number( CodeId ) +"' )"
                     " AND t2.CDF_CODE_PK             = t1.SPAFS_CDF_CODE_DOC_FK_PK"
                     " AND t2.CDF_NUMERO_PK           = '25'"
                     " AND t1.SPAFS_SP_CODE_FK_PK     = '"+ QString::number( CodeId ) +"' ;";
       }
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_DET_PHDYNA() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_TEXTEPH = value(0).toString();
                m_DTREF   = value(1).toDate();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      QString TEXTEPH()                      {return m_TEXTEPH;}
      QDate   DTREF()                        {return m_DTREF;}
      QString DTREF(const QString &format)   {return m_DTREF.toString(format);}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      QString m_TEXTEPH;
      QDate   m_DTREF;
 };

 //================================== C_GET_THE_DET_ETIO_CUR   -93- ==================================
 /****************************************************************************
 *   Nom           :  GET_THE_DET_ETIO
 -----------------------------------------------------------------------------
 *   Date creation : 15/09/2008
 -----------------------------------------------------------------------------
 *   Description   : Cette procédure renvoie les données étiologique d'une spécialité.
 *   MAJ           : 03/10/2008
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_DET_ETIO_CUR  C_GET_THE_DET_ETIO ( database(), this );
      while ( C_GET_THE_DET_ETIO.next( CodeFic , TypId , CodeId  ) )
            { html += tr("<br><b> GET_THE_DET_ETIO : </b>  ") + C_GET_THE_DET_ETIO.MEMBER();
            }
  */
  class C_GET_THE_DET_ETIO_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_DET_ETIO_CUR ---------------------
      C_GET_THE_DET_ETIO_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( QString CodeFic , double TypId , QString CodeId )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............
       if ( TypId == 1) {

 //+   SELECT t2.CDF_NOM     AS TEXTETIO ,
 //+      t1.FETAFS_DATE_PK       AS VALETIO
 //+   FROM   FETAFS_FET_AFSSAPS t1,
 //+      CDF_CODIF         t2
 //+   WHERE  t1.FETAFS_DATE_PK = ( SELECT MAX(FETAFS_DATE_PK)
 //+              FROM   FETAFS_FET_AFSSAPS
 //+              WHERE  FETAFS_SP_CODE_FK_PK   = CodeId
 //+              AND    FETAFS_FET_CODE_FK_PK  = CodeFic)
 //+   AND t2.CDF_CODE_PK           = t1.FETAFS_CDF_DOCUMENT_FK_PK
 //+   AND t2.CDF_NUMERO_PK         = '25'
 //+   AND t1.FETAFS_SP_CODE_FK_PK  = CodeId
 //+   AND t1.FETAFS_FET_CODE_FK_PK = CodeFic;
                sql_query += " SELECT t2.CDF_NOM     AS TEXTETIO ,"
                     " t1.FETAFS_DATE_PK       AS VALETIO"
                     " FROM   fetafs_fet_afssaps t1,"
                     " cdf_codif         t2"
                     " WHERE  t1.FETAFS_DATE_PK = ( SELECT MAX(FETAFS_DATE_PK)"
                     " FROM   fetafs_fet_afssaps"
                     " WHERE  FETAFS_SP_CODE_FK_PK    = '"+CodeId+"'"
                     " AND    FETAFS_FET_CODE_FK_PK   = '"+CodeFic+"')"
                     " AND t2.CDF_CODE_PK           = t1.FETAFS_CDF_DOCUMENT_FK_PK"
                     " AND t2.CDF_NUMERO_PK         = '25'"
                     " AND t1.FETAFS_SP_CODE_FK_PK   = '"+CodeId+"'"
                     " AND t1.FETAFS_FET_CODE_FK_PK  = '"+CodeFic+"';";

       } else if ( TypId == 2) {

 //+   SELECT t3.SAC_NOM             AS TEXTETIO,
 //+      t3.SAC_CODE_SQ_PK    AS VALETIO
 //+   FROM   FET_FICHEETIOLOGIE  t1,
 //+      FETSAC_ETIOSUBAC    t2,
 //+      SAC_SUBACTIVE       t3
 //+   WHERE  t1.FET_CODE_SQ_PK         = t2.FETSAC_FET_CODE_FK_PK
 //+   AND    t2.FETSAC_SAC_CODE_FK_PK  = t3.SAC_CODE_SQ_PK
 //+   AND    t1.FET_CODE_SQ_PK         = CodeFic ;
                sql_query += " SELECT t3.SAC_NOM             AS TEXTETIO,"
                     " t3.SAC_CODE_SQ_PK    AS VALETIO"
                     " FROM   fet_ficheetiologie  t1,"
                     " fetsac_etiosubac    t2,"
                     " sac_subactive       t3"
                     " WHERE  t1.FET_CODE_SQ_PK         = t2.FETSAC_FET_CODE_FK_PK"
                     " AND    t2.FETSAC_SAC_CODE_FK_PK  = t3.SAC_CODE_SQ_PK"
                     " AND    t1.FET_CODE_SQ_PK          = '"+CodeFic+"' ;";

       } else if ( TypId == 3) {

 //+   SELECT t1.FETTXTI_TXT_INTRO        AS TEXTETIO ,
 //+          t1.FETTXTI_FET_CODE_FK_PK   AS VALETIO
 //+   FROM   FETTXTI_TEXTINTRO_CMI  t1,
 //+          FETSP_ETIOSPE          t2
 //+   WHERE  t1.FETTXTI_FET_CODE_FK_PK  = t2.FETSP_FET_CODE_FK_PK
 //+   AND    t1.FETTXTI_FET_CODE_FK_PK  = CodeFic
 //+   AND    t2.FETSP_SP_CODE_FK_PK     = CodeId ;
                sql_query += " SELECT t1.FETTXTI_TXT_INTRO        AS TEXTETIO ,"
                     " t1.FETTXTI_FET_CODE_FK_PK   AS VALETIO"
                     " FROM   fettxti_textintro_cmi  t1,"
                     " fetsp_etiospe          t2"
                     " WHERE  t1.FETTXTI_FET_CODE_FK_PK  = t2.FETSP_FET_CODE_FK_PK"
                     " AND    t1.FETTXTI_FET_CODE_FK_PK   = '"+CodeFic+"'"
                     " AND    t2.FETSP_SP_CODE_FK_PK      = '"+CodeId+"' ;";

       } else if ( TypId == 4) {

 //+   SELECT t2.CDF_NOM        AS TEXTETIO,
 //+      t2.CDF_CODE_PK  AS VALETIO
 //+   FROM   FETCHS_COMMENT_HABITU_SENSIBLE  t1,
 //+      CDF_CODIF                       t2
 //+   WHERE  t1.FETCHS_CDF_COIN_CODE_FK_PK = t2.CDF_CODE_PK
 //+   AND    t2.CDF_NUMERO_PK              = 'NC'
 //+   AND    t1.FETCHS_FET_CODE_FK_PK      = CodeFic ;
                sql_query += " SELECT t2.CDF_NOM        AS TEXTETIO,"
                     " t2.CDF_CODE_PK  AS VALETIO"
                     " FROM   fetchs_comment_habitu_sensible  t1,"
                     " cdf_codif                       t2"
                     " WHERE  t1.FETCHS_CDF_COIN_CODE_FK_PK = t2.CDF_CODE_PK"
                     " AND    t2.CDF_NUMERO_PK              = 'NC'"
                     " AND    t1.FETCHS_FET_CODE_FK_PK       = '"+CodeFic+"' ;";

       } else if ( TypId == 5) {

 //+   SELECT t2.CDF_NOM       AS TEXTETIO,
 //+        t2.CDF_CODE_PK  AS VALETIO
 //+   FROM   FETCIS_COMMENT_INCONS_SENSIBLE  t1,
 //+      CDF_CODIF                       t2
 //+   WHERE  t1.FETCIS_CDF_COIN_CODE_FK_PK = t2.CDF_CODE_PK
 //+   AND    t2.CDF_NUMERO_PK              = 'NC'
 //+   AND    t1.FETCIS_FET_CODE_FK_PK      = CodeFic ;
                sql_query += " SELECT t2.CDF_NOM       AS TEXTETIO,"
                     " t2.CDF_CODE_PK  AS VALETIO"
                     " FROM   fetcis_comment_incons_sensible  t1,"
                     " cdf_codif                       t2"
                     " WHERE  t1.FETCIS_CDF_COIN_CODE_FK_PK = t2.CDF_CODE_PK"
                     " AND    t2.CDF_NUMERO_PK              = 'NC'"
                     " AND    t1.FETCIS_FET_CODE_FK_PK       = '"+CodeFic+"' ;";

       } else if ( TypId == 6) {

 //+   SELECT t2.CDF_NOM        AS TEXTETIO,
 //+      t2.CDF_CODE_PK  AS VALETIO
 //+   FROM   FETCMS_COMMENT_MODERE_SENSIBLE  t1,
 //+      CDF_CODIF                       t2
 //+   WHERE  t1.FETCMS_CDF_COIN_CODE_FK_PK  = t2.CDF_CODE_PK
 //+   AND    t2.CDF_NUMERO_PK              = 'NC'
 //+   AND    t1.FETCMS_FET_CODE_FK_PK      = CodeFic ;
                sql_query += " SELECT t2.CDF_NOM        AS TEXTETIO,"
                     " t2.CDF_CODE_PK  AS VALETIO"
                     " FROM   fetcms_comment_modere_sensible  t1,"
                     " cdf_codif                       t2"
                     " WHERE  t1.FETCMS_CDF_COIN_CODE_FK_PK  = t2.CDF_CODE_PK"
                     " AND    t2.CDF_NUMERO_PK              = 'NC'"
                     " AND    t1.FETCMS_FET_CODE_FK_PK       = '"+CodeFic+"' ;";

       } else if ( TypId == 7) {

 //+   SELECT t2.CDF_NOM        AS TEXTETIO,
 //+      t2.CDF_CODE_PK  AS VALETIO
 //+   FROM   FETCRE_COMMENT_RESISTANTE  t1,
 //+      CDF_CODIF                  t2
 //+   WHERE  t1.FETCRE_CDF_COIN_CODE_FK_PK  = t2.CDF_CODE_PK
 //+   AND    t2.CDF_NUMERO_PK              = 'NC'
 //+   AND    t1.FETCRE_FET_CODE_FK_PK      = CodeFic ;
                sql_query += " SELECT t2.CDF_NOM        AS TEXTETIO,"
                     " t2.CDF_CODE_PK  AS VALETIO"
                     " FROM   fetcre_comment_resistante  t1,"
                     " cdf_codif                  t2"
                     " WHERE  t1.FETCRE_CDF_COIN_CODE_FK_PK  = t2.CDF_CODE_PK"
                     " AND    t2.CDF_NUMERO_PK              = 'NC'"
                     " AND    t1.FETCRE_FET_CODE_FK_PK       = '"+CodeFic+"' ;";

       } else if ( TypId == 8) {

 //+   SELECT t2.CDF_NOM        AS TEXTETIO,
 //+      t1.FET_CMIHS    AS VALETIO
 //+   FROM   FET_FICHEETIOLOGIE  t1,
 //+      CDF_CODIF           t2
 //+   WHERE  t1.FET_CDF_UDHS_CODE_FK  = t2.CDF_CODE_PK
 //+   AND    t2.CDF_NUMERO_PK         = '19'
 //+   AND    t1.FET_CODE_SQ_PK        = CodeFic ;
                sql_query += " SELECT t2.CDF_NOM        AS TEXTETIO,"
                     " t1.FET_CMIHS    AS VALETIO"
                     " FROM   fet_ficheetiologie  t1,"
                     " cdf_codif           t2"
                     " WHERE  t1.FET_CDF_UDHS_CODE_FK  = t2.CDF_CODE_PK"
                     " AND    t2.CDF_NUMERO_PK         = '19'"
                     " AND    t1.FET_CODE_SQ_PK         = '"+CodeFic+"' ;";

       } else if ( TypId == 9) {

 //+   SELECT t2.CDF_NOM      AS TEXTETIO,
 //+      t1.FET_CMIIS  AS VALETIO
 //+   FROM   FET_FICHEETIOLOGIE  t1,
 //+      CDF_CODIF           t2
 //+   WHERE  t1.FET_CDF_UDIS_CODE_FK  = t2.CDF_CODE_PK
 //+   AND    t2.CDF_NUMERO_PK         = '19'
 //+   AND    t1.FET_CODE_SQ_PK        = CodeFic  ;
                sql_query += " SELECT t2.CDF_NOM      AS TEXTETIO,"
                     " t1.FET_CMIIS  AS VALETIO"
                     " FROM   fet_ficheetiologie  t1,"
                     " cdf_codif           t2"
                     " WHERE  t1.FET_CDF_UDIS_CODE_FK  = t2.CDF_CODE_PK"
                     " AND    t2.CDF_NUMERO_PK         = '19'"
                     " AND    t1.FET_CODE_SQ_PK         = '"+CodeFic+"'  ;";

       } else if ( TypId == 10) {

 //+   SELECT t2.CDF_NOM      AS TEXTETIO,
 //+      t1.FET_CMIMS  AS VALETIO
 //+   FROM   FET_FICHEETIOLOGIE  t1,
 //+      CDF_CODIF           t2
 //+   WHERE  t1.FET_CDF_UDMS_CODE_FK  = t2.CDF_CODE_PK
 //+   AND    t2.CDF_NUMERO_PK         = '19'
 //+   AND    t1.FET_CODE_SQ_PK        = CodeFic ;
                sql_query += " SELECT t2.CDF_NOM      AS TEXTETIO,"
                     " t1.FET_CMIMS  AS VALETIO"
                     " FROM   fet_ficheetiologie  t1,"
                     " cdf_codif           t2"
                     " WHERE  t1.FET_CDF_UDMS_CODE_FK  = t2.CDF_CODE_PK"
                     " AND    t2.CDF_NUMERO_PK         = '19'"
                     " AND    t1.FET_CODE_SQ_PK         = '"+CodeFic+"' ;";

       } else if ( TypId == 11) {

 //+   SELECT t2.CDF_NOM        AS TEXTETIO,
 //+      t1.FET_CMIRE    AS VALETIO
 //+   FROM   FET_FICHEETIOLOGIE  t1,
 //+      CDF_CODIF           t2
 //+   WHERE  t1.FET_CDF_UDRE_CODE_FK  = t2.CDF_CODE_PK
 //+   AND    t2.CDF_NUMERO_PK         = '19'
 //+   AND    t1.FET_CODE_SQ_PK        = CodeFic ;
                sql_query += " SELECT t2.CDF_NOM        AS TEXTETIO,"
                     " t1.FET_CMIRE    AS VALETIO"
                     " FROM   fet_ficheetiologie  t1,"
                     " cdf_codif           t2"
                     " WHERE  t1.FET_CDF_UDRE_CODE_FK  = t2.CDF_CODE_PK"
                     " AND    t2.CDF_NUMERO_PK         = '19'"
                     " AND    t1.FET_CODE_SQ_PK         = '"+CodeFic+"' ;";

       } else if ( TypId == 12) {

 //+   SELECT t2.CDF_NOM                AS TEXTETIO,
 //+      t1.FETHS_POURCENTAGE_RESISTANCE  AS VALETIO
 //+   FROM   FETHS_ETIOLOGIE_HABITU_SENSIB  t1,
 //+      CDF_CODIF                      t2
 //+   WHERE  t1.FETHS_CDF_ETIN_CODE_FK_PK  = t2.CDF_CODE_PK
 //+   AND    t2.CDF_NUMERO_PK              = 'NA'
 //+   AND    t1.FETHS_FET_CODE_FK_PK       =  CodeFic ;
                sql_query += " SELECT t2.CDF_NOM                AS TEXTETIO,"
                     " t1.FETHS_POURCENTAGE_RESISTANCE  AS VALETIO"
                     " FROM   feths_etiologie_habitu_sensib  t1,"
                     " cdf_codif                      t2"
                     " WHERE  t1.FETHS_CDF_ETIN_CODE_FK_PK  = t2.CDF_CODE_PK"
                     " AND    t2.CDF_NUMERO_PK              = 'NA'"
                     " AND    t1.FETHS_FET_CODE_FK_PK        = '"+CodeFic+"' ;";

       } else if ( TypId == 13) {

 //+   SELECT t2.CDF_NOM                        AS TEXTETIO,
 //+          t1.FETIS_POURCENTAGE_RESISTANCE   AS VALETIO
 //+   FROM   FETIS_ETIOLOGIE_INCONST_SENSIB  t1,
 //+        CDF_CODIF                      t2
 //+   WHERE  t1.FETIS_CDF_ETIN_CODE_FK_PK  = t2.CDF_CODE_PK
 //+   AND    t2.CDF_NUMERO_PK              = 'NA'
 //+   AND    t1.FETIS_FET_CODE_FK_PK       =  CodeFic ;
                sql_query += " SELECT t2.CDF_NOM                        AS TEXTETIO,"
                     " t1.FETIS_POURCENTAGE_RESISTANCE   AS VALETIO"
                     " FROM   fetis_etiologie_inconst_sensib  t1,"
                     " cdf_codif                      t2"
                     " WHERE  t1.FETIS_CDF_ETIN_CODE_FK_PK  = t2.CDF_CODE_PK"
                     " AND    t2.CDF_NUMERO_PK              = 'NA'"
                     " AND    t1.FETIS_FET_CODE_FK_PK        = '"+CodeFic+"' ;";

       } else if ( TypId == 14) {

 //+   SELECT t2.CDF_NOM               AS TEXTETIO,
 //+      t1.FETMS_POURCENTAGE_RESISTANCE  AS VALETIO
 //+   FROM   FETMS_ETIOLOGIE_MODEREM_SENSIB  t1,
 //+      CDF_CODIF                      t2
 //+   WHERE  t1.FETMS_CDF_ETIN_CODE_FK_PK  = t2.CDF_CODE_PK
 //+   AND    t2.CDF_NUMERO_PK              = 'NA'
 //+   AND    t1.FETMS_FET_CODE_FK_PK       = CodeFic ;
                sql_query += " SELECT t2.CDF_NOM               AS TEXTETIO,"
                     " t1.FETMS_POURCENTAGE_RESISTANCE  AS VALETIO"
                     " FROM   fetms_etiologie_moderem_sensib  t1,"
                     " cdf_codif                      t2"
                     " WHERE  t1.FETMS_CDF_ETIN_CODE_FK_PK  = t2.CDF_CODE_PK"
                     " AND    t2.CDF_NUMERO_PK              = 'NA'"
                     " AND    t1.FETMS_FET_CODE_FK_PK        = '"+CodeFic+"' ;";

       } else if ( TypId == 15) {

 //+   SELECT t2.CDF_NOM                   AS TEXTETIO,
 //+      t1.FETRE_POURCENTAGE_RESISTANCE   AS VALETIO
 //+   FROM   FETRE_ETIOLOGIE_RESISTANTES  t1,
 //+      CDF_CODIF                    t2
 //+   WHERE  t1.FETRE_CDF_ETIN_CODE_FK_PK  = t2.CDF_CODE_PK
 //+   AND    t2.CDF_NUMERO_PK              = 'NA'
 //+   AND    t1.FETRE_FET_CODE_FK_PK       = CodeFic ;
                sql_query += " SELECT t2.CDF_NOM                   AS TEXTETIO,"
                     " t1.FETRE_POURCENTAGE_RESISTANCE   AS VALETIO"
                     " FROM   fetre_etiologie_resistantes  t1,"
                     " cdf_codif                    t2"
                     " WHERE  t1.FETRE_CDF_ETIN_CODE_FK_PK  = t2.CDF_CODE_PK"
                     " AND    t2.CDF_NUMERO_PK              = 'NA'"
                     " AND    t1.FETRE_FET_CODE_FK_PK        = '"+CodeFic+"' ;";

       } else if ( TypId == 16) {

 //+   SELECT t1.FETTX1_TEXTE               AS TEXTETIO,
 //+      t1.FETTX1_FET_CODE_FK_PK    AS VALETIO
 //+   FROM   FETTX1_ET_TXHS    t1
 //+   WHERE  t1.FETTX1_FET_CODE_FK_PK = CodeFic ;
                sql_query += " SELECT t1.FETTX1_TEXTE               AS TEXTETIO,"
                     " t1.FETTX1_FET_CODE_FK_PK    AS VALETIO"
                     " FROM   fettx1_et_txhs    t1"
                     " WHERE  t1.FETTX1_FET_CODE_FK_PK  = '"+CodeFic+"' ;";

       } else if ( TypId == 17) {

 //+    SELECT t1.FETTX2_TEXTE              AS TEXTETIO,
 //+      t1.FETTX2_FET_CODE_FK_PK    AS VALETIO
 //+   FROM   FETTX2_ET_TXIS    t1
 //+   WHERE  t1.FETTX2_FET_CODE_FK_PK = CodeFic ;
                sql_query += " SELECT t1.FETTX2_TEXTE              AS TEXTETIO,"
                     " t1.FETTX2_FET_CODE_FK_PK    AS VALETIO"
                     " FROM   fettx2_et_txis    t1"
                     " WHERE  t1.FETTX2_FET_CODE_FK_PK  = '"+CodeFic+"' ;";

       } else if ( TypId == 18) {

 //+   SELECT t1.FETTX3_TEXTE               AS TEXTETIO,
 //+      t1.FETTX3_FET_CODE_FK_PK    AS VALETIO
 //+   FROM   FETTX3_ET_TXMS    t1
 //+   WHERE  t1.FETTX3_FET_CODE_FK_PK = CodeFic ;
                sql_query += " SELECT t1.FETTX3_TEXTE               AS TEXTETIO,"
                     " t1.FETTX3_FET_CODE_FK_PK    AS VALETIO"
                     " FROM   fettx3_et_txms    t1"
                     " WHERE  t1.FETTX3_FET_CODE_FK_PK  = '"+CodeFic+"' ;";

       } else if ( TypId == 19) {

 //+   SELECT t1.FETTX4_TEXTE               AS TEXTETIO,
 //+      t1.FETTX4_FET_CODE_FK_PK    AS VALETIO
 //+   FROM   FETTX4_ET_TXRE     t1
 //+   WHERE  t1.FETTX4_FET_CODE_FK_PK = CodeFic ;
                sql_query += " SELECT t1.FETTX4_TEXTE               AS TEXTETIO,"
                     " t1.FETTX4_FET_CODE_FK_PK    AS VALETIO"
                     " FROM   fettx4_et_txre     t1"
                     " WHERE  t1.FETTX4_FET_CODE_FK_PK  = '"+CodeFic+"' ;";

       }
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_DET_ETIO() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_TEXTETIO = value(0).toString();
                m_VALETIO  = value(1).toString();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      QString TEXTETIO() {return m_TEXTETIO;}
      QString VALETIO()  {return m_VALETIO;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      QString m_TEXTETIO;
      QString m_VALETIO;
 };

 //================================== C_GET_THE_ETIO_SPE_CUR   -94- ==================================
 /****************************************************************************
 *   Nom           :  GET_THE_ETIO_SPE
 -----------------------------------------------------------------------------
 *   Date creation : 15/09/2008
 -----------------------------------------------------------------------------
 *   Description   :  Cette procédure renvoie les fiches étiologique d'une spécialité.
 -----------------------------------------------------------------------------
 *   Maj           :  05/02/2009 - Mourad
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_ETIO_SPE_CUR  C_GET_THE_ETIO_SPE ( database(), this );
      while ( C_GET_THE_ETIO_SPE.next( CodeId  ) )
            { html += tr("<br><b> GET_THE_ETIO_SPE : </b>  ") + C_GET_THE_ETIO_SPE.MEMBER();
            }
  */
  class C_GET_THE_ETIO_SPE_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_ETIO_SPE_CUR ---------------------
      C_GET_THE_ETIO_SPE_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( double CodeId )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............

 //+  SELECT t1.FET_CODE_SQ_PK      AS CODEFIC
 //+  FROM   FET_FICHEETIOLOGIE  t1,
 //+     FETSP_ETIOSPE       t2
 //+  WHERE  t1.FET_CODE_SQ_PK       = t2.FETSP_FET_CODE_FK_PK
 //+  AND    t2.FETSP_SP_CODE_FK_PK  = CodeId ;
                sql_query += " SELECT t1.FET_CODE_SQ_PK      AS CODEFIC"
                     " FROM   fet_ficheetiologie  t1,"
                     " fetsp_etiospe       t2"
                     " WHERE  t1.FET_CODE_SQ_PK       = t2.FETSP_FET_CODE_FK_PK"
                     " AND    t2.FETSP_SP_CODE_FK_PK   = '"+ QString::number( CodeId ) +"' ;";
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_ETIO_SPE() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_CODEFIC = value(0).toDouble();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      double  CODEFIC() {return m_CODEFIC;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      double  m_CODEFIC;
 };

 //================================== C_GET_THE_FCO_ID_BY_SPE_CUR   -95- ==================================
 /****************************************************************************
 *   Nom           :  GET_THE_FCO_ID_BY_SPE
 -----------------------------------------------------------------------------
 *   Date creation : 15/09/2008
 -----------------------------------------------------------------------------
 *   Description   :  Cette procédure renvoie les identifiants de fiches « FCO »
 *                    ainsi que les textes et références officielles.
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_FCO_ID_BY_SPE_CUR  C_GET_THE_FCO_ID_BY_SPE ( database(), this );
      while ( C_GET_THE_FCO_ID_BY_SPE.next( IDSPE  ) )
            { html += tr("<br><b> GET_THE_FCO_ID_BY_SPE : </b>  ") + C_GET_THE_FCO_ID_BY_SPE.MEMBER();
            }
  */
  class C_GET_THE_FCO_ID_BY_SPE_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_FCO_ID_BY_SPE_CUR ---------------------
      C_GET_THE_FCO_ID_BY_SPE_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( const QString &IDSPE )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............
                sql_query += " SELECT t1.FCO_CODE_SQ_PK    AS IDFCO,"
                     " t1.FCO_TXT         AS FCO_TXT ,"
                     " t3.CDF_NOM         AS INFO_01 ,"
                     " t2.FCOAFS_DATE_PK  AS DAT_CRE"
                     " FROM   fco_conducteur  t1,"
                     " fcoafs_fco_afssaps     t2,"
                     " cdf_codif              t3"
                     " WHERE  t1.FCO_CODE_SQ_PK        = t2.FCOAFS_FCO_CODE_FK_PK"
                     " AND    t3.CDF_CODE_PK           = t2.FCOAFS_CDF_DOCUMENT_FK_PK"
                     " AND    t3.CDF_NUMERO_PK         = '25'"
                     " AND    t2.FCOAFS_DATE_PK        = (SELECT MAX(FCOAFS_DATE_PK)"
                     " FROM   fcoafs_fco_afssaps"
                     " WHERE  FCOAFS_SP_CODE_FK_PK     = '"+  IDSPE  +"')"
                     " AND    t2.FCOAFS_SP_CODE_FK_PK  = '"+  IDSPE  +"';";
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_FCO_ID_BY_SPE() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_IDFCO   = value(0).toString();
                m_FCO_TXT = value(1).toString();
                m_INFO_01 = value(2).toString();
                m_DAT_CRE = value(3).toDate();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      QString IDFCO()   {return m_IDFCO;}
      QString FCO_TXT() {return m_FCO_TXT;}
      QString INFO_01() {return m_INFO_01;}
      QDate   DAT_CRE() {return m_DAT_CRE;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      QString m_IDFCO;
      QString m_FCO_TXT;
      QString m_INFO_01;
      QDate   m_DAT_CRE;
 };

 //================================== C_GET_THE_DET_FCO_CUR   -96- ==================================
 /****************************************************************************
 *   Nom           :  GET_THE_DET_FCO
 -----------------------------------------------------------------------------
 *   Date creation : 15/09/2008
 -----------------------------------------------------------------------------
 *   Description   :  Cette procédure renvoie les iinformations générales
 *                    pour des fiches « FCO » passées en paramètre.
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_DET_FCO_CUR  C_GET_THE_DET_FCO ( database(), this );
      while ( C_GET_THE_DET_FCO.next( IDFCO  ) )
            { html += tr("<br><b> GET_THE_DET_FCO : </b>  ") + C_GET_THE_DET_FCO.MEMBER();
            }
  */
  class C_GET_THE_DET_FCO_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_DET_FCO_CUR ---------------------
      C_GET_THE_DET_FCO_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( QString IDFCO )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";
     //............. zone de construction de la requete DEBUT ...............
                sql_query +=
                     " SELECT t1.FCOREC_FCO_CODE_FK_PK    FCOID,"
                     " concat('0',t1.FCOREC_NUMORD) AS    GRP,"
                     " t2.CDF_NOM                         INFO_01 ,"
                     " t2.CDF_DATECR                      DAT_CRE ,"
                     " t2.CDF_DATEMJ                      DAT_MAJ"
                     " FROM   fcorec_fco_rec         t1 ,"
                     " cdf_codif                     t2"
                     " WHERE  t1.FCOREC_CDF_REC_CODE_FK_PK  = t2.CDF_CODE_PK"
                     " AND    t2.CDF_NUMERO_PK              = 'CC'"
                     " AND    t1.FCOREC_FCO_CODE_FK_PK      IN ('"+IDFCO+"')"
                     " UNION"
                     " SELECT t1.FCOCOM_FCO_CODE_FK_PK  FCOID,"
                     " concat('1',t1.FCOCOM_NUMORD) AS       GRP,"
                     " t2.CDF_NOM                            INFO_01 ,"
                     " t2.CDF_DATECR                         DAT_CRE ,"
                     " t2.CDF_DATEMJ                         DAT_MAJ"
                     " FROM   fcocom_fco_com   t1 ,"
                     " cdf_codif               t2"
                     " WHERE  t1.FCOCOM_CDF_COM_CODE_FK_PK  = t2.CDF_CODE_PK"
                     " AND    t2.CDF_NUMERO_PK              = 'CC'"
                     " AND    t1.FCOCOM_FCO_CODE_FK_PK      IN ('"+IDFCO+"')"
                     " ORDER BY 1;";
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_DET_FCO() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_FCOID   = value(0).toDouble();
                m_GRP     = value(1).toString();
                m_INFO_01 = value(2).toString();
                m_DAT_CRE = value(3).toDate();
                m_DAT_MAJ = value(4).toDate();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      double  FCOID()   {return m_FCOID;}
      QString GRP()     {return m_GRP;}
      QString INFO_01() {return m_INFO_01;}
      QDate   DAT_CRE() {return m_DAT_CRE;}
      QDate   DAT_MAJ() {return m_DAT_MAJ;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      double  m_FCOID;
      QString m_GRP;
      QString m_INFO_01;
      QDate   m_DAT_CRE;
      QDate   m_DAT_MAJ;
 };

 //================================== C_GET_THE_PRF_PAT_CUR   -97- ==================================
 /****************************************************************************
 *   Nom           :  GET_THE_PRF_PAT
 -----------------------------------------------------------------------------
 *   Date creation : 16/09/2008
 -----------------------------------------------------------------------------
 *   Description   :  Cette procédure renvoie les éléments nescéssaires à l'établissement
 *                    du profil Patient. Les critères sont:La tranche d'age
 *                   (si enfant, nouveau né ou nourisson l'age et poids seront des critères
 *                    supplémentaires),grossesse allaitement et pathologie
 *                    (dans pathologie sont prises en compte les hypersensibilités). La
 *                    procédure sera appellée plusieurs fois pour obtenir les différents critères
 *   MAJ           :  24/10/2008 le fils doit etre visible que pour le TYP = 1
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_PRF_PAT_CUR  C_GET_THE_PRF_PAT ( database(), this );
      while ( C_GET_THE_PRF_PAT.next( TYP , ARG  ) )
            { html += tr("<br><b> GET_THE_PRF_PAT : </b>  ") + C_GET_THE_PRF_PAT.MEMBER();
            }
  */
  class C_GET_THE_PRF_PAT_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_PRF_PAT_CUR ---------------------
      C_GET_THE_PRF_PAT_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( double TYP , QString ARG )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............
       if ( TYP == 1) {

 //+   SELECT DISTINCT '01'           AS CRITERE  ,
 //+      t2.cdf_nom            AS LIB ,
 //+      t1.CDFPF_CODEP_FK_PK  AS CODE,
 //+      t1.CDFPF_CODEF_FK_PK  AS FILS
 //+   FROM   CDFPF_LIEN_CDF_PERE_FILS t1,
 //+      CDF_CODIF                t2
 //+   WHERE  t1.CDFPF_CODEP_FK_PK       = t2.CDF_CODE_PK
 //+   AND    t1.CDFPF_NUMEROP_FK_PK       = t2.CDF_NUMERO_PK
 //+   AND    t2.CDF_NUMERO_PK             = 'TP'
 //+   AND    t1.CDFPF_CODEP_FK_PK         IN ('K','E','Q','I','T')
 //+   AND    t1.CDFPF_NUMEROF_FK_PK       = 'CS'
 //+   AND    t1.CDFPF_NUMORD              = (SELECT MIN(CDFPF_NUMORD)
 //+             FROM   CDFPF_LIEN_CDF_PERE_FILS t3
 //+                WHERE  t3.CDFPF_NUMEROP_FK_PK       = 'TP'
 //+                AND    t3.CDFPF_CODEP_FK_PK         = t1.CDFPF_CODEP_FK_PK
 //+                AND    t3.CDFPF_NUMEROF_FK_PK       = 'CS')
 //+        ORDER BY 2 ;
                sql_query += " SELECT DISTINCT '01'           AS CRITERE  ,"
                     " t2.CDF_NOM            AS LIB ,"
                     " t1.CDFPF_CODEP_FK_PK  AS CODE,"
                     " t1.CDFPF_CODEF_FK_PK  AS FILS"
                     " FROM   cdfpf_lien_cdf_pere_fils t1,"
                     " cdf_codif                t2"
                     " WHERE  t1.CDFPF_CODEP_FK_PK       = t2.CDF_CODE_PK"
                     " AND    t1.CDFPF_NUMEROP_FK_PK       = t2.CDF_NUMERO_PK"
                     " AND    t2.CDF_NUMERO_PK             = 'TP'"
                     " AND    t1.CDFPF_CODEP_FK_PK         IN ('K','E','Q','I','T')"
                     " AND    t1.CDFPF_NUMEROF_FK_PK       = 'CS'"
                     " AND    t1.CDFPF_NUMORD              = (SELECT MIN(CDFPF_NUMORD)"
                     " FROM   cdfpf_lien_cdf_pere_fils t3"
                     " WHERE  t3.CDFPF_NUMEROP_FK_PK       = 'TP'"
                     " AND    t3.CDFPF_CODEP_FK_PK         = t1.CDFPF_CODEP_FK_PK"
                     " AND    t3.CDFPF_NUMEROF_FK_PK       = 'CS')"
                     " ORDER BY 2 ;";

       } else if ( (TYP == 2) && (ARG.toInt() != 0)) {

 //+   SELECT DISTINCT '02'           AS CRITERE  ,
 //+      t2.cdf_nom            AS LIB ,
 //+      t1.CDFPF_CODEP_FK_PK  AS CODE ,
 //+      NULL                  AS FILS
 //+   FROM   CDFPF_LIEN_CDF_PERE_FILS t1,
 //+      CDF_CODIF                t2
 //+   WHERE  t1.CDFPF_CODEP_FK_PK   = t2.CDF_CODE_PK
 //+   AND    t1.CDFPF_NUMEROP_FK_PK = t2.CDF_NUMERO_PK
 //+   AND    t2.CDF_NUMERO_PK       = 'TP'
 //+   AND    t1.CDFPF_CODEP_FK_PK   LIKE ARG||'A%'
 //+   AND    t1.CDFPF_NUMEROF_FK_PK = 'CS'
 //+   AND    t1.CDFPF_NUMORD        = (SELECT MIN(CDFPF_NUMORD)
 //+            FROM   CDFPF_LIEN_CDF_PERE_FILS t3
 //+           WHERE  t3.CDFPF_NUMEROP_FK_PK       = 'TP'
 //+           AND    t3.CDFPF_CODEP_FK_PK         = t1.CDFPF_CODEP_FK_PK
 //+           AND    t3.CDFPF_NUMEROF_FK_PK       = 'CS')
 //+         ORDER BY 3,2 ;
                sql_query += " SELECT DISTINCT '02'           AS CRITERE  ,"
                     " t2.CDF_NOM            AS LIB ,"
                     " t1.CDFPF_CODEP_FK_PK  AS CODE ,"
                     " NULL                  AS FILS"
                     " FROM   cdfpf_lien_cdf_pere_fils t1,"
                     " cdf_codif                t2"
                     " WHERE  t1.CDFPF_CODEP_FK_PK   = t2.CDF_CODE_PK"
                     " AND    t1.CDFPF_NUMEROP_FK_PK = t2.CDF_NUMERO_PK"
                     " AND    t2.CDF_NUMERO_PK       = 'TP'"
                     " AND    t1.CDFPF_CODEP_FK_PK   LIKE '"+ARG+"'A%'"
                     " AND    t1.CDFPF_NUMEROF_FK_PK = 'CS'"
                     " AND    t1.CDFPF_NUMORD        = (SELECT MIN(CDFPF_NUMORD)"
                     " FROM   cdfpf_lien_cdf_pere_fils t3"
                     " WHERE  t3.CDFPF_NUMEROP_FK_PK       = 'TP'"
                     " AND    t3.CDFPF_CODEP_FK_PK         = t1.CDFPF_CODEP_FK_PK"
                     " AND    t3.CDFPF_NUMEROF_FK_PK       = 'CS')"
                     " ORDER BY 3,2 ;";

       } else if ( (TYP == 3) && (ARG.toInt() != 0)) {

 //+   SELECT DISTINCT '03'           AS CRITERE  ,
 //+      t2.cdf_nom            AS LIB ,
 //+      t1.CDFPF_CODEP_FK_PK  AS CODE ,
 //+      NULL                  AS FILS
 //+   FROM   CDFPF_LIEN_CDF_PERE_FILS t1,
 //+      CDF_CODIF                t2
 //+   WHERE  t1.CDFPF_CODEP_FK_PK       = t2.CDF_CODE_PK
 //+   AND    t1.CDFPF_NUMEROP_FK_PK       = t2.CDF_NUMERO_PK
 //+   AND    t2.CDF_NUMERO_PK             = 'TP'
 //+   AND    t1.CDFPF_CODEP_FK_PK         LIKE ARG||'P%'
 //+   AND    t1.CDFPF_NUMEROF_FK_PK       = 'CS'
 //+   AND    t1.CDFPF_NUMORD              = ( SELECT MIN(CDFPF_NUMORD)
 //+             FROM   CDFPF_LIEN_CDF_PERE_FILS t3
 //+             WHERE  t3.CDFPF_NUMEROP_FK_PK       = 'TP'
 //+             AND    t3.CDFPF_CODEP_FK_PK         = t1.CDFPF_CODEP_FK_PK
 //+             AND    t3.CDFPF_NUMEROF_FK_PK       = 'CS')
 //+  ORDER BY 3,2 ;
                sql_query += " SELECT DISTINCT '03'           AS CRITERE  ,"
                     " t2.CDF_NOM            AS LIB ,"
                     " t1.CDFPF_CODEP_FK_PK  AS CODE ,"
                     " NULL                  AS FILS"
                     " FROM   cdfpf_lien_cdf_pere_fils t1,"
                     " cdf_codif                t2"
                     " WHERE  t1.CDFPF_CODEP_FK_PK       = t2.CDF_CODE_PK"
                     " AND    t1.CDFPF_NUMEROP_FK_PK       = t2.CDF_NUMERO_PK"
                     " AND    t2.CDF_NUMERO_PK             = 'TP'"
                     " AND    t1.CDFPF_CODEP_FK_PK         LIKE '"+ARG+"'P%'"
                     " AND    t1.CDFPF_NUMEROF_FK_PK       = 'CS'"
                     " AND    t1.CDFPF_NUMORD              = ( SELECT MIN(CDFPF_NUMORD)"
                     " FROM   cdfpf_lien_cdf_pere_fils t3"
                     " WHERE  t3.CDFPF_NUMEROP_FK_PK       = 'TP'"
                     " AND    t3.CDFPF_CODEP_FK_PK         = t1.CDFPF_CODEP_FK_PK"
                     " AND    t3.CDFPF_NUMEROF_FK_PK       = 'CS')"
                     " ORDER BY 3,2 ;";

       } else if ( TYP == 4) {

 //+   SELECT DISTINCT '04'           AS CRITERE  ,
 //+      t2.cdf_nom            AS LIB ,
 //+      t1.CDFPF_CODEP_FK_PK  AS CODE ,
 //+      NULL                  AS FILS
 //+   FROM   CDFPF_LIEN_CDF_PERE_FILS t1,
 //+      CDF_CODIF                t2
 //+   WHERE  t1.CDFPF_CODEP_FK_PK        = t2.CDF_CODE_PK
 //+   AND    t1.CDFPF_NUMEROP_FK_PK       = t2.CDF_NUMERO_PK
 //+   AND    t2.CDF_NUMERO_PK             = 'TP'
 //+   AND    t1.CDFPF_CODEP_FK_PK         IN ('XX','XY')
 //+   AND    t1.CDFPF_NUMEROF_FK_PK       = 'CS'
 //+   AND    t1.CDFPF_NUMORD              = ( SELECT MIN(CDFPF_NUMORD)
 //+             FROM   CDFPF_LIEN_CDF_PERE_FILS t3
 //+             WHERE  t3.CDFPF_NUMEROP_FK_PK       = 'TP'
 //+             AND    t3.CDFPF_CODEP_FK_PK         = t1.CDFPF_CODEP_FK_PK
 //+             AND    t3.CDFPF_NUMEROF_FK_PK       = 'CS')
 //+         ORDER BY 3,2 ;
                sql_query += " SELECT DISTINCT '04'           AS CRITERE  ,"
                     " t2.CDF_NOM            AS LIB ,"
                     " t1.CDFPF_CODEP_FK_PK  AS CODE ,"
                     " NULL                  AS FILS"
                     " FROM   cdfpf_lien_cdf_pere_fils t1,"
                     " cdf_codif                t2"
                     " WHERE  t1.CDFPF_CODEP_FK_PK        = t2.CDF_CODE_PK"
                     " AND    t1.CDFPF_NUMEROP_FK_PK       = t2.CDF_NUMERO_PK"
                     " AND    t2.CDF_NUMERO_PK             = 'TP'"
                     " AND    t1.CDFPF_CODEP_FK_PK         IN ('XX','XY')"
                     " AND    t1.CDFPF_NUMEROF_FK_PK       = 'CS'"
                     " AND    t1.CDFPF_NUMORD              = ( SELECT MIN(CDFPF_NUMORD)"
                     " FROM   cdfpf_lien_cdf_pere_fils t3"
                     " WHERE  t3.CDFPF_NUMEROP_FK_PK       = 'TP'"
                     " AND    t3.CDFPF_CODEP_FK_PK         = t1.CDFPF_CODEP_FK_PK"
                     " AND    t3.CDFPF_NUMEROF_FK_PK       = 'CS')"
                     " ORDER BY 3,2 ;";

       } else if ( TYP == 5) {

 //+   SELECT DISTINCT '05'           AS CRITERE  ,
 //+      t2.cdf_nom            AS LIB ,
 //+      t1.CDFPF_CODEP_FK_PK  AS CODE,
 //+      NULL                  AS FILS
 //+   FROM   CDFPF_LIEN_CDF_PERE_FILS t1,
 //+      CDF_CODIF                t2
 //+   WHERE  t1.CDFPF_CODEP_FK_PK       = t2.CDF_CODE_PK
 //+   AND    t1.CDFPF_NUMEROP_FK_PK       = t2.CDF_NUMERO_PK
 //+   AND    t2.CDF_NUMERO_PK             = 'TP'
 //+   AND    t1.CDFPF_CODEP_FK_PK         IN ('F1','F2','F3')
 //+   AND    t1.CDFPF_NUMEROF_FK_PK       = 'CS'
 //+   AND    t1.CDFPF_NUMORD              = ( SELECT MIN(CDFPF_NUMORD)
 //+             FROM   CDFPF_LIEN_CDF_PERE_FILS t3
 //+             WHERE  t3.CDFPF_NUMEROP_FK_PK       = 'TP'
 //+             AND    t3.CDFPF_CODEP_FK_PK         = t1.CDFPF_CODEP_FK_PK
 //+             AND    t3.CDFPF_NUMEROF_FK_PK       = 'CS')
 //+         ORDER BY 3,2 ;
                sql_query += " SELECT DISTINCT '05'           AS CRITERE  ,"
                     " t2.CDF_NOM            AS LIB ,"
                     " t1.CDFPF_CODEP_FK_PK  AS CODE,"
                     " NULL                  AS FILS"
                     " FROM   cdfpf_lien_cdf_pere_fils t1,"
                     " cdf_codif                t2"
                     " WHERE  t1.CDFPF_CODEP_FK_PK       = t2.CDF_CODE_PK"
                     " AND    t1.CDFPF_NUMEROP_FK_PK       = t2.CDF_NUMERO_PK"
                     " AND    t2.CDF_NUMERO_PK             = 'TP'"
                     " AND    t1.CDFPF_CODEP_FK_PK         IN ('F1','F2','F3')"
                     " AND    t1.CDFPF_NUMEROF_FK_PK       = 'CS'"
                     " AND    t1.CDFPF_NUMORD              = ( SELECT MIN(CDFPF_NUMORD)"
                     " FROM   cdfpf_lien_cdf_pere_fils t3"
                     " WHERE  t3.CDFPF_NUMEROP_FK_PK       = 'TP'"
                     " AND    t3.CDFPF_CODEP_FK_PK         = t1.CDFPF_CODEP_FK_PK"
                     " AND    t3.CDFPF_NUMEROF_FK_PK       = 'CS')"
                     " ORDER BY 3,2 ;";

       } else if ( TYP == 6) {

 //+   SELECT DISTINCT '06'           AS CRITERE  ,
 //+      t2.cdf_nom            AS LIB ,
 //+      t1.CDFPF_CODEP_FK_PK  AS CODE ,
 //+       NULL                    AS FILS
 //+   FROM   CDFPF_LIEN_CDF_PERE_FILS t1,
 //+       CDF_CODIF                t2
 //+   WHERE  t1.CDFPF_CODEP_FK_PK        = t2.CDF_CODE_PK
 //+   AND    t1.CDFPF_NUMEROP_FK_PK       = t2.CDF_NUMERO_PK
 //+   AND    t2.CDF_NUMERO_PK             = 'TP'
 //+   AND   (t1.CDFPF_CODEP_FK_PK        LIKE 'U%' OR  t1.CDFPF_CODEP_FK_PK LIKE 'O%' )
 //+   AND    t1.CDFPF_NUMEROF_FK_PK       = 'CS'
 //+   AND    t1.CDFPF_NUMORD              = (SELECT MIN(CDFPF_NUMORD)
 //+                FROM   CDFPF_LIEN_CDF_PERE_FILS t3
 //+                WHERE  t3.CDFPF_NUMEROP_FK_PK       = 'TP'
 //+                AND    t3.CDFPF_CODEP_FK_PK         = t1.CDFPF_CODEP_FK_PK
 //+                AND    t3.CDFPF_NUMEROF_FK_PK       = 'CS')
 //+   ORDER BY 3,2 ;
                sql_query += " SELECT DISTINCT '06'           AS CRITERE  ,"
                     " t2.CDF_NOM            AS LIB ,"
                     " t1.CDFPF_CODEP_FK_PK  AS CODE ,"
                     " NULL                    AS FILS"
                     " FROM   cdfpf_lien_cdf_pere_fils t1,"
                     " cdf_codif                t2"
                     " WHERE  t1.CDFPF_CODEP_FK_PK        = t2.CDF_CODE_PK"
                     " AND    t1.CDFPF_NUMEROP_FK_PK       = t2.CDF_NUMERO_PK"
                     " AND    t2.CDF_NUMERO_PK             = 'TP'"
                     " AND   (t1.CDFPF_CODEP_FK_PK        LIKE 'U%' OR  t1.CDFPF_CODEP_FK_PK LIKE 'O%' )"
                     " AND    t1.CDFPF_NUMEROF_FK_PK       = 'CS'"
                     " AND    t1.CDFPF_NUMORD              = (SELECT MIN(CDFPF_NUMORD)"
                     " FROM   cdfpf_lien_cdf_pere_fils t3"
                     " WHERE  t3.CDFPF_NUMEROP_FK_PK       = 'TP'"
                     " AND    t3.CDFPF_CODEP_FK_PK         = t1.CDFPF_CODEP_FK_PK"
                     " AND    t3.CDFPF_NUMEROF_FK_PK       = 'CS')"
                     " ORDER BY 3,2 ;";

       } else if ( TYP == 7) {

 //+     SELECT DISTINCT '07'                    AS CRITERE ,
 //+      t3.cdf_nom                    AS LIB ,
 //+      t2.TERCOM_CDF_COM_CODE_FK_PK  AS CODE ,
 //+      NULL                          AS FILS
 //+   FROM   CDFPF_LIEN_CDF_PERE_FILS   t1,
 //+       TERCOM_TERRAIN_COMMENTAIRE t2,
 //+       CDF_CODIF                  t3
 //+   WHERE  t1.CDFPF_NUMEROP_FK_PK       = 'TP'
 //+   AND    t1.CDFPF_CODEP_FK_PK         = 'O1'
 //+   AND    t1.CDFPF_NUMEROF_FK_PK       = 'CS'
 //+   AND    t1.CDFPF_CODEF_FK_PK         = t2.TERCOM_CDF_TER_CODE_FK_PK
 //+   AND    t2.TERCOM_CDF_COM_CODE_FK_PK = t3.CDF_CODE_PK
 //+   AND    t3.CDF_NUMERO_PK             = 'CC'
 //+   AND   ( t2.TERCOM_CDF_COM_CODE_FK_PK LIKE 'E%' OR t2.TERCOM_CDF_COM_CODE_FK_PK LIKE 'H%' OR t2.TERCOM_CDF_COM_CODE_FK_PK LIKE 'L%' )
 //+   AND    t2.TERCOM_CDF_COM_CODE_FK_PK != 'E18'
 //+   ORDER BY 3 ;
                sql_query += " SELECT DISTINCT '07'                    AS CRITERE ,"
                     " t3.CDF_NOM                    AS LIB ,"
                     " t2.TERCOM_CDF_COM_CODE_FK_PK  AS CODE ,"
                     " NULL                          AS FILS"
                     " FROM   cdfpf_lien_cdf_pere_fils   t1,"
                     " tercom_terrain_commentaire t2,"
                     " cdf_codif                  t3"
                     " WHERE  t1.CDFPF_NUMEROP_FK_PK       = 'TP'"
                     " AND    t1.CDFPF_CODEP_FK_PK         = 'O1'"
                     " AND    t1.CDFPF_NUMEROF_FK_PK       = 'CS'"
                     " AND    t1.CDFPF_CODEF_FK_PK         = t2.TERCOM_CDF_TER_CODE_FK_PK"
                     " AND    t2.TERCOM_CDF_COM_CODE_FK_PK = t3.CDF_CODE_PK"
                     " AND    t3.CDF_NUMERO_PK             = 'CC'"
                     " AND   ( t2.TERCOM_CDF_COM_CODE_FK_PK LIKE 'E%' OR t2.TERCOM_CDF_COM_CODE_FK_PK LIKE 'H%' OR t2.TERCOM_CDF_COM_CODE_FK_PK LIKE 'L%' )"
                     " AND    t2.TERCOM_CDF_COM_CODE_FK_PK != 'E18'"
                     " ORDER BY 3 ;";

       } else if ( (TYP == 8) && (ARG.toInt() != 0)) {

 //+        SELECT  DISTINCT '08'                     AS CRITERE  ,
 //+        t3.cdf_nom                    AS LIB ,
 //+        t2.TERCOM_CDF_COM_CODE_FK_PK  AS CODE ,
 //+        NULL                          AS FILS
 //+   FROM   CDFPF_LIEN_CDF_PERE_FILS   t1,
 //+        TERCOM_TERRAIN_COMMENTAIRE t2,
 //+        CDF_CODIF                  t3
 //+   WHERE  t1.CDFPF_NUMEROP_FK_PK       = 'TP'
 //+   AND    t1.CDFPF_CODEP_FK_PK         = 'O1'
 //+   AND    t1.CDFPF_NUMEROF_FK_PK       = 'CS'
 //+   AND    t1.CDFPF_CODEF_FK_PK         = t2.TERCOM_CDF_TER_CODE_FK_PK
 //+   AND    t2.TERCOM_CDF_COM_CODE_FK_PK = t3.CDF_CODE_PK
 //+   AND    t3.CDF_NUMERO_PK             = 'CC'
 //+   AND   ( t2.TERCOM_CDF_COM_CODE_FK_PK LIKE 'E%' OR t2.TERCOM_CDF_COM_CODE_FK_PK LIKE 'H%' OR t2.TERCOM_CDF_COM_CODE_FK_PK LIKE 'L%' )
 //+   AND    t2.TERCOM_CDF_COM_CODE_FK_PK != 'E18'
 //+   AND    t3.CDF_NOM                   LIKE 'HYPERSENSIBILITE '||ARG;
                sql_query += " SELECT  DISTINCT '08'                     AS CRITERE  ,"
                     " t3.CDF_NOM                    AS LIB ,"
                     " t2.TERCOM_CDF_COM_CODE_FK_PK  AS CODE ,"
                     " NULL                          AS FILS"
                     " FROM   cdfpf_lien_cdf_pere_fils   t1,"
                     " tercom_terrain_commentaire t2,"
                     " cdf_codif                  t3"
                     " WHERE  t1.CDFPF_NUMEROP_FK_PK       = 'TP'"
                     " AND    t1.CDFPF_CODEP_FK_PK         = 'O1'"
                     " AND    t1.CDFPF_NUMEROF_FK_PK       = 'CS'"
                     " AND    t1.CDFPF_CODEF_FK_PK         = t2.TERCOM_CDF_TER_CODE_FK_PK"
                     " AND    t2.TERCOM_CDF_COM_CODE_FK_PK = t3.CDF_CODE_PK"
                     " AND    t3.CDF_NUMERO_PK             = 'CC'"
                     " AND   ( t2.TERCOM_CDF_COM_CODE_FK_PK LIKE 'E%' OR t2.TERCOM_CDF_COM_CODE_FK_PK LIKE 'H%' OR t2.TERCOM_CDF_COM_CODE_FK_PK LIKE 'L%' )"
                     " AND    t2.TERCOM_CDF_COM_CODE_FK_PK != 'E18'"
                     " AND    t3.CDF_NOM                   LIKE 'HYPERSENSIBILITE '"+ARG+"';";

       } else if ( TYP == 9) {

 //+   SELECT DISTINCT '09'           AS CRITERE  ,
 //+      t2.cdf_nom            AS LIB ,
 //+      t1.CDFPF_CODEP_FK_PK  AS CODE ,
 //+        NULL                   AS FILS
 //+   FROM   CDFPF_LIEN_CDF_PERE_FILS t1,
 //+      CDF_CODIF                t2
 //+   WHERE  t1.CDFPF_CODEP_FK_PK            = t2.CDF_CODE_PK
 //+   AND    t1.CDFPF_NUMEROP_FK_PK            = t2.CDF_NUMERO_PK
 //+   AND    t2.CDF_NUMERO_PK                  = 'TP'
 //+   AND    SUBSTR(t1.CDFPF_CODEP_FK_PK,0,1)  IN ('A','B','C','D','G','H','J','L','M','N','P','R','S','V','W','Y','Z')
 //+   AND    t1.CDFPF_NUMEROF_FK_PK            = 'CS'
 //+   AND    t1.CDFPF_NUMORD                   = (SELECT MIN(CDFPF_NUMORD)
 //+                   FROM   CDFPF_LIEN_CDF_PERE_FILS t3
 //+                   WHERE  t3.CDFPF_NUMEROP_FK_PK       = 'TP'
 //+                   AND    t3.CDFPF_CODEP_FK_PK         = t1.CDFPF_CODEP_FK_PK
 //+                   AND    t3.CDFPF_NUMEROF_FK_PK       = 'CS')
 //+    ORDER BY 2 ;
                sql_query += " SELECT DISTINCT '09'           AS CRITERE  ,"
                     " t2.CDF_NOM            AS LIB ,"
                     " t1.CDFPF_CODEP_FK_PK  AS CODE ,"
                     " NULL                   AS FILS"
                     " FROM   cdfpf_lien_cdf_pere_fils t1,"
                     " cdf_codif                t2"
                     " WHERE  t1.CDFPF_CODEP_FK_PK            = t2.CDF_CODE_PK"
                     " AND    t1.CDFPF_NUMEROP_FK_PK            = t2.CDF_NUMERO_PK"
                     " AND    t2.CDF_NUMERO_PK                  = 'TP'"
                     " AND    SUBSTR(t1.CDFPF_CODEP_FK_PK,0,1)  IN ('A','B','C','D','G','H','J','L','M','N','P','R','S','V','W','Y','Z')"
                     " AND    t1.CDFPF_NUMEROF_FK_PK            = 'CS'"
                     " AND    t1.CDFPF_NUMORD                   = (SELECT MIN(CDFPF_NUMORD)"
                     " FROM   cdfpf_lien_cdf_pere_fils t3"
                     " WHERE  t3.CDFPF_NUMEROP_FK_PK       = 'TP'"
                     " AND    t3.CDFPF_CODEP_FK_PK         = t1.CDFPF_CODEP_FK_PK"
                     " AND    t3.CDFPF_NUMEROF_FK_PK       = 'CS')"
                     " ORDER BY 2 ;";

       } else if ( (TYP == 10) && (ARG.toInt() != 0)) {

 //+   SELECT DISTINCT '10'           AS CRITERE  ,
 //+      t2.CDF_NOM            AS LIB ,
 //+      t1.CDFPF_CODEP_FK_PK  AS CODE ,
 //+      NULL                  AS FILS
 //+   FROM   CDFPF_LIEN_CDF_PERE_FILS t1,
 //+      CDF_CODIF                t2
 //+   WHERE  t1.CDFPF_CODEP_FK_PK            = t2.CDF_CODE_PK
 //+   AND    t1.CDFPF_NUMEROP_FK_PK            = t2.CDF_NUMERO_PK
 //+   AND    t2.CDF_NUMERO_PK                  = 'TP'
 //+   AND    SUBSTR(t1.CDFPF_CODEP_FK_PK,0,1)  IN ('A','B','C','D','G','H','J','L','M','N','P','R','S','V','W','Y','Z')
 //+   AND    t1.CDFPF_NUMEROF_FK_PK            = 'CS'
 //+   AND    t1.CDFPF_NUMORD                   = (SELECT MIN(CDFPF_NUMORD)
 //+                   FROM   CDFPF_LIEN_CDF_PERE_FILS t3
 //+                   WHERE  t3.CDFPF_NUMEROP_FK_PK       = 'TP'
 //+                   AND    t3.CDFPF_CODEP_FK_PK         = t1.CDFPF_CODEP_FK_PK
 //+                   AND    t3.CDFPF_NUMEROF_FK_PK       = 'CS')
 //+    AND  t2.cdf_nom LIKE ARG
 //+    ORDER BY 2 ;
                sql_query += " SELECT DISTINCT '10'           AS CRITERE  ,"
                     " t2.CDF_NOM            AS LIB ,"
                     " t1.CDFPF_CODEP_FK_PK  AS CODE ,"
                     " NULL                  AS FILS"
                     " FROM   cdfpf_lien_cdf_pere_fils t1,"
                     " cdf_codif                t2"
                     " WHERE  t1.CDFPF_CODEP_FK_PK            = t2.CDF_CODE_PK"
                     " AND    t1.CDFPF_NUMEROP_FK_PK            = t2.CDF_NUMERO_PK"
                     " AND    t2.CDF_NUMERO_PK                  = 'TP'"
                     " AND    SUBSTR(t1.CDFPF_CODEP_FK_PK,0,1)  IN ('A','B','C','D','G','H','J','L','M','N','P','R','S','V','W','Y','Z')"
                     " AND    t1.CDFPF_NUMEROF_FK_PK            = 'CS'"
                     " AND    t1.CDFPF_NUMORD                   = (SELECT MIN(CDFPF_NUMORD)"
                     " FROM   cdfpf_lien_cdf_pere_fils t3"
                     " WHERE  t3.CDFPF_NUMEROP_FK_PK       = 'TP'"
                     " AND    t3.CDFPF_CODEP_FK_PK         = t1.CDFPF_CODEP_FK_PK"
                     " AND    t3.CDFPF_NUMEROF_FK_PK       = 'CS')"
                     " AND  t2.cdf_nom LIKE '"+ARG+"'"
                     " ORDER BY 2 ;";

       } else {

 //+   SELECT NULL          AS CRITERE  ,
 //+       NULL          AS LIB ,
 //+       NULL          AS CODE ,
 //+       NULL          AS FILS
 //+   FROM   CDFPF_LIEN_CDF_PERE_FILS
 //+   WHERE ROWNUM = 1;
                sql_query += " SELECT NULL          AS CRITERE  ,"
                     " NULL          AS LIB ,"
                     " NULL          AS CODE ,"
                     " NULL          AS FILS"
                     " FROM   cdfpf_lien_cdf_pere_fils"
                     " WHERE ROWNUM = 1;";

       }
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_PRF_PAT() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_CRITERE = value(0).toString();
                m_LIB     = value(1).toString();
                m_CODE    = value(2).toString();
                m_FILS    = value(3).toString();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      QString CRITERE() {return m_CRITERE;}
      QString LIB()     {return m_LIB;}
      QString CODE()    {return m_CODE;}
      QString FILS()    {return m_FILS;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      QString m_CRITERE;
      QString m_LIB;
      QString m_CODE;
      QString m_FILS;
 };

 //================================== C_GET_THE_PRF_FILS_CUR   -98- ==================================
 /****************************************************************************
 *   Nom           :  GET_THE_PRF_FILS
 -----------------------------------------------------------------------------
 *   Date creation : 17/09/2008
 -----------------------------------------------------------------------------
 *   Description   : Cette procédure renvoie les fils pour les codes pères passés en paramètre.
 *   MAJ           : 12/12/2008
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_PRF_FILS_CUR  C_GET_THE_PRF_FILS ( database(), this );
      while ( C_GET_THE_PRF_FILS.next( T_AGE , PATHO  ) )
            { html += tr("<br><b> GET_THE_PRF_FILS : </b>  ") + C_GET_THE_PRF_FILS.MEMBER();
            }
  */
  class C_GET_THE_PRF_FILS_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_PRF_FILS_CUR ---------------------
      C_GET_THE_PRF_FILS_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( QString T_AGE , QString PATHO )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............

 //+  '  SELECT DISTINCT ''01''         TYP  ,                           '||
 //+     '      t1.CDFPF_CODEP_FK_PK  PERE,                            '||
 //+     '      t1.CDFPF_CODEF_FK_PK  FILS,                            '||
 //+     '      t2.CDF_NOM            LIB ,                            '||
 //+     '      t1.CDFPF_NUMORD       NO_ORD                           '||
 //+     '  FROM   CDFPF_LIEN_CDF_PERE_FILS t1,                          '||
 //+     '      CDF_CODIF                t2                            '||
 //+  ' WHERE  t1.CDFPF_CODEF_FK_PK       = t2.CDF_CODE_PK               '||
 //+  ' AND    t1.CDFPF_NUMEROP_FK_PK     =  ''TP''                      '||
 //+  ' AND    t1.CDFPF_NUMEROF_FK_PK = t2.CDF_NUMERO_PK                 '||
 //+  ' AND   (t1.CDFPF_CODEP_FK_PK = '''||T_AGE||''' or t1.CDFPF_CODEP_FK_PK  IN ('||PATHO||')' ||')'  ||
 //+  ' AND   t1.CDFPF_NUMEROF_FK_PK       = ''NC''                      '||
 //+  ' UNION                                                            '||
 //+  ' SELECT DISTINCT ''02''         TYP  ,                            '||
 //+     '      t1.CDFPF_CODEP_FK_PK  PERE,                            '||
 //+     '      t1.CDFPF_CODEF_FK_PK  FILS,                            '||
 //+     '      t2.CDF_NOM            LIB ,                            '||
 //+     '      t1.CDFPF_NUMORD       NO_ORD                           '||
 //+     ' FROM   CDFPF_LIEN_CDF_PERE_FILS t1,                              '||
 //+     '   CDF_CODIF                t2                               '||
 //+  ' WHERE  t1.CDFPF_CODEF_FK_PK       = t2.CDF_CODE_PK               '||
 //+  ' AND    t1.CDFPF_NUMEROF_FK_PK = t2.CDF_NUMERO_PK                 '||
 //+  ' AND    t1.CDFPF_NUMEROP_FK_PK      =  ''TP''                     '||
 //+  ' AND   (t1.CDFPF_CODEP_FK_PK   = '''||T_AGE||''' or t1.CDFPF_CODEP_FK_PK  IN ('||PATHO||')' ||')'  ||
 //+  ' AND    t1.CDFPF_NUMEROF_FK_PK       = ''NN''                     ';
                sql_query += " SELECT DISTINCT '01'         TYP  ,"
                     " t1.CDFPF_CODEP_FK_PK  PERE,"
                     " t1.CDFPF_CODEF_FK_PK  FILS,"
                     " t2.CDF_NOM            LIB ,"
                     " t1.CDFPF_NUMORD       NO_ORD"
                     " FROM   cdfpf_lien_cdf_pere_fils t1,"
                     " cdf_codif                t2"
                     " WHERE  t1.CDFPF_CODEF_FK_PK       = t2.CDF_CODE_PK"
                     " AND    t1.CDFPF_NUMEROP_FK_PK     =  'TP'"
                     " AND    t1.CDFPF_NUMEROF_FK_PK = t2.CDF_NUMERO_PK"
                     " AND   (t1.CDFPF_CODEP_FK_PK = '"+T_AGE+"' or t1.CDFPF_CODEP_FK_PK  IN ('"+PATHO+"')')'"
                     " AND   t1.CDFPF_NUMEROF_FK_PK       = 'NC'"
                     " UNION"
                     " SELECT DISTINCT '02'         TYP  ,"
                     " t1.CDFPF_CODEP_FK_PK  PERE,"
                     " t1.CDFPF_CODEF_FK_PK  FILS,"
                     " t2.CDF_NOM            LIB ,"
                     " t1.CDFPF_NUMORD       NO_ORD"
                     " FROM   cdfpf_lien_cdf_pere_fils t1,"
                     " cdf_codif                t2"
                     " WHERE  t1.CDFPF_CODEF_FK_PK       = t2.CDF_CODE_PK"
                     " AND    t1.CDFPF_NUMEROF_FK_PK = t2.CDF_NUMERO_PK"
                     " AND    t1.CDFPF_NUMEROP_FK_PK      =  'TP'"
                     " AND   (t1.CDFPF_CODEP_FK_PK   = '"+T_AGE+"' or t1.CDFPF_CODEP_FK_PK  IN ('"+PATHO+"')')'"
                     " AND    t1.CDFPF_NUMEROF_FK_PK       = 'NN';";
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_PRF_FILS() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_TYP    = value(0).toString();
                m_PERE   = value(1).toString();
                m_FILS   = value(2).toString();
                m_LIB    = value(3).toString();
                m_NO_ORD = value(4).toDouble();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      QString TYP()    {return m_TYP;}
      QString PERE()   {return m_PERE;}
      QString FILS()   {return m_FILS;}
      QString LIB()    {return m_LIB;}
      double  NO_ORD() {return m_NO_ORD;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      QString m_TYP;
      QString m_PERE;
      QString m_FILS;
      QString m_LIB;
      double  m_NO_ORD;
 };

 //================================== C_GET_THE_PRF_INDIC_CUR   -99- ==================================
 /****************************************************************************
 *   Nom           :  GET_THE_PRF_INDIC
 -----------------------------------------------------------------------------
 *   Date creation : 18/09/2008
 -----------------------------------------------------------------------------
 *   Description   : Cette procédure permet de récupérer les identifiants
 *                   qui permettront de retrouver la liste ordonnée des fiches indications.
 *   MAJ           : 27/10/2008
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_PRF_INDIC_CUR  C_GET_THE_PRF_INDIC ( database(), this );
      while ( C_GET_THE_PRF_INDIC.next( CDF_NC , CDF_NN , ID_SPE  ) )
            { html += tr("<br><b> GET_THE_PRF_INDIC : </b>  ") + C_GET_THE_PRF_INDIC.MEMBER();
            }
  */
  class C_GET_THE_PRF_INDIC_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_PRF_INDIC_CUR ---------------------
      C_GET_THE_PRF_INDIC_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( QString CDF_NC , QString CDF_NN , double ID_SPE )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............

 //+  ' SELECT DISTINCT ''01''            PDS,  '||
 //+  '        t1.FINCON_FIN_CODE_FK_PK   ID_IND '||
 //+  ' FROM   FINCON_FINDCOMMENT_NATURE  t1,                       '||
 //+  '        FINSP_INDSPE               t2,                       '||
 //+  '     CDF_CODIF                  t3,                        '||
 //+  '     FIN_FICHEINDIC             t4,                        '||
 //+  '     CDF_CODIF                  t5                         '||
 //+  ' WHERE  t1.FINCON_CDF_COIN_CODE_FK_PK  IN ('||CDF_NC||')'     ||
 //+  ' AND    t1.FINCON_CDF_COIN_CODE_FK_PK  = t3.CDF_CODE_PK      '||
 //+  ' AND    t3.CDF_NUMERO_PK          = ''NC''                   '||
 //+  ' AND    t1.FINCON_FIN_CODE_FK_PK = t2.FINSP_FIN_CODE_FK_PK   '||
 //+  ' AND    t2.FINSP_SP_CODE_FK_PK    = '||ID_SPE||
 //+  ' AND     t4.FIN_CODE_SQ_PK        = t2.FINSP_FIN_CODE_FK_PK  '||
 //+  ' AND     t4.FIN_CDF_NAIN_CODE_FK_PK =  t5.CDF_CODE_PK        '||
 //+  ' AND     t5.CDF_NUMERO_PK           = ''NN''                 '||
 //+  ' AND     t4.FIN_CDF_NAIN_CODE_FK_PK IN ('||CDF_NN||')'        ||
 //+  ' UNION                                                       '||
 //+  ' (SELECT ''02''     PDS,                       '||
 //+  '        t1.FINCON_FIN_CODE_FK_PK    ID_IND                   '||
 //+  ' FROM   FINCON_FINDCOMMENT_NATURE  t1,                       '||
 //+  '        FINSP_INDSPE               t2,                       '||
 //+  '     CDF_CODIF                  t3                         '||
 //+  ' WHERE  t1.FINCON_CDF_COIN_CODE_FK_PK   IN ('||CDF_NC||')'    ||
 //+  ' AND    t1.FINCON_CDF_COIN_CODE_FK_PK  = t3.CDF_CODE_PK      '||
 //+  ' AND    t3.CDF_NUMERO_PK               = ''NC''              '||
 //+  ' AND    t1.FINCON_FIN_CODE_FK_PK = t2.FINSP_FIN_CODE_FK_PK   '||
 //+  ' AND    t2.FINSP_SP_CODE_FK_PK = '||ID_SPE||
 //+  ' MINUS                                                       '||
 //+  ' SELECT  ''02''               PDS,                           '||
 //+  '         t1.FIN_CODE_SQ_PK  ID_IND                           '||
 //+  ' FROM    FIN_FICHEINDIC  t1,                                 '||
 //+  '         FINSP_INDSPE    t2 ,                                '||
 //+  '   CDF_CODIF       t3                                    '||
 //+  ' WHERE   t1.FIN_CODE_SQ_PK          = t2.FINSP_FIN_CODE_FK_PK'||
 //+  ' AND     t1.FIN_CDF_NAIN_CODE_FK_PK =  t3.CDF_CODE_PK        '||
 //+  ' AND     t3.CDF_NUMERO_PK               = ''NN''             '||
 //+  ' AND     t1.FIN_CDF_NAIN_CODE_FK_PK IN ('||CDF_NN||')'        ||
 //+  ' AND     t2.FINSP_SP_CODE_FK_PK    =  '||ID_SPE||')          '||
 //+  ' UNION                                                       '||
 //+  ' (SELECT  ''03''               PDS,                          '||
 //+  '         t1.FIN_CODE_SQ_PK  ID_IND                           '||
 //+  ' FROM    FIN_FICHEINDIC  t1,                                 '||
 //+  '         FINSP_INDSPE    t2 ,                                '||
 //+  '   CDF_CODIF       t3                                    '||
 //+  ' WHERE   t1.FIN_CODE_SQ_PK          = t2.FINSP_FIN_CODE_FK_PK'||
 //+  ' AND     t1.FIN_CDF_NAIN_CODE_FK_PK =  t3.CDF_CODE_PK        '||
 //+  ' AND     t3.CDF_NUMERO_PK               = ''NN''             '||
 //+  ' AND     t1.FIN_CDF_NAIN_CODE_FK_PK  IN ('||CDF_NN||')'       ||
 //+  ' AND     t2.FINSP_SP_CODE_FK_PK     = '||ID_SPE||
 //+  ' MINUS                                                       '||
 //+  ' SELECT ''03''     PDS,                       '||
 //+  '        t1.FINCON_FIN_CODE_FK_PK    ID_IND                   '||
 //+  ' FROM   FINCON_FINDCOMMENT_NATURE  t1,                       '||
 //+  '        FINSP_INDSPE               t2,                       '||
 //+  '     CDF_CODIF                  t3                         '||
 //+  ' WHERE  t1.FINCON_CDF_COIN_CODE_FK_PK  IN ('||CDF_NC||')'     ||
 //+  ' AND    t1.FINCON_CDF_COIN_CODE_FK_PK  = t3.CDF_CODE_PK      '||
 //+  ' AND    t3.CDF_NUMERO_PK               = ''NC''              '||
 //+  ' AND    t1.FINCON_FIN_CODE_FK_PK = t2.FINSP_FIN_CODE_FK_PK    '||
 //+  ' AND    t2.FINSP_SP_CODE_FK_PK  =  '||ID_SPE||')              '||
 //+  ' UNION                                                        '||
 //+  '  SELECT  DISTINCT ''04''               PDS,                   '||
 //+  '  t1.FIN_CODE_SQ_PK  ID_IND                                    '||
 //+  '  FROM    FIN_FICHEINDIC  t1,                                  '||
 //+  '  FINSP_INDSPE    t2                                           '||
 //+  '  WHERE   t1.FIN_CODE_SQ_PK          = t2.FINSP_FIN_CODE_FK_PK '||
 //+  '  AND     t2.FINSP_FIN_CODE_FK_PK    NOT IN (SELECT FINCON_FIN_CODE_FK_PK FROM FINCON_FINDCOMMENT_NATURE) '||
 //+  '  AND     t2.FINSP_SP_CODE_FK_PK      = '||ID_SPE ;
                sql_query += " SELECT DISTINCT '01'            PDS,"
                     " t1.FINCON_FIN_CODE_FK_PK   ID_IND"
                     " FROM   fincon_findcomment_nature  t1,"
                     " finsp_indspe               t2,"
                     " cdf_codif                  t3,"
                     " fin_ficheindic             t4,"
                     " cdf_codif                  t5"
                     " WHERE  t1.FINCON_CDF_COIN_CODE_FK_PK  IN ('"+CDF_NC+"')'"
                     " AND    t1.FINCON_CDF_COIN_CODE_FK_PK  = t3.CDF_CODE_PK"
                     " AND    t3.CDF_NUMERO_PK          = 'NC'"
                     " AND    t1.FINCON_FIN_CODE_FK_PK = t2.FINSP_FIN_CODE_FK_PK"
                     " AND    t2.FINSP_SP_CODE_FK_PK    = '"+ QString::number( ID_SPE ) +"'"
                     " AND     t4.FIN_CODE_SQ_PK        = t2.FINSP_FIN_CODE_FK_PK"
                     " AND     t4.FIN_CDF_NAIN_CODE_FK_PK =  t5.CDF_CODE_PK"
                     " AND     t5.CDF_NUMERO_PK           = 'NN'"
                     " AND     t4.FIN_CDF_NAIN_CODE_FK_PK IN ('"+CDF_NN+"')'"
                     " UNION"
                     " (SELECT '02'     PDS,"
                     " t1.FINCON_FIN_CODE_FK_PK    ID_IND"
                     " FROM   fincon_findcomment_nature  t1,"
                     " finsp_indspe               t2,"
                     " cdf_codif                  t3"
                     " WHERE  t1.FINCON_CDF_COIN_CODE_FK_PK   IN ('"+CDF_NC+"')'"
                     " AND    t1.FINCON_CDF_COIN_CODE_FK_PK  = t3.CDF_CODE_PK"
                     " AND    t3.CDF_NUMERO_PK               = 'NC'"
                     " AND    t1.FINCON_FIN_CODE_FK_PK = t2.FINSP_FIN_CODE_FK_PK"
                     " AND    t2.FINSP_SP_CODE_FK_PK = '"+ QString::number( ID_SPE ) +"'"
                     " MINUS"
                     " SELECT  '02'               PDS,"
                     " t1.FIN_CODE_SQ_PK  ID_IND"
                     " FROM    fin_ficheindic  t1,"
                     " finsp_indspe    t2 ,"
                     " cdf_codif       t3"
                     " WHERE   t1.FIN_CODE_SQ_PK          = t2.FINSP_FIN_CODE_FK_PK"
                     " AND     t1.FIN_CDF_NAIN_CODE_FK_PK =  t3.CDF_CODE_PK"
                     " AND     t3.CDF_NUMERO_PK               = 'NN'"
                     " AND     t1.FIN_CDF_NAIN_CODE_FK_PK IN ('"+CDF_NN+"')'"
                     " AND     t2.FINSP_SP_CODE_FK_PK    =  '"+ QString::number( ID_SPE ) +"')"
                     " UNION"
                     " (SELECT  '03'               PDS,"
                     " t1.FIN_CODE_SQ_PK  ID_IND"
                     " FROM    fin_ficheindic  t1,"
                     " finsp_indspe    t2 ,"
                     " cdf_codif       t3"
                     " WHERE   t1.FIN_CODE_SQ_PK          = t2.FINSP_FIN_CODE_FK_PK"
                     " AND     t1.FIN_CDF_NAIN_CODE_FK_PK =  t3.CDF_CODE_PK"
                     " AND     t3.CDF_NUMERO_PK               = 'NN'"
                     " AND     t1.FIN_CDF_NAIN_CODE_FK_PK  IN ('"+CDF_NN+"')'"
                     " AND     t2.FINSP_SP_CODE_FK_PK     = '"+ QString::number( ID_SPE ) +"'"
                     " MINUS"
                     " SELECT '03'     PDS,"
                     " t1.FINCON_FIN_CODE_FK_PK    ID_IND"
                     " FROM   fincon_findcomment_nature  t1,"
                     " finsp_indspe               t2,"
                     " cdf_codif                  t3"
                     " WHERE  t1.FINCON_CDF_COIN_CODE_FK_PK  IN ('"+CDF_NC+"')'"
                     " AND    t1.FINCON_CDF_COIN_CODE_FK_PK  = t3.CDF_CODE_PK"
                     " AND    t3.CDF_NUMERO_PK               = 'NC'"
                     " AND    t1.FINCON_FIN_CODE_FK_PK = t2.FINSP_FIN_CODE_FK_PK"
                     " AND    t2.FINSP_SP_CODE_FK_PK  =  '"+ QString::number( ID_SPE ) +"')"
                     " UNION"
                     " SELECT  DISTINCT '04'               PDS,"
                     " t1.FIN_CODE_SQ_PK  ID_IND"
                     " FROM    fin_ficheindic  t1,"
                     " finsp_indspe    t2"
                     " WHERE   t1.FIN_CODE_SQ_PK          = t2.FINSP_FIN_CODE_FK_PK"
                     " AND     t2.FINSP_FIN_CODE_FK_PK    NOT IN (SELECT FINCON_FIN_CODE_FK_PK FROM FINCON_FINDCOMMENT_NATURE)"
                     " AND     t2.FINSP_SP_CODE_FK_PK      = '"+ QString::number( ID_SPE ) +"';";
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_PRF_INDIC() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_PDS    = value(0).toString();
                m_ID_IND = value(1).toString();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      QString PDS()    {return m_PDS;}
      QString ID_IND() {return m_ID_IND;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      QString m_PDS;
      QString m_ID_IND;
 };

 //================================== C_GET_THE_PRF_POSO_CUR   -100- ==================================
 /****************************************************************************
 *   Nom           :  GET_THE_PRF_POSO
 -----------------------------------------------------------------------------
 *   Date creation : 18/09/2008
 -----------------------------------------------------------------------------
 *   Description   : Cette procédure renvoie les fiches posologiques qui
 *                   correspondent au profil profil du Patient à l'exclusion de toutes autres.
 *   MAJ           : 18/12/2008
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_PRF_POSO_CUR  C_GET_THE_PRF_POSO ( database(), this );
      while ( C_GET_THE_PRF_POSO.next( ID_SPE , A_G , POI , PATHO , T_A , SEXE  ) )
            { html += tr("<br><b> GET_THE_PRF_POSO : </b>  ") + C_GET_THE_PRF_POSO.MEMBER();
            }
  */
  class C_GET_THE_PRF_POSO_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_PRF_POSO_CUR ---------------------
      C_GET_THE_PRF_POSO_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( double ID_SPE , QString A_G , QString POI , QString PATHO , QString T_A , QString SEXE )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............

 //+  '   SELECT  DISTINCT ''01''    PDS ,                                 '||
 //+  '           t1.fposp_fpo_code_fk_pk  ID_POSO                          '||
 //+  '   FROM    FPOSP_POSO_SPE      t1  ,                                '||
 //+  '           FPOTE_FPOSO_TERRAIN t2  ,                                '||
 //+  '     CDFPF_LIEN_CDF_PERE_FILS t3                                 '||
 //+  '   WHERE   t1.FPOSP_FPO_CODE_FK_PK      = t2.FPOTE_FPO_CODE_FK_PK   '||
 //+  '   AND     t2.FPOTE_CDF_TEPO_CODE_FK_PK = t3.CDFPF_CODEF_FK_PK      '||
 //+  '   AND     t3.CDFPF_NUMEROP_FK_PK       = ''TP''                    '||
 //+  '   AND     t3.CDFPF_CODEP_FK_PK        IN ('||A_G||')'               ||
 //+  '   AND     t1.FPOSP_SP_CODE_FK_PK       = '||ID_SPE                  ||
 //+      '   UNION                                                              '||
 //+  '   SELECT  DISTINCT ''02''    PDS ,                                 '||
 //+  '           t1.fposp_fpo_code_fk_pk  ID_POSO                         '||
 //+  '   FROM    FPOSP_POSO_SPE      t1  ,                                '||
 //+  '           FPOTE_FPOSO_TERRAIN t2  ,                                '||
 //+  '     CDFPF_LIEN_CDF_PERE_FILS t3                              '||
 //+  '   WHERE   t1.FPOSP_FPO_CODE_FK_PK      = t2.FPOTE_FPO_CODE_FK_PK   '||
 //+  '   AND     t2.FPOTE_CDF_TEPO_CODE_FK_PK = t3.CDFPF_CODEF_FK_PK      '||
 //+  '   AND     t3.CDFPF_NUMEROP_FK_PK       = ''TP''                    '||
 //+  '   AND     t3.CDFPF_CODEP_FK_PK        IN ('||POI||')'               ||
 //+  '   AND     t1.FPOSP_SP_CODE_FK_PK       = '||ID_SPE                  ||
 //+  '   UNION                                                            '||
 //+  '   SELECT  DISTINCT ''03''    PDS ,                                 '||
 //+  '           t1.fposp_fpo_code_fk_pk  ID_POSO                         '||
 //+  '   FROM    FPOSP_POSO_SPE      t1  ,                                '||
 //+  '           FPOTE_FPOSO_TERRAIN t2  ,                                '||
 //+  '     CDFPF_LIEN_CDF_PERE_FILS t3                              '||
 //+  '   WHERE   t1.FPOSP_FPO_CODE_FK_PK      = t2.FPOTE_FPO_CODE_FK_PK   '||
 //+  '   AND     t2.FPOTE_CDF_TEPO_CODE_FK_PK = t3.CDFPF_CODEF_FK_PK      '||
 //+  '   AND     t3.CDFPF_NUMEROP_FK_PK       = ''TP''                    '||
 //+  '   AND     t3.CDFPF_CODEP_FK_PK        IN ('||PATHO||')'             ||
 //+  '   AND     t1.FPOSP_SP_CODE_FK_PK       = '||ID_SPE                  ||
 //+        '   UNION                                                            '||
 //+  '   SELECT  DISTINCT ''04''    PDS ,                                 '||
 //+  '           t1.fposp_fpo_code_fk_pk  ID_POSO                         '||
 //+  '   FROM    FPOSP_POSO_SPE      t1  ,                                '||
 //+  '           FPOTE_FPOSO_TERRAIN t2  ,                                '||
 //+  '     CDFPF_LIEN_CDF_PERE_FILS t3                              '||
 //+  '   WHERE   t1.FPOSP_FPO_CODE_FK_PK      = t2.FPOTE_FPO_CODE_FK_PK   '||
 //+  '   AND     t2.FPOTE_CDF_TEPO_CODE_FK_PK = t3.CDFPF_CODEF_FK_PK      '||
 //+  '   AND     t3.CDFPF_NUMEROP_FK_PK       = ''TP''                    '||
 //+  '   AND     t3.CDFPF_CODEP_FK_PK     = '''||T_A||''''         ||
 //+  '   AND     t1.FPOSP_SP_CODE_FK_PK   = '||ID_SPE                      ||
 //+        '   UNION                                                            '||
 //+  '   SELECT  DISTINCT ''05''    PDS ,                                 '||
 //+  '           t1.fposp_fpo_code_fk_pk  ID_POSO                         '||
 //+  '   FROM    FPOSP_POSO_SPE      t1  ,                                '||
 //+  '           FPOTE_FPOSO_TERRAIN t2  ,                                '||
 //+  '     CDFPF_LIEN_CDF_PERE_FILS t3                              '||
 //+  '   WHERE   t1.FPOSP_FPO_CODE_FK_PK      = t2.FPOTE_FPO_CODE_FK_PK   '||
 //+  '   AND     t2.FPOTE_CDF_TEPO_CODE_FK_PK = t3.CDFPF_CODEF_FK_PK      '||
 //+  '   AND     t3.CDFPF_NUMEROP_FK_PK       = ''TP''                    '||
 //+  '   AND     t3.CDFPF_CODEP_FK_PK      = '''||SEXE||''''               ||
 //+  '   AND     t1.FPOSP_SP_CODE_FK_PK    = '||ID_SPE ;
                sql_query += " SELECT  DISTINCT '01'    PDS ,"
                     " t1.FPOSP_FPO_CODE_FK_PK  ID_POSO"
                     " FROM    fposp_poso_spe      t1  ,"
                     " fpote_fposo_terrain t2  ,"
                     " cdfpf_lien_cdf_pere_fils t3"
                     " WHERE   t1.FPOSP_FPO_CODE_FK_PK      = t2.FPOTE_FPO_CODE_FK_PK"
                     " AND     t2.FPOTE_CDF_TEPO_CODE_FK_PK = t3.CDFPF_CODEF_FK_PK"
                     " AND     t3.CDFPF_NUMEROP_FK_PK       = 'TP'"
                     " AND     t3.CDFPF_CODEP_FK_PK        IN ('"+A_G+"')'"
                     " AND     t1.FPOSP_SP_CODE_FK_PK       = '"+ QString::number( ID_SPE ) +"'"
                     " UNION"
                     " SELECT  DISTINCT '02'    PDS ,"
                     " t1.FPOSP_FPO_CODE_FK_PK  ID_POSO"
                     " FROM    fposp_poso_spe      t1  ,"
                     " fpote_fposo_terrain t2  ,"
                     " cdfpf_lien_cdf_pere_fils t3"
                     " WHERE   t1.FPOSP_FPO_CODE_FK_PK      = t2.FPOTE_FPO_CODE_FK_PK"
                     " AND     t2.FPOTE_CDF_TEPO_CODE_FK_PK = t3.CDFPF_CODEF_FK_PK"
                     " AND     t3.CDFPF_NUMEROP_FK_PK       = 'TP'"
                     " AND     t3.CDFPF_CODEP_FK_PK        IN ('"+POI+"')'"
                     " AND     t1.FPOSP_SP_CODE_FK_PK       = '"+ QString::number( ID_SPE ) +"'"
                     " UNION"
                     " SELECT  DISTINCT '03'    PDS ,"
                     " t1.FPOSP_FPO_CODE_FK_PK  ID_POSO"
                     " FROM    fposp_poso_spe      t1  ,"
                     " fpote_fposo_terrain t2  ,"
                     " cdfpf_lien_cdf_pere_fils t3"
                     " WHERE   t1.FPOSP_FPO_CODE_FK_PK      = t2.FPOTE_FPO_CODE_FK_PK"
                     " AND     t2.FPOTE_CDF_TEPO_CODE_FK_PK = t3.CDFPF_CODEF_FK_PK"
                     " AND     t3.CDFPF_NUMEROP_FK_PK       = 'TP'"
                     " AND     t3.CDFPF_CODEP_FK_PK        IN ('"+PATHO+"')'"
                     " AND     t1.FPOSP_SP_CODE_FK_PK       = '"+ QString::number( ID_SPE ) +"'"
                     " UNION"
                     " SELECT  DISTINCT '04'    PDS ,"
                     " t1.FPOSP_FPO_CODE_FK_PK  ID_POSO"
                     " FROM    fposp_poso_spe      t1  ,"
                     " fpote_fposo_terrain t2  ,"
                     " cdfpf_lien_cdf_pere_fils t3"
                     " WHERE   t1.FPOSP_FPO_CODE_FK_PK      = t2.FPOTE_FPO_CODE_FK_PK"
                     " AND     t2.FPOTE_CDF_TEPO_CODE_FK_PK = t3.CDFPF_CODEF_FK_PK"
                     " AND     t3.CDFPF_NUMEROP_FK_PK       = 'TP'"
                     " AND     t3.CDFPF_CODEP_FK_PK     = '"+T_A+"'"
                     " AND     t1.FPOSP_SP_CODE_FK_PK   = '"+ QString::number( ID_SPE ) +"'"
                     " UNION"
                     " SELECT  DISTINCT '05'    PDS ,"
                     " t1.FPOSP_FPO_CODE_FK_PK  ID_POSO"
                     " FROM    fposp_poso_spe      t1  ,"
                     " fpote_fposo_terrain t2  ,"
                     " cdfpf_lien_cdf_pere_fils t3"
                     " WHERE   t1.FPOSP_FPO_CODE_FK_PK      = t2.FPOTE_FPO_CODE_FK_PK"
                     " AND     t2.FPOTE_CDF_TEPO_CODE_FK_PK = t3.CDFPF_CODEF_FK_PK"
                     " AND     t3.CDFPF_NUMEROP_FK_PK       = 'TP'"
                     " AND     t3.CDFPF_CODEP_FK_PK      = '"+SEXE+"'"
                     " AND     t1.FPOSP_SP_CODE_FK_PK    = '"+ QString::number( ID_SPE ) +"';";
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_PRF_POSO() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_PDS     = value(0).toString();
                m_ID_POSO = value(1).toString();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      QString PDS()     {return m_PDS;}
      QString ID_POSO() {return m_ID_POSO;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      QString m_PDS;
      QString m_ID_POSO;
 };

 //================================== C_GET_THE_PRF_HYPER_CUR   -101- ==================================
 /****************************************************************************
 *   Nom           :  GET_THE_PRF_HYPER
 -----------------------------------------------------------------------------
 *   Date creation : 18/09/2008
 -----------------------------------------------------------------------------
 *   Description   : Cette procédure renvoie les fils pour les codes pères passés en paramètre.
 *   MAJ           : 31/10/2008
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_PRF_HYPER_CUR  C_GET_THE_PRF_HYPER ( database(), this );
      while ( C_GET_THE_PRF_HYPER.next( LST_SPE , LST_HYPER  ) )
            { html += tr("<br><b> GET_THE_PRF_HYPER : </b>  ") + C_GET_THE_PRF_HYPER.MEMBER();
            }
  */
  class C_GET_THE_PRF_HYPER_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_PRF_HYPER_CUR ---------------------
      C_GET_THE_PRF_HYPER_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( QString LST_SPE , QString LST_HYPER )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............

 //+  ' SELECT MAX(FCPM_CODE_SQ_PK) AS ID_COM, CDF_NOM, SP_CODE_SQ_PK AS ID_SPE, SP_NOM, TERCOM_CDF_TER_CODE_FK_PK AS ID_TER, '||
 //+  ' MAX(TERCOM_NUMSEQ_TER_FK_PK) AS IDSEQ, MIN(TERCOM_NATURE_CIPEMG_FK_PK) AS NATURE               '||
 //+  ' FROM FCPMSP_CIPEMG_SPE, FCPM_FICHECIPEMG, TERCOM_TERRAIN_COMMENTAIRE, CDF_CODIF, SP_SPECIALITE          '||
 //+  ' WHERE FCPMSP_SP_CODE_FK_PK IN ('||LST_SPE||')'                         ||
 //+  ' AND FCPM_CODE_SQ_PK = FCPMSP_FCPM_CODE_FK_PK                          '||
 //+  ' AND TERCOM_FCPM_CODE_FK_PK = FCPM_CODE_SQ_PK                          '||
 //+  ' AND TERCOM_CDF_COM_CODE_FK_PK  IN ('||LST_HYPER||')'                   ||
 //+  ' AND CDF_NUMERO_PK = ''CC''                   '||
 //+  ' AND CDF_CODE_PK = TERCOM_CDF_COM_CODE_FK_PK           '||
 //+  ' AND SP_CODE_SQ_PK = FCPMSP_SP_CODE_FK_PK          '||
 //+  ' GROUP BY CDF_NOM, SP_CODE_SQ_PK, SP_NOM, TERCOM_CDF_TER_CODE_FK_PK ' ;
                sql_query += " SELECT MAX(FCPM_CODE_SQ_PK) AS ID_COM, CDF_NOM, SP_CODE_SQ_PK AS ID_SPE, SP_NOM, TERCOM_CDF_TER_CODE_FK_PK AS ID_TER,"
                     " MAX(TERCOM_NUMSEQ_TER_FK_PK) AS IDSEQ, MIN(TERCOM_NATURE_CIPEMG_FK_PK) AS NATURE"
                     " FROM fcpmsp_cipemg_spe, fcpm_fichecipemg, tercom_terrain_commentaire, cdf_codif, sp_specialite"
                     " WHERE FCPMSP_SP_CODE_FK_PK IN ('"+LST_SPE+"')'"
                     " AND FCPM_CODE_SQ_PK = FCPMSP_FCPM_CODE_FK_PK"
                     " AND TERCOM_FCPM_CODE_FK_PK = FCPM_CODE_SQ_PK"
                     " AND TERCOM_CDF_COM_CODE_FK_PK  IN ('"+LST_HYPER+"')'"
                     " AND CDF_NUMERO_PK = 'CC'"
                     " AND CDF_CODE_PK = TERCOM_CDF_COM_CODE_FK_PK"
                     " AND SP_CODE_SQ_PK = FCPMSP_SP_CODE_FK_PK"
                     " GROUP BY CDF_NOM, SP_CODE_SQ_PK, SP_NOM, TERCOM_CDF_TER_CODE_FK_PK ';";
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_PRF_HYPER() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_ID_COM  = value(0).toDouble();
                m_CDF_NOM = value(1).toString();
                m_ID_SPE  = value(2).toDouble();
                m_SP_NOM  = value(3).toString();
                m_ID_TER  = value(4).toString();
                m_IDSEQ   = value(5).toDouble();
                m_NATURE  = value(6).toString();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      double  ID_COM()  {return m_ID_COM;}
      QString CDF_NOM() {return m_CDF_NOM;}
      double  ID_SPE()  {return m_ID_SPE;}
      QString SP_NOM()  {return m_SP_NOM;}
      QString ID_TER()  {return m_ID_TER;}
      double  IDSEQ()   {return m_IDSEQ;}
      QString NATURE()  {return m_NATURE;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      double  m_ID_COM;
      QString m_CDF_NOM;
      double  m_ID_SPE;
      QString m_SP_NOM;
      QString m_ID_TER;
      double  m_IDSEQ;
      QString m_NATURE;
 };

 //================================== C_GET_THE_CIM10_TO_CDF_CUR   -102- ==================================
 /****************************************************************************
 *   Nom           :  GET_THE_CIM10_TO_CDF
 -----------------------------------------------------------------------------
 *   Date creation : 19/09/2008
 -----------------------------------------------------------------------------
 *   Description   : Cette procédure permet de rechercher pour les éléments
 *                   THERIAQUE CC ou CS (CDF_CODIF) les codes
 *                   Thériaque depuis un nom ou un code CIM10
 *   MAJ           : 24/10/2008
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_CIM10_TO_CDF_CUR  C_GET_THE_CIM10_TO_CDF ( database(), this );
      while ( C_GET_THE_CIM10_TO_CDF.next( CC_CS , ARGU , TYP  ) )
            { html += tr("<br><b> GET_THE_CIM10_TO_CDF : </b>  ") + C_GET_THE_CIM10_TO_CDF.MEMBER();
            }
  */
  class C_GET_THE_CIM10_TO_CDF_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_CIM10_TO_CDF_CUR ---------------------
      C_GET_THE_CIM10_TO_CDF_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( QString CC_CS , QString ARGU , QString TYP )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............
       if ( TYP.toInt() == 1) {

 //+   SELECT CC_CS                AS NAT_CODIF,
 //+       t1.CIM_CODE_PK       AS ID_CIM10 ,
 //+       t3.CDF_CODE_PK       AS ID_THE   ,
 //+       t3.CDF_NOM           AS THE_NOM  ,
 //+       t1.CIM_LIBELLE_COURT AS CIM10_LC ,
 //+       t1.CIM_LIBELLE_LONG  AS CIM10_LL
 //+   FROM   CIM10                t1,
 //+       CIMCDF_CIM10_CODIF   t2,
 //+       CDF_CODIF            t3
 //+   WHERE  t1.CIM_CODE_PK              = t2.CIMCDF_CIM_CODE_FK_PK
 //+   AND    t2.CIMCDF_CDF_CODE_FK_PK    = t3.CDF_CODE_PK
 //+   AND    t2.CIMCDF_CDF_NUMERO_FK_PK  = t3.CDF_NUMERO_PK
 //+   AND    t2.CIMCDF_CDF_NUMERO_FK_PK  = CC_CS
 //+   AND    UPPER(t3.CDF_NOM)        LIKE UPPER(ARGU)
 //+   ORDER BY  SUBSTR(t3.CDF_CODE_PK,2,LENGTH(t3.CDF_CODE_PK)) ;
                sql_query += " SELECT CC_CS                AS NAT_CODIF,"
                     " t1.CIM_CODE_PK       AS ID_CIM10 ,"
                     " t3.CDF_CODE_PK       AS ID_THE   ,"
                     " t3.CDF_NOM           AS THE_NOM  ,"
                     " t1.CIM_LIBELLE_COURT AS CIM10_LC ,"
                     " t1.CIM_LIBELLE_LONG  AS CIM10_LL"
                     " FROM   cim10                t1,"
                     " cimcdf_cim10_codif   t2,"
                     " cdf_codif            t3"
                     " WHERE  t1.CIM_CODE_PK              = t2.CIMCDF_CIM_CODE_FK_PK"
                     " AND    t2.CIMCDF_CDF_CODE_FK_PK    = t3.CDF_CODE_PK"
                     " AND    t2.CIMCDF_CDF_NUMERO_FK_PK  = t3.CDF_NUMERO_PK"
                     " AND    t2.CIMCDF_CDF_NUMERO_FK_PK   = '"+CC_CS+"'"
                     " AND    UPPER(t3.CDF_NOM)        LIKE UPPER('"+ARGU+"')"
                     " ORDER BY  SUBSTR(t3.CDF_CODE_PK,2,LENGTH(t3.CDF_CODE_PK)) ;";

       } else if ( TYP.toInt() == 2) {

 //+   SELECT CC_CS                  AS NAT_CODIF,
 //+      t1.CIM_CODE_PK       AS ID_CIM10 ,
 //+      t3.CDF_CODE_PK       AS ID_THE   ,
 //+      t3.CDF_NOM           AS THE_NOM  ,
 //+      t1.CIM_LIBELLE_COURT AS CIM10_LC ,
 //+      t1.CIM_LIBELLE_LONG  AS CIM10_LL
 //+   FROM   CIM10                t1,
 //+      CIMCDF_CIM10_CODIF   t2,
 //+      CDF_CODIF            t3
 //+   WHERE  t1.CIM_CODE_PK              = t2.CIMCDF_CIM_CODE_FK_PK
 //+   AND    t2.CIMCDF_CDF_CODE_FK_PK    = t3.CDF_CODE_PK
 //+   AND    t2.CIMCDF_CDF_NUMERO_FK_PK  = t3.CDF_NUMERO_PK
 //+   AND    t2.CIMCDF_CDF_NUMERO_FK_PK  = CC_CS
 //+   AND    t1.CIM_CODE_PK              LIKE ARGU
 //+   ORDER BY  SUBSTR(t3.CDF_CODE_PK,2,LENGTH(t3.CDF_CODE_PK)) ;
                sql_query += " SELECT CC_CS                  AS NAT_CODIF,"
                     " t1.CIM_CODE_PK       AS ID_CIM10 ,"
                     " t3.CDF_CODE_PK       AS ID_THE   ,"
                     " t3.CDF_NOM           AS THE_NOM  ,"
                     " t1.CIM_LIBELLE_COURT AS CIM10_LC ,"
                     " t1.CIM_LIBELLE_LONG  AS CIM10_LL"
                     " FROM   cim10                t1,"
                     " cimcdf_cim10_codif   t2,"
                     " cdf_codif            t3"
                     " WHERE  t1.CIM_CODE_PK              = t2.CIMCDF_CIM_CODE_FK_PK"
                     " AND    t2.CIMCDF_CDF_CODE_FK_PK    = t3.CDF_CODE_PK"
                     " AND    t2.CIMCDF_CDF_NUMERO_FK_PK  = t3.CDF_NUMERO_PK"
                     " AND    t2.CIMCDF_CDF_NUMERO_FK_PK   = '"+CC_CS+"'"
                     " AND    t1.CIM_CODE_PK              LIKE '"+ARGU+"'"
                     " ORDER BY  SUBSTR(t3.CDF_CODE_PK,2,LENGTH(t3.CDF_CODE_PK)) ;";

       }
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_CIM10_TO_CDF() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_NAT_CODIF = value(0).toString();
                m_ID_CIM10  = value(1).toString();
                m_ID_THE    = value(2).toString();
                m_THE_NOM   = value(3).toString();
                m_CIM10_LC  = value(4).toString();
                m_CIM10_LL  = value(5).toString();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      QString NAT_CODIF() {return m_NAT_CODIF;}
      QString ID_CIM10()  {return m_ID_CIM10;}
      QString ID_THE()    {return m_ID_THE;}
      QString THE_NOM()   {return m_THE_NOM;}
      QString CIM10_LC()  {return m_CIM10_LC;}
      QString CIM10_LL()  {return m_CIM10_LL;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      QString m_NAT_CODIF;
      QString m_ID_CIM10;
      QString m_ID_THE;
      QString m_THE_NOM;
      QString m_CIM10_LC;
      QString m_CIM10_LL;
 };

 //================================== C_GET_THE_CDF_TO_CIM10_CUR   -103- ==================================
 /****************************************************************************
 *   Nom           :  GET_THE_CDF_TO_CIM10
 -----------------------------------------------------------------------------
 *   Date creation : 19/09/2008
 -----------------------------------------------------------------------------
 *   Description   : Cette procédure permet de rechercher pour les éléments
 *                   THERIAQUE CC ou CS (CDF_CODIF) les codes
 *                   CIM10 depuis un nom ou un code Thériaque
 *   MAJ           : 28/10/2008
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_CDF_TO_CIM10_CUR  C_GET_THE_CDF_TO_CIM10 ( database(), this );
      while ( C_GET_THE_CDF_TO_CIM10.next( CC_CS , ARGU , TYP  ) )
            { html += tr("<br><b> GET_THE_CDF_TO_CIM10 : </b>  ") + C_GET_THE_CDF_TO_CIM10.MEMBER();
            }
  */
  class C_GET_THE_CDF_TO_CIM10_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_CDF_TO_CIM10_CUR ---------------------
      C_GET_THE_CDF_TO_CIM10_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( QString CC_CS , QString ARGU , QString TYP )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............
       if ( TYP.toInt() == 1) {

 //+     SELECT CC_CS                   AS NAT_CODIF,
 //+      t1.CIM_CODE_PK       AS ID_CIM10 ,
 //+      t3.CDF_CODE_PK       AS ID_THE   ,
 //+      t3.CDF_NOM           AS THE_NOM  ,
 //+      t1.CIM_LIBELLE_COURT AS CIM10_LC ,
 //+      t1.CIM_LIBELLE_LONG  AS CIM10_LL
 //+   FROM   CIM10                t1,
 //+      CIMCDF_CIM10_CODIF   t2,
 //+      CDF_CODIF            t3
 //+   WHERE  t1.CIM_CODE_PK              = t2.CIMCDF_CIM_CODE_FK_PK
 //+   AND    t2.CIMCDF_CDF_CODE_FK_PK    = t3.CDF_CODE_PK
 //+   AND    t2.CIMCDF_CDF_NUMERO_FK_PK  = t3.CDF_NUMERO_PK
 //+   AND    t2.CIMCDF_CDF_NUMERO_FK_PK  = CC_CS
 //+   AND    UPPER(t3.CDF_NOM)        LIKE UPPER(ARGU)
 //+   ORDER BY  SUBSTR(t3.CDF_CODE_PK,2,LENGTH(t3.CDF_CODE_PK)) ;
                sql_query += " SELECT CC_CS                   AS NAT_CODIF,"
                     " t1.CIM_CODE_PK       AS ID_CIM10 ,"
                     " t3.CDF_CODE_PK       AS ID_THE   ,"
                     " t3.CDF_NOM           AS THE_NOM  ,"
                     " t1.CIM_LIBELLE_COURT AS CIM10_LC ,"
                     " t1.CIM_LIBELLE_LONG  AS CIM10_LL"
                     " FROM   cim10                t1,"
                     " cimcdf_cim10_codif   t2,"
                     " cdf_codif            t3"
                     " WHERE  t1.CIM_CODE_PK              = t2.CIMCDF_CIM_CODE_FK_PK"
                     " AND    t2.CIMCDF_CDF_CODE_FK_PK    = t3.CDF_CODE_PK"
                     " AND    t2.CIMCDF_CDF_NUMERO_FK_PK  = t3.CDF_NUMERO_PK"
                     " AND    t2.CIMCDF_CDF_NUMERO_FK_PK   = '"+CC_CS+"'"
                     " AND    UPPER(t3.CDF_NOM)        LIKE UPPER('"+ARGU+"')"
                     " ORDER BY  SUBSTR(t3.CDF_CODE_PK,2,LENGTH(t3.CDF_CODE_PK)) ;";

       } else if ( TYP.toInt() == 2) {

 //+     SELECT CC_CS                   AS NAT_CODIF,
 //+      t1.CIM_CODE_PK       AS ID_CIM10 ,
 //+      t3.CDF_CODE_PK       AS ID_THE   ,
 //+      t3.CDF_NOM           AS THE_NOM  ,
 //+      t1.CIM_LIBELLE_COURT AS CIM10_LC ,
 //+      t1.CIM_LIBELLE_LONG  AS CIM10_LL
 //+   FROM   CIM10                t1,
 //+      CIMCDF_CIM10_CODIF   t2,
 //+      CDF_CODIF            t3
 //+   WHERE  t1.CIM_CODE_PK              = t2.CIMCDF_CIM_CODE_FK_PK
 //+   AND    t2.CIMCDF_CDF_CODE_FK_PK    = t3.CDF_CODE_PK
 //+   AND    t2.CIMCDF_CDF_NUMERO_FK_PK  = t3.CDF_NUMERO_PK
 //+   AND    t2.CIMCDF_CDF_NUMERO_FK_PK  = CC_CS
 //+   AND    t3.CDF_CODE_PK              LIKE ARGU
 //+   ORDER BY  SUBSTR(t3.CDF_CODE_PK,2,LENGTH(t3.CDF_CODE_PK)) ;
                sql_query += " SELECT CC_CS                   AS NAT_CODIF,"
                     " t1.CIM_CODE_PK       AS ID_CIM10 ,"
                     " t3.CDF_CODE_PK       AS ID_THE   ,"
                     " t3.CDF_NOM           AS THE_NOM  ,"
                     " t1.CIM_LIBELLE_COURT AS CIM10_LC ,"
                     " t1.CIM_LIBELLE_LONG  AS CIM10_LL"
                     " FROM   cim10                t1,"
                     " cimcdf_cim10_codif   t2,"
                     " cdf_codif            t3"
                     " WHERE  t1.CIM_CODE_PK              = t2.CIMCDF_CIM_CODE_FK_PK"
                     " AND    t2.CIMCDF_CDF_CODE_FK_PK    = t3.CDF_CODE_PK"
                     " AND    t2.CIMCDF_CDF_NUMERO_FK_PK  = t3.CDF_NUMERO_PK"
                     " AND    t2.CIMCDF_CDF_NUMERO_FK_PK   = '"+CC_CS+"'"
                     " AND    t3.CDF_CODE_PK              LIKE '"+ARGU+"'"
                     " ORDER BY  SUBSTR(t3.CDF_CODE_PK,2,LENGTH(t3.CDF_CODE_PK)) ;";

       }
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_CDF_TO_CIM10() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_NAT_CODIF = value(0).toString();
                m_ID_CIM10  = value(1).toString();
                m_ID_THE    = value(2).toString();
                m_THE_NOM   = value(3).toString();
                m_CIM10_LC  = value(4).toString();
                m_CIM10_LL  = value(5).toString();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      QString NAT_CODIF() {return m_NAT_CODIF;}
      QString ID_CIM10()  {return m_ID_CIM10;}
      QString ID_THE()    {return m_ID_THE;}
      QString THE_NOM()   {return m_THE_NOM;}
      QString CIM10_LC()  {return m_CIM10_LC;}
      QString CIM10_LL()  {return m_CIM10_LL;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      QString m_NAT_CODIF;
      QString m_ID_CIM10;
      QString m_ID_THE;
      QString m_THE_NOM;
      QString m_CIM10_LC;
      QString m_CIM10_LL;
 };

 //================================== C_GET_THE_REDON_CUR   -104- ==================================
 /*@************************************************************************
 *   Produit       :  CNHIM
 ---------------------------------------------------------------------------
 *   Création       :  18/05/2009
 *   Auteur        :  HEDFI MOURAD
 ---------------------------------------------------------------------------
 *   Description   :  Ensemble des APIs de la base Theriaque
 ---------------------------------------------------------------------------
 *   Module        :  PACK_THERIAQUE_API
 ---------------------------------------------------------------------------
 *  Evolution des API de la version THERIAQUE V12.00.00.
    27/04/2009 - Traitement des tickets Mantis : 0000011, 0000012, 0000013, 0000014, 0000015,
       0000016, 0000017, 0000018, 0000019, 0000020, 0000021, 0000022, 0000023,
       0000024, 0000025, 0000026
    14/05/2009 - Traitement tickets ré-ouverts : 0000016, 0000017, 0000018
    18/05/2009 - Traitement tickets : 0000025, 0000022, 0000028, 0000029, 0000030
    19/05/2009 - Traitement du ticket : 0000031
    07/03/2011 - Traitement du ticket : 179
    12/09/2011 - Traitement ticket taskland 11760 (GET_THE_REDON)
    30/12/2011 - Traitement ticket taskland 12439 (GET_THE_GTIAM)
 *******************************************************************************@*/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_REDON_CUR  C_GET_THE_REDON ( database(), this );
      while ( C_GET_THE_REDON.next( LST_SP  ) )
            { html += tr("<br><b> GET_THE_REDON : </b>  ") + C_GET_THE_REDON.MEMBER();
            }
  */
  class C_GET_THE_REDON_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_REDON_CUR ---------------------
      C_GET_THE_REDON_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( QString LST_SP )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............

 //+  ' SELECT   DISTINCT t1.COSAC_SP_CODE_FK_PK   IDSPE ,   '||
 //+  ' t4.SP_NOM                     NOM   ,                   '||
 //+  ' t1.COSAC_SAC_CODE_FK_PK           SAC   ,                  '||
 //+  ' t1.COSAC_DOSAGE               DOSE  ,                   '||
 //+  ' t1.COSAC_UNITEDOSAGE          UNITE ,                   '||
 //+  ' t2.SAC_NOM                    SAC_NOM                   '||
 //+  ' FROM  COSAC_COMPO_SUBACT t1,         '||
 //+        ' SAC_SUBACTIVE      t2,    '||
 //+        ' COSAC_COMPO_SUBACT t3, '||
 //+        ' SAC_SUBACTIVE      t5, '||
 //+        ' SP_SPECIALITE      t4, '||
 //+        ' SP_SPECIALITE      t6  '||
 //+        ' WHERE    t1.COSAC_SAC_CODE_FK_PK = t2.SAC_CODE_SQ_PK  '||
 //+        ' AND      t1.COSAC_SP_CODE_FK_PK  = t4.SP_CODE_SQ_PK '||
 //+        ' AND      t3.COSAC_SAC_CODE_FK_PK = t5.SAC_CODE_SQ_PK '||
 //+        ' AND      t3.COSAC_SP_CODE_FK_PK  = t6.SP_CODE_SQ_PK '||
 //+        ' AND      t1.COSAC_SP_CODE_FK_PK  <> t3.COSAC_SP_CODE_FK_PK '||   -- specialité différentes
 //+        ' AND      t1.COSAC_SAC_CODE_FK_PK <>  t3.COSAC_SAC_CODE_FK_PK '||  -- différentes substances
 //+        ' AND      t2.sac_gsac_code_fk = t5.sac_gsac_code_fk  '||-- même code père
 //+        ' AND      t1.COSAC_SP_CODE_FK_PK  IN ('||LST_SP||') '||
 //+        ' AND      t3.COSAC_SP_CODE_FK_PK  IN ('||LST_SP||')  '||
 //+  ' UNION '||
 //+  ---Une redondance est définie lorsque deux spécialités ont des substances actives différentes mais qui sont rattachées à la même substance active père
 //+  ' SELECT   DISTINCT t1.COSAC_SP_CODE_FK_PK   IDSPE ,    '||
 //+  ' t4.SP_NOM                     NOM   ,       '||
 //+  ' t2.SAC_CODE_SQ_PK             SAC   ,       '||
 //+  ' t1.COSAC_DOSAGE               DOSE  ,       '||
 //+  ' t1.COSAC_UNITEDOSAGE          UNITE ,       '||
 //+  ' t2.SAC_NOM                    SAC_NOM          '||
 //+  ' FROM  COSAC_COMPO_SUBACT t1,         '||
 //+        ' SAC_SUBACTIVE      t2,    '||
 //+        ' COSAC_COMPO_SUBACT t3, '||
 //+        ' SAC_SUBACTIVE      t5, '||
 //+        ' SP_SPECIALITE      t4, '||
 //+        ' SP_SPECIALITE      t6  '||
 //+  ' WHERE t1.COSAC_SAC_CODE_FK_PK = t2.SAC_CODE_SQ_PK  '||
 //+        ' AND t1.COSAC_SP_CODE_FK_PK  = t4.SP_CODE_SQ_PK '||
 //+        ' AND t3.COSAC_SAC_CODE_FK_PK = t5.SAC_CODE_SQ_PK '||
 //+        ' AND t3.COSAC_SP_CODE_FK_PK  = t6.SP_CODE_SQ_PK '||
 //+        ' AND t1.COSAC_SP_CODE_FK_PK  <> t3.COSAC_SP_CODE_FK_PK '||   -- specialité différentes
 //+        ' AND t1.COSAC_SAC_CODE_FK_PK =  t3.COSAC_SAC_CODE_FK_PK '||  -- mêmes substances
 //+  ' AND t1.COSAC_SP_CODE_FK_PK    IN ('||LST_SP||')'   ||
 //+  ' AND t3.COSAC_SP_CODE_FK_PK    IN ('||LST_SP||')'   ||
 //+  ' ORDER BY 1 ,3 ' ;
                sql_query += " SELECT   DISTINCT t1.COSAC_SP_CODE_FK_PK   IDSPE ,"
                     " t4.SP_NOM                     NOM   ,"
                     " t1.COSAC_SAC_CODE_FK_PK       SAC   ,"
                     " t1.COSAC_DOSAGE               DOSE  ,"
                     " t1.COSAC_UNITEDOSAGE          UNITE ,"
                     " t2.SAC_NOM                    SAC_NOM"
                     " FROM  cosac_compo_subact t1,"
                     " sac_subactive      t2,"
                     " cosac_compo_subact t3,"
                     " sac_subactive      t5,"
                     " sp_specialite      t4,"
                     " sp_specialite      t6"
                     " WHERE    t1.COSAC_SAC_CODE_FK_PK = t2.SAC_CODE_SQ_PK"
                     " AND      t1.COSAC_SP_CODE_FK_PK  = t4.SP_CODE_SQ_PK"
                     " AND      t3.COSAC_SAC_CODE_FK_PK = t5.SAC_CODE_SQ_PK"
                     " AND      t3.COSAC_SP_CODE_FK_PK  = t6.SP_CODE_SQ_PK"
                     " AND      t1.COSAC_SP_CODE_FK_PK  <> t3.COSAC_SP_CODE_FK_PK '   "  //-- specialité différentes"
                     " AND      t1.COSAC_SAC_CODE_FK_PK <>  t3.COSAC_SAC_CODE_FK_PK '  "  //-- différentes substances"
                     " AND      t2.sac_gsac_code_fk = t5.sac_gsac_code_fk  '"  //-- même code père"
                     " AND      t1.COSAC_SP_CODE_FK_PK  IN ('"+LST_SP+"')"
                     " AND      t3.COSAC_SP_CODE_FK_PK  IN ('"+LST_SP+"')"
                     " UNION"
                     " "  //---UNE redondance est définie lorsque deux spécialités ont des substances actives différentes mais qui sont rattachées à la même substance active père"
                     " SELECT   DISTINCT t1.COSAC_SP_CODE_FK_PK   IDSPE ,"
                     " t4.SP_NOM                     NOM   ,"
                     " t2.SAC_CODE_SQ_PK             SAC   ,"
                     " t1.COSAC_DOSAGE               DOSE  ,"
                     " t1.COSAC_UNITEDOSAGE          UNITE ,"
                     " t2.SAC_NOM                    SAC_NOM"
                     " FROM  cosac_compo_subact t1,"
                     " sac_subactive      t2,"
                     " cosac_compo_subact t3,"
                     " sac_subactive      t5,"
                     " sp_specialite      t4,"
                     " sp_specialite      t6"
                     " WHERE t1.COSAC_SAC_CODE_FK_PK = t2.SAC_CODE_SQ_PK"
                     " AND t1.COSAC_SP_CODE_FK_PK  = t4.SP_CODE_SQ_PK"
                     " AND t3.COSAC_SAC_CODE_FK_PK = t5.SAC_CODE_SQ_PK"
                     " AND t3.COSAC_SP_CODE_FK_PK  = t6.SP_CODE_SQ_PK"
                     " AND t1.COSAC_SP_CODE_FK_PK  <> t3.COSAC_SP_CODE_FK_PK '   "  //-- specialité différentes"
                     " AND t1.COSAC_SAC_CODE_FK_PK =  t3.COSAC_SAC_CODE_FK_PK '  "  //-- mêmes substances"
                     " AND t1.COSAC_SP_CODE_FK_PK    IN ('"+LST_SP+"')'"
                     " AND t3.COSAC_SP_CODE_FK_PK    IN ('"+LST_SP+"')'"
                     " ORDER BY 1 ,3 ';";
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_REDON() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_IDSPE   = value(0).toDouble();
                m_NOM     = value(1).toString();
                m_SAC     = value(2).toDouble();
                m_DOSE    = value(3).toString();
                m_UNITE   = value(4).toString();
                m_SAC_NOM = value(5).toString();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      double  IDSPE()   {return m_IDSPE;}
      QString NOM()     {return m_NOM;}
      double  SAC()     {return m_SAC;}
      QString DOSE()    {return m_DOSE;}
      QString UNITE()   {return m_UNITE;}
      QString SAC_NOM() {return m_SAC_NOM;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      double  m_IDSPE;
      QString m_NOM;
      double  m_SAC;
      QString m_DOSE;
      QString m_UNITE;
      QString m_SAC_NOM;
 };

 //================================== C_GET_THE_VIR_ID_CUR   -105- ==================================
 /****************************************************************************
 *   Nom           :  GET_THE_VIR_ID
 -----------------------------------------------------------------------------
 *   Date creation : 14/04/2009
 -----------------------------------------------------------------------------
 *   Description   : Cette procédure permet d'avoir toutes les infors d'un
 *                   médciament virtuel
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_VIR_ID_CUR  C_GET_THE_VIR_ID ( database(), this );
      while ( C_GET_THE_VIR_ID.next( CodeId  ) )
            { html += tr("<br><b> GET_THE_VIR_ID : </b>  ") + C_GET_THE_VIR_ID.MEMBER();
            }
  */
  class C_GET_THE_VIR_ID_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_VIR_ID_CUR ---------------------
      C_GET_THE_VIR_ID_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( double CodeId )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............

 //+    SELECT GSP_CODE_VIRTUEL13   AS ID13,
 //+     GSP_CODE_VIRTUEL     AS ID7,
 //+     GSP_PRESCRIPTION_DC   AS PRES_DC,
 //+     GSP_NOM      AS LIBELLE,
 //+     GSP_INFO_GENERAL_TEXTE AS TEXTE,
 //+     GSP_DATECR     AS DATE_CREA,
 //+     GSP_DATEMJ      AS DATE_MODIF,
 //+     GSP_CODE_SP_REFERENCE  AS MONO
 //+  FROM GSP_GENERIQUE_SPECIALITE
 //+  WHERE GSP_CODE_SQ_PK = CodeId;
                sql_query += " SELECT GSP_CODE_VIRTUEL13   AS ID13,"
                     " GSP_CODE_VIRTUEL     AS ID7,"
                     " GSP_PRESCRIPTION_DC   AS PRES_DC,"
                     " GSP_NOM      AS LIBELLE,"
                     " GSP_INFO_GENERAL_TEXTE AS TEXTE,"
                     " GSP_DATECR     AS DATE_CREA,"
                     " GSP_DATEMJ      AS DATE_MODIF,"
                     " GSP_CODE_SP_REFERENCE  AS MONO"
                     " FROM gsp_generique_specialite"
                     " WHERE GSP_CODE_SQ_PK  = '"+ QString::number( CodeId ) +"';";
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_VIR_ID() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_ID13       = value(0).toString();
                m_ID7        = value(1).toString();
                m_PRES_DC    = value(2).toDouble();
                m_LIBELLE    = value(3).toString();
                m_MY_TEXTE   = value(4).toString();
                m_DATE_CREA  = value(5).toDate();
                m_DATE_MODIF = value(6).toDate();
                m_MONO       = value(7).toString();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      QString ID13()       {return m_ID13;}
      QString ID7()        {return m_ID7;}
      double  PRES_DC()    {return m_PRES_DC;}
      QString LIBELLE()    {return m_LIBELLE;}
      QString MY_TEXTE()   {return m_MY_TEXTE;}
      QDate   DATE_CREA()  {return m_DATE_CREA;}
      QDate   DATE_MODIF() {return m_DATE_MODIF;}
      QString MONO()       {return m_MONO;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      QString m_ID13;
      QString m_ID7;
      double  m_PRES_DC;
      QString m_LIBELLE;
      QString m_MY_TEXTE;
      QDate   m_DATE_CREA;
      QDate   m_DATE_MODIF;
      QString m_MONO;
 };

 //================================== C_GET_THE_URL_CUR   -106- ==================================
 /****************************************************************************
 *   Nom           :  GET_THE_URL
 -----------------------------------------------------------------------------
 *   Date creation : 14/04/2009
 -----------------------------------------------------------------------------
 *   Description   : Cette procédure permet d'avoir l'url d'une spécialité
 ****************************************************************************/
 /*   Project   :  MedinTux  (typographie made in france)                   *
  *   Copyright :  (C) 2012-2013 and for the eternity                       *
  *   by        :  Sevin Roland     from   MedinTux project                 *
  *   E-Mail    :  roland-sevin@medintux.org                                *
  *   Web site  :  www.medintux.org                                         *
  ****************************************************************************/
  /*........................ usage .......................................

      C_GET_THE_URL_CUR  C_GET_THE_URL ( database(), this );
      while ( C_GET_THE_URL.next( CodeId  ) )
            { html += tr("<br><b> GET_THE_URL : </b>  ") + C_GET_THE_URL.MEMBER();
            }
  */
  class C_GET_THE_URL_CUR : public QObject, public QSqlQuery
  {
      Q_OBJECT

  public:
      //-------------------------- C_GET_THE_URL_CUR ---------------------
      C_GET_THE_URL_CUR(QSqlDatabase db, QObject *parent = 0)
            :  QObject(parent), QSqlQuery(db)
          { m_isNextData = 0;
            if (parent)
               {connect( this,   SIGNAL (Sign_onError                  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )),
                         parent,  SLOT  (Slot_On_TheriaqueCursorError  ( const QSqlQuery &, const QString &, const QString &, const QString &, int  )) );
               }
          }
      //-------------------------- next ----------------------------------------------------
      int next( double CodeId )
      {   if ( m_isNextData == 0 )
             {  QString sql_query = "";

     //............. zone de construction de la requete DEBUT ...............

 //+    SELECT u.URL_TYPE AS GRP,
 //+        s.SPURL_ADRESSE  AS URL
 //+  FROM URL_ADRESSE u,
 //+    SPURL_SPECIALITE_ADRESSE s
 //+  WHERE s.SPURL_CODE_URL_PK_FK = u.URL_CODE_PK
 //+  AND s.SPURL_CODE_SP_PK_FK =  CodeId;
                sql_query += " SELECT u.URL_TYPE AS GRP,"
                     " s.SPURL_ADRESSE  AS URL"
                     " FROM url_adresse u,"
                     " spurl_specialite_adresse s"
                     " WHERE s.SPURL_CODE_URL_PK_FK = u.URL_CODE_PK"
                     " AND s.SPURL_CODE_SP_PK_FK  = '"+ QString::number( CodeId ) +"';";
     //............. zone de construction de la requete FIN ...............
                exec(sql_query);
                if ( ! isActive() )
                   { emit Sign_onError(*this , tr("<font color=#ff0000><b>ERREUR  : C_GET_THE_URL() </b></font>"), sql_query, __FILE__, __LINE__  );
                     return 0;
                   }
             }
          if (QSqlQuery::next())
             {  ++m_isNextData;
                m_GRP = value(0).toString();
                m_URL = value(1).toString();
                return m_isNextData;
             }
          m_isNextData = 0;
          return 0;
      }
      //-------------------------- acces aux donnees ----------------------------------------------
      QString GRP() {return m_GRP;}
      QString URL() {return m_URL;}
      //-------------------------- error gesticulation --------------------------------------
   signals:
      void Sign_onError(const QSqlQuery &qsqlquery, const QString &from, const QString &sql_query, const QString &file, int line);

   private:
      //.......... procedure datas .........................................................
      int     m_isNextData;
      //.......... cursor datas ............................................................
      QString m_GRP;
      QString m_URL;
 };
#endif // C_BDM_THERIAQUEPLUGIN_H
