-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
218 lines (203 loc) · 7.38 KB
/
Copy pathindex.html
File metadata and controls
218 lines (203 loc) · 7.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
<!DOCTYPE html>
<html lang="pt-BR">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Uber do Zé II</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap" rel="stylesheet">
<style>
:root{
--bg:#0b0b0c;
--card:#151516;
--muted:#a7a7ac;
--text:#f2f2f3;
--accent:#10d07a;
--danger:#ff5a67;
--shadow:0 4px 16px rgba(0,0,0,.35);
--radius:14px;
}
*{box-sizing:border-box}
body{
margin:0;
font-family:Inter, system-ui, sans-serif;
background:#0b0b0c;
color:var(--text);
}
.app{display:flex; flex-direction:column; height:100%; max-width:980px; margin:0 auto}
header{padding:18px 16px 8px; background:#111; position:sticky; top:0}
header h1{margin:0; font-size:20px}
main{flex:1; overflow:auto; padding:16px; padding-bottom:96px}
.card{background:var(--card); border-radius:var(--radius); padding:14px; margin-bottom:14px}
.row{display:grid; grid-template-columns:1fr 1fr; gap:10px}
label{font-size:13px; color:var(--muted)}
input[type="number"], input[type="date"], select{
width:100%; padding:12px; border-radius:12px; border:1px solid #333;
background:#0f0f11; color:var(--text)
}
input[readonly]{opacity:.85}
.stat{padding:12px; border-radius:12px; background:#0f1412}
.stat h3{margin:0; font-size:12px; color:var(--muted)}
.stat .val{margin-top:4px; font-weight:700; font-size:18px}
.btn{padding:12px; border-radius:12px; border:none; cursor:pointer; font-weight:700;
background:var(--accent); color:#031a10; width:100%}
.footer-tabs{position:sticky; bottom:0; display:flex; gap:8px; padding:8px; background:#111}
.tab-btn{flex:1; padding:10px; border-radius:12px; background:#333; color:var(--muted)}
.tab-btn.active{background:var(--accent); color:#072015}
.hidden{display:none}
canvas{background:#0f0f11; border-radius:12px}
</style>
</head>
<body>
<div class="app">
<header>
<h1>Uber do Zé II</h1>
<small id="todayLabel"></small>
</header>
<main>
<!-- TAB 1: Receita diária -->
<section id="tab-diaria">
<div class="card">
<div class="row">
<div>
<label>Data</label>
<input type="date" id="dateInput">
</div>
<div>
<label>Valor da Gasolina (R$)</label>
<input type="number" step="0.01" id="gasInput" placeholder="4.00">
</div>
</div>
</div>
<div class="card">
<div class="row">
<div>
<label>Km inicial</label>
<input type="number" step="0.1" id="kmInicial">
</div>
<div>
<label>Km final</label>
<input type="number" step="0.1" id="kmFinal">
</div>
</div>
<div class="row" style="margin-top:10px">
<div>
<label>Número de km rodados</label>
<input type="number" id="kmRodados" readonly>
</div>
<div>
<label>Gasto com combustível (R$)</label>
<input type="text" id="gastoComb" readonly>
</div>
</div>
</div>
<div class="card">
<div class="row">
<div>
<label>Receita Uber (R$)</label>
<input type="number" step="0.01" id="receitaUber">
</div>
<div>
<label>Receita 99 (R$)</label>
<input type="number" step="0.01" id="receita99">
</div>
</div>
<div class="row" style="margin-top:10px">
<div>
<label>Quantidade de corridas Uber</label>
<input type="number" step="1" id="qtdUber">
</div>
<div>
<label>Quantidade de corridas 99</label>
<input type="number" step="1" id="qtd99">
</div>
</div>
</div>
<div class="card">
<div class="row">
<div class="stat">
<h3>Ganho por km</h3>
<div class="val" id="ganhoPorKmVal">R$ 0,00</div>
</div>
<div class="stat">
<h3>Ganho líquido</h3>
<div class="val" id="ganhoLiquidoVal">R$ 0,00</div>
</div>
</div>
<button class="btn" id="saveBtn">Salvar dia</button>
</div>
</section>
<!-- TAB 2: Faturamento total -->
<section id="tab-faturamento" class="hidden">
<div class="card">
<label>Escolha a data</label>
<input type="date" id="consultaData">
</div>
<div class="card">
<div class="row">
<div class="stat">
<h3>Faturamento do dia (Ganho por km)</h3>
<div class="val" id="fatDiaVal">R$ 0,00</div>
</div>
<div class="stat">
<h3>Lucro do dia (Ganho líquido)</h3>
<div class="val" id="lucroDiaVal">R$ 0,00</div>
</div>
</div>
</div>
<div class="card">
<canvas id="chartGanhoKm" height="260"></canvas>
<canvas id="chartLucro" height="260"></canvas>
</div>
</section>
<!-- TAB 3: Configurações -->
<section id="tab-config" class="hidden">
<div class="card">
<label>Novo valor da Gasolina (R$)</label>
<input type="number" step="0.01" id="cfgGasolina">
<button class="btn" id="salvarGasolina">Salvar valor</button>
</div>
<div class="card">
<button class="btn" id="exportCsv">Baixar CSV</button>
<button class="btn" id="limparTudo">Apagar tudo</button>
</div>
</section>
</main>
<nav class="footer-tabs">
<button class="tab-btn active" data-tab="diaria">Receita diária</button>
<button class="tab-btn" data-tab="faturamento">Faturamento total</button>
<button class="tab-btn" data-tab="config">Configurações</button>
</nav>
</div>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<script>
(function(){
const $ = (sel)=>document.querySelector(sel);
const dateInput = $("#dateInput"), gasInput=$("#gasInput"),
kmInicial=$("#kmInicial"), kmFinal=$("#kmFinal"), kmRodados=$("#kmRodados"),
gastoComb=$("#gastoComb"), receitaUber=$("#receitaUber"), receita99=$("#receita99"),
ganhoPorKmVal=$("#ganhoPorKmVal"), ganhoLiquidoVal=$("#ganhoLiquidoVal"),
saveBtn=$("#saveBtn");
function fmtBRL(v){return (isFinite(v)?v:0).toLocaleString('pt-BR',{style:'currency',currency:'BRL'});}
function recalc(){
const gas = parseFloat(gasInput.value)||0;
const ki = parseFloat(kmInicial.value)||0;
const kf = parseFloat(kmFinal.value)||0;
const kr = Math.max(0,kf-ki);
kmRodados.value = kr.toFixed(2);
// ✅ nova fórmula: (km rodados / 6) * gasolina
const gasto = (kr/6)*gas;
gastoComb.value = fmtBRL(gasto);
const rU = parseFloat(receitaUber.value)||0;
const r9 = parseFloat(receita99.value)||0;
const receitaTotal = rU+r9;
const ganhoKm = kr>0? receitaTotal/kr : 0;
ganhoPorKmVal.textContent = fmtBRL(ganhoKm);
const liquido = ganhoKm - gasto;
ganhoLiquidoVal.textContent = fmtBRL(liquido);
}
[gasInput, kmInicial, kmFinal, receitaUber, receita99].forEach(el=>el.addEventListener('input', recalc));
})();
</script>
</body>
</html>