<!--#include file="db.asp"-->
<!DOCTYPE HTML>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<style type="text/css">
<!--
a:link {
	text-decoration: none;
	color: #da3226;
}
a:visited {
	text-decoration: none;
	color: #da3226;
}
a:hover {
	text-decoration: none;
	color: #da3226;
}
a:active {
	text-decoration: none;
	color: #da3226;
}
.STYLE14 {
font-size: 16px;
width:95%;
height:35px;
line-height:35px;
background-color:#e7e7e7;
border-radius:0px 0px 5px 5px;
vertical-align:middle;
color:#000000;
}
.STYLE14-1 {
font-size: 16px;
color:#FFFFFF;
width:95%;
height:35px;
line-height:35px;
background-color:#da3226;
border-radius:0px 0px 5px 5px;
vertical-align:middle;
}
.STYLE15 {
font-size: 14px;}
.STYLEindex {
font-size: 18px;}
.STYLE26 {font-size: 12px; color: #FFFFFF; }
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
body,td,th {
	font-family: Geneva, Arial, Helvetica, sans-serif;
}
.STYLE28 {font-size: 50px; font-weight: bold; color:#da3226;
}
.STYLE29 {
width:100%;
height:auto;
font-size: 50px;
font-weight: bold;
color::#da3226;
}

-->
</style></head>
<body>
 
 <%
 FECHA="Fecha:"&NOW()
 BILLETE="EURO"
 
 
 F0=replace(year(DateAdd("d",-0,date()))&"-"&right("0"&month(DateAdd("d",-0,date())),2)&"-"&right("0"&day(DateAdd("d",-0,date())),2),"/","-")
 F1=replace(year(DateAdd("d",-1,date()))&"-"&right("0"&month(DateAdd("d",-1,date())),2)&"-"&right("0"&day(DateAdd("d",-1,date())),2),"/","-")

conn.open Str

sql= "SELECT * FROM Empleado where Nombre='"&request.QueryString("userName")&"' and Contrasena='"&request.QueryString("password")&"' and ClaseID=1"
set rs = Conn.execute(sql) 
if rs.eof then %>
错误：<br/>
1:用户名或密码错误<br/>
2:用户无权限查
<%  
response.end() 
conn.close
rs.close
end if

IF request.QueryString("windos")="" and request.QueryString("key")="" then
sql = "select *,SUM(TOTAL) AS TOTAL0,COUNT(*) AS TCANT0 from ticket where LEFT(FECHA,10) = '"& f0 &"'  "
set rs = conn.execute(sql) 
TOTAL0=RS("TOTAL0")
TCANT0=RS("TCANT0")
rs.close
set rs=nothing

sql = "select *,SUM(TOTAL) AS TOTAL1,COUNT(*) AS TCANT1 from ticket where LEFT(FECHA,10) = '"& f1 &"'  "
set rs = conn.execute(sql) 
TOTAL1=RS("TOTAL1")
TCANT1=RS("TCANT1")
rs.close
set rs=nothing

%>

 <table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="25%" height="50"><div align="center" class="STYLE15">昨日单数</div></td>
    <td width="25%" height="50"><div align="center" class="STYLE15">昨日营业</div></td>
    <td width="25%" height="50"><div align="center" class="STYLE15">今日单数</div></td>
    <td width="25%" height="50"><div align="center" class="STYLE15">今日营业</div></td>
  </tr>
  <tr>
    <td width="25%" height="35" valign="top"><div align="center" class="STYLE15"><%= TCANT1 %></div></td>
    <td width="25%" height="35" valign="top"><div align="center" class="STYLE15"><%= TOTAL1%></div></td>
    <td width="25%" height="35" valign="top"><div align="center" class="STYLE15"><%= TCANT0 %></div></td>
    <td width="25%" height="35" valign="top"><div align="center" class="STYLE15"><%= TOTAL0%></div></td>
  </tr>
</table>

<% 
end if
IF request.QueryString("windos")="2" and request.QueryString("key")="" then
if request.QueryString("list")="" then
response.Redirect("?list=ri&modelo="&request.QueryString("modelo")&"&userName="&request.QueryString("userName")&"&Password="&request.QueryString("Password")&"&windos="&request.QueryString("windos")&"")
response.End()
end if
 
  %>
 
 <table width="100%" height="35" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <td width="20%" align="center"><a href="?list=ri&modelo=<%= request.QueryString("modelo") %>&userName=<%= request.QueryString("userName") %>&Password=<%= request.QueryString("Password") %>&windos=<%= request.QueryString("windos") %>"><% if request.QueryString("list")="ri" then %><div align="center" class="STYLE14-1"><% else %><div align="center" class="STYLE14"><% end if %>日报</div></a></td>
  <td width="20%" align="center"><a href="?list=zhou&modelo=<%= request.QueryString("modelo") %>&userName=<%= request.QueryString("userName") %>&Password=<%= request.QueryString("Password") %>&windos=<%= request.QueryString("windos") %>"><% if request.QueryString("list")="zhou" then %><div align="center" class="STYLE14-1"><% else %><div align="center" class="STYLE14"><% end if %>周报</div></a></td>
    <td width="20%" align="center"><a href="?list=yue&modelo=<%= request.QueryString("modelo") %>&userName=<%= request.QueryString("userName") %>&Password=<%= request.QueryString("Password") %>&windos=<%= request.QueryString("windos") %>"><% if request.QueryString("list")="yue" then %><div align="center" class="STYLE14-1"><% else %><div align="center" class="STYLE14"><% end if %>月报</div></a></td>
    <td width="20%" align="center"><a href="?list=ji&modelo=<%= request.QueryString("modelo") %>&userName=<%= request.QueryString("userName") %>&Password=<%= request.QueryString("Password") %>&windos=<%= request.QueryString("windos") %>"><% if request.QueryString("list")="ji" then %><div align="center" class="STYLE14-1"><% else %><div align="center" class="STYLE14"><% end if %>季度报</div></a></td>
    <td width="20%" align="center"><a href="?list=ano&modelo=<%= request.QueryString("modelo") %>&userName=<%= request.QueryString("userName") %>&Password=<%= request.QueryString("Password") %>&windos=<%= request.QueryString("windos") %>"><% if request.QueryString("list")="ano" then %><div align="center" class="STYLE14-1"><% else %><div align="center" class="STYLE14"><% end if %>年报</div></a></td>
  </tr>
</table>
 
<% 
'年
if request.QueryString("list")="ano" then
fecha=year(now())&"-01-01"
fecha2=replace(year(DateAdd("d",-0,date()))&"-"&right("0"&month(DateAdd("d",-0,date())),2)&"-"&right("0"&day(DateAdd("d",-0,date())),2),"/","-")
if request.QueryString("lado")="left" then
fecha=year(request.QueryString("fecha"))-1&"-01-01"
fecha2=year(request.QueryString("fecha"))-1&"-12-31"
end if
if request.QueryString("lado")="right" then
fecha=year(request.QueryString("fecha"))+1&"-01-01"
fecha2=year(request.QueryString("fecha"))+1&"-12-31"
end if
if request.QueryString("ver")="si" then
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),"/","-")
fecha2=replace(year(DateAdd("d",-0,request.Form("fecha2")))&"-"&right("0"&month(DateAdd("d",-0,request.Form("fecha2"))),2)&"-"&right("0"&day(DateAdd("d",-0,request.Form("fecha2"))),2),"/","-")
end if
if request.QueryString("stock")="si" or request.QueryString("proveedor")="si"  then
fecha=replace(year(DateAdd("d",-0,request.QueryString("fecha")))&"-"&right("0"&month(DateAdd("d",-0,request.QueryString("fecha"))),2)&"-"&right("0"&day(DateAdd("d",-0,request.QueryString("fecha"))),2),"/","-")
fecha2=replace(year(DateAdd("d",-0,request.QueryString("fecha2")))&"-"&right("0"&month(DateAdd("d",-0,request.QueryString("fecha2"))),2)&"-"&right("0"&day(DateAdd("d",-0,request.QueryString("fecha2"))),2),"/","-")
end if
sqllist = "select *,COUNT(*),Sum(CASE WHEN FormaDePago='Efectivo' THEN TOTAL ELSE '0' END) as EFECTIVO,Sum(CASE WHEN FormaDePago='Tarjeta' THEN TOTAL ELSE '0' END) as Tarjeta,Sum(CASE WHEN FormaDePago='ValeSalida' THEN TOTAL ELSE '0' END) as ValeSalida,Sum(CASE WHEN FormaDePago='Vale' THEN TOTAL ELSE '0' END) as Vale,Sum(CASE WHEN FormaDePago='Multi' THEN TOTAL ELSE '0' END) as Multi,SUM(TOTAL) AS TOTAL,COUNT(*) AS TCANT from ticket where LEFT(FECHA,10) between '"& fecha &"' and '"& fecha2 &"'  group by LEFT(FECHA,7) order by LEFT(FECHA,7) desc"
sqltotal = "select *,Sum(CASE WHEN FormaDePago='Efectivo' THEN TOTAL ELSE '0' END) as EFECTIVO,Sum(CASE WHEN FormaDePago='Tarjeta' THEN TOTAL ELSE '0' END) as Tarjeta,Sum(CASE WHEN FormaDePago='ValeSalida' THEN TOTAL ELSE '0' END) as ValeSalida,Sum(CASE WHEN FormaDePago='Vale' THEN TOTAL ELSE '0' END) as Vale,Sum(CASE WHEN FormaDePago='Multi' THEN TOTAL ELSE '0' END) as Multi,SUM(TOTAL) AS TOTAL,COUNT(*) AS TCANT from ticket where  LEFT(FECHA,10) between '"& fecha &"' and '"& fecha2 &"'"
end if
'------------------------
'季度
if request.QueryString("list")="ji" then
FirstDayInQuarter=DateSerial(Year(now()), Int((Month(now()) - 1) / 3) * 3 + 1, 1)
fecha=year(FirstDayInQuarter)&"-"&Right("0" & month(FirstDayInQuarter),2)&"-"&Right("0" & Day(FirstDayInQuarter),2)
fecha2=replace(year(DateAdd("d",-0,date()))&"-"&right("0"&month(DateAdd("d",-0,date())),2)&"-"&right("0"&day(DateAdd("d",-0,date())),2),"/","-")

if request.QueryString("lado")="left" then
quarterStartMonth = Int((Month(request.QueryString("fecha")) - 1) / 3) * 3 + 1

lastQuarterStartMonth = quarterStartMonth - 3
If lastQuarterStartMonth <= 0 Then
    lastQuarterStartMonth = lastQuarterStartMonth + 12 ' 处理跨年的情况
End If
If lastQuarterStartMonth > Month(request.QueryString("fecha")) Then
    lastQuarterYear = Year(request.QueryString("fecha")) - 1 ' 处理跨年的情况
Else
    lastQuarterYear = Year(request.QueryString("fecha"))
End If
firstDayOfLastQuarter = DateSerial(lastQuarterYear, lastQuarterStartMonth, 1)
fecha=Year(firstDayOfLastQuarter)&"-"&Right("00" & Month(firstDayOfLastQuarter), 2)&"-"&Right("00" & Day(firstDayOfLastQuarter), 2)

quarterStartMonth = Int((Month(request.QueryString("fecha")) - 1) / 3) * 3 + 1
lastQuarterEndMonth = quarterStartMonth - 1
If lastQuarterEndMonth <= 0 Then
    lastQuarterEndMonth = 12 ' 处理跨年的情况
End If
If lastQuarterEndMonth > Month(request.QueryString("fecha")) Then
    lastQuarterYear = Year(request.QueryString("fecha")) - 1 ' 处理跨年的情况
Else
    lastQuarterYear = Year(request.QueryString("fecha"))
End If
firstDayOfNextQuarter = DateSerial(lastQuarterYear, lastQuarterEndMonth + 1, 1)
lastDayOfLastQuarter = DateAdd("d", -1, firstDayOfNextQuarter)
fecha2=Year(lastDayOfLastQuarter)&"-"&Right("00" & Month(lastDayOfLastQuarter), 2)&"-"&Right("00" & Day(lastDayOfLastQuarter), 2)
end if
if request.QueryString("lado")="right" then
quarterStartMonth = Int((Month(request.QueryString("fecha")) - 1) / 3) * 3 + 1
nextQuarterStartMonth = quarterStartMonth + 3
If nextQuarterStartMonth > 12 Then
    nextQuarterStartMonth = nextQuarterStartMonth - 12 ' 处理跨年的情况
End If
If nextQuarterStartMonth <= Month(request.QueryString("fecha")) Then
    nextQuarterYear = Year(request.QueryString("fecha")) + 1 ' 处理跨年的情况
Else
    nextQuarterYear = Year(request.QueryString("fecha"))
End If
firstDayOfNextQuarter = DateSerial(nextQuarterYear, nextQuarterStartMonth, 1)
fecha=Year(firstDayOfNextQuarter)&"-"&Right("00" & Month(firstDayOfNextQuarter), 2)&"-"&Right("00" & Day(firstDayOfNextQuarter), 2)
quarterStartMonth = Int((Month(request.QueryString("fecha")) - 1) / 3) * 3 + 1
nextQuarterEndMonth = quarterStartMonth + 5
If nextQuarterEndMonth > 12 Then
    nextQuarterEndMonth = nextQuarterEndMonth - 12 ' 处理跨年的情况
End If
If nextQuarterEndMonth <= Month(request.QueryString("fecha")) Then
    nextQuarterYear = Year(request.QueryString("fecha")) + 1 ' 处理跨年的情况
Else
    nextQuarterYear = Year(request.QueryString("fecha"))
End If
firstDayOfNextQuarter = DateSerial(nextQuarterYear, nextQuarterEndMonth + 1, 1)
lastDayOfNextQuarter = DateAdd("d", -1, firstDayOfNextQuarter)
fecha2=Year(lastDayOfNextQuarter)&"-"&Right("00" & Month(lastDayOfNextQuarter), 2)&"-"&Right("00" & Day(lastDayOfNextQuarter), 2)
end if
if request.QueryString("ver")="si" then
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),"/","-")
fecha2=replace(year(DateAdd("d",-0,request.Form("fecha2")))&"-"&right("0"&month(DateAdd("d",-0,request.Form("fecha2"))),2)&"-"&right("0"&day(DateAdd("d",-0,request.Form("fecha2"))),2),"/","-")
end if
if request.QueryString("stock")="si" or request.QueryString("proveedor")="si"  then
fecha=replace(year(DateAdd("d",-0,request.QueryString("fecha")))&"-"&right("0"&month(DateAdd("d",-0,request.QueryString("fecha"))),2)&"-"&right("0"&day(DateAdd("d",-0,request.QueryString("fecha"))),2),"/","-")
fecha2=replace(year(DateAdd("d",-0,request.QueryString("fecha2")))&"-"&right("0"&month(DateAdd("d",-0,request.QueryString("fecha2"))),2)&"-"&right("0"&day(DateAdd("d",-0,request.QueryString("fecha2"))),2),"/","-")
end if
sqllist = "select *,Sum(CASE WHEN FormaDePago='Efectivo' THEN TOTAL ELSE '0' END) as EFECTIVO,Sum(CASE WHEN FormaDePago='Tarjeta' THEN TOTAL ELSE '0' END) as Tarjeta,Sum(CASE WHEN FormaDePago='ValeSalida' THEN TOTAL ELSE '0' END) as ValeSalida,Sum(CASE WHEN FormaDePago='Vale' THEN TOTAL ELSE '0' END) as Vale,Sum(CASE WHEN FormaDePago='Multi' THEN TOTAL ELSE '0' END) as Multi,SUM(TOTAL) AS TOTAL,COUNT(*) AS TCANT from ticket where LEFT(FECHA,10) between '"& fecha &"' and '"& fecha2 &"'  group by LEFT(FECHA,7) order by LEFT(FECHA,7) desc"
sqltotal = "select *,Sum(CASE WHEN FormaDePago='Efectivo' THEN TOTAL ELSE '0' END) as EFECTIVO,Sum(CASE WHEN FormaDePago='Tarjeta' THEN TOTAL ELSE '0' END) as Tarjeta,Sum(CASE WHEN FormaDePago='ValeSalida' THEN TOTAL ELSE '0' END) as ValeSalida,Sum(CASE WHEN FormaDePago='Vale' THEN TOTAL ELSE '0' END) as Vale,Sum(CASE WHEN FormaDePago='Multi' THEN TOTAL ELSE '0' END) as Multi,SUM(TOTAL) AS TOTAL,COUNT(*) AS TCANT from ticket where LEFT(FECHA,10) between '"& fecha &"' and '"& fecha2 &"'"
end if
'------------------------
'月
if request.QueryString("list")="yue" then
fecha=year(date())&"-"&Right("0" & month(date()),2)&"-01"
fecha2=replace(year(DateAdd("d",-0,date()))&"-"&right("0"&month(DateAdd("d",-0,date())),2)&"-"&right("0"&day(DateAdd("d",-0,date())),2),"/","-")
if request.QueryString("lado")="left" then
firstDayOfLastMonth = DateAdd("m", -1, DateSerial(Year(request.QueryString("fecha")), Month(request.QueryString("fecha")), 1))
fecha=Year(firstDayOfLastMonth)&"-"&Right("00" & Month(firstDayOfLastMonth), 2)&"-"&Right("00" & Day(firstDayOfLastMonth), 2)
firstDayOfCurrentMonth = DateSerial(Year(request.QueryString("fecha")), Month(request.QueryString("fecha")), 1)
lastDayOfLastMonth = DateAdd("d", -1, firstDayOfCurrentMonth)
fecha2=Year(lastDayOfLastMonth)&"-"&Right("00" & Month(lastDayOfLastMonth), 2)&"-"&Right("00" & Day(lastDayOfLastMonth), 2)
end if
if request.QueryString("lado")="right" then
firstDayOfNextMonth = DateSerial(Year(request.QueryString("fecha")), Month(request.QueryString("fecha")) + 1, 1)
fecha=Year(firstDayOfNextMonth)&"-"&Right("00" & Month(firstDayOfNextMonth), 2)&"-"&Right("00" & Day(firstDayOfNextMonth), 2)
lastDayOfNextMonth = DateAdd("d", -1, DateAdd("m", 2, Year(request.QueryString("fecha")) & "-" & Month(request.QueryString("fecha")) & "-01"))
fecha2=Year(lastDayOfNextMonth)&"-"&Right("00" & Month(lastDayOfNextMonth), 2)&"-"&Right("00" & Day(lastDayOfNextMonth), 2)
end if
if request.QueryString("ver")="si" then
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),"/","-")
fecha2=replace(year(DateAdd("d",-0,request.Form("fecha2")))&"-"&right("0"&month(DateAdd("d",-0,request.Form("fecha2"))),2)&"-"&right("0"&day(DateAdd("d",-0,request.Form("fecha2"))),2),"/","-")
end if
if request.QueryString("stock")="si" or request.QueryString("proveedor")="si"  then
fecha=replace(year(DateAdd("d",-0,request.QueryString("fecha")))&"-"&right("0"&month(DateAdd("d",-0,request.QueryString("fecha"))),2)&"-"&right("0"&day(DateAdd("d",-0,request.QueryString("fecha"))),2),"/","-")
fecha2=replace(year(DateAdd("d",-0,request.QueryString("fecha2")))&"-"&right("0"&month(DateAdd("d",-0,request.QueryString("fecha2"))),2)&"-"&right("0"&day(DateAdd("d",-0,request.QueryString("fecha2"))),2),"/","-")
end if
sqllist = "select *,Sum(CASE WHEN FormaDePago='Efectivo' THEN TOTAL ELSE '0' END) as EFECTIVO,Sum(CASE WHEN FormaDePago='Tarjeta' THEN TOTAL ELSE '0' END) as Tarjeta,Sum(CASE WHEN FormaDePago='ValeSalida' THEN TOTAL ELSE '0' END) as ValeSalida,Sum(CASE WHEN FormaDePago='Vale' THEN TOTAL ELSE '0' END) as Vale,Sum(CASE WHEN FormaDePago='Multi' THEN TOTAL ELSE '0' END) as Multi,SUM(TOTAL) AS TOTAL,COUNT(*) AS TCANT from ticket where LEFT(FECHA,10) between '"& fecha &"' and '"& fecha2 &"'  group by LEFT(FECHA,10) order by LEFT(FECHA,10) desc"
sqltotal = "select *,Sum(CASE WHEN FormaDePago='Efectivo' THEN TOTAL ELSE '0' END) as EFECTIVO,Sum(CASE WHEN FormaDePago='Tarjeta' THEN TOTAL ELSE '0' END) as Tarjeta,Sum(CASE WHEN FormaDePago='ValeSalida' THEN TOTAL ELSE '0' END) as ValeSalida,Sum(CASE WHEN FormaDePago='Vale' THEN TOTAL ELSE '0' END) as Vale,Sum(CASE WHEN FormaDePago='Multi' THEN TOTAL ELSE '0' END) as Multi,SUM(TOTAL) AS TOTAL,COUNT(*) AS TCANT from ticket where LEFT(FECHA,10) between '"& fecha &"' and '"& fecha2 &"'"
end if
'------------------------
'周
if request.QueryString("list")="zhou" then
W=weekday(date)-1
FirstDayInWeek=dateadd("d",now(),(-(w-1)))
fecha=replace(year(DateAdd("d",-0,FirstDayInWeek))&"-"&right("0"&month(DateAdd("d",-0,FirstDayInWeek)),2)&"-"&right("0"&day(DateAdd("d",-0,FirstDayInWeek)),2),"/","-")
fecha2=replace(year(DateAdd("d",-0,date()))&"-"&right("0"&month(DateAdd("d",-0,date())),2)&"-"&right("0"&day(DateAdd("d",-0,date())),2),"/","-")
if request.QueryString("lado")="left" then
fecha=replace(year(DateAdd("d",-7,request.QueryString("fecha")))&"-"&right("0"&month(DateAdd("d",-7,request.QueryString("fecha"))),2)&"-"&right("0"&day(DateAdd("d",-7,request.QueryString("fecha"))),2),"/","-")
fecha2=replace(year(DateAdd("d",-1,request.QueryString("fecha")))&"-"&right("0"&month(DateAdd("d",-1,request.QueryString("fecha"))),2)&"-"&right("0"&day(DateAdd("d",-1,request.QueryString("fecha"))),2),"/","-")
end if
if request.QueryString("lado")="right" then
fecha=replace(year(DateAdd("d",+7,request.QueryString("fecha")))&"-"&right("0"&month(DateAdd("d",+7,request.QueryString("fecha"))),2)&"-"&right("0"&day(DateAdd("d",+7,request.QueryString("fecha"))),2),"/","-")
fecha2=replace(year(DateAdd("d",+13,request.QueryString("fecha")))&"-"&right("0"&month(DateAdd("d",+13,request.QueryString("fecha"))),2)&"-"&right("0"&day(DateAdd("d",+13,request.QueryString("fecha"))),2),"/","-")
end if
if request.QueryString("ver")="si" then
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),"/","-")
fecha2=replace(year(DateAdd("d",-0,request.Form("fecha2")))&"-"&right("0"&month(DateAdd("d",-0,request.Form("fecha2"))),2)&"-"&right("0"&day(DateAdd("d",-0,request.Form("fecha2"))),2),"/","-")
end if
if request.QueryString("stock")="si" or request.QueryString("proveedor")="si"  then
fecha=replace(year(DateAdd("d",-0,request.QueryString("fecha")))&"-"&right("0"&month(DateAdd("d",-0,request.QueryString("fecha"))),2)&"-"&right("0"&day(DateAdd("d",-0,request.QueryString("fecha"))),2),"/","-")
fecha2=replace(year(DateAdd("d",-0,request.QueryString("fecha2")))&"-"&right("0"&month(DateAdd("d",-0,request.QueryString("fecha2"))),2)&"-"&right("0"&day(DateAdd("d",-0,request.QueryString("fecha2"))),2),"/","-")
end if
sqllist = "select *,Sum(CASE WHEN FormaDePago='Efectivo' THEN TOTAL ELSE '0' END) as EFECTIVO,Sum(CASE WHEN FormaDePago='Tarjeta' THEN TOTAL ELSE '0' END) as Tarjeta,Sum(CASE WHEN FormaDePago='ValeSalida' THEN TOTAL ELSE '0' END) as ValeSalida,Sum(CASE WHEN FormaDePago='Vale' THEN TOTAL ELSE '0' END) as Vale,Sum(CASE WHEN FormaDePago='Multi' THEN TOTAL ELSE '0' END) as Multi,SUM(TOTAL) AS TOTAL,COUNT(*) AS TCANT from ticket where LEFT(FECHA,10) between '"& fecha &"' and '"& fecha2 &"'  group by LEFT(FECHA,10) order by LEFT(FECHA,10) desc"
sqltotal = "select *,Sum(CASE WHEN FormaDePago='Efectivo' THEN TOTAL ELSE '0' END) as EFECTIVO,Sum(CASE WHEN FormaDePago='Tarjeta' THEN TOTAL ELSE '0' END) as Tarjeta,Sum(CASE WHEN FormaDePago='ValeSalida' THEN TOTAL ELSE '0' END) as ValeSalida,Sum(CASE WHEN FormaDePago='Vale' THEN TOTAL ELSE '0' END) as Vale,Sum(CASE WHEN FormaDePago='Multi' THEN TOTAL ELSE '0' END) as Multi,SUM(TOTAL) AS TOTAL,COUNT(*) AS TCANT from ticket where LEFT(FECHA,10) between '"& fecha &"' and '"& fecha2 &"'"
end if
'------------------------
'日
if request.QueryString("list")="ri" then
fecha=replace(year(DateAdd("d",-0,date()))&"-"&right("0"&month(DateAdd("d",-0,date())),2)&"-"&right("0"&day(DateAdd("d",-0,date())),2),"/","-")
fecha2=replace(year(DateAdd("d",-0,date()))&"-"&right("0"&month(DateAdd("d",-0,date())),2)&"-"&right("0"&day(DateAdd("d",-0,date())),2),"/","-")
if request.QueryString("lado")="left" then
fecha=replace(year(DateAdd("d",-1,request.QueryString("fecha")))&"-"&right("0"&month(DateAdd("d",-1,request.QueryString("fecha"))),2)&"-"&right("0"&day(DateAdd("d",-1,request.QueryString("fecha"))),2),"/","-")
fecha2=replace(year(DateAdd("d",-1,request.QueryString("fecha2")))&"-"&right("0"&month(DateAdd("d",-1,request.QueryString("fecha2"))),2)&"-"&right("0"&day(DateAdd("d",-1,request.QueryString("fecha2"))),2),"/","-")
end if
if request.QueryString("lado")="right" then
fecha=replace(year(DateAdd("d",+1,request.QueryString("fecha")))&"-"&right("0"&month(DateAdd("d",+1,request.QueryString("fecha"))),2)&"-"&right("0"&day(DateAdd("d",+1,request.QueryString("fecha"))),2),"/","-")
fecha2=replace(year(DateAdd("d",+1,request.QueryString("fecha2")))&"-"&right("0"&month(DateAdd("d",+1,request.QueryString("fecha2"))),2)&"-"&right("0"&day(DateAdd("d",+1,request.QueryString("fecha2"))),2),"/","-")
end if
if request.QueryString("ver")="si" then
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),"/","-")
fecha2=replace(year(DateAdd("d",-0,request.Form("fecha2")))&"-"&right("0"&month(DateAdd("d",-0,request.Form("fecha2"))),2)&"-"&right("0"&day(DateAdd("d",-0,request.Form("fecha2"))),2),"/","-")
end if
if request.QueryString("stock")="si" or request.QueryString("proveedor")="si"  then
fecha=replace(year(DateAdd("d",-0,request.QueryString("fecha")))&"-"&right("0"&month(DateAdd("d",-0,request.QueryString("fecha"))),2)&"-"&right("0"&day(DateAdd("d",-0,request.QueryString("fecha"))),2),"/","-")
fecha2=replace(year(DateAdd("d",-0,request.QueryString("fecha2")))&"-"&right("0"&month(DateAdd("d",-0,request.QueryString("fecha2"))),2)&"-"&right("0"&day(DateAdd("d",-0,request.QueryString("fecha2"))),2),"/","-")
end if
sqllist = "select *,Sum(CASE WHEN FormaDePago='Efectivo' THEN TOTAL ELSE '0' END) as EFECTIVO,Sum(CASE WHEN FormaDePago='Tarjeta' THEN TOTAL ELSE '0' END) as Tarjeta,Sum(CASE WHEN FormaDePago='ValeSalida' THEN TOTAL ELSE '0' END) as ValeSalida,Sum(CASE WHEN FormaDePago='Vale' THEN TOTAL ELSE '0' END) as Vale,Sum(CASE WHEN FormaDePago='Multi' THEN TOTAL ELSE '0' END) as Multi,SUM(TOTAL) AS TOTAL,COUNT(*) AS TCANT from ticket where LEFT(FECHA,10) between '"& fecha &"' and '"& fecha2 &"'  group by LEFT(FECHA,10) order by LEFT(FECHA,10) desc"
sqltotal = "select *,Sum(CASE WHEN FormaDePago='Efectivo' THEN TOTAL ELSE '0' END) as EFECTIVO,Sum(CASE WHEN FormaDePago='Tarjeta' THEN TOTAL ELSE '0' END) as Tarjeta,Sum(CASE WHEN FormaDePago='ValeSalida' THEN TOTAL ELSE '0' END) as ValeSalida,Sum(CASE WHEN FormaDePago='Vale' THEN TOTAL ELSE '0' END) as Vale,Sum(CASE WHEN FormaDePago='Multi' THEN TOTAL ELSE '0' END) as Multi,SUM(TOTAL) AS TOTAL,COUNT(*) AS TCANT from ticket where LEFT(FECHA,10) between '"& fecha &"' and '"& fecha2 &"'"
end if
'------------------------
 %>
 <form id="form0" name="form0" method="post" action="?ver=si&list=<%= request.QueryString("list") %>&modelo=<%= request.QueryString("modelo") %>&userName=<%= request.QueryString("userName") %>&Password=<%= request.QueryString("Password") %>&windos=<%= request.QueryString("windos") %>">
  <table width="100%" border="0" cellpadding="0" cellspacing="0">
    <tr>
      <td height="85" >
        
        <div align="center" >
          <a href="?lado=left&list=<%= request.QueryString("list") %>&modelo=<%= request.QueryString("modelo") %>&userName=<%= request.QueryString("userName") %>&Password=<%= request.QueryString("Password") %>&windos=<%= request.QueryString("windos") %>&fecha=<%= fecha %>&fecha2=<%= fecha2 %>" ><img src="img/left.png" width="25" height="25" border="0" style="vertical-align:middle;"></a>&nbsp;&nbsp;
          <input name="fecha" type="date" id="fecha" value="<%= fecha %>"  style="width:95px; height:30px; font-size:12px;vertical-align:middle;"/>
          -
      <input name="fecha2" type="date" id="fecha2" value="<%= fecha2 %>"  style="width:95px; height:30px;  font-size:12px;vertical-align:middle;"/>&nbsp;&nbsp;<a href="?lado=right&list=<%= request.QueryString("list") %>&modelo=<%= request.QueryString("modelo") %>&userName=<%= request.QueryString("userName") %>&Password=<%= request.QueryString("Password") %>&windos=<%= request.QueryString("windos") %>&fecha=<%= fecha %>&fecha2=<%= fecha2 %>"><img src="img/right.png" width="25" height="25" border="0" style="vertical-align:middle;"></a></div></td>
      <td width="40" height="80">
        <div align="center">
          <INPUT type=image height="30" width="30" src="img/ver.png" border=0 name="Submit0" onClick="this.form.submit()" autocomplete="off"  style="vertical-align:middle;"/>
        </div></td>
      <td width="40"><div align="center"><a href="?stock=si&list=<%= request.QueryString("list") %>&modelo=<%= request.QueryString("modelo") %>&userName=<%= request.QueryString("userName") %>&Password=<%= request.QueryString("Password") %>&windos=<%= request.QueryString("windos") %>&fecha=<%= fecha %>&fecha2=<%= fecha2 %>"><img src="img/stock.png" width="30" height="30" border="0"></a></div></td>
      <td width="40"><div align="center"><a href="?proveedor=si&list=<%= request.QueryString("list") %>&modelo=<%= request.QueryString("modelo") %>&userName=<%= request.QueryString("userName") %>&Password=<%= request.QueryString("Password") %>&windos=<%= request.QueryString("windos") %>&fecha=<%= fecha %>&fecha2=<%= fecha2 %>"><img src="img/proveedor.png" width="30" height="32" border="0"></a></div></td>
    </tr>
  </table>
