phpcompta-dev
[Top][All Lists]
Advanced

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

[Phpcompta-dev] r4124 - phpcompta/trunk/include


From: phpcompta-dev
Subject: [Phpcompta-dev] r4124 - phpcompta/trunk/include
Date: Tue, 24 May 2011 00:12:27 +0200 (CEST)

Author: danydb
Date: 2011-05-24 00:12:26 +0200 (Tue, 24 May 2011)
New Revision: 4124

Modified:
   phpcompta/trunk/include/class_acc_account_ledger.php
   phpcompta/trunk/include/export_gl_csv.php
   phpcompta/trunk/include/export_gl_pdf.php
   phpcompta/trunk/include/impress_gl_comptes.inc.php
Log:
Add filter on account and letter to the GrandLivre (TBT)

Modified: phpcompta/trunk/include/class_acc_account_ledger.php
===================================================================
--- phpcompta/trunk/include/class_acc_account_ledger.php        2011-05-23 
18:35:42 UTC (rev 4123)
+++ phpcompta/trunk/include/class_acc_account_ledger.php        2011-05-23 
22:12:26 UTC (rev 4124)
@@ -431,6 +431,9 @@
              HtmlInput::submit('bt_other',"Autre poste").
              
$hid->input("type","poste").$hid->input('p_action','impress')."</form></TD>";
          }
+
+       $letter=HtmlInput::default_value('letter',0,$_REQUEST);
+
         echo '<TD><form method="GET" ACTION="export.php">'.
         dossier::hidden().
         HtmlInput::submit('bt_pdf',"Export PDF").
@@ -438,8 +441,14 @@
         $hid->input("type","poste").$str_ople.
         $hid->input('p_action','impress').
         $hid->input("from_periode",$_REQUEST['from_periode']).
-        $hid->input("to_periode",$_REQUEST['to_periode']);
+        $hid->input("to_periode",$_REQUEST['to_periode']).
+         $hid->input('from_poste',$_REQUEST['from_poste']).
+         $hid->input('to_poste',$_REQUEST['to_poste']).
+         $hid->input('letter',$letter);
 
+
+
+
         if (isset($_REQUEST['poste_id'])) echo 
$hid->input("poste_id",$_REQUEST['poste_id']);
 
         if (isset($_REQUEST['poste_fille']))
@@ -456,7 +465,11 @@
         $hid->input("type","poste").$str_ople.
         $hid->input('p_action','impress').
         $hid->input("from_periode",$_REQUEST['from_periode']).
-        $hid->input("to_periode",$_REQUEST['to_periode']);
+        $hid->input("to_periode",$_REQUEST['to_periode']).
+         $hid->input('from_poste',$_REQUEST['from_poste']).
+         $hid->input('to_poste',$_REQUEST['to_poste']).
+         $hid->input('letter',$letter);
+
         if (isset($_REQUEST['poste_fille']))
             echo $hid->input('poste_fille','on');
         if (isset($_REQUEST['oper_detail']))

Modified: phpcompta/trunk/include/export_gl_csv.php
===================================================================
--- phpcompta/trunk/include/export_gl_csv.php   2011-05-23 18:35:42 UTC (rev 
4123)
+++ phpcompta/trunk/include/export_gl_csv.php   2011-05-23 22:12:26 UTC (rev 
4124)
@@ -1,5 +1,4 @@
 <?php
