noalyss-commit
[Top][All Lists]
Advanced

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

[Noalyss-commit] [noalyss] 02/07: Put a button export CSV & PDF into the


From: Dany De Bontridder
Subject: [Noalyss-commit] [noalyss] 02/07: Put a button export CSV & PDF into the inner windows for the history of card and accounting
Date: Thu, 15 Oct 2015 19:00:14 +0000

sparkyx pushed a commit to branch master
in repository noalyss.

commit 25cda2ef7c35af14b65d0b717ac4d12bb2fe8f65
Author: Dany De Bontridder <address@hidden>
Date:   Thu Oct 15 10:37:37 2015 +0200

    Put a button export CSV & PDF into the inner windows for the history of 
card and accounting
---
 include/ajax/ajax_history.php              |   19 ++++++--
 include/class/class_acc_account_ledger.php |   66 +++++++++++++++++++++++-----
 include/class/class_fiche.php              |   44 ++++++++++++++++++
 3 files changed, 113 insertions(+), 16 deletions(-)

diff --git a/include/ajax/ajax_history.php b/include/ajax/ajax_history.php
index 3fd225e..cb2119e 100644
--- a/include/ajax/ajax_history.php
+++ b/include/ajax/ajax_history.php
@@ -87,7 +87,7 @@ if ( isset($_GET['f_id']))
              }
            else
              {
-               $old='<form method="get" action="popup.php">';
+               $old='<form method="get" style="display:inline" 
action="popup.php">';
                $is=$exercice->select('ex',$default,'onchange = 
"submit(this)"');
                $old.=_("Autre exercice")." ".$is->input();
                $old.=HtmlInput::hidden('div','popup');
@@ -108,7 +108,10 @@ if ( isset($_GET['f_id']))
  
        if (   $fiche->HtmlTable($array,0,$from_div)==-1){
          echo h2(_("Aucune opération pour l'exercice 
courant"),'class="error"');
-       }
+       } else {
+            echo 
$fiche->button_csv($array['from_periode'],$array['to_periode']);
+            echo 
$fiche->button_pdf($array['from_periode'],$array['to_periode']);
+          }
 
        echo $old;
 
@@ -159,7 +162,7 @@ if ( isset($_REQUEST['pcm_val']))
              }
            else
              {
-               $old='<form method="get" action="popup.php">';
+               $old='<form method="get" style="display:inline" 
action="popup.php">';
                $is=$exercice->select('ex',$default,'onchange = 
"submit(this)"');
                $old.=_("Autre exercice")." ".$is->input();
                $old.=HtmlInput::hidden('div','popup');
@@ -175,12 +178,18 @@ if ( isset($_REQUEST['pcm_val']))
 
         ob_start();
         require_once NOALYSS_INCLUDE.'/template/history_top.php';
-
+        
+        
+        
         if ( $poste->HtmlTable($array) == -1)
          {
            echo h2($poste->id." ".$poste->name,' class="title"');
            echo h2(_("Aucune opération pour l'exercice 
courant"),'class="error"');
-         }
+         } else {
+                 
+                 echo 
$poste->button_csv($array['from_periode'],$array['to_periode']);
+                 echo 
$poste->button_pdf($array['from_periode'],$array['to_periode']);
+          }
        echo $old;
 
         $html=ob_get_contents();
diff --git a/include/class/class_acc_account_ledger.php 
b/include/class/class_acc_account_ledger.php
index 274039d..f35a939 100644
--- a/include/class/class_acc_account_ledger.php
+++ b/include/class/class_acc_account_ledger.php
@@ -635,17 +635,61 @@ class Acc_Account_Ledger
         $sql=substr($sql,0,strlen($sql)-2);
         return $sql;
     }
-       /**
-        * Find the id of the cards which are using the current account
-         * 
-        * @return an array of f_id
-        */
-       function find_card()
-       {
-               $sql="select f_id from fiche_detail where ad_id=$1 and 
ad_value=$2";
-               
$account=$this->db->get_array($sql,array(ATTR_DEF_ACCOUNT,$this->id));
-               return $account;
-       }
+    /**
+     * Find the id of the cards which are using the current account
+     * 
+     * @return an array of f_id
+     */
+    function find_card()
+    {
+            $sql="select f_id from fiche_detail where ad_id=$1 and 
ad_value=$2";
+            
$account=$this->db->get_array($sql,array(ATTR_DEF_ACCOUNT,$this->id));
+            return $account;
+    }
+    /**
+     * @brief Return a string with the HTML code to display a button to export 
the 
+     * history in CSV
+     * @param type $p_from from date (DD.MM.YYYY)
+     * @param type $p_to to date (DD.MM.YYYY)
+     * @return HTML string
+     */
+    function button_csv($p_from,$p_to) {
+        $href="export.php?".http_build_query(
+                array(
+                    "gDossier"=>Dossier::id(),
+                    "poste_id"=>$this->id,
+                    "ople"=>0,
+                    "type"=>"poste",
+                    "from_periode"=>$p_from,
+                    "to_periode"=>$p_to,
+                    "act"=>"CSV:postedetail"
+                    )
+                );
+        return '<a class="smallbutton" style="display:inline" 
href="'.$href.'">'._("Export CSV").'</a>';
+
+    }
+    /**
+     * @brief Return a string with the HTML code to display a button to export 
the 
+     * history in PDF
+     * @param type $p_from from date (DD.MM.YYYY)
+     * @param type $p_to to date (DD.MM.YYYY)
+     * @return HTML string
+     */
+    function button_pdf($p_from,$p_to) {
+        $href="export.php?".http_build_query(
+                array(
+                    "gDossier"=>Dossier::id(),
+                    "poste_id"=>$this->id,
+                    "ople"=>0,
+                    "type"=>"poste",
+                    "from_periode"=>$p_from,
+                    "to_periode"=>$p_to,
+                    "act"=>"PDF:postedetail"
+                    )
+                );
+        return '<a class="smallbutton" style="display:inline" 
href="'.$href.'">'._("Export PDF").'</a>';
+        
+    }
     static function test_me()
     {
         $cn=Dossier::connect();
diff --git a/include/class/class_fiche.php b/include/class/class_fiche.php
index 6e7e211..d6ab887 100644
--- a/include/class/class_fiche.php
+++ b/include/class/class_fiche.php
@@ -1987,6 +1987,50 @@ class Fiche
        {
 
        }
+    /**
+     * @brief Return a string with the HTML code to display a button to export 
the 
+     * history in CSV
+     * @param type $p_from from date (DD.MM.YYYY)
+     * @param type $p_to to date (DD.MM.YYYY)
+     * @return HTML string
+     */
+    function button_csv($p_from,$p_to) {
+        $href="export.php?".http_build_query(
+                array(
+                    "gDossier"=>Dossier::id(),
+                    "f_id"=>$this->id,
+                    "ople"=>0,
+                    "type"=>"poste",
+                    "from_periode"=>$p_from,
+                    "to_periode"=>$p_to,
+                    "act"=>"CSV:fichedetail"
+                    )
+                );
+        return '<a class="smallbutton" style="display:inline" 
href="'.$href.'">'._("Export CSV").'</a>';
+
+    }
+    /**
+     * @brief Return a string with the HTML code to display a button to export 
the 
+     * history in PDF
+     * @param type $p_from from date (DD.MM.YYYY)
+     * @param type $p_to to date (DD.MM.YYYY)
+     * @return HTML string
+     */
+    function button_pdf($p_from,$p_to) {
+        $href="export.php?".http_build_query(
+                array(
+                    "gDossier"=>Dossier::id(),
+                    "f_id"=>$this->id,
+                    "ople"=>0,
+                    "type"=>"poste",
+                    "from_periode"=>$p_from,
+                    "to_periode"=>$p_to,
+                    "act"=>"PDF:fichedetail"
+                    )
+                );
+        return '<a class="smallbutton" style="display:inline" 
href="'.$href.'">'._("Export PDF").'</a>';
+        
+    }
 }
 
 ?>



reply via email to

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