{
    "header": {
        "version": 1,
        "type": "record"
    },
    "body": {
        "record1": {
            "<1>": "declare function msg, send_event, admin_user, center_window, memberof, fieldcount, mast_sched_today_date\r\ndeclare subroutine end_dialog\r\n\r\n$insert msg_equates\r\n$insert lsl_users_equ\r\n\r\nif index( CreateParam, 'CENTER', 1 ) then\r\n    void = center_window( @window )\r\nend else\r\n    Void = set_property( @window, 'VISIBLE', 1 )\r\nend\r\nopen 'CONFIG' to ConfigTable else\r\n   Void = msg( '', 'Unable to open CONFIG table' )\r\n   end_dialog( @window, '' )\r\n   return 0\r\nend\r\n\r\nif memberof(@user4,'MASTER_SCHED' ) then\r\n\tlock ConfigTable, 'WO_MAST_SCHED' then\r\n\t   write @user4 on ConfigTable, 'WO_MAST_SCHED_USER' else\r\n\t      Void = msg( '', 'Error writing WO_MAST_SCHED_USER in config file...' )\r\n\t      return 0\r\n\t   end\r\n\t   Void = set_property( @window, '@GotLock', 1 )\r\n\tend else\r\n\t   UseBy = oconv( xlate( 'CONFIG', 'WO_MAST_SCHED_USER', '', 'X' ), '[XLATE_CONV,LSL_USERS*FIRST_LAST]' )\r\n\t   MsgInfo = ''\r\n\t   MsgInfo<mtext$> = 'WO_MAST_SCHED is in use by ':UseBy:' you will be allowed to view only.'\r\n\t   MsgInfo<micon$> = '!'\r\n\t   Void = msg( '', MsgInfo )\r\n      .save->enabled = 0\r\n      .clear_day->enabled = 0\r\n      .cfg_date_button->enabled = 0\r\n      .qcfg_date_button->enabled = 0      \r\n      .new_wo->enabled = 0\r\n      .month->enabled = 0\r\n      .cancel->text = 'OK'\r\n      .reactor_cnt->enabled = 0\r\n\tend\r\n    .print->visible = 1\t\r\n\tgosub DoRead\r\nend else\r\n    .save->enabled = 0\r\n    *.save->enabled = 1\r\n    .clear_day->enabled = 0\r\n    .cfg_date_button->enabled = 0\r\n    .qcfg_date_button->enabled = 0    \r\n    .new_wo->enabled = 0\r\n    .month->enabled = 0\r\n    .cancel->text = 'OK'\r\n    .reactor_cnt->enabled = 0\r\n    if memberof(@user4,'SUPERVISOR' ) OR MemberOf( @user4, 'LEAD') or memberof( @user4, 'MATERIALS' ) or memberof( @user4, 'DATA_ENTRY' ) then\r\n        .print->visible = 1\r\n    end\r\n    gosub DoRead\r\nend\r\n\r\nCurDate = mast_sched_today_date( '' )\r\nCurLabels = .sched_info->label\r\n\r\nlocate CurDate in CurLabels using @fm setting Fpos then\r\n   .sched_info->selpos = FPos:@fm:20\r\nend else\r\n   .sched_info->selpos = 1:@fm:20\r\nend\r\nRETURN 0\r\n*===========================================================================*\r\nDoRead:\r\n\r\nread MastSched from ConfigTable, 'WO_MAST_SCHED' then\r\n    if MastSched then\r\n        Days      = MastSched<1>\r\n        convert @vm to @fm in Days\r\n        .sched_info->label\t= Days\r\n        .month->text\t\t= MastSched<2>\r\n        ReactCnt\t\t\t= MastSched<3>\r\n        .reactor_cnt->text\t= ReactCnt\r\n        \r\n        SchedInfo = field( MastSched, @fm, 4, 99999 )\r\n       \r\n\r\n        SCnt = fieldcount( SchedInfo, @fm )\r\n        \r\n        for i = 1 to SCnt\r\n            SchedInfo<i> = field( SchedInfo<i>, @vm, 1, ReactCnt )\r\n\t        for j = 1 to ReactCnt\r\n\t            if SchedInfo<i,j> = '' then\r\n\t                SchedInfo<i,j> = 'Open'\r\n\t            end\r\n\t        next j\r\n        next i\r\n\t    .sched_info->array = SchedInfo\r\n        Void = set_property( @window, '@OrigSched', SchedInfo )\t    \r\n\t    .sched_info->toppos = 1:@fm:20\t    \r\n    end\r\nend\r\nreturn\r\n*===========================================================================*"
        }
    }
}