You are on page 1of 4

Custamizing Payment Register ---------------------------------------------------------------CF_1 : Formula Column for payment workbench count invoice number ---------------------------------------------------------------_______________ function CF_1Formula

return Char is l_count number; L_inv_num Varchar2(200); L_inv_num_M varchar2(200); begin Begin select count(ai.invoice_num) into l_count from ap_suppliers aps, ap_supplier_sites_all ass, ap_invoices_all ai, ap_checks_all ac where aps.VENDOR_ID=ass.VENDOR_ID and ass.VENDOR_SITE_ID=ai.VENDOR_SITE_ID and ai.VENDOR_ID=aps.VENDOR_ID and aps.VENDOR_ID=ac.VENDOR_ID and ass.VENDOR_SITE_ID=ac.VENDOR_SITE_ID and ac.CHECK_NUMBER='10003' and aps.segment1 = '5037'; exception ----when no_data_found then --return(Null); when others then return(null); --l_count:=null; end; if l_count=1 then select --count(ac.CHECK_NUMBER) --into l_count ai.invoice_num Into L_Inv_num from ap_suppliers aps, ap_supplier_sites_all ass, ap_invoices_all ai, ap_checks_all ac where aps.VENDOR_ID=ass.VENDOR_ID and ass.VENDOR_SITE_ID=ai.VENDOR_SITE_ID and ai.VENDOR_ID=aps.VENDOR_ID and aps.VENDOR_ID=ac.VENDOR_ID and ass.VENDOR_SITE_ID=ac.VENDOR_SITE_ID and ac.CHECK_NUMBER='10003' and aps.segment1 = '5037'; return(L_Inv_num); elsif l_count=0 then return null; elsif l_count >1 then for i IN ( ai.invoice_num --Into L_Inv_num from ap_suppliers aps, select

ap_supplier_sites_all ass, ap_invoices_all ai, ap_checks_all ac where aps.VENDOR_ID=ass.VENDOR_ID and ass.VENDOR_SITE_ID=ai.VENDOR_SITE_ID and ai.VENDOR_ID=aps.VENDOR_ID and aps.VENDOR_ID=ac.VENDOR_ID and ass.VENDOR_SITE_ID=ac.VENDOR_SITE_ID and ac.CHECK_NUMBER='10003' and aps.segment1 = '5037') loop l_Inv_num:=i.invoice_num; l_Inv_Num_M:=NVL(l_Inv_Num_M,'')||';'||l_Inv_num; end loop; return(ltrim(l_Inv_Num_M,';')); else return null; end if; end; -------------------------------------------------------Formula Column for payment workbench count invoice number --------------------------------------------------------------------------------------------------------------function CF_1Formula return Char is l_count number; L_inv_num Varchar2(200); L_inv_num_M varchar2(200); begin Begin select count(ai.invoice_num) into l_count from ap_suppliers aps, ap_supplier_sites_all ass, ap_invoices_all ai, ap_checks_all ac where aps.VENDOR_ID=ass.VENDOR_ID and ass.VENDOR_SITE_ID=ai.VENDOR_SITE_ID and ai.VENDOR_ID=aps.VENDOR_ID and aps.VENDOR_ID=ac.VENDOR_ID and ass.VENDOR_SITE_ID=ac.VENDOR_SITE_ID and ac.CHECK_NUMBER='10003' and aps.segment1 = '5037'; exception ----when no_data_found then --return(Null); when others then return(null); --l_count:=null; end; if l_count=1 then select ai.invoice_num Into L_Inv_num from ap_suppliers aps, ap_supplier_sites_all ass, ap_invoices_all ai, ap_checks_all ac

where aps.VENDOR_ID=ass.VENDOR_ID and ass.VENDOR_SITE_ID=ai.VENDOR_SITE_ID and ai.VENDOR_ID=aps.VENDOR_ID and aps.VENDOR_ID=ac.VENDOR_ID and ass.VENDOR_SITE_ID=ac.VENDOR_SITE_ID and ac.CHECK_NUMBER='10003' and aps.segment1 = '5037'; return(L_Inv_num); elsif l_count=0 then return null; elsif l_count >1 then for i IN (select ai.invoice_num --Into L_Inv_num from ap_suppliers aps, ap_supplier_sites_all ass, ap_invoices_all ai, ap_checks_all ac where aps.VENDOR_ID=ass.VENDOR_ID and ass.VENDOR_SITE_ID=ai.VENDOR_SITE_ID and ai.VENDOR_ID=aps.VENDOR_ID and aps.VENDOR_ID=ac.VENDOR_ID and ass.VENDOR_SITE_ID=ac.VENDOR_SITE_ID and ac.CHECK_NUMBER='10003' and aps.segment1 = '5037') loop l_Inv_num:=i.invoice_num; l_Inv_Num_M:=NVL(l_Inv_Num_M,'')||';'||l_Inv_num; end loop; return(ltrim(l_Inv_Num_M,';')); else return null; end if; end; ---------------------------------------------------Formate Trigger --- Supplers ------------------------------function F_2FormatTrigger return boolean is begin if:P_Address_option='Y' then return (TRUE); elsif :P_Address_option='N'Then return(false); end if; end; ------------------------------------------------------------PO query ======== SELECT pha.segment1 po_num, pha.creation_date created, pha.type_lookup_code TYPE, aps.vendor_name supplier,aps.SEGMENT1 supplier _num, ass.vendor_site_code site, ass.address_line1, ass.address_line2, ass.address_line3, ass.city, ass.state, ass.country, ass.zip,

DECODE (apsc.vendor_contact_id, NULL, '0') contact, hrla.location_code ship_to, hrla1.location_code bill_to, pha.currency_code currency, DECODE (agent_id, '31418', 'S01 SAI TEJA') buyer, pha.authorization_status status, plt.purchase_basis line_type, msi.segment1 item, mc.segment1 || '.' || mc.segment2 CATEGORY, pla.item_description description, pla.unit_meas_lookup_code uom, pla.quantity, pla.unit_price, pll.quantity_received received, pll.quantity_accepted, pll.quantity_cancelled cancelled, pll.quantity_billed billed, pda.destination_type_code distri_type, pda.destination_subinventory subinventory, pda.req_header_reference_num requistion_num, gcc.concatenated_segments "PO Accrual Account" FROM po_headers_all pha, ap_suppliers aps, ap_supplier_sites_all ass, ap_supplier_contacts apsc, hr_locations_all_tl hrla, hr_locations_all_tl hrla1, po_lines_all pla, po_line_types_b plt, mtl_system_items_b msi, mtl_categories_b mc, po_line_locations_all pll, po_distributions_all pda, gl_code_combinations_kfv gcc WHERE rownum<100 --pha.po_header_id = '110387' and pha.vendor_id = aps.vendor_id AND pha.vendor_site_id = ass.vendor_site_id AND pha.vendor_contact_id = apsc.vendor_contact_id(+) AND hrla.location_id(+) = pha.ship_to_location_id AND hrla.LANGUAGE(+) = USERENV ('LANG') AND hrla1.location_id(+) = pha.bill_to_location_id AND hrla1.LANGUAGE(+) = USERENV ('LANG') AND pla.po_header_id = pha.po_header_id AND pla.line_type_id = plt.line_type_id AND msi.inventory_item_id = pla.item_id AND mc.category_id = pla.category_id AND pll.po_header_id = pha.po_header_id AND pll.po_line_id = pla.po_line_id AND pda.po_header_id = pha.po_header_id AND pda.po_line_id = pla.po_line_id AND pda.line_location_id = pll.line_location_id AND gcc.code_combination_id = pda.code_combination_id;

You might also like