示例#1
0
        private void BindOBDetails(string pObCode)
        {
            using (OfficialBusiness ob = new OfficialBusiness(pObCode))
            {
                ob.Fill();
                lblOBCode.Text       = pObCode;
                lblOBType.Text       = OfficialBusiness.GetOBTypeDesc(ob.OBType);
                lblOBDepartment.Text = Department.GetName(ob.DepartmentCode);
                lblOBRequestor.Text  = Employee.GetName(ob.UserName);
                lblOBDateFile.Text   = ob.DateFile.ToString("MMM dd, yyyy hh:mm tt");
                lblOBReason.Text     = ob.Reason;
                lblOBRApprover.Text  = (ob.OBType == "1" ? Employee.GetName(ob.RAName) : "NA");
                lblOBRDate.Text      = (ob.OBType == "1" ? ob.RADate.ToString("MM-dd-yyyy") : "NA");
                lblOBRRemarks.Text   = (ob.OBType == "1" ? ob.RARemarks : "NA");
                lblOBHApprover.Text  = Employee.GetName(ob.HAName);
                lblOBHDate.Text      = ob.HADate.ToString("MM-dd-yyyy");
                lblOBHRemarks.Text   = ob.HARemarks;
                lblOBStatus.Text     = LeaveApplication.ToLeaveStatusDesc(ob.Status);
            }

            lvOBDetails.Items.Clear();
            DataTable tblOBDetails = OfficialBusinessDetails.DataTableByOBCode(pObCode);

            foreach (DataRow drw in tblOBDetails.Rows)
            {
                ListViewItem lvi = new ListViewItem();
                lvi.Text = clsValidator.CheckDate(drw["focsdate"].ToString()).ToString("MMM dd, yyyy");
                lvi.SubItems.Add(clsValidator.CheckDate(drw["keyin"].ToString()).ToString("MMM dd, yyyy hh:mm tt"));
                lvi.SubItems.Add(clsValidator.CheckDate(drw["keyout"].ToString()).ToString("MMM dd, yyyy hh:mm tt"));

                lvOBDetails.Items.Add(lvi);
            }
        }
示例#2
0
 private void frmOBEdit_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (OfficialBusinessDetails.CountSchedule(_strOBCode) == 0)
     {
         MessageBox.Show("There is no OB schedule specified.", clsMessageBox.MessageBoxText, MessageBoxButtons.OK, MessageBoxIcon.Error);
         e.Cancel = true;
     }
     if (!e.Cancel && _FormCallers == FormCallers.OBNew)
     {
         _frmOBList.BindOBList();
     }
 }