</form>
     <%  
  set rs = conn.execute(sqltotal)
  if rs("Tcant")="0" then%>
  <div align="center" style=" height:100%;font-size:18px">
  <p>无数据/Sin datos</p>
</div>
  <div style="width:100%; height:30px;vertical-align:middle;color:#CCCCCC; font-size:12px;position: fixed; bottom: 0;" align="center">HIPOS小财迷[HIPOS.ES]</div>
  <%
  response.End()
  end if
 %>  
  <table width="100%" height="305" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
      <td height="120" background="img/bg120.png"></td>
      <td height="120" colspan="2" background="img/bg120.png">
        <div align="left" style="color:#da3226; font-weight:bold; font-size:16px;">总收入<BR/>
      <span class="STYLE28"><%= Formatnumber(rs("Total"),2,-1,-1,-1) %></span></div> </td>
      <td height="120" background="img/bg120.png">&nbsp;</td>
    </tr>
    <tr>
      <td width="2%" background="img/bj35.png">&nbsp;</td>
      <td width="20%" height="35" background="img/bj35.png">
      <div align="left" style="font-weight:bold; font-size:20px; color:#00CC66; " >总单数</div></td>
      <td width="76%" height="35" background="img/bj35.png">
      <div align="right" style="color:#00CC66; font-weight:bold; font-size:20px;"><%= Formatnumber(rs("Tcant"),0,-1,-1,-1)  %></div></td>
      <td width="2%" background="img/bj35.png">&nbsp;</td>
    </tr>
    <tr>
      <td width="2%" background="img/bj35.png" class="STYLE15">&nbsp;</td>
      <td width="20%" height="35" background="img/bj35.png" class="STYLE15">
      <div align="left">现金</div></td>
      <td width="76%" height="35" background="img/bj35.png" class="STYLE15">
      <div align="right"><%= Formatnumber(rs("Efectivo"),2,-1,-1,-1) %></div></td>
      <td width="2%" background="img/bj35.png" class="STYLE15">&nbsp;</td>
    </tr>
    <tr>
      <td width="2%" background="img/bj35.png" class="STYLE15">&nbsp;</td>
      <td width="20%" height="35" background="img/bj35.png" class="STYLE15">
      <div align="left">刷卡</div></td>
      <td width="76%" height="35" background="img/bj35.png" class="STYLE15">
        <div align="right"><%= Formatnumber(rs("Tarjeta"),2,-1,-1,-1) %></div></td>
      <td width="2%" background="img/bj35.png" class="STYLE15">&nbsp;</td>
    </tr>
    <tr>
      <td width="2%" background="img/bj35.png" class="STYLE15">&nbsp;</td>
      <td width="20%" height="35" background="img/bj35.png" class="STYLE15">
      <div align="left">+VALE</div></td>
      <td width="76%" height="35" background="img/bj35.png" class="STYLE15">
        <div align="right"><%= Formatnumber(rs("Vale"),2,-1,-1,-1) %></div></td>
      <td width="2%" background="img/bj35.png" class="STYLE15">&nbsp;</td>
    </tr>
    <tr>
      <td width="2%" background="img/bj35.png" class="STYLE15">&nbsp;</td>
      <td width="20%" height="35" background="img/bj35.png" class="STYLE15">
      <div align="left">-VALE</div></td>
      <td width="76%" height="35" background="img/bj35.png" class="STYLE15">
        <div align="right"><%= Formatnumber(rs("ValeSalida"),2,-1,0,0) %></div></td>
      <td width="2%" background="img/bj35.png" class="STYLE15">&nbsp;</td>
    </tr>
    <tr>
      <td width="2%" background="img/bj35.png" class="STYLE15">&nbsp;</td>
      <td width="20%" height="35" background="img/bj35.png" class="STYLE15">
      <div align="left">MULTI</div></td>
      <td width="76%" height="35" background="img/bj35.png" class="STYLE15">
        <div align="right"><%= Formatnumber(rs("Multi"),2,-1,-1,-1) %></div></td>
      <td width="2%" background="img/bj35.png" class="STYLE15">&nbsp;</td>
    </tr>
  </table>
  <div style="width:100%; height:30px;vertical-align:middle;color:#CCCCCC; font-size:12px;position: fixed; bottom: 0;" align="center">HIPOS小财迷[HIPOS.ES]</div>
  <% rs.close 
  set rs=nothing %>
  <%  if request.QueryString("ver")="si" and request.QueryString("list")<>"ri" then %>
  <table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td height="35" bgcolor="#da3226"><div align="center" class="STYLE26">日期</div></td>
	<td height="35" bgcolor="#da3226"><div align="center" class="STYLE26">单数</div></td>
    <td height="35" bgcolor="#da3226"><div align="center" class="STYLE26">现金</div></td>
    <td height="35" bgcolor="#da3226"><div align="center" class="STYLE26">刷卡</div></td>
    <td height="35" bgcolor="#da3226"><div align="center" class="STYLE26">+VALE</div></td>
    <td height="35" bgcolor="#da3226"><div align="center" class="STYLE26">-VALE</div></td>
    <td height="35" bgcolor="#da3226"><div align="center" class="STYLE26">MULTI</div></td>
    <td height="35" bgcolor="#da3226"><div align="center" class="STYLE26">总额</div></td>
  </tr>
  
  <% 
  set rs = conn.execute(sqllist)
	while not rs.eof
	if weekday(Rs("fecha")-1)="1" then
	wk="一"
	end if
	if weekday(Rs("fecha")-1)="2" then
	wk="二"
	end if
	if weekday(Rs("fecha")-1)="3" then
	wk="三"
	end if
	if weekday(Rs("fecha")-1)="4" then
	wk="四"
	end if
	if weekday(Rs("fecha")-1)="5" then
	wk="五"
	end if
	if weekday(Rs("fecha")-1)="6" then
	wk="六"
	end if
	if weekday(Rs("fecha")-1)="7" then
	wk="日"
	end if	
   %>
    <tr>
    <td height="35" background="img/bj35.png" class="STYLE15"><div align="center" style="font-size:14px;font-weight:bold;">
	<% if request.QueryString("list")="ri" then response.Write(Right("0" & month(Rs("fecha")),2)&"-"&Right("0" & Day(Rs("fecha")),2)) end if %>	
	<% if request.QueryString("list")="ano" then response.Write(month(Rs("fecha"))&"月") end if %>
	<% if request.QueryString("list")="ji" then response.Write(month(Rs("fecha"))&"月") end if %>
	<% if request.QueryString("list")="yue" then response.Write(Right("0" & month(Rs("fecha")),2)&"-"&Right("0" & Day(Rs("fecha")),2)&"/"&wk)  end if %>
	<% if request.QueryString("list")="zhou" then response.Write(Right("0" & month(Rs("fecha")),2)&"-"&Right("0" & Day(Rs("fecha")),2)&"/"&wk) end if %>	
	</div></td>
	<td height="35" background="img/bj35.png" class="STYLE15"><div align="center" style="font-size:14px;"><%= Formatnumber(rs("Tcant"),0,-1,-1,-1)  %></div></td>
    <td height="35" background="img/bj35.png" class="STYLE15"><div align="center"  style="font-size:14px;"><%= Formatnumber(rs("Efectivo"),2,-1,-1,-1) %></div></td>
    <td height="35" background="img/bj35.png" class="STYLE15"><div align="center" style="font-size:14px;"><%= Formatnumber(rs("Tarjeta"),2,-1,-1,-1) %></div></td>
    <td background="img/bj35.png" class="STYLE15"><div align="center" style="font-size:14px;"><%= Formatnumber(rs("Vale"),2,-1,-1,-1) %></div></td>
    <td background="img/bj35.png" class="STYLE15"><div align="center" style="font-size:14px;"><%= Formatnumber(rs("ValeSalida"),2,-1,0,0) %></div></td>
    <td height="35" background="img/bj35.png" class="STYLE15"><div align="center" style="font-size:14px;"><%= Formatnumber(rs("Multi"),2,-1,-1,-1) %></div></td>
    <td height="35" background="img/bj35.png" class="STYLE15"><div align="center" style="font-size:14px;font-weight:bold;"><%= Formatnumber(rs("Total"),2,-1,-1,-1) %></div></td>
  </tr>
  <%
   rs.movenext
  wend
rs.close 
  set rs=nothing
  end if
 %>
</table>
   <%  if request.QueryString("ver")="si" and request.QueryString("list")="ri" then 
   sqlday="select * from ticket where left(fecha,10) between '"& fecha &"' and '"& fecha2 &"' order by ticketno desc"
   
   %>
  <table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td height="35" bgcolor="#da3226"><div align="center" class="STYLE26">单号</div></td>
	<td height="35" bgcolor="#da3226"><div align="center" class="STYLE26">时间</div></td>
    <td height="35" bgcolor="#da3226"><div align="center" class="STYLE26">金额</div></td
  ></tr>
  
  <% 
  set rs = conn.execute(sqlday)
	while not rs.eof	
   %>
    <tr>
    <td height="35" background="img/bj35.png" class="STYLE15"><div align="center" style="font-size:14px;font-weight:bold;"><%= rs("ticketno")  %></td>
	<td height="35" background="img/bj35.png" class="STYLE15"><div align="center" style="font-size:14px;"><%= rs("fecha") %></div></td>
    <td height="35" background="img/bj35.png" class="STYLE15"><div align="center"  style="font-size:14px;"><%= Formatnumber(rs("Total"),2,-1,-1,-1) %></div></td>
  </tr>
  <%
   rs.movenext
  wend
