I need if you can help me with a simple algorithm in whatever language,
I have the following I have a existencia=3 , I have a two rows that have saldo=1 , saldo=3 , precio_uni=154.16 , precio_uni=116 .
Well what I have to do is go through saldo that have 1 and since it is not equal to existencia I pass the 154.16 of precio , then I pass the second saldo that has 3 but to equal the 3 of existencia I only occupy 2 of saldo and I raise the precio I wanted to add twice 116 to give me 154.16 + 116 + 116 and like this already the saldos with the existencia
If someone can help me with logic