Advertisement
Pandaaaa906

Untitled

Dec 7th, 2021
360
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. SELECT
  2. iArrQTY - arr.iQuantity,
  3. po_m.cPOID,
  4. po_d.ID,
  5. po_d.cInvCode,
  6. po_d.iQuantity,
  7. po_d.iNum,
  8. po_d.iSum,
  9. po_d.iNatSum,
  10. po_d.iInvQTY,
  11. po_d.iInvNum,
  12. po_d.iArrQTY,
  13. po_d.iArrNum,
  14. po_d.iArrMoney,
  15. po_d.iNatArrMoney,
  16. po_d.fPoValidQuantity,
  17. po_d.fPoValidNum,
  18. po_d.fPoArrQuantity,
  19. po_d.fPoArrNum,
  20.  
  21. rd01.iQuantity rd_quantity,
  22. rd01.iNum rd_inum,
  23. arr.iQuantity arr_quantity,
  24. arr.iNum arr_inum
  25.  
  26. -- update po_d
  27. --
  28. -- set iArrQTY = arr.iQuantity,
  29. -- iArrNum = arr.iNum,
  30. -- iArrMoney = arr.iOriSum,
  31. -- iNatArrMoney = arr.iSum,
  32. -- fPoValidQuantity = arr.iQuantity,
  33. -- fPoValidNum = arr.iNum,
  34. -- fPoArrQuantity = arr.iQuantity,
  35. -- fPoArrNum = arr.iNum
  36.  
  37. FROM [dbo].[PO_Podetails] po_d
  38.  
  39. LEFT JOIN PO_Pomain po_m
  40. ON po_d.POID = po_m.POID
  41.  
  42. LEFT JOIN (
  43. select
  44. rd01_d.iPOsID,
  45. sum(rd01_d.iQuantity) iQuantity,
  46. sum(rd01_d.iNum) iNum
  47. FROM RdRecords01 rd01_d
  48. GROUP BY rd01_d.iPOsID
  49. ) rd01
  50. on rd01.iPOsID = po_d.ID
  51.  
  52. LEFT JOIN (
  53. SELECT
  54. arr_d.iPOsID,
  55. sum(arr_d.iOriSum) iOriSum,
  56. sum(arr_d.iSum) iSum,
  57. sum(arr_d.iQuantity) iQuantity,
  58. sum(arr_d.iNum) iNum
  59. FROM PU_ArrivalVouchs arr_d
  60. GROUP BY arr_d.iPOsID
  61. ) arr
  62. on arr.iPOsID = po_d.ID
  63.  
  64. where po_d.iArrQTY != arr.iQuantity
  65. -- and iArrMoney != iNatArrMoney
  66. -- and po_d.iArrQty = iInvQTY + 5
  67. -- or arr.iQuantity > po_d.iQuantity
  68.  
  69. -- and cInvCode like '%CWLT600728%'
  70. -- and cInvCode not like 'YF%'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement