Plugins  LAST
 All Data Structures Files Functions Variables Pages
declaration.inc.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 /* $Revision$ */
20 
21 // Copyright (c) 2002 Author Dany De Bontridder dany@alchimerys.be
22 
23 /**
24  * @file
25  * @brief Déclaration
26  *
27  */
28 require_once 'class_rapav_declaration.php';
29 global $cn;
30 
31 /*
32  * Save the date (update them)
33  */
34 if (isset($_POST['save']))
35 {
36  $decl = new Rapav_Declaration();
37  $decl->d_description =strip_tags($_GET['p_description']);
38  $decl->d_id = $_POST['d_id'];
39  $decl->load();
40  $decl->to_keep = 'Y';
41  $decl->f_id = $_POST['p_form'];
42  $decl->save();
43  if ($decl->d_step == 0)
44  {
45  $decl->generate_document();
46  } else
47  {
48  // get empty lob
49  $decl->d_filename = null;
50  $decl->d_size = null;
51  $decl->d_mimetype = null;
52  $decl->d_lob = null;
53  $decl->update();
54  }
55  $decl->display();
56  echo '<p class="notice">' . _(' Sauvé ') . date('d-m-Y H:i') . '</p>';
57 
58  $ref_csv = HtmlInput::array_to_string(array('gDossier', 'plugin_code', 'd_id'), $_REQUEST, 'extension.raw.php?');
59  $ref_csv.="&amp;act=export_decla_csv";
60  echo HtmlInput::button_anchor("Export CSV", $ref_csv, 'export_id', "", 'small_button');
61  if ($decl->d_filename != '' && $decl->d_step == 0)
62  echo $decl->anchor_document();
63  return;
64 }
65 /*
66  * compute and propose to modify and save
67  */
68 if (isset($_GET['compute']))
69 {
70  $decl = new Rapav_Declaration();
71  if (isDate($_GET['p_start']) == 0 || isDate($_GET['p_end']) == 0)
72  {
73  alert('Date invalide');
74  } else
75  {
76  $decl->d_description = $_GET['p_description'];
77  $decl->compute($_GET['p_form'], $_GET['p_start'], $_GET['p_end'], $_GET['p_step']);
78  echo '<form class="print" method="POST">';
79  echo HtmlInput::hidden('p_form', $_GET['p_form']);
80  $decl->display();
81  echo HtmlInput::submit('save', 'Sauver');
82  echo '</form>';
83  return;
84  }
85 }
86 /*
87  * For rapport
88  */
89 $date_start = new IDate('p_start');
90 $date_end = new IDate('p_end');
91 $hidden = HtmlInput::array_to_hidden(array('gDossier', 'ac', 'plugin_code', 'sa'), $_GET);
92 $select = new ISelect('p_form');
93 $select->value = $cn->make_array('select f_id,f_title from rapport_advanced.formulaire order by 2');
94 $description = new ITextArea('p_description');
95 $description->heigh = 2;
96 $description->style = ' class="itextarea" style="margin:0"';
97 
98 $description->width = 80;
99 
100 $istep = new ISelect('p_step');
101 $istep->value = array(
102  array('label' => 'Aucun', 'value' => 0),
103  array('label' => '7 jours', 'value' => 1),
104  array('label' => '14 jours', 'value' => 2),
105  array('label' => '1 mois', 'value' => 3),
106  array('label' => '2 mois', 'value' => 4),
107  array('label' => '3 mois', 'value' => 5),
108  array('label' => '6 mois', 'value' => 6),
109  array('label' => '1 an', 'value' => 7)
110 );
111 /*
112  * For listing
113  */
114 $date_start_listing = new IDate('p_start');
115 $date_end_listing = new IDate('p_end');
116 $select_listing = new ISelect('p_listing');
117 $select_listing->value = $cn->make_array("select l_id, l_name from rapport_advanced.listing order by 2");
118 $select_listing->javascript=' onchange ="generation_fill_condition ();generation_fill_description()"';
119 $description_listing = new ITextArea('p_description');
120 $description_listing->heigh = 2;
121 $description_listing->style = ' class="itextarea" style="margin:0"';
122 $description_listing->width = 80;
123 $operation_paid = new ISelect('p_operation_paid');
124 
125 $operation_paid->value = array(
126  array('value' => 0, 'label' => 'Toutes les opérations'),
127  array('value' => 1, 'label' => 'Uniquement les opérations payées'),
128  array('value' => 2, 'label' => 'Uniquement les opérations non payées')
129 );
130 ?>
131 <div id="id_rapport_div" style="display: block">
132  <form id="declaration_form_id" method="GET" onsubmit="return validate()">
133  <?php echo $hidden ?>
134  <input type="hidden" name="form" value="rapport">
135  <table style="min-width: 40%">
136  <tr>
137  <td>
138  Formulaire
139  </td>
140  <td>
141 <?php echo $select->input() ?>
142  </td>
143  </tr>
144  <tr>
145  <td> Description</td><td> <?php echo $description->input() ?></td>
146  </tr>
147  <tr>
148  <td>
149  Date de début
150  </td>
151  <td>
152  <?php echo $date_start->input() ?>
153  </td>
154  </tr>
155  <tr>
156  <td>
157  Date de fin
158  </td>
159  <td>
160  <?php echo $date_end->input() ?>
161  </td>
162  </tr>
163  <tr>
164  <td>
165  Etape de
166  </td>
167  <td>
168 <?php echo $istep->input() ?>
169  </td>
170  </tr>
171  </table>
172  </p>
173 <?php echo HtmlInput::submit('compute', 'Générer') ?>
174  </form>
175 </div>
176 
177 <script charset="UTF8" lang="javascript">
178  function validate() {
179  if (check_date_id('<?php echo $date_start->id ?>') == false) {
180  smoke.alert('Date de début incorrecte');
181  $('<?php echo $date_start->id ?>').style.borderColor = 'red';
182  $('<?php echo $date_start->id ?>').style.borderWidth = 2;
183  return false;
184  }
185  if (check_date_id('<?php echo $date_end->id ?>') == false) {
186  smoke.alert('Date de fin incorrecte');
187  $('<?php echo $date_end->id ?>').style.borderColor = 'red';
188  $('<?php echo $date_end->id ?>').style.borderWidth = 2;
189  return false;
190  }
191  return true;
192  }
193 </script>
$select value
$select_listing
$description style
$date_end
compute, save and display a declaration
$description_listing
global $cn
$operation_paid
$date_start_listing
$categorie_appel table
if(isset($_POST['save'])) if(isset($_GET['compute'])) $date_start
$categorie_appel name
$_REQUEST['sb']
Definition: am_print.php:39
$description
$date_end_listing