This commit is contained in:
2023-09-11 10:13:35 -07:00
12 changed files with 1260 additions and 241 deletions

View File

@@ -240,7 +240,7 @@ Public Class LogicNominas
End If End If
Next Next
hasfiniquito = False 'objNomina.DtResultados.COUNT("SATCveConcepto", "(Tipo = 'P' AND SATCveConcepto IN ('022', '023','025')) ") > 0 'OR (Tipo = 'D' AND SATCveConcepto = '101') hasfiniquito = objNomina.DtResultados.COUNT("SATCveConcepto", "(Tipo = 'P' AND SATCveConcepto IN ('022', '023','025')) ") > 0 'OR (Tipo = 'D' AND SATCveConcepto = '101')
TotalPercepciones = DtPercepciones.SUM("Importe").ToString().ToDecimal() TotalPercepciones = DtPercepciones.SUM("Importe").ToString().ToDecimal()
@@ -251,15 +251,15 @@ Public Class LogicNominas
If continuar Then GetError = "No se pudo obtener el detalle de la nomina" 'si continuar= true el error se origino en este nodo y le asigno el error If continuar Then GetError = "No se pudo obtener el detalle de la nomina" 'si continuar= true el error se origino en este nodo y le asigno el error
continuar = False continuar = False
End If End If
If Not TimbreIndemnizacion Then 'If Not TimbreIndemnizacion Then
'If continuar AndAlso objNomina.GetHorasExtras(CvePersonal, CvePeriodo, UsuarioActual.CveEmpresa) Then ' 'If continuar AndAlso objNomina.GetHorasExtras(CvePersonal, CvePeriodo, UsuarioActual.CveEmpresa) Then
' DtHorasExtras = objNomina.DtResultados ' ' DtHorasExtras = objNomina.DtResultados
' 'Else
' ' continuar = False
' 'End If
'Else 'Else
' continuar = False ' 'DtHorasExtras = New DataTable()
'End If 'End If
Else
'DtHorasExtras = New DataTable()
End If
If continuar AndAlso objNomina.GetPeriodos(-1, UsuarioActual.CveEmpresa, -1, -1, CvePeriodo) AndAlso objNomina.DtResultados.Rows().Count > 0 Then If continuar AndAlso objNomina.GetPeriodos(-1, UsuarioActual.CveEmpresa, -1, -1, CvePeriodo) AndAlso objNomina.DtResultados.Rows().Count > 0 Then
Dim DrPeriodo As DataRow = objNomina.DtResultados.Rows(0) Dim DrPeriodo As DataRow = objNomina.DtResultados.Rows(0)
@@ -446,7 +446,7 @@ Public Class LogicNominas
Next Next
End If End If
If CveRegimenContratacion.ToEntero() = 2 AndAlso ((ObjOtrosPagos.FirstOrDefault(Function(m) m.TipoOtroPago.ToEntero().Contiene(2, 7, 8))) Is Nothing) Then If Not hasfiniquito AndAlso CveRegimenContratacion.ToEntero() = 2 AndAlso ((ObjOtrosPagos.FirstOrDefault(Function(m) m.TipoOtroPago.ToEntero().Contiene(2, 7, 8))) Is Nothing) Then
ObjOtrosPagos.Add(New CFDINominaOtrosPagos With {.TipoOtroPago = "002", ' codigo fijo, por ser referente a subsidio al empleo ObjOtrosPagos.Add(New CFDINominaOtrosPagos With {.TipoOtroPago = "002", ' codigo fijo, por ser referente a subsidio al empleo
.Clave = "D051", .Concepto = "Subs al Empleo acreditado", .Importe = 0D, .Subsidiocausado = 0D}) .Clave = "D051", .Concepto = "Subs al Empleo acreditado", .Importe = 0D, .Subsidiocausado = 0D})
@@ -464,6 +464,7 @@ Public Class LogicNominas
cfdi.Comprobante.Serie = Serie cfdi.Comprobante.Serie = Serie
cfdi.Comprobante.Folio = Folio cfdi.Comprobante.Folio = Folio
cfdi.Comprobante.Fecha = Now cfdi.Comprobante.Fecha = Now
cfdi.Comprobante.SubTotal = subTotalDb 'cfdi.Nomina.TotalPercepciones.ToString().ToDecimal() + cfdi.Nomina.TotalOtrosPagos.ToString().ToDecimal() cfdi.Comprobante.SubTotal = subTotalDb 'cfdi.Nomina.TotalPercepciones.ToString().ToDecimal() + cfdi.Nomina.TotalOtrosPagos.ToString().ToDecimal()
cfdi.Comprobante.Descuentos = cfdi.Nomina.TotalDeducciones.ToString().ToDecimal() cfdi.Comprobante.Descuentos = cfdi.Nomina.TotalDeducciones.ToString().ToDecimal()
cfdi.Comprobante.Total = totalDb 'cfdi.Comprobante.SubTotal - cfdi.Comprobante.Descuentos 'cfdi.Nomina.TotalPercepciones + cfdi.Nomina.TotalOtrosPagos - cfdi.Nomina.TotalDeducciones cfdi.Comprobante.Total = totalDb 'cfdi.Comprobante.SubTotal - cfdi.Comprobante.Descuentos 'cfdi.Nomina.TotalPercepciones + cfdi.Nomina.TotalOtrosPagos - cfdi.Nomina.TotalDeducciones
@@ -479,15 +480,15 @@ Public Class LogicNominas
'4.0 '4.0
cfdi.Receptor.DomicilioFiscalReceptor = CodigoPostal cfdi.Receptor.DomicilioFiscalReceptor = CodigoPostal
cfdi.Receptor.RegimenFiscalReceptor = "605" cfdi.Receptor.RegimenFiscalReceptor = "605"
cfdi.IStimbreFiniquito = hasfiniquito
cfdi.Nomina.Receptor.CURP = CURP cfdi.Nomina.Receptor.CURP = CURP
cfdi.Nomina.Receptor.NSS = NumeroSS cfdi.Nomina.Receptor.NSS = NumeroSS
cfdi.Nomina.Receptor.FechaInicioContrato = FechaInicioContrato cfdi.Nomina.Receptor.FechaInicioContrato = FechaInicioContrato
cfdi.Nomina.Receptor.Antiguedad = AntiguedadSemanas '$"P{AntiguedadSemanas}W" cfdi.Nomina.Receptor.Antiguedad = AntiguedadSemanas '$"P{AntiguedadSemanas}W"
cfdi.Nomina.Receptor.TipoContrato = If(TimbreIndemnizacion, "99", CodigoTipoContrato) cfdi.Nomina.Receptor.TipoContrato = If(hasfiniquito, "99", CodigoTipoContrato)
cfdi.Nomina.Receptor.CodigoTipoJornada = ClaveTipoJornada cfdi.Nomina.Receptor.CodigoTipoJornada = ClaveTipoJornada
cfdi.Nomina.Receptor.CodigoRegimenContratacion = If(TimbreIndemnizacion, "13", CveRegimenContratacion) cfdi.Nomina.Receptor.CodigoRegimenContratacion = If(hasfiniquito, "13", CveRegimenContratacion)
cfdi.Nomina.Receptor.CodigoEmpleado = Codigo cfdi.Nomina.Receptor.CodigoEmpleado = Codigo
cfdi.Nomina.Receptor.Departamento = Departamento cfdi.Nomina.Receptor.Departamento = Departamento
cfdi.Nomina.Receptor.Puesto = Puesto cfdi.Nomina.Receptor.Puesto = Puesto
@@ -502,6 +503,7 @@ Public Class LogicNominas
cfdi.Conceptos.Add(New CFDIConceptos With {.Cantidad = 1, .ClaveUnidad = "ACT", .ClaveProdServ = "84111505", .Descripcion = "Pago de nómina", .ValorUnitario = cfdi.Comprobante.SubTotal, .Importe = cfdi.Comprobante.SubTotal, .Descuento = cfdi.Nomina.TotalDeducciones.ToString().ToDecimal(), .ObjetoImpuesto = "01"}) cfdi.Conceptos.Add(New CFDIConceptos With {.Cantidad = 1, .ClaveUnidad = "ACT", .ClaveProdServ = "84111505", .Descripcion = "Pago de nómina", .ValorUnitario = cfdi.Comprobante.SubTotal, .Importe = cfdi.Comprobante.SubTotal, .Descuento = cfdi.Nomina.TotalDeducciones.ToString().ToDecimal(), .ObjetoImpuesto = "01"})
hasfiniquito = False
If continuar Then If continuar Then
Return cfdi Return cfdi

View File

