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

compute the ageing balance, currently this code is not used More...

+ Collaboration diagram for Balance_Age:

Public Member Functions

 __construct ($p_cn)
 
 display_card ($p_date_start, $p_fiche, $p_let)
 
 display_category ($p_date_start, $p_cat, $p_let)
 
 display_purchase ($p_date_start, $p_let)
 Display all the operation for the customer. More...
 
 display_sale ($p_date_start, $p_let)
 Display all the operation for the supplier. More...
 
 export_csv ($p_date_start, $p_let)
 Export Aged Balance to CSV. More...
 
 get_array_card ($p_type, $p_extra="")
 

Private Attributes

 $cn
 

Detailed Description

compute the ageing balance, currently this code is not used

Definition at line 33 of file balance_age.class.php.

Constructor & Destructor Documentation

◆ __construct()

Balance_Age::__construct (   $p_cn)

Definition at line 38 of file balance_age.class.php.

39 {
40 $this->cn=$p_cn;
41 $this->afiche=null;
42 }
$input_from cn
Definition: balance.inc.php:66

References cn.

Member Function Documentation

◆ display_card()

Balance_Age::display_card (   $p_date_start,
  $p_fiche,
  $p_let 
)

Definition at line 94 of file balance_age.class.php.

95 {
96 $this->get_array_card('U', $p_fiche);
97 $a_fiche=$this->afiche;
98 $nb_fiche=count($a_fiche);
99 require NOALYSS_TEMPLATE.'/balance_aged_result.php';
100 }
get_array_card($p_type, $p_extra="")
$afiche[0]
Definition: fiche.inc.php:482

References $afiche, $nb_fiche, and get_array_card().

+ Here is the call graph for this function:

◆ display_category()

Balance_Age::display_category (   $p_date_start,
  $p_cat,
  $p_let 
)

Definition at line 102 of file balance_age.class.php.

103 {
104 // Get all fiche from Purchase
105
106 $this->get_array_card('X', $p_cat);
107 $a_fiche=$this->afiche;
108 $nb_fiche=count($a_fiche);
109 require NOALYSS_TEMPLATE.'/balance_aged_result.php';
110 }

References $afiche, $nb_fiche, and get_array_card().

+ Here is the call graph for this function:

◆ display_purchase()

Balance_Age::display_purchase (   $p_date_start,
  $p_let 
)

Display all the operation for the customer.

Parameters
type$p_date_startmin date of the operatin
type$p_let'unlet' only unlettered or 'let' for all

Definition at line 117 of file balance_age.class.php.

118 {
119 // Get all fiche from Purchase
120 $this->get_array_card('F');
121 $a_fiche=$this->afiche;
122 $nb_fiche=count($a_fiche);
123 require NOALYSS_TEMPLATE.'/balance_aged_result.php';
124 }

References $afiche, $nb_fiche, and get_array_card().

+ Here is the call graph for this function:

◆ display_sale()

Balance_Age::display_sale (   $p_date_start,
  $p_let 
)

Display all the operation for the supplier.

Parameters
type$p_date_startmin date of the operatin
type$p_let'unlet' only unlettered or 'let' for all

Definition at line 131 of file balance_age.class.php.

132 {
133 // Get all fiche from Purchase
134 $this->get_array_card('C');
135 $a_fiche=$this->afiche;
136 $nb_fiche=count($a_fiche);
137 require NOALYSS_TEMPLATE.'/balance_aged_result.php';
138 }

References $afiche, $nb_fiche, and get_array_card().

+ Here is the call graph for this function:

◆ export_csv()

Balance_Age::export_csv (   $p_date_start,
  $p_let 
)

Export Aged Balance to CSV.

Parameters
$p_date_startdate DD.MM.YYYY
type$p_letunlet for unlettered operations

Definition at line 144 of file balance_age.class.php.

