Example #1
0
 private void MarkFlags(TVALUES_DB watts, ExtendedXlsFile xls, int col)
 {
     //есть ОВ
     if ((watts.F_FLAG & (VALUES_FLAG_DB.None | VALUES_FLAG_DB.IsOVReplaced)) ==
         (VALUES_FLAG_DB.None | VALUES_FLAG_DB.IsOVReplaced))
     {
         xls.SetCellFontColor(UsedRows, col, IsOVReplacedColor);
         xls.SetCellFontColor(UsedRows, col, IsOVReplacedColor);
         InternalData.FlagOVremark = true;
     }
     // нет данных
     if ((watts.F_FLAG & VALUES_FLAG_DB.DataNotFull) == VALUES_FLAG_DB.DataNotFull)
     {
         xls.SetCellBkColor(UsedRows, col, NoDataColor);
         InternalData.FlNoData = true;
     }
     // статус менялся вручную
     if (((watts.F_FLAG & VALUES_FLAG_DB.NotCorrect) == VALUES_FLAG_DB.NotCorrect) &&
         ((watts.F_FLAG & VALUES_FLAG_DB.isManualStatusChanged) ==
          VALUES_FLAG_DB.isManualStatusChanged))
     {
         xls.SetCellBkColor(UsedRows, col, IsManualStatusChangeColor);
         InternalData.FlagManualStatusChange = true;
     }
 }
Example #2
0
 private void MarkFlags(KeyValuePair <enumVoltageClassPoint, Server.DBAccess.Internal.TClasses.TVALUES_DB> wattsByVolt,
                        ExtendedXlsFile xls,
                        int groupColNum,
                        Dictionary <enumVoltageClassPoint, ColNumFormulaUid> colDict)
 {
     //есть ОВ
     if ((wattsByVolt.Value.F_FLAG & (VALUES_FLAG_DB.None | VALUES_FLAG_DB.IsOVReplaced)) ==
         (VALUES_FLAG_DB.None | VALUES_FLAG_DB.IsOVReplaced))
     {
         xls.SetCellFontColor(UsedRows, colDict[wattsByVolt.Key].ColumnNumber, IsOVReplacedColor);
         xls.SetCellFontColor(UsedRows, groupColNum, IsOVReplacedColor);
         xls.SetCellFontColor(UsedRows, InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.SaldoSumm], IsOVReplacedColor);
         //Data.FlagOVremark = true;
         InternalData.FlagOVremark = true;
     }
     // нет данных
     if ((wattsByVolt.Value.F_FLAG & VALUES_FLAG_DB.DataNotFull) == VALUES_FLAG_DB.DataNotFull)
     {
         xls.SetCellBkColor(UsedRows, colDict[wattsByVolt.Key].ColumnNumber, NoDataColor);
         xls.SetCellBkColor(UsedRows, groupColNum, NoDataColor);
         xls.SetCellBkColor(UsedRows, InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.SaldoSumm], NoDataColor);
         //Data.IsNoDataStatus = true;
         InternalData.FlNoData = true;
     }
     // статус менялся вручную
     if (((wattsByVolt.Value.F_FLAG & VALUES_FLAG_DB.NotCorrect) == VALUES_FLAG_DB.NotCorrect)
         &&
         ((wattsByVolt.Value.F_FLAG & VALUES_FLAG_DB.isManualStatusChanged) ==
          VALUES_FLAG_DB.isManualStatusChanged))
     {
         xls.SetCellBkColor(UsedRows, colDict[wattsByVolt.Key].ColumnNumber, IsManualStatusChangeColor);
         xls.SetCellBkColor(UsedRows, groupColNum, IsManualStatusChangeColor);
         xls.SetCellBkColor(UsedRows, InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.SaldoSumm], IsManualStatusChangeColor);
         //Data.FlagManualStatusChange = true;
         InternalData.FlagManualStatusChange = true;
     }
 }
        protected override void RenderFooter(ExtendedXlsFile xls)
        {
            UsedRows++;

            xls.SetCellValueStyled(UsedRows, InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.BalPartName],
                                   "Потери в " + ((Data.VoltageClass == enumVoltageClassGlobal.V220AndLower) ? "сети 220 кВ и ниже" : "сети 330 кВ и выше"),
                                   TFlxFontStyles.Bold);
            xls.MergeCells(UsedRows,
                           InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.BalPartName],
                           UsedRows,
                           InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.InputSumm] - 1);

            xls.SetCellValueStyled(UsedRows + 1, InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.BalPartName],
                                   ("Относительные потери в " +
                                    ((Data.VoltageClass == enumVoltageClassGlobal.V220AndLower) ? "сети 220 кВ и ниже" : "сети 330 кВ и выше") +
                                    " к отпуску в РСК и потребителям"), TFlxFontStyles.Bold);
            xls.MergeCells(UsedRows + 1,
                           InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.BalPartName],
                           UsedRows + 1,
                           InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.InputSumm] - 1);

            UsedCols = InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.InputSumm] - 1;
            for (int i = 0; i < InternalData.NumbersValues; i++)
            {
                UsedCols++;
                var lossesFormula = GetFirstLevelFormulas(InternalData.IntervalFormulUids[i].SummBalPartSaldoForLosses);
                xls.SetFormula(UsedRows, UsedCols, lossesFormula);

                string relativeLossesFormula;

                var dividerFormula = GetFirstLevelFormulas(InternalData.IntervalFormulUids[i].SummBalPartSaldoForLossesDivider);

                if (dividerFormula.Elements.Count > 0)
                {
                    if (InternalData.ExportType == TExportExcelAdapterType.toXLS)
                    {
                        relativeLossesFormula = "=(" + lossesFormula.StringRepresentation() + ")/("
                                                + dividerFormula.StringRepresentation() + ")*100";
                        xls.SetCellFloatValue(UsedRows + 1,
                                              UsedCols,
                                              new TFormula(relativeLossesFormula));
                    }
                    else
                    {
                        double relativeLosses = lossesFormula.DoubleRepresentation()
                                                / dividerFormula.DoubleRepresentation() * 100;
                        xls.SetCellFloatValue(UsedRows + 1, UsedCols, relativeLosses);
                    }
                }
                else
                {
                    xls.SetCellFloatValue(UsedRows + 1, UsedCols, 0.000);
                }

                xls.MergeCells(UsedRows, UsedCols, UsedRows, UsedCols + 2);
                xls.MergeCells(UsedRows + 1, UsedCols, UsedRows + 1, UsedCols + 2);

                UsedCols++;
                UsedCols++;
            }

            UsedRows++;

            if (InternalData.FlNoData || InternalData.FlagOVremark || InternalData.FlagManualStatusChange)
            {
                UsedRows++;
                UsedRows++;
                xls.SetCellValue(UsedRows,
                                 InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.InputSumm] - 1,
                                 "Примечание : ", InternalData.GetFootnoteFormat(xls));
            }
            if (InternalData.FlNoData)
            {
                UsedRows++;
                xls.SetCellBkColor(UsedRows, InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.InputSumm], Color.LightPink);
                xls.SetCellValue(UsedRows, InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.InputSumm] + 1, " - нет данных по одной или нескольким точкам измерения");
                xls.MergeCells(UsedRows, InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.InputSumm] + 1, UsedRows, UsedCols);
            }
            if (InternalData.FlagOVremark)
            {
                UsedRows++;
                xls.SetCellFloatValue(UsedRows, InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.InputSumm], 0.0);
                xls.SetCellFontColor(UsedRows, InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.InputSumm], Color.Red);
                xls.SetCellValue(UsedRows, InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.InputSumm] + 1, " - обходной выключатель");
                xls.MergeCells(UsedRows, InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.InputSumm] + 1, UsedRows, UsedCols);
            }
            if (InternalData.FlagManualStatusChange)
            {
                UsedRows++;
                xls.SetCellBkColor(UsedRows, InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.InputSumm], Color.Yellow);
                xls.SetCellValue(UsedRows, InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.InputSumm] + 1, " - вручную установлен некоммерческий статус");
                xls.MergeCells(UsedRows, InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.InputSumm] + 1, UsedRows, UsedCols);
            }
        }
Example #4
0
        protected override void RenderFooter(ExtendedXlsFile xls)
        {
            UsedRows++;
            xls.SetCellValue(UsedRows,
                             InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.BalPartName],
                             "Итого по ЕНЕС, кВт*ч",
                             InternalData.GetSectionNameFormat(xls));
            xls.MergeCells(UsedRows,
                           InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.BalPartName],
                           UsedRows,
                           InternalData.TotalColumnsCount);
            UsedRows++;

            xls.SetCellValueStyled(UsedRows, InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.BalPartName],
                                   "Всего по объектам ЕНЭС " + ((Data.VoltageClass == enumVoltageClassGlobal.V220AndLower) ? "220" : "330") + " кВ и выше", TFlxFontStyles.Bold);
            xls.MergeCells(UsedRows,
                           InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.BalPartName],
                           UsedRows,
                           InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.InputSumm] - 1);

            RenderSummaryBehavior behav = new RenderSummaryBehavior(this, TFlxFontStyles.None);

            behav.RenderSummary(xls, GetFirstLevelFormulas);
            UsedRows++;

            xls.SetCellValueStyled(UsedRows, InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.BalPartName],
                                   "Потери в " + ((Data.VoltageClass == enumVoltageClassGlobal.V220AndLower) ? "сети 220 кВ и ниже" : "сети 330 кВ и выше"),
                                   TFlxFontStyles.Bold);
            xls.MergeCells(UsedRows,
                           InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.BalPartName],
                           UsedRows,
                           InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.InputSumm] - 1);

            var saldoFormula       = GetFirstLevelFormulas(FormulaNamesEnum.Balance220330SaldoSummary.GetFormulaUid());
            var balPartInRelLosses = GetFirstLevelFormulas(FormulaNamesEnum.Balance220330RelativeLosses.GetFormulaUid());

            xls.SetFormula(UsedRows,
                           InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.InputSumm],
                           saldoFormula);
            UsedRows++;

            xls.SetCellValueStyled(UsedRows, InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.BalPartName],
                                   ("Относительные потери в " +
                                    ((Data.VoltageClass == enumVoltageClassGlobal.V220AndLower) ? "сети 220 кВ и ниже" : "сети 330 кВ и выше") +
                                    " к отпуску в РСК и потребителям"), TFlxFontStyles.Bold);
            xls.MergeCells(UsedRows,
                           InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.BalPartName],
                           UsedRows,
                           InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.InputSumm] - 1);

            string relativeLossesFormula;

            if (balPartInRelLosses.Elements.Count > 0)
            {
                if (InternalData.ExportType == TExportExcelAdapterType.toXLS)
                {
                    relativeLossesFormula = "=(" + saldoFormula.StringRepresentation() + ")/("
                                            + balPartInRelLosses.StringRepresentation() + ")*100";
                    xls.SetCellFloatValue(UsedRows,
                                          InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.InputSumm],
                                          new TFormula(relativeLossesFormula));
                }
                else
                {
                    double relativeLosses = saldoFormula.DoubleRepresentation()
                                            / balPartInRelLosses.DoubleRepresentation() * 100;
                    xls.SetCellFloatValue(UsedRows,
                                          InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.InputSumm],
                                          relativeLosses);
                }
            }
            else
            {
                xls.SetCellFloatValue(UsedRows, InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.InputSumm], 0.000);
            }

            UsedRows++;

            xls.SetCellValueStyled(UsedRows, InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.BalPartName],
                                   "Относительные нормативные потери в сети " +
                                   ((Data.VoltageClass == enumVoltageClassGlobal.V220AndLower) ? "220" : "330") + "кВ, %",
                                   TFlxFontStyles.Bold);
            xls.MergeCells(UsedRows,
                           InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.BalPartName],
                           UsedRows,
                           InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.InputSumm] - 1);
            xls.SetCellFloatValue(UsedRows, InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.InputSumm], Data.HighLimit);
            UsedRows++;
            UsedRows++;

            if (InternalData.FlNoData || InternalData.FlagOVremark || InternalData.FlagManualStatusChange)
            {
                UsedRows++;
                UsedRows++;
                xls.SetCellValue(UsedRows,
                                 InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.InputSumm] - 1,
                                 "Примечание : ", InternalData.GetFootnoteFormat(xls));
            }
            if (InternalData.FlNoData)
            {
                UsedRows++;
                xls.SetCellBkColor(UsedRows, InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.InputSumm], Color.LightPink);
                xls.SetCellValue(UsedRows, InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.InputSumm] + 1, " - нет данных по одной или нескольким точкам измерения");
                xls.MergeCells(UsedRows, InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.InputSumm] + 1, UsedRows, InternalData.TotalColumnsCount);
            }
            if (InternalData.FlagOVremark)
            {
                UsedRows++;
                xls.SetCellFloatValue(UsedRows, InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.InputSumm], 0.0);
                xls.SetCellFontColor(UsedRows, InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.InputSumm], Color.Red);
                xls.SetCellValue(UsedRows, InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.InputSumm] + 1, " - обходной выключатель");
                xls.MergeCells(UsedRows, InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.InputSumm] + 1, UsedRows, InternalData.TotalColumnsCount);
            }
            if (InternalData.FlagManualStatusChange)
            {
                UsedRows++;
                xls.SetCellBkColor(UsedRows, InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.InputSumm], Color.Yellow);
                xls.SetCellValue(UsedRows, InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.InputSumm] + 1, " - вручную установлен некоммерческий статус");
                xls.MergeCells(UsedRows, InternalData.HeaderColumnNumbers[HeaderBal0LogicalParts.InputSumm] + 1, UsedRows, InternalData.TotalColumnsCount);
            }
        }