Calculate amounts in interval

I need to understand the following code in order to translate it into sql .
I didn't understand how to fill the table PeriodStartDate ? any idea , please help .
PrintLine := FALSE;
LineTotalVendAmountDue := 0;
FOR i := 1 TO 5 DO BEGIN
  DtldVendLedgEntry.SETCURRENTKEY("Vendor No.","Initial Entry Due Date");
  DtldVendLedgEntry.SETRANGE("Vendor No.","No.");
  DtldVendLedgEntry.SETRANGE("Initial Entry Due Date",PeriodStartDate[i],PeriodStartDate[i + 1] - 1);
  DtldVendLedgEntry.CALCSUMS("Amount (LCY)");
  VendBalanceDue[i] := DtldVendLedgEntry."Amount (LCY)";
  VendBalanceDueLCY[i] := DtldVendLedgEntry."Amount (LCY)";
  IF VendBalanceDue[i] <> 0 THEN
    PrintLine := TRUE;
  LineTotalVendAmountDue := LineTotalVendAmountDue + VendBalanceDueLCY[i];
  TotalVendAmtDueLCY := TotalVendAmtDueLCY + VendBalanceDueLCY[i];

In this case, PeriodStartDate is an array of dates, not a table, and it would have been populated prior to executing this code segment.