f_rst_mon_1st.srf 890 B

12345678910111213141516171819202122232425262728293031323334353637
  1. $PBExportHeader$f_rst_mon_1st.srf
  2. $PBExportComments$返回日期
  3. global type f_rst_mon_1st from function_object
  4. end type
  5. forward prototypes
  6. global function datetime f_rst_mon_1st (integer arg_type, long arg_yearmon)
  7. end prototypes
  8. global function datetime f_rst_mon_1st (integer arg_type, long arg_yearmon);//返回月第一天
  9. //f_rst_mon_1st(arg_type,arg_yearmon)
  10. //arg_type
  11. //1:当月第一天
  12. //2:下月第一天
  13. //3:当月最后一天
  14. datetime rst_next_1st
  15. datetime sdate,edate
  16. select sdate,edate into :sdate,:edate
  17. from cw_calendar
  18. where accsetid = :sys_accsetid
  19. and cmonth = :arg_yearmon;
  20. choose case arg_type
  21. case 1
  22. rst_next_1st = sdate
  23. case 2
  24. rst_next_1st = datetime(RelativeDate ( date(string(edate,'yyyy-mm-dd')), 1 ),time(0))
  25. case 3
  26. rst_next_1st = datetime(date(string(edate,'yyyy-mm-dd')),time('23:59:59'))
  27. end choose
  28. return rst_next_1st
  29. end function