Beispiel #1
0
        private void barcodetxt_Validating(object sender, CancelEventArgs e)
        {
            if (barcodetxt.Text != "")
            {
                prodARR         = r.getProductsWRTBarcode(barcodetxt.Text);
                productID       = Convert.ToInt32(prodARR[0]);
                producttxt.Text = prodARR[1];
                string barco = prodARR[2];

                producttxt.Enabled = false;


                if (barco != null)
                {
                    puptxt.Focus();
                }
            }
            else
            {
                productID       = 0;
                producttxt.Text = "";
                puptxt.Text     = "";
                Array.Clear(prodARR, 0, prodARR.Length);
            }
        }
Beispiel #2
0
        private void barcodeTxt_Validating(object sender, CancelEventArgs e)
        {
            if (barcodeTxt.Text != "")
            {
                GrossTxt.Text         = "";
                TotalDiscountTxt.Text = "";
                amountTxt.Text        = "";
                changeGiveTxt.Text    = "";
                int qCount = 0;
                int sQuant = 0;
                int nCount = 0;

                prodARR = r.getProductsWRTBarcode(barcodeTxt.Text);
                foreach (DataGridViewRow row in dataGridView1.Rows)
                {
                    if (prodARR[0] == row.Cells["proIDGV"].Value.ToString())
                    {
                        qCount = qCount + Convert.ToInt32(row.Cells["quantGV"].Value.ToString());
                    }
                }
                sQuant = Convert.ToInt32(r.getProductQuantity(Convert.ToInt64(prodARR[0])));

                nCount = sQuant - qCount;

                if (nCount <= 0)
                {
                }
                else
                {
                    if (dataGridView1.RowCount == 0)
                    {
                        dataGridView1.Rows.Add(Convert.ToInt32(prodARR[0]), prodARR[1], 1, Convert.ToSingle(prodARR[3]), prodARR[4], Convert.ToSingle(prodARR[5]));
                    }
                    else
                    {
                        foreach (DataGridViewRow row in dataGridView1.Rows)
                        {
                            if (row.Cells["proIDGV"].Value.ToString() == prodARR[0])
                            {
                                productCheck = true;
                                break;
                            }
                            else
                            {
                                productCheck = false;
                            }
                        }
                        if (productCheck == true)
                        {
                            foreach (DataGridViewRow row in dataGridView1.Rows)
                            {
                                if (row.Cells["proIDGV"].Value.ToString() == prodARR[0])
                                {
                                    float disc = 0;
                                    row.Cells["quantGV"].Value = Convert.ToInt32(row.Cells["quantGV"].Value.ToString()) + 1;
                                    if (row.Cells["disGV"].Value.ToString() != null)
                                    {
                                        disc = Convert.ToSingle(row.Cells["disGV"].Value.ToString()) + Convert.ToSingle(row.Cells["disGV"].Value.ToString());
                                        row.Cells["disGV"].Value = disc;
                                    }
                                    float tot = (Convert.ToSingle(row.Cells["pupGV"].Value.ToString()) * Convert.ToInt32(row.Cells["quantGV"].Value.ToString())) - Convert.ToSingle(row.Cells["disGV"].Value.ToString());
                                    row.Cells["totalGV"].Value = tot;
                                }
                            }
                        }

                        else
                        {
                            dataGridView1.Rows.Add(Convert.ToInt32(prodARR[0]), prodARR[1], 1, Convert.ToSingle(prodARR[3]), prodARR[4], Convert.ToSingle(prodARR[5]));
                        }
                    }
                    foreach (DataGridViewRow item in dataGridView1.Rows)
                    {
                        GROSS += Convert.ToSingle(item.Cells["totalGV"].Value.ToString());
                    }
                    grossLabel.Text = GROSS.ToString();
                    GROSS           = 0;
                    barcodeTxt.Focus();
                    barcodeTxt.Clear();
                }
            }
        }