Hide billing lines



  • Rebecca Ralls

    Hi Grace,

    Unfortunately, there's is no easy way "out of the box". But it is possibe to design a custom invoice template that will hide designated billing lines. 

    The two main methodsI have seen it done is with a document generation tool like Conga Compser, or via a custom Visualforce page to replace the Accounting Seed template.   

    If your company is already using Conga or something like it, this is probably the easiest/most affordable way to accomplish what you want.  If it is not, incurring a monthly license fee just for a custom invocie template probably isn't worth it, and you might explore the new visualforce page route. 

    A new visualforce page is something a developer needs to put together, and it can require a decent chunk of hours; I've seen estimates of 15-30 hours, but once it's done, it's yours.

    If you're interested in talking through the options with someone, you can reach out to the finance and accounting team at Coastal Cloud where I work.  https://coastalcloud.us/contact/. As long as you mention "Accounting Seed" in the How can we help your organization field, your message will end up in the right place ;-) 

    Comment actions Permalink
  • Antonia Nuzzolo

    I figured it out for ya, @Grace! (And anyone else who comes across this and doesn't want to pay 30 developer hours.) You're gonna have to go into the Developer Console but don't shed any tears, I'll walk you through it.

    First you're going to go to your Sandbox (because we can't develop straight in our Production environment) and go to the Developer Console. Then you're going to click File and Open. Under Entity Type, select "Pages." You're going to scroll until you find the VisualForce page that your Invoice uses (to find this name, you can go into an existing Billing record, scroll down to "PDF Format," click whatever's entered in that field, and then see what value is under "VisualForce PDF Page.") Double click it to open it up. Let's code!

    Scroll down through all this nonsense 'til you see this:

            <apex:repeat value="{!billLines}" var="item">

    You're right where you need to be. All that is contained in this body are the ROWS of your invoice. It says: Apex, go through my list of billing lines. I'm going to call each billing line "item." Now I'm going to create a table row ("tr") for each of items; within that I am going to enter multiple pieces of table data ("td") which are basically my columns. 

    What you're going to do is replace the <tr line that exists under <apex:repeat value with this:

          <apex:repeat value="{!billLines}" var="item">
          <tr style="display: {!IF((item.Product_Family__c == 'Discount'), 'none', 'table-row')};">

    Now your row is not going to hold the exact contents of mine. I am conditionally hiding the table row for every item whose Product Family is equal to "Discount." You need to find the billing line field you want to make your conditionality determination off of and add it in place of "Product_Family__c." (Make sure you add the API name, not the label.) Then you can change the == operator if you want (!= not equal to... < less than... >= greater than or equal to... and so on) and change 'Discount' to the text of your choosing (use the ' ') or enter a number (don't use the ' '.)

    My explanation has assumed you know a bit about Salesforce as an admin or developer, so if anyone wants me to do a video on this or meet with them I would be happy to as it hurts me to think someone's paying $10,000 for one line of code lol. My email is anuzzolo@eaglemg.com. Peace

    Comment actions Permalink

Please sign in to leave a comment.