<%@ LANGUAGE="VBSCRIPT" EnableSessionState=True TRANSACTION=NOT_SUPPORTED%>

<% Response.AddHeader "Relatorios", "no-cache" %>
<% Response.Expires = -1 %>
<% Response.Buffer = true %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<!--#include file="comunes/accesoData.asp" -->
<link rel="stylesheet" href="clases.css" type="text/css" />

<script language="vbscript" runat = "server">

	sub ObtenerStatement()

	    Dim oStored
		Dim OBJdbConnection
		Dim OBJRecordset
		Dim strCmdText		
		Dim Data_Inicio
		Dim Data_Fim
		
		Data_Inicio = Request.Form("Dia_St_Inic") + "/" + Request.Form("Mes_St_Inic") + "/" + Request.Form("Ano_St_Inic") + " 00:00"
		Data_Fim    = Request.Form("Dia_St_Fim") + "/" + Request.Form("Mes_St_Fim") + "/" + request.Form("Ano_St_Fim") + " 23:59"
						
		Set OBJdbConnection = Server.CreateObject("ADODB.Connection")
		
		On Error Resume Next
		
		OBJdbConnection.Open strCnn
						
	    Set oStored = server.CreateObject("ADODB.Command")
		Set OBJRecordset = Server.CreateObject("ADODB.RecordSet")
		
		oStored.ActiveConnection = strCnn	
	    oStored.CommandText = "SP_Lista_Statement"
		oStored.CommandType = adCmdStoredProc
		
		With oStored
			.Parameters.Append .CreateParameter("Codigo_cliente", adInteger, adParamInput, 5, request.Form("Cliente_St"))
			.Parameters.Append .CreateParameter("Data_Inicio", adVarchar, adParamInput, 16, Data_Inicio)
			.Parameters.Append .CreateParameter("Data_Fim", adVarchar, adParamInput, 16, Data_Fim)
		End With	
		
		Set OBJRecordset = oStored.Execute()
		
		if OBJdbConnection.Errors.Count > 0 then
		   	nErro = OBJdbConnection.Errors(0).NativeError
		else
			If Err.Number <> 0 Then
        		nErro = Err.Number		        
			end if	
		end if		
					
		I = 0			
		while Not OBJRecordset.EOF					
			Tabela_Statement(I,0)  = OBJRecordset("REFERENCE")
			Tabela_Statement(I,1)  = OBJRecordset("BravacarRef")
			Tabela_Statement(I,2)  = OBJRecordset("Dia_Entrega")
			Tabela_Statement(I,3)  = OBJRecordset("Mes_Entrega")
			Tabela_Statement(I,4)  = OBJRecordset("Ano_Entrega")
			Tabela_Statement(I,5)  = OBJRecordset("Driver_Name")
			Tabela_Statement(I,6)  = OBJRecordset("Valor_Total")
			I = I + 1
			OBJRecordset.MoveNext			
		Wend		
								
		OBJdbConnection.close
		OBJRecordset.close
		Set OBJdbConnection = nothing
		Set OBJRecordset = Nothing		
		Set oStored = nothing		
	End sub

	sub Buscar_Guias()

	    Dim oStored
		Dim OBJdbConnection
		Dim OBJRecordset
		Dim strCmdText		
					
		Set OBJdbConnection = Server.CreateObject("ADODB.Connection")
		
		On Error Resume Next
		
		OBJdbConnection.Open strCnn
						
	    Set oStored = server.CreateObject("ADODB.Command")
		Set OBJRecordset = Server.CreateObject("ADODB.RecordSet")
		
		oStored.ActiveConnection = strCnn	
	    oStored.CommandText = "SP_Lista_Guias"
		oStored.CommandType = adCmdStoredProc
		
		Set OBJRecordset = oStored.Execute()
		
		if OBJdbConnection.Errors.Count > 0 then
		   	nErro = OBJdbConnection.Errors(0).NativeError
		else
			If Err.Number <> 0 Then
        		nErro = Err.Number		        
			end if	
		end if
			
		I = 0	
		while Not OBJRecordset.EOF
			Tabela_Guias(I,0)  = OBJRecordset("OriginID")
			Tabela_Guias(I,1)  = OBJRecordset("Origin")
			I = I + 1			
			OBJRecordset.MoveNext			
		Wend
		
		OBJdbConnection.close
		OBJRecordset.close
		Set OBJdbConnection = nothing
		Set OBJRecordset = Nothing		
		Set oStored = nothing		
	End sub

	sub ObtenerComissoes()

	    Dim oStored
		Dim OBJdbConnection
		Dim OBJRecordset
		Dim strCmdText		
		Dim Data_Inicio
		Dim Data_Fim
		
		Data_Inicio = Request.Form("Dia_Orig_Inic") + "/" + Request.Form("Mes_Orig_Inic") + "/" + Request.Form("Ano_Orig_Inic") + " 00:00"
		Data_Fim    = Request.Form("Dia_Orig_Fim") + "/" + Request.Form("Mes_Orig_Fim") + "/" + request.Form("Ano_Orig_Fim") + " 23:59"
		
		Set OBJdbConnection = Server.CreateObject("ADODB.Connection")
		
		On Error Resume Next
		
		OBJdbConnection.Open strCnn
						
	    Set oStored = server.CreateObject("ADODB.Command")
		Set OBJRecordset = Server.CreateObject("ADODB.RecordSet")
		
		oStored.ActiveConnection = strCnn	
	    oStored.CommandText = "SP_Comissoes_Origem"
		oStored.CommandType = adCmdStoredProc
		
		With oStored
			.Parameters.Append .CreateParameter("Codigo_Guia", adVarChar, adParamInput, 10, request.Form("Guias_Orig"))
			.Parameters.Append .CreateParameter("Data_Inicio", adVarChar, adParamInput, 16, Data_Inicio)
			.Parameters.Append .CreateParameter("Data_Fim", adVarChar, adParamInput, 16, Data_Fim)
		End With	
		
		Set OBJRecordset = oStored.Execute()
		
		if OBJdbConnection.Errors.Count > 0 then
		   	nErro = OBJdbConnection.Errors(0).NativeError
		else
			If Err.Number <> 0 Then
        		nErro = Err.Number		        
			end if	
		end if		
		
		I = 0			
		while Not OBJRecordset.EOF					
			Tabela_Origens(I,0)  = OBJRecordset("Origem")
			Tabela_Origens(I,1)  = OBJRecordset("Reserva")
			Tabela_Origens(I,2)  = OBJRecordset("Contrato")
			Tabela_Origens(I,3)  = OBJRecordset("Condutor")
			Tabela_Origens(I,4)  = OBJRecordset("Grupo")
			Tabela_Origens(I,5)  = OBJRecordset("Dia_Entrega")
			Tabela_Origens(I,6)  = OBJRecordset("Mes_Entrega")
			Tabela_Origens(I,7)  = OBJRecordset("Ano_Entrega")
			Tabela_Origens(I,8)  = OBJRecordset("Hotel")
			Tabela_Origens(I,9)  = OBJRecordset("Dia_Recolha")
			Tabela_Origens(I,10)  = OBJRecordset("Mes_Recolha")
			Tabela_Origens(I,11)  = OBJRecordset("Ano_Recolha")
			Tabela_Origens(I,12)  = OBJRecordset("Nro_Dias")
			Tabela_Origens(I,13)  = OBJRecordset("Nro_Dias_Pagar")
			Tabela_Origens(I,14)  = OBJRecordset("Valor")
			Tabela_Origens(I,15)  = OBJRecordset("Valor_Total")
			Tabela_Origens(I,16)  = OBJRecordset("Comissao")
			Tabela_Origens(I,17)  = OBJRecordset("Seguro")
			Tabela_Origens(I,18)  = OBJRecordset("VTSS")
			Tabela_Origens(I,19)  = OBJRecordset("TComissao")
			Tabela_Origens(I,20)  = OBJRecordset("type_document")
			Tabela_Origens(I,21)  = OBJRecordset("Document_Nr")			
			I = I + 1
			OBJRecordset.MoveNext			
		Wend		
					
		OBJdbConnection.close
		OBJRecordset.close
		Set OBJdbConnection = nothing
		Set OBJRecordset = Nothing		
		Set oStored = nothing		
	End sub
		
