This topic is locked
[SOLVED]

 header detail

12/5/2018 9:32:58 AM
PHPRunner General questions
A
ayctech author

hi, would there be any way for the javascript to update in the header when the details are added?
The total price of the detail updated in the total price of the header.

admin 12/5/2018

This can be done. You can add your code to details table Add/Edit pages Javascript OnLoad event that would trigger when some values change in details record and you can perform calculations and update master record controls.
This example shows you how to calculate run your code when value of one of controls changes:

https://xlinesoft.com/phprunner/docs/show_dropdown_list_of_us_states.htm

A
ayctech author 12/5/2018

in the javascript of the header (compras) does not stretch me the total_price_detail(detalle_compras)

A
ayctech author 12/5/2018

in the javascript of the header (compras) does not stretch me the total_price_detail(detalle_compras)

admin 12/5/2018

You cannot use Javascript API to access controls from another table. You can use jQuery for this purpose:

$("input[id^=value_precio_total_compras]").val(12345);
A
ayctech author 12/6/2018

The code works correctly with separate rows,I how would sum all the Precio_total_detalle columns to add in Precio_total_compras before saving to the database

A
ayctech author 12/6/2018

solve it with this function, thanks

cantidad_comprada.on('change', function(e){

var add = 0;

$('input[id^=value_precio_total_detalle]').each(function() {

if (!isNaN($(this).val())) {

add += Number($(this).val());

}

});

$("input[id^=value_precio_total_compras]").val(add);
});