{
	"name": "dialog/productivity_report/filter.json",
	"definition": {
		"speed_row_other_lg": [{
			"info": "speed_row_other_lg",
			"table": "wpa",
			"rule": [
				["wpa_production_lot", "==", "param.production_lot"],
				["wpa_work_phase_est_id", "==", "param.work_phase_est_id"]
			]
		}],
		"develop_chart": [{
			"info": "develop_chart",
			"table": "",
			"rule": [
				["includes", ["param.load_group", "load_group"]]
			]
		}],
		"wpa_time_period": {
			"info": "wpa_time_period, used elsewhere, must NOT be an array",
			"info2": "shift: yv=1, av=2, iv=3, em=4",
			"info3": "iv or em shift can be within next day, but it isn't next day work shift",
			"info4": "yv shift can be within pevious day, but it is time period work shift",
			"table": "wpa",
			"rule": [
				["includes", ["param.load_group", "wpa_work_load_group_id"]],
				["wpa_date_", ">=", "param.start_prev_date"],
				["wpa_date_", "<=", "param.end_next_date"],
				[
					[
						["wpa_date_", "<>", "param.start_date"], "or", ["wpa_end_time", ">=", "12:00:00"], "or", ["wpa_shift_number", "<", 3]
					]
				],
				[
					[
						["wpa_date_", "<>", "param.end_date"], "or", ["wpa_end_time", "<=", "12:00:00"], "or", ["wpa_shift_number", "<>", 1]
					]
				],
				[
					[
						["wpa_date_", "<>", "param.start_prev_date"], "or", ["wpa_end_time", ">", "12:00:00"]
					]
				],
				[
					[
						["wpa_date_", "<>", "param.start_prev_date"], "or", ["wpa_shift_number", "==", 1]
					]
				],
				[
					[
						["wpa_date_", "<>", "param.end_next_date"], "or", ["wpa_end_time", "<", "12:00:00"]
					]
				],
				[
					[
						["wpa_date_", "<>", "param.end_next_date"], "or", ["wpa_shift_number", ">=", 3]
					]
				]
			]
		},
		"finished_estimated_work_time": [{
			"info": "finished_estimated_work_time",
			"table": "wpa",
			"rule": [
				["finished_work_time", "<>", 0],
				["includes", ["param.load_group", "wpa_work_load_group_id"]]
			]
		}],
		"finished_work_time": [{
			"info": "finished_work_time",
			"table": "wpa",
			"rule": [
				["std_time", ">", 0],
				["includes", ["param.load_group", "wpa_work_load_group_id"]]
			]
		}],
		"track_time_asked": [{
			"info": "track_time_asked",
			"table": "track_time",
			"rule": [
				[
					["wpa_track_time_status", ">=", 1], "and", ["wpa_track_time_status", "<=", 4]
				],
				["includes", ["param.load_group", "wpa_work_load_group_id"]]
			]
		}],
		"track_time_measured": [{
			"info": "track_time_measured",
			"table": "track_time",
			"rule": [
				[
					["wpa_track_time_status", ">=", 2], "and", ["wpa_track_time_status", "<=", 3]
				],
				["includes", ["param.load_group", "wpa_work_load_group_id"]]
			]
		}],
		"track_time_changed": [{
			"info": "track_time_changed",
			"table": "track_time",
			"rule": [
				["previous_batch_number", "<>", 0],
				["wpa_measured_track_time", "<>", 0],
				["includes", ["param.load_group", "wpa_work_load_group_id"]]
			]
		}],
		"unproductive": [{
			"info": "unproductive",
			"table": "wpa",
			"rule": [
				["wpa_type_", "==", "ET"],
				["includes", ["param.load_group", "wpa_work_load_group_id"]]
			]
		}],
		"capacity_work_time": [{
			"info": "capacity_work_time",
			"table": "wpa",
			"rule": [
				["wpa_type_", "<>", "ET"],
				["wpa_shift_number", "==", "param.shift"],
				["includes", ["param.load_group", "wpa_work_load_group_id"]]
			]
		}],
		"capacity_unproductive_work_time": [{
				"info": "capacity_unproductive_work_time",
				"table": "wpa",
				"rule": [
					["wpa_type_", "==", "ET"],
					["wpa_shift_number", "==", "param.shift"],
					["includes", ["param.load_group", "wpa_work_load_group_id"]]
				]
			},
			{
				"info": "wpa_time_period",
				"table": "wpa",
				"rule": "wpa_time_period"
			}
		],
		"capacity_shift": [{
			"info": "shift",
			"table": "capacity",
			"rule": [
				["shift", "==", "param.shift"]
			]
		}],
		"capacity": [{
			"info": "time_period",
			"info2": "shift: yv=1, av=2, iv=3, em=4",
			"info3": "em shift can be within next day, but it isn't next day work shift ",
			"table": "capacity",
			"rule": [
				["end_dt", ">=", "param.start_date"],
				["end_dt", "<=", "param.end_next_date"],
				[
					[
						["end_dt", "<>", "param.start_date"], "or", ["end_dt", ">=", "12:00:00"], "or", ["shift", "<", 3]
					]
				],
				[
					[
						["end_dt", "<>", "param.end_next_date"], "or", ["end_dt", "<", "12:00:00"]
					]
				],
				[
					[
						["end_dt", "<>", "param.end_next_date"], "or", ["shift", ">=", 3]
					]
				]
			]
		}],
		"reclamation_load_group": [{
			"info": "reclamation_load_group",
			"table": "rcl",
			"rule": [
				["includes", ["param.load_group", "rcl_fault_made_load_group_id"]]
			]
		}],
		"finished_reclamation": [{
			"info": "finished_reclamation",
			"table": "rcl",
			"rule": [
				["includes", ["param.load_group", "rcl_fault_made_load_group_id"]],
				["rcl_state", "<>", 0],
				["rcl_finished_date", ">=", "param.start_date"],
				["rcl_finished_date", "<=", "param.end_date"]
			]
		}],
		"track_time_map": [{
			"info": "track_time_map",
			"table": "track_time",
			"rule": [
				["includes", ["param.load_group", "wpa_work_load_group_id"]],
				["wpa_date_", ">=", "param.start_date"],
				["wpa_date_", "<=", "param.end_date"]
			]
		}],
		"wlg_load_group": [{
			"info": "wlg_load_group",
			"table": "wlg",
			"rule": [
				["includes", ["param.load_group", "wlg_work_load_group_id"]]
			]
		}],
		"speed": [{
				"info": "no_unproductivity",
				"table": "wpa",
				"rule": [
					["includes", ["param.load_group", "wpa_work_load_group_id"]],
					["wpa_type_", "<>", "ET"]
				]
			},
			{
				"info": "no_fms",
				"use": [
					["rec.query_name", "==", "no_fms"]
				],
				"table": "wpa",
				"rule": [
					["includes", ["param.load_group", "wpa_work_load_group_id"]],
					[
						["work_time_fms", "==", 0], "or", ["wlg_use_automatic_receipt", "<=", 0]
					]
				]
			},
			{
				"info": "only_fms",
				"use": [
					["rec.query_name", "==", "only_fms"]
				],
				"table": "wpa",
				"rule": [
					["includes", ["param.load_group", "wpa_work_load_group_id"]],
					[
						["work_time_fms", "<>", 0], "or", ["wlg_use_automatic_receipt", "<=", 0]
					]
				]
			},
			{
				"info": "time_period",
				"info2": "shift: yv=1, av=2, iv=3, em=4",
				"info3": "em shift can be within next day, but it isn't next day work shift",
				"info4": "productivity_report.lua - createWpaIdTableWithTimePeriod(...)",
				"table": "wpa",
				"rule": "wpa_time_period"
			}
		],
		"quality": [{
			"info": "time_period",
			"info2": "shift: yv=1, av=2, iv=3, em=4",
			"info3": "em shift can be within next day, but it isn't next day work shift",
			"info4": "productivity_report.lua - createWpaIdTableWithTimePeriod(...)",
			"table": "wpa",
			"rule": "wpa_time_period"
		}]
	}
}