Example #1
0
        public NFe()
        {
            ide = new Ide();
            emit = new Emit();
            dest = new Dest();
            avulsa = new Avulsa();
            entrega = new Entrega();
            autXML = new List<ConvertTxt.autXML>();
            retirada = new Retirada();
            det = new List<Det>();
            Transp = new Transp();
            Cobr = new Cobr();
            InfAdic = new InfAdic();
            cana = new Cana();
            protNFe = new protNFe();
            ///
            /// NFC-e
            pag = new List<pag>();

            infNFe.Versao = (decimal)2.0;
        }
Example #2
0
        public NFe()
        {
            ide      = new Ide();
            emit     = new Emit();
            dest     = new Dest();
            avulsa   = new Avulsa();
            entrega  = new Entrega();
            autXML   = new List <ConvertTxt.autXML>();
            retirada = new Retirada();
            det      = new List <Det>();
            Transp   = new Transp();
            Cobr     = new Cobr();
            InfAdic  = new InfAdic();
            cana     = new Cana();
            protNFe  = new protNFe();
            ///
            /// NFC-e
            pag = new List <pag>();

            infNFe.Versao = (decimal)2.0;
        }
Example #3
0
        /// <summary>
        /// GerarTransp
        /// </summary>
        /// <param name="Transp"></param>
        /// <param name="root"></param>
        private void GerarTransp(Transp Transp, XmlElement root)
        {
            XmlElement nodeTransp = doc.CreateElement("transp");
            root.AppendChild(nodeTransp);
            nodeCurrent = nodeTransp;

            wCampo(Transp.modFrete, TpcnTipoCampo.tcInt, TpcnResources.modFrete);
            //
            //  (**)GerarTranspTransporta;
            //
            if (!string.IsNullOrEmpty(Transp.Transporta.CNPJ) ||
                !string.IsNullOrEmpty(Transp.Transporta.CPF) ||
                !string.IsNullOrEmpty(Transp.Transporta.xNome) ||
                !string.IsNullOrEmpty(Transp.Transporta.IE) ||
                !string.IsNullOrEmpty(Transp.Transporta.xEnder) ||
                !string.IsNullOrEmpty(Transp.Transporta.xMun) ||
                !string.IsNullOrEmpty(Transp.Transporta.UF))
            {
                XmlElement nodeTransporta = doc.CreateElement("transporta");
                nodeTransp.AppendChild(nodeTransporta);
                nodeCurrent = nodeTransporta;

                if (!string.IsNullOrEmpty(Transp.Transporta.CNPJ))
                    wCampo(Transp.Transporta.CNPJ, TpcnTipoCampo.tcStr, TpcnResources.CNPJ);
                else
                    if (!string.IsNullOrEmpty(Transp.Transporta.CPF))
                        wCampo(Transp.Transporta.CPF, TpcnTipoCampo.tcStr, TpcnResources.CPF);
                wCampo(Transp.Transporta.xNome, TpcnTipoCampo.tcStr, TpcnResources.xNome, ObOp.Opcional);
                wCampo(Transp.Transporta.IE, TpcnTipoCampo.tcStr, TpcnResources.IE, ObOp.Opcional);
                wCampo(Transp.Transporta.xEnder, TpcnTipoCampo.tcStr, TpcnResources.xEnder, ObOp.Opcional);
                wCampo(Transp.Transporta.xMun, TpcnTipoCampo.tcStr, TpcnResources.xMun, ObOp.Opcional);
                wCampo(Transp.Transporta.UF, TpcnTipoCampo.tcStr, TpcnResources.UF, ObOp.Opcional);
            }
            //
            //  (**)GerarTranspRetTransp;
            //
            if ((Transp.retTransp.vServ > 0) ||
              (Transp.retTransp.vBCRet > 0) ||
              (Transp.retTransp.pICMSRet > 0) ||
              (Transp.retTransp.vICMSRet > 0) ||
              (!string.IsNullOrEmpty(Transp.retTransp.CFOP)) ||
              (Transp.retTransp.cMunFG > 0))
            {
                XmlElement nodeRetTransporta = doc.CreateElement("retTransp");
                nodeTransp.AppendChild(nodeRetTransporta);
                nodeCurrent = nodeRetTransporta;

                wCampo(Transp.retTransp.vServ, TpcnTipoCampo.tcDec2, TpcnResources.vServ);
                wCampo(Transp.retTransp.vBCRet, TpcnTipoCampo.tcDec2, TpcnResources.vBCRet);
                wCampo(Transp.retTransp.pICMSRet, TpcnTipoCampo.tcDec2, TpcnResources.pICMSRet);
                wCampo(Transp.retTransp.vICMSRet, TpcnTipoCampo.tcDec2, TpcnResources.vICMSRet);
                wCampo(Transp.retTransp.CFOP, TpcnTipoCampo.tcStr, TpcnResources.CFOP);
                wCampo(Transp.retTransp.cMunFG, TpcnTipoCampo.tcStr, TpcnResources.cMunFG);
            }
            //
            //  (**)GerarTranspVeicTransp;
            //
            if (!string.IsNullOrEmpty(Transp.veicTransp.placa) ||
              !string.IsNullOrEmpty(Transp.veicTransp.UF) ||
              !string.IsNullOrEmpty(Transp.veicTransp.RNTC))
            {
                XmlElement nodeveicTransp = doc.CreateElement("veicTransp");
                nodeTransp.AppendChild(nodeveicTransp);
                nodeCurrent = nodeveicTransp;

                wCampo(Transp.veicTransp.placa, TpcnTipoCampo.tcStr, TpcnResources.placa);
                wCampo(Transp.veicTransp.UF, TpcnTipoCampo.tcStr, TpcnResources.UF);
                wCampo(Transp.veicTransp.RNTC, TpcnTipoCampo.tcStr, TpcnResources.RNTC, ObOp.Opcional);
            }
            //
            //(**)GerarTranspReboque;
            //
            if (Transp.Reboque.Count > 2)
                this.cMensagemErro += "Transp.reboque: Excedeu o máximo permitido de 2" + Environment.NewLine;

            foreach (Reboque Reboque in Transp.Reboque)
            {
                XmlElement nodeReboque = doc.CreateElement("reboque");
                nodeTransp.AppendChild(nodeReboque);
                nodeCurrent = nodeReboque;

                wCampo(Reboque.placa, TpcnTipoCampo.tcStr, TpcnResources.placa);
                wCampo(Reboque.UF, TpcnTipoCampo.tcStr, TpcnResources.UF);
                wCampo(Reboque.RNTC, TpcnTipoCampo.tcStr, TpcnResources.RNTC, ObOp.Opcional);
            }

            wCampo(Transp.vagao, TpcnTipoCampo.tcStr, TpcnResources.vagao, ObOp.Opcional);
            wCampo(Transp.balsa, TpcnTipoCampo.tcStr, TpcnResources.balsa, ObOp.Opcional);

            //
            //(**)GerarTranspVol;
            //
            foreach (Vol Vol in Transp.Vol)
            {
                XmlElement nodeVol = doc.CreateElement("vol");
                nodeTransp.AppendChild(nodeVol);
                nodeCurrent = nodeVol;

                wCampo(Vol.qVol, TpcnTipoCampo.tcInt, TpcnResources.qVol, ObOp.Opcional);
                wCampo(Vol.esp, TpcnTipoCampo.tcStr, TpcnResources.esp, ObOp.Opcional);
                wCampo(Vol.marca, TpcnTipoCampo.tcStr, TpcnResources.marca, ObOp.Opcional);
                wCampo(Vol.nVol, TpcnTipoCampo.tcStr, TpcnResources.nVol, ObOp.Opcional);
                wCampo(Vol.pesoL, TpcnTipoCampo.tcDec3, TpcnResources.pesoL, ObOp.Opcional);
                wCampo(Vol.pesoB, TpcnTipoCampo.tcDec3, TpcnResources.pesoB, ObOp.Opcional);
                //(**)GerarTranspVolLacres(i);
                foreach (Lacres lacres in Vol.Lacres)
                {
                    XmlElement nodeVolLacres = doc.CreateElement("lacres");
                    nodeVol.AppendChild(nodeVolLacres);
                    nodeCurrent = nodeVolLacres;

                    wCampo(lacres.nLacre, TpcnTipoCampo.tcStr, TpcnResources.nLacre);
                }
            }
        }