Question / Problem:
Sometimes it is not possible to delete an invoice from Manager if it has become corrupt.
Answer / Solution:
If an invoice cannot be removed from Manager it will need to be removed from the database directly and it is recommend that these steps are carried out by a DBA and a backup of the database is taken first.
Enter How to here:
- Make a note of the Invoice ID number in Manager
- On the Database server open "SQL Managment Studio"
- Paste the following script as a new query against the INVOICES database
declare @docid int
set @docid = *****
DELETE FROM docprofileconnection WHERE docid = @docid
DELETE FROM docuserdefs WHERE docid in (select docid from documents where parent = @docid)
DELETE FROM docqueues WHERE docid in (select docid from documents where parent = @docid)
DELETE FROM documents WHERE parent = @docid
DELETE FROM docuserdefs WHERE docid=@docid
DELETE FROM docqueues WHERE docid=@docid
DELETE FROM documentslocks WHERE docid=@docid
DELETE FROM documents WHERE docid=@docid
DELETE FROM documentposition WHERE docid=@docid
DELETE FROM docrefby where docid=@docid
Change the "******" to the Invoice ID you first made a note of at step 1
Execute the query
If you now refresh the view in Manager the invoice will be gone.