Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function horario($nome,$dt1,$dt2){
- $indevidosCont = DB::table('tempindevidos')->
- where('email', '=', Auth::user()->email)->
- whereBetween(DB::raw("date_format(STR_TO_DATE(data, '%d/%m/%Y'),'%Y-%m-%d')"),[$dt1,$dt2])
- ->where('acesso','=',$nome)
- ->select('hora','horaTemp')
- -> get();
- $resultado =0;
- foreach($indevidosCont as $e){
- if (preg_match('/^[0-9]{2}:[0-9]{2}$/', $e->hora)) {
- $hora1 = $e->hora;
- $hora2 = $e->horaTemp;
- $intervalo1 = new DateTime("T$hora1");
- $intervalo2 = new DateTime("T$hora2");
- $resultado += round(($intervalo2->getTimestamp() - $intervalo1->getTimestamp())/60);
- }
- }
- return $resultado;
- }
- //--------------------------------
- function appImpressora($data,$hora,$email,$usuario){
- $retorno = DB::table('dados_computador')->
- select('aplicacao')
- ->where('email','=',$email)
- ->where('data','=',$data)
- ->where('usuario','=',$usuario)
- ->where('aplicacao','!=','0')
- ->where(DB::raw('substr(informacoes, 1, 5)'), '=' , $hora)
- ->groupBy('aplicacao')
- ->orderBy('id', 'desc')->first();
- return $retorno;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement