Class Document
- Namespace
- RetailForce.Fiscalisation.Model.Document
- Assembly
- RetailForce.Fiscalisation.Model.dll
Represents a fiscal document.
public sealed class Document : DocumentValidationBase
- Inheritance
-
ValidationBase<DocumentValidationError>ValidationPropertyBase<DocumentValidationError>Document
- Inherited Members
-
ValidationPropertyBase<DocumentValidationError>.Validate()
- Extension Methods
Constructors
Document()
Constructor.
public Document()
Document(FiscalResponse)
Constructor.
public Document(FiscalResponse response)
Parameters
responseFiscalResponseA FiscalResponse object representing the fiscal response for starting a transaction.
Exceptions
- ArgumentNullException
Thrown if
responseparameter is set to null.
Fields
CLOSING_CLOSEMONTH
public const string CLOSING_CLOSEMONTH = "CLOSEMONTH"
Field Value
SmallAmountInvoiceMaxAmount
public const int SmallAmountInvoiceMaxAmount = 250
Field Value
VoucherIdFieldName
public const string VoucherIdFieldName = "VoucherId"
Field Value
Properties
AccountingDate
The accounting date described a possible accounting date for this document in the accounting.
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public DateTimeOffset? AccountingDate { get; set; }
Property Value
Remarks
The format for this property is according ISO 8601 including time zone information. Sample: 2013-01-21T00:00:00+01:00. If time zone is omitted, time zone is interpreted in the local setting of the executing environment.
AdditionalFields
Additional fields for the document.
public Dictionary<string, string> AdditionalFields { get; set; }
Property Value
AdditionalFooter
Additional text lines for print out in the footer of the document.
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public List<string> AdditionalFooter { get; set; }
Property Value
AdditionalHeader
Additional text lines for print out in the header of the document.
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public List<string> AdditionalHeader { get; set; }
Property Value
AllocationGroups
The allocation group for the document.
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public List<string> AllocationGroups { get; set; }
Property Value
Remarks
Country specific implementation:
- DE (Germany): used for marking tables on orders and receipts.
AllowedVatDeviation
Represents the absolute allowed vat deviation.
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
public decimal AllowedVatDeviation { get; set; }
Property Value
Remarks
Default: 0. Can be set to avoid vat calculation problems. Please use carefully. Settings this value to a high value disables vat calculation check!
Example: vat deviation of 0.05 allows 5 cent deviation between netValue + taxValue = grossValue (+-0.05).
Amount
The audit log amount
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public decimal? Amount { get; set; }
Property Value
ApplicationVersion
The version of the software which is sending the document (pos software version).
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public string ApplicationVersion { get; set; }
Property Value
Remarks
(in case of Canada / Quebec: "versi" / Version)
ApplicationVersionId
The application version id.
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public string ApplicationVersionId { get; set; }
Property Value
Remarks
(Canada / Quebec: "idVersi" / VersionId)
ApplicationVersionPrevious
The application version previous.
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public string ApplicationVersionPrevious { get; set; }
Property Value
Remarks
(in case of Canada / Quebec: "versiParn" / ParentVersion)
AuditLogEntryType
The Audit log entry type
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public LogEntryType? AuditLogEntryType { get; set; }
Property Value
AutomaticVatCalculation
Flag to inform the fiscal module that the net or gross value should be calculated by the fiscal system.
public AutomaticVatCalculation AutomaticVatCalculation { get; set; }
Property Value
Remarks
Default: AutomaticVatCalculation.NoCalculation Information: Using gross value calculation, gross value will be calculated to 2 decimal places.
BookDate
The storage date of the document.
[Required]
public DateTimeOffset BookDate { get; set; }
Property Value
Remarks
The format for this property is according ISO 8601 including time zone information. Sample: 2013-01-21T00:00:00+01:00. If time zone is omitted, time zone is interpreted in the local setting of the executing environment.
CancellationDocument
True if this document cancels another document; otherwise false.
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
public bool CancellationDocument { get; set; }
Property Value
Remarks
If this is property is set to true the document reference must be set (with ReferenceType Cancellation).
Coupon
Possible coupon for print outs.
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public DocumentCoupon Coupon { get; set; }
Property Value
CreateDate
The creation date of the document. Must be set when the document was initially created.
[Required]
public DateTimeOffset CreateDate { get; set; }
Property Value
Remarks
The format for this property is according ISO 8601 including time zone information. Sample: 2013-01-21T00:00:00+01:00. If time zone is omitted, time zone is interpreted in the local setting of the executing environment.
CustomerCount
The count of customers for this document (for instance in hospitality the number of guests on one receipt/table).
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public int? CustomerCount { get; set; }
Property Value
- int?
DeliveryPrintCount
Number of printouts of intermediate orders (e.g.: table orders, or kitchen/bar printout)
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
[Obsolete]
public int? DeliveryPrintCount { get; set; }
Property Value
- int?
DocumentGuid
The global unique identification of the document.
public Guid DocumentGuid { get; set; }
Property Value
Remarks
Not required, if not set it will be automatically set by the fiscal system. You can set this guid by your decision, it would be best to have a link to your transaction in your system (if possible). If you don't have Guid (UUID) in your system, just create a new random one.
DocumentId
The unique identification of the document (over all terminals in organization).
public string DocumentId { get; set; }
Property Value
Remarks
Should be continuous and unique identification of all documents. required, max length = 40.
Must not contain characters which are invalid for path in file system.
DocumentIssueType
The type of the document how it was issued to the customer/partner.
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public DocumentIssueType? DocumentIssueType { get; set; }
Property Value
DocumentLevel
The validation level for this element.
protected override DocumentLevel DocumentLevel { get; }
Property Value
DocumentNumber
The number of the document (of the external system). Must not be unique over all terminals in the organization.
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public string DocumentNumber { get; set; }
Property Value
Remarks
In the normal case it represents the document number of the local system without document type and other values.
DocumentNumberSeries
The series for the document number (caption/short caption).
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public string DocumentNumberSeries { get; set; }
Property Value
DocumentReference
Reference to another document.
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public DocumentReference DocumentReference { get; set; }
Property Value
DocumentType
The type of the document.
public DocumentType DocumentType { get; set; }
Property Value
DocumentTypeCaption
The name of the document type. Better description of the document type.
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public string DocumentTypeCaption { get; set; }
Property Value
Remarks
For instance you can have to different types of document with the document type: Receipt. With this property it is possible to store this information (text). This property can be also filled with language specific text (so "Beleg" for austria for example).
ExternalDocumentNumber
The external document number (may be null).
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public string ExternalDocumentNumber { get; set; }
Property Value
Remarks
This can be used when no internal invoice is available and can therefore not be referenced. (e.g. for document type PaymentReceipt in Slovakia)
FailedToPay
True if failed to pay (e.g. customer has left without to pay); otherwise false.
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
public bool FailedToPay { get; set; }
Property Value
FiscalAdditionalFields
[JsonIgnore]
public ReadOnlyDictionary<string, object> FiscalAdditionalFields { get; }
Property Value
FiscalCountryModuleVersion
The fiscal module country version of this document (will be set automatically by the fiscal middleware).
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public string FiscalCountryModuleVersion { get; set; }
Property Value
FiscalDocumentNumber
This property must be set before storing or canceling the document with the return values of fiscal response of CreateDocument.
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
public int FiscalDocumentNumber { get; set; }
Property Value
Remarks
If you use constructor Document(FiscalResponse) it will be set by the constructor.
FiscalDocumentRevision
This property must be set before storing or canceling the document with the return values of fiscal response of CreateDocument.
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
public int FiscalDocumentRevision { get; set; }
Property Value
Remarks
If you use constructor Document(FiscalResponse) it will be set by the constructor.
FiscalDocumentStartTime
This property must be set before storing or canceling the document with the return values of fiscal response of CreateDocument.
[JsonProperty("FiscalDocumentStartTime", NullValueHandling = NullValueHandling.Ignore)]
public long? FiscalDocumentStartTime { get; set; }
Property Value
- long?
Remarks
If you use constructor Document(FiscalResponse) it will be set by the constructor.
FiscalModuleVersion
The fiscal module version of this document (will be set automatically by the fiscal middleware).
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public string FiscalModuleVersion { get; set; }
Property Value
FiscalResponse
The fiscal response for this document when signed by fiscalisation unit.
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public FiscalResponse? FiscalResponse { get; }
Property Value
Remarks
DO NOT SET THIS PROPERTY EXCEPT AFTER SIGNING IN THE APPROPIATE MODULE.
FooterGraphicIndex
Set index to a value from 0 to 9 to print out a footer graphic.
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public int? FooterGraphicIndex { get; set; }
Property Value
- int?
FriendlyName
Optional friendly name for certificate requests (CSR) (usually only used in test environments, not in production)
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
public string FriendlyName { get; set; }
Property Value
Identifier
An additional identifier for the audit log entry
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public string Identifier { get; set; }
Property Value
IsEcommerceTransaction
True if the document is an ecommerce transaction, otherwise false.
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public bool? IsEcommerceTransaction { get; set; }
Property Value
- bool?
IsTraining
True if this document is a training document; otherwise false.
[Required]
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
public bool IsTraining { get; set; }
Property Value
ModelVersion
Returns the version of the document model structure.
public string ModelVersion { get; }
Property Value
Notes
Additional notes for the document (header notes). Maximum: 255 characters.
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public string Notes { get; set; }
Property Value
ParagonDocument
True if this document is a paragon document (= hand written); otherwise false.
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
public bool? ParagonDocument { get; set; }
Property Value
- bool?
ParagonIssueDate
Paragon issue date
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
public DateTimeOffset? ParagonIssueDate { get; set; }
Property Value
Remarks
Needs to be set if ParagonDocument is true. Must not be set if ParagonDocument is false.
ParagonNumber
Paragon number
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
public string ParagonNumber { get; set; }
Property Value
Remarks
Needs to be set if ParagonDocument is true. Must not be set if ParagonDocument is false.
Partner
The partner for the document. A partner can be for instance a customer, a supplier, etc.
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public Partner Partner { get; set; }
Property Value
PaymentTerms
The payment terms for the document.
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public PaymentTerms PaymentTerms { get; set; }
Property Value
Payments
The payments for the document.
public List<DocumentPayment> Payments { get; set; }
Property Value
Remarks
Depending on the document type it is necessary to have payments attached or not.
PositionCount
The count of the positions (including all positions, Booking, Item, Total).
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public uint? PositionCount { get; set; }
Property Value
- uint?
Remarks
If set it must correspond to the transferred number of positions; otherwise a validation error would occur.
Positions
The positions for the document.
[Required]
public List<DocumentPositionBase> Positions { get; set; }
Property Value
Remarks
Positions can be of type:
- ItemPosition
- TextPosition
- SubItemPosition
PrintCount
The print count for this document.
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
[Obsolete]
public int? PrintCount { get; set; }
Property Value
- int?
Remarks
In several countries it is necessary to store and update the print count for a document (eg. France, Denmark). This number is the number of print outs at the initial transaction / document creation.
ProcessStartDate
The date of the first receipt for the whole process.
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public DateTimeOffset? ProcessStartDate { get; set; }
Property Value
Remarks
This field is used for long-term orders (eg. gastronomy) for print out in germany (mandatory if long-term orders are used). The format for this property is according ISO 8601 including time zone information. Sample: 2013-01-21T00:00:00+01:00. If time zone is omitted, time zone is interpreted in the local setting of the executing environment.
ProformaPrintCount
Number of prints before saving the document (e.g..: Information printing in gastronomy)
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
[Obsolete]
public int? ProformaPrintCount { get; set; }
Property Value
- int?
RetailForceReceiptId
The unique RetailForce receipt id. Necessary for certain implementation of digital receipt.
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public string RetailForceReceiptId { get; set; }
Property Value
SalesPerson
The salesperson for this transaction.
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public User SalesPerson { get; set; }
Property Value
ServicePeriodEnd
The end of the service period (especially for invoices).
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public DateTimeOffset? ServicePeriodEnd { get; set; }
Property Value
Remarks
The format for this property is according ISO 8601 including time zone information. Sample: 2013-01-21T00:00:00+01:00. If time zone is omitted, time zone is interpreted in the local setting of the executing environment.
ServicePeriodStart
The start of the service period (especially for invoices).
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public DateTimeOffset? ServicePeriodStart { get; set; }
Property Value
Remarks
The format for this property is according ISO 8601 including time zone information. Sample: 2013-01-21T00:00:00+01:00. If time zone is omitted, time zone is interpreted in the local setting of the executing environment.
ServiceType
The type of the service (if service for instance in hospitality) for several countries (eg. Canada)
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public string ServiceType { get; set; }
Property Value
SoftwareName
The name of the software creating this document (will be set automatically by the fiscal middleware if not set).
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public string SoftwareName { get; set; }
Property Value
TaxPositions
Represents a list of all tax positions (of document).
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public List<DocumentTaxPosition>? TaxPositions { get; set; }
Property Value
Remarks
You have to send either no position here or all tax positions of the document.
To get the tax positions from the document (if this property was not set) use DocumentExtension.GetTaxPositions(Document, bool).
Austria: Use this property to send the tax positions for the document to ensure not to have rounding problems with the dep.
TerminalSlaveId
The id of a terminal slave (multiple additional slaves are possible for one terminal).
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public string TerminalSlaveId { get; set; }
Property Value
Remarks
Please take a look at FiscalCountryProperties.TerminalSlaveSupported if country supported terminal slaves.
TestCaseNumber
Optional test case number (usually only used in test environments, not in production)
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
public string TestCaseNumber { get; set; }
Property Value
UniqueCashRegisterId
The unique cash register id (will be set automatically by the trusted fiscal module).
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public string UniqueCashRegisterId { get; }
Property Value
UniqueClientId
Represents the client for this document.
[Required]
public Guid UniqueClientId { get; set; }
Property Value
Remarks
The client must be found in the current configuration and may not be Empty.
User
The user for this transaction.
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public User User { get; set; }
Property Value
Methods
CheckDocumentTypeBusinessTransactionType(Dictionary<DocumentType, Dictionary<BusinessTransactionType, bool>>, DocumentType, BusinessTransactionType, List<DocumentValidationError>, bool)
Checks document and business transaction type mapping.
public static bool CheckDocumentTypeBusinessTransactionType(Dictionary<DocumentType, Dictionary<BusinessTransactionType, bool>> mappingDictionary, DocumentType documentType, BusinessTransactionType businessTransactionType, List<DocumentValidationError> errorList, bool useErrorList = true)
Parameters
mappingDictionaryDictionary<DocumentType, Dictionary<BusinessTransactionType, bool>>The dictionary with the mapping.
documentTypeDocumentTypeThe document type to check.
businessTransactionTypeBusinessTransactionTypeThe business transaction type to check.
errorListList<DocumentValidationError>A possible error list to add a validation error. If null no error is added.
useErrorListboolTrue if error should be added to the list; otherwise false. If
errorListis null no error is added independent of this setting.
Returns
- bool
True if an error would be added (independent from
useErrorListanderrorList.
CreateStartDocument(Guid, DateTimeOffset?, User?, IFiscalCountryProperties?)
Creates a start document (used for initialization).
public static Document CreateStartDocument(Guid uniqueClientId, DateTimeOffset? bookDate = null, User? user = null, IFiscalCountryProperties? countryProperties = null)
Parameters
uniqueClientIdGuidThe unique client id of the client which should process the start document.
bookDateDateTimeOffset?The book date of the start document, if null, Now is used.
userUserA possible user for the start document. If omitted default values will be set. It is recommend to send this information.
countryPropertiesIFiscalCountryPropertiesOptional fiscal country properties. Some values may change due to country properties. If not indicated, default values will be used
Returns
- Document
A start document (used for initialization).
Remarks
Feel free to change all other properties of the document (for instance user).
GetDocumentTypeBusinessTransactionTypeSupport()
Returns default document type / business transaction type mapping.
public static Dictionary<DocumentType, Dictionary<BusinessTransactionType, bool>> GetDocumentTypeBusinessTransactionTypeSupport()
Returns
- Dictionary<DocumentType, Dictionary<BusinessTransactionType, bool>>
Default document type / business transaction type mapping.
Remarks
If document type is set, but business transaction type dictionary is null -> all business transaction types are allowed. If document type is not found, all business transaction types are allowed. If document type and business transaction type is found, value must be true to be supported.
SetFiscalResponse(FiscalResponse)
Set fiscal response from create document to existing (and with data filled) document.
public void SetFiscalResponse(FiscalResponse response)
Parameters
responseFiscalResponseThe fiscal response to set into the document.
Remarks
To setup a holy new document with fiscal response just use constructor with FiscalResponse parameter.
Exceptions
- ArgumentNullException
Thrown if parameter
responseis set to null.
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.
ValidateElement()
Validates the element and returns a list of DocumentValidationError objects.
protected override List<DocumentValidationError> ValidateElement()
Returns
- List<DocumentValidationError>
A list of DocumentValidationError objects.