phpcompta-dev
[Top][All Lists]
Advanced

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

[Phpcompta-dev] r418 - in trunk/rapport_avance: . include


From: phpcompta-dev
Subject: [Phpcompta-dev] r418 - in trunk/rapport_avance: . include
Date: Sun, 30 Sep 2012 01:13:08 +0200 (CEST)

Author: danydb
Date: 2012-09-30 01:13:07 +0200 (Sun, 30 Sep 2012)
New Revision: 418

Added:
   trunk/rapport_avance/ajax_declaration_display.php
   trunk/rapport_avance/include/historique.inc.php
Modified:
   trunk/rapport_avance/ajax.php
   trunk/rapport_avance/include/class_rapav_declaration.php
   trunk/rapport_avance/include/declaration.inc.php
   trunk/rapport_avance/rapav_javascript.js
Log:
Add the history + display + remove

Modified: trunk/rapport_avance/ajax.php
===================================================================
--- trunk/rapport_avance/ajax.php       2012-09-29 22:12:15 UTC (rev 417)
+++ trunk/rapport_avance/ajax.php       2012-09-29 23:13:07 UTC (rev 418)
@@ -111,6 +111,19 @@
        
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        case 'delete_param_detail':
                $cn->exec_sql("delete from 
rapport_advanced.formulaire_param_detail where fp_id=$1",array($fp_id));
+               break;
+       
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+       // Display a saved declaration from history
+       
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+       case 'rapav_declaration_display':
+               include 'ajax_declaration_display.php';
+               break;
+       
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+       // Delete a saved declaration (from history)
+       
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+       case 'rapav_declaration_delete':
+               $cn->exec_sql("delete from rapport_advanced.declaration where 
d_id=$1",array($_GET['d_id']));
+               break;
        default:
                break;
 

Added: trunk/rapport_avance/ajax_declaration_display.php
===================================================================
--- trunk/rapport_avance/ajax_declaration_display.php                           
(rev 0)
+++ trunk/rapport_avance/ajax_declaration_display.php   2012-09-29 23:13:07 UTC 
(rev 418)
@@ -0,0 +1,36 @@
+<?php
+
+/*
+ *   This file is part of PhpCompta.
+ *
+ *   PhpCompta is free software; you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation; either version 2 of the License, or
+ *   (at your option) any later version.
+ *
+ *   PhpCompta is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   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
+
+/**
+ * @file
+ * @brief display a declaration but you can't modify it
+ */
+require_once 'include/class_rapav_declaration.php';
+global $cn;
+echo HtmlInput::button_action("Retour","$('declaration_list_div').show(); 
$('declaration_display_div').hide();");
+$decl = new Rapav_Declaration();
+$decl->d_id = $_GET['d_id'];
+$decl->load();
+$decl->display();
+echo HtmlInput::button_action("Retour","$('declaration_list_div').show(); 
$('declaration_display_div').hide();");
+?>

Modified: trunk/rapport_avance/include/class_rapav_declaration.php
===================================================================
--- trunk/rapport_avance/include/class_rapav_declaration.php    2012-09-29 
22:12:15 UTC (rev 417)
+++ trunk/rapport_avance/include/class_rapav_declaration.php    2012-09-29 
23:13:07 UTC (rev 418)
@@ -119,6 +119,7 @@
                        {
                                $cn->exec_sql('update 
rapport_advanced.declaration_row set dr_amount=$2 where 
dr_id=$1',array($code[$i],$amount[$i]));
                        }
+                       $cn->commit();
                }
                catch(Exception $e)
                {

Modified: trunk/rapport_avance/include/declaration.inc.php
===================================================================
--- trunk/rapport_avance/include/declaration.inc.php    2012-09-29 22:12:15 UTC 
(rev 417)
+++ trunk/rapport_avance/include/declaration.inc.php    2012-09-29 23:13:07 UTC 
(rev 418)
@@ -36,8 +36,10 @@
        $decl = new Rapav_Declaration();
        $decl->d_id = $_POST['d_id'];
        $decl->load();
+       $decl->to_keep='Y';
        $decl->save();
        $decl->display();
+       echo '<h2 class="notice"> Sauvé</h2>';
        exit();
 }
 /*

Added: trunk/rapport_avance/include/historique.inc.php
===================================================================
--- trunk/rapport_avance/include/historique.inc.php                             
(rev 0)
+++ trunk/rapport_avance/include/historique.inc.php     2012-09-29 23:13:07 UTC 
(rev 418)
@@ -0,0 +1,78 @@
+<?php
+
+/*
+ *   This file is part of PhpCompta.
+ *
+ *   PhpCompta is free software; you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation; either version 2 of the License, or
+ *   (at your option) any later version.
+ *
+ *   PhpCompta is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   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
+
+/**
+ * @file
+ * @brief show the history of the saved declaration
+ * take data from rapport_avance.declaration and display via ajax
+ */
+global $cn;
+$data=$cn->get_array("select d_id,d_title,
+               d_start,d_end
+               from rapport_advanced.declaration
+               where to_keep='Y'
+               order by d_start,d_title");
+?>
+<div id="declaration_list_div">
+<table class="sortable">
+       <tr>
+               <th>
+                       Date début
+               </th>
+               <th>
+                       Date Fin
+               </th>
+               <th>
+                       Déclaration
+               </th>
+               <th>
+
+               </th>
+               <th>
+                       
+               </th>
+       </tr>
+       <? for ($i=0;$i<count($data);$i++) :?>
+       <tr id="tr_<?=$data[$i]['d_id']?>">
+               <td>
+                       <?=format_date($data[$i]['d_start'])?>
+               </td>
+               <td>
+                       <?=format_date($data[$i]['d_end'])?>
+               </td>
+               <td>
+                       <?=h($data[$i]['d_title'])?>
+               </td>
+               <td id="mod_<?=$data[$i]['d_id']?>">
+                       
<?=HtmlInput::anchor("Afficher","",sprintf("onclick=\"rapav_declaration_display('%s','%s','%s','%s')\"",$_REQUEST['plugin_code'],$_REQUEST['ac'],$_REQUEST['gDossier'],$data[$i]['d_id']))?>
+               </td>
+               <td id="del_<?=$data[$i]['d_id']?>">
+                       
<?=HtmlInput::anchor("Efface","",sprintf("onclick=\"rapav_declaration_delete('%s','%s','%s','%s')\"",$_REQUEST['plugin_code'],$_REQUEST['ac'],$_REQUEST['gDossier'],$data[$i]['d_id']))?>
+               </td>
+       </tr>
+       <? endfor; ?>
+</table>
+</div>
+<div id="declaration_display_div">
+
+</div>
\ No newline at end of file

Modified: trunk/rapport_avance/rapav_javascript.js
===================================================================
--- trunk/rapport_avance/rapav_javascript.js    2012-09-29 22:12:15 UTC (rev 
417)
+++ trunk/rapport_avance/rapav_javascript.js    2012-09-29 23:13:07 UTC (rev 
418)
@@ -298,4 +298,61 @@
        }
 
        return false;
+}
+function rapav_declaration_display(plugin_code,ac,dossier,d_id)
+{
+       try
+       {
+               $('declaration_list_div').hide();
+               $('declaration_display_div').innerHTML="";
+               $('declaration_display_div').show();
+               waiting_box();
+               var 
querystring='plugin_code='+plugin_code+'&ac='+ac+'&gDossier='+dossier+'&act=rapav_declaration_display'+"&d_id="+d_id;
+               var action=new Ajax.Request(
+                       "ajax.php",
+                       {
+                               method:'get',
+                               parameters:querystring,
+                               onFailure:error_get_predef,
+                               onSuccess:function(req){
+                                       remove_waiting_box();
+                                       var answer=req.responseText;
+                                       
$('declaration_display_div').innerHTML=answer;
+                                       answer.evalScripts()
+                               }
+                       }
+                       );
+       }
+       catch(e)
+       {
+               alert(e.message);
+       }
+}
+function rapav_declaration_delete(plugin_code,ac,dossier,d_id)
+{
+       try
+       {
+               if ( confirm('Confirmez-vous l\'effacement ?') == false) { 
return;}
+               waiting_box();
+               var 
querystring='plugin_code='+plugin_code+'&ac='+ac+'&gDossier='+dossier+'&act=rapav_declaration_delete'+"&d_id="+d_id;
+               var action=new Ajax.Request(
+                       "ajax.php",
+                       {
+                               method:'get',
+                               parameters:querystring,
+                               onFailure:error_get_predef,
+                               onSuccess:function(req){
+                                       remove_waiting_box();
+                                       
$('tr_'+d_id).style.textDecoration="line-through";
+                                       $('tr_'+d_id).style.color="red";
+                                       $('del_'+d_id).innerHTML="";
+                                       $('mod_'+d_id).innerHTML="";
+                               }
+                       }
+                       );
+       }
+       catch(e)
+       {
+               alert(e.message);
+       }
 }
\ No newline at end of file



---
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]