1: PACKAGE BODY ARP_ETAX_INVAPI_UTIL AS
2: /* $Header: AREBTIAB.pls 120.27.12010000.6 2008/12/22 17:50:00 mraymond ship $ */
3:
4: /*=======================================================================+
5: | Package Globals
39: p_request_id IN NUMBER) IS
40:
41: BEGIN
42: IF PG_DEBUG in ('Y', 'C') THEN
43: debug('arp_etax_invapi_util.insert_headers()+');
44: END IF;
45:
46: /* 4666566 added ship_to columns. Note that invoice API
47: only supports ship_to at header level at this time
178: WHERE HGT.trx_id = IL.customer_trx_id
179: GROUP BY IL.customer_trx_id);
180:
181: IF PG_DEBUG in ('Y', 'C') THEN
182: debug('arp_etax_invapi_util.insert_headers()-');
183: END IF;
184:
185: EXCEPTION
186: WHEN NO_DATA_FOUND
184:
185: EXCEPTION
186: WHEN NO_DATA_FOUND
187: THEN
188: debug('arp_etax_invapi_util.insert_headers()- No transaction headers to process.');
189: RETURN;
190: WHEN OTHERS
191: THEN
192: debug('EXCEPTION: ARP_ETAX_INVAPI_UTIL.insert_headers()-');
188: debug('arp_etax_invapi_util.insert_headers()- No transaction headers to process.');
189: RETURN;
190: WHEN OTHERS
191: THEN
192: debug('EXCEPTION: ARP_ETAX_INVAPI_UTIL.insert_headers()-');
193: RAISE;
194:
195: END insert_headers;
196:
215: l_so_org_id VARCHAR2(20);
216: l_lines_updated NUMBER;
217: BEGIN
218: IF PG_DEBUG in ('Y', 'C') THEN
219: debug('arp_etax_invapi_util.insert_lines()+');
220: END IF;
221:
222: l_so_org_id := oe_profile.value('SO_ORGANIZATION_ID',
223: arp_global.sysparam.org_id);
429:
430: IF PG_DEBUG in ('Y', 'C') THEN
431: l_lines_updated := SQL%ROWCOUNT;
432: debug('lines update (poo columns) = ' || l_lines_updated);
433: debug('arp_etax_invapi_util.insert_lines()-');
434: END IF;
435:
436:
437: EXCEPTION
436:
437: EXCEPTION
438: WHEN OTHERS
439: THEN
440: debug('EXCEPTION: ARP_ETAX_INVAPI_UTIL.insert_lines()- ' ||
441: SQLERRM);
442: RAISE;
443: END insert_lines;
444:
452: PROCEDURE insert_tax_lines IS
453:
454: BEGIN
455: IF PG_DEBUG in ('Y', 'C') THEN
456: debug('arp_etax_invapi_util.insert_tax_lines()+');
457: END IF;
458:
459:
460: INSERT INTO ZX_IMPORT_TAX_LINES_GT
528: END IF;
529:
530:
531: IF PG_DEBUG in ('Y', 'C') THEN
532: debug('arp_etax_invapi_util.insert_tax_lines()-');
533: END IF;
534:
535: EXCEPTION
536: WHEN OTHERS
534:
535: EXCEPTION
536: WHEN OTHERS
537: THEN
538: debug('EXCEPTION: ARP_ETAX_INVAPI_UTIL.insert_tax_lines()-');
539: RAISE;
540:
541: END insert_tax_lines;
542:
565:
566: BEGIN
567:
568: IF PG_DEBUG in ('Y', 'C') THEN
569: debug('arp_etax_invapi_util.populate_ebt_gt()+');
570: END IF;
571:
572: /* Insert lines into ZX_TRX_HEADERS_GT */
573: insert_headers(p_request_id);
581: IF PG_DEBUG in ('Y', 'C') THEN
582: debug('headers inserted : ' || g_headers_inserted);
583: debug('lines inserted : ' || g_lines_inserted);
584: debug('tax lines inserted : ' || g_tax_lines_inserted);
585: debug('arp_etax_invapi_util.populate_ebt_gt()-');
586: END IF;
587:
588: EXCEPTION
589: WHEN OTHERS THEN
587:
588: EXCEPTION
589: WHEN OTHERS THEN
590: IF PG_DEBUG in ('Y', 'C') THEN
591: debug('EXCEPTION: ARP_ETAX_INVAPI_UTIL.populate_ebt_gt()');
592: END IF;
593: RAISE;
594:
595: END populate_ebt_gt;
601: l_rows1 NUMBER;
602: l_rows2 NUMBER;
603: BEGIN
604: IF PG_DEBUG in ('Y', 'C') THEN
605: debug('arp_etax_invapi_util.build_ar_tax_lines()+');
606: END IF;
607:
608: /* Dev Notes:
609: 1) swapped zx_detail_tax_lines_gt to zx_lines per svaze in IM
826:
827: IF PG_DEBUG in ('Y', 'C') THEN
828: debug(' Number of tax lines retrieved autotax lines = ' || l_rows2);
829: debug(' Number of tax lines retrieved manualtax lines = ' || l_rows1);
830: debug('arp_etax_invapi_util.build_ar_tax_lines()-');
831: END IF;
832: END build_ar_tax_lines;
833:
834: /* Procedure to extract error/validation messages from ZX
841:
842: BEGIN
843:
844: IF PG_DEBUG in ('Y', 'C') THEN
845: debug('arp_etax_invapi_util.retrieve_tax_validation_errors()+');
846: END IF;
847:
848: /* Dev Notes:
849:
868: p_error_count := l_trx_line_errors;
869:
870: IF PG_DEBUG in ('Y', 'C') THEN
871: debug('Validation errors: ' || l_trx_line_errors);
872: debug('arp_etax_invapi_util.retrieve_tax_validation_errors()-');
873: END IF;
874:
875: END retrieve_tax_validation_errors;
876:
883: l_return_status NUMBER := 0;
884: BEGIN
885: IF PG_DEBUG in ('Y', 'C')
886: THEN
887: debug('arp_etax_invapi_util.calculate_tax()+');
888: END IF;
889:
890: /* Insert data into ebt tables */
891: populate_ebt_gt(p_request_id);
924: END IF;
925:
926: IF PG_DEBUG in ('Y', 'C')
927: THEN
928: debug('arp_etax_invapi_util.calculate_tax()-');
929: END IF;
930: END calculate_tax;
931:
932: PROCEDURE cleanup_tax(p_trx_id IN NUMBER) IS
973: END IF;
974:
975: EXCEPTION
976: WHEN OTHERS THEN
977: debug('EXCEPTION: ARP_ETAX_INVAPI_UTIL.INITIALIZE()');
978: RAISE;
979:
980: END ARP_ETAX_INVAPI_UTIL;
976: WHEN OTHERS THEN
977: debug('EXCEPTION: ARP_ETAX_INVAPI_UTIL.INITIALIZE()');
978: RAISE;
979:
980: END ARP_ETAX_INVAPI_UTIL;