{
  "name": "dialog/productivity_report/filter.json",
  "filter": [
    {
      "filter_name":"no_fms",
      "filter_rule": ["query_name","=","no_fms"],
      "run": [
       [
         "if", ["wpa_employee_id", "is empty"],
           [
             ["result","=",true]
           ],
         "elseif", ["wlg_use_automatic_receipt", "<", 1],
           [
             ["result","=",true]
           ],
         "elseif", [["lowercase", ["wpa_employee_id"]], "=", "fms"],
           [
             ["result","=",false]
           ],
         "else",
           [
             ["result","=",true]
           ]
         ]
      ]
    },
    {
      "filter_name":"only_fms",
      "filter_rule": ["query_name","=","fms"],
      "run": [
       [
         "if", ["wpa_employee_id", "is empty"],
           [
             ["result","=",true]
           ],
         "elseif", ["wlg_use_automatic_receipt", "<", 1],
           [
             ["result","=",true]
           ],
         "elseif", [["lowercase", ["wpa_employee_id"]], "<>", "fms"],
           [
             ["result","=",false]
           ],
         "else",
           [
             ["result","=",true]
           ]
         ]
      ]
    }
  ]
}
