欢迎 510814171 加入本站!
 免费注册  用户登陆  汇款方式  汇款确认  产品报价  联系我们  帮助中心
加入收藏
设为首页
会员体系
申请VIP
网站首页 光盘超市 软件下载 技术文章 专题 用户中心 VIP会员 技术论坛 网站留言 娱乐中心 卓越资源
今天是:2008年11月20日 星期四  您现在位于: 首页 → 技术文章 → INFORMIX-4GL...
   INFORMIX-4GL实例
作者:大梦  出处:Unix爱好者家园unix-cd.com  更新时间: 2004年09月21日 
################################################################################
#                  版本号: Ver 1.0      研制时间:1999.12.15                    #
#                              作 者: 大梦                                     #
################################################################################
database slif
globals "glob.4gl"
main
 options prompt  line 24,
         error   line 24,
         message line 24,
         form    line 4,
         input   wrap,
         accept key interrupt   #### 使ESC键无效
 defer   interrupt
 set isolation to dirty read
 set lock mode to wait 5
 call startlog("slif_err.log")

 call public()

 menu "理赔登记子系统"
      command "A.录入登记" "对本机构的理赔案件进行录入处理"
               call M_a_main()
               call clea(4)

      command "B.查询修改" "对本机构登记的案件进行查询,修改,删除等处理"
               call M_b_main()
               call clea(4)

      command "C.理赔统计" "对本机构给付的案件进行统计处理"
               call M_c_main()
               call clea(4)

      command "D.打印流水" "对本机构给付的案件进行打印处理"
               call M_d_main()
               call clea(4)

      command "E.退出系统" "退出理赔案件管理子系统"
               clear screen
               exit menu
 end menu
end main

function M_a_main()
define list_rec record like give_list.*
define code_rec record like give_pol.*
open form M_main from "./form/M_main"
display form M_main
while 1
display "^即Ctrl ^B:求 助 ^Z:存 盘 ^E:退 出" at 4,1
initialize list_rec.* to null
let list_rec.log_date   = today
let list_rec.clerk_code = the_opr
let list_rec.branch_no  = cu_num
let list_rec.check_flag = 1
display ""     to s_pol
display ""     to s_sex
display "已赔" to s_flag
display by name list_rec.*
input by name list_rec.* without defaults
     after field give_no
           if list_rec.give_no is null then
              call disp_msg("赔案编号不得为空???")
              next field give_no
           end if
     after field ins_no
           if list_rec.ins_no is null then
              call disp_msg("保险证号不得为空???")
              next field ins_no
           end if
     after field ins_amt
           if list_rec.ins_amt is null then
              call disp_msg("保险金额不得为空???")
              next field ins_amt
           end if
           if list_rec.ins_amt = 0 then
              call disp_msg("保险金额不得为零???")
              next field ins_amt
           end if
           if list_rec.ins_amt < 0 then
              call disp_msg("保险金额不得小于零???")
              next field ins_amt
           end if
     after field pol_code
           if list_rec.pol_code is null then
              call disp_msg("险种代码不得为空???")
              next field pol_code
           else
              select * into code_rec.* from give_pol
                                      where pol_code = list_rec.pol_code
              if status = NOTFOUND then
                 call disp_msg("险种代码不存在???")
                 next field pol_code
              else
                display code_rec.pol_name to s_pol
              end if
           end if
     after field beg_date
           if list_rec.beg_date is null then
              call disp_msg("责任开始时间不得为空???")
              next field beg_date
           end if
           if list_rec.beg_date > today then
              call disp_msg("责任开始时间不得大于系统时间???")
              next field beg_date
           end if
           if list_rec.beg_date < mdy(1,1,1985) then
              call disp_msg("责任开始时间不在规定范围内???")
              next field beg_date
           end if
     after field end_date
           if list_rec.end_date is not null then
              if list_rec.end_date < list_rec.beg_date then
                 call disp_msg("终止时间不得小于起始时间???")
                 next field end_date
              end if
              if list_rec.end_date < mdy(1,1,1985) then
                 call disp_msg("责任终止时间不在规定范围内???")
                 next field end_date
              end if
           end if
     after field ipsn_name
           if list_rec.ipsn_name is null then
              call disp_msg("被保险人姓名不得为空???")
              next field ipsn_name
           end if
     after field ipsn_sex
           if list_rec.ipsn_sex is null then
              call disp_msg("被保险人性别不得为空???")
              next field ipsn_sex
           end if
           case list_rec.ipsn_sex
              when "F" display "" to s_sex
              when "M" display "" to s_sex
              otherwise call disp_msg("被保险人性别错???")
           end case
     after field happ_date
           if list_rec.happ_date is null then
              call disp_msg("出险时间不得为空???")
              next field happ_date
           end if
           if list_rec.happ_date > today then
              call disp_msg("出险时间不得大于系统时间???")
              next field happ_date
           end if
           if list_rec.happ_date < list_rec.beg_date
           or list_rec.happ_date > list_rec.end_date then
              call disp_msg("出险时间不在保险期间内???")
              next field happ_date
           end if
     after field in_date
           if list_rec.in_date is not null then
              if list_rec.in_date < list_rec.happ_date then
                 call disp_msg("入院时间不得小于出险时间???")
                 next field in_date
              end if
           end if
     after field hosp_addr
           if list_rec.in_date is not null then
              if list_rec.hosp_addr is null then
                 call disp_msg("住院地点不得为空???")
                 next field hosp_addr
              end if
           end if
     after field out_date
           if list_rec.in_date is not null then
              if list_rec.out_date < list_rec.in_date then
                 call disp_msg("出院时间不得小于入院时间???")
                 next field out_date
              end if
           end if
     after field diag_tes1
           if list_rec.diag_tes1 is null then
              call disp_msg("诊断证明不得为空???")
              next field diag_tes1            end if
     after field star_date
           if list_rec.star_date is null then
              call disp_msg("立案时间不得为空???")
              next field star_date
           end if
           if list_rec.star_date > today then
              call disp_msg("立案时间不得大于系统时间???")
              next field star_date
           end if
           if list_rec.star_date < list_rec.happ_date then
              call disp_msg("立案时间不得小于出险时间???")
              next field star_date
           end if
     after field give_amt1
           if list_rec.give_amt1 is null then
              let list_rec.give_amt1 = 0
              display by name list_rec.*
           end if
     after field give_amt2
           if list_rec.give_amt2 is null then
              let list_rec.give_amt2 = 0
              display by name list_rec.*
           end if
     after field give_amt3
           if list_rec.give_amt3 is null then
              let list_rec.give_amt3 = 0
              display by name list_rec.*
           end if
     after field give_amt4
           if list_rec.give_amt4 is null then
              let list_rec.give_amt4 = 0
              display by name list_rec.*
           end if
     after field give_amt5
           if list_rec.give_amt5 is null then
              let list_rec.give_amt5 = 0
              display by name list_rec.*
           end if
     after field give_amt6
           if list_rec.give_amt6 is null then
              let list_rec.give_amt6 = 0
              display by name list_rec.*
           end if
           let list_rec.count_amt = list_rec.give_amt1 + list_rec.give_amt2
                                  + list_rec.give_amt3 + list_rec.give_amt4
                                  + list_rec.give_amt5 + list_rec.give_amt6
           display by name list_rec.*
           if list_rec.count_amt < 0.01 then
              call disp_msg("合计给付金额错???")
              next field give_amt1
           end if
     after field check_date
           if list_rec.check_date is null then
              call disp_msg("审批时间不得为空???")
              next field check_date
           end if
           if list_rec.check_date > today then
              call disp_msg("审批时间不得大于系统时间???")
              next field check_date
           end if
           if list_rec.check_date < list_rec.star_date then
              call disp_msg("审批时间不应小于立案时间???")
              next field check_date
           end if
     after field check_flag
           if list_rec.check_flag is null then
              call disp_msg("理赔标志不得为空???")
              next field check_flag
           end if
           case list_rec.check_flag
              when "1" display "已赔" to s_flag
              when "0" display "拒赔" to s_flag
              otherwise call disp_msg("理赔标志错???")
           end case

     on key(control-b)
   if infield(pol_code) then
        let list_rec.pol_code = disp_pol()
              display by name list_rec.*
        next field pol_code
   end if

     on key(control-z)
           display by name list_rec.*
           call disp_msg("正在检测,请稍候...")
           if list_rec.give_no is null then
              call disp_msg("赔案编号不得为空???")
              next field give_no
           end if
           if list_rec.ins_no is null then
              call disp_msg("保险证号不得为空???")
              next field ins_no
           end if
           if list_rec.ins_amt is null then
              call disp_msg("保险金额不得为空???")
              next field ins_amt
           end if
           if list_rec.ins_amt = 0 then
              call disp_msg("保险金额不得为零???")
              next field ins_amt
           end if
           if list_rec.ins_amt < 0 then
              call disp_msg("保险金额不得小于零???")
              next field ins_amt
           end if
           if list_rec.pol_code is null then
              call disp_msg("险种代码不得为空???")
              next field pol_code
           else
              select * into code_rec.* from give_pol
                                      where pol_code = list_rec.pol_code
              if status = NOTFOUND then
                 call disp_msg("险种代码不存在???")
                 next field pol_code
              else
                display code_rec.pol_name to s_pol
              end if
           end if
           if list_rec.beg_date is null then
              call disp_msg("责任开始时间不得为空???")
              next field beg_date
           end if
           if list_rec.beg_date > today then
              call disp_msg("责任开始时间不得大于系统时间???")
              next field beg_date
           end if
           if list_rec.beg_date < mdy(1,1,1985) then
              call disp_msg("责任开始时间不在规定范围内???")
              next field beg_date
           end if
           if list_rec.end_date is not null then
              if list_rec.end_date < list_rec.beg_date then
                 call disp_msg("终止时间不得小于起始时间???")
                 next field end_date
              end if
              if list_rec.end_date < mdy(1,1,1985) then
                 call disp_msg("责任终止时间不在规定范围内???")
                 next field end_date
              end if
           end if
           if list_rec.ipsn_name is null then
              call disp_msg("被保险人姓名不得为空???")
              next field ipsn_name
           end if
           if list_rec.ipsn_sex is null then
              call disp_msg("被保险人性别不得为空???")
              next field ipsn_sex
           end if
           if list_rec.happ_date is null then
              call disp_msg("出险时间不得为空???")
              next field happ_date
           end if
           if list_rec.happ_date > today then
              call disp_msg("出险时间不得大于系统时间???")
              next field happ_date
           end if
           if list_rec.happ_date < list_rec.beg_date
           or list_rec.happ_date > list_rec.end_date then
              call disp_msg("出险时间不在保险期间内???")
              next field happ_date
           end if
           if list_rec.in_date is not null then
              if list_rec.in_date < list_rec.happ_date then
                 call disp_msg("入院时间不得小于出险时间???")
                 next field in_date
              end if
           end if
           if list_rec.in_date is not null then
              if list_rec.hosp_addr is null then
                 call disp_msg("住院地点不得为空???")
                 next field hosp_addr
              end if
           end if
           if list_rec.in_date is not null then
              if list_rec.out_date < list_rec.in_date then
                 call disp_msg("出院时间不得小于入院时间???")
                 next field out_date
              end if
           end if
           if list_rec.diag_tes1 is null then
              call disp_msg("诊断证明不得为空???")
              next field diag_tes1            end if
           if list_rec.star_date is null then
              call disp_msg("立案时间不得为空???")
              next field star_date
           end if
           if list_rec.star_date > today then
              call disp_msg("立案时间不得大于系统时间???")
              next field star_date
           end if
           if list_rec.star_date < list_rec.happ_date then
              call disp_msg("立案时间不得小于出险时间???")
              next field star_date
           end if
           if list_rec.give_amt1 is null then
              let list_rec.give_amt1 = 0
              display by name list_rec.*
           end if
           if list_rec.give_amt2 is null then
              let list_rec.give_amt2 = 0
              display by name list_rec.*
           end if
           if list_rec.give_amt3 is null then
              let list_rec.give_amt3 = 0
              display by name list_rec.*
           end if
           if list_rec.give_amt4 is null then
              let list_rec.give_amt4 = 0
              display by name list_rec.*
           end if
           if list_rec.give_amt5 is null then
              let list_rec.give_amt5 = 0
              display by name list_rec.*
           end if
           if list_rec.give_amt6 is null then
              let list_rec.give_amt6 = 0
              display by name list_rec.*
           end if
           let list_rec.count_amt = list_rec.give_amt1 + list_rec.give_amt2
                                  + list_rec.give_amt3 + list_rec.give_amt4
                                  + list_rec.give_amt5 + list_rec.give_amt6
           display by name list_rec.*
           if list_rec.count_amt < 0.01 then
              call disp_msg("合计给付金额错???")
              next field give_amt1
           end if
           if list_rec.check_date is null then
              call disp_msg("审批时间不得为空???")
              next field check_date
           end if
           if list_rec.check_date > today then
              call disp_msg("审批时间不得大于系统时间???")
              next field check_date
           end if
           if list_rec.check_date < list_rec.star_date then
              call disp_msg("审批时间不应小于立案时间???")
              next field check_date
           end if
           if list_rec.check_flag is null then
              call disp_msg("理赔标志不得为空???")
              next field check_flag
           end if
           error "";error ""
           open window z_win at 13,23 with 1 rows,35 columns
                                                  attribute(reverse,border)
           prompt "  是否写入当前案件登记情况[Y/y]?" for char answ
           close window z_win
           if answ matches "[Yy]" then
              call disp_msg("正在存盘,请稍候...")
              insert into give_list values(list_rec.*)
              call disp_msg("存盘成功,OK!")
              exit input
           else
              call disp_msg("没有执行任何操作,放弃存盘!")
           end if

     on key(control-e)
           error "";error ""
           open window e_win at 13,23 with 1 rows,35 columns
                                                     attribute(reverse,border)
           prompt "  是否真的要放弃录入工作[Y/y]??? " for char answ
           close window e_win
           if answ matches "[Yy]" then
              exit while
           end if
    end input
end while
close form M_main
end function

###################################
## 函数:M_b_main()               ##
## 功能:                         ##
##      查询修改                 ##
## 创建时间:1999.12.15           ##
###################################
function M_b_main()
define list_rec record like give_list.*,
      code_rec record like give_pol.*,
      que,str1,str2   char(1024),
      sum_row,cur_row decimal(12,0)
options form line 4
open form M_main from "./form/M_main"
display form M_main
while 1
     options accept key control-z
     display "^即Ctrl ^B:求 助 ^Z:确 认 ^E:退 出" at 4,1
     construct que on give_list.* from give_list.*
            on key(control-e)
               let int_flag = 1
               exit construct
            on key(control-b)
       if infield(pol_code) then
            let list_rec.pol_code = disp_pol()
                  display by name list_rec.pol_code
       end if
     end construct
     options accept key control-w
     if int_flag != 0 then
        let int_flag = 0
        return
     end if
  if cu_num matches "????00" then
     let str1 = " select rowid,give_list.* from give_list where ",que clipped
     let str2 = " select count(*)          from give_list where ",que clipped
  else
     let str1 = " select rowid,give_list.* from give_list where ",
                  que clipped," and branch_no = \"",cu_num,"\""
     let str2 = " select count(*)          from give_list where ",
                  que clipped," and branch_no = \"",cu_num,"\""
  end if
     let cur_row = 1
label beg:
 prepare see1 from str1
 prepare see2 from str2
 declare c1 scroll cursor for see1
 open c1
 declare c2 scroll cursor for see2
 open c2
 foreach c2 into sum_row
 end foreach
 fetch relative cur_row c1 into row_id,list_rec.*
 if sqlca.sqlcode = 0 then
    exit while
 else
    call disp_msg ("符合条件的记录没有找到???")
    return
 end if
end while
while 1
 options previous key control-p
 options next     key control-n
 options prompt line 24
 display sum_row to row_sum
 display cur_row to row_id
 display by name list_rec.*
 select * into code_rec.* from give_pol where pol_code = list_rec.pol_code
 display code_rec.pol_name to s_pol
 case list_rec.ipsn_sex
      when "F" display "" to s_sex
      when "M" display "" to s_sex
 end case
 case list_rec.check_flag
      when "1" display "已赔" to s_flag
      when "0" display "拒赔" to s_flag
 end case
 prompt "^即Ctrl ^N:下一记录  ^P:上一记录  ^U:修 改  ^O:删 除  ^E:退 出" for answ
 on key(control-n,down,right)
    fetch next c1 into row_id,list_rec.*
    if status = NOTFOUND then
call disp_msg("无后一条记录???")
    else
let cur_row = cur_row + 1
    end if

 on key(control-p,up,left)     fetch previous c1 into row_id,list_rec.*
    if status = NOTFOUND then
