private static Dto.Xsd.InvoiceDetail GetInvoiceDetail(Invoice invoice, IIndexedItem <Revenue> indexedRevenueItem) { var revenueItem = indexedRevenueItem.Value; var invoiceDetail = new Dto.Xsd.InvoiceDetail { LineNumber = indexedRevenueItem.Index, NetValue = Math.Abs(revenueItem.NetValue.Value), VatAmount = Math.Abs(revenueItem.VatValue.Value), VatCategory = MapVatCategory(revenueItem.TaxType), IncomeClassification = new[] { GetIncomeClassification(invoice, revenueItem) } }; if (revenueItem.VatExemption.HasValue) { invoiceDetail.VatExemptionCategory = MapVatExemptionCategory(revenueItem.VatExemption.Value); invoiceDetail.VatExemptionCategorySpecified = true; } return(invoiceDetail); }
static bool HaveSameIndexAndItem <T>(IIndexedItem <T> x, IIndexedItem <T> y) { return(x.Index == y.Index && EqualityComparer <T> .Default.Equals(x.Item, y.Item)); }
private static Dto.LineModificationReferenceType GetLineModificationReference(IIndexedItem <InvoiceItem> item, int modificationIndexOffset) { return(new Dto.LineModificationReferenceType { lineNumberReference = (item.Index + modificationIndexOffset).ToString(), lineOperation = Dto.LineOperationType.CREATE }); }