<?php
class Mes_Conge  extends CI_Controller{
    function __construct() {
        parent::__construct();
        $this->Is_Connected();

      }

      public function Is_Connected()
       {
       if (empty($this->session->userdata('SOCAR_ID_USER')))
        {
         redirect(base_url('Login/'));
        }
       }

        
       public function index()
       {

        // if ($this->session->userdata('SOCAR_PROFIL_ID') == 0) {
          // $SOCAR_ID_USER = $this->session->userdata('ID_EMPLOYE');
          $employe = ' AND `ID_EMPLOYE` = '.$this->session->userdata('ID_EMPLOYE').'';
          // if ($) {
            // code...
          // }
        // }
        // else{
          // $SOCAR_ID_USER = $this->session->userdata('SOCAR_ID_USER');  
          // $employe = ' ';

        // }
        
   
         $data['creditconge']=$this->Model->getRequete(' SELECT conge_credit.ID_CREDIT, config_exercice.DESCRIPTION AS EXERCICE, conge_credit.ID_EMPLOYE, conge_credit.NB_JOURS_CREDITE, conge_credit.NB_JOURS_RESTANT, conge_credit.DEBUT_CREDIT, conge_credit.FIN_CREDIT, IF(conge_credit.STATUS = 1, "Actif", "Innactif") AS STATUS, config_type_conge.NOM_CONGE FROM `conge_credit` JOIN config_exercice ON config_exercice.ID_EXERCICE = conge_credit.ID_EXERCICE JOIN config_type_conge ON config_type_conge.ID_TYPE_CONGE = conge_credit.ID_TYPE_CONGE WHERE  1  '.$employe.' ');

         $data['listconge']=$this->Model->getRequete('SELECT conge_demande_conge.ID_DEMANDE_CONGE, config_type_conge.NOM_CONGE, config_exercice.DESCRIPTION AS EXERCICE, conge_demande_conge.ID_CREDIT, conge_demande_conge.ID_EMPLOYE, conge_status_conge.STATUS_CONGE,conge_demande_conge.DATE_SYSTEME_DEMANDE, conge_status_conge.DESCRIPTION , conge_demande_conge.NB_JOURS_DEMANDE, conge_demande_conge.NB_JOURS_ACCORDE, conge_demande_conge.DATE_DERNIER_REPOSE, DATEDIFF(conge_demande_conge.DATE_DERNIER_REPOSE , conge_demande_conge.DATE_SYSTEME_DEMANDE) AS DIFF, conge_demande_conge.DATE_DEBUT_CONGE_ACCORDE FROM conge_demande_conge JOIN config_exercice ON config_exercice.ID_EXERCICE = conge_demande_conge.ID_EXERCICE JOIN config_type_conge ON config_type_conge.ID_TYPE_CONGE = conge_demande_conge.ID_TYPE_CONGE JOIN conge_status_conge ON conge_status_conge.STATUS_CONGE = conge_demande_conge.STATUS_CONGE WHERE  1  '.$employe.' ORDER BY conge_demande_conge.DATE_DERNIER_REPOSE DESC ');


         

         $tabledata=array();
   
         $data['title']='Mes Cong&eacute;s';
           $this->load->view('Mes_Conge_List_View',$data);
   
       }


}