noalyss Version-9
Public Member Functions | Static Public Member Functions
Anc_Listing Class Reference

manage the CA listing More...

+ Inheritance diagram for Anc_Listing:
+ Collaboration diagram for Anc_Listing:

Public Member Functions

 display_csv ()
 Compute the csv export. More...
 
 display_form ($p_string="")
 Compute the form to display. More...
 
 display_html ()
 compute the html display More...
 
 get_request ()
 complete the object with the data in $_REQUEST More...
 
 load ()
 load the data from the database More...
 
 show_button ($p_string='')
 show the export button to pdf and CSV More...
 
- Public Member Functions inherited from Anc_Print
 __construct ($p_cn)
 
 check ()
 
 display_form ($p_hidden="")
 Compute the form to display. More...
 
 get_request ()
 complete the object with the data in $_REQUEST More...
 
 set_sql_filter ()
 Set the filter (account_date) More...
 

Static Public Member Functions

static test_me ()
 debugging and test function for dev. only More...
 

Additional Inherited Members

- Data Fields inherited from Anc_Print
 $db
 
 $from
 
 $from_poste
 
 $to
 
 $to_poste
 

Detailed Description

manage the CA listing

Returns

Definition at line 32 of file anc_listing.class.php.

Member Function Documentation

◆ display_csv()

Anc_Listing::display_csv ( )

Compute the csv export.

Returns
string with the csv

Definition at line 152 of file anc_listing.class.php.

153 {
154 $array=$this->load($this->from,$this->to,$this->from_poste,$this->to_poste);
155 if ( empty($array) == true )
156 {
157 return $array;
158
159 }
160 $csv=new Noalyss_Csv("anc_listing");
161 $csv->send_header();
162 $csv->write_header(array("Date","Poste","QuickCode",
163 "Activité","interne","pièce","description","montant","d/c"));
164 foreach ( $array as $row)
165 {
166 // the name and po_id
167 $csv->add($row['oa_date']);
168 $csv->add($row['j_poste']);
169 $csv->add($row['qcode']);
170 $csv->add($row['po_name']);
171 $csv->add($row['jr_internal']);
172 $csv->add($row['jr_pj_number']);
173 $csv->add($row['oa_description']);
174 $csv->add($row['oa_amount'],"number");
175 $csv->add(sprintf("'%s'",(($row['oa_debit']=='f')?'CREDIT':'DEBIT')));
176 $csv->write();
177 }
178 return;
179
180 }
$anc_grandlivre from_poste
$anc_grandlivre to
$anc_grandlivre to_poste
$anc_grandlivre from
load()
load the data from the database
Manage the CSV : manage files and write CSV record.

References $array, $csv, $row, from, from_poste, load(), to, and to_poste.

+ Here is the call graph for this function:

◆ display_form()

Anc_Listing::display_form (   $p_hidden = "")

Compute the form to display.

Parameters
$p_hiddenhidden tag to be included (gDossier,...)
Returns
string containing the data

Reimplemented from Anc_Print.

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

35 {
36 echo '<form method="get">';
37 $r=parent::display_form($p_string);
38 $r.=HtmlInput::submit('result', _('Rechercher'));
39 $r.= '</form>';
40 return $r;
41
42 }
catch(Exception $exc) if(! $g_user->can_write_action($ag_id)) $r
static submit($p_name, $p_value, $p_javascript="", $p_class="smallbutton")

References $r, and HtmlInput\submit().

+ Here is the call graph for this function:

◆ display_html()

Anc_Listing::display_html ( )

compute the html display

Returns
string

Definition at line 59 of file anc_listing.class.php.

60 {
61 $idx=0;
62 $r="";
63 //---Html
64 $array=$this->load();
65 if ( is_array($array) == false || empty($array) )
66 {
67 return 0;
68 }
69 $cred=0;$deb=0;
70 bcscale(2);
71 $r.='<div></div>';
72 $r.=_('Cherche').HtmlInput::filter_table("tb_anchop",'0,1,2,3,4,5,6,7',1);
73 $r.= '<table id="tb_anchop" class="sortable" >';
74 $r.= '<tr>'.
75 '<th class=" sorttable_sorted">'._('Date').'</th>'.
76 '<th>'._('Poste').'</th>'.
77 '<th>'._('Quick_code').'</th>'.
78 '<th>'._('Analytique').'</th>'.
79 th(_('Description')).
80 '<th>'._('libelle').'</th>'.
81 '<th>'._('Num.interne').'</th>'.
82 '<th>'._('Montant').'</th>'.
83 '<th>'._('D/C').'</th>'.
84 '</tr>';
85 foreach ( $array as $row )
86 {
87 $class=($idx%2==0)?'even':'odd';
88 $idx++;
89 $r.= '<tr class="'.$class.'">';
90 $detail=($row['jr_id'] != null)?HtmlInput::detail_op($row['jr_id'],$row['jr_internal']):'';
91 $post_detail=($row['j_poste'] != null)?HtmlInput::history_account($row['j_poste'],$row['j_poste']):'';
92 $card_detail=($row['f_id'] != null)?HtmlInput::history_card($row['f_id'],$row['qcode']):'';
93
94 $r.=
95 '<td sorttable_customkey="'.$row['str_order_date'].'">'.$row['oa_date'].'</td>'.
96 td($post_detail,' sorttable_customkey="X'.$row['j_poste'].'"').
97 td($card_detail).
98 '<td>'.HtmlInput::history_anc_account($row['po_id'],h($row['po_name'])).'</td>'.
99 '<td>'.h($row['oa_description']).'</td>'.
100 td($row['jr_comment']).
101 '<td>'.$detail.'</td>'.
102 '<td class="num" sorttable_customkey="'.$row['oa_amount'].'">'.nbm($row['oa_amount']).'</td>'.
103 '<td>'.(($row['oa_debit']=='f')?'C':'D').'</td>';
104 $r.= '</tr>';
105 if ( $row['oa_debit'] == 'f') {$cred=bcadd($cred,$row['oa_amount']);}
106 if ( $row['oa_debit'] == 't') {$deb=bcadd($deb,$row['oa_amount']);}
107 }
108
109 $r.= '</table>';
110 ob_start();
111 echo _("Total");
112 echo '<ol style="list-style:none">';
113 echo '<li>'._('Total')." ".nbm($deb).' D '.'</li>';
114 echo '<li>'._('Total')." ".nbm($cred).' C '.'</li>';
115 echo '<li>';
116 echo _('Solde');
117 $solde=abs(bcsub($deb,$cred));
118 echo $solde." ";
119 echo findSide($deb-$cred);
120 echo '<li>';
121 echo '</ol>';
122
123 $r_solde=ob_get_clean();
124
125 return $r.$r_solde;
126 }
th($p_string, $p_extra='', $raw='')
Definition: ac_common.php:58
findSide($p_number)
return D if the number is smaller than 0 , C if bigger and an empty string if equal to 0.
Definition: ac_common.php:121
td($p_string='', $p_extra='')
surround the string with td
Definition: ac_common.php:83
nbm($p_number, $p_dec=2)
format the number with a sep.
Definition: ac_common.php:137
h( $row[ 'oa_description'])
$idx
$class
static history_account($p_account, $p_mesg, $p_style="", $p_exercice="")
display a div with the history of the account
static detail_op($p_jr_id, $p_mesg)
return a string containing the html code for calling the modifyOperation
static history_card($f_id, $p_mesg, $p_style="", $p_exercice="")
display a div with the history of the card
for($i=0;$i< $nb_jrn;$i++) $deb

