SELECT
CustInv.TransactionDate
,CustInv.UserTranNumber
,Cust.CompanyName
,CustIDet.AircraftNumber
,CustIDet.NumNameCode
,CustIDet.Quantity
,CustIDet.SalePrice
,CustIDet.UnitCost
,CustIDet.SalePrice - CustIdet.Unitcost AS Margin
FROM
CustInv
JOIN Cust
ON
CustInv.CustomerID = Cust.CustomerID
JOIN CustIDet
ON
CustIDet.TransactionID = CustInv.TransactionID
WHERE
CustInv.TransactionDate BETWEEN @startDate AND @endDate
AND
CustInv.LocationID = @location
AND
CustIDet.NumNameCode LIKE 'JET-A%'
ORDER by CustInv.TransactionDate ASC
|