function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Mick ManMick Man 

controller class

how the class if I want to calculate the amount of MP by product,
that is to say, I want to calculate the result Quantity x number of product
<apex:page standardController="Ordre_Travail__c" extensions="OdtDetailController2">
    <apex:pageBlock >
        <apex:pageBlockTable value="{!Odtwrapper}" var="odt">
            <apex:column value="{!odt.ODT.name}"/>
            <apex:column value="{!odt.ODT.Date__c}"/>
            <apex:column value="{!odt.ODT.Produit__c}"/>
            <apex:column value="{!odt.ODT.Nombre__c}"/>
        </apex:pageBlockTable>
            <apex:pageblocktable value="{!Jonintwrapper}" var="joint">
                  <apex:column value="{!joint.JOINT.MatierePremiere__c}" />
                  <apex:column value="{!joint.JOINT.Quantite__c}" />
          </apex:pageblocktable>
    </apex:pageBlock>
</apex:page>
public class OdtDetailController2 
    {

       
         public list<wrapperclass> Jonintwrapper{get;set;}
         public list<wrapperclass> Odtwrapper{get;set;}
         
         public OdtDetailController2(ApexPages.StandardController controller) 
             {
                 list<Ordre_Travail__c> OrdreTravail = [SELECT id, name, Date__c, Produit__c, Nombre__c FROM Ordre_Travail__c WHERE produit__c = 'a0Ic000000DCvwEEAT'];
                 list<JointMatProd__c> Jointure = [SELECT id, MatierePremiere__c, Quantite__c FROM JointMatProd__c WHERE produit__c = 'a0Ic000000DCvwEEAT'];
             
                 Odtwrapper = new list<wrapperclass>();
                 for(Ordre_Travail__c Odt: OrdreTravail)
                     {
                        Odtwrapper.add(new wrapperclass(Odt));
                     }
                     
                 Jonintwrapper = new list<wrapperclass>();
                 for(JointMatProd__c Joint: Jointure)
                     {
                        Jonintwrapper.add(new wrapperclass(Joint));
                     }
              }
    
              public class wrapperclass
                  {
                       public Ordre_Travail__c ODT{get;set;}
                       public JointMatProd__c JOINT{get;set;}
                       
                       public wrapperclass(Ordre_Travail__c OrdreTravail) 
                           {
                                this.ODT = (OrdreTravail);
                           }
                           
                       public wrapperclass(JointMatProd__c Joint) 
                           {
                                this.JOINT = (Joint);
                           }
                  }    
    }


 
SonamSonam (Salesforce Developers) 
I see you are using a Wrapper Class and are displaying a list products? How do you wish to calculate the Quantity of product? are you selecting the products on the VF?