Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Display Packages without services broken out. Packages will also display the period as shown below in the image.

HTML SECTION

Code Block
<xsl:apply-templates select="PackageGroup"/>

XSL SECTION

Code Block
<xsl:template match="PackageGroup"> <xsl:apply-templates select="ItemGroup"/>
</xsl:template><xsl:template match="ItemGroup"> <tr> <td colspan="5"></td> </tr> <tr> <td colspan="5"> <span> <h2> Monthly Charges for <xsl:apply-templates select="UserTopParent"/> </h2> </span> </td> </tr>
<xsl:if test="count(Item)>0"> <tr> <td colspan="5"> <span> <h3> <xsl:apply-templates select="User"/> </h3> </span> </td> </tr> <tr> <td width="2%"></td> <td width="48%">Package</td> <td width="40%">Period Billed</td> <td width="10%" align="center">Amount</td> </tr> <xsl:apply-templates select="Item"/>
</xsl:if>
</xsl:template> <xsl:template match="Item"> <xsl:if test="not(Amount = '0.00')"> <tr> <td></td> <td> <b> <xsl:apply-templates select="Detail"/> </b> </td> <xsl:if test="count(CurrentBilldate)>0"> <td> <b> <xsl:apply-templates select="CurrentBilldate"/> - <xsl:apply-templates select="NextBilldate"/> </b> </td>
</xsl:if>
<xsl:if test="count(CurrentBilldate)=0"> <td> <b> <xsl:apply-templates select="TransactionDate"/> - <xsl:apply-templates select="TransactionDate"/> </b> </td>
</xsl:if><td align="center"> <b> <xsl:apply-templates select="Amount"/> </b> </td> </tr>
</xsl:if>
</xsl:template>

...

Code Block
<xsl:apply-templates select="PackageGroupRecurring"/>

XSL SECTION

Code Block
<xsl:template match="PackageGroupRecurring"> <xsl:for-each select="PackageGroupItem"> <xsl:variable name="packagename"> <xsl:value-of select="Package"/> </xsl:variable> <xsl:if test="$packagename != 'Long Distance Rate Plan (3.9)'"> <tr> <td colspan="3" align="left"> <xsl:value-of select="Package"/> </td> <td align="right"> <b> <xsl:value-of select="Quantity"/> </b> </td> <td align="right"> <b> $<xsl:value-of select="Amount"/> </b> </td> </tr> </xsl:if> </xsl:for-each> <tr> <td colspan="5"> <HR width="40%" align="right" /> </td> </tr> <tr> <td colspan="4" align="right"> Recurring Total: </td> <td align="right"> $<xsl:value-of select="PackageGroupRecurringTotal"/> </td> </tr> <tr> <td colspan="5"> <HR width="100%" align="right"/> <HR width="100%" align="right"/> </td> </tr> </xsl:template>Profile Answers for Services

...

Displays profile answers attached to services that are show on the customer invoice As shown above, we have created the profile question ‘What is your favourite colour?’ on the Dialup Service. Once the XML is in place, we can then show that profile question answer on the invoice, in this case, the answer is ‘RED’ Complete Invoice Template Sample: 

View file
nameInvoiceWithProfileAnswer.xml



HTML SECTION

Code Block
<xsl:apply-templates select="InvoiceGroup"/>

...

Code Block
<xsl:template match="InvoiceUserProfileGroup">
<xsl:if test="count(Profile)>0">
<xsl:for-each select="Profile">
<xsl:if test="ProfileQuestion = 'PO Number'">
<xsl:value-of select="ProfileAnswer"/>
</xsl:if>
</xsl:for-each>
</xsl:if>
</xsl:template>
Invoice Detail

Invoice Detail
 

Token in the invoice is 'Extra Detail' - The 'invoice detail' component on packages allows you to insert additional information or notes about a particular package on an invoice. Remember that this is a global setting for anyone who signs up for this package and is not configurable per account. The 'extra detail' token as referred to here displays the 'invoice detail' component data.

HTML SECTION

Code Block
<xsl:apply-templates select="ExtraDetail"/>

XSL SECTION

Code Block
<xsl:template match="ExtraDetail"> <xsl:value-of select="." /> </xsl:template>Invoice Identifier

Invoice Identifier

The invoice identifier option allows you to tag packages and/or services with a specific identifier for the purpose of applying formatting to the item on the invoice. For example, if you would like to hide specific services on invoices so that they are not seen by your customers you could create an invoice identifier named HIDE. In your invoice template you would look for any services which have an identifier value of HIDE and then react by not showing them on the invoice. The same could be done to hide services which do not have an amount ($0.00) on invoices, to highlight a particular discount or promotional service with different font formatting than the others listed.

