Exemplo n.º 1
0
        //modo consulta
        //public void ModoConsulta()
        //{
        //    if (lblIdPedido.Text == "idpedido")
        //    {

        //    }
        //}
        //llistar pedidos do vendedor atual
        public void ListarVendas()
        {
            DataTable dtPedido = new DataTable();

            dtPedido         = BusinesPedido.DetalhePedido(UserLoginCache.IdUser);
            lblIdPedido.Text = dtPedido.Rows[0]["id_pedido"].ToString();
        }
Exemplo n.º 2
0
        //listar os itens no cupom
        public void ListarItensCupom()
        {
            dgvCupom.DataSource = BusinesPedido.ListarItemPedido(int.Parse(lblIdPedido.Text));
            dgvCupom.Columns["id_pedido"].Visible       = false;
            dgvCupom.Columns["id_produto"].Visible      = false;
            dgvCupom.Columns["descricao"].DisplayIndex  = 1;
            dgvCupom.Columns["descricao"].HeaderText    = "Nome do Produto";
            dgvCupom.Columns["descricao"].AutoSizeMode  = DataGridViewAutoSizeColumnMode.DisplayedCells;
            dgvCupom.Columns["codigo"].DisplayIndex     = 2;
            dgvCupom.Columns["codigo"].HeaderText       = "Código";
            dgvCupom.Columns["codigo"].AutoSizeMode     = DataGridViewAutoSizeColumnMode.DisplayedCells;
            dgvCupom.Columns["quantidade"].DisplayIndex = 3;
            dgvCupom.Columns["quantidade"].HeaderText   = "Qtde.";
            //dgvCupom.Columns["quantidade"].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells;
            dgvCupom.Columns["preco"].DisplayIndex = 4;
            dgvCupom.Columns["preco"].HeaderText   = "Preço un.";
            //dgvCupom.Columns["preco"].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells;
            DataGridViewCellStyle style = dgvCupom.ColumnHeadersDefaultCellStyle;

            style.BackColor          = Color.WhiteSmoke;
            style.ForeColor          = Color.Black;
            style.Font               = new Font("Open Sans", 7, FontStyle.Bold);
            style.SelectionBackColor = Color.WhiteSmoke;

            dgvCupom.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
            dgvCupom.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
            dgvCupom.ColumnHeadersHeight         = 40;
            dgvCupom.ColumnHeadersVisible        = true;
            lblTotalItens.Text = dgvCupom.Rows.Count.ToString();
        }
Exemplo n.º 3
0
        private void btnCredito_Click(object sender, EventArgs e)
        {
            this.Enabled = false;
            FormCredito frm = new FormCredito(lblTotal.Text);

            frm.ShowDialog();
            this.Enabled = true;
            BusinesPagamento.CadastroPedidoPagamento(TiposPagamento.Crédito, int.Parse(lblIdPedido.Text), decimal.Parse(lblTotal.Text), decimal.Parse(lblTroco.Text));
            try
            {
                string rpta = BusinesPedido.FecharCompra(Convert.ToInt32(lblIdPedido.Text), StatusPedido.Fechado);
                lblIdPedido.Text           = "idpedido";
                txtPesquisaProduto.Enabled = false;
                lblCompraAberta.Text       = "Compra Finalizada... *F5 PARA ABRIR UMA NOVA COMPRA";
                DisableBtn();
                btnFechar.Enabled = true;
                lblTrocoT.Text    = "Troco:";
                if (rpta.Equals("OK"))
                {
                    lblPagamento.Text = TiposPagamento.Crédito.ToString();
                }
                else
                {
                    MessageBox.Show(rpta);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + ex.StackTrace);
            }
            CompraEmAndamento = true;
        }
Exemplo n.º 4
0
        private void btnDinheiro_Click(object sender, EventArgs e)
        {
            this.Enabled = false;
            FormDinheiro _frm = new FormDinheiro(lblTotal.Text);

            _frm.ShowDialog();
            this.Enabled = true;
            Busines.Pagamento.BusinesPagamento.CadastroPedidoPagamento(TiposPagamento.Dinheiro, int.Parse(lblIdPedido.Text), decimal.Parse(_frm.Recebido), decimal.Parse(_frm.Troco));
            lblTroco.Text = _frm.Troco;
            VerificarPagamentoPedido();
            this.txtValida.Text = _frm.ValidaFecharCompra;
            string idCliente = null;

            if (!string.IsNullOrEmpty(CpfNaNota))
            {
                idCliente = CacheCliente.IdCliente.ToString();
            }
            else
            {
                idCliente = "1";
            }
            if (txtValida.Text == "2")
            {
                try
                {
                    string rpta = BusinesPedido.FecharCompra(Convert.ToInt32(lblIdPedido.Text), StatusPedido.Fechado);
                    lblIdPedido.Text           = "idpedido";
                    txtPesquisaProduto.Enabled = false;
                    lblCompraAberta.Text       = "Compra Finalizada... *F5 PARA ABRIR UMA NOVA COMPRA";
                    DisableBtn();
                    btnFechar.Enabled = true;
                    lblTrocoT.Text    = "Troco:";
                    if (rpta.Equals("OK"))
                    {
                        lblPagamento.Text = TiposPagamento.Dinheiro.ToString();
                    }
                    else
                    {
                        MessageBox.Show(rpta);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message + ex.StackTrace);
                }
                CompraEmAndamento = true;
            }
            if (txtValida.Text == "3")
            {
                // var novoTotal = decimal.Parse(lblTotal.Text) - decimal.Parse(lblrecebido.Text);
                lblTrocoT.Text     = "Falta:";
                lblTotalT.Text     = "Falta:";
                lblTotal.ForeColor = Color.FromArgb(102, 102, 102);

                // lblTotal.Text = novoTotal.ToString();
                CompraEmAndamento = false;
            }
            CpfNaNota = string.Empty;
        }
