Exemplo n.º 1
0
        public void BindType()
        {
            ConnDB  conn = new ConnDB();
            string  sql  = "select sub_id cid,cname value from cost_base_data where module_id = 2";
            DataSet ds   = conn.ReturnDataSet(sql);
            DataRow dr   = ds.Tables[0].NewRow();

            dr[0] = 0;
            dr[1] = "请选择";
            //插在第一位

            ds.Tables[0].Rows.InsertAt(dr, 0);
            comboBoxType.DataSource    = ds.Tables[0];
            comboBoxType.DisplayMember = "value";
            comboBoxType.ValueMember   = "CID";
            conn.Close();
        }
Exemplo n.º 2
0
        public void BindDept1()
        {
            ConnDB  conn = new ConnDB();
            string  sql  = "select distinct dept1 from COST_DEPT_LIST";
            DataSet ds   = conn.ReturnDataSet(sql);
            DataRow dr   = ds.Tables[0].NewRow();

            //dr[0] = "0";
            //dr[1] = "请选择";
            ////插在第一位

            //ds.Tables[0].Rows.InsertAt(dr, 0);
            comboBoxDept1.DataSource    = ds.Tables[0];
            comboBoxDept1.DisplayMember = "dept1";
            comboBoxDept1.ValueMember   = "dept1";
            conn.Close();
        }
Exemplo n.º 3
0
        public void BindDept2()
        {
            ConnDB  conn = new ConnDB();
            string  sql  = "select distinct dept2 as id,dept2 as name from COST_DEPT_LIST where dept1 = '" + comboBoxDept1.SelectedValue + "'";
            DataSet ds   = conn.ReturnDataSet(sql);
            DataRow dr   = ds.Tables[0].NewRow();

            dr[0] = "0";
            dr[1] = "请选择";
            //插在第一位

            ds.Tables[0].Rows.InsertAt(dr, 0);
            comboBoxDept2.DataSource    = ds.Tables[0];
            comboBoxDept2.DisplayMember = "name";
            comboBoxDept2.ValueMember   = "id";
            conn.Close();
        }
Exemplo n.º 4
0
        public void BindShift()
        {
            ConnDB  conn = new ConnDB();
            string  sql  = "select cname cid,cname value from cost_shift where isnull(forbidden,'false') != 'true'";
            DataSet ds   = conn.ReturnDataSet(sql);
            DataRow dr   = ds.Tables[0].NewRow();

            dr[0] = "";//其实这里也许设置为"null"更好
            dr[1] = "请选择";
            //插在第一位

            ds.Tables[0].Rows.InsertAt(dr, 0);
            comboBoxShift.DataSource    = ds.Tables[0];
            comboBoxShift.DisplayMember = "value";
            comboBoxShift.ValueMember   = "CID";
            conn.Close();
        }
Exemplo n.º 5
0
        private void showDetail()
        {
            ConnDB conn = new ConnDB();
            string strsql;

            strsql = "select CMONTH 月份,MAT_CODE 新物料编码,CUSTOMER 客户,PRODUCT_MODEL 产品型号,STANDARD_HOURS 标工 from COST_HH_STANDARD_HOURS where cmonth = '" + dateTimePickerMonth.Text + "'";
            DataSet ds = conn.ReturnDataSet(strsql);

            gridControl1.DataSource      = ds.Tables[0].DefaultView;
            gridView1.Columns[0].Visible = false;
            gridView1.Columns[0].OptionsColumn.ReadOnly = true;
            gridView1.Columns[1].OptionsColumn.ReadOnly = true;
            gridView1.Columns[2].OptionsColumn.ReadOnly = true;
            gridView1.Columns[3].OptionsColumn.ReadOnly = true;
            gridView1.Columns[4].OptionsColumn.ReadOnly = true;
            conn.Close();
        }
Exemplo n.º 6
0
        public void BindDept()
        {
            ConnDB  conn = new ConnDB();
            string  sql  = "select d.cid,d.cname from  COST_DEPT d where d.saletype_id = 14";
            DataSet ds   = conn.ReturnDataSet(sql);
            DataRow dr   = ds.Tables[0].NewRow();

            dr[0] = "0";
            dr[1] = "请选择";
            //插在第一位

            ds.Tables[0].Rows.InsertAt(dr, 0);
            comboBoxDept.DataSource    = ds.Tables[0];
            comboBoxDept.DisplayMember = "CNAME";
            comboBoxDept.ValueMember   = "CID";
            conn.Close();
        }