...

If you want to display only a list of manual transactions, in the case where you might be using package grouping as well, you can use this code below to show only those manual transactions

HTML SECTION

Code Block
<xsl:if test="count(PackageGroup/ItemGroup) = 0"> <xsl:apply-templates select="InvoiceGroup" />
</xsl:if>

XSL SECTION

Code Block
<xsl:template match="InvoiceGroup"> <xsl:variable name="loop"> <xsl:value-of select="ItemGroup/Item[(ManualTransaction='Yes') ]"/>
</xsl:variable>
<xsl:if test="($loop != '')"> <tr> <td colspan="5"></td> </tr> <tr> <td colspan="5"> <span> <h2> Monthly Charges for <xsl:apply-templates select="ItemGroup/UserTopParent"/> </h2> </span> </td> </tr> <tr> <td colspan="5"> <span> <h3> <xsl:apply-templates select="ItemGroup/User"/> </h3> </span> </td> </tr> <tr> <td width="2%"></td> <td width="48%">Detail</td> <td width="40%">Period Billed</td> <td width="10%" align="center">Amount</td> </tr>
</xsl:if>
<xsl:for-each select="ItemGroup/Item"> <xsl:variable name="manual"> <xsl:value-of select="ManualTransaction"/> </xsl:variable> <xsl:if test="($manual = 'Yes')"> <tr> <td></td> <td> <b> <xsl:value-of select="Detail"/> </b> </td> <xsl:if test="count(PeriodStart)>0"> <td> <b> <xsl:value-of select="PeriodStart"/> - <xsl:value-of select="PeriodEnd"/> </b> </td> </xsl:if> <xsl:if test="count(PeriodStart)=0"> <td> <b> <xsl:value-of select="TransactionDate"/> - <xsl:value-of select="TransactionDate"/> </b> </td> </xsl:if> <td align="center"> <b> $<xsl:value-of select="Amount"/> </b> </td> </tr>
</xsl:if>
</xsl:for-each>
</xsl:template>


How to Omit Account Detail Rows Where All Transactions are Zero

In the invoice detail, if you have accounts with zero dollar transactions, you can make sure they don’t show up in the detail with this piece of code

Info

Note: the below code as inserted into the 'ItemGroup' element

HTML SECTION

Code Block
<xsl:template match="ItemGroup">
<xsl:variable name="showsubaccount">
<xsl:for-each select="Item">
<xsl:if test="Amount != 0.00"> <xsl:value-of select="Amount"></xsl:value-of>
</xsl:if>
</xsl:for-each> </xsl:variable> <xsl:if test="$showsubaccount !=''"> <tr> <td colspan="6"></td> </tr> <tr> <td colspan="6"> <span> <h2> Monthly Charges for <xsl:apply-templates select="User"/> </h2> </span> </td> </tr> <tr> <td width="2%"></td> <td width="58%">Service</td> <td width="20%" colspan="2" align="center">Period</td> <td width="10%" align="center">Amount</td> </tr> <xsl:apply-templates select="Item"/> <xsl:apply-templates select="InvoiceItemsSubtotal"/>
</xsl:if>
</xsl:template>This allows you to create new tokens if one does not exist, for example when you want to add taxes token with the invoice charges token and display the sum of the two.

...

This allows you to create new tokens if one does not exist, for example when you want to add taxes token with the invoice charges token and display the sum of the two.

Info

Note: When adding variables / tokens, if your format includes commas  (

...

i.e. $1,234.00 as opposed to $1234.00) to delineate thousands for example, you need to first strip the comma out of the token, perform the calculation, then add it back in using the XML formatting of numbers.

HTML SECTION

Code Block
<xsl:copy-ofselect="$totalDue"/>

...

This allows you to convert the duration for telecom invoices on invoices to minutes

Code Block
<xsl:template name="convertdurationtomin">
<xsl:param name="duration"/>
<xsl:variable name="hour" select='substring-before($duration, ":")' />
<xsl:variable name="rest" select='substring-after($duration, ":")' />
<xsl:variable name="min" select='substring-before($rest, ":")' />
<xsl:variable name="sec" select='substring-after($rest, ":")' />
<xsl:value-of select="floor( $hour * 60) + $min + ($sec div 60)" />
</xsl:template>

...

If you need to format your date, you can use a substring method for example to trim a 4 digit year to a 2 digit year. Because the date is not in a UTC format, you cannot currently use the standard XSL date formatting methods.