示例#1
0
        private void IndirectLabourUpdate_Load(object sender, EventArgs e)
        {
            string cno = "", cname = "", positionname = "", deptname = "";
            int    id = 0, positionid = 0, deptid = 0, person_level = 0;

            IndirectLabourQuery.GetInfo(ref id, ref cno, ref cname, ref positionid, ref positionname, ref person_level, ref deptid, ref deptname);
            PositionBind();
            Common.BasicDataBind("cost_dept", comboBoxDept);
            ConnDB conn  = new ConnDB();
            string sql   = "select * from cost_dept where cid = " + deptid + " and isnull(forbidden,'false') = 'true'";
            int    rows  = conn.ReturnRecordCount(sql);
            string sql2  = "select * from cost_position where cid = " + positionid + " and isnull(forbidden,'false') = 'true'";
            int    rows2 = conn.ReturnRecordCount(sql);

            if (cno != "")
            {
                textEditNo.Text    = cno;
                textEditName.Text  = cname;
                textEditLevel.Text = person_level.ToString();
                if (rows == 0)
                {
                    comboBoxDept.SelectedIndex = -1;
                    comboBoxDept.SelectedValue = deptid;
                }
                if (rows2 == 0)
                {
                    comboBoxPosition.SelectedIndex = -1;
                    comboBoxPosition.SelectedValue = positionid;
                }
                textEditID.Text = id.ToString();
            }
        }
示例#2
0
        private void simpleButton导入_Click(object sender, EventArgs e)
        {
            simpleButton导入.Enabled = false;
            simpleButton清空.Enabled = false;
            ConnDB conn  = new ConnDB();
            string file  = textEditFile.Text.ToString().Trim();
            string sheet = comboBoxSheet.Text.ToString();
            string sql   = "select * from COST_HH_STANDARD_HOURS where cmonth = '" + dateTimePickerMonth.Text + "'";
            int    rows  = conn.ReturnRecordCount(sql);

            if (rows > 0)
            {
                MessageBox.Show("该月标工已经存在,要重新导入,请先清空该月数据!");
                simpleButton导入.Enabled = true;
                simpleButton清空.Enabled = true;
            }
            else if (file == "")
            {
                MessageBox.Show("没有选择文件", "提示信息", MessageBoxButtons.OK);
                simpleButton导入.Enabled = true;
                simpleButton清空.Enabled = true;
            }
            else if (sheet == "")
            {
                MessageBox.Show("请选择EXCEL表", "提示信息", MessageBoxButtons.OK);
                simpleButton导入.Enabled = true;
                simpleButton清空.Enabled = true;
            }
            else
            {
                MethodCaller mc     = new MethodCaller(Import);
                IAsyncResult result = mc.BeginInvoke(file, sheet, AsyncShowDetail, mc);
            }
        }
示例#3
0
        private void simpleButtonOK_Click(object sender, EventArgs e)
        {
            ConnDB conn = new ConnDB();
            string strsql, strsql2, password, log_name, person_name, dept1, dept2, dept3, dept, remark;
            int    rows;

            log_name    = textEditLogName.Text.ToString().Trim();
            password    = Common.MD5Encrypt(textEditPsw.Text.ToString().Trim());
            person_name = textEditName.Text.ToString().Trim();
            dept1       = comboBoxDept1.Text.ToString();
            dept2       = comboBoxDept2.Text.ToString();
            dept3       = comboBoxDept3.Text.ToString();
            dept        = comboBoxDept.Text.ToString();
            remark      = textEditRemark.Text.ToString().Trim();
            if (dept1 == "请选择")
            {
                dept1 = "";
            }
            if (dept2 == "请选择")
            {
                dept2 = "";
            }
            if (dept3 == "请选择")
            {
                dept3 = "";
            }
            if (dept == "请选择")
            {
                dept = "";
            }
            strsql  = "insert into cost_user(CNAME,PASSWORD,PERSON_NAME,DEPT1,DEPT2,DEPT3,DEPT,remark) values('" + log_name + "','" + password + "','" + person_name + "','" + dept1 + "','" + dept2 + "','" + dept3 + "','" + dept + "','" + remark + "')";
            strsql2 = "select cname from cost_user where cname = '" + textEditLogName.Text.ToString().Trim() + "'";
            if (log_name != "" && textEditPsw.Text.ToString().Trim() != "")
            {
                rows = conn.ReturnRecordCount(strsql2);
                if (rows > 0)
                {
                    MessageBox.Show("该用户已经存在!");
                }
                else
                {
                    bool isok = conn.EditDatabase(strsql);
                    if (isok)
                    {
                        MessageBox.Show("添加成功!");
                        UserQuery.RefreshEX();
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("失败!");
                    }
                }
            }
            else
            {
                MessageBox.Show("不能为空!");
            }
            conn.Close();
        }
        private void simpleButtonOK_Click(object sender, EventArgs e)
        {
            ConnDB conn = new ConnDB();
            string strsql, strsql2;
            int    rows;

            strsql  = "insert into cost_steel_net_rate(yyyymm,steel_net_rate) values('" + dateTimePicker1.Text.ToString() + "',ltrim(rtrim(" + textEditSteelNetRate.Text.ToString() + ")))";
            strsql2 = "select yyyymm from cost_steel_net_rate where yyyymm ='" + dateTimePicker1.Text.ToString() + "'";
            if (textEditSteelNetRate.Text.ToString() != "")
            {
                rows = conn.ReturnRecordCount(strsql2);
                if (rows > 0)
                {
                    MessageBox.Show("该钢网占比已经存在!");
                }
                else
                {
                    bool isok = conn.EditDatabase(strsql);
                    if (isok)
                    {
                        MessageBox.Show("添加成功!");
                        SteelNetRateQuery.RefreshEX();
                        this.Close();
                    }
                }
            }
            else
            {
                MessageBox.Show("钢网占比不能为空!");
            }
            conn.Close();
        }
示例#5
0
        private void simpleButtonOK_Click(object sender, EventArgs e)
        {
            ConnDB conn = new ConnDB();
            string sql  = "update cost_shift set cname = '" + textEditName.Text.ToString().Trim() + "',cbegin = '" + dateTimePickerBegin.Text + "',cend = '" + dateTimePickerEnd.Text + "',rest_hours = '" + textEditRest.Text.ToString().Trim() + "',overtime_rest_hours = '" + textEditOvertimeRest.Text.ToString().Trim() + "',overtime_begin = '" + dateTimePickerOvertimeBegin.Text.ToString() + "' where cname ='" + cname + "'";
            string sql2 = "select cname from cost_shift where cname = '" + textEditName.Text.ToString().Trim() + "'";

            if (textEditName.Text.ToString().Trim() != "")
            {
                int rows = conn.ReturnRecordCount(sql2);
                if (rows > 0 && textEditName.Text.ToString().Trim() != cname)
                {
                    MessageBox.Show("该考勤班次已经存在!");
                }
                else
                {
                    bool isok = conn.EditDatabase(sql);
                    if (isok)
                    {
                        MessageBox.Show("修改成功!");
                        ShiftQuery.RefreshEX();
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("失败!");
                    }
                }
            }
            else
            {
                MessageBox.Show("名称不能为空!");
            }
            conn.Close();
        }
示例#6
0
        private void simpleButtonOK_Click(object sender, EventArgs e)
        {
            ConnDB conn = new ConnDB();
            string strsql, strsql2;
            int    rows;

            strsql  = "insert into cost_festival(festival_date,festival_type,festival_note) values('" + dateTimePickerDate.Text.ToString() + "','" + comboBoxType.SelectedValue.ToString() + "','" + textEditNote.Text.ToString().Trim() + "')";
            strsql2 = "select * from cost_festival where festival_date = '" + dateTimePickerDate.Text.ToString() + "'";
            if (textEditNote.Text.ToString().Trim() != "")
            {
                rows = conn.ReturnRecordCount(strsql2);
                if (rows > 0)
                {
                    MessageBox.Show("该日期已经存在!");
                }
                else
                {
                    bool isok = conn.EditDatabase(strsql);
                    if (isok)
                    {
                        MessageBox.Show("添加成功!");
                        FestivalQuery.RefreshEX();
                        this.Close();
                    }
                }
            }
            else
            {
                MessageBox.Show("不能为空!");
            }
            conn.Close();
        }
示例#7
0
        private void simpleButtonOK_Click(object sender, EventArgs e)
        {
            ConnDB conn = new ConnDB();
            string strsql, strsql2;
            int    rows;

            strsql  = "insert into cost_role(CNAME) values('" + textEditName.Text.ToString().Trim() + "')";
            strsql2 = "select cname from cost_role where cname = '" + textEditName.Text.ToString().Trim() + "'";
            if (textEditName.Text.ToString().Trim() != "")
            {
                rows = conn.ReturnRecordCount(strsql2);
                if (rows > 0)
                {
                    MessageBox.Show("该角色已经存在!");
                }
                else
                {
                    bool isok = conn.EditDatabase(strsql);
                    if (isok)
                    {
                        MessageBox.Show("添加成功!");
                        RoleQuery.RefreshEX();
                        this.Close();
                    }
                }
            }
            else
            {
                MessageBox.Show("名称不能为空!");
            }
            conn.Close();
        }
示例#8
0
        private void simpleButtonOK_Click(object sender, EventArgs e)
        {
            ConnDB conn = new ConnDB();
            string strsql, strsql2;
            int    rows;

            strsql  = "insert into cost_shift(cname,cbegin,cend,rest_hours,overtime_rest_hours,overtime_begin) values('" + textEditName.Text.ToString().Trim() + "','" + dateTimePickerBegin.Text.ToString() + "','" + dateTimePickerEnd.Text.ToString() + "','" + textEditRest.Text.ToString().Trim() + "','" + textEditOverTimeRest.Text.ToString().Trim() + "','" + dateTimePickerOvertimeBegin.Text.ToString() + "')";
            strsql2 = "select cname from cost_shift where cname = '" + textEditName.Text.ToString().Trim() + "'";
            if (textEditName.Text.ToString().Trim() != "")
            {
                rows = conn.ReturnRecordCount(strsql2);
                if (rows > 0)
                {
                    MessageBox.Show("该考勤班次已经存在!");
                }
                else
                {
                    bool isok = conn.EditDatabase(strsql);
                    if (isok)
                    {
                        MessageBox.Show("添加成功!");
                        ShiftQuery.RefreshEX();
                        this.Close();
                    }
                }
            }
            else
            {
                MessageBox.Show("名称不能为空!");
            }
            conn.Close();
        }
示例#9
0
        /// <summary>
        /// 营业类型点数
        /// </summary>
        private void ImportPointSum(string month)
        {
            ConnDB conn = new ConnDB();
            string strsql, strsql2, sqldel;
            int    rows;

            //string month = DateTime.Now.ToString("yyyy-MM");
            //string month = "2017-10";
            strsql = "insert into cost_pointcount_sum(cdate, saletype_id, pointcount) ";
            strsql = strsql + "select CONVERT(varchar(100), cdate, 23) as cdate, saletypeid, sum(cast(生产总点数 as decimal(18, 2)))  pointcount from ";
            strsql = strsql + "(select cdate,工单号,saletype, 装配件描述, 生产总点数 =case when saletype = 'shl' and 工单号 like '%-ws' then cast(生产总点数 as decimal(18,2))*3.56 else 生产总点数 end, saletypeid = case when(saletype = 'HCL' AND CODE2 IS null and 装配件描述 not like '【HBTG专用%') OR CODE2 = 'HCL' then 2 else 10 end from ";
            strsql = strsql + "(select cdate,工单号,saletype, 装配件描述, 生产总点数 from openquery (LINKERPNEW, 'select 日期 as cdate,工单号, organization_code as saletype,装配件描述,生产总点数  from CUX_SMT_PROD_RP where (装配件描述  not like ''%F1专用%'' and   装配件描述 not like ''%F1 TB%'') and to_char(日期,''yyyy-mm'')=''" + month + "'' ')) i ";
            strsql = strsql + "left join (select d.*, o.CODE, O2.CODE CODE2 from COST_SPECIAL_DEAL d left join cost_organization o on d.ORGANIZATION_ID = o.CID left join cost_organization o2 on d.TO_ORGANIZATION_ID = o2.CID where d.YYYYMM = '" + month + "') j ";
            strsql = strsql + "on i.装配件描述 like '%' + j.TASK_NAME + '%' and i.saletype = j.CODE) t ";
            strsql = strsql + "group by cdate, saletypeid order by cdate";

            strsql2 = "select * from cost_pointcount_sum where cdate like '%" + month + "%'";
            sqldel  = "delete from cost_pointcount_sum where cdate like '%" + month + "%'";
            rows    = conn.ReturnRecordCount(strsql2);
            if (rows > 0)
            {
                conn.EditDatabase(sqldel);
                conn.EditDatabase(strsql);
            }
            else
            {
                conn.EditDatabase(strsql);
            }
            conn.Close();
        }
