PRIMERA posibilidad, Ejemplo:
Un Taladro por Valor de 10.000, normalmente se debe facturar en 11.900 = 10.000 + 1.900 de IVA.
Con descuento de 10%:
10.000 - 1.000 (descuento) = 9.000
El IVA de 9.000 * 0.19 = 1.710
El subtotal 9.000 + 1.710 = 10.710.
SEGUNDA. El problema no es de cálculos, sino mala conformación del xml.
El ejemplo.
<cac:PaymentMeans>
<cbc:ID>1</cbc:ID>
<cbc:PaymentMeansCode>10</cbc:PaymentMeansCode>
<cbc:PaymentID>990000405</cbc:PaymentID>
</cac:PaymentMeans>
<cac:AllowanceCharge>
<cbc:ID>1</cbc:ID>
<cbc:ChargeIndicator>false</cbc:ChargeIndicator>
<cbc:AllowanceChargeReasonCode>00</cbc:AllowanceChargeReasonCode>
<cbc:AllowanceChargeReason>Descuentos de linea, con motivo descrito en cada linea</cbc:AllowanceChargeReason>
<cbc:MultiplierFactorNumeric>11.11</cbc:MultiplierFactorNumeric>
<cbc:Amount currencyID="COP">1000.00</cbc:Amount>
<cbc:BaseAmount> currencyID="COP">9000.00</cbc:BaseAmount>
</cac:AllowanceCharge>
<cac:TaxTotal>
<cbc:TaxAmount currencyID="COP">1710.00</cbc:TaxAmount>
<cac:TaxSubtotal>
<cbc:TaxableAmount currencyID="COP">9000.00</cbc:TaxableAmount>
<cbc:TaxAmount currencyID="COP">1710.00</cbc:TaxAmount>
<cac:TaxCategory>
<cbc:Percent>19.00</cbc:Percent>
<cac:TaxScheme>
<cbc:ID>01</cbc:ID>
<cbc:Name>Impuesto sobre la Ventas</cbc:Name>
</cac:TaxScheme>
</cac:TaxCategory>
</cac:TaxSubtotal>
</cac:TaxTotal>
<cac:LegalMonetaryTotal>
<cbc:LineExtensionAmount currencyID="COP">9000.00</cbc:LineExtensionAmount>
<cbc:TaxExclusiveAmount currencyID="COP">9000.00</cbc:TaxExclusiveAmount>
<cbc:TaxInclusiveAmount currencyID="COP">10710.00</cbc:TaxInclusiveAmount>
<cbc:AllowanceTotalAmount currencyID="COP">1000.00</cbc:AllowanceTotalAmount>
<cbc:ChargeTotalAmount currencyID="COP">0.00</cbc:ChargeTotalAmount>
<cbc:PayableAmount currencyID="COP">10710.00</cbc:PayableAmount>
</cac:LegalMonetaryTotal>
<cac:InvoiceLine>
<cbc:ID>1</cbc:ID>
<cbc:InvoicedQuantity unitCode="94">1</cbc:InvoicedQuantity>
<cbc:LineExtensionAmount currencyID="COP">10000.00</cbc:LineExtensionAmount>
<cac:AllowanceCharge>
<cbc:ID>1</cbc:ID>
<cbc:ChargeIndicator>false</cbc:ChargeIndicator>
<cbc:AllowanceChargeReason>Oferta del día</cbc:AllowanceChargeReason>
<cbc:MultiplierFactorNumeric>10.00</cbc:MultiplierFactorNumeric>
<cbc:Amount currencyID="COP">1000.00</cbc:Amount>
<cbc:BaseAmount currencyID="COP">10000.00</cbc:BaseAmount>
</cac:AllowanceCharge>
<cac:TaxTotal>
<cbc:TaxAmount currencyID="COP">1710.00</cbc:TaxAmount>
<cac:TaxSubtotal>
<cbc:TaxableAmount currencyID="COP">9000.00</cbc:TaxableAmount>
<cbc:TaxAmount currencyID="COP">1710.00</cbc:TaxAmount>
<cac:TaxCategory>
<cbc:Percent>19.00</cbc:Percent>
<cac:TaxScheme>
<cbc:ID>01</cbc:ID>
<cbc:Name>IVA</cbc:Name>
</cac:TaxScheme>
</cac:TaxCategory>
</cac:TaxSubtotal>
</cac:TaxTotal>
<cac:Item>
<cbc:Description>Taladro</cbc:Description>
<cbc:PackSizeNumeric>1</cbc:PackSizeNumeric>
<cac:StandardItemIdentification>
<cbc:ID schemeID="999" schemeName="" schemeAgencyID="" schemeAgencyName="">999</cbc:ID>
</cac:StandardItemIdentification>
<cac:AdditionalItemIdentification>
<cbc:ID schemeID="999" schemeName="EAN13">Sis</cbc:ID>
</cac:AdditionalItemIdentification>
</cac:Item>
<cac:Price>
<cbc:PriceAmount currencyID="COP">10000.00</cbc:PriceAmount>
<cbc:BaseQuantity unitCode="94">1</cbc:BaseQuantity>
</cac:Price>
</cac:InvoiceLine>
Para ver:
https://catalogo-vpfe-hab.dian.gov.co/Document/FindDocument?documentKey=bb1f69eefc501142a8478a99bbc2eb5a0325686bdc5126ef746c763ae43c51acb4d98ebf2338452408d108962458a6fa&partitionKey=co%7C05%7Cbb&emissionDate=20200705