Plugins  LAST
 All Data Structures Files Functions Variables Pages
list_tva.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 require_once(NOALYSS_INCLUDE.'/lib/class_iselect.php');
23 require_once NOALYSS_INCLUDE.'/lib/class_sort_table.php';
24 
25 echo '<div id="detail" style="display:none; width:80%;margin-left:10%">';
26 echo '<image src="image/loading.gif" border="0" alt="Chargement...">';
27 echo '</div>';
28 /**\file
29  * \brief show all the declaration by date
30  */
31 
32 echo '<div id="main" class="content" style="width:80%;margin-left:10%">';
33 echo '<form method="get">';
34 echo HtmlInput::request_to_hidden(array('ac'));
35 echo _('Filtrer par ');
36 $choice = new ISelect('type');
37 $choice->value = array(
38  array('label' => 'Toutes', 'value' => 0),
39  array('label' => 'Déclarations', 'value' => 1),
40  array('label' => 'Listings assujetti', 'value' => 2),
41  array('label' => 'Listings intracom', 'value' => 3)
42 );
43 $choice->selected = (isset($_REQUEST['type'])) ? $_REQUEST['type'] : 0;
44 $choice->javascript = ' onchange="submit(this)"';
45 echo HtmlInput::extension();
46 echo HtmlInput::hidden('sa', 'ltva');
47 echo dossier::hidden();
48 echo $choice->input();
49 echo HtmlInput::submit('rc', 'Recharger');
50 echo '</form>';
51 
52 $url = HtmlInput::request_to_string(array('ac', 'plugin_code', 'gDossier', 'sa', 'type'));
53 $sort= new Sort_Table();
54 $sort->add('Date déclaration ', $url, ' order by date_decl asc', ' order by date_decl desc', 'da', 'dd');
55 $sort->add('Période ', $url, ' order by exercice asc,periode_dec asc', ' order by exercice desc,periode_dec desc', 'pa', 'pd');
56 
57 $option_order = (isset($_GET['ord'])) ? $_GET['ord'] : 'dd';
58 
59 $sql_order = $sort->get_sql_order($option_order);
60 
61 switch ($choice->selected)
62 {
63  case 0:
64  $sql = "
65 select da_id as id, 'Déclaration trim/mens' as type_title,1 as type_decl,to_char(date_decl,'DD.MM.YYYY') as date_fmt,date_decl,
66 case when periodicity ='1' then 'Mensuel'
67 when periodicity = '2' then 'Trimestriel'
68 end as fmt_periodicity,
69 periode_dec,exercice
70 from tva_belge.declaration_amount
71 union all
72 select i_id as id, 'Listing Intracom' as type_title, 3 as type_decl, to_char(date_decl,'DD.MM.YYYY') as date_fmt,date_decl,
73 case when periodicity ='1' then 'Mensuel'
74 when periodicity = '2' then 'Trimestriel'
75 when periodicity = '3' then 'Annuel'
76 end as fmt_periodicity,
77 periode_dec,exercice
78 from tva_belge.intracomm
79 union all
80 select a_id as id, 'Listing assujetti' as type_title, 2 as type_decl, to_char(date_decl,'DD.MM.YYYY') as date_fmt,date_decl,
81  'Annuel' as fmt_periodicity,
82 periode_dec,exercice
83 from tva_belge.assujetti
84 ";
85 
86  break;
87 
88  case 1:
89 
90  $sql = "
91 select da_id as id, 'Déclaration trim/mens' as type_title,1 as type_decl,to_char(date_decl,'DD.MM.YYYY') as date_fmt,
92 case when periodicity ='1' then 'Mensuel'
93 when periodicity = '2' then 'Trimestriel'
94 end as fmt_periodicity,
95 periode_dec,exercice
96 from tva_belge.declaration_amount
97 ";
98  break;
99  case 2:
100  $sql = "
101 select a_id as id, 'Listing assujetti' as type_title, 2 as type_decl, to_char(date_decl,'DD.MM.YYYY') as date_fmt,date_decl,
102  'Annuel' as fmt_periodicity,
103 periode_dec,exercice
104 from tva_belge.assujetti
105 ";
106  break;
107  case 3:
108  $sql = "
109 select i_id as id, 'Listing Intracom' as type_title, 3 as type_decl, to_char(date_decl,'DD.MM.YYYY') as date_fmt,date_decl,
110 case when periodicity ='1' then 'Mensuel'
111 when periodicity = '2' then 'Trimestriel'
112 when periodicity = '3' then 'Annuel'
113 end as fmt_periodicity,
114 periode_dec,exercice
115 from tva_belge.intracomm
116 ";
117  break;
118 }
120 $res = $cn->get_array($sql);
121 ?>
122 <table class="result" >
123  <tr>
124  <th>Type de déclaration</th>
125  <th>Periodicité</th>
126  <th> <?php echo $sort->get_header(1)?></th>
127  <th><?php echo $sort->get_header(0)?></th>
128 
129  <?php for ($i = 0; $i < count($res); $i++):?>
130  <tr>
131  <?php
132  $aref = sprintf('<a href="javascript:void(0)" onclick="show_declaration(\'%s\',\'%s\')">', $res[$i]['type_decl'], $res[$i]['id']);
133  echo td($aref . $res[$i]['type_title'] . '</a>');
134  echo td($aref . $res[$i]['fmt_periodicity'] . '</a>');
135  echo td($aref.$res[$i]['periode_dec'].' - '.$res[$i]['exercice'].'</a>');
136  echo td($aref.$res[$i]['date_fmt'].'</a>');
137  ?>
138  </tr>
139  <?php endfor;?>
140 </table>
141 </div>
142 
143 
switch($choice->selected) $sql
$sort
endfor
$choice
$option_order
$url
$res
$categorie_appel table
$_REQUEST['sb']
Definition: am_print.php:39
$sql_order
global $cn