This topic is locked

How to calculate values ​​of the child form within parent

9/12/2011 8:31:33 PM
PHPRunner Tips and Tricks
milver author

Hello, my name is Silva and I am Milvia Brazilian

so sorry my English my project follows: http://demo.asprunner.net/milvercastro_ig_com_br/Guapa/login.php
Nome de usuario: admin

Senha: admin
I have two problems:
1 - In the menu below VENDAS/ITENS DA VENDA


How to how to calculate values ​​on the fly works perfectly, as shown in the image below


has the following menu: Vendas / Venda


Where there are two tables in the same form (VENDAS / ITEMVENDA) being VENDASto the parent table and child table ITEMVENDA. When I try to record a new insecurity in the child table (ITEMVENDA) the value is not calculated in real time as shown in image below:


2 - If the above problem is resolved, I wonder if it would be possible to perform this operation: sum the values ​​of the PRECOfield is as adding ITEMVENDArecords in the table, calculating the field TOTAL**VENDAStable is subtracted from the DESCONTO**field, this being done in real time as shown in image below:


Already thank you and hope you can help me ...

P
Pierre DAC 9/13/2011

I'm interested too by the solution.

Thank you.



Hello, my name is Silva and I am Milvia Brazilian

so sorry my English my project follows: http://demo.asprunner.net/milvercastro_ig_com_br/Guapa/login.php
Nome de usuario: admin

Senha: admin
I have two problems:
1 - In the menu below VENDAS/ITENS DA VENDA


How to how to calculate values ​​on the fly works perfectly, as shown in the image below


has the following menu: Vendas / Venda


Where there are two tables in the same form (VENDAS / ITEMVENDA) being VENDASto the parent table and child table ITEMVENDA. When I try to record a new insecurity in the child table (ITEMVENDA) the value is not calculated in real time as shown in image below:


2 - If the above problem is resolved, I wonder if it would be possible to perform this operation: sum the values ​​of the PRECOfield is as adding ITEMVENDArecords in the table, calculating the field TOTAL**VENDAStable is subtracted from the DESCONTO**field, this being done in real time as shown in image below:


Already thank you and hope you can help me ...

E
ericholiveira 9/13/2011

Olá Milver Silva,
Você pode usar o javascript para calcular os campos automaticamente.
//



var desconto = Runner.getControl(pageid, 'DESCONTO');

desconto.on("click", function(e){



document.getElementById("value_TOTAL_1").value =(document.getElementById("total2_PRECO").innerHTML - document.getElementById("value_DESCONTO_1").value);



});
milver author 9/13/2011

Endenti... Só que só poderei passar para esta segunda situação quando conseguir resolver a primeira, que é deu não conseguir fazer com que seja realizado o cálculo em tempo real "In Line" quando insiro o ITEMVENDAdentro da VENDA, resolvendo isso, aí concerteza o seu código irá funcionar perfeitamente para o meu projeto. Mais muito obrigado pelo ajuda. Você já viu o meu projeto como está? Em relação a minha primeira dúvida? Se poderes me ajudar ficarei muito agradecido...>

Olá Milver Silva,
Você pode usar o javascript para calcular os campos automaticamente.
//



var desconto = Runner.getControl(pageid, 'DESCONTO');

desconto.on("click", function(e){
document.getElementById("value_TOTAL_1").value =(document.getElementById("total2_PRECO").innerHTML - document.getElementById("value_DESCONTO_1").value);
});