rs.close 
  set rs=nothing
  
 %>
</table>

<% end if
end if %>
<% 
if request.QueryString("stock")="si" then
if request.Form("top")="" then
  top="50"
  else
  top=request.Form("top")
  end if
 %>
 <table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td height="35" colspan="2" bgcolor="#da3226" class="STYLE26"><div align="center">TOP <%= top %> 产品</span></div></td>
    <td width="15%" height="35" bgcolor="#da3226" class="STYLE26"><div align="center">销量</div></td>
    <td width="15%" height="35" bgcolor="#da3226" class="STYLE26"><div align="center">库存</div></td>
  </tr>
  <% 
  
sql = "select *,Sum(ticketarticulo.Cantidad) as sum from ticket,ticketarticulo,stock where left(ticket.FECHA,10) between '"& fecha &"' and '"& fecha2 &"' AND ticket.DocumentoNo=ticketarticulo.DocumentoNo and ticketarticulo.ArticuloID=stock.ArticuloID  GROUP BY ticketarticulo.ArticuloID ORDER BY Sum(ticketarticulo.Cantidad) DESC LIMIT "& top &"" 
set rs = conn.execute(sql)
       while not rs.eof
   %>
   <tr>
    <td height="35" colspan="2" background="img/bj35.png"><div align="center" class="STYLE15"><%= rs("Nombrees") %><br><%= rs("ArticuloID") %><br></div></td>
<td width="15%" height="35" background="img/bj35.png"><div align="center" class="STYLE15"><%= rs("sum") %></div></td>
<td width="15%" height="35" background="img/bj35.png"><div align="center" class="STYLE15"><%= rs("stock") %></div></td>
  </tr>
  <% 
  rs.movenext
  wend
rs.close 
  set rs=nothing 
%>
<tr height="40">
  <td width="30%">  </td>
  </tr>
</table> 
<% end if %>
<% 
if request.QueryString("proveedor")="si" then
  if request.Form("top")="" then
  top="100"
  else
  top=request.Form("top")
  end if
 %>
 <table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td height="35" colspan="2" bgcolor="#da3226" class="STYLE26"><div align="center">TOP <%= top %> 供应商</span></div></td>
    <td width="15%" height="35" bgcolor="#da3226" class="STYLE26"><div align="center">数量</div></td>
	<td width="20%" height="35" bgcolor="#da3226" class="STYLE26"><div align="center">成本</div></td>
    <td width="20%" height="35" bgcolor="#da3226" class="STYLE26"><div align="center">销售额</div></td>
	<td width="15%" height="35" bgcolor="#da3226" class="STYLE26"><div align="center">利润比</div></td>
	<td width="15%" bgcolor="#da3226" class="STYLE26"><div align="center">占比</div></td>
  </tr>
  <% 
 sql = "select SUM(TOTAL) AS TOTAL from ticket where LEFT(FECHA,10) between '"& fecha &"' and '"& fecha2 &"'"
set rs = conn.execute(sql)
Totalventa=RS("Total")
rs.close
set rs=nothing 
  
Sql="SELECT proveedor.*,SUM(ticketarticulo.precio * ticketarticulo.cantidad) AS sum,SUM(articulo.preciocoste * ticketarticulo.cantidad) AS sumcoste,SUM(ticketarticulo.cantidad) AS cantidad FROM ticket JOIN ticketarticulo ON ticket.DocumentoNo = ticketarticulo.DocumentoNo JOIN articulo ON ticketarticulo.ArticuloID = articulo.ArticuloID JOIN proveedor ON articulo.EmpresaID = proveedor.EmpresaID WHERE LEFT(ticket.FECHA, 10) BETWEEN '"& fecha &"' AND '"& fecha2 &"' GROUP BY proveedor.EmpresaID ORDER BY SUM(ticketarticulo.precio*ticketarticulo.cantidad) DESC LIMIT "& top &""
set rs = conn.execute(sql)
       while not rs.eof
   %>
   <tr>
    <td height="35" colspan="2" background="img/bj35.png"><div align="center" class="STYLE15"><%= rs("Nombrees")&rs("Nombrecn") %><br><br></div></td>
<td width="15%" height="35" background="img/bj35.png"><div align="center" class="STYLE15"><%= rs("cantidad") %></div></td>
<td width="20%" height="35" background="img/bj35.png"><div align="center" class="STYLE15"><%= formatnumber(rs("sumcoste"),2,-1,-1,-1) %></div></td>
<td width="20%" height="35" background="img/bj35.png"><div align="center" class="STYLE15"><%= formatnumber(rs("sum"),2,-1,-1,-1) %></div></td>
<td width="15%" height="35" background="img/bj35.png"><div align="center" class="STYLE15"><%= formatnumber((formatnumber(rs("sum"),2,-1,-1,-1)-formatnumber(rs("sumcoste"),2,-1,-1,-1))/formatnumber(rs("sumcoste"),2,-1,-1,-1),2,-1,-1,-1)*100&"&nbsp;%" %></div></td>
  <td width="15%" background="img/bj35.png"><div align="center" class="STYLE15"><%= formatnumber(formatnumber(rs("sum"),2,-1,-1,-1)/formatnumber(Totalventa,2,-1,-1,-1),4,-1,-1,-1)*100&"&nbsp;%" %></div></td>

  </tr>
  <% 
  rs.movenext
  wend
rs.close 
  set rs=nothing 
%>
<tr height="40">
  <td width="30%">  </td>
  </tr>
</table> 
<% end if %>

<%  
if request.QueryString("key")<>"" and request.QueryString("windos")="" then

 sql = "select * from articulo where ArticuloID = '"&left(request.QueryString("key"),15)&"' or Codigobarra ='"&left(request.QueryString("key"),15)&"' or FIND_IN_SET('"& left(request.QueryString("key"),15)&"',replace(multicodigo,' ',','))"
set rs = conn.execute(sql)
 if not(rs.bof and rs.eof) then 
 sql2 = "select * from stock where ArticuloID = '"&rs("ArticuloID")&"'"
 set rs2 = conn.execute(sql2) 
if rs2.bof and rs2.eof then
stock="0"
at="no"
else
stock=rs2("stock")
at="si"
end if
end if
 if rs.eof then
 %>
<div align="center" style=" height:100%;font-size:18px">
  <p><%= left(request.QueryString("key"),15) %><br/>无此产品/No hay Producto</p>
</div>
<% 
else
 %>
 <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" >
<% while not rs.eof%>
    <tr>
    <td height="40" ><div align="center" style="font-size:16px; "><%= left(rs("nombrees"),24) %></div>    </td>
    <td width="50%" height="40" ><div align="center" style="font-size:18px; "><%= formatnumber(rs("preciodetalle"),2,-1,-1,-1) %></div></td>
   </tr>
  <tr>
    <td height="40" ><div align="center" style="font-size:18px; "><%= rs("articuloid") %><BR/><%= rs("CODIGOBARRA") %></div></td>
    <td height="40" ><div align="center" style="font-size:18px; "><%= stock %></div></td>
  </tr>
