Basically, it seems you need to group by Buyer and the name of the correct month, then pivot the aggregated results on the month name column. Here's how you could go about it, provided you are using SQL Server 2005 or later version:
WITH monthly AS (
SELECT
Buyer,
Amount = Credit - Debit,
CreditMonth = DATENAME(MONTH, MIN(Date) OVER (PARTITION BY Buyer, Info2, LinkKey)),
TotalAmount = SUM(Credit - Debit) OVER (PARTITION BY Buyer)
FROM atable
)
SELECT
Buyer,
January = ISNULL(January , 0),
February = ISNULL(February, 0),
March = ISNULL(March , 0),
April = ISNULL(April , 0),
May = ISNULL(May , 0),
Amount = TotalAmount
FROM monthly
PIVOT (
SUM(Amount) FOR CreditMonth IN (January, February, March, April, May)
) p
;
This is how the query works:
Every Credit/Debit column pair in the monthly common table expression (CTE) is represented as a single column, Credit - Debit, aliased Amount.
The month name for every Amount value is derived, using DATENAME(), from the minimum Date value in the same group (or partition) of Buyer, Info2, LinkKey as the current row. (The requirement is to use the credit date. The credit date is supposed to go before the debit one(s), hence looking for the minimum date.) The query uses a window MIN() function to get the minimum Dates.
The TotalAmount column is the sum of all Credit - Debit results per Buyer. It is calculated using a window aggregate function too, which is SUM() this time. (The column is re-aliased as Amount in the final SELECT to match your expected output, but it seemed to me to make more sense to call it TotalAmount at this stage.) Eventually, this is what the monthly CTE produces:
Buyer CreditMonth BIL_Amount Amount
Samuel March 500 200
Samuel March -300 200
Maria May 300 150
Maria May -300 150
Maria February 150 150
The PIVOT clause in the main query does both grouping and pivoting of the above result set. Grouping is implicit: all columns in the monthly dataset except one (Amount) are the (implicit) GROUP BY columns, that's just how PIVOT works. (The CreditMonth column, in addition to being a GROUP BY column, is specified to be the one that the result set is pivoted on.) So, essentially, the monthly results are being grouped by Buyer, CreditMonth, Amount.
Not all months may be present for every buyer. That means some month columns might contain NULLs in the final result set. That is the reason why the final SELECT uses ISNULL(): to default those NULLs to 0's.
So, that is what the query is doing, and you can try and play with it at SQL Fiddle too.