<script>
function calculate() {
  var sales = document.getElementById("sales").value;
  var expenses = document.getElementById("expenses").value;
  var initial_stock = document.getElementById("initial_stock").value;
  var final_stock = document.getElementById("final_stock").value;

  var CMV = expenses + initial_stock - final_stock;
  var CMV = CMV / sales;
  var CMC = expenses / sales;

  if (31 <= (CMV * 100) <= 42) {
    document.getElementById("warning").innerHTML = "Cuidado, a saúde de sua loja está em risco.";
  } else {
    document.getElementById("warning").innerHTML = "";
  }

  document.getElementById("CMV").innerHTML = "{:.2f}%".format(