@if ( $_SERVER['REMOTE_ADDR'] == substr(env('URL_BASE'),7) )
	@include('led/led_header_dossier')
@endif
<!-- page break para version impresa -->
<div class="page-break"></div>
<div id="imagen_fidelitas_comerciales" class="text-start d-none" style="padding-bottom: 10px;"></div>
<div id="nombre_cuit_seccion_comex" class="d-none"></div>
<h4 id="titulo_seccion_comex" class="text-center titulo-fidelitas d-none mb-2 bg-fidelitas"></h4>  
@if (!$comex_impo && ( !$comex_totales || (!isset($comex_totales->total_impo) && (!$comex_totales->total_impo) && !isset($comex_totales->total_expo) && (!$comex_totales->total_expo))) && (!$comex_pais_impo))
    <div class="col-md-12 padding10">
        <p class="text-center titulo-fidelitas text-fidelitas border-top-fidleitas border-bottom-fidleitas mt-3 mb-2">@traducir('IMPORTACIONES','IMPORTACIONES')</p>
        <div class="text-center font15 py-5">  - @traducir('No se detectaron datos','No se detectaron datos') -</div>
    </div>
@else
    @if((isset($comex_totales->total_expo) && ($comex_totales->total_expo > 0)) or ((isset($comex_totales->total_impo) && ($comex_totales->total_impo > 0))))
        <div class="row padding10 mt20">
            <div class="col-md-1"></div>
            <div class="col-md-4">
                <div class ="padding10 bg-fidelitas text-center font15 ">
                @traducir('IMPORTACIONES','IMPORTACIONES')
                    <div>(@traducir('últimos','últimos') {{$meses}} @traducir('meses','meses'))</div>
                </div>
                <div class =" padding10 text-center" style="border:1px solid #eee;">
                    USD {{number_format($comex_totales->total_impo,0,'.',' ')}}
                </div>
            </div>
            <div class="col-md-2"></div>
            <div class="col-md-4">
                <div class ="padding10 bg-fidelitas text-center font15 ">
                    @traducir('EXPORTACIONES','EXPORTACIONES')
                    <div>(@traducir('últimos','últimos') {{$meses}} @traducir('meses','meses'))</div>
                </div>
                <div class =" padding10 text-center "  style="border:1px solid #eee;">
                    USD {{number_format($comex_totales->total_expo,0,'.',' ')}}
                </div>
            </div>
            <div class="col-md-1"></div>
        </div>
    @endif
	<!-- -->
	<div class="row justify-content-center">
		<div class="col-xl-4 my-2">
			<h4 class="text-center text-fidelitas border-fidelitas border-top border-bottom">@traducir('IMPORTACIONES','IMPORTACIONES')</h4>
		</div>
	</div>
	@if($comex_impo && $esled=='')
		<div class="row">
			<div class="col-xl-4 my-1">			
				<h4 class="text-start text-fidelitas border-fidelitas border-bottom my-2">@traducir('Importaciones (últimos 24 meses)','Importaciones (últimos 24 meses)')</h4>	
			</div>
		</div>
	@endif
	<!-- -->
    @if ($esled=='')
        <div class="col-md-12 col-sm-12 col-xs-12" >
            @if($grafico_impo_comex != '')
                <img src="{{$grafico_impo_comex}}" class="img-responsive center-block" style="width: 95%;" />
            @else
                <!-- <div id="impo_comex"></div> -->
                <canvas   id="impo_comex" class="impo_comex chartjs-render-monitor"></canvas>
            @endif
        </div>
    @endif
    <!-- -->
    @if($comex_impo && $esled=='')
        <div class="col-md-12">
            <div class="col-md-12">
                <div class="col-md-12"  >
                    <table  class="table table-striped" id="tabla_comex">
                        <thead class="thead">
                            <tr>
                            <th>@traducir('Período','Período')<br><span style="color:white;">@traducir('Periodo','Periodo')</span></th>
                            <th>@traducir('Consumo','Consumo')                  <br>
                                <span style="color: #369EAD;">: @if(isset($total_consumo)) {{ number_format($total_consumo,0,","," ") }} @endif</span>
                            </th>
                            <th>(F.O.B. U$S)  @traducir('Temporal','Temporal')   <br>
                                <span style="color:#C24642;">@traducir('Total','Total'): @if(isset($total_temporal)) {{ number_format($total_temporal,0,","," ") }} @endif</span>
                            </th>
                            <th>(F.O.B. U$S)  @traducir('Depósito','Depósito')   <br>
                                <span style="color:#7F6084;">@traducir('Total','Total'): @if(isset($total_deposito)) {{ number_format($total_deposito,0,","," ") }} @endif</span>
                            </th>
                            <th>(F.O.B. U$S)  @traducir('Zona Franca','Zona Franca')<br>
                                <span style="color:#86B402;">@traducir('Total','Total'): @if(isset($total_zonafranca)){{ number_format($total_zonafranca,0,","," ") }} @endif</span>
                            </th>
                            <th>(F.O.B. U$S)<br>
                                <span>@traducir('Total','Total'): @if(isset($total_totales)){{ number_format($total_totales,0,","," ") }} @endif</span>
                            </th>
                            </tr>
                        </thead>
                        <tbody class="text-start">
                            @foreach($comex_impo as $info)
                                <tr>
                                <td class="text-end">{{$info->mes}}/{{$info->anio}}</td>
                                <td class="text-end">{{number_format($info->consumo,0,","," ")}}</td>
                                <td class="text-end">{{number_format($info->temporal,0,","," ")}}</td>
                                <td class="text-end">{{number_format($info->deposito,0,","," ")}}</td>
                                <td class="text-end">{{number_format($info->zonafranca,0,","," ")}}</td>
                                <td class="text-end">{{number_format($info->total,0,","," ")}}</td>
                                </tr>
                            @endforeach
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    @endif
	<!--inicio Importaciones por pais --> 
	@if(isset($comex_pais_impo[0]) && $comex_pais_impo[0]->fob > 0)
		<div class="row my-2">
			<div class="col-xl-5 col-lg-6">
				<h4 class="text-center text-fidelitas border-fidelitas border-bottom">@traducir('Importaciones por País (últimos 24 meses)','Importaciones por País (últimos 24 meses)')</h4>
			</div>
		</div>
		<!-- -->
		<div class="row my-2"> 
			<div @if(Session::get('html')) class="col-md-12" @else class="col-md-7" @endif>
				<table class="table table-striped">
					<tr class="background-fidelitas">
						<th class="col-md-9">@traducir('País','País')</th>
						<th class="col-md-1 text-center">%</th>
						<th class="col-md-2 text-center">@traducir('Fob Total','Fob Total')</th>
					</tr>
					@foreach($comex_pais_impo as $key => $expo)
						<tr class="@if($expo->nombre == 'Totales') destacar-registro @endif">
							<td class="text-start comex_td"  >{{$expo->nombre or ''}}</td>
							<td class="text-center" >
								@if($expo->nombre!='Totales' && $expo->fob > 0)
								{{number_format(($expo->fob * 100) / $total_pais_impo,2)}}
								@endif
							</td>
							<td class="text-center"  >{{ number_format($expo->fob,0,',',' ')  }}</td>
						</tr>
					@endforeach
				</table>
				<div class="col-md-12 text-start">@traducir('Valores estadísticos aproximados','Valores estadísticos aproximados')</div>
			</div>
			<div @if(Session::get('html')) class="col-md-12" @else class="col-xl-5 col-lg-5" @endif>
				<div class="row">
					@if(Session::get('html'))
						<div class="col-md-12 text-center" ><img src="{{$grafico_pais_impo_comex}}"   style="width: 50% " /></div>
					@elseif($grafico_pais_impo_comex != '')
						<div class="col-md-12">
							<img src="{{$grafico_pais_impo_comex}}"  style="width: 250px;height: 250px" />
						</div>
					@else
						<div class="col-md-12">
							<canvas id="pais_impo" class=" chartjs-render-monitor" ></canvas>
						</div>
						<!-- <div class="col-md-4" id="pais_impo"></div> -->
					@endif
				</div>
			</div>
		</div>
	@else
		<div class="col-md-12">
			<div @if(Session::get('html')) class="text-center font15" @else class="text-center font15" @endif >- @traducir('No se detectaron datos','No se detectaron datos') -</div>
		</div> 
	@endif
	<!--fin Importaciones por pais -->
	<!--inicio RUBROS importaciones -->
	@if(isset($comex_rubro_impo[0]) && $comex_rubro_impo[0]->fob > 0)
		<div class="row my-2">
			<div class="col-xl-5 col-lg-6">
				<h4 class="text-center text-fidelitas border-fidelitas border-bottom">@traducir('Importaciones por Rubro (últimos 24 meses)','Importaciones por Rubro (últimos 24 meses)')</h4>
			</div>
		</div>
		<!-- -->
		<div class="row">
			<div @if(Session::get('html')) class="col-md-12" @else class="col-md-7" @endif>
				<table class="table table-striped">
					<tr class="background-fidelitas">
						<th class="col-md-7">@traducir('Nombre','Nombre')</th>
						<th class="col-md-2 text-center">@traducir('Posicion','Posicion')</th>
						<th class="col-md-1 text-center">%</th>
						<th class="col-md-2 text-center">@traducir('Fob Total','Fob Total')</th>
					</tr>
					@foreach($comex_rubro_impo as $key => $impo)
						<tr class="@if($impo->descripcion == 'Totales') destacar-registro @endif">
							<td class="col-md-6 text-start">
								<div class="truncate-ellipsis">
								<span>
									{{$impo->descripcion or ''}}
								</span>
								</div>
							</td>            
							<td class="col-md-2 text-center">{{$impo->posicion or ''}}</td>

							<td class="text-center ">
								@if($impo->descripcion != 'Totales')
								@if($impo->fob > 0)
									{{number_format(($impo->fob * 100) / $total_rubro_impo,2)}}
								@endif
								@endif
							</td>
							<!--   number_format($impo->fob,2,'.','') -->
							<td class="col-md-4 text-center">{{ number_format($impo->fob,0,',',' ')  }}</td>
						</tr>
					@endforeach
				</table>
				<div class="col-md-12 text-start">@traducir('Valores estadísticos aproximados','Valores estadísticos aproximados')</div>
			</div>
			@if(Session::get('html'))
				<div class="col-md-12 text-center"> <img src="{{$grafico_rubro_impo_comex}}"  style="width: 50%"  /></div>
			@elseif($grafico_rubro_impo_comex != '')
				<div class="col-md-5"> <img src="{{$grafico_rubro_impo_comex}}"  style="width: 250px;height: 250px"  /></div>
			@else
				<div class="col-md-5">
					<canvas id="rubros_impo" class="chartjs-render-monitor"></canvas>
				</div>
			@endif
		</div>
	@endif
	<!--fin RUBROS importaciones -->
@endif


@if (!$comex_expo)
    <div class="col-md-12 padding10">
        <p class="text-center titulo-fidelitas text-fidelitas border-top-fidleitas border-bottom-fidleitas">@traducir('EXPORTACIONES','EXPORTACIONES')</p>
        <div class="text-center font15 py-5">  - @traducir('No se detectaron datos','No se detectaron datos') -</div>
    </div>
@else
	<div class="row justify-content-center my-2">
		<div class="col-xl-4">
			<h4 class="text-center text-fidelitas border-fidelitas border-top border-bottom my-1">@traducir('EXPORTACIONES','EXPORTACIONES')</h4>  
			
		</div>
	</div>
	<!-- -->
	<div class="row">
		<div class="col-xl-4">
			<h4 class="text-start text-fidelitas border-fidelitas border-bottom my-1">@traducir('Exportaciones (últimos 24 meses)','Exportaciones (últimos 24 meses)')</h4>
		</div>
	</div>
	<!-- -->
    <div class="col-md-12">
		@if($grafico_expo_comex != '')
			<img src="{{$grafico_expo_comex}}"  class="img-responsive center-block" style="width: 95%;"/>
		@else
			<!-- <div  id="grafico_exportaciones_comex" ></div> -->
			<canvas id="expo_comex" class="expo_comex chartjs-render-monitor"></canvas>
		@endif
    </div>
	<!--inicio Exportaciones por pais -->
	<div class="row my-1">
		<div class="col-xl-4">
			<h4 class="text-center text-fidelitas border-fidelitas border-bottom">@traducir('Exportaciones (últimos 24 meses)','Exportaciones (últimos 24 meses)')</h4>
		</div>
	</div>
	<!-- -->
	@if($comex_pais_expo)
		<div class="row">
			<div @if(Session::get('html')) class="col-md-12" @else class="col-md-7" @endif>
				<table class="table table-striped">
					<tr class="background-fidelitas">
					<th class="col-md-9">País</th>
					<th class="col-md-1 text-center" >%</th>
					<th class="col-md-2 text-center">Fob Total</th>
					</tr>
				@foreach($comex_pais_expo as $key => $expo)
					<tr class="@if($expo->nombre == 'Totales') destacar-registro @endif">
					<td class="text-start comex_td"  ><span>{{$expo->nombre or ''}}</span></td>
					<td class="text-center" >
						@if($expo->nombre!='Totales')
						@if($expo->fob > 0)
							{{number_format(($expo->fob * 100) / $total_pais_expo,0,',',' ')}}
						@endif
						@endif
					</td>
					<td class="text-center">{{ number_format($expo->fob,0,',',' ')  }}</td>
					</tr>
				@endforeach
				</table>
				<div class="col-md-12 text-start">@traducir('Valores estadísticos aproximados','Valores estadísticos aproximados')</div>
			</div>
			@if(Session::get('html'))
				<div class="col-md-12 text-center">
					<img src="{{$grafico_pais_expo_comex}}" style="width: 50%" />
				</div>
			@elseif($grafico_pais_expo_comex != '')
				<div class="col-md-5">
					<img src="{{$grafico_pais_expo_comex}}" style="width: 250px;height: 250px" />
				</div>
			@else
				<div class="col-md-5">
					<canvas id="pais_expo" class="chartjs-render-monitor"></canvas>
				</div>
			@endif
		</div>  
	@else
		<div class="col-md-12">
			<div class="text-start font15">- @traducir('No se detectaron datos','No se detectaron datos') -</div>
		</div> 
	@endif
  	<!--fin Exportaciones por pais -->

	<!--inicio RUBROS exportaciones-->
	<div class="row">
		<div class="col-xl-5 my-1">  
			<h4 class="text-center text-fidelitas border-fidelitas border-bottom">@traducir('Exportaciones por Rubro (últimos 24 meses)','Exportaciones por Rubro (últimos 24 meses)')</h4>
		</div>
	</div>
	@if($comex_rubro_expo)
		<!-- -->
		<div class="row">
			<div @if(Session::get('html')) class="col-md-12" @else class="col-md-7" @endif >
				<table class="table table-striped">
					<tr class="background-fidelitas">
					<th class="col-md-7">@traducir('Nombre','Nombre')</th>
					<th class="col-md-2 text-center">@traducir('Posicion','Posicion')</th>
					<th class="col-md-1 text-center">%</th>
					<th class="col-md-2 text-center">@traducir('Fob Total','Fob Total')</th>
					</tr>
				@foreach($comex_rubro_expo as $key => $expo)
					<tr class="@if($expo->descripcion == 'Totales') destacar-registro @endif">
					<td class="col-md-6 text-left">
						<div class="truncate-ellipsis">
						<span>
							{{$expo->descripcion or ''}}
						</span>
						</div>
					</td>            
					<td class="col-md-2 text-center">{{$expo->posicion or ''}}</td>

					<td class="text-center">
						@if($expo->descripcion != 'Totales')
						@if($expo->fob > 0)
							{{number_format(($expo->fob * 100) / $total_rubro_expo,2)}}
						@endif
						@endif
					</td>
					
					<td class="col-md-4 text-center">{{ number_format($expo->fob,0,',',' ')  }}</td>

					</tr>
				@endforeach
				</table>
				<div class="col-md-12 text-left">@traducir('Valores estadísticos aproximados','Valores estadísticos aproximados')</div>
			</div>
			<!-- -->
			@if(Session::get('html'))
				<div class="col-md-12 text-center"> <img src="{{$grafico_rubro_expo_comex}}"  style="width: 50%"  /></div>
			@elseif($grafico_rubro_expo_comex != '')
				<div class="col-md-5"> <img src="{{$grafico_rubro_expo_comex}}"  style="width: 250px;height: 250px"  /></div>
			@else
				<div class="col-md-5">
					<canvas  id="rubros_expo" class=" chartjs-render-monitor"></canvas>
					<canvas  id="rubros_expo_led" class=" chartjs-render-monitor"></canvas>
				</div>
			@endif
		</div>
	@else
		<div class="row justify-content-center">
			<div class="col-xl-5">
				<div class="text-center font15">- @traducir('No se detectaron datos','No se detectaron datos') -</div>
			</div>
		</div>
	@endif
	</div>
@endif

@if ( $_SERVER['REMOTE_ADDR'] == substr(env('URL_BASE'),7) )
	@include('led/led_footer_dossier')
@endif