@@ -197,7 +197,9 @@
</div> </div>
</div> </div>
<div class="portlet-body"> <div class="portlet-body">
<div class="row">
<%-- <div class="row">
<div class="col-md-4"> <div class="col-md-4">
<span>Número de Tarjeta:</span> <span>Número de Tarjeta:</span>
</div> </div>
@@ -223,8 +225,6 @@
<asp:CompareValidator ID="CVFechaVencimiento" runat="server" ControlToValidate="TxtFechaVencimiento" Display="None" Operator="DataTypeCheck" Type="Date" ValidationGroup="GrpAgregarTarjeta" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Fecha de Vencimiento''</b> no tiene el formato correcto, por favor intente de nuevo con el siguiente formato: (dd/mm/yyyy)."></asp:CompareValidator> <asp:CompareValidator ID="CVFechaVencimiento" runat="server" ControlToValidate="TxtFechaVencimiento" Display="None" Operator="DataTypeCheck" Type="Date" ValidationGroup="GrpAgregarTarjeta" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Fecha de Vencimiento''</b> no tiene el formato correcto, por favor intente de nuevo con el siguiente formato: (dd/mm/yyyy)."></asp:CompareValidator>
<ajax:ValidatorCalloutExtender ID="VCOFecha2Cancelacion" runat="server" HighlightCssClass="vco" TargetControlID="CVFechaVencimiento" Width="350px"></ajax:ValidatorCalloutExtender> <ajax:ValidatorCalloutExtender ID="VCOFecha2Cancelacion" runat="server" HighlightCssClass="vco" TargetControlID="CVFechaVencimiento" Width="350px"></ajax:ValidatorCalloutExtender>
<%-- <asp:CompareValidator ID="CVFechaVencimientoMin" runat="server" ControlToCompare="Date.Now" ControlToValidate="TxtFechaVencimiento" Display="None" Operator="GreaterThanEqual" Type="Date" ValidationGroup="" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Fecha Cancelación''</b>tiene que ser mayor o igual a la fecha del documento."></asp:CompareValidator>
<ajax:ValidatorCalloutExtender ID="ValidatorCalloutExtender4" runat="server" HighlightCssClass="vco" TargetControlID="CVFechaCancelacionMin" Width="350px"></ajax:ValidatorCalloutExtender>--%>
</div> </div>
</div> </div>
</div> </div>
@@ -242,13 +242,21 @@
<asp:LinkButton ID="LkbAgregarTarjera" CssClass="Texto" runat="server" ValidationGroup="GrpAgregarTarjeta">Agregar</asp:LinkButton></td> <asp:LinkButton ID="LkbAgregarTarjera" CssClass="Texto" runat="server" ValidationGroup="GrpAgregarTarjeta">Agregar</asp:LinkButton></td>
</div> </div>
</div> </div>
</div> </div>--%>
<div class="row" style="margin-top: 5px;"> <div class="row" style="margin-top: 5px;">
<div class="col-md-12"> <div class="col-md-12">
<asp:GridView ID="GvTarjetas" runat="server" GridLines="None" AutoGenerateColumns="false" CssClass="table table-striped table-hover mysmallbtn" data-height="400px" DataKeyNames="CveCuentaTarjeta, CveCuenta"> <asp:GridView ID="GvTC" runat="server" DataKeyNames="CveCuenta" AutoGenerateColumns="False" EmptyDataText="No hay tarjetas vinculadas" ToolTip="Tarjetas de Credito" CssClass="table table-striped table-advance table-hover Widthall" GridLines="None">
<Columns>
<asp:BoundField DataField="CLABE" HeaderText="CLABE" ItemStyle-HorizontalAlign="Left"></asp:BoundField>
<asp:BoundField DataField="NumCuenta" HeaderText="Num. Cuenta" ItemStyle-HorizontalAlign="Left"></asp:BoundField>
</Columns>
</asp:GridView>
<%--<asp:GridView ID="GvTarjetas" runat="server" GridLines="None" AutoGenerateColumns="false" CssClass="table table-striped table-hover mysmallbtn" data-height="400px" DataKeyNames="CveCuentaTarjeta, CveCuenta">
<Columns> <Columns>
<asp:TemplateField> <asp:TemplateField>
<HeaderTemplate> <HeaderTemplate>
@@ -317,7 +325,9 @@
</Columns> </Columns>
<RowStyle CssClass="Texto" /> <RowStyle CssClass="Texto" />
<AlternatingRowStyle CssClass="TextoAlterno" /> <AlternatingRowStyle CssClass="TextoAlterno" />
</asp:GridView> </asp:GridView>--%>
</div> </div>
</div> </div>
</div> </div>

View File

@@ -688,106 +688,118 @@ Partial Class Bancos_CuentasBancariasDetalle
#End Region #End Region
#Region "D A T O S T A R J E TA - C R E D I T O" #Region "D A T O S T A R J E TA - C R E D I T O"
Private Sub LkbAgregarTarjera_Click(sender As Object, e As EventArgs) Handles LkbAgregarTarjera.Click 'Private Sub LkbAgregarTarjera_Click(sender As Object, e As EventArgs) Handles LkbAgregarTarjera.Click
Dim ObjTarjeta As New ClsBancos() ' Dim ObjTarjeta As New ClsBancos()
Dim TieneError = False ' Dim TieneError = False
If Not ObjTarjeta.AddTarjetaCredito(CveCuenta, TxtNumTarjeta.Text, TxtNombreResponsable.Text, TxtFechaVencimiento.Text.ToDate, UsuarioActual.CveUsuario) Then ' If Not ObjTarjeta.AddTarjetaCredito(CveCuenta, TxtNumTarjeta.Text, TxtNombreResponsable.Text, TxtFechaVencimiento.Text.ToDate, UsuarioActual.CveUsuario) Then
TieneError = True ' TieneError = True
End If ' End If
If Not TieneError Then ' If Not TieneError Then
Alert("Se guardo la tarjeta de credito correctamente", TipoMensaje.MsgInformacion) ' Alert("Se guardo la tarjeta de credito correctamente", TipoMensaje.MsgInformacion)
TxtNumTarjeta.Text = "" ' TxtNumTarjeta.Text = ""
TxtNombreResponsable.Text = "" ' TxtNombreResponsable.Text = ""
TxtFechaVencimiento.Text = "" ' TxtFechaVencimiento.Text = ""
CargaDatosTarjeta() ' CargaDatosTarjeta()
Else ' Else
Alert("Ocurrio un Error al Guardar la tarjeta de credito", TipoMensaje.MsgError) ' Alert("Ocurrio un Error al Guardar la tarjeta de credito", TipoMensaje.MsgError)
End If ' End If
ObjTarjeta.Dispose() ' ObjTarjeta.Dispose()
UpDatos.Update() ' UpDatos.Update()
End Sub 'End Sub
Private Sub CargaDatosTarjeta() Private Sub CargaDatosTarjeta()
Dim ObjTarjeta As New ClsBancos() 'Dim ObjTarjeta As New ClsBancos()
If ObjTarjeta.GetTarjetaCredito(-1, CveCuenta, -1) Then 'If ObjTarjeta.GetTarjetaCredito(-1, CveCuenta, -1) Then
GvTarjetas.DataSource = ObjTarjeta.DtResultados() ' GvTarjetas.DataSource = ObjTarjeta.DtResultados()
Else 'Else
GvTarjetas.DataSource = Nothing ' GvTarjetas.DataSource = Nothing
'End If
'GvTarjetas.DataBind()
'ObjTarjeta.Dispose()
Dim ObjCreditos As New ClsBancos
If ObjCreditos.GetTarjetasCreditos(CveCuenta) Then
If ObjCreditos.DtResultados.Rows.Count > 0 Then
GvTC.DataSource = ObjCreditos.DtResultados
End If End If
GvTarjetas.DataBind() GvTC.Visible = True
ObjTarjeta.Dispose() End If
ObjCreditos.Dispose()
GvTC.DataBind()
UpDatos.Update() UpDatos.Update()
End Sub End Sub
Private Sub GvTarjetas_RowEditing(sender As Object, e As GridViewEditEventArgs) Handles GvTarjetas.RowEditing 'Private Sub GvTarjetas_RowEditing(sender As Object, e As GridViewEditEventArgs) Handles GvTarjetas.RowEditing
GvTarjetas.EditIndex = e.NewEditIndex ' GvTarjetas.EditIndex = e.NewEditIndex
CargaDatosTarjeta() ' CargaDatosTarjeta()
End Sub 'End Sub
Private Sub GvTarjetas_RowCancelingEdit(sender As Object, e As GridViewCancelEditEventArgs) Handles GvTarjetas.RowCancelingEdit 'Private Sub GvTarjetas_RowCancelingEdit(sender As Object, e As GridViewCancelEditEventArgs) Handles GvTarjetas.RowCancelingEdit
GvTarjetas.EditIndex = -1 ' GvTarjetas.EditIndex = -1
CargaDatosTarjeta() ' CargaDatosTarjeta()
End Sub 'End Sub
Private Sub GvTarjetas_RowUpdating(sender As Object, e As GridViewUpdateEventArgs) Handles GvTarjetas.RowUpdating 'Private Sub GvTarjetas_RowUpdating(sender As Object, e As GridViewUpdateEventArgs) Handles GvTarjetas.RowUpdating
Dim ObjTarjeta As New ClsBancos() ' Dim ObjTarjeta As New ClsBancos()
Dim TieneError = False ' Dim TieneError = False
Dim CveCuentaTarjeta = GvTarjetas.Rows(e.RowIndex).DataKey("CveCuentaTarjeta").ToEntero ' Dim CveCuentaTarjeta = GvTarjetas.Rows(e.RowIndex).DataKey("CveCuentaTarjeta").ToEntero
Dim CveCuenta As Integer = GvTarjetas.Rows(e.RowIndex).DataKey("CveCuenta").ToEntero ' Dim CveCuenta As Integer = GvTarjetas.Rows(e.RowIndex).DataKey("CveCuenta").ToEntero
Dim Numero = DirectCast(GvTarjetas.Rows(e.RowIndex).FindControl("TxtNumeroEdit"), TextBox).Text.Trim ' Dim Numero = DirectCast(GvTarjetas.Rows(e.RowIndex).FindControl("TxtNumeroEdit"), TextBox).Text.Trim
Dim Responsable = DirectCast(GvTarjetas.Rows(e.RowIndex).FindControl("TxtResponsableEdit"), TextBox).Text.Trim ' Dim Responsable = DirectCast(GvTarjetas.Rows(e.RowIndex).FindControl("TxtResponsableEdit"), TextBox).Text.Trim
Dim Vencimiento = DirectCast(GvTarjetas.Rows(e.RowIndex).FindControl("TxtFechaVencimientoEdit"), TextBox).Text.ToDate ' Dim Vencimiento = DirectCast(GvTarjetas.Rows(e.RowIndex).FindControl("TxtFechaVencimientoEdit"), TextBox).Text.ToDate
If Not ObjTarjeta.UpdateTarjetaCredito(CveCuentaTarjeta, CveCuenta, Numero, Responsable, Vencimiento, UsuarioActual.CveUsuario) Then ' If Not ObjTarjeta.UpdateTarjetaCredito(CveCuentaTarjeta, CveCuenta, Numero, Responsable, Vencimiento, UsuarioActual.CveUsuario) Then
TieneError = True ' TieneError = True
Else ' Else
GvTarjetas.EditIndex = -1 ' GvTarjetas.EditIndex = -1
End If ' End If
If Not TieneError Then ' If Not TieneError Then
Alert("Los cambios se guardaron correctamente.", TipoMensaje.MsgInformacion) ' Alert("Los cambios se guardaron correctamente.", TipoMensaje.MsgInformacion)
CargaDatosTarjeta() ' CargaDatosTarjeta()
Else ' Else
Alert("Error al actualizar los cambios.", TipoMensaje.MsgError) ' Alert("Error al actualizar los cambios.", TipoMensaje.MsgError)
End If ' End If
ObjTarjeta.Dispose() ' ObjTarjeta.Dispose()
UpDatos.Update() ' UpDatos.Update()
End Sub 'End Sub
Private Sub GvTarjetas_RowDeleting(sender As Object, e As GridViewDeleteEventArgs) Handles GvTarjetas.RowDeleting 'Private Sub GvTarjetas_RowDeleting(sender As Object, e As GridViewDeleteEventArgs) Handles GvTarjetas.RowDeleting
Dim ObjTarjeta As New ClsBancos() ' Dim ObjTarjeta As New ClsBancos()
Dim TieneError = False ' Dim TieneError = False
Dim CveCuentaTarjeta = GvTarjetas.Rows(e.RowIndex).DataKey("CveCuentaTarjeta").ToEntero ' Dim CveCuentaTarjeta = GvTarjetas.Rows(e.RowIndex).DataKey("CveCuentaTarjeta").ToEntero
If ObjTarjeta.RemoveTarjetaCredito(CveCuentaTarjeta, UsuarioActual.CveUsuario) Then ' If ObjTarjeta.RemoveTarjetaCredito(CveCuentaTarjeta, UsuarioActual.CveUsuario) Then
CargaDatosTarjeta() ' CargaDatosTarjeta()
Alert("Se eliminaron datos correctamente", TipoMensaje.MsgInformacion) ' Alert("Se eliminaron datos correctamente", TipoMensaje.MsgInformacion)
Else ' Else
Alert("Error al eliminar", TipoMensaje.MsgError) ' Alert("Error al eliminar", TipoMensaje.MsgError)
End If ' End If
ObjTarjeta.Dispose() ' ObjTarjeta.Dispose()
UpDatos.Update() ' UpDatos.Update()
End Sub 'End Sub
Private Sub GvTarjetas_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvTarjetas.RowDataBound 'Private Sub GvTarjetas_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvTarjetas.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then ' If e.Row.RowType = DataControlRowType.DataRow Then
If e.Row.RowIndex = 0 Then ' If e.Row.RowIndex = 0 Then
e.Row.Cells(0).Width = Unit.Pixel(100) ' e.Row.Cells(0).Width = Unit.Pixel(100)
e.Row.Cells(1).Width = Unit.Pixel(100) ' e.Row.Cells(1).Width = Unit.Pixel(100)
e.Row.Cells(2).Width = Unit.Pixel(200) ' e.Row.Cells(2).Width = Unit.Pixel(200)
e.Row.Cells(3).Width = Unit.Pixel(20) ' e.Row.Cells(3).Width = Unit.Pixel(20)
e.Row.Cells(4).Width = Unit.Pixel(20) ' e.Row.Cells(4).Width = Unit.Pixel(20)
End If ' End If
End If ' End If
End Sub 'End Sub
Private Function CargarDdlUsuarios(UsuariosGlobal As DataTable) As DataTable Private Function CargarDdlUsuarios(UsuariosGlobal As DataTable) As DataTable
Dim tablaUsuariosFormateada As DataTable = New DataTable("Usuarios") Dim tablaUsuariosFormateada As DataTable = New DataTable("Usuarios")

View File

@@ -181,6 +181,7 @@
<div> <div>
<asp:UpdatePanel ID="UpGvTC" runat="server" UpdateMode="Conditional"> <asp:UpdatePanel ID="UpGvTC" runat="server" UpdateMode="Conditional">
<ContentTemplate> <ContentTemplate>
<asp:GridView ID="GvTC" runat="server" DataKeyNames="CveCuenta" AutoGenerateColumns="False" EmptyDataText="No hay tarjetas vinculadas" ToolTip="Tarjetas de Credito" CssClass="table table-striped table-advance table-hover Widthall" GridLines="None"> <asp:GridView ID="GvTC" runat="server" DataKeyNames="CveCuenta" AutoGenerateColumns="False" EmptyDataText="No hay tarjetas vinculadas" ToolTip="Tarjetas de Credito" CssClass="table table-striped table-advance table-hover Widthall" GridLines="None">
<Columns> <Columns>
<asp:BoundField DataField="CLABE" HeaderText="CLABE" ItemStyle-HorizontalAlign="Right"> <asp:BoundField DataField="CLABE" HeaderText="CLABE" ItemStyle-HorizontalAlign="Right">
@@ -202,6 +203,7 @@
<AlternatingRowStyle CssClass="TextoAlterno" /> <AlternatingRowStyle CssClass="TextoAlterno" />
<HeaderStyle CssClass="Titulos" Height="50px" /> <HeaderStyle CssClass="Titulos" Height="50px" />
</asp:GridView> </asp:GridView>
</ContentTemplate> </ContentTemplate>
</asp:UpdatePanel> </asp:UpdatePanel>
</div> </div>

View File

@@ -380,7 +380,6 @@ Partial Class Bancos_Transferencias
Exit For Exit For
Else Else
AlertaGlobal.AppendFormat("<a class=""Texto"" target='_blank' href=""/Bancos/IE.aspx?CveIE={0}"">{1}</a><br/>", CveIEDestino, FolioDestino) AlertaGlobal.AppendFormat("<a class=""Texto"" target='_blank' href=""/Bancos/IE.aspx?CveIE={0}"">{1}</a><br/>", CveIEDestino, FolioDestino)
'FolioDestino = (FolioDestino.ToLong + 1).ToString
End If End If
Next Next

Binary file not shown.

BIN
Imagenes/SinImagenB.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@@ -235,9 +235,17 @@ public partial class Nomina_Finiquito : ClsPaginas
if (TxtFechaBaja.Text.Length > 9) if (TxtFechaBaja.Text.Length > 9)
{ {
DateTime fechafin = TxtFechaBaja.Text.ToDateTime(); DateTime fechafin = TxtFechaBaja.Text.ToDateTime();
DateTime fechaalta = LblFechaAlta.Text.ToDateTime();
int diasanio = fechafin.DayOfYear;
if (fechafin.Year == fechaalta.Year)
{
diasanio = diasanio - fechaalta.DayOfYear;
}
decimal antiguedad = getyearsresult(fechafin, FechaInicio); decimal antiguedad = getyearsresult(fechafin, FechaInicio);
TxtAntiguedad.Text = string.Format("{0:##0.00###}", antiguedad); TxtAntiguedad.Text = string.Format("{0:##0.00###}", antiguedad);
TxtDiasTransAnio.Text = string.Format("{0}", fechafin.DayOfYear); TxtDiasTransAnio.Text = string.Format("{0}", diasanio);
} }
else else
{ {

View File

@@ -295,6 +295,9 @@
<li> <li>
<asp:HyperLink ID="HypPDFSTimbrados" Visible="false" onclick="GETPDF(-1,0)" NavigateUrl="#" runat="server"><i class="fa fa-download" aria-hidden="true"></i>Recibos timbrados</asp:HyperLink> <asp:HyperLink ID="HypPDFSTimbrados" Visible="false" onclick="GETPDF(-1,0)" NavigateUrl="#" runat="server"><i class="fa fa-download" aria-hidden="true"></i>Recibos timbrados</asp:HyperLink>
</li> </li>
<li>
<asp:LinkButton ID="LnkProcesarModal" OnClick="LnkProcesarModal_Click" runat="server"><i class="fa fa-check"></i> Procesar archivo SUA EBA PDF</asp:LinkButton>
</li>
<li> <li>
<%--<asp:LinkButton ID="LnkOpenCancelarTimbre" OnClick="LnkOpenCancelarTimbre_Click" runat="server"><i class="fa fa-download"></i> CancelarTimbre</asp:LinkButton>--%> <%--<asp:LinkButton ID="LnkOpenCancelarTimbre" OnClick="LnkOpenCancelarTimbre_Click" runat="server"><i class="fa fa-download"></i> CancelarTimbre</asp:LinkButton>--%>
</li> </li>
@@ -917,7 +920,8 @@
<div class="portlet-title"> <div class="portlet-title">
<div class="caption "> <div class="caption ">
<i class="icon-pin font-yellow-gold"></i> <i class="icon-pin font-yellow-gold"></i>
<span class="caption-subject font-yellow-gold bold uppercase">Nomina del <asp:Label ID="LblFecha" runat="server"></asp:Label></span> <span class="caption-subject font-yellow-gold bold uppercase">Nomina del
<asp:Label ID="LblFecha" runat="server"></asp:Label></span>
</div> </div>
<div class="tools"> <div class="tools">
<a href="javascript:;" class="collapse" data-original-title="" title=""></a> <a href="javascript:;" class="collapse" data-original-title="" title=""></a>
@@ -3306,6 +3310,47 @@
</asp:UpdatePanel> </asp:UpdatePanel>
</div> </div>
<div id="DmodalArchivoEBASUAPDFToExceL" class="modal ADS fade" role="dialog">
<asp:UpdatePanel ID="UpdatePanel4" class="modal-dialog" tabindex="-1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div class="modal-content rowpadding">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title" runat="server" style="text-align: left">Procesa PDF</h4>
</div>
<div class="modal-body">
<div class="portlet light smmallpadding bordered">
<div class="portlet-title">
<div class="caption font-green">
<i class="fa fa-upload font-green"></i>
<span class="caption-subject bold uppercase">cargar Archivos PDF </span>
</div>
<div class="tools">
<a href="javascript:;" class="collapse" data-original-title="" title=""></a>
</div>
</div>
<div class="portlet-body rowpadding ">
<asp:TextBox ID="TxtArchivoPDFSUAEBA" CssClass="ADSdropzone hidden" runat="server"></asp:TextBox>
</div>
</div>
</div>
<div class="modal-footer">
<asp:LinkButton ID="LnkProcesaPDFSUAEBA" OnClick="LnkProcesaPDFSUAEBA_Click" CssClass="btn btn-primary" runat="server">Procesar</asp:LinkButton>
</div>
</div>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="LnkProcesaPDFSUAEBA" />
</Triggers>
</asp:UpdatePanel>
</div>
<div id="DModalAsistenciaTabular" class="modal ADS fade" role="dialog"> <div id="DModalAsistenciaTabular" class="modal ADS fade" role="dialog">
<asp:UpdatePanel ID="UpdatePanel3" class="modal-dialog" tabindex="-1" runat="server" UpdateMode="Conditional"> <asp:UpdatePanel ID="UpdatePanel3" class="modal-dialog" tabindex="-1" runat="server" UpdateMode="Conditional">
<ContentTemplate> <ContentTemplate>
@@ -3431,8 +3476,6 @@
-si desea agregar un empleado que no se encuentre en la lista solo debe de ingresar fila y el codigo del empleado.<br /> -si desea agregar un empleado que no se encuentre en la lista solo debe de ingresar fila y el codigo del empleado.<br />
-si no desea insertar un concepto puede borrar la columna.<br /> -si no desea insertar un concepto puede borrar la columna.<br />
-no se debe borrar la columna código.<br />--%> -no se debe borrar la columna código.<br />--%>
</div> </div>

View File

@@ -11,6 +11,8 @@ using System.Web.UI;
using System.Web.UI.WebControls; using System.Web.UI.WebControls;
using static Extensiones.ModExtensiones; using static Extensiones.ModExtensiones;
using Modelos; using Modelos;
using System.Text.RegularExpressions;
using iTextSharp.text.pdf.parser;
public partial class Nomina_Nomina2 : ClsPaginas public partial class Nomina_Nomina2 : ClsPaginas
{ {
@@ -652,7 +654,8 @@ public partial class Nomina_Nomina2 : ClsPaginas
if (CvePersonal > 0) if (CvePersonal > 0)
{ {
} }
else { else
{
#region CargaGrid #region CargaGrid
if (continuar) if (continuar)
{ {
@@ -1173,7 +1176,7 @@ public partial class Nomina_Nomina2 : ClsPaginas
int CvePeriodo = e.Row.DataKey("CvePeriodo").ToEntero(); int CvePeriodo = e.Row.DataKey("CvePeriodo").ToEntero();
int CveNomina = e.Row.DataKey("CveNomina").ToEntero(); int CveNomina = e.Row.DataKey("CveNomina").ToEntero();
string SeTimbro = e.Row.DataKey("SeTimbro").ToString(); string SeTimbro = e.Row.DataKey("SeTimbro").ToString();
string SeTimbroFiniquito = e.Row.DataKey("SeTimbroFiniquito").ToString(); string SeTimbroFiniquito = SeTimbro;//e.Row.DataKey("SeTimbroFiniquito").ToString();
string EsRenuncia = e.Row.DataKey("EsRenuncia").ToString(); string EsRenuncia = e.Row.DataKey("EsRenuncia").ToString();
string NomAutorizado = e.Row.DataKey("NomAutorizado").ToString(); string NomAutorizado = e.Row.DataKey("NomAutorizado").ToString();
string Nombre = e.Row.DataKey("Nombre").ToString(); string Nombre = e.Row.DataKey("Nombre").ToString();
@@ -10140,11 +10143,801 @@ public partial class Nomina_Nomina2 : ClsPaginas
GVViewCorreos.DataBind(); GVViewCorreos.DataBind();
} }
UpviewCorreos.Update(); UpviewCorreos.Update();
RegistraScript(string.Format("$('#ModalViewCorreo').modal();", TxtmcImporte.ClientID)); RegistraScript("$('#ModalViewCorreo').modal();");
}
protected void LnkProcesarModal_Click(object sender, EventArgs e)
{
RegistraScript("$('#DmodalArchivoEBASUAPDFToExceL').modal();");
}
protected void LnkProcesaPDFSUAEBA_Click(object sender, EventArgs e)
{
List<Archivo> Filesgral = TxtArchivoPDFSUAEBA.getfiles().Archivos;
if (Filesgral.Count > 0)
{
string dirPDF = Filesgral[0].FileUrl;
Boolean essua = false;
using (iTextSharp.text.pdf.PdfReader readerx = new iTextSharp.text.pdf.PdfReader(dirPDF))
{
if (readerx.NumberOfPages > 0)
{
string text = PdfTextExtractor.GetTextFromPage(readerx, 1);
essua = text.Contains("SISTEMA ÚNICO DE AUTODETERMINACIÓN");
}
}
if (essua)
{
System.IO.Stream fs=(new CedulaSuaPDF()).writexls(dirPDF);
fs.Position = 0;
System.IO.MemoryStream memoryStream = new System.IO.MemoryStream();
using (System.IO.Stream input = fs)
{
input.CopyTo(memoryStream);
}
memoryStream.Position = 0;
Response.Clear();
Response.Buffer = true;
Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
Response.AddHeader("content-disposition", string.Format("attachment;filename={0}.xlsx", "SUA "));
Response.BinaryWrite(memoryStream.ToArray());
Response.End();
}
else
{
System.IO.Stream fs =(new CedulaEBAPDF()).writexls(dirPDF);
fs.Position = 0;
System.IO.MemoryStream memoryStream = new System.IO.MemoryStream();
using (System.IO.Stream input = fs)
{
input.CopyTo(memoryStream);
}
memoryStream.Position = 0;
Response.Clear();
Response.Buffer = true;
Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
Response.AddHeader("content-disposition", string.Format("attachment;filename={0}.xlsx", "EBA "));
Response.BinaryWrite(memoryStream.ToArray());
Response.End();
}
}
}
public class CedulaEBAPDF
{
public const string validaNSSptt = @"\d{2}\s\d{2}\s\d{2}\s\d{4}\s\d"; //^inicia//$termina // Regular expression pattern
public const string ValidateCURPptt = @"[A-Z]{4}\d{6}[HM]{1}[A-Z]{5}[A-Z0-9]{2}";//^inicia//$termina
public const string ValidateFechaptt = @"(0[1-9]|[12][0-9]|3[01])-(0[1-9]|1[0-2])-\d{4}";//dd/MM/yyyy
public const string Validatedigitptt = @"^[0-9\s.\t]*$";//digitos espacio y punto
public int getindexpatch(string text, string pattern)
{
Match match = Regex.Match(text, pattern);
return match.Success ? match.Index : -1;
}
public string getvaluepatch(string text, string pattern)
{
Match match = Regex.Match(text, pattern);
return match.Success ? match.Value : null;
}
public System.IO.Stream writexls(string dirPDF)
{
cedulaEBA dataEBAPDF = readPDFcedulaEBA(dirPDF);
ClosedXML.Excel.XLWorkbook wb = new ClosedXML.Excel.XLWorkbook();
var libro = wb.AddWorksheet("EBA DATA");
int row = 1;
int column = 1;
libro.Cell(row, column++).Value = "NSS";
libro.Cell(row, column++).Value = "CURP";
libro.Cell(row, column++).Value = "Nombre";
libro.Cell(row, column++).Value = "ORIGEN";
libro.Cell(row, column++).Value = "CLAVE";
libro.Cell(row, column++).Value = "FECHA";
libro.Cell(row, column++).Value = "DIAS";
libro.Cell(row, column++).Value = "SALARIO";
libro.Cell(row, column++).Value = "RETIRO";
libro.Cell(row, column++).Value = "CESANTIAPAT";
libro.Cell(row, column++).Value = "CESANTIAOBR";
libro.Cell(row, column++).Value = "SUMARCV";
libro.Cell(row, column++).Value = "APORTACION";
libro.Cell(row, column++).Value = " ";
libro.Cell(row, column++).Value = "CUOTAFIJAOFD";
libro.Cell(row, column++).Value = "AMORTIZA";
libro.Cell(row, column++).Value = "SUMAINFONAVIT";
libro.Cell(row, column++).Value = "SUMA";
int maxxolumn = column;
libro.Range(1, 1, row, column - 1).Style.Font.FontColor = ClosedXML.Excel.XLColor.White;
libro.Range(1, 1, row, column - 1).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(79, 129, 189));
row++;
foreach (var empleado in dataEBAPDF.empleados)
{
column = 1;
if (empleado.ldtos.Count > 0)
{
foreach (var data in empleado.ldtos)
{
column = 1;
libro.Cell(row, column++).Value = string.Format("'{0}", empleado.NSS.Trim());
libro.Cell(row, column++).Value = string.Format("{0}", empleado.Curp);
libro.Cell(row, column++).Value = string.Format("{0}", empleado.Nombre);
if (!data.ORIGEN.Contains("Formato") && !data.ORIGEN.Contains("VERSION"))
{
libro.Cell(row, column++).Value = string.Format("{0}", data.ORIGEN);
libro.Cell(row, column++).Value = string.Format("'{0}", data.CLAVE);
libro.Cell(row, column++).Value = string.Format("'{0}", data.FECHA);
libro.Cell(row, column++).Value = string.Format("{0}", data.DIAS);//.Trim().Replace(",", "").Replace("$", "").ToDecimal());
libro.Cell(row, column++).Value = string.Format("{0}", data.SALARIO);//.Trim().Replace(",", "").Replace("$", "").ToDecimal());
libro.Cell(row, column++).Value = string.Format("{0}", data.RETIRO);//.Trim().Replace(",", "").Replace("$", "").ToDecimal());
libro.Cell(row, column++).Value = string.Format("{0}", data.CESANTIAPAT);//.Trim().Replace(",", "").Replace("$", "").ToDecimal());
libro.Cell(row, column++).Value = string.Format("{0}", data.CESANTIAOBR);//.Trim().Replace(",", "").Replace("$", "").ToDecimal());
libro.Cell(row, column++).Value = string.Format("{0}", data.SUMARCV);//.Trim().Replace(",", "").Replace("$", "").ToDecimal());
libro.Cell(row, column++).Value = string.Format("{0}", data.APORTACION);//.Trim().Replace(",", "").Replace("$", "").ToDecimal());
libro.Cell(row, column++).Value = string.Format("{0}", data.CUOTAFIJAOFDSTR);//.Trim().Replace(",", "").Replace("$", "").ToDecimal());
libro.Cell(row, column++).Value = string.Format("{0}", data.CUOTAFIJAOFD);//.Trim().Replace(",", "").Replace("$", "").ToDecimal());
libro.Cell(row, column++).Value = string.Format("{0}", data.AMORTIZA);//.Trim().Replace(",", "").Replace("$", "").ToDecimal());
libro.Cell(row, column++).Value = string.Format("{0}", data.SUMAINFONAVIT);//.Trim().Replace(",", "").Replace("$", "").ToDecimal());
libro.Cell(row, column++).Value = string.Format("{0}", data.SUMA);//.Trim().Replace(",", "").Replace("$", "").ToDecimal());
}
row++;
}
}
else
{
libro.Cell(row, column++).Value = string.Format("'{0}", empleado.NSS.Trim());
libro.Cell(row, column++).Value = string.Format("{0}", empleado.Curp);
libro.Cell(row, column++).Value = string.Format("{0}", empleado.Nombre);
row++;
}
}
libro.Range(2, 7, row, 13).Style.Alignment.Horizontal = ClosedXML.Excel.XLAlignmentHorizontalValues.Right;
libro.Range(2, 15, row, maxxolumn - 1).Style.Alignment.Horizontal = ClosedXML.Excel.XLAlignmentHorizontalValues.Right;
libro.Range(2, 7, row, 13).Style.NumberFormat.Format = "$ #,##0.00";
libro.Range(2, 15, row, maxxolumn - 1).Style.NumberFormat.Format = "$ #,##0.00";
libro.Columns().AdjustToContents();
libro.Range(2, 1, row, maxxolumn - 1).SetAutoFilter();
//wb.SaveAs(string.Format("{0}xlsx", dirPDF.Substring(0, dirPDF.Length - 3)));
System.IO.Stream fs = new System.IO.MemoryStream();
wb.SaveAs(fs);
return fs;
}
public cedulaEBA readPDFcedulaEBA(string dirPDF)
{
cedulaEBA objEBA = new cedulaEBA();
StringBuilder strb = new StringBuilder();
using (iTextSharp.text.pdf.PdfReader readerx = new iTextSharp.text.pdf.PdfReader(dirPDF))
{
for (int page = 1; page <= readerx.NumberOfPages; page++)
{
string text = PdfTextExtractor.GetTextFromPage(readerx, page);
string[] lines = text.Split('\n');
cedulaEBAEmpleados cempleado = null;
int pasoCaptura = 0;
bool esiniciodepagina = false;
foreach (string line in lines)
{
strb.AppendLine(line);
bool espaso1 = Regex.IsMatch(line, ValidateCURPptt);
bool espaso2 = Regex.IsMatch(line, validaNSSptt);
if (esiniciodepagina)
{
if (objEBA.empleados.Count > 0 && !espaso2 && !espaso1)
{
cempleado = objEBA.empleados[objEBA.empleados.Count - 1];
objEBA.empleados.RemoveAt(objEBA.empleados.Count - 1);
pasoCaptura = 2;
}
esiniciodepagina = false;
}
if (pasoCaptura == 0 && line.Contains("FIJA O FD"))
{
esiniciodepagina = true;
}
if (!espaso2 && !espaso1 && pasoCaptura == 2)
{
pasoCaptura = 2;
procesapaso2(line, cempleado);
}
if (espaso2)
{
//isTitulo = false;
if (!(pasoCaptura == 1))
{
if (null != cempleado)
{
objEBA.empleados.Add(cempleado);
}
cempleado = new cedulaEBAEmpleados();
}
pasoCaptura = 2;
if (espaso1)
{
cempleado.Curp = getvaluepatch(line, ValidateCURPptt);
}
cempleado.NSS = getvaluepatch(line, validaNSSptt);
cempleado.Nombre = line.Replace(cempleado.NSS, "").Trim();
if (cempleado.Curp != null)
{
cempleado.Nombre = cempleado.Nombre.Replace(cempleado.Curp, "").Trim();
}
}
if (pasoCaptura == 1)
{
pasoCaptura = 2;
procesapaso2(line, cempleado);
}
if (espaso1 && !espaso2)
{
//isTitulo = false;
pasoCaptura = 1;
if (null != cempleado)
{
objEBA.empleados.Add(cempleado);
}
cempleado = new cedulaEBAEmpleados();
cempleado.Curp = getvaluepatch(line, ValidateCURPptt);
}
//Console.WriteLine(line);
}
if (null != cempleado)
{
objEBA.empleados.Add(cempleado);
}
cempleado = null;
strb.AppendLine("/*NEWPAGE*/");
}
}
return objEBA;
}
public cedulaEBAEmpleados procesapaso2(string line, cedulaEBAEmpleados empleado)
{
if (line.ToUpper().Contains("Página".ToUpper()))
{
}
else
{
bool contienefecha = Regex.IsMatch(line, ValidateFechaptt);
string[] splitedline = line.Split(' ');
int l = splitedline.Length;
cedulaEBAEmpleadosdatos dtos = null;
cedulaEBAEmpleadosdatos dtosant = null;
if (empleado.ldtos.Count > 0)
{
dtosant = empleado.ldtos[empleado.ldtos.Count - 1];
if (dtosant.CESANTIAPAT != null &&
!(dtosant.CUOTAFIJAOFD != null &&
(dtosant.CUOTAFIJAOFD.Contains("CF") || dtosant.CUOTAFIJAOFD.Contains("FD") || dtosant.CUOTAFIJAOFD.Contains("%"))
)
)
{
dtosant = null;
}
}
int col = 0;
if (dtosant == null || l > 6)
{
dtos = new cedulaEBAEmpleadosdatos();
if (col < l) { dtos.ORIGEN = splitedline[col++]; }
if (contienefecha && col < l) { dtos.CLAVE = splitedline[col++]; }
if (contienefecha && col < l) { dtos.FECHA = splitedline[col++]; }
if (col < l) { dtos.DIAS = splitedline[col++]; }
if (col < l) { dtos.SALARIO = splitedline[col++]; }
if (col < l) { dtos.RETIRO = splitedline[col++]; }
if (col < l) { dtos.SUMARCV = splitedline[col++]; }
if (col < l) { dtos.APORTACION = splitedline[col++]; }
if ((col + 3) < l)
{
dtos.CUOTAFIJAOFD = splitedline[col++].Trim();
if (dtos.CUOTAFIJAOFD.Contains("CF") || dtos.CUOTAFIJAOFD.Contains("FD") || dtos.CUOTAFIJAOFD.Contains("%"))
{
dtos.CUOTAFIJAOFDSTR = dtos.CUOTAFIJAOFD;
if ((col + 3) < l) { dtos.CUOTAFIJAOFD = splitedline[col++].Trim(); }
}
}
if (col < l) { dtos.AMORTIZA = splitedline[col++]; }
if (col < l) { dtos.SUMAINFONAVIT = splitedline[col++]; }
if (col < l) { dtos.SUMA = splitedline[col++]; }
}
else
{
empleado.ldtos.RemoveAt(empleado.ldtos.Count - 1);
dtos = dtosant;
if (dtosant.CESANTIAPAT != null)
{
if (col < l) { dtos.CUOTAFIJAOFD = splitedline[col++]; } else { dtos.CUOTAFIJAOFD = ""; }
}
else
{
if (col < l) { dtos.CESANTIAPAT = splitedline[col++]; }
if (col < l) { dtos.CESANTIAOBR = splitedline[col++]; }
}
}
empleado.ldtos.Add(dtos);
}
return empleado;
}
}
public class cedulaEBA
{
public cedulaEBA()
{
empleados = new List<cedulaEBAEmpleados>();
}
public string txtTitulo { get; set; }
public string txtTodo { get; set; }
public List<cedulaEBAEmpleados> empleados { get; set; }
}
public class cedulaEBAEmpleados
{
public cedulaEBAEmpleados()
{
ldtos = new List<cedulaEBAEmpleadosdatos>();
}
public string NSS { get; set; }
public string Nombre { get; set; }
public string Curp { get; set; }
public string centrocostos { get; set; }
public List<cedulaEBAEmpleadosdatos> ldtos { get; set; }
}
public class cedulaEBAEmpleadosdatos
{
public string ORIGEN { get; set; }
public string CLAVE { get; set; }
public string FECHA { get; set; }
public string DIAS { get; set; }
public string SALARIO { get; set; }
public string RETIRO { get; set; }
public string SUMARCV { get; set; }
public string APORTACION { get; set; }
public string CUOTAFIJAOFD { get; set; }
public string CUOTAFIJAOFDSTR { get; set; }
public string AMORTIZA { get; set; }
public string SUMAINFONAVIT { get; set; }
public string SUMA { get; set; }
public string CESANTIAPAT { get; set; }
public string CESANTIAOBR { get; set; }
}
public class CedulaSuaPDF
{
public const string validaNSSptt = @"\d{2}-\d{2}-\d{2}-\d{4}-\d"; //^inicia//$termina // Regular expression pattern
public const string ValidateCURPptt = @"[A-Z]{4}\d{6}[HM]{1}[A-Z]{5}[A-Z0-9]{2}";//^inicia//$termina
public const string ValidateFechaptt = @"(0[1-9]|[12][0-9]|3[01])/(0[1-9]|1[0-2])/\d{4}";//dd/MM/yyyy
public const string Validatedigitptt = @"^[0-9\s.,\t]*$";//digitos espacio y punto
public int getindexpatch(string text, string pattern)
{
Match match = Regex.Match(text, pattern);
return match.Success ? match.Index : -1;
}
public string getvaluepatch(string text, string pattern)
{
Match match = Regex.Match(text, pattern);
return match.Success ? match.Value : null;
}
public System.IO.Stream writexls(string dirPDF)
{
cedulaSUA dataEBAPDF = readPDFcedulaSUA(dirPDF);
ClosedXML.Excel.XLWorkbook wb = new ClosedXML.Excel.XLWorkbook();
var libro = wb.AddWorksheet("EBA DATA");
int row = 2;
int column = 1;
libro.Cell(row, column++).Value = "NSS";
libro.Cell(row, column++).Value = "CURP";
libro.Cell(row, column++).Value = "Nombre";
libro.Cell(row, column++).Value = "Ubicación".ToUpper();
libro.Cell(row, column++).Value = "CLAVE";
libro.Cell(row, column++).Value = "FECHA";
libro.Cell(row, column++).Value = "DIAS";
libro.Cell(row, column++).Value = "SALARIO";
if (dataEBAPDF.ContieneLic)
{
libro.Cell(row, column++).Value = "LIC";
}
libro.Cell(row, column++).Value = "INCAPACIDAD";
libro.Cell(row, column++).Value = "AUSENTISMO";
libro.Cell(row, column++).Value = "RETIRO";
libro.Range(1, column, 1, column + 2).Merge().Value = "Cesantía y Vejez".ToUpper();
libro.Cell(row, column++).Value = "PATRONAL";
libro.Cell(row, column++).Value = "OBRERA";
libro.Cell(row, column++).Value = "SUMA";
libro.Cell(row, column++).Value = "Aportación Patronal".ToUpper();
libro.Cell(row, column++).Value = "% o $ o FD";
libro.Cell(row, column++).Value = "% o $ o FD";
libro.Range(row, column - 2, row, column).Value = "% o $ o FD";
libro.Cell(row, column++).Value = "Amortización";
libro.Cell(row, column++).Value = "SUMA";
libro.Cell(row, column++).Value = "Créd. Vivienda".ToUpper();
libro.Cell(row, column++).Value = "Tipo Movto. de Crédito".ToUpper();
libro.Cell(row, column++).Value = "Fecha de Movto. de Crédito".ToUpper();
int maxxolumn = column;
libro.Range(1, 1, row, column - 1).Style.Font.FontColor = ClosedXML.Excel.XLColor.White;
libro.Range(1, 1, row, column - 1).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(79, 129, 189));
row++;
foreach (var empleado in dataEBAPDF.empleados)
{
column = 1;
if (empleado.ldtos.Count > 0)
{
foreach (var data in empleado.ldtos)
{
column = 1;
libro.Cell(row, column++).Value = string.Format("'{0}", empleado.NSS.Trim());
libro.Cell(row, column++).Value = string.Format("{0}", empleado.Curp);
libro.Cell(row, column++).Value = string.Format("{0}", empleado.Nombre);
libro.Cell(row, column++).Value = string.Format("{0}", empleado.centrocostos);
libro.Cell(row, column++).Value = string.Format("'{0}", data.Clave);
libro.Cell(row, column++).Value = string.Format("'{0}", data.Fecha);
libro.Cell(row, column++).Value = string.Format("{0}", data.Dias);
libro.Cell(row, column++).Value = string.Format("{0}", data.SDI);
if (dataEBAPDF.ContieneLic)
{
libro.Cell(row, column++).Value = string.Format("{0}", data.Lic);
}
libro.Cell(row, column++).Value = string.Format("{0}", data.Inc);
libro.Cell(row, column++).Value = string.Format("{0}", data.Aus);
libro.Cell(row, column++).Value = string.Format("{0}", data.Retiro);
libro.Cell(row, column++).Value = string.Format("{0}", data.Patronal);
libro.Cell(row, column++).Value = string.Format("{0}", data.Obrera);
libro.Cell(row, column++).Value = string.Format("{0}", data.Suma);
libro.Cell(row, column++).Value = string.Format("{0}", data.AportacionPatronal);
libro.Cell(row, column++).Value = string.Format("{0}", data.FD);
libro.Cell(row, column++).Value = string.Format("{0}", data.FDimporte);
libro.Cell(row, column++).Value = string.Format("{0}", data.Amortización);
libro.Cell(row, column++).Value = string.Format("{0}", data.SumaB);
libro.Cell(row, column++).Value = string.Format("'{0}", data.CredVivienda);
libro.Cell(row, column++).Value = string.Format("{0}", data.tipodecredito);
libro.Cell(row, column++).Value = string.Format("'{0}", data.fechamovto);
row++;
}
}
else
{
libro.Cell(row, column++).Value = string.Format("'{0}", empleado.NSS.Trim());
libro.Cell(row, column++).Value = string.Format("{0}", empleado.Curp);
libro.Cell(row, column++).Value = string.Format("{0}", empleado.Nombre);
libro.Cell(row, column++).Value = string.Format("{0}", empleado.centrocostos);
row++;
}
}
libro.Range(2, 7, row, dataEBAPDF.ContieneLic ?15:16).Style.Alignment.Horizontal = ClosedXML.Excel.XLAlignmentHorizontalValues.Right;
libro.Range(2, dataEBAPDF.ContieneLic ? 17:18, row, dataEBAPDF.ContieneLic ? 20:21).Style.Alignment.Horizontal = ClosedXML.Excel.XLAlignmentHorizontalValues.Right;
//libro.Range(2, 7, row, 15).Style.NumberFormat.Format = "$ #,##0.00";
//libro.Range(2, 17, row, 20).Style.NumberFormat.Format = "$ #,##0.00";
libro.Columns().AdjustToContents();
libro.Range(2, 1, row, maxxolumn - 1).SetAutoFilter();
//wb.SaveAs(string.Format("{0}xlsx", dirPDF.Substring(0, dirPDF.Length - 3)));
System.IO.Stream fs = new System.IO.MemoryStream();
wb.SaveAs(fs);
return fs;
}
public cedulaSUA readPDFcedulaSUA(string dirPDF)
{
cedulaSUA objSUA = new cedulaSUA();
StringBuilder strb = new StringBuilder();
StringBuilder strtitulo = new StringBuilder();
bool isTitulo = true;
using (iTextSharp.text.pdf.PdfReader readerx = new iTextSharp.text.pdf.PdfReader(dirPDF))
{
for (int page = 1; page <= readerx.NumberOfPages; page++)
{
string text = PdfTextExtractor.GetTextFromPage(readerx, page);
if (!isTitulo)
{
text = text.Replace(strtitulo.ToString(), "");
}
cedulaSUAEmpleados cempleado = null;
string[] lines = text.Split('\n');
int pasoCaptura = 0;
foreach (string line in lines)
{
strb.AppendLine(line);
bool espaso1 = Regex.IsMatch(line, validaNSSptt);
if (!espaso1 && pasoCaptura == 4)
{
procesapaso4(line, cempleado, objSUA.ContieneLic);
}
if (!espaso1 && pasoCaptura == 3)
{
if (Regex.IsMatch(line, ValidateFechaptt) || Regex.IsMatch(line, Validatedigitptt))
{
procesapaso4(line, cempleado, objSUA.ContieneLic);
pasoCaptura = 4;
}
else
{
cempleado.centrocostos = line;
pasoCaptura = 4;
}
}
if (!espaso1 && pasoCaptura == 1)
{
if (Regex.IsMatch(line, ValidateFechaptt) || Regex.IsMatch(line, Validatedigitptt))
{
procesapaso4(line, cempleado, objSUA.ContieneLic);
pasoCaptura = 4;
}
else
{
if (Regex.IsMatch(line, ValidateCURPptt))
{
cempleado.Curp = getvaluepatch(line, ValidateCURPptt);
cempleado.centrocostos = line.Replace(cempleado.Curp, "").Trim();
pasoCaptura = cempleado.centrocostos.Length > 0 ? 4 : 3;
}
else
{
cempleado.centrocostos = line;
pasoCaptura = 4;
}
}
}
if (espaso1)
{
isTitulo = false;
pasoCaptura = 1;
if (null != cempleado)
{
objSUA.empleados.Add(cempleado);
}
cempleado = new cedulaSUAEmpleados();
cempleado.NSS = getvaluepatch(line, validaNSSptt);
string[] linesplited = line.Replace(cempleado.NSS, "").Trim().Split(' ');
if (linesplited.Length > 2)
{
cempleado.Curp = linesplited[linesplited.Length - 1];
}
//cempleado.Curp = getvaluepatch(line, ValidateCURPptt);
string NombreCompleto;
if (cempleado.Curp != null)
{
cempleado.Nombre = line.Replace(cempleado.NSS, "").Replace(cempleado.Curp, "").Trim();
//cempleado.Nombre = line.Substring(getindexpatch(line, validaNSSptt) + 15).Substring(0, getindexpatch(line, ValidateCURPptt) - 18).Trim();
//cempleado.centrocostos = line.Substring(getindexpatch(line, ValidateCURPptt) + 18);
pasoCaptura = 3;// cempleado.centrocostos.Length > 0 ? 4 : 3;
}
else
{
NombreCompleto = line.Replace(cempleado.NSS, "").Trim();
}
//string[] splitline = line.Split(nss);
}
if (isTitulo)
{
if (line.Contains("Clave Fecha Días SDI ") && line.Contains(" Lic. "))
{
objSUA.ContieneLic = true;
}
strtitulo.AppendLine(line);
}
//Console.WriteLine(line);
}
if (null != cempleado)
{
objSUA.empleados.Add(cempleado);
}
cempleado = null;
strb.AppendLine("/*NEWPAGE*/");
}
}
objSUA.txtTodo = strb.ToString();
return objSUA;
}
public cedulaSUAEmpleados procesapaso4(string line, cedulaSUAEmpleados empleado,bool ContieneLic)
{
if (line.ToUpper().Contains("Página".ToUpper()))
{
}
else
{
bool contienefecha;
if (line.Length > 20)
{
contienefecha = Regex.IsMatch(line.Substring(0, 20), ValidateFechaptt);
}
else
{
contienefecha = Regex.IsMatch(line, ValidateFechaptt);
}
string[] splitedline = line.Split(' ');
int l = splitedline.Length;
bool ismsfsd = (line.ToUpper().Contains("M/S".ToUpper()) && line.ToUpper().Contains("FSD".ToUpper()) && l < 6);
cedulaSUAEmpleadosdatos dtos = null;
cedulaSUAEmpleadosdatos dtosant = null;
if (empleado.ldtos.Count > 0)
{
dtosant = empleado.ldtos[empleado.ldtos.Count - 1];
}
if (dtosant == null || (contienefecha && !(dtosant != null && dtosant.Dias == null)))
{
dtos = new cedulaSUAEmpleadosdatos();
}
else
{
empleado.ldtos.RemoveAt(empleado.ldtos.Count - 1);
dtos = dtosant;
}
int col = 0;
if (contienefecha && col < l) { dtos.Clave = splitedline[col++]; }
if (col < l && splitedline[col] == "") { col++; }
if (contienefecha && col < l) { dtos.Fecha = splitedline[col++]; }
if (dtos.Clave != null && dtos.Clave.Contains("FSD"))
{
dtos.tipodecredito = dtos.Clave;
dtos.Clave = "";
dtos.fechamovto = dtos.Fecha;
dtos.Fecha = "";
}
if (col < l && splitedline[col] == "") { col++; }
if (col < l && !ismsfsd)
{
if (splitedline[col].Length > 8)
{
dtos.tipodecredito = dtos.CredVivienda;
dtos.CredVivienda = splitedline[col++];
}
else
{
dtos.Dias = splitedline[col++];
}
}
if (col < l && !ismsfsd) { dtos.SDI = splitedline[col++]; }
if (col < l && splitedline[col] == "") { col++; }
if(ContieneLic && col < l && !ismsfsd) { dtos.Lic = splitedline[col++]; }
if (col < l && splitedline[col] == "") { col++; }
if (col < l && !ismsfsd) { dtos.Inc = splitedline[col++]; }
if (col < l && splitedline[col] == "") { col++; }
if (col < l && !ismsfsd) { dtos.Aus = splitedline[col++]; }
if (col < l && splitedline[col] == "") { col++; }
if (col < l && !ismsfsd) { dtos.Retiro = splitedline[col++]; }
if (col < l && splitedline[col] == "") { col++; }
if (col < l && !ismsfsd) { dtos.Patronal = splitedline[col++]; }
if (col < l && splitedline[col] == "") { col++; }
if (col < l && !ismsfsd) { dtos.Obrera = splitedline[col++]; }
if (col < l && splitedline[col] == "") { col++; }
if (col < l && !ismsfsd) { dtos.Suma = splitedline[col++]; }
if (col < l && splitedline[col] == "") { col++; }
if (col < l && !ismsfsd) { dtos.AportacionPatronal = splitedline[col++]; }
if (col < l && splitedline[col] == "") { col++; }
if (col < l && !ismsfsd && (col + 3) < l) { dtos.FD = splitedline[col++]; }
if (col < l && splitedline[col] == "") { col++; }
if (col < l && !ismsfsd && (col + 2) < l) { dtos.FDimporte = splitedline[col++]; }
if (col < l && splitedline[col] == "") { col++; }
if (col < l && !ismsfsd) { dtos.Amortización = splitedline[col++]; }
if (col < l && splitedline[col] == "") { col++; }
if (col < l && !ismsfsd) { dtos.SumaB = splitedline[col++]; }
if (col < l && splitedline[col] == "") { col++; }
if (col < l && !ismsfsd) { dtos.CredVivienda = splitedline[col++]; }
if (col < l && splitedline[col] == "") { col++; }
if (col < l) { dtos.tipodecredito = splitedline[col++]; }
if (col < l && splitedline[col] == "") { col++; }
if (col < l) { dtos.fechamovto = splitedline[col++]; }
empleado.ldtos.Add(dtos);
}
return empleado;
}
}
public class cedulaSUA
{
public cedulaSUA()
{
empleados = new List<cedulaSUAEmpleados>();
}
public string txtTitulo { get; set; }
public string txtTodo { get; set; }
public bool ContieneLic { get; set; }
public List<cedulaSUAEmpleados> empleados { get; set; }
}
public class cedulaSUAEmpleados
{
public cedulaSUAEmpleados()
{
ldtos = new List<cedulaSUAEmpleadosdatos>();
}
public string NSS { get; set; }
public string Nombre { get; set; }
public string Curp { get; set; }
public string centrocostos { get; set; }
public List<cedulaSUAEmpleadosdatos> ldtos { get; set; }
}
public class cedulaSUAEmpleadosdatos
{
public string Clave { get; set; }
public string Fecha { get; set; }
public string Dias { get; set; }
public string SDI { get; set; }
public string Lic { get; set; }
public string Inc { get; set; }
public string Aus { get; set; }
public string Retiro { get; set; }
public string Patronal { get; set; }
public string Obrera { get; set; }
public string Suma { get; set; }
public string AportacionPatronal { get; set; }
public string FD { get; set; }
public string FDimporte { get; set; }
public string Amortización { get; set; }
public string SumaB { get; set; }
public string CredVivienda { get; set; }
public string tipodecredito { get; set; }
public string fechamovto { get; set; }
} }
} }

View File

@@ -49,10 +49,19 @@
<li> <li>
<asp:LinkButton ID="ImgImprimirExpediente" Visible="false" runat="server"> <i class="fa fa-file-pdf-o" style=" font-weight: bold;"></i> Expediente de personal</asp:LinkButton> <asp:LinkButton ID="ImgImprimirExpediente" Visible="false" runat="server"> <i class="fa fa-file-pdf-o" style=" font-weight: bold;"></i> Expediente de personal</asp:LinkButton>
</li> </li>
<%-- <asp:UpdatePanel runat="server">
<ContentTemplate>
<li> <li>
<asp:LinkButton ID="LbGafete" runat="server" CssClass=""><i class="fa fa-list-alt"></i> Gafete</asp:LinkButton> <asp:LinkButton ID="LbGafete" runat="server" CssClass=""><i class="fa fa-list-alt"></i> Gafete</asp:LinkButton>
</li> </li>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="LbGafete" />
</Triggers>
</asp:UpdatePanel>--%>
<li> <li>
<asp:LinkButton ID="Lnkopenaddcuentabancaria" OnClick="Lnkopenaddcuentabancaria_Click" Visible="true" runat="server"> <i class="fa fa-plus"></i> Agregar cuenta bancaria</asp:LinkButton> <asp:LinkButton ID="Lnkopenaddcuentabancaria" OnClick="Lnkopenaddcuentabancaria_Click" Visible="true" runat="server"> <i class="fa fa-plus"></i> Agregar cuenta bancaria</asp:LinkButton>
</li> </li>

View File

@@ -10,6 +10,8 @@ Imports Microsoft.Reporting.WebForms
Imports System.Globalization Imports System.Globalization
Imports System.Xml Imports System.Xml
Imports System.Web.Script.Services Imports System.Web.Script.Services
Imports System.Linq
Partial Class RH_Personal Partial Class RH_Personal
Inherits ClsPaginas Inherits ClsPaginas
@@ -3897,40 +3899,95 @@ Partial Class RH_Personal
End If End If
ObjPersonal.Dispose() ObjPersonal.Dispose()
End Sub End Sub
Private Sub LbGafete_Click(sender As Object, e As EventArgs) Handles LbGafete.Click
Dim params As New List(Of ReportParameter)
Dim ObjPersonal As New ClsRH()
If ObjPersonal.GetPersonal(CvePersonal, "-1", "-1", "-1", "-1", -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "-1", -1, -1, -1, -1, -1, -1, "-1", "-1", "-1", "-1", UsuarioActual.CveEmpresa) Then 'Eliminar hasta 15 de septiembre 2023
If ObjPersonal.DtResultados.Rows.Count > 0 Then 'Private Sub LbGafete_Click(sender As Object, e As EventArgs) Handles LbGafete.Click
params.Add(New ReportParameter("Nombre", String.Format("{0} {1} {2}", TxtAPaterno.Text.Trim, TxtAMaterno.Text.Trim, TxtNombres.Text.Trim))) ' Dim PathSource As String = UsuarioActual.Empresa.Ruta & "Formatos\Gafete.docx"
params.Add(New ReportParameter("Vigencia", TxtFechaFinContrato.Text)) ' If File.Exists(PathSource) Then
params.Add(New ReportParameter("Puesto", If(DdlPuesto.SelectedValue.ToEntero() > 0, DdlPuesto.SelectedItem.Text, "")))
params.Add(New ReportParameter("CURP", TxtCURP.Text)) ' Dim PathRoot As String = AppDomain.CurrentDomain.BaseDirectory
params.Add(New ReportParameter("NoRegistro", "")) ' Dim pathDesti As String
params.Add(New ReportParameter("RegIMSS", TxtNumeroSS.Text))
params.Add(New ReportParameter("FechaIngreso", TxtFechaIngreso.Text)) ' PathSource = UsuarioActual.Empresa.Ruta & "Formatos\Gafete.docx"
params.Add(New ReportParameter("DomPart", String.Format("{0} NoExt:{1} NoInt:{2} {3}", TxtCalle.Text, TxtNumExt.Text, TxtNumInt.Text, TxtColonia.Text))) ' pathDesti = PathRoot & "Temp\" & CvePersonal & "Gafete.docx"
params.Add(New ReportParameter("Emergencia", ""))
params.Add(New ReportParameter("CUIP", "")) ' If File.Exists(pathDesti) Then
params.Add(New ReportParameter("TipoSangre", "")) ' File.Delete(pathDesti)
params.Add(New ReportParameter("RFC", TxtRFC.Text)) ' End If
params.Add(New ReportParameter("Denominacion", TxtRFC.Text))
' File.Copy(PathSource, pathDesti)
' Dim objDoc As New clsGemBoxDocument(pathDesti)
' Dim objRH As New ClsRH
' Dim FechaActual As String = Now.Day.ToString("0#") & " de " & CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(1).ToString() & " del " & Now.Year.ToString()
' objDoc.SustituirTags(objRH.GetDatosTagsDocumentos(CvePersonal, UsuarioActual.CveEmpresa))
' objRH.Dispose()
If File.Exists(UsuarioActual.Empresa.Ruta & "RH\Personal\" & ObjPersonal.CvePersonal & ".png") Then ' objDoc.Guardar(pathDesti)
params.Add(New ReportParameter("LogoUri", String.Format("{0}://{1}:{2}/Empresas/{3}/RH/Personal/{4}.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa, ObjPersonal.CvePersonal)))
Else
params.Add(New ReportParameter("LogoUri", ""))
End If
ImprimirPDF("Empresas/Grales/Formatos/RHGafete.rdlc", New DataTable, params, String.Format("Gafete_{0}", ObjPersonal.CvePersonal), "PDF") ' Dim fileinfo As New FileInfo(pathDesti)
End If
End If
ObjPersonal.Dispose() ' If fileinfo.Exists Then
End Sub
' Response.ContentType = "application/docx"
' Response.AppendHeader("Content-Disposition", $"attachment; filename=Gafete_{CvePersonal}.docx")
' Response.TransmitFile(pathDesti)
' Response.End()
' End If
' 'Dim baseUrl As String = Request.Url.GetLeftPart(UriPartial.Authority)
' 'baseUrl = baseUrl & "/temp/" & fileinfo.Name
' 'RegistraDescargaJavaScript(baseUrl)
' Else
' Dim params As New List(Of ReportParameter)
' Dim ObjPersonal As New ClsRH()
' If ObjPersonal.GetPersonal(CvePersonal, "-1", "-1", "-1", "-1", -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "-1", -1, -1, -1, -1, -1, -1, "-1", "-1", "-1", "-1", UsuarioActual.CveEmpresa) Then
' If ObjPersonal.DtResultados.Rows.Count > 0 Then
' params.Add(New ReportParameter("Nombre", String.Format("{0} {1} {2}", TxtAPaterno.Text.Trim, TxtAMaterno.Text.Trim, TxtNombres.Text.Trim)))
' params.Add(New ReportParameter("Vigencia", TxtFechaFinContrato.Text))
' params.Add(New ReportParameter("Puesto", If(DdlPuesto.SelectedValue.ToEntero() > 0, DdlPuesto.SelectedItem.Text, "")))
' params.Add(New ReportParameter("CURP", TxtCURP.Text))
' params.Add(New ReportParameter("NoRegistro", ""))
' params.Add(New ReportParameter("RegIMSS", TxtNumeroSS.Text))
' params.Add(New ReportParameter("FechaIngreso", TxtFechaIngreso.Text))
' params.Add(New ReportParameter("DomPart", String.Format("{0} NoExt:{1} NoInt:{2} {3}", TxtCalle.Text, TxtNumExt.Text, TxtNumInt.Text, TxtColonia.Text)))
' params.Add(New ReportParameter("Emergencia", TxtTelefonoEmergencia.Text))
' params.Add(New ReportParameter("CUIP", ""))
' params.Add(New ReportParameter("TipoSangre", DdlTipoSangre.SelectedItem.Text))
' params.Add(New ReportParameter("RFC", TxtRFC.Text))
' params.Add(New ReportParameter("Denominacion", TxtRFC.Text))
' If File.Exists(UsuarioActual.Empresa.Ruta & "RH\Personal\" & ObjPersonal.CvePersonal & ".png") Then
' params.Add(New ReportParameter("LogoUri", String.Format("{0}://{1}:{2}/Empresas/{3}/RH/Personal/{4}.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa, ObjPersonal.CvePersonal)))
' Else
' params.Add(New ReportParameter("LogoUri", ""))
' End If
' ImprimirPDF("Empresas/Grales/Formatos/RHGafete.rdlc", New DataTable, params, String.Format("Gafete_{0}", ObjPersonal.CvePersonal), "PDF")
' End If
' End If
' ObjPersonal.Dispose()
' End If
'End Sub
Private Sub GenerarPDFGastosXComp(Optional Formato As String = "PDF") Private Sub GenerarPDFGastosXComp(Optional Formato As String = "PDF")
If CvePersonal > 0 Then If CvePersonal > 0 Then
If RBLTipoGastos.SelectedValue = "1" Then If RBLTipoGastos.SelectedValue = "1" Then
@@ -4367,10 +4424,94 @@ Partial Class RH_Personal
objDoc.SustituirTags(objRH.GetDatosTagsDocumentos(CvePersonal, UsuarioActual.CveEmpresa)) objDoc.SustituirTags(objRH.GetDatosTagsDocumentos(CvePersonal, UsuarioActual.CveEmpresa))
objRH.Dispose() objRH.Dispose()
objDoc.Guardar(pathDesti) objDoc.Guardar(pathDesti)
If pathDesti.ToUpper.Contains("GAFETTE") Or pathDesti.ToUpper.Contains("GAFETE") Then
GemBox.Document.ComponentInfo.SetLicense(SerialGemBoxDocument)
Dim document = GemBox.Document.DocumentModel.Load(pathDesti)
Dim imgPersonalURL As String = ""
If File.Exists(UsuarioActual.Empresa.Ruta & "RH\Personal\" & CvePersonal & ".jpg") Then
imgPersonalURL = UsuarioActual.Empresa.Ruta & "RH\Personal\" & CvePersonal & ".jpg"
ElseIf File.Exists(UsuarioActual.Empresa.Ruta & "RH\Personal\" & CvePersonal & ".png") Then
imgPersonalURL = UsuarioActual.Empresa.Ruta & "RH\Personal\" & CvePersonal & ".png"
ElseIf File.Exists(UsuarioActual.Empresa.Ruta & "RH\Personal\" & CvePersonal & ".bmp") Then
imgPersonalURL = UsuarioActual.Empresa.Ruta & "RH\Personal\" & CvePersonal & ".bmp"
ElseIf File.Exists(UsuarioActual.Empresa.Ruta & "RH\Personal\" & CvePersonal & ".jpeg") Then
imgPersonalURL = UsuarioActual.Empresa.Ruta & "RH\Personal\" & CvePersonal & ".jpeg"
End If
'imgPersonalURL = UsuarioActual.Empresa.Ruta & "RH\Personal\" & CvePersonal & ".png"
If imgPersonalURL.Trim.Length = 0 Then
imgPersonalURL = ModExtensiones.DirectorioBaseEmpresas & "\wwwSIG\Imagenes\SinImagenB.jpg"
End If
'Dim document As New GemBox.Document.DocumentModel()
'Dim section As New GemBox.Document.Section(document)
'Dim paragraph As New GemBox.Document.Paragraph(document)
'section.Blocks.Add(paragraph)
'Dim picture1 As New GemBox.Document.Picture(document, imgPersonalURL, 61, 53, GemBox.Document.LengthUnit.Pixel)
'paragraph.Inlines.Add(picture1)
'Dim Zahnrad As String = UsuarioActual.Empresa.Ruta & "RH\Personal\Zahnrad.gif"
'Dim Dices As String = UsuarioActual.Empresa.Ruta & "RH\Personal\Dices.png"
'Dim Graphics1 As String = UsuarioActual.Empresa.Ruta & "RH\Personal\Graphics1.svg"
'Dim section As New GemBox.Document.Section(document)
'document.Sections.Add(section)
'Dim paragraph As New GemBox.Document.Paragraph(document)
'section.Blocks.Add(paragraph)
'Dim picture1 As New GemBox.Document.Picture(document, imgPersonalURL, 61, 53, GemBox.Document.LengthUnit.Pixel)
'paragraph.Inlines.Add(picture1)
' Get the first section and the first paragraph (or create them if necessary)
'**************************************************************
Dim firstSection As GemBox.Document.Section = document.Sections.FirstOrDefault()
If firstSection Is Nothing Then
firstSection = New GemBox.Document.Section(document)
document.Sections.Add(firstSection)
End If
Dim firstParagraph As GemBox.Document.Paragraph = firstSection.Blocks.OfType(Of GemBox.Document.Paragraph)().FirstOrDefault()
If firstParagraph Is Nothing Then
firstParagraph = New GemBox.Document.Paragraph(document)
firstSection.Blocks.Add(firstParagraph)
End If
Dim imageParagraph As New GemBox.Document.Paragraph(document)
Dim picture1 As New GemBox.Document.Picture(document, imgPersonalURL, 83, 100, GemBox.Document.LengthUnit.Pixel)
Dim layout3 As New GemBox.Document.FloatingLayout(
New GemBox.Document.HorizontalPosition(1.79, GemBox.Document.LengthUnit.Inch, GemBox.Document.HorizontalPositionAnchor.LeftMargin),
New GemBox.Document.VerticalPosition(2.55, GemBox.Document.LengthUnit.Inch, GemBox.Document.VerticalPositionAnchor.TopMargin),
picture1.Layout.Size)
'layout3.WrappingStyle = GemBox.Document.TextWrappingStyle.Through
picture1.Layout = layout3
imageParagraph.Inlines.Add(picture1)
firstSection.Blocks.Insert(0, imageParagraph)
document.Sections(0).Blocks.RemoveAt(9)
document.Save(pathDesti)
End If
Dim fileinfo As New FileInfo(pathDesti) Dim fileinfo As New FileInfo(pathDesti)
Dim baseUrl As String = Request.Url.GetLeftPart(UriPartial.Authority) Dim baseUrl As String = Request.Url.GetLeftPart(UriPartial.Authority)