noalyss  Version-8.1
forecast_result.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>
5 Pé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;?>
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'];
42 if (count($aPerMonth[$i]) != 0 ){
43  for ($x=0;$x<count($aPerMonth[$i]);$x++) {
44  $amount=$aItem[$i][$e]['fi_amount'];
45  if ($aPeriode[$h]['p_id']==$aPerMonth[$i][$x]['fi_pid'] &&
46  $aItem[$i][$e]['fi_card']==$aPerMonth[$i][$x]['fi_card'] &&
47  $aItem[$i][$e]['fi_account']==$aPerMonth[$i][$x]['fi_account']
48  )
49  {
50  $amount=$aPerMonth[$i][$x]['fi_amount'];
51  break;
52  }
53  }
54 }
56 echo nbm( $amount);
57 
60 ?>
61 
62 </td>
63 <?php endfor;?>
64 <td style="text-align:right">
65 <?php echo nbm($tot_estm);?>
66 </td>
67 </tr>
68 
69 <tr>
70 <td>
71 <?php echo _('Réel');$tot=0;?>
72 </td>
73 <?php for ($h=0;$h<count($aPeriode);$h++):?>
74 <td align="right">
75  <?php echo nbm( $aReal[$i][$e][$h]);$tot_cat_real=bcadd($tot_cat_real,$aReal[$i][$e][$h]);$tot=bcadd($tot,$aReal[$i][$e][$h]);?>
76 </td>
77 <?php endfor;?>
78 <td align="right">
79 <?php echo nbm( $tot);?>
80 </td>
81 </tr>
82  <tr>
83  <td>
84  <?php echo _('Total réel');
85 
86  $tot_cat_real = 0;
87  ?>
88  </td>
89  <?php for ($h = 0; $h < count($aPeriode); $h++):?>
90  <td align="right">
91  <?php
92  $tot_cat_real = bcadd($tot_cat_real, $aReal[$i][$e][$h]);
93  $tot_cum_real=bcadd($tot_cum_real,$aReal[$i][$e][$h]);
94  echo nbm($tot_cat_real);
95  ?>
96  </td>
97  <?php endfor;?>
98 
99  </tr>
100 <tr>
101 <td>
102 <?php echo _('Différence');?>
103 </td>
104 <?php for ($h=0;$h<count($aPeriode);$h++):?>
105 
106  <?php
107  $diff= bcsub( $aReal[$i][$e][$h],$estm[$i][$e][$h]);
108 if ( ($aItem[$i][$e]['fi_debit'] == 'C' && $diff < 0) || ($aItem[$i][$e]['fi_debit'] == 'D' && $diff > 0))
109  {
110  echo '<td style="text-align:right;background-color:red;color:white">';
111  }
112 else if ($diff==0)
113  {
114  echo '<td style="text-align:right;">';
115  }
116 else
117  {
118  echo '<td style="text-align:right;background-color:green;color:white">';
119  }
120 
121 echo nbm( $diff);
122 ?>
123 </td>
124 <?php endfor;?>
125 </tr>
126 <tr>
127 <td>
128 <?php echo _('Diff. cumul.'); $cum=0.0; ?>
129 </td>
130 <?php for ($h=0;$h<count($aPeriode);$h++):?>
131 
132 <?php
133  $diff= bcsub($aReal[$i][$e][$h],$estm[$i][$e][$h]);
134 $cum=bcadd($diff,$cum);
135 if ( ($aItem[$i][$e]['fi_debit'] == 'C' && $cum < 0) || ($aItem[$i][$e]['fi_debit'] == 'D' && $cum > 0))
136  {
137  echo '<td style="text-align:right;background-color:red;color:white">';
138  }
139 else if ($cum ==0)
140  {
141  echo '<td style="text-align:right;">';
142  }
143 
144 else
145  {
146  echo '<td style="text-align:right;background-color:green;color:white">';
147  }
148 
149 echo nbm( $cum);
150 ?>
151 </td>
152 <?php endfor;?>
153 <?php
154 if ( ($aItem[$i][$e]['fi_debit'] == 'C' && $cum < 0) || ($aItem[$i][$e]['fi_debit'] == 'D' && $cum > 0))
155  {
156  echo '<td style="text-align:right;background-color:red;color:white">';
157  }
158 else
159  {
160  echo '<td style="text-align:right;background-color:green;color:white">';
161  }
162  echo nbm( $cum);
163 ?>
164 </td>
165 </tr>
166 
167 
168 </table>
169 </td>
170 </tr>
171 <?php endfor;?>
172 </table>
173 
174 <table>
175 <tr>
176 <?php echo td(_('Total Catégorie estimé'));echo td(nbm($tot_cat_estm),'num');?>
177 </tr>
178 <tr>
179 <?php echo td(_('Total Catégorie réel'));echo td(nbm($tot_cum_real),'num');?>
180 </tr>
181 <tr>
182 <?php echo td(_('Différence'));echo td(nbm($tot_cum_real-$tot_cat_estm),'num');?>
183 </tr>
184 </table>
185 </fieldset>
186 
187 
188 <?php endfor;?>
189 <?php if ( ! empty ($error) ) : ?>
190 <div class="error">
191 Désolé il y a des formules incorrectes
192 <ul style="list-style-type:none">
193 
194  <?php $last="";?>
195  <?php for ($i=0;$i<count($error);$i++) : ?>
196 <?php
197  if ( $last != $error[$i] ) { echo h($error[$i]); }
199 endfor;
200 ?>
201 </ul>
202 </div>
203 <?php endif; ?>
nbm
nbm($p_number, $p_dec=2)
format the number with a sep.
Definition: ac_common.php:137
h
h( $row[ 'oa_description'])
Definition: ajax_anc_detail_operation.php:46
$e
$e
Definition: result_cat_card_summary.php:26
style
$opd_description style
Definition: ajax_mod_predf_op.php:53
h1
h1($p_string, $p_class="")
Definition: ac_common.php:72
$estm
if(count($aPerMonth[$i]) !=0) $estm[$i][$e][$h]
Definition: forecast_result.php:55
tr
tr($p_string, $p_extra='')
Definition: ac_common.php:88
$amount
for($h=0;$h< count($aPeriode);$h++) $amount
Definition: forecast_result.php:41
$tot_estm
$tot_estm
Definition: forecast_result.php:36
endfor
endfor
Definition: forecast_result.php:28
align
text align
Definition: index.php:272
width
$desc width
Definition: restore.inc.php:237
$tot
$tot
Definition: forecast_result.php:71
$i
$i
Definition: action_document_type_mtable_input.php:83
$last
if(! empty($error)) for( $i=0; $i< count( $error); $i++)( $last !=$error[$i]) $last
Definition: forecast_result.php:198
table
$compta table
Definition: company.inc.php:81
$tot_cat_estm
$tot_cat_estm
Definition: forecast_result.php:10
$cum
$cum
Definition: forecast_result.php:128
td
td($p_string='', $p_extra='')
surround the string with td
Definition: ac_common.php:83
endif
endif
Definition: forecast_result.php:203
$diff
$diff
Definition: compta_fin_rec.inc.php:287
$tot_cum_real
$tot_cum_real
Definition: forecast_result.php:10
$error
$error
Definition: currency_mtable_input.php:34
$tot_cat_real
$tot_cat_real
Definition: forecast_result.php:10