Example #1
0
        public override DataSet Clone()
        {
            dsReportSource cln = ((dsReportSource)(base.Clone()));

            cln.InitVars();
            return(cln);
        }
Example #2
0
        /// <summary>
        /// Заполняет набор данных для формирования "ежедневного" и "итогового" отчётов
        /// </summary>
        /// <returns>Набор данных</returns>
        private dsReportSource fillReportSource()
        {
            dsReportSource sqlDS = null;

            try
            {
                OleDbDataAdapter sqlDA = new OleDbDataAdapter("SELECT * FROM vwReportSource", conStr);
                sqlDA.SelectCommand.CommandTimeout = 120;

                sqlDS = new dsReportSource();
                sqlDA.Fill(sqlDS, "vwReportSource");
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
            }

            return(sqlDS);
        }
Example #3
0
        /// <summary>
        /// Иницирует к открытию "ежедневный" либо "итоговый" отчёты
        /// </summary>
        private void btnGo_Click(object sender, System.EventArgs e)
        {
            string   midlist = "", s = "";
            DateTime d1, d2;

            if ((cbAll.Checked == false) && (clbEmpl.CheckedItems.Count == 0))
            {
                MessageBox.Show("Не выбраны сотрудники для формирования отчёта! ", "Предупреждение", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
                return;
            }

            d1 = Convert.ToDateTime(dtpDate1.Text + " " + dtpTime1.Text);
            d2 = Convert.ToDateTime(dtpDate2.Text + " " + dtpTime2.Text);
            if (d2 <= d1)
            {
                MessageBox.Show("Некорректно задан временной диапазон! ", "Сообщение", MessageBoxButtons.OK);
                return;
            }

            lbWait.Show();
            Cursor = Cursors.WaitCursor;
            //список идентификаторов сотрудников
            if ((cbAll.Checked == false) && (clbEmpl.CheckedItems.Count != 0))        //список идентификаторов сотрудников, которые отображаются в отчёте
            {
                for (int i = 0; i < clbEmpl.CheckedItems.Count; i++)
                {
                    s       = clbEmpl.CheckedItems[i].ToString();
                    s       = s.Substring(s.IndexOf('['));
                    midlist = midlist + s;
                }
            }
            //формирование таблицы для отчёта
            if (formReportTable(midlist, d1, d2))
            {
                //выбираем отчёт для формирования
                dsReportSource ds = null;
                ReportClass    cr = null;

                try
                {
                    if (rbDayly.Checked)
                    {
                        cr = new crDayReport();
                    }
                    else
                    {
                        cr = new crTotalReport();
                    }
                    ds = fillReportSource();
                    cr.SetDataSource(ds);
                    string report_dur = "за период с " + Convert.ToString(d1) + " по " + Convert.ToString(d2);
                    cr.SetParameterValue("report_dur", report_dur);

                    fmRep codeRep = new fmRep(cr);
                    Cursor = Cursors.Default;
                    lbWait.Hide();

                    codeRep.ShowDialog();
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Не удалось создать отчёт! " + ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
                }
            }
            else
            {
                MessageBox.Show("Не удалось создать таблицу для отчёта! ", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
            }
            Cursor = Cursors.Default;
            lbWait.Hide();
        }