-1
I am very layman in javascript, but I think you can do this in this language. I tried it in a very trivial way, but I did not succeed. Basically I have a system that converts the amount into kg for boxes of cookies, for example:
function bisc_salg(){
p3 = document.getElementById("multiplicando3").value;
p4 = document.getElementById("multiplicador3").value;
r = p3/p4;
document.getElementById("resultado3").value = r.toFixed(3);
}
<form id="bisc_salg" class="box_Branco">
<p class="desc_item"> Biscoito Salgado Cream Cracker </p>
<input type="text" placeholder="Qtde." class="qtde_Req" id="multiplicando3" onChange="bisc_salg();">
<input type="text" class="invisible" id="multiplicador3" readonly="readonly" value=4.8 onChange="bisc_salg();"> =
<input type="text" class="retorno" id="resultado3" readonly="readonly"> caixas
</form>
Let’s assume that I have 14.8 kg and playing in this system I get: 3,083 which means 3 whole boxes and a packet of biscuits. That is, each package has 400 grams. How do I take this rest of the decimal place and convert into packages? More or less would have to return:
3 boxes and 1 package.
The summary data are: Each box has 12 packets of cookies and 4.8 Kg; each cookie has 400 grams.
I think this bill is wrong. If a package has 200g, apart from the extra package, it would be 19kg, that is 19,000 grams... dividing by 200g of each package, that’s 95 packages, so you can’t divide 95 into 3 boxes.
– Sam
I’m sorry, I’ve already made the correction.
– Thiago Vinícius