window.repositoryObject = {"parameters_custom_fields":[],"object_id":"f368","name":"FN_GET_BENEFIT_PRICE","subtype":"FUNCTION","is_user_defined":false,"description":null,"summary":[{"field":"Documentation","value":{"_type":"link","name":"style24@172.30.90.100","id":"d10"}},{"field":"Schema","value":""},{"field":"Name","value":"FN_GET_BENEFIT_PRICE"},{"field":"Type","value":"Function"}],"script":"BEGIN\r\n    DECLARE O_RET_VALUE INT;\r\n    DECLARE V_USABLE_CUST_GB VARCHAR(20);\r\n\r\n    DECLARE CONTINUE HANDLER FOR NOT FOUND\r\n        BEGIN\r\n            SET O_RET_VALUE = I_CURR_PRICE;\r\n            RETURN O_RET_VALUE;\r\n        END;\r\n\r\n    SET O_RET_VALUE = 0;\r\n    SET V_USABLE_CUST_GB = I_USABLE_CUST_GB;\r\n\r\n    IF V_USABLE_CUST_GB IS NULL OR V_USABLE_CUST_GB = '' THEN\r\n        SET V_USABLE_CUST_GB = 'G100_00';\r\n    END IF;\r\n\r\n    SELECT CASE\r\n               WHEN I_USABLE_CUST_GB = '99' THEN I_CURR_PRICE\r\n               WHEN I_FRONT_GB = 'P' AND I_USABLE_CUST_GB = 'G100_20' THEN STAFF_PC_CURR_PRICE\r\n               WHEN I_FRONT_GB = 'P' AND I_USABLE_CUST_GB <> 'G100_20' THEN PC_CURR_PRICE\r\n               WHEN I_FRONT_GB = 'M' AND I_USABLE_CUST_GB = 'G100_20' THEN STAFF_MO_CURR_PRICE\r\n               WHEN I_FRONT_GB = 'M' AND I_USABLE_CUST_GB <> 'G100_20' THEN MO_CURR_PRICE\r\n               WHEN I_FRONT_GB = 'A' AND I_USABLE_CUST_GB = 'G100_20' THEN STAFF_APP_CURR_PRICE\r\n               WHEN I_FRONT_GB = 'A' AND I_USABLE_CUST_GB <> 'G100_20' THEN APP_CURR_PRICE\r\n               ELSE I_CURR_PRICE END\r\n    INTO O_RET_VALUE\r\n    FROM TB_GOODS_BENEFIT_PRICE\r\n    WHERE GOODS_CD = I_GOODS_CD\r\n      AND CUST_GB = 'G100_00';\r\n\r\n    RETURN O_RET_VALUE;\r\nEND","parameters":[{"name":"Returns","description":null,"mode":"OUT","data_type":"int(10, 0)","custom_fields":{}},{"name":"I_FRONT_GB","description":null,"mode":"IN","data_type":"varchar(20)","custom_fields":{}},{"name":"I_GOODS_CD","description":null,"mode":"IN","data_type":"varchar(20)","custom_fields":{}},{"name":"I_CURR_PRICE","description":null,"mode":"IN","data_type":"int(10, 0)","custom_fields":{}},{"name":"I_USABLE_CUST_GB","description":null,"mode":"IN","data_type":"varchar(20)","custom_fields":{}}],"dependencies":null,"imported_at":"2021-11-11 16:37"};