/**
  * VALIDATE FUNCTION
  */
 static function Validate($representative = null, $month = null)
 {
     if (Session::IsUserLogged() && Session::Get('accountant')) {
         $datas = Main::GetData();
         if (!isset($representative) && isset($datas['representative_id'])) {
             $representative = $datas['representative_id'];
         }
         if (!isset($month) && isset($datas['report_month'])) {
             $month = $datas['report_month'];
         }
         if (!isset($representative) && isset($month)) {
             $month = null;
         }
         require VIEW . '/v_header.php';
         if (!isset($representative) && !isset($month)) {
             require VIEW . '/www/v_select_validation.php';
         } elseif (isset($representative) && !isset($month)) {
             $last_month = new DateTime('first day of last month');
             $report = ExpenseReport::Compile($last_month, $representative);
             $closure = self::Closure($report, Session::Get('accountant'));
             if (count($closure) > 2) {
                 require VIEW . '/www/v_report_status_update.php';
             } elseif ($closure[0] === 'allowed') {
                 $representative = $closure[1];
                 require VIEW . '/www/v_validate.php';
             } else {
                 $now = new DateTime();
                 $now = $now->format('d-m-Y');
                 $forbidden = 'La validation des fiches de frais a lieu ' . 'entre le 10 et le 20 du mois suivant. ' . 'Date du jour : ' . $now;
                 require VIEW . '/www/v_forbidden.php';
             }
         } else {
             $report = ExpenseReport::Compile($month, $representative);
             $representative = Representative::GetRepresentative($report);
             require VIEW . '/www/v_validate.php';
         }
         require VIEW . '/v_footer.php';
     } else {
         header('Location: /home/login');
     }
 }