예제 #1
0
        private void simpleButtonExport_Click(object sender, EventArgs e)
        {
            ConnDB conn = new ConnDB();
            string dept1, dept2, dept3, table_name, cmonth;

            table_name = "salary";
            DataSet ds = new DataSet();

            cmonth = dateTimePickerMonth.Text.ToString();
            dept1  = comboBoxDept1.SelectedValue.ToString();
            dept2  = comboBoxDept2.SelectedValue.ToString();
            dept3  = comboBoxDept3.SelectedValue.ToString();


            IDataParameter[] parameters = new IDataParameter[] { new SqlParameter("@cmonth", cmonth), new SqlParameter("@dept1", dept1), new SqlParameter("@dept2", dept2), new SqlParameter("@dept3", dept3) };
            try
            {
                ds = conn.RunProcedure("COST_TEMP_EMPLOYEE_SALARY_SUM", parameters, table_name);
            }
            catch
            {
                MessageBox.Show("失败!");
            }

            bool isok = Common.DataSetToExcel(ds, true);

            if (isok)
            {
                MessageBox.Show("导出完成!");
            }
        }
예제 #2
0
        private void simpleButtonExport_Click(object sender, EventArgs e)
        {
            ConnDB  conn = new ConnDB();
            string  month, group;
            string  table_name = "status";
            DataSet ds         = new DataSet();

            month = dateTimePickerMonth.Text.ToString();
            group = comboBoxGroup.Text.ToString();
            IDataParameter[] parameters = new IDataParameter[] { new SqlParameter("@month", month), new SqlParameter("@group", group) };
            try
            {
                ds = conn.RunProcedure("COST_TEMP_EMPLOYEE_STATUS", parameters, table_name);
            }
            catch
            {
                MessageBox.Show("失败!");
            }

            bool isok = Common.DataSetToExcel(ds, true);

            if (isok)
            {
                MessageBox.Show("导出完成!");
            }
        }
예제 #3
0
        private void simpleButtonExport_Click(object sender, EventArgs e)
        {
            ConnDB conn = new ConnDB();
            string cno, dept1, dept2, dept3, dept, status, days, cmonth;

            days = "days";
            //DateTime begin_date, end_date;
            DataSet ds = new DataSet();

            status = comboBoxStatus.SelectedIndex.ToString();
            cno    = textEditNo.Text.ToString().Trim();
            cmonth = dateTimePickerMonth.Text.ToString();
            //begin_date = Convert.ToDateTime(dateTimePickerBegin.Text.ToString());
            //end_date = Convert.ToDateTime(dateTimePickerEnd.Text.ToString());
            dept1 = comboBoxDept1.SelectedValue.ToString();
            dept2 = comboBoxDept2.SelectedValue.ToString();
            dept3 = comboBoxDept3.SelectedValue.ToString();
            dept  = comboBoxDept.SelectedValue.ToString();

            IDataParameter[] parameters = new IDataParameter[] { new SqlParameter("@month", cmonth), new SqlParameter("@cno", cno), new SqlParameter("@dept1", dept1), new SqlParameter("@dept2", dept2), new SqlParameter("@dept3", dept3), new SqlParameter("@dept", dept) };
            try
            {
                ds = conn.RunProcedure("COST_TEMP_EMPLOYEE_DAYS", parameters, days);
            }
            catch
            {
                MessageBox.Show("失败!");
            }

            bool isok = Common.DataSetToExcel(ds, true);

            if (isok)
            {
                MessageBox.Show("导出完成!");
            }
        }
