Sales Order\Sales Order Invoice - Order Type

SUGGESTED

Afternoon,

For Sales Order:

Curious if we have any control over the SO Order Type.

Specifically we want to remove Master Order & Repeating Order as an option.

For Sales Order Invoice:

Same for Sales Order Invoice Data Entry.

We would like to limit the options to: Standard Invoice and Credit Memo

Thanks for comments

  • 0

    First thought that comes to mind is a pre-validate event script on each field and use oScript.SetError if it is not one of the values you want to allow.

    Second though is a UI post load event script on the panel where the drop box is located and use oUIObj.LoadDropBox to try to reload it with just the values you want but I haven't tested this and with value translations being used on the stock field, it may not work as expected.  Would probably need to be handled differently but I can't test it at the moment.

    Third though is create your own drop box UDF for each task with the values you want for each and hide the original drop box, place yours over it and use a post-validate event script to mirror the value from your UDF to the stock field.  You need to take into consideration the actual value that needs to be set though.

  • 0 in reply to David Speck
    SUGGESTED

    FYI, if you go with the pre-validate event script, which I think is the safest way to go, make sure you filter them to the UI tasks and libraries.

    If you want to attempt to override the drop boxes, see below.

    I found that Sales Order Entry uses a variable called "cOrderTypeListAll$" to populate the OrderType drop box so you can use the following in a UI post load event script attached to the dMain panel of SO_SalesOrder.M4L.

    oUIObj.SetVar "cOrderTypeListAll$", "Standard Order|Back Order|Quote|"

    SO Invoice Data Entry did not appear to operate the same way and I actually had to reload the drop box whenever the panel was redrawn.  So the following works on the UI post load event script attached to the pHeader and pHeader panels of SO_Invoice.M4L.

    InvoiceType = "" : oUIObj.GetControlProperty "DB_InvoiceType", "Value$", InvoiceType
    oUIObj.DropBoxLoad "DB_InvoiceType", "Standard Invoice|Credit Memo|"
    oUIObj.SetControlProperty "DB_InvoiceType", "Tbl$", "SC"
    oUIObj.SetControlProperty "DB_InvoiceType", "Value$", InvoiceType

    EDIT: The solution above for Sales Order Entry is faulty, DO NOT use it.  The solution for Invoice Data Entry has been updated.

  • 0

    It used to be that if you had access to NOMADS you could edit the list. Don't know if that is still the case

  • 0 in reply to David Speck

    You have to be careful with drop boxes where the contents may change.  In the case of Sales Order as   has stated above, it is true initially this variable is used to load the drop box, however, there are many other places, where types are dropped or manipulated.  With the Sales Order type you have to also set another property of the control, because there is a translation table used with some drop boxes.  In addition to what David is proposing above, you would need to set the translation table as well.

    oUIObj.SetControlProperty "OrderType", "TBL$", "SBQ"

     Even after doing this, the underlying code may change these drop boxes.  You can definitely script, to only allow the types you want, something like David said in his first response.

  • 0 in reply to jepritch

    I did play around with overriding the Tbl$ property but the UI appeared to constantly reset it in Sales Order Entry, even when just picking a different value from it and not when the panel was redrawn, and the testing I did appeared as though the Tbl$ property did not have to be manipulated in order to make sure the correct single character (translated value) was set into the field.  I know some translations appear to use the number (index) of a value and then the position in the Tbl$ string but my testing appeared as though the translation was occurring based on the first character of the selected value.  Being unsure of exactly what it was doing and without doing additional extensive testing is why I initially recommended using the pre-validate scripts to avoid messing with the drop boxes themselves.

  • 0 in reply to David Speck

    Well, did some more testing, and Sales Order Entry is problematic because it does continue to reset the Tbl$ property to "SBMRQ" so selecting Quote after using my previous script example and then checking the Value$ property of the control showed the value was "M". 

    So I can confirm the following works fine on the post-load UI event of the pHeader and pHeaderW panels in SO_Invoice.M4L.

    InvoiceType = "" : oUIObj.GetControlProperty "DB_InvoiceType", "Value$", InvoiceType
    oUIObj.DropBoxLoad "DB_InvoiceType", "Standard Invoice|Credit Memo|"
    oUIObj.SetControlProperty "DB_InvoiceType", "Tbl$", "SC"
    oUIObj.SetControlProperty "DB_InvoiceType", "Value$", InvoiceType

    At the moment, I do not have a solution for Sales Order Entry using this approach.

    Thank you for your insight .

  • 0 in reply to David Speck

    The following was required on the post-load UI event of the pHeader and pHeaderW panels in SO_SalesOrder.M4L.  

    OrderType = "" : oUIObj.GetControlProperty "OrderType", "Value$", OrderType
    oUIObj.DropBoxLoad "OrderType", "Standard Order|Back Order|Quote|"
    oUIObj.SetControlProperty "OrderType", "Tbl$", "SBQ"
    oUIObj.SetControlProperty "OrderType", "Value$", OrderType
    oUIObj.SetVar "cOrderTypeListAll$", "Standard Order|Back Order|Quote|"
    oScript.Execute "IF OrderType.ctl <> 0 { IF POS(UCS(""OrderType.ctl'Tbl$"") = UCS(_CMD_TBL$[OrderType.ctl - 10000, _WDW_INDX])) = 0 { _CMD_TBL$[OrderType.ctl - 10000, _WDW_INDX] = _CMD_TBL$[OrderType.ctl - 10000, _WDW_INDX] + ""; OrderType.ctl'Tbl$ = """"SBQ"""" "" } }"
    oScript.Execute "IF BT_NextNum.ctl <> 0 AND OrderType.ctl <> 0 { IF POS(UCS(""BT_NextNum.ctl'Tbl$"") = UCS(_CMD_TBL$[BT_NextNum.ctl - 10000, _WDW_INDX])) = 0 { _CMD_TBL$[BT_NextNum.ctl - 10000, _WDW_INDX]=_CMD_TBL$[BT_NextNum.ctl - 10000, _WDW_INDX] + ""; OrderType.ctl'Tbl$ = """"SBQ""""; IF OrderType$ <> """""""" { OrderType.ctl'Value$ = OrderType$ } "" } }"
    oScript.Execute "IF SalesOrderNo.ctl <> 0 AND OrderType.ctl <> 0 { IF POS(UCS(""SalesOrderNo.ctl'Tbl$"") = UCS(_CMD_TBL$[SalesOrderNo.ctl - 10000, _WDW_INDX])) = 0 { _CMD_TBL$[SalesOrderNo.ctl - 10000, _WDW_INDX] = _CMD_TBL$[SalesOrderNo.ctl - 10000, _WDW_INDX] + ""; OrderType.ctl'Tbl$ = """"SBQ""""; IF OrderType$ <> """""""" { OrderType.ctl'Value$ = OrderType$ } "" } }"
    oScript.Execute "IF ML_Customer.ctl <> 0 AND OrderType.ctl <> 0 { IF POS(UCS(""ML_Customer.ctl'Tbl$"") = UCS(_CMD_TBL$[ML_Customer.ctl - 10000, _WDW_INDX])) = 0 { _CMD_TBL$[ML_Customer.ctl - 10000, _WDW_INDX] = _CMD_TBL$[ML_Customer.ctl - 10000, _WDW_INDX] + ""; OrderType.ctl'Tbl$ = """"SBQ""""; IF OrderType$ <> """""""" { OrderType.ctl'Value$ = OrderType$ } "" } }"
    oScript.Execute "IF OrderType.ctl <> 0 { IF POS(UCS(""OrderType.ctl'Tbl$"") = UCS(_FCS_TBL$[OrderType.ctl - 10000, _WDW_INDX])) = 0 { _FCS_TBL$[OrderType.ctl - 10000, _WDW_INDX] = _FCS_TBL$[OrderType.ctl - 10000, _WDW_INDX] + ""; OrderType.ctl'Tbl$ = """"SBQ"""""" } }"

    All the extra code was needed to force the Tbl$ property to "SBQ" because any of the following would reset the Tbl$ property to "SBMRQ".

    1. Changing the sales order number.
    2. Using the Next Order No. button.
    3. Changing the customer number.
    4. Clicking the lookup for the customer number regardless of whether you clicked cancel or selected a customer number.
    5. Changing the order type.