made extra charge for paying cash configurable
This commit is contained in:
parent
1132ab1330
commit
a5d08b1b9f
4 changed files with 7 additions and 2 deletions
|
@ -94,7 +94,7 @@ postBuyCashR bId = do
|
||||||
case quant > beverageAmount bev of
|
case quant > beverageAmount bev of
|
||||||
False -> do
|
False -> do
|
||||||
master <- getYesod
|
master <- getYesod
|
||||||
price <- return $ quant * (beveragePrice bev + 50)
|
price <- return $ quant * (beveragePrice bev + (appCashCharge $ appSettings master))
|
||||||
runDB $ update bId [BeverageAmount -=. quant]
|
runDB $ update bId [BeverageAmount -=. quant]
|
||||||
updateCashier price "Barzahlung"
|
updateCashier price "Barzahlung"
|
||||||
checkAlert bId
|
checkAlert bId
|
||||||
|
|
|
@ -55,6 +55,9 @@ data AppSettings = AppSettings
|
||||||
, appEmail :: Text
|
, appEmail :: Text
|
||||||
-- ^ notification address
|
-- ^ notification address
|
||||||
, appCurrency :: Text
|
, appCurrency :: Text
|
||||||
|
-- ^ Currency character
|
||||||
|
, appCashCharge :: Int
|
||||||
|
-- ^ Extra charge for paying in cash in cents
|
||||||
}
|
}
|
||||||
|
|
||||||
instance FromJSON AppSettings where
|
instance FromJSON AppSettings where
|
||||||
|
@ -82,6 +85,7 @@ instance FromJSON AppSettings where
|
||||||
appAnalytics <- o .:? "analytics"
|
appAnalytics <- o .:? "analytics"
|
||||||
appEmail <- o .: "email"
|
appEmail <- o .: "email"
|
||||||
appCurrency <- o .: "currency"
|
appCurrency <- o .: "currency"
|
||||||
|
appCashCharge <- o .: "cash_charge"
|
||||||
|
|
||||||
return AppSettings {..}
|
return AppSettings {..}
|
||||||
|
|
||||||
|
|
|
@ -28,3 +28,4 @@ database:
|
||||||
#analytics: UA-YOURCODE
|
#analytics: UA-YOURCODE
|
||||||
email: "nek0@momen"
|
email: "nek0@momen"
|
||||||
currency: "€"
|
currency: "€"
|
||||||
|
cash_charge: 50
|
||||||
|
|
|
@ -5,7 +5,7 @@ $doctype 5
|
||||||
<p>
|
<p>
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
_{MsgPricePerUnit (beveragePrice bev + 50) (appCurrency $ appSettings master)}
|
_{MsgPricePerUnit (beveragePrice bev + (appCashCharge $ appSettings master)) (appCurrency $ appSettings master)}
|
||||||
<li>
|
<li>
|
||||||
_{MsgVolume}: #{formatIntVolume (beverageMl bev)}
|
_{MsgVolume}: #{formatIntVolume (beverageMl bev)}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue