<div class="col-md-12 ">
  <h4 class="text-center titulo-fidelitas ">STATUS BANCARIO</h4>
</div>
<div class="col-md-12 padding10 mt20">
  <div class="col-md-3">
    <div class ="padding10 background-fidelitas text-center font15 " style="min-height: 55px;">
      CHEQUES RECHAZADOS
    </div>
    <div class =" padding10 text-center font15" style="border:1px solid #eee; ">
      @if(isset($card_status_bancario->cheques_rechazados)) @if($card_status_bancario->cheques_rechazados  > 0) SI @else NO @endif @else No Informa @endif
    </div>
  </div>
  <div class="col-md-3">
    <div class ="padding10 background-fidelitas text-center font15 " style="min-height: 55px;">
      SITUACIÓN DIFERENTE A NORMAL
    </div>
    <div class =" padding10 text-center font15"  style="border:1px solid #eee;">
       @if(isset($card_status_bancario->situaciones)) @if($card_status_bancario->situaciones  > 0) SI @else NO @endif @else No Informa @endif
    </div>
  </div>
   <div class="col-md-3">
    <div class ="padding10 background-fidelitas text-center font15 " style="min-height: 55px;">
      ÚLTIMA POSICIÓN
    </div>
    <div class =" padding10 text-center font15" style="border:1px solid #eee; ">
      @if(isset($card_status_bancario->ultima_posicion)) 
      
        @if($card_status_bancario->ultima_posicion  > 0) 
          $ {{number_format($card_status_bancario->ultima_posicion ,0,',',' ')}} 
        @else
          No Informa
        @endif 
      @else 
        No Informa
       @endif
    </div>
  </div>
   <div class="col-md-3">
    <div class ="padding10 background-fidelitas text-center font15 " style="min-height: 55px;">
      MÁXIMA POSICIÓN <div style="font-size:10px;">(VALOR MÁX. ÚLTIMOS 24 MESES)</div>
    </div>
    <div class =" padding10 text-center font15" style="border:1px solid #eee; ">
       @if(isset($card_status_bancario->maxima_posicion)) @if($card_status_bancario->maxima_posicion  > 0) $ {{number_format($card_status_bancario->maxima_posicion,0,',',' ')}} @endif @else No Informa @endif
    </div>
  </div>
</div>

<div class="col-md-12 padding10">
  <h4 class="text-center titulo-fidelitas ">CHEQUES RECHAZADOS</h4>
</div>

@if (!isset($cheques['a_nombre_de_empresa']) && !isset($cheques['propio']) && !isset($cheques['empresa']))

    <h4 class="text-center">No se registran Cheques Rechazados.</h4>
</div>

@endif

<div class="col-md-12 col-sm-12 col-xs-12 text-center" style="margin-top:20px;">
    @if($grafico_cheques_bancos != '')
    <div style="height: 300px;margin-bottom:8px;"><img src="{{$grafico_cheques_bancos}}" style="width:100%" /></div>
    @else
    <div id="ajusta_grafico_cheques">&nbsp;</div>
    <div id="grafico_cheques_bancos" style="height: 300px;margin-bottom:8px; margin-left: 12px;"></div>
    @endif
</div>

