Beispiel #1
0
        //Método para Logar
        private void AbrirCaixa()
        {
            if (txtSaldo.Text == string.Empty)
            {
                errorP.SetError(txtSaldo, "Campo Obrigatório");
            }
            else if (txtSenha.Text == string.Empty)
            {
                errorP.SetError(txtSenha, "Campo Obrigatório");
            }
            else if (_SenhaGlobal != txtSenha.Text)
            {
                errorP.SetError(txtSenha, "Senha Errada");
            }
            else
            {
                BllCaixa    bll = new BllCaixa();
                Funcionario dto = new Funcionario();
                dto.Operacao      = "AbrirCaixa";
                dto.CaixaId       = Convert.ToInt32(cbCaixa.SelectedValue);
                dto.SaldoInicial  = Convert.ToDecimal(txtSaldo.Text);
                dto.FuncionarioId = Convert.ToInt32(_IdGlobal);

                DataTable dt = bll.AbrirCaixa(dto);

                try
                {
                    if (dt.Rows.Count != 0)
                    {
                        FNotificao.AlerForm("Caixa Nº " + dto.CaixaId.ToString() + " Aberta Com Sucesso", TipoNotificacao.sucesso);
                        dto = new Funcionario();
                        dto.FuncionarioId = Convert.ToInt32(_IdGlobal);
                        dto.Cargo         = _CargoGlobal;
                        dto.NomeCompleto  = _NomeGlobal;
                        dto.CaixaId       = Convert.ToInt32(cbCaixa.SelectedValue);
                        dto.CaixaFunc     = Convert.ToInt32(dt.Rows[0]["CaixaFuncionarioId"]);
                        dto.Abertura      = dt.Rows[0]["Abertura"].ToString();
                        this.Hide();
                        Estoque es = new Estoque();
                        FVenda  f  = FVenda.getInstancia(dto);
                        f.ShowDialog();
                    }
                    else
                    {
                        FNotificao.AlerForm("Erro Detalhes: " /*+ dt.Rows[0]["Retorno"].ToString()*/, TipoNotificacao.erro);
                    }
                }
                catch
                {
                    //FNotificao.AlerForm("Erro Detalhes: " /*+ dt.Rows[0]["Retorno"].ToString()*/, TipoNotificacao.erro);
                }
            }
        }
Beispiel #2
0
        private void btnSelecionar_Click(object sender, EventArgs e)
        {
            if (dgv.RowCount == 0)
            {
                FNotificao.AlerForm("Não Nenhum Fármaco Selecionado", TipoNotificacao.info);
            }
            else
            {
                if (dgv.CurrentRow.Cells[13].Value.ToString() == "Disponível")
                {
                    Estoque es = new Estoque();

                    // txtPrijs textbox está Invisível no Formulario Venda
                    //f.txtPrijs.Text = dgv.CurrentRow.Cells[10].Value.ToString();
                    if (dgv.CurrentRow.Cells[11].Value.ToString() == "")
                    {
                        es.Descricao = "Sem Descrição";
                    }
                    else
                    {
                        es.Descricao = dgv.CurrentRow.Cells[11].Value.ToString();
                    }
                    Funcionario dto = new Funcionario();
                    FVenda      f   = FVenda.getInstancia(dto);
                    f.txtCod.Text    = dgv.CurrentRow.Cells[4].Value.ToString();
                    f.txtDescri.Text = dgv.CurrentRow.Cells[11].Value.ToString();
                    f.txtPreco.Text  = dgv.CurrentRow.Cells[10].Value.ToString();
                    f.txtPrijs.Text  = dgv.CurrentRow.Cells[10].Value.ToString();
                    f.txtEstok.Text  = dgv.CurrentRow.Cells[5].Value.ToString();
                    f.txtProd.Text   = dgv.CurrentRow.Cells[3].Value.ToString();
                    if (dgv.CurrentRow.Cells[12].Value.ToString() == "")
                    {
                        f.picBox.Image = new Bitmap(Application.StartupPath + "\\Imagens\\image_100px.png");
                    }
                    else
                    {
                        f.picBox.Image    = new Bitmap(Application.StartupPath + "\\Imagens\\" + dgv.CurrentRow.Cells[12].Value.ToString());
                        f.picBox.SizeMode = PictureBoxSizeMode.StretchImage;
                    }

                    f.Show();
                    Listar();
                }
                else
                {
                    FNotificao.AlerForm("O Fármaco Selecionaro Não Encontra-se DISPONÍVEL", TipoNotificacao.aviso);
                }
            }
        }
Beispiel #3
0
 private void btnCaixa_Click(object sender, EventArgs e)
 {
     if (Application.OpenForms["FVenda"] == null)
     {
         FAbrirCaixa frm = new FAbrirCaixa();
         frm.NomeGlobal  = _NomeGlobal;
         frm.CargoGlobal = _CargoGlobal;
         frm.SenhaGlobal = _SenhaGlobal;
         frm.IdGlobal    = _IdGlobal;
         frm.ShowDialog();
     }
     else
     {
         Funcionario dto = new Funcionario();
         FVenda      f   = FVenda.getInstancia(dto);
         f.Show();
     }
 }
Beispiel #4
0
        //Método para Cadastrar Venda
        private void CadastrarVenda()
        {
            Venda    dto = new Venda();
            BllVenda bll = new BllVenda();

            dto.Operacao   = "Venda";
            dto.CaixaFunc  = Convert.ToInt32(_CaixaId);
            dto.ClienteId  = Convert.ToInt32(txtCodigo.Text);
            dto.ValorTotal = Convert.ToDecimal(ValorTotal);
            if (cbTipoPagam.SelectedIndex == 1)
            {
                dto.TipoPagamento = 1;
            }
            else if (cbTipoPagam.SelectedIndex == 2)
            {
                dto.TipoPagamento = 2;
            }
            else if (cbTipoPagam.SelectedIndex == 3)
            {
                dto.TipoPagamento = 3;
                dataPagam.Enabled = true;
            }
            else
            {
                FNotificao.AlerForm("Tipo de Pagamento Inválido", TipoNotificacao.aviso);
            }


            string retorno = bll.Cadastrar(dto);

            try
            {
                int id = Convert.ToInt32(retorno);
                FNotificao.AlerForm("Venda Efetuada Com Sucesso!!!", TipoNotificacao.sucesso);
                FVenda f = FVenda.getInstancia(null);
                f.CadastrarPedido();
                LimparCampos();
                this.Close();
            }
            catch
            {
                FNotificao.AlerForm("Erro Ao Registrar a Venda " + retorno.ToString(), TipoNotificacao.erro);
            }
        }
Beispiel #5
0
 private void btnAbrir_Click(object sender, EventArgs e)
 {
     if (Logado == false)
     {
         if (cbCaixa.SelectedIndex != 0)
         {
             AbrirCaixa();
         }
         else
         {
             errorP.SetError(cbCaixa, "!");
             FNotificao.AlerForm("Selecionar o Caixa", TipoNotificacao.aviso);
         }
     }
     else
     {
         FVenda f = FVenda.getInstancia(null);
         f.Show();
     }
 }