{
	"name": "query/manager/product/product_work/actual/update_finished_work_phase_machine_time.json",
	"table": [
		{
			"record_type": ["actual"],
			"table": "product_work"
		}
	],
	"database": "4d",
	"parameter": {
		"previous_change_id": "",
		"start_date": "2099-01-01"
	},
	"field": [
		"prwo.json_data.start_date",
		"prwo.json_data.start_time",
		"prwo.json_data.end_date",
		"prwo.json_data.end_time",
		"prwo.resource_id",
		"prwo.json_data",
		"prwo.work_hours",
		"prwo.machine_hours",
		"prwo.setup_hours",
		"prwo.modify_id",
		"prwo.record_id"
	],
	"field_not_in_use": [
		"prwo.json_data.start_date",
		"prwo.json_data.start_time",
		"prwo.json_data.end_date",
		"prwo.json_data.end_time",
		"prwo.resource_id",
		"prwo.production_lot",
		"prwo.work_phase_number",
		"prwo.person_id",
		"prwo.json_data",
		"prwo.work_hours",
		"prwo.json_data.social_cost_multiplier",
		"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.machine_hours",
		"prwo.setup_hours",
		"prwo.modify_id",
		"prwo.record_id"
	],
	"field_to save_not_in_use": ["prwo.machine_hours", "prwo.cost_price", "prwo.sales_price"],
	"info_fi": "Toteutuneiden työvaiheiden koneajan uudelleenlaskenta",
	"query": [
		["prwo.modify_id", ">", "previous_change_id"],
		"and",
		["prwo.json_data.end_date", ">=", "start_date"],
		"and",
		["prwo.json_data.start_date", ">=", "start_date"],
		"and",
		"query_finished",
		"and",
		["res.json_data.follow_machine_data", "=", 1],
		"and",
		["res.json_data.follow_work_progression", "=", 1],
		"and",
		["res.json_data.use_automatic_receipt", "=", 0]
	],
	"set": {
		"query_finished": [
				["prwo.work_phase_type", "=", "LO"],
				"or",
				"query_unproductive_finished"
			],
		"query_unproductive_finished": [
				["prwo.work_phase_type", "=", "ET"],
				"and",
				["prwo.json_data.subtype", "=", "LT"]
			]
	}
}