To implement a document cancel (void) process you've to do the following:
At first the process is the same way as booking a normal receipt, you can find the documentation for this process under Basic document transfer process.
To mark a document as an void (or cancellation) document (mandatory setting in several countries) you have to set the following properties.
You can find this properties at the document object (RetailForce.Fiscalisation.Model.Document.Document)
- Set property CancellationDocument = true
- Add a document reference with property DocumentReference
- Revert the document (turn all values negative) in relation to the canceled document (the document you want to cancel). This means if the to be canceled document has a turnover of 20 EUR the cancellation document has an turnover of -20 EUR.
Sample C# Code:
public Document CancelDocument(TrustedFiscalModule fiscalModule, Document documentToCancel, string storeNumber, string terminalNumber)
{
// check parameter
if (fiscalModule == null) throw new ArgumentNullException(nameof(fiscalModule));
if (documentToCancel == null) throw new ArgumentNullException(nameof(documentToCancel));
// revert all values of the document (can also be done by pos software)
Document cancelDocument = fiscalModule.RevertDocument(documentToCancel);
// set CancellationDocument property to true
cancelDocument.CancellationDocument = true;
// now set document cancellation reference
cancelDocument.DocumentReference = new DocumentReference()
{
DocumentType = DocumentType.Receipt,
DocumentBookDate = documentToCancel.BookDate,
DocumentId = documentToCancel.DocumentId,
DocumentGuid = documentToCancel.DocumentGuid, // not necessary
ReferenceType = ReferenceType.Cancellation,
DocumentNumber = documentToCancel.DocumentNumber,
FiscalDocumentNumber = documentToCancel.FiscalDocumentNumber,
StoreNumber = storeNumber,
TerminalNumber = terminalNumber
};
cancelDocument.BookDate = DateTime.Now;
cancelDocument.DocumentGuid = Guid.NewGuid();
cancelDocument.DocumentId = "NEWID";
cancelDocument.DocumentNumber = "NEWNUMBER";
return cancelDocument;
}
For detailed information about the document object module please refer to the document object model documentation.
Comments
0 comments
Please sign in to leave a comment.