Pricing Scheme Ignored  Topic is solved

Discussions relating to Jiwa 7 plugin development, and the Jiwa 7 API.

Pricing Scheme Ignored

Postby neil.interactit » Tue Jun 02, 2015 10:02 am

Hey guys,

I have an obscure issue (but instead of getting personal, lets talk programming!) ...

When an invoice is imported into JIWA from the Job Manager utility the pricing scheme is ignored. Also once the invoice is imported into JIWA and we manually add additional items to the invoice the pricing scheme is also ignored.

Code: Select all
Manager.Instance.Logon(Servername, Database, database.AuthenticationModes.JiwaAuthentication, Username, password);
var salesOrder = Manager.Instance.BusinessLogicFactory.CreateBusinessLogic<SalesOrder>(null);
var inventory = new JiwaFinancials.Jiwa.JiwaApplication.Entities.Inventory.Inventory();
[CLIP]
var debtor = new JiwaFinancials.Jiwa.JiwaApplication.Entities.Debtor.Debtor();
debtor.ReadRecord(debtorId);
[CLIP]
salesOrder.CreateNew(JiwaFinancials.Jiwa.JiwaSales.SalesOrder.SalesOrder.NewSalesOrderTypes.e_NewSalesOrder, debtor.DebtorID);
salesOrder.OrderNo = jobs.Project;
salesOrder.InitiatedDate = initiatedDate;
salesOrder.WholeSaleInvoice = false;
[CLIP]
foreach (var row in rows)
{
   inventory.ReadRecordFromPartNo(row["JobCode"].ToString());
   salesOrder.SalesOrderLines.AddInventoryItem(inventory.InventoryID, JiwaFinancials.Jiwa.JiwaSales.SalesOrder.SalesOrderLineCollection.SalesOrderLineInventorySeedTypes.e_SalesOrderLineInventoryID, ref newKey);
   salesOrder.SalesOrderLines[newKey].ScheduledDate = DateTime.Parse(row["AppointmentTime"]);
   salesOrder.SalesOrderLines[newKey].QuantityOrdered = Decimal.Parse(row["BilledHours"]);
   salesOrder.SalesOrderLines[newKey].DoLineCalculationsFromExGSTSellPrice();
   var details = row["Description"].Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
   foreach (string detail in details) salesOrder.SalesOrderLines.AddCommentLine(detail, ref newKey);
}
salesOrder.Save();