示例#10
0
        private void simpleButtonOK_Click(object sender, EventArgs e)
        {
            ConnDB conn = new ConnDB();
            string strsql, strsql2;
            int    rows;

            strsql  = "insert into cost_transfer(cdate,sale_type_id,transfer_type,hours) values('" + dateEditDate.Text.ToString() + "','" + Common.IsZero(comboBoxSaleType.SelectedValue.ToString()) + "','" + Common.IsZero(comboBoxTransferType.SelectedValue.ToString()) + "'," + textEditHours.Text.ToString().Trim() + ")";
            strsql2 = "select cdate from cost_transfer where cdate ='" + dateEditDate.Text.ToString() + "' and sale_type_id = " + comboBoxSaleType.SelectedValue.ToString() + " and transfer_type = " + comboBoxTransferType.SelectedValue.ToString();
            if (textEditHours.Text.ToString() != "")
            {
                rows = conn.ReturnRecordCount(strsql2);
                if (rows > 0)
                {
                    MessageBox.Show("此转嫁工时已经存在!");
                }
                else
                {
                    bool isok = conn.EditDatabase(strsql);
                    if (isok)
                    {
                        MessageBox.Show("添加成功!");
                        CostTransferQuery.RefreshEX();
                        this.Close();
                    }
                }
            }
            else
            {
                MessageBox.Show("转嫁工时不能为空!");
            }
            conn.Close();
        }
        private void simpleButtonOK_Click(object sender, EventArgs e)
        {
            ConnDB conn = new ConnDB();
            string strsql, strsql2;
            int    rows;

            strsql  = "insert into cost_product_quantity(cdate,type,product_quantity) values('" + dateEditDate.Text.ToString() + "',2," + textEditQuantity.Text.ToString().Trim() + ")";
            strsql2 = "select cdate from cost_product_quantity where cdate ='" + dateEditDate.Text.ToString() + "' and type = 2";
            if (textEditQuantity.Text.ToString() != "")
            {
                rows = conn.ReturnRecordCount(strsql2);
                if (rows > 0)
                {
                    MessageBox.Show("此日期记录已经存在!");
                }
                else
                {
                    bool isok = conn.EditDatabase(strsql);
                    if (isok)
                    {
                        MessageBox.Show("添加成功!");
                        ChannelQuantityQuery.RefreshEX();
                        this.Close();
                    }
                }
            }
            else
            {
                MessageBox.Show("信道数量不能为空!");
            }
            conn.Close();
        }
示例#12
0
        private void simpleButtonOK_Click(object sender, EventArgs e)
        {
            ConnDB conn = new ConnDB();
            string sql  = "update COST_TEMP_EMPLOYEE_price set begin_date = '" + dateTimePickerBegin.Text + "',end_date='" + dateTimePickerEnd.Text + "',price='" + Common.IsNull(textEditPrice.Text.ToString().Trim()) + "',insurance_price='" + Common.IsNull(textEditInsurance.Text.ToString().Trim()) + "'";

            sql = sql + " where cid =  '" + id + "'";
            string sql2 = "select * from cost_temp_employee_price where cid <> '" + id + "' and type = 2 and not (begin_date > '" + dateTimePickerEnd.Text.ToString() + "' or end_date <'" + dateTimePickerBegin.Text.ToString() + "')";
            int    rows = conn.ReturnRecordCount(sql2);

            if (rows > 0)
            {
                MessageBox.Show("此时间范围的记录已经存在!");
            }
            else
            {
                bool isok = conn.EditDatabase(sql);
                if (isok)
                {
                    MessageBox.Show("修改成功!");
                    TempEmpStandardPriceQuery.RefreshEX();
                    this.Close();
                }
                else
                {
                    MessageBox.Show("失败!");
                }
            }
            conn.Close();
        }
示例#13
0
        private void simpleButtonOK_Click(object sender, EventArgs e)
        {
            ConnDB conn = new ConnDB();
            string sql  = "update COST_TEMP_EMPLOYEE_price set supplier = '" + textEditSupplier.Text.ToString().Trim() + "',begin_date = '" + dateTimePickerBegin.Text + "',end_date='" + dateTimePickerEnd.Text + "',from_type='" + comboBoxType.SelectedValue.ToString() + "',price='" + Common.IsNull(textEditPrice.Text.ToString().Trim()) + "',meal_price='" + Common.IsNull(textEditMeal.Text.ToString().Trim()) + "',night_price='" + Common.IsNull(textEditNight.Text.ToString().Trim()) + "',travel_price='" + Common.IsNull(textEditTravel.Text.ToString().Trim()) + "',regular_price='" + Common.IsNull(textEditRegular.Text.ToString().Trim()) + "'";

            sql = sql + " where cid =  '" + id + "'";
            string sql2 = "select * from cost_temp_employee_price where cid <> '" + id + "' and supplier = '" + textEditSupplier.Text.ToString().Trim() + "' and not (begin_date > '" + dateTimePickerEnd.Text.ToString() + "' or end_date <'" + dateTimePickerBegin.Text.ToString() + "') and from_type = '" + comboBoxType.SelectedValue.ToString() + "' and type =1";
            int    rows = conn.ReturnRecordCount(sql2);

            if (rows > 0)
            {
                MessageBox.Show("此时间范围的价格信息已经存在!");
            }
            else
            {
                bool isok = conn.EditDatabase(sql);
                if (isok)
                {
                    MessageBox.Show("修改成功!");
                    TempEmpPriceQuery.RefreshEX();
                    this.Close();
                }
                else
                {
                    MessageBox.Show("失败!");
                }
            }
            conn.Close();
        }
示例#14
0
        private void simpleButtonOK_Click(object sender, EventArgs e)
        {
            ConnDB conn = new ConnDB();
            string sql  = "update cost_festival set festival_date = '" + dateEditDate.Text + "',festival_type = '" + comboBoxType.SelectedValue.ToString() + "',festival_note = '" + textEditNote.Text.ToString().Trim() + "' where festival_date ='" + cdate + "'";
            string sql2 = "select * from cost_festival where festival_date = '" + dateEditDate.Text + "'";

            if (textEditNote.Text.ToString().Trim() != "")
            {
                int rows = conn.ReturnRecordCount(sql2);
                if (rows > 0 && dateEditDate.Text != cdate)
                {
                    MessageBox.Show("该日期已经存在!");
                }
                else
                {
                    bool isok = conn.EditDatabase(sql);
                    if (isok)
                    {
                        MessageBox.Show("修改成功!");
                        FestivalQuery.RefreshEX();
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("失败!");
                    }
                }
            }
            else
            {
                MessageBox.Show("名称不能为空!");
            }
            conn.Close();
        }
示例#15
0
        private void LineTypeUpdate_Load(object sender, EventArgs e)
        {
            //this.WindowState = FormWindowState.Maximized;
            string cname = "", cnamemes = "", saletypename = "", workshop = "";
            int    id = 0, saletypeid = 0, workshopid = 0;
            ConnDB conn = new ConnDB();

            LineTypeQuery.GetInfo(ref id, ref cname, ref cnamemes, ref saletypeid, ref saletypename, ref workshopid, ref workshop);
            string sql  = "select * from cost_saletype where cid = " + saletypeid + " and isnull(forbidden,'false') = 'true'";
            int    rows = conn.ReturnRecordCount(sql);

            Common.BasicDataBind("cost_saletype", comboBoxSaleType);
            BindWorkShop();
            if (cname != "" || cnamemes != "")
            {
                textEditName.Text    = cname;
                textEditNameMes.Text = cnamemes;
                if (rows == 0)
                {
                    comboBoxSaleType.SelectedIndex = -1;
                    comboBoxSaleType.SelectedValue = saletypeid;
                }
                comboBoxWorkShop.SelectedIndex = -1;
                comboBoxWorkShop.SelectedValue = workshopid;
                textEditID.Text         = id.ToString();
                textEditSaleTypeID.Text = saletypeid.ToString();
            }
        }