call disp_msg("无前一条记录???")
    else
let cur_row = cur_row - 1
    end if

 on key(control-o)
            error "";error ""
            open window o_win at 13,23 with 1 rows,35 columns
                                                   attribute(reverse,border)
            prompt "  是否删除当前案件登记情况[Y/y]?" for char answ
            close window o_win
    if answ matches "[Yy]" then
call disp_msg("正在删除,请稍候...")
begin work
     delete from give_list where rowid = row_id
commit work
call disp_msg("删除成功!!!")
if cur_row = sum_row then let cur_row = cur_row - 1 end if
goto beg
    else
call disp_msg("没有删除!!!")
    end if

 on key(control-u)
            input by name list_rec.* without defaults
            after field give_no
                  if list_rec.give_no is null then
                     call disp_msg("赔案编号不得为空???")
                     next field give_no
                  end if
            after field ins_no
                  if list_rec.ins_no is null then
                     call disp_msg("保险证号不得为空???")
                     next field ins_no
                  end if
            after field ins_amt
                  if list_rec.ins_amt is null then
                     call disp_msg("保险金额不得为空???")
                     next field ins_amt
                  end if
                  if list_rec.ins_amt = 0 then
                     call disp_msg("保险金额不得为零???")
                     next field ins_amt
                  end if
                  if list_rec.ins_amt < 0 then
                     call disp_msg("保险金额不得小于零???")
                     next field ins_amt
                  end if
            after field pol_code
                  if list_rec.pol_code is null then
                     call disp_msg("险种代码不得为空???")
                     next field pol_code
                  else
                     select * into code_rec.* from give_pol
                                             where pol_code = list_rec.pol_code
                     if status = NOTFOUND then
                        call disp_msg("险种代码不存在???")
                        next field pol_code
                     else
                       display code_rec.pol_name to s_pol
                     end if
                  end if
            after field beg_date
                  if list_rec.beg_date is null then
                     call disp_msg("责任开始时间不得为空???")
                     next field beg_date
                  end if
                  if list_rec.beg_date > today then
                     call disp_msg("责任开始时间不得大于系统时间???")
                     next field beg_date
                  end if
                  if list_rec.beg_date < mdy(1,1,1985) then
                     call disp_msg("责任开始时间不在规定范围内???")
                     next field beg_date
                  end if
            after field end_date
                  if list_rec.end_date is not null then
                     if list_rec.end_date < list_rec.beg_date then
                        call disp_msg("终止时间不得小于起始时间???")
                        next field end_date
                     end if
                     if list_rec.end_date < mdy(1,1,1985) then
                        call disp_msg("责任终止时间不在规定范围内???")
                        next field end_date
                     end if
                  end if
            after field ipsn_name
                  if list_rec.ipsn_name is null then
                     call disp_msg("被保险人姓名不得为空???")
                     next field ipsn_name
                  end if
            after field ipsn_sex
                  if list_rec.ipsn_sex is null then
                     call disp_msg("被保险人性别不得为空???")
                     next field ipsn_sex
                  end if
                  case list_rec.ipsn_sex
                     when "F" display "" to s_sex
                     when "M" display "" to s_sex
                     otherwise call disp_msg("被保险人性别错???")
                  end case
            after field happ_date
                  if list_rec.happ_date is null then
                     call disp_msg("出险时间不得为空???")
                     next field happ_date
                  end if
                  if list_rec.happ_date > today then
                     call disp_msg("出险时间不得大于系统时间???")
                     next field happ_date
                  end if
                  if list_rec.happ_date < list_rec.beg_date
                  or list_rec.happ_date > list_rec.end_date then
                     call disp_msg("出险时间不在保险期间内???")
                     next field happ_date
                  end if
            after field in_date
                  if list_rec.in_date is not null then
                     if list_rec.in_date < list_rec.happ_date then
                        call disp_msg("入院时间不得小于出险时间???")
                        next field in_date
                     end if
                  end if
            after field hosp_addr
                  if list_rec.in_date is not null then
                     if list_rec.hosp_addr is null then
                        call disp_msg("住院地点不得为空???")
                        next field hosp_addr
                     end if
                  end if
            after field out_date
                  if list_rec.in_date is not null then
                     if list_rec.out_date < list_rec.in_date then
                        call disp_msg("出院时间不得小于入院时间???")
                        next field out_date
                     end if
                  end if
            after field diag_tes1
                  if list_rec.diag_tes1 is null then
                     call disp_msg("诊断证明不得为空???")
                     next field diag_tes1                   end if
            after field star_date
                  if list_rec.star_date is null then
                     call disp_msg("立案时间不得为空???")
                     next field star_date
                  end if
                  if list_rec.star_date > today then
                     call disp_msg("立案时间不得大于系统时间???")
                     next field star_date
                  end if
                  if list_rec.star_date < list_rec.happ_date then
                     call disp_msg("立案时间不得小于出险时间???")
                     next field star_date
                  end if
            after field give_amt1
                  if list_rec.give_amt1 is null then
                     let list_rec.give_amt1 = 0
                     display by name list_rec.*
                  end if
            after field give_amt2
                  if list_rec.give_amt2 is null then
                     let list_rec.give_amt2 = 0
                     display by name list_rec.*
                  end if
            after field give_amt3
                  if list_rec.give_amt3 is null then
                     let list_rec.give_amt3 = 0
                     display by name list_rec.*
                  end if
            after field give_amt4
                  if list_rec.give_amt4 is null then
                     let list_rec.give_amt4 = 0
                     display by name list_rec.*
                  end if
            after field give_amt5
                  if list_rec.give_amt5 is null then
                     let list_rec.give_amt5 = 0
                     display by name list_rec.*
                  end if
            after field give_amt6
                  if list_rec.give_amt6 is null then
                     let list_rec.give_amt6 = 0
                     display by name list_rec.*
                  end if
                  let list_rec.count_amt=list_rec.give_amt1+list_rec.give_amt2
                                        +list_rec.give_amt3+list_rec.give_amt4
                                        +list_rec.give_amt5+list_rec.give_amt6
                  display by name list_rec.*
                  if list_rec.count_amt < 0.01 then
                     call disp_msg("合计给付金额错???")
                     next field give_amt1
                  end if
            after field check_date
                  if list_rec.check_date is null then
                     call disp_msg("审批时间不得为空???")
                     next field check_date
                  end if
                  if list_rec.check_date > today then
                     call disp_msg("审批时间不得大于系统时间???")
                     next field check_date
                  end if
                  if list_rec.check_date < list_rec.star_date then
                     call disp_msg("审批时间不应小于立案时间???")
                     next field check_date
                  end if
            after field check_flag
                  if list_rec.check_flag is null then
                     call disp_msg("理赔标志不得为空???")
                     next field check_flag
                  end if
                  case list_rec.check_flag
                       when "1" display "已赔" to s_flag
                       when "0" display "拒赔" to s_flag
                       otherwise call disp_msg("理赔标志错???")
                  end case
                  on key(control-b)
          if infield(pol_code) then
               let list_rec.pol_code = disp_pol()
                     display by name list_rec.*
               next field pol_code
          end if

            on key(control-z)
                  display by name list_rec.*
                  call disp_msg("正在检测,请稍候...")
                  if list_rec.give_no is null then
                     call disp_msg("赔案编号不得为空???")
                     next field give_no
                  end if
                  if list_rec.ins_no is null then
                     call disp_msg("保险证号不得为空???")
                     next field ins_no
                  end if
                  if list_rec.ins_amt is null then
                     call disp_msg("保险金额不得为空???")
                     next field ins_amt
                  end if
                  if list_rec.ins_amt = 0 then
                     call disp_msg("保险金额不得为零???")
                     next field ins_amt
                  end if
                  if list_rec.ins_amt < 0 then
                     call disp_msg("保险金额不得小于零???")
                     next field ins_amt
                  end if
                  if list_rec.pol_code is null then
                     call disp_msg("险种代码不得为空???")
                     next field pol_code
                  else
                     select * into code_rec.* from give_pol
                                             where pol_code = list_rec.pol_code
                     if status = NOTFOUND then
                        call disp_msg("险种代码不存在???")
                        next field pol_code
                     end if
                  end if
                  if list_rec.beg_date is null then
                     call disp_msg("责任开始时间不得为空???")
                     next field beg_date
                  end if
                  if list_rec.beg_date > today then
                     call disp_msg("责任开始时间不得大于系统时间???")
                     next field beg_date
                  end if
                  if list_rec.beg_date < mdy(1,1,1985) then
                     call disp_msg("责任开始时间不在规定范围内???")
                     next field beg_date
                  end if
                  if list_rec.end_date is not null then
                     if list_rec.end_date < list_rec.beg_date then
                        call disp_msg("终止时间不得小于起始时间???")
                        next field end_date
                     end if
                     if list_rec.end_date < mdy(1,1,1985) then
                        call disp_msg("责任终止时间不在规定范围内???")
                        next field end_date
                     end if
                  end if
                  if list_rec.ipsn_name is null then
                     call disp_msg("被保险人姓名不得为空???")
                     next field ipsn_name
                  end if
                  if list_rec.ipsn_sex is null then
                     call disp_msg("被保险人性别不得为空???")
                     next field ipsn_sex
                  end if
                  if list_rec.happ_date is null then
                     call disp_msg("出险时间不得为空???")
                     next field happ_date
                  end if
                  if list_rec.happ_date > today then
                     call disp_msg("出险时间不得大于系统时间???")
                     next field happ_date
                  end if
                  if list_rec.happ_date < list_rec.beg_date
                  or list_rec.happ_date > list_rec.end_date then
                     call disp_msg("出险时间不在保险期间内???")
                     next field happ_date
                  end if
                  if list_rec.in_date is not null then
                     if list_rec.in_date < list_rec.happ_date then
                        call disp_msg("入院时间不得小于出险时间???")
                        next field in_date
                     end if
                  end if
                  if list_rec.in_date is not null then
                     if list_rec.hosp_addr is null then
                        call disp_msg("住院地点不得为空???")
                        next field hosp_addr
                     end if
                  end if
                  if list_rec.in_date is not null then
                     if list_rec.out_date < list_rec.in_date then
                        call disp_msg("出院时间不得小于入院时间???")
                        next field out_date
                     end if
                  end if
                  if list_rec.diag_tes1 is null then
                     call disp_msg("诊断证明不得为空???")
                     next field diag_tes1                   end if
                  if list_rec.star_date is null then
                     call disp_msg("立案时间不得为空???")
                     next field star_date
                  end if
                  if list_rec.star_date > today then
                     call disp_msg("立案时间不得大于系统时间???")
                     next field star_date
                  end if
                  if list_rec.star_date < list_rec.happ_date then
                     call disp_msg("立案时间不得小于出险时间???")
                     next field star_date
                  end if
                  if list_rec.give_amt1 is null then
                     let list_rec.give_amt1 = 0
                     display by name list_rec.*
                  end if
                  if list_rec.give_amt2 is null then
                     let list_rec.give_amt2 = 0
                     display by name list_rec.*
                  end if
                  if list_rec.give_amt3 is null then
                     let list_rec.give_amt3 = 0
                     display by name list_rec.*
                  end if
                  if list_rec.give_amt4 is null then
                     let list_rec.give_amt4 = 0
                     display by name list_rec.*
                  end if
                  if list_rec.give_amt5 is null then
                     let list_rec.give_amt5 = 0
                     display by name list_rec.*
                  end if
                  if list_rec.give_amt6 is null then
                     let list_rec.give_amt6 = 0
                     display by name list_rec.*
                  end if
                  let list_rec.count_amt=list_rec.give_amt1+list_rec.give_amt2
                                        +list_rec.give_amt3+list_rec.give_amt4
                                        +list_rec.give_amt5+list_rec.give_amt6
                  display by name list_rec.*
                  if list_rec.count_amt < 0.01 then
                     call disp_msg("合计给付金额错???")
                     next field give_amt1
                  end if
                  if list_rec.check_date is null then
                     call disp_msg("审批时间不得为空???")
                     next field check_date
                  end if
                  if list_rec.check_date > today then
                     call disp_msg("审批时间不得大于系统时间???")
                     next field check_date
                  end if
                  if list_rec.check_date < list_rec.star_date then
                     call disp_msg("审批时间不应小于立案时间???")
                     next field check_date
                  end if
                  if list_rec.check_flag is null then
                     call disp_msg("理赔标志不得为空???")
                     next field check_flag
                  end if
           error "";error ""
           open window u_win at 13,23 with 1 rows,35 columns
                                                  attribute(reverse,border)
           prompt "  是否修改当前案件登记情况[Y/y]?" for char answ
           close window u_win
           if answ matches "[Yy]" then
              call disp_msg("正在修改,请稍候...")
              begin work
                update give_list set give_list.*=list_rec.* where rowid=row_id
              commit work
              call disp_msg("修改成功,OK!")
              goto beg
              exit input
           else
              call disp_msg("没有执行任何操作,放弃修改!")
           end if

           on key(control-e)
                 error "";error ""
                 open window e1_win at 13,23 with 1 rows,35 columns
                                                     attribute(reverse,border)
                 prompt "  是否真的要放弃修改工作[Y/y]??? " for char answ
                 close window e1_win
                 if answ matches "[Yy]" then
                    exit input
                 end if
           end input

     on key(control-e)
           error "";error ""
           open window e2_win at 13,23 with 1 rows,35 columns
                                                     attribute(reverse,border)
           prompt "  是否真的要放弃查询工作[Y/y]??? " for char answ
           close window e2_win
           if answ matches "[Yy]" then
              exit while
           end if
end prompt
end while
close form M_main
end function

###################################
## 函数:M_c_main()               ##
## 功能:                         ##
##      理赔统计                 ##
## Create: 2000.2.22             ##
###################################
function M_c_main()
define input_rec record
      bran_no   char(6),
      tj_flag   char(1),
      s_clerk_code char(10),
      beg_date  date,
      end_date  date
      end record
define bran_name,tj_name  char(20)
define i,j,m,n,a,b,c,d,e  integer
define str,str0,str1,str2,str3 char(512)
define sum_amnt           decimal(12,2)
define p_tj array[300] of record
      pol_code char(4),
      pol_name char(40),
      pay_cou  integer,
      pay_amt  decimal(12,2)
      end record
define tj_rec record
      pol_code char(4),
      pol_name char(40),
      pay_cou  integer,
      pay_amt  decimal(12,2)
      end record
open form M_c_main from "M_c_main"
while true
     display form M_c_main
    #call clea(17)
     initialize input_rec.* to null
     let bran_name = "                     "
     let tj_name   = "                     "
     display bran_name at  8,45
     display tj_name   at 10,40
     let input_rec.bran_no  = cu_num
     let input_rec.tj_flag  = 1
     let input_rec.beg_date = today
     let input_rec.end_date = today
     display by name input_rec.*
     input by name input_rec.* without defaults
           after field bran_no
                 if input_rec.bran_no is null then
                    call disp_msg("Sorry,机构代码不得为空???")
                    next field bran_no
                 end if
                 if cu_num not matches "????00" then
                    let input_rec.bran_no = cu_num
                 end if
                 display by name input_rec.*
                 select branch_name into bran_name
                   from branch
                  where branch_no = input_rec.bran_no
                 if status = 100 then
                    call disp_msg("Sorry,机构代码不存在???")
                    let input_rec.bran_no = cu_num
                    display by name input_rec.*
                    next field bran_no
                 end if
                 display bran_name at 8,45 attribute(reverse)
           after field tj_flag
                 if input_rec.tj_flag is null then
                    call disp_msg("Sorry,统计口径不得为空???")
                    next field tj_flag
                 end if
                 case input_rec.tj_flag                       when '1' let tj_name = "开户时间"
                      when '2' let tj_name = "出险时间"
                      when '3' let tj_name = "立案时间"
                      when '4' let tj_name = "审批时