日销售报表的查询

select decode(substr(n5002,3,2),'25','23','27','23','29','23',substr(n5002,3,2)) "大类编码",
a0202 "大类名称",
jxbhs "经销不含税销售总额",
sj1 "17%税金",
sj2 "13%税金",
jxxs "经销销售额" ,
dxhs "代销含税销售额",
dxbhs "代销不含税销售额",
zlxs "租赁销售",
qt "其他销售",
zxs "总销售额" ,
n5010 "日期",
n5001 "门店"
from (select n5001,n5002,
round(sum(decode(n5005,'6',0,'7',0,'8',0,decode(n5014,'17',(n5011/1.17),'0',(n5011/1.0),'10',(n5011/1.13),'13',(n5011/1.13),0)*(1-nvl(zkl,0)*0.01)))/1,2) jxbhs,
round(sum(decode(n5005,'6',0,'7',0,'8',0,decode(n5014,'17',(n5011/1.17*0.17),0)*(1-nvl(zkl,0)*0.01)))/1,2) sj1,
round(sum(decode(n5005,'6',0,'7',0,'8',0,decode(n5014,'10',(n5011/1.13*0.13),'13',(n5011/1.13*0.13),0)*(1-nvl(zkl,0)*0.01)))/1,2) sj2,
round(sum(decode(n5005,'6',0,'7',0,'8',0,n5011*(1-nvl(zkl,0)*0.01)))/1,2) jxxs ,
round(sum(decode(n5005,'6',n5011))/1,2) dxhs,
round(sum(decode(n5005,'6',n5012))/1,2) dxbhs,
round(sum(decode(n5005,'7',n5011,'8',n5011)),2) zlxs,
round(sum(decode(n5005,'6',n5011,n5011*(1-nvl(zkl,0)*0.01)))/1,2) zxs,
n5010
from (select * from fzdc.n501003 union all select * from fzdc.n50),fzdc.cwzkb
where to_char(n5010,'yyyy.mm.dd')>='2010.03.01' and to_char(n5010,'yyyy.mm.dd')<='2010.03.31'
and n5002=bm(+)
and to_char(n5010,'yyyy.mm.dd')=to_char(rq(+),'yyyy.mm.dd')
and n5001=md(+)
and n5001||n5002<>'012027'
and n5001 in ('02','07','12')
and n5002 like '%%'
and n5004 like '%%'
and n5005 in ('0','1','2','3','9')
and n5006 like '%%'
and n5007 like '%%'
and n5019 like '%%'
group by n5001,n5002,n5010),(select n5001 mendian,n5002 bumen,
sum(n5011) qt,n5010 rq
from (select * from fzdc.n501003 union all select * from fzdc.n50)
where
to_char(n5010,'yyyy.mm.dd')>='2010.03.01' and to_char(n5010,'yyyy.mm.dd')<='2010.03.31'
and n5005=1
and substr(n5004,1,6)<>'110204'
and substr(n5004,1,6)<>'110304'
and n5014=0
and n5001 in ('02','07','12')
and n5002 like '%%'
group by n5001,n5002,n5010),a02
where n5001=mendian(+)
and n5002=bumen(+)
and n5010=rq(+)
and n5002=a0201

order by decode(substr(n5002,3,2),'25','23','27','23','29','23',substr(n5002,3,2)),n5010

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值