public ThisReportParams(ReportParams ps) { PeriodType = (PeriodType)((int)ps["PeriodType"]); if (!ps.GetParam("IntervalBegin").IsNull) { IntervalBegin = (DateTime)ps["IntervalBegin"]; } if (!ps.GetParam("IntervalEnd").IsNull) { IntervalEnd = (DateTime)ps["IntervalEnd"]; } if (!ps.GetParam("Quarter").IsNull) { Quarter = (Quarter)((int)ps["Quarter"]); } Folder = (Guid)ps["Folder"]; ShowDetalization = (bool)((int)ps["ShowDetalization"] != 0); TimeMeasureUnits = (TimeMeasureUnits)((int)ps["TimeMeasureUnits"]); SortBy = (ReportDepartmentCostSort)((int)ps["SortBy"]); ShowRestrictions = (bool)((int)ps["ShowRestrictions"] != 0); //if (PeriodType != PeriodType.DateInterval && (IntervalBegin.HasValue || IntervalEnd.HasValue)) // throw new ApplicationException("Заданы даты интервала при типе периода отличном от Интервал дат"); //if (PeriodType != PeriodType.SelectedQuarter && Quarter.HasValue) // throw new ApplicationException("Задан квартал при типе периода отличном от Квартал"); }
public bool IsSpecifiedIntervalEnd; //Признак, что дата конца отчетного периода задана public ThisReportParams(ReportParams Params) { // Задание дат начала и конца отчетного периода IsSpecifiedIntervalBegin = !Params.GetParam("IntervalBegin").IsNull; IntervalBegin = (IsSpecifiedIntervalBegin ? Params.GetParam("IntervalBegin").Value : DBNull.Value); IsSpecifiedIntervalEnd = !Params.GetParam("IntervalEnd").IsNull; IntervalEnd = (IsSpecifiedIntervalEnd ? Params.GetParam("IntervalEnd").Value : DBNull.Value); }
/// <summary> /// Параметризированный конструктор. Инициализирует свойства класса на /// основании данных параметров, представленных в коллекции ReportParams. /// </summary> /// <param name="Params">Данные параметов, передаваемые в отчет</param> /// <remarks> /// При необходимости выполняет коррекцию значений параметров, полгаемых /// по умолчанию, а так же расчет синтетических параметров (таких как /// "Направление активности") /// </remarks> public ThisReportParams(ReportParams Params) { EmpID = (Guid)Params.GetParam("EmpID").Value; IsSpecifiedIntervalBegin = !Params.GetParam("IntervalBegin").IsNull; IntervalBegin = (IsSpecifiedIntervalBegin ? Params.GetParam("IntervalBegin").Value : DBNull.Value); IsSpecifiedIntervalEnd = !Params.GetParam("IntervalEnd").IsNull; IntervalEnd = (IsSpecifiedIntervalEnd ? Params.GetParam("IntervalEnd").Value : DBNull.Value); }
// Выводит приходы и расходы по займам и интервалам private void writeLoansIncOutDataRow(XslFOProfileWriter fo, ThisReportData data, int iType, ReportParams Params) { string sCol = "OutSum"; fo.TRStart(); if (iType == 0) { sCol = "IncSum"; _WriteCell(fo, "П"); } else { _WriteCell(fo, "Р"); } //На начало периода writeEmptyValueCell(fo, 1); //Расходы - приходы foreach (IDictionary fd in data.LoansSumFinData) { //Если есть расходы или приходы, то формируем ссылку на отчет с детализацией if ((String)fd[sCol] != "0.00") { StringBuilder sbDetailRef = new StringBuilder(); _StartReportURL(sbDetailRef, "r-LoansIncOut"); _AppendParamURL(sbDetailRef, "Type", iType); _AppendParamURL(sbDetailRef, "PrjGroup", (Guid)Params.GetParam("Group").Value); _AppendParamURL(sbDetailRef, "DateIntervalID", (Guid)fd["DateIntervalID"]); _AppendParamURL(sbDetailRef, "IsSeparate", Params.GetParam("IsSeparate").Value); _AppendParamURL(sbDetailRef, "Sum", fd[sCol].ToString()); _EndReportURL(sbDetailRef, "Детализация", fd[sCol]); _WriteCell(fo, sbDetailRef.ToString()); } else { _WriteCell(fo, xmlEncode(fd[sCol])); } } // writeEmptyValueCell(fo, 3); fo.TREnd(); }
/// <summary> /// Параметризированный конструктор. Инициализирует свойства класса на /// основании данных параметров, представленных в коллекции ReportParams. /// </summary> /// <param name="Params">Данные параметов, передаваемые в отчет</param> /// <param name="cn">Соединение с БД (для подгрузки данных)</param> /// <remarks> /// При необходимости выполняет коррекцию значений параметров /// </remarks> public ThisReportParams(ReportParams Params, IReportDataProvider provider) { // #1: ЗАЧИТЫВАЕМ ПАРАМЕТРЫ, ЗАДАННЫЕ ЯВНО // Идентификатор сотрудника EmployeeID = (Guid)Params.GetParam("Employee").Value; // Задание дат начала и конца отчетного периода IsSpecifiedIntervalBegin = !Params.GetParam("IntervalBegin").IsNull; IntervalBegin = (IsSpecifiedIntervalBegin? Params.GetParam("IntervalBegin").Value : DBNull.Value); IsSpecifiedIntervalEnd = !Params.GetParam("IntervalEnd").IsNull; IntervalEnd = (IsSpecifiedIntervalEnd? Params.GetParam("IntervalEnd").Value : DBNull.Value); // Признак "Показывть выходные дни без списаний" ShowFreeWeekends = (0 != (int)Params.GetParam("ShowFreeWeekends").Value); // Представление времени TimeMeasure = (TimeMeasureUnits)((int)Params.GetParam("TimeMeasureUnits").Value); // Признак отображения параметров отчета в заголовке ShowRestrictions = (0 != (int)Params.GetParam("ShowRestrictions").Value); // #2: ДОГРУЖАЕМ ВСЕ ДАННЫЕ ПО СОТРУДНИКУ using (IDataReader reader = provider.GetDataReader("dsAdditionaly", null)) { if (reader.Read()) { int nOrdinal = reader.GetOrdinal("FullName"); FullName = reader.IsDBNull(nOrdinal)? null : reader.GetString(nOrdinal); nOrdinal = reader.GetOrdinal("WorkBeginDate"); WorkBeginDate = reader.IsDBNull(nOrdinal) ? DateTime.MinValue : reader.GetDateTime(nOrdinal); nOrdinal = reader.GetOrdinal("WorkEndDate"); WorkEndDate = reader.IsDBNull(nOrdinal) ? DateTime.MaxValue : reader.GetDateTime(nOrdinal); nOrdinal = reader.GetOrdinal("WorkdayDuration"); WorkdayDuration = reader.IsDBNull(nOrdinal) ? 0 : reader.GetInt32(nOrdinal); } } }
/// <summary> /// Параметризированный конструктор. Инициализирует свойства класса на /// основании данных параметров, представленных в коллекции ReportParams. /// </summary> /// <param name="Params">Данные параметов, передаваемые в отчет</param> /// <remarks> /// При необходимости выполняет коррекцию значений параметров, полгаемых /// по умолчанию, а так же расчет синтетических параметров (таких как /// "Направление активности") /// </remarks> public ThisReportParams(ReportParams Params) { // Задание дат начала и конца отчетного периода IsSpecifiedIntervalBegin = !Params.GetParam("IntervalBegin").IsNull; IntervalBegin = (IsSpecifiedIntervalBegin? Params.GetParam("IntervalBegin").Value : DBNull.Value); IsSpecifiedIntervalEnd = !Params.GetParam("IntervalEnd").IsNull; IntervalEnd = (IsSpecifiedIntervalEnd? Params.GetParam("IntervalEnd").Value : DBNull.Value); // Вид направления анализа определяется на основании задания идентификаторов // организации или активности; сразу корректируем значения параметров: если // они не заданы, то используем в качестве значения DBNull: Organization = Guid.Empty; Folder = Guid.Empty; if (!Params.GetParam("Folder").IsNull) { AnalysisDirection = AnalysisDirectionEnum.ByActivity; Folder = Params.GetParam("Folder").Value; Organization = DBNull.Value; } else if (!Params.GetParam("Organization").IsNull) { AnalysisDirection = AnalysisDirectionEnum.ByCustomer_TargetCustomer; Organization = Params.GetParam("Organization").Value; Folder = DBNull.Value; } else { AnalysisDirection = AnalysisDirectionEnum.ByCustomer_AllCustomners; Organization = DBNull.Value; Folder = DBNull.Value; } // Типы активностей: FolderType = (int)Params.GetParam("FolderType").Value; if (AnalysisDirectionEnum.ByActivity == AnalysisDirection) { FolderType = 0; } // Учет данных только открытых активностей OnlyActiveFolders = (0 != (int)Params.GetParam("OnlyActiveFolders").Value); if (AnalysisDirectionEnum.ByActivity == AnalysisDirection) { OnlyActiveFolders = false; } // Отображение данных об истории изменения данных по направлениям для активности ShowHistoryInfo = (0 != (int)Params.GetParam("ShowHistoryInfo").Value); if (AnalysisDirectionEnum.ByActivity != AnalysisDirection) { ShowHistoryInfo = false; } // Детализация данных в отчете ShowDetails = (0 != (int)Params.GetParam("ShowDetails").Value); // Форма представления времени; TimeMeasure = (TimeMeasureUnits)((int)Params.GetParam("TimeMeasureUnits").Value); // Тип сортировки (0 - по наименованию направления, 1 - по сумме) SortBy = (int)Params.GetParam("SortBy").Value; // Признак отображения параметров отчета в заголовке ShowRestrictions = (0 != (int)Params.GetParam("ShowRestrictions").Value); }
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("" + Employee + "","" + xmlEncode(headerData["EMail"]) + "")\">" + 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> </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(" ", 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(" ", null); } if (bComment) { w.TRAddCell(" ", 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(" ", 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(" ", null); } if (bComment) { w.TRAddCell(" ", null); } w.TREnd(); } // Итого if ((int)ExpencesType.Both == (int)ExpenseType || (int)ExpencesType.Incidents == (int)ExpenseType) { w.TRStart(); w.TRAddCell(" ", 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(" ", null, 1, 1, "TABLE_HEADER"); } if (bComment) { w.TRAddCell(" ", null, 1, 1, "TABLE_HEADER"); } w.TREnd(); } if ((int)ExpencesType.Both == (int)ExpenseType || (int)ExpencesType.Discarding == (int)ExpenseType) { w.TRStart(); w.TRAddCell(" ", null, 1, 1, "TABLE_HEADER"); w.TRAddCell("Итого списано ", null, nTotalColspan, 1, "TABLE_HEADER"); if (bNumberOfTasks) { w.TRAddCell(" ", null, 1, 1, "TABLE_HEADER"); } w.TRAddCell(this._FormatTimeStringAtServer(totalLost, nReportWorkDayDuration), 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 ((int)ExpencesType.Both == (int)ExpenseType) { w.TRStart(); w.TRAddCell(" ", null, 1, 1, "TABLE_HEADER"); w.TRAddCell("Общие трудозатраты ", null, nTotalColspan, 1, "TABLE_HEADER"); if (bNumberOfTasks) { w.TRAddCell(" ", null, 1, 1, "TABLE_HEADER"); } w.TRAddCell(this._FormatTimeStringAtServer(totalLost + totalSpent, nReportWorkDayDuration), 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(); } w.TRStart(); w.TRAddCell(" ", 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(); } }
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("" + Customer + "","" + rdr.GetString(6) + "","" + rdr.GetString(7) + "")\">" + 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("" + rdr.GetGuid(5) + "",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(); }
// Выводит приходы и расходы по проектам и интервалам private void writeProjectsIncOutDataRow(XslFOProfileWriter fo, ThisReportData data, IDictionary Project, int iType, ReportParams Params) { string sCol = "OutSum"; fo.TRStart(); if (iType == 0) { sCol = "IncSum"; _WriteCell(fo, "П"); } else { _WriteCell(fo, "Р"); } //На начало периода foreach (IDictionary fd in data.ProjectsPreFinData) { if ((Guid)Project["ObjectID"] == (Guid)fd["ObjectID"]) { _WriteCell(fo, xmlEncode(fd[sCol])); } } //Расходы foreach (IDictionary fd in data.ProjectsFinData) { if ((Guid)Project["ObjectID"] == (Guid)fd["ObjectID"]) { //Если есть расходы или приходы, то формируем ссылку на отчет с детализацией if ((String)fd[sCol] != "0.00") { StringBuilder sbDetailRef = new StringBuilder(); _StartReportURL(sbDetailRef, "r-ProjectIncOut"); _AppendParamURL(sbDetailRef, "Type", iType); _AppendParamURL(sbDetailRef, "InContract", (Guid)fd["ObjectID"]); _AppendParamURL(sbDetailRef, "DateIntervalID", (Guid)fd["DateIntervalID"]); _AppendParamURL(sbDetailRef, "IsSeparate", Params.GetParam("IsSeparate").Value); _AppendParamURL(sbDetailRef, "Sum", fd[sCol].ToString()); _EndReportURL(sbDetailRef, "Детализация", fd[sCol]); _WriteCell(fo, sbDetailRef.ToString()); } else { _WriteCell(fo, xmlEncode(fd[sCol])); } } } //Итого расходов foreach (IDictionary fd in data.ProjectsSumFinData) { if ((Guid)Project["ObjectID"] == (Guid)fd["ObjectID"]) { _WriteCell(fo, xmlEncode(fd[sCol])); } } //Остаток foreach (IDictionary fd in data.ProjectsAfterFinData) { if ((Guid)Project["ObjectID"] == (Guid)fd["ObjectID"]) { _WriteCell(fo, xmlEncode(fd[sCol])); } } //Всего foreach (IDictionary fd in data.ProjectsAllFinData) { if ((Guid)Project["ObjectID"] == (Guid)fd["ObjectID"]) { _WriteCell(fo, xmlEncode(fd[sCol])); } } fo.TREnd(); }
public Guid DateRatio; //Масштаб дат public ThisReportParams(ReportParams Params) { PrjGroup = (Guid)Params.GetParam("Group").Value; DateRatio = (Guid)Params.GetParam("DateRatio").Value; }
/// Отображение основных данных отчета private void writeMainData(XslFOProfileWriter fo, ThisReportData data, ReportParams Params) { _TableSeparator(fo); fo.TStart(true, ITRepStyles.TABLE, false); #region Шапка отчета fo.TAddColumn("", align.ALIGN_LEFT, valign.VALIGN_MIDDLE, null, "1%", align.ALIGN_CENTER, valign.VALIGN_MIDDLE, ITRepStyles.TABLE_HEADER); fo.TAddColumn("На начало", align.ALIGN_RIGHT, valign.VALIGN_MIDDLE, null, "4%", align.ALIGN_CENTER, valign.VALIGN_MIDDLE, ITRepStyles.TABLE_HEADER); //Общее количество колонок в таблице отчета int i = 4; //Заголовки колонок foreach (IDictionary Interval in data.DateRatio) { fo.TAddColumn(xmlEncode(Interval["Name"].ToString()), align.ALIGN_RIGHT, valign.VALIGN_MIDDLE, null, "4%", align.ALIGN_CENTER, valign.VALIGN_MIDDLE, ITRepStyles.TABLE_HEADER); i++; } fo.TAddColumn("Итого", align.ALIGN_RIGHT, valign.VALIGN_MIDDLE, null, "4%", align.ALIGN_CENTER, valign.VALIGN_MIDDLE, ITRepStyles.TABLE_HEADER); fo.TAddColumn("Остаток", align.ALIGN_RIGHT, valign.VALIGN_MIDDLE, null, "4%", align.ALIGN_CENTER, valign.VALIGN_MIDDLE, ITRepStyles.TABLE_HEADER); fo.TAddColumn("Всего", align.ALIGN_RIGHT, valign.VALIGN_MIDDLE, null, "4%", align.ALIGN_CENTER, valign.VALIGN_MIDDLE, ITRepStyles.TABLE_HEADER); i++; #endregion #region Общие расходы и расходы по АО fo.TRStart(); fo.TRAddCell("ОБЩИE РАСХОДЫ", "string", i, 1, ITRepStyles.GROUP_HEADER); fo.TREnd(); writeGenDataRow(fo, data.GenOutSum); fo.TRStart(); fo.TRAddCell("ОБЩИЕ АО", "string", i, 1, ITRepStyles.GROUP_HEADER); fo.TREnd(); writeGenDataRow(fo, data.AOSum); #endregion #region Итоговые показатели по займам fo.TRStart(); fo.TRAddCell("ВСЕГО ПО ЗАЙМАМ", "string", i, 1, ITRepStyles.GROUP_HEADER); fo.TREnd(); writeLoansIncOutDataRow(fo, data, 0, Params); //Приходы по займам writeLoansIncOutDataRow(fo, data, 1, Params); //Расходы по займам // Сальдо по займам fo.TRStart(); _WriteCell(fo, "C"); writeEmptyValueCell(fo, 1); foreach (IDictionary fd in data.LoansSumFinData) { _WriteCell(fo, xmlEncode(fd["SaldoSum"])); } writeEmptyValueCell(fo, 3); fo.TREnd(); #endregion #region Итоговые показатели по группе проектов fo.TRStart(); fo.TRAddCell("ВСЕГО ПО ПРОЕКТАМ", "string", i, 1, ITRepStyles.GROUP_HEADER); fo.TREnd(); writeSumProjectDataRow(fo, data, "П", "IncSum"); // Приходы по группе проектов writeSumProjectDataRow(fo, data, "Р", "OutSum"); // Расходы по группе проектов writeSumProjectDataRow(fo, data, "С", "SaldoSum"); // Сальдо по группе проектов // Сальдо по группе нарастающим итогом fo.TRStart(); _WriteCell(fo, "НИ"); writeEmptyValueCell(fo, 1); foreach (IDictionary fd in data.GroupFinData) { _WriteCell(fo, xmlEncode(fd["SaldoSumProg"])); } writeEmptyValueCell(fo, 3); fo.TREnd(); #endregion #region Показатели по проектам if ((int)Params.GetParam("IsPrjData").Value != 0) { foreach (IDictionary Project in data.PrjGroup) { //Заголовок проекта fo.TRStart(); fo.TRAddCell(xmlEncode(Project["Name"]), "string", i, 1, ITRepStyles.GROUP_HEADER); fo.TREnd(); writeProjectsIncOutDataRow(fo, data, Project, 0, Params); //Приходы по проекту writeProjectsIncOutDataRow(fo, data, Project, 1, Params); //Расходы по проекту // Сальдо по проекту fo.TRStart(); _WriteCell(fo, "С"); foreach (IDictionary fd in data.ProjectsPreFinData) //На начало периода { if ((Guid)Project["ObjectID"] == (Guid)fd["ObjectID"]) { _WriteCell(fo, xmlEncode(fd["SaldoSum"])); } } foreach (IDictionary fd in data.ProjectsFinData) //По интервалам { if ((Guid)Project["ObjectID"] == (Guid)fd["ObjectID"]) { _WriteCell(fo, xmlEncode(fd["SaldoSum"])); } } foreach (IDictionary fd in data.ProjectsSumFinData) //Итого сальдо { if ((Guid)Project["ObjectID"] == (Guid)fd["ObjectID"]) { _WriteCell(fo, xmlEncode(fd["SaldoSum"])); } } foreach (IDictionary fd in data.ProjectsAfterFinData) //Остаток { if ((Guid)Project["ObjectID"] == (Guid)fd["ObjectID"]) { _WriteCell(fo, xmlEncode(fd["SaldoSum"])); } } foreach (IDictionary fd in data.ProjectsAllFinData) //Итого { if ((Guid)Project["ObjectID"] == (Guid)fd["ObjectID"]) { _WriteCell(fo, xmlEncode(fd["SaldoSum"])); } } fo.TREnd(); // Сальдо нарастающим итогом fo.TRStart(); _WriteCell(fo, "НИ"); writeEmptyValueCell(fo, 1); foreach (IDictionary fd in data.ProjectsFinData) { if ((Guid)Project["ObjectID"] == (Guid)fd["ObjectID"]) { _WriteCell(fo, xmlEncode(fd["SaldoSumProg"])); } } writeEmptyValueCell(fo, 3); fo.TREnd(); } } #endregion fo.TEnd(); }