f_idcard_process.srf 1017 B

12345678910111213141516171819202122232425262728293031323334353637
  1. $PBExportHeader$f_idcard_process.srf
  2. global type f_idcard_process from function_object
  3. end type
  4. forward prototypes
  5. global subroutine f_idcard_process (string idcardcode, ref s_idcard_change s_idcard, integer mode)
  6. end prototypes
  7. global subroutine f_idcard_process (string idcardcode, ref s_idcard_change s_idcard, integer mode);datetime ls_date
  8. string ls_year,ls_mth,ls_day,ls_sex
  9. if mode =1 then //15位
  10. ls_year=mid(idcardcode,7,2)
  11. if mid(ls_year,1,1)='0' then
  12. ls_year='20'+ls_year
  13. else
  14. ls_year='19'+ls_year
  15. end if
  16. ls_date=datetime(date(ls_year+'/'+mid(idcardcode,9,2)+'/'+mid(idcardcode,11,2)),time('00:00:00'))
  17. if mod(integer(right(idcardcode,1)),2)=1 then
  18. ls_sex='男'
  19. else
  20. ls_sex='女'
  21. end if
  22. else
  23. ls_year=mid(idcardcode,7,4)
  24. ls_date=datetime(date(ls_year+'/'+mid(idcardcode,11,2)+'/'+mid(idcardcode,13,2)),time('00:00:00'))
  25. if mod(integer(mid(idcardcode,17,1)),2)=1 then
  26. ls_sex='男'
  27. else
  28. ls_sex='女'
  29. end if
  30. end if
  31. s_idcard.birthday=ls_date
  32. s_idcard.sex=ls_sex
  33. end subroutine