</table>
<% 
  rs.movenext
  wend
 rs.close
  conn.close
  set rs=nothing 
%>
</table>
<% end if %>
<% end if %>

<%  
if request.QueryString("key")<>"" and request.QueryString("windos")="2" then
'进货量-----------------
sql="select COUNT(*) as totallist,sum(cantidad) as totalentra from albaranproveedorarticulo where ArticuloID = '"&left(request.QueryString("key"),15)&"' or Codigobarra ='"&left(request.QueryString("key"),15)&"'"
set rs = conn.execute(sql)
if rs("totallist")="0" then
totalentra="0"
else
totalentra=rs("totalentra")
end if
rs.close
set rs=nothing 
'销售量
sql="select COUNT(*) as totallist,sum(cantidad) as totalventa from ticketarticulo where ArticuloID = '"&left(request.QueryString("key"),15)&"' or Codigobarra ='"&left(request.QueryString("key"),15)&"'"
set rs = conn.execute(sql)
if rs("totallist")="0" then
totalventa="0"
else
totalventa=rs("totalventa")
end if
rs.close
set rs=nothing
'------------------------
'产品基础信息查询
sql = "select * from articulo where ArticuloID = '"&left(request.QueryString("key"),15)&"' or Codigobarra ='"&left(request.QueryString("key"),15)&"' or FIND_IN_SET('"& left(request.QueryString("key"),15)&"',replace(multicodigo,' ',','))"
set rs = conn.execute(sql)
if rs.eof then
 %>
<div align="center" style=" height:100%;font-size:18px">
  <p><%= left(request.QueryString("key"),15) %><br/>无数据/Sin datos</p>
</div>
<% 
response.End()
else
NombreES=rs("NombreES")
NombreCN=rs("NombreCN")
PrecioDetalle=rs("PrecioDetalle")
ArticuloID=rs("ArticuloID")
Codigobarra=rs("Codigobarra")
rs.close
set rs=nothing
'------------------------
end if
%>
 <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" >
     <tr>
    <td height="120" colspan="4" background="img/bg120.png" ><div align="center" style="font-size:19px; font-weight:bold;"><%= NombreES %><%= NombreCN %><br/>
        <%= ArticuloID %><br/>
        <%= Codigobarra %></div></td>
   </tr>
     <tr>
       <td height="80" colspan="4" >
         <table width="100%" height="120" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
          <td width="50%"><div align="center" style="color:#da3226; font-weight:bold; font-size:16px;">总进货量</div><BR/>
		  <a href="?verentra=si&userName=<%= request.QueryString("userName") %>&Password=<%= request.QueryString("Password") %>&windos=<%= request.QueryString("windos") %>&key=<%= request.QueryString("key") %>"/><div align="center" class="STYLE29"><%= totalentra %></div></a></td>
          <td width="50%"><div align="center" style="color:#da3226; font-weight:bold; font-size:16px;">总销售量</div><BR/>
		  <a href="?verventa=si&userName=<%= request.QueryString("userName") %>&Password=<%= request.QueryString("Password") %>&windos=<%= request.QueryString("windos") %>&key=<%= request.QueryString("key") %>"/><div align="center" class="STYLE29"><%= totalventa %></div></a></td>
        </tr>
      </table>       </td>
     </tr>
<% if request.QueryString("verentra")="si" and totalentra<>"0" then %>
    <tr>
    <td height="35" background="img/bj35.png" ><div align="center" style="font-size:16px; ">进货日期</div></td>
    <td background="img/bj35.png" ><div align="center" style="font-size:16px; ">单号</div></td>
    <td width="80" height="35" background="img/bj35.png" ><div align="center" style="font-size:18px; ">进价</div></td>
    <td width="80" height="35" background="img/bj35.png" ><div align="center" style="font-size:18px; ">数量</div></td>
   </tr>
   <%  
sql="select * from albaranproveedorarticulo left join albaranproveedor on albaranproveedorarticulo.DocumentoNo=albaranproveedor.DocumentoNo where albaranproveedorarticulo.ArticuloID = '"&left(request.QueryString("key"),15)&"' or albaranproveedorarticulo.Codigobarra ='"&left(request.QueryString("key"),15)&"' order by albaranproveedor.fecha desc"
set rs = conn.execute(sql)
while not rs.eof%>
    <tr>
    <td height="35" background="img/bj35.png" ><div align="center" style="font-size:16px; "><%= Year(rs("FECHA"))&"-"&Right("00" & Month(rs("FECHA")), 2)&"-"&Right("00" & Day(rs("FECHA")), 2) %></div></td>
    <td background="img/bj35.png" ><div align="center" style="font-size:16px; "><%= rs("DocumentoNo") %></div></td>
    <td width="80" height="35" background="img/bj35.png" ><div align="center" style="font-size:18px; "><%= formatnumber(rs("precio"),2,-1,-1,-1) %></div></td>
    <td width="80" height="35" background="img/bj35.png" ><div align="center" style="font-size:18px; "><%= rs("cantidad") %></div></td>
   </tr>
<% 
  rs.movenext
  wend
 rs.close
  set rs=nothing 
 end if %> 
 
 
<% if request.QueryString("verventa")="si" and totalventa<>"0" then %>
 <tr>
    <td height="35" background="img/bj35.png" ><div align="center" style="font-size:16px; ">销售日期</div></td>
    <td background="img/bj35.png" ><div align="center" style="font-size:16px; ">单号</div></td>
    <td width="80" height="35" background="img/bj35.png" ><div align="center" style="font-size:18px; ">售价</div></td>
    <td width="80" height="35" background="img/bj35.png" ><div align="center" style="font-size:18px; ">数量</div></td>
   </tr>
   <% 
    sql="select * from ticketarticulo left join ticket on ticketarticulo.DocumentoNo=ticket.DocumentoNo where ticketarticulo.ArticuloID = '"&left(request.QueryString("key"),15)&"' or ticketarticulo.Codigobarra ='"&left(request.QueryString("key"),15)&"'  order by ticket.fecha desc"
set rs = conn.execute(sql)
   while not rs.eof%>
       <tr>
    <td height="35" background="img/bj35.png" ><div align="center" style="font-size:16px; "><%= Year(rs("FECHA"))&"-"&Right("00" & Month(rs("FECHA")), 2)&"-"&Right("00" & Day(rs("FECHA")), 2) %></div></td>
    <td background="img/bj35.png" ><div align="center" style="font-size:16px; "><%= rs("DocumentoNo") %></div></td>
    <td width="80" height="35" background="img/bj35.png" ><div align="center" style="font-size:18px; "><%= formatnumber(rs("precio"),2,-1,-1,-1) %></div></td>
    <td width="80" height="35" background="img/bj35.png" ><div align="center" style="font-size:18px; "><%= rs("cantidad") %></div></td>
   </tr>
 <% 
  rs.movenext
  wend
 rs.close
  conn.close
  set rs=nothing
  end if
%>
</table>
<div style="width:100%; height:30px;vertical-align:middle;color:#CCCCCC; font-size:12px;position: fixed; bottom: 0;" align="center">HIPOS小财迷[HIPOS.ES]</div>
<% end if %>


</body>
</html>