Generally speaking, you are looking at about 4 days before your system would be clear for a urine test, so now we need to try to get you to pass it.
Here's a little tip that may help too:
Try exercising as much as possible to sweat it out, drink lots of water (which you will need to do anyway to replace lost fluids) and go to the bathroom as much as possible. I have also heard that cranberry juice helps, it's certainly worth a try!
If your test is within the next four days, it may be worth calling in sick (a vomiting bug would be a good excuse, especially if you have diarrhoea as well, you can't possibly leave your bed, let alone your house then can you?).
If you can then get the test postponed somehow, you should be fine. But whatever you do, stay clean until after the test - good luck!