@if($persona_fisica)

  @if(isset($cheques['propio']))
     <div style="padding:10px;font-size:16px; margin-bottom: :5px;" class="col-md-12 col-sm-12 col-xs-12 text-center background-fidelitas"><span>{{$cheques['cantidad_propios']}}</span> Cheques Rechazados</div>
      
        <table class="table table-hover" id="tabla_cheques">
          <thead>
            <tr>
              <th>
                Número de Cheque
              </th>
              <th>
                Firmante
              </th>
               <th>
                Importe
              </th>
              <th>
              Fecha Rechazo
              </th>
              <th>
              Fecha Pago
              </th>
              <th>
              Fecha Pago Multa
              </th>
              <th>
              Causa
              </th>
            </tr>
          </thead>
          <tbody>
            @foreach ($cheques['propio'] as $cheque)
            <tr>
              <td>
                {{ $cheque->nro_cheque }}
              </td>
              <td>
                {{ $cheque->nombre_persona_firmante or 'No Informa'}}
              </td>
              <td>
                {{ number_format($cheque->importe,2,',',' ')  }} 
              </td>
              <td>
                {{ $cheque->fecha_rechazo }}
              </td>
              <td>
                {{ $cheque->fecha_levantamiento }}
              </td>
              <td>
                {{ $cheque->fecha_pago }}
              </td>
              <td>
                {{ $cheque->causa }}
              </td>
            </tr>
            @endforeach
           
          </tbody>
          <tfoot>
            <tr>
              <th>
              Número de Cheque
              </th>
              <th>
              Firmante
              </th>
               <th>
              Importe
              </th>
              <th>
              Fecha Rechazo
              </th>
               <th>
              Fecha Pago
              </th>
              <th>
              Fecha Pago Multa
              </th>
              <th>
              Causa
              </th>
            </tr>
          </tfoot>
        </table>
  @else
        <div class="col-md-12 col-sm-12 col-xs-12"><h5 style="padding:10px;" class="text-center alert alert-success">No se registran cheques rechazados en cuentas Personales</h5></div>
  @endif



  @if(isset($cheques['empresa']))         

      <h5 style="padding:10px;" class="col-md-12 col-sm-12 col-xs-12 text-center background-fidelitas"><span>{{$cheques['cantidad_empresas']}}</span> Cheques Rechazados en cuentas de personas jurídicas</h5>

    <table class="table table-hover" id="tabla_cheques">
        <thead>
          <tr>
            <th>
            Número de Cheque
            </th>
            <th>
            Empresa
            </th>
             <th>
            Importe
            </th>
            <th>
            Fecha Rechazo
            </th>
            <th>
            Fecha Pago
            </th>
            <th>
            Fecha Pago Multa
            </th>
            <th>
            Causa
            </th>
          </tr>
        </thead>
         <tbody>
          @foreach ($cheques['empresa'] as $cheque)
          <tr>
            <td>
              {{ $cheque->nro_cheque }}
            </td>
            <td>
               <form target="iframe{{$cheque->Cuit_relacionado}}" method="POST" action="/informes/compacto" class="text-left">
                <input type="hidden" name="_token" id="token" value="{{ csrf_token() }}">
                <input id="idp" name="idp" value="{{$cheque->idp}}" type="hidden">
                <input id="fcuit" name="cuit" value="{{$cheque->Cuit_relacionado}}" type="hidden">
                <input id="nc" name="nc" value="{{$cheque->nombre_persona_relacionado}} - {{$cheque->Cuit_relacionado}}" type="hidden">
                <input id="rs" name="rs" value="{{$cheque->nombre_persona_relacionado}}" type="hidden">
                <button type="submit" class="nuevo-informe">{{$cheque->nombre_persona_relacionado or ''}}</button>

              </form>
            </td>
            <td>
              {{ number_format($cheque->importe,2,',',' ')  }}
              
            </td>
            <td>
              {{ $cheque->fecha_rechazo }}
            </td>
            <td>
              {{ $cheque->fecha_levantamiento }}
            </td>
            <td>
              {{ $cheque->fecha_pago }}
            </td>
            <td>
              {{ $cheque->causa }}
            </td>
          </tr>
          @endforeach
        
         </tbody>
        <tfoot>
          <tr>
            <th>
            Número de Cheque
            </th>
            <th>
            Empresa
            </th>
             <th>
            Importe
            </th>
            <th>
            Fecha Rechazo
            </th>
            <th>
            Fecha Pago
            </th>
            <th>
            Fecha Pago Multa
            </th> 
            <th>
            Causa
            </th>
          </tr>
        </tfoot>
        </table>
        </div>
  @endif

