*** MODULO de DIFERENCIAS de HORAS
***
*** caso que sea AM y AM
IF (thisformset.form1.tipocron1.am.Value=1 AND thisformset.form1.tipocron2.am.Value=1) then
diferencia=60*(VAL(SUBSTR(thisformset.form1.txtcf.Value,1,2))-VAL(SUBSTR(thisformset.form1.txtci.Value,1,2)))-VAL(SUBSTR(thisformset.form1.txtci.Value,3,2))+VAL(SUBSTR(thisformset.form1.txtcf.Value,3,2))
thisformset.form1.txthrs2.Value=ROUND(diferencia/60,2)
ENDIF
***
*** caso que sea AM y PM
IF (thisformset.form1.tipocron1.am.Value=1 AND thisformset.form1.tipocron2.pm.Value=1) then
IF VAL(SUBSTR(thisformset.form1.txtcf.Value,1,2))=12 THEN
diferencia=60*(12-VAL(SUBSTR(thisformset.form1.txtci.Value,1,2)))-VAL(SUBSTR(thisformset.form1.txtci.Value,3,2))+VAL(SUBSTR(thisformset.form1.txtcf.Value,3,2))
thisformset.form1.txthrs2.Value=ROUND(diferencia/60,2)
ELSE
diferencia=60*(12-VAL(SUBSTR(thisformset.form1.txtci.Value,1,2))+VAL(SUBSTR(thisformset.form1.txtcf.Value,1,2)))-VAL(SUBSTR(thisformset.form1.txtci.Value,3,2))+VAL(SUBSTR(thisformset.form1.txtcf.Value,3,2))
thisformset.form1.txthrs2.Value=ROUND(diferencia/60,2)
ENDIF
ENDIF
***
*** caso que sea PM y PM
IF(thisformset.form1.tipocron1.pm.Value=1 AND thisformset.form1.tipocron2.pm.Value=1) then
IF (VAL(SUBSTR(thisformset.form1.txtci.Value,1,2))=12 AND VAL(SUBSTR(thisformset.form1.txtcf.Value,1,2))=12) THEN
diferencia=VAL(SUBSTR(thisformset.form1.txtcf.Value,3,2))- VAL(SUBSTR(thisformset.form1.txtci.Value,3,2))
thisformset.form1.txthrs2.Value=ROUND(diferencia/60,2)
ELSE
IF (VAL(SUBSTR(thisformset.form1.txtci.Value,1,2))=12) then
diferencia=(60-VAL(SUBSTR(thisformset.form1.txtci.Value,3,2)))+60*(VAL(SUBSTR(thisformset.form1.txtcf.Value,1,2))-1)+VAL(SUBSTR(thisformset.form1.txtcf.Value,3,2))
thisformset.form1.txthrs2.Value=ROUND(diferencia/60,2)
ELSE
diferencia=60*(VAL(SUBSTR(thisformset.form1.txtcf.Value,1,2))-VAL(SUBSTR(thisformset.form1.txtci.Value,1,2)))+VAL(SUBSTR(thisformset.form1.txtcf.Value,3,2))-VAL(SUBSTR(thisformset.form1.txtci.Value,3,2))
thisformset.form1.txthrs2.Value=ROUND(diferencia/60,2)
ENDIF
ENDIF
ENDIF
***
*** caso que sea PM y PM
IF(thisformset.form1.tipocron1.pm.Value=1 AND thisformset.form1.tipocron2.am.Value=1) then
diferencia=60*(12-VAL(SUBSTR(thisformset.form1.txtci.Value,1,2))+VAL(SUBSTR(thisformset.form1.txtcf.Value,1,2)))+VAL(SUBSTR(thisformset.form1.txtcf.Value,3,2))-VAL(SUBSTR(thisformset.form1.txtci.Value,3,2))
thisformset.form1.txthrs2.Value=ROUND(diferencia/60,2)
ENDIF
thisformset.Refresh