{
	"save_script": [],
	"field": [
		{
			"type": "varchar",
			"length": 40,
			"name": "order_code_id",
			"constraint": [
				"primary key",
				"unique"
			]
		},
		{
			"type": "varchar",
			"length": 80,
			"name": "name"
		},
		{
			"type": "varchar",
			"length": 20,
			"name": "account_id",
			"foreign_key": {
				"field": "account_id",
				"link_type": "prevent delete",
				"table": "bookkeeping_account"
			}
		},
		{
			"name": "vat_percent",
			"type": "double"
		},
		{
			"name": "info",
			"type": "text"
		},
		{
			"name": "json_data",
			"type": "jsonb"
		}
	],
	"constraint": {
		"save": {
			"allow": [
				{
					"field": "ordc_order_code_id",
					"message": "Field '%s' may not be empty",
					"code": [
						[
							"order_code_id",
							"<>",
							""
						]
					]
				},
				{
					"field": "ordc_account_id",
					"message": "Field '%s' may not be empty",
					"code": [
						[
							"ordc_account_id",
							"<>",
							""
						]
					]
				},
				{
					"field": "ordc_json_data.discount_account.account_id",
					"message": "Field '%s' may not be empty",
					"code": [
						[
							"ordc_json_data.discount_account.account_id",
							"<>",
							""
						]
					]
				}
			]
		}
	},
	"table_prefix": "ordc",
	"extra_field": [
		{
			"type": "varchar",
			"length": 160,
			"name": "json_data.cost_center"
		},
		{
			"type": "varchar",
			"length": 80,
			"name": "json_data.customer_project"
		},
		{
			"type": "varchar",
			"length": 40,
			"name": "json_data.export_code"
		},
		{
			"type": "integer",
			"name": "json_data.firm_id"
		},
		{
			"type": "varchar",
			"length": 40,
			"name": "json_data.modifier_id"
		},
		{
			"type": "date",
			"name": "json_data.new_code_date"
		},
		{
			"type": "varchar",
			"length": 40,
			"name": "json_data.new_code_id"
		},
		{
			"type": "varchar",
			"length": 80,
			"name": "json_data.project_id"
		},
		{
			"type": "varchar",
			"length": 10,
			"name": "json_data.target"
		},
		{
			"type": "varchar",
			"length": 24,
			"name": "json_data.target_group"
		},
		{
			"type": "varchar",
			"length": 120,
			"name": "json_data.transfer_id"
		},
		{
			"type": "integer",
			"name": "json_data.transfer_state"
		},
		{
			"type": "varchar",
			"length": 24,
			"name": "json_data.ar_account_id"
		},
		{
			"type": "double",
			"name": "json_data.commission__unit"
		},
		{
			"type": "double",
			"name": "json_data.commission_percent"
		},
		{
			"type": "varchar",
			"length": 24,
			"name": "json_data.discount_account_id"
		},
		{
			"type": "double",
			"name": "json_data.marketing_support__unit"
		},
		{
			"type": "double",
			"name": "json_data.marketing_support_percent"
		},
		{
			"type": "varchar",
			"length": 40,
			"name": "json_data.vat_code"
		}
	],
	"calculated_field": [],
	"table_name": "order_code",
	"name": "/structure_ma/ordc.json",
	"row_table": [
		{
			"row_table_name": "discount_account",
			"save_field": "ordc_json_data",
			"field": [
				{
					"type": "varchar",
					"length": 20,
					"name": "account_id",
					"foreign_key": {
						"field": "account_id",
						"link_type": "prevent delete",
						"table": "bookkeeping_account"
					}
				},
				{
					"type": "varchar",
					"length": 20,
					"name": "discount_type"
				},
				{
					"name": "info",
					"type": "text"
				}
			]
		}
	]
}