EraDigital commited on
Commit
5a4ea66
·
verified ·
1 Parent(s): 0626e2e

from fpdf import FPDF

Browse files

import matplotlib.pyplot as plt
import io

# Dados
meses = ["Jan", "Fev", "Mar", "Abr", "Mai", "Jun", "Jul", "Ago", "Set", "Out"]
receita_liquida = [52955, 35479, 47800, 48745, 52123, 56412, 54729, 50621, 51664, 50934]
custos = [20571, 17265, 10506, 17062, 18840, 25296, 20341, 18733, 17556, 17319]
lucro_liquido = [309, -13589, 9669, 606, 3060, 422, 2153, 1346, 3931, 2284]

# --- Gráfico ---
plt.figure(figsize=(8, 4))
plt.plot(meses, receita_liquida, label="Receita Líquida", color="#004080", linewidth=2)
plt.plot(meses, custos, label="Custos Operacionais", color="#808080", linewidth=2)
plt.plot(meses, lucro_liquido, label="Lucro Líquido", color="#0070C0", linewidth=2)
plt.title("Evolução Financeira – MCA (Jan–Out/2025)", fontsize=12, color="#004080")
plt.xlabel("Meses")
plt.ylabel("Valores (R$)")
plt.grid(True, linestyle="--", alpha=0.6)
plt.legend()

img_buf = io.BytesIO()
plt.savefig(img_buf, format="png", bbox_inches="tight")
plt.close()

# --- PDF ---
pdf = FPDF()
pdf.add_page()
pdf.set_font("Arial", "B", 14)
pdf.set_text_color(0, 64, 128)
pdf.cell(0, 10, "Análise Financeira DRE – MCA | Fechamento Outubro 2025", ln=True, align="C")

pdf.ln(8)
pdf.set_font("Arial", "", 11)
pdf.set_text_color(0, 0, 0)
texto = """
Resumo Executivo:
O fechamento de outubro apresentou manutenção de receita e leve melhora no lucro líquido.
A empresa consolida um resultado positivo, ainda pressionado por despesas administrativas elevadas.

Indicadores-Chave (Outubro/2025):
• Receita Líquida: R$ 50.934
• Custos Operacionais: R$ 17.319
• Lucro Bruto: R$ 33.615 (66%)
• Despesas Operacionais: R$ 31.331 (61%)
• Lucro Líquido: R$ 2.284 (4,5%)
• Margem de Contribuição: 57,3%

Pontos de Atenção:
• Despesas Administrativas representam 80% das despesas totais.
• Margem operacional ainda abaixo do ideal (4,5% vs. meta 8%).
• Aumento nas deduções e impostos sobre vendas em outubro.

Diretrizes:
1. Reavaliar estrutura administrativa e contratos fixos.
2. Otimizar controle de custos e deduções.
3. Manter foco na eficiência operacional e na geração de caixa.
"""
pdf.multi_cell(0, 7, texto.strip())

pdf.ln(5)
pdf.image(img_buf, x=15, w=180)
pdf.ln(5)
pdf.set_font("Arial", "I", 9)
pdf.set_text_color(128, 128, 128)
pdf.cell(0, 8, "Fonte: DRE Interna MCA - Análise Financeira | GPT-5", ln=True, align="R")

pdf.output("Analise_Financeira_MCA_Outubro2025.pdf")
print("✅ Relatório PDF gerado: Analise_Financeira_MCA_Outubro2025.pdf")

Files changed (2) hide show
  1. README.md +7 -4
  2. index.html +191 -19
README.md CHANGED
@@ -1,10 +1,13 @@
1
  ---
2
- title: Finance Flow Dashboard
3
- emoji: 🏢
4
  colorFrom: blue
5
- colorTo: purple
 
6
  sdk: static
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
1
  ---
2
+ title: Finance Flow Dashboard 🌊
 
3
  colorFrom: blue
4
+ colorTo: yellow
5
+ emoji: 🐳
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite-v3
10
  ---
11
 
