《发票开超率.docx》由会员分享,可在线阅读,更多相关《发票开超率.docx(5页珍藏版)》请在第壹文秘上搜索。
1、发票开超率连续两个月发票开具超过定额withXas(selectNSRDZDAH,YF_DM,SM(YNSJYE)YNSJYE每人每月核定额from(SE1.ECTT.NSRDZDAH,YF_DMZT.ZSPMJD,T.ZXHDBZ,SUM(NV1.(T.YNSJYE,0)YNSJYEzCoUntOVer(PartitiOnbyT.NSRDZDAH,P.YF_DM)pmcsFROMZS_HD_DQDEHD_JG1(SE1.ECTYF_DM,SSSQQ,SSSQZFROMWD_ZQTWHEREZQ1.X_BJ=,1,ANDTSSSQQ=ADD_MONTHS(fxqjqt-1)-FXQJQANDT
2、.SSSQZ=fxqjz)P-FXQJZWHERET.ZSXM_ID=,10101,ANDNV1.(T.ZFBZ,N,)=,N,ANDT.HDZXQQ=TRUNC(P.SSSQZ)GROUPBYT.NSRDZDAH,P.YF_DM,T.ZSPMJD,T.ZXHDBZ)where(pmcs=1)or(pmcs1andZXHDBZ=Y,)GROUPBYNSRDZDAH,YF_DM),bas(selectt.nsrdzdahnsrdzdah-连续2个月的nsrfromzs_hd_dqdehdjgtwheret.zsxm_id=10101,andNV1.(t.zfbz,N)=Nandt.hdzxqq=
3、TRNC(fxqjz)-FXQJZgroupbyt.nsrdzdah),hhas(selecth.XFNSRDZDAHNSRDZDAH,h.KPYF,sum(JE)JEfrom(selecta.XFNSRDZDAH,a.KPYF,a.JEfromDZDZ_DZDZ_FPXX_PTFPawherea.KPYF=TO_CHAR(ADD_MONTHS(fxqjq,-1),YYYYMM)anda.KPYFOanda.FPZT_BZnotin(23,f,4,)andTSPZ_DM=02unionallselectb.XFNSRDZDAHzb.KPYF,b.JEfromDZDZ_DZDZ_FPXX_PTF
4、P_YDbwhereb.KPYF=TO_CHAR(ADD_MONTHS(fxqjqf-l)fYYYYMM,)andb.KPYF0andb.FPZT_BZnotin(,2,z,3,4,)andb.TSPZ_DM=,02,unionallselectc.XFNSRDZDAH,c.KPYF,c.JEfromDZDZ_DZDZ_FPXX_DZFPcwherec.KPYF=TO_CHAR(ADD_MONTHS(fxqjq,-1),YYYYMM,)andc.KPYF0andc.FPZT_BZnotin(2,z,3,z,4,)andc.TSPZ_DM=02unionallselectd.XFNSRDZDAH
5、zd.KPYF,d.JEfromDZDZ_DZDZ_FPXX_DZFP_YDdwhered.KPYF=TO_CHAR(ADD_MONTHS(fxqjqf-l)fYYYYMM,)andd.KPYF0andd.FPZT_BZnotin(,2,z,3,4,)andd.TSPZ_DM=,02,)hgroupbyh.XFNSRDZDAH,h.KPYF)selectNSRMCas纳税人名称,nvl(SHXYDMzNSRSBH)as社会信用代码,Nsrdzdahas纳税人电子档案号,SWJGMCas主管税务机关,SSG1.YSWRYMCas税收管理员,YF_DMas开票月份,Dkyxfpzjeas代开金额,
6、ZKYXFPJEas自开金额,KJYXFPZJEas合计金额,增值税as核定征收项目,YNSJYEas核定应纳税经营额,dsswjgmcas地市级税务机关,qswjgmcas区县级税务机关from(SE1.ECTFRnsrdzdah,MAX(N.NSRMC)NSRMC,MAX(N.SHXYDM)SHXYDM,MAX(N.NSRSBH)NSRSBH,MAX(N.SSG1.YSWRYMC)SSG1.YSWRYMCzMAX(N.SWJGMC)SWJGMC,max(n.dsswjgmc)dsswjgmc,max(n.qxswjgmc)qxswjgmczFP.YF_DM,SM(NV1.(FRDKYXFP
7、ZJEz0)DKYXFPZJE,SUM(NV1.(FP.ZKYXFPJE,0)ZKYXFPJEzSM(NV1.(FRKJYXFPZJE,0)-sum(nvl(hh.jez0)KJYXFPZJEz,10101,ZSXMJD,SM(NV1.(X.YNSJYEx0)YNSJYE,MONTHS.BETWEEN(To_DATE(FP.YF_DM,yyyymm),1.AG(TO_DAFE(FP.YF_DM,yyymm,)z1)OVER(PARTITIONBYFP.NSRDZDAHORDERBYTC1.DATE(FP.YF_DM,yyyymm)YFC,MoNTHS.BETWEEN(To_DATE(FP.YF
8、_DM,yyyymm),1.EAD(TC1.DATE(FP.YF_DM,yyyymm),1)OVER(PARTITIONBYFP.NSRDZDAHORDERBYTe1.DATE(FP.YF_DM,yyyymm)YFC2fromx,WD_NSRXXN,JCZT_FPKJ_NSRKJXXFP,b,hhwhereX.NSRDZDAH=N.NSRDZDAHandx.nsrdzdah=b.nsrdzdahANDX.NSRDZDAH=FP.NSRDZDAHandx.YF_DM=FP.YF_DMandfp.nsrdzdah=hh.NSRDZDAHandfp.YF_DM=hh.kpyfANDFP.YF_DM=
9、TO_CHAR(ADD_MONTHS(fxqjq,-1),YYYYMM)-FXQJQANDFP.YF_DMoANDFP.KJYXFPZJE-hh.jeX.YNSJYE*1.3ANDN.KQCCSZTDJBZ=NANDN.KZZTDJ1.X_ID=ADD_MONTHS(fxqjq,-2)TFXQJQANDT.SSSQZ=fxqjz)P-FXQJZWHERET.ZSXMJD=,10101ANDNV1.(T.ZFBZ,N)=NANDT.HDZXQQ=TRUNC(P.SSSQZ)GROUPBYT.NSRDZDAHzP.YF_DM,T.ZSPMD,T.ZXHDBZ)where(pmcs=l)or(pmc
10、slandZXHDBZ=1Y)GROUPBYNSRDZDAH,YF_DM),bas(selectt.nsrdzdahnsrdzdah-连续3个月的nsrfromzs_hd_dqdehdjgtwheret.zsxmjd=,10101,andNV1.(t.zfbz,N,)=,N,andt.hdzxqq=TRUNC(fxqjz)-FXQJZgroupbyt.nsrdzdah),hhas(selecth.XFNSRDZDAHNSRDZDAH,h.KPYF,sum(JE)JEfrom(selecta.XFNSRDZDAH,a.KPYF,a.JEfromDZDZ_DZDZ_FPXX_PTFPawherea
11、.KPYF=TO_CHAR(ADD_MONTHS(fxqjqz-2)z,YYYYMM,)anda.KPYFOanda.FPZT_BZnotin(2,3,4)andTSPZ_DM=02,unionallselectb.XFNSRDZDAH,b.KPYF,b.JEfromDZDZ_DZDZ_FPXX_PTFP_YDbwhereb.KPYF=TO_CHAR(ADD_MONTHS(fxqjqz-2),YYYYMM,)andb.KPYFOandb.FPZT_BZnotin(2,374,)andb.TSPZ_DM=02,unionallselectc.XFNSRDZDAH,c.KPYF,cJEfromDZ
12、DZ_DZDZ_FPXX_DZFPcwherec.KPYF=TO_CHAR(ADD_MONTHS(fxqjqz-2)z,YYYYMM,)andc.KPYFOandc.FPZT_BZnotin(2,3,4)andc.TSPZ_DM=,02unionallselectd.XFNSRDZDAH,d.KPYF,d.JEfromDZDZDZDZFPXXDZFPYDdwhered.KPYF=TO_CHAR(ADD_MONTHS(fxqjqz-2),YYYYMM,)andd.KPYFOandd.FPZT_BZnotin(,2,374,)andd.TSPZ_DM=02,)hgroupbyh.XFNSRDZDAH,h.KPYF)sele