Advertisement
Guest User

Untitled

a guest
Apr 24th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.66 KB | None | 0 0
  1. public class Medical_Equipment_ControllerCls {
  2.  
  3. public decimal totalAmount {get;set;}
  4. public decimal temp = 0;
  5. set<id> getid = new set<id>();
  6. public Medical_Equipment_ControllerCls(ApexPages.StandardController controller)
  7. {
  8. Medical_Equipment__c med = new Medical_Equipment__c();
  9. for(Medical_Equipment__c medical : [select name, Amount__c,Equipment_for_Department__c from Medical_Equipment__c])
  10. {
  11. getid.add(medical.Equipment_for_Department__c);
  12. }
  13. List<Medical_Equipment__c> lstmedical = [select Amount__c, Equipment_for_Department__c from Medical_Equipment__c where id in : getid and amount__c != null];
  14. for(Medical_Equipment__c medicalequp : lstmedical)
  15. {
  16. temp = temp + medicalequp.Amount__c;
  17. totalAmount = temp;
  18. }
  19.  
  20. }
  21. }
  22.  
  23. Select SUM(TotalAmount__c) from Department__c
  24.  
  25. public class Medical_Equipment_ControllerCls {
  26.  
  27. public decimal totalAmount {get;set;}
  28. public decimal temp = 0;
  29. set<id> getid = new set<id>();
  30. public Medical_Equipment_ControllerCls(ApexPages.StandardController controller)
  31. {
  32. Medical_Equipment__c med = new Medical_Equipment__c();
  33.  
  34. //****** Notice the changes in following query*****
  35. List<Medical_Equipment__c> lstmedical = [select Amount__c, Equipment_for_Department__c from Medical_Equipment__c where Equipment_for_Department__c!=null and amount__c != null];
  36.  
  37. for(Medical_Equipment__c medicalequp : lstmedical)
  38. {
  39. temp = temp + medicalequp.Amount__c;
  40. totalAmount = temp;
  41. }
  42.  
  43. }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement