Advertisement
Guest User

Untitled

a guest
Jul 26th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. select
  2. pih.[PO Number],
  3. pih.[Pre-Assigned No_] as [Invoice No],
  4. pil.[Document No_],
  5. pil.[Description] as [Reason For Discrepency],
  6. pil.[Line No_],
  7. pl.[No_] as [Item No],
  8. pl.[Vendor Item No_],
  9. pl.[Order Date],
  10. pil.[Posting Date],
  11. pil.[Expected Receipt Date],
  12. pih.[Notes] as [Header Notes],
  13. pil.[No_] as [G/L Account No],
  14. pih.[Buy-from Vendor No_],
  15. pih.[Buy-from Vendor Name],
  16. Pil.Quantity as [Inv Qty From InvoiceLine],
  17. pil.[Amount Including VAT] as [Inv Value From InvoiceLine],
  18. pl.Quantity as [PO Quantity From Purchaseline],
  19. pl.[Quantity Received] as [Received Qty From PurchaseLine],
  20. pl.[Quantity Invoiced] as [Invoiced Qty From PurchaseLine] ,
  21. pl.[Amount Including VAT] as [PO Value From PurchaseLine]
  22. from
  23. [Purch_ Inv_ Line] pil
  24. inner join
  25. Purch_ Inv_ Header] pih
  26. on pil.[Document No_]= pih.[No_]
  27. left join [Purchase Line] pl
  28. on pih.[PO Number]=pl.[Document No_]
  29. and pl.[Line No_]=pil.[Line No_]
  30. where
  31. PIL.[Document No_] in
  32. (
  33. select distinct pil.[Document No_] from
  34. Purch_ Inv_ Line] pil
  35. where piL.[No_] in ('700xxx','700xxx','17xxxxx') and pil.[Posting Date] >=getdate()-7
  36. )
  37. and piL.[Type]='1'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement