f_get_defsptprice.srf 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  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,a
  8. Decimal rtn_price
  9. a = 1
  10. SELECT top 1 fprice
  11. INTO :rtn_price
  12. FROM u_spt_price_mx
  13. WHERE u_spt_price_mx.mtrlid = :arg_mtrlid
  14. AND u_spt_price_mx.sptid = :arg_sptid
  15. AND u_spt_price_mx.unit = :arg_unit
  16. AND u_spt_price_mx.status = :arg_status
  17. AND u_spt_price_mx.woodcode = :arg_woodcode
  18. AND u_spt_price_mx.pcode = :arg_pcode
  19. AND u_spt_price_mx.billtype = 2
  20. Order By Opdate Desc;
  21. IF sqlca.SQLCode <> 0 THEN
  22. rslt = 0
  23. rtn_price = 0.00
  24. GOTO ext
  25. END IF
  26. ext:
  27. arg_def_dftsptprice = rtn_price
  28. RETURN rslt
  29. end function