Thursday, 29 December 2016

Calculating Sum of 2 or More Fields in Oracle Apex



Step 1:
Create all the items which you need to calculate
Step 2:
In items level
Element à HTML Form Element Attributes à Call a function on Key up
onkeyup="total();"
Step 3:
Create the function in page header level
function total()
{
$("#P7_TOTAL_COST").attr("value",
    ($("#P7_EX_SHOW_ROOM_COST").val().trim() == "" ? 0 : parseFloat($("#P7_EX_SHOW_ROOM_COST").val())) +
    ($("#P7_ROAD_TAX_LIFE_TAX").val().trim() == "" ? 0 : parseFloat($("#P7_ROAD_TAX_LIFE_TAX").val())) +
    ($("#P7_REGISTRATION_CHARGES").val().trim() == "" ? 0 : parseFloat($("#P7_REGISTRATION_CHARGES").val())) +
    ($("#P7_OTHER_CHARGES").val().trim() == "" ? 0 : parseFloat($("#P7_OTHER_CHARGES").val())) -
    ($("#P7_DISCOUNTS").val().trim() == "" ? 0 : parseFloat($("#P7_DISCOUNTS").val()))
);
}

By
A.Arun Kumar

No comments:

Post a Comment