diff --git a/App_Code/ClsNominas.vb b/App_Code/ClsNominas.vb
index 3bc8643af..500315bf5 100644
--- a/App_Code/ClsNominas.vb
+++ b/App_Code/ClsNominas.vb
@@ -3633,6 +3633,24 @@ Public Class ClsNominas
Return retorno
End Function
+
+
+ Public Function GetRepPersonalDIM(Ejercicio As Integer, CveEmpresa As Integer) As Boolean
+ Dim retorno As Boolean = False
+ DataAdapter("PA_Nom_PersonalDIM", CommandType.StoredProcedure)
+ With SqlAdapter.SelectCommand.Parameters
+ .Add("@Ejercicio", SqlDbType.Int).Value = Ejercicio
+ .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
+ End With
+ Try
+ SqlAdapter.Fill(Data)
+ retorno = True
+ Catch ex As Exception
+ OnError("Ocurrió un error al obtener el reporte Personal DIM.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
+ End Try
+ Return retorno
+ End Function
+
#Region "IDisposable Support"
' IDisposable
Protected Overridable Sub Dispose(ByVal disposing As Boolean)
@@ -3656,6 +3674,8 @@ Public Class ClsNominas
Dispose(True)
GC.SuppressFinalize(Me)
End Sub
+
+
#End Region
End Class
diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb
index 4757d6158..1da462c12 100644
--- a/App_Code/ClsPaginas.vb
+++ b/App_Code/ClsPaginas.vb
@@ -8911,6 +8911,7 @@ Public Class ClsPaginas
PaginaDict.Add("/Nomina/CatSatTipoIncapacidad.aspx".ToUpper(), 258)
PaginaDict.Add("/Nomina/CatSatRiesgoPuesto.aspx".ToUpper(), 259)
PaginaDict.Add("/Nomina/ReportePTU.aspx".ToUpper(), 870)
+ PaginaDict.Add("/Nomina/RepPersonalDIM.aspx".ToUpper(), 1340)
#End Region
#Region "Ordenes de Servicios"
PaginaDict.Add("/OS/PopUpBuscarOS.aspx".ToUpper(), 80)
diff --git a/Compras/eFacturas.aspx.vb b/Compras/eFacturas.aspx.vb
index 5464021b3..ce502c1e2 100644
--- a/Compras/eFacturas.aspx.vb
+++ b/Compras/eFacturas.aspx.vb
@@ -2790,6 +2790,8 @@ Partial Class Compras_eFacturas
Protected Sub LnkverificarSolicitudes_Click(ByVal sender As Object, ByVal e As EventArgs)
Try
Dim sbResultado As StringBuilder = New StringBuilder()
+ Dim TipoMensaje = ModExtensiones.TipoMensaje.MsgInformacion
+
For Each GvRow As GridViewRow In GVSolicitudesPendientes.Rows
Dim CveSolicitudActual As Integer = GvRow.DataKey("CveSolicitud").ToEntero()
@@ -2800,17 +2802,33 @@ Partial Class Compras_eFacturas
Dim resultVerificacion As List(Of String) = New List(Of String)()
Dim ResultadoVerificaionOK = False
Dim SeVerifico = False
- Dim TipoMensaje = ModExtensiones.TipoMensaje.MsgInformacion
+
Dim ResultadoSolicitudOK = False
Dim api = New GeneralesAPIeFacturas()
+ Dim Verificar As Boolean = True
+
If idSolicitud.Length = 0 Then
Dim ObjApiSolicitud As JToken = CType(api.GeneraSolicitud(UsuarioActual.CveEmpresa, CveTipoSolicitud, CveSolicitudActual), JToken)
If Not (ObjApiSolicitud Is Nothing) Then
resultSolicitud = ObjApiSolicitud.[Select](Function(token) token.Values().Aggregate(Function(i, j) $"{i}|{j}").Value(Of String)()).ToList()
ResultadoSolicitudOK = Boolean.Parse(resultSolicitud(0))
- sbResultado.Append($"Solicitud {Folio} solicitada a SAT.
")
+
+ Try
+ sbResultado.Append($"Solicitud {Folio} { resultSolicitud(1)}.
")
+
+ If resultSolicitud(1).Contains("No se Generaron solicitudes al SAT") Then
+ Verificar = False
+ Else
+ Verificar = True
+ End If
+ Catch ex As Exception
+ sbResultado.Append($"Solicitud {Folio} solicitada a SAT.
")
+ Verificar = False
+ End Try
+
+
Else
TipoMensaje = ModExtensiones.TipoMensaje.MsgAdvertencia
End If
@@ -2821,13 +2839,24 @@ Partial Class Compras_eFacturas
resultSolicitud.Add("")
resultSolicitud.Add("")
ResultadoSolicitudOK = True
+ Verificar = True
End If
- If ResultadoSolicitudOK Then
+ If ResultadoSolicitudOK And Verificar Then
Dim ObjApiVerificacion As JToken = CType(api.VerificaSolicitudesNominas(UsuarioActual.CveEmpresa, CveTipoSolicitud, CveSolicitudActual), JToken)
If Not (ObjApiVerificacion Is Nothing) Then
resultVerificacion = ObjApiVerificacion.[Select](Function(token) token.Values().Aggregate(Function(i, j) $"{i}|{j}").Value(Of String)()).ToList()
+
+ 'If UsuarioActual.CveRol = 1 Then
+ ' Dim respesta = New StringBuilder
+ ' For Each s As String In resultVerificacion
+ ' respesta.AppendLine($"{s} - ")
+ ' Next
+
+ ' Alert(respesta.ToString)
+ 'End If
+
ResultadoVerificaionOK = Boolean.Parse(resultVerificacion(0))
SeVerifico = True
Else
@@ -2835,7 +2864,7 @@ Partial Class Compras_eFacturas
End If
Else
- If resultSolicitud.Count = 4 Then
+ If resultSolicitud.Count >= 4 Then
sbResultado.Append($"({resultSolicitud(1)})
Folio:{Folio}
")
Else
sbResultado.Append($"Solicitud pendiente de verificar en SAT
Folio:{Folio}
")
@@ -2844,22 +2873,30 @@ Partial Class Compras_eFacturas
TipoMensaje = ModExtensiones.TipoMensaje.MsgAdvertencia
End If
- If SeVerifico AndAlso resultVerificacion.Count = 4 Then
- If ResultadoVerificaionOK Then
- sbResultado.Append($"Solicitud procesada.
Folio: {Folio}
{resultVerificacion(1)}")
+ 'If UsuarioActual.CveRol = 1 Then
+ ' Alert($"SeVerifico {SeVerifico.ToString} resultVerificacion.Count {resultVerificacion.Count }")
+ 'End If
+ If Verificar Then
+ If SeVerifico AndAlso resultVerificacion.Count >= 4 Then
+
+ If ResultadoVerificaionOK Then
+ sbResultado.Append($"Solicitud procesadaFolio: {Folio}
{resultVerificacion(1)}")
+ Else
+ sbResultado.Append($"Solicitud no verificada
Folio: {Folio}{resultVerificacion(1)}.
")
+ TipoMensaje = ModExtensiones.TipoMensaje.MsgAdvertencia
+ End If
Else
- sbResultado.Append($"Solicitud no verificada
Folio: {Folio}{resultVerificacion(1)}.
")
+ sbResultado.Append($"Se presento un error al verificar la solicitud Folio: {Folio}.
")
TipoMensaje = ModExtensiones.TipoMensaje.MsgAdvertencia
End If
- Else
- sbResultado.Append($"Se presento un error al verificar la solicitud
Folio: {Folio}.")
- TipoMensaje = ModExtensiones.TipoMensaje.MsgAdvertencia
End If
- Alert(sbResultado.ToString(), TipoMensaje)
+
+
Next
+ Alert(sbResultado.ToString(), TipoMensaje)
cargasolicitudes()
Catch ex As Exception
Alert(ex.StackTrace)
diff --git a/Nomina/RepPersonalDIM.aspx b/Nomina/RepPersonalDIM.aspx
new file mode 100644
index 000000000..169f12671
--- /dev/null
+++ b/Nomina/RepPersonalDIM.aspx
@@ -0,0 +1,97 @@
+<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="RepPersonalDIM.aspx.vb" Inherits="Nomina_RepPersonalDIM" EnableEventValidation="false" %>
+
+
+
+
+
+
+
+
+
+ Reporte Personal DIM
+
+
+
+
+
+ Generar Excel
+
+
+ Descarga Archivo
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Nomina/RepPersonalDIM.aspx.vb b/Nomina/RepPersonalDIM.aspx.vb
new file mode 100644
index 000000000..df4b99ab2
--- /dev/null
+++ b/Nomina/RepPersonalDIM.aspx.vb
@@ -0,0 +1,149 @@
+Option Explicit On
+Option Strict On
+
+Imports System.Data
+Imports System.Drawing
+Imports System.IO
+Imports Extensiones
+Imports GemBox.Spreadsheet
+Imports Microsoft.Reporting.WebForms
+
+Partial Class Nomina_RepPersonalDIM
+ Inherits ClsPaginas
+
+ Public Property Dt_Datos As DataTable
+ Get
+ If ViewState("Dt_Datos") Is Nothing Then
+ ViewState("Dt_Datos") = New DataTable
+ End If
+ Return DirectCast(ViewState("Dt_Datos"), DataTable)
+ End Get
+ Set(value As DataTable)
+ ViewState("Dt_Datos") = value
+ End Set
+
+ End Property
+
+ Protected Sub Nomina_RepPersonalDIM(sender As Object, e As EventArgs) Handles Me.Load
+ If Not Page.IsPostBack Then
+
+ CargaEjercicios()
+ DdlEjercicio.SelectedValueExist(UsuarioActual.Empresa.EjercicioActual)
+
+ End If
+ End Sub
+
+
+ Private Sub CargaEjercicios()
+ 'Dim ClsConta As New ClsContPAQi(UsuarioActual.Empresa)
+ Dim ClsConta As New ClsContabilidad
+ If ClsConta.GetEjercicios(UsuarioActual.CveEmpresa) Then
+ DdlEjercicio.DataSource = ClsConta.DtResultados
+ Else
+ DdlEjercicio.DataSource = Nothing
+ End If
+ ClsConta.Dispose()
+ DdlEjercicio.DataBind()
+
+ DdlEjercicio.SelectedValueExist(UsuarioActual.Empresa.EjercicioActual.ToString)
+
+ If DdlEjercicio.Items.Count = 0 Then
+ DdlEjercicio.Items.Add(New ListItem(Now.Year.ToString, Now.Year.ToString))
+ End If
+
+ End Sub
+
+ Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs)
+ CargaDatos()
+ End Sub
+
+
+ Private Sub CargaDatos()
+
+ Dt_Datos = New DataTable
+ LnkDescargaArchivo.Visible = False
+ LnkExportar.Visible = False
+
+ Dim ObjNom As New ClsNominas
+
+
+ If ObjNom.GetRepPersonalDIM(Ejercicio:=DdlEjercicio.SelectedValue.ToEntero, CveEmpresa:=UsuarioActual.CveEmpresa) Then
+ GvDatos.DataSource = ObjNom.DtResultados
+ Dt_Datos = ObjNom.DtResultados
+
+ If Dt_Datos.Rows.Count > 0 Then
+ LnkDescargaArchivo.Visible = True
+ LnkExportar.Visible = True
+ End If
+
+
+ Else
+ GvDatos.DataSource = Nothing
+ End If
+
+ ObjNom.Dispose()
+
+ GvDatos.DataBind()
+
+
+
+ End Sub
+
+
+#Region "DESCARGA EXCEL"
+
+ Private Sub LnkExportar_Click(sender As Object, e As EventArgs) Handles LnkExportar.Click
+ Imprimir("Excel")
+ End Sub
+
+ Private Sub Imprimir(Optional reporte As String = "PDF")
+ GvDatos.ExportToExcelGembox("RepPersonalDIM", UsuarioActual, "Reporte Personal ", "", DatosFiltros:=$"Ejercicio {DdlEjercicio.SelectedItem.Text}")
+
+ End Sub
+
+ Public Overrides Sub VerifyRenderingInServerForm(ByVal control As Control)
+ End Sub
+
+ Protected Sub LnkDescargaArchivo_Click(ByVal sender As Object, ByVal e As EventArgs) Handles LnkDescargaArchivo.Click
+ Dim tabla As DataTable = Dt_Datos ' Reemplaza esto con tu método para obtener la tabla
+
+ Dim contenido As String = ConvertirTablaATexto(tabla)
+
+ ' Guardar el archivo en el servidor
+ Dim nombreArchivo As String = "tabla.txt"
+ Dim rutaArchivo As String = Server.MapPath("~/Descargas/" & nombreArchivo)
+ File.WriteAllText(rutaArchivo, contenido)
+
+ ' Descargar el archivo
+ Response.ContentType = "text/plain"
+ Response.AppendHeader("Content-Disposition", "attachment; filename=" & nombreArchivo)
+ Response.TransmitFile(rutaArchivo)
+ Response.End()
+ End Sub
+
+ Public Function ConvertirTablaATexto(ByVal tabla As DataTable) As String
+ Dim sb As New StringBuilder()
+
+ For Each fila As DataRow In tabla.Rows
+ For i As Integer = 0 To tabla.Columns.Count - 1
+ sb.Append(fila(i).ToString())
+
+ If i < tabla.Columns.Count - 1 Then
+ sb.Append("|") ' Agrega el separador de pipes
+ End If
+ Next
+
+ sb.AppendLine() ' Agrega un salto de línea al final de cada fila
+ Next
+
+ Return sb.ToString()
+ End Function
+
+#End Region
+
+
+
+
+
+End Class
+