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;
            }
        }
        private void Btn_ExportExcel_Click(object sender, EventArgs e)
        {
            System.Windows.Forms.SaveFileDialog saveFileDialog = new SaveFileDialog();
            string pathsave = "";

            saveFileDialog.Title      = "Browse Excel Files";
            saveFileDialog.DefaultExt = "Excel";
            saveFileDialog.Filter     = "Excel files (*.xlsx)|*.xlsx";

            saveFileDialog.CheckPathExists = true;

            if (saveFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                GetAttendanceHR       getAttendance   = new GetAttendanceHR();
                List <AttendanceDept> attendanceDepts = getAttendance.GetAttendanceDeptsNew(dtpk_choose.Value);
                HRReport hRReport = new HRReport();
                pathsave = saveFileDialog.FileName;

                saveFileDialog.RestoreDirectory = true;

                hRReport.ExportExcelHRAttendaceReport(pathsave, attendanceDepts, dtpk_choose.Value);
                var resultMessage = MessageBox.Show("Attendance Daily Report export to excel sucessful ! \n\r Do you want to open this file ?", "Information", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                if (resultMessage == DialogResult.Yes)
                {
                    FileInfo fi = new FileInfo(pathsave);
                    if (fi.Exists)
                    {
                        System.Diagnostics.Process.Start(pathsave);
                    }
                    else
                    {
                        MessageBox.Show("File doestn't exist !", "warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
            }
        }