You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2 年之前
1234567891011121314151617181920212223242526272829303132333435363738394041
  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. }