Ejemplo n.º 1
0
 /// <summary>Адрес по объекту</summary>
 protected void ObjectAdres(Objecte objecte, bool full)
 {
     CP = new Control_Print();
     if (objecte.Separate)
     {
         DetailsObject details = objecte.Detail;
         if (details.MailAdres.Length > 0)
         {
             Substitute.AddExchange(StaticMark.adres_abonent, details.MailAdres.CutAdres(full), 0);
         }
         else if (details.LegalAdres.Length > 0)
         {
             Substitute.AddExchange(StaticMark.adres_abonent, details.LegalAdres.CutAdres(full), 0);
         }
         else
         {
             MessageBox.Show("Объект имеет индикатор абособленный, но адрес не задан!");
         }
     }
     else
     {
         DetailsClient Details   = objecte.Client.Detail;
         string        Storege   = string.Empty;
         bool          PostAdres = Details.AdresPostID != 0;
         if (PostAdres)
         {
             Substitute.AddExchange(StaticMark.adres_abonent, Helpers.LogicHelper.AdresLogic.FirstModel(Details.AdresPostID).Adr.CutAdres(full), 0);
         }
         else
         {
             CP.Elems.SetRowFromGrid(MyTools.GL_Auto);
             WrapPanel wp = new WrapPanel();
             wp.Orientation = Orientation.Vertical;
             if (Details.AdresLegalID > 0)
             {
                 RadioButton AdresLegal = new RadioButton();
                 AdresLegal.Content  = Helpers.LogicHelper.AdresLogic.FirstModel(Details.AdresLegalID).Adr;
                 AdresLegal.Checked += (sender, e) => { Storege = AdresLegal.Content.ToString(); };
                 wp.Children.Add(AdresLegal);
             }
             RadioButton AdresObj = new RadioButton();
             AdresObj.Content  = objecte.Adres;
             AdresObj.Checked += (sender, e) => { Storege = objecte.Adres; };
             wp.Children.Add(AdresObj);
             CP.Elems.SetFromGrid(wp);
             CP.ShowDialog();
         }
         if (!PostAdres)
         {
             Substitute.AddExchange(StaticMark.adres_abonent, Storege.CutAdres(full), 0);
         }
     }
 }
Ejemplo n.º 2
0
        protected override void internalStart()
        {
            {
                CP = new Control_Print();
                CP.Elems.SetRowFromGrid(MyTools.GL_Auto);
                var DateSelect = new DateSelector(_negotiationAssistant.YMD);
                CP.Elems.SetFromGrid(DateSelect.View);
                CP.ShowDialog();

                if (_negotiationAssistant.WorkerID == 0)
                {
                    MessageBox.Show("Не выбран пробоотборщик!");
                    return;
                }

                _negotiationAssistant.YMD = MyTools.YMD_From_DateTime(DateSelect.dateTime);
            }

            Objecte  obj     = _negotiationAssistant.Objecte;
            Accredit acc     = AdditionnTable.GetAccredit();
            string   sampler = _negotiationAssistant.Worker.Post_FIO;

            foreach (var one in obj.Wells)
            {
                book       = TemplateStorage.WorkBook;
                Substitute = new CellExchange_Class(book.GetSheetAt(0));
                var Details = obj.Client.Detail;
                Substitute.AddExchange("{абонент}", Details.FullName, 0);
                if (obj.Separate)
                {
                    Substitute.AddExchange("{юридический адрес}", obj.Detail.LegalAdres, 0);
                }
                else
                {
                    Substitute.AddExchange("{юридический адрес}", Helpers.LogicHelper.AdresLogic.FirstModel(Details.AdresLegalID).Adr, 0);
                }
                Substitute.AddExchange("{тип колодца}", new TypeWell(one.TypeWellID).FullName + " " + new TypeWell(one.TypeWellID).CurtName + '-' + one.Number, 0);
                Substitute.AddExchange("{место отбора}", obj.Adres.CutAdres(false), 0);
                Substitute.AddExchange("{аккредитация}", acc.Text, 0);
                Substitute.AddExchange("{дата аккредитации}", acc.YMDFrom, 0);
                Substitute.AddExchange("{пробоотборщик}", sampler, 0);
                //Substitute.AddExchange("{представитель абонента}", sample == null ? string.empty : sample.IDRepresentative > 0 ? new Representative(sample.IDRepresentative).Post_FIO : string.empty, 0);
                Substitute.Exchange();
                Print("Акты", "акт отбора пробы " + new TypeWell(one.TypeWellID).FullName + ' ' + one.Number, EPathPrint.Documents);
            }
        }
