Page 1 of 1

Sales order line column Line Total Ex GST

PostPosted: Wed Sep 18, 2024 2:51 pm
by DannyC
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?

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

PostPosted: Wed Sep 18, 2024 2:56 pm
by Mike.Sheen
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).

Re: Sales order line column Line Total Ex GST

PostPosted: Wed Sep 18, 2024 3:59 pm
by DannyC
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);
      }
   }