altocompta/doc/developper/html/classBalance.html
2006-07-12 21:24:48 +00:00

264 lines
15 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>phpcompta: Balance Class Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.4.4 -->
<div class="qindex"><a class="qindex" href="index.html">Main&nbsp;Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class&nbsp;Hierarchy</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="dirs.html">Directories</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related&nbsp;Pages</a></div>
<h1>Balance Class Reference</h1><!-- doxytag: class="Balance" -->Class for manipulating data to print the balance of account.
<a href="#_details">More...</a>
<p>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classBalance.html#a0">Balance</a> ($p_cn)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classBalance.html#a1">GetRow</a> ($p_from_periode, $p_to_periode)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">retrieve all the row from the ledger in the range of a periode <a href="#a1"></a><br></td></tr>
<tr><td colspan="2"><br><h2>Data Fields</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classBalance.html#o0">$db</a></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classBalance.html#o1">$central</a></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classBalance.html#o2">$row</a></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
Class for manipulating data to print the balance of account.
<p>
<p>
Definition at line <a class="el" href="class__balance_8php-source.html#l00029">29</a> of file <a class="el" href="class__balance_8php-source.html">class_balance.php</a>.<hr><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" name="a0"></a><!-- doxytag: member="Balance::Balance" ref="a0" args="($p_cn)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">Balance::Balance </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">$&nbsp;</td>
<td class="mdname1" valign="top" nowrap> <em>p_cn</em> </td>
<td class="md" valign="top">&nbsp;)&nbsp;</td>
<td class="md" nowrap></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="class__balance_8php-source.html#l00033">33</a> of file <a class="el" href="class__balance_8php-source.html">class_balance.php</a>.<div class="fragment"><pre class="fragment"><a name="l00033"></a>00033 {
<a name="l00034"></a>00034 $this-&gt;db=$p_cn;
<a name="l00035"></a>00035 $this-&gt;central=<span class="charliteral">'N'</span>;
<a name="l00036"></a>00036 }
</pre></div>
<p>
</td>
</tr>
</table>
<hr><h2>Member Function Documentation</h2>
<a class="anchor" name="a1"></a><!-- doxytag: member="Balance::GetRow" ref="a1" args="($p_from_periode, $p_to_periode)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">Balance::GetRow </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">$&nbsp;</td>
<td class="mdname" nowrap> <em>p_from_periode</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>$&nbsp;</td>
<td class="mdname" nowrap> <em>p_to_periode</em></td>
</tr>
<tr>
<td class="md"></td>
<td class="md">)&nbsp;</td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
retrieve all the row from the ledger in the range of a periode
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>$p_from_periode</em>&nbsp;</td><td>start periode </td></tr>
<tr><td valign="top"></td><td valign="top"><em>$p_to_periode</em>&nbsp;</td><td>end periode</td></tr>
</table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd>a double array array of<ul>
<li>$a['poste']</li><li>$a['label']</li><li>$a['sum_deb']</li><li>$a['sum_cred']</li><li>$a['solde_deb']</li><li>$a['solde_cred']</li></ul>
</dd></dl>
<p>
Definition at line <a class="el" href="class__balance_8php-source.html#l00053">53</a> of file <a class="el" href="class__balance_8php-source.html">class_balance.php</a>.
<p>
References <a class="el" href="balance_8php-source.html#l00113">$a</a>, <a class="el" href="recherche_8php-source.html#l00066">$array</a>, <a class="el" href="balance_8php-source.html#l00118">$i</a>, <a class="el" href="setup_8php-source.html#l00431">$M</a>, <a class="el" href="bank_8inc_8php-source.html#l00237">$r</a>, <a class="el" href="depense_8inc_8php-source.html#l00077">$Res</a>, <a class="el" href="bank_8inc_8php-source.html#l00169">$sql</a>, <a class="el" href="postgres_8php-source.html#l00099">ExecSql()</a>, <a class="el" href="poste_8php-source.html#l00036">GetPosteLibelle()</a>, and <a class="el" href="balance_8php-source.html#l00076">label</a>.<div class="fragment"><pre class="fragment"><a name="l00053"></a>00053 {
<a name="l00054"></a>00054 <span class="comment">// compute periode</span>
<a name="l00055"></a>00055 <span class="keywordflow">if</span> ( $p_from_periode==$p_to_periode ) {
<a name="l00056"></a>00056 $per_sql=<span class="stringliteral">" j_tech_per = $p_from_periode "</span>;
<a name="l00057"></a>00057 } <span class="keywordflow">else</span> {
<a name="l00058"></a>00058 $per_sql = <span class="stringliteral">"j_tech_per &gt;= $p_from_periode and j_tech_per &lt;= $p_to_periode "</span>;
<a name="l00059"></a>00059 }
<a name="l00060"></a>00060
<a name="l00061"></a>00061
<a name="l00062"></a>00062 <span class="comment">// if centralized</span>
<a name="l00063"></a>00063 $cent=<span class="stringliteral">""</span>;
<a name="l00064"></a>00064
<a name="l00065"></a>00065 <span class="keywordflow">if</span> ( $this-&gt;central==<span class="charliteral">'Y'</span> ) { $cent=<span class="stringliteral">"j_centralized = true and "</span>; }
<a name="l00066"></a>00066
<a name="l00067"></a>00067 <span class="comment">// build query</span>
<a name="l00068"></a>00068 <a class="code" href="bank_8inc_8php.html#a20">$sql</a>=<span class="stringliteral">"select j_poste,sum(deb) as sum_deb, sum(cred) as sum_cred from </span>
<a name="l00069"></a>00069 <span class="stringliteral"> ( select j_poste,</span>
<a name="l00070"></a>00070 <span class="stringliteral"> case when j_debit='t' then j_montant else 0 end as deb,</span>
<a name="l00071"></a>00071 <span class="stringliteral"> case when j_debit='f' then j_montant else 0 end as cred</span>
<a name="l00072"></a>00072 <span class="stringliteral"> from jrnx join tmp_pcmn on j_poste=pcm_val</span>
<a name="l00073"></a>00073 <span class="stringliteral"> where </span>
<a name="l00074"></a>00074 <span class="stringliteral"> $cent</span>
<a name="l00075"></a>00075 <span class="stringliteral"> $per_sql ) as m group by j_poste order by j_poste::text"</span>;
<a name="l00076"></a>00076
<a name="l00077"></a>00077 <a class="code" href="depense_8inc_8php.html#a4">$Res</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($this-&gt;db,$sql);
<a name="l00078"></a>00078
<a name="l00079"></a>00079 $tot_cred= 0.0;
<a name="l00080"></a>00080 $tot_deb= 0.0;
<a name="l00081"></a>00081 $tot_deb_saldo=0.0;
<a name="l00082"></a>00082 $tot_cred_saldo=0.0;
<a name="l00083"></a>00083 <a class="code" href="setup_8php.html#a14">$M</a>=pg_NumRows($Res);
<a name="l00084"></a>00084 <span class="comment">// Load the array</span>
<a name="l00085"></a>00085 <span class="keywordflow">for</span> ($i=0; $i &lt;$M;$i++) {
<a name="l00086"></a>00086 <a class="code" href="bank_8inc_8php.html#a29">$r</a>=pg_fetch_array($Res,$i);
<a name="l00087"></a>00087 <a class="code" href="balance_8php.html#a10">$a</a>['<a class="code" href="classposte.html">poste</a>']=<a class="code" href="bank_8inc_8php.html#a29">$r</a>['j_poste'];
<a name="l00088"></a>00088 <a class="code" href="balance_8php.html#a10">$a</a>['<a class="code" href="balance_8php.html#a6">label</a>']=substr(<a class="code" href="poste_8php.html#a0">GetPosteLibelle</a>($this-&gt;db,$r['j_poste'],1),0,40);
<a name="l00089"></a>00089 <a class="code" href="balance_8php.html#a10">$a</a>['sum_deb']=round($r['sum_deb'],2);
<a name="l00090"></a>00090 <a class="code" href="balance_8php.html#a10">$a</a>['sum_cred']=round($r['sum_cred'],2);
<a name="l00091"></a>00091 <a class="code" href="balance_8php.html#a10">$a</a>['solde_deb']=round(( $a['sum_deb'] &gt;= $a['sum_cred'] )? $a['sum_deb']- $a['sum_cred']:0,2);
<a name="l00092"></a>00092 <a class="code" href="balance_8php.html#a10">$a</a>['solde_cred']=round(( $a['sum_deb'] &lt;= $a['sum_cred'] )?$a['sum_cred']-$a['sum_deb']:0,2);
<a name="l00093"></a>00093 <a class="code" href="recherche_8php.html#a4">$array</a>[<a class="code" href="balance_8php.html#a12">$i</a>]=<a class="code" href="balance_8php.html#a10">$a</a>;
<a name="l00094"></a>00094 $tot_cred+= <a class="code" href="balance_8php.html#a10">$a</a>['sum_cred'];
<a name="l00095"></a>00095 $tot_deb+= <a class="code" href="balance_8php.html#a10">$a</a>['sum_deb'];
<a name="l00096"></a>00096 $tot_deb_saldo+= <a class="code" href="balance_8php.html#a10">$a</a>['solde_deb'];
<a name="l00097"></a>00097 $tot_cred_saldo+= <a class="code" href="balance_8php.html#a10">$a</a>['solde_cred'];
<a name="l00098"></a>00098
<a name="l00099"></a>00099
<a name="l00100"></a>00100 }<span class="comment">//for i</span>
<a name="l00101"></a>00101 <span class="comment">// Add the saldo</span>
<a name="l00102"></a>00102 <a class="code" href="balance_8php.html#a12">$i</a>+=1;
<a name="l00103"></a>00103 <a class="code" href="balance_8php.html#a10">$a</a>['<a class="code" href="classposte.html">poste</a>']=<span class="stringliteral">""</span>;
<a name="l00104"></a>00104 <a class="code" href="balance_8php.html#a10">$a</a>['<a class="code" href="balance_8php.html#a6">label</a>']=<span class="stringliteral">"&lt;b&gt; Totaux &lt;/b&gt;"</span>;
<a name="l00105"></a>00105 <a class="code" href="balance_8php.html#a10">$a</a>['sum_deb']=$tot_deb;
<a name="l00106"></a>00106 <a class="code" href="balance_8php.html#a10">$a</a>['sum_cred']=$tot_cred;
<a name="l00107"></a>00107 <a class="code" href="balance_8php.html#a10">$a</a>['solde_deb']=$tot_deb_saldo;
<a name="l00108"></a>00108 <a class="code" href="balance_8php.html#a10">$a</a>['solde_cred']=$tot_cred_saldo;
<a name="l00109"></a>00109 <a class="code" href="recherche_8php.html#a4">$array</a>[<a class="code" href="balance_8php.html#a12">$i</a>]=<a class="code" href="balance_8php.html#a10">$a</a>;
<a name="l00110"></a>00110 $this-&gt;row=<a class="code" href="recherche_8php.html#a4">$array</a>;
<a name="l00111"></a>00111 <span class="keywordflow">return</span> <a class="code" href="recherche_8php.html#a4">$array</a>;
<a name="l00112"></a>00112
<a name="l00113"></a>00113 }
</pre></div>
<p>
</td>
</tr>
</table>
<hr><h2>Field Documentation</h2>
<a class="anchor" name="o1"></a><!-- doxytag: member="Balance::$central" ref="o1" args="" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">Balance::$central </td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="class__balance_8php-source.html#l00031">31</a> of file <a class="el" href="class__balance_8php-source.html">class_balance.php</a>. </td>
</tr>
</table>
<a class="anchor" name="o0"></a><!-- doxytag: member="Balance::$db" ref="o0" args="" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">Balance::$db </td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="class__balance_8php-source.html#l00030">30</a> of file <a class="el" href="class__balance_8php-source.html">class_balance.php</a>. </td>
</tr>
</table>
<a class="anchor" name="o2"></a><!-- doxytag: member="Balance::$row" ref="o2" args="" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">Balance::$row </td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="class__balance_8php-source.html#l00032">32</a> of file <a class="el" href="class__balance_8php-source.html">class_balance.php</a>. </td>
</tr>
</table>
<hr>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="class__balance_8php-source.html">class_balance.php</a></ul>
</BODY>
</HTML>