Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Master Detail form update and calculation

anand_gpApr 11 2018

Hello,

I have a Master-Detail form for Purchase Bill entry. A seperate HTML region (ADD NEW ITEM region in below image) accepts Item details and "Add Item" button will add that record to Detail Table.

Dynamic Action on "Add Item" adds item details to DETAIL table (and saves). Next True Action on DA calculates sum of "AMOUNT" column in DETAIL and then updates "Round Off" and "Tot. Amt" columns of MASTER Table (and saves). Next, page submit action will refresh the page to show all details.

Calculation => SUM(AMOUNT) from detail table + PACKING from master table = TOTAL_AMOUNT in Master table (excluding Round Off.)

Everything works fine so far. If user has entered "Packing" value (Master region) while creation of Master Record, the "Add Item" pl/sql codes takes care of that value during calculation.

However, when user finishes adding all records to DETAIL region and then want to change "Packing" value, it has to update "Round Off" and "Tot. Amt" fields accordingly. And SAVE button on MASTER region should save that changes.

I know that, there is no need to save TOTAL-AMOUNT and ROUND-OFF value in DB because they are auto calculated. If not saved in DB, then the issue I am talking here doesn't araise. But I need to save these value to DB because of future reference, as business logic to calculate DETAIL calculation doesn't remain same always.

My need is, if user changes PACKING value, the changes to "Round Off" and "Tot. Amt" column has to happen. Probably it can be done using DA. But challenge here is, if user changes value of QUANTITY column (multiple records) in detail region, the javascript will calculate "Amount" column (in detail region), and then, SAVE button on MASTER region has to save the record and at the same time, it also has to re-calculates TOTAL-AMOUNT and ROUND-OFF of Master Table, which I am not able to achieve.

I am finding it little messed up in achiving the result. Probably I might have not definined the page (or logic) properly? Can someone help me to understand how both Master and Detail changes to be saved as well as the calcuation to happen at the same time?

pastedImage_0.png

Thanks,

-Anand

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 9 2018
Added on Apr 11 2018
0 comments
48 views