References $array, $class, $cred, $deb, $detail, $idx, $r, $row, $solde, HtmlInput\detail_op(), findSide(), h, HtmlInput\history_account(), HtmlInput\history_card(), load(), nbm(), td(), and th().

+ Here is the call graph for this function:

◆ get_request()

Anc_Listing::get_request ( )

complete the object with the data in $_REQUEST

Reimplemented from Anc_Print.

Definition at line 47 of file anc_listing.class.php.

48 {
49 parent::get_request();
50 $this->pa_id=(isset($_REQUEST['pa_id']))?$_REQUEST['pa_id']:"";
51 }
$anc pa_id
$_REQUEST['ac']

References $_REQUEST, and pa_id.

◆ load()

Anc_Listing::load ( )

load the data from the database

Returns
array

Definition at line 132 of file anc_listing.class.php.

133 {
134 $op=new Anc_Operation ($this->db);
135 $op->pa_id=$this->pa_id;
136 $array=$op->get_list($this->from,$this->to,$this->from_poste,$this->to_poste);
137 if (! $array )
138 {
139 $this->has_data=0;
140 }
141 else
142 {
143 $this->has_data=count($array);
144 }
145 return $array;
146 }
$op
Definition: ajax_admin.php:38
this class is used to show the form for entering an operation only FOR analytic operation to save it,...
$SecUser db

References $array, $op, $pa_id, db, from, from_poste, to, and to_poste.

Referenced by display_csv(), and display_html().

◆ show_button()

Anc_Listing::show_button (   $p_string = '')

show the export button to pdf and CSV

Parameters
$p_stringstring containing some HTML tag as hidden field

param

Returns
string containing the html code

Definition at line 191 of file anc_listing.class.php.

192 {
193 $r="";
194 $submit=HtmlInput::submit('','');
195 $hidden=new IHidden();
196 /* for the export in PDF
197 * Not yet needed, the html print should be enough
198 $r.= '<form method="GET" action="ca_list_pdf.php" style="display:inline">';
199 $r.= $p_string;
200 $r.= dossier::hidden();
201 $r.= $hidden->input("to",$this->to);
202 $r.= $hidden->input("from",$this->from);
203 $r.= $hidden->input("pa_id",$this->pa_id);
204 $r.= $hidden->input("from_poste",$this->from_poste);
205 $r.= $hidden->input("to_poste",$this->to_poste);
206 $r.=HtmlInput::submit('bt_pdf',"Export en PDF");
207 $r.= '</form>';
208 */
209
210 $r.= '<form method="GET" action="export.php" style="display:inline">';
211 $r.= HtmlInput::hidden("to",$this->to);
212 $r.= HtmlInput::hidden("from",$this->from);
213 $r.= HtmlInput::hidden("pa_id",$this->pa_id);
214 $r.= HtmlInput::hidden("from_poste",$this->from_poste);
215 $r.= HtmlInput::hidden("to_poste",$this->to_poste);
216 $r.=HtmlInput::hidden('act','CSV:AncList');
217 $r.=HtmlInput::hidden('ac',$_REQUEST['ac']);
218 $r.= $p_string;
219 $r.= dossier::hidden();
220 $r.=HtmlInput::submit('bt_csv',"Export en CSV");
221 $r.= '</form>';
222 return $r;
223
224 }
static hidden($p_name, $p_value, $p_id="")
Html Input.

References $_REQUEST, $hidden, $r, from, from_poste, HtmlInput\hidden(), pa_id, HtmlInput\submit(), to, and to_poste.

+ Here is the call graph for this function:

◆ test_me()

static Anc_Listing::test_me ( )
static

debugging and test function for dev. only

Parameters

param

Parameters

return

Definition at line 234 of file anc_listing.class.php.

235 {
236 }

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