Plugins  LAST
 All Data Structures Files Functions Variables Pages
am_generate.inc.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of NOALYSS.
5  *
6  * NOALYSS is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * NOALYSS is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with NOALYSS; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19  */
20 /* $Revision$ */
21 
22 // Copyright (c) 2002 Author Dany De Bontridder dany@alchimerys.be
23 
24 /**
25  * @file
26  * \brief let you generate the accounting for the paid off for a selected
27  * year
28  */
29 require_once('class_am_generate.php');
30 require_once('class_amortissement_sql.php');
31 global $cn;
32 
33 $am = new Am_Generate();
34 
35 if (isset($_POST['generate']))
36 {
37  try
38  {
39  /*
40  * propose writing
41  */
42  if ($am->propose_writing($_POST) == false)
43  {
44  echo '<div class="content" style="width:80%;margin-left:10%">';
45  echo $am->input($_POST);
46  echo '</div>';
47  }
48  return;
49  }
50  catch (Exception $e)
51  {
52  echo $e->getMessage();
53  error_log($e->getMessage());
54  error_log($e->getTraceAsString());
55  }
56 }
57 
58 if (isset($_POST['save']))
59 {
60  try
61  {
62  $cn->start();
63  $p_group=HtmlInput::default_value_post("grouped", -1);
64  if ( $p_group == 1)
65  {
66  $group=true;
67  } else if ($p_group == 0)
68  {
69  $group=false;
70  }
71  if ( isset ($group))
72  $m = $am->save($_POST,$group);
73  else
74  throw new Exception (_('Missing parameter grouped'));
75  /*
76  * if $m is not empty, some mat. were already encoded
77  */
78  if ($m != '')
79  {
80  throw new Exception($m);
81  }
82  $cn->commit();
83  echo '<div class="content" style="width:80%;margin-left:10%">';
84 
85  echo h2("Opération sauvée") ;
86  echo '<ol>';
87  for ($i=0;$i < count($am->saved_operation['desc']);$i++)
88  {
89  echo '<li>';
90  echo sprintf('<A class="detail" style="display:inline;text-decoration:underline" HREF="javascript:modifyOperation(%d,%d)">%s</A>', $am->saved_operation['jr_id'][$i], dossier::id(), $am->saved_operation['internal'][$i]." ".$am->saved_operation['desc'][$i]);
91  echo '</li>';
92  }
93  echo '</ol>';
94  echo '</div>';
95  return;
96  }
97  catch (Exception $e)
98  {
99  echo alert($e->getMessage());
100  $cn->rollback();
101  }
102 }
103 
104 echo '<div class="content" style="width:80%;margin-left:10%">';
105 echo $am->input($_POST);
106 
107 
108 echo '</div>';
$select_type id
global $cn