Ciao.

Mi date una mano a sistemare questo codice per favore?

In pratica in un form dati ho quattro campi:

OrarioEntrata_1 OrarioUscita_1
OrarioEntrata_2 OrarioUscita_2

Devo calcolare le ore lavorate in meno rispetto all'orario assegnato a ciascun dipendente ed ho scritto:


codice:
'ORE PREVISTE DAL CONTRATTO
strOreLavorativeGiornaliere = FormatNumber(Rs("OreLavorativeGiornaliere"))
 
'PRIMA FASCIA ORARIA
strOrarioEntrata_1 = replace(strOrarioEntrata_1, ".", ",")
strOrarioUscita_1 = replace(strOrarioUscita_1, ".", ",")

'SECONDA FASCIA ORARIA
strOrarioEntrata_2 = replace(strOrarioEntrata_2, ".", ",")
strOrarioUscita_2 = replace(strOrarioUscita_2, ".", ",")

'DIFFERENZA TRA ORARIO ENTRATA E ORARIO USCITA 
    strOreLavorateGiornaliere = cDbl(strOrarioUscita_1) - cDbl(strOrarioEntrata_1)
    strOreLavorateGiornaliere = FormatNumber(strOreLavorateGiornaliere, 2)
    
    strOreLavorateGiornaliere_1 = cDbl(strOrarioUscita_2) - cDbl(strOrarioEntrata_2)
    strOreLavorateGiornaliere_1 = FormatNumber(strOreLavorateGiornaliere_1, 2)
    

' SE LE ORE PREVISTE SONO MAGGIORI DELLE ORE EFFETTIVE, SIGNIFICA CHE SI E' LAVORATO MENO   
If strOreLavorativeGiornaliere > strOreLavorateGiornaliere then
   strOreLavorateGiornaliere = cDbl(strOreLavorativeGiornaliere) - cDbl(strOreLavorateGiornaliere)
ElseIf strOreLavorativeGiornaliere > strOreLavorateGiornaliere_1 then
   strOreLavorateGiornaliere_1 = cDbl(strOreLavorativeGiornaliere) - cDbl(strOreLavorateGiornaliere_1)
else
   strOreLavorateGiornaliere = 0
end if
Non funziona come dovrebbe nel senso che sbaglio qualche ragionamento...
Gracias!