Page 1 of 1

JIWA 7 API creating Debtors/Creditors

PostPosted: Mon Nov 02, 2015 3:23 pm
by Drew
Hi all
I am working on a system integration tool to link the details of Debtors and Creditors in JIWA with a SugarCRM.
changes in one need to be reflected in the other.

So far the SugarCRM side is fairly straight forward with their REST API.

on the JIWA side of things I can:
- Pull From JIWA Data through SQL queries straight to the JIWA database.
- Push to JIWA changes through SQL queries straight to the JIWA database.

I am stuck on the being able to create a new Debtor / Creditor record.

Environment:
- C# .net
- JIWA 7
- Microsoft SQL

Any help will be appreciated.

Cheers
Drew

Re: JIWA 7 API creating Debtors/Creditors

PostPosted: Mon Nov 02, 2015 3:34 pm
by Drew
Also noted that as of sometime last week that the following https://help.jiwa.com.au/Jiwa7/7.00.126 ... index.aspx
which might have been helpful now nolonger works..

Re: JIWA 7 API creating Debtors/Creditors  Topic is solved

PostPosted: Mon Nov 02, 2015 3:35 pm
by Mike.Sheen
Hi Drew,

Reference JiwaApplication.dll, JiwaDebtors.dll and JiwaODBC.dll in your project and then you can create a debtor using something such as this:

Code: Select all
private void CreateDebtor()
{
   JiwaFinancials.Jiwa.JiwaApplication.Manager.Instance.Logon("SQLServerName", "DatabaseName", JiwaFinancials.Jiwa.JiwaODBC.database.AuthenticationModes.JiwaAuthentication, "Admin", "password");

   var debtor = JiwaFinancials.Jiwa.JiwaApplication.Manager.Instance.BusinessLogicFactory.CreateBusinessLogic<JiwaFinancials.Jiwa.JiwaDebtors.Debtor>(null);
   debtor.CreateNew();
   debtor.AccountNo = "1234";
   debtor.Name = "Test";
   //debtor.Classification.ReadRecordFromDescription("My Classification"); //<-- Example of setting the debtor classification
   debtor.Save();
}


Creditors is very similar - just change "debtor" with "creditor" in the above.

Mike

Re: JIWA 7 API creating Debtors/Creditors

PostPosted: Mon Nov 02, 2015 3:35 pm
by Mike.Sheen
Drew wrote:Also noted that as of sometime last week that the following https://help.jiwa.com.au/Jiwa7/7.00.126 ... index.aspx
which might have been helpful now nolonger works..


That post which referred to that link was corrected last week with the right link :)

Re: JIWA 7 API creating Debtors/Creditors

PostPosted: Tue Nov 03, 2015 4:34 pm
by Drew
Thanks Mike that is the start I needed.

Re: JIWA 7 API creating Debtors/Creditors

PostPosted: Wed Nov 04, 2015 4:04 pm
by Drew
Technical Hitch..

How would I Create/set the DeliveryAddress details when creating a debtor?

Cheer
Drew

Re: JIWA 7 API creating Debtors/Creditors

PostPosted: Wed Nov 04, 2015 4:24 pm
by Scott.Pearce
This is off the top of my head:

Code: Select all
   JiwaFinancials.Jiwa.JiwaDebtors.DeliveryAddress myNewDeliveryAddress = new JiwaFinancials.Jiwa.JiwaDebtors.DeliveryAddress();

   myNewDeliveryAddress.DeliveryAddressName = "Head Office";
   myNewDeliveryAddress.Address1 = "1 Smith St";
   myNewDeliveryAddress.Address3 = "Sydney";
   myNewDeliveryAddress.Address4 = "NSW";
   myNewDeliveryAddress.Postcode = "2000";

   debtor.DeliveryAddresses.Add(myNewDeliveryAddress);


So to add this to Mike's example from above:

Code: Select all
private void CreateDebtor()
{
   JiwaFinancials.Jiwa.JiwaApplication.Manager.Instance.Logon("SQLServerName", "DatabaseName", JiwaFinancials.Jiwa.JiwaODBC.database.AuthenticationModes.JiwaAuthentication, "Admin", "password");

   var debtor = JiwaFinancials.Jiwa.JiwaApplication.Manager.Instance.BusinessLogicFactory.CreateBusinessLogic<JiwaFinancials.Jiwa.JiwaDebtors.Debtor>(null);
   debtor.CreateNew();
   debtor.AccountNo = "1234";
   debtor.Name = "Test";
   //debtor.Classification.ReadRecordFromDescription("My Classification"); //<-- Example of setting the debtor classification

   //Add a delivery address
   JiwaFinancials.Jiwa.JiwaDebtors.DeliveryAddress myNewDeliveryAddress = new JiwaFinancials.Jiwa.JiwaDebtors.DeliveryAddress();
   myNewDeliveryAddress.DeliveryAddressName = "Head Office";
   myNewDeliveryAddress.Address1 = "1 Smith St";
   myNewDeliveryAddress.Address3 = "Sydney";
   myNewDeliveryAddress.Address4 = "NSW";
   myNewDeliveryAddress.Postcode = "2000";

   debtor.DeliveryAddresses.Add(myNewDeliveryAddress);

   debtor.Save();
}


EDIT: Forget to new.