@ -96,15 +96,6 @@ below parent and children groups."))
( define optname-amount-links ( N_ "Display amounts as hyperlinks" ) )
( define opthelp-amount-links ( N_ "Shows each amounts in the table as a hyperlink to a register or report." ) )
;; closing entries filter - for P&L report
( define pagename-entries "Closing Entries" )
( define optname-closing-pattern ( N_ "Closing Entries pattern" ) )
( define opthelp-closing-pattern ( N_ "Any text in the Description column which identifies closing entries." ) )
( define optname-closing-casing ( N_ "Closing Entries pattern is case-sensitive" ) )
( define opthelp-closing-casing ( N_ "Causes the Closing Entries Pattern match to be case-sensitive." ) )
( define optname-closing-regexp ( N_ "Closing Entries Pattern is regular expression" ) )
( define opthelp-closing-regexp ( N_ "Causes the Closing Entries Pattern to be treated as a regular expression." ) )
;; section labels
( define optname-label-sections ( N_ "Label sections" ) )
( define opthelp-label-sections ( N_ "Whether or not to include a label for sections." ) )
@ -347,23 +338,7 @@ also show overall period profit & loss."))
( add-option
( gnc:make-simple-boolean-option
gnc:pagename-general optname-include-overall-period
"c6" opthelp-include-overall-period #f ) )
;; closing entry match criteria
( add-option
( gnc:make-string-option
pagename-entries optname-closing-pattern
"a" opthelp-closing-pattern ( _ "Closing Entries" ) ) )
( add-option
( gnc:make-simple-boolean-option
pagename-entries optname-closing-casing
"b" opthelp-closing-casing #f ) )
( add-option
( gnc:make-simple-boolean-option
pagename-entries optname-closing-regexp
"c" opthelp-closing-regexp #f ) ) )
"c6" opthelp-include-overall-period #f ) ) )
( gnc:options-set-default-section options gnc:pagename-general )
@ -795,10 +770,11 @@ also show overall period profit & loss."))
( gnc:make-commodity-collector ) )
# :split->elt
( lambda ( s )
( val-coll 'add
( xaccTransGetCurrency ( xaccSplitGetParent s ) )
( xaccSplitGetValue s ) )
( make-datum s ( amt->monetary ( xaccSplitGetBalance s ) )
( unless ( xaccTransGetIsClosingTxn ( xaccSplitGetParent s ) )
( val-coll 'add
( xaccTransGetCurrency ( xaccSplitGetParent s ) )
( xaccSplitGetValue s ) ) )
( make-datum s ( amt->monetary ( xaccSplitGetNoclosingBalance s ) )
( gnc:collector+ val-coll ) ) ) ) ) ) )
accounts ) )
@ -1139,10 +1115,7 @@ also show overall period profit & loss."))
( gnc:html-markup-anchor chart ( _ "Barchart" ) ) ) ) ) ) )
( ( eq? report-type 'pnl )
( let* ( ( closing-str ( get-option pagename-entries optname-closing-pattern ) )
( closing-cased ( get-option pagename-entries optname-closing-casing ) )
( closing-regexp ( get-option pagename-entries optname-closing-regexp ) )
( include-overall-period? ( get-option gnc:pagename-general
( let* ( ( include-overall-period? ( get-option gnc:pagename-general
optname-include-overall-period ) )
( col-idx->datepair
( lambda ( idx )
@ -1161,44 +1134,13 @@ also show overall period profit & loss."))
( cons ( list-ref balancelist idx )
( list-ref balancelist ( 1 + idx ) ) ) ) ) )
( closing-entries ( let ( ( query ( qof-query-create-for-splits ) ) )
( qof-query-set-book query ( gnc-get-current-book ) )
( xaccQueryAddAccountMatch
query income-expense
QOF-GUID-MATCH-ANY QOF-QUERY-AND )
( if ( and closing-str ( not ( string-null? closing-str ) ) )
( xaccQueryAddDescriptionMatch
query closing-str closing-cased closing-regexp
QOF-COMPARE-CONTAINS QOF-QUERY-AND ) )
( xaccQueryAddClosingTransMatch query #t QOF-QUERY-OR )
( let ( ( splits ( qof-query-run query ) ) )
( qof-query-destroy query )
splits ) ) )
;; this function will query the above closing-entries for
;; splits within the date range, and produce the total
;; amount for these closing entries
( closing-adjustment
( lambda ( account col-idx )
( define datepair ( col-idx->datepair col-idx ) )
( define ( include-split? split )
( and ( equal? ( xaccSplitGetAccount split ) account )
( <= ( car datepair )
( xaccTransGetDate ( xaccSplitGetParent split ) )
( cdr datepair ) ) ) )
( let ( ( account-closing-splits ( filter include-split? closing-entries ) ) )
( gnc:make-gnc-monetary
( xaccAccountGetCommodity account )
( apply + ( map xaccSplitGetAmount account-closing-splits ) ) ) ) ) )
( get-cell-monetary-fn
( lambda ( account col-idx )
( let* ( ( balances ( assoc-ref accounts-balances account ) )
( monetarypair ( col-idx->monetarypair balances col-idx ) ) )
( monetary-less
( cdr monetarypair )
( car monetarypair )
( closing-adjustment account col-idx ) ) ) ) )
( car monetarypair ) ) ) ) )
( get-cell-anchor-fn
( lambda ( account col-idx )