1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| USE [LEHI]
GO
/****** Object: StoredProcedure [dbo].[BeneficeVente] Script Date: 11/09/2015 13:00:36 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
ALTER PROCEDURE [dbo].[BeneficeVente] (@DateDebut as Date,@DateFin as Date,@NomElt as nvarchar,@Carburant as Bit,@TypeEtatParJour as bit)
-- Add the parameters for the stored procedure here
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
BEGIN
select dateoperation as Elt,sum(vente) as Vte,sum(achat) as Ach,sum(vente-achat) as Benef,cast(@DateDebut as nvarchar)+' au '+cast(@DateFin as nvarchar) As Periode,upper(@NomElt) as NomElt,(select sum(sortie) as D from mvt_caisse where (dateoperation between @DateDebut and @DateFin)) as Depense from benefice where (dateoperation between @DateDebut and @DateFin) and (carb=@Carburant) group by dateoperation
END
END |
Partager