<?php include "php/cabecera.inc";
	echo "<div><BR>";
	
	$conexion = mysqli_connect($serv,$dbu,$dbp,$db);
	mysqli_set_charset($conexion, "utf8");
	$suma=0;
	$STY = "STYLE='color:".$st['C-T-TEXT']."; background-color: ".$st['C-T-CELL'].";' ";
	echo "<INPUT TYPE='HIDDEN' ID='IDSX' VALUE='".$_GET['IDS']."'>";
	echo "<CENTER><DIV STYLE='WIDTH:100%;'><TABLE ID='CHECKOUT' STYLE='WIDTH:100%;COLOR:BLACK;background-color:".$st['C-T-BACK'].";'><THEAD><TR><TD  ".$STY.">Nombre</TD><TD  ".$STY.">Piezas</TD><TD  ".$STY.">Precio unitario</TD><TD ".$STY.">Subtotal</TD></TR></THEAD><TBODY>";
	for($i = 0;$i< $_SESSION['contador'];$i++){
		$peticion = "SELECT * FROM tabla_altaproducto WHERE SKU='".$_SESSION['producto'][$i]."'";
		$resultado = mysqli_query($conexion, $peticion);
		while($fila = mysqli_fetch_array($resultado)){
			$total = $fila['COSTOECOM']*$_SESSION['numb'][$i];
			echo "<tr ".$STY."><td> ".$fila['DESCRIPCION']."</td><td>".$_SESSION['numb'][$i]."</td><td>$ ".$fila['COSTOECOM']."</td><td>$ ".$total;
			echo "<INPUT TYPE='HIDDEN' ID='NOMBP-".$fila['SKU']."' VALUE='".$fila['DESCRIPCION']."'><INPUT TYPE='HIDDEN' ID='PROD-".$fila['SKU']."' VALUE='".$i."'><button class='less' id='less' name='".$fila['SKU']."' style='float:right;'>-</button></td></tr>";
			$suma += $total;
		}
	}
	echo "<tr ".$STY." id='PRECTOTAL' colspan='3'></tr></TBODY></TABLE></DIV></CENTER><BR><BR><CENTER>";
	if($_SESSION['contador']!=0){
	//formulario
	echo "<form action='check.php' METHOD='POST'>
	<input type='hidden' name='IDS' value='$_GET[IDS]'/>
	<H3 $STY>Datos de envío</H3>
	<br><br>
	<TABLE STYLE='BORDER:none;'><tr>
	<td><input type='text' name='col' required='required' placeholder='Colonia'></td>
	<td><input type='text' name='cal' required='required' placeholder='Calle'></td>
	<td><input type='text' name='nex' placeholder='N. Exterior'></td>
	</tr>
	<tr>
	<td><input type='text' name='cp'  placeholder='Código Postal'></td>
	<td><input type='text' name='ref' required='required' placeholder='Entre calles u otra referencia'></td>
	<td><input type='text' name='mun' required='required' placeholder='Municipio'></td>
	</tr>
	<tr>
	<td><input type='text' name='est' required='required' placeholder='Estado'></td>
	<td><input type='text' name='nom' required='required' placeholder='Nombre del comprador'></td>
	<td><input type='text' name='tel' required='required' placeholder='Telefono'></td>
	</tr>
	<tr>
	<td><input type='text' name='ema' required='required' placeholder='e-mail'></td>
	<td><SELECT name='pais'><OPTION>México</OPTION><OPTION>América</OPTION><OPTION>Otro</OPTION></SELECT></td>
	</tr>
	</table>
	<br><br>
	<INPUT TYPE='SUBMIT' VALUE='Confirmar' class='btn'/>
	</form>";
	echo "<br><br><a href='php/destruir.php?IDS=".$_GET['IDS']."'><button class='btn'> Borrar todo </button></a>";}
	echo "<br><br><a href='index.php?IDS=".$_GET['IDS']."'><button class='btn'> Regresar </button></a></CENTER>";
	
	mysqli_close($conexion);
include "php/pie.inc" ?>