Home » Developer & Programmer » Forms » Distribute Master block Total amount in Detail block Line wise (oracle form 6i, winxp)
Distribute Master block Total amount in Detail block Line wise [message #553478] Sat, 05 May 2012 00:17 Go to next message
hissam78
Messages: 193
Registered: August 2011
Location: PAKISTAN
Senior Member
dear all,
i have a master detail form, In Master block we have one field cheque amount and in Detail block we have field receiveable amount invoice wise. if company paid us a cheque amount we will enter this amount in Master block field Cheque amount and in detail block there will be invoice wise receivable amounts. so i want to distribute the cheque amount in detail block invoice wise
for example

Cheque amount in master block = 291

Invoice wise receiveable amount is as follows

Invoice No , receivable amount , Received amount

10 , 196 , 0
20 , 95 , 0
30 , 54 , 0


Result should be as follows:

Invoice No , receivable amount , Received amount

10 , 196 , 196
20 , 95 , 95
30 , 54 , 0

Received amount field should be distributed according to the receivable amount when recevied amount = cheque amount then remaining will be 0.

Some body can help me to acheive this goal.


thanx

regards
Re: Distribute Master block Total amount in Detail block Line wise [message #553482 is a reply to message #553478] Sat, 05 May 2012 01:20 Go to previous messageGo to next message
Littlefoot
Messages: 21813
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Here's one idea: put master block's amount into a parameter:
:parameter.total_amount := :master_block.cheque_amount;

Loop through detail block records and set received amount, such as
loop
  ...
  if :parameter.total_amount >= :detail_block.receivable_amount then
     :detail_block.received_amount := :detail_block.receivable_amount;
     :parameter.total_amount := :parameter.total_amount - :detail_block.receivable_amount;
  else
     :detail_block.received_amount := :detail_block.received_amount - :parameter.total_amount;
     exit;
  end if;

  next_record;
  ...
end loop;


A question: how will you handle situations where :master_block.cheque_amount > sum(:detail_block.receivable_amount)?
Re: Distribute Master block Total amount in Detail block Line wise [message #553483 is a reply to message #553482] Sat, 05 May 2012 01:42 Go to previous message
hissam78
Messages: 193
Registered: August 2011
Location: PAKISTAN
Senior Member
Littlefoot you are great you have resolved my issue in a moment, got it.

thanx a lot Boss

great help


regards,
Previous Topic: Frm-41009 function key not allowed ,press ctrl+k for list of valid values when press F11
Next Topic: How to generate excel in oracle forms 11g?????
Goto Forum:
  


Current Time: Fri Jul 05 22:34:25 CDT 2024