Sales order line column Line Total Ex GST  Topic is solved

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: 647
Joined: Fri Mar 22, 2013 12:23 pm
Topics Solved: 31

Re: Sales order line column Line Total Ex GST  Topic is solved

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: 2476
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 766

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: 647
Joined: Fri Mar 22, 2013 12:23 pm
Topics Solved: 31


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 5 guests