Example #1
0
 public static void ConsultarNovedades(out List<eFact_Entidades.Lote> Lotes, CedEntidades.Sesion Sesion)
 {
     List<eFact_Entidades.Lote> lotes = new List<eFact_Entidades.Lote>();
     eFact_DB.Lote l = new eFact_DB.Lote(Sesion);
     l.ConsultarNovedades(out lotes);
     Lotes = lotes;
 }
Example #2
0
 public static void ConsultarXEstado(out List<eFact_Entidades.Lote> Lotes, string ListaEstados, CedEntidades.Sesion Sesion)
 {
     List<eFact_Entidades.Lote> lotes = new List<eFact_Entidades.Lote>();
     eFact_DB.Lote l = new eFact_DB.Lote(Sesion);
     l.ConsultarXEstado(out lotes, ListaEstados);
     Lotes = lotes;
 }
Example #3
0
 public static void Consultar(out List<eFact_Entidades.Lote> Lotes, eFact_Entidades.Lote.TipoConsulta TipoConsulta, DateTime FechaDsd, DateTime FechaHst, string CuitVendedor, string NumeroLote, string PuntoVenta, bool VerPendientes, CedEntidades.Sesion Sesion)
 {
     List<eFact_Entidades.Lote> lotes = new List<eFact_Entidades.Lote>();
     eFact_DB.Lote l = new eFact_DB.Lote(Sesion);
     l.Consultar(out lotes, TipoConsulta, FechaDsd, FechaHst, CuitVendedor, NumeroLote, PuntoVenta, VerPendientes);
     Lotes = lotes;
 }
Example #4
0
 public static void VerificarEnviosPosteriores(bool LoteNuevo, string CuitVendedor, string NumeroLote, string PuntoVenta, int NumeroEnvio, CedEntidades.Sesion Sesion)
 {
     List<eFact_Entidades.Lote> lotes = new List<eFact_Entidades.Lote>();
     eFact_DB.Lote l = new eFact_DB.Lote(Sesion);
     l.Consultar(out lotes, eFact_Entidades.Lote.TipoConsulta.SinAplicarFechas, DateTime.Today, DateTime.Today, CuitVendedor, NumeroLote, PuntoVenta, false);
     if (lotes.Count != 0)
     {
         //Verificar si hay envios posteriores del lote. 
         if (lotes[0].NumeroEnvio > NumeroEnvio)
         {
             throw new Microsoft.ApplicationBlocks.ExceptionManagement.Validaciones.Lote.HayEnviosPosteriores("");
         }
         //Verifico el estado de la ultimo lote enviado.
         if (LoteNuevo && (lotes[0].WF.IdEstado != "RechazadoIF" && lotes[0].WF.IdEstado != "Cancelado"))
         {
             throw new Microsoft.ApplicationBlocks.ExceptionManagement.Validaciones.Lote.Existente("Ya existe el lote " + NumeroLote + " en el estado: " + lotes[0].WF.DescrEstado);
         }
     }
 }
Example #5
0
 public static void ObtenerNumeroEnvioDisponible(out int NumeroEnvioDisponible, string CuitVendedor, string NumeroLote, string PuntoVenta, CedEntidades.Sesion Sesion)
 {
     List<eFact_Entidades.Lote> lotes = new List<eFact_Entidades.Lote>();
     eFact_DB.Lote l = new eFact_DB.Lote(Sesion);
     l.Consultar(out lotes, eFact_Entidades.Lote.TipoConsulta.SinAplicarFechas, DateTime.Today, DateTime.Today, CuitVendedor, NumeroLote, PuntoVenta, false);
     if (lotes.Count != 0)
     {
         //Verificar que el ultimo envio del lote este un estado final ( cancelado o rechzado por interfactureas ) para generar un nuevo numero de envio.
         if (lotes[0].WF.IdEstado == "RechazadoIF" || lotes[0].WF.IdEstado == "Cancelado")
         {
             NumeroEnvioDisponible = lotes.Count + 1;
         }
         else
         {
             throw new Microsoft.ApplicationBlocks.ExceptionManagement.Validaciones.Lote.ImposibleAsignarNuevoNroEnvio("Ya existe el lote " + NumeroLote + " en el estado: " + lotes[0].WF.DescrEstado);
         }
     }
     else
     {
         //Si el lote NO existe, es el primer envio.
         NumeroEnvioDisponible = 1;
     }
 }
