phpcompta-dev
[Top][All Lists]
Advanced

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

[Phpcompta-dev] r4100 - in phpcompta/trunk: html include


From: phpcompta-dev
Subject: [Phpcompta-dev] r4100 - in phpcompta/trunk: html include
Date: Sat, 14 May 2011 21:17:05 +0200 (CEST)

Author: danydb
Date: 2011-05-14 21:17:04 +0200 (Sat, 14 May 2011)
New Revision: 4100

Added:
   phpcompta/trunk/include/class_anc_acc_link.php
   phpcompta/trunk/include/export_anc_table_csv.php
Modified:
   phpcompta/trunk/html/export.php
   phpcompta/trunk/include/anc_imp.inc.php
   phpcompta/trunk/include/class_anc_table.php
   phpcompta/trunk/include/export_anc_acc_list_csv.php
Log:
Add Anc_Acc_List + export_csv + finish ANC Table

Modified: phpcompta/trunk/html/export.php
===================================================================
--- phpcompta/trunk/html/export.php     2011-05-14 19:00:47 UTC (rev 4099)
+++ phpcompta/trunk/html/export.php     2011-05-14 19:17:04 UTC (rev 4100)
@@ -157,9 +157,14 @@
     exit();
     break;
   case 'CSV/AncTable':
-    require_once('export_table_csv.php');
+    require_once('export_anc_table_csv.php');
     exit();
     break;
+  case 'CSV/AncAccList':
+    require_once('export_anc_acc_list_csv.php');
+    exit();
+    break;
+
    default:
     alert('Action inconnue '.$_GET['act']);
     exit();

Modified: phpcompta/trunk/include/anc_imp.inc.php
===================================================================
--- phpcompta/trunk/include/anc_imp.inc.php     2011-05-14 19:00:47 UTC (rev 
4099)
+++ phpcompta/trunk/include/anc_imp.inc.php     2011-05-14 19:17:04 UTC (rev 
4100)
@@ -37,6 +37,7 @@
             array("?p_action=ca_imp&sub=bs&$str_dossier",_("Balance 
simple"),_("Balance simple d'un plan analytique"),"bs"),
             array("?p_action=ca_imp&sub=bc2&$str_dossier",_("Balance 
croisée"),_("Balance croisée de 2 plans analytiques"),"bc2"),
            
array("?p_action=ca_imp&sub=tab&$str_dossier",_("Tableau"),_("Tableau lié à la 
comptabilité"),'tab'),
+           array("?p_action=ca_imp&sub=lico&$str_dossier",_("Lien 
comptabilité"),_("Lien entre comptabilité et Comptabilité analytique"),'lico'),
            
array("?p_action=ca_imp&sub=groupe&$str_dossier",_("Groupe"),_("Balance par 
groupe"),'gr'),
 
            );
@@ -128,4 +129,25 @@
         echo $tab->show_button($str_hidden);
        $tab->display_html();
     }
-  }
\ No newline at end of file
+  }
+
+//----------------------------------------------------------------------
+//  linked between accountancy and analytic
+//---------------------------------------------------------------------------
+if ( $sub == 'lico')
+  {
+    require_once('class_anc_acc_list.php');
+    $tab=new Anc_Acc_List($cn);
+    $tab->get_request();
+    echo '<form method="get">';
+    echo $tab->display_form($str_hidden);
+    echo '<p>'.HtmlInput::submit('Recherche','Recherche').'</p>';
+
+    echo '</form>';
+    if ( isset($_GET['result']))
+    {
+        echo $tab->show_button($str_hidden);
+       $tab->display_html();
+    }
+  }
+

Added: phpcompta/trunk/include/class_anc_acc_link.php
===================================================================
--- phpcompta/trunk/include/class_anc_acc_link.php                              
(rev 0)
+++ phpcompta/trunk/include/class_anc_acc_link.php      2011-05-14 19:17:04 UTC 
(rev 4100)
@@ -0,0 +1,62 @@
+<?php
+/*
+ *   This file is part of PhpCompta.
+ *
+ *   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
+*/
+/* $Revision$ */
+
+// Copyright Author Dany De Bontridder address@hidden
+
+/*!\file
+ * \brief link between accountancy and analytic, like table but as a listing
+ */
+require_once('class_anc_print.php');
+
+class Anc_Acc_Link extends Anc_Print
+{
+  function __contruct($p_cn)
+  {
+    $this->cn=$p_cn;
+  }
+  
+  /**
+   address@hidden get the parameters
+   */
+  function get_request()
+  {
+    parent::get_request();
+    $this->card_poste=HtmlInput::default_value('card_poste',1,$_GET);
+  }
+    function set_sql_filter()
+    {
+        $sql="";
+        $and=" and ";
+        if ( $this->from != "" )
+        {
+            $sql.="$and oa_date >= to_date('".$this->from."','DD.MM.YYYY')";
+        }
+        if ( $this->to != "" )
+        {
+            $sql.=" $and oa_date <= to_date('".$this->to."','DD.MM.YYYY')";
+        }
+
+        return $sql;
+
+    }
+
+
+}
+

Modified: phpcompta/trunk/include/class_anc_table.php
===================================================================
--- phpcompta/trunk/include/class_anc_table.php 2011-05-14 19:00:47 UTC (rev 
4099)
+++ phpcompta/trunk/include/class_anc_table.php 2011-05-14 19:17:04 UTC (rev 
4100)
@@ -23,23 +23,11 @@
 /*!\file
  * \brief object to show a table: link between accountancy and analytic
  */
-require_once('class_anc_print.php');
+require_once('class_anc_acc_link.php');
 
-class Anc_Table extends Anc_Print
+class Anc_Table extends Anc_Acc_Link
 {
-  function __contruct($p_cn)
-  {
-    $this->cn=$p_cn;
-  }
   /**
-   address@hidden get the parameters
-   */
-  function get_request()
-  {
-    parent::get_request();
-    $this->card_poste=HtmlInput::default_value('card_poste',1,$_GET);
-  }
-  /**
    address@hidden display form to get the parameter 
    *  - card_poste 1 by card, 2 by account
    *  - from_poste 
@@ -61,60 +49,46 @@
     $r.=$icard->input();
     return $r;
   }
+
+
   /**
    * load the data
    * does not return anything but give a value to this->aheader and this->arow
    */
-  function load_card()
+  function load_poste()
   {
     $date=$this->set_sql_filter();
     $date=($date != '')?"  $date":'';
     $sql_from_poste=($this->from_poste!='')?" and  po.po_name >= 
upper('".Database::escape_string($this->from_poste)."')":'';
     $sql_to_poste=($this->to_poste!='')?" and  po.po_name <= 
upper('".Database::escape_string($this->to_poste)."')":'';
 
-    $header="select distinct po_id,po_name from v_table_analytic_card  where
+    $header="select distinct po_id,po_name from v_table_analytic_account where
                pa_id=$1 ".$date.$sql_from_poste.$sql_to_poste." order by 
po_name";
     $this->aheader=$this->db->get_array($header,array($this->pa_id));
     
-    $this->arow=$this->db->get_array("select distinct f_id,j_qcode,name from 
v_table_analytic_card  where
-               pa_id=$1 ".$date.$sql_from_poste.$sql_to_poste." order by 
name",array($this->pa_id));
-    $this->sql='select sum_amount from v_table_analytic_card where f_id=$1 and 
po_id=$2 and pa_id='.$this->pa_id.' '.$date.$sql_from_poste.$sql_to_poste;
+    $this->arow=$this->db->get_array("select distinct j_poste,name from 
v_table_analytic_account  where
+               pa_id=$1 ".$date.$sql_from_poste.$sql_to_poste." order by 
j_poste",array($this->pa_id));
+    $this->sql='select sum_amount from v_table_analytic_account where 
j_poste=$1 and po_id=$2 and pa_id='.$this->pa_id.' 
'.$date.$sql_from_poste.$sql_to_poste;
   }
-    function set_sql_filter()
-    {
-        $sql="";
-        $and=" and ";
-        if ( $this->from != "" )
-        {
-            $sql.="$and oa_date >= to_date('".$this->from."','DD.MM.YYYY')";
-        }
-        if ( $this->to != "" )
-        {
-            $sql.=" $and oa_date <= to_date('".$this->to."','DD.MM.YYYY')";
-        }
 
-        return $sql;
-
-    }
-
   /**
    * load the data
    * does not return anything but give a value to this->aheader and this->arow
    */
-  function load_poste()
+  function load_card()
   {
     $date=$this->set_sql_filter();
     $date=($date != '')?"  $date":'';
     $sql_from_poste=($this->from_poste!='')?" and  po.po_name >= 
upper('".Database::escape_string($this->from_poste)."')":'';
     $sql_to_poste=($this->to_poste!='')?" and  po.po_name <= 
upper('".Database::escape_string($this->to_poste)."')":'';
 
-    $header="select distinct po_id,po_name from v_table_analytic_account where
+    $header="select distinct po_id,po_name from v_table_analytic_card  where
                pa_id=$1 ".$date.$sql_from_poste.$sql_to_poste." order by 
po_name";
     $this->aheader=$this->db->get_array($header,array($this->pa_id));
     
-    $this->arow=$this->db->get_array("select distinct j_poste,name from 
v_table_analytic_account  where
-               pa_id=$1 ".$date.$sql_from_poste.$sql_to_poste." order by 
j_poste",array($this->pa_id));
-    $this->sql='select sum_amount from v_table_analytic_account where 
j_poste=$1 and po_id=$2 and pa_id='.$this->pa_id.' 
'.$date.$sql_from_poste.$sql_to_poste;
+    $this->arow=$this->db->get_array("select distinct f_id,j_qcode,name from 
v_table_analytic_card  where
+               pa_id=$1 ".$date.$sql_from_poste.$sql_to_poste." order by 
name",array($this->pa_id));
+    $this->sql='select sum_amount from v_table_analytic_card where f_id=$1 and 
po_id=$2 and pa_id='.$this->pa_id.' '.$date.$sql_from_poste.$sql_to_poste;
   }
   /**
    address@hidden display the button export CSV
@@ -131,6 +105,7 @@
     $r.= HtmlInput::hidden("pa_id",$this->pa_id);
     $r.= HtmlInput::hidden("from_poste",$this->from_poste);
     $r.= HtmlInput::hidden("to_poste",$this->to_poste);
+    $r.= HtmlInput::hidden("card_poste",$this->card_poste);
     $r.= $p_hidden;
     $r.= dossier::hidden();
     $r.=HtmlInput::submit('bt_csv',"Export en CSV");
@@ -264,7 +239,7 @@
          {
            echo ';"'.$h['po_name'].'"';
          }
-       echo ',"Total"';
+       echo ';"Total"';
        printf("\r\n");
        /*
         * Show all the result
@@ -296,6 +271,48 @@
 
          }
       }
+    if ( $this->card_poste=='2')
+      {
+       $this->load_poste();
+
+       echo '"Poste"';
+       foreach ($this->aheader as $h)
+         {
+           echo ';"'.$h['po_name'].'"';
+         }
+       echo ';"Total"';
+       printf("\r\n");
+       /*
+        * Show all the result
+        */
+
+       for ($i=0;$i<count($this->arow);$i++)
+         {
+
+           printf('"%s"',$this->arow[$i]['j_poste'].' 
'.$this->arow[$i]['name']);
+           $tot_row=0;
+           for ($x=0;$x<count($this->aheader);$x++)
+             {
+               
$amount=$this->db->get_value($this->sql,array($this->arow[$i]['j_poste'],$this->aheader[$x]['po_id']));
+               if ($amount==null)$amount=0;
+               if ( isset($tot_col[$x]))
+                 {
+                   $tot_col[$x]=bcadd($tot_col[$x],$amount);
+                 }
+               else
+                 {
+                   $tot_col[$x]=$amount;
+                 }
+               printf(";%s",nb($amount));
+               $tot_row=bcadd($tot_row,$amount);
+             }
+           printf(";%s",nb($tot_row));
+           printf("\r\n");
+                   
+
+         }
+      }
    
   }
+
 }
\ No newline at end of file

Modified: phpcompta/trunk/include/export_anc_acc_list_csv.php
===================================================================
--- phpcompta/trunk/include/export_anc_acc_list_csv.php 2011-05-14 19:00:47 UTC 
(rev 4099)
+++ phpcompta/trunk/include/export_anc_acc_list_csv.php 2011-05-14 19:17:04 UTC 
(rev 4100)
@@ -21,17 +21,16 @@
 // Copyright Author Dany De Bontridder address@hidden
 
 /*!\file
-* \brief  export the operation in pdf
+* \brief  export analytic list in csv
  *
  */
 header('Pragma: public');
 header('Content-type: application/csv');
-header('Content-Disposition: attachment;filename="jrn.csv"',FALSE);
+header('Content-Disposition: attachment;filename="export-anc-list.csv"',FALSE);
 
-require_once ('class_anc_listing.php');
+require_once ('class_anc_acc_list.php');
 
-$cn=new Database(dossier::id());
 
-$bal=new Anc_Listing($cn);
+$bal=new Anc_Acc_List($cn);
 $bal->get_request();
-echo $bal->display_csv();
+echo $bal->export_csv();

Added: phpcompta/trunk/include/export_anc_table_csv.php
===================================================================
--- phpcompta/trunk/include/export_anc_table_csv.php                            
(rev 0)
+++ phpcompta/trunk/include/export_anc_table_csv.php    2011-05-14 19:17:04 UTC 
(rev 4100)
@@ -0,0 +1,34 @@
+<?php
+/*
+ *   This file is part of PhpCompta.
+ *
+ *   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
+*/
+/* $Revision$ */
+
+// Copyright Author Dany De Bontridder address@hidden
+
+/*!\file
+ * \brief export the anc tables in CSV
+ */
+
+header('Pragma: public');
+header('Content-type: application/csv');
+header('Content-Disposition: 
attachment;filename="anc-table-export.csv"',FALSE);
+
+require_once('class_anc_table.php');
+$atable=new Anc_Table($cn);
+$atable->get_request();
+$atable->export_csv();
\ No newline at end of file




reply via email to

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