noalyss Version-9
exercice.class.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 accountancy period (usually 1 year starting in January until december) = exercice
24 */
25
26/*!
27 * \class Exercice
28 * \brief about the accountancy period (usually 1 year starting in January until december) = exercice
29 */
31{
32 var $cn;
33 function __construct($cn)
34 {
35 $this->cn=$cn;
36 }
37 /**
38 *@brief return the number of different exercices into a folder
39 *@param $cn is the database connexion object database
40 *@return the count of exercice
41 */
42 function count()
43 {
44 $count=$this->cn->get_value('select count(distinct p_exercice) from parm_periode');
45 return $count;
46 }
47 /**
48 *@brief Show a ISelect with the different exercices
49 *@param $name of the iselect
50 *@param $selected the selected year (default = '')
51 *@param $js javascript (default = '')
52 *@return ISelect object
53 */
54 function select($name,$selected='',$js='')
55 {
57 $iselect->value=$this->cn->make_array('select distinct p_exercice,p_exercice_label from parm_periode order by 1 desc');
58 $iselect->selected=$selected;
59 $iselect->javascript=$js;
60 return $iselect;
61 }
62 /**
63 *@brief Show a ISelect with the different exercices, display start and end date
64 *@param $name of the iselect
65 *@param $selected the selected year (default = '')
66 *@param $js javascript (default = '')
67 *@return ISelect object
68 */
70 {
72 $iselect->value=$this->cn->make_array("select distinct p_exercice,to_char (min(p_start),'DD.MM.YY')
73 ||' - '
74 ||to_char (max(p_end),'DD.MM.YY')
75 from parm_periode
76 group by p_exercice order by 1");
77 $iselect->selected=$selected;
78 $iselect->javascript=$js;
79 return $iselect;
80 }
81 /**
82 * @brief retrieve the exercice from the exercice label
83 * @param string $p_label
84 */
85 function exercice_from_label($p_label)
86 {
87 $value = $this->cn->get_value("select distinct p_exercice from parm_periode where p_exercice_label=$1",
88 [$p_label]);
89 if ($value == "") return -1;
90 return $value;
91 }
92}
$selected
$input_from cn
Definition: balance.inc.php:66
about the accountancy period (usually 1 year starting in January until december) = exercice
select($name, $selected='', $js='')
Show a ISelect with the different exercices.
__construct($cn)
count()
return the number of different exercices into a folder
exercice_from_label($p_label)
retrieve the exercice from the exercice label
select_date($name, $selected='', $js='')
Show a ISelect with the different exercices, display start and end date.
Html Input , create a tag <SELECT> ... </SELECT> if readonly == true then display the label correspon...
$count
$iselect
Definition: menu.inc.php:121