Ejemplo n.º 3
0
        protected override void internalStart()
        {
            Objecte obj = _negotiationAssistant.Objecte;

            book = TemplateStorage.WorkBook;

            Substitute = new CellExchange_Class(book.GetSheetAt(0));
            ClientName(_negotiationAssistant.Objecte.Client);
            NumberFolder(obj.NumberFolder);

            #region Подписывающий
            var works = AdditionnTable.GetSigner(data.ETypeTemplate.LetterNotification, "Письмо");
            Substitute.AddExchange("{должность}", works.Post, 0);
            Substitute.AddExchange("{ФИО}", works.FIO, 0);
            #endregion

            #region адрес/дата
            ObjectAdres(obj, true);
            CP = new Control_Print();
            CP.Elems.SetRowFromGrid(MyTools.GL_Auto);
            var DateSelect = new DateSelector(_negotiationAssistant.YMD);
            CP.Elems.SetFromGrid(DateSelect.View);
            CP.ShowDialog();

            if (DateSelect.dateTime == null)
            {
                return;
            }

            _negotiationAssistant.YMD = MyTools.YMD_From_DateTime(DateSelect.dateTime);
            Substitute.AddExchange("{дата отбора}", MyTools.YearMonthDay_From_YMD(DateSelect.dateTime), 0);
            #endregion

            Substitute.AddExchange("{адрес отбора}", obj.Adres, 0);
            Substitute.Exchange();
            Print("Письма", "Письмо", EPathPrint.Documents);
        }
Ejemplo n.º 4
0
        private bool StartMenu()
        {
            CP = new Control_Print();
            CP.Elems.SetColumnsFromGrid(2, MyTools.GL_Auto);

            CP.Elems.SetRowFromGrid(MyTools.GL_Auto);
            CP.Elems.SetFromGrid(new TextBlock {
                Text = "Объект:"
            }, Column: 0);
            TextBlock tbObj = new TextBlock {
                Text = this._selectionWell.Objecte.Client.Detail.FullName
            };

            //tbObj.MouseLeftButtonDown += (sender, e) =>
            //  {
            //      SearchGrid_Window sg = new SearchGrid_Window(G.Objecte )
            //  };
            CP.Elems.SetFromGrid(tbObj);


            CP.Elems.SetRowFromGrid(MyTools.GL_Auto);
            DateSelector DateSelect = new DateSelector((int)MyTools.GetNowDate(MyTools.EInputDate.YMD) - 365, "Период отсчёта");

            CP.Elems.SetFromGrid(DateSelect.View, Column: 0, ColumnSpan: 2);

            CP.Elems.SetRowFromGrid(MyTools.GL_Auto);
            CP.Elems.SetFromGrid(new TextBlock {
                Text = "Колличество месяцев для выгрузки"
            }, Column: 0);
            ComboBox cbMonths = new ComboBox();

            for (int i = 1; i < 13; i++)
            {
                cbMonths.Items.Add(i);
            }
            cbMonths.SelectedIndex = cbMonths.Items.Count - 1;
            CP.Elems.SetFromGrid(cbMonths);

            CP.Elems.SetRowFromGrid(MyTools.GL_Auto);
            CheckBox cbSumm = new CheckBox
            {
                IsChecked = true,
                Content   = "Выводить сумму"
            };

            CP.Elems.SetFromGrid(cbSumm, Column: 0, ColumnSpan: 2);

            CP.Elems.SetRowFromGrid(MyTools.GL_Auto);
            CheckBox cbNorms = new CheckBox
            {
                IsChecked = true,
                Content   = "Выводить нормативы"
            };

            CP.Elems.SetFromGrid(cbNorms, Column: 0, ColumnSpan: 2);

            CP.ShowDialog();
            StartYM    = DateSelect.dateTime.Year * 12 + DateSelect.dateTime.Month;
            MonthCount = cbMonths.SelectedIndex + 1;
            ShowCalcs  = (bool)cbSumm.IsChecked;
            ShowNorms  = (bool)cbNorms.IsChecked;
            if (MonthCount > 6)
            {
                book.RemoveSheetAt(book.GetSheetIndex("Результат вертикальный"));
                sheet = book.GetSheet("Результат горизонтальный");
            }
            else
            {
                book.RemoveSheetAt(book.GetSheetIndex("Результат горизонтальный"));
                sheet = book.GetSheet("Результат вертикальный");
            }

            return(sheet != null);
        }