Пример #1
0
        private void lerXML(String caminho)
        {
            xml1 = new LeituraXML(caminho);
            SIME.Class.NFe.nota_entrada nota;
            Boolean chaveCadastrada = false;

            //Processo de identificação e gravação da NFe
            try
            {
                nota            = new Class.NFe.nota_entrada(xml1.getChave());
                chaveCadastrada = true;
            }
            catch (Exception)
            {
                nota = new Class.NFe.nota_entrada(xml1.getProdutosNfe().Count());
                nota.setChave(xml1.getChave());
                nota.setLocal(caminho);
                nota.setDataEmissao(Convert.ToDateTime(xml1.getNota().getData()));
                nota.salvar();
            }

            LabChave.Text    = nota.getChave();//Armazena a chave da NF-e
            listaProdutosNFE = xml1.getProdutosNfe();
            ListNfe.Items.Clear();

            String CNPJ = xml1.getFornecedor().getCNPJ();

            ataulizaLista(nota, chaveCadastrada, listaProdutosNFE);//Verifica se já há registros de vinculo com a Tabela de Notas de entrada

            ListBuscaR1.Items.Clear();
            LabForncedor.Text = xml1.getFornecedor().getFantasia() + " - " + xml1.getFornecedor().getNome();

            if (chaveCadastrada)
            {
                imgOk.ImageUrl             = "~/imagens/ok_16x16.gif";
                upbuscaFornecedor1.Visible = false;
                LabForncedor.Text         += "</br> <font Color='RED'> NOTA JÁ CADASTRADA OU INICIADO O CADASTRO. </font>";
            }
            else
            {
                imgOk.ImageUrl             = "~/imagens/delete_16x16.gif";
                upbuscaFornecedor1.Visible = true;
                new Fornecedores().MontaListaFornecedores(CombForncedores1);
            }

            FormaPagamento formas = xml1.getFormasPagamento();


            List <String[]> lista = new List <String[]>();

            for (int i = 0; i < formas.getNumeroParcelas(); i++)
            {
                lista.Add(new String[] { (i + 1) + "ª", formas.getDtVencimento(i).ToString(), " Valor: " + formas.getValorParcela(i).ToString("N") });
            }

            UteisWeb util = new UteisWeb();

            LabForncedor0.Text = util.montaTab(lista, "N° de parcelas: " + formas.getNumeroParcelas(), System.Drawing.Color.LightBlue);
            LabForncedor1.Text = "N° da NF: " + xml1.getNota().getNumeroNF().ToString() + " Data da NF: " + xml1.getNota().getData().ToString();
        }