Ejemplo n.º 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;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// GerarCobr
        /// </summary>
        /// <param name="Cobr"></param>
        /// <param name="root"></param>
        private void GerarCobr(Cobr Cobr, XmlElement root)
        {
            if (!string.IsNullOrEmpty(Cobr.Fat.nFat) ||
                (Cobr.Fat.vOrig > 0) ||
                (Cobr.Fat.vDesc > 0) ||
                (Cobr.Fat.vLiq > 0) ||
                (Cobr.Dup.Count > 0))
            {
                XmlElement nodeCobr = doc.CreateElement("cobr");
                nodeCurrent = nodeCobr;
                root.AppendChild(nodeCobr);
                //
                //(**)GerarCobrFat;
                //
                if (!string.IsNullOrEmpty(Cobr.Fat.nFat) ||
                    Cobr.Fat.vOrig > 0 ||
                    Cobr.Fat.vDesc > 0 ||
                    Cobr.Fat.vLiq > 0)
                {
                    XmlElement nodeFat = doc.CreateElement("fat");
                    nodeCobr.AppendChild(nodeFat);
                    nodeCurrent = nodeFat;

                    wCampo(Cobr.Fat.nFat, TpcnTipoCampo.tcStr, TpcnResources.nFat);
                    wCampo(Cobr.Fat.vOrig, TpcnTipoCampo.tcDec2, TpcnResources.vOrig, ObOp.Opcional);
                    wCampo(Cobr.Fat.vDesc, TpcnTipoCampo.tcDec2, TpcnResources.vDesc, ObOp.Opcional);
                    wCampo(Cobr.Fat.vLiq, TpcnTipoCampo.tcDec2, TpcnResources.vLiq, ObOp.Opcional);
                }
                //
                //(**)GerarCobrDup;
                //
                foreach (Dup Dup in Cobr.Dup)
                {
                    if (Dup.dVenc.Year > 1 || Dup.vDup > 0 || !string.IsNullOrEmpty(Dup.nDup))
                    {
                        XmlElement nodeDup = doc.CreateElement("dup");
                        nodeCobr.AppendChild(nodeDup);
                        nodeCurrent = nodeDup;

                        wCampo(Dup.nDup, TpcnTipoCampo.tcStr, TpcnResources.nDup, ObOp.Opcional);
                        wCampo(Dup.dVenc, TpcnTipoCampo.tcDatYYYY_MM_DD, TpcnResources.dVenc, ObOp.Opcional);
                        wCampo(Dup.vDup, TpcnTipoCampo.tcDec2, TpcnResources.vDup, ObOp.Obrigatorio);
                    }
                }
            }
        }