<!--#include file="conn.asp"-->
<% 
if session("login")<>"1" then
response.write("<script>alert('未登录或者登陆超时，请重新登陆！');window.location.href='login.asp';</script>")   
response.end() 
end if

if session("PoderArqueroCierre")="0" then
response.write("<script>alert('无权限！\nNo tienes permiso!');window.location.href='index.asp?get=good';</script>")   
response.end() 
end if

 %>
 <table width="100%"  height="80" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td align="center">
	<span class="STYLE2">已结单</span><br />
<span class="STYLE14">TICKETS</span><br />
<span class="STYLE2"><%= request.Form("key") %></span>
</td>
 </tr>
</table>
<form id="form1" name="form1" method="post" action="?get=consulta">
<% 
if request.Form("fecha")="" then
fecha=replace(year(DateAdd("d",-0,date()))&"-"&right("0"&month(DateAdd("d",-0,date())),2)&"-"&right("0"&day(DateAdd("d",-0,date())),2),"/","-")
else
fecha=replace(year(DateAdd("d",-0,request.Form("fecha")))&"-"&right("0"&month(DateAdd("d",-0,request.Form("fecha"))),2)&"-"&right("0"&day(DateAdd("d",-0,request.Form("fecha"))),2),"/","-")
end if
 %>

 <table width="100%" height="30px" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td><label>
    <div align="center">日期FECHA:
      <input name="fecha" type="date" id="fecha" value="<%= fecha %>"  style="width:125px; height:25px;"/>
    </div>
    </label></td>
    <td width="60"><label>
      <div align="left" >
	   <INPUT type=image height="30" width="30" src="img/BUSCA.png" border=0 name="Submit2" onClick="this.form.submit()" autocomplete="off"/> 
      </div> </label></td>
  </tr>
  <tr>
    <td colspan="2">&nbsp; </td>
    </tr>
</table>
</form>
<% 
if request.QueryString("get")="consulta"  and request.QueryString("id")=""  then
 conn.open Str

sql = "select * from ticket where left(Fecha,10)='"& fecha &"'order by DocumentoNo desc" 
set rs = conn.execute(sql)


 %>


 <table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="40%" height="30" style="background-color:<%= bgcolor %>;opacity:<%= opacity %>;"  ><div align="center"><span class="Menu1">单号</span><BR/><span class="Menu2">TIKECT.NO</span></div></td>
    <td width="40%" height="30" style="background-color:<%= bgcolor %>;opacity:<%= opacity %>;"  ><div align="center"><span class="Menu1">时间</span><BR/><span class="Menu2">HORA</span></div></td>
    <td width="20%" height="30" style="background-color:<%= bgcolor %>;opacity:<%= opacity %>;"  ><div align="center"><span class="Menu1">金额</span><BR/><span class="Menu2">IMPORTE</span></div></td>
  </tr>
  
  
  <%
       while not rs.eof
   %>
  
  <tr>
    <td width="40%" height="30"><div align="center"><a href="?get=consulta&id=<%= rs("DocumentoNo") %>&FECHA=<%= rs("TiempoUltimoActualizar") %>&FormaDePago=<%= rs("FormaDePago") %>&CantidadTotal=<%= rs("CantidadTotal") %>&Total=<%= rs("Total") %>&OperadorID=<%= rs("OperadorID") %>&OrdenadorNombre=<%= rs("OrdenadorNombre") %>&Efectivo=<%= rs("Efectivo") %>"><%= rs("DocumentoNo") %></a></div></td>
    <td width="40%" height="30"><div align="center"><%= rs("TiempoUltimoActualizar") %></div></td>
    <td width="20%" height="30"><div align="center"><%= formatnumber(rs("Total"),2,-1) %></div></td>
  </tr>
  <% 
  rs.movenext
  wend
 sql = "select COUNT(DocumentoNo) as ticket,sum(total) as sum from ticket where left(Fecha,10)='"&fecha&"'" 
set rs = conn.execute(sql)

%>
  
  
  <tr height="30">
    <td align="center" style="background-color:<%= bgcolor %>;opacity:<%= opacity %>;" ><div align="center" style="font-weight: bold"><span class="Menu1"><%= "TotalTicket："&rs("ticket") %></span></div></td>
    <td colspan="2" style="background-color:<%= bgcolor %>;opacity:<%= opacity %>;" ><div align="center" style="font-weight: bold"><span class="Menu1"><%= "Total："&rs("sum") %></span></div></td>
   </tr>
