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
domdickdomdick 

Need help on VF display

Hello,

 

I have an opportunity with OLI item added and i would like display line item on VF page with subtotal and minus discount (if any) number. I am struggling to write a query results / produce solution to display below.

 

VF should display:

Service   ListPrice   Discount  Terms  TotalPrice

TEst1      480           10%         5          2400.00

Test2       500            5%          10        5000.00

Test3       100            0%          10        1000.00

 

SubTotal                                              8400.00

Discount number                                -  740.00   (This number based on if there is any discount applicable from above OLI)

 

Thanks a lot for helping me here!

 

asish1989asish1989

use query like this

 

List<Opportunity> opptList = [SELECT Id, Name,
                                                               (
                                                                   SELECT Id, Name,all necessary field,
                                                                       FROM OpportunityProducts
                                                               )
                                                       FROM Opportunity
                                                   WHERE id=:OpptId]

Devender MDevender M

There is no direct query to get values.
Query the opp line in list(lisofOppLine) display that list.

public decimal SubTotal{get;set;}
public decimal Discountnumber {get;set;}

 


SubTotal = 0;
Discountnumber = 0;
for(OpportunityLineItem op : lisofOppLine) {
SubTotal = SubTotal + op.TotalPrice;
Discountnumber = Discountnumber + /// similary for discount
}

and bind with output text