DBA Data[Home] [Help]

VIEW: APPS.CN_SRP_PAYRUNS

Source

View Text - Preformatted

SELECT cns.salesrep_id salesrep_id, cns.name salesrep_name, cnp.payrun_id , cns.employee_number, cns.org_id from cn_payruns cnp, cn_srp_pay_groups cnspg, cn_salesreps cns, cn_period_statuses cnps WHERE cnp.status = 'UNPAID' and cnp.pay_group_id = cnspg.pay_group_id and cnspg.salesrep_id = cns.salesrep_id and cnspg.org_id = cns.org_id and cns.hold_payment = 'N' and cnp.pay_period_id = cnps.period_id and cnp.org_id = cnps.org_id and cnps.end_date >= cnspg.start_date and cnps.end_date <= Nvl(cnspg.end_date, cnps.end_date) and not exists (select 1 from cn_payment_worksheets cnpw where cnpw.salesrep_id = cns.salesrep_id and cnp.payrun_id = cnpw.payrun_id and cnpw.org_id = cns.org_id )
View Text - HTML Formatted

SELECT CNS.SALESREP_ID SALESREP_ID
, CNS.NAME SALESREP_NAME
, CNP.PAYRUN_ID
, CNS.EMPLOYEE_NUMBER
, CNS.ORG_ID
FROM CN_PAYRUNS CNP
, CN_SRP_PAY_GROUPS CNSPG
, CN_SALESREPS CNS
, CN_PERIOD_STATUSES CNPS
WHERE CNP.STATUS = 'UNPAID'
AND CNP.PAY_GROUP_ID = CNSPG.PAY_GROUP_ID
AND CNSPG.SALESREP_ID = CNS.SALESREP_ID
AND CNSPG.ORG_ID = CNS.ORG_ID
AND CNS.HOLD_PAYMENT = 'N'
AND CNP.PAY_PERIOD_ID = CNPS.PERIOD_ID
AND CNP.ORG_ID = CNPS.ORG_ID
AND CNPS.END_DATE >= CNSPG.START_DATE
AND CNPS.END_DATE <= NVL(CNSPG.END_DATE
, CNPS.END_DATE)
AND NOT EXISTS (SELECT 1
FROM CN_PAYMENT_WORKSHEETS CNPW
WHERE CNPW.SALESREP_ID = CNS.SALESREP_ID
AND CNP.PAYRUN_ID = CNPW.PAYRUN_ID
AND CNPW.ORG_ID = CNS.ORG_ID )