Files
abap-llm/tasks_gen/eval/G0144/seed/cine_fee_old.func.abap

72 lines
1.3 KiB
ABAP

FUNCTION {{p}}cine_fee_old
IMPORTING
iv_show_type TYPE string
iv_seats TYPE i
iv_show_time TYPE t
iv_cust_type TYPE string
EXPORTING
ev_total TYPE decfloat34
ev_discount TYPE decfloat34
EXCEPTIONS
invalid_input.
" legacy: price per seat
DATA: lv_x TYPE decfloat34,
lv_y TYPE decfloat34,
lv_z TYPE i.
IF iv_seats < 1.
RAISE invalid_input.
ENDIF.
IF iv_show_type = '2D' OR iv_show_type = '3D' OR iv_show_type = 'IMAX'.
IF iv_show_type = '2D'.
lv_x = 9.
ELSEIF iv_show_type = '3D'.
lv_x = '12.50'.
ELSE.
lv_x = 16.
ENDIF.
ELSE.
RAISE invalid_input.
ENDIF.
IF iv_cust_type = 'CHILD'.
lv_y = 40.
ELSEIF iv_cust_type = 'SENIOR'.
lv_y = 30.
ELSEIF iv_cust_type = 'STUDENT'.
lv_y = 20.
ELSEIF iv_cust_type = 'ADULT'.
lv_y = 0.
ELSE.
RAISE invalid_input.
ENDIF.
IF iv_show_time < '170000'.
IF iv_cust_type <> 'CHILD'.
lv_y = lv_y + 25.
ENDIF.
ENDIF.
IF iv_seats >= 8.
lv_y = lv_y + 10.
ENDIF.
IF lv_y > 60.
lv_y = 60.
ENDIF.
lv_x = lv_x - lv_x * lv_y / 100.
lv_x = lv_x + '0.5'.
lv_z = 0.
DO iv_seats TIMES.
lv_z = lv_z + 1.
ENDDO.
ev_total = round( val = lv_x * lv_z dec = 2 mode = cl_abap_math=>round_half_up ).
ev_discount = lv_y.
ENDFUNCTION.