D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
var
/
www
/
html
/
rosario
/
adm
/
app
/
gre
/
Views
/
Cotacao
/
Filename :
VieCtAgendaExcel.php
back
Copy
<?php ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); ob_start(); $path = getcwd(); //VAR_DUMP(URLFPDF); $Dados = $_GET; $Lanc = new \App\gre\Models\Cotacao\ModCtAgendaListar(); $arr = $Lanc->listarAgenda($Dados); var_dump($arr[0]); $colspan1 = 8; $colspan2 = 5; $colspan3 = 4; //var_dump($arr[0]); //die; if ($arr[0]['comp_sel'] == 0) { $comp_nome_sel = 'TODOS'; }else{ $comp_nome_sel = $arr[0]['comp_nome']; } if ($arr[0]['tipo_compra_sel'] == 0) { $tipo_nome = 'TODOS'; }else{ $tipo_nome = $arr[0]['tipo_nome']; } $datai = date('d/m/Y', strtotime($arr[0]['datai_sel'])); $dataf = date('d/m/Y', strtotime($arr[0]['dataf_sel'])); //var_dump($datai); //var_dump($dataf); $myfile = "C:/Cotacao/Rosario"; // checking whether a file is directory or not //if (is_dir($myfile)) { // echo ("$myfile is a directory"); //}else{ // echo ("$myfile is not a directory"); mkdir('C:/Cotacao/Rosario', 0777, true); //} //die; $cabec = "Agenda de Cotação período de: ". $datai ." à ". $dataf; $marca_nome = $arr[0]['marca_nome']; $dtxls = date("dmYHi"); $arquivo = "AGENDA DE COTAÇÃO"."_"."$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" ); $colspan1 = 9; ?> <html> <head> <meta http-equiv='Content-Type' content='text/html; charset=utf-8'/> </head> <?php $html = ""; $html .= "<table border='1'>"; $html .= "<tr>"; if ($arr[0]['comp_sel'] == 0 and $arr[0]['tipo_compra_sel'] == 0) { $html .="<td colspan='10' align='center'><b><font color='blue'>$cabec</td>"; $html .="</tr>"; $html .= "<tr>"; $html .="<td colspan='5' align='center'><b><font color='blue'>Comprador: $comp_nome_sel</td>"; $html .="<td colspan='5' align='center'><b><font color='blue'>Tipo: $tipo_nome</td>"; $html .="</tr>"; } if ($arr[0]['comp_sel'] <> 0 and $arr[0]['tipo_compra_sel'] == 0) { $html .="<td colspan='9' align='center'><b><font color='blue'>$cabec </td>"; $html .="</tr>"; $html .= "<tr>"; $html .="<td colspan='9' align='center'><b><font color='blue'>Comprador: $comp_nome_sel</td>"; $html .="</tr>"; } if ($arr[0]['comp_sel'] == 0 and $arr[0]['tipo_compra_sel'] <> 0) { $html .="<td colspan='9' align='center'><b><font color='blue'>$cabec </td>"; $html .="</tr>"; $html .= "<tr>"; $html .="<td colspan='9' align='center'><b><font color='blue'>Tipo: $tipo_nome</td>"; $html .="</tr>"; } if ($arr[0]['comp_sel'] <> 0 and $arr[0]['tipo_compra_sel'] <> 0) { $html .="<td colspan='8' align='center'><b><font color='blue'>$cabec </td>"; $html .="<tr>"; $html .="<td colspan='4' align='center'><b><font color='blue'>Comprador: $comp_nome_sel</td>"; $html .="<td colspan='4' align='center'><b><font color='blue'>Tipo: $tipo_nome</td>"; $html .="</tr>"; } $html .="<tr>"; $html .="<td align='center'><b>Cod.Marca</td>"; $html .="<td align='center'><b>Marca</td>"; if ($arr[0]['tipo_compra_sel'] == 0) { $html .="<td align='center'><b>Tipo Compra</td>"; } if ($arr[0]['comp_sel'] == 0) { $html .="<td align='center'><b>Comprador</td>"; } $html .="<td align='center'><b>Marca Própria</td>"; $html .="<td align='center'><b>Prazo</td>"; $html .="<td align='center'><b>Ped Mínimo</td>"; $html .="<td align='center'><b>Frequencia</td>"; $html .="<td align='center'><b>Dia Semana</td>"; $html .="<td align='center'><b>Data Cotação</td>"; $html .="</tr>"; foreach ($arr as $lcto) { extract($lcto); $marca_id = number_format($marca_id,0,',','.'); $html .="<tr>"; $html .="<td align='right'> $marca_id</td>"; $html .="<td align='left'> $marca_nome</td>"; if ($tipo_compra_sel == 0) { $html .="<td align='left'> $tipo_nome</td>"; } if ($comp_sel == 0) { $html .="<td align='left'> $comp_nome</td>"; } $html .="<td align='center'> $marca_propria</td>"; $html .="<td align='center'> $prazo</td>"; $html .="<td align='right'> $ped_minimo</td>"; $html .="<td align='center'> $per_nome</td>"; $html .="<td align='center'> $dia_semana_agendado</td>"; $html .="<td align='center'> $data_cotacao</td>"; $html .="</tr>"; } $html .= "</table>"; $html .= "<br>"; echo $html; exit; ?> </html>