noalyss-commit
[Top][All Lists]
Advanced

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

[Noalyss-commit] [noalyss] 219/219: Task #1378 : show only the ledger of


From: Dany De Bontridder
Subject: [Noalyss-commit] [noalyss] 219/219: Task #1378 : show only the ledger of a given type
Date: Mon, 18 Dec 2017 13:23:05 -0500 (EST)

sparkyx pushed a commit to branch master
in repository noalyss.

commit 689dfc28be3ebcf8b978efd3cb5aea70dda61797
Author: Dany De Bontridder <address@hidden>
Date:   Sun Dec 17 18:47:21 2017 +0100

    Task #1378 : show only the ledger of a given type
---
 html/js/scripts.js                 | 40 ++++++++++++++++++++++++++++++++++++++
 include/cfgledger.inc.php          |  5 +++++
 include/class/acc_ledger.class.php |  2 +-
 3 files changed, 46 insertions(+), 1 deletion(-)

diff --git a/html/js/scripts.js b/html/js/scripts.js
index 02c4792..65192cd 100644
--- a/html/js/scripts.js
+++ b/html/js/scripts.js
@@ -3002,4 +3002,44 @@ function pin (object_id) {
             ); 
         $('pin_'+object_id).firstChild.innerHTML="&#8778;";
     }
+}
+/**
+ * Show only the rows into the table (p_table_id) with the attribute 
(p_attribute_name) and if this attribute
+ * has the value of  (attribut_value)
+ * @param p_table_id table id
+ * @param p_attribute_name the name of the attribute
+ * @param p_attribute_value the value of the attribute we want to show
+ */
+function show_only_row(p_table_id,p_attribute_name,p_attribute_value)
+{
+    if ( ! $(p_table_id)) {
+        throw "Invalide table id"
+    }
+    var mTable=$(p_table_id) ;
+    var ncount=mTable.rows.length
+    for (var i = 0;i < ncount;i++) {
+        var mRow=mTable.rows[i];
+        if (mRow.getAttribute(p_attribute_name) != undefined && 
mRow.getAttribute(p_attribute_name)!=p_attribute_value){
+            mRow.hide();
+          } else {
+            mRow.show();
+          }
+    }
+}
+/**
+ * Show all the rows into the table (p_table_id) 
+ * @param p_table_id table id
+ */
+function show_all_row(p_table_id)
+{
+    if ( ! $(p_table_id)) {
+        throw "Invalide table id"
+    }
+    var mTable=$(p_table_id) ;
+    var ncount=mTable.rows.length
+    for (var i = 0;i < ncount;i++) {
+        var mRow=mTable.rows[i];
+            mRow.show();
+    }
+    
 }
\ No newline at end of file
diff --git a/include/cfgledger.inc.php b/include/cfgledger.inc.php
index 7002f6e..d9fc2b3 100644
--- a/include/cfgledger.inc.php
+++ b/include/cfgledger.inc.php
@@ -159,6 +159,11 @@ switch ($sa)
 // Display list of ledgers
 //////////////////////////////////////////////////////////////////////////
 if ( $show_menu == 1 ) {
+    echo HtmlInput::anchor_action(_("Tout"), 
'show_all_row(\'cfgledger_table_id\')','ledger_all_bt','smallbutton ');
+    echo HtmlInput::anchor_action(_("Financier"), 
'show_only_row(\'cfgledger_table_id\',\'ledger_type\',\'FIN\')','ledger_fin_bt','smallbutton
 ');
+    echo HtmlInput::anchor_action(_("Achat"), 
'show_only_row(\'cfgledger_table_id\',\'ledger_type\',\'ACH\')','ledger_ach_bt','smallbutton
 ');
+    echo HtmlInput::anchor_action(_("Opérations Diverses"), 
'show_only_row(\'cfgledger_table_id\',\'ledger_type\',\'ODS\')','ledger_ods_bt','smallbutton
 ');
+    echo HtmlInput::anchor_action(_("Vente"), 
'show_only_row(\'cfgledger_table_id\',\'ledger_type\',\'VEN\')','ledger_ven_bt','smallbutton
 ');
     echo '<div class="content">';
     echo $ledger->listing();
     echo '</div>';
diff --git a/include/class/acc_ledger.class.php 
b/include/class/acc_ledger.class.php
index a146403..9755412 100644
--- a/include/class/acc_ledger.class.php
+++ b/include/class/acc_ledger.class.php
@@ -2617,7 +2617,7 @@ class Acc_Ledger extends jrn_def_sql
         {
             $l_line=Database::fetch_array($ret, $i);
             $url=$base_url."&sa=detail&p_jrn=".$l_line['jrn_def_id'];
-            $r.=sprintf('<TR><TD><A HREF="%s">%s</A></TD></TR>', $url,
+            $r.=sprintf('<TR ledger_type="%s"><TD><A 
HREF="%s">%s</A></TD></TR>', $l_line['jrn_def_type'],$url,
                     h($l_line['jrn_def_name']).' 
('.$l_line['jrn_def_type'].')');
         }
         $r.="</TABLE>";



reply via email to

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