private void button1_Click(object sender, EventArgs e) { double imageWidth, cPrice = 0; if (double.TryParse(textBox1.Text, out imageWidth)) { cPrice = imageWidth; } if (cPrice > 0) { StockMgntRef.StockMgntClient client = new StockMgntRef.StockMgntClient(); var msg = client.SetCylPrice(selectedCy.CylinderType, cPrice); if (msg.Equals("OK")) { MessageBox.Show("Successfully Updated Price of Product '" + selectedCy.CylinderType + "' . New price is " + cPrice + " Rs."); } cylinders = client.GetCylinders().ToList(); } else { textBox2.Text = cPrice.ToString(); MessageBox.Show("Invalid Price!!!"); } textBox1.Text = ""; comboBox1.Items.Clear(); string[] cyTypes = cylinders.Where(x => x.Price != 0).Select(x => x.CylinderType).ToArray(); comboBox1.Items.AddRange(cyTypes); }
private void button2_Click(object sender, EventArgs e) { double imageWidth, sPrice = 0; if (double.TryParse(textBox2.Text, out imageWidth)) { sPrice = imageWidth; } if (sPrice > 0) { StockMgntRef.StockMgntClient client = new StockMgntRef.StockMgntClient(); var msg = client.SetStovePrice(selectedStove.Product, sPrice); if (msg.Equals("OK")) { MessageBox.Show("Successfully Updated Price of Product '" + selectedStove.Product + "' . New price is " + sPrice + " Rs."); } stoves = client.GetStoves().ToList(); } else { textBox2.Text = sPrice.ToString(); MessageBox.Show("Invalid Price!!!"); } textBox2.Text = ""; comboBox2.Items.Clear(); string[] stoveTypes = stoves.Where(x => x.Price != 0).Select(x => x.Product).ToArray(); comboBox2.Items.AddRange(stoveTypes); }
private void button2_Click(object sender, EventArgs e) { int tbQty = int.Parse(textBox6.Text); if (tbQty != roldQty) { StockMgntRef.StockMgntClient client = new StockMgntRef.StockMgntClient(); TransactionMgnt.TransactionMgntClient client1 = new TransactionMgnt.TransactionMgntClient(); var msg1 = client1.AddRegulatorTx(tbQty); var msg = client.SetRegulators(tbQty + roldQty); if (msg.Equals("OK") && msg1.Equals("OK")) { MessageBox.Show("Your new Regulator stock is " + (tbQty + roldQty)); } else { MessageBox.Show("Some error occured!!"); } } else { MessageBox.Show("You have not changed Regulator stock!!!"); } textBox6.Text = null; }
private void BillStoveRegulator_Load(object sender, EventArgs e) { Location = new Point(-7, 50); int w = SystemInformation.VirtualScreen.Width + 14; int h = SystemInformation.VirtualScreen.Height - 43; Size = new Size(w, h); dataGridView1.DefaultCellStyle.Font = new System.Drawing.Font("Microsoft Sans Serif", 10); dataGridView2.DefaultCellStyle.Font = new System.Drawing.Font("Microsoft Sans Serif", 10); dataGridView3.DefaultCellStyle.Font = new System.Drawing.Font("Microsoft Sans Serif", 10); using (StockMgntRef.StockMgntClient client = new StockMgntRef.StockMgntClient()) { stoves = client.GetStoves().ToList(); List <StockMgntRef.Stove> stoveTypes = stoves.Where(x => x.Price != 0).Select(x => x).ToList(); dataGridView2.DataSource = stoveTypes; } using (CustomerMgntRef.CustomerMgntClient client1 = new CustomerMgntRef.CustomerMgntClient()) { customersNames = client1.GetCustomersName(); AutoCompleteStringCollection acsc = new AutoCompleteStringCollection(); acsc.AddRange(customersNames); textBox1.AutoCompleteMode = AutoCompleteMode.Suggest; textBox1.AutoCompleteSource = AutoCompleteSource.CustomSource; textBox1.AutoCompleteCustomSource = acsc; } }
private void AddStoveandRegulator_Load(object sender, EventArgs e) { Location = new Point(-7, 50); int w = SystemInformation.VirtualScreen.Width + 14; int h = SystemInformation.VirtualScreen.Height - 43; Size = new Size(w, h); dataGridView1.DefaultCellStyle.Font = new Font("Microsoft Sans Serif", 10); using (StockMgntRef.StockMgntClient client = new StockMgntRef.StockMgntClient()) { dataGridView1.DataSource = client.GetStoves(); stoves = client.GetStoves().ToList(); if (stoves.Count >= 10) { textBox3.Enabled = false; textBox4.Enabled = false; textBox5.Enabled = false; button3.Enabled = false; } string[] stoveTypes = stoves.Where(x => x.Price != 0).Select(x => x.Product).ToArray(); comboBox2.Items.AddRange(stoveTypes); comboBox1.Items.AddRange(stoveTypes); var reg = client.GetRegulators(); roldQty = reg.Quentity; //textBox6.Text = roldQty.ToString(); label16.Text = roldQty + " piece(s)"; } }
private void button3_Click(object sender, EventArgs e) { StockMgntRef.Stove stove = new StockMgntRef.Stove(); stove.Product = textBox3.Text; stove.Price = double.Parse(textBox5.Text); stove.Quentity = int.Parse(textBox4.Text); StockMgntRef.StockMgntClient client = new StockMgntRef.StockMgntClient(); TransactionMgnt.TransactionMgntClient client1 = new TransactionMgnt.TransactionMgntClient(); var msg = client.AddStove(stove); var msg1 = client1.AddStoveTx(textBox3.Text, int.Parse(textBox4.Text)); if (msg.Equals("OK") && msg1.Equals("OK")) { MessageBox.Show("Successfully added new product."); } dataGridView1.DataSource = client.GetStoves(); stoves = client.GetStoves().ToList(); string[] stoveTypes = stoves.Where(x => x.Price != 0).Select(x => x.Product).ToArray(); comboBox1.Items.Clear(); comboBox2.Items.Clear(); comboBox2.Items.AddRange(stoveTypes); comboBox1.Items.AddRange(stoveTypes); textBox4.Text = ""; textBox5.Text = ""; }
private void AddCylinder_Load(object sender, EventArgs e) { Location = new Point(-7, 50); int w = SystemInformation.VirtualScreen.Width + 14; int h = SystemInformation.VirtualScreen.Height - 43; Size = new Size(w, h); dataGridView1.DefaultCellStyle.Font = new Font("Microsoft Sans Serif", 10); using (StockMgntRef.StockMgntClient client = new StockMgntRef.StockMgntClient()) { dataGridView1.DataSource = client.GetCylinders(); cylinders = client.GetCylinders().ToList(); string[] cyTypes = cylinders.Where(x => x.Price != 0).Select(x => x.CylinderType).ToArray(); comboBox1.Items.AddRange(cyTypes); } }
private void button1_Click(object sender, EventArgs e) { StockMgntRef.StockMgntClient client = new StockMgntRef.StockMgntClient(); TransactionMgnt.TransactionMgntClient client1 = new TransactionMgnt.TransactionMgntClient(); var fr = client.SetFCylinders(selectedFType, int.Parse(textBox1.Text)); var er = client.SetECylinders(selectedEType, int.Parse(textBox1.Text)); var msg1 = client1.AddCylenderTx(comboBox1.Text, int.Parse(textBox1.Text)); if (fr.Equals("OKF") && er.Equals("OKE") && msg1.Equals("OK")) { MessageBox.Show("Stock is Updated"); } cylinders = client.GetCylinders().ToList(); dataGridView1.DataSource = cylinders; textBox1.Text = ""; }
private void button1_Click(object sender, EventArgs e) { StockMgntRef.StockMgntClient client = new StockMgntRef.StockMgntClient(); TransactionMgnt.TransactionMgntClient client1 = new TransactionMgnt.TransactionMgntClient(); int total = int.Parse(textBox1.Text) + soldQty; var msg = client.SetStoves(comboBox1.Text, total); var msg1 = client1.AddStoveTx(comboBox1.Text, int.Parse(textBox1.Text)); if (msg.Equals("OK") && msg1.Equals("OK")) { MessageBox.Show("Your new stock for product '" + comboBox1.Text + "' is " + total); } textBox1.Text = ""; stoves = client.GetStoves().ToList(); comboBox1.DataSource = stoves; dataGridView1.DataSource = stoves; }
private void button4_Click(object sender, EventArgs e) { StockMgntRef.StockMgntClient client = new StockMgntRef.StockMgntClient(); var msg = client.RemoveStove(comboBox2.Text); if (msg.Equals("OK")) { MessageBox.Show("Successfully removed product."); } dataGridView1.DataSource = client.GetStoves(); stoves = client.GetStoves().ToList(); string[] stoveTypes = stoves.Where(x => x.Price != 0).Select(x => x.Product).ToArray(); comboBox1.Items.Clear(); comboBox2.Items.Clear(); comboBox2.Items.AddRange(stoveTypes); comboBox1.Items.AddRange(stoveTypes); }
private void ViewStock_Load(object sender, EventArgs e) { Location = new Point(-7, 50); int w = SystemInformation.VirtualScreen.Width + 14; int h = SystemInformation.VirtualScreen.Height - 43; Size = new Size(w, h); dataGridView1.DefaultCellStyle.Font = new Font("Microsoft Sans Serif", 10); dataGridView2.DefaultCellStyle.Font = new Font("Microsoft Sans Serif", 10); using (StockMgntRef.StockMgntClient client = new StockMgntRef.StockMgntClient()) { dataGridView1.DataSource = client.GetCylinders(); dataGridView2.DataSource = client.GetStoves(); var reg = client.GetRegulators(); label3.Text += reg.Quentity + " piece(s)"; label5.Text += reg.Price + " Rs."; } }
private void SetPrice_Load(object sender, EventArgs e) { Location = new Point(-7, 50); int w = SystemInformation.VirtualScreen.Width + 14; int h = SystemInformation.VirtualScreen.Height - 43; Size = new Size(w, h); using (StockMgntRef.StockMgntClient client = new StockMgntRef.StockMgntClient()) { cylinders = client.GetCylinders().ToList(); string[] cyTypes = cylinders.Where(x => x.Price != 0).Select(x => x.CylinderType).ToArray(); comboBox1.Items.AddRange(cyTypes); stoves = client.GetStoves().ToList(); string[] stoveTypes = stoves.Where(x => x.Price != 0).Select(x => x.Product).ToArray(); comboBox2.Items.AddRange(stoveTypes); var reg = client.GetRegulators(); textBox3.Text = reg.Price.ToString(); } }
private void button3_Click(object sender, EventArgs e) { double imageWidth, rPrice = 0; if (double.TryParse(textBox3.Text, out imageWidth)) { rPrice = imageWidth; } if (rPrice > 0) { StockMgntRef.StockMgntClient client = new StockMgntRef.StockMgntClient(); var msg = client.SetRegPrice(rPrice); if (msg.Equals("OK")) { MessageBox.Show("Successfully Updated Price of Regulators. New price is " + rPrice + " Rs."); } } else { textBox3.Text = rPrice.ToString(); MessageBox.Show("Invalid Price!!!"); } }
private void button5_Click(object sender, EventArgs e) { dataGridView3.Rows.Clear(); string cname = textBox1.Text.Trim(); double totalAmt = 0; string product = ""; int qty = 0; if (cname.Length > 0) { int imageWidth, tbQty = 0; if (Int32.TryParse(textBox2.Text, out imageWidth)) { tbQty = imageWidth; } TransactionMgnt.TransactionMgntClient txClient = new TransactionMgnt.TransactionMgntClient(); List <TransactionMgnt.GSTRates> gstrates = txClient.GetGSTRates().ToList(); if (tbQty > 0) { StockMgntRef.StockMgntClient stockMgntClient = new StockMgntRef.StockMgntClient(); var reg = stockMgntClient.GetRegulators(); int regStock = reg.Quentity; if (regStock >= tbQty) { double cgst = gstrates.Where(x => x.Comodity.Equals("Regulator")).FirstOrDefault().CGST; double sgst = gstrates.Where(x => x.Comodity.Equals("Regulator")).FirstOrDefault().SGST; DataGridViewRow nrow = (DataGridViewRow)dataGridView3.Rows[0].Clone(); nrow.Cells[0].Value = "Regulator(s)"; nrow.Cells[1].Value = tbQty; nrow.Cells[2].Value = reg.Price; nrow.Cells[3].Value = (100 + cgst + sgst) * (reg.Price * tbQty) / 100; totalAmt += double.Parse(nrow.Cells[3].Value.ToString()); dataGridView3.Rows.Add(nrow); } else { MessageBox.Show("Not Enough Stock of Regulators!!!"); } } foreach (DataGridViewRow row1 in dataGridView1.Rows) { if (row1.Cells[0].Value != null) { product = row1.Cells[0].Value.ToString(); if (int.Parse(row1.Cells[1].Value.ToString()) > 0) { var selectedStove = stoves.Where(x => x.Product.Equals(product)).FirstOrDefault(); if (selectedStove.Quentity >= qty) { qty = int.Parse(row1.Cells[1].Value.ToString()); double cgst = gstrates.Where(x => x.Comodity.Equals("Stove")).FirstOrDefault().CGST; double sgst = gstrates.Where(x => x.Comodity.Equals("Stove")).FirstOrDefault().SGST; DataGridViewRow nrow = (DataGridViewRow)dataGridView3.Rows[0].Clone(); nrow.Cells[0].Value = product; nrow.Cells[1].Value = qty; nrow.Cells[2].Value = selectedStove.Price; nrow.Cells[3].Value = (100 + cgst + sgst) * (selectedStove.Price * qty) / 100; totalAmt += double.Parse(nrow.Cells[3].Value.ToString()); dataGridView3.Rows.Add(nrow); } else { MessageBox.Show("Not Enough Stock of Stove '" + product + "' !!!"); } } } } label7.Text = totalAmt.ToString(); } }
private void button3_Click(object sender, EventArgs e) { string cname = textBox1.Text.Trim(); int cmnum = 0; string product = ""; int qty = 0; if (cname.Length > 0) { int imageWidth, tbQty = 0; if (Int32.TryParse(textBox2.Text, out imageWidth)) { tbQty = imageWidth; } if (tbQty > 0) { StockMgntRef.StockMgntClient stockMgntClient = new StockMgntRef.StockMgntClient(); int regStock = stockMgntClient.GetRegulators().Quentity; if (regStock >= tbQty) { TransactionMgnt.TransactionMgntClient client = new TransactionMgnt.TransactionMgntClient(); cmnum = client.RegulatorTx(cname, tbQty); //PrintBill(); } else { MessageBox.Show("Not Enough Stock of Regulators!!!"); } } foreach (DataGridViewRow row1 in dataGridView1.Rows) { if (row1.Cells[0].Value != null) { product = row1.Cells[0].Value.ToString(); if (int.Parse(row1.Cells[1].Value.ToString()) > 0) { int stoveStock = stoves.Where(x => x.Product.Equals(product)).FirstOrDefault().Quentity; if (stoveStock >= qty) { qty = int.Parse(row1.Cells[1].Value.ToString()); TransactionMgnt.TransactionMgntClient client1 = new TransactionMgnt.TransactionMgntClient(); cmnum = client1.StoveTx(cname, product, qty, cmnum); } else { MessageBox.Show("Not Enough Stock of Stove '" + product + "' !!!"); } } } } if (cmnum > 0) { textBox1.Text = ""; textBox2.Text = ""; dataGridView1.Rows.Clear(); MessageBox.Show("Transaction is done Successfully !!! \nCashmemo Number is " + cmnum); } TransactionMgnt.TransactionMgntClient txClient = new TransactionMgnt.TransactionMgntClient(); List <TransactionMgnt.GSTRates> gstrates = txClient.GetGSTRates().ToList(); int f = 0; foreach (DataGridViewRow r in dataGridView1.Rows) { if (r.Cells[1].Value != null) { if (int.Parse(r.Cells[1].Value.ToString()) != 0) { f = 1; break; } else { f = 0; } } } if (tbQty > 0) { f = 1; } if (f == 1) { //MessageBox.Show("In Print"); PrintReceipt(cname, cmnum, stoves, dataGridView3, gstrates); } else { MessageBox.Show("Can't Generate Invoice for zero Quentity !!!"); } } }