phpcompta-dev
[Top][All Lists]
Advanced

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

[Phpcompta-dev] r4380 - in phpcompta/trunk: include sql


From: phpcompta-dev
Subject: [Phpcompta-dev] r4380 - in phpcompta/trunk: include sql
Date: Thu, 17 Nov 2011 21:28:21 +0100 (CET)

Author: danydb
Date: 2011-11-17 21:28:19 +0100 (Thu, 17 Nov 2011)
New Revision: 4380

Modified:
   phpcompta/trunk/include/anc_great_ledger.inc.php
   phpcompta/trunk/include/class_anc_grandlivre.php
   phpcompta/trunk/include/class_impress.php
   phpcompta/trunk/sql/
   phpcompta/trunk/sql/anc-grandlivre.sql
   phpcompta/trunk/sql/upgrade.sql
Log:
expprt GrandLivre Analytique

Modified: phpcompta/trunk/include/anc_great_ledger.inc.php
===================================================================
--- phpcompta/trunk/include/anc_great_ledger.inc.php    2011-11-17 14:50:20 UTC 
(rev 4379)
+++ phpcompta/trunk/include/anc_great_ledger.inc.php    2011-11-17 20:28:19 UTC 
(rev 4380)
@@ -9,8 +9,8 @@
 echo '</form>';
 if (isset($_GET['result']))
 {
-    echo $gl->display_button();
+    echo $gl->show_button();
     echo $gl->display_html();
-    echo $gl->display_button();
+    echo $gl->show_button();
 }
 ?>

Modified: phpcompta/trunk/include/class_anc_grandlivre.php
===================================================================
--- phpcompta/trunk/include/class_anc_grandlivre.php    2011-11-17 14:50:20 UTC 
(rev 4379)
+++ phpcompta/trunk/include/class_anc_grandlivre.php    2011-11-17 20:28:19 UTC 
(rev 4380)
@@ -44,7 +44,7 @@
         $pa_id_cond="";
         if ( isset ( $this->pa_id) && $this->pa_id !='')
             $pa_id_cond= "pa_id=".$this->pa_id." and";