</script>
		
<%
Dim sAccion

if request("Accion")<>"" then
	sAccion = request("Accion")
else
	sAccion = "DEFAULT"
end if

if sAccion = "SAIR" then	
	Session.Abandon()
	Response.Redirect("Utilizadores_PT.asp")
end if

if session("Nome_Usuario_Internet")="" then
	Response.Redirect("Logout_PT.asp")
end if

if nErro <> 0 and nErro <> 5701 then
	response.Redirect("V_Int_PT.asp")
end if	

if sAccion = "DEFAULT" then	
	call main()
end if

if sAccion = "REPORTES" then	
	
	if request("TipoReporte") = "STATEMENT" then
		Response.Buffer=true
		Response.ContentType = "application/vnd.ms-excel"	
		if request.Form("Cliente_St") = 43 then
			Response.AddHeader "Content-Disposition","disposition-type=attachment;filename=RelatorioStatement43.xls"	
		end if
		if request.Form("Cliente_St") = 44 then
			Response.AddHeader "Content-Disposition","disposition-type=attachment;filename=RelatorioStatement44.xls"	
		end if
		if request.Form("Cliente_St") = 45 then
			Response.AddHeader "Content-Disposition","disposition-type=attachment;filename=RelatorioStatement45.xls"	
		end if				
		Call Reporte_Statement()
	end if
	
	if request("TipoReporte") = "COMISSOES" then
		Response.Buffer=true
		Response.ContentType = "application/vnd.ms-excel"
		Response.AddHeader "Content-Disposition","disposition-type=attachment;filename=RelatorioComissoes.xls"	
		Call Reporte_Comissoes()
	end if	
end if

Sub main()

Dim Datos
Dim SQLQuery
Dim Est_Out
Dim i
Dim sMensaje 
Dim Meses

Meses = Array("Jan","Fev","Mar","Abr","Mai","Jun","Jul","Ago","Set","Out","Nov","Dez")	

nErro = 0
sMensaje = ""
call Buscar_Guias()

%>
<HTML>
<HEAD>
	<META NAME="KEYWORDS" CONTENT="ilha da madeira, rent a car, rent a car na madeira, bravacar, aluguer de viaturas, rent a car in portugal, portugal rent a car">
	<meta http-equiv="Cache-Control" content="no-store,private,must-revalidate">
	<meta http-equiv="Pragma" content="no-cache">
	<meta http-equiv="Expires" content="1">
	
	<TITLE>Bravacar - Relatórios</TITLE>
	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

	<SCRIPT LANGUAGE="JavaScript">
		
		var mensaje='<%=sMensaje%>'
		if (mensaje!='')
			{		 	
			 alert(mensaje)
			}
			
		function Sair()
		{
			var forma = document.Relatorios
			forma.Accion.value = 'SAIR'	
			forma.submit()	 
		}

		function Reportes(Tipo)
		{
			var forma =document.Relatorios
			forma.Accion.value = 'REPORTES'
			forma.TipoReporte.value = Tipo
			forma.submit()
		}
			
	</SCRIPT>
</HEAD>

<BODY>

<form name="Relatorios" method="post" action="Relatorios_PT.asp">
<input type="hidden" name="Accion" value="<%=sAccion%>">
<input type="hidden" name="TipoReporte">

<center>

<div id="Imagem" class="Imagem">
	<img src="Images/Bravacar.bmp">
</div>
  
<table width="740" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
	<tr>
		<td height="25" align="left"><img src="IMAGES/Esquina1.bmp"/></td>	
		<td height="25" align="right"><img src="IMAGES/Esquina2.bmp"/></td>	
	</tr>
	<tr>
		<td height="20" align="left" class="Estilo8" valign="top" style="padding-left:20px"><%=Session("Nome_Usuario_Internet")%></td>	
		<td height="20" align="right" class="Estilo8" style="padding-right:20px; line-height:14px"><a href="javascript:Sair()" style="color:#FF6600; font-size:85%; font-style:normal; font-family:tahoma; text-decoration:underline">Sair</a></td>	
	</tr>  
</table>	

<table width="740" border="0" cellpadding="0" cellspacing="0"  bgcolor="#FFFFFF">
	<tr>
		<td height="40" class="Estilo8" align="center" style="width:730px" valign="middle">Relatórios</td>
	</tr>
</table> 
<table width="740" border="0" cellpadding="0" cellspacing="0"  bgcolor="#FFFFFF">
	<tr>
		<td align="center">		
			<table width="730" cellpadding="0" cellspacing="0" border="0" bgcolor="#EEEEEE">
			  <tr>
			    <td class="Estilo8" height="40" style="padding-left:6px" width="80">Statement</td>
				<td width="195">
					<%I = 1%>
					<select name="Cliente_St" class="Estilo3" style="width:185px">
						<option value="43" selected>Holiday Autos Internacional</option>
						<option value="44">Holiday Autos Alemanha</option>
						<option value="45">Holiday Autos European Services</option>
					</select>
				</td>
				<td class="Estilo2" width="195">Inicio:
					<%I = 1%>
					<select name="Dia_St_Inic" class="Estilo3" style="width:40px">					
						<%While I <=31 
							if I = Day(Date) then %>
								<option value="<%=I%>" selected><%=I%></option>
						<%	else %>		
								<option value="<%=I%>"><%=I%></option>
						<%  end if	
							I = I + 1						
						Wend%>
					</select>			
					<font>/</font>
					<%I = 1%>
					<select name="Mes_St_Inic" class="Estilo3" style="width:50px">					
						<%While I <=12
							sMes = Meses(I-1) 
							if I = Month(Date) then %>
								<option value="<%=I%>" selected><%=sMes%></option>
						<%	else %>
								<option value="<%=I%>"><%=sMes%></option>	
						<%  end if		
							I = I + 1						
						Wend %>	
					</select>		
					<font>/</font>
					<%I = 2004%>
					<%J = year(date) + 1%>
					<select name="Ano_St_Inic" class="Estilo3">
						<%While I <=J 
							if I = year(date) then %>	
								<option value="<%=I%>" selected><%=I%></option>	
						 <% else %>
								<option value="<%=I%>"><%=I%></option>	
						 <% end if	
							I = I + 1						
						Wend%>
					</select>
				</td>
				<td class="Estilo2" width="195">&nbsp;&nbsp;Fim:
					<%I = 1%>
					<select name="Dia_St_Fim" class="Estilo3" style="width:40px">					
						<%While I <=31 
							if I = Day(Date) then %>
								<option value="<%=I%>" selected><%=I%></option>
						<%	else %>		
								<option value="<%=I%>"><%=I%></option>
						<%  end if	
							I = I + 1						
						Wend%>
					</select>			
					<font>/</font>
					<%I = 1%>
					<select name="Mes_St_Fim" class="Estilo3" style="width:50px">					
						<%While I <=12
							sMes = Meses(I-1) 
							if I = Month(Date) then %>
								<option value="<%=I%>" selected><%=sMes%></option>
						<%	else %>
								<option value="<%=I%>"><%=sMes%></option>	
						<%  end if		
							I = I + 1						
						Wend %>	
					</select>		
					<font>/</font>
					<%I = 2004%>
					<%J = year(date) + 1%>
					<select name="Ano_St_Fim" class="Estilo3">
						<%While I <=J 
							if I = year(date) then %>	
								<option value="<%=I%>" selected><%=I%></option>	
						 <% else %>
								<option value="<%=I%>"><%=I%></option>	
						 <% end if	
							I = I + 1						
						Wend%>
					</select>
				</td>				
				<td align="right" style="padding-right:6px" width="40">
					<input name="btBuscar_St" type="button" class="Estilo5" value="Criar" onClick="javascript:Reportes('STATEMENT')">					
				</td>
			  </tr>  	
			  <tr>
			    <td class="Estilo8" height="40" style="padding-left:6px">Comissoes</td>
				<td>
					<%I = 0%>  
					<select name="Guias_Orig" class="Estilo3" style="width:185px">						
						<% While Tabela_Guias(I,0) <> "" 
							if I = 0 then %>
								<option value="<%=Tabela_Guias(I,0)%>" selected><%=cstr(Tabela_Guias(I,0)) + " - " + Tabela_Guias(I,1)%></option>
						<%	else %>		
								<option value="<%=Tabela_Guias(I,0)%>"><%=cstr(Tabela_Guias(I,0)) + " - " + Tabela_Guias(I,1)%></option>
						<%  end if	
							I = I + 1						
						Wend%>
					</select>				
				</td>
				<td class="Estilo2">Inicio:
					<%I = 1%>
					<select name="Dia_Orig_Inic" class="Estilo3" style="width:40px">					
						<%While I <=31 
							if I = Day(Date) then %>
								<option value="<%=I%>" selected><%=I%></option>
						<%	else %>		
								<option value="<%=I%>"><%=I%></option>
						<%  end if	
							I = I + 1						
						Wend%>
					</select>			
					<font>/</font>
					<%I = 1%>
					<select name="Mes_Orig_Inic" class="Estilo3" style="width:50px">					
						<%While I <=12
							sMes = Meses(I-1) 
							if I = Month(Date) then %>
								<option value="<%=I%>" selected><%=sMes%></option>
						<%	else %>
								<option value="<%=I%>"><%=sMes%></option>	
						<%  end if		
							I = I + 1						
						Wend %>	
					</select>		
					<font>/</font>
					<%I = 2004%>
					<%J = year(date) + 1%>
					<select name="Ano_Orig_Inic" class="Estilo3">
						<%While I <=J 
							if I = year(date) then %>	
								<option value="<%=I%>" selected><%=I%></option>	
						 <% else %>
								<option value="<%=I%>"><%=I%></option>	
						 <% end if	
							I = I + 1						
						Wend%>
					</select>
				</td>
				<td class="Estilo2">&nbsp;&nbsp;Fim:
					<%I = 1%>
					<select name="Dia_Orig_Fim" class="Estilo3" style="width:40px">					
						<%While I <=31 
							if I = Day(Date) then %>
								<option value="<%=I%>" selected><%=I%></option>
						<%	else %>		
								<option value="<%=I%>"><%=I%></option>
						<%  end if	
							I = I + 1						
						Wend%>
					</select>			
					<font>/</font>
					<%I = 1%>
					<select name="Mes_Orig_Fim" class="Estilo3" style="width:50px">					
						<%While I <=12
							sMes = Meses(I-1) 
							if I = Month(Date) then %>
								<option value="<%=I%>" selected><%=sMes%></option>
						<%	else %>
								<option value="<%=I%>"><%=sMes%></option>	
						<%  end if		
							I = I + 1						
						Wend %>	
					</select>		
					<font>/</font>
					<%I = 2004%>
					<%J = year(date) + 1%>
					<select name="Ano_Orig_Fim" class="Estilo3">
						<%While I <=J 
							if I = year(date) then %>	
								<option value="<%=I%>" selected><%=I%></option>	
						 <% else %>
								<option value="<%=I%>"><%=I%></option>	
						 <% end if	
							I = I + 1						
						Wend%>
					</select>
				</td>				
				<td align="right" style="padding-right:6px">
					<input name="btBuscar_Orig" type="button" class="Estilo5" value="Criar" onClick="javascript:Reportes('COMISSOES')">					
				</td>
			  </tr>  				  
			</table>  
		</td>	
	</tr>
</table> 

<table width="740" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
	<tr>
		<td height="25" align="left"><img src="IMAGES/Esquina3.bmp"/></td>	
		<td height="25" align="right"><img src="IMAGES/Esquina4.bmp"/></td>	
	</tr>
</table>		

<table>
	<tr>
		<td height="4"></td>
	</tr>
</table>

</center>
</form>
</body>
</html>

<%	
end sub

Sub Reporte_Statement()
    Dim Dia
	Dim Mes
	Dim Titulo
	Dim Dia_Stat_Inic
	Dim Dia_Stat_Fim
	Dim Mes_Stat_Inic
	Dim Mes_Stat_Fim
	Dim Periodo
	Dim Data_Inicio
	Dim Data_Fim
	
	if request.Form("Cliente_St") = 43 then
		Titulo = "LIST OF INVOICES FOR HOLIDAY AUTOS INTERNATIONAL"
	end if	
	if request.Form("Cliente_St") = 44 then
		Titulo = "LIST OF INVOICES FOR HOLIDAY AUTOS ALEMANHA"
	end if	
	if request.Form("Cliente_St") = 45 then
		Titulo = "LIST OF INVOICES FOR HOLIDAY AUTOS EUROPEAN SERVICE GMBH"
	end if		
	Dia = request.Form("Dia_St_Inic")
	if Dia < 10 then
		Dia_Stat_Inic = "0" + cstr(Dia)
	else
		Dia_Stat_Inic = cstr(Dia)
	end if
	Dia = request.Form("Dia_St_Fim")
	if Dia < 10 then
		Dia_Stat_Fim = "0" + cstr(Dia)
	else
		Dia_Stat_Fim = cstr(Dia)
	end if		
	Mes = request.Form("Mes_St_Inic")
	if Mes < 10 then
		Mes_Stat_Inic = "0" + cstr(Mes)
	else
		Mes_Stat_Inic = cstr(Mes)
	end if
	Mes = request.Form("Mes_St_Fim")
	if Mes < 10 then
		Mes_Stat_Fim = "0" + cstr(Mes)
	else
		Mes_Stat_Fim = cstr(Mes)
	end if	
	
	Data_Inicio = Dia_Stat_Inic + "/" + Mes_Stat_Inic + "/" + cstr(request.Form("Ano_St_Inic"))
	Data_Fim    = Dia_Stat_Fim + "/" + Mes_Stat_Fim + "/" + cstr(request.Form("Ano_St_Fim"))
	Periodo = "PERIOD: FROM " + Data_Inicio + " UNTIL " + Data_Fim
	ObtenerStatement()
	
%>	
	<html>
		<body>
			<table width="500" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
				<tr>
					<td height="40" class="Estilo8" align="center"><%=Titulo%></td>					
				</tr>
				<tr>
					<td height="40" class="Estilo8" align="center"><%=Periodo%></td>					
				</tr>				
				<tr>
					<td>					
						<table width="500" border="1" cellpadding="0" cellspacing="0">
							<tr>
								<td height="22" width="50"  class="Estilo5" align="center">H.AUTOS REFERENCE</td>
								<td height="22" width="50"  class="Estilo5" style="padding-left:3px">BRAVACAR REFERENCE</td>
								<td height="22" width="110" class="Estilo5" style="padding-left:3px">PICK UP DATE</td>
								<td height="22" width="220"  class="Estilo5" align="center">CLIENT'S NAME</td>
								<td height="22" width="70"  class="Estilo5" style="padding-left:3px">AMOUNT</td>
							</tr>
							<%
							  I = 0
							  while Tabela_Statement(I,1) <> ""
							  	Data = cstr(Tabela_Statement(I,2)) + "." + cstr(Tabela_Statement(I,3)) + "." + cstr(Tabela_Statement(I,4))
								  %>
									<tr>
										<td height="22" class="Estilo5" align="center">&nbsp;<%=Tabela_Statement(I,0)%></td>
										<td height="22" class="Estilo5" style="padding-left:3px">&nbsp;<%=Tabela_Statement(I,1)%></td>
										<td height="22" class="Estilo3" style="padding-left:3px"><%=Data%></td>
										<td height="22" class="Estilo3" style="padding-left:3px"><%=Tabela_Statement(I,5)%></td>
										<td height="22" class="Estilo3" style="padding-left:3px"><%=Tabela_Statement(I,6)%></td>
									</tr>
								  <%
								  I = I + 1
							  Wend					  
							%>
						</table> 	
					</td>
				</tr>
			</table> 					
		</body>
	</html>

<%			
end sub

Sub Reporte_Comissoes()
	ObtenerComissoes()
	
%>	
	<html>
		<body>
			<table width="1000" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">			
				<tr>
					<td>					
						<table width="1000" border="1" cellpadding="0" cellspacing="0">
							<tr>
								<td height="22" width="50"  class="Estilo24">Origem</td>
								<td height="22" width="50"  class="Estilo24">Reserva</td>
								<td height="22" width="110" class="Estilo24">Contrato</td>
								<td height="22" width="220" class="Estilo24">Condutor</td>
								<td height="22" width="70"  class="Estilo24">Grupo</td>
								<td height="22" width="70"  class="Estilo24">Data_Entrega</td>
								<td height="22" width="70"  class="Estilo24">Hotel</td>
								<td height="22" width="70"  class="Estilo24">Recolha</td>
								<td height="22" width="70"  class="Estilo24">NDia</td>
								<td height="22" width="70"  class="Estilo24">Dias Pay</td>
								<td height="22" width="70"  class="Estilo24">Valor</td>
								<td height="22" width="70"  class="Estilo24">V.Total</td>
								<td height="22" width="70"  class="Estilo24">Comissao</td>
								<td height="22" width="70"  class="Estilo24">Seguro</td>
								<td height="22" width="70"  class="Estilo24">VTSS</td>
								<td height="22" width="70"  class="Estilo24">T.Comissao</td>
								<td height="22" width="70"  class="Estilo24">Tipo</td>
								<td height="22" width="70"  class="Estilo24">VD</td>
							</tr>
							<%
							  I = 0
							  while Tabela_Origens(I,0) <> ""
							  	DEnt = cstr(Tabela_Origens(I,5)) + "." + cstr(Tabela_Origens(I,6)) + "." + cstr(Tabela_Origens(I,7))
								DRec = cstr(Tabela_Origens(I,9)) + "." + cstr(Tabela_Origens(I,10)) + "." + cstr(Tabela_Origens(I,11))
								  %>
									<tr>
										<td height="22" class="Estilo24"><%=Tabela_Origens(I,0)%></td>
										<td height="22" class="Estilo24"><%=Tabela_Origens(I,1)%></td>
										<td height="22" class="Estilo24"><%=Tabela_Origens(I,2)%></td>
										<td height="22" class="Estilo24"><%=Tabela_Origens(I,3)%></td>
										<td height="22" class="Estilo24"><%=Tabela_Origens(I,4)%></td>
										<td height="22" class="Estilo24"><%=DEnt%></td>
										<td height="22" class="Estilo24"><%=Tabela_Origens(I,8)%></td>
										<td height="22" class="Estilo24"><%=DRec%></td>
										<td height="22" class="Estilo24"><%=Tabela_Origens(I,12)%></td>
										<td height="22" class="Estilo24"><%=Tabela_Origens(I,13)%></td>
										<td height="22" class="Estilo24"><%=Tabela_Origens(I,14)%></td>
										<td height="22" class="Estilo24"><%=Tabela_Origens(I,15)%></td>
										<td height="22" class="Estilo24"><%=Tabela_Origens(I,16)%></td>
										<td height="22" class="Estilo24"><%=Tabela_Origens(I,17)%></td>
										<td height="22" class="Estilo24"><%=Tabela_Origens(I,18)%></td>
										<td height="22" class="Estilo24"><%=Tabela_Origens(I,19)%></td>
										<td height="22" class="Estilo24"><%=Tabela_Origens(I,20)%></td>
										<td height="22" class="Estilo24"><%=Tabela_Origens(I,21)%></td>
									</tr>
								  <%
								  I = I + 1
							  Wend					  
							%>
						</table> 	
					</td>
				</tr>
			</table> 					
		</body>
	</html>

<%			
end sub
%>	