Class DocumentExtension
- Namespace
- RetailForce.Fiscalisation.Model.Document
- Assembly
- RetailForce.Fiscalisation.Model.dll
public static class DocumentExtension
- Inheritance
-
DocumentExtension
- Inherited Members
Methods
CalculateDiscountedValues(DocumentPositionSubItem, DocumentPositionItem)
Calculates the gross, net, tax and tax2 values of subitems to reflect discounts, added to the parent item.
public static (decimal grossValue, decimal netValue, decimal taxValue, decimal? taxValue2) CalculateDiscountedValues(this DocumentPositionSubItem subItem, DocumentPositionItem parent)
Parameters
subItemDocumentPositionSubItemThe subitem
parentDocumentPositionItemThe parent of the subitem. It is needed to calculate the discount factor (rabattFactor). The discount value is calculated as GrossValue (the gross value with discount) / BaseGrossValue (the gross value without discount)
Returns
GetBookingPositions(Document)
Returns all positions of type DocumentPositionBooking.
public static List<DocumentPositionBooking> GetBookingPositions(this Document document)
Parameters
documentDocumentThe document to fetch the positions.
Returns
GetBusinessTransactionTypePositions(Document, BusinessTransactionType?)
Returns all business type transaction positions.
public static IEnumerable<IBusinessTransactionTypePosition> GetBusinessTransactionTypePositions(this Document document, BusinessTransactionType? businessTransactionType = null)
Parameters
documentDocumentThe document where the positions are stored.
businessTransactionTypeBusinessTransactionType?A filter to fetch only positions having this business transaction type. Optional.
Returns
- IEnumerable<IBusinessTransactionTypePosition>
All business type transaction positions.
Remarks
If document or document.Positions is null this method returns null.
GetItemAndBookingPositions(Document?, Func<IBusinessTransactionTypePosition, bool>?)
Returns all positions of type DocumentPositionItem and DocumentPositionBooking.
public static IEnumerable<IBusinessTransactionTypePosition>? GetItemAndBookingPositions(this Document? document, Func<IBusinessTransactionTypePosition, bool>? positionFilter = null)
Parameters
documentDocumentThe document to fetch the positions.
positionFilterFunc<IBusinessTransactionTypePosition, bool>Optional. A possible positionFilter expression.
Returns
- IEnumerable<IBusinessTransactionTypePosition>
A list of type DocumentPositionVatPosition representing all positions of type DocumentPositionItem and DocumentPositionBooking.
Remarks
This method does not include sub item positions.
GetItemPositions(Document)
Returns all positions of type DocumentPositionItem.
public static List<DocumentPositionItem> GetItemPositions(this Document document)
Parameters
documentDocumentThe document to fetch the positions.
Returns
Remarks
This method does not include sub item positions.
GetTaxPositions(Document, ItemType, bool)
The summary of the tax positions for the document for the given item tax type.
public static List<DocumentTaxPosition> GetTaxPositions(this Document document, ItemType taxType, bool valuePositionCalculation)
Parameters
documentDocumentThe document to fetch the positions.
taxTypeItemTypeThe item type to filter the tax positions.
valuePositionCalculationbool
Returns
- List<DocumentTaxPosition>
A list of tax positions representing the tax of document grouped by vat rates.
GetTaxPositions(Document?, bool, Func<IBusinessTransactionTypePosition, bool>?, bool, bool)
The summary of the tax positions for the document.
public static IEnumerable<DocumentTaxPosition>? GetTaxPositions(this Document? document, bool notUseTaxPositions = true, Func<IBusinessTransactionTypePosition, bool>? positionFilter = null, bool valuePositionCalculation = false, bool roundTwoDigitsBeforeSum = false)
Parameters
documentDocumentThe document to fetch the positions.
notUseTaxPositionsboolOptional. If tax positions of document are manually set and this parameter is true, the document tax positions will not be used.
positionFilterFunc<IBusinessTransactionTypePosition, bool>Optional. A possible positionFilter expression.
valuePositionCalculationboolroundTwoDigitsBeforeSumboolrounds to two digits before sum
Returns
GetTaxPositions(IEnumerable<IBusinessTransactionTypePosition>, bool, bool)
The summary of the tax positions for the given positions.
public static IEnumerable<DocumentTaxPosition> GetTaxPositions(this IEnumerable<IBusinessTransactionTypePosition> positions, bool valuePositionCalculation, bool roundTwoDigitsBeforeSum = false)
Parameters
positionsIEnumerable<IBusinessTransactionTypePosition>valuePositionCalculationboolroundTwoDigitsBeforeSumboolrounds to two digits before sum
Returns
GetTotalBaseGrossAmount(Document?, Func<IBusinessTransactionTypePosition, bool>?)
Returns the total base gross amount of the given document.
public static decimal GetTotalBaseGrossAmount(this Document? document, Func<IBusinessTransactionTypePosition, bool>? positionFilter = null)
Parameters
documentDocumentThe document to evaluate the total gross amount.
positionFilterFunc<IBusinessTransactionTypePosition, bool>Optional. A possible positionFilter expression.
Returns
- decimal
The total base gross amount of the given document.
Remarks
The value is returned without regarding the document type.
GetTotalDiscountAmount(Document?, Func<DocumentPositionItem, bool>?)
Returns the total discount amount of the given document.
public static decimal GetTotalDiscountAmount(this Document? document, Func<DocumentPositionItem, bool>? positionFilter = null)
Parameters
documentDocumentThe document to evaluate the total net amount.
positionFilterFunc<DocumentPositionItem, bool>Optional. A possible positionFilter expression.
Returns
- decimal
The total net amount of the given document.
Remarks
The value is returned without regarding the document type.
GetTotalDiscountQuantity(Document?, Func<DocumentPositionItem, bool>?)
Returns the total discount quantity of the given document.
public static int GetTotalDiscountQuantity(this Document? document, Func<DocumentPositionItem, bool>? positionFilter = null)
Parameters
documentDocumentThe document to evaluate the discount quantity.
positionFilterFunc<DocumentPositionItem, bool>Optional. A possible positionFilter expression.
Returns
- int
The discount quantity of the given document.
Remarks
The value is returned without regarding the document type.
GetTotalGrossAmount(Document?, Func<IBusinessTransactionTypePosition, bool>?)
Returns the total gross amount of the given document.
public static decimal GetTotalGrossAmount(this Document? document, Func<IBusinessTransactionTypePosition, bool>? positionFilter = null)
Parameters
documentDocumentThe document to evaluate the total gross amount.
positionFilterFunc<IBusinessTransactionTypePosition, bool>Optional. A possible positionFilter expression.
Returns
- decimal
The total gross amount of the given document.
Remarks
The value is returned without regarding the document type.
GetTotalNetAmount(Document?, Func<IBusinessTransactionTypePosition, bool>?)
Returns the total net amount of the given document.
public static decimal GetTotalNetAmount(this Document? document, Func<IBusinessTransactionTypePosition, bool>? positionFilter = null)
Parameters
documentDocumentThe document to evaluate the total net amount.
positionFilterFunc<IBusinessTransactionTypePosition, bool>Optional. A possible positionFilter expression.
Returns
- decimal
The total net amount of the given document.
Remarks
The value is returned without regarding the document type.
NOTE: diese funktion unterstützt derzeit noch nicht das Flag UseSubItemVatCalculation --> sollte sie schon, aber nicht ohne vorherige Rücksprache mit Wolfgang ändern, weil zu zentrale Codestelle! --> siehe Ticket RF #1539
GetTotalTaxAmount(Document, Func<IBusinessTransactionTypePosition, bool>?)
Returns the total tax amount of the given document.
public static decimal GetTotalTaxAmount(this Document document, Func<IBusinessTransactionTypePosition, bool>? positionFilter = null)
Parameters
documentDocumentThe document to evaluate the total tax amount.
positionFilterFunc<IBusinessTransactionTypePosition, bool>Optional. A possible positionFilter expression.
Returns
- decimal
The total tax amount of the given document.
Remarks
The value is returned without regarding the document type.
GetTotalTaxAmount2(Document, Func<IBusinessTransactionTypePosition, bool>?)
Returns the total tax amount 2 of the given document.
public static decimal GetTotalTaxAmount2(this Document document, Func<IBusinessTransactionTypePosition, bool>? positionFilter = null)
Parameters
documentDocumentThe document to evaluate the total tax amount 2.
positionFilterFunc<IBusinessTransactionTypePosition, bool>Optional. A possible positionFilter expression.
Returns
- decimal
The total tax amount 2 of the given document.
Remarks
The value is returned without regarding the document type.
GetVoucherIds(Document)
Returns all voucher id's for the document (including id's of booking elements, not only payments).
public static List<string> GetVoucherIds(this Document document)
Parameters
documentDocumentThe document to get all voucher id's.
Returns
- List<string>
All voucher id's for the document (including id's of booking elements, not only payments).
calculateGrossFromNet(decimal, decimal, decimal?)
Calculates gross value from net amount and the vat percentages
public static decimal calculateGrossFromNet(decimal netAmount, decimal vatPercent1, decimal? vatPercent2)