Esempio 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;
        }
Esempio n. 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;
        }
Esempio n. 3
0
        /// <summary>
        /// GerarCana
        /// </summary>
        /// <param name="cana"></param>
        /// <param name="root"></param>
        private void GerarCana(Cana cana, XmlElement root)
        {
            if (!string.IsNullOrEmpty(cana.safra) || !string.IsNullOrEmpty(cana.Ref) ||
                (cana.fordia.Count > 0) || (cana.deduc.Count > 0))
            {
                XmlElement rootCana = doc.CreateElement("cana");
                root.AppendChild(rootCana);
                nodeCurrent = rootCana;

                wCampo(cana.safra, TpcnTipoCampo.tcStr, TpcnResources.safra, ObOp.Opcional);
                wCampo(cana.Ref, TpcnTipoCampo.tcStr, TpcnResources.Ref, ObOp.Opcional);

                if (cana.fordia.Count > 31)
                    this.cMensagemErro += "Número máximo de elementos no segmento 'ZC04' excedeu" + Environment.NewLine;

                foreach (fordia item in cana.fordia)
                {
                    XmlElement nodefordia = doc.CreateElement("forDia");
                    XmlAttribute xmlItem = doc.CreateAttribute(TpcnResources.dia.ToString());   //
                    xmlItem.Value = item.dia.ToString();                                        //danasa 3/11/2011
                    nodefordia.Attributes.Append(xmlItem);                                      //
                    rootCana.AppendChild(nodefordia);
                    nodeCurrent = nodefordia;

                    //wCampo(item.dia, TpcnTipoCampo.tcInt, TpcnResources.dia);
                    wCampo(item.qtde, item.qtde_Tipo, TpcnResources.qtde);
                }
                nodeCurrent = rootCana;
                wCampo(cana.qTotMes, cana.qTotMes_Tipo, TpcnResources.qTotMes);
                wCampo(cana.qTotAnt, cana.qTotAnt_Tipo, TpcnResources.qTotAnt);
                wCampo(cana.qTotGer, cana.qTotGer_Tipo, TpcnResources.qTotGer);

                if (cana.deduc.Count > 10)
                    this.cMensagemErro += "Número máximo de elementos no segmento 'ZC10' excedeu" + Environment.NewLine;

                foreach (deduc item in cana.deduc)
                {
                    XmlElement nodededuc = doc.CreateElement("deduc");
                    rootCana.AppendChild(nodededuc);
                    nodeCurrent = nodededuc;

                    wCampo(item.xDed, TpcnTipoCampo.tcStr, TpcnResources.xDed);
                    wCampo(item.vDed, TpcnTipoCampo.tcDec2, TpcnResources.vDed);
                }
                nodeCurrent = rootCana;
                wCampo(cana.vFor, TpcnTipoCampo.tcDec2, TpcnResources.vFor);
                wCampo(cana.vTotDed, TpcnTipoCampo.tcDec2, TpcnResources.vTotDed);
                wCampo(cana.vLiqFor, TpcnTipoCampo.tcDec2, TpcnResources.vLiqFor);
            }
        }