noalyss-commit
[Top][All Lists]
Advanced

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

[Noalyss-commit] [noalyss] 02/19: Fix : France saldo until end of exerci


From: dwm
Subject: [Noalyss-commit] [noalyss] 02/19: Fix : France saldo until end of exercice in Gestion
Date: Wed, 25 Sep 2024 06:45:02 -0400 (EDT)

sparkyx pushed a commit to branch unstable
in repository noalyss.

commit c1fa5a9fa41cf4566eb6cc3200935f95c72c2caf
Author: sparkyx <danydb@noalyss.eu>
AuthorDate: Fri Sep 20 19:06:27 2024 +0200

    Fix : France saldo until end of exercice in Gestion
---
 include/class/fiche.class.php   |  9 +++------
 include/class/periode.class.php | 23 ++++++++++++-----------
 2 files changed, 15 insertions(+), 17 deletions(-)

diff --git a/include/class/fiche.class.php b/include/class/fiche.class.php
index e8a314a84..401763c11 100644
--- a/include/class/fiche.class.php
+++ b/include/class/fiche.class.php
@@ -1339,11 +1339,6 @@ class Fiche
         // set a filter ?
         $search=$p_sql;
 
-        $exercice=$g_user->get_exercice();
-        $tPeriode=new Periode($this->cn);
-        list($max,$min)=$tPeriode->get_limit($exercice);
-
-
         if ( noalyss_trim($p_search) != "" )
         {
             $search.=" and f_id in
@@ -1380,7 +1375,9 @@ class Fiche
 
              /* Filter on the default year */
             if ( $g_parameter->MY_REPORT == 'N') {
-                $amount = $tiers->get_solde_detail();
+                list($l_from,$l_to)=(new 
Periode($this->cn))->get_limit($g_user->get_exercice());
+                $condition = sprintf ("  j_date <= to_date('%s','DD.MM.YYYY')  
",                                $l_to->last_day());
+                $amount = $tiers->get_solde_detail($condition);
             } else {
                 $amount=$tiers->get_solde_detail($filter_year);
             }
diff --git a/include/class/periode.class.php b/include/class/periode.class.php
index 63ac4de06..dee39238e 100644
--- a/include/class/periode.class.php
+++ b/include/class/periode.class.php
@@ -318,28 +318,29 @@ EOF;
         return 0;
     }
 
-    /*!\brief return the max and the min periode of the exercice given
+    /*!
+     * \brief return the max (to periode) and the min periode (from periode) 
of the exercice given
      * in parameter
-     * \param $p_exercice is the exercice
+     * \param $p_exercice is the exercice (parm_periode.p_exercice)
      * \return an array of Periode object
      */
 
     function get_limit($p_exercice)
     {
 
-        $max=$this->cn->get_value("select p_id from parm_periode where 
p_exercice=$1 order by p_start asc limit 1",
+        $from_periode_id=$this->cn->get_value("select p_id from parm_periode 
where p_exercice=$1 order by p_start asc limit 1",
                 array($p_exercice));
-        $min=$this->cn->get_value("select p_id from parm_periode where 
p_exercice=$1 order by p_start desc limit 1",
+        $to_periode_id=$this->cn->get_value("select p_id from parm_periode 
where p_exercice=$1 order by p_start desc limit 1",
                 array($p_exercice));
-        $rMax=new Periode($this->cn);
-        $rMax->p_id=$max;
-        if ($rMax->load() == -1)
+        $periodeFrom=new Periode($this->cn);
+        $periodeFrom->p_id=$from_periode_id;
+        if ($periodeFrom->load() == -1)
             throw new Exception('Periode n\'existe pas');
-        $rMin=new Periode($this->cn);
-        $rMin->p_id=$min;
-        if ($rMin->load() == -1)
+        $periodeTo=new Periode($this->cn);
+        $periodeTo->p_id=$to_periode_id;
+        if ($periodeTo->load() == -1)
             throw new Exception('Periode n\'existe pas');
-        return array($rMax, $rMin);
+        return array($periodeFrom, $periodeTo);
     }
 
     /*!



reply via email to

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