The following lines contain the word 'select', 'insert', 'update' or 'delete':
| AP_INVOICE_LINES_INTERFACE is updated with this tax code. |
| Note : If Tax Code is Null, we use -Taxable as the tax code | | |
+===========================================================================*/
PROCEDURE correct_tax(p_invoice_id in NUMBER, p_vendor_id in NUMBER) as
cursor num_of_tax_lines is
select count(*) from ap_invoice_lines_interface
where invoice_id = p_invoice_id and
line_type_lookup_code = 'TAX';
select org_id from ap_invoices_interface
where invoice_id = p_invoice_id;
select hl.country, hl.region_2
from po_line_locations_all poll,
po_lines_all pol,
po_headers_all poh,
hr_locations_all hl
where
poh.org_id = p_org_id and
poh.segment1= p_po_number and
pol.po_header_id =poh.po_header_id and
poll.po_line_id=pol.po_line_id and
poll.ship_to_location_id = hl.location_id
order by pol.line_num;
select tax_code
from ap_tax_derivations
where receiving_country = p_country
and receiving_state = p_state
and vendor_id = p_vendor_id;
select distinct po_number
from ap_invoice_lines_interface
where invoice_id = p_invoice_id and
po_number is not null;
select ap_invoice_lines_interface_s.nextval
into l_invoice_line_id
from dual ;
INSERT INTO AP_INVOICE_LINES_INTERFACE
(ORG_ID, INVOICE_ID, INVOICE_LINE_ID, AMOUNT,
LINE_NUMBER, LINE_TYPE_LOOKUP_CODE)
VALUES
(l_org_id, p_invoice_id, l_invoice_line_id, 0, NULL, 'TAX');
UPDATE AP_INVOICE_LINES_INTERFACE
SET TAX_CODE = l_tax_code
WHERE INVOICE_ID = p_invoice_id and
TAX_CODE is NULL;