private void btn_stop_Click(object sender, EventArgs e)
        {
            if (hRReport == HRReportStatus.pause)
            {
                //pic_loader.Visible = true;
                //pic_loader.Image = global::WindowsFormsApplication1.Properties.Resources.loader;

                //pic_loader.Visible = false;

                tmrCallBgWorker.Start();
                hRReport = HRReportStatus.start;
                btn_HRReport.BackColor = Color.Green;
            }
            else if (hRReport == HRReportStatus.start)
            {
                tmrCallBgWorker.Stop();
                hRReport = HRReportStatus.stop;
                btn_HRReport.BackColor = Color.Red;
            }
            else if (hRReport == HRReportStatus.stop)
            {
                tmrCallBgWorker.Start();
                hRReport = HRReportStatus.start;
                btn_HRReport.BackColor = Color.Green;
            }
        }
        public HRAttendaceReport()
        {
            InitializeComponent();

            lbl_Header.Text = "Tech-Link manpower daily report on " + DateTime.Now.ToString("dd-MM-yyyy");
            //  Screen[] screens = Screen.AllScreens;

            var scrProgram = Screen.FromControl(this);

            if (scrProgram.Primary)
            {
                // StartPosition was set to FormStartPosition.Manual in the properties window.
                Rectangle screen = Screen.PrimaryScreen.WorkingArea;
                int       w      = Width >= screen.Width ? screen.Width : (screen.Width + Width) / 2;
                int       h      = Height >= screen.Height ? screen.Height : (screen.Height + Height) / 2;
                // this.Location = new Point((screen.Width - w) / 2, (screen.Height - h) / 2);
                this.Location = new Point(0, 0);
                this.Size     = new Size(w, h);
            }
            else
            {
                Rectangle screen = scrProgram.WorkingArea;
                int       w      = Width >= screen.Width ? screen.Width : (screen.Width + Width) / 2;
                int       h      = Height >= screen.Height ? screen.Height : (screen.Height + Height) / 2;
                // this.Location = new Point((screen.Width - w) / 2, (screen.Height - h) / 2);
                this.Location = new Point(0, 0);
                this.Size     = new Size(w, h);
            }

            //    this.tableLayoutPanel1.Size = new Size(w - 10, h - 10);

            bgWorker = new BackgroundWorker();

            // work happens in this method


            bgWorker.RunWorkerCompleted   += new RunWorkerCompletedEventHandler(bg_RunWorkerCompleted);
            bgWorker.WorkerReportsProgress = true;
            //timer_update.Start();
            // this timer calls bgWorker again and again after regular intervals
            tmrCallBgWorker       = new System.Windows.Forms.Timer();//Timer for do task
            tmrCallBgWorker.Tick += new EventHandler(tmrCallBgWorker_Tick);
            hRReport              = HRReportStatus.pause;
        }
        private void Button1_Click(object sender, EventArgs e)
        {
            System.Windows.Input.Cursor oldCursor = Mouse.OverrideCursor;
            try
            {
                Mouse.OverrideCursor     = System.Windows.Input.Cursors.Wait;
                tmrCallBgWorker.Interval = 30000;
                GetAttendanceHR getAttendance = new GetAttendanceHR();
                attendanceDepts = getAttendance.GetAttendanceDeptsNew(dtpk_choose.Value);
                DisplayLabelCompany();
                ListAttendance = attendanceDepts.GroupBy(u => u.BigDeptCode)
                                 .Select(grp => grp.ToList())
                                 .ToList();
                ResourceDept1        = new HumanResourceDept(ListAttendance[0]);
                ResourceDept2        = new HumanResourceDept(ListAttendance[1]);
                ResourceDept1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                                                                              | System.Windows.Forms.AnchorStyles.Left)
                                                                             | System.Windows.Forms.AnchorStyles.Right)));
                ResourceDept2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                                                                              | System.Windows.Forms.AnchorStyles.Left)
                                                                             | System.Windows.Forms.AnchorStyles.Right)));
                IntializeforTableLayout(ListAttendance, CurrentStart);
                //pic_loader.Visible = false;

                tmrCallBgWorker.Start();
                hRReport = HRReportStatus.start;
                btn_HRReport.BackColor = Color.Green;
            }
            catch (Exception ex)
            {
                SystemLog.Output(SystemLog.MSG_TYPE.Err, "", ex.Message);
            }
            finally
            {
                Mouse.OverrideCursor = oldCursor;
            }
        }