on 01-12-2015 1:17 PM
Olá a todos!
Alguém teria um relatório de faturamento - ou mesmo uma consulta - que tenha como filtros período e filial?
Desde já agradeço!
Boa tarde,
Tenho um meio simples, mas ajuda muito por aqui, espero que te ajude.
select
t1.Serial 'NF',
t1.DocEntry ,
t1.DocDate 'Data',
Substring(t3.SlpName,1,15) 'Repres',
Substring(t1.CardName,1,25) 'Cliente' ,
t1.DocTotal 'Faturamento Bruto',
t1.DocTotal-t1.vatsum 'Faturamento s/Impostos',
isnull( (sum(t2.taxsum)),'0') 'IPI',
t1.DocTotal-t1.vatsum + sum(t2.taxsum) 'Faturamento c/IPI',
t1.DocTotal - (t1.DocTotal-t1.vatsum) - (isnull( (sum(t2.taxsum)),'0')) 'ST'
from oinv t1
inner join inv4 t2 on t2.docentry = t1.docentry
left join oslp t3 on T3.slpcode = t1.slpcode
left join ocrd t4 on t4.cardcode = t1.cardcode
left join [@GRUPO_CLIENTES] t5 on t5.Code = t4.U_Grp_Cliente
where
T1.DocDate between '[%0]' and '[%1]'
and t1.BpLID = '[%2]'
and left(t2.StaCode,3) ='IPI'
and t1.InvntSttus = 'O'
and t1.DocTotal >0
GROUP BY t1.CardName,t1.DocTotal,t3.SlpName,t1.Serial,t1.DocEntry,t1.DocDate,t5.Name,t1.DocTotal-t1.vatsum
order by t1.Serial desc
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
103 | |
12 | |
11 | |
6 | |
5 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.