obtenerMinutos :: (String, Int, Int, Int) -> Int obtenerMinutos (w, x, y, z) = (y*60)+z diff :: (String, Int, Int, Int) -> (String, Int, Int, Int) -> Int diff x y | (obtenerMinutos x) > (obtenerMinutos y) = (obtenerMinutos x) - (obtenerMinutos y) | otherwise = (obtenerMinutos y) - (obtenerMinutos x) obtenerDiaTrabajado :: (String, Int,Int,Int) -> Int obtenerDiaTrabajado (w, x, y, z) = x obtenerNombre :: (String, Int,Int,Int) -> String obtenerNombre (w, x, y, z) = w obtListaDiasTrabajados :: [(String, Int, Int, Int)] -> String -> [Int] obtListaDiasTrabajados [] _ = [] obtListaDiasTrabajados (x:xs) y | obtenerNombre x == y = (obtenerDiaTrabajado x):obtListaDiasTrabajados xs y | otherwise = obtListaDiasTrabajados xs y intermedio :: Int -> Int ->[Int] intermedio x y | x < (y-1) = (x+1) : intermedio (x+1) y | otherwise = [] listaDesde :: Int -> [Int] listaDesde 0 = [] listaDesde x = x:listaDesde(x-1) ultimo :: [Int] -> Int ultimo [x] = x ultimo (x:xs) = ultimo xs noElUltimo :: [Int] -> [Int] noElUltimo [x] = [] noElUltimo (x:xs) = x:noElUltimo xs invertir :: [Int] -> [Int] invertir [] = [] invertir x = (ultimo x):(invertir(noElUltimo x)) hastaTreinta:: Int -> [Int] hastaTreinta x | x <= 30 = x:hastaTreinta (x+1) | otherwise = [] ausencias:: [(String, Int, Int, Int)] -> String -> [Int] ausencias x y = listaAusencias (obtListaDiasTrabajados x y) listaAusencias:: [Int] -> [Int] listaAusencias [] = [] --listaAusencias [x]:[] = hastaTreinta x --listaAusencias x = intermedios (0:x) jornal:: Integer -> Integer jornal x | (x<8) && (odd x) = 15 | (x>=8) && (even x) = 15 | otherwise = 13 presentismo:: [Int] -> Int presentismo x | (length x)<3 = 150 | otherwise = 0 puntualidad :: [(String, Int, Int, Int)] -> String -> Int puntualidad x y | (llegoTarde (obtHHMM x y) (obtHMIngreso horarioIngreso y)) == True = 0 | otherwise = 100 llegoTarde::[Int] -> Int -> Bool llegoTarde [] _ = True llegoTarde (x:xs) y | abs(x-y) > 20 = False | otherwise = llegoTarde xs y obtHHMM::[(String, Int, Int, Int)] -> String -> [Int] obtHHMM [] _ = [] obtHHMM (x:xs) y | obtenerNombre x == y = ((obtHora x)* 60 + obtMin x): obtHHMM xs y | otherwise = obtHHMM xs y obtHora :: (String, Int,Int,Int) -> Int obtHora (w, x, y, z) = y obtMin :: (String, Int,Int,Int) -> Int obtMin (w, x, y, z) = z obtHMIngreso :: [(String, Int, Int)] -> String -> Int obtHMIngreso [] _ = 0 obtHMIngreso (x:xs) y | obtenerNombre2 x == y = obtMinTresUpla x | otherwise = obtHMIngreso xs y obtMinTresUpla:: (String, Int, Int) -> Int obtMinTresUpla (x,y,z) = (y*60)+z obtenerNombre2:: (String, Int, Int) -> String obtenerNombre2 (x,y,z) = x horarioIngreso :: [(String, Int, Int)] horarioIngreso = [("pepe", 9, 0),("marcelo", 10, 15),("dario", 7, 30)] enero = 1 febrero = 2 marzo = 3 abril = 4 mayo= 5 junio = 6 julio = 7 agosto = 8 septiembre = 9 octubre = 10 noviembre = 11 diciembre = 12 sectores:: [(String, [String])] sectores = [("administrativo", ["contaduria", "facturacion", "proveedores"])] --getRol::[(String, [String])] -> String -> [String] --getRol [] _ = [] --getRol (x:xs) y | (obtNomRol x) == y = (obtRoles x): getRol xs y -- | otherwise = getRol xs y obtNomRol:: (String, [String]) -> String obtNomRol (x,y) = x obtRoles:: (String, [String]) -> [String] obtRoles (x,y) = y getNomSector:: (String, [String]) -> String getNomSector (x,y) = x getSectores:: (String, [String]) -> [String] getSectores (x,y) = y --getSector:: [(String, [String])] -> [String] -> [String] --getSector (x:xs) (y:ys) | (getNomSector x) == y = (getSectores x):(getSector xs ys) -- | otherwise = getSector xs (y:ys) quitaRepetidos :: String -> [String] -> [String] quitaRepetidos _ [] = [] quitaRepetidos x (y:ys) | x/=y = y:quitaRepetidos x ys | otherwise = quitaRepetidos x ys procesarSectores::[String] -> [String] procesarSectores []= [] procesarSectores (x:xs) = x:procesarSectores(quitaRepetidos x xs)