diff --git a/assets/css/custom.css b/assets/css/custom.css new file mode 100644 index 0000000..87ca96a --- /dev/null +++ b/assets/css/custom.css @@ -0,0 +1,106 @@ + +body { + font-family: 'Inter', sans-serif; + background-color: #F4F7F9; + color: #333; +} + +.header { + background: linear-gradient(135deg, #4A90E2 0%, #50E3C2 100%); + color: white; + padding: 2rem 0; + margin-bottom: 2rem; + text-align: center; +} + +.header h1 { + font-weight: 700; + font-size: 2.5rem; +} + +.card { + border: none; + border-radius: 8px; + box-shadow: 0 4px 12px rgba(0,0,0,0.08); + padding: 2rem; + height: 100%; +} + +.card-title { + font-weight: 600; + margin-bottom: 1.5rem; + color: #4A90E2; + display: flex; + align-items: center; +} + +.card-title i { + margin-right: 0.75rem; +} + +.form-label { + font-weight: 500; +} + +.form-control, .form-select { + border-radius: 8px; + border: 1px solid #ced4da; + padding: 0.75rem 1rem; +} +.form-control:focus { + border-color: #4A90E2; + box-shadow: 0 0 0 0.25rem rgba(74, 144, 226, 0.25); +} + +.btn-primary { + background-color: #4A90E2; + border-color: #4A90E2; + border-radius: 8px; + padding: 0.75rem 1.5rem; + font-weight: 600; + transition: background-color 0.2s ease-in-out; +} + +.btn-primary:hover { + background-color: #357ABD; + border-color: #357ABD; +} + +.results-card h3 { + text-align: center; + color: #aaa; + height: 100%; + display: flex; + align-items: center; + justify-content: center; +} + +.result-item { + display: flex; + justify-content: space-between; + padding: 1rem 0; + border-bottom: 1px solid #eee; +} +.result-item:last-child { + border-bottom: none; +} +.result-item span { + font-weight: 500; +} +.result-item .value { + font-weight: 700; + color: #4A90E2; + font-size: 1.1rem; +} + +.total-value { + background-color: #4A90E2; + color: white; + padding: 1rem; + border-radius: 8px; + margin-top: 1rem; +} +.total-value .result-item .value { + color: white; + font-size: 1.5rem; +} diff --git a/index.php b/index.php index 6f7ffab..51340ee 100644 --- a/index.php +++ b/index.php @@ -1,131 +1,370 @@ $data_array[$i], 'y' => ($i + 1) / $count]; + } + return $ecdf; +} + + +if ($_SERVER["REQUEST_METHOD"] == "POST") { + // --- GET INPUTS --- + + $valor_veiculo = (float)($_POST['valor_veiculo'] ?? 500000); + $rota = (float)($_POST['rota'] ?? 100); + $n_dias = (int)($_POST['n_dias'] ?? 22); + $diesel = (float)($_POST['diesel'] ?? 5.50); + $oleo = (float)($_POST['oleo'] ?? 500); + $pecas = (float)($_POST['pecas'] ?? 0.5); + $pneu_novo = (float)($_POST['pneu_novo'] ?? 2000); + $pneu_recap = (float)($_POST['pneu_recap'] ?? 800); + $motorista = (float)($_POST['motorista'] ?? 3000); + $n_motorista = (int)($_POST['n_motorista'] ?? 2); + $escritorio = (float)($_POST['escritorio'] ?? 5000); + $taxas = (float)($_POST['taxas'] ?? 1000); + $impostos = (float)($_POST['impostos'] ?? 2000); + $pedagio = (float)($_POST['pedagio'] ?? 50); + $duracao_contrato = (int)($_POST['duracao_contrato'] ?? 12); + + // --- SIMULATION INPUTS --- + + $valor_contrato_manual = (float)($_POST['valor_contrato_manual'] ?? 0); + $n_simulacoes = (int)($_POST['n_simulacoes'] ?? 0); + $variabilidade = (float)($_POST['variabilidade'] ?? 0); + + // --- CALCULATION FUNCTIONS --- + + function custo_onibus($diesel, $oleo, $pneu_novo, $pneu_recap, $pecas) { + return ($diesel * 0.33) + ($oleo / 15000) + ($pneu_novo / 50000 * 2) + ($pneu_recap / 50000 * 4) + $pecas; + } + + function custo_fixo($motorista, $escritorio, $taxas, $impostos, $pedagio, $valor_veiculo, $n_motorista, $n_dias) { + return ($motorista * $n_motorista) + $escritorio + $taxas + $impostos + ($pedagio * $n_dias) + ($valor_veiculo * 0.031); + } + + function custo_variavel($custo_onibus_val, $n_dias, $rota) { + return $custo_onibus_val * $n_dias * $rota; + } + + // --- PROCESS BASE DATA --- + + $custo_onibus_B = custo_onibus($diesel, $oleo, $pneu_novo, $pneu_recap, $pecas); + $custo_fixo_B = custo_fixo($motorista, $escritorio, $taxas, $impostos, $pedagio, $valor_veiculo, $n_motorista, $n_dias); + $custo_variavel_B = custo_variavel($custo_onibus_B, $n_dias, $rota); + $custo_total_B = $custo_fixo_B + $custo_variavel_B; + $valor_contrato_sugerido = $custo_total_B * 1.06; + + $results = [ + 'custo_por_km' => $custo_onibus_B, + 'custo_fixo_mensal' => $custo_fixo_B, + 'custo_variavel_mensal' => $custo_variavel_B, + 'custo_total_mensal' => $custo_total_B, + 'valor_contrato_sugerido' => $valor_contrato_sugerido, + ]; + + // --- RUN SIMULATION --- + + if ($n_simulacoes > 0 && $valor_contrato_manual > 0) { + $custos_simulados = []; + $lucros_simulados = []; + + for ($i = 0; $i < $n_simulacoes; $i++) { + // Get random values for variables + $diesel_sim = get_random_value($diesel, $variabilidade); + $pecas_sim = get_random_value($pecas, $variabilidade); + $rota_sim = get_random_value($rota, $variabilidade); + + // Recalculate costs with simulated values + $custo_onibus_sim = custo_onibus($diesel_sim, $oleo, $pneu_novo, $pneu_recap, $pecas_sim); + $custo_variavel_sim = custo_variavel($custo_onibus_sim, $n_dias, $rota_sim); + $custo_total_sim = $custo_fixo_B + $custo_variavel_sim; // Assuming fixed costs don't vary + + $lucro_sim = $valor_contrato_manual - $custo_total_sim; + + $custos_simulados[] = $custo_total_sim; + $lucros_simulados[] = $lucro_sim; + } + + $simulation_results = [ + 'ecdf_custo' => generate_ecdf_data($custos_simulados), + 'ecdf_lucro' => generate_ecdf_data($lucros_simulados), + ]; + } +} + +function format_currency($value) { + return 'R$ ' . number_format($value, 2, ',', '.'); +} ?> - - + + - - - New Style - - - - + + + Análise de Custos de Veículo + + + + + + + -
-
-

Analyzing your requirements and generating your website…

-
- Loading… -
-

AI is collecting your requirements and applying the first changes.

-

This page will update automatically as the plan is implemented.

-

Runtime: PHP — UTC

-
-
- + +
+

🚌 Análise de Custos de Veículo

+
+ +
+
+
+
+

Entrada de Dados

+
+ +
Informações do Contrato e Veículo
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ +
Custos de Operação (por KM)
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ +
Custos Fixos Mensais
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ +
Parâmetros da Simulação
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+
+
+

Resultados

+ +
+ Custo por KM: + +
+
+ Custo Fixo Mensal: + +
+
+ Custo Variável Mensal: + +
+
+ Custo Total Mensal: + +
+
+
+ Valor Sugerido do Contrato: + +
+
+ + +
+

Análise de Simulação

+
+ +
+
+ +
+ + + +

Preencha os dados para ver os resultados.

+ +
+
+
+
+ + + + + + + + +