level 8
噢丶Right
楼主
p_red_curr := 0.0;
obj2.zsfp_red_total := 0.0;
obj2.zsfp_oneoff_childcurr := 0.0;
obj2.zsfp_oneoff_childtotal := 0.0;
obj2.paidtax_sale_curr := 0;
obj2.paidtax_sale_total := 0;
obj2.paidtax_total := 0;
obj2.paidtax_curr := 0;
obj2.zsfp_oneoff_year_childtotal:= 0.0;
obj2.zsfp_oneoff_year_total:= 0.0;
obj2.paidtax_year_curr :=0.0;
obj2.paidtax_sale_year_curr:=0.0;
--obj2.contractamount :=0;
v_invoiceamount :=0.0;
v_yearinvoiceamount:=0.0;
--project area
if obj.audittime < to_date(v_begindate, 'yyyy-mm-dd') then
obj2.buildarea_init := obj.area;
else
obj2.buildarea_new := obj.area;
end if;
if obj.status = 3 and
trunc(obj.updatedate) < to_date(v_enddate, 'yyyy-mm-dd') then
obj2.buildarea_finish := obj.area;
else
obj2.buildarea_end := obj.area;
v_begindate || ''',''yyyy-mm-dd''),''yyyy'')
and
fillindate <=to_date(''' || v_enddate ||
''',''yyyy-mm-dd'')
and
(cancelsign=0 or canceldate>to_date(''' ||
v_enddate || ''',''yyyy-mm-dd''))
and
extend3=''' || obj.id || '''
group by
(case when invoiceamount<0 then 1 else 0 end)';
open c2 for v_sql;
loop
fetch c2
into v_yearinvoiceamount, v_isred;
exit when c2%notfound;
if v_isred = 1 then
obj2.zsfp_oneoff_year_total := -v_yearinvoiceamount;
else
obj2.zsfp_oneoff_year_childtotal := v_yearinvoiceamount;
end if;
end loop;
if c2%isopen then
*/
--营业税-年度,应税本年统计
select sum(case
when v.taxkind = '03' and
v.begindate <= to_date('2013-04-30', 'yyyy-mm-dd') and
v.begindate >= to_date('2013-04-01', 'yyyy-mm-dd') then
coalesce(amount, 0)
else
0
end) as paidtax_sale_curr,
sum(case
when v.taxkind = '03' and
'50',
'24',
'17',
'33',
'15',
'73',
'83',
'90',
'71') then
'00'
else
taxkind
'00', trunc(ti.congnizancedate, 'mm')
union all
select to_date(manualyear || '-' || manualmonth || '-01',
'yyyy-mm-dd') as begindate,
projectid,
'03' as taxkind,
case
when ARREARAGEORPAID = 0 then
coalesce(salestax, 0) + coalesce(saleadjust, 0)
case
when ARREARAGEORPAID = 0 then
ecuattachtax
else
0
end as amount,
case
when ARREARAGEORPAID = 1 then
ecuattachtax
else
0
end as owetax
from project_paidtax_manual pm
where coalesce(ecuattachtax, 0) <> 0
and ecuattachtax is not null
and pm.projectid = obj.id
union all
select to_date(manualyear || '-' || manualmonth || '-01',
'yyyy-mm-dd') as begindate,
projectid,
'90' as taxkind,
case
when ARREARAGEORPAID = 0 then
localecuattachtax
else
.paidtax_curr
from project_balance_monthly a
where a.belongdate >= to_date(v_begindate, 'yyyy-mm-dd')
and a.belongdate <= to_date(v_enddate, 'yyyy-mm-dd')
and a.id = obj.id;
select coalesce(sum(a.saletax), 0), coalesce(sum(a.tax), 0)
into obj2.paidtax_sale_total, obj2.paidtax_total
from project_balance_monthly a
where a.belongdate <= to_date(v_enddate, 'yyyy-mm-dd')
and a.id = obj.id;
/
i,
'0',
obj.id,
obj2.investor,
obj2.constructionname,
obj.area,
obj.name,
obj2.buildarea_init,
obj2.buildarea_finish,
obj2.buildarea_new,
obj2.buildarea_end,
obj2.zsfp_oneoff_curr,
obj2.zsfp_oneoff_total,
obj2.zsfp_red_curr,
o
loop
fetch c1
into obj2.invoicecount_total,
obj2.zsfp_red_total,
obj2.zsfp_oneoff_total;
exit when c1%notfound;
obj2.buildarea_init := 0.0;
obj2.buildarea_finish := 0.0;
obj2.buildarea_new := 0.0;
obj2.buildarea_end := 0.0;
obj2.zsfp_oneoff_curr := 0.0;
obj2.zsfp_oneoff_total := 0.0;
obj2.zsfp?????_?????';
v_cansalecount_new := 0; --'???????_????';
v_cansalecount_end := 0; --'???????_????';
v_totalcount_sale := 0;
v_totalcount := 0;