separate (Tracker.Report_Generator)

procedure Parameter_Data_List is
    ----------------------------------------------------------------------
    --|
    --|  NAME:  PARAMETER_DATA_LIST
    --|
    --|  OVERVIEW:
    --|    This report prints all of the parameter data including global
    --|    variables, activity data, milestone data, personnel data,
    --|    subsystem data, and the milestone completion sequence.
    --|
    --|  EXCEPTIONS HANDLED:
    --|    others   an error message is printed and execution continues
    --|
    --|  HISTORY:
    --|    written by   Bonnie Burkhardt   March 1985
    --|
    ----------------------------------------------------------------------

    use Calendar;
    use Ac_List_Pkg;
    use Ms_List_Pkg;
    use Pr_List_Pkg;
    use Ss_List_Pkg;

    Blanks : constant String (1 .. 30) := (others => ' ');
    Dashes : constant String (1 .. 20) := (others => '-');
    End_List : Boolean := False;
    Ms_On_Line : Integer := 0;
    Num_Of_Blanks : Integer := 1;

    Ac_Ptr : Activity_Pointer;
    Ms_Ptr : Milestone_Pointer;
    Pr_Ptr : Personnel_Pointer;
    Ss_Ptr : Subsystem_Pointer;

    procedure Print_Start_Date (Date : in Date_Type) is
    begin
        if Date = Null_Date then
            Put (Report_File, " 0/ 0/ 0");
        else
            Put (Report_File, Date.Month, 2);
            Put (Report_File, '/');
            Put (Report_File, Date.Day, 2);
            Put (Report_File, '/');
            Put (Report_File, Date.Year, 4);
        end if;
    end Print_Start_Date;

    procedure Print_Stop_Date (Date : in Date_Type) is
    begin
        if Date = Null_Date then
            Put (Report_File, "99/99/99");
        else
            Put (Report_File, Date.Month, 2);
            Put (Report_File, '/');
            Put (Report_File, Date.Day, 2);
            Put (Report_File, '/');
            Put (Report_File, Date.Year, 4);
        end if;
    end Print_Stop_Date;

begin
    -- print out global information
    Put (Report_File, "Project Name: ");
    Put (Report_File, Project_Name);
    Put (Report_File, " #");
    Put (Report_File, Project_Number, 3);
    Set_Col (Report_File, 80);
    Put (Report_File, "Status Date: ");
    Put (Report_File, Date.Month, 2);
    Put (Report_File, "/");
    Put (Report_File, Date.Day, 2);
    Put (Report_File, "/");
    Put (Report_File, Date.Year, 4);
    New_Line (Report_File);
    Put (Report_File, "Project Manager: ");
    Put (Report_File, Manager_Name);
    New_Line (Report_File);

    -- output total number of parameters
    Put (Report_File, "NUMBER OF ACTIVITIES : ");
    Put (Report_File, Num_Of_Activities, 4);
    New_Line (Report_File);
    Put (Report_File, "NUMBER OF MILESTONES : ");
    Put (Report_File, Num_Of_Milestones, 4);
    New_Line (Report_File);
    Put (Report_File, "NUMBER OF PERSONNEL  : ");
    Put (Report_File, Num_Of_People, 4);
    New_Line (Report_File);
    Put (Report_File, "NUMBER OF SUBSYSTEMS : ");
    Put (Report_File, Num_Of_Subsystems, 4);
    New_Line (Report_File);
    Put (Report_File, "NUMBER OF ELEMENTS   : ");
    Put (Report_File, Num_Of_Elements, 4);
    New_Line (Report_File);

    -- output subsystem data
    New_Line (Report_File);
    Set_Col (Report_File, 2);
    Put (Report_File, "SUBSYSTEM");
    Set_Col (Report_File, 13);
    Put (Report_File, "% AVAILABLE AT START");
    New_Line (Report_File);
    Set_Col (Report_File, 2);
    Put (Report_File, Dashes (1 .. 9));
    Set_Col (Report_File, 13);
    Put (Report_File, Dashes (1 .. 20));
    New_Line (Report_File);
    Start_Walk (Ss_List);

    loop
        Walk (Ss_List, Ss_Ptr, End_List);
        exit when End_List;
        Put (Report_File, Ss_Ptr.Name);
        Set_Col (Report_File, 20);
        Put (Report_File, Ss_Ptr.Percent_At_Start, 3, 2, 0);
        Put (Report_File, '%');
        New_Line (Report_File);
    end loop;

    -- output personnel data
    New_Line (Report_File);
    Set_Col (Report_File, 2);
    Put (Report_File, "PERSON'S NAME");
    Set_Col (Report_File, 23);
    Put (Report_File, "INITIALS");
    Set_Col (Report_File, 34);
    Put (Report_File, "RATE PER HOUR");
    Set_Col (Report_File, 50);
    Put (Report_File, "HOURS PER WEEK");
    Set_Col (Report_File, 67);
    Put (Report_File, "START DATE");
    Set_Col (Report_File, 80);
    Put (Report_File, "STOP DATE");
    New_Line (Report_File);
    Set_Col (Report_File, 2);
    Put (Report_File, Dashes (1 .. 13));
    Set_Col (Report_File, 23);
    Put (Report_File, Dashes (1 .. 8));
    Set_Col (Report_File, 34);
    Put (Report_File, Dashes (1 .. 13));
    Set_Col (Report_File, 50);
    Put (Report_File, Dashes (1 .. 14));
    Set_Col (Report_File, 67);
    Put (Report_File, Dashes (1 .. 10));
    Set_Col (Report_File, 80);
    Put (Report_File, Dashes (1 .. 10));
    New_Line (Report_File);
    Start_Walk (Pr_List);

    loop
        Walk (Pr_List, Pr_Ptr, End_List);
        exit when End_List;
        Set_Col (Report_File, 2);
        Put (Report_File, Pr_Ptr.Name);
        Set_Col (Report_File, 26);
        Put (Report_File, Pr_Ptr.Initials);
        Set_Col (Report_File, 37);
        Put (Report_File, Pr_Ptr.Production_Rate, 3, 3, 0);
        Set_Col (Report_File, 55);
        Put (Report_File, Pr_Ptr.Hours_Per_Week, 4);

        -- write out all the start/stop dates for this person
        Set_Col (Report_File, 67);
        Print_Start_Date (Pr_Ptr.Start_Dates (Pr_Ptr.Start_Dates'First));
        Set_Col (Report_File, 80);
        Print_Stop_Date (Pr_Ptr.Stop_Dates (Pr_Ptr.Stop_Dates'First));
        New_Line (Report_File);

        for I in Pr_Ptr.Start_Dates'First + 1 .. Pr_Ptr.Start_Dates'Last loop
            if Pr_Ptr.Start_Dates (I) = Null_Date then
                exit;  -- if there are no more start/stop dates, don't print them
            else
                Set_Col (Report_File, 67);
                Print_Start_Date (Pr_Ptr.Start_Dates (I));
                Set_Col (Report_File, 80);
                Print_Stop_Date (Pr_Ptr.Stop_Dates (I));
                New_Line (Report_File);
            end if;
        end loop;
    end loop;

    -- output activity data
    New_Line (Report_File);
    Set_Col (Report_File, 2);
    Put (Report_File, "ACTIVITY NAME");
    Set_Col (Report_File, 17);
    Put (Report_File, "% TOTAL PROJECT");
    Set_Col (Report_File, 35);
    Put (Report_File, "PRIORITY");
    Set_Col (Report_File, 46);
    Put (Report_File, "CONSIDERED");
    Set_Col (Report_File, 59);
    Put (Report_File, "% AVAILABLE AT START");
    New_Line (Report_File);
    Set_Col (Report_File, 2);
    Put (Report_File, Dashes (1 .. 13));
    Set_Col (Report_File, 17);
    Put (Report_File, Dashes (1 .. 15));
    Set_Col (Report_File, 35);
    Put (Report_File, Dashes (1 .. 8));
    Set_Col (Report_File, 46);
    Put (Report_File, Dashes (1 .. 10));
    Set_Col (Report_File, 59);
    Put (Report_File, Dashes (1 .. 20));
    New_Line (Report_File);
    Start_Walk (Ac_List);

    loop
        Walk (Ac_List, Ac_Ptr, End_List);
        exit when End_List;
        Set_Col (Report_File, 2);
        Put (Report_File, Ac_Ptr.Name);
        Set_Col (Report_File, 21);
        Put (Report_File, Ac_Ptr.Percent_Tot_Proj, 3, 2, 0);
        Put (Report_File, '%');
        Set_Col (Report_File, 37);
        Put (Report_File, Ac_Ptr.Priority, 3);
        Set_Col (Report_File, 49);

        if Ac_Ptr.Consider_In_Calc then
            Put (Report_File, "YES");
        else
            Put (Report_File, "NO");
        end if;

        Set_Col (Report_File, 59);
        Put (Report_File, Ac_Ptr.Percent_At_Start, 3, 2, 0);
        Put (Report_File, '%');
        New_Line (Report_File);
    end loop;

    -- output the task numbers
    New_Line (Report_File);

    if Num_Of_Activities > 2 then
        Num_Of_Blanks := Num_Of_Activities * 3 - 4;
    end if;

    Put (Report_File, Blanks (1 .. Num_Of_Blanks));
    Put_Line (Report_File, "TASK NUMBERS");
    Set_Col (Report_File, 2);
    Start_Walk (Ac_List);

    loop
        Walk (Ac_List, Ac_Ptr, End_List);
        exit when End_List;
        Put (Report_File, Ac_Ptr.Name (1 .. 4));
        Put (Report_File, "  ");
    end loop;

    New_Line (Report_File);

    Set_Col (Report_File, 2);

    for Ac_Index in 1 .. Num_Of_Activities loop
        Put (Report_File, "----  ");
    end loop;

    New_Line (Report_File);

    Start_Walk (Ss_List);

    loop
        Walk (Ss_List, Ss_Ptr, End_List);
        exit when End_List;
        Set_Col (Report_File, 2);

        for Ac_Index in 1 .. Num_Of_Activities loop
            Put (Report_File, Ss_Ptr.Task_Numbers (Ac_Index), 4);
            Put (Report_File, "  ");
        end loop;

        New_Line (Report_File);
    end loop;

    -- output milestone data
    New_Line (Report_File);
    Set_Col (Report_File, 2);
    Put (Report_File, "MILESTONE");
    Set_Col (Report_File, 14);
    Put (Report_File, "DUE DATE");
    Set_Col (Report_File, 26);
    Put (Report_File, "DESCRIPTION");
    New_Line (Report_File);
    Set_Col (Report_File, 2);
    Put (Report_File, Dashes (1 .. 9));
    Set_Col (Report_File, 13);
    Put (Report_File, Dashes (1 .. 10));
    Set_Col (Report_File, 26);
    Put (Report_File, Dashes (1 .. 11));
    New_Line (Report_File);
    Start_Walk (Ms_List);

    loop
        Walk (Ms_List, Ms_Ptr, End_List);
        exit when End_List;
        Set_Col (Report_File, 4);
        Put (Report_File, Ms_Ptr.Number, 3);
        Set_Col (Report_File, 13);

        if Ms_Ptr.Due_Date = Null_Date then
            Put (Report_File, " 0/ 0/ 0");
        else
            Put (Report_File, Ms_Ptr.Due_Date.Month, 2);
            Put (Report_File, '/');
            Put (Report_File, Ms_Ptr.Due_Date.Day, 2);
            Put (Report_File, '/');
            Put (Report_File, Ms_Ptr.Due_Date.Year, 4);
        end if;

        Set_Col (Report_File, 26);
        Put (Report_File, Ms_Ptr.Description);
        New_Line (Report_File);
    end loop;

    -- write out milestone completion sequence
    New_Line (Report_File, 2);
    Set_Col (Report_File, 2);
    Put (Report_File, "MILESTONE COMPLETION SEQUENCE");
    New_Line (Report_File, 2);
    Ms_On_Line := 0;
    Start_Walk (Ms_List);

    loop
        Walk (Ms_List, Ms_Ptr, End_List);
        exit when End_List;
        Ms_On_Line := Ms_On_Line + 1;

        if Ms_On_Line > 33 then
            Ms_On_Line := 0;
            New_Line (Report_File);
        end if;

        Put (Report_File, ' ');
        Put (Report_File, Ms_Ptr.Number, 2);
    end loop;

    New_Line (Report_File, 2);

exception
    when others =>
        Put_Line ("exception raised in PARAMETER DATA LIST");
end Parameter_Data_List;