<?php
include_once '../header_.php';
include_once '../php/config.php';
$sql_camarero = mysql_query("select * from camareros order by nombre asc") or die(mysql_error());
$sql_mesas = mysql_query("select * from mesas") or die(mysql_error());
$mesa = $_GET["txt-mesa"];
?>
<style>
td{
	font-size:18px;
}

th{
	background:orange;
}
</style>
<br>
<div class="container">
<span class="text-primary h3">Dividir cuenta de mesa #: <?php echo $_GET["txt-mesa"]?>	
<br>
<button class="btn btn-secondary btn-lg" onclick="window.location.href='vender.php?txt-mesa=<?php echo $mesa?>'"> Ir atras</button>
<br>
<br>
<table class="table table-hover table-striped tabla_comanda2" style="width:700px;">
								<tr><th>ITEM</th><th>CANTIDAD</th><th></th><th>TOTAL</th></tr>
								<?php 
								$sql_detalle_pedido = mysql_query("select * from detalle_comanda where mesa='".$_GET['txt-mesa']."' and anulado!=1 order by id_detalle_comanda desc") or die(mysql_error());
								while($r004 = mysql_fetch_array($sql_detalle_pedido)){
								$sub_pedido2+=$r004["total_precio"];
								$sub_costo+=$r004["total_costo"];
								$id = $r004["id_detalle_comanda"];
								$mesa = $r004["mesa"];
								
								?>
								<tr>
									<td><?php echo $r004["descripcion"]?>
									
									</td>
									
									<td><input style="width:100px; heihgt:30px; font-size:35px" class="" type="number" id="<?php echo $id?>" value="<?php echo $r004["cantidad"]?>" readonly>


	
								</td>
								
								
								<td>
									<a style="font-size:30px; font-weight:bolder;"  class="btn btn-default" href='javascript:void()' onClick='abrir(<?php echo $id?>)'> Dividir </a>
									
									</td>
									<td><?php echo $r004["total_precio"]?></td>
								</tr>
								<?php }?>
								
							<tfoot>
							<th><input type="hidden" name="txt_total_comanda2" id="txt_total_comanda2" value="<?php echo $sub_pedido2?>">
							<input type="hidden" name="txt_total_costo" id="txt_total_costo" value="<?php echo $sub_costo?>"></th>
</table>
<script>
function abrir(id){
	var mesa = "<?php echo $_GET['txt-mesa']?>";
	window.open("dividiendo.php?id="+id+"&txt-mesa="+mesa,'_blank', 'toolbar=no,scrollbars=no,resizable=no,top=500,left=500,width=500,height=550');
}
</script>