SDK - PurchasesJournal - Project Allocations on Line Numbers

Hi there,

We're working on creating an integration using our application and Sage 50 Canadian Edition.

Currently working on creating Purchase Journal Entries - we want to allocate the line-item on the journal to a project.  In the example, it doesn't show how to do it exactly, but reviewing the Example for a Sales Journal - I see where he is allocating entries to a project as shown below:

            // Sales Invoice Example
            SalesJournal salJourn = SDKInstanceManager.Instance.OpenSalesJournal();

            <removed code>

            salJourn.SetItemNumber("CR-10", 1);
            salJourn.SetQuantity(1, 1);
            salJourn.SetUnit("Hour", 1);
            salJourn.SetDescription("Computer Repair - No Warranty", 1);
            salJourn.SetPrice(90.00, 1);
            salJourn.SetLineAmount(90.00, 1);
            salJourn.SetLineAccount(MakeAccountNumber(SDK_ACCTINVREV).ToString(), 1);

            salJourn.SetDescription("Item #2", 2);
            salJourn.SetQuantity(2, 2);
            salJourn.SetUnit("Each", 2);
            salJourn.SetPrice(0.99, 2);
            salJourn.SetLineAccount(MakeAccountNumber(SDK_ACCTINVREV).ToString(), 2);

            // allocate projects
            ProjectAllocation projAlloc = salJourn.AllocateLine(2);
            projAlloc.SetProject("Sage Project", 1);
                projAlloc.SetPercent(50.0, 1);
            catch (SimplyNoAccessException)
                // can't allocate by percent, allocation by amount
                projAlloc.SetAmount(0.99, 1);

           < removed code >


When I use this same logic - the initial call to "ProjectAllocation projAlloc = salJourn.AllocateLine(linenum);" - throws a "SimplySDK.SimplyNoAccessException" exception. Thinking this function may only work after the invoice is posted - I tried doing the line allocations AFTER the posting, the same error is displayed.

Has anyone had any success doing project allocations on Purchase Journals?

It looks like we will be allocating 100% of the costs of the line to a single project - BUT not 100% of the invoice.

The call to purJourn.SelectProject(projectname) appears to work for the whole invoice - but we need to get it at the line level.

I'm sure its something small on my end - anyone have any suggestions?