diff --git a/App_Code/CFDITimbre.vb b/App_Code/CFDITimbre.vb index da170c392..6600b448e 100644 --- a/App_Code/CFDITimbre.vb +++ b/App_Code/CFDITimbre.vb @@ -16,6 +16,9 @@ Public Class CFDITimbre Public Property Nomina As CFDINomina Public Property ComplementoPagos As CFDIComplementoPagos Public Property Complementos As CFDIComplementos + Public Property Timbrado As Boolean + Public Property IStimbreFiniquito As Boolean + Public ReadOnly Property TotalImpuestosRetenidos As Decimal Get Return (From c In Conceptos @@ -128,6 +131,8 @@ Public Class CFDINomina Public Property OtrosPagos As List(Of CFDINominaOtrosPagos) Public Property HorasExtras As List(Of CFDINominaHorasExtras) Public Property CveNomina As Integer + Public Property Antiguedad As Integer + Public Property UltimoSueldoOrdinario As Decimal Public ReadOnly Property TotalPercepciones As Double Get diff --git a/App_Code/ClsNominas.vb b/App_Code/ClsNominas.vb index 59e51f69a..78496ee91 100644 --- a/App_Code/ClsNominas.vb +++ b/App_Code/ClsNominas.vb @@ -852,7 +852,7 @@ Public Class ClsNominas Return Retorno End Function - Public Function UpdateEstatusNomNominas(Estatus As Integer, CvePAC As Integer, FolioFiscal As String, SelloSAT As String, FechaCancelacion As DateTime, CveNomina As Integer, Optional SubTotal As Double = -1, Optional Descuento As Double = -1, Optional ISR As Double = -1, Optional Total As Double = -1, Optional DiasPagados As Double = -1) As Boolean + Public Function UpdateEstatusNomNominas(Estatus As Integer, CvePAC As Integer, FolioFiscal As String, SelloSAT As String, FechaCancelacion As DateTime, CveNomina As Integer, Optional SubTotal As Double = -1, Optional Descuento As Double = -1, Optional ISR As Double = -1, Optional Total As Double = -1, Optional DiasPagados As Double = -1, Optional isFiniquito As Boolean = False) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Nom_NominasUpdateEstatus") @@ -870,6 +870,7 @@ Public Class ClsNominas .Add("@Total", SqlDbType.Money).Value = Total .Add("@DiasPagados", SqlDbType.Int).Value = DiasPagados .Add("@CveNomina", SqlDbType.Int).Value = CveNomina + .Add("@isFiniquito", SqlDbType.Bit).Value = isFiniquito End With Try @@ -2182,7 +2183,7 @@ Public Class ClsNominas End Try Return retorno End Function - Public Function GetNominaEmpleado(CveProyecto As Integer, CveSubProyecto As Integer, CveTurno As Integer, CvePeriodo As Integer, CveEmpresa As Integer, Agrupador As Integer, Optional RegimenContratacion As Integer = 1, Optional CvePersonal As Integer = -1) As Boolean + Public Function GetNominaEmpleado(CveProyecto As Integer, CveSubProyecto As Integer, CveTurno As Integer, CvePeriodo As Integer, CveEmpresa As Integer, Agrupador As Integer, Optional RegimenContratacion As Integer = 1, Optional CvePersonal As Integer = -1, Optional SalarioDiario As Decimal = 0) As Boolean Dim retorno As Boolean = False Try DTSet = New DataSet() @@ -2196,6 +2197,7 @@ Public Class ClsNominas .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@RegimenContratacion", SqlDbType.Int).Value = RegimenContratacion .Add("@CvePersonal", SqlDbType.Decimal).Value = CvePersonal + .Add("@SalarioDiario", SqlDbType.Decimal).Value = SalarioDiario End With diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index 1ed6016c8..15411ebe9 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -3855,6 +3855,7 @@ Public Class ClsPaginas PaginaDict.Add("/Nomina/CatConceptos2.aspx".ToUpper(), -1) PaginaDict.Add("/Nomina/Aguinaldo.aspx".ToUpper(), -1) PaginaDict.Add("/Nomina/RepInversiondeNomina.aspx".ToUpper(), 906) + PaginaDict.Add("/RH/DiasFestivos.aspx".ToUpper(), -1) PaginaDict.Add("/Nomina/FiniquitoB.aspx".ToUpper(), -1) ''CONFIGURACIONES GENERALES PaginaDict.Add("/Sistemas/SistemaSIG.aspx".ToUpper(), 9999) @@ -4681,7 +4682,6 @@ Public Class ClsPaginas PaginaDict.Add("/Inventarios/EntregasPorRealizar.aspx".ToUpper(), 728) PaginaDict.Add("/Inventarios/CatAlmacenClasificacionSecciones.aspx".ToUpper(), 764) PaginaDict.Add("/Inventarios/ReconstruirCostos.aspx".ToUpper(), 764) - PaginaDict.Add("/Inventarios/RecepcionDevolucion.aspx".ToUpper(), 696) #End Region @@ -4802,6 +4802,7 @@ Public Class ClsPaginas #End Region #Region "Planeacion" 'PLANEACIÓN + PaginaDict.Add("/Planeacion/CatSucursales.aspx".ToUpper(), 17) PaginaDict.Add("/Planeacion/Sucursal.aspx".ToUpper(), 17) PaginaDict.Add("/Planeacion/CatProyectos.aspx".ToUpper(), 34) PaginaDict.Add("/Planeacion/CatSubProyectos.aspx".ToUpper(), 35) @@ -5941,19 +5942,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) @@ -6083,7 +6071,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) @@ -6098,7 +6086,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)) @@ -6130,7 +6118,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)) @@ -6163,8 +6151,7 @@ Public Class ClsPaginas params.Add(New CrystalParametro("ClienteTelefono", Vta.ClienteSucursal.TelefonoSucursal)) Else params.Add(New CrystalParametro("ClienteContactoMail", Vta.Cliente.MailCotizacion)) - params.Add(New CrystalParametro("ClienteTelefono", If(Vta.TipoDocto.Contiene("Ing", "Rem") AndAlso Vta.Cliente.Telefono.Length > 6, Vta.Cliente.Telefono, Vta.TelefonoGenerico))) - + params.Add(New CrystalParametro("ClienteTelefono", If(Vta.TipoDocto.Contiene("Ing", "Rem") AndAlso Vta.Cliente.RFC = "XAXX010101000", Vta.TelefonoGenerico, Vta.Cliente.Telefono))) End If If UsuarioActual.CveEmpresa.Contiene(17) Then @@ -6466,18 +6453,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) @@ -6632,7 +6608,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) @@ -6650,17 +6626,17 @@ Public Class ClsPaginas 'CLIENTE If Vta.CveCliente.ToEntero > 0 Or Vta.CveEmpresaCRM.ToEntero > 0 Then params.Add(New ReportParameter("ClienteCodigo", Vta.Cliente.Codigo)) - 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 RFCReceptor = "XAXX010101000", $"{Vta.Cliente.Nombre}({Vta.AtencionA})", Vta.Cliente.Nombre)))) + 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 @@ -6743,7 +6719,7 @@ Public Class ClsPaginas params.Add(New ReportParameter("ClienteTelefono", Vta.ClienteSucursal.TelefonoSucursal)) ElseIf Vta.CveCliente.ToEntero > 0 Then params.Add(New ReportParameter("ClienteContactoMail", Vta.Cliente.MailCotizacion)) - params.Add(New ReportParameter("ClienteTelefono", If(Vta.TipoDocto.Contiene("Ing", "Rem") AndAlso Vta.Cliente.Telefono.Length > 6, Vta.Cliente.Telefono, Vta.TelefonoGenerico))) + params.Add(New ReportParameter("ClienteTelefono", If(Vta.TipoDocto.Contiene("Ing", "Rem") AndAlso Vta.Cliente.Telefono.Length > 6, Vta.TelefonoGenerico, Vta.Cliente.Telefono))) End If If UsuarioActual.CveEmpresa.Contiene(17) Then @@ -7861,7 +7837,7 @@ Public Class ClsPaginas #Region "PDF NOMINA" - Public Function GeneraPDFNomina(CvePersonal As Integer, CvePeriodo As Integer, CveEmpresa As Integer, RutaEmpresa As String) As Byte() + Public Function GeneraPDFNomina(CvePersonal As Integer, CvePeriodo As Integer, CveEmpresa As Integer, RutaEmpresa As String, Optional indemnizacion As Boolean = False) As Byte() Dim ObjNomina As New ClsNominas Dim ObjPersonal As New ClsRH @@ -7881,7 +7857,7 @@ Public Class ClsPaginas Dim DTDeducciones2 As New Data.DataTable Dim Ruta As String = $"{ModExtensiones.DirectorioBaseEmpresas}Empresas\{CveEmpresa}\" - Dim PathXML As String = $"{Ruta}XML\Nomina\{ObjNomina.SerieFolio}.xml" + Dim PathXML As String = $"{Ruta}XML\Nomina\{ObjNomina.Serie }{If(indemnizacion, "F", "")}-{ObjNomina.Folio}.xml" Dim FechaEmision, FechaCertificacion As DateTime Dim FolioFiscal, NoSerieCertificado, NoSerieCertificadoContribuyente, SelloCFDi, SelloSAT As String FolioFiscal = "" @@ -7961,7 +7937,32 @@ Public Class ClsPaginas 'Datos Empresa RptParametro.Add(New ReportParameter("RegistroPatronal", ObjNomina.RegistroPatronal)) + Dim ajusteindemnizacion As Double = 0 + 'PERCECIONES - DEDUCCIONES + If ObjNomina.GetNom_NominasDetalles(CveNomina, CvePersonal, CvePeriodo, "-1") Then + Dim filtrop As String = " AND CveSistema NOT IN(10,11,32)" + Dim friltrod As String = " AND CveSistema <>47" + If indemnizacion Then + filtrop = "AND CveSistema IN(10,11,32)" + friltrod = " AND CveSistema =47" + End If + DTPercepciones = ObjNomina.DtResultados.FiltraParametros($"((Tipo = 'P' OR (Tipo = 'D' AND Importe <0)) AND Importe <>0 AND EsPadre = 1 AND SoloVisible =0) {filtrop}") + DTDeducciones = ObjNomina.DtResultados.FiltraParametros($"(Tipo = 'D' AND Importe >0 AND EsPadre = 1 AND SoloVisible =0) {friltrod}") + DTDeducciones2 = ObjNomina.DtResultados.FiltraParametros($"((Tipo = 'D' AND Importe >0 AND EsPadre = 1 AND SoloVisible =0) OR CveSistema IN (20,21)){friltrod}") + ajusteindemnizacion = ObjNomina.DtResultados.FiltraParametros($"((Tipo = 'P' OR (Tipo = 'D' AND Importe <0)) AND Importe <>0 AND EsPadre = 1 AND SoloVisible =0) AND CveSistema IN(10,11,32)").SUM("Importe") - + ObjNomina.DtResultados.FiltraParametros($"(Tipo = 'D' AND Importe >0 AND EsPadre = 1 AND SoloVisible =0) AND CveSistema =47").SUM("Importe") + For Each row As DataRow In DTPercepciones.Rows + If row("Tipo").ToString() = "D" Then + row("Codigo") = row("Codigo").ToString().Replace("D", "OP") + row("Importe") = row("Importe").ToString().ToDecimal() * -1 + End If + Next + + Else + DTPercepciones = Nothing + DTDeducciones = Nothing + End If 'DATOS DEL EMPLEADO If ObjPersonal.GetPersonal(CvePersonal, CveEmpresa) Then @@ -8003,7 +8004,7 @@ Public Class ClsPaginas RptParametro.Add(New ReportParameter("Cantidad", "1")) RptParametro.Add(New ReportParameter("Unidad", "ACT")) RptParametro.Add(New ReportParameter("Descripcion", "PAGO DE NÓMINA")) - RptParametro.Add(New ReportParameter("Total", ObjNomina.Total.ToString())) + RptParametro.Add(New ReportParameter("Total", If(indemnizacion, ajusteindemnizacion, ObjNomina.Total - ajusteindemnizacion).ToString())) Dim CBB As New ClbNegBICFDv3_2.ClsNegCBBGenerar() cQr = CBB.GenerarCBBBytes(UsuarioActual.Empresa.RFC, ObjPersonal.RFC, ObjNomina.Total.ToString().ToDecimal(), FolioFiscal) @@ -8025,22 +8026,6 @@ Public Class ClsPaginas End If End If - 'PERCECIONES - DEDUCCIONES - If ObjNomina.GetNom_NominasDetalles(CveNomina, CvePersonal, CvePeriodo, "-1") Then - DTPercepciones = ObjNomina.DtResultados.FiltraParametros("(Tipo = 'P' OR (Tipo = 'D' AND Importe <0)) AND Importe <>0 AND EsPadre = 1 AND SoloVisible =0") - DTDeducciones = ObjNomina.DtResultados.FiltraParametros("Tipo = 'D' AND Importe >0 AND EsPadre = 1 AND SoloVisible =0") - DTDeducciones2 = ObjNomina.DtResultados.FiltraParametros("(Tipo = 'D' AND Importe >0 AND EsPadre = 1 AND SoloVisible =0) OR CveConcepto IN (1471,1491)") - For Each row As DataRow In DTPercepciones.Rows - If row("Tipo").ToString() = "D" Then - row("Codigo") = row("Codigo").ToString().Replace("D", "OP") - row("Importe") = row("Importe").ToString().ToDecimal() * -1 - End If - Next - - Else - DTPercepciones = Nothing - DTDeducciones = Nothing - End If RptParametro.Add(New ReportParameter("PU", DTPercepciones.SUM("Importe").ToString())) RptParametro.Add(New ReportParameter("Importe", DTPercepciones.SUM("Importe").ToString())) diff --git a/App_Code/ClsRH.vb b/App_Code/ClsRH.vb index 678bccbbc..196f5f3bf 100644 --- a/App_Code/ClsRH.vb +++ b/App_Code/ClsRH.vb @@ -122,9 +122,74 @@ Public Class ClsRH CveConexion = 0 End If - End Sub + End Sub #End Region + +#Region "DiasFestivos" + + Public Function DiasFestivosGet(CveEmpresa As Int32) As Boolean + Dim retorno As Boolean = False + DataAdapter("PA_RH_DiasFestivosGet", CommandType.StoredProcedure) + With SqlAdapter.SelectCommand.Parameters + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + Try + SqlAdapter.Fill(Data) + retorno = True + Catch Ex1 As SqlException + + Me.OnError("Ocurrió un error al obtener los días festivos", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + Catch ex As Exception + OnError("Ocurrió un error al Guardar el Tipo de A-I", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + Return retorno + End Function + Public Function DiasFestivosAdd(fecha As DateTime, cveEmpresa As Int32, CveUsuario As Int32) As Boolean + Dim retorno As Boolean = False + DataAdapter("PA_RH_DiasFestivosAdd", CommandType.StoredProcedure) + With SqlAdapter.SelectCommand.Parameters + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = cveEmpresa + .Add("@Fecha", SqlDbType.DateTime).Value = fecha + End With + + Try + SqlAdapter.Fill(Data) + retorno = True + Catch Ex1 As SqlException + If Ex1.Message.Contains("Número: 2627;") Then + Alert($"Ya existe un día festivo con fecha '{fecha:dd/MM/yyyy}'.", TipoMensaje.MsgAdvertencia) + Else + Me.OnError("Ocurrió un error al guardar el día festivo.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + Catch ex As Exception + OnError("Ocurrió un error al Guardar el Tipo de A-I", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + Return retorno + End Function + Public Function DiasFestivosRemove(fecha As DateTime, cveEmpresa As Int32) As Boolean + Dim retorno As Boolean = False + DataAdapter("PA_RH_DiasFestivosRemove", CommandType.StoredProcedure) + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = cveEmpresa + .Add("@Fecha", SqlDbType.DateTime).Value = fecha + End With + + Try + SqlAdapter.Fill(Data) + retorno = True + Catch Ex1 As SqlException + Me.OnError("Ocurrió un error al eliminar el día festivo.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + Catch ex As Exception + OnError("Ocurrió un error al eliminar el día festivo", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + Return retorno + End Function +#End Region + #Region "ClsRHAsistenciasInasistencias" Public Function GetAsistenciasInasistencias() As Boolean Dim Retorno As Boolean = False @@ -2145,7 +2210,7 @@ chkAplicaVacacion As Boolean, chkAplicaIncapacidad As Boolean, chkAplicaRetardo Return Retorno End Function - Public Function UpPersonalAltas(CvePersonal As Integer, fechaInicio As String, fechaFin As String, CvePeriodoFiniquito As Integer, CveMotivoBaja As Integer, esLiquidacion As Boolean) As Boolean + Public Function UpPersonalAltas(CvePersonal As Integer, fechaInicio As String, fechaFin As String, CvePeriodoFiniquito As Integer, CveMotivoBaja As Integer, esLiquidacion As Boolean, ValIndemnizacion As Boolean, ValSeparacionunica As Boolean, ValPrimadeantiguedad As Boolean) As Boolean Dim Retorno As Boolean = False SqlDataAdapter("PA_RH_PersonalAltasUp") @@ -2156,6 +2221,9 @@ chkAplicaVacacion As Boolean, chkAplicaIncapacidad As Boolean, chkAplicaRetardo .Add("@CvePeriodoFiniquito", SqlDbType.Int).Value = CvePeriodoFiniquito .Add("@CveMotivoBaja", SqlDbType.Int).Value = CveMotivoBaja .Add("@esLiquidacion", SqlDbType.Int).Value = If(esLiquidacion, 1, 0) + .Add("@ValIndemnizacion", SqlDbType.Bit).Value = If(ValIndemnizacion, 1, 0) + .Add("@ValSeparacionunica", SqlDbType.Bit).Value = If(ValSeparacionunica, 1, 0) + .Add("@ValPrimadeantiguedad", SqlDbType.Bit).Value = If(ValPrimadeantiguedad, 1, 0) End With Try SqlAdapter.Fill(Data) diff --git a/App_Code/LogicNominas.vb b/App_Code/LogicNominas.vb index ae2fbadef..6ac889921 100644 --- a/App_Code/LogicNominas.vb +++ b/App_Code/LogicNominas.vb @@ -20,20 +20,53 @@ Public Class LogicNominas sw.Start() End If - Dim cfdi As CFDITimbre = PreTimbrar(CveNomina, UsuarioActual) 'CvePersonal, CvePeriodo, + Dim cfdi As CFDITimbre = PreTimbrar(CveNomina, UsuarioActual, False) 'CvePersonal, CvePeriodo, If cfdi IsNot Nothing AndAlso cfdi.Mensaje = "" Then - Dim ObjTimbrado As New Timbrado - Dim ObjFactura As New Modelos.Factura - ObjFactura.TipoDocto = "Nomina" - ObjFactura.Folio = cfdi.Comprobante.Folio.ToEntero() - ObjFactura.Serie = cfdi.Comprobante.Serie - ObjFactura.Timbre = cfdi - If Not ObjTimbrado.TimbrarFactura(UsuarioActual, ObjFactura, CvePAC) Then - Retorno = ObjTimbrado.MensajeErrorCFDI + If Not cfdi.Timbrado Then + Dim ObjTimbrado As New Timbrado + Dim ObjFactura As New Modelos.Factura + ObjFactura.TipoDocto = "Nomina" + ObjFactura.Folio = cfdi.Comprobante.Folio.ToEntero() + ObjFactura.Serie = cfdi.Comprobante.Serie + ObjFactura.Timbre = cfdi + If Not ObjTimbrado.TimbrarFactura(UsuarioActual, ObjFactura, CvePAC) Then + Retorno = ObjTimbrado.MensajeErrorCFDI + End If End If If Retorno <> "" Then Retorno = $"{Retorno} - {cfdi.Receptor.Nombre}" Else + If hasfiniquito Then + + cfdi = PreTimbrar(CveNomina, UsuarioActual, True) 'CvePersonal, CvePeriodo, + If cfdi IsNot Nothing AndAlso cfdi.Mensaje = "" Then + + If Not cfdi.Timbrado Then + Dim ObjTimbrado As New Timbrado + Dim ObjFactura As New Modelos.Factura + ObjFactura.TipoDocto = "Nomina" + ObjFactura.Folio = cfdi.Comprobante.Folio.ToEntero() + ObjFactura.Serie = cfdi.Comprobante.Serie + ObjFactura.Timbre = cfdi + If Not ObjTimbrado.TimbrarFactura(UsuarioActual, ObjFactura, CvePAC) Then + Retorno = ObjTimbrado.MensajeErrorCFDI + End If + If Retorno <> "" Then + Retorno = $"{Retorno} - {cfdi.Receptor.Nombre}" + Else + + End If + + End If + Else + If cfdi Is Nothing Then + Retorno = $"No se pudo generar el pretimbre(GetError):
{GetError}" + Else + Retorno = $"No se pudo generar el pretimbre:
{cfdi.Mensaje}" + End If + End If + + End If End If Else If cfdi Is Nothing Then @@ -48,10 +81,10 @@ Public Class LogicNominas End If Return Retorno End Function - - Private Function PreTimbrar(CveNomina As Integer, UsuarioActual As Usuario) As CFDITimbre + Dim hasfiniquito As Boolean + Private Function PreTimbrar(CveNomina As Integer, UsuarioActual As Usuario, TimbreIndemnizacion As Boolean) As CFDITimbre Dim continuar As Boolean = True - + hasfiniquito = False Dim CvePersonal As Integer = -1 Dim CvePeriodo As Integer = -1 Dim DtPercepciones As Data.DataTable = Nothing @@ -107,13 +140,26 @@ Public Class LogicNominas Dim ObjIncapacidades As New List(Of CFDINominaIncapacidades) 'Conexiones a la Base de Datos + Dim cfdi As New CFDITimbre + cfdi.Nomina = New CFDINomina Using objNomina As ClsNominas = New ClsNominas() Using objPersonal As ClsRH = New ClsRH() If objNomina.GetNom_Nominas(CveNomina, -1, -1, -1, UsuarioActual.CveEmpresa) AndAlso objNomina.DtResultados.Rows.Count > 0 Then - CvePersonal = objNomina.DtResultados.Rows(0)("CvePersonal").ToString().ToEntero() - CvePeriodo = objNomina.DtResultados.Rows(0)("CvePeriodo").ToString().ToEntero() + Dim drow As DataRow = objNomina.DtResultados.Rows(0) + CvePersonal = drow("CvePersonal").ToString().ToEntero() + CvePeriodo = drow("CvePeriodo").ToString().ToEntero() + cfdi.Nomina.Antiguedad = drow("Antiguedad").ToString().ToEntero() + cfdi.Nomina.UltimoSueldoOrdinario = drow("UltimoSueldoOrdinario").ToString().ToDecimal() Serie = objNomina.Serie Folio = objNomina.Folio.ToString() + If TimbreIndemnizacion Then + cfdi.Timbrado = drow("SeTimbroFiniquitoVal").ToString().ToEntero() = 1 + cfdi.IStimbreFiniquito = True + Serie = $"{objNomina.Serie}F" + Else + cfdi.Timbrado = drow("SeTimbroVal").ToString().ToEntero() = 1 + cfdi.IStimbreFiniquito = False + End If Else If continuar Then GetError = "No se pudo obtener la información de la nomina" 'si continuar= true el error se origino en este nodo y se le asigno el error continuar = False @@ -148,18 +194,27 @@ Public Class LogicNominas End If If continuar AndAlso objNomina.GetNom_NominasDetalles(CveNomina, CvePersonal, CvePeriodo, "-1") Then If objNomina.DtResultados.Rows.Count > 0 Then - Dim filtropercepciones As String = "Tipo = 'P' AND EsPadre = 1 AND SoloVisible =0" + Dim filtropercepciones As String = "Tipo = 'P' AND EsPadre = 1 AND SoloVisible =0 AND SATCveConcepto NOT IN ('022', '023','025')" + If TimbreIndemnizacion Then + filtropercepciones = " Tipo = 'P' AND SATCveConcepto IN ('022', '023','025')" + End If DtPercepciones = objNomina.DtResultados.FiltraParametros(filtropercepciones) - Dim filtrodeduc As String = "Tipo = 'D' AND EsPadre = 1 AND SoloVisible =0 AND (TipoConceptoSAT<>'O' OR TipoConceptoSAT IS NULL)" + Dim filtrodeduc As String = "Tipo = 'D' AND EsPadre = 1 AND SoloVisible =0 AND (TipoConceptoSAT<>'O' OR TipoConceptoSAT IS NULL) AND CveSistema <> 47" + If TimbreIndemnizacion Then + filtrodeduc = " Tipo = 'D' AND CveSistema =47" + End If DtDeducciones = objNomina.DtResultados.FiltraParametros(filtrodeduc) - DtOtrosPagos = objNomina.DtResultados.FiltraParametros(" TipoConceptoSAT='O'") + If Not TimbreIndemnizacion Then + DtOtrosPagos = objNomina.DtResultados.FiltraParametros(" TipoConceptoSAT='O'") + + End If Dim disrcomp As DataRow = DtOtrosPagos.FiltroPrimero("Codigo ='D999'") For Each drow As DataRow In DtDeducciones.Rows If drow("Codigo").ToString() = "D038" Then End If Next - + hasfiniquito = objNomina.DtResultados.COUNT("SATCveConcepto", "(Tipo = 'P' AND SATCveConcepto IN ('022', '023','025')) OR (Tipo = 'D' AND SATCveConcepto = '101')") > 0 TotalPercepciones = DtPercepciones.SUM("Importe").ToString().ToDecimal() @@ -170,53 +225,70 @@ Public Class LogicNominas If continuar Then GetError = "No se pudo obtener el detalle de la nomina" 'si continuar= true el error se origino en este nodo y le asigno el error continuar = False End If - If continuar AndAlso objNomina.GetHorasExtras(CvePersonal, CvePeriodo, UsuarioActual.CveEmpresa) Then - DtHorasExtras = objNomina.DtResultados + If Not TimbreIndemnizacion Then + If continuar AndAlso objNomina.GetHorasExtras(CvePersonal, CvePeriodo, UsuarioActual.CveEmpresa) Then + DtHorasExtras = objNomina.DtResultados + Else + continuar = False + End If Else - continuar = False + DtHorasExtras = New DataTable() End If If continuar AndAlso objNomina.GetPeriodos(-1, UsuarioActual.CveEmpresa, -1, -1, CvePeriodo) AndAlso objNomina.DtResultados.Rows().Count > 0 Then Dim DrPeriodo As DataRow = objNomina.DtResultados.Rows(0) - FechaInicio = DrPeriodo("FechaInicio").ToString().ToDate - FechaFin = DrPeriodo("FechaFin").ToString().ToDate - FechaPago = DrPeriodo("FechaPago").ToString().ToDate - TipoNomina = If(objNomina.CveTipoPeriodo = 6, "E", "O") + FechaFin = DrPeriodo("FechaFin").ToString().ToDate() + FechaPago = DrPeriodo("FechaPago").ToString().ToDate() + + If Not TimbreIndemnizacion Then + FechaInicio = DrPeriodo("FechaInicio").ToString().ToDate() + TipoNomina = If(objNomina.CveTipoPeriodo = 6, "E", "O") + Else + FechaInicio = FechaFin + TipoNomina = "E" + End If Else If continuar Then GetError = "No se pudo obtener la información del periodo" 'si continuar= true el error se origino en este nodo y le asigno el error continuar = False End If - If continuar AndAlso objPersonal.GetAsistencias(CvePersonal, -1, -1, -1, -1, -1, FechaInicio, FechaFin, UsuarioActual.CveEmpresa) Then + If Not TimbreIndemnizacion Then + If continuar AndAlso objPersonal.GetAsistencias(CvePersonal, -1, -1, -1, -1, -1, FechaInicio, FechaFin, UsuarioActual.CveEmpresa) Then - Dim Asistencias As Integer = objPersonal.DtResultados.SUM("AplicaAsistencia").ToEntero() - 'If Asistencias > 15 Then - ' Asistencias = 15 - 'End If - Dim Vacaciones As Integer = objPersonal.DtResultados.SUM("AplicaVacacion").ToEntero() - DiasIncapacitados = objPersonal.DtResultados.SUM("AplicaIncapacidad").ToEntero() - DiasPagados = Asistencias - Vacaciones - If DiasPagados < 0 Then DiasPagados = 0 - Else - continuar = False - End If - If DiasIncapacitados > 0 Then - If objNomina.GetIncapacidades(CvePersonal, CvePeriodo, UsuarioActual.CveEmpresa) Then - If objNomina.DtResultados IsNot Nothing AndAlso objNomina.DtResultados.Rows.Count > 0 Then - For Each dr As DataRow In objNomina.DtResultados.Rows - ObjIncapacidades.Add(New CFDINominaIncapacidades With {.DiasIncapacidad = dr("Dias").ToString().ToEntero().ToString(), .TipoIncapacidad = dr("ClaveTipoIncapacidad").ToString(), .Importe = dr("Descuento").ToString().ToDecimal}) - Next - End If + + Dim Asistencias As Integer = objPersonal.DtResultados.SUM("AplicaAsistencia").ToEntero() + 'If Asistencias > 15 Then + ' Asistencias = 15 + 'End If + Dim Vacaciones As Integer = objPersonal.DtResultados.SUM("AplicaVacacion").ToEntero() + DiasIncapacitados = objPersonal.DtResultados.SUM("AplicaIncapacidad").ToEntero() + DiasPagados = Asistencias - Vacaciones + If DiasPagados < 0 Then DiasPagados = 0 Else - If continuar Then GetError = "No se pudo obtener las incapacidades del periodo" 'si continuar= true el error se origino en este nodo y le asigno el error continuar = False End If + Else + DiasPagados = 1 + DiasIncapacitados = 0 + End If + If continuar AndAlso DiasIncapacitados > 0 Then + If Not TimbreIndemnizacion Then + + If objNomina.GetIncapacidades(CvePersonal, CvePeriodo, UsuarioActual.CveEmpresa) Then + If objNomina.DtResultados IsNot Nothing AndAlso objNomina.DtResultados.Rows.Count > 0 Then + For Each dr As DataRow In objNomina.DtResultados.Rows + ObjIncapacidades.Add(New CFDINominaIncapacidades With {.DiasIncapacidad = dr("Dias").ToString().ToEntero().ToString(), .TipoIncapacidad = dr("ClaveTipoIncapacidad").ToString(), .Importe = dr("Descuento").ToString().ToDecimal}) + Next + End If + Else + If continuar Then GetError = "No se pudo obtener las incapacidades del periodo" 'si continuar= true el error se origino en este nodo y le asigno el error + continuar = False + End If + End If End If End Using End Using - 'Lnado del CFDITimbre - Dim cfdi As New CFDITimbre - cfdi.Nomina = New CFDINomina + 'Lnado del CFDITimbre cfdi.Nomina.Version = "1.2" cfdi.Nomina.TipoNomina = TipoNomina cfdi.Nomina.FechaPago = FechaPago @@ -326,7 +398,7 @@ Public Class LogicNominas Next End If - If CveRegimenContratacion.ToEntero() = 2 AndAlso ((ObjOtrosPagos.FirstOrDefault(Function(m) m.TipoOtroPago.ToEntero().Contiene(2, 7, 8))) Is Nothing) Then + If Not TimbreIndemnizacion AndAlso CveRegimenContratacion.ToEntero() = 2 AndAlso ((ObjOtrosPagos.FirstOrDefault(Function(m) m.TipoOtroPago.ToEntero().Contiene(2, 7, 8))) Is Nothing) Then ObjOtrosPagos.Add(New CFDINominaOtrosPagos With {.TipoOtroPago = "002", ' codigo fijo, por ser referente a subsidio al empleo .Clave = "D051", .Concepto = "Subs al Empleo acreditado", .Importe = 0D, .Subsidiocausado = 0D}) @@ -361,9 +433,9 @@ Public Class LogicNominas cfdi.Nomina.Receptor.NSS = NumeroSS cfdi.Nomina.Receptor.FechaInicioContrato = FechaInicioContrato cfdi.Nomina.Receptor.Antiguedad = $"P{AntiguedadSemanas}W" - cfdi.Nomina.Receptor.TipoContrato = CodigoTipoContrato + cfdi.Nomina.Receptor.TipoContrato = If(TimbreIndemnizacion, "99", CodigoTipoContrato) cfdi.Nomina.Receptor.CodigoTipoJornada = ClaveTipoJornada - cfdi.Nomina.Receptor.CodigoRegimenContratacion = CveRegimenContratacion + cfdi.Nomina.Receptor.CodigoRegimenContratacion = If(TimbreIndemnizacion, "13", CveRegimenContratacion) cfdi.Nomina.Receptor.CodigoEmpleado = Codigo cfdi.Nomina.Receptor.Departamento = Departamento cfdi.Nomina.Receptor.Puesto = Puesto diff --git a/App_Code/Timbrado.vb b/App_Code/Timbrado.vb index e09436df7..6dba27799 100644 --- a/App_Code/Timbrado.vb +++ b/App_Code/Timbrado.vb @@ -935,7 +935,7 @@ Public Class Timbrado Dim ObjVentas As New ClsVentas() - If Not ObjVentas.UpdateEstatusFactura(3, FolioFiscal, "", ObjCFDITimbre.Comprobante.Fecha, Ventas.CveVenta, CvePAC:=1, RFCReceptor:=ObjCFDITimbre.Receptor.RFC) Then + If Not ObjVentas.UpdateEstatusFactura(3, FolioFiscal, "", ObjCFDITimbre.Comprobante.Fecha, Ventas.CveVenta, CvePAC:=1) Then Retorno = "No se pudo registrar el folio fiscal" End If ObjVentas.Dispose() @@ -1520,7 +1520,7 @@ Public Class Timbrado If Ventas.CveVenta > 0 Then Dim ObjVentas As New ClsVentas() - If ObjVentas.UpdateEstatusFactura(3, FolioFiscal, "", ObjCFDITimbre.Comprobante.Fecha, Ventas.CveVenta, CvePAC:=UsuarioActual.Empresa.CvePAC, RFCReceptor:=ObjCFDITimbre.Receptor.RFC) Then + If ObjVentas.UpdateEstatusFactura(3, FolioFiscal, "", ObjCFDITimbre.Comprobante.Fecha, Ventas.CveVenta, CvePAC:=UsuarioActual.Empresa.CvePAC) Then Retorno = "" Else Retorno = "Error" @@ -2021,57 +2021,66 @@ Public Class Timbrado End If #End Region If ObjCFDITimbre.Nomina IsNot Nothing Then - + 'If cfdi.Nomina12SeparacionIndemnizacion Then If ObjCFDITimbre.Nomina.Percepciones IsNot Nothing AndAlso ObjCFDITimbre.Nomina.Percepciones.Count > 0 Then - cfdi.Nomina12Percepciones(ObjCFDITimbre.Nomina.TotalSueldos, ObjCFDITimbre.Nomina.TotalIndemnizacion, ObjCFDITimbre.Nomina.TotalJubilacion, ObjCFDITimbre.Nomina.TotalPercepcionesGravado, ObjCFDITimbre.Nomina.TotalPercepcionesExento) - For Each percep As CFDINominaPercepciones In ObjCFDITimbre.Nomina.Percepciones - cfdi.Nomina12Percepcion(percep.TipoPercepcion, percep.Clave, percep.Concepto, Math.Round(percep.ImporteGravado, 2), Math.Round(percep.ImporteExento, 2)) - If percep.TipoPercepcion.ToEntero() = 19 Then + cfdi.Nomina12Percepciones(ObjCFDITimbre.Nomina.TotalSueldos, ObjCFDITimbre.Nomina.TotalIndemnizacion, ObjCFDITimbre.Nomina.TotalJubilacion, ObjCFDITimbre.Nomina.TotalPercepcionesGravado, ObjCFDITimbre.Nomina.TotalPercepcionesExento) + For Each percep As CFDINominaPercepciones In ObjCFDITimbre.Nomina.Percepciones + cfdi.Nomina12Percepcion(percep.TipoPercepcion, percep.Clave, percep.Concepto, Math.Round(percep.ImporteGravado, 2), Math.Round(percep.ImporteExento, 2)) + If percep.TipoPercepcion.ToEntero() = 19 Then - If ObjCFDITimbre.Nomina.HorasExtras IsNot Nothing AndAlso ObjCFDITimbre.Nomina.HorasExtras.Count > 0 Then - For Each HoraExtra As CFDINominaHorasExtras In ObjCFDITimbre.Nomina.HorasExtras - cfdi.Nomina12HorasExtra(HoraExtra.Dias.ToEntero, HoraExtra.TipoHoras, HoraExtra.HorasExtra, HoraExtra.ImportePagado) - Next - End If - End If - Next - End If - - 'deducciones al final - If ObjCFDITimbre.Nomina.Deducciones IsNot Nothing AndAlso ObjCFDITimbre.Nomina.Deducciones.Count > 0 Then - cfdi.Nomina12Deducciones(ObjCFDITimbre.Nomina.TotalDeduccionesOtras, Math.Round(ObjCFDITimbre.Nomina.TotalDeduccionesImpuestosRetenidos, 2)) - For Each deduc As CFDINominaDeducciones In ObjCFDITimbre.Nomina.Deducciones - cfdi.Nomina12Deduccion(deduc.TipoDeduccion, deduc.Clave, deduc.Concepto, Math.Round(deduc.Importe, 2)) - Next - End If - If ObjCFDITimbre.Nomina.OtrosPagos IsNot Nothing Then - ' cfdi.agregarNominaOtrosPagosOtroPago12("002", "002", "Subsidio", "10.00"); - ' cfdi.agregarNominaOtrosPagosOtroPagoSubsidioAlEmpleo12("10.00"); - If ObjCFDITimbre.Nomina.OtrosPagos IsNot Nothing AndAlso ObjCFDITimbre.Nomina.OtrosPagos.Count > 0 Then - For Each otpag As CFDINominaOtrosPagos In ObjCFDITimbre.Nomina.OtrosPagos - cfdi.Nomina12OtroPago(otpag.TipoOtroPago, otpag.Clave, otpag.Concepto, otpag.Importe) - If otpag.TipoOtroPago = "002" Then - cfdi.Nomina12SubsidioAlEmpleo(otpag.Subsidiocausado) - End If - - If otpag.TipoOtroPago = "004" AndAlso otpag.Importe > 0 Then - If otpag.ejercicio > 0 Then - cfdi.CompensacionSaldosAFavor(otpag.SaldoAFavor, otpag.ejercicio, otpag.RemanenteSalFav) 'otpag.SaldoAFavor + If ObjCFDITimbre.Nomina.HorasExtras IsNot Nothing AndAlso ObjCFDITimbre.Nomina.HorasExtras.Count > 0 Then + For Each HoraExtra As CFDINominaHorasExtras In ObjCFDITimbre.Nomina.HorasExtras + cfdi.Nomina12HorasExtra(HoraExtra.Dias.ToEntero, HoraExtra.TipoHoras, HoraExtra.HorasExtra, HoraExtra.ImportePagado) + Next End If End If + Next + End If + If ObjCFDITimbre.IStimbreFiniquito Then + 'ObjCFDITimbre.Nomina. + Dim UltimoSueldoOrdinario As Double = ObjCFDITimbre.Nomina.UltimoSueldoOrdinario.ToString().ToDouble() + Dim TotalIndemnizacion As Double = ObjCFDITimbre.Nomina.TotalIndemnizacion + Dim t1 As Double = If(UltimoSueldoOrdinario < TotalIndemnizacion, UltimoSueldoOrdinario, TotalIndemnizacion) + Dim t2 As Double = If(UltimoSueldoOrdinario < TotalIndemnizacion, TotalIndemnizacion, UltimoSueldoOrdinario) + cfdi.Nomina12SeparacionIndemnizacion(TotalIndemnizacion, ObjCFDITimbre.Nomina.Antiguedad, UltimoSueldoOrdinario, t1, t2 - t1) + + End If + 'deducciones al final + If ObjCFDITimbre.Nomina.Deducciones IsNot Nothing AndAlso ObjCFDITimbre.Nomina.Deducciones.Count > 0 Then + cfdi.Nomina12Deducciones(ObjCFDITimbre.Nomina.TotalDeduccionesOtras, Math.Round(ObjCFDITimbre.Nomina.TotalDeduccionesImpuestosRetenidos, 2)) + For Each deduc As CFDINominaDeducciones In ObjCFDITimbre.Nomina.Deducciones + cfdi.Nomina12Deduccion(deduc.TipoDeduccion, deduc.Clave, deduc.Concepto, Math.Round(deduc.Importe, 2)) + Next + End If + If ObjCFDITimbre.Nomina.OtrosPagos IsNot Nothing Then + ' cfdi.agregarNominaOtrosPagosOtroPago12("002", "002", "Subsidio", "10.00"); + ' cfdi.agregarNominaOtrosPagosOtroPagoSubsidioAlEmpleo12("10.00"); + If ObjCFDITimbre.Nomina.OtrosPagos IsNot Nothing AndAlso ObjCFDITimbre.Nomina.OtrosPagos.Count > 0 Then + For Each otpag As CFDINominaOtrosPagos In ObjCFDITimbre.Nomina.OtrosPagos + cfdi.Nomina12OtroPago(otpag.TipoOtroPago, otpag.Clave, otpag.Concepto, otpag.Importe) + If otpag.TipoOtroPago = "002" Then + cfdi.Nomina12SubsidioAlEmpleo(otpag.Subsidiocausado) + End If + + If otpag.TipoOtroPago = "004" AndAlso otpag.Importe > 0 Then + If otpag.ejercicio > 0 Then + cfdi.CompensacionSaldosAFavor(otpag.SaldoAFavor, otpag.ejercicio, otpag.RemanenteSalFav) 'otpag.SaldoAFavor + End If + End If + + Next + End If + End If + If ObjCFDITimbre.Nomina.Incapacidades IsNot Nothing AndAlso ObjCFDITimbre.Nomina.Incapacidades.Count > 0 Then + For Each Incap As CFDINominaIncapacidades In ObjCFDITimbre.Nomina.Incapacidades + cfdi.Nomina12Incapacidad(Incap.DiasIncapacidad.ToEntero, Incap.TipoIncapacidad, Incap.Importe) Next End If End If - If ObjCFDITimbre.Nomina.Incapacidades IsNot Nothing AndAlso ObjCFDITimbre.Nomina.Incapacidades.Count > 0 Then - For Each Incap As CFDINominaIncapacidades In ObjCFDITimbre.Nomina.Incapacidades - cfdi.Nomina12Incapacidad(Incap.DiasIncapacidad.ToEntero, Incap.TipoIncapacidad, Incap.Importe) - Next - End If - End If #End Region - sw.Stop() + sw.Stop() swTiempo.AppendFormat("Armado: ({0}) {1} ", sw.ElapsedMilliseconds - swmili, sw.ElapsedMilliseconds) swmili = sw.ElapsedMilliseconds sw.Start() @@ -2127,7 +2136,7 @@ Public Class Timbrado Using ObjVentas As New ClsVentas() - If ObjVentas.UpdateEstatusFactura(3, FolioFiscal, "", ObjCFDITimbre.Comprobante.Fecha, Ventas.CveVenta, CvePAC:=CvePACEspecial, RFCReceptor:=ObjCFDITimbre.Receptor.RFC) Then + If ObjVentas.UpdateEstatusFactura(3, FolioFiscal, "", ObjCFDITimbre.Comprobante.Fecha, Ventas.CveVenta, CvePAC:=CvePACEspecial) Then Retorno = "" Else Retorno = "Error" @@ -2150,7 +2159,7 @@ Public Class Timbrado If ObjCFDITimbre.Comprobante.TipoComprobante = "N" Then Using ObjNomina2 As New ClsNominas() - If ObjNomina2.UpdateEstatusNomNominas(3, CvePACEspecial, FolioFiscal, "", ("01/01/2000").ToDate, ObjCFDITimbre.Nomina.CveNomina, 0, 0, 0, 0, 0) Then + If ObjNomina2.UpdateEstatusNomNominas(3, CvePACEspecial, FolioFiscal, "", ("01/01/2000").ToDate, ObjCFDITimbre.Nomina.CveNomina, 0, 0, 0, 0, 0, isFiniquito:=Ventas.Timbre.IStimbreFiniquito) Then Retorno = "" Else Retorno = "Error" @@ -3820,7 +3829,7 @@ Public Class Timbrado Dim ObjVentas As New ClsVentas() - If ObjVentas.UpdateEstatusFactura(3, FolioFiscal, "", Now, Ventas.CveVenta, CvePAC:=UsuarioActual.Empresa.CvePAC, RFCReceptor:=ObjCFDITimbre.Receptor.RFC) Then + If ObjVentas.UpdateEstatusFactura(3, FolioFiscal, "", Now, Ventas.CveVenta, CvePAC:=UsuarioActual.Empresa.CvePAC) Then Retorno = "" Else Retorno = "Error" diff --git a/Contabilidad/RegPrePoliza.aspx b/Contabilidad/RegPrePoliza.aspx index 5f72a908d..1d6823ab4 100644 --- a/Contabilidad/RegPrePoliza.aspx +++ b/Contabilidad/RegPrePoliza.aspx @@ -80,9 +80,6 @@
  • Cargar Comprobante
  • -
  • - Imprimir Poliza -
  • @@ -410,7 +407,7 @@
    - + Movimiento diff --git a/Contabilidad/RegPrePoliza.aspx.vb b/Contabilidad/RegPrePoliza.aspx.vb index b18750878..259ae97cc 100644 --- a/Contabilidad/RegPrePoliza.aspx.vb +++ b/Contabilidad/RegPrePoliza.aspx.vb @@ -56,14 +56,14 @@ Partial Class ContabilidadC_RegPrePoliza End Property Private ReadOnly Property CvePrePoliza As Integer Get - Return ViewState("CvePrePoliza").ToString.ToEntero + Return ViewState("CvePrePoliza").ToString().ToEntero() End Get End Property 'PARA CREAR IE Private Property CveConcepto As Integer Get - Return ViewState("CveConcepto").ToString.ToEntero + Return ViewState("CveConcepto").ToString().ToEntero() End Get Set(value As Integer) ViewState("CveConcepto") = value @@ -71,7 +71,7 @@ Partial Class ContabilidadC_RegPrePoliza End Property Private Property CveTipoTransaccion As Integer Get - Return ViewState("CveTipoTransaccion").ToString.ToEntero + Return ViewState("CveTipoTransaccion").ToString().ToEntero() End Get Set(value As Integer) ViewState("CveTipoTransaccion") = value @@ -79,7 +79,7 @@ Partial Class ContabilidadC_RegPrePoliza End Property Private Property CveCuenta As Integer Get - Return ViewState("CveCuenta").ToString.ToEntero + Return ViewState("CveCuenta").ToString().ToEntero() End Get Set(value As Integer) ViewState("CveCuenta") = value @@ -87,7 +87,7 @@ Partial Class ContabilidadC_RegPrePoliza End Property Private Property Folio As String Get - Return ViewState("Folio").ToString + Return ViewState("Folio").ToString() End Get Set(value As String) ViewState("Folio") = value @@ -95,7 +95,7 @@ Partial Class ContabilidadC_RegPrePoliza End Property Private Property ImporteDocumento As Decimal Get - Return ViewState("ImporteDocumento").ToString.ToDecimal + Return ViewState("ImporteDocumento").ToString().ToDecimal() End Get Set(value As Decimal) ViewState("ImporteDocumento") = value @@ -103,7 +103,7 @@ Partial Class ContabilidadC_RegPrePoliza End Property Private Property Observaciones As String Get - Return ViewState("Observaciones").ToString + Return ViewState("Observaciones").ToString() End Get Set(value As String) ViewState("Observaciones") = value @@ -111,7 +111,7 @@ Partial Class ContabilidadC_RegPrePoliza End Property Private Property Beneficiario As String Get - Return ViewState("Beneficiario").ToString + Return ViewState("Beneficiario").ToString() End Get Set(value As String) ViewState("Beneficiario") = value @@ -119,7 +119,7 @@ Partial Class ContabilidadC_RegPrePoliza End Property Private Property RowIndex As Integer Get - Return ViewState("RowIndex").ToString.ToEntero + Return ViewState("RowIndex").ToString().ToEntero() End Get Set(value As Integer) ViewState("RowIndex") = value @@ -127,7 +127,7 @@ Partial Class ContabilidadC_RegPrePoliza End Property Private Property Actualizar As Boolean Get - Return CBool(ViewState("Actualizar").ToString) + Return CBool(ViewState("Actualizar").ToString()) End Get Set(value As Boolean) ViewState("Actualizar") = value @@ -202,6 +202,7 @@ Partial Class ContabilidadC_RegPrePoliza Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load If Not Page.IsPostBack Then + Tick = DateTime.Now.Ticks.ToString() If UsuarioActual.Empresa.TipoContabilizacion = 1 OrElse UsuarioActual.Empresa.TipoContabilidad = 1 Then Response.Redirect(Request.Url.PathAndQuery.Replace("RegPrePoliza", "RegPrePolizaS")) @@ -234,32 +235,30 @@ Partial Class ContabilidadC_RegPrePoliza End If - If IfNull(Request("Tipo"), "").ToString = "NOMPROV" Then + If IfNull(Request("Tipo"), "").ToString() = "NOMPROV" Then DivTipoGasto.Visible = True ThTipoGasto.Visible = True CargaTiposGasto() End If - If Request("CvePrePoliza") IsNot Nothing AndAlso IsNumeric(Request("CvePrePoliza")) AndAlso Request("CvePrePoliza").ToEntero > 0 Then - ViewState("CvePrePoliza") = Request("CvePrePoliza").ToEntero + If Request("CvePrePoliza") IsNot Nothing AndAlso IsNumeric(Request("CvePrePoliza")) AndAlso Request("CvePrePoliza").ToEntero() > 0 Then + ViewState("CvePrePoliza") = Request("CvePrePoliza").ToEntero() CreaDT() CargaPrePoliza() CargaGvBitacora() - If IfNull(Request("Tipo"), "").ToString <> "NOMPROV" Then + If IfNull(Request("Tipo"), "").ToString() <> "NOMPROV" Then GvPrePoliza.Columns(4).Visible = False GvConcepto.Columns(4).Visible = False GvMov.Columns(5).Visible = False End If - LnkExcel.Visible = False - LnkImprimirPoliza.Visible = True - If IfNull(Request("Conta"), "").ToString = "1" Then + If IfNull(Request("Conta"), "").ToString() = "1" Then Contabilizar() End If Exit Sub + LnkExcel.Visible = False Else LnkExcel.Visible = True - LnkImprimirPoliza.Visible = False CreaDT() BtnEliminar.Visible = False @@ -272,7 +271,7 @@ Partial Class ContabilidadC_RegPrePoliza TipoPlantilla = 0 - If IfNull(Request("Tipo"), "").ToString = "Ing" Then + If IfNull(Request("Tipo"), "").ToString() = "Ing" Then TipoPlantilla = 1 LblEncabezado.Text = "Otros Ingresos" End If @@ -290,11 +289,11 @@ Partial Class ContabilidadC_RegPrePoliza CargaCuentas() - If Request("CvePeriodo") IsNot Nothing AndAlso IsNumeric(Request("CvePeriodo")) AndAlso Request("CvePeriodo").ToEntero > 0 Then - ViewState("CvePeriodo") = Request("CvePeriodo").ToEntero - ViewState("CveProyecto") = Request("CveProyecto").ToEntero - ViewState("CveSubProyecto") = Request("CveSubProyecto").ToEntero - ViewState("CveTurno") = Request("CveTurno").ToEntero + If Request("CvePeriodo") IsNot Nothing AndAlso IsNumeric(Request("CvePeriodo")) AndAlso Request("CvePeriodo").ToEntero() > 0 Then + ViewState("CvePeriodo") = Request("CvePeriodo").ToEntero() + ViewState("CveProyecto") = Request("CveProyecto").ToEntero() + ViewState("CveSubProyecto") = Request("CveSubProyecto").ToEntero() + ViewState("CveTurno") = Request("CveTurno").ToEntero() 'DdlPlantilla.Items.Add(New ListItem("Pago Nomina", "61")) 'DdlPlantilla.SelectedValue = "61" @@ -308,7 +307,7 @@ Partial Class ContabilidadC_RegPrePoliza RegistraScript("$(document).ready(function () { comparar(); Sys.Application.add_load(function (s, e) { comparar(); }); } );", 3) End If - If IfNull(Request("Tipo"), "").ToString <> "NOMPROV" Then + If IfNull(Request("Tipo"), "").ToString() <> "NOMPROV" Then GvPrePoliza.Columns(3).Visible = False GvConcepto.Columns(3).Visible = False GvMov.Columns(4).Visible = False @@ -362,7 +361,7 @@ Partial Class ContabilidadC_RegPrePoliza End Sub Private Sub CargaNomina() - Dim CvePlantilla As Integer = DdlPlantilla.SelectedValue.ToEntero + Dim CvePlantilla As Integer = DdlPlantilla.SelectedValue.ToEntero() Dim ObjNomina As New ClsNominas Dim ObjConta As New ClsContabilidad @@ -384,18 +383,18 @@ Partial Class ContabilidadC_RegPrePoliza For Each drt As DataRow In Dt.Rows Dim dr As DataRow = DtMovimientos.NewRow - If drt("NombreCompleto").ToString = "" AndAlso ObjConta.GetRetCuenta(31, UsuarioActual.CveEmpresa) Then + If drt("NombreCompleto").ToString() = "" AndAlso ObjConta.GetRetCuenta(31, UsuarioActual.CveEmpresa) Then CveConcepto = 98 Cuenta = "Nominas por Pagar" - IdCuenta = ObjConta.DtResultados(0)("IdCtaContable").ToString.ToEntero + IdCuenta = ObjConta.DtResultados(0)("IdCtaContable").ToString().ToEntero() Concepto = "Pago Nomina" Referencia = "Pago Nomina" Else Concepto = drt("NombreCompleto") Referencia = "" - CveConcepto = drt("CveConceptoContable").ToString.ToEntero - Cuenta = drt("ConceptoContable").ToString - IdCuenta = drt("IdCtaContable").ToString.ToEntero + CveConcepto = drt("CveConceptoContable").ToString().ToEntero() + Cuenta = drt("ConceptoContable").ToString() + IdCuenta = drt("IdCtaContable").ToString().ToEntero() End If Dim drr As DataRow = DtCuentasContables.FiltroPrimero($"Id={IdCuenta}") @@ -405,11 +404,11 @@ Partial Class ContabilidadC_RegPrePoliza TipoMovto = drt("TipoMovto") If TipoMovto = 0 Then - dr("Cargo") = Math.Abs(drt("Importe").ToString.ToDecimal) + dr("Cargo") = Math.Abs(drt("Importe").ToString().ToDecimal()) dr("Abono") = 0 Else dr("Cargo") = 0 - dr("Abono") = Math.Abs(drt("Importe").ToString.ToDecimal) + dr("Abono") = Math.Abs(drt("Importe").ToString().ToDecimal()) End If dr("IdCuenta") = IdCuenta @@ -450,7 +449,7 @@ Partial Class ContabilidadC_RegPrePoliza TxtConcepto.Text = dr("Concepto") DivDatosPoliza.Visible = True TipoPoliza = DdlTipoPoliza.SelectedItem.Text - Folio = dr("FolioPoliza").ToString + Folio = dr("FolioPoliza").ToString() If UsuarioActual.CveRol = 1 OrElse UsuarioActual.TienePermisoProceso(221) Then @@ -470,8 +469,8 @@ Partial Class ContabilidadC_RegPrePoliza LnkComplementoPago.Visible = True End If - IdPoliza = dr("IdPoliza").ToString.ToEntero - If dr("IdPoliza").ToString.ToEntero > 0 Then + IdPoliza = dr("IdPoliza").ToString().ToEntero() + If dr("IdPoliza").ToString().ToEntero() > 0 Then HplContabilizada.NavigateUrl = String.Format("RegPoliza.aspx?IdPoliza={0}", dr("IdPoliza")) divContabilziada.Visible = True BtnEliminar.Visible = False @@ -493,7 +492,7 @@ Partial Class ContabilidadC_RegPrePoliza RegistraScript("comparar();") - If Request("Tipo") IsNot Nothing AndAlso IsNumeric(Request("Tipo")) AndAlso Request("Tipo").ToEntero = 1 AndAlso UsuarioActual.CveUsuario <> 100 Then + If Request("Tipo") IsNot Nothing AndAlso IsNumeric(Request("Tipo")) AndAlso Request("Tipo").ToEntero() = 1 AndAlso UsuarioActual.CveUsuario <> 100 Then For Each row As GridViewRow In GvPrePoliza.Rows row.FCTextBox("TxtCargo").Enabled = False row.FCTextBox("TxtAbono").Enabled = False @@ -519,13 +518,13 @@ Partial Class ContabilidadC_RegPrePoliza 'Asignamos los Subproyectos e.Row.FCDropDownList("DdlSubProyecto").DataSource = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa) e.Row.FCDropDownList("DdlSubProyecto").DataBind() - e.Row.FCDropDownList("DdlSubProyecto").Items.Insert(0, New ListItem(" - ", "-1")) + 'e.Row.FCDropDownList("DdlSubProyecto").Items.Insert(0, New ListItem(" - ", "-1")) e.Row.FCDropDownList("DdlSubProyecto").SelectedValueExist(e.Row.DataKey("CveSubProyecto")) 'Asignamos los Tipos de Gasto e.Row.FCDropDownList("DdlTipoGasto").DataSource = GlobalDTTiposGastos(UsuarioActual.CveEmpresa) e.Row.FCDropDownList("DdlTipoGasto").DataBind() - e.Row.FCDropDownList("DdlTipoGasto").Items.Insert(0, New ListItem("Sin Asignar", "-1")) + 'e.Row.FCDropDownList("DdlTipoGasto").Items.Insert(0, New ListItem("Sin Asignar", "-1")) e.Row.FCDropDownList("DdlTipoGasto").SelectedValueExist(e.Row.DataKey("CveTipoGasto")) 'ASignamos las CuentasContables @@ -534,10 +533,10 @@ Partial Class ContabilidadC_RegPrePoliza 'e.Row.FCDropDownList("DdlCtaContable").Items.Insert(0, New ListItem("Sin Asignar", "0")) e.Row.FCDropDownList("DdlCtaContable").SelectedValueExist(e.Row.DataKey("IdCtaContable")) - TxtTotalCargos.Text = (TxtTotalCargos.Text.ToDouble + e.Row.FCTextBox("TxtCargo").Text.ToDouble).ToString.FormatoNumero - TxtTotalAbonos.Text = (TxtTotalAbonos.Text.ToDouble + e.Row.FCTextBox("TxtAbono").Text.ToDouble).ToString.FormatoNumero + TxtTotalCargos.Text = (TxtTotalCargos.Text.ToDouble + e.Row.FCTextBox("TxtCargo").Text.ToDouble).ToString().FormatoNumero + TxtTotalAbonos.Text = (TxtTotalAbonos.Text.ToDouble + e.Row.FCTextBox("TxtAbono").Text.ToDouble).ToString().FormatoNumero - Dim CveConceptoContable As Integer = e.Row.DataKey("CveConceptoContable").ToEntero + Dim CveConceptoContable As Integer = e.Row.DataKey("CveConceptoContable").ToEntero() If CveConceptoContable.Contiene(1, 2, 12, 13, 38, 207, 203, 39, 61, 62, 63, 150, 251, 226) Then e.Row.FCHyperLink("HlReferencia").NavigateUrl = String.Format("/Ventas/Ventas.aspx?CveVenta={0}", e.Row.DataKey("CveVenta")) If CveConceptoContable.Contiene(5, 6, 17, 18, 14, 19, 25, 26, 60, 205, 225, 234, 235, 240) Then e.Row.FCHyperLink("HlReferencia").NavigateUrl = String.Format("/Compras/Compras.aspx?CveCompra={0}", e.Row.DataKey("CveCompra")) @@ -548,7 +547,7 @@ Partial Class ContabilidadC_RegPrePoliza If CveConceptoContable.Contiene(30) Then LnkImprimirPDF.Visible = True LnkComprobante.Visible = True - CveIE = e.Row.DBCampo("CveIE").ToString.ToEntero + CveIE = e.Row.DBCampo("CveIE").ToString().ToEntero() End If 'e.Row.FCHyperLink("HlReferencia").NavigateUrl = CveConceptoContable @@ -592,7 +591,7 @@ Partial Class ContabilidadC_RegPrePoliza End Sub Private Sub DdlConceptosContables_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlConceptosContables.SelectedIndexChanged - If DdlConceptosContables.SelectedValue.ToEntero.Contiene(5, 17, 201, 205, 206, 14, 15, 16, 19, 25, 26, 21, 18, 60) Then + If DdlConceptosContables.SelectedValue.ToEntero().Contiene(5, 17, 201, 205, 206, 14, 15, 16, 19, 25, 26, 21, 18, 60) Then CargaProveedores() DdlProveedores.Visible = True DdlCompras.Visible = True @@ -601,13 +600,13 @@ Partial Class ContabilidadC_RegPrePoliza DdlCompras.Visible = False End If - If DdlConceptosContables.SelectedValue.ToEntero.Contiene(28, 29) Then + If DdlConceptosContables.SelectedValue.ToEntero().Contiene(28, 29) Then CargaPersonal() DdlPersonal.Visible = True Else DdlPersonal.Visible = False End If - If DdlConceptosContables.SelectedValue.ToEntero.Contiene(1, 2, 203, 207, 13, 61, 8, 9, 62, 63, 38, 39, 12, 91) Then + If DdlConceptosContables.SelectedValue.ToEntero().Contiene(1, 2, 203, 207, 13, 61, 8, 9, 62, 63, 38, 39, 12, 91) Then CargaClientes() DdlClientes.Visible = True DdlVentas.Visible = True @@ -616,14 +615,14 @@ Partial Class ContabilidadC_RegPrePoliza DdlVentas.Visible = False End If - If DdlConceptosContables.SelectedValue.ToEntero.Contiene(51) Then + If DdlConceptosContables.SelectedValue.ToEntero().Contiene(51) Then CargaClasificacionesE() DdlClasificacionesE.Visible = True Else DdlClasificacionesE.Visible = False End If - If DdlConceptosContables.SelectedValue.ToEntero.Contiene(201, 202, 203, 204, 206, 207, 226, 227, 229, 233, 234, 235, 239, 242, 256, 266) Then + If DdlConceptosContables.SelectedValue.ToEntero().Contiene(201, 202, 203, 204, 206, 207, 226, 227, 229, 233, 234, 235, 239, 242, 256, 266) Then TxtTC.Text = "2" TxtTC.Visible = True Else @@ -631,7 +630,7 @@ Partial Class ContabilidadC_RegPrePoliza TxtTC.Visible = False End If - If DdlConceptosContables.SelectedValue.ToEntero.Contiene(69) Then + If DdlConceptosContables.SelectedValue.ToEntero().Contiene(69) Then CargaClasificaciones() DdlClasificaciones.Visible = True Else @@ -644,19 +643,19 @@ Partial Class ContabilidadC_RegPrePoliza End Sub Private Sub DdlProveedores_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlProveedores.SelectedIndexChanged - If DdlConceptosContables.SelectedValue.ToEntero.Contiene(18, 60) Then - CargaNotasCreditoCompras(DdlProveedores.SelectedValue.ToEntero, DdlCompras) + If DdlConceptosContables.SelectedValue.ToEntero().Contiene(18, 60) Then + CargaNotasCreditoCompras(DdlProveedores.SelectedValue.ToEntero(), DdlCompras) Else - CargaCompras(DdlProveedores.SelectedValue.ToEntero) + CargaCompras(DdlProveedores.SelectedValue.ToEntero()) End If End Sub Private Sub DdlClientes_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlClientes.selectedindexchange - If DdlConceptosContables.SelectedValue.ToEntero.Contiene(12, 91) Then - CargaVentas(DdlClientes.SelectedValue.ToEntero) + If DdlConceptosContables.SelectedValue.ToEntero().Contiene(12, 91) Then + CargaVentas(DdlClientes.SelectedValue.ToEntero()) Else - CargaVentas(DdlClientes.SelectedValue.ToEntero) + CargaVentas(DdlClientes.SelectedValue.ToEntero()) End If End Sub @@ -689,7 +688,7 @@ Partial Class ContabilidadC_RegPrePoliza End Sub Private Sub CargaCompras(CveProveedor As Integer) - If Not DdlConceptosContables.SelectedValue.ToEntero.Contiene(21) Then + If Not DdlConceptosContables.SelectedValue.ToEntero().Contiene(21) Then Dim ObjCompras As New ClsCompras DdlCompras.ClearSelection() @@ -707,7 +706,7 @@ Partial Class ContabilidadC_RegPrePoliza End Sub Private Sub CargaNotasCreditoCompras(CveProveedor As Integer, ddl As DropDownList) - If DdlConceptosContables.SelectedValue.ToEntero.Contiene(18, 60) Then + If DdlConceptosContables.SelectedValue.ToEntero().Contiene(18, 60) Then Dim ObjCompras As New ClsCompras ddl.ClearSelection() @@ -786,13 +785,13 @@ Partial Class ContabilidadC_RegPrePoliza TxtTotalAbonos.Text = "" TxtTotalCargos.Text = "" - If DdlPlantilla.SelectedValue.ToEntero <= 0 Then + If DdlPlantilla.SelectedValue.ToEntero() <= 0 Then Alert("Seleccione un Movimiento Válido", TipoMensaje.MsgAdvertencia) DdlPlantilla.SelectedValue = "-1" Exit Sub End If - If DdlPlantilla.SelectedValue.ToEntero = 53 Then 'Plantilla Personalizada + If DdlPlantilla.SelectedValue.ToEntero() = 53 Then 'Plantilla Personalizada DivAgregarConceptos.Visible = True Else DivAgregarConceptos.Visible = False @@ -800,7 +799,7 @@ Partial Class ContabilidadC_RegPrePoliza - Dim CvePlantilla As Integer = DdlPlantilla.SelectedValue.ToEntero + Dim CvePlantilla As Integer = DdlPlantilla.SelectedValue.ToEntero() Dim Dt As DataTable = GlobalDTContaPlantillasPolizasDetalle(CvePlantilla).FiltraParametros(String.Format("CveEmpresa={0}", UsuarioActual.CveEmpresa), "Orden") Dim Cuenta As String = "" @@ -812,23 +811,23 @@ Partial Class ContabilidadC_RegPrePoliza For Each drt As DataRow In Dt.Rows - Cuenta = drt("ConceptoContable").ToString + Cuenta = drt("ConceptoContable").ToString() IdCuenta = 0 CodigoCuenta = "" NombreCuenta = "" - If drt("IdCtaContable").ToString.ToEntero > 0 Then 'DtCuentasContables - Dim drr As DataRow = DtCuentasContables.FiltroPrimero(String.Format("Id={0}", drt("IdCtaContable").ToString)) + If drt("IdCtaContable").ToString().ToEntero() > 0 Then 'DtCuentasContables + Dim drr As DataRow = DtCuentasContables.FiltroPrimero(String.Format("Id={0}", drt("IdCtaContable").ToString())) If drr IsNot Nothing Then - IdCuenta = drt("IdCtaContable").ToString.ToEntero + IdCuenta = drt("IdCtaContable").ToString().ToEntero() CodigoCuenta = drr("CuentaFormato").ToString() NombreCuenta = drr("Nombre").ToString() - 'Cuenta = drr("Nombre").ToString() + 'Cuenta = drr("Nombre").Tostring() NombreCuenta = CodigoCuenta & "
    " & NombreCuenta End If EsComodin = 0 End If - If drt("CveCuenta").ToString.ToEntero > 0 Then + If drt("CveCuenta").ToString().ToEntero() > 0 Then NombreCuenta = String.Format("{0}
    {1}", drt("Codigo"), drt("Nombre")) End If @@ -836,9 +835,9 @@ Partial Class ContabilidadC_RegPrePoliza dr("IdCuenta") = IdCuenta dr("CodigoCuenta") = NombreCuenta dr("Cuenta") = Cuenta 'TxtCuentaContable.Text - dr("Referencia") = If(drt("CveConcepto").ToString.Contiene("29", "130"), drt("Personal"), drt("RazonSocial")) + dr("Referencia") = If(drt("CveConcepto").ToString().Contiene("29", "130"), drt("Personal"), drt("RazonSocial")) dr("Concepto") = TxtObservaciones.Text - dr("TipoMovto") = If(drt("TipoMovto").ToString = "False", 0, 1) + dr("TipoMovto") = If(drt("TipoMovto").ToString() = "False", 0, 1) dr("EsComodin") = EsComodin dr("CveConcepto") = drt("CveConcepto") dr("CveSubProyecto") = drt("CveSubProyectoNegativo") @@ -850,10 +849,7 @@ Partial Class ContabilidadC_RegPrePoliza dr("MultipleSubProyecto") = drt("MultipleSubProyecto") dr("PorcentajeImpuesto") = drt("PorcentajeImpuesto") dr("CveCuenta") = drt("CveCuenta") - If CvePrePoliza > 0 Then - dr("FolioPoliza") = drt("FolioPoliza") - End If - + dr("FolioPoliza") = drt("FolioPoliza") DtMovimientos.Rows.Add(dr) @@ -900,7 +896,7 @@ Partial Class ContabilidadC_RegPrePoliza e.Row.FCDropDownList("DdlTipoGasto").Items.Insert(0, New ListItem("Sin Asignar", "-1")) e.Row.FCDropDownList("DdlTipoGasto").SelectedValue = e.Row.DBCampo("CveTipoGasto") - If DdlPlantilla.SelectedValue.ToEntero = 53 Then 'Plantilla Personalizada + If DdlPlantilla.SelectedValue.ToEntero() = 53 Then 'Plantilla Personalizada e.Row.FCDropDownList("DdlSubProyecto").Enabled = True e.Row.FCImageButton("imgD").Visible = True Else @@ -912,17 +908,17 @@ Partial Class ContabilidadC_RegPrePoliza End If 'Agregamos la opcion para vincular los movimientos bancarios - If e.Row.DataKey("CveConcepto").ToEntero.Contiene(41) Then + If e.Row.DataKey("CveConcepto").ToEntero().Contiene(41) Then Dim ObjMovimientos As New ClsMovimientos Dim DdlSaldos As DropDownList = e.Row.FCDropDownList("DdlSaldos") - Select Case e.Row.DataKey("CveConcepto").ToEntero + Select Case e.Row.DataKey("CveConcepto").ToEntero() 'Acreedores Case 41 If (ObjMovimientos.GetAcreedoresSaldosDetalles(-1, CveMoneda, UsuarioActual.CveEmpresa)) Then DdlSaldos.Visible = True - DdlSaldos.DataSource = ObjMovimientos.DtResultados.FiltraParametros($"CveIE > 0 AND CveProveedor = {e.Row.DataKey("CveProveedor").ToEntero}") + DdlSaldos.DataSource = ObjMovimientos.DtResultados.FiltraParametros($"CveIE > 0 AND CveProveedor = {e.Row.DataKey("CveProveedor").ToEntero()}") DdlSaldos.DataBind() DdlSaldos.Items.Insert(0, New ListItem("Seleccione", "-1")) End If @@ -932,7 +928,7 @@ Partial Class ContabilidadC_RegPrePoliza ObjMovimientos.Dispose() End If - If e.Row.DataKey("CveConcepto").ToEntero.Contiene(30) Then + If e.Row.DataKey("CveConcepto").ToEntero().Contiene(30) Then e.Row.FCLinkButton("ImgBancos").Visible = True If CveTipoTransaccion > 0 And CveCuenta > 0 And Folio.Length > 0 And ImporteDocumento > 0 And Beneficiario.Length > 0 Then @@ -940,7 +936,7 @@ Partial Class ContabilidadC_RegPrePoliza End If End If - If e.Row.DataKey("CveConcepto").ToEntero.Contiene(17) Then + If e.Row.DataKey("CveConcepto").ToEntero().Contiene(17) Then e.Row.FCDropDownList("DdlProveedores").Visible = True e.Row.FCDropDownList("DdlProveedores").DataSource = GlobalDTCompProveedores(UsuarioActual.CveEmpresa) e.Row.FCDropDownList("DdlProveedores").DataBind() @@ -958,12 +954,12 @@ Partial Class ContabilidadC_RegPrePoliza Dim TotalCargos, TotalAbonos As Decimal If CvePrePoliza > 0 Then - TotalCargos = TxtTotalCargos.Text.ToDecimal - TotalAbonos = TxtTotalAbonos.Text.ToDecimal + TotalCargos = TxtTotalCargos.Text.ToDecimal() + TotalAbonos = TxtTotalAbonos.Text.ToDecimal() Else For Each Gvr As GridViewRow In GvMov.Rows - TotalCargos += Gvr.FCTextBox("TxtCargo").Text.ToDecimal - TotalAbonos += Gvr.FCTextBox("TxtAbono").Text.ToDecimal + TotalCargos += Gvr.FCTextBox("TxtCargo").Text.ToDecimal() + TotalAbonos += Gvr.FCTextBox("TxtAbono").Text.ToDecimal() Next End If @@ -994,7 +990,7 @@ Partial Class ContabilidadC_RegPrePoliza Try Dim CvePrePoliza As Integer Dim ConceptoPoliza As String = TxtObservaciones.Text - CvePrePoliza = ObjMov.AddPrePolizas("Contabilidad/RegPrePoliza", DdlPlantilla.SelectedValue.ToEntero, TotalCargos, TotalAbonos, 1, TxtFecha.Text.ToDate, ConceptoPoliza, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoPoliza:=DdlTipoPolizaAdd.SelectedValue.ToEntero) + CvePrePoliza = ObjMov.AddPrePolizas("Contabilidad/RegPrePoliza", DdlPlantilla.SelectedValue.ToEntero(), TotalCargos, TotalAbonos, 1, TxtFecha.Text.ToDate(), ConceptoPoliza, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoPoliza:=DdlTipoPolizaAdd.SelectedValue.ToEntero()) If CvePrePoliza > 0 Then Dim alertaContabilizacion As String = "Se enviaron correctamente las siguientes pólizas:

    " @@ -1013,12 +1009,12 @@ Partial Class ContabilidadC_RegPrePoliza 'inserto las compras que voy a pagarDdlSaldos For Each gvr As GridViewRow In GvMov.Rows - If gvr.DataKey("IDCuenta").ToEntero > 0 Then + If gvr.DataKey("IDCuenta").ToEntero() > 0 Then IdCtaContable = gvr.DataKey("IDCuenta") End If - CveProveedor = gvr.DataKey("CveProveedor").ToEntero - CveCompra = gvr.DataKey("CveCompra").ToEntero - CveConcepto = gvr.DataKey("CveConcepto").ToEntero + CveProveedor = gvr.DataKey("CveProveedor").ToEntero() + CveCompra = gvr.DataKey("CveCompra").ToEntero() + CveConcepto = gvr.DataKey("CveConcepto").ToEntero() If gvr.DataKey("TipoMovto").ToDouble <> 0 Then Importe = gvr.FCTextBox("TxtAbono").Text.ToDouble @@ -1029,12 +1025,12 @@ Partial Class ContabilidadC_RegPrePoliza End If 'Registra pago de compra If CveConcepto = 17 Then - CveProveedor = gvr.FCDropDownList("DdlProveedores").SelectedValue.ToEntero - CveCompra = gvr.FCDropDownList("DdlCompras").SelectedValue.ToEntero + CveProveedor = gvr.FCDropDownList("DdlProveedores").SelectedValue.ToEntero() + CveCompra = gvr.FCDropDownList("DdlCompras").SelectedValue.ToEntero() End If If CveConcepto = 41 Then - CveIE = gvr.FCDropDownList("DdlSaldos").SelectedValue.ToEntero + CveIE = gvr.FCDropDownList("DdlSaldos").SelectedValue.ToEntero() Else If CveConcepto = 30 AndAlso Importe <> 0 Then 'Registra movimieno bancario @@ -1060,14 +1056,14 @@ Partial Class ContabilidadC_RegPrePoliza End If If Importe <> 0 Then - If ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovto, Importe, gvr.FCLiteral("LtlReferencia").Text, gvr.DataKey("CveConcepto").ToEntero, gvr.FCTextBox("TxtConcepto").Text, - TxtFecha.Text.ToDate, IdCtaContable, -1, CveSubProyecto:=gvr.FCDropDownList("DdlSubProyecto").SelectedValue.ToEntero, CveIE:=CveIE, + If ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovto, Importe, gvr.FCLiteral("LtlReferencia").Text, gvr.DataKey("CveConcepto").ToEntero(), gvr.FCTextBox("TxtConcepto").Text, + TxtFecha.Text.ToDate(), IdCtaContable, -1, CveSubProyecto:=gvr.FCDropDownList("DdlSubProyecto").SelectedValue.ToEntero(), CveIE:=CveIE, CveProveedor:=CveProveedor, CveCompra:=CveCompra, - CvePersonal:=gvr.DataKey("CvePersonal").ToEntero, CveClasificacion:=gvr.DataKey("CveClasificacion").ToEntero, - ImporteMX:=Importe, CveTipoGasto:=gvr.FCDropDownList("DdlTipoGasto").SelectedValue.ToEntero, - CveCliente:=gvr.DataKey("CveCliente").ToEntero, CveVenta:=gvr.DataKey("CveVenta").ToEntero, TipoCambio:=If(gvr.DataKey("TC").ToString.ToDecimal > 0, gvr.DataKey("TC").ToString.ToDecimal, 1), - ImporteME:=If(gvr.DataKey("TC").ToString.ToDecimal > 0, (Importe / (gvr.DataKey("TC").ToString.ToDecimal - 1)).RoundSQL, 0), - PorcentajeImpuesto:=gvr.DataKey("PorcentajeImpuesto").ToDecimal, CveCuenta:=gvr.DataKey("CveCuenta").ToEntero) Then + CvePersonal:=gvr.DataKey("CvePersonal").ToEntero(), CveClasificacion:=gvr.DataKey("CveClasificacion").ToEntero(), + ImporteMX:=Importe, CveTipoGasto:=gvr.FCDropDownList("DdlTipoGasto").SelectedValue.ToEntero(), + CveCliente:=gvr.DataKey("CveCliente").ToEntero(), CveVenta:=gvr.DataKey("CveVenta").ToEntero(), TipoCambio:=If(gvr.DataKey("TC").ToString().ToDecimal() > 0, gvr.DataKey("TC").ToString().ToDecimal(), 1), + ImporteME:=If(gvr.DataKey("TC").ToString().ToDecimal() > 0, (Importe / (gvr.DataKey("TC").ToString().ToDecimal() - 1)).RoundSQL, 0), + PorcentajeImpuesto:=gvr.DataKey("PorcentajeImpuesto").ToDecimal(), CveCuenta:=gvr.DataKey("CveCuenta").ToEntero()) Then Else MsgError = "No se pudo insertar el detalle de la póliza2" Exit For @@ -1097,7 +1093,7 @@ Partial Class ContabilidadC_RegPrePoliza 'MENSAJE PRINCIPAL MensajeAlert.AppendFormat("

    Folio de Póliza: {1}", ObjMov.ContaIdPoliza, ObjMov.ContaFolio) MensajeAlert.AppendFormat("

    Prepóliza: {1}", CvePrePoliza, ObjMov.ContaFolio) - 'Alert(MensajeAlert.ToString, ModExtensiones.TipoMensaje.MsgInformacion) + 'Alert(MensajeAlert.Tostring(), ModExtensiones.TipoMensaje.MsgInformacion) Else Alert("Ocurrio un error al contabilizar, pongase en contacto con Soporte Técnico") End If @@ -1115,9 +1111,9 @@ Partial Class ContabilidadC_RegPrePoliza 'MENSAJE IE If CveIE > 0 Then MensajeAlert.AppendFormat("

    Folio Bancario: {1}", CveIE, FolioIE) - Alert(MensajeAlert.ToString, ModExtensiones.TipoMensaje.MsgInformacion, "window.location.reload()") + Alert(MensajeAlert.ToString(), ModExtensiones.TipoMensaje.MsgInformacion, "window.location.reload()") Else - Alert(If(MensajeAlert.ToString = "", "Se registro con exito.", MensajeAlert.ToString), TipoMensaje.MsgInformacion, "window.location.reload()") + Alert(If(MensajeAlert.ToString() = "", "Se registro con exito.", MensajeAlert.ToString()), TipoMensaje.MsgInformacion, "window.location.reload()") End If ObjIE.Commit() @@ -1150,62 +1146,79 @@ Partial Class ContabilidadC_RegPrePoliza End Sub Private Sub ActualizarPrePoliza() - + Dim contador As Integer = 0 + 'Dim diferencia As String = "" Dim OcurrioError As Boolean = False - Dim ObjContabilidad As New ClsContabilidad - ObjContabilidad.IniciaTransacSQL() + Using ObjContabilidad As New ClsContabilidad + + ObjContabilidad.IniciaTransacSQL() - If Not ObjContabilidad.UpdatePrePolizasDetalleBloquear(CvePrePoliza, False) Then - OcurrioError = True - End If + If Not ObjContabilidad.UpdatePrePolizasDetalleBloquear(CvePrePoliza, False) Then + OcurrioError = True + End If + If ObjContabilidad.UpdatePrePoliza(MinFecha, -1, DdlTipoPoliza.SelectedValue.ToEntero(), -1, CvePrePoliza, UsuarioActual.CveEmpresa, Concepto:=TxtConcepto.Text, FechaPoliza:=TxtFechaDocumento.Text.ToDate(), CveUsuarioModifico:=UsuarioActual.CveUsuario) Then - If ObjContabilidad.UpdatePrePoliza(MinFecha, -1, DdlTipoPoliza.SelectedValue.ToEntero, -1, CvePrePoliza, UsuarioActual.CveEmpresa, Concepto:=TxtConcepto.Text, FechaPoliza:=TxtFechaDocumento.Text.ToDate, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then + For Each row As GridViewRow In GvPrePoliza.Rows + Dim CvePrePolizaDetalle As Integer = row.DataKey("CvePrePolizaDetalle").ToEntero() + Dim Concepto As String = row.FCTextBox("TxtConcepto").Text + Dim CveSubProyecto As Integer = row.FCDropDownList("DdlSubProyecto").SelectedValue.ToEntero() + Dim CtaContable As Integer = row.FCDropDownList("DdlCtaContable").SelectedValue.ToEntero() + Dim TipoMovto As Boolean = If(row.FCTextBox("TxtCargo").Text.ToDecimal() <> 0, False, True) + Dim TipoMovtoOld As Boolean = (row.DataKey("TipoMovto").ToString = "True") + Dim ImporteMN As Decimal = If(row.FCTextBox("TxtCargo").Text.ToDecimal() <> 0, row.FCTextBox("TxtCargo").Text.ToDecimal(), row.FCTextBox("TxtAbono").Text.ToDecimal()) + Dim CveTipoGastonew As Integer = If(DdlTipoGasto.Visible, row.FCDropDownList("DdlTipoGasto").SelectedValue.ToEntero(), row.DataKey("CveTipoGasto").ToEntero()) - - - For Each row As GridViewRow In GvPrePoliza.Rows - If row.DataKey("CvePrePolizaDetalle").ToEntero > 0 Then - If Not ObjContabilidad.UpdatePrepolizasDetalle(row.DataKey("CvePrePolizaDetalle").ToEntero, row.FCTextBox("TxtConcepto").Text, row.FCDropDownList("DdlSubProyecto").SelectedValue.ToEntero, - row.FCDropDownList("DdlCtaContable").SelectedValue.ToEntero, If(row.FCTextBox("TxtCargo").Text.ToDecimal <> 0, False, True), If(row.FCTextBox("TxtCargo").Text.ToDecimal <> 0, - row.FCTextBox("TxtCargo").Text.ToDecimal, row.FCTextBox("TxtAbono").Text.ToDecimal), CveTipoGasto:=If(DdlTipoGasto.Visible, row.FCDropDownList("DdlTipoGasto").SelectedValue.ToEntero, row.DataKey("CveTipoGasto").ToEntero), CveUsuarioModifico:=UsuarioActual.CveUsuario) Then - OcurrioError = True - Exit For + If row.DataKey("CvePrePolizaDetalle").ToEntero() > 0 Then + Dim actualizar As Boolean + actualizar = (Concepto <> row.DataKey("Concepto") OrElse CveSubProyecto <> row.DataKey("CveSubProyecto").ToEntero() OrElse CtaContable <> row.DataKey("IdCtaContable").ToEntero() OrElse + TipoMovto <> TipoMovtoOld OrElse ImporteMN <> row.DataKey("ImporteMN").ToDecimal() OrElse CveTipoGastonew <> row.DataKey("CveTipoGasto").ToEntero()) + 'diferencia = $"{diferencia}\r\n /*{actualizar}*/actualizar = '{Concepto}' <> '{row.DataKey("Concepto")}' || '{CveSubProyecto}' <> '{row.DataKey("CveSubProyecto").ToEntero()}' || '{CtaContable}' <> '{row.DataKey("IdCtaContable").ToEntero()}' ||" + 'diferencia = $"{diferencia} '{TipoMovto}' <> '{TipoMovtoOld}' OrElse '{ImporteMN}' <> '{row.DataKey("ImporteMN").ToEntero()}' OrElse '{CveTipoGastonew}' <> '{row.DataKey("CveTipoGasto").ToEntero()}'" + If actualizar Then + contador = contador + 1 + If Not ObjContabilidad.UpdatePrepolizasDetalle(CvePrePolizaDetalle, Concepto, CveSubProyecto, + CtaContable, TipoMovto, ImporteMN, CveTipoGasto:=CveTipoGastonew, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then + OcurrioError = True + Exit For + End If + End If + Else + contador = contador + 1 + If Not ObjContabilidad.AddPrePolizasDetalle(CvePrePoliza, If(row.FCTextBox("TxtCargo").Text.ToDecimal() <> 0, False, True), If(row.FCTextBox("TxtCargo").Text.ToDecimal() <> 0, + row.FCTextBox("TxtCargo").Text.ToDecimal(), row.FCTextBox("TxtAbono").Text.ToDecimal()), row.DataKey("Referencia").ToString(), + row.DataKey("CveConceptoContable").ToEntero(), row.FCTextBox("TxtConcepto").Text, Now, + row.FCDropDownList("DdlCtaContable").SelectedValue.ToEntero(), 0, CveSubProyecto:=row.FCDropDownList("DdlSubProyecto").SelectedValue.ToEntero(), + CveTipoGasto:=If(DdlTipoGasto.Visible, row.FCDropDownList("DdlTipoGasto").SelectedValue.ToEntero(), row.DataKey("CveTipoGasto").ToEntero()), + ImporteMX:=If(row.FCTextBox("TxtCargo").Text.ToDecimal() <> 0, + row.FCTextBox("TxtCargo").Text.ToDecimal(), row.FCTextBox("TxtAbono").Text.ToDecimal()), CveProveedor:=DdlProveedores.SelectedValue.ToEntero()) Then + OcurrioError = True + Exit For + End If End If - Else - If Not ObjContabilidad.AddPrePolizasDetalle(CvePrePoliza, If(row.FCTextBox("TxtCargo").Text.ToDecimal <> 0, False, True), If(row.FCTextBox("TxtCargo").Text.ToDecimal <> 0, - row.FCTextBox("TxtCargo").Text.ToDecimal, row.FCTextBox("TxtAbono").Text.ToDecimal), row.DataKey("Referencia").ToString, - row.DataKey("CveConceptoContable").ToEntero, row.FCTextBox("TxtConcepto").Text, Now, - row.FCDropDownList("DdlCtaContable").SelectedValue.ToEntero, 0, CveSubProyecto:=row.FCDropDownList("DdlSubProyecto").SelectedValue.ToEntero, - CveTipoGasto:=If(DdlTipoGasto.Visible, row.FCDropDownList("DdlTipoGasto").SelectedValue.ToEntero, row.DataKey("CveTipoGasto").ToEntero), - ImporteMX:=If(row.FCTextBox("TxtCargo").Text.ToDecimal <> 0, - row.FCTextBox("TxtCargo").Text.ToDecimal, row.FCTextBox("TxtAbono").Text.ToDecimal), CveProveedor:=DdlProveedores.SelectedValue.ToEntero) Then - OcurrioError = True - Exit For - End If - End If - Next - Else - OcurrioError = True - End If + Next + Else + OcurrioError = True + End If - If Not OcurrioError Then - ObjContabilidad.Commit() - Alert("La PrePoliza se actualizó correctamente.", TipoMensaje.MsgInformacion) - Else - ObjContabilidad.RollBack() - Alert("Ocurrio un error al actualizar la PrePoliza.", TipoMensaje.MsgError) - End If + If Not OcurrioError Then + ObjContabilidad.Commit() + Alert($"La Prepoliza se actualizó correctamente.
    se actualizaron {contador} registros.", TipoMensaje.MsgInformacion) + Else + ObjContabilidad.RollBack() + Alert($"Ocurrio un error al actualizar la PrePoliza.
    {contador} registros.", TipoMensaje.MsgError) + End If + 'RegistraScript($"console.log(""{diferencia}"")".Replace("'", "\'")) + End Using - ObjContabilidad.Dispose() CargaPrePoliza() If Not OcurrioError Then - If IdPoliza > 0 Then + If IdPoliza > 0 AndAlso contador Then BtnContabilizar_Click(Nothing, Nothing) End If @@ -1229,9 +1242,9 @@ Partial Class ContabilidadC_RegPrePoliza Dim ConceptoContable As String = GvPrePoliza.Rows(IndiceGrid).FCLiteral("LtlConceptoContable").Text Dim FolioFactura As String = GvPrePoliza.Rows(IndiceGrid).FCHyperLink("HlReferencia").Text Dim Concepto As String = GvPrePoliza.Rows(IndiceGrid).FCTextBox("TxtConcepto").Text - Dim CveSubProyecto As Integer = GvPrePoliza.Rows(IndiceGrid).FCDropDownList("DdlSubProyecto").SelectedValue.ToEntero - Dim CveTipoGasto As Integer = GvPrePoliza.Rows(IndiceGrid).FCDropDownList("DdlTipoGasto").SelectedValue.ToEntero - Dim Id As Integer = GvPrePoliza.Rows(IndiceGrid).FCDropDownList("DdlCtaContable").SelectedValue.ToEntero + Dim CveSubProyecto As Integer = GvPrePoliza.Rows(IndiceGrid).FCDropDownList("DdlSubProyecto").SelectedValue.ToEntero() + Dim CveTipoGasto As Integer = GvPrePoliza.Rows(IndiceGrid).FCDropDownList("DdlTipoGasto").SelectedValue.ToEntero() + Dim Id As Integer = GvPrePoliza.Rows(IndiceGrid).FCDropDownList("DdlCtaContable").SelectedValue.ToEntero() Dim Cargo As Double = GvPrePoliza.Rows(IndiceGrid).FCTextBox("TxtCargo").Text.ToDouble Dim Abono As Double = GvPrePoliza.Rows(IndiceGrid).FCTextBox("TxtAbono").Text.ToDouble @@ -1278,10 +1291,10 @@ Partial Class ContabilidadC_RegPrePoliza - 'TxtTotalCargos.Text = (TxtTotalCargos.Text.ToDouble + e.Row.FCTextBox("TxtCargo").Text.ToDouble).ToString.FormatoNumero - 'TxtTotalAbonos.Text = (TxtTotalAbonos.Text.ToDouble + e.Row.FCTextBox("TxtAbono").Text.ToDouble).ToString.FormatoNumero + 'TxtTotalCargos.Text = (TxtTotalCargos.Text.ToDouble + e.Row.FCTextBox("TxtCargo").Text.ToDouble).Tostring().FormatoNumero + 'TxtTotalAbonos.Text = (TxtTotalAbonos.Text.ToDouble + e.Row.FCTextBox("TxtAbono").Text.ToDouble).Tostring().FormatoNumero - 'Dim CveConceptoContable As Integer = e.Row.DataKey("CveConceptoContable").ToEntero + 'Dim CveConceptoContable As Integer = e.Row.DataKey("CveConceptoContable").ToEntero() 'If CveConceptoContable.Contiene(1, 2, 13, 38, 207, 203, 39, 61, 62, 63) Then e.Row.FCHyperLink("HlReferencia").NavigateUrl = String.Format("/Ventas/Ventas.aspx?CveVenta={0}", e.Row.DataKey("CveVenta")) 'If CveConceptoContable.Contiene(5, 6, 17, 18, 14, 19, 25, 26, 60, 234, 235) Then e.Row.FCHyperLink("HlReferencia").NavigateUrl = String.Format("/Compras/Compras.aspx?CveCompra={0}", e.Row.DataKey("CveCompra")) @@ -1305,7 +1318,7 @@ Partial Class ContabilidadC_RegPrePoliza Protected Sub GvMov_RowDeleting(sender As Object, e As GridViewDeleteEventArgs) Handles GvMov.RowDeleting - Dim idMov As Integer = GvMov.DataKeys(e.RowIndex).Value.ToString.ToEntero + Dim idMov As Integer = GvMov.DataKeys(e.RowIndex).Value.ToString().ToEntero() Dim Rows As DataRow() = DtMovimientos.Select("IDMov = " & idMov) If Rows.Count > 0 Then @@ -1337,7 +1350,7 @@ Partial Class ContabilidadC_RegPrePoliza Dim NombreCuenta As String = "" dr("IdCuenta") = DdlCtaContable.SelectedValue - If DdlCtaContable.SelectedValue.ToEntero > 0 Then + If DdlCtaContable.SelectedValue.ToEntero() > 0 Then Dim drr As DataRow = DtCuentasContables.FiltroPrimero(String.Format("Id={0}", DdlCtaContable.SelectedValue)) If drr IsNot Nothing Then CodigoCuenta = drr("CuentaFormato").ToString() @@ -1356,12 +1369,12 @@ Partial Class ContabilidadC_RegPrePoliza dr("Abono") = TxtAbono.Text.ToDouble dr("Descripcion") = TxtDescripcion.Text dr("CveSubProyecto") = DdlSubProyecto.SelectedValue - dr("CveProveedor") = DdlProveedores.SelectedValue.ToEntero - dr("CveCompra") = DdlCompras.SelectedValue.ToEntero - dr("CvePersonal") = DdlPersonal.SelectedValue.ToEntero - dr("CveClasificacion") = DdlClasificaciones.SelectedValue.ToEntero - dr("CveCliente") = DdlClientes.SelectedValue.ToEntero - dr("CveVenta") = DdlVentas.SelectedValue.ToEntero + dr("CveProveedor") = DdlProveedores.SelectedValue.ToEntero() + dr("CveCompra") = DdlCompras.SelectedValue.ToEntero() + dr("CvePersonal") = DdlPersonal.SelectedValue.ToEntero() + dr("CveClasificacion") = DdlClasificaciones.SelectedValue.ToEntero() + dr("CveCliente") = DdlClientes.SelectedValue.ToEntero() + dr("CveVenta") = DdlVentas.SelectedValue.ToEntero() End If GvMov.DataSource = DtMovimientos @@ -1387,8 +1400,8 @@ Partial Class ContabilidadC_RegPrePoliza dr("CveSubProyecto") = DdlSubProyecto.SelectedValue - TxtTotalAbonos.Text = (TxtTotalAbonos.Text.ToDouble + TxtAbono.Text.ToDouble).ToString.FormatoNumero - TxtTotalCargos.Text = (TxtTotalCargos.Text.ToDouble + TxtCargo.Text.ToDouble).ToString.FormatoNumero + TxtTotalAbonos.Text = (TxtTotalAbonos.Text.ToDouble + TxtAbono.Text.ToDouble).ToString().FormatoNumero + TxtTotalCargos.Text = (TxtTotalCargos.Text.ToDouble + TxtCargo.Text.ToDouble).ToString().FormatoNumero DtMovimientos.Rows.Add(dr) DtMovimientos.AcceptChanges() @@ -1404,7 +1417,7 @@ Partial Class ContabilidadC_RegPrePoliza dr("IdCuenta") = DdlCtaContable.SelectedValue - If DdlCtaContable.SelectedValue.ToEntero > 0 Then + If DdlCtaContable.SelectedValue.ToEntero() > 0 Then Dim drr As DataRow = DtCuentasContables.FiltroPrimero(String.Format("Id={0}", DdlCtaContable.SelectedValue)) If drr IsNot Nothing Then CodigoCuenta = drr("CuentaFormato").ToString() @@ -1425,16 +1438,16 @@ Partial Class ContabilidadC_RegPrePoliza dr("Abono") = TxtAbono.Text.ToDouble dr("Descripcion") = TxtDescripcion.Text dr("CveSubProyecto") = DdlSubProyecto.SelectedValue - dr("CveProveedor") = DdlProveedores.SelectedValue.ToEntero - dr("CveCompra") = DdlCompras.SelectedValue.ToEntero - dr("CvePersonal") = DdlPersonal.SelectedValue.ToEntero - dr("CveClasificacion") = DdlClasificaciones.SelectedValue.ToEntero - dr("CveCliente") = DdlClientes.SelectedValue.ToEntero - dr("CveVenta") = DdlVentas.SelectedValue.ToEntero + dr("CveProveedor") = DdlProveedores.SelectedValue.ToEntero() + dr("CveCompra") = DdlCompras.SelectedValue.ToEntero() + dr("CvePersonal") = DdlPersonal.SelectedValue.ToEntero() + dr("CveClasificacion") = DdlClasificaciones.SelectedValue.ToEntero() + dr("CveCliente") = DdlClientes.SelectedValue.ToEntero() + dr("CveVenta") = DdlVentas.SelectedValue.ToEntero() dr("TC") = TxtTC.Text.ToDouble - TxtTotalAbonos.Text = (TxtTotalAbonos.Text.ToDouble + TxtAbono.Text.ToDouble).ToString.FormatoNumero - TxtTotalCargos.Text = (TxtTotalCargos.Text.ToDouble + TxtCargo.Text.ToDouble).ToString.FormatoNumero + TxtTotalAbonos.Text = (TxtTotalAbonos.Text.ToDouble + TxtAbono.Text.ToDouble).ToString().FormatoNumero + TxtTotalCargos.Text = (TxtTotalCargos.Text.ToDouble + TxtCargo.Text.ToDouble).ToString().FormatoNumero DtMovimientos.Rows.Add(dr) DtMovimientos.AcceptChanges() @@ -1489,10 +1502,10 @@ Partial Class ContabilidadC_RegPrePoliza End Sub Private Sub BtnContado_Click(sender As Object, e As EventArgs) Handles BtnContado.Click CveConcepto = 30 - CveTipoTransaccion = DdlTipoTransaccion.SelectedValue.ToEntero - CveCuenta = DdlCuenta.SelectedValue.ToEntero + CveTipoTransaccion = DdlTipoTransaccion.SelectedValue.ToEntero() + CveCuenta = DdlCuenta.SelectedValue.ToEntero() Folio = TxtDocumentoFolio.Text - ImporteDocumento = TxtDocumentoImporte.Text.ToDecimal + ImporteDocumento = TxtDocumentoImporte.Text.ToDecimal() Observaciones = TxtDocumentoObservaciones.Text Beneficiario = TxtDocumentoBeneficiario.Text RegistraScript(String.Format("$('#{0}').modal('hide');", "DivContadoModal")) @@ -1549,8 +1562,8 @@ Partial Class ContabilidadC_RegPrePoliza Protected Sub DdlSubProyectoFiltro_SelectedIndexChanged(sender As Object, e As EventArgs) Dim Ddl As DropDownList = CType(sender, DropDownList) For Each Gvr As GridViewRow In GvPrePoliza.Rows - If Ddl.SelectedValue.ToEntero > 0 Then - If Gvr.FCDropDownList("DdlSubProyecto").SelectedValue.ToEntero = Ddl.SelectedValue.ToEntero Or Not Gvr.FCDropDownList("DdlSubProyecto").SelectedValue.ToEntero > 0 Or Gvr.FCDropDownList("DdlSubProyecto").Enabled Then + If Ddl.SelectedValue.ToEntero() > 0 Then + If Gvr.FCDropDownList("DdlSubProyecto").SelectedValue.ToEntero() = Ddl.SelectedValue.ToEntero() Or Not Gvr.FCDropDownList("DdlSubProyecto").SelectedValue.ToEntero() > 0 Or Gvr.FCDropDownList("DdlSubProyecto").Enabled Then Gvr.Visible = True Gvr.FCDropDownList("DdlSubProyecto").SelectedValueExist(Ddl.SelectedValue) Else @@ -1567,8 +1580,8 @@ Partial Class ContabilidadC_RegPrePoliza End Sub Protected Sub DdlSubProyectoFiltroMov_SelectedIndexChanged(sender As Object, e As EventArgs) For Each Gvr As GridViewRow In GvMov.Rows - If DdlSubProyectoFiltroMov.SelectedValue.ToEntero > 0 Then - If Gvr.FCDropDownList("DdlSubProyecto").SelectedValue.ToEntero = DdlSubProyectoFiltroMov.SelectedValue.ToEntero Or Not Gvr.FCDropDownList("DdlSubProyecto").SelectedValue.ToEntero > 0 Or Gvr.FCDropDownList("DdlSubProyecto").Enabled Then + If DdlSubProyectoFiltroMov.SelectedValue.ToEntero() > 0 Then + If Gvr.FCDropDownList("DdlSubProyecto").SelectedValue.ToEntero() = DdlSubProyectoFiltroMov.SelectedValue.ToEntero() Or Not Gvr.FCDropDownList("DdlSubProyecto").SelectedValue.ToEntero() > 0 Or Gvr.FCDropDownList("DdlSubProyecto").Enabled Then Gvr.Visible = True Gvr.FCDropDownList("DdlSubProyecto").SelectedValueExist(DdlSubProyectoFiltroMov.SelectedValue) Else @@ -1586,22 +1599,22 @@ Partial Class ContabilidadC_RegPrePoliza Private Sub GvMov_RowEditing(sender As Object, e As GridViewEditEventArgs) Handles GvMov.RowEditing Actualizar = True - GvMov.DataKeys(e.NewEditIndex).Value.ToString.ToEntero - Dim idMov As Integer = GvMov.DataKeys(e.NewEditIndex).Value.ToString.ToEntero + GvMov.DataKeys(e.NewEditIndex).Value.ToString().ToEntero() + Dim idMov As Integer = GvMov.DataKeys(e.NewEditIndex).Value.ToString().ToEntero() Dim DrM As DataRow = DtMovimientos.Rows(e.NewEditIndex) If DrM IsNot Nothing Then - HdnCve.Value = idMov.ToString + HdnCve.Value = idMov.ToString() DdlCtaContable.SelectedValue = DrM("IdCuenta") TxtReferencia.Text = DrM("Referencia") TxtObservaciones.Text = DrM("Concepto") ' (Math.Abs(TxtCargo.Text.ToDouble) > 0, 0, 1) = dr("TipoMovto") DrM("EsComodin") = 0 - DdlConceptosContables.SelectedValue = DrM("CveConcepto").ToString - TxtCargo.Text = DrM("Cargo").ToString - TxtAbono.Text = DrM("Abono").ToString + DdlConceptosContables.SelectedValue = DrM("CveConcepto").ToString() + TxtCargo.Text = DrM("Cargo").ToString() + TxtAbono.Text = DrM("Abono").ToString() TxtDescripcion.Text = DrM("Descripcion") DdlSubProyecto.SelectedValue = DrM("CveSubProyecto") DdlProveedores.SelectedValue = DrM("CveProveedor") @@ -1627,11 +1640,11 @@ Partial Class ContabilidadC_RegPrePoliza 'dr("IdCuenta") = DdlCtaContable.SelectedValue - 'If DdlCtaContable.SelectedValue.ToEntero > 0 Then + 'If DdlCtaContable.SelectedValue.ToEntero() > 0 Then ' Dim drr As DataRow = DtCuentasContables.FiltroPrimero(String.Format("Id={0}", DdlCtaContable.SelectedValue)) ' If drr IsNot Nothing Then - ' CodigoCuenta = drr("CuentaFormato").ToString() - ' NombreCuenta = drr("Nombre").ToString() + ' CodigoCuenta = drr("CuentaFormato").Tostring() + ' NombreCuenta = drr("Nombre").Tostring() ' End If 'End If @@ -1646,15 +1659,15 @@ Partial Class ContabilidadC_RegPrePoliza 'dr("Abono") = TxtAbono.Text.ToDouble 'dr("Descripcion") = TxtDescripcion.Text 'dr("CveSubProyecto") = DdlSubProyecto.SelectedValue - 'dr("CveProveedor") = DdlProveedores.SelectedValue.ToEntero - 'dr("CveCompra") = DdlCompras.SelectedValue.ToEntero - 'dr("CvePersonal") = DdlPersonal.SelectedValue.ToEntero + 'dr("CveProveedor") = DdlProveedores.SelectedValue.ToEntero() + 'dr("CveCompra") = DdlCompras.SelectedValue.ToEntero() + 'dr("CvePersonal") = DdlPersonal.SelectedValue.ToEntero() 'dr("CveClasificacion") = -1 - 'dr("CveCliente") = DdlClientes.SelectedValue.ToEntero - 'dr("CveVenta") = DdlVentas.SelectedValue.ToEntero + 'dr("CveCliente") = DdlClientes.SelectedValue.ToEntero() + 'dr("CveVenta") = DdlVentas.SelectedValue.ToEntero() - 'TxtTotalAbonos.Text = (TxtTotalAbonos.Text.ToDouble + TxtAbono.Text.ToDouble).ToString.FormatoNumero - 'TxtTotalCargos.Text = (TxtTotalCargos.Text.ToDouble + TxtCargo.Text.ToDouble).ToString.FormatoNumero + 'TxtTotalAbonos.Text = (TxtTotalAbonos.Text.ToDouble + TxtAbono.Text.ToDouble).Tostring().FormatoNumero + 'TxtTotalCargos.Text = (TxtTotalCargos.Text.ToDouble + TxtCargo.Text.ToDouble).Tostring().FormatoNumero 'DtMovimientos.Rows.Add(dr) 'If CvePrePoliza > 0 Then @@ -1696,7 +1709,7 @@ Partial Class ContabilidadC_RegPrePoliza ObjConta.UpdatePrePolizasDetalleBloquear(CvePrePoliza, False) End If - If ObjConta.ContabilizarPrePoliza(CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.Empresa, pIDPoliza:=If(IdPoliza > 0, IdPoliza, -1), Concepto:=TxtConcepto.Text, Fecha:=TxtFechaDocumento.Text.ToDateTime) Then + If ObjConta.ContabilizarPrePoliza(CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.Empresa, pIDPoliza:=If(IdPoliza > 0, IdPoliza, -1), Concepto:=TxtConcepto.Text, Fecha:=TxtFechaDocumento.Text.ToDateTime()) Then Alert(String.Format("Prepóliza contabilizada.

    Folio:Ver Póliza", ObjConta.ContaIdPoliza), ModExtensiones.TipoMensaje.MsgInformacion) Else @@ -1728,7 +1741,7 @@ Partial Class ContabilidadC_RegPrePoliza Str.AppendFormat("No se genero complemento por el siguiente motivo: {0}", Banco.Mensaje) End If Banco.Dispose() - Alert(Str.ToString, TipoMensaje.MsgInformacion, "self.parent.tb_remove();self.parent.location.reload();") + Alert(Str.ToString(), TipoMensaje.MsgInformacion, "self.parent.tb_remove();self.parent.location.reload();") End Sub Private Sub MandaCorreo(NombreArchivo As String, Correo As String, Optional ConAlerta As Boolean = True) @@ -1779,7 +1792,6 @@ Partial Class ContabilidadC_RegPrePoliza Dim ObjIE As New ClsBancos() Dim pathPoliza As String = "" Dim TieneComprobante As Boolean - Tick = DateTime.Now.Ticks.ToString Try TieneComprobante = VerificarComprobante() @@ -1792,11 +1804,11 @@ Partial Class ContabilidadC_RegPrePoliza End If For Each Row As DataRow In dt.Rows - If Row("CveConceptoContable").ToString.ToEntero = 30 Then - If Row("CveIE").ToString.ToEntero > 0 Then - If ObjIE.GetBancosIE(Row("CveIE").ToString.ToEntero, UsuarioActual.CveEmpresa) Then + If Row("CveConceptoContable").ToString().ToEntero() = 30 Then + If Row("CveIE").ToString().ToEntero() > 0 Then + If ObjIE.GetBancosIE(Row("CveIE").ToString().ToEntero(), UsuarioActual.CveEmpresa) Then If ObjIE.DtResultados.Rows.Count > 0 Then - Path = String.Format("{0}IE\{1}", UsuarioActual.Empresa.Ruta, ObjIE.Comprobante.ToString) + Path = String.Format("{0}IE\{1}", UsuarioActual.Empresa.Ruta, ObjIE.Comprobante.ToString()) If File.Exists(Path) Then Dim formato As String = System.IO.Path.GetExtension(Path) If formato.ToLower.Contiene(".jpg", ".png", ".jpeg") Then @@ -1825,12 +1837,12 @@ Partial Class ContabilidadC_RegPrePoliza End If End If End If - If Row("CveConceptoContable").ToString.ToEntero.Contiene(17, 309, 312, 308) Then - If ObjCompra.GetCompras(Row("CveCompra").ToString.ToEntero, "-1", "-1", -1, -1, UsuarioActual.CveEmpresa) Then + If Row("CveConceptoContable").ToString().ToEntero().Contiene(17, 309, 312, 308) Then + If ObjCompra.GetCompras(Row("CveCompra").ToString().ToEntero(), "-1", "-1", -1, -1, UsuarioActual.CveEmpresa) Then If ObjCompra.DtResultados IsNot Nothing AndAlso ObjCompra.DtResultados.Rows.Count > 0 Then Dim dr As DataRow = ObjCompra.DtResultados.Rows(0) - Dim RFC As String = dr("RFC").ToString - Dim CveFactura As String = dr("CveFactura").ToString + Dim RFC As String = dr("RFC").ToString() + Dim CveFactura As String = dr("CveFactura").ToString() Path = String.Format("{0}Compras\{1}\{2}.pdf", UsuarioActual.Empresa.Ruta, RFC, CveFactura) If File.Exists(Path) Then @@ -1842,36 +1854,38 @@ Partial Class ContabilidadC_RegPrePoliza Next - - For Each Row As DataRow In dt.FiltraParametros("CveConceptoContable = 30").Rows - If ObjCompra.GetCompraComplementoPago(-1, UsuarioActual.CveEmpresa, Row("CveIE").ToString.ToEntero) Then + dt = DtMovimientos.FiltraParametros("", "", filtroComplemento) + For Each Row As DataRow In dt.Rows + If ObjCompra.GetCompraComplementoPago(-1, UsuarioActual.CveEmpresa, Row("CveIE").ToString().ToEntero()) Then + Console.WriteLine(Row("CveIE").ToString()) If ObjCompra.DtResultados IsNot Nothing AndAlso ObjCompra.DtResultados.Rows.Count > 0 Then - For Each RowComple As DataRow In ObjCompra.DtResultados.FiltraParametros("", "", {"RFCde", "CveFactura"}).Rows - Dim RFC As String = RowComple.Item("RFCde").ToString - Dim CveFactura As String = RowComple.Item("CveFactura").ToString - If CveFactura <> "" Then - Path = String.Format("{0}Compras\{1}\{2}.pdf", UsuarioActual.Empresa.Ruta, RFC, CveFactura) - If File.Exists(Path) Then - Pathpdf.Add(Path) - End If + Dim dr As DataRow = ObjCompra.DtResultados.Rows(0) + Dim RFC As String = dr("RFCde").ToString() + Dim CveFactura As String = dr("CveFactura").ToString() + Console.WriteLine(RFC & CveFactura) + If CveFactura <> "" Then + Path = String.Format("{0}Compras\{1}\{2}.pdf", UsuarioActual.Empresa.Ruta, RFC, CveFactura) + Console.WriteLine(Path) + If File.Exists(Path) Then + Pathpdf.Add(Path) End If - Next - + End If End If End If Next + MergePdfFiles(Pathpdf.ToArray) + If File.Exists(pathPoliza) Then + Directory.Delete(String.Format("{0}{1}", AppDomain.CurrentDomain.BaseDirectory, Tick), True) + End If + Else Alert("No se tiene cargado comprobante de pago", TipoMensaje.MsgAdvertencia) End If - If File.Exists(pathPoliza) Then - Directory.Delete(String.Format("{0}/{1}", AppDomain.CurrentDomain.BaseDirectory, Tick), True) - End If + + Catch ex As Exception Alert("Error al descargar el paquete", TipoMensaje.MsgError) - If File.Exists(pathPoliza) Then - Directory.Delete(String.Format("{0}/{1}", AppDomain.CurrentDomain.BaseDirectory, Tick), True) - End If End Try ObjCompra.Dispose() ObjIE.Dispose() @@ -1889,24 +1903,21 @@ Partial Class ContabilidadC_RegPrePoliza If ObjConta.GetPrePolizasDetalle(CvePrePoliza) AndAlso ObjConta.DtResultados.Rows.Count > 0 Then Dim dtVC As DataTable Dim dr As DataRow - dtVC = ObjConta.DtResultados.FiltraParametros("Contabilizable = 1", "Orden") + dtVC = ObjConta.DtResultados dr = dtVC.Rows(0) Dim ruta As String = "" params.Add(New ReportParameter("Empresa", UsuarioActual.Empresa.Empresa)) - params.Add(New ReportParameter("TipoPoliza", dr("TipoPoliza").ToString)) - params.Add(New ReportParameter("Finicio", dr("Fecha").ToString.ToDate.ToShortDateString)) - params.Add(New ReportParameter("FFin", dr("Fecha").ToString.ToDate.ToShortDateString)) - params.Add(New ReportParameter("Fecha", dr("Fecha").ToString.ToDate.ToShortDateString)) - 'params.Add(New ReportParameter("Nombre", dr("Cuenta").ToString)) - 'params.Add(New ReportParameter("Cuenta", dr("Codigo").ToString)) - params.Add(New ReportParameter("Numero", dr("FolioPoliza").ToString)) + params.Add(New ReportParameter("TipoPoliza", dr("TipoPoliza").ToString())) + params.Add(New ReportParameter("Finicio", dr("Fecha").ToString().ToDate().ToShortDateString)) + params.Add(New ReportParameter("FFin", dr("Fecha").ToString().ToDate().ToShortDateString)) + params.Add(New ReportParameter("Fecha", dr("Fecha").ToString().ToDate().ToShortDateString)) + 'params.Add(New ReportParameter("Nombre", dr("Cuenta").Tostring())) + 'params.Add(New ReportParameter("Cuenta", dr("Codigo").Tostring())) + params.Add(New ReportParameter("Numero", dr("FolioPoliza").ToString())) params.Add(New ReportParameter("Moneda", "")) params.Add(New ReportParameter("CodigoPostal", "")) If UsuarioActual.CveEmpresa = 119 Then - params.Add(New ReportParameter("UsuarioRegistro", GlobalDTUsuarios(dr("CveUsuario").ToString.ToEntero).FiltroPrimeroValor("Nombre"))) - End If - If UsuarioActual.CveEmpresa = 140 Then - params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre)) + params.Add(New ReportParameter("UsuarioRegistro", GlobalDTUsuarios(dr("CveUsuario").ToString().ToEntero()).FiltroPrimeroValor("Nombre"))) End If If Archivo.Exists Then ruta = UsuarioActual.Empresa.Ruta & "Formatos/Polizas.rdlc" @@ -1914,12 +1925,12 @@ Partial Class ContabilidadC_RegPrePoliza ruta = "Empresas/Grales/Formatos/Polizas.rdlc" End If Bytes = StreamPDF(ruta, dtVC, params, "ppoliza") - If Not File.Exists(String.Format("{0}{1}\{2}.pdf", AppDomain.CurrentDomain.BaseDirectory, Tick, IdPoliza.ToString)) Then + If Not File.Exists(String.Format("{0}{1}\{2}.pdf", AppDomain.CurrentDomain.BaseDirectory, Tick, IdPoliza.ToString())) Then DirectoryExistsCreate(String.Format("{0}{1}", AppDomain.CurrentDomain.BaseDirectory, Tick)) - File.WriteAllBytes(String.Format("{0}\{1}\{2}.pdf", AppDomain.CurrentDomain.BaseDirectory, Tick, IdPoliza.ToString), Bytes) + File.WriteAllBytes(String.Format("{0}\{1}\{2}.pdf", AppDomain.CurrentDomain.BaseDirectory, Tick, IdPoliza.ToString()), Bytes) End If End If - Return String.Format("{0}\{1}\{2}.pdf", AppDomain.CurrentDomain.BaseDirectory, Tick, IdPoliza.ToString) + Return String.Format("{0}\{1}\{2}.pdf", AppDomain.CurrentDomain.BaseDirectory, Tick, IdPoliza.ToString()) ObjConta.Dispose() End Function @@ -1994,9 +2005,6 @@ Partial Class ContabilidadC_RegPrePoliza End If result = True - If Directory.Exists(String.Format("{0}/{1}", AppDomain.CurrentDomain.BaseDirectory, Tick)) Then - Directory.Delete(String.Format("{0}/{1}", AppDomain.CurrentDomain.BaseDirectory, Tick), True) - End If End If Catch ex As Exception End Try @@ -2012,10 +2020,10 @@ Partial Class ContabilidadC_RegPrePoliza Protected Sub DdlProveedores_SelectedIndexChanged1(sender As Object, e As EventArgs) Dim ddl As DropDownList = CType(sender, DropDownList) Dim ddl2 As DropDownList = DirectCast(ddl.BindingContainer, GridViewRow).FCDropDownList("DdlCompras") - If DdlConceptosContables.SelectedValue.ToEntero.Contiene(18, 60) Then - CargaNotasCreditoCompras(ddl.SelectedValue.ToEntero, ddl2) + If DdlConceptosContables.SelectedValue.ToEntero().Contiene(18, 60) Then + CargaNotasCreditoCompras(ddl.SelectedValue.ToEntero(), ddl2) Else - CargaCompras2(ddl.SelectedValue.ToEntero, ddl2) + CargaCompras2(ddl.SelectedValue.ToEntero(), ddl2) End If End Sub @@ -2058,9 +2066,9 @@ Partial Class ContabilidadC_RegPrePoliza Dim NombreArchivo As String SpreadsheetInfo.SetLicense(ModExtensiones.SerialGemBoxSpreadsheet) Dim workbook As New ExcelFile() - Dim worksheet = workbook.Worksheets.Add(DdlPlantilla2.SelectedItem.Text.ToString) + Dim worksheet = workbook.Worksheets.Add(DdlPlantilla2.SelectedItem.Text.ToString()) - Dim CvePlantilla As Integer = DdlPlantilla2.SelectedValue.ToEntero + Dim CvePlantilla As Integer = DdlPlantilla2.SelectedValue.ToEntero() Dim Dt As DataTable = GlobalDTContaPlantillasPolizasDetalle(CvePlantilla).FiltraParametros(String.Format("CveEmpresa={0}", UsuarioActual.CveEmpresa), "Orden") Dim DtExcel As DataTable = (From row As DataRow In Dt.Rows @@ -2075,8 +2083,8 @@ Partial Class ContabilidadC_RegPrePoliza .Concepto = "", .SubProyecto = row.Item("SubProyecto"), .CveConceptoContable = row.Item("CveConcepto"), - .CveSubProyecto = IIf(row.Item("CveSubProyecto").ToString.ToEntero > 0, row.Item("CveSubProyecto"), -1), - .IdCtaContable = IIf(row.Item("IdCtaContable").ToString.ToEntero > 0, row.Item("IdCtaContable"), -1) + .CveSubProyecto = IIf(row.Item("CveSubProyecto").ToString().ToEntero() > 0, row.Item("CveSubProyecto"), -1), + .IdCtaContable = IIf(row.Item("IdCtaContable").ToString().ToEntero() > 0, row.Item("IdCtaContable"), -1) }).QueryToDataTable(True) worksheet.InsertDataTable(DtExcel, New InsertDataTableOptions() With @@ -2095,7 +2103,7 @@ Partial Class ContabilidadC_RegPrePoliza worksheet.Columns("K").Hidden = True - NombreArchivo = DdlPlantilla2.SelectedItem.Text.ToString + NombreArchivo = DdlPlantilla2.SelectedItem.Text.ToString() workbook.Save(Response, $"{NombreArchivo}.xlsx", SaveOptions.XlsxDefault) @@ -2175,28 +2183,26 @@ Partial Class ContabilidadC_RegPrePoliza Dim TotalAbonos As Integer = 0 - CvePrePoliza = ObjConta.AddPrePolizas("Contabilidad/RegPrePolizaExcel", DdlPlantilla2.SelectedValue.ToEntero, TotalCargos, TotalAbonos, 1, TxtFecha.Text.ToDate, DdlPlantilla2.SelectedItem.Text.ToString, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoPoliza:=DdlTipoPolizaAdd.SelectedValue.ToEntero) + CvePrePoliza = ObjConta.AddPrePolizas("Contabilidad/RegPrePolizaExcel", DdlPlantilla2.SelectedValue.ToEntero(), TotalCargos, TotalAbonos, 1, TxtFecha.Text.ToDate(), DdlPlantilla2.SelectedItem.Text.ToString(), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoPoliza:=DdlTipoPolizaAdd.SelectedValue.ToEntero()) For Each Row As DataRow In dt.Rows - NombreCuenta = Row("NombreCuenta").ToString - Cuenta = Row("Cuenta").ToString + NombreCuenta = Row("NombreCuenta").ToString() + Cuenta = Row("Cuenta").ToString() - Dim Importe As Decimal = If(Row("Cargo").ToString.ToDecimal <> 0, Row("Cargo").ToString.ToDecimal, Row("Abono").ToString.ToDecimal) - Dim Concepto As String = Row("Concepto").ToString - Dim Referencia As String = Row("Referencia").ToString + Dim Importe As Decimal = If(Row("Cargo").ToString().ToDecimal() <> 0, Row("Cargo").ToString().ToDecimal(), Row("Abono").ToString().ToDecimal()) + Dim Concepto As String = Row("Concepto").ToString() + Dim Referencia As String = Row("Referencia").ToString() Dim IdCuenta As Integer = -1 - Dim CveSubProyecto As Integer = Row("CveSubProyecto").ToString.ToEntero - Dim TipoMovto As Boolean = If(Row("Cargo").ToString.ToDecimal <> 0, False, True) + Dim CveSubProyecto As Integer = Row("CveSubProyecto").ToString().ToEntero() + Dim TipoMovto As Boolean = If(Row("Cargo").ToString().ToDecimal() <> 0, False, True) Dim YaExiste As Boolean = False - Dim CveConceptoContable As Integer = Row("CveConceptoContable").ToString.ToEntero - Dim IdCtaContable As Integer = Row("IdCtaContable").ToString.ToEntero - 'sino viene el cveconcepto, busca por le nombre del concepto - If CveConceptoContable = 0 Then CveConceptoContable = GlobalDTContaConceptosContables(-1).FiltroPrimeroValor("CveConceptoContable", String.Format("ConceptoContable = '{0}'", Row("ConceptoContable"))).ToEntero + Dim CveConceptoContable As Integer = Row("CveConceptoContable").ToString().ToEntero() + Dim IdCtaContable As Integer = Row("IdCtaContable").ToString().ToEntero() If ObjConta.GetCuentas(-1, Cuenta.Replace("-", ""), 1, UsuarioActual.CveEmpresa) Then If ObjConta.DtResultados.Rows.Count > 0 Then - IdCuenta = ObjConta.DtResultados().FiltroPrimeroValor("CveCuenta").ToEntero + IdCuenta = ObjConta.DtResultados().FiltroPrimeroValor("CveCuenta").ToEntero() 'TipoCuenta = ObjConta.DtResultados().FiltroPrimeroValor("Tipo") Else Reporte.AppendLine($"{Cuenta} - {NombreCuenta} - {Importe}
    ") @@ -2215,7 +2221,7 @@ Partial Class ContabilidadC_RegPrePoliza If YaExiste = False Then If IdCuenta > 0 Then - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovto, Importe, "", CveConceptoContable, Concepto, Now.ToDate, IdCtaContable, -1, ImporteMX:=Importe, CveSubProyecto:=CveSubProyecto, CveCuenta:=IdCuenta) Then + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovto, Importe, "", CveConceptoContable, Concepto, Now.ToDate(), IdCtaContable, -1, ImporteMX:=Importe, CveSubProyecto:=CveSubProyecto, CveCuenta:=IdCuenta) Then TieneError = True Exit For End If @@ -2233,7 +2239,7 @@ Partial Class ContabilidadC_RegPrePoliza Alert($"Se agregó la póliza {ObjConta.ContaFolio}") Else - Alert($"No encontraron las siguientes cuentas: {Reporte.ToString} ", TipoMensaje.MsgError) + Alert($"No encontraron las siguientes cuentas: {Reporte.ToString()} ", TipoMensaje.MsgError) ObjConta.RollBack() End If @@ -2342,9 +2348,9 @@ Partial Class ContabilidadC_RegPrePoliza For Each Row As DataRow In dt.FiltraParametros("CveConceptoContable = 30").Rows - If ObjIE.GetBancosIE(Row("CveIE").ToString.ToEntero, UsuarioActual.CveEmpresa) Then + If ObjIE.GetBancosIE(Row("CveIE").ToString().ToEntero(), UsuarioActual.CveEmpresa) Then If ObjIE.DtResultados.Rows.Count > 0 Then - Path = String.Format("{0}IE\{1}", UsuarioActual.Empresa.Ruta, ObjIE.Comprobante.ToString) + Path = String.Format("{0}IE\{1}", UsuarioActual.Empresa.Ruta, ObjIE.Comprobante.ToString()) If File.Exists(Path) Then TieneComprobante = True Exit For @@ -2364,53 +2370,5 @@ Partial Class ContabilidadC_RegPrePoliza End Function - Protected Sub LnkImprimirPoliza_Click(sender As Object, e As EventArgs) - ImprimirPolizaPDFRunTime(IdPoliza) - End Sub - Private Function ImprimirPolizaPDFRunTime(IdPoliza As Integer) As String - Dim ObjConta As New ClsContabilidad - 'Dim ObjPoliza As New ClsContPAQi(UsuarioActual.Empresa) - - Dim Archivo As New System.IO.FileInfo(String.Format("{0}Formatos/Polizas.rdlc", UsuarioActual.Empresa.Ruta)) - Dim params As New List(Of ReportParameter) - Dim Bytes As Byte() = Nothing - - - 'If ObjPoliza.GetPoliza(IdPoliza, -1, -1, -1, -1) AndAlso ObjPoliza.DtResultados.Rows.Count > 0 Then - If ObjConta.GetPrePolizasDetalle(CvePrePoliza) AndAlso ObjConta.DtResultados.Rows.Count > 0 Then - Dim dtVC As DataTable - Dim dr As DataRow - dtVC = ObjConta.DtResultados.FiltraParametros("Contabilizable = 1", "Orden") - dr = dtVC.Rows(0) - Dim ruta As String = "" - params.Add(New ReportParameter("Empresa", UsuarioActual.Empresa.Empresa)) - params.Add(New ReportParameter("TipoPoliza", dr("TipoPoliza").ToString)) - params.Add(New ReportParameter("Finicio", dr("Fecha").ToString.ToDate.ToShortDateString)) - params.Add(New ReportParameter("FFin", dr("Fecha").ToString.ToDate.ToShortDateString)) - params.Add(New ReportParameter("Fecha", dr("Fecha").ToString.ToDate.ToShortDateString)) - 'params.Add(New ReportParameter("Nombre", dr("Cuenta").ToString)) - 'params.Add(New ReportParameter("Cuenta", dr("Codigo").ToString)) - params.Add(New ReportParameter("Numero", dr("FolioPoliza").ToString)) - params.Add(New ReportParameter("Moneda", "")) - params.Add(New ReportParameter("CodigoPostal", "")) - If UsuarioActual.CveEmpresa = 119 Then - params.Add(New ReportParameter("UsuarioRegistro", GlobalDTUsuarios(dr("CveUsuario").ToString.ToEntero).FiltroPrimeroValor("Nombre"))) - End If - If UsuarioActual.CveEmpresa = 140 Then - params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre)) - End If - If Archivo.Exists Then - ruta = UsuarioActual.Empresa.Ruta & "Formatos/Polizas.rdlc" - Else - ruta = "Empresas/Grales/Formatos/Polizas.rdlc" - End If - ImprimirbytesPDF(StreamPDF(ruta, dtVC, params, "ppoliza"), String.Format("{0}-{1}", TipoPoliza, dr("FolioPoliza").ToString), "PDF", True) - - End If - Return String.Format("{0}\{1}\{2}.pdf", AppDomain.CurrentDomain.BaseDirectory, Tick, IdPoliza.ToString) - ObjConta.Dispose() - - End Function - End Class diff --git a/General/SaldosIniciales.aspx.vb b/General/SaldosIniciales.aspx.vb index bd11fdf29..6427152d0 100644 --- a/General/SaldosIniciales.aspx.vb +++ b/General/SaldosIniciales.aspx.vb @@ -384,147 +384,10 @@ Partial Class General_SaldosIniciales 'End If ElseIf RblFormato.SelectedValue = "6" Then - If Not dt.Columns(0).ColumnName = "Código" Then - Alert("El nombre de la primera columna debe ser 'Código'. Favor de corregirlo", TipoMensaje.MsgError) - Exit Sub - End If - If Not dt.Columns(1).ColumnName = "Apellido Paterno" Then - Alert("El nombre de la segunda columna debe ser 'Apellido Paterno'. Favor de corregirlo", TipoMensaje.MsgError) + If Not validaRHPersonal(dt) Then Exit Sub End If - - If Not dt.Columns(2).ColumnName = "Apellido Materno" Then - Alert("El nombre de la tercera columna debe ser 'Apellido Materno'. Favor de corregirlo", TipoMensaje.MsgError) - Exit Sub - End If - - If Not dt.Columns(3).ColumnName = "Nombre" Then - Alert("El nombre de la cuarta columna debe ser 'Nombre'. Favor de corregirlo", TipoMensaje.MsgError) - Exit Sub - End If - - If Not dt.Columns(4).ColumnName = "Correo Electronico" Then - Alert("El nombre de la quinta columna debe ser 'Correo Electronico'. Favor de corregirlo", TipoMensaje.MsgError) - Exit Sub - End If - - If Not dt.Columns(5).ColumnName = "Fecha Nacimiento" Then - Alert("El nombre de la sexta columna debe ser 'Fecha Nacimiento'. Favor de corregirlo", TipoMensaje.MsgError) - Exit Sub - End If - - If Not dt.Columns(6).ColumnName = "Sexo" Then - Alert("El nombre de la séptima columna debe ser 'Sexo'. Favor de corregirlo", TipoMensaje.MsgError) - Exit Sub - End If - - If Not dt.Columns(7).ColumnName = "Lugar Nacimiento" Then - Alert("El nombre de la octava columna debe ser 'Lugar Nacimiento'. Favor de corregirlo", TipoMensaje.MsgError) - Exit Sub - End If - - If Not dt.Columns(8).ColumnName = "Dirección" Then - Alert("El nombre de la novena columna debe ser 'Dirección'. Favor de corregirlo", TipoMensaje.MsgError) - Exit Sub - End If - - If Not dt.Columns(9).ColumnName = "Ciudad" Then - Alert("El nombre de la décima columna debe ser 'Ciudad'. Favor de corregirlo", TipoMensaje.MsgError) - Exit Sub - End If - - If Not dt.Columns(10).ColumnName = "Estado Civil" Then - Alert("El nombre de la onceava columna debe ser 'Estado Civil'. Favor de corregirlo", TipoMensaje.MsgError) - Exit Sub - End If - - If Not dt.Columns(11).ColumnName = "Teléfono" Then - Alert("El nombre de la doceava columna debe ser 'Teléfono'. Favor de corregirlo", TipoMensaje.MsgError) - Exit Sub - End If - - If Not dt.Columns(12).ColumnName = "Celular" Then - Alert("El nombre de la treceava columna debe ser 'Celular'. Favor de corregirlo", TipoMensaje.MsgError) - Exit Sub - End If - - If Not dt.Columns(13).ColumnName = "RFC" Then - Alert("El nombre de la catorceava columna debe ser 'RFC'. Favor de corregirlo", TipoMensaje.MsgError) - Exit Sub - End If - - If Not dt.Columns(14).ColumnName = "CURP" Then - Alert("El nombre de la quinceava columna debe ser 'CURP'. Favor de corregirlo", TipoMensaje.MsgError) - Exit Sub - End If - If Not dt.Columns(15).ColumnName = "Numero SS" Then - Alert("El nombre de la diesciseisava columna debe ser 'Numero SS'. Favor de corregirlo", TipoMensaje.MsgError) - Exit Sub - End If - If Not dt.Columns(16).ColumnName = "CLABE" Then - Alert("El nombre de la diescisieteava columna debe ser 'CLABE'. Favor de corregirlo", TipoMensaje.MsgError) - Exit Sub - End If - - If Not dt.Columns(17).ColumnName = "Fecha Ingreso" Then - Alert("El nombre de la dieciochoava columna debe ser 'Fecha Ingreso'. Favor de corregirlo", TipoMensaje.MsgError) - Exit Sub - End If - If Not dt.Columns(18).ColumnName = "Fecha Baja" Then - Alert("El nombre de la diecinueveava columna debe ser 'Fecha Baja'. Favor de corregirlo", TipoMensaje.MsgError) - Exit Sub - End If - - If Not dt.Columns(19).ColumnName = "Alta IMSS" Then - Alert("El nombre de la veinteava columna debe ser 'Alta IMSS'. Favor de corregirlo", TipoMensaje.MsgError) - Exit Sub - End If - - If Not dt.Columns(20).ColumnName = "Salario Diario" Then - Alert("El nombre de la veinteunava columna debe ser 'Salario Diario'. Favor de corregirlo", TipoMensaje.MsgError) - Exit Sub - End If - - If Not dt.Columns(21).ColumnName = "Código Postal" Then - Alert("El nombre de la veintedosava columna debe ser 'Código Postal'. Favor de corregirlo", TipoMensaje.MsgError) - Exit Sub - End If - If Not dt.Columns(22).ColumnName = "Estatus Personal" Then - Alert("El nombre de la veintetresava columna debe ser 'Estatus Personal'. Favor de corregirlo", TipoMensaje.MsgError) - Exit Sub - End If - - If Not dt.Columns(23).ColumnName = "Estado" Then - Alert("El nombre de la veintecuatroava columna debe ser 'Estado'. Favor de corregirlo", TipoMensaje.MsgError) - Exit Sub - End If - - If Not dt.Columns(24).ColumnName = "Nombre Padre" Then - Alert("El nombre de la veintecincoava columna debe ser 'Nombre Padre'. Favor de corregirlo", TipoMensaje.MsgError) - Exit Sub - End If - - If Not dt.Columns(25).ColumnName = "Nombre Madre" Then - Alert("El nombre de la veinteseisava columna debe ser 'Nombre Madre'. Favor de corregirlo", TipoMensaje.MsgError) - Exit Sub - End If - - If Not dt.Columns(26).ColumnName = "Puesto" Then - Alert("El nombre de la veintesieteava columna debe ser 'Puesto'. Favor de corregirlo", TipoMensaje.MsgError) - Exit Sub - End If - - If Not dt.Columns(27).ColumnName = "Turno" Then - Alert("El nombre de la veinteochaava columna debe ser 'Turno'. Favor de corregirlo", TipoMensaje.MsgError) - Exit Sub - End If - - If Not dt.Columns(28).ColumnName = "Tipo Contrato" Then - Alert("El nombre de la veintenueveava columna debe ser 'Tipo Contrato'. Favor de corregirlo", TipoMensaje.MsgError) - Exit Sub - End If - End If ElseIf RblFormato.SelectedValue = "7" Then @@ -1517,165 +1380,8 @@ Partial Class General_SaldosIniciales ' R H - P E R S O N A L ElseIf RblFormato.SelectedValue = "6" Then - Dim ObjRH As New ClsRH - Try - ObjRH.IniciaTransacSQL() - Dim ErrorRH As Boolean = False - Dim Contador As Integer = 0 - Dim NumRow As Integer = 0 - - For Each Row As DataRow In dt.Rows - Dim Codigo As String = Row("Código").ToString - Dim ApellidoPaterno As String = Row("Apellido Paterno").ToString - Dim ApellidoMaterno As String = Row("Apellido Materno").ToString - Dim Nombre As String = Row("Nombre").ToString - Dim CorreoElectronico As String = Row("Correo Electronico").ToString - Dim FechaIngreso As String = Row("Fecha Ingreso").ToString - Dim FechaBaja As String = Row("Fecha Baja").ToString - Dim NumeroSS As String = Row("Numero SS").ToString - Dim AltaIMSS As String = Row("Alta IMSS").ToString - Dim SalarioDiario As String = Row("Salario Diario").ToString - Dim Direccion As String = Row("Dirección").ToString - Dim FechaNacimiento As String = Row("Fecha Nacimiento").ToString - Dim LugarNacimiento As String = Row("Lugar Nacimiento").ToString - Dim Sexo As String = Row("Sexo").ToString - Dim CodigoPostal As String = Row("Código Postal").ToString - Dim Ciudad As String = Row("Ciudad").ToString - Dim EstadoCivil As String = Row("Estado Civil").ToString.ToUpper - Dim Telefono As String = Row("Teléfono").ToString - Dim Celular As String = Row("Celular").ToString - Dim RFC As String = Row("RFC").ToString - Dim CURP As String = Row("CURP").ToString - Dim ClabeInterbancaria As String = Row("CLABE").ToString - Dim EstatusPersonal As String = Row("Estatus Personal").ToString.ToUpper - - 'Nuevas - Dim Estado As String = Row("Estado").ToString - Dim NombrePadre As String = Row("Nombre Padre").ToString - Dim NombreMadre As String = Row("Nombre Madre").ToString - Dim Puesto As String = Row("Puesto").ToString - Dim Turno As String = Row("Turno").ToString - Dim TipoContrato As String = Row("Tipo Contrato").ToString - Dim Departamento As String = Row("Departamento").ToString - Dim TipoPeriodo As String = Row("Tipo Periodo").ToString - Dim Escolaridad As String = Row("Escolaridad").ToString - Dim SDI As String = Row("SDI").ToString - Dim MetodoPago As String = Row("Metodo Pago").ToString - Dim Nominista As String = Row("Nominista").ToString - - 'CLAVES - Dim CveGenero As Integer = 0 - Dim CveEstadoCivil As Integer = 0 - Dim CveEstatusPersonal As Integer = 0 - ' Dim CveSucursal As Integer = GlobalDTSucursales(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveSucursal").ToString.ToEntero - Dim CvePuesto As Integer = GlobalDTRHPuestos(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CvePuesto", $"Puesto = '{Puesto}'").ToString.ToEntero - Dim CveTurno As Integer = GlobalDTTurno().FiltraParametros($"CveEmpresa = {UsuarioActual.CveEmpresa}").FiltroPrimeroValor("CveTurno", $"Turno = '{Turno}'").ToString.ToEntero - Dim CveDepartamento As Integer = GlobalDTDepartamentos().FiltraParametros($"CveEmpresa = {UsuarioActual.CveEmpresa}").FiltroPrimeroValor("CveDepartamento", $"Departamento = '{Departamento}'").ToString.ToEntero - Dim CveEstado As Integer = GlobalDTGralEstados(1).FiltroPrimeroValor("CveEstado", $"Clave = '{Estado}'").ToString.ToEntero - Dim CveTipoContrato As Integer = GlobalDTTiposContrato().FiltroPrimeroValor("CveTipoContrato", $"TipoContrato = '{TipoContrato}'").ToString.ToEntero - Dim CveTipoPeriodo As Integer = GlobalDTTipoPeriodo().FiltroPrimeroValor("CveTipoPeriodo", $"TipoPeriodo = '{TipoPeriodo}'").ToString.ToEntero - Dim CveEscolaridad As Integer = GlobalDTEscolaridad().FiltroPrimeroValor("CveEscolaridad", $"Escolaridad = '{Escolaridad}'").ToString.ToEntero - Dim CveMetodoPago As Integer = GlobalDTMetodosPago().FiltroPrimeroValor("CveMetodoPago", $"ClaveSAT = '{MetodoPago}'").ToString.ToEntero - Dim CveUsuarioNomina As Integer = GlobalDTUsuarios(-1, -1).FiltroPrimeroValor("CveUsuario", $"Nombre = '{Nominista}'").ToString.ToEntero - - Dim FechaIn As Date - Dim FechaFn As Date - Dim FechaNac As Date - FechaIn = If(IsDate(FechaIngreso), FechaIngreso.ToDate, MinFecha) - FechaFn = If(IsDate(FechaBaja), FechaBaja.ToDate, MinFecha) - FechaNac = If(IsDate(FechaNacimiento), FechaNacimiento.ToDate, MinFecha) - - 'VALIDACIONES - ' If Not CveSucursal > 0 Then Alert("La Empresa no cuenta con Sucursal, es necesario dar una Sucursal de alta.", TipoMensaje.MsgAdvertencia) : ErrorRH = True : Exit For - If Not CveDepartamento > 0 Then Alert($"No se encontró el Departamento: {Departamento} Renglón: {NumRow}: ", TipoMensaje.MsgAdvertencia) : ErrorRH = True : Exit For - If Not CvePuesto > 0 Then Alert($"No se encontró el Puesto: {Puesto} Renglón: {NumRow}: ", TipoMensaje.MsgAdvertencia) : ErrorRH = True : Exit For - If Not CveTurno > 0 Then Alert($"No se encontró el turno: {Turno} Renglón: {NumRow}: ", TipoMensaje.MsgAdvertencia) : ErrorRH = True : Exit For - If Not CveEstado > 0 Then Alert($"No se encontró el Estado: {Estado} Renglón: {NumRow}: ", TipoMensaje.MsgAdvertencia) : ErrorRH = True : Exit For - If Not CveTipoContrato > 0 Then Alert($"No se encontró el Tipo Contrato: {TipoContrato} Renglón: {NumRow}: ", TipoMensaje.MsgAdvertencia) : ErrorRH = True : Exit For - If Not CveTipoPeriodo > 0 Then Alert($"No se encontró el Tipo Periodo: {TipoPeriodo} Renglón: {NumRow}: ", TipoMensaje.MsgAdvertencia) : ErrorRH = True : Exit For - If Not CveEscolaridad > 0 Then Alert($"No se encontró el Escolaridad: {Escolaridad} Renglón: {NumRow}: ", TipoMensaje.MsgAdvertencia) : ErrorRH = True : Exit For - If Not CveMetodoPago > 0 Then Alert($"No se encontró el Método de Pago: {MetodoPago} Renglón: {NumRow}: ", TipoMensaje.MsgAdvertencia) : ErrorRH = True : Exit For - If Not CveUsuarioNomina > 0 Then CveUsuarioNomina = -1 'Alert("No se encontró el Nominista: " + Nominista + " Renglón: " + NumRow, TipoMensaje.MsgAdvertencia) : ErrorRH = True : Exit For - - - Dim NombreCompleto As String = $"{Nombre} {ApellidoPaterno} {ApellidoMaterno}" - Dim CvePersonal As Integer = GlobalDTRHPersonal(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CvePersonal", $"NombreCompletoNombre = '{NombreCompleto}'").ToString.ToEntero - - - 'PENDIENTES POR MEJORAR - Dim CveSATRegimenContratacion As Integer = 1 - Dim CveSATRiesgoPuesto As Integer = 1 - Dim CveJornada As Integer = 1 - - If Sexo = "Masculino" Then CveGenero = 1 Else CveGenero = 2 - If AltaIMSS = "SI" Then AltaIMSS = "True" Else AltaIMSS = "False" - - Select Case EstadoCivil - Case "SOLTERO" - CveEstadoCivil = 1 - Case "CASADO" - CveEstadoCivil = 2 - Case "DIVORCIADO" - CveEstadoCivil = 3 - Case "UNIÓN LIBRE" - CveEstadoCivil = 4 - Case "VIUDO" - CveEstadoCivil = 5 - Case Else - CveEstadoCivil = 1 - End Select - - Select Case EstatusPersonal - Case "ACTIVO" - CveEstatusPersonal = 1 - Case "INACTIVO" - CveEstatusPersonal = 2 - Case "REINGRESO" - CveEstatusPersonal = 5 - Case Else - CveEstatusPersonal = 1 - End Select - - If CvePersonal > 0 Then - Contador = Contador + 1 - Else - If Not ObjRH.AddPersonal(Codigo, ApellidoPaterno, ApellidoMaterno, Nombre, CorreoElectronico, FechaIn, CveTipoPeriodo, NumeroSS, CBool(AltaIMSS), SalarioDiario.ToDouble, SalarioDiario.ToDouble, SDI.ToDouble, SalarioDiario.ToDouble, - -1, -1, -1, CveMetodoPago, FechaIn, FechaFn.ToString, CveTipoContrato, Direccion, CveTurno, CvePuesto, CveDepartamento, -1, CveEscolaridad, CveEstadoCivil, CveGenero, -1, FechaBaja, CveEstatusPersonal, FechaNac, - LugarNacimiento, Direccion, "", "", "", CodigoPostal, Ciudad, CveEstado, Telefono, Celular, RFC, CURP, NombrePadre, NombreMadre, -1, CveSATRiesgoPuesto, CveSATRegimenContratacion, -1, -1, "", -1, - ClabeInterbancaria, "", CveJornada, CveJornada, "", -1, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveUsuarioNomina) Then - ErrorRH = True - Exit For - End If - End If - - NumRow = NumRow + 1 - Next - - - If Not ErrorRH Then - If Contador > 0 Then - Alert(String.Format("Se agregaron: {0} Empleados correctamente.
    Se Omitieron: {1} Empleados ya que ya se encontraban registrados.", NumRows - Contador, Contador), TipoMensaje.MsgInformacion) - ObjRH.Commit() - TxtExcel.Text = "" - UpDatos.Update() - Else - Alert(String.Format("Se agregaron: {0} Empleados correctamente.", NumRows), TipoMensaje.MsgInformacion) - ObjRH.Commit() - TxtExcel.Text = "" - UpDatos.Update() - End If - Else - ObjRH.RollBack() - End If - - Catch ex As Exception - GuardaLog($"Ocurrio un error al insertar el personal.: {ex}") - ObjRH.RollBack() - - Finally - ObjRH.Dispose() - End Try + UpPersonal(dt) ' A F - A C T I V O F I J O @@ -2023,7 +1729,7 @@ Partial Class General_SaldosIniciales If YaExiste = False Then If IdCuenta > 0 Then - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovto, Importe, "", 95, Concepto, Now.toDate, -1, -1, ImporteMX:=Importe, CveSubProyecto:=CveSubProyecto, CveCuenta:=IdCuenta) Then + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovto, Importe, "", 95, Concepto, Now.ToDate, -1, -1, ImporteMX:=Importe, CveSubProyecto:=CveSubProyecto, CveCuenta:=IdCuenta) Then TieneError = True Exit For End If @@ -2138,7 +1844,8 @@ Partial Class General_SaldosIniciales ElseIf RblFormato.SelectedValue = "5" Then Directorio = ModExtensiones.DirectorioBaseEmpresas & "Empresas\Grales\SaldosIniciales\FormatoPS.xlsx" ElseIf RblFormato.SelectedValue = "6" Then - Directorio = ModExtensiones.DirectorioBaseEmpresas & "Empresas\Grales\SaldosIniciales\FormatoRH-Personal.xlsx" + 'Directorio = ModExtensiones.DirectorioBaseEmpresas & "Empresas\Grales\SaldosIniciales\FormatoRH-Personal.xlsx" + LnkCargaMasiva_Click(Nothing, Nothing) ElseIf RblFormato.SelectedValue = "7" Then Directorio = ModExtensiones.DirectorioBaseEmpresas & "Empresas\Grales\SaldosIniciales\FormatoAF-ActivosFijos.xlsx" ElseIf RblFormato.SelectedValue = "8" Then @@ -2150,20 +1857,749 @@ Partial Class General_SaldosIniciales ElseIf RblFormato.SelectedValue = "12" Then Directorio = ModExtensiones.DirectorioBaseEmpresas & "Empresas\Grales\SaldosIniciales\FormatoAlmacen.xlsx" End If + If Not (Directorio = "") Then - Dim Archivo As New IO.FileInfo(Directorio) - If Archivo.Exists Then - Response.Clear() - Response.ClearHeaders() - Response.ClearContent() - Response.AddHeader("Content-Disposition", "attachment; filename=" + Archivo.Name) - Response.AddHeader("Content-Length", Archivo.Length.ToString()) - Response.ContentType = "text/plain" - Response.Flush() - Response.TransmitFile(Archivo.FullName) - Response.End() + Dim Archivo As New IO.FileInfo(Directorio) + If Archivo.Exists Then + Response.Clear() + Response.ClearHeaders() + Response.ClearContent() + Response.AddHeader("Content-Disposition", "attachment; filename=" + Archivo.Name) + Response.AddHeader("Content-Length", Archivo.Length.ToString()) + Response.ContentType = "text/plain" + Response.Flush() + Response.TransmitFile(Archivo.FullName) + Response.End() + End If End If End Sub + Public Function validaRHPersonal(dt As DataTable) As Boolean + Return True + + If Not dt.Columns(0).ColumnName = "Código" Then + Alert("El nombre de la primera columna debe ser 'Código'. Favor de corregirlo", TipoMensaje.MsgError) + Return False + End If + + If Not dt.Columns(1).ColumnName = "Apellido Paterno" Then + Alert("El nombre de la segunda columna debe ser 'Apellido Paterno'. Favor de corregirlo", TipoMensaje.MsgError) + Return False + End If + + If Not dt.Columns(2).ColumnName = "Apellido Materno" Then + Alert("El nombre de la tercera columna debe ser 'Apellido Materno'. Favor de corregirlo", TipoMensaje.MsgError) + Return False + End If + + If Not dt.Columns(3).ColumnName = "Nombre" Then + Alert("El nombre de la cuarta columna debe ser 'Nombre'. Favor de corregirlo", TipoMensaje.MsgError) + Return False + End If + + If Not dt.Columns(4).ColumnName = "Correo Electronico" Then + Alert("El nombre de la quinta columna debe ser 'Correo Electronico'. Favor de corregirlo", TipoMensaje.MsgError) + Return False + End If + + If Not dt.Columns(5).ColumnName = "Fecha Nacimiento" Then + Alert("El nombre de la sexta columna debe ser 'Fecha Nacimiento'. Favor de corregirlo", TipoMensaje.MsgError) + Return False + End If + + If Not dt.Columns(6).ColumnName = "Sexo" Then + Alert("El nombre de la séptima columna debe ser 'Sexo'. Favor de corregirlo", TipoMensaje.MsgError) + Return False + End If + + If Not dt.Columns(7).ColumnName = "Lugar Nacimiento" Then + Alert("El nombre de la octava columna debe ser 'Lugar Nacimiento'. Favor de corregirlo", TipoMensaje.MsgError) + Return False + End If + + If Not dt.Columns(8).ColumnName = "Dirección" Then + Alert("El nombre de la novena columna debe ser 'Dirección'. Favor de corregirlo", TipoMensaje.MsgError) + Return False + End If + + If Not dt.Columns(9).ColumnName = "Ciudad" Then + Alert("El nombre de la décima columna debe ser 'Ciudad'. Favor de corregirlo", TipoMensaje.MsgError) + Return False + End If + + If Not dt.Columns(10).ColumnName = "Estado Civil" Then + Alert("El nombre de la onceava columna debe ser 'Estado Civil'. Favor de corregirlo", TipoMensaje.MsgError) + Return False + End If + + If Not dt.Columns(11).ColumnName = "Teléfono" Then + Alert("El nombre de la doceava columna debe ser 'Teléfono'. Favor de corregirlo", TipoMensaje.MsgError) + Return False + End If + + If Not dt.Columns(12).ColumnName = "Celular" Then + Alert("El nombre de la treceava columna debe ser 'Celular'. Favor de corregirlo", TipoMensaje.MsgError) + Return False + End If + + If Not dt.Columns(13).ColumnName = "RFC" Then + Alert("El nombre de la catorceava columna debe ser 'RFC'. Favor de corregirlo", TipoMensaje.MsgError) + Return False + End If + + If Not dt.Columns(14).ColumnName = "CURP" Then + Alert("El nombre de la quinceava columna debe ser 'CURP'. Favor de corregirlo", TipoMensaje.MsgError) + Return False + End If + If Not dt.Columns(15).ColumnName = "Numero SS" Then + Alert("El nombre de la diesciseisava columna debe ser 'Numero SS'. Favor de corregirlo", TipoMensaje.MsgError) + Return False + End If + If Not dt.Columns(16).ColumnName = "CLABE" Then + Alert("El nombre de la diescisieteava columna debe ser 'CLABE'. Favor de corregirlo", TipoMensaje.MsgError) + Return False + End If + + If Not dt.Columns(17).ColumnName = "Fecha Ingreso" Then + Alert("El nombre de la dieciochoava columna debe ser 'Fecha Ingreso'. Favor de corregirlo", TipoMensaje.MsgError) + Return False + End If + If Not dt.Columns(18).ColumnName = "Fecha Baja" Then + Alert("El nombre de la diecinueveava columna debe ser 'Fecha Baja'. Favor de corregirlo", TipoMensaje.MsgError) + Return False + End If + + If Not dt.Columns(19).ColumnName = "Alta IMSS" Then + Alert("El nombre de la veinteava columna debe ser 'Alta IMSS'. Favor de corregirlo", TipoMensaje.MsgError) + Return False + End If + + If Not dt.Columns(20).ColumnName = "Salario Diario" Then + Alert("El nombre de la veinteunava columna debe ser 'Salario Diario'. Favor de corregirlo", TipoMensaje.MsgError) + Return False + End If + + If Not dt.Columns(21).ColumnName = "Código Postal" Then + Alert("El nombre de la veintedosava columna debe ser 'Código Postal'. Favor de corregirlo", TipoMensaje.MsgError) + Return False + End If + If Not dt.Columns(22).ColumnName = "Estatus Personal" Then + Alert("El nombre de la veintetresava columna debe ser 'Estatus Personal'. Favor de corregirlo", TipoMensaje.MsgError) + Return False + End If + + If Not dt.Columns(23).ColumnName = "Estado" Then + Alert("El nombre de la veintecuatroava columna debe ser 'Estado'. Favor de corregirlo", TipoMensaje.MsgError) + Return False + End If + + If Not dt.Columns(24).ColumnName = "Nombre Padre" Then + Alert("El nombre de la veintecincoava columna debe ser 'Nombre Padre'. Favor de corregirlo", TipoMensaje.MsgError) + Return False + End If + + If Not dt.Columns(25).ColumnName = "Nombre Madre" Then + Alert("El nombre de la veinteseisava columna debe ser 'Nombre Madre'. Favor de corregirlo", TipoMensaje.MsgError) + Return False + End If + + If Not dt.Columns(26).ColumnName = "Puesto" Then + Alert("El nombre de la veintesieteava columna debe ser 'Puesto'. Favor de corregirlo", TipoMensaje.MsgError) + Return False + End If + + If Not dt.Columns(27).ColumnName = "Turno" Then + Alert("El nombre de la veinteochaava columna debe ser 'Turno'. Favor de corregirlo", TipoMensaje.MsgError) + Return False + End If + + If Not dt.Columns(28).ColumnName = "Tipo Contrato" Then + Alert("El nombre de la veintenueveava columna debe ser 'Tipo Contrato'. Favor de corregirlo", TipoMensaje.MsgError) + Return False + End If + End Function + Protected Sub UpPersonal(dt As DataTable) + + Dim NumRows As Integer = 0 + Dim ObjRH As New ClsRH + Try + ObjRH.IniciaTransacSQL() + Dim ErrorRH As Boolean = False + Dim Contador As Integer = 0 + Dim NumRow As Integer = 0 + + For Each Row As DataRow In dt.Rows + Dim myarraystr As String() + Dim Codigo As String = Row("Código").ToString + Dim ApellidoPaterno As String = Row("Apellido Paterno").ToString + Dim ApellidoMaterno As String = Row("Apellido Materno").ToString + Dim Nombre As String = Row("Nombre").ToString + Dim CorreoElectronico As String = Row("Correo Electronico").ToString + Dim FechaIngreso As String = Row("Fecha Ingreso").ToString + Dim FechaBaja As String = Row("Fecha Baja").ToString + Dim NumeroSS As String = Row("Numero SS").ToString + Dim AltaIMSS As String = Row("Alta IMSS").ToString + Dim SalarioDiario As String = Row("Salario Diario").ToString + Dim Direccion As String = Row("Dirección").ToString + Dim FechaNacimiento As String = Row("Fecha Nacimiento").ToString + Dim LugarNacimiento As String = Row("Lugar Nacimiento").ToString + Dim Sexo As String = Row("Sexo").ToString + Dim CodigoPostal As String = Row("Código Postal").ToString + Dim Ciudad As String = Row("Ciudad").ToString + Dim EstadoCivil As String = Row("Estado Civil").ToString.ToUpper + Dim Telefono As String = Row("Teléfono").ToString + Dim Celular As String = Row("Celular").ToString + Dim RFC As String = Row("RFC").ToString + Dim CURP As String = Row("CURP").ToString + Dim ClabeInterbancaria As String = Row("CLABE").ToString + Dim EstatusPersonal As String = Row("Estatus Personal").ToString.ToUpper + + 'Nuevas + Dim Estado As String = Row("Estado").ToString + Dim NombrePadre As String = Row("Nombre Padre").ToString + Dim NombreMadre As String = Row("Nombre Madre").ToString + Dim Puesto As String = Row("Puesto").ToString + Dim Turno As String = Row("Turno").ToString + Dim TipoContrato As String = Row("Tipo Contrato").ToString + Dim Departamento As String = Row("Departamento").ToString + Dim TipoPeriodo As String = Row("Tipo Periodo").ToString + Dim Escolaridad As String = Row("Escolaridad").ToString + Dim SDI As String = Row("SDI").ToString + Dim MetodoPago As String = Row("Metodo Pago").ToString + Dim Nominista As String = Row("Nominista").ToString + + 'CLAVES + Dim CveGenero As Integer = 0 + Dim CveEstadoCivil As Integer = 0 + Dim CveEstatusPersonal As Integer = 0 + ' Dim CveSucursal As Integer = GlobalDTSucursales(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveSucursal").ToString.ToEntero + Dim CvePuesto As Integer + Dim CveTurno As Integer + Dim CveDepartamento As Integer + Dim CveEstado As Integer + Dim CveTipoContrato As Integer + Dim CveTipoPeriodo As Integer + Dim CveEscolaridad As Integer + Dim CveMetodoPago As Integer + Dim CveUsuarioNomina As Integer + + myarraystr = Puesto.Split(":"c) + If (myarraystr.Length > 0) Then + CvePuesto = myarraystr(0).ToEntero() + Else + CvePuesto = GlobalDTRHPuestos(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CvePuesto", $"UPPER(Puesto) = ('{Puesto}')").ToString.ToEntero + + End If + If CvePuesto = 0 Then + CvePuesto = -1 + End If + myarraystr = Turno.Split(":"c) + If (myarraystr.Length > 0) Then + CveTurno = myarraystr(0).ToEntero() + Else + CveTurno = GlobalDTTurno().FiltraParametros($"CveEmpresa = {UsuarioActual.CveEmpresa}").FiltroPrimeroValor("CveTurno", $"Turno = '{Turno}'").ToString.ToEntero + End If + If CveTurno = 0 Then + CveTurno = -1 + End If + + myarraystr = Departamento.Split(":"c) + If (myarraystr.Length > 0) Then + CveDepartamento = myarraystr(0).ToEntero() + Else + + CveDepartamento = GlobalDTDepartamentos().FiltraParametros($"CveEmpresa = {UsuarioActual.CveEmpresa}").FiltroPrimeroValor("CveDepartamento", $"Departamento = '{Departamento}'").ToString.ToEntero + End If + If CveDepartamento <= 0 Then + CveDepartamento = -1 + End If + + myarraystr = Estado.Split(":"c) + If (myarraystr.Length > 0) Then + CveEstado = myarraystr(0).ToEntero() + Else + CveEstado = GlobalDTGralEstados(1).FiltroPrimeroValor("CveEstado", $"Clave = '{Estado}'").ToString.ToEntero + End If + If CveEstado = 0 Then + CveEstado = -1 + End If + + myarraystr = TipoContrato.Split(":"c) + If (myarraystr.Length > 0) Then + CveTipoContrato = myarraystr(0).ToEntero() + Else + CveTipoContrato = GlobalDTTiposContrato().FiltroPrimeroValor("CveTipoContrato", $"TipoContrato = '{TipoContrato}'").ToString.ToEntero + End If + If CveTipoContrato = 0 Then + CveTipoContrato = -1 + End If + + myarraystr = TipoPeriodo.Split(":"c) + If (myarraystr.Length > 0) Then + CveTipoPeriodo = myarraystr(0).ToEntero() + Else + CveTipoPeriodo = GlobalDTTipoPeriodo().FiltroPrimeroValor("CveTipoPeriodo", $"TipoPeriodo = '{TipoPeriodo}'").ToString.ToEntero + End If + If CveTipoPeriodo = 0 Then + CveTipoPeriodo = -1 + End If + + myarraystr = Escolaridad.Split(":"c) + If (myarraystr.Length > 0) Then + CveEscolaridad = myarraystr(0).ToEntero() + Else + CveEscolaridad = GlobalDTEscolaridad().FiltroPrimeroValor("CveEscolaridad", $"Escolaridad = '{Escolaridad}'").ToString.ToEntero + End If + If CveEscolaridad = 0 Then + CveEscolaridad = -1 + End If + + + + + + + myarraystr = MetodoPago.Split(":"c) + If (myarraystr.Length > 0) Then + CveMetodoPago = myarraystr(0).ToEntero() + Else + CveMetodoPago = GlobalDTMetodosPago().FiltroPrimeroValor("CveMetodoPago", $"ClaveSAT = '{MetodoPago}'").ToString.ToEntero + End If + If CveMetodoPago = 0 Then + CveMetodoPago = -1 + End If + + myarraystr = Nominista.Split(":"c) + If (myarraystr.Length > 0) Then + CveUsuarioNomina = myarraystr(0).ToEntero() + Else + CveUsuarioNomina = GlobalDTUsuarios(-1, -1).FiltroPrimeroValor("CveUsuario", $"Nombre = '{Nominista}'").ToString.ToEntero + End If + If CveUsuarioNomina = 0 Then + CveUsuarioNomina = -1 + End If + + Dim FechaIn As Date + Dim FechaFn As Date + Dim FechaNac As Date + FechaIn = If(IsDate(FechaIngreso), FechaIngreso.ToDate, MinFecha) + FechaFn = If(IsDate(FechaBaja), FechaBaja.ToDate, MinFecha) + FechaNac = If(IsDate(FechaNacimiento), FechaNacimiento.ToDate, MinFecha) + + 'VALIDACIONES + ' If Not CveSucursal > 0 Then Alert("La Empresa no cuenta con Sucursal, es necesario dar una Sucursal de alta.", TipoMensaje.MsgAdvertencia) : ErrorRH = True : Exit For + If Not CveDepartamento > 0 Then Alert($"No se encontró el Departamento: {Departamento} Renglón: {NumRow}: ", TipoMensaje.MsgAdvertencia) : ErrorRH = True : Exit For + If Not CvePuesto > 0 Then Alert($"No se encontró el Puesto: {Puesto} Renglón: {NumRow}: ", TipoMensaje.MsgAdvertencia) : ErrorRH = True : Exit For + If Not CveTurno > 0 Then Alert($"No se encontró el turno: {Turno} Renglón: {NumRow}: ", TipoMensaje.MsgAdvertencia) : ErrorRH = True : Exit For + If Not CveEstado > 0 Then Alert($"No se encontró el Estado: {Estado} Renglón: {NumRow}: ", TipoMensaje.MsgAdvertencia) : ErrorRH = True : Exit For + If Not CveTipoContrato > 0 Then Alert($"No se encontró el Tipo Contrato: {TipoContrato} Renglón: {NumRow}: ", TipoMensaje.MsgAdvertencia) : ErrorRH = True : Exit For + If Not CveTipoPeriodo > 0 Then Alert($"No se encontró el Tipo Periodo: {TipoPeriodo} Renglón: {NumRow}: ", TipoMensaje.MsgAdvertencia) : ErrorRH = True : Exit For + If Not CveEscolaridad > 0 Then Alert($"No se encontró el Escolaridad: {Escolaridad} Renglón: {NumRow}: ", TipoMensaje.MsgAdvertencia) : ErrorRH = True : Exit For + If Not CveMetodoPago > 0 Then Alert($"No se encontró el Método de Pago: {MetodoPago} Renglón: {NumRow}: ", TipoMensaje.MsgAdvertencia) : ErrorRH = True : Exit For + If Not CveUsuarioNomina > 0 Then CveUsuarioNomina = -1 'Alert("No se encontró el Nominista: " + Nominista + " Renglón: " + NumRow, TipoMensaje.MsgAdvertencia) : ErrorRH = True : Exit For + + + Dim NombreCompleto As String = $"{Nombre} {ApellidoPaterno} {ApellidoMaterno}" + Dim CvePersonal As Integer = GlobalDTRHPersonal(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CvePersonal", $"NombreCompletoNombre = '{NombreCompleto}'").ToString.ToEntero() + + + 'PENDIENTES POR MEJORAR + Dim CveSATRegimenContratacion As Integer = 1 + Dim CveSATRiesgoPuesto As Integer = 1 + Dim CveJornada As Integer = 1 + + If Sexo.ToUpper.Contains("Masculino") Then CveGenero = 1 Else CveGenero = 2 + If AltaIMSS.ToUpper.Contiene("SI", "1") Then AltaIMSS = "True" Else AltaIMSS = "False" + myarraystr = EstadoCivil.Split(":"c) + If (myarraystr.Length > 0) Then + CveEstadoCivil = myarraystr(0).ToEntero() + End If + 'Select Case EstadoCivil + ' Case "SOLTERO" + ' CveEstadoCivil = 1 + ' Case "CASADO" + ' CveEstadoCivil = 2 + ' Case "DIVORCIADO" + ' CveEstadoCivil = 3 + ' Case "UNIÓN LIBRE" + ' CveEstadoCivil = 4 + ' Case "VIUDO" + ' CveEstadoCivil = 5 + ' Case Else + ' CveEstadoCivil = 1 + 'End Select + + myarraystr = EstatusPersonal.Split(":"c) + If (myarraystr.Length > 0) Then + CveEstatusPersonal = myarraystr(0).ToEntero() + End If + 'Select Case EstatusPersonal + ' Case "ACTIVO" + ' CveEstatusPersonal = 1 + ' Case "INACTIVO" + ' CveEstatusPersonal = 2 + ' Case "REINGRESO" + ' CveEstatusPersonal = 5 + ' Case Else + ' CveEstatusPersonal = 1 + 'End Select + + If CvePersonal > 0 Then + Contador = Contador + 1 + Else + If Not ObjRH.AddPersonal(Codigo, ApellidoPaterno, ApellidoMaterno, Nombre, CorreoElectronico, FechaIn, CveTipoPeriodo, NumeroSS, CBool(AltaIMSS), SalarioDiario.ToDouble, SalarioDiario.ToDouble, SDI.ToDouble, SalarioDiario.ToDouble, + -1, -1, -1, CveMetodoPago, FechaIn, FechaFn.ToString, CveTipoContrato, Direccion, CveTurno, CvePuesto, CveDepartamento, -1, CveEscolaridad, CveEstadoCivil, CveGenero, -1, FechaBaja, CveEstatusPersonal, FechaNac, + LugarNacimiento, Direccion, "", "", "", CodigoPostal, Ciudad, CveEstado, Telefono, Celular, RFC, CURP, NombrePadre, NombreMadre, -1, CveSATRiesgoPuesto, CveSATRegimenContratacion, -1, -1, "", -1, + ClabeInterbancaria, "", CveJornada, CveJornada, "", -1, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveUsuarioNomina) Then + ErrorRH = True + Exit For + End If + End If + + NumRow = NumRow + 1 + Next + + + If Not ErrorRH Then + If Contador > 0 Then + Alert(String.Format("Se agregaron: {0} Empleados correctamente.
    Se Omitieron: {1} Empleados ya que ya se encontraban registrados.", NumRows - Contador, Contador), TipoMensaje.MsgInformacion) + ObjRH.Commit() + TxtExcel.Text = "" + UpDatos.Update() + Else + Alert(String.Format("Se agregaron: {0} Empleados correctamente.", NumRows), TipoMensaje.MsgInformacion) + ObjRH.Commit() + TxtExcel.Text = "" + UpDatos.Update() + End If + Else + ObjRH.RollBack() + End If + + Catch ex As Exception + GuardaLog($"Ocurrio un error al insertar el personal.: {ex}") + ObjRH.RollBack() + + Finally + ObjRH.Dispose() + End Try + End Sub + Protected Sub LnkCargaMasiva_Click(sender As Object, e As EventArgs) + Dim wb As ClosedXML.Excel.XLWorkbook = New ClosedXML.Excel.XLWorkbook() + Dim libro = wb.AddWorksheet("Personal") + Dim crow As Integer = 1 + Dim ccol As Integer = 1 + + Dim colLugarNacimiento As Integer = 1 + Dim rowLugarNacimiento As Integer = 1 + +#Region "Regimen de contratación" + Dim Catalogos = wb.AddWorksheet("Catalogos") + crow = 1 + ccol = 1 + Dim colRegimenContratacion As Integer = 1 + Dim rowRegimenContratacion As Integer = 1 + Catalogos.Cell(crow, ccol).Value = "Regimen de contratación" + For Each row As DataRow In GlobalDTNomSatRegimenContratacion.Rows + crow = crow + 1 + Catalogos.Cell(crow, ccol).Value = String.Format("{0}: {1}", row("CveSATRegimenContratacion"), row("RegimenContratacion")) + Next + colRegimenContratacion = ccol + rowRegimenContratacion = crow +#End Region +#Region "Estado civil" + Dim colEstadoCivil As Integer = 1 + Dim rowEstadoCivil As Integer = 1 + crow = 1 + ccol = ccol + 1 + Catalogos.Cell(crow, ccol).Value = "Estado civil" + For Each row As DataRow In GlobalDTEstadoCivil.Rows + crow = crow + 1 + Catalogos.Cell(crow, ccol).Value = String.Format("{0}: {1}", row("CveEstadoCivil"), row("EstadoCivil")) + Next + colEstadoCivil = ccol + rowEstadoCivil = crow +#End Region +#Region "Escolaridad" + Dim colEscolaridad As Integer = 1 + Dim rowEscolaridad As Integer = 1 + crow = 1 + ccol = ccol + 1 + Catalogos.Cell(crow, ccol).Value = "Escolaridad" + For Each row As DataRow In GlobalDTEscolaridad.Rows + crow = crow + 1 + Catalogos.Cell(crow, ccol).Value = String.Format("{0}: {1}", row("CveEscolaridad"), row("Escolaridad")) + Next + colEscolaridad = ccol + rowEscolaridad = crow + +#End Region +#Region "Tipo Periodo" + Dim colTipoPeriodo As Integer = 1 + Dim rowTipoPeriodo As Integer = 1 + crow = 1 + ccol = ccol + 1 + Catalogos.Cell(crow, ccol).Value = "Tipo Periodo" + For Each row As DataRow In GlobalDTTipoPeriodo.Rows + crow = crow + 1 + Catalogos.Cell(crow, ccol).Value = String.Format("{0}: {1}", row("CveTipoPeriodo"), row("TipoPeriodo")) + Next + colTipoPeriodo = ccol + rowTipoPeriodo = crow + +#End Region +#Region "Estatus" + Dim colEstatusPersonal As Integer = 1 + Dim rowEstatusPersonal As Integer = 1 + crow = 1 + ccol = ccol + 1 + Catalogos.Cell(crow, ccol).Value = "Estatus" + For Each row As DataRow In GlobalDTEstatusPersonal.Rows + crow = crow + 1 + Catalogos.Cell(crow, ccol).Value = String.Format("{0}: {1}", row("CveEstatusPersonal"), row("EstatusPersonal")) + Next + colEstatusPersonal = ccol + rowEstatusPersonal = crow + +#End Region +#Region "Tipo Contratro" + Dim colTipoContrato As Integer = 1 + Dim rowTipoContrato As Integer = 1 + crow = 1 + ccol = ccol + 1 + Catalogos.Cell(crow, ccol).Value = "Tipo Contratro" + For Each row As DataRow In GlobalDTTiposContrato.Rows + crow = crow + 1 + Catalogos.Cell(crow, ccol).Value = String.Format("{0}", row("TipoContrato")) + Next + colTipoContrato = ccol + rowTipoContrato = crow + +#End Region +#Region "Departamento" + Dim colDepartamento As Integer = 1 + Dim rowDepartamento As Integer = 1 + crow = 1 + ccol = ccol + 1 + Catalogos.Cell(crow, ccol).Value = "Departamento" + For Each row As DataRow In GlobalDTDepartamentos.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa).Rows + crow = crow + 1 + Catalogos.Cell(crow, ccol).Value = String.Format("{0}: {1}", row("CveDepartamento"), row("Departamento")) + Next + colDepartamento = ccol + rowDepartamento = crow + +#End Region +#Region "Turno" + Dim colTurno As Integer = 1 + Dim rowTurno As Integer = 1 + crow = 1 + ccol = ccol + 1 + Catalogos.Cell(crow, ccol).Value = "Turno" + For Each row As DataRow In GlobalDTTurno.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa).Rows + crow = crow + 1 + Catalogos.Cell(crow, ccol).Value = String.Format("{0}: {1}", row("CveTurno"), row("Turno")) + Next + colTurno = ccol + rowTurno = crow + +#End Region +#Region "Puesto" + Dim colPuesto As Integer = 1 + Dim rowPuesto As Integer = 1 + crow = 1 + ccol = ccol + 1 + Catalogos.Cell(crow, ccol).Value = "Puesto" + For Each row As DataRow In GlobalDTRHPuestos(UsuarioActual.CveEmpresa).Rows + crow = crow + 1 + Catalogos.Cell(crow, ccol).Value = String.Format("{0}: {1}", row("CvePuesto"), row("Puesto")) + Next + colPuesto = ccol + rowPuesto = crow + +#End Region +#Region "Estado" + Dim colEstado As Integer = 1 + Dim rowEstado As Integer = 1 + crow = 1 + ccol = ccol + 1 + Catalogos.Cell(crow, ccol).Value = "Estado" + For Each row As DataRow In GlobalDTGralEstados(1).Rows + crow = crow + 1 + Catalogos.Cell(crow, ccol).Value = String.Format("{0}: {1}", row("CveEstado"), row("Estado")) + Next + colEstado = ccol + rowEstado = crow + +#End Region +#Region "Tipo salario" + + Dim colTipoSalario As Integer = 1 + Dim rowTipoSalario As Integer = 1 + + crow = 1 + ccol = ccol + 1 + Catalogos.Cell(crow, ccol).Value = "Tipo salario" + crow = crow + 1 + Catalogos.Cell(crow, ccol).Value = "1: Salario fijo" + crow = crow + 1 + Catalogos.Cell(crow, ccol).Value = "2: Salario variable" + crow = crow + 1 + Catalogos.Cell(crow, ccol).Value = "3: Salario mixto" + colTipoSalario = ccol + rowTipoSalario = crow + +#End Region +#Region "Genero" + Dim colSexo As Integer = 1 + Dim rowSexo As Integer = 1 + crow = 1 + ccol = ccol + 1 + Catalogos.Cell(crow, ccol).Value = "Genero" + crow = crow + 1 + Catalogos.Cell(crow, ccol).Value = "1: Masculino" + crow = crow + 1 + Catalogos.Cell(crow, ccol).Value = "2: Femenino" + colSexo = ccol + rowSexo = crow + +#End Region +#Region "Sindicalizado" + Dim colsindicalizado As Integer = 1 + Dim rowsindicalizado As Integer = 1 + crow = 1 + ccol = ccol + 1 + Catalogos.Cell(crow, ccol).Value = "Sindicalizado" + crow = crow + 1 + Catalogos.Cell(crow, ccol).Value = "1: Sí" + crow = crow + 1 + Catalogos.Cell(crow, ccol).Value = "0: No" + colsindicalizado = ccol + rowsindicalizado = crow + +#End Region +#Region "Area geografica" + Dim colAreaGeografica As Integer = 1 + Dim rowAreaGeografica As Integer = 1 + crow = 1 + ccol = ccol + 1 + Catalogos.Cell(crow, ccol).Value = "Area geografica" + crow = crow + 1 + Catalogos.Cell(crow, ccol).Value = "A" + crow = crow + 1 + Catalogos.Cell(crow, ccol).Value = "B" + crow = crow + 1 + Catalogos.Cell(crow, ccol).Value = "C" + colAreaGeografica = ccol + rowAreaGeografica = crow + +#End Region +#Region "Metodo pago" + Dim colmetodopago = 0 + Dim rowmetodopago = 0 + crow = 1 + ccol = ccol + 1 + Catalogos.Cell(crow, ccol).Value = "Metodo pago" + For Each row As DataRow In GlobalDTMetodosPago.Rows + crow = crow + 1 + Catalogos.Cell(crow, ccol).Value = String.Format("{0}: {1}", row("CveMetodoPago"), row("MetodoPago")) + Next + colmetodopago = ccol + rowmetodopago = crow + +#End Region + +#Region "subproyecto" + Dim colsubproyecto = 0 + Dim rowsubproyecto = 0 + crow = 1 + ccol = ccol + 1 + Catalogos.Cell(crow, ccol).Value = "subproyecto" + Dim dtsubproyecto = If(Not UsuarioActual.TienePermisoProceso(110), GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, 1), GlobalDTSubProyectos(-1, -1, UsuarioActual.CveEmpresa, 1)) + For Each row As DataRow In dtsubproyecto.Rows + crow = crow + 1 + Catalogos.Cell(crow, ccol).Value = String.Format("{0}: {1}", row("CveSubProyecto"), row("SubProyecto")) + Next + colsubproyecto = ccol + rowsubproyecto = crow + +#End Region + Catalogos.Range(1, 1, 1, ccol).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(79, 129, 189)) + Catalogos.Range(1, 1, 1, ccol).Style.Font.FontColor = ClosedXML.Excel.XLColor.White + + crow = 1 + ccol = 1 + + libro.Cell(crow, ccol).Value = "Código" : ccol = ccol + 1 + libro.Cell(crow, ccol).Value = "Apellido Paterno" : ccol = ccol + 1 + libro.Cell(crow, ccol).Value = "Apellido Materno" : ccol = ccol + 1 + libro.Cell(crow, ccol).Value = "Nombre" : ccol = ccol + 1 + libro.Cell(crow, ccol).Value = "Correo Electronico" : ccol = ccol + 1 + libro.Cell(crow, ccol).Value = "Fecha Nacimiento" : ccol = ccol + 1 + libro.Cell(crow, ccol).Value = "Sexo" : libro.Range(crow + 1, ccol, 50000, ccol).SetDataValidation().List(Catalogos.Range(2, colSexo, rowSexo, colSexo), True) : ccol = ccol + 1 + libro.Cell(crow, ccol).Value = "Lugar Nacimiento" : ccol = ccol + 1 + libro.Cell(crow, ccol).Value = "Dirección" : ccol = ccol + 1 + libro.Cell(crow, ccol).Value = "Ciudad" : ccol = ccol + 1 + libro.Cell(crow, ccol).Value = "Estado Civil" : libro.Range(crow + 1, ccol, 50000, ccol).SetDataValidation().List(Catalogos.Range(2, colEstadoCivil, rowEstadoCivil, colEstadoCivil), True) : ccol = ccol + 1 + libro.Cell(crow, ccol).Value = "Teléfono" : ccol = ccol + 1 + libro.Cell(crow, ccol).Value = "Celular" : ccol = ccol + 1 + libro.Cell(crow, ccol).Value = "RFC" : ccol = ccol + 1 + libro.Cell(crow, ccol).Value = "CURP" : ccol = ccol + 1 + libro.Cell(crow, ccol).Value = "Numero SS" : ccol = ccol + 1 + libro.Cell(crow, ccol).Value = "CLABE" : ccol = ccol + 1 + libro.Cell(crow, ccol).Value = "Fecha Ingreso" : ccol = ccol + 1 + libro.Cell(crow, ccol).Value = "Fecha Baja" : ccol = ccol + 1 + libro.Cell(crow, ccol).Value = "Alta IMSS" : ccol = ccol + 1 + libro.Cell(crow, ccol).Value = "Código Postal" : ccol = ccol + 1 + libro.Cell(crow, ccol).Value = "Estatus Personal" : libro.Range(crow + 1, ccol, 50000, ccol).SetDataValidation().List(Catalogos.Range(2, colEstatusPersonal, rowEstatusPersonal, colEstatusPersonal), True) : ccol = ccol + 1 + libro.Cell(crow, ccol).Value = "Estado" : libro.Range(crow + 1, ccol, 50000, ccol).SetDataValidation().List(Catalogos.Range(2, colEstado, rowEstado, colEstado), True) : ccol = ccol + 1 + libro.Cell(crow, ccol).Value = "Nombre Padre" : ccol = ccol + 1 + libro.Cell(crow, ccol).Value = "Nombre Madre" : ccol = ccol + 1 + libro.Cell(crow, ccol).Value = "Puesto" : libro.Range(crow + 1, ccol, 50000, ccol).SetDataValidation().List(Catalogos.Range(2, colPuesto, rowPuesto, colPuesto), True) : ccol = ccol + 1 + libro.Cell(crow, ccol).Value = "Turno" : libro.Range(crow + 1, ccol, 50000, ccol).SetDataValidation().List(Catalogos.Range(2, colTurno, rowTurno, colTurno), True) : ccol = ccol + 1 + libro.Cell(crow, ccol).Value = "Tipo Contrato" : libro.Range(crow + 1, ccol, 50000, ccol).SetDataValidation().List(Catalogos.Range(2, colTipoContrato, rowTipoContrato, colTipoContrato), True) : ccol = ccol + 1 + libro.Cell(crow, ccol).Value = "Departamento" : libro.Range(crow + 1, ccol, 50000, ccol).SetDataValidation().List(Catalogos.Range(2, colDepartamento, rowDepartamento, colDepartamento), True) : ccol = ccol + 1 + libro.Cell(crow, ccol).Value = "Tipo Periodo" : libro.Range(crow + 1, ccol, 50000, ccol).SetDataValidation().List(Catalogos.Range(2, colTipoPeriodo, rowTipoPeriodo, colTipoPeriodo), True) : ccol = ccol + 1 + libro.Cell(crow, ccol).Value = "Escolaridad" : libro.Range(crow + 1, ccol, 50000, ccol).SetDataValidation().List(Catalogos.Range(2, colEscolaridad, rowEscolaridad, colEscolaridad), True) : ccol = ccol + 1 + libro.Cell(crow, ccol).Value = "Salario Diario" : ccol = ccol + 1 + libro.Cell(crow, ccol).Value = "Tipo Salario" : libro.Range(crow + 1, ccol, 50000, ccol).SetDataValidation().List(Catalogos.Range(2, colTipoSalario, rowTipoSalario, colTipoSalario), True) : ccol = ccol + 1 + libro.Cell(crow, ccol).Value = "Salario variable" : ccol = ccol + 1 + libro.Cell(crow, ccol).Value = "Sindicalizado" : libro.Range(crow + 1, ccol, 50000, ccol).SetDataValidation().List(Catalogos.Range(2, colsindicalizado, rowsindicalizado, colsindicalizado), True) : ccol = ccol + 1 + libro.Cell(crow, ccol).Value = "SubProyecto " : libro.Range(crow + 1, ccol, 50000, ccol).SetDataValidation().List(Catalogos.Range(2, colsubproyecto, rowsubproyecto, colsubproyecto), True) : ccol = ccol + 1 + libro.Cell(crow, ccol).Value = "RegimenContratacion" : libro.Range(crow + 1, ccol, 50000, ccol).SetDataValidation().List(Catalogos.Range(2, colRegimenContratacion, rowRegimenContratacion, colRegimenContratacion), True) : ccol = ccol + 1 + libro.Cell(crow, ccol).Value = "Area Geografica" : libro.Range(crow + 1, ccol, 50000, ccol).SetDataValidation().List(Catalogos.Range(2, colAreaGeografica, rowAreaGeografica, colAreaGeografica), True) : ccol = ccol + 1 + libro.Cell(crow, ccol).Value = "Prima vacacional" : ccol = ccol + 1 + libro.Cell(crow, ccol).Value = "Dias aguinaldo" : ccol = ccol + 1 + libro.Cell(crow, ccol).Value = "Metodo Pago" : libro.Range(crow + 1, ccol, 50000, ccol).SetDataValidation().List(Catalogos.Range(2, colmetodopago, rowmetodopago, colmetodopago), True) : ccol = ccol + 1 + + + + + libro.Range(crow, 1, crow, ccol - 1).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(79, 129, 189)) + libro.Range(crow, 1, crow, ccol - 1).Style.Font.FontColor = ClosedXML.Excel.XLColor.White + + Catalogos.ColumnsUsed().AdjustToContents() + libro.ColumnsUsed().AdjustToContents() + 'AreaGeografica ABC + 'GlobalDTMetodosPago MetodoPago" DataValueField="CveMetodoPago + + + Dim fs As System.IO.Stream = New System.IO.MemoryStream() + wb.SaveAs(fs) + fs.Position = 0 + Dim memoryStream As System.IO.MemoryStream = New System.IO.MemoryStream() + + Using input As System.IO.Stream = fs + input.CopyTo(memoryStream) + End Using + + memoryStream.Position = 0 + Response.Clear() + Response.Buffer = True + Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" + Response.AddHeader("content-disposition", String.Format("attachment;filename=SaldosInicialesRH.xlsx", "")) + Response.BinaryWrite(memoryStream.ToArray()) + Response.[End]() + End Sub Private Function ReadExcelFile(ByVal flatFilePath As String, ByVal firstRowHasHeaders As Boolean) As DataTable SpreadsheetInfo.SetLicense(ModExtensiones.SerialGemBoxSpreadsheet) diff --git a/Nomina/ConceptoNomina.aspx b/Nomina/ConceptoNomina.aspx index fa44998ab..f691d8511 100644 --- a/Nomina/ConceptoNomina.aspx +++ b/Nomina/ConceptoNomina.aspx @@ -10,12 +10,14 @@ input[disabled="disabled"] ~ .CodeMirror.cm-s-material { cursor: not-allowed; } - input[disabled="disabled"] ~ .CodeMirror.cm-s-material input { - cursor: not-allowed; - } - input[disabled="disabled"] ~ .CodeMirror.cm-s-material pre { - cursor: not-allowed; - } + + input[disabled="disabled"] ~ .CodeMirror.cm-s-material input { + cursor: not-allowed; + } + + input[disabled="disabled"] ~ .CodeMirror.cm-s-material pre { + cursor: not-allowed; + } .CodeMirror-hints { z-index: 700; @@ -218,23 +220,23 @@
    -
    -
    -
    - - Fórmulas -
    -
    -
    - Actualizar + + +
    +
    +
    + + Fórmulas +
    +
    +
    + Actualizar +
    +
    -
    -
    -
    +
    - - @@ -254,9 +256,8 @@ - - - <%--
    + + <%--
    @@ -265,10 +266,10 @@
    --%> -
    -
    - - +
    +
    + +
    @@ -343,6 +344,13 @@
    + +
    + +
    + +
    +
    diff --git a/Nomina/ConceptoNomina.aspx.cs b/Nomina/ConceptoNomina.aspx.cs index ff61ea299..2c9f70bee 100644 --- a/Nomina/ConceptoNomina.aspx.cs +++ b/Nomina/ConceptoNomina.aspx.cs @@ -323,6 +323,22 @@ public partial class Nomina_CatConcepto : ClsPaginas { TieneError = !ObjNomina.UpdateConcepto(codigo, concepto, tipo, formula, sistema, estado, CveConceptoPadre, CveConcepto, retencion, CveClasificacion, IdCtaContable, CveTipoGasto, tipoCalculo, CveConceptoContable, AplicaFiniquito, AutomaticoGlobal, Especie, Imprimir, CveSATConcepto,UsuarioActual.CveEmpresa); + if(!TieneError) + { + if (ChkMovtoPermanente.Checked) + { + ObjNomina.UpdateConceptoFormula(CveConcepto, "FNC.[MovimientosPermanentes]", 1); + } + else + { + if(TxtFormulaTotal.Text == "FNC.[MovimientosPermanentes]") + { + // ObjNomina.UpdateConceptoFormula(CveConcepto, "FNC.[MovimientosPermanentes] ", 1); + } + } + } + + if (TieneError) { ObjNomina.RollBack(); @@ -337,6 +353,22 @@ public partial class Nomina_CatConcepto : ClsPaginas { CveConcepto = ObjNomina.AddConcepto(codigo, concepto, tipo, formula, sistema, estado, CveConceptoPadre, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, retencion, CveClasificacion, IdCtaContable, CveTipoGasto, tipoCalculo, CveConceptoContable, AplicaFiniquito, AutomaticoGlobal, Especie, Imprimir, CveSATConcepto); + + + if (CveConcepto>0) + { + if (ChkMovtoPermanente.Checked) + { + ObjNomina.UpdateConceptoFormula(CveConcepto, "FNC.[MovimientosPermanentes]", 1); + } + else + { + if (TxtFormulaTotal.Text == "FNC.[MovimientosPermanentes]") + { + // ObjNomina.UpdateConceptoFormula(CveConcepto, "FNC.[MovimientosPermanentes] ", 1); + } + } + } if (CveConcepto == -1) { ObjNomina.RollBack(); @@ -403,6 +435,9 @@ public partial class Nomina_CatConcepto : ClsPaginas DdlTipo.SelectedValueExist(drow["Tipo"]); TxtFormulaImporte.Text = drow["Formula"].ToString(); TxtFormulaTotal.Text = drow["FormulaTotal"].ToString(); + + ChkMovtoPermanente.Checked=(TxtFormulaTotal.Text == "FNC.[MovimientosPermanentes]"); + ChkMovtoPermanente_CheckedChanged(null, null); TxtFormulaGravada.Text = drow["FormulaGravada"].ToString(); if (drow["EsRetencion"].Equals("1")) ChkRetencion.Checked = true; if (drow["TipoCalculo"].Equals("True")) ChkTipoCalculo.Checked = true; @@ -529,4 +564,18 @@ public partial class Nomina_CatConcepto : ClsPaginas } } } + + protected void ChkMovtoPermanente_CheckedChanged(object sender, EventArgs e) + { + Divformula.Visible = !ChkMovtoPermanente.Checked; + //if (Divformula.Visible) + //{ + //TxtFormulaTotal.Text = ""; + //} + //else + //{ + // TxtFormulaTotal.Text = "FNC.[MovimientosPermanentes]"; + //} + + } } \ No newline at end of file diff --git a/Nomina/Finiquito.aspx b/Nomina/Finiquito.aspx index 2614371bf..8aff005bd 100644 --- a/Nomina/Finiquito.aspx +++ b/Nomina/Finiquito.aspx @@ -4,6 +4,16 @@ @@ -88,7 +88,7 @@ - + @@ -117,24 +117,9 @@ - + - - - - - - - - - - - - - - - - + diff --git a/RH/CalculoSBC.aspx.cs b/RH/CalculoSBC.aspx.cs index c715eed04..cddcad81f 100644 --- a/RH/CalculoSBC.aspx.cs +++ b/RH/CalculoSBC.aspx.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Data; using System.Linq; using System.Web; using System.Web.UI; @@ -27,12 +28,12 @@ public partial class RH_CalculoSBC : ClsPaginas { using (ClsNominas objnom = new ClsNominas()) { - if (objnom.GetCalculoSBC(UsuarioActual.CveEmpresa,DdlTipo.SelectedValue.ToEntero(), TxtFechaPago.Text)) + if (objnom.GetCalculoSBC(UsuarioActual.CveEmpresa, DdlTipo.SelectedValue.ToEntero(), TxtFechaPago.Text)) { GVCalculosSBC.DataSource = objnom.DTSetResultados.Tables[0]; GVCFija.DataSource = objnom.DTSetResultados.Tables[0]; GVPV.DataSource = objnom.DTSetResultados.Tables[0]; - if(objnom.DTSetResultados.Tables.Count > 0) + if (objnom.DTSetResultados.Tables.Count >1) { GVDetalleParteVariable.DataSource = objnom.DTSetResultados.Tables[1]; GVDetalleParteVariable.DataBind(); @@ -75,8 +76,8 @@ public partial class RH_CalculoSBC : ClsPaginas //} foreach (GridViewRow item in GVCalculosSBC.Rows) { - double SalarioDiarioSSNuevo =Math.Round( item.DataKey("SalarioDiarioSSNuevo").ToDouble(),2); - double SalarioDiarioSS = Math.Round(item.DataKey("SalarioDiarioSS").ToDouble(),2); + double SalarioDiarioSSNuevo = Math.Round(item.DataKey("SalarioDiarioSSNuevo").ToDouble(), 2); + double SalarioDiarioSS = Math.Round(item.DataKey("SalarioDiarioSS").ToDouble(), 2); if (SalarioDiarioSSNuevo != SalarioDiarioSS) { MovtosmodSalario = string.Format("{0}{1}{2}", MovtosmodSalario, concater, item.DataKey("Movtotxt")); @@ -113,9 +114,9 @@ public partial class RH_CalculoSBC : ClsPaginas int CvePersonal = item.DataKey("CvePersonal").ToEntero();//,,, double SalarioDiario = item.DataKey("SalarioDiario").ToDouble(); double SDINuevo = item.DataKey("SDINuevo").ToDouble(); - double SalarioDiarioSSNuevo = Math.Round(item.DataKey("SalarioDiarioSSNuevo").ToDouble(),2); + double SalarioDiarioSSNuevo = Math.Round(item.DataKey("SalarioDiarioSSNuevo").ToDouble(), 2); double SalarioVariableNuevo = item.DataKey("SalarioVariableNuevo").ToDouble(); - double SalarioDiarioSS = Math.Round(item.DataKey("SalarioDiarioSS").ToDouble(),2); + double SalarioDiarioSS = Math.Round(item.DataKey("SalarioDiarioSS").ToDouble(), 2); if (continuar && SalarioDiarioSSNuevo != SalarioDiarioSS && (continuar = objrh.UpdateSalarios(CvePersonal, fecha, UsuarioActual.CveEmpresa, SalarioDiario, SDINuevo, SalarioDiarioSSNuevo, SalarioDiario))) { @@ -141,22 +142,118 @@ public partial class RH_CalculoSBC : ClsPaginas protected void LnkDescargar_Click(object sender, EventArgs e) { - if (Tab.ActiveTab == TabSBC) + DataTable dt = GVToDT(GVCalculosSBC,"Salario"); + DataTable dtPF = GVToDT(GVCFija, "Parte fija"); + DataTable dtPV = GVToDT(GVPV, "Parte variable"); + DataTable dtPVD = GVToDT(GVDetalleParteVariable, "Detalle parte variable"); + + ClosedXML.Excel.XLWorkbook wb = new ClosedXML.Excel.XLWorkbook(); + var libro = wb.AddWorksheet(dt); + var libroPF = wb.AddWorksheet(dtPF); + var libroPV = wb.AddWorksheet(dtPV); + var libroPVD = wb.AddWorksheet(dtPVD); + libro.ColumnsUsed().AdjustToContents(); + libroPF.ColumnsUsed().AdjustToContents(); + libroPV.ColumnsUsed().AdjustToContents(); + libroPVD.ColumnsUsed().AdjustToContents(); + + + libro.ColumnsUsed().AdjustToContents(); + libro.Row(1).InsertRowsAbove(5); + libro.Range(1, 2, 1, 6).Merge().Value = UsuarioActual.Empresa.Empresa; + libro.Range(2, 2, 2, 6).Merge().Value = $"Reporte de calculo de sbc {TxtFechaPago.Text}."; + 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}"; + libro.Range(5, 6, 5, 9).Merge().Value = "Actual"; + libro.Range(5, 10, 5, 12).Merge().Value = "Nuevo"; + + libro.Range(5, 1, 6, 14).Style.Alignment.Horizontal = ClosedXML.Excel.XLAlignmentHorizontalValues.Center; + + libro.Range(5, 1, 6, 13).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(79, 129, 189)); + libro.Range(5, 1, 5, 13).Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.None; + + libro.Range(5, 6, 6, 9).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(128, 100, 162)); + libro.Range(5, 6, 6, 9).Style.Font.FontColor = ClosedXML.Excel.XLColor.White; + libro.Range(5, 10, 6, 12).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(136, 214, 205)); + libro.Range(5, 10, 6, 12).Style.Font.FontColor = ClosedXML.Excel.XLColor.White; + + + libro.Range(7, 6, 7 + dt.Rows.Count, 12).Style.Alignment.Horizontal = ClosedXML.Excel.XLAlignmentHorizontalValues.Right; + libro.Range(7, 6, 7+ dt.Rows.Count, 12).Style.NumberFormat.Format = "$##,###,###,0.00"; + + + + 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) + { - GVCalculosSBC.ExportToExcel("Salario"); - } - if (Tab.ActiveTab == TabParteFija) - { - GVCFija.ExportToExcel("Salario"); - } - if (Tab.ActiveTab == TabParteVariable) - { - GVPV.ExportToExcel("Salario"); - } - if (Tab.ActiveTab == TabDetalleParteVariable) - { - GVDetalleParteVariable.ExportToExcel("Salario"); + 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", "Salario")); + Response.BinaryWrite(memoryStream.ToArray()); + Response.End(); + } + public string limpiarcelda( string celdatext) + { + celdatext = celdatext.Replace("
    ", "\r\n").Replace(" ", " "); + while (celdatext.Contains(" ")){ + celdatext = celdatext.Replace(" ", " "); + } + celdatext = celdatext.Replace("\n ", " "); + celdatext = celdatext.Replace("\r ", " "); + + return celdatext; + } + public DataTable GVToDT(GridView GridView, string NombreArchivoXLSX) + { + DataTable dt = new DataTable(NombreArchivoXLSX); + if (GridView != null && GridView.Rows.Count > 0) + { + int i = 0; + List ArrColumnasVisibles = new List(); // solo recorro las columnas visibles + + foreach (TableCell cell in GridView.HeaderRow.Cells) + { + string titulo = HttpUtility.HtmlDecode(Extensiones.ModExtensiones.TextoCelda(cell)).Trim(); + titulo = limpiarcelda( titulo); + if (GridView.Columns[i].Visible && titulo.Length > 0) + { + if (dt.Columns.Contains(titulo)) + titulo = titulo + i; + dt.Columns.Add(titulo); + ArrColumnasVisibles.Add(i); + } + i += 1; + } + i = 0; + + foreach (GridViewRow row in GridView.Rows) + { + dt.Rows.Add(); + i = 0; + foreach (int j in ArrColumnasVisibles) + { + dt.Rows[dt.Rows.Count - 1][i] = limpiarcelda(Extensiones.ModExtensiones.TextoCelda(row.Cells[j]).Replace("
    ", "\r\n")); + i = i + 1; + } + } + } + return dt; + } } \ No newline at end of file diff --git a/RH/CatPersonal.aspx b/RH/CatPersonal.aspx index 7fd4e727e..f6ba72b60 100644 --- a/RH/CatPersonal.aspx +++ b/RH/CatPersonal.aspx @@ -62,6 +62,9 @@
  • Descargar Excel
  • +
  • + Formato saldos iniciales +
  • Personalizar
  • @@ -77,6 +80,7 @@ +
  • diff --git a/RH/CatPersonal.aspx.vb b/RH/CatPersonal.aspx.vb index c915c826e..655ca2973 100644 --- a/RH/CatPersonal.aspx.vb +++ b/RH/CatPersonal.aspx.vb @@ -680,4 +680,366 @@ Partial Class RH_CatPersonal End If End Sub + Protected Sub LnkCargaMasiva_Click(sender As Object, e As EventArgs) + Dim wb As ClosedXML.Excel.XLWorkbook = New ClosedXML.Excel.XLWorkbook() + Dim libro = wb.AddWorksheet("Personal") + Dim crow As Integer = 1 + Dim ccol As Integer = 1 + + Dim colLugarNacimiento As Integer = 1 + Dim rowLugarNacimiento As Integer = 1 + +#Region "Regimen de contratación" + Dim Catalogos = wb.AddWorksheet("Catalogos") + crow = 1 + ccol = 1 + Dim colRegimenContratacion As Integer = 1 + Dim rowRegimenContratacion As Integer = 1 + Catalogos.Cell(crow, ccol).Value = "Regimen de contratación" + For Each row As DataRow In GlobalDTNomSatRegimenContratacion.Rows + crow = crow + 1 + Catalogos.Cell(crow, ccol).Value = String.Format("{0}: {1}", row("CveSATRegimenContratacion"), row("RegimenContratacion")) + Next + colRegimenContratacion = ccol + rowRegimenContratacion = crow +#End Region +#Region "Estado civil" + Dim colEstadoCivil As Integer = 1 + Dim rowEstadoCivil As Integer = 1 + crow = 1 + ccol = ccol + 1 + Catalogos.Cell(crow, ccol).Value = "Estado civil" + For Each row As DataRow In GlobalDTEstadoCivil.Rows + crow = crow + 1 + Catalogos.Cell(crow, ccol).Value = String.Format("{0}: {1}", row("CveEstadoCivil"), row("EstadoCivil")) + Next + colEstadoCivil = ccol + rowEstadoCivil = crow +#End Region +#Region "Escolaridad" + Dim colEscolaridad As Integer = 1 + Dim rowEscolaridad As Integer = 1 + crow = 1 + ccol = ccol + 1 + Catalogos.Cell(crow, ccol).Value = "Escolaridad" + For Each row As DataRow In GlobalDTEscolaridad.Rows + crow = crow + 1 + Catalogos.Cell(crow, ccol).Value = String.Format("{0}: {1}", row("CveEscolaridad"), row("Escolaridad")) + Next + colEscolaridad = ccol + rowEscolaridad = crow + +#End Region +#Region "Tipo Periodo" + Dim colTipoPeriodo As Integer = 1 + Dim rowTipoPeriodo As Integer = 1 + crow = 1 + ccol = ccol + 1 + Catalogos.Cell(crow, ccol).Value = "Tipo Periodo" + For Each row As DataRow In GlobalDTTipoPeriodo.Rows + crow = crow + 1 + Catalogos.Cell(crow, ccol).Value = String.Format("{0}: {1}", row("CveTipoPeriodo"), row("TipoPeriodo")) + Next + colTipoPeriodo = ccol + rowTipoPeriodo = crow + +#End Region +#Region "Estatus" + Dim colEstatusPersonal As Integer = 1 + Dim rowEstatusPersonal As Integer = 1 + crow = 1 + ccol = ccol + 1 + Catalogos.Cell(crow, ccol).Value = "Estatus" + For Each row As DataRow In GlobalDTEstatusPersonal.Rows + crow = crow + 1 + Catalogos.Cell(crow, ccol).Value = String.Format("{0}: {1}", row("CveEstatusPersonal"), row("EstatusPersonal")) + Next + colEstatusPersonal = ccol + rowEstatusPersonal = crow + +#End Region +#Region "Tipo Contratro" + Dim colTipoContrato As Integer = 1 + Dim rowTipoContrato As Integer = 1 + crow = 1 + ccol = ccol + 1 + Catalogos.Cell(crow, ccol).Value = "Tipo Contratro" + For Each row As DataRow In GlobalDTTiposContrato.Rows + crow = crow + 1 + Catalogos.Cell(crow, ccol).Value = String.Format("{0}", row("TipoContrato")) + Next + colTipoContrato = ccol + rowTipoContrato = crow + +#End Region +#Region "Departamento" + Dim colDepartamento As Integer = 1 + Dim rowDepartamento As Integer = 1 + crow = 1 + ccol = ccol + 1 + Catalogos.Cell(crow, ccol).Value = "Departamento" + For Each row As DataRow In GlobalDTDepartamentos.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa).Rows + crow = crow + 1 + Catalogos.Cell(crow, ccol).Value = String.Format("{0}: {1}", row("CveDepartamento"), row("Departamento")) + Next + colDepartamento = ccol + rowDepartamento = crow + +#End Region +#Region "Turno" + Dim colTurno As Integer = 1 + Dim rowTurno As Integer = 1 + crow = 1 + ccol = ccol + 1 + Catalogos.Cell(crow, ccol).Value = "Turno" + For Each row As DataRow In GlobalDTTurno.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa).Rows + crow = crow + 1 + Catalogos.Cell(crow, ccol).Value = String.Format("{0}: {1}", row("CveTurno"), row("Turno")) + Next + colTurno = ccol + rowTurno = crow + +#End Region +#Region "Puesto" + Dim colPuesto As Integer = 1 + Dim rowPuesto As Integer = 1 + crow = 1 + ccol = ccol + 1 + Catalogos.Cell(crow, ccol).Value = "Puesto" + For Each row As DataRow In GlobalDTRHPuestos(UsuarioActual.CveEmpresa).Rows + crow = crow + 1 + Catalogos.Cell(crow, ccol).Value = String.Format("{0}: {1}", row("CvePuesto"), row("Puesto")) + Next + colPuesto = ccol + rowPuesto = crow + +#End Region +#Region "Estado" + Dim colEstado As Integer = 1 + Dim rowEstado As Integer = 1 + crow = 1 + ccol = ccol + 1 + Catalogos.Cell(crow, ccol).Value = "Estado" + For Each row As DataRow In GlobalDTGralEstados(1).Rows + crow = crow + 1 + Catalogos.Cell(crow, ccol).Value = String.Format("{0}: {1}", row("CveEstado"), row("Estado")) + Next + colEstado = ccol + rowEstado = crow + +#End Region +#Region "Tipo salario" + + Dim colTipoSalario As Integer = 1 + Dim rowTipoSalario As Integer = 1 + + crow = 1 + ccol = ccol + 1 + Catalogos.Cell(crow, ccol).Value = "Tipo salario" + crow = crow + 1 + Catalogos.Cell(crow, ccol).Value = "1: Salario fijo" + crow = crow + 1 + Catalogos.Cell(crow, ccol).Value = "2: Salario variable" + crow = crow + 1 + Catalogos.Cell(crow, ccol).Value = "3: Salario mixto" + colTipoSalario = ccol + rowTipoSalario = crow + +#End Region +#Region "Genero" + Dim colSexo As Integer = 1 + Dim rowSexo As Integer = 1 + crow = 1 + ccol = ccol + 1 + Catalogos.Cell(crow, ccol).Value = "Genero" + crow = crow + 1 + Catalogos.Cell(crow, ccol).Value = "1: Masculino" + crow = crow + 1 + Catalogos.Cell(crow, ccol).Value = "2: Femenino" + colSexo = ccol + rowSexo = crow + +#End Region +#Region "Sindicalizado" + Dim colsindicalizado As Integer = 1 + Dim rowsindicalizado As Integer = 1 + crow = 1 + ccol = ccol + 1 + Catalogos.Cell(crow, ccol).Value = "Sindicalizado" + crow = crow + 1 + Catalogos.Cell(crow, ccol).Value = "1: Sí" + crow = crow + 1 + Catalogos.Cell(crow, ccol).Value = "0: No" + colsindicalizado = ccol + rowsindicalizado = crow + +#End Region +#Region "Area geografica" + Dim colAreaGeografica As Integer = 1 + Dim rowAreaGeografica As Integer = 1 + crow = 1 + ccol = ccol + 1 + Catalogos.Cell(crow, ccol).Value = "Area geografica" + crow = crow + 1 + Catalogos.Cell(crow, ccol).Value = "A" + crow = crow + 1 + Catalogos.Cell(crow, ccol).Value = "B" + crow = crow + 1 + Catalogos.Cell(crow, ccol).Value = "C" + colAreaGeografica = ccol + rowAreaGeografica = crow + +#End Region +#Region "Metodo pago" + Dim colmetodopago = 0 + Dim rowmetodopago = 0 + crow = 1 + ccol = ccol + 1 + Catalogos.Cell(crow, ccol).Value = "Metodo pago" + For Each row As DataRow In GlobalDTMetodosPago.Rows + crow = crow + 1 + Catalogos.Cell(crow, ccol).Value = String.Format("{0}: {1}", row("CveMetodoPago"), row("MetodoPago")) + Next + colmetodopago = ccol + rowmetodopago = crow + +#End Region + +#Region "subproyecto" + Dim colsubproyecto = 0 + Dim rowsubproyecto = 0 + crow = 1 + ccol = ccol + 1 + Catalogos.Cell(crow, ccol).Value = "subproyecto" + Dim dtsubproyecto = If(Not UsuarioActual.TienePermisoProceso(110), GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, 1), GlobalDTSubProyectos(-1, -1, UsuarioActual.CveEmpresa, 1)) + For Each row As DataRow In dtsubproyecto.Rows + crow = crow + 1 + Catalogos.Cell(crow, ccol).Value = String.Format("{0}: {1}", row("CveSubProyecto"), row("SubProyecto")) + Next + colsubproyecto = ccol + rowsubproyecto = crow + +#End Region + Catalogos.Range(1, 1, 1, ccol).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(79, 129, 189)) + Catalogos.Range(1, 1, 1, ccol).Style.Font.FontColor = ClosedXML.Excel.XLColor.White + + crow = 1 + ccol = 1 + + libro.Cell(crow, ccol).Value = "Código" : ccol = ccol + 1 + libro.Cell(crow, ccol).Value = "Apellido Paterno" : ccol = ccol + 1 + libro.Cell(crow, ccol).Value = "Apellido Materno" : ccol = ccol + 1 + libro.Cell(crow, ccol).Value = "Nombre" : ccol = ccol + 1 + libro.Cell(crow, ccol).Value = "Correo Electronico" : ccol = ccol + 1 + libro.Cell(crow, ccol).Value = "Fecha Nacimiento" : ccol = ccol + 1 + libro.Cell(crow, ccol).Value = "Sexo" : libro.Range(crow + 1, ccol, 50000, ccol).SetDataValidation().List(Catalogos.Range(2, colSexo, rowSexo, colSexo), True) : ccol = ccol + 1 + libro.Cell(crow, ccol).Value = "Lugar Nacimiento" : ccol = ccol + 1 + libro.Cell(crow, ccol).Value = "Dirección" : ccol = ccol + 1 + libro.Cell(crow, ccol).Value = "Ciudad" : ccol = ccol + 1 + libro.Cell(crow, ccol).Value = "Estado Civil" : libro.Range(crow + 1, ccol, 50000, ccol).SetDataValidation().List(Catalogos.Range(2, colEstadoCivil, rowEstadoCivil, colEstadoCivil), True) : ccol = ccol + 1 + libro.Cell(crow, ccol).Value = "Teléfono" : ccol = ccol + 1 + libro.Cell(crow, ccol).Value = "Celular" : ccol = ccol + 1 + libro.Cell(crow, ccol).Value = "RFC" : ccol = ccol + 1 + libro.Cell(crow, ccol).Value = "CURP" : ccol = ccol + 1 + libro.Cell(crow, ccol).Value = "Numero SS" : ccol = ccol + 1 + libro.Cell(crow, ccol).Value = "CLABE" : ccol = ccol + 1 + libro.Cell(crow, ccol).Value = "Fecha Ingreso" : ccol = ccol + 1 + libro.Cell(crow, ccol).Value = "Fecha Baja" : ccol = ccol + 1 + libro.Cell(crow, ccol).Value = "Alta IMSS" : ccol = ccol + 1 + libro.Cell(crow, ccol).Value = "Código Postal" : ccol = ccol + 1 + libro.Cell(crow, ccol).Value = "Estatus Personal" : libro.Range(crow + 1, ccol, 50000, ccol).SetDataValidation().List(Catalogos.Range(2, colEstatusPersonal, rowEstatusPersonal, colEstatusPersonal), True) : ccol = ccol + 1 + libro.Cell(crow, ccol).Value = "Estado" : libro.Range(crow + 1, ccol, 50000, ccol).SetDataValidation().List(Catalogos.Range(2, colEstado, rowEstado, colEstado), True) : ccol = ccol + 1 + libro.Cell(crow, ccol).Value = "Nombre Padre" : ccol = ccol + 1 + libro.Cell(crow, ccol).Value = "Nombre Madre" : ccol = ccol + 1 + libro.Cell(crow, ccol).Value = "Puesto" : libro.Range(crow + 1, ccol, 50000, ccol).SetDataValidation().List(Catalogos.Range(2, colPuesto, rowPuesto, colPuesto), True) : ccol = ccol + 1 + libro.Cell(crow, ccol).Value = "Turno" : libro.Range(crow + 1, ccol, 50000, ccol).SetDataValidation().List(Catalogos.Range(2, colTurno, rowTurno, colTurno), True) : ccol = ccol + 1 + libro.Cell(crow, ccol).Value = "Tipo Contrato" : libro.Range(crow + 1, ccol, 50000, ccol).SetDataValidation().List(Catalogos.Range(2, colTipoContrato, rowTipoContrato, colTipoContrato), True) : ccol = ccol + 1 + libro.Cell(crow, ccol).Value = "Departamento" : libro.Range(crow + 1, ccol, 50000, ccol).SetDataValidation().List(Catalogos.Range(2, colDepartamento, rowDepartamento, colDepartamento), True) : ccol = ccol + 1 + libro.Cell(crow, ccol).Value = "Tipo Periodo" : libro.Range(crow + 1, ccol, 50000, ccol).SetDataValidation().List(Catalogos.Range(2, colTipoPeriodo, rowTipoPeriodo, colTipoPeriodo), True) : ccol = ccol + 1 + libro.Cell(crow, ccol).Value = "Escolaridad" : libro.Range(crow + 1, ccol, 50000, ccol).SetDataValidation().List(Catalogos.Range(2, colEscolaridad, rowEscolaridad, colEscolaridad), True) : ccol = ccol + 1 + libro.Cell(crow, ccol).Value = "Salario Diario" : ccol = ccol + 1 + libro.Cell(crow, ccol).Value = "Tipo Salario" : libro.Range(crow + 1, ccol, 50000, ccol).SetDataValidation().List(Catalogos.Range(2, colTipoSalario, rowTipoSalario, colTipoSalario), True) : ccol = ccol + 1 + libro.Cell(crow, ccol).Value = "Salario variable" : ccol = ccol + 1 + libro.Cell(crow, ccol).Value = "Sindicalizado" : libro.Range(crow + 1, ccol, 50000, ccol).SetDataValidation().List(Catalogos.Range(2, colsindicalizado, rowsindicalizado, colsindicalizado), True) : ccol = ccol + 1 + libro.Cell(crow, ccol).Value = "SubProyecto " : libro.Range(crow + 1, ccol, 50000, ccol).SetDataValidation().List(Catalogos.Range(2, colsubproyecto, rowsubproyecto, colsubproyecto), True) : ccol = ccol + 1 + libro.Cell(crow, ccol).Value = "RegimenContratacion" : libro.Range(crow + 1, ccol, 50000, ccol).SetDataValidation().List(Catalogos.Range(2, colRegimenContratacion, rowRegimenContratacion, colRegimenContratacion), True) : ccol = ccol + 1 + libro.Cell(crow, ccol).Value = "Area Geografica" : libro.Range(crow + 1, ccol, 50000, ccol).SetDataValidation().List(Catalogos.Range(2, colAreaGeografica, rowAreaGeografica, colAreaGeografica), True) : ccol = ccol + 1 + libro.Cell(crow, ccol).Value = "Prima vacacional" : ccol = ccol + 1 + libro.Cell(crow, ccol).Value = "Dias aguinaldo" : ccol = ccol + 1 + libro.Cell(crow, ccol).Value = "Metodo Pago" : libro.Range(crow + 1, ccol, 50000, ccol).SetDataValidation().List(Catalogos.Range(2, colmetodopago, rowmetodopago, colmetodopago), True) : ccol = ccol + 1 + + + + + libro.Range(crow, 1, crow, ccol - 1).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(79, 129, 189)) + libro.Range(crow, 1, crow, ccol - 1).Style.Font.FontColor = ClosedXML.Excel.XLColor.White + + Catalogos.ColumnsUsed().AdjustToContents() + libro.ColumnsUsed().AdjustToContents() + 'AreaGeografica ABC + 'GlobalDTMetodosPago MetodoPago" DataValueField="CveMetodoPago + + + Dim fs As System.IO.Stream = New System.IO.MemoryStream() + wb.SaveAs(fs) + fs.Position = 0 + Dim memoryStream As System.IO.MemoryStream = New System.IO.MemoryStream() + + Using input As System.IO.Stream = fs + input.CopyTo(memoryStream) + End Using + + memoryStream.Position = 0 + Response.Clear() + Response.Buffer = True + Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" + Response.AddHeader("content-disposition", String.Format("attachment;filename=SaldosInicialesRH.xlsx", "")) + Response.BinaryWrite(memoryStream.ToArray()) + Response.[End]() + 'Using nom As ClsNominas = New ClsNominas() + + ' If nom.ReportedePercepcionesDeduccionesGet(UsuarioActual.CveEmpresa, fechai, fechaf, 4) Then + ' Dim dt As DataTable = nom.DTSetResultados.Tables(0) + ' Dim libro = wb.AddWorksheet(nom.DTSetResultados.Tables(0), "Percepciones y deducciones") + ' libro.Tables.FirstOrDefault().Theme = ClosedXML.Excel.XLTableTheme.None + ' Dim crow As Integer = 1 + + ' For Each item As DataRow In dt.Rows + ' crow += 1 + + ' Select Case item("Grupoid").ToString() + ' Case "10" + ' libro.Range(crow, 1, crow, 9).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(184, 204, 228)) + ' Case "8", "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 + ' Case "6" + ' libro.Range(crow, 1, crow, 9).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(216, 228, 188)) + ' Case "5", "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 + ' Case "2" + ' Case "1", "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 + ' End Select + ' Next + + ' 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} al {fechaf}" + ' 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(2, 7, 2, 9).Merge().Value = $"Fecha:{DateTime.Now}" + ' libro.Range(3, 7, 3, 9).Merge().Value = $"Hora:{DateTime.Now}" + ' End If + 'End Using + End Sub End Class +S \ No newline at end of file diff --git a/RH/DiasFestivos.aspx b/RH/DiasFestivos.aspx new file mode 100644 index 000000000..1be34aea1 --- /dev/null +++ b/RH/DiasFestivos.aspx @@ -0,0 +1,79 @@ +<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="DiasFestivos.aspx.cs" Inherits="RH_DiasFestivos" %> + + + + + + +Catalogo de días festivos + + + + +
  • días festivos
  • + + + + + + + + + + + + + + + <%-- + + + + --%> + + + + + + + + + + + + + + diff --git a/RH/DiasFestivos.aspx.cs b/RH/DiasFestivos.aspx.cs new file mode 100644 index 000000000..4304fdcd7 --- /dev/null +++ b/RH/DiasFestivos.aspx.cs @@ -0,0 +1,74 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using Extensiones; + +public partial class RH_DiasFestivos : ClsPaginas +{ + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + CargaDiasFestivos(); + } + + } + + + protected void CargaDiasFestivos() + { + ClsRH ObjDias = new ClsRH(); + ObjDias.DiasFestivosGet(UsuarioActual.CveEmpresa ); + GVDiasFestivos.DataSource = ObjDias.DtResultados; + ObjDias.Dispose(); + GVDiasFestivos.DataBind(); + upDatosDias.Update(); + } + protected void LimpiaDiasFestivos() + { + TxtDiasfecha.Text = ""; + UPModalDias.Update(); + } + protected void LnkAgregarDias_Click(object sender, EventArgs e) + { + this.RegistraScript("$('#DModalDiasFestivos').modal();"); + LimpiaDiasFestivos(); + BtnDiasADD.Visible = true; + UPModalDias.Update(); + } + protected void BtnDiasADD_Click(object sender, EventArgs e) + { + + DateTime fecha = TxtDiasfecha.Text.ToDate(); + ClsRH ObjDias = new ClsRH(); + bool Continuar = ObjDias.DiasFestivosAdd(fecha, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario); + ObjDias.Dispose(); + if (Continuar) + { + this.RegistraScript("$('#DModalDiasFestivos').modal('hide');"); + LimpiaDiasFestivos(); + CargaDiasFestivos(); + UPModalDias.Update(); + this.Alert("El dìa festivos se ha agregado"); + } + } + protected void LnkEliminarDias_Click(object sender, EventArgs e) + { + GridViewRow gvRow = (GridViewRow)(((LinkButton)sender).NamingContainer); + DateTime fecha = gvRow.DataKey("CveDiainabil").ToDateTime(); + ClsRH ObjDias = new ClsRH(); + bool Continuar = ObjDias.DiasFestivosRemove(fecha, UsuarioActual.CveEmpresa); + ObjDias.Dispose(); + if (Continuar) + { + CargaDiasFestivos(); + this.Alert("El dìa festivos se ha Eliminado"); + } + } + + + +} \ No newline at end of file