SELECT
  A.UserID,
  A.Office365Email AS Office365EmailEdit,
  A.FullName,
  A.GivenName,
  A.Status,
  IF(A.Status = 1, "Active", "Cancelled") AS UserStatus,
  fnUserBranch(A.UserID, NOW()) AS BranchID,
  A.TeamLeaderID,
  A.CellPhoneNo,
  A.TelephoneNo,
  A.CMSPassword,
  A.PasswordExpiryDate,
  A.JobTitle,
  A.UserBillingGroupID,
  A.EmployeeCode,
  A.TargetAmount,
  A.AllowTravel,
  A.IsResource,
  A.MapReference,
  A.VehiclePurchasePrice,
  A.VehiclePurchaseDate,
  A.VehicleMake,
  A.VehicleModel,
  A.VehicleRegYear,
  fnDepreciatedVehicleValue(A.VehiclePurchasePrice, A.VehiclePurchaseDate, NOW(), @nDepreciation) AS DepreciatedVehicleValue,
  fnConsultantTravelRate(A.VehiclePurchasePrice, A.VehiclePurchaseDate, NOW(), @nDepreciation, @nAssumedAnnual) AS ConsultantTravelRate,
  A.VehicleNumberPlate,
  A.ReviewLevel,
  A.HomePage,
  A.AllowedRegions,
  A.AllowedProducts
FROM
  taUsers AS A
WHERE
  A.UserID = @nUserID;
