Esempio n. 1
0
 protected void writeEmptyBody(XslFOProfileWriter foWriter, string message)
 {
     foWriter.StartPageSequence();
     foWriter.StartPageBody();
     foWriter.EmptyBody(message);
     foWriter.EndPageBody();
     foWriter.EndPageSequence();
 }
Esempio n. 2
0
            public void Write(XslFOProfileWriter writer)
            {
                writer.WriteLayoutMaster();
                writer.StartPageSequence();
                writer.StartPageBody();

                headerWriter.Write(writer);

                bodyWriter.Write(writer);

                writer.EndPageBody();
                writer.EndPageSequence();
            }
Esempio n. 3
0
        /// <summary>
        /// Метод формирования отчета. Вызывается из ReportService
        /// </summary>
        /// <param name="foWriter"></param>
        /// <param name="Params"></param>
        /// <param name="Provider"></param>
        /// <param name="cn"></param>
        /// <param name="CustomData"></param>
        protected void buildThisReport(XslFOProfileWriter foWriter, ReportParams Params, IReportDataProvider Provider, object CustomData)
        {
            // Получим параметры:
            m_oParams = new ThisReportParams(Params, Provider);

            // ФОРМИРОВАНИЕ ОТЧЕТА
            foWriter.WriteLayoutMaster();
            foWriter.StartPageSequence();
            foWriter.StartPageBody();

            // ЗАГОЛОВОК
            foWriter.Header("Баланс списаний сотрудника");
            // Параметры отчета в заголовке?
            if (m_oParams.ShowRestrictions)
            {
                m_oParams.WriteParamsInHeader(foWriter);
            }

            writeBody(foWriter, Provider);

            foWriter.EndPageBody();
            foWriter.EndPageSequence();
        }
Esempio n. 4
0
        /// <summary>
        /// Метод формирования отчета. Вызывается из ReportService
        /// </summary>
        /// <param name="foWriter"></param>
        /// <param name="Params"></param>
        /// <param name="Provider"></param>
        /// <param name="cn"></param>
        /// <param name="CustomData"></param>
        protected void buildThisReport(XslFOProfileWriter foWriter, ReportParams Params, IReportDataProvider Provider, object CustomData)
        {
            // Получим параметры:
            ThisReportParams oParams = new ThisReportParams(Params);

            // ФОРМИРОВАНИЕ ОТЧЕТА
            foWriter.WriteLayoutMaster();
            foWriter.StartPageSequence();
            foWriter.StartPageBody();

            // ЗАГОЛОВОК
            foWriter.Header("Затраты в разрезе направлений");
            // Параметры отчета в заголовке?
            if (oParams.ShowRestrictions)
            {
                oParams.WriteParamsInHeader(foWriter, Provider);
            }

            writeBody(foWriter, oParams, Provider);

            foWriter.EndPageBody();
            foWriter.EndPageSequence();
        }
Esempio n. 5
0
        protected void buildThisReport(XslFOProfileWriter w, ReportParams Params, IReportDataProvider Provider, object CustomData)
        {
            // Получим параметры
            object IntervalBegin = Params.GetParam("IntervalBegin").Value;
            object IntervalEnd   = Params.GetParam("IntervalEnd").Value;
            Guid   Employee      = (Guid)Params.GetParam("Employee").Value;

            int    NonProjectExpences   = (int)Params.GetParam("NonProjectExpences").Value;
            int    IncludeParams        = (int)Params.GetParam("IncludeParams").Value;
            int    AnalysDirection      = (int)Params.GetParam("AnalysDirection").Value;
            int    TimeLossReason       = (int)Params.GetParam("TimeLossReason").Value;
            int    SectionByActivity    = (int)Params.GetParam("SectionByActivity").Value;
            int    ExepenseDetalization = (int)Params.GetParam("ExepenseDetalization").Value;
            int    TimeMeasureUnits     = (int)Params.GetParam("TimeMeasureUnits").Value;
            object ActivityType         = Params.GetParam("ActivityType").Value;
            object ExpenseType          = Params.GetParam("ExpenseType").Value;
            object IncidentState        = Params.GetParam("IncidentState").Value;

            int Sort      = (int)Params.GetParam("Sort").Value;
            int SortOrder = (int)Params.GetParam("SortOrder").Value;

            bool          bIncidentAttributes = 0 != (int)Params.GetParam("IncidentAttributes").Value;
            bool          bDate          = 0 != (int)Params.GetParam("Date").Value;
            bool          bNumberOfTasks = 0 != (int)Params.GetParam("NumberOfTasks").Value;
            bool          bRemaining     = 0 != (int)Params.GetParam("Remaining").Value;
            bool          bNewState      = 0 != (int)Params.GetParam("NewState").Value;
            bool          bComment       = 0 != (int)Params.GetParam("Comment").Value;
            StringBuilder sb             = new StringBuilder();

            switch (ExepenseDetalization)
            {
            case (int)ExpenseDetalization.ByExpences:
                bNumberOfTasks = false;
                break;

            case (int)ExpenseDetalization.BySubActivity:

                bNewState = bComment = bIncidentAttributes = false;
                break;
            }
            using (IDataReader r = Provider.GetDataReader("dsMain", null))
            {
                IDictionary headerData;
                w.WriteLayoutMaster();
                w.StartPageSequence();
                w.StartPageBody();
                sb.Append("<fo:block>Список инцидентов и затрат сотрудника</fo:block>");
                if (!r.Read())
                {
                    //TODO: EmptyBody
                }

                headerData    = _GetDataFromDataRow(r);
                IntervalBegin = headerData["IntervalBegin"];
                IntervalEnd   = headerData["IntervalEnd"];
                // Создадим заголовок
                if (0 != IncludeParams)
                {
                    sb.Append("<fo:block/>");

                    sb.Append("<fo:block font-size='14px'>Параметры отчета:</fo:block>");
                    sb.Append("<fo:table color='#FFFFFF' text-align='left' font-size='12px' font-family='MS Sans-serif'>");
                    sb.Append("<fo:table-column/>");
                    sb.Append("<fo:table-column/>");
                    sb.Append("<fo:table-body>");

                    sb.Append("<fo:table-row>");
                    sb.Append("<fo:table-cell width='35%'><fo:block>Направление анализа:</fo:block></fo:table-cell>");
                    sb.Append("<fo:table-cell><fo:block>" + xmlEncode(headerData["AnalysDirection"]) + "</fo:block></fo:table-cell>");
                    sb.Append("</fo:table-row>");

                    sb.Append("<fo:table-row>");
                    sb.Append("<fo:table-cell width='35%'><fo:block>Период времени:</fo:block></fo:table-cell>");
                    sb.Append("<fo:table-cell><fo:block>" + xmlEncode(headerData["DateInterval"]) + "</fo:block></fo:table-cell>");
                    sb.Append("</fo:table-row>");

                    sb.Append("<fo:table-row>");
                    sb.Append("<fo:table-cell width='35%'><fo:block>Сотрудник:</fo:block></fo:table-cell>");
                    sb.Append("<fo:table-cell><fo:block><fo:basic-link color=\"#ffffff\" external-destination=\"vbscript:ShowContextForEmployeeLite(&quot;" + Employee + "&quot;,&quot;" + xmlEncode(headerData["EMail"]) + "&quot;)\">" + headerData["EmployeeName"] + "</fo:basic-link></fo:block></fo:table-cell>");
                    sb.Append("</fo:table-row>");

                    sb.Append("<fo:table-row>");
                    sb.Append("<fo:table-cell width='35%'><fo:block>Тип активности:</fo:block></fo:table-cell>");
                    sb.Append("<fo:table-cell><fo:block>" + xmlEncode(headerData["ActivityType"]) + "</fo:block></fo:table-cell>");
                    sb.Append("</fo:table-row>");

                    sb.Append("<fo:table-row>");
                    sb.Append("<fo:table-cell width='35%'><fo:block>Детализация затрат:</fo:block></fo:table-cell>");
                    sb.Append("<fo:table-cell><fo:block>" + xmlEncode(headerData["ExepenseDetalization"]) + "</fo:block></fo:table-cell>");
                    sb.Append("</fo:table-row>");

                    sb.Append("<fo:table-row>");
                    sb.Append("<fo:table-cell width='35%'><fo:block>Вид трудозатрат:</fo:block></fo:table-cell>");
                    sb.Append("<fo:table-cell><fo:block>" + xmlEncode(headerData["ExpenseType"]) + "</fo:block></fo:table-cell>");
                    sb.Append("</fo:table-row>");

                    sb.Append("<fo:table-row>");
                    sb.Append("<fo:table-cell width='35%'><fo:block>Состояние инцидента:</fo:block></fo:table-cell>");
                    sb.Append("<fo:table-cell><fo:block>" + xmlEncode(headerData["IncidentState"]) + "</fo:block></fo:table-cell>");
                    sb.Append("</fo:table-row>");

                    sb.Append("<fo:table-row>");
                    sb.Append("<fo:table-cell width='35%'><fo:block>Единицы измерения времени:</fo:block></fo:table-cell>");
                    sb.Append("<fo:table-cell><fo:block>" + xmlEncode(TimeMeasureUnitsItem.GetItem((Croc.IncidentTracker.TimeMeasureUnits)TimeMeasureUnits).Description) + "</fo:block></fo:table-cell>");
                    sb.Append("</fo:table-row>");

                    sb.Append("<fo:table-row>");
                    sb.Append("<fo:table-cell width='35%'><fo:block>&#160;</fo:block></fo:table-cell>");
                    sb.Append("<fo:table-cell><fo:block>" + xmlEncode(headerData["NonProjectExpences"]) + "</fo:block></fo:table-cell>");
                    sb.Append("</fo:table-row>");

                    sb.Append("</fo:table-body>");
                    sb.Append("</fo:table>");
                }

                int nActivityColspan = 9;

                int nWorkDayDuration       = (int)headerData["WorkDayDuration"];
                int nReportWorkDayDuration = TimeMeasureUnits == (int)IncidentTracker.TimeMeasureUnits.Hours?int.MaxValue:nWorkDayDuration;
                w.Header(sb.ToString());

                int nRowNum = 0;

                if (!r.NextResult())
                {
                    throw new ApplicationException("Отсутствует основной рекордсет");
                }
                nActivityColspan = 9;
                w.TStart(0 == SectionByActivity, "CELL_CLASS", false);
                w.TAddColumn("№ п/п", align.ALIGN_RIGHT, valign.VALIGN_MIDDLE, null, String.Empty, align.ALIGN_NONE, valign.VALIGN_NONE, "TABLE_HEADER");
                if (bIncidentAttributes)
                {
                    w.TAddColumn("Причина списания", align.ALIGN_LEFT, valign.VALIGN_MIDDLE, null, String.Empty, align.ALIGN_NONE, valign.VALIGN_NONE, "TABLE_HEADER");
                }
                else
                {
                    --nActivityColspan;
                }
                w.TAddColumn("Наименование активности", align.ALIGN_LEFT, valign.VALIGN_MIDDLE, null, String.Empty, align.ALIGN_NONE, valign.VALIGN_NONE, "TABLE_HEADER");
                if (bDate)
                {
                    w.TAddColumn("Дата", align.ALIGN_CENTER, valign.VALIGN_MIDDLE, null, String.Empty, align.ALIGN_NONE, valign.VALIGN_NONE, "TABLE_HEADER");
                }
                else
                {
                    --nActivityColspan;
                }
                int nTotalColspan = nActivityColspan - 5 - 1;
                if (bNumberOfTasks)
                {
                    w.TAddColumn("Кол-во заданий", align.ALIGN_RIGHT, valign.VALIGN_MIDDLE, null, String.Empty, align.ALIGN_NONE, valign.VALIGN_NONE, "TABLE_HEADER");
                }
                else
                {
                    --nActivityColspan;
                }
                w.TAddColumn("Затрачено/Списано", align.ALIGN_CENTER, valign.VALIGN_MIDDLE, null, String.Empty, align.ALIGN_NONE, valign.VALIGN_NONE, "TABLE_HEADER");
                if (bRemaining)
                {
                    w.TAddColumn("Осталось", align.ALIGN_CENTER, valign.VALIGN_MIDDLE, null, String.Empty, align.ALIGN_NONE, valign.VALIGN_NONE, "TABLE_HEADER");
                }
                else
                {
                    --nActivityColspan;
                }
                if (bNewState)
                {
                    w.TAddColumn(ExepenseDetalization == (int)ExpenseDetalization.ByExpences ? "Новое состояние" : "Состояние", align.ALIGN_LEFT, valign.VALIGN_MIDDLE, null, String.Empty, align.ALIGN_NONE, valign.VALIGN_NONE, "TABLE_HEADER");
                }
                else
                {
                    --nActivityColspan;
                }
                if (bComment)
                {
                    w.TAddColumn("Комментарии", align.ALIGN_LEFT, valign.VALIGN_MIDDLE, null, String.Empty, align.ALIGN_NONE, valign.VALIGN_NONE, "TABLE_HEADER");
                }
                else
                {
                    --nActivityColspan;
                }

                Guid currentTopActivityID = Guid.Empty;

                int totalSpent            = 0;
                int totalLeft             = 0;
                int totalTasks            = 0;
                int totalLost             = 0;
                int totalSpentPerActivity = 0;
                int totalLeftPerActivity  = 0;
                int totalTasksPerActivity = 0;

                int previousCauseType = -1;
                int nCauseType        = -1;

                while (r.Read())
                {
                    IDictionary rec = _GetDataFromDataRow(r);
                    previousCauseType = nCauseType;
                    nCauseType        = (int)rec["CauseType"];
                    bool bMergeIncidentAttributes = (3 == nCauseType) && bIncidentAttributes;

                    if (0 != SectionByActivity)
                    {
                        Guid topActivityID = (Guid)rec["topFolder"];
                        if (currentTopActivityID != topActivityID)
                        {
                            if (currentTopActivityID != Guid.Empty)
                            {
                                w.TRStart();
                                w.TRAddCell("&#160;", null);
                                w.TRAddCell(previousCauseType == 3?"Всего по непроектным списаниям":"Всего по активности:", null, nTotalColspan, 1);
                                if (bNumberOfTasks)
                                {
                                    w.TRAddCell(totalTasksPerActivity, "i4");
                                }
                                w.TRAddCell(this._FormatTimeStringAtServer(totalSpentPerActivity, nReportWorkDayDuration), null);
                                if (bRemaining)
                                {
                                    w.TRAddCell(this._FormatTimeStringAtServer(totalLeftPerActivity, nReportWorkDayDuration), null);
                                }
                                if (bNewState)
                                {
                                    w.TRAddCell("&#160;", null);
                                }
                                if (bComment)
                                {
                                    w.TRAddCell("&#160;", null);
                                }
                                w.TREnd();

                                totalSpentPerActivity = 0;
                                totalLeftPerActivity  = 0;
                                totalTasksPerActivity = 0;
                            }

                            currentTopActivityID = topActivityID;
                            w.TRStart();
                            w.TROmitCell();
                            w.TRAddCell(3 == nActivityColspan?xmlEncode(rec["topName"]):this._GetFolderAnchor(rec["topName"], (Guid)rec["ActivityID"], Employee, true, IntervalBegin != null?(DateTime)IntervalBegin:DateTime.MinValue, IntervalEnd != null?(DateTime)IntervalEnd:DateTime.MaxValue), null, nActivityColspan, 1, "TABLE_HEADER");
                            w.TREnd();
                            w.TRStart();
                            w.TRAddCell("№ п/п", null, 1, 1, "TABLE_HEADER");
                            if (bIncidentAttributes)
                            {
                                w.TRAddCell("Причина списания", null, bMergeIncidentAttributes?2:1, 1, "TABLE_HEADER");
                            }
                            if (!bMergeIncidentAttributes)
                            {
                                w.TRAddCell(3 == nCauseType?"Причина списания":"Наименование активности", null, 1, 1, "TABLE_HEADER");
                            }
                            if (bDate)
                            {
                                w.TRAddCell("Дата", null, 1, 1, "TABLE_HEADER");
                            }
                            if (bNumberOfTasks)
                            {
                                w.TRAddCell(3 == nCauseType?"Кол-во списаний":"Кол-во заданий", null, 1, 1, "TABLE_HEADER");
                            }
                            w.TRAddCell(3 == nCauseType?"Списано":"Затрачено/Списано", null, 1, 1, "TABLE_HEADER");
                            if (bRemaining)
                            {
                                w.TRAddCell("Осталось", null, 1, 1, "TABLE_HEADER");
                            }
                            if (bNewState)
                            {
                                w.TRAddCell("Новое состояние", null, 1, 1, "TABLE_HEADER");
                            }
                            if (bComment)
                            {
                                w.TRAddCell("Комментарии", null, 1, 1, "TABLE_HEADER");
                            }
                            w.TREnd();
                        }
                    }

                    if (3 == nCauseType || 4 == nCauseType)
                    {
                        totalLost += (int)rec["Spent"];
                    }
                    else
                    {
                        totalSpent += (int)rec["Spent"];
                    }
                    totalSpentPerActivity += (int)rec["Spent"];
                    totalTasks            += (3 == nCauseType ? 0 : (null != rec["NumberOfTasks"]?(int)rec["NumberOfTasks"]:0));
                    totalTasksPerActivity += ((1 != nCauseType && 2 != nCauseType)? 0 : null != rec["NumberOfTasks"]? (int)rec["NumberOfTasks"] : 0);
                    totalLeft             += 3 == nCauseType?0:(null != rec["LeftTime"]?(int)rec["LeftTime"]:0);
                    totalLeftPerActivity  += 3 == nCauseType?0:(null != rec["LeftTime"]?(int)rec["LeftTime"]:0);

                    w.TRStart();
                    w.TRAddCell(++nRowNum, "i4");
                    if (bIncidentAttributes)
                    {
                        w.TRAddCell(
                            1 == nCauseType?                                   // только для инцидентов
                            this._GetIncidentAnchor(rec["CauseName"], (Guid)rec["CauseID"], true) :
                            xmlEncode(rec["CauseName"]),
                            null,
                            bMergeIncidentAttributes? 2 : 1,
                            1);
                    }
                    if (!bMergeIncidentAttributes)
                    {
                        if (3 != nCauseType)
                        {
                            w.TRAddCell(this._GetFolderAnchor(rec["ActivityName"], (Guid)rec["ActivityID"], Employee, true, IntervalBegin != null?(DateTime)IntervalBegin : DateTime.MinValue, IntervalEnd != null?(DateTime)IntervalEnd:DateTime.MaxValue), null);
                        }
                        else
                        {
                            w.TRAddCell(xmlEncode(rec["ActivityName"]), null);
                        }
                    }
                    if (bDate)
                    {
                        w.TRAddCell(xmlEncode(rec["DateSpent"]), null);
                    }

                    if (bNumberOfTasks)
                    {
                        // Кол-во инцидентов показваем только для инцидентов или проектов
                        if (1 == nCauseType || 2 == nCauseType)
                        {
                            w.TRAddCell("" + rec["NumberOfTasks"], "i4");
                        }
                        else
                        {
                            w.TRAddCell(" - ", "string");
                        }
                    }

                    w.TRAddCell(this._FormatTimeStringAtServer((int)rec["Spent"], nReportWorkDayDuration), null);
                    if (bRemaining)
                    {
                        object objLeftTime = rec["LeftTime"];
                        w.TRAddCell(objLeftTime == null?string.Empty:this._FormatTimeStringAtServer((int)objLeftTime, nReportWorkDayDuration), null);
                    }
                    if (bNewState)
                    {
                        w.TRAddCell(xmlEncode(rec["NewState"]), null);
                    }
                    if (bComment)
                    {
                        w.TRAddCell(xmlEncode(rec["Comments"]), null);
                    }
                    w.TREnd();
                }

                if (0 != SectionByActivity && currentTopActivityID != Guid.Empty)
                {
                    w.TRStart();
                    w.TRAddCell("&#160;", null);
                    w.TRAddCell(nCauseType == 3?"Всего по непроектным списаниям":"Всего по активности:", null, nTotalColspan, 1);
                    if (bNumberOfTasks)
                    {
                        w.TRAddCell(totalTasksPerActivity, "i4");
                    }
                    w.TRAddCell(this._FormatTimeStringAtServer(totalSpentPerActivity, nReportWorkDayDuration), null);
                    if (bRemaining)
                    {
                        w.TRAddCell(this._FormatTimeStringAtServer(totalLeftPerActivity, nReportWorkDayDuration), null);
                    }
                    if (bNewState)
                    {
                        w.TRAddCell("&#160;", null);
                    }
                    if (bComment)
                    {
                        w.TRAddCell("&#160;", null);
                    }
                    w.TREnd();
                }

                // Итого
                if ((int)ExpencesType.Both == (int)ExpenseType || (int)ExpencesType.Incidents == (int)ExpenseType)
                {
                    w.TRStart();
                    w.TRAddCell("&#160;", null, 1, 1, "TABLE_HEADER");

                    w.TRAddCell("Итого затрачено на задания по инцидентам", null, nTotalColspan, 1, "TABLE_HEADER");
                    if (bNumberOfTasks)
                    {
                        w.TRAddCell(totalTasks, "i4", 1, 1, "TABLE_HEADER");
                    }
                    w.TRAddCell(this._FormatTimeStringAtServer(totalSpent, nReportWorkDayDuration), null, 1, 1, "TABLE_HEADER");
                    if (bRemaining)
                    {
                        w.TRAddCell(this._FormatTimeStringAtServer(totalLeft, nReportWorkDayDuration), null, 1, 1, "TABLE_HEADER");
                    }
                    if (bNewState)
                    {
                        w.TRAddCell("&#160;", null, 1, 1, "TABLE_HEADER");
                    }
                    if (bComment)
                    {
                        w.TRAddCell("&#160;", null, 1, 1, "TABLE_HEADER");
                    }
                    w.TREnd();
                }

                if ((int)ExpencesType.Both == (int)ExpenseType || (int)ExpencesType.Discarding == (int)ExpenseType)
                {
                    w.TRStart();
                    w.TRAddCell("&#160;", null, 1, 1, "TABLE_HEADER");
                    w.TRAddCell("Итого списано ", null, nTotalColspan, 1, "TABLE_HEADER");
                    if (bNumberOfTasks)
                    {
                        w.TRAddCell("&#160;", null, 1, 1, "TABLE_HEADER");
                    }
                    w.TRAddCell(this._FormatTimeStringAtServer(totalLost, nReportWorkDayDuration), null, 1, 1, "TABLE_HEADER");
                    if (bRemaining)
                    {
                        w.TRAddCell("&#160;", null, 1, 1, "TABLE_HEADER");
                    }
                    if (bNewState)
                    {
                        w.TRAddCell("&#160;", null, 1, 1, "TABLE_HEADER");
                    }
                    if (bComment)
                    {
                        w.TRAddCell("&#160;", null, 1, 1, "TABLE_HEADER");
                    }
                    w.TREnd();
                }

                if ((int)ExpencesType.Both == (int)ExpenseType)
                {
                    w.TRStart();
                    w.TRAddCell("&#160;", null, 1, 1, "TABLE_HEADER");
                    w.TRAddCell("Общие трудозатраты  ", null, nTotalColspan, 1, "TABLE_HEADER");
                    if (bNumberOfTasks)
                    {
                        w.TRAddCell("&#160;", null, 1, 1, "TABLE_HEADER");
                    }
                    w.TRAddCell(this._FormatTimeStringAtServer(totalLost + totalSpent, nReportWorkDayDuration), null, 1, 1, "TABLE_HEADER");
                    if (bRemaining)
                    {
                        w.TRAddCell("&#160;", null, 1, 1, "TABLE_HEADER");
                    }
                    if (bNewState)
                    {
                        w.TRAddCell("&#160;", null, 1, 1, "TABLE_HEADER");
                    }
                    if (bComment)
                    {
                        w.TRAddCell("&#160;", null, 1, 1, "TABLE_HEADER");
                    }
                    w.TREnd();
                }

                w.TRStart();
                w.TRAddCell("&#160;", null, 1, 1, "TABLE_HEADER");
                w.TRAddCell(xmlEncode(string.Format("Всего рабочих дней за период - {0}, Норма рабочего времени за период - {1}", headerData["WorkDays"], this._FormatTimeStringAtServer((int)headerData["WorkDays"] * nWorkDayDuration, int.MaxValue))), null, nActivityColspan - 1, 1, "TABLE_HEADER");
                w.TREnd();

                w.TEnd();
                w.EndPageBody();
                w.EndPageSequence();
            }
        }
Esempio n. 6
0
        private void buildThisReport(XslFOProfileWriter w, ReportParams Params, IReportDataProvider Provider)
        {
            DateTime  dtActualBegin;
            DateTime  dtActualEnd;
            DateTime  dtBegin;
            DateTime  dtEnd;
            string    OrganizationName;
            ArrayList arrDates            = new ArrayList();
            object    IntervalBegin       = Params.GetParam("IntervalBegin").Value;
            object    IntervalEnd         = Params.GetParam("IntervalEnd").Value;
            object    Folder              = Params.GetParam("Folder").Value;
            object    Customer            = Params.GetParam("Customer").Value;
            int       ActivityAnalysDepth = (int)Params.GetParam("ActivityAnalysDepth").Value;
            int       InsertRestrictions  = (int)Params.GetParam("InsertRestrictions").Value;
            int       FolderType          = (int)Params.GetParam("FolderType").Value;
            int       SectionByActivity   = (int)Params.GetParam("SectionByActivity").Value;
            int       DateDetalization    = (int)Params.GetParam("DateDetalization").Value;
            int       TimeMeasureUnits    = (int)Params.GetParam("TimeMeasureUnits").Value;
            int       ExpencesType        = (int)Params.GetParam("ExpensesType").Value;
            int       IncludeSubProjects  = (int)Params.GetParam("IncludeSubProjects").Value;

            int SortType  = (int)Params.GetParam("SortType").Value;
            int SortOrder = (int)Params.GetParam("SortOrder").Value;
            int ShowColumnWorkTimeNorm = (int)Params.GetParam("ShowColumnWorkTimeNorm").Value;

            /*int ShowColumnOverheads = (int)Params.GetParam("ShowColumnOverheads").Value;
             * int ShowColumnSalaryExpenses = (int)Params.GetParam("ShowColumnSalaryExpenses").Value;*/
            CustomDataForDS oCustomData = new CustomDataForDS();

            oCustomData.sTempTableName = "##UsersExpences_" + Guid.NewGuid().ToString("n");
            // Первый запрос возвращает 2 рекордсета
            // 1 - Папка, Организация, Начало, Конец
            // 2 - Даты для которых строится отчёт
            using (IDataReader rdr = Provider.GetDataReader("dsUserExpencesPrimary", oCustomData))
            {
                rdr.Read();                         // По любому одна строка :)
                OrganizationName          = rdr.GetString(1);
                dtActualBegin             = rdr.IsDBNull(2)?DateTime.MinValue:rdr.GetDateTime(2);
                dtActualEnd               = rdr.IsDBNull(3)?DateTime.MaxValue:rdr.GetDateTime(3);
                oCustomData.dtActualBegin = dtActualBegin;
                oCustomData.dtActualEnd   = dtActualEnd;
                dtBegin = IntervalBegin == null?dtActualBegin:(DateTime)IntervalBegin;
                dtEnd   = IntervalEnd == null?dtActualEnd:(DateTime)IntervalEnd;
                StringBuilder sb = new StringBuilder("<fo:block>Динамика затрат сотрудников</fo:block>");
                // Создадим заголовок
                if (0 != InsertRestrictions)
                {
                    sb.Append("<fo:block/>");

                    sb.Append("<fo:block font-size='14px'>Параметры отчета:</fo:block>");
                    sb.Append("<fo:table color='#FFFFFF' text-align='left' font-size='12px' font-family='MS Sans-serif'>");
                    sb.Append("<fo:table-column/>");
                    sb.Append("<fo:table-column/>");
                    sb.Append("<fo:table-body>");

                    sb.Append("<fo:table-row>");
                    sb.Append("<fo:table-cell width='35%'><fo:block>Период времени:</fo:block></fo:table-cell>");
                    sb.Append("<fo:table-cell><fo:block>" + xmlEncode(rdr.GetString(4)) + "</fo:block></fo:table-cell>");
                    sb.Append("</fo:table-row>");


                    sb.Append("<fo:table-row>");
                    sb.Append("<fo:table-cell width='35%'><fo:block>Клиент:</fo:block></fo:table-cell>");
                    if (null == Customer)
                    {
                        sb.Append("<fo:table-cell><fo:block>" + xmlEncode(OrganizationName) + "</fo:block></fo:table-cell>");
                    }
                    else
                    {
                        //																							ShowContextForOrganization(sID, sExtID, sDirectorEMail)
                        sb.Append("<fo:table-cell><fo:block><fo:basic-link color=\"#ffffff\" external-destination=\"vbscript:ShowContextForOrganization(&quot;" + Customer + "&quot;,&quot;" + rdr.GetString(6) + "&quot;,&quot;" + rdr.GetString(7) + "&quot;)\">" + xmlEncode(OrganizationName) + "</fo:basic-link></fo:block></fo:table-cell>");
                    }

                    sb.Append("</fo:table-row>");


                    if (!rdr.IsDBNull(5))
                    {
                        sb.Append("<fo:table-row>");
                        sb.Append("<fo:table-cell width='35%'><fo:block>Активность:</fo:block></fo:table-cell>");
                        sb.Append("<fo:table-cell><fo:block><fo:basic-link color=\"#ffffff\" external-destination=\"vbscript:ShowContextForFolderEx(&quot;" + rdr.GetGuid(5) + "&quot;,true, " + ((dtBegin == DateTime.MinValue)?"NULL":dtBegin.ToString("#MM'/'dd'/'yyyy#")) + ", " + ((dtEnd == DateTime.MaxValue)?"NULL":dtEnd.ToString("#MM'/'dd'/'yyyy#")) + ")\">" + xmlEncode(rdr.GetString(0)) + "</fo:basic-link></fo:block></fo:table-cell>");
                        sb.Append("</fo:table-row>");
                    }

                    sb.Append("<fo:table-row>");
                    sb.Append("<fo:table-cell width='35%'><fo:block>Тип активности:</fo:block></fo:table-cell>");
                    sb.Append("<fo:table-cell><fo:block>" + xmlEncode(FolderTypeEnumItem.ToStringOfDescriptions((FolderTypeEnum)FolderType)) + "</fo:block></fo:table-cell>");
                    sb.Append("</fo:table-row>");


                    sb.Append("<fo:table-row>");
                    sb.Append("<fo:table-cell width='35%'><fo:block>Глубина анализа активностей:</fo:block></fo:table-cell>");
                    sb.Append("<fo:table-cell><fo:block>" + xmlEncode(ActivityAnalysDepthItem.GetItem((ActivityAnalysDepth)ActivityAnalysDepth).Description) + "</fo:block></fo:table-cell>");
                    sb.Append("</fo:table-row>");

                    sb.Append("<fo:table-row>");
                    sb.Append("<fo:table-cell width='35%'><fo:block>Секционирование по активностям:</fo:block></fo:table-cell>");
                    sb.Append("<fo:table-cell><fo:block>" + xmlEncode(SectionByActivityItem.GetItem((SectionByActivity)SectionByActivity).Description) + "</fo:block></fo:table-cell>");
                    sb.Append("</fo:table-row>");

                    sb.Append("<fo:table-row>");
                    sb.Append("<fo:table-cell width='35%'><fo:block>Детализация по датам:</fo:block></fo:table-cell>");
                    sb.Append("<fo:table-cell><fo:block>" + xmlEncode(DateDetalizationItem.GetItem((DateDetalization)DateDetalization).Description) + "</fo:block></fo:table-cell>");
                    sb.Append("</fo:table-row>");

                    sb.Append("<fo:table-row>");
                    sb.Append("<fo:table-cell width='35%'><fo:block>Виды трудозатрат:</fo:block></fo:table-cell>");
                    sb.Append("<fo:table-cell><fo:block>" + xmlEncode(ExpencesTypeItem.GetItem((ExpencesType)ExpencesType).Description) + "</fo:block></fo:table-cell>");
                    sb.Append("</fo:table-row>");

                    sb.Append("<fo:table-row>");
                    sb.Append("<fo:table-cell width='35%'><fo:block>Включать в проект затраты подпроектов:</fo:block></fo:table-cell>");
                    sb.Append("<fo:table-cell><fo:block>" + ((IncludeSubProjects == 0)?"нет":"да") + "</fo:block></fo:table-cell>");
                    sb.Append("</fo:table-row>");

                    sb.Append("<fo:table-row>");
                    sb.Append("<fo:table-cell width='35%'><fo:block>Сортировка:</fo:block></fo:table-cell>");
                    sb.Append("<fo:table-cell><fo:block>" + xmlEncode(SortExpencesItem.GetItem((SortExpences)SortType).Description) + ", " + xmlEncode(SortOrderItem.GetItem((SortOrder)SortOrder).Description) + "</fo:block></fo:table-cell>");
                    sb.Append("</fo:table-row>");

                    sb.Append("<fo:table-row>");
                    sb.Append("<fo:table-cell width='35%'><fo:block>Единицы измерения времени:</fo:block></fo:table-cell>");
                    sb.Append("<fo:table-cell><fo:block>" + xmlEncode(TimeMeasureUnitsItem.GetItem((TimeMeasureUnits)TimeMeasureUnits).Description) + "</fo:block></fo:table-cell>");
                    sb.Append("</fo:table-row>");

                    sb.Append("</fo:table-body>");
                    sb.Append("</fo:table>");
                }
                if (rdr.NextResult())
                {
                    while (rdr.Read())
                    {
                        arrDates.Add(rdr.GetDateTime(0));
                    }
                }
                oCustomData.arrDates = arrDates;
                w.WriteLayoutMaster();
                w.StartPageSequence();
                w.StartPageBody();
                w.Header(sb.ToString());
            }

            if (dtActualBegin == DateTime.MinValue)
            {
                // Пустой отчёт, данные не нужны, табличка дропнута
                w.EmptyBody("Нет данных");
            }
            else
            {
                // Теперь сформируем вторичный запрос на получение данных
                using (IDataReader rdr2 = Provider.GetDataReader("dsUserExpencesSecondary", oCustomData))
                {
                    int       nActivityColSpan = 2;
                    int       nTotalColspan    = 1;
                    int       nFieldCount      = rdr2.FieldCount;
                    const int nFirstDateColumn = 9;
                    // Выведем тело отчёта
                    w.TStart(true, "CELL_CLASS", false);

                    /*
                     * if(HideGroupColumns)
                     * {
                     ++nActivityColSpan;
                     *      w.TAddColumn("Активность", align.ALIGN_LEFT, valign.VALIGN_MIDDLE, "TABLE_HEADER");
                     * }
                     */
                    w.TAddColumn("Сотрудник", align.ALIGN_LEFT, valign.VALIGN_MIDDLE, "TABLE_HEADER");
                    if (0 != ShowColumnWorkTimeNorm)
                    {
                        w.TAddColumn("Норма рабочего времени", align.ALIGN_CENTER, valign.VALIGN_MIDDLE, "TABLE_HEADER");
                        ++nActivityColSpan;
                        ++nTotalColspan;
                    }
                    w.TAddColumn("Сумма затрат (час)", align.ALIGN_CENTER, valign.VALIGN_MIDDLE, "TABLE_HEADER");
                    //w.TAddColumn("Сумма затрат", align.ALIGN_RIGHT, valign.VALIGN_MIDDLE, "TABLE_HEADER");

                    /*if(0!=ShowColumnOverheads)
                     * {
                     *      w.TAddColumn("Накладные расходы", align.ALIGN_RIGHT, valign.VALIGN_MIDDLE, "TABLE_HEADER");
                     ++nActivityColSpan;
                     * }
                     * if(0!=ShowColumnSalaryExpenses)
                     * {
                     *      w.TAddColumn("Затраты на з/п", align.ALIGN_RIGHT, valign.VALIGN_MIDDLE, "TABLE_HEADER");
                     ++nActivityColSpan;
                     * } */

                    for (int i = nFirstDateColumn; i < nFieldCount; ++i)
                    {
                        w.TAddColumn(rdr2.GetName(i), align.ALIGN_CENTER, valign.VALIGN_MIDDLE, "TABLE_HEADER");
                        ++nActivityColSpan;
                    }

                    Guid  prevFolderID     = Guid.Empty;
                    int[] arrLocalTotals   = new int[nFieldCount];
                    int[] arrGlobalTotals  = new int[nFieldCount];
                    int   nLocalTotalTime  = 0;
                    int   nGlobalTotalTime = 0;

                    int nTimeFormatValue = (TimeMeasureUnits == (int)IncidentTracker.TimeMeasureUnits.Hours)?int.MaxValue:/*rdr.GetInt32(5)*/ 600;

                    while (rdr2.Read())
                    {
                        if (SectionByActivity != (int)Croc.IncidentTracker.SectionByActivity.NoSection)
                        {
                            Guid thisFolderID = rdr2.GetGuid(0);
                            if (thisFolderID != prevFolderID)
                            {
                                if (prevFolderID != Guid.Empty)
                                {
                                    // Итого ;)
                                    w.TRStart("SUBTOTAL");
                                    w.TRAddCell("Итого по активности:", null, nTotalColspan, 1);
                                    w.TRAddCell(xmlEncode(_FormatTimeStringAtServer(nLocalTotalTime, nTimeFormatValue)), null);
                                    //w.TRAddCell(rLocalTotalCost, fixed_14_4);

                                    /*if(0!=ShowColumnOverheads)
                                     *      w.TRAddCell( rLocalTotalOverheads, fixed_14_4);
                                     * if(0!=ShowColumnSalaryExpenses)
                                     *      w.TRAddCell( rLocalTotalSalaryExpenses, fixed_14_4);*/
                                    for (int i = nFirstDateColumn; i < nFieldCount; ++i)
                                    {
                                        w.TRAddCell(xmlEncode(_FormatTimeStringAtServer(arrLocalTotals[i], nTimeFormatValue)), null);
                                    }
                                    w.TREnd();
                                    // Почистим локальный "ИТОГО"
                                    nLocalTotalTime = 0;
                                    System.Array.Clear(arrLocalTotals, 0, arrLocalTotals.Length);
                                }
                                prevFolderID = thisFolderID;
                                // Сформируем подзаголовок
                                w.TRStart("SUBTITLE");
                                w.TRAddCell(this._GetFolderAnchor(rdr2.GetString(1), thisFolderID, Guid.Empty, true, dtBegin, dtEnd), null, nActivityColSpan, 1);
                                w.TREnd();
                            }
                        }

                        bool bIncludeInGlobals = rdr2.GetInt32(7) == 0;

                        w.TRStart("CELL_CLASS");
                        w.TRAddCell(_GetUserMailAnchor(rdr2.GetString(3), rdr2.GetString(4), rdr2.GetGuid(2), Guid.Empty, rdr2.IsDBNull(0)?(Folder == null?Guid.Empty:((Guid)Folder)):rdr2.GetGuid(0)), null);
                        if (0 != ShowColumnWorkTimeNorm)
                        {
                            w.TRAddCell(xmlEncode(this._FormatTimeStringAtServer(rdr2.GetInt32(8), nTimeFormatValue)), null);
                        }
                        int nTempInt32 = rdr2.GetInt32(6);
                        w.TRAddCell(xmlEncode(_FormatTimeStringAtServer(nTempInt32, nTimeFormatValue)), null);
                        if (bIncludeInGlobals)
                        {
                            nGlobalTotalTime += nTempInt32;
                        }
                        nLocalTotalTime += nTempInt32;

                        /*decimal rTempDecimal = rdr2.GetDecimal(11);
                         * w.TRAddCell( rTempDecimal, fixed_14_4);
                         * if(bIncludeInGlobals) rGlobalTotalCost += rTempDecimal;
                         * rLocalTotalCost += rTempDecimal;*/

                        /*if(0!=ShowColumnOverheads)
                         * {
                         *      rTempDecimal = rdr2.GetDecimal(7);
                         *      w.TRAddCell( rTempDecimal, fixed_14_4);
                         *      if(bIncludeInGlobals) rGlobalTotalOverheads += rTempDecimal;
                         *      rLocalTotalOverheads += rTempDecimal;
                         * }
                         * if(0!=ShowColumnSalaryExpenses)
                         * {
                         *      rTempDecimal = rdr2.GetDecimal(8);
                         *      w.TRAddCell( rTempDecimal, fixed_14_4);
                         *      if(bIncludeInGlobals) rGlobalTotalSalaryExpenses += rTempDecimal;
                         *      rLocalTotalSalaryExpenses += rTempDecimal;
                         * }*/
                        for (int i = nFirstDateColumn; i < nFieldCount; ++i)
                        {
                            nTempInt32 = rdr2.GetInt32(i);
                            w.TRAddCell(xmlEncode(_FormatTimeStringAtServer(nTempInt32, nTimeFormatValue)), null);
                            if (bIncludeInGlobals)
                            {
                                arrGlobalTotals[i] = arrGlobalTotals[i] + nTempInt32;
                            }
                            arrLocalTotals[i] = arrLocalTotals[i] + nTempInt32;
                        }

                        w.TREnd();
                    }
                    if (SectionByActivity != (int)Croc.IncidentTracker.SectionByActivity.NoSection)
                    {
                        if (prevFolderID != Guid.Empty)
                        {
                            // Итого ;)
                            w.TRStart("SUBTOTAL");
                            w.TRAddCell("Итого по активности:", null, nTotalColspan, 1);
                            w.TRAddCell(xmlEncode(_FormatTimeStringAtServer(nLocalTotalTime, nTimeFormatValue)), null);
                            //w.TRAddCell(rLocalTotalCost, fixed_14_4);

                            /*if(0!=ShowColumnOverheads)
                             *      w.TRAddCell( rLocalTotalOverheads, fixed_14_4);
                             * if(0!=ShowColumnSalaryExpenses)
                             *      w.TRAddCell( rLocalTotalSalaryExpenses, fixed_14_4); */
                            for (int i = nFirstDateColumn; i < nFieldCount; ++i)
                            {
                                w.TRAddCell(xmlEncode(_FormatTimeStringAtServer(arrLocalTotals[i], nTimeFormatValue)), null);
                            }
                            w.TREnd();
                        }
                    }
                    // Итого ;)
                    w.TRStart("TABLE_FOOTER");
                    w.TRAddCell("Итого:", null, nTotalColspan, 1);
                    w.TRAddCell(xmlEncode(_FormatTimeStringAtServer(nGlobalTotalTime, nTimeFormatValue)), null);
                    //w.TRAddCell(rGlobalTotalCost, fixed_14_4);

                    /*if(0!=ShowColumnOverheads)
                     *      w.TRAddCell( rGlobalTotalOverheads, fixed_14_4);
                     * if(0!=ShowColumnSalaryExpenses)
                     *      w.TRAddCell( rGlobalTotalSalaryExpenses, fixed_14_4); */
                    for (int i = nFirstDateColumn; i < nFieldCount; ++i)
                    {
                        w.TRAddCell(xmlEncode(_FormatTimeStringAtServer(arrGlobalTotals[i], nTimeFormatValue)), null);
                    }
                    w.TREnd();

                    w.TEnd();
                }
            }
            w.EndPageBody();
            w.EndPageSequence();
        }