Question

In my project I am integrating QuickBooks Online by PHP. Here I want to add journal entry. So I have downloaded the SDK for PHP. And able to connect QuickBook Online and successfully add some customer.

But my real requirement is adding Journal Entry, but there is no example for journal entry. So I am wondering how I can add Journal using that SDK? Which class I need to use for Journal Entry? And How can I pass the journal data?

Please help me.

Thanks in Advance

Was it helpful?

Solution 2

I searched the sdk and found, there is a class IPPJournalEntry which will be used here for journal entry add. Along with this we need two more classes IPPLine, IPPJournalEntryLineDetail.

Thanks

OTHER TIPS

If you're using the open-source QuickBooks PHP DevKit provided on GitHub:

Then you can find the quick-start guide to getting connected here:

And a detailed working example of adding a journal entry here:

The code ends up looking something like:

$JournalEntryService = new QuickBooks_IPP_Service_JournalEntry();

// Main journal entry object
$JournalEntry = new QuickBooks_IPP_Object_JournalEntry();
$JournalEntry->setDocNumber('1234');
$JournalEntry->setTxnDate(date('Y-m-d'));

// Debit line
$Line1 = new QuickBooks_IPP_Object_Line();
$Line1->setDescription('Line 1 description');
$Line1->setAmount(100);
$Line1->setDetailType('JournalEntryLineDetail');

$Detail1 = new QuickBooks_IPP_Object_JournalEntryLineDetail();
$Detail1->setPostingType('Debit');
$Detail1->setAccountRef(3);

$Line1->addJournalEntryLineDetail($Detail1);
$JournalEntry->addLine($Line1);

// Credit line
$Line2 = new QuickBooks_IPP_Object_Line();
$Line2->setDescription('Line 2 description');
$Line2->setAmount(100);
$Line2->setDetailType('JournalEntryLineDetail');

$Detail2 = new QuickBooks_IPP_Object_JournalEntryLineDetail();
$Detail2->setPostingType('Credit');
$Detail2->setAccountRef(56);

$Line2->addJournalEntryLineDetail($Detail2);
$JournalEntry->addLine($Line2);

if ($resp = $JournalEntryService->add($Context, $realm, $JournalEntry))
{
    print('Our new journal entry ID is: [' . $resp . ']');
}
else
{
    print($JournalEntryService->lastError($Context));
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top