{
  "name": "query/manager/product/product_work/actual/latest.json",
  "database": "4d",
  "parameter": {
    "days_before": 15,
    "start_minutes_before": 60,
    "last_date": "",
    "start_date": "",
    "start_time": "",
    "start_type": ["AL"]
  },
  "map_parameter":[
    ["days_before_negative", "=", ["-",["days_before"]]],
    ["last_date", "=", ["daysToCurrentDateStringAdd",["days_before_negative"]]],
    
    ["current_dt", "=", ["currentDateTime"]],
    ["start_minutes_before_negative", "=", ["-",["start_minutes_before"]]],
    ["start_seconds_before_negative", "=", ["start_minutes_before_negative", "*", 60]],
    ["start_dt", "=", ["secondsAdd", ["current_dt", "start_seconds_before_negative"]]],
    ["start_date", "=", ["dateTimeToDateString", ["start_dt"]]],
    ["start_time", "=", ["dateTimeToTimeString", ["start_dt"]]]
  ],
  "query": [
    [
      "wpa_date_",
      ">=",
      "last_date"
    ],
    "or",
    "started"
  ],
  "set":{
    "started": [
      "started_1",
      "or", 
      "started_2"
    ],
    "started_1": [
      [
        "wpa_type_",
        "in",
        "start_type"
      ],
      "and",
      [
        "wpa_start_date",
        "=",
        "start_date"
      ],
      "and",
      [
        "wpa_start_time",
        ">=",
        "start_time"
      ]
    ],
    "started_2": [
      [
        "wpa_type_",
        "in",
        "start_type"
      ],
      "and",
      [
        "wpa_start_date",
        ">",
        "start_date"
      ]
    ]
  },
  "order": [
    "wpa_date_", "<", "wpa_end_time", "<"
  ],
  "limit": 1000000,
  "field": [
    "wpa_record_id"
  ]
}
