function index()
 {
     /** WARNING time section */
     $this->set('tau', $this->tachionTravel(deep));
     if (!isset($_SESSION['Auth']['User']['year'])) {
         $year = date('Y');
         $_SESSION['Auth']['User']['year'] = $year;
     } else {
         $year = $_SESSION['Auth']['User']['year'];
     }
     /** when @GST */
     if (isset($_SESSION['Auth']['User']['id_empresa_back']) and $_SESSION['Auth']['User']['id_empresa_back'] == $_SESSION['Auth']['User']['id_empresa']) {
         $this->shiftCorp($level = $_SESSION['Auth']['User']['level']);
     }
     $id_empresa = $_SESSION['Auth']['User']['id_empresa'];
     if (!isset($_SESSION['projections']['fraction'])) {
         $_SESSION['projections']['fraction'] = $this->Fraccion->find('list', array('fields' => array('id', 'fraccion')));
     }
     $fraction = $_SESSION['projections']['fraction'];
     if (!isset($_SESSION['projections']['fleets'])) {
         $_SESSION['projections']['fleets'] = $this->fleets(true, false);
     }
     if (!isset($_SESSION['projections']['currentProjectionsWorkingDays'])) {
         $_SESSION['projections']['currentProjectionsWorkingDays'] = $this->workingDays(null, $year, false, true);
     }
     if (!isset($_SESSION['projections']['months'])) {
         $_SESSION['projections']['months'] = $this->months($return = true, $set = false, $year);
     }
     $months = $_SESSION['projections']['months'];
     // 		pr($months);
     if (!isset($_SESSION['projections']['operacion'])) {
         $this->operations($id_empresa, $year);
     }
     if (!isset($_SESSION['projections']['acumulado'])) {
         $this->acumulado($id_empresa, $year);
         // 		   $id_empresa=null,$year=null,$month=null
     }
     $operations = $_SESSION['projections']['operacion'];
     // 		$id_empresa = $_SESSION['Auth']['User']['id_empresa'];
     if (!isset($_SESSION['projections']['projeccion'])) {
         $this->projection($id_empresa);
     }
     if (!isset($_SESSION['projections']['fleets'])) {
         $_SESSION['projections']['fleets'] = $this->fleets(true, false);
         $this->set('fleets', $_SESSION['projections']['fleets']);
     } else {
         $this->set('fleets', $_SESSION['projections']['fleets']);
     }
     $this->set('TonsIndex', array_sum($operations['totalToneladasYearlyByArea'][$id_empresa]));
     $this->set('KmsIndex', array_sum($operations['totalKilometrosYearlyByArea'][$id_empresa]));
     $this->set('IngresosIndex', array_sum($operations['totalIngresosYearlyByArea'][$id_empresa]));
     $this->set('ViajesIndex', array_sum($operations['totalViajesYearlyByArea'][$id_empresa]));
     if (empty(filterUser($_SESSION['Auth']['User']['email'], $this->areas()))) {
         $AllAreas = $this->areas();
     } else {
         $setFilter = filterUser($_SESSION['Auth']['User']['email'], $this->areas());
         $AllAreas = $setFilter['flotas'];
         // 		  $redirect = $setFilter['redirect'];
     }
     // 		if(isset($redirect)){
     // // 		  pr('redirect');
     // 		}
     // 		var_dump($setFilter);
     // 		var_dump($AllAreas);
     // 		pr($this->areas());
     $AreaCorp['Area'] = $AllAreas['0'];
     $this->set('areas', $AllAreas);
     $this->set('AreaCorp', $AreaCorp);
     $this->set('unidadDeNegocio', array_map('strtolower', $this->Empresas->getEmpresas()));
     // 		pr($_SESSION['projections']['workingDays']);
     // 		pr($_SESSION['projections']['currentProjectionsWorkingDays']);
     // 		if($debug){
     // 		  //script code
     // 		  $time2 = microtime(true);
     // 		  echo "script execution time: ".($time2-$time1); //value in seconds
     // 		}
 }
Esempio n. 2
0
     break;
 case 'deleUser':
     //删除预约用户
     deleUser();
     break;
 case 'addUser':
     //添加预约用户
     addUser();
     break;
 case 'reserveSuccess':
     //预约成功
     reserveSuccess();
     break;
 case 'filterUser':
     //按条件查询用户
     filterUser();
     break;
 case 'comUser':
     //查询企业用户
     comUser();
     break;
 case 'jobUser':
     //查询兼职用户
     jobUser();
     break;
 case 'addComUser':
     //添加企业用户
     addComUser();
     break;
 case 'findUserById':
     findUserById();