fix skonto calculation in UE4

This commit is contained in:
Ivaylo Ivanov 2021-11-11 16:09:15 +01:00
parent d7e3b2a3bd
commit 09470bb077

View File

@ -139,12 +139,12 @@ Helper functions:
> int_to_month 11 = Nov > int_to_month 11 = Nov
> int_to_month 12 = Dez > int_to_month 12 = Dez
> skonto_to_num :: Skonto -> Float > skonto_to_num :: Skonto -> Int
> skonto_to_num s > skonto_to_num s
> | s == KeinSkonto = 0 > | s == KeinSkonto = 0
> | s == DreiProzent = 0.03 > | s == DreiProzent = 3
> | s == FuenfProzent = 0.05 > | s == FuenfProzent = 5
> | otherwise = 0.1 > | otherwise = 10
> full_months::[Monat] > full_months::[Monat]
> full_months = [Jan, Mar, Mai, Jul, Aug, Okt, Dez] > full_months = [Jan, Mar, Mai, Jul, Aug, Okt, Dez]
@ -250,9 +250,9 @@ Aufgabe A.1
> | is_credit g = P_Gutschrift (gutschriftsbetrag g) (gutschrift_vom g) > | is_credit g = P_Gutschrift (gutschriftsbetrag g) (gutschrift_vom g)
> | otherwise = AP_Zahlung n (zahlung_vom g) > | otherwise = AP_Zahlung n (zahlung_vom g)
> where > where
> b = fromIntegral(cents (brutto g)) :: Float -- convert b to float > b = cents (brutto g)
> s = skonto_to_num (skonto g) > s = skonto_to_num (skonto g)
> n = C ((round(b - (b * s))) :: Nat1) > n = C ((b - ((b * s) `div` 100)) :: Nat1)
=================================================================================== ===================================================================================