2010-07-12 GnuCash IRC logs

00:10:46 *** harlan_ has quit IRC
00:11:13 *** harlan_ has joined #gnucash
00:32:14 *** aldente has joined #gnucash
00:49:49 *** Krumar has quit IRC
00:57:32 *** aldente has quit IRC
03:34:28 *** message144 has joined #gnucash
03:56:10 *** message144 has quit IRC
04:51:49 *** bentob0x has joined #gnucash
05:38:09 *** andyt has quit IRC
05:38:58 *** andyt has joined #gnucash
07:17:48 *** fbond has joined #gnucash
07:52:57 *** bentob0x has quit IRC
08:13:13 <blathijs> Is there any way to generate a sales tax report?
08:14:30 <blathijs> e.g., for a given period, a table containing all entries from the the tax table with for each entry the total amount of transactions using the tax table, as well as the the total amount of tax to pay
08:19:37 <blathijs> Or should I write my own report for this?
08:27:24 *** warlord-afk is now known as warlord
08:27:33 <warlord> You will need to write a new report for that, blathijs
08:32:41 <blathijs> ok, thanks
08:32:59 <blathijs> Is there any documentation of the GnuCash scheme bindings somewhere?
08:36:20 *** Jimraehl has left #gnucash
08:48:19 <warlord> unfortunately, not really. BUT the scheme API is effectively the C API, so the C docs are... close.
08:48:36 <blathijs> :-)
08:51:06 *** Jimraehl has joined #gnucash
09:01:07 *** bentob0x has joined #gnucash
09:12:29 *** Jimraehl has quit IRC
09:13:28 *** Jimraehl has joined #gnucash
09:21:55 *** ErKa has joined #gnucash
10:09:31 *** daedeloth has joined #gnucash
10:10:07 *** markjenkinsparit has joined #gnucash
10:13:40 <blathijs> Hmm, is there a generated doxygen HTML for kvp_doc.txt
10:13:42 <blathijs> ?
10:15:56 <warlord> I dont think so
10:16:10 <blathijs> It looks like doxygen formatted stuff
10:20:30 <blathijs> Hmm, it seems like make doc should catch it
10:21:43 <blathijs> It's here: http://svn.gnucash.org/docs/HEAD/kvpvalues.html
10:21:56 <blathijs> I googled for the page title :-)
10:24:46 <warlord> ah, ok.
10:25:40 <blathijs> Doesn't document kvp values for linking a transaction to an invoice, though.
10:25:52 <blathijs> Or are (posting) transactions not linked to an invoice using KVP?
10:27:10 <warlord> It is.
10:27:15 <warlord> Not documented that way
10:28:05 <blathijs> I was thinking of iterating all transactions to find all posted sales tax-related transactions
10:28:23 <blathijs> OTOH, it might be better to just iterate all (posted) invoices and look at their entries
10:28:28 <blathijs> Any insights on that?
10:29:07 <blathijs> Ah, there's an gncInvoiceGetInvoiceFromTxn function that would save me the KVP stuff :-)
10:35:08 <warlord> Yep
10:44:50 <blathijs> Hmm, the query subsystem only queries splits, it seems?
10:46:37 <blathijs> I'm trying to get a list of invoices (eventually filtered on post date), but I can't find how that works
10:57:37 <warlord> Nope, you can query anything
10:57:57 <warlord> (gnc-query-for...)
11:02:48 *** jpetersen has joined #gnucash
11:03:36 <blathijs> warlord: Hmm, couldn't find the GNC_ID_ constant for invoices in the list, but I've just found it in the business department
11:03:40 <blathijs> Let's have a go with that, then
11:49:22 <blathijs> warlord: Hmm, but how to get the results, then?
11:49:35 <blathijs> I can only find xaccQueryGetSplits and ..Transactions
11:50:54 <warlord> blathijs: qof_query_run
11:51:16 <blathijs> Thanks
11:53:18 <blathijs> Hmm, that's weird. http://svn.gnucash.org/docs/HEAD/group__Query.html doesn't show any functions in the table of contents, but does contain them in the actual documentation below
11:53:24 <blathijs> that's why I hadn't found query_run yet
11:54:00 <blathijs> Ah, it's listed in qofquery.h docs as well
11:59:45 <warlord> ok
12:02:50 <blathijs> Hmm, gconf-query-for won't accept a string (gconf-query-for "gncInvoice") nor (gconf-query-for (GNC-ID-INVOICE)) work
12:03:04 <blathijs> ERROR: Wrong type argument in position 1: "gncInvoice"
12:03:13 <blathijs> Could it be that a string is different from a gchar* ?
12:03:22 <blathijs> Hm, no, a gchar was just a char IIRC
12:05:49 <blathijs> (And its gconf-query-create-for, btw)
12:06:00 <blathijs> uh
12:06:13 <blathijs> qof-query-create-for even (I shouldn't be messing in two projects at the same tim e:-)
12:06:30 <blathijs> It seems qof-query-create-for isn't even used anywhere, only qof-query-create-for-splits
12:08:25 <warlord> Yeah, it's possible that the QOF Query isn't used in scheme for anything else.
12:09:17 <blathijs> Any clues on how I should call it?
12:09:38 <blathijs> The relevant line from swig-engine.c is: argp1 = (QofIdTypeConst *)SWIG_MustGetPtr(s_0, SWIGTYPE_p_QofIdTypeConst, 1, 0);
12:09:49 <blathijs> I suspect this is the line that generates the error?
12:10:52 *** aldente has joined #gnucash
12:12:25 *** fbond has quit IRC
12:17:08 <warlord> try (gconf-query-for GNC-ID-INVOICE) ?
12:17:14 <warlord> er, qof-query-for
12:17:45 <blathijs> ERROR: Wrong type argument in position 1: #<primitive-procedure GNC-ID-INVOICE>
12:18:18 <blathijs> For some reason swig thinks the type shouldn't be char*, but I can't seem to find out where the actual check is performed
12:18:27 <warlord> I dont know.
12:18:33 <blathijs> (or rather, I can't find where the swig_types array is filled)
12:18:43 <warlord> It could be the swig wrappings are... wrong.
12:19:18 <blathijs> Seems like that
12:19:55 <warlord> If the wrapper has never been used then the wrapping has never been tested.
12:21:03 <blathijs> Any suggestion on a similar function I could compare with?
12:21:43 <blathijs> And AFAICS the wrappers are autogenerated using engine.i as input, right? (and the normal header files, of course) Or are there more inputs?
12:22:21 <warlord> There are other things, like core-types.i, etc.
12:22:43 <warlord> Also, there may be a problem with the generic qof-query-run because you need to tell scheme what kind of object is being returned.
12:25:30 <blathijs> Isn't it just a list of pointers? Or does it need to know pointers-to-what? :-)
12:27:26 <warlord> scheme needs to know pointers-to-what
12:48:48 *** Linuturk has joined #gnucash
12:50:04 *** Linuturk has joined #gnucash
12:54:22 *** Linuturk has quit IRC
12:57:39 *** Linuturk has joined #gnucash
13:01:04 <blathijs> warlord: Can I do some generic cast in scheme, or should I write a query-run-invoices function in engine.i
13:01:07 <blathijs> ?
13:02:08 <warlord> Well, it would be business.i --- and yeah, you might need to do that.
13:02:56 <blathijs> k :-)
13:03:02 <blathijs> Let's read up a bit on swig, then :-)
13:07:19 <warlord> ok
13:10:06 *** Linuturk has quit IRC
13:11:34 *** Linuturk has joined #gnucash
13:23:10 *** fbond has joined #gnucash
13:23:33 *** fbond has left #gnucash
13:23:41 *** fbond has joined #gnucash
13:39:24 <blathijs> warlord: Adding a "typedef const char* QofIdTypeConst" to base-types.i changes the generated code to use scm2str instead of MustGetPtr or something
13:39:42 <blathijs> warlord: But now it complains because you can't free up a QofIdTypeConst...
13:40:05 <blathijs> e.g., there's a temporary value defined in the generated wrapper, which gets a const type, which you can't free...
13:40:17 <warlord> right, because it's a const string
13:43:32 <blathijs> but you'd say swig can handle const strings as arguments
13:44:09 <blathijs> You could even say the constness of the string is not part of the type passed in, but it's a promise the function makes (I'll not modify this string)
13:44:56 <warlord> Right.
13:45:02 <warlord> I dont know why it's trying to free it.
13:45:17 <blathijs> That makes sense, scm2str returns a newly allocated char*
13:45:40 <blathijs> Hmm, or would that be scm2newstr?
13:46:51 <warlord> I dont know offhand
13:46:56 <blathijs> Ah, it's SWIG_scm2str which eventually calls SWIG_Guile_scm2newstr
13:46:58 <blathijs> which does a malloc
13:47:45 <blathijs> But given that it's a const str, it could just skip the duplication and pass in a pointer to the scm char buffer directly
13:48:20 <blathijs> Though that might produce undefined values when the pointer is retained in the C implemenation and freed within scheme of course
13:48:32 <warlord> Yeah
13:49:59 <blathijs> So duplicating the string is ok
13:50:15 <blathijs> but it should just declare the temporary variable as a char *, not a QofIdTypeConst
13:51:25 <warlord> well, it shouldn't need to duplicate the string.
13:51:59 <blathijs> only because we know that query_create_for doesn't retain the pointer
13:52:08 <warlord> the fact that a QofIdType is a char* is really a detail of the implementation.
13:58:32 <blathijs> Any suggestions on how to get this working?
13:59:41 <blathijs> If I change the argument type to const gchar *, things start working
14:00:15 <blathijs> Then swig correctly discards the const on the variable declared in the wrapp
14:00:16 <blathijs> er
14:01:14 <warlord> okay....
14:02:25 <blathijs> Yup, then I don't get the runtime error anymore
14:02:30 <blathijs> no results either, though
14:07:57 <warlord> sorry. like I said, I dont think anyone has done what you'
14:08:00 <warlord> re trying to do.
14:08:34 <blathijs> That shouldn't stop me from trying, right? :-)
14:08:43 <blathijs> Or are you fed up with my questions?
14:09:48 <blathijs> warlord: You said that you wrote most of the business stuff for your own use. How do you fill in your sales tax reports, then? By calculating the total taxable amount from the tax amount, or don't you need to specify the taxable amount?
14:13:10 <warlord> I have no sales tax reports
14:13:19 <warlord> I dont sell *things*
14:14:07 <blathijs> No sales tax on services? Where are you from? :-)
14:14:15 * blathijs doesn't sell things either
14:14:24 <warlord> USA
14:14:41 <warlord> Sales tax on services varies from locale to locale.
14:15:50 <blathijs> Hmkay
14:15:57 <warlord> But no, when I was doing it I was not in a locale that taxed services
14:16:18 <warlord> where are you?
14:16:25 <blathijs> Netherlands
14:16:40 <blathijs> But I think there's VAT on services in most of Europe
14:17:03 <warlord> Yeah
14:17:16 <warlord> (I'll be in Amsterdam and Maastricht later this month)
14:17:43 <warlord> But that's why there's no report.. I never needed it, and nobody else added a report.
14:18:25 <blathijs> right
14:18:56 <blathijs> Hmm, it seems qof_query_create_for (or more specifically qof_query_search_for) actually explicitly discards the const qualifier from the type :-S
14:22:01 <warlord> It's expecting a const string that will stick around. It's const not just to say "i wont modify it" but it doesn't const say anything about holding onto the pointer... The C code is expecting to be able to maintain the pointer.
14:23:12 <warlord> In C this works fine due to the implementation of GNC_ID_*
14:24:27 <blathijs> Ah, right. Literal strings are const char* as well of course
14:24:46 <blathijs> but tecnically, the meaning of const is "will not modify", not "will never be modified", I think?
14:25:29 <warlord> It's... ambiguous
14:25:30 <blathijs> OTOH, one can say that putting the const inside the typedef makes the meaning a bit more like "is a literal"
14:25:34 <blathijs> anyway
14:25:35 <warlord> a literal is const.
14:25:42 <blathijs> Yeah, but not the other way around
14:25:55 <warlord> In this case, it's expecting a literal, but there's no way to declare that expectation.
14:25:58 <blathijs> I guess I'll just create a create-for-invoice, like create-for-splits
14:26:21 <blathijs> Since even removing the const-ness doesn't help enough (somehow the type ends up as "" inside the query module)
14:36:07 <warlord> Even a "create-for-invoice" is not sufficient... It'll have the same issue, I think.
14:36:20 <warlord> there needs to be some way to get swig to provide the string-literal.
14:37:03 <blathijs> create-for-invoice would work in the same way as create-for-splits
14:37:20 <blathijs> It is a zero-argument function, implemented in C, not in Scheme
14:37:31 <blathijs> It's defined in the .i file
14:37:57 <blathijs> I have it now, but now it complains about qof-query-set-book...
14:37:59 *** ErKa has quit IRC
14:39:42 <warlord> Are you providing a valid book?
14:40:00 <warlord> *THAT* function is used in many many places
14:40:54 <blathijs> Yeah, it works when I use create-for-splits, but breaks on create-for-invoices...
14:40:57 <blathijs> scheme is not lazy, right?
14:41:15 <warlord> depends..
14:41:16 <blathijs> ERROR: In procedure qof-query-set-book: ERROR: Wrong type argument in position 1: #<swig-pointer QofQuery * 2a9f170>
14:41:17 <warlord> it can be lazy
14:41:37 <blathijs> Hm, I don't think lazyness could be the problem here, though
14:42:08 <blathijs> With -splits I query_run returns a list of 17 elements (and then dies because I'm trying to do invoice stuff on the returned splits)
14:42:21 <warlord> heh
14:42:23 <blathijs> with -invoices it errors out even before running the query
14:42:39 <blathijs> but the code generated for -splits and -invoices seems completely identical...
14:44:22 <blathijs> Is there any way to display values from scheme like #<swig-pointer QofQuery * 2a9f170> ?
14:44:39 <blathijs> just (display query) shows only #
14:44:43 <warlord> what value do you want? That's a QofQuery object
14:45:06 <warlord> sounds like you're passing the QofQuery into something that dosn't want it?
14:45:42 <blathijs> You'd say that, but it seems it does want it. This is how qof-query-set-book is used everywhere
14:45:50 <blathijs> and it works when I use -splits instead of my -invoices
14:46:17 <warlord> show me your scheme code?
14:46:23 <blathijs> both of which have the same QofQuery* return type
14:46:26 <warlord> (pastebin if it's more that ~3 lines)
14:46:53 <blathijs> http://pastebin.com/LDR63Htm
14:47:02 <blathijs> This is from an eguile.scm file
14:47:24 <blathijs> I should probably move this to the main .scm, but I don't want to restart gnucash everytime
14:48:27 <warlord> Well, that scheme looks okay....
14:51:51 <blathijs> And the wrappers generated in swig-engine.c and swig-business-core.c are also identical: http://pastebin.com/QjdCkXBx
14:52:25 <blathijs> oh wait, there is a slight difference in the type
14:52:39 <blathijs> SWIGTYPE_p__QofQuery vs SWIGTYPE_p_QofQuery
14:54:40 <blathijs> though that type stuff is somehow autogenerated for each .i file it seems
14:56:59 <blathijs> Perhaps that means there are two different QofQuery* types in swig, one from engine.i and one from business-core.i :-S
14:58:56 <warlord> Hmm.. That would be... unfortunate
15:03:19 <warlord> are you working from SVN or a tarball?
15:03:45 <blathijs> svn
15:04:36 <warlord> Hmm, I dont see SWIGTYPE_p_QofQuery anywhere in my code.
15:04:47 <warlord> I do see SWIGTYPE_p__QofQuery
15:06:08 <blathijs> Yeah, the latter is generated from engine.i
15:06:34 <blathijs> I've added a new function to business-core.i (qof_query_create_for_invoices), which results in the other type being generated
15:06:47 <blathijs> I can't put the function in engine.i, since it needs GNC_ID_INVOICE
15:07:49 <jsled> warlord: btw, I'm in Germany starting tomorrow for work, so you might want to (rope someone into) moderating the mailing lists
15:07:52 <blathijs> I don't know what the number of _ mean either
15:09:40 <warlord> jsled: how long are you away?
15:09:55 <jsled> through next wed the 21st
15:10:01 <warlord> blathijs: maybe it's not pulling in the correct swig dependencies?
15:10:13 <warlord> jsled: amusingly that's when I leave for Europe ;)
15:10:18 <jsled> hehe.
15:10:25 <jsled> where are you headed?
15:10:54 <blathijs> warlord: Dunno. I'm doing a make over the entire tree now instead of just the changed parts
15:11:32 <warlord> Amsterdam, Maastricht, Brussels, Reims, Troyes, Beaune, and Paris
15:12:53 *** cortana has joined #gnucash
15:18:13 <blathijs> warlord: Hmm, it seems there are two definitions of QofQuery around
15:18:23 <blathijs> ./engine/Query.h:typedef QofQuery Query;
15:18:28 <blathijs> ./libqof/qof/qofquery.h:typedef struct _QofQuery QofQuery;
15:19:46 <blathijs> Oh wait, never mind
15:19:53 <blathijs> The first defines Query, not QofQuery
15:19:56 <warlord> The former defines Query
15:20:17 <warlord> Now, maybe you don't #include qofquery.h in business-core.i?
15:20:46 *** jpetersen has quit IRC
15:21:13 <blathijs> warlord: Possibly. I had thought to fix that by copying in the typedef, but I just saw that I have copied the wrong typedef :-)
15:27:31 <blathijs> awesome, I got a list with results! :-)
15:27:47 <blathijs> Hm, I should start telling quilt about my changes, I guess
15:30:41 <blathijs> Heh, in engine.i, the return type of qof_query_run is fixed to a list of Split*
15:31:42 <warlord> blathijs: I am not surprised...
15:32:49 <blathijs> I'll create another qof_query_run_for_invoices I guess
15:33:21 <warlord> Yeah. :-(
15:45:15 *** ErKa has joined #gnucash
15:51:19 <blathijs> Bah, swig is quite complicated stuff
16:04:39 <blathijs> ah, I think I figured it out
16:13:37 *** todd has quit IRC
16:34:17 <blathijs> woohoo, I can now do a length on my InvoiceList
16:34:31 <blathijs> but now gncInvoiceGetID fails again...
16:44:47 *** malko has joined #gnucash
16:44:53 *** ErKa has quit IRC
16:52:04 *** ErKa has joined #gnucash
17:01:51 *** todd has joined #gnucash
17:07:22 *** fbond has quit IRC
17:10:17 *** ErKa has quit IRC
17:11:01 *** todd has quit IRC
17:11:04 *** todd has joined #gnucash
17:33:54 *** cortana has quit IRC
17:37:57 *** bentob0x has quit IRC
17:42:12 *** cortana has joined #gnucash
17:45:36 *** malko has quit IRC
18:00:18 *** fbond has joined #gnucash
18:27:41 *** andyt has quit IRC
19:37:05 *** daedeloth has quit IRC
19:38:42 *** todd has quit IRC
19:55:27 *** cortana has quit IRC
20:01:27 *** todd has joined #gnucash
20:02:31 *** cortana has joined #gnucash
20:18:32 *** fbond has quit IRC
20:19:09 *** fbond has joined #gnucash
20:32:11 *** Jimraehl has left #gnucash
20:37:52 *** Jimraehl has joined #gnucash
21:11:59 *** cortana has quit IRC
21:14:28 *** KrazyKaveman has joined #gnucash
21:22:07 <KrazyKaveman> Could someone help me understand how the budget portion of cash works. I have a detailed personal budget as a spreadsheet that I would like to manage/track from gnucash.
21:28:46 <warlord> KrazyKaveman: you might need to ask on gnucash-user ml
21:35:49 <KrazyKaveman> I was asking from a more technical perspective than what a user might want. I figured that if the capability was nearly where I needed it, I would expand it to what I needed, which is why I asked here
21:36:53 <KrazyKaveman> I was going to develop a companion application before I realized that there was budget capabilities already in place
21:52:47 <warlord> Oh. Well, the developer who did the budgeting hasn't been around in a couple years. So the code has kinda just sat there.
21:52:56 <warlord> AFAIK, none of the current devs know it well.
21:56:52 <KrazyKaveman> alright then, I'll just look through the code. Thanks anyways. Anyone know whether/how the budget interfaces with the accounts, or did that leave with the developer?
21:57:17 <warlord> Ummm... I honestly don't know.
21:57:19 <warlord> (sorry)
21:57:46 <KrazyKaveman> kk, thanks.
21:58:11 <warlord> No probem
21:58:12 <warlord> problem
21:58:52 <KrazyKaveman> one more question
21:59:19 <KrazyKaveman> is there anyone that is working on a server (or similar) for smartphone interfacing?
21:59:50 <KrazyKaveman> or smartphone apps for android/blackberry/iphone
22:02:22 <warlord> Nope
22:03:05 <KrazyKaveman> alright
22:05:17 <warlord> sorry
22:44:52 *** todd has quit IRC
22:45:02 *** todd has joined #gnucash
23:01:30 *** KrazyKaveman has left #gnucash
23:06:13 *** warlord is now known as warlord-afk