Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014aUaQeLnwbb1zTpN7kHeat
78 lines
1.9 KiB
ABAP
78 lines
1.9 KiB
ABAP
CLASS {{p}}locksmith_pricer DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
|
PUBLIC SECTION.
|
|
INTERFACES {{p}}if_locksmith_pricer.
|
|
ENDCLASS.
|
|
|
|
|
|
CLASS {{p}}locksmith_pricer IMPLEMENTATION.
|
|
METHOD {{p}}if_locksmith_pricer~calculate_price.
|
|
DATA lv_qty TYPE p LENGTH 9 DECIMALS 2.
|
|
DATA lv_rate TYPE p LENGTH 9 DECIMALS 2.
|
|
DATA lv_base TYPE p LENGTH 9 DECIMALS 2.
|
|
DATA lv_disc TYPE p LENGTH 9 DECIMALS 2.
|
|
DATA lv_hundred TYPE p LENGTH 9 DECIMALS 2.
|
|
|
|
lv_qty = iv_quantity.
|
|
lv_hundred = '100.00'.
|
|
|
|
IF iv_job_type = 'K'.
|
|
IF lv_qty < 1.
|
|
rv_price = '0.00'.
|
|
ELSE.
|
|
IF iv_key_type = 'S'.
|
|
lv_rate = '4.50'.
|
|
ELSEIF iv_key_type = 'Y'.
|
|
lv_rate = '9.80'.
|
|
ELSEIF iv_key_type = 'E'.
|
|
lv_rate = '24.00'.
|
|
ELSE.
|
|
lv_rate = '0.00'.
|
|
ENDIF.
|
|
IF lv_rate = 0.
|
|
rv_price = '0.00'.
|
|
ELSE.
|
|
lv_base = lv_rate * lv_qty.
|
|
IF lv_qty >= 20.
|
|
lv_disc = '20.00'.
|
|
ELSEIF lv_qty >= 5.
|
|
lv_disc = '10.00'.
|
|
ELSE.
|
|
lv_disc = '0.00'.
|
|
ENDIF.
|
|
rv_price = lv_base - lv_base * lv_disc / lv_hundred.
|
|
ENDIF.
|
|
ENDIF.
|
|
ELSEIF iv_job_type = 'L'.
|
|
IF iv_callout = 'W'.
|
|
rv_price = '179.00'.
|
|
ELSEIF iv_callout = 'A'.
|
|
rv_price = '149.00'.
|
|
ELSE.
|
|
rv_price = '89.00'.
|
|
ENDIF.
|
|
ELSEIF iv_job_type = 'R'.
|
|
IF lv_qty < 1.
|
|
rv_price = '0.00'.
|
|
ELSE.
|
|
IF iv_key_type = 'S'.
|
|
lv_rate = '6.00'.
|
|
ELSEIF iv_key_type = 'Y'.
|
|
lv_rate = '11.00'.
|
|
ELSEIF iv_key_type = 'E'.
|
|
lv_rate = '26.00'.
|
|
ELSE.
|
|
lv_rate = '0.00'.
|
|
ENDIF.
|
|
IF lv_rate = 0.
|
|
rv_price = '0.00'.
|
|
ELSE.
|
|
lv_base = '35.00'.
|
|
rv_price = lv_qty * ( lv_base + lv_rate ).
|
|
ENDIF.
|
|
ENDIF.
|
|
ELSE.
|
|
rv_price = '0.00'.
|
|
ENDIF.
|
|
ENDMETHOD.
|
|
ENDCLASS.
|