phpcompta-dev
[Top][All Lists]
Advanced

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

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


From: phpcompta-dev
Subject: [Phpcompta-dev] r602 - trunk/rapport_avance/include
Date: Mon, 9 Dec 2013 14:57:40 +0100 (CET)

Author: danydb
Date: 2013-12-09 14:57:40 +0100 (Mon, 09 Dec 2013)
New Revision: 602

Modified:
   trunk/rapport_avance/include/class_rapav_listing_formula.php
   trunk/rapport_avance/include/declaration.inc.php
Log:
Task #0000937: Listing : filtre sur op?\195?\169ration
Doit encore ?\195?\170tre test?\195?\169
Task #937 - Listing : filtre sur op?\195?\169ration

Modified: trunk/rapport_avance/include/class_rapav_listing_formula.php
===================================================================
--- trunk/rapport_avance/include/class_rapav_listing_formula.php        
2013-12-08 20:45:04 UTC (rev 601)
+++ trunk/rapport_avance/include/class_rapav_listing_formula.php        
2013-12-09 13:57:40 UTC (rev 602)
@@ -283,6 +283,25 @@
     {
         global $cn;
         $sql = "";
+        switch ($this->type_operation)
+        {
+            case 0:
+                /*--all operation --*/
+                $sql_filter_operation="";
+                break;
+            case '1':
+                /* -- only paid --*/
+                $sql_filter_operation=" and j_id in (select j_id from jrnx 
join 
+                    jrn on (j_grpt=jr_grpt_id) where jr_rapt='Y')";
+                break;
+            case '2':
+                /*-- only unpaid --*/
+                $sql_filter_operation=" and j_id in (select j_id from jrnx 
join 
+                    jrn on (j_grpt=jr_grpt_id) 
+                    join jrn_def on (jrn_def_id=jr_def_id)
+                    where coalesce(jr_rapt,'')='' and jrn_def_type in 
('ACH','VEN'))";
+                break;
+        }
         if ($this->data->jrn_def_id != null)
         {
             $sql = ' and j_jrn_def =' . $this->data->jrn_def_id;
@@ -299,7 +318,7 @@
             $p_start = '01.01.1900';
             $p_end = '01.01.2100';
         }
-
+        $sql.=$sql_filter_operation;
         $amount = Impress::parse_formula($cn, "", $this->data->fp_formula, 
$p_start, $p_end, true, 1, $sql);
         $this->detail->ld_value_numeric = $amount['montant'];
     }
@@ -428,6 +447,7 @@
                                 ', array($this->detail->lc_id, 
$search,$this->fiche->f_id));
             $formula = str_replace($piece, $value, $formula);
         }
+        /** Protect against division by zero */
         if ( strpos("1".$formula,"/0.0000") != 0)
         {
             $amount=0;
@@ -553,6 +573,25 @@
 
         $sql_date = RAPAV::get_sql_date($this->data->date_paid);
         $card_saldo = ($this->data->lp_card_saldo == 0) ? "jrn1" : "jrn2";
+         switch ($this->type_operation)
+        {
+            case 0:
+                /*--all operation --*/
+                $sql_filter_operation="";
+                break;
+            case '1':
+                /* -- only paid --*/
+                $sql_filter_operation=" and $card_saldo.j_id in (select j_id 
from jrnx join 
+                    jrn on (j_grpt=jr_grpt_id) where jr_rapt='Y')";
+                break;
+            case '2':
+                /*-- only unpaid --*/
+                $sql_filter_operation=" and $card_saldo.j_id in (select j_id 
from jrnx join 
+                    jrn on (j_grpt=jr_grpt_id) 
+                    join jrn_def on (jrn_def_id=jr_def_id)
+                    where coalesce(jr_rapt,'')='' and jrn_def_type in 
('ACH','VEN'))";
+                break;
+        }
         bcscale(2);
         switch ($this->data->type_sum_account)
         {
@@ -572,7 +611,7 @@
                                 and
                                 jrn2.f_id = $4
                                 $filter_ledger
-                                    
+                                $sql_filter_operation    
                                 ) as tv_amount
                                                         ";
                 $amount = $cn->get_value($sql, array(
@@ -601,6 +640,7 @@
                                 and
                                 $card_saldo.j_debit='t'
                                 $filter_ledger
+                                $sql_filter_operation
                                 ) as tv_amount
                                                         ";
                 $amount = $cn->get_value($sql, array(
@@ -626,6 +666,7 @@
                                 and
                                 $card_saldo.j_debit='f'
                                 $filter_ledger
+                                $sql_filter_operation
                                 ) as tv_amount
                                                         ";
                 $amount = $cn->get_value($sql, array(

Modified: trunk/rapport_avance/include/declaration.inc.php
===================================================================
--- trunk/rapport_avance/include/declaration.inc.php    2013-12-08 20:45:04 UTC 
(rev 601)
+++ trunk/rapport_avance/include/declaration.inc.php    2013-12-09 13:57:40 UTC 
(rev 602)
@@ -91,6 +91,11 @@
 {
     $listing=new RAPAV_Listing_Compute();
     $listing->keep($_POST['lc_id']);
+    
+    if ($listing->has_template() == true) {
+        $listing->generate_doc();
+    }
+    
     $listing->display();
     exit();
 }



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