export const purchased = `
use AlplaPROD_test1

declare    @start_date nvarchar(30) = '[startDate] '
declare    @end_date nvarchar(30) = '[endDate] '

select  T_Wareneingaenge.IdBestellung AS Purchase_order, 
        T_Adressen.IdAdressen, 
        T_Adressen.Bezeichnung, 
        T_Wareneingaenge.IdArtikelVarianten AS AV, 
        V_Artikel.Alias, 
        x.Bemerkung AS Remark, 
        T_Wareneingaenge.Bemerkung AS Purchase_Remark, 
        x.Add_User, 
        CONVERT(DATE, x.Add_Date) AS Received_Date, 
        x.IdWareneingangPlanung, 
        T_Wareneingaenge.SollMenge As Ordered_QTY, 
        x.EntladeMenge As Received_QTY, 
        case when T_Adressen.Bezeichnung LIKE '%Alpla%' Then 'AlplaPlant' Else 'Supplier' End AS 
		Supplier, 
        x.Typ as incoming_goods_type
    from dbo.T_WareneingangPlanungen  (nolock) as x
    
    join 
    
    dbo.T_Wareneingaenge (nolock) on 
	x.IdWareneingang=
		dbo.T_Wareneingaenge.IdWareneingang
    join   
    dbo.V_Artikel (nolock) on 
	dbo.T_Wareneingaenge.IdArtikelVarianten=
	dbo.V_Artikel.IdArtikelvarianten 
    
    join  
    dbo.T_Adressen (nolock) on  dbo.T_Wareneingaenge.IdLieferantAdresse = 
	dbo.T_Adressen.IdAdressen 
    
    where x.add_date between @start_date + (select top(1) CONVERT(char(8), StartDate, 108) as startTime from [test1_AlplaPROD2.0_Read].masterData.ShiftDefinition (nolock) where TeamNumber = 1) 
    AND @end_date + (select top(1) CONVERT(char(8), StartDate, 108) as startTime from [test1_AlplaPROD2.0_Read].masterData.ShiftDefinition (nolock) where TeamNumber = 1) 
    
    order by x.add_date desc
`;
