fixed sql for addDocumentCode to include Batch ID