初始欠费录入

来源:互联网 发布:linux 常用命令 top 编辑:程序博客网 时间:2024/04/27 14:36

select aa.收费期,aa.房间编号,aa.住户名称,'' as 交费单位,aa.使用类型,'A' as 收费项目,
case when aa.使用类型 = '居民' then 'A01' else 'A02' end 收费标准,'1' as 表号面积编号,
case when aa.使用类型 = '居民' then '28.00' else '33.00' end 单价,aa.面积,
case when aa.使用类型 = '居民' then round(28*面积) else round(33*面积) end 总应收金额,0 as 减免金额,
case when aa.使用类型 = '居民' then round(28*面积) else round(33*面积) end 实应收金额,
case when aa.使用类型 = '居民' then round(28*面积)-aa.欠收款 else round(33*面积)-aa.欠收款 end as 实收金额,
0 as 滞纳金应收,0 as 滞纳金实收,'' as 发票代码,'' as 发票编号,'张磊' as 收费人, '2006-01-01 10:10:10' as 收费时间,
'2010-11-05' as 供热开始时间,'2011-04-05' as 供热截止时间,'admin' as 管理员,aa.管理站所,'' as 备注
from fc_temp_zl aa;

 

select a.收费期,d.housecode as 房间编号,a.住户名称,'' as 交费单位,d.usetype as 使用类型,'A' as 收费项目,'' as 收费标准,
'' as 表号面积编号,'' as 单价,a.面积,'' as 总应收金额,'' as 减免金额,'' as 实应收金额,'' as 实收金额,'' as 滞纳金应收,
'' as 滞纳金实收,'' as 发票代码,'' as 发票编号, '' as 收费人,'' as 收费时间,'' as 供热开始时间,'' as 供热截止时间,
'' as 管理员,a.管理站所,'' as 备注,a.欠收款,d.unio,a.楼号,a.房号 from
(select fc_temp_qf."年度" as 收费期,fc_temp_qf."换热站" as 管理站所,fc_temp_qf."楼号",fc_temp_qf."房号",fc_temp_qf."姓名" as 住户名称,
fc_temp_qf."面积" as 面积,fc_temp_qf."欠收款",trim(楼号)||trim(房号)  as abc  from fc_temp_qf where fc_temp_qf."年度"='2012') a,
(select a.housecode,a.usetype,trim(b.buildingname)||trim(a.oldcode) as unio from fc_house a,fc_building b
where a.buildingcode = b.buildingcode
and a.clustercoding = b.clustercoding) d
where a.abc = d.unio(+)
and d.housecode(+) like 'A%';

 

select oldcode,buildingcode from fc_house where housecode='A021-001-00-09-01';
select buildingname from fc_building where buildingcode='A021-001';
update fc_house set oldcode='' where housecode='7012-001-N0-01-01';
select buildingname from fc_building where buildingcode='7012-001';
select workUnit from sf_charge where housecode='A021-001-00-09-01';
select * FROM FC_UNIT WHERE UNITNAME='金州区爱民小学';
select unitcode from sf_charge;
select case when oldcode is null then '12342' else '13234'||'-234234'
end abc from fc_house where housecode='7012-001-N0-01-01';

 


