Get list of Invoices .NET SDK 2017.1

Hi,

I want to get the list of all invoice from sage50 with the .NET SDK 2017.1

I have tried to use 

SalesJournal salJourn = SDKInstanceManager.Instance.OpenSalesJournal();
List<LookupLine> lines = salJourn.GetLookupList(string.Empty, DateTime.MinValue, DateTime.UtcNow, string.Empty, 0, 0, false);
lines.ForEach(j => {
          salJourn.LoadInvoiceForLookup(string.Empty, j.JournalNumber, false);
          // .....
});

but i have lot of Cannot find the transaction with the criteria you entered. Please try using different criteria.

OR

Do a SQl statement and call IDataReader reader = util.ExecuteReader(sql);

with all the join in the SQL

with one is the best?

  • 0

    Does it work if the transactionNumber and amount are empty:

    List<LookupLine> lines = salJourn.GetLookupList(string.Empty, DateTime.MinValue, DateTime.UtcNow, string.Empty, , , false);

    instead of

    List<LookupLine> lines = salJourn.GetLookupList(string.Empty, DateTime.MinValue, DateTime.UtcNow, string.Empty, 0, 0, false);

    Oh, guess not - I read the help more carefully.

    invoiceNum
    Type: System..::..String
    Invoice number to search for - if null or empty, this search parameter is ignored.
    transactionNumber
    Type: System..::..Int32
    Transaction number to search for - if less than or equal to zero, this search parameter is ignored.
    amount
    Type: System..::..Double
    Amount to search for.
    searchByAmount
    Type: System..::..Boolean
    True to search by amount - if false, the amount parameter is ignored.
  • 0 in reply to RandyW
    It doesn't compile if I remove the amount. According to the documentation if the searchByAmount is set to false the amount parameter is ignored. The cannot find the transaction.... message come from the LoadInvoiceForLookup call.