| 1019 | } |
| 1020 | |
| 1021 | bool BillingPeriod::withinPeriodicRunPeriod() const { |
| 1022 | model::Model model = getImpl<detail::UtilityBill_Impl>()->model(); |
| 1023 | |
| 1024 | bool withinRunPeriod = this->withinRunPeriod(); |
| 1025 | if (withinRunPeriod) { |
| 1026 | return true; |
| 1027 | } |
| 1028 | |
| 1029 | bool overlapsRunPeriod = this->overlapsRunPeriod(); |
| 1030 | if (!overlapsRunPeriod) { |
| 1031 | return false; |
| 1032 | } |
| 1033 | |
| 1034 | boost::optional<RunPeriod> runPeriod = model.runPeriod(); |
| 1035 | if (!runPeriod) { |
| 1036 | return false; |
| 1037 | } |
| 1038 | |
| 1039 | boost::optional<model::YearDescription> yd = model.yearDescription(); |
| 1040 | if (!yd) { |
| 1041 | return false; |
| 1042 | } |
| 1043 | |
| 1044 | boost::optional<int> calendarYear = yd->calendarYear(); |
| 1045 | if (!calendarYear) { |
| 1046 | return false; |
| 1047 | } |
| 1048 | |
| 1049 | Date runPeriodStartDatePeriodic = Date(runPeriod->getBeginMonth(), runPeriod->getBeginDayOfMonth(), *calendarYear + 1); |
| 1050 | Date runPeriodEndDate = Date(runPeriod->getEndMonth(), runPeriod->getEndDayOfMonth(), *calendarYear); |
| 1051 | Time time = runPeriodStartDatePeriodic - runPeriodEndDate; |
| 1052 | |
| 1053 | bool result = (time.days() == 1); |
| 1054 | |
| 1055 | return result; |
| 1056 | } |
| 1057 | |
| 1058 | bool BillingPeriod::overlapsRunPeriod() const { |
| 1059 | model::Model model = getImpl<detail::UtilityBill_Impl>()->model(); |
nothing calls this directly
no test coverage detected