{
	"name": "table/external/moloni/order/purchase_order.json",
	"table_name": "order",
	"table_prefix": "ord",
	"record_type": ["purchase"],
	"local_table": "order",
	"local_record_type": "purchase",
	"default_field": "table/default_field.json",
	"field": [
		{
			"field_name": "number",
			"field_type": "integer",
			"local_field": "order_id",
			"writeable": false
		},
		{
			"field_name": "document_id",
			"field_type": "varchar",
			"local_field": "project_id",
			"info": "only placeholder, will be overridden in erp-sync",
			"writeable": false
		},
		{
			"field_name": "entity_name",
			"field_type": "varchar",
			"local_field": "json_data.company_name"
		},
		{
			"field_name": "billing",
			"field_type": "json",
			"local_field": "json_data.invoicing_address"
		},
		{
			"field_name": "currency",
			"field_type": "varchar",
			"local_field": "currency_id"
		},
		{
			"field_name": "supplier_id",
			"field_type": "integer",
			"local_field": "company_id"
		},
		{
			"field_name": "status",
			"field_type": "varchar",
			"local_field": "order_state",
			"local_field2": "json_data.moloni.status"
		},
		{
			"field_name": "date",
			"field_type": "date",
			"local_field": "order_date"
		},
		{
			"field_name": "expiration_date",
			"field_type": "date",
			"local_field": "json_data.moloni.expiration_date"
		},
		{
			"field_name": "lastmodified",
			"field_type": "date",
			"local_field": "modify_time"
		},
		{
			"info": "Grand total",
			"field_name": "gross_value",
			"field_type": "double",
			"local_field": "price_without_vat"
		},
		{
			"info": "Sum of all taxes",
			"field_name": "taxes_value",
			"field_type": "double",
			"local_field": "vat_price"
		},
		{
			"field_name": "maturity_date_name",
			"field_type": "varchar",
			"local_field": "terms_of_payment_id"
		},
		{
			"field_name": "our_reference",
			"field_type": "text",
			"local_field": "our_reference"
		},
		{
			"field_name": "your_reference",
			"field_type": "text",
			"local_field": "your_reference"
		},
		{
			"field_name": "document_set_name",
			"field_type": "text",
			"local_field": "info",
			"writeable": false
		},
		{
			"field_name": "document_set_id",
			"field_type": "integer",
			"local_field": "json_data.moloni.document_set_id"
		}
	],
	"field_not_in_use": [
		{
			"field_name": "doc_unico",
			"field_type": "varchar",
			"local_field": "record_id",
			"writeable": false
		}
	],
	"example_data": {
		"lastmodifiedby": "Mikko",
		"lastmodifiedby_id": 134253,
		"lastmodified": "2019-09-13T11:06:18+0100",
		"set_from_api": 0,
		"plugin_id": 0,
		"doc_unico": "7:153703:1:0",
		"terminal_id": 0,
		"cash_vat_scheme_indicator": 0,
		"rsa_hash": "",
		"hash_control": 0,
		"timezone_id": 0,
		"document_id": 261328399,
		"company_id": 86546,
		"document_type_id": 7,
		"customer_id": 0,
		"supplier_id": 644095,
		"salesman_id": 0,
		"document_set_id": 153703,
		"document_set_name": "portugal2019",
		"number": 1,
		"date": "2019-09-13T00:00:00+0100",
		"expiration_date": "2019-10-13T00:00:00+0100",
		"year": 2019,
		"maturity_date_days": null,
		"maturity_date_id": 507393,
		"maturity_date_name": "30 Dias",
		"your_reference": "testing",
		"our_reference": "test purchase",
		"entity_number": "1",
		"entity_name": "VA-VARUSTE POLAND Sp. z o.o.",
		"entity_vat": "PL5213645628",
		"entity_address": "ul. Turkusowa 10",
		"entity_city": "Suwalki",
		"entity_zip_code": "16-400",
		"entity_country": "Poland",
		"entity_country_id": 168,
		"cash_vat_scheme_entity": 0,
		"alternate_address_id": 0,
		"attached_file": "",
		"notes": "",
		"salesman_commission": 0,
		"deduction_id": 0,
		"deduction_percentage": 0,
		"deduction_name": "",
		"special_discount": 0,
		"financial_discount": 0,
		"gross_value": 404.9,
		"comercial_discount_value": 0,
		"financial_discount_value": 0,
		"taxes_value": 0,
		"deduction_value": 0,
		"net_value": 404.9,
		"reconciled_value": 0,
		"eac_id": 0,
		"eac_code": "",
		"delivery_method_id": 551333,
		"delivery_method_name": "",
		"vehicle_id": 0,
		"vehicle_name": "",
		"vehicle_number_plate": "",
		"delivery_datetime": "2019-09-13T13:07:00+0100",
		"delivery_departure_address": "",
		"delivery_departure_city": "",
		"delivery_departure_zip_code": "",
		"delivery_departure_country": 0,
		"delivery_destination_address": "",
		"delivery_destination_city": "",
		"delivery_destination_zip_code": "",
		"delivery_destination_country": 0,
		"related_documents_notes": "",
		"status": 1,
		"transport_code": "",
		"transport_code_set_by": 0,
		"global_guide": 0,
		"generate_mb_reference": 0,
		"exchange_currency_id": 0,
		"exchange_total_value": 0,
		"exchange_rate": 0,
		"document_type": {
			"document_type_id": 7,
			"saft_code": "NEF"
		},
		"document_set": {
			"document_set_id": 153703,
			"name": "portugal2019"
		},
		"products": [
			{
				"ean": "2211619",
				"origin_id": 0,
				"order": 1,
				"product_id": 29878027,
				"category_id": 1179257,
				"reference": "TU_VEISMIQSFL",
				"name": "BOAT SEAT MINI QUICKSILVER 2211619",
				"summary": "",
				"price": 113.101,
				"price_class_id": 0,
				"unit_id": 647438,
				"unit_name": "Unidade",
				"unit_short_name": "Uni.",
				"discount": 0,
				"qty": 1,
				"exemption_reason": "M20",
				"deduction_id": 0,
				"deduction": 0,
				"deduction_name": "",
				"properties": "",
				"is_related": 0,
				"supplier": {
					"supplier_id": 644095,
					"number": "1",
					"name": "VA-VARUSTE POLAND Sp. z o.o.",
					"vat": "PL5213645628"
				},
				"taxes": []
			},
			{
				"ean": "",
				"origin_id": 0,
				"order": 2,
				"product_id": 29878032,
				"category_id": 1179257,
				"reference": "TU_VEISMIQSFLVAVA",
				"name": "BOAT SEAT MINI QUICKSILVER WHT CAP VAVA 2284421",
				"summary": "",
				"price": 131.8,
				"price_class_id": 0,
				"unit_id": 647438,
				"unit_name": "Unidade",
				"unit_short_name": "Uni.",
				"discount": 0,
				"qty": 1,
				"exemption_reason": "M20",
				"deduction_id": 0,
				"deduction": 0,
				"deduction_name": "",
				"properties": "",
				"is_related": 0,
				"supplier": {
					"supplier_id": 644095,
					"number": "1",
					"name": "VA-VARUSTE POLAND Sp. z o.o.",
					"vat": "PL5213645628"
				},
				"taxes": []
			},
			{
				"ean": "",
				"origin_id": 0,
				"order": 3,
				"product_id": 29878017,
				"category_id": 1179257,
				"reference": "TU_BRJOSEQTAUOT",
				"name": "Quicksilver seat INT2286829C /base John seat 2",
				"summary": "",
				"price": 160,
				"price_class_id": 0,
				"unit_id": 647438,
				"unit_name": "Unidade",
				"unit_short_name": "Uni.",
				"discount": 0,
				"qty": 1,
				"exemption_reason": "M20",
				"deduction_id": 0,
				"deduction": 0,
				"deduction_name": "",
				"properties": "",
				"is_related": 0,
				"supplier": {
					"supplier_id": 644095,
					"number": "1",
					"name": "VA-VARUSTE POLAND Sp. z o.o.",
					"vat": "PL5213645628"
				},
				"taxes": []
			}
		],
		"associated_documents": [],
		"reverse_associated_documents": [],
		"mb_references": [],
		"payments": []
	},
	"example_data_all": {
		"terminal_id": 0,
		"lastmodified": "2019-09-13T11:06:18+0100",
		"document_id": 261328399,
		"document_type_id": 7,
		"customer_id": 0,
		"supplier_id": 644095,
		"salesman_id": 0,
		"document_set_id": 153703,
		"document_set_name": "portugal2019",
		"number": 1,
		"date": "2019-09-13T00:00:00+0100",
		"expiration_date": "2019-10-13T00:00:00+0100",
		"maturity_date_days": null,
		"maturity_date_id": 507393,
		"maturity_date_name": "30 Dias",
		"your_reference": "testing",
		"our_reference": "test purchase",
		"entity_number": "1",
		"entity_name": "VA-VARUSTE POLAND Sp. z o.o.",
		"entity_vat": "PL5213645628",
		"entity_address": "ul. Turkusowa 10",
		"gross_value": 404.9,
		"comercial_discount_value": 0,
		"financial_discount_value": 0,
		"taxes_value": 0,
		"deduction_value": 0,
		"net_value": 404.9,
		"reconciled_value": 0,
		"status": 1,
		"transport_code": "",
		"transport_code_set_by": 0,
		"global_guide": 0,
		"exchange_currency_id": 0,
		"exchange_total_value": 0,
		"exchange_rate": 0,
		"document_type": {
			"document_type_id": 7,
			"saft_code": "NEF"
		},
		"document_set": {
			"document_set_id": 153703,
			"name": "portugal2019"
		},
		"associated_documents": [],
		"reverse_associated_documents": []
	}
}
