{
	"name": "query/manager/product/product_work/actual/update_started_work_phase_work_time.json",
	"table": [
		{
			"record_type": ["actual"],
			"table": "product_work"
		}
	],
	"database": "4d",
	"parameter": {
		"show_sql": false
	},
	"field": [
		"prwo.json_data.start_date",
		"prwo.json_data.start_time",
		"prwo.json_data.end_date",
		"prwo.json_data.end_time",
		"prwo.json_data.start_work_shift",
		"prwo.json_data.work_shift",
		"prwo.resource_id",
		"prwo.production_lot",
		"prwo.work_phase_number",
		"prwo.work_phase_type",
		"prwo.json_data.subtype",
		"prwo.json_data.start_person_id",
		"prwo.json_data.program_id",
		"prwo.json_data",
		"prwo.info",
		"prwo.record_id",
		"prwo.modify_id",
		"prwo.work_hours",
		"prwo.json_data.social_cost_multiplier",
		"prwo.description",
		"prwo.profit_multiplier",
		"prwo.setup_hourly_salary",
		"prwo.work_hourly_salary",
		"prwo.setup_hourly_self_cost",
		"prwo.work_hourly_self_cost",
		"prwo.json_data.salary_bonus",
		"prwo.json_data.work_number",
		"prwo.json_data.start_subtype",
		"prwo.machine_hours",
		"prwo.setup_hours"
	],
	"fieldXX": ["res.json_data.automatic_receipt_delay"],
	"info_fi": "Kuormitusryhmän 'seurataan työn  etenemistä' on oltava päällä ja lisäksi tot. työvaiheen tyyppi on oltava AL tai ET-tyyppiset tot työvaiheet joiden alatyyppi=AL",
	"query": [
		["prwo.json_data.start_date", ">=", "2015-01-01"],
		"and",
		["res.json_data.follow_work_progression", "=", 1],
		"and",
		"query_started",
		"and",
		"query_wo_open"
	],
	"queryZZ": [
		["prwo.resource_id", "=", "BW1"]
	],
	"query_orig": [
		["prwo.json_data.start_date", ">=", "2015-01-01"],
		"and",
		["res.json_data.follow_work_progression", "=", 1],
		"and",
		["prwo.work_phase_type", "=", "AL"]
	],
	"query_test_not_working": [
		["prwo.json_data.start_date", ">=", "2015-01-01"],
		"and",
		["res.json_data.follow_work_progression", "=", 1],
		"and",
		[
			["prwo.work_phase_type", "=", "AL"],
			"or",
			[
				["prwo.work_phase_type", "=", "ET"],
				"and",
				["prwo.json_data.subtype", "=", "AL"]
			]
		]
	],
	"query_with_many_set": [
		["prwo.json_data.start_date", ">=", "2015-01-01"],
		"and",
		["res.json_data.follow_work_progression", "=", 1],
		"and",
		"query_started"
	],
	"set": {
		"query_productive_started": ["prwo.work_phase_type", "=", "AL"],
		"query_started": [
				["prwo.work_phase_type", "=", "AL"],
				"or",
				"query_unproductive_started"
			],
		"query_started_test": ["query_productive_started", "or", "query_unproductive_started"],
		"query_unproductive_started": [
				["prwo.work_phase_type", "=", "ET"],
				"and",
				["prwo.json_data.subtype", "=", "AL"]
			],
		"query_wo_open": ["pro.production_order_state", "in", ["EK", "KU", "AL", "PY"]]
	},
	"set_all": [
		["prwo.work_phase_type", "=", "AL"],
		"or",
		["prwo.work_phase_type", "=", "ET"],
		"and",
		["prwo.json_data.subtype", "=", "AL"]
	]
}