{
	"name": "table/manager/order/order.json",
	"table_name": "order",
	"table_prefix": "ord",
	"record_type": ["accounts_payable", "dispatch_note", "invoice", "purchase", "sales", "production"],
	"default_order": [
		{
			"field": "order_id",
			"order": ">"
		}
	],
	"save_script": [],
	"calculated_field": {
		"json_data.discount_price": {
			"code": [["ord.json_data.discount_price", "=", ["rowSum", ["ordr_discount_price"]]]],
			"type": "double"
		},
		"json_data.paid_price": {
			"code": [["ord.json_data.paid_price", "=", ["rowSum", ["invp_paid_price"]]]],
			"type": "double"
		},
		"json_data.payment_discount_price": {
			"code": [["ord.json_data.payment_discount_price", "=", ["rowSum", ["invp_discount_price"]]]],
			"type": "double"
		},
		"price_with_vat": {
			"code": [
				[
					"ord_price_with_vat",
					"=",
					["ord_price_without_vat", "+", "ord_vat_price", "+", "ord.json_data.rounding_price"]
				]
			],
			"type": "double"
		},
		"price_without_vat": {
			"code": [["ord_price_without_vat", "=", ["rowSum", ["ordr_price_without_vat"]]]],
			"type": "double"
		},
		"vat_price": {
			"code": [["ord_vat_price", "=", ["rowSum", ["ordr_vat_price"]]]],
			"type": "double"
		}
	},
	"field": [
		{
			"field_length": 40,
			"field_name": "company_id",
			"foreign_key": [
				{
					"link_type": "prevent delete",
					"linked_field": "company_id",
					"linked_record_type": "customer",
					"linked_table": "company",
					"linking_record_type": "sales"
				},
				{
					"link_type": "prevent delete",
					"linked_field": "company_id",
					"linked_record_type": "supplier",
					"linked_table": "company",
					"linking_record_type": "purchase"
				},
				{
					"link_type": "prevent delete",
					"linked_field": "company_id",
					"linked_record_type": "supplier",
					"linked_table": "company",
					"linking_record_type": "accounts_payable"
				}
			],
			"not_allowed_value": [""]
		},
		{
			"field_length": 80,
			"field_name": "company_reference_number"
		},
		{
			"field_name": "confirmation_date",
			"field_type": "date"
		},
		{
			"field_length": 20,
			"field_name": "currency_id",
			"foreign_key": [
				{
					"link_type": "prevent delete",
					"linked_field": "currency_id",
					"linked_record_type": "",
					"linked_table": "currency",
					"linking_record_type": ""
				}
			],
			"not_allowed_value": [""]
		},
		{
			"field_name": "delivery_address",
			"field_type": "text"
		},
		{
			"field_length": 40,
			"field_name": "delivery_company_id",
			"foreign_key": [
				{
					"link_type": "prevent delete",
					"linked_field": "company_id",
					"linked_record_type": "",
					"linked_table": "company",
					"linking_record_type": "dispatch_note"
				}
			],
			"record_tag": "co_deliv"
		},
		{
			"field_name": "discount_price",
			"field_type": "double"
		},
		{
			"field_name": "due_date",
			"field_type": "date"
		},
		{
			"field_name": "exchange_rate",
			"field_type": "double"
		},
		{
			"field_name": "info",
			"field_type": "text"
		},
		{
			"field_name": "invoicing_address",
			"field_type": "text"
		},
		{
			"field_length": 40,
			"field_name": "invoicing_company_id",
			"foreign_key": [
				{
					"link_type": "prevent delete",
					"linked_field": "company_id",
					"linked_record_type": "",
					"linked_table": "company",
					"linking_record_type": "invoice"
				}
			],
			"record_tag": "co_inv"
		},
		{
			"field_name": "local_price_without_vat",
			"field_type": "double"
		},
		{
			"field_name": "note",
			"field_type": "text"
		},
		{
			"field_name": "order_address",
			"field_type": "text"
		},
		{
			"field_name": "order_date",
			"field_type": "date"
		},
		{
			"constraint": ["primary key", "unique"],
			"field_length": 40,
			"field_name": "order_id",
			"not_allowed_value": [""],
			"writeable": false
		},
		{
			"field_length": 20,
			"field_name": "order_state",
			"value_array": "order_state_array.json"
		},
		{
			"field_length": 20,
			"field_name": "order_type",
			"not_allowed_value": [""],
			"value_array": "order_type_array.json"
		},
		{
			"field_length": 40,
			"field_name": "our_reference"
		},
		{
			"field_length": 40,
			"field_name": "person_id",
			"foreign_key": [
				{
					"link_type": "prevent delete",
					"linked_field": "person_id",
					"linked_record_type": "",
					"linked_table": "person",
					"linking_record_type": ""
				}
			],
			"not_allowed_value": [""]
		},
		{
			"field_name": "price_with_vat",
			"field_type": "double"
		},
		{
			"field_name": "price_without_vat",
			"field_type": "double"
		},
		{
			"field_length": 80,
			"field_name": "project_id",
			"field_type": "varchar"
		},
		{
			"allowed_value": ["sales", "purchase", "invoice", "dispatch_note", "accounts_payable"],
			"field_length": 20,
			"field_name": "record_type"
		},
		{
			"field_length": 120,
			"field_name": "term_of_delivery"
		},
		{
			"field_length": 40,
			"field_name": "terms_of_payment_id",
			"foreign_key": [
				{
					"link_type": "prevent delete",
					"linked_field": "terms_of_payment_id",
					"linked_record_type": "",
					"linked_table": "terms_of_payment",
					"linking_record_type": ""
				}
			],
			"not_allowed_value": [""]
		},
		{
			"field_name": "vat_price",
			"field_type": "double"
		},
		{
			"field_length": 20,
			"field_name": "voucher_id",
			"foreign_key": [
				{
					"link_type": "prevent delete",
					"linked_field": "voucher_id",
					"linked_record_type": "",
					"linked_table": "bookkeeping_voucher",
					"linking_record_type": ""
				}
			]
		},
		{
			"field_length": 120,
			"field_name": "way_of_delivery"
		},
		{
			"field_length": 40,
			"field_name": "your_reference"
		}
	],
	"default_field": "table/default_field.json",
	"default_value": {
		"static": {
			"order_state": "open",
			"order_type": "order"
		},
		"tag": {
			"delivery_company_id": "company_id",
			"invoicing_company_id": "company_id"
		}
	},
	"extra_field": [
		{
			"field_name": "json_data.moloni.document_set_id",
			"field_type": "integer"
		},
		{
			"field_name": "json_data.company_name",
			"field_type": "varchar"
		},
		{
			"field_name": "json_data.invoicing_address",
			"field_type": "json"
		},
		{
			"field_name": "json_data.transfer_id",
			"field_type": "integer"
		},
		{
			"field_length": 60,
			"field_name": "json_data.accounts_ledger"
		},
		{
			"field_length": 4,
			"field_name": "json_data.approval_state"
		},
		{
			"field_name": "json_data.cash_discount_due_date"
		},
		{
			"field_length": 80,
			"field_name": "json_data.customer_project"
		},
		{
			"field_name": "json_data.debet_total"
		},
		{
			"field_name": "json_data.destination_date"
		},
		{
			"field_name": "json_data.firm_id"
		},
		{
			"field_name": "json_data.kredit_total"
		},
		{
			"field_length": 50,
			"field_name": "json_data.method_of_payment"
		},
		{
			"field_length": 40,
			"field_name": "json_data.modifier_id"
		},
		{
			"field_name": "json_data.no_bank_program"
		},
		{
			"field_length": 30,
			"field_name": "json_data.note_type"
		},
		{
			"field_name": "json_data.payable_amount"
		},
		{
			"field_name": "json_data.payment_date"
		},
		{
			"field_name": "json_data.priority"
		},
		{
			"field_length": 80,
			"field_name": "json_data.project_id"
		},
		{
			"field_length": 24,
			"field_name": "json_data.purchase_debt_account_id"
		},
		{
			"field_length": 160,
			"field_name": "json_data.purchase_order_id"
		},
		{
			"field_length": 80,
			"field_name": "json_data.bank_account"
		},
		{
			"field_length": 160,
			"field_name": "json_data.bank_reference_number"
		},
		{
			"field_name": "json_data.paid_price"
		},
		{
			"field_length": 80,
			"field_name": "json_data.intermediator"
		},
		{
			"field_length": 120,
			"field_name": "json_data.transfer_id"
		},
		{
			"field_name": "json_data.transfer_state"
		},
		{
			"field_name": "json_data.description_of_the_goods"
		},
		{
			"field_length": 60,
			"field_name": "json_data.eur_number"
		},
		{
			"field_name": "json_data.firm_id"
		},
		{
			"field_name": "json_data.freight_charges"
		},
		{
			"field_length": 160,
			"field_name": "json_data.freight_charges_payer"
		},
		{
			"field_name": "json_data.gross_weight"
		},
		{
			"field_length": 160,
			"field_name": "json_data.mark"
		},
		{
			"field_length": 40,
			"field_name": "json_data.modifier_id"
		},
		{
			"field_name": "json_data.net_weight",
			"field_type": "double"
		},
		{
			"field_name": "json_data.number_of_pallets"
		},
		{
			"field_name": "json_data.printed"
		},
		{
			"field_length": 20,
			"field_name": "json_data.pro_forma_number"
		},
		{
			"field_length": 120,
			"field_name": "json_data.transfer_id"
		},
		{
			"field_name": "json_data.transfer_state"
		},
		{
			"field_name": "json_data.volume"
		},
		{
			"field_length": 40,
			"field_name": "json_data.waybill_id"
		},
		{
			"field_name": "json_data.cash_discount_due_date",
			"field_type": "date"
		},
		{
			"field_length": 20,
			"field_name": "json_data.collection_invoice_id"
		},
		{
			"field_name": "json_data.collection_started"
		},
		{
			"field_name": "json_data.coming_price"
		},
		{
			"field_length": 20,
			"field_name": "json_data.credit_note"
		},
		{
			"field_length": 80,
			"field_name": "json_data.customer_project"
		},
		{
			"field_name": "json_data.description_of_the_goods"
		},
		{
			"field_name": "json_data.destination_date",
			"field_type": "date"
		},
		{
			"field_name": "json_data.discount_percentage"
		},
		{
			"field_name": "json_data.payment_discount_price"
		},
		{
			"field_length": 12,
			"field_name": "json_data.divided"
		},
		{
			"field_length": 80,
			"field_name": "json_data.eur_1_no"
		},
		{
			"field_name": "json_data.exported_to_ar"
		},
		{
			"field_name": "json_data.firm_id"
		},
		{
			"field_name": "json_data.footnote"
		},
		{
			"field_name": "json_data.gross_weight"
		},
		{
			"field_length": 24,
			"field_name": "json_data.handler_id"
		},
		{
			"field_name": "json_data.last_collection_date",
			"field_type": "date"
		},
		{
			"field_length": 160,
			"field_name": "json_data.mark"
		},
		{
			"field_length": 40,
			"field_name": "json_data.modifier_id"
		},
		{
			"field_name": "json_data.net_weight",
			"field_type": "double"
		},
		{
			"field_name": "json_data.order_discount_percentage"
		},
		{
			"field_name": "json_data.order_discount_total"
		},
		{
			"field_name": "json_data.paid_price",
			"field_type": "double"
		},
		{
			"field_name": "json_data.penalty_interest_percent",
			"field_type": "double"
		},
		{
			"field_name": "json_data.printed"
		},
		{
			"field_length": 80,
			"field_name": "json_data.project_id"
		},
		{
			"field_length": 40,
			"field_name": "json_data.bank_reference_number"
		},
		{
			"field_length": 70,
			"field_name": "json_data.remark_time"
		},
		{
			"field_length": 80,
			"field_name": "json_data.send_state"
		},
		{
			"field_length": 80,
			"field_name": "json_data.send_type"
		},
		{
			"field_name": "json_data.supplier_invoice_date",
			"field_type": "date"
		},
		{
			"field_length": 80,
			"field_name": "json_data.supplier_invoice_number"
		},
		{
			"field_name": "json_data.rounding_price"
		},
		{
			"field_length": 120,
			"field_name": "json_data.transfer_id"
		},
		{
			"field_name": "json_data.transfer_state"
		},
		{
			"field_name": "json_data.volume"
		},
		{
			"field_length": 160,
			"field_name": "json_data.cost_center"
		},
		{
			"field_length": 80,
			"field_name": "json_data.customer_project"
		},
		{
			"field_name": "json_data.delivery_to_customer"
		},
		{
			"field_name": "json_data.firm_id"
		},
		{
			"field_name": "json_data.first_delivery_date"
		},
		{
			"field_name": "json_data.freight_charges"
		},
		{
			"field_name": "json_data.invoicing_address"
		},
		{
			"field_name": "json_data.invoicing_state"
		},
		{
			"field_length": 160,
			"field_name": "json_data.mark"
		},
		{
			"field_length": 40,
			"field_name": "json_data.modifier_id"
		},
		{
			"field_length": 24,
			"field_name": "json_data.receiver_id"
		},
		{
			"field_name": "json_data.shipping_date"
		},
		{
			"field_length": 24,
			"field_name": "json_data.supplier_id"
		},
		{
			"field_length": 120,
			"field_name": "json_data.transfer_id"
		},
		{
			"field_name": "json_data.transfer_state"
		},
		{
			"field_length": 40,
			"field_name": "json_data.waybill_id"
		},
		{
			"field_name": "json_data.add_packing_cost",
			"field_type": "integer"
		},
		{
			"field_name": "json_data.add_packing_material",
			"field_type": "integer"
		},
		{
			"field_name": "json_data.delivery_address",
			"field_type": "text"
		},
		{
			"field_name": "json_data.invoicing_address",
			"field_type": "text"
		},
		{
			"field_name": "json_data.collection_invoice",
			"field_type": "boolean"
		},
		{
			"field_name": "json_data.cost_center",
			"field_type": "varchar"
		},
		{
			"field_name": "json_data.cost_price",
			"field_type": "double"
		},
		{
			"field_name": "json_data.country_of_destination",
			"field_type": "varchar"
		},
		{
			"field_name": "json_data.country_of_origin",
			"field_type": "varchar"
		},
		{
			"field_name": "json_data.covenant",
			"field_type": "varchar"
		},
		{
			"field_name": "json_data.customer_project",
			"field_type": "varchar"
		},
		{
			"field_name": "json_data.dealer_address",
			"field_type": "text"
		},
		{
			"field_name": "json_data.dealer_company_id",
			"field_type": "varchar"
		},
		{
			"field_name": "json_data.description_of_the_goods",
			"field_type": "text"
		},
		{
			"field_name": "json_data.destination",
			"field_type": "varchar"
		},
		{
			"field_name": "json_data.discharge_place",
			"field_type": "varchar"
		},
		{
			"field_name": "json_data.eur_number",
			"field_type": "varchar"
		},
		{
			"field_name": "json_data.euro_rate",
			"field_type": "double"
		},
		{
			"field_name": "json_data.firm_id",
			"field_type": "integer"
		},
		{
			"field_name": "json_data.first_delivery_date",
			"field_type": "date"
		},
		{
			"field_name": "json_data.freight_charges_payer",
			"field_type": "varchar"
		},
		{
			"field_name": "json_data.gross_weight",
			"field_type": "double"
		},
		{
			"field_name": "json_data.mark",
			"field_type": "varchar"
		},
		{
			"field_name": "json_data.material_cost",
			"field_type": "double"
		},
		{
			"field_name": "json_data.material_margin",
			"field_type": "double"
		},
		{
			"field_name": "json_data.material_margin_percentage",
			"field_type": "double"
		},
		{
			"field_name": "json_data.modifier_id",
			"field_type": "varchar"
		},
		{
			"field_name": "json_data.net_weight",
			"field_type": "double"
		},
		{
			"field_name": "json_data.number_of_pallets",
			"field_type": "integer"
		},
		{
			"field_name": "json_data.offer_number",
			"field_type": "varchar"
		},
		{
			"field_name": "json_data.order_discount",
			"field_type": "double"
		},
		{
			"field_name": "json_data.order_discount_percentage",
			"field_type": "double"
		},
		{
			"field_name": "json_data.packing_info",
			"field_type": "text"
		},
		{
			"field_name": "json_data.packing_state",
			"field_type": "integer"
		},
		{
			"field_name": "json_data.place_of_departure",
			"field_type": "varchar"
		},
		{
			"field_name": "json_data.postcalc_date",
			"field_type": "date"
		},
		{
			"field_name": "json_data.precarriage",
			"field_type": "varchar"
		},
		{
			"field_name": "json_data.row_discount_percentage",
			"field_type": "double"
		},
		{
			"field_name": "json_data.sales_margin",
			"field_type": "double"
		},
		{
			"field_name": "json_data.sales_margin_percentage",
			"field_type": "double"
		},
		{
			"field_name": "json_data.sales_price_wo_discount",
			"field_type": "double"
		},
		{
			"field_name": "json_data.sales_probability",
			"field_type": "double"
		},
		{
			"field_name": "json_data.supplier_id",
			"field_type": "varchar"
		},
		{
			"field_name": "json_data.supplier_invoicing_date",
			"field_type": "date"
		},
		{
			"field_name": "json_data.supplier_invoice_number",
			"field_type": "varchar"
		},
		{
			"field_name": "json_data.tariff_heading",
			"field_type": "varchar"
		},
		{
			"field_name": "json_data.transfer_id",
			"field_type": "varchar"
		},
		{
			"field_name": "json_data.transfer_state",
			"field_type": "integer"
		},
		{
			"field_name": "json_data.volume",
			"field_type": "double"
		},
		{
			"field_name": "json_data.your_reference_of_delivery",
			"field_type": "varchar"
		},
		{
			"field_name": "json_data.your_reference_of_invoice",
			"field_type": "varchar"
		},
		{
			"field_name": "json_data.moloni.expiration_date",
			"field_type": "date"
		}
	]
}
