Main Page | Namespace List | Class Hierarchy | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

preference.php File Reference

include file for the periode form, currency,... More...

Go to the source code of this file.

Functions

 FormPeriodeMult ($p_cn)
 Generate the form for the periode.
 FormPeriode ($p_cn, $l_default=0, $p_type=OPEN, $p_suff="")
 Generate the form for the periode.
 GetPeriode ($p_cn, $p_periode)
 Give the start & end date of a periode.
 PeriodeClosed ($p_cn, $p_periode)
 get the status of a periode
 GetExercice ($p_cn, $p_periode)
 get the exercice of a periode
 ShowDevise ($p_cn)
 Show all the currency encoded.
 ShowPeriode ($p_cn)
 Show all the periode and their status.


Detailed Description

include file for the periode form, currency,...

Definition in file preference.php.


Function Documentation

FormPeriode p_cn,
l_default = 0,
p_type = OPEN,
p_suff = ""
 

Generate the form for the periode.

Parameters:
$p_cn connexion
$p_default default periode
$p_type the type of the periode OPEN CLOSE NOTCENTRALIZED or ALL
$p_suff the suffix of the name
Returns:
string containing html code for the HTML

Definition at line 71 of file preference.php.

References $l_line, $Max, $Res, $ret, $sql, and ExecSql().

00072 {
00073   switch ($p_type) {
00074   case CLOSED:
00075     $sql_closed="where p_closed=true and p_central = false ";
00076     break;
00077   case OPEN:
00078     $sql_closed="where p_closed=false";
00079     break;
00080   case NOTCENTRALIZED:
00081     $sql_closed="where p_closed=true and p_central = false ";
00082     break;
00083   case ALL:
00084     $sql_closed="";
00085     break;
00086   default:
00087     error("invalide p_type in 'preference.php'#__LINE__");
00088   }
00089   $sql="select p_id,to_char(p_start,'DD.MM.YYYY') as p_start_string,
00090                     to_char(p_end,'DD.MM.YYYY') as p_end_string 
00091         from parm_periode  
00092          $sql_closed 
00093           order by p_start";
00094           
00095   $Res=ExecSql($p_cn,$sql);
00096   $Max=pg_NumRows($Res);
00097   if ( $Max == 0 ) return null;
00098   $ret='<SELECT NAME="periode'.$p_suff.'">';
00099   for ( $i = 0; $i < $Max;$i++) {
00100     $l_line=pg_fetch_array($Res,$i);
00101     if ( $l_default == $l_line['p_id'] )
00102       $sel="SELECTED";
00103     else
00104       $sel="";
00105 
00106     $ret.=sprintf('<OPTION VALUE="%s" %s>%s - %s',$l_line['p_id']
00107                   ,$sel
00108                   ,$l_line['p_start_string']
00109                   ,$l_line['p_end_string']);
00110 
00111   }
00112   $ret.="</SELECT>";
00113   return $ret;
00114 }

FormPeriodeMult p_cn  ) 
 

Generate the form for the periode.

FormPeriodeMult

Parameters:
$p_cn connexion
Returns:
string containing html code for the form

Definition at line 37 of file preference.php.

References $l_line, $Max, $Res, $ret, $sql, and ExecSql().

Referenced by ViewImp().

00038 {
00039   $sql="select p_id,to_char(p_start,'DD.MM.YYYY') as p_start,
00040                     to_char(p_end,'DD.MM.YYYY') as p_end 
00041         from parm_periode  
00042             order by p_exercice,p_start";
00043   $Res=ExecSql($p_cn,$sql);
00044   $Max=pg_NumRows($Res);
00045   $ret='<SELECT NAME="periode[]" SIZE="12" multiple>';
00046   for ( $i = 0; $i < $Max;$i++) {
00047     $l_line=pg_fetch_array($Res,$i);
00048     $ret.=sprintf('<OPTION VALUE="%s">%s - %s',$l_line['p_id']
00049                   ,$l_line['p_start']
00050                   ,$l_line['p_end']);
00051 
00052   }
00053   $ret.="</SELECT>";
00054   return $ret;
00055 }

