Exemplo n.º 1
0
 public void reload()
 {
     label9.Text = "";
     toolTip1.SetToolTip(button1, "Close");
     mc = new MyConnection();
     mc.conn.Open();
     cmd = new SqlCommand("select count(POID) from PO;", mc.conn);
     dr  = cmd.ExecuteReader();
     if (dr.Read())
     {
         textBox1.Text = "PO-00" + (Convert.ToInt32(dr[0]) + 1).ToString() + "-2017";
     }
     dr.Close();
     comboBox1.Items.Clear();
     cmd = new SqlCommand("select PName from Products;", mc.conn);
     dr  = cmd.ExecuteReader();
     while (dr.Read())
     {
         comboBox1.Items.Add(dr["PName"]);
     }
     dr.Close();
     cmd = new SqlCommand("select VID from Vendor;", mc.conn);
     dr  = cmd.ExecuteReader();
     while (dr.Read())
     {
         comboBox2.Items.Add(dr["VID"]);
     }
     mc.conn.Close();
     label9.Text           = "";
     textBox3.Text         = "";
     textBox4.Text         = "";
     comboBox1.Text        = "";
     textBox5.Text         = "";
     textBox6.Text         = "";
     comboBox2.Text        = "";
     button2.Enabled       = false;
     button3.Enabled       = false;
     textBox6.Enabled      = false;
     comboBox1.Enabled     = false;
     dateTimePicker1.Value = System.DateTime.Now;
     dataGridView1.Rows.Clear();
     pid        = new string[100];
     pqty       = new int[100];
     grandTotal = 0;
     price      = 0;
     count      = 0;
 }
        public void reload()
        {
            comboBox1.Items.Clear();
            mc = new MyConnection();
            mc.conn.Open();
            cmd = new SqlCommand("select POID from PO where GoodsReceived='Yes' and POStatus='Open';", mc.conn);
            dr  = cmd.ExecuteReader();
            string[] poid  = new string[100];
            int      count = 0;

            while (dr.Read())
            {
                poid[count] = dr["POID"].ToString();
                count++;
            }
            dr.Close();
            for (int i = 0; i < count; i++)
            {
                cmd = new SqlCommand("select GRNID from GRN where POID='" + poid[i] + "';", mc.conn);
                dr  = cmd.ExecuteReader();
                if (dr.Read())
                {
                    comboBox1.Items.Add(dr["GRNID"]);
                }
                dr.Close();
            }
            cmd = new SqlCommand("select count(IPID) from InvoicePayable;", mc.conn);
            dr  = cmd.ExecuteReader();
            if (dr.Read())
            {
                textBox1.Text = (Convert.ToInt32(dr[0]) + 1).ToString();
            }

            mc.conn.Close();
            textBox2.Text  = "";
            textBox3.Text  = "";
            textBox4.Text  = "";
            textBox5.Text  = "";
            textBox6.Text  = "";
            textBox7.Text  = "";
            textBox8.Text  = "";
            comboBox1.Text = "";
            dataGridView1.Rows.Clear();
            button2.Enabled = false;
        }
Exemplo n.º 3
0
 public void showControl()
 {
     reload();
     comboBox1.Items.Clear();
     mc = new MyConnection();
     mc.conn.Open();
     cmd = new SqlCommand("select POID from PO where GoodsReceived='No' and POStatus='Open';", mc.conn);
     dr  = cmd.ExecuteReader();
     while (dr.Read())
     {
         comboBox1.Items.Add(dr["POID"]);
     }
     dr.Close();
     cmd = new SqlCommand("select count(GRNID) from GRN;", mc.conn);
     dr  = cmd.ExecuteReader();
     if (dr.Read())
     {
         sno           = (Convert.ToInt32(dr[0]) + 1);
         textBox7.Text = "GRN-00" + sno.ToString() + "-2017";
     }
     mc.conn.Close();
 }
Exemplo n.º 4
0
 public void showControl()
 {
     reload();
     comboBox1.Items.Clear();
     mc = new MyConnection();
     mc.conn.Open();
     cmd = new SqlCommand("select SOID from SO where GoodsDelivered='No';", mc.conn);
     dr  = cmd.ExecuteReader();
     while (dr.Read())
     {
         comboBox1.Items.Add(dr["SOID"]);
     }
     dr.Close();
     cmd = new SqlCommand("select count(DCID) from DC;", mc.conn);
     dr  = cmd.ExecuteReader();
     if (dr.Read())
     {
         sno           = (Convert.ToInt32(dr[0]) + 1);
         textBox6.Text = "DC-00" + sno.ToString() + "-2017";
     }
     mc.conn.Close();
 }
 private void CreateSalesOrder_Load(object sender, EventArgs e)
 {
     label9.Text = "";
     toolTip1.SetToolTip(button1, "Close");
     mc = new MyConnection();
     mc.conn.Open();
     cmd = new SqlCommand("select count(SOID) from SO;", mc.conn);
     dr  = cmd.ExecuteReader();
     if (dr.Read())
     {
         textBox1.Text = "SO-00" + (Convert.ToInt32(dr[0]) + 1).ToString() + "-2017";
     }
     dr.Close();
     cmd = new SqlCommand("select PName from Products;", mc.conn);
     dr  = cmd.ExecuteReader();
     while (dr.Read())
     {
         comboBox1.Items.Add(dr["PName"]);
     }
     mc.conn.Close();
     textBox3.KeyPress += keyPress;
     textBox6.KeyPress += keyPress;
 }
        public void select(string s)
        {
            dateTimePicker3.Visible = true;
            this.Visible            = true;
            selection = s;
            mc        = new MyConnection();
            if (selection == "Add")
            {
                comboBox1.Visible = false;
                textBox3.Visible  = false;
                textBox1.Visible  = true;
                comboBox2.Visible = true;
                textBox1.ReadOnly = true;
                button2.Text      = "Add";
                mc.conn.Open();
                comboBox1.Visible = false;
                textBox1.Visible  = true;
                cmd = new SqlCommand("select count(EID) from Emploee;", mc.conn);
                dr  = cmd.ExecuteReader();
                if (dr.Read())
                {
                    textBox1.Text = "EMP-00" + (Convert.ToInt32(dr[0]) + 1).ToString() + "-2017";
                }
                mc.conn.Close();
                textBox2.Text         = "";
                comboBox2.Text        = "";
                textBox4.Text         = "";
                textBox5.Text         = "";
                textBox6.Text         = "";
                textBox7.Text         = "";
                dateTimePicker1.Value = dateTimePicker2.Value = dateTimePicker3.Value = System.DateTime.Now;
                checkBox1.Checked     = false;
                comboBox2.Items.Clear();
                comboBox2.Items.Add("Male");
                comboBox2.Items.Add("Female");
                checkBox1.Visible        = true;
                dateTimePicker3.Location = new Point(143, 239);
                dateTimePicker3.Size     = new Size(194, 20);
                label9.Text             = "Date of fire if any?";
                textBox2.ReadOnly       = false;
                textBox3.ReadOnly       = false;
                textBox4.ReadOnly       = false;
                textBox5.ReadOnly       = false;
                textBox6.ReadOnly       = false;
                textBox7.ReadOnly       = false;
                dateTimePicker1.Enabled = true;
                dateTimePicker2.Enabled = true;
                dateTimePicker3.Enabled = true;
            }
            else if (selection == "Search")
            {
                textBox3.Visible      = true;
                comboBox2.Visible     = false;
                textBox2.Text         = "";
                textBox3.Text         = "";
                textBox4.Text         = "";
                textBox5.Text         = "";
                textBox6.Text         = "";
                textBox7.Text         = "";
                dateTimePicker1.Value = dateTimePicker2.Value = dateTimePicker3.Value = System.DateTime.Now;
                comboBox1.Items.Clear();
                button2.Text      = "Reset";
                textBox1.Visible  = false;
                comboBox1.Visible = true;
                textBox3.Visible  = true;
                comboBox2.Visible = false;
                mc.conn.Open();
                cmd = new SqlCommand("select EID from Emploee;", mc.conn);
                dr  = cmd.ExecuteReader();
                while (dr.Read())
                {
                    comboBox1.Items.Add(dr["EID"]);
                }
                mc.conn.Close();
                textBox2.ReadOnly        = true;
                textBox3.ReadOnly        = true;
                textBox4.ReadOnly        = true;
                textBox5.ReadOnly        = true;
                textBox6.ReadOnly        = true;
                textBox7.ReadOnly        = true;
                label9.Text              = "Date of fire";
                checkBox1.Visible        = false;
                dateTimePicker3.Location = new Point(94, 239);
                dateTimePicker3.Size     = new Size(243, 20);
                dateTimePicker1.Enabled  = false;
                dateTimePicker2.Enabled  = false;
                dateTimePicker3.Enabled  = false;
            }

            else if (selection == "Update")
            {
                textBox3.Visible      = true;
                comboBox2.Visible     = false;
                textBox2.Text         = "";
                textBox4.Text         = "";
                textBox5.Text         = "";
                textBox6.Text         = "";
                textBox7.Text         = "";
                dateTimePicker1.Value = dateTimePicker2.Value = dateTimePicker3.Value = System.DateTime.Now;
                comboBox2.Text        = "";
                comboBox1.Text        = "";
                comboBox1.Items.Clear();
                mc.conn.Open();
                cmd = new SqlCommand("select EID from Emploee;", mc.conn);
                dr  = cmd.ExecuteReader();
                while (dr.Read())
                {
                    comboBox1.Items.Add(dr["EID"]);
                }
                mc.conn.Close();
                button2.Text      = "Update";
                textBox1.Visible  = false;
                comboBox1.Visible = true;
                textBox3.Visible  = false;
                comboBox2.Visible = true;
                comboBox2.Items.Clear();
                comboBox2.Items.Add("Male");
                comboBox2.Items.Add("Female");
                checkBox1.Visible        = true;
                checkBox1.Checked        = false;
                dateTimePicker3.Location = new Point(143, 239);
                dateTimePicker3.Size     = new Size(194, 20);
                label9.Text             = "Date of fire if any?";
                dateTimePicker2.Enabled = true;
                dateTimePicker2.Enabled = true;
                dateTimePicker3.Enabled = false;
                textBox2.ReadOnly       = false;
                textBox3.ReadOnly       = false;
                textBox4.ReadOnly       = false;
                textBox5.ReadOnly       = false;
                textBox6.ReadOnly       = false;
                textBox7.ReadOnly       = false;
            }
        }
Exemplo n.º 7
0
 public void select(string s)
 {
     selection      = s;
     comboBox1.Text = "";
     textBox1.Text  = "";
     textBox2.Text  = "";
     textBox3.Text  = "";
     textBox4.Text  = "";
     textBox5.Text  = "";
     textBox6.Text  = "";
     textBox7.Text  = "";
     mc             = new MyConnection();
     mc.conn.Open();
     if (selection == "Add")
     {
         comboBox1.Visible = false;
         textBox1.Visible  = true;
         cmd = new SqlCommand("select count(VID) from Vendor;", mc.conn);
         dr  = cmd.ExecuteReader();
         if (dr.Read())
         {
             textBox1.Text = "VEN-00" + (Convert.ToInt32(dr[0]) + 1).ToString() + "-2017";
         }
         mc.conn.Close();
         textBox1.ReadOnly = true;
         textBox7.Text     = "Active";
         button2.Visible   = true;
         button2.Text      = "Add";
         textBox2.ReadOnly = false;
         textBox3.ReadOnly = false;
         textBox4.ReadOnly = false;
         textBox5.ReadOnly = false;
         textBox6.ReadOnly = false;
     }
     else if (selection == "Search")
     {
         comboBox1.Items.Clear();
         comboBox1.Visible = true;
         textBox1.Visible  = false;
         button2.Visible   = true;
         button2.Text      = "Reset";
         cmd = new SqlCommand("select VID from Vendor;", mc.conn);
         dr  = cmd.ExecuteReader();
         while (dr.Read())
         {
             comboBox1.Items.Add(dr["VID"]);
         }
         mc.conn.Close();
         textBox2.ReadOnly = true;
         textBox3.ReadOnly = true;
         textBox4.ReadOnly = true;
         textBox5.ReadOnly = true;
         textBox6.ReadOnly = true;
     }
     else if (selection == "Update")
     {
         comboBox1.Items.Clear();
         cmd = new SqlCommand("select VID from Vendor;", mc.conn);
         dr  = cmd.ExecuteReader();
         while (dr.Read())
         {
             comboBox1.Items.Add(dr["VID"]);
         }
         mc.conn.Close();
         comboBox1.Visible = true;
         textBox1.Visible  = false;
         button2.Text      = "Update";
         button2.Visible   = true;
         textBox2.ReadOnly = false;
         textBox3.ReadOnly = false;
         textBox4.ReadOnly = false;
         textBox5.ReadOnly = false;
         textBox6.ReadOnly = false;
     }
 }