示例#16
0
        private void Import()
        {
            ConnDB conn = new ConnDB();
            string strsql, strsql2;
            int    rows;

            //strsql = "select CONVERT(varchar(100), cdate, 23) as cdate,linetype,pointcount from openquery (LINKERP, 'select 日期 as cdate, 生产线别 as linetype,sum(生产总点数) as pointcount from CUX_SMT_PROD_RP where 工单类型 = ''正常'' and to_char(日期,''yyyy-mm'')=''" + dateTimePickerMonth.Text + "'' group by 日期, 生产线别 order by 日期')";
            strsql  = "insert into cost_pointcount(cdate,line_type_name,pointcount) select CONVERT(varchar(100), cdate, 23) as cdate,linetype,pointcount from openquery (LINKERPNEW, 'select 日期 as cdate, 生产线别 as linetype,sum(生产总点数) as pointcount from CUX_SMT_PROD_RP where  to_char(日期,''yyyy-mm'')=''" + dateTimePickerMonth.Text + "'' group by 日期, 生产线别 order by 日期')";
            strsql2 = "select * from cost_pointcount where cdate like '%" + dateTimePickerMonth.Text + "%'";
            rows    = conn.ReturnRecordCount(strsql2);
            if (rows > 0)
            {
                MessageBox.Show("该月点数已经存在,要重新导入,请先清空该月数据!");
            }
            else
            {
                bool isok = conn.EditDatabase(strsql);
                if (isok)
                {
                    MessageBox.Show("导入成功!");
                    showDetailLocal();
                }
                else
                {
                    MessageBox.Show("失败!");
                }
            }
            conn.Close();
        }
示例#17
0
        private void simpleButtonOK_Click(object sender, EventArgs e)
        {
            ConnDB conn = new ConnDB();
            string sql  = "update cost_saletype set cname = ltrim(rtrim('" + textEditNew.Text.ToString() + "')) where cname = ltrim(rtrim('" + textEditOld.Text.ToString() + "'))";
            string sql2 = "select cname from cost_saletype where cname = LTRIM(rtrim('" + textEditNew.Text.ToString() + "'))";

            if (textEditNew.Text.ToString().Trim() != "")
            {
                int rows = conn.ReturnRecordCount(sql2);
                if (rows > 0)
                {
                    MessageBox.Show("该营业类型已经存在!");
                }
                else
                {
                    bool isok = conn.EditDatabase(sql);
                    if (isok)
                    {
                        MessageBox.Show("修改成功!");
                        SaleTypeQuery.RefreshEX();
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("失败!");
                    }
                }
            }
            else
            {
                MessageBox.Show("新值不能为空!");
            }
            conn.Close();
        }
        private void simpleButtonOK_Click(object sender, EventArgs e)
        {
            ConnDB conn = new ConnDB();
            string sql  = "update COST_EXPENSE set emp_no = '" + textEditEmpno.Text.ToString().Trim() + "',begin_date = '" + dateTimePickerDate.Text + "',expense='" + Common.IsNull(textEditPrice.Text.ToString().Trim()) + "'";

            sql = sql + " where cid =  '" + id + "'";
            string sql2 = "select * from COST_EXPENSE where cid <> '" + id + "' and emp_no = '" + textEditEmpno.Text.ToString().Trim() + "' and begin_date = '" + dateTimePickerDate.Text.ToString() + "'  and ctype =2";
            int    rows = conn.ReturnRecordCount(sql2);

            if (rows > 0)
            {
                MessageBox.Show("该员工这天的交通补贴信息已经存在!");
            }
            else
            {
                bool isok = conn.EditDatabase(sql);
                if (isok)
                {
                    MessageBox.Show("修改成功!");
                    TempEmpTravelExpenseQuery.RefreshEX();
                    this.Close();
                }
                else
                {
                    MessageBox.Show("失败!");
                }
            }
            conn.Close();
        }
