{
	"name": "table/local/order/order_code.json",
	"table_name": "order_code",
	"table_prefix": "ordc",
	"main_table": "order",
	"record_type": ["purchase", "sales", "sales_account"],
	"table_name_language": {
		"purchase": "Purchase order code",
		"sales": "Sales order code",
		"sales_account": "Sales order code account"
	},
	"default_field": "table/prf/default_field.json",
	"default_order": [
		{
			"field": "order_code_id",
			"order": ">"
		}
	],
	"save_script": [],
	"calculated_field": [],
	"field": [
		{
			"field_name": "order_code_id",
			"field_type": "varchar",
			"field_length": 40,
			"constraint": ["index"],
			"not_allowed_value": [""]
		},
		{
			"field_name": "account_id",
			"field_type": "varchar",
			"field_length": 20,
			"foreign_key": [
				{
					"link_type": "prevent delete",
					"linked_field": "account_id",
					"linked_record_type": "",
					"linked_table": "bookkeeping_account",
					"linking_record_type": ""
				}
			],
			"not_allowed_value": [""]
		},
		{
			"field_name": "info",
			"field_type": "text"
		},
		{
			"field_name": "name",
			"field_type": "varchar",
			"field_length": 80
		},
		{
			"field_name": "vat_percent",
			"field_type": "double"
		}
	],
	"extra_field": [
		{
			"field_name": "json_data.transfer_id",
			"field_type": "varchar",
			"field_length": 120
		},
		{
			"field_name": "json_data.target",
			"field_type": "varchar",
			"field_length": 12
		},
		{
			"field_name": "json_data.customer_project",
			"field_type": "varchar",
			"field_length": 80
		},
		{
			"field_name": "json_data.transfer_state",
			"field_type": "integer"
		},
		{
			"field_name": "json_data.commission__unit",
			"field_type": "double"
		},
		{
			"field_name": "json_data.marketing_support__unit",
			"field_type": "double"
		},
		{
			"field_name": "json_data.new_code_id",
			"field_type": "varchar",
			"field_length": 40
		},
		{
			"field_name": "json_data.export_code",
			"field_type": "varchar",
			"field_length": 40
		},
		{
			"field_name": "json_data.vat_code",
			"field_type": "varchar",
			"field_length": 40
		},
		{
			"field_name": "json_data.firm_id",
			"field_type": "integer"
		},
		{
			"field_name": "json_data.cost_center",
			"field_type": "varchar",
			"field_length": 160
		},
		{
			"field_name": "json_data.project_id",
			"field_type": "varchar",
			"field_length": 80
		},
		{
			"field_name": "json_data.target_group",
			"field_type": "varchar",
			"field_length": 24
		},
		{
			"field_name": "json_data.commission_percent",
			"field_type": "double"
		},
		{
			"field_name": "json_data.discount_account_id",
			"field_type": "varchar",
			"field_length": 24
		},
		{
			"field_name": "json_data.marketing_support_percent",
			"field_type": "double"
		},
		{
			"field_name": "json_data.ar_account_id",
			"field_type": "varchar",
			"field_length": 24
		},
		{
			"field_name": "json_data.new_code_date",
			"field_type": "date"
		},
		{
			"field_name": "json_data.order_code_account.account_id",
			"field_type": "varchar",
			"field_length": 24
		},
		{
			"field_name": "json_data.order_code_account.change_id",
			"field_type": "varchar",
			"field_length": 90
		},
		{
			"field_name": "json_data.order_code_account.creator_id",
			"field_type": "varchar",
			"field_length": 40
		},
		{
			"field_name": "json_data.order_code_account.customer_project",
			"field_type": "varchar",
			"field_length": 80
		},
		{
			"field_name": "json_data.order_code_account.discount_type",
			"field_type": "varchar",
			"field_length": 4
		},
		{
			"field_name": "json_data.order_code_account.firm_id",
			"field_type": "integer"
		},
		{
			"field_name": "json_data.order_code_account.info",
			"field_type": "text"
		},
		{
			"field_name": "json_data.order_code_account.modifier_id",
			"field_type": "varchar",
			"field_length": 40
		},
		{
			"field_name": "json_data.order_code_account.project_id",
			"field_type": "varchar",
			"field_length": 80
		},
		{
			"field_name": "json_data.order_code_account.transfer_id",
			"field_type": "varchar",
			"field_length": 120
		},
		{
			"field_name": "json_data.order_code_account.transfer_state",
			"field_type": "integer"
		},
		{
			"field_name": "json_data.order_code_account.record_id",
			"field_length": 90
		},
		{
			"field_name": "json_data.order_code_account.order_code_id",
			"field_length": 12
		}
	],
	"row_table": [
		{
			"field": [
				{
					"name": "account_id",
					"type": "varchar",
					"field_length": 20,
					"foreign_key": {
						"table": "bookkeeping_account",
						"field": "account_id",
						"link_type": "prevent delete"
					}
				},
				{
					"name": "discount_type",
					"type": "varchar",
					"field_length": 20
				},
				{
					"name": "info",
					"type": "text"
				}
			],
			"row_table_name": "discount_account",
			"save_field": "ordc.json_data"
		}
	]
}
