在日记帐分录Quickbooks中获取错误

时间:2014-01-29 07:30:59

标签: quickbooks intuit-partner-platform quickbooks-online intuit

我正在尝试添加日记帐分录。但它会像错误一样返回

Uncaught IdsException: [0]: 2014-01-29 08:13:07 - D:\DummyApps\v3-php-sdk-2.0.1\v3-php-sdk-2.0.1\DataService\DataService.php - 341 - CheckNullResponseAndThrowException - 
Response Null or Empty thrown in D:\DummyApps\v3-php-sdk-2.0.1\v3-php-sdk-2.0.1\Core\CoreHelper.php on line 95'

我正在使用QuickBooks PHP SDK。我的代码如下:

    // Prep Data Services
    $dataService = new DataService($serviceContext);
    if (!$dataService)
    exit("Problem while initializing DataService.\n");

    $linedet = new IPPJournalEntryLineDetail();
    $linedet->PostingType = 'Credit';
    $linedet->AccountRef  = 9;

   $line = new IPPLine();
   $line->Id = 0;
   $line->Description = 'test journal';
   $line->Amount = 2.00;
   $line->DetailType= 'test ';
   $line->JournalEntryLineDetail = $linedet;

   $linedet2 = new IPPJournalEntryLineDetail();

   $linedet2->PostingType = 'Debit';
   $linedet2->AccountRef  = 9;
   $line2 = new IPPLine();
   $line2->Id = 1;
   $line2->Description = 'test journal';
   $line2->Amount = 2.00;
   $line2->DetailType= 'test ';
   $line2->JournalEntryLineDetail = $linedet2;

   // Add a journal
   $journalObj = new IPPJournalEntry();
   $journalObj->SyncToken = '1';
   $journalObj->DocNumber = '1';
   $journalObj->TxnDate = '2014-12-30';
   $journalObj->RefNumber = 't123';
   $journalObj->PrivateNote = 'Just testing';
   $journalObj->Line = array($line, $line2);
   $journalObj->Adjustment  = TRUE;
   $journalObj->IsAdjustment  = TRUE;   
   $resultingObj = $dataService->Add($journalObj );

请帮助我....我被困在这里。

先谢谢

1 个答案:

答案 0 :(得分:0)

我在这里发现了错误。

行对象中的“DetailType”必须具有“JournalEntryLineDetail”