Added function generateDocumentNumber