/*Cel tego datasetu sa podstawowe dane do analizy dla indeksu bez noise*/
declare @itemid uniqueidentifier
select @itemid = itemid from wms.item where itemcode= 'CE00000028'
print @itemid
--zqname: wms.item
select * from wms.item where itemid = @itemid
--zqname: document.documentline
select
-- excluded [documentNR],[documentMonth],[addUsername], [modDate], [modUsername],[fullTextCat],
[documentLineID], [documentID], [sourceDocumentLineID], [orderLineID], [documentFullNR], [itemID], [itemQuantity], [itemQuantityLeft], [itemPrice], [itemValue], [itemValueLeft], [itemSerialNumber], [locationID], [sign], [addDate], [fullTextKeyword], [fullTextID], [status], [documentOrdinalNumber], [itemConvertUnit], [itemConvertQuantity], [itemConvertPrice], [commisionLineID], [sysItemPrice], [sysItemValue], [sysItemValueLeft], [invoiceLineId], [outcomeShiftLineId], [locationIdB], [itemIDB], [isCorrectiveLine], [correctedItemQuantity], [correctedItemPrice], [initialSourceDocumentLineId], [inventorySheetLineId], [additionalValue], [CNCCode], [correctedItemValue], [additionalPrice], [sysAdditionalPrice], [sysCorrectedItemPrice], [relPriceOutShLineID], [agrItemQuantity], [agrItemPrice], [agrItemValue], [commisionID], [manualCommisionLineID], [initialIncomeSourceLineID], [signValue], [matchedRequisitionID], [matchedRequisitionQuantity], [matchedQuantityDifference], [hasInitialIncomeQuantityLeft], [pwDocumentLineID], [structureLineID], [testDocumentLineID], [commitTimeMs], [sysCorrectedItemValueQcorrExcluded], [importRelationID], [archive]
from document.documentline where itemid = @itemid and status>0 order by adddate
--zqname: document.document
select
-- excluded [barcodeCollectorCommisionLineIdList], [manualAccounting], [commitException], [commitTimeMs], [productStockVirtualLocationID], [commitTaskID], [commitIssuedDate], [importID], [documentMonth],[addUsername], [modDate], [modUsername], [fullTextKeyword], [fullTextCat], [financialSystemExport], [accDate], [accUsername],
[documentID], [documentDate], [warehouseID], [warehouseIDB], [documentType], [documentNR], [documentFullNR], [documentCode], [firmID], [invoiceNR], [orderID], [commisionID], [addDate], [status], [documentOutNR], [fullTextID], [commisionLineID], [organisationUnitID], [documentMemo], [currency], [currencyExchangeRate], [currencyExchangeDate], [outcomeShiftId], [correctedDocumentId], [initialCorrectedDocumentId], [outcomeItemId], [CNCCode], [trashItemId], [trashItemQuantity], [outcomeTrashLocationId], [incomeTrashLocationId], [lastCorrectionDocumentID], [sumItemQuantity], [sumItemValue], [sumSysItemValue], [barcodeCollectorCommisionIDlist], [currencyExchangeTableNumber], [trashItemPrice]
from document.document where documentid in (select documentid from document.documentline where itemid = @itemid and status>0) order by adddate
--zqname: wms.stockBalance
select * from
wms.stockBalance where itemid =@itemid