Exemple #1
0
        private void Search_Click(object sender, EventArgs e)
        {
            splashScreenManager5.ShowWaitForm();
            if (dateEdit.DateTime.Date > dateEdit1.DateTime.Date)
            {
                MessageBox.Show("Ngày bắt đầu không được nhỏ hơn ngày kết thúc", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                if (string.Compare(dateEdit.DateTime.ToString("MM"), dateEdit1.DateTime.ToString("MM")) != 0)
                {
                    MessageBox.Show("Ngày bắt đầu và ngày kết thúc phải trong cùng một tháng", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    string maCa;
                    if (lkShift.EditValue == null)
                    {
                        maCa = "0";
                    }
                    else
                    {
                        maCa = lkShift.EditValue.ToString();
                    }
                    // Add a title to the chart (if necessary).
                    chartControl1.Titles.Clear();
                    chartTitle1.Text = "BIỂU ĐỒ NHÂN SỰ\n(" + dateEdit.DateTime.ToString("dd/MM/yyyy") + " - " + dateEdit1.DateTime.ToString("dd/MM/yyyy") + ")";
                    chartTitle1.Font = new Font("Times New Roman", 15, FontStyle.Bold);
                    chartControl1.Titles.Add(chartTitle1);

                    // Add a title to the chart (if necessary).
                    chartControl2.Titles.Clear();
                    chartTitle2.Text = "BIỂU ĐỒ TỈ LỆ NGƯỜI VẮNG\n(" + dateEdit.DateTime.ToString("dd/MM/yyyy") + " - " + dateEdit1.DateTime.ToString("dd/MM/yyyy") + ")";
                    chartTitle2.Font = new Font("Times New Roman", 15, FontStyle.Bold);
                    chartControl2.Titles.Add(chartTitle2);

                    dtChart1 = BUS_ChamCong.ChartDiemDanh(dateEdit.DateTime.ToString("yyyy-MM-dd"), dateEdit1.DateTime.ToString("yyyy-MM-dd"), lkBoPhan.EditValue.ToString(), maCa);
                    dtChart2 = Utility.CopyChart(dtChart1, dateEdit.DateTime.ToString("dd"), dateEdit1.DateTime.ToString("dd"));
                    CreateChart(dtChart1, dtChart2);
                }
            }
            splashScreenManager5.CloseWaitForm();
        }
Exemple #2
0
        public frmAttReport(string ad_user_id, string ad_org_id, DataTable dtProcess)
        {
            InitializeComponent();
            dateEdit.DateTime  = DateTime.Now;
            dateEdit1.DateTime = DateTime.Now;
            this.ad_user_id    = ad_user_id;
            this.ad_org_id     = ad_org_id;
            this.dtProcess     = dtProcess;
            dtCa     = BUS_Ca.LoadCaShift(DateTime.Now.Date, ad_org_id);
            dtboPhan = BUS_BoPhan.LoadBoPhan(ad_org_id);
            utility.SearchProcess(this.Controls, dtProcess);

            #region Chart control 1
            // Create an empty Bar series and add it to the chart.
            chartControl1.Series.Add(series1);
            series1.View.Color = Color.Green;

            chartControl1.Series.Add(series2);
            series2.View.Color = Color.DarkGoldenrod;

            chartControl1.Series.Add(series3);
            series3.View.Color = Color.Red;

            chartControl1.Series.Add(series4);
            series4.View.Color = Color.Red;

            //Show point view lable and customize it
            chartControl1.Series["Tổng số người"].LabelsVisibility = DevExpress.Utils.DefaultBoolean.True;
            SideBySideBarSeriesLabel label1 = chartControl1.Series["Tổng số người"].Label as SideBySideBarSeriesLabel;
            if (label1 != null)
            {
                label1.Position = BarSeriesLabelPosition.Top;
            }

            chartControl1.Series["Số người vắng"].LabelsVisibility = DevExpress.Utils.DefaultBoolean.True;
            SideBySideBarSeriesLabel label2 = chartControl1.Series["Số người vắng"].Label as SideBySideBarSeriesLabel;
            if (label2 != null)
            {
                label2.Position = BarSeriesLabelPosition.Top;
            }

            chartControl1.Series["Số người nghỉ việc"].LabelsVisibility = DevExpress.Utils.DefaultBoolean.True;
            SideBySideBarSeriesLabel label3 = chartControl1.Series["Số người nghỉ việc"].Label as SideBySideBarSeriesLabel;
            if (label3 != null)
            {
                label3.Position = BarSeriesLabelPosition.Top;
            }

            chartControl1.Series["Tỉ lệ người vắng(%)"].LabelsVisibility = DevExpress.Utils.DefaultBoolean.True;
            SideBySideBarSeriesLabel label4 = chartControl1.Series["Tỉ lệ người vắng(%)"].Label as SideBySideBarSeriesLabel;
            if (label4 != null)
            {
                label4.Position = BarSeriesLabelPosition.Top;
            }

            // Cast Diagram to the XYDiagram type.
            XYDiagram diagram = chartControl1.Diagram as XYDiagram;
            diagram.AxisY.Title.Visibility = DevExpress.Utils.DefaultBoolean.True;
            diagram.AxisY.Title.Text       = "Số lượng người";
            diagram.AxisY.Title.Font       = new Font("Times New Roman", 10, FontStyle.Regular);

            // Add a title to the chart (if necessary).
            chartTitle1.Text = "BIỂU ĐỒ NHÂN SỰ\n(" + "01" + DateTime.Now.ToString("/MM/yyyy") + " - " + DateTime.Now.ToString("dd/MM/yyyy") + ")";
            chartTitle1.Font = new Font("Times New Roman", 15, FontStyle.Bold);
            chartControl1.Titles.Add(chartTitle1);

            // Control legend & position
            chartControl1.Legend.Visibility          = DevExpress.Utils.DefaultBoolean.True;
            chartControl1.Legend.AlignmentHorizontal = LegendAlignmentHorizontal.Center;
            chartControl1.Legend.AlignmentVertical   = LegendAlignmentVertical.BottomOutside;
            chartControl1.Legend.Direction           = LegendDirection.LeftToRight;
            chartControl1.Legend.EquallySpacedItems  = true;

            //Create secondary Y-Axis, and add them to the chart's diagram
            SecondaryAxisY myAxisY2 = new SecondaryAxisY("Y-Axis2");
            ((XYDiagram)chartControl1.Diagram).SecondaryAxesY.Add(myAxisY2);

            //Assign series4 to the created axis
            ((LineSeriesView)series4.View).AxisY = myAxisY2;

            //Customize the apperance of the secondary axis
            myAxisY2.Title.Text       = "Tỉ lệ người vắng(%)";
            myAxisY2.Title.Visibility = DevExpress.Utils.DefaultBoolean.True;
            myAxisY2.Title.TextColor  = Color.Red;
            myAxisY2.Title.Font       = new Font("Times New Roman", 10, FontStyle.Regular);
            myAxisY2.Label.TextColor  = Color.Red;
            myAxisY2.Color            = Color.Red;
            #endregion

            #region Chart control 2
            // Add a title to the chart (if necessary).
            chartControl2.Titles.Clear();
            chartTitle2.Text = "BIỂU ĐỒ TỈ LỆ NGƯỜI VẮNG\n(" + "01" + DateTime.Now.ToString("/MM/yyyy") + " - " + DateTime.Now.ToString("dd/MM/yyyy") + ")";
            chartTitle2.Font = new Font("Times New Roman", 15, FontStyle.Bold);
            chartControl2.Titles.Add(chartTitle2);


            #endregion
            dtChart1 = BUS_ChamCong.ChartDiemDanh(DateTime.Now.ToString("yyyy-MM-") + "01", DateTime.Now.ToString("yyyy-MM-dd"), ad_org_id, "0");
            dtChart2 = Utility.CopyChart(dtChart1, "01", DateTime.Now.ToString("dd"));
            CreateChart(dtChart1, dtChart2);
        }