D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
var
/
www
/
html
/
rosario
/
adm
/
app
/
gre
/
Views
/
Analise_Mix
/
Filename :
VieMixIqviaMapaExcel.php
back
Copy
<?php ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); ob_start(); $path = getcwd(); function mapped_implode($glue, $array, $symbol = '=') { return implode($glue, array_map( function($k, $v) use($symbol) { return $k . $symbol . $v; }, array_keys($array), array_values($array) ) ); } $Dados = $_GET; $Lanc = new \App\gre\Models\ModMixIqviaMapaLer(); $arr = $Lanc->lerLanc(); //var_dump($arr[0]); //die; $primeiro = 0; $total_linha = 0; $data_imp = date("d/m/Y H:i:s"); $dtxls = date("dmYHi"); $dtxls = date("Y_m_d H:i:s"); $arquivo = "MAPA DE MOLECULAS GENÉRICO IQVIA_"."$dtxls.xls"; header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header ("Last-Modified: " . gmdate("D,d M YH:i:s") . " GMT"); header ("Cache-Control: no-cache, must-revalidate"); header ("Pragma: no-cache"); header ("Content-type: application/x-msexcel"); header ("Content-Disposition: attachment; filename=\"{$arquivo}\"" ); header ("Content-Description: PHP Generated Data" ); ?> <html> <head> <meta http-equiv='Content-Type' content='text/html; charset=utf-8'/> </head> <?php $html = ""; $html .= "<table border='1'>"; $html .= "<tr>"; $html .="<td colspan='16' align='center'><b><font color='blue'>MAPA DE MOLECULAS GENERICO - IQVIA</td>"; $html .="</tr>"; $result = count($arr) -1; for ($i = 0; $i <= $result; $i++) { $d_nome = $arr[$i]['d_nome']; unset ($arr[$i]['d_nome']); $mensa= mapped_implode('-', $arr[$i], '*'); $fabr = explode('-', $mensa); if($primeiro == 0 ) { $num_fabr = count($fabr) -1; $html .="<tr>"; $html .="<td align='center'>MOLECULA</td>"; $html .="<td align='center'>Mix Rosario</td>"; $html .="<td align='center'>Total</td>"; for ($i1 = 0; $i1 <= $num_fabr; $i1++) { $nome_fabr = explode('*', $fabr[$i1]); $html .="<td align='center'>$nome_fabr[0]</td>"; } $html .="</tr>"; } $html .="<tr>"; $separa = explode('@',$d_nome); $html .="<td align='left'>$separa[1]</td>"; $html .="<td align='center'>$separa[0]</td>"; for ($i1 = 0; $i1 <= $num_fabr; $i1++) { $nome_fabr = explode('*', $fabr[$i1]); if($nome_fabr[1]<> ''){ $total_linha = $total_linha + $nome_fabr[1]; } } $html .="<td align='center'>$total_linha</td>"; for ($i1 = 0; $i1 <= $num_fabr; $i1++) { $nome_fabr = explode('*', $fabr[$i1]); $html .="<td align='center'>$nome_fabr[1]</td>"; } $total_linha = 0; $html .="</tr>"; $primeiro = 1; } $html .= "</table>"; $html .= "<br>"; echo $html; exit; ?> </html>