예제 #4
0
        private void simpleButtonExport_Click(object sender, EventArgs e)
        {
            ConnDB conn = new ConnDB();
            string strsql, yyyymm;

            yyyymm = dateTimePicker1.Text.ToString();
            simpleButtonExport.Enabled = false;
            if (!isall)
            {
                if (textEditNo.Text.ToString().Trim() != "" || textEditName.Text.ToString().Trim() != "")
                {
                    strsql = "select '''' + cno 临时工号,e.cname 姓名,sex 性别,register_date 报道日期,leave_date 离职日期,cfrom 输送渠道,b.cname 输送类型,dept1 一级部门,dept2 二级部门,dept3 三级部门,dept 部门,'''' + id_number 身份证号,phone_no 手机号码,shift 班次,status 状态 from COST_TEMP_EMPLOYEE e left join cost_base_data b on e.from_type = b.sub_id and module_id = 1 where cno = '" + textEditNo.Text.ToString().Trim() + "' or e.cname = '" + textEditName.Text.ToString().Trim() + "'";
                }
                else if (comboBoxDept.SelectedValue.ToString() != "0" && comboBoxDept.SelectedValue.ToString() != "")
                {
                    strsql = "select '''' + cno 临时工号,e.cname 姓名,sex 性别,register_date 报道日期,leave_date 离职日期,cfrom 输送渠道,b.cname 输送类型,dept1 一级部门,dept2 二级部门,dept3 三级部门,dept 部门,'''' + id_number 身份证号,phone_no 手机号码,shift 班次,status 状态 from COST_TEMP_EMPLOYEE e left join cost_base_data b on e.from_type = b.sub_id and module_id = 1 where register_date like '" + yyyymm + "%' and dept = '" + comboBoxDept.SelectedValue + "' and isnull(status,'在职')= case when '" + comboBoxStatus.Text + "' = '全部' then isnull(status,'在职') else '" + comboBoxStatus.Text + "' end";
                }
                else if (comboBoxDept3.SelectedValue.ToString() != "0" && comboBoxDept3.SelectedValue.ToString() != "")
                {
                    strsql = "select '''' + cno 临时工号,e.cname 姓名,sex 性别,register_date 报道日期,leave_date 离职日期,cfrom 输送渠道,b.cname 输送类型,dept1 一级部门,dept2 二级部门,dept3 三级部门,dept 部门,'''' + id_number 身份证号,phone_no 手机号码,shift 班次,status 状态 from COST_TEMP_EMPLOYEE e left join cost_base_data b on e.from_type = b.sub_id and module_id = 1 where register_date like '" + yyyymm + "%' and dept3 = '" + comboBoxDept3.SelectedValue + "' and dept2 = '" + comboBoxDept2.SelectedValue + "' and dept1 = '" + comboBoxDept1.SelectedValue + "' and isnull(status,'在职')= case when '" + comboBoxStatus.Text + "' = '全部' then isnull(status,'在职') else '" + comboBoxStatus.Text + "' end";
                }
                else if (comboBoxDept2.SelectedValue.ToString() != "0" && comboBoxDept2.SelectedValue.ToString() != "")
                {
                    strsql = "select '''' + cno 临时工号,e.cname 姓名,sex 性别,register_date 报道日期,leave_date 离职日期,cfrom 输送渠道,b.cname 输送类型,dept1 一级部门,dept2 二级部门,dept3 三级部门,dept 部门,'''' + id_number 身份证号,phone_no 手机号码,shift 班次,status 状态 from COST_TEMP_EMPLOYEE e left join cost_base_data b on e.from_type = b.sub_id and module_id = 1 where register_date like '" + yyyymm + "%' and dept2 = '" + comboBoxDept2.SelectedValue + "' and dept1 = '" + comboBoxDept1.SelectedValue + "' and isnull(status,'在职')= case when '" + comboBoxStatus.Text + "' = '全部' then isnull(status,'在职') else '" + comboBoxStatus.Text + "' end";
                }
                else if (comboBoxDept1.SelectedValue.ToString() != "0" && comboBoxDept1.SelectedValue.ToString() != "")
                {
                    strsql = "select '''' + cno 临时工号,e.cname 姓名,sex 性别,register_date 报道日期,leave_date 离职日期,cfrom 输送渠道,b.cname 输送类型,dept1 一级部门,dept2 二级部门,dept3 三级部门,dept 部门,'''' + id_number 身份证号,phone_no 手机号码,shift 班次,status 状态 from COST_TEMP_EMPLOYEE e left join cost_base_data b on e.from_type = b.sub_id and module_id = 1 where register_date like '" + yyyymm + "%' and dept1 = '" + comboBoxDept1.SelectedValue + "' and isnull(status,'在职')= case when '" + comboBoxStatus.Text + "' = '全部' then isnull(status,'在职') else '" + comboBoxStatus.Text + "' end";
                }
                else
                {
                    strsql = "select '''' + cno 临时工号,e.cname 姓名,sex 性别,register_date 报道日期,leave_date 离职日期,cfrom 输送渠道,b.cname 输送类型,dept1 一级部门,dept2 二级部门,dept3 三级部门,dept 部门,'''' + id_number 身份证号,phone_no 手机号码,shift 班次,status 状态 from COST_TEMP_EMPLOYEE e left join cost_base_data b on e.from_type = b.sub_id and module_id = 1 where register_date like '" + yyyymm + "%' and isnull(status,'在职')= case when '" + comboBoxStatus.Text + "' = '全部' then isnull(status,'在职') else '" + comboBoxStatus.Text + "' end";
                }
            }
            else
            {
                if (comboBoxDept.SelectedValue.ToString() != "")
                {
                    strsql = "select '''' + cno 临时工号,e.cname 姓名,sex 性别,register_date 报道日期,leave_date 离职日期,cfrom 输送渠道,b.cname 输送类型,dept1 一级部门,dept2 二级部门,dept3 三级部门,dept 部门,'''' + id_number 身份证号,phone_no 手机号码,shift 班次,status 状态 from COST_TEMP_EMPLOYEE e left join cost_base_data b on e.from_type = b.sub_id and module_id = 1 where dept = '" + comboBoxDept.SelectedValue + "' and isnull(status,'在职')= case when '" + comboBoxStatus.Text + "' = '全部' then isnull(status,'在职') else '" + comboBoxStatus.Text + "' end";
                }
                else if (comboBoxDept3.SelectedValue.ToString() != "")
                {
                    strsql = "select '''' + cno 临时工号,e.cname 姓名,sex 性别,register_date 报道日期,leave_date 离职日期,cfrom 输送渠道,b.cname 输送类型,dept1 一级部门,dept2 二级部门,dept3 三级部门,dept 部门,'''' + id_number 身份证号,phone_no 手机号码,shift 班次,status 状态 from COST_TEMP_EMPLOYEE e left join cost_base_data b on e.from_type = b.sub_id and module_id = 1 where dept3 = '" + comboBoxDept3.SelectedValue + "' and dept2 = '" + comboBoxDept2.SelectedValue + "' and dept1 = '" + comboBoxDept1.SelectedValue + "' and isnull(status,'在职')= case when '" + comboBoxStatus.Text + "' = '全部' then isnull(status,'在职') else '" + comboBoxStatus.Text + "' end";
                }
                else if (comboBoxDept2.SelectedValue.ToString() != "")
                {
                    strsql = "select '''' + cno 临时工号,e.cname 姓名,sex 性别,register_date 报道日期,leave_date 离职日期,cfrom 输送渠道,b.cname 输送类型,dept1 一级部门,dept2 二级部门,dept3 三级部门,dept 部门,'''' + id_number 身份证号,phone_no 手机号码,shift 班次,status 状态 from COST_TEMP_EMPLOYEE e left join cost_base_data b on e.from_type = b.sub_id and module_id = 1 where dept2 = '" + comboBoxDept2.SelectedValue + "' and dept1 = '" + comboBoxDept1.SelectedValue + "' and isnull(status,'在职')= case when '" + comboBoxStatus.Text + "' = '全部' then isnull(status,'在职') else '" + comboBoxStatus.Text + "' end";
                }
                else if (comboBoxDept1.SelectedValue.ToString() != "")
                {
                    strsql = "select '''' + cno 临时工号,e.cname 姓名,sex 性别,register_date 报道日期,leave_date 离职日期,cfrom 输送渠道,b.cname 输送类型,dept1 一级部门,dept2 二级部门,dept3 三级部门,dept 部门,'''' + id_number 身份证号,phone_no 手机号码,shift 班次,status 状态 from COST_TEMP_EMPLOYEE e left join cost_base_data b on e.from_type = b.sub_id and module_id = 1 where dept1 = '" + comboBoxDept1.SelectedValue + "' and isnull(status,'在职')= case when '" + comboBoxStatus.Text + "' = '全部' then isnull(status,'在职') else '" + comboBoxStatus.Text + "' end";
                }
                else
                {
                    strsql = "select '''' + cno 临时工号,e.cname 姓名,sex 性别,register_date 报道日期,leave_date 离职日期,cfrom 输送渠道,b.cname 输送类型,dept1 一级部门,dept2 二级部门,dept3 三级部门,dept 部门,'''' + id_number 身份证号,phone_no 手机号码,shift 班次,status 状态 from COST_TEMP_EMPLOYEE e left join cost_base_data b on e.from_type = b.sub_id and module_id = 1 where isnull(status,'在职')= case when '" + comboBoxStatus.Text + "' = '全部' then isnull(status,'在职') else '" + comboBoxStatus.Text + "' end";
                }
            }


            DataSet ds   = conn.ReturnDataSet(strsql);
            bool    isok = Common.DataSetToExcel(ds, true);

            if (isok)
            {
                simpleButtonExport.Enabled = true;
                MessageBox.Show("导出完成!");
            }
        }