Sales order line column Line Total Ex GST

Discussions relating to plugin development, and the Jiwa API.

Sales order line column Line Total Ex GST

Postby DannyC » Wed Sep 18, 2024 2:51 pm

Currently out of the box, there isn't a Line Total Ex GST column.

I'm fiddling with a plugin to get this implemented but not sure of the most appropriate direction. I reckon there are 3 ways to do it.
I'm pretty sure they don't need it saved - it's just they want it displayed in the grid.

1. An extra grid column which calculates
Code: Select all
soLine.DeliveredExGSTAmount * soLine.QuantityThisDelivery;


2. A line custom field which calcs the same formula. This will end up being saved. Doesn't really matter, but not required.

3. Use one of the UserDefinedFloats to do the same formula. Once again this will end up being saved.

Thing is, for points 2 and 3 when displaying closed sales orders the calculation will prompt to save the sales order because I am using the ReadEnd event & iterating the lines to do the calculation.

How would others approach this? Maybe a sample plugin anyone has?
User avatar
DannyC
Senpai
Senpai
 
Posts: 656
Joined: Fri Mar 22, 2013 12:23 pm
Topics Solved: 31

Re: Sales order line column Line Total Ex GST

Postby Mike.Sheen » Wed Sep 18, 2024 2:56 pm

Add a column and add a handler for the LineDisplayed event from the form, and in there you set your new column contents to be SalesOrderLine.LineTotal - SalesOrderLine.GSTAmount. SalesOrderLine is passed as an parameter to the event, and so is Row - so it's literally a one line event handler (well you should wrap it in an if statement to not do anything if it is a comment line, so maybe 3 lines).
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2485
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 769

Re: Sales order line column Line Total Ex GST

Postby DannyC » Wed Sep 18, 2024 3:59 pm

Thx Mike. Plugin done.
Works nicely :)

For anyone interested...
Code: Select all
    public void Setup(JiwaFinancials.Jiwa.JiwaApplication.IJiwaForm JiwaForm, JiwaFinancials.Jiwa.JiwaApplication.Plugin.Plugin Plugin)
    {
      if (JiwaForm is JiwaFinancials.Jiwa.JiwaSalesUI.SalesOrder.SalesOrderEntryForm)
      {
         JiwaFinancials.Jiwa.JiwaSalesUI.SalesOrder.SalesOrderEntryForm salesOrderForm = (JiwaFinancials.Jiwa.JiwaSalesUI.SalesOrder.SalesOrderEntryForm)JiwaForm;
         _salesOrderForm = salesOrderForm;
         salesOrderForm.grdLines.AddColumn("LineTotalEx", new JiwaCurrencyCellType(),"LineTotal Ex GST",10,false,true,true,true,20,false,false,2,false,false);
         salesOrderForm.grdLines.GridDecimalPlaces("LineTotalEx", -1, 2, -2);
         salesOrderForm.LineDisplayed += my_SalesOrderAddTotExGST;
      }
      
    }
   
   private void my_SalesOrderAddTotExGST(object sender, System.EventArgs e, JiwaFinancials.Jiwa.JiwaSales.SalesOrder.SalesOrderLine soLine, int Row)
   {
      if (!soLine.CommentLine)
      {
         _salesOrderForm.grdLines.set_GridText("LineTotalEx", Row, soLine.LineTotal - soLine.GSTAmount);
      }
   }
User avatar
DannyC
Senpai
Senpai
 
Posts: 656
Joined: Fri Mar 22, 2013 12:23 pm
Topics Solved: 31

Re: Sales order line column Line Total Ex GST

Postby DannyC » Fri Sep 27, 2024 4:10 pm

Just revisiting this after getting reports from the client that when the sales order is a few lines long, they're getting an error message
invalid row index.jpg
invalid row index.jpg (23.21 KiB) Viewed 228 times


When I was testing, I only had 1 line on my sales order.
When I have multiple rows, the added column only calculates on the first line.

Thereafter, the column just shows 0.
I'm not getting the error as per client, but neither am I getting the Total Ex displayed. :(
Line Total 1 line only.jpg
User avatar
DannyC
Senpai
Senpai
 
Posts: 656
Joined: Fri Mar 22, 2013 12:23 pm
Topics Solved: 31

Re: Sales order line column Line Total Ex GST

Postby Mike.Sheen » Mon Sep 30, 2024 12:31 pm

Please provide a plugin which demonstrates the issue that can be used on demo data.
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2485
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 769

Re: Sales order line column Line Total Ex GST

Postby DannyC » Mon Sep 30, 2024 3:52 pm

Plugin attached
Attachments
Plugin Attkey Sales Order Line Total Ex GST.xml
(32.49 KiB) Downloaded 7 times
User avatar
DannyC
Senpai
Senpai
 
Posts: 656
Joined: Fri Mar 22, 2013 12:23 pm
Topics Solved: 31

Re: Sales order line column Line Total Ex GST

Postby Mike.Sheen » Mon Sep 30, 2024 4:02 pm

DannyC wrote:Plugin attached


Looks fine to me.

Screenshot 2024-09-30 125920.png


Now that you have provided me with a plugin, the next thing is to provide the steps to reproduce.
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2485
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 769

Re: Sales order line column Line Total Ex GST

Postby DannyC » Mon Sep 30, 2024 7:28 pm

provide the steps to reproduce


Create a sales order with a few lines. Save.

Also, use the Back button to look at old sales orders.
User avatar
DannyC
Senpai
Senpai
 
Posts: 656
Joined: Fri Mar 22, 2013 12:23 pm
Topics Solved: 31

Re: Sales order line column Line Total Ex GST

Postby Mike.Sheen » Tue Oct 01, 2024 10:25 am

DannyC wrote:Create a sales order with a few lines. Save.


Did that - screenshot shown below is the result.

Screenshot 2024-10-01 072305.png


Maybe provide some better steps because it might be specific part numbers or debtor?

DannyC wrote:Also, use the Back button to look at old sales orders.


I did, that's what my first screenshot was of. How about citing a specific sales order no. in demo data which exhibits the problem for you?
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2485
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 769

Re: Sales order line column Line Total Ex GST

Postby DannyC » Tue Oct 01, 2024 11:01 am

I've had a new revelation...Just discovered that if I move the column somewhere closer to the left of the grid, i.e. not the last column then I get the behaviour as shown. That is, only the first row displays the Total Ex column.
If I leave it as the last column then all good, each line is calced as expected.

What's trick with being able to move it up the order a bit?
User avatar
DannyC
Senpai
Senpai
 
Posts: 656
Joined: Fri Mar 22, 2013 12:23 pm
Topics Solved: 31

Next

Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 5 guests

cron