use of org.activityinfo.legacy.shared.reports.model.DateRange in project activityinfo by bedatadriven.
the class DateFilterMenu method addYearRange.
private void addYearRange(int yearsAgo) {
int year = new DateWrapper().getFullYear() - yearsAgo;
DateWrapper from = new DateWrapper(year, 0, 1);
DateWrapper to = new DateWrapper(year, 11, 31);
addFixedRange(Integer.toString(year), new DateRange(from.asDate(), to.asDate()));
}
use of org.activityinfo.legacy.shared.reports.model.DateRange in project activityinfo by bedatadriven.
the class UpdateMonthlyReportsAsync method insertPeriod.
private Promise<Void> insertPeriod(SqlTransaction tx, int siteId, Integer periodId, Month month) {
DateRange range = DateUtilGWTImpl.INSTANCE.monthRange(month);
SqlInsert query = SqlInsert.insertInto(Tables.REPORTING_PERIOD).value("ReportingPeriodId", periodId).value("SiteId", siteId).value("Date1", range.getMinLocalDate()).value("Date2", range.getMaxLocalDate()).value("DateCreated", new Date()).value("DateEdited", new Date());
return executeInsert(tx, query);
}
use of org.activityinfo.legacy.shared.reports.model.DateRange in project activityinfo by bedatadriven.
the class DateUtilGWTImpl method yearRange.
@Override
public DateRange yearRange(int year) {
DateRange range = new DateRange();
DateWrapper date = new DateWrapper(year, 0, 1);
range.setMinDate(date.asDate());
date = new DateWrapper(year, 11, 31);
range.setMaxDate(date.asDate());
return range;
}
use of org.activityinfo.legacy.shared.reports.model.DateRange in project activityinfo by bedatadriven.
the class RenderReportHtmlHandler method execute.
@Override
public CommandResult execute(RenderReportHtml cmd, User user) throws CommandException {
ReportElement model = cmd.getModel();
LOGGER.fine("Model: " + model);
// don't show the title: it will be rendered by the container
model.setTitle(null);
generator.generateElement(user, model, new Filter(), new DateRange());
StringWriter writer = new StringWriter();
try {
renderer.render(model, writer);
} catch (IOException e) {
throw new CommandException(e);
}
return new HtmlResult(writer.toString());
}
use of org.activityinfo.legacy.shared.reports.model.DateRange in project activityinfo by bedatadriven.
the class DateUtilCalendarImpl method yearRange.
@Override
public DateRange yearRange(int year) {
DateRange range = new DateRange();
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.YEAR, year);
calendar.set(Calendar.MONTH, 0);
calendar.set(Calendar.DATE, 1);
range.setMinDate(calendar.getTime());
calendar.set(Calendar.MONTH, Calendar.DECEMBER);
calendar.set(Calendar.DATE, 31);
range.setMaxDate(calendar.getTime());
return range;
}
Aggregations