26 $exercice->value = HtmlInput::default_value_post(
'p_exercice',
'');
28 $year =
new INum(
'year');
30 $year->value = HtmlInput::default_value_post(
'year',
'');
32 $nb_month =
new INum(
'nb_month');
34 $nb_month->value = HtmlInput::default_value_post(
'nb_month',
'');
36 $from =
new ISelect(
'from_month');
37 $from->selected= HtmlInput::default_value_post(
'from_month',
'');
39 for ($i = 1; $i < 13; $i++)
41 $amonth[] = array(
"value" => $i,
"label" => $i);
43 $from->value = $amonth;
45 require_once
'template/tool_exercice_input.php';
50 $this->exercice = $_POST[
'p_exercice'];
51 $this->nb_month = $_POST[
'nb_month'];
52 $this->from = $_POST[
'from_month'];
53 $this->year= $_POST[
'year'];
58 if (isNumber($this->exercice) == 0)
59 throw new Exception(
"Exercice n'est pas un nombre");
61 if ($this->exercice > COMPTA_MAX_YEAR|| $this->exercice < COMPTA_MIN_YEAR)
62 throw new Exception(
"Exercice doit être entre ".COMPTA_MAX_YEAR.
"& ".COMPTA_MIN_YEAR);
63 if (isNumber($this->year) == 0)
64 throw new Exception(
"Année n'est pas un nombre");
66 if ($this->year > COMPTA_MAX_YEAR|| $this->year < COMPTA_MIN_YEAR)
67 throw new Exception(
"Année doit être entre ".COMPTA_MAX_YEAR.
"& ".COMPTA_MIN_YEAR);
69 if (isNumber($this->nb_month) == 0)
70 throw new Exception(
"Nombre de mois n'est pas un nombre");
71 if ($this->nb_month < 1 || $this->nb_month > 60)
72 throw new Exception(
"Nombre de mois doit être compris entre 1 & 60 ");
73 if (isNumber($this->from) == 0)
74 throw new Exception(
"Mois de début n'existe pas ");
75 if ($this->from > 13 || $this->from < 1)
76 throw new Exception(
"Mois de début n'existe pas ");
87 throw new Exception($e->getMessage());
96 for ($i = 1; $i <= $this->nb_month; $i++)
101 $date_end = $this->cn->get_value(
"select to_char(to_date('$date_start','DD.MM.YYYY')+interval '1 month'-interval '1 day','DD.MM.YYYY')");
104 throw new Exception(
'Erreur insertion période');
119 var_dump($e->getTraceAsString());
if(isset($_POST['save'])) if(isset($_GET['compute'])) $date_start