You are on page 1of 2

select papf.full_name --,papf.last_name||','||papf.first_name||','||papf.middle_names -- ,PDIA.ra_invoice_number -- ,PDII.draft_invoice_num -- ,PCRDLA.expenditure_item_id --,PEA.expenditure_ending_date --,PEIA.system_linkage_function ,PEIA.bill_job_billing_title ,PT.task_number ,PEIA.expenditure_type -- ,PEIA.expenditure_item_date /* ,CASE WHEN pet.

Unit_Of_Measure = 'HOURS'AND PCRDLA.Line_Num_Reversed IS NOT NULL T HEN (PEIA.Quantity*-1) WHEN pet.Unit_Of_Measure = 'HOURS' AND PCRDLA.Line_Num_Reversed IS NULL THEN P EIA.Quantity ELSE 0 END AS Hours4 ,CASE WHEN pet.Unit_Of_Measure = 'DAY' AND PCRDLA.Line_Num_Reversed IS NOT NULL THEN (PEIA.Quantity*-1) WHEN pet.Unit_Of_Measure = 'DAY' AND PCRDLA.Line_Num_Reversed IS NULL THEN PEI A.Quantity ELSE 0 END AS Days4*/ ,PET.unit_of_measure ,PEIA.bill_rate ,Round(PCRDLA.bill_trans_bill_amount,2) as BILL_AMOUNT FROM pa.pa_draft_invoices_all PDIA ,pa.pa_draft_invoice_items PDII ,pa.pa_cust_rev_dist_lines_all PCRDLA ,pa.pa_projects_all PPA ,pa.pa_expenditure_items_all PEIA ,pa.pa_expenditure_types PET ,pa.pa_expenditures_all PEA ,pa.pa_tasks PT ,hr.per_all_people_f PAPF ,pa.pa_project_customers PPC ,apps.AR_CUSTOMERS ARC WHERE 1 = 1 AND PDIA.project_id = PDII.project_id AND PDIA.draft_invoice_num = PDII.draft_invoice_num AND PDII.project_id = PCRDLA.project_id AND PDII.draft_invoice_num = PCRDLA.draft_invoice_num AND PDII.line_num = PCRDLA.draft_invoice_item_line_num AND PCRDLA.expenditure_item_id = PEIA.expenditure_item_id AND PEIA.expenditure_type = PET.expenditure_type AND PEIA.expenditure_id = PEA.expenditure_id AND PDIA.project_id = PPA.project_id AND PEIA.task_id = PT.task_id AND PEA.incurred_by_person_id = PAPF.person_id AND PEA.expenditure_ending_date BETWEEN papf.effective_start_date AND papf.e ffective_end_date AND PPA.project_id = PPC.project_id AND PPC.customer_id = ARC.customer_id AND PET.expenditure_category = 'LABOR' --note this and PDII.draft_invoice_num = 4 and ppa.project_id = 7

--AND PET.revenue_category_code = 'LABOR' --not needed? --AND ppa.segment1 = 'FIRST T&M' --AND ppa.segment1 = :Project --AND PDIA.ra_invoice_number between :Invoice and :InvoiceT --GROUP BY papf.full_name --,PEIA.bill_job_billing_title --,PT.task_number

You might also like