Sage 100

 View Only
  • 1.  #Scripting Around the Sales Journal Update

    Posted 02-22-2020 14:23
    My objective is to ensure that invoices have no profit by replacing UnitPrice with actual UnitCost (including made items) in invoice detail lines that are about to be posted. Knowing that journal updating events are not triggered, I HAVE been successful at intercepting related events (e.g. Pre and Post Delete events against invoice detail records), but these events occur too late for changing the price before it is posted. Are there any ideas about how to effect a no profit invoice? Am I barking up the wrong tree or maybe this isn't a tree at all? All comments appreciated.

    ------------------------------
    Dan Burleson
    Software Consultant
    Connex Software
    Corvallis OR
    541-224-6642
    ------------------------------


  • 2.  RE: #Scripting Around the Sales Journal Update

    Posted 02-23-2020 00:25
    Not easily as a non-MD. As a MD, you could use a class override to do this. Otherwise, you have to intercept the print/preview buttons during the SO Journal, basically tacking on your logic followed by the button's original logic. Then figure out if batches are enabled, if yes, figure out which batches have been selected, then loop through SO_InvoiceHeader and the related SO_InvoiceDetail records. At the very least, this requires either DFDM'ing the panel so you can customize it or add a UI Post Load event to any panel to create the record in CM_UIScriptSettings and then modify the library and panel (both MUST be uppercase) to match the library and panel used during journals, which is used by all the journals so you also have to check the StartProgram to make sure you are only doing this during the SO Journal.

    I recommend getting an MD to do this. 

    However, i do have to ask, why not set the UnitPrice to the UnitCost during the pre-write on SO_InvoiceDetail or is the cost fluctuating so much that between the last edit and the journal update, the cost is being recalculated to something else? If this is the case, then maybe another approach is to use a button script in SO Invoice Data Entry that a user would click once ready to update and have it recalculate the unit cost and then set the unit price.

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



  • 3.  RE: #Scripting Around the Sales Journal Update

    Posted 02-23-2020 02:05
    Thank you for the response David. I tested this again to make sure, but at the time of the detail table Pre-Write event the costs have been set to AverageCost and what is posted is something different (I assume) from the MB-JOBOPS equivalent of IM_ItemCost. I think your MD suggestion is the best (and safest) solution.

    ------------------------------
    Dan Burleson
    Software Consultant
    Connex Software
    Corvallis OR
    541-224-6642
    ------------------------------