12/05/2005, 16:01
|
| | Fecha de Ingreso: junio-2004
Mensajes: 158
Antigüedad: 20 años, 6 meses Puntos: 1 | |
codigo:
Código:
<?
include("lib_carrito.php");
if ($_GET['accion']=="enviado"){
if ($_SESSION["ocarrito"]->iscomprado()) {
header ("Location:". $_SESSION["ocarrito"]->read_url());
// borro el carrito
unset($_SESSION["ocarrito"]);
}
}
// guardo la url padre
$_SESSION["ocarrito"]->save_url($PHP_SELF); // aqui deberia guardar la
//pagina desde donde
// vengo lo cula no funciona
// No almacenar en el cache del navegador esta página.
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
// Expira en fecha pasada
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
// Siempre página modificada
header("Cache-Control: no-cache, must-revalidate");
// HTTP/1.1
header("Pragma: no-cache");
// HTTP/1.0
?>
<html>
<head>
<title>show carrito</title>
<?
if ($_GET['accion']=="sumar"){
$_SESSION["ocarrito"]->sumar_uno($_GET["linea"]);
}
elseif ($_GET['accion']=="restar"){
$_SESSION["ocarrito"]->restar_uno($_GET["linea"]);
}
elseif ($_GET['accion']=="eliminar"){
$_SESSION["ocarrito"]->elimina_producto($_GET["linea"]);
}
?>
<script language="javascript">
{
// con este oculto o muestro los <tr> - <td> segun sea una empresa o
// persona fisica
function toggleVis(btn){
btn = document.forms['myform'].elements[btn];
modecon = btn.checked ? 'block' : 'none';
modesin = btn.checked ? 'none' : 'block';
document.getElementById('concofis0').style.display = modecon;
document.getElementById('concofis1').style.display = modecon;
document.getElementById('concofis2').style.display = modecon;
document.getElementById('sincofis1').style.display = modesin;
}
function redondear(num, dec){
num = parseFloat(num);
dec = parseFloat(dec);
dec = (!dec ? 2 : dec);
return Math.round(num * Math.pow(10, dec)) / Math.pow(10, dec);
}
function ajustar(num, dec){
num = parseFloat(num);
dec = parseFloat(dec);
dec = (!dec ? 2 : dec);
return Math.floor(num * Math.pow(10, dec)) / Math.pow(10, dec);
}
}
</script>
</head>
<body bgcolor="#ffffff">
<form name=myform onsubmit=exit=false action="_envio_transaccion.php" method="post">
<table border="0" width="722" cellspacing="0" cellpadding="0">
<tr>
<td height="25" bgcolor="#33CCCC" width="174" >
<FONT style="font-size:12pt" color=#FF0000 face="Arial Black">Carrito de
Compras</FONT></td>
<td height="25" bgcolor="#33CCCC" width="278" >
</td>
<td height="25" bgcolor="#33CCCC" width="248" >
<p align="center"><font face="Tahoma" size="2">
<a href=javascript:history.go(-1)>Volver Atras</a></font></td>
</tr>
<tr>
<td width="722" colspan="3">
<table border="0" width="720" cellspacing="0" cellpadding="6" height="1">
<tr>
<td width="385" valign="top" align="left" height="1">
<table border="0" width="100%" cellspacing="0" cellpadding="0" style="border-collapse: collapse" bordercolor="#111111" height="11">
<?
$_SESSION["ocarrito"]->imprime_carrito(0);
?>
</table>
<table border="0" width="100%" cellspacing="0" cellpadding="3" style="border-collapse: collapse" bordercolor="#111111" height="11">
<!-- aca van los totales con impuestos -->
<tr>
<td width="10%" align="left" style="font-family: verdana, arial, sans-serif; color: #000; font-size: 11; font-weight: normal" height="13">
</td>
<td width="90%" align="left" style="font-family: verdana, arial, sans-serif; color: #000; font-size: 11; font-weight: normal" height="13" id="concofis1" style="display: none">
<script language="JavaScript" type="text/javascript">
{
var subtotal = <? $_SESSION["ocarrito"]->total_carrito(0); ?>;
var cofis=0.00;
var iva =0.00;
var total=0.00;
var csubtotal = "SUBTOTAL.......................................... ";
var ccofis = "COFIS................................................ ";
var civa = "IVA.................................................... ";
var ctotal = "TOTAL................................................ ";
cofis=subtotal*0.03;
cofis=redondear(cofis,1);
iva=((subtotal+cofis)*0.23);
iva=redondear(iva,1);
total=(subtotal+cofis+iva);
total=redondear(total,1);
csubtotal = csubtotal + subtotal.toString() + "<br>";
ccofis = ccofis + cofis.toString() + "<br>";
civa = civa + iva.toString() + "<br>";
ctotal = ctotal + total.toString() + "<br>";
document.write(csubtotal);
document.write(ccofis);
document.write(civa);
document.write(ctotal);
}
//-->
</script>
</td>
</tr>
<tr>
<td width="10%" align="left" style="font-family: verdana, arial, sans-serif; color: #000; font-size: 11; font-weight: normal" height="13">
</td>
<td width="90%" align="left" style="font-family: verdana, arial, sans-serif; color: #000; font-size: 11; font-weight: normal" height="13" id="sincofis1" style="display: none">
<script language="JavaScript" type="text/javascript">
{
var subtotal = <? $_SESSION["ocarrito"]->total_carrito(0); ?>;
var cofis=0.00;
var iva =0.00;
var total=0.00;
var csubtotal = "SUBTOTAL.......................................... ";
var civa = "IVA.................................................... ";
var ctotal = "TOTAL................................................ ";
iva=subtotal*0.23;
iva=redondear(iva,1);
total=subtotal+iva;
total=redondear(total,1);
csubtotal = csubtotal + subtotal.toString() + "<br>";
civa = civa + iva.toString() + "<br>";
ctotal = ctotal + total.toString() + "<br>";
document.write(csubtotal);
document.write(civa);
document.write(ctotal);
}
//-->
</script>
</td>
</tr>
</table>
<table border="0" width="100%" cellspacing="0" cellpadding="3" style="border-collapse: collapse" bordercolor="#111111" height="11" id="formulario" style="display: none">
<!-- aca va el formulario de los datos -->
<tr>
<td width="43%" style="font-family: verdana, arial, sans-serif; color: #000; font-size: 11; font-weight: normal" height="13">
<font color="#003366"><b>
<input type="checkbox" name="siruc" value="OFF" onclick="toggleVis(this.name)">  RUC?</b></font></td>
<td width="55%" style="font-family: verdana, arial, sans-serif; color: #000; font-size: 11; font-weight: normal" height="13" id="concofis0" style="display: none">
<input type="text" name="ruc" size="20">
</td>
</tr>
<tr id="concofis2" style="display: none">
<td width="4%" style="font-family: verdana, arial, sans-serif; color: #000; font-size: 11; font-weight: normal" height="13" align="center">
</td>
<td width="43%" style="font-family: verdana, arial, sans-serif; color: #000; font-size: 11; font-weight: normal" height="13">
<b><font color="#003366">Dirección Empresa?</font></b></td>
<td width="55%" style="font-family: verdana, arial, sans-serif; color: #000; font-size: 11; font-weight: normal" height="13">
<input type="text" name="dirempre" size="20">
</td>
</tr>
<tr>
<td width="4%" style="font-family: verdana, arial, sans-serif; color: #000; font-size: 11; font-weight: normal" height="13" align="center">
</td>
</tr>
<tr>
...
</tr>
<tr>
<td width="4%" style="font-family: verdana, arial, sans-serif; color: #000; font-size: 11; font-weight: normal" height="13" align="center">
</td>
<td width="98%" style="font-family: verdana, arial, sans-serif; color: #000; font-size: 11; font-weight: normal" height="13" colspan="2">
<p><input type="submit" value="Enviar" name="submit" style="float: right"></p>
</td>
</tr>
<tr>
<td width="100%" style="border-top: 1px solid #000000; border-bottom: 1px solid #000000; ; font-family:verdana, arial, sans-serif; color:#000; font-size:11; font-weight:normal" bgcolor="#00FFFF" height="14" colspan="3">
<p align="center">Y envíelo para Confirmar Compra</td>
</tr>
</table>
</td>
<td width="220" valign="top" align="center" height="1">
<table border="0" width="220" cellspacing="0" cellpadding="0" align="left" height="271" id="condiciones" style="display: none">
<tr>
<td width="100%" style="border-top: 1px solid #000000; border-bottom: 1px solid #000000; ; font-family:verdana, arial, sans-serif; color:#000; font-size:11; font-weight:normal" bgcolor="#00FFFF" height="15">
<p align="center"><b>Importante</b></p>
</td>
</tr>
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
<script language="JavaScript" type="text/javascript">
{
var cantidad = <? $_SESSION["ocarrito"]->cantidad_articulos();?>;
if (cantidad > 0)
{
document.getElementById('formulario').style.display = 'block';
document.getElementById('condiciones').style.display = 'block';
document.getElementById('sincofis1').style.display = 'block';
}
else
{
document.getElementById('formulario').style.display = 'none';
document.getElementById('condiciones').style.display = 'none';
document.getElementById('sincofis1').style.display = 'none';
}
}
//-->
</script>
<table border=0 width=726 style="border-top: 1px dotted #000000;" height="24">
<tr>
<td height="16" bgcolor="#33CCCC" width="720">
<p align="center">Los datos precedidos por <b>
<font size="3" color="#FF0000">(*)</font><font style="font-size: 9pt">
</font></b>son <u>obligatorios</u> para realizar la Compra.</td>
</tr>
<tr>
<td width="720" height="1">
</td>
</tr>
</table>
</body>
</html>
|