Example #1
0
        private void ShowDetail()
        {
            string yyyymm = "";
            int    id = 0, level_begin = 0, level_end = 0;

            InDirectLabourLevelPriceQuery.GetInfo(ref id, ref yyyymm, ref level_begin, ref level_end);
            string strsql;

            if (yyyymm != "")
            {
                ConnDB conn = new ConnDB();
                strsql = "select i.cid id,i.yyyymm 年月,i.level_begin '员工等级(起)',i.level_end '员工等级(止)',j.CID,j.CNAME 上班类型,i.price '费率(元/小时)' from (select * from cost_indirect_labour_level_price where isnull(YYYYMM,'') ='" + yyyymm + "' and level_begin = " + level_begin + " and level_end = " + level_end + ") 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[0].Visible = false;
                gridView1.Columns[4].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;
                conn.Close();
            }
        }
Example #2
0
        public static void Save()
        {
            ConnDB conn = new ConnDB();
            string sql;
            bool   isok = false;
            string yyyymm = "";
            int    id = 0, level_begin = 0, level_end = 0;

            InDirectLabourLevelPriceQuery.GetInfo(ref id, ref yyyymm, ref level_begin, ref level_end);
            if (yyyymm != "")
            {
                dlpuform.gridView1.FocusInvalidRow();
                for (int i = 0; i < dlpuform.gridView1.RowCount; i++)
                {
                    sql  = "update cost_indirect_labour_level_price set price = " + dlpuform.gridView1.GetDataRow(i).ItemArray[6].ToString() + " where cid = " + dlpuform.gridView1.GetDataRow(i).ItemArray[0].ToString();
                    isok = conn.EditDatabase(sql);
                }
            }
            if (isok)
            {
                MessageBox.Show("修改成功!");
                InDirectLabourLevelPriceQuery.RefreshEX();
                dlpuform.Close();
            }
            else
            {
                MessageBox.Show("失败!");
            }
            dlpuform.ischange = false;
            conn.Close();
            dlpuform.Close();
            InDirectLabourLevelPrice.savetype = "insert";
        }
 public static InDirectLabourLevelPriceQuery GetInstance()
 {
     if (dlpqform == null || dlpqform.IsDisposed)
     {
         dlpqform = new InDirectLabourLevelPriceQuery();
     }
     return(dlpqform);
 }
Example #4
0
        private void barButtonItem查询_ItemClick(object sender, ItemClickEventArgs e)
        {
            InDirectLabourLevelPriceQuery Frm = InDirectLabourLevelPriceQuery.GetInstance();

            Frm.TopLevel = false;
            Frm.Parent   = this;
            Frm.Show();
            Frm.BringToFront();
        }
Example #5
0
        private void DirectLabourPrice_Load(object sender, EventArgs e)
        {
            this.WindowState = FormWindowState.Maximized;
            InDirectLabourLevelPriceQuery Frm = InDirectLabourLevelPriceQuery.GetInstance();

            Frm.TopLevel = false;
            Frm.Parent   = this;
            Frm.Show();
            Frm.BringToFront();
            Frm.Height = this.Height - 20;
        }
