![]() |
![]() ![]() |
![]() |
![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 5 Pomógł: 0 Dołączył: 13.02.2010 Ostrzeżenie: (0%) ![]() ![]() |
czy da się jakoś w access zrobić coś takiego: obliczyć czas pomiędzy godzinami i pomnożyć go razy kwotę pieniędzy za godzinę? np. ze skokiem co 15 min. moim problemem jest to, że nie mogę wykonać działania, ponieważ są w różnych typach - kwota to tekst a czas to typ data/godzina. Próbowałem zmienić typ data/godzina na tekst z maską ale nie da się wówczas obliczyć już nawet samego czasu trwania. Można jakoś rozbić tą date/godzinę na osobne: h i mm?
W normalnym obliczaniu daty z data/godzina i pomnożeniu jej przez tekst (kwotę) wychodzą jakieś dziwne liczby ale to mnie akurat nie dziwi- zastanawia mnie sam fakt że takie działanie się wykonuje. Gdybym poznał choć jego kolejność to by mi dało szanse na przemyślenie tego problemu:) Czekam choć na propozycję rozwiązania tego problemu. Pozdrawiam --------------- rozwiązałem problem dość mało profesjonalnie: If txt_czas = "00:00:00" Then txt_przelicznik = 0 else If txt_czas = "00:15:00" Then txt_przelicznik = 0.25 Else If txt_czas = "00:30:00" Then txt_przelicznik = 0.5 Else If txt_czas = "00:45:00" Then txt_przelicznik = 0.75 Else If txt_czas = "01:00:00" Then txt_przelicznik = 1 Else If txt_czas = "01:15:00" Then txt_przelicznik = 1.25 Else If txt_czas = "01:30:00" Then txt_przelicznik = 1.5 Else If txt_czas = "01:45:00" Then txt_przelicznik = 1.75 Else If txt_czas = "02:00:00" Then txt_przelicznik = 2 Else If txt_czas = "02:15:00" Then txt_przelicznik = 2.25 Else If txt_czas = "02:30:00" Then txt_przelicznik = 2.5 Else If txt_czas = "02:45:00" Then txt_przelicznik = 2.75 Else If txt_czas = "03:00:00" Then txt_przelicznik = 3 Else If txt_czas = "03:15:00" Then txt_przelicznik = 3.25 Else If txt_czas = "03:30:00" Then txt_przelicznik = 3.5 Else If txt_czas = "03:45:00" Then txt_przelicznik = 3.75 Else If txt_czas = "04:00:00" Then txt_przelicznik = 4 Else If txt_czas = "04:15:00" Then txt_przelicznik = 4.25 Else If txt_czas = "04:30:00" Then txt_przelicznik = 4.5 Else If txt_czas = "04:45:00" Then txt_przelicznik = 4.75 Else If txt_czas = "05:00:00" Then txt_przelicznik = 5 Else If txt_czas = "05:15:00" Then txt_przelicznik = 5.25 Else If txt_czas = "05:30:00" Then txt_przelicznik = 5.5 Else If txt_czas = "05:45:00" Then txt_przelicznik = 5.75 Else If txt_czas = "06:00:00" Then txt_przelicznik = 6 Else If txt_czas = "06:15:00" Then txt_przelicznik = 6.25 Else If txt_czas = "06:30:00" Then txt_przelicznik = 6.5 Else If txt_czas = "06:45:00" Then txt_przelicznik = 6.75 Else If txt_czas = "07:00:00" Then txt_przelicznik = 7 Else If txt_czas = "07:15:00" Then txt_przelicznik = 7.25 Else If txt_czas = "07:30:00" Then txt_przelicznik = 7.5 Else If txt_czas = "07:45:00" Then txt_przelicznik = 7.75 Else If txt_czas = "08:00:00" Then txt_przelicznik = 8 Else If txt_czas = "08:15:00" Then txt_przelicznik = 8.25 Else If txt_czas = "08:30:00" Then txt_przelicznik = 8.5 Else If txt_czas = "08:45:00" Then txt_przelicznik = 8.75 Else If txt_czas = "09:00:00" Then txt_przelicznik = 9 Else If txt_czas = "09:15:00" Then txt_przelicznik = 9.25 Else If txt_czas = "09:30:00" Then txt_przelicznik = 9.5 Else If txt_czas = "09:45:00" Then txt_przelicznik = 9.75 Else If txt_czas = "10:00:00" Then txt_przelicznik = 10 Else If txt_czas = "10:15:00" Then txt_przelicznik = 10.25 Else If txt_czas = "10:30:00" Then txt_przelicznik = 10.5 Else If txt_czas = "10:45:00" Then txt_przelicznik = 10.75 Else If txt_czas = "11:00:00" Then txt_przelicznik = 11 Else If txt_czas = "11:15:00" Then txt_przelicznik = 11.25 Else If txt_czas = "11:30:00" Then txt_przelicznik = 11.5 Else If txt_czas = "11:45:00" Then txt_przelicznik = 11.75 Else If txt_czas = "12:00:00" Then txt_przelicznik = 12 Else If txt_czas = "12:15:00" Then txt_przelicznik = 12.25 Else If txt_czas = "12:30:00" Then txt_przelicznik = 12.5 Else If txt_czas = "12:45:00" Then txt_przelicznik = 12.75 Else If txt_czas = "13:00:00" Then txt_przelicznik = 13 Else If txt_czas = "13:15:00" Then txt_przelicznik = 13.25 Else If txt_czas = "13:30:00" Then txt_przelicznik = 13.5 Else If txt_czas = "13:45:00" Then txt_przelicznik = 13.75 Else If txt_czas = "14:00:00" Then txt_przelicznik = 14 Else If txt_czas = "14:15:00" Then txt_przelicznik = 14.25 Else If txt_czas = "14:30:00" Then txt_przelicznik = 14.5 Else If txt_czas = "14:45:00" Then txt_przelicznik = 14.75 Else If txt_czas = "15:00:00" Then txt_przelicznik = 15 Else If txt_czas = "15:15:00" Then txt_przelicznik = 15.25 Else If txt_czas = "15:30:00" Then txt_przelicznik = 15.5 Else If txt_czas = "15:45:00" Then txt_przelicznik = 15.75 Else If txt_czas = "16:00:00" Then txt_przelicznik = 16 Else If txt_czas = "16:15:00" Then txt_przelicznik = 16.25 Else If txt_czas = "16:30:00" Then txt_przelicznik = 16.5 Else If txt_czas = "16:45:00" Then txt_przelicznik = 16.75 Else If txt_czas = "17:00:00" Then txt_przelicznik = 17 Else If txt_czas = "17:15:00" Then txt_przelicznik = 17.25 Else If txt_czas = "17:30:00" Then txt_przelicznik = 17.5 Else If txt_czas = "17:45:00" Then txt_przelicznik = 17.75 Else If txt_czas = "18:00:00" Then txt_przelicznik = 18 Else If txt_czas = "18:15:00" Then txt_przelicznik = 18.25 Else If txt_czas = "18:30:00" Then txt_przelicznik = 18.5 Else If txt_czas = "18:45:00" Then txt_przelicznik = 18.75 Else If txt_czas = "19:00:00" Then txt_przelicznik = 19 Else If txt_czas = "19:15:00" Then txt_przelicznik = 19.25 Else If txt_czas = "19:30:00" Then txt_przelicznik = 19.5 Else If txt_czas = "19:45:00" Then txt_przelicznik = 19.75 Else txt_przelicznik = "BŁĄD" End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If Ten post edytował kris_IV 16.02.2010, 20:28:07 |
|
|
![]()
Post
#2
|
|
Grupa: Zarejestrowani Postów: 171 Pomógł: 18 Dołączył: 13.03.2009 Skąd: lublin Ostrzeżenie: (0%) ![]() ![]() |
w VBA -> select case bo to co zrobiłeś kłuje w oczy
w Accessie zrób tabelę zawierającą wszystkie godziny, a w kolumnie obok wartość w kwerendzie dodajesz tabelę kt órą stworzyłeś, zakładasz relację z kolumną godzin i mnożysz razy wartość z drugiej tabeli |
|
|
![]()
Post
#3
|
|
Grupa: Zarejestrowani Postów: 2 178 Pomógł: 596 Dołączył: 25.09.2009 Skąd: Piwniczna-Zdrój Ostrzeżenie: (0%) ![]() ![]() |
Można rozbić date/czas np. na minuty. Co więcej umożliwia to funkcja do odejmowania dat/czasu:
SELECT (DATEDIFF("n", data1, data2) / 60 AS godzin) * stawka_za_godzine FROM tabela W powyższym zapytaniu "n" powoduje odejmowanie z uwzględnieniem minut. Dodatkowo wypadałoby zaokrąglić to, co zwróci nam "kolorowa" część zapytania, albo całość w zależności od tego, jak są liczone godziny pracy. |
|
|
![]() ![]() |
![]() |
Aktualny czas: 20.08.2025 - 14:27 |