Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Medical_Equipment_ControllerCls {
- public decimal totalAmount {get;set;}
- public decimal temp = 0;
- set<id> getid = new set<id>();
- public Medical_Equipment_ControllerCls(ApexPages.StandardController controller)
- {
- Medical_Equipment__c med = new Medical_Equipment__c();
- for(Medical_Equipment__c medical : [select name, Amount__c,Equipment_for_Department__c from Medical_Equipment__c])
- {
- getid.add(medical.Equipment_for_Department__c);
- }
- List<Medical_Equipment__c> lstmedical = [select Amount__c, Equipment_for_Department__c from Medical_Equipment__c where id in : getid and amount__c != null];
- for(Medical_Equipment__c medicalequp : lstmedical)
- {
- temp = temp + medicalequp.Amount__c;
- totalAmount = temp;
- }
- }
- }
- Select SUM(TotalAmount__c) from Department__c
- public class Medical_Equipment_ControllerCls {
- public decimal totalAmount {get;set;}
- public decimal temp = 0;
- set<id> getid = new set<id>();
- public Medical_Equipment_ControllerCls(ApexPages.StandardController controller)
- {
- Medical_Equipment__c med = new Medical_Equipment__c();
- //****** Notice the changes in following query*****
- 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];
- for(Medical_Equipment__c medicalequp : lstmedical)
- {
- temp = temp + medicalequp.Amount__c;
- totalAmount = temp;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement