I was able to get it to work for both detailed and header only instances.
For detailed, use the Taxes (ArrayofPurchaseTax) property and the TaxAmount property on onnly the PO line. Then on the PurchaseOrder, you only need to supply the TaxAmount.
For header only taxes, don’t do anything with taxes on the PO line and use the Taxes (ArrayofPurchaseTax) property and the TaxAmount property only on the PO header. When using header level taxes only, the sequence number for the tax detail key should be 0:
poTax = new PurchaseTax();
poTax.Key = new PurchaseTaxKey();
poTax.Key.PurchaseTransactionKey = purchaseOrderKey;
poTax.Key.TaxDetailKey = new TaxDetailKey();
poTax.Key.TaxDetailKey.Id = "USEXMT+PSONO";
poTax.Key.SequenceNumber = 0;
The Microsoft.Dynamics.GP.PurchaseOrderCreate.xslt file handles the USINGHEADERLEVELTAXES flag so this is why you either set the Taxes on either each line or the header:
<!-- If there is one or more taxes on the line, usingHeaderTaxes = 0 else 1-->
<xsl:choose>
<xsl:when test = "Lines/PurchaseOrderLine/Taxes/PurchaseTax">
<USINGHEADERLEVELTAXES>0</USINGHEADERLEVELTAXES>
</xsl:when>
<xsl:otherwise>
<USINGHEADERLEVELTAXES>1</USINGHEADERLEVELTAXES>
</xsl:otherwise>
</xsl:choose>
From the GP2010 Web Services Help file regarding the Taxes property:
The collection of taxes for the purchase order.
Do not set this value if you are also setting taxes on the Purchase Order Line. Setting tax information on both the purchase order and purchase order line is not supported.