示例#19
0
        private void simpleButtonOK_Click(object sender, EventArgs e)
        {
            ConnDB conn = new ConnDB();
            string strsql, strsql2;
            int    rows;

            strsql  = "insert into cost_ems_hh_hours(cdate,hours) values('" + dateEditDate.Text.ToString() + "',ltrim(rtrim(" + textEditHours.Text.ToString() + ")))";
            strsql2 = "select cdate from cost_ems_hh_hours where cdate ='" + dateEditDate.Text.ToString() + "'";
            if (textEditHours.Text.ToString() != "")
            {
                rows = conn.ReturnRecordCount(strsql2);
                if (rows > 0)
                {
                    MessageBox.Show("此日期产出工时已经存在!");
                }
                else
                {
                    bool isok = conn.EditDatabase(strsql);
                    if (isok)
                    {
                        MessageBox.Show("添加成功!");
                        EmsHhHoursQuery.RefreshEX();
                    }
                }
            }
            else
            {
                MessageBox.Show("产出工时不能为空!");
            }
            conn.Close();
        }
示例#20
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();
        }
示例#21
0
        private void simpleButtonOK_Click(object sender, EventArgs e)
        {
            ConnDB conn = new ConnDB();
            string strsql, strsql2, log_name, dept1, dept2, dept3;
            int    rows;

            log_name = textEditLogName.Text.ToString().Trim();
            dept1    = comboBoxDept1.Text.ToString();
            dept2    = comboBoxDept2.Text.ToString();
            dept3    = comboBoxDept3.Text.ToString();
            if (dept1 == "请选择")
            {
                dept1 = "";
            }
            if (dept2 == "请选择")
            {
                dept2 = "";
            }
            if (dept3 == "请选择")
            {
                dept3 = "";
            }

            strsql  = "insert into cost_check_dept(log_name,DEPT1,DEPT2,DEPT3) values('" + log_name + "','" + dept1 + "','" + dept2 + "','" + dept3 + "')";
            strsql2 = "select * from cost_check_dept where log_name = '" + log_name + "' and dept1 = '" + dept1 + "' and dept2 = '" + dept2 + "' and dept3 ='" + dept3 + "'";
            if (log_name != "")
            {
                rows = conn.ReturnRecordCount(strsql2);
                if (rows > 0)
                {
                    MessageBox.Show("该记录已经存在!");
                }
                else
                {
                    bool isok = conn.EditDatabase(strsql);
                    if (isok)
                    {
                        MessageBox.Show("添加成功!");
                        UserDeptCheckQuery.RefreshEX();
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("失败!");
                    }
                }
            }
            else
            {
                MessageBox.Show("不能为空!");
            }
            conn.Close();
        }
示例#22
0
        /// <summary>
        /// 从System.Data.DataTable导入数据到数据库
        /// </summary>
        /// <param name="dt"></param>
        /// <returns></returns>
        private int UpdateData(DataTable dt)
        {
            int    i = 0;
            string cno = "", dept2 = "", dept3 = "", dept = "", leave_date = "", shift = "", status = "", sql = "";
            ConnDB conn = new ConnDB();
            bool   err  = false;

            foreach (DataRow dr in dt.Rows)
            {
                if (dr["临时工号"].ToString().Trim() == null || dr["临时工号"].ToString().Trim() == "")
                {
                    MessageBox.Show("临时工号格式有错误!");
                    err = true;
                    break;
                }
                sql = "select * from COST_SHIFT where cname = '" + dr["班次"].ToString().Trim() + "'";
                int count = conn.ReturnRecordCount(sql);
                if (count == 0)
                {
                    string msg = "班次:" + dr["班次"].ToString().Trim() + ",与考勤班次中现有的班次格式不一致!";
                    MessageBox.Show(msg);
                    err = true;
                    break;
                }
            }
            if (!err)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    cno        = dr["临时工号"].ToString().Trim();
                    dept2      = dr["二级部门"].ToString().Trim();
                    dept3      = dr["三级部门"].ToString().Trim();
                    dept       = dr["部门"].ToString().Trim();
                    leave_date = dr["离职日期"].ToString().Trim();
                    shift      = dr["班次"].ToString().Trim();
                    status     = dr["状态"].ToString().Trim();
                    if (leave_date == "")
                    {
                        sql = "update i set i.leave_date = NULL,i.dept2 = '" + dept2 + "',i.dept3 = '" + dept3 + "',i.dept = '" + dept + "',i.shift = '" + shift + "',i.status = '" + status + "' from cost_temp_employee i where cno = '" + cno + "'";
                    }
                    else
                    {
                        sql = "update i set i.leave_date = '" + leave_date + "',i.dept2 = '" + dept2 + "',i.dept3 = '" + dept3 + "',i.dept = '" + dept + "',i.shift = '" + shift + "',i.status = '" + status + "' from cost_temp_employee i where cno = '" + cno + "'";
                    }

                    conn.EditDatabase(sql);
                    i++;
                }
            }
            conn.Close();
            return(i);
        }
