Best way to use CustomCompletionValue

I am using the DBPlanner components for a Door Shop Production Schedule.
The planner shows the orders that are that are scheduled for the day.
However, each order has a variable number of doors that have to be built.
As the door shop has a capacity for the number of doors it can produce in a day, I would like to display the percentage of capacity in the Footer of each day.

I can calculate the Percentage of Capacity for each Day into a variable called PercentageOfCapacityUsed.

I understand that I can accomplish this by using:
Planner.Footer.CompletionValue[index] := PercentageOfCapacityUsed

My question is:
Where is the best place to put the code where I have access to the Index for the day but has minimal effect on overhead? How do I get the index for the day to be used with Planner.Footer.CompletionValue?

The footer would have to be updated for each day when the schedule is first displayed and when an item is moved from one day to another.

I have tried placing code in numerous events but have not found a solution.

The index of the day depends on how your time-axis is organised.
Are you using a single day view or a multi day view?

If you have a multiday view where each column represents a day, the day is retrieved as Day = startdate + planner.SelPosition.
To find the column based on a date, it would be : position := Int(day) - int(startdate);
If you need a recalculation when items are moved, I'd suggest to do that from the OnItemMove() event. This event is triggered after the item has moved. From this event, you can update the Planner.Footer.CompletionValue[] for each position, i.e. loop to update this completion from 0 to Planner.Positions -1.

Thanks Bruno,

I was making progress and was in the process of handling the item move on the OnItemMove Event.
I am using a multiday view excluding Saturday and Sunday and did it as follows:

  Offset := 0;
  for i := 0 to DBActiveDaySource1.NumberOfDays-1 do
    if  (FormatDateTime('DDD',DBActiveDaySource1.Day + i + Offset ) = 'Sat')
    and (DBActiveDaySource1.NumberOfDays = 5) then
        Offset := Offset + 1;

    if   (FormatDateTime('DDD',DBActiveDaySource1.Day + i + Offset ) = 'Sun')
    and ((DBActiveDaySource1.NumberOfDays = 5)
    or   (DBActiveDaySource1.NumberOfDays = 6)) then
          Offset := Offset + 1;

    CalcDate := DBActiveDaySource1.Day + i + Offset;

    UpdateCompletionValue(i, FormatDateTime('yyyy-mm-dd',CalcDate));

In the UpdateCompletionValue procedure I locate my Door Count and update the footer as follows:

procedure TfrmProdSchedQ.UpdateCompletionValue(Index: integer; CalcDate: String);
  if qryDoorCount.locate('ScheduleDate', CalcDate, []) then
     DBPlanner1.Footer.CompletionValue[Index] := qryDoorCount.FindField('Capacity').AsInteger
      DBPlanner1.Footer.CompletionValue[Index] := 0;

However, my footer does not change after completing the move. Do I need to refresh the footer some how?

Please disregard my last post.
I needed to refresh my DoorCount query before I Updated the completionValues.

All is working fine now.

Thanks for your help, Bruno.