Example #6
0
 public static List<eFact_Entidades.Lote> ConsultarLotesDeComprobantesDVigentesXFecha(string FechaDsd, string FechaHst, string CuitEmpresa, CedEntidades.Sesion Sesion)
 {
     eFact_DB.Lote c = new eFact_DB.Lote(Sesion);
     return c.ConsutarLotesDeComprobantesDVigentesXFecha(FechaDsd, FechaHst, CuitEmpresa);
 }
Example #7
0
 public static void GuardarNovedades(eFact_Entidades.Novedades novedad, CedEntidades.Sesion Sesion)
 {
     eFact_DB.Lote lote = new eFact_DB.Lote(Sesion);
     lote.GuardarNovedades(novedad);
 }
Example #8
0
 public static void Leer(eFact_Entidades.Lote Lote, CedEntidades.Sesion Sesion)
 {
     eFact_DB.Lote l = new eFact_DB.Lote(Sesion);
     l.Leer(Lote);
 }
Example #9
0
 public static void Ejecutar(eFact_Entidades.Lote Lote, CedEntidades.Evento Evento, string Handler, eFact_Entidades.Aplicacion Aplicacion, CedEntidades.Sesion Sesion)
 {
     string handlerEvento = "";
     //VerificarAssemblyVersion();
     eFact_DB.Lote lote = new eFact_DB.Lote(Sesion);
     string nombreArchivoProcesado = "";
     switch (Lote.WF.IdFlow)
     {
         case "eFact":
             switch (Evento.Id)
             {
                 case "EnvBandSalida":
                     if (Lote.NumeroEnvio > 1)
                     { 
                         eFact_Entidades.Lote l = new eFact_Entidades.Lote();
                         l.CuitVendedor = Lote.CuitVendedor;
                         l.PuntoVenta = Lote.PuntoVenta;
                         l.NumeroLote = Lote.NumeroLote;
                         l.NumeroEnvio = Lote.NumeroEnvio - 1;
                         eFact_RN.Lote.Leer(l, Sesion);
                         //Busca el evento automático, para anular el envio anterior.
                         CedEntidades.Evento evento = l.WF.EventosPosibles.Find((delegate(CedEntidades.Evento e1) { return e1.Automatico == true && (e1.Id == "AnularRechIF" || e1.Id == "AnularCancel"); }));
                         handlerEvento = Cedeira.SV.WF.EjecutarEvento(l.WF, evento, true);
                         handlerEvento += " end ";
                     }
                     handlerEvento += Cedeira.SV.WF.EjecutarEvento(Lote.WF, Evento, true);
                     lote.Insertar(Lote, handlerEvento, Handler);
                     break;
                 case "EnvBandSalidaV":
                     handlerEvento += Cedeira.SV.WF.EjecutarEvento(Lote.WF, Evento, true);
                     lote.Insertar(Lote, handlerEvento, Handler);
                     break;
                 case "EnviarAIF":
                     handlerEvento += Cedeira.SV.WF.EjecutarEvento(Lote.WF, Evento, true);
                     lote.ActualizarFechaEnvio(Lote, handlerEvento);
                     break;
                 case "RegAceptAFIP":
                 case "RegActAFIP":
                     handlerEvento = Cedeira.SV.WF.EjecutarEvento(Lote.WF, Evento, true);
                     lote.ActualizarDatosCAE(Lote, handlerEvento);
                     if (Aplicacion.TipoItfAut == "XML")
                     {
                         GuardarItfXML(out nombreArchivoProcesado, Lote, "ROK", Aplicacion.ArchPathItfAut, true, false);
                     }
                     else if (Aplicacion.TipoItfAut == "TXT")
                     {
                         GuardarItfTXT(out nombreArchivoProcesado, Lote, "ROK", Aplicacion.ArchPathItfAut, true);
                     }
                     break;
                 case "RegAceptAFIPO":
                 case "RegActAFIPO":
                     handlerEvento = Cedeira.SV.WF.EjecutarEvento(Lote.WF, Evento, true);
                     lote.ActualizarDatosCAE(Lote, handlerEvento);
                     if (Aplicacion.TipoItfAut == "XML")
                     {
                         GuardarItfXML(out nombreArchivoProcesado, Lote, "ROO", Aplicacion.ArchPathItfAut, true, false);
                     }
                     else if (Aplicacion.TipoItfAut == "TXT")
                     {
                         GuardarItfTXT(out nombreArchivoProcesado, Lote, "ROO", Aplicacion.ArchPathItfAut, true);
                     }
                     break;
                 case "RegAceptAFIPP":
                 case "RegActAFIPP":
                     handlerEvento = Cedeira.SV.WF.EjecutarEvento(Lote.WF, Evento, true);
                     lote.ActualizarDatosCAE(Lote, handlerEvento);
                     if (Aplicacion.TipoItfAut == "XML")
                     {
                         GuardarItfXML(out nombreArchivoProcesado, Lote, "ROP", Aplicacion.ArchPathItfAut, true, false);
                     }
                     else if (Aplicacion.TipoItfAut == "TXT")
                     {
                         GuardarItfTXT(out nombreArchivoProcesado, Lote, "ROP", Aplicacion.ArchPathItfAut, true);
                     }
                     break;
                 case "RegContAFIP":
                 case "RegContAFIPO":
                 case "RegContAFIPP":
                     handlerEvento = Cedeira.SV.WF.EjecutarEvento(Lote.WF, Evento, true);
                     DataTable dt = lote.Insertar(Lote, handlerEvento, "");
                     Lote.IdLote = Convert.ToInt32(dt.Rows[0][0].ToString());
                     Leer(Lote, Sesion);
                     CedEntidades.Evento eventoAct = new CedEntidades.Evento();
                     eventoAct = Lote.WF.EventosPosibles[0];
                     handlerEvento = Cedeira.SV.WF.EjecutarEvento(Lote.WF, eventoAct, true);
                     lote.ActualizarDatosCAE(Lote, handlerEvento);
                     if (Aplicacion.TipoItfAut == "XML")
                     {
                         GuardarItfXML(out nombreArchivoProcesado, Lote, "ROK", Aplicacion.ArchPathItfAut, true, false);
                     }
                     else if (Aplicacion.TipoItfAut == "TXT")
                     {
                         GuardarItfTXT(out nombreArchivoProcesado, Lote, "ROK", Aplicacion.ArchPathItfAut, true);
                     }
                     break;
                 case "RegRechAFIP":
                     handlerEvento = Cedeira.SV.WF.EjecutarEvento(Lote.WF, Evento, true);
                     lote.ActualizarDatosError(Lote, handlerEvento);
                     if (Aplicacion.TipoItfAut == "XML")
                     {
                         GuardarItfXML(out nombreArchivoProcesado, Lote, "RAF", Aplicacion.ArchPathItfAut, true, false);
                     }
                     else if (Aplicacion.TipoItfAut == "TXT")
                     {
                         GuardarItfTXTlr(out nombreArchivoProcesado, Lote, "RAF", Aplicacion.ArchPathItfAut, true);
                     }
                     break;
                 case "RegRechIF":
                     handlerEvento = Cedeira.SV.WF.EjecutarEvento(Lote.WF, Evento, true);
                     lote.ActualizarDatosError(Lote, handlerEvento);
                     if (Aplicacion.TipoItfAut == "XML")
                     {
                         GuardarItfXML(out nombreArchivoProcesado, Lote, "RIF", Aplicacion.ArchPathItfAut, true, false);
                     }
                     else if (Aplicacion.TipoItfAut == "TXT")
                     {
                         GuardarItfTXTlr(out nombreArchivoProcesado, Lote, "RIF", Aplicacion.ArchPathItfAut, true);
                     }
                     break;
                 default:
                     Cedeira.SV.WF.EjecutarEvento(Lote.WF, Evento, false);
                     break;
             }
             break;
     }
 }