noalyss  Version-6.9.1.8
 All Data Structures Namespaces Files Functions Variables Pages
class_exercice.php
Go to the documentation of this file.
1 <?php
2 /*
3  * This file is part of NOALYSS.
4  *
5  * NOALYSS is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * NOALYSS is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with NOALYSS; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19 
20 // Copyright Author Dany De Bontridder danydb@aevalys.eu
21 
22 /*!\file
23  * \brief about the accountant exercice
24  */
25 require_once NOALYSS_INCLUDE.'/lib/class_database.php';
26 require_once NOALYSS_INCLUDE.'/lib/class_iselect.php';
27 class Exercice
28 {
29  function __construct(&$cn)
30  {
31  $this->cn=$cn;
32  }
33  /**
34  *return the number of different exercices into a folder
35  *@param $cn is the database connexion object database
36  *@return the count of exercice
37  */
38  function count()
39  {
40  $count=$this->cn->get_value('select count(distinct p_exercice) from parm_periode');
41  return $count;
42  }
43  /**
44  *Show a ISelect with the different exercices
45  *@param $name of the iselect
46  *@param $selected the selected year (default = '')
47  *@param $js javascript (default = '')
48  *@return ISelect object
49  */
50  function select($name,$selected='',$js='')
51  {
52  $iselect=new ISelect($name);
53  $iselect->value=$this->cn->make_array('select distinct p_exercice,p_exercice from parm_periode order by 1');
54  $iselect->selected=$selected;
55  $iselect->javascript=$js;
56  return $iselect;
57  }
58  /**
59  *Show a ISelect with the different exercices, display start and end date
60  *@param $name of the iselect
61  *@param $selected the selected year (default = '')
62  *@param $js javascript (default = '')
63  *@return ISelect object
64  */
65  function select_date($name,$selected='',$js='')
66  {
67  $iselect=new ISelect($name);
68  $iselect->value=$this->cn->make_array("select distinct p_exercice,to_char (min(p_start),'DD.MM.YY')
69  ||' - '
70  ||to_char (max(p_end),'DD.MM.YY')
71  from parm_periode
72  group by p_exercice order by 1");
73  $iselect->selected=$selected;
74  $iselect->javascript=$js;
75  return $iselect;
76  }
77 }
$selected
select($name, $selected='', $js='')
Show a ISelect with the different exercices.
__construct(&$cn)
$input_from cn
Definition: balance.inc.php:71
count()
return the number of different exercices into a folder
select_date($name, $selected='', $js='')
Show a ISelect with the different exercices, display start and end date.
$count
Definition: modele.inc.php:255