+ Start a Discussion

Need help on VF display



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!



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