[Kmymoney-devel] Android Port: Question relating to Schedules

Eric Bonney mailinglists at vanhlebarsoftware.com
Thu Jul 12 18:28:16 UTC 2012

Found it!! Yes once again the error was of course in my code. :) This one
was particularly difficult, well only because I forgot that the Schedules
are stored in three different tables:

   1. kmmSchedules - the basic information for the actual schedule.
   2. kmmSplits - the actual detail items for all the account items for
   this schedule.
   3. kmmTransactions - the top level item for all the splits.

Yup I forgot to even consider #3 this entire time. I even made a change in
the desktop software and then compared the results of before and after in
sqlitemanager so that I could see the details. I noticed that KMM changes
the startDate to be equal to the nextPaymentDate on the schedule but it
also changes the postDate to be equal to the nextPaymentDate on the actual
Transaction item and the splits as well.

Anyway, I finally figured it out once I remembered that there are the
locations that need to be updated. Wow what an ordeal it was.

Thanks for the help folks.

On Thu, Jul 12, 2012 at 12:48 PM, Eric Bonney <
mailinglists at vanhlebarsoftware.com> wrote:

> Hi Alvaro,
> Yes I am writing the updates to the database and even ensured that the
> database was closed after all my operations where completed.
> I noticed that the sched.adjustedNextDueDate() is calling nextDueDate()
> which returns the actual posting date on the transaction I think.
> m_PostDate in the transaction is being set in the constructor I think from
> the node of TRANSACTION type and the attribute "postdate". Now I am not
> positive what those really are but I "think" those are corresponding to my
> columns in the kmmSchedule table. So if that is true then I have to have
> something wrong in my code somewhere, but I am lost as to where it might be.
> Well unless someone else has any other ideas I will keep looking but I am
> not real sure where.
> On Thu, Jul 12, 2012 at 11:34 AM, Alvaro Soliverez <asoliverez at kde.org>wrote:
>> Are you writing the changes after updating the schedules? I assume you do.
>> The fields you are using seem to be the right ones.
>> sched.adjustedNextDueDate() is a function to check for holidays,
>> weekends, etc, and adjust the due date accordingly (ie, don't have a
>> business schedule occur on a Sunday).
>> I don't have much more info on that area of code.
>> Regards,
>> Alvaro
>> On Thu, Jul 12, 2012 at 12:27 PM, Eric Bonney
>> <mailinglists at vanhlebarsoftware.com> wrote:
>> > So I have tried to do more research on this in the actual source code
>> and I
>> > am still a bit confused.
>> >
>> > Inside khomeview.cpp I followed the code for the display of the
>> Payments.
>> > Down in showPaymentEntry() I see where the method takes a
>> MyMoneySchedule as
>> > a variable. This schedule is then used to get the transaction which is
>> then
>> > in turn used to get the split. All is good for me so far. :) but when we
>> > actually display the date we go back to using the schedule variable
>> that was
>> > passed into the method and we call sched.adjustedNextDueDate().
>> >
>> > I am assuming that adjustedNextDueDate() is returning the date from the
>> > actual schedule not from the splits. This is the logic that I had used
>> in my
>> > port but when I bring the file back from the device to the desktop and
>> open
>> > it up, the desktop software still shows my schedule as being due in the
>> > Payments section on the HomeView on the wrong date. I have looked at
>> the raw
>> > data in a database viewer and the schedule itself shows the correct next
>> > date in the nextPaymentDue column.
>> >
>> > Here is an example with dates to try and make it a little clearer:
>> > I have a schedule set up at every two weeks and it is due on July 15,
>> 2012
>> > for $75.00
>> >
>> > On my device I enter the schedule and move the nextPaymentDue column to
>> > 2012-07-22 and set the lastPaymentDate to 2012-07-15. I have also set
>> the
>> > postDate to 2012-07-15 on the schedules splits in kmmSplits table.
>> >
>> > Now when I look at my updated schedules on my device it properly shows
>> the
>> > schedule as due next on July 22nd but when I pull the device to the
>> desktop
>> > it is showing up still in Payments as due on July 15th. It is in the
>> > register on the correct date just fine, but the schedule inside the
>> Schedule
>> > View shows July 15th and also in the Payments section of the home view.
>> >
>> > I know I am missing something here but I can't follow the logic
>> anymore. I
>> > can't see anywhere else in the database where the dates could be coming
>> from
>> > for the schedules. They are only kept in kmmSchedules and kmmSplits as
>> far
>> > as I can tell. Can anyone point me in the right direction here to see
>> what I
>> > could be doing wrong?
>> >
>> > Thanks,
>> > -Eric
>> >
>> >
>> > On Tue, Jul 10, 2012 at 5:50 PM, Eric Bonney
>> > <mailinglists at vanhlebarsoftware.com> wrote:
>> >>
>> >> Hi All:
>> >>
>> >> So I am now working on implementing schedules to the port. I had read
>> >> access working just fine and added my home widget and then added the
>> ability
>> >> to skip a schedule and enter a schedule from the widget itself.
>> >>
>> >> Entering the widget creates the transaction just fine and on my port it
>> >> advances the schedule to the next date and seems to be recording the
>> payment
>> >> correctly in the lastPayment and nextPaymentDue columns just fine. The
>> issue
>> >> is when I then move the file over to the desktop software the schedule
>> that
>> >> was entered shows as still being due. The transaction is reflected in
>> the
>> >> account just fine but the schedule has not been moved to the next due
>> date.
>> >>
>> >> Is this information being pulled from somewhere other than
>> kmmSchedules? I
>> >> didn't see anything in the kmmKeyValuePairs table for schedules but I
>> could
>> >> be missing something I guess.
>> >>
>> >> Also I noticed that there is now a table kmmSchedulePaymentHistory,
>> this
>> >> appears to be new but it doesn't seem to have any data in it yet. Is
>> this
>> >> something that is going to be used in the future? I just need to know
>> if I
>> >> need to start populating this table as well. :)
>> >>
>> >> Thanks,
>> >> -Eric
>> >
>> >
>> >
>> > _______________________________________________
>> > KMyMoney-devel mailing list
>> > KMyMoney-devel at kde.org
>> > https://mail.kde.org/mailman/listinfo/kmymoney-devel
>> >
>> _______________________________________________
>> KMyMoney-devel mailing list
>> KMyMoney-devel at kde.org
>> https://mail.kde.org/mailman/listinfo/kmymoney-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kmymoney-devel/attachments/20120712/479d0ed3/attachment.html>

More information about the KMyMoney-devel mailing list