Hi All...
So I have a Grid with only a Grid Part. On the Grid Part I have the following items:
Total_Premium
Num_Of_Payments - Dropdown with values 1-9
Installment_Pmnt1
Installment_Pmnt2
Installment_Pmnt3
Installment_Pmnt4
Installment_Pmnt5
Installment_Pmnt6
Installment_Pmnt7
Installment_Pmnt8
Installment_Pmnt9
Difference_Calc
What I'm attempting to do is calculate the payment amounts based off of the Total Premium / Number of Payments. This part is simple. Where the challenge becomes is if the number does not divide evenly.
For Example - $1000 (Total_Premium) / 3 (Num_of Payments) you get $333.33333333333
I set the value to Round so the field displays $333.33 for the 3 payments. However this adds up to $999.99. I then added a field called Differenc_Calc that calculates the missing penny.
All of this works properly except I cannot figure out how to add the Penny back to the first payment. Since it is a client side calculation the number in the first field keeps "flashing" as it keeps running the field calculations over and over again. So this won't work: Total_Premium/Num_of_Payments + Difference_Calc
Any suggestions? I was trying to figure out a Button that runs a Javascript calculation 1 time but I'm failing at that as suck at Javascript (for now...)...that script looks like:
Thanks
Joe
So I have a Grid with only a Grid Part. On the Grid Part I have the following items:
Total_Premium
Num_Of_Payments - Dropdown with values 1-9
Installment_Pmnt1
Installment_Pmnt2
Installment_Pmnt3
Installment_Pmnt4
Installment_Pmnt5
Installment_Pmnt6
Installment_Pmnt7
Installment_Pmnt8
Installment_Pmnt9
Difference_Calc
What I'm attempting to do is calculate the payment amounts based off of the Total Premium / Number of Payments. This part is simple. Where the challenge becomes is if the number does not divide evenly.
For Example - $1000 (Total_Premium) / 3 (Num_of Payments) you get $333.33333333333
I set the value to Round so the field displays $333.33 for the 3 payments. However this adds up to $999.99. I then added a field called Differenc_Calc that calculates the missing penny.
All of this works properly except I cannot figure out how to add the Penny back to the first payment. Since it is a client side calculation the number in the first field keeps "flashing" as it keeps running the field calculations over and over again. So this won't work: Total_Premium/Num_of_Payments + Difference_Calc
Any suggestions? I was trying to figure out a Button that runs a Javascript calculation 1 time but I'm failing at that as suck at Javascript (for now...)...that script looks like:
Code:
var totalPremium={grid.Object}.getValue('G','TOTAL_PREMIUM',{grid.RowNumber}); var numPayments={grid.Object}.getValue('G','NUM_OF_PAYMENTS',{grid.RowNumber}); var newPayment1=totalPremium/numPayments; {grid.Object}.setValue('G','INSTALLMENT_PMNT1',{grid.RowNumber},newPayment1);
Thanks
Joe
Comment