Commit inicial Ventas Productivo
This commit is contained in:
330
RH/BuzonCalidad.aspx.vb.exclude
Normal file
330
RH/BuzonCalidad.aspx.vb.exclude
Normal file
@@ -0,0 +1,330 @@
|
||||
Option Explicit On
|
||||
Option Strict On
|
||||
|
||||
Imports Extensiones
|
||||
Imports System.Runtime.InteropServices
|
||||
Imports System.IO
|
||||
|
||||
Partial Class RH_BuzonCalidad
|
||||
Inherits ClsPaginas
|
||||
|
||||
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
||||
If Not IsPostBack Then
|
||||
CargaEscolaridad()
|
||||
CargaEstadoCivil()
|
||||
CargaDepartamento()
|
||||
CargaEstatusPersonal()
|
||||
CargaGenero()
|
||||
CargaMotivoBaja()
|
||||
CargaPuesto()
|
||||
CargaRuta()
|
||||
CargaTiposContrato()
|
||||
CargaTipoPeriodo()
|
||||
CargaTurno()
|
||||
'CargaClientes()
|
||||
DdlCliente.Attributes.Add("onclick", "CargaClientes();")
|
||||
CargaProyecto()
|
||||
|
||||
If Request("CvePersonal") IsNot Nothing AndAlso IsNumeric(Request("CvePersonal")) AndAlso Request("CvePersonal").ToEntero > 0 Then
|
||||
ViewState("CvePersonal") = Request("CvePersonal")
|
||||
CargaDatos()
|
||||
'Configuración de Modalidad Update
|
||||
BtnGuardar.Text = "Guardar Cambios"
|
||||
LtlTitulo.Text = "Consulta del Cliente:"
|
||||
'ImgAddVenta
|
||||
If Request("Opt") IsNot Nothing AndAlso IsNumeric(Request("Opt")) Then TAB.ActiveTabIndex = Request("Opt").ToEntero
|
||||
|
||||
'Inicia Permisos
|
||||
'If Not PermisoModificar Then BtnGuardar.Enabled = False
|
||||
'If Not PermisoEliminar Then BtnEliminar.Enabled = False
|
||||
'Fin Permisos
|
||||
Else
|
||||
|
||||
'Configuración de Modalidad Insert
|
||||
LblFechaCaptura.Text = Now.ToShortDateString()
|
||||
LblUsuarioCapturo.Text = UsuarioActual.Usuario
|
||||
ViewState("CvePersonal") = -1
|
||||
BtnEliminar.Visible = False
|
||||
'Inicia Permisos
|
||||
'If Not PermisoRegistro Then BtnGuardar.Enabled = False
|
||||
'Fin Permisos
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
|
||||
'Private Sub CargaPersonal()
|
||||
' DdlPersonal.DataSource = GlobalDTPersonal
|
||||
' DdlPersonal.DataBind()
|
||||
'End Sub
|
||||
Private Sub CargaCliente()
|
||||
DdlCliente.DataSource = GlobalDTCliente
|
||||
DdlCliente.DataBind()
|
||||
End Sub
|
||||
Private Sub CargarSucursal()
|
||||
DdlSucursal.DataSource = GlobalDTSucursales
|
||||
DdlSucursal.DataBind()
|
||||
End Sub
|
||||
Private Sub CargarTipoBuzon()
|
||||
DdlTipoBuzon.DataSource = GlobalDTTipoBuzon
|
||||
DdlTipoBuzon.DataBind()
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
Private Sub CargaDatos()
|
||||
Dim ObjPersonal As New ClsRH()
|
||||
If ObjPersonal.GetPersonal(CvePersonal, "-1", "-1", "-1", "-1", -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "-1", UsuarioActual.CveEmpresa) Then
|
||||
If ObjPersonal.DtResultados.Rows.Count > 0 Then
|
||||
|
||||
'Carga Datos Personales
|
||||
LtlPersonal.Text = ObjPersonal.Nombre
|
||||
TxtNombre.Text = ObjPersonal.Nombre
|
||||
TxtCodigo.Text = ObjPersonal.Codigo
|
||||
DdlEscolaridad.SelectedValue = ObjPersonal.CveEscolaridad.ToString
|
||||
DdlEstadoCivil.SelectedValue = ObjPersonal.CveEstadoCivil.ToString
|
||||
DdlGenero.SelectedValue = ObjPersonal.CveGenero.ToString
|
||||
TxtFechaNacimiento.Text = ObjPersonal.FechaNacimiento.ToShortDateString
|
||||
TxtRFC.Text = ObjPersonal.RFC
|
||||
TxtCURP.Text = ObjPersonal.CURP
|
||||
'Localización
|
||||
TxtDireccion.Text = ObjPersonal.Direccion.ToString
|
||||
TxtCP.Text = ObjPersonal.CP.ToString
|
||||
TxtCiudad.Text = ObjPersonal.Ciudad.ToString
|
||||
TxtEstado.Text = ObjPersonal.Estado.ToString
|
||||
TxtTelefono.Text = ObjPersonal.Telefono.ToString
|
||||
TxtCelular.Text = ObjPersonal.Telefono.ToString
|
||||
TxtLugarNacimiento.Text = ObjPersonal.LugarNacimiento.ToString
|
||||
TxtNombrePadre.Text = ObjPersonal.NombrePadre.ToString
|
||||
TxtNombreMadre.Text = ObjPersonal.NombreMadre.ToString
|
||||
|
||||
'Carga RH
|
||||
TxtFechaInicioContrato.Text = ObjPersonal.FechaInicioContrato.ToShortDateString
|
||||
TxtFechaFinContrato.Text = If(ObjPersonal.FechaFinContrato.ToShortDateString = "01/01/0001", "", ObjPersonal.FechaFinContrato.ToShortDateString)
|
||||
DdlTipoContrato.SelectedValue = ObjPersonal.CveTipoContrato.ToString
|
||||
DdlTurno.SelectedValue = ObjPersonal.CveTurno.ToString
|
||||
DdlPuesto.SelectedValue = ObjPersonal.CvePuesto.ToString
|
||||
DdlDepartamento.SelectedValue = ObjPersonal.CveDepartamento.ToString
|
||||
DdlRuta.SelectedValue = ObjPersonal.CveRuta.ToString
|
||||
DdlMotivoBaja.SelectedValue = ObjPersonal.CveMotivoBaja.ToString
|
||||
DdlEstatusPersonal.SelectedValue = ObjPersonal.CveEstatusPersonal.ToString
|
||||
'Asignación
|
||||
If ObjPersonal.CveCliente <> -1 Then
|
||||
DdlCliente.Items.Insert(1, New ListItem(ObjPersonal.Cliente, ObjPersonal.CveCliente.ToString))
|
||||
DdlCliente.SelectedValue = ObjPersonal.CveCliente.ToString
|
||||
Else
|
||||
DdlCliente.SelectedValue = ObjPersonal.CveCliente.ToString
|
||||
End If
|
||||
DdlProyecto.SelectedValue = ObjPersonal.CveProyecto.ToString
|
||||
If ObjPersonal.CveProyecto <> -1 Then DdlProyecto_SelectedIndexChanged(Me, New System.EventArgs())
|
||||
DdlSubProyecto.SelectedValue = ObjPersonal.CveSubProyecto.ToString
|
||||
'Carga Nómina
|
||||
TxtFechaIngreso.Text = ObjPersonal.FechaIngreso.ToShortDateString
|
||||
DdlTipoPeriodo.SelectedValue = ObjPersonal.CveTipoPeriodo.ToString
|
||||
TxtNumeroSS.Text = ObjPersonal.NumeroSS
|
||||
ChkSeInscribioSS.Checked = ObjPersonal.SeInscribioSS
|
||||
TxtSalarioDiario.Text = ObjPersonal.SalarioDiario.ToString
|
||||
TxtSDI.Text = ObjPersonal.SDI.ToString
|
||||
TxtSalarioTotal.Text = ObjPersonal.SalarioDiario.ToString
|
||||
TxtNumDiasAguinaldo.Text = ObjPersonal.NumDiasAguinaldo.ToString
|
||||
TxtPorPrimaVacacional.Text = ObjPersonal.PorPrimaVacacional.ToString
|
||||
|
||||
'Carga Incidencias
|
||||
'Carga Formatos
|
||||
'Carga Sistemas
|
||||
LblFechaCaptura.Text = ObjPersonal.FechaIngreso.ToShortDateString
|
||||
LblUsuarioCapturo.Text = ObjPersonal.Usuario
|
||||
|
||||
|
||||
|
||||
|
||||
Else
|
||||
Alert("El Personal Solicitado no existe, por favor revise su búsqueda.", TipoMensaje.MsgAdvertencia)
|
||||
BtnGuardar.Enabled = False
|
||||
End If
|
||||
End If
|
||||
ObjPersonal.Dispose()
|
||||
End Sub
|
||||
|
||||
Protected Sub BtnGuardar_Click(sender As Object, e As System.EventArgs) Handles BtnGuardar.Click
|
||||
'System.Threading.Thread.Sleep(3000)
|
||||
Dim ObjPersonal As New ClsRH()
|
||||
If CvePersonal = -1 Then
|
||||
If ObjPersonal.AddPersonal(TxtCodigo.Text.Trim, TxtNombre.Text.Trim, TxtFechaIngreso.Text.ToDate,
|
||||
DdlTipoPeriodo.SelectedValue.ToEntero, TxtNumeroSS.Text.Trim, ChkSeInscribioSS.Checked,
|
||||
TxtSalarioDiario.Text.Trim.ToDouble, TxtSDI.Text.Trim.ToDouble, TxtSalarioTotal.Text.Trim.ToDouble, TxtNumDiasAguinaldo.Text.Trim.ToEntero,
|
||||
TxtPorPrimaVacacional.Text.Trim.ToDouble, TxtFechaInicioContrato.Text.Trim.ToDate, If(IsDate(TxtFechaFinContrato.Text.Trim()), TxtFechaFinContrato.Text.Trim(), "-1"),
|
||||
DdlTipoContrato.SelectedValue.ToEntero,
|
||||
DdlTurno.SelectedValue.ToEntero, DdlPuesto.SelectedValue.ToEntero,
|
||||
DdlDepartamento.SelectedValue.ToEntero,
|
||||
DdlRuta.SelectedValue.ToEntero,
|
||||
DdlEscolaridad.SelectedValue.ToEntero,
|
||||
DdlEstadoCivil.SelectedValue.ToEntero,
|
||||
DdlGenero.SelectedValue.ToEntero,
|
||||
DdlMotivoBaja.SelectedValue.ToEntero,
|
||||
DdlEstatusPersonal.SelectedValue.ToEntero, TxtFechaNacimiento.Text.ToDate,
|
||||
TxtLugarNacimiento.Text.Trim, TxtDireccion.Text.Trim, TxtCP.Text.Trim, TxtCiudad.Text.Trim,
|
||||
TxtEstado.Text.Trim, TxtTelefono.Text.Trim, TxtCelular.Text.Trim, TxtRFC.Text.Trim,
|
||||
TxtCURP.Text.Trim, TxtNombrePadre.Text.Trim, TxtNombreMadre.Text.Trim, DdlCliente.SelectedValue.ToEntero, DdlSubProyecto.SelectedValue.ToEntero,
|
||||
UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
|
||||
|
||||
Alert("El Personal se guardó correctamente.", TipoMensaje.MsgInformacion, "window.location.href=""/RH/CatPersonal.aspx"";")
|
||||
End If
|
||||
Else
|
||||
If ObjPersonal.UpdatePersonal(TxtCodigo.Text.Trim, TxtNombre.Text.Trim, TxtFechaIngreso.Text.ToDate,
|
||||
DdlTipoPeriodo.SelectedValue.ToEntero, TxtNumeroSS.Text.Trim, ChkSeInscribioSS.Checked,
|
||||
TxtSalarioDiario.Text.Trim.ToDouble, TxtSDI.Text.Trim.ToDouble, TxtSalarioTotal.Text.Trim.ToDouble, TxtNumDiasAguinaldo.Text.Trim.ToEntero,
|
||||
TxtPorPrimaVacacional.Text.Trim.ToDouble, TxtFechaInicioContrato.Text.Trim.ToDate, If(IsDate(TxtFechaFinContrato.Text.Trim()), TxtFechaFinContrato.Text.Trim(), "-1"),
|
||||
DdlTipoContrato.SelectedValue.ToEntero,
|
||||
DdlTurno.SelectedValue.ToEntero, DdlPuesto.SelectedValue.ToEntero,
|
||||
DdlDepartamento.SelectedValue.ToEntero,
|
||||
DdlRuta.SelectedValue.ToEntero,
|
||||
DdlEscolaridad.SelectedValue.ToEntero,
|
||||
DdlEstadoCivil.SelectedValue.ToEntero,
|
||||
DdlGenero.SelectedValue.ToEntero,
|
||||
DdlMotivoBaja.SelectedValue.ToEntero,
|
||||
DdlEstatusPersonal.SelectedValue.ToEntero, TxtFechaNacimiento.Text.ToDate,
|
||||
TxtLugarNacimiento.Text.Trim, TxtDireccion.Text.Trim, TxtCP.Text.Trim, TxtCiudad.Text.Trim,
|
||||
TxtEstado.Text.Trim, TxtTelefono.Text.Trim, TxtCelular.Text.Trim, TxtRFC.Text.Trim,
|
||||
TxtCURP.Text.Trim, TxtNombrePadre.Text.Trim, TxtNombreMadre.Text.Trim, DdlCliente.SelectedValue.ToEntero, DdlSubProyecto.SelectedValue.ToEntero, CvePersonal,
|
||||
UsuarioActual.CveEmpresa) Then
|
||||
CargaDatos()
|
||||
UpDatos.Update()
|
||||
Alert("Los cambios se guardaron correctamente.", TipoMensaje.MsgInformacion)
|
||||
End If
|
||||
End If
|
||||
ObjPersonal.Dispose()
|
||||
End Sub
|
||||
|
||||
Protected Sub BtnEliminar_Click(sender As Object, e As System.EventArgs) Handles BtnEliminar.Click
|
||||
Dim ObjPersonal As New ClsRH()
|
||||
If ObjPersonal.RemovePersonal(CvePersonal, UsuarioActual.CveEmpresa) Then
|
||||
Alert("El Personal se Eliminó correctamente.", TipoMensaje.MsgInformacion, "window.location.href=""/RH/CatPersonal.aspx""")
|
||||
End If
|
||||
ObjPersonal.Dispose()
|
||||
End Sub
|
||||
|
||||
Protected Sub DdlProyecto_SelectedIndexChanged(sender As Object, e As System.EventArgs) Handles DdlProyecto.SelectedIndexChanged
|
||||
CargaSubProyecto()
|
||||
End Sub
|
||||
|
||||
Protected Sub LbContrato_Click(sender As Object, e As System.EventArgs) Handles LbContrato.Click
|
||||
Dim oWordApp As Word.Application = Nothing
|
||||
Dim oWordDoc As Word.Document = Nothing
|
||||
Dim objSelection As Word.Selection = Nothing
|
||||
|
||||
Dim ArchivoPath As String = ""
|
||||
|
||||
Try
|
||||
'GuardaLog("Inicia Petición de Aplicación")
|
||||
oWordApp = New Word.Application
|
||||
oWordApp.Visible = True
|
||||
oWordDoc = oWordApp.Documents.Open(AppDomain.CurrentDomain.BaseDirectory & "Empresas\" & UsuarioActual.CveEmpresa & "\RH\Contratos\" & "SOGO.doc")
|
||||
'GuardaLog("Inicia Petición de Documento")
|
||||
If oWordDoc IsNot Nothing Then
|
||||
'GuardaLog("Creación de Documento")
|
||||
oWordDoc.Activate()
|
||||
objSelection = oWordApp.Selection
|
||||
|
||||
objSelection.WholeStory()
|
||||
objSelection.Copy()
|
||||
objSelection.Delete(Unit:=wdCharacter, COUNT:=1)
|
||||
'GuardaLog("Recorrer de reemplazo de variables")
|
||||
|
||||
objSelection.PasteAndFormat(Word.WdRecoveryType.wdPasteDefault)
|
||||
ReemplazaTexto(objSelection, "{NOMBRE_PERSONAL}", TxtNombre.Text.Trim)
|
||||
ReemplazaTexto(objSelection, "{DIRECCION}", TxtDireccion.Text.Trim)
|
||||
ReemplazaTexto(objSelection, "{CP}", TxtCP.Text.Trim)
|
||||
ReemplazaTexto(objSelection, "{CIUDAD}", TxtCiudad.Text.Trim)
|
||||
ReemplazaTexto(objSelection, "{ESTADO}", TxtEstado.Text.Trim)
|
||||
ReemplazaTexto(objSelection, "{DIA_INICIA_CONTRATO}", TxtFechaIngreso.Text.ToDate.Day.ToString)
|
||||
ReemplazaTexto(objSelection, "{MES_INICIA_CONTRATO}", MonthName(TxtFechaIngreso.Text.ToDate.Month))
|
||||
ReemplazaTexto(objSelection, "{ANIO_INICIA_CONTRATO}", TxtFechaIngreso.Text.ToDate.Year.ToString)
|
||||
ReemplazaTexto(objSelection, "{DIA_FIN_CONTRATO}", TxtFechaFinContrato.Text.ToDate.Day.ToString)
|
||||
ReemplazaTexto(objSelection, "{MES_FIN_CONTRATO}", MonthName(TxtFechaFinContrato.Text.ToDate.Month))
|
||||
ReemplazaTexto(objSelection, "{ANIO_FIN_CONTRATO}", TxtFechaFinContrato.Text.ToDate.Year.ToString)
|
||||
|
||||
'objSelection.InsertBreak(Type:=wdPageBreak)
|
||||
'GuardaLog("Termina de reemplazo de variables")
|
||||
objSelection.TypeBackspace()
|
||||
objSelection.TypeBackspace()
|
||||
If Not System.IO.Directory.Exists(AppDomain.CurrentDomain.BaseDirectory & "Empresas\" & UsuarioActual.CveEmpresa & "\Temp\") Then
|
||||
System.IO.Directory.CreateDirectory(AppDomain.CurrentDomain.BaseDirectory & "Empresas\" & UsuarioActual.CveEmpresa & "\Temp\")
|
||||
End If
|
||||
ArchivoPath = AppDomain.CurrentDomain.BaseDirectory & "Empresas\" & UsuarioActual.CveEmpresa & "\Temp\" & UsuarioActual.CveUsuario & ".doc"
|
||||
|
||||
oWordDoc.SaveAs(ArchivoPath.ToString)
|
||||
oWordDoc.Close()
|
||||
Else
|
||||
Alert("No se pudo generar el archivo", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
Alert(ex.Message, TipoMensaje.MsgError)
|
||||
OnError("", ex)
|
||||
ArchivoPath = ""
|
||||
Finally
|
||||
|
||||
If oWordDoc IsNot Nothing Then
|
||||
'GuardaLog("Documento Destruido")
|
||||
While (Marshal.ReleaseComObject(oWordDoc) > 0)
|
||||
End While
|
||||
'GuardaLog("Documento Destruido")
|
||||
oWordDoc = Nothing
|
||||
End If
|
||||
|
||||
If oWordApp IsNot Nothing Then
|
||||
oWordApp.Quit(False)
|
||||
While (Marshal.ReleaseComObject(oWordApp) > 0)
|
||||
End While
|
||||
'GuardaLog("Aplicación Destruida")
|
||||
oWordApp = Nothing
|
||||
End If
|
||||
System.GC.Collect()
|
||||
objSelection = Nothing
|
||||
|
||||
End Try
|
||||
|
||||
|
||||
If ArchivoPath <> "" Then
|
||||
|
||||
Dim Archivo As New System.IO.FileInfo(ArchivoPath)
|
||||
|
||||
'If Archivo.Exists Then
|
||||
'HttpContext.Current.Response.Clear()
|
||||
'HttpContext.Current.Response.ClearContent()
|
||||
''HttpContext.Current.Response.ContentType = "application/msword"
|
||||
'HttpContext.Current.Response.ContentType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
|
||||
'HttpContext.Current.Response.AppendHeader("Content-disposition", "attachment; filename=" & Archivo.Name)
|
||||
'HttpContext.Current.Response.AddHeader("Content-Length", Archivo.Length.ToString())
|
||||
'HttpContext.Current.Response.TransmitFile(ArchivoPath)
|
||||
'HttpContext.Current.Response.Flush()
|
||||
'HttpContext.Current.Response.End()
|
||||
RegistraScript("AbrirVentana('/Ventas/PopUpImprimir.aspx?RH=True&Ext=" & Archivo.Extension & "', 700, 400, 'N', 'ImpRH')")
|
||||
'End If
|
||||
Archivo = Nothing
|
||||
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub ReemplazaTexto(ByRef ObjSelection As Word.Selection, ByVal Texto As String, ByVal Reemplazar As String)
|
||||
With ObjSelection.Find
|
||||
.Text = Texto
|
||||
.Replacement.Text = Reemplazar
|
||||
.Forward = True
|
||||
.Wrap = Word.WdFindWrap.wdFindContinue
|
||||
.Format = False
|
||||
.MatchCase = True
|
||||
.MatchWholeWord = False
|
||||
.MatchWildcards = False
|
||||
.MatchSoundsLike = False
|
||||
.MatchAllWordForms = False
|
||||
End With
|
||||
ObjSelection.Find.Execute(Replace:=Word.WdReplace.wdReplaceAll)
|
||||
End Sub
|
||||
|
||||
Protected Sub BtnCargarClientes_Click(sender As Object, e As System.EventArgs) Handles BtnCargarClientes.Click
|
||||
CargaClientes()
|
||||
DdlCliente.Attributes.Remove("onclick")
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
Reference in New Issue
Block a user