noalyss-commit
[Top][All Lists]
Advanced

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

[Noalyss-commit] [noalyss] 17/27: Mantis #1596: Dans le plan comptable,


From: Dany De Bontridder
Subject: [Noalyss-commit] [noalyss] 17/27: Mantis #1596: Dans le plan comptable, fiches non cliquables Les fiches sont cliquable dans Plan Comptable , PCMNCFG et dans la liste des postes, en plus on peut obtenir toutes les fiches d'un poste
Date: Sat, 11 Jul 2020 13:25:19 -0400 (EDT)

sparkyx pushed a commit to annotated tag E-8000
in repository noalyss.

commit abf4b1743ad85254fcb4af43322b0f81b6410ed9
Author: Dany De Bontridder <danydb@noalyss.eu>
AuthorDate: Sat Feb 2 13:31:35 2019 +0100

    Mantis #1596: Dans le plan comptable, fiches non cliquables
    Les fiches sont cliquable dans Plan Comptable , PCMNCFG et
    dans la liste des postes, en plus on peut obtenir toutes
    les fiches d'un poste
---
 html/ajax_misc.php                      |  2 ++
 html/js/accounting_item.js              | 25 +++++++++++++++
 html/js/scripts.js                      |  7 +++++
 include/ajax/ajax_display_all_card.php  | 56 +++++++++++++++++++++++++++++++++
 include/ajax/ajax_poste.php             |  5 +--
 include/class/acc_bilan.class.php       |  4 ++-
 include/class/acc_plan_mtable.class.php | 35 ++++++++++++++++++---
 include/lib/icon_action.class.php       | 14 +++++++++
 include/template/account_result.php     |  2 +-
 9 files changed, 142 insertions(+), 8 deletions(-)

diff --git a/html/ajax_misc.php b/html/ajax_misc.php
index 7f5218f..d951281 100644
--- a/html/ajax_misc.php
+++ b/html/ajax_misc.php
@@ -247,6 +247,8 @@ $path = array(
     "tva_parameter"=>"ajax_tva_parameter",
     // Currency  , delete a rate
     "CurrencyRateDelete"=>"ajax_currency",
+    // Display all cards using an accounting
+    "display_all_card"=>"ajax_display_all_card"
     // Currency , add / remove / update currency 
     "CurrencyManage"=>"ajax_currency"
 )    ;
diff --git a/html/js/accounting_item.js b/html/js/accounting_item.js
index 80cae00..41f3a34 100644
--- a/html/js/accounting_item.js
+++ b/html/js/accounting_item.js
@@ -244,3 +244,28 @@ function pausecomp(millis)
   do { curDate = new Date(); }
   while(curDate-date < millis);
 }
+/**
+ * Display the list of card using a given accounting
+ * @param dossier
+ * @param accounting
+ * 
+ */
+function display_all_card(p_dossier,p_accounting)
+{
+    waiting_box();
+    var 
div_dest=add_div({id:'info_card_accounting',cssclass:"inner_box",style:fixed_position(100,250)+";width:auto"});
+    var action=new Ajax.Request ( 'ajax_misc.php',
+                                      {
+                                        method:'get',
+                                        parameters:{op:"display_all_card",
+                                                    gDossier:p_dossier,
+                                                    p_accounting:p_accounting
+                                                },
+                                        onSuccess:function (req)
+                                        {
+                                            
div_dest.innerHTML=req.responseText;
+                                            remove_waiting_box();
+                                        }
+                                      }
+                                    );
+}
\ No newline at end of file
diff --git a/html/js/scripts.js b/html/js/scripts.js
index b3c8a34..6ac7d63 100644
--- a/html/js/scripts.js
+++ b/html/js/scripts.js
@@ -26,6 +26,10 @@
 var ask_reload = 0;
 var tag_choose = '';
 var aDraggableElement=new Array();
+var viewport = document.viewport.getDimensions(); // Gets the viewport as an 
object literal
+var width = viewport.width; // Usable window width
+var height = viewport.height;
+
 /**
  * callback function when we just need to update a hidden div with an info
  * message
@@ -1486,6 +1490,9 @@ function calcy(p_sy)
     {
         sy = document.documentElement.scrollTop + p_sy;
     }
+    if ( width < 801 ) {
+        sy=sy/2;
+    }
     return sy;
 
 }
diff --git a/include/ajax/ajax_display_all_card.php 
b/include/ajax/ajax_display_all_card.php
new file mode 100644
index 0000000..4f9b516
--- /dev/null
+++ b/include/ajax/ajax_display_all_card.php
@@ -0,0 +1,56 @@
+<?php
+
+/*
+ *   This file is part of NOALYSS.
+ *
+ *   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
+ */
+// Copyright (2018) Author Dany De Bontridder <dany@alchimerys.be>
+
+if (!defined('ALLOWED'))
+    die('Appel direct ne sont pas permis');
+
+/**
+ * @file
+ * @brief Display all cards using an accounting
+ */
+$accounting=$http->get("p_accounting");
+
+$a_card=$cn->get_array("
+    select f1.f_id,f3.ad_value as qcode, f2.ad_value as name
+        from fiche_detail as f1 
+        join fiche_detail as f2 on (f1.f_id=f2.f_id and f2.ad_id=1)
+        join fiche_detail as f3 on (f1.f_id=f3.f_id and f3.ad_id=23)
+    where 
+        f1.ad_id=5 and f1.ad_value=$1
+        order by 3", [$accounting]);
+$nb_card=count($a_card);
+echo HtmlInput::title_box($accounting, "info_card_accounting");
+echo '<div class="content">';
+echo '<ol>';
+for ($i=0; $i<$nb_card; $i++)
+{
+    echo '<li>';
+    echo HtmlInput::card_detail($a_card[$i]['qcode'], $a_card[$i]['name']);
+    echo '</li>';
+}
+echo '</ol>';
+echo '<ul class="aligned-block">';
+echo '<li>';
+echo HtmlInput::button_close("info_card_accounting");
+echo '</li>';
+echo '</ul>';
+
+echo '</div>';
\ No newline at end of file
diff --git a/include/ajax/ajax_poste.php b/include/ajax/ajax_poste.php
index a178c3b..d7c96df 100644
--- a/include/ajax/ajax_poste.php
+++ b/include/ajax/ajax_poste.php
@@ -43,8 +43,9 @@ mb_internal_encoding("UTF-8");
 
 extract($_REQUEST, EXTR_SKIP);
 
-if  ($g_user->check_dossier(dossier::id()) == 'X') exit();
+$dossier_id=Dossier::id();
 
+if  ($g_user->check_dossier($dossier_id) == 'X') exit();
 switch ($op2)
 {
     /*----------------------------------------------------------------------
@@ -141,7 +142,7 @@ case "sf":
         $array[$i]['javascript']=$str;
     }
     ob_start();
-
+    
     require_once NOALYSS_TEMPLATE.'/account_result.php';
     $r.=ob_get_contents();
     ob_end_clean();
diff --git a/include/class/acc_bilan.class.php 
b/include/class/acc_bilan.class.php
index 8f17f63..9585cfd 100644
--- a/include/class/acc_bilan.class.php
+++ b/include/class/acc_bilan.class.php
@@ -195,7 +195,9 @@ class Acc_Bilan
         
         /* debit Actif */
          $res=$this->db->execute("sqlAccount",array('ACT','ACTINV'));
-        $result=Database::fetch_array($res, 0);
+         $result=Database::fetch_array($res, 0);
+        
+         /* Show detail */
         
         $debit_actif=($result === false)?0:$result['amount_debit'];
         /* Credit Actif */
diff --git a/include/class/acc_plan_mtable.class.php 
b/include/class/acc_plan_mtable.class.php
index 26e68bf..c9ba7d7 100644
--- a/include/class/acc_plan_mtable.class.php
+++ b/include/class/acc_plan_mtable.class.php
@@ -77,7 +77,7 @@ class Acc_Plan_MTable extends Manage_Table_SQL
                 $p_row[$this->table->primary_key])
         ;
         
-        
+        $dossier_id=Dossier::id();
         $nb_order=count($this->a_order);
         for ($i=0; $i<$nb_order; $i++)
         {
@@ -97,8 +97,25 @@ class Acc_Plan_MTable extends Manage_Table_SQL
             elseif ($v == "fiche_qcode") {
                 $count=$this->table->cn->get_value("select count(*) from 
fiche_detail where ad_id=5 and ad_value=$1",array($p_row['pcm_val']));
                if ($count ==  0) echo td("");
-               elseif ($count == 1 ) { echo td($p_row[$v]) ; }
-               elseif ($count > 1) { echo td($p_row[$v] . " ($count) ");} 
+               elseif ($count == 1 ) { 
+                   echo '<td>';
+                   echo HtmlInput::card_detail($p_row[$v]) ; 
+                   echo '</td>';
+               
+               }
+               elseif ($count > 1) { 
+                   echo '<td>';
+                   $a_code=explode(",",$p_row[$v]);
+                   $nb_code=count($a_code);
+                   for ($xx = 0;$xx < $nb_code;$xx++)
+                   {
+                       echo HtmlInput::card_detail($a_code[$xx]) ; 
+                   }
+                   echo  " ($count) ";
+                   echo Icon_Action::detail(uniqid(), 
sprintf("display_all_card('%s','%s')",$dossier_id,$p_row["pcm_val"]));
+                   echo '</td>';
+                   
+               } 
             }
             elseif ($v=="pcm_lib")
             {
@@ -160,6 +177,16 @@ class Acc_Plan_MTable extends Manage_Table_SQL
         return true;
     }
     
-   
+    /**
+     * @brief display into a dialog box the datarow in order 
+     * to be appended or modified. Can be override if you need
+     * a more complex form
+     */
+    function input()
+    {
+        parent::input();
+        $dossier_id=Dossier::id();
+        echo HtmlInput::button_action(_("Toutes les fiches") , 
sprintf("display_all_card('%s','%s')",$dossier_id,$this->table->pcm_val));
+    }
     
 }
diff --git a/include/lib/icon_action.class.php 
b/include/lib/icon_action.class.php
index ad9a30b..8d31bc8 100644
--- a/include/lib/icon_action.class.php
+++ b/include/lib/icon_action.class.php
@@ -229,4 +229,18 @@ class Icon_Action
         
         return $r;
     }
+    static function detail($p_id,$p_javascript)
+    {
+        $r=sprintf('<span id="%s" onclick="%s" class="smallicon icon" 
style="margin-left:5px">&#xe803;</span>',
+                $p_id,
+                $p_javascript);
+        return $r;
+    }
+    static function more($p_id,$p_javascript)
+    {
+        $r=sprintf('<span id="%s" onclick="%s" class="smallicon icon" 
style="margin-left:5px">...</span>',
+                $p_id,
+                $p_javascript);
+        return $r;
+    }
 }
diff --git a/include/template/account_result.php 
b/include/template/account_result.php
index d196bd5..550535c 100644
--- a/include/template/account_result.php
+++ b/include/template/account_result.php
@@ -42,7 +42,7 @@
                                $sep=" , ";
                        }
                        if ($max < count($det_qcode)) {
-                               echo "...";
+                            echo Icon_Action::detail(uniqid(), 
sprintf("display_all_card('%s','%s')",$dossier_id,$array[$i]['pcm_val']));
                        }
                } else {
                        echo HtmlInput::card_detail($array[$i]['acode']);



reply via email to

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