Example #1
0
        private void TempEmpAtt_Load(object sender, EventArgs e)
        {
            this.WindowState = FormWindowState.Maximized;
            TempEmpAttQuery Frm = TempEmpAttQuery.GetInstance();

            Frm.TopLevel = false;
            Frm.Parent   = this;
            Frm.Show();
            Frm.BringToFront();
            Frm.Height = this.Height - 20;
        }
Example #2
0
        private void simpleButtonOK_Click(object sender, EventArgs e)
        {
            ConnDB  conn = new ConnDB();
            string  sql, month, cdate;
            bool    isok = false, closed = false;
            DataSet ds;

            cdate = dateTimePickerDateBegin.Text.ToString();
            if (Convert.ToDateTime(cdate) > DayOfMonth(Convert.ToDateTime(cdate)))
            {
                month = NextMonth(Convert.ToDateTime(cdate));
            }
            else
            {
                month = Convert.ToDateTime(cdate).ToString("yyyy-MM");
            }
            sql = "select closed from cost_temp_close where cmonth = '" + month + "'";
            ds  = conn.ReturnDataSet(sql);
            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0][0].ToString() == "True")
                {
                    closed = true;
                }
            }
            bool right = TempEmpAttQuery.SubmitRight(textEditCno.Text.ToString().Trim());

            if (!right)
            {
            }
            else if (closed)
            {
                MessageBox.Show("该月考勤已经关闭,不能再提报!");
            }
            else if (textEditStatus.Text != "未提报" && textEditStatus.Text != "")
            {
                MessageBox.Show("已提报的记录,不能再提报!");
            }
            else if (comboBoxShift.Text.ToString().Trim() == "" || textEditCno.Text.ToString().Trim() == "" || textEditRest.Text.ToString().Trim() == "" || textEditRealHours.Text.ToString().Trim() == "" || textEditNormal.Text.ToString().Trim() == "")
            {
                MessageBox.Show("有关键信息为空,请检查!");
            }
            else if (this.Text == "异常提报" && comboBoxNGType.SelectedValue.ToString() == "")
            {
                MessageBox.Show("请选择异常类型!");
            }
            else
            {
                string checkdata = "select isnull(status,0) status from COST_TEMP_EMPLOYEE_ATTENDANCE  where isnull(isclose,0) = 0 and cno = '" + textEditCno.Text.ToString() + "' and begin_date = '" + dateTimePickerDateBegin.Text + "' and end_date = '" + dateTimePickerDateEnd.Text + "'";;
                ds = conn.ReturnDataSet(checkdata);
                if (begin_date != "")
                {
                    if (ds.Tables[0].Rows.Count > 0 && (Convert.ToDateTime(begin_date).ToString("yyyy-MM-dd") != dateTimePickerDateBegin.Text.ToString() || Convert.ToDateTime(end_date).ToString("yyyy-MM-dd") != dateTimePickerDateEnd.Text.ToString()))
                    {
                        MessageBox.Show("该出勤日期已经存在!");
                    }
                    else
                    {
                        //TimeSpan ts = Convert.ToDateTime(dateTimePickerEnd.Text) - Convert.ToDateTime(dateTimePickerBegin.Text);
                        //textEditRealHours.Text = Convert.ToString(ts.TotalHours - Convert.ToDouble(textEditRest.Text.ToString().Trim()));
                        sql  = "update COST_TEMP_EMPLOYEE_ATTENDANCE set shift = '" + comboBoxShift.SelectedValue.ToString() + "',begin_date = '" + dateTimePickerDateBegin.Text + "',end_date = '" + dateTimePickerDateEnd.Text + "',BEGIN_APPLY = '" + timeEditBegin.Text + "',END_APPLY = '" + timeEditEnd.Text + "',rest_hours = '" + textEditRest.Text.ToString().Trim() + "',hours = '" + textEditRealHours.Text.ToString().Trim() + "',normal_hours = '" + textEditNormal.Text.ToString().Trim() + "',overtime_hours = '" + textEditOverTime.Text.ToString().Trim() + "',REASON_OVERTIME='" + textEditReason.Text.ToString().Trim() + "',apply_user = '******',apply_time = '" + DateTime.Now.ToString() + "',ng_type = '" + comboBoxNGType.SelectedValue.ToString() + "',status = 1";
                        sql  = sql + " where cno = '" + cno + "' and begin_date = '" + begin_date + "' and end_date = '" + end_date + "' and isnull(isclose,0) = 0";
                        isok = conn.EditDatabase(sql);
                        if (isok)
                        {
                            MessageBox.Show("提报成功!");
                            TempEmpAttQuery.RefreshEX();
                            this.Close();
                        }
                        else
                        {
                            MessageBox.Show("失败!");
                        }
                    }
                }
                else
                {
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        MessageBox.Show("此员工该出勤日期已经存在,请直接选择相应记录进行提报!");
                    }
                    else
                    {
                        sql  = string.Format("Insert into COST_TEMP_EMPLOYEE_ATTENDANCE(cno,shift,begin_date,end_date,begin_apply,end_apply,rest_hours,hours,normal_hours,overtime_hours,reason_overtime,status,apply_user,apply_time,ng_type) Values ('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}','{14}')", textEditCno.Text.ToString().Trim(), comboBoxShift.SelectedValue.ToString(), dateTimePickerDateBegin.Text, dateTimePickerDateEnd.Text, timeEditBegin.Text, timeEditEnd.Text, textEditRest.Text.ToString().Trim(), textEditRealHours.Text.ToString().Trim(), textEditNormal.Text.ToString().Trim(), textEditOverTime.Text.ToString().Trim(), textEditReason.Text.ToString().Trim(), 1, Logon.GetCname(), DateTime.Now.ToString(), comboBoxNGType.SelectedValue.ToString());
                        isok = conn.EditDatabase(sql);
                        if (isok)
                        {
                            MessageBox.Show("异常提报成功!");
                            TempEmpAttQuery.RefreshEX();
                            this.Close();
                        }
                        else
                        {
                            MessageBox.Show("失败!");
                        }
                    }
                }
            }

            conn.Close();
        }
Example #3
0
        private void TempEmpAttUpdate_Load(object sender, EventArgs e)
        {
            BindShift();
            //绑定异常类型
            Dictionary <string, string> kvDictonary = new Dictionary <string, string>();

            kvDictonary.Add("", "");
            kvDictonary.Add("忘打卡", "忘打卡");
            kvDictonary.Add("漏报", "漏报");
            kvDictonary.Add("多报", "多报");
            kvDictonary.Add("未录脸", "未录脸");
            kvDictonary.Add("卡机异常", "卡机异常");
            kvDictonary.Add("迟到", "迟到");
            kvDictonary.Add("早退", "早退");
            kvDictonary.Add("其它", "其它");
            BindingSource bs = new BindingSource();

            bs.DataSource                = kvDictonary;
            comboBoxNGType.DataSource    = bs;
            comboBoxNGType.ValueMember   = "Key";
            comboBoxNGType.DisplayMember = "Value";
            comboBoxNGType.SelectedIndex = 0;

            string cname = "", cfrom = "", shift = "", begin_time = "", end_time = "", begin_apply = "", end_apply = "", dept = "", rest_hours = "", hours = "", normal_hours = "", overtime_hours = "", reason = "", status = "", ng_type = "";

            TempEmpAttQuery.GetInfo(ref cno, ref cname, ref dept, ref cfrom, ref shift, ref begin_date, ref end_date, ref begin_time, ref end_time, ref begin_apply, ref end_apply, ref rest_hours, ref hours, ref normal_hours, ref overtime_hours, ref reason, ref status, ref ng_type, ref s_begin, ref s_end, ref s_rest_hours, ref s_overtime_rest_hours, ref overtime_begin);
            if (cno != "")
            {
                textEditCno.Text             = cno;
                textEditName.Text            = cname;
                textEditDept.Text            = dept;
                textEditFrom.Text            = cfrom;
                comboBoxShift.SelectedIndex  = -1;
                comboBoxShift.SelectedValue  = shift;
                comboBoxNGType.SelectedIndex = -1;
                comboBoxNGType.SelectedValue = ng_type;
                dateTimePickerDateBegin.Text = begin_date;
                dateTimePickerDateEnd.Text   = end_date;
                textEditMachineTime.Text     = begin_time + "—" + end_time;
                if (begin_apply != "")
                {
                    timeEditBegin.Time = Convert.ToDateTime(begin_apply);
                }
                if (end_apply != "")
                {
                    timeEditEnd.Time = Convert.ToDateTime(end_apply);
                }


                textEditRest.Text      = rest_hours;
                textEditRealHours.Text = hours;
                textEditNormal.Text    = normal_hours;
                textEditOverTime.Text  = overtime_hours;
                textEditReason.Text    = reason;
                textEditStatus.Text    = status;
            }
            else
            {
                textEditCno.Enabled = true;
            }
        }
Example #4
0
 private void barButtonItem主管审批_ItemClick(object sender, ItemClickEventArgs e)
 {
     TempEmpAttQuery.Check(3);
 }
Example #5
0
 private void barButtonItem驳回提报_ItemClick(object sender, ItemClickEventArgs e)
 {
     TempEmpAttQuery.Reject(1);
 }