Пример #1
0
        public void SetData(HRM_TIMEKEEPER item)
        {
            //   SYS_LOG.Insert("Giờ Làm Việc", "Xem", item.ShiftCode.ToString());
            this.m_TimeKeeperTableListID = item.TimeKeeperTableListID;
            this.m_EmployeeCode          = item.EmployeeCode;
            HRM_EMPLOYEE hRMEMPLOYEE = new HRM_EMPLOYEE();

            hRMEMPLOYEE.Get(this.m_EmployeeCode);
            GroupControl groupControl = this.groupControl1;

            string[] firstName = new string[] { "Thông Tin Ra/Vào - ", hRMEMPLOYEE.FirstName, " ", hRMEMPLOYEE.LastName, " (", hRMEMPLOYEE.EmployeeCode, ") - ", item.Symbol };
            groupControl.Text = string.Concat(firstName);
            this.m_ShiftCode  = item.ShiftCode;
            this.m_Date       = item.Date;
            this.m_Symbol     = item.Symbol;
            DIC_SHIFT dICSHIFT = new DIC_SHIFT();

            dICSHIFT.Get(this.m_ShiftCode);
            this.txtShift.Text            = dICSHIFT.ShiftName;
            this.dtDate.DateTime          = item.Date;
            this.txtSymbol.Text           = item.Symbol;
            this.m_IsFirstLoad            = true;
            this.teTimeIn.EditValue       = item.TimeIn;
            this.m_IsFirstLoad            = true;
            this.teTimeOut.EditValue      = item.TimeOut;
            this.calHour.EditValue        = item.Hour;
            this.calDayHour.EditValue     = item.DayHour;
            this.calNightHour.EditValue   = item.NightHour;
            this.calLateMinute.EditValue  = item.LateMinute;
            this.calEarlyMinute.EditValue = item.EarlyMinute;
            this.m_IsOverTime             = item.IsOverTime;
            this.m_IsWork            = item.IsWork;
            this.m_Sorted            = item.Sorted;
            this.txtDescription.Text = item.Description;
            HRM_TIMEKEEPER_BREAK hRMTIMEKEEPERBREAK = new HRM_TIMEKEEPER_BREAK();
            double num = hRMTIMEKEEPERBREAK.TotalBreakHour(this.m_TimeKeeperTableListID, this.m_EmployeeCode, this.m_ShiftCode, this.m_Date);

            this.bbiTimekeepingBreak.Text = string.Concat("(", num.ToString(), "h)");
            if (num <= 0)
            {
                this.bbiTimekeepingBreak.ButtonStyle = BorderStyles.Simple;
            }
            else
            {
                this.bbiTimekeepingBreak.ButtonStyle = BorderStyles.Office2003;
                HRM_TIMEKEEPER_EXTRA hRMTIMEKEEPEREXTRA = new HRM_TIMEKEEPER_EXTRA();
                double num1 = hRMTIMEKEEPEREXTRA.TotalExtraHour(this.m_TimeKeeperTableListID, this.m_EmployeeCode, this.m_ShiftCode, this.m_Date);
                this.bbiTimekeepingExtra.Text = string.Concat("(", num1.ToString(), "h)");
                if (num1 <= 0)
                {
                    this.bbiTimekeepingExtra.ButtonStyle = BorderStyles.Simple;
                }
                else
                {
                    this.bbiTimekeepingExtra.ButtonStyle = BorderStyles.Office2003;
                }
                HRM_TIMEKEEPER_PRIVATE hRMTIMEKEEPERPRIVATE = new HRM_TIMEKEEPER_PRIVATE();
                double num2 = hRMTIMEKEEPERPRIVATE.TotalPrivateHour(this.m_TimeKeeperTableListID, this.m_EmployeeCode, this.m_ShiftCode, this.m_Date);
                this.bbiTimekeepingPrivate.Text = string.Concat("(", num2.ToString(), "h)");
                if (num2 <= 0)
                {
                    this.bbiTimekeepingPrivate.ButtonStyle = BorderStyles.Simple;
                }
                else
                {
                    this.bbiTimekeepingPrivate.ButtonStyle = BorderStyles.Office2003;
                }
            }
        }
