@extends('cr_blank')

@section('content')
@include('reportes.components.pdf_header', [
    'titulo' => $title,
    'fecha' => now()->format('d/m/Y')
])
{{-- <div>Dirección: {{ $data->proveedor->direccion }}</div> --}}
@php
    $total_c = 0;
    $total_o = 0;
@endphp
<table class="table-data bordes">
  <tr>
    <th style="width: 4%;">N.</th>
    <th style="width: 6%;">Código</th>
    <th style="width: 10%;">Número de medidor</th>
    <th style="width: 26%;">Contribuyente</th>
    <th style="width: 20%;">OTB</th>
    <th style="width: 8%;">Meses Adeudados</th>
    <th style="width: 8%;">Consumo (Bs)</th>
    <th style="width: 8%;">Otros (Bs)</th>
    <th style="width: 10%;">Total (Bs)</th>
  </tr>
  @foreach ($data as $index => $item)
    @php
        $total_c += $item->t_consumo;
        $total_o += $item->t_otros;
        $sombreado = ($index % 2 === 1) ? 'row-alt' : '';
    @endphp
    <tr class="{{ $sombreado }}">
      <td class="text-center">{{ ++$i }}</td>
      <td class="text-center">M{{ $item->manzano->nombre }} - {{ $item->lote }}{{ $item->sufijo }}</td>
      <td class="text-center">{{ $item->numero }}</td>
      <td>{{ $item->socio->nombre_completo }}</td>
      <td class="text-center">{{ $item->zona->nombre }}</td>
      <td class="text-center">{{ $item->nro_meses }}</td>
      <td class="text-center">{{ number_format($item->t_consumo,2) }}</td>
      <td class="text-center">{{ number_format($item->t_otros,2) }}</td>
      <td class="text-center">{{ number_format($item->t_consumo + $item->t_otros,2) }}</td>
    </tr>
  @endforeach
    <tr>
        <td class="text-right no-margin-bottom no-margin-left negrita" colspan="6">TOTAL</td>
        <td class="text-center negrita">{{ number_format($total_c,2) }}</td>
        <td class="text-center negrita">{{ number_format($total_o,2) }}</td>
        <td class="text-center negrita">{{ number_format($total_c + $total_o,2) }}</td>
    </tr>
</table>

{{-- <div>{{ $txt_total }}</div> --}}
    
@endsection

@section('scripts')
  <style>
    .title {
      font-size: 18px;
      font-weight: bold;
      text-transform: uppercase;
    }
    .table-data {
      width: 100%;
      font-size: 11px;
    }
    .row-alt { background-color: #bbbbbb; }
    table.table-data th, table.table-data td {
      height: 30px;
    }
    .bordes .no-margin {
      margin-top: 0;
      margin-bottom: 0;
      margin-left: 0;
      border: none;
    }
    .bordes .no-margin-top {
      margin-top: 0;
      border: none;
    }
    .bordes .no-margin-bottom {
      margin-bottom: 0;
      border: none;
    }
    .bordes .no-margin-left {
      margin-left: 0;
      border: none;
    }
  </style>
    
@endsection
