Exemplo n.º 1
0
 private void Form1_Load(object sender, EventArgs e)
 {
     Quantidade.Hide();
     TXTQTDE.Hide();
     ValorUnitario.Hide();
     TXTVALORUNITARIO.Hide();
     Valor.Hide();
     TXTVALOR.Hide();
     Total.Hide();
     TXTTOTAL.Hide();
     Descricao.Hide();
     TXT_DESC.Hide();
     dgDados.Hide();
     valorrecebido.Hide();
     TXT_VLRR.Hide();
     troco.Hide();
     TXT_TROCO.Hide();
 }
Exemplo n.º 2
0
        private void TXT_VLRR_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                Double vrll = Double.Parse(TXT_VLRR.Text);
                Double trocoo;
                trocoo = vrll - Valortotal;



                System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("pt-BR");


                TXT_VLRR.Text  = string.Format("{0:C}", Convert.ToDouble(vrll));
                TXT_TROCO.Text = string.Format("{0:C}", Convert.ToDouble(trocoo));



                if (trocoo >= 0)
                {
                    //envia bd

                    Conexao comb = new Conexao();

                    comb.sql = "Insert into tb02_cupom (tb02_valor, tb02_data) values ('" + Valortotal + "', now())";


                    comb.open();

                    int lin = comb.Runsql();


                    comb.close();



                    //fim envia bd


                    MessageBox.Show("COMPRA TERMINADA. TROCO: " + TXT_TROCO.Text + "", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    TXTQTDE.Text          = "0";
                    TXTTOTAL.Text         = "";
                    TXTVALOR.Text         = "";
                    TXTVALORUNITARIO.Text = "";
                    TXT_DESC.Text         = "";
                    Valortotal            = 0;

                    Quantidade.Hide();
                    TXTQTDE.Hide();
                    ValorUnitario.Hide();
                    TXTVALORUNITARIO.Hide();
                    Valor.Hide();
                    TXTVALOR.Hide();
                    Total.Hide();
                    TXTTOTAL.Hide();
                    PB_foto.Image = Properties.Resources.CL1;
                    Descricao.Hide();
                    TXT_DESC.Hide();
                    dgDados.Hide();
                    dgDados.Rows.Clear();
                    TXT_DESC.Text = "";
                    valorrecebido.Hide();
                    TXT_VLRR.Hide();
                    troco.Hide();
                    TXT_TROCO.Hide();


                    TXT_TROCO.Text = "R$ 0,00";
                    TXT_VLRR.Text  = "R$ 0,00";


                    TXTQTDE.Enabled  = true;
                    TXT_PROD.Enabled = true;
                    this.TXT_PROD.Focus();
                }
                else
                {
                    MessageBox.Show("O valor recebido é menor que o valor total da compra!", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }



            if (e.KeyCode == Keys.F7)
            {
                if (TXTQTDE.Text == "0")
                {
                    MessageBox.Show("Aperte F5 para começar a compra!", "Aviso");
                }
                else
                {
                    if (DialogResult.Yes == MessageBox.Show("Deseja cancelar a compra?", "Aviso", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
                    {
                        TXTQTDE.Text          = "0";
                        TXTTOTAL.Text         = "";
                        TXTVALOR.Text         = "";
                        TXTVALORUNITARIO.Text = "";
                        TXT_DESC.Text         = "";
                        TXT_TROCO.Text        = "R$ 0,00";
                        TXT_VLRR.Text         = "R$ 0,00";
                        Quantidade.Hide();
                        TXTQTDE.Hide();
                        ValorUnitario.Hide();
                        TXTVALORUNITARIO.Hide();
                        Valor.Hide();
                        TXTVALOR.Hide();
                        Total.Hide();
                        TXTTOTAL.Hide();
                        PB_foto.Image = Properties.Resources.CL1;
                        Descricao.Hide();
                        TXT_DESC.Hide();
                        dgDados.Hide();
                        dgDados.Rows.Clear();
                        Valortotal = 0;
                    }
                }
            }
        }