f_get_defsptprice.srf 1.0 KB

123456789101112131415161718192021222324252627282930313233343536
  1. $PBExportHeader$f_get_defsptprice.srf
  2. global type f_get_defsptprice from function_object
  3. end type
  4. forward prototypes
  5. global function integer f_get_defsptprice (long arg_sptid, long arg_mtrlid, string arg_unit, string arg_status, string arg_pcode, string arg_woodcode, ref decimal arg_def_dftsptprice)
  6. end prototypes
  7. global function integer f_get_defsptprice (long arg_sptid, long arg_mtrlid, string arg_unit, string arg_status, string arg_pcode, string arg_woodcode, ref decimal arg_def_dftsptprice);Long rslt = 1
  8. Decimal rtn_price
  9. SELECT top 1 fprice
  10. INTO :rtn_price
  11. FROM u_spt_price_mx
  12. WHERE u_spt_price_mx.mtrlid = :arg_mtrlid
  13. AND u_spt_price_mx.sptid = :arg_sptid
  14. AND u_spt_price_mx.unit = :arg_unit
  15. AND u_spt_price_mx.status = :arg_status
  16. AND u_spt_price_mx.woodcode = :arg_woodcode
  17. AND u_spt_price_mx.pcode = :arg_pcode
  18. AND u_spt_price_mx.billtype = 2
  19. Order By Opdate Desc;
  20. IF sqlca.SQLCode <> 0 THEN
  21. rslt = 0
  22. rtn_price = 0.00
  23. GOTO ext
  24. END IF
  25. ext:
  26. arg_def_dftsptprice = rtn_price
  27. RETURN rslt
  28. end function