Discussion:
Journal Entry Table
(too old to reply)
Abby
2009-08-19 04:48:01 UTC
Permalink
Hi!
I am using OA 2009. I need to import the GL accounts monthly from my
in-house system to OA. If I will write directly to the database, what table
should I write? Can I use the journal entry table for this import?

Thanks!
Abby
GTSageDev
2009-08-20 13:11:08 UTC
Permalink
Not a good idea to write directly to the database - you'd need to update many tables as well as perform all validation.

There doesn't seem to be an Excel import routine for GL journals, otherwise I'd suggest transferring the data via Excel.

So I'd suggest using the API. This is a very basic example of posting a journal (in this case, depreciation):

'sbi is already set up as ISmallBusinessInstance
Dim oJournalEntry As IJournalEntry = sbi.CreateJournalEntry
Dim oFinancialAccounts As IFinancialAccountView = sbi.FinancialAccounts
Dim oJournalLine As IJournalEntryLine
oJournalEntry.FinancialDateTime = Today 'default
oJournalEntry.ReferenceNumber = "DEPREC"
oJournalLine = oJournalEntry.CreateJournalEntryLine(DocumentLineType.JournalLine)
oJournalLine.Account = oFinancialAccounts.GetByDisplayNumber("1475") 'Office Equip depreciation
oJournalLine.Credit = 100.0
oJournalLine = oJournalEntry.CreateJournalEntryLine(DocumentLineType.JournalLine)
oJournalLine.Account = oFinancialAccounts.GetByDisplayNumber("1420") 'Office Equip
oJournalLine.Debit = 100.0
oJournalEntry.Save()

PS. I hope this displays ok.
jalvarezca
2009-10-13 21:12:01 UTC
Permalink
Hi. This is a good example.

But now I need to save a collection of journal entries inside a transaction.

I mean, is it possible to send a group of documents and subsequent details
and save then all or nothing?

Thanks
Post by GTSageDev
Not a good idea to write directly to the database - you'd need to update
many tables as well as perform all validation.
There doesn't seem to be an Excel import routine for GL journals,
otherwise I'd suggest transferring the data via Excel.
So I'd suggest using the API. This is a very basic example of posting a
'sbi is already set up as ISmallBusinessInstance
Dim oJournalEntry As IJournalEntry = sbi.CreateJournalEntry
Dim oFinancialAccounts As IFinancialAccountView = sbi.FinancialAccounts
Dim oJournalLine As IJournalEntryLine
oJournalEntry.FinancialDateTime = Today 'default
oJournalEntry.ReferenceNumber = "DEPREC"
oJournalLine =
oJournalEntry.CreateJournalEntryLine(DocumentLineType.JournalLine)
oJournalLine.Account = oFinancialAccounts.GetByDisplayNumber("1475")
'Office Equip depreciation
oJournalLine.Credit = 100.0
oJournalLine =
oJournalEntry.CreateJournalEntryLine(DocumentLineType.JournalLine)
oJournalLine.Account = oFinancialAccounts.GetByDisplayNumber("1420") 'Office Equip
oJournalLine.Debit = 100.0
oJournalEntry.Save()
PS. I hope this displays ok.
GTSageDev
2009-10-15 08:52:10 UTC
Permalink
Not though the SDK objects as far as I know. However, it may be possible to wrap
the whole lot in an SQL transaction - but you'd have to somehow get hold of the
SQL connection before starting.

The usual workaround is to validate all the data before posting it!
Post by jalvarezca
Hi. This is a good example.
But now I need to save a collection of journal entries inside a transaction.
I mean, is it possible to send a group of documents and subsequent details
and save then all or nothing?
Thanks
Post by GTSageDev
Not a good idea to write directly to the database - you'd need to update
many tables as well as perform all validation.
There doesn't seem to be an Excel import routine for GL journals,
otherwise I'd suggest transferring the data via Excel.
So I'd suggest using the API. This is a very basic example of posting a
'sbi is already set up as ISmallBusinessInstance
Dim oJournalEntry As IJournalEntry = sbi.CreateJournalEntry
Dim oFinancialAccounts As IFinancialAccountView = sbi.FinancialAccounts
Dim oJournalLine As IJournalEntryLine
oJournalEntry.FinancialDateTime = Today 'default
oJournalEntry.ReferenceNumber = "DEPREC"
oJournalLine =
oJournalEntry.CreateJournalEntryLine(DocumentLineType.JournalLine)
oJournalLine.Account = oFinancialAccounts.GetByDisplayNumber("1475")
'Office Equip depreciation
oJournalLine.Credit = 100.0
oJournalLine =
oJournalEntry.CreateJournalEntryLine(DocumentLineType.JournalLine)
oJournalLine.Account = oFinancialAccounts.GetByDisplayNumber("1420") 'Office Equip
oJournalLine.Debit = 100.0
oJournalEntry.Save()
PS. I hope this displays ok.
Loading...