<?php 
session_start();
error_reporting(E_ALL);
@ini_set('display_errors', '1');
if(isset($_SESSION['carro']))
$carro=$_SESSION['carro'];else $carro=false;

$pag="<html>";
$pag.="<head>";
$pag.="<title>FACTURA FINAL</title>";

$pag.="<style type='text/css'>";
$pag.="<!--";
$pag.=".tit {";
$pag.=" font-family: Verdana, Arial, Helvetica, sans-serif;";
$pag.="	font-size: 13px;";
$pag.="	color: #FFFFFF;";
$pag.="}";
$pag.=".prod {";
$pag.="	font-family: Verdana, Arial, Helvetica, sans-serif;";
$pag.="	font-size: 13px;";
$pag.="	color: #333333;";
$pag.="}";
$pag.="h1 {";
$pag.="	font-family: Verdana, Arial, Helvetica, sans-serif;";
$pag.="	font-size: 20px;";
$pag.="	color: #990000;";
$pag.="}";

$pag.="h2 {";
$pag.="	font-family: Arial, Helvetica, sans-serif;";
$pag.="	font-size: 10px;";
$pag.="	font-weight: bold;";
$pag.="}";


$pag.="-->";
$pag.="</style>";
$pag.="</head>";

$pag.="<body>";

$pag.= "<h1 align='center'>Factura de Compra </h1>";
$pag.="<table width='720' border='0' cellspacing='0' cellpadding='0' align='center' >";
$pag.="  <tr bgcolor='#333333' class='tit'>";
$pag.="    <td width='105'>Producto</td>";
$pag.="    <td width='207'>Precio</td>";
$pag.="    <td colspan='4' align='center'> Cantidad de Unidades</td>";
$pag.=" </tr>";
  
  $color=array('#ffffff','#F0F0F0');
  $contador=0;
  $suma=0;
   foreach($carro as $k => $v){
   $subto=$v['cantidad']*$v['precio'];
   $suma=$suma+$subto;
   $contador++;
    
$pag.="    <tr bgcolor='".$color[$contador%2]."' class='prod'>"; 
$pag.="    <td> ".$v['nombre']." </td>";
$pag.="    <td> ".$v['precio']." </td>";
$pag.="    <td width='43' align='center'>".$v['cantidad']."</td>";
$pag.="    <td width='136' align='center'>"; 
       
   }
$pag.="</table>";

$pag.="<div align='center'><span class='prod'>Total de Artículos: ".count($carro)."</span>"; 
$pag.="</div><br>";
$pag.="<div align='center'><span class='prod'>Total: $".number_format($suma,2)."</span>"; 


$pag.="<form action='mostrar.php' method='post'>";
$pag.="Nombre: <input type='text' name='nombre' size='16'/>";

$pag.="<br/>Email: <input type='text' name='email' size='16'/>"; 
$pag.="<br/><input type='hidden' name='pag' value=echo $pag; />";
$pag.="<input type='submit' value='Enviar Pedido'/></form> ";
$pag.="</body></html>";

echo $pag;

#$pag.="<h2 align='center'> Realizo Pedido: ".$_SESSION['usuario'];" </h2>";

#echo $_SESSION['usuario']; 
    
?>




 



 