示例#3
0
 private void btnDelete_Click(object sender, EventArgs e)
 {
     if (lvOBDetails.Items.Count > 0)
     {
         if (MessageBox.Show(clsMessageBox.MessageBoxDeleteAsk, clsMessageBox.MessageBoxText, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
         {
             OfficialBusinessDetails obd = new OfficialBusinessDetails();
             obd.OBCode    = _strOBCode;
             obd.FocusDate = clsValidator.CheckDate(lvOBDetails.SelectedItems[0].Tag.ToString());
             obd.Delete();
             LoadOBDetails();
         }
     }
 }
示例#4
0
 private void BindDetails()
 {
     txtOBCode.Text     = _strOBCode;
     dtpFocusDate.Value = _dteFocusDate;
     using (OfficialBusinessDetails obdetails = new OfficialBusinessDetails())
     {
         obdetails.OBCode    = _strOBCode;
         obdetails.FocusDate = _dteFocusDate;
         obdetails.Fill();
         dtpInDate.Value  = obdetails.KeyIn;
         dtpInTime.Value  = obdetails.KeyIn;
         dtpOutDate.Value = obdetails.KeyOut;
         dtpOutTime.Value = obdetails.KeyOut;
         txtUpdateBy.Text = obdetails.UpdateBy;
         txtUpdateOn.Text = obdetails.UpdateOn.ToString("MMM dd, yyyy");
     }
 }
示例#5
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (IsCorrectData())
     {
         using (OfficialBusinessDetails obdetails = new OfficialBusinessDetails())
         {
             obdetails.OBCode    = _strOBCode;
             obdetails.FocusDate = dtpFocusDate.Value;
             obdetails.KeyIn     = clsDateTime.CombineDateTime(dtpInDate.Value, dtpInTime.Value);
             obdetails.KeyOut    = clsDateTime.CombineDateTime(dtpOutDate.Value, dtpOutTime.Value);
             obdetails.UpdateBy  = HRMSCore.Username;
             obdetails.UpdateOn  = DateTime.Now;
             obdetails.Insert();
         }
         _frmOBEdit.LoadOBDetails();
         this.Close();
     }
 }
示例#6
0
        public void LoadOBDetails()
        {
            lvOBDetails.Items.Clear();
            DataTable tblOBDetails = OfficialBusinessDetails.DataTableByOBCode(_strOBCode);

            foreach (DataRow drw in tblOBDetails.Rows)
            {
                ListViewItem lvi = new ListViewItem();
                lvi.Text = clsValidator.CheckDate(drw["focsdate"].ToString()).ToString("MMM dd, yyyy");
                lvi.Tag  = drw["focsdate"].ToString();
                lvi.SubItems.Add(clsValidator.CheckDate(drw["keyin"].ToString()).ToString("MMM dd, yyyy hh:mm tt"));
                lvi.SubItems.Add(clsValidator.CheckDate(drw["keyout"].ToString()).ToString("MMM dd, yyyy hh:mm tt"));
                lvOBDetails.Items.Add(lvi);
            }

            if (lvOBDetails.Items.Count > 0)
            {
                lvOBDetails.Items[0].Selected = true;
            }
        }
示例#7
0
        private bool IsCorrectData()
        {
            bool   blnReturn       = true;
            string strErrorMessage = "";

            if (dtpOutDate.Value < dtpInDate.Value)
            {
                strErrorMessage = "Invalid date entries.";
            }

            if (OfficialBusinessDetails.HasExistingApplication(_strOBCode, clsDateTime.CombineDateTime(dtpInDate.Value, dtpInTime.Value), clsDateTime.CombineDateTime(dtpOutDate.Value, dtpOutTime.Value)))
            {
                strErrorMessage = "OB date already exist.";
            }

            if (strErrorMessage != "")
            {
                MessageBox.Show(clsMessageBox.MessageBoxValidationError + strErrorMessage, clsMessageBox.MessageBoxText, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                blnReturn = false;
            }

            return(blnReturn);
        }
示例#8
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            if (DateStart.Value >= DateEnd.Value)
            {
                MessageBox.Show("Invalid date.", "HRMS");
            }
            else
            {
                prog1.Visible = true;
                _dtEmployeeAttendance.Clear();
                _dateStart = clsDateTime.ChangeTimeToStart(DateStart.Value);
                _dateEnd   = clsDateTime.ChangeTimeToEnd(DateEnd.Value);

                //checking of employe without late, undertime, and leave
                foreach (DataRow dgRow in _dtEmployee.Rows)
                {
                    _intAbsentunit      = 0;
                    _intLateUnit        = 0;
                    _intLeaveWithoutPay = 0;
                    _intLeaveWithPay    = 0;
                    _intUndertime       = 0;
                    _intCDL             = 0;

                    _intAbsentunit      = clsPerfectAttendance.CountAbsentTotal(dgRow["username"].ToString(), _dateStart, _dateEnd);
                    _intLeaveWithPay    = clsPerfectAttendance.CountLeaveWithPayTotal(dgRow["username"].ToString(), _dateStart, _dateEnd);
                    _intLeaveWithoutPay = clsPerfectAttendance.CountLeaveWithoutPayTotal(dgRow["username"].ToString(), _dateStart, _dateEnd);
                    _intLateUnit        = clsPerfectAttendance.CountLateTotal(dgRow["username"].ToString(), _dateStart, _dateEnd);
                    _intUndertime       = clsPerfectAttendance.CountUndertimeTotal(dgRow["username"].ToString(), _dateStart, _dateEnd);
                    _intCDL             = clsPerfectAttendance.CountCDLTotal(dgRow["username"].ToString(), _dateStart, _dateEnd);


                    if (_intAbsentunit == 0 && _intLeaveWithoutPay == 0 && _intLateUnit == 0 && _intUndertime == 0 && _intLeaveWithPay == 0)
                    {
                        //MessageBox.Show(_intLeaveWithPay.ToString() + '=' + _intCDL.ToString());
                        DataRow drw = _dtEmployeeAttendance.NewRow();
                        drw["username"]   = dgRow["username"].ToString();
                        drw["lastname"]   = dgRow["lastname"].ToString();
                        drw["firstname"]  = dgRow["firstname"].ToString();
                        drw["middlename"] = dgRow["middlename"].ToString();
                        drw["nickname"]   = dgRow["nickname"].ToString();
                        drw["division"]   = dgRow["division"].ToString();
                        drw["pimage"]     = dgRow["pimage"].ToString();
                        _dtEmployeeAttendance.Rows.Add(drw);
                        _dtEmployeeAttendance.AcceptChanges();
                    }
                    try
                    {
                        prog1.Value = prog1.Value + 1;
                    }
                    catch
                    {
                        prog1.Value = 0;
                    }
                }

                _dtEmployeePerfectAttendance.Clear();
                _dtPerfectAttendanceDetails.Clear();
                int z = 1;


                // checking of OB employees
                foreach (DataRow drw in _dtEmployeeAttendance.Rows)
                {
                    int i = 0;
                    int j = 0;


                    _dtTimeSheet.Clear();
                    _dtOfficialBusiness.Clear();
                    _dtTimeSheet        = clsPerfectAttendance.DSTTimeSheet(drw["username"].ToString(), DateStart.Value, DateEnd.Value);
                    _dtOfficialBusiness = OfficialBusinessDetails.DSGEmployeeOBDetails(drw["username"].ToString(), DateStart.Value, DateEnd.Value);

                    foreach (DataRow dgtRow in _dtTimeSheet.Rows)
                    {
                        if (dgtRow["timestart"].ToString() == dgtRow["shiftin"].ToString() && clsValidator.CheckFloat(dgtRow["workunit"].ToString()) >= clsValidator.CheckFloat(dgtRow["tworkhrs"].ToString()) && dgtRow["pstatus"].ToString() == "W")
                        {
                            j = 1;
                        }
                        else if (clsDateTime.RemoveSeconds(clsDateTime.CombineDateTime(clsValidator.CheckDate(dgtRow["timestart"].ToString()), clsValidator.CheckDate(dgtRow["shiftin"].ToString()).AddMinutes(-clsValidator.CheckInteger(txtinterval.Text)))) < clsDateTime.RemoveSeconds(clsValidator.CheckDate(dgtRow["timestart"].ToString())) && dgtRow["pstatus"].ToString() == "W")
                        {
                            i = 1;
                        }
                    }


                    ///employees with perfect attendance
                    if (i == 0)
                    {
                        DataRow drwPA = _dtEmployeePerfectAttendance.NewRow();
                        drwPA["username"]       = drw["username"].ToString();
                        drwPA["lastname"]       = drw["lastname"].ToString();
                        drwPA["firstname"]      = drw["firstname"].ToString();
                        drwPA["middlename"]     = drw["middlename"].ToString();
                        drwPA["nickname"]       = drw["nickname"].ToString();
                        drwPA["division"]       = drw["division"].ToString();
                        drwPA["pimage"]         = drw["pimage"].ToString();
                        drwPA["daterangestart"] = clsDateTime.GetDateOnly(_dateStart);
                        drwPA["daterangeend"]   = clsDateTime.GetDateOnly(_dateEnd);
                        _dtEmployeePerfectAttendance.Rows.Add(drwPA);
                        _dtEmployeeAttendance.AcceptChanges();

                        //employees with perfect attendance with details
                        foreach (DataRow dgvPADetails in _dtTimeSheet.Rows)
                        {
                            if (dgvPADetails["pstatus"].ToString() == "W")
                            {
                                DataRow drwPADetails = _dtPerfectAttendanceDetails.NewRow();
                                drwPADetails["username"]   = dgvPADetails["username"].ToString();
                                drwPADetails["timestart"]  = dgvPADetails["timestart"].ToString();
                                drwPADetails["timeend"]    = dgvPADetails["timeend"].ToString();
                                drwPADetails["shiftin"]    = dgvPADetails["shiftin"].ToString();
                                drwPADetails["shiftout"]   = dgvPADetails["shiftout"].ToString();
                                drwPADetails["lastname"]   = dgvPADetails["lastname"].ToString();
                                drwPADetails["firstname"]  = dgvPADetails["firstname"].ToString();
                                drwPADetails["middlename"] = dgvPADetails["middlename"].ToString();
                                drwPADetails["counter"]    = z;
                                _dtPerfectAttendanceDetails.Rows.Add(drwPADetails);
                                _dtPerfectAttendanceDetails.AcceptChanges();
                            }
                        }

                        //employee with perfect attendace OB Details
                        if (j == 1)
                        {
                            foreach (DataRow dgob in _dtOfficialBusiness.Rows)
                            {
                                DataRow drob = _dtEmployeeOfficialBusiness.NewRow();
                                drob["employeename"] = dgob["employeename"].ToString();
                                drob["focsdate"]     = dgob["focsdate"].ToString();
                                drob["reason"]       = dgob["reason"].ToString();
                                _dtEmployeeOfficialBusiness.Rows.Add(drob);
                                _dtEmployeeOfficialBusiness.AcceptChanges();
                            }
                        }
                        z = z + 1;
                    }
                    try
                    {
                        prog1.Value = prog1.Value + 1;
                    }
                    catch
                    {
                    }
                }

                try
                {
                    bsPA.DataSource = _dtEmployeePerfectAttendance;
                    this.rptPerfectAttendance.RefreshReport();

                    bsPADetails.DataSource = _dtPerfectAttendanceDetails;
                    this.rptPADetails.RefreshReport();

                    bsPAOB.DataSource = _dtEmployeeOfficialBusiness;
                    this.rptPAOB.RefreshReport();

                    MessageBox.Show(_dtEmployeePerfectAttendance.Rows.Count.ToString() + " employee(s) found.", "HRMS");
                }
                catch
                {
                    this.rptPerfectAttendance.RefreshReport();
                    this.rptPADetails.RefreshReport();
                    this.rptPAOB.RefreshReport();
                }

                prog1.Visible = false;
            }
        }