You need to sign in to do that
Don't have an account?
DevSF
Add multiple Products in a single table visualforcepage
I am creating an invoice PDF.
I have two custom objects
1) Invoice__c
2) Invoice_Product__c
These 2 objects have master detail relationship between them.
Now in my PDF i am adding multiple products to invoice, It is displaying 2 products in different tables. As shown.
I need these 2 products should be displayed in one table.
This is my code (Table).
Kindly make any changes which displays 2 products in one table.
This is my Code:
<table cellpadding="2" cellspacing="0" style="width:100%;">
<tr style="font-size:16px;height:32px;Font-family:Verdana,Arial;" >
<td style="width:7%;background-color:#707070;border-left:1px solid;border-top:1px solid;border-right:1px solid;border-bottom:1px solid;text-align:center;">Quantity</td>
<td style="width:15%;background-color:#707070;border-left:1px solid;border-top:1px solid;border-right:1px solid;border-bottom:1px solid;text-align:center;">Item</td>
<td style="width:27%;background-color:#707070;border-left:none;border-top:1px solid;border-right:1px solid;border-bottom:1px solid;text-align:center;">Description</td>
<td style="width:12%;background-color:#707070;border-left:none;border-top:1px solid;border-right:1px solid;border-bottom:1px solid;text-align:center;">Unit Price</td>
<td style="width:12%;;background-color:#707070;border-left:none;border-top:1px solid;border-right:1px solid;border-bottom:1px solid;text-align:center;">Total</td>
</tr>
<apex:repeat value="{!Invoice__c.Invoice_Products__r}" var="inv" id="theRepeat">
<apex:repeat value="{!Invoice__c}" var="iv" id="theRepeat">
<tr style="font-size:16px;height:300px;vertical-align:text-top;Font-family:Verdana,Arial;">
<td style="border-left:1px solid;border-top:none;border-right:1px solid;border-bottom:none;text-align:center;"><apex:outputText value="{!inv.Quantity__c}"/></td>
<td style="border-left:1px solid;border-top:none;border-right:1px solid;border-bottom:none;text-align:center;"><apex:outputText value="{!inv.Name}"/></td>
<td style="border-left:none;border-top:none;border-right:1px solid;border-bottom:none;text-align:center;"><apex:outputText value="{!inv.VWO_Product_Code__c}" /></td>
<td style="border-left:none;border-top:none;border-right:1px solid;border-bottom:none;text-align:center;"><apex:outputText value="${!inv.Unit_Price__c}" rendered="{!IF(inv.Unit_Price__c==NUll || inv.Unit_Price__c==0,false,true)}"/></td>
<td style="border-left:0.1px solid;border-top:none;border-right:1px solid;border-bottom:none;text-align:center;"><apex:outputText value="${!inv.Line_Item_Total__c}" rendered="{!IF(inv.Line_Item_Total__c==NUll || inv.Line_Item_Total__c==0,false,true)}"/></td>
</tr>
<tr style="font-size:16px;height:18px;Font-family:Verdana,Arial;">
<td style="border-left:none;border-top:1px solid;border-right:none;border-bottom:none"></td>
<td style="border-left:none;border-top:1px solid;border-right:none;border-bottom:none"> </td>
<td style="border-left:none;border-top:1px solid;border-right:1px solid;border-bottom:none"> </td>
<td style="border-left:none;border-top:1px solid;border-right:1px solid;border-bottom:1px solid;text-align:right;" >Subtotal</td>
<td style="border-left:none;border-top:1px solid;border-right:1px solid;border-bottom:1px solid;text-align:center;"><apex:outputText value="${!iv.Subtotal_Amount__c}" rendered="{!IF(iv.Subtotal_Amount__c==NUll || iv.Subtotal_Amount__c==0,false,true)}"/></td>
</tr>
<tr style="font-size:14px;height:14px;Font-family:Verdana,Arial;">
<td style="border-left:none;border-top:none;border-right:none;border-bottom:none"></td>
<td style="border-left:none;border-top:none;border-right:none;border-bottom:none"> </td>
<td style="border-left:none;border-top:none;border-right:1px solid;border-bottom:none"></td>
<td style="border-left:none;border-top:none;border-right:1px solid;border-bottom:1px solid;text-align:right;"><b>Total Amount</b></td>
<td style="border-left:none;border-top:none;border-right:1px solid;border-bottom:1px solid;text-align:center;"><apex:outputText value="${!iv.Total_Amount__c}" rendered="{!IF(iv.Total_Amount__c==NUll || iv.Total_Amount__c==0,false,true)}"/></td>
</tr>
</apex:repeat>
</apex:repeat>
</table>
Any help would be appriciated..!
Thanks.
I have two custom objects
1) Invoice__c
2) Invoice_Product__c
These 2 objects have master detail relationship between them.
Now in my PDF i am adding multiple products to invoice, It is displaying 2 products in different tables. As shown.
I need these 2 products should be displayed in one table.
This is my code (Table).
Kindly make any changes which displays 2 products in one table.
This is my Code:
<table cellpadding="2" cellspacing="0" style="width:100%;">
<tr style="font-size:16px;height:32px;Font-family:Verdana,Arial;" >
<td style="width:7%;background-color:#707070;border-left:1px solid;border-top:1px solid;border-right:1px solid;border-bottom:1px solid;text-align:center;">Quantity</td>
<td style="width:15%;background-color:#707070;border-left:1px solid;border-top:1px solid;border-right:1px solid;border-bottom:1px solid;text-align:center;">Item</td>
<td style="width:27%;background-color:#707070;border-left:none;border-top:1px solid;border-right:1px solid;border-bottom:1px solid;text-align:center;">Description</td>
<td style="width:12%;background-color:#707070;border-left:none;border-top:1px solid;border-right:1px solid;border-bottom:1px solid;text-align:center;">Unit Price</td>
<td style="width:12%;;background-color:#707070;border-left:none;border-top:1px solid;border-right:1px solid;border-bottom:1px solid;text-align:center;">Total</td>
</tr>
<apex:repeat value="{!Invoice__c.Invoice_Products__r}" var="inv" id="theRepeat">
<apex:repeat value="{!Invoice__c}" var="iv" id="theRepeat">
<tr style="font-size:16px;height:300px;vertical-align:text-top;Font-family:Verdana,Arial;">
<td style="border-left:1px solid;border-top:none;border-right:1px solid;border-bottom:none;text-align:center;"><apex:outputText value="{!inv.Quantity__c}"/></td>
<td style="border-left:1px solid;border-top:none;border-right:1px solid;border-bottom:none;text-align:center;"><apex:outputText value="{!inv.Name}"/></td>
<td style="border-left:none;border-top:none;border-right:1px solid;border-bottom:none;text-align:center;"><apex:outputText value="{!inv.VWO_Product_Code__c}" /></td>
<td style="border-left:none;border-top:none;border-right:1px solid;border-bottom:none;text-align:center;"><apex:outputText value="${!inv.Unit_Price__c}" rendered="{!IF(inv.Unit_Price__c==NUll || inv.Unit_Price__c==0,false,true)}"/></td>
<td style="border-left:0.1px solid;border-top:none;border-right:1px solid;border-bottom:none;text-align:center;"><apex:outputText value="${!inv.Line_Item_Total__c}" rendered="{!IF(inv.Line_Item_Total__c==NUll || inv.Line_Item_Total__c==0,false,true)}"/></td>
</tr>
<tr style="font-size:16px;height:18px;Font-family:Verdana,Arial;">
<td style="border-left:none;border-top:1px solid;border-right:none;border-bottom:none"></td>
<td style="border-left:none;border-top:1px solid;border-right:none;border-bottom:none"> </td>
<td style="border-left:none;border-top:1px solid;border-right:1px solid;border-bottom:none"> </td>
<td style="border-left:none;border-top:1px solid;border-right:1px solid;border-bottom:1px solid;text-align:right;" >Subtotal</td>
<td style="border-left:none;border-top:1px solid;border-right:1px solid;border-bottom:1px solid;text-align:center;"><apex:outputText value="${!iv.Subtotal_Amount__c}" rendered="{!IF(iv.Subtotal_Amount__c==NUll || iv.Subtotal_Amount__c==0,false,true)}"/></td>
</tr>
<tr style="font-size:14px;height:14px;Font-family:Verdana,Arial;">
<td style="border-left:none;border-top:none;border-right:none;border-bottom:none"></td>
<td style="border-left:none;border-top:none;border-right:none;border-bottom:none"> </td>
<td style="border-left:none;border-top:none;border-right:1px solid;border-bottom:none"></td>
<td style="border-left:none;border-top:none;border-right:1px solid;border-bottom:1px solid;text-align:right;"><b>Total Amount</b></td>
<td style="border-left:none;border-top:none;border-right:1px solid;border-bottom:1px solid;text-align:center;"><apex:outputText value="${!iv.Total_Amount__c}" rendered="{!IF(iv.Total_Amount__c==NUll || iv.Total_Amount__c==0,false,true)}"/></td>
</tr>
</apex:repeat>
</apex:repeat>
</table>
Any help would be appriciated..!
Thanks.
The first repeat is for Invoice Products - then for each Invoice Product - you're repeating for each invoice. I would think that you would want to repeat for each Invoice, then inside of each invoice, repeat on the Inovice Products.
I am sorry.I didn't get your point.
Could you please make the changes in the code and paste it here.
As i have to complete this by tommorow. Please help me out sir.
Thanks,
Raj
<apex:repeat value="{!Invoice__c.Invoice_Products__r}" var="inv" id="theRepeat">
<apex:repeat value="{!Invoice__c}" var="iv" id="theRepeat">
I have reversed those 2 lines.
I am sorry, But my table is repeating again as shown in the above figure.
Is there any other way sir.