0

I try to import data from my POS System to Quickbooks to create General Journal entries. When i add some static(hard coded) data all saved successfully. But when I try to add data from my app QB add data to dataService but when i sync QB data didn't come. Please could you help with my problem. Here is my code.

//main code to add General Journal Entry to QB
var header = GenerateReportHeader(model);

var creditInfo = GenerateJournalEntryLines(model.CreditInformation, PostingTypeEnum.Credit);
var debitInfo = GenerateJournalEntryLines(model.DebitInformation, PostingTypeEnum.Debit);

var allLines = creditInfo.Concat(debitInfo).ToArray();
var result = new JournalEntry();
result.Header = header;
result.Line = allLines;
dataService.Add(result);

//Add Header
private JournalEntryHeader GenerateReportHeader(GeneralJournalModel model)
    {
        var result = new JournalEntryHeader
        {
            TxnDate = new DateTime(2013,7,1),
            Status = "Payable",
            Adjustment = false,
            TxnDateSpecified = true
        };
        if (!String.IsNullOrEmpty(model.EntryNo))
        {
            result.DocNumber = model.EntryNo;
        }
        return result;
    }
 //Add Line
    private JournalEntryLine[] GenerateJournalEntryLines(List<GeneralJournalEntryModel> model, PostingTypeEnum postType)
    {
        var result = new JournalEntryLine[model.Count];
        for (int i = 0; i < model.Count; i++)
        {
            var journalEntryLine = model[i];
            var account = GetAccountByNumber(journalEntryLine.AccountNumber);
            var toAdd = new JournalEntryLine
            {
                AccountId = account.Id,
                AccountType = account.Type,
                AccountName = account.Name,
                Amount = Convert.ToDecimal(journalEntryLine.Amount),
                AmountSpecified = true,
                PostingType = postType,
                AccountTypeSpecified = true,
                Id = new IdType(),
                PostingTypeSpecified = true
            };
            if (journalEntryLine.EntityId != null)
            {
                toAdd.EntityId = GetEntityId(journalEntryLine.EntityType, journalEntryLine.EntityId);
                toAdd.EntityType = GetEntityType(journalEntryLine.EntityType);
                toAdd.EntityName = GetEntityName(journalEntryLine.EntityType, journalEntryLine.EntityId);
                toAdd.EntityTypeSpecified = true;
            }

            result[i] = toAdd;
        }
        return result;
    }
4

1 回答 1

0

您是否检查了 SyncStatus,并找出原因?

这应该是您开始的地方: https ://developer.intuit.com/docs/0025_quickbooksapi/0050_data_services/v2/0500_quickbooks_windows/0600_object_reference/syncstatus

它将为您提供有关数据无法同步的具体原因的更多详细信息。

于 2013-07-24T15:34:41.177 回答