<?php
    function getSalaryYearGross($id_emp, $year, $month){
      $CI =& get_instance();	
      $CI->load->model('model_graph');
      return $CI -> model_graph-> getSalaryYearGross($id_emp, $year, $month);  
    } 
    
    function getSalaryNet($id_emp, $year, $month){
      $CI =& get_instance();	
      $CI->load->model('model_graph');
      return $CI -> model_graph-> getSalaryNet($id_emp, $year, $month);  
    }
    
    function getCountHoursWorked($id_emp, $year, $month){
      $CI =& get_instance();	
      $CI->load->model('model_graph');
      return $CI -> model_graph-> getCountHoursWorked($id_emp, $year, $month);  
    }
    
    function getCountCompletedInventories($id_emp, $year, $month){
      $CI =& get_instance();	
      $CI->load->model('model_graph');
      return $CI -> model_graph-> getCountCompletedInventories($id_emp, $year, $month);  
    }
    
    function getCountCompletedKilometer($id_emp, $year, $month){
      $CI =& get_instance();	
      $CI->load->model('model_graph');
      return $CI -> model_graph-> getCountCompletedKilometer($id_emp, $year, $month);  
    }
    
    function getSalaryYearGrossLead($id_emp, $year, $month){
      $CI =& get_instance();	
      $CI->load->model('model_graph');
      return $CI -> model_graph-> getSalaryYearGrossLead($id_emp, $year, $month);  
    }
    
    function getCountHoursWorkedLead($id_emp, $year, $month){
      $CI =& get_instance();	
      $CI->load->model('model_graph');
      return $CI -> model_graph-> getCountHoursWorkedLead($id_emp, $year, $month);  
    }
    
    function getCountCompletedInventoriesLead($id_emp, $year, $month){
      $CI =& get_instance();	
      $CI->load->model('model_graph');
      return $CI -> model_graph-> getCountCompletedInventoriesLead($id_emp, $year, $month);   
    }
    
    function getSalaryYearGrossDriver($id_emp, $year, $month){
      $CI =& get_instance();	
      $CI->load->model('model_graph');
      return $CI -> model_graph-> getSalaryYearGrossDriver($id_emp, $year, $month);  
    }
    
    function getCountHoursWorkedDriver($id_emp, $year, $month){
      $CI =& get_instance();	
      $CI->load->model('model_graph');
      return $CI -> model_graph-> getCountHoursWorkedDriver($id_emp, $year, $month);  
    }
    
    function getCountCompletedInventoriesDriver($id_emp, $year, $month){
      $CI =& get_instance();	
      $CI->load->model('model_graph');
      return $CI -> model_graph-> getCountCompletedInventoriesDriver($id_emp, $year, $month);   
    }   
   
    
//MANAGER STATISTICS

    function getSalaryYearGrossManager($year, $month){
      $CI =& get_instance();	
      $CI->load->model('model_graph');
      return $CI -> model_graph-> getSalaryYearGrossManager($year, $month);   
    }
    
    function getSalaryYearNetManager($year, $month){
      $CI =& get_instance();	
      $CI->load->model('model_graph');
      return $CI -> model_graph-> getSalaryYearNetManager($year, $month);   
    }
    
    function getCountCompletedInventoriesManager($year, $month){
      $CI =& get_instance();	
      $CI->load->model('model_graph');
      return $CI -> model_graph-> getCountCompletedInventoriesManager($year, $month);   
    }
    
    function getCountHoursWorkedManager($year, $month){
      $CI =& get_instance();	
      $CI->load->model('model_graph');
      return $CI -> model_graph-> getCountHoursWorkedManager($year, $month);   
    }
    
    function getTopSalaryLeadEmployees($year, $limit){
      $CI =& get_instance();	
      $CI->load->model('model_graph');
      return $CI -> model_graph-> getTopSalaryLeadEmployees($year, $limit);  
    }
    
    function getTopSalaryDrivers($year, $limit){
      $CI =& get_instance();	
      $CI->load->model('model_graph');
      return $CI -> model_graph-> getTopSalaryDrivers($year, $limit);  
    }
    
    function getTopSalaryEmployees($year, $limit){
      $CI =& get_instance();	
      $CI->load->model('model_graph');
      return $CI -> model_graph-> getTopSalaryEmployees($year, $limit);  
    }
    
    function getTopHoursVehicles($year, $limit){
      $CI =& get_instance();	
      $CI->load->model('model_graph');
      return $CI -> model_graph-> getTopHoursVehicles($year, $limit);  
    }
    
    function getTopKilometersVehicles($year, $limit){
      $CI =& get_instance();	
      $CI->load->model('model_graph');
      return $CI -> model_graph-> getTopKilometersVehicles($year, $limit);  
    }
    
    function getTopCompleteInventoriesVehicles($year, $limit){
      $CI =& get_instance();	
      $CI->load->model('model_graph');
      return $CI -> model_graph-> getTopCompleteInventoriesVehicles($year, $limit);  
    }
    
//DRIVER 
    function getSalaryYearGrossDriverAsDriver($id_emp, $year, $month){
      $CI =& get_instance();	
      $CI->load->model('model_graph');
      return $CI -> model_graph-> getSalaryYearGrossDriverAsDriver($id_emp, $year, $month);  
    } 
    
    function getSalaryNetDriverAsDriver($id_emp, $year, $month){
      $CI =& get_instance();	
      $CI->load->model('model_graph');
      return $CI -> model_graph-> getSalaryNetDriverAsDriver($id_emp, $year, $month);  
    }
    
    function getCountHoursWorkedDriverAsDriver($id_emp, $year, $month){
      $CI =& get_instance();	
      $CI->load->model('model_graph');
      return $CI -> model_graph-> getCountHoursWorkedDriverAsDriver($id_emp, $year, $month);  
    }
    
    function getCountCompletedInventoriesDriverAsDriver($id_emp, $year, $month){
      $CI =& get_instance();	
      $CI->load->model('model_graph');
      return $CI -> model_graph-> getCountCompletedInventoriesDriverAsDriver($id_emp, $year, $month);  
    }
    
    function getCountCompletedKilometerDriverAsDriver($id_emp, $year, $month){
      $CI =& get_instance();	
      $CI->load->model('model_graph');
      return $CI -> model_graph-> getCountCompletedKilometerDriverAsDriver($id_emp, $year, $month);  
    }
    
    function getSalaryYearGrossDriverAsEmployee($id_emp, $year, $month){
      $CI =& get_instance();	
      $CI->load->model('model_graph');
      return $CI -> model_graph-> getSalaryYearGrossDriverAsEmployee($id_emp, $year, $month);  
    } 
    
    function getSalaryNetDriverAsEmployee($id_emp, $year, $month){
      $CI =& get_instance();	
      $CI->load->model('model_graph');
      return $CI -> model_graph-> getSalaryNetDriverAsEmployee($id_emp, $year, $month);  
    }
    
    function getCountHoursWorkedDriverAsEmployee($id_emp, $year, $month){
      $CI =& get_instance();	
      $CI->load->model('model_graph');
      return $CI -> model_graph-> getCountHoursWorkedDriverAsEmployee($id_emp, $year, $month);  
    }
    
    function getCountCompletedInventoriesDriverAsEmployee($id_emp, $year, $month){
      $CI =& get_instance();	
      $CI->load->model('model_graph');
      return $CI -> model_graph-> getCountCompletedInventoriesDriverAsEmployee($id_emp, $year, $month);  
    }
    
    function getCountCompletedKilometerDriverAsEmployee($id_emp, $year, $month){
      $CI =& get_instance();	
      $CI->load->model('model_graph');
      return $CI -> model_graph-> getCountCompletedKilometerDriverAsEmployee($id_emp, $year, $month);  
    }
    
    function getCountPenaltyEmp($id_emp, $year, $month){
      $CI =& get_instance();	
      $CI->load->model('model_graph');
      return $CI -> model_graph-> getCountPenaltyEmp($id_emp, $year, $month);  
    }
    
function drawGraphEmployee($id_emp, $mode, $year){ 
   switch($mode){
      case 1:
        $array= 
          '[["", "Mzda v €"],
          ["Január", '.getSalaryYearGross($id_emp, $year, "01").'],
          ["Február", '.getSalaryYearGross($id_emp, $year, "02").'],
          ["Marec", '.getSalaryYearGross($id_emp, $year,  "03").'],
          ["Apríl", '.getSalaryYearGross($id_emp, $year,  "04").'],
          ["Máj", '.getSalaryYearGross($id_emp, $year, "05").'],
          ["Jún", '.getSalaryYearGross($id_emp, $year, "06").'],
          ["Júl", '.getSalaryYearGross($id_emp, $year, "07").'],
          ["August", '.getSalaryYearGross($id_emp, $year, "08").'],
          ["September", '.getSalaryYearGross($id_emp, $year, "09").'],
          ["Október", '.getSalaryYearGross($id_emp, $year, "10").'],
          ["November", '.getSalaryYearGross($id_emp, $year, "11").'],
          ["December", '.getSalaryYearGross($id_emp, $year, "12").']]';
        $title = "Mesačné zobrazenie miezd za rok ".$year." v hrubom.";
      break;
      
      case 2:
        $array= 
          '[["", "Mzda v €"],
          ["Január", '.getSalaryNet($id_emp, $year, "01").'],
          ["Február", '.getSalaryNet($id_emp, $year, "02").'],
          ["Marec", '.getSalaryNet($id_emp, $year,  "03").'],
          ["Apríl", '.getSalaryNet($id_emp, $year,  "04").'],
          ["Máj", '.getSalaryNet($id_emp, $year, "05").'],
          ["Jún", '.getSalaryNet($id_emp, $year, "06").'],
          ["Júl", '.getSalaryNet($id_emp, $year, "07").'],
          ["August", '.getSalaryNet($id_emp, $year, "08").'],
          ["September", '.getSalaryNet($id_emp, $year, "09").'],
          ["Október", '.getSalaryNet($id_emp, $year, "10").'],
          ["November", '.getSalaryNet($id_emp, $year, "11").'],
          ["December", '.getSalaryNet($id_emp, $year, "12").']]'; 
         $title = "Mesačné zobrazenie miezd za rok ".$year." v čistom.";
      break;
      
      case 3: 
         $array= 
          '[["", "Počet odpracovaných hodín"],
          ["Január", '.getCountHoursWorked($id_emp, $year, "01").'],
          ["Február", '.getCountHoursWorked($id_emp, $year, "02").'],
          ["Marec", '.getCountHoursWorked($id_emp, $year,  "03").'],
          ["Apríl", '.getCountHoursWorked($id_emp, $year,  "04").'],
          ["Máj", '.getCountHoursWorked($id_emp, $year, "05").'],
          ["Jún", '.getCountHoursWorked($id_emp, $year, "06").'],
          ["Júl", '.getCountHoursWorked($id_emp, $year, "07").'],
          ["August", '.getCountHoursWorked($id_emp, $year, "08").'],
          ["September", '.getCountHoursWorked($id_emp, $year, "09").'],
          ["Október", '.getCountHoursWorked($id_emp, $year, "10").'],
          ["November", '.getCountHoursWorked($id_emp, $year, "11").'],
          ["December", '.getCountHoursWorked($id_emp, $year, "12").']]'; 
         $title = "Počet odpracovaných hodín v roku ".$year.".";
      break;
      
      case 4: 
         $array= 
          '[["", "Počet inventúr"],
          ["Január", '.getCountCompletedInventories($id_emp, $year, "01").'],
          ["Február", '.getCountCompletedInventories($id_emp, $year, "02").'],
          ["Marec", '.getCountCompletedInventories($id_emp, $year,  "03").'],
          ["Apríl", '.getCountCompletedInventories($id_emp, $year,  "04").'],
          ["Máj", '.getCountCompletedInventories($id_emp, $year, "05").'],
          ["Jún", '.getCountCompletedInventories($id_emp, $year, "06").'],
          ["Júl", '.getCountCompletedInventories($id_emp, $year, "07").'],
          ["August", '.getCountCompletedInventories($id_emp, $year, "08").'],
          ["September", '.getCountCompletedInventories($id_emp, $year, "09").'],
          ["Október", '.getCountCompletedInventories($id_emp, $year, "10").'],
          ["November", '.getCountCompletedInventories($id_emp, $year, "11").'],
          ["December", '.getCountCompletedInventories($id_emp, $year, "12").']]'; 
         $title = "Počet absolvovaných inventúr v roku ".$year.".";
      break;
      
      case 5: 
         $array= 
          '[["", "Počet kilometrov"],
          ["Január", '.getCountCompletedKilometer($id_emp, $year, "01").'],
          ["Február", '.getCountCompletedKilometer($id_emp, $year, "02").'],
          ["Marec", '.getCountCompletedKilometer($id_emp, $year,  "03").'],
          ["Apríl", '.getCountCompletedKilometer($id_emp, $year,  "04").'],
          ["Máj", '.getCountCompletedKilometer($id_emp, $year, "05").'],
          ["Jún", '.getCountCompletedKilometer($id_emp, $year, "06").'],
          ["Júl", '.getCountCompletedKilometer($id_emp, $year, "07").'],
          ["August", '.getCountCompletedKilometer($id_emp, $year, "08").'],
          ["September", '.getCountCompletedKilometer($id_emp, $year, "09").'],
          ["Október", '.getCountCompletedKilometer($id_emp, $year, "10").'],
          ["November", '.getCountCompletedKilometer($id_emp, $year, "11").'],
          ["December", '.getCountCompletedKilometer($id_emp, $year, "12").']]'; 
         $title = "Počet precestovaných kilometrov za rok ".$year.".";
      break; 
    }       
    
?>	
	<html>
  <head>
    <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
    <script type="text/javascript">

      google.charts.load('current', {'packages':['bar']});
      google.charts.setOnLoadCallback(drawStuff);

      function drawStuff() {
        var data = new google.visualization.arrayToDataTable(<?php echo $array ?>);

        var options = {
          title: <?php echo "'".$title."'" ?>,
          width: 950, height: 360,
          legend: { position: 'none' },
          bar: { groupWidth: "90%" },
          vAxis: {format: 'decimal'}
        };

        var chart = new google.charts.Bar(document.getElementById('top_x_div'));

        chart.draw(data, google.charts.Bar.convertOptions(options));
      };
    </script>
  </head>

  <body>
    <div id="top_x_div" style="margin-left:50px; margin-top:20px"></div>
  </body>
</html>
<?php
}

function drawGraphManagerEmployees($modeSta,$id_emp,$type_emp,$year){
   switch($type_emp){
     case 2:
            switch($modeSta){
            case 1:
                  $array= 
                      '[["", "Mzdy v [€]"],
                      ["Január", '.getSalaryYearGrossLead($id_emp, $year, "01").'],
                      ["Február", '.getSalaryYearGrossLead($id_emp, $year, "02").'],
                      ["Marec", '.getSalaryYearGrossLead($id_emp, $year,  "03").'],
                      ["Apríl", '.getSalaryYearGrossLead($id_emp, $year,  "04").'],
                      ["Máj", '.getSalaryYearGrossLead($id_emp, $year, "05").'],
                      ["Jún", '.getSalaryYearGrossLead($id_emp, $year, "06").'],
                      ["Júl", '.getSalaryYearGrossLead($id_emp, $year, "07").'],
                      ["August", '.getSalaryYearGrossLead($id_emp, $year, "08").'],
                      ["September", '.getSalaryYearGrossLead($id_emp, $year, "09").'],
                      ["Október", '.getSalaryYearGrossLead($id_emp, $year, "10").'],
                      ["November", '.getSalaryYearGrossLead($id_emp, $year, "11").'],
                      ["December", '.getSalaryYearGrossLead($id_emp, $year, "12").']]'; 
                    $title = "Mesačné zobrazenie miezd za rok ".$year." v hrubom. (vedúci inventúry)"; 
            break;
            case 2:
                  $array= 
                      '[["", "Odpracovaných hodín"],
                      ["Január", '.getCountHoursWorkedLead($id_emp, $year, "01").'],
                      ["Február", '.getCountHoursWorkedLead($id_emp, $year, "02").'],
                      ["Marec", '.getCountHoursWorkedLead($id_emp, $year,  "03").'],
                      ["Apríl", '.getCountHoursWorkedLead($id_emp, $year,  "04").'],
                      ["Máj", '.getCountHoursWorkedLead($id_emp, $year, "05").'],
                      ["Jún", '.getCountHoursWorkedLead($id_emp, $year, "06").'],
                      ["Júl", '.getCountHoursWorkedLead($id_emp, $year, "07").'],
                      ["August", '.getCountHoursWorkedLead($id_emp, $year, "08").'],
                      ["September", '.getCountHoursWorkedLead($id_emp, $year, "09").'],
                      ["Október", '.getCountHoursWorkedLead($id_emp, $year, "10").'],
                      ["November", '.getCountHoursWorkedLead($id_emp, $year, "11").'],
                      ["December", '.getCountHoursWorkedLead($id_emp, $year, "12").']]'; 
                    $title = "Mesačné zobrazenie odpracovaných hodín v roku ".$year.". (vedúci inventúry)";     
            break;
            case 3:
                  $array= 
                      '[["", "Počet inventúr"],
                      ["Január", '.getCountCompletedInventoriesLead($id_emp, $year, "01").'],
                      ["Február", '.getCountCompletedInventoriesLead($id_emp, $year, "02").'],
                      ["Marec", '.getCountCompletedInventoriesLead($id_emp, $year,  "03").'],
                      ["Apríl", '.getCountCompletedInventoriesLead($id_emp, $year,  "04").'],
                      ["Máj", '.getCountCompletedInventoriesLead($id_emp, $year, "05").'],
                      ["Jún", '.getCountCompletedInventoriesLead($id_emp, $year, "06").'],
                      ["Júl", '.getCountCompletedInventoriesLead($id_emp, $year, "07").'],
                      ["August", '.getCountCompletedInventoriesLead($id_emp, $year, "08").'],
                      ["September", '.getCountCompletedInventoriesLead($id_emp, $year, "09").'],
                      ["Október", '.getCountCompletedInventoriesLead($id_emp, $year, "10").'],
                      ["November", '.getCountCompletedInventoriesLead($id_emp, $year, "11").'],
                      ["December", '.getCountCompletedInventoriesLead($id_emp, $year, "12").']]'; 
                    $title = "Mesačné zobrazenie odpracovaných hodín v roku ".$year.". (vedúci inventúry)";      
            break;
            } 
     break;
     case 3:
            switch($modeSta){
            case 1:
                    $array= 
                        '[["", "Mzdy v [€]"],
                        ["Január", '.getSalaryYearGrossDriver($id_emp, $year, "01").'],
                        ["Február", '.getSalaryYearGrossDriver($id_emp, $year, "02").'],
                        ["Marec", '.getSalaryYearGrossDriver($id_emp, $year,  "03").'],
                        ["Apríl", '.getSalaryYearGrossDriver($id_emp, $year,  "04").'],
                        ["Máj", '.getSalaryYearGrossDriver($id_emp, $year, "05").'],
                        ["Jún", '.getSalaryYearGrossDriver($id_emp, $year, "06").'],
                        ["Júl", '.getSalaryYearGrossDriver($id_emp, $year, "07").'],
                        ["August", '.getSalaryYearGrossDriver($id_emp, $year, "08").'],
                        ["September", '.getSalaryYearGrossDriver($id_emp, $year, "09").'],
                        ["Október", '.getSalaryYearGrossDriver($id_emp, $year, "10").'],
                        ["November", '.getSalaryYearGrossDriver($id_emp, $year, "11").'],
                        ["December", '.getSalaryYearGrossDriver($id_emp, $year, "12").']]'; 
                      $title = "Mesačné zobrazenie miezd za rok ".$year." v hrubom. (vodič)"; 
            break;
            case 2:
                  $array= 
                      '[["", "Odpracovaných hodín"],
                      ["Január", '.getCountHoursWorkedDriver($id_emp, $year, "01").'],
                      ["Február", '.getCountHoursWorkedDriver($id_emp, $year, "02").'],
                      ["Marec", '.getCountHoursWorkedDriver($id_emp, $year,  "03").'],
                      ["Apríl", '.getCountHoursWorkedDriver($id_emp, $year,  "04").'],
                      ["Máj", '.getCountHoursWorkedDriver($id_emp, $year, "05").'],
                      ["Jún", '.getCountHoursWorkedDriver($id_emp, $year, "06").'],
                      ["Júl", '.getCountHoursWorkedDriver($id_emp, $year, "07").'],
                      ["August", '.getCountHoursWorkedDriver($id_emp, $year, "08").'],
                      ["September", '.getCountHoursWorkedDriver($id_emp, $year, "09").'],
                      ["Október", '.getCountHoursWorkedDriver($id_emp, $year, "10").'],
                      ["November", '.getCountHoursWorkedDriver($id_emp, $year, "11").'],
                      ["December", '.getCountHoursWorkedDriver($id_emp, $year, "12").']]'; 
                    $title = "Mesačné zobrazenie odpracovaných hodín v roku ".$year.". (vodič)";     
            break;
                case 3:
                      $array= 
                          '[["", "Počet inventúr"],
                          ["Január", '.getCountCompletedInventoriesDriver($id_emp, $year, "01").'],
                          ["Február", '.getCountCompletedInventoriesDriver($id_emp, $year, "02").'],
                          ["Marec", '.getCountCompletedInventoriesDriver($id_emp, $year,  "03").'],
                          ["Apríl", '.getCountCompletedInventoriesDriver($id_emp, $year,  "04").'],
                          ["Máj", '.getCountCompletedInventoriesDriver($id_emp, $year, "05").'],
                          ["Jún", '.getCountCompletedInventoriesDriver($id_emp, $year, "06").'],
                          ["Júl", '.getCountCompletedInventoriesDriver($id_emp, $year, "07").'],
                          ["August", '.getCountCompletedInventoriesDriver($id_emp, $year, "08").'],
                          ["September", '.getCountCompletedInventoriesDriver($id_emp, $year, "09").'],
                          ["Október", '.getCountCompletedInventoriesDriver($id_emp, $year, "10").'],
                          ["November", '.getCountCompletedInventoriesDriver($id_emp, $year, "11").'],
                          ["December", '.getCountCompletedInventoriesDriver($id_emp, $year, "12").']]'; 
                        $title = "Mesačné zobrazenie odpracovaných hodín v roku ".$year.". (vodič)";      
                break;
            }             
     break;
     case 4: 
            switch($modeSta){
                    case 1:
                          $array= 
                            '[["", "Mzdy v [€]"],
                            ["Január", '.getSalaryYearGross($id_emp, $year, "01").'],
                            ["Február", '.getSalaryYearGross($id_emp, $year, "02").'],
                            ["Marec", '.getSalaryYearGross($id_emp, $year,  "03").'],
                            ["Apríl", '.getSalaryYearGross($id_emp, $year,  "04").'],
                            ["Máj", '.getSalaryYearGross($id_emp, $year, "05").'],
                            ["Jún", '.getSalaryYearGross($id_emp, $year, "06").'],
                            ["Júl", '.getSalaryYearGross($id_emp, $year, "07").'],
                            ["August", '.getSalaryYearGross($id_emp, $year, "08").'],
                            ["September", '.getSalaryYearGross($id_emp, $year, "09").'],
                            ["Október", '.getSalaryYearGross($id_emp, $year, "10").'],
                            ["November", '.getSalaryYearGross($id_emp, $year, "11").'],
                            ["December", '.getSalaryYearGross($id_emp, $year, "12").']]'; 
                          $title = "Mesačné zobrazenie miezd za rok ".$year." v hrubom. (zamestnanec)"; 
                    break;
                    case 2:
                          $array= 
                            '[["", "Odpracovaných hodín"],
                            ["Január", '.getCountHoursWorked($id_emp, $year, "01").'],
                            ["Február", '.getCountHoursWorked($id_emp, $year, "02").'],
                            ["Marec", '.getCountHoursWorked($id_emp, $year,  "03").'],
                            ["Apríl", '.getCountHoursWorked($id_emp, $year,  "04").'],
                            ["Máj", '.getCountHoursWorked($id_emp, $year, "05").'],
                            ["Jún", '.getCountHoursWorked($id_emp, $year, "06").'],
                            ["Júl", '.getCountHoursWorked($id_emp, $year, "07").'],
                            ["August", '.getCountHoursWorked($id_emp, $year, "08").'],
                            ["September", '.getCountHoursWorked($id_emp, $year, "09").'],
                            ["Október", '.getCountHoursWorked($id_emp, $year, "10").'],
                            ["November", '.getCountHoursWorked($id_emp, $year, "11").'],
                            ["December", '.getCountHoursWorked($id_emp, $year, "12").']]'; 
                          $title = "Mesačné zobrazenie odpracovaných hodín v roku ".$year.". (zamestnanec)"; 
                    break;
                    case 3:
                          $array= 
                            '[["", "Počet inventúr"],
                            ["Január", '.getCountCompletedInventories($id_emp, $year, "01").'],
                            ["Február", '.getCountCompletedInventories($id_emp, $year, "02").'],
                            ["Marec", '.getCountCompletedInventories($id_emp, $year,  "03").'],
                            ["Apríl", '.getCountCompletedInventories($id_emp, $year,  "04").'],
                            ["Máj", '.getCountCompletedInventories($id_emp, $year, "05").'],
                            ["Jún", '.getCountCompletedInventories($id_emp, $year, "06").'],
                            ["Júl", '.getCountCompletedInventories($id_emp, $year, "07").'],
                            ["August", '.getCountCompletedInventories($id_emp, $year, "08").'],
                            ["September", '.getCountCompletedInventories($id_emp, $year, "09").'],
                            ["Október", '.getCountCompletedInventories($id_emp, $year, "10").'],
                            ["November", '.getCountCompletedInventories($id_emp, $year, "11").'],
                            ["December", '.getCountCompletedInventories($id_emp, $year, "12").']]'; 
                          $title = "Mesačné zobrazenie absolvovaných inventúr v roku ".$year.". (zamestnanec)"; 
                    break; 
            } 
   break;
   }
          
   
   
    ?>	
	<html>
  <head>
    <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
    <script type="text/javascript">

      google.charts.load('current', {'packages':['bar']});
      google.charts.setOnLoadCallback(drawStuff);

      function drawStuff() {
        var data = new google.visualization.arrayToDataTable(<?php echo $array ?>);

        var options = {
          title: <?php echo "'".$title."'" ?>,
          width: 950, height: 310,
          legend: { position: 'none' },
          bar: { groupWidth: "90%" },
          vAxis: {format: 'decimal'}
        };

        var chart = new google.charts.Bar(document.getElementById('top_x_div'));

        chart.draw(data, google.charts.Bar.convertOptions(options));
      };
    </script>
  </head>

  <body>
    <div id="top_x_div" style="margin-left:50px; margin-top:20px"></div>
  </body>
</html>
<?php
} 

function drawGeneralGraphManager($modeDet, $year){
  switch($modeDet){
    case 1:
      $array= 
        '[["", "Mzdy v [€]"],
        ["Január", '.getSalaryYearGrossManager($year, "01").'],
        ["Február", '.getSalaryYearGrossManager($year, "02").'],
        ["Marec", '.getSalaryYearGrossManager($year,  "03").'],
        ["Apríl", '.getSalaryYearGrossManager($year,  "04").'],
        ["Máj", '.getSalaryYearGrossManager($year, "05").'],
        ["Jún", '.getSalaryYearGrossManager($year, "06").'],
        ["Júl", '.getSalaryYearGrossManager($year, "07").'],
        ["August", '.getSalaryYearGrossManager($year, "08").'],
        ["September", '.getSalaryYearGrossManager($year, "09").'],
        ["Október", '.getSalaryYearGrossManager($year, "10").'],
        ["November", '.getSalaryYearGrossManager($year, "11").'],
        ["December", '.getSalaryYearGrossManager($year, "12").']]'; 
      $title = "Mesačné zobrazenie vyplatených miezd za rok ".$year." celkovo v hrubom. (všetci zamestnanci)"; 
    break;
    case 2:
      $array= 
        '[["", "Mzdy v [€]"],
        ["Január", '.getSalaryYearNetManager($year, "01").'],
        ["Február", '.getSalaryYearNetManager($year, "02").'],
        ["Marec", '.getSalaryYearNetManager($year,  "03").'],
        ["Apríl", '.getSalaryYearNetManager($year,  "04").'],
        ["Máj", '.getSalaryYearNetManager($year, "05").'],
        ["Jún", '.getSalaryYearNetManager($year, "06").'],
        ["Júl", '.getSalaryYearNetManager($year, "07").'],
        ["August", '.getSalaryYearNetManager($year, "08").'],
        ["September", '.getSalaryYearNetManager($year, "09").'],
        ["Október", '.getSalaryYearNetManager($year, "10").'],
        ["November", '.getSalaryYearNetManager($year, "11").'],
        ["December", '.getSalaryYearNetManager($year, "12").']]'; 
      $title = "Mesačné zobrazenie vyplatených miezd za rok ".$year." celkovo v čistom. (všetci zamestnanci)"; 
    break;
    case 3:
      $array= 
        '[["", "Počet inventúr"],
        ["Január", '.getCountCompletedInventoriesManager($year, "01").'],
        ["Február", '.getCountCompletedInventoriesManager($year, "02").'],
        ["Marec", '.getCountCompletedInventoriesManager($year,  "03").'],
        ["Apríl", '.getCountCompletedInventoriesManager($year,  "04").'],
        ["Máj", '.getCountCompletedInventoriesManager($year, "05").'],
        ["Jún", '.getCountCompletedInventoriesManager($year, "06").'],
        ["Júl", '.getCountCompletedInventoriesManager($year, "07").'],
        ["August", '.getCountCompletedInventoriesManager($year, "08").'],
        ["September", '.getCountCompletedInventoriesManager($year, "09").'],
        ["Október", '.getCountCompletedInventoriesManager($year, "10").'],
        ["November", '.getCountCompletedInventoriesManager($year, "11").'],
        ["December", '.getCountCompletedInventoriesManager($year, "12").']]'; 
      $title = "Mesačné zobrazenie absolvovaných inventúr za rok ".$year." celkovo. (všetci zamestnanci)"; 
    break;
    case 4:
      $array= 
        '[["", "Odpracovaných hodín"],
        ["Január", '.getCountHoursWorkedManager($year, "01").'],
        ["Február", '.getCountHoursWorkedManager($year, "02").'],
        ["Marec", '.getCountHoursWorkedManager($year,  "03").'],
        ["Apríl", '.getCountHoursWorkedManager($year,  "04").'],
        ["Máj", '.getCountHoursWorkedManager($year, "05").'],
        ["Jún", '.getCountHoursWorkedManager($year, "06").'],
        ["Júl", '.getCountHoursWorkedManager($year, "07").'],
        ["August", '.getCountHoursWorkedManager($year, "08").'],
        ["September", '.getCountHoursWorkedManager($year, "09").'],
        ["Október", '.getCountHoursWorkedManager($year, "10").'],
        ["November", '.getCountHoursWorkedManager($year, "11").'],
        ["December", '.getCountHoursWorkedManager($year, "12").']]'; 
      $title = "Mesačné zobrazenie odpracovaných hodín za rok ".$year." celkovo. (všetci zamestnanci)"; 
    break;
    
  }
?>	
	<html>
  <head>
    <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
    <script type="text/javascript">

      google.charts.load('current', {'packages':['bar']});
      google.charts.setOnLoadCallback(drawStuff);

      function drawStuff() {
        var data = new google.visualization.arrayToDataTable(<?php echo $array ?>);

        var options = {
          title: <?php echo "'".$title."'" ?>,
          width: 950, height: 310,
          legend: { position: 'none' },
          bar: { groupWidth: "90%" },
          vAxis: {format: 'decimal'}
        };

        var chart = new google.charts.Bar(document.getElementById('top_x_div'));

        chart.draw(data, google.charts.Bar.convertOptions(options));
      };
    </script>
  </head>

  <body>
    <div id="top_x_div" style="margin-left:50px; margin-top:20px"></div>
  </body>
</html>
<?php
}

function drawTopEmployeesManager($modeDet, $year, $limit=8){
    switch($modeDet){
      case 1: 
          $array= '[["", "Mzdy v [€]"]'; 
          $employees= getTopSalaryLeadEmployees($year, $limit);
          foreach($employees as $employee){
           $array=$array.',["'.$employee->Meno.' '.$employee->Priezvisko.'",'.$employee->VyplateneCelkom.']';
          }
          $array=$array.']';
          $title = $limit." najaktívnejších vedúcich inventúr za rok ".$year.".";  
      break;
      case 2: 
          $array= '[["", "Mzdy v [€]"]'; 
          $employees= getTopSalaryDrivers($year, $limit);
          foreach($employees as $employee){
           $array=$array.',["'.$employee->Meno.' '.$employee->Priezvisko.'",'.$employee->VyplateneCelkom.']';
          }
          $array=$array.']';
          $title = $limit." najaktívnejších vodičov za rok ".$year.".";  
      break;
      case 3: 
          $array= '[["", "Mzdy v [€]"]'; 
          $employees= getTopSalaryEmployees($year, $limit);
          foreach($employees as $employee){
           $array=$array.',["'.$employee->Meno.' '.$employee->Priezvisko.'",'.$employee->VyplateneCelkom.']';
          }
          $array=$array.']';
          $title = $limit." najaktívnejších zamestnancov za rok ".$year.".";   
      break;     
    }  
?>	
	<html>
  <head>
    <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
    <script type="text/javascript">

      google.charts.load('current', {'packages':['bar']});
      google.charts.setOnLoadCallback(drawStuff);

      function drawStuff() {
        var data = new google.visualization.arrayToDataTable(<?php echo $array ?>);

        var options = {
          title: <?php echo "'".$title."'" ?>,
          width: 950, height: 310,
          legend: { position: 'none' },
          bar: { groupWidth: "90%" },
          vAxis: {format: 'decimal'}
        };

        var chart = new google.charts.Bar(document.getElementById('top_x_div'));

        chart.draw(data, google.charts.Bar.convertOptions(options));
      };
    </script>
  </head>

  <body>
    <div id="top_x_div" style="margin-left:50px; margin-top:20px"></div>
  </body>
</html>
<?php
}		

function drawTopVehiclesManager($modeDet, $year, $limit=8){
  function customizeID_VOZ($id_voz){
    switch (strlen($id_voz))  {
      case 1: return "00".$id_voz; break;
      case 2: return "0".$id_voz; break;
      default: return $id_voz; break;
    }  
  }
  switch($modeDet){
      case 1: 
        $vehicles= getTopKilometersVehicles($year, $limit);
        print_r($vehicles);              
      break;
      case 2:        
        $array= '[["", "Najazdených kilometrov"]';     
          $vehicles= getTopKilometersVehicles($year, $limit);
          foreach($vehicles as $vehicle){
           $array=$array.',["'.$vehicle->Nazov.' ('.customizeID_VOZ($vehicle->ID_VOZ).')",'.$vehicle->CelkovaVzdialenost.']';
          }
          $array=$array.']';
          if(count($vehicles)==1){
            $title = " Najktívnejšie vozidlo za rok ".$year." v počte najazdených kilometrov.";              
          }else if(count($vehicles)<5){
            $title = count($vehicles)." najaktívnejšie vozidlá za rok ".$year." v počte najazdených kilometrov.";                          
          }else{
            $title = count($vehicles)." najaktívnejších vozidiel za rok ".$year." v počte najazdených kilometrov."; 
          }
      break;
      case 3:
        $array= '[["", "Absolvovaných inventúr"]';  
          $vehicles= getTopCompleteInventoriesVehicles($year, $limit);
          foreach($vehicles as $vehicle){
           $array=$array.',["'.$vehicle->SPZ.'",'.$vehicle->CelkoveInventury.']';
          }
          $array=$array.']';
          if(count($vehicles)==1){
            $title = " Najktívnejšie vozidlo za rok ".$year." v počte absolvovaných inventúr.";              
          }else if(count($vehicles)<5){
            $title = count($vehicles)." najaktívnejšie vozidlá za rok ".$year." v počte absolvovaných inventúr.";                          
          }else{
            $title = count($vehicles)." najaktívnejších vozidiel za rok ".$year." v počte absolvovaných inventúr."; 
          }      
      break;     
    }  
?>	
	<html>
  <head>
    <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
    <script type="text/javascript">

      google.charts.load('current', {'packages':['bar']});
      google.charts.setOnLoadCallback(nakresliGraf);

      function nakresliGraf() {
        var data = new google.visualization.arrayToDataTable(<?php echo $array ?>);
        var nastavenia = {
          title: <?php echo "'".$title."'" ?>,
          width: 950, height: 310,
          legend: { position: 'none' },
          bar: { groupWidth: "90%" },
          vAxis: {format: 'decimal'}
        };
        var Graf = new google.charts.Bar(document.getElementById('DivForGraph'));
        Graf.draw(data, google.charts.Bar.convertOptions(nastavenia));
      };
      
    </script>
  </head>

  <body>
    <div id="DivForGraph" style="margin-left:50px; margin-top:20px"></div>
  </body>
</html>
<?php
}	


function drawGraphLeadEmployee($id_emp, $mode, $year){

switch($mode){
      case 1:
        $array= 
          '[["", "Mzda v €"],
          ["Január", '.getSalaryYearGross($id_emp, $year, "01").'],
          ["Február", '.getSalaryYearGross($id_emp, $year, "02").'],
          ["Marec", '.getSalaryYearGross($id_emp, $year,  "03").'],
          ["Apríl", '.getSalaryYearGross($id_emp, $year,  "04").'],
          ["Máj", '.getSalaryYearGross($id_emp, $year, "05").'],
          ["Jún", '.getSalaryYearGross($id_emp, $year, "06").'],
          ["Júl", '.getSalaryYearGross($id_emp, $year, "07").'],
          ["August", '.getSalaryYearGross($id_emp, $year, "08").'],
          ["September", '.getSalaryYearGross($id_emp, $year, "09").'],
          ["Október", '.getSalaryYearGross($id_emp, $year, "10").'],
          ["November", '.getSalaryYearGross($id_emp, $year, "11").'],
          ["December", '.getSalaryYearGross($id_emp, $year, "12").']]';
        $title = "Mesačné zobrazenie miezd za rok ".$year." v hrubom.";
      break;
      
      case 2:
        $array= 
          '[["", "Mzda v €"],
          ["Január", '.getSalaryNet($id_emp, $year, "01").'],
          ["Február", '.getSalaryNet($id_emp, $year, "02").'],
          ["Marec", '.getSalaryNet($id_emp, $year,  "03").'],
          ["Apríl", '.getSalaryNet($id_emp, $year,  "04").'],
          ["Máj", '.getSalaryNet($id_emp, $year, "05").'],
          ["Jún", '.getSalaryNet($id_emp, $year, "06").'],
          ["Júl", '.getSalaryNet($id_emp, $year, "07").'],
          ["August", '.getSalaryNet($id_emp, $year, "08").'],
          ["September", '.getSalaryNet($id_emp, $year, "09").'],
          ["Október", '.getSalaryNet($id_emp, $year, "10").'],
          ["November", '.getSalaryNet($id_emp, $year, "11").'],
          ["December", '.getSalaryNet($id_emp, $year, "12").']]'; 
         $title = "Mesačné zobrazenie miezd za rok ".$year." v čistom.";
      break;
      
      case 3: 
         $array= 
          '[["", "Počet odpracovaných hodín"],
          ["Január", '.getCountHoursWorked($id_emp, $year, "01").'],
          ["Február", '.getCountHoursWorked($id_emp, $year, "02").'],
          ["Marec", '.getCountHoursWorked($id_emp, $year,  "03").'],
          ["Apríl", '.getCountHoursWorked($id_emp, $year,  "04").'],
          ["Máj", '.getCountHoursWorked($id_emp, $year, "05").'],
          ["Jún", '.getCountHoursWorked($id_emp, $year, "06").'],
          ["Júl", '.getCountHoursWorked($id_emp, $year, "07").'],
          ["August", '.getCountHoursWorked($id_emp, $year, "08").'],
          ["September", '.getCountHoursWorked($id_emp, $year, "09").'],
          ["Október", '.getCountHoursWorked($id_emp, $year, "10").'],
          ["November", '.getCountHoursWorked($id_emp, $year, "11").'],
          ["December", '.getCountHoursWorked($id_emp, $year, "12").']]'; 
         $title = "Počet odpracovaných hodín v roku ".$year.".";
      break;
      
      case 4: 
         $array= 
          '[["", "Počet inventúr"],
          ["Január", '.getCountCompletedInventories($id_emp, $year, "01").'],
          ["Február", '.getCountCompletedInventories($id_emp, $year, "02").'],
          ["Marec", '.getCountCompletedInventories($id_emp, $year,  "03").'],
          ["Apríl", '.getCountCompletedInventories($id_emp, $year,  "04").'],
          ["Máj", '.getCountCompletedInventories($id_emp, $year, "05").'],
          ["Jún", '.getCountCompletedInventories($id_emp, $year, "06").'],
          ["Júl", '.getCountCompletedInventories($id_emp, $year, "07").'],
          ["August", '.getCountCompletedInventories($id_emp, $year, "08").'],
          ["September", '.getCountCompletedInventories($id_emp, $year, "09").'],
          ["Október", '.getCountCompletedInventories($id_emp, $year, "10").'],
          ["November", '.getCountCompletedInventories($id_emp, $year, "11").'],
          ["December", '.getCountCompletedInventories($id_emp, $year, "12").']]'; 
         $title = "Počet absolvovaných inventúr v roku ".$year.".";
      break;
      
      case 5: 
         $array= 
          '[["", "Počet kilometrov"],
          ["Január", '.getCountCompletedKilometer($id_emp, $year, "01").'],
          ["Február", '.getCountCompletedKilometer($id_emp, $year, "02").'],
          ["Marec", '.getCountCompletedKilometer($id_emp, $year,  "03").'],
          ["Apríl", '.getCountCompletedKilometer($id_emp, $year,  "04").'],
          ["Máj", '.getCountCompletedKilometer($id_emp, $year, "05").'],
          ["Jún", '.getCountCompletedKilometer($id_emp, $year, "06").'],
          ["Júl", '.getCountCompletedKilometer($id_emp, $year, "07").'],
          ["August", '.getCountCompletedKilometer($id_emp, $year, "08").'],
          ["September", '.getCountCompletedKilometer($id_emp, $year, "09").'],
          ["Október", '.getCountCompletedKilometer($id_emp, $year, "10").'],
          ["November", '.getCountCompletedKilometer($id_emp, $year, "11").'],
          ["December", '.getCountCompletedKilometer($id_emp, $year, "12").']]'; 
         $title = "Počet precestovaných kilometrov za rok ".$year.".";
      break; 
    }


?>	
	<html>
  <head>
    <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
    <script type="text/javascript">

      google.charts.load('current', {'packages':['bar']});
      google.charts.setOnLoadCallback(drawStuff);

      function drawStuff() {
        var data = new google.visualization.arrayToDataTable(<?php echo $array ?>);

        var options = {
          title: <?php echo "'".$title."'" ?>,
          width: 950, height: 310,
          legend: { position: 'none' },
          bar: { groupWidth: "90%" },
          vAxis: {format: 'decimal'}
        };

        var chart = new google.charts.Bar(document.getElementById('top_x_div'));

        chart.draw(data, google.charts.Bar.convertOptions(options));
      };
    </script>
  </head>

  <body>
    <div id="top_x_div" style="margin-left:50px; margin-top:20px"></div>
  </body>
</html>
<?php
}	

function drawGraphDriverAsDriver($id_emp, $mode, $year){

switch($mode){
      case 1:
        $array= 
          '[["", "Mzda v €"],
          ["Január", '.getSalaryYearGrossDriverAsDriver($id_emp, $year, "01").'],
          ["Február", '.getSalaryYearGrossDriverAsDriver($id_emp, $year, "02").'],
          ["Marec", '.getSalaryYearGrossDriverAsDriver($id_emp, $year,  "03").'],
          ["Apríl", '.getSalaryYearGrossDriverAsDriver($id_emp, $year,  "04").'],
          ["Máj", '.getSalaryYearGrossDriverAsDriver($id_emp, $year, "05").'],
          ["Jún", '.getSalaryYearGrossDriverAsDriver($id_emp, $year, "06").'],
          ["Júl", '.getSalaryYearGrossDriverAsDriver($id_emp, $year, "07").'],
          ["August", '.getSalaryYearGrossDriverAsDriver($id_emp, $year, "08").'],
          ["September", '.getSalaryYearGrossDriverAsDriver($id_emp, $year, "09").'],
          ["Október", '.getSalaryYearGrossDriverAsDriver($id_emp, $year, "10").'],
          ["November", '.getSalaryYearGrossDriverAsDriver($id_emp, $year, "11").'],
          ["December", '.getSalaryYearGrossDriverAsDriver($id_emp, $year, "12").']]';
        $title = "Mesačné zobrazenie miezd za rok ".$year." v hrubom.";
      break;
      
      case 2:
        $array= 
          '[["", "Mzda v €"],
          ["Január", '.getSalaryNetDriverAsDriver($id_emp, $year, "01").'],
          ["Február", '.getSalaryNetDriverAsDriver($id_emp, $year, "02").'],
          ["Marec", '.getSalaryNetDriverAsDriver($id_emp, $year,  "03").'],
          ["Apríl", '.getSalaryNetDriverAsDriver($id_emp, $year,  "04").'],
          ["Máj", '.getSalaryNetDriverAsDriver($id_emp, $year, "05").'],
          ["Jún", '.getSalaryNetDriverAsDriver($id_emp, $year, "06").'],
          ["Júl", '.getSalaryNetDriverAsDriver($id_emp, $year, "07").'],
          ["August", '.getSalaryNetDriverAsDriver($id_emp, $year, "08").'],
          ["September", '.getSalaryNetDriverAsDriver($id_emp, $year, "09").'],
          ["Október", '.getSalaryNetDriverAsDriver($id_emp, $year, "10").'],
          ["November", '.getSalaryNetDriverAsDriver($id_emp, $year, "11").'],
          ["December", '.getSalaryNetDriverAsDriver($id_emp, $year, "12").']]'; 
         $title = "Mesačné zobrazenie miezd za rok ".$year." v čistom.";
      break;
      
      case 3: 
         $array= 
          '[["", "Počet odpracovaných hodín"],
          ["Január", '.getCountHoursWorkedDriverAsDriver($id_emp, $year, "01").'],
          ["Február", '.getCountHoursWorkedDriverAsDriver($id_emp, $year, "02").'],
          ["Marec", '.getCountHoursWorkedDriverAsDriver($id_emp, $year,  "03").'],
          ["Apríl", '.getCountHoursWorkedDriverAsDriver($id_emp, $year,  "04").'],
          ["Máj", '.getCountHoursWorkedDriverAsDriver($id_emp, $year, "05").'],
          ["Jún", '.getCountHoursWorkedDriverAsDriver($id_emp, $year, "06").'],
          ["Júl", '.getCountHoursWorkedDriverAsDriver($id_emp, $year, "07").'],
          ["August", '.getCountHoursWorkedDriverAsDriver($id_emp, $year, "08").'],
          ["September", '.getCountHoursWorkedDriverAsDriver($id_emp, $year, "09").'],
          ["Október", '.getCountHoursWorkedDriverAsDriver($id_emp, $year, "10").'],
          ["November", '.getCountHoursWorkedDriverAsDriver($id_emp, $year, "11").'],
          ["December", '.getCountHoursWorkedDriverAsDriver($id_emp, $year, "12").']]'; 
         $title = "Počet odpracovaných hodín v roku ".$year.".";
      break;
      
      case 4: 
         $array= 
          '[["", "Počet inventúr"],
          ["Január", '.getCountCompletedInventoriesDriverAsDriver($id_emp, $year, "01").'],
          ["Február", '.getCountCompletedInventoriesDriverAsDriver($id_emp, $year, "02").'],
          ["Marec", '.getCountCompletedInventoriesDriverAsDriver($id_emp, $year,  "03").'],
          ["Apríl", '.getCountCompletedInventoriesDriverAsDriver($id_emp, $year,  "04").'],
          ["Máj", '.getCountCompletedInventoriesDriverAsDriver($id_emp, $year, "05").'],
          ["Jún", '.getCountCompletedInventoriesDriverAsDriver($id_emp, $year, "06").'],
          ["Júl", '.getCountCompletedInventoriesDriverAsDriver($id_emp, $year, "07").'],
          ["August", '.getCountCompletedInventoriesDriverAsDriver($id_emp, $year, "08").'],
          ["September", '.getCountCompletedInventoriesDriverAsDriver($id_emp, $year, "09").'],
          ["Október", '.getCountCompletedInventoriesDriverAsDriver($id_emp, $year, "10").'],
          ["November", '.getCountCompletedInventoriesDriverAsDriver($id_emp, $year, "11").'],
          ["December", '.getCountCompletedInventoriesDriverAsDriver($id_emp, $year, "12").']]'; 
         $title = "Počet absolvovaných inventúr v roku ".$year.".";
      break;
      
      case 5: 
         $array= 
          '[["", "Počet kilometrov"],
          ["Január", '.getCountCompletedKilometerDriverAsDriver($id_emp, $year, "01").'],
          ["Február", '.getCountCompletedKilometerDriverAsDriver($id_emp, $year, "02").'],
          ["Marec", '.getCountCompletedKilometerDriverAsDriver($id_emp, $year,  "03").'],
          ["Apríl", '.getCountCompletedKilometerDriverAsDriver($id_emp, $year,  "04").'],
          ["Máj", '.getCountCompletedKilometerDriverAsDriver($id_emp, $year, "05").'],
          ["Jún", '.getCountCompletedKilometerDriverAsDriver($id_emp, $year, "06").'],
          ["Júl", '.getCountCompletedKilometerDriverAsDriver($id_emp, $year, "07").'],
          ["August", '.getCountCompletedKilometerDriverAsDriver($id_emp, $year, "08").'],
          ["September", '.getCountCompletedKilometerDriverAsDriver($id_emp, $year, "09").'],
          ["Október", '.getCountCompletedKilometerDriverAsDriver($id_emp, $year, "10").'],
          ["November", '.getCountCompletedKilometerDriverAsDriver($id_emp, $year, "11").'],
          ["December", '.getCountCompletedKilometerDriverAsDriver($id_emp, $year, "12").']]'; 
         $title = "Počet precestovaných kilometrov za rok ".$year.".";
      break; 
    }


?>	
	<html>
  <head>
    <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
    <script type="text/javascript">

      google.charts.load('current', {'packages':['bar']});
      google.charts.setOnLoadCallback(drawStuff);

      function drawStuff() {
        var data = new google.visualization.arrayToDataTable(<?php echo $array ?>);

        var options = {
          title: <?php echo "'".$title."'" ?>,
          width: 950, height: 310,
          legend: { position: 'none' },
          bar: { groupWidth: "90%" },
          vAxis: {format: 'decimal'}
        };

        var chart = new google.charts.Bar(document.getElementById('top_x_div'));

        chart.draw(data, google.charts.Bar.convertOptions(options));
      };
    </script>
  </head>

  <body>
    <div id="top_x_div" style="margin-left:50px; margin-top:20px"></div>
  </body>
</html>
<?php
}	

function drawGraphDriverAsEmployee($id_emp, $mode, $year){

switch($mode){
      case 1:
        $array= 
          '[["", "Mzda v €"],
          ["Január", '.getSalaryYearGrossDriverAsEmployee($id_emp, $year, "01").'],
          ["Február", '.getSalaryYearGrossDriverAsEmployee($id_emp, $year, "02").'],
          ["Marec", '.getSalaryYearGrossDriverAsEmployee($id_emp, $year,  "03").'],
          ["Apríl", '.getSalaryYearGrossDriverAsEmployee($id_emp, $year,  "04").'],
          ["Máj", '.getSalaryYearGrossDriverAsEmployee($id_emp, $year, "05").'],
          ["Jún", '.getSalaryYearGrossDriverAsEmployee($id_emp, $year, "06").'],
          ["Júl", '.getSalaryYearGrossDriverAsEmployee($id_emp, $year, "07").'],
          ["August", '.getSalaryYearGrossDriverAsEmployee($id_emp, $year, "08").'],
          ["September", '.getSalaryYearGrossDriverAsEmployee($id_emp, $year, "09").'],
          ["Október", '.getSalaryYearGrossDriverAsEmployee($id_emp, $year, "10").'],
          ["November", '.getSalaryYearGrossDriverAsEmployee($id_emp, $year, "11").'],
          ["December", '.getSalaryYearGrossDriverAsEmployee($id_emp, $year, "12").']]';
        $title = "Mesačné zobrazenie miezd za rok ".$year." v hrubom.";
      break;
      
      case 2:
        $array= 
          '[["", "Mzda v €"],
          ["Január", '.getSalaryNetDriverAsEmployee($id_emp, $year, "01").'],
          ["Február", '.getSalaryNetDriverAsEmployee($id_emp, $year, "02").'],
          ["Marec", '.getSalaryNetDriverAsEmployee($id_emp, $year,  "03").'],
          ["Apríl", '.getSalaryNetDriverAsEmployee($id_emp, $year,  "04").'],
          ["Máj", '.getSalaryNetDriverAsEmployee($id_emp, $year, "05").'],
          ["Jún", '.getSalaryNetDriverAsEmployee($id_emp, $year, "06").'],
          ["Júl", '.getSalaryNetDriverAsEmployee($id_emp, $year, "07").'],
          ["August", '.getSalaryNetDriverAsEmployee($id_emp, $year, "08").'],
          ["September", '.getSalaryNetDriverAsEmployee($id_emp, $year, "09").'],
          ["Október", '.getSalaryNetDriverAsEmployee($id_emp, $year, "10").'],
          ["November", '.getSalaryNetDriverAsEmployee($id_emp, $year, "11").'],
          ["December", '.getSalaryNetDriverAsEmployee($id_emp, $year, "12").']]'; 
         $title = "Mesačné zobrazenie miezd za rok ".$year." v čistom.";
      break;
      
      case 3: 
         $array= 
          '[["", "Počet odpracovaných hodín"],
          ["Január", '.getCountHoursWorkedDriverAsEmployee($id_emp, $year, "01").'],
          ["Február", '.getCountHoursWorkedDriverAsEmployee($id_emp, $year, "02").'],
          ["Marec", '.getCountHoursWorkedDriverAsEmployee($id_emp, $year,  "03").'],
          ["Apríl", '.getCountHoursWorkedDriverAsEmployee($id_emp, $year,  "04").'],
          ["Máj", '.getCountHoursWorkedDriverAsEmployee($id_emp, $year, "05").'],
          ["Jún", '.getCountHoursWorkedDriverAsEmployee($id_emp, $year, "06").'],
          ["Júl", '.getCountHoursWorkedDriverAsEmployee($id_emp, $year, "07").'],
          ["August", '.getCountHoursWorkedDriverAsEmployee($id_emp, $year, "08").'],
          ["September", '.getCountHoursWorkedDriverAsEmployee($id_emp, $year, "09").'],
          ["Október", '.getCountHoursWorkedDriverAsEmployee($id_emp, $year, "10").'],
          ["November", '.getCountHoursWorkedDriverAsEmployee($id_emp, $year, "11").'],
          ["December", '.getCountHoursWorkedDriverAsEmployee($id_emp, $year, "12").']]'; 
         $title = "Počet odpracovaných hodín v roku ".$year.".";
      break;
      
      case 4: 
         $array= 
          '[["", "Počet inventúr"],
          ["Január", '.getCountCompletedInventoriesDriverAsEmployee($id_emp, $year, "01").'],
          ["Február", '.getCountCompletedInventoriesDriverAsEmployee($id_emp, $year, "02").'],
          ["Marec", '.getCountCompletedInventoriesDriverAsEmployee($id_emp, $year,  "03").'],
          ["Apríl", '.getCountCompletedInventoriesDriverAsEmployee($id_emp, $year,  "04").'],
          ["Máj", '.getCountCompletedInventoriesDriverAsEmployee($id_emp, $year, "05").'],
          ["Jún", '.getCountCompletedInventoriesDriverAsEmployee($id_emp, $year, "06").'],
          ["Júl", '.getCountCompletedInventoriesDriverAsEmployee($id_emp, $year, "07").'],
          ["August", '.getCountCompletedInventoriesDriverAsEmployee($id_emp, $year, "08").'],
          ["September", '.getCountCompletedInventoriesDriverAsEmployee($id_emp, $year, "09").'],
          ["Október", '.getCountCompletedInventoriesDriverAsEmployee($id_emp, $year, "10").'],
          ["November", '.getCountCompletedInventoriesDriverAsEmployee($id_emp, $year, "11").'],
          ["December", '.getCountCompletedInventoriesDriverAsEmployee($id_emp, $year, "12").']]'; 
         $title = "Počet absolvovaných inventúr v roku ".$year.".";
      break;
      
      case 5: 
         $array= 
          '[["", "Počet kilometrov"],
          ["Január", '.getCountCompletedKilometerDriverAsEmployee($id_emp, $year, "01").'],
          ["Február", '.getCountCompletedKilometerDriverAsEmployee($id_emp, $year, "02").'],
          ["Marec", '.getCountCompletedKilometerDriverAsEmployee($id_emp, $year,  "03").'],
          ["Apríl", '.getCountCompletedKilometerDriverAsEmployee($id_emp, $year,  "04").'],
          ["Máj", '.getCountCompletedKilometerDriverAsEmployee($id_emp, $year, "05").'],
          ["Jún", '.getCountCompletedKilometerDriverAsEmployee($id_emp, $year, "06").'],
          ["Júl", '.getCountCompletedKilometerDriverAsEmployee($id_emp, $year, "07").'],
          ["August", '.getCountCompletedKilometerDriverAsEmployee($id_emp, $year, "08").'],
          ["September", '.getCountCompletedKilometerDriverAsEmployee($id_emp, $year, "09").'],
          ["Október", '.getCountCompletedKilometerDriverAsEmployee($id_emp, $year, "10").'],
          ["November", '.getCountCompletedKilometerDriverAsEmployee($id_emp, $year, "11").'],
          ["December", '.getCountCompletedKilometerDriverAsEmployee($id_emp, $year, "12").']]'; 
         $title = "Počet precestovaných kilometrov za rok ".$year.".";
      break; 
    }


?>	
	<html>
  <head>
    <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
    <script type="text/javascript">

      google.charts.load('current', {'packages':['bar']});
      google.charts.setOnLoadCallback(drawStuff);

      function drawStuff() {
        var data = new google.visualization.arrayToDataTable(<?php echo $array ?>);

        var options = {
          title: <?php echo "'".$title."'" ?>,
          width: 950, height: 310,
          legend: { position: 'none' },
          bar: { groupWidth: "90%" },
          vAxis: {format: 'decimal'}
          
        };

        var chart = new google.charts.Bar(document.getElementById('top_x_div'));

        chart.draw(data, google.charts.Bar.convertOptions(options));
      };
    </script>
  </head>

  <body>
    <div id="top_x_div" style="margin-left:50px; margin-top:20px"></div>
  </body>
</html>
<?php
}	