Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NaN when V.A.T is zero #97

Open
dellermann opened this issue Jun 30, 2017 · 1 comment
Open

NaN when V.A.T is zero #97

dellermann opened this issue Jun 30, 2017 · 1 comment
Assignees
Labels
Milestone

Comments

@dellermann
Copy link
Owner

When I print an invoice, sales order etc. with all items having zero V.A.T the tax rate rows in the footer of the table contains "NaN".

@dellermann dellermann added the bug label Jun 30, 2017
@dellermann dellermann added this to the 2.1 milestone Jun 30, 2017
@dellermann dellermann self-assigned this Jun 30, 2017
@dellermann
Copy link
Owner Author

A possible solution could be to add handling of NaN values in XSLT template:

<xsl:template match="entry[@key='taxRates']/entry">
  <fo:table-row>
    <fo:table-cell number-columns-spanned="2">
      <fo:block></fo:block>
    </fo:table-cell>
    <fo:table-cell padding="{$table.cell.padding.default}">
      <fo:block>
        <xsl:value-of select="format-number(number(@key), '#.##0,##')"/>
        <xsl:text> % MwSt.</xsl:text>
      </fo:block>
    </fo:table-cell>
    <fo:table-cell><fo:block></fo:block></fo:table-cell>
    <fo:table-cell padding="{$table.cell.padding.default}"
      text-align="right">
      <fo:block>
        <xsl:choose>
          <xsl:when test="string(number()) = 'NaN'">
            <xsl:value-of select="format-number(0, '#.##0,00')"/>
          </xsl:when>
          <xsl:otherwise>
            <xsl:value-of select="format-number(number(), '#.##0,00')"/>
          </xsl:otherwise>
        </xsl:choose>
        <xsl:text> €</xsl:text>
      </fo:block>
    </fo:table-cell>
  </fo:table-row>
</xsl:template>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant