noalyss Version-9
Public Member Functions | Private Attributes
Anc_Account Class Reference

Analytic account ; get the balance. More...

+ Collaboration diagram for Anc_Account:

Public Member Functions

 __construct ($p_cn, $p_id=-1)
 
 get_balance ($p_cond_sql)
 Get the balance of an Analytic account. More...
 
 get_poste_analytique_sql ()
 
 load_by_code ($p_code)
 retrieve the Analytic account thanks its code More...
 
 set_poste_analytique_sql ($poste_analytique_sql)
 

Private Attributes

 $poste_analytique_sql
 

Detailed Description

Analytic account ; get the balance.

Definition at line 30 of file anc_account.class.php.

Constructor & Destructor Documentation

◆ __construct()

Anc_Account::__construct (   $p_cn,
  $p_id = -1 
)

Definition at line 35 of file anc_account.class.php.

36 {
37 $this->poste_analytique_sql=new Poste_analytique_SQL($p_cn, $p_id);
38 }
abstract of the table public.poste_analytique

References $p_id.

Member Function Documentation

◆ get_balance()

Anc_Account::get_balance (   $p_cond_sql)

Get the balance of an Analytic account.

Parameters
string$p_cond_sqlSQL condition to filter , usually the period
See also
Impress::compute_amount
Returns
array key = credit , debit , solde

Definition at line 55 of file anc_account.class.php.

56 {
57 if ( DEBUGNOALYSS > 1)
58 {
59 tracedebug("impress.debug.log", "$p_cond_sql", 'Anc_Account->get_balance \$p_cond_sql');
60 }
61 $cn=$this->poste_analytique_sql->cn;
62 $detail=$cn->get_row("
63 select ( select coalesce (sum(oa1.oa_amount),0)
64 from operation_analytique oa1
65 where oa1.po_id=$1
66 and oa1.oa_debit='t'
67 $p_cond_sql
68 ) as debit,
69 ( select coalesce (sum(oa2.oa_amount),0)
70 from operation_analytique oa2
71 where oa2.po_id=$1
72 and oa2.oa_debit='f'
73 $p_cond_sql
74 ) as credit
75 ",[$this->poste_analytique_sql->getp("po_id")]);
76 if ( DEBUGNOALYSS > 1)
77 {
78 tracedebug("impress.debug.log", $cn->sql, 'Anc_Account->get_balance SQL executed');
79 }
80 $tdetail['credit']=$detail['credit'];
81 $tdetail['debit']=$detail['debit'];
82 $tdetail['solde']=abs(bcsub($detail['debit'],$detail['credit']));
83 return $tdetail;
84
85
86 }

References $cn, and $detail.

◆ get_poste_analytique_sql()

Anc_Account::get_poste_analytique_sql ( )

Definition at line 40 of file anc_account.class.php.

41 {
43 }

References $poste_analytique_sql.

◆ load_by_code()

Anc_Account::load_by_code (   $p_code)

retrieve the Analytic account thanks its code

Parameters
type$p_code
Returns
type

Definition at line 92 of file anc_account.class.php.

93 {
94 $cn=$this->poste_analytique_sql->cn;
95 $p_id= $cn->get_value("select po_id from poste_analytique where po_name=$1",
96 [ trim(strtoupper($p_code))]);
97 $p_id=(empty($p_id))?-1:$p_id;
98 $this->poste_analytique_sql->setp('po_id',$p_id);
99 $this->poste_analytique_sql->load();
101 }

References $cn, $p_id, and $poste_analytique_sql.

◆ set_poste_analytique_sql()

Anc_Account::set_poste_analytique_sql (   $poste_analytique_sql)

Definition at line 45 of file anc_account.class.php.

45 : void
46 {
47 $this->poste_analytique_sql=$poste_analytique_sql;
48 }

References $poste_analytique_sql.

Field Documentation

◆ $poste_analytique_sql

Anc_Account::$poste_analytique_sql
private

The documentation for this class was generated from the following file: