/[phpcompta]/phpcompta/include/impress_fiche.php
ViewVC logotype

Diff of /phpcompta/include/impress_fiche.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.4 by sparkyx, Sun Feb 27 14:24:30 2005 UTC revision 1.5 by sparkyx, Wed Jul 27 11:15:09 2005 UTC
# Line 24  include_once('class_fiche.php'); Line 24  include_once('class_fiche.php');
24  include_once("class_widget.php");  include_once("class_widget.php");
25    
26  $cn=DbConnect($_SESSION['g_dossier']);  $cn=DbConnect($_SESSION['g_dossier']);
 $fiche_def=new fiche_def($cn);  
27    
   
 $fiche_def->GetAll();  
   
 $i=0;  
 foreach ($fiche_def->all as $l_fiche) {  
   $a[$i]=array("user_impress.php?type=fiche&fd_id=".$l_fiche->id,$l_fiche->label);  
   $i++;  
 }  
 echo ShowItem($a,'V');  
28  ////////////////////////////////////////////////////////////////////////////////  ////////////////////////////////////////////////////////////////////////////////
29  if  ( isset ($_GET['fd_id'])) {  if  ( isset ($_REQUEST['fd_id'])) {
30    echo '<div class="u_redcontent">';    // if amount requested
31      $with_amount= (isset($_REQUEST['with_amount']))?true:false;
32      if ($with_amount)
33        include_once("class_poste.php");
34      //echo '<div class="redcontent">';
35      echo "<div>";
36    $submit=new widget();    $submit=new widget();
37    $hid=new widget("hidden");    $hid=new widget("hidden");
38    $fiche_id=new widget("hidden");    $fiche_id=new widget("hidden");
39        $w=new widget("select");
40      $fiche_def=new fiche_def($cn);
41    
42    echo '<form method="POST" ACTION="fiche_csv.php">'.    echo '<form method="POST" ACTION="fiche_csv.php">'.
43      $submit->Submit('bt_csv',"Export CSV").      $submit->Submit('bt_csv',"Export CSV").
44      $hid->IOValue("type","fiche").      $hid->IOValue("type","fiche").
45      $fiche_id->IOValue("fd_id",$_GET['fd_id']);      $fiche_id->IOValue("fd_id",$_REQUEST['fd_id']);
46      if ($with_amount) {
47        echo $hid->IOValue("with_amount");
48        echo $hid->IOValue("from_periode",$_REQUEST['from_periode']);
49        echo $hid->IOValue("to_periode",$_REQUEST['to_periode']);
50      }
51      echo "</form>";
52      echo '<form method="Post" action="?type=fiche">'.$submit->Submit("bt_submit","Autres fiches")."</form>";
53      
54      $fiche_def->id=$_REQUEST['fd_id'];
55    
56      // Si les fiches ont un poste comptable
57      // propose de calculer aussi le solde
58      //--
59      if ( $fiche_def->HasAttribute(ATTR_DEF_ACCOUNT) == true ) {
60        echo '<form method="POST" ACTION="user_impress.php">';
61        $periode_start=make_array($cn,"select p_id,to_char(p_start,'DD-MM-YYYY') from parm_periode order by p_id");
62        
63        $w->selected=(isset($_POST['from_periode']))?$_POST['from_periode']:"";
64        print "Depuis ".$w->IOValue('from_periode',$periode_start);
65        $periode_end=make_array($cn,"select p_id,to_char(p_end,'DD-MM-YYYY') from parm_periode order by p_id");
66        $w->selected=(isset($_POST['to_periode']))?$_POST['to_periode']:"";
67        print " Jusque ".$w->IOValue('to_periode',$periode_end);
68        
69    
70        print $submit->Submit('bt_solde',"Avec solde").
71        $hid->IOValue("type","fiche").
72        $fiche_id->IOValue("fd_id",$_REQUEST['fd_id']).
73          $hid->IOValue("with_amount");
74      
75    echo "</form>";    echo "</form>";
76      }
77        
   $fiche_def->id=$_GET['fd_id'];  
78    $fiche=new fiche($cn);    $fiche=new fiche($cn);
79    $e=$fiche->GetByType($fiche_def->id);    $e=$fiche->GetByType($fiche_def->id);
80    $l=var_export($e,true);    $l=var_export($e,true);
81    echo_debug(__FILE__,__LINE__,$l);    echo_debug(__FILE__,__LINE__,$l);
82    $old=-1;    $old=-1;
83    echo "<TABLE>";    echo "<TABLE class=\"result\">";
84    echo "<TR>";    echo "<TR>";
85    $fiche_def->GetAttribut();    $fiche_def->GetAttribut();
86    foreach ($fiche_def->attribut as $attribut)    foreach ($fiche_def->attribut as $attribut) {
87      echo "<TH>".$attribut->ad_text."</TH>";      echo "<TH>".$attribut->ad_text."</TH>";
88        // si solde demandé affiche la col
89        //--
90        if ($attribut->ad_id==ATTR_DEF_ACCOUNT
91            && $with_amount==true) {
92          echo "<TH  >Débit</TH>";
93          echo "<TH  >Crédit</TH>";
94          echo "<TH  >Solde</TH>";
95        }
96      }
97    
98    echo "<TR></TR>";    echo "<TR></TR>";
99    if ( count($e) != 0 ) {    if ( count($e) != 0 ) {
100      foreach ($e as $detail) {      foreach ($e as $detail) {
101        echo "<TR>";        echo "<TR>";
102        foreach ( $detail->attribut as $dattribut ) {        foreach ( $detail->attribut as $dattribut ) {
103          echo "<TD>".$dattribut->av_text."</TD>";          echo "<TD>".$dattribut->av_text."</TD>";
104            // if amount requested
105            //---
106            if ( $dattribut->ad_id == ATTR_DEF_ACCOUNT &&
107                 $with_amount) {
108    
109              $account=new poste ($cn,$dattribut->av_text);
110              $solde=  $account->GetSoldeDetail("j_tech_per between ".$_REQUEST['from_periode'].
111                                             " and ".
112                                          $_REQUEST['to_periode']);
113              printf ("<td align=\"right\">% 10.2f</td>",$solde['debit']);
114              printf ("<td align=\"right\">% 10.2f</td>",$solde['credit']);
115              printf ("<td align=\"right\">% 10.2f</td>",$solde['solde']);
116                                  
117            }
118        }        }
       echo "</TR>";  
119      }      }
120        echo "</TR>";
121    }    }
122    
123    echo "</TABLE>";    echo "</TABLE>";
124    echo "</div>";    echo "</div>";
125   }   }
126     else {
127       // only the menu
128       $fiche_def=new fiche_def($cn);
129    
130    
131       $fiche_def->GetAll();
132    
133       $i=0;
134       foreach ($fiche_def->all as $l_fiche) {
135         $a[$i]=array("user_impress.php?type=fiche&fd_id=".$l_fiche->id,$l_fiche->label);
136         $i++;
137       }
138       echo ShowItem($a,'V');
139     }
140    
141  ?>  ?>

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26