-        $array=$this->db->get_array("  select oa_id,   
+        $array=$this->db->get_array("  select oa_id,
        po_name,
        oa_description,
        po_description,
@@ -52,22 +52,53 @@
        to_char(oa_date,'DD.MM.YYYY') as oa_date,
        oa_amount,
        oa_group,
-       j_id , 
-       jr_internal,  
-       jr_id, 
+       j_id ,
+       jr_internal,
+       jr_id,
        jr_comment,
        j_poste,
        jrnx.f_id,
        ( select ad_value from fiche_Detail where f_id=jrnx.f_id and ad_id=23) 
as qcode
-       from operation_analytique as B join poste_analytique using(po_id) 
+       from operation_analytique as B join poste_analytique using(po_id)
        left join jrnx using (j_id)
        left join jrn on  (j_grpt=jr_grpt_id)
              where $pa_id_cond oa_amount <> 0.0  $cond_poste
        order by po_name,oa_date ,qcode,j_poste");
-        
-       
+
+
         return $array;
     }
+
+       function load_csv()
+    {
+      $filter_date=$this->set_sql_filter();
+      $cond_poste='';
+      if ($this->from_poste != "" )
+            $cond_poste=" and upper(po_name) >= 
upper('".$this->from_poste."')";
+        if ($this->to_poste != "" )
+            $cond_poste.=" and upper(po_name) <= upper('".$this->to_poste."')";
+        $pa_id_cond="";
+        if ( isset ( $this->pa_id) && $this->pa_id !='')
+            $pa_id_cond= "pa_id=".$this->pa_id." and";
+        $array=$this->db->get_array("  select
+       po_name,
+       to_char(oa_date,'DD.MM.YYYY') as oa_date,
+       j_poste,
+       ( select ad_value from fiche_Detail where f_id=jrnx.f_id and ad_id=23) 
as qcode,
+       jr_comment,
+       jr_internal,
+       case when oa_debit='t' then 'D' else 'C' end,
+       oa_amount
+       from operation_analytique as B join poste_analytique using(po_id)
+       left join jrnx using (j_id)
+       left join jrn on  (j_grpt=jr_grpt_id)
+             where $pa_id_cond oa_amount <> 0.0  $cond_poste
+       order by po_name,oa_date ,qcode,j_poste");
+
+
+        return $array;
+    }
+
    /*!
      * \brief compute the html display
      *
@@ -120,7 +151,7 @@
              $prev=$row['po_name'];
              $ix++;
            }
-             
+
             $r.= '<tr>';
            $detail=($row['jr_id'] != 
null)?HtmlInput::detail_op($row['jr_id'],$row['jr_internal']):'';
            $post_detail=($row['j_poste'] != 
null)?HtmlInput::history_account($row['j_poste'],$row['j_poste']):'';
@@ -192,7 +223,7 @@
     {
         $r="";
         //---Html
-        $array=$this->load();
+        $array=$this->load_csv();
         if ( is_array($array) == false )
         {
             return $array;
@@ -208,13 +239,14 @@
         $ix=0;$prev='xx';
        $tot_deb=$tot_cred=0;
         $aheader=array();
-        $aheader=array("title"=>'Date','type'=>'string');
-        $aheader=array("title"=>'Poste','type'=>'string');
-        $aheader=array("title"=>'Quick_Code','type'=>'string');
-        $aheader=array("title"=>'libelle','type'=>'string');
-        $aheader=array("title"=>'Num.interne','type'=>'string');
-        $aheader=array("title"=>'Debit','type'=>'num');
-        $aheader=array("title"=>'Credit','type'=>'num');
+        $aheader[]=array("title"=>'Imp. Analytique','type'=>'string');
+        $aheader[]=array("title"=>'Date','type'=>'string');
+        $aheader[]=array("title"=>'Poste','type'=>'string');
+        $aheader[]=array("title"=>'Quick_Code','type'=>'string');
+        $aheader[]=array("title"=>'libelle','type'=>'string');
+        $aheader[]=array("title"=>'Num.interne','type'=>'string');
+        $aheader[]=array("title"=>'Debit','type'=>'string');
+        $aheader[]=array("title"=>'Credit','type'=>'num');
         Impress::array_to_csv($array, $aheader);
     }
 }
\ No newline at end of file

Modified: phpcompta/trunk/include/class_impress.php
===================================================================
--- phpcompta/trunk/include/class_impress.php   2011-11-17 14:50:20 UTC (rev 
4379)
+++ phpcompta/trunk/include/class_impress.php   2011-11-17 20:28:19 UTC (rev 
4380)
@@ -29,7 +29,7 @@
 class Impress
 {
     /*! \brief   Purpose Parse a formula
-     * 
+     *
      * \param $p_cn connexion
      * \param $p_label
      * \param $p_formula
@@ -233,39 +233,47 @@
      * with the handle of a successull query, echo each row into CSV and
      * send it directly
      * @param type $array of data
-     * @param type $aheader  double array, each item of the array contains 
+     * @param type $aheader  double array, each item of the array contains
      * a key type (num) and a key title
      */
     static function array_to_csv($array,$aheader)
     {
         $seq="";
-        for ($i=0;$i<count($i);$i++)
+        for ($i=0;$i<count($aheader);$i++)
         {
-            echo '"'.$aheader[$i]['title'].'"';
+            echo $seq.'"'.$aheader[$i]['title'].'"';
             $seq=";";
         }
-        printf("\n\r");
-        
+        printf("\r");
+
         $seq="";
         // fetch all the rows
         for ($i=0;$i<count($array);$i++)
         {
             $row=$array[$i];
             $sep2="";
+                       $e=0;
             // for each rows, for each value
-            for ($e=0;$e<count($row);$e++)
+            foreach ($array[$i] as $key=>$value)
             {
-                switch ($aheader[$e]['type'])
-                {
-                    case 'num':
-                        echo nb($row[$e]).$sep2;
-                        break;
-                    default:
-                        echo '"'.$row[$e].'"'.$sep2;
-                }
-                $sep2=";";
+                               if ($e > count($aheader)) $e=0;
+
+                               if ( isset ($aheader[$e]['type']))
+                               {
+                                       switch ($aheader[$e]['type'])
+                                       {
+                                               case 'num':
+                                                       echo $sep2.nb($value);
+                                                       break;
+                                               default:
+                                                       echo 
$sep2.'"'.$value.'"';
+                                       }
+                               } else {
+                                       echo '"'.$value.'"'.$sep2;
+                               }
+                $sep2=";";$e++;
             }
-            printf("\n\r");
+            printf("\r");
         }
     }
 }
\ No newline at end of file


Property changes on: phpcompta/trunk/sql
___________________________________________________________________
Name: svn:ignore
   - .upgrade.sql.swp
.object-6.0.sql.swp
.backup-new-object.sh.swp
.mode_paiement.sql.swp

   + .upgrade.sql.swp
.object-6.0.sql.swp
.backup-new-object.sh.swp
.mode_paiement.sql.swp
.anc-grandlivre.sql.swp


Modified: phpcompta/trunk/sql/anc-grandlivre.sql
===================================================================
--- phpcompta/trunk/sql/anc-grandlivre.sql      2011-11-17 14:50:20 UTC (rev 
4379)
+++ phpcompta/trunk/sql/anc-grandlivre.sql      2011-11-17 20:28:19 UTC (rev 
4380)
@@ -1,15 +1,6 @@
 insert into menu_ref(me_code,me_menu,me_file,me_description,me_type) 
 values ('CSV:AncGrandLivre','Impression Grand-Livre',null,null,'PR');
-CREATE TABLE profile_menu (
-    pm_id integer NOT NULL,
-    me_code text,
-    me_code_dep text,
-    p_id integer,
-    p_order integer,
-    p_type_display text NOT NULL,
-    pm_default integer
-);
 
-insert into profile_menu(me_code,me_code_dep,p_id,pm_default)
+insert into profile_menu(me_code,me_code_dep,p_id,p_type_display,pm_default)
 values ( 'CSV:AncGrandLivre', NULL, 1 , 'P', 0);
 

Modified: phpcompta/trunk/sql/upgrade.sql
===================================================================
--- phpcompta/trunk/sql/upgrade.sql     2011-11-17 14:50:20 UTC (rev 4379)
+++ phpcompta/trunk/sql/upgrade.sql     2011-11-17 20:28:19 UTC (rev 4380)
@@ -29,8 +29,8 @@
 
 \i mode_paiement.sql
 \i anc-modularity-imp.sql
+\i anc-grandlivre.sql
 
-
 create unique index qcode_idx on fiche_detail (ad_value) where ad_id=23;
 
 




reply via email to

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