This commit is contained in:
2023-07-28 11:37:24 -07:00
3 changed files with 196 additions and 197 deletions

View File

@@ -1595,6 +1595,7 @@
<asp:BoundField DataField="TipoPago" HeaderText="Tipo pago" />
<asp:BoundField DataField="DiasextraAutorizado" HeaderText="Días extra" />
<asp:BoundField DataField="diasPago" HeaderText="Días pago" />
<asp:BoundField DataField="DiasPrima" HeaderText="Días Prima" />
<asp:TemplateField HeaderText="Aplica prima">
<ItemTemplate>
<asp:Label runat="server" Text='<%# ((Eval("AplicaPrima").ToString() == "1" || Eval("AplicaPrima").ToString().ToUpper() == "TRUE") ? "Sí": "No") %>'> </asp:Label>

View File

@@ -3270,6 +3270,7 @@
<asp:BoundField DataField="TipoPago" HeaderText="Tipo pago" />
<asp:BoundField DataField="DiasextraAutorizado" HeaderText="Días extra" />
<asp:BoundField DataField="diasPago" HeaderText="Días pago" />
<asp:BoundField DataField="DiasPrima" HeaderText="Días Prima" />
<asp:TemplateField HeaderText="Aplica prima">
<ItemTemplate>
<asp:Label runat="server" Text='<%# If(Eval("AplicaPrima").ToString() = "1" Or Eval("AplicaPrima").ToString().ToUpper() = "TRUE", "Sí", "No") %>'> </asp:Label>

View File

@@ -943,25 +943,22 @@ Partial Class RH_Personal
divBitacora.Visible = True
CargaGvBitacora()
CargaCuentasBancarias()
CarcaConceptosNomina()
CargaFonacot()
End If
Else
cargatipoTrabajador()
MostrarOcultarFechasEstatus()
LoadDefaultValues()
'Configuración de Modalidad Insert
ImgAddObs.Visible = False
LblFechaCaptura.Text = Now.ToShortDateString()
LblUsuarioCapturo.Text = UsuarioActual.Usuario
ViewState("CvePersonal") = -1
BtnEliminar.Visible = False
CarcaConceptosNomina()
CargaFonacot()
CargaCuentasBancarias()
'Inicia Permisos
'Fin Permisos
End If
If UsuarioActual.Empresa.Funcionalidad(568) = "1" Then
@@ -1939,218 +1936,219 @@ Partial Class RH_Personal
Dim EnviarCorreoNomina As Boolean = False
'System.Threading.Thread.Sleep(3000)
Dim ObjPersonal As New ClsRH()
Dim ObjCuentasDeposito As New ClsGenerales(ObjPersonal.IniciaTransacSQL())
Dim ObjAF As New ClsAF(ObjPersonal.IniciaTransacSQL())
Dim Extension As String = Path.GetExtension(UsuarioActual.Empresa.Ruta & "Temp\RH\" & ViewState("Archivo").ToString())
Dim URL As String = If(Extension.Trim().Length > 0, CvePersonal & Extension, "")
Dim Ruta = String.Format("{0}Temp\RH\{1}", UsuarioActual.Empresa.Ruta, ViewState("Archivo").ToString())
Dim Archivo As New System.IO.FileInfo(Ruta)
Using ObjPersonal As New ClsRH()
Using ObjCuentasDeposito As New ClsGenerales(ObjPersonal.IniciaTransacSQL())
Using ObjAF As New ClsAF(ObjPersonal.IniciaTransacSQL())
Dim TieneError = False
Dim Mensaje = ""
Dim Accion = ""
Dim Extension As String = Path.GetExtension(UsuarioActual.Empresa.Ruta & "Temp\RH\" & ViewState("Archivo").ToString())
Dim URL As String = If(Extension.Trim().Length > 0, CvePersonal & Extension, "")
Dim Ruta = String.Format("{0}Temp\RH\{1}", UsuarioActual.Empresa.Ruta, ViewState("Archivo").ToString())
Dim Archivo As New System.IO.FileInfo(Ruta)
'Dim FechaBaja As Date = MinFecha
'Dim FechaActivo As Date = MinFecha
'Dim FechaReingreso As Date = MinFecha
'If DdlEstatusPersonal.SelectedValue.ToEntero() <> CvePersonalEstatusInicial Then
' If DdlEstatusPersonal.SelectedValue.ToEntero() = 1 Then
' FechaActivo = TxtFechaActivo.Text.ToDate
' ElseIf DdlEstatusPersonal.SelectedValue.ToEntero() = 2 Then
' ElseIf DdlEstatusPersonal.SelectedValue.ToEntero() = 5 Then
' FechaReingreso = TxtFechaReingreso.Text.ToDate
' End If
'End If
Dim TieneError = False
Dim Mensaje = ""
Dim Accion = ""
If UsuarioActual.CveEmpresa = 72 OrElse UsuarioActual.CveEmpresa = 80 Then
TxtSalarioCotizado.Text = TxtSDI.Text
End If
'Dim FechaBaja As Date = MinFecha
'Dim FechaActivo As Date = MinFecha
'Dim FechaReingreso As Date = MinFecha
If CvePersonal = -1 Then
URL = ""
'If DdlEstatusPersonal.SelectedValue.ToEntero() <> CvePersonalEstatusInicial Then
' If DdlEstatusPersonal.SelectedValue.ToEntero() = 1 Then
' FechaActivo = TxtFechaActivo.Text.ToDate
' ElseIf DdlEstatusPersonal.SelectedValue.ToEntero() = 2 Then
' ElseIf DdlEstatusPersonal.SelectedValue.ToEntero() = 5 Then
' FechaReingreso = TxtFechaReingreso.Text.ToDate
' End If
'End If
If ObjPersonal.AddPersonal(TxtCodigo.Text.Trim, TxtAPaterno.Text.Trim, TxtAMaterno.Text.Trim, TxtNombres.Text.Trim, TxtCorreo.Text.Trim, TxtFechaIngreso.Text.ToDate,
DdlTipoPeriodo.SelectedValue.ToEntero(), TxtNumeroSS.Text.Trim, ChkSeInscribioSS.Checked, TxtSalarioDiarioPago.Text.Trim.ToDouble,
TxtSalarioDiario.Text.Trim.ToDouble, TxtSDI.Text.Trim.ToDouble, TxtSalarioCotizado.Text.Trim.ToDouble, TxtBono.Text.Trim.ToDouble, TxtNumDiasAguinaldo.Text.Trim.ToEntero(),
TxtPorPrimaVacacional.Text.Trim.ToDouble, DdlMetodoPago.SelectedValue.ToEntero(), TxtFechaInicioContrato.Text.Trim.ToDate, If(IsDate(TxtFechaFinContrato.Text.Trim()), TxtFechaFinContrato.Text.Trim(), "-1"),
DdlTipoContrato.SelectedValue.ToEntero(), TxtUbicacion.Text.Trim,
DdlTurno.SelectedValue.ToEntero(), DdlPuesto.SelectedValue.ToEntero(),
DdlDepartamento.SelectedValue.ToEntero(),
DdlRuta.SelectedValue.ToEntero(),
DdlEscolaridad.SelectedValue.ToEntero(),
DdlEstadoCivil.SelectedValue.ToEntero(),
DdlGenero.SelectedValue.ToEntero(),
-1, "-1",
DdlEstatusPersonal.SelectedValue.ToEntero(), TxtFechaNacimiento.Text.ToDate,
TxtLugarNacimiento.Text.Trim, TxtCalle.Text.Trim, TxtNumExt.Text.Trim, TxtNumInt.Text.Trim, TxtColonia.Text.Trim, TxtCP.Text.Trim, TxtCiudad.Text.Trim,
DdlEstados.SelectedValue.ToEntero(), TxtTelefono.Text.Trim, TxtTelefonoEmergencia.Text.Trim, TxtCelular.Text.Trim, TxtRFC.Text.Trim, TxtCURP.Text.Trim, TxtCredencialElector.Text.Trim,
TxtNombrePadre.Text.Trim, TxtNombreMadre.Text.Trim, DdlBanco.SelectedValue.ToEntero(), DdlRiesgoPuesto.SelectedValue.ToEntero(), DdlRegimenContratacion.SelectedValue.ToEntero(),
DdlClienteAsignado.SelectedValue.ToEntero(), DdlSubProyectoAsignado.SelectedValue.ToEntero(), 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.CveUsuario, UsuarioActual.CveEmpresa, DDLUsuarioNomina.SelectedValue.ToEntero(), TxtBeneficiario.Text.Trim, 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(),
CveEmpresaAsignado:=DdlEmpresaAsignada.SelectedValue.ToEntero, CveTipoTrabajador:=DdlTipoTrabajador.SelectedValue.ToEntero(), NetoPeriodo:=TxtNetoPeriodo.Text.ToDecimal) Then
If Archivo.Exists Then
If Not IsNothing(ViewState("FilesMoveimgNew")) Then
Dim filemove As String = ViewState("FilesMoveimgNew").ToString()
If Not String.IsNullOrWhiteSpace(filemove) Then
filemove.FilesMove(ObjPersonal.CvePersonal.ToString(), String.Format("{0}RH\Personal\", UsuarioActual.Empresa.Ruta), ConcatenarDirectorioBase:=False)
End If
If UsuarioActual.CveEmpresa = 72 OrElse UsuarioActual.CveEmpresa = 80 Then
TxtSalarioCotizado.Text = TxtSDI.Text
End If
If File.Exists(String.Format("{0}RH\Personal\{1}", UsuarioActual.Empresa.Ruta, URL)) Then
File.Delete(String.Format("{0}RH\Personal\{1}", UsuarioActual.Empresa.Ruta, URL))
End If
System.IO.File.Move(String.Format("{0}Temp\RH\{1}", UsuarioActual.Empresa.Ruta, URL), String.Format("{0}RH\Personal\{1}", UsuarioActual.Empresa.Ruta, URL))
If CvePersonal = -1 Then
URL = ""
End If
If ObjPersonal.AddPersonal(TxtCodigo.Text.Trim, TxtAPaterno.Text.Trim, TxtAMaterno.Text.Trim, TxtNombres.Text.Trim, TxtCorreo.Text.Trim, TxtFechaIngreso.Text.ToDate,
DdlTipoPeriodo.SelectedValue.ToEntero(), TxtNumeroSS.Text.Trim, ChkSeInscribioSS.Checked, TxtSalarioDiarioPago.Text.Trim.ToDouble,
TxtSalarioDiario.Text.Trim.ToDouble, TxtSDI.Text.Trim.ToDouble, TxtSalarioCotizado.Text.Trim.ToDouble, TxtBono.Text.Trim.ToDouble, TxtNumDiasAguinaldo.Text.Trim.ToEntero(),
TxtPorPrimaVacacional.Text.Trim.ToDouble, DdlMetodoPago.SelectedValue.ToEntero(), TxtFechaInicioContrato.Text.Trim.ToDate, If(IsDate(TxtFechaFinContrato.Text.Trim()), TxtFechaFinContrato.Text.Trim(), "-1"),
DdlTipoContrato.SelectedValue.ToEntero(), TxtUbicacion.Text.Trim,
DdlTurno.SelectedValue.ToEntero(), DdlPuesto.SelectedValue.ToEntero(),
DdlDepartamento.SelectedValue.ToEntero(),
DdlRuta.SelectedValue.ToEntero(),
DdlEscolaridad.SelectedValue.ToEntero(),
DdlEstadoCivil.SelectedValue.ToEntero(),
DdlGenero.SelectedValue.ToEntero(),
-1, "-1",
DdlEstatusPersonal.SelectedValue.ToEntero(), TxtFechaNacimiento.Text.ToDate,
TxtLugarNacimiento.Text.Trim, TxtCalle.Text.Trim, TxtNumExt.Text.Trim, TxtNumInt.Text.Trim, TxtColonia.Text.Trim, TxtCP.Text.Trim, TxtCiudad.Text.Trim,
DdlEstados.SelectedValue.ToEntero(), TxtTelefono.Text.Trim, TxtTelefonoEmergencia.Text.Trim, TxtCelular.Text.Trim, TxtRFC.Text.Trim, TxtCURP.Text.Trim, TxtCredencialElector.Text.Trim,
TxtNombrePadre.Text.Trim, TxtNombreMadre.Text.Trim, DdlBanco.SelectedValue.ToEntero(), DdlRiesgoPuesto.SelectedValue.ToEntero(), DdlRegimenContratacion.SelectedValue.ToEntero(),
DdlClienteAsignado.SelectedValue.ToEntero(), DdlSubProyectoAsignado.SelectedValue.ToEntero(), 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.CveUsuario, UsuarioActual.CveEmpresa, DDLUsuarioNomina.SelectedValue.ToEntero(), TxtBeneficiario.Text.Trim, 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(),
CveEmpresaAsignado:=DdlEmpresaAsignada.SelectedValue.ToEntero, CveTipoTrabajador:=DdlTipoTrabajador.SelectedValue.ToEntero(), NetoPeriodo:=TxtNetoPeriodo.Text.ToDecimal) Then
If Archivo.Exists Then
If Not IsNothing(ViewState("FilesMoveimgNew")) Then
Dim filemove As String = ViewState("FilesMoveimgNew").ToString()
If Not String.IsNullOrWhiteSpace(filemove) Then
filemove.FilesMove(ObjPersonal.CvePersonal.ToString(), String.Format("{0}RH\Personal\", UsuarioActual.Empresa.Ruta), ConcatenarDirectorioBase:=False)
End If
End If
If File.Exists(String.Format("{0}RH\Personal\{1}", UsuarioActual.Empresa.Ruta, URL)) Then
File.Delete(String.Format("{0}RH\Personal\{1}", UsuarioActual.Empresa.Ruta, URL))
End If
System.IO.File.Move(String.Format("{0}Temp\RH\{1}", UsuarioActual.Empresa.Ruta, URL), String.Format("{0}RH\Personal\{1}", UsuarioActual.Empresa.Ruta, URL))
End If
ObjPersonal.AgroDepartamentoPersonalUp(UsuarioActual.CveEmpresa, DDlAgroDepartamento.SelectedValue.ToEntero(), ObjPersonal.CvePersonal, If(ChkCharolaForanea.Checked, 1, 0))
'Agregar Cuentas Bancarias
ViewState("CvePersonal") = ObjPersonal.CvePersonal
ObjPersonal.AgroDepartamentoPersonalUp(UsuarioActual.CveEmpresa, DDlAgroDepartamento.SelectedValue.ToEntero(), ObjPersonal.CvePersonal, If(ChkCharolaForanea.Checked, 1, 0))
'Agregar Cuentas Bancarias
ViewState("CvePersonal") = ObjPersonal.CvePersonal
'Funsion usa RH Familiares
If UsuarioActual.Empresa.Funcionalidad(568) = "1" Then
ProcesaDTFamiliares(ObjPersonal)
End If
If TempDTCuentasBancos.Rows.Count > 0 Then
'Funsion usa RH Familiares
If UsuarioActual.Empresa.Funcionalidad(568) = "1" Then
ProcesaDTFamiliares(ObjPersonal)
End If
If TempDTCuentasBancos IsNot Nothing AndAlso 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(), UsuarioActual.CveEmpresa, CvePersonal:=CvePersonal, CveUsuarioModifico:=UsuarioActual.CveUsuario, BBVAAlias:=row("BBVAAlias").ToString()) 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(), UsuarioActual.CveEmpresa, CvePersonal:=CvePersonal, CveUsuarioModifico:=UsuarioActual.CveUsuario, BBVAAlias:=row("BBVAAlias").ToString()) Then
TieneError = True
Exit For
End If
Next
End If
If DTLicencias IsNot Nothing AndAlso DTLicencias.Rows.Count > 0 Then
For Each Dr As DataRow In DTLicencias.Rows
If Not ObjAF.AddLicencia(-1, Dr("Licencia").ToString(), Dr("FechaExpedicion").ToString().ToDateTime(), Dr("FechaVencimiento").ToString().ToDateTime(), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CvePersonal:=ObjPersonal.CvePersonal) Then
TieneError = True
Exit For
End If
Next
End If
'If ObjPersonal.GetPersonal(-1, UsuarioActual.CveEmpresa) Then
' GlobalDTGralColectivas(-1) = ObjPersonal.DtResultados
'Else
' TieneError = True
'End If
Mensaje = "El Personal se guardó correctamente."
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
Exit For
End If
Next
End If
If DTLicencias IsNot Nothing AndAlso DTLicencias.Rows.Count > 0 Then
For Each Dr As DataRow In DTLicencias.Rows
If Not ObjAF.AddLicencia(-1, Dr("Licencia").ToString(), Dr("FechaExpedicion").ToString().ToDateTime(), Dr("FechaVencimiento").ToString().ToDateTime(), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CvePersonal:=ObjPersonal.CvePersonal) Then
Else
'If File.Exists(ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & UsuarioActual.CveEmpresa & "\RH\Personal\" & CvePersonal & Extension) Then
If ObjPersonal.UpdatePersonal(TxtCodigo.Text.Trim, TxtAPaterno.Text.Trim, TxtAMaterno.Text.Trim, TxtNombres.Text.Trim, TxtCorreo.Text.Trim, TxtFechaIngreso.Text.ToDate,
DdlTipoPeriodo.SelectedValue.ToEntero(), TxtNumeroSS.Text.Trim, ChkSeInscribioSS.Checked, TxtSalarioDiarioPago.Text.Trim.ToDouble,
TxtSalarioDiario.Text.Trim.ToDouble, TxtSDI.Text.Trim.ToDouble, TxtSalarioCotizado.Text.Trim.ToDouble, TxtBono.Text.Trim.ToDouble, TxtNumDiasAguinaldo.Text.Trim.ToEntero(),
TxtPorPrimaVacacional.Text.Trim.ToDouble, DdlMetodoPago.SelectedValue.ToEntero(), TxtFechaInicioContrato.Text.Trim.ToDate, If(IsDate(TxtFechaFinContrato.Text.Trim()), TxtFechaFinContrato.Text.Trim(), "-1"),
DdlTipoContrato.SelectedValue.ToEntero(), TxtUbicacion.Text.Trim,
DdlTurno.SelectedValue.ToEntero(), DdlPuesto.SelectedValue.ToEntero(),
DdlDepartamento.SelectedValue.ToEntero(),
DdlRuta.SelectedValue.ToEntero(),
DdlEscolaridad.SelectedValue.ToEntero(),
DdlEstadoCivil.SelectedValue.ToEntero(),
DdlGenero.SelectedValue.ToEntero(),
DdlMotivoBaja.SelectedValue.ToEntero(), If(DdlEstatusPersonal.SelectedValue = "2", TxtFechaBaja.Text.Trim, "-1"),
DdlEstatusPersonal.SelectedValue.ToEntero(), TxtFechaNacimiento.Text.ToDate,
TxtLugarNacimiento.Text.Trim, TxtCalle.Text.Trim, TxtNumExt.Text.Trim, TxtNumInt.Text.Trim, TxtColonia.Text.Trim, TxtCP.Text.Trim, TxtCiudad.Text.Trim,
DdlEstados.SelectedValue.ToEntero(), TxtTelefono.Text.Trim, TxtTelefonoEmergencia.Text.Trim, TxtCelular.Text.Trim, TxtRFC.Text.Trim,
TxtCURP.Text.Trim, TxtCredencialElector.Text.Trim, TxtNombrePadre.Text.Trim, TxtNombreMadre.Text.Trim,
DdlBanco.SelectedValue.ToEntero(), DdlRiesgoPuesto.SelectedValue.ToEntero(), DdlRegimenContratacion.SelectedValue.ToEntero(),
DdlClienteAsignado.SelectedValue.ToEntero(), DdlSubProyectoAsignado.SelectedValue.ToEntero(), CvePersonal,
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(), TxtBeneficiario.Text.Trim, 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(), CveEmpresaAsignado:=DdlEmpresaAsignada.SelectedValue.ToEntero(), EsReserva:=If(chkEsReserva.Checked, 1, 0),
Fiscalizable:=If(chkNoFiscalizar.Checked, 0, 1), CveTipoTrabajador:=DdlTipoTrabajador.SelectedValue.ToEntero(), NetoPeriodo:=TxtNetoPeriodo.Text.ToDecimal) Then
'Funcion usa RH Familiares
If UsuarioActual.Empresa.Funcionalidad(568) = "1" Then
ProcesaDTFamiliares(ObjPersonal)
End If
ObjPersonal.AgroDepartamentoPersonalUp(UsuarioActual.CveEmpresa, DDlAgroDepartamento.SelectedValue.ToEntero(), CvePersonal, If(ChkCharolaForanea.Checked, 1, 0))
If Archivo.Exists Then
If Not Directory.Exists(String.Format("{0}\RH\Personal", UsuarioActual.Empresa.Ruta)) Then Directory.CreateDirectory(String.Format("{0}\RH\Personal", UsuarioActual.Empresa.Ruta))
If File.Exists(String.Format("{0}RH\Personal\{1}", UsuarioActual.Empresa.Ruta, URL)) Then
File.Delete(String.Format("{0}RH\Personal\{1}", UsuarioActual.Empresa.Ruta, URL))
End If
System.IO.File.Move(String.Format("{0}Temp\RH\{1}", UsuarioActual.Empresa.Ruta, URL), String.Format("{0}RH\Personal\{1}", UsuarioActual.Empresa.Ruta, URL))
End If
Mensaje = "Los cambios se guardaron correctamente."
'If ViewState("CveEstatusOriginal").ToString() <> DdlEstatusPersonal.SelectedValue Then
' 'Manda Mail con bajas
'End If
Else
TieneError = True
Exit For
End If
Next
End If
'If ObjPersonal.GetPersonal(-1, UsuarioActual.CveEmpresa) Then
' GlobalDTGralColectivas(-1) = ObjPersonal.DtResultados
'Else
' TieneError = True
'End If
Mensaje = "El Personal se guardó correctamente."
Accion = If(Request("CveFactura") Is Nothing, "document.location.href=""/RH/CatPersonal.aspx""", "window.opener.location.href = window.opener.location.href; window.close();")
'GUARDA ORGANIGRAMA
If Not TieneError Then
If Not ObjPersonal.AddUpdatePersonalOrganigrama(CvePersonal, If(DdlSupervisorOrganigrama.SelectedValue.ToEntero() = 0, CvePersonal, DdlSupervisorOrganigrama.SelectedValue.ToEntero())) Then
TieneError = True
End If
End If
'Alert("El Personal se guardó correctamente.", TipoMensaje.MsgInformacion, "window.location.href=""/RH/CatPersonal.aspx"";")
EnviarCorreoNomina = True
Else
TieneError = True
End If
Else
'If File.Exists(ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & UsuarioActual.CveEmpresa & "\RH\Personal\" & CvePersonal & Extension) Then
If ObjPersonal.UpdatePersonal(TxtCodigo.Text.Trim, TxtAPaterno.Text.Trim, TxtAMaterno.Text.Trim, TxtNombres.Text.Trim, TxtCorreo.Text.Trim, TxtFechaIngreso.Text.ToDate,
DdlTipoPeriodo.SelectedValue.ToEntero(), TxtNumeroSS.Text.Trim, ChkSeInscribioSS.Checked, TxtSalarioDiarioPago.Text.Trim.ToDouble,
TxtSalarioDiario.Text.Trim.ToDouble, TxtSDI.Text.Trim.ToDouble, TxtSalarioCotizado.Text.Trim.ToDouble, TxtBono.Text.Trim.ToDouble, TxtNumDiasAguinaldo.Text.Trim.ToEntero(),
TxtPorPrimaVacacional.Text.Trim.ToDouble, DdlMetodoPago.SelectedValue.ToEntero(), TxtFechaInicioContrato.Text.Trim.ToDate, If(IsDate(TxtFechaFinContrato.Text.Trim()), TxtFechaFinContrato.Text.Trim(), "-1"),
DdlTipoContrato.SelectedValue.ToEntero(), TxtUbicacion.Text.Trim,
DdlTurno.SelectedValue.ToEntero(), DdlPuesto.SelectedValue.ToEntero(),
DdlDepartamento.SelectedValue.ToEntero(),
DdlRuta.SelectedValue.ToEntero(),
DdlEscolaridad.SelectedValue.ToEntero(),
DdlEstadoCivil.SelectedValue.ToEntero(),
DdlGenero.SelectedValue.ToEntero(),
DdlMotivoBaja.SelectedValue.ToEntero(), If(DdlEstatusPersonal.SelectedValue = "2", TxtFechaBaja.Text.Trim, "-1"),
DdlEstatusPersonal.SelectedValue.ToEntero(), TxtFechaNacimiento.Text.ToDate,
TxtLugarNacimiento.Text.Trim, TxtCalle.Text.Trim, TxtNumExt.Text.Trim, TxtNumInt.Text.Trim, TxtColonia.Text.Trim, TxtCP.Text.Trim, TxtCiudad.Text.Trim,
DdlEstados.SelectedValue.ToEntero(), TxtTelefono.Text.Trim, TxtTelefonoEmergencia.Text.Trim, TxtCelular.Text.Trim, TxtRFC.Text.Trim,
TxtCURP.Text.Trim, TxtCredencialElector.Text.Trim, TxtNombrePadre.Text.Trim, TxtNombreMadre.Text.Trim,
DdlBanco.SelectedValue.ToEntero(), DdlRiesgoPuesto.SelectedValue.ToEntero(), DdlRegimenContratacion.SelectedValue.ToEntero(),
DdlClienteAsignado.SelectedValue.ToEntero(), DdlSubProyectoAsignado.SelectedValue.ToEntero(), CvePersonal,
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(), TxtBeneficiario.Text.Trim, 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(), CveEmpresaAsignado:=DdlEmpresaAsignada.SelectedValue.ToEntero(), EsReserva:=If(chkEsReserva.Checked, 1, 0),
Fiscalizable:=If(chkNoFiscalizar.Checked, 0, 1), CveTipoTrabajador:=DdlTipoTrabajador.SelectedValue.ToEntero(), NetoPeriodo:=TxtNetoPeriodo.Text.ToDecimal) Then
'Funcion usa RH Familiares
If UsuarioActual.Empresa.Funcionalidad(568) = "1" Then
ProcesaDTFamiliares(ObjPersonal)
End If
ObjPersonal.AgroDepartamentoPersonalUp(UsuarioActual.CveEmpresa, DDlAgroDepartamento.SelectedValue.ToEntero(), CvePersonal, If(ChkCharolaForanea.Checked, 1, 0))
If Archivo.Exists Then
If Not Directory.Exists(String.Format("{0}\RH\Personal", UsuarioActual.Empresa.Ruta)) Then Directory.CreateDirectory(String.Format("{0}\RH\Personal", UsuarioActual.Empresa.Ruta))
If File.Exists(String.Format("{0}RH\Personal\{1}", UsuarioActual.Empresa.Ruta, URL)) Then
File.Delete(String.Format("{0}RH\Personal\{1}", UsuarioActual.Empresa.Ruta, URL))
End If
System.IO.File.Move(String.Format("{0}Temp\RH\{1}", UsuarioActual.Empresa.Ruta, URL), String.Format("{0}RH\Personal\{1}", UsuarioActual.Empresa.Ruta, URL))
End If
If TieneError Then
ObjPersonal.RollBack()
Alert("Ocurrio un error guardar el Personal. Por favor vuelva a intentar.", TipoMensaje.ToastAdventencia)
Else
ObjPersonal.Commit()
Alert(Mensaje, TipoMensaje.MsgInformacion, Accion)
Mensaje = "Los cambios se guardaron correctamente."
'If ViewState("CveEstatusOriginal").ToString() <> DdlEstatusPersonal.SelectedValue Then
' 'Manda Mail con bajas
'End If
CargaEstatusPersonal(DdlEstatusPersonal.SelectedValue.ToEntero())
'If File.Exists(ModExtensiones.DirectorioBaseEmpresas & "Empresas\" & UsuarioActual.CveEmpresa & "\RH\Personal\" & ObjPersonal.URL) Then
' ImgPersonal.ImageUrl = "/Empresas/" & UsuarioActual.CveEmpresa & "/RH/Personal/" & ObjPersonal.URL
'End If
GlobalDTRHPersonal(UsuarioActual.CveEmpresa) = Nothing
GlobalDTCuentasDepositosPersonales(UsuarioActual.CveEmpresa) = Nothing
If CvePersonal > 0 Then
Using objbase As New ClsRH
If (objbase.PersonalDomUp(DdlEstadosDomicilio.SelectedValue.ToEntero(), TxtCiudadOrigen.Text, CvePersonal, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario)) Then
End If
End Using
CargaDatos()
End If
Else
TieneError = True
End If
'GUARDA ORGANIGRAMA
If Not TieneError Then
If Not ObjPersonal.AddUpdatePersonalOrganigrama(CvePersonal, If(DdlSupervisorOrganigrama.SelectedValue.ToEntero() = 0, CvePersonal, DdlSupervisorOrganigrama.SelectedValue.ToEntero())) Then
TieneError = True
End If
End If
End If
If TieneError Then
ObjPersonal.RollBack()
Alert("Ocurrio un error guardar el Personal. Por favor vuelva a intentar.", TipoMensaje.ToastAdventencia)
Else
ObjPersonal.Commit()
Alert(Mensaje, TipoMensaje.MsgInformacion, Accion)
CargaEstatusPersonal(DdlEstatusPersonal.SelectedValue.ToEntero())
'If File.Exists(ModExtensiones.DirectorioBaseEmpresas & "Empresas\" & UsuarioActual.CveEmpresa & "\RH\Personal\" & ObjPersonal.URL) Then
' ImgPersonal.ImageUrl = "/Empresas/" & UsuarioActual.CveEmpresa & "/RH/Personal/" & ObjPersonal.URL
'End If
GlobalDTRHPersonal(UsuarioActual.CveEmpresa) = Nothing
GlobalDTCuentasDepositosPersonales(UsuarioActual.CveEmpresa) = Nothing
If CvePersonal > 0 Then
Using objbase As New ClsRH
If (objbase.PersonalDomUp(DdlEstadosDomicilio.SelectedValue.ToEntero(), TxtCiudadOrigen.Text, CvePersonal, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario)) Then
End If
GuardarDocumentosFirmaContrato()
Session("FileUpload") = ""
ViewState("Archivo") = ""
End Using
CargaDatos()
End If
End If
GuardarDocumentosFirmaContrato()
Session("FileUpload") = ""
ViewState("Archivo") = ""
ObjPersonal.Dispose()
ObjCuentasDeposito.Dispose()
ObjAF.Dispose()
End Using
End Using
UpDatos.Update()
CargaGvBitacora()
@@ -3399,7 +3397,7 @@ Partial Class RH_Personal
End If
LimpiaCuentasBancarias()
CargaGridCuentasBancos(ViewState("OrdenCuentasBancos").ToString())
CargaGridCuentasBancos("")
If CvePersonal > 0 Then
CargaGvBitacora()
@@ -3412,7 +3410,6 @@ Partial Class RH_Personal
End Sub
Private Sub CargaCuentasBancarias()
Dim ObjCuentasBancos As New ClsGenerales
ViewState("OrdenCuentasBancos") = ""
DTCuentasBancos = New DataTable
TempDTCuentasBancos = New DataTable
@@ -3427,7 +3424,7 @@ Partial Class RH_Personal
End If
ObjCuentasBancos.Dispose()
CargaGridCuentasBancos(ViewState("OrdenCuentasBancos").ToString())
CargaGridCuentasBancos("")
End Sub
#Region "GRIDVIEW - CUENTAS BANCARIAS"
@@ -3485,11 +3482,11 @@ Partial Class RH_Personal
GvBancosCuentas.EditIndex = e.NewEditIndex
CargaGridCuentasBancos(ViewState("OrdenCuentasBancos").ToString())
CargaGridCuentasBancos("")
End Sub
Protected Sub GvBancosCuentas_RowCancelingEdit(sender As Object, e As System.Web.UI.WebControls.GridViewCancelEditEventArgs) Handles GvBancosCuentas.RowCancelingEdit
GvBancosCuentas.EditIndex = -1
CargaGridCuentasBancos(ViewState("OrdenCuentasBancos").ToString())
CargaGridCuentasBancos("")
End Sub
Protected Sub GvBancosCuentas_RowUpdating(sender As Object, e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles GvBancosCuentas.RowUpdating
Dim NombreBanco = GvBancosCuentas.Rows(e.RowIndex).FCTextBox("TxtNombreBanco").Text.Trim
@@ -3582,7 +3579,7 @@ Partial Class RH_Personal
ObjCuentasBancos.Dispose()
GvBancosCuentas.EditIndex = -1
CargaGridCuentasBancos(ViewState("OrdenCuentasBancos").ToString())
CargaGridCuentasBancos("")
CargaGvBitacora()
End Sub
Protected Sub GvBancosCuentas_RowDeleting(sender As Object, e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvBancosCuentas.RowDeleting
@@ -3600,7 +3597,7 @@ Partial Class RH_Personal
TempDTCuentasBancos.Rows.RemoveAt(index)
End If
CargaGridCuentasBancos(ViewState("OrdenCuentasBancos").ToString())
CargaGridCuentasBancos("")
ObjCuentasBancos.Dispose()
CargaGvBitacora()
End Sub