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

565 lines
37 KiB
HTML
Raw Blame History

<!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: Customer 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>Customer Class Reference</h1><!-- doxytag: class="Customer" --><!-- doxytag: inherits="fiche" -->class Customer are a specific kind of card
<a href="#_details">More...</a>
<p>
<p>Inheritance diagram for Customer:
<p><center><img src="classCustomer.png" usemap="#Customer_map" border="0" alt=""></center>
<map name="Customer_map">
<area href="classfiche.html" alt="fiche" shape="rect" coords="0,0,65,24">
</map>
<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="classCustomer.html#a0">Customer</a> ($p_cn, $p_id=0)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Constructor /* only a db connection is needed. <a href="#a0"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classCustomer.html#a1">GetFromPoste</a> ($p_poste=0)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Get all info contains in the view thanks to the poste elt (account). <a href="#a1"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classCustomer.html#a2">VatListing</a> ($p_year)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Get all the info for making a vat listing for the vat administration. <a href="#a2"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classCustomer.html#a3">Summary</a> ($p_search)</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="classCustomer.html#o0">$poste</a></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classCustomer.html#o1">$name</a></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classCustomer.html#o2">$street</a></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classCustomer.html#o3">$country</a></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classCustomer.html#o4">$cp</a></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classCustomer.html#o5">$vat_number</a></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
class Customer are a specific kind of card
<p>
<p>
Definition at line <a class="el" href="class__customer_8php-source.html#l00038">38</a> of file <a class="el" href="class__customer_8php-source.html">class_customer.php</a>.<hr><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" name="a0"></a><!-- doxytag: member="Customer::Customer" ref="a0" args="($p_cn, $p_id=0)" --><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">Customer::Customer </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">$&nbsp;</td>
<td class="mdname" nowrap> <em>p_cn</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_id</em> = <code>0</code></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>
Constructor /* only a db connection is needed.
<p>
<p>
Definition at line <a class="el" href="class__customer_8php-source.html#l00049">49</a> of file <a class="el" href="class__customer_8php-source.html">class_customer.php</a>.
<p>
References <a class="el" href="class__fiche_8php-source.html#l00155">fiche::fiche()</a>.<div class="fragment"><pre class="fragment"><a name="l00049"></a>00049 {
<a name="l00050"></a>00050 $this-&gt;<a class="code" href="classfiche__def__ref.html">fiche_def_ref</a>=<a class="code" href="constant_8php.html#a69">FICHE_TYPE_CLIENT</a>;
<a name="l00051"></a>00051 <a class="code" href="classfiche.html#a0">fiche::fiche</a>($p_cn,$p_id) ;
<a name="l00052"></a>00052
<a name="l00053"></a>00053 }
</pre></div>
<p>
</td>
</tr>
</table>
<hr><h2>Member Function Documentation</h2>
<a class="anchor" name="a1"></a><!-- doxytag: member="Customer::GetFromPoste" ref="a1" args="($p_poste=0)" --><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">Customer::GetFromPoste </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">$&nbsp;</td>
<td class="mdname1" valign="top" nowrap> <em>p_poste</em> = <code>0</code> </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>
Get all info contains in the view thanks to the poste elt (account).
<p>
<p>
Definition at line <a class="el" href="class__customer_8php-source.html#l00057">57</a> of file <a class="el" href="class__customer_8php-source.html">class_customer.php</a>.
<p>
References <a class="el" href="depense_8inc_8php-source.html#l00077">$Res</a>, <a class="el" href="argenta__be_8inc_8php-source.html#l00044">$row</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="facture_8inc_8php-source.html#l00227">f_id</a>, and <a class="el" href="action_8inc_8php-source.html#l00240">name</a>.
<p>
Referenced by <a class="el" href="class__customer_8php-source.html#l00084">VatListing()</a>.<div class="fragment"><pre class="fragment"><a name="l00057"></a>00057 {
<a name="l00058"></a>00058 $this-&gt;<a class="code" href="classposte.html">poste</a>=($p_poste==0)?$this-&gt;<a class="code" href="classposte.html">poste</a>:$p_poste;
<a name="l00059"></a>00059 <a class="code" href="bank_8inc_8php.html#a20">$sql</a>=<span class="stringliteral">"select * from vw_client where poste_comptable="</span>.$this-&gt;poste;
<a name="l00060"></a>00060 <a class="code" href="depense_8inc_8php.html#a4">$Res</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($this-&gt;cn,$sql);
<a name="l00061"></a>00061 <span class="keywordflow">if</span> ( pg_NumRows($Res) == 0) <span class="keywordflow">return</span> null;
<a name="l00062"></a>00062 <span class="comment">// There is only _one_ row by customer</span>
<a name="l00063"></a>00063 <a class="code" href="argenta__be_8inc_8php.html#a2">$row</a>=pg_fetch_array($Res,0);
<a name="l00064"></a>00064 $this-&gt;<a class="code" href="action_8inc_8php.html#a18">name</a>=<a class="code" href="argenta__be_8inc_8php.html#a2">$row</a>['<a class="code" href="action_8inc_8php.html#a18">name</a>'];
<a name="l00065"></a>00065 $this-&gt;<span class="keywordtype">id</span>=<a class="code" href="argenta__be_8inc_8php.html#a2">$row</a>['<a class="code" href="facture_8inc_8php.html#a26">f_id</a>'];
<a name="l00066"></a>00066 $this-&gt;street=<a class="code" href="argenta__be_8inc_8php.html#a2">$row</a>['rue'];
<a name="l00067"></a>00067 $this-&gt;cp=<a class="code" href="argenta__be_8inc_8php.html#a2">$row</a>['code_postal'];
<a name="l00068"></a>00068 $this-&gt;country=<a class="code" href="argenta__be_8inc_8php.html#a2">$row</a>['pays'];
<a name="l00069"></a>00069 $this-&gt;vat_number=<a class="code" href="argenta__be_8inc_8php.html#a2">$row</a>['tva_num'];
<a name="l00070"></a>00070
<a name="l00071"></a>00071 }
</pre></div>
<p>
</td>
</tr>
</table>
<a class="anchor" name="a3"></a><!-- doxytag: member="Customer::Summary" ref="a3" args="($p_search)" --><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">Customer::Summary </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">$&nbsp;</td>
<td class="mdname1" valign="top" nowrap> <em>p_search</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>
Summary<p>
show the default screen<p>
parm :<ul>
<li>p_search (filter) gen :</li><li>return: string to display</li></ul>
<p>
Definition at line <a class="el" href="class__customer_8php-source.html#l00195">195</a> of file <a class="el" href="class__customer_8php-source.html">class_customer.php</a>.
<p>
References <a class="el" href="balance_8php-source.html#l00113">$a</a>, <a class="el" href="bank_8inc_8php-source.html#l00184">$bar</a>, <a class="el" href="impress__fiche_8php-source.html#l00082">$e</a>, <a class="el" href="balance_8php-source.html#l00073">$filter_year</a>, <a class="el" href="bank_8inc_8php-source.html#l00172">$offset</a>, <a class="el" href="bank_8inc_8php-source.html#l00171">$page</a>, <a class="el" href="bank_8inc_8php-source.html#l00237">$r</a>, <a class="el" href="admin_8inc_8php-source.html#l00129">$search</a>, <a class="el" href="admin_8inc_8php-source.html#l00112">$url</a>, <a class="el" href="user__action__ach_8php-source.html#l00164">$User</a>, <a class="el" href="class__fiche_8php-source.html#l00291">fiche::CountByDef()</a>, <a class="el" href="ac__common_8php-source.html#l00206">FormatString()</a>, <a class="el" href="class__fiche_8php-source.html#l00780">fiche::GetAll()</a>, <a class="el" href="user__common_8php-source.html#l00858">jrn_navigation_bar()</a>, <a class="el" href="user__impress_8php-source.html#l00082">poste</a>, and <a class="el" href="balance_8php-source.html#l00071">table</a>.<div class="fragment"><pre class="fragment"><a name="l00196"></a>00196 {
<a name="l00197"></a>00197 $p_search=<a class="code" href="ac__common_8php.html#a9">FormatString</a>($p_search);
<a name="l00198"></a>00198 <a class="code" href="admin_8inc_8php.html#a3">$url</a>=urlencode($_SERVER['REQUEST_URI']);
<a name="l00199"></a>00199 $script=$_SERVER['SCRIPT_NAME'];
<a name="l00200"></a>00200 <span class="comment">// Creation of the nav bar</span>
<a name="l00201"></a>00201 <span class="comment">// Get the max numberRow</span>
<a name="l00202"></a>00202 $all_client=$this-&gt;<a class="code" href="classfiche.html#a5">CountByDef</a>($this-&gt;fiche_def_ref,$p_search);
<a name="l00203"></a>00203 <span class="comment">// Get offset and page variable</span>
<a name="l00204"></a>00204 <a class="code" href="bank_8inc_8php.html#a23">$offset</a>=( isset ($_REQUEST['offset'] )) ?$_REQUEST['offset']:0;
<a name="l00205"></a>00205 <a class="code" href="bank_8inc_8php.html#a22">$page</a>=(isset($_REQUEST['page']))?$_REQUEST['page']:1;
<a name="l00206"></a>00206 <a class="code" href="bank_8inc_8php.html#a25">$bar</a>=<a class="code" href="user__common_8php.html#a16">jrn_navigation_bar</a>($offset,$all_client,$_SESSION['g_pagesize'],$page);
<a name="l00207"></a>00207 <span class="comment">// set a filter ?</span>
<a name="l00208"></a>00208 <a class="code" href="admin_8inc_8php.html#a8">$search</a>=<span class="stringliteral">""</span>;
<a name="l00209"></a>00209 <span class="keywordflow">if</span> ( trim($p_search) != <span class="stringliteral">""</span> )
<a name="l00210"></a>00210 {
<a name="l00211"></a>00211 <a class="code" href="admin_8inc_8php.html#a8">$search</a>=<span class="stringliteral">" and f_id in</span>
<a name="l00212"></a>00212 <span class="stringliteral">(select f_id from jnt_fic_att_value </span>
<a name="l00213"></a>00213 <span class="stringliteral"> join fiche using (f_id) </span>
<a name="l00214"></a>00214 <span class="stringliteral"> join attr_value using (jft_id)</span>
<a name="l00215"></a>00215 <span class="stringliteral"> where</span>
<a name="l00216"></a>00216 <span class="stringliteral"> ad_id=1 and av_text ~* '$p_search')"</span>;
<a name="l00217"></a>00217 }
<a name="l00218"></a>00218 <span class="comment">// Get The result Array</span>
<a name="l00219"></a>00219 $step_client=$this-&gt;<a class="code" href="classfiche.html#a17">GetAll</a>($offset,$search);
<a name="l00220"></a>00220 <span class="keywordflow">if</span> ( $all_client == 0 ) <span class="keywordflow">return</span> <span class="stringliteral">""</span>;
<a name="l00221"></a>00221 <a class="code" href="bank_8inc_8php.html#a29">$r</a>=<a class="code" href="bank_8inc_8php.html#a25">$bar</a>;
<a name="l00222"></a>00222 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.='&lt;<a class="code" href="balance_8php.html#a3">table</a>&gt;
<a name="l00223"></a>00223 &lt;TR style=<span class="stringliteral">"background-color:lightgrey;"</span>&gt;
<a name="l00224"></a>00224 &lt;TH&gt;Quick Code&lt;/TH&gt;
<a name="l00225"></a>00225 &lt;th&gt;Nom&lt;/th&gt;
<a name="l00226"></a>00226 &lt;th&gt;Adresse&lt;/th&gt;
<a name="l00227"></a>00227 &lt;th&gt;Solde&lt;/th&gt;
<a name="l00228"></a>00228 &lt;th colspan=<span class="stringliteral">"3"</span>&gt;Action &lt;/th&gt;
<a name="l00229"></a>00229 &lt;/TR&gt;';
<a name="l00230"></a>00230 <span class="keywordflow">if</span> ( <span class="keyword">sizeof</span> ($step_client ) == 0 )
<a name="l00231"></a>00231 <span class="keywordflow">return</span> <a class="code" href="bank_8inc_8php.html#a29">$r</a>;
<a name="l00232"></a>00232 foreach ($step_client as $client ) {
<a name="l00233"></a>00233 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.=<span class="stringliteral">"&lt;TR&gt;"</span>;
<a name="l00234"></a>00234 <a class="code" href="impress__fiche_8php.html#a10">$e</a>=sprintf('&lt;A HREF=<span class="stringliteral">"%s?p_action=client&amp;sa=detail&amp;f_id=%d&amp;url=%s"</span> title=<span class="stringliteral">"D<>tail"</span>&gt; ',
<a name="l00235"></a>00235 $script,$client-&gt;id,$url);
<a name="l00236"></a>00236
<a name="l00237"></a>00237 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.=<span class="stringliteral">"&lt;TD&gt; $e"</span>.$client-&gt;strAttribut(<a class="code" href="constant_8php.html#a78">ATTR_DEF_QUICKCODE</a>).<span class="stringliteral">"&lt;/A&gt;&lt;/TD&gt;"</span>;
<a name="l00238"></a>00238 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.=<span class="stringliteral">"&lt;TD&gt;"</span>.$client-&gt;strAttribut(<a class="code" href="constant_8php.html#a56">ATTR_DEF_NAME</a>).<span class="stringliteral">"&lt;/TD&gt;"</span>;
<a name="l00239"></a>00239 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.=<span class="stringliteral">"&lt;TD&gt;"</span>.$client-&gt;strAttribut(<a class="code" href="constant_8php.html#a61">ATTR_DEF_ADRESS</a>).
<a name="l00240"></a>00240 <span class="stringliteral">" "</span>.$client-&gt;strAttribut(<a class="code" href="constant_8php.html#a62">ATTR_DEF_CP</a>).
<a name="l00241"></a>00241 <span class="stringliteral">" "</span>.$client-&gt;strAttribut(<a class="code" href="constant_8php.html#a63">ATTR_DEF_PAYS</a>).
<a name="l00242"></a>00242 <span class="stringliteral">"&lt;/TD&gt;"</span>;
<a name="l00243"></a>00243
<a name="l00244"></a>00244 $post=<span class="keyword">new</span> <a class="code" href="user__impress_8php.html#a6">poste</a>($this-&gt;cn,$client-&gt;strAttribut(<a class="code" href="constant_8php.html#a55">ATTR_DEF_ACCOUNT</a>));
<a name="l00245"></a>00245 <span class="comment">/* Filter on the default year */</span>
<a name="l00246"></a>00246 <a class="code" href="user__action__ach_8php.html#a9">$User</a>=<span class="keyword">new</span> <a class="code" href="classcl__user.html">cl_user</a>($this-&gt;cn);
<a name="l00247"></a>00247 <a class="code" href="balance_8php.html#a4">$filter_year</a>=<span class="stringliteral">" j_tech_per in (select p_id from parm_periode "</span>.
<a name="l00248"></a>00248 <span class="stringliteral">"where p_exercice='"</span>.$User-&gt;getExercice().<span class="stringliteral">"')"</span>;
<a name="l00249"></a>00249 <a class="code" href="balance_8php.html#a10">$a</a>=$post-&gt;GetSoldeDetail($filter_year);
<a name="l00250"></a>00250 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.=sprintf('&lt;TD align=<span class="stringliteral">"right"</span>&gt; %15.2f&amp;euro;&lt;/TD&gt;',$a['solde']);
<a name="l00251"></a>00251 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.=<span class="stringliteral">"&lt;TD&gt;"</span>;
<a name="l00252"></a>00252
<a name="l00253"></a>00253 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.=sprintf('&lt;A HREF=<span class="stringliteral">"%s?p_action=contact&amp;qcode=%s&amp;url=%s"</span> title=<span class="stringliteral">"Contact"</span>&gt;Contact&lt;/A&gt;&lt;/td&gt;',
<a name="l00254"></a>00254 $script,$client-&gt;strAttribut(<a class="code" href="constant_8php.html#a78">ATTR_DEF_QUICKCODE</a>),<a class="code" href="admin_8inc_8php.html#a3">$url</a>);
<a name="l00255"></a>00255 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.=sprintf('&lt;td&gt;&lt;A HREF=<span class="stringliteral">"%s?p_action=suivi_courrier&amp;sa=list&amp;qcode=%s&amp;url=%s"</span> title=<span class="stringliteral">"Action"</span>&gt;Courrier&lt;/A&gt;&lt;/td&gt; ',
<a name="l00256"></a>00256 $script,$client-&gt;strAttribut(<a class="code" href="constant_8php.html#a78">ATTR_DEF_QUICKCODE</a>) ,<a class="code" href="admin_8inc_8php.html#a3">$url</a>);
<a name="l00257"></a>00257
<a name="l00258"></a>00258
<a name="l00259"></a>00259
<a name="l00260"></a>00260 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.='&lt;td&gt;&lt;A HREF=<span class="stringliteral">"commercial.php?p_action=facture&amp;sa=list&amp;p_periode=-1&amp;qcode='.$client-&gt;strAttribut(ATTR_DEF_QUICKCODE).'&amp;url='.$url.'"</span> title=<span class="stringliteral">"Historique Facture"</span>&gt;Facture&lt;/A&gt;&lt;/td&gt;';
<a name="l00261"></a>00261
<a name="l00262"></a>00262 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.='&lt;/TD&gt;';
<a name="l00263"></a>00263
<a name="l00264"></a>00264 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.=<span class="stringliteral">"&lt;/TR&gt;"</span>;
<a name="l00265"></a>00265
<a name="l00266"></a>00266 }
<a name="l00267"></a>00267 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.=<span class="stringliteral">"&lt;/TABLE&gt;"</span>;
<a name="l00268"></a>00268 <a class="code" href="bank_8inc_8php.html#a29">$r</a>.=<a class="code" href="bank_8inc_8php.html#a25">$bar</a>;
<a name="l00269"></a>00269 <span class="keywordflow">return</span> <a class="code" href="bank_8inc_8php.html#a29">$r</a>;
<a name="l00270"></a>00270 }
</pre></div>
<p>
</td>
</tr>
</table>
<a class="anchor" name="a2"></a><!-- doxytag: member="Customer::VatListing" ref="a2" args="($p_year)" --><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">Customer::VatListing </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">$&nbsp;</td>
<td class="mdname1" valign="top" nowrap> <em>p_year</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>
Get all the info for making a vat listing for the vat administration.
<p>
<dl compact><dt><b><a class="el" href="todo.html#_todo000005">Todo:</a></b></dt><dd>optimize SQL</dd></dl>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>periode</em>&nbsp;</td><td></td></tr>
</table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd>double array structure is ( j_poste,name,vat_number,amount,tva,customer(object)</dd></dl>
<p>
Definition at line <a class="el" href="class__customer_8php-source.html#l00084">84</a> of file <a class="el" href="class__customer_8php-source.html">class_customer.php</a>.
<p>
References <a class="el" href="impress__listing__client_8php-source.html#l00035">$a_Res</a>, <a class="el" href="admin_8inc_8php-source.html#l00081">$c</a>, <a class="el" href="client_8inc_8php-source.html#l00052">$customer</a>, <a class="el" href="impress__fiche_8php-source.html#l00082">$e</a>, <a class="el" href="depense_8inc_8php-source.html#l00077">$Res</a>, <a class="el" href="setup_8php-source.html#l00426">$Res2</a>, <a class="el" href="bank_8inc_8php-source.html#l00169">$sql</a>, <a class="el" href="impress__rapport_8php-source.html#l00062">$t</a>, <a class="el" href="postgres_8php-source.html#l00099">ExecSql()</a>, <a class="el" href="class__customer_8php-source.html#l00057">GetFromPoste()</a>, and <a class="el" href="action_8inc_8php-source.html#l00240">name</a>.<div class="fragment"><pre class="fragment"><a name="l00084"></a>00084 {
<a name="l00085"></a>00085 $cond_sql=<span class="stringliteral">" and A.j_date = B.j_date </span>
<a name="l00086"></a>00086 <span class="stringliteral"> and extract(year from A.j_date) ='$p_year'"</span>;
<a name="l00087"></a>00087
<a name="l00088"></a>00088 <span class="comment">// BASE ACCOUNT</span>
<a name="l00089"></a>00089 <span class="comment">// for belgium</span>
<a name="l00090"></a>00090 $s=<span class="keyword">new</span> <a class="code" href="classparm__code.html">parm_code</a>($this-&gt;cn,'VENTE');
<a name="l00091"></a>00091 $s-&gt;Get();
<a name="l00092"></a>00092 $SOLD=$s-&gt;p_value;
<a name="l00093"></a>00093
<a name="l00094"></a>00094 <a class="code" href="admin_8inc_8php.html#a2">$c</a>=<span class="keyword">new</span> <a class="code" href="classparm__code.html">parm_code</a>($this-&gt;cn,'CUSTOMER');
<a name="l00095"></a>00095 <a class="code" href="admin_8inc_8php.html#a2">$c</a>-&gt;Get();
<a name="l00096"></a>00096 $CUSTOMER=<a class="code" href="admin_8inc_8php.html#a2">$c</a>-&gt;p_value;
<a name="l00097"></a>00097
<a name="l00098"></a>00098 <a class="code" href="impress__rapport_8php.html#a3">$t</a>=<span class="keyword">new</span> <a class="code" href="classparm__code.html">parm_code</a>($this-&gt;cn,'COMPTE_TVA');
<a name="l00099"></a>00099 <a class="code" href="impress__rapport_8php.html#a3">$t</a>-&gt;Get();
<a name="l00100"></a>00100 $TVA=<a class="code" href="impress__rapport_8php.html#a3">$t</a>-&gt;p_value;
<a name="l00101"></a>00101 <span class="comment">// Get all the sell operation</span>
<a name="l00102"></a>00102 <span class="comment">//----</span>
<a name="l00103"></a>00103 <a class="code" href="bank_8inc_8php.html#a20">$sql</a>=<span class="stringliteral">"select j_grpt </span>
<a name="l00104"></a>00104 <span class="stringliteral"> from</span>
<a name="l00105"></a>00105 <span class="stringliteral">jrnx as A</span>
<a name="l00106"></a>00106 <span class="stringliteral"> join jrnx as B using (j_grpt)</span>
<a name="l00107"></a>00107 <span class="stringliteral">where</span>
<a name="l00108"></a>00108 <span class="stringliteral"> A.j_poste like '"</span>.$CUSTOMER.<span class="stringliteral">"%' and</span>
<a name="l00109"></a>00109 <span class="stringliteral"> B.j_poste like '"</span>.$SOLD.<span class="stringliteral">"%' </span>
<a name="l00110"></a>00110 <span class="stringliteral"> $cond_sql</span>
<a name="l00111"></a>00111 <span class="stringliteral">"</span>;
<a name="l00112"></a>00112
<a name="l00113"></a>00113 <a class="code" href="depense_8inc_8php.html#a4">$Res</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($this-&gt;cn,$sql);
<a name="l00114"></a>00114 <span class="comment">// Foreach operation </span>
<a name="l00115"></a>00115 <span class="comment">// where 7% or tva account are involved</span>
<a name="l00116"></a>00116 <span class="comment">// and store the result in an array (a_Res)</span>
<a name="l00117"></a>00117 <span class="comment">//---</span>
<a name="l00118"></a>00118 <a class="code" href="impress__listing__client_8php.html#a1">$a_Res</a>=array();
<a name="l00119"></a>00119 <span class="keywordflow">for</span> ($i=0; $i &lt; pg_NumRows($Res);$i++) {
<a name="l00120"></a>00120 <span class="comment">// Get each row</span>
<a name="l00121"></a>00121 <span class="comment">//---</span>
<a name="l00122"></a>00122 $row1=pg_fetch_array($Res,$i);
<a name="l00123"></a>00123
<a name="l00124"></a>00124 <span class="comment">// select the operation</span>
<a name="l00125"></a>00125 <span class="comment">//----</span>
<a name="l00126"></a>00126 <a class="code" href="setup_8php.html#a12">$Res2</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($this-&gt;cn,<span class="stringliteral">"select j_poste,j_montant,j_debit from jrnx where j_grpt="</span>.$row1['j_grpt']);
<a name="l00127"></a>00127 $a_row=array();
<a name="l00128"></a>00128 <span class="comment">// Store the result in the array </span>
<a name="l00129"></a>00129 <span class="comment">//---</span>
<a name="l00130"></a>00130 <span class="keywordflow">for</span> ($e=0;$e &lt; pg_NumRows($Res2);$e++) {
<a name="l00131"></a>00131 $a_row[]=pg_fetch_array($Res2,$e);
<a name="l00132"></a>00132 }
<a name="l00133"></a>00133
<a name="l00134"></a>00134 <span class="comment">// Seek the customer</span>
<a name="l00135"></a>00135 <span class="comment">//---</span>
<a name="l00136"></a>00136 foreach ($a_row as $e) {
<a name="l00137"></a>00137 <span class="keywordflow">if</span> ( substr($e['j_poste'],0, strlen($CUSTOMER))==$CUSTOMER) {
<a name="l00138"></a>00138 <a class="code" href="client_8inc_8php.html#a1">$customer</a>=<a class="code" href="impress__fiche_8php.html#a10">$e</a>['j_poste'];
<a name="l00139"></a>00139 <span class="comment">// Retrieve name and vat number</span>
<a name="l00140"></a>00140 $this-&gt;<a class="code" href="classCustomer.html#a1">GetFromPoste</a>($customer);
<a name="l00141"></a>00141 <a class="code" href="impress__listing__client_8php.html#a1">$a_Res</a>[<a class="code" href="client_8inc_8php.html#a1">$customer</a>]['<a class="code" href="action_8inc_8php.html#a18">name</a>']=$this-&gt;<a class="code" href="action_8inc_8php.html#a18">name</a>;
<a name="l00142"></a>00142 <a class="code" href="impress__listing__client_8php.html#a1">$a_Res</a>[<a class="code" href="client_8inc_8php.html#a1">$customer</a>]['vat_number']=$this-&gt;vat_number;
<a name="l00143"></a>00143 <span class="keywordflow">break</span>;
<a name="l00144"></a>00144
<a name="l00145"></a>00145 }
<a name="l00146"></a>00146 }<span class="comment">// foreach $a</span>
<a name="l00147"></a>00147 <span class="comment">// Store the amount in the array</span>
<a name="l00148"></a>00148 <span class="comment">//---</span>
<a name="l00149"></a>00149 foreach ($a_row as $e) {
<a name="l00150"></a>00150 $amount=0;
<a name="l00151"></a>00151 $tva=0;
<a name="l00152"></a>00152 <span class="keywordflow">if</span> ( substr($e['j_poste'],0, strlen($SOLD))==$SOLD) {
<a name="l00153"></a>00153 $amount=(<a class="code" href="impress__fiche_8php.html#a10">$e</a>['j_debit']==<span class="charliteral">'f'</span>)?<a class="code" href="impress__fiche_8php.html#a10">$e</a>['j_montant']:<a class="code" href="impress__fiche_8php.html#a10">$e</a>['j_montant']*-1;
<a name="l00154"></a>00154 }
<a name="l00155"></a>00155 <span class="keywordflow">if</span> ( substr($e['j_poste'],0, strlen($TVA))==$TVA) {
<a name="l00156"></a>00156 $tva=(<a class="code" href="impress__fiche_8php.html#a10">$e</a>['j_debit']==<span class="charliteral">'f'</span>)?<a class="code" href="impress__fiche_8php.html#a10">$e</a>['j_montant']:<a class="code" href="impress__fiche_8php.html#a10">$e</a>['j_montant']*-1;
<a name="l00157"></a>00157 }
<a name="l00158"></a>00158 <span class="comment">// store sold</span>
<a name="l00159"></a>00159 <span class="comment">//---</span>
<a name="l00160"></a>00160 <a class="code" href="impress__listing__client_8php.html#a1">$a_Res</a>[<a class="code" href="client_8inc_8php.html#a1">$customer</a>]['amount']=(isset($a_Res[$customer]['amount']))?<a class="code" href="impress__listing__client_8php.html#a1">$a_Res</a>[<a class="code" href="client_8inc_8php.html#a1">$customer</a>]['amount']:0;
<a name="l00161"></a>00161 <a class="code" href="impress__listing__client_8php.html#a1">$a_Res</a>[<a class="code" href="client_8inc_8php.html#a1">$customer</a>]['amount']+=$amount;
<a name="l00162"></a>00162
<a name="l00163"></a>00163 <span class="comment">// store vat</span>
<a name="l00164"></a>00164 <span class="comment">//---</span>
<a name="l00165"></a>00165 <a class="code" href="impress__listing__client_8php.html#a1">$a_Res</a>[<a class="code" href="client_8inc_8php.html#a1">$customer</a>]['tva']=(isset($a_Res[$customer]['tva']))?<a class="code" href="impress__listing__client_8php.html#a1">$a_Res</a>[<a class="code" href="client_8inc_8php.html#a1">$customer</a>]['tva']:0;
<a name="l00166"></a>00166 <a class="code" href="impress__listing__client_8php.html#a1">$a_Res</a>[<a class="code" href="client_8inc_8php.html#a1">$customer</a>]['tva']+=$tva;
<a name="l00167"></a>00167
<a name="l00168"></a>00168 <span class="comment">// store customef info</span>
<a name="l00169"></a>00169 <span class="comment">//---</span>
<a name="l00170"></a>00170 <a class="code" href="impress__listing__client_8php.html#a1">$a_Res</a>[<a class="code" href="client_8inc_8php.html#a1">$customer</a>]['customer']=<a class="code" href="client_8inc_8php.html#a1">$customer</a>;
<a name="l00171"></a>00171
<a name="l00172"></a>00172 <span class="comment">//if not submitted to VAT, remove from list:</span>
<a name="l00173"></a>00173 <span class="comment">//STAN: currently commented out because I don't know if it is really what we need.</span>
<a name="l00174"></a>00174 <span class="comment">//Dany : yes we need it because the decla. concerns only the registered customer at the VAT </span>
<a name="l00175"></a>00175 <span class="keywordflow">if</span> (!isset($a_Res[$customer]['vat_number']) || strcmp($a_Res[$customer]['vat_number'], <span class="stringliteral">""</span>) == 0)
<a name="l00176"></a>00176 {
<a name="l00177"></a>00177 unset($a_Res[$customer]);
<a name="l00178"></a>00178 }
<a name="l00179"></a>00179
<a name="l00180"></a>00180 }<span class="comment">// foreach $a</span>
<a name="l00181"></a>00181
<a name="l00182"></a>00182 }
<a name="l00183"></a>00183 <span class="keywordflow">return</span> <a class="code" href="impress__listing__client_8php.html#a1">$a_Res</a>;
<a name="l00184"></a>00184 }
</pre></div>
<p>
</td>
</tr>
</table>
<hr><h2>Field Documentation</h2>
<a class="anchor" name="o3"></a><!-- doxytag: member="Customer::$country" ref="o3" 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">Customer::$country </td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Country
<p>
Definition at line <a class="el" href="class__customer_8php-source.html#l00043">43</a> of file <a class="el" href="class__customer_8php-source.html">class_customer.php</a>. </td>
</tr>
</table>
<a class="anchor" name="o4"></a><!-- doxytag: member="Customer::$cp" ref="o4" 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">Customer::$cp </td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Zip code
<p>
Definition at line <a class="el" href="class__customer_8php-source.html#l00044">44</a> of file <a class="el" href="class__customer_8php-source.html">class_customer.php</a>. </td>
</tr>
</table>
<a class="anchor" name="o1"></a><!-- doxytag: member="Customer::$name" 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">Customer::$<a class="el" href="ecrit__ouv_8php.html#a8">name</a> </td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
name of the company
<p>
Definition at line <a class="el" href="class__customer_8php-source.html#l00041">41</a> of file <a class="el" href="class__customer_8php-source.html">class_customer.php</a>. </td>
</tr>
</table>
<a class="anchor" name="o0"></a><!-- doxytag: member="Customer::$poste" 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">Customer::$<a class="el" href="classposte.html">poste</a> </td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
poste comptable
<p>
Definition at line <a class="el" href="class__customer_8php-source.html#l00040">40</a> of file <a class="el" href="class__customer_8php-source.html">class_customer.php</a>. </td>
</tr>
</table>
<a class="anchor" name="o2"></a><!-- doxytag: member="Customer::$street" 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">Customer::$street </td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Street
<p>
Definition at line <a class="el" href="class__customer_8php-source.html#l00042">42</a> of file <a class="el" href="class__customer_8php-source.html">class_customer.php</a>. </td>
</tr>
</table>
<a class="anchor" name="o5"></a><!-- doxytag: member="Customer::$vat_number" ref="o5" 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">Customer::$vat_number </td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
vat number
<p>
Definition at line <a class="el" href="class__customer_8php-source.html#l00045">45</a> of file <a class="el" href="class__customer_8php-source.html">class_customer.php</a>. </td>
</tr>
</table>
<hr>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="class__customer_8php-source.html">class_customer.php</a></ul>
</BODY>
</HTML>