/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { Dados::destroy($id); Session::flash('flash_message', 'Dados successfully deleted!'); return redirect('dados'); }
use NFePHP\Common\Files\FilesFolders; use NFePHP\Common\Exception\InvalidArgumentException; //carrega os dados de configuração $configJson = FilesFolders::readFile('../config/config.json'); $objConfig = json_decode($configJson); //estabelece o ambiente $ambiente = 'homologacao'; if ($objConfig->tpAmb == '1') { $ambiente = 'producao'; } //cria uma lista vazia $aList = array(); $caminho = 'recebidas' . DIRECTORY_SEPARATOR . 'resumo'; $path = $objConfig->pathNFeFiles . DIRECTORY_SEPARATOR . $ambiente . DIRECTORY_SEPARATOR . $caminho; try { $aList = FilesFolders::listDir($path, '*.xml', true); } catch (InvalidArgumentException $exc) { $mensagem = $exc->getMessage(); } $aDados = Dados::extraiResumo($aList); $lista = '<form>'; $lista .= '<table width="75%"><thead><tr><th></th><th class=\\"border\\" data-sort=\\"int\\">NFe Número</th><th class=\\"border\\" data-sort=\\"string\\">Emitente</th><th class=\\"border\\" data-sort=\\"string\\">Data</th><th>Valor</th></tr></thead><tbody>'; $iCount = 0; foreach ($aDados as $res) { $chkChave = "chk"; $lista .= '<tr class=\\"dados\\">' . '<td><input type="checkbox" name="' . $chkChave . '" id="' . $chkChave . '" value="' . $res['chNFe'] . '" ></td>' . '<td class="center">' . substr($res['chNFe'], 25, 9) . '</td>' . '<td class="left">' . $res['xNome'] . '</td>' . '<td class="center">' . $res['dhEmi'] . '</td>' . '<td class="right">R$ ' . number_format($res['vNF'], 2, ',', '.') . '</td>' . '</tr>'; } $lista .= '<tr><td colspan="4"><input type="button" value="Manifestar" onClick="manifestar();"></td></tr>'; $lista .= '</tbody></table></form>'; $html = "<!DOCTYPE html>\n<html>\n <head>\n <title>Resumos das Notas Fiscais</title>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <script src=\"http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js\"></script>\n <script src=\"resources/stupidtable.js?dev\"></script>\n <link rel=\"stylesheet\" type=\"text/css\" href=\"css/teste.css\">\n <script>\n \$(function() {\n //Helper function para valores formatados em R\$\n var valor_from_string = function(str) {\n var newstr = str.replace(/(\\t*) */g, '');\n newstr = newstr.replace(/[A-Z]/g, '');\n newstr = newstr.replace(/[\$]/g, '');\n newstr = newstr.replace(/\\./g, '');\n newstr = newstr.replace(/[,]/g, '.');\n var valor = parseInt(newstr)*100;\n return valor;\n }\n var table = \$(\"table\").stupidtable({\n \"valor\": function(a,b) {\n // Get these into int objects for comparison.\n aVal = valor_from_string(a);\n bVal = valor_from_string(b);\n return aVal - bVal;\n }\n });\n table.on(\"beforetablesort\", function (event, data) {\n // Apply a \"disabled\" look to the table while sorting.\n // Using addClass for testing as it takes slightly longer to render.\n \$(\"#msg\").text(\"Organizando a tabela ...\");\n \$(\"table\").addClass(\"disabled\");\n });\n table.on(\"aftertablesort\", function (event, data) {\n // Reset loading message.\n \$(\"#msg\").html(\" \");\n \$(\"table\").removeClass(\"disabled\");\n var th = \$(this).find(\"th\");\n th.find(\".arrow\").remove();\n var dir = \$.fn.stupidtable.dir;\n var arrow = data.direction === dir.ASC ? \"↑\" : \"↓\";\n th.eq(data.column).append('<span class=\"arrow\">' + arrow +'</span>');\n });\n }); \n </script>\n <script>\n function OpenWindowWithPost(url, windowoption, name, params) {\n var form = document.createElement(\"form\");\n form.setAttribute(\"method\", \"post\");\n form.setAttribute(\"action\", url);\n form.setAttribute(\"target\", name);\n for (var i in params) {\n if (params.hasOwnProperty(i)) {\n var input = document.createElement('input');\n input.type = 'hidden';\n input.name = i;\n input.value = params[i];\n form.appendChild(input);\n }\n }\n document.body.appendChild(form);\n window.open(\"\", name, windowoption);\n form.submit();\n document.body.removeChild(form);\n }\n function manifestar() {\n var url = 'manifestarmarcadas.php';\n var name = 'page';\n var lista = [];\n var x = 0;\n var specs = 'scrollbars=no,menubar=no,height=260,width=650,resizable=yes,toolbar=no,status=no';\n var checkboxes = document.getElementsByName('chk');\n for (var i= 0; i < checkboxes.length; i++) {\n if (checkboxes[i].checked) {\n lista[x] = checkboxes[i].value;\n x++;\n }\n }\n var param = {'lista' : lista};\n OpenWindowWithPost(url, specs, name, param);\t\t\n }\n </script>\n </head>\n <body>\n <div class=\"container\">\n <center>\n <h2>Resumos de Notas</h2>\n <h3>Estas notas foram emitidas contra nós e podem ser maifestadas para permitir seu download</h3>\n <h3>Selecione e manifeste a ciencia dessa operação.</h3>\n {$lista}\n </center> \n </div>\n </body>\n</html>"; echo $html;
$caminho = 'enviadas' . DIRECTORY_SEPARATOR; $chkEnviadas = 'SELECTED '; } else { $caminho = 'recebidas' . DIRECTORY_SEPARATOR . $ano . $mes; $chkRecebidas = 'SELECTED '; } $aList = array(); $mensagem = ''; $titulo .= " {$mes}/{$ano}"; $path = $objConfig->pathNFeFiles . DIRECTORY_SEPARATOR . $ambiente . DIRECTORY_SEPARATOR . $caminho; try { $aList = FilesFolders::listDir($path, '*.xml', true); } catch (InvalidArgumentException $exc) { $mensagem = $exc->getMessage(); } $aDados = Dados::extrai($aList, $objConfig->cnpj); $numNF = count($aDados['aNF']); $numCanc = Dados::$nCanc; $dias = Dates::diasUteis($mes, $ano); $media = round($numNF / $dias, 0); $htmlMsgPasta = "<i>Total de {$numNF} notas no mês {$mes}. " . "{ {$numCanc} notas canceladas} [ {$media} NFe/dia (até hoje {$hoje}) " . "e {$dias} dias úteis no mês.]</i>"; } $selPasta = "<select size=\"1\" name=\"pasta\" id=\"pasta\">\n <option " . $chkEnviadas . "value=\"ENVIADAS\">ENVIADAS</option>\n <option " . $chkAprovadas . "value=\"APROVADAS\">APROVADAS</option>\n <option " . $chkRecebidas . "value=\"RECEBIDAS\">RECEBIDAS</option>\n</select>"; $htmlNotas = ""; $i = 0; $totFat = number_format($aDados['totFat'], '2', ',', '.'); $totIcms = number_format($aDados['totIcms'], '2', ',', '.'); $totPeso = number_format($aDados['totPeso'], '2', ',', '.'); $fatMedio = round($aDados['totFat'] / $dias); $fatMedioTxt = number_format($fatMedio, '2', ',', '.'); $fatProj = number_format($aDados['totFat'], '2', ',', '.');