Ver Mensaje Individual
  #3 (permalink)  
Antiguo 14/11/2006, 12:44
MaveriK.j
 
Fecha de Ingreso: noviembre-2006
Mensajes: 5
Antigüedad: 18 años, 5 meses
Puntos: 0
bueno nose k poner daniel ( sorry ) haci k voya poner todo el codigo
= a alguien le puede servir ( no entro todo el codigo )...

<%
If isobject(session("sCarrito")) then
Set dbCarrito = session("sCarrito")
Else
Set dbCarrito = Server.CreateObject("Scripting.Dictionary")
End if

txtVolver=Request.QueryString("txtVolver")
dbCodPro=request.QueryString("dbcodigoproducto")
dbcantidad=request.QueryString("dbcantidadele")
If not Request.QueryString("dbCategoria") = Empty then
dbCategoria=Request.QueryString("dbCategoria")
Else
dbCategoria=-1
End If
If Len(dbCodPro)=1 then
If dbCodPro=0 or dbcantidad=0 then
response.redirect("errorcarrovacio.asp")
Else
If dbcarrito.exists(dbcodpro) then
dbcarrito(Int(dbcodpro)) = Int(dbcarrito(Int(dbcodpro) )) + Int(dbcantidad)
Else
dbcarrito.add (Int(dbcodpro)),Int(0)
dbcarrito(Int(dbcodpro)) = Int(dbcarrito(Int(dbcodpro))) + Int(dbcantidad)
End if
End If
Else
dbCodPro=split(dbCodPro,",")
dbcantidad=split(dbcantidad,",")
For i = LBound(dbCodPro) To UBound(dbCodPro)
If not len(Trim(dbcantidad(i))) = 0 then
If dbcarrito.exists(Int(dbCodPro(i))) then
dbcarrito(Int(dbCodPro(i))) = Int(dbcarrito(Int(dbCodPro(i)) )) + Int(dbcantidad(i))
Else
dbcarrito.add (Int(dbCodPro(i))),Int(0)
dbcarrito(Int(dbCodPro(i))) = Int(dbcarrito(Int(dbCodPro(i)))) + Int(dbcantidad(i))
End if
End If
Next
End If
dim dbaux, xsw, totalCat, dbCCAux, dbXCCaux
dim dbsubtotal, dbtotal, dbST, dbSubTotCat
dim v()
N=dbcarrito.count
Redim Preserve v(N+1)
x=1
For Each codigo In dbcarrito
v(x)=codigo
x=x+1
Next
For x=1 to N-1
codPro=v(x)
If codPro<>0 Then
Set rsOrdenar=myBase.execute("Select CategoriaCodigo From Producto Where(Producto.ProductoCodigo=" & codPro & ")")
CC=rsOrdenar("CategoriaCodigo")
End if
For i=x+1 to N
codprod=v(i)
If codprod<>0 then
Set rsOrdenador=myBase.execute("Select CategoriaCodigo From Producto Where(Producto.ProductoCodigo=" & codprod & ")")
CodCat=rsOrdenador("CategoriaCodigo")
If CC>CodCat then
saux=v(i)
v(i)=v(x)
v(x)=saux
End if
End if
Next
Next
xsw=0
For x=1 To N
dbaux=v(x)
If dbaux<>0 Then

