Cambio de formato de respuesta en facturacion masiva del pescadito
This commit is contained in:
@@ -11,40 +11,64 @@ Imports Extensiones
|
|||||||
Imports System.IO
|
Imports System.IO
|
||||||
Imports Modelos
|
Imports Modelos
|
||||||
|
|
||||||
Public Class SIGFacturacion : Implements IHttpHandler, IRequiresSessionState
|
Public Class SIGFacturacion : Implements IHttpHandler, IRequiresSessionState
|
||||||
|
|
||||||
|
Private Property CveEmpresaFacturar As Integer = 143
|
||||||
|
|
||||||
Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
|
Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
|
||||||
context.Response.ContentType = "application/json"
|
context.Response.ContentType = "text/plain"
|
||||||
Try
|
Dim Retorno As Boolean = False
|
||||||
If context.Request.InputStream IsNot Nothing Then
|
|
||||||
Using reader As New StreamReader(context.Request.InputStream)
|
|
||||||
Dim json = reader.ReadToEnd
|
|
||||||
|
|
||||||
If Not String.IsNullOrEmpty(json) Then
|
Try
|
||||||
Dim JsonRequest As JObject = JObject.Parse(json)
|
'If context.Request.InputStream IsNot Nothing Then
|
||||||
If JsonRequest IsNot Nothing Then
|
' Using reader As New StreamReader(context.Request.InputStream)
|
||||||
Dim Metodo = JsonRequest("Metodo").ToString()
|
' Dim json = reader.ReadToEnd
|
||||||
If Metodo = "FactMasivaRemisiones" Then
|
|
||||||
Dim pCveEmpresa = JsonRequest("CveEmpresa").ToString()
|
' If Not String.IsNullOrEmpty(json) Then
|
||||||
Dim pFechaI As String = ""
|
' Dim JsonRequest As JObject = JObject.Parse(json)
|
||||||
Dim pFechaF As String = ""
|
' If JsonRequest IsNot Nothing Then
|
||||||
|
' Dim Metodo = JsonRequest("Metodo").ToString()
|
||||||
If JsonRequest("FechaI") IsNot Nothing AndAlso JsonRequest("FechaF") IsNot Nothing Then
|
' If Metodo = "FactMasivaRemisiones" Then
|
||||||
pFechaI = JsonRequest("FechaI")
|
' Dim pCveEmpresa = JsonRequest("CveEmpresa").ToString()
|
||||||
pFechaF = JsonRequest("FechaF")
|
' Dim pFechaI As String = ""
|
||||||
End If
|
' Dim pFechaF As String = ""
|
||||||
|
|
||||||
IniciaFacturacionMasiva(context, pCveEmpresa, pFechaI, pFechaF)
|
' If JsonRequest("FechaI") IsNot Nothing AndAlso JsonRequest("FechaF") IsNot Nothing Then
|
||||||
End If
|
' pFechaI = JsonRequest("FechaI")
|
||||||
End If
|
' pFechaF = JsonRequest("FechaF")
|
||||||
End If
|
' End If
|
||||||
|
|
||||||
End Using
|
' IniciaFacturacionMasiva(context, CveEmpresaFacturar, pFechaI, pFechaF)
|
||||||
|
' End If
|
||||||
|
' End If
|
||||||
|
' End If
|
||||||
|
|
||||||
|
' End Using
|
||||||
|
'End If
|
||||||
|
|
||||||
|
Dim Metodo = If(context.Request("Metodo") = Nothing, "", context.Request("Metodo").ToString())
|
||||||
|
If Metodo = "FactMasivaRemisiones" Then
|
||||||
|
Dim pFechaI As String = ""
|
||||||
|
Dim pFechaF As String = ""
|
||||||
|
|
||||||
|
If context.Request("FechaI") IsNot Nothing AndAlso context.Request("FechaF") IsNot Nothing Then
|
||||||
|
pFechaI = context.Request("FechaI")
|
||||||
|
pFechaF = context.Request("FechaF")
|
||||||
|
End If
|
||||||
|
|
||||||
|
Retorno = IniciaFacturacionMasiva(CveEmpresaFacturar, pFechaI, pFechaF)
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
ex.GuardaLog(ex.Message)
|
ex.GuardaLog(ex.Message)
|
||||||
End Try
|
End Try
|
||||||
|
|
||||||
|
If Retorno Then
|
||||||
|
context.Response.Write("True")
|
||||||
|
Else
|
||||||
|
context.Response.Write("False")
|
||||||
|
End If
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Public ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable
|
Public ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable
|
||||||
@@ -53,7 +77,8 @@ Public Class SIGFacturacion : Implements IHttpHandler, IRequiresSessionState
|
|||||||
End Get
|
End Get
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
Private Sub IniciaFacturacionMasiva(ByVal context As HttpContext, pCveEmpresa As String, pFechaI As String, pFechaF As String)
|
Private Function IniciaFacturacionMasiva(pCveEmpresa As String, pFechaI As String, pFechaF As String) As Boolean
|
||||||
|
Dim Retorno As Boolean = True
|
||||||
Dim JsonRetorno As New JObject()
|
Dim JsonRetorno As New JObject()
|
||||||
Dim CveEmpresa As Integer = pCveEmpresa.ToEntero()
|
Dim CveEmpresa As Integer = pCveEmpresa.ToEntero()
|
||||||
If CveEmpresa > 0 Then
|
If CveEmpresa > 0 Then
|
||||||
@@ -71,7 +96,10 @@ Public Class SIGFacturacion : Implements IHttpHandler, IRequiresSessionState
|
|||||||
FechaI = New DateTime(DomingoAnterior.Year, DomingoAnterior.Month, DomingoAnterior.Day, 0, 0, 0)
|
FechaI = New DateTime(DomingoAnterior.Year, DomingoAnterior.Month, DomingoAnterior.Day, 0, 0, 0)
|
||||||
FechaF = New DateTime(Sabado.Year, Sabado.Month, Sabado.Day, 23, 59, 59)
|
FechaF = New DateTime(Sabado.Year, Sabado.Month, Sabado.Day, 23, 59, 59)
|
||||||
|
|
||||||
JsonRetorno = EjecutarFacturacionMasiva(Usuario, FechaI, FechaF, Usuario.Empresa.FacturaProduccion)
|
JsonRetorno = EjecutarFacturacionMasiva(Usuario, FechaI, FechaF, Usuario.Empresa.FacturaProduccion)
|
||||||
|
Else
|
||||||
|
Retorno = False
|
||||||
|
GuardaLogFacturacion("Ejecución no permitida, no es el dia permitido para ejecucion o no se espeficaron las fechas")
|
||||||
End If
|
End If
|
||||||
Else
|
Else
|
||||||
FechaI = pFechaI.ToDateTime()
|
FechaI = pFechaI.ToDateTime()
|
||||||
@@ -79,11 +107,13 @@ Public Class SIGFacturacion : Implements IHttpHandler, IRequiresSessionState
|
|||||||
|
|
||||||
JsonRetorno = EjecutarFacturacionMasiva(Usuario, FechaI, FechaF, Usuario.Empresa.FacturaProduccion)
|
JsonRetorno = EjecutarFacturacionMasiva(Usuario, FechaI, FechaF, Usuario.Empresa.FacturaProduccion)
|
||||||
End If
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
End If
|
GuardaLogFacturacion("Ejecución Exitosa, se generaron las siguientes facturas:")
|
||||||
context.Response.Write(JsonRetorno)
|
GuardaLogFacturacion(JsonRetorno.ToString())
|
||||||
End Sub
|
|
||||||
|
Return Retorno
|
||||||
|
End Function
|
||||||
|
|
||||||
|
|
||||||
Public Shared Function GetNextWeekday(ByVal start As DateTime, ByVal day As DayOfWeek, hora As TimeSpan) As DateTime
|
Public Shared Function GetNextWeekday(ByVal start As DateTime, ByVal day As DayOfWeek, hora As TimeSpan) As DateTime
|
||||||
|
|||||||
Reference in New Issue
Block a user