Rep personal DIM
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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.<br>")
|
||||
|
||||
Try
|
||||
sbResultado.Append($"Solicitud {Folio} { resultSolicitud(1)}.<br>")
|
||||
|
||||
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.<br>")
|
||||
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)})<br> Folio:{Folio} <br> ")
|
||||
Else
|
||||
sbResultado.Append($"Solicitud pendiente de verificar en SAT <br> Folio:{Folio} <br>")
|
||||
@@ -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.<br> Folio: {Folio} <br> {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} <br> {resultVerificacion(1)}")
|
||||
Else
|
||||
sbResultado.Append($"Solicitud no verificada <br> Folio: {Folio}{resultVerificacion(1)}.<br>")
|
||||
TipoMensaje = ModExtensiones.TipoMensaje.MsgAdvertencia
|
||||
End If
|
||||
Else
|
||||
sbResultado.Append($"Solicitud no verificada <br> Folio: {Folio}{resultVerificacion(1)}.<br>")
|
||||
sbResultado.Append($"Se presento un error al verificar la solicitud Folio: {Folio}. <br>")
|
||||
TipoMensaje = ModExtensiones.TipoMensaje.MsgAdvertencia
|
||||
End If
|
||||
Else
|
||||
sbResultado.Append($"Se presento un error al verificar la solicitud <br> 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)
|
||||
|
||||
97
Nomina/RepPersonalDIM.aspx
Normal file
97
Nomina/RepPersonalDIM.aspx
Normal file
@@ -0,0 +1,97 @@
|
||||
<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="RepPersonalDIM.aspx.vb" Inherits="Nomina_RepPersonalDIM" EnableEventValidation="false" %>
|
||||
|
||||
<asp:Content ID="Content1" ContentPlaceHolderID="CP" runat="Server">
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content2" ContentPlaceHolderID="Css" runat="Server">
|
||||
<style>
|
||||
</style>
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content3" ContentPlaceHolderID="HB" runat="Server">
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content4" ContentPlaceHolderID="E" runat="Server">
|
||||
Reporte Personal DIM
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content5" ContentPlaceHolderID="H" runat="Server">
|
||||
|
||||
|
||||
<li>
|
||||
<asp:LinkButton ID="LnkExportar" runat="server" Visible="true"><i class="fa fa-ad-excel"></i> Generar Excel</asp:LinkButton>
|
||||
</li>
|
||||
<li>
|
||||
<asp:LinkButton ID="LnkDescargaArchivo" runat="server" Visible="true"><i class="fa fa-ad-excel"></i> Descarga Archivo</asp:LinkButton>
|
||||
</li>
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content6" ContentPlaceHolderID="C" runat="Server">
|
||||
|
||||
<asp:UpdatePanel runat="server" ID="UpFiltros" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
<div class="portlet solid grey-cascade portlet-filter">
|
||||
<div class="portlet-title portlet-filterT smalltitle">
|
||||
<div class="tools">
|
||||
<asp:Button ID="BtnConsultar" Text="Consultar" CssClass="btn btn-primary" runat="server" OnClick="BtnConsultar_Click" />
|
||||
<a href="javascript:;" class="expand"></a>
|
||||
</div>
|
||||
<div class="titlefiltros caption ">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
|
||||
<label class="col-md-1" runat="server" id="LiEjercicioLbl">Ejercicio: </label>
|
||||
<div class="col-md-1 " runat="server" id="LiEjercicioDdl">
|
||||
<asp:DropDownList ID="DdlEjercicio" runat="server" CssClass="select2me" DataTextField="Ejercicio" DataValueField="Ejercicio" Width="100%" >
|
||||
</asp:DropDownList>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="portlet-body" style="display: none">
|
||||
<div class="row">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
|
||||
<asp:UpdatePanel runat="server" ID="UpGvCargaDatos">
|
||||
<ContentTemplate>
|
||||
<asp:GridView ID="GvDatos" runat="server" AutoGenerateColumns="true" DataKeyNames="" ShowHeaderWhenEmpty="true"
|
||||
CssClass="ADSCROLLER2 table table-striped table-advance table-hover" data-cols="1" data-heightmenos="300"
|
||||
Style="margin-top: -10px; text-align: center;" GridLines="None">
|
||||
<Columns>
|
||||
|
||||
</Columns>
|
||||
</asp:GridView>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content7" ContentPlaceHolderID="JS" runat="Server">
|
||||
|
||||
|
||||
</asp:Content>
|
||||
149
Nomina/RepPersonalDIM.aspx.vb
Normal file
149
Nomina/RepPersonalDIM.aspx.vb
Normal file
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user