{
    "header": {
        "version": 1,
        "type": "record"
    },
    "body": {
        "record1": {
            "<1>": "declare function fieldcount, msg, dialog_box, ncr_comm, memberof\r\ndeclare subroutine create_note\r\n$insert logical\r\n$insert msg_equates\r\n$insert quote_sigs_equ\r\n$insert lsl_users_equ\r\n$insert ncr_equ\r\nequ CrLf$ to char(13):char(10)\r\n\r\nRejCnt = .rej_cnt->text\r\nif RejCnt > 5 then\r\n   if memberof( @user4, 'ENGINEERING' ) then\r\n      * OK\r\n   end else\r\n      MsgInfo = ''\r\n      MsgInfo<micon$> = '!'\r\n      MsgInfo<mtext$> = 'There are more than 5 rejects, therefor an engineer must sign.'\r\n      Void = msg( '', MsgInfo )      \r\n      return 0\r\n   end\r\nend else\r\n   if ( memberof( @user4, 'SUPERVISOR' ) and not( memberof( @user4, 'SHIPPING' ) ) ) or memberof( @user4, 'ENGINEERING' ) then\r\n      * OK\r\n   end else\r\n      MsgInfo = ''\r\n      MsgInfo<micon$> = '!'\r\n      MsgInfo<mtext$> = 'You must be a supervisor or an engineer to sign for shipping materisl.'\r\n      Void = msg( '', MsgInfo )\r\n      return 0\r\n   end\r\nend\r\nAuthShipSig = .auth_ship_sig->text\r\nAuthShipSigName = .auth_ship_sig_name->text\r\nAuthDevSig  = .auth_dev_sig->text\r\nCurStatus = .status->value\r\nif CurStatus = 'O' then\r\n    if AuthShipSigName <> '' then\r\n        MsgInfo = ''\r\n        MsgInfo<mtext$> = 'This NCR has already been signed for ship material.'\r\n        MsgInfo<micon$> = '!'\r\n        Void = msg( '', MsgInfo )\r\n    end else\r\n        if ( .auth_rej_sig->text <> '' ) then\r\n\t\t    Valid = dialog_box( 'QUOTE_SIG_PWD_ENTRY', @window, @user4:@vm:xlate( 'LSL_USERS', @user4, lsl_users_password$, 'X' ) )\r\n\t\t\tif Valid then\r\n\t\t        .auth_ship_sig->text = @user4\r\n\t\t        .auth_ship_sig_name->text = xlate( 'LSL_USERS', @user4, 'FIRST_LAST', 'X' )\r\n\t\t        .status->value = 'C'\r\n\t\t        @@window->savewarn = 1\r\n\t\t        Void = ncr_comm( 'CLOSE_STATUS' )\t\t        \r\n\t\t    end\r\n\t    end else\r\n\t        MsgInfo = ''\r\n\t        MsgInfo<mtext$> = 'This NCR must be signed for rejected material before shipping material.'\r\n\t        MsgInfo<micon$> = '!'\r\n\t        Void = msg( '', MsgInfo )\r\n\t    end\r\n    end\r\nend else\r\n    if CurStatus = 'C' then\r\n       CurStatus = 'Closed'\r\n    end else\r\n       CurStatus = 'Verified'    \r\n    end\r\n    MsgExtension = ''\r\n    if AuthDevSig <> '' then\r\n       MsgExtension = ' and has already been signed for accept under deviation.'\r\n    end\r\n    MsgInfo = ''\r\n    MsgInfo<mtext$> = 'This NCR is ':CurStatus:MsgExtension\r\n    MsgInfo<micon$> = '!'\r\n    Void = msg( '', MsgInfo )\r\nend\r\nreturn 0"
        }
    }
}