When is a $34 million profit not a profit? When you're aaiPharma (NASDAQ:AAII) and you have to restate your earnings by $67 million to show that your gain was actually a $33 million loss.

This is just the latest result of aaiPharma's ongoing woes. The pharmaceutical firm's problems began when it launched an investigation into sales practices of its respiratory drug, Brethine, and the painkiller Darvocet.

Seems management engaged in the practice of "channel stuffing" by shipping larger quantities of product to wholesalers than what is actually sold through retailers and institutions. This was done with a guarantee to take back any unsold products. It gave the appearance of high revenues, but SEC regulations are very specific about when and how such revenue can be recognized, and aaiPharma apparently didn't follow those rules.

Of course, nothing's been proven, but when you're forced to hire a firm like FTI Consulting that engages in "forensic accounting," you know it can't be good.

Maybe the company should hire Mary Lou Retton instead to perform the financial gymnastics necessary to account for the loss of $1.18 per share in 2003 versus a previously reported profit of $1.17. Sales have also been rewritten to reflect the true value of $225 million, compared to their "over-stuffed" number of $282.7 million. Earnings for 2002 have also been revised downward, from $0.61 to $0.46 per share.

Back in December, management said earnings for 2004 would be in the area of $1.45 to $1.52, with revenues as high as $355 million for the full year. That's looking wishful now. With the restatements, management anticipates losses for the first two quarters and doesn't give guidance beyond that.

Yet, were there any clues this was coming? Perhaps. Sales were reported up 23% in 2003, but accounts receivable soared 57%. Such imbalances don't always mean a company is stuffing the channels. But receivables generally should track sales, and it's a red flag when things get out of whack like that.

Compare that to Hidden Gems pick Transkaryotic Therapies (NASDAQ:TKTX), which showed receivables up 47% in 2003, but sales up even more at 61% year over year. That's the kind of divergence investors should look for.

In the wake of aaiPharma's revelations, the CEO abruptly resigned (never a good sign), the principal lender blocked access to a $100 million credit facility (aaiPharma subsequently secured a new $40 million credit line), and aaiPharma flirted with a Nasdaq delisting.

All this has to bring a sigh of relief from shareholders of Cima Labs (NASDAQ:CIMA). Last November, its board of directors had approved aaiPharma's takeover of the maker of "fast-dissolve" versions of popular drugs, but the deal was questioned as being too cheap and the company eventually approved a takeover by Cephalon (NASDAQ:CEPH) instead.

It would appear that sales of Darvocet could rise in the near term as aaiPharma's management tries to deaden the pain of SEC investigations and class action lawsuits.

Fool contributor Rich Duprey uses Coors Light to deaden his pain. He does not own any of the stocks mentioned in this article.