145 {
146 bcscale(2);
147 $export=new Noalyss_Csv('aged_balance');
148 $header = array(_('QuickCode') ,
149 _('Nom'),
150 _('Prénom'),
151 _('Date'),
152 _('N° pièce'),
153 _('Interne'),
154 _('Fin'),
155 _('<30 jours'),
156 _('entre 30 et 60 jours'),
157 _('entre 60 et 90 jours'),
158 _('> 90 jours') );
159 $export->send_header();
160 $export->write_header($header);
161
162
163 $nb_fiche=count($this->afiche);
164
165 for ($i=0; $i<$nb_fiche; $i++)
166 {
167 $card=new Lettering_Card($this->cn, $this->afiche[$i]['quick_code']);
168 $card->set_parameter('start', $p_date_start);
169 $card->get_balance_ageing($p_let);
170 if (empty($card->content))
171 continue;
172 $nb_row=count($card->content);
173 $sum_lt_30=0;
176 $sum_gt_90=0;
177 $sum_fin=0;
178 for ($j=0; $j<$nb_row; $j++)
179 {
180 $show=true;
181 $export->add($this->afiche[$i]['quick_code']);
182 $export->add($this->afiche[$i]['name']);
183 $export->add($this->afiche[$i]['first_name']);
184 $export->add($card->content[$j]['j_date_fmt']);
185 $export->add($card->content[$j]['jr_pj_number']);
186 $export->add($card->content[$j]['jr_internal']);
187 if ($card->content[$j]['jrn_def_type']=='FIN'||$card->content[$j]['jrn_def_type']=='ODS')
188 {
189 $export->add($card->content[$j]['j_montant'],"number");
190 $sum_fin=bcadd($sum_fin, $card->content[$j]['j_montant']);
191 $show=false;
192 }
193 else
194 {
195 $export->add(0,'number');
196 }
197 if ($show&&$card->content[$j]['day_paid']<=30)
198 {
199 $export->add($card->content[$j]['j_montant'],"number");
200 $sum_lt_30=bcadd($sum_lt_30, $card->content[$j]['j_montant']);
201 $show=false;
202 }
203 else
204 {
205 $export->add(0,'number');
206 }
207
208 if ($show&&$card->content[$j]['day_paid']>30&&$card->content[$j]['day_paid']<=60)
209 {
210 $export->add($card->content[$j]['j_montant'],"number");
211 $sum_gt_30_lt_60=bcadd($sum_gt_30_lt_60, $card->content[$j]['j_montant']);
212 }
213 else
214 {
215 $export->add(0,'number');
216 }
217
218 if ($show&&$card->content[$j]['day_paid']>60&&$card->content[$j]['day_paid']<=90)
219 {
220 $export->add($card->content[$j]['j_montant'],"number");
221 $sum_gt_60_lt_90=bcadd($sum_gt_60_lt_90, $card->content[$j]['j_montant']);
222 }
223 else
224 {
225 $export->add(0,'number');
226 }
227 if ($show&&$card->content[$j]['day_paid']>90)
228 {
229 $export->add($card->content[$j]['j_montant'],"number");
230 $sum_gt_90=bcadd($sum_gt_90, $card->content[$j]['j_montant']);
231 }
232 else
233 {
234 $export->add(0,'number');
235 }
236 $export->write();
237 }
238 $export->add(_('Totaux'));
239 $export->add("");
240 $export->add("");
241 $export->add("");
242 $export->add("");
243 $export->add("");
244 $export->add($sum_fin,"number");
245 $export->add($sum_lt_30,"number");
246 $export->add($sum_gt_30_lt_60,"number");
247 $export->add($sum_gt_60_lt_90,"number");
248 $export->add($sum_gt_90,"number");
249 $export->write();
250
251
252 }
253 }
$sum_gt_30_lt_60
for($j=0;$j< $nb_row;$j++)($j%2==0)? 'even' $show
$sum_gt_60_lt_90
only for operation retrieved thanks a quick_code manage the accounting entries for a given card
Manage the CSV : manage files and write CSV record.
if(count($a_accounting)==0) $header

References $card, $export, $header, $i, $nb_fiche, $nb_row, $p_let, $show, $sum_fin, $sum_gt_30_lt_60, $sum_gt_60_lt_90, $sum_gt_90, $sum_lt_30, and cn.

◆ get_array_card()

Balance_Age::get_array_card (   $p_type,
  $p_extra = "" 
)

Definition at line 44 of file balance_age.class.php.

45 {
46 switch ($p_type)
47 {
48 case 'X':
49 $this->afiche=$this->cn->get_array("
50 with m as (select distinct qp_supplier as f_id from quant_purchase union select qs_client from quant_sold)
51 select distinct fiche.f_id as f_id ,f1.ad_value as name, f3.ad_value as first_name,f2.ad_value as quick_code
52 from fiche
53 join m on (fiche.f_id=m.f_id)
54 join fiche_detail as f1 on (fiche.f_id=f1.f_id and f1.ad_id=1)
55 join fiche_detail as f2 on (fiche.f_id=f2.f_id and f2.ad_id=23)
56 left join fiche_detail as f3 on (fiche.f_id=f3.f_id and f3.ad_id=32)
57 where
58 fiche.fd_id=$1
59 order by f1.ad_value
60 ", array($p_extra));
61 break;
62 case 'U':
63 $fiche=new Fiche($this->cn, $p_extra);
64 $this->afiche[0]['f_id']=$fiche->id;
65 $this->afiche[0]['quick_code']=$fiche->get_quick_code();
66 $this->afiche[0]['name']=$fiche->strAttribut(ATTR_DEF_NAME, 0);
67 $this->afiche[0]['first_name']=$fiche->strAttribut(ATTR_DEF_FIRST_NAME, 0);
68 break;
69 case 'F':
70 $this->afiche=$this->cn->get_array("
71 select distinct qp_supplier as f_id ,f1.ad_value as name, f3.ad_value as first_name,f2.ad_value as quick_code
72 from quant_purchase join
73 fiche_detail as f1 on (qp_supplier=f1.f_id and f1.ad_id=1)
74 join fiche_detail as f2 on (qp_supplier=f2.f_id and f2.ad_id=23)
75 left join fiche_detail as f3 on (qp_supplier=f3.f_id and f3.ad_id=32)
76 order by f1.ad_value
77 ");
78 break;
79 case 'C':
80 $this->afiche=$this->cn->get_array("
81 select distinct qs_client as f_id ,f1.ad_value as name, f3.ad_value as first_name,f2.ad_value as quick_code
82 from quant_sold join
83 fiche_detail as f1 on (qs_client=f1.f_id and f1.ad_id=1)
84 join fiche_detail as f2 on (qs_client=f2.f_id and f2.ad_id=23)
85 left join fiche_detail as f3 on (qs_client=f3.f_id and f3.ad_id=32)
86 order by f1.ad_value
87 ");
88 break;
89 default:
90 throw new Exception('Type invalide');
91 }
92 }
define Class fiche and fiche def, those class are using class attribut. When adding or modifing new c...
Definition: fiche.class.php:38
const ATTR_DEF_NAME
Definition: constant.php:216
const ATTR_DEF_FIRST_NAME
Definition: constant.php:238

References $fiche, $p_type, ATTR_DEF_FIRST_NAME, ATTR_DEF_NAME, and cn.

Referenced by display_card(), display_category(), display_purchase(), and display_sale().

Field Documentation

◆ $cn

Balance_Age::$cn
private

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


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