Example #6
0
 public static void Save()
 {
     if (ilpiform == null || ilpiform.IsDisposed)
     {
     }
     else
     {
         ConnDB   conn = new ConnDB();
         string   strsql;
         bool     isok  = false;
         DateTime dt1   = Convert.ToDateTime(ilpiform.dateTimePicker1.Text);
         DateTime dt2   = System.DateTime.Now;
         int      month = (dt2.Year - dt1.Year) * 12 + (dt2.Month - dt1.Month);
         if (ilpiform.textEditLevelBegin.Text.ToString().Trim() == "" || ilpiform.textEditLevelEnd.Text.ToString().Trim() == "")
         {
             MessageBox.Show("员工等级不能为空!");
         }
         else if (!ilpiform.Exist())
         {
             if (month < -1)
             {
                 MessageBox.Show("月份错误!");
             }
             else
             {
                 ilpiform.gridView1.FocusInvalidRow();
                 for (int i = 0; i < ilpiform.gridView1.RowCount; i++)
                 {
                     strsql = "insert into COST_INDIRECT_LABOUR_LEVEL_PRICE(yyyymm,level_begin,level_end,work_type,price) values('" + ilpiform.dateTimePicker1.Text.ToString() + "'," + ilpiform.textEditLevelBegin.Text.ToString().Trim() + "," + ilpiform.textEditLevelEnd.Text.ToString().Trim() + "," + ilpiform.gridView1.GetDataRow(i).ItemArray[0].ToString() + "," + Common.IsNull(ilpiform.gridView1.GetDataRow(i).ItemArray[2].ToString()) + ")";
                     isok   = conn.EditDatabase(strsql);
                 }
                 if (isok)
                 {
                     MessageBox.Show("保存成功!");
                     InDirectLabourLevelPriceQuery.RefreshEX();
                     ilpiform.Close();
                 }
                 else
                 {
                     MessageBox.Show("失败!");
                 }
             }
         }
         else
         {
             MessageBox.Show("该数据已经存在!");
         }
         ilpiform.ischange = false;
         conn.Close();
     }
 }
Example #7
0
        private void barButtonItem修改_ItemClick(object sender, ItemClickEventArgs e)
        {
            string yyyymm = "";
            int    id = 0, level_begin = 0, level_end = 0;

            InDirectLabourLevelPriceQuery.GetInfo(ref id, ref yyyymm, ref level_begin, ref level_end);
            if (yyyymm != "")
            {
                InDirectLabourLevelPriceUpdate Frm = InDirectLabourLevelPriceUpdate.GetInstance();
                Frm.TopLevel = false;
                Frm.Parent   = this;
                Frm.Show();
                Frm.BringToFront();
            }
        }
Example #8
0
        private void simpleButton复制_Click(object sender, EventArgs e)
        {
            MessageBoxButtons messButton = MessageBoxButtons.OKCancel;
            DialogResult      dr         = MessageBox.Show("将按最近的月度数据自动新增当前选择月份的数据,确认复制吗?", "复制最近月份数据", messButton);

            if (dr == DialogResult.OK)
            {
                ConnDB   conn = new ConnDB();
                string   strsql;
                int      rows;
                bool     isok  = false;
                DateTime dt1   = Convert.ToDateTime(ilpiform.dateTimePicker1.Text);
                DateTime dt2   = System.DateTime.Now;
                int      month = (dt2.Year - dt1.Year) * 12 + (dt2.Month - dt1.Month);
                strsql = "select * from COST_INDIRECT_LABOUR_LEVEL_PRICE where YYYYMM = '" + dateTimePicker1.Text.ToString() + "'";
                rows   = conn.ReturnRecordCount(strsql);
                if (rows > 0)
                {
                    MessageBox.Show("该月度间接人工费率已经存在!");
                }
                else if (month < -1)
                {
                    MessageBox.Show("月份错误!");
                }
                else
                {
                    strsql = "insert into COST_INDIRECT_LABOUR_LEVEL_PRICE(yyyymm,level_begin,level_end,work_type,price) select '" + ilpiform.dateTimePicker1.Text + "',level_begin,level_end,work_type,price from COST_INDIRECT_LABOUR_LEVEL_PRICE where YYYYMM = (select Max(yyyymm) from COST_INDIRECT_LABOUR_LEVEL_PRICE) ";
                    isok   = conn.EditDatabase(strsql);
                    if (isok)
                    {
                        MessageBox.Show("复制成功!");
                        InDirectLabourLevelPriceQuery.RefreshEX();
                        this.Close();
                    }
                }
                conn.Close();
            }
            //Exist();
            //ShowDetail();
        }
Example #9
0
 private void barButtonItem刷新_ItemClick(object sender, ItemClickEventArgs e)
 {
     InDirectLabourLevelPriceQuery.RefreshEX();
 }