{
    "header": {
        "version": 1,
        "type": "record"
    },
    "body": {
        "record1": {
            "<1>": "declare subroutine btree.extract, update_index, rlist, end_dialog\r\ndeclare function msg, key_sort, utility, fieldcount\r\n$insert lsl_users_equ\r\n$insert msg_equates\r\n\r\nCustNo     = .cust_no->text\r\nSpan       = .span->text    \r\nStartDate  = .from->text\r\nEndDate    = .thru->text\r\nOrdStat    = .order_stat->text\r\nQuoteStat  = .order_quote->text\r\nDirToPrint = .send_to_printer->text\r\nSpecOnly   = .spec_only->check\r\n* verify that every required field has a value\r\nif CustNo else\r\n   MsgInfo = ''\r\n   MsgInfo<micon$> = 'H'\r\n   MsgInfo<mtext$> = 'You must select a customer...'\r\n   Void = msg( '', MsgInfo )\r\n   return 0\r\nend\r\nif QuoteStat = 'Quoted Products' then\r\n   OrdStat = '' ;* set to null instead of N/A so the code will not break\r\n                ;* cause if it is quoted products then no orders will be printed\r\nend else\r\n   if QuoteStat = 'Ordered Products' then\r\n      if OrdStat = 'N/A' then\r\n\t\t * have choosen ordered products now make sure they have not choosen N/A\r\n\t\t MsgInfo = ''\r\n\t\t MsgInfo<micon$> = 'H'\r\n\t\t MsgInfo<mtext$> = 'You have choosen Ordered Products, therefore Order Status cannot be N/A...'\r\n\t\t Void = msg( '', MsgInfo )\r\n\t\t return 0\r\n      end\r\n   end else\r\n\t  MsgInfo = ''\r\n\t  MsgInfo<micon$> = 'H'\r\n\t  MsgInfo<mtext$> = 'You must choose an option from Orders/Quotes...'\r\n\t  Void = msg( '', MsgInfo )\r\n\t  return 0\r\n   end\r\nend\r\nif StartDate or EndDate then\r\n   * they must have both of them\r\n   if StartDate and EndDate then\r\n      * have both from and thru so set span to '' instead of N/A so code does not break\r\n      Span = ''\r\n   end else\r\n      * have only one date must have both\r\n      MsgInfo = ''\r\n      MsgInfo<micon$> = 'H'\r\n      MsgInfo<mtext$> = 'When using a From and Thru range you must specify both dates...'\r\n      Void = msg( '', MsgInfo )\r\n      return 0\r\n   end\r\nend else\r\n   if Span then\r\n\t  if Span = 'N/A' then\r\n\t     * have not choosen start and end dates so span cannot be N/A\r\n\t     MsgInfo = ''\r\n\t     MsgInfo<micon$> = 'H'\r\n\t     MsgInfo<mtext$> = 'You have not choosen From and Thru dates, therefore Span cannot be N/A...'\r\n\t     Void = msg( '', MsgInfo )\r\n\t     return 0\r\n\t  end\r\n   end else\r\n      * have only one date must have both\r\n      MsgInfo = ''\r\n      MsgInfo<micon$> = 'H'\r\n      MsgInfo<mtext$> = 'You must either choose a From and Thru When using a From and Thru range you must specify both dates...'\r\n      Void = msg( '', MsgInfo )\r\n      return 0\r\n   end\r\nend\r\nRetVal = CustNo:'*':Span:'*':StartDate:'*':EndDate:'*':OrdStat:'*':QuoteStat:'*':DirToPrint:'*':SpecOnly\r\nend_dialog( @window, RetVal )\r\nreturn 0"
        }
    }
}