Custom Report > simply divide by 2
Drunal42
andreas_pinter at inode.at
Sun Jan 10 10:53:06 EST 2016
This is probably the dumbest question ever, but I'm not able to divde a given
value by two.
I took the cash-flow report and added another option there, which should
basically do the following:
If the flag is set, divide the "incoming" by two.
I managed to add the option
I managed to read the option
I managed to create my own commodity-collector
And I managed that it will be used instead of the money-in-collector from
the standard report if the flag is set.
But for the sake of god I'm not able to fill my own commodity-collector with
half of what the money-in-collector contains.
I tried
(mycollector 'add report-currency (/ s-report-value 2))
or
(mycollector 'add report-currency (gnc-numeric-div s-report-value 2))
or
(mycollector 'add report-currency (gnc-number-div s-report-value
(gnc-numberic-create 2 100)))
where it originally said
(money-in-collector 'add report-currency s-report value)
all of the above give me an error in gnucash.
It is really just a simple modification I need and I do not plan to create
any additional / more complex reports. Therefore I have not setup any
meaningful development environment yet. I assume it is simply a typing issue
with the s-report-value being one type and 2 something else (I thought it
should be a gnc-numeric as far as I understood it)
Alternatively I tried to get the gnc-numeric value from the
money-in-collector and then divide it by 2 before adding it to my own
collector:
(set! temp (gnc:sum-collector-commodity money-in-collector report-currency
exchange-fn))
(set! temp(gnc:gnc-monetary-amount temp))
;; divide by two here, somehow.
(mycollector 'add report-currency temp)
Any help is appreciated.
--
View this message in context: http://gnucash.1415818.n4.nabble.com/Custom-Report-simply-divide-by-2-tp4682554.html
Sent from the GnuCash - User mailing list archive at Nabble.com.
More information about the gnucash-user
mailing list