Escolar Documentos
Profissional Documentos
Cultura Documentos
Jump:
'tudo
__________________________________________________________________________________________________________________________
'testes
Dim DATA01, DATA02, datak, datay As Date
'-----------------------------------------------------------------------------------------------------------------------------
'bloco com apenas teste nas datas de quem não tem o check_fds ou o check vip
'tudo
__________________________________________________________________________________________________________________________
SQL = "select count(oficial_ordem) as soma from tab_oficial WHERE " _
& "oficial_check_normal <= 1 and " _
& " oficial_cont_vip <= 1 and " _
& " oficial_check_fds = 0 and " _
& " oficial_check_p = 0 and " _
& " oficial_check_f = 0 and" _
& " oficial_escala_id <> " & Cod & " and " _
& " oficial_grupo_id = " & grupo1 & " and " _
& " oficial_grupo_id <> 9 and " _
& " oficial_cont_N <= 1 and " _
& " oficial_id not in (select vip from tab_escala where escala_id = " & Cod & ") and " _
& " oficial_id not in (select diario from tab_escala where escala_id = " & Cod & ") and " _
& " oficial_id not in(select vip from tab_escala where mes = '" & cboMes & "' and ano = " & cboAno.Text & ") and " _
& " oficial_id not in(select diario from tab_escala where mes = '" & cboMes & "' and ano = " & cboAno.Text & ") and " _
& " oficial_id not in(select fds_vip from tab_escala where mes = '" & cboMes & "' and ano = " & cboAno.Text & ") and " _
& " oficial_id not in(select fds_24h from tab_escala where mes = '" & cboMes & "' and ano = " & cboAno.Text & ") and " _
& " oficial_id not in(select oficial_id from v_estatistica_oficial where normal > 1 and mes = '" & cboMes.Text & "') and " _
& " oficial_id NOT in(select oficial_id from tab_afastamentos where data_inicial_afast <= '" & DATA01 & "' AND data_FIM_AFAST >= '" & DATA02 & "')
"
Set Rs3 = De.Cn.Execute(SQL)
Cont = 0
Cont = Rs3!soma
Rs3.Close
Set Rs3 = Nothing
'bloco com apenas teste nas datas de quem não tem o check_fds ou o check vip
'agora trata a possibilidade de combinar um vip/24horas com normal em algum momento na escala mensal
'tudo
__________________________________________________________________________________________________________________________
SQL = "select count(oficial_ordem) as soma from tab_oficial WHERE " _
& "oficial_check_normal <= 1 and " _
& " oficial_cont_vip <= 1 and " _
& " oficial_check_p = 0 and " _
& " oficial_check_f = 0 and" _
& " oficial_escala_id <> " & Cod & " and " _
& " oficial_grupo_id = " & grupo1 & " and " _
& " oficial_grupo_id <> 9 and " _
& " oficial_id not in (select vip from tab_escala where escala_id = " & Cod & ") and " _
& " oficial_id not in (select diario from tab_escala where escala_id = " & Cod & ") and " _
& " oficial_id not in (select vip from tab_escala where mes = '" & cboMes & "' and ano = " & cboAno.Text & ") and " _
& " oficial_id not in (select diario from tab_escala where mes = '" & cboMes & "' and ano = " & cboAno.Text & ") and " _
& " oficial_id not in(select fds_vip from tab_escala where mes = '" & cboMes & "' and ano = " & cboAno.Text & ") and " _
& " oficial_id not in(select fds_24h from tab_escala where mes = '" & cboMes & "' and ano = " & cboAno.Text & ") and " _
& " oficial_id not in(select oficial_id from v_estatistica_oficial where normal > 1 and mes = '" & cboMes.Text & "') and " _
& " oficial_id NOT in(select oficial_id from tab_afastamentos where data_inicial_afast <= '" & DATA01 & "' AND data_FIM_AFAST >= '" & DATA02 & "')
"
Set Rs3 = De.Cn.Execute(SQL)
Cont = 0
Cont = Rs3!soma
Rs3.Close
Set Rs3 = Nothing
'bloco com apenas teste nas datas de quem não tem o check_fds ou o check vip
End Sub