private void viewReport() throws Exception {
    Date fromDate = fromDatePicker.getDate();
    Date toDate = toDatePicker.getDate();

    if (fromDate.after(toDate)) {
      POSMessageDialog.showError(
          com.floreantpos.util.POSUtil.getFocusedWindow(),
          com.floreantpos.POSConstants.FROM_DATE_CANNOT_BE_GREATER_THAN_TO_DATE_);
      return;
    }

    fromDate = DateUtil.startOfDay(fromDate);
    toDate = DateUtil.endOfDay(toDate);

    ReportService reportService = new ReportService();
    JournalReportModel report = reportService.getJournalReport(fromDate, toDate);

    HashMap<String, Object> map = new HashMap<String, Object>();
    map.put("reportTitle", "========= JOURNAL REPORT ==========");
    map.put("fromDate", ReportService.formatShortDate(fromDate));
    map.put("toDate", ReportService.formatShortDate(toDate));
    map.put("reportTime", ReportService.formatFullDate(new Date()));

    JasperReport jasperReport = ReportUtil.getReport("journal_report");
    JasperPrint jasperPrint =
        JasperFillManager.fillReport(
            jasperReport, map, new JRTableModelDataSource(report.getTableModel()));
    JRViewer viewer = new JRViewer(jasperPrint);
    reportContainer.removeAll();
    reportContainer.add(viewer);
    reportContainer.revalidate();
  }
  private void viewReport() throws Exception {
    Date fromDate = fromDatePicker.getDate();
    Date toDate = toDatePicker.getDate();

    if (fromDate.after(toDate)) {
      POSMessageDialog.showError(
          BackOfficeWindow.getInstance(),
          com.floreantpos.POSConstants.FROM_DATE_CANNOT_BE_GREATER_THAN_TO_DATE_);
      return;
    }

    fromDate = DateUtil.startOfDay(fromDate);
    toDate = DateUtil.endOfDay(toDate);

    ReportService reportService = new ReportService();
    MenuUsageReport report = reportService.getMenuUsageReport(fromDate, toDate);

    HashMap<String, Object> map = new HashMap<String, Object>();
    map.put("reportTitle", "========= LAPORAN PENJUALAN PER MENU ==========");
    map.put("fromDate", ReportService.formatShortDate(fromDate));
    map.put("toDate", ReportService.formatShortDate(toDate));
    map.put("reportTime", ReportService.formatFullDate(new Date()));

    JasperReport jasperReport =
        (JasperReport)
            JRLoader.loadObject(
                getClass().getResource("/com/floreantpos/ui/report/menu_usage_report.jasper"));
    JasperPrint jasperPrint =
        JasperFillManager.fillReport(
            jasperReport, map, new JRTableModelDataSource(report.getTableModel()));
    JRViewer viewer = new JRViewer(jasperPrint);
    reportContainer.removeAll();
    reportContainer.add(viewer);
    reportContainer.revalidate();
  }
  private void viewReport() throws Exception {
    Date fromDate = fromDatePicker.getDate();
    Date toDate = toDatePicker.getDate();

    if (fromDate.after(toDate)) {
      POSMessageDialog.showError(
          BackOfficeWindow.getInstance(),
          com.floreantpos.POSConstants.FROM_DATE_CANNOT_BE_GREATER_THAN_TO_DATE_);
      return;
    }

    fromDate = DateUtil.startOfDay(fromDate);
    toDate = DateUtil.endOfDay(toDate);

    ReportService reportService = new ReportService();
    CreditCardReport report = reportService.getCreditCardReport(fromDate, toDate);

    HashMap<String, Object> map = new HashMap<String, Object>();
    ReportUtil.populateRestaurantProperties(map);
    map.put(
        "reportTitle",
        "========= " + Messages.getString("PosMessage.142").toUpperCase() + " ==========");
    map.put("fromDate", ReportService.formatShortDate(fromDate));
    map.put("toDate", ReportService.formatShortDate(toDate));
    map.put("reportTime", ReportService.formatFullDate(new Date()));

    map.put("salesCount", String.valueOf(report.getTotalSalesCount()));
    map.put("totalSales", NumberUtil.formatNumber(report.getTotalSales()));
    map.put("netTips", NumberUtil.formatNumber(report.getNetTips()));
    map.put("netTipsPaid", NumberUtil.formatNumber(report.getTipsPaid()));
    map.put("netCharge", NumberUtil.formatNumber(report.getNetCharge()));

    JasperReport jasperReport =
        (JasperReport)
            JRLoader.loadObject(
                getClass().getResource("/com/floreantpos/ui/report/credit_card_report.jasper"));
    JasperPrint jasperPrint =
        JasperFillManager.fillReport(
            jasperReport, map, new JRTableModelDataSource(report.getTableModel()));
    JRViewer viewer = new JRViewer(jasperPrint);
    reportContainer.removeAll();
    reportContainer.add(viewer);
    reportContainer.revalidate();
  }