If a customer only wants to return one or more products (not all) of a previously stored document you can implement the return of goods-function.
In the event that all items (positions) of a previous transaction are to be cancelled, i.e. an entire transaction is to be reversed, you will find instructions in the article "Implementation of document cancel (void)".
In some countries, it is permitted to mix sales items with those that are to be cancelled in one transaction. For details, see "fiscalCountryProperties" - property: "Return and sale behaviour".
To configure a return-position (ItemPosition) you have to set the following properties:
- DocumentPositionItem.CancellationPosition = true
- DocumentPositionItem.PositionReference = Reference to the document of the orignated position
Code sample C#
public void AddCancelPosition(Document document, DocumentPositionItem cancelPosition, string refStoreNumber, string refTerminalNumber, string refDocumentNr, DateTime refBookDate) { // check parameter if (document == null) throw new ArgumentNullException(nameof(document)); if (cancelPosition == null) throw new ArgumentNullException(nameof(cancelPosition)); if (string.IsNullOrEmpty(refStoreNumber)) throw new ArgumentNullException(nameof(refStoreNumber)); if (string.IsNullOrEmpty(refTerminalNumber)) throw new ArgumentNullException(nameof(refTerminalNumber)); if (string.IsNullOrEmpty(refDocumentNr)) throw new ArgumentNullException(nameof(refDocumentNr)); if (document.BookDate < refBookDate) throw new ArgumentException("Referenced book date must be greater than document date."); // add more checks if necessary // revert the position (can also be done by the pos software) cancelPosition.Revert(); // set cancel flag cancelPosition.CancellationPosition = true; // set reference cancelPosition.PositionReference = new DocumentPositionReference() { DocumentBookDate = refBookDate, DocumentNumber = refDocumentNr, ReferenceType = ReferenceType.Cancellation, StoreNumber = refStoreNumber, TerminalNumber = refTerminalNumber }; document.Positions.Add(cancelPosition); }
Comments
0 comments
Please sign in to leave a comment.