procedure ReBuild_IE02(
pi_aac001 in number,
po_fhz out varchar2,
po_msg out varchar2)
is
type typ_tab_ie02 is table of ie02%rowtype index by binary_integer;
type typ_rec_InterestRate is record(
YearRate number(8, 6),
MonthRate number(7, 6)
);
type typ_tab_InterestRate is table of typ_rec_InterestRate index by binary_integer; cursor cur_list is
select ic50.bae001, --系统机构代码
ic50.aab001, --组织ID-即虚拟单位编号
ic50.aac001, --个人编号
case when nvl(ic52.aab383, 0) - nvl(ic52.aic021, 0) > 0 then nvl(ic52.aab383, 0) - nvl(ic52.aic021, 0) else 0 end aic441, --划入统筹金额 = 应缴金额 - 划入账户金额
case when nvl(ic52.aic452, 0) > 0 then nvl(ic52.aic452, 0) else 0 end aic452, --政府补贴金额
aae002
from ic50,
ic52
where ic50.aac001 = ic52.aac001
and ic50.aac001 = pi_aac001
and ic52.bce094 = '' --缴费标志
and ic52.aae016 = ''; --复核标志 i_count integer;
s_bae001 ac01.bae001%type;
n_aab001 ac01.aab001%type;
n_MinYear_ie02 number(4);
n_SysCurYear number(4);
n_LoopYear number(4);
n_LoopMonth number(2);
tab_ie02 typ_tab_ie02;
tab_InterestRate typ_tab_InterestRate; procedure GetMinYear_ie02
is
begin
select min(aae001)
into n_MinYear_ie02
from ic52
where aac001 = pi_aac001
and bce094 = ''
and aae016 = '';
end GetMinYear_ie02; procedure Init_tab_ie02
is
begin
for i in n_MinYear_ie02..n_SysCurYear loop
tab_ie02(i).bae001 := s_bae001; --系统机构代码
tab_ie02(i).aab001 := n_aab001; --组织ID
tab_ie02(i).aac001 := pi_aac001; --人员ID
tab_ie02(i).aae001 := i; --账户年度
tab_ie02(i).cic103 := 0; --截止上年末个人缴费划拨统筹部分累计本息
tab_ie02(i).cic105 := 0; --1月增加个人缴费划拨统筹部分金额
tab_ie02(i).cic106 := 0; --2月增加个人缴费划拨统筹部分金额
tab_ie02(i).cic107 := 0; --3月增加个人缴费划拨统筹部分金额
tab_ie02(i).cic108 := 0; --4月增加个人缴费划拨统筹部分金额
tab_ie02(i).cic109 := 0; --5月增加个人缴费划拨统筹部分金额
tab_ie02(i).cic110 := 0; --6月增加个人缴费划拨统筹部分金额
tab_ie02(i).cic111 := 0; --7月增加个人缴费划拨统筹部分金额
tab_ie02(i).cic112 := 0; --8月增加个人缴费划拨统筹部分金额
tab_ie02(i).cic113 := 0; --9月增加个人缴费划拨统筹部分金额
tab_ie02(i).cic114 := 0; --10月增加个人缴费划拨统筹部分金额
tab_ie02(i).cic115 := 0; --11月增加个人缴费划拨统筹部分金额
tab_ie02(i).cic116 := 0; --12月增加个人缴费划拨统筹部分金额
tab_ie02(i).cic117 := 0; --本年个人缴费划拨统筹部分本金总额
tab_ie02(i).cic131 := 0; --本年缴纳个人缴费划拨统筹部分本年计入利息
tab_ie02(i).cic133 := 0; --截止上年末个人缴费划拨统筹部分累计本息在本年产生的利息
tab_ie02(i).cic135 := 0; --截止本年末个人缴费划拨统筹部分累计储存额(本息)
tab_ie02(i).aae013 := null; --备注
end loop;
end Init_tab_ie02; procedure Init_tab_InterestRate
is
begin
for i in n_MinYear_ie02..n_SysCurYear loop
GetAcctYearlyRate(
i,
'',
tab_InterestRate(i).YearRate,
po_fhz,
po_msg);
if po_fhz <> pkg_pub.def_OK then
return;
end if; tab_InterestRate(i).MonthRate := round(tab_InterestRate(i).YearRate / 12, 6);
end loop;
end Init_tab_InterestRate; procedure FillinAllotCorpusAmt(ai_aic441 in number) --划入统筹金额
is
begin
if ai_aic441 <> 0 then
case n_LoopMonth
when 1 then tab_ie02(n_LoopYear).cic105 := tab_ie02(n_LoopYear).cic105 + ai_aic441; --1月增加个人缴费划拨统筹部分金额
when 2 then tab_ie02(n_LoopYear).cic106 := tab_ie02(n_LoopYear).cic106 + ai_aic441; --2月增加个人缴费划拨统筹部分金额
when 3 then tab_ie02(n_LoopYear).cic107 := tab_ie02(n_LoopYear).cic107 + ai_aic441; --3月增加个人缴费划拨统筹部分金额
when 4 then tab_ie02(n_LoopYear).cic108 := tab_ie02(n_LoopYear).cic108 + ai_aic441; --4月增加个人缴费划拨统筹部分金额
when 5 then tab_ie02(n_LoopYear).cic109 := tab_ie02(n_LoopYear).cic109 + ai_aic441; --5月增加个人缴费划拨统筹部分金额
when 6 then tab_ie02(n_LoopYear).cic110 := tab_ie02(n_LoopYear).cic110 + ai_aic441; --6月增加个人缴费划拨统筹部分金额
when 7 then tab_ie02(n_LoopYear).cic111 := tab_ie02(n_LoopYear).cic111 + ai_aic441; --7月增加个人缴费划拨统筹部分金额
when 8 then tab_ie02(n_LoopYear).cic112 := tab_ie02(n_LoopYear).cic112 + ai_aic441; --8月增加个人缴费划拨统筹部分金额
when 9 then tab_ie02(n_LoopYear).cic113 := tab_ie02(n_LoopYear).cic113 + ai_aic441; --9月增加个人缴费划拨统筹部分金额
when 10 then tab_ie02(n_LoopYear).cic114 := tab_ie02(n_LoopYear).cic114 + ai_aic441; --10月增加个人缴费划拨统筹部分金额
when 11 then tab_ie02(n_LoopYear).cic115 := tab_ie02(n_LoopYear).cic115 + ai_aic441; --11月增加个人缴费划拨统筹部分金额
when 12 then tab_ie02(n_LoopYear).cic116 := tab_ie02(n_LoopYear).cic116 + ai_aic441; --12月增加个人缴费划拨统筹部分金额
end case; tab_ie02(n_LoopYear).cic117 := tab_ie02(n_LoopYear).cic117 + ai_aic441; --本年个人缴费划拨统筹部分本金总额
end if;
end FillinAllotCorpusAmt; procedure CalculateAccountAccrual
is
n_cic103 number(8, 2); --截止上年末个人缴费划拨统筹部分累计本息
n_AccrualEndMonth number(2);
begin
n_cic103 := 0;
for n_year in tab_ie02.First..tab_ie02.Last loop
tab_ie02(n_year).cic103 := n_cic103; if n_year < n_SysCurYear then
n_AccrualEndMonth := 12;
else
n_AccrualEndMonth := to_number(to_char(sysdate, 'mm'));
end if; --按正常按时缴费模式处理,从缴费当月起计息
for n_month in 1..n_AccrualEndMonth loop
--1月份
if n_month = 1 then
if tab_ie02(n_year).cic105 <> 0 and n_AccrualEndMonth >= n_month then
tab_ie02(n_year).cic131 := tab_ie02(n_year).cic131 + tab_InterestRate(n_year).MonthRate * tab_ie02(n_year).cic105 * (n_AccrualEndMonth - n_month + 1);
end if;
--2月份
elsif n_month = 2 then
if tab_ie02(n_year).cic106 <> 0 and n_AccrualEndMonth >= n_month then
tab_ie02(n_year).cic131 := tab_ie02(n_year).cic131 + tab_InterestRate(n_year).MonthRate * tab_ie02(n_year).cic106 * (n_AccrualEndMonth - n_month + 1);
end if;
--3月份
elsif n_month = 3 then
if tab_ie02(n_year).cic107 <> 0 and n_AccrualEndMonth >= n_month then
tab_ie02(n_year).cic131 := tab_ie02(n_year).cic131 + tab_InterestRate(n_year).MonthRate * tab_ie02(n_year).cic107 * (n_AccrualEndMonth - n_month + 1);
end if;
--4月份
elsif n_month = 4 then
if tab_ie02(n_year).cic108 <> 0 and n_AccrualEndMonth >= n_month then
tab_ie02(n_year).cic131 := tab_ie02(n_year).cic131 + tab_InterestRate(n_year).MonthRate * tab_ie02(n_year).cic108 * (n_AccrualEndMonth - n_month + 1);
end if;
--5月份
elsif n_month = 5 then
if tab_ie02(n_year).cic109 <> 0 and n_AccrualEndMonth >= n_month then
tab_ie02(n_year).cic131 := tab_ie02(n_year).cic131 + tab_InterestRate(n_year).MonthRate * tab_ie02(n_year).cic109 * (n_AccrualEndMonth - n_month + 1);
end if;
--6月份
elsif n_month = 6 then
if tab_ie02(n_year).cic110 <> 0 and n_AccrualEndMonth >= n_month then
tab_ie02(n_year).cic131 := tab_ie02(n_year).cic131 + tab_InterestRate(n_year).MonthRate * tab_ie02(n_year).cic110 * (n_AccrualEndMonth - n_month + 1);
end if;
--7月份
elsif n_month = 7 then
if tab_ie02(n_year).cic111 <> 0 and n_AccrualEndMonth >= n_month then
tab_ie02(n_year).cic131 := tab_ie02(n_year).cic131 + tab_InterestRate(n_year).MonthRate * tab_ie02(n_year).cic111 * (n_AccrualEndMonth - n_month + 1);
end if;
--8月份
elsif n_month = 8 then
if tab_ie02(n_year).cic112 <> 0 and n_AccrualEndMonth >= n_month then
tab_ie02(n_year).cic131 := tab_ie02(n_year).cic131 + tab_InterestRate(n_year).MonthRate * tab_ie02(n_year).cic112 * (n_AccrualEndMonth - n_month + 1);
end if;
--9月份
elsif n_month = 9 then
if tab_ie02(n_year).cic113 <> 0 and n_AccrualEndMonth >= n_month then
tab_ie02(n_year).cic131 := tab_ie02(n_year).cic131 + tab_InterestRate(n_year).MonthRate * tab_ie02(n_year).cic113 * (n_AccrualEndMonth - n_month + 1);
end if;
--10月份
elsif n_month = 10 then
if tab_ie02(n_year).cic114 <> 0 and n_AccrualEndMonth >= n_month then
tab_ie02(n_year).cic131 := tab_ie02(n_year).cic131 + tab_InterestRate(n_year).MonthRate * tab_ie02(n_year).cic114 * (n_AccrualEndMonth - n_month + 1);
end if;
--11月份
elsif n_month = 11 then
if tab_ie02(n_year).cic115 <> 0 and n_AccrualEndMonth >= n_month then
tab_ie02(n_year).cic131 := tab_ie02(n_year).cic131 + tab_InterestRate(n_year).MonthRate * tab_ie02(n_year).cic115 * (n_AccrualEndMonth - n_month + 1);
end if;
--12月份
elsif n_month = 12 then
if tab_ie02(n_year).cic116 <> 0 and n_AccrualEndMonth >= n_month then
tab_ie02(n_year).cic131 := tab_ie02(n_year).cic131 + tab_InterestRate(n_year).MonthRate * tab_ie02(n_year).cic116 * (n_AccrualEndMonth - n_month + 1);
end if;
end if;
end loop; if n_AccrualEndMonth = 12 then
tab_ie02(n_year).cic133 := tab_ie02(n_year).cic103 * tab_InterestRate(n_year).YearRate;
else
tab_ie02(n_year).cic133 := tab_ie02(n_year).cic103 * tab_InterestRate(n_year).MonthRate * n_AccrualEndMonth;
end if; tab_ie02(n_year).cic135 := tab_ie02(n_year).cic103 + tab_ie02(n_year).cic117 + tab_ie02(n_year).cic131 + tab_ie02(n_year).cic133; n_cic103 := tab_ie02(n_year).cic135;
end loop;
end CalculateAccountAccrual; procedure Insert_ie02
is
begin
for i in n_MinYear_ie02..n_SysCurYear loop
insert into ie02(
bae001, --系统机构代码
aab001, --组织ID
aac001, --人员ID
aae001, --账户年度
cic103, --截止上年末个人缴费划拨统筹部分累计本息
cic105, --1月增加个人缴费划拨统筹部分金额
cic106, --2月增加个人缴费划拨统筹部分金额
cic107, --3月增加个人缴费划拨统筹部分金额
cic108, --4月增加个人缴费划拨统筹部分金额
cic109, --5月增加个人缴费划拨统筹部分金额
cic110, --6月增加个人缴费划拨统筹部分金额
cic111, --7月增加个人缴费划拨统筹部分金额
cic112, --8月增加个人缴费划拨统筹部分金额
cic113, --9月增加个人缴费划拨统筹部分金额
cic114, --10月增加个人缴费划拨统筹部分金额
cic115, --11月增加个人缴费划拨统筹部分金额
cic116, --12月增加个人缴费划拨统筹部分金额
cic117, --本年个人缴费划拨统筹部分本金总额
cic131, --本年缴纳个人缴费划拨统筹部分本年计入利息
cic133, --截止上年末个人缴费划拨统筹部分累计本息在本年产生的利息
cic135, --截止本年末个人缴费划拨统筹部分累计储存额(本息)
aae013) --备注
values(
tab_ie02(i).bae001, --系统机构代码
tab_ie02(i).aab001, --组织ID
tab_ie02(i).aac001, --人员ID
tab_ie02(i).aae001, --账户年度
tab_ie02(i).cic103, --截止上年末个人缴费划拨统筹部分累计本息
tab_ie02(i).cic105, --1月增加个人缴费划拨统筹部分金额
tab_ie02(i).cic106, --2月增加个人缴费划拨统筹部分金额
tab_ie02(i).cic107, --3月增加个人缴费划拨统筹部分金额
tab_ie02(i).cic108, --4月增加个人缴费划拨统筹部分金额
tab_ie02(i).cic109, --5月增加个人缴费划拨统筹部分金额
tab_ie02(i).cic110, --6月增加个人缴费划拨统筹部分金额
tab_ie02(i).cic111, --7月增加个人缴费划拨统筹部分金额
tab_ie02(i).cic112, --8月增加个人缴费划拨统筹部分金额
tab_ie02(i).cic113, --9月增加个人缴费划拨统筹部分金额
tab_ie02(i).cic114, --10月增加个人缴费划拨统筹部分金额
tab_ie02(i).cic115, --11月增加个人缴费划拨统筹部分金额
tab_ie02(i).cic116, --12月增加个人缴费划拨统筹部分金额
tab_ie02(i).cic117, --本年个人缴费划拨统筹部分本金总额
tab_ie02(i).cic131, --本年缴纳个人缴费划拨统筹部分本年计入利息
tab_ie02(i).cic133, --截止上年末个人缴费划拨统筹部分累计本息在本年产生的利息
tab_ie02(i).cic135, --截止本年末个人缴费划拨统筹部分累计储存额(本息)
tab_ie02(i).aae013); --备注
end loop;
end Insert_ie02; begin
po_fhz := pkg_pub.def_OK; select count(1)
into i_count
from ic52
where aac001 = pi_aac001
and bce094 = '' --缴费标志
and aae016 = '' --复核标志
and (aae002 is null or length(to_char(aae002)) <> 6);
if i_count > 0 then
po_fhz := pkg_pub.def_ERR;
po_msg := to_char(pi_aac001)||'系统检查发现该参保人存在有失地居民人员养老按年零星缴费记录的【费款所属期】不正确,无法重建划统筹部分的账户记录,请先检查核实!';
return;
end if; select count(1) into i_count from ie02 where aac001 = pi_aac001;
if i_count > 0 then
delete ie02 where aac001 = pi_aac001;
end if; select bae001, aab001 into s_bae001, n_aab001 from ac01 where aac001 = pi_aac001;
n_SysCurYear := to_char(sysdate, 'yyyy'); GetMinYear_ie02;
if n_MinYear_ie02 is null then
return;
elsif n_MinYear_ie02 > n_SysCurYear then
po_fhz := pkg_pub.def_ERR;
po_msg := to_char(pi_aac001)||'系统检查发现该参保人存在有失地居民人员养老按年零星缴费记录的所属账户年度大于系统当前年度值,认为数据有问题,请先检查核实!';
return;
end if; Init_tab_ie02;
for rec in cur_list loop
n_LoopYear := to_number(substr(rec.aae002, 1, 4));
n_LoopMonth := to_number(substr(rec.aae002, 5, 2)); if n_LoopMonth < 1 or n_LoopMonth > 12 then
po_fhz := pkg_pub.def_ERR;
po_msg := to_char(pi_aac001)||'系统检查发现该参保人存在有失地居民人员养老按年零星缴费记录无法确定其记账所属年月,认为数据有问题,请通知系统管理员协助检查核实!';
return;
end if; FillinAllotCorpusAmt(rec.aic441); if tab_ie02(n_LoopYear).bae001 <> rec.bae001 then
tab_ie02(n_LoopYear).bae001 := rec.bae001;
end if;
if tab_ie02(n_LoopYear).aab001 <> rec.aab001 then
tab_ie02(n_LoopYear).aab001 := rec.aab001;
end if;
end loop; Init_tab_InterestRate;
if po_fhz <> pkg_pub.def_OK then
return;
end if; CalculateAccountAccrual;
Insert_ie02;
exception
when others then
po_fhz := pkg_pub.def_ERR;
po_msg := to_char(pi_aac001)||'对该参保人的失地居民人员养老按年零星缴费记录重建划统筹部分的账户记录时发生失败:'||sqlerrm;
end ReBuild_IE02;

重新生成IE02的更多相关文章

  1. Oracle 11g数据库详解(2)

    FAILED_LOGIN_ATTEMPTS 用于指定连续登陆失败的最大次数 达到最大次数后,用户会被锁定,登陆时提示ORA-28000 UNLIMITED为不限制 精确无误差 是 实时 PASSWOR ...

  2. Jenkins 安装的HTML Publisher Plugin 插件无法展示ant生成的JunitReport报告

    最近在做基于jenkins ant  junit 的测试持续集成,单独ant junit生成的junitreport报告打开正常,使用Jenkins的HTML Publisher Plugin 插件无 ...

  3. SQL Server镜像自动生成脚本

    SQL Server镜像自动生成脚本 镜像的搭建非常繁琐,花了一点时间写了这个脚本,方便大家搭建镜像 执行完这个镜像脚本之后,最好在每台机器都绑定一下hosts文件,不然的话,镜像可能会不work 1 ...

  4. 将表里的数据批量生成INSERT语句的存储过程 增强版

    将表里的数据批量生成INSERT语句的存储过程 增强版 有时候,我们需要将某个表里的数据全部或者根据查询条件导出来,迁移到另一个相同结构的库中 目前SQL Server里面是没有相关的工具根据查询条件 ...

  5. 使用 .NET WinForm 开发所见即所得的 IDE 开发环境,实现不写代码直接生成应用程序

    直接切入正题,这是我09年到11年左右业余时间编写的项目,最初的想法很简单,做一个能拖拖拽拽就直接生成应用程序的工具,不用写代码,把能想到的业务操作全部封装起来,通过配置的方式把这些业务操作组织起来运 ...

  6. Javascript生成二维码(QR)

    网络上已经有非常多的二维码编码和解码工具和代码,很多都是服务器端的,也就是说需要一台服务器才能提供二维码的生成.本着对服务器性能的考虑,这种小事情都让服务器去做,感觉对不住服务器,尤其是对于大流量的网 ...

  7. myeclipse学习总结一(在MyEclipse中设置生成jsp页面时默认编码为utf-8编码)

    1.每次我们在MyEclispe中创建Jsp页面,生成的Jsp页面的默认编码是"ISO-8859-1".在这种情况下,当我们在页面中编写的内容存在中文的时候,就无法进行保存.如下图 ...

  8. iOS二维码生成、识别、扫描等

    二维码扫描 前言: 最近的项目中使用到了二维码,二维码这个模块功能也完成:觉得还是有必要总结一下用来做记录.好长时间没有写二维码了都忘记在差不多了,重新拾起来还是挻快的. 二维码使用场景: 生活中有很 ...

  9. 使用python抓取婚恋网用户数据并用决策树生成自己择偶观

    最近在看<机器学习实战>的时候萌生了一个想法,自己去网上爬一些数据按照书上的方法处理一下,不仅可以加深自己对书本的理解,顺便还可以在github拉拉人气.刚好在看决策树这一章,书里面的理论 ...