If xsw=0 then
dbCCAux=int(rsBuscarProducto("CategoriaCodigo"))
dbXCCaux=int(dbCCAux)
Else
dbCCAux=rsBuscarProducto("CategoriaCodigo")
End if
dbsubtotal= int(rsBuscarProducto("ProductoValor"))*int(dbcarri to(v(x)))
If int(dbXCCAux)=int(dbCCAux) then
dbSubTotCat=dbSubTotCat+dbsubtotal
xsw=1
Else
xsw=2
XAux=dbSubTotCat
dbSubTotCat=dbsubtotal
dbXCCAux=rsBuscarProducto("CategoriaCodigo")
End if
If len(dbsubtotal)>3 then
dbcentena=mid(strreverse(dbsubtotal),1,3)
dbmiles=mid(strreverse(dbsubtotal),4,3)
dbMillones=Mid(strreverse(dbsubtotal),7,3)
If len(dbsubtotal)>=7 then
dbST=strreverse(dbMillones) & "." & strreverse(dbmiles) & "." & strreverse(dbcentena)
Else
dbST=strreverse(dbmiles) & "." & strreverse(dbcentena)
End if
Else
dbST=dbsubtotal
dbcentena=0
dbmiles=0
dbMillones=0
End if
If xsw=2 then
If len(XAux)>3 then
dbcentena=mid(strreverse(XAux),1,3)
dbmiles=mid(strreverse(XAux),4,3)
dbMillones=Mid(strreverse(XAux),7,3)
If len(XAux)>=7 then
totalCat=(strreverse(dbMillones) & "." & strreverse(dbmiles) & "." & strreverse(dbcentena))
Else
totalCat=(strreverse(dbmiles) & "." & strreverse(dbcentena))
End if
Else
totalCat=XAux
End if
%>
<TR>
<TD colspan ="5" class="Fila2F"><div align="right">
<p class="FilaRV">El Total de esta Categoria de Producto es &nbsp;</p>
</div></TD>
<TD class="FilaCV">$<%=totalCat%></TD>
</TR>
<%
End if
%>

<%
If len(rsBuscarProducto("productovalor"))>3 then
dbcentena=mid(strreverse(rsBuscarProducto("product ovalor")),1,3)
dbmiles=mid(strreverse(rsBuscarProducto("productov alor")),4,3)
dbProductoValor=strreverse(dbmiles) & "." & strreverse(dbcentena)
else
dbProductoValor=rsBuscarProducto("productovalor")
end if
%>
<TD class="Fila1">$<%=dbProductoValor%></TD>
<TD class="Fila1"><%=
if dbcarrito = 0 then
response.Write("ahy 1 registro en 0")
else
response.Write("no hay registros en 0")
end if
response.write(Int(dbcarrito(Int(v(x)))))%></TD>
<TD class="Fila1">$&nbsp;<%=dbST%></TD>
<TD class="Fila1F"><a href="actualiza.asp?dbCodigo=<%=dbaux%>">Eliminar</a></TD>
</TR>
<%
dbtotal=dbtotal+dbsubtotal
End if
next
If len(dbSubTotCat)>3 then
dbcentena=mid(strreverse(dbSubTotCat),1,3)
dbmiles=mid(strreverse(dbSubTotCat),4,3)
dbMillones=Mid(strreverse(dbSubTotCat),7,3)
If len(dbSubTotCat)>=7 then
totalCat=(strreverse(dbMillones) & "." & strreverse(dbmiles) & "." & strreverse(dbcentena))
else
totalCat=(strreverse(dbmiles) & "." & strreverse(dbcentena))
end if
else
totalCat=dbSubTotCat
end if
%>
<TR>
<TD colspan ="5" class="Fila2F"><div align="right">
<p class="FilaRV">El Total de esta Categoria de Producto es&nbsp;</p>
</div></TD>
<TD class="FilaCV">$<%=totalCat %></TD>
</TR>
<%
set session("sCarrito") = dbCarrito
%>
<%
If len(dbtotal)>3 then
dbcentena=mid(strreverse(dbtotal),1,3)
dbmiles=mid(strreverse(dbtotal),4,3)
dbMillones=Mid(strreverse(dbtotal),7,3)
if len(dbtotal)>=7 then
dbTotalFinal=strreverse(dbMillones) & "." & strreverse(dbmiles) & "." & strreverse(dbcentena)
else
dbTotalFinal=strreverse(dbmiles) & "." & strreverse(dbcentena)
end if
else
dbTotalFinal=dbtotal
end if
%>

<tr>
<td colspan ="5" height="4%" class="Fila1F">&nbsp;</td>
<td valign="middle" class="Fila1F">&nbsp;</td>
</tr>
<tr>
<td colspan ="5" height="4%" class="FilaRN">El Total de su Cotizacion es de</td>
<td valign="middle" class="FilaCN">$ <%=dbTotalFinal%></td>
</tr>
<tr>
<td colspan ="5" height="4%" class="Fila1F">&nbsp;</td>
<td valign="middle" class="Fila1F">&nbsp;</td>
</tr>
</table>
<BR>
<%
txtFecha=Now()
If Session("Reserva")=0 then
txtFecha=Now()
Set rsVigencia=MyBase.Execute("Select * from Vigencia")
If not rsVigencia.Eof then
txtVigenciaDias=rsVigencia("VigenciaDias")
DReservacion=FormatDateTime(DateAdd("d",txtVigenci aDias, txtFecha),2)
End If
%>
<SCRIPT LANGUAGE="JavaScript">
<!--
alert("Su Reserva tiene vigencia hasta el <%=DReservacion%>.");
//-->
</SCRIPT>
<%
Session("Reserva")=1
End If
Set rsVigencia=MyBase.Execute("Select * from Vigencia")
If not rsVigencia.Eof then
txtVigenciaDias=rsVigencia("VigenciaDias")
DReservacion=FormatDateTime(DateAdd("d",txtVigenci aDias, txtFecha),2)
End If
%>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="15%" class="Error">Su Reserva tiene vigencia hasta el <%=DReservacion%>.</td>
</tr>
</table>
<%
If txtVolver=3 then
%>
<!-- <tr>
<td Colspan="2" class="Fila1F"><A HREF="pedirdatos.asp" target="central">Enviar Cotización</A></td>
</tr>
<tr>
<td colspan="2" class="Fila1F"><a Href="ListarNovedades.asp" target="central">Volver</a></td>
</tr> -->
<tr class="Fila1F">
<td colspan="2">
<Input Type="submit" Name="txtEnviar" Class="Boton" Value="Enviar Cotización" onClick="javascript:window.open('pedirdatos.asp',' central')">&nbsp;
<Input Type="submit" Name="txtVolver" Class="Boton" Value="Volver" onClick="javascript:window.open('ListarNovedades.a sp','central')">
</td>
</tr>

<%
ElseIf txtVolver=1 then
%>
<!-- <tr>
<td Colspan="2" class="Fila1F"><A HREF="pedirdatos.asp" target="central">Enviar Cotización</A></td>
</tr>
<tr>
<td colspan="2" class="Fila1F"><a Href="MostrarProductos.asp?dbCoCat=<%=dbCategoria% >" target='central'>Volver</a></td>
</tr> -->
<tr class="Fila1F">
<td colspan="2">
<Input Type="submit" Name="txtEnviar" Class="Boton" Value="Enviar Cotización" onClick="javascript:window.open('pedirdatos.asp',' central')">&nbsp;
<Input Type="submit" Name="txtVolver" Class="Boton" Value="Volver" onClick="javascript:window.open('MostrarProductos. asp?dbCoCat=<%=dbCategoria%>','central')">
</td>
</tr>
<%
ElseIf txtVolver=2 then
%>
<!-- <tr>
<td colspan="2" class="Fila1F"><A HREF="pedirdatos.asp" target="central">Enviar Cotización</A></td>
</tr>
<tr>
<td colspan="2" class="Fila1F"><a Href="../Oferta/mostrarProductosOferta.asp?dbCoCat=<%=dbCategoria% >" target="central">Volver</a></td>
</tr> -->
<tr class="Fila1F">
<td colspan="2">
<Input Type="submit" Name="txtEnviar" Class="Boton" Value="Enviar Cotización" onClick="javascript:window.open('pedirdatos.asp',' central')">&nbsp;
<Input Type="submit" Name="txtVolver" Class="Boton" Value="Volver" onClick="javascript:window.open('../Oferta/mostrarProductosOferta.asp?dbCoCat=<%=dbCategoria% >','central')">
</td>
</tr>
<%
End If
%>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
<%
MyBase.close
set MyBase=nothing
%>
</BODY>
</HTML>
disculpen la ingnoracia
MaveriK