private void cmbBoxVATCodes_SelectedIndexChanged(object sender, EventArgs e) { sqlconnectionclass selectusers = new sqlconnectionclass(); DR1 = selectusers.ReadDB("select * from VAT where VAT_Codes='" + cmbBoxVATCodes.Text + "'"); //DataTable dt = new DataTable(); while (DR1.Read()) { string VAT_Percentage = (string)DR1["VAT_Percentage"].ToString(); textBoxRates.Text = VAT_Percentage; } }
void fill_combo1() { cmbBoxVATCodes.Items.Clear(); sqlconnectionclass selectusers = new sqlconnectionclass(); DR1 = selectusers.ReadDB("select * from VAT"); if (DR1.HasRows) { while (DR1.Read()) { cmbBoxVATCodes.Items.Add(DR1[0]); } } }
//this is for searchbox(combobox) void fill_combo3() { txtSearch.Items.Clear(); sqlconnectionclass selectusers = new sqlconnectionclass(); DR1 = selectusers.ReadDB("select * from Products "); if (DR1.HasRows) { while (DR1.Read()) { txtSearch.Items.Add(DR1[0] + ":" + DR1[1] + "-" + DR1[10]); } } }
void fill_combo2() { cmbBoxParkageMode.Items.Clear(); sqlconnectionclass selectusers = new sqlconnectionclass(); DR1 = selectusers.ReadDB("select * from Packaging"); if (DR1.HasRows) { while (DR1.Read()) { cmbBoxParkageMode.Items.Add(DR1[0]); } } }
private void cmbBusinessname_SelectedIndexChanged(object sender, EventArgs e) { sqlconnectionclass selectpid = new sqlconnectionclass(); DR1 = selectpid.ReadDB("select BussinessName,credit_customerID from Credit_Customers where BussinessName= '" + cmbBusinessname.Text + "'"); if (DR1.HasRows) { DR1.Read(); pid = DR1["credit_customerID"].ToString(); sqlconnectionclass selecttousers = new sqlconnectionclass(); DR = selecttousers.ReadDB("select ((select ISNULL(SUM(amount), 0)as availab from Credit_sales where credit_customerID= '" + pid + "')-(select ISNULL(SUM(amount), 0)as qty from creditPayment where credit_customerID= '" + pid + "')) As available from Credit_Customers where credit_customerID='" + pid + "'"); //DR = selecttousers.ReadDB("(select ISNULL(SUM(amount), 0) from credit_sales)-(select ISNULL(SUM(amount), 0) from creditPayment)"); if (DR.Read()) { balancetxt.Text = DR[0].ToString(); } } }
private void itemsearchBox1_SelectedIndexChanged(object sender, EventArgs e) { sqlconnectionclass selectpid = new sqlconnectionclass(); DR1 = selectpid.ReadDB("select ProductNo,vat_rate from Products where productname= '" + itemsearchBox1.Text + "'"); if (DR1.HasRows) { DR1.Read(); pid = DR1["ProductNo"].ToString(); sqlconnectionclass selecttousers = new sqlconnectionclass(); DR = selecttousers.ReadDB("select ProductName,(select top 1 unitprice from stockin where productno = '" + pid + "' ORDER BY rep_no DESC ) as currentprice,((select isnull(sum(qty),0)as availab from stockin where ProductNo= '" + pid + "')-(select isnull(sum(sqty),0)as qty from sales where ProductNo= '" + pid + "')) As available from products where ProductNo='" + pid + "'"); while (DR.Read()) { string ProductName = (string)DR["ProductName"].ToString();; textBoxProductName.Text = ProductName; string RetailPrice = (string)DR["currentprice"].ToString(); label11.Visible = true; label12.Visible = true; label12.Text = "KES " + RetailPrice; textBox1.Text = DR[2].ToString(); //itemsearchBox1.Text = ""; } sqlconnectionclass getstatus = new sqlconnectionclass(); dr2 = getstatus.ReadDB("select count(*) from stockin where productno='" + pid + "'"); if (dr2.HasRows) { dr2.Read(); if (Convert.ToInt32(dr2[0]) > 0) { rdunknown.Checked = false; } else { rdunknown.Checked = true; } } } //textBoxQuantity.Text; }
private void Search() { //throw new NotImplementedException(); textBoxSearch.Text = listBox1.SelectedValue.ToString(); sqlconnectionclass selectpid = new sqlconnectionclass(); DR = selectpid.ReadDB("select ProductNo from Products where productno='" + textBoxSearch.Text.Split(':')[0] + "'"); if (DR.HasRows) { DR.Read(); pid = DR["ProductNo"].ToString(); sqlconnectionclass selectpd = new sqlconnectionclass(); DR1 = selectpd.ReadDB("select (select top 1 unitprice from stockin where productno = '" + pid + "' ORDER BY rep_no DESC ) as currentprice,vat_rate,((select isnull(sum(qty),0)as availab from stockin where ProductNo= '" + pid + "')-(select isnull(sum(sqty),0)as qty from sales where ProductNo= '" + pid + "')) As available from Products where ProductNo= '" + pid + "'"); if (DR1.HasRows) { DR1.Read(); textBox2.Text = DR1[0].ToString(); textBox8.Text = DR1[2].ToString(); //textBox4.Text = DR1[0].ToString(); Vatrate = Convert.ToDouble(DR1[1]); } } }