开发工具:
文件大小: 351kb
下载次数: 0
上传时间: 2012-09-25
详细说明: ############ 提取数据 Declare cur_b Cursor For select documentno,policyno,deskdate,mancode,kindcode,insurant,mainamount into documentnov,policynov,deskdatev,mancodev,kindcodev,insurantv,mainamountv from sf02 where deskdate between sdate and edate and ksdm in ("41090099","41099200") and mancode=handlercodev and kindcode in ("R21","R29","R30","R39","RB0","RB1","RB2","RB3&q uot;,"P10","P19","P30","P39","PB0","PB1","PB2","PB3","P16","P17","P36","P37") and documentno[2,4] in ('EFW','EFX','LBR','EFU','LBQ','LBS','EAK','EAG','EAJ','EFF','EFG','EJQ','JEB','EJP') and procflag is not null and procflag<>"R" and procflag<>"" and not exists ( select * from ksyw_basic where ksyw_basic.documentno=sf02.documentno and ksyw_basic.kindcode=sf02.kindcode ) foreach cur_b if kindcodev[1]="P" then let mainamountv=-mainamountv end if if documentnov[2]="D" then select count(*) into tmpcnt from c_cmain where policyno=policynov and startdate between "01/01/2009" and "12/31/2009" else select count(*) into tmpcnt from p_cmain where policyno=policynov and startdate between "01/01/2009" and "12/31/2009" end if if tmpcnt>0 then ## 是本年度业务 insert into ksyw_basic values (documentnov,deskdatev,mancodev,kindcodev, mainamountv,insurantv,"1") end if end foreach ############ 计算得分 ## 月度任务 let monthtargetv=targetpremiumv/11 ## 当月保费 select count(*),sum(mainamount) into cnt,mainamountv From ksyw_basic Where mancode=handlercodev and deskdate between msdate and edate if cnt<=0 then let mainamountv=0 end if let monthpremiumv=mainamountv ## 累计保费 select count(*),sum(mainamount) into cnt,mainamountv From ksyw_basic Where mancode=handlercodev and deskdate between "01/01/2009" and edate if cnt<=0 then let mainamountv=0 end if let totalpremiumv=mainamountv ## 累计当月保费(由累计保费计算得来的当月保费) let tmpremiumv=totalpremiumv-targetpremiumv*(month(edate)-1)/11 ## 当月完成比例 let monthratev=monthpremiumv/monthtargetv*100 if monthratev<0 then let monthratev=0 end if ## 累计完成比例 let totalratev=totalpremiumv/targetpremiumv*100 if totalratev<0 then let totalratev=0 end if ## 月度得分 if monthpremiumv>tmpremiumv then let mpremiumv=monthpremiumv else let mpremiumv=tmpremiumv end if let monthmarkv=mpremiumv/monthtargetv*30 if monthmarkv>30 then let monthmarkv=30 else if monthmarkv<0 then let monthmarkv=0 end if end if select count(*) into cnt from ksyw_recmark where employeeid=employeeidv if cnt<=0 then insert into ksyw_recmark values (edate,dprtidv,employeeidv,handlercodev,employeenamev,targetpremiumv,flagv,monthtargetv,monthpremiumv,totalpremiumv,tmpremiumv,monthratev,totalratev,monthmarkv,0,0,0,0) else update ksyw_recmark set monthpremium=monthpremiumv, totalpremium=totalpremiumv, tmpremium=tmpremiumv, monthrate=monthratev, totalrate=totalratev, monthmark=monthmarkv where statdate=edate and employeeid=employeeidv end if end foreach ############## 计算部门得分 Declare cur_r Cursor For Select dprtid,sum(targetpremium),sum(monthpremium),sum(totalpremium) into dprtidv,targetpremiumv,monthpremiumv,totalpremiumv From ksyw_recmark Where flag<>"0" and flag<>"9" and flag<>"A" and statdate=edate group by dprtid foreach cur_r ## 月度任务 let monthtargetv=targetpremiumv/11 ## 当月完成比例 let dmonthratev=monthpremiumv/monthtargetv*100 if dmonthratev<0 then let dmonthratev=0 end if ## 累计完成比例 let dtotalratev=totalpremiumv/targetpremiumv*100 if dtotalratev<0 then let dtotalratev=0 end if ## 累计本月保费 let tmpremiumv=totalpremiumv-targetpremiumv*(month(edate)-1)/11 ## 月度得分 if monthpremiumv>tmpremiumv then let mpremiumv=monthpremiumv else let mpremiumv=tmpremiumv end if let dmonthmarkv=mpremiumv/monthtargetv*30 if dmonthmarkv>30 then let dmonthmarkv=30 else if dmonthmarkv<0 then let dmonthmarkv=0 end if end if if dmonthmarkv>=22.5 then select monthmark into monthmarkv from ksyw_recmark where dprtid=dprtidv and flag="5" and statdate=edate if monthmarkv<22.5 then let dmonthmarkv=0 end if else let dmonthmarkv=0 end if ## 部门人员人数 select count(*) into membercountv from ksyw_user where dprtid=dprtidv and flag<>"0" update ksyw_recmark set dmonthrate=dmonthratev, dtotalrate=dtotalratev, dmonthmark=dmonthmarkv, membercount=membercountv where dprtid=dprtidv and flag="5" and statdate=edate ## 清A数据 update ksyw_recmark set targetpremium=0, monthtarget=0, monthpremium=0, totalpremium=0, tmpremium=0, monthrate=0, totalrate=0, monthmark=0 where flag="A" and statdate=edate End Foreach End Main ...展开收缩
(系统自动生成,下载前可以参看下载内容)
下载文件列表
相关说明
- 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
- 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度。
- 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
- 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
- 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
- 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.