{
	"name": "form/manager/project-material/query/sales_project_material.json",
	"table": [
		{
			"record_type": ["sales"],
			"table": "order"
		},
		{
			"record_type": ["sales"],
			"table": "order_row"
		},
		{
			"record_type": ["product"],
			"table": "product"
		}
	],
	"database": "4d",
	"parameter": {
		"finished_state": ["LO", "PE"],
		"project": "",
		"order_type": "TI",
		"remove_empty_aggregate_row": true,
		"show_sql": true
	},
	"field": [
		"ordr.product_id",
		"ordr.waiting_for_delivery",
		"ordr.order_amount",
		"pr.work_number",
		"pr.product_type",
		"pr.stock_unit",
		"pr.name",
		"pr.stock_balance",
		"pr.minimum_order_amount",
		"pr.default_supplier_id",
		"pr.storable",
		"pr.json_data.free_amount",
		"pr.json_data.coming_amount",
		"pr.json_data.going_amount"
	],
	"aggregate": {
		"sum": ["ordr.waiting_for_delivery", "ordr.order_amount"]
	},
	"link_example": {
		"order_row - order": {
			"linked_field": "pr.product_id",
			"linking_field": "ordr.product_id"
		},
		"order_row - product": {
			"linked_field": "pr.product_id",
			"linking_field": "ordr.product_id"
		}
	},
	"query": [
		["ordr.delivery_state", "=", ""],
		"and",
		["ord.project_id", "=", "project"],
		"and",
		["ord.order_state", "not in", "finished_state"],
		"and",
		["ord.order_type", "=", "order_type"]
	]
}
