Ejemplo n.º 1
0
        public belEncerramentoMDFe(PesquisaManifestosModel objPesquisa, string cUF, string cMun)
        {
            this.objPesquisa = objPesquisa;
            XNamespace pf = "http://www.portalfiscal.inf.br/mdfe";
            XContainer envCTe = new XElement(pf + "evEncMDFe",
                 new XElement(pf + "descEvento", "Encerramento"),
                 new XElement(pf + "nProt", objPesquisa.protocolo),
                 new XElement(pf + "dtEnc", daoUtil.GetDateServidor().ToString("yyyy-MM-dd")),
                 new XElement(pf + "cUF", cUF),
                 new XElement(pf + "cMun", cMun.Trim()));
            XmlDocument xmlCanc = new XmlDocument();
            xmlCanc.LoadXml(envCTe.ToString());
            string sPath = Pastas.PROTOCOLOS + objPesquisa.protocolo + "evEnc.xml";
            if (File.Exists(sPath))
                File.Delete(sPath);
            xmlCanc.Save(sPath);
            try
            {
                belValidaXml.ValidarXml("http://www.portalfiscal.inf.br/mdfe", Pastas.SCHEMA_MDFe + "\\evEncMDFe_v1.00.xsd", sPath);
            }
            catch (Exception ex)
            {                
                throw ex;
            }

            objEvento = new belEventoMDFe(xmlCanc.DocumentElement, objPesquisa, "110112");

          //  Encerramento();
        }
Ejemplo n.º 2
0
        public belEncerramentoMDFe(PesquisaManifestosModel objPesquisa, string cUF, string cMun)
        {
            this.objPesquisa = objPesquisa;
            XNamespace pf     = "http://www.portalfiscal.inf.br/mdfe";
            XContainer envCTe = new XElement(pf + "evEncMDFe",
                                             new XElement(pf + "descEvento", "Encerramento"),
                                             new XElement(pf + "nProt", objPesquisa.protocolo),
                                             new XElement(pf + "dtEnc", daoUtil.GetDateServidor().ToString("yyyy-MM-dd")),
                                             new XElement(pf + "cUF", cUF),
                                             new XElement(pf + "cMun", cMun.Trim()));
            XmlDocument xmlCanc = new XmlDocument();

            xmlCanc.LoadXml(envCTe.ToString());
            string sPath = Pastas.PROTOCOLOS + objPesquisa.protocolo + "evEnc.xml";

            if (File.Exists(sPath))
            {
                File.Delete(sPath);
            }
            xmlCanc.Save(sPath);
            try
            {
                belValidaXml.ValidarXml("http://www.portalfiscal.inf.br/mdfe", Pastas.SCHEMA_MDFe + "\\evEncMDFe_v1.00.xsd", sPath);
            }
            catch (Exception ex)
            {
                throw ex;
            }

            objEvento = new belEventoMDFe(xmlCanc.DocumentElement, objPesquisa, "110112");

            //  Encerramento();
        }
Ejemplo n.º 3
0
 public frmEncerramentoMDFe(PesquisaManifestosModel objPesquisa)
 {
     this.objPesquisa = objPesquisa;
     InitializeComponent();
     cbxCidades.DataSource    = belMunicipios.GetMunicipios();
     cbxCidades.DisplayMember = "xMun";
     cbxCidades.ValueMember   = "cMun";
 }
Ejemplo n.º 4
0
        public belDadosManifesto(PesquisaManifestosModel objManifesto)
        {
            this.objManifesto = objManifesto;
            this.enviMDFe     = new TEnviMDFe();

            this.enviMDFe.MDFe                = new TMDFe();
            this.enviMDFe.MDFe.infMDFe        = new TMDFeInfMDFe();
            this.enviMDFe.MDFe.infMDFe.versao = Acesso.versaoMDFe;

            this.getIDE();
            this.getEmit();
            this.enviMDFe.idLote = this.enviMDFe.MDFe.infMDFe.ide.nMDF; // numero do lote.
            this.enviMDFe.versao = Acesso.versaoMDFe;
            this.GetInfDoc();
            this.GetTot();
            string sObs = daoManifesto.GetObs(objManifesto.sequencia);

            if (!(string.IsNullOrEmpty(sObs)))
            {
                this.enviMDFe.MDFe.infMDFe.infAdic        = new TMDFeInfMDFeInfAdic();
                this.enviMDFe.MDFe.infMDFe.infAdic.infCpl = daoManifesto.GetObs(objManifesto.sequencia);
            }
            this.GetRodoviarioPrincipal();
            this.enviMDFe.MDFe.infMDFe.infModal = new TMDFeInfMDFeInfModal();
            XmlSerializerNamespaces ns = new XmlSerializerNamespaces();

            ns.Add("", "http://www.portalfiscal.inf.br/mdfe");
            string sRodo = SerializeToString <rodo>(objRodo, ns);

            System.Xml.XmlDocument xml = new XmlDocument();
            xml.LoadXml(sRodo);
            this.enviMDFe.MDFe.infMDFe.infModal.Any         = xml.DocumentElement;
            this.enviMDFe.MDFe.infMDFe.infModal.versaoModal = Acesso.versaoMDFe;
            this.enviMDFe.MDFe.infMDFe.ide.cDV = GeraChaveMDFe().ToString();
            this.GeraXmlAndValida();

            string sPathRodo = Pastas.ENVIO + this.enviMDFe.MDFe.infMDFe.Id.Substring(6, 4) + "\\rodo_" + this.enviMDFe.idLote + ".xml";

            if (File.Exists(sPathRodo))
            {
                File.Delete(sPathRodo);
            }
            xml.Save(sPathRodo);


            try
            {
                belValidaXml.ValidarXml("http://www.portalfiscal.inf.br/mdfe", Pastas.SCHEMA_MDFe + "\\mdfeModalRodoviario_v1.00.xsd", sPathRodo);
            }
            catch (Exception ex)
            {
                throw ex;
            }


            Envio = new belTransmiteMDFe(this.sPathLote, this.enviMDFe, this.xmlFinal);
        }
Ejemplo n.º 5
0
 public belBuscaRetornoMDFe(PesquisaManifestosModel objPesquisa)
 {
     this.objPesquisa = objPesquisa;
     TConsReciMDFe objconsulta = new TConsReciMDFe();
     objconsulta.versao = Acesso.versaoMDFe;
     objconsulta.tpAmb = Acesso.TP_AMB == 1 ? TAmb.Item1 : TAmb.Item2;
     objconsulta.nRec = this.objPesquisa.recibo;
     string sPathSave = Pastas.PROTOCOLOS + "Rec_" + this.objPesquisa.numero + ".xml";
     if (File.Exists(sPathSave))
         File.Delete(sPathSave);
     XmlSerializerNamespaces ns = new XmlSerializerNamespaces();
     ns.Add("", "http://www.portalfiscal.inf.br/mdfe");
     SerializeClassToXml.SerializeClasse<TConsReciMDFe>(objconsulta, sPathSave, ns);
     xmlConsulta = new XmlDocument();
     xmlConsulta.PreserveWhitespace = false;
     xmlConsulta.Load(sPathSave);
 }
Ejemplo n.º 6
0
 public belEventoMDFe(XmlElement AnyXml, PesquisaManifestosModel objPesquisa, string tpEvento, string nSeq = "1")
 {
     this.objPesquisa = objPesquisa;
     evento = new TEvento();
     evento.versao = Acesso.versaoMDFe;
     evento.infEvento = new TEventoInfEvento();
     evento.infEvento.Id = "ID" + tpEvento + objPesquisa.chaveMDFe + nSeq.PadLeft(2,'0');
     evento.infEvento.cOrgao = Convert.ToByte(Acesso.cUF).ToString();
     evento.infEvento.tpAmb = Acesso.TP_AMB == 1 ? TAmb.Item1 : TAmb.Item2;
     evento.infEvento.CNPJ = Util.RetiraCaracterCNPJ(Acesso.CNPJ_EMPRESA);
     evento.infEvento.chMDFe = objPesquisa.chaveMDFe;
     evento.infEvento.dhEvento = daoUtil.GetDateServidor().ToString("yyyy-MM-ddTHH:mm:ss");
     evento.infEvento.tpEvento = tpEvento;
     evento.infEvento.nSeqEvento = nSeq;
     evento.infEvento.detEvento = new TEventoInfEventoDetEvento();
     evento.infEvento.detEvento.versaoEvento = Acesso.versaoMDFe;
     evento.infEvento.detEvento.Any = AnyXml;
 }
Ejemplo n.º 7
0
 public belEventoMDFe(XmlElement AnyXml, PesquisaManifestosModel objPesquisa, string tpEvento, string nSeq = "1")
 {
     this.objPesquisa                        = objPesquisa;
     evento                                  = new TEvento();
     evento.versao                           = Acesso.versaoMDFe;
     evento.infEvento                        = new TEventoInfEvento();
     evento.infEvento.Id                     = "ID" + tpEvento + objPesquisa.chaveMDFe + nSeq.PadLeft(2, '0');
     evento.infEvento.cOrgao                 = Convert.ToByte(Acesso.cUF).ToString();
     evento.infEvento.tpAmb                  = Acesso.TP_AMB == 1 ? TAmb.Item1 : TAmb.Item2;
     evento.infEvento.CNPJ                   = Util.RetiraCaracterCNPJ(Acesso.CNPJ_EMPRESA);
     evento.infEvento.chMDFe                 = objPesquisa.chaveMDFe;
     evento.infEvento.dhEvento               = daoUtil.GetDateServidor().ToString("yyyy-MM-ddTHH:mm:ss");
     evento.infEvento.tpEvento               = tpEvento;
     evento.infEvento.nSeqEvento             = nSeq;
     evento.infEvento.detEvento              = new TEventoInfEventoDetEvento();
     evento.infEvento.detEvento.versaoEvento = Acesso.versaoMDFe;
     evento.infEvento.detEvento.Any          = AnyXml;
 }
Ejemplo n.º 8
0
        public belCancelamentoMDFe(PesquisaManifestosModel objPesquisa, string xJust)
        {
            this.xJust = xJust;
            this.objPesquisa = objPesquisa;
            XNamespace pf = "http://www.portalfiscal.inf.br/mdfe";
            XContainer envCTe = new XElement(pf + "evCancMDFe",
                 new XElement(pf + "descEvento", "Cancelamento"),
                 new XElement(pf + "nProt", objPesquisa.protocolo),
                 new XElement(pf + "xJust", xJust.Trim()));


            XmlDocument xmlCanc = new XmlDocument();
            xmlCanc.LoadXml(envCTe.ToString());

            objEvento = new belEventoMDFe(xmlCanc.DocumentElement, objPesquisa, "110111");

           // ExecuteCancelamento();
        }
Ejemplo n.º 9
0
        public belCancelamentoMDFe(PesquisaManifestosModel objPesquisa, string xJust)
        {
            this.xJust       = xJust;
            this.objPesquisa = objPesquisa;
            XNamespace pf     = "http://www.portalfiscal.inf.br/mdfe";
            XContainer envCTe = new XElement(pf + "evCancMDFe",
                                             new XElement(pf + "descEvento", "Cancelamento"),
                                             new XElement(pf + "nProt", objPesquisa.protocolo),
                                             new XElement(pf + "xJust", xJust.Trim()));


            XmlDocument xmlCanc = new XmlDocument();

            xmlCanc.LoadXml(envCTe.ToString());

            objEvento = new belEventoMDFe(xmlCanc.DocumentElement, objPesquisa, "110111");

            // ExecuteCancelamento();
        }
Ejemplo n.º 10
0
        public belBuscaRetornoMDFe(PesquisaManifestosModel objPesquisa)
        {
            this.objPesquisa = objPesquisa;
            TConsReciMDFe objconsulta = new TConsReciMDFe();

            objconsulta.versao = Acesso.versaoMDFe;
            objconsulta.tpAmb  = Acesso.TP_AMB == 1 ? TAmb.Item1 : TAmb.Item2;
            objconsulta.nRec   = this.objPesquisa.recibo;
            string sPathSave = Pastas.PROTOCOLOS + "Rec_" + this.objPesquisa.numero + ".xml";

            if (File.Exists(sPathSave))
            {
                File.Delete(sPathSave);
            }
            XmlSerializerNamespaces ns = new XmlSerializerNamespaces();

            ns.Add("", "http://www.portalfiscal.inf.br/mdfe");
            SerializeClassToXml.SerializeClasse <TConsReciMDFe>(objconsulta, sPathSave, ns);
            xmlConsulta = new XmlDocument();
            xmlConsulta.PreserveWhitespace = false;
            xmlConsulta.Load(sPathSave);
        }
Ejemplo n.º 11
0
 public frmCancelarMDFe(PesquisaManifestosModel objPesquisa)
 {
     this.objPesquisa = objPesquisa;
     InitializeComponent();
 }