ALTER PROCEDURE [dbo].[DailySummary] -- Add the parameters for the stored procedure here @StartDate datetime = null, @RegionCode varchar(30) = null AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. --Declare @DateA datetime --set @DateA=dateadd(hour,00,@StartDate) Declare @DateB datetime set @DateB = convert(datetime, convert(Varchar(12), @StartDate, 106) + ' 23:59:59PM') --set @DateB = DATEADD(minute, txn.59, txn.@StartDate) --set @DateB = DATEADD(SECOND, txn.59, txn.@StartDate) SET NOCOUNT ON; -- Insert statements for procedure here select distinct txn.Source_GpoName as GPO_Name,count(MoNo) as Total_EMO,Sum(Amount) as EMO_Value , sum(Commision) as Commission,Sum(Amount+ Commision)as Total_Amount from MOTxn txn INNER JOIN AllPostOffice AS po ON txn.Source_GpoName = po.Name where EntryDate between --( DATEDIFF(d,@StartDate,MOTxn_txn.EntryDate ) >= 0 -- AND DATEDIFF(d,@DateB,MOTxn_txn.EntryDate)<= 0) @StartDate and @DateB --convert(date,@StartDate) AND convert(date,DateADD(dd,1,@EndDate)) --convert(date,@StartDate) AND convert(date,DateADD(dd,1,@DateB)) --WHERE EntryDate Between ( DATEDIFF(d,@StartDate,MOTxn_txn.EntryDate ) >= 0 --AND DATEDIFF(d,@DateB,MOTxn_txn.EntryDate)<= 0) --AND ( EntryDate <> 0 ) --and isPaid='0' and po.RegionCode LIKE ISNULL(@RegionCode ,'') + '%' group by Source_GpoName END
WHERE DATEDIFF(d,@startDate,vv_TxnTemp.CreatedOn ) >= 0 AND DATEDIFF(d,@endDate2,vv_TxnTemp.CreatedOn)<= 0
@StartDate date where cast(EntryDate as date) = @StartDate
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)