@@ 1348-1377 (lines=30) @@ | ||
1345 | * |
|
1346 | * @return float (days) |
|
1347 | */ |
|
1348 | public function getPlannedDaysBetween($begin, $end, $id_type = null) |
|
1349 | { |
|
1350 | if (empty($this->elements)) |
|
1351 | { |
|
1352 | $this->loadElements(); |
|
1353 | } |
|
1354 | ||
1355 | $total = 0.0; |
|
1356 | foreach($this->elements as $elem) |
|
1357 | { |
|
1358 | /*@var $elem absences_EntryElem */ |
|
1359 | $right = $elem->getRight(); |
|
1360 | ||
1361 | if (isset($id_type) && (int) $id_type !== (int) $right->id_type) { |
|
1362 | continue; |
|
1363 | } |
|
1364 | ||
1365 | $quantity = $elem->getPlannedQuantityBetween($begin, $end); |
|
1366 | ||
1367 | if ('H' === $right->quantity_unit) { |
|
1368 | $days = $this->hoursToDays($quantity); |
|
1369 | } else { |
|
1370 | $days = $quantity; |
|
1371 | } |
|
1372 | ||
1373 | $total += $days; |
|
1374 | } |
|
1375 | ||
1376 | return $total; |
|
1377 | } |
|
1378 | ||
1379 | ||
1380 | ||
@@ 1394-1423 (lines=30) @@ | ||
1391 | * |
|
1392 | * @return float (hours) |
|
1393 | */ |
|
1394 | public function getPlannedHoursBetween($begin, $end, $id_type = null) |
|
1395 | { |
|
1396 | if (empty($this->elements)) |
|
1397 | { |
|
1398 | $this->loadElements(); |
|
1399 | } |
|
1400 | ||
1401 | $total = 0.0; |
|
1402 | foreach($this->elements as $elem) |
|
1403 | { |
|
1404 | /*@var $elem absences_EntryElem */ |
|
1405 | $right = $elem->getRight(); |
|
1406 | ||
1407 | if (isset($id_type) && (int) $id_type !== (int) $right->id_type) { |
|
1408 | continue; |
|
1409 | } |
|
1410 | ||
1411 | $quantity = $elem->getPlannedQuantityBetween($begin, $end); |
|
1412 | ||
1413 | if ('D' === $right->quantity_unit) { |
|
1414 | $hours = $this->daysToHours($quantity); |
|
1415 | } else { |
|
1416 | $hours = $quantity; |
|
1417 | } |
|
1418 | ||
1419 | $total += $hours; |
|
1420 | } |
|
1421 | ||
1422 | return $total; |
|
1423 | } |
|
1424 | ||
1425 | ||
1426 |