You are on page 1of 2

Vf page

Css;Table..
Controller
Quote
Quote Line Item
Quote-> Account

Total
Encapulation -> blue print;unit;data bining;

<apex:page controller="QuoteGenerate">

</apex:page>
<apex:page extenstion="QuoteGenerate" standardController="Quote">
{!wrapper.qutObj.account.name}
{!wrapper.qutObj.contact.BillingAddress}
{!wrapper.qutObj.createdDate}
<table>
<thead>
<tr>

</tr>
</thead>
<tbody>
<apex:repeat value="{!wrapper.qutObj.qtLineLst}"
var="lineItemRec">
<tr>
<td>{!lineItemRec.Name}</td>
<td>{!lineItemRec.Product.Name}</td>
</tr>
</apex:repeat>
</tbody>
</table>
</apex:page>

public class QuoteGenerate{


public QuoteWrapper wrapper{get;set;}
public QuoteGenerate(StandardController stObj){
Id recId = stObj.getRecordId();

wrapper = new QuoteWrapper(recId);

}
public class QuoteWrapper{
public static Quote qutObj{get;set;}
public static QuoteLineItem qtLineLst{get;set;}
public static Decimal subTotal{get;set;}
public static Decimal grandTotal{get;set;}
public static Decimal totalTotal{get;set;}
public QuoteWrapper(){
qutObj = new Quote();
qtLineLst = new List<QuoteLineItem>();
subTotal = 0;
grandTotal = 0;
totalTotal = 0;
}
public QuoteWrapper(Id quoteId){
qutObj = [select
id,account.name,contact.BillingAddress,createdDate,(select id,Product.Name,name
from QuoteLineItems) from Quote where id = : quoteId];
qtLineLst = qutObj.QuoteLineItems;
subTotal = 0;
grandTotal = 0;
totalTotal = 0;
for(QuoteLineItem itemObj : qtLineLst ){
subTotal = subTotal + itemObj.quantity * itemObj.unitPrice;
Total = subTotal + itemObj.quantity * itemObj.unitPrice;
totalTotal = subTotal + itemObj.quantity *
itemObj.unitPrice;
}
}
}
}

You might also like