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

manage the operation in currency : export CSV , output in HTML More...

+ Collaboration diagram for Print_Operation_Currency:

Public Member Functions

 __construct (Data_Currency_Operation $data_operation)
 
 export_csv (Noalyss_CSV $export)
 Output in CSV. More...
 
 export_html ()
 Display in HTML. More...
 
 getData_operation ()
 return Data_Currency_Operation with a possible filter More...
 
 setData_operation ($data_operation)
 return Data_Currency_Operation with a possible filter More...
 

Static Public Member Functions

static build ($p_search)
 build a Print_Operation_Currency Object thanks the http request ($_REQUEST) with the right Filter More...
 

Private Attributes

 $data_operation
 

Detailed Description

manage the operation in currency : export CSV , output in HTML

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

Constructor & Destructor Documentation

◆ __construct()

Print_Operation_Currency::__construct ( Data_Currency_Operation  $data_operation)

Definition at line 36 of file print_operation_currency.class.php.

37 {
38 $this->data_operation=$data_operation;
39 }

References $data_operation.

Member Function Documentation

◆ build()

static Print_Operation_Currency::build (   $p_search)
static

build a Print_Operation_Currency Object thanks the http request ($_REQUEST) with the right Filter

Parameters
string$p_searchpossible values are "by_card" if we filter by card, by_account if we filter by accounting, by_category or empty if we take everything

Definition at line 48 of file print_operation_currency.class.php.

49 {
50 $http=new HttpInput();
51 $from_account=$http->request("from_account", "string", "");
52 $to_account=$http->request("to_account", "string", "");
53 $currency_code=$http->request("p_currency_code", "string", "0");
54 $from_date=$http->request("from_date", "date", "");
55 $to_date=$http->request("to_date", "date", "");
56 $card=$http->request("card","string","");
57 $card_category_id=$http->request("card_category_id","string","0");
59 if ($p_search=='by_card')
60 {
62 }
63 elseif ($p_search=='by_accounting')
64 {
66 $to_date,$currency_code,$from_account,$to_account);
67 }
68 elseif ($p_search=="by_category")
69 {
71 $currency_code,$card_category_id);
72 }
73 elseif ($p_search=="all")
74 {
76 }
77 else
78 {
79 throw new Exception("PROC67 Invalid parameter");
80 }
81
84 }
build the SQL and fetch data of data currency operation from database ,
static connect()
filter data in currency from datase , inherit from Data_Currency_Operation, filter on a range of acco...
filter data in currency from datase , inherit from Data_Currency_Operation, filter on card category
filter data in currency froqm datase , inherit from Data_Currency_Operation, filter on a specific car...
manage the http input (get , post, request) and extract from an array
manage the operation in currency : export CSV , output in HTML
$print_operation_currency
if( $delta< 0) elseif( $delta==0)

References $card, $cn, $data_operation, $from_account, $from_date, $http, $print_operation_currency, $to_account, $to_date, Dossier\connect(), and elseif.

+ Here is the call graph for this function:

◆ export_csv()

Print_Operation_Currency::export_csv ( Noalyss_CSV  $export)

Output in CSV.

Definition at line 167 of file print_operation_currency.class.php.

168 {
169 $aData=$this->data_operation->get_data();
170
171 $date=_("Date");
172 $accounting=_("Poste comptable");
173 $card_qcode=_("Fiche");
174 $receipt=_("Pièce");
175 $internal=_("Internal");
176 $comment=_("Libellé");
177 $amount=_("Montant");
178 $amount_currency=_("Mont. Devise");
179 $rate_ref=_("Taux de référence");
180 $rate=_("Taux utilisé");
181 $currency=_("Devise");
182
183 $export->write_header(array ($date,
185 $card_qcode,
186 $receipt,
187 $comment,
188 $internal,
189 $currency,
190 $amount,
191 $rate,
192 $rate_ref,
193 $amount_currency));
194 $nb_data=count($aData);
195 for ($i=0;$i<$nb_data;$i++)
196 {
197 $export->add($aData[$i]['j_date']);
198 $export->add($aData[$i]['j_poste']);
199 $export->add($aData[$i]['fiche_qcode']);
200 $export->add($aData[$i]['jr_pj_number']);
201 $export->add($aData[$i]['jr_comment']);
202 $export->add($aData[$i]['jr_internal']);
203 $export->add($aData[$i]['currency_code_iso']);
204 $export->add(nbm($aData[$i]['j_montant'],2),"number");
205 $export->add(round($aData[$i]['currency_rate'],4),"number");
206 $export->add(round($aData[$i]['currency_rate_ref'],4),"number");
207 $export->add(nbm($aData[$i]['oc_amount'],4),"number");
208 $export->write();
209 }
210 }
nbm($p_number, $p_dec=2)
format the number with a sep.
Definition: ac_common.php:137

References $accounting, $amount, $currency, $date, $export, $i, $nb_data, $receipt, and nbm().

+ Here is the call graph for this function:

◆ export_html()

Print_Operation_Currency::export_html ( )

Display in HTML.

Returns
string

Definition at line 106 of file print_operation_currency.class.php.

107 {
108 $aData=$this->data_operation->get_data();
109 if ( empty ($aData)){
110 return h2(_("Aucune donnée"),'class="error"');
111 }
112 $date=_("Date");
113 $accounting=_("Poste comptable");
114 $card_qcode=_("Fiche");
115 $receipt=_("Pièce");
116 $internal=_("Internal");
117 $comment=_("Libellé");
118 $amount=_("Montant");
119 $amount_currency=_("Mont. Devise");
120 $rate_ref=_("Taux de référence");
121 $rate=_("Taux utilisé");
122 $currency=_("Devise");
123 $r=HtmlInput::filter_table("pcur01_tb", '0,1,2,3,4,5,6,7,8,9,10', 1);
124 $r.=<<<EOF
125<table id="pcur01_tb" class="result">
126<tr>
127 <th>{$date}</th>
128 <th>{$accounting}</th>
129 <th>{$card_qcode}</th>
130 <th>{$receipt}</th>
131 <th>{$comment}</th>
132 <th>{$internal}</th>
133 <th>{$currency}</th>
134 <th class="num">{$amount}</th>
135 <th class="num">{$rate}</th>
136 <th class="num">{$rate_ref}</th>
137 <th class="num">{$amount_currency}</th>
138</tr>
139
140EOF;
141 $nb_data=count($aData);
142 for ($i=0;$i<$nb_data;$i++)
143 {
144 $r.="<tr>";
145 $r.=td($aData[$i]['j_date']);
146 $r.=td($aData[$i]['j_poste']);
147 $r.=td($aData[$i]['fiche_qcode']);
148 $r.=td($aData[$i]['jr_pj_number']);
149 $r.=td($aData[$i]['jr_comment']);
150 $r.="<td>";
151 $r.=HtmlInput::detail_op($aData[$i]['jr_id'], $aData[$i]['jr_internal']);
152 $r.="</td>";
153 $r.=td($aData[$i]['currency_code_iso']);
154 $r.=td(nbm($aData[$i]['j_montant'],2),'class="num"');
155 $r.=td(round($aData[$i]['currency_rate'],4),'class="num"');
156 $r.=td(round($aData[$i]['currency_rate_ref'],4),'class="num"');
157 $r.=td(nbm($aData[$i]['oc_amount'],4),'class="num"');
158 $r.="</tr>";
159 }
160 $r.="</table>";
161 return $r;
162
163 }
h2($p_string, $p_class="", $raw="")
Definition: ac_common.php:68
th($p_string, $p_extra='', $raw='')
Definition: ac_common.php:58
tr($p_string, $p_extra='')
Definition: ac_common.php:88
td($p_string='', $p_extra='')
surround the string with td
Definition: ac_common.php:83
catch(Exception $exc) if(! $g_user->can_write_action($ag_id)) $r
static detail_op($p_jr_id, $p_mesg)
return a string containing the html code for calling the modifyOperation
static filter_table($p_table_id, $p_col, $start_row)
filter the rows in a table and keep the colored row in alternance
$all table

References $accounting, $amount, $currency, $date, $i, $nb_data, $r, $receipt, HtmlInput\detail_op(), HtmlInput\filter_table(), h2(), nbm(), table, td(), th(), and tr().

+ Here is the call graph for this function:

◆ getData_operation()

Print_Operation_Currency::getData_operation ( )

return Data_Currency_Operation with a possible filter

Returns
type

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

90 {
92 }

References $data_operation.

◆ setData_operation()

Print_Operation_Currency::setData_operation (   $data_operation)

return Data_Currency_Operation with a possible filter

Returns
type

Definition at line 98 of file print_operation_currency.class.php.

99 {
100 $this->data_operation=$data_operation;
101 }

References $data_operation.

Field Documentation

◆ $data_operation

Print_Operation_Currency::$data_operation
private

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