<style>
.hiddenRow {
padding: 0 !important;
}
</style>
<div class="block">
<div class="block-title">
<h2><strong>Vertedero Mensual ({{ (isset($month))? Helper::month($month) : Helper::month(date('m')) }} - {{ (isset($year))? $year : date('Y') }})</strong> </h2>
<div class="block-options pull-right">
<a onclick="MetricaVertedero.selectType(2)" class="btn btn-alt btn-sm btn-default toggle-bordered enable-tooltip" data-toggle="button" title="" data-original-title="">Vertedero</a>
<a onclick="MetricaVertedero.selectType(1)" class="btn btn-alt btn-sm btn-default toggle-bordered enable-tooltip" data-toggle="button" title="" data-original-title="">Chofer</a>
</div>
</div>
<div class="row">
<div class="col-md-12">
<table class="table table-condensed table-striped">
<thead>
<tr>
<th>Semana</th>
<th></th>
<th></th>
<th></th>
<th>Peso Neto</th>
<th>Total</th>
</tr>
</thead>
<tbody>
@if(isset($vertederoObject ))
<?php
$typeView = "nombre";
if ($type == 2) {
$typeView = "nombre_comercial";
}
?>
@foreach($vertederoObject 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>Chofer</th>
<th>Vertedero</th>
<th>Precio</th>
<th>Peso Neto</th>
<th>Total</th>
</tr>
</thead>
<tbody>
<?php
$total = 0;
$peso = 0;
?>
@foreach($value2['notas'] as $key => $value)
<?php
$total += $value->total;
$peso += $value->peso_neto;
?>
<tr>
<td>{{$value->orden_id}}</td>
<td>{{$value->nota}}</td>
<td>{{$value->fecha_inicio}}</td>
<td>{{$value->nombre}}</td>
<td>{{$value->nombre_comercial}}</td>
<td>${{number_format($value->precio)}}</td>
<td>{{$value->peso_neto}}</td>
<td>${{number_format($value->total, 2)}}</td>
</tr>
@if(isset($value2['notas'][$key + 1]) && $value->$typeView != $value2['notas'][$key + 1]->$typeView)
<tr>
<td>{{$value->$typeView}}</td>
<td colspan="5"></td>
<td>Peso Neto: {{$peso}} kg.</td>
<td>Total: ${{number_format($total, 2)}}</td>
</tr>
<?php
$total = 0;
$peso = 0;
?>
@elseif (!isset($value2['notas'][$key + 1]))
<tr>
<td>{{$value->$typeView}}</td>
<td colspan="5"></td>
<td>Peso Neto: {{$peso}} kg.</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"], $value2["year"]).")"}}</td>
<td></td>
<td></td>
<td></td>
<td>{{$value2['peso_neto']}}</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>Vertedero 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>Peso Neto</th>
<th>Total</th>
</tr>
</thead>
<tbody>
@if(isset($vertederoOrdenYear ))
@foreach($vertederoOrdenYear as $key => $value)
<tr>
<td>{{$value->mes}}</td>
<td>{{$value->notas}}</td>
<td>{{$value->peso_neto}}</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>
<script src="{{ URL::To('/js/catalogo_js/metricaVertedero.js') }}"></script>