Sage 100

 View Only
  • 1.  Appropriate event for recalculating SOE lines for copied orders

    Posted 08-13-2019 22:35
    It's late and I'm just not seeing it...I have a Column Post Validate on SO Detail table to calculate gross profit on some other UDFs and it works fine. Now the client wants the UDF to recalculate for every line when a new sales order is copied from an existing order and when the users click on the Lines tab (he would not consider a button script). I've tried various table and panel events but can't seem to get the copied lines to automatically recalculate. Any suggestions on the appropriate event to configure in this case? Thank you! ​

    ------------------------------
    Amber Prayfrock, Blytheco
    ------------------------------


  • 2.  RE: Appropriate event for recalculating SOE lines for copied orders
    Best Answer

    Posted 08-14-2019 00:16
    Edited by Amber Prayfrock 08-14-2019 09:06
    Table Pre-Write events are the only events that will be triggered during a copy of a record.
    If you place your event on the SO_SalesOrderDetail Pre-Write event, you can use the following code to determine if the current line is a new line created during a copy operation.
    ncCopyingLines = 0 : oBusObj.GetValue "cCopyingLines", ncCopyingLines
    If oBusObj.EditState = 2 And CBool(ncCopyingLines) Then
    	' This line is new and being copied.
    	' Process your logic in here.
    End If​


    ------------------------------
    David Speck II
    Tennessee Software Solutions
    ------------------------------



  • 3.  RE: Appropriate event for recalculating SOE lines for copied orders

    Posted 08-14-2019 09:06
    Thank you so much, David! That is exactly what I needed. Once I updated a few lines to bring in the current costs from Item Maintenance too (vs. the copied values) the script worked perfectly! I very much appreciate your help!

    ------------------------------
    Amber Prayfrock, Blytheco
    ------------------------------



  • 4.  RE: Appropriate event for recalculating SOE lines for copied orders

    Posted 08-14-2019 09:41
    Yes, very nice!  I've never been able to figure that out, using header PreTotals (and a loop) to do recalculations.

    ------------------------------
    Kevin Moyes
    Technical Systems Analyst
    Munjal White Consulting Co.
    Toronto ON
    ------------------------------



  • 5.  RE: Appropriate event for recalculating SOE lines for copied orders

    Posted 08-14-2019 10:30
    My first thought was to do PreTotals, too, but the client didn't want to click on Totals and come back to Lines. So this PreWrite will come in handy again, I'm sure!

    ------------------------------
    Amber Prayfrock, Blytheco
    ------------------------------