GetExercice p_cn,
p_periode
 

get the exercice of a periode

Parameters:
$p_cn connection
$p_periode periode
Returns:
Exercice of the periode

Definition at line 168 of file preference.php.

References $line, $Res, and ExecSql().

00169 {
00170   $Res=ExecSql($p_cn,"select p_exercice from parm_periode".
00171                " where p_id=$p_periode");
00172   if ( pg_NumRows($Res) == 0 ) return "";
00173   $line=pg_fetch_array($Res,0);
00174   return $line['p_exercice'];
00175 }

GetPeriode p_cn,
p_periode
 

Give the start & end date of a periode.

GetPeriode

Parameters:
p_connection 
p_periode 
Returns:
array containing the start date & the end date

Definition at line 125 of file preference.php.

References $Res, $sql, and ExecSql().

Referenced by FormAchInput(), FormFin(), FormODS(), FormVenInput(), RecordJrn(), VerifData(), and VerifyOperationDate().

00126 {
00127  $sql="select to_char(p_start,'DD.MM.YYYY') as p_start,
00128               to_char(p_end,'DD.MM.YYYY')   as p_end
00129        from parm_periode
00130          where p_id=".$p_periode;
00131  $Res=ExecSql($p_cn,$sql);
00132  if ( pg_NumRows($Res) == 0) return null;
00133  return pg_fetch_array($Res,0);
00134 
00135 }

PeriodeClosed p_cn,
p_periode
 

get the status of a periode

Parameters:
$p_cn database connex
periode id
Returns:
't' if closed otherwise 'f'

Definition at line 146 of file preference.php.

References $l_line, $Res, $sql, and ExecSql().

Referenced by VerifData(), and VerifyOperationDate().

00147 {
00148  $sql="select p_closed
00149        from parm_periode
00150          where p_id=".$p_periode;
00151  $Res=ExecSql($p_cn,$sql);
00152  if ( pg_NumRows($Res) == 0) return null;
00153  $l_line=pg_fetch_array($Res,0);
00154  return $l_line['p_closed'];
00155 
00156 }

ShowDevise p_cn  ) 
 

Show all the currency encoded.

Parameters:
$p_cn database connextion
Returns:
nothing

Definition at line 185 of file preference.php.

References $l_line, $Max, $Res, ExecSql(), and METHOD.

00186 {
00187  echo "<h2 class=\"info\"> Devises </H2>";
00188   echo '<TABLE ALIGN="CENTER">';
00189   echo "<TR>";
00190   echo '<TH> CODE </TH>';
00191   echo '<TH> Valeur <BR>(par rapport à l\'euro) </TH>';
00192   echo "</TR>";
00193 
00194   $Res=ExecSql($p_cn,"select pm_id,pm_code,pm_rate  from parm_money order by pm_code");
00195   $Max=pg_NumRows($Res);
00196   
00197   for ($i=0;$i<$Max;$i++) {
00198     $l_line=pg_fetch_array($Res,$i);
00199     echo '<TR>'; 
00200     echo '<TD>'.$l_line['pm_code'].'</TD>';
00201     $l_rate=sprintf("% 10.6f",$l_line['pm_rate']);
00202     echo '<TD ALIGN="RIGHT">'.$l_rate.'</TD>';
00203     echo "<TD class=\"mtitle\"> <A class=\"mtitle\" HREF=\"parametre.php?p_mid=$l_line[pm_id]&p_action=change&p_code=$l_line[pm_code]&p_rate=$l_line[pm_rate]\">Change</A></TD>";
00204     echo "<TD class=\"mtitle\"> <A class=\"mtitle\" HREF=\"parametre.php?p_mid=$l_line[pm_id]&p_action=delete&p_code=$l_line[pm_code]\">Efface</A></TD>";
00205     echo '</TR>';
00206     
00207   }
00208   echo '<TR> <FORM ACTION="parametre.php" METHOD="POST">';
00209 echo '<TD> <INPUT TYPE="text" NAME="p_devise"></TD>';
00210  echo '<TD> <INPUT TYPE="text" NAME="p_rate"></TD>';
00211  echo '<TD> <INPUT TYPE="SUBMIT" NAME="action" Value="Ajout"</TD>';
00212  echo '</FORM></TR>';
00213  echo '</TABLE>';
00214 }

ShowPeriode p_cn  ) 
 

Show all the periode and their status.

Parameters:
$p_cn database connection
Returns:
nothing

Definition at line 224 of file preference.php.

References $l_line, $Max, $Res, echo_debug(), ExecSql(), and METHOD.

00225 {
00226   //  echo "<h2 class=\"info\"> Période </H2>";
00227   $Res=ExecSql($p_cn,"select p_id,to_char(p_start,'DD.MM.YYYY') as date_start,to_char(p_end,'DD.MM.YYYY') as date_end,p_central,p_closed,p_exercice
00228   from parm_periode order by p_start");
00229   $Max=pg_NumRows($Res);
00230   echo '<TABLE ALIGN="CENTER">';
00231   echo "</TR>";
00232   echo '<TH> Date début </TH>';
00233   echo '<TH> Date fin </TH>';
00234   echo '<TH> Exercice </TH>';
00235   echo "</TR>";
00236   
00237   for ($i=0;$i<$Max;$i++) {
00238     $l_line=pg_fetch_array($Res,$i);
00239     echo '<TR>'; 
00240     echo '<TD ALIGN="CENTER"> '.$l_line['date_start'].'</TD>';
00241     echo '<TD  ALIGN="CENTER"> '.$l_line['date_end'].'</TD>';
00242     echo '<TD  ALIGN="CENTER"> '.$l_line['p_exercice'].'</TD>';
00243     echo_debug('preference.php',__LINE__," closed : $l_line[p_closed]");
00244     if ( $l_line['p_closed'] == 't' )     { 
00245       $closed=($l_line['p_central']=='t')?'<TD>Centralisée</TD>':'<TD>Fermée</TD>';
00246       $change='<TD></TD>';
00247       $remove='<TD></TD>';
00248     } else {
00249       $closed='<TD class="mtitle">'; 
00250       $closed.='<A class="mtitle" HREF="user_advanced.php?p_action=periode&action=closed&p_per='.$l_line['p_id'].'"> Cloturer</A>';
00251     $change='<TD class="mtitle">';
00252     $change.='<A class="mtitle" HREF="user_advanced.php?p_action=periode&action=change_per&p_per='.
00253       $l_line['p_id']."&p_date_start=".$l_line['date_start'].
00254       "&p_date_end=".$l_line['date_end']."&p_exercice=".
00255       $l_line['p_exercice']."\"> Changer</A>";
00256     $remove='<TD class="mtitle">';
00257     $remove.='<A class="mtitle" HREF="user_advanced.php?p_action=periode&action=delete_per&p_per='.
00258       $l_line['p_id']."\"> Efface</A>";
00259 
00260     }
00261     echo "$closed";
00262     echo $change;
00263 
00264     echo $remove;
00265 
00266     echo '</TR>';
00267     
00268   }
00269   echo '<TR> <FORM ACTION="user_advanced.php?p_action=periode" METHOD="POST">';
00270   echo '<TD> <INPUT TYPE="text" NAME="p_date_start" SIZE="10"></TD>';
00271   echo '<TD> <INPUT TYPE="text" NAME="p_date_end" SIZE="10"></TD>';
00272   echo '<TD> <INPUT TYPE="text" NAME="p_exercice" SIZE="10"></TD>';
00273   echo '<TD> <INPUT TYPE="SUBMIT" NAME="add_per" Value="Ajout"</TD>';
00274   echo '<TD></TD>';
00275   echo '<TD></TD>';
00276   echo '</FORM></TR>';
00277 
00278   echo '</TABLE>';
00279 }