private bool Loader() { selections = sample.SelectionWells.ToArray(); obj = selections.FirstOrDefault().Objecte; client = obj.Client; if (obj.GetMidMonthVolume(DateControl_Class.SelectYear - 1).Volume == 0) { MessageBox.Show("Среднемесячный объём отсутствует!"); return(false); } return(true); }
/// <summary>Отрисовка таблицы</summary> public void CreateTable(ICell cell, SelectionWell selectionWell) { table = CreateColumn(cell); for (int i = 1; i < 16; i++) { table.value.Add(new MyTools.C_ValueCell(i, 1, i - 1)); } table.value.Add(new MyTools.C_ValueCell("мг / л", 0, 6)); table.value.Add(new MyTools.C_ValueCell("мг / л", 0, 7)); table.value.Add(new MyTools.C_ValueCell("мг / л", 0, 10)); table.value.Add(new MyTools.C_ValueCell("тонн", 0, 8)); table.value.Add(new MyTools.C_ValueCell("тонн", 0, 9)); table.value.Add(new MyTools.C_ValueCell("тонн", 0, 11)); ValueSelection[] valueSelections = selectionWell.ValueSelections.Where(x => x.Value > 0).ToArray(); table.value.Add(new MyTools.C_ValueCell(MyTools.StringDate_From_YMDHMS(selectionWell.YMDHM, MyTools.EInputDate.YMDHM, MyTools.EInputDate.YMD), 2, 0, valueSelections.Length - 1)); MonthVolume = obj.GetMidMonthVolume(DateControl_Class.SelectYear - 1).Volume; table.value.Add(new MyTools.C_ValueCell(MonthVolume, 2, 1, valueSelections.Length - 1)); int row = 2; Declaration declair = selectionWell.Well.Declaration; foreach (var valueSelection in valueSelections) { Pollution pollution = valueSelection.Pollution; table.value.Add(new MyTools.C_ValueCell(pollution.FullName.TextToUpper().StringDivision(4), row, 2, style: Styles.s_RLTB_LC_T10_W)); if (pollution.Key > 0) { table.value.Add(new MyTools.C_ValueCell(pollution.Key, row, 3)); } table.value.Add(new MyTools.C_ValueCell(valueSelection.ValueRound.KillZero(), row, 4)); table.value.Add(new MyTools.C_ValueCell(((decimal)MonthVolume * valueSelection.Value).ToMath(6, 4, 1), row, 5, style: Styles.s_RLTB_RC_T10_W)); table.value.AddRange(GetResolution(valueSelection, "621", row, 6, 8, 12)); table.value.AddRange(GetResolution(valueSelection, "644", row, 7, 9, 13)); DeclarationValue declarationValue = declair != null?declair.DeclarationValues.FirstOrDefault(x => x.PollutionID == pollution.ID) : null; if (declarationValue != null) { decimal result = 0; if (pollution.HasRange) { table.value.Add(new MyTools.C_ValueCell($"{declarationValue.FromRound.KillZero()}-{declarationValue.ToRound.KillZero()}", row, 10)); } else { table.value.Add(new MyTools.C_ValueCell(declarationValue.ToRound.KillZero(), row, 10)); result = (decimal)MonthVolume * declarationValue.To; if (result > 0) { table.value.Add(new MyTools.C_ValueCell(result.ToMath(6, 4, 1), row, 11, style: Styles.s_RLTB_RC_T10_W)); } result = Math.Round(valueSelection.Value / declarationValue.To, 1); if (result > 1) { table.value.Add(new MyTools.C_ValueCell(result.ToMoney(null, 1), row, 14)); } } } row++; } CreateTable(cell.Sheet, table); ResizeWidth(cell.Sheet, MyTools.ETypeFormatBook.Horizontal, table); ResizeHeight(cell.Sheet, table); }