Your bug is in
Select isnull(sum(p.SalePrice * d.SoldQuantity)* dr.DiscountRate/100),00.00
The closing bracket on
isnull
is not including the default value for when the discount is null.
This should probably be something like
Select (sum(p.SalePrice * d.SoldQuantity)* isnull(dr.DiscountRate/100, 0))