noalyss Version-9
anticipation-display.php
Go to the documentation of this file.
1<?php
2//This file is part of NOALYSS and is under GPL
3//see licence.txt
4?><h1><?php echo $str_name;?></h1>
5Période du <?php echo $str_start?> à <?php echo $str_end;?>
6<?php for ($i=0;$i<count($aCat);$i++): // foreach category ?>
7<?php if (count($aItem[$i])==0) continue;?>
8<fieldset>
9<legend>
10<?php echo $aCat[$i]['fc_desc'];$tot_cat_estm=0;$tot_cat_real=0;$tot_cum_real=0;$tot_cum_estm=[];?>
11</legend>
12
13<?php for ($e=0;$e<count($aItem[$i]);$e++):?>
14<table class="result" style="margin-bottom:3px">
15<tr>
16<td>
17 <?php echo '<h2>'.h($aItem[$i][$e]['fi_text']).'</h2>';?>
18</td>
19</tr>
20<tr>
21<td>
22<table width="100%">
23<tr >
24<td style="font-weight:bold;border:1px solid black">
25<?php echo _('Période')?></td>
26<?php for ($h=0;$h<count($aPeriode);$h++):?>
27<td style="text-align:center;font-weight:bold;border:1px solid black">
28<?php echo $aPeriode[$h]['myear'];?>
29</td>
30<?php endfor;?>
31<td style="text-align:center;font-weight:bold;border:1px solid black;"><?php echo _('Totaux');?></td>
32</tr>
33
34<tr>
35<td>
36<?php echo _('Estimé');$tot_estm=0;?>
37</td>
38<?php for ($h=0;$h<count($aPeriode);$h++):?>
39<td style="text-align:right;">
40<?php
41$amount=$aItem[$i][$e]['fi_amount'];
43// -- if first periode , get the initial amou
44if ( $h == 0 ) {
45 $amount_initial=$aItem[$i][$e]['fi_amount_initial'];
46}
47if (count($aPerMonth[$i]) != 0 ){
48 for ($x=0;$x<count($aPerMonth[$i]);$x++) {
49 if (DEBUGNOALYSS>1) {
50 printf (" \$aItem [$i] [$e] = %s",$aItem[$i][$e]['fi_amount']);
51 echo p("\$aPeriode[$h]['p_id']==\$aPerMonth[$i][$x]['fi_pid'] ".
52 $aPeriode[$h]['p_id']."==".$aPerMonth[$i][$x]['fi_pid'] );
53
54
55 echo p( " \$aItem[$i][$e]['fi_account']==\$aPerMonth[$i][$x]['fi_account']".
56 $aItem[$i][$e]['fi_account']."==".$aPerMonth[$i][$x]['fi_account']);
57 if ($aPeriode[$h]['p_id']==$aPerMonth[$i][$x]['fi_pid']) {
58 echo p("\$aPeriode[$h]['p_id']==\$aPerMonth[$i][$x]['fi_pid'] YES");
59 } else {
60 echo p("\$aPeriode[$h]['p_id']==\$aPerMonth[$i][$x]['fi_pid'] NO");
61 }
62
63 if ($aItem[$i][$e]['fi_account']==$aPerMonth[$i][$x]['fi_account']) {
64 echo p("\$aItem[$i][$e]['fi_account']==\$aPerMonth[$i][$x]['fi_account']YES");
65 } else {
66 echo p("\$aItem[$i][$e]['fi_account']==\$aPerMonth[$i][$x]['fi_account']NO");
67 }
68 echo p("\$aItem[$i][$e]['fi_account'] [".$aItem[$i][$e]['fi_account']."]");
69 echo p("\$aPerMonth[$i][$x]['fi_account'] [".$aPerMonth[$i][$x]['fi_account']."]");
70 }
71 $amount=$aItem[$i][$e]['fi_amount'];
72 if (
73 $aPeriode[$h]['p_id']==$aPerMonth[$i][$x]['fi_pid'] &&
74 trim($aItem[$i][$e]['fi_account'])==trim($aPerMonth[$i][$x]['fi_account'])
75 )
76 {
77 $amount=$aPerMonth[$i][$x]['fi_amount'];
78 if ( DEBUGNOALYSS > 1 ){
79 echo p("\$aPerMonth[$i][$x]['fi_amount']".$aPerMonth[$i][$x]['fi_amount']);
80 echo "\$amount = $amount ";
81 }
82 break;
83 }
84 }
85}
88echo nbm( $amount);
92?>
93
94</td>
95<?php endfor;?>
96<td style="text-align:right">
97<?php echo nbm($tot_estm);?>
98</td>
99</tr>
100
101
102<tr>
103<td>
104<?php echo _('Réel');$tot=0;?>
105</td>
106<?php for ($h=0;$h<count($aPeriode);$h++):?>
107<td align="right">
108 <?php echo nbm( $aReal[$i][$e][$h]);
109 $tot_cat_real=bcadd($tot_cat_real,$aReal[$i][$e][$h]);
110 $tot=bcadd($tot,$aReal[$i][$e][$h]);?>
111</td>
112<?php endfor;?>
113<td align="right">
114<?php echo nbm( $tot);?>
115</td>
116</tr>
117<tr>
118 <td>
119 <?=_('Total estimé')?>
120 </td>
121 <?php
122 /// row about cum. estimate amount
123 for ($h=0;$h<count($aPeriode);$h++):
124 ?>
125 <td class="num">
126 <?=nbm($tot_cum_estm[$h])?>
127 </td>
128 <?php
129 endfor;
130 ?>
131</tr>
132
133<tr>
134 <td>
135 <?php echo _('Total réel');
136
137 $tot_cat_real = 0;
138 ?>
139 </td>
140 <?php for ($h = 0; $h < count($aPeriode); $h++):?>
141 <td align="right">
142 <?php
143 $tot_cat_real = bcadd($tot_cat_real, $aReal[$i][$e][$h]);
144 $tot_cum_real=bcadd($tot_cum_real,$aReal[$i][$e][$h]);
145 echo nbm($tot_cat_real);
146 ?>
147 </td>
148 <?php endfor;?>
149
150</tr>
151<tr>
152<td>
153<?php echo _('Différence');?>
154</td>
155<?php for ($h=0;$h<count($aPeriode);$h++):?>
156
157 <?php
158 $diff= bcsub( $aReal[$i][$e][$h],$estm[$i][$e][$h]);
159 if ($diff==0)
160 {
161 echo '<td style="text-align:right;">';
162 }
163elseif ( $aItem[$i][$e]['fi_account']!="" && $diff > 0 )
164 {
165 echo '<td style="text-align:right;background-color:green;color:white">';
166 }
167 elseif ( $aItem[$i][$e]['fi_account']!="" && $diff < 0 ) {
168 echo '<td style="text-align:right;background-color:red;color:white">';
169
170 }
171 else {
172 echo '<td style="text-align:right;background-color:green;color:white">';
173 }
174
175
176echo nbm( $diff);
177?>
178</td>
179<?php endfor;?>
180</tr>
181<tr>
182<td>
183<?php echo _('Diff. cumul.'); $cum=0.0; ?>
184</td>
185<?php $strColorCell="";?>
186<?php for ($h=0;$h<count($aPeriode);$h++):?>
187
188<?php
189 $diff= bcsub($aReal[$i][$e][$h],$estm[$i][$e][$h]);
190$cum=bcadd($diff,$cum);
191
192if ($cum ==0)
193 {
194 $strColorCell= '<td style="text-align:right;">';
195 }
196
197elseif ($cum > 0)
198 {
199 $strColorCell= '<td style="text-align:right;background-color:green;color:white">';
200 }
201else {
202 $strColorCell= '<td style="text-align:right;background-color:red;color:white">';
203}
204echo $strColorCell;
205echo nbm( $cum);
206?>
207</td>
208<?php endfor;?>
209<?php
210 echo $strColorCell;
211 echo nbm( $cum);
212?>
213</td>
214</tr>
215
216
217</table>
218</td>
219</tr>
220<?php endfor;?>
221</table>
222
223<table>
224<tr>
225<?php echo td(_('Total Catégorie estimé'));echo td(nbm($tot_cat_estm),'num');?>
226</tr>
227<tr>
228<?php echo td(_('Total Catégorie réel'));echo td(nbm($tot_cum_real),'num');?>
229</tr>
230<tr>
231<?php echo td(_('Différence'));echo td(nbm($tot_cum_real-$tot_cat_estm),'num');?>
232</tr>
233</table>
234</fieldset>
235
236
237<?php endfor;?>
238<?php if ( ! empty ($error) ) : ?>
239<div class="error">
240Désolé il y a des formules incorrectes
241<ul style="list-style-type:none">
242
243 <?php $last="";?>
244 <?php for ($i=0;$i<count($error);$i++) : ?>
245<?php
246 if ( $last != $error[$i] ) { echo h($error[$i]); }
248endfor;
249?>
250</ul>
251</div>
252<?php endif; ?>
h1($p_string, $p_class="")
Definition: ac_common.php:72
tr($p_string, $p_extra='')
Definition: ac_common.php:88
p($p_string)
Definition: ac_common.php:39
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
return false Description text align
h( $row[ 'oa_description'])
$opd_description style
$estm[$i][$e][$h]
if(! empty( $error)) for($i=0;$i< count($error);$i++)( $last !=$error[$i]) $last
for($h=0;$h< count($aPeriode);$h++) $amount_initial
if($h==0) if(count($aPerMonth[$i]) !=0) $amount
$all table
if( $delta< 0) elseif( $delta==0)
$desc width