{
	"name": "table/external/ksef/order/order.json",
	"table_name": "order",
	"table_prefix": "ord",
	"record_type": ["invoice", "ksef_invoice", "accounts_payable"],
	"local_table": "order",
	"local_record_type": ["invoice", "ksef_invoice", "accounts_payable"],
	"default_field": "table/prf/default_field.json",
	"default_order": [
		{
			"field": "order_id",
			"order": ">"
		}
	],
	"format": {
		"date": "%Y-%m-%d",
		"datetime": "%Y-%m-%dT%H:%M:%SZ"
	},
	"field": [
		{
			"field_name": "invoiceNumber",
			"local_field": "order_id",
			"field_type": "text",
			"constraint": ["primary key"],
			"info": "Invoice number (primary key)"
		},
		{
			"field_name": "invoicing_company_id",
			"local_field": "invoicing_company_id",
			"field_type": "text",
			"info": "Company ID"
		},
		{
			"field_name": "invoicingDate",
			"local_field": "order_date",
			"field_type": "date",
			"info": "Invoicing date"
		},
		{
			"field_name": "company_reference_number",
			"local_field": "company_reference_number",
			"field_type": "text",
			"info": "Customer order id"
		},
		{
			"field_name": "confirmation_date",
			"local_field": "confirmation_date",
			"field_type": "date",
			"info": "Confirmation date"
		},
		{
			"field_name": "currency",
			"local_field": "currency_id",
			"field_type": "text",
			"info": "Currency code"
		},
		{
			"field_name": "due_date",
			"local_field": "due_date",
			"field_type": "date",
			"info": "Payment due date"
		},
		{
			"field_name": "exchange_rate",
			"local_field": "exchange_rate",
			"field_type": "double",
			"info": "Exchange rate if foreign currency"
		},
		{
			"field_name": "info",
			"local_field": "info",
			"field_type": "text",
			"info": "Info"
		},
		{
			"field_name": "delivery_address",
			"local_field": "delivery_address",
			"field_type": "text",
			"info": "Delivery address"
		},
		{
			"field_name": "delivery_company_id",
			"local_field": "delivery_company_id",
			"field_type": "text",
			"info": "Delivery company ID"
		},
		{
			"field_name": "discount_price",
			"local_field": "discount_price",
			"field_type": "double",
			"info": "Discount price"
		},
		{
			"field_name": "invoicing_address",
			"local_field": "invoicing_address",
			"field_type": "text",
			"info": "Invoicing address"
		},
		{
			"field_name": "local_price_without_vat",
			"local_field": "local_price_without_vat",
			"field_type": "double",
			"info": "Local price without VAT"
		},
		{
			"field_name": "order_address",
			"local_field": "order_address",
			"field_type": "text",
			"info": "Order address"
		},
		{
			"field_name": "order_state",
			"local_field": "order_state",
			"field_type": "text",
			"value_array": "order_state",
			"info": "Order state"
		},
		{
			"field_name": "order_type",
			"local_field": "order_type",
			"field_type": "text",
			"value_array": "order_type",
			"info": "Order type"
		},
		{
			"field_name": "our_reference",
			"local_field": "our_reference",
			"field_type": "text",
			"info": "Our reference"
		},
		{
			"field_name": "person_id",
			"local_field": "person_id",
			"field_type": "text",
			"info": "Person ID"
		},
		{
			"field_name": "grossAmount",
			"local_field": "price_with_vat",
			"field_type": "double",
			"info": "Price with VAT"
		},
		{
			"field_name": "netAmount",
			"local_field": "price_without_vat",
			"field_type": "double",
			"info": "Price without VAT"
		},
		{
			"field_name": "term_of_delivery",
			"local_field": "term_of_delivery",
			"field_type": "text",
			"info": "Term of delivery"
		},
		{
			"field_name": "terms_of_payment_id",
			"local_field": "terms_of_payment_id",
			"field_type": "text",
			"info": "Payment terms"
		},
		{
			"field_name": "vatAmount",
			"local_field": "vat_price",
			"field_type": "double",
			"info": "VAT price"
		},
		{
			"field_name": "voucher_id",
			"local_field": "voucher_id",
			"field_type": "text",
			"info": "Voucher ID"
		},
		{
			"field_name": "way_of_delivery",
			"local_field": "way_of_delivery",
			"field_type": "text",
			"info": "Way of delivery"
		},
		{
			"field_name": "your_reference",
			"local_field": "your_reference",
			"field_type": "text",
			"info": "Your reference"
		},
		{
			"field_name": "note",
			"local_field": "note",
			"field_type": "text",
			"info": "Additional notes"
		}
	],
	"extra_field": [
		{
			"field_name": "json_data.import_text",
			"local_field": "json_data.import_text",
			"field_type": "text",
			"info": "XML"
		},
		{
			"field_name": "json_data.html_text",
			"local_field": "json_data.html_text",
			"field_type": "text",
			"info": "HTML text"
		},
		{
			"field_name": "json_data.html_text_en",
			"local_field": "json_data.html_text_en",
			"field_type": "text",
			"info": "HTML text-english"
		},
		{
			"field_name": "json_data.error",
			"local_field": "json_data.error",
			"field_type": "text",
			"info": "Error message (XML)"
		},
		{
			"field_name": "json_data.poland_vat_price",
			"local_field": "json_data.poland_vat_price",
			"field_type": "double",
			"info": "Poland VAT price"
		},
		{
			"field_name": "json_data.poland_vat_rate",
			"local_field": "json_data.poland_vat_rate",
			"field_type": "double",
			"info": "Poland VAT rate"
		},
		{
			"field_name": "json_data.poland_vat_rate_date",
			"local_field": "json_data.poland_vat_rate_date",
			"field_type": "date",
			"info": "Poland VAT rate date"
		},
		{
			"field_name": "json_data.firm_id",
			"local_field": "json_data.firm_id",
			"field_type": "text",
			"info": "Firm ID"
		},
		{
			"field_name": "json_data.ksefNumber",
			"local_field": "json_data.transfer_id",
			"field_type": "text",
			"info": "Ksef number"
		},
		{
			"field_name": "json_data.destination_date",
			"local_field": "json_data.destination_date",
			"field_type": "date",
			"info": "Destination date"
		},
		{
			"field_name": "json_data.remark_time",
			"local_field": "json_data.remark_time",
			"field_type": "text",
			"info": "Remark time"
		},
		{
			"field_name": "json_data.paid_price",
			"local_field": "json_data.paid_price",
			"field_type": "double",
			"info": "Paid price"
		},
		{
			"field_name": "json_data.bank_reference_number",
			"local_field": "json_data.bank_reference_number",
			"field_type": "text",
			"info": "Bank reference number"
		},
		{
			"field_name": "json_data.penalty_interest_percent",
			"local_field": "json_data.penalty_interest_percent",
			"field_type": "double",
			"info": "Penalty interest percent"
		},
		{
			"field_name": "json_data.issueDate",
			"local_field": "json_data.issue_date",
			"field_type": "date",
			"info": "Issue date"
		},
		{
			"field_name": "json_data.acquisitionDate",
			"local_field": "json_data.acquisition_date",
			"field_type": "date",
			"info": "Acquisition date"
		},
		{
			"field_name": "json_data.permanentStorageDate",
			"local_field": "json_data.permanent_storage_date",
			"field_type": "timestamp",
			"info": "Permanent storage date"
		},
		{
			"field_name": "json_data.invoicingMode",
			"local_field": "json_data.invoicing_mode",
			"field_type": "varchar",
			"info": "Invoicing mode"
		},
		{
			"field_name": "json_data.invoiceType",
			"local_field": "json_data.invoice_type",
			"field_type": "varchar",
			"info": "Invoice type"
		},
		{
			"field_name": "json_data.isSelfInvoicing",
			"local_field": "json_data.is_self_invoicing",
			"field_type": "boolean",
			"info": "Self invoicing"
		},
		{
			"field_name": "json_data.hasAttachment",
			"local_field": "json_data.has_attachment",
			"field_type": "boolean",
			"info": "Has attachment"
		},
		{
			"field_name": "json_data.invoiceHash",
			"local_field": "json_data.invoice_hash",
			"field_type": "varchar",
			"info": "Invoice hash"
		},
		{
			"field_name": "json_data.thirdSubjects",
			"local_field": "json_data.third_subjects",
			"field_type": "json",
			"info": "Third subjects"
		},
		{
			"field_name": "json_data.formCode",
			"local_field": "json_data.form_code",
			"field_type": "json",
			"info": "Form code"
		},
		{
			"field_name": "json_data.seller",
			"local_field": "json_data.seller",
			"field_type": "json",
			"info": "Seller"
		},
		{
			"field_name": "json_data.buyer",
			"local_field": "json_data.buyer",
			"field_type": "json",
			"info": "Buyer"
		},
		{
			"field_name": "json_data.seller.name",
			"local_field": "json_data.seller.name",
			"field_type": "text",
			"info": "Seller name"
		},
		{
			"field_name": "json_data.seller.nip",
			"local_field": "json_data.seller.nip",
			"field_type": "text",
			"info": "Seller tax ID incoming (NIP)"
		},
		{
			"field_name": "json_data.seller.vat_number",
			"local_field": "json_data.seller.vat_number",
			"field_type": "text",
			"info": "Seller tax ID (NIP)"
		},
		{
			"field_name": "json_data.seller.address",
			"local_field": "json_data.seller.address",
			"field_type": "text",
			"info": "Seller street address"
		},
		{
			"field_name": "json_data.seller.post_office",
			"local_field": "json_data.seller.post_office",
			"field_type": "text",
			"info": "Seller city/post office"
		},
		{
			"field_name": "json_data.seller.post_code",
			"local_field": "json_data.seller.post_code",
			"field_type": "text",
			"info": "Seller postal code"
		},
		{
			"field_name": "json_data.seller.country_code",
			"local_field": "json_data.seller.country_code",
			"field_type": "text",
			"info": "Seller country code"
		},
		{
			"field_name": "json_data.seller.country",
			"local_field": "json_data.seller.country",
			"field_type": "text",
			"info": "Seller country"
		},
		{
			"field_name": "json_data.seller.bank_account",
			"local_field": "json_data.seller.bank_account",
			"field_type": "text",
			"info": "Seller bank account"
		},
		{
			"field_name": "json_data.seller.swift_code",
			"local_field": "json_data.seller.swift_code",
			"field_type": "text",
			"info": "Seller SWIFT code"
		},
		{
			"field_name": "json_data.seller.bank_name",
			"local_field": "json_data.seller.bank_name",
			"field_type": "text",
			"info": "Seller bank name"
		},
		{
			"field_name": "json_data.seller.www",
			"local_field": "json_data.seller.www",
			"field_type": "text",
			"info": "Seller website"
		},
		{
			"field_name": "json_data.seller.email",
			"local_field": "json_data.seller.email",
			"field_type": "text",
			"info": "Seller email"
		},
		{
			"field_name": "json_data.buyer.name",
			"local_field": "json_data.buyer.name",
			"field_type": "text",
			"info": "Buyer name"
		},
		{
			"field_name": "json_data.buyer.identifier.type",
			"local_field": "json_data.buyer.identifier_type",
			"field_type": "text",
			"info": "Buyer identifier type"
		},
		{
			"field_name": "json_data.buyer.identifier.value",
			"local_field": "json_data.buyer.identifier_value",
			"field_type": "text",
			"info": "Buyer tax ID incoming (NIP)"
		},
		{
			"field_name": "json_data.buyer.vat_number",
			"local_field": "json_data.buyer.vat_number",
			"field_type": "text",
			"info": "Buyer tax ID (NIP)"
		},
		{
			"field_name": "json_data.buyer.address",
			"local_field": "json_data.buyer.address",
			"field_type": "text",
			"info": "Buyer address"
		},
		{
			"field_name": "json_data.buyer.post_office",
			"local_field": "json_data.buyer.post_office",
			"field_type": "text",
			"info": "Buyer city/post office"
		},
		{
			"field_name": "json_data.buyer.post_code",
			"local_field": "json_data.buyer.post_code",
			"field_type": "text",
			"info": "Buyer postal code"
		},
		{
			"field_name": "json_data.buyer.country_code",
			"local_field": "json_data.buyer.country_code",
			"field_type": "text",
			"info": "Buyer country code"
		},
		{
			"field_name": "json_data.buyer.country",
			"local_field": "json_data.buyer.country",
			"field_type": "text",
			"info": "Buyer country"
		},
		{
			"field_name": "json_data.buyer.trade_registry_number",
			"local_field": "json_data.buyer.trade_registry_number",
			"field_type": "text",
			"info": "Buyer trade registry number"
		},
		{
			"field_name": "json_data.buyer.www",
			"local_field": "json_data.buyer.www",
			"field_type": "text",
			"info": "Buyer website"
		},
		{
			"field_name": "json_data.buyer.email",
			"local_field": "json_data.buyer.email",
			"field_type": "text",
			"info": "Seller email"
		}
	]
}
