f_find_tax.srf 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. $PBExportHeader$f_find_tax.srf
  2. global type f_find_tax from function_object
  3. end type
  4. forward prototypes
  5. global function integer f_find_tax (integer arg_cusid, integer arg_mtrlid, ref string arg_cusmtrlcode, ref string arg_cusmtrlname, ref string arg_cusmtrlmode)
  6. global function integer f_find_tax (integer arg_id, string arg_table, ref decimal arg_tax)
  7. end prototypes
  8. global function integer f_find_tax (integer arg_cusid, integer arg_mtrlid, ref string arg_cusmtrlcode, ref string arg_cusmtrlname, ref string arg_cusmtrlmode);Int rslt = 1
  9. SELECT cusmtrlcode, cusmtrlname, cusmtrlmode
  10. into :arg_cusmtrlcode, :arg_cusmtrlname, :arg_cusmtrlmode
  11. FROM u_cusmtrlname
  12. where cusid = :arg_cusid and mtrlid = :arg_mtrlid;
  13. IF sqlca.SQLCode <> 0 THEN
  14. rslt = 0
  15. GOTO ext
  16. END IF
  17. ext:
  18. RETURN rslt
  19. end function
  20. global function integer f_find_tax (integer arg_id, string arg_table, ref decimal arg_tax);Int rslt = 1
  21. IF arg_table = 'u_cust' then
  22. SELECT tax
  23. into :arg_tax
  24. FROM u_cust
  25. where cusid = :arg_id;
  26. IF sqlca.SQLCode <> 0 THEN
  27. rslt = 0
  28. GOTO ext
  29. END IF
  30. ELSEIF arg_table = 'u_spt' then
  31. SELECT tax
  32. into :arg_tax
  33. FROM u_spt
  34. where sptid = :arg_id;
  35. IF sqlca.SQLCode <> 0 THEN
  36. rslt = 0
  37. GOTO ext
  38. END IF
  39. ELSE
  40. rslt = 0
  41. END IF
  42. ext:
  43. RETURN rslt
  44. end function