feat(eom): lastSales, lastPurch added to be pulled with new template
This commit is contained in:
17
server/services/sqlServer/querys/eom/lastSalesprice.ts
Normal file
17
server/services/sqlServer/querys/eom/lastSalesprice.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
export const lastSalesPriceCheck = `
|
||||
use AlplaPROD_test1
|
||||
|
||||
select * from
|
||||
(select IdArtikelvarianten as av,
|
||||
VKPreis as salesPrice,
|
||||
MPB, FWMPAlpla,
|
||||
FWMPB,
|
||||
ROW_NUMBER() over(partition by IdArtikelVarianten order by gueltigabdatum desc) rn,
|
||||
convert(date, gueltigabdatum, 120) as validDate
|
||||
from dbo.T_HistoryVK (nolock)
|
||||
where convert(date, gueltigabdatum, 120) <= '[date]' and StandardKunde = 1) a
|
||||
where rn =1
|
||||
order by av asc,
|
||||
validDate desc
|
||||
|
||||
`;
|
||||
17
server/services/sqlServer/querys/eom/lstPurchasePrice.ts
Normal file
17
server/services/sqlServer/querys/eom/lstPurchasePrice.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
export const lastPurchasePrice = `
|
||||
use AlplaPROD_test1
|
||||
|
||||
SELECT plant=(SELECT Wert FROM dbo.T_SystemParameter (nolock) WHERE (Bezeichnung = 'Werkskuerzel')),
|
||||
plantName=(SELECT Wert FROM dbo.T_SystemParameter AS T_SystemParameter (nolock) WHERE (Bezeichnung = 'Mandant-intern')),*
|
||||
from
|
||||
(Select IdBestellung as 'Purchase order number',
|
||||
IdArtikelVarianten AS AV,
|
||||
BestellMenge,
|
||||
BestellMengeVPK,
|
||||
PreisProEinheit,
|
||||
convert(varchar,Lieferdatum,23) as deliveryDate,
|
||||
ROW_NUMBER() over(partition by IdArtikelVarianten order by Lieferdatum desc) rn
|
||||
from dbo.V_Bestellpositionen_PURCHASE (nolock)
|
||||
where PositionsStatus = '7' or PositionsStatus = '6' or PositionsStatus = '5' and convert(varchar,Lieferdatum,23) > DATEADD(year, -5, GetDate()) )a
|
||||
where rn = 1
|
||||
`;
|
||||
Reference in New Issue
Block a user