@Test public void shouldGenerateRnRFromByCurrentPeriod() throws Exception { Date generateDate = DateUtil.parseString("30/06/2015", DateUtil.SIMPLE_DATE_FORMAT); RnRForm rnRForm = RnRForm.init(new Program(), generateDate); assertThat(DateUtil.formatDate(rnRForm.getPeriodBegin(), DateUtil.SIMPLE_DATE_FORMAT), is("21/06/2015")); assertThat(DateUtil.formatDate(rnRForm.getPeriodEnd(), DateUtil.SIMPLE_DATE_FORMAT), is("20/07/2015")); generateDate = DateUtil.parseString("05/07/2015", DateUtil.SIMPLE_DATE_FORMAT); rnRForm = RnRForm.init(new Program(), generateDate); assertThat(DateUtil.formatDate(rnRForm.getPeriodBegin(), DateUtil.SIMPLE_DATE_FORMAT), is("21/06/2015")); assertThat(DateUtil.formatDate(rnRForm.getPeriodEnd(), DateUtil.SIMPLE_DATE_FORMAT), is("20/07/2015")); generateDate = DateUtil.parseString("28/12/2015", DateUtil.SIMPLE_DATE_FORMAT); rnRForm = RnRForm.init(new Program(), generateDate); assertThat(DateUtil.formatDate(rnRForm.getPeriodBegin(), DateUtil.SIMPLE_DATE_FORMAT), is("21/12/2015")); assertThat(DateUtil.formatDate(rnRForm.getPeriodEnd(), DateUtil.SIMPLE_DATE_FORMAT), is("20/01/2016")); }
public static RnRForm init(Program program, Date generateDate) { RnRForm rnrForm = new RnRForm(); rnrForm.program = program; Period period = DateUtil.generateRnRFormPeriodBy(generateDate); rnrForm.periodBegin = period.getBegin().toDate(); rnrForm.periodEnd = period.getEnd().toDate(); return rnrForm; }
RnRForm extends BaseModel { public static RnRForm init(Program program, Date generateDate) { RnRForm rnrForm = new RnRForm(); rnrForm.program = program; Period period = DateUtil.generateRnRFormPeriodBy(generateDate); rnrForm.periodBegin = period.getBegin().toDate(); rnrForm.periodEnd = period.getEnd().toDate(); return rnrForm; } }
RnRForm extends BaseModel { public static RnRForm init(Program program, Date generateDate) { RnRForm rnrForm = new RnRForm(); rnrForm.program = program; Period period = DateUtil.generateRnRFormPeriodBy(generateDate); rnrForm.periodBegin = period.getBegin().toDate(); rnrForm.periodEnd = period.getEnd().toDate(); return rnrForm; }  }
RnRForm extends BaseModel { public static RnRForm init(Program program, Date generateDate) { RnRForm rnrForm = new RnRForm(); rnrForm.program = program; Period period = DateUtil.generateRnRFormPeriodBy(generateDate); rnrForm.periodBegin = period.getBegin().toDate(); rnrForm.periodEnd = period.getEnd().toDate(); return rnrForm; }  boolean isDraft(); boolean isMissed(); boolean isSubmitted(); boolean canRemoveAddedProducts(); boolean isAuthorized(); static RnRForm init(Program program, Date generateDate); static RnRForm init(Program program, Period period, boolean isEmergency); static long calculateTotalRegimenAmount(Collection<RegimenItem> list, MMIARegimeList.COUNTTYPE counttype); static long caculateTotalRegimenTypeAmount(Collection<RegimenItemThreeLines> list, MMIARegimeThreeLineList.COUNTTYPE counttype); List<RnrFormItem> getRnrFormItemListWrapper(); List<BaseInfoItem> getBaseInfoItemListWrapper(); List<RegimenItem> getRegimenItemListWrapper(); List<RegimenItemThreeLines> getRegimenThreeLineListWrapper(); List<RnRFormSignature> getSignaturesWrapper(); static void fillFormId(RnRForm rnRForm); List<RnrFormItem> getDeactivatedAndUnsupportedProductItems(final List<String> supportedProductCodes); List<RnrFormItem> getRnrItems(final Product.IsKit isKit); void addSignature(String signature); }
RnRForm extends BaseModel { public static RnRForm init(Program program, Date generateDate) { RnRForm rnrForm = new RnRForm(); rnrForm.program = program; Period period = DateUtil.generateRnRFormPeriodBy(generateDate); rnrForm.periodBegin = period.getBegin().toDate(); rnrForm.periodEnd = period.getEnd().toDate(); return rnrForm; }  boolean isDraft(); boolean isMissed(); boolean isSubmitted(); boolean canRemoveAddedProducts(); boolean isAuthorized(); static RnRForm init(Program program, Date generateDate); static RnRForm init(Program program, Period period, boolean isEmergency); static long calculateTotalRegimenAmount(Collection<RegimenItem> list, MMIARegimeList.COUNTTYPE counttype); static long caculateTotalRegimenTypeAmount(Collection<RegimenItemThreeLines> list, MMIARegimeThreeLineList.COUNTTYPE counttype); List<RnrFormItem> getRnrFormItemListWrapper(); List<BaseInfoItem> getBaseInfoItemListWrapper(); List<RegimenItem> getRegimenItemListWrapper(); List<RegimenItemThreeLines> getRegimenThreeLineListWrapper(); List<RnRFormSignature> getSignaturesWrapper(); static void fillFormId(RnRForm rnRForm); List<RnrFormItem> getDeactivatedAndUnsupportedProductItems(final List<String> supportedProductCodes); List<RnrFormItem> getRnrItems(final Product.IsKit isKit); void addSignature(String signature);  }