@else

  @if(isset($cheques['a_nombre_de_empresa']))
<div class="col-md-12 col-sm-12 col-xs-12">
  <div class="col-md-12 col-sm-12 col-xs-12">
    <div style="padding:10px;font-size:16px; margin-bottom: 50px;" class="col-md-12 col-sm-12 col-xs-12  text-center background-fidelitas"><span>{{$cheques['cantidad_propios']}}</span> Cheques Rechazados</div>         
        <table class="table table-hover" id="tabla_cheques">
        <thead>
          <tr>
            <th>
            Número de Cheque
            </th>
            
             <th>
            Importe
            </th>
            <th>
            Fecha Rechazo
            </th>
             <th>
            Fecha Pago
            </th>
            <th>
            Fecha Pago Multa
            </th>
            <th>
            Causa
            </th>
          </tr>
        </thead>
         <tbody>
          @foreach ($cheques['a_nombre_de_empresa'] as $cheque)

          <tr>
            <td>
              {{ $cheque->nro_cheque }}
            </td>
            
            <td>
              {{ number_format($cheque->importe,2,'.',' ')  }}
              
            </td>
            <td>
              {{ $cheque->fecha_rechazo }}
            </td>
            <td>
              {{ $cheque->fecha_levantamiento }}
            </td>
            <td>
              {{ $cheque->fecha_pago }}
            </td>
            <td>
              {{ $cheque->causa }}
            </td>
          </tr>
          @endforeach
         
         </tbody>
        <tfoot>
          <tr>
            <th>
            Número de Cheque
            </th>
             <th>
            Importe
            </th>
            <th>
            Fecha Rechazo
            </th>
             <th>
            Fecha Pago
            </th>
            <th>
            Fecha Pago Multa
            </th>
            <th>
            Causa
            </th>
          </tr>
      </tfoot>
    </table>
  </div>
</div>
  @endif

  
  @if (isset($cheques['vinculaciones']))

  
<div class="col-md-12 col-sm-12 col-xs-12 padding10" style="margin-bottom: 25px">
  <h4 class="text-center titulo-fidelitas ">VINCULACIONES SEGÚN BCRA</h4>
</div>
    <div class="col-md-12 col-sm-12 col-xs-12">
      <div class="col-md-12 col-sm-12 col-xs-12">
        <table class="table table-hover" id="tabla_vinculaciones">
        <thead>
              <tr>
                <th class="text-center">
                  Firmante
                </th>
                <th class="text-center">
                  CUIT
                </th>
                <th class="text-center">
                  Cant Cheques(individual/conjunta)
                </th>
              </tr>
            </thead>
             <tbody>
        @if (isset($cheques['vinculaciones']) && sizeof($cheques['vinculaciones']) > 0)
              @foreach ($cheques['vinculaciones'] as $cheque)
              <tr>
                 <td class="text-center">
                  <form target="iframe{{$cheque->cuit_firmante}}" method="POST" action="/informes/compacto"  class="text-left">
                    <input type="hidden" name="_token" id="token" value="{{ csrf_token() }}">
                    <input id="idp" name="idp" value="{{$cheque->idp}}" type="hidden">
                    <input id="fcuit" name="cuit" value="{{$cheque->cuit_firmante}}" type="hidden">
                    <input id="nc" name="nc" value="{{$cheque->nombre_persona_firmante}} - {{$cheque->cuit_firmante}}" type="hidden">
                    <input id="rs" name="rs" value="{{$cheque->nombre_persona_firmante}}" type="hidden">
                    <button type="submit" class="nuevo-informe">{{$cheque->nombre_persona_firmante or ''}}</button>
                    
                  </form>

                </td>
                <td>
                  {{ $cheque->cuit_firmante or '' }}
                </td>
                <td class="text-center">
                  {{ $cheque->cantidad or '' }}/{{$cheques['cantidad_propios']}}
                </td>
              </tr>
              @endforeach
              @endif
            </tbody>
            <tfoot>
               <tr>
                <th class="text-center">
                  Firmante
                </th>  
                <th class="text-center">
                  CUIT
                </th>
                <th class="text-center">
                  Cantidad
                </th>
              </tr>
            </tfoot>
      </table>
    </div>
  </div>
  @endif
