123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- $PBExportHeader$f_find_mtrl_dftprice.srf
- global type f_find_mtrl_dftprice from function_object
- end type
- forward prototypes
- global function integer f_find_mtrl_dftprice (long arg_mtrlid, ref decimal arg_price, ref decimal arg_rebate)
- end prototypes
- global function integer f_find_mtrl_dftprice (long arg_mtrlid, ref decimal arg_price, ref decimal arg_rebate);Int rslt = 1
- long ll_moneyid
- SELECT moneyid
- INTO :ll_moneyid
- FROM cw_currency
- Where native = 1;
- IF sqlca.SQLCode <> 0 THEN
- arg_price = 0
- arg_rebate = 1
- rslt = 0
- GOTO ext
- end if
- SELECT u_sale_price_mx.price,
- u_sale_price_mx.rebate
- INTO :arg_price,
- :arg_rebate
- FROM u_sale_price_list,u_sale_price_mx
- WHERE u_sale_price_list.pricelistid = u_sale_price_mx.pricelistid
- AND u_sale_price_list.dftflag = 1
- AND u_sale_price_mx.mtrlid = :arg_mtrlid and u_sale_price_list.moneyid = :ll_moneyid;
- IF sqlca.SQLCode <> 0 THEN
- arg_price = 0
- arg_rebate = 1
- rslt = 0
- GOTO ext
- ELSEIF sqlca.SQLNRows = 0 THEN
- SELECT u_mtrldef.lmsaleprice
- INTO :arg_price
- FROM u_mtrldef
- Where u_mtrldef.mtrlid = :arg_mtrlid;
- IF sqlca.SQLCode <> 0 THEN
- arg_price = 0
- arg_rebate = 1
- rslt = 0
- GOTO ext
- END IF
- END IF
- ext:
- RETURN rslt
- end function
|