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

build the SQL and fetch data of data currency operation from database , More...

+ Inheritance diagram for Data_Currency_Operation:
+ Collaboration diagram for Data_Currency_Operation:

Public Member Functions

 __construct ($cn, $from_date="", $to_date="", $currency_id=0)
 
 build_SQL ()
 build the SQL to execute More...
 
 get_data ()
 returns data More...
 
 getCurrency_id ()
 retrieve currency.od More...
 
 getDbconx ()
 Database connection. More...
 
 getFrom_date ()
 
 getTo_date ()
 
 setCurrency_id ($currency_id)
 retrieve currency.od More...
 
 setDbconx ($dbconx)
 
 setFrom_date ($from_date)
 
 setTo_date ($to_date)
 
 SQL_Condition ()
 build the SQL condition More...
 
 to_currency_code ()
 retrieve the currency code More...
 

Private Attributes

 $currency_id
 
 $dbconx
 
 $from_date
 
 $to_date
 

Detailed Description

build the SQL and fetch data of data currency operation from database ,

Definition at line 31 of file data_currency_operation.class.php.

Constructor & Destructor Documentation

◆ __construct()

Data_Currency_Operation::__construct (   $cn,
  $from_date = "",
  $to_date = "",
  $currency_id = 0 
)

Definition at line 39 of file data_currency_operation.class.php.

40 {
41 global $g_user;
42 $this->dbconx=$cn;
43 $this->currency_id=$currency_id;
44
45 $periode_limit=$g_user->get_limit_current_exercice();
46 $this->from_date=($from_date=="")?$periode_limit[0]:$from_date;
47 $this->to_date=($to_date=="")?$periode_limit[1]:$to_date;
48 }
global $g_user
if no group available , then stop

References $cn, $currency_id, $from_date, $g_user, and $to_date.

Member Function Documentation

◆ build_SQL()

Data_Currency_Operation::build_SQL ( )

build the SQL to execute

Definition at line 110 of file data_currency_operation.class.php.

111 {
112 $sql=" select jr_id,
113 j_date,
114 j_montant,
115 coalesce(oc_amount,0) oc_amount,
116 j_poste,
117 jr_comment,
118 jr_internal,
119 jr_pj_number,
120 jrn.currency_id,
121 (select cr_code_iso from currency c where c.id=jrn.currency_id) as currency_code_iso,
122 coalesce (currency_rate,1) currency_rate,
123 coalesce (currency_rate_ref,1) currency_rate_ref,
124 f_id,
125 (select ad_value from fiche_detail fd1 where fd1.f_id=jrnx.f_id and ad_id=23) as fiche_qcode
126 from jrnx
127 join jrn on (jr_grpt_id=jrnx.j_grpt)
128 join operation_currency oc using (j_id)
129 join jrn_def on (jr_def_id=jrn_def.jrn_def_id)
130 ";
131 $sql.=$this->SQL_Condition();
132
133 $sql.=" order by j_poste,j_date ";
134
135 return $sql;
136 }
SQL_Condition()
build the SQL condition

References $sql, and SQL_Condition().

Referenced by get_data(), Filter_Data_Currency_Accounting\get_data(), Filter_Data_Currency_Card\get_data(), and Filter_Data_Currency_Card_Category\get_data().

+ Here is the call graph for this function:

◆ get_data()

Data_Currency_Operation::get_data ( )

returns data

Returns
array

Reimplemented in Filter_Data_Currency_Accounting, Filter_Data_Currency_Card, and Filter_Data_Currency_Card_Category.

Definition at line 155 of file data_currency_operation.class.php.

156 {
157 $sql=$this->build_SQL();
158 $aArray=$this->dbconx->get_array($sql, [$this->getCurrency_id(), $this->getFrom_date(),$this->getTo_date()]);
159
160 return $aArray;
161 }
build_SQL()
build the SQL to execute

References $sql, build_SQL(), getCurrency_id(), getFrom_date(), and getTo_date().

+ Here is the call graph for this function:

◆ getCurrency_id()

Data_Currency_Operation::getCurrency_id ( )

◆ getDbconx()

Data_Currency_Operation::getDbconx ( )

◆ getFrom_date()

Data_Currency_Operation::getFrom_date ( )

◆ getTo_date()

Data_Currency_Operation::getTo_date ( )

◆ setCurrency_id()

Data_Currency_Operation::setCurrency_id (   $currency_id)

retrieve currency.od

Definition at line 89 of file data_currency_operation.class.php.

90 {
91 $this->currency_id=$currency_id;
92 }

References $currency_id.

◆ setDbconx()

Data_Currency_Operation::setDbconx (   $dbconx)

Definition at line 101 of file data_currency_operation.class.php.

102 {
103 $this->dbconx=$dbconx;
104 return $this;
105 }

References $dbconx.

◆ setFrom_date()

Data_Currency_Operation::setFrom_date (   $from_date)

Definition at line 76 of file data_currency_operation.class.php.

77 {
78 $this->from_date=$from_date;
79 }

References $from_date.

◆ setTo_date()

Data_Currency_Operation::setTo_date (   $to_date)

Definition at line 81 of file data_currency_operation.class.php.

82 {
83 $this->to_date=$to_date;
84 }

References $to_date.

◆ SQL_Condition()

Data_Currency_Operation::SQL_Condition ( )

build the SQL condition

Returns
SQL condition

Reimplemented in Filter_Data_Currency_Accounting, Filter_Data_Currency_Card, and Filter_Data_Currency_Card_Category.

Definition at line 142 of file data_currency_operation.class.php.

143 {
144 global $g_user;
145
146 return " where jrn.currency_id = $1 and ".$g_user->get_ledger_sql('ALL', 3)
147 ." and jr_date >= to_date($2,'DD.MM.YYYY')"
148 ." and jr_date <= to_date($3,'DD.MM.YYYY')"
149 ;
150 }

References $g_user.

Referenced by build_SQL().

◆ to_currency_code()

Data_Currency_Operation::to_currency_code ( )

retrieve the currency code

Returns
string ISO CODE

Definition at line 53 of file data_currency_operation.class.php.

54 {
55 $currency_code=$this->dbconx->get_value("select cr_code_iso from currency where id=$1",[$this->currency_id]);
56 return $currency_code;
57 }

Field Documentation

◆ $currency_id

Data_Currency_Operation::$currency_id
private

◆ $dbconx

Data_Currency_Operation::$dbconx
private

Definition at line 34 of file data_currency_operation.class.php.

Referenced by getDbconx(), and setDbconx().

◆ $from_date

Data_Currency_Operation::$from_date
private

◆ $to_date

Data_Currency_Operation::$to_date
private

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