12
+ # Welcome to your new DeepSite project!
13
+ This project was created with [DeepSite](https://huggingface.co/deepsite).
index.html CHANGED
@@ -1,19 +1,191 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en" class="h-full bg-gray-50">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Finance Flow Dashboard</title>
7
+ <link rel="stylesheet" href="style.css">
8
+ <script src="https://cdn.tailwindcss.com"></script>
9
+ <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
10
+ <script src="https://unpkg.com/feather-icons"></script>
11
+ <script src="components/navbar.js"></script>
12
+ <script>
13
+ tailwind.config = {
14
+ theme: {
15
+ extend: {
16
+ colors: {
17
+ primary: {
18
+ 50: '#f0f9ff',
19
+ 100: '#e0f2fe',
20
+ 200: '#b0e0ff',
21
+ 300: '#7ec8ff',
22
+ 400: '#4ab0ff',
23
+ 500: '#0088ff',
24
+ 600: '#0066cc',
25
+ 700: '#004999',
26
+ 800: '#003366',
27
+ 900: '#001a33',
28
+ },
29
+ secondary: {
30
+ 50: '#f5f7fa',
31
+ 100: '#e4e9f2',
32
+ 200: '#c5d0e5',
33
+ 300: '#9fb8d9',
34
+ 400: '#7a9fcc',
35
+ 500: '#4d82bf',
36
+ 600: '#3a66a3',
37
+ 700: '#2c4d87',
38
+ 800: '#1e366b',
39
+ 900: '#10204f',
40
+ }
41
+ }
42
+ }
43
+ }
44
+ }
45
+ </script>
46
+ </head>
47
+ <body class="h-full">
48
+ <custom-navbar></custom-navbar>
49
+
50
+ <main class="container mx-auto px-4 py-8">
51
+ <div class="flex flex-col lg:flex-row gap-8">
52
+ <!-- Left Column -->
53
+ <div class="w-full lg:w-2/3">
54
+ <div class="bg-white rounded-xl shadow-md p-6 mb-8">
55
+ <div class="flex justify-between items-center mb-6">
56
+ <h1 class="text-2xl font-bold text-primary-800">Financial Evolution - MCA (Jan-Oct/2025)</h1>
57
+ <div class="flex items-center space-x-2">
58
+ <button class="px-3 py-1 bg-primary-100 text-primary-700 rounded-lg text-sm">Export PDF</button>
59
+ <button class="p-2 rounded-lg hover:bg-gray-100">
60
+ <i data-feather="more-vertical"></i>
61
+ </button>
62
+ </div>
63
+ </div>
64
+
65
+ <div class="h-80">
66
+ <canvas id="financialChart"></canvas>
67
+ </div>
68
+
69
+ <div class="mt-6 grid grid-cols-1 md:grid-cols-3 gap-4">
70
+ <div class="bg-blue-50 p-4 rounded-lg">
71
+ <p class="text-sm text-blue-700 mb-1">Net Revenue</p>
72
+ <p class="text-2xl font-bold text-blue-900">R$50,934</p>
73
+ <p class="text-xs text-blue-600">+2.1% vs last month</p>
74
+ </div>
75
+ <div class="bg-gray-50 p-4 rounded-lg">
76
+ <p class="text-sm text-gray-700 mb-1">Operational Costs</p>
77
+ <p class="text-2xl font-bold text-gray-900">R$17,319</p>
78
+ <p class="text-xs text-gray-600">-1.3% vs last month</p>
79
+ </div>
80
+ <div class="bg-green-50 p-4 rounded-lg">
81
+ <p class="text-sm text-green-700 mb-1">Net Profit</p>
82
+ <p class="text-2xl font-bold text-green-900">R$2,284</p>
83
+ <p class="text-xs text-green-600">+8.5% vs last month</p>
84
+ </div>
85
+ </div>
86
+ </div>
87
+ </div>
88
+
89
+ <!-- Right Column -->
90
+ <div class="w-full lg:w-1/3">
91
+ <div class="bg-white rounded-xl shadow-md p-6 mb-8">
92
+ <div class="flex justify-between items-center mb-6">
93
+ <h2 class="text-xl font-bold text-primary-800">Key Indicators</h2>
94
+ <i data-feather="info" class="text-gray-400"></i>
95
+ </div>
96
+
97
+ <div class="space-y-4">
98
+ <div>
99
+ <div class="flex justify-between text-sm mb-1">
100
+ <span class="text-gray-600">Gross Profit</span>
101
+ <span class="font-medium">66%</span>
102
+ </div>
103
+ <div class="w-full bg-gray-200 rounded-full h-2">
104
+ <div class="bg-blue-500 h-2 rounded-full" style="width: 66%"></div>
105
+ </div>
106
+ </div>
107
+
108
+ <div>
109
+ <div class="flex justify-between text-sm mb-1">
110
+ <span class="text-gray-600">Operational Expenses</span>
111
+ <span class="font-medium">61%</span>
112
+ </div>
113
+ <div class="w-full bg-gray-200 rounded-full h-2">
114
+ <div class="bg-yellow-500 h-2 rounded-full" style="width: 61%"></div>
115
+ </div>
116
+ </div>
117
+
118
+ <div>
119
+ <div class="flex justify-between text-sm mb-1">
120
+ <span class="text-gray-600">Net Margin</span>
121
+ <span class="font-medium">4.5%</span>
122
+ </div>
123
+ <div class="w-full bg-gray-200 rounded-full h-2">
124
+ <div class="bg-green-500 h-2 rounded-full" style="width: 4.5%"></div>
125
+ </div>
126
+ </div>
127
+
128
+ <div>
129
+ <div class="flex justify-between text-sm mb-1">
130
+ <span class="text-gray-600">Contribution Margin</span>
131
+ <span class="font-medium">57.3%</span>
132
+ </div>
133
+ <div class="w-full bg-gray-200 rounded-full h-2">
134
+ <div class="bg-purple-500 h-2 rounded-full" style="width: 57.3%"></div>
135
+ </div>
136
+ </div>
137
+ </div>
138
+ </div>
139
+
140
+ <div class="bg-white rounded-xl shadow-md p-6">
141
+ <h2 class="text-xl font-bold text-primary-800 mb-4">Executive Summary</h2>
142
+ <div class="prose prose-sm text-gray-700">
143
+ <p>The October closing showed revenue maintenance and slight improvement in net profit. The company consolidates a positive result, still pressured by high administrative expenses.</p>
144
+ <p class="mt-3 font-medium">Attention Points:</p>
145
+ <ul class="list-disc list-inside">
146
+ <li>Administrative expenses represent 80% of total expenses</li>
147
+ <li>Operational margin still below ideal (4.5% vs 8% target)</li>
148
+ <li>Increase in deductions and sales taxes in October</li>
149
+ </ul>
150
+ </div>
151
+ </div>
152
+ </div>
153
+ </div>
154
+ </main>
155
+
156
+ <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
157
+ <script src="script.js"></script>
158
+ <script>
159
+ feather.replace();
160
+
161
+ // Chart initialization
162
+ document.addEventListener('DOMContentLoaded', function() {
163
+ const ctx = document.getElementById('financialChart').getContext('2d');
164
+ const myChart = new Chart(ctx, {
165
+ type: 'line',
166
+ data: {
167
+ labels: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct"],
168
+ datasets: [
169
+ {
170
+ label: 'Net Revenue',
171
+ data: [52955, 35479, 47800, 48745, 52123, 56412, 54729, 50621, 51664, 50934],
172
+ borderColor: '#004080',
173
+ backgroundColor: 'rgba(0, 64, 128, 0.1)',
174
+ borderWidth: 2,
175
+ fill: true,
176
+ tension: 0.4
177
+ },
178
+ {
179
+ label: 'Operational Costs',
180
+ data: [20571, 17265, 10506, 17062, 18840, 25296, 20341, 18733, 17556, 17319],
181
+ borderColor: '#808080',
182
+ backgroundColor: 'rgba(128, 128, 128, 0.1)',
183
+ borderWidth: 2,
184
+ tension: 0.4
185
+ },
186
+ {
187
+ label: 'Net Profit',
188
+ data: [309, -13589, 9669, 606, 3060, 422, 2153, 1346
189
+ <script src="https://huggingface.co/deepsite/deepsite-badge.js"></script>
190
+ </body>
191
+ </html>