Example #1
0
 private void btnLX_Click(object sender, EventArgs e)
 {
     if (FCaixa.StatusCaixa != 3)
     {
         if (MessageBox.Show("Confirma a emissão da Leitura X?", "Emissão de Leitura X", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
         {
             UECF.LeituraX();
         }
     }
     else
     {
         MessageBox.Show("Terminal em Estado Somente Consulta.", "Informação do Sistema", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Example #2
0
        private void listaSupervisor_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Escape)
            {
                this.Close();
            }


            if (e.KeyCode == Keys.Enter)
            {
                //  inicia movimento
                if (listaSupervisor.SelectedIndex == 0)
                {
                    FCaixa.IniciaMovimento();
                }
                //  encerra movimento
                if (listaSupervisor.SelectedIndex == 1)
                {
                    FCaixa.EncerraMovimento();
                }
                //  suprimento
                if (listaSupervisor.SelectedIndex == 3)
                {
                    FCaixa.Suprimento();
                }
                //  sangria
                if (listaSupervisor.SelectedIndex == 4)
                {
                    FCaixa.Sangria();
                }
                //  Reducao Z
                if (listaSupervisor.SelectedIndex == 6)
                {
                    if (MessageBox.Show("Tem Certeza Que Deseja Executar a Reducao Z?" + "\r" + "\r" + "O Movimento da Impressora será Suspenso no dia de Hoje.", "Reducao Z", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        try
                        {
                            UECF.ReducaoZ();
                        }
                        finally
                        {
                            FCaixa.TelaPadrao(2);
                        }
                    }
                }
            }
        }
Example #3
0
 private void acBrTEFD_OnAntesCancelarTransacao(object sender, ACBrFramework.TEFD.AntesCancelarTransacaoEventArgs e)
 {
     if ((FDataModule.ACBrECF.Estado.ToString() == "Venda") || (FDataModule.ACBrECF.Estado.ToString() == "Pagamento"))
     {
         UECF.CancelaCupom();
         CupomCancelado = true;
     }
     else if ((FDataModule.ACBrECF.Estado.ToString() == "Relatorio"))
     {
         FDataModule.ACBrECF.FechaRelatorio();
         UPAF.GravaR06("CC");
     }
     else
     {
         FDataModule.ACBrECF.CorrigeEstadoErro(false);
     }
 }
Example #4
0
 public void SubTotalizaCupom()
 {
     if ((FDataModule.ACBrECF.Estado.ToString() == "Venda"))
     {
         if (FCaixa.VendaCabecalho.Desconto > 0)
         {
             UECF.SubTotalizaCupom(FCaixa.VendaCabecalho.Desconto * -1);
         }
         else if (FCaixa.VendaCabecalho.Acrescimo > 0)
         {
             UECF.SubTotalizaCupom(FCaixa.VendaCabecalho.Acrescimo);
         }
         else
         {
             UECF.SubTotalizaCupom(0);
         }
     }
 }
Example #5
0
        private void listaGerente_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Escape)
            {
                this.Close();
            }


            if (e.KeyCode == Keys.Enter)
            {
                //  inicia movimento
                if (listaGerente.SelectedIndex == 0)
                {
                    FCaixa.IniciaMovimento();
                }
                //  encerra movimento
                if (listaGerente.SelectedIndex == 1)
                {
                    FCaixa.EncerraMovimento();
                }
                //  suprimento
                if (listaGerente.SelectedIndex == 3)
                {
                    FCaixa.Suprimento();
                }
                //  sangria
                if (listaGerente.SelectedIndex == 4)
                {
                    FCaixa.Sangria();
                }
                //  Reducao Z
                if (listaGerente.SelectedIndex == 6)
                {
                    if (MessageBox.Show("Tem Certeza Que Deseja Executar a Reducao Z?" + "\r" + "\r" + "O Movimento da Impressora será Suspenso no dia de Hoje.", "Reducao Z", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        try
                        {
                            UECF.ReducaoZ();
                        }
                        finally
                        {
                            FCaixa.TelaPadrao(2);
                        }
                    }
                }

                //  consultar cliente
                if (listaGerente.SelectedIndex == 8)
                {
                    FImportaCliente FImportaCliente = new FImportaCliente();
                    FImportaCliente.QuemChamou = "SUBMENU";
                    FImportaCliente.ShowDialog();
                }
                //  configuracao do sistema
                if (listaGerente.SelectedIndex == 10)
                {
                    /*
                     * Utilize o Sistema Configurador
                     * FConfiguracao FConfiguracao = new FConfiguracao();
                     * FConfiguracao.ShowDialog();
                     */
                }
                //  funções administrativas do TEF Discado
                if (listaGerente.SelectedIndex == 12)
                {
                    FEfetuaPagamento FEfetuaPagamento = new FEfetuaPagamento();
                    try
                    {
                        FEfetuaPagamento.ACBrTEFD.Initializar(ACBrFramework.TEFD.TefTipo.TefDial);
                        FEfetuaPagamento.ACBrTEFD.ADM(ACBrFramework.TEFD.TefTipo.TefDial);
                    }
                    catch (Exception eError)
                    {
                        Log.write(eError.ToString());
                        MessageBox.Show("Problemas no GP TEFDIAL.", "Informação do Sistema", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    FEfetuaPagamento.Dispose();
                }
                //  funções administrativas do TECBAN
                if (listaGerente.SelectedIndex == 13)
                {
                    FEfetuaPagamento FEfetuaPagamento = new FEfetuaPagamento();
                    try
                    {
                        FEfetuaPagamento.ACBrTEFD.Initializar(ACBrFramework.TEFD.TefTipo.TefDisc);
                        FEfetuaPagamento.ACBrTEFD.ADM(ACBrFramework.TEFD.TefTipo.TefDisc);
                    }
                    catch (Exception eError)
                    {
                        Log.write(eError.ToString());
                        MessageBox.Show("Problemas no GP TECBAN.", "Informação do Sistema", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    FEfetuaPagamento.Dispose();
                }
                //  funções administrativas do HIPER
                if (listaGerente.SelectedIndex == 14)
                {
                    FEfetuaPagamento FEfetuaPagamento = new FEfetuaPagamento();
                    try
                    {
                        FEfetuaPagamento.ACBrTEFD.Initializar(ACBrFramework.TEFD.TefTipo.HiperTef);
                        FEfetuaPagamento.ACBrTEFD.ADM(ACBrFramework.TEFD.TefTipo.HiperTef);
                    }
                    catch (Exception eError)
                    {
                        Log.write(eError.ToString());
                        MessageBox.Show("Problemas no GP HIPER.", "Informação do Sistema", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    FEfetuaPagamento.Dispose();
                }

                //  Importar Tabelas com Dispositivo (pen-drive)
                if (listaGerente.SelectedIndex == 16)
                {
                    FPenDrive FPenDrive = new FPenDrive();
                    FPenDrive.Rotina = "IMPORTA";
                    FPenDrive.ShowDialog();
                }

                //  Exportar Tabelas com Dispositivo (pen-drive)
                if (listaGerente.SelectedIndex == 17)
                {
                    FPenDrive FPenDrive = new FPenDrive();
                    FPenDrive.Rotina = "EXPORTA";
                    FPenDrive.ShowDialog();
                }
            }
        }
Example #6
0
        private void acBrTEFD_OnComandaECF(object sender, ACBrFramework.TEFD.ComandaECFEventArgs e)
        {
            string Mensagem = "";

            try
            {
                switch (e.Operacao)
                {
                case ACBrFramework.TEFD.OperacaoECF.AbreGerencial:
                {
                    FDataModule.ACBrECF.AbreRelatorioGerencial();
                }
                break;

                case ACBrFramework.TEFD.OperacaoECF.CancelaCupom:
                {
                    ImpressaoOK = false;
                    try
                    {
                        UECF.CancelaCupom();
                        CupomCancelado = true;
                    }
                    catch (Exception eError)
                    {
                        Log.write(eError.ToString());
                        CupomCancelado = false;
                    }
                } break;

                case ACBrFramework.TEFD.OperacaoECF.FechaCupom:
                {
                    if (FCaixa.VendaCabecalho.IdPreVenda > 0)
                    {
                        Mensagem = "PV" + new string('0', 10 - Convert.ToString(FCaixa.VendaCabecalho.IdPreVenda).Length) + Convert.ToString(FCaixa.VendaCabecalho.IdPreVenda);
                    }
                    if (FCaixa.VendaCabecalho.IdDAV > 0)
                    {
                        DavCabecalhoVO DavCabecalho = new DAVController().ConsultaDAVId(FCaixa.VendaCabecalho.IdDAV);
                        Mensagem = Mensagem + "DAV" + DavCabecalho.NumeroDav;
                    }
                    Mensagem = FCaixa.MD5 + Mensagem + "\r" + "\n";
                    try
                    {
                        EmpresaVO Empresa = new EmpresaController().PegaEmpresa(FCaixa.Configuracao.IdEmpresa);
                        if (Empresa.Uf == "MG")
                        {
                            Mensagem = Mensagem + "MINAS LEGAL:" +
                                       Empresa.Cnpj.Substring(8, 1) + FDataModule.ACBrECF.DataHora.ToString("ddMMyyyy");
                            if (FCaixa.VendaCabecalho.ValorFinal >= 1)
                            {
                                Mensagem = Mensagem + FCaixa.VendaCabecalho.ValorFinal.Value.ToString("0.00");
                            }
                            Mensagem = Mensagem + "\r" + "\n";
                        }
                        UECF.FechaCupom(Mensagem + FCaixa.Configuracao.MensagemCupom);
                    }
                    catch (Exception eError)
                    {
                        Log.write(eError.ToString());
                    }
                } break;

                case ACBrFramework.TEFD.OperacaoECF.SubTotalizaCupom:
                    SubTotalizaCupom();     //FDataModule.ACBrECF.SubtotalizaCupom(0);
                    break;

                case ACBrFramework.TEFD.OperacaoECF.FechaVinculado:
                {
                    FDataModule.ACBrECF.FechaRelatorio();
                    UPAF.GravaR06("CC");
                } break;

                case ACBrFramework.TEFD.OperacaoECF.PulaLinhas:
                {
                    FDataModule.ACBrECF.PulaLinhas(FDataModule.ACBrECF.LinhasEntreCupons);
                    FDataModule.ACBrECF.CortaPapel(true);
                    Thread.Sleep(200);
                } break;
                }

                e.RetornoECF = true;
            }
            catch (Exception eError)
            {
                Log.write(eError.ToString());
                e.RetornoECF = false;
            }
        }
        public void CancelaPreVendasPendentes(List <PreVendaCabecalhoVO> ListaPreVendaCabecalho, List <PreVendaDetalheVO> ListaPreVendaDetalhe)
        {
            string Mensagem;
            int    IdMovimento, ItemCupom;
            string Id;

            IdMovimento = FCaixa.Movimento.Id;

            for (int i = 0; i <= ListaPreVendaCabecalho.Count - 1; i++)
            {
                VendaCabecalhoVO      VendaCabecalho    = new VendaCabecalhoVO();
                List <VendaDetalheVO> ListaVendaDetalhe = new List <VendaDetalheVO>();
                VendaController       VendaController   = new VendaController();

                ItemCupom = 0;

                FDataModule.ACBrECF.AbreCupom();

                VendaCabecalho.IdMovimento = IdMovimento;
                VendaCabecalho.DataVenda   = FDataModule.ACBrECF.DataHora;
                VendaCabecalho.HoraVenda   = FDataModule.ACBrECF.DataHora.ToString("hh:mm:ss");
                VendaCabecalho.StatusVenda = "C";
                VendaCabecalho.CFOP        = FCaixa.Configuracao.CFOPECF;
                VendaCabecalho.COO         = Convert.ToInt32(FDataModule.ACBrECF.NumCOO);
                VendaCabecalho.CCF         = Convert.ToInt32(FDataModule.ACBrECF.NumCCF);
                VendaCabecalho.ValorVenda  = ListaPreVendaCabecalho[i].Valor;
                VendaCabecalho.IdPreVenda  = ListaPreVendaCabecalho[i].Id;
                VendaCabecalho             = VendaController.IniciaVenda(VendaCabecalho);

                Id = Convert.ToString(ListaPreVendaCabecalho[i].Id);

                Mensagem = FCaixa.MD5 + "PV" + new string('0', 10 - Id.Length) + Id + "\r" + "\n";

                for (int j = 0; j <= ListaPreVendaDetalhe.Count - 1; j++)
                {
                    if (ListaPreVendaDetalhe[j].IdPreVenda == ListaPreVendaCabecalho[i].Id)
                    {
                        ItemCupom++;
                        VendaDetalheVO VendaDetalhe = new VendaDetalheVO();
                        ProdutoVO      Produto      = new ProdutoController().ConsultaId(ListaPreVendaDetalhe[j].IdProduto);
                        VendaDetalhe.IdProduto        = ListaPreVendaDetalhe[j].IdProduto;
                        VendaDetalhe.CFOP             = FCaixa.Configuracao.CFOPECF;
                        VendaDetalhe.IdVendaCabecalho = VendaCabecalho.Id;
                        VendaDetalhe.DescricaoPDV     = Produto.DescricaoPDV;
                        VendaDetalhe.UnidadeProduto   = Produto.UnidadeProduto;
                        VendaDetalhe.CST                = Produto.Cst;
                        VendaDetalhe.ECFICMS            = Produto.ECFICMS;
                        VendaDetalhe.TaxaICMS           = Produto.AliquotaICMS;
                        VendaDetalhe.TotalizadorParcial = Produto.TotalizadorParcial;
                        VendaDetalhe.Quantidade         = ListaPreVendaDetalhe[j].Quantidade;
                        VendaDetalhe.ValorUnitario      = ListaPreVendaDetalhe[j].ValorUnitario;
                        VendaDetalhe.ValorTotal         = ListaPreVendaDetalhe[j].ValorTotal;
                        if (Produto.GTIN.Trim() == "")
                        {
                            VendaDetalhe.GTIN = Convert.ToString(Produto.Id);
                        }
                        else
                        {
                            VendaDetalhe.GTIN = Produto.GTIN;
                        }

                        VendaDetalhe.Item = ItemCupom;
                        if (Produto.IPPT == "T")
                        {
                            VendaDetalhe.MovimentaEstoque = "S";
                        }
                        else
                        {
                            VendaDetalhe.MovimentaEstoque = "N";
                        }

                        ListaVendaDetalhe.Add(VendaDetalhe);
                        VendaController.InserirItem(VendaDetalhe);

                        FDataModule.ACBrECF.VendeItem(ListaPreVendaDetalhe[j].GtinProduto, ListaPreVendaDetalhe[j].NomeProduto, ListaPreVendaDetalhe[j].ECFICMS, Convert.ToDecimal(ListaPreVendaDetalhe[j].Quantidade), Convert.ToDecimal(ListaPreVendaDetalhe[j].ValorUnitario));
                    }
                }// for j = 0 to ListaPreVendaDetalhe.Count - 1 do

                FDataModule.ACBrECF.SubtotalizaCupom();
                FDataModule.ACBrECF.EfetuaPagamento(FDataModule.ACBrECF.FormasPagamento[0].Indice, Convert.ToDecimal(ListaPreVendaCabecalho[i].Valor));

                try
                {
                    EmpresaVO Empresa = new EmpresaController().PegaEmpresa(FCaixa.Configuracao.IdEmpresa);
                    if (Empresa.Uf == "MG")
                    {
                        Mensagem = Mensagem + "MINAS LEGAL:" +
                                   Empresa.Cnpj.Substring(8, 1) + FDataModule.ACBrECF.DataHora.ToString("ddmmyyyy");
                        if (FCaixa.VendaCabecalho.ValorFinal >= 1)
                        {
                            Mensagem = Mensagem + FCaixa.VendaCabecalho.ValorFinal.ToString();
                        }
                        Mensagem = Mensagem + "\r" + "\n";
                    }
                }
                catch (Exception eError)
                {
                    Log.write(eError.ToString());
                }

                UECF.FechaCupom(Mensagem + FCaixa.Configuracao.MensagemCupom);
                UECF.CancelaCupom();
                VendaController.CancelaVenda(VendaCabecalho, ListaVendaDetalhe);
            }// for i := 0 to ListaPreVendaCabecalho.Count - 1 do

            FCaixa.Movimento = new MovimentoController().VerificaMovimento();
        }
Example #8
0
        private void Confirma()
        {
            try
            {
                // verifica se senha e o nivel do operador estáo corretos
                OperadorVO Operador = OperadorController.ConsultaUsuario(editLoginOperador.Text, editSenhaOperador.Text);
                if (Operador != null)
                {
                    // verifica se senha do gerente esta correta
                    OperadorVO Gerente = OperadorController.ConsultaUsuario(editLoginGerente.Text, editSenhaGerente.Text);
                    if (Gerente != null)
                    {
                        // verifica nivel de acesso do gerente/supervisor
                        if ((Gerente.Nivel == "G") || (Gerente.Nivel == "S"))
                        {
                            if (UECF.ImpressoraOK(2))
                            {
                                DataRow Registro = DTTurno.Rows[GridTurno.CurrentRow.Index];

                                // insere movimento
                                Movimento                     = new MovimentoVO();
                                Movimento.IdTurno             = Convert.ToInt32(Registro["ID"]);
                                Movimento.IdImpressora        = FCaixa.Configuracao.IdImpressora;
                                Movimento.IdEmpresa           = FCaixa.Configuracao.IdEmpresa;
                                Movimento.IdOperador          = Operador.Id;
                                Movimento.IdCaixa             = FCaixa.Configuracao.IdCaixa;
                                Movimento.IdGerenteSupervisor = Gerente.Id;
                                Movimento.DataAbertura        = FDataModule.ACBrECF.DataHora;
                                Movimento.HoraAbertura        = FDataModule.ACBrECF.DataHora.ToString("hh:mm:ss");
                                Movimento.TotalSuprimento     = Convert.ToDecimal(editValorSuprimento.Text);
                                Movimento.Status              = "A";
                                Movimento.Sincronizado        = "N";
                                Movimento                     = MovimentoController.IniciaMovimento(Movimento);
                            }
                            else
                            {
                                MessageBox.Show("Não foi possivel abrir o movimento!.", "Informação do Sistema", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                FCaixa.StatusCaixa = 3;
                                this.Close();
                            }

                            // insere suprimento
                            if (Convert.ToDecimal(editValorSuprimento.Text) != 0)
                            {
                                try
                                {
                                    SuprimentoVO Suprimento = new SuprimentoVO();
                                    Suprimento.IdMovimento    = Movimento.Id;
                                    Suprimento.DataSuprimento = FDataModule.ACBrECF.DataHora;
                                    Suprimento.Valor          = Convert.ToDecimal(editValorSuprimento.Text);
                                    MovimentoController.Suprimento(Suprimento);
                                }
                                catch (Exception eError)
                                {
                                    Log.write(eError.ToString());
                                }
                            }

                            FCaixa.LabelMensagens.Text = "CAIXA ABERTO";
                            if (Movimento != null)
                            {
                                FCaixa.LabelCaixa.Text    = "Terminal: " + Movimento.NomeCaixa;
                                FCaixa.LabelOperador.Text = "Operador: " + Movimento.LoginOperador;
                                MessageBox.Show("Movimento aberto com sucesso.", "Informação do Sistema", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                FCaixa.Movimento = Movimento;
                                ImprimeAbertura();
                            }
                            Application.DoEvents();
                            this.Close();
                        }
                        else
                        {
                            MessageBox.Show("Gerente ou Supervisor: nivel de acesso incorreto.", "Informação do Sistema", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            editLoginGerente.Focus();
                        }
                    }
                    else
                    {
                        MessageBox.Show("Gerente ou Supervisor: dados incorretos.", "Informação do Sistema", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        editLoginGerente.Focus();
                    }
                }
                else
                {
                    MessageBox.Show("Operador: dados incorretos.", "Informação do Sistema", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    editSenhaOperador.Focus();
                }
            }
            catch (Exception eError)
            {
                Log.write(eError.ToString());
            }
        }