Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
35 views2 pages

Oracle Query For Vendor

The document contains SQL queries that aggregate sales and payment data from a database, focusing on various receipt methods and transaction types for specific dates. It calculates total sales amounts, refunds, and cash received, while also filtering results based on transaction classes and receipt method names. The queries are structured to provide insights into financial transactions for a particular vendor on specified dates.

Uploaded by

shaluabu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views2 pages

Oracle Query For Vendor

The document contains SQL queries that aggregate sales and payment data from a database, focusing on various receipt methods and transaction types for specific dates. It calculates total sales amounts, refunds, and cash received, while also filtering results based on transaction classes and receipt method names. The queries are structured to provide insights into financial transactions for a particular vendor on specified dates.

Uploaded by

shaluabu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

/*Oracle vendor details */

SELECT SUM (rctl.extended_amount) sales_amount, rct.trx_class, rctt.NAME,


(SELECT SUM (arc.amount) staff_pur
FROM ar_cash_receipts_all arc, ar_receipt_methods arm
WHERE arc.receipt_method_id = arm.receipt_method_id
AND arm.NAME LIKE 'FREE%') amount,
(SELECT SUM (arc.amount)
FROM ar_cash_receipts_all arc,
ar_receipt_methods arm
WHERE arc.receipt_method_id = arm.receipt_method_id
AND arm.NAME = 'Master-106'
AND TO_CHAR (arc.receipt_date, 'DD-MON-YYYY') = '06-09-2019'
GROUP BY arm.NAME) card_master,
(SELECT SUM (arc.amount)
FROM ar_cash_receipts_all arc,
ar_receipt_methods arm
WHERE arc.receipt_method_id = arm.receipt_method_id
AND arm.NAME = 'Span-106'
AND TO_CHAR (arc.receipt_date, 'DD-MON-YYYY') = '06-09-2019'
GROUP BY arm.NAME) card_span,
(SELECT SUM (arc.amount)
FROM ar_cash_receipts_all arc,
ar_receipt_methods arm
WHERE arc.receipt_method_id = arm.receipt_method_id
AND arm.NAME = 'Visa-106'
AND TO_CHAR (arc.receipt_date, 'DD-MON-YYYY') = '06-09-2019'
GROUP BY arm.NAME) card_visa,
(SELECT SUM (arc.amount)
FROM ar_cash_receipts_all arc, ar_receipt_methods arm
WHERE arc.receipt_method_id = arm.receipt_method_id
AND arm.NAME = 'Coupon-106'
AND TO_CHAR (arc.receipt_date, 'DD-MON-YYYY') = '06-09-2019'
GROUP BY arm.NAME) coupon,
(SELECT ABS (SUM (rctl.extended_amount)) refund
FROM ra_customer_trx_all rct,
ra_customer_trx_lines_all rctl,
ra_cust_trx_types_all rctt
WHERE 1 = 1
AND rct.customer_trx_id = rctl.customer_trx_id
AND rctt.cust_trx_type_seq_id = rct.cust_trx_type_seq_id
AND rctt.NAME = 'CM-70'
AND TO_CHAR (rct.trx_date, 'DD-MON-YYYY') = '07-09-2019'
GROUP BY rct.trx_class, rctt.NAME) refund,
(SELECT SUM (arc.amount)
FROM ar_cash_receipts_all arc,
ar_receipt_methods arm
WHERE arc.receipt_method_id = arm.receipt_method_id
AND arm.NAME LIKE 'Cash-106'
AND TO_CHAR (arc.receipt_date, 'DD-MON-YYYY') = '06-09-2019'
GROUP BY arm.NAME) cash_received_in_branch,
(SELECT ABS (SUM (arc.amount))
FROM ar_cash_receipts_all arc,
ar_receipt_methods arm
WHERE arc.receipt_method_id = arm.receipt_method_id
AND arm.NAME = 'Cash-106'
AND arc.TYPE = 'MISC'
AND TO_CHAR (arc.receipt_date, 'DD-MON-YYYY') = '06-09-2019'
GROUP BY arm.NAME)
cash_transfer_to_hq,rcgl.code_combination_id,fndvl.flex_value,fndvl.description
ACCT_NAME
FROM ra_customer_trx_all rct,
ra_customer_trx_lines_all rctl,
ra_cust_trx_types_all rctt,
RA_CUST_TRX_LINE_GL_DIST_ALL rcgl,
gl_code_combinations gcc,
fnd_vs_value_sets fndv,
fnd_flex_values_vl fndvl
WHERE 1 = 1
AND rct.customer_trx_id = rctl.customer_trx_id
AND rctt.cust_trx_type_seq_id = rct.cust_trx_type_seq_id
AND rct.trx_class LIKE 'INV'
and rct.customer_trx_id=rcgl.customer_trx_id
AND TO_CHAR (rct.trx_date, 'DD-MON-YYYY') = '06-09-2019'
AND rctt.NAME = 'IN-106'
and gcc.code_combination_id=rcgl.code_combination_id
and fndv.value_set_id = fndvl.flex_value_set_id
and fndv.value_set_code = 'Branch Barn_Structure'
and fndvl.flex_value = gcc.segment3
GROUP BY rct.trx_class,
rctt.NAME,rcgl.code_combination_id,fndvl.flex_value,fndvl.description
SELECT SUM (rctl.extended_amount) sales_amount, rct.trx_class, rctt.NAME,
(SELECT SUM (arc.amount) staff_pur
FROM ar_cash_receipts_all arc, ar_receipt_methods arm
WHERE arc.receipt_method_id = arm.receipt_method_id
AND arm.NAME LIKE 'FREE%') amount,
(SELECT SUM (arc.amount)
union all
SELECT SUM (rctl.extended_amount) sales_amount, rct.trx_class, rctt.NAME,
(SELECT SUM (arc.amount) staff_pur
FROM ar_cash_receipts_all arc, ar_receipt_methods arm
WHERE arc.receipt_method_id = arm.receipt_method_id
AND arm.NAME LIKE 'FREE%') amount,
(SELECT SUM (arc.amount)

You might also like