noalyss  Version-6.7.2
 All Data Structures Namespaces Files Functions Variables Enumerations
class_exercice.php
Go to the documentation of this file.
00001 <?php
00002 /*
00003  *   This file is part of NOALYSS.
00004  *
00005  *   NOALYSS is free software; you can redistribute it and/or modify
00006  *   it under the terms of the GNU General Public License as published by
00007  *   the Free Software Foundation; either version 2 of the License, or
00008  *   (at your option) any later version.
00009  *
00010  *   NOALYSS is distributed in the hope that it will be useful,
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  *   GNU General Public License for more details.
00014  *
00015  *   You should have received a copy of the GNU General Public License
00016  *   along with NOALYSS; if not, write to the Free Software
00017  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 */
00019 
00020 // Copyright Author Dany De Bontridder danydb@aevalys.eu
00021 
00022 /*!\file
00023  * \brief about the accountant exercice
00024  */
00025 require_once('class_database.php');
00026 require_once('class_iselect.php');
00027 class Exercice
00028 {
00029   function __construct(&$cn)
00030   {
00031     $this->cn=$cn;
00032   }
00033   /**
00034    *return the number of different exercices into a folder
00035    *@param $cn is the database connexion object database
00036    *@return the count of exercice
00037    */
00038    function count()
00039   {
00040     $count=$this->cn->get_value('select count(distinct p_exercice) from parm_periode');
00041     return $count;
00042   }
00043    /**
00044     *Show a ISelect with the different exercices
00045     *@param $name of the iselect
00046     *@param $selected the selected year  (default = '')
00047     *@param $js javascript (default = '')
00048     *@return ISelect object
00049     */
00050    function select($name,$selected='',$js='')
00051    {
00052      $iselect=new ISelect($name);
00053      $iselect->value=$this->cn->make_array('select distinct p_exercice,p_exercice from parm_periode order by 1');
00054      $iselect->selected=$selected;
00055      $iselect->javascript=$js;
00056      return $iselect;
00057    }
00058    /**
00059     *Show a ISelect with the different exercices, display start and end date
00060     *@param $name of the iselect
00061     *@param $selected the selected year  (default = '')
00062     *@param $js javascript (default = '')
00063     *@return ISelect object
00064     */
00065    function select_date($name,$selected='',$js='')
00066    {
00067      $iselect=new ISelect($name);
00068      $iselect->value=$this->cn->make_array("select distinct p_exercice,to_char (min(p_start),'DD.MM.YY')
00069                                                                                                                                          ||' - '
00070                                                                                                                                          ||to_char (max(p_end),'DD.MM.YY')
00071                                                                                         from parm_periode
00072                                                                                         group by p_exercice order by 1");
00073      $iselect->selected=$selected;
00074      $iselect->javascript=$js;
00075      return $iselect;
00076    }
00077 }
 All Data Structures Namespaces Files Functions Variables Enumerations