UPDATE
  tbAppointments
SET

  --
  -- Appointment details.
  --
  AttendanceTypeID = @nAttendanceTypeID,
  SubAttendanceType = @aSubAttendanceType,
  CoverType = @nCoverType,
  AttendanceDate = @aAttendanceDate,
  AttendanceTime = CONCAT(@aAttendanceDate, ' ', @aAttendanceTime),
  Duration = @nDuration,
  AppointmentStage = IF(@aAppointmentStage = 'AuthReady', 'AuthReady', 'Appointment'),
  BillingYearMonth = NULL,
  DontDeductFromCover = @bDontDeductFromCover,
  TrainingRequired = @bTrainingRequired,
  ReferralRequested = @bReferralRequested,
  ProjectID = @nProjectID,
  CaseID = @nCaseID,
  LastChangeDate = NOW(),
  EmployeeParticulars = @aEmployeeParticulars,
  ClientOrderNumber = @aClientOrderNumber,

  --
  -- Client details.
  --
  ClientID = @nClientID,
  ClientBranchID = @nClientBranchID,
  ProductID = @nProductID,
  ClientBranchProductID = @nClientBranchProductID,
  AccountBookType = @aAccountBookType,
  AccountBookID = @nAccountBookID,

  --
  -- IR details.
  --
  IRChargeType = @aIRChargeType,
  IRFinding = @aIRFinding,
  IRRecommendationID = @nIRRecommendationID,

  --
  -- Consultant details.
  --
  BookedByID = @nBookedByID,
  ConsultantID = @nConsultantID,
  ConsultantBranchID = @nConsultantBranchID,
  `OnLine` = @nOnLine,

  --
  -- Costing details.
  --
  TimeSpent = @nTimeSpent,
  ActualHoursSpent = @nTimeSpent,
  TimeSpentRate = @nTimeSpentRate,

  --
  -- Travel time billing details.
  --
  TravelTimeBillable = @bTravelTimeBillable,
  TimeTravelledRate = @nTimeTravelledRate,
  TimeTravelled = @nTimeTravelled,

  --
  -- Travel distance billing details.
  --
  ThresholdDistanceApplied = @bThresholdDistanceApplied,
  ThresholdKiloDistance = @nThresholdKiloDistance,
  DistanceTravelled = @nDistanceTravelled,
  DistanceTravelledRate = @nDistanceTravelledRate,
  TravelMode = @nTravelMode,
  OtherDestination = @bOtherDestination,
  DestinationName = @aDestinationName,
  TravelParkingCost = @nTravelParkingCost,
  TravelTollgatesCost = @nTravelTollgatesCost,
  RoundTripDistance = @nRoundTripDistance,
  FreeKiloDistance = @nFreeKiloDistance,

  --
  -- Disbursements billing details.
  --
  AmountTelephone = @nAmountTelephone,
  AmountPostage = @nAmountPostage,
  AmountCourierFees = @nAmountCourierFees,
  AmountPhotoCopies = @nAmountPhotoCopies,
  AmountCorrespondence = @nAmountCorrespondence,
  AmountOther = @nAmountOther,
  AmountDetails = @aAmountDetails,
  NoOfDelegates = @nNoOfDelegates,

  --
  -- Client satisfaction details.
  --
  ClientSatisfactionRating = @nClientSatisfactionRating,
  ClientSatisfactionComment = @aClientSatisfactionComment,
  ClientHasComplained = @bClientHasComplained,
  IsCancelImminent = @bIsCancelImminent

WHERE
  AppointmentID = @nAppointmentID