Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2014
228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.29 KB | None | 0 0
  1. select "PO Number2", "Total"
  2.  
  3. from (select distinct "PO Number2", sum("Amount") as "Total"
  4.  
  5. from (select distinct account as Account,
  6. company as Company,
  7. year_period_key as "Year Period Key",
  8. voucher_no as "Voucher No",
  9. voucher_type as "Vou Type",
  10. voucher_date as "GRN/Invoice Date",
  11. reference_number as "PO Number2",
  12. code_c as "Project ID",
  13. ifsapp.PURCHASE_ORDER_API.Get_Vendor_No(reference_number) as "Supplier ID",
  14. ifsapp.SUPPLIER_INFO_API.Get_Name(ifsapp.PURCHASE_ORDER_API.Get_Vendor_No(reference_number)) as "Supplier Name",
  15. sum(quantity) as "Quantity",
  16. sum(amount) as "Amount",
  17. sum(debet_amount) as "Debit Amount",
  18. sum(credit_amount) as "Credit Amount"
  19.  
  20. from ifsapp.GEN_LED_VOUCHER_ROW_UNION_QRY
  21.  
  22. where account = '222010'
  23. and Voucher_Type = '0'
  24.  
  25. group by voucher_type,
  26. account,
  27. year_period_key,
  28. voucher_date,
  29. reference_number,
  30. code_c,
  31. company,
  32. voucher_no,
  33. party_type_id
  34.  
  35. union all
  36.  
  37. select distinct account as Account,
  38. company as Company,
  39. year_period_key as "Year Period Key",
  40. voucher_no as "Voucher No",
  41. voucher_type as "Vou Type",
  42. voucher_date as "GRN/Invoice Date",
  43. ifsapp.MAN_SUPP_INVOICE_API.Get_Purchase_Order_Ref_Number(company,
  44. party_type_id,
  45. 'Supplier',
  46. reference_number) as "PO Number2",
  47. code_c as "Project ID",
  48. ifsapp.PURCHASE_ORDER_API.Get_Vendor_No(ifsapp.MAN_SUPP_INVOICE_API.Get_Purchase_Order_Ref_Number(company,
  49. party_type_id,
  50. 'Supplier',
  51. reference_number)) as "Supplier ID",
  52. ifsapp.SUPPLIER_INFO_API.Get_Name(ifsapp.PURCHASE_ORDER_API.Get_Vendor_No(ifsapp.MAN_SUPP_INVOICE_API.Get_Purchase_Order_Ref_Number(company,
  53. party_type_id,
  54. 'Supplier',
  55. reference_number))) as "Supplier Name",
  56. sum(quantity) as "Quantity",
  57. sum(amount) as "Amount",
  58. sum(debet_amount) as "Debit Amount",
  59. sum(credit_amount) as "Credit Amount"
  60.  
  61. from ifsapp.GEN_LED_VOUCHER_ROW_UNION_QRY
  62.  
  63. where account = '222010'
  64. and Voucher_Type = 'J'
  65. group by voucher_type,
  66. account,
  67. year_period_key,
  68. voucher_date,
  69. reference_number,
  70. code_c,
  71. company,
  72. voucher_no,
  73. party_type_id)
  74.  
  75. where "Year Period Key" <= '&YearPeriodKey'
  76. group by "PO Number2")
  77.  
  78. where "Total" = 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement