<head>
	<meta charset="UTF-8">
	<title>Temposatis</title>
	<!-- <link href="../assets/global/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css"/> -->
	<style>
		.text-center{text-align: center; }
		.text-left{text-align: left; }
		.text-right{text-align: right; }
	</style>
</head>
<body>
	<div class="datos">
		<?php 
include_once "../controller/cVentas.php";
$cVentas = new cVentas();
$datos = $cVentas->getVentas($_GET['user'], $_GET['sucursal'], $_GET['fecha_inicio'], $_GET['fecha_fin'], $_GET['estatus']);
?>
			<table class="table table-hover table-bordered table-striped" id="tabla" border="1" cellpadding="10" cellspacing="0">
				<thead>
					<tr>
						<th> Folio</th>
						<th> Fecha </th>
						<th> Referencia/serie</th>
						<th> Incentivos por venta(comisiones) </th>
						<th> Estatus</th>
						<th> Observacion</th>
					</tr>
				</thead>
				<tbody>
					<?php 
while ($row = $datos->fetch_array(MYSQLI_ASSOC)) {
                // $cFiles->setName($_POST['txtNombreAgregar'],'archivo');
                // echo $cFiles->getName();
                $result = $cFiles->setFile('archivo', '../pedidos', false);
                if ($result == 1) {
                    $cVentas->updateEstatusVenta($_POST['estatus'], $_POST['txtIdVenta'], $_POST['txtObservacion'], $cFiles->getName());
                    header("Location:../view/consultarPedidoExistente.php");
                } else {
                    throw new Exception($result, 1);
                }
            } catch (Exception $e) {
                echo $e->getMessage();
            }
            break;
        case 'ventasUsuario':
            //muestra la tabla de los pedidos que tiene un usuario
            $datos = $cVentas->getVentas($_POST['id_usuario'], $_POST['id_sucursal'], $_POST['fecha_inicio'], $_POST['fecha_fin'], $_POST['estatus']);
            ?>
			<table class="table table-hover table-bordered table-striped" id="tabla" border="1" cellpadding="10" cellspacing="0">
				<thead>
					<tr>
						<th> Folio</th>
						<th> Fecha </th>
						<th> Referencia/Descripción/Serie</th>
						<th> Incentivos</th>
						<th> Estatus</th>
						<th> Observacion</th>
						<th> Imagen</th>
					</tr>
				</thead>
				<tbody>
					<?php