Carregando WebR...
# ============================================ # Custo Economico vs. Custo Contabil # ============================================ # Caso: confeitaria artesanal em BH (Exercicio 11.1) # --- Dados --- receita <- 480000 ingredientes <- 120000 aluguel <- 60000 salarios_func <- 96000 pro_labore <- 48000 # Custos implicitos salario_alternativo <- 84000 # oferta como chef capital_proprio <- 200000 # valor dos equipamentos taxa_retorno <- 0.10 # retorno alternativo # --- Calculos --- custos_explicitos <- ingredientes + aluguel + salarios_func + pro_labore custo_oport_trabalho <- salario_alternativo - pro_labore custo_oport_capital <- capital_proprio * taxa_retorno custos_implicitos <- custo_oport_trabalho + custo_oport_capital custo_economico <- custos_explicitos + custos_implicitos lucro_contabil <- receita - custos_explicitos lucro_economico <- receita - custo_economico cat("========== DEMONSTRATIVO DE CUSTOS ==========\n\n") cat("RECEITA TOTAL:", formatC(receita, format="f", big.mark=".", decimal.mark=",", digits=0), "\n\n") cat("--- Custos Explicitos ---\n") cat(" Ingredientes: ", formatC(ingredientes, format="f", big.mark=".", decimal.mark=",", digits=0), "\n") cat(" Aluguel: ", formatC(aluguel, format="f", big.mark=".", decimal.mark=",", digits=0), "\n") cat(" Salarios: ", formatC(salarios_func, format="f", big.mark=".", decimal.mark=",", digits=0), "\n") cat(" Pro-labore: ", formatC(pro_labore, format="f", big.mark=".", decimal.mark=",", digits=0), "\n") cat(" TOTAL EXPLICITO: ", formatC(custos_explicitos, format="f", big.mark=".", decimal.mark=",", digits=0), "\n\n") cat("--- Custos Implicitos ---\n") cat(" Custo oport. trabalho:", formatC(custo_oport_trabalho, format="f", big.mark=".", decimal.mark=",", digits=0), "\n") cat(" Custo oport. capital: ", formatC(custo_oport_capital, format="f", big.mark=".", decimal.mark=",", digits=0), "\n") cat(" TOTAL IMPLICITO: ", formatC(custos_implicitos, format="f", big.mark=".", decimal.mark=",", digits=0), "\n\n") cat("--- Resultados ---\n") cat(" CUSTO ECONOMICO TOTAL:", formatC(custo_economico, format="f", big.mark=".", decimal.mark=",", digits=0), "\n") cat(" Lucro contabil: ", formatC(lucro_contabil, format="f", big.mark=".", decimal.mark=",", digits=0), "\n") cat(" Lucro economico: ", formatC(lucro_economico, format="f", big.mark=".", decimal.mark=",", digits=0), "\n\n") if (lucro_economico > 0) { cat("=> Lucro economico POSITIVO: a confeitaria remunera\n") cat(" todos os fatores acima do custo de oportunidade.\n") cat(" Decisao racional: MANTER o negocio.\n") } else if (lucro_economico == 0) { cat("=> Lucro NORMAL: a firma remunera exatamente\n") cat(" o custo de oportunidade de todos os fatores.\n") } else { cat("=> Lucro economico NEGATIVO: os recursos renderiam\n") cat(" mais em uso alternativo. Considerar fechar.\n") } # --- Grafico comparativo --- par(mar = c(5, 5, 3, 2), bg = "#f8f9fa") dados <- matrix(c(custos_explicitos, custos_implicitos, 0, custos_explicitos, 0, 0), nrow=3) cores <- c("#dc3545", "#fd7e14", "#d4d4d4") bp <- barplot(dados, beside = FALSE, names.arg = c("Custo\nEconomico", "Custo\nContabil"), col = cores[1:3], border = NA, ylim = c(0, receita * 1.15), ylab = "R$", main = "Custo Economico vs. Contabil", cex.names = 1.1, cex.lab = 1.1, las = 1) # Linhas de receita e lucros abline(h = receita, col = "#198754", lwd = 2, lty = 2) text(mean(bp), receita, paste0("Receita = R$ ", formatC(receita/1000, format="f", digits=0), "k"), pos = 3, col = "#198754", font = 2, cex = 0.9) # Anotacoes de lucro arrows(bp[1], custo_economico, bp[1], receita, code = 3, col = "#0d6efd", lwd = 2, length = 0.08) text(bp[1], (custo_economico + receita)/2, paste0("Lucro econ.\nR$ ", formatC(lucro_economico/1000, format="f", digits=0), "k"), col = "#0d6efd", font = 2, cex = 0.85) arrows(bp[2], custos_explicitos, bp[2], receita, code = 3, col = "#6f42c1", lwd = 2, length = 0.08) text(bp[2], (custos_explicitos + receita)/2, paste0("Lucro contab.\nR$ ", formatC(lucro_contabil/1000, format="f", digits=0), "k"), col = "#6f42c1", font = 2, cex = 0.85) legend("topright", legend = c("Custos explicitos", "Custos implicitos"), fill = cores[1:2], border = NA, cex = 0.9, bg = "white")
▶ Executar
↻ Resetar
(Aguardando WebR...)