Jump to content
Fórum Script Brasil
  • 0

Pausa Para Almoço


feio134
 Share

Question

Boa tarde! Desde já os meus parabéns pela vossa disponibilidade para ajudar.
Cnsegui este código vba aplicado no exemplo calculaHoras_2009 e faz tempo que ando a procura de algo muito parecido,  na realidade este é o que mais se aproxima da solução que procuro, (apenas) precisava que fosse incluída uma pausa para almoço. Tipo entrada 08:00:00, p/Almoço 12:30:00
Inicio Período da Tarde 13:30:00, Fim 18:00:00.
Bom Fim de Semana e Muito Obrigado

Option Compare Database[/background][/size][/font]
[font=Arial, Verdana, Tahoma, sans-serif][size=3][background=rgb(247, 247, 247)]Public Function GetElapsedTime(interval)
' fonte Microsoft
' http://support.microsoft.com/kb/210604/pt-br
Dim totalhours As Long, totalminutes As Long, totalseconds As _
         Long
Dim days As Long, hours As Long, minutes As Long, Seconds As Long[/background][/size][/font]
[font=Arial, Verdana, Tahoma, sans-serif][size=3][background=rgb(247, 247, 247)]days = Int(CSng(interval))
totalhours = Int(CSng(interval * 24))
totalminutes = Int(CSng(interval * 1440))
totalseconds = Int(CSng(interval * 86400))
hours = totalhours Mod 24
minutes = totalminutes Mod 60
Seconds = totalseconds Mod 60[/background][/size][/font]
[font=Arial, Verdana, Tahoma, sans-serif][size=3][background=rgb(247, 247, 247)]GetElapsedTime = days & " Dias " & hours & " Horas " & minutes & _
" Minutos " & Seconds & " Segundos "[/background][/size][/font]
[font=Arial, Verdana, Tahoma, sans-serif][size=3][background=rgb(247, 247, 247)]End Function[/background][/size][/font]
[font=Arial, Verdana, Tahoma, sans-serif][size=3][background=rgb(247, 247, 247)]Public Function HoraDecimal(dHora As Variant)
''Converte data/hora para formato decimal
''Autor: Carlos Moura - [email protected]
Dim lngDia As Long, intervalo As Double
Dim H1  As Long, H2 As Double, dblHora As Double[/background][/size][/font]

[font=Arial, Verdana, Tahoma, sans-serif][size=3][background=rgb(247, 247, 247)]If VarType(dHora) < 7 And VarType(dHora) > 5 Then Exit Function

  intervalo = CDbl(dHora)
  lngDia = Int(intervalo)
  H1 = lngDia * 24
  dblHora = (intervalo - lngDia)
  H2 = dblHora * 24
  HoraDecimal = Format(H1 + H2, "#0.00")
 
End Function

 

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share



  • Forum Statistics

    • Total Topics
      149.6k
    • Total Posts
      646.2k
×
×
  • Create New...