25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.

42 satır
1.0KB

  1. <?php
  2. namespace App\Models;
  3. use CodeIgniter\Model;
  4. class HorasModel extends Model
  5. {
  6. protected $table = 'horasprestador';
  7. protected $primaryKey = 'id';
  8. protected $useTimestamps = false;
  9. function getHorasRealizadas($idPrestador = null)
  10. {
  11. return $this
  12. ->selectSum('total_horas_truncadas', 'horas')
  13. ->where('idprestador', $idPrestador)
  14. ->first();
  15. }
  16. function getHoras($idPrestador = null)
  17. {
  18. return $this
  19. ->select(['dia', 'mes', 'ano', 'total_horas_truncadas'])
  20. ->where('idprestador', $idPrestador)
  21. ->where('total_horas_truncadas >', 0)
  22. ->orderBy('ano DESC, mes DESC, dia DESC')
  23. ->findAll();
  24. }
  25. function getSegundosMensuales($idPrestador = null)
  26. {
  27. return $this
  28. ->select(['mes', 'ano'])
  29. ->selectSum('total_horas_truncadas', 'segundos')
  30. ->where('idprestador', $idPrestador)
  31. ->groupby(['mes', 'ano'])
  32. ->findAll();
  33. }
  34. }