mirror of
https://github.com/simonmichael/hledger.git
synced 2024-12-26 03:42:25 +03:00
close: refactor
This commit is contained in:
parent
a5eb5bdff9
commit
f320345699
@ -43,22 +43,25 @@ close CliOpts{rawopts_=rawopts, reportopts_=ropts} j = do
|
|||||||
-- amounts in opening/closing transactions should be too (#941)
|
-- amounts in opening/closing transactions should be too (#941)
|
||||||
-- setprec = setFullPrecision
|
-- setprec = setFullPrecision
|
||||||
setprec = setMinimalPrecision
|
setprec = setMinimalPrecision
|
||||||
ps = [posting{paccount=a
|
|
||||||
,pamount=mixed [setprec b]
|
closingps = [posting{paccount=a
|
||||||
,pbalanceassertion=Just assertion{ baamount=setprec b }
|
,pamount=mixed [setprec $ negate b]
|
||||||
}
|
,pbalanceassertion=Just assertion{baamount=setprec b{aquantity=0}}
|
||||||
|(a,_,_,mb) <- acctbals
|
}
|
||||||
,b <- amounts $ normaliseMixedAmountSquashPricesForDisplay mb
|
| (a,_,_,mb) <- acctbals
|
||||||
]
|
, b <- amounts $ normaliseMixedAmountSquashPricesForDisplay mb
|
||||||
++ [posting{paccount="equity:opening balances", pamount=balancingamt}]
|
]
|
||||||
nps = [posting{paccount=a
|
++ [posting{paccount="equity:closing balances", pamount=negate balancingamt}]
|
||||||
,pamount=mixed [setprec $ negate b]
|
|
||||||
,pbalanceassertion=Just assertion{ baamount= setprec b{aquantity=0} }
|
openingps = [posting{paccount=a
|
||||||
}
|
,pamount=mixed [setprec b]
|
||||||
|(a,_,_,mb) <- acctbals
|
,pbalanceassertion=Just assertion{baamount=setprec b}
|
||||||
,b <- amounts $ normaliseMixedAmountSquashPricesForDisplay mb
|
}
|
||||||
]
|
| (a,_,_,mb) <- acctbals
|
||||||
++ [posting{paccount="equity:closing balances", pamount=negate balancingamt}]
|
, b <- amounts $ normaliseMixedAmountSquashPricesForDisplay mb
|
||||||
when closing $ putStr $ showTransaction (nulltransaction{tdate=closingdate, tdescription="closing balances", tpostings=nps})
|
]
|
||||||
when opening $ putStr $ showTransaction (nulltransaction{tdate=openingdate, tdescription="opening balances", tpostings=ps})
|
++ [posting{paccount="equity:opening balances", pamount=balancingamt}]
|
||||||
|
|
||||||
|
when closing $ putStr $ showTransaction (nulltransaction{tdate=closingdate, tdescription="closing balances", tpostings=closingps})
|
||||||
|
when opening $ putStr $ showTransaction (nulltransaction{tdate=openingdate, tdescription="opening balances", tpostings=openingps})
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user