Exemple #1
0
 public factura get_facturas_eventos(TipoComprobante_Info info)
 {
     try
     {
         return(odata.get_facturas_eventos(info));
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemple #2
0
 public guiaRemision get_info_guia(TipoComprobante_Info info)
 {
     try
     {
         return(odata.get_info_guia(info));
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemple #3
0
 public notaDebito get_info_nota_debito(TipoComprobante_Info info)
 {
     try
     {
         return(odata.get_info_nota_debito(info));
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemple #4
0
 public comprobanteRetencion get_info_retencion(TipoComprobante_Info info)
 {
     try
     {
         return(odata.get_info_retencion(info));
     }
     catch (Exception)
     {
         throw;
     }
 }
        public void Serv_GeneradorDocumentosElectronicos()
        {
            try
            {
                #region Variables
                TipoComprobante_Bus  bus_comprobante       = new TipoComprobante_Bus();
                TipoComprobante_Info info_tipo_comprobante = new TipoComprobante_Info();
                info_tipo_comprobante = bus_comprobante.get_info_comprobante_a_generar();
                StreamWriter myWriter;
                #endregion


                switch (info_tipo_comprobante.TipoDocumento)
                {
                case Info.Helps.cl_enumeradores.eTipoDocumento.FACT:
                    #region Generando facturas
                    var info_factura = bus_comprobante.get_info_factura(info_tipo_comprobante);
                    if (info_factura != null && info_factura.infoTributaria.secuencial != null)
                    {
                        string sIdCbteFact = info_factura.infoTributaria.razonSocial.Substring(0, 3) + "FAC" + info_factura.infoTributaria.estab + "-" + info_factura.infoTributaria.ptoEmi + "-" + info_factura.infoTributaria.secuencial;
                        XmlSerializerNamespaces NamespaceObject = new XmlSerializerNamespaces();
                        NamespaceObject.Add("", "");
                        XmlSerializer mySerializer = new XmlSerializer(typeof(factura));
                        myWriter = new StreamWriter(@"C:\Comprobantes EFIXED\Repositorio de Comprobantes" + sIdCbteFact + ".xml");
                        mySerializer.Serialize(myWriter, info_factura, NamespaceObject);
                        myWriter.Close();
                    }

                    #endregion

                    break;

                case Info.Helps.cl_enumeradores.eTipoDocumento.GUIA:

                    #region Generando guia remision
                    var info_guia = bus_comprobante.get_info_factura(info_tipo_comprobante);
                    if (info_guia != null && info_guia.infoTributaria.secuencial != null)
                    {
                        string sIdCbteFact = info_guia.infoTributaria.razonSocial.Substring(0, 3) + "GUI" + info_guia.infoTributaria.estab + "-" + info_guia.infoTributaria.ptoEmi + "-" + info_guia.infoTributaria.secuencial;
                        XmlSerializerNamespaces NamespaceObject = new XmlSerializerNamespaces();
                        NamespaceObject.Add("", "");
                        XmlSerializer mySerializer = new XmlSerializer(typeof(factura));
                        myWriter = new StreamWriter(@"C:\Comprobantes EFIXED\Repositorio de Comprobantes" + sIdCbteFact + ".xml");
                        mySerializer.Serialize(myWriter, info_guia, NamespaceObject);
                        myWriter.Close();
                    }

                    #endregion
                    break;

                case Info.Helps.cl_enumeradores.eTipoDocumento.NTCR:

                    #region Generando nota credito
                    var info_nc = bus_comprobante.get_info_factura(info_tipo_comprobante);
                    if (info_nc != null && info_nc.infoTributaria.secuencial != null)
                    {
                        string sIdCbteFact = info_nc.infoTributaria.razonSocial.Substring(0, 3) + "NTC" + info_nc.infoTributaria.estab + "-" + info_nc.infoTributaria.ptoEmi + "-" + info_nc.infoTributaria.secuencial;
                        XmlSerializerNamespaces NamespaceObject = new XmlSerializerNamespaces();
                        NamespaceObject.Add("", "");
                        XmlSerializer mySerializer = new XmlSerializer(typeof(factura));
                        myWriter = new StreamWriter(@"C:\Comprobantes EFIXED\Repositorio de Comprobantes" + sIdCbteFact + ".xml");
                        mySerializer.Serialize(myWriter, info_nc, NamespaceObject);
                        myWriter.Close();
                    }

                    #endregion
                    break;

                case Info.Helps.cl_enumeradores.eTipoDocumento.NTDB:


                    #region Generando nota debito
                    var info_nd = bus_comprobante.get_info_factura(info_tipo_comprobante);
                    if (info_nd != null && info_nd.infoTributaria.secuencial != null)
                    {
                        string sIdCbteFact = info_nd.infoTributaria.razonSocial.Substring(0, 3) + "NTD" + info_nd.infoTributaria.estab + "-" + info_nd.infoTributaria.ptoEmi + "-" + info_nd.infoTributaria.secuencial;
                        XmlSerializerNamespaces NamespaceObject = new XmlSerializerNamespaces();
                        NamespaceObject.Add("", "");
                        XmlSerializer mySerializer = new XmlSerializer(typeof(factura));
                        myWriter = new StreamWriter(@"C:\Comprobantes EFIXED\Repositorio de Comprobantes" + sIdCbteFact + ".xml");
                        mySerializer.Serialize(myWriter, info_nd, NamespaceObject);
                        myWriter.Close();
                    }

                    #endregion
                    break;

                case Info.Helps.cl_enumeradores.eTipoDocumento.RETEN:

                    #region Generando retencion
                    var info_retencion = bus_comprobante.get_info_factura(info_tipo_comprobante);
                    if (info_retencion != null && info_retencion.infoTributaria.secuencial != null)
                    {
                        string sIdCbteFact = info_retencion.infoTributaria.razonSocial.Substring(0, 3) + "RET" + info_retencion.infoTributaria.estab + "-" + info_retencion.infoTributaria.ptoEmi + "-" + info_retencion.infoTributaria.secuencial;
                        XmlSerializerNamespaces NamespaceObject = new XmlSerializerNamespaces();
                        NamespaceObject.Add("", "");
                        XmlSerializer mySerializer = new XmlSerializer(typeof(factura));
                        myWriter = new StreamWriter(@"C:\Comprobantes EFIXED\Repositorio de Comprobantes" + sIdCbteFact + ".xml");
                        mySerializer.Serialize(myWriter, info_retencion, NamespaceObject);
                        myWriter.Close();
                    }

                    #endregion
                    break;

                default:
                    break;
                }
            }
            catch (Exception)
            {
                throw;
            }
        }