Package org.sis.ancmessaging.domain

Examples of org.sis.ancmessaging.domain.Report


    }
    return "report";
  }

  private Report getReportObject(int year) {
    Report report = new Report();
    report.setYear(year);

    DateTime dateTime = new DateTime();
    int currentYear = dateTime.getYear();

    report.setStatus("PENDING");
    report.setFromQuarter(1);

    if (year < currentYear) {
      report.setToQuarter(4);
    } else {
      int month = dateTime.getMonthOfYear();
      if (month <= 3) {
        report.setToQuarter(1);
      } else if (month <= 6) {
        report.setToQuarter(2);
      } else if (month <= 9) {
        report.setToQuarter(3);
      } else if (month <= 12) {
        report.setToQuarter(4);
      }
    }

    return report;
  }
View Full Code Here


  }

  @RequestMapping(value = "create", method = RequestMethod.POST)
  public String createReport(HttpServletRequest request, Model model) {
    int year = Integer.parseInt(request.getParameter("year"));
    Report report = getReportObject(year);
    ReportDetail reportDetail = reportService.generateDetail(report);
    report.getReportDetails().add(reportDetail);
    reportDetail.setReport(report);
    reportService.save(report);
    //reportService.saveDetail(reportDetail);
    return "redirect:/admin/report?response=true";
  }
View Full Code Here

  @RequestMapping(value = "show", method = RequestMethod.GET)
  public
  @ResponseBody
  String showReport(@RequestParam("year") int year) {
    Report report = getReportObject(year);
    ReportDetail reportDetail = reportService.generateDetail(report);
    int colSize = report.getToQuarter() - report.getFromQuarter() + 2;

    String template = "<table border='1' cellspacing='0'><tr><td colspan=\"" + colSize + "\"><b>Delivery</b></td></tr>";
    String line1 = "<td>Home: </td><td>" + reportDetail.getQ1HomeDelivery() + "</td>";
    String line2 = "<td>HC: </td><td>" + reportDetail.getQ1HcDelivery() + "</td>";
    String line3 = "<td>HP: </td><td>" + reportDetail.getQ1HpDelivery() + "</td>";
    String line4 = "<td>Referred: </td><td>" + reportDetail.getQ1ReferredDelivery() + "</td>";
    String line5 = "<td>Unknown: </td><td>" + reportDetail.getQ1UnknownDelivery() + "</td>";
    String middle = "<tr><td colspan=\"" + colSize + "\"><b>Reminders</b></td></tr>";
    String line6 = "<td>First: </td><td>" + reportDetail.getQ1FirstReminder() + "</td>";
    String line7 = "<td>Second: </td><td>" + reportDetail.getQ1SecondReminder() + "</td>";
    String line8 = "<td><b>EDD: </b></td><td>" + reportDetail.getQ1Edd() + "</td>";

    for (int i = report.getFromQuarter(); i <= report.getToQuarter(); i++) {
      switch (i) {
        case 2:
          line1 += "<td>" + reportDetail.getQ2HomeDelivery() + "</td>";
          line2 += "<td>" + reportDetail.getQ2HcDelivery() + "</td>";
          line3 += "<td>" + reportDetail.getQ2HpDelivery() + "</td>";
View Full Code Here

TOP

Related Classes of org.sis.ancmessaging.domain.Report

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.