Exemplo n.º 5
0
        //vericar se existe uma compra aberta
        public void VerificarComprasAbertas()
        {
            DataTable dt = new DataTable();

            dt = BusinesPedido.VerificarComprasAbertas(UserLoginCache.IdUser, CacheIdCaixa.IdCaixa);
            if (dt.Rows.Count > 0)
            {
                lblIdPedido.Text = dt.Rows[0]["id_pedido"].ToString();
                ListarItensCupom();
                LiberarControlesCompraRecuperada();
            }
        }
Exemplo n.º 6
0
        //tecla de atalho para abrir uma nova compra
        protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
        {
            try
            {
                switch (keyData)
                {
                //nova abertura
                case Keys.Control | Keys.M:
                    try
                    {
                        string resposta = "";
                        if (CompraEmAndamento == true)
                        {
                            resposta = BusinesPedido.CadastroNovaCompra
                                       (
                                1,
                                UserLoginCache.IdUser,
                                StatusPedido.Aberto,
                                TipoEntrega.Balcão,
                                DateTime.Now,
                                CacheIdCaixa.IdCaixa
                                       );
                            LiberarControlesNovaCompra();
                            CompraEmAndamento          = false;
                            txtPesquisaProduto.Enabled = true;
                        }
                        else
                        {
                            MessageBox.Show("Compra em Andamento");
                        }
                        ListarVendas();
                    }
                    catch (Exception ex)
                    {
                    }
                    break;

                case Keys.F1:
                    txtQuantidade.Enabled = true;
                    txtValorUnitario.Clear();
                    txtSubTotal.Clear();
                    txtQuantidade.Focus();
                    break;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + ex.StackTrace);
            }
            return(base.ProcessCmdKey(ref msg, keyData));
        }
Exemplo n.º 7
0
        private void btnFiado_Click(object sender, EventArgs e)
        {
            FormFiado _frm = new FormFiado(lblTotal.Text, lblIdPedido.Text);

            _frm.ShowDialog();
            this.txtValida.Text = _frm.Valor;
            if (txtValida.Text == "2")
            {
                try
                {
                    string rpta = BusinesPedido.FecharCompra(Convert.ToInt32(lblIdPedido.Text), StatusPedido.Fechado);
                    lblIdPedido.Text           = "idpedido";
                    txtPesquisaProduto.Enabled = false;
                    lblCompraAberta.Text       = "Compra Finalizada... *F5 PARA ABRIR UMA NOVA COMPRA";
                    lblRecebidoT.Text          = "Cliente:";
                    lblrecebido.Text           = _frm.NomeCliente;
                    lblTrocoT.Text             = "CPF:";
                    lblTroco.Text = _frm.CpfCliente;
                    DisableBtn();
                    btnFechar.Enabled = true;
                    if (rpta.Equals("OK"))
                    {
                        lblPagamento.Text = TiposPagamento.Fiado.ToString();
                    }
                    else
                    {
                        MessageBox.Show(rpta);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message + ex.StackTrace);
                }
            }
            CompraEmAndamento = true;
            //implementa a divisao do pagamento fiado tambem
            //if (txtValida.Text == "3")
            //{
            //    var novoTotal = decimal.Parse(lblTotal.Text) - decimal.Parse(lblrecebido.Text);
            //    lblTrocoT.Text = "Falta:";

            //    lblTotal.Text = novoTotal.ToString();
            //    CompraEmAndamento = false;
            //    Busines.Pagamento.BusinesPagamento.PedidoPagamento(TiposPagamento.Dinheiro, int.Parse(lblIdPedido.Text), decimal.Parse(lblrecebido.Text));
            //}
        }
Exemplo n.º 8
0
        //listar detalhes
        public void DetalhesPedido()
        {
            DataTable dt = new DataTable();

            dt            = BusinesPedido.ListarItemPedido(int.Parse(lblIdPedido.Text));
            lblTotal.Text = dt.Rows[0]["Total"].ToString();
            Decimal valorTotal = 0;

            if (!string.IsNullOrEmpty(dt.Rows[0]["Total"].ToString()))
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    valorTotal += Convert.ToDecimal(dt.Rows[i]["Total"].ToString());
                }
            }
            lblSubTotalCupom.Text = valorTotal.ToString("N2");
            lblTotal.Text         = valorTotal.ToString("N2");
        }
Exemplo n.º 9
0
        //abrindo uma nova compra
        public void IncluirItem()
        {
            string rpta = "";

            try
            {
                if (string.IsNullOrEmpty(txtIdProduto.Text))
                {
                    MessageBox.Show("Nenhum Produto Definido");
                }
                else
                {
                    if (this.IsNew)
                    {
                        rpta = BusinesPedido.InserirItemPedido(
                            Convert.ToInt32(lblIdPedido.Text),
                            Convert.ToInt32(txtIdProduto.Text),
                            Convert.ToInt32(txtQuantidade.Text),
                            Convert.ToInt32(txtQuantidade.Text)
                            );
                    }
                }
                if (rpta.Equals("OK"))
                {
                    txtQuantidade.Enabled = false;
                }
                else
                {
                    MessageBox.Show("IsNew = false");
                }
            }
            catch (Exception ex)
            {
                rpta = ex.Message + ex.StackTrace;
            }
        }