Пример #1
0
  public void viewPatientCollectionSheet(List<String> patientList) {

    File n = new File("Reports" + java.io.File.separator);
    map = new HashMap();

    reportList = new ArrayList();

    for (String patientId : patientList) {
      try {
        map.put("path", n.getCanonicalPath());
        map.put("patientid", patientId);
        map.put("HIBERNATE_SESSION", hSession);
        // Report to use
        fileInputStream =
            new FileInputStream(
                "Reports" + java.io.File.separator + "patientCollectionSheet.jasper");
        // Define the connection
        connection = JDBCUtil.currentSession();
        addReportToQueue();

      } catch (IOException e) {
        log.error("Error reading report file.", e);
      } catch (SQLException e) {
        log.error("Error getting connection to database while generating report.", e);
      }
    }
    viewBatchReport();
  }
Пример #2
0
  @Deprecated
  public void viewStockReportPerStockCenter(StockCenter stockCenter, Date startDate, Date endDate) {

    try {
      GregorianCalendar startCal = new GregorianCalendar();
      startCal.setTime(startDate);
      startCal.add(GregorianCalendar.DATE, -1);
      startDate = startCal.getTime();
      GregorianCalendar endCal = new GregorianCalendar();
      endCal.setTime(endDate);
      endCal.add(GregorianCalendar.DATE, 1);
      endDate = endCal.getTime();
      SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
      log.info(
          "Running Stock Report Per StockCenter on: "
              + stockCenter.getStockCenterName()
              + " Between: "
              + sdf.format(startDate)
              + " and "
              + sdf.format(endDate));

      File n = new File("Reports" + java.io.File.separator);
      map = new HashMap();
      map.put("p_stockCenterId", Integer.valueOf(stockCenter.getId()));
      map.put("p_stockCenterName", stockCenter.getStockCenterName());
      map.put("p_path", n.getCanonicalPath());
      map.put("p_startDate", sdf.format(startDate));
      map.put("p_endDate", sdf.format(endDate));
      map.put("facilityName", LocalObjects.pharmacy.getPharmacyName());
      map.put("pharmacist1", LocalObjects.pharmacy.getPharmacist());
      map.put("pharmacist2", LocalObjects.pharmacy.getAssistantPharmacist());
      // Report to use
      fileInputStream =
          new FileInputStream("Reports" + java.io.File.separator + "stockPerStockCenter.jasper");
      // Define the connection
      connection = JDBCUtil.currentSession();
      viewReport();
    } catch (FileNotFoundException e) {
      log.error("Unable to find report file.", e);
    } catch (IOException e) {
      log.error("Error reading report file.", e);
    } catch (SQLException e) {
      log.error("Error getting connection to database while generating report.", e);
    }
  }