示例#1
0
        private void Editqty_Click(object sender, EventArgs e)
        {
            double qty = double.Parse(quantity);
            quantityandconversion conv = new quantityandconversion();

            foreach (DataGridViewRow row in billList.SelectedRows)
            {
                conv.itemmu.Text = row.Cells[4].Value.ToString();
                conv.qtyac.Text  = row.Cells[3].Value.ToString();
                conv.dataSent   += muconversion_datasent;
                conv.ShowDialog();
                row.Cells[3].Value = quantity;
                row.Cells[5].Value = (double.Parse(quantity) * getSellingPrice(row.Cells[0].Value.ToString())).ToString();
            }
        }
示例#2
0
        private void addbtnbill_Click(object sender, EventArgs e)
        {
            float dis;

            if (discounttb.Text == "")
            {
                discounttb.Text = "0";
            }
            if (searchItemcb.Text == "" && billcat.Text == "")
            {
                MessageBox.Show("Item or Catagory field can't be blank");
            }
            else if (!float.TryParse(discounttb.Text, out dis))
            {
                MessageBox.Show("Enter a numeric value of Discount Field");
            }
            else if (!searchItemcb.Items.Contains(searchItemcb.Text))
            {
                MessageBox.Show("Item not allowed");
            }
            else
            {
                string itemCol, descCol, MUCol, ISPCol, discountCol, sgstCol, cgstCol;
                double totalItemPrice;
                double qty = 0;

                quantityandconversion muconversion = new quantityandconversion();
                muconversion.itemmu.Text = mu.Text;
                muconversion.dataSent   += muconversion_datasent;
                muconversion.ShowDialog();
                string   itemcat   = searchItemcb.Text;
                char[]   splitchar = { '_' };
                string[] temp      = itemcat.Split(splitchar);
                itemCol = temp[0];
                descCol = desc.Text;
                MUCol   = mu.Text;
                double.TryParse(quantity, out qty);
                totalItemPrice = float.Parse(spricetb.Text) * qty;
                ISPCol         = totalItemPrice.ToString();
                discountCol    = discounttb.Text;
                cgstCol        = sgsttb.Text;
                sgstCol        = cgsttb.Text;
                bool flag = false;
                if (!withoutstock.Checked)
                {
                    string[] row = { itemid, itemCol, descCol, qty.ToString(), MUCol, ISPCol, discountCol, sgstCol, cgstCol };
                    if (stock_qty >= qty & totalItemPrice >= float.Parse(discounttb.Text))
                    {
                        if (billList.Rows.Count != 0)
                        {
                            foreach (DataGridViewRow i in billList.Rows)
                            {
                                if (i.Cells[0].Value.ToString() == itemid)
                                {
                                    flag = true;
                                }
                            }
                            if (flag)
                            {
                                MessageBox.Show("Duplicate entry found in Billing List");
                            }
                            else
                            {
                                billList.Rows.Add(row);
                            }
                        }
                        else
                        {
                            billList.Rows.Add(row);
                        }
                    }
                    else
                    {
                        MessageBox.Show("Entered Quantity exceeds the stock Quantity, Please Update stock Quantity before billing or Discount Amount is greater than amount of Total Price");
                    }
                }
                else
                {
                    string[] row = { itemid, itemCol, descCol, qty.ToString(), MUCol, ISPCol, discountCol, sgstCol, cgstCol };
                    billList.Rows.Add(row);
                    stockflag = true;
                }
            }
            discounttb.Clear();
            desc.Clear();
            searchItemcb.ResetText();
        }