Location: PHPKode > projects > MyPhpMoney > myphpmoney_2.0/public_html/listing.php
<?php
/**
 * $Id: listing.php 336 2003-04-02 12:18:39Z courou $
 *
 * Author     : courou&#64;users.sourceforge.net
 * Website    : http://allreponse.ath.cx
 *
 * Support    : http://sourceforge.net/projects/myphpmoney/
 * CVS        : http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/myphpmoney/
 */

/**
 * INCLUDE FILE
 */
     require_once 'config/settings.inc.php';

/**
 * ENTER IN THE SESSION OR BUILD THE LOGIN FORM
 */
     if (SQL_VerifSession()) {

/**
 * BUILD THE HEADER
 */
     XHTML_header(1,0,1,1,0,0,0,1);

/**
 * DEFINE VARIABLE GLOBALS
 */
      $incomeplus = '';

    ## NO VALUE -- ERROR MESSAGE
    if (!isset($_GET['MT']) || !isset($_GET['taux'])
       || !isset($_GET['duree']) || !isset($_GET['REMB'])) {

    $_MPM['BeginMixed'] = array
    (
         'MESSAGE_JS_BEFORE'      => $_VAR['MESSAGE_JS']['MESSAGE_SIMUL_1'],
         'CALCULE'                => $_VAR['CALCULE'],
         'MESSAGE_JS_AFTER'       => $_VAR['MESSAGE_JS']['MESSAGE_SIMUL_2']
    );
    XHTML_SetFile('js_simulation.tpl',$_MPM['BeginMixed'],2);
    exit;
    }

    ## DISPLAY THE MENU FOR TABLE AMORTISSEMENT
    $_MPM['BeginMixed'] = array
    (
         'SIMUL_FORM_2'           => $_VAR['SIMUL_FORM_2'],
         'SIMUL_FORM_3'           => $_VAR['SIMUL_FORM_3'],
         'SIMUL_FORM_4'           => $_VAR['SIMUL_FORM_4'],
         'SIMUL_FORM_5'           => $_VAR['SIMUL_FORM_5'],
         'SIMUL_FORM_6'           => $_VAR['SIMUL_FORM_6'],
         'SIMUL_FORM_7'           => $_VAR['SIMUL_FORM_7'],
         'SIMUL_FORM_8'           => $_VAR['SIMUL_FORM_8'],
         'EXCEL_AMORT'            => $_VAR['EXCEL_AMORT'],
         'AMORTISS_FORM_1'        => $_VAR['AMORTISS_FORM_1'],
         'AMORTISS_FORM_2'        => $_VAR['AMORTISS_FORM_2'],
         'AMORTISSEMENT_BUTTON_1' => $_VAR['AMORTISSEMENT_BUTTON_1'],
         'AMORTISSEMENT_BUTTON_2' => $_VAR['AMORTISSEMENT_BUTTON_2'],
         'HTTP_LIST'              => $_MPM['file_excel_c'],
         'MT_AMORT'               => $_GET['MT'],
         'REMB_AMORT'             => $_GET['REMB'],
         'TAUX_AMORT'             => $_GET['taux'],
         'DUREE_AMORT'            => $_GET['duree'],
         'CHOIX_AMORT'            => $_GET['choix_duree']
    );
    XHTML_SetFile('form_simulation_3.tpl',$_MPM['BeginMixed'],0);

   if ($_GET['choix_duree'] == '1') $_GET['duree'] = $_GET['duree'] * 12;
   $nbr_page       = $_GET['duree'];
   $taux_mensuelle = $_GET['taux'] / 12;

   $tpl->set_block('FILE_form_simulation_3.tpl','BOUCLE_SIMULATION','BOUCLE_BEGIN');

  ## FOR FIX BUG THE MONTH (29,30,31)
  for ($i=1; $i <= $nbr_page; $i++) {
   $_month = $_MPM['date_gettime']['mon'] + ($i - 1);
    $month = date('m',mktime(0,0,0,$_month));

      if ($_MPM['date_gettime']['mday'] <= 28) {
        $time = date('d-m-Y',mktime(0,0,0,$_month,$_MPM['date_gettime']['mday'],$_MPM['date_gettime']['year']));
      }
      else if ($_MPM['date_gettime']['mday'] > 28 && $_MPM['date_gettime']['mday'] < 32) {
        $der_j = $shuffle->getDaysInMonth($month,$_MPM['date_gettime']['year']);

        if ($der_j >= $_MPM['date_gettime']['mday']) {
              $der_j = $_MPM['date_gettime']['mday'];
        } else {
              $der_j = $der_j;
        }
        $time = date('d-m-Y',mktime(0,0,0,$_month,$der_j,$_MPM['date_gettime']['year']));
      } ## end of if ($_MPM['date_gettime']['mday'] <= 28)

        $INTERET     = round(((($i == 1 ? $_GET['MT'] : $MONTANT) * $taux_mensuelle) / 100),2);
        $CAPITAL     = $_GET['REMB'] - $INTERET;
        $MONTANT     = ($i == 1 ? $_GET['MT'] : $MONTANT) - $CAPITAL;
        $incomeplus += $INTERET;

     $j = $nbr_page - 1;

       if ($i == $nbr_page) $MONTANT = 0;
       if ($i == $j)        $MONTANTs = $MONTANT;
       if ($i == $nbr_page) {
           $CAPITAL = $MONTANTs;
           $_GET['REMB'] = $MONTANTs + $INTERET;
       }

     $tpl->set_var(array(
              'classbgcolor'       => isset($colors) && $colors == __COLOR_DISPLAY_1__ ? 'display2' : 'display1',
              'COLOR'              => isset($colors) && $colors == __COLOR_DISPLAY_1__ ? $colors = __COLOR_DISPLAY_2__ : $colors = __COLOR_DISPLAY_1__,
              'FORMAT_I'           => $i,
              'FORMAT_TIME'        => $time,
              'FORMAT_DETTE'       => $tools->formatage($i == 1 ? $_GET['MT'] : $MONTANT),
              'FORMAT_REMB'        => $tools->formatage($_GET['REMB']),
              'FORMAT_INTERET'     => $tools->formatage($INTERET),
              'FORMAT_CAPITAL'     => $tools->formatage($CAPITAL),
              'FORMAT_INTERETPLUS' => $tools->formatage($incomeplus),
              'FORMAT_MONTANT'     => $tools->formatage($MONTANT)
     ));
     $tpl->parse('BOUCLE_BEGIN','BOUCLE_SIMULATION',true);
     } ## end of for $i
     XHTML_SetFile('form_simulation_3.tpl','',4);

    /**
    * THE TEMPLATES -- BUILD THE TABLEAU AND ALLOWS TO KEEP THE SECOND FENETER IN THE FOREGROUND
    */
    $getincomeplus = $_GET['MT'] + $incomeplus;
          $_MPM['BeginMixed'] = array
          (
              'CHART_DIAMETER'     => __CHART_DIAMETER__,
              'CHART_FONT'         => __CHART_FONT__,
              'JS_WIDTH_GRAPH'     => __POPUP_GRAPH_WIDTH__,
              'JS_HEIGHT_GRAPH'    => __POPUP_GRAPH_HEIGHT__,
              'JS_TOP'             => __POPUP_GRAPH_TOP__,
              'JS_LEFT'            => __POPUP_GRAPH_LEFT__,
              'MODEL_GRAPHIQUE'    => $_MPM['dir_graph'],
              'ACCENT_SIMUL_FORM_5'=> $tools->Del_accent($_VAR['SIMUL_FORM_5']),
              'ACCENT_SIMUL_FORM_6'=> $tools->Del_accent($_VAR['SIMUL_FORM_6']),
              'HTTP_JS_SIMUL'      => $_MPM['file_camenbert'],
              'INTERET_FOCUS'      => $tools->formatage(($incomeplus / $getincomeplus) * 100),
              'CAPITAL_FOCUS'      => $tools->formatage(($_GET['MT'] / $getincomeplus) * 100),
              'TAUX_FOCUS'         => $_GET['taux'],
              'DUREE_FOCUS'        => $_GET['duree'],
              'CHOIX_FOCUS'        => $_GET['choix_duree']
          );
      XHTML_SetFile('js_simulation_1.tpl',$_MPM['BeginMixed'],2);
   } else {
          XHTML_DisplayLogin();
   } ## end if (SQL_VerifSession())

/**
 * BUILD THE FOOTER
 */
     XHTML_footer();
Return current item: MyPhpMoney