-
 /*
  *   This file is part of PhpCompta.
  *
@@ -60,7 +59,27 @@
 }
 else
 {
-    $a_poste=$cn->get_array("select pcm_val from tmp_pcmn order by 
pcm_val::text");
+    if ($from_poste != '') 
+      {
+       $cond_poste = '  where ';
+       $cond_poste .=' pcm_val >= upper 
(\''.Database::escape_string($from_poste).'\')';
+      }
+
+    if ( $to_poste != '')
+      {
+       if  ( $cond_poste == '') 
+         {
+           $cond_poste =  ' where pcm_val <= upper 
(\''.Database::escape_string($from_poste).'\')';
+         }
+       else
+         {
+           $cond_poste.=' and pcm_val <= upper 
(\''.Database::escape_string($from_poste).'\')';
+         }
+      }
+
+    $sql=$sql.$cond_poste.'  order by pcm_val::text';
+    $a_poste=$cn->get_array($sql);
+
 }
 
 if ( count($a_poste) == 0 )

Modified: phpcompta/trunk/include/export_gl_pdf.php
===================================================================
--- phpcompta/trunk/include/export_gl_pdf.php   2011-05-23 18:35:42 UTC (rev 
4123)
+++ phpcompta/trunk/include/export_gl_pdf.php   2011-05-23 22:12:26 UTC (rev 
4124)
@@ -44,13 +44,33 @@
 $User->can_request(IMPBIL,0);
 
 extract($_GET);
+if ($from_poste != '') 
+  {
+    $cond_poste = '  where ';
+    $cond_poste .=' pcm_val >= upper 
(\''.Database::escape_string($from_poste).'\')';
+  }
 
+if ( $to_poste->value != '')
+  {
+    if  ( $cond_poste == '') 
+      {
+       $cond_poste =  ' where pcm_val <= upper 
(\''.Database::escape_string($from_poste).'\')';
+      }
+    else
+      {
+       $cond_poste.=' and pcm_val <= upper 
(\''.Database::escape_string($from_poste).'\')';
+      }
+  }
+
+$sql=$sql.$cond_poste.'  order by pcm_val::text';
+$a_poste=$cn->get_array($sql);
+
 $pdf = new PDF($cn);
 $pdf->setDossierInfo("  Periode : ".$from_periode." - ".$to_periode);
 $pdf->AliasNbPages();
 $pdf->AddPage();
-$a_poste=$cn->get_array("select pcm_val from tmp_pcmn order by pcm_val::text");
 
+
 if ( count($a_poste) == 0 )
 {
     $pdf->Output();
@@ -63,13 +83,15 @@
 $lor    = array( "L"   , "L"        , "L"      , "L"    , "R",   "R"    , "R"  
   , "R"     );
 // Column widths (in mm)
 $width  = array( 13    , 20         , 60       , 15     ,  12     , 20     , 
20      , 20      );
+$l=(isset($_REQUEST['letter']))?1:0;
 
 foreach ($a_poste as $poste)
 {
 
     $Poste=new Acc_Account_Ledger($cn,$poste['pcm_val']);
-    
list($array,$tot_deb,$tot_cred)=$Poste->get_row_date($from_periode,$to_periode);
 
+    
list($array,$tot_deb,$tot_cred)=$Poste->get_row_date($from_periode,$to_periode,$l);
+
     // don't print empty account
     if ( count($array) == 0 )
     {

Modified: phpcompta/trunk/include/impress_gl_comptes.inc.php
===================================================================
--- phpcompta/trunk/include/impress_gl_comptes.inc.php  2011-05-23 18:35:42 UTC 
(rev 4123)
+++ phpcompta/trunk/include/impress_gl_comptes.inc.php  2011-05-23 22:12:26 UTC 
(rev 4124)
@@ -61,6 +61,28 @@
 
$date_to->value=(isset($_REQUEST['to_periode']))?$_REQUEST['to_periode']:$last_day;
 echo td(_('Depuis').$date_from->input());
 echo td(_('Jusque ').$date_to->input());
+
+$letter=new ICheck('letter');
+$letter->selected=(isset($_REQUEST['letter']))?true:false;
+
+$from_poste=new IPoste('from_poste');
+$from_poste->value=HtmlInput::default_value('from_poste','',$_REQUEST);
+
+$to_poste=new IPoste('to_poste');
+$to_poste->value=HtmlInput::default_value('to_poste','',$_REQUEST);
+
+echo '<tr>';
+echo td.(_('Depuis le 
poste')).td($from_poste->input()).td($from_poste->dsp_button());
+echo '</tr>';
+
+echo '<tr>';
+echo td.(_("Jusqu'au 
poste")).td($to_poste->input()).td($to_poste->dsp_button());
+echo '</tr>';
+
+echo '<tr>';
+echo td('Uniquement les comptes non lettrés');
+echo td($letter->input());
+echo '</tr>';
 //
 echo '</TABLE>';
 print HtmlInput::submit('bt_html','Visualisation');
@@ -78,9 +100,30 @@
 {
     require_once("class_acc_account_ledger.php");
     echo Acc_Account_Ledger::HtmlTableHeader("gl_comptes");
+    $sql='select pcm_val from tmp_pcmn ';
+    $cond_poste='';
 
-    $a_poste=$cn->get_array("select pcm_val from tmp_pcmn order by 
pcm_val::text");
+    if ($from_poste->value != '') 
+      {
+       $cond_poste = '  where ';
+       $cond_poste .=' pcm_val >= upper 
(\''.Database::escape_string($from_poste->value).'\')';
+      }
 
+    if ( $to_poste->value != '')
+      {
+       if  ( $cond_poste == '') 
+         {
+           $cond_poste =  ' where pcm_val <= upper 
(\''.Database::escape_string($from_poste->value).'\')';
+         }
+       else
+         {
+           $cond_poste.=' and pcm_val <= upper 
(\''.Database::escape_string($from_poste->value).'\')';
+         }
+      }
+
+    $sql=$sql.$cond_poste.'  order by pcm_val::text';
+    $a_poste=$cn->get_array($sql);
+
     if ( sizeof($a_poste) == 0 )
     {
         die("Nothing here. Strange.");
@@ -100,7 +143,8 @@
     {
         $Poste=new Acc_Account_Ledger ($cn, $poste_id['pcm_val']);
         $Poste->load();
-        $Poste->get_row_date( $_GET['from_periode'], $_GET['to_periode']);
+       $l=(isset($_REQUEST['letter']))?1:0;
+        $Poste->get_row_date( $_GET['from_periode'], $_GET['to_periode'],$l);
         if ( empty($Poste->row))
         {
             continue;




reply via email to

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