(c# strong typing specific code removed to make more readable)

This is implemented in an external EXE, referencing JiwaApplication,JiwaODBC,JiwaSales. It would appear that sales orders created through this do not observe the pricing scheme applied.

Cheers,
Neil
neil.interactit
Kohai
Kohai
 
Posts: 232
Joined: Wed Dec 03, 2014 2:36 pm
Topics Solved: 6

Re: Pricing Scheme Ignored

Postby Scott.Pearce » Tue Jun 02, 2015 10:24 am

So have you tested by adding the exact same part to the sales order manually? (To ensure that the price scheme is working under normal circumstances)
Scott Pearce
Senior Analyst/Programmer
Jiwa Financials
User avatar
Scott.Pearce
Senpai
Senpai
 
Posts: 765
Joined: Tue Feb 12, 2008 11:27 am
Location: New South Wales, Australia
Topics Solved: 230

Re: Pricing Scheme Ignored

Postby neil.interactit » Tue Jun 02, 2015 10:29 am

Yep. It has been done manually until now - all working. However with imported invoices the behaviour seem different.
neil.interactit
Kohai
Kohai
 
Posts: 232
Joined: Wed Dec 03, 2014 2:36 pm
Topics Solved: 6

Re: Pricing Scheme Ignored

Postby Scott.Pearce » Tue Jun 02, 2015 10:37 am

Try *not* doing the line:

Code: Select all
salesOrder.SalesOrderLines[newKey].DoLineCalculationsFromExGSTSellPrice();
Scott Pearce
Senior Analyst/Programmer
Jiwa Financials
User avatar
Scott.Pearce
Senpai
Senpai
 
Posts: 765
Joined: Tue Feb 12, 2008 11:27 am
Location: New South Wales, Australia
Topics Solved: 230

Re: Pricing Scheme Ignored

Postby neil.interactit » Tue Jun 02, 2015 10:41 am

Will do. Slightly off topic ... when I ran in VS this morning - on first Jiwa access, I am getting

The source was not found, but some or all event logs could not be searched. To create the source, you need permission to read all event logs to make sure that the new source name is unique. Inaccessible logs: Security.


This is with no code change from previous successful running. Have you seen this before?
neil.interactit
Kohai
Kohai
 
Posts: 232
Joined: Wed Dec 03, 2014 2:36 pm
Topics Solved: 6

Re: Pricing Scheme Ignored

Postby Scott.Pearce » Tue Jun 02, 2015 10:55 am

Yes I have.

Dealing with event logs in .Net is crappy.

Jiwa (or a plugin) is probably trying to create an event source for whatever reason. To create an event source, all the logs have to be searched to ensure that the event source name we want to create is unique - the .net method for creating the event source does this for us automatically. The message you are getting is saying that you don't have permissions to read the "Security" logs, so .Net couldn't look there to check for uniqueness. It's just a warning.

By memory, you can avoid this exception by either running VS as admin, or you can manually create the event source yourself (this means that Jiwa wont have to create it, and therefore wont need to check for uniqueness, and therefore wont need to touch the Security logs).

We had to have our event sources created at install time to avoid this issue!
Scott Pearce
Senior Analyst/Programmer
Jiwa Financials
User avatar
Scott.Pearce
Senpai
Senpai
 
Posts: 765
Joined: Tue Feb 12, 2008 11:27 am
Location: New South Wales, Australia
Topics Solved: 230

Re: Pricing Scheme Ignored

Postby neil.interactit » Tue Jun 02, 2015 12:01 pm

Thanks, running as admin fixed the event log error. Now the ACTUAL error has me stumped ... this all compiled/ran perfectly last week, and without any changes this week I am now getting:

ex.Message
"Object reference not set to an instance of an object."
ex.StackTrace
at JiwaFinancials.Jiwa.JiwaApplication.Manager.HandleApplicationManagerPluginExceptions()
at JiwaFinancials.Jiwa.JiwaApplication.Manager.Logon(String ServerName, String DatabaseName, AuthenticationModes AuthenticationMode, String JiwaUserName, String JiwaPassword)


I have confirmed all the params passed are not null (and correct).

Also, just to rule out an introduced issue, I quickly rebuilt a new project from scratch, added the 3 Jiwa DLL refs ... same result.

Any ideas?
neil.interactit
Kohai
Kohai
 
Posts: 232
Joined: Wed Dec 03, 2014 2:36 pm
Topics Solved: 6

Re: Pricing Scheme Ignored

Postby Scott.Pearce » Tue Jun 02, 2015 12:43 pm

That looks like a plugin exception.

Try disabling all plugins in the system (UPDATE SY_Plugin SET IsEnabled = 0) and run your exe again.
Scott Pearce
Senior Analyst/Programmer
Jiwa Financials
User avatar
Scott.Pearce
Senpai
Senpai
 
Posts: 765
Joined: Tue Feb 12, 2008 11:27 am
Location: New South Wales, Australia
Topics Solved: 230

Re: Pricing Scheme Ignored

Postby neil.interactit » Tue Jun 02, 2015 1:10 pm

DUH! Absolutely right! Didn't even need to disable plugins ... just running Jiwa (which I hadn't yet today) recompiled the plugins and fixed the issue.

Note to self: Read the BLINKIN error message!
neil.interactit
Kohai
Kohai
 
Posts: 232
Joined: Wed Dec 03, 2014 2:36 pm
Topics Solved: 6

Re: Pricing Scheme Ignored

Postby Scott.Pearce » Tue Jun 02, 2015 1:18 pm

;-)
Scott Pearce
Senior Analyst/Programmer
Jiwa Financials
User avatar
Scott.Pearce
Senpai
Senpai
 
Posts: 765
Joined: Tue Feb 12, 2008 11:27 am
Location: New South Wales, Australia
Topics Solved: 230

Next

Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 6 guests