Hi all,
I want to add some tax on the unit price. Normally we have the following:
Quantity | Unit price | Net amount
76 | 84.12 | 6393.12
The net amount is calculated with 76*84.12
It is possible to have some taxes which i need to add to the net amount, and i need to change the unit price. Within the XML file there can be TypeOfAllowanceOrChange//MonetaryAmount element. This is the tax, for example 14.14. The XSL should be changed to calculate the following:
Quantity | Unit price | Net amount | Wrap tax
76 | 84.306 | 6407.26 | 14.14
The unit price should be calculated as follows:
84.12 + (14.14/76)
Now my XML files. Normally we can have multiple Lineitemnum's a invoice, one of these item is look like:
In my HTML document, i need to fill the information above in a table look like:
Quantity | Unit price | Net amount | Wraptax
1 | 12.29 | 12.29 |
This is not a problem. But sometimes i can have like the following item:
As you can see we have an addtional element, called AllowOrCharge (which is not always available, in this example we need to add the 5 euro on the unit price, like:
Quantity | Unit price | Net amount | Wrap tax
1 | 11.49 | 11.49 | 5
The unit price should be calculated in the stylesheet as follows:
6.49 + (5/1) = 11.49
I have the following lines in my stysheet to put this information into a table:
But the unit price calculation does not calculate the unit price correctly, does somebody know what im doing wrong?
A big golden star for the solution...
TIA
I want to add some tax on the unit price. Normally we have the following:
Quantity | Unit price | Net amount
76 | 84.12 | 6393.12
The net amount is calculated with 76*84.12
It is possible to have some taxes which i need to add to the net amount, and i need to change the unit price. Within the XML file there can be TypeOfAllowanceOrChange//MonetaryAmount element. This is the tax, for example 14.14. The XSL should be changed to calculate the following:
Quantity | Unit price | Net amount | Wrap tax
76 | 84.306 | 6407.26 | 14.14
The unit price should be calculated as follows:
84.12 + (14.14/76)
Now my XML files. Normally we can have multiple Lineitemnum's a invoice, one of these item is look like:
Code:
- <LineItemNum>
<BuyerLineItemNum>1</BuyerLineItemNum>
</LineItemNum>
- <ItemIdentifiers>
- <PartNumbers>
- <StandardPartNumber>
- <ProductIdentifierCoded>
<ProductIdentifierQualifierCoded>EAN2-5-5-1</ProductIdentifierQualifierCoded>
<ProductIdentifier>4011100002777</ProductIdentifier>
</ProductIdentifierCoded>
</StandardPartNumber>
</PartNumbers>
</ItemIdentifiers>
- <TotalQuantity>
- <Quantity>
<QuantityValue>1</QuantityValue>
- <UnitOfMeasurement>
<UOMCoded>1</UOMCoded>
</UnitOfMeasurement>
</Quantity>
</TotalQuantity>
</InvoiceBaseItemDetail>
- <InvoicePricingDetail>
- <ListOfPrice>
- <Price>
- <UnitPrice>
<UnitPriceValue>12.29</UnitPriceValue>
</UnitPrice>
</Price>
</ListOfPrice>
- <Tax>
<TaxFunctionQualifierCoded>Tax</TaxFunctionQualifierCoded>
<TaxCategoryCoded>ExemptFromTax</TaxCategoryCoded>
<TaxTypeCoded>ValueAddedTax</TaxTypeCoded>
<TaxPercent />
<TaxAmount>0</TaxAmount>
</Tax>
- <InvoiceCurrencyTotalValue>
- <MonetaryValue>
<MonetaryAmount>12.29</MonetaryAmount>
</MonetaryValue>
</InvoiceCurrencyTotalValue>
</InvoicePricingDetail>
</InvoiceItemDetail>
In my HTML document, i need to fill the information above in a table look like:
Quantity | Unit price | Net amount | Wraptax
1 | 12.29 | 12.29 |
This is not a problem. But sometimes i can have like the following item:
Code:
- <InvoiceItemDetail>
- <InvoiceBaseItemDetail>
- <LineItemNum>
<BuyerLineItemNum>4</BuyerLineItemNum>
</LineItemNum>
- <ItemIdentifiers>
- <PartNumbers>
- <StandardPartNumber>
- <ProductIdentifierCoded>
<ProductIdentifierQualifierCoded>EAN2-5-5-1</ProductIdentifierQualifierCoded>
<ProductIdentifier>5449000000552</ProductIdentifier>
</ProductIdentifierCoded>
</StandardPartNumber>
</PartNumbers>
</ItemIdentifiers>
- <TotalQuantity>
- <Quantity>
<QuantityValue>1</QuantityValue>
- <UnitOfMeasurement>
<UOMCoded>1</UOMCoded>
</UnitOfMeasurement>
</Quantity>
</TotalQuantity>
</InvoiceBaseItemDetail>
- <InvoicePricingDetail>
- <ListOfPrice>
- <Price>
- <UnitPrice>
<UnitPriceValue>6.49</UnitPriceValue>
</UnitPrice>
</Price>
</ListOfPrice>
- <Tax>
<TaxFunctionQualifierCoded>Tax</TaxFunctionQualifierCoded>
<TaxCategoryCoded>ExemptFromTax</TaxCategoryCoded>
<TaxTypeCoded>ValueAddedTax</TaxTypeCoded>
<TaxPercent />
<TaxAmount>0</TaxAmount>
</Tax>
- <ItemAllowancesOrCharges>
- <ListOfAllowOrCharge>
- <AllowOrCharge>
<IndicatorCoded>Charge</IndicatorCoded>
<MethodOfHandlingCoded>Other</MethodOfHandlingCoded>
- <AllowanceOrChargeDescription>
- <AllowOrChgDesc>
- <ListOfDescription>
- <Description>
<DescriptionText>RAD</DescriptionText>
- <Language>
<LanguageCoded>en</LanguageCoded>
</Language>
</Description>
</ListOfDescription>
<ServiceCoded>Deposit</ServiceCoded>
</AllowOrChgDesc>
</AllowanceOrChargeDescription>
- <TypeOfAllowanceOrCharge>
- <MonetaryValue>
<MonetaryAmount>5</MonetaryAmount>
</MonetaryValue>
</TypeOfAllowanceOrCharge>
</AllowOrCharge>
</ListOfAllowOrCharge>
</ItemAllowancesOrCharges>
- <InvoiceCurrencyTotalValue>
- <MonetaryValue>
<MonetaryAmount>11.49</MonetaryAmount>
</MonetaryValue>
</InvoiceCurrencyTotalValue>
</InvoicePricingDetail>
</InvoiceItemDetail>
As you can see we have an addtional element, called AllowOrCharge (which is not always available, in this example we need to add the 5 euro on the unit price, like:
Quantity | Unit price | Net amount | Wrap tax
1 | 11.49 | 11.49 | 5
The unit price should be calculated in the stylesheet as follows:
6.49 + (5/1) = 11.49
I have the following lines in my stysheet to put this information into a table:
Code:
<xsl:for-each select="//InvoiceItemDetail">
..
..
<td><span><xsl:value-of select="InvoiceBaseItemDetail//QuantityValue"/></span></td>
<!-- The calculation of the unit price -->
<td align="right"><span><xsl:value-of select="format-number(InvoicePricingDetail//UnitPriceValue + concat('0', InvoicePricingDetail//AllowOrCharge[IndicatorCoded='Charge']/../TypeOfAllowanceOrCharge/MonetaryValue/MonetaryAmount) div //QuantityValue, '0.00')"/></span></td>
But the unit price calculation does not calculate the unit price correctly, does somebody know what im doing wrong?
A big golden star for the solution...
TIA