Event handler to return an object

Mkontwg

Member
Hi team

I need a help here below. My code first create an event handler that calculate vat, when click event is triggered. Then it also do the unchecked when this event is not clicked. What i want to achieve here is find a way to return original value(amount), when this event is unchecked.
Code:
/*-----------------------------------------------------------------------------
      Purpose: ORDER NUMBER JD000699.
     Notes: Please change miscelleneous line items to display VAT on cash invoices.
     This handler created to check and calculate VAT amount and VAT excluded.
     This only changes when VAT inclusive is set to YES.
    ------------------------------------------------------------------------------*/
    @VisualDesigner.
    METHOD PRIVATE VOID Check_Click( INPUT sender AS System.Object, INPUT e AS System.EventArgs ):
       DEFINE VARIABLE result AS DECIMAL NO-UNDO.
      
        IF  hdsMain:GET-BUFFER-HANDLE (1)::tt-incl THEN DO: 
            
            dgMain:ActiveRow:Cells["tt-retail"]:Value = CalcExVatAmount(DEC(dgMain:ActiveRow:Cells["tt-retail"]:Value:ToString())). 
            
        END.
        ELSE DO:
        IF NOT hdsMain:GET-BUFFER-HANDLE (1)::tt-incl = "TRUE" THEN DO:
        dgMain:ActiveRow:Cells["tt-retail"]:Value =  CalcVat(DEC(dgMain:ActiveRow:Cells["tt-retail"]:Value:ToString())).
           END. 
        
       END.
     CheckedButton().   
     
              
   END METHOD.
  METHOD PRIVATE VOID CheckedButton( ):
   
  CredTick().
 
Top