@endif
<div class="col-md-12 padding10">
  <h4 class="text-center titulo-fidelitas ">CENTRAL DE DEUDORES</h4>
</div>
@if (!$obtener_bancos)
<div class="col-md-12"><h4 class="text-center">No se registra información de Bancos</h4></div>
@else
 <div class="col-md-12 col-sm-12 col-xs-12 text-center">
    @if(Session::get('HTML'))
    <div  style="height: 450px;margin-left: 12px;" ><img src="{{$grafico_financiero}}" style="height: 450px;margin-left: 12px;" /></div>
    @elseif($grafico_financiero != '')
    <div   style="height: 450px;margin-left: 12px;" ><img src="{{$grafico_financiero}}" style="width:100%" /></div>
    @else
    <div id="financiero" style="height: 450px;margin-left: 12px;"></div>
    @endif
</div>


  <div class="col-md-12 col-sm-12 col-xs-12">
    <div class="col-md-12 col-sm-12 col-xs-12">
      <h4 style="padding:10px;" class="text-center  titulo-contables heading-block">Situaciones últimos 24 meses</h4>
    </div>
  </div>

  <div class="col-md-12 col-sm-12 col-xs-12 text-left  color-fidelitas">
    <div class="col-md-12 col-sm-12 col-xs-12">
      *Los montos se encuentran expresados en miles de pesos.
    </div>
  </div> 

  <div class="col-md-12 col-sm-12 col-xs-12 text-center">
    @if($grafico_situaciones != '')
    <div  style="height: 450px; margin-left: 12px;" ><img src="{{$grafico_situaciones}}" style="width:100%" /></div>
    @else
    <div id="situaciones" style="height: 400px; margin-left: 12px;"></div>
    @endif
  </div>

  <div class="col-md-12 col-sm-12 col-xs-12">
    <div class="col-md-12 col-sm-12 col-xs-12">
      <div class="red text-right" style="font-size:17px; margin-bottom: 25px">Los montos se encuentran expresados en miles de pesos</div>
    </div>
  </div>

@for ($i = 1; $i <= 3; $i++)
  <div style="width:5%;float:left;display: none;">
    <i class="fa fa-plus-square color-fidelitas" aria-hidden="true" style="font-size: 20px;"></i>
  </div>
  <!--<div style="width:5%;float:left;display: none;">
    <i class="fa fa-minus-square color-fidelitas" aria-hidden="true" style="font-size: 20px;"></i>
  </div>-->
  <div class="col-md-12 col-sm-12 col-xs-12">
    <div class="col-md-12 col-sm-12 col-xs-12">
      <div class="table-responsive" style="width:100%;float:left;">
        <table  id="table_{{$i}}" class="table table-responsive  table-bordered" style="font-size: 0.8em;white-space: nowrap;color:black;">
          <tr class="background-fidelitas">
            <th class="text-left bancos_th">Banco</th>
            @foreach($periodo[$i] as $fecha)
              <th class="text-center  bancos_th">{{date('m/Y',strtotime($fecha.'01'))}}</th>
            @endforeach
          </tr>
          @foreach($obtener_bancos as $key_ob => $bancos)
            <tr class="tr_{{$i}}">
              <td class="text-left" class="desplegable_{{$i}}">
                @if($key_ob == 'TOTAL_PERIODO')
                  <label class="tr_{{$i}}" style="font-weight: 700">{{str_replace('_', ' ', $key_ob)}}</label>
                @else
                  {{str_replace('_', ' ', $key_ob)}}
                @endif
              </td>
              @foreach($bancos[$i] as $banco)
                @if($key_ob == 'TOTAL_PERIODO')
                  <td class="text-right desplegable_{{$i}} bancos_td" style="font-weight: 700">  
                    @if($banco['TOTAL_PERIODO']) {{number_format($banco['TOTAL_PERIODO'],2,',',' ')}} @endif
                  </td>
                @else
                  <td class="situacion{{$banco['situacion']}} text-right desplegable_{{$i}} bancos_td" >  
                    @if($banco['total']) {{number_format($banco['total'],2,',',' ')}} @endif
                  </td>
                @endif
              @endforeach
            </tr>
          @endforeach
        </table>
      </div>
    </div>
</div>
@endfor


<div class="col-md-12 col-sm-12 col-xs-12">
  <div class="col-md-12 col-sm-12 col-xs-12">
    <table class="table table-bordered">
      <tr>
        <td colspan="4" class="text-center"><b>Situaciones</b>
        </td>
      </tr>

      <tr>
        <td class="text-center situacion01" style="width: 20px; padding: 3px 8px">1</td><td class="text-left font07"> Situación Normal (atraso hasta 30 días)
        </td>
        <td class="text-center situacion04" style="width: 20px; padding: 3px 8px">4</td><td class="text-left font07"> Con Alto Riesgo de Insolvencia (atraso de 181 a 365 días)
        </td>
      </tr>

      <tr>
        <td class="text-center situacion02" style="width: 20px; padding: 3px 8px">2</td><td class="text-left font07"> Con Riesgo Potencial (atraso de 31 a 90 días)
        </td>
        <td class="text-center situacion05" style="width: 20px; padding: 3px 8px">5</td><td class="text-left font07"> Irrecuperable (atraso de más de 365 días)
        </td>
      </tr>

      <tr>
        <td class="text-center situacion03" style="width: 20px; padding: 3px 8px">3</td><td class="text-left font07"> Con Problemas (atraso de 91 a 180 días)
        </td>
        <td class="text-center situacion06" style="width: 20px; padding: 3px 8px">6</td><td class="text-left font07"> Irrecuperable por Disposición Técnica (Morosos de ex-entidades financieras, con atraso de más de 180 días)
        </td>
      </tr>
    </table>
  </div>
  @if($cancelaciones)
  <div class="col-md-12 col-sm-12 col-xs-12">
      <h4 style="padding:10px;" class="text-center  titulo-contables heading-block">Notas</h4>
    </div>

    @foreach($cancelaciones as $cancelacion)
  <div class="col-md-12 col-sm-12 col-xs-12 text-left">
   - El {{$cancelacion->fecha_fuente}} SE COMUNICO {{$cancelacion->evento}} DE LA DEUDA CON {{$cancelacion->banco}} INFORMADA DESDE {{$cancelacion->periodo_desde}} HASTA {{$cancelacion->periodo_hasta}} ( FECHA DE {{$cancelacion->evento}}: {{$cancelacion->fecha_evento}})
  </div>
    @endforeach
  @endif
</div>

<div class="col-md-12 col-sm-12 col-xs-12" style="margin-top:20px;">
  <div class="col-md-12 col-sm-12 col-xs-12">
    <h4 style="padding:10px;" class="text-center  titulo-contables heading-block">Garantías últimos 24 meses</h4>
  </div>
</div>

<div class="col-md-12 col-sm-12 col-xs-12 text-left  color-fidelitas">
  <div class="col-md-12 col-sm-12 col-xs-12">
    *Los montos se encuentran expresados en miles de pesos.
  </div>
</div> 

 <div class="col-md-12 col-sm-12 col-xs-12 text-center">
    @if($grafico_garantias != '')
      <div style="height: 400px; margin-left: 12px;" ><img src="{{$grafico_garantias}}" style="width:100%" /></div>
    @else
      <div id="garantias" style="height: 400px; margin-left: 12px;"></div>
    @endif
</div> 

@endif