Пример #2
0
 private void gbList_CellValueChanged(object sender, CellValueChangedEventArgs e)
 {
     if (e.Column != this.colTotalHour)
     {
         this.m_EmployeeCode = this.gbList.GetFocusedRowCellValue(this.colEmployeeCode).ToString();
         this.m_ShiftCode    = this.gbList.GetFocusedRowCellValue(this.colShiftCode).ToString();
         if (this.m_IsEditValueChanged)
         {
             try
             {
                 this.m_Hour = Convert.ToDouble(e.Value.ToString());
             }
             catch
             {
                 this.m_Hour = 0;
                 this.gbList.SetFocusedValue(0);
             }
             if (this.m_Hour > 24)
             {
                 XtraMessageBox.Show("Dữ liệu bạn nhập vào quá lớn!");
                 this.m_Hour = 0;
                 this.gbList.SetFocusedValue(0);
             }
             if (this.m_Hour < 0)
             {
                 this.m_Hour = 0;
                 this.gbList.SetFocusedValue(0);
             }
             this.m_Symbol = "+";
             this.m_IsWork = HRM_TIMEKEEPER_SHIFT.IsWork(this.m_TimeKeeperTableListID, this.m_EmployeeCode, this.m_ShiftCode, this.m_Date.Day);
             double    mHour    = this.m_Hour * 60;
             int       num      = int.Parse(mHour.ToString());
             DIC_SHIFT dICSHIFT = new DIC_SHIFT();
             dICSHIFT.Get(this.m_ShiftCode);
             int      year      = this.m_Date.Year;
             int      month     = this.m_Date.Month;
             int      day       = this.m_Date.Day;
             int      hour      = dICSHIFT.BeginTime.Hour;
             int      minute    = dICSHIFT.BeginTime.Minute;
             DateTime beginTime = dICSHIFT.BeginTime;
             DateTime dateTime  = new DateTime(year, month, day, hour, minute, beginTime.Second);
             int      year1     = this.m_Date.Year;
             int      month1    = this.m_Date.Month;
             int      day1      = this.m_Date.Day;
             int      hour1     = dICSHIFT.EndTime.Hour;
             int      minute1   = dICSHIFT.EndTime.Minute;
             beginTime = dICSHIFT.EndTime;
             DateTime dateTime1 = new DateTime(year1, month1, day1, hour1, minute1, beginTime.Second);
             this.m_TimeIn = dateTime;
             HRM_TIMEKEEPER_BREAK hRMTIMEKEEPERBREAK = new HRM_TIMEKEEPER_BREAK();
             double num1 = hRMTIMEKEEPERBREAK.TotalBreakHour(this.m_TimeKeeperTableListID, this.m_EmployeeCode, this.m_ShiftCode, this.m_Date);
             mHour          = num1 * 60;
             this.m_TimeOut = MyDateTime.AddMinute(this.m_TimeIn, num + int.Parse(mHour.ToString()));
             HRM_TIMEKEEPER hRMTIMEKEEPER = new HRM_TIMEKEEPER();
             hRMTIMEKEEPER.Get(this.m_TimeKeeperTableListID, this.m_EmployeeCode, this.m_ShiftCode, this.m_Symbol, this.m_Date, this.m_TimeIn, this.m_TimeOut);
             this.m_TimeIn      = hRMTIMEKEEPER.TimeIn;
             this.m_TimeOut     = hRMTIMEKEEPER.TimeOut;
             this.m_Hour        = hRMTIMEKEEPER.Hour;
             this.m_DayHour     = hRMTIMEKEEPER.DayHour;
             this.m_NightHour   = hRMTIMEKEEPER.NightHour;
             this.m_LateMinute  = hRMTIMEKEEPER.LateMinute;
             this.m_EarlyMinute = hRMTIMEKEEPER.EarlyMinute;
             DataRowCollection rows = this.dt_Timekeeper.Rows;
             object[]          mTimeKeeperTableListID = new object[] { this.m_TimeKeeperTableListID, this.m_EmployeeCode, this.m_ShiftCode, this.m_Date, this.m_Symbol, this.m_TimeIn, this.m_TimeOut, this.m_Hour, this.m_DayHour, this.m_NightHour, 0, this.m_LateMinute, this.m_EarlyMinute, this.m_IsOvertime, this.m_IsWork, 0, "" };
             rows.Add(mTimeKeeperTableListID);
             this.SaveData();
             if (this.m_IsSetRowCellValue)
             {
                 this.SetRowCellValue(e.RowHandle, this.m_EmployeeCode);
             }
             else
             {
                 this.m_IsSetRowCellValue = true;
             }
         }
         else
         {
             this.m_IsEditValueChanged = true;
             this.SetRowCellValue(e.RowHandle, this.m_EmployeeCode);
         }
     }
 }