Exemplo n.º 1
0
        /// <summary>Заполнить лист хранилище</summary>
        private void DRAW_THIS()
        {
            PollutionBase_Class.LoadSelectedWells(DateControl_Class.SelectMonth);

            var actualSelectionWells = PollutionBase_Class.ListSelectionWell.Where(x => x.Number > 0).OrderBy(x => x.Number).ToArray();

            foreach (var actialSelectionWell in actualSelectionWells)
            {
                List <KeyValuePair <string, decimal> > Summs = new List <KeyValuePair <string, decimal> >();
                //расчеты
                if (!ColumnOff.Contains(ThisColumn.Summn))
                {
                    Sample  samp = actialSelectionWell.Sample;
                    Objecte obj  = actialSelectionWell.Well.Objecte;
                    KeyValuePair <uint, BaseCalc_Class.Summs>[] summs;
                    Resolution resolution;

                    #region 644
                    resolution = PollutionBase_Class.AllResolution.First(x => x.CurtName.Contains("644"));
                    if (obj.CanResolution(resolution.ID))
                    {
                        calc  = new Calc_644(samp, obj, resolution);
                        summs = calc.Calc();

                        Summs.AddRange(summs.Select(x => new KeyValuePair <string, decimal>("644:", x.Value.SummNDS)));
                    }
                    #endregion

                    #region 621
                    resolution = PollutionBase_Class.AllResolution.First(x => x.CurtName.Contains("621"));
                    if (obj.CanResolution(resolution.ID))
                    {
                        calc  = new Calc_621(samp, obj, resolution);
                        summs = calc.Calc();

                        Summs.AddRange(summs.Select(x => new KeyValuePair <string, decimal>("621:", x.Value.SummNDS)));
                    }
                    #endregion
                }

                Dictionary <string, ValueWork> values = new Dictionary <string, ValueWork>();
                //концентрации
                if (!ColumnOff.Contains(ThisColumn.Pollution))
                {
                    foreach (var pollution in PollutionBase_Class.AllPolutions)
                    {
                        values.Add(pollution.BindName, new ValueWork(pollution.ID, actialSelectionWell.ID));
                    }

                    foreach (var selectionValue in actialSelectionWell.ValueSelections)
                    {
                        values[selectionValue.Pollution.BindName] = new ValueWork(selectionValue.ID);
                    }
                }

                Values.Add(new SHOW(actialSelectionWell, Summs.ToArray(), values.Values.ToArray()));
            }
        }
Exemplo n.º 2
0
        private List <MyTools.C_ValueCell> GetResolution(ValueSelection one, string resolutionName, int row, int Col1, int Col2, int Col3)
        {
            Resolution resolution             = PollutionBase_Class.AllResolution.First(x => x.CurtName.Contains(resolutionName));
            List <MyTools.C_ValueCell> result = new List <MyTools.C_ValueCell>();
            decimal value = 0;

            if (obj.CanResolution(resolution.ID))
            {
                uint      IDUnit = resolution.CurtName.Contains("621") ? one.SelectionWell.Well.UnitID : 0;
                ValueNorm VN     = PollutionBase_Class.GetValueNorm(resolution.ID, one.Pollution.ID, IDUnit);
                if (VN != null)
                {
                    if (one.Pollution.HasRange)
                    {
                        if (VN.FromRound > 0 && VN.ToRound > 0)
                        {
                            result.Add(new MyTools.C_ValueCell($"{VN.FromRound.KillZero()}-{VN.ToRound.KillZero()}", row, Col1));
                        }
                    }
                    else
                    {
                        var toValue = VN.ToRound;

                        if (toValue > 0)
                        {
                            table.value.Add(new MyTools.C_ValueCell(VN.ToRound.KillZero(), row, Col1));
                            value = (decimal)MonthVolume * VN.To;
                            if (value > 0)
                            {
                                table.value.Add(new MyTools.C_ValueCell(value.ToMath(6, 4, 1), row, Col2, style: Styles.s_RLTB_RC_T10_W));
                            }
                            value = Math.Round(one.Value / VN.To, 1);
                            if (value > 1)
                            {
                                table.value.Add(new MyTools.C_ValueCell(value.ToMoney(null, 1), row, Col3));
                            }
                        }
                    }
                }
            }
            return(result);
        }
Exemplo n.º 3
0
        protected override void internalStart()
        {
            book = TemplateStorage.WorkBook;
            if (!CreateStyle())
            {
                return;
            }
            string ListName = "621";

            #region 621
            Resolution resolution = PollutionBase_Class.AllResolution.First(x => x.CurtName.Contains(ListName));
            if (obj.CanResolution(resolution.ID))
            {
                GeneralSumma = new List <decimal>();

                var index = book.GetSheetIndex("Расчёт");

                sheet = book.CloneSheet(index);

                book.SetSheetName(book.NumberOfSheets - 1, ListName);
                Substitute = new CellExchange_Class(sheet);
                LoadTextTemplate(sheet, ListName);
                ClientLoad();
                Table621_1(resolution);
                if (!Table621_2(resolution))
                {
                    Substitute.AddExchange(mark.blok2, e => e.Row.ZeroHeight = true, 0);
                }
                else
                {
                    Substitute.AddExchange(mark.blok2, "", 0);
                }
                ResizeHeight(sheet, 3, sheet.LastRowNum);
                Substitute.AddExchange(mark.pay, GeneralSumma.Sum().ToMoney(), 1);
                R621 = GeneralSumma.Sum() > AdditionnTable.GetPeriod.MinLimits;
                Substitute.Exchange();
                ClearRowFromMark(sheet, mark.job);
            }
            #endregion
            #region 644
            ListName   = "644";
            resolution = PollutionBase_Class.AllResolution.First(x => x.CurtName.Contains(ListName));
            if (obj.CanResolution(resolution.ID))
            {
                GeneralSumma = new List <decimal>();
                sheet        = book.CloneSheet(book.GetSheetIndex("Расчёт"));
                book.SetSheetName(book.NumberOfSheets - 1, ListName);
                Substitute = new CellExchange_Class(sheet);
                LoadTextTemplate(sheet, ListName);
                ClientLoad();
                if (Table644(resolution))
                {
                    Substitute.AddExchange(mark.pay, GeneralSumma.Sum().ToMoney(), 1);
                    R644 = GeneralSumma.Sum() > AdditionnTable.GetPeriod.MinLimits;
                    Substitute.Exchange();
                    ClearRowFromMark(sheet, mark.job);
                }
                else
                {
                    book.RemoveSheetAt(book.NumberOfSheets - 1);
                }
            }
            #endregion
            book.RemoveSheetAt(book.GetSheetIndex("Расчёт"));
            Letter();
            Print("Расчёты платы", "Расчёт платы", EPathPrint.Documents);
        }