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

poste.php File Reference

Go to the source code of this file.

Functions

 GetPosteLibelle ($p_dossier, $p_id, $is_cn=0)
 Return the label of a poste.
 GetNumberLine ($p_dossier, $p_jrn)
 Max of ligne definie dans le journal.
 PosteForm ($p_cn)
 Cree un form pour prendre les postes.
 GetSolde ($p_cn, $p_account, $p_cond="")
 give the balance of an account


Function Documentation

GetNumberLine p_dossier,
p_jrn
 

Max of ligne definie dans le journal.

Parameters:
$p_dossier dossier id
$p_jrn ledger id gen :
  • none return:
Todo:
obsolete ?

Definition at line 62 of file poste.php.

References $cn, $l_line, $Res, DbConnect(), and ExecSql().

00063 {
00064   $cn=DbConnect($p_dossier);
00065   $Res=ExecSql($cn,"select jrn_deb_max_line,jrn_cred_max_line from jrn_def where jrn_def_id=$p_jrn");
00066   if ( pg_NumRows($Res) == 0 ) {
00067     echo "<H2 class=\"warning\"> Journal non trouvé </H2>";
00068     //    return (3,3);
00069   }
00070   $l_line=pg_fetch_array($Res,0);
00071   $l_deb=$l_line['jrn_deb_max_line'];
00072   $l_cred=$l_line['jrn_cred_max_line'];
00073   return array ($l_deb,$l_cred);
00074 
00075 }

GetPosteLibelle p_dossier,
p_id,
is_cn = 0
 

Return the label of a poste.

Parameters:
$p_dossier 
$p_id tmp_pcmn (pcm_val)
$is_cn conneciton
Returns:
string

Definition at line 36 of file poste.php.

References $cn, $Res, DbConnect(), and ExecSql().

Referenced by FormODS(), Balance::GetRow(), ImpHtml(), and ViewRecord().

00037 {
00038   include_once("postgres.php");
00039   if ( ! isset($is_cn) ) $is_cn=0;
00040   if ( $is_cn == 0) {
00041     $cn=DbConnect($p_dossier);
00042   } else {
00043     $cn=$p_dossier;
00044   }
00045   $Res=ExecSql($cn,"select pcm_lib from tmp_pcmn where pcm_val=$p_id");
00046   if ( pg_NumRows($Res) == 0) { return "non existing poste";}
00047   $l_poste=pg_fetch_row($Res,0);
00048   return $l_poste[0];
00049 }

GetSolde p_cn,
p_account,
p_cond = ""
 

give the balance of an account

Parameters:
$p_cn connection
$p_account account
$p_cond sql condition
Returns:
balance of the account

Definition at line 114 of file poste.php.

References $Max, $r, $Res, and ExecSql().

Referenced by FormFin().

00114                                                {
00115   $Res=ExecSql($p_cn,"select j_poste,sum(deb) as sum_deb, sum(cred) as sum_cred from 
00116           ( select j_poste, 
00117              case when j_debit='t' then j_montant else 0 end as deb, 
00118              case when j_debit='f' then j_montant else 0 end as cred 
00119           from jrnx join tmp_pcmn on j_poste=pcm_val 
00120               where  
00121             j_poste=$p_account
00122           ) as m group by j_poste ");
00123   $Max=pg_NumRows($Res);
00124   if ($Max==0) return 0;
00125   $r=pg_fetch_array($Res,0);
00126 
00127   return $r['sum_deb']-$r['sum_cred'];
00128 }

PosteForm p_cn  ) 
 

Cree un form pour prendre les postes.

Parameters:
connection 
Returns:
morceau de code d'html qui contient un multiselect pour les postes

Definition at line 87 of file poste.php.

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

Referenced by ViewImp().

00087                           {
00088   $Res=ExecSql($p_cn,"select pcm_val,pcm_lib from tmp_pcmn 
00089          where pcm_val = any (select j_poste from jrnx) order by pcm_val::text");
00090   $Max=pg_NumRows($Res);
00091   if ($Max==0) return null;
00092   $ret='<SELECT NAME="poste[]" SIZE="15" MULTIPLE>';
00093   for ( $i = 0;$i< $Max;$i++) {
00094     $line=pg_fetch_array($Res,$i);
00095     $ret.=sprintf('<OPTION VALUE="%s" > %s - %s',
00096                   $line['pcm_val'],
00097                   $line['pcm_val'],
00098                   $line['pcm_lib']);
00099   }//for
00100   $ret.="</SELECT>";
00101   return $ret;
00102 }