phpcompta-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpcompta-dev] r391 - tag/rel650/tva


From: phpcompta-dev
Subject: [Phpcompta-dev] r391 - tag/rel650/tva
Date: Fri, 20 Jul 2012 06:44:47 +0200 (CEST)

Author: danydb
Date: 2012-07-20 06:44:45 +0200 (Fri, 20 Jul 2012)
New Revision: 391

Modified:
   tag/rel650/tva/list_tva.inc.php
Log:
Sort table for history of form

Modified: tag/rel650/tva/list_tva.inc.php
===================================================================
--- tag/rel650/tva/list_tva.inc.php     2012-07-09 16:12:43 UTC (rev 390)
+++ tag/rel650/tva/list_tva.inc.php     2012-07-20 04:44:45 UTC (rev 391)
@@ -15,16 +15,17 @@
  *   You should have received a copy of the GNU General Public License
  *   along with PhpCompta; if not, write to the Free Software
  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-*/
+ */
 /* $Revision$ */
 
 // Copyright Author Dany De Bontridder address@hidden
 require_once('class_iselect.php');
+require_once 'class_sort_table.php';
 
 echo '<div id="detail" style="display:none; width:80%;margin-left:10%">';
 echo '<image src="image/loading.gif" border="0" alt="Chargement...">';
 echo '</div>';
-/*!\file
+/* !\file
  * \brief show all the declaration by date
  */
 
@@ -32,24 +33,35 @@
 echo '<form method="get">';
 echo HtmlInput::request_to_hidden(array('ac'));
 echo _('Filtrer par ');
-$choice=new ISelect('type');
-$choice->value=array(
-                    array('label'=> 'Toutes','value'=> 0 ),
-                    array('label'=> 'Déclarations','value'=> 1 ),
-                    array('label'=> 'Listings assujetti','value'=> 2),
-                    array('label'=> 'Listings intracom','value'=> 3)
-                    );
-$choice->selected=(isset($_REQUEST['type']))?$_REQUEST['type']:0;
-$choice->javascript=' onchange="submit(this)"';
+$choice = new ISelect('type');
+$choice->value = array(
+       array('label' => 'Toutes', 'value' => 0),
+       array('label' => 'Déclarations', 'value' => 1),
+       array('label' => 'Listings assujetti', 'value' => 2),
+       array('label' => 'Listings intracom', 'value' => 3)
+);
+$choice->selected = (isset($_REQUEST['type'])) ? $_REQUEST['type'] : 0;
+$choice->javascript = ' onchange="submit(this)"';
 echo HtmlInput::extension();
-echo HtmlInput::hidden('sa','ltva');
+echo HtmlInput::hidden('sa', 'ltva');
 echo dossier::hidden();
 echo $choice->input();
-echo HtmlInput::submit('rc','Recharger');
+echo HtmlInput::submit('rc', 'Recharger');
 echo '</form>';
-switch($choice->selected) {
-case 0:
- $sql="
+
+$url = HtmlInput::request_to_string(array('ac', 'plugin_code', 'gDossier', 
'sa', 'type'));
+$sort= new Sort_Table();
+$sort->add('Date déclaration   ', $url, ' order by date_decl asc', ' order by 
date_decl desc', 'da', 'dd');
+$sort->add('Période    ', $url, ' order by exercice asc,periode_dec asc', ' 
order by exercice desc,periode_dec desc', 'pa', 'pd');
+
+$option_order = (isset($_GET['ord'])) ? $_GET['ord'] : 'dd';
+
+$sql_order = $sort->get_sql_order($option_order);
+
+switch ($choice->selected)
+{
+       case 0:
+               $sql = "
 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,
 case when periodicity ='1' then 'Mensuel'
 when periodicity = '2' then 'Trimestriel'
@@ -69,15 +81,13 @@
  'Annuel' as fmt_periodicity,
 periode_dec,exercice
 from tva_belge.assujetti
-
-order by date_decl desc
 ";
 
-  break;
+               break;
 
-case 1:
+       case 1:
 
-  $sql="
+               $sql = "
 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,
 case when periodicity ='1' then 'Mensuel'
 when periodicity = '2' then 'Trimestriel'
@@ -85,18 +95,17 @@
 periode_dec,exercice
 from tva_belge.declaration_amount order by date_decl desc
 ";
-  break;
-case 2:
-$sql="
+               break;
+       case 2:
+               $sql = "
 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,
  'Annuel' as fmt_periodicity,
 periode_dec,exercice
 from tva_belge.assujetti
-order by date_decl desc
 ";
-break;
-case 3:
-$sql="
+               break;
+       case 3:
+               $sql = "
 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,
 case when periodicity ='1' then 'Mensuel'
 when periodicity = '2' then 'Trimestriel'
@@ -104,26 +113,31 @@
 end as fmt_periodicity,
 periode_dec,exercice
 from tva_belge.intracomm
-order by date_decl desc
 ";
-  break;
-
+               break;
 }
-$res=$cn->get_array($sql);
-echo '<table class="result" >';
-echo tr(th('Type de 
déclaration').th('Periodicité').th('Mois/année').th('Date').th('Année'));
-for ($i=0;$i<count($res);$i++){
-  $aref=sprintf('<a href="javascript:void(0)" 
onclick="show_declaration(\'%s\',\'%s\')">',
-               $res[$i]['type_decl'],$res[$i]['id']);
-  $row=td($aref.$res[$i]['type_title'].'</a>');
-  $row.=td($aref.$res[$i]['fmt_periodicity'].'</a>');
-  $row.=td($aref.$res[$i]['periode_dec'].'</a>');
-  $row.=td($aref.$res[$i]['date_fmt'].'</a>');
-  $row.=td($aref.$res[$i]['exercice'].'</a>');
+$sql = $sql . $sql_order;
+$res = $cn->get_array($sql);
+?>
+<table class="result" >
+       <tr>
+               <th>Type de déclaration</th>
+               <th>Periodicité</th>
+               <th> <?=$sort->get_header(1)?></th>
+               <th><?=$sort->get_header(0)?></th>
 
-  echo tr($row);
-}
-echo '</table>';
-echo '</div>';
+               <? for ($i = 0; $i < count($res); $i++):?>
+               <tr>
+                       <?
+                       $aref = sprintf('<a href="javascript:void(0)" 
onclick="show_declaration(\'%s\',\'%s\')">', $res[$i]['type_decl'], 
$res[$i]['id']);
+                       echo td($aref . $res[$i]['type_title'] . '</a>');
+                       echo td($aref . $res[$i]['fmt_periodicity'] . '</a>');
+                       echo td($aref.$res[$i]['periode_dec'].' - 
'.$res[$i]['exercice'].'</a>');
+                       echo td($aref.$res[$i]['date_fmt'].'</a>');
+                       ?>
+               </tr>
+       <? endfor;?>
+</table>
+</div>
 
 



---
PhpCompta est un logiciel de comptabilité libre en ligne (full web)
Projet opensource http://www.phpcompta.eu



reply via email to

[Prev in Thread] Current Thread [Next in Thread]