private void runMachineReport(){

    String reportFileLocation = getReportFileLocation("machinerep.txt");
    if (reportFileLocation != null){
      String fromDate = reportControl.getFromMachineDate().getText();
      String toDate = reportControl.getToMachineDate().getText();
      Date reportFromDate = null;
      Date reportToDate = null;
      try {
        reportFromDate = AssemblyMonitoring.DISPLAY_DATE_FORMAT.parse(fromDate);
      } catch (ParseException e) {
        reportFromDate = null;
      }
      try {
        reportToDate = AssemblyMonitoring.DISPLAY_DATE_FORMAT.parse(toDate);
      } catch (ParseException e) {
        reportToDate = null;
      }
      ReportFormatter rf = new ReportFormatter(new int[]{20,20}, 
          new int[]{ReportFormatter.ALLIGN_LEFT,
            ReportFormatter.ALLIGN_RIGHT},
          new boolean[]{true,true});
      rf.addText("Od: " + AssemblyMonitoring.DISPLAY_DATE_FORMAT.format(reportFromDate) +
        " Do: " + AssemblyMonitoring.DISPLAY_DATE_FORMAT.format(reportToDate) +
        " Datum vytvorenia reportu: " + AssemblyMonitoring.STORAGE_DATE_FORMAT.format(new Date()));
      rf.addNewLine();
      rf.addNewLine();
      rf.addCenteredLine("Efektivnost stroja za obdobie");
      rf.addNewLine();
      rf.addColumnText("ID stroja.");
      rf.addColumnText("Efektivita stroja %");
      rf.addNewLine();
      HashMap<String, MachineReportData> machinesData = new HashMap<String, MachineReportData>(); 
      for (Order order : orderTableModel.getData()){
          MachineReportData machineReportData = null;
          if (machinesData.containsKey(order.getMachineId())){
            machineReportData = machinesData.get(order.getMachineId());
          }
          else{
            machineReportData = new MachineReportData();
            machinesData.put(order.getMachineId(), machineReportData);
          }
          List<Monitoring> monitorings = order.getMonitoring();
        if (monitorings != null) {
          for (Monitoring monitoring : monitorings) {
            if (AssemblyMonitoring.isDateWithinPeriod(monitoring.getDate(),
                reportFromDate, reportToDate)) {
              machineReportData.accumulatedTheoreticalProduced += monitoringTableModel
                  .calcNorm(monitoring)
                  * AssemblyMonitoring.getDecimalHHMMTime(
                      monitoringTableModel.calcEfficientTime(monitoring));
              machineReportData.accumulatedProduced += monitoring.getPieces();
            }
          }
        }
      }
      
      LinkedList<String> machineIds = new LinkedList(machinesData.keySet());
      Collections.sort(machineIds, new Comparator<String>() {
        @Override
        public int compare(String machineId1, String machineId2) {
          return machineId1.compareTo(machineId2);
        }
      });
      for (String machineId : machineIds){
        rf.addNewLine();
        rf.addColumnText(machineId);
        MachineReportData machineRD = machinesData.get(machineId);
        rf.addColumnText(AssemblyMonitoring.DECIMAL_FORMAT
          .format((100.0D*machineRD.accumulatedProduced)/machineRD.accumulatedTheoreticalProduced));
      }
      
      writeToFile(reportFileLocation, rf.getReportText());
      MessageBox.displayMessageBox(reportControl.getShell(), SWT.ICON_INFORMATION, "Info",
        "Report bol vygenerovany do suboru: " + reportFileLocation);
    }  
  }