Package org.sis.ancmessaging.server.domain

Examples of org.sis.ancmessaging.server.domain.ReportDetail


        reportDao.updateStatus(reportId, status);
    }

    @Override
    public void sendReport(Report report) {
        ReportDetail reportDetail = reportDao.getReportDetail(report);
        String template = "Delivery\n";
        String line1 = "Home: " + reportDetail.getQ1HomeDelivery();
        String line2 = "HC: " + reportDetail.getQ1HcDelivery();
        String line3 = "HP: " + reportDetail.getQ1HpDelivery();
        String line4 = "Referred: " + reportDetail.getQ1ReferredDelivery();
        String line5 = "Unknown: " + reportDetail.getQ1UnknownDelivery();
        String line6 = "First: " + reportDetail.getQ1FirstReminder();
        String line7 = "Second: " + reportDetail.getQ1SecondReminder();
        String line8 = "EDD: " + reportDetail.getQ1Edd();
       
        for (int i = report.getFromQuarter(); i <= report.getToQuarter(); i++) {
            switch(i) {
                case 2: line1 += ", " + reportDetail.getQ2HomeDelivery();
                        line2 += ", " + reportDetail.getQ2HcDelivery();
                        line3 += ", " + reportDetail.getQ2HpDelivery();
                        line4 += ", " + reportDetail.getQ2ReferredDelivery();
                        line5 += ", " + reportDetail.getQ2UnknownDelivery();
                        line6 += ", " + reportDetail.getQ2FirstReminder();
                        line7 += ", " + reportDetail.getQ2SecondReminder();
                        line8 += ", " + reportDetail.getQ2Edd();
                        break;
                case 3: line1 += ", " + reportDetail.getQ3HomeDelivery();
                        line2 += ", " + reportDetail.getQ3HcDelivery();
                        line3 += ", " + reportDetail.getQ3HpDelivery();
                        line4 += ", " + reportDetail.getQ3ReferredDelivery();
                        line5 += ", " + reportDetail.getQ3UnknownDelivery();
                        line6 += ", " + reportDetail.getQ3FirstReminder();
                        line7 += ", " + reportDetail.getQ3SecondReminder();
                        line8 += ", " + reportDetail.getQ3Edd();
                        break;
                case 4: line1 += ", " + reportDetail.getQ4HomeDelivery();
                        line2 += ", " + reportDetail.getQ4HcDelivery();
                        line3 += ", " + reportDetail.getQ4HpDelivery();
                        line4 += ", " + reportDetail.getQ4ReferredDelivery();
                        line5 += ", " + reportDetail.getQ4UnknownDelivery();
                        line6 += ", " + reportDetail.getQ4FirstReminder();
                        line7 += ", " + reportDetail.getQ4SecondReminder();
                        line8 += ", " + reportDetail.getQ4Edd();
                        break;
            }
        }
        line1 += "\n"; line2 += "\n"; line3 += "\n"; line4 += "\n";
        line5 += "\n"; line6 += "\n"; line7 += "\n"; line8 += "\n";
View Full Code Here


    }

    @Override
    public ReportDetail generateReport(Report report) {
        DateTime begin, end;
        ReportDetail reportDetail = new ReportDetail();
        for (int i = report.getFromQuarter(); i <= report.getToQuarter(); i++) {
            int endMonth = i * 3;
            int beginMonth = endMonth - 2;
            int endDate = 31;
            int year = report.getYear();
            if (endMonth == 2 || endMonth == 3) {
                endDate = 30;
            }
            begin = new DateTime(year, beginMonth, 1,0, 0);
            end = new DateTime(year, endMonth, endDate, 0, 0);
            long count = (Long) getSession().createCriteria(Reminder.class)
                    .add(Restrictions.between("reminderSentOn", begin.toDate(), end.toDate()))
                    .add(Restrictions.eq("reminderType", "MONTHLY"))
                    .setProjection(Projections.rowCount()).uniqueResult();
            int c = (int)count;
            switch(i) {
                case 1: reportDetail.setQ1FirstReminder(c);
                        break;
                case 2: reportDetail.setQ2FirstReminder(c);
                        break;
                case 3: reportDetail.setQ3FirstReminder(c);
                        break;
                case 4: reportDetail.setQ4FirstReminder(c);
                        break;
            }

            count = (Long) getSession().createCriteria(Reminder.class)
                    .add(Restrictions.between("reminderSentOn", begin.toDate(), end.toDate()))
                    .add(Restrictions.eq("reminderType", "WEEKLY"))
                    .setProjection(Projections.rowCount()).uniqueResult();
            c = (int)count;
            switch(i) {
                case 1: reportDetail.setQ1SecondReminder(c);
                        break;
                case 2: reportDetail.setQ2SecondReminder(c);
                        break;
                case 3: reportDetail.setQ3SecondReminder(c);
                        break;
                case 4: reportDetail.setQ4SecondReminder(c);
                        break;
            }

            count = (Long) getSession().createCriteria(Mother.class)
                    .add(Restrictions.between("arrivalTime", begin.toDate(), end.toDate()))
                    .add(Restrictions.eq("outcome", "Delivered at Home"))
                    .setProjection(Projections.rowCount()).uniqueResult();
            c = (int)count;
            switch(i) {
                case 1: reportDetail.setQ1HomeDelivery(c);
                        break;
                case 2: reportDetail.setQ2HomeDelivery(c);
                        break;
                case 3: reportDetail.setQ3HomeDelivery(c);
                        break;
                case 4: reportDetail.setQ4HomeDelivery(c);
                        break;
            }

            count = (Long) getSession().createCriteria(Mother.class)
                    .add(Restrictions.between("arrivalTime", begin.toDate(), end.toDate()))
                    .add(Restrictions.eq("outcome", "Delivered at HP"))
                    .setProjection(Projections.rowCount()).uniqueResult();
            c = (int)count;
            switch(i) {
                case 1: reportDetail.setQ1HpDelivery(c);
                        break;
                case 2: reportDetail.setQ2HpDelivery(c);
                        break;
                case 3: reportDetail.setQ3HpDelivery(c);
                        break;
                case 4: reportDetail.setQ4HpDelivery(c);
                        break;
            }

            count = (Long) getSession().createCriteria(Mother.class)
                    .add(Restrictions.between("arrivalTime", begin.toDate(), end.toDate()))
                    .add(Restrictions.eq("outcome", "Delivered at HC"))
                    .setProjection(Projections.rowCount()).uniqueResult();
            c = (int)count;
            switch(i) {
                case 1: reportDetail.setQ1HcDelivery(c);
                        break;
                case 2: reportDetail.setQ2HcDelivery(c);
                        break;
                case 3: reportDetail.setQ3HcDelivery(c);
                        break;
                case 4: reportDetail.setQ4HcDelivery(c);
                        break;
            }

            count = (Long) getSession().createCriteria(Mother.class)
                    .add(Restrictions.between("arrivalTime", begin.toDate(), end.toDate()))
                    .add(Restrictions.eq("outcome", "Referred"))
                    .setProjection(Projections.rowCount()).uniqueResult();
            c = (int)count;
            switch(i) {
                case 1: reportDetail.setQ1ReferredDelivery(c);
                        break;
                case 2: reportDetail.setQ2ReferredDelivery(c);
                        break;
                case 3: reportDetail.setQ3ReferredDelivery(c);
                        break;
                case 4: reportDetail.setQ4ReferredDelivery(c);
                        break;
            }

            count = (Long) getSession().createCriteria(Mother.class)
                    .add(Restrictions.between("arrivalTime", begin.toDate(), end.toDate()))
                    .add(Restrictions.eq("outcome", "Unknown"))
                    .setProjection(Projections.rowCount()).uniqueResult();
            c = (int)count;
            switch(i) {
                case 1: reportDetail.setQ1UnknownDelivery(c);
                        break;
                case 2: reportDetail.setQ2UnknownDelivery(c);
                        break;
                case 3: reportDetail.setQ3UnknownDelivery(c);
                        break;
                case 4: reportDetail.setQ4UnknownDelivery(c);
                        break;
            }

            count = (Long) getSession().createCriteria(Mother.class)
                    .add(Restrictions.between("edd", begin.toDate(), end.toDate()))
                    .setProjection(Projections.rowCount()).uniqueResult();
            c = (int)count;
            switch(i) {
                case 1: reportDetail.setQ1Edd(c);
                    break;
                case 2: reportDetail.setQ2Edd(c);
                    break;
                case 3: reportDetail.setQ3Edd(c);
                    break;
                case 4: reportDetail.setQ4Edd(c);
                    break;
            }
        }
       
        return reportDetail;
View Full Code Here

TOP

Related Classes of org.sis.ancmessaging.server.domain.ReportDetail

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.