daily pastebin goal
26%
SHARE
TWEET

Untitled

a guest Nov 22nd, 2017 41 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <apex:outputPanel id="out">    
  2. <b><apex:outputText style="text-align:right;font-size:15px;color:black" value="Average Risk Score"/> &nbsp; &nbsp; <apex:outputText style="text-align:right;font-size:14px;color:blue" value="{!Account_Summary__c.Average_Risk_Score__c}"/> </b>                                  
  3. <b><apex:outputText style="text-align:right;font-size:15px;color:black" /> &nbsp; &nbsp; <apex:outputText style="text-align:right;font-size:14px;color:blue" value="{!averageTotalRisk}" rendered="{ISBLANK({!averageTotalRisk})}" />  </b>          
  4. </apex:outputPanel>      
  5. <br></br> <br></br>  
  6.   <table class="htmlRiskTable">
  7.            <tr valign="center">
  8.               <td>
  9.               <apex:outputText style="text-align:right;font-size:12px;color:blue" value="Underwriting Audit Risk Score" title="Seasoned UW department, well managed, good controls, good documentation, good pricing decisions vs. inexperienced staff, lack of management controls, poor documentation, unjustified price cutting"/>
  10.               </td>
  11.               <td>
  12.                 <apex:selectRadio id="Radio1" value="{!Account_Summary__c.Risk1__c}" style="margin-top: -10px;">
  13.                 <apex:actionSupport event="onchange" rerender="out" action="{!calculateaverageRisk}"/>                
  14.                  <apex:selectOptions value="{!AuditItems}"/>
  15.                 </apex:selectRadio>
  16.               </td>
  17.              </tr>
  18.    
  19. public List<SelectOption> getAuditItems() {
  20.     List<SelectOption> options = new List<SelectOption>();
  21.     options.add(new SelectOption('0', 'No Audit in the Last 3 Years'));
  22.     options.add(new SelectOption('0', 'Poor'));
  23.     options.add(new SelectOption('5', 'Average'));
  24.     options.add(new SelectOption('10', 'Superior'));
  25.     return options;
  26. }
  27.  
  28. //calculate the average risk based on the logic
  29. Public void calculateaverageRisk() {
  30.     if ((AccountSummary.Risk1__c == null) || (AccountSummary.Risk2__c == null) || (AccountSummary.Risk3__c == null) || (AccountSummary.Risk4__c == null) || (AccountSummary.Risk5__c == null) || (AccountSummary.Risk6__c == null) || (AccountSummary.Risk7__c == null) || (AccountSummary.Risk8__c == null) || (AccountSummary.Risk9__c == null) || (AccountSummary.Risk10__c == null)) {
  31.         averageTotalRisk = 'Select a score fore every risk.';
  32.     } else {
  33.         TotalRisk = ((integer.valueof(AccountSummary.Risk1__c) + integer.valueof(AccountSummary.Risk2__c) + integer.valueof(AccountSummary.Risk3__c) + integer.valueof(AccountSummary.Risk4__c) + integer.valueof(AccountSummary.Risk5__c) + integer.valueof(AccountSummary.Risk6__c) + integer.valueof(AccountSummary.Risk7__c) + integer.valueof(AccountSummary.Risk8__c) + integer.valueof(AccountSummary.Risk9__c) + integer.valueof(AccountSummary.Risk10__c)));
  34.         Integer TotalRiskCalc = Integer.valueOf((TotalRisk / 100)*100);
  35.         averageTotalRisk = string.valueof(TotalRiskCalc);
  36.         this.AccountSummary.Average_Risk_Score__c = TotalRiskCalc;
  37.     }
  38. }
RAW Paste Data
Top