I have the following code but it does nto work, I think it is something to do with the Round and sum functions inside the case clause.
SELECT
Case When @JobsInvoiceVatiD = 1 then
Round(TPP.PartsPaidAmount,2)
Else
Round(Sum(TPP.PartsPaidAmount / 1.175),2)
end As JobsSubTotal,
Round(Sum(TPP.PartsPaidAmount) - Sum(TPP.PartsPaidAmount / 1.175),2) As JobsVat,
Sum(TPP.PartsPaidAmount) As JobsTotal
FROM
tblPartsType AS TPT INNER JOIN
tblParts AS TP ON TPT.PartsTypeiD = TP.PartsTypeiD INNER JOIN
tblJobs AS TJ INNER JOIN
tblPartsPayment AS TPP ON TJ.JobsiD = TPP.JobsiD ON TP.PartsiD = TPP.PartsiD INNER JOIN
tblClients AS TC ON TJ.ClientsiD = TC.ClientsiD INNER JOIN
tblJobsStatus AS TJS ON TJ.JobsStatusiD = TJS.JobsStatusid
Where
TJ.jobsid = @jobsid