Exemplo n.º 7
0
        private void simpleButtonOK_Click(object sender, EventArgs e)
        {
            ConnDB conn = new ConnDB();
            string password;

            password = Common.MD5Encrypt(textEditAgain.Text.ToString().Trim());
            string sql = "update cost_user set password ='******' where cname = '" + Logon.GetCname() + "'";
            string sql2 = "select cname from cost_user where cname = '" + Logon.GetCname() + "' and password ='******'";

            if (textEditNew.Text.ToString().Trim() != "" && textEditAgain.Text.ToString().Trim() != "")
            {
                if (textEditNew.Text.ToString().Trim() == textEditAgain.Text.ToString().Trim())
                {
                    int rows = conn.ReturnRecordCount(sql2);
                    if (rows > 0)
                    {
                        MessageBox.Show("不能和旧密码相同!");
                    }
                    else
                    {
                        bool isok = conn.EditDatabase(sql);
                        if (isok)
                        {
                            MessageBox.Show("修改成功!");
                            this.Close();
                        }
                        else
                        {
                            MessageBox.Show("失败!");
                        }
                    }
                }
                else
                {
                    MessageBox.Show("两次输入的不一致!");
                }
            }
            else
            {
                MessageBox.Show("不能为空值!");
            }
            conn.Close();
        }
Exemplo n.º 8
0
        private void simpleButtonOK_Click(object sender, EventArgs e)
        {
            ConnDB conn = new ConnDB();
            string dept11, dept22, dept33;

            dept11 = comboBoxDept1.Text;
            dept22 = comboBoxDept2.Text;
            dept33 = comboBoxDept3.Text;
            if (dept11 == "请选择")
            {
                dept11 = "";
            }
            if (dept22 == "请选择")
            {
                dept22 = "";
            }
            if (dept33 == "请选择")
            {
                dept33 = "";
            }

            string sql = "update cost_check_dept set dept1 ='" + dept11 + "',dept2 ='" + dept22 + "',dept3 ='" + dept33;

            sql = sql + "' where log_name = '" + logname + "' and dept1 = '" + dept1 + "' and dept2 = '" + dept2 + "' and dept3 = '" + dept3 + "'";
            // string sql2 = "select cname from cost_user where cname = '" + textEditLogName.Text.ToString().Trim() + "' and password ='******'";
            if (textEditLogName.Text.ToString().Trim() != "")
            {
                bool isok = conn.EditDatabase(sql);
                if (isok)
                {
                    MessageBox.Show("修改成功!");
                    UserDeptCheckQuery.RefreshEX();
                    this.Close();
                }
                else
                {
                    MessageBox.Show("失败!");
                }
            }
            else
            {
                MessageBox.Show("登录名不能为空值!");
            }
            conn.Close();
        }
 private void BindIndirectLabour()
 {
     if (comboBoxDept.SelectedValue.ToString() != "System.Data.DataRowView")
     {
         ConnDB  conn = new ConnDB();
         string  sql  = "select CID,CNO + ' ' + CNAME as CNAME from cost_direct_labour where person_type_id = 4 and isnull(forbidden,'false') != 'true' and dept_id = " + comboBoxDept.SelectedValue.ToString();
         DataSet ds   = conn.ReturnDataSet(sql);
         DataRow dr   = ds.Tables[0].NewRow();
         dr[0] = "0";
         dr[1] = "请选择";
         //插在第一位
         ds.Tables[0].Rows.InsertAt(dr, 0);
         comboBoxIndirectLabour.DataSource    = ds.Tables[0];
         comboBoxIndirectLabour.DisplayMember = "CNAME";
         comboBoxIndirectLabour.ValueMember   = "CID";
         conn.Close();
     }
 }
Exemplo n.º 10
0
        private void ShowDetail()
        {
            ConnDB conn = new ConnDB();
            string strsql, yyyymm;

            yyyymm = dateTimePicker1.Text.ToString();
            strsql = "select i.yyyymm 年月,j.CID,j.CNAME 上班类型,i.price '费率(元/小时)' from (select * from cost_direct_labour_price where isnull(YYYYMM,'') ='" + yyyymm + "') i left join (select * from COST_WORK_TYPE where forbidden = 'false') j on i.WORK_TYPE = j.cid  ";
            DataSet ds = conn.ReturnDataSet(strsql);

            gridControl1.DataSource      = ds.Tables[0].DefaultView;
            gridView1.Columns[1].Visible = false;

            gridView1.Columns[0].OptionsColumn.ReadOnly = true;
            gridView1.Columns[1].OptionsColumn.ReadOnly = true;
            gridView1.Columns[2].OptionsColumn.ReadOnly = true;
            gridView1.Columns[3].OptionsColumn.ReadOnly = true;
            conn.Close();
        }
Exemplo n.º 11
0
        private void simpleButtonOK_Click(object sender, EventArgs e)
        {
            ConnDB conn = new ConnDB();
            string strsql, strsql2;
            int    rows;

            strsql  = "insert into cost_rate(yyyy,quarter_id,sale_type_id,dept_id,cost_rate) values('" + dateTimePicker1.Text.ToString() + "'," + comboBoxQuarter.SelectedValue.ToString() + "," + comboBoxSaleType.SelectedValue.ToString() + "," + comboBoxDept.SelectedValue.ToString() + ",ltrim(rtrim(" + Common.IsNull(textEditCostRate.Text.ToString()) + ")))";
            strsql2 = "select * from cost_rate where yyyy ='" + dateTimePicker1.Text.ToString() + "' and sale_type_id = " + Common.IsZero(comboBoxSaleType.SelectedValue.ToString()) + " and quarter_id = " + Common.IsZero(comboBoxQuarter.SelectedValue.ToString()) + " and dept_id = " + comboBoxDept.SelectedValue;
            if (comboBoxQuarter.SelectedValue.ToString() == "0")
            {
                MessageBox.Show("请选择季度");
            }
            else if (comboBoxSaleType.SelectedValue.ToString() == "0")
            {
                MessageBox.Show("请选择营业类型");
            }
            else if (comboBoxDept.SelectedValue.ToString() == "0")
            {
                MessageBox.Show("部门不能为空!");
            }
            else if (textEditCostRate.Text.ToString() == "")
            {
                MessageBox.Show("成本比率不能为空!");
            }
            else
            {
                rows = conn.ReturnRecordCount(strsql2);
                if (rows > 0)
                {
                    MessageBox.Show("该部门成本比率已经存在!");
                }
                else
                {
                    bool isok = conn.EditDatabase(strsql);
                    if (isok)
                    {
                        MessageBox.Show("添加成功!");
                        CostDeptRateQuery.RefreshEX();
                        this.Close();
                    }
                }
            }
            conn.Close();
        }
Exemplo n.º 12
0
        private void showDetail()
        {
            gridView1.Columns.Clear();
            ConnDB  conn = new ConnDB();
            string  month, group;
            string  table_name = "status";
            DataSet ds;

            month = dateTimePickerMonth.Text.ToString();
            group = comboBoxGroup.Text.ToString();


            bool success = true;

            IDataParameter[] parameters = new IDataParameter[] { new SqlParameter("@month", month), new SqlParameter("@group", group) };
            try
            {
                ds = conn.RunProcedure("COST_TEMP_EMPLOYEE_STATUS", parameters, table_name);
                gridControl1.DataSource = ds.Tables[0].DefaultView;
            }
            catch
            {
                MessageBox.Show("失败!");
                success = false;
            }
            if (success)
            {
                gridView1.Columns[0].OptionsColumn.ReadOnly = true;
                gridView1.Columns[1].OptionsColumn.ReadOnly = true;
                gridView1.Columns[2].OptionsColumn.ReadOnly = true;
                gridView1.Columns[3].OptionsColumn.ReadOnly = true;
                gridView1.Columns[4].OptionsColumn.ReadOnly = true;
            }

            //表头设置
            //gridView1.ColumnPanelRowHeight = 35;
            //gridView1.OptionsView.AllowHtmlDrawHeaders = true;
            //gridView1.Appearance.HeaderPanel.TextOptions.WordWrap = DevExpress.Utils.WordWrap.Wrap;
            //表头及行内容居中显示
            //gridView1.Appearance.Row.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
            gridView1.Appearance.HeaderPanel.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;

            conn.Close();
        }
Exemplo n.º 13
0
        private void simpleButtonOK_Click(object sender, EventArgs e)
        {
            ConnDB conn = new ConnDB();
            string strsql, strsql2;
            int    rows;

            strsql  = "insert into cost_dept_standard_point(yyyymm,sale_type_id,dept_id,dept_standard_point) values('" + dateTimePicker1.Text.ToString() + "'," + comboBoxSaleType.SelectedValue.ToString() + "," + comboBoxDept.SelectedValue.ToString() + ",ltrim(rtrim(" + textEditDeptStandardPoint.Text.ToString() + ")))";
            strsql2 = "select * from cost_dept_standard_point where yyyymm ='" + dateTimePicker1.Text.ToString() + "' and sale_type_id = " + Common.IsZero(comboBoxSaleType.SelectedValue.ToString()) + " and dept_id = " + Common.IsZero(comboBoxDept.SelectedValue.ToString());
            if (comboBoxSaleType.SelectedValue.ToString() == "0")
            {
                MessageBox.Show("请选择营业分类!");
            }
            else if (comboBoxDept.SelectedValue.ToString() == "0")
            {
                MessageBox.Show("请选择部门!");
            }
            else if (textEditDeptStandardPoint.Text.ToString() == "")
            {
                MessageBox.Show("部门标准单点成本不能为空!");
            }
            else
            {
                rows = conn.ReturnRecordCount(strsql2);
                if (rows > 0)
                {
                    MessageBox.Show("该单点标准成本已经存在!");
                }
                else
                {
                    bool isok = conn.EditDatabase(strsql);
                    if (isok)
                    {
                        MessageBox.Show("添加成功!");
                        DeptStandardPointQuery.RefreshEX();
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("失败!");
                    }
                }
            }
            conn.Close();
        }
Exemplo n.º 14
0
        public static void Delete()
        {
            string sql;
            bool   isdone = true;
            ConnDB conn   = new ConnDB();

            if (ilpqform == null || ilpqform.IsDisposed)
            {
                MessageBox.Show("没有要删除的数据!");
            }
            else if (ilpqform.gridView1.SelectedRowsCount == 0)
            {
                MessageBox.Show("没有要删除的数据!");
            }

            else
            {
                MessageBoxButtons messButton = MessageBoxButtons.OKCancel;
                string            ms         = "确定要删除查询出来的所有数据吗?";
                DialogResult      dr         = MessageBox.Show(ms, "间接人工费率删除", messButton);
                if (dr == DialogResult.OK)
                {
                    if (ilpqform.comboBoxDept.SelectedValue.ToString() == "0")
                    {
                        sql = "delete from cost_indirect_labour_price where YYYYMM = '" + ilpqform.dateTimePicker1.Text.ToString() + "'";
                    }
                    else if (ilpqform.comboBoxIndirectLabour.SelectedValue.ToString() == "0")
                    {
                        sql = "delete i from cost_indirect_labour_price i left join cost_direct_labour j on i.indirect_labour_id = j.cid where YYYYMM = '" + ilpqform.dateTimePicker1.Text.ToString() + "' and j.dept_id = " + ilpqform.comboBoxDept.SelectedValue.ToString();
                    }
                    else
                    {
                        sql = "delete i from cost_indirect_labour_price i where YYYYMM = '" + ilpqform.dateTimePicker1.Text.ToString() + "' and i.indirect_labour_id = " + ilpqform.comboBoxIndirectLabour.SelectedValue.ToString();
                    }
                    isdone = conn.DeleteDatabase(sql);
                    if (isdone)
                    {
                        MessageBox.Show("删除成功!");
                    }
                }
            }
            conn.Close();
        }
Exemplo n.º 15
0
        private void ShowDetail()
        {
            ConnDB conn = new ConnDB();
            string strsql, month, sqlsum;

            month  = dateTimePicker1.Text.ToString();
            strsql = "select SALE_TYPE_NAME 营业类型,CONVERT(varchar(100), CDATE, 23) 日期,DIRECT_HOURS 直接人工小时数,cast(round(DIRECT_COST, 2) as decimal(18, 2)) 直接人工成本,INDIRECT_HOURS 间接人工小时数,cast(round(INDIRECT_COST, 2) as decimal(18, 2)) 间接人工成本,cast(round(DEPRECIATION, 2) as decimal(18, 2)) 折旧费,cast(round(OPERATION_TRANSFER, 2) as decimal(18, 2)) 运营部费用转嫁,cast(round(TRIAL_TRANSFER, 2) as decimal(18, 2)) 试产费用转嫁,cast(round(COMPOSITE_EXPENSE, 2) as decimal(18, 2)) 主营综合费用,cast(round(POINTCOUNT, 2) as decimal(18, 2)) 产出信道数,cast(round(COST, 2) as decimal(18, 2)) 预估成本,COST_POINT 预估单信道成本,STANDARD_POINT 标准单信道成本,cast(round(STANDARD_COST, 2) as decimal(18, 2)) 标准成本,cast(round(PROFIT, 2) as decimal(18, 2)) 盈亏 from COST_DAY_CALCULATE where cdate like '" + month + "%' and sale_type_id =15  order by cdate";
            DataSet ds = conn.ReturnDataSet(strsql);

            sqlsum = "select SALE_TYPE_NAME 营业类型,'汇总:' 日期,DIRECT_HOURS 直接人工小时数,cast(round(DIRECT_COST, 2) as decimal(18, 2)) 直接人工成本,INDIRECT_HOURS 间接人工小时数,cast(round(INDIRECT_COST, 2) as decimal(18, 2)) 间接人工成本,cast(round(DEPRECIATION, 2) as decimal(18, 2)) 折旧费,cast(round(OPERATION_TRANSFER, 2) as decimal(18, 2)) 运营部费用转嫁,cast(round(TRIAL_TRANSFER, 2) as decimal(18, 2)) 试产费用转嫁,cast(round(COMPOSITE_EXPENSE, 2) as decimal(18, 2)) 主营综合费用,cast(round(POINTCOUNT, 2) as decimal(18, 2)) 产出信道数,cast(round(COST, 2) as decimal(18, 2)) 预估成本,COST_POINT 预估单信道成本,STANDARD_POINT 标准单信道成本,cast(round(STANDARD_COST, 2) as decimal(18, 2)) 标准成本,cast(round(PROFIT, 2) as decimal(18, 2)) 盈亏 from COST_MONTH_CALCULATE where cmonth = '" + month + "' and sale_type_id =15";
            DataSet ds2 = conn.ReturnDataSet(sqlsum);

            ds.Merge(ds2, true, MissingSchemaAction.AddWithKey);
            gridControl1.DataSource      = ds.Tables[0].DefaultView;
            gridView1.Columns[0].Visible = false;
            //gridView1.Columns[0].OptionsColumn.ReadOnly = true;
            //gridView1.Columns[1].OptionsColumn.ReadOnly = true;
            conn.Close();
        }
Exemplo n.º 16
0
        private bool costing()
        {
            ConnDB conn  = new ConnDB();
            string month = dateTimePicker1.Text;
            string sql;
            int    i, rows;
            bool   isok;
            bool   success = false;

            isok = CheckData(false);
            if (isok)
            {
                sql = "select * from COST_MONTH_CALCULATE where cmonth ='" + dateTimePicker1.Text.ToString() + "' and sale_type_id = 10";
                IDataParameter[] parameters = new IDataParameter[] { new SqlParameter("@cmonth", month), new SqlParameter("@saletypeid", "10") };

                rows = conn.ReturnRecordCount(sql);
                if (rows > 0)
                {
                    MessageBox.Show("该月已经存在成本计算结果,如要重新计算,请先清空该月计算结果!");
                }
                else
                {
                    try
                    {
                        conn.RunProcedure("costing", parameters, out i);
                        success = true;
                    }
                    catch
                    {
                        MessageBox.Show("失败!");
                        success = false;
                    }
                    if (success)
                    {
                        MessageBox.Show("计算完成!");
                        ShowDetail();
                    }
                }
            }

            conn.Close();
            return(success);
        }
        private void ShowDetail()
        {
            ConnDB conn = new ConnDB();
            string strsql, yyyymm;

            yyyymm = dateTimePicker1.Text.ToString();
            strsql = "select '" + comboBoxIndirectLabour.SelectedValue.ToString() + "'as labour_id,'" + ((DataRowView)comboBoxIndirectLabour.SelectedItem).Row["CNAME"].ToString() + "' as 人员,j.CID,j.CNAME 上班类型,i.price '费率(元/小时)' from (select i.* from cost_indirect_labour_price i left join cost_direct_labour j on i.indirect_labour_id = j.cid where isnull(YYYYMM,'') ='" + yyyymm + "' and j.dept_id = " + comboBoxDept.SelectedValue.ToString() + " and indirect_labour_id = " + comboBoxIndirectLabour.SelectedValue.ToString() + ") i right join (select * from COST_WORK_TYPE where forbidden = 'false') j on i.WORK_TYPE_id = j.cid  ";
            DataSet ds = conn.ReturnDataSet(strsql);

            gridControl1.DataSource      = ds.Tables[0].DefaultView;
            gridView1.Columns[0].Visible = false;
            gridView1.Columns[2].Visible = false;
            gridView1.Columns[0].OptionsColumn.ReadOnly = true;
            gridView1.Columns[1].OptionsColumn.ReadOnly = true;
            gridView1.Columns[2].OptionsColumn.ReadOnly = true;
            gridView1.Columns[3].OptionsColumn.ReadOnly = true;
            gridView1.Columns[1].Width = 130;
            conn.Close();
        }
Exemplo n.º 18
0
        private void simpleButton全选_Click(object sender, EventArgs e)
        {
            ConnDB conn = new ConnDB();
            string strsql;
            int    cid = RoleQuery.GetCid();

            strsql = "select i.cid,p.cid,p.module_name 模块,p.permission 权限, cast('true' as bit) ' ' from COST_ROLE i cross join COST_MODULE_PERMISSION p left join COST_ROLE_PERMISSION r on i.CID = r.ROLE_ID and p.CID = r.PERMISSION_ID where i.cid = " + cid;
            DataSet ds = conn.ReturnDataSet(strsql);

            gridControl1.DataSource      = ds.Tables[0].DefaultView;
            gridView1.Columns[0].Visible = false;
            gridView1.Columns[1].Visible = false;
            gridView1.Columns[0].OptionsColumn.ReadOnly = true;
            gridView1.Columns[1].OptionsColumn.ReadOnly = true;
            gridView1.Columns[2].OptionsColumn.ReadOnly = true;
            gridView1.Columns[3].OptionsColumn.ReadOnly = true;
            ischange = true;
            conn.Close();
        }
Exemplo n.º 19
0
        private void showDetail()
        {
            ConnDB conn = new ConnDB();
            string strsql;
            int    cid = RoleQuery.GetCid();

            strsql = "select i.cid,p.cid,p.module_name 模块,p.permission 权限,isnull(r.have_right,'false') ' ' from COST_ROLE i cross join COST_MODULE_PERMISSION p left join COST_ROLE_PERMISSION r on i.CID = r.ROLE_ID and p.CID = r.PERMISSION_ID where i.cid = " + cid;
            DataSet ds = conn.ReturnDataSet(strsql);

            gridControl1.DataSource      = ds.Tables[0].DefaultView;
            gridView1.Columns[0].Visible = false;
            gridView1.Columns[1].Visible = false;
            gridView1.Columns[0].OptionsColumn.ReadOnly = true;
            gridView1.Columns[1].OptionsColumn.ReadOnly = true;
            gridView1.Columns[2].OptionsColumn.ReadOnly = true;
            gridView1.Columns[3].OptionsColumn.ReadOnly = true;

            conn.Close();
        }
Exemplo n.º 20
0
        private void showDetail()
        {
            ConnDB conn = new ConnDB();
            string strsql, yyyymm;

            yyyymm = dateTimePicker1.Text.ToString();
            strsql = "select i.cid,i.yyyymm 年月,i.sale_type_id 营业类型id,j.cname 营业类型,i.expense 费用 from COST_COMPOSITE_EXPENSE i left join cost_saletype j on i.sale_type_id = j.cid where i.yyyymm = '" + yyyymm + "'";
            DataSet ds = conn.ReturnDataSet(strsql);

            gridControl1.DataSource      = ds.Tables[0].DefaultView;
            gridView1.Columns[0].Visible = false;
            gridView1.Columns[2].Visible = false;
            gridView1.Columns[0].OptionsColumn.ReadOnly = true;
            gridView1.Columns[1].OptionsColumn.ReadOnly = true;
            gridView1.Columns[2].OptionsColumn.ReadOnly = true;
            gridView1.Columns[3].OptionsColumn.ReadOnly = true;
            gridView1.Columns[4].OptionsColumn.ReadOnly = true;
            conn.Close();
        }
Exemplo n.º 21
0
        private void simpleButtonOK_Click(object sender, EventArgs e)
        {
            ConnDB conn = new ConnDB();
            string sql  = "update cost_direct_labour set cno = ltrim(rtrim('" + textEditNo.Text.ToString().Trim() + "')),cname = ltrim(rtrim('" + textEditName.Text.ToString().Trim() + "')),position_id = " + Common.IsZero(comboBoxPosition.SelectedValue.ToString()) + ",linetype_id =" + Common.IsZero(comboBoxLineType.SelectedValue.ToString()) + ",dept_id =" + comboBoxDept.SelectedValue.ToString();

            sql = sql + " where cid = " + textEditID.Text.ToString();
            string sql2 = "select cname from cost_direct_labour where cno = '" + textEditNo.Text.ToString().Trim() + "' and cid <> " + textEditID.Text;
            string sql3 = "select * from cost_direct_labour where cno = '" + textEditNo.Text.ToString().Trim() + "' and cname ='" + textEditName.Text.ToString().Trim() + "' and position_id = " + comboBoxPosition.SelectedValue.ToString() + " and linetype_id =" + comboBoxLineType.SelectedValue.ToString() + " and dept_id =" + comboBoxDept.SelectedValue.ToString();

            if (textEditNo.Text.ToString().Trim() != "" && textEditName.Text.ToString().Trim() != "" && comboBoxPosition.SelectedValue.ToString() != "0" && comboBoxDept.SelectedValue.ToString() != "0")
            {
                int rows  = conn.ReturnRecordCount(sql2);
                int rows2 = conn.ReturnRecordCount(sql3);
                if (rows > 0)
                {
                    MessageBox.Show("该工号已经存在!");
                }
                else if (rows2 > 0)
                {
                    MessageBox.Show("该人员已经存在!");
                }
                else
                {
                    bool isok = conn.EditDatabase(sql);
                    if (isok)
                    {
                        MessageBox.Show("修改成功!");
                        DirectLabourQuery.RefreshEX();
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("失败!");
                    }
                }
            }
            else
            {
                MessageBox.Show("不能为空值!");
            }
            conn.Close();
        }
