$PBExportHeader$f_check_billdate.srf global type f_check_billdate from function_object end type forward prototypes global function integer f_check_billdate (datetime arg_billdate) global function integer f_check_billdate (datetime arg_billdate, ref string arg_msg) end prototypes global function integer f_check_billdate (datetime arg_billdate);int rslt = 1 return rslt end function global function integer f_check_billdate (datetime arg_billdate, ref string arg_msg);Int rslt = 1 Long li_cmonth,cnt IF Not sys_accsetbegin THEN rslt = 1 GOTO ext END IF SELECT count(*) Into :cnt From cw_calendar; IF sqlca.SQLCode <> 0 THEN arg_msg = '查询会计日历失败,原因:'+sqlca.SQLErrText rslt = 0 GOTO ext END IF IF cnt = 0 THEN rslt = 1 GOTO ext END IF SELECT cmonth Into :li_cmonth From cw_calendar Where sdate <= :arg_billdate And dateadd(d, 1, edate) > :arg_billdate; IF sqlca.SQLCode <> 0 THEN arg_msg = '非法日期,不在本年会计期间范围内,请检查' rslt = 0 GOTO ext END IF IF li_cmonth < sys_curyearmon THEN arg_msg = '日期所属会计期间会计已经结帐,不能在本期间内增加单据' rslt = 0 GOTO ext END IF ext: RETURN rslt end function