public bool ObtieneUltimoNroCbte(int puntoVta, int tipoCbe, long CUITExpress, string NombreCertificadoExpress, string Ambiente) { try { WSFENegocio.FEService ws; ws = System.Web.HttpContext.Current.Session["WSFE_Dominio"] as WSFENegocio.FEService; if (ws == null) { // create the proxy //MyService = new localhost.MyDemo(); ws = new WSFENegocio.FEService(); // create a container for the SessionID cookie ws.CookieContainer = new CookieContainer(); //ws.Inicializar(CUITExpress, NombreCertificadoExpress, Ambiente); // ws.Inicializar(long.Parse(CUITCargas), NombreCertificadoCargas, Ambiente); // store it in Session for next usage System.Web.HttpContext.Current.Session["WSFE_Dominio"] = ws; } if (Ambiente == "TEST") { //testing ws.Url = "http://10.0.0.6:8095/FEService.asmx"; ws.Inicializar(CUITExpress, NombreCertificadoExpress, Ambiente); } else { //produccion ws.Url = "http://10.0.0.6:8098/FEService.asmx"; ws.Inicializar(CUITExpress, NombreCertificadoExpress, Ambiente); } NumeroFactura = ws.ObtieneUltimoNroCbte(puntoVta, tipoCbe, CUITExpress) + 1; if (NumeroFactura > 0) { errorCAE = ""; return(true); } else { errorCAE = "Error al obtener ultimo número utilizado."; return(false); } } catch (Exception ex) { NumeroFactura = 0; return(false); } }
public bool ObtenerCAE(int puntoVta, int tipoCbe, long CUITExpress, string NombreCertificadoExpress, string Ambiente, int tipoConcepto, int tipoDocumento, long numeroDocumento, long nroFactura, string fechaFE, double total, double totalConcepto, double neto, double exento, double totalTributos, double totalIva, int tipoIva) { try { NumeroCAE = string.Empty; string error = string.Empty; DateTime sVencimientoCae = new DateTime(); WSFENegocio.FEService ws; WSFENegocio.Detalles detalle = new Detalles(); ws = System.Web.HttpContext.Current.Session["WSFE_Dominio"] as WSFENegocio.FEService; if (ws == null) { // create the proxy //MyService = new localhost.MyDemo(); ws = new WSFENegocio.FEService(); // create a container for the SessionID cookie ws.CookieContainer = new CookieContainer(); if (Ambiente == "TEST") { //testing ws.Url = "http://10.0.0.6:8095/FEService.asmx"; ws.Inicializar(CUITExpress, NombreCertificadoExpress, Ambiente); } else { //produccion ws.Url = "http://10.0.0.6:8098/FEService.asmx"; ws.Inicializar(CUITExpress, NombreCertificadoExpress, Ambiente); } // ws.Inicializar(long.Parse(CUITCargas), NombreCertificadoCargas, Ambiente); // store it in Session for next usage System.Web.HttpContext.Current.Session["WSFE_Dominio"] = ws; } detalle.Ivas.AddIvasRow(tipoIva, neto, totalIva); NumeroCAE = ws.ObtenerCAE(1, 1, puntoVta, tipoCbe, tipoConcepto, tipoDocumento, numeroDocumento, nroFactura, nroFactura, fechaFE, total, totalConcepto, neto, exento, totalTributos, totalIva, fechaFE, fechaFE, fechaFE, "PES", 1, detalle, ref error, ref sVencimientoCae, CUITExpress); errorCAE = error; fechaCAE = sVencimientoCae; if (NumeroCAE != string.Empty) { return(true); } else { return(false); } } catch (Exception ex) { NumeroCAE = string.Empty; return(false); } }