</table>
<%

rs.close 
  set rs=nothing 
  end if
  
  %>
	<% 
if request.QueryString("get")="consulta" and request.QueryString("id")<>""  then
 conn.open Str
 sql = "select * from ticketarticulo where DocumentoNo='"&request.QueryString("id")&"'order by OrdenNo Asc" 
set rs = conn.execute(sql)
		 %>	 
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td height="30" style="background-color:<%= bgcolor %>;opacity:<%= opacity %>;"><div align="center"><span class="Menu1">产品</span></div></td>
    <td width="15%" height="30" style="background-color:<%= bgcolor %>;opacity:<%= opacity %>;"><div align="center"><span class="Menu1">数量</span></div></td>
    <td width="15%" height="30" style="background-color:<%= bgcolor %>;opacity:<%= opacity %>;"><div align="center"><span class="Menu1">单价</span></div></td>
    <td width="15%" height="30" style="background-color:<%= bgcolor %>;opacity:<%= opacity %>;"><div align="center"><span class="Menu1">总价</span></div></td>
  </tr>
  
  <%
       while not rs.eof
   %>
  <tr>
    <td height="30"><div align="center"><%= rs("nombrees") %></div></td>
    <td width="15%" height="30"><div align="center"><%= rs("Cantidad") %></div></td>
    <td width="15%" height="30"><div align="center"><%= formatnumber(rs("precio"),2,-1) %></div></td>
    <td width="15%" height="30"><div align="center"><%= formatnumber(formatnumber(rs("Cantidad"),2,-1) * formatnumber(rs("precio"),2,-1),2,-1) %></div></td>
  </tr>
    <% 
  rs.movenext
  wend
  rs.close 
  set rs=nothing 

%>
  
  <tr>
    <td style="background-color:<%= bgcolor %>;opacity:<%= opacity %>;"><div align="center" style="font-weight: bold"><span class="Menu1"> Cant.Total:<%= request.QueryString("CantidadTotal") %></span></div></td>
    <td style="background-color:<%= bgcolor %>;opacity:<%= opacity %>;"></td>
    <td style="background-color:<%= bgcolor %>;opacity:<%= opacity %>;"><div align="center" style="font-weight: bold"><span class="Menu1"> Total:</span></td>
    <td style="background-color:<%= bgcolor %>;opacity:<%= opacity %>;"><div align="center" style="font-weight: bold"><span class="Menu1"> <%=  formatnumber(request.QueryString("Total"),2,-1) %></span></div></td>
  </tr>
  <tr>
    <td style="background-color:<%= bgcolor %>;opacity:<%= opacity %>;"><div align="center" style="font-weight: bold"><span class="Menu1"> <%= request.QueryString("id") %></span></div></td>
    <td style="background-color:<%= bgcolor %>;opacity:<%= opacity %>;"></td>
    <td style="background-color:<%= bgcolor %>;opacity:<%= opacity %>;"><div align="center" style="font-weight: bold"><span class="Menu1"> <%= request.QueryString("FormaDePago")&":" %></span></div></td>
    <td style="background-color:<%= bgcolor %>;opacity:<%= opacity %>;"><div align="center" style="font-weight: bold"><span class="Menu1"> <%=  formatnumber(request.QueryString("Efectivo"),2,-1) %></span></div></td>
  </tr>
  <tr>
    <td style="background-color:<%= bgcolor %>;opacity:<%= opacity %>;"><div align="center"><span class="Menu1"> <%= request.QueryString("FECHA") %></span></div></td>
    <td style="background-color:<%= bgcolor %>;opacity:<%= opacity %>;"></td>
    <td style="background-color:<%= bgcolor %>;opacity:<%= opacity %>;"><div align="center" style="font-weight: bold"><span class="Menu1"> Cambio:</span></div></td>
    <td style="background-color:<%= bgcolor %>;opacity:<%= opacity %>;"><div align="center" style="font-weight: bold"><span class="Menu1"> <%= formatnumber(formatnumber(request.QueryString("Efectivo"),2,-1)-formatnumber(request.QueryString("Total"),2,-1),2,-1) %></span></div></td>
  </tr>
  
</table>
<%
end if
 %>
<!--#include file="fooder.asp"-->