<style>
.hiddenRow {
padding: 0 !important;
}
</style>
<div class="block">
<div class="block-title">
<h2><strong>Combustible Mensual ({{ (isset($month))? Helper::month($month) : Helper::month(date('m')) }} - {{ (isset($year))? $year : date('Y') }})</strong> </h2>
</div>
<div class="row">
<div class="col-md-12">
<table class="table table-condensed table-striped">
<thead>
<tr>
<th>Semana</th>
<th colspan="4"> </th>
<th>Litros</th>
<th>Total</th>
</tr>
</thead>
<tbody>
@if(isset($combustibleObject ))
@foreach($combustibleObject as $key => $value2)
<tr>
<td colspan="12" class="hiddenRow">
<div class="accordian-body collapse" id="{{$value2["semana"]}}">
<table class="table table-striped">
<thead>
<tr>
<th>Orden</th>
<th>Nota</th>
<th>Fecha</th>
<th>Gasolinera</th>
<th>Tipo</th>
<th>Chofer</th>
<th>Placas</th>
<th>Litros</th>
<th>Precio</th>
<th>Kilometraje</th>
<th>Rendimiento</th>
<th>Total</th>
</tr>
</thead>
<tbody>
<?php
$total = 0;
$litros = 0;
?>
@foreach($value2['notas'] as $key => $value)
<?php
$total += $value->total;
$litros += $value->litros;
?>
<tr>
<td>{{$value->orden_id}}</td>
<td>{{$value->nota}}</td>
<td>{{$value->fecha_inicio}}</td>
<td>{{$value->nombre_comercial}}</td>
<td>{{$value->tipo}}</td>
<td>{{$value->nombre}}</td>
<td>{{$value->placas}}</td>
<td>{{$value->litros}}</td>
<td>${{$value->precio_litro}}</td>
<td>{{$value->kilometraje}}</td>
<td>{{$value->rendimiento ? $value->rendimiento."/L" : null}}</td>
<td>${{number_format($value->total, 2)}}</td>
</tr>
@if(isset($value2['notas'][$key + 1]) && $value->nombre != $value2['notas'][$key + 1]->nombre)
<tr>
<td>{{$value->nombre}}</td>
<td colspan="6"></td>
<td>Litros: {{$litros}}</td>
<td colspan="3"></td>
<td>Total: ${{number_format($total, 2)}}</td>
</tr>
<?php
$total = 0;
$litros = 0;
?>
@elseif (!isset($value2['notas'][$key + 1]))
<tr>
<td>{{$value->nombre}}</td>
<td colspan="6"></td>
<td>Litros: {{$litros}}</td>
<td colspan="3"></td>
<td>Total: ${{number_format($total, 2)}}</td>
</tr>
@endif
@endforeach
</tbody>
</table>
</div>
</td>
</tr>
<tr data-toggle="collapse" data-target="#{{$value2['semana']}}" class="accordion-toggle success" >
<td>Semana {{$value2["semana"]." (".\Helper::getStartAndEndDate($value2["semana"], 2021).")"}}</td>
<td colspan="4"> </td>
<td>{{ $value2['litros'] }}</td>
<td>${{number_format($value2['total'], 2)}}</td>
</tr>
@endforeach
@else
<tr>
<td colspan="6">No hay registros</td>
</tr>
@endif
</tbody>
</table>
</div>
</div>
</div>
<div class="block">
<div class="block-title">
<h2><strong>Combustible Anual ({{ (isset($year))? $year : date('Y') }})</strong> </h2>
</div>
<div class="row">
<div class="col-md-12">
<div>
<table class="table table-striped">
<thead>
<tr>
<th>Mes</th>
<th>No. Notas</th>
<th>Litros</th>
<th>Total</th>
</tr>
</thead>
<tbody>
@if(isset($combustibleOrdenYear ))
@foreach($combustibleOrdenYear as $key => $value)
<tr>
<td>{{$value->mes}}</td>
<td>{{$value->notas}}</td>
<td>{{$value->litros}}</td>
<td>${{number_format($value->total, 2)}}</td>
</tr>
@endforeach
@else
<tr>
<td colspan="6">No hay registros</td>
</tr>
@endif
</tbody>
</table>
</div>
</div>
</div>
</div>