Funcion para calculo de horas (tiempos)
La funcion aqui descrita permite transformar horas y minutos a minutos, realizados los calculos (+ - * / ) , permite transformar de nuevo a horas y minutos.
Facilito mi E-Mailñ para cuantas aclaraciones preciseis. Un saludo a tod@s.
** ----------------------------------------------------------------
** Funcion ....... FCH
** Copyright (C).. 1994, 2005 Jordi Sunyer ( [email protected] )
** Fecha Creac.... 27.07.94
** F. Ult. Modif.. 31.07.94
** Descripción ... CONVERSION DE HORAS (SEXAGESIMALES) => MINUTOS
** 1 - HORAS => MINUTOS
** 2 - MINUTOS => HORAS ( 60 )
** 3 - MINUTOS => HORAS ( 100 )
** ----------------------------------------------------------------
*
*
FUNCTION FCH
PARAMETERS TC, TV && Tipo convers./Valor a conv.
STORE 0 TO VC && Valor convertido
STORE SPACE(2) TO RCSGN && Control de signo
RCSGN = SIGN(TV)
TV = TV * SIGN(TV)
DO CASE && Conversiones
CASE TC = 1 && Horas (60) => Minutos
TV = TV / 100
VC = INT((INT(TV) * 60) + ((TV - INT(TV)) * 100))
CASE TC = 2 && Minutos => Horas ( 60)
HR = INT(TV / 60)
VC = (HR * 100) + (TV - (HR * 60))
CASE TC = 3 && Minutos => Horas (100)
HR = INT(TV / 60)
VC = (HR * 100) + ROUND(((TV - (HR * 60)) * 100) / 60, 0)
ENDCASE
VC = VC * IIF(RCSGN # -1, 1, RCSGN)
RETURN VC
Facilito mi E-Mailñ para cuantas aclaraciones preciseis. Un saludo a tod@s.
** ----------------------------------------------------------------
** Funcion ....... FCH
** Copyright (C).. 1994, 2005 Jordi Sunyer ( [email protected] )
** Fecha Creac.... 27.07.94
** F. Ult. Modif.. 31.07.94
** Descripción ... CONVERSION DE HORAS (SEXAGESIMALES) => MINUTOS
** 1 - HORAS => MINUTOS
** 2 - MINUTOS => HORAS ( 60 )
** 3 - MINUTOS => HORAS ( 100 )
** ----------------------------------------------------------------
*
*
FUNCTION FCH
PARAMETERS TC, TV && Tipo convers./Valor a conv.
STORE 0 TO VC && Valor convertido
STORE SPACE(2) TO RCSGN && Control de signo
RCSGN = SIGN(TV)
TV = TV * SIGN(TV)
DO CASE && Conversiones
CASE TC = 1 && Horas (60) => Minutos
TV = TV / 100
VC = INT((INT(TV) * 60) + ((TV - INT(TV)) * 100))
CASE TC = 2 && Minutos => Horas ( 60)
HR = INT(TV / 60)
VC = (HR * 100) + (TV - (HR * 60))
CASE TC = 3 && Minutos => Horas (100)
HR = INT(TV / 60)
VC = (HR * 100) + ROUND(((TV - (HR * 60)) * 100) / 60, 0)
ENDCASE
VC = VC * IIF(RCSGN # -1, 1, RCSGN)
RETURN VC
