From e225163b119af99c301ae8e90c366383ef8cae55 Mon Sep 17 00:00:00 2001 From: rakcsle Date: Thu, 10 Mar 2022 21:13:09 -0700 Subject: [PATCH] Personal envio de correo al dara de alta empleado en vsh, personal asignacion de empresa de outsorcing --- App_Code/ClsRH.vb | 9 +++- RH/Personal.aspx | 9 ++++ RH/Personal.aspx.vb | 119 ++++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 132 insertions(+), 5 deletions(-) diff --git a/App_Code/ClsRH.vb b/App_Code/ClsRH.vb index ba5cd008c..3668afa90 100644 --- a/App_Code/ClsRH.vb +++ b/App_Code/ClsRH.vb @@ -1925,7 +1925,7 @@ chkAplicaVacacion As Boolean, chkAplicaIncapacidad As Boolean, chkAplicaRetardo NombrePadre As String, NombreMadre As String, CveSATBanco As Integer, CveSATRiesgoPuesto As Integer, CveSATRegimenContratacion As Integer, CveClienteAsignado As Integer, CveSubProyecto As Integer, URL As String, CveSupervisor As Integer, CLABE As String, BancoNumCuenta As String, CveJornada As Integer, IdCtaContPersonal As Integer, CtaContPersonal As String, IdCtaContPrestamos As Integer, CtaContPrestamos As String, CveUsuario As Integer, CveEmpresa As Integer, CveUsuarioNomina As Integer, Optional CveSubProyectoZona As Integer = Nothing, Optional CveUniforme As Integer = -1, Optional TelefonoExtension As String = "-1", Optional CelularPersonal As String = "-1", Optional TelefonoMarcadoRapido As String = "-1", Optional ContactoAlterno As String = "-1", Optional CveTipodeSalario As Integer = 1, Optional Sindicalizado As Boolean = False, Optional CvePais As Integer = -1, - Optional Pensionado As Boolean = False, Optional CveMedioTransporte As Integer = -1, Optional CveRegistroPatronal As Integer = -1) As Boolean + Optional Pensionado As Boolean = False, Optional CveMedioTransporte As Integer = -1, Optional CveRegistroPatronal As Integer = -1, Optional CveEmpresaAsignado As Integer = -1) As Boolean Dim Retorno As Boolean = False @@ -2011,6 +2011,8 @@ chkAplicaVacacion As Boolean, chkAplicaIncapacidad As Boolean, chkAplicaRetardo .Add("@CvePais", SqlDbType.Int).Value = CvePais .Add("@CveMedioTransporte", SqlDbType.Int).Value = CveMedioTransporte .Add("@CveRegistroPatronal", SqlDbType.Int).Value = CveRegistroPatronal + .Add("@CveEmpresaAsignado", SqlDbType.Int).Value = CveEmpresaAsignado + @@ -2052,7 +2054,8 @@ chkAplicaVacacion As Boolean, chkAplicaIncapacidad As Boolean, chkAplicaRetardo NombrePadre As String, NombreMadre As String, CveSATBanco As Integer, CveSATRiesgoPuesto As Integer, CveSATRegimenContratacion As Integer, CveClienteAsignado As Integer, CveSubProyecto As Integer, CvePersonal As Integer, URL As String, CveSupervisor As Integer, CLABE As String, BancoNumCuenta As String, CveJornada As Integer, IdCtaContPersonal As Integer, CtaContPersonal As String, IdCtaContPrestamos As Integer, CtaContPrestamos As String, CveEmpresa As Integer, CveUsuarioNomina As Integer, Optional CveSubProyectoZona As Integer = Nothing, Optional CveUniforme As Integer = -1, Optional TelefonoExtension As String = "-1", Optional CelularPersonal As String = "-1", Optional TelefonoMarcadoRapido As String = "-1", Optional ContactoAlterno As String = "-1", Optional CveUsuarioModifico As Integer = -1, - Optional FechaActivo As Date = MinFecha, Optional FechaReingreso As Date = MinFecha, Optional CveTipodeSalario As Integer = 1, Optional Sindicalizado As Integer = -1, Optional CvePais As Integer = -1, Optional Pensionado As Boolean = False, Optional CveRegistroPatronal As Integer = -1) As Boolean + Optional FechaActivo As Date = MinFecha, Optional FechaReingreso As Date = MinFecha, Optional CveTipodeSalario As Integer = 1, Optional Sindicalizado As Integer = -1, Optional CvePais As Integer = -1, Optional Pensionado As Boolean = False, Optional CveRegistroPatronal As Integer = -1, + Optional CveEmpresaAsignado As Integer = -1) As Boolean Dim Retorno As Boolean = False @@ -2141,6 +2144,8 @@ chkAplicaVacacion As Boolean, chkAplicaIncapacidad As Boolean, chkAplicaRetardo .Add("@Pensionado", SqlDbType.Bit).Value = Pensionado .Add("@CvePais", SqlDbType.Int).Value = CvePais .Add("@CveRegistroPatronal", SqlDbType.Int).Value = CveRegistroPatronal + .Add("@CveEmpresaAsignado", SqlDbType.Int).Value = CveEmpresaAsignado + diff --git a/RH/Personal.aspx b/RH/Personal.aspx index a866ce7fe..71f3e96bc 100644 --- a/RH/Personal.aspx +++ b/RH/Personal.aspx @@ -590,6 +590,15 @@ + +
+ + + + + +
+
diff --git a/RH/Personal.aspx.vb b/RH/Personal.aspx.vb index a95d6d4cd..fc27e4468 100644 --- a/RH/Personal.aspx.vb +++ b/RH/Personal.aspx.vb @@ -869,6 +869,7 @@ Partial Class RH_Personal CargaPermisosReemplazos() CargaPaises() CargaRegistroPatronal() + CargaOutSourcing() If Request("CvePersonal") IsNot Nothing AndAlso IsNumeric(Request("CvePersonal")) AndAlso Request("CvePersonal").ToEntero() > 0 Then ViewState("CvePersonal") = Request("CvePersonal") @@ -1386,6 +1387,20 @@ Partial Class RH_Personal End Sub + + Private Sub CargaOutSourcing() + + If UsuarioActual.CveEmpresa = 7 Then + DdlEmpresaAsignada.DataSource = GlobalDTEmpresas.FiltraParametros("CveEmpresa in (7,11,12,122,145)") + DdlEmpresaAsignada.DataBind() + DvOutsourcing.Visible = True + End If + + + DdlEmpresaAsignada.Items.Insert(0, New ListItem("Seleccione uno", "-1")) + + End Sub + #End Region #Region "Asistencias" @@ -1687,6 +1702,7 @@ Partial Class RH_Personal DdlRegistroPatronal.SelectedValueExist(ObjPersonal.DtResultados.Rows(0)("CveRegistroPatronal").ToString) + DdlEmpresaAsignada.SelectedValueExist(ObjPersonal.DtResultados.Rows(0)("CveEmpresaAsignado").ToString) 'Carga Incidencias BtnConsultarAsistencia_Click(Me, New System.EventArgs) @@ -1807,6 +1823,8 @@ Partial Class RH_Personal End Sub Protected Sub BtnGuardar_Click(sender As Object, e As System.EventArgs) Handles BtnGuardar.Click + + Dim EnviarCorreoNomina As Boolean = False 'System.Threading.Thread.Sleep(3000) Dim ObjPersonal As New ClsRH() Dim ObjCuentasDeposito As New ClsGenerales(ObjPersonal.IniciaTransacSQL()) @@ -1862,7 +1880,7 @@ Partial Class RH_Personal DdlSupervisor.SelectedValue.ToEntero(), TxtCLABE.Text.Trim, TxtBancoNumCuenta.Text.Trim, DdlJornada.SelectedValue.ToEntero(), DdlViaticos.SelectedValue.ToEntero(), DdlViaticos.SelectedItem.Text, DdlPrestamos.SelectedValue.ToEntero(), DdlPrestamos.SelectedItem.Text, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, DDLUsuarioNomina.SelectedValue.ToEntero(), DdlSubproyectoZona.SelectedValue.ToEntero(), CveUniforme:=DdlUniforme.SelectedValue.ToEntero(), TelefonoExtension:=TxtTelefonoExtension.Text, CelularPersonal:=TxtCelularPersonal.Text, TelefonoMarcadoRapido:=TxtTelefonoMarcadoRapido.Text, ContactoAlterno:="", CveTipodeSalario:=DDlTipoSalario.SelectedValue.ToEntero(), - Sindicalizado:=ChkSindicalizado.Checked, Pensionado:=ChkPensionado.Checked, CvePais:=DdlPais.SelectedValue.ToEntero(), CveRegistroPatronal:=DdlRegistroPatronal.SelectedValue.ToEntero()) Then + Sindicalizado:=ChkSindicalizado.Checked, Pensionado:=ChkPensionado.Checked, CvePais:=DdlPais.SelectedValue.ToEntero(), CveRegistroPatronal:=DdlRegistroPatronal.SelectedValue.ToEntero(), CveEmpresaAsignado:=DdlEmpresaAsignada.SelectedValue.ToEntero) Then If Archivo.Exists Then @@ -1882,8 +1900,8 @@ Partial Class RH_Personal If UsuarioActual.Empresa.Funcionalidad(568) = "1" Then ProcesaDTFamiliares(ObjPersonal) End If - If TempDTCuentasBancos.Rows.Count > 0 Then + For Each row As DataRow In TempDTCuentasBancos.Rows If Not ObjCuentasDeposito.AddCuentasDepositos(row("BancoNombre").ToString(), row("Plaza").ToString(), row("Sucursal").ToString(), row("Cuenta").ToString(), row("CLABE").ToString(), row("CIE").ToString(), row("SWIFT").ToString(), row("Referencia").ToString(), "", UsuarioActual.CveUsuario, row("CveMoneda").ToString().ToEntero(), CvePersonal:=CvePersonal, CveUsuarioModifico:=UsuarioActual.CveUsuario, BBVAAlias:=row("BBVAAlias").ToString()) Then TieneError = True @@ -1910,6 +1928,7 @@ Partial Class RH_Personal Accion = If(Request("CveFactura") Is Nothing, "document.location.href=""/RH/CatPersonal.aspx""", "window.opener.location.href = window.opener.location.href; window.close();") 'Alert("El Personal se guardó correctamente.", TipoMensaje.MsgInformacion, "window.location.href=""/RH/CatPersonal.aspx"";") + EnviarCorreoNomina = True Else TieneError = True End If @@ -1937,7 +1956,8 @@ Partial Class RH_Personal URL, DdlSupervisor.SelectedValue.ToEntero(), TxtCLABE.Text.Trim, TxtBancoNumCuenta.Text.Trim, DdlJornada.SelectedValue.ToEntero(), DdlViaticos.SelectedValue.ToEntero(), DdlViaticos.SelectedItem.Text, DdlPrestamos.SelectedValue.ToEntero(), DdlPrestamos.SelectedItem.Text, UsuarioActual.CveEmpresa, DDLUsuarioNomina.SelectedValue.ToEntero(), DdlSubproyectoZona.SelectedValue.ToEntero(), CveUniforme:=DdlUniforme.SelectedValue.ToEntero(), TelefonoExtension:=TxtTelefonoExtension.Text, CelularPersonal:=TxtCelularPersonal.Text, TelefonoMarcadoRapido:=TxtTelefonoMarcadoRapido.Text, ContactoAlterno:="", CveUsuarioModifico:=UsuarioActual.CveUsuario, - CveTipodeSalario:=DDlTipoSalario.SelectedValue.ToEntero(), Sindicalizado:=If(ChkSindicalizado.Checked, 1, 0), Pensionado:=ChkPensionado.Checked, CvePais:=DdlPais.SelectedValue.ToEntero(), CveRegistroPatronal:=DdlRegistroPatronal.SelectedValue.ToEntero()) Then + CveTipodeSalario:=DDlTipoSalario.SelectedValue.ToEntero(), Sindicalizado:=If(ChkSindicalizado.Checked, 1, 0), Pensionado:=ChkPensionado.Checked, CvePais:=DdlPais.SelectedValue.ToEntero(), + CveRegistroPatronal:=DdlRegistroPatronal.SelectedValue.ToEntero(), CveEmpresaAsignado:=DdlEmpresaAsignada.SelectedValue.ToEntero) Then 'Funsion usa RH Familiares If UsuarioActual.Empresa.Funcionalidad(568) = "1" Then @@ -2008,6 +2028,99 @@ Partial Class RH_Personal UpDatos.Update() CargaGvBitacora() + If EnviarCorreoNomina AndAlso DDLUsuarioNomina.SelectedValue.ToEntero > 0 Then + EnviarCorreoNominista() + End If + + + End Sub + + Private Sub EnviarCorreoNominista() + + If UsuarioActual.CveEmpresa.Contiene(7) Then + + Dim CorreoNominista As String = GlobalDTUsuarios(CveUsuario:=DDLUsuarioNomina.SelectedValue.ToEntero).Rows(0)("Correo").ToString + + If CorreoNominista = "" Then + Alert($"No se envio el correo de notificación a nominas, el nominista no tiene {DDLUsuarioNomina.SelectedItem.Text} correo electronico", TipoMensaje.MsgAdvertencia) + Exit Sub + + End If + + + Dim correo As New ClsSisMail + Dim Cuerpo As New StringBuilder + + Dim Puesto As String = "" + Dim Padre As String = "" + Dim Madre As String = "" + Dim FechaIngreso As String = "" + + Dim EmpresaDestino As String = If(DdlEmpresaAsignada.SelectedValue.ToEntero > 0, GlobalDTEmpresas(DdlEmpresaAsignada.SelectedValue.ToEntero).Rows(0)("Empresa").ToString, UsuarioActual.Empresa.Empresa) + + Dim objRH As New ClsRH + + If objRH.PersonalFamiliaresGet(-1, CvePersonal) Then + + Dim DtFamiliares As DataTable = objRH.DtResultados.FiltraParametros(" CveParentesco = 1 ") + + If DtFamiliares.Rows.Count > 0 Then + Padre = DtFamiliares.Rows(0)("Nombre").ToString + End If + + DtFamiliares = objRH.DtResultados.FiltraParametros(" CveParentesco = 2 ") + + If DtFamiliares.Rows.Count > 0 Then + Madre = DtFamiliares.Rows(0)("Nombre").ToString + End If + + End If + + objRH.Dispose() + Cuerpo.AppendLine("") + Cuerpo.AppendLine($"") + Cuerpo.AppendLine("") + Cuerpo.AppendLine("
{ EmpresaDestino }
{ Now.ToShortDateString } { Now.ToShortTimeString }
Notificacion por Alta de Nomina
") + + Cuerpo.AppendLine("
") + Cuerpo.AppendLine("
") + + Cuerpo.AppendLine("") + Cuerpo.AppendLine($"") + Cuerpo.AppendLine($"") + Cuerpo.AppendLine($"") + Cuerpo.AppendLine($"") + Cuerpo.AppendLine($"") + Cuerpo.AppendLine($"") + Cuerpo.AppendLine($"") + Cuerpo.AppendLine($"") + Cuerpo.AppendLine($"") + Cuerpo.AppendLine($"") + Cuerpo.AppendLine($"") + + + If Padre.Length > 0 Then + Cuerpo.AppendLine($"") + End If + + If Madre.Length > 0 Then + Cuerpo.AppendLine($"") + End If + + + Cuerpo.AppendLine($"") + Cuerpo.AppendLine($"") + Cuerpo.AppendLine($"") + Cuerpo.AppendLine($"") + Cuerpo.AppendLine("
Datos del Candidato
Puesto:{If(DdlPuesto.SelectedIndex > 0, DdlPuesto.SelectedItem.Text, "") }
Ruta/Servicio:{ If(DdlRuta.SelectedValue.ToEntero > 0, DdlRuta.SelectedItem.Text, "") }
Fecha de ingreso:{TxtFechaIngreso.Text}
Nombre:{ NombreCompleto }
Fecha y Lugar de Nacimiento:{TxtFechaNacimiento.Text} {TxtLugarNacimiento.Text}
Numero IMSS:{ TxtNumeroSS.Text }
Numero Infonavit:{ If(TxtInfoNumCredito.Text.Trim = "", "NO CUENTA CON CREDITO", TxtInfoNumCredito.Text) }
Sexo:{ If(DdlGenero.SelectedValue = "1", "Masculino", "Femenino") }
R.F.C.:{ TxtRFC.Text }
CURP:{ TxtCURP.Text }
Nombre del Padre:{ Padre }
Nombre de la Madre:{ Madre }
Dirección:{ TxtCalle.Text }
Escolaridad:{ If(DdlEscolaridad.SelectedIndex > 0, DdlEscolaridad.SelectedItem.Text, "") }
Telefono:{ TxtCelular.Text},{TxtTelefono.Text}
Correo:{ TxtCorreo.Text }
") + + correo.SendMail(EmpresaNotificaciones, CorreoNominista, "Notificacion por Alta de Nomina: " & NombreCompleto, Cuerpo.ToString) + + + + + End If + End Sub 'Private Sub MandaMails(Rutas As Object)