{
	"name": "grid/manager/product/production_order/fi_fi/work_in_progress.json",
	"calculate": [
		{
			"field": "qry_material_self_cost_wme__unit",
			"width": 70,
			"name": "Mat. OK/kpl (var. ohj)",
			"format": [
				"%'.0f"
			]
		},
		{
			"field": "calc_material_self_cost_wme",
			"width": 70,
			"name": "cost_wme",
			"format": [
				"%'.0f"
			]
		},
		{
			"field": "self_cost_sum",
			"formula": [
				"+",
				"qry_work_self_cost_calculated",
				"qry_subcontract_self_cost_calculated",
				"calc_material_self_cost_wme",
				"qry_material_self_cost_por_calculated"
			]
		}
	],
	"null_allowed": [
		"qry_work_self_cost",
		"qry_material_self_cost_por",
		"qry_material_self_cost_wme__unit",
		"qry_subcontract_self_cost"
	],
	"subtotal": [
		"pr.product_group"
	],
	"columns_not_in_use": [
		{
			"width": 70,
			"field": "qry_material_self_cost_por",
			"format": [
				"%'.0f"
			],
			"name": "Mat. OK (til. ohj)",
			"type": "calculate"
		},
		{
			"width": 70,
			"field": "qry_material_self_cost_wme__unit",
			"format": [
				"%'.0f"
			],
			"name": "Mat. OK/kpl (var. ohj)",
			"type": "calculate"
		}
	],
	"columns": [
		{
			"width": 30,
			"subtotal": "",
			"field": "rowNumber",
			"subtotal_operator": "",
			"name": "Rivi",
			"format": [
				"%'d"
			]
		},
		{
			"field": "pro.company_id",
			"width": 80,
			"name": "Asiakas"
		},
		{
			"field": "pr.product_group",
			"width": 90,
			"name": "Tuoteryhmä"
		},
		{
			"field": "pro.drawing_number",
			"width": 125,
			"name": "Piirustusnumero"
		},
		{
			"field": "pr.name",
			"width": 220,
			"name": "Nimi"
		},
		{
			"field": "pro.production_lot",
			"width": 70,
			"name": "Valm. erä"
		},
		{
			"field": "pro.production_order_state",
			"width": 25,
			"name": "Tila"
		},
		{
			"field": "pro.json_data.creation_date",
			"width": 64,
			"name": "Luontipäivä",
			"format": [
				"d%d.%m.%Y"
			]
		},
		{
			"field": "pro.json_data.material_actual_arrival_date",
			"width": 64,
			"name": "RA tot. tulo",
			"format": [
				"d%d.%m.%Y"
			]
		},
		{
			"width": 25,
			"field": "pr.production_control_type",
			"formula": [
				"replace",
				{
					"1": "V",
					"0": "T"
				}
			],
			"style": {
				"horizontal_align": "center"
			},
			"name": "T/V"
		},
		{
			"field": "pro.started_amount",
			"width": 40,
			"name": "Al.",
			"style": {
				"horizontal_align": "center"
			}
		},
		{
			"field": "pro.produced_amount",
			"width": 40,
			"name": "Val.",
			"style": {
				"horizontal_align": "center"
			}
		},
		{
			"field": "pro.remaining_amount",
			"width": 40,
			"name": "Jäl.",
			"style": {
				"horizontal_align": "center"
			}
		},
		{
			"field": "pro.failed_amount",
			"width": 40,
			"name": "Hyl.",
			"style": {
				"horizontal_align": "center"
			}
		},
		{
			"width": 70,
			"formula": [
				"+",
				"qry_material_self_cost_por_calculated",
				"calc_material_self_cost_wme"
			],
			"field": "calc_material_self_cost",
			"name": "Mat. OK",
			"style": {
				"horizontal_align": "right"
			},
			"format": [
				"%'.0f"
			]
		},
		{
			"width": 70,
			"formula": [
				"+",
				"qry_subcontract_self_cost_calculated"
			],
			"field": "calc_subcontract_self_cost",
			"name": "Alih. OK",
			"style": {
				"horizontal_align": "right"
			},
			"format": [
				"%'.0f"
			]
		},
		{
			"width": 70,
			"format": [
				"%'.0f"
			],
			"field": "calc_work_self_cost",
			"name": "Työ. OK",
			"style": {
				"horizontal_align": "right"
			},
			"formula": [
				"+",
				"qry_work_self_cost_calculated"
			]
		},
		{
			"width": 45,
			"formula": [
				"*",
				"self_cost_sum",
				"reduced_self_cost_multiplier",
				"-1"
			],
			"field": "reduced_self_cost",
			"name": "Väh.",
			"style": {
				"horizontal_align": "right"
			},
			"format": [
				"%'.0f"
			]
		},
		{
			"width": 67,
			"formula": [
				"*",
				"self_cost_sum",
				"self_cost_multiplier"
			],
			"field": "calc_self_cost",
			"name": "OK yht.",
			"style": {
				"horizontal_align": "right"
			},
			"format": [
				"%'.0f"
			]
		},
		{
			"width": 67,
			"formula": [
				"*",
				"pro.remaining_amount",
				"pro.json_data.sales_price__unit"
			],
			"field": "calc_sales_price",
			"name": "MH",
			"style": {
				"horizontal_align": "right"
			},
			"format": [
				"%'.0f"
			]
		},
		{
			"width": 45,
			"formula": [
				[
					"/",
					"calc_self_cost",
					"calc_sales_price"
				],
				[
					"*",
					"100"
				]
			],
			"field": "calc_profit_percent",
			"name": "%",
			"style": {
				"horizontal_align": "right"
			},
			"format": [
				"%.f%%"
			]
		}
	]
}