示例#23
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();
        }
        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();
        }
示例#25
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();
        }
示例#26
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);
        }
示例#27
0
        private bool Exist()
        {
            ConnDB conn = new ConnDB();
            string strsql;
            int    rows;

            strsql = "select * from COST_INDIRECT_LABOUR_LEVEL_PRICE where YYYYMM = '" + dateTimePicker1.Text.ToString() + "' and level_begin = " + Common.IsNull(ilpiform.textEditLevelBegin.Text.ToString().Trim()) + " and level_end = " + Common.IsNull(ilpiform.textEditLevelEnd.Text.ToString().Trim());
            rows   = conn.ReturnRecordCount(strsql);
            if (rows > 0)
            {
                labelControlCheck.Text = "该数据已经存在!";
                gridControl1.Enabled   = false;
                return(true);
            }
            else
            {
                labelControlCheck.Text = "";
                gridControl1.Enabled   = true;
                return(false);
            }
        }
        private bool Exist()
        {
            ConnDB conn = new ConnDB();
            string strsql;
            int    rows;

            strsql = "select * from cost_direct_labour_price where YYYYMM = '" + dateTimePicker1.Text.ToString() + "'";
            rows   = conn.ReturnRecordCount(strsql);
            if (rows > 0)
            {
                labelControlCheck.Text = "该月数据已经存在!";
                gridControl1.Enabled   = false;
                return(true);
            }
            else
            {
                labelControlCheck.Text = "";
                gridControl1.Enabled   = true;
                return(false);
            }
        }
        private bool Exist()
        {
            ConnDB conn = new ConnDB();
            string strsql;
            int    rows;

            strsql = "select * from cost_indirect_labour_price i left join cost_direct_labour j on i.indirect_labour_id = j.cid where isnull(YYYYMM,'') ='" + dateTimePicker1.Text.ToString() + "' and j.dept_id = " + comboBoxDept.SelectedValue.ToString() + " and indirect_labour_id = " + comboBoxIndirectLabour.SelectedValue.ToString();
            rows   = conn.ReturnRecordCount(strsql);
            if (rows > 0)
            {
                labelControlCheck.Text = "该人员数据已经存在!";
                gridControl1.Enabled   = false;
                return(true);
            }
            else
            {
                labelControlCheck.Text = "";
                gridControl1.Enabled   = true;
                return(false);
            }
        }
        private void simpleButtonOK_Click(object sender, EventArgs e)
        {
            ConnDB conn = new ConnDB();
            string strsql, strsql2;
            int    rows;

            strsql  = "insert into cost_direct_labour(CNO,CNAME,POSITION_ID,DEPT_ID,PERSON_LEVEL,PERSON_TYPE_ID,FORBIDDEN) values(LTRIM(rtrim('" + textEditNo.Text.ToString().Trim() + "')),LTRIM(rtrim('" + textEditName.Text.ToString().Trim() + "'))," + comboBoxPosition.SelectedValue.ToString() + "," + comboBoxDept.SelectedValue.ToString() + "," + textEditLevel.Text.ToString().Trim() + ",4,0)";
            strsql2 = "select cname from cost_direct_labour where cno = LTRIM(rtrim('" + textEditNo.Text.ToString().Trim() + "'))";
            if (textEditLevel.Text.ToString().Trim() == "")
            {
                MessageBox.Show("员工等级不能为空!");
            }
            else if (textEditNo.Text.ToString() != "")
            {
                rows = conn.ReturnRecordCount(strsql2);
                if (rows > 0)
                {
                    MessageBox.Show("该人员已经存在!");
                }
                else
                {
                    bool isok = conn.EditDatabase(strsql);
                    if (isok)
                    {
                        MessageBox.Show("添加成功!");
                        IndirectLabourQuery.RefreshEX();
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("失败!");
                    }
                }
            }
            else
            {
                MessageBox.Show("工号不能为空!");
            }
            conn.Close();
        }