You need to sign in to do that
Don't have an account?
Soundar Rajan Ponpandi
Entered Amount Calculating With Percentage
Dears,
I need to display an amount in table <Td> (calculating With Percentage - This value also available <td> in same row <tr>).
Step 1 : Enter An Amount (Example : 1000)
Step2 : Entered Amound need to Calculate with Percentage (Example : 10% (10/100) * 1000)
Step 3 : Calculated Amount should be display in another <Td>.
Thanks In Advance.
Regards,
Soundar.
I need to display an amount in table <Td> (calculating With Percentage - This value also available <td> in same row <tr>).
Step 1 : Enter An Amount (Example : 1000)
Step2 : Entered Amound need to Calculate with Percentage (Example : 10% (10/100) * 1000)
Step 3 : Calculated Amount should be display in another <Td>.
Controller --------------------------------------------------------------------------- public with sharing class WholeSale_User_Stories{ Public Account acc {get;set;} Public Integer EnteredAmount{get;set;} //Public Integer secondNumber{get;set;} Public Integer result{get;set;} Public List<Exposure_Limit_WS__c> expLimitList{get;Set;} public WholeSale_User_Stories(ApexPages.StandardSetController controller) { } public WholeSale_User_Stories() { expLimitList = [Select id,name ,Particulars__c,Standard_Limit_Percentage__c From Exposure_Limit_WS__c]; acc = New Account(); /*for(Exposure_Limit_WS__c expLimit : expLimitList){ stanPer = expLimit.Standard_Limit_Percentage__c; }*/ } Public PageReference init(){ EnteredAmount = 0; //secondNumber = 0; result = 0; return Null; } Public PageReference doSum(){ EnteredAmount= EnteredAmount== Null ? 0 : EnteredAmount; //secondNumber = secondNumber == Null ? 0 : secondNumber; System.debug('************Entered Amount ' + EnteredAmount); result = EnteredAmount; //test System.debug('############result | ' + result); return Null; } //Wrapper Class /*Public Class WholeSaleWrapper{ Public double StandardLimitPercent; public WholeSaleWrapper(Exposure_Limit_WS__c exp){ StandardLimitPercent = exp.Standard_Limit_Percentage__c; } }*/ }
VF Page -------------------------------------------------------------------- <apex:page sidebar="False" showHeader="False" controller="WholeSale_User_Stories"> <apex:form id="frm"> <html> <head> <!-- Bootstrap Online Link --> <!-- Latest compiled and minified CSS --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous" /> <!-- Optional theme --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous" /> <!-- Latest compiled and minified JavaScript --> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script> <style> </style> </head> <body> <div><br/><br/><br/><br/></div> <div class="container"> <div class="row col-sm-12" align="center"> <div class="form-group col-sm-6" align="right"> <apex:outputLabel >Selected Borrower </apex:outputLabel> <apex:inputField value="{!acc.Parentid}"/ > </div> <div class="form-group col-sm-4" > <apex:outputLabel for="theTextInput1">Enter Amount </apex:outputLabel> <apex:inputText value="{!EnteredAmount}" id="theTextInput1" /> <!--<apex:outputlabel value="Result Is : {!result}" for="theTextInput2"></apex:outputlabel > --> </div> <div class="form-group col-sm-2" align="left"> <!-- <button type="button" class="btn btn-info" styleClass="buttonStyle" style="background:#388A9D" >Calculate</button> --> <apex:commandButton action="{!doSum}" value="Calculate" style="background:#52D7F5"/> </div> <br/> <br/> </div> <table border="1" width="100%"> <!--<tr> <td colsapn="6">Owned Funds Amount INR</td> <td width="10%"></td> <td width="10%"></td> </tr> --> <tr bgcolor="#DAF3FC" style="font-weight:bold"> <td rowspan="2" colspan="2" align="center">Particulars</td> <td width="10%" rowspan="2" align="center">Standard Limit in % for Loan Company</td> <td colspan="2" align="center">Infrastructure Finance Company</td> <td colspan="2" align="center"> AFC and LC (only for Infrastructure Loan and/ or Investment)</td> <td width="17%" align="center" rowspan="2">Exposure Limits in Amount INR</td> <td align="center" rowspan="2">Exposure Limits in Amount INR ( For Non PPP projects and PPP projects Non Tripartite cases)</td> </tr> <tr bgcolor="#DAF3FC" style="font-weight:bold"> <td width="11%" align="center">Additional limit %</td> <td width="11%" align="center">Total Limit %</td> <td width="10%" align="center">Additional limit ***</td> <td width="12%" align="center">Total Limit</td> </tr> <apex:repeat value="{!expLimitList}" var="whlsl"> <tr> <td width="7%" align="center"><apex:outputText value="{!whlsl.Particulars__c}" ></apex:outputText></td> <td width="9%" align="center"><apex:outputText value="{!whlsl.Name}"></apex:outputText> </td> <td Align="center"><apex:outputText value="{!whlsl.Standard_Limit_Percentage__c}" ></apex:outputText>%</td> <td></td> <td></td> <td></td> <td></td> <td bgcolor="#E6F4C8" align="center">{!result}</td> <td bgcolor="#E6F4C8" align="center">--</td> </tr> </apex:repeat> </table> </div> <!-- Container Closed --> </body> </html> </apex:form> </apex:page>
Thanks In Advance.
Regards,
Soundar.
I think you need to code some javascript to calculate the amount and result should be displayed in <td>. I am not good at javascript coding but take a look at below code:
<script src="text/javascript">
var amount=document.getElementById('theTextInput1').value;//1000
var percentval=document.getElementById("$Component.form.outputtextid").value;//10
var result=(percentval/100)*amount;//(10/100)*1000=100.
document.getElementById("$Component.form.resultid').innerHTML=result;//100
</script>
just change the {!result} to <td><apex:outputText id="resultid" value={!result}/></td>. mark it as best answer if it would be helped.
Regards
Saidaiah.
All Answers
I think you need to code some javascript to calculate the amount and result should be displayed in <td>. I am not good at javascript coding but take a look at below code:
<script src="text/javascript">
var amount=document.getElementById('theTextInput1').value;//1000
var percentval=document.getElementById("$Component.form.outputtextid").value;//10
var result=(percentval/100)*amount;//(10/100)*1000=100.
document.getElementById("$Component.form.resultid').innerHTML=result;//100
</script>
just change the {!result} to <td><apex:outputText id="resultid" value={!result}/></td>. mark it as best answer if it would be helped.
Regards
Saidaiah.
Thanks For your Support.
Regards,
Soundar.