<!doctype html>
<html lang="es">
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
		<meta name="description" content="Ventas.">
		<meta name="author" content="Edu FX">

		<title><?php echo !empty($title) ? $title : 'Ventas DeMente Games: ';?></title>

		<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
		<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.2/css/solid.css" integrity="sha384-ioUrHig76ITq4aEJ67dHzTvqjsAP/7IzgwE7lgJcg2r7BRNGYSK0LwSmROzYtgzs" crossorigin="anonymous">
		<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.2/css/fontawesome.css" integrity="sha384-sri+NftO+0hcisDKgr287Y/1LVnInHJ1l+XC7+FOabmTTIK0HnE2ID+xxvJ21c5J" crossorigin="anonymous">

		<link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>css/jquery-ui.css">
		<link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>css/style.css">
		<link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>css/print.css"/>

		<script src="https://code.jquery.com/jquery-3.0.0.min.js"></script>

	</head>
	<body style="font-family: Verdana; margin: 0 80px; font-size: 16px;">
		<div class="container detalle-venta">
			<div class="row mt-5 mb-2">
				<div class="col text-center">
					<img class="img-logo logo-l" src="/img/logo-labels.png">
				</div>
			</div>

			<div class="row mb-5">
				<div class="col text-center" style="font-size: 16px;">
					<strong>COMERCIALIZADORA E3VC SPA</strong>
				</div>
			</div>

			<div class="row mb-2">
				<div class="col-2">RUT:</div>
				<div class="col-10">76.950.763-9</div>
			</div>

			<div class="row mb-2">
				<div class="col-2">Giro:</div>
				<div class="col-10">Venta al por menor de juegos y juguetes en comercios especializados</div>
			</div>

			<div class="row mb-2">
				<div class="col-2">Casa Matriz:</div>
				<div class="col-10">Avenida Italia 1601</div>
			</div>

			<div class="row mb-2">
				<div class="col-2">Comuna:</div>
				<div class="col-10">Ñuñoa</div>
			</div>

			<div class="row mb-2">
				<div class="col-2">Ciudad:</div>
				<div class="col-10">Santiago</div>
			</div>

			<div class="row mb-2">
				<div class="col-2">Fecha:</div>
				<div class="col-10"><?php echo fechaHora($fecha_venta); ?></div>
			</div>

			<?php
				if ($id_canal == 7) {
				/*
					?>
					<div class="row mb-2">
						<div class="col-2">Sucursal: </div>
						<div class="col-10">Avenida Italia 1601, Ñuñoa</div>
					</div>
				<?php
				*/
				}
				if ($id_canal == 8) {
					?>
					<div class="row mb-2">
						<div class="col-2">Sucursal: </div>
						<div class="col-10">Mall Plaza Los Dominicos, Avenida Padre Hurtado Sur 875, Barrio Indie Local 9, Las Condes</div>
					</div>
				<?php
				}
				if ($id_canal == 12) {
					?>
					<div class="row mb-2">
						<div class="col-2">Sucursal: </div>
						<div class="col-10">Drugstore, Avenida Providencia 2124, Local 5, Providencia</div>
					</div>
				<?php
				}
			?>

			<?php
				if (!empty($productos_ventas)) {
					?>
					<table class="table mt-5">
						<thead>
							<tr>
								<th class="text-center px-2 border-top-0">Cantidad</th>
								<th class="px-2 border-top-0">Producto</th>
								<th class="text-center px-2 border-top-0">Valor Unitario</th>
								<th class="text-center px-2 border-top-0">Desc. Unitario</th>
								<th class="text-center px-2 border-top-0">Total</th>
							</tr>
						</thead>
						<tbody>
						<?php
							foreach ($productos_ventas as $pv) {
								?>
								<tr>
									<td class="text-center px-2 py-3"><?php echo $pv['cantidad']; ?></td>
									<td class="px-2 py-3"><?php echo $pv['nombre']; ?></td>
									<td class="text-right px-2 py-3" style="white-space: nowrap;">$ <?php echo clp($pv['precio_normal']); ?></td>
									<td class="text-right px-2 py-3" style="white-space: nowrap;">$ <?php echo clp($pv['descuento']); ?></td>
									<td class="text-right px-2 py-3" style="white-space: nowrap;">$ <?php echo clp($pv['precio_total']); ?></td>
								</tr>
								<?php
							}
							?>
						</tbody>
						<tfooter>
							<?php if (!empty($descuento) || !empty($descuento_puntos)) {
								$descuentoTotal = $descuento + $descuento_puntos;
								?>
								<tr>
									<td></td>
									<td></td>
									<td></td>
									<td class="text-right px-2 py-3"><strong>DESCUENTO</strong></td>
									<td class="px-2 py-3 text-right" style="white-space: nowrap;"><strong><?php echo "$ " . clp($descuentoTotal); ?></strong></td>
								</tr>

							<?php
							} 
							?>
							<tr>
								<td></td>
								<td></td>
								<td></td>
								<td class="text-right px-2 py-3"><strong>TOTAL</strong></td>
								<td class="px-2 py-3 text-right" style="white-space: nowrap;"><strong><?php echo "$ " . clp($total); ?></strong></td>
							</tr>
						</tfooter>
					</table>
				<?php
				}
			?>

			<div class="row mt-5">
				<div class="col text-center"><strong>Detalle de venta no válido como boleta</strong></div>
			</div>
		</div>
		<script src="<?php echo base_url(); ?>js/jquery-ui.min.js"></script>
		<script src="<?php echo base_url(); ?>js/functions.js"></script>
		<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
		<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
	</body>
</html>