Exemplo n.º 1
0
        private void VerificaSituacaodoArquivo(string NumeroNota, int CUPOMELETRONICOID)
        {
            try
            {
                Application.DoEvents();
                this.Text = "Aguarde.. processando...";

                string arquivo = BmsSoftware.ConfigNFCe.Default.LocalInstalacaoNewSystems + @"\Processados\NFCe_" + NumeroNota + ".txt";

                //100 Autorizado o uso da NF-e
                //101 Cancelamento de NF-e homologado
                //102 Inutilização de número homologado
                //103 Lote recebido com sucesso
                //104 Lote processado
                //105 Lote em processamento
                //106 Lote não localizado
                //107 Serviço em Operação
                //108 Serviço Paralisado Momentaneamente (curto prazo)
                //109 Serviço Paralisado sem Previsão
                //110 Uso Denegado
                //111 Consulta cadastro com uma ocorrência
                //112 Consulta cadastro com mais de uma ocorrência

                //usando a instrução using os recursos são liberados após a conclusão da operação

                if (File.Exists(arquivo))
                {
                    using (StreamReader sr = new StreamReader(arquivo))
                    {
                        String linha;
                        // Lê linha por linha até o final do arquivo
                        while ((linha = sr.ReadLine()) != null)
                        {
                            if (linha.IndexOf("|100|") != -1)//Autorizado
                            {
                                CUPOMELETRONICOEntity CUPOMELETRONICOTy_2 = new CUPOMELETRONICOEntity();
                                CUPOMELETRONICOTy_2 = CUPOMELETRONICOP.Read(CUPOMELETRONICOID);
                                CUPOMELETRONICOTy_2.IDSTATUSNFCE = 1;//Enviado
                                CUPOMELETRONICOTy_2.PROTOCOLO    = linha.Substring(3, 15);
                                CUPOMELETRONICOP.Save(CUPOMELETRONICOTy_2);
                            }
                        }
                    }
                }
                else
                {
                    Application.DoEvents();
                    this.Text = "Fechar Venda";
                }
            }
            catch (Exception ex)
            {
                Application.DoEvents();
                this.Text = "Fechar Venda";

                MessageBox.Show("Erro técnico: " + ex.Message);
            };
        }
Exemplo n.º 2
0
        private void FrmAlteraNFCe_Load(object sender, EventArgs e)
        {
            this.FormBorderStyle = FormBorderStyle.FixedDialog;

            GetDropStatus();

            if (_CUPOMELETRONICOID != -1)
            {
                CUPOMELETRONICOTy      = CUPOMELETRONICOP.Read(_CUPOMELETRONICOID);
                lblNotaFiscal.Text     = CUPOMELETRONICOTy.NUMERONFCE.ToString().Trim();
                cbStatus.SelectedValue = CUPOMELETRONICOTy.IDSTATUSNFCE;
                txtChave.Text          = CUPOMELETRONICOTy.CHAVEACESSO.Trim();
                txtProtocolo.Text      = CUPOMELETRONICOTy.PROTOCOLO.Trim();
            }

            btnSair.Image = Util.GetAddressImage(21);
        }
