Exemplo n.º 1
0
 private void textEditCno_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         ConnDB conn = new ConnDB();
         string sql;
         sql = "select cname,cfrom,dept,shift from COST_TEMP_EMPLOYEE where cno = '" + textEditCno.Text.ToString().Trim() + "' and status != '离职'";
         DataSet ds = conn.ReturnDataSet(sql);
         if (ds.Tables[0].Rows.Count > 0)
         {
             textEditName.Text           = ds.Tables[0].Rows[0][0].ToString();
             textEditDept.Text           = ds.Tables[0].Rows[0][2].ToString();
             textEditFrom.Text           = ds.Tables[0].Rows[0][1].ToString();
             comboBoxShift.SelectedIndex = -1;
             comboBoxShift.SelectedValue = ds.Tables[0].Rows[0][3].ToString();
         }
         else
         {
             textEditName.Text           = "";
             textEditDept.Text           = "";
             textEditFrom.Text           = "";
             comboBoxShift.SelectedIndex = -1;
             comboBoxShift.SelectedValue = "0";
         }
         bool right = TempEmpAttQuery.SubmitRight(textEditCno.Text.ToString().Trim());
     }
 }
Exemplo n.º 2
0
        private void barButtonItem提报工时_ItemClick(object sender, ItemClickEventArgs e)
        {
            string cno = "", cname = "", cfrom = "", shift = "", begin_date = "", end_date = "", begin_time = "", end_time = "", begin_apply = "", end_apply = "", dept = "", rest_hours = "", hours = "", normal_hours = "", overtime_hours = "", reason = "", status = "", ng_type = "", s_begin = "", s_end = "", s_rest_hours = "", s_overtime_rest_hours = "", overtime_begin = "";

            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);
            bool right = TempEmpAttQuery.SubmitRight();

            if (right)
            {
                if (cno != "")
                {
                    if (begin_time != "" && end_time != "")
                    {
                        TempEmpAttUpdate Frm = new TempEmpAttUpdate();
                        Frm.TopLevel = false;
                        Frm.Parent   = this;
                        Frm.Show();
                        Frm.BringToFront();
                    }
                    else
                    {
                        MessageBox.Show("打卡记录不完整,请异常提报!");
                    }
                }
                else
                {
                    MessageBox.Show("没有选中要提报的打卡记录!");
                }
            }
            else
            {
                MessageBox.Show("没有权限!");
            }
        }
Exemplo n.º 3
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();
        }