Friday, 4 March 2011

Robert Branaghan @ FactoryMaster » .NET Developers Blog


While writting the integration to Sage Accounts from FactoryMaster, I came across a bit of a problem. Using the SDK that developers can use to integrate with Sage, a pretty useful flag isn’t available IsForeignTraderEnabled Which if this isnt set, Sage Accounts only has currencies in Home currency, but using the SDK you can import different values into the Database, but Sage wont use them unless you have specifically enabled foreign trader through the wizzard. Yes it does get confusing.

I could send USD to Sage when creating a customer, although Sage wouldnt display USD in the program, it is stored as USD. So if using the integration I get the Currency Code for that customer, I would be given USD. But when I try and save that invoice, I would get an error saying “Foreign Trader Not Enabled”. Not much good to me at that point.

I had to find a way of using this flag, as we import in batches of invoices, and if one of the invoices in the batch wouldnt pass tests then none of them should be posted. Since this flag wasnt available this was one test that couldnt be done.

Speaking with developer support I went through the reason I needed this, and we come to the conclusion that it wasn’t available. Nor easy to get to. I noticed it in an internal dll that Sage uses to run their application, but could not gain access to the function! Very frustrating, when you can see it, but not use it!

But lucky for me, developer support looked into it, and with developer supports internal knowledge I created a function that can get this flag (probably in a similar way that Sage’s dll does) for versions 2008 (v14), 2009(v15), 2010(v16) and 2011(v17) of Sage Line 50.

Some would look at this as not much of a success, but due to the fact no one had ever tried to get this before, shows that either developers sent over values in home currency, or never thought to test for it and rely on a user to enable it)

Now using this function, gives me more tests I can do on data before attempting to save it in Sage Accounts 50.

Flickr - projectbrainsaver

www.flickr.com
projectbrainsaver's A Point of View photoset projectbrainsaver's A Point of View photoset