fixed bug in supplier digest where crates could become negative
This commit is contained in:
parent
303c2716f1
commit
8375041ad7
1 changed files with 7 additions and 2 deletions
|
@ -48,7 +48,7 @@ getSupplierDigestR sId = do
|
|||
<th>_{MsgPricePerCrate}
|
||||
<th>_{MsgTotalValue}
|
||||
$forall dig <- digests
|
||||
$if bdCrates dig > 0
|
||||
$if bdCrates dig /= 0
|
||||
<tr>
|
||||
<td>#{fromMaybe "" $ beverageArtNr $ bdBev dig}
|
||||
<td>#{beverageIdent $ bdBev dig}
|
||||
|
@ -87,8 +87,13 @@ genBevDigest bev =
|
|||
BevDigest amount (amount * (fromMaybe 0 $ beveragePricePerCrate $ entityVal bev)) (entityVal bev)
|
||||
where
|
||||
amount =
|
||||
if ((beverageMaxAmount (entityVal bev) - beverageAmount (entityVal bev)) `div` (fromMaybe 1 $ beveragePerCrate (entityVal bev))) < 0
|
||||
then
|
||||
0
|
||||
else
|
||||
((beverageMaxAmount (entityVal bev) - beverageAmount (entityVal bev)) `div` (fromMaybe 1 $ beveragePerCrate (entityVal bev)))
|
||||
|
||||
|
||||
getDeleteSupplierR :: SupplierId -> Handler Html
|
||||
getDeleteSupplierR sId = do
|
||||
mSup <- runDB $ get sId
|
||||
|
|
Loading…
Reference in a new issue