Esempio n. 1
0
        public belInfNFe xmlBuscaInfNFe()
        {
            belInfNFe objInfNFe = new belInfNFe();

            return objInfNFe;

        }
Esempio n. 2
0
        public belEscrituracao(belInfNFe pInfNFe)
        {
            try
            {
                bProdutorRural = false;
                objInfNFe = pInfNFe;
                string scdClifor = string.Empty;

                if (objInfNFe.Empresa != null)
                {
                    string sTipoLanc = TipoLancamento();
                    string sDoc = string.Empty;

                    #region Clientes/Fornecedores
                    if (objInfNFe.dest.Cnpj != null)
                    {
                        sDoc = FormataString(objInfNFe.dest.Cnpj.ToString(), "CNPJ");
                    }
                    else
                    {
                        sDoc = FormataString(objInfNFe.dest.Cpf.ToString(), "CPF");
                    }


                    if (!RegistroExiste("CLIFOR", (objInfNFe.dest.Cnpj != null ? "CD_CGC = '" : "CD_CPF ='") + sDoc + "'", "CD_CLIFOR"))
                    {

                        scdClifor = CadastraCliFor(sDoc);
                    }
                    else
                    {
                        scdClifor = BuscaCodigoClifor(sDoc);
                    }

                    objInfNFe.Cdclifor = scdClifor;
                    #endregion

                    bool bSaida = true;
                    if (sTipoLanc == "E")
                    {
                        bSaida = false;
                    }
                    Escritura(bSaida);
                }
            }
            catch (Exception ex)
            {
                new HLPexception(ex);
            }
        }
        private void frmImportaEscritorNfe_Load(object sender, EventArgs e)
        {
            try
            {
                belInfNFe objInfNFe = new belInfNFe();
                belEscrituracao objEscrituracao = new belEscrituracao(objInfNFe);

                cbxEmpresas.DisplayMember = "Descricao";
                cbxEmpresas.ValueMember = "Codigo";

                cbxEmpresas.DataSource = objEscrituracao.RetornaEmpresa();
            }
            catch (Exception ex)
            {
                new HLPexception(ex);
            }
        }
Esempio n. 4
0
        public belInfNFe MontaInfNFe()
        {
            belInfNFe objInfNFe = null;
            if (xmlAnalizado())
            {
                objInfNFe = new belInfNFe();
                objInfNFe.id = xmlBuscaId();
                objInfNFe.ide = xmlBuscaIde();
                objInfNFe.emit = xmlBuscaEmit();
                objInfNFe.dest = xmlBuscaDest();
                objInfNFe.det = xmlBuscaDet();
                objInfNFe.total = xmlBuscaTotal();
                objInfNFe.transp = xmlBuscaTransp();
                objInfNFe.cobr = xmlBuscaCobr();
                objInfNFe.infAdic = xmlBuscaInfAdic();
                objInfNFe.exporta = xmlBuscaExporta();
                objInfNFe.compra = xmlBuscaCompra();
                objInfNFe.protNFe = xmlBuscaProNFe();

            }
            //else
            //{
            //    throw new Exception("XML não pode ser Analisado");
            //} // Diego - tratar lista não validada
            return objInfNFe;
        }
Esempio n. 5
0
        public void CarregaDados()
        {
            try
            {

                lNotas = new List<belInfNFe>();
                foreach (belPesquisaNotas nota in lPesquisa)
                {
                    belInfNFe objInfNFe = new belInfNFe();
                    nota.sCHAVENFE = daoUtil.GeraChaveNFe(nota.sCD_NFSEQ);
                    objInfNFe.chaveNFe = "NFe" + nota.sCHAVENFE;

                    objInfNFe.ide.Carrega(nota.sCD_NFSEQ, objInfNFe.sDigVerif);

                    objInfNFe.emit.Carrega(nota.sCD_NFSEQ);

                    objInfNFe.dest.Carrega(nota.sCD_NFSEQ);
                    bool bEX = (objInfNFe.dest.Uf.Equals("EX") ? true : false);

                    objInfNFe.endent.Carrega(nota.sCD_NFSEQ);
                    belDet objbelDet = new belDet();
                    objInfNFe.det = objbelDet.Carrega(nota.sCD_NFSEQ, bEX, objInfNFe.dest.Uf);
                    #region RetiraValorBCICMSret dos Totais;
                    decimal dVbcIcmsRt = objInfNFe.det.Where(p => p.imposto.belIcms.belICMSSN500 != null).Select(p => p.imposto.belIcms.belICMSSN500.vBCSTRet).Sum();
                    decimal dVIcmsRt = objInfNFe.det.Where(p => p.imposto.belIcms.belICMSSN500 != null).Select(p => p.imposto.belIcms.belICMSSN500.vICMSSTRet).Sum();
                    #endregion

                    objInfNFe.total.Carrega(nota.sCD_NFSEQ, objbelDet.pbIndustri, bEX);
                    objInfNFe.total.belIcmstot.Vbcst = objInfNFe.total.belIcmstot.Vbcst - dVbcIcmsRt;
                    objInfNFe.total.belIcmstot.Vst = objInfNFe.total.belIcmstot.Vst - dVIcmsRt;
                    objInfNFe.total.belIcmstot.vTotTrib = objInfNFe.det.Sum(c => c.prod.vTotTrib);

                    objInfNFe.transp.Carrega(nota.sCD_NFSEQ);

                    objInfNFe.cobr.Carrega(nota.sCD_NFSEQ);

                    objInfNFe.infAdic.Carrega(nota.sCD_NFSEQ, objInfNFe.det, objInfNFe.dest.Cnpj, dVbcIcmsRt, dVIcmsRt);

                    if (Acesso.TRANSPARENCIA == 0 || Acesso.TRANSPARENCIA == 2)
                    {
                        string sMsg = objInfNFe.infAdic.Infcpl;
                        objInfNFe.infAdic.Infcpl = null;
                        objInfNFe.infAdic.Infcpl = daoUtil.CarregaObsTransparenciaNF(nota.sCD_NFSEQ) + sMsg;
                    }

                    if (Acesso.NM_EMPRESA.Equals("GIWA"))
                    {
                        if (objInfNFe.cobr != null)
                        {
                            if (objInfNFe.cobr.Fat != null)
                            {
                                if (objInfNFe.cobr.Fat.belDup != null)
                                {
                                    
                                    string sparecelas = string.Empty;
                                    foreach (var item in objInfNFe.cobr.Fat.belDup)
                                    {
                                        sparecelas += string.Format("{0}{1} VALOR R$ {2} | ", item.Dvenc.ToShortDateString(), (sparecelas == "" ? "" : " -")
                                            , item.Vdup.ToString("#0.00"));
                                    }
                                    if (objInfNFe.cobr.Fat.belDup.Count() > 0)
                                        objInfNFe.infAdic.Infcpl = "PARCELA(S): " + sparecelas;
                                }
                            }
                        }
                    }


                    lNotas.Add(objInfNFe);
                }
                objbelCriaXml = new belCriaXmlNFe(lNotas);

            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 6
0
        public belInfNFe xmlBuscaInfNFe()
        {
            belInfNFe objInfNFe = new belInfNFe();

            return(objInfNFe);
        }