private void TotalStockReport_Load(object sender, EventArgs e) { SqlConnection con = new SqlConnection("Data Source=Dolon-PC;Initial Catalog=Medical;Integrated Security=True"); SqlCommand cmd = new SqlCommand("SELECT I_name FROM StockInMst", con); con.Open(); SqlDataReader reader = cmd.ExecuteReader(); AutoCompleteStringCollection SCollection = new AutoCompleteStringCollection(); while (reader.Read()) { SCollection.Add(reader.GetString(0)); } txtiname.AutoCompleteCustomSource = SCollection; con.Close(); SDT = SAdapter.SelectStock(); GVReports.DataSource = SDT; //SqlCommand cmdd = new SqlCommand("SELECT cname FROM companymst", con); //con.Open(); //SqlDataReader readerr = cmdd.ExecuteReader(); //AutoCompleteStringCollection SCollectionn = new AutoCompleteStringCollection(); //while (readerr.Read()) //{ // SCollectionn.Add(readerr.GetString(0)); //} //txtcname.AutoCompleteCustomSource = SCollectionn; //con.Close(); }
private void tabControl1_SelectedIndexChanged(object sender, EventArgs e) { if (tabControl1.SelectedIndex == 0) { CDT = CAdapter.SelectComapny(); cmbdompany.DataSource = CDT; cmbdompany.DisplayMember = "Cname"; cmbdompany.ValueMember = "Cid"; cmbdompany.Text = "SELECT"; } else if (tabControl1.SelectedIndex == 1) { // IDT = IAdapter.SelectItem(); SDT = SAdapter.SelectStock(); comboBox1.DataSource = SDT; comboBox1.DisplayMember = "Iname"; comboBox1.ValueMember = "s_ID"; comboBox1.Text = "SELECT"; } else if (tabControl1.SelectedIndex == 2) { // IDT = IAdapter.SelectItem(); SDT = SAdapter.SelectStock(); comboBox2.DataSource = SDT; comboBox2.DisplayMember = "Iname"; comboBox2.ValueMember = "s_ID"; comboBox2.Text = "SELECT"; } else if (tabControl1.SelectedIndex == 3) { IDT = IAdapter.SelectItem(); dataGridView1.DataSource = IDT; } }
private void button3_Click(object sender, EventArgs e) { if (MessageBox.Show("Are you sure !! You want to Delete Stock !!", "Medical system", MessageBoxButtons.OKCancel) == DialogResult.OK) { int del = SAdapter.Delete(Convert.ToInt32(comboBox2.SelectedValue)); int dellitem = IAdapter.Delete(comboBox2.Text); MessageBox.Show("Item Deleted Successfully !!", "Medical System"); SDT = SAdapter.SelectStock(); comboBox2.DataSource = SDT; comboBox2.DisplayMember = "Iname"; comboBox2.ValueMember = "s_ID"; comboBox2.Text = "SELECT"; } }
private void txtq_Leave(object sender, EventArgs e) { if (txtq.Text != "") { StockDT = StockAdapter.SelectBY_INAME(label8.Text); IDT = IAdapter.SelectByINmae(label8.Text); if (StockDT.Rows.Count > 0) { if (StockDT.Rows[0]["AvailableQuantity"].ToString() == "0") { MessageBox.Show("No Enought Quantity !!", "Medical System"); } else { SDT = SAdapter.SelectBY_NAME(label8.Text); if (SDT.Rows.Count > 0) { SDT = SAdapter.SelectBY_NAME(label8.Text); int exiqnt = Convert.ToInt32(SDT.Rows[0]["Quantity"].ToString()); int qntt = exiqnt + Convert.ToInt32(txtq.Text); if (Convert.ToInt32(StockDT.Rows[0]["AvailableQuantity"].ToString()) > qntt) { // int QNT = Convert.ToInt32(SDT.Rows[0]["Quantity"].ToString()) + 1; double TPRICE = Convert.ToInt32(SDT.Rows[0]["Price"].ToString()) * qntt; int existsalseupdate = SAdapter.Update(label8.Text, qntt.ToString(), TPRICE); SDT = SAdapter.SelectBy_PNAME(txtpname.Text); gpdispatch.Visible = true; gvsales.AutoGenerateColumns = false; gvsales.DataSource = SDT; SUMDT = SUMAdapter.SelectTotla(); lblqnt.Text = SUMDT.Rows[0]["qnt"].ToString(); lbltprice.Text = SUMDT.Rows[0]["Tprice"].ToString(); } else { MessageBox.Show("No Enought Quantity", "Medical system"); } } } } } }
private void txtiname_Leave(object sender, EventArgs e) { if (txtiname.Text != "") { label8.Text = txtiname.Text; StockDT = StockAdapter.SelectBY_INAME(txtiname.Text); IDT = IAdapter.SelectByINmae(txtiname.Text); if (StockDT.Rows.Count > 0) { if (StockDT.Rows[0]["AvailableQuantity"].ToString() == "0") { MessageBox.Show("No Enought Quantity !!", "Medical System"); } else { SDT = SAdapter.SelectBY_NAME(txtiname.Text); if (SDT.Rows.Count > 0) { SDT = SAdapter.SelectBY_NAME(txtiname.Text); int exiqnt = Convert.ToInt32(SDT.Rows[0]["Quantity"].ToString()); if (Convert.ToInt32(StockDT.Rows[0]["AvailableQuantity"].ToString()) > exiqnt) { int QNT = Convert.ToInt32(SDT.Rows[0]["Quantity"].ToString()) + 1; double TPRICE = Convert.ToInt32(SDT.Rows[0]["Price"].ToString()) * QNT; int existsalseupdate = SAdapter.Update(txtiname.Text, QNT.ToString(), TPRICE); } else { MessageBox.Show("No Enought Quantity", "Medical system"); } } else { lblq.Text = StockDT.Rows[0]["AvailableQuantity"].ToString(); lblp.Text = IDT.Rows[0]["I_Price"].ToString(); lbll.Text = IDT.Rows[0]["I_location"].ToString(); txtq.Text = "1"; double tprice = Convert.ToDouble(IDT.Rows[0]["I_Price"].ToString()); int salinst = SAdapter.Insert(txtpname.Text, txtiname.Text, tprice, 1, tprice); } SDT = SAdapter.SelectBy_PNAME(txtpname.Text); gpdispatch.Visible = true; gvsales.AutoGenerateColumns = false; gvsales.DataSource = SDT; SUMDT = SUMAdapter.SelectTotla(); lblqnt.Text = SUMDT.Rows[0]["qnt"].ToString(); lbltprice.Text = SUMDT.Rows[0]["Tprice"].ToString(); } gpdispatch.Visible = true; } else { MessageBox.Show("Item Not Available !!", "Medical System"); } } // txtiname.Text = ""; // txtiname.Focus(); }
private void btnitemsearch_Click(object sender, EventArgs e) { //SDT = SAdapter.SelectBY_INAME(txtiname.Text); SDT = SAdapter.SelectBY_INAME(txtiname.Text); GVReports.DataSource = SDT; }
private void button4_Click(object sender, EventArgs e) { SDT = SAdapter.SelectBY_INAME(comboBox1.Text); txtcurentqnt.Text = SDT.Rows[0]["totalQuantity"].ToString(); }