<ul class="list-group">
	<li class="list-group-item header-right">
		<?php
			$data['a'] = 'i';
			if ($tipo_venta == 1) {
				$data['a'] = 'i';
			}
			else {
				$data['a'] = 'f';
			}
			$this->load->view('ventas/navigation', $data);
		?>
		<?php /*
		<div class="row mt-0">
			<div class="col-12 text-left">
				<h5>
					<span class="badge badge-pill badge-success"><?php echo clp($totales['total']); ?></span>
					<span class="badge badge-pill badge-primary"><?php echo clp($totales['total_facturas']); ?></span>
				</h5>
			</div>
		</div>
		*/ ?>
	</li>
<?php
//$data['clientes'] = $clientes;
if(!empty($ventas)) {
	//$first = true;
	foreach($ventas as $k => $mes) {
		$mes_actual = (!empty($mes_actual) ? $mes_actual : $k);
		?>
		<li class="list-group-item">
			<div class="row">
				<div class="col-sm-6">
					<h4 class="mes clickable">
						<?php 
						if ($k == $mes_actual) {
							?>
								<a data-toggle="collapse" href="#collapse<?php echo $k; ?>"><?php echo mtt($k);?></a>
							<?php
						}
						else{
							?>
							<a href="/ventas/index/<?php echo $k . '/' . $tipo_venta . '?' . $_SERVER['QUERY_STRING'];?>"><?php echo mtt($k);?></a>
							<?php
						}
						?>
					</h4>
				</div>
				<div class="col-sm-6 text-right">
					<h5>
						<?php if ($tipo_venta == 1) { ?>
							<span class="badge badge-pill badge-danger" title="Sin Nº de boleta"><?php echo $totales[$k]['sin_boleta'];?></span>
							<span class="badge badge-pill badge-info" title="Cantidad de boletas"><?php echo $totales[$k]['boletas'];?></span> 
							<span class="badge badge-pill badge-success" title="Total vendido"><?php echo clp($totales[$k]['total']); ?></span>
						<?php } else { ?>
							<span class="badge badge-pill badge-info" title="Cantidad de documentos"><?php echo (!empty($totales[$k]['tipo']) ? $totales[$k]['tipo'] : 0); ?></span>
							<span class="badge badge-pill badge-primary" title="Total vendido"><?php echo (!empty($totales[$k]['tipo']) ? clp($totales[$k]['total_tipo']) : 0); ?></span>
						<?php } 
						?>
					</h5>
				</div>
			</div>
			<?php
				$show = '';
				//if ($first) {
				if ($k == $mes_actual) {
					$show = ' show';
					$first = false;
				}
			?>
			<div class="collapse<?php echo $show; ?>" id="collapse<?php echo $k; ?>">
				<?php
				if ($k == $mes_actual) {
					foreach($mes as $v) {
						$data['v'] = $v;
						$this->load->view('ventas/single', $data);
					}
				}
				?>
			</div>
		</li>
		<?php
	}
}
else {
	?>
	<li>A&uacute;n no hay ventas</li>
	<?php
}
?>
</ul>

<?php $this->load->view('ventas/modal'); ?>
<script src="<?php echo js('ventas.js'); ?>"></script>