Path: C:\
<?php
date_default_timezone_set('America/Sao_Paulo');
$dateadded = date("d-m-Y");
ini_set('max_execution_time', 300); //300 seconds = 5 minutes
$erro='Sem Erro';$achou='S';$a=0;
?>
<!DOCTYPE html>
<html lang='pt-br'>
<head>
<meta charset='utf-8'/>
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="Expires" content="0" />
<meta content='width=device-width, initial-scale=1, maximum-scale=1' name='viewport'>
<title>TransWar</title>
<link rel='icon' type='image/png' href='images/favicon.ico'>
<link href="css/estilo.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="css/redmond/jquery-ui-1.10.1.custom.css" />
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/bootstrap-theme.min.css" rel="stylesheet">
<link href="css/theme.css" rel="stylesheet">
<link href="css/signin.css" rel="stylesheet">
<script src='js/jquery.min.js'></script>
<script src="js/ie-emulation-modes-warning.js"></script>
</head>
<body role='document'>
<table width="100%">
<tr>
<td align='center'>
<h2><span class="label label-primary"> Controle Diário de Entregas : <span style='color: Yellow;'>Provider</span></span></h2>
</td>
</tr>
<tr>
<td height="30" colspan="2" background="images/top-menubg.gif"> <?php echo $dateadded; ?></td>
</tr>
</table>
<div class='panel panel-primary'>
<table class="table table-bordered">
<tbody>
<?php
if (isset($_POST['del']))
{ $arqxlsx="Controle Provider.xlsx";
$u = count($_POST['chave']);
$n = count($_POST['del']);
for ($d=0; $d<$n; $d++)
{ $nf=$_POST['del'][$d];
for ($i=0; $i<$u; $i++)
{
if ($nf==$i)
{ $chave=$_POST['chave'][$nf];$nrNF=$_POST['nrNF'][$nf];
$coletaX[$d]=$_POST['coleta'][$nf];
$horaX[$d]=$_POST['hora'][$nf];
$nrNFX[$d]=$_POST['nrNF'][$nf];
$fornecedorX[$d]=$_POST['fornecedor'][$nf];
$pedidoX[$d]=$_POST['pedido'][$nf];
$chaveX[$d]=$_POST['chave'][$nf];
$valorX[$d]=$_POST['valor'][$nf];
$volumeX[$d]=$_POST['volume'][$nf];
$origemX[$d]=$_POST['origem'][$nf];
$destinoX[$d]=$_POST['destino'][$nf];
$embalagemX[$d]=$_POST['embalagem'][$nf];
include "consulta1.php";
header('Content-Type: text/html; charset=utf-8');
if ($achou=='S'){$texto='➔ OK';$a++;$dow[$a]="nf-".$nrNF.".pdf";}else{$texto='com Chave➔ '.$chave.'➔ Não Encontrado';}
echo '<tr><td align="left">PDF da Nota Fiscal '.$_POST['nrNF'][$nf].$texto.'</td></tr>';
break;
}
}
}
include 'liberaXLSXprovider.php';
if ($a>=1){
$arqzip='Controle Provider.zip';
$files_to_zip = $dow;$overwrite=false;
if(file_exists($arqzip)) { $overwrite=true; }
$diretorio = getcwd().'/NotasPDF/';
// Instancia a Classe Zip
$zip = new ZipArchive();
// Cria o Arquivo Zip, caso não consiga exibe mensagem de erro e finaliza script
if($zip->open($arqzip,$overwrite ? ZIPARCHIVE::OVERWRITE : ZIPARCHIVE::CREATE) !== true)
{ exit('O Arquivo ZIP não pode ser criado.');}
else
{ // Insere os arquivos que devem conter no arquivo zip
foreach($files_to_zip as $file)
{$zip->addFile($diretorio.$file,$file);}
}
$zip->addFile($diretorio.$arqxlsx,$arqxlsx);
// Fecha arquivo Zip aberto
$zip->close();
echo"<form method='POST' action=''>
<tr><td align='center'>
<button type='submit' class='btn btn-warning'><a href='Controle Provider.zip' download>Baixar ZIP</a></button>
</td></tr>
</form>";}
}
?>
</tbody>
</table>
</div>
<p class="copyright" align="center">© Copyright 2018 TransWar - Todos os direitos reservados. Versão 1.0</p>
<br />
<script src="js/bootstrap.min.js"></script>
<script src="js/jquery-1.9.1.js" type="text/javascript"></script>
<script src="js/jquery-ui.js" type="text/javascript"></script>
<script src="js/docs.min.js"></script>
<script src="js/ie10-viewport-bug-workaround.js"></script>
</body>
</html>