export const openOrders = `
Select LEFT(ArtikelVariantenAlias, charindex(' ', ArtikelVariantenAlias) - 1) customerItemNumber,
x.IdArtikelVarianten AS article,
ArtikelVariantenAlias AS articleDescription,
IdAuftragsAbruf as releaseNumber,
AuftragsNummer AS header, 
PositionsNummer as customerLineItemNo,
AbrufNummer AS customerReleaseNumber,
AbrufMengeVPK AS pallets,
AbrufMenge AS qty,
y.TradeUnits AS cartons,
IdAdresse AS customerID,
LieferAdressBez as DeliveryAddressDescription,
AbrufLadeDatum AS loadingDate,
AbrufLiefertermin AS deliveryDate
,Remark
--,OrderStatus = 'loading'
--,*
FROM alplaprod_test1.dbo.V_TrackerAuftragsAbrufe (nolock) x

left join 
[test1_AlplaPROD2.0_Read].[order].[Release] (nolock) y on
x.IdAuftragsAbruf = y.ReleaseNumber

--WHERE AbrufStatus = 1 AND AbrufLiefertermin < getdate() + 5 AND GelieferteMenge = 0
WHERE AbrufStatus = 1 AND AbrufLiefertermin between getDate() + -[sDay] and  getdate() + [eDay] AND GelieferteMenge = 0
ORDER BY AbrufLiefertermin
`;
