{
  "info": "",
  "field": {
    "pr_product_id": [
      ["_code_CLEAN", ["pr_product_id"]]
    ],
    "pr_name": [
      ["pr_scNIMI"]
    ],
    "pr_product_group": [],
    "pr_subgroup": [
      ["pr_TEE_LYHENNE"]
    ],
    "pr_quality": [
      ["pr_TEE_LYHENNE"]
    ],
    "pr_product_code": [
      ["pr_TEE_LYHENNE"]
    ],
    "pr_purchase_multiplier": [
      ["pr_scOSTOKERROIN"]
    ],
    "pr_storable": [],
    "pr_no_discount": [],
    "pr_conversion_multiplier": [
      ["pr_scVAR_MKERROI"]
    ],
    "pr_unit": [],
    "pr_unit_2": [],
    "pr_sales_price_unit": [
      ["pr_sMYYNTIHINTA_"]
    ],
    "pr_action_limit_unit": [
      ["pr_C_MUUTTUJAT"]
    ],
    "pr_min_purchase_amount_unit": [
      ["pr_sMIN_H_ERA_YK"]
    ],
    "pr_cost_price_unit": [
      ["pr_sOK_HINTA_Y1"]
    ],
    "pr_profit_multiplier": [
      ["pr_sKATEKERROIN"]
    ],
    "pr_need_calculation_in_use": [
      ["pr_scNEED_CALC_IN_USE"]
    ],
    "pr_stock_balance_unit": [],
    "pr_price_change_date": [],
    "pr_going_amount": [],
    "pr_free_amount": [],
    "pr_average_balance": [],
    "pr_last_stock_event_date": [],
    "pr_info": [],
    "pr_supplier_id": [],
    "pr_purchase_price_unit": [
      ["pr_scOSTOHINTA"]
    ],
    "pr_sales_order_code_id": [
      ["pr_scMYYNTIKOODI"]
    ],
    "pr_foreign_sales_ord_code_id": [
      ["pr_scULKOMYKOODI"]
    ],
    "pr_purchase_order_code_id": [
      ["pr_scOSTOKOODI"]
    ],
    "pr_average_price": [],
    "pr_abc_class": [],
    "pr_currency_id": [
      ["pr_scOSTOVALUUTT"]
    ],
    "pr_foreign_purch_pr_unit": [],
    "pr_gross_weight": [],
    "pr_net_weight": [],
    "pr_volume": [],
    "pr_not_in_use": [],
    "pr_price_group_id": [],
    "pr_not_in_dispatch_note": [],
    "pr_design_conversion_multip": [
      ["pr_scSUUNN_MKERR"]
    ],
    "pr_design_unit": [],
    "pr_design_unit_2": [],
    "pr_unit_design_unit_multip": [
      ["pr_scV1_S1_MKERR"]
    ],
    "pr_is_in_enclosure": [],
    "pr_work_position_num_id": [
      ["pr_scTYO_POS_NRO"]
    ],
    "pr_supplier_material_code": [
      ["IDLE"]
    ],
    "pr_inventory_date": [],
    "pr_stock_parcel_in_use": [],
    "pr_in_price_list": [],
    "pr_no_printing": [],
    "pr_coming_amount": [],
    "pr_effect_of_amount": [],
    "pr_effect_of_fixed_size": [],
    "pr_no_billing": [],
    "pr_tariff_heading": [],
    "pr_supplier_price_in_use": [
      ["pr_FLD_ENTERABLE_SET"]
    ],
    "pr_work_load_group": [],
    "pr_calculated_sales_pr_unit": [],
    "pr_ean_code": [
      [
        "if", ["g.pr_lEanCodeCheckInUse", "=", "true"],
        [
          ["pr_ean_code", "=", ["pr_scEAN_KOODI", ["pr_ean_code"]]]
        ],
        "if", ["g.pr_lEanCode2CalcInUse", "=", "true"],
        [
          ["pr_ean_code2", "=", ["EANmuunnos"]]
        ]
      ]
    ],
    "pr_ean_code2": [
      [
        "if", ["g.pr_lEanCode2CheckInUse", "=", "true"],
        [
          ["pr_ean_code2", "=", ["pr_scEAN_KOODI", ["EAN_Code2"]]]
        ]
      ]
    ],
    "pr_size": [],
    "pr_stock_position": [],
    "pr_parcel_code": [],
    "pr_no_automatic_stock_remove": [],
    "pr_explanation": [],
    "pr_change_date": [],
    "pr_calculation_type": [],
    "pr_type": [
      ["pr_scTYPE"]
    ],
    "pr_firm_id": [],
    "pr_raw_material_delivery_time": [],
    "pr_stock_limit_calc_type": [],
    "pr_safety_stock_duration": [
      ["pr_rSafeStockNeed", "=", ["pr_stlim_SafeStockNeedGet", ["pr_safety_stock_duration", "pr_estimated_average_need"]]]
    ],
    "pr_production_control_type": [],
    "pr_unfinished_orders_in_weeks": [],
    "pr_category": [],
    "pr_drawing_number_material": [],
    "pr_critical_date": [],
    "pr_order_forecast_days": [],
    "pr_cost_center": [],
    "pr_purchase_average_price": [],
    "pr_purch_avg_price_amount": [],
    "pr_purch_avg_price_start_date": [],
    "pr_average_balance_start_date": [],
    "pr_critical_date_real": [],
    "pr_stock_balance_wip": [],
    "pr_critical_start_date": [],
    "pr_critical_start_date_real": [],
    "pr_dynamic_act_limit_in_use": [],
    "pr_dynamic_act_limit_min_val": [],
    "pr_dynamic_act_limit_max_val": [
      [
        "if", [["pr_dynamic_act_limit_max_val", "=", 0], "and", ["pr_dynamic_act_limit_min_val", ">", 0]],
        [
          ["IDLE"]
        ],
        "elseif", ["pr_dynamic_act_limit_max_val", "<", ["pr_dynamic_act_limit_min_val"]],
        [
          ["_err_CRY", [["_lang_Current", ["Max. value_may_not_be_smaller_than_min. value"]], "false"]]
        ]
      ]
    ],
    "pr_estimated_average_need": [
      ["pr_rSafeStockNeed", "=", ["pr_stlim_SafeStockNeedGet", ["pr_safety_stock_duration", "pr_estimated_average_need"]]]
    ],
    "pr_manufacturing_average_need": [],
    "pr_actual_average_need": [],
    "pr_est_work_time": [],
    "pr_true_coming_amount": [],
    "pr_true_going_amount": [],
    "pr_true_free_amount": [],
    "pr_external_storage_balance": [],
    "pr_shelf_stock_balance": [],
    "pr_transfer_id": [],
    "pr_max_wanted_stock_balance": [],
    "pr_last_stock_removal_date": [],
    "pr_project_id": [],
    "pr_forecast_days": [],
    "pr_max_production_amount": [],
    "pr_work_order_type": [],
    "pr_track_time_status": [],
    "pr_default_sales_person_id": [],
    "pr_customer_id": [
      ["pr_scCUSTOMER"]
    ],
    "pr_reclamation_count": [],
    "pr_document_count": [],
    "pr_origin": [],
    "pr_purchase_price_change_date": [],
    "pr_WORK_DRAWING_NUM_SET(arg1) ---- ??, on pr_ Script.luan alalaidassa": []
  },
  "function": {
    "pr_scNIMI": [
      [
        "if", ["pr_work_position_num_id", "<>", ""],
        [
          ["_w_fRO_State", "=", ["aaRO_State", ["w", "false"]]],
          ["RELATE_ONE", ["pr_work_position_num_id"]],
          ["wo_name", "=", ["pr_name"]],
          ["_rec_SAVE", ["w"]],
          ["aaRO_STATE_SET", ["w", "_w_fRO_State"]]
        ]
      ],
      [
        "if", ["g.pr_lSeliKopi", "=", "2"],
        [
          [
            "if", ["pr_explanation", "=", ""],
            ["pr_explanation", "=", ["pr_name"]]
          ]
        ],
        "elseif", ["pr_explanation", "=", ["pr_name"]],
        [
          ["CONFIRM", ["concat", [["_lang_Current", ["Do_you_want_to_copy_name_to_product_explanation?"]], "\n", "pr_explanation", " ", "pr_name"]]],
          [
            "if", ["OK", "=", "1"],
            [
              ["pr_explanation", "=", ["pr_name"]]
            ]
          ]
        ]
      ]
    ],
    "pr_TEE_LYHENNE": [
      ["pr_TEE_LYHENNE", [["rbtuLaji", "=", 0]]],
      [
        "if", [["Current_default_table", "=", ["pr"]], "and", ["pr_production_id", "=", ""]]
      ],
      [
        "if", ["g._el_Tbl", "<>", ["pr"]],
        [
          ["wo_product_id", "=", ["pr_production_id"]]
        ]
      ]
    ],
    "pr_scOSTOKERROIN": [
      ["pr_C_HINNAT", ["pr_purchase_multiplier"]]
    ],
    "pr_scVAR_MKERROI": [
      [
        "if", [["pr_design_unit", "=", "pr_unit_2"], "and", ["pr_design_unit_2", "=", "pr_unit"]],
        [
          ["pr_design_conversion_multip", "=", "pr_JaaVarMuutosk", ["1", "g.pr_iPyorMKer"]]
        ],
        "elseif", [["pr_design_unit", "=", "pr_unit"], "and", ["pr_design_unit_2", "=", ["pr_unit_2"]]],
        [
          ["pr_design_conversion_multip", "=", ["pr_conversion_multiplier"]]
        ],
        "elseif", ["pr_design_unit_2", "=", ["pr_unit"]],
        [
          ["IDLE"]
        ],
        "else",
        [
          ["IDLE"]
        ]
      ],
      ["pr_V1_S1_MUUTOSK"]
    ],
    "pr_V1_S1_MUUTOSK": [
      [
        "if", ["pr_unit_2", "=", ["pr_design_unit"]],
        [
          ["pr_unit_design_unit_multip", "=", ["pr_conversion_multiplier"]]
        ],
        "elseif", ["pr_unit", "=", ["pr_design_unit_2"]],
        [
          ["pr_unit_design_unit_multip", "=", ["pr_JaaSuunnMuuto", ["1", "g.pr_iPyorMKer"]]]
        ],
        "elseif", ["pr_unit", "=", ["pr_design_unit"]],
        [
          ["pr_unit_design_unit_multip", "=", "1"]
        ],
        "elseif", ["pr_unit_2", "=", ["pr_design_unit_2"]],
        [
          [
            "if", ["pr_design_conversion_multip", "<>", 0],
            [
              ["pr_unit_design_unit_multip", "=", ["pr_JaaSuunnMuuto", ["pr_conversion_multiplier", "g.pr_iPyorMKer"]]]
            ],
            "else",
            [
              ["pr_unit_design_unit_multip", "=", 0]
            ]
          ]
        ]
      ],
      ["pr_C_MUUTTUJAT"]
    ],
    "pr_sMYYNTIHINTA_": [
      ["pr_C_HINNAT", ["pr_sales_price_unit"]]
    ],
    "pr_C_MUUTTUJAT": [
      ["pr_roh_y2", "=", ["pr_kervarmuutosk", ["pr_purchase_price_unit", "g.pr_ipyorahin"]]],
      ["pr_rok_y2", "=", ["pr_kervarmuutosk", ["pr_cost_price_unit", "g.pr_ipyorahin"]]],
      ["pr_rmh_y2", "=", ["pr_kervarmuutosk", ["pr_sales_price_unit", "g.pr_ipyorahin"]]],
      ["pr_rsislvvoh", "=", ["round", [["aac_mk_lvvmk", ["pr_purchase_price_unit", "pr_rmklvvpr"]], "g.pr_ipyorahin"]]],
      ["pr_rsislvvok", "=", ["round", [["aac_mk_lvvmk", ["pr_cost_price_unit", "pr_rmklvvpr"]]], "g.pr_ipyorahin"]],
      ["pr_rsislvvmh", "=", ["round", [["aac_mk_lvvmk", ["pr_sales_price_unit", "pr_rmklvvpr"]], "g.pr_ipyorahin"]]],
      ["pr_rminer_y2", "=", ["pr_jaavarmuutosk", ["pr_min_purchase_amount_unit", "g.pr_ipyormaar"]]],
      ["pr_rkatepros", "=", ["pr_c_kateprosent"]],
      ["pr_ractionlimit_unit2", "=", ["pr__amountstock1tostock2", ["pr_action_limit_unit", "get", "true"]]]
    ],
    "pr_sMIN_H_ERA_YK": [
      [
        "if", [["pr_unit", "<>", ["pr_unit_2"]], "and", ["pr_conversion_multiplier", "<>", "1"]],
        [
          ["pr_rMinEr_Y2", "=", ["Round", [["pr_min_purchase_amount_unit", "/", "pr_conversion_multiplier"], "5"]]]
        ],
        "else",
        [
          ["pr_rMinEr_Y2", "=", ["pr_min_purchase_amount_unit"]]
        ]
      ]
    ],
    "pr_sOK_HINTA_Y1": [
      ["pr_C_HINNAT", ["pr_cost_price_unit"]]
    ],
    "pr_sKATEKERROIN": [
      ["pr_C_HINNAT", ["pr_profit_multiplier"]]
    ],
    "pr_scNEED_CALC_IN_USE": [
      [
        "if", ["false"],
        [
          ["pr_scTYPE"]
        ]
      ]
    ],
    "pr_scOSTOHINTA": [
      ["pr_C_HINNAT", ["pr_purchase_price_unit"]]
    ],
    "pr_scMYYNTIKOODI": [
      ["pr_smyyntiko", "=", ["soc_name"]],
      ["pr_rmklvvpr", "=", ["soc_vat_percentage"]],
      ["pr_C_MUUTTUJAT"]
    ],
    "pr_scULKOMYKOODI": [
      ["pr_sulkommyk", "=", ["soc_name"]],
      ["pr_rumklvvpr", "=", ["soc_vat_percentage"]]
    ],
    "pr_scOSTOKOODI": [
      ["pr_sostokood", "=", ["poc_name"]],
      ["pr_roklvvpr", "=", ["poc_vat_percentage"]]
    ],
    "pr_scOSTOVALUUTT": [
      ["pr_rvalkerr", "=", ["cu_buying_rate"]]
    ],
    "pr_scSUUNN_MKERR": [
      [
        "if", [["pr_design_unit", "=", ["pr_unit_2"]], "and", ["pr_design_unit_2", "=", ["pr_unit"]]],
        [
          ["pr_conversion_multiplier", "=", ["pr_JaaSuunnMuuto", ["1", "g.pr_iPyorMKer"]]]
        ],
        "elseif", [["pr_design_unit", "=", ["pr_unit"]], "and", ["pr_design_unit_2", "=", ["pr_unit_2"]]],
        [
          ["pr_conversion_multiplier", "=", ["pr_design_conversion_multip"]]
        ]
      ],
      ["pr_V1_S1_MUUTOSK"]
    ],
    "pr_scV1_S1_MKERR": [
      ["_pr_sKaava", "=", ""],
      ["_Arvo", "=", ["pr_unit_design_unit_multip"]],
      [
        "if", ["pr_unit_2", "=", ["pr_design_unit"]],
        [
          ["_pr_sKaava", "=", "Var_muutosker"],
          ["_Arvo", "=", ["pr_conversion_multiplier"]]
        ],
        "elseif", ["pr_unit", "=", ["pr_design_unit_2"]],
        [
          ["_pr_sKaava", "=", "1/Suunn_muutosker"],
          ["_Arvo", "=", ["pr_JaaSuunnMuuto", ["1", "g.pr_iPyorMKer"]]]
        ],
        "elseif", ["pr_unit", "=", ["pr_design_unit"]],
        [
          ["_pr_sKaava", "=", "1"],
          ["_Arvo", "=", "1"]
        ],
        "elseif", ["pr_unit", "=", ["pr_design_unit_2"]],
        [
          ["_pr_sKaava", "=", ["Var_muutosker/Suunn_muutosker"]],
          ["_Arvo", "=", ["pr_JaaSuunnMuuto", ["pr_conversion_multiplier", "g.pr_iPyorMKer"]]]
        ]
      ],
      [
        "if", ["_Arvo", "<>", ["pr_unit_design_unit_multip"]],
        [
          ["_err_CRY", ["concat", [["_lang_Current", ["Check_field_value"]], ": ", ["_fld_Name", ["pr_unit_design_unit_multip"], ", ", ["_lang_Current", ["pr"]], ": ", ["_fld_ValueStr", ["pr_product_id"]], "true"]]]]
        ]
      ]
    ],
    "pr_scTYO_POS_NRO": [
      [
        "if", [["Records_in_selection", ["Product_Field"]], ">", 0],
        [
          ["_fRO_State", "=", ["aaRO_State", ["prfi_kTbl", "false"]]],
          ["APPLY_TO_SELECTION", ["prfi", "prfi_work_id", "pr_work_position_num_id"]],
          ["aaRO_STATE_SET", ["prfi", "_fRO_State"]]
        ]
      ],
      [
        "if", ["false"],
        [
          ["_w_fRO_State", "=", ["aaRO_State", ["w", "false"]]],
          [
            "if", ["pr_work_position_num_id", "<>", ""],
            [
              ["QUERY", ["wo", "wo_work__position_num_id", "=", "pr_work__position_num_id"]],
              ["_sTuote", "=", ["pr_product_id"]]
            ],
            "else",
            [
              ["QUERY", ["wo", ["wo_product_id", "=", "pr_production_id"]]],
              ["_sTuote", "=", ""]
            ]
          ],
          [
            "if", ["wo_product_id", "<>", "_sTuote"],
            [
              [
                "if", [["Records_in_selection", ["wo"]], "=", "1"],
                [
                  ["zaxWAIT_FOR_FREE", ["wo", "true"]],
                  [
                    "if", ["OK", "=", "1"],
                    [
                      ["wo_product_id", "=", ["_sTuote"]],
                      ["_rec_SAVE", ["w"]]
                    ]
                  ]
                ],
                "elseif", [["Records_in_selection", ["wo"]], ">", "1"],
                [
                  ["xERROR_MESSAGE", ["concat", ["Useita_toita_on_kytkeytynyt", "pr_product_id", " tuotteeseen!", "tuscTYO_POS_NRO"]]]
                ]
              ],
              ["aaRO_STATE_SET", ["w", "_w_fRO_State"]]
            ]
          ]
        ]
      ]
    ],
    "pr_FLD_ENTERABLE_SET": [
      ["_var_ENTERABLE_SET", ["false", "g.pr_fs_Product_ID"]],
      ["_var_ENTERABLE_SET", ["true", "g.pr_fr_Purchase_Price__unit"]],
      ["_var_ENTERABLE_SET", ["true", "g.pr_fs_Supplier_id"]],
      ["_var_ENTERABLE_SET", ["true", "g.pr_fs_Supplier_Material_Code"]],
      ["_var_ENTERABLE_SET", ["true", "pr_lpbLinkSupplier"]],
      [
        "if", ["pr_supplier_price_in_use", "=", "true"],
        [
          [
            "if", ["g.pr_lLockPurchasePriceInInput", "=", "true"],
            [
              ["_var_ENTERABLE_SET", ["false", "g.pr_fr_Purchase_Price__unit"]]
            ]
          ],
          [
            "if", ["g.pr_lLockSupplierInInput", "=", "true"],
            [
              ["_var_ENTERABLE_SET", ["false", "g.pr_fs_Supplier_id"]],
              ["_var_ENTERABLE_SET", ["false", "pr_lpbLinkSupplier"]]
            ]
          ],
          [
            "if", ["g.pr_lLockSupplierMatCodeInInput", "=", "true"],
            [
              ["_var_ENTERABLE_SET", ["false", "g.pr_fs_Supplier_Material_Code"]]
            ]
          ]
        ]
      ]
    ],
    "pr_scTYPE": [
      [
        "if", ["g.prnc_lNeedCalcFldTypePr_", ">", 0],
        [
          ["_pr_lType", "=", ["_fld_ValueLong", ["pr_type"]]],
          ["_pr_tType", "=", ["concat", [",", ["String", ["_pr_lType"]], ","]]],
          [
            "if", [["pr__TypeWork", ["_pr_tType"]], "=", "true"],
            [
              ["pr_fOptionOnTmp", "=", "true"]
            ],
            "else",
            [
              ["pr_fOptionOnTmp", "=", "false"]
            ]
          ],
          ["_fld_VALUE", ["set", "pr_need_calculation_in_use", "pr_fOptionOnTmp"]]
        ]
      ]
    ],
    "pr_scCUSTOMER": [
      [
        "if", [["pr_customer_id", "<>", ""], "and", ["_fld_ValueStr", ["pr_work_position_num_id", "<>", ""]]],
        [
          ["_WRITE_STATE", ["w", "true"]],
          ["_sel_RELATE_ONE", ["w_work_position_num_id", "pr_work_position_num_id"]],
          ["_fld_VALUE_STR_SET", ["set", "w_company_id", "_pr_tCustomer"]],
          ["_rec_SAVE", ["w"]],
          ["_WRITE_STATE", ["w", "previous"]]
        ]
      ]
    ]
  }
}