Exemplo n.º 3
0
        private void FrmItensVenda_Load(object sender, EventArgs e)
        {
            try
            {
                this.FormBorderStyle = FormBorderStyle.FixedDialog;
                AddItemProdutosNFCe(CUPOMELETRONICOID);
                ExibirDadosCupom(CUPOMELETRONICOID);
                GetDropProdutos();

                btnSair.Image   = Util.GetAddressImage(21);
                btnSalvar.Image = Util.GetAddressImage(15);
                btnLimpar.Image = Util.GetAddressImage(16);

                CUPOMELETRONICOTy = CUPOMELETRONICOP.Read(CUPOMELETRONICOID);

                if (CUPOMELETRONICOTy.IDSTATUSNFCE == 4)// Aberto
                {
                    dtgItensCupom.Enabled = true;
                    cbProduto.Enabled     = true;
                    txtQuant.Enabled      = true;
                    txtvalorunit.Enabled  = true;
                    btnSalvar.Enabled     = true;
                    btnLimpar.Enabled     = true;
                }
                else
                {
                    dtgItensCupom.Enabled = false;
                    cbProduto.Enabled     = false;
                    txtQuant.Enabled      = false;
                    txtvalorunit.Enabled  = false;
                    btnSalvar.Enabled     = false;
                    btnLimpar.Enabled     = false;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Erro técnico: " + ex.Message);
            }
        }
Exemplo n.º 4
0
        private void PreencheGrid()
        {
            ValotTotalGeral = 0;

            CreaterCursor Cr = new CreaterCursor();

            this.Cursor = Cr.CreateCursor(Cr.btmap, 0, 0);

            DataGriewDados.Rows.Clear();
            CUPOMELETRONICOProvider CUPOMELETRONICOP = new CUPOMELETRONICOProvider();

            foreach (var LIS_PRODUTONFCETy in LIS_PRODUTONFCEColl)
            {
                CUPOMELETRONICOEntity CUPOMELETRONICOTy = new CUPOMELETRONICOEntity();
                CUPOMELETRONICOTy = CUPOMELETRONICOP.Read(Convert.ToInt32(LIS_PRODUTONFCETy.CUPOMELETRONICOID));
                string NumCupom   = CUPOMELETRONICOTy.NUMERONFCE.ToString();
                string Data       = Convert.ToDateTime(CUPOMELETRONICOTy.DTEMISSAO).ToString("dd/MM/yyyy");
                string Produto    = LIS_PRODUTONFCETy.NOMEPRODUTO;
                string Quantidade = Convert.ToDecimal(LIS_PRODUTONFCETy.QUANTIDADE).ToString("n3");
                string VlUnit     = Convert.ToDecimal(LIS_PRODUTONFCETy.VALORUNITARIO).ToString("n3");
                string VlTotal    = Convert.ToDecimal(LIS_PRODUTONFCETy.VALORTOTAL).ToString("n2");

                ValotTotalGeral += Convert.ToDecimal(LIS_PRODUTONFCETy.VALORTOTAL);

                DataGridViewRow row2 = new DataGridViewRow();
                row2.CreateCells(DataGriewDados, NumCupom, Data, Produto, Quantidade, VlUnit, VlTotal);
                row2.DefaultCellStyle.Font = new Font("Arial", 8);
                DataGriewDados.Rows.Add(row2);
            }

            DataGridViewRow rowLinha = new DataGridViewRow();

            rowLinha.CreateCells(DataGriewDados, "", "", "", "", "Total Geral: ", ValotTotalGeral.ToString("n2"));
            rowLinha.DefaultCellStyle.Font = new Font("Arial", 8, FontStyle.Bold);
            DataGriewDados.Rows.Add(rowLinha);

            this.Cursor = Cursors.Default;
        }
Exemplo n.º 5
0
        private void ExibirDadosCupom(int CUPOMELETRONICOID)
        {
            try
            {
                RowRelatorio.Clear();
                RowRelatorio.Add(new RowsFiltro("CUPOMELETRONICOID", "System.Int32", "=", CUPOMELETRONICOID.ToString()));
                LIS_PRODUTONFCEColl = LIS_PRODUTONFCEP.ReadCollectionByParameter(RowRelatorio);

                lblNumItens.Text = "Nº de Itens: " + LIS_PRODUTONFCEColl.Count.ToString();

                Entity = CUPOMELETRONICOP.Read(CUPOMELETRONICOID);

                if (LIS_PRODUTONFCEColl.Count > 0)
                {
                    EMPRESAEntity   EMPRESATy = new EMPRESAEntity();
                    EMPRESAProvider EMPRESAP  = new EMPRESAProvider();
                    EMPRESATy = EMPRESAP.Read(1);

                    tbProdutos.Text  = String.Empty;
                    tbProdutos.Text += @"-----------------------------------------------------" + Environment.NewLine;
                    tbProdutos.Text += @"Data: " + DateTime.Now.ToString("dd/MM/yyyy") + Environment.NewLine;
                    tbProdutos.Text += @"Nome: " + EMPRESATy.NOMEFANTASIA + Environment.NewLine;
                    tbProdutos.Text += @"CNPJ: " + String.Format(@"{0:00\.000\.000\/0000\-00}", EMPRESATy.CNPJCPF) + Environment.NewLine;
                    tbProdutos.Text += @"-----------------------------------------------------" + Environment.NewLine;


                    //Dados Do Produto
                    string header    = String.Format("{0,12}{1,8}{2,12}\n", "Item", "Codigo", "Descrição");
                    string subheader = String.Format("{0,12}{1,12}{2,8}\n", "", "Unidade", "Valor");
                    tbProdutos.Text += @"-----------------------------------------------------" + Environment.NewLine;
                    tbProdutos.Text += header + Environment.NewLine;
                    tbProdutos.Text += subheader + Environment.NewLine;
                    int itemProduto = 1;


                    //for (int i = LIS_PRODUTONFCEColl.Count; i > LIS_PRODUTONFCEColl.Count; i--)
                    foreach (LIS_PRODUTONFCEEntity item in LIS_PRODUTONFCEColl)
                    {
                        tbProdutos.Text += Environment.NewLine;
                        tbProdutos.Text += String.Format("{0,6}{1,8}  {2,12}\n", itemProduto.ToString().PadLeft(3, '0'), item.IDPRODUTO.ToString(), item.NOMEPRODUTO);
                        tbProdutos.Text += String.Format("{0,12}{1,12}{2,8}\n", "      ", Convert.ToDecimal(item.QUANTIDADE).ToString("n4") + " x ", Convert.ToDecimal(item.VALORUNITARIO).ToString("n2"));
                        tbProdutos.Text += @"-----------------------------------------------------" + Environment.NewLine;
                        itemProduto++;
                    }

                    // tbProdutos.Select(tbProdutos.Text.Length, 0);
                    this.tbProdutos.Focus();
                    int textLength = tbProdutos.Text.Length;
                    tbProdutos.SelectionStart = textLength;
                    tbProdutos.ScrollToCaret();
                    // tbProdutos.SelectionLength = 0;
                    //
                    //this.tbProdutos.Focus();
                    //this.tbProdutos.SelectionStart = Strings.Len(this.tbProdutos.Text);
                    //this.tbProdutos.ScrollToCaret();
                }
                else
                {
                    MessageBox.Show("Cupom Eletrônico não localizado!");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Erro técnico: " + ex.Message);
            }
        }
Exemplo n.º 6
0
        private void VerificaArquivoContingencia(string NumeroNota, int CUPOMELETRONICOID)
        {
            CreaterCursor Cr = new CreaterCursor();

            this.Cursor = Cr.CreateCursor(Cr.btmap, 0, 0);

            try
            {
                string arquivo = BmsSoftware.ConfigNFCe.Default.LocalInstalacaoNewSystems + @"\Processados\nsConcluido\contingencia_ret.txt";

                Application.DoEvents();
                this.Text = "Aguarde.. processando...";

                //100 Autorizado o uso da NF-e
                //101 Cancelamento de NF-e homologado
                //102 Inutilização de número homologado
                //103 Lote recebido com sucesso
                //104 Lote processado
                //105 Lote em processamento
                //106 Lote não localizado
                //107 Serviço em Operação
                //108 Serviço Paralisado Momentaneamente (curto prazo)
                //109 Serviço Paralisado sem Previsão
                //110 Uso Denegado
                //111 Consulta cadastro com uma ocorrência
                //112 Consulta cadastro com mais de uma ocorrência

                //usando a instrução using os recursos são liberados após a conclusão da operação

                if (File.Exists(arquivo))
                {
                    CUPOMELETRONICOEntity CUPOMELETRONICOTy_2 = new CUPOMELETRONICOEntity();
                    CUPOMELETRONICOTy_2 = CUPOMELETRONICOP.Read(CUPOMELETRONICOID);

                    using (StreamReader sr = new StreamReader(arquivo))
                    {
                        String linha;
                        // Lê linha por linha até o final do arquivo
                        while ((linha = sr.ReadLine()) != null)
                        {
                            if (Util.RetiraLetras(CUPOMELETRONICOTy_2.CHAVEACESSO) != string.Empty)
                            {
                                if (linha.IndexOf(Util.RetiraLetras(CUPOMELETRONICOTy_2.CHAVEACESSO)) != -1) //Chave de acesso na linha
                                {
                                    if (linha.IndexOf("Autorizado") != -1)                                   //Autorizado
                                    {
                                        CUPOMELETRONICOTy_2.IDSTATUSNFCE = 1;                                //Enviado
                                        CUPOMELETRONICOTy_2.PROTOCOLO    = Util.RetiraLetras(linha.Substring(3, 16));
                                        CUPOMELETRONICOP.Save(CUPOMELETRONICOTy_2);
                                    }
                                }
                            }
                        }
                    }
                }
                else
                {
                    Application.DoEvents();
                }

                this.Cursor = Cursors.Default;
                this.Text   = "  IMEX Sistemas - NFCe Nota Fiscal de Consumidor Eletrônica";
            }
            catch (Exception ex)
            {
                this.Cursor = Cursors.Default;
                this.Text   = "  IMEX Sistemas - NFCe Nota Fiscal de Consumidor Eletrônica";
                MessageBox.Show("Erro técnico: " + ex.Message);
            }
        }