@if(!empty($activo)) 
<div class="col-md-12"><h3>No Hay información Contable</h3></div>

@else
<h4 style="padding:10px;" class="text-center  background-fidelitas">Activos</h4>

<table class="table table-striped table-bordered">
	@foreach($activo as $key_bo => $balances)
	<tr>
		@foreach($balances as $key => $balance )
		@if ($key == 0)<td><p>{{ucwords(str_replace('anc_','_',str_replace('_',' ',$key_bo)))}}</p></td>@endif
		<td><p>@if ($key_bo == 'fecha_balance'){{$balance}}@else{{number_format(($balance/1000),2,',','.')}}@endif</p></td>
		@if($key_bo == 'fecha_balance')<td><p>%</p></td>
		@else
		<td><p>
		@if($key_bo != 'bienes_de_uso_valor_de_origen' && $key_bo != 'depreciacion_acumulada')
		{{round(($balance /10) / ($activo['total_activo'][$key] / 1000),2)}}
		@endif
		</p></td>
		@endif
		@endforeach
	</tr>
	@endforeach
</table>


<h4 style="padding:10px;" class="text-center  background-fidelitas">Pasivos</h4>

<table class="table table-striped table-bordered">
	@foreach($pasivo as $key_bo => $balances)
	<tr>
		@foreach($balances as $key => $balance )
		@if ($key == 0)<td><p>{{ ucwords(str_replace('pnc','',str_replace('_',' ',$key_bo)))}}</p></td>@endif
			<td><p>@if ($key_bo == 'fecha_balance'){{$balance}}@else{{number_format(($balance/1000),2,',','.')}}@endif</p></td>
	@if($key_bo == 'fecha_balance')<td><p>%</p></td>@else<td><p>
	@if(!empty($pasivo['total_pasivo'][$key]))
		@if($key_bo != 'capital_social' && $key_bo != 'resultados_no_asignados')
			{{round(($balance /10) / ($pasivo['total'][$key] / 1000),2)}}
		@endif
	@endif
	</p></td>@endif
		@endforeach
	</tr>
	@endforeach
</table>

<h4 style="padding:10px;" class="text-center  background-fidelitas">Estado de Resultados</h4>
<table class="table table-striped table-bordered">
	@foreach($estado_de_resultados as $key_bo => $balances)
	<tr>
		@foreach($balances as $key => $balance )
			@if ($key == 0)
				<td><p>
				@if($key_bo == 'res_cosmer')
				 Costos de las mercaderías, productos, servicios vendidos
				@elseif($key_bo == 'res_gasadm')
				Gastos de Administración
				@elseif($key_bo == 'res_gascom')
					Gastos de Comercialización
				@elseif($key_bo == 'res_resfin')
					Resultados financieros y por tenencia (incluyendo result.por exposición a inflación)
				@else
				{{ ucwords(str_replace('_',' ',$key_bo))}}
				@endif
				</p></td>
				@endif
				<td><p>@if ($key_bo == 'fecha_balance'){{$balance}}
			@else
				{{number_format(($balance/1000),2,',','.')}}
			@endif
			</p></td>
		
	@if($key_bo == 'fecha_balance')
		<td><p>%</p></td>
	@else
		<td><p>
		@if($key_bo != 'amortizaciones' && $key_bo != 'compras_del_ejercicio')
			{{number_format(round(($balance /10) / ($estado_de_resultados['ventas_netas'][$key] / 1000),2),2,',','.')}}
		@endif
		</p></td>
	@endif
		@endforeach
	</tr>
	@endforeach
</table>

<h4 style="padding:10px;" class="text-center  background-fidelitas">Indices de Gestión</h4>
<table class="table table-striped table-bordered">
	@foreach($indices as $key => $indice)
	@if(substr( $key, 0, 2 ) != "t_")
	<tr>
		@if($key == 'rotacion_de_activos' || $key == 'rotacion_activo_fijo' || $key == 'rotacion_de_inventarios' || $key == 'rotacion_de_creditos' || $key == 'ebitda')
		<td rowspan="2" style="vertical-align:middle;">
		@else
		<td>
		@endif
		@if($key == 'prestamos_ventas')
			<span class="fw600">PRESTAMOS / (VENTAS/12)</span>
		@elseif($key == 'prestamos_pn')
			<span class="fw600">PRESTAMOS / P.N.</span>
		@elseif($key == 'ebitda')
			<span class="fw600">EBITDA / PASIVO</span>
		@elseif($key == 'rentabilidad')
			<span class="fw600">RENTABILIDAD S/ACTIVO</span>
		@elseif($key == 'liquidez_seca')
			<span class="fw600">LIQUIDEZ SECA (Acida)</span>
		@else
			<span class="fw600">{{ ucwords(str_replace('_',' ',$key))}}</span>
		@endif
		<br>
		@if(isset($indices["t_".$key])) <p style="font-size:10px">{{$indices["t_".$key][0]}}</p> @endif</td>
		
		@foreach($indice as $info)
			@if($key == 'rotacion_de_activos' || $key == 'rotacion_activo_fijo' || $key == 'rotacion_de_inventarios' || $key == 'rotacion_de_creditos' || $key == 'ebitda')
				<td><p style="font-size:10px">en veces / año</p>  {{number_format($info,2,',','.')}}</td>
			@else
				@if($key != 'fecha_balance')
				<td>{{number_format($info,2,',','.')}}</td>
				@else
				<td>{{$info}}</td>
				@endif
			@endif
		@endforeach
	</tr>
	@endif
	@if($key == 'rotacion_de_activos' || $key == 'rotacion_activo_fijo' || $key == 'rotacion_de_inventarios' || $key == 'rotacion_de_creditos' || $key == 'ebitda')

		<tr>
		@foreach($indices[$key] as $info)
				<td><p style="font-size:10px">en días</p>  @if($info != 0){{round(360/$info)}} @else 0.00 @endif</td>
		@endforeach
		</tr>	
	@endif

	@endforeach
</table>
@endif