Wednesday, September 26, 2018

Export employee data with personal expenses in i-expense and the expense is not claimed


SELECT pap.full_name, pap.email_address, pap.employee_number,
                aeh.invoice_num, aeh.total total_amount,
                aeh.amt_due_employee personal_amount, aeh.expense_status_code,
                aeh.report_header_id, aeh.employee_id, aeh.org_id, aeh.ROWID,
                round((trunc(sysdate)-trunc(aia.creation_date)))days,aia.creation_date
           FROM ap_expense_report_headers_all aeh, per_all_people_f pap,ap_invoices_all aia
          WHERE aeh.employee_id = pap.person_id
            AND aeh.org_id = p_organization_id
            AND AIA.INVOICE_NUM=aeh.invoice_num
            AND aeh.amt_due_employee < 0
            and aia.AMOUNT_PAID = 0;

1 comment: