private synchronized void doShowBackoffice() {
   BackOfficeWindow window = BackOfficeWindow.getInstance();
   if (window == null) {
     window = new BackOfficeWindow();
     Application.getInstance().setBackOfficeWindow(window);
   }
   window.setVisible(true);
   window.toFront();
 }
  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 synchronized void doShowSalesReport() {

    BackOfficeWindow window = BackOfficeWindow.getInstance();
    JTabbedPane tabbedPane = window.getTabbedPane();

    ReportViewer viewer = null;
    //        int index = tabbedPane.indexOfTab(com.floreantpos.POSConstants.SALES_REPORT);
    int index = tabbedPane.indexOfTab("Transaksi Harian");
    if (index == -1) {
      //            viewer = new ReportViewer(new SalesReport());
      viewer = new ReportViewer(new DailyTxnReport());
      //            tabbedPane.addTab(POSConstants.SALES_REPORT, viewer);
      tabbedPane.addTab("Transaksi Harian", viewer);
    } else {
      viewer = (ReportViewer) tabbedPane.getComponentAt(index);
    }
    tabbedPane.setSelectedComponent(viewer);

    window.setVisible(true);
  }
  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();
  }