You need to sign in to do that
Don't have an account?
shakila G
My Wrapper class not returning any values?
HI All,
Am Trying show list of records from Different object Using Wrapper Class.But its not returning any values .
Kindly Help me on this
VF Page:
<apex:page renderAs="PDF" standardController="Project__c" extensions="Dispatch_Workorder_Checklist" applyBodyTag="False" ShowHeader="False" applyHtmlTag="False">
<html>
<head>
<style>
@page {
margin-top: 4cm;
margin-bottom: 2cm;
margin-right:1CM;
margin-Left:1CM;
padding: 5px;
@top-center {
content: element(header);
}
@bottom-left {
content: element(footer);
}
}
div.header {
width: 100%;
padding: 5px;
position: running(header);
}
div.footer {
display: block;
padding: 5px;
position: running(footer);
}
.pagenumber:before {
content: counter(page);
}
.pagecount:before {
content: counter(pages);
}
div.content {
border: 1px solid black;
padding: 5px;
width: 100%;
}
</style>
</head>
<!-- ==== Header=== -->
<div class="header" >
<p align="center"><b>WorkOrder Dispatch Check List</b></p>
<p align="Left"><b> Project Name: </b><apex:outputField value="{!CPWR.Name}" /></p>
<p align="Left"><b> Project Type :</b> <apex:outputField value="{!CPWR.Project_Type__c }" /></p>
<p align="Left"><b> No of Products: </b><apex:outputField value="{!CPWR.Total_Product_Qty__c}" /></p>
</div>
<!-- ==== Header=== -->
<!-- ==== Product Deatils=== -->
<apex:outputText style="page-break-Before: Avoid; white-space:nowrap" >
<div class="Content" style="position:absolute; width:100% white-space:nowrap">
<table style="font-size:13px;font-face:Arial;page-break-inside: avoid;white-space:nowrap " border="1" rules="cols" cellspacing="0" width="100%" cellpadding="0" >
<tr height="30" width="100%" style="font-family: sans-serif; white-space:nowrap;font-weight: bold; font-size: 10pt;">
<th align="center">Sl.No</th>
<th align="center" > Product Name</th>
<th align="center">Dispatch Material Name</th>
<th align="center">Required Quantity</th>
<th align="center">Product Quantity</th>
</tr>
<apex:variable value="{!0}" var="icount" />
<apex:repeat value="{!product}" var="line">
<apex:variable value="{!icount+ 1}" var="icount" />
<tr>
<td style="text-align:center; " border-style="solid;" width="10%" >{!icount}.</td>
<td width="10%" align="center">{!line.ProductName }" </td>
<td width="10%" align="center">{!line.RequiredMaterial }</td>
<td width="10%" align="center">{!line.QTy }</td>
<td width="10%" align="center">{!line.ProdutQty }</td>
</tr>
</apex:repeat>
</table>
</div>
</apex:outputText>
</html>
</apex:page>
Apex Class:
public class Dispatch_Workorder_Checklist {
public Project__c CPWR {get;set;}
list<OpportunityLineItem> listlinitem = New List<OpportunityLineItem>();
list<Dispatch_Product_Checklist__c> listdisprod = New List<Dispatch_Product_Checklist__c>();
Set<ID> setproducID = New Set<ID> ();
Map<ID,Decimal> ProdQty= New Map<ID,Decimal>();
public list<Intermediate> intermediatelist = New list<Intermediate>();
public list<Intermediate> intermediatelist1 = New list<Intermediate>();
list<Product2> listprod = New list<Product2>();
Map<ID,String> ProdName= New Map<ID,String>();
public list<Dispatch_Product_Checklist__c > getlistdisprod ()
{
Return listdisprod ;
}
public list<OpportunityLineItem > getlistlinitem()
{
Return listlinitem ;
}
public list<Intermediate> getproduct()
{
Return intermediatelist1;
}
public Dispatch_Workorder_Checklist(ApexPages.StandardController controller) {
CPWR=[select ID,Name,Opportunity__c,Total_Product_Qty__c,Project_Type__c from Project__c where ID=:ApexPages.CurrentPage().getParameters().get('Id')];
listlinitem =[select ID,Product2Id,Quantity from OpportunityLineItem where OpportunityID=:CPWR.Opportunity__c];
For(OpportunityLineItem opp: listlinitem ) {
setproducID.add(opp.Product2Id );
ProdQty.put(opp.Product2Id ,opp.Quantity);
}
listdisprod =[select ID,Name,Product__c,Quantity__c from Dispatch_Product_Checklist__c where Product__c=:setproducID order by Product__c];
IF(setproducID!=Null){
listprod= [select ID, Name from Product2 where ID=:setproducID];
}
For(Product2 pro: listprod)
{
ProdName.put(pro.ID,PRo.Name);
}
}
Public Void getPRoductlist(){
If(listprod.size()>0) {
For(Dispatch_Product_Checklist__c DP:listdisprod ) {
Intermediate I= New Intermediate();
i.RequiredMaterial =dp.Name;
i.Qty=dp.Quantity__c ;
i.ProdutQty =ProdQty.get(dp.Product__c);
i.ProductName =ProdName.get(dp.Product__c);
intermediatelist.add(i);
}
}
}
public void getwrapperlist()
{
For(Intermediate Im: intermediatelist)
{
intermediatelist1.add(IM);
}
}
Public Class Intermediate{
public Decimal QTy {Get;set;}
Public String RequiredMaterial {get;set;}
Public Decimal ProdutQty {get;set;}
public String ProductName {get;set;}
}
}
Am Trying show list of records from Different object Using Wrapper Class.But its not returning any values .
Kindly Help me on this
VF Page:
<apex:page renderAs="PDF" standardController="Project__c" extensions="Dispatch_Workorder_Checklist" applyBodyTag="False" ShowHeader="False" applyHtmlTag="False">
<html>
<head>
<style>
@page {
margin-top: 4cm;
margin-bottom: 2cm;
margin-right:1CM;
margin-Left:1CM;
padding: 5px;
@top-center {
content: element(header);
}
@bottom-left {
content: element(footer);
}
}
div.header {
width: 100%;
padding: 5px;
position: running(header);
}
div.footer {
display: block;
padding: 5px;
position: running(footer);
}
.pagenumber:before {
content: counter(page);
}
.pagecount:before {
content: counter(pages);
}
div.content {
border: 1px solid black;
padding: 5px;
width: 100%;
}
</style>
</head>
<!-- ==== Header=== -->
<div class="header" >
<p align="center"><b>WorkOrder Dispatch Check List</b></p>
<p align="Left"><b> Project Name: </b><apex:outputField value="{!CPWR.Name}" /></p>
<p align="Left"><b> Project Type :</b> <apex:outputField value="{!CPWR.Project_Type__c }" /></p>
<p align="Left"><b> No of Products: </b><apex:outputField value="{!CPWR.Total_Product_Qty__c}" /></p>
</div>
<!-- ==== Header=== -->
<!-- ==== Product Deatils=== -->
<apex:outputText style="page-break-Before: Avoid; white-space:nowrap" >
<div class="Content" style="position:absolute; width:100% white-space:nowrap">
<table style="font-size:13px;font-face:Arial;page-break-inside: avoid;white-space:nowrap " border="1" rules="cols" cellspacing="0" width="100%" cellpadding="0" >
<tr height="30" width="100%" style="font-family: sans-serif; white-space:nowrap;font-weight: bold; font-size: 10pt;">
<th align="center">Sl.No</th>
<th align="center" > Product Name</th>
<th align="center">Dispatch Material Name</th>
<th align="center">Required Quantity</th>
<th align="center">Product Quantity</th>
</tr>
<apex:variable value="{!0}" var="icount" />
<apex:repeat value="{!product}" var="line">
<apex:variable value="{!icount+ 1}" var="icount" />
<tr>
<td style="text-align:center; " border-style="solid;" width="10%" >{!icount}.</td>
<td width="10%" align="center">{!line.ProductName }" </td>
<td width="10%" align="center">{!line.RequiredMaterial }</td>
<td width="10%" align="center">{!line.QTy }</td>
<td width="10%" align="center">{!line.ProdutQty }</td>
</tr>
</apex:repeat>
</table>
</div>
</apex:outputText>
</html>
</apex:page>
Apex Class:
public class Dispatch_Workorder_Checklist {
public Project__c CPWR {get;set;}
list<OpportunityLineItem> listlinitem = New List<OpportunityLineItem>();
list<Dispatch_Product_Checklist__c> listdisprod = New List<Dispatch_Product_Checklist__c>();
Set<ID> setproducID = New Set<ID> ();
Map<ID,Decimal> ProdQty= New Map<ID,Decimal>();
public list<Intermediate> intermediatelist = New list<Intermediate>();
public list<Intermediate> intermediatelist1 = New list<Intermediate>();
list<Product2> listprod = New list<Product2>();
Map<ID,String> ProdName= New Map<ID,String>();
public list<Dispatch_Product_Checklist__c > getlistdisprod ()
{
Return listdisprod ;
}
public list<OpportunityLineItem > getlistlinitem()
{
Return listlinitem ;
}
public list<Intermediate> getproduct()
{
Return intermediatelist1;
}
public Dispatch_Workorder_Checklist(ApexPages.StandardController controller) {
CPWR=[select ID,Name,Opportunity__c,Total_Product_Qty__c,Project_Type__c from Project__c where ID=:ApexPages.CurrentPage().getParameters().get('Id')];
listlinitem =[select ID,Product2Id,Quantity from OpportunityLineItem where OpportunityID=:CPWR.Opportunity__c];
For(OpportunityLineItem opp: listlinitem ) {
setproducID.add(opp.Product2Id );
ProdQty.put(opp.Product2Id ,opp.Quantity);
}
listdisprod =[select ID,Name,Product__c,Quantity__c from Dispatch_Product_Checklist__c where Product__c=:setproducID order by Product__c];
IF(setproducID!=Null){
listprod= [select ID, Name from Product2 where ID=:setproducID];
}
For(Product2 pro: listprod)
{
ProdName.put(pro.ID,PRo.Name);
}
}
Public Void getPRoductlist(){
If(listprod.size()>0) {
For(Dispatch_Product_Checklist__c DP:listdisprod ) {
Intermediate I= New Intermediate();
i.RequiredMaterial =dp.Name;
i.Qty=dp.Quantity__c ;
i.ProdutQty =ProdQty.get(dp.Product__c);
i.ProductName =ProdName.get(dp.Product__c);
intermediatelist.add(i);
}
}
}
public void getwrapperlist()
{
For(Intermediate Im: intermediatelist)
{
intermediatelist1.add(IM);
}
}
Public Class Intermediate{
public Decimal QTy {Get;set;}
Public String RequiredMaterial {get;set;}
Public Decimal ProdutQty {get;set;}
public String ProductName {get;set;}
}
}