now tracking article loss

This commit is contained in:
nek0 2015-05-19 05:37:22 +02:00
parent 207bcbc35d
commit 58d7a3c443
7 changed files with 9 additions and 0 deletions

View file

@ -28,6 +28,7 @@ postModifyR bId = do
, BeveragePrice =. beveragePrice nBev , BeveragePrice =. beveragePrice nBev
, BeverageAmount =. beverageAmount nBev , BeverageAmount =. beverageAmount nBev
, BeverageAlertAmount =. beverageAlertAmount nBev , BeverageAlertAmount =. beverageAlertAmount nBev
, BeverageCorrectedAmount +=. ((beverageAmount nBev) - (beverageAmount bev))
, BeverageMl =. beverageMl nBev , BeverageMl =. beverageMl nBev
, BeverageAvatar =. beverageAvatar nBev , BeverageAvatar =. beverageAvatar nBev
] ]
@ -46,6 +47,7 @@ modifyForm bev = renderDivs $ Beverage
<*> areq currencyField (fieldSettingsLabel MsgPrice) (Just $ beveragePrice bev) <*> areq currencyField (fieldSettingsLabel MsgPrice) (Just $ beveragePrice bev)
<*> areq amountField (fieldSettingsLabel MsgCurrentStock) (Just $ beverageAmount bev) <*> areq amountField (fieldSettingsLabel MsgCurrentStock) (Just $ beverageAmount bev)
<*> areq amountField (fieldSettingsLabel MsgAnnouncedStock) (Just $ beverageAlertAmount bev) <*> areq amountField (fieldSettingsLabel MsgAnnouncedStock) (Just $ beverageAlertAmount bev)
<*> pure (beverageCorrectedAmount bev)
<*> areq volumeField (fieldSettingsLabel MsgVolume) (Just $ beverageMl bev) <*> areq volumeField (fieldSettingsLabel MsgVolume) (Just $ beverageMl bev)
<*> aopt (selectField avatars) (fieldSettingsLabel MsgSelectAvatar) (Just $ beverageAvatar bev) <*> aopt (selectField avatars) (fieldSettingsLabel MsgSelectAvatar) (Just $ beverageAvatar bev)
where where

View file

@ -72,6 +72,7 @@ newArticleForm = renderDivs $ Beverage
<*> areq currencyField (fieldSettingsLabel MsgPrice) (Just 100) <*> areq currencyField (fieldSettingsLabel MsgPrice) (Just 100)
<*> areq amountField (fieldSettingsLabel MsgAmount) (Just 0) <*> areq amountField (fieldSettingsLabel MsgAmount) (Just 0)
<*> areq amountField (fieldSettingsLabel MsgAmountWarning) (Just 0) <*> areq amountField (fieldSettingsLabel MsgAmountWarning) (Just 0)
<*> pure 0
<*> areq volumeField (fieldSettingsLabel MsgVolume) (Just 500) <*> areq volumeField (fieldSettingsLabel MsgVolume) (Just 500)
<*> aopt (selectField avatars) (fieldSettingsLabel MsgSelectAvatar) Nothing <*> aopt (selectField avatars) (fieldSettingsLabel MsgSelectAvatar) Nothing
where where

View file

@ -115,5 +115,6 @@ insOrUpd bev = do
(bevStorePrice bev) (bevStorePrice bev)
(bevStoreAmount bev) (bevStoreAmount bev)
(bevStoreAlertAmount bev) (bevStoreAlertAmount bev)
0
(bevStoreMl bev) (bevStoreMl bev)
Nothing Nothing

View file

@ -11,6 +11,7 @@ Beverage
price Int price Int
amount Int amount Int
alertAmount Int alertAmount Int
correctedAmount Int default=0
ml Int default=500 ml Int default=500
avatar AvatarId Maybe avatar AvatarId Maybe
UniqueBeverage ident UniqueBeverage ident

View file

@ -100,3 +100,4 @@ DeleteAvatar: Smazat avatar
AvatarDeleted: Avatar úspěšně smazán AvatarDeleted: Avatar úspěšně smazán
AvatarInUseError: Avatar nelze smazat dokud je v užitku AvatarInUseError: Avatar nelze smazat dokud je v užitku
Volume: Objem v l Volume: Objem v l
CorrectedAmount: Stráta

View file

@ -100,3 +100,4 @@ DeleteAvatar: Diesen Avatar löschen
AvatarDeleted: Avatar gelöscht AvatarDeleted: Avatar gelöscht
AvatarInUseError: Avatare können nicht gelöscht werden, solange sie in Benutzung sind. AvatarInUseError: Avatare können nicht gelöscht werden, solange sie in Benutzung sind.
Volume: Volumen in l Volume: Volumen in l
CorrectedAmount: Schwund

View file

@ -9,6 +9,7 @@ $if not $ L.null bevs
<th>_{MsgName} <th>_{MsgName}
<th>_{MsgVolume} <th>_{MsgVolume}
<th>_{MsgCurrentAmount} <th>_{MsgCurrentAmount}
<th>_{MsgCorrectedAmount}
<th>_{MsgAnnouncedStock} <th>_{MsgAnnouncedStock}
<th>_{MsgValueIn $ appCurrency $ appSettings master} <th>_{MsgValueIn $ appCurrency $ appSettings master}
<th> <th>
@ -17,6 +18,7 @@ $if not $ L.null bevs
<td>#{beverageIdent bev} <td>#{beverageIdent bev}
<td>#{formatIntVolume (beverageMl bev)} <td>#{formatIntVolume (beverageMl bev)}
<td>#{beverageAmount bev} <td>#{beverageAmount bev}
<td>#{beverageCorrectedAmount bev}
<td>#{beverageAlertAmount bev} <td>#{beverageAlertAmount bev}
<td>#{formatIntCurrency (beveragePrice bev)} #{appCurrency $ appSettings master} <td>#{formatIntCurrency (beveragePrice bev)} #{appCurrency $ appSettings master}
<td><a href=@{ModifyR bId}>bearbeiten <td><a href=@{ModifyR bId}>bearbeiten