Almost everything on the stock market is down over the past week, but solar stocks have been hit particularly hard. Nearly all of the solar stocks I follow were down more than 10% yesterday when the market fell of a cliff.

First Solar's (Nasdaq: FSLR) quarterly report didn't ease any fears last week, and there was little good news in the rest of the sector. JA Solar (Nasdaq: JASO) announced it would have negative margins because of an "inventory provision recorded on high-cost inventory." Trina Solar (NYSE: TSL) lowered its guidance for both shipments and gross margins for the quarter.

The lone bright spot was Yingli Green Energy (NYSE: YGE), which increased shipment guidance and reaffirmed expected gross margins. Of course, that didn't keep the stock from falling along with the rest of the sector.

Take a deep breath
With so much news swirling, let's take a step back, take a deep breath, and see where these companies are really trading right now. Since both net and gross margins can fly all over the place, a price-to-sales multiple may be the best way to judge solar companies right now.

Company

Market Cap

Sales (TTM)

Price/Sales

First Solar $8.36 billion $2.51 billion 3.33
SunPower (Nasdaq: SPWRA) $1.57 billion $2.32 billion 0.68
Trina Solar $1.12 billion $2.07 billion 0.54
Yingli Green Energy $838 million $2.07 billion 0.41
LDK Solar (NYSE: LDK) $679 million $3.00 billion 0.23
JA Solar $586 million $2.05 billion 0.29

Source: Fool.com.

Price-to-sales multiples that low would suggest that solar stocks are nearly going out of business. But most indications point to a decent profit margin for most companies in the second quarter, and improving conditions for the rest of 2011.

Trina Solar is expecting a 20% gross margin; Yingli forecasts a gross margin in the mid-to-low 20s; and First Solar already reported a gross margin of 36.5% in the second quarter. If conditions in Europe and the U.S. are indeed picking up, as comments from management across the industry have suggested, then solar stocks are a bargain.

But those three companies are vertically integrated, giving them shelter from some pressures in the industry. Not everyone is so lucky.

Not a rosy outlook for all
For companies that aren't vertically integrated, the second and third quarters might not be quite as promising. In ReneSola's (NYSE: SOL) earnings, announced this mornings, revenue fell 30.9%, gross margin dropped almost 10% to 18.4%, and the company barely squeaked out a profit of $0.02 per share.

With competitors seeing light during Q3, ReneSola thinks margins will continue to fall to between 6% and 8%. The company even withdrew full-year guidance. With most of its debt in short-term borrowings, there is a lot of risk on ReneSola's balance sheet.

I've mentioned in the past how suppliers will suffer the most as costs are squeezed. Now, that appears to be coming true. Vertically integrated manufacturers are the safest place to invest. If they have a big project development unit, that's even better. Otherwise, you're at the mercy of the market.

Foolish bottom line
Based on initial numbers coming out, I think solar stocks have sold off far more than is justified, as long as you stick with market leaders. It's going to be a tough quarter, and margins are falling across the sector. But with improvements coming in the second half of the year, there is a lot of upside here.

What do you think? Is it time to buy solar stocks? Sound off in the comments section below, and be sure to add your favorite solar stocks to My Watchlist to keep up on earnings season.