SELECT count(*) as qtd,sum(if(tpdoc<>4 and tot_valor>0 and anulado<>1,tot_valor,0)) as totalc,sum(if(tpdoc=4  and tot_valor>0 and anulado<>1,tot_valor,0)) as totald FROM vendas WHERE data>='20241201000000' and data<='20241231235959'  and tpdoc in (1,2,4,11,12,14,21,22,24)  and numero>0 order by Numero;
SELECT count(*) as qtd,sum(if(InvoiceStatus='N',NetTotal,0)) as totalc,sum(0) as totald FROM invoice WHERE InvoiceDate>='20241201000000' and InvoiceDate<='20241231235959' 
