cn=$cn; } /** *@brief return the number of different exercices into a folder *@param $cn is the database connexion object database *@return the count of exercice */ function count() { $count=$this->cn->get_value('select count(distinct p_exercice) from parm_periode'); return $count; } /** *@brief Show a ISelect with the different exercices *@param $name of the iselect *@param $selected the selected year (default = '') *@param $js javascript (default = '') *@return ISelect object */ function select($name,$selected='',$js='') { $iselect=new ISelect($name); $iselect->value=$this->cn->make_array('select distinct p_exercice,p_exercice_label from parm_periode order by 1 desc'); $iselect->selected=$selected; $iselect->javascript=$js; return $iselect; } /** *@brief Show a ISelect with the different exercices, display start and end date *@param $name of the iselect *@param $selected the selected year (default = '') *@param $js javascript (default = '') *@return ISelect object */ function select_date($name,$selected='',$js='') { $iselect=new ISelect($name); $iselect->value=$this->cn->make_array("select distinct p_exercice,to_char (min(p_start),'DD.MM.YY') ||' - ' ||to_char (max(p_end),'DD.MM.YY') from parm_periode group by p_exercice order by 1"); $iselect->selected=$selected; $iselect->javascript=$js; return $iselect; } /** * @brief retrieve the exercice from the exercice label * @param string $p_label */ function exercice_from_label($p_label) { $value = $this->cn->get_value("select distinct p_exercice from parm_periode where p_exercice_label=$1", [$p_label]); if ($value == "") return -1; return $value; } }