When you see the 'Cannot delete a referenced record' notification, it's because the record is linked to other records in your Infusion data. Infusion maintains strong links between records to ensure data accuracy, and so this means you sometimes cannot delete a record.
Some entities, like GL codes, have a References tab on the Enquiry screen that indicates why the entity can't be deleted. Most of the time, this should mean the entity should be deactivated instead of deleted.