Exemplo n.º 1
0
        private void txt_Item_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                if (Row <= 0)
                {
                    MessageBox.Show(PublicFunction.L_Get_Msg("msg", 214));
                    txt_item.Focus();
                    return;
                }
                if (!ok)
                {
                    MessageBox.Show(PublicFunction.L_Get_Msg("msg", 213));
                    txt_WID.Focus();
                    return;
                }
                Double vl  = T_String.IsNullTo00(txt_item.Text + "");
                string sql = "Update FILD02A SET [" + vs.Rows[Row]["COL_NM"] + "]=" + vl +
                             " where YYY_MM=N'" + dt.Text + "' and EMP_ID=N'" + EMP_ID + "'";
                if (r1.Checked)
                {
                    sql += " and SEQ_NO=1";
                }
                else
                {
                    sql += " and SEQ_NO=2";
                }
                string st = "";
                if (checkBox1.Checked)
                {
                    st = DWID.Text + ": " + txt_WID.Text + " \n ";
                }
                else
                {
                    st = WID.Text + ": " + txt_WID.Text + " \n ";
                }
                st += txt_Name.Text + "\n" + lb.Text + ": " + txt_item.Text + "\n ";
                if (PublicFunction.SQL_Execute(sql, true) == 0)
                {
                    lb1.Text = st + PublicFunction.L_Get_Msg("Staff", 1);
                }
                else
                {
                    lb1.Text = st + PublicFunction.L_Get_Msg("Staff", 2);
                    return;
                }
                Double max = T_String.GetMax0("MAX(ID)", "GP_HISTORYINPUTPIECERATE");
                sql = "Insert Into GP_HISTORYINPUTPIECERATE values(" + max + ",N'" + dt.Text + "',N'"
                      + vs.Rows[Row]["COL_NM"] + "'," + vl + ",N'" + PublicFunction.A_UserID + "','"
                      + T_String.GetDate().ToString("yyyy/MM/dd HH:mm") + "')";
                PublicFunction.SQL_Execute(sql);
                vs2.Rows.Count++;
                vs2.Rows[vs2.Rows.Count - 1][0]        = vs2.Rows.Count - 1;
                vs2.Rows[vs2.Rows.Count - 1]["YYY_MM"] = dt.Text;
                vs2.Rows[vs2.Rows.Count - 1]["EMP_ID"] = EMP_ID;
                vs2.Rows[vs2.Rows.Count - 1]["EMP_I1"] = EMP_I1;
                vs2.Rows[vs2.Rows.Count - 1]["EMP_NM"] = txt_Name.Text;
                vs2.Rows[vs2.Rows.Count - 1]["COL_NM"] = lb.Text;
                vs2.Rows[vs2.Rows.Count - 1]["COL_VL"] = vl;
                vs2.AutoSizeCols();

                txt_Name.Text = "";
                txt_Dep.Text  = "";
                txt_INH.Text  = "";
                txt_WID.Text  = "";
                txt_item.Text = "";
                txt_WID.Focus();
            }
        }