Escolha uma Página

PDVSuper

23 de setembro de 2022
by Cenora
7
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace PDV
{
    public partial class frmPDVSuper : Form
    {
        //Declara a lista
        List<string> lista;
        string textoQtd = "1";
        
        double total = 0;
        public frmPDVSuper()
        {
            InitializeComponent();
            //Inicializa a lista
            lista = new List<string>();
        }

        private void btnAdicionar_Click(object sender, EventArgs e)
        {
            if (txtItems.Text == "")
            {
                MessageBox.Show("Items vazio");
            }
            else
            {
                //Adiciona o item na lista
                lista.Add(txtItems.Text);
                
                

                if (txtQtd.Text != "")
                {
                    double preco = Convert.ToDouble(txtQtd.Text) * Convert.ToDouble(txtPreco.Text);
                    total += preco;
                    textoQtd = txtQtd.Text;
                }
                else
                {
                    total += Convert.ToDouble(txtPreco.Text);
                }

                lstLista.Items.Add(txtItems.Text + " - " + textoQtd + "un.       " + txtCod.Text);


                lblQtd.Text = lista.Count.ToString();

                lstLista.Update();
                lblTotal.Text = "R$"+total.ToString();
                //txtItems.Select(0, txtItems.Text.Length);
                //txtPreco.Focus();

                LimparForm();
            }

        }
        private void LimparForm()
        {
            txtItems.Text = "";
            txtPreco.Text = "";
            txtQtd.Text = "";
            txtCod.Text = "";
            txtItems.Focus();
        }

        private void btnLimpar_Click(object sender, EventArgs e)
        {
            LimparForm();
        }
    }
}

Relacionadas, talvez…

Blog em Angular – The End

O que faz de um blog um blog é mostrar os posts logo na página principal. Da forma que configuramos a rota padrão até agora, ArtigosComponent é a página de destino onde deveria ter posts, mas até agora, nada... O Scully fornece o serviço ScullyRoutesService, este,...

Blog em Angular – Parte III

Zero lógica! Nosso blog ainda não tem nenhuma lógica para recuperar posts. Por hora, é apenas uma aplicação Angular tipicamente roteada. Entretanto, justamente por ser roteada, temos a base estável suficiente para adicionar o suporte ao Blog através do Scully. Para...

Formulário em HTML 5

<!DOCTYPE html> <html lang="PT_br"> <head> <meta charset="UTF-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>Formulário</title> </head> <body>...

Share This