随机推荐

  1. JAVA排序(一) Comparable接口

    昨天接到一个实习公司的电话面试,来的很突然,没有准备. 由于以前没用过,在被他问及是否用过JAVA的排序工具Comparable与Comparator时,没有回答上来,只能实话实说没有用过. 感觉太丢 ...

  2. VM 映像

     让我们一起欢呼吧!随着最近Microsoft Azure运行时的发布,我们非常高兴地宣布发布 OS映像的继承性产品:新 VM映像.等一下-有些人可能会觉得这听起来有点耳熟.没错,一个月前在旧金山 ...

  3. HDU 5765 Bonds(状压DP)

    [题目链接] http://acm.hdu.edu.cn/showproblem.php?pid=5765 [题目大意] 给出一张图,求每条边在所有边割集中出现的次数. [题解] 利用状压DP,计算不 ...

  4. 注册表缺失导致Windows Server 2008 R2时钟服务W32time不能自启

    参照@飘云 http://blog.csdn.net/piaoyunqing/article/details/6323647 的文章. 测试环境中有一台Windows Server 2008 R2的虚 ...

  5. Dos关闭进程命令

    netstat -ao 查找占用端口的进程 taskkikk /pid 端口pid  /f

  6. UVa1586 Molar mass

    #include <stdio.h> int GetQuantity(char* q, char** p){    int quantity = 0;    while (*q & ...

  7. hdu 4704 Sum 费马小定理

    题目链接 求2^n%mod的值, n<=10^100000. 费马小定理 如果a, p 互质, 那么a^(p-1) = 1(mod p)  然后可以推出来a^k % p = a^(k%(p-1) ...

  8. 【转】关于UItableViewCell的accessoryType属性

    转载自:http://blog.csdn.net/kmyhy/article/details/6442351 使用的话,例如: cell.accessoryType = UITableViewCell ...

  9. Aone新拉分支

    1.进入Aone新建项目 2.测试人员填huyangjun和husong 3.进入后拉分支 4.弄个日常普通环境 5.吧环境跑起,绑定Host就可以

  10. js函数调用模式总结

    在javascript中一共有四种调用模式:方法调用模式.函数调用模式.构造器调用模式和apply调用模式.这些模式在如何初始化关键参数this上存在差异 方法调用模式 当一个函数被保存为对象的一个属 ...