{
	"info": "",
	"field": {
		"ap_kPurchase_Order_id": [],
		"ap_kInvoice_Date": [
			["ap_ERÄPÄIVÄ"],
			["ap_MAKSUEHTO", ["ap_invoice_Date"]]
		],
		"ap_kDue_Date": [
			["ap_scERÄPÄIVÄ"]
		],
		"ap_kMethod_Of_Payment": [],
		"ap_Invoice_Number": [
			["ap_TARK_LASKUNRO"]
		],
		"ap_kReceiver_id":[
			["ap_scSAAJA"]
		],
		"ap_kInfo": [],
		"ap_kCode_ID": [

		],
		"ap_kPayable_Amount": [
			["ap_scMAKSETTAVA"]
		],
		"ap_kHandler": [],
		"ap_kCash_Discount_Due_Date": [],
		"ap_kPayment_Date": [],
		"ap_kSupplier_id": [
			["ap_scTOIMITTAJA"],
			["ap_TARK_LASKUNRO"]
		],
		"ap_Debet_Total": [],
		"ap_kKredit_Total": [],
		"ap_kReference_Number": [
			["ap_TARKISTA VIIT"]
		],
		"ap_kPurchase_Debt_Account_id": [],
		"ap_kNote": [],
		"ap_kNote_Type": [],
		"ap_kVoucher_Number": [],
		"ap_kCurrency_id": [
			["ap_sc_CURRENCY"]
		],
		"ap_kExchange_Rate": [],
		"ap_kApproval_State": [],
		"ap_kTerms_Of_Payment_id": [
			["ap_sc_TERMS_OF_PAYMENT"]
		],
		"ap_kReceiver_Bank_Account": [
			"if", ["ap_Receiver_Bank_Account", "<>", ""],
			[
				["ap_tErr", "=", ["bank__AccountNumberCheck", ["ap_Receiver_Bank_Account"]]],
				"if", ["ap_tErr"],
				[
					"if", ["_el_InInput", "=", "true"],
					[
						["REJECT", ["ap_Receiver_Bank_Account"]]
					]
				]
			]
		],
		"ap_kAccounts_Ledger": [],
		"ap_kNo_Bank_Program": [],
		"ap_kDestination_Date": [],
		"ap_kSum_Of_Payment": [],
		"ap_kSum_Of_Payable": [
			["ap_scMAKSUUN_VAL"]
		],
		"ap_kFirm_id": [
			["ap_sYRITYS"]
		],
		"ap_kPriority": [],
		"ap_kSWIFT_Code": []

	},
	"function": {
		"ap_ERÄPÄIVÄ": [
			["_sel_RELATE_ONE", ["top_kTerms_Of_Payment_ID", "ap_kTerms_Of_Payment_id"]]
		],
		"ap_scERÄPÄIVÄ": [
			["ap_MAKSUEHTO", ["ap_Due_Date"]]
		],
		"ap_TARK_LASKUNRO": [
			["_err_LANG_DO"],
			"if", [["ap_Invoice_Number", ""], "and", ["ap_Supplier_id", "<>", ""]],
			[
				["g.ap_sToimTunn", "=", "ap_Supplier_id"],
				["g.ap_sLaskuNro", "=", "ap_Invoice_Number"],
				["g.ap_Tunnus", "=", "ap_Code_ID"],
				["_ap_lTupla_p", "=", ["zapStartProcess", ["True", "ap_TARKISTA_LA_p", 16, "Laskun_tarkistus"]] ]
			]
		],
		"ap_scSAAJA": [
			["ap_sSaaja", "=", "s_Name"],
			"if", ["ap_Supplier_id", "=", ""],
			[
				["ap_toimitta", "=", "s_Name"],
				"if", ["ap_Receiver_id", ""],
				[
					["ap_supplier_id", "=", "ap_receiver_id"]
				]
			],
			["ap_receiver_Bank_Account", "=", "s_bank_Account"],
			["ap_terms_Of_Payment_id", "=", "s_terms_Of_Payment_id"],
			["ap_SWIFT_Code", "=", "s_SWIFT_Code"],
			["ap_ERÄPÄIVÄ"],
			["ap_MAKSUEHTO", "ap_Receiver_id"]
		],
		"ap_scMAKSETTAVA": [
			["_ap_newRec", "=", "_rec_newRecord", ["ap_kTbl"]],
			"case of",
			[
				":", [["ap_voucher_Number", "<>", ""], "and", ["_ap_newRec", "=", "false"], "and", "Not", ["aaComOptKey"]],
				["xCRY", ["Kirjanpitoon viedyn ostolaskun valuuttasummaa ei voi muuttaa"]],
				["ap_payable_Amount", "=", "old", ["ap_payable_Amount"]]
			],
			"else",
			[
				["ap_Sum_Of_Payable", "=", "cur_C_Currency", ["False", "-1", "ap_Exchange_Rate", "cur_DefaultCurre", "ap_Payable_Amount", "ap_Currency_id"]]
			]

		],
		"ap_scTOIMITTAJA": [
			"if", ["_qry_Fld", ["0", "su_kSupplier_ID", "=", ["ap_Supplier_id", "", "kFalse", 1]]],
			[
				"if", ["_el_Tbl", "=", "ap_kTbl"],
				[
					"if", [["ap_sToimitta", "<>", "s_Name"], "and", ["Records_in_selection", ["apr", ">", 0]], "and", ["ap_sToimitta", "<>", "ap_sApuToimi"]],
					[
						["C_STRING", [255, "_ap_sMessu"]],
						["_ap_sMessu", "=", "Reskontrarivit on haettu toisen toimittajan tilauksista. Et voi hakea"],
						["_ap_sMessu", "=", "_ap_sMessu", "+", "eri toimittajia samaan reskontratapahtumaan"],
						["xCRY", ["_ap_sMessu"]],
						["DISABLE_BUTTON", ["ap_lbPurchaseOrderPost"]]
					],
					[
						["ENABLE_BUTTON", ["ap_lbpurchase_OrderPost"]]
					],
					["ap_sToimitta", "=", "s_Name"],
					"if", ["ap_sApuToimi", "=", ""],
					[
						["ap_sApuToimi", "=", "ap_sToimitta"]
					]
				],
				["C_TEXT", ["ap_tPayment_Receiver_tmp"]],
				["C_LONGINT", ["_ap_lReceiverFound"]],
				["ap_tPayment_Receiver_tmp", "=", "s_Payment_Receiver_id"],
				"if", [["ap_tPayment_Receiver_tmp", "<>", ""], "and", ["ap_tPayment_Receiver_tmp", "<>", ["ap_Supplier_id"]]],
				[
					["_ap_lReceiverFound", "=", ["_qry_Fld", "0", "su_kSupplier_ID", "=", ["ap_tPayment_Receiver_tmp", "", "kFalse"]]],
					["ap_Receiver_id", "=", "ap_tPayment_Receiver_tmp"],
					"case of",
					[
						":", ["_ap_lReceiverFound", ">", 1],
						["_err CRY", ["_lang Current", ["More than one supplier payment receiver was not found"], "..."]],
						":", ["_ap_lReceiverFound", "<", "=", 0],
						["_err CRY", ["_lang Current", ["Supplier payment receiver was not found"], "..."]]
					],
					"if", ["_ap_lReceiverFound", "<>", 1],
					[
						["ap_Receiver_id", "=", ""],
						["_qry_Fld", 0, "su_kSupplier_ID", "=", ["ap_Supplier_id", "", "kFalse"]]
					]
				],
				[
					["ap_Receiver_id", "=", "ap_Supplier_id"]
				],
				["ap_Receiver_Bank_Account", "=", "s_Bank_Account"],
				["ap_Terms_Of_Payment_id", "=", "s_Terms_Of_Payment_id"],
				["ap_SWIFT_Code", "=", "s_SWIFT_Code"],
				["ap_sSaaja", "=", "s_Name"],
				["ap_ERÄPÄIVÄ"],
				["ap_MAKSUEHTO", ["ap_Supplier_id"]],
				["ap_VALUUTTA", ["ap_Supplier_id"]]
			]
		],
		"ap_TARK_LASKUNRO": [
			["_err_LANG_DO"],
			"if", [["ap_Invoice_Number", "<>", ""], "and", ["ap_Supplier_id", "<>", ""]],
			[
				["g.ap_sToimTunn", "=", "ap_Supplier_id"],
				["g.ap_sLaskuNro", "=", "ap_Invoice_Number"],
				["g.ap_Tunnus", "=", "ap_Code_ID"],
				["_ap_lTupla_p", "=", "zapStartProcess", ["True", "ap_TARKISTA_LA_p", 16, "Laskun tarkistus"]]
			]
		],
		"ap_sc_CURRENCY": [
			["ap_VALUUTTA", ["ap_Currency_id"]]
		],
		"ap_sc_TERMS_OF_PAYMENT": [
			["ap_MAKSUEHTO", ["ap_Terms_Of_Payment_id"]]
		],
		"ap_scMAKSUUN_VAL": [
			["_ap_lNewRec", "=", "_rec_NewRecord", ["ap_kTbl"]],
			"case of",
			[
				":", [["ap_Voucher_Number", "<>", ""], "and", ["_ap_lNewRec", "=", "kFalse"], "and", "Not", ["aaComOptKey"]],
				["xCRY", ["Kirjanpitoon viedyn ostolaskun valuuttasummaa ei voi muuttaa"]],
				["ap_Sum_Of_Payable", "=", "old", ["ap_Sum_Of_Payable"]]
			],
			"else",
			[
				["ap_Payable_Amount", "=", "cur_C_Currency", ["false", "ap_Exchange_Rate", "-1", "ap_Currency_id", "ap_Sum_Of_Payable", "cur_DefaultCurre"]]
			],
			["ap_C_CURRENCY"]
		],
		"ap_sYRITYS": [
			["ap_NUMBER", ["g.aalNR_LOFF", "", "ap_Firm_id"]],
			["ap_scTUNNUS_NUM"]
		]
	}
}
