コード例 #1
0
bool
CSVResourceReportElement::generate()
{
    generateHeader();

    generateTableHeader();

    ResourceList filteredResourceList;
    if (!filterResourceList(filteredResourceList, 0, hideResource,
                            rollUpResource))
        return false;
    sortResourceList(filteredResourceList);
    maxDepthResourceList = filteredResourceList.maxDepth();

    maxDepthTaskList = 0;
    
    int rNo = 1;
    for (ResourceListIterator rli(filteredResourceList); *rli != 0; 
         ++rli, ++rNo)
    {
        TableLineInfo tli1;
        tli1.ca1 = tli1.resource = *rli;
        for (uint sc = 0; sc < scenarios.count(); ++sc)
        {
            tli1.row = sc;
            tli1.sc = scenarios[sc];
            tli1.idxNo = rNo;
            generateLine(&tli1, sc == 0 ? 4 : 5);
        }
    }
    generateFooter();

    return true;
}
コード例 #2
0
bool
TjPrintTaskReport::generate()
{
    /* Get complete task list, filter and sort it. Then determine the maximum
     * tree level. */
    TaskList filteredTaskList;
    if (!reportElement->filterTaskList(filteredTaskList, 0,
                                       reportElement->getHideTask(),
                                       reportElement->getRollUpTask()))
        return false;
    maxDepthTaskList = filteredTaskList.maxDepth();
    (static_cast<const QtTaskReportElement*>(reportElement))->
        sortTaskList(filteredTaskList);
    if (filteredTaskList.isEmpty())
        return true;

    /* Same for resource list. Just that we don't have to sort it. It needs to
     * be regenerated per task later on. */
    ResourceList filteredResourceList;
    if (!reportElement->filterResourceList(filteredResourceList, 0,
                                           reportElement->getHideResource(),
                                           reportElement->getRollUpResource()))
        return false;
    maxDepthResourceList = filteredResourceList.maxDepth();

    generateTableHeader();

    int index = 1;
    for (TaskListIterator tli(filteredTaskList); *tli; ++tli)
    {
        TjReportRow* row = new TjReportRow(getNumberOfColumns(), index++);
        row->setCoreAttributes(*tli, 0);
        rows.push_back(row);

        generateTaskListRow(row, *tli);

        if (!reportElement->filterResourceList
            (filteredResourceList, *tli, reportElement->getHideResource(),
             reportElement->getRollUpResource()))
            return false;
        reportElement->sortResourceList(filteredResourceList);
        for (ResourceListIterator rli(filteredResourceList); *rli; ++rli)
        {
            row = new TjReportRow(getNumberOfColumns(), index++);
            row->setCoreAttributes(*tli, *rli);
            rows.push_back(row);

            generateResourceListRow(row, *rli, *tli);
        }
    }

    layoutPages();

    return true;
}
コード例 #3
0
bool
HTMLResourceReportElement::generate()
{
    generateHeader();

    generateTableHeader();

    s() << "<tbody>" << endl;

    ResourceList filteredResourceList;
    if (!filterResourceList(filteredResourceList, 0, hideResource,
                            rollUpResource))
        return false;
    sortResourceList(filteredResourceList);
    maxDepthResourceList = filteredResourceList.maxDepth();

    TaskList filteredTaskList;
    if (!filterTaskList(filteredTaskList, 0, hideTask, rollUpTask))
        return false;
    maxDepthTaskList = filteredTaskList.maxDepth();

    int rNo = 1;
    for (ResourceListIterator rli(filteredResourceList); *rli != 0;
         ++rli, ++rNo)
    {
        TableLineInfo tli1;
        tli1.ca1 = tli1.resource = *rli;
        for (uint sc = 0; sc < scenarios.count(); ++sc)
        {
            tli1.row = sc;
            tli1.sc = scenarios[sc];
            tli1.idxNo = rNo;
            tli1.bgCol = colors.getColor("default").dark(100 + sc * 10);
            generateLine(&tli1, sc == 0 ? 4 : 5);
        }

        /* We only want to show the nested task list for leaf resources. Leaf
         * in this case means "task has no visible childs". */
        bool hasVisibleChilds = false;
        for (ResourceListIterator cli((*rli)->getSubListIterator());
             *cli; ++cli)
             if (filteredResourceList.findRef(*cli) >= 0)
             {
                 hasVisibleChilds = true;
                 break;
             }

        if (hasVisibleChilds)
            continue;

        if (!filterTaskList(filteredTaskList, *rli, hideTask, rollUpTask))
            return false;
        sortTaskList(filteredTaskList);

        int tNo = 1;
        for (TaskListIterator tli(filteredTaskList); *tli != 0; ++tli, ++tNo)
        {
            TableLineInfo tli2;
            tli2.ca1 = tli2.task = *tli;
            tli2.ca2 = tli2.resource = *rli;
            for (uint sc = 0; sc < scenarios.count(); ++sc)
            {
                tli2.row = sc;
                tli2.sc = scenarios[sc];
                tli2.idxNo = tNo;
                tli2.bgCol = colors.getColor("default").light(120).
                    dark(100 + sc * 10);
                generateLine(&tli2, sc == 0 ? 2 : 3);
            }
        }
    }
    s() << "</tbody>" << endl;
    s() << "</table>" << endl;
    generateFooter();

    return true;
}