select billcode,usr_name,chargeMonth,itemname,itemcode, MANAGEID,
NVL(WORKUNIT,combine) as address,
nvl((case when ChargeArea=0 then null else ChargeArea end),0) ChargeArea,
nvl((case when PRICE=0 then null else PRICE end),0) PRICE,
nvl((case when TOTALACCOUNT=0 then null else TOTALACCOUNT end),0) TOTALACCOUNT,
nvl((case when MINUSMONEY=0 then null else MINUSMONEY end),0) MINUSMONEY,
nvl((case when ADDIMPREST=0 then null else ADDIMPREST end),0) ADDIMPREST,
nvl((case when LATEFEENOW=0 then null else LATEFEENOW end),0) LATEFEENOW,
nvl((case when REALCOUNT=0 then null else REALCOUNT end),0) REALCOUNT,
nvl((case when REALC=0 then null else REALC end),0) REALC,hou
from (
select a.billcode,o.WORKUNIT,
case when OLDCODE = '' then w.BUILDINGNAME else(w.BUILDINGNAME||'-'||e.OLDCODE) end combine,
h.usr_name,b.chargeMonth,
t.itemname,a.itemcode as itemcode,e.MANAGEID,
sum(a.ChargeArea) ChargeArea,sum(a.chargePrice) PRICE,sum(a.TOTALACCOUNT) TOTALACCOUNT,
sum(b.MINUSMONEY) MINUSMONEY,sum(a.ADDIMPREST) ADDIMPREST,sum(a.LATEFEENOW) LATEFEENOW,
sum(a.CASH) REALCOUNT,
(sum(a.CASH)+sum(a.LATEFEENOW)+sum(a.ADDIMPREST)) REALC,
 substr(a.housecode,1,4)||substr(a.housecode,6,3)|| substr(a.housecode,10,2)|| substr(a.housecode,13,2)|| substr(a.housecode,16,2) as hou
from sf_detail a,sf_charge b,t_user h,
fc_community q,fc_building w,fc_house e,sf_item t,FC_OWNER o
where a.CHARGEMONTH=b.CHARGEMONTH and a.HOUSECODE=b.HOUSECODE and a.housecode=o.housecode and o.ISOWNER='1'
and a.ITEMCODE=b.ITEMCODE and a.CLOCKNUMBER=b.CLOCKNUMBER
and a.clusterCoding=b.clusterCoding
and a.ROLLBACKFLAG='0'
and a.OPERATOR=h.usr_code
and a.communitycode=q.communitycode
and a.buildingcode=w.buildingcode
and a.housecode=e.housecode
and b.itemcode=t.itemcode
and b.clusterCoding=t.clusterCoding
group by a.billcode,w.BUILDINGNAME,e.OLDCODE, h.usr_name, b.chargeMonth, t.itemname,a.itemcode  ,a.housecode ,e.MANAGEID,o.WORKUNIT
)
where workunit i
order by billcode;

select tt. from sf_charge tt where communitycode like 'A%';
select * from sf_detail where communitycode like 'A%';

select * from sf_imprest;
select aa.收费期,aa.房间编号,aa.住户名称,'' as 交费单位,aa.使用类型,'A' as 收费项目,
case when aa.使用类型 = '居民' then 'A01' else 'A02' end 收费标准,'1' as 表号面积编号,
case when aa.使用类型 = '居民' then '28.00' else '33.00' end 单价,aa.面积,
case when aa.使用类型 = '居民' then round(28*面积) else round(33*面积) end 总应收金额,0 as 减免金额,
case when aa.使用类型 = '居民' then round(28*面积) else round(33*面积) end 实应收金额,
case when aa.使用类型 = '居民' then round(28*面积)-aa.欠收款 else round(33*面积)-aa.欠收款 end as 实收金额,
0 as 滞纳金应收,0 as 滞纳金实收,'' as 发票代码,'' as 发票编号,'张磊' as 收费人, '2006-01-24 10:10:10' as 收费时间,
'2010-11-05' as 供热开始时间,'2011-04-05' as 供热截止时间,'admin' as 管理员,aa.管理站所,'' as 备注
from fc_temp_zl aa order by 住户名称;

delete from fc_temp_zl;
delete from sf_charge where chargemonth='2007' and communitycode like 'A%';
delete from sf_detail where chargemonth='2007' and communitycode like 'A%';
delete  from sf_bill where billcode like '20060124%';
select * from sf_detail where chargemonth='2007';
select sum(欠收款) from fc_temp_qf where 年度='2007';select a.收费期,d.housecode as 房间编号,a.住户名称,'' as 交费单位,d.usetype as 使用类型,'A' as 收费项目,'' as 收费标准,
'' as 表号面积编号,'' as 单价,a.面积,'' as 总应收金额,'' as 减免金额,'' as 实应收金额,'' as 实收金额,'' as 滞纳金应收,
'' as 滞纳金实收,'' as 发票代码,'' as 发票编号, '' as 收费人,'' as 收费时间,'' as 供热开始时间,'' as 供热截止时间,
'' as 管理员,a.管理站所,'' as 备注,a.欠收款,d.unio,a.楼号,a.房号 from
(select fc_temp_qf."年度" as 收费期,fc_temp_qf."换热站" as 管理站所,fc_temp_qf."楼号",fc_temp_qf."房号",fc_temp_qf."姓名" as 住户名称,
fc_temp_qf."面积" as 面积,fc_temp_qf."欠收款",trim(楼号)||trim(房号)  as abc  from fc_temp_qf where fc_temp_qf."年度"='2007') a,
(select a.housecode,a.usetype,trim(b.buildingname)||trim(a.oldcode) as unio from fc_house a,fc_building b
where a.buildingcode = b.buildingcode
and a.clustercoding = b.clustercoding) d
where a.abc = d.unio(+)
and d.housecode(+) like 'A%'
order by 住户名称;

 

select 'A' as itemcode,收费期 as chargemonth,房间编号 as housecode,
substr(房间编号,1,4) as communitycode,substr(房间编号,1,8) as buildingcode,
case when 欠收款 < 0 then 欠收款 else 0 end nowaccount,'administrator' as operator,
收费期||'-01-01 10:10:10' as operatedate,'2011082001' as clustercoding,住户名称
from (
select a.收费期,d.housecode as 房间编号,a.住户名称,'' as 交费单位,d.usetype as 使用类型,'A' as 收费项目,'' as 收费标准,
'' as 表号面积编号,'' as 单价,a.面积,'' as 总应收金额,'' as 减免金额,'' as 实应收金额,'' as 实收金额,'' as 滞纳金应收,
'' as 滞纳金实收,'' as 发票代码,'' as 发票编号, '' as 收费人,'' as 收费时间,'' as 供热开始时间,'' as 供热截止时间,
'' as 管理员,a.管理站所,'' as 备注,a.欠收款,d.unio,a.楼号,a.房号 from
(select fc_temp_qf."年度" as 收费期,fc_temp_qf."换热站" as 管理站所,fc_temp_qf."楼号",fc_temp_qf."房号",fc_temp_qf."姓名" as 住户名称,
fc_temp_qf."面积" as 面积,fc_temp_qf."欠收款",trim(楼号)||trim(房号)  as abc,'2011082001' as clustercoding  from fc_temp_qf where 年度 in ('2007') and 欠收款 < 0) a,
(select a.housecode,a.usetype,trim(b.buildingname)||trim(a.oldcode) as unio ,a.clustercoding from fc_house a,fc_building b
where a.buildingcode = b.buildingcode
and a.clustercoding = b.clustercoding) d
where a.abc = d.unio(+)
and d.housecode(+) like 'A%'
) where 欠收款 < 0 order by 住户名称;

--('1991','1992','1993','1994','1995','1996','1997','1998','1999','2000','2001','2002','2003','2004','2005','2006','2007','2008','2009','2010','2011','2012')

 

select sum(欠收款) from fc_temp_qf where 欠收款 <= 0;

select a.收费期,d.housecode as 房间编号,a.住户名称,'' as 交费单位,d.usetype as 使用类型,'A' as 收费项目,'' as 收费标准,
'' as 表号面积编号,'' as 单价,a.面积,'' as 总应收金额,'' as 减免金额,'' as 实应收金额,'' as 实收金额,'' as 滞纳金应收,
'' as 滞纳金实收,'' as 发票代码,'' as 发票编号, '' as 收费人,'' as 收费时间,'' as 供热开始时间,'' as 供热截止时间,
'' as 管理员,a.管理站所,'' as 备注,a.欠收款,d.unio,a.楼号,a.房号 from
(select fc_temp_qf."年度" as 收费期,fc_temp_qf."换热站" as 管理站所,fc_temp_qf."楼号",fc_temp_qf."房号",fc_temp_qf."姓名" as 住户名称,
fc_temp_qf."面积" as 面积,fc_temp_qf."欠收款",trim(楼号)||trim(房号)  as abc  from fc_temp_qf) a,
(select a.housecode,a.usetype,trim(b.buildingname)||trim(a.oldcode) as unio from fc_house a,fc_building b
where a.buildingcode = b.buildingcode(+)
and a.clustercoding = b.clustercoding(+)) d
where a.abc = d.unio(+)
and d.housecode(+) like 'A%'


select 楼号,clustercoding from
(select trim(楼号) as 楼号,trim(楼号)||trim(房号) as 混合号 from fc_temp_qf) aa,
(select cc.housecode,cc.usetype,bb.buildingname,bb.clustercoding,trim(bb.buildingname)||trim(cc.oldcode) as unio from fc_house cc,fc_building bb
where cc.buildingcode = bb.buildingcode
and cc.clustercoding = bb.clustercoding) dd
where aa.楼号 = dd.buildingname(+)
and aa.混合号 = dd.unio(+)
and dd.housecode(+) like 'A%';


select HouseCode,OWNERNAME,ItemName,ChargeMonth,NowAccount, BuildingCode, CommunityCode,itemcode from
                        (select imp.HouseCode,OWNERNAME,ItemName, imp.BuildingCode,imp.CommunityCode,
                                         case(ChargeMonth) when '0' then ' '
 else ChargeMonth end as ChargeMonth,NowAccount,imp.itemcode
                                from (select HouseCode,OWNERNAME,clusterCoding
from fc_owner where COMMUNITYCODE in ('A001','A002','A001','A002','A003','A003','A003',
'A004','A004','A005','A006','A007','A008','A009','A009','A010','A011','A012',
'A013','A014','A015','A016','A017','A018','A019','A020','A019','A021','A022',
'A023','A024','A025','A026','A026','A026','A026','A027','A027','A028','A029',
'A030','A031') and isowner='1') n , SF_Imprest imp
                                        left join (select distinct '0' as ItemCode, '公共' as ItemName from SF_Item where SepImpre='0'
                                        and clusterCoding='2011082001'
                                        union all
                                        select ItemCode, ItemName from SF_Item where SepImpre='0' and clusterCoding='2011082001') itm
                                        on itm.ItemCode = imp.ItemCode
                                where NowAccount > 0 and n.housecode=imp.housecode and n.clusterCoding='2011082001'
                                and imp.clusterCoding='2011082001'
                                        ) v where
                        1=1 and COMMUNITYCODE in ('A001','A002','A001','A002','A003','A003','A003',
                        'A004','A004','A005','A006','A007','A008','A009','A009','A010','A011',
                        'A012','A013','A014','A015',
'A016','A017','A018','A019','A020','A019','A021','A022','A023','A024','A025','A026',
'A026','A026','A026','A027','A027','A028','A029','A030','A031');
                      

select SepImpre from sf_item where SepImpre='1';


select * from SF_Imprest imp
                                        left join (select distinct '0' as ItemCode, '公共' as ItemName from SF_Item where SepImpre='0'
                                        and clusterCoding='2011082001'
                                        union all
                                        select ItemCode, ItemName from SF_Item where SepImpre='0' and clusterCoding='2011082001') itm
                                        on itm.ItemCode = imp.ItemCode
                                        and imp.communitycode like 'A%';
                                where NowAccount > 0 and n.housecode=imp.housecode and n.clusterCoding='2011082001'
                                and imp.clusterCoding='2011082001';
                                           UPDATE SF_IMPREST TT SET TT.NOWACCOUNT=abs(TT.NOWACCOUNT) where TT.NOWACCOUNT < 0; 

原创粉丝点击