public string CrearXML(EnumeradoresFEL.enmTipoDocumento tipoDoc) { var encDoc = ResolverEncabezado(tipoDoc); encDoc.Clave = Encabezado.Clave; encDoc.NumeroConsecutivo = Encabezado.NumeroConsecutivo; encDoc.FechaEmision = Encabezado.FechaEmision; encDoc.Emisor = Encabezado.Emisor; encDoc.Receptor = Validador.esReceptorValido(Encabezado.Receptor) ? Encabezado.Receptor : null; encDoc.CondicionVenta = ModFunciones.ObtenerValorEnumerador(Encabezado.CondicionVenta, Enumeradores.CondicionVenta.Item99); encDoc.PlazoCredito = Encabezado.PlazoCredito; encDoc.MedioPago = AsignarMediosPago(); encDoc.DetalleServicio = Detalles.ToArray(); encDoc.ResumenFactura = Resumen; encDoc.InformacionReferencia = CrearArregloReferencias(); encDoc.Normativa = new Normativa { NumeroResolucion = Encabezado.NormativaNombre, FechaResolucion = Encabezado.NormativaFecha }; encDoc.Otros = CrearSeccionOtros(); return(encDoc.GenerarXML()); throw new NotImplementedException(); }
private string GenerarConsecutivo(int sucursal, int terminal, long consecutivo, EnumeradoresFEL.enmTipoDocumento tipoDocumento) { return(string.Format("{0}{1}{2}{3}", sucursal.ToString().PadLeft(3, '0'), terminal.ToString().PadRight(5, '0'), ((int)tipoDocumento).ToString().PadLeft(2, '0'), consecutivo.ToString().PadLeft(10, '0'))); }
private IEncabezado ResolverEncabezado(EnumeradoresFEL.enmTipoDocumento tipoDoc) { switch (tipoDoc) { case EnumeradoresFEL.enmTipoDocumento.Factura: return(new Encabezados.FacturaElectronica()); case EnumeradoresFEL.enmTipoDocumento.NotaCredito: return(new NotaCreditoElectronica()); case EnumeradoresFEL.enmTipoDocumento.NotaDebito: return(new NotaDebitoElectronica()); case EnumeradoresFEL.enmTipoDocumento.Tiquete: return(new TiqueteElectronico()); default: throw new NotSupportedException("Tipo de documento no soportado"); } }