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
RelaxItsJustCodeRelaxItsJustCode 

Need help with Visualforce currency formatting. Will give kudos to anyone that contributes.

Kudos goes to everyone who contributes.


I'm having a problem formatting this to $ USD currency.  I have the commas and the commas but:

 

$10,000.50 = $10,000.5 - Where I need $10,000.50

OR

$10,000.00 = $10,000 - Where I need $10,000.00

 

Here is the code below I'm hoping someone can help. (Please note that the column in second table called "Invoice Amount" is where I am having formatting issues.

 

Thank you,

Steve Laycock

 

<apex:page standardController="Contract" showHeader="false" renderas="pdf">

<table border="0" cellspacing="0" cellpadding="0" width="100%" id="table1">
<tr>
    <td>
        <img src='{!URLFOR($Resource.APSLogoContract)}' title="logo" />
    </td>
    
    <td  align="center" style="font-size:20px;"><font face="Arial">
    <b>INVOICE</b></font>
    <table border="1" cellspacing="0" cellpadding="1" width="100%"  id="table77">
        <tr>
            <td bgcolor="#d7dee9">
                <font face="Arial"  style="font-size:13px;">Date: </font>
            </td>    
            <td>
                <font face="Arial" style="font-size:13px;">
                    <apex:outputText value="{0,date,MM'/'dd'/'yyyy}">
                        <apex:param value="{!contract.WF_Invoice_Date__c}" /> 
                    </apex:outputText>
                
                </font>
            </td>
        </tr>
        <tr>
            <td bgcolor="#d7dee9">
                <font face="Arial"  style="font-size:13px;">Due: </font>
            </td>    
            <td>
                <font face="Arial" style="font-size:13px;">Net 30</font>
            </td>
        </tr>    
    </table>     
    </td>
    

    
</tr>


</table>

<br/>

<table border="0" cellspacing="0" cellpadding="1" width="100%" id="table2">
<tr>
       <td colspan="2" style="font-size:13px;">
           <font face="Arial">BarbaraG@aps.us <br/><br/></font>
       </td>
</tr>
<tr>
       <td style="font-size:13px;">          
           <font face="Arial">Bill To:<br/><br/>
                             {!Contract.Account.Name}<br/>  
                             {!Contract.Account.BillingStreet}<br/>
                             {!Contract.Account.BillingCity} {!Contract.Account.BillingState} {!Contract.Account.BillingPostalCode} 
           </font>
        </td>
        
        <td width="20%"></td>
        
        <td style="font-size:13px;">
           <font face="Arial">Ship To:<br/><br/>
                              {!Contract.Account.Name}<br/>
                              {!Contract.Account.ShippingStreet}<br/>
                              {!Contract.Account.ShippingCity} {!Contract.Account.BillingState} {!Contract.Account.ShippingPostalCode}
           </font>
        </td>
</tr>    
</table>
<br/><br/><br/>


<table border="1" cellspacing="0" cellpadding="1" width="85%" id="table15">
<tr>
       <td bgcolor="#d7dee9" align="center"><font face="Arial">Contract Number</font></td>
       <td bgcolor="#d7dee9" align="center"><font face="Arial">Product</font></td>
       <td bgcolor="#d7dee9" align="center"><font face="Arial">Term</font></td>
       <td bgcolor="#d7dee9" align="center"><font face="Arial">Invoice Amount</font></td>
</tr>
<tr>
        <td align="center"><font face="Arial">
             {!Contract.ContractNumber}
            </font>
        </td>
        <td align="center"><font face="Arial">
             Maintenance
            </font>
        </td>
        <td align="center"><font face="Arial">
          <apex:outputText value="{0,date,MM'/'dd'/'yyyy}">
                <apex:param value="{!contract.startdate}" /> 
          </apex:outputText>-<apex:outputText value="{0,date,MM'/'dd'/'yyyy}">
              <apex:param value="{!Contract.Contract_End_Date__c}" />
          </apex:outputText>
            </font>
        </td>
        <td align="center"><font face="Arial">
            <apex:outputText value="{0,number,$#,###,###.##}">
    <apex:param value="{!Contract.Total_Maintenance_Price__c}" />
  </apex:outputText>

            </font>
        </td>
</tr>



</table>
<br/><br/>

<table border="1" style="border-color: #3B5E91" cellspacing="0" cellpadding="1" width="100%" id="table4">
<tr>
       <td bgcolor="#d7dee9" align="left"><font face="Arial">Product(s) Covered</font></td>
       <td bgcolor="#d7dee9" align="center"><font face="Arial">Quantity</font></td>      
</tr>
<tr>
       <apex:repeat value="{!Contract.Service_Contract_Line_Items__r}" var="line">
          <tr>
             <td align="left">{!line.Product_LU__r.name}</td>
             
             <td align="right">{!(ROUND(line.Quantity__c,0))}</td>
          </tr>
       </apex:repeat>  
</tr>
</table>
<br/><br/>

<table border="1" cellspacing="0" cellpadding="1" width="65%" id="table3">
<tr>
       <td bgcolor="#d7dee9" align="left"><font face="Arial">Please Note Our Remit To Address</font></td>
</tr>
<tr>
        <td><font face="Arial">
              Advanced Public Safety, Inc.<br/>
              PO Box 535208<br/>
              Atlanta, GA 30353-5208<br/><br/>
              Wire Instructions: Wells Fargo Bank<br/>
              ABA#: 121000248 Account #: 412-1360267

            </font>
        </td>

</tr>
</table>
<br/>


</apex:page>

 

 

Best Answer chosen by Admin (Salesforce Developers) 
pinoytechiepinoytechie

try ###.00, i.e.:

..
<apex:outputText value="{0,number,$#,###,###.00}">

 

All Answers

pinoytechiepinoytechie

try ###.00, i.e.:

..
<apex:outputText value="{0,number,$#,###,###.00}">

 

This was selected as the best answer
RelaxItsJustCodeRelaxItsJustCode

I'm already doing that.  Please see code.  The problem is with that code it doesn't give the cents.  You know $1.50 shows as $1.00 with the solution you provided.

 

I need something that will show all of the cents to the two decimal point, with commas for thousands and a dallor sign.

 

Any ideas?

 

Thank you,

Steve Laycock

pinoytechiepinoytechie

i'm not sure what's going on with your org... but i just tested that:

 

200.15 will give 200.15

200.5 will give 200.50

 

other than that, i don't know how.

 

i mean i programmed with VB, VB.net, LotusScript and Java, and now in apex, and that format is the same: ###,###.00

RelaxItsJustCodeRelaxItsJustCode

Let me take another look maybe I made a mistake.

 

Give me a few I will get back to you.

 

Thank you for the help.

 

Steve

RelaxItsJustCodeRelaxItsJustCode

 

Ok I gave you two kudos and credit for the solution.  Turns out I must of fat fingered it when I was initialy trying to us something similar.

 

 

Thank you very much.

 

Steve Laycock