Sage 100

 View Only
  • 1.  Custom Office Scripting Question on Taxes

    Posted 10-13-2020 13:43
    I am in the need of some help on a custom office script regarding Sales Tax amounts in invoice data entry.

    My client is manually entering a value in a UDF called UDF_MAN_SLSTAX. However, It is mainly used on imported VI orders

    When Sales Order Invoice occurs the invoice clerks, manually overrides the Tax Amount in Sage by this value.

    Goal: To have Sage take this UDF value on have it automatically update the standard Sales Tax fields. The Tax Schedule is always the same ECOMM for every order. Also the tax code is setup up with a rate of 0. 

    Challenge: I think Sage's standard tax program keeps overriding any amounts that I try to script based on the tax schedule setups. The client does not want to setup tax rules in Sage and they have a very strange distaste of Avatax and Vertex. It was tried in the past and was not successfully.

    The following is my current script. 
    Any help or insights would be appreciated.

    'Goal: To set Sales Tax Schedule and Sage Tax amount to manual UDF Tax value


    UDF_MAN_SLSTAX=0

    if oSession.CompanyCode = "TST" then

    retVal = oBusObj.GetValue("UDF_MAN_SLSTAX", UDF_MAN_SLSTAX)
    'oSession.AsObject(oSession.UI).MessageBox "", "UDF_MAN_SLSTAX is " & UDF_MAN_SLSTAX

    if UDF_MAN_SLSTAX <> 0 then
    retVal = oBusObj.SetValue("TaxSchedule$", " ECOMM")

    'Sales Tax Detail Key
    'SalesOrderNo+ScheduleSeqNo+TaxCode+TaxClass

    'Sales Tax Header
    If oBusObj.SalesTaxCalcObj > 0 Then
    'Set oSalesTaxCalcObj = oSession.AsObject(oBusObj.SalesTaxCalcObj)

    Set oSalesTaxCalcObj = oSession.AsObject(oSession.GetObject("SO_SalesOrderTaxSummary_bus"))
    orderNo = ""
    seqNo = ""
    taxCode = ""

    retVal = oBusObj.GetValue("SalesOrderNo$", orderNo)



    retval = oSalesTaxCalcObj.SetKeyValue("SalesOrderNo$", orderNo)
    retval = oSalesTaxCalcObj.SetKeyValue("ScheduleSeqNo$", "000001")
    retval = oSalesTaxCalcObj.SetKeyValue("TaxCode$", "TX")
    retval = oSalesTaxCalcObj.SetKey()
    retval = oSalesTaxCalcObj.Write()

    retVal = oSalesTaxCalcObj.SetValue("Overridden$", "Y")
    retVal = oSalesTaxCalcObj.SetValue("SalesTaxAmt", UDF_MAN_SLSTAX)
    retval = oSalesTaxCalcObj.Write()

    set oSalesTaxCalcObj = Nothing
    End If

    'retVal = oScript.InvokeButton("BT_TAXDETAIL")
    'oSession.AsObject(oSession.UI).MessageBox "", "UDF_MAN_SLSTAX is " & UDF_MAN_SLSTAX & " " & TaxableSalesAmt & " " & NonTaxableSalesAmt

    end if
    end if

    ------------------------------
    Michael Davis
    Warren Averett Technology Group
    Birmingham, AL
    ------------------------------


  • 2.  RE: Custom Office Scripting Question on Taxes

    Posted 10-13-2020 14:45
    Edited by Alnoor Cassim 10-13-2020 14:54
    Due to the timing issue you mentioned this is more intended for a mod. Couple of ideas that involve changing the timing:

    1.  Since you're importing into S/O Entry , after the main import which now would also involve importing in UDF_MAN_SLSTAX, you do a 2nd import into SO Sales Order Tax Summary to set the key fields and the SalesTaxAmt. If it behaves the way I'm thinking, Overridden field (which is ReadOnly in dictionary) will get set for you and the SalesTaxAmt will also get updated on the order in SO_SalesOrderHeader table.

    2. After import completes OR after they have keyed in the UDF_MAN_SLSTAX, have them save/accept the order. Add a button to your S/O Entry that when pressed will sequentially go through all the orders that need the sales tax adjustment. Basically do this part of your script only (don't .Write back to the order):

    retVal = oSalesTaxCalcObj.SetValue("SalesTaxAmt", UDF_MAN_SLSTAX)
    retval = oSalesTaxCalcObj.Write()

    The Write() in theory should set the Overridden on SO Sales Order Tax Summary and set the SalesTaxAmt on the order itself in S/O Entry.

    You'll have to test it out.


    ------------------------------
    Alnoor Cassim

    Email: alnoor@asifocus.com
    Ph: 949-689-9887
    Orange County, CA
    ------------------------------



  • 3.  RE: Custom Office Scripting Question on Taxes

    Posted 10-14-2020 13:21

    Alnoor,

     

     

    In running the button script, I keep getting an error 0, record/file busy.

     

    It looks like it is not letting the write happen since I am on that invoice in invoice data entry.

    Last file Name: SO_InvoiceHeader.M4T

     

    Any suggestions?

     

    Thank you

    Michael

     

    Michael H . Davis, CPA.CITP, MCSE

    Senior Consultant

    michael.davis@warrenaverett.com

    (O) 205.313.4700  

    (D) 205.313.4734  (F) 205.592.9991

    1900 International Park Dr, Suite 400, Birmingham, AL 35243

     

    To contact our Support Team, call 844.712.6223 or email software@warrenaverett.com.

    __________________________________________________________________

    In response to the COVID-19 pandemic, we have moved to a remote working environment. While our physical office locations are minimally staffed, Warren Averett continues to serve your accounting and consulting needs.

    Please note that Warren Averett is not an Agent under the Paycheck Protection Program loan program ("PPP"). Warren Averett does not provide loan packaging services or guarantee qualification under the PPP or any loan administered by the U.S. Small Business Administration 7(a) loan program.

    For ongoing insights and updates visit our COVID-19 Resource Page .

     






  • 4.  RE: Custom Office Scripting Question on Taxes

    Posted 10-14-2020 14:37
    Edited by Alnoor Cassim 10-14-2020 14:42
    First make sure your button is active only when there is no invoice on the screen.  You can set Customizer to do that with a trick I mentioned here on this SageCity link . Then make sure when you loop thru the invoices , start with a MoveFirst() then Do Until / Loop then MoveNext() . Within the loop you'll do the GetObject to SO_InvoiceTaxSummary_bus (let's say you've called it oITS) and only in there you oITS.SetValue() and oITS.Write() while the oBusObj.MoveNext() would take you to the next invoice. If you still have trouble message me privately.

    ------------------------------
    Alnoor Cassim

    Email: alnoor@asifocus.com
    Ph: 949-689-9887
    Orange County, CA
    ------------------------------



  • 5.  RE: Custom Office Scripting Question on Taxes

    Posted 10-14-2020 16:17

    Alnoor,

     

    That worked like a charm.

     

    Thank  you,

    Michael

     

     

    Michael H . Davis, CPA.CITP, MCSE

    Senior Consultant

    michael.davis@warrenaverett.com

    (O) 205.313.4700  

    (D) 205.313.4734  (F) 205.592.9991

    1900 International Park Dr, Suite 400, Birmingham, AL 35243

     

    To contact our Support Team, call 844.712.6223 or email software@warrenaverett.com.

    __________________________________________________________________

    In response to the COVID-19 pandemic, we have moved to a remote working environment. While our physical office locations are minimally staffed, Warren Averett continues to serve your accounting and consulting needs.

    Please note that Warren Averett is not an Agent under the Paycheck Protection Program loan program ("PPP"). Warren Averett does not provide loan packaging services or guarantee qualification under the PPP or any loan administered by the U.S. Small Business Administration 7(a) loan program.

    For ongoing insights and updates visit our COVID-19 Resource Page .