Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- HEADER --
- Open pRefHeader FOR
- SELECT pDatetime AS datetime, f_get_ou_name(pOuId) AS ou_name, f_get_username(pUserId) AS username,
- f_get_role_name(pRoleId) AS rolename, pYearMonth AS year_month, to_char(to_date(vPeriodeIncentive, 'YYYYMMDD'), 'FMMONTH YYYY') AS periode,
- CASE WHEN pTypePenerima = vTypePenerimaCollector THEN 'COLLECTOR'
- WHEN pTypePenerima = vTypePenerimaSales THEN 'SALES'
- WHEN pTypePenerima = vTypePenerimaEkspedisi THEN 'EKSPEDISI'
- ELSE 'ALL'
- END AS type_penerima;
- RETURN NEXT pRefHeader;
- -- DETAIL --
- Open pRefDetail FOR
- SELECT CASE WHEN type_penerima = vTypePenerimaCollector THEN 'COLLECTOR'
- WHEN type_penerima = vTypePenerimaSales THEN 'SALES'
- WHEN type_penerima = vTypePenerimaEkspedisi THEN 'EKSPEDISI'
- WHEN type_penerima = vTypePenerimaEkspedisiTotal THEN 'EKSPEDISI TOTAL'
- WHEN type_penerima = vTypePenerimaUndefined THEN 'UNDEFINED' END AS type_penerima ,
- employee_code||'-'||employee_name AS employee, customer_code||'-'||customer_name AS customer,
- invoice_doc_date, invoice_doc_no, invoice_amount, allocation_doc_no, allocation_doc_date,
- payment_no_cb AS cashbank_no, payment_date_cb AS cashbank_date, payment_no_cg AS cheque_giro_no, payment_date_cg AS cheque_giro_date,
- realization_date, allocation_amount, percentage_incentive, incentive_amount
- FROM tt_invoice_list_for_incentive
- WHERE session_id = pSessionId
- AND data_id = vDataDetailId
- ORDER BY type_penerima, employee_code, customer_name, invoice_doc_date, invoice_doc_no;
- RETURN NEXT pRefDetail;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement