Hi
I have below Stored Procedure . I want to calculate YTD also.
Suppose user enter @frDate = '01/01/2021' and @ToDate = '31/01/2021' then YTD value will be from 01/04/2020 t0 31/01/2021
Alter PROCEDURE [dbo].[SpBpGroupWiseSalePurchase]
@frDate date,
@toDate date,
@DocType nvarchar(1)
AS
BEGIN
SET NOCOUNT ON;
if @DocType = 'I'
Begin
SELECT Code,Name,
(Select sum(InvoiceTotal) from InvoiceLine where DocumentDate between @frDate and @ToDate) as "Total Sales"
from InvoiceHeader T0
End
END
Thanks