{
    "header": {
        "version": 1,
        "type": "record"
    },
    "body": {
        "record1": {
            "<1>": "declare function entid, repository, start_window, msg, key_sort, rowexists\r\ndeclare subroutine make.list\r\n$insert msg_equates\r\n$insert logical\r\n\r\nVoid = set_property( @window, '@ChoosingMultiPSN', true$ )\r\nSelPos = .prev_psns->selpos\r\nCustNo = .cust_no->text\r\nCol = SelPos<1>\r\nRow = SelPos<2>\r\nif CustNo then\r\n    * row one = call window with current key\r\n\t* row two = call window with no keys\r\n\t* row three = call window with all keys for customer\r\n\t* row four = call popup allowing choice\r\n\tColData = get_property( @window:'.PREV_PSNS', 'COLDATA' )\r\n\tCurProdSpecID = ColData<1,Row>\r\n\tif CurProdSpecID then\r\n\t   if rowexists( 'QUOTE', .quote_no->text ) else\r\n\t      Tvar = iconv( CurProdSpecID, '[WIN_PROD_SPEC_NUM_VALID]' )\r\n\t      if status() then\r\n\t         return 0\r\n\t      end\r\n\t   end\r\n\tend\r\n\tPopupId = entid( @appid<1>, 'POPUP', '', 'PROD_SPEC_LOOKUP_OPTS' )\r\n\tChoosenRow = repository( 'EXECUTE', PopupId, @window, '' )\r\n\tif ChoosenRow = 1 then\r\n\t    ;* go view current prod spec\r\n\t    if CurProdSpecID then\r\n\t        RetVal = start_window( 'PROD_SPEC', @window, CurProdSpecID:'*Choosing*Quote**CENTER', '', '' ) \r\n\t\tend else\r\n\t\t    MsgInfo = ''\r\n\t\t    Text = 'You have not entered a product specification number...' \r\n\t\t    MsgInfo<mtext$> = Text\r\n\t\t    MsgInfo<micon$> = 'H'\r\n\t\t    Void = msg( '', MsgInfo )\r\n\t\t    return 0\r\n        end\r\n    end else\r\n        if ChoosenRow = 2 then\r\n\t        * call customer prod spec window\r\n\t\t\tRetVal = start_window( 'PROD_SPEC', @window, '*Choosing*Quote*':CustNo:'*CENTER', '', '' )\r\n\t\tend else\r\n\t\t    if ChoosenRow = 3 then\r\n\t\t        *  call product specification window with all\r\n\t\t\t\tOpenKeys = xlate( 'COMPANY', CustNo, 'PROD_SPEC_KEYS', 'X' )\r\n\t\t\t\tif OpenKeys then\r\n\t\t\t\t\tconvert @vm to @fm in OpenKeys\r\n\t\t\t        OpenKeys = key_sort( OpenKeys, 'PROD_SPEC', '#ENTRY_DATE', 1 )\t\t\t\t\t\r\n\t\t\t        convert @fm to @vm in OpenKeys\r\n\t\t            RetVal = start_window( 'PROD_SPEC', @window, OpenKeys:'*Choosing*Quote**CENTER', '', '' )\r\n\t\t\t\tend else\r\n\t\t\t\t    gosub CustErr\r\n\t\t\t\t    return 0\r\n\t\t\t\tend\r\n\t\t\tend else\r\n\t\t\t    if ChoosenRow = 4 then\r\n\t\t\t        ;* show all open in popup allowing choice\r\n\t\t  \t\t\tOpenKeys = xlate( 'COMPANY', CustNo, 'PROD_SPEC_KEYS', 'X' )\r\n\t\t\t\t\tif OpenKeys then\r\n\t\t\t\t\t    convert @vm to @fm in OpenKeys\r\n\t\t\t\t        OpenKeys = key_sort( OpenKeys, 'PROD_SPEC', '#ENTRY_DATE', 1 )\t\t\t\r\n\t\t\t         \tmake.list( 0, OpenKeys, '', '' )\r\n\t\t         \t\tPopupId = entid( @appid<1>, 'POPUP', '', 'PROD_SPEC_SINGLE' )\r\n\t\t    \t   \t\tChoosenRow = repository( 'EXECUTE', PopupId, @window, '' )\r\n\t\t    \t   \t\tif ChoosenRow then\r\n\t\t\t\t\t\t\tColData<1,Row> = ChoosenRow\r\n\t\t\t\t\t\t\tVoid = set_property( @window:'.PREV_PSNS', 'COLDATA', ColData )\r\n\t\t                end\r\n\t\t        \tend else\r\n\t\t\t\t\t    gosub CustErr\r\n\t\t\t\t\t    return 0\r\n\t\t\t\t\tend\r\n\t\t\t    end ;* user canceled\r\n\t\t    end\r\n\t    end\r\n    end    \r\nend else\r\n    MsgRec = ''\r\n    MsgRec<mtext$> = 'You must enter a customer first...' \r\n    MsgRec<micon$> = 'H'\r\n    Void = msg( '', MsgRec )    \r\nend\r\nRETURN 0\r\n*===========================================================================*\r\nCustErr:\r\n    Text = 'There are currently no Product Specifications for '\t\t        \r\n    Text:= oconv( CustNo, '[XLATE_CONV,COMPANY*CO_NAME]' )  \r\n    MsgInfo = ''\r\n    MsgInfo<mtext$> = Text\r\n    MsgInfo<micon$> = 'H'\r\n    Void = msg( '', MsgInfo )\r\nreturn 0\r\n*===========================================================================*\r\n"
        }
    }
}