Exemplo n.º 22
0
        private void simpleButtonOK_Click(object sender, EventArgs e)
        {
            ConnDB conn = new ConnDB();
            string leave_date, sql;

            if ((comboBoxStatus.Text.ToString() == "离职" || comboBoxStatus.Text.ToString() == "转正") && textEditLeaveDate.Text.ToString() == "")
            {
                MessageBox.Show("请先填写离职日期!");
            }
            else if (comboBoxStatus.Text.ToString() == "在职" && textEditLeaveDate.Text.ToString() != "")
            {
                MessageBox.Show("请去掉离职日期!");
            }
            else
            {
                if (textEditLeaveDate.Text.ToString() == "")
                {
                    sql = "update COST_TEMP_EMPLOYEE set cname = '" + textEditName.Text.ToString().Trim() + "',sex = '" + comboBoxSex.Text + "',register_date='" + dateTimePickerRegister.Text + "',leave_date=NULL,cfrom = '" + textEditFrom.Text.ToString().Trim() + "',from_type = '" + comboBoxType.SelectedValue.ToString() + "',dept1 = '" + comboBoxDept1.Text + "',dept2 = '" + comboBoxDept2.Text + "',dept3 = '" + comboBoxDept3.Text + "',dept = '" + comboBoxDept.Text + "',id_number = '" + textEditIdNumber.Text.ToString().Trim() + "',phone_no = '" + textEditPhone.Text.ToString().Trim() + "',shift = '" + comboBoxShift.Text + "',status = '" + comboBoxStatus.SelectedItem + "'";
                    sql = sql + " where cno = '" + textEditCno.Text.ToString() + "'";
                }
                else
                {
                    leave_date = textEditLeaveDate.Text.ToString();
                    sql        = "update COST_TEMP_EMPLOYEE set cname = '" + textEditName.Text.ToString().Trim() + "',sex = '" + comboBoxSex.Text + "',register_date='" + dateTimePickerRegister.Text + "',leave_date='" + leave_date + "',cfrom = '" + textEditFrom.Text.ToString().Trim() + "',from_type = '" + comboBoxType.SelectedValue.ToString() + "',dept1 = '" + comboBoxDept1.Text + "',dept2 = '" + comboBoxDept2.Text + "',dept3 = '" + comboBoxDept3.Text + "',dept = '" + comboBoxDept.Text + "',id_number = '" + textEditIdNumber.Text.ToString().Trim() + "',phone_no = '" + textEditPhone.Text.ToString().Trim() + "',shift = '" + comboBoxShift.Text + "',status = '" + comboBoxStatus.SelectedItem + "'";
                    sql        = sql + " where cno = '" + textEditCno.Text.ToString() + "'";
                }

                bool isok = conn.EditDatabase(sql);
                if (isok)
                {
                    MessageBox.Show("修改成功!");
                    TempEmpQuery.RefreshEX();
                    this.Close();
                }
                else
                {
                    MessageBox.Show("失败!");
                }
            }

            conn.Close();
        }
        private void showDetail()
        {
            ConnDB conn = new ConnDB();
            string strsql;
            int    deptid;

            deptid = (int)comboBoxDept.SelectedValue;
            if (deptid > 0)
            {
                strsql = "select isnull(i.cid,0) id,'" + dateEditDate.Text + "' 日期,d.cid 部门id,d.cname 部门,j.cid 直接人工id,j.cno 工号,j.cname 姓名,i.work_type_id 上班类型id,w.cname 上班类型,i.hours 小时数 from (select * from COST_DIRECT_LABOUR_ATTENDANCE where cdate = '" + dateEditDate.Text + "') i right join COST_DIRECT_LABOUR j on i.DIRECT_LABOUR_ID = j.CID left join COST_DEPT D on j.DEPT_ID = D.CID left join cost_work_type w on i.work_type_id = w.cid where j.person_type_id = 4 and D.cid = " + Common.IsZero(deptid.ToString()) + " order by d.cname";
            }
            else
            {
                strsql = "select isnull(i.cid,0) id,'" + dateEditDate.Text + "' 日期,d.cid 部门id,d.cname 部门,j.cid 直接人工id,j.cno 工号,j.cname 姓名,i.work_type_id 上班类型id,w.cname 上班类型,i.hours 小时数 from(select * from COST_DIRECT_LABOUR_ATTENDANCE where cdate = '" + dateEditDate.Text + "') i right join COST_DIRECT_LABOUR j on i.DIRECT_LABOUR_ID = j.CID left join COST_DEPT D on j.DEPT_ID = D.CID left join cost_work_type w on i.work_type_id = w.cid where j.person_type_id = 4 order by d.cname";
            }

            DataSet ds = conn.ReturnDataSet(strsql);

            gridControl1.DataSource      = ds.Tables[0].DefaultView;
            gridView1.Columns[0].Visible = false;
            gridView1.Columns[2].Visible = false;
            gridView1.Columns[4].Visible = false;
            gridView1.Columns[7].Visible = false;

            gridView1.Columns[0].OptionsColumn.ReadOnly = true;
            gridView1.Columns[1].OptionsColumn.ReadOnly = true;
            gridView1.Columns[2].OptionsColumn.ReadOnly = true;
            gridView1.Columns[3].OptionsColumn.ReadOnly = true;
            gridView1.Columns[4].OptionsColumn.ReadOnly = true;
            gridView1.Columns[5].OptionsColumn.ReadOnly = true;
            gridView1.Columns[6].OptionsColumn.ReadOnly = true;
            gridView1.Columns[7].OptionsColumn.ReadOnly = true;
            gridView1.Columns[8].OptionsColumn.ReadOnly = true;


            if (gridView1.GetDataRow(0) != null && gridView1.GetDataRow(0).ItemArray[7].ToString() != "0" && gridView1.GetDataRow(0).ItemArray[7].ToString() != "")
            {
                comboBoxWorkType.SelectedIndex = -1;
                comboBoxWorkType.SelectedValue = Convert.ToInt32(gridView1.GetDataRow(0).ItemArray[7].ToString());
            }
            conn.Close();
        }
Exemplo n.º 24
0
 public static void Save()
 {
     if (dlpiform == null || dlpiform.IsDisposed)
     {
     }
     else
     {
         ConnDB   conn = new ConnDB();
         string   strsql;
         bool     isok  = false;
         DateTime dt1   = Convert.ToDateTime(dlpiform.dateTimePicker1.Text);
         DateTime dt2   = System.DateTime.Now;
         int      month = (dt2.Year - dt1.Year) * 12 + (dt2.Month - dt1.Month);
         if (!dlpiform.Exist())
         {
             if (month < -1)
             {
                 MessageBox.Show("月份错误!");
             }
             else
             {
                 dlpiform.gridView1.FocusInvalidRow();
                 for (int i = 0; i < dlpiform.gridView1.RowCount; i++)
                 {
                     strsql = "insert into cost_direct_labour_price(yyyymm,work_type,price) values('" + dlpiform.dateTimePicker1.Text.ToString() + "'," + dlpiform.gridView1.GetDataRow(i).ItemArray[0].ToString() + "," + Common.IsNull(dlpiform.gridView1.GetDataRow(i).ItemArray[2].ToString()) + ")";
                     isok   = conn.EditDatabase(strsql);
                 }
                 if (isok)
                 {
                     MessageBox.Show("保存成功!");
                     DirectLabourPriceQuery.RefreshEX();
                 }
                 else
                 {
                     MessageBox.Show("失败!");
                 }
             }
         }
         dlpiform.ischange = false;
         conn.Close();
     }
 }
Exemplo n.º 25
0
        private void simpleButtonOK_Click(object sender, EventArgs e)
        {
            ConnDB conn = new ConnDB();
            string sql  = "update cost_standard_point set standard_point = ltrim(rtrim('" + textEditStandardPoint.Text.ToString() + "'))";

            sql = sql + " where cid = " + textEditID.Text.ToString();
            bool isok = conn.EditDatabase(sql);

            if (isok)
            {
                MessageBox.Show("修改成功!");
                StandardPointQuery.RefreshEX();
                this.Close();
            }
            else
            {
                MessageBox.Show("失败!");
            }
            conn.Close();
        }
Exemplo n.º 26
0
        private void Clear()
        {
            ConnDB conn = new ConnDB();
            string strsql;

            strsql = "delete from COST_EMS_HH_HOURS where  cdate like '" + dateTimePickerMonth.Text + "%'";
            bool isok = conn.EditDatabase(strsql);

            if (isok)
            {
                MessageBox.Show("该月HH产出工时已成功清空!");
                showDetail();
            }
            else
            {
                MessageBox.Show("失败!");
            }

            conn.Close();
        }
Exemplo n.º 27
0
        private void simpleButtonOK_Click(object sender, EventArgs e)
        {
            ConnDB conn = new ConnDB();
            string sql  = "update COST_COMPOSITE_EXPENSE set expense = ltrim(rtrim('" + textEditExpense.Text.ToString() + "'))";

            sql = sql + " where cid = " + textEditID.Text.ToString();
            bool isok = conn.EditDatabase(sql);

            if (isok)
            {
                MessageBox.Show("修改成功!");
                CompositeExpenseQuery.RefreshEX();
                this.Close();
            }
            else
            {
                MessageBox.Show("失败!");
            }
            conn.Close();
        }
Exemplo n.º 28
0
        private void showDetail()
        {
            ConnDB conn = new ConnDB();
            string strsql;
            string logname = "", personname = "", dept1 = "", dept2 = "", dept3 = "", dept = "", remark = "";
            int    cid = 0;

            UserQuery.GetInfo(ref cid, ref logname, ref personname, ref dept1, ref dept2, ref dept3, ref dept, ref remark);
            strsql = "select i.cid,p.cid,p.cname 角色,isnull(r.have_right,'false') ' ' from COST_user i cross join COST_role p left join COST_user_role r on i.CID = r.user_ID and p.CID = r.role_ID where i.cid = " + cid;
            DataSet ds = conn.ReturnDataSet(strsql);

            gridControl1.DataSource      = ds.Tables[0].DefaultView;
            gridView1.Columns[0].Visible = false;
            gridView1.Columns[1].Visible = false;
            gridView1.Columns[0].OptionsColumn.ReadOnly = true;
            gridView1.Columns[1].OptionsColumn.ReadOnly = true;
            gridView1.Columns[2].OptionsColumn.ReadOnly = true;

            conn.Close();
        }
Exemplo n.º 29
0
        private void simpleButtonOK_Click(object sender, EventArgs e)
        {
            ConnDB conn = new ConnDB();
            string sql  = "update cost_rate set cost_rate = ltrim(rtrim('" + Common.IsNull(textEditCostRate.Text.ToString()) + "'))";

            sql = sql + " where cid = " + textEditID.Text.ToString();
            bool isok = conn.EditDatabase(sql);

            if (isok)
            {
                MessageBox.Show("修改成功!");
                CostRateQuery.RefreshEX();
                this.Close();
            }
            else
            {
                MessageBox.Show("失败!");
            }
            conn.Close();
        }
Exemplo n.º 30
0
        private void showDetail()
        {
            ConnDB conn = new ConnDB();
            string strsql;

            strsql = "select cname as 名称,cbegin 开始时间,cend 结束时间,isnull(rest_hours,0) 休息时数,isnull(overtime_rest_hours,0) 加班后休息时数,overtime_begin 加班开始时间,forbidden 禁用 from cost_shift";
            DataSet ds = conn.ReturnDataSet(strsql);

            gridControl1.DataSource = ds.Tables[0].DefaultView;
            //gridView1.Columns[0].Visible = false;
            gridView1.Columns[0].OptionsColumn.ReadOnly = true;
            gridView1.Columns[1].OptionsColumn.ReadOnly = true;
            gridView1.Columns[2].OptionsColumn.ReadOnly = true;
            gridView1.Columns[3].OptionsColumn.ReadOnly = true;
            gridView1.Columns[4].OptionsColumn.ReadOnly = true;
            gridView1.Columns[5].OptionsColumn.ReadOnly = true;
            gridView1.Columns[6].OptionsColumn.ReadOnly = true;
            IsForbidden();
            conn.Close();
        }