noalyss  Version-6.7.2
 All Data Structures Namespaces Files Functions Variables Enumerations
forecast_result.php
Go to the documentation of this file.
00001 <?php
00002 //This file is part of NOALYSS and is under GPL 
00003 //see licence.txt
00004 ?><h1><?php echo $str_name;?></h1>
00005 Période du <?php echo $str_start?> à <?php echo $str_end;?>
00006 <?php  for ($i=0;$i<count($aCat);$i++): // foreach category ?>
00007 <?php if (count($aItem[$i])==0) continue;?>
00008 <fieldset>
00009 <legend>
00010 <?php echo $aCat[$i]['fc_desc'];$tot_cat_estm=0;$tot_cat_real=0;$tot_cum_real=0;?>
00011 </legend>
00012 
00013 <?php for ($e=0;$e<count($aItem[$i]);$e++):?>
00014 <table class="result" style="margin-bottom:3px">
00015 <tr>
00016 <td>
00017    <?php echo '<h2>'.h($aItem[$i][$e]['fi_text']).'</h2>';?>
00018 </td>
00019 </tr>
00020 <tr>
00021 <td>
00022 <table width="100%">
00023 <tr >
00024 <td style="font-weight:bold;border:1px solid black">
00025 <?php echo _('Période')?></td>
00026 <?php for ($h=0;$h<count($aPeriode);$h++):?>
00027 <td style="text-align:center;font-weight:bold;border:1px solid black">
00028 <?php echo $aPeriode[$h]['myear'];?>
00029 </td>
00030 <?php endfor;?>
00031 <td style="text-align:center;font-weight:bold;border:1px solid black;"><?php echo _('Totaux');?></td>
00032 </tr>
00033 
00034 <tr>
00035 <td>
00036 <?php echo _('Estimé');$tot_estm=0;?>
00037 </td>
00038 <?php for ($h=0;$h<count($aPeriode);$h++):?>
00039 <td style="text-align:right;">
00040 <?php
00041 $amount=$aItem[$i][$e]['fi_amount'];
00042 if (count($aPerMonth[$i]) != 0 ){
00043         for ($x=0;$x<count($aPerMonth[$i]);$x++) {
00044                 $amount=$aItem[$i][$e]['fi_amount'];
00045                 if ($aPeriode[$h]['p_id']==$aPerMonth[$i][$x]['fi_pid'] &&
00046                         $aItem[$i][$e]['fi_card']==$aPerMonth[$i][$x]['fi_card'] &&
00047                         $aItem[$i][$e]['fi_account']==$aPerMonth[$i][$x]['fi_account']
00048                         )
00049                         {
00050                                 $amount=$aPerMonth[$i][$x]['fi_amount'];
00051                                 break;
00052                         }
00053         }
00054 }
00055 $estm[$i][$e][$h]=$amount;
00056 echo nbm( $amount);
00057 
00058 $tot_estm=bcadd($tot_estm,$amount);
00059 $tot_cat_estm=bcadd($amount,$tot_cat_estm);
00060 ?>
00061 
00062 </td>
00063 <?php endfor;?>
00064 <td style="text-align:right">
00065 <?php echo nbm($tot_estm);?>
00066 </td>
00067 </tr>
00068 
00069 <tr>
00070 <td>
00071 <?php echo _('Réel');$tot=0;?>
00072 </td>
00073 <?php for ($h=0;$h<count($aPeriode);$h++):?>
00074 <td align="right">
00075    <?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]);?>
00076 </td>
00077 <?php endfor;?>
00078 <td align="right">
00079 <?php echo nbm( $tot);?>
00080 </td>
00081 </tr>
00082                 <tr>
00083                         <td>
00084                                                 <?php echo _('Total réel');
00085 
00086                                                 $tot_cat_real = 0;
00087                                                 ?>
00088                                         </td>
00089                                 <?php for ($h = 0; $h < count($aPeriode); $h++):?>
00090                                 <td align="right">
00091                                 <?php
00092                                 $tot_cat_real = bcadd($tot_cat_real, $aReal[$i][$e][$h]);
00093                                 $tot_cum_real=bcadd($tot_cum_real,$aReal[$i][$e][$h]);
00094                                 echo nbm($tot_cat_real);
00095                         ?>
00096                         </td>
00097                                 <?php endfor;?>
00098 
00099                 </tr>
00100 <tr>
00101 <td>
00102 <?php echo _('Différence');?>
00103 </td>
00104 <?php for ($h=0;$h<count($aPeriode);$h++):?>
00105 
00106     <?php
00107  $diff= bcsub( $aReal[$i][$e][$h],$estm[$i][$e][$h]);
00108 if ( ($aItem[$i][$e]['fi_debit'] == 'C' && $diff < 0) || ($aItem[$i][$e]['fi_debit'] == 'D' && $diff > 0))
00109   {
00110     echo '<td style="text-align:right;background-color:red;color:white">';
00111   }
00112 else if ($diff==0)
00113   {
00114     echo '<td style="text-align:right;">';
00115   }
00116 else
00117   {
00118     echo '<td style="text-align:right;background-color:green;color:white">';
00119   }
00120 
00121 echo nbm( $diff);
00122 ?>
00123 </td>
00124 <?php endfor;?>
00125 </tr>
00126 <tr>
00127 <td>
00128 <?php echo _('Diff. cumul.'); $cum=0.0; ?>
00129 </td>
00130 <?php for ($h=0;$h<count($aPeriode);$h++):?>
00131 
00132 <?php
00133     $diff= bcsub($aReal[$i][$e][$h],$estm[$i][$e][$h]);
00134 $cum=bcadd($diff,$cum);
00135 if ( ($aItem[$i][$e]['fi_debit'] == 'C' && $cum < 0) || ($aItem[$i][$e]['fi_debit'] == 'D' && $cum > 0))
00136   {
00137     echo '<td style="text-align:right;background-color:red;color:white">';
00138   }
00139 else if ($cum ==0)
00140   {
00141     echo '<td style="text-align:right;">';
00142   }
00143 
00144 else
00145   {
00146     echo '<td style="text-align:right;background-color:green;color:white">';
00147   }
00148 
00149 echo nbm( $cum);
00150 ?>
00151 </td>
00152 <?php endfor;?>
00153 <?php
00154 if ( ($aItem[$i][$e]['fi_debit'] == 'C' && $cum < 0) || ($aItem[$i][$e]['fi_debit'] == 'D' && $cum > 0))
00155   {
00156     echo '<td style="text-align:right;background-color:red;color:white">';
00157   }
00158 else
00159   {
00160     echo '<td style="text-align:right;background-color:green;color:white">';
00161   }
00162  echo nbm(  $cum);
00163 ?>
00164 </td>
00165 </tr>
00166 
00167 
00168 </table>
00169 </td>
00170 </tr>
00171 <?php endfor;?>
00172 </table>
00173 
00174 <table>
00175 <tr>
00176 <?php echo td(_('Total Catégorie estimé'));echo td(nbm($tot_cat_estm),'num');?>
00177 </tr>
00178 <tr>
00179 <?php echo td(_('Total Catégorie réel'));echo td(nbm($tot_cum_real),'num');?>
00180 </tr>
00181 <tr>
00182 <?php echo td(_('Différence'));echo td(nbm($tot_cum_real-$tot_cat_estm),'num');?>
00183 </tr>
00184 </table>
00185 </fieldset>
00186 
00187 
00188 <?php endfor;?>
00189 <?php if ( ! empty ($error) ) : ?>
00190 <div class="error">
00191 Désolé il y a des formules incorrectes
00192 <ul style="list-style-type:none">
00193 
00194    <?php $last="";?>
00195    <?php for ($i=0;$i<count($error);$i++) : ?>
00196 <?php
00197    if ( $last != $error[$i] ) {  echo h($error[$i]); }
00198 $last=$error[$i];
00199 endfor;
00200 ?>
00201 </ul>
00202 </div>
00203 <?php endif; ?>
 All Data Structures Namespaces Files Functions Variables Enumerations