/[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.2 by sparkyx, Thu Jun 30 19:25:44 2005 UTC revision 1.3 by sparkyx, Wed Jul 27 11:15:09 2005 UTC
# Line 111  function GetSolde($p_cond="") { Line 111  function GetSolde($p_cond="") {
111        
112    return abs($r['sum_deb']-$r['sum_cred']);    return abs($r['sum_deb']-$r['sum_cred']);
113  }  }
114      /* function GetSoldeDetail
115       * Purpose : give the balance of an account
116       *
117       * parm :
118       *      - cond
119       * gen :
120       *    - none
121       * return:
122       *      - balance of the account
123       *
124       */
125    function GetSoldeDetail($p_cond="") {
126      $Res=ExecSql($this->db,"select sum(deb) as sum_deb, sum(cred) as sum_cred from
127              ( select j_poste,
128                 case when j_debit='t' then j_montant else 0 end as deb,
129                 case when j_debit='f' then j_montant else 0 end as cred
130              from jrnx join tmp_pcmn on j_poste=pcm_val
131                  where  
132                j_poste like ('$this->id'::text) and
133                $p_cond
134              ) as m  ");
135      $Max=pg_NumRows($Res);
136      if ($Max==0) return 0;
137      $r=pg_fetch_array($Res,0);
138      
139      return array('debit'=>$r['sum_deb'],
140                   'credit'=>$r['sum_cred'],
141                   'solde'=>abs($r['sum_deb']-$r['sum_cred']));
142    }
143  }  }

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

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