Placeholder

Customer Forum

Why is my Credit Note PDF showing negative currency amounts when the other currency columns are positive?

Alix (Workbooks Online) Posted: 2017-09-05 11:25

If you are creating your own custom Credit Note PDF Template, you will need to make sure that you are pulling through the correct line item fields, else your PDF will show negative amounts.

Below is some example XML from a Credit Note. Highlighted are some of the Line Item amount fields that you can pull through onto the PDF. Notice that the amounts are all negative.

xml-credit-note-example.png

Highlighted in green are those fields that display as positive amounts in the UI - these fields will also display as positive on your PDF without any conversion. Those highlighted in red display as negative in the UI, and will also display as negative on your PDF if you do not first convert them to a positive number in your XSL.

credit-note-line-item.png

Summary

Below you can see that the fields will pull through onto the PDF the same as they show in the UI, irrespective of whether they are negative or positive values in the XML. Use this to ensure you are using the correct field label in the <xsl:value-of select="...."/>

Field Label Field Name UI XML PDF
Unit Price document_currency_unit_price_value positive negative positive
Discount Given document_currency_discount negative negative negative
Net Amount document_currency_net_value positive negative positive
Tax Amount document_currency_sales_tax_value positive negative positive
Tax Adjustment document_currency_tax_adjustment positive positive positive
Gross Amount document_currency_gross_value positive negative positive
Unit Cost document_currency_unit_cost positive negative positive
Total Cost document_currency_cost positive negative positive
Gross Margin document_currency_gross_margin positive negative positive

The rest of the fields that you can see in the XML are those that are used to calculate the correct Net Amount depending on whether you have the 'Discount applied before totalling' (found in Database Settings) set to true or false. In general you would not display these fields on a PDF, and would instead use 'Unit Price' and 'Net Value' from above.

You may want to use 'Unit Price After Discount' or 'Net Amount (before discount)' for comparison though- these will pull through as positive values (make sure you pick the correct one dependent on how you have the setting). if any of the other fields are required, they will need to be converted to ensure that they pull through onto your PDF as positive. You can do this by multiplying the amount by -1, but you will therefore have to split the field into the currency symbol and the amount, as follows:

<xsl:value-of select="/hash/document_currency_currency_symbol"/> <xsl:value-of select="format-number(field/@amount * -1, '#,###.00')"/>

Discount applied before totalling = true

Field Label Field Name UI XML PDF
Unit price after main discount document_currency_unit_price_after_main_discount negative negative negative
Unit price after additional discount 1 document_currency_unit_price_after_additional_discount_1 negative negative negative
Unit price After Discount document_currency_unit_price_after_discount_value positive negative positive
Net value discounted before totalling document_currency_net_value_discount_before_totalling negative negative negative

Discount applied before totalling = false

Field Label Field Name UI XML PDF
Net Amount (before discount) document_currency_net_before_discount_value positive negative positive
Net value after main discount document_currency_net_after_main_discount negative negative negative
Net value after additional discount 1 document_currency_net_after_additional_discount_1 negative negative negative
Net value after additional discount 2 document_currency_net_value_discount_after_totalling negative negative negative