Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %REM
- Agent ActualizarIndicesMotivoPase
- Created Jun 7, 2018 Por Santiago Alpuy
- Description: Comments for Agent
- %END REM
- Option Public
- Option Declare
- Use "ConfEE 1.0"
- UseLSX "*lsxlc"
- '------------- Constantes Datos Externos -------------
- Private Const BASE_DATOS_EXTERNOS = "DATOSEXTERNOS"
- Private Const BASE_PORTAL = "PORTAL"
- Private Const BASE_RUTAS = "RUTAS"
- Private Const BASE_ALARMAS = "sistemas/expedientes/LogAlarmas.nsf"
- Private Const VISTA_MOTIVOS = "(BusquedaDatoPorClave)"
- Private Const TAG_MOTIVOS_PASE = "MotivosDePase"
- '------------- Constantes Conexion Oracle -------------
- Private Const ORACLE = "oracle"
- 'Private Const ORACLE_SERVER = "BRF9" Produccion
- 'Private Const ORACLE_USER = "iem" Produccion
- 'Private Const ORACLE_PASSWORD = "mei" Produccion
- Private Const ORACLE_SERVER = "BDE9"
- Private Const ORACLE_USER = "prh"
- Private Const ORACLE_PASSWORD = "prh"
- '------------- Constantes Vistas Portal -------------
- 'Las vistas deben ser sin categorizar por que de lo contrario, habran problemas a la hora de iterar a traves de los documentos.
- Private Const VISTA_BANDEJA_ENTRADA = "ExpedienteBandejaEntradaSinCategorizar"
- Private Const VISTA_BANDEJA_TRABAJO = "ExpedienteBandejaTrabajoSinCategorizar"
- '------------- Constantes Vistas Gestion ------------
- 'En esta vista vemos las actuaciones de la forma (NroActuacion)(NroExpe) por ejemplo 102018-4000-98-000004 es la 10ava actuación del
- 'expediente 2018-4000-98-000004.
- Private Const VISTA_ACTUACIONES_NRO_EXPE = "(BusquedaActuacion)"
- '------------- Constantes Documentos Indice ----------------
- Private Const CANTIDAD_ACTUACIONES = "ccnNroAct"
- Private Const BASE_GESTION_DE_INDICE = "base"
- Private Const NUMERO_EXPEDIENTE_INDICE = "clave"
- Private Const ALARMA = "AlarmaMotivoPase"
- Private Const ALARMA_SI = "SI"
- Private Const ALARMA_NO = "NO"
- Private Const TIENE_PAQUETE = "rTienePaquete"
- Private Const ESTADO_INDICE = "ccEstado"
- Private Const ESTADO_TRANSITO = "EN TRÁNSITO"
- Private Const TEMA = "sTema"
- '------------- Constantes Ultima Actuacion -----------------
- Private Const FECHA_RECIBIDO = "fRecibido"
- Private Const FECHA_ENTRADA = "fEntrada"
- Private Const MOTIVO_PASE = "sMotivoDePase"
- Private Const OFICINA_ACTUAL = "ccOficina"
- '------------- Constantes Base Alarma Log ------------------
- Private Const VISTA_ALARMA_LOG = "LogAlarmas"
- Private Const VISTA_TEMAS_POR_NOMBRE = "Reportes\Temas por Nombre"
- Private Const VISTA_CATEGORIAS_POR_NUMERO = "(BusquedaCategoriaXNum)"
- '------------------------------------------------------
- Sub Initialize
- On Error GoTo ErrorActIndice
- Dim session As New NotesSession
- Dim dbPortal As NotesDatabase
- Dim dbGestion As NotesDatabase
- Dim dbDatosExternos As NotesDatabase
- Dim dbRutas As NotesDatabase
- Dim dbLogAlarmas As NotesDatabase
- Dim servidorPrimario As String
- Dim servidorActual As String
- Dim c As Configuracion
- Dim flag_Bandeja_Entrada As Boolean
- '----------------- Bandera para habilitar que busque en Bandeja de Entrada -----------------
- 'Si la bandera es TRUE, busca ademas de la bandeja de trabajo, en bandeja de entrada, tambien contemplara los casos donde
- 'el expediente tenga paquete.
- 'En ese caso (hay paquete) no debo verificar nada. Para los demas documentos debo comparar la fecha habil con la fecha de entrada.
- 'Si la bandera es FALSE busco solamente en la bandeja de trabajo y en el campo fRecibido de las ultimas actuaciones.
- flag_Bandeja_Entrada = True
- '-------------------------------------------------------------------------------------------
- Set c = New Configuracion
- Set dbDatosExternos = c.ReferenciarBaseDeDatos(BASE_DATOS_EXTERNOS)
- Set dbPortal = c.ReferenciarBaseDeDatos(BASE_PORTAL)
- Set dbRutas = c.ReferenciarBaseDeDatos(BASE_RUTAS)
- Set dbLogAlarmas = session.Getdatabase("", BASE_ALARMAS , False)
- '----------------- Busco el servidor primario ------------------'
- 'El agente va a correr unicamente si el servidor actual es el servidor primario
- servidorPrimario = c.ServidorDomino(CLAVE_DBMOTORDOC)
- servidorActual = FullTrim(Replace(session.Currentdatabase.server, "CN=", ""))
- servidorActual = Replace(servidorActual, "O=", "")
- If UCase(servidorPrimario) = UCase(servidorActual) Then
- 'Guardare en dos variants los motivos de pase y la cantidad de días del mismo
- Dim motivosPase As Vector
- Dim diasMotivos As Vector
- Dim fechaHabil As Vector
- Set motivosPase = New Vector(0)
- Set diasMotivos = New Vector(0)
- Set fechaHabil = New Vector(0)
- Dim viewDatosExternos As NotesView
- Dim viewPortal As NotesView
- Set viewDatosExternos = dbDatosExternos.Getview(VISTA_MOTIVOS)
- Dim coleccionMotivosPase As NotesDocumentCollection
- Set coleccionMotivosPase = viewDatosExternos.Getalldocumentsbykey(TAG_MOTIVOS_PASE, False)
- Dim docMotivoPase As NotesDocument
- Set docMotivoPase = coleccionMotivosPase.Getfirstdocument()
- Dim valorMotivoPase As String
- Dim splitValorMotivoPase As Variant
- While Not docMotivoPase Is Nothing
- valorMotivoPase = docMotivoPase.Getitemvalue("Codigo")(0)
- splitValorMotivoPase = Split(valorMotivoPase,"|")
- Call motivosPase.insertElement(splitValorMotivoPase(0), motivosPase.cantElem+1)
- Call diasMotivos.insertElement(splitValorMotivoPase(1), diasMotivos.cantElem+1)
- Call fechaHabil.insertElement(obtenerFechaHabil(splitValorMotivoPase(1)), fechaHabil.cantElem+1)
- Set docMotivoPase = coleccionMotivosPase.Getnextdocument(docMotivoPase)
- MsgBox "FechHabil: " & obtenerFechaHabil(splitValorMotivoPase(1)) + "Cantidad Días: " & splitValorMotivoPase(1)
- Wend
- 'Luego de este while, los vectores motivosPase, diasMotivos y fechaHabil estan cargados con los motivos, los dias y la fecha ->
- 'habil esa cantidad de dias atras.
- 'Ahora debo recorrer toda la bandeja de entrada y de trabajo y para cada indice debo calcular si amerita poner una alarma o no.
- 'La reglas para despertar una alarma son las siguientes:
- '-Si fechaHabil de ese motivo de pase >= fechaRecibido y/o fechaPase entonces salta alarma.
- '-Si dicha aritmetica es < fechaRecibido y/o fechaPase entonces no salta alarma.
- Dim viewBandejaEntrada As NotesView
- Dim viewBandejaTrabajo As NotesView
- Set viewBandejaEntrada = dbPortal.Getview(VISTA_BANDEJA_ENTRADA)
- Set viewBandejaTrabajo = dbPortal.Getview(VISTA_BANDEJA_TRABAJO)
- viewBandejaEntrada.Autoupdate = False
- viewBandejaTrabajo.Autoupdate = False
- Dim viewActuacionesGestion As NotesView
- Dim ultimaActuacion As NotesDocument
- Dim actuacionYNroExpe As String
- Dim fechaRecibido As NotesDateTime
- Dim fecha As NotesDateTime 'Se usa indistintamente cuando flag_Bandeja_Entrada = True tanto para fecha de entrada como fecha de recibido
- Dim motivoPaseUltimaActuacion As String
- Dim isMemberVectorMotivos As Integer
- Dim pos As Long
- Dim fechaHabilActuacion As NotesDateTime
- Dim timeDifference As Long
- 'Si solo debo recorrer la bandeja de trabajo
- If Not flag_Bandeja_Entrada Then
- Dim docBandejaTrabajo As NotesDocument
- Set docBandejaTrabajo = viewBandejaTrabajo.Getfirstdocument()
- While Not docBandejaTrabajo Is Nothing
- 'Si la cantidad de actuaciones es 1, el documento esta en generación y no amerita poner alarma alguna. No tiene Motivo Pase.
- If docBandejaTrabajo.Hasitem(CANTIDAD_ACTUACIONES) And docBandejaTrabajo.Getitemvalue(CANTIDAD_ACTUACIONES)(0) <> 1 Then
- 'Tengo que ir hasta la ultima actuación del expediente correspondiente al indice seleccionado.
- 'Para eso hago uso de información ya existente en dicho indice, como la base, el nro expediente y la cantidad de actuaciones.
- Set dbGestion = session.Getdatabase("", docBandejaTrabajo.Getitemvalue(BASE_GESTION_DE_INDICE)(0), False)
- 'Si la base gestion correspondiente al indice pudo obtenerse, hago lo siguiente.
- If Not dbGestion Is Nothing Then
- Set viewActuacionesGestion = dbGestion.Getview(VISTA_ACTUACIONES_NRO_EXPE)
- actuacionYNroExpe = CStr(docBandejaTrabajo.Getitemvalue(CANTIDAD_ACTUACIONES)(0)) + CStr(docBandejaTrabajo.Getitemvalue(NUMERO_EXPEDIENTE_INDICE)(0))
- Set ultimaActuacion = viewActuacionesGestion.Getdocumentbykey(actuacionYNroExpe, True)
- 'Si se pudo obtener de la ultima actuacion, debo agarrar el motivo de pase y la fecha de recibido
- If Not ultimaActuacion Is Nothing Then
- Set fechaRecibido = New NotesDateTime(CStr(ultimaActuacion.Getitemvalue(FECHA_RECIBIDO)(0)))
- motivoPaseUltimaActuacion = ultimaActuacion.Getitemvalue(MOTIVO_PASE)(0)
- If motivoPaseUltimaActuacion <> "" Then
- 'Si entro a esta condición significa se obtuvo un motivo de pase distinto de vacio
- isMemberVectorMotivos = motivosPase.isMember(motivoPaseUltimaActuacion, Pos, False)
- 'Luego del isMember en la variable Pos se guardo la posición en el vector de dicho motivo.
- 'Si Pos=-1, no se encontro. Si Pos>=1 se encontro.
- MsgBox "Pos: " & Pos
- If Pos >= 1 Then
- 'Esto significa que en mi vector que cargue anteriormente desde datos externos se encontro el motivo de
- 'pase que tiene la ultima actuación encontrada a partir del documento indice.
- 'Ahora sabiendo la posicion busco en el vector de fechas habiles y tendre la fecha con que comparar a la
- 'fecha de recibido.
- Set fechaHabilActuacion = New NotesDateTime(fechaHabil.getElement(Pos))
- 'Ahora tengo la fecha habil de la actuación. Esta fecha representa la fecha en que debio haber sido
- 'enviado el pase para caducara el día de hoy.
- 'Lo que tengo que hacer ahora son comparaciones a fin de cuenta de calcular si hay alarma o no.
- 'La aritmetica es la comentaba al comienzo del codigo.
- timeDifference = fechaHabilActuacion.Timedifference(fechaRecibido)
- If timeDifference >= 0 Then
- 'La diferencia de la fecha habil del motivo de pase y la fecha de recibido es mayor a 0.
- 'Hay que saltar la alarma.
- MsgBox "Se metio alarma al expediente: " + docBandejaTrabajo.getitemvalue("clave")(0)
- Call docBandejaTrabajo.Replaceitemvalue(ALARMA, ALARMA_SI)
- Call docBandejaTrabajo.Save(True,False)
- Call generarLog(dbLogAlarmas, dbRutas, docBandejaTrabajo, ultimaActuacion)
- Else 'En este caso no hay que saltar la alarma, PERO LUEGO TENDRE QUE LOGEAR IGUAL.
- MsgBox "Se nego alarma al expediente: " + docBandejaTrabajo.getitemvalue("clave")(0)
- Call docBandejaTrabajo.Replaceitemvalue(ALARMA, ALARMA_NO)
- Call docBandejaTrabajo.Save(True,False)
- Call generarLog(dbLogAlarmas, dbRutas, docBandejaTrabajo, ultimaActuacion)
- End If
- End If
- 'Seteamos Pos a -1 para volver a buscar.
- Pos = -1
- End If
- End If
- End If
- End If
- actuacionYNroExpe = ""
- Set docBandejaTrabajo = viewBandejaTrabajo.Getnextdocument(docBandejaTrabajo)
- Wend
- Else
- 'Esto es cuando flag_Bandeja_Entrad = True.
- 'En este caso debo recorrer tanto la bandeja de trabajo como la bandeja de entrada.
- 'Tambien debo ver en la bandeja de entrada si el expediente tiene paquete. En ese caso debo omitirlo, no prestarle atención.
- 'Para todos los demas documentos, ya sea de la bandeja de entrada o bandeja de trabajo, debo comparar la fecha habil del motivo
- 'que tenga dicho documento, con la fecha de pase (fEntrada).
- Dim docBandeja As NotesDocument
- Set docBandeja = viewBandejaTrabajo.Getfirstdocument()
- Dim finalizoRecorridaBandejaTrabajo As Boolean
- finalizoRecorridaBandejaTrabajo = False
- While Not docBandeja Is Nothing
- 'Si las siguientes condiciones son verdaderas, entonces hay que considerar hacer el respectivo chequeo.
- 'Si la cantidad de actuaciones es 1, el documento esta en generación.
- 'Si TIENE_PAQUETE <> "SI" o TIENE_PAQUETE = "SI" y ESTADO_INDICE <> "En Transito" o No tiene paquete.
- If docBandeja.Hasitem(CANTIDAD_ACTUACIONES) And docBandeja.Getitemvalue(CANTIDAD_ACTUACIONES)(0) <> 1 And ( (docBandeja.Hasitem(TIENE_PAQUETE) And UCase(docBandeja.Getitemvalue(TIENE_PAQUETE)(0)) <> "SI") Or (docBandeja.Hasitem(TIENE_PAQUETE) And UCase(docBandeja.Getitemvalue(TIENE_PAQUETE)(0)) = "SI" And docBandeja.Hasitem(ESTADO_INDICE) And UCase(docBandeja.Getitemvalue(ESTADO_INDICE)(0)) <> ESTADO_TRANSITO ) Or Not docBandeja.Hasitem(TIENE_PAQUETE) ) Then
- 'Tengo que ir hasta la ultima actuación del expediente correspondiente al indice seleccionado.
- 'Para eso hago uso de información ya existente en dicho indice, como la base, el nro expediente y la cantidad de actuaciones.
- Set dbGestion = session.Getdatabase("", docBandeja.Getitemvalue(BASE_GESTION_DE_INDICE)(0), False)
- 'Si la base gestion correspondiente al indice pudo obtenerse, hago lo siguiente.
- If Not dbGestion Is Nothing Then
- Set viewActuacionesGestion = dbGestion.Getview(VISTA_ACTUACIONES_NRO_EXPE)
- actuacionYNroExpe = CStr(docBandeja.Getitemvalue(CANTIDAD_ACTUACIONES)(0)) + CStr(docBandeja.Getitemvalue(NUMERO_EXPEDIENTE_INDICE)(0))
- Set ultimaActuacion = viewActuacionesGestion.Getdocumentbykey(actuacionYNroExpe, True)
- 'Si se pudo obtener de la ultima actuacion, debo agarrar el motivo de pase y la fecha de entrada
- If Not ultimaActuacion Is Nothing Then
- 'Aqui discrimino si tiene paquete o no. Si tiene paquete debo considerar la fecha de recibido.
- 'Si no tiene paquete debo considerar la fecha de entrada.
- If docBandeja.Hasitem(TIENE_PAQUETE) And UCase(docBandeja.Getitemvalue(TIENE_PAQUETE)(0)) = "SI" Then
- Set fecha = New NotesDateTime(CStr(ultimaActuacion.Getitemvalue(FECHA_RECIBIDO)(0)))
- Else
- Set fecha = New NotesDateTime(CStr(ultimaActuacion.Getitemvalue(FECHA_ENTRADA)(0)))
- End If
- motivoPaseUltimaActuacion = ultimaActuacion.Getitemvalue(MOTIVO_PASE)(0)
- If motivoPaseUltimaActuacion <> "" Then
- 'Si entro a esta condición significa se obtuvo un motivo de pase distinto de vacio
- isMemberVectorMotivos = motivosPase.isMember(motivoPaseUltimaActuacion, Pos, False)
- 'Luego del isMember en la variable Pos se guardo la posición en el vector de dicho motivo.
- 'Si Pos=-1, no se encontro. Si Pos>=1 se encontro.
- MsgBox "Pos: " & Pos
- If Pos >= 1 Then
- 'Esto significa que en mi vector que cargue anteriormente desde datos externos se encontro el motivo de
- 'pase que tiene la ultima actuación encontrada a partir del documento indice.
- 'Ahora sabiendo la posicion busco en el vector de fechas habiles y tendre la fecha con que comparar a la
- 'fecha de entrada.
- Set fechaHabilActuacion = New NotesDateTime(fechaHabil.getElement(Pos))
- 'Ahora tengo la fecha habil de la actuación. Esta fecha representa la fecha en que debio haber sido
- 'enviado el pase para caducara el día de hoy.
- 'Lo que tengo que hacer ahora son comparaciones a fin de cuenta de calcular si hay alarma o no.
- 'La aritmetica es la comentaba al comienzo del codigo.
- timeDifference = fechaHabilActuacion.Timedifference(fecha)
- If timeDifference >= 0 Then
- 'La diferencia de la fecha habil del motivo de pase y la fecha de recibido o de pase es mayor a 0.
- 'Hay que saltar la alarma.
- MsgBox "Se metio alarma al expediente: " + docBandeja.getitemvalue("clave")(0)
- Call docBandeja.Replaceitemvalue(ALARMA, ALARMA_SI)
- Call docBandeja.Save(True,False)
- Call generarLog(dbLogAlarmas, dbRutas, docBandeja, ultimaActuacion)
- Else 'En este caso no hay que saltar la alarma, PERO LUEGO TENDRE QUE LOGEAR IGUAL.
- MsgBox "Se nego alarma al expediente: " + docBandeja.getitemvalue("clave")(0)
- Call docBandeja.Replaceitemvalue(ALARMA, ALARMA_NO)
- Call docBandeja.Save(True,False)
- Call generarLog(dbLogAlarmas, dbRutas, docBandeja, ultimaActuacion)
- End If
- End If
- 'Seteamos Pos a -1 para volver a buscar.
- Pos = -1
- End If
- End If
- End If
- End If
- actuacionYNroExpe = ""
- 'El siguiente codigo es para que una vez que termine de iterar en la bandeja de trabajo, empiece a iterar en la de entrada.
- If Not finalizoRecorridaBandejaTrabajo Then
- Set docBandeja = viewBandejaTrabajo.Getnextdocument(docBandeja)
- Else
- Set docBandeja = viewBandejaEntrada.Getnextdocument(docBandeja)
- End If
- If docBandeja Is Nothing Then
- If Not finalizoRecorridaBandejaTrabajo Then
- 'Si entra aca es por que termino la recorrida de la bandeja de trabajo y hay que setear la bandeja de entrada
- finalizoRecorridaBandejaTrabajo = True
- MsgBox "Fin de la bandeja de trabajo, comienzo de bandeja de entrada"
- Set docBandeja = viewBandejaEntrada.Getfirstdocument()
- End If
- End If
- Wend
- End If
- End If
- Exit Sub
- ErrorActIndice:
- MsgBox "ERRROR: " + Error
- MsgBox "ERL: " & ERL
- Exit Sub
- End Sub
- Function generarFechaHoy() As String
- Dim fileNameAnio, fileNameMes, fileNameDia As String
- fileNameAnio = Right(CStr(Year(Today)),2)
- fileNameMes = CStr(Month(Today))
- If Month(Today) < 10 Then fileNameMes = "0" & fileNameMes
- fileNameDia = CStr(Day(Today))
- If Day(Today) < 10 Then fileNameDia = "0" & fileNameDia
- generarFechaHoy = fileNameDia + "/" + fileNameMes + "/" + fileNameAnio
- End Function
- %REM
- Sub generarLog
- Description: Comments for Sub
- %END REM
- Sub generarLog(baseNotes As NotesDatabase, baseRutas As NotesDatabase, docIndice As NotesDocument, ultimaActuacion As NotesDocument)
- On Error GoTo errorGenerarLog
- If Not baseNotes Is Nothing Then
- Dim viewLog As NotesView
- Set viewLog = baseNotes.Getview(VISTA_ALARMA_LOG)
- Dim actuacionYNroExpe As String
- actuacionYNroExpe = Trim(CStr(docIndice.Getitemvalue(CANTIDAD_ACTUACIONES)(0)) + CStr(docIndice.Getitemvalue(NUMERO_EXPEDIENTE_INDICE)(0)))
- Dim documentoLog As NotesDocument
- Set documentoLog =viewLog.Getdocumentbykey(actuacionYNroExpe, True)
- If Not documentoLog Is Nothing Then
- 'Si en la vista se encuentra el log, debo modificar los valores pertinentes como AlarmaHasta
- If docIndice.Hasitem(ALARMA) And docIndice.Getitemvalue(ALARMA)(0) = ALARMA_SI Then
- Call documentoLog.Replaceitemvalue("HayAlarma", ALARMA_SI)
- Call documentoLog.Replaceitemvalue("AlarmaHasta", Today)
- End If
- Else
- 'Si no se encuentra en la vista, el documento log no existe y debo crear uno.
- Set documentoLog = baseNotes.Createdocument()
- Call documentoLog.Replaceitemvalue("Form", "LogAlarmas")
- Call documentoLog.Replaceitemvalue("NumeroExpediente", docIndice.Getitemvalue(NUMERO_EXPEDIENTE_INDICE)(0))
- Call documentoLog.Replaceitemvalue("Actuacion", docIndice.Getitemvalue(CANTIDAD_ACTUACIONES)(0))
- If ultimaActuacion.Hasitem(OFICINA_ACTUAL) Then
- Call documentoLog.Replaceitemvalue("Unidad", ultimaActuacion.Getitemvalue(OFICINA_ACTUAL)(0))
- End If
- If docIndice.Hasitem(ALARMA) Then
- If docIndice.Getitemvalue(ALARMA)(0) = ALARMA_SI Then
- Call documentoLog.Replaceitemvalue("HayAlarma", ALARMA_SI)
- Call documentoLog.Replaceitemvalue("AlarmaDesde", Today)
- Call documentoLog.Replaceitemvalue("AlarmaHasta", Today)
- Else
- Call documentoLog.Replaceitemvalue("HayAlarma", ALARMA_NO)
- Call documentoLog.Replaceitemvalue("AlarmaDesde", "")
- Call documentoLog.Replaceitemvalue("AlarmaHasta", "")
- End If
- End If
- If ultimaActuacion.Hasitem(FECHA_ENTRADA) Then
- Call documentoLog.Replaceitemvalue("FechaEntradaUnidad", ultimaActuacion.Getitemvalue(FECHA_ENTRADA)(0))
- End If
- If ultimaActuacion.Hasitem(FECHA_RECIBIDO) Then
- Call documentoLog.Replaceitemvalue("FechaRecibidoUnidad", ultimaActuacion.Getitemvalue(FECHA_RECIBIDO)(0))
- End If
- If docIndice.Hasitem(TEMA) Then
- Call documentoLog.Replaceitemvalue("Tema", docIndice.Getitemvalue(TEMA)(0))
- 'Ahora sabiendo el tema debo buscar en una vista de temas por nombre y obtener su número de categoria.
- 'Sabiendo dicho número de categoría puedo obtener esta ultima.
- Dim viewTemasPorNombre As NotesView
- Dim viewCategoriasPorNumero As NotesView
- Dim docTema As NotesDocument
- Dim docCategoria As NotesDocument
- Set viewTemasPorNombre = baseRutas.Getview(VISTA_TEMAS_POR_NOMBRE)
- Set viewCategoriasPorNumero = baseRutas.Getview(VISTA_CATEGORIAS_POR_NUMERO)
- Set docTema = viewTemasPorNombre.Getdocumentbykey(docIndice.Getitemvalue(TEMA)(0), True)
- MsgBox "cat: " + docTema.Getitemvalue("sCategoria")(0)
- If Not docTema Is Nothing Then
- 'Si pude obtener el tema, dado el numero de categoria conseguire el nombre de la misma
- Set docCategoria = viewCategoriasPorNumero.Getdocumentbykey(docTema.Getitemvalue("sCategoria")(0), True)
- If Not docCategoria Is Nothing Then
- Call documentoLog.Replaceitemvalue("Categoria", docCategoria.Getitemvalue("sNombreCategoria")(0))
- Else
- Call documentoLog.Replaceitemvalue("Categoria", "NO TIENE")
- End If
- End If
- Else 'No tiene tema, y por consiguiente, tampoco categoria
- Call documentoLog.Replaceitemvalue("Tema", "NO TIENE")
- Call documentoLog.ReplaceItemValue("Categoria", "NO TIENE")
- End If
- If ultimaActuacion.Hasitem(MOTIVO_PASE) Then
- Call documentoLog.Replaceitemvalue("MotivoDePase", ultimaActuacion.Getitemvalue(MOTIVO_PASE)(0))
- Else
- Call documentoLog.Replaceitemvalue("MotivoDePase", "NO TIENE O ERROR")
- End If
- If docIndice.Hasitem("ccEstado") And UCase(docIndice.Getitemvalue("ccEstado")(0)) <> ESTADO_TRANSITO Then
- Call documentoLog.Replaceitemvalue("Bandeja", "Trabajo")
- Else
- Call documentoLog.Replaceitemvalue("Bandeja", "Entrada")
- End If
- End If
- MsgBox "JIJJI"
- Call documentoLog.Save(True,False)
- Else
- 'ERROR
- End If
- Exit sub
- errorGenerarLog:
- MsgBox "Error: " + Error
- MsgBox "Error en la linea : " & erl
- Exit sub
- End Sub
- %REM
- Function obtenerFechaHabil
- Description: Dado una cantidad de dias pasada como parametro, devuelve la fecha habil.
- %END REM
- Function obtenerFechaHabil(CantidadDias As String) As String
- On Error GoTo errorObtenerFecha
- Dim SQL As String
- Dim count As Long
- Dim fldLst As New LCFieldList
- Dim cantidadResultado As Integer
- Dim fechaHabil As LCfield
- Dim connect As New LCConnection (ORACLE)
- connect.server = ORACLE_SERVER
- connect.Userid = ORACLE_USER
- connect.Password = ORACLE_PASSWORD
- connect.Connect
- If Not connect.IsConnected Then
- RegistrarYGenerarError NOMBRE_APLICACION,"Agente ActualizarIndicesMotivoPase - obtenerFechaHabil - No se conecto a SQL",""
- Exit Function
- End If
- SQL = "Select F_RESTAR_HABILES(TO_DATE(" + "'" + generarFechaHoy() +"'" + ",'dd/mm/yy')," + CantidadDias +") from DUAL"
- 'MsgBox "SQL: " + SQL
- count=connect.Execute (SQL, fldLst)
- cantidadResultado = connect.Fetch(fldLst)
- 'Obtengo el dia habil
- obtenerFechaHabil = CDat(fldLst.Getfield(1).Value(0))
- Exit Function
- errorObtenerFecha:
- MsgBox "Error en funcion ObtenerFechaHabil - Agente ActualizarIndicesMotivoPase en linea " & erl
- Exit Function
- End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement