| @@ 1687-1716 (lines=30) @@ | ||
| 1684 | * |
|
| 1685 | * @return float (days) |
|
| 1686 | */ |
|
| 1687 | public function getPlannedDaysBetween($begin, $end, $id_type = null) |
|
| 1688 | { |
|
| 1689 | if (empty($this->elements)) |
|
| 1690 | { |
|
| 1691 | $this->loadElements(); |
|
| 1692 | } |
|
| 1693 | ||
| 1694 | $total = 0.0; |
|
| 1695 | foreach($this->elements as $elem) |
|
| 1696 | { |
|
| 1697 | /*@var $elem absences_EntryElem */ |
|
| 1698 | $right = $elem->getRight(); |
|
| 1699 | ||
| 1700 | if (isset($id_type) && (int) $id_type !== (int) $right->id_type) { |
|
| 1701 | continue; |
|
| 1702 | } |
|
| 1703 | ||
| 1704 | $quantity = $elem->getPlannedQuantityBetween($begin, $end); |
|
| 1705 | ||
| 1706 | if ('H' === $right->quantity_unit) { |
|
| 1707 | $days = $this->hoursToDays($quantity); |
|
| 1708 | } else { |
|
| 1709 | $days = $quantity; |
|
| 1710 | } |
|
| 1711 | ||
| 1712 | $total += $days; |
|
| 1713 | } |
|
| 1714 | ||
| 1715 | return $total; |
|
| 1716 | } |
|
| 1717 | ||
| 1718 | ||
| 1719 | ||
| @@ 1733-1762 (lines=30) @@ | ||
| 1730 | * |
|
| 1731 | * @return float (hours) |
|
| 1732 | */ |
|
| 1733 | public function getPlannedHoursBetween($begin, $end, $id_type = null) |
|
| 1734 | { |
|
| 1735 | if (empty($this->elements)) |
|
| 1736 | { |
|
| 1737 | $this->loadElements(); |
|
| 1738 | } |
|
| 1739 | ||
| 1740 | $total = 0.0; |
|
| 1741 | foreach($this->elements as $elem) |
|
| 1742 | { |
|
| 1743 | /*@var $elem absences_EntryElem */ |
|
| 1744 | $right = $elem->getRight(); |
|
| 1745 | ||
| 1746 | if (isset($id_type) && (int) $id_type !== (int) $right->id_type) { |
|
| 1747 | continue; |
|
| 1748 | } |
|
| 1749 | ||
| 1750 | $quantity = $elem->getPlannedQuantityBetween($begin, $end); |
|
| 1751 | ||
| 1752 | if ('D' === $right->quantity_unit) { |
|
| 1753 | $hours = $this->daysToHours($quantity); |
|
| 1754 | } else { |
|
| 1755 | $hours = $quantity; |
|
| 1756 | } |
|
| 1757 | ||
| 1758 | $total += $hours; |
|
| 1759 | } |
|
| 1760 | ||
| 1761 | return $total; |
|
| 1762 | } |
|
| 1763 | ||
| 1764 | ||
| 1765 | ||