show receipts next business day

Stimulsoft Dashboards.WIN discussion
Post Reply
Corteze
Posts: 1
Joined: Mon Jul 13, 2020 4:13 pm
Location: Brasil

show receipts next business day

Post by Corteze »

Good Morning!
I would like a help to show on the dashboard instead of the current day of receipt of the titles the next business day, apart from weekends, here's query:

SELECT
CASE WHEN A.Doctipo = 3 THEN B.TitDataVencimento +1 ELSE B.TitDataVencimento END [Data Vencimento],
A.DocNum [Nº Doc],
CASE WHEN A.DocTipo = 3 THEN CONCAT('Faturamento - ',C.FavOrigNome) ELSE C.FavOrigNome END [Favorecido],
CASE WHEN A.DocDebCred = 'D' THEN B.TitValor*(-1) ELSE 0 END[Pagar],
CASE WHEN A.DocDebCred = 'C' THEN B.TitValor ELSE 0 END[Receber],
CASE WHEN A.DocDebCred = 'D' THEN B.TitValor*(-1) ELSE B.TitValor END[Resultado],
CONCAT (F.BncNome,' - ',E.CCNumAgencia,'-', E.CCDigAgencia,' ', E.CCNum,'-',E.CCDig) [Conta Corrente],
D.EmpNomeAbrev [Empresa],
CASE WHEN B.TitDataPagamento IS NULL THEN 'Em Aberto' ELSE 'Pago' END [Pago/Aberto],
B.TitDataPagamento [Data Pagamento],
B.TitStatus,
CASE WHEN B.TitStatus IN ('C') THEN 'Cancelados' ELSE 'Normal' END [Status Título],
CASE WHEN A.DocPrevisao = 1 THEN 'Previsão' ELSE 'Documentos' END [Previsão],
CONCAT(H.CnCstDescr,' - ',I.CatDescr)[Centro de Custo]

FROM TbDocumento A
JOIN TbTitulo B ON A.DocId = B.DocId
JOIN VwDocumentoFavorecidoOrigem C ON A.DocId = C.DocId
JOIN TbEmpresa D ON A.EmpId = D.EmpId
JOIN TbContaCorrente E ON B.CCId = E.CCId
JOIN TbBanco F ON E.BncId = F.BncId
JOIN TbRateioDocumento G ON A.DocId = G.DocId
JOIN TbCentroCusto H ON G.CnCstId = H.CnCstId
left JOIN TbCategoria I ON G.CatId = I.CatId
left JOIN TbSubCategoria J ON G.SubCatId = J.SubCatId

WHERE
CONVERT (Date, B.TitDataVencimento) >= Convert (Date, @DataInicio)
AND
CONVERT (Date, B.TitDataVencimento) <= Convert (Date, @DataFim)
Lech Kulikowski
Posts: 6197
Joined: Tue Mar 20, 2018 5:34 am

Re: show receipts next business day

Post by Lech Kulikowski »

Hello,

Please try to use DateTime functions - AddDays, AddMonth, etc.

Thank you.
Post Reply