Per implementare un processo di annullamento (void) di un documento, è necessario procedere come segue:
Inizialmente, la procedura è identica a quella di registrazione di una normale ricevuta; la documentazione relativa a tale procedura è disponibile alla voce «Procedura di trasferimento dei documenti di base».
Per contrassegnare un documento come documento nullo (o annullato) (impostazione obbligatoria in diversi paesi), è necessario impostare le seguenti proprietà.
Tali proprietà sono disponibili nell’oggetto documento (RetailForce.Fiscalisation.Model.Document.Document)
- Impostare la proprietà cancellationDocument = true
- Aggiungere un riferimento al documento tramite la proprietà documentReference
- Invertire i valori del documento (rendere negativi tutti i valori) in relazione al documento annullato (il documento che si desidera annullare). Ciò significa che, se il documento da annullare presenta un fatturato di 20 EUR, il documento di annullamento avrà un fatturato di -20 EUR.
Codice C# di esempio:
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;
}
Per informazioni dettagliate sul modulo dell’oggetto documento, si prega di fare riferimento alla documentazione relativa al modello a oggetti del documento.
Questo articolo è stato tradotto automaticamente.
Commenti
0 commenti
Accedi per aggiungere un commento.