diff --git a/App_Code/ClsNominas.vb b/App_Code/ClsNominas.vb
index 4039d1299..8dc140ab6 100644
--- a/App_Code/ClsNominas.vb
+++ b/App_Code/ClsNominas.vb
@@ -171,6 +171,47 @@ Public Class ClsNominas
#End Region
#Region "ClsNominas_Nominas"
+
+ Public Function NominaUpMetododepago(cveEmpresa As Integer, CvePersonal As Integer, CvePeriodo As Integer, MetodoPagoFijo As Boolean,
+ CveMetodoPago As Integer, CveSATBanco As Integer, BancoNumCuenta As String, CLABE As String) As Boolean
+ Dim retorno As Boolean = False
+ DTSet = New DataSet()
+ DataAdapter("PA_Nom_NominaUpMetododepago", CommandType.StoredProcedure)
+ With SqlAdapter.SelectCommand.Parameters
+ .Add("@CvePersonal", SqlDbType.Int).Value = CvePersonal
+ .Add("@CvePeriodo", SqlDbType.Int).Value = CvePeriodo
+ .Add("@MetodoPagoFijo", SqlDbType.Bit).Value = MetodoPagoFijo
+ .Add("@CveMetodoPago", SqlDbType.Int).Value = CveMetodoPago
+ .Add("@CveSATBanco", SqlDbType.Int).Value = CveSATBanco
+ .Add("@BancoNumCuenta", SqlDbType.VarChar).Value = BancoNumCuenta
+ .Add("@CLABE", SqlDbType.VarChar).Value = CLABE
+ .Add("@CveEmpresa", SqlDbType.Int).Value = cveEmpresa
+ End With
+ Try
+ SqlAdapter.Fill(DTSetResultados)
+ retorno = True
+ Catch ex As Exception
+ OnError("Ocurrió un error al actualizar forma de pago.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
+ End Try
+ Return retorno
+ End Function
+ Public Function PersonalISRAnual(CvePersonal As Integer, cveEmpresa As Integer, Ejercicio As Integer) As Boolean
+ Dim retorno As Boolean = False
+ DTSet = New DataSet()
+ DataAdapter("PA_Nom_PersonalISRAnual", CommandType.StoredProcedure)
+ With SqlAdapter.SelectCommand.Parameters
+ .Add("@CvePersonal", SqlDbType.Int).Value = CvePersonal
+ .Add("@CveEmpresa", SqlDbType.Int).Value = cveEmpresa
+ .Add("@Ejercicio", SqlDbType.Int).Value = Ejercicio
+ End With
+ Try
+ SqlAdapter.Fill(DTSet)
+ retorno = True
+ Catch ex As Exception
+ OnError("Ocurrió un error al eliminar el finiquito.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
+ End Try
+ Return retorno
+ End Function
Public Function RemoveFiniquito(CvePersonal As Integer, cveEmpresa As Integer, CvePersonalAltas As Integer) As Boolean
Dim retorno As Boolean = False
DTSet = New DataSet()
@@ -542,8 +583,13 @@ Public Class ClsNominas
Try
SqlAdapter.Fill(Data)
Retorno = True
- Catch Ex1 As SqlException
- Me.OnError("Ocurrió un error al Guardar el Movimiento de Nomina.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
+ '
+ Catch sqlex As SqlException
+ If sqlex.Message.Contains("x5010") Then
+ Me.OnError("Ocurrió un error al eliminar el Movimiento de Nomina(Timbrada).", sqlex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
+ Else
+ Me.OnError("Ocurrió un error al eliminar el Movimiento de Nomina.", sqlex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
+ End If
End Try
Return Retorno
@@ -786,6 +832,14 @@ Public Class ClsNominas
Try
SqlAdapter.Fill(Data)
Retorno = True
+
+ Catch sqlex As SqlException
+ If sqlex.Message.Contains("Número: 50001x") Then
+ Me.OnError("Ocurrió un error al eliminar el Movimiento de Nomina(Timbrada).", sqlex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
+ Else
+ Me.OnError("Ocurrió un error al eliminar el Movimiento de Nomina.", sqlex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
+
+ End If
Catch ex As Exception
Me.OnError("Ocurrió un error al eliminar el Movimiento de Nomina.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
End Try
@@ -1930,12 +1984,13 @@ Public Class ClsNominas
End Function
#End Region
- Public Function GetFiniquitosPersonal(CvePersonal As Integer, CveEmpresa As Integer, Optional Limpiar As Integer = 0) As Boolean
+ Public Function GetFiniquitosPersonal(CvePersonal As Integer, CveEmpresa As Integer, Optional Limpiar As Integer = 0, Optional diasindemnizacion As Integer = 90) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Nom_FiniquitosGET")
With SqlAdapter.SelectCommand.Parameters
.Add("@CvePersonal", SqlDbType.Int).Value = CvePersonal
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
+ .Add("@diasindemnizacion", SqlDbType.Int).Value = diasindemnizacion
'.Add("@Limpiar", SqlDbType.Int).Value = Limpiar
End With
Try
diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb
index 2f67b4eff..06ea7a8d6 100644
--- a/App_Code/ClsPaginas.vb
+++ b/App_Code/ClsPaginas.vb
@@ -293,28 +293,19 @@ Public Class ClsPaginas
Application("Directorio") = value
End Set
End Property
- Public Shared ReadOnly Property GlobalDTPSATPS(SATClaveProductoServicio As String) As DataTable
+ Property GlobalDTPSATPS() As DataTable
Get
- 'If Application("GlobalDTPSATPS") Is Nothing Then
- ' Dim ObjGrales As New ClsGenerales
- ' If ObjGrales.GetSATProductosServicios Then Application("GlobalDTPSATPS") = ObjGrales.DtResultados.AsEnumerable() Else Application("GlobalDTPSATPS") = Nothing
- ' ObjGrales.Dispose()
- 'End If
-
- 'GlobalDTPSATPS = DirectCast(Application("GlobalDTPSATPS"), EnumerableRowCollection(Of DataRow)).CopyToDataTable
-
- Dim ObjGrales As New ClsGenerales
- If ObjGrales.GetSATProductosServicios(SATClaveProductoServicio) Then
- GlobalDTPSATPS = ObjGrales.DtResultados
- Else
- GlobalDTPSATPS = Nothing
+ If Application("GlobalDTPSATPS") Is Nothing Then
+ Dim ObjGrales As New ClsGenerales
+ If ObjGrales.GetSATProductosServicios Then Application("GlobalDTPSATPS") = ObjGrales.DtResultados.AsEnumerable() Else Application("GlobalDTPSATPS") = Nothing
+ ObjGrales.Dispose()
End If
- ObjGrales.Dispose()
+ GlobalDTPSATPS = DirectCast(Application("GlobalDTPSATPS"), EnumerableRowCollection(Of DataRow)).CopyToDataTable
End Get
- 'Set(value As DataTable)
- ' Application("GlobalDTPSATPS") = value
- 'End Set
+ Set(value As DataTable)
+ Application("GlobalDTPSATPS") = value
+ End Set
End Property
#Region "GLOBALES DE SAT COMERCIO EXTERIOR"
@@ -647,7 +638,7 @@ Public Class ClsPaginas
End Property
- Property GlobalDTClasificaciones(Optional CveEmpresa As Integer = -1, Optional CveCategoria As Integer = -1, Optional UsoClasificacion As Integer = -1, Optional CveClasificacion As Integer = -1, Optional Estatus As Integer = 1) As DataTable
+ Property GlobalDTClasificaciones(Optional CveEmpresa As Integer = -1, Optional CveCategoria As Integer = -1, Optional UsoClasificacion As Integer = -1, Optional CveClasificacion As Integer = -1) As DataTable
Get
Dim AppNombre As String = String.Format("GlobalDTClasificaciones-{0}", CveEmpresa)
'sino existe, recarga los datos
@@ -662,7 +653,6 @@ Public Class ClsPaginas
If CveCategoria <> -1 Then Str.AppendFormat(" AND CveCategoria = {0}", CveCategoria)
If UsoClasificacion <> -1 Then Str.AppendFormat(" AND UsoClasificacion IN ({0},3) ", UsoClasificacion)
If CveClasificacion <> -1 Then Str.AppendFormat(" AND CveClasificacion = {0}", CveClasificacion)
- If Estatus <> -1 Then Str.AppendFormat(" AND Estatus = '{0}'", If(Estatus = 1, "Activo", "Inactivo"))
Dim Dv As New DataView(DirectCast(Application(AppNombre), DataTable), Str.ToString(), "", DataViewRowState.CurrentRows)
GlobalDTClasificaciones = Dv.ToTable
Dv.Dispose()
@@ -3076,6 +3066,8 @@ Public Class ClsPaginas
End Set
End Property
+
+
Property GlobalDTContaConceptosContables(CvePlantillaPoliza As Integer) As DataTable
Get
If CvePlantillaPoliza <> -1 Then
@@ -3848,6 +3840,7 @@ Public Class ClsPaginas
If Application("GlobalSIGAppPaginas") Is Nothing Then
PaginaDict = New System.Collections.Hashtable
+ PaginaDict.Add("/Nomina/ISRCalculoAnual.aspx".ToUpper(), 918)
PaginaDict.Add("/Nomina/Acumulados.aspx".ToUpper(), 916)
PaginaDict.Add("/RH/CalculoSBC.aspx".ToUpper(), 915)
PaginaDict.Add("/Inicio.aspx".ToUpper(), -1)
@@ -4617,7 +4610,6 @@ Public Class ClsPaginas
PaginaDict.Add("/GPS/RepGastos.aspx".ToUpper(), 685)
PaginaDict.Add("/GPS/RecursoConfiableTracking.aspx".ToUpper(), 692)
PaginaDict.Add("/GPS/KimberlyClarkTracking.aspx".ToUpper(), -1)
- PaginaDict.Add("/GPS/RepUnidades.aspx".ToUpper(), 780)
#End Region
'INVENTARIOS
#Region "Inventarios"
@@ -5951,19 +5943,6 @@ Public Class ClsPaginas
Dim TipoDocumentoRef As String = ""
Dim AplicaPagare As String = "1"
- Dim RFCReceptor As String = ""
-
- If String.IsNullOrEmpty(Vta.RFCReceptor) Then
- RFCReceptor = Vta.Cliente.RFC
- If Vta.FacturarSucursal Then
- If Vta.ClienteSucursal IsNot Nothing Then
- RFCReceptor = Vta.ClienteSucursal.RFC
- End If
- End If
- Else
- RFCReceptor = Vta.RFCReceptor
- End If
-
Dim RutaCBB As String = String.Format("{0}CBB\{1}.jpg", Ruta, Vta.SerieFolio)
Dim ImagenCBB As New System.IO.FileInfo(RutaCBB)
Dim ImgCBB As String '= String.Format("{0}://{1}:{2}/Empresas/{3}/CBB/{4}.jpg", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa, Vta.SerieFolio)
@@ -6093,7 +6072,7 @@ Public Class ClsPaginas
'Si no tiene CBB, SE GENERA
If Not ImagenCBB.Exists Then
Dim CBB As New ClbNegBICFDv3_2.ClsNegCBBGenerar()
- CBB.GenerarCBB(UsuarioActual.Empresa.RFC, RFCReceptor, Vta.Total.ToString.ToDecimal, Vta.FolioFiscal, RutaCBB)
+ CBB.GenerarCBB(UsuarioActual.Empresa.RFC, Vta.Cliente.RFC, Vta.Total.ToString.ToDecimal, Vta.FolioFiscal, RutaCBB)
End If
ImgCBB = String.Format("{0}://{1}:{2}/Empresas/{3}/CBB/{4}.jpg", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa, Vta.SerieFolio)
@@ -6108,7 +6087,7 @@ Public Class ClsPaginas
'CLIENTE
params.Add(New CrystalParametro("ClienteCodigo", Vta.Cliente.Codigo))
- params.Add(New CrystalParametro("ClienteNombre", If(Vta.ClienteSucursal.ImprimeNombreSucursal = "True", If(Vta.CveClienteSucursal > 0, Vta.ClienteSucursal.Sucursal, Vta.Cliente.Nombre), If(Vta.AtencionA <> "" AndAlso Vta.TipoDocto.Contiene("Ing", "Rem") AndAlso RFCReceptor = "XAXX010101000", $"{Vta.Cliente.Nombre}({Vta.AtencionA})", Vta.Cliente.Nombre))))
+ params.Add(New CrystalParametro("ClienteNombre", If(Vta.ClienteSucursal.ImprimeNombreSucursal = "True", If(Vta.CveClienteSucursal > 0, Vta.ClienteSucursal.Sucursal, Vta.Cliente.Nombre), If(Vta.AtencionA <> "" AndAlso Vta.TipoDocto.Contiene("Ing", "Rem") AndAlso Vta.Cliente.RFC = "XAXX010101000", $"{Vta.Cliente.Nombre}({Vta.AtencionA})", Vta.Cliente.Nombre))))
params.Add(New CrystalParametro("ClienteDireccion", ClienteDireccion))
params.Add(New CrystalParametro("ClienteLugar", ClienteLugar))
@@ -6140,7 +6119,7 @@ Public Class ClsPaginas
params.Add(New CrystalParametro("SelloSAT", Vta.SelloSAT))
params.Add(New CrystalParametro("QR", ImgCBB))
- params.Add(New CrystalParametro("ClienteRFC", RFCReceptor))
+ params.Add(New CrystalParametro("ClienteRFC", Vta.Cliente.RFC))
params.Add(New CrystalParametro("FormaPago", Vta.FormaPagoText))
params.Add(New CrystalParametro("Moneda", Vta.Moneda))
params.Add(New CrystalParametro("TipoCambio", Vta.TipoCambio.ToString))
@@ -6475,18 +6454,7 @@ Public Class ClsPaginas
Dim NombreArchivoDescarga As String = ""
Dim TipoDocumento As String = ""
Dim TipoDocumentoRef As String = ""
- Dim RFCReceptor As String = ""
- If String.IsNullOrEmpty(Vta.RFCReceptor) Then
- RFCReceptor = Vta.Cliente.RFC
- If Vta.FacturarSucursal Then
- If Vta.ClienteSucursal IsNot Nothing Then
- RFCReceptor = Vta.ClienteSucursal.RFC
- End If
- End If
- Else
- RFCReceptor = Vta.RFCReceptor
- End If
Dim RutaCBB As String = String.Format("{0}CBB\{1}.jpg", Ruta, Vta.SerieFolio)
Dim ImagenCBB As New System.IO.FileInfo(RutaCBB)
@@ -6641,7 +6609,7 @@ Public Class ClsPaginas
'Si no tiene CBB, SE GENERA
If Not ImagenCBB.Exists AndAlso Vta.CveCliente.ToEntero > 0 Then
Dim CBB As New ClbNegBICFDv3_2.ClsNegCBBGenerar()
- CBB.GenerarCBB(UsuarioActual.Empresa.RFC, RFCReceptor, Vta.Total.ToString.ToDecimal, Vta.FolioFiscal, RutaCBB)
+ CBB.GenerarCBB(UsuarioActual.Empresa.RFC, Vta.Cliente.RFC, Vta.Total.ToString.ToDecimal, Vta.FolioFiscal, RutaCBB)
End If
ImgCBB = String.Format("{0}://{1}:{2}/Empresas/{3}/CBB/{4}.jpg", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa, Vta.SerieFolio)
@@ -6662,14 +6630,14 @@ Public Class ClsPaginas
params.Add(New ReportParameter("ClienteNombre", If(Vta.ClienteSucursal.ImprimeNombreSucursal = "True", If(Vta.CveClienteSucursal > 0, Vta.ClienteSucursal.Sucursal, Vta.Cliente.Nombre), If(Vta.AtencionA <> "" AndAlso Vta.TipoDocto.Contiene("Ing", "Rem") AndAlso Vta.Cliente.RFC = "XAXX010101000", $"{Vta.Cliente.Nombre}({Vta.AtencionA})", Vta.Cliente.Nombre))))
params.Add(New ReportParameter("ClienteDireccion", ClienteDireccion))
params.Add(New ReportParameter("ClienteLugar", ClienteLugar))
- params.Add(New ReportParameter("ClienteRFC", RFCReceptor))
+ params.Add(New ReportParameter("ClienteRFC", Vta.Cliente.RFC))
End If
If Vta.CveEmpresaCRM.ToEntero > 0 Then
params.Add(New ReportParameter("ClienteCodigo", Vta.Cliente.Codigo))
params.Add(New ReportParameter("ClienteNombre", Vta.Cliente.Nombre))
params.Add(New ReportParameter("ClienteDireccion", ClienteDireccion))
params.Add(New ReportParameter("ClienteLugar", ClienteLugar))
- params.Add(New ReportParameter("ClienteRFC", RFCReceptor))
+ params.Add(New ReportParameter("ClienteRFC", Vta.Cliente.RFC))
End If
'TOTALES
diff --git a/App_Code/ClsRH.vb b/App_Code/ClsRH.vb
index 196f5f3bf..80494b780 100644
--- a/App_Code/ClsRH.vb
+++ b/App_Code/ClsRH.vb
@@ -5654,7 +5654,7 @@ chkAplicaVacacion As Boolean, chkAplicaIncapacidad As Boolean, chkAplicaRetardo
Return Retorno
End Function
- Public Function SolicitudVacacionesAdd(CvePersonal As Integer, Fecha As Date, FechaFin As Date, Estatus As Integer, CveUsuario As Integer, CveAutoriza As Integer, Folio As Integer, Optional Motivo As String = "", Optional FechaPago As String = "", Optional diasinabiles As Integer = 0, Optional PorcentajePrimaVac As Decimal = -1) As Boolean
+ Public Function SolicitudVacacionesAdd(CvePersonal As Integer, Fecha As Date, FechaFin As Date, Estatus As Integer, CveUsuario As Integer, CveAutoriza As Integer, Folio As Integer, Optional Motivo As String = "", Optional FechaPago As String = "", Optional diasinabiles As Integer = 0, Optional PorcentajePrimaVac As Decimal = -1, Optional CveTipoPago As Integer = 0, Optional diasExtras As Integer = 0) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_RH_SolicitudVacacionesAdd")
@@ -5670,6 +5670,8 @@ chkAplicaVacacion As Boolean, chkAplicaIncapacidad As Boolean, chkAplicaRetardo
.Add("@diasinabiles", SqlDbType.Int).Value = diasinabiles
.Add("@PorcentajePrimaVac", SqlDbType.Money).Value = PorcentajePrimaVac
.Add("@FechaPago", SqlDbType.VarChar).Value = FechaPago
+ .Add("@CveTipoPago", SqlDbType.Int).Value = CveTipoPago
+ .Add("@diasExtras", SqlDbType.Int).Value = diasExtras
'.Add("@Motivo", SqlDbType.VarChar).Value = MotivoFechaPago As String = "", Optional diasinabiles
End With
diff --git a/App_Code/LogicNominas.vb b/App_Code/LogicNominas.vb
index 6ac889921..7e9d8cc88 100644
--- a/App_Code/LogicNominas.vb
+++ b/App_Code/LogicNominas.vb
@@ -137,6 +137,7 @@ Public Class LogicNominas
Dim SDI As Double = 0
Dim SalarioDiarioSS As Double = 0
Dim ClaveEstado As String = ""
+ Dim MetodoPagoFijo As Boolean
Dim ObjIncapacidades As New List(Of CFDINominaIncapacidades)
'Conexiones a la Base de Datos
@@ -152,6 +153,12 @@ Public Class LogicNominas
cfdi.Nomina.UltimoSueldoOrdinario = drow("UltimoSueldoOrdinario").ToString().ToDecimal()
Serie = objNomina.Serie
Folio = objNomina.Folio.ToString()
+
+ MetodoPagoFijo = drow("MetodoPagoFijo").ToString().ToUpper().Contiene("1", "TRUE")
+
+ ClaveBanco = drow("ClaveBanco").ToString()
+ BancoNumCuenta = drow("BancoNumCuenta").ToString()
+
If TimbreIndemnizacion Then
cfdi.Timbrado = drow("SeTimbroFiniquitoVal").ToString().ToEntero() = 1
cfdi.IStimbreFiniquito = True
@@ -180,8 +187,11 @@ Public Class LogicNominas
Puesto = objPersonal.Puesto
CveSATRiesgoPuesto = objPersonal.CveSATRiesgoPuesto.ToString()
TipoPeriodoPago = objPersonal.TipoPeriodoPago
- ClaveBanco = objPersonal.ClaveBanco
- BancoNumCuenta = objPersonal.BancoNumCuenta
+ If Not MetodoPagoFijo Then
+ ClaveBanco = objPersonal.ClaveBanco
+ BancoNumCuenta = objPersonal.BancoNumCuenta
+
+ End If
SDI = objPersonal.SDI
SalarioDiarioSS = objPersonal.SalarioDiarioSS
ClaveEstado = objPersonal.ClaveEstado
@@ -332,7 +342,7 @@ Public Class LogicNominas
'subsidio al empleo
If Row("SATCveConcepto").ToString().ToEntero().ToEntero() = 17 AndAlso Row("Importe").ToString().ToDecimal > 0 Then 'Subsidio
ObjOtrosPagos.Add(New CFDINominaOtrosPagos With {.TipoOtroPago = "002", ' codigo fijo, por ser referente a subsidio al empleo
- .Clave = Row("Codigo").ToString(), .Concepto = Row("Concepto").ToString(), .Importe = Row("Importe").ToString().ToDecimal, .Subsidiocausado = Row("Importe").ToString().ToDecimal().Abs()})
+ .Clave = Row("Codigo").ToString(), .Concepto = Row("Concepto").ToString(), .Importe = Row("Importe").ToString().ToDecimal, .Subsidiocausado = Row("ImporteValor").ToString().ToDecimal().Abs()})
End If
Next
End If
@@ -362,7 +372,7 @@ Public Class LogicNominas
'subsidio al empleo
If Row("SATCveConcepto").ToString().ToEntero().ToEntero() = 17 AndAlso Row("Importe").ToString().ToDecimal > 0 Then 'Subsidio
ObjOtrosPagos.Add(New CFDINominaOtrosPagos With {.TipoOtroPago = "002", ' codigo fijo, por ser referente a subsidio al empleo
- .Clave = Row("Codigo").ToString(), .Concepto = Row("Concepto").ToString(), .Importe = Row("Importe").ToString().ToDecimal(), .Subsidiocausado = Row("Importe").ToString().ToDecimal().Abs()})
+ .Clave = Row("Codigo").ToString(), .Concepto = Row("Concepto").ToString(), .Importe = Row("Importe").ToString().ToDecimal(), .Subsidiocausado = Row("ImporteValor").ToString().ToDecimal().Abs()})
End If
Next
End If
@@ -376,7 +386,7 @@ Public Class LogicNominas
If Row("CveSATConcepto").ToString() = "" Then cfdi.AddMsg(String.Format("Concepto No registrado ({0})", Row("Concepto").ToString())) : Exit For
Dim otrp = New CFDINominaOtrosPagos With {.TipoOtroPago = Row("SATCveConcepto").ToString(), .Clave = Row("Codigo").ToString(), .Concepto = Row("Concepto").ToString(),
- .Importe = Row("Importe").ToString().ToDecimal().Abs(), .Subsidiocausado = Row("Importe").ToString().ToDecimal().Abs()}
+ .Importe = Row("Importe").ToString().ToDecimal().Abs(), .Subsidiocausado = Row("ImporteValor").ToString().ToDecimal().Abs()}
If Row("SATCveConcepto").ToString().ToEntero() = 4 Then
otrp.ejercicio = DateTime.Now.Year - 1
otrp.SaldoAFavor = Row("ImporteValor").ToString().ToDecimal().Abs()
diff --git a/Bin/ClosedXML.dll b/Bin/ClosedXML.dll
index 4065a321f..0bdfccd36 100644
Binary files a/Bin/ClosedXML.dll and b/Bin/ClosedXML.dll differ
diff --git a/Bin/DocumentFormat.OpenXml.dll b/Bin/DocumentFormat.OpenXml.dll
index 1698758e5..7978b0462 100644
Binary files a/Bin/DocumentFormat.OpenXml.dll and b/Bin/DocumentFormat.OpenXml.dll differ
diff --git a/Bin/Microsoft.Owin.Security.OAuth.dll b/Bin/Microsoft.Owin.Security.OAuth.dll
index 8f95e3053..650eb379b 100644
Binary files a/Bin/Microsoft.Owin.Security.OAuth.dll and b/Bin/Microsoft.Owin.Security.OAuth.dll differ
diff --git a/Bin/Microsoft.Owin.Security.dll b/Bin/Microsoft.Owin.Security.dll
index e162f2d25..3bf4f0a88 100644
Binary files a/Bin/Microsoft.Owin.Security.dll and b/Bin/Microsoft.Owin.Security.dll differ
diff --git a/Bin/Microsoft.Owin.dll b/Bin/Microsoft.Owin.dll
index 3b7a0ffe8..0e19530d5 100644
Binary files a/Bin/Microsoft.Owin.dll and b/Bin/Microsoft.Owin.dll differ
diff --git a/Bin/WebGrease.dll b/Bin/WebGrease.dll
index 1d308f8ed..a6a80d37f 100644
Binary files a/Bin/WebGrease.dll and b/Bin/WebGrease.dll differ
diff --git a/Contabilidad2/CatCuentasAsignaciones.aspx.vb b/Contabilidad2/CatCuentasAsignaciones.aspx.vb
index 886765323..3202ecc39 100644
--- a/Contabilidad2/CatCuentasAsignaciones.aspx.vb
+++ b/Contabilidad2/CatCuentasAsignaciones.aspx.vb
@@ -165,13 +165,13 @@ Partial Class Contabilidad2_CatCuentasAsignaciones
If LbAgregar.Text = "Agregar" Then
If Not ObjConta.AddCuentasAsignaciones(DdlCconceptosContables.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, DdlCuenta.SelectedValue.ToEntero, TxtIdCuentaContable.Text.ToEntero,
DdlProveedor.SelectedValue.ToEntero, DdlClientes.SelectedValue.ToEntero, DdlPersonal.SelectedValue.ToEntero,
- DdlClasificacion.SelectedValue.ToEntero, DdlAlmacen.SelectedValue.ToEntero, TxtPorcentajeIVA.Text.ToDecimal, CveBancoCuenta:=DdlCuentaBancaria.SelectedValue.ToEntero) Then
+ DdlClasificacion.SelectedValue.ToEntero, DdlAlmacen.SelectedValue.ToEntero, TxtPorcentajeIVA.Text.ToDecimal, CveBancoCuenta:=DdlCuentaBancaria.SelectedValue.ToEntero(), CveConceptoNomina:=DdlConceptoNomina.SelectedValue.ToEntero()) Then
ErrorString = "Error al agregar"
End If
ElseIf LbAgregar.Text = "Actualizar" Then
If Not ObjConta.UpdateCuentasAsignaciones(CveConceptoAsignacion, DdlCconceptosContables.SelectedValue.ToEntero, DdlCuenta.SelectedValue.ToEntero, TxtIdCuentaContable.Text.ToEntero,
DdlProveedor.SelectedValue.ToEntero, DdlClientes.SelectedValue.ToEntero, DdlPersonal.SelectedValue.ToEntero,
- DdlClasificacion.SelectedValue.ToEntero, DdlAlmacen.SelectedValue.ToEntero, TxtPorcentajeIVA.Text.ToDecimal, CveBancoCuenta:=DdlCuentaBancaria.SelectedValue.ToEntero) Then
+ DdlClasificacion.SelectedValue.ToEntero, DdlAlmacen.SelectedValue.ToEntero, TxtPorcentajeIVA.Text.ToDecimal, CveBancoCuenta:=DdlCuentaBancaria.SelectedValue.ToEntero(), CveConceptoNomina:=DdlConceptoNomina.SelectedValue.ToEntero()) Then
ErrorString = "Error al actualizar"
End If
End If
diff --git a/Nomina/ConceptoNomina.aspx b/Nomina/ConceptoNomina.aspx
index f691d8511..5e4827a94 100644
--- a/Nomina/ConceptoNomina.aspx
+++ b/Nomina/ConceptoNomina.aspx
@@ -203,7 +203,7 @@
diff --git a/Nomina/ConceptoNomina.aspx.cs b/Nomina/ConceptoNomina.aspx.cs
index 2c9f70bee..b798fb34e 100644
--- a/Nomina/ConceptoNomina.aspx.cs
+++ b/Nomina/ConceptoNomina.aspx.cs
@@ -271,6 +271,21 @@ public partial class Nomina_CatConcepto : ClsPaginas
DdlCtaContable.Items.Insert(0, new ListItem("Seleccione", "-1"));
DdlCtaContable.SelectedValueExist("-1");
}
+ else
+ {
+
+ using (ClsContabilidad ObjConta = new ClsContabilidad())
+ {
+ if (ObjConta.GetCuentas(-1, "-1", -1, UsuarioActual.CveEmpresa))
+ {
+
+ DdlCtaContable.DataSource = ObjConta.DtResultados;
+ DdlCtaContable.DataBind();
+ }
+ }
+ DdlCtaContable.Items.Insert(0, new ListItem("Seleccione", "-1"));
+ DdlCtaContable.SelectedValueExist("-1");
+ }
}
@@ -453,7 +468,14 @@ public partial class Nomina_CatConcepto : ClsPaginas
DdlClasificacion.SelectedValueExist(drow["CveClasificacion"]);
DdlTipoGasto.SelectedValueExist(drow["CveTipoGasto"]);
- DdlCtaContable.SelectedValueExist(drow["IdCtaContable"]);
+ DdlCtaContable.SelectedValueExist(drow["CveCuenta"]);
+ //if (UsuarioActual.Empresa.TipoContabilidad == 1)
+ //{
+ //}
+ //else
+ //{
+ // DdlCtaContable.SelectedValueExist(drow["IdCtaContable"]);
+ //}
DdlConceptoSAT.SelectedValueExist(drow["CveSATConcepto"]);
}
ObjNomina.Dispose();
diff --git a/Nomina/Finiquito.aspx b/Nomina/Finiquito.aspx
index 8aff005bd..0d915c274 100644
--- a/Nomina/Finiquito.aspx
+++ b/Nomina/Finiquito.aspx
@@ -242,6 +242,13 @@
Indemnización
+
+
Separación unica
diff --git a/Nomina/Finiquito.aspx.cs b/Nomina/Finiquito.aspx.cs
index 3596e07ff..5b28459b6 100644
--- a/Nomina/Finiquito.aspx.cs
+++ b/Nomina/Finiquito.aspx.cs
@@ -1062,16 +1062,15 @@ public partial class Nomina_Finiquito : ClsPaginas
using (ClsRH ObjPersonal = new ClsRH())
using (ClsNominas onom = new ClsNominas(ObjPersonal.IniciaTransacSQL()))
{
- if (ObjPersonal.UpPersonalAltas(CvePersonal, "", TxtFechaBaja.Text.ToDateTime().ToString("yyyy/MM/dd"), -1, DdlMotivoBaja.SelectedValue.ToEntero(), ChkesLiquidacion.Checked,chkIndemnizacion.Checked ,chkSeparacionUnica.Checked, chkPrimaantiguedad.Checked) && ObjPersonal.GetPersonalAltas(CvePersonal) && ObjPersonal.DtResultados.Rows.Count > 0)
+ if (continuar =ObjPersonal.UpPersonalAltas(CvePersonal, "", TxtFechaBaja.Text.ToDateTime().ToString("yyyy/MM/dd"), -1, DdlMotivoBaja.SelectedValue.ToEntero(), ChkesLiquidacion.Checked,chkIndemnizacion.Checked ,chkSeparacionUnica.Checked, chkPrimaantiguedad.Checked) && ObjPersonal.GetPersonalAltas(CvePersonal) && ObjPersonal.DtResultados.Rows.Count > 0)
{
DataRow da = ObjPersonal.DtResultados.Rows[0];
CvePeriodoIndemnizacion = da["CvePeriodoIndemnizacion"].ToString().ToEntero();
- CvePeriodoFiniquito = da["CvePeriodoFiniquito"].ToString().ToEntero();
- continuar = onom.GetFiniquitosPersonal(CvePersonal, UsuarioActual.CveEmpresa);
+ CvePeriodoFiniquito = da["CvePeriodoFiniquito"].ToString().ToEntero();
}
if (continuar)
{
- continuar = onom.GetFiniquitosPersonal(CvePersonal, UsuarioActual.CveEmpresa);
+ continuar = onom.GetFiniquitosPersonal(CvePersonal, UsuarioActual.CveEmpresa,diasindemnizacion:Txtdiasindemnizacion.Text.ToEntero());
}
if (continuar)
{
@@ -1311,16 +1310,15 @@ public partial class Nomina_Finiquito : ClsPaginas
using (ClsRH ObjPersonal = new ClsRH())
using (ClsNominas onom = new ClsNominas(ObjPersonal.IniciaTransacSQL()))
{
- if (ObjPersonal.UpPersonalAltas(CvePersonal, "", TxtFechaBaja.Text.ToDateTime().ToString("yyyy/MM/dd"), -1, DdlMotivoBaja.SelectedValue.ToEntero(), ChkesLiquidacion.Checked, chkIndemnizacion.Checked, chkSeparacionUnica.Checked, chkPrimaantiguedad.Checked) && ObjPersonal.GetPersonalAltas(CvePersonal) && ObjPersonal.DtResultados.Rows.Count > 0)
+ if (continuar =ObjPersonal.UpPersonalAltas(CvePersonal, "", TxtFechaBaja.Text.ToDateTime().ToString("yyyy/MM/dd"), -1, DdlMotivoBaja.SelectedValue.ToEntero(), ChkesLiquidacion.Checked, chkIndemnizacion.Checked, chkSeparacionUnica.Checked, chkPrimaantiguedad.Checked) && ObjPersonal.GetPersonalAltas(CvePersonal) && ObjPersonal.DtResultados.Rows.Count > 0)
{
DataRow da = ObjPersonal.DtResultados.Rows[0];
CvePeriodoIndemnizacion = da["CvePeriodoIndemnizacion"].ToString().ToEntero();
CvePeriodoFiniquito = da["CvePeriodoFiniquito"].ToString().ToEntero();
- continuar = onom.GetFiniquitosPersonal(CvePersonal, UsuarioActual.CveEmpresa);
}
if (continuar)
{
- continuar = onom.GetFiniquitosPersonal(CvePersonal, UsuarioActual.CveEmpresa);
+ continuar = onom.GetFiniquitosPersonal(CvePersonal, UsuarioActual.CveEmpresa, diasindemnizacion: Txtdiasindemnizacion.Text.ToEntero());
}
if (continuar)
{ loadsobrerecibo(onom); }
diff --git a/Nomina/ISRCalculoAnual.aspx b/Nomina/ISRCalculoAnual.aspx
new file mode 100644
index 000000000..6de631038
--- /dev/null
+++ b/Nomina/ISRCalculoAnual.aspx
@@ -0,0 +1,128 @@
+<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="ISRCalculoAnual.aspx.cs" Inherits="Nomina_ISCalculoAnual" %>
+
+
+
+
+
+
+ Calculo anual de ISR
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Nomina/ISRCalculoAnual.aspx.cs b/Nomina/ISRCalculoAnual.aspx.cs
new file mode 100644
index 000000000..f6528e3b0
--- /dev/null
+++ b/Nomina/ISRCalculoAnual.aspx.cs
@@ -0,0 +1,47 @@
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Web;
+using System.Web.UI;
+using System.Web.UI.WebControls;
+using Extensiones;
+
+public partial class Nomina_ISCalculoAnual : ClsPaginas
+{
+ protected void Page_Load(object sender, EventArgs e)
+ {
+
+ DataTable dtejercicio = new DataTable();
+ using (ClsNominas objnom = new ClsNominas())
+ {
+ if (objnom.GetEjercicios(UsuarioActual.CveEmpresa))
+ {
+ dtejercicio = objnom.DtResultados;
+ }
+ }
+ DdlEjercicios.DataSource = dtejercicio;
+ DdlEjercicios.DataBind();
+ }
+
+ protected void LnkConsultar_Click(object sender, EventArgs e)
+ {
+ CargaPersonalISRAnual();
+ }
+
+ protected void CargaPersonalISRAnual()
+ {
+ DataTable dtdatos = new DataTable();
+ int ejercicio = DdlEjercicios.SelectedValue.ToEntero();
+ using (ClsNominas objnom = new ClsNominas())
+ {
+ if (objnom.PersonalISRAnual(-1, UsuarioActual.CveEmpresa, ejercicio))
+ {
+ dtdatos = objnom.DTSetResultados.Tables[0];
+ }
+ }
+ GVPersonalISRAnual.DataSource = dtdatos;
+ GVPersonalISRAnual.DataBind();
+ upDatosPers.Update();
+ }
+}
\ No newline at end of file
diff --git a/Nomina/Nomina.aspx b/Nomina/Nomina.aspx
index bb73f7840..c04e8e10c 100644
--- a/Nomina/Nomina.aspx
+++ b/Nomina/Nomina.aspx
@@ -1,103 +1,309 @@
-<%@ Page Title="Nómina - Nómina" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="Nomina.aspx.vb" Inherits="Nomina_Nomina" %>
+<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="Nomina.aspx.cs" Inherits="Nomina_Nomina2" %>
-
-
+
-
- <%-- Nómina --%>
+
+ Nominas
+
+
+
+
+
+
+ Autorizar
+
+
+ Registrar provisión
+
+
+ Layout banco
+
+
+ Ver provisión
+
+
+ Ver provisión Asimilados
+
+
+ Timbrar todos
+
+
+ Incidencias asistencia
+
+
+ Reporte percepciones y deducciones
+
+
+ Reporte acumulados
+
+
+ Empleado concepto
+
+
+ Carga masiva de asistencia
+
+
+ Lista de raya
+
+
+ Cargar masiva de conceptos
+
+
+ Tablas de cálculo
+
+
+ Cálculo ISR
+
+
+ Ir a asistencia
+
+
+ Nómina tabular
+
+
+ Simulador
+
+
+ Procesar archivo SUA
+
+
+ Descargar archivos SUA
+
+
+ Recibos timbrados
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
-
Ejercicio:
-
-
-
Tipo Período:
-
-
-
Período:
-
-
Agrupador:
+
Ejercicio:
+
+
Tipo Período:
+
+
+
Período:
+
+
+
+ <%--
--%>
+ <%--
--%>
+
+
+
+
+
Recibos
+
+
-
+
-
Proyecto:
-
-
+ Agrupador:
+
+
+
-
- SubProyecto:
+
- Turno:
+ Turno:
-
-
Fecha Pago:
+
+
+
-
-
+
-
-
-
-
- Nombre
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
+
+
+
-
-
-
-
-
+
+
+
+
+
+
+
+
+ Nombre
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Asistencia
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
No. trabajador
+
+
Días trabajados
+
+
+
+
Salario diario
+
+
Salario Diario Integrado
+
+
+
+
Salario base cotización
+
+
+
+
+
+
Puesto
+
+
Departamento
+
+
+
+
Afi IMSS
+
+
Faltas
+
+
+
+
R.F.C.
+
+
Retardos
+
+
+
+
Curp
+
+
Días Vacaciones
+
+
+
+
Tipo de Pago
+
+
Días Incapacidad
+
+
+
+
Fecha de Pago
+
+
Periodo del
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Sobre Recibo
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Movimientos
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Vacaciones registradas.
+
+
+
+
+
+
+
+
+
+
+
+
+ <%-- --%>
+
+ <%-- --%>
+
+
+
+
+
+
+
+
+
+ <%--
+
+
+
+ --%>
+ <%----%>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Incapacidades registradas.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <%# Eval("DiasAutorizados")%>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ captura de incapacidad
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Forma de pago
+
+
+
+
+
+
+ ¿forma de pago fija?
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <%-- --%>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <%-- --%>
+ <%# string.Format("{1} {2} ",Eval("CvePersonal"),Eval("Codigo"), Eval("Nombre"))%>
+
+
+
+
+ Base
+
+ gravada
+
+
+
+
+
+
+
+ Limite
+ inferior
+
+
+
+
+
+
+
+ Excedente
+ Limite I.
+
+
+
+
+
+
+
+ % sobre
+
+ excedente
+
+
+
+
+
+
+
+ Impuesto
+ marginal
+
+
+
+
+
+
+
+ Cuota
+ fija
+
+
+
+
+
+
+
+ Impuesto antes
+ de subsidio
+
+
+
+
+
+
+
+
+
+
+
+
+ Impuesto a
+ cargo o a favor
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Paso 1: Descargar Plantilla
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <%-- -recuerda Solo editar de las tercer fila en adelante.
+ -No se debe editar el nombre de la hoja 'Nomina'.
+ -la columna para referenciar al emplado es la primer columna 'Codigo', la columna empleado es solo es informativa.
+ -si desea agregar un empleado que no se encuentre en la lista solo debe de ingresar fila y el codigo del empleado.
+ -si no desea insertar un concepto puede borrar la columna.
+ -no se debe borrar la columna codigo.
--%>
+
+
+
+
+
+ Paso 2: cargar plantilla
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Sobre Recibo
+
+
+
+
+
+
+
+
+
+ <%--
--%>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <%--
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ --%>
+
+
+
+
+ <%--
+ TOTAL
+ 0.00
+ TOTAL
+ 0.00
+
+ --%>
+
+
+
+ Neto a pagar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Paso 1: Cargar Archivo
+
+
+
+
+
+
+
+
+
+
Paso 2:Resultado (Periodo :
+ )
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ,
+
+
+
+
+
+
+
+
+
+ <%--
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ --%>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
diff --git a/Nomina/Nomina.aspx.cs b/Nomina/Nomina.aspx.cs
new file mode 100644
index 000000000..60b362b2b
--- /dev/null
+++ b/Nomina/Nomina.aspx.cs
@@ -0,0 +1,6570 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+using System.Web.UI;
+using System.Web.UI.WebControls;
+using Extensiones;
+using System.Data;
+using System.Text;
+using static Extensiones.ModExtensiones;
+using System.Drawing;
+using iTextSharp.text.pdf;
+using System.IO;
+using System.Data.SqlClient;
+using System.Configuration;
+
+public partial class Nomina_Nomina2 : ClsPaginas
+{
+ #region Propiedades
+ private int FilaConceptos
+ {
+ get { return 5; }
+ }
+
+ private DataTable dtPeriodos
+ {
+ get
+ {
+ if (ViewState["dtPeriodos"] == null) { return null; }
+ else { return (DataTable)ViewState["dtPeriodos"]; }
+ }
+
+ set { ViewState["dtPeriodos"] = value; }
+ }
+ private DataTable dtConceptos
+ {
+ get
+ {
+ if (ViewState["dtConceptos"] == null) { return null; }
+ else { return (DataTable)ViewState["dtConceptos"]; }
+ }
+
+ set { ViewState["dtConceptos"] = value; }
+ }
+
+ private DataTable dtempleadosConceptos
+ {
+ get
+ {
+ if (ViewState["dtempleadosConceptos"] == null) { return null; }
+ else { return (DataTable)ViewState["dtempleadosConceptos"]; }
+ }
+
+ set { ViewState["dtempleadosConceptos"] = value; }
+ }
+ private DataTable dtempleados
+ {
+ get
+ {
+ if (ViewState["dtempleados"] == null) { return null; }
+ else { return (DataTable)ViewState["dtempleados"]; }
+ }
+
+ set { ViewState["dtempleados"] = value; }
+ }
+ private DataTable DtSuaProcesado
+ {
+ get
+ {
+ if (ViewState["dtempleados"] == null) { return null; }
+ else { return (DataTable)ViewState["dtempleados"]; }
+ }
+
+ set { ViewState["dtempleados"] = value; }
+ }
+
+ protected bool PermisoCancelarEmitido
+ {
+ get
+ {
+ if (ViewState["PermisoCancelarEmitido"] == null) { return false; }
+ else { return (bool)ViewState["PermisoCancelarEmitido"]; }
+ }
+
+ set { ViewState["PermisoCancelarEmitido"] = value; }
+ }
+ protected bool PermisoAutorizar
+ {
+ get
+ {
+ if (ViewState["PermisoAutorizar"] == null) { return false; }
+ else { return (bool)ViewState["PermisoAutorizar"]; }
+ }
+
+ set { ViewState["PermisoAutorizar"] = value; }
+ }
+ protected bool PermisoEmitir
+ {
+ get
+ {
+ if (ViewState["PermisoEmitir"] == null) { return false; }
+ else { return (bool)ViewState["PermisoEmitir"]; }
+ }
+
+ set { ViewState["PermisoEmitir"] = value; }
+ }
+ protected int CvePeriodoSeleccionado
+ {
+ get
+ {
+ if (ViewState["CvePeriodoSeleccionado"] == null) { return 0; }
+ else { return ViewState["CvePeriodoSeleccionado"].ToString().ToEntero(); }
+ }
+
+ set { ViewState["CvePeriodoSeleccionado"] = value; }
+ }
+
+ protected int CcveMovtoPermanente
+ {
+ get
+ {
+ if (ViewState["CcveMovtoPermanente"] == null) { return 0; }
+ else { return ViewState["CcveMovtoPermanente"].ToString().ToEntero(); }
+ }
+
+ set { ViewState["CcveMovtoPermanente"] = value; }
+ }
+
+ protected int FiltCveProyecto
+ {
+ get
+ {
+ if (ViewState["FiltCveProyecto"] == null) { return 0; }
+ else { return ViewState["FiltCveProyecto"].ToString().ToEntero(); }
+ }
+
+ set { ViewState["FiltCveProyecto"] = value; }
+ }
+ protected int FiltCveSubProyecto
+ {
+ get
+ {
+ if (ViewState["FiltCveSubProyecto"] == null) { return 0; }
+ else { return ViewState["FiltCveSubProyecto"].ToString().ToEntero(); }
+ }
+
+ set { ViewState["FiltCveSubProyecto"] = value; }
+ }
+ protected int FiltCveTurno
+ {
+ get
+ {
+ if (ViewState["FiltCveTurno"] == null) { return 0; }
+ else { return ViewState["FiltCveTurno"].ToString().ToEntero(); }
+ }
+
+ set { ViewState["FiltCveTurno"] = value; }
+ }
+ protected int FiltCvePeriodo
+ {
+ get
+ {
+ if (ViewState["FiltCvePeriodo"] == null) { return 0; }
+ else { return ViewState["FiltCvePeriodo"].ToString().ToEntero(); }
+ }
+
+ set { ViewState["FiltCvePeriodo"] = value; }
+ }
+ protected int FiltAgrupador
+ {
+ get
+ {
+ if (ViewState["FiltAgrupador"] == null) { return 0; }
+ else { return ViewState["FiltAgrupador"].ToString().ToEntero(); }
+ }
+
+ set { ViewState["FiltAgrupador"] = value; }
+ }
+ #endregion
+ protected void Page_Load(object sender, EventArgs e)
+ {
+ if (!IsPostBack)
+ {
+ LnkVerCalculoISR.Visible = (UsuarioActual.CveUsuario == 100);
+ TxtPeriodo.Text = $"{DateTime.Now:yyyyMM}";
+ CargarCentrosDeCosto(DdlProyecto, DdlSubProyecto, LblProyecto, LblSubProyeccto);
+ cargaEjercicios();
+ CargaTiposPeriodo();
+ cargaPeriodos();
+ DdlTurno.DataSource = GlobalDTTurno.FiltraParametros($"CveEmpresa = { UsuarioActual.CveEmpresa}");
+ DdlTurno.DataBind();
+
+ DdlMetodoPago.DataSource = GlobalDTMetodosPago;
+ DdlMetodoPago.DataBind();
+
+ DdlBanco.DataSource = GlobalDTNomSatBancos;
+ DdlBanco.DataBind();
+ //Permisos
+ if (UsuarioActual.TienePermisoProceso(82))
+ {
+ PermisoAutorizar = true;
+ }
+ else
+ {
+ PermisoAutorizar = false;
+ }
+ if (UsuarioActual.TienePermisoProceso(83))
+ {
+ PermisoEmitir = true;
+ PermisoCancelarEmitido = true;
+ }
+ else
+ {
+ PermisoEmitir = false;
+ PermisoCancelarEmitido = false;
+ }
+ DataTable dtperinc = null;
+ using (ClsNominas onom = new ClsNominas())
+ {
+ if (onom.PersonalIncapacidadCatalogos())
+ {
+ dtperinc = onom.DtResultados;
+ }
+ }
+ if (dtperinc != null)
+ {
+ DdlSRINCcveTipodeIncidencia.DataSource = dtperinc.FiltraParametros("Tipo = -1 OR Tipo =1 ");
+ DdlSRINCcveRamoSeguro.DataSource = dtperinc.FiltraParametros("Tipo = -1 OR Tipo =2 ");
+ DdlSRINCcveTipoRiesgo.DataSource = dtperinc.FiltraParametros("Tipo = -1 OR Tipo =3 ");
+ DdlSRINCcveSecuelaConsecuencia.DataSource = dtperinc.FiltraParametros("Tipo = -1 OR Tipo =4 ");
+ DdlSRINCcveControlIncapacidad.DataSource = dtperinc.FiltraParametros("Tipo = -1 OR Tipo =5 ");
+
+ DdlSRINCcveTipodeIncidencia.DataBind();
+ DdlSRINCcveRamoSeguro.DataBind();
+ DdlSRINCcveTipoRiesgo.DataBind();
+ DdlSRINCcveSecuelaConsecuencia.DataBind();
+ DdlSRINCcveControlIncapacidad.DataBind();
+ }
+ }
+ if (GvVacaciones.Rows.Count > 0)
+ {
+ foreach (GridViewRow item in GvVacaciones.Rows)
+ {
+ LinkButton lnkDescargaFormato = item.FCLinkButton("ImgDescargaFormato");
+ LinkButton lnkDescargaAutorizacion = item.FCLinkButton("ImgDescargaAutorizacion");
+ if (lnkDescargaAutorizacion != null && lnkDescargaAutorizacion.Visible) { ScriptManager.GetCurrent(this).RegisterPostBackControl(lnkDescargaAutorizacion); }
+ if (lnkDescargaFormato != null && lnkDescargaFormato.Visible) { ScriptManager.GetCurrent(this).RegisterPostBackControl(lnkDescargaFormato); }
+ }
+ }
+ }
+ #region Filtros
+ private void cargaEjercicios()
+ {
+ int EjercicioActual = UsuarioActual.Empresa.EjercicioActual;
+ if (EjercicioActual == 0)
+ {
+ EjercicioActual = DateTime.Now.Year;
+ }
+ DataTable dtejercicio = null;
+ using (ClsNominas objnom = new ClsNominas())
+ {
+ if (objnom.GetEjercicios(UsuarioActual.CveEmpresa))
+ {
+ dtejercicio = objnom.DtResultados;
+ }
+ }
+ DdlEjercicios.DataSource = dtejercicio;
+ DdlEjerciciosCM.DataSource = dtejercicio;
+ DdlEjercicios.DataBind();
+ DdlEjerciciosCM.DataBind();
+ ListItem litem = null;
+ if ((dtejercicio != null) && dtejercicio.Rows.Count > 0)
+ {
+ if (dtejercicio.COUNT("Ejercicio", string.Format("Ejercicio={0}", EjercicioActual)) == 0)
+ {
+ litem = new ListItem(EjercicioActual.ToString(), EjercicioActual.ToString());
+ DdlEjercicios.Items.Insert(0, litem);
+ DdlEjerciciosCM.Items.Insert(0, litem);
+ }
+ if (dtejercicio.COUNT("Ejercicio", string.Format("Ejercicio={0}", (EjercicioActual - 1))) == 0)
+ {
+ litem = new ListItem((EjercicioActual - 1).ToString(), (EjercicioActual - 1).ToString());
+ DdlEjercicios.Items.Insert(1, litem);
+ DdlEjerciciosCM.Items.Insert(1, litem);
+ }
+ }
+ else
+ {
+ litem = new ListItem(EjercicioActual.ToString(), EjercicioActual.ToString());
+ DdlEjercicios.Items.Insert(0, litem);
+ DdlEjerciciosCM.Items.Insert(0, litem);
+ litem = new ListItem((EjercicioActual - 1).ToString(), (EjercicioActual - 1).ToString());
+ DdlEjercicios.Items.Insert(0, litem);
+ DdlEjerciciosCM.Items.Insert(0, litem);
+
+ }
+ if (DdlEjercicios.Items.Count > 0)
+ {
+ DdlEjercicios.SelectedIndex = 0;
+ }
+ DdlEjercicios.SelectedValueExist(DateTime.Now.Year.ToString());
+ }
+ private void CargaTiposPeriodo()
+ {
+ DdlTipoPeriodo.DataSource = GlobalDTTipoPeriodo.FiltraParametros("Estatus = 'Activo'");
+ DdlTipoPeriodoCM.DataSource = DdlTipoPeriodo.DataSource;
+ DdlTipoPeriodoSim.DataSource = DdlTipoPeriodo.DataSource;
+ DdlTipoPeriodoSim.DataBind();
+ DdlTipoPeriodoCM.DataBind();
+ DdlTipoPeriodo.DataBind();
+ DdlTipoPeriodo.Items.Insert(0, new ListItem("Seleccione", "-1"));
+ if (DdlTipoPeriodo.Items.Count > 0)
+ {
+ DdlTipoPeriodo.SelectedIndex = 0;
+ }
+ }
+ private void cargaPeriodos()
+ {
+ int tipoPeriodo = DdlTipoPeriodo.SelectedValue.ToEntero();
+ int ejercicio = DdlEjercicios.SelectedValue.ToEntero();
+ dtPeriodos = null;
+ if (DdlTipoPeriodo.SelectedValue.ToEntero() > 0)
+ {
+ using (ClsNominas objperiodos = new ClsNominas())
+ {
+ if (objperiodos.GetPeriodos(tipoPeriodo, UsuarioActual.CveEmpresa, ejercicio, -1, -1))
+ {
+ dtPeriodos = objperiodos.DtResultados.FiltraParametros("Estatus IN (1,2,3,4,5)");
+ }
+ }
+ }
+ DdlPeriodo.DataSource = dtPeriodos;
+ DdlPeriodo.DataBind();
+ DdlPeriodo.Items.Insert(0, new ListItem("Seleccione", "-1"));
+ muestraPeriodo();
+ }
+
+ protected void DdlEjercicios_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ cargaPeriodos();
+ }
+
+ protected void DdlTipoPeriodo_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ cargaPeriodos();
+ DdlEjercicios.AutoPostBack = true;
+ }
+
+ protected void DdlPeriodo_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ muestraPeriodo();
+ }
+ private void muestraPeriodo()
+ {
+ int CvePeriodo = DdlPeriodo.SelectedValue.ToEntero();
+ LnkConsultar.Visible = (CvePeriodo > 0);
+ UPFiltros.Update();
+ UpDatos.Update();
+ }
+ #endregion
+ #region Datos
+
+ protected void LnkConsultar_Click(object sender, EventArgs e)
+ {
+ FiltCveProyecto = DdlProyecto.SelectedValue.ToEntero();
+ FiltCveSubProyecto = DdlSubProyecto.SelectedValue.ToEntero();
+ FiltCveTurno = DdlTurno.SelectedValue.ToEntero();
+ FiltCvePeriodo = DdlPeriodo.SelectedValue.ToEntero();
+ LtlPeriodoseleccionado.Text = DdlPeriodo.SelectedItem.Text;
+ FiltAgrupador = 1;
+ HypPDFSTimbrados.Attributes.Add("onclick", string.Format("GETPDF({0},{1})", -1, FiltCvePeriodo));
+ cargaDatos();
+
+ }
+ public void cargaDatos(bool cargaasistencia = true)
+ {
+ int CveEmpresa = UsuarioActual.CveEmpresa;
+
+ bool continuar = false;
+ CvePeriodoSeleccionado = 0;
+ dtempleados = null;
+ dtConceptos = null;
+ DataTable dtPeriodo = new DataTable();
+ DataTable dtasistencia = new DataTable();
+ LnkAutorizar.Visible = false;
+ if (FiltCvePeriodo > 0)
+ {
+
+ int Estatus = 0;
+ using (ClsNominas objnom = new ClsNominas())
+ {
+ if (objnom.GetPeriodos(-1, UsuarioActual.CveEmpresa, -1, -1, FiltCvePeriodo))
+ {
+ DataRow drow = objnom.DtResultados.Rows[0];
+ Estatus = drow["Estatus"].ToString().ToEntero();
+ int CvePrePolizaProvision = drow["CvePrePolizaProvision"].ToString().ToEntero();
+ int CvePrePolizaProvisionAsimilados = drow["CvePrePolizaAsimilables"].ToString().ToEntero();
+ LnkConceptoEmpleado.Visible = (Estatus == 1);
+ LnkRegistrarProvision.Visible = (Estatus >= 2) && CvePrePolizaProvision <= 0;
+ LnkConceptoEmpleado.Visible = (Estatus < 2);
+ LnkCargaAsistenciaMasiva.Visible = (Estatus < 2);
+ LnkModalPlantillaNomina.Visible = (Estatus < 2);
+ LnkTimbrarTodos.Visible = (Estatus > 2);
+
+ LnkLayoutContable.Visible = (Estatus > 2);
+ LnkProvisionNomina.Visible = CvePrePolizaProvision > 0;
+ LnkProvisionNomina.NavigateUrl = $"../Contabilidad/RegPrePoliza.aspx?CvePrePoliza={CvePrePolizaProvision}";
+ LnkProvisionNominaAsimilados.Visible = CvePrePolizaProvisionAsimilados > 0;
+ LnkProvisionNominaAsimilados.NavigateUrl = $"../Contabilidad/RegPrePoliza.aspx?CvePrePoliza={CvePrePolizaProvisionAsimilados}";
+ UpAccciones.Update();
+ }
+ LnkListaRaya.Visible = true;
+ LnkAsistenciaIncidencias.Visible = true;
+
+ LnkFormatoTabular.Visible = true;
+ HypPDFSTimbrados.Visible = true;
+ if (objnom.GetNominaEmpleado(FiltCveProyecto, FiltCveSubProyecto, FiltCveTurno, FiltCvePeriodo, CveEmpresa, FiltAgrupador, DdlRegimenContratacion.SelectedValue.ToEntero()) && objnom.DTSetResultados.Tables.Count > 1)
+ {
+ dtempleados = objnom.DTSetResultados.Tables[3];
+ dtempleadosConceptos = objnom.DTSetResultados.Tables[4];
+ dtConceptos = objnom.DTSetResultados.Tables[0];
+ dtPeriodo = objnom.DTSetResultados.Tables[1];
+ dtasistencia = objnom.DTSetResultados.Tables[2];
+ CvePeriodoSeleccionado = FiltCvePeriodo;
+ continuar = true;
+ }
+
+ LnkTimbrarTodos.Visible = dtempleados.Rows.Count > 0 && dtempleados.COUNT("CvePersonal", "SeTimbro=0 AND CvePersonal >0 AND NomAutorizado =1") > 0;
+ }
+
+ }
+ #region CargaGrid
+ if (continuar)
+ {
+
+ //string ctipo = "P";
+ /*
+ while (GvNominas.Columns.Count > 3)
+ {
+ GvNominas.Columns.RemoveAt(2);
+ //GvNominas.Columns.sa();
+ }*/
+
+ int CurrentColumn = 2;
+ BoundField bf;
+ foreach (DataRow row in dtConceptos.FiltraParametros("Tipo IN ('P') AND EsPadre = 1 ").Rows)
+ {
+ int CveConcepto = row["CveConcepto"].ToString().ToEntero();
+ int SoloVisible = row["SoloVisible"].ToString().ToEntero();
+ string Concepto = row["Concepto"].ToString();
+ GvNominas.Columns[CurrentColumn].ItemStyle.BackColor = System.Drawing.Color.Transparent;
+ GvNominas.Columns[CurrentColumn].ItemStyle.CssClass = " ";
+ GvNominas.Columns[CurrentColumn].HeaderStyle.CssClass = " ";
+ if (SoloVisible == 1)
+ {
+
+ GvNominas.Columns[CurrentColumn].HeaderStyle.CssClass = "isOnlyVisible ";
+ }
+ GvNominas.Columns[CurrentColumn].Visible = (dtempleados.SUM(string.Format("[V_{0}]", CveConcepto)) != 0);
+ bf = (BoundField)GvNominas.Columns[CurrentColumn];
+ bf.DataField = string.Format("V_{0}", CveConcepto);
+ bf.HeaderText = Concepto;
+ if (GvNominas.Columns[CurrentColumn].Visible)
+ {
+ CurrentColumn++;
+ }
+ }
+ if (true)
+ {
+ BoundField field = (BoundField)GvNominas.Columns[CurrentColumn];
+
+ field.HeaderText = "Percepciones";
+ field.DataField = "SumaPercepciones";
+ field.ItemStyle.BackColor = System.Drawing.Color.LightGray;
+ GvNominas.Columns[CurrentColumn].Visible = true;
+ CurrentColumn++;
+ }
+
+ foreach (DataRow row in dtConceptos.FiltraParametros("Tipo IN ('D') AND EsPadre = 1 ").Rows)
+ {
+ int CveConcepto = row["CveConcepto"].ToString().ToEntero();
+ int CveSistema = row["CveSistema"].ToString().ToEntero();
+ int SoloVisible = row["SoloVisible"].ToString().ToEntero();
+ string Concepto = row["Concepto"].ToString();
+ GvNominas.Columns[CurrentColumn].ItemStyle.BackColor = System.Drawing.Color.Transparent;
+ GvNominas.Columns[CurrentColumn].ItemStyle.CssClass = " ";
+ GvNominas.Columns[CurrentColumn].HeaderStyle.CssClass = " ";
+ if (SoloVisible == 1)
+ {
+ GvNominas.Columns[CurrentColumn].HeaderStyle.CssClass = "isOnlyVisible ";
+ }
+ GvNominas.Columns[CurrentColumn].Visible = (dtempleados.SUM(string.Format("[V_{0}]", CveConcepto)) != 0) && CveSistema != 101;
+ bf = (BoundField)GvNominas.Columns[CurrentColumn];
+ bf.DataField = string.Format("V_{0}", CveConcepto);
+ bf.HeaderText = Concepto;
+ if (GvNominas.Columns[CurrentColumn].Visible)
+ {
+ CurrentColumn++;
+ }
+ }
+
+ if (true)
+ {
+ BoundField field = (BoundField)GvNominas.Columns[CurrentColumn];
+ field.HeaderText = "Deducciones";
+ field.DataField = "SumaDeducciones";
+ field.ItemStyle.BackColor = System.Drawing.Color.LightGray;
+ GvNominas.Columns[CurrentColumn].ItemStyle.CssClass = " ";
+ GvNominas.Columns[CurrentColumn].HeaderStyle.CssClass = " ";
+ GvNominas.Columns[CurrentColumn].Visible = true;
+ CurrentColumn++;
+
+ field = (BoundField)GvNominas.Columns[CurrentColumn];
+ field.HeaderText = "Total";
+ field.DataField = "Total";
+ field.ItemStyle.BackColor = System.Drawing.Color.DarkGray;
+ field.ItemStyle.CssClass = "TotalWhite";
+ field.HeaderStyle.CssClass = "TotalWhite";
+
+ GvNominas.Columns[CurrentColumn].Visible = true;
+ CurrentColumn++;
+ }
+
+ foreach (DataRow row in dtConceptos.FiltraParametros("Tipo IN ('O') AND EsPadre = 1 ").Rows)
+ {
+ int CveConcepto = row["CveConcepto"].ToString().ToEntero();
+ int SoloVisible = row["SoloVisible"].ToString().ToEntero();
+ string Concepto = row["Concepto"].ToString();
+ GvNominas.Columns[CurrentColumn].ItemStyle.BackColor = System.Drawing.Color.Transparent;
+ GvNominas.Columns[CurrentColumn].ItemStyle.CssClass = " ";
+ GvNominas.Columns[CurrentColumn].HeaderStyle.CssClass = " ";
+ if (SoloVisible == 1)
+ {
+ GvNominas.Columns[CurrentColumn].HeaderStyle.CssClass = "isOnlyVisible ";
+ }
+ GvNominas.Columns[CurrentColumn].Visible = (dtempleados.SUM(string.Format("[V_{0}]", CveConcepto)) != 0);
+ bf = (BoundField)GvNominas.Columns[CurrentColumn];
+ bf.DataField = string.Format("V_{0}", CveConcepto);
+ bf.HeaderText = Concepto;
+
+ if (GvNominas.Columns[CurrentColumn].Visible)
+ {
+ CurrentColumn++;
+ }
+ }
+ if (true)
+ {
+ BoundField field = (BoundField)GvNominas.Columns[CurrentColumn];
+ field.HeaderText = "Obligaciones";
+ field.DataField = "SumaObligaciones";
+ field.ItemStyle.BackColor = System.Drawing.Color.LightGray;
+ GvNominas.Columns[CurrentColumn].ItemStyle.CssClass = " ";
+ GvNominas.Columns[CurrentColumn].HeaderStyle.CssClass = " ";
+ GvNominas.Columns[CurrentColumn].Visible = true;
+ CurrentColumn++;
+ }
+ for (int i = CurrentColumn; i < 102; i++)
+ {
+ bf = (BoundField)GvNominas.Columns[i];
+ bf.DataField = "";
+ bf.HeaderText = "";
+ GvNominas.Columns[i].ItemStyle.BackColor = System.Drawing.Color.Transparent;
+ GvNominas.Columns[CurrentColumn].ItemStyle.CssClass = " ";
+ GvNominas.Columns[CurrentColumn].HeaderStyle.CssClass = " ";
+ GvNominas.Columns[i].Visible = false;
+
+ }
+ bool tr = false;
+ if (tr)
+ {
+ /*
+ bool sumaPercepciones = false;
+ bool sumaDeducciones = false;
+ if (GvNominas.Columns.Count > 3)
+ {
+
+ foreach (DataRow row in dtConceptos.FiltraParametros("Tipo IN ('P','D','O') AND EsPadre = 1 ").Rows)
+ {
+ int CveConcepto = row["CveConcepto"].ToString().ToEntero();
+ string Concepto = row["Concepto"].ToString();
+ string Tipo = row["Tipo"].ToString();
+
+ if (Tipo != ctipo)
+ {
+ if (ctipo == "P")
+ {
+ CurrentColumn++;
+ if (Tipo != "D")
+ {
+ CurrentColumn++;
+ CurrentColumn++;
+ }
+ }
+ else if (ctipo == "D")
+ {
+
+ CurrentColumn++;
+ CurrentColumn++;
+ }
+ ctipo = Tipo;
+ }
+ CurrentColumn++;
+ }
+ }
+ else
+ {
+
+ foreach (DataRow row in dtConceptos.FiltraParametros("Tipo IN ('P','D','O') AND EsPadre = 1 ").Rows)
+ {
+ int CveConcepto = row["CveConcepto"].ToString().ToEntero();
+ string Concepto = row["Concepto"].ToString();
+ string Tipo = row["Tipo"].ToString();
+
+ if (Tipo != ctipo)
+ {
+ if (ctipo == "P")
+ {
+
+ BoundField field = new BoundField();
+ field.HeaderText = "Percepciones";
+ field.DataField = "SumaPercepciones";
+ field.DataFormatString = "{0:N2}";
+ field.ItemStyle.Width = Unit.Pixel(120);
+ field.ItemStyle.HorizontalAlign = HorizontalAlign.Right;
+ field.ItemStyle.BackColor = System.Drawing.Color.LightGray;
+ GvNominas.Columns.Insert(CurrentColumn++, field);
+ sumaPercepciones = true;
+ if (Tipo != "D")
+ {
+ field = new BoundField();
+ field.HeaderText = "Deducciones";
+ field.DataField = "SumaDeducciones";
+ field.DataFormatString = "{0:N2}";
+ field.ItemStyle.Width = Unit.Pixel(120);
+ field.ItemStyle.HorizontalAlign = HorizontalAlign.Right;
+ field.ItemStyle.BackColor = System.Drawing.Color.LightGray;
+ field.ItemStyle.CssClass = " ";
+ field.HeaderStyle.CssClass = " ";
+ GvNominas.Columns.Insert(CurrentColumn++, field);
+ field = new BoundField();
+ field.HeaderText = "Total";
+ field.DataField = "Total";
+ field.DataFormatString = "{0:N2}";
+ field.ItemStyle.Width = Unit.Pixel(120);
+ field.ItemStyle.HorizontalAlign = HorizontalAlign.Right;
+ field.ItemStyle.BackColor = System.Drawing.Color.LightGray;
+ field.ItemStyle.CssClass = " ";
+ field.HeaderStyle.CssClass = " ";
+ GvNominas.Columns.Insert(CurrentColumn++, field);
+ sumaDeducciones = true;
+ }
+ }
+ else if (ctipo == "D")
+ {
+
+ BoundField field = new BoundField();
+ if (!sumaPercepciones)
+ {
+
+ field.HeaderText = "Percepciones";
+ field.DataField = "SumaPercepciones";
+ field.DataFormatString = "{0:N2}";
+ field.ItemStyle.Width = Unit.Pixel(120);
+ field.ItemStyle.HorizontalAlign = HorizontalAlign.Right;
+ field.ItemStyle.BackColor = System.Drawing.Color.LightGray;
+ field.ItemStyle.CssClass = " ";
+ field.HeaderStyle.CssClass = " ";
+ GvNominas.Columns.Insert(CurrentColumn++, field);
+ field = new BoundField();
+ sumaPercepciones = true;
+ }
+ field.HeaderText = "Deducciones";
+ field.DataField = "SumaDeducciones";
+ field.DataFormatString = "{0:N2}";
+ field.ItemStyle.Width = Unit.Pixel(120);
+ field.ItemStyle.HorizontalAlign = HorizontalAlign.Right;
+ field.ItemStyle.BackColor = System.Drawing.Color.LightGray;
+ field.ItemStyle.CssClass = " ";
+ field.HeaderStyle.CssClass = " ";
+ GvNominas.Columns.Insert(CurrentColumn++, field);
+
+ field = new BoundField();
+ field.HeaderText = "Total";
+ field.DataField = "Total";
+ field.DataFormatString = "{0:N2}";
+ field.ItemStyle.Width = Unit.Pixel(120);
+ field.ItemStyle.HorizontalAlign = HorizontalAlign.Right;
+ field.ItemStyle.BackColor = System.Drawing.Color.LightGray;
+ field.ItemStyle.CssClass = "TotalWhite ";
+ field.HeaderStyle.CssClass = "TotalWhite ";
+ GvNominas.Columns.Insert(CurrentColumn++, field);
+ sumaDeducciones = true;
+ }
+ ctipo = Tipo;
+ }
+ if (true)
+ {
+ BoundField field = new BoundField();
+ field.Visible = (dtempleados.SUM(string.Format("[V_{0}]", CveConcepto)) > 0);
+ field.HeaderText = Concepto;
+ field.DataField = string.Format("V_{0}", CveConcepto);
+ field.DataFormatString = "{0:N2}";
+ field.ItemStyle.Width = Unit.Pixel(80);
+ GvNominas.Columns.Insert(CurrentColumn++, field);
+ }
+ }
+
+ if (true)
+ {
+
+ BoundField field = new BoundField();
+ if (!sumaPercepciones)
+ {
+
+ field.HeaderText = "Percepciones";
+ field.DataField = "SumaPercepciones";
+ field.DataFormatString = "{0:N2}";
+ field.ItemStyle.Width = Unit.Pixel(120);
+ field.ItemStyle.HorizontalAlign = HorizontalAlign.Right;
+ field.ItemStyle.BackColor = System.Drawing.Color.LightGray;
+ field.ItemStyle.CssClass = " ";
+ field.HeaderStyle.CssClass = " ";
+ GvNominas.Columns.Insert(CurrentColumn++, field);
+ field = new BoundField();
+ sumaPercepciones = true;
+ }
+ if (!sumaDeducciones)
+ {
+ field.HeaderText = "Deducciones";
+ field.DataField = "SumaDeducciones";
+ field.DataFormatString = "{0:N2}";
+ field.ItemStyle.Width = Unit.Pixel(120);
+ field.ItemStyle.HorizontalAlign = HorizontalAlign.Right;
+ field.ItemStyle.BackColor = System.Drawing.Color.LightGray;
+ field.ItemStyle.CssClass = " ";
+ field.HeaderStyle.CssClass = " ";
+ GvNominas.Columns.Insert(CurrentColumn++, field);
+
+ field = new BoundField();
+ field.HeaderText = "Total";
+ field.DataField = "Total";
+ field.DataFormatString = "{0:N2}";
+ field.ItemStyle.Width = Unit.Pixel(120);
+ field.ItemStyle.HorizontalAlign = HorizontalAlign.Right;
+ field.ItemStyle.BackColor = System.Drawing.Color.LightGray;
+ field.ItemStyle.CssClass = " ";
+ field.HeaderStyle.CssClass = " ";
+ GvNominas.Columns.Insert(CurrentColumn++, field);
+ sumaDeducciones = true;
+ field = new BoundField();
+ }
+ field.HeaderText = "Obligaciones";
+ field.DataField = "SumaObligaciones";
+ field.DataFormatString = "{0:N2}";
+ field.ItemStyle.Width = Unit.Pixel(120);
+ field.ItemStyle.HorizontalAlign = HorizontalAlign.Right;
+ field.ItemStyle.BackColor = System.Drawing.Color.LightGray;
+ field.ItemStyle.CssClass = " ";
+ field.HeaderStyle.CssClass = " ";
+ GvNominas.Columns.Insert(CurrentColumn++, field);
+ }
+
+
+ }
+ */
+ }
+ setGVNominas();
+ }
+ else
+ {
+
+ GvNominas.DataSource = null;
+ GvNominas.DataBind();
+ }
+ if (cargaasistencia)
+ {
+ if (dtPeriodo != null && dtPeriodo.Rows.Count > 0)
+ {
+
+ DateTime FechaInicio = (DateTime)dtPeriodo.Rows[0]["FechaInicio"];
+ DateTime FechaFin = (DateTime)dtPeriodo.Rows[0]["FechaFin"];
+ StringBuilder gvasistencia = new StringBuilder();
+ gvasistencia.Append("");
+ if (true)
+ {
+ DateTime fecha = FechaInicio;
+
+ gvasistencia.Append("");
+ gvasistencia.Append("Nombre ");
+ while (fecha <= FechaFin)
+ {
+ gvasistencia.AppendFormat("{0:dd/MM/yyyy} ", fecha);
+ fecha = fecha.AddDays(1);
+ }
+ gvasistencia.Append(" ");
+ }
+ string tipo = "";
+ foreach (DataRow rempl in dtempleados.FiltraParametros("CvePersonal>0").Rows)
+ {
+ int CvePersonal = rempl["CvePersonal"].ToString().ToEntero();
+ string nombre = rempl["Nombre"].ToString();
+ string Codigo = rempl["Codigo"].ToString();
+ DateTime fecha = FechaInicio; int HorasDobles, HorasTriples;
+ gvasistencia.Append("");
+ gvasistencia.AppendFormat("{2} {1} ", CvePersonal, nombre, Codigo);
+ while (fecha <= FechaFin)
+ {
+ DataRow drow = dtasistencia.FiltroPrimero(string.Format("Fecha='{0:yyyy/MM/dd}' AND CvePersonal={1}", fecha, CvePersonal));
+ tipo = "-";
+ if (drow != null)
+ {
+ tipo = string.Format("{0} ({1}%)", drow["Tipo"], drow["PorcentajePago"]);
+ HorasDobles = drow["HorasDobles"].ToString().ToEntero();
+ HorasTriples = drow["HorasTriples"].ToString().ToEntero();
+ if (HorasDobles > 0)
+ {
+
+ tipo = string.Format("{0} {1} horas dobles", tipo, HorasDobles);
+ }
+ if (HorasTriples > 0)
+ {
+
+ tipo = string.Format("{0} {1} horas triple", tipo, HorasTriples);
+ }
+ drow.Delete();
+ }
+ gvasistencia.AppendFormat(" {0} ", tipo, CvePersonal, fecha);
+ fecha = fecha.AddDays(1);
+ }
+ gvasistencia.Append(" ");
+ }
+ gvasistencia.Append("
");
+ ltlGvAsistencia.Text = gvasistencia.ToString();
+ }
+ }
+ #endregion
+ UpDatos.Update();
+ LnkAutorizar.Visible = dtempleados.COUNT("CvePersonal", " CvePersonal > 0 AND NomAutorizado =0") > 0;
+ }
+ private void setGVNominas()
+ {
+ string filtrogrupo = "";
+ DataTable dt = dtempleados.Copy();
+ if (DdlAgrupadorB.SelectedValue == "1")
+ {
+ foreach (DataRow drow in dtempleados.FiltraParametros("CvePersonal > 0", "", new string[] { "CveSubProyecto", "SubProyecto" }).Rows)
+ {
+ DataRow dr = dt.NewRow();
+ filtrogrupo = (drow["CveSubProyecto"] == DBNull.Value ? "CveSubProyecto IS NULL AND CvePersonal>0 " : string.Format("CveSubProyecto = {0} AND CvePersonal>0", drow["CveSubProyecto"]));
+ foreach (DataRow row in dtConceptos.FiltraParametros("EsPadre = 1 ").Rows)
+ {
+ int CveConcepto = row["CveConcepto"].ToString().ToEntero();
+ dr[string.Format("V_{0}", CveConcepto)] = dtempleados.SUM(string.Format("[V_{0}]", CveConcepto), filtrogrupo);
+ }
+ dr["CveSubProyecto"] = drow["CveSubProyecto"];
+ dr["SubProyecto"] = drow["SubProyecto"];
+ dr["SumaPercepciones"] = dtempleados.SUM("SumaPercepciones", filtrogrupo);
+ dr["SumaDeducciones"] = dtempleados.SUM("SumaDeducciones", filtrogrupo);
+ dr["Total"] = dtempleados.SUM("Total", filtrogrupo);
+ dr["SumaObligaciones"] = dtempleados.SUM("SumaObligaciones", filtrogrupo);
+
+ dt.Rows.Add(dr);
+ }
+ dt.AcceptChanges();
+ dt = dt.FiltraParametros("", "CveSubProyecto,SubProyecto,Codigo,Nombre");
+ }
+ if (DdlAgrupadorB.SelectedValue == "2")
+ {
+
+ foreach (DataRow drow in dtempleados.FiltraParametros("CvePersonal > 0", "", new string[] { "CveDepartamento", "Departamento" }).Rows)
+ {
+ DataRow dr = dt.NewRow();
+ filtrogrupo = (drow["CveDepartamento"] == DBNull.Value ? "CveDepartamento IS NULL AND CvePersonal>0 " : string.Format("CveDepartamento = {0} AND CvePersonal>0", drow["CveDepartamento"]));
+ foreach (DataRow row in dtConceptos.FiltraParametros("EsPadre = 1 ").Rows)
+ {
+ int CveConcepto = row["CveConcepto"].ToString().ToEntero();
+ dr[string.Format("V_{0}", CveConcepto)] = dtempleados.SUM(string.Format("[V_{0}]", CveConcepto), filtrogrupo);
+ }
+ dr["CveDepartamento"] = drow["CveDepartamento"];
+ dr["Departamento"] = drow["Departamento"];
+ dr["SumaPercepciones"] = dtempleados.SUM("SumaPercepciones", filtrogrupo);
+ dr["SumaDeducciones"] = dtempleados.SUM("SumaDeducciones", filtrogrupo);
+ dr["Total"] = dtempleados.SUM("Total", filtrogrupo);
+ dr["SumaObligaciones"] = dtempleados.SUM("SumaObligaciones", filtrogrupo);
+
+ dt.Rows.Add(dr);
+ }
+ dt.AcceptChanges();
+ dt = dt.FiltraParametros("", "CveDepartamento,Departamento,Codigo,Nombre");
+ }
+ if (DdlAgrupadorB.SelectedValue == "3")
+ {
+
+ foreach (DataRow drow in dtempleados.FiltraParametros("CvePersonal > 0", "", new string[] { "CveTurno", "Turno" }).Rows)
+ {
+ DataRow dr = dt.NewRow();
+ filtrogrupo = (drow["CveTurno"] == DBNull.Value ? "CveTurno IS NULL AND CvePersonal>0 " : string.Format("CveTurno = {0} AND CvePersonal>0", drow["CveTurno"]));
+ foreach (DataRow row in dtConceptos.FiltraParametros("EsPadre = 1 ").Rows)
+ {
+ int CveConcepto = row["CveConcepto"].ToString().ToEntero();
+ dr[string.Format("V_{0}", CveConcepto)] = dtempleados.SUM(string.Format("[V_{0}]", CveConcepto), filtrogrupo);
+ }
+ dr["CveTurno"] = drow["CveTurno"];
+ dr["Turno"] = drow["Turno"];
+ dr["SumaPercepciones"] = dtempleados.SUM("SumaPercepciones", filtrogrupo);
+ dr["SumaDeducciones"] = dtempleados.SUM("SumaDeducciones", filtrogrupo);
+ dr["Total"] = dtempleados.SUM("Total", filtrogrupo);
+ dr["SumaObligaciones"] = dtempleados.SUM("SumaObligaciones", filtrogrupo);
+
+ dt.Rows.Add(dr);
+ }
+ dt.AcceptChanges();
+ dt = dt.FiltraParametros("", "CveDepartamento,Departamento,Codigo,Nombre");
+ }
+ GvNominas.DataSource = dt;
+ GvNominas.DataBind();
+ }
+ protected void GvNominas_RowDataBound(object sender, GridViewRowEventArgs e)
+ {
+ if (e.Row.RowType == DataControlRowType.DataRow)
+ {
+ Literal LtlNombre = e.Row.FCLiteral("LtlNombre");
+ LinkButton LnkTimbrar = (LinkButton)e.Row.FindControl("LnkTimbrar");
+ int cvePersonal = e.Row.DataKey("CvePersonal").ToEntero();
+ int CvePeriodo = e.Row.DataKey("CvePeriodo").ToEntero();
+ int CveNomina = e.Row.DataKey("CveNomina").ToEntero();
+ string SeTimbro = e.Row.DataKey("SeTimbro").ToString();
+ string SeTimbroFiniquito = e.Row.DataKey("SeTimbroFiniquito").ToString();
+ string EsRenuncia = e.Row.DataKey("EsRenuncia").ToString();
+ string NomAutorizado = e.Row.DataKey("NomAutorizado").ToString();
+ string Nombre = e.Row.DataKey("Nombre").ToString();
+ string Codigo = e.Row.DataKey("Codigo").ToString();
+ string Turno = e.Row.DataKey("Turno").ToString();
+ string Departamento = e.Row.DataKey("Departamento").ToString();
+ string SubProyecto = e.Row.DataKey("SubProyecto").ToString();
+ LnkTimbrar.Visible = false;
+ if (cvePersonal > 0)
+ {
+ LtlNombre.Text = String.Format("{2} {1} ", cvePersonal, Nombre, Codigo);
+ if (CveNomina > 0)
+ {
+ if (NomAutorizado == "False")
+ {
+
+
+ }
+ else
+ {
+ if (!SeTimbro.ToUpper().Contiene("TRUE", "1"))
+ {
+ LnkTimbrar.Visible = true;
+ e.Row.CssClass = "info";
+
+ }
+ else
+ {
+ //onclick()
+ e.Row.FCHyperLink("HypPDF").Attributes.Add("onclick", string.Format("GETPDF({0},{1})", cvePersonal, CvePeriodo));
+ e.Row.FCHyperLink("HypXml").Attributes.Add("onclick", string.Format("GETXML({0},{1})", cvePersonal, CvePeriodo));
+ e.Row.FindControl("HypPDF").Visible = true;
+ e.Row.FindControl("HypXml").Visible = true;
+ e.Row.CssClass = "success";
+ if (EsRenuncia.ToUpper().Contiene("TRUE", "1") && !SeTimbroFiniquito.ToUpper().Contiene("TRUE", "1"))
+ {
+ // cvePersonal
+ bool isfiniquito = false;
+ foreach (DataRow drow in dtConceptos.FiltraParametros("CveSistema IN(10, 11, 32, 47)").Rows)
+ {
+ if (dtempleados.SUM(string.Format("V_{0}", drow["CveConcepto"]), string.Format("CvePersonal ={0}", cvePersonal)) > 0)
+ {
+ isfiniquito = true;
+ }
+ }
+ if (isfiniquito)
+ {
+ LnkTimbrar.Visible = true;
+ e.Row.CssClass = "danger";
+ e.Row.ToolTip = "sin timbrar conceptos de indemnización";
+
+ }
+ }
+ }
+
+ }
+
+ }
+ }
+ else
+ {
+ LtlNombre.Text = "Total General";
+ e.Row.FindControl("LnkTimbrar").Visible = false;
+ if (Turno.Length == 0 && SubProyecto.Length > 0)
+ {
+ LtlNombre.Text = String.Format("Centro de costos: {0}", SubProyecto);
+ }
+ else if (Turno.Length > 0)
+ {
+ LtlNombre.Text = String.Format("Turno: {0}", SubProyecto);
+ }
+ else if (Departamento.Length > 0)
+ {
+ LtlNombre.Text = String.Format("Departamento: {0}", Departamento);
+ }
+ else
+ {
+
+ e.Row.FCHyperLink("HypPDF").Attributes.Add("onclick", string.Format("GETPDF({0},{1})", -1, CvePeriodoSeleccionado));
+ e.Row.FindControl("HypPDF").Visible = false;
+ e.Row.CssClass = "SubTotales";
+ }
+ e.Row.FindControl("LnkSobreRecibo").Visible = false;
+
+ }
+
+ }
+
+ }
+ #endregion
+
+ protected void LnkTimbrarTodos_Click(object sender, EventArgs e)
+ {
+ string msggral = "";
+ foreach (GridViewRow gvRow in GvNominas.Rows)
+ {
+ int CvePeriodo = gvRow.DataKey("CvePeriodo").ToEntero();
+ int CvePersonal = gvRow.DataKey("CvePersonal").ToEntero();
+ int CveNomina = gvRow.DataKey("CveNomina").ToEntero();
+ LinkButton LnkTimbrar = gvRow.FCLinkButton("LnkTimbrar");
+ if (CvePersonal > 0 && LnkTimbrar.Visible)
+ {
+ LogicNominas lognom = new LogicNominas();
+
+ string Msg = lognom.TimbrarNomina(CveNomina, CvePersonal, CvePeriodo, UsuarioActual);
+ if (Msg != null && Msg.Length > 0)
+ {
+ msggral = string.Format("{0}{3} {2} {1} ", msggral, Msg, gvRow.DataKey("Nombre"), gvRow.DataKey("Codigo"));
+ }
+ else
+ {
+ ClsNominas ObjPeriodo = new ClsNominas();
+ ObjPeriodo.CambiaEstatusPeriodo(CvePeriodo, (int)enumNominasEstatus.Timbrada, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa);
+ ObjPeriodo.Dispose();
+ LnkTimbrar.Visible = false;
+ gvRow.CssClass = "success";
+ gvRow.FindControl("ImgDelete").Visible = false;
+ gvRow.FindControl("LnkCancelar").Visible = true;
+ gvRow.FindControl("HypXml").Visible = true;
+ gvRow.FindControl("HypPDF").Visible = true;
+
+ gvRow.ForeColor = Color.Green;
+ }
+
+
+ }
+ }
+ if (msggral.Length > 0)
+ {
+
+ Alert(string.Format("Ocurrieron los siguientes errores ", msggral), TipoMensaje.MsgAdvertencia);
+ }
+ UpDatos.Update();
+ }
+
+ protected void LnkTimbrar_Click(object sender, EventArgs e)
+ {
+ LinkButton lnk = (LinkButton)sender;
+ GridViewRow gvRow = (GridViewRow)lnk.NamingContainer;
+ int CvePeriodo = gvRow.DataKey("CvePeriodo").ToEntero();
+ int CvePersonal = gvRow.DataKey("CvePersonal").ToEntero();
+ int CveNomina = gvRow.DataKey("CveNomina").ToEntero();
+ LogicNominas lognom = new LogicNominas();
+
+ string Msg = lognom.TimbrarNomina(CveNomina, CvePersonal, CvePeriodo, UsuarioActual);
+ if (Msg != null && Msg.Length > 0)
+ { Alert(Msg, TipoMensaje.MsgAdvertencia); }
+ else
+ {
+ ClsNominas ObjPeriodo = new ClsNominas();
+ ObjPeriodo.CambiaEstatusPeriodo(CvePeriodo, (int)enumNominasEstatus.Timbrada, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa);
+ ObjPeriodo.Dispose();
+ Alert("Se ha timbrado correctamente");
+ gvRow.FindControl("ImgDelete").Visible = false;
+ gvRow.FindControl("LnkCancelar").Visible = true;
+ gvRow.FindControl("HypXml").Visible = true;
+ gvRow.FindControl("HypPDF").Visible = true;
+ gvRow.ForeColor = Color.Green;
+ lnk.Visible = false; UpDatos.Update();
+ }
+ }
+
+ protected void ImgDelete_Click(object sender, EventArgs e)
+ {
+ int Cve = ((LinkButton)sender).CommandArgument.ToEntero();
+ //LinkButton lnk = (LinkButton)sender;
+ //GridViewRow gvRow = (GridViewRow)lnk.NamingContainer;
+ //int CvePeriodo = gvRow.DataKey("CvePeriodo").ToEntero();
+ //int CvePersonal = gvRow.DataKey("CvePersonal").ToEntero();
+ bool continuar = true;
+
+ using (ClsNominas Nom = new ClsNominas())
+ {
+ Nom.IniciaTransacSQL();
+ //AutorizaNom_Nominas
+ if (continuar && (continuar=Nom.RemoveNom_Nominas(Cve)))
+ {
+ Alert("Los movimientos de la nómina fueron eliminados", TipoMensaje.MsgInformacion); cargaDatos();
+ Nom.Commit();
+ }
+ }
+ }
+
+ protected void LnkCancelar_Click(object sender, EventArgs e)
+ {
+ int CveNomina = ((LinkButton)sender).CommandArgument.ToEntero();
+
+
+ if (CveNomina > 0)
+ {
+ ClsNominas Nom = new ClsNominas();
+ if (Nom.GetNom_Nominas(CveNomina, -1, -1, -1, UsuarioActual.CveEmpresa))
+ {
+ Timbrado ObjTimbrado = new Timbrado();
+
+ string FolioFiscal = Nom.FolioFiscal;
+ decimal Total = Nom.Total.ToString().ToDecimal();
+ string RFCReceptor = Nom.RFC;
+ string RFCEmisor = UsuarioActual.Empresa.RFC;
+
+
+ if (ObjTimbrado.CFDICancelar(UsuarioActual.Empresa, FolioFiscal, Total, RFCReceptor, RFCEmisor, 4))
+ {
+ Nom.UpdateEstatusNomNominas(2, UsuarioActual.Empresa.CvePAC, "", "", ("01/01/2000").ToDate(), CveNomina, 0, 0, 0, 0, 0);
+
+ Alert($"La nómina con folio fiscal '{FolioFiscal}' fue cancelada ante el SAT", TipoMensaje.MsgInformacion);
+ }
+ else
+ {
+
+ ObjTimbrado.MensajeErrorCFDI.GuardaLog();
+ Alert($"no se pudo cancelar el folio fiscal {ObjTimbrado.MensajeErrorCFDI}", TipoMensaje.MsgAdvertencia);
+ }
+ }
+
+
+ Nom.Dispose();
+
+ cargaDatos();
+ }
+ }
+
+
+ protected void LnkModalPlantillaNomina_Click(object sender, EventArgs e)
+ {
+ RegistraScript("$('#DModalNominas').modal();");
+
+ using (ClsNominas ObjNomina = new ClsNominas())
+ {
+ if (ObjNomina.GetConceptos(UsuarioActual.CveEmpresa))
+ {
+ GVConceptosPlantilla.DataSource = ObjNomina.DtResultados.FiltraParametros($"CveEmpresa = {UsuarioActual.CveEmpresa}");
+ GVConceptosPlantilla.DataBind();
+ }
+ }
+
+ UpCargarNomina.Update();
+ }
+ protected void LnkFormato_Click(object sender, EventArgs e)
+ {
+ try
+ {
+ StringBuilder str = new StringBuilder("0");
+ bool continuar = false;
+ foreach (GridViewRow gvrow in GVConceptosPlantilla.Rows)
+ {
+ if (gvrow.DataKey("CveConcepto").ToEntero() > 0 && gvrow.FCCheckBox("chkCon").Checked)
+ {
+ str.AppendFormat(",{0}", gvrow.DataKey("CveConcepto"));
+ continuar = true;
+ }
+ }
+ if (continuar)
+ {
+
+ ClosedXML.Excel.XLWorkbook wb = new ClosedXML.Excel.XLWorkbook();
+ var libro = wb.AddWorksheet("Nomina");
+ int column = 1;
+ libro.Row(1).Hide();
+ libro.Cell(1, column).Value = "Codigo";
+ libro.Cell(3, column).Value = "Codigo";
+ column++;
+ libro.Cell(1, column).Value = "Empleado";
+ libro.Cell(3, column).Value = "Empleado";
+ libro.Column(column).Width = 35;
+ DataTable dtcP = dtConceptos.FiltraParametros(string.Format("Tipo = 'P' AND EsPadre = 1 AND CveConcepto in({0})", str));
+ DataTable dtcD = dtConceptos.FiltraParametros(string.Format("Tipo = 'D' AND EsPadre = 1 AND CveConcepto in({0})", str));
+ DataTable dtcO = dtConceptos.FiltraParametros(string.Format("Tipo = 'O' AND EsPadre = 1 AND CveConcepto in({0})", str));
+ int iniciotipe = column;
+ foreach (DataRow row in dtcP.Rows)
+ {
+ column++;
+ libro.Cell(1, column).Value = row["CveConcepto"].ToString();
+ libro.Cell(FilaConceptos, column).Value = "N";
+ libro.Cell(3, column).Value = row["Concepto"].ToString();
+ libro.Cell(4, column).Value = row["Codigo"].ToString();
+ libro.Column(column).Width = 15;
+ }
+ if (iniciotipe < column)
+ {
+ libro.Range(2, iniciotipe + 1, 2, column).Style.Alignment.Horizontal = ClosedXML.Excel.XLAlignmentHorizontalValues.Center;
+ libro.Range(2, iniciotipe + 1, 2, column).Merge().Value = "Percepciones";
+ }
+ iniciotipe = column;
+ foreach (DataRow row in dtcD.Rows)
+ {
+ column++;
+ libro.Cell(1, column).Value = row["CveConcepto"].ToString();
+ libro.Cell(FilaConceptos, column).Value = "N";
+ libro.Cell(3, column).Value = row["Concepto"].ToString();
+ libro.Cell(4, column).Value = row["Codigo"].ToString();
+ libro.Column(column).Width = 15;
+ }
+ if (iniciotipe < column)
+ {
+ libro.Range(2, iniciotipe + 1, 2, column).Style.Alignment.Horizontal = ClosedXML.Excel.XLAlignmentHorizontalValues.Center;
+ libro.Range(2, iniciotipe + 1, 2, column).Merge().Value = "Deducciones";
+ }
+ iniciotipe = column;
+ foreach (DataRow row in dtcO.Rows)
+ {
+ column++;
+ libro.Cell(1, column).Value = row["CveConcepto"].ToString();
+ libro.Cell(FilaConceptos, column).Value = "N";
+ libro.Cell(3, column).Value = row["Concepto"].ToString();
+ libro.Cell(4, column).Value = row["Codigo"].ToString();
+ libro.Column(column).Width = 15;
+ }
+ if (iniciotipe < column)
+ {
+ libro.Range(2, iniciotipe + 1, 2, column).Style.Alignment.Horizontal = ClosedXML.Excel.XLAlignmentHorizontalValues.Center;
+ libro.Range(2, iniciotipe + 1, 2, column).Merge().Value = "Obligaciones";
+ }
+ libro.Range(2, 1, 2, 2).Merge().Value = "";
+ libro.Range(4, 1, 4, 2).Merge().Value = "";
+ libro.Range(2, 1, 2, 2).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(79, 129, 189));
+ libro.Range(4, 1, 4, 2).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(79, 129, 189));
+
+ libro.Row(1).CellsUsed().Style.Font.FontColor = ClosedXML.Excel.XLColor.White;
+ libro.Row(2).CellsUsed().Style.Font.FontColor = ClosedXML.Excel.XLColor.White;
+ libro.Row(3).CellsUsed().Style.Font.FontColor = ClosedXML.Excel.XLColor.White;
+ libro.Row(4).CellsUsed().Style.Font.FontColor = ClosedXML.Excel.XLColor.White;
+ libro.Row(FilaConceptos).CellsUsed().Style.Font.FontColor = ClosedXML.Excel.XLColor.White;
+ libro.Row(1).CellsUsed().Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(79, 129, 189));
+ libro.Row(2).CellsUsed().Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(79, 129, 189));
+ libro.Row(3).CellsUsed().Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(79, 129, 189));
+ libro.Row(4).CellsUsed().Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(79, 129, 189));
+ //libro.Row(FilaConceptos).CellsUsed().Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(79, 129, 189));
+ libro.Cell(FilaConceptos, 1).Value = "'-------";
+ libro.Cell(FilaConceptos, 1).Style.Font.FontColor = ClosedXML.Excel.XLColor.FromArgb(177, 160, 199);
+ libro.Cell(FilaConceptos, 2).Value = "¿Modificar SI(S)/NO(N)?";
+ libro.Cell(FilaConceptos, 1).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(177, 160, 199));
+ libro.Row(FilaConceptos).CellsUsed().Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(177, 160, 199));
+
+ int Fila = 5;
+ foreach (DataRow erow in dtempleados.FiltraParametros("CvePersonal>0 AND NomAutorizado=0").Rows)
+ {
+ Fila++;
+ column = 1;
+ libro.Cell(Fila, column).Value = string.Format("'{0}", erow["Codigo"]);
+ column++;
+ libro.Cell(Fila, column).Value = erow["Nombre"];
+ foreach (DataRow row in dtcP.Rows)
+ {
+ column++;
+ string Concepto = string.Format("V_{0}", row["CveConcepto"]);
+ libro.Cell(Fila, column).Value = erow[Concepto];
+ }
+ foreach (DataRow row in dtcD.Rows)
+ {
+ column++;
+ string Concepto = string.Format("V_{0}", row["CveConcepto"]);
+ libro.Cell(Fila, column).Value = erow[Concepto];
+ }
+ foreach (DataRow row in dtcO.Rows)
+ {
+ column++;
+ string Concepto = string.Format("V_{0}", row["CveConcepto"]);
+ libro.Cell(Fila, column).Value = erow[Concepto];
+ }
+ }
+ System.IO.Stream fs = new System.IO.MemoryStream();
+ wb.SaveAs(fs);
+ 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", "Plantilla conceptos nómina "));
+ Response.BinaryWrite(memoryStream.ToArray());
+ Response.End();
+ }
+ else
+ {
+ Alert("Debe seleccionar los conceptos a cargar.", TipoMensaje.MsgAdvertencia);
+ }
+ }
+ catch (Exception ex)
+ {
+ Alert("Ocurrio un error al generar el Formato de nominas" + ex.ToString());
+ }
+ }
+
+ protected void LnkCargarNomina_Click(object sender, EventArgs e)
+ {
+
+ List Filesgral = TxtArchivoNomina.getfiles().Archivos;
+ bool continuar = Filesgral.Count > 0;
+ string stringError = "";
+ Archivo fileItem = continuar ? Filesgral[0] : null;
+ if (continuar)
+ {
+ string FileExtension = fileItem.Extencion.ToUpper();
+ if (FileExtension == "XLS" | FileExtension == "XLSX" | FileExtension == "CSV")
+ {
+ }
+ else
+ {
+ continuar = false;
+ stringError = "No se inserto un archivo de tipo Excel";
+ }
+
+ }
+ DataTable DTEXcel = new DataTable();
+ if (continuar)
+ {
+ try
+ {
+ DTEXcel = Extensiones.ModExtensiones.ReadExcelFile(fileItem.FileUrl, true).FiltraParametros(" LEN(Codigo)>0 AND Codigo <> 'Codigo'");
+
+ }
+ catch (Exception ex)
+ {
+
+ continuar = false;
+ stringError = "Ocurrio un Error al procesar el excel ";
+ string.Format("{0} \r\n{0}", stringError, ex.ToString()).GuardaLog();
+ }
+ }
+ if (continuar && DTEXcel.Rows.Count == 0)
+ {
+
+ continuar = false;
+ stringError = "No se encontraron cambios";
+ }
+ StringBuilder str = new StringBuilder();
+ bool rollback = false;
+ if (continuar)
+ {
+
+ int CveMoneda = 1;
+ //List lConceptos = new List();
+ //foreach (DataColumn item in DTEXcel.Columns)
+ //{
+ // if (item.ColumnName.ToEntero() > 0)
+ // {
+ // lConceptos.Add(item.ColumnName.ToEntero());
+ // }
+
+ //}
+ using (ClsRH objpersonal = new ClsRH())
+ {
+ using (ClsNominas objNomina = new ClsNominas(objpersonal.IniciaTransacSQL()))
+ {
+ foreach (DataRow row in DTEXcel.FiltraParametros("LEN(Codigo)>0 ").Rows)
+ {
+ if (!rollback)
+ {
+
+ string Codigo = row["Codigo"].ToString();
+ int CvePersonal = -1; // row["CvePersonal"].ToString().ToEntero();
+ int CveNomina = 0;
+ double SubTotal = 0;
+ double Total = 0;
+ int CveMetodoPago = 0;
+ if (Codigo != "-1" && objpersonal.GetPersonal(CvePersonal, Codigo, "-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) &&
+ objpersonal.DtResultados.Rows.Count == 1)
+ {
+ CvePersonal = objpersonal.CvePersonal;
+ CveMetodoPago = objpersonal.CveMetodoPago;
+ }
+ else
+ {
+ CvePersonal = 0;
+ str.AppendLine(string.Format("No se encontro el codigo {0} ", Codigo));
+ }
+ if (CvePersonal > 0)
+ {
+ if (objNomina.GetNom_Nominas(-1, CvePersonal, CvePeriodoSeleccionado, -1, UsuarioActual.CveEmpresa))
+ {
+ if (objNomina.DtResultados.Rows.Count > 0)
+ {
+ CveNomina = objNomina.CveNomina;
+ }
+ else
+ {
+ if (objNomina.AddNom_Nominas(-1, 1, CvePersonal, CvePeriodoSeleccionado, SubTotal, 0, 0, Total, CveMoneda, 1, CveMetodoPago, DateTime.Now, "Deducciones nómina",
+ "", "", "", "", 0, 0, 0, new DateTime(), new DateTime(), new DateTime(), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, false))
+ {
+ CveNomina = objNomina.CveNomina;
+ }
+ else
+ {
+ rollback = true;
+ }
+ }
+ }
+ else
+ {
+ rollback = true;
+ }
+ }
+ if (CveNomina > 0)
+ {
+ for (int i = 1; i < DTEXcel.Columns.Count; i++)
+ {
+ int CveConcepto = DTEXcel.Columns[i].ColumnName.ToEntero();
+ decimal Importe = 0;
+ decimal ImporteGravado = 0;
+ decimal ImporteExento = 0;
+ decimal ImporteValor = 0;
+ bool dontsaveconcepto = ((row[i].ToString().ToUpper() == "N") || (DTEXcel.Rows[0][i].ToString().ToUpper() == "N"));
+ Importe = row[i].ToString().ToDecimal();
+ ImporteGravado = Importe - ImporteExento;
+ ImporteValor = 0;
+ if (CveConcepto > 0)
+ {
+ if (!dontsaveconcepto)//el usuario definira si desea actualizar o no el concepto en el periodo
+ {
+ if (!objNomina.AddUPNom_NominasDetalles(objNomina.CveNomina, CvePeriodoSeleccionado, CvePersonal, CveConcepto, Importe, ImporteGravado, ImporteExento, ImporteValor, UsuarioActual.CveUsuario, true))
+ {
+ rollback = true;
+ }
+ }
+ }
+ else
+ {
+ rollback = false;
+ stringError = "ocurrio un error al procesar el archivo favor de intentar de nuevo volviendo a descargar la plantilla. si el problema Persiste Contacte a soporte.";
+ }
+
+ }
+
+ }
+ }
+ }
+ if (rollback)
+ {
+ objpersonal.RollBack();
+ continuar = false;
+ }
+ else
+ {
+ objpersonal.Commit();
+ }
+ }
+ }
+
+ }
+ if (!continuar)
+ {
+ Alert(stringError, ModExtensiones.TipoMensaje.MsgAdvertencia);
+ }
+ else
+ {
+ Alert("La información se a actualizado satisfactoriamente");
+ }
+ }
+
+ protected void LnkFormatoEmpleados_Click(object sender, EventArgs e)
+ {
+
+ }
+
+
+ #region SobreRecibo
+ #region SobreRecibo propiedades
+
+ protected int SRCvePersonal
+ {
+ get
+ {
+ if (ViewState["SRCvePersonal"] == null) { return 0; }
+ else { return ViewState["SRCvePersonal"].ToString().ToEntero(); }
+ }
+
+ set { ViewState["SRCvePersonal"] = value; }
+ }
+
+ protected int SRCvePeriodo
+ {
+ get
+ {
+ if (ViewState["SRCvePeriodo"] == null) { return 0; }
+ else { return ViewState["SRCvePeriodo"].ToString().ToEntero(); }
+ }
+
+ set { ViewState["SRCvePeriodo"] = value; }
+ }
+ protected int SRCveConcepto
+ {
+ get
+ {
+ if (ViewState["SRCveConcepto"] == null) { return 0; }
+ else { return ViewState["SRCveConcepto"].ToString().ToEntero(); }
+ }
+
+ set { ViewState["SRCveConcepto"] = value; }
+ }
+ protected string SRTipoConcepto
+ {
+ get
+ {
+ if (ViewState["SRTipoConcepto"] == null) { return ""; }
+ else { return ViewState["SRTipoConcepto"].ToString(); }
+ }
+
+ set { ViewState["SRTipoConcepto"] = value; }
+ }
+ protected bool NomAutorizado
+ {
+ get
+ {
+ if (ViewState["NomAutorizado"] == null) { return false; }
+ else { return (bool)ViewState["NomAutorizado"]; }
+ }
+
+ set { ViewState["NomAutorizado"] = value; }
+ }
+ #endregion
+ protected void LnkSobreRecibo_Click(object sender, EventArgs e)
+ {
+ GridViewRow gvrow = (GridViewRow)(((LinkButton)sender).NamingContainer);
+ LnkSRVacacionesADD.Visible = false;
+ if (DdlCtaContable.Items.Count == 0)
+ {
+ if (UsuarioActual.Empresa.TipoContabilidad == 1)
+ {
+
+ using (ClsContabilidad ObjConta = new ClsContabilidad())
+ {
+ if (ObjConta.GetCuentas(-1, "-1", -1, UsuarioActual.CveEmpresa))
+ {
+
+ DdlCtaContable.DataSource = ObjConta.DtResultados;
+ DdlCtaContable.DataBind();
+ }
+ }
+ }
+ else
+ {
+ using (ClsContPAQi ObjConta = new ClsContPAQi(UsuarioActual.Empresa))
+ {
+ if (ObjConta.Conectado && ObjConta.GetCuentas(-1, "-1", 1))
+ {
+ DdlCtaContable.DataSource = ObjConta.DtResultados;
+ DdlCtaContable.DataBind();
+ }
+ }
+ }
+
+
+ DdlCtaContable.Items.Insert(0, new ListItem("Seleccione", "-1"));
+ DdlCtaContable.SelectedValueExist("-1");
+ }
+ string Nombre = gvrow.DataKey("Nombre").ToString();
+ SRCvePersonal = gvrow.DataKey("CvePersonal").ToEntero();
+ SRCvePeriodo = gvrow.DataKey("CvePeriodo").ToEntero();
+ int CveNomina = gvrow.DataKey("CveNomina").ToEntero();
+ NomAutorizado = gvrow.DataKey("NomAutorizado").ToUpper().Contiene(new string[] { "1", "TRUE" });
+ using (ClsNominas nom = new ClsNominas())
+ {
+ if (nom.GetNom_Nominas(CveNomina, SRCvePersonal, SRCvePeriodo, -1, UsuarioActual.CveEmpresa) && nom.DtResultados.Rows.Count > 0)
+ {
+ DataRow drow = nom.DtResultados.Rows[0];
+ ChkMetodoPago.Checked = drow["MetodoPagoFijo"].ToString().ToUpper().Contiene(new string[] { "1", "TRUE" });
+ DdlMetodoPago.SelectedValueExist(drow["CveMetodoPago"].ToString());
+ DdlBanco.SelectedValueExist(drow["CveSATBanco"].ToString());
+ TxtBancoNumCuenta.Text = drow["BancoNumCuenta"].ToString();
+ TxtCLABE.Text = drow["CLABE"].ToString();
+ }
+ }
+ LblEmpleado.Text = Nombre;
+ LblEmpleado.NavigateUrl = string.Format("/RH/Personal.aspx?CvePersonal={0}", SRCvePersonal);
+ TabPersonal.ActiveTabIndex = 0;
+ mostrarConceptos();
+ CargaVacaciones();
+ pnlAddupMovto.Visible = false;
+ CargaMovtoPermanente();
+ CargaPersonalIncapacidad();
+ RegistraScript("$('#ModalConceptos').modal();");
+ }
+
+ private void CargaVacaciones()
+ {
+ ClsRH objRH = new ClsRH();
+
+ if (objRH.VacacionesGet(SRCvePersonal, UsuarioActual.Empresa.CveEmpresa))
+ {
+ GvVacaciones.DataSource = objRH.DtResultados;
+
+ }
+ else { GvVacaciones.DataSource = null; }
+
+ objRH.Dispose();
+ GvVacaciones.DataBind();
+ UpGvVacaciones.Update();
+ }
+
+ protected void LnkImportexCalculo_Click(object sender, EventArgs e)
+ {
+
+ SRCveConcepto = ((LinkButton)sender).CommandArgument.ToEntero();
+ //CvePeriodoSeleccionado
+ //SRCvePersonal
+ bool continuar = true;
+ if (SRCveConcepto > 0)
+ {
+ using (ClsNominas onom = new ClsNominas())
+ {
+ if (continuar=onom.DeleteNom_NominasDetalles(SRCveConcepto, SRCvePersonal, CvePeriodoSeleccionado))
+ {
+ }
+ }
+ }
+
+ if (continuar)
+ {
+ cargaDatos();
+
+ cargasobrericiboconceptos();
+ UpModalConceptos.Update();
+
+ RegistraScript("$('#ModalUpConcepto').modal('hide');");
+ Alert("el importe sera tomado del calculo y no del valor fijo");
+
+ }
+ }
+ protected void LnkConcepto_Click(object sender, EventArgs e)
+ {
+ SRCveConcepto = ((LinkButton)sender).CommandArgument.ToEntero();
+ SRTipoConcepto = ((LinkButton)sender).CommandArgument;
+ #region carga conceptos
+ DataTable dtCon;
+ if (SRCveConcepto > 0)
+ {
+ DataRow drow = dtConceptos.FiltroPrimero(string.Format("CveConcepto={0}", SRCveConcepto));
+ if (drow != null)
+ {
+ SRTipoConcepto = drow["Tipo"].ToString();
+ }
+ else
+ {
+ SRCveConcepto = 0;
+ SRTipoConcepto = "D";
+ }
+ }
+
+
+ if (SRTipoConcepto == "P")
+ {
+ dtCon = dtConceptos.FiltraParametros("Tipo ='P' AND EsPadre = 1 ").Copy(); //AND CveSistema <>12'
+ }
+ else
+ {
+ dtCon = dtConceptos.FiltraParametros("Tipo ='D' AND EsPadre = 1 ").Copy();
+ SRTipoConcepto = "D";
+ }
+ dtCon.Columns.Add(new DataColumn("CodigoConcepto"));
+ foreach (DataRow trow in dtCon.Rows)
+ {
+ trow["CodigoConcepto"] = string.Format("{0} - {1}", trow["Codigo"], trow["Concepto"]);
+ }
+ dtCon.AcceptChanges();
+ DataRow row = dtCon.NewRow();
+ row["CveConcepto"] = "-1";
+ row["CodigoConcepto"] = "Seleccione";
+ dtCon.Rows.InsertAt(row, 0);
+ #endregion
+ DdlmcConceptos.DataSource = dtCon;
+ DdlmcConceptos.DataBind();
+ if (SRCveConcepto > 0)
+ {
+ DdlmcConceptos.SelectedValueExist(SRCveConcepto);
+ }
+
+ PnlConceptoPersonal.Visible = false;
+ DdlmcConceptos_SelectedIndexChanged(DdlmcConceptos, null);
+ RegistraScript(string.Format("$('#ModalUpConcepto').on('shown.bs.modal', function () {{$('#{0}').trigger('focus')}});$('#ModalUpConcepto').modal();", TxtmcImporte.ClientID));
+ UPpanelModalUpConcepto.Update();
+ }
+
+ protected void LnkConceptoEmpleado_Click(object sender, EventArgs e)
+ {
+
+ SRCveConcepto = -1;
+ SRTipoConcepto = "P";
+ SRCvePersonal = -1;
+
+ using (ClsRH ObjPersonal = new ClsRH())
+ {
+ if (ObjPersonal.GetPersonal(-1, UsuarioActual.CveEmpresa))
+ {
+ DdlmcPersonal.DataSource = ObjPersonal.DtResultados;
+ DdlmcPersonal.DataBind();
+ }
+ }
+ #region carga conceptos
+ DataTable dtCon;
+
+ dtCon = dtConceptos.FiltraParametros("Tipo IN('P','D') AND EsPadre = 1 ").Copy();
+ dtCon.Columns.Add(new DataColumn("CodigoConcepto"));
+ foreach (DataRow trow in dtCon.Rows)
+ {
+ trow["CodigoConcepto"] = string.Format("{0} - {1}", trow["Codigo"], trow["Concepto"]);
+ }
+ dtCon.AcceptChanges();
+ #endregion
+ DdlmcConceptos.DataSource = dtCon;
+ DdlmcConceptos.DataBind();
+ if (SRCveConcepto > 0)
+ {
+ DdlmcConceptos.SelectedValueExist(SRCveConcepto);
+ }
+ PnlConceptoPersonal.Visible = true;
+ DdlmcConceptos_SelectedIndexChanged(DdlmcConceptos, null);
+ RegistraScript(string.Format("$('#ModalUpConcepto').on('shown.bs.modal', function () {{$('#{0}').trigger('focus')}});$('#ModalUpConcepto').modal();", TxtmcImporte.ClientID));
+ UPpanelModalUpConcepto.Update();
+ }
+ protected void DdlmcConceptos_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ int CvePersonal = SRCvePersonal;
+ int CveConcepto = DdlmcConceptos.SelectedValue.ToEntero();
+ TxtmcImporte.Text = "";
+ TxtmcImporteGrabado.Text = "";
+ Txtmcvalor.Text = "";
+ if (CveConcepto > 0)
+ {
+ DataRow drow = dtempleadosConceptos.FiltroPrimero(string.Format("CveConcepto={0} AND CvePersonal ={1}", CveConcepto, CvePersonal));
+ if (drow != null)
+ {
+ TxtmcImporte.Text = string.Format("{0:N2}", drow["Importe"]);
+ TxtmcImporteGrabado.Text = string.Format("{0:N2}", drow["ImporteGravado"]);
+ Txtmcvalor.Text = string.Format("{0:N2}", drow["Valor"]);
+ }
+ }
+ else
+ {
+ if (e != null)
+ {
+ Alert("Seleccione un concepto.", TipoMensaje.MsgAdvertencia);
+ }
+ }
+ UPpanelModalUpConcepto.Update();
+ }
+ protected void BtnAceptarMC_Click(object sender, EventArgs e)
+ {
+ bool continuar = true;
+ int CveNomina = 0;
+ double Total = 0;
+ int CveMoneda = 1;
+ int CveMetodoPago = 0;
+ int CvePersonal = SRCvePersonal;
+ if (CvePersonal <= 0)
+ {
+ CvePersonal = DdlmcPersonal.SelectedValue.ToEntero();
+ }
+ int CveConcepto = DdlmcConceptos.SelectedValue.ToEntero();
+ if (CveConcepto > 0 && CvePersonal > 0)
+ {
+ decimal ImporteConcepto = TxtmcImporte.Text.Replace("$", "").Replace(",", "").ToDecimal();
+ decimal ImporteGravadoConcepto = TxtmcImporteGrabado.Text.Replace("$", "").Replace(",", "").ToDecimal();
+ decimal ImporteExentoConcepto = ImporteConcepto - ImporteGravadoConcepto;
+ decimal ImporteValor = Txtmcvalor.Text.Replace("$", "").Replace(",", "").ToDecimal();
+ using (ClsNominas objNomina = new ClsNominas())
+ {
+
+ if (continuar)
+ {
+ if (objNomina.GetNom_Nominas(-1, CvePersonal, CvePeriodoSeleccionado, -1, UsuarioActual.CveEmpresa))
+ {
+ if (objNomina.DtResultados.Rows.Count > 0)
+ {
+ CveNomina = objNomina.CveNomina;
+ }
+ else
+ {
+ if (objNomina.AddNom_Nominas(-1, 1, CvePersonal, CvePeriodoSeleccionado, Total, 0, 0, Total, CveMoneda, 1, CveMetodoPago, DateTime.Now, "Deducciones nómina",
+ "", "", "", "", 0, 0, 0, new DateTime(), new DateTime(), new DateTime(), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, false))
+ {
+ CveNomina = objNomina.CveNomina;
+ }
+ else
+ {
+ continuar = false;
+ }
+ }
+ }
+ }
+ if (CveNomina == 0)
+ {
+ continuar = false;
+ }
+
+
+
+ if (continuar)
+ {
+
+ if (continuar)
+ {
+
+ if (!objNomina.AddUPNom_NominasDetalles(CveNomina, CvePeriodoSeleccionado, CvePersonal, CveConcepto, ImporteConcepto, ImporteGravadoConcepto, ImporteExentoConcepto, ImporteValor, UsuarioActual.CveUsuario, true))
+ {
+ continuar = false;
+ }
+ }
+ }
+ }
+
+ if (continuar)
+ {
+ cargaDatos();
+
+ cargasobrericiboconceptos();
+ UpModalConceptos.Update();
+
+ RegistraScript("$('#ModalUpConcepto').modal('hide');");
+ Alert("El cambio se ha guardado correctamente.");
+
+ }
+
+ }
+ else
+ {
+ if (CveConcepto > 0)
+ {
+ Alert("Debe seleccionar un empleado.", TipoMensaje.MsgAdvertencia);
+ }
+ else
+ {
+ Alert("Debe seleccionar un concepto.", TipoMensaje.MsgAdvertencia);
+ }
+ }
+
+ }
+ private void mostrarConceptos()
+ {
+ #region "Llenado de datos empleado"
+ string CodigoEmpleado = "";
+ string NombreCompleto = "";
+ string RFC = "";
+ string CURP = "";
+ string TipoPeriodo = "";
+ string NSS = "";
+ string DiasLaborados = "";
+ string DiasFaltados = "";
+ string DiasVacaciones = "";
+ string FechaInicio = "";
+ string FechaFin = "";
+ string DiasRetardos = "";
+ string DiasIncapacidad = "";
+ string Puesto = "";
+ string Departamento = "";
+ string SD = "";
+ string SDI = "";
+ string SalarioDiarioIMSS = "";
+ DataRow drow = dtempleados.FiltroPrimero(string.Format("CvePersonal = {0}", SRCvePersonal));
+ if (drow != null)
+ {
+ DiasLaborados = string.Format("{0}", drow["DiasLaborados"].ToString().ToEntero());
+ DiasFaltados = string.Format("{0}", drow["DiasFaltados"].ToString().ToEntero());
+ DiasVacaciones = string.Format("{0}", drow["DiasVacaciones"].ToString().ToEntero());
+ FechaInicio = string.Format("{0:dd/MM/yyyy}", drow["FechaInicio"]);
+ FechaFin = string.Format("{0:dd/MM/yyyy}", drow["FechaFin"]);
+ DiasRetardos = string.Format("{0}", drow["DiasRetardos"].ToString().ToEntero());
+ DiasIncapacidad = string.Format("{0}", drow["DiasIncapacidad"].ToString().ToEntero());
+ SD = string.Format("{0:####.####}", drow["SalarioDiario"]);
+ SDI = string.Format("{0:####.####}", drow["SalarioDiarioIntegrado"]);
+ SalarioDiarioIMSS = string.Format("{0:####.####}", drow["SalarioDiarioIMSS"]);
+ }
+
+ using (ClsRH objrh = new ClsRH())
+ {
+ if (objrh.GetPersonal(SRCvePersonal, UsuarioActual.CveEmpresa) && objrh.DtResultados.Rows.Count > 0)
+ {
+ DataRow erow = objrh.DtResultados.Rows[0];
+ CodigoEmpleado = erow["Codigo"].ToString();
+ NombreCompleto = erow["NombreCompleto"].ToString();
+ RFC = erow["RFC"].ToString();
+ CURP = erow["CURP"].ToString();
+ TipoPeriodo = erow["TipoPeriodo"].ToString();
+ NSS = erow["NSS"].ToString();
+ Puesto = erow["Puesto"].ToString();
+ Departamento = erow["Departamento"].ToString();
+ }
+ }
+ LblCodigoEmpleado.Text = CodigoEmpleado;
+ //LblNombreCompleto.Text = NombreCompleto;
+ LblRFC.Text = RFC;
+ LblCURP.Text = CURP;
+ LblTipoPeriodo.Text = TipoPeriodo;
+ LblNSS.Text = NSS;
+ LblDiasLaborados.Text = DiasLaborados;
+ LblDiasFaltados.Text = DiasFaltados;
+ LblDiasVacaciones.Text = DiasVacaciones;
+ LblFecha.Text = string.Format("{0} al {1}", FechaInicio, FechaFin);
+ LblDiasRetardos.Text = DiasRetardos;
+ LblDiasIncapacidad.Text = DiasIncapacidad;
+ LblSRPuesto.Text = Puesto;
+ LblSRDepartamento.Text = Departamento;
+ LblSRSalarioDiario.Text = SD;
+ LblSRSalarioDiarioIntegrado.Text = SDI;
+ LblSRSbc.Text = SalarioDiarioIMSS;
+
+ #endregion
+ #region "Sobre Recibo"
+ cargasobrericiboconceptos();
+ #endregion
+ #region "Infonavit"
+ {
+ using (ClsRH objper = new ClsRH())
+ {
+ objper.GetPersonalConceptos(SRCvePersonal, UsuarioActual.CveEmpresa);
+ DataRow frow = objper.DtResultados.FiltroPrimero("CveSistema =3");
+ TxtInfoValor.Text = "";
+ DdlInfoTipoAplicacion.SelectedValueExist("-1");
+ TxtInfoDescripcion.Text = "";
+ TxtInfoNumCredito.Text = "";
+ TxtInfoFechaInicio.Text = "";
+ ChkInfo.Checked = false;
+ if (frow != null)
+ {
+
+ TxtInfoValor.Text = String.Format("{0:###,###.##}", frow["Importe"]);
+ DdlInfoTipoAplicacion.SelectedValueExist(frow["TipoAplicacion"].ToString());
+
+ TxtInfoDescripcion.Text = String.Format("{0}", frow["Descripcion02"]);
+ TxtInfoNumCredito.Text = String.Format("{0}", frow["Descripcion01"]);
+ TxtInfoFechaInicio.Text = String.Format("{0:dd/MM/yyyy}", frow["FInicioAplicacion"]);
+ ChkInfo.Checked = frow["estatus"].ToString().ToUpper().Contiene("1", "TRUE");
+ }
+
+
+
+
+ frow = objper.DtResultados.FiltroPrimero("CveSistema =4");
+ TxtFonValor.Text = "";
+ DdlFonTipoAplicacion.SelectedValueExist("-1");
+ TxtFonDescripcion.Text = "";
+ TxtFonNumCredito.Text = "";
+ TxtFonFechaInicio.Text = "";
+ ChkFonacot.Checked = false;
+ if (frow != null)
+ {
+
+ TxtFonValor.Text = String.Format("{0:###,###.##}", frow["Importe"]);
+ DdlFonTipoAplicacion.SelectedValueExist(frow["TipoAplicacion"].ToString());
+
+ TxtFonDescripcion.Text = String.Format("{0}", frow["Descripcion02"]);
+ TxtFonNumCredito.Text = String.Format("{0}", frow["Descripcion01"]);
+ TxtFonFechaInicio.Text = String.Format("{0:dd/MM/yyyy}", frow["FInicioAplicacion"]);
+ ChkFonacot.Checked = frow["estatus"].ToString().ToUpper().Contiene("1", "TRUE");
+ }
+
+ }
+ }
+ #endregion
+
+ UpModalConceptos.Update();
+ }
+ public void cargasobrericiboconceptos()
+ {
+
+ {
+ DataTable dtper = dtConceptos.FiltraParametros("Tipo IN ('P') AND EsPadre = 1 ");
+ DataTable dtded = dtConceptos.FiltraParametros("Tipo IN ('D') AND EsPadre = 1 ");
+ dtper.Columns.Add("BorradoLogico", typeof(int));
+ dtded.Columns.Add("BorradoLogico", typeof(int));
+
+ foreach (DataRow row in dtper.Rows)
+ {
+ int BorradoLogico = 0;
+ int CveConcepto = row["CveConcepto"].ToString().ToEntero();
+ if (!(dtempleados.SUM(string.Format("[V_{0}]", CveConcepto), string.Format("CvePersonal = {0}", SRCvePersonal)) != 0)
+ && (dtempleadosConceptos.COUNT("CveConcepto", string.Format("CveConcepto={0} AND CvePersonal ={1} AND Estatus =2", CveConcepto, SRCvePersonal)) == 0)
+ )
+ {
+ BorradoLogico = 1;
+ }
+ row["BorradoLogico"] = BorradoLogico;
+ }
+ dtper.AcceptChanges();
+ foreach (DataRow row in dtded.Rows)
+ {
+ int BorradoLogico = 0;
+ int CveConcepto = row["CveConcepto"].ToString().ToEntero();
+ if (!(dtempleados.SUM(string.Format("[V_{0}]", CveConcepto), string.Format("CvePersonal = {0}", SRCvePersonal)) != 0)
+ && (dtempleadosConceptos.COUNT("CveConcepto", string.Format("CveConcepto={0} AND CvePersonal ={1} AND Estatus =2", CveConcepto, SRCvePersonal)) == 0)
+ )
+ {
+ BorradoLogico = 1;
+ }
+ row["BorradoLogico"] = BorradoLogico;
+ }
+ dtded.AcceptChanges();
+ dtper = dtper.FiltraParametros("BorradoLogico=0");
+ dtded = dtded.FiltraParametros("BorradoLogico=0");
+ int maxper = dtper.Rows.Count;
+ int maxded = dtded.Rows.Count;
+ int i = 0;
+ List lconc = new List();
+ for (i = 0; i < maxper || i < maxded; i++)
+ {
+ NConcepto nConcepto = new NConcepto();
+ DataRow row;
+ if (maxper > i)
+ {
+ row = dtper.Rows[i];
+ int CveConcepto = row["CveConcepto"].ToString().ToEntero();
+ string Concepto = row["Concepto"].ToString();
+ string Codigo = row["Codigo"].ToString();
+ //bool visible = (dtempleados.SUM(string.Format("[V_{0}]", CveConcepto)) > 0);
+ double Importe = dtempleados.SUM(string.Format("[V_{0}]", CveConcepto), string.Format("CvePersonal = {0}", SRCvePersonal));
+ nConcepto.CveConceptoP = CveConcepto;
+ nConcepto.ConceptoP = Concepto;
+ nConcepto.NoConceptoP = Codigo;
+ nConcepto.ImporteP = Importe;
+ nConcepto.ValorP = dtempleados.SUM(string.Format("[VAL_{0}]", CveConcepto), string.Format("CvePersonal = {0}", SRCvePersonal));
+ nConcepto.isOnlyBisibleP = row["SoloVisible"].ToString().ToEntero();
+
+
+ nConcepto.isSavedP = dtempleadosConceptos.COUNT("CveConcepto", string.Format("CveConcepto={0} AND CvePersonal ={1} AND Estatus >0", CveConcepto, SRCvePersonal));
+ nConcepto.isEditedP = dtempleadosConceptos.COUNT("CveConcepto", string.Format("CveConcepto={0} AND CvePersonal ={1} AND Estatus =2", CveConcepto, SRCvePersonal));
+ }
+ if (maxded > i)
+ {
+ row = dtded.Rows[i];
+ int CveConcepto = row["CveConcepto"].ToString().ToEntero();
+ string Concepto = row["Concepto"].ToString();
+ string Codigo = row["Codigo"].ToString();
+ //bool visible = (dtempleados.SUM(string.Format("[V_{0}]", CveConcepto)) > 0);
+ double Importe = dtempleados.SUM(string.Format("[V_{0}]", CveConcepto), string.Format("CvePersonal = {0}", SRCvePersonal));
+ nConcepto.CveConceptoD = CveConcepto;
+ nConcepto.ConceptoD = Concepto;
+ nConcepto.NoConceptoD = Codigo;
+ nConcepto.ImporteD = Importe;
+ nConcepto.ValorD = dtempleados.SUM(string.Format("[VAL_{0}]", CveConcepto), string.Format("CvePersonal = {0}", SRCvePersonal));
+ nConcepto.isOnlyBisibleD = row["SoloVisible"].ToString().ToEntero();
+ nConcepto.isSavedD = dtempleadosConceptos.COUNT("CveConcepto", string.Format("CveConcepto={0} AND CvePersonal ={1} AND Estatus >0", CveConcepto, SRCvePersonal));
+ nConcepto.isEditedD = dtempleadosConceptos.COUNT("CveConcepto", string.Format("CveConcepto={0} AND CvePersonal ={1} AND Estatus =2", CveConcepto, SRCvePersonal));
+ }
+ lconc.Add(nConcepto);
+ }
+
+ lconc.Add(new NConcepto());
+
+ NConcepto SubTotales = new NConcepto();
+ SubTotales.CveConceptoP = 0;
+ SubTotales.ConceptoP = "Total Percepciones";
+ SubTotales.EstatusP = -2;
+ SubTotales.ImporteP = dtempleados.SUM("SumaPercepciones", string.Format("CvePersonal = {0}", SRCvePersonal));
+ ///Alert(SubTotales.ImporteP.ToString());
+
+ SubTotales.CveConceptoD = 0;
+ SubTotales.ConceptoD = "Total Deducciones";
+ SubTotales.EstatusD = -2;
+ SubTotales.ImporteD = dtempleados.SUM("SumaDeducciones", string.Format("CvePersonal = {0}", SRCvePersonal));
+
+ NConcepto Totales = new NConcepto();
+ Totales.CveConceptoD = 0;
+ Totales.ConceptoD = "Total";
+ Totales.EstatusD = -3;
+ Totales.ImporteD = dtempleados.SUM("Total", string.Format("CvePersonal = {0}", SRCvePersonal));
+
+ lconc.Add(SubTotales);
+ lconc.Add(Totales);
+ GvConceptos.DataSource = lconc;
+ GvConceptos.DataBind();
+ }
+ }
+
+ protected void BtnImprimirsobrerecibo_Click(object sender, EventArgs e)
+ {
+
+ DataTable dtper = dtConceptos.FiltraParametros("Tipo IN ('P') AND EsPadre = 1 AND SoloVisible =0");
+ DataTable dtded = dtConceptos.FiltraParametros("Tipo IN ('D') AND EsPadre = 1 AND SoloVisible =0");
+ dtper.Columns.Add("BorradoLogico", typeof(int));
+ dtded.Columns.Add("BorradoLogico", typeof(int));
+
+ foreach (DataRow row in dtper.Rows)
+ {
+ int BorradoLogico = 0;
+ int CveConcepto = row["CveConcepto"].ToString().ToEntero();
+ if (!(dtempleados.SUM(string.Format("[V_{0}]", CveConcepto), string.Format("CvePersonal = {0}", SRCvePersonal)) != 0))
+ {
+ BorradoLogico = 1;
+ }
+ row["BorradoLogico"] = BorradoLogico;
+ }
+ dtper.AcceptChanges();
+ foreach (DataRow row in dtded.Rows)
+ {
+ int BorradoLogico = 0;
+ int CveConcepto = row["CveConcepto"].ToString().ToEntero();
+ if (!(dtempleados.SUM(string.Format("[V_{0}]", CveConcepto), string.Format("CvePersonal = {0}", SRCvePersonal)) != 0))
+ {
+ BorradoLogico = 1;
+ }
+ row["BorradoLogico"] = BorradoLogico;
+ }
+ dtded.AcceptChanges();
+ dtper = dtper.FiltraParametros("BorradoLogico=0");
+ dtded = dtded.FiltraParametros("BorradoLogico=0");
+ int maxper = dtper.Rows.Count;
+ int maxded = dtded.Rows.Count;
+ int i = 0;
+ List lconc = new List();
+ for (i = 0; i < maxper || i < maxded; i++)
+ {
+ NConcepto nConcepto = new NConcepto();
+ DataRow row;
+ if (maxper > i)
+ {
+ row = dtper.Rows[i];
+ int CveConcepto = row["CveConcepto"].ToString().ToEntero();
+ string Concepto = row["Concepto"].ToString();
+ string Codigo = row["Codigo"].ToString();
+ //bool visible = (dtempleados.SUM(string.Format("[V_{0}]", CveConcepto)) > 0);
+ double Importe = dtempleados.SUM(string.Format("[V_{0}]", CveConcepto), string.Format("CvePersonal = {0}", SRCvePersonal));
+ nConcepto.CveConceptoP = CveConcepto;
+ nConcepto.ConceptoP = Concepto;
+ nConcepto.NoConceptoP = Codigo;
+ nConcepto.ImporteP = Importe;
+ nConcepto.ValorP = dtempleados.SUM(string.Format("[VAL_{0}]", CveConcepto), string.Format("CvePersonal = {0}", SRCvePersonal));
+ }
+ if (maxded > i)
+ {
+ row = dtded.Rows[i];
+ int CveConcepto = row["CveConcepto"].ToString().ToEntero();
+ string Concepto = row["Concepto"].ToString();
+ string Codigo = row["Codigo"].ToString();
+ //bool visible = (dtempleados.SUM(string.Format("[V_{0}]", CveConcepto)) > 0);
+ double Importe = dtempleados.SUM(string.Format("[V_{0}]", CveConcepto), string.Format("CvePersonal = {0}", SRCvePersonal));
+ nConcepto.CveConceptoD = CveConcepto;
+ nConcepto.ConceptoD = Concepto;
+ nConcepto.NoConceptoD = Codigo;
+ nConcepto.ImporteD = Importe;
+ nConcepto.ValorD = dtempleados.SUM(string.Format("[VAL_{0}]", CveConcepto), string.Format("CvePersonal = {0}", SRCvePersonal));
+ }
+ lconc.Add(nConcepto);
+ }
+
+ lconc.Add(new NConcepto());
+
+ NConcepto SubTotales = new NConcepto();
+ SubTotales.CveConceptoP = 0;
+ SubTotales.ConceptoP = "Total Percepciones";
+ SubTotales.EstatusP = -2;
+ SubTotales.ImporteP = dtempleados.SUM("SumaPercepciones", string.Format("CvePersonal = {0}", SRCvePersonal));
+ ///Alert(SubTotales.ImporteP.ToString());
+
+ SubTotales.CveConceptoD = 0;
+ SubTotales.ConceptoD = "Total Deducciones";
+ SubTotales.EstatusD = -2;
+ SubTotales.ImporteD = dtempleados.SUM("SumaDeducciones", string.Format("CvePersonal = {0}", SRCvePersonal));
+
+ NConcepto Totales = new NConcepto();
+ Totales.CveConceptoD = 0;
+ Totales.ConceptoD = "Total";
+ Totales.EstatusD = -3;
+ Totales.ImporteD = dtempleados.SUM("Total", string.Format("CvePersonal = {0}", SRCvePersonal));
+
+ lconc.Add(SubTotales);
+ lconc.Add(Totales);
+
+ DataTable dtCon = new DataTable();
+ dtCon.Columns.Add(new DataColumn("NoConceptoP", typeof(string)));
+ dtCon.Columns.Add(new DataColumn("ConceptoP", typeof(string)));
+ dtCon.Columns.Add(new DataColumn("LabelValorP", typeof(string)));
+ dtCon.Columns.Add(new DataColumn("CveConceptoP", typeof(int)));
+ dtCon.Columns.Add(new DataColumn("ImporteP", typeof(double)));
+ dtCon.Columns.Add(new DataColumn("ValorP", typeof(double)));
+ dtCon.Columns.Add(new DataColumn("EstatusP", typeof(int)));
+ dtCon.Columns.Add(new DataColumn("isEditedP", typeof(int)));
+ dtCon.Columns.Add(new DataColumn("isOnlyBisibleP", typeof(int)));
+ dtCon.Columns.Add(new DataColumn("NoConceptoD", typeof(string)));
+ dtCon.Columns.Add(new DataColumn("ConceptoD", typeof(string)));
+ dtCon.Columns.Add(new DataColumn("LabelValorD", typeof(string)));
+ dtCon.Columns.Add(new DataColumn("CveConceptoD", typeof(int)));
+ dtCon.Columns.Add(new DataColumn("ImporteD", typeof(double)));
+ dtCon.Columns.Add(new DataColumn("ValorD", typeof(double)));
+ dtCon.Columns.Add(new DataColumn("EstatusD", typeof(int)));
+ dtCon.Columns.Add(new DataColumn("isEditedD", typeof(int)));
+ dtCon.Columns.Add(new DataColumn("isOnlyBisibleD", typeof(int)));
+ foreach (NConcepto itc in lconc)
+ {
+ DataRow dr = dtCon.NewRow();
+ dr["NoConceptoP"] = itc.NoConceptoP;
+ dr["ConceptoP"] = itc.ConceptoP;
+ dr["LabelValorP"] = itc.LabelValorP;
+ dr["CveConceptoP"] = itc.CveConceptoP;
+ dr["ImporteP"] = itc.ImporteP;
+ dr["ValorP"] = itc.ValorP;
+ dr["EstatusP"] = itc.EstatusP;
+ dr["isEditedP"] = itc.isEditedP;
+ dr["isOnlyBisibleP"] = itc.isOnlyBisibleP;
+ dr["NoConceptoD"] = itc.NoConceptoD;
+ dr["ConceptoD"] = itc.ConceptoD;
+ dr["LabelValorD"] = itc.LabelValorD;
+ dr["CveConceptoD"] = itc.CveConceptoD;
+ dr["ImporteD"] = itc.ImporteD;
+ dr["ValorD"] = itc.ValorD;
+ dr["EstatusD"] = itc.EstatusD;
+ dr["isEditedD"] = itc.isEditedD;
+ dr["isOnlyBisibleD"] = itc.isOnlyBisibleD;
+ dtCon.Rows.Add(dr);
+ }
+ dtCon.AcceptChanges();
+ List lrds = new List();
+ Microsoft.Reporting.WebForms.ReportDataSource rds = new Microsoft.Reporting.WebForms.ReportDataSource();
+ rds.Name = "DataSet1";
+ rds.Value = dtCon;// lconc;
+ lrds.Add(rds);
+ List parametros = new List();
+
+ string CodigoEmpleado = "";
+ string NombreCompleto = "";
+ string RFC = "";
+ string CURP = "";
+ string TipoPeriodo = "";
+ string NSS = "";
+ string DiasLaborados = "";
+ string DiasFaltados = "";
+ string DiasVacaciones = "";
+ string FechaInicio = "";
+ string FechaFin = "";
+ string DiasRetardos = "";
+ string DiasIncapacidad = "";
+ string SubProyecto = "";
+ {
+ DataRow drow = dtempleados.FiltroPrimero(string.Format("CvePersonal = {0}", SRCvePersonal));
+ if (drow != null)
+ {
+ DiasLaborados = string.Format("{0}", drow["DiasLaborados"].ToString().ToEntero());
+ DiasFaltados = string.Format("{0}", drow["DiasFaltados"].ToString().ToEntero());
+ DiasVacaciones = string.Format("{0}", drow["DiasVacaciones"].ToString().ToEntero());
+ FechaInicio = string.Format("{0:dd/MM/yyyy}", drow["FechaInicio"]);
+ FechaFin = string.Format("{0:dd/MM/yyyy}", drow["FechaFin"]);
+ DiasRetardos = string.Format("{0}", drow["DiasRetardos"].ToString().ToEntero());
+ DiasIncapacidad = string.Format("{0}", drow["DiasIncapacidad"].ToString().ToEntero());
+ }
+ }
+ //string Codigo = "";
+ using (ClsRH objrh = new ClsRH())
+ {
+ if (objrh.GetPersonal(SRCvePersonal, UsuarioActual.CveEmpresa) && objrh.DtResultados.Rows.Count > 0)
+ {
+ DataRow drow = objrh.DtResultados.Rows[0];
+ SubProyecto = drow["SubProyecto"].ToString();
+ CodigoEmpleado = drow["Codigo"].ToString();
+ NombreCompleto = drow["NombreCompleto"].ToString();
+ RFC = drow["RFC"].ToString();
+ CURP = drow["CURP"].ToString();
+ TipoPeriodo = drow["TipoPeriodo"].ToString();
+ NSS = drow["NSS"].ToString();
+ }
+ }
+ parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("DiasIncapacidad", DiasIncapacidad));
+ parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("Codigo", CodigoEmpleado));
+ parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("NombreCompleto", NombreCompleto));
+ parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("RFC", RFC));
+ parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("CURP", ""));
+ parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("TipoPeriodo", TipoPeriodo));
+ parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("NSS", NSS));
+ parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("DiasLaborados", DiasLaborados));
+ parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("DiasFaltados", DiasFaltados));
+ parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("DiasVacaciones", DiasVacaciones));
+ parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("FechaInicio", FechaInicio));
+ parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("FechaFin", FechaFin));
+ parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("DiasRetardos", DiasRetardos));
+ parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("Empresa", UsuarioActual.Empresa.Empresa));
+ parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("SubProyecto", SubProyecto));
+ parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("FechaPago", ""));
+ //parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("", ""));
+ //parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("", ""));
+ //parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("", ""));
+ //parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("", ""));
+ //parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("", ""));
+ string urlfile = System.IO.Path.Combine(ModExtensiones.DirectorioBaseEmpresas, string.Format("Empresas/{0}/Formatos/SobreRecibo.rdlc", UsuarioActual.CveEmpresa));
+ if (!System.IO.File.Exists(urlfile))
+ {
+ urlfile = System.IO.Path.Combine(ModExtensiones.DirectorioBaseEmpresas, "Empresas/Grales/Formatos/SobreRecibo.rdlc");
+ }
+
+ ImprimirPDF(urlfile, lrds, parametros, "SobreRecibo", "PDF", null);
+ }
+ protected void BtnGuardarInfornavit_Click(object sender, EventArgs e)
+ {
+ double importe = TxtInfoValor.Text.ToDouble();
+ int TipoAplicacion = DdlInfoTipoAplicacion.SelectedValue.ToEntero();
+ int NoPagos = 0;
+ double SaldoIni = 0;
+ string descripcion02 = TxtInfoDescripcion.Text;
+ string descripcion01 = TxtInfoNumCredito.Text;
+ string fecha = TxtInfoFechaInicio.Text.Replace("_", "");
+ int estatus = ChkInfo.Checked ? 1 : 0;
+ if (fecha.Length > 8)
+ fecha = fecha.ToDateTime().ToString("yyyy/MM/dd");
+ else
+ fecha = "";
+ bool continuar = true;
+ using (ClsRH ObjPersonal = new ClsRH())
+ {
+ if (!ObjPersonal.AddConcepto(SRCvePersonal, -1, importe, TipoAplicacion, NoPagos, SaldoIni, UsuarioActual.CveUsuario, 3, descripcion01, descripcion02, fecha, "", estatus, UsuarioActual.CveEmpresa))
+ continuar = false;
+ }
+ if (continuar)
+ {
+ LnkConsultar_Click(null, null);
+ mostrarConceptos();
+ Alert("Se actualizo el calculo de infonavit");
+ }
+ }
+
+
+ private class NConcepto
+ {
+ public string NoConceptoP { get; set; }
+ public string ConceptoP { get; set; }
+ public string LabelValorP { get; set; }
+ public int CveConceptoP { get; set; }
+ public double ImporteP { get; set; }
+ public double ValorP { get; set; }
+ public int EstatusP { get; set; }
+ public int isSavedP { get; set; }
+ public int isEditedP { get; set; }
+ public int isOnlyBisibleP { get; set; }
+
+
+ public string NoConceptoD { get; set; }
+ public string ConceptoD { get; set; }
+ public string LabelValorD { get; set; }
+ public int CveConceptoD { get; set; }
+ public double ImporteD { get; set; }
+ public double ValorD { get; set; }
+ public int EstatusD { get; set; }
+ public int isSavedD { get; set; }
+ public int isEditedD { get; set; }
+ public int isOnlyBisibleD { get; set; }
+
+
+
+
+
+ public string NoConceptoO { get; set; }
+ public string ConceptoO { get; set; }
+ public string LabelValorO { get; set; }
+ public int CveConceptoO { get; set; }
+ public double ImporteO { get; set; }
+ public double ValorO { get; set; }
+ public int EstatusO { get; set; }
+ public int isEditedO { get; set; }
+ public int isOnlyBisibleO { get; set; }
+ }
+
+ int CveConceptoPolgvc, CveConceptoDolgvc;
+ protected void GvConceptos_RowDataBound(object sender, GridViewRowEventArgs e)
+ {
+ if (e.Row.RowType == DataControlRowType.DataRow)
+ {
+ if (e.Row.RowIndex == 0)
+ {
+ CveConceptoPolgvc = 1;
+ CveConceptoDolgvc = 1;
+ }
+ // Datakeys
+ // Concepto,CveConcepto,Importe,Estatus,ConceptoD,CveConceptoD,ImporteD,EstatusD
+ int CveConcepto = e.Row.DataKey("CveConceptoP").ToEntero();
+ int CveConceptoD = e.Row.DataKey("CveConceptoD").ToEntero();
+ // Dim Importe As Decimal = e.Row.DataKey("Importe").ToDecimal()
+ // Dim ImporteD As Decimal = e.Row.DataKey("ImporteD").ToDecimal()
+ int Estatus = e.Row.DataKey("EstatusP").ToEntero();
+ int EstatusD = e.Row.DataKey("EstatusD").ToEntero();
+ int isOnlyBisibleP = e.Row.DataKey("isOnlyBisibleP").ToEntero();
+ int isOnlyBisibleD = e.Row.DataKey("isOnlyBisibleD").ToEntero();
+ bool isEditedP = e.Row.DataKey("isEditedP").ToEntero() > 0;
+ bool isEditedD = e.Row.DataKey("isEditedD").ToEntero() > 0;
+ bool isSavedP = e.Row.DataKey("isSavedP").ToEntero() > 0;
+ bool isSavedD = e.Row.DataKey("isSavedD").ToEntero() > 0;
+
+ //isEditedD
+ // Controles
+ Label LtlConcepto = e.Row.FCLabel("LtlConcepto");
+ LinkButton LnkConcepto = e.Row.FCLinkButton("LnkConcepto");
+ Label LtlConceptoD = e.Row.FCLabel("LtlConceptoD");
+ LinkButton LnkConceptoD = e.Row.FCLinkButton("LnkConceptod");
+ Label LtlImporte = e.Row.FCLabel("LtlImporte");
+ LinkButton LnkImporte = e.Row.FCLinkButton("LnkImporte");
+ Label LtlImporteD = e.Row.FCLabel("LtlImporteD");
+ LinkButton LnkImporteD = e.Row.FCLinkButton("LnkImporteD");
+
+ LinkButton LnkImportexCalculo = e.Row.FCLinkButton("LnkImportexCalculo");
+ LinkButton LnkImporteDxCalculo = e.Row.FCLinkButton("LnkImporteDxCalculo");
+
+ //isEditedD
+ if (isOnlyBisibleP == 1)
+ {
+ e.Row.CssClass = string.Format("{0} isOnlyBisibleP", e.Row.CssClass);
+ }
+ if (isOnlyBisibleD == 1)
+ {
+ e.Row.CssClass = string.Format("{0} isOnlyBisibleD", e.Row.CssClass);
+ }
+ if (isEditedP)
+ {
+ e.Row.CssClass = string.Format("{0} isEditedP", e.Row.CssClass);
+ }
+ if (isEditedD)
+ {
+ e.Row.CssClass = string.Format("{0} isEditedD", e.Row.CssClass);
+ }
+
+ if (Estatus == -1) { LtlConcepto.Visible = false; }
+ else if (Estatus > 0) { LtlImporte.Visible = false; }
+
+ if (EstatusD == -1) { LtlConceptoD.Visible = false; }
+ else if (EstatusD > 0) { LtlImporteD.Visible = false; }
+
+ LtlImporte.Visible = false;
+ LtlImporteD.Visible = false;
+ if (Estatus < -1 | EstatusD < -1)
+ {
+ e.Row.CssClass = "ConceptosTotales";
+ LtlImporte.Visible = true;
+ LtlImporteD.Visible = true;
+ }
+ LnkImporte.CommandArgument = (CveConcepto > 0 ? CveConcepto.ToString() : "P");
+ LnkImporteD.CommandArgument = (CveConceptoD > 0 ? CveConceptoD.ToString() : "D");
+ if (LnkImportexCalculo != null)
+ {
+ LnkImportexCalculo.CommandArgument = LnkImporte.CommandArgument;
+ LnkImporteDxCalculo.CommandArgument = LnkImporteD.CommandArgument;
+ }
+
+ LnkImporte.Text = (CveConcepto > 0 ? string.Format("${0:N2}", e.Row.DataKey("ImporteP").ToDecimal()) : (CveConceptoPolgvc > 0 ? " " : ""));
+ LnkImporteD.Text = (CveConceptoD > 0 ? string.Format("${0:N2}", e.Row.DataKey("ImporteD").ToDecimal()) : (CveConceptoDolgvc > 0 ? " " : ""));
+ if (NomAutorizado)
+ {
+ LtlImporte.Visible = true;
+ LtlImporteD.Visible = true;
+ LtlImporte.Text = (CveConcepto > 0 ? string.Format("${0:N2}", e.Row.DataKey("ImporteP").ToDecimal()) : (CveConceptoPolgvc > 0 ? "" : ""));
+ LtlImporte.Text = (CveConceptoD > 0 ? string.Format("${0:N2}", e.Row.DataKey("ImporteD").ToDecimal()) : (CveConceptoDolgvc > 0 ? "" : ""));
+ LnkImporte.Visible = false;
+ LnkImporteD.Visible = false;
+ LnkImportexCalculo.Visible = false;
+ LnkImporteDxCalculo.Visible = false;
+ }
+ else
+ {
+
+ LnkImportexCalculo.Visible = isSavedP;
+ LnkImporteDxCalculo.Visible = isSavedD;
+ }
+
+
+ if (CveConcepto == 0 && (Estatus == 0 || Estatus == -1 || Estatus == -3)) { LtlImporte.Text = ""; }
+
+ if (CveConceptoD == 0 && (EstatusD == 0 || EstatusD == -1)) { LtlImporteD.Text = ""; }
+
+
+
+ LnkConcepto.Visible = !LtlConcepto.Visible;
+ LnkConceptoD.Visible = !LtlConceptoD.Visible;
+ LnkImporte.Visible = !LtlImporte.Visible;
+ LnkImporteD.Visible = !LtlImporteD.Visible;
+
+ LinkButton LnkConceptoO = e.Row.FCLinkButton("LnkConceptoO");
+ LinkButton LnkImporteO = e.Row.FCLinkButton("LnkImporteO");
+ if (LnkConceptoO != null)
+ {
+ LnkConceptoO.Visible = false;
+ LnkImporteO.Visible = false;
+ if (e.Row.DBCampo("ImporteO").ToDecimal() == 0)
+ {
+ e.Row.FCLabel("LtlConceptoO").Visible = false;
+ e.Row.FCLabel("LtlImporteO").Visible = false;
+ if (e.Row.DataKey("isOnlyBisibleO").ToEntero() == 1)
+ {
+ e.Row.CssClass = string.Format("{0} isOnlyBisibleO", e.Row.CssClass);
+ }
+ }
+ }
+
+ CveConceptoPolgvc = CveConcepto;
+ CveConceptoDolgvc = CveConceptoD;
+ }
+ }
+
+
+ protected void GvConceptosSimula_RowDataBound(object sender, GridViewRowEventArgs e)
+ {
+ if (e.Row.RowType == DataControlRowType.DataRow)
+ {
+ if (e.Row.RowIndex == 0)
+ {
+ CveConceptoPolgvc = 1;
+ CveConceptoDolgvc = 1;
+ }
+ // Datakeys
+ // Concepto,CveConcepto,Importe,Estatus,ConceptoD,CveConceptoD,ImporteD,EstatusD
+ int CveConcepto = e.Row.DataKey("CveConceptoP").ToEntero();
+ int CveConceptoD = e.Row.DataKey("CveConceptoD").ToEntero();
+ // Dim Importe As Decimal = e.Row.DataKey("Importe").ToDecimal()
+ // Dim ImporteD As Decimal = e.Row.DataKey("ImporteD").ToDecimal()
+ int Estatus = e.Row.DataKey("EstatusP").ToEntero();
+ int EstatusD = e.Row.DataKey("EstatusD").ToEntero();
+ int isOnlyBisibleP = e.Row.DataKey("isOnlyBisibleP").ToEntero();
+ int isOnlyBisibleD = e.Row.DataKey("isOnlyBisibleD").ToEntero();
+ bool isEditedP = e.Row.DataKey("isEditedP").ToEntero() > 0;
+ bool isEditedD = e.Row.DataKey("isEditedD").ToEntero() > 0;
+ //isEditedD
+ // Controles
+ Label LtlConcepto = e.Row.FCLabel("LtlConcepto");
+ LinkButton LnkConcepto = e.Row.FCLinkButton("LnkConcepto");
+ Label LtlConceptoD = e.Row.FCLabel("LtlConceptoD");
+ LinkButton LnkConceptoD = e.Row.FCLinkButton("LnkConceptod");
+ Label LtlImporte = e.Row.FCLabel("LtlImporte");
+ LinkButton LnkImporte = e.Row.FCLinkButton("LnkImporte");
+ Label LtlImporteD = e.Row.FCLabel("LtlImporteD");
+ LinkButton LnkImporteD = e.Row.FCLinkButton("LnkImporteD");
+
+ LinkButton LnkImportexCalculo = e.Row.FCLinkButton("LnkImportexCalculo");
+ LinkButton LnkImporteDxCalculo = e.Row.FCLinkButton("LnkImporteDxCalculo");
+
+ //isEditedD
+ if (isOnlyBisibleP == 1)
+ {
+ e.Row.CssClass = string.Format("{0} isOnlyBisibleP", e.Row.CssClass);
+ }
+ if (isOnlyBisibleD == 1)
+ {
+ e.Row.CssClass = string.Format("{0} isOnlyBisibleD", e.Row.CssClass);
+ }
+ if (isEditedP)
+ {
+ e.Row.CssClass = string.Format("{0} isEditedP", e.Row.CssClass);
+ }
+ if (isEditedD)
+ {
+ e.Row.CssClass = string.Format("{0} isEditedD", e.Row.CssClass);
+ }
+
+ if (Estatus == -1) { LtlConcepto.Visible = false; }
+ else if (Estatus > 0) { LtlImporte.Visible = false; }
+
+ if (EstatusD == -1) { LtlConceptoD.Visible = false; }
+ else if (EstatusD > 0) { LtlImporteD.Visible = false; }
+
+ LtlImporte.Visible = false;
+ LtlImporteD.Visible = false;
+ if (Estatus < -1 | EstatusD < -1)
+ {
+ e.Row.CssClass = "ConceptosTotales";
+ LtlImporte.Visible = true;
+ LtlImporteD.Visible = true;
+ }
+ LnkImporte.CommandArgument = (CveConcepto > 0 ? CveConcepto.ToString() : "P");
+ LnkImporteD.CommandArgument = (CveConceptoD > 0 ? CveConceptoD.ToString() : "D");
+ if (LnkImportexCalculo != null)
+ {
+ LnkImportexCalculo.CommandArgument = LnkImporte.CommandArgument;
+ LnkImporteDxCalculo.CommandArgument = LnkImporteD.CommandArgument;
+ LnkImportexCalculo.Visible = isEditedP;
+ LnkImporteDxCalculo.Visible = isEditedD;
+
+ }
+
+ LnkImporte.Text = (CveConcepto > 0 ? string.Format("${0:N2}", e.Row.DataKey("ImporteP").ToDecimal()) : (CveConceptoPolgvc > 0 ? "" : ""));
+ LnkImporteD.Text = (CveConceptoD > 0 ? string.Format("${0:N2}", e.Row.DataKey("ImporteD").ToDecimal()) : (CveConceptoDolgvc > 0 ? "" : ""));
+
+
+
+ if (CveConcepto == 0 && (Estatus == 0 || Estatus == -1 || Estatus == -3)) { LtlImporte.Text = ""; }
+
+ if (CveConceptoD == 0 && (EstatusD == 0 || EstatusD == -1)) { LtlImporteD.Text = ""; }
+
+
+
+ LnkConcepto.Visible = !LtlConcepto.Visible;
+ LnkConceptoD.Visible = !LtlConceptoD.Visible;
+
+ LtlImporte.Visible = true;
+ LtlImporteD.Visible = true;
+ LtlImporte.Text = LnkImporte.Text;
+ LtlImporteD.Text = LtlImporteD.Text;
+
+ LnkImporte.Visible = !LtlImporte.Visible;
+ LnkImporteD.Visible = !LtlImporteD.Visible;
+
+ LinkButton LnkConceptoO = e.Row.FCLinkButton("LnkConceptoO");
+ LinkButton LnkImporteO = e.Row.FCLinkButton("LnkImporteO");
+ if (LnkConceptoO != null)
+ {
+ LnkConceptoO.Visible = false;
+ LnkImporteO.Visible = false;
+ if (e.Row.DBCampo("ImporteO").ToDecimal() == 0)
+ {
+ e.Row.FCLabel("LtlConceptoO").Visible = false;
+ e.Row.FCLabel("LtlImporteO").Visible = false;
+ if (e.Row.DataKey("isOnlyBisibleO").ToEntero() == 1)
+ {
+ e.Row.CssClass = string.Format("{0} isOnlyBisibleO", e.Row.CssClass);
+ }
+ }
+ }
+
+ CveConceptoPolgvc = CveConcepto;
+ CveConceptoDolgvc = CveConceptoD;
+ }
+ }
+
+ protected void BtnGuardarMetododepago_Click(object sender, EventArgs e)
+ {
+ using (ClsNominas nom = new ClsNominas())
+ {
+ if (nom.NominaUpMetododepago(UsuarioActual.CveEmpresa, SRCvePersonal, SRCvePeriodo, ChkMetodoPago.Checked,
+ DdlMetodoPago.SelectedValue.ToEntero(), DdlBanco.SelectedValue.ToEntero(), TxtBancoNumCuenta.Text, TxtCLABE.Text))
+ {
+ Alert("La informacion se ha actualizado correctamente");
+ }
+ else
+ {
+ }
+
+ }
+ }
+ #endregion
+
+ protected void LnkFormatoTabular_Click(object sender, EventArgs e)
+ {
+ try
+ {
+ ClosedXML.Excel.XLWorkbook wb = new ClosedXML.Excel.XLWorkbook();
+ var libro = wb.AddWorksheet("Nomina");
+ int column = 1;
+ int filainicio = 3;
+ libro.Cell(filainicio + 1, column).Value = " ";
+ libro.Cell(filainicio + 2, column).Value = "Codigo";
+ libro.Cell(filainicio + 3, column).Value = " ";
+ column++;
+ libro.Cell(filainicio + 1, column).Value = " ";
+ libro.Cell(filainicio + 2, column).Value = "Empleado";
+ libro.Cell(filainicio + 3, column).Value = " ";
+ libro.Column(column).Width = 35;
+ libro.Cell(1, 1).Value = "Empresa";
+ libro.Range(1, 2, 1, 4).Merge().Value = UsuarioActual.Empresa.Empresa;
+ libro.Cell(2, 1).Value = "período";
+ string periodo = DdlPeriodo.SelectedItem.Text;
+ periodo = periodo.Substring(0, (periodo.Length > 27 ? 27 : periodo.Length));
+ libro.Range(2, 2, 2, 4).Merge().Value = periodo;
+
+ int iniciotipe = column;
+ foreach (DataRow row in dtConceptos.FiltraParametros("Tipo ='P' AND EsPadre = 1 ").Rows)
+ {
+
+ column++;
+ libro.Cell(filainicio + 2, column).Value = row["Concepto"].ToString();
+ libro.Cell(filainicio + 3, column).Value = row["Codigo"].ToString();
+ libro.Column(column).Width = 15;
+ if ((dtempleados.SUM(string.Format("[V_{0}]", row["CveConcepto"].ToString())) == 0))
+ {
+ libro.Column(column).Hide();
+ }
+
+ }
+ column++;
+ libro.Range(filainicio + 2, column, filainicio + 3, column).Merge().Value = "Percepciones";
+ libro.Column(column).Width = 15;
+ if (iniciotipe < column)
+ {
+ libro.Range(filainicio + 1, iniciotipe + 1, filainicio + 1, column).Style.Alignment.Horizontal = ClosedXML.Excel.XLAlignmentHorizontalValues.Center;
+ libro.Range(filainicio + 1, iniciotipe + 1, filainicio + 1, column).Merge().Value = "Percepciones";
+ }
+ iniciotipe = column;
+
+
+ foreach (DataRow row in dtConceptos.FiltraParametros("Tipo = 'D' AND EsPadre = 1 ").Rows)
+ {
+ column++;
+ libro.Cell(filainicio + 2, column).Value = row["Concepto"].ToString();
+ libro.Cell(filainicio + 3, column).Value = row["Codigo"].ToString();
+ libro.Column(column).Width = 15;
+ if ((dtempleados.SUM(string.Format("[V_{0}]", row["CveConcepto"].ToString())) == 0))
+ {
+ libro.Column(column).Hide();
+ }
+
+ }
+
+ column++;
+ libro.Range(filainicio + 2, column, filainicio + 3, column).Merge().Value = "Deducciones";
+ libro.Column(column).Width = 15;
+
+ if (iniciotipe < column)
+ {
+ libro.Range(filainicio + 1, iniciotipe + 1, filainicio + 1, column).Style.Alignment.Horizontal = ClosedXML.Excel.XLAlignmentHorizontalValues.Center;
+ libro.Range(filainicio + 1, iniciotipe + 1, filainicio + 1, column).Merge().Value = "Deducciones";
+ }
+
+ column++;
+ libro.Cell(filainicio + 1, column).Value = " ";
+ libro.Range(filainicio + 2, column, filainicio + 3, column).Merge().Value = "Total";
+ libro.Column(column).Width = 15;
+ iniciotipe = column;
+
+ foreach (DataRow row in dtConceptos.FiltraParametros("Tipo = 'O' AND EsPadre = 1 ").Rows)
+ {
+ column++;
+ libro.Cell(filainicio + 2, column).Value = row["Concepto"].ToString();
+ libro.Cell(filainicio + 3, column).Value = row["Codigo"].ToString();
+ libro.Column(column).Width = 15;
+ if ((dtempleados.SUM(string.Format("[V_{0}]", row["CveConcepto"].ToString())) == 0))
+ {
+ libro.Column(column).Hide();
+ }
+
+ }
+ column++;
+ libro.Range(filainicio + 2, column, filainicio + 3, column).Merge().Value = "Obligaciones";
+ libro.Column(column).Width = 15;
+
+
+ if (iniciotipe < column)
+ {
+ libro.Range(filainicio + 1, iniciotipe + 1, filainicio + 1, column).Style.Alignment.Horizontal = ClosedXML.Excel.XLAlignmentHorizontalValues.Center;
+ libro.Range(filainicio + 1, iniciotipe + 1, filainicio + 1, column).Merge().Value = "Obligaciones";
+ }
+
+ //libro.Row(1).CellsUsed().Style.Font.FontColor = ClosedXML.Excel.XLColor.White;
+ //libro.Row(2).CellsUsed().Style.Font.FontColor = ClosedXML.Excel.XLColor.White;
+ //libro.Row(3).CellsUsed().Style.Font.FontColor = ClosedXML.Excel.XLColor.White;
+ //libro.Row(1).CellsUsed().Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(177, 160, 199));
+ //libro.Row(2).CellsUsed().Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(79, 129, 189));
+ //libro.Row(3).Cell(1).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(79, 129, 189));
+ //libro.Row(3).CellsUsed().Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(79, 129, 189));
+ int maxnocolumn = column;
+
+ int Fila = filainicio + 3;
+ int cveSupProyecto = -5;
+ string subproyecto = "";
+ int oldcveSupProyecto = -5;
+ bool newsubproyecto = false;
+ bool newsubproyectoTitulo = false;
+ DataTable dtsr = dtempleados.FiltraParametros("", "CveSubProyecto");
+ dtsr.Rows.Add(dtsr.NewRow());
+ foreach (DataRow erow in dtsr.Rows)
+ {
+ Fila++;
+ newsubproyecto = false; newsubproyectoTitulo = false;
+ if (cveSupProyecto != erow["CveSubProyecto"].ToString().ToEntero())
+ {
+
+ if (oldcveSupProyecto != -5) { Fila += 2; newsubproyecto = true; }
+ oldcveSupProyecto = cveSupProyecto;
+ cveSupProyecto = erow["CveSubProyecto"].ToString().ToEntero();
+ subproyecto = erow["SubProyecto"].ToString();
+ if (cveSupProyecto != -5 && oldcveSupProyecto != -5) { Fila++; newsubproyectoTitulo = true; }
+ }
+ column = 1;
+ libro.Cell(Fila, column).Value = string.Format("'{0}", erow["Codigo"]);
+ column++;
+ if (newsubproyectoTitulo)
+ {
+ libro.Cell(Fila - 1, column).Value = subproyecto;
+ libro.Range(Fila - 1, 1, Fila - 1, maxnocolumn).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(155, 194, 230));
+ }
+ if (newsubproyecto)
+ {
+ libro.Cell(Fila - 3, column).Value = "Total";
+ libro.Range(Fila - 3, 1, Fila - 3, maxnocolumn).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(155, 194, 230));
+ }
+ libro.Cell(Fila, column).Value = erow["Nombre"];
+ foreach (DataRow row in dtConceptos.FiltraParametros("Tipo = 'P' AND EsPadre = 1 ").Rows)
+ {
+ column++;
+ string Concepto = string.Format("V_{0}", row["CveConcepto"]);
+ libro.Cell(Fila, column).Value = erow[Concepto];
+
+
+ if (newsubproyecto)
+ {
+ libro.Cell(Fila - 3, column).Value = dtempleados.SUM(Concepto, string.Format("CveSubProyecto ={0} AND CvePersonal > 0 ", oldcveSupProyecto));
+ }
+
+ }
+
+ column++;
+ libro.Cell(Fila, column).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(166, 166, 166));
+ libro.Cell(Fila, column).Value = erow["SumaPercepciones"];
+ if (newsubproyecto)
+ {
+ libro.Cell(Fila - 3, column).Value = dtempleados.SUM("SumaPercepciones", string.Format("CveSubProyecto ={0} AND CvePersonal > 0 ", oldcveSupProyecto));
+ }
+
+
+ foreach (DataRow row in dtConceptos.FiltraParametros("Tipo = 'D' AND EsPadre = 1 ").Rows)
+ {
+ column++;
+ string Concepto = string.Format("V_{0}", row["CveConcepto"]);
+ libro.Cell(Fila, column).Value = erow[Concepto];
+
+ if (newsubproyecto)
+ {
+ libro.Cell(Fila - 3, column).Value = dtempleados.SUM(Concepto, string.Format("CveSubProyecto ={0} AND CvePersonal > 0 ", oldcveSupProyecto));
+ }
+ }
+
+ column++;
+ libro.Cell(Fila, column).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(166, 166, 166));
+ libro.Cell(Fila, column).Value = erow["SumaDeducciones"];
+ if (newsubproyecto)
+ {
+ libro.Cell(Fila - 3, column).Value = dtempleados.SUM("SumaDeducciones", string.Format("CveSubProyecto ={0} AND CvePersonal > 0 ", oldcveSupProyecto));
+ }
+
+ column++;
+ libro.Cell(Fila, column).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(166, 166, 166));
+ libro.Cell(Fila, column).Value = erow["Total"];
+ if (newsubproyecto)
+ {
+ libro.Cell(Fila - 3, column).Value = dtempleados.SUM("Total", string.Format("CveSubProyecto ={0} AND CvePersonal > 0 ", oldcveSupProyecto));
+ }
+
+ foreach (DataRow row in dtConceptos.FiltraParametros("Tipo = 'O' AND EsPadre = 1 ").Rows)
+ {
+ column++;
+ string Concepto = string.Format("V_{0}", row["CveConcepto"]);
+ libro.Cell(Fila, column).Value = erow[Concepto];
+
+ if (newsubproyecto)
+ {
+ libro.Cell(Fila - 3, column).Value = dtempleados.SUM(Concepto, string.Format("CveSubProyecto ={0} AND CvePersonal > 0 ", oldcveSupProyecto));
+ }
+ }
+
+ column++;
+ libro.Cell(Fila, column).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(166, 166, 166));
+ libro.Cell(Fila, column).Value = erow["SumaObligaciones"];
+ if (newsubproyecto)
+ {
+ libro.Cell(Fila - 3, column).Value = dtempleados.SUM("SumaObligaciones", string.Format("CveSubProyecto ={0} AND CvePersonal > 0 ", oldcveSupProyecto));
+ }
+ }
+
+
+ libro.Range(filainicio + 1, 1, filainicio + 4, maxnocolumn).Style.Font.FontColor = ClosedXML.Excel.XLColor.White;
+ libro.Range(filainicio + 1, 1, filainicio + 4, maxnocolumn).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(79, 129, 189));
+
+ System.IO.Stream fs = new System.IO.MemoryStream();
+ wb.SaveAs(fs);
+ 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} {1}.xlsx", "Nomina tabular", periodo));
+ Response.BinaryWrite(memoryStream.ToArray());
+ Response.End();
+ }
+ catch (Exception ex)
+ {
+ Alert("Ocurrio un error al generar el Formato de nominas" + ex.ToString());
+ }
+ }
+
+
+ protected void LnkConceptoD_Click(object sender, EventArgs e)
+ {
+
+ }
+
+ public void loadtablas()
+ {
+
+ using (ClsNominas objnom = new ClsNominas())
+ {
+ if (objnom.GetTablasNomina(UsuarioActual.CveEmpresa) && objnom.DTSetResultados.Tables.Count > 1)
+ {
+ GVFactorDesctInfonavit.DataSource = objnom.DTSetResultados.Tables[0];
+ GVSalariosMinimos.DataSource = objnom.DTSetResultados.Tables[1];
+ GVIMMSRiesgot.DataSource = objnom.DTSetResultados.Tables[2];
+ GVInfonavitSegViv.DataSource = objnom.DTSetResultados.Tables[3];
+ GVVigISRMensual.DataSource = objnom.DTSetResultados.Tables[4];
+ GVVigSubEmpMensual.DataSource = objnom.DTSetResultados.Tables[5];
+ GVVigISRSemanal.DataSource = objnom.DTSetResultados.Tables[7];
+ GVVigISRDecenal.DataSource = objnom.DTSetResultados.Tables[8];
+ GVVigISRQuincenal.DataSource = objnom.DTSetResultados.Tables[9];
+
+
+
+ }
+ if (objnom.RH_TablasValoresGet(UsuarioActual.CveEmpresa, 1))
+ {
+ GVUma.DataSource = objnom.DtResultados;
+ }
+
+ }
+ GVFactorDesctInfonavit.DataBind();
+ GVSalariosMinimos.DataBind();
+ GVIMMSRiesgot.DataBind();
+ GVInfonavitSegViv.DataBind();
+ GVVigISRMensual.DataBind();
+ GVVigSubEmpMensual.DataBind();
+ GVVigISRSemanal.DataBind();
+ GVVigISRDecenal.DataBind();
+ GVVigISRQuincenal.DataBind();
+ GVUma.DataBind();
+ UpModalTablas.Update();
+ }
+
+ protected void LnkAddUMA_Click(object sender, EventArgs e)
+ {
+ using (ClsNominas objnom = new ClsNominas())
+ {
+ if (objnom.RH_TablasValoresAdd(UsuarioActual.CveEmpresa, TxtFechaUma.Text.ToDateTime(), 1, TxtValorUma.Text.ToDecimal()))
+ {
+ if (objnom.RH_TablasValoresGet(UsuarioActual.CveEmpresa, 1))
+ {
+ GVUma.DataSource = objnom.DtResultados;
+ GVUma.DataBind();
+ }
+ Alert("La UMA se ha actualizado.");
+ }
+
+ }
+ }
+ protected void LnkEliminarUma_Click(object sender, EventArgs e)
+ {
+ GridViewRow gvrow = (GridViewRow)((LinkButton)sender).NamingContainer;
+ DateTime fecha = gvrow.DataKey("Fecha").ToDateTime();
+ //DateTime tipo = gvrow.DataKey("Tipo").ToDateTime();
+
+ using (ClsNominas objnom = new ClsNominas())
+ {
+
+ if (objnom.RH_TablasValoresRemove(UsuarioActual.CveEmpresa, TxtFechaUma.Text.ToDateTime(), 1))
+ {
+ if (objnom.RH_TablasValoresGet(UsuarioActual.CveEmpresa, 1))
+ {
+ GVUma.DataSource = objnom.DtResultados;
+ GVUma.DataBind();
+ }
+ Alert("La UMA se ha eliminado.");
+ }
+ }
+ }
+ protected void LnkVerTablas_Click(object sender, EventArgs e)
+ {
+ loadtablas();
+ RegistraScript("$('#ModalTablas').modal();");
+ }
+ protected void LnkVerCalculoISR_Click(object sender, EventArgs e)
+ {
+ DataTable dt = dtempleados.FiltraParametros("CvePersonal >0", "", new string[] { "CvePersonal", "Nombre", "Codigo", "SumaPercepcionesG" });
+
+ //dt.Columns.Add("SumaPercepcionesG");
+ dt.Columns.Add("LimiteInferior", typeof(decimal));
+ dt.Columns.Add("ExedenteLI", typeof(decimal));
+ dt.Columns.Add("PorcentajeSE", typeof(decimal));
+ dt.Columns.Add("ImpuestoMarginal", typeof(decimal));
+ dt.Columns.Add("cuotafija", typeof(decimal));
+
+ dt.Columns.Add("Impuestoantessubs", typeof(decimal));
+ dt.Columns.Add("subsidio", typeof(decimal));
+ dt.Columns.Add("Impuesto", typeof(decimal));
+
+ DataTable dtquin = null;
+ using (ClsNominas objnom = new ClsNominas())
+ {
+ if (objnom.GetTablasNomina(UsuarioActual.CveEmpresa) && objnom.DTSetResultados.Tables.Count > 1)
+ {
+ //GVFactorDesctInfonavit.DataSource = objnom.DTSetResultados.Tables[0];
+ //GVSalariosMinimos.DataSource = objnom.DTSetResultados.Tables[1];
+ //GVIMMSRiesgot.DataSource = objnom.DTSetResultados.Tables[2];
+ //GVInfonavitSegViv.DataSource = objnom.DTSetResultados.Tables[3];
+ //GVVigISRMensual.DataSource = objnom.DTSetResultados.Tables[4];
+ //GVVigSubEmpMensual.DataSource = objnom.DTSetResultados.Tables[5];
+ //GVVigISRSemanal.DataSource = objnom.DTSetResultados.Tables[7];
+ //GVVigISRDecenal.DataSource = objnom.DTSetResultados.Tables[8];
+ //GVVigISRQuincenal.DataSource = objnom.DTSetResultados.Tables[9];
+ dtquin = objnom.DTSetResultados.Tables[9];
+
+
+ }
+ //if (objnom.RH_TablasValoresGet(UsuarioActual.CveEmpresa, 1))
+ //{
+ // GVUma.DataSource = objnom.DtResultados;
+ //}
+
+ }
+ if (dtquin != null)
+ {
+
+ foreach (DataRow item in dt.Rows)
+ {
+ decimal SumaPercepcionesG = item["SumaPercepcionesG"].ToString().ToDecimal();
+
+ decimal Limiteinferior = 0;
+ decimal CuotaFija = 0;
+ decimal Porcentaje = 0;
+ foreach (DataRow drow in dtquin.Rows)
+ {
+ decimal limite = drow["Limite inferior"].ToString().ToDecimal();
+ if (limite > SumaPercepcionesG)
+ {
+ break;
+ }
+ else
+ {
+ Limiteinferior = drow["Limite inferior"].ToString().ToDecimal();
+ CuotaFija = drow["Cuota fija"].ToString().ToDecimal();
+ Porcentaje = drow["Porcentaje"].ToString().ToDecimal();
+
+ }
+
+ }
+ decimal Impuestomarginal = (SumaPercepcionesG - Limiteinferior) * (Porcentaje / 100);
+ decimal Impuestoantessubs = Impuestomarginal + CuotaFija;
+ item["LimiteInferior"] = Limiteinferior;
+ item["ExedenteLI"] = SumaPercepcionesG - Limiteinferior;
+ item["PorcentajeSE"] = Porcentaje;
+ item["ImpuestoMarginal"] = Impuestomarginal;
+ item["cuotafija"] = CuotaFija;
+ item["Impuestoantessubs"] = Impuestoantessubs;
+ item["subsidio"] = 0;
+ item["Impuesto"] = Impuestoantessubs;
+ //[Limite inferior],FORMAT(CuotaFija,'###,####,###0.00') [Cuota fija],FORMAT(Porcentaje,'###,####,###0.00') Porcentaje
+ }
+ dt.AcceptChanges();
+ }
+
+ UpCalculoISR.Update();
+ GVCalculoISR.DataSource = dt;
+ GVCalculoISR.DataBind();
+
+ RegistraScript("$('#ModalCalculoISR').modal();");
+ }
+
+ private void ImprimirReporte()
+ {
+ string RutaDocumento = System.IO.Path.Combine(ModExtensiones.DirectorioBaseEmpresas, "Empresas/Grales/Lista de Raya.docx");
+ DataTable dtpersonas = null;
+ using (ClsRH ObjRH = new ClsRH())
+ {
+ if (ObjRH.GetPersonal(-1, UsuarioActual.CveEmpresa))
+ {
+ dtpersonas = ObjRH.DtResultados;
+ }
+ }
+ if (dtempleados != null && dtempleados.Rows.Count > 0 && dtpersonas != null)
+ {
+ if (System.IO.File.Exists(RutaDocumento))
+ {
+ try
+ {
+ clsGemBoxDocument GemDocumen = new clsGemBoxDocument(RutaDocumento);
+ List listaTags = new List();
+ string strEmpresa = UsuarioActual.Empresa.Empresa;
+ string strFechaInicio = "";
+ string strFechaFin = "";
+ string strTipo = "";
+ string strPeriodoNum = "";
+ string strUbicacion = string.Format("{0}, {1}, {2}, {3}, C.P. {4}", UsuarioActual.Empresa.Direccion, UsuarioActual.Empresa.Colonia, UsuarioActual.Empresa.Ciudad, UsuarioActual.Empresa.Estado, UsuarioActual.Empresa.CP).ToLower();
+ string strRegPatImss = UsuarioActual.Empresa.RegistroPatronal;
+ string strRFC = UsuarioActual.Empresa.RFC;
+ string strfecha = DateTime.Now.ToString("dd/MMM/yyyy", System.Globalization.CultureInfo.CreateSpecificCulture("es-MX"));
+ string strhora = DateTime.Now.ToString("HH:mm:ss", System.Globalization.CultureInfo.CreateSpecificCulture("es-MX"));
+
+
+ int CvePeriodo = DdlPeriodo.SelectedValue.ToEntero();
+ DataRow rperiodo = dtPeriodos.FiltroPrimero(string.Format("CvePeriodo = {0}", CvePeriodo));
+ if (rperiodo != null)
+ {
+ strFechaInicio = string.Format("{0:dd/MM/yyyy}", rperiodo["FechaInicio"]);
+ strFechaFin = string.Format("{0:dd/MM/yyyy}", rperiodo["FechaFin"]);
+ strPeriodoNum = rperiodo["Numero"].ToString();
+
+ strTipo = DdlTipoPeriodo.SelectedItem.Text;
+ }
+ listaTags.Add(new TagsDocumentos("[Empresa]", strEmpresa));
+ listaTags.Add(new TagsDocumentos("[FechaInicio]", strFechaInicio));
+ listaTags.Add(new TagsDocumentos("[FechaFin]", strFechaFin));
+ listaTags.Add(new TagsDocumentos("[Tipo]", strTipo));
+ listaTags.Add(new TagsDocumentos("[PeriodoNum]", strPeriodoNum));
+ listaTags.Add(new TagsDocumentos("[Ubicacion]", strUbicacion));
+ listaTags.Add(new TagsDocumentos("[RegPatImss]", strRegPatImss));
+ listaTags.Add(new TagsDocumentos("[RFC]", strRFC));
+ listaTags.Add(new TagsDocumentos("[fecha]", strfecha));
+ listaTags.Add(new TagsDocumentos("[hora]", strhora));
+
+ GemBox.Document.DocumentModel document = GemDocumen.documento;
+ var section = document.Sections[0];
+ GemBox.Document.Tables.TableRow row;
+ GemBox.Document.Tables.Table sobrereciboTable;
+ GemBox.Document.Tables.Table tconeptos;
+ GemBox.Document.Paragraph paragraphh;
+ int CveSubProyecto = 0;
+ string SubProyecto = "";
+ GemBox.Document.ParagraphStyle styilo = (GemBox.Document.ParagraphStyle)document.Styles.GetOrAdd(GemBox.Document.StyleTemplateType.Normal);
+ GemBox.Document.ParagraphStyle styilostrong = (GemBox.Document.ParagraphStyle)document.Styles.GetOrAdd(GemBox.Document.StyleTemplateType.NoSpacing);
+ //GemBox.Document.Style styilonegrita = GemBox.Document.Style.CreateStyle(GemBox.Document.StyleTemplateType.Strong, document);
+ //document.Styles.Add(styilonegrita);
+ foreach (DataRow drow in dtempleados.FiltraParametros("CvePersonal > 0", "", new string[] { "CveSubProyecto", "SubProyecto" }).Rows)
+ {
+ CveSubProyecto = drow["CveSubProyecto"].ToString().ToEntero();
+ SubProyecto = drow["SubProyecto"].ToString();
+ paragraphh = new GemBox.Document.Paragraph(document, SubProyecto);
+ paragraphh.ParagraphFormat.Style = styilostrong;
+ section.Blocks.Add(paragraphh);
+ paragraphh = new GemBox.Document.Paragraph(document, "........................................................................................................................................................................");
+ section.Blocks.Add(paragraphh);
+ foreach (DataRow drow2 in dtempleados.FiltraParametros(string.Format("CveSubProyecto={0}", CveSubProyecto)).Rows)
+ {
+ int CvePersonal = drow2["CvePersonal"].ToString().ToEntero();
+ sobrereciboTable = new GemBox.Document.Tables.Table(document);
+ sobrereciboTable.TableFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(100, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ section.Blocks.Add(sobrereciboTable);
+
+ row = new GemBox.Document.Tables.TableRow(document);
+ sobrereciboTable.Rows.Add(row);
+ var cell = new GemBox.Document.Tables.TableCell(document);
+ row.Cells.Add(cell);
+ /*
+ string SalarioDiariop = "";
+ string FechaIngreso = "", Nombre = "", DiasLaborados = "";*/
+ paragraphh = new GemBox.Document.Paragraph(document, string.Format("{1} : {0}", drow2["Nombre"].ToString(), drow2["Codigo"].ToString())); cell.Blocks.Add(paragraphh);
+ paragraphh.ParagraphFormat.Style = styilostrong;
+ //
+ DataRow drh = dtpersonas.FiltroPrimero(string.Format("CvePersonal ={0}", CvePersonal));
+ if (drh != null)
+ {
+ paragraphh = new GemBox.Document.Paragraph(document, string.Format("CURP:{0} RFC:{1} Afiliación IMSS:{2}", drh["CURP"], drh["RFC"], drh["NumeroSS"])); cell.Blocks.Add(paragraphh);
+ paragraphh.ParagraphFormat.Style = styilo;
+ }
+ paragraphh = new GemBox.Document.Paragraph(document, string.Format("Fecha Ingr:{0:dd/MM/yyyy}, S.D.:{1:N2}, S.D.I.:{2:N2}, S.B.C.:{3:N2} ", drow2["FechaIngreso"], drow2["SalarioDiario"], drow2["SalarioDiarioIntegrado"], drow2["SalarioDiarioIMSS"])); cell.Blocks.Add(paragraphh);
+ paragraphh.ParagraphFormat.Style = styilo;
+ paragraphh = new GemBox.Document.Paragraph(document, string.Format("Días pagados:{0}, Retardos: {1}, Ausencias:{2},Incapacidad:{4}, Centro de costos: {3}", drow2["DiasLaborados"], drow2["DiasRetardos"], drow2["DiasFaltados"], drow2["SubProyecto"], drow2["DiasIncapacidad"])); cell.Blocks.Add(paragraphh);
+ paragraphh.ParagraphFormat.Style = styilo;
+
+ row = new GemBox.Document.Tables.TableRow(document);
+ sobrereciboTable.Rows.Add(row);
+ cell = new GemBox.Document.Tables.TableCell(document);
+ row.Cells.Add(cell);
+
+ tconeptos = new GemBox.Document.Tables.Table(document);
+ tconeptos.TableFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(100, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ cell.Blocks.Add(tconeptos);
+ GemBox.Document.Tables.TableRow rowx; GemBox.Document.Tables.TableCell cellx;
+ {
+ rowx = new GemBox.Document.Tables.TableRow(document);
+ tconeptos.Rows.Add(rowx);
+ {
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(3, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, ""); cellx.Blocks.Add(paragraphh);
+ paragraphh.ParagraphFormat.Style = styilo;
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(30, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, "Percepción"); cellx.Blocks.Add(paragraphh);
+ paragraphh.ParagraphFormat.Style = styilostrong;
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(6, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, "Valor"); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+ paragraphh.ParagraphFormat.Style = styilostrong;
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(11, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, "Importe"); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+ paragraphh.ParagraphFormat.Style = styilostrong;
+
+ }
+ {
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(3, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, ""); cellx.Blocks.Add(paragraphh);
+ paragraphh.ParagraphFormat.Style = styilostrong;
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(30, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, "Deducción"); cellx.Blocks.Add(paragraphh);
+ paragraphh.ParagraphFormat.Style = styilostrong;
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(6, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, "Valor"); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+ paragraphh.ParagraphFormat.Style = styilostrong;
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(11, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, "Importe"); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+ paragraphh.ParagraphFormat.Style = styilostrong;
+
+ }
+ }
+ //Percepción Valor Importe Deducción Valor Importe
+ bool gonext = true;
+ int cindex = 0;
+ while (gonext)
+ {
+ cindex = cindex + 1;
+ int CveConcepto; string Concepto = ""; string Codigo = ""; string importe = ""; string valor = "";
+ rowx = new GemBox.Document.Tables.TableRow(document);
+ tconeptos.Rows.Add(rowx);
+ DataRow rowconcept = dtempleadosConceptos.FiltroPrimero(string.Format("CvePersonal={0} AND Tipo =1 AND SoloVisible =0 AND FilaRaya ={1} AND Importe <> 0 ", CvePersonal, cindex));
+ if (rowconcept != null)
+ {
+ CveConcepto = rowconcept["CveConcepto"].ToString().ToEntero();
+ importe = string.Format("${0:N2}", rowconcept["Importe"]);
+ valor = string.Format("{0:#,###.##}", rowconcept["Valor"]);
+
+ Concepto = "";
+
+ rowconcept = dtConceptos.FiltroPrimero(string.Format("CveConcepto={0}", CveConcepto));
+ if (rowconcept != null)
+ {
+ Concepto = rowconcept["Concepto"].ToString();
+ Codigo = rowconcept["Codigo"].ToString();
+ }
+ }
+ else
+ {
+ gonext = false;
+ }
+ //percepciones
+ {
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(3, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, Codigo); cellx.Blocks.Add(paragraphh);
+ paragraphh.ParagraphFormat.Style = styilo;
+
+
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(30, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, Concepto); cellx.Blocks.Add(paragraphh);
+ paragraphh.ParagraphFormat.Style = styilo;
+
+
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(6, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, valor); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+ paragraphh.ParagraphFormat.Style = styilo;
+
+
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(11, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, importe); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+ paragraphh.ParagraphFormat.Style = styilo;
+
+ }
+ CveConcepto = 0; Concepto = ""; importe = ""; Codigo = ""; valor = "";
+ rowconcept = dtempleadosConceptos.FiltroPrimero(string.Format("CvePersonal={0} AND Tipo =2 AND SoloVisible =0 AND FilaRaya ={1} AND Importe <> 0", CvePersonal, cindex));
+ if (rowconcept != null)
+ {
+ CveConcepto = rowconcept["CveConcepto"].ToString().ToEntero();
+ importe = string.Format("${0:N2}", rowconcept["Importe"]);
+ valor = string.Format("{0:#,###.##}", rowconcept["Valor"]);
+ //string valor = "";
+ Concepto = "";
+
+ rowconcept = dtConceptos.FiltroPrimero(string.Format("CveConcepto={0}", CveConcepto));
+ if (rowconcept != null)
+ {
+ Concepto = rowconcept["Concepto"].ToString();
+ Codigo = rowconcept["Codigo"].ToString();
+ }
+ gonext = true;
+ }
+ //deducciones
+ {
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(3, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, Codigo); cellx.Blocks.Add(paragraphh);
+ paragraphh.ParagraphFormat.Style = styilo;
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(30, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, Concepto); cellx.Blocks.Add(paragraphh);
+ paragraphh.ParagraphFormat.Style = styilo;
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(6, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, valor); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+ paragraphh.ParagraphFormat.Style = styilo;
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(11, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, importe); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+ paragraphh.ParagraphFormat.Style = styilo;
+ }
+ }
+ {
+ rowx = new GemBox.Document.Tables.TableRow(document);
+ tconeptos.Rows.Add(rowx);
+ }
+ //Total Percepciones y deducciones
+ {
+
+ rowx = new GemBox.Document.Tables.TableRow(document);
+ tconeptos.Rows.Add(rowx);
+ {
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(3, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, ""); cellx.Blocks.Add(paragraphh);
+ paragraphh.ParagraphFormat.Style = styilo;
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(30, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, "Total Percepciones"); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+ paragraphh.ParagraphFormat.Style = styilo;
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(6, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, ""); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+ paragraphh.ParagraphFormat.Style = styilo;
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(11, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, string.Format("${0:N2}", drow2["SumaPercepciones"])); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+ paragraphh.ParagraphFormat.Style = styilostrong;
+ }
+ {
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(3, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, ""); cellx.Blocks.Add(paragraphh);
+ paragraphh.ParagraphFormat.Style = styilo;
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(30, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, "Total Deducciones"); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+ paragraphh.ParagraphFormat.Style = styilo;
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(6, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, ""); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+ paragraphh.ParagraphFormat.Style = styilo;
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(11, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, string.Format("${0:N2}", drow2["SumaDeducciones"])); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+ paragraphh.ParagraphFormat.Style = styilostrong;
+
+ }
+ }
+ {
+ rowx = new GemBox.Document.Tables.TableRow(document);
+ tconeptos.Rows.Add(rowx);
+ {
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(3, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, ""); cellx.Blocks.Add(paragraphh);
+ paragraphh.ParagraphFormat.Style = styilo;
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(30, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, ""); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+ paragraphh.ParagraphFormat.Style = styilo;
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(6, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, ""); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+ paragraphh.ParagraphFormat.Style = styilo;
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(11, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, ""); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+ paragraphh.ParagraphFormat.Style = styilo;
+
+ }
+
+ {
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(3, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, ""); cellx.Blocks.Add(paragraphh);
+ paragraphh.ParagraphFormat.Style = styilo;
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(30, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, "Neto a Pagar"); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+ paragraphh.ParagraphFormat.Style = styilo;
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(6, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, ""); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+ paragraphh.ParagraphFormat.Style = styilostrong;
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(11, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, string.Format("${0:N2}", drow2["Total"])); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+ paragraphh.ParagraphFormat.Style = styilostrong;
+ }
+ }
+ setborderclear(tconeptos);
+ keeptablesamepage(sobrereciboTable);
+ }
+ paragraphh = new GemBox.Document.Paragraph(document, "........................................................................................................................................................................");
+ section.Blocks.Add(paragraphh);
+ paragraphh = new GemBox.Document.Paragraph(document, string.Format("Total Centro de costos {0}", SubProyecto.ToUpper()));
+ paragraphh.ParagraphFormat.Style = styilostrong;
+
+
+ section.Blocks.Add(paragraphh);
+ #region "totaldepto"
+ {
+
+ sobrereciboTable = new GemBox.Document.Tables.Table(document);
+ sobrereciboTable.TableFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(100, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ section.Blocks.Add(sobrereciboTable);
+ row = new GemBox.Document.Tables.TableRow(document);
+ sobrereciboTable.Rows.Add(row);
+ var cell = new GemBox.Document.Tables.TableCell(document);
+ row.Cells.Add(cell);
+ tconeptos = new GemBox.Document.Tables.Table(document);
+ tconeptos.TableFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(100, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ cell.Blocks.Add(tconeptos);
+ GemBox.Document.Tables.TableRow rowx; GemBox.Document.Tables.TableCell cellx;
+ //Percepción Valor Importe Deducción Valor Importe
+ bool gonext = true;
+ int cindex = 0;
+ int OrdenP = -999;
+ int ordenD = -999;
+ #region "Titulos"
+
+ {
+ rowx = new GemBox.Document.Tables.TableRow(document);
+ tconeptos.Rows.Add(rowx);
+
+ {
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(3, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, ""); cellx.Blocks.Add(paragraphh);
+ paragraphh.ParagraphFormat.Style = styilo;
+
+
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(30, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, "Percepción"); cellx.Blocks.Add(paragraphh);
+ paragraphh.ParagraphFormat.Style = styilostrong;
+
+
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(6, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, "Valor"); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+ paragraphh.ParagraphFormat.Style = styilostrong;
+
+
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(11, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, "Importe"); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+ paragraphh.ParagraphFormat.Style = styilostrong;
+
+ }
+
+ {
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(3, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, ""); cellx.Blocks.Add(paragraphh);
+
+
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(30, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, "Deducción"); cellx.Blocks.Add(paragraphh);
+ paragraphh.ParagraphFormat.Style = styilostrong;
+
+
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(6, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, "Valor"); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+ paragraphh.ParagraphFormat.Style = styilostrong;
+
+
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(11, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, "Importe"); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+ paragraphh.ParagraphFormat.Style = styilostrong;
+
+ }
+ }
+ #endregion
+ #region "Conceptos agrupador"
+
+ while (gonext)
+ {
+ cindex = cindex + 1;
+ int CveConcepto; string Concepto = ""; string Codigo = ""; string importe = "";
+
+ rowx = new GemBox.Document.Tables.TableRow(document);
+ tconeptos.Rows.Add(rowx);
+ DataRow rowconcept;
+ rowconcept = dtConceptos.FiltroPrimero(string.Format("Orden>{0} AND SoloVisible =0 AND Tipo ='P'", OrdenP), "Orden");
+ bool continuarconcepto = rowconcept != null;
+ while (continuarconcepto)
+ {
+ double sumaimporte = dtempleadosConceptos.SUM("Importe", string.Format("CvePersonal > 0 AND CveSubProyecto={0} AND CveConcepto={1} AND Importe <> 0", CveSubProyecto, rowconcept["CveConcepto"]));
+ OrdenP = rowconcept["Orden"].ToString().ToEntero();
+ if (sumaimporte != 0)
+ {
+ CveConcepto = rowconcept["CveConcepto"].ToString().ToEntero();
+ importe = string.Format("${0:N2}", sumaimporte);
+ Concepto = rowconcept["Concepto"].ToString();
+ Codigo = rowconcept["Codigo"].ToString();
+ continuarconcepto = false;
+ }
+ else
+ {
+
+ rowconcept = dtConceptos.FiltroPrimero(string.Format("Orden>{0} AND SoloVisible =0 AND Tipo ='P'", OrdenP), "Orden");
+ continuarconcepto = rowconcept != null;
+ }
+
+ }
+ //while (rowconcept == null || importe == "")
+ //{
+ // double sumaimporte = dtempleadosConceptos.SUM("Importe", string.Format("CveSubProyecto={0} AND CveConcepto={1} AND Importe <> 0", CveSubProyecto, rowconcept["CveConcepto"]));
+ // OrdenP = rowconcept["Orden"].ToString().ToEntero();
+ // if (sumaimporte > 0)
+ // {
+ // CveConcepto = rowconcept["CveConcepto"].ToString().ToEntero();
+ // importe = string.Format("${0:N2}", sumaimporte);
+ // Concepto = rowconcept["Concepto"].ToString();
+ // Codigo = rowconcept["Codigo"].ToString();
+
+ // }
+ //}
+ if (importe == "")
+ {
+ gonext = false;
+ }
+ //percepciones
+ {
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(3, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, Codigo); cellx.Blocks.Add(paragraphh);
+ paragraphh.ParagraphFormat.Style = styilo;
+
+
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(30, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, Concepto); cellx.Blocks.Add(paragraphh);
+ paragraphh.ParagraphFormat.Style = styilo;
+
+
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(6, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, ""); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+ paragraphh.ParagraphFormat.Style = styilo;
+
+
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(11, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, importe); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+ paragraphh.ParagraphFormat.Style = styilo;
+
+ }
+
+
+
+ CveConcepto = 0; Concepto = ""; importe = ""; Codigo = "";
+
+ rowconcept = dtConceptos.FiltroPrimero(string.Format("Orden>{0} AND SoloVisible =0 AND Tipo ='D'", ordenD), "Orden");
+ continuarconcepto = rowconcept != null;
+ while (continuarconcepto)
+ {
+ double sumaimporte = dtempleadosConceptos.SUM("Importe", string.Format("CvePersonal > 0 AND CveSubProyecto={0} AND CveConcepto={1} AND Importe <> 0", CveSubProyecto, rowconcept["CveConcepto"]));
+ ordenD = rowconcept["Orden"].ToString().ToEntero();
+ if (sumaimporte != 0)
+ {
+ CveConcepto = rowconcept["CveConcepto"].ToString().ToEntero();
+ importe = string.Format("${0:N2}", sumaimporte);
+ Concepto = rowconcept["Concepto"].ToString();
+ Codigo = rowconcept["Codigo"].ToString();
+ continuarconcepto = false;
+
+ }
+ else
+ {
+
+ rowconcept = dtConceptos.FiltroPrimero(string.Format("Orden>{0} AND SoloVisible =0 AND Tipo ='D'", ordenD), "Orden");
+ continuarconcepto = rowconcept != null;
+ }
+ }
+ if (importe != "")
+ {
+ gonext = true;
+ }
+
+
+ //deducciones
+ {
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(3, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, Codigo); cellx.Blocks.Add(paragraphh);
+ paragraphh.ParagraphFormat.Style = styilo;
+
+
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(30, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, Concepto); cellx.Blocks.Add(paragraphh);
+ paragraphh.ParagraphFormat.Style = styilo;
+
+
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(6, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, ""); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+ paragraphh.ParagraphFormat.Style = styilo;
+
+
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(11, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, importe); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+ paragraphh.ParagraphFormat.Style = styilo;
+
+ }
+ }
+ #endregion
+
+ {
+ rowx = new GemBox.Document.Tables.TableRow(document);
+ tconeptos.Rows.Add(rowx);
+ }
+ {
+
+ rowx = new GemBox.Document.Tables.TableRow(document);
+ tconeptos.Rows.Add(rowx);
+
+ {
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(3, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, ""); cellx.Blocks.Add(paragraphh);
+ paragraphh.ParagraphFormat.Style = styilo;
+
+
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(30, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, "Total Percepciones"); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+ paragraphh.ParagraphFormat.Style = styilo;
+
+
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(6, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, ""); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+ paragraphh.ParagraphFormat.Style = styilo;
+
+
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(11, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, string.Format("${0:N2}", dtempleados.SUM("SumaPercepciones", string.Format(" CvePersonal > 0 AND CveSubProyecto={0}", CveSubProyecto)))); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+ paragraphh.ParagraphFormat.Style = styilostrong;
+
+ }
+
+ {
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(3, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, ""); cellx.Blocks.Add(paragraphh);
+ paragraphh.ParagraphFormat.Style = styilostrong;
+
+
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(30, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, "Total Deducciones"); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+ paragraphh.ParagraphFormat.Style = styilo;
+
+
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(6, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, ""); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+ paragraphh.ParagraphFormat.Style = styilostrong;
+
+
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(11, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, string.Format("${0:N2}", dtempleados.SUM("SumaDeducciones", string.Format("CvePersonal > 0 AND CveSubProyecto={0}", CveSubProyecto)))); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+ paragraphh.ParagraphFormat.Style = styilostrong;
+
+ }
+ }
+
+ //no empleados
+ {
+
+ rowx = new GemBox.Document.Tables.TableRow(document);
+ tconeptos.Rows.Add(rowx);
+
+ {
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(3, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, ""); cellx.Blocks.Add(paragraphh);
+
+
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(30, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, "Total de empleados"); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+ paragraphh.ParagraphFormat.Style = styilo;
+
+
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(6, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, ""); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+
+
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(11, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, string.Format("{0:N0}", dtempleados.COUNT("CvePersonal", string.Format("CvePersonal > 0 AND CveSubProyecto={0}", CveSubProyecto)))); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+ paragraphh.ParagraphFormat.Style = styilo;
+ }
+
+ {
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(3, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, ""); cellx.Blocks.Add(paragraphh);
+
+
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(30, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, ""); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+ paragraphh.ParagraphFormat.Style = styilostrong;
+
+
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(6, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, ""); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+
+
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(11, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, ""); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+
+ }
+ }
+ //Neto depto
+ {
+
+ rowx = new GemBox.Document.Tables.TableRow(document);
+ tconeptos.Rows.Add(rowx);
+
+ {
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(3, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, ""); cellx.Blocks.Add(paragraphh);
+
+
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(30, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, ""); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+
+
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(6, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, ""); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+
+
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(11, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, ""); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+
+ }
+
+ {
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(3, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, ""); cellx.Blocks.Add(paragraphh);
+
+
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(30, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, "Neto del Centro de costos"); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+ paragraphh.ParagraphFormat.Style = styilo;
+
+
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(6, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, ""); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+
+
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(11, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, string.Format("${0:N2}", dtempleados.SUM("Total", string.Format("CvePersonal > 0 AND CveSubProyecto={0}", CveSubProyecto)))); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+ paragraphh.ParagraphFormat.Style = styilostrong;
+
+ }
+ }
+
+
+ setborderclear(tconeptos);
+ keeptablesamepage(sobrereciboTable);
+ }
+ #endregion
+ section.Blocks.Add(new GemBox.Document.Paragraph(document, new GemBox.Document.SpecialCharacter(document, GemBox.Document.SpecialCharacterType.PageBreak)));
+
+ }
+ paragraphh = new GemBox.Document.Paragraph(document, "TOTAL ");
+ paragraphh.ParagraphFormat.Style = styilostrong;
+ section.Blocks.Add(paragraphh);
+
+ #region "total"
+ {
+
+ sobrereciboTable = new GemBox.Document.Tables.Table(document);
+ sobrereciboTable.TableFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(100, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ section.Blocks.Add(sobrereciboTable);
+ row = new GemBox.Document.Tables.TableRow(document);
+ sobrereciboTable.Rows.Add(row);
+ var cell = new GemBox.Document.Tables.TableCell(document);
+ row.Cells.Add(cell);
+ tconeptos = new GemBox.Document.Tables.Table(document);
+ tconeptos.TableFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(100, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ cell.Blocks.Add(tconeptos);
+ GemBox.Document.Tables.TableRow rowx; GemBox.Document.Tables.TableCell cellx;
+ //Percepción Valor Importe Deducción Valor Importe
+ bool gonext = true;
+ int cindex = 0;
+ int OrdenP = -999;
+ int ordenD = -999;
+ //Titulos
+ {
+
+ rowx = new GemBox.Document.Tables.TableRow(document);
+ tconeptos.Rows.Add(rowx);
+ {
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(3, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, ""); cellx.Blocks.Add(paragraphh);
+ paragraphh.ParagraphFormat.Style = styilo;
+
+
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(30, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, "Percepción"); cellx.Blocks.Add(paragraphh);
+ paragraphh.ParagraphFormat.Style = styilostrong;
+
+
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(6, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, "Valor"); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+ paragraphh.ParagraphFormat.Style = styilostrong;
+
+
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(11, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, "Importe"); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+ paragraphh.ParagraphFormat.Style = styilostrong;
+
+ }
+
+ {
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(3, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, ""); cellx.Blocks.Add(paragraphh);
+
+
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(30, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, "Deducción"); cellx.Blocks.Add(paragraphh);
+ paragraphh.ParagraphFormat.Style = styilostrong;
+
+
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(6, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, "Valor"); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+ paragraphh.ParagraphFormat.Style = styilostrong;
+
+
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(11, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, "Importe"); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+ paragraphh.ParagraphFormat.Style = styilostrong;
+
+ }
+ }
+ //conceptos percep,deduc
+ while (gonext)
+ {
+ cindex = cindex + 1;
+ int CveConcepto; string Concepto = ""; string Codigo = ""; string importe = "";
+
+ rowx = new GemBox.Document.Tables.TableRow(document);
+ tconeptos.Rows.Add(rowx);
+ DataRow rowconcept;
+ while ((rowconcept = dtConceptos.FiltroPrimero(string.Format("Orden>{0} AND SoloVisible =0 AND Tipo ='P'", OrdenP), "Orden")) != null && importe == "")
+ {
+ double sumaimporte = dtempleadosConceptos.SUM("Importe", string.Format("CvePersonal > 0 AND CveConcepto={0}", rowconcept["CveConcepto"]));
+ OrdenP = rowconcept["Orden"].ToString().ToEntero();
+ if (sumaimporte != 0)
+ {
+ CveConcepto = rowconcept["CveConcepto"].ToString().ToEntero();
+ importe = string.Format("${0:N2}", sumaimporte);
+ Concepto = rowconcept["Concepto"].ToString();
+ Codigo = rowconcept["Codigo"].ToString();
+
+ }
+ }
+ if (importe == "")
+ {
+ gonext = false;
+ }
+ //percepciones
+ {
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(3, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, Codigo); cellx.Blocks.Add(paragraphh);
+ paragraphh.ParagraphFormat.Style = styilo;
+
+
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(30, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, Concepto); cellx.Blocks.Add(paragraphh);
+ paragraphh.ParagraphFormat.Style = styilo;
+
+
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(6, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, ""); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+ paragraphh.ParagraphFormat.Style = styilo;
+
+
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(11, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, importe); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+ paragraphh.ParagraphFormat.Style = styilo;
+
+ }
+
+
+
+ CveConcepto = 0; Concepto = ""; importe = ""; Codigo = "";
+
+ while ((rowconcept = dtConceptos.FiltroPrimero(string.Format("Orden>{0} AND SoloVisible =0 AND Tipo ='D'", ordenD), "Orden")) != null && importe == "")
+ {
+ double sumaimporte = dtempleadosConceptos.SUM("Importe", string.Format("CvePersonal > 0 AND CveConcepto={0}", rowconcept["CveConcepto"]));
+ ordenD = rowconcept["Orden"].ToString().ToEntero();
+ if (sumaimporte != 0)
+ {
+ CveConcepto = rowconcept["CveConcepto"].ToString().ToEntero();
+ importe = string.Format("${0:N2}", sumaimporte);
+ Concepto = rowconcept["Concepto"].ToString();
+ Codigo = rowconcept["Codigo"].ToString();
+
+ }
+ }
+ if (importe != "")
+ {
+ gonext = true;
+ }
+
+
+ //deducciones
+ {
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(3, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, Codigo); cellx.Blocks.Add(paragraphh);
+ paragraphh.ParagraphFormat.Style = styilo;
+
+
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(30, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, Concepto); cellx.Blocks.Add(paragraphh);
+ paragraphh.ParagraphFormat.Style = styilo;
+
+
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(6, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, ""); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+ paragraphh.ParagraphFormat.Style = styilo;
+
+
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(11, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, importe); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+ paragraphh.ParagraphFormat.Style = styilo;
+
+ }
+ }
+ {
+ rowx = new GemBox.Document.Tables.TableRow(document);
+ tconeptos.Rows.Add(rowx);
+ }
+ //Totales perceciones deducciones
+ {
+
+ rowx = new GemBox.Document.Tables.TableRow(document);
+ tconeptos.Rows.Add(rowx);
+
+ {
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(3, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, ""); cellx.Blocks.Add(paragraphh);
+
+
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(30, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, "Total Percepciones"); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+ paragraphh.ParagraphFormat.Style = styilo;
+
+
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(6, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, ""); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+
+
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(11, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, string.Format("${0:N2}", dtempleados.SUM("SumaPercepciones", "CvePersonal > 0 "))); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+ paragraphh.ParagraphFormat.Style = styilostrong;
+
+ }
+
+ {
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(3, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, ""); cellx.Blocks.Add(paragraphh);
+
+
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(30, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, "Total Deducciones"); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+ paragraphh.ParagraphFormat.Style = styilo;
+
+
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(6, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, ""); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+
+
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(11, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, string.Format("${0:N2}", dtempleados.SUM("SumaDeducciones", "CvePersonal > 0 "))); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+ paragraphh.ParagraphFormat.Style = styilostrong;
+
+ }
+ }
+ {
+
+ rowx = new GemBox.Document.Tables.TableRow(document);
+ tconeptos.Rows.Add(rowx);
+
+ {
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(3, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, ""); cellx.Blocks.Add(paragraphh);
+
+
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(30, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, "Total de empleados general"); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+ paragraphh.ParagraphFormat.Style = styilo;
+
+
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(6, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, ""); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+
+
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(11, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, string.Format("{0:N0}", dtempleados.COUNT("CvePersonal", "CvePersonal > 0"))); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+ paragraphh.ParagraphFormat.Style = styilo;
+ }
+
+ {
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(3, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, ""); cellx.Blocks.Add(paragraphh);
+
+
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(30, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, ""); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+ paragraphh.ParagraphFormat.Style = styilostrong;
+
+
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(6, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, ""); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+
+
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(11, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, ""); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+
+ }
+ }
+ //neto empresa
+ {
+
+ rowx = new GemBox.Document.Tables.TableRow(document);
+ tconeptos.Rows.Add(rowx);
+
+ {
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(3, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, ""); cellx.Blocks.Add(paragraphh);
+
+
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(30, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, ""); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+
+
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(6, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, ""); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+
+
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(11, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, ""); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+
+ }
+
+ {
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(3, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, ""); cellx.Blocks.Add(paragraphh);
+
+
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(30, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, "Neto general"); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+ paragraphh.ParagraphFormat.Style = styilo;
+
+
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(6, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, ""); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+
+
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(11, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, string.Format("${0:N2}", dtempleados.SUM("Total", "CvePersonal > 0"))); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+
+ paragraphh.ParagraphFormat.Style = styilostrong;
+
+ }
+ }
+ gonext = true;
+ int OrdenO = -999;
+
+ //basura para espacio
+ {
+ rowx = new GemBox.Document.Tables.TableRow(document);
+ tconeptos.Rows.Add(rowx);
+ {
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(3, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, " "); cellx.Blocks.Add(paragraphh);
+ }
+
+ rowx = new GemBox.Document.Tables.TableRow(document);
+ tconeptos.Rows.Add(rowx);
+ {
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(3, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, " "); cellx.Blocks.Add(paragraphh);
+ }
+ }
+ rowx = new GemBox.Document.Tables.TableRow(document);
+ tconeptos.Rows.Add(rowx);
+
+ {
+
+ {
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(3, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, ""); cellx.Blocks.Add(paragraphh);
+
+
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(30, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, ""); cellx.Blocks.Add(paragraphh);
+
+
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(6, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, ""); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+
+
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(11, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, ""); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+
+ }
+
+ {
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(3, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, ""); cellx.Blocks.Add(paragraphh);
+
+
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(30, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, "Obligación"); cellx.Blocks.Add(paragraphh);
+ paragraphh.ParagraphFormat.Style = styilostrong;
+
+
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(6, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, ""); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+ paragraphh.ParagraphFormat.Style = styilostrong;
+
+
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(11, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, "Importe"); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+ paragraphh.ParagraphFormat.Style = styilostrong;
+
+ }
+ }
+ while (gonext)
+ {
+ cindex = cindex + 1;
+ int CveConcepto; string Concepto = ""; string Codigo = ""; string importe = "";
+ rowx = new GemBox.Document.Tables.TableRow(document);
+ tconeptos.Rows.Add(rowx);
+ {
+
+ {
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(3, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, Codigo); cellx.Blocks.Add(paragraphh);
+ paragraphh.ParagraphFormat.Style = styilo;
+
+
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.ColumnSpan = 2;
+ paragraphh = new GemBox.Document.Paragraph(document, Concepto); cellx.Blocks.Add(paragraphh);
+ paragraphh.ParagraphFormat.Style = styilo;
+
+
+ //cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ //cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(6, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ //paragraphh = new GemBox.Document.Paragraph(document, ""); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+ //paragraphh.ParagraphFormat.Style = styilo;
+
+
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(11, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, importe); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+ paragraphh.ParagraphFormat.Style = styilo;
+
+ }
+ }
+ DataRow rowconcept;
+ while ((rowconcept = dtConceptos.FiltroPrimero(string.Format("Orden>{0} AND SoloVisible =0 AND Tipo ='O'", OrdenO), "Orden")) != null && importe == "")
+ {
+ double sumaimporte = dtempleadosConceptos.SUM("Valor", string.Format("CvePersonal > 0 AND CveConcepto={0}", rowconcept["CveConcepto"]));
+ OrdenO = rowconcept["Orden"].ToString().ToEntero();
+ if (sumaimporte != 0)
+ {
+ CveConcepto = rowconcept["CveConcepto"].ToString().ToEntero();
+ importe = string.Format("${0:N2}", sumaimporte);
+ Concepto = rowconcept["Concepto"].ToString();
+ Codigo = rowconcept["Codigo"].ToString();
+
+ }
+ }
+ if (importe == "")
+ {
+ gonext = false;
+ }
+ //Obligaciones
+ {
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(3, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, Codigo); cellx.Blocks.Add(paragraphh);
+ paragraphh.ParagraphFormat.Style = styilo;
+
+
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(30, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, Concepto); cellx.Blocks.Add(paragraphh);
+ paragraphh.ParagraphFormat.Style = styilo;
+
+
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(6, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, ""); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+ paragraphh.ParagraphFormat.Style = styilo;
+
+
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(11, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, importe); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+ paragraphh.ParagraphFormat.Style = styilo;
+
+ }
+
+
+ }
+
+ {
+ rowx = new GemBox.Document.Tables.TableRow(document);
+ tconeptos.Rows.Add(rowx);
+ }
+ {
+
+ rowx = new GemBox.Document.Tables.TableRow(document);
+ tconeptos.Rows.Add(rowx);
+
+ {
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(3, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, ""); cellx.Blocks.Add(paragraphh);
+ paragraphh.ParagraphFormat.Style = styilo;
+
+
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(30, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, " "); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+ paragraphh.ParagraphFormat.Style = styilostrong;
+
+
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(6, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, ""); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+ paragraphh.ParagraphFormat.Style = styilo;
+
+
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(11, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, ""); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+ paragraphh.ParagraphFormat.Style = styilostrong;
+
+ }
+
+ {
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(3, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, ""); cellx.Blocks.Add(paragraphh);
+ paragraphh.ParagraphFormat.Style = styilo;
+
+
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(30, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, "Total Obligaciones"); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+ paragraphh.ParagraphFormat.Style = styilo;
+
+
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(6, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, ""); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+ paragraphh.ParagraphFormat.Style = styilo;
+
+
+ cellx = new GemBox.Document.Tables.TableCell(document); rowx.Cells.Add(cellx);
+ cellx.CellFormat.PreferredWidth = new GemBox.Document.Tables.TableWidth(11, GemBox.Document.Tables.TableWidthUnit.Percentage);
+ paragraphh = new GemBox.Document.Paragraph(document, string.Format("${0:N2}", dtempleados.SUM("SumaObligaciones"))); cellx.Blocks.Add(paragraphh); paragraphh.ParagraphFormat.Alignment = GemBox.Document.HorizontalAlignment.Right;
+ paragraphh.ParagraphFormat.Style = styilostrong;
+
+ }
+ }
+ setborderclear(tconeptos);
+ keeptablesamepage(tconeptos);
+ keeptablesamepage(sobrereciboTable);
+ }
+ #endregion
+ GemDocumen.SustituirTags(listaTags);
+ GemDocumen.GuardarStreamPDF();
+ System.IO.MemoryStream memoryStream = new System.IO.MemoryStream(GemDocumen.GetBytesDocumento());
+ GemDocumen.Dispose();
+ Response.Clear();
+ Response.ContentType = "application/pdf";
+ Response.AddHeader("content-disposition", $"attachment;filename=Lista de Raya.pdf");
+ Response.Buffer = true;
+ memoryStream.WriteTo(Response.OutputStream);
+ Response.End();
+ }
+ catch (Exception e)
+ {
+ Extensiones.ModExtensiones.GuardaLog(string.Format("Nomina2(errorLayout):{0} ", e.ToString()));
+ Alert("No se pudo generar la lista de raya favor de contactar a soporte tecnico.", Extensiones.ModExtensiones.TipoMensaje.ToastError);
+ RegistraScript(string.Format("console.error('Nomina2(errorLayout):{0}'); ", e.ToString().Replace("'", "\\'")));
+ }
+ }
+ else
+ {
+ Alert("No se encontro la plantilla.", Extensiones.ModExtensiones.TipoMensaje.ToastAdventencia);
+ }
+ }
+ else
+ {
+ Alert("es necesario calcular el periodo primero.", Extensiones.ModExtensiones.TipoMensaje.ToastAdventencia);
+ }
+ }
+
+ #region "Gembox"
+ private void keeptablesamepage(GemBox.Document.Tables.Table table)
+ {
+ //Mantener tabla unida
+ {
+ // Get all Paragraph formats in a Table element.
+ IEnumerable formats = table.GetChildElements(true, GemBox.Document.ElementType.TableCell)
+ .Cast()
+ .SelectMany(cell =>
+ {
+ if (cell.Blocks.Count == 0)
+ cell.Blocks.Add(new GemBox.Document.Paragraph(cell.Document));
+ return cell.GetChildElements(true, GemBox.Document.ElementType.Paragraph);
+ })
+ .Cast()
+ .Select(p => p.ParagraphFormat);
+
+ // Set KeepLinesTogether and KeepWithNext properties.
+ foreach (GemBox.Document.ParagraphFormat format in formats)
+ {
+ format.KeepLinesTogether = true;
+ format.KeepWithNext = true;
+ }
+ }
+ }
+ private void setborderclear(GemBox.Document.Tables.Table table)
+ {
+ table.TableFormat.Borders.SetBorders(GemBox.Document.MultipleBorderTypes.All, GemBox.Document.BorderStyle.None, GemBox.Document.Color.Empty, 0);
+ foreach (var row in table.Rows)
+ {
+ foreach (var cell in row.Cells)
+ {
+ cell.CellFormat.Borders.ClearBorders();
+ }
+ }
+ }
+ #endregion
+ protected void LnkListaRaya_Click(object sender, EventArgs e)
+ {
+ ImprimirReporte();
+ }
+ #region Movtos Permanentes
+
+ protected void CargaTipoConcepto()
+ {
+ //DdlTipo.Items.Insert(0, new ListItem("Percepciones", "P"));
+ //DdlTipo.Items.Insert(1, new ListItem("Deducciones", "D"));
+ //DdlTipo.Items.Insert(2, new ListItem("Obligaciones", "O"));
+ //DdlTipo.SelectedValueExist("-1");
+ CargaConcepto();
+ }
+
+ protected void CargaConcepto()
+ {
+ DdlConcepto.Items.Clear();
+ if (DdlTipo.SelectedValue.Contiene("P", "D", "O"))
+ {
+ DdlConcepto.DataSource = get_GlobalDTNomConceptos(UsuarioActual.CveEmpresa).FiltraParametros(string.Format("Tipo ='{0}' AND FormulaTotal = 'FNC.[MovimientosPermanentes]'", DdlTipo.SelectedValue));
+ }
+ else
+ {
+ DdlConcepto.DataSource = get_GlobalDTNomConceptos(UsuarioActual.CveEmpresa).FiltraParametros(" FormulaTotal = 'FNC.[MovimientosPermanentes]'");
+ }
+ DdlConcepto.DataBind();
+ DdlConcepto.Items.Insert(0, new ListItem("Seleccione", "-1"));
+ DdlConcepto.SelectedValueExist("-1");
+ }
+ private void CargaMovtoPermanente()
+ {
+
+ using (ClsNominas ObjMovt = new ClsNominas())
+ {
+ ObjMovt.GetMovtoPermanente(UsuarioActual.CveEmpresa, SRCvePersonal);
+ GVMovtoPermanente.DataSource = ObjMovt.DtResultados;
+
+ }
+ GVMovtoPermanente.DataBind();
+ UpMovtosPermanentes.Update();
+ }
+ protected void DdlTipo_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ CargaConcepto();
+ }
+
+ protected void LnkAddMovtoPermanente_Click(object sender, EventArgs e)
+ {
+ CargaConcepto();
+ DdlTipoDescto_SelectedIndexChanged(null, null);
+ pnlAddupMovto.Visible = true;
+ LnkAddMovto.Visible = true;
+ LnkUpMovto.Visible = false;
+ LtlMovtoPermanenteaddup.Text = "Agregar Movimiento";
+
+ TxtDescripcion.Text = "";
+ TxtValor.Text = "";
+ TxtVecesAplicar.Text = "";
+ TxtMontoLimite.Text = "";
+ TxtFechaAplicacion.Text = "";
+ ChkEstatus.Visible = true;
+ }
+
+ protected void LnkAddMovto_Click(object sender, EventArgs e)
+ {
+ int cveConcepto = DdlConcepto.SelectedValue.ToEntero();
+ string descripcion = TxtDescripcion.Text;
+ int tipoDescuento = DdlTipoDescto.SelectedValue.ToEntero();
+ double valor = TxtValor.Text.ToDouble();
+ int vecesAplicar = TxtVecesAplicar.Text.ToEntero();
+ decimal montoLimite = TxtMontoLimite.Text.ToDecimal();
+ string fechaInicioAplicacion = TxtFechaAplicacion.Text.ToDate().ToString("yyyy/MM/dd");
+ bool estatus = ChkEstatus.Checked;
+ bool Continuar;
+ using (ClsNominas ObjMovt = new ClsNominas())
+ {
+ Continuar = ObjMovt.AddMovtoPermanente(cveConcepto, SRCvePersonal, descripcion, tipoDescuento, valor, vecesAplicar, montoLimite, fechaInicioAplicacion, estatus);
+
+ }
+ if (Continuar)
+ {
+ this.RegistraScript("$('#DModalMovtoPermanente').modal('hide');");
+ CargaMovtoPermanente();
+ UpMovtosPermanentes.Update();
+ this.Alert("El Movto_Permanente Se ha agregado");
+ }
+
+ }
+
+ protected void LnkUpMovto_Click(object sender, EventArgs e)
+ {
+ int cveConcepto = DdlConcepto.SelectedValue.ToEntero();
+ string descripcion = TxtDescripcion.Text;
+ int tipoDescuento = DdlTipoDescto.SelectedValue.ToEntero();
+ double valor = TxtValor.Text.ToDouble();
+ int vecesAplicar = TxtVecesAplicar.Text.ToEntero();
+ decimal montoLimite = TxtMontoLimite.Text.ToDecimal();
+ string fechaInicioAplicacion = TxtFechaAplicacion.Text.ToDate().ToString("yyyy/MM/dd");
+ bool estatus = ChkEstatus.Checked;
+ bool Continuar;
+ using (ClsNominas ObjMovt = new ClsNominas())
+ {
+ Continuar = ObjMovt.UpMovtoPermanente(CcveMovtoPermanente, cveConcepto, SRCvePersonal, descripcion, tipoDescuento, valor, vecesAplicar, montoLimite, fechaInicioAplicacion, estatus);
+
+ }
+ if (Continuar)
+ {
+ this.RegistraScript("$('#DModalMovtoPermanente').modal('hide');");
+ CargaMovtoPermanente();
+ UpMovtosPermanentes.Update();
+ this.Alert("El Movto_Permanente Se ha agregado");
+ }
+
+ }
+
+ protected void DdlTipoDescto_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ pnlMonto.Visible = DdlTipoDescto.SelectedValue.ToEntero() > 2;
+ pnlVecesAplicar.Visible = DdlTipoDescto.SelectedValue.ToEntero() < 3;
+ }
+
+ protected void LnkEditarMovtoPermanente_Click(object sender, EventArgs e)
+ {
+
+ GridViewRow gvRow = (GridViewRow)(((LinkButton)sender).NamingContainer);
+ CcveMovtoPermanente = gvRow.DataKey("CveMovtoPermanente").ToEntero();
+ int cveConcepto = gvRow.DataKey("CveConcepto").ToEntero();
+ int cvePersonal = gvRow.DataKey("CvePersonal").ToEntero();
+ string descripcion = gvRow.DataKey("Descripcion");
+ int tipoDescuento = gvRow.DataKey("TipoDescuento").ToEntero();
+ double valor = gvRow.DataKey("Valor").ToDouble();
+ int vecesAplicar = gvRow.DataKey("VecesAplicar").ToEntero();
+ decimal montoLimite = gvRow.DataKey("MontoLimite").ToDecimal();
+ DateTime fechaInicioAplicacion = gvRow.DataKey("FechaInicioAplicacion").ToDate();
+ bool estatus = gvRow.DataKey("Estatus") == "1" || gvRow.DataKey("Estatus").ToUpper() == "TRUE";
+ DateTime fechaRegistro = gvRow.DataKey("FechaRegistro").ToDateTime();
+ string tipo = "P";
+ DataRow drow = get_GlobalDTNomConceptos(UsuarioActual.CveEmpresa).FiltroPrimero(string.Format("Tipo ='{0}'", cveConcepto));
+ if (drow != null)
+ {
+ tipo = drow["Tipo"].ToString();
+ DdlTipo.SelectedValueExist(tipo);
+ DdlTipo_SelectedIndexChanged(null, null);
+ }
+ CargaConcepto();
+ DdlConcepto.SelectedValueExist(cveConcepto);
+ TxtDescripcion.Text = descripcion.ToString();
+ DdlTipoDescto.SelectedValueExist(tipoDescuento.ToString());
+ DdlTipoDescto_SelectedIndexChanged(null, null);
+
+ TxtValor.Text = valor.ToString();
+ TxtVecesAplicar.Text = vecesAplicar.ToString();
+ TxtMontoLimite.Text = montoLimite.ToString();
+ TxtFechaAplicacion.Text = $"{fechaInicioAplicacion:dd/MM/yyyy}";
+ ChkEstatus.Checked = estatus;
+ this.RegistraScript("$('#DModalMovtoPermanente').modal();");
+
+
+ pnlAddupMovto.Visible = true;
+ LnkAddMovto.Visible = false;
+ LnkUpMovto.Visible = true;
+ UpMovtosPermanentes.Update();
+ }
+ #endregion
+
+ protected void LnkGuardarFonacot_Click(object sender, EventArgs e)
+ {
+ double importe = TxtFonValor.Text.ToDouble();
+ int TipoAplicacion = DdlFonTipoAplicacion.SelectedValue.ToEntero();
+ int NoPagos = 0;
+ double SaldoIni = 0;
+ string descripcion02 = TxtFonDescripcion.Text;
+ string descripcion01 = TxtFonNumCredito.Text;
+ string fecha = TxtFonFechaInicio.Text.Replace("_", "");
+ int estatus = ChkFonacot.Checked ? 1 : 0;
+ if (fecha.Length > 8)
+ fecha = fecha.ToDateTime().ToString("yyyy/MM/dd");
+ else
+ fecha = "";
+ bool continuar = true;
+ using (ClsRH ObjPersonal = new ClsRH())
+ {
+ if (!ObjPersonal.AddConcepto(SRCvePersonal, -1, importe, TipoAplicacion, NoPagos, SaldoIni, UsuarioActual.CveUsuario, 4, descripcion01, descripcion02, fecha, "", estatus, UsuarioActual.CveEmpresa))
+ continuar = false;
+ }
+ if (continuar)
+ {
+ LnkConsultar_Click(null, null);
+ mostrarConceptos();
+ Alert("Se actualizo el calculo de fonacot");
+ }
+
+ }
+
+ protected void LnkAutorizar_Click(object sender, EventArgs e)
+ {
+ autorizarNomina(-1);
+ }
+
+ private void autorizarNomina(int FiltroCvePersonal)
+ {
+
+ bool continuar = true;
+ string[] getcolumnas = new string[] { "CvePersonal", "CveMetodoPago", "SumaPercepciones", "Total", "SalarioDiario", "SalarioDiarioIMSS", "SalarioDiarioIntegrado", "DiasLaborados", "DiasFaltados", "DiasVacaciones", "DiasIncapacidad" };
+
+ DataTable dtr = dtempleados.FiltraParametros(string.Format("(CvePersonal={0} OR {0}=-1) AND CvePersonal > 0 AND NomAutorizado =0", FiltroCvePersonal), "", getcolumnas);
+ DataTable dtconp = null;
+ int CvePeriodoSeleccionado = DdlPeriodo.SelectedValue.ToEntero();//cambiar reparar
+
+ #region PropNomina
+ int CvePersonal = 0;
+ int CveNomina = 0;
+ int CveMetodoPago = 0;
+ double SubTotal = 0;
+ double Total = 0;
+ int CveMoneda = 1;
+ #endregion
+ #region PropNominaDetalle
+ int CveConcepto = 0;
+ decimal ImporteConcepto = 0, ImporteGravadoConcepto = 0, ImporteExentoConcepto = 0, ImporteValor = 0;
+ #endregion
+
+
+ using (ClsNominas objNomina = new ClsNominas())
+ {
+ objNomina.IniciaTransacSQL();
+ foreach (DataRow rtemp in dtr.Rows)
+ {
+ CveNomina = 0;
+ CvePersonal = rtemp["CvePersonal"].ToString().ToEntero();
+ CveMetodoPago = rtemp["CveMetodoPago"].ToString().ToEntero();
+ SubTotal = rtemp["SumaPercepciones"].ToString().ToDouble();
+ Total = rtemp["Total"].ToString().ToDouble();
+ if (CvePersonal > 0)
+ {
+ if (continuar)
+ {
+ if (objNomina.GetNom_Nominas(-1, CvePersonal, CvePeriodoSeleccionado, -1, UsuarioActual.CveEmpresa))
+ {
+
+ if (objNomina.DtResultados.Rows.Count > 0)
+ {
+ CveNomina = objNomina.CveNomina;
+ }
+ else
+ {
+ if (objNomina.AddNom_Nominas(-1, 1, CvePersonal, CvePeriodoSeleccionado, SubTotal, 0, 0, Total, CveMoneda, 1, CveMetodoPago, DateTime.Now, "Deducciones nómina",
+ "", "", "", "", 0, 0, 0, new DateTime(), new DateTime(), new DateTime(), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa))
+ {
+ CveNomina = objNomina.CveNomina;
+ }
+ else
+ {
+ continuar = false;
+ }
+ }
+ }
+ }
+ if (CveNomina == 0)
+ {
+ continuar = false;
+ }
+
+
+ if (continuar)
+ {
+ dtconp = dtempleadosConceptos.FiltraParametros(string.Format("CvePersonal={0} AND Importe<>0", CvePersonal));
+ foreach (DataRow rcon in dtconp.Rows)
+ {
+
+ CveConcepto = rcon["CveConcepto"].ToString().ToEntero();
+ ImporteConcepto = rcon["Importe"].ToString().ToDecimal();
+ ImporteGravadoConcepto = rcon["ImporteGravado"].ToString().ToDecimal();
+ ImporteExentoConcepto = ImporteConcepto - ImporteGravadoConcepto;
+ ImporteValor = rcon["Valor"].ToString().ToDecimal();
+ if (continuar)
+ {
+
+ if (!objNomina.AddUPNom_NominasDetalles(CveNomina, CvePeriodoSeleccionado, CvePersonal, CveConcepto, ImporteConcepto, ImporteGravadoConcepto, ImporteExentoConcepto, ImporteValor, UsuarioActual.CveUsuario))
+ {
+ continuar = false;
+ }
+ }
+
+ }
+ }
+ if (continuar)
+ {
+ decimal SalarioDiario = rtemp["SalarioDiario"].ToString().ToDecimal();
+ decimal SalarioDiarioIMSS = rtemp["SalarioDiarioIMSS"].ToString().ToDecimal();
+ decimal SalarioDiarioIntegrado = rtemp["SalarioDiarioIntegrado"].ToString().ToDecimal();
+ int DiasLaborados = rtemp["DiasLaborados"].ToString().ToEntero();
+ int DiasFaltados = rtemp["DiasFaltados"].ToString().ToEntero();
+ int DiasVacaciones = rtemp["DiasVacaciones"].ToString().ToEntero();
+ int DiasIncapacidad = rtemp["DiasIncapacidad"].ToString().ToEntero();
+ continuar = objNomina.PA_Nom_NominasAutorizarUP(CvePersonal, CvePeriodoSeleccionado, SalarioDiario, SalarioDiarioIMSS, SalarioDiarioIntegrado, 0, 0, Total, SubTotal, DiasLaborados, DiasFaltados, DiasVacaciones, DiasIncapacidad);
+
+ continuar = objNomina.AutorizaNom_Nominas(CvePersonal, CvePeriodoSeleccionado, true);
+ }
+
+ }
+ }
+
+
+
+
+ if (continuar)
+ {
+ objNomina.Commit();
+ Alert("La nomina se autorizó correctamente.");
+ cargaDatos();
+ }
+ else
+ {
+ objNomina.RollBack();
+
+ }
+ }
+ if (dtr != null)
+ {
+ dtr.Dispose();
+
+ }
+ if (dtconp != null)
+ {
+ dtconp.Dispose();
+
+ }
+
+ }
+
+ protected void LnkCargaAsistenciaMasiva_Click(object sender, EventArgs e)
+ {
+ RegistraScript("$('#DModalCargaASistenciaMasiva').modal();");
+ }
+
+ protected void LnkCargarAsistenciaMasiva_Click(object sender, EventArgs e)
+ {
+ using (ClsRH ObjPersonal = new ClsRH())
+ {
+ ObjPersonal.IniciaTransacSQL();
+ bool OcurrioError = false;
+
+ if (!ObjPersonal.AddAsistenciaMasiva2(DdlPeriodoCM.SelectedValue.ToEntero(), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa))
+ OcurrioError = true;
+
+ if (OcurrioError)
+ {
+ ObjPersonal.RollBack();
+ Alert("Ocurrió un error al guardar las Asistencias.", ModExtensiones.TipoMensaje.MsgError);
+ }
+ else
+ {
+ ObjPersonal.Commit();
+ Alert("Las Asistencias se guardaron correctamente.", ModExtensiones.TipoMensaje.ToastInformacion);
+ }
+
+ }
+
+ }
+
+ private void cargaPeriodosCM()
+ {
+ int tipoPeriodo = DdlTipoPeriodoCM.SelectedValue.ToEntero();
+ int ejercicio = DdlEjerciciosCM.SelectedValue.ToEntero();
+ DataTable dtPeriodos = null;
+ if (tipoPeriodo > 0)
+ {
+ using (ClsNominas objperiodos = new ClsNominas())
+ {
+ if (objperiodos.GetPeriodos(tipoPeriodo, UsuarioActual.CveEmpresa, ejercicio, -1, -1))
+ {
+ dtPeriodos = objperiodos.DtResultados;
+ }
+ }
+ }
+ DdlPeriodoCM.DataSource = dtPeriodos;
+ DdlPeriodoCM.DataBind();
+ DdlPeriodoCM.Items.Insert(0, new ListItem("Seleccione", "-1"));
+ UpModalAsistenciaMasiva.Update();
+ }
+
+ protected void DdlEjerciciosCM_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ cargaPeriodosCM();
+ }
+ protected void DdlTipoPeriodoCM_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ cargaPeriodosCM();
+ }
+
+
+
+ protected void LnkGuardarASistencia_Click(object sender, EventArgs e)
+ {
+ int CvePersonal = TxtasiscvePersonal.Text.ToEntero();
+ DateTime fecha = TxtasisFecha.Text.ToDate();
+ using (ClsRH objpersonal = new ClsRH())
+ {
+
+ if (objpersonal.AddAsistencia(CvePersonal, -1, -1, fecha, DdlTipoAsistencias.SelectedValue.ToEntero(), TxtPorPago.Text.Trim().ToDouble(), TxtHorasDobles.Text.Trim().ToDouble(),
+ TxtHorasTriples.Text.Trim().ToDouble(), DdlMotivoHoraExtra.SelectedValue.ToEntero(), TxtObservaciones.Text.Trim(), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa))
+ {
+
+ }
+ Alert("se ha guardado la asistencia satisfactoriamente");
+ }
+ }
+
+ protected void btnasis_Click(object sender, EventArgs e)
+ {
+ int CvePersonal = TxtasiscvePersonal.Text.ToEntero();
+ DateTime fecha = TxtasisFecha.Text.ToDate();
+ DataRow drow = dtempleados.FiltroPrimero(string.Format("CvePersonal={0}", CvePersonal));
+ TxtPersonal.Text = drow["nombre"].ToString();
+ if (DdlTipoAsistencias.Items.Count == 1)
+ {
+ DdlTipoAsistencias.DataSource = GlobalDTAsistenciasInasistencias.FiltraParametros(string.Format("CveEmpresa = {0}", UsuarioActual.CveEmpresa));
+ DdlTipoAsistencias.DataBind();
+
+ }
+ if (DdlMotivoHoraExtra.Items.Count == 1)
+ {
+ DdlMotivoHoraExtra.DataSource = GlobalDTMotivosHorasExtras.FiltraParametros(string.Format("CveEmpresa = {0}", UsuarioActual.CveEmpresa));
+ DdlMotivoHoraExtra.DataBind();
+
+ }
+ using (ClsRH objpersonal = new ClsRH())
+ {
+ if (objpersonal.GetAsistencias(CvePersonal, -1, -1, -1, -1, -1, fecha, fecha, UsuarioActual.CveEmpresa))
+ {
+ if (objpersonal.DtResultados.Rows.Count > 0)
+ {
+ DataRow dr = objpersonal.DtResultados.Rows[0];
+ DdlTipoAsistencias.SelectedValueExist(dr["CveAsistenciasInasistencias"].ToString());
+ TxtPorPago.Text = dr["PorcentajePago"].ToString();
+ TxtHorasDobles.Text = dr["HorasDobles"].ToString();
+ TxtHorasTriples.Text = dr["HorasTriples"].ToString();
+ DdlMotivoHoraExtra.SelectedValueExist(dr["CveMotivoHoraExtra"].ToString());
+ TxtObservaciones.Text = dr["Observacion"].ToString();
+ // CveAsistenciasInasistencias
+ // PorcentajePago
+ // HorasDobles
+ // HorasTriples
+ //CveMotivoHoraExtra
+ //Observacion
+ //
+
+ }
+ }
+ }
+ UpModalAsistencia.Update();
+ RegistraScript("$('#DModalModAsistencia').modal();");
+ }
+
+ protected void LnkSimulador_Click(object sender, EventArgs e)
+ {
+ GvConceptossimulador.DataSource = new DataTable();
+ GvConceptossimulador.DataBind();
+ DdlTipoPeriodoSim.SelectedValue = "1";
+ RegistraScript("$('#DSimulador').modal()");
+ UpSimulador.Update();
+ }
+
+
+ protected void LnkSimularXNeto_Click(object sender, EventArgs e)
+ {
+ int CveProyecto = -1;
+ int CveSubProyecto = 1;
+ int CveTurno = -1;
+ int CvePeriodo = (DdlTipoPeriodoSim.SelectedValue == "1") ? 12706 : 12551;
+ int CveEmpresa = UsuarioActual.CveEmpresa;
+ int Agrupador = -1;
+ decimal Neto = TxtNetoaPagar.Text.ToDecimal();
+ decimal NetoSimulado = 0;
+ decimal SDI = (Neto * 1.25M) / (DdlTipoPeriodoSim.SelectedValue == "1" ? 7 : 15);
+ decimal SDIOLD = 0;
+ decimal sumador = 100;
+ decimal multiplicador = 1;
+ bool ismayor = false;
+ bool isfirst = true;
+ bool continuarV = true;
+ DataTable dtPeriodo = new DataTable();
+ DataTable dtasistencia = new DataTable();
+ DataTable dtConceptos = new DataTable();
+ DataTable dtempleados = new DataTable();
+ DataTable dtempleadosConceptos = new DataTable();
+ bool continuar = false;
+ using (ClsNominas objnom = new ClsNominas())
+ {
+ while (Neto != NetoSimulado && continuarV)
+ {
+
+ if (objnom.GetNominaEmpleado(CveProyecto, CveSubProyecto, CveTurno, CvePeriodo, CveEmpresa, Agrupador, -1, 1, SDI)
+ && objnom.DTSetResultados.Tables.Count > 1)
+ {
+ dtempleados = objnom.DTSetResultados.Tables[3];
+ dtempleadosConceptos = objnom.DTSetResultados.Tables[4];
+ dtConceptos = objnom.DTSetResultados.Tables[0];
+ dtPeriodo = objnom.DTSetResultados.Tables[1];
+ dtasistencia = objnom.DTSetResultados.Tables[2];
+ continuar = true;
+ NetoSimulado = dtempleados.SUM("Total", string.Format("CvePersonal = {0}", 1)).ToString().ToDecimal();
+ }
+ if (continuar)
+ {
+
+ if (isfirst)
+ {
+
+ if (Neto > NetoSimulado)
+ {
+ ismayor = true;
+ }
+ else
+ {
+ ismayor = false;
+ }
+ isfirst = false;
+ }
+ else
+ {
+ if (!((Neto > NetoSimulado) == ismayor))
+ {
+ SDI = SDIOLD;
+ sumador = sumador * 0.1M;
+ if (sumador < .00000001M)
+ {
+
+ continuarV = false;
+ }
+ }
+ }
+
+ multiplicador = (Neto > NetoSimulado) ? 1 : -1;
+ SDIOLD = SDI;
+ SDI = SDI + (multiplicador * sumador);
+ }
+ else
+ {
+ continuarV = false;
+ }
+ }
+ }
+ if (continuar)
+ {
+ {
+ DataTable dtx = dtConceptos.Copy();
+ dtx.Columns.Add("BorradoLogico", typeof(int));
+ DataTable dtper = dtx.FiltraParametros("Tipo IN ('P') AND EsPadre = 1 ");
+ DataTable dtded = dtx.FiltraParametros("Tipo IN ('D') AND EsPadre = 1 ");
+ DataTable dtObl = dtx.FiltraParametros("Tipo IN ('O') AND EsPadre = 1 ");
+ ////dtded.Columns.Add("BorradoLogico", typeof(int));
+ ////dtObl.Columns.Add("BorradoLogico", typeof(int));
+
+ foreach (DataRow row in dtper.Rows)
+ {
+ int BorradoLogico = 0;
+ int CveConcepto = row["CveConcepto"].ToString().ToEntero();
+ if (!(dtempleados.SUM(string.Format("[V_{0}]", CveConcepto)) > 0))
+ {
+ BorradoLogico = 1;
+ }
+ row["BorradoLogico"] = BorradoLogico;
+ }
+ dtper.AcceptChanges();
+ foreach (DataRow row in dtded.Rows)
+ {
+ int BorradoLogico = 0;
+ int CveConcepto = row["CveConcepto"].ToString().ToEntero();
+ if (!(dtempleados.SUM(string.Format("[V_{0}]", CveConcepto)) > 0))
+ {
+ BorradoLogico = 1;
+ }
+ row["BorradoLogico"] = BorradoLogico;
+ }
+ dtded.AcceptChanges();
+ foreach (DataRow row in dtObl.Rows)
+ {
+ int BorradoLogico = 0;
+ int CveConcepto = row["CveConcepto"].ToString().ToEntero();
+ if (!(dtempleados.SUM(string.Format("[V_{0}]", CveConcepto)) > 0))
+ {
+ BorradoLogico = 1;
+ }
+ row["BorradoLogico"] = BorradoLogico;
+ }
+ dtObl.AcceptChanges();
+ dtper = dtper.FiltraParametros("BorradoLogico=0");
+ dtded = dtded.FiltraParametros("BorradoLogico=0");
+ dtObl = dtObl.FiltraParametros("BorradoLogico=0");
+ int maxper = dtper.Rows.Count;
+ int maxded = dtded.Rows.Count;
+ int maxObl = dtObl.Rows.Count;
+ int i = 0;
+ List lconc = new List();
+ for (i = 0; i < maxper || i < maxded || i < maxObl; i++)
+ {
+ NConcepto nConcepto = new NConcepto();
+ DataRow row;
+ if (maxper > i)
+ {
+ row = dtper.Rows[i];
+ int CveConcepto = row["CveConcepto"].ToString().ToEntero();
+ string Concepto = row["Concepto"].ToString();
+ string Codigo = row["Codigo"].ToString();
+ //bool visible = (dtempleados.SUM(string.Format("[V_{0}]", CveConcepto)) > 0);
+ double Importe = dtempleados.SUM(string.Format("[V_{0}]", CveConcepto), string.Format("CvePersonal = {0}", 1));
+ nConcepto.CveConceptoP = CveConcepto;
+ nConcepto.ConceptoP = Concepto;
+ nConcepto.NoConceptoP = Codigo;
+ nConcepto.ImporteP = Importe;
+ nConcepto.ValorP = dtempleados.SUM(string.Format("[VAL_{0}]", CveConcepto), string.Format("CvePersonal = {0}", 1));
+ }
+ if (maxded > i)
+ {
+ row = dtded.Rows[i];
+ int CveConcepto = row["CveConcepto"].ToString().ToEntero();
+ string Concepto = row["Concepto"].ToString();
+ string Codigo = row["Codigo"].ToString();
+ //bool visible = (dtempleados.SUM(string.Format("[V_{0}]", CveConcepto)) > 0);
+ double Importe = dtempleados.SUM(string.Format("[V_{0}]", CveConcepto), string.Format("CvePersonal = {0}", 1));
+ nConcepto.CveConceptoD = CveConcepto;
+ nConcepto.ConceptoD = Concepto;
+ nConcepto.NoConceptoD = Codigo;
+ nConcepto.ImporteD = Importe;
+ nConcepto.ValorD = dtempleados.SUM(string.Format("[VAL_{0}]", CveConcepto), string.Format("CvePersonal = {0}", 1));
+ }
+ if (maxObl > i)
+ {
+ row = dtObl.Rows[i];
+ int CveConcepto = row["CveConcepto"].ToString().ToEntero();
+ string Concepto = row["Concepto"].ToString();
+ string Codigo = row["Codigo"].ToString();
+ //bool visible = (dtempleados.SUM(string.Format("[V_{0}]", CveConcepto)) > 0);
+ double Importe = dtempleados.SUM(string.Format("[V_{0}]", CveConcepto), string.Format("CvePersonal = {0}", 1));
+ nConcepto.CveConceptoO = CveConcepto;
+ nConcepto.ConceptoO = Concepto;
+ nConcepto.NoConceptoO = Codigo;
+ nConcepto.ImporteO = Importe;
+ nConcepto.ValorO = dtempleados.SUM(string.Format("[VAL_{0}]", CveConcepto), string.Format("CvePersonal = {0}", 1));
+ }
+ lconc.Add(nConcepto);
+ }
+
+ lconc.Add(new NConcepto());
+
+ NConcepto SubTotales = new NConcepto();
+ SubTotales.CveConceptoP = 0;
+ SubTotales.ConceptoP = "Total Percepciones";
+ SubTotales.EstatusP = -2;
+ SubTotales.ImporteP = dtempleados.SUM("SumaPercepciones", string.Format("CvePersonal = {0}", 1));
+ ///Alert(SubTotales.ImporteP.ToString());
+
+ SubTotales.CveConceptoD = 0;
+ SubTotales.ConceptoD = "Total Deducciones";
+ SubTotales.EstatusD = -2;
+ SubTotales.ImporteD = dtempleados.SUM("SumaDeducciones", string.Format("CvePersonal = {0}", 1));
+ SubTotales.CveConceptoD = 0;
+
+ SubTotales.ConceptoO = "Total Obligaciones";
+ SubTotales.EstatusO = -2;
+ SubTotales.ImporteO = dtempleados.SUM("SumaObligaciones", string.Format("CvePersonal = {0}", 1));
+
+ //NConcepto Totales = new NConcepto();
+ //Totales.CveConceptoD = 0;
+ //Totales.ConceptoD = "Total";
+ //Totales.EstatusD = -3;
+ //Totales.ImporteD = dtempleados.SUM("Total", string.Format("CvePersonal = {0}", 1));
+
+ lconc.Add(SubTotales);
+ //lconc.Add(Totales);
+ GvConceptossimulador.DataSource = lconc;
+ GvConceptossimulador.DataBind();
+ }
+ }
+ UpSimulador.Update();
+ }
+
+ protected void DdlTipoPeriodoSim_SelectedIndexChanged(object sender, EventArgs e)
+ {
+
+ }
+
+
+ protected void LnkDownArchivosSua_Click(object sender, EventArgs e)
+ {
+ TxtFechaInicio.Text = DateTime.Now.AddDays(DateTime.Now.Day - 1).ToString("dd/MM/yyy");
+ TXTFechaFin.Text = DateTime.Now.AddDays(DateTime.Now.Day - 1).AddMonths(1).AddDays(-1).ToString("dd/MM/yyy");
+
+ RegistraScript("$('#DmodalGetSua').modal();");
+ UpModalGetSUA.Update();
+ }
+
+ protected void LnkGetTxtsSUA_Click(object sender, EventArgs e)
+ {
+ string concater = "";
+ string MovtosAfil = "";
+ string MovtosmodSalario = "";
+ string movtosBajas = "";
+ using (ClsRH ObjPersonal = new ClsRH())
+ {
+ if (ObjPersonal.GetMovimientosToSUA(UsuarioActual.CveEmpresa, TxtFechaInicio.Text.ToDate().ToString("yyyy/MM/dd"), TXTFechaFin.Text.ToDate().ToString("yyyy/MM/dd")))
+ {
+ //01: MovtosAfil
+ concater = "";
+ foreach (var item in ObjPersonal.DtResultados.Select("Tipo=1"))
+ {
+ MovtosAfil = string.Format("{0}{1}{2}", MovtosAfil, concater, item["Movtotxt"]);
+ concater = "\\r\\n";
+ }
+
+ //02: MovtosmodSalario
+ concater = "";
+ foreach (var item in ObjPersonal.DtResultados.Select("Tipo=2"))
+ {
+ MovtosmodSalario = string.Format("{0}{1}{2}", MovtosmodSalario, concater, item["Movtotxt"]);
+ concater = "\\r\\n";
+ }
+ //03: movtosBajas
+ concater = "";
+ foreach (var item in ObjPersonal.DtResultados.Select("Tipo=3"))
+ {
+ movtosBajas = string.Format("{0}{1}{2}", movtosBajas, concater, item["Movtotxt"]);
+ concater = "\\r\\n";
+ }
+
+ }
+ string script = "";// string.Format("SaveCsv(\"MovtosAfil.txt\", '{0}');SaveCsv(\"MovtosmodSalario.txt\", '{1}');SaveCsv(\"movtosBajas.txt\", '{2}');", MovtosAfil.Replace("'", "\\'"), MovtosmodSalario.Replace("'", "\\'"), movtosBajas.Replace("'", "\\'"));
+ if (ChkSuaAltas.Checked)
+ {
+ script = string.Format("{1}SaveCsv(\"MovtosAfil.txt\", '{0}');", MovtosAfil.Replace("'", "\\'"), script);
+ }
+ if (ChkSuaBajas.Checked)
+ {
+ script = string.Format("{1}SaveCsv(\"movtosBajas.txt\", '{0}');", movtosBajas.Replace("'", "\\'"), script);
+ }
+
+ RegistraScript(script);
+ RegistraScript("$('#DmodalGetSua').modal('hide');");
+ }
+
+ }
+
+ protected void LnkUpSuamodal_Click(object sender, EventArgs e)
+ {
+ TxtArchivoSua.Text = "";
+ GVProcesarSUA.DataSource = null;
+ GVProcesarSUA.DataBind();
+ RegistraScript("$('#DmodalCompareSua').modal();shownew();");
+ UpArchivoSua.Update();
+ }
+ protected void LnkUpSuaFile_Click(object sender, EventArgs e)
+ {
+ string fileurl = "";
+ GVProcesarSUA.DataSource = null;
+ Files archivos = TxtArchivoSua.getfiles();
+ if (archivos.Archivos.Count > 0)
+ {
+ fileurl = archivos.Archivos[0].FileUrl;
+ string SuaFiletext = System.IO.File.ReadAllText(fileurl, Encoding.GetEncoding("iso-8859-1"));
+ using (ClsNominas ObjPersonal = new ClsNominas())
+ {
+ if (ObjPersonal.ProcesarSUA(SuaFiletext, UsuarioActual.CveEmpresa))
+ {
+ if (ObjPersonal.DTSetResultados.Tables.Count > 4)
+ {
+ DateTime dateperiodo;
+ DateTime.TryParseExact(string.Format("{0}01", ObjPersonal.DTSetResultados.Tables[1].Rows[0]["Periodo"]), "yyyyMMdd", new System.Globalization.CultureInfo("es-MX"), System.Globalization.DateTimeStyles.None, out dateperiodo);
+ LtlPeriodo.Text = dateperiodo.Date.ToString("MMMM yyyy", new System.Globalization.CultureInfo("es-MX"));
+ DtSuaProcesado = ObjPersonal.DTSetResultados.Tables[3];
+ GVProcesarSUA.DataSource = ObjPersonal.DTSetResultados.Tables[3];
+ }
+ }
+ }
+
+ }
+ GVProcesarSUA.DataBind();
+ TxtArchivoSua.Text = "";
+ RegistraScript("showResult();");
+ UpArchivoSua.Update();
+ }
+
+
+
+ protected void GVProcesarSUA_RowDataBound(object sender, GridViewRowEventArgs e)
+ {
+
+ if (e.Row.RowType == DataControlRowType.DataRow)
+ {
+ if (e.Row.RowIndex == 0)
+ {
+ e.Row.CssClass = "Totales";
+ }
+ string SalarioSUA = string.Format("{0:N2}", e.Row.DataKey("SalarioSUA").ToDecimal());
+ string SalarioSIG = string.Format("{0:N2}", e.Row.DataKey("SalarioSIG").ToDecimal());
+ int celda = 1;
+ if (SalarioSUA != SalarioSIG)
+ {
+ e.Row.Cells[celda].CssClass = "cellFail";
+ e.Row.Cells[celda + 1].CssClass = "cellFail";
+ }
+ celda = celda + 4;
+ string CuotaExcedenteSUA = string.Format("{0:N2}", e.Row.DataKey("CuotaExcedenteSUA").ToDecimal());
+ string CuotaExcedenteSIG = string.Format("{0:N2}", e.Row.DataKey("CuotaExcedenteSIG").ToDecimal());
+ if (CuotaExcedenteSUA != CuotaExcedenteSIG)
+ {
+ e.Row.Cells[celda].CssClass = "cellFail";
+ e.Row.Cells[celda + 1].CssClass = "cellFail";
+ }
+ celda = celda + 2;
+ string PrestacionesDineroSUA = string.Format("{0:N2}", e.Row.DataKey("PrestacionesDineroSUA").ToDecimal());
+ string PrestacionesSIG = string.Format("{0:N2}", e.Row.DataKey("PrestacionesSIG").ToDecimal());
+ if (PrestacionesDineroSUA != PrestacionesSIG)
+ {
+ e.Row.Cells[celda].CssClass = "cellFail";
+ e.Row.Cells[celda + 1].CssClass = "cellFail";
+ }
+ celda = celda + 2;
+ string GastosMedPenSUA = string.Format("{0:N2}", e.Row.DataKey("GastosMedPenSUA").ToDecimal());
+ string GastosMedicosSIG = string.Format("{0:N2}", e.Row.DataKey("GastosMedicosSIG").ToDecimal());
+ if (GastosMedPenSUA != GastosMedicosSIG)
+ {
+ e.Row.Cells[celda].CssClass = "cellFail";
+ e.Row.Cells[celda + 1].CssClass = "cellFail";
+ }
+ celda = celda + 2;
+ string InvalidezyVidaSUA = string.Format("{0:N2}", e.Row.DataKey("InvalidezyVidaSUA").ToDecimal());
+ string InvalidezyVidaSIG = string.Format("{0:N2}", e.Row.DataKey("InvalidezyVidaSIG").ToDecimal());
+ if (InvalidezyVidaSUA != InvalidezyVidaSIG)
+ {
+ e.Row.Cells[celda].CssClass = "cellFail";
+ e.Row.Cells[celda + 1].CssClass = "cellFail";
+ }
+ celda = celda + 2;
+ string CesantiayVejezObreraSUA = string.Format("{0:N2}", e.Row.DataKey("CesantiayVejezObreraSUA").ToDecimal());
+ string CesantiayVejezObreraSIG = string.Format("{0:N2}", e.Row.DataKey("CesantiayVejezObreraSIG").ToDecimal());
+ if (CesantiayVejezObreraSUA != CesantiayVejezObreraSIG)
+ {
+ e.Row.Cells[celda].CssClass = "cellFail";
+ e.Row.Cells[celda + 1].CssClass = "cellFail";
+ }
+ celda = celda + 2;
+ string CuotaFijaSUA = string.Format("{0:N2}", e.Row.DataKey("CuotaFijaSUA").ToDecimal());
+ string CuotaFijaSIG = string.Format("{0:N2}", e.Row.DataKey("CuotaFijaSIG").ToDecimal());
+ if (CuotaFijaSUA != CuotaFijaSIG)
+ {
+ e.Row.Cells[celda].CssClass = "cellFail";
+ e.Row.Cells[celda + 1].CssClass = "cellFail";
+ }
+ celda = celda + 2;
+ string RiesgosdeTrabajoSUA = string.Format("{0:N2}", e.Row.DataKey("RiesgosdeTrabajoSUA").ToDecimal());
+ string RiesgoTrabajoSIG = string.Format("{0:N2}", e.Row.DataKey("RiesgoTrabajoSIG").ToDecimal());
+ if (RiesgosdeTrabajoSUA != RiesgoTrabajoSIG)
+ {
+ e.Row.Cells[celda].CssClass = "cellFail";
+ e.Row.Cells[celda + 1].CssClass = "cellFail";
+ }
+ celda = celda + 2;
+ string GuarderiaSUA = string.Format("{0:N2}", e.Row.DataKey("GuarderiaSUA").ToDecimal());
+ string GuarderiaSIG = string.Format("{0:N2}", e.Row.DataKey("GuarderiaSIG").ToDecimal());
+ if (GuarderiaSUA != GuarderiaSIG)
+ {
+ e.Row.Cells[celda].CssClass = "cellFail";
+ e.Row.Cells[celda + 1].CssClass = "cellFail";
+ }
+ celda = celda + 2;
+ string RetiroSUA = string.Format("{0:N2}", e.Row.DataKey("RetiroSUA").ToDecimal());
+ string RetiroSIG = string.Format("{0:N2}", e.Row.DataKey("RetiroSIG").ToDecimal());
+ if (RetiroSUA != RetiroSIG)
+ {
+ e.Row.Cells[celda].CssClass = "cellFail";
+ e.Row.Cells[celda + 1].CssClass = "cellFail";
+ }
+ celda = celda + 2;
+ string CesantiayVejezPatronalSUA = string.Format("{0:N2}", e.Row.DataKey("CesantiayVejezPatronalSUA").ToDecimal());
+ string CesantiayVejezPatronalSIG = string.Format("{0:N2}", e.Row.DataKey("CesantiayVejezPatronalSIG").ToDecimal());
+ if (CesantiayVejezPatronalSUA != CesantiayVejezPatronalSIG)
+ {
+ e.Row.Cells[celda].CssClass = "cellFail";
+ e.Row.Cells[celda + 1].CssClass = "cellFail";
+ }
+
+ }
+ }
+
+ protected void LnkDownExcelSua_Click(object sender, EventArgs e)
+ {
+
+ ClosedXML.Excel.XLWorkbook wb = new ClosedXML.Excel.XLWorkbook();
+ var libro = wb.AddWorksheet("SUA");
+ int Fila = 1;
+ libro.Column(1).Width = 50;
+ ClosedXML.Excel.IXLRange range = libro.Range(Fila, 2, Fila, 3);
+ range.Merge();
+ range.Value = "Salario";
+ range = libro.Range(Fila, 4, Fila, 5);
+ range.Merge();
+ range.Value = "Días";
+ range = libro.Range(Fila, 6, Fila, 7);
+ range.Merge();
+ range.Value = "Cuota Fija";
+ range = libro.Range(Fila, 8, Fila, 9);
+ range.Merge();
+ range.Value = "Cuota Excedente";
+ range = libro.Range(Fila, 10, Fila, 11);
+ range.Merge();
+ range.Value = "Prestaciones en Dinero";
+ range = libro.Range(Fila, 12, Fila, 13);
+ range.Merge();
+ range.Value = "Gastos Medicos";
+ range = libro.Range(Fila, 14, Fila, 15);
+ range.Merge();
+ range.Value = "Riesgos de Trabajo";
+ range = libro.Range(Fila, 16, Fila, 17);
+ range.Merge();
+ range.Value = "Invalidez y Vida";
+ range = libro.Range(Fila, 18, Fila, 19);
+ range.Merge();
+ range.Value = "Guarderia";
+ range = libro.Range(Fila, 20, Fila, 21);
+ range.Merge();
+ range.Value = "Retiro";
+ Fila = Fila + 1;
+ libro.Cell(Fila, 1).Value = "Empleado";
+ libro.Cell(Fila, 2).Value = "SUA"; //SalarioSUA
+ libro.Cell(Fila, 3).Value = "SIG";//SalarioSIG
+ libro.Cell(Fila, 4).Value = "SUA";//CuotaFijaSUA
+ libro.Cell(Fila, 5).Value = "SIG";//CuotaFijaSIG
+ libro.Cell(Fila, 6).Value = "SUA";//CuotaExcedenteSUA
+ libro.Cell(Fila, 7).Value = "SIG";//CuotaExcedenteSIG
+ libro.Cell(Fila, 8).Value = "SUA";//PrestacionesDineroSUA
+ libro.Cell(Fila, 9).Value = "SIG";//PrestacionesSIG
+ libro.Cell(Fila, 10).Value = "SUA";//GastosMedPenSUA
+ libro.Cell(Fila, 11).Value = "SIG";//GastosMedicosSIG
+ libro.Cell(Fila, 12).Value = "SUA";//RiesgosdeTrabajoSUA
+ libro.Cell(Fila, 13).Value = "SIG";//RiesgoTrabajoSIG
+ libro.Cell(Fila, 14).Value = "SUA";//InvalidezyVidaSUA
+ libro.Cell(Fila, 15).Value = "SIG";//InvalidezyVidaSIG
+ libro.Cell(Fila, 16).Value = "SUA";//GuarderiaSUA
+ libro.Cell(Fila, 17).Value = "SIG";//GuarderiaSIG
+ libro.Cell(Fila, 18).Value = "SUA";//RetiroSUA
+ libro.Cell(Fila, 19).Value = "SIG";//RetiroSIG
+ libro.Cell(Fila, 20).Value = "SUA";//RetiroSUA
+ libro.Cell(Fila, 21).Value = "SIG";//RetiroSIG
+
+
+ libro.Cell(1, 1).Style.Font.FontColor = ClosedXML.Excel.XLColor.White;
+ libro.Cell(1, 1).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(79, 129, 189));
+ libro.Row(1).CellsUsed().Style.Font.FontColor = ClosedXML.Excel.XLColor.White;
+ libro.Row(1).CellsUsed().Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(79, 129, 189));
+ libro.Row(2).CellsUsed().Style.Font.FontColor = ClosedXML.Excel.XLColor.White;
+ libro.Row(2).CellsUsed().Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(79, 129, 189));
+
+ foreach (DataRow erow in DtSuaProcesado.Rows)
+ {
+ Fila++;
+ libro.Cell(Fila, 1).Value = erow["CodigoNombreCompleto"];
+ libro.Cell(Fila, 2).Value = string.Format("{0:N2}", erow["SalarioSUA"]);
+ libro.Cell(Fila, 3).Value = string.Format("{0:N2}", erow["SalarioSIG"]);
+ libro.Cell(Fila, 4).Value = string.Format("{0:N2}", erow["DiasMes"]);
+ libro.Cell(Fila, 5).Value = string.Format("{0:N2}", erow["DiasAsistio"]);
+ libro.Cell(Fila, 6).Value = string.Format("{0:N2}", erow["CuotaFijaSUA"]);
+ libro.Cell(Fila, 7).Value = string.Format("{0:N2}", erow["CuotaFijaSIG"]);
+ libro.Cell(Fila, 8).Value = string.Format("{0:N2}", erow["CuotaExcedenteSUA"]);
+ libro.Cell(Fila, 9).Value = string.Format("{0:N2}", erow["CuotaExcedenteSIG"]);
+ libro.Cell(Fila, 10).Value = string.Format("{0:N2}", erow["PrestacionesDineroSUA"]);
+ libro.Cell(Fila, 11).Value = string.Format("{0:N2}", erow["PrestacionesSIG"]);
+ libro.Cell(Fila, 12).Value = string.Format("{0:N2}", erow["GastosMedPenSUA"]);
+ libro.Cell(Fila, 13).Value = string.Format("{0:N2}", erow["GastosMedicosSIG"]);
+ libro.Cell(Fila, 14).Value = string.Format("{0:N2}", erow["RiesgosdeTrabajoSUA"]);
+ libro.Cell(Fila, 15).Value = string.Format("{0:N2}", erow["RiesgoTrabajoSIG"]);
+ libro.Cell(Fila, 16).Value = string.Format("{0:N2}", erow["InvalidezyVidaSUA"]);
+ libro.Cell(Fila, 17).Value = string.Format("{0:N2}", erow["InvalidezyVidaSIG"]);
+ libro.Cell(Fila, 18).Value = string.Format("{0:N2}", erow["GuarderiaSUA"]);
+ libro.Cell(Fila, 19).Value = string.Format("{0:N2}", erow["GuarderiaSIG"]);
+ libro.Cell(Fila, 20).Value = string.Format("{0:N2}", erow["RetiroSUA"]);
+ libro.Cell(Fila, 21).Value = string.Format("{0:N2}", erow["RetiroSIG"]);
+ }
+ //libro.Row(2).SetAutoFilter();
+
+
+
+
+ System.IO.Stream fs = new System.IO.MemoryStream();
+ wb.SaveAs(fs);
+ 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", "FormatoCargaNominas"));
+ Response.BinaryWrite(memoryStream.ToArray());
+ Response.End();
+ }
+
+
+ #region Incapacidad
+ private int CcvePersonalIncapacidad
+ {
+ get { return (ViewState["CcvePersonalIncapacidad"] == null) ? 0 : Convert.ToInt32(ViewState["CcvePersonalIncapacidad"]); }
+ set { ViewState["CcvePersonalIncapacidad"] = value; }
+ }
+ protected void CargaPersonalIncapacidad()
+ {
+
+ LimpiaPersonalIncapacidad();
+ LnkAgregarIncapacidad.Visible = false;
+ LnkActualizarIncapacidad.Visible = false;
+ CcvePersonalIncapacidad = 0;
+
+
+ using (ClsNominas ObjPers = new ClsNominas())
+ {
+ ObjPers.PersonalIncapacidadGet(-1, SRCvePersonal, UsuarioActual.CveEmpresa);
+ GVNom_PersonalIncapacidad.DataSource = ObjPers.DtResultados;
+ }
+ GVNom_PersonalIncapacidad.DataBind();
+ UpsrIncapacidadpersonal.Update();
+ }
+ protected void LimpiaPersonalIncapacidad()
+ {
+ TxtSRINCfolio.Text = "";
+ TxtSRINCfechaInicio.Text = "";
+ TxtSRINCdiasAutorizados.Text = "";
+ DdlSRINCcveTipodeIncidencia.SelectedValue = "-1";
+ DdlSRINCcveRamoSeguro.SelectedValue = "-1";
+ DdlSRINCcveTipoRiesgo.SelectedValue = "-1";
+ TxtSRINCporcentajedeIncapacidad.Text = "100";
+ DdlSRINCcveSecuelaConsecuencia.SelectedValue = "-1";
+ DdlSRINCcveControlIncapacidad.SelectedValue = "-1";
+ TxtSRINCdescripcion.Text = "";
+ UpsrIncapacidadpersonal.Update();
+ }
+ protected void LnkPersonalIncapacidad_Click(object sender, EventArgs e)
+ {
+
+ LimpiaPersonalIncapacidad();
+ #region GetDatos
+ GridViewRow gvRow = (GridViewRow)(((LinkButton)sender).NamingContainer);
+ CcvePersonalIncapacidad = gvRow.DataKey("CvePersonalIncapacidad").ToEntero();
+ int cvePersonal = gvRow.DataKey("CvePersonal").ToEntero();
+ string folio = gvRow.DataKey("Folio");
+ DateTime fechaInicio = gvRow.DataKey("FechaInicio").ToDateTime();
+ int diasAutorizados = gvRow.DataKey("DiasAutorizados").ToEntero();
+ int cveTipodeIncidencia = gvRow.DataKey("CveTipodeIncidencia").ToEntero();
+ int cveRamoSeguro = gvRow.DataKey("CveRamoSeguro").ToEntero();
+ int cveTipoRiesgo = gvRow.DataKey("CveTipoRiesgo").ToEntero();
+ int porcentajedeIncapacidad = gvRow.DataKey("PorcentajedeIncapacidad").ToEntero();
+ int cveSecuelaConsecuencia = gvRow.DataKey("CveSecuelaConsecuencia").ToEntero();
+ int cveControlIncapacidad = gvRow.DataKey("CveControlIncapacidad").ToEntero();
+ string descripcion = gvRow.DataKey("Descripcion");
+ #endregion
+ TxtSRINCfolio.Text = folio.ToString();
+ TxtSRINCfechaInicio.Text = $"{fechaInicio:dd/MM/yyyy}";
+ TxtSRINCdiasAutorizados.Text = diasAutorizados.ToString();
+ DdlSRINCcveTipodeIncidencia.SelectedValueExist(cveTipodeIncidencia.ToString());
+ DdlSRINCcveRamoSeguro.SelectedValueExist(cveRamoSeguro.ToString());
+ DdlSRINCcveTipoRiesgo.SelectedValueExist(cveTipoRiesgo.ToString());
+ TxtSRINCporcentajedeIncapacidad.Text = porcentajedeIncapacidad.ToString();
+ DdlSRINCcveSecuelaConsecuencia.SelectedValueExist(cveSecuelaConsecuencia.ToString());
+ DdlSRINCcveControlIncapacidad.SelectedValueExist(cveControlIncapacidad.ToString());
+ TxtSRINCdescripcion.Text = descripcion.ToString();
+ LnkAgregarIncapacidad.Visible = false;
+ //LnkActualizarIncapacidad.Visible = true;
+ }
+ protected void LnkshowaaddIncapacidad_Click(object sender, EventArgs e)
+ {
+ LimpiaPersonalIncapacidad();
+ LnkAgregarIncapacidad.Visible = true;
+ LnkActualizarIncapacidad.Visible = false;
+ CcvePersonalIncapacidad = 0;
+ }
+ protected void LnkAgregarIncapacidad_Click(object sender, EventArgs e)
+ {
+
+ string folio = TxtSRINCfolio.Text;
+ DateTime fechaInicio = TxtSRINCfechaInicio.Text.ToDateTime();
+ int diasAutorizados = TxtSRINCdiasAutorizados.Text.ToEntero();
+ int cveTipodeIncidencia = DdlSRINCcveTipodeIncidencia.Text.ToEntero();
+ int cveRamoSeguro = DdlSRINCcveRamoSeguro.Text.ToEntero();
+ int cveTipoRiesgo = DdlSRINCcveTipoRiesgo.Text.ToEntero();
+ int porcentajedeIncapacidad = TxtSRINCporcentajedeIncapacidad.Text.ToEntero();
+ int cveSecuelaConsecuencia = DdlSRINCcveSecuelaConsecuencia.Text.ToEntero();
+ int cveControlIncapacidad = DdlSRINCcveControlIncapacidad.Text.ToEntero();
+ string descripcion = TxtSRINCdescripcion.Text;
+ bool Continuar;
+ using (ClsNominas ObjPers = new ClsNominas())
+ {
+ Continuar = ObjPers.PersonalIncapacidadAdd(UsuarioActual.CveUsuario, SRCvePersonal, folio, fechaInicio, diasAutorizados, cveTipodeIncidencia, cveRamoSeguro, cveTipoRiesgo, porcentajedeIncapacidad, cveSecuelaConsecuencia, cveControlIncapacidad, descripcion);
+ }
+ if (Continuar)
+ {
+ CargaPersonalIncapacidad();
+ UpsrIncapacidadpersonal.Update();
+ this.Alert("La incapacidad se ha agregado.", TipoMensaje.ToastInformacion);
+ }
+ }
+ protected void LnkActualizarIncapacidad_Click(object sender, EventArgs e)
+ {
+
+ string folio = TxtSRINCfolio.Text;
+ DateTime fechaInicio = TxtSRINCfechaInicio.Text.ToDateTime();
+ int diasAutorizados = TxtSRINCdiasAutorizados.Text.ToEntero();
+ int cveTipodeIncidencia = DdlSRINCcveTipodeIncidencia.Text.ToEntero();
+ int cveRamoSeguro = DdlSRINCcveRamoSeguro.Text.ToEntero();
+ int cveTipoRiesgo = DdlSRINCcveTipoRiesgo.Text.ToEntero();
+ int porcentajedeIncapacidad = TxtSRINCporcentajedeIncapacidad.Text.ToEntero();
+ int cveSecuelaConsecuencia = DdlSRINCcveSecuelaConsecuencia.Text.ToEntero();
+ int cveControlIncapacidad = DdlSRINCcveControlIncapacidad.Text.ToEntero();
+ string descripcion = TxtSRINCdescripcion.Text;
+ bool Continuar;
+ using (ClsNominas ObjPers = new ClsNominas())
+ {
+ Continuar = ObjPers.PersonalIncapacidadUp(UsuarioActual.CveUsuario, CcvePersonalIncapacidad, folio, fechaInicio, diasAutorizados,
+ cveTipodeIncidencia, cveRamoSeguro, cveTipoRiesgo, porcentajedeIncapacidad, cveSecuelaConsecuencia, cveControlIncapacidad, descripcion);
+ }
+ if (Continuar)
+ {
+ CargaPersonalIncapacidad();
+ UpsrIncapacidadpersonal.Update();
+ this.Alert("La incapacidad se ha actualizado.", TipoMensaje.ToastInformacion);
+ }
+ }
+ #endregion
+
+
+ protected void LnkSRVacacionesUP_Click(object sender, EventArgs e)
+ {
+
+ }
+
+ protected void LnkSRVacacionesADD_Click(object sender, EventArgs e)
+ {
+
+ DateTime fInicio = TxtvacFechaInicio.Text.ToDate();
+ DateTime fFin = TxtvacFechaFin.Text.ToDate();
+ string fechapago = TxtvacFechaPago.Text.ToDate().ToString("yyyy/MM/dd");
+ int diasinhabil = TxtvacDiasFeriados.Text.ToEntero();
+ // Dim motivoVacaciones As String = TxtMotivoVacaciones.Text
+ int VacCveSupervisor = 0;
+ int VacFolioActual = 0;
+ if (fInicio <= fFin)
+ {
+ using (ClsRH objRHx = new ClsRH())
+ {
+
+ if (objRHx.VacacionesResumenGet(SRCvePersonal, UsuarioActual.Empresa.CveEmpresa))
+ {
+ if (objRHx.DtResultados.Rows.Count > 0)
+ {
+ VacCveSupervisor = objRHx.DtResultados.Rows[0]["SupervisorCorreo"].ToString().ToEntero();
+ }
+ }
+
+ if (objRHx.VacacionesGet(SRCvePersonal, UsuarioActual.Empresa.CveEmpresa))
+ {
+ if (objRHx.DtResultados.Rows.Count > 0)
+ {
+ VacFolioActual = objRHx.DtResultados.Compute("Max(Folio)", string.Empty).ToString().ToEntero();
+ }
+ }
+ }
+
+ VacFolioActual = VacFolioActual + 1;
+ ClsRH objRH = new ClsRH();
+ // Dim continuar As Boolean = objRH.SolicitudVacacionesAdd(CvePersonal, fInicio, fFin, 0, UsuarioActual.CveUsuario, VacCveSupervisor, VacFolioActual, motivoVacaciones)
+ bool continuar = objRH.SolicitudVacacionesAdd(SRCvePersonal, fInicio, fFin, 0, UsuarioActual.CveUsuario, VacCveSupervisor, VacFolioActual, FechaPago: fechapago, diasinabiles: diasinhabil, CveTipoPago: DdlFormapagovacaciones.SelectedValue.ToEntero(), diasExtras: TxtVacDiasExtra.Text.ToEntero());//
+ if (objRH.DtResultados.Rows.Count > 0)
+ {
+ string ShowError = objRH.DtResultados.Rows[0]["ShowError"].ToString();
+ if (ShowError.Length > 0)
+ {
+ Alert(ShowError, TipoMensaje.MsgAdvertencia);
+ continuar = false;
+ }
+ }
+ objRH.Dispose();
+ if (continuar)
+ {
+
+
+ TxtvacFechaInicio.Text = "";
+ TxtvacFechaFin.Text = "";
+ TxtvacFechaPago.Text = "";
+ TxtvacDiasFeriados.Text = "";
+ CargaVacaciones();
+ //CargaVacacionesResumenPeriodoActual();
+ //VacacionesMandaCorreoSupervisor("Solicitud Vacaciones " + NombreCompleto, VacSupervisorCorreo, VacSupervisorNombre, NombreCompleto, fInicio, fFin);
+ Alert("Las vacaciones se han solicitado");
+ }
+ }
+ else { Alert("La fecha Inicial debe ser inferior a la fecha final.", TipoMensaje.MsgAdvertencia); }
+ }
+ protected void GvVacaciones_RowDataBound(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e)
+ {
+ if (e.Row.RowType == DataControlRowType.DataRow)
+ {
+ bool _Estatus = bool.Parse(e.Row.DBCampo("Estatus").ToString());
+ string _Documento = e.Row.DataKey("Documento");
+ int _CveAutoriza = e.Row.DataKey("CveAutoriza").ToEntero();
+ string RutaDocuemntoAutorizacion = string.Format(@"{0}Personal\{1}\Vacaciones\{2}", UsuarioActual.Empresa.Ruta, SRCvePersonal, _Documento);
+ LinkButton lnkDescargaFormato = e.Row.FCLinkButton("ImgDescargaFormato");
+ LinkButton lnkDescargaAutorizacion = e.Row.FCLinkButton("ImgDescargaAutorizacion");
+ LinkButton lnkEditar = e.Row.FCLinkButton("ImgEditar");
+ lnkEditar.Visible = true;
+ lnkDescargaFormato.Visible = true;
+ if (_CveAutoriza > 0 | !_Estatus)
+ {
+ lnkEditar.Visible = false;
+ lnkDescargaFormato.Visible = false;
+
+ }
+ // ScriptManager.GetCurrent(Me).RegisterAsyncPostBackControl(lnkDescargaFormato)
+ if (File.Exists(RutaDocuemntoAutorizacion) & _Estatus) { lnkDescargaAutorizacion.Visible = true; }
+ else { lnkDescargaAutorizacion.Visible = false; }
+
+ if (lnkDescargaAutorizacion != null && lnkDescargaAutorizacion.Visible) { ScriptManager.GetCurrent(this).RegisterPostBackControl(lnkDescargaAutorizacion); }
+ if (lnkDescargaFormato != null && lnkDescargaFormato.Visible) { ScriptManager.GetCurrent(this).RegisterPostBackControl(lnkDescargaFormato); }
+
+
+ }
+ }
+ protected void LnkEliminarSolicitud_Click(object sender, EventArgs e)
+ {
+ GridViewRow GvRow = (GridViewRow)((LinkButton)sender).NamingContainer;
+ int CvePersonalVacaciones = GvRow.DataKey("CvePersonalVacaciones").ToEntero();
+
+ ClsRH objRH = new ClsRH();
+ if (objRH.RemoverSolicitudVacaciones(CvePersonalVacaciones))
+ {
+ CargaVacaciones();
+ Alert("Las vacaciones se ha eliminado");
+ }
+ objRH.Dispose();
+ }
+
+ protected int CvePersonalVacaciones
+ {
+ get
+ {
+ if (ViewState["CvePersonalVacaciones"] == null) { return 0; }
+ else { return ViewState["CvePersonalVacaciones"].ToString().ToEntero(); }
+ }
+
+ set { ViewState["CvePersonalVacaciones"] = value; }
+ }
+ public void Edit_ClickVacacionDia(object sender, EventArgs e)
+ {
+ GridViewRow GvRow = (GridViewRow)((LinkButton)sender).NamingContainer;
+
+ CvePersonalVacaciones = GvRow.DataKey("CvePersonalVacaciones").ToEntero();
+ //VacFolio = GvRow.DataKey("Folio").ToString().ToEntero;
+
+
+ TxtFechaDiaVacacion.Text = GvRow.DataKey("FechaInicio").ToString().ToDate().ToString("dd/MM/yyyy");
+ TxtFechaDiaVacacionFin.Text = GvRow.DataKey("FechaFin").ToString().ToDate().ToString("dd/MM/yyyy");
+
+ RegistraScript("$('#divEditarDiaVacacion').modal({ backdrop: 'static', keyboard: false});");
+ UpModalEditarDiaVacacion.Update();
+ }
+ protected void BtnEditarDiaVacacionModal_Click(object sender, EventArgs e)
+ {
+ using (ClsRH objRH = new ClsRH())
+ {
+
+ string FileExtension = "-1";
+ List Filesgral = TxtFileFormatoVacaciones.getfiles().Archivos;
+ string Documento = "";
+
+ foreach (Archivo fileItem in Filesgral)
+ {
+ try
+ {
+ FileExtension = System.IO.Path.GetExtension(string.Format(@"{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, fileItem.filename)).Replace(".", "");
+ Documento = $"Vacaciones_{CvePersonalVacaciones}.{FileExtension}";
+ string[] tempArray;
+ tempArray = fileItem.filename.ToString().Split("-".ToCharArray());
+
+ string rutaDestino = $@"{UsuarioActual.Empresa.Ruta}Personal\{SRCvePersonal}\Vacaciones\{Documento}";
+
+ if (!System.IO.Directory.Exists(UsuarioActual.Empresa.Ruta + @"Personal\" + SRCvePersonal + @"\Vacaciones\"))
+ System.IO.Directory.CreateDirectory(UsuarioActual.Empresa.Ruta + @"Personal\" + SRCvePersonal + @"\Vacaciones\");
+
+
+ if (System.IO.File.Exists(rutaDestino))
+ System.IO.File.Delete(rutaDestino);
+
+ System.IO.File.Move(fileItem.FileUrl, rutaDestino);
+
+ TxtFileFormatoVacaciones.Text = "";
+ }
+ catch (Exception ex)
+ {
+ // OnError("Error al cargar Formato vacaciones", ex);
+ }
+ }
+ if (Documento.Length > 0)
+ {
+ if (objRH.SolicitudVacacionesAddUpdate(CvePersonalVacaciones, SRCvePersonal, UsuarioActual.CveUsuario, Documento))
+ Alert("Las vacaciones se han autorizado.");
+ UpModalEditarDiaVacacion.Update();
+
+
+ CargaVacaciones();
+ // CargaVacacionesResumenPeriodoActual();
+ RegistraScript("$('#divEditarDiaVacacion').modal('hide');");
+ }
+ else { Alert("debe ingresar un documento para poder autorizar la solicitud", TipoMensaje.MsgAdvertencia); }
+ }
+ }
+ public void DownLoad_ClickSolicitudVacaciones(object sender, EventArgs e)
+ {
+ /*
+ GridViewRow GvRow = (GridViewRow)(LinkButton)sender.NamingContainer;
+
+ // Dim Folio As Integer = GvRow.DataKey("Folio").ToEntero
+
+ // DescarSolicitudVacaciones(Folio)
+ string RutaFormato = string.Format(@"{0}Formatos\SolicitudVacaciones.docx", UsuarioActual.Empresa.Ruta);
+
+ string NombreEmpleado = string.Format("{0} {1} {2}", TxtAPaterno.Text, TxtAMaterno.Text, TxtNombres.Text);
+ string Codigo = TxtCodigo.Text;
+ string Departamento = DdlDepartamento.SelectedItem.Text;
+ string JefeInmediato = DdlSupervisorOrganigrama.SelectedItem.Text;
+ DateTime fechaIngreso = TxtFechaIngreso.Text.ToDate();
+ int Periodoingreso = fechaIngreso.ToString("MMdd").ToEntero();
+ int PeriodoInicio = GvRow.DataKey("FechaInicio").ToDate().ToString("MMdd").ToEntero();
+ string FechaInicio = GvRow.DataKey("FechaInicio").ToDateTime().ToString("dd/MM/yyyy");
+ string FechaFin = GvRow.DataKey("FechaFin").ToDateTime().ToString("dd/MM/yyyy");
+ string diasPermiso = GvRow.DataKey("Dias");
+ string MotivoPermiso = GvRow.DataKey("Motivo");
+ string Puesto = DdlPuesto.SelectedItem.Value;
+ string Fecha = DateTime.Now.ToString("dd/MM/yyyy");
+ string Solicitante = UsuarioActual.Nombre;
+ int anio = GvRow.DataKey("FechaInicio").ToDate().Year;
+ string FechaPeriodo = GvRow.DataKey("Periodo");
+
+
+
+
+ if (Periodoingreso > PeriodoInicio)
+ anio = anio - 1;
+
+
+
+ if (File.Exists(RutaFormato))
+ {
+ clsGemBoxDocument objGemDocument = new clsGemBoxDocument(RutaFormato);
+ List ListaTags = new List();
+
+ ListaTags = GetDatosTagsDocumentos();
+
+ ListaTags.Add(new TagsDocumentos("{Solicitante}", Solicitante));
+ ListaTags.Add(new TagsDocumentos("{Fecha}", Fecha));
+ ListaTags.Add(new TagsDocumentos("{NombreEmpleado}", NombreEmpleado));
+ ListaTags.Add(new TagsDocumentos("{Codigo}", Codigo));
+ ListaTags.Add(new TagsDocumentos("{Departamento}", Departamento));
+ ListaTags.Add(new TagsDocumentos("{JefeInmediato}", JefeInmediato));
+ ListaTags.Add(new TagsDocumentos("{FechaInicio}", FechaInicio));
+ ListaTags.Add(new TagsDocumentos("{FechaFin}", FechaFin));
+ ListaTags.Add(new TagsDocumentos("{diasPermiso}", diasPermiso));
+ ListaTags.Add(new TagsDocumentos("{MotivoPermiso}", MotivoPermiso));
+ ListaTags.Add(new TagsDocumentos("{Puesto}", Puesto));
+ ListaTags.Add(new TagsDocumentos("{anio}", anio.ToString()));
+ ListaTags.Add(new TagsDocumentos("{FechaPeriodo}", FechaPeriodo));
+
+ objGemDocument.SustituirTags(ListaTags);
+
+ // objGemDocument.GuardarStream()
+ objGemDocument.GuardarStreamPDF();
+
+ byte[] bytesInStream = objGemDocument.GetBytesDocumento();
+ // Dim bytesInStream As Byte() = objGemDocument.memoryStream.ToArray
+
+ objGemDocument.Dispose();
+
+ Response.Clear();
+ Response.ContentType = "application/force-download";
+ Response.AddHeader("content-disposition", "attachment; filename=" + CvePersonal + "_Solicitud_Vacaciones_" + DateTime.Now.ToString("yyyyMMddhhmmss") + ".pdf");
+ Response.BinaryWrite(bytesInStream);
+ Response.End();
+ }
+ else
+ Alert("No se encontro el Formato, favor de revisarlo con soporte tecnico.", TipoMensaje.MsgAdvertencia);*/
+ }
+ private List GetDatosTagsDocumentos()
+ {
+ var ListaTagsDocumentost = new List();
+
+ if (SRCvePersonal != -1)
+ {
+ using (ClsRH objRH = new ClsRH())
+ {
+ if (objRH.PersonalReclutamientoGet(SRCvePersonal, UsuarioActual.Empresa.CveEmpresa))
+ {
+ DataRow drow = objRH.DtResultados.Rows[0];
+ ListaTagsDocumentost.Add(new TagsDocumentos("{Nombres}", drow["Nombres"].ToString()));
+ ListaTagsDocumentost.Add(new TagsDocumentos("{APaterno}", drow["APaterno"].ToString()));
+ ListaTagsDocumentost.Add(new TagsDocumentos("{AMaterno}", drow["AMaterno"].ToString()));
+ ListaTagsDocumentost.Add(new TagsDocumentos("{RFC}", drow["RFC"].ToString()));
+ ListaTagsDocumentost.Add(new TagsDocumentos("{NombreCompleto}", LblEmpleado.Text));
+ ListaTagsDocumentost.Add(new TagsDocumentos("{Estatura}", drow["Estatura"].ToString()));
+ ListaTagsDocumentost.Add(new TagsDocumentos("{Peso}", drow["Peso"].ToString()));
+ ListaTagsDocumentost.Add(new TagsDocumentos("{LugarNacimiento}", drow["LugarNacimiento"].ToString()));
+ ListaTagsDocumentost.Add(new TagsDocumentos("{Edad}", drow["Edad"].ToString()));
+ ListaTagsDocumentost.Add(new TagsDocumentos("{NombreTelEmergencia}", drow["NombreTelEmergencia"].ToString()));
+ ListaTagsDocumentost.Add(new TagsDocumentos("{TipoSangre}", drow["TipoSangre"].ToString()));
+ ListaTagsDocumentost.Add(new TagsDocumentos("{Vivienda}", drow["Vivienda"].ToString()));
+ ListaTagsDocumentost.Add(new TagsDocumentos("{ViviendaDueno}", drow["ViviendaDueno"].ToString()));
+ ListaTagsDocumentost.Add(new TagsDocumentos("{CreditoInfonavit}", drow["CreditoInfonavit"].ToString()));
+ ListaTagsDocumentost.Add(new TagsDocumentos("{RentaMensual}", drow["RentaMensual"].ToString().ToDecimal().ToString("###,###,###.00")));
+ ListaTagsDocumentost.Add(new TagsDocumentos("{TransportePublico}", drow["TransportePublico"].ToString()));
+ ListaTagsDocumentost.Add(new TagsDocumentos("{TrabajadoAnteriormente}", drow["TrabajadoAnteriormente"].ToString()));
+ ListaTagsDocumentost.Add(new TagsDocumentos("{TrabajadoAnteriormenteObservaciones}", drow["TrabajadoAnteriormenteObservaciones"].ToString()));
+ ListaTagsDocumentost.Add(new TagsDocumentos("{ParientesEmpresa}", drow["ParientesEmpresa"].ToString()));
+ ListaTagsDocumentost.Add(new TagsDocumentos("{AcusadoDelito}", drow["AcusadoDelito"].ToString()));
+ ListaTagsDocumentost.Add(new TagsDocumentos("{AcusadoDelitoObservaciones}", drow["AcusadoDelitoObservaciones"].ToString()));
+ ListaTagsDocumentost.Add(new TagsDocumentos("{Direccion}", drow["Direccion"].ToString()));
+ ListaTagsDocumentost.Add(new TagsDocumentos("{Calle}", drow["Calle"].ToString()));
+ ListaTagsDocumentost.Add(new TagsDocumentos("{Colonia}", drow["Colonia"].ToString()));
+ ListaTagsDocumentost.Add(new TagsDocumentos("{CP}", drow["CP"].ToString()));
+ ListaTagsDocumentost.Add(new TagsDocumentos("{Telefono}", drow["Telefono"].ToString()));
+ ListaTagsDocumentost.Add(new TagsDocumentos("{Celular}", drow["Celular"].ToString()));
+ ListaTagsDocumentost.Add(new TagsDocumentos("{Correo}", drow["Correo"].ToString()));
+ // If Not IsDBNull(drow["CveSucursal"]) Then
+ // ListaTagsDocumentost.Add(New TagsDocumentos("{CveSucursal}", DDLSucursal4.Text))
+ // End If
+ ListaTagsDocumentost.Add(new TagsDocumentos("{NumeroSS}", drow["NumeroSS"].ToString()));
+ ListaTagsDocumentost.Add(new TagsDocumentos("{Licencia}", drow["Licencia"].ToString()));
+ ListaTagsDocumentost.Add(new TagsDocumentos("{CartillaMilitar}", drow["CartillaMilitar"].ToString()));
+ ListaTagsDocumentost.Add(new TagsDocumentos("{CURP}", drow["CURP"].ToString()));
+ ListaTagsDocumentost.Add(new TagsDocumentos("{AutorizaAntidoping}", drow["AutorizaAntidoping"].ToString()));
+ ListaTagsDocumentost.Add(new TagsDocumentos("{Observaciones}", drow["Observaciones"].ToString()));
+ ListaTagsDocumentost.Add(new TagsDocumentos("{Direccion}", drow["Direccion"].ToString()));
+ ListaTagsDocumentost.Add(new TagsDocumentos("{FechaIngreso}", drow["FechaIngreso"].ToString().ToDate().ToShortDateString()));
+ ListaTagsDocumentost.Add(new TagsDocumentos("{Puesto}", drow["Puesto"].ToString()));
+ ListaTagsDocumentost.Add(new TagsDocumentos("{CUIP}", ""));
+ ListaTagsDocumentost.Add(new TagsDocumentos("{Denominacion}", ""));
+ ListaTagsDocumentost.Add(new TagsDocumentos("{FechaNacimiento}", drow["FechaNacimiento"].ToString().ToDate().ToString("dd/MM/yyyy")));
+ string fechaActual = " " + DateTime.Now.Day + " del mes " + DateTime.Now.Month + " del año " + DateTime.Now.Year;
+ string FechaActualDF = DateTime.Now.ToString("dd/MM/yyyy");
+ ListaTagsDocumentost.Add(new TagsDocumentos("{FechaActual}", fechaActual));
+ ListaTagsDocumentost.Add(new TagsDocumentos("{FechaActualDF}", FechaActualDF));
+ }
+
+ }
+ }
+
+ return ListaTagsDocumentost;
+ }
+
+ public void DownLoad_ClickSolicitudPermiso(object sender, EventArgs e)
+ {
+ GridViewRow GvRow = (GridViewRow)((LinkButton)sender).NamingContainer;
+ // Dim Folio As Integer = GvRow.DataKey("Folio").ToEntero
+ // DescarSolicitudVacaciones(Folio)
+ string RutaFormato = string.Format(@"{0}Formatos\PermisoSolicitud.docx", UsuarioActual.Empresa.Ruta);
+
+ string NombreEmpleado = LblEmpleado.Text;
+ string Codigo = LblCodigoEmpleado.Text;
+ string Departamento = LblSRDepartamento.Text;
+ string JefeInmediato = "";
+ string FechaInicio = GvRow.DataKey("FechaInicio").ToDateTime().ToString("dd/MM/yyyy");
+ string FechaFin = GvRow.DataKey("FechaFin").ToDateTime().ToString("dd/MM/yyyy");
+ string diasPermiso = $"{(GvRow.DataKey("FechaFin").ToDate() - GvRow.DataKey("FechaInicio").ToDate()).Days}";
+ string HorasPermiso = ""; // String.Format("{0}", ((GvRow.DataKey("FechaInicio").ToDateTime() - GvRow.DataKey("FechaFin").ToDateTime()).Hours))
+ string MotivoPermiso = string.Format("{0},{1}", GvRow.DataKey("Descripcion"), GvRow.DataKey("Motivo"));
+ if (File.Exists(RutaFormato))
+ {
+ clsGemBoxDocument objGemDocument = new clsGemBoxDocument(RutaFormato);
+ List ListaTags = new List();
+
+ ListaTags = GetDatosTagsDocumentos();
+
+ ListaTags.Add(new TagsDocumentos("{NombreEmpleado}", NombreEmpleado));
+ ListaTags.Add(new TagsDocumentos("{Codigo}", Codigo));
+ ListaTags.Add(new TagsDocumentos("{Departamento}", Departamento));
+ ListaTags.Add(new TagsDocumentos("{JefeInmediato}", JefeInmediato));
+ ListaTags.Add(new TagsDocumentos("{FechaInicio}", FechaInicio));
+ ListaTags.Add(new TagsDocumentos("{FechaFin}", FechaFin));
+ ListaTags.Add(new TagsDocumentos("{diasPermiso}", diasPermiso));
+ ListaTags.Add(new TagsDocumentos("{HorasPermiso}", HorasPermiso));
+ ListaTags.Add(new TagsDocumentos("{MotivoPermiso}", MotivoPermiso));
+
+ objGemDocument.SustituirTags(ListaTags);
+
+ // objGemDocument.GuardarStream()
+ objGemDocument.GuardarStreamPDF();
+ byte[] bytesInStream = objGemDocument.GetBytesDocumento();
+ // Dim bytesInStream As Byte() = objGemDocument.memoryStream.ToArray
+ objGemDocument.Dispose();
+
+ Response.Clear();
+ Response.ContentType = "application/force-download";
+ Response.AddHeader("content-disposition", "attachment; filename=" + SRCvePersonal + "_Solicituddepermiso_" + DateTime.Now.ToString("yyyyMMddhhmmss") + ".pdf");
+ Response.BinaryWrite(bytesInStream);
+ Response.End();
+ }
+ else { Alert("No se encontro el formato de Permisos", TipoMensaje.ToastAdventencia); }
+
+ }
+
+ public void DownLoad_ClickSolicitudAutorizacion(object sender, EventArgs e)
+ {
+
+ GridViewRow GvRow = (GridViewRow)((LinkButton)sender).NamingContainer;
+ string _Documento = GvRow.DataKey("Documento");
+ string RutaDocuemntoAutorizacion = string.Format(@"{0}Personal\{1}\Vacaciones\{2}", UsuarioActual.Empresa.Ruta, SRCvePersonal, _Documento);
+
+ if (File.Exists(RutaDocuemntoAutorizacion))
+ {
+ byte[] bytesInStream = File.ReadAllBytes(RutaDocuemntoAutorizacion);
+ Response.Clear();
+ Response.ContentType = "application/force-download";
+ Response.AddHeader("content-disposition", "attachment; filename=" + _Documento);
+ Response.AddHeader("content-disposition", "attachment; filename=" + _Documento);
+ Response.BinaryWrite(bytesInStream);
+ Response.End();
+ }
+ else
+ {
+ Alert("No se encontro el documento que intenta descargar.");
+ }
+
+ }
+
+
+ protected void BtnGeneratepdf_Click(object sender, EventArgs e)
+ {
+ byte[] pdf = new byte[1];
+ string nombre = "recibo";
+ bool confiniquito = false;
+ int CvePersonal = TxtCvePersonal.Text.ToEntero(); int CvePeriodo = TxtCvePeriodo.Text.ToEntero();
+ if (CvePersonal > 0)
+ {
+ using (ClsNominas ObjNomina = new ClsNominas())
+ {
+ if (ObjNomina.GetNom_Nominas(-1, TxtCvePersonal.Text.ToEntero(), TxtCvePeriodo.Text.ToEntero(), -1, UsuarioActual.CveEmpresa))
+ {
+ nombre = ObjNomina.SerieFolio;
+
+ }
+ if (ObjNomina.GetNom_NominasDetalles(-1, CvePersonal, CvePeriodo, "-1"))
+ {
+ confiniquito = ObjNomina.DtResultados.COUNT("CveConcepto", " CveSistema IN(10,11,32,47) AND Importe <>0") > 0;
+ }
+ }
+ pdf = GeneraPDFNomina(CvePersonal, CvePeriodo, UsuarioActual.CveEmpresa, UsuarioActual.Empresa.Ruta);
+ if (confiniquito)
+ {
+ List pdfs = new List();
+ pdfs.Add(pdf);
+ pdfs.Add(GeneraPDFNomina(CvePersonal, CvePeriodo, UsuarioActual.CveEmpresa, UsuarioActual.Empresa.Ruta, true));
+ pdf = MergeFiles(pdfs);
+
+ }
+ }
+ else
+ {
+ List pdfs = new List();
+ //byte[] pdf2 = new byte[1]; bool notfirst = false;
+ foreach (DataRow dr in dtempleados.FiltraParametros("", "CveSubProyecto").Rows)
+ {
+ CvePersonal = dr["CvePersonal"].ToString().ToEntero();
+ if (CvePersonal > 0)
+ {
+ pdfs.Add(GeneraPDFNomina(CvePersonal, CvePeriodo, UsuarioActual.CveEmpresa, UsuarioActual.Empresa.Ruta));
+
+ }
+ //if (notfirst)
+ //{
+
+ // pdf2 = GeneraPDFNomina(dr["CvePersonal"].ToString().ToEntero(), CvePeriodo, UsuarioActual.CveEmpresa, UsuarioActual.Empresa.Ruta);
+ // byte[] newByteArray2 = pdf.Concat(pdf2).ToArray();
+ //}
+ //else
+ //{
+ // pdf = GeneraPDFNomina(dr["CvePersonal"].ToString().ToEntero(), CvePeriodo, UsuarioActual.CveEmpresa, UsuarioActual.Empresa.Ruta);
+
+ //}
+ //notfirst = true;
+ }
+ pdf = MergeFiles(pdfs);
+ }
+ ImprimirbytesPDF(pdf, nombre);
+
+ }
+ public static byte[] MergeFiles(List sourceFiles)
+ {
+ //string destinationFile;
+ try
+ {
+ using (MemoryStream ms = new MemoryStream())
+ {
+ int f = 0;
+ // we create a reader for a certain document
+ PdfReader reader = new PdfReader(sourceFiles[f]);
+ // we retrieve the total number of pages
+ int n = reader.NumberOfPages;
+ //Console.WriteLine("There are " + n + " pages in the original file.");
+ // step 1: creation of a document-object
+ iTextSharp.text.Document document = new iTextSharp.text.Document(reader.GetPageSizeWithRotation(1));
+ // step 2: we create a writer that listens to the document
+ //PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(destinationFile, FileMode.Create));
+ PdfWriter writer = PdfWriter.GetInstance(document, ms);
+ // step 3: we open the document
+ document.Open();
+ PdfContentByte cb = writer.DirectContent;
+ PdfImportedPage page;
+ int rotation;
+ // step 4: we add content
+ while (f < sourceFiles.Count)
+ {
+ int i = 0;
+ while (i < n)
+ {
+ i++;
+ document.SetPageSize(reader.GetPageSizeWithRotation(i));
+ document.NewPage();
+ page = writer.GetImportedPage(reader, i);
+ rotation = reader.GetPageRotation(i);
+ if (rotation == 90 || rotation == 270)
+ {
+ cb.AddTemplate(page, 0, -1f, 1f, 0, 0, reader.GetPageSizeWithRotation(i).Height);
+ }
+ else
+ {
+ cb.AddTemplate(page, 1f, 0, 0, 1f, 0, 0);
+ }
+ //Console.WriteLine("Processed page " + i);
+ }
+ f++;
+ if (f < sourceFiles.Count)
+ {
+ reader = new PdfReader(sourceFiles[f]);
+ // we retrieve the total number of pages
+ n = reader.NumberOfPages;
+ //Console.WriteLine("There are " + n + " pages in the original file.");
+ }
+ }
+ // step 5: we close the document
+ document.Close();
+ return ms.ToArray();
+
+ }
+ }
+ catch (Exception e)
+ {
+ string strOb = e.Message;
+ }
+ return null;
+ }
+
+ public static int CountPageNo(string strFileName)
+ {
+ // we create a reader for a certain document
+ PdfReader reader = new PdfReader(strFileName);
+ // we retrieve the total number of pages
+ return reader.NumberOfPages;
+ }
+
+
+ protected void BtnGenerateXml_Click(object sender, EventArgs e)
+ {
+ string Ruta = "";
+ string PathXML = "";
+ string PathXMLF = "";
+ string Xmlname = "";
+ string XmlnameF = "";
+ string empleado = "";
+ DataRow dr = dtempleados.FiltroPrimero(string.Format("CvePersonal ={0}", TxtCvePersonal.Text.ToEntero()));
+ if (dr != null)
+ {
+ empleado = string.Format("{0} - {1}", dr["Codigo"], dr["Nombre"]);
+ }
+ using (ClsNominas ObjNomina = new ClsNominas())
+ {
+ if (ObjNomina.GetNom_Nominas(-1, TxtCvePersonal.Text.ToEntero(), TxtCvePeriodo.Text.ToEntero(), -1, UsuarioActual.CveEmpresa))
+ {
+ Ruta = $"{ModExtensiones.DirectorioBaseEmpresas}Empresas\\{UsuarioActual.CveEmpresa}\\";
+ PathXML = $"{Ruta}XML\\Nomina\\{ObjNomina.SerieFolio}.xml";
+ PathXMLF = $"{Ruta}XML\\Nomina\\{ObjNomina.Serie}F-{ObjNomina.Folio}.xml";
+ Xmlname = ObjNomina.SerieFolio;
+ XmlnameF = $"{ObjNomina.Serie}F-{ObjNomina.Folio}";
+ }
+ }
+ try
+ {
+ string script = "";
+ if (!string.IsNullOrEmpty(PathXML) && System.IO.File.Exists(PathXML))
+ {
+ LtlXml.Text = System.IO.File.ReadAllText(PathXML);
+ script = string.Format("Savexml(\"{0} {1}.xml\", $('.ltlxml').html());", Xmlname, empleado);
+ //System.IO.FileInfo file = new System.IO.FileInfo(PathXML);
+ //string mimeType = "text/plain";
+ //try
+ //{
+ // mimeType = MimeMapping.GetMimeMapping(PathXML);
+ //}
+ //catch (Exception)
+ //{
+
+ //}
+ //// Response.Write(path)
+ //Response.Clear();
+ //Response.ClearHeaders();
+ //Response.ClearContent();
+ //Response.AddHeader("Content-Disposition", $"attachment; filename= {Uri.EscapeDataString(file.Name)}");
+ //Response.AddHeader("Content-Length", file.Length.ToString());
+ //Response.ContentType = mimeType;
+ //Response.Flush();
+ //Response.TransmitFile(file.FullName);
+ //Response.End();
+ }
+ if (!string.IsNullOrEmpty(PathXML) && System.IO.File.Exists(PathXMLF))
+ {
+ LtlXmlfin.Text = System.IO.File.ReadAllText(PathXMLF);
+ script = string.Format("{1}Savexml(\"{0}(Indemnización) {2}.xml\", $('.ltlxmlfin').html());", Xmlname, script, empleado);
+ }
+ if (script.Trim().Length > 0)
+ {
+ RegistraScript(script);
+ }
+ else
+ {
+ Alert("No se encontro el archivo");
+ }
+ }
+ catch (Exception)
+ {
+ }
+ }
+
+
+ protected void LnkRegistrarProvision_Click(object sender, EventArgs e)
+ {
+ using (ClsNominas objnom = new ClsNominas())
+ {
+ if (objnom.Autorizaperiodoconta(CvePeriodoSeleccionado, UsuarioActual.CveEmpresa))
+ {
+ int CvePrePolizaProvision = 0; int CvePrePolizaasmilidos = 0;
+ if (objnom.DtResultados.Rows.Count > 0)
+ {
+ CvePrePolizaProvision = objnom.DtResultados.Rows[0]["CvePrePoliza"].ToString().ToEntero();
+ CvePrePolizaasmilidos = objnom.DtResultados.Rows[0]["CvePrePolizaAsimilables"].ToString().ToEntero();
+ }
+ string mensaje = string.Format("La provision a sido autorizada.Provision Asimilados ", CvePrePolizaProvision, CvePrePolizaasmilidos);
+ Alert(mensaje);
+ }
+ }
+ }
+
+
+ protected void LnkupPrimaRiesgo_Click(object sender, EventArgs e)
+ {
+
+
+ using (ClsNominas objnom = new ClsNominas())
+ {
+ if (objnom.PrimaRiesgoUP(UsuarioActual.CveEmpresa, TxtFechaPRT.Text.ToDateTime(), TxtPrimaRiesgo.Text.ToDecimal()))
+ {
+ }
+
+ }
+ loadtablas();
+ }
+ private void CrearLayout(DataTable DTNomina)
+ {
+ StringBuilder sb = new StringBuilder();
+ StringBuilder SbErrores = new StringBuilder();
+ bool ErroresValidaciones = false;
+
+
+ SbErrores.AppendLine("Se detectaron los siguientes errores en la generación del layout");
+
+ foreach (DataRow dRow in DTNomina.Rows)
+ {
+ string RFC = dRow["RFC"].ToString();
+ string Nombre = dRow["Nombre"].ToString();
+ string BancoNumCuenta = dRow["BancoNumCuenta"].ToString();
+ decimal Importe = dRow["Importe"].ToString().ToDecimal();
+
+
+
+ if (RFC.Trim().Length == 0)
+ SbErrores.AppendLine($"El RFC es requerido del empleado {Nombre} ");
+
+ System.Text.RegularExpressions.Match Coincidencia = System.Text.RegularExpressions.Regex.Match(RFC, @"/^([A-Z,Ñ,&]{3,4}([0-9]{2})(0[1-9]|1[0-2])(0[1-9]|1[0-9]|2[0-9]|3[0-1])[A-Z|\d]{3})$/");
+ if (!Coincidencia.Success)
+ {
+ SbErrores.AppendLine($"El RFC {RFC} del empleado {Nombre} no es valido ");
+ ErroresValidaciones = true;
+ }
+
+ if (BancoNumCuenta.Trim().Length != 10)
+ {
+ SbErrores.AppendLine($"Empleado {Nombre} numero de cuenta incorrecto, la cuenta debe de tener 10 caracteres "); // Bancomer 10 caracteres
+ ErroresValidaciones = true;
+ }
+
+
+ if (Importe <= 0)
+ {
+ SbErrores.AppendLine($"Empleado {Nombre} el importe debe de ser mayor a 0 importe {Importe}"); // importe mayot a 0
+ ErroresValidaciones = true;
+ }
+ }
+
+ ErroresValidaciones = false;
+
+ if (!ErroresValidaciones)
+ {
+ int Count = 1;
+ foreach (DataRow dRow in DTNomina.Rows)
+ {
+ StringBuilder SbLinea = new StringBuilder();
+
+ string RFC = dRow["RFC"].ToString();
+ string Nombre = dRow["Nombre"].ToString();
+ string BancoNumCuenta = dRow["BancoNumCuenta"].ToString();
+ decimal Importe = dRow["Importe"].ToString().ToDecimal().RoundSQL(2);
+
+ SbLinea.Append(Count.ToString("000000000"));
+ SbLinea.Append(RFC.Trim().PadRight(16));
+ SbLinea.Append("03");
+ SbLinea.Append(BancoNumCuenta.Trim().PadRight(20));
+ SbLinea.Append(Importe.ToString("0000000000000.00").Replace(".", ""));
+
+
+ if (Nombre.Trim().Length > 40)
+ Nombre = Nombre.Substring(0, 40);
+
+ SbLinea.Append(Nombre.Trim().PadRight(40));
+
+ SbLinea.Append("012");
+ SbLinea.Append("000");
+
+ sb.AppendLine(SbLinea.ToString());
+
+
+ Count = Count + 1;
+ }
+
+
+ Response.Clear();
+ Response.ClearHeaders();
+ Response.AppendHeader("Content-Length", sb.ToString());
+ Response.ContentType = "text/plain";
+ //Response.AppendHeader("Content-Disposition", $"attachment;filename=\"Nomina{DateTime.Now.ToString("yyyyMMddhhmmss").ToString()}.txt\"");
+ Response.AppendHeader("Content-Disposition", $"attachment;filename=\"Nomina {DdlPeriodo.SelectedItem.Text }.txt\"");
+ Response.Write(sb.ToString());
+ Response.End();
+ }
+ else
+ Alert(SbErrores.ToString(), TipoMensaje.MsgAdvertencia);
+ }
+ protected void LnkLayoutContable_Click(object sender, EventArgs e)
+ {
+
+ using (ClsNominas objnom = new ClsNominas())
+ {
+ if (objnom.GetDispersiondenomina(CvePeriodoSeleccionado, UsuarioActual.CveEmpresa))
+ {
+ CrearLayout(objnom.DtResultados);
+ }
+
+ }
+ }
+
+ protected void LnkAsistenciaIncidencias_Click(object sender, EventArgs e)
+ {
+ RegistraScript("$('#DmodalReporteInicidencia').modal()");
+ }
+
+ protected void lnkreportepercepciones_Click(object sender, EventArgs e)
+ {
+ RegistraScript("$('#DmodalReportePercepcionesdeducciones').modal()");
+ }
+ protected void LnkProcesarReporteIncidencia_Click(object sender, EventArgs e)
+ {
+
+ DateTime fechai = TxtRIFechaInicio.Text.ToDateTime();
+ DateTime fechaf = TxtRIFechaFin.Text.ToDateTime();
+ ClosedXML.Excel.XLWorkbook wb = new ClosedXML.Excel.XLWorkbook();
+ using (ClsNominas nom = new ClsNominas())
+ {
+ if (nom.ReportedeincidenciasGET(UsuarioActual.CveEmpresa, fechai, fechaf, 4))
+ {
+
+ var libro = wb.AddWorksheet(nom.DTSetResultados.Tables[2], "Incidencias");
+ libro.ColumnsUsed().AdjustToContents();
+ var libroin = wb.AddWorksheet(nom.DTSetResultados.Tables[1], "Descripción incidencias");
+ libroin.ColumnsUsed().AdjustToContents();
+ libro.Row(1).InsertRowsAbove(4);
+ libro.Range(1, 2, 1, 6).Merge().Value = UsuarioActual.Empresa.Empresa;
+ libro.Range(2, 2, 2, 6).Merge().Value = "Reporte de incidencias";
+ libro.Range(3, 2, 3, 6).Merge().Value = $"del {fechai:dd/MM/yyyy} al {fechaf:dd/MM/yyyy}";
+ libro.Range(2, 7, 2, 9).Merge().Value = $"Fecha:{DateTime.Now:dd/MM/yyyy}";
+ libro.Range(3, 7, 3, 9).Merge().Value = $"Hora:{DateTime.Now:HH:mm}";
+
+ //ws.Row(1).InsertRowsAbove(1);
+ }
+ }
+
+
+ System.IO.Stream fs = new System.IO.MemoryStream();
+ wb.SaveAs(fs);
+ 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=incidencias del al{0}.xlsx", ""));
+ Response.BinaryWrite(memoryStream.ToArray());
+ Response.End();
+ }
+
+ protected void LnkProcesarReporteAcumulados_Click(object sender, EventArgs e)
+ {
+
+ //DateTime fechai = TxtRIFechaInicio.Text.ToDateTime();
+ //DateTime fechaf = TxtRIFechaFin.Text.ToDateTime();
+ ClosedXML.Excel.XLWorkbook wb = new ClosedXML.Excel.XLWorkbook();
+ using (ClsNominas nom = new ClsNominas())
+ {
+ if (nom.ReportedeAcumuladosGET(UsuarioActual.CveEmpresa, TxtPeriodo.Text.ToEntero(), 4))
+ {
+ DateTime datei = new DateTime();
+ DateTime datef = datei;
+ try
+ {
+ datei = $"{TxtPeriodo.Text}01".ToDateTime();
+ datef = datei.AddMonths(1).AddDays(-1);
+ }
+ catch (Exception) { }
+ DataTable dt = nom.DTSetResultados.Tables[0];
+ var libro = wb.AddWorksheet(dt, "Acumulados");
+ libro.Tables.FirstOrDefault().Theme = ClosedXML.Excel.XLTableTheme.None;
+ int crow = 1;
+ foreach (DataRow item in dt.Rows)
+ {
+ crow++;
+ //220,230,241
+ //79,129,189
+ switch (item["Grupoid"].ToString())
+ {
+ case "1":
+ libro.Range(crow, 1, crow, 11).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(79, 129, 189));
+ libro.Range(crow, 1, crow, 11).Style.Font.FontColor = ClosedXML.Excel.XLColor.White;
+ break;
+ case "2":
+ libro.Range(crow, 1, crow, 11).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(220, 230, 241));
+ //libro.Range(crow, 1, crow, 10).Style.Font.FontColor = ClosedXML.Excel.XLColor.White;
+ break;
+ case "3":
+ break;
+ case "4":
+ libro.Range(crow, 1, crow, 11).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(79, 129, 189));
+ libro.Range(crow, 1, crow, 11).Style.Font.FontColor = ClosedXML.Excel.XLColor.White;
+ break;
+ case "5":
+
+ libro.Range(crow, 1, crow, 11).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(79, 129, 189));
+ libro.Range(crow, 1, crow, 11).Style.Font.FontColor = ClosedXML.Excel.XLColor.White;
+ break;
+
+ }
+ }
+ libro.Range(2, 3, crow, 11).Style.NumberFormat.Format = "$##,###,###,0.00";
+ libro.Range(2, 3, crow, 11).DataType = ClosedXML.Excel.XLDataType.Number;
+ libro.Column(1).Delete();
+ libro.ColumnsUsed().AdjustToContents();
+ libro.Row(1).InsertRowsAbove(4);
+ libro.Range(1, 2, 1, 6).Merge().Value = UsuarioActual.Empresa.Empresa;
+ libro.Range(2, 2, 2, 6).Merge().Value = $"Reporte de Acumulados del {datei:dd/MM/yyyy} al {datef:dd/MM/yyyy}";
+ //libro.Range(3, 2, 3, 6).Merge().Value = $"del {fechai:dd/MM/yyyy} al {fechaf:dd/MM/yyyy}";
+ libro.Range(2, 7, 2, 9).Merge().Value = $"Fecha:{DateTime.Now:dd/MM/yyyy}";
+ libro.Range(3, 7, 3, 9).Merge().Value = $"Hora:{DateTime.Now:HH:mm}";
+
+ //ws.Row(1).InsertRowsAbove(1);
+ }
+ }
+
+
+ System.IO.Stream fs = new System.IO.MemoryStream();
+ wb.SaveAs(fs);
+ 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=Acumulados.xlsx", ""));
+ Response.BinaryWrite(memoryStream.ToArray());
+ Response.End();
+ }
+
+ protected void LnkReporteAcumulados_Click(object sender, EventArgs e)
+ {
+ RegistraScript("$('#DmodalReporteAcumulados').modal()");
+
+ }
+
+
+
+
+
+ protected void LnkrRepPercpDed_Click(object sender, EventArgs e)
+ {
+
+ DateTime fechai = TxtRpdFechaInicio.Text.ToDateTime();
+ DateTime fechaf = TxtRpdFechaFin.Text.ToDateTime();
+ ClosedXML.Excel.XLWorkbook wb = new ClosedXML.Excel.XLWorkbook();
+ using (ClsNominas nom = new ClsNominas())
+ {
+ if (nom.ReportedePercepcionesDeduccionesGet(UsuarioActual.CveEmpresa, fechai, fechaf, 4))
+ {
+ DataTable dt = nom.DTSetResultados.Tables[0];
+ var libro = wb.AddWorksheet(nom.DTSetResultados.Tables[0], "Percepciones y deducciones");
+ libro.Tables.FirstOrDefault().Theme = ClosedXML.Excel.XLTableTheme.None;
+
+ int crow = 1;
+ foreach (DataRow item in dt.Rows)
+ {
+ crow++;
+ //220,230,241
+ //79,129,189
+ switch (item["Grupoid"].ToString())
+ {
+ case "10":
+ libro.Range(crow, 1, crow, 9).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(184, 204, 228));
+ break;
+ case "8":
+ case "11":
+ libro.Range(crow, 1, crow, 9).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(79, 129, 189));
+ libro.Range(crow, 1, crow, 11).Style.Font.FontColor = ClosedXML.Excel.XLColor.White;
+ break;
+
+
+ case "6":
+ libro.Range(crow, 1, crow, 9).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(216, 228, 188));
+ break;
+ case "5":
+ case "7":
+ libro.Range(crow, 1, crow, 9).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(155, 187, 89));
+ libro.Range(crow, 1, crow, 9).Style.Font.FontColor = ClosedXML.Excel.XLColor.White;
+ break;
+
+
+
+ case "2":
+ //libro.Range(crow, 1, crow, 11).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(216, 228, 188));
+ break;
+ case "1":
+ case "3":
+ libro.Range(crow, 1, crow, 9).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(75, 172, 198));
+ libro.Range(crow, 1, crow, 9).Style.Font.FontColor = ClosedXML.Excel.XLColor.White;
+ break;
+
+ }
+ }
+
+
+ libro.Range(2, 4, crow, 9).Style.NumberFormat.Format = "$##,###,###,0.00";
+ libro.Range(2, 4, crow, 9).DataType = ClosedXML.Excel.XLDataType.Number;
+ libro.Column(1).Delete();
+ libro.ColumnsUsed().AdjustToContents();
+ libro.Row(1).InsertRowsAbove(4);
+ libro.Range(1, 2, 1, 6).Merge().Value = UsuarioActual.Empresa.Empresa;
+ libro.Range(2, 2, 2, 6).Merge().Value = $"Reporte de percepciones y deducciones del {fechai:dd/MM/yyyy} al {fechaf:dd/MM/yyyy}";
+ libro.Range(1, 2, 2, 6).Style.Font.SetBold(true);
+ libro.Range(1, 2, 2, 6).Style.Font.SetFontSize(16);
+ libro.Range(2, 2, 2, 6).Style.Font.SetFontSize(14);
+ libro.Range(1, 2, 2, 6).Style.Alignment.Horizontal = ClosedXML.Excel.XLAlignmentHorizontalValues.Center;
+ //libro.Range(3, 2, 3, 6).Merge().Value = $"del {fechai:dd/MM/yyyy} al {fechaf:dd/MM/yyyy}";
+ libro.Range(2, 7, 2, 9).Merge().Value = $"Fecha:{DateTime.Now:dd/MM/yyyy}";
+ libro.Range(3, 7, 3, 9).Merge().Value = $"Hora:{DateTime.Now:HH:mm}";
+ //ws.Row(1).InsertRowsAbove(1);
+ }
+ }
+
+
+ System.IO.Stream fs = new System.IO.MemoryStream();
+ wb.SaveAs(fs);
+ 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=percepciones .xlsx", ""));
+ Response.BinaryWrite(memoryStream.ToArray());
+ Response.End();
+ }
+
+ protected void LnkShowAddVacaciones_Click(object sender, EventArgs e)
+ {
+ LnkSRVacacionesADD.Visible = true;
+ }
+
+}
diff --git a/Nomina/ReportedeAcumulados.aspx.cs b/Nomina/ReportedeAcumulados.aspx.cs
index d21c41728..2c5b5ff60 100644
--- a/Nomina/ReportedeAcumulados.aspx.cs
+++ b/Nomina/ReportedeAcumulados.aspx.cs
@@ -605,8 +605,8 @@ public partial class Nomina_ReportedeAcumulados : ClsPaginas
if (true)
{
- Fila++;
- oldcveSupProyecto = cveSupProyecto; newsubproyecto = true;
+ Fila += 4;
+ oldcveSupProyecto = cveSupProyecto; newsubproyecto = true;
column = 1;
column++;
libro.Cell(Fila - 3, column).Value = string.Format("Total {0}", subproyectoold);
diff --git a/RH/CalculoSBC.aspx.cs b/RH/CalculoSBC.aspx.cs
index 0e672cbea..0c473901c 100644
--- a/RH/CalculoSBC.aspx.cs
+++ b/RH/CalculoSBC.aspx.cs
@@ -241,7 +241,7 @@ public partial class RH_CalculoSBC : ClsPaginas
{
string titulo = HttpUtility.HtmlDecode(Extensiones.ModExtensiones.TextoCelda(cell)).Trim();
titulo = limpiarcelda( titulo);
- if (GridView.Columns[i].Visible && titulo.Length > 0)
+ if (GridView.Columns.Count > i && GridView.Columns[i].Visible && titulo.Length > 0)
{
if (dt.Columns.Contains(titulo))
titulo = titulo + i;
diff --git a/RH/Personal.aspx b/RH/Personal.aspx
index 52185762d..5a9e03487 100644
--- a/RH/Personal.aspx
+++ b/RH/Personal.aspx
@@ -2394,6 +2394,25 @@
+
+
diff --git a/RH/Personal.aspx.vb b/RH/Personal.aspx.vb
index c5bac7099..c76ba4672 100644
--- a/RH/Personal.aspx.vb
+++ b/RH/Personal.aspx.vb
@@ -4514,7 +4514,7 @@ Partial Class RH_Personal
VacFolioActual = VacFolioActual + 1
Dim objRH As New ClsRH
'Dim continuar As Boolean = objRH.SolicitudVacacionesAdd(CvePersonal, fInicio, fFin, 0, UsuarioActual.CveUsuario, VacCveSupervisor, VacFolioActual, motivoVacaciones)
- Dim continuar As Boolean = objRH.SolicitudVacacionesAdd(CvePersonal, fInicio, fFin, 0, UsuarioActual.CveUsuario, VacCveSupervisor, VacFolioActual, FechaPago:=fechapago, diasinabiles:=diasinhabil)
+ Dim continuar As Boolean = objRH.SolicitudVacacionesAdd(CvePersonal, fInicio, fFin, 0, UsuarioActual.CveUsuario, VacCveSupervisor, VacFolioActual, FechaPago:=fechapago, diasinabiles:=diasinhabil, CveTipoPago:=DdlFormapagovacaciones.SelectedValue.ToEntero(), diasExtras:=TxtVacDiasExtra.Text.ToEntero())
If objRH.DtResultados.Rows.Count > 0 Then
Dim ShowError As String = objRH.DtResultados.Rows(0)("ShowError").ToString()
If ShowError.Length > 0 Then
@@ -4768,11 +4768,6 @@ Partial Class RH_Personal
Protected Sub BtnEditarDiaVacacionModal_Click(sender As Object, e As EventArgs) Handles BtnEditarDiaVacacionModal.Click
- Dim objRH As New ClsRH()
-
-
-
-
Dim FileExtension As String = "-1"
Dim Filesgral As List(Of Archivo) = TxtFileFormatoVacaciones.getfiles().Archivos
Dim Filename As String = ""
@@ -4784,36 +4779,27 @@ Partial Class RH_Personal
Documento = $"Vacaciones_{CvePersonalVacaciones}.{FileExtension}"
Dim tempArray() As String
tempArray = fileItem.filename.ToString().Split("-".ToCharArray())
-
Dim rutaDestino As String = $"{UsuarioActual.Empresa.Ruta}Personal\{CvePersonal}\Vacaciones\{Documento}"
-
If Not System.IO.Directory.Exists(UsuarioActual.Empresa.Ruta & "Personal\" & CvePersonal & "\Vacaciones\") Then
System.IO.Directory.CreateDirectory(UsuarioActual.Empresa.Ruta & "Personal\" & CvePersonal & "\Vacaciones\")
End If
-
-
If System.IO.File.Exists(rutaDestino) Then
System.IO.File.Delete(rutaDestino)
End If
-
System.IO.File.Move(fileItem.FileUrl, rutaDestino)
-
TxtFileFormatoVacaciones.Text = ""
-
Catch ex As Exception
OnError("Error al cargar Formato vacaciones", ex)
End Try
Next
If Documento.Length > 0 Then
-
+ Dim objRH As New ClsRH()
If objRH.SolicitudVacacionesAddUpdate(CvePersonalVacaciones, CvePersonal, UsuarioActual.CveUsuario, Documento) Then
Alert("La fecha se actualizo correctamente")
End If
UpModalEditarDiaVacacion.Update()
-
objRH.Dispose()
-
CargaVacaciones()
CargaVacacionesResumenPeriodoActual()
RegistraScript("$('#divEditarDiaVacacion').modal('hide');")
@@ -5304,38 +5290,14 @@ Partial Class RH_Personal
Dim Cantidad As Double = TxtCantidadResguardo.Text.ToDouble()
Dim Serie As String = TxtLiberarSerie.Text.Trim
- Dim MsgError As String = ""
Dim CveResultadoSalida As Integer = ObjInventario.AddMovimiento(CveAlmacenUniforme, 3, 1, Date.Now, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, CveAlmacenDestino:=DdlAlmacenDestinoLiberarUniforme.SelectedValue.ToEntero, CvePersonal:=CvePersonal, Observaciones:=DescripcionUniforme)
- If CveResultadoSalida > 0 Then
- If CveSeccionAlmacenUniforme = 0 Then CveSeccionAlmacenUniforme = -3 'que lo tome por default
- Dim ResultadoDetalleSalida As Boolean = ObjInventario.AddMovimientoDetalle(CveResultadoSalida, Cantidad, CveUM, CvePS, PU, CveSeccionAlmacen:=CveSeccionAlmacenUniforme, Serie:=Serie, CveMovimientoDetalleEntrada:=CveMovimientoDetalleUniforme)
- Dim CveSeccionAlmacen As Integer = DdlSeccionAlmacen.SelectedValue.ToEntero
- If ResultadoDetalleSalida Then
+ Dim ResultadoDetalleSalida As Boolean = ObjInventario.AddMovimientoDetalle(CveResultadoSalida, Cantidad, CveUM, CvePS, PU, CveSeccionAlmacen:=CveSeccionAlmacenUniforme, Serie:=Serie, CveMovimientoDetalleEntrada:=CveMovimientoDetalleUniforme)
+ Dim CveSeccionAlmacen As Integer = DdlSeccionAlmacen.SelectedValue.ToEntero
+ Dim CveResultadoEntrada As Integer = ObjInventario.AddMovimiento(DdlAlmacenDestinoLiberarUniforme.SelectedValue.ToEntero, 2, 1, Date.Now, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, CvePersonal:=CvePersonal, Observaciones:=DescripcionUniforme, CveMovimientoRelacionado:=CveMovimientoUniforme)
+ Dim ResultadoDetalleEntrada As Boolean = ObjInventario.AddMovimientoDetalle(CveResultadoEntrada, Cantidad, CveUM, CvePS, PU, CveSeccionAlmacen:=CveSeccionAlmacen, Serie:=Serie)
- Dim CveResultadoEntrada As Integer = ObjInventario.AddMovimiento(DdlAlmacenDestinoLiberarUniforme.SelectedValue.ToEntero, 2, 1, Date.Now, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, CvePersonal:=CvePersonal, Observaciones:=DescripcionUniforme, CveMovimientoRelacionado:=CveMovimientoUniforme)
- If CveResultadoEntrada > 0 Then
- Dim ResultadoDetalleEntrada As Boolean = ObjInventario.AddMovimientoDetalle(CveResultadoEntrada, Cantidad, CveUM, CvePS, PU, CveSeccionAlmacen:=CveSeccionAlmacen, Serie:=Serie)
- If ResultadoDetalleSalida And ResultadoDetalleEntrada Then
- MsgError = ""
- Else
- Alert("No se pudo registrar la liberación.", TipoMensaje.MsgError)
- MsgError = "Error1"
- End If
- Else
- MsgError = "Error1"
- End If
-
- Else
- MsgError = "Error1"
- End If
- Else
- MsgError = "Error"
-
- End If
-
-
- If MsgError = "" Then
+ If ResultadoDetalleSalida And ResultadoDetalleEntrada Then
ObjInventario.Commit()
Alert("El resguardo se liberó correctamente")
RegistraScript(String.Format("$('#{0}').modal('hide');", "ModalUniforme"))
@@ -5344,7 +5306,6 @@ Partial Class RH_Personal
Alert("No se pudo registrar la liberación.", TipoMensaje.MsgError)
ObjInventario.RollBack()
End If
-
ObjInventario.Dispose()
End Sub
diff --git a/Sistemas/PopUpCambiaUsuario.aspx.vb b/Sistemas/PopUpCambiaUsuario.aspx.vb
index acda2dfa4..2c3b04d80 100644
--- a/Sistemas/PopUpCambiaUsuario.aspx.vb
+++ b/Sistemas/PopUpCambiaUsuario.aspx.vb
@@ -53,29 +53,30 @@ Partial Class Sistemas_PopUpCambiaUsuario
End If
If splitedtext.Length > 0 Then
- Select Case splitedtext(0).ToUpper()
- Case "VSH" : CveEmpresa = "7"
- Case "JAM" : CveEmpresa = "119"
- Case "COMPUPROVEEDORES" : CveEmpresa = "72"
- Case "DNDIFUSA" : CveEmpresa = "80"
- Case "SOGO" : CveEmpresa = "8"
- Case "BDH" : CveEmpresa = "140"
- Case "ECONOLLANTAS" : CveEmpresa = "141"
- End Select
- End If
- DdlEmpresa.DataBind()
- DdlEmpresa.SelectedValue = CveEmpresa
-
- 'DdlRol.DataSource = GlobalDTRoles(DdlEmpresa.SelectedValue.ToEntero)
- 'DdlRol.DataBind()
- 'DdlRol.Items.Insert(0, New ListItem("Todos", "-1"))
-
- TxtBusqueda.Attributes.Add("data-table", gvUsuarios.ClientID)
-
- CargaUsuarios()
- 'LblUsuario.Text = usuarioactual.
-
+ Select Case splitedtext(0).ToUpper()
+ Case "VSH" : CveEmpresa = "7"
+ Case "JAM" : CveEmpresa = "119"
+ Case "COMPUPROVEEDORES" : CveEmpresa = "72"
+ Case "DNDIFUSA" : CveEmpresa = "80"
+ Case "SOGO" : CveEmpresa = "8"
+ Case "BDH" : CveEmpresa = "140"
+ Case "ECONOLLANTAS" : CveEmpresa = "141"
+ Case "SERVEC" : CveEmpresa = "153"
+ End Select
End If
+ DdlEmpresa.DataBind()
+ DdlEmpresa.SelectedValue = CveEmpresa
+
+ 'DdlRol.DataSource = GlobalDTRoles(DdlEmpresa.SelectedValue.ToEntero)
+ 'DdlRol.DataBind()
+ 'DdlRol.Items.Insert(0, New ListItem("Todos", "-1"))
+
+ TxtBusqueda.Attributes.Add("data-table", gvUsuarios.ClientID)
+
+ CargaUsuarios()
+ 'LblUsuario.Text = usuarioactual.
+
+ End If
End Sub