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

Diff of /phpcompta/include/class_poste.php

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

revision 1.1 by sparkyx, Fri Nov 26 22:05:31 2004 UTC revision 1.2 by sparkyx, Thu Jun 30 19:25:44 2005 UTC
# Line 84  class poste { Line 84  class poste {
84        }        }
85      return $this->name;      return $this->name;
86    }    }
87      /* function GetSolde
88       * Purpose : give the balance of an account
89       *
90       * parm :
91       *      - cond
92       * gen :
93       *    - none
94       * return:
95       *      - balance of the account
96       *
97       */
98    function GetSolde($p_cond="") {
99      $Res=ExecSql($this->db,"select sum(deb) as sum_deb, sum(cred) as sum_cred from
100              ( select j_poste,
101                 case when j_debit='t' then j_montant else 0 end as deb,
102                 case when j_debit='f' then j_montant else 0 end as cred
103              from jrnx join tmp_pcmn on j_poste=pcm_val
104                  where  
105                j_poste like ('$this->id'::text) and
106                $p_cond
107              ) as m  ");
108      $Max=pg_NumRows($Res);
109      if ($Max==0) return 0;
110      $r=pg_fetch_array($Res,0);
111      
112      return abs($r['sum_deb']-$r['sum_cred']);
113    }
114    
115  }  }

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

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