コード例 #1
0
ファイル: Importa.aspx.cs プロジェクト: Laerton2016/SIME
        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();
        }
コード例 #2
0
ファイル: Importa.aspx.cs プロジェクト: Laerton2016/SIME
        protected void btAdd1_Click(object sender, EventArgs e)
        {
            SIME.Class.NFe.nota_entrada nota = new Class.NFe.nota_entrada(LabChave.Text);
            Int32  ItemNFE = Convert.ToInt32(ListNfe.SelectedValue), Id_Produto = Convert.ToInt32(ListBuscaR1.SelectedValue);
            string EAN = listaProdutosNFE.getEAN(ItemNFE);
            String NCM = listaProdutosNFE.getNCM(ItemNFE);
            String ValorUnitario = listaProdutosNFE.getValorUnitario(ItemNFE).ToString();
            String IPI = listaProdutosNFE.getAiqIPI(ItemNFE).ToString(), ICMS = listaProdutosNFE.getAiqICMS(ItemNFE).ToString(), ST = listaProdutosNFE.getValorICMSST(ItemNFE).ToString();
            String Entrada = listaProdutosNFE.getQuantidadeProduto(ItemNFE).ToString() + "-" + xml1.getNota().getNumeroNF() + "-" + xml1.getFornecedor().getFornecedor().getID().ToString()
                             + "-" + xml1.getNota().getData();

            //procedimentos na Base de dados Notas;
            nota.setItem(ItemNFE, Id_Produto);
            nota.salvar();

            Int32 itemSelecionado = ListNfe.SelectedIndex;

            ataulizaLista(nota);

            if (ListNfe.SelectedIndex < ListNfe.Items.Count - 1)
            {
                ListNfe.SelectedIndex = ListNfe.SelectedIndex + 1;
            }


            Response.Redirect("~/Produtos/produtos.aspx?ID=" + ListBuscaR1.SelectedValue + "&EAN=" + EAN + "&NCM=" + NCM +
                              "&Valor=" + ValorUnitario + "&IPI=" + IPI + "&ICMS=" + ICMS + "&ST=" + ST + "&entrada=" + Entrada, "_blank", "menubar=0,width=1000,height=800");
            ListBuscaR1.Items.Clear();
        }
コード例 #3
0
ファイル: Importa.aspx.cs プロジェクト: Laerton2016/SIME
        protected void btBuscaItem_Click(object sender, EventArgs e)
        {
            algoritimoBuscaProduto busca = new algoritimoBuscaProduto();

            String textoItem = "", EAN = "";
            Int32  id_produto = 0;

            try
            {
                textoItem    = ListNfe.SelectedItem.Text;
                labErro.Text = "";
            }
            catch (Exception)
            {
                labErro.Text    = "Não foi selecionado nenhum item para busca.";
                labErro.Visible = true;
                return;
            }



            ListBuscaR1.Visible = true;
            //Leitura do arquivo XML
            EAN = listaProdutosNFE.getEAN(Convert.ToInt32(ListNfe.SelectedValue));



            //Busca por EAN
            if (!EAN.Equals(""))
            {
                id_produto = busca.BuscaProdutopporEAN(EAN);
                if (id_produto != 0)
                {
                    Produto produto = new Produto(id_produto, new Conexao().getDb4());
                    ListBuscaR1.Items.Clear();
                    ListBuscaR1.Items.Add(new ListItem(produto.getDescricao(), produto.getID().ToString()));
                }
                else
                {
                    buscaSemelhante(busca, textoItem);
                }
            }
            else
            {
                buscaSemelhante(busca, textoItem);
            }
            //Libera a atualização do PainelUpdate
            upListaBusca1.Update();
            SIME.Class.NFe.nota_entrada nota = new Class.NFe.nota_entrada(LabChave.Text);
            ataulizaLista(nota);
        }