Delegating Feature-Creep

This is a feature request that has been on the books for a while. Only requested by one user as far as I know.

0003133: User has requested an Item Picking List on the Order screens.
Description: He would like to be able to flag the Items to appear in the Order - from the Item List, and then add the Quantities.

This is the very thing that MWScript is for: functionality that is only wanted by a small percentage of users, which if included in the base product would only add complexity and concomitant fear and confusion for all other users.

It takes a few minutes to write a script to implement this functionality


constant meta = "Sample by Rowan Daniell. http://cognito.co.nz"

// Creates a new Sales Order populated with the highlighted products

property populate = 0

on MakeOrder public      // Invocation point
    let populate = 1    // set one-shot flag
    Navigator("neso")   // make new sales order
end

on Before:F_TRANS:SO(winref)
    if populate // only do our thing when one-shot is set
        let list = GetListHandle(winref"All Order Lines")
        let row = 0
        foreach prod in product CreateSelection("Product""**")
            if row > 0  // the first row is inserted automatically
                AddListLine(list)
            endif
            SetListField(listrow"Item"prod.Code)
            let row = row + 1
        endfor
        let populate = 0
    endif
end

on Load
    // install our command in the Command menu
    InstallMenuCommand("Pick Order for Selection""Order_From_Sel:MakeOrder")
end
Posted in MWScript | Comments Off on Delegating Feature-Creep