phpcompta-dev
[Top][All Lists]
Advanced

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

[Phpcompta-dev] r599 - trunk/rapport_avance/include


From: phpcompta-dev
Subject: [Phpcompta-dev] r599 - trunk/rapport_avance/include
Date: Tue, 3 Dec 2013 21:40:13 +0100 (CET)

Author: danydb
Date: 2013-12-03 21:40:13 +0100 (Tue, 03 Dec 2013)
New Revision: 599

Modified:
   trunk/rapport_avance/include/class_rapav_listing_compute.php
   trunk/rapport_avance/include/class_rapav_listing_formula.php
Log:
Fix some bugs

Modified: trunk/rapport_avance/include/class_rapav_listing_compute.php
===================================================================
--- trunk/rapport_avance/include/class_rapav_listing_compute.php        
2013-12-03 20:39:47 UTC (rev 598)
+++ trunk/rapport_avance/include/class_rapav_listing_compute.php        
2013-12-03 20:40:13 UTC (rev 599)
@@ -67,7 +67,14 @@
         $nb_fiche = count($a_fiche);
         for ($e = 0; $e < $nb_fiche; $e++)
         {
-
+            /*
+             * save a listing_compute_fiche
+             */
+            $fiche=new RAPAV_Listing_Compute_Fiche_SQL();
+            $fiche->f_id=$a_fiche[$e]['f_id'];
+            $this->lc_id = $this->data->lc_id;
+            $fiche->insert();
+            
             $a_later = array();
             for ($i = 0; $i < $nb; $i++)
             {
@@ -75,8 +82,8 @@
                 // Rapav_Formula_Compute or Rapav_Formula_Formula,
                 unset($compute);
                 $compute = 
RAPAV_Listing_Formula::make_object($a_code[$i]->Param);
-                $compute->set_fiche($a_fiche[$e]['f_id']);
-
+                $compute->fiche=$fiche;
+                
                 if ($compute->sig == 'COMP')
                 {
                     $a_later[] = clone $compute;
@@ -84,16 +91,8 @@
                 {
                     $compute->set_listing_compute($this->data->lc_id);
                     $compute->filter_operation($this->type_operation);
-
-                    if ($i == 0)
-                    {
-                        $compute->save_fiche();
-                        $fiche = $compute->fiche;
-                    } 
-                    else
-                    {
-                        $compute->fiche=$fiche;
-                    }
+                    
+                    
                     //compute
                     $compute->compute($p_date_start, $p_date_end);
                     // save computed
@@ -107,17 +106,7 @@
              */
             for ($i = 0; $i < $nb_later; $i++)
             {
-                $a_later[$i]->set_fiche($a_fiche[$e]['f_id']);
                 $compute->set_listing_compute($this->data->lc_id);
-                if ($i == 0)
-                {
-                    $a_later[$i]->save_fiche();
-                    $fiche=$a_later[$i]->fiche;
-                }
-                else
-                {
-                    $a_later[$i]=$fiche;
-                }
                 $a_later[$i]->compute($p_date_start, $p_date_end);
                 $a_later[$i]->save_computed();
             }

Modified: trunk/rapport_avance/include/class_rapav_listing_formula.php
===================================================================
--- trunk/rapport_avance/include/class_rapav_listing_formula.php        
2013-12-03 20:39:47 UTC (rev 598)
+++ trunk/rapport_avance/include/class_rapav_listing_formula.php        
2013-12-03 20:40:13 UTC (rev 599)
@@ -417,8 +417,15 @@
             $search = str_replace('[', '', $piece);
             $search = str_replace(']', '', $search);
             $value = $cn->get_value('select coalesce(sum(ld_value_numeric),0) 
as value
-                               from rapport_advanced.listing_compute_detail 
where lc_id=$1 and lp_id in (select lp_id from 
-                                rapport_advanced.listing_param where 
lp_code=$2)', array($this->detail->lc_id, $search));
+                               from 
+                                    rapport_advanced.listing_compute_detail as 
ld
+                                    join 
rapport_advanced.listing_compute_fiche as lf on (ld.lf_id=lf.lf_id) 
+                                    join rapport_advanced.listing_param  as lp 
on (ld.lp_id=lp.lp_id) 
+                                where 
+                                ld.lc_id=$1 
+                                and lp.lp_code=$2
+                                and lf.f_id = $3
+                                ', array($this->detail->lc_id, 
$search,$this->fiche->f_id));
             $formula = str_replace($piece, $value, $formula);
         }
         eval('$amount = ' . $formula . ';');



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