rellyon / index.html
maralvic's picture
Add 3 files
97aca1c verified
<!DOCTYPE html>
<html lang="pt-BR">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Relatório MVICENTE Advocacia - LYON CORRETORA</title>
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.18.5/xlsx.full.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/FileSaver.js/2.0.5/FileSaver.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.4.1/html2canvas.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
@page {
size: A4;
margin: 10mm;
}
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
.blue-gradient {
background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
}
.scrollable-table-container {
position: relative;
overflow: auto;
max-height: 70vh;
}
.scrollable-table {
overflow: visible;
}
.sticky-header th {
position: sticky;
top: 0;
z-index: 10;
background-color: #1e40af;
color: white;
text-align: center;
vertical-align: middle;
}
.hover-row:hover {
background-color: #f0f9ff;
}
.text-xxs {
font-size: 0.65rem;
}
.rotate-text {
writing-mode: vertical-rl;
transform: rotate(180deg);
white-space: nowrap;
}
.monetary {
text-align: right;
font-family: 'Courier New', monospace;
}
.row-page {
width: 210mm;
height: 297mm;
padding: 15mm;
box-sizing: border-box;
background: white;
margin: 0 auto;
box-shadow: 0 0 5px rgba(0,0,0,0.1);
position: relative;
overflow: hidden;
}
.row-table {
width: 100%;
border-collapse: collapse;
margin-bottom: 10px;
}
.row-table th {
background-color: #1e40af;
color: white;
text-align: left;
padding: 8px;
font-size: 12px;
width: 30%;
}
.row-table td {
border: 1px solid #ddd;
padding: 8px;
font-size: 12px;
width: 70%;
}
.row-table tr:nth-child(even) {
background-color: #f8fafc;
}
@media print {
body * {
visibility: hidden;
}
#printableArea, #printableArea * {
visibility: visible;
}
#printableArea {
position: absolute;
left: 0;
top: 0;
width: 100%;
}
.no-print {
display: none !important;
}
.row-page {
page-break-after: always;
box-shadow: none;
margin: 0;
padding: 15mm;
}
}
.hidden-row-pages {
position: absolute;
left: -9999px;
top: -9999px;
width: 210mm;
height: 297mm;
}
.cda-list {
max-height: 80px;
overflow-y: auto;
padding: 4px;
border: 1px solid #e2e8f0;
border-radius: 4px;
background-color: #f8fafc;
}
.cda-item {
padding: 2px 0;
font-size: 0.75rem;
border-bottom: 1px solid #e2e8f0;
}
.cda-item:last-child {
border-bottom: none;
}
.summary-card {
transition: all 0.3s ease;
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}
.summary-card:hover {
transform: translateY(-2px);
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}
.progress-bar {
height: 6px;
border-radius: 3px;
background-color: #e2e8f0;
overflow: hidden;
}
.progress-value {
height: 100%;
background-color: #3b82f6;
transition: width 0.5s ease;
}
.tooltip {
position: relative;
display: inline-block;
}
.tooltip .tooltip-text {
visibility: hidden;
width: 200px;
background-color: #1e40af;
color: #fff;
text-align: center;
border-radius: 6px;
padding: 5px;
position: absolute;
z-index: 1;
bottom: 125%;
left: 50%;
margin-left: -100px;
opacity: 0;
transition: opacity 0.3s;
font-size: 0.8rem;
}
.tooltip:hover .tooltip-text {
visibility: visible;
opacity: 1;
}
.badge {
display: inline-block;
padding: 0.25em 0.5em;
font-size: 0.75em;
font-weight: 600;
line-height: 1;
text-align: center;
white-space: nowrap;
vertical-align: baseline;
border-radius: 0.25rem;
}
.badge-primary {
color: #fff;
background-color: #3b82f6;
}
.badge-success {
color: #fff;
background-color: #10b981;
}
.badge-warning {
color: #fff;
background-color: #f59e0b;
}
.badge-danger {
color: #fff;
background-color: #ef4444;
}
.badge-info {
color: #fff;
background-color: #06b6d4;
}
/* Password protection styles */
#password-protection {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.8);
display: flex;
justify-content: center;
align-items: center;
z-index: 9999;
}
.password-box {
background-color: white;
padding: 2rem;
border-radius: 0.5rem;
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
max-width: 400px;
width: 90%;
text-align: center;
}
.password-box h2 {
color: #1e40af;
margin-bottom: 1.5rem;
font-size: 1.5rem;
}
.password-input {
width: 100%;
padding: 0.75rem;
border: 2px solid #e2e8f0;
border-radius: 0.375rem;
font-size: 1rem;
margin-bottom: 1rem;
transition: border-color 0.2s;
}
.password-input:focus {
outline: none;
border-color: #3b82f6;
}
.password-btn {
background-color: #3b82f6;
color: white;
border: none;
padding: 0.75rem 1.5rem;
border-radius: 0.375rem;
font-size: 1rem;
cursor: pointer;
transition: background-color 0.2s;
width: 100%;
}
.password-btn:hover {
background-color: #2563eb;
}
.error-message {
color: #ef4444;
margin-top: 0.5rem;
font-size: 0.875rem;
display: none;
}
.table-cell {
white-space: normal !important;
word-wrap: break-word;
}
.table-cell.cda-cell {
white-space: nowrap !important;
overflow-x: auto;
}
</style>
</head>
<body class="bg-gray-50 text-gray-800">
<!-- Password Protection -->
<div id="password-protection">
<div class="password-box">
<h2>Acesso Restrito</h2>
<p class="mb-4 text-gray-600">Por favor, insira a senha para acessar este relatório</p>
<input type="password" id="password-input" class="password-input" placeholder="Digite a senha">
<p id="error-message" class="error-message">Senha incorreta. Tente novamente.</p>
<button id="password-btn" class="password-btn">
<i class="fas fa-lock mr-2"></i> Acessar
</button>
</div>
</div>
<!-- Main Content (hidden until password is entered) -->
<div id="mainContent" class="hidden">
<div id="printableArea" class="max-w-7xl mx-auto p-6 bg-white shadow-lg rounded-lg">
<!-- Header -->
<header class="blue-gradient text-white rounded-t-lg p-6 mb-6">
<div class="flex flex-col">
<div class="flex justify-between items-start mb-4">
<div>
<div class="flex items-center">
<div class="bg-white p-2 rounded-lg mr-4">
<svg xmlns="http://www.w3.org/2000/svg" class="h-12 w-12 text-blue-600" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z" />
</svg>
</div>
<div>
<h1 class="text-3xl font-bold">MVICENTE ADVOCACIA</h1>
<h2 class="text-xl mt-2">RELATÓRIO DE NEGOCIAÇÕES TRIBUTÁRIAS ATIVAS</h2>
</div>
</div>
</div>
<div class="text-right">
<div class="text-xl font-semibold">
<i class="fas fa-calendar-alt mr-2"></i>
<span id="current-date"></span>
</div>
<div class="mt-2 text-sm bg-blue-700 px-3 py-1 rounded-full inline-block">
<i class="fas fa-lock mr-1"></i> CONFIDENCIAL
</div>
</div>
</div>
<div class="bg-blue-700 p-3 rounded-lg flex items-center">
<div class="mr-3">
<svg xmlns="http://www.w3.org/2000/svg" class="h-8 w-8 text-blue-200" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 21V5a2 2 0 00-2-2H7a2 2 0 00-2 2v16m14 0h2m-2 0h-5m-9 0H3m2 0h5M9 7h1m-1 4h1m4-4h1m-1 4h1m-5 10v-5a1 1 0 011-1h2a1 1 0 011 1v5m-4 0h4" />
</svg>
</div>
<div>
<p class="font-medium">LYON CORRETORA DE SEGUROS LTDA.</p>
<p class="text-blue-200 text-sm">55.223.077/0001-12</p>
</div>
</div>
</div>
</header>
<!-- Summary Cards -->
<div class="grid grid-cols-1 md:grid-cols-4 gap-4 mb-6 no-print">
<div class="summary-card bg-blue-50 border-l-4 border-blue-500 p-4 rounded-lg relative">
<div class="absolute top-2 right-2">
<span class="badge badge-primary">DÍVIDA</span>
</div>
<h3 class="text-xs font-semibold text-blue-800 uppercase">Valor Total Dívida</h3>
<p class="text-2xl font-bold text-blue-900 monetary">R$ 374.709,11</p>
<div class="mt-2">
<div class="flex justify-between text-xs text-blue-600">
<span>Consolidado</span>
<span>60.2%</span>
</div>
<div class="progress-bar mt-1">
<div class="progress-value" style="width: 60.2%"></div>
</div>
</div>
</div>
<div class="summary-card bg-green-50 border-l-4 border-green-500 p-4 rounded-lg relative">
<div class="absolute top-2 right-2">
<span class="badge badge-success">CONSOLIDAÇÃO</span>
</div>
<h3 class="text-xs font-semibold text-green-800 uppercase">Valor Consolidado</h3>
<p class="text-2xl font-bold text-green-900 monetary">R$ 225.395,20</p>
<div class="mt-2">
<div class="flex justify-between text-xs text-green-600">
<span>Desconto</span>
<span>39.8%</span>
</div>
<div class="progress-bar mt-1">
<div class="progress-value bg-green-500" style="width: 39.8%"></div>
</div>
</div>
</div>
<div class="summary-card bg-yellow-50 border-l-4 border-yellow-500 p-4 rounded-lg relative">
<div class="absolute top-2 right-2">
<span class="badge badge-warning">ECONÔMICO</span>
</div>
<h3 class="text-xs font-semibold text-yellow-800 uppercase">Desconto Total</h3>
<p class="text-2xl font-bold text-yellow-900 monetary">R$ 149.313,91</p>
<div class="mt-2">
<div class="flex justify-between text-xs text-yellow-600">
<span>Benefício</span>
<span>100%</span>
</div>
<div class="progress-bar mt-1">
<div class="progress-value bg-yellow-500" style="width: 100%"></div>
</div>
</div>
</div>
<div class="summary-card bg-indigo-50 border-l-4 border-indigo-500 p-4 rounded-lg relative">
<div class="absolute top-2 right-2">
<span class="badge badge-info">FLUXO</span>
</div>
<h3 class="text-xs font-semibold text-indigo-800 uppercase">Valor Entrada</h3>
<p class="text-2xl font-bold text-indigo-900 monetary">R$ 18.409,32</p>
<div class="mt-2">
<div class="flex justify-between text-xs text-indigo-600">
<span>Saldo</span>
<span>91.8%</span>
</div>
<div class="progress-bar mt-1">
<div class="progress-value bg-indigo-500" style="width: 8.2%"></div>
</div>
</div>
</div>
</div>
<!-- Filters (hidden in print) -->
<div class="mb-4 no-print">
<div class="flex flex-col md:flex-row md:items-center md:justify-between bg-gray-100 p-3 rounded-lg">
<div class="mb-2 md:mb-0">
<label for="search" class="block text-sm font-medium text-gray-700 mb-1">Buscar:</label>
<div class="relative">
<input type="text" id="search" placeholder="Pesquisar por conta, CDA..."
class="pl-8 pr-4 py-2 border border-gray-300 rounded-lg w-full md:w-64 focus:ring-blue-500 focus:border-blue-500">
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
<i class="fas fa-search text-gray-400"></i>
</div>
</div>
</div>
<div class="flex space-x-2">
<div>
<label for="modalidade" class="block text-sm font-medium text-gray-700 mb-1">Modalidade:</label>
<select id="modalidade" class="pl-3 pr-8 py-2 border border-gray-300 rounded-lg focus:ring-blue-500 focus:border-blue-500">
<option value="">Todas</option>
<option value="Lei 12.996/2014">Lei 12.996/2014</option>
<option value="0014">0014 - PERT</option>
</select>
</div>
<div>
<label for="status" class="block text-sm font-medium text-gray-700 mb-1">Status:</label>
<select id="status" class="pl-3 pr-8 py-2 border border-gray-300 rounded-lg focus:ring-blue-500 focus:border-blue-500">
<option value="">Todos</option>
<option value="deferida">Deferida e Consolidada</option>
<option value="parcelamento">Em Parcelamento</option>
</select>
</div>
</div>
</div>
</div>
<!-- Main Table (hidden in print) -->
<div class="mb-8 no-print">
<div class="flex flex-col md:flex-row md:justify-between md:items-center mb-4">
<h2 class="text-xl font-semibold text-blue-900 mb-2 md:mb-0">
<i class="fas fa-table mr-2"></i>Detalhamento das Transações
</h2>
<div class="flex flex-col sm:flex-row sm:space-x-2 space-y-2 sm:space-y-0">
<button onclick="exportToPDF()" class="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg text-sm font-medium flex items-center justify-center">
<i class="fas fa-file-pdf mr-2"></i>Exportar PDF
</button>
<button onclick="exportToExcel()" class="bg-green-600 hover:bg-green-700 text-white px-4 py-2 rounded-lg text-sm font-medium flex items-center justify-center">
<i class="fas fa-file-excel mr-2"></i>Exportar Excel
</button>
<button onclick="printReport()" class="bg-gray-600 hover:bg-gray-700 text-white px-4 py-2 rounded-lg text-sm font-medium flex items-center justify-center">
<i class="fas fa-print mr-2"></i>Imprimir
</button>
</div>
</div>
<div class="scrollable-table-container">
<table class="min-w-full divide-y divide-gray-200 border border-gray-200 scrollable-table">
<thead class="bg-blue-600 text-white sticky-header">
<tr>
<th class="px-3 py-3 text-xs font-semibold uppercase tracking-wider text-center">REF</th>
<th class="px-3 py-3 text-xs font-semibold uppercase tracking-wider text-center">CONTA</th>
<th class="px-3 py-3 text-xs font-semibold uppercase tracking-wider text-center">MODAL</th>
<th class="px-3 py-3 text-xs font-semibold uppercase tracking-wider text-center">SUBMOD</th>
<th class="px-3 py-3 text-xs font-semibold uppercase tracking-wider text-center">SITUAÇÃO</th>
<th class="px-3 py-3 text-xs font-semibold uppercase tracking-wider text-center">N. CDA</th>
<th class="px-3 py-3 text-xs font-semibold uppercase tracking-wider text-center">DÍVIDA</th>
<th class="px-3 py-3 text-xs font-semibold uppercase tracking-wider text-center">CONSOL</th>
<th class="px-3 py-3 text-xs font-semibold uppercase tracking-wider text-center">% DESC</th>
<th class="px-3 py-3 text-xs font-semibold uppercase tracking-wider text-center">V. DESC</th>
<th class="px-3 py-3 text-xs font-semibold uppercase tracking-wider text-center">Q PREST TOTAL</th>
<th class="px-3 py-3 text-xs font-semibold uppercase tracking-wider text-center">% ENT</th>
<th class="px-3 py-3 text-xs font-semibold uppercase tracking-wider text-center">V. ENT</th>
<th class="px-3 py-3 text-xs font-semibold uppercase tracking-wider text-center">Q PREST ENT</th>
<th class="px-3 py-3 text-xs font-semibold uppercase tracking-wider text-center">V. PREST ENT</th>
<th class="px-3 py-3 text-xs font-semibold uppercase tracking-wider text-center">V. PREST ENT 1</th>
<th class="px-3 py-3 text-xs font-semibold uppercase tracking-wider text-center">V. PREST ENT F</th>
<th class="px-3 py-3 text-xs font-semibold uppercase tracking-wider text-center">V. SALDO</th>
<th class="px-3 py-3 text-xs font-semibold uppercase tracking-wider text-center">Q PREST SALDO</th>
<th class="px-3 py-3 text-xs font-semibold uppercase tracking-wider text-center">V. PREST SALDO</th>
<th class="px-3 py-3 text-xs font-semibold uppercase tracking-wider text-center">V. PREST SALDO 1</th>
<th class="px-3 py-3 text-xs font-semibold uppercase tracking-wider text-center">V. PREST SALDO F</th>
<th class="px-3 py-3 text-xs font-semibold uppercase tracking-wider text-center">V. PREST ATUAL</th>
<th class="px-3 py-3 text-xs font-semibold uppercase tracking-wider text-center">ORIENTAÇÃO</th>
<th class="px-3 py-3 text-xs font-semibold uppercase tracking-wider text-center no-print">AÇÕES</th>
</tr>
</thead>
<tbody class="bg-white divide-y divide-gray-200" id="tableBody">
<!-- Rows will be generated here -->
</tbody>
</table>
</div>
</div>
<!-- Individual Row Pages (hidden on screen, visible in print) -->
<div id="rowPages" class="hidden-row-pages">
<!-- Row pages will be generated here -->
</div>
<!-- Footer -->
<footer class="blue-gradient text-white rounded-b-lg p-4 text-center text-sm">
<div class="flex flex-col md:flex-row md:justify-between items-center">
<div class="mb-2 md:mb-0">
<p>MVICENTE Advocacia - Relatório gerado em <span id="current-date-footer"></span></p>
</div>
<div>
<p class="text-blue-100">Este documento é confidencial e destinado exclusivamente ao uso da diretoria</p>
</div>
<div class="mt-2 md:mt-0">
<span class="bg-blue-700 px-3 py-1 rounded-full text-xs">
<i class="fas fa-shield-alt mr-1"></i> Documento protegido
</span>
</div>
</div>
</footer>
</div>
</div>
<!-- Modal for detailed view -->
<div id="detailModal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 hidden">
<div class="bg-white rounded-lg shadow-xl max-w-4xl w-full max-h-screen overflow-y-auto">
<div class="flex justify-between items-center border-b border-gray-200 px-6 py-4">
<h3 class="text-xl font-semibold text-gray-800">Detalhes da Negociação</h3>
<button onclick="closeModal()" class="text-gray-500 hover:text-gray-700">
<i class="fas fa-times"></i>
</button>
</div>
<div class="p-6" id="modalContent">
<!-- Modal content will be loaded here -->
</div>
<div class="border-t border-gray-200 px-6 py-4 flex justify-end">
<button onclick="closeModal()" class="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg">
Fechar
</button>
</div>
</div>
</div>
<script>
// Password protection
const CORRECT_PASSWORD = "LYON25";
const passwordProtection = document.getElementById('password-protection');
const passwordInput = document.getElementById('password-input');
const passwordBtn = document.getElementById('password-btn');
const errorMessage = document.getElementById('error-message');
const mainContent = document.getElementById('mainContent');
function checkPassword() {
const enteredPassword = passwordInput.value.trim();
if (enteredPassword === CORRECT_PASSWORD) {
// Hide password protection and show main content
passwordProtection.style.display = 'none';
mainContent.classList.remove('hidden');
// Generate the report
generateReport();
} else {
// Show error message
errorMessage.style.display = 'block';
passwordInput.focus();
}
}
// Add event listeners for password protection
passwordBtn.addEventListener('click', checkPassword);
passwordInput.addEventListener('keypress', function(e) {
if (e.key === 'Enter') {
checkPassword();
}
});
// Focus password input on page load
passwordInput.focus();
// Data for the report
const reportData = [
{
ref: "1",
conta: "S/N",
modalidade: "Lei 12.996/2014",
submodalidade: "PGFN – Débitos Previdenciários–Parcelamento",
situacao: "EM PARCELAMENTO",
cda: ["39.494.661-8", "43.234.725-9"],
valorDivida: "17.791,97",
valorConsolidado: "14.115,91",
percDesconto: "20,66%",
valorDesconto: "3.676,06",
qPrestTotal: "135",
percEntrada: "5,00%",
valorEntrada: "705,79",
qPrestEntrada: "1",
valorPrestEntrada: "705,79",
vPrestEnt1: "30/12/2014",
vPrestEntF: "30/12/2014",
valorSaldo: "13.410,12",
qPrestSaldo: "134",
valorPrestSaldo: "100,08",
vPrestSaldo1: "30/01/2015",
vPrestSaldoF: "28/02/2026",
valorPrestAtual: "197,61",
orientacao: "PAGAMENTOS EM DIA / MANTER",
linkDocumento: "https://drive.google.com/file/d/1mpwxS7R46BoRvmtL69Z9i_kONqXpOXMh/view?usp=sharing"
},
{
ref: "2",
conta: "S/N",
modalidade: "Lei 12.996/2014",
submodalidade: "RFB – Débitos Previdenciários–Parcelamento",
situacao: "EM PARCELAMENTO",
cda: ["N/C"],
valorDivida: "24.079,35",
valorConsolidado: "21.231,16",
percDesconto: "11,83%",
valorDesconto: "2.848,19",
qPrestTotal: "180",
percEntrada: "5,00%",
valorEntrada: "1.061,65",
qPrestEntrada: "1",
valorPrestEntrada: "1.061,65",
vPrestEnt1: "30/12/2014",
vPrestEntF: "30/12/2014",
valorSaldo: "20.169,51",
qPrestSaldo: "179",
valorPrestSaldo: "112,68",
vPrestSaldo1: "30/01/2015",
vPrestSaldoF: "30/11/2029",
valorPrestAtual: "222,50",
orientacao: "PAGAMENTOS EM DIA / MANTER",
linkDocumento: "https://drive.google.com/file/d/1nJ0dI-jahBDdCuIN4u8AwevDm9kd0c2v/view?usp=sharing"
},
{
ref: "3",
conta: "1627874",
modalidade: "0014 - PROGRAMA ESPECIAL DE REGULARIZACAO TRIBUTARIA - PERT - DEMAIS DEBITOS",
submodalidade: "0026 - DEMAIS DEBITOS ATE 15 MILHOES - ENTRADA E SALDO A VISTA OU ATE 145 MESES - NOV-2017",
situacao: "DEFERIDA E CONSOLIDADA",
cda: ["80 6 09 030887", "80 6 11 122994", "80 6 11 122995", "80 6 13 079598", "80 2 13 038143", "80 6 13 079599", "80 6 14 066770", "80 2 14 039888", "80 6 14 066771"],
valorDivida: "332.837,79",
valorConsolidado: "190.048,13",
percDesconto: "42,90%",
valorDesconto: "142.789,66",
qPrestTotal: "147",
percEntrada: "5,00%",
valorEntrada: "16.641,88",
qPrestEntrada: "2",
valorPrestEntrada: "8.320,94",
vPrestEnt1: "30/11/2017",
vPrestEntF: "30/12/2017",
valorSaldo: "173.406,25",
qPrestSaldo: "145",
valorPrestSaldo: "1.195,91",
vPrestSaldo1: "30/01/2018",
vPrestSaldoF: "30/01/2030",
valorPrestAtual: "1.902,33",
orientacao: "PAGAMENTOS EM DIA / MANTER",
linkDocumento: "https://drive.google.com/file/d/1CvO-IvmFsSr7Wb8YDyo_xCWmV2tcLMGT/view?usp=sharing"
}
];
// Set current date
const now = new Date();
const options = { day: '2-digit', month: '2-digit', year: 'numeric' };
const formattedDate = now.toLocaleDateString('pt-BR', options);
document.getElementById('current-date').textContent = formattedDate;
document.getElementById('current-date-footer').textContent = formattedDate;
// Format monetary values for Excel
function formatCurrencyForExcel(value) {
if (value === "-") return value;
// Remove dots (thousands separator) and replace comma with dot (decimal separator)
return parseFloat(value.replace(/\./g, '').replace(',', '.'));
}
// Generate CDA list HTML
function generateCDAList(cdaItems) {
if (Array.isArray(cdaItems)) {
return `<div class="cda-list">${cdaItems.map(item => `<div class="cda-item">${item}</div>`).join('')}</div>`;
}
return cdaItems; // fallback if not an array
}
// Show modal with details
function showDetails(rowData) {
const modal = document.getElementById('detailModal');
const modalContent = document.getElementById('modalContent');
modalContent.innerHTML = `
<div class="mb-6">
<h4 class="text-lg font-semibold text-blue-800 mb-2">Detalhes da Negociação #${rowData.ref}</h4>
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
<div class="bg-blue-50 p-4 rounded-lg">
<h5 class="font-medium text-blue-700 mb-2">Informações Básicas</h5>
<p><span class="font-medium">Conta:</span> ${rowData.conta}</p>
<p><span class="font-medium">Modalidade:</span> ${rowData.modalidade}</p>
<p><span class="font-medium">Submodalidade:</span> ${rowData.submodalidade}</p>
<p><span class="font-medium">Situação:</span> ${rowData.situacao}</p>
</div>
<div class="bg-green-50 p-4 rounded-lg">
<h5 class="font-medium text-green-700 mb-2">Valores</h5>
<p><span class="font-medium">Dívida:</span> <span class="monetary">${rowData.valorDivida}</span></p>
<p><span class="font-medium">Consolidado:</span> <span class="monetary">${rowData.valorConsolidado}</span></p>
<p><span class="font-medium">Desconto:</span> ${rowData.percDesconto} (<span class="monetary">${rowData.valorDesconto}</span>)</p>
</div>
</div>
</div>
<div class="mb-6">
<h5 class="font-medium text-gray-700 mb-2">CDAs Vinculadas</h5>
<div class="cda-list max-h-60 overflow-y-auto">
${Array.isArray(rowData.cda) ?
rowData.cda.map(item => `<div class="cda-item p-2 border-b border-gray-200 last:border-b-0">${item}</div>`).join('') :
`<div class="p-2">${rowData.cda}</div>`}
</div>
</div>
<div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6">
<div class="bg-yellow-50 p-4 rounded-lg">
<h5 class="font-medium text-yellow-700 mb-2">Entrada</h5>
<p><span class="font-medium">Valor:</span> <span class="monetary">${rowData.valorEntrada}</span> (${rowData.percEntrada})</p>
<p><span class="font-medium">Prestações:</span> ${rowData.qPrestEntrada} x <span class="monetary">${rowData.valorPrestEntrada}</span></p>
<p><span class="font-medium">1ª Prestação:</span> ${rowData.vPrestEnt1}</p>
<p><span class="font-medium">Última Prestação:</span> ${rowData.vPrestEntF}</p>
</div>
<div class="bg-purple-50 p-4 rounded-lg">
<h5 class="font-medium text-purple-700 mb-2">Saldo</h5>
<p><span class="font-medium">Valor:</span> <span class="monetary">${rowData.valorSaldo}</span></p>
<p><span class="font-medium">Prestações:</span> ${rowData.qPrestSaldo} x <span class="monetary">${rowData.valorPrestSaldo}</span></p>
<p><span class="font-medium">1ª Prestação:</span> ${rowData.vPrestSaldo1}</p>
<p><span class="font-medium">Última Prestação:</span> ${rowData.vPrestSaldoF}</p>
</div>
</div>
<div class="bg-gray-50 p-4 rounded-lg">
<h5 class="font-medium text-gray-700 mb-2">Resumo Financeiro</h5>
<div class="flex justify-between items-center">
<div>
<p class="text-sm">Total a pagar:</p>
<p class="text-xl font-bold monetary">${rowData.valorConsolidado}</p>
</div>
<div class="text-right">
<p class="text-sm">Economia:</p>
<p class="text-xl font-bold monetary">${rowData.valorDesconto}</p>
</div>
</div>
<div class="mt-4">
<p class="text-sm font-medium">Prestação Atual:</p>
<p class="text-lg monetary">${rowData.valorPrestAtual}</p>
</div>
</div>
<div class="mt-4 bg-blue-50 p-4 rounded-lg">
<h5 class="font-medium text-blue-700 mb-2">Orientações</h5>
<p>${rowData.orientacao}</p>
<div class="mt-3">
<a href="${rowData.linkDocumento}" target="_blank" class="inline-flex items-center px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700">
<i class="fas fa-file-alt mr-2"></i> Gerar Documento
</a>
</div>
</div>
`;
modal.classList.remove('hidden');
}
// Close modal
function closeModal() {
document.getElementById('detailModal').classList.add('hidden');
}
// Filter table rows
function filterTable() {
const searchInput = document.getElementById('search').value.toLowerCase();
const modalidadeFilter = document.getElementById('modalidade').value;
const statusFilter = document.getElementById('status').value;
const rows = document.querySelectorAll('#tableBody tr');
rows.forEach(row => {
const rowData = row.getAttribute('data-row');
const rowObj = JSON.parse(rowData);
const matchesSearch =
rowObj.conta.toLowerCase().includes(searchInput) ||
rowObj.cda.toString().toLowerCase().includes(searchInput);
const matchesModalidade =
modalidadeFilter === '' ||
rowObj.modalidade.includes(modalidadeFilter);
const matchesStatus =
statusFilter === '' ||
(statusFilter === 'deferida' && rowObj.situacao.includes('DEFERIDA')) ||
(statusFilter === 'parcelamento' && rowObj.situacao.includes('PARCELAMENTO'));
if (matchesSearch && matchesModalidade && matchesStatus) {
row.classList.remove('hidden');
} else {
row.classList.add('hidden');
}
});
}
// Print the report
function printReport() {
window.print();
}
// Generate the report
function generateReport() {
const tableBody = document.getElementById('tableBody');
const rowPagesContainer = document.getElementById('rowPages');
// Clear existing content
tableBody.innerHTML = '';
rowPagesContainer.innerHTML = '';
// Generate main table rows and individual pages
reportData.forEach((row, index) => {
// Add row to main table
const tableRow = document.createElement('tr');
tableRow.className = index % 2 === 0 ? 'hover-row' : 'hover-row bg-gray-50';
tableRow.setAttribute('data-row', JSON.stringify(row));
tableRow.innerHTML = `
<td class="px-3 py-4 text-sm font-medium text-blue-600 table-cell">${row.ref}</td>
<td class="px-3 py-4 text-sm table-cell">${row.conta}</td>
<td class="px-3 py-4 text-sm table-cell">${row.modalidade}</td>
<td class="px-3 py-4 text-sm table-cell">${row.submodalidade}</td>
<td class="px-3 py-4 text-sm table-cell">${row.situacao}</td>
<td class="px-3 py-4 text-xs cda-cell">
<div class="max-w-xs overflow-auto h-20">${generateCDAList(row.cda)}</div>
</td>
<td class="px-3 py-4 text-sm font-medium monetary table-cell">${row.valorDivida}</td>
<td class="px-3 py-4 text-sm font-medium text-green-600 monetary table-cell">${row.valorConsolidado}</td>
<td class="px-3 py-4 text-sm table-cell">${row.percDesconto}</td>
<td class="px-3 py-4 text-sm font-medium monetary table-cell">${row.valorDesconto}</td>
<td class="px-3 py-4 text-sm table-cell">${row.qPrestTotal}</td>
<td class="px-3 py-4 text-sm table-cell">${row.percEntrada}</td>
<td class="px-3 py-4 text-sm font-medium monetary table-cell">${row.valorEntrada}</td>
<td class="px-3 py-4 text-sm table-cell">${row.qPrestEntrada}</td>
<td class="px-3 py-4 text-sm monetary table-cell">${row.valorPrestEntrada}</td>
<td class="px-3 py-4 text-sm table-cell">${row.vPrestEnt1}</td>
<td class="px-3 py-4 text-sm table-cell">${row.vPrestEntF}</td>
<td class="px-3 py-4 text-sm font-medium monetary table-cell">${row.valorSaldo}</td>
<td class="px-3 py-4 text-sm table-cell">${row.qPrestSaldo}</td>
<td class="px-3 py-4 text-sm monetary table-cell">${row.valorPrestSaldo}</td>
<td class="px-3 py-4 text-sm table-cell">${row.vPrestSaldo1}</td>
<td class="px-3 py-4 text-sm table-cell">${row.vPrestSaldoF}</td>
<td class="px-3 py-4 text-sm monetary table-cell">${row.valorPrestAtual}</td>
<td class="px-3 py-4 text-sm table-cell">${row.orientacao}</td>
<td class="px-3 py-4 text-sm no-print">
<button onclick="showDetails(${JSON.stringify(row).replace(/"/g, '&quot;')})" class="text-blue-600 hover:text-blue-800 mr-2 tooltip">
<i class="fas fa-eye"></i>
<span class="tooltip-text">Visualizar detalhes</span>
</button>
<a href="${row.linkDocumento}" target="_blank" class="text-green-600 hover:text-green-800 tooltip">
<i class="fas fa-file-alt"></i>
<span class="tooltip-text">Gerar documento</span>
</a>
</td>
`;
tableBody.appendChild(tableRow);
// Create individual page for this row
const rowPage = document.createElement('div');
rowPage.className = 'row-page';
rowPage.innerHTML = `
<div class="mb-4">
<div class="flex items-center mb-2">
<div class="bg-blue-100 p-2 rounded-lg mr-3">
<svg xmlns="http://www.w3.org/2000/svg" class="h-10 w-10 text-blue-600" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round stroke-width="2" d="M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z" />
</svg>
</div>
<div>
<h1 class="text-2xl font-bold text-blue-800">MVICENTE ADVOCACIA</h1>
<h2 class="text-lg">RELATÓRIO DE NEGOCIAÇÕES TRIBUTÁRIAS ATIVAS</h2>
</div>
</div>
<div class="bg-blue-700 text-white p-2 rounded-lg text-sm">
<p>LYON CORRETORA DE SEGUROS LTDA. - 55.223.077/0001-12</p>
<p class="mt-1">Data: ${formattedDate}</p>
</div>
</div>
<div class="mb-4">
<h3 class="text-lg font-semibold border-b border-gray-200 pb-2">Detalhes da Transação #${row.ref}</h3>
</div>
<table class="row-table">
<tr>
<th>Referência</th>
<td>${row.ref}</td>
</tr>
<tr>
<th>Conta Nº</th>
<td>${row.conta}</td>
</tr>
<tr>
<th>Modalidade</th>
<td>${row.modalidade}</td>
</tr>
<tr>
<th>Submodalidade</th>
<td>${row.submodalidade}</td>
</tr>
<tr>
<th>Situação</th>
<td>${row.situacao}</td>
</tr>
<tr>
<th>N. CDA</th>
<td><div style="max-height: 120px; overflow-y: auto;">${generateCDAList(row.cda)}</div></td>
</tr>
<tr>
<th>Valor Dívida</th>
<td class="monetary">${row.valorDivida}</td>
</tr>
<tr>
<th>Valor Consolidado</th>
<td class="monetary">${row.valorConsolidado}</td>
</tr>
<tr>
<th>% Desconto</th>
<td>${row.percDesconto}</td>
</tr>
<tr>
<th>Valor Desconto</th>
<td class="monetary">${row.valorDesconto}</td>
</tr>
<tr>
<th>Qtd. Prestações Total</th>
<td>${row.qPrestTotal}</td>
</tr>
<tr>
<th>% Entrada</th>
<td>${row.percEntrada}</td>
</tr>
<tr>
<th>Valor Entrada</th>
<td class="monetary">${row.valorEntrada}</td>
</tr>
<tr>
<th>Qtd. Prestações Entrada</th>
<td>${row.qPrestEntrada}</td>
</tr>
<tr>
<th>Valor Prestação Entrada</th>
<td class="monetary">${row.valorPrestEntrada}</td>
</tr>
<tr>
<th>1ª Prestação Entrada</th>
<td>${row.vPrestEnt1}</td>
</tr>
<tr>
<th>Última Prestação Entrada</th>
<td>${row.vPrestEntF}</td>
</tr>
<tr>
<th>Valor Saldo</th>
<td class="monetary">${row.valorSaldo}</td>
</tr>
<tr>
<th>Qtd. Prestações Saldo</th>
<td>${row.qPrestSaldo}</td>
</tr>
<tr>
<th>Valor Prestação Saldo</th>
<td class="monetary">${row.valorPrestSaldo}</td>
</tr>
<tr>
<th>1ª Prestação Saldo</th>
<td>${row.vPrestSaldo1}</td>
</tr>
<tr>
<th>Última Prestação Saldo</th>
<td>${row.vPrestSaldoF}</td>
</tr>
<tr>
<th>Valor Prestação Atual</th>
<td class="monetary">${row.valorPrestAtual}</td>
</tr>
<tr>
<th>Orientação</th>
<td>${row.orientacao}</td>
</tr>
</table>
<div class="mt-6 grid grid-cols-1 md:grid-cols-2 gap-4">
<div class="bg-blue-50 p-3 rounded-lg">
<h4 class="font-medium text-blue-700 mb-2">Cronograma de Pagamentos</h4>
<p><span class="font-medium">Entrada:</span> ${row.qPrestEntrada} parcelas de <span class="monetary">${row.valorPrestEntrada}</span></p>
<p><span class="font-medium">Saldo:</span> ${row.qPrestSaldo} parcelas de <span class="monetary">${row.valorPrestSaldo}</span></p>
<p class="mt-2"><span class="font-medium">Prestação Atual:</span> <span class="monetary">${row.valorPrestAtual}</span></p>
</div>
<div class="bg-green-50 p-3 rounded-lg">
<h4 class="font-medium text-green-700 mb-2">Resumo Financeiro</h4>
<p><span class="font-medium">Total Consolidado:</span> <span class="monetary">${row.valorConsolidado}</span></p>
<p><span class="font-medium">Economia Total:</span> <span class="monetary">${row.valorDesconto}</span></p>
<div class="mt-3">
<a href="${row.linkDocumento}" target="_blank" class="inline-flex items-center px-4 py-2 bg-green-600 text-white rounded-lg hover:bg-green-700">
<i class="fas fa-file-alt mr-2"></i> Gerar Documento
</a>
</div>
</div>
</div>
<div class="mt-4 text-sm text-gray-600">
<p>MVICENTE Advocacia - Relatório gerado em ${formattedDate}</p>
<p>Este documento é confidencial e destinado exclusivamente ao uso da diretoria</p>
</div>
`;
rowPagesContainer.appendChild(rowPage);
});
// Add total row to main table
const totalRow = document.createElement('tr');
totalRow.className = 'bg-blue-50 font-bold';
totalRow.innerHTML = `
<td class="px-3 py-4 whitespace-nowrap text-sm font-medium text-blue-800" colspan="6">TOTAL</td>
<td class="px-3 py-4 whitespace-nowrap text-sm font-medium text-blue-800 monetary">374.709,11</td>
<td class="px-3 py-4 whitespace-nowrap text-sm font-medium text-blue-800 monetary">225.395,20</td>
<td class="px-3 py-4 whitespace-nowrap text-sm"></td>
<td class="px-3 py-4 whitespace-nowrap text-sm font-medium text-blue-800 monetary">149.313,91</td>
<td class="px-3 py-4 whitespace-nowrap text-sm"></td>
<td class="px-3 py-4 whitespace-nowrap text-sm"></td>
<td class="px-3 py-4 whitespace-nowrap text-sm font-medium text-blue-800 monetary">18.409,32</td>
<td class="px-3 py-4 whitespace-nowrap text-sm"></td>
<td class="px-3 py-4 whitespace-nowrap text-sm font-medium text-blue-800 monetary">10.088,38</td>
<td class="px-3 py-4 whitespace-nowrap text-sm" colspan="2"></td>
<td class="px-3 py-4 whitespace-nowrap text-sm font-medium text-blue-800 monetary">206.985,88</td>
<td class="px-3 py-4 whitespace-nowrap text-sm"></td>
<td class="px-3 py-4 whitespace-nowrap text-sm font-medium text-blue-800 monetary">1.408,66</td>
<td class="px-3 py-4 whitespace-nowrap text-sm" colspan="2"></td>
<td class="px-3 py-4 whitespace-nowrap text-sm font-medium text-blue-800 monetary">2.322,43</td>
<td class="px-3 py-4 whitespace-nowrap text-sm"></td>
<td class="px-3 py-4 whitespace-nowrap text-sm no-print"></td>
`;
tableBody.appendChild(totalRow);
// Add event listeners to filters
document.getElementById('search').addEventListener('input', filterTable);
document.getElementById('modalidade').addEventListener('change', filterTable);
document.getElementById('status').addEventListener('change', filterTable);
}
// Export to PDF with each row on a separate page
async function exportToPDF() {
const { jsPDF } = window.jspdf;
const pdf = new jsPDF('p', 'mm', 'a4');
// Show loading indicator
const loading = document.createElement('div');
loading.className = 'fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50';
loading.innerHTML = `
<div class="bg-white p-6 rounded-lg shadow-xl text-center">
<div class="animate-spin rounded-full h-12 w-12 border-b-2 border-blue-500 mx-auto mb-4"></div>
<p class="text-lg font-medium">Gerando PDF...</p>
<p class="text-sm text-gray-600 mt-1">Por favor, aguarde</p>
</div>
`;
document.body.appendChild(loading);
// Get all row pages
const rowPages = document.querySelectorAll('.row-page');
// Process each page sequentially
for (let i = 0; i < rowPages.length; i++) {
if (i > 0) {
pdf.addPage();
}
const page = rowPages[i];
// Temporarily position the page for capture
page.style.position = 'absolute';
page.style.left = '0';
page.style.top = '0';
page.style.width = '210mm';
page.style.height = '297mm';
page.style.zIndex = '9999';
document.body.appendChild(page);
// Create canvas from the page
const canvas = await html2canvas(page, {
scale: 2,
logging: false,
useCORS: true,
allowTaint: true,
scrollX: 0,
scrollY: 0
});
// Remove the page from view
document.body.removeChild(page);
page.style.position = '';
page.style.left = '';
page.style.top = '';
page.style.width = '';
page.style.height = '';
page.style.zIndex = '';
const imgData = canvas.toDataURL('image/png');
const imgProps = pdf.getImageProperties(imgData);
const pdfWidth = pdf.internal.pageSize.getWidth() - 20;
const pdfHeight = (imgProps.height * pdfWidth) / imgProps.width;
pdf.addImage(imgData, 'PNG', 10, 10, pdfWidth, pdfHeight);
}
// Remove loading indicator
document.body.removeChild(loading);
// Save the PDF
pdf.save(`Relatorio_Negociacoes_Tributarias_Lyon_Corretora_${formattedDate.replace(/\//g, '-')}.pdf`);
}
// Export to Excel with Brazilian currency formatting
function exportToExcel() {
const table = document.querySelector('table');
// Clone the table to avoid modifying the original
const tableClone = table.cloneNode(true);
// Remove action column from export
const actionColumns = tableClone.querySelectorAll('.no-print');
actionColumns.forEach(col => col.remove());
// Process monetary values for Excel
const monetaryCells = tableClone.querySelectorAll('.monetary');
monetaryCells.forEach(cell => {
if (cell.textContent !== "-") {
const numericValue = formatCurrencyForExcel(cell.textContent);
cell.setAttribute('data-num', numericValue);
}
});
// Convert to workbook
const workbook = XLSX.utils.table_to_book(tableClone, {raw: true});
// Apply number formatting
const ws = workbook.Sheets[workbook.SheetNames[0]];
// Find all columns with monetary values (we'll check for data-num attribute)
const range = XLSX.utils.decode_range(ws['!ref']);
for (let C = range.s.c; C <= range.e.c; ++C) {
const header = XLSX.utils.encode_col(C) + "1";
if (ws[header] && (ws[header].v.includes("DÍVIDA") ||
ws[header].v.includes("CONSOL") ||
ws[header].v.includes("V. DESC") ||
ws[header].v.includes("V. ENT") ||
ws[header].v.includes("V. PREST") ||
ws[header].v.includes("SALDO") ||
ws[header].v.includes("ATUAL"))) {
for (let R = range.s.r + 1; R <= range.e.r; ++R) {
const cell = XLSX.utils.encode_col(C) + (R + 1);
if (ws[cell] && ws[cell].v !== "-") {
// Apply Brazilian currency format
ws[cell].z = '"R$"#,##0.00;[Red]\-"R$"#,##0.00';
}
}
}
}
// Save the Excel file
XLSX.writeFile(workbook, `Relatorio_Negociacoes_Tributarias_Lyon_Corretora_${formattedDate.replace(/\//g, '-')}.xlsx`);
}
</script>
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=maralvic/rellyon" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>