[Home] [Help]
40: PROCEDURE DELETE_STG
41: IS
42:
43: BEGIN
44: DELETE FII_AP_INV_LINES_FSTG
45: WHERE COLLECTION_STATUS = 'LOCAL READY'OR ( COLLECTION_STATUS = 'RATE NOT AVAILABLE' OR COLLECTION_STATUS = 'INVALID CURRENCY')
46: AND INSTANCE = (SELECT INSTANCE_CODE
47: FROM EDW_LOCAL_INSTANCE);
48: END;
78: TO_NUMBER(SUBSTR(INV_LINE_PK,INSTR('INV_LINE_PK','-',1,2)+1,INSTR(INV_LINE_PK,'-',1,3)-
79: (INSTR(INV_LINE_PK,'-',1,2)+1))),
80: g_acct_or_inv_date
81:
82: FROM FII_AP_INV_LINES_FSTG fil
83:
84: WHERE
85:
86: fil.COLLECTION_STATUS = 'RATE NOT AVAILABLE'
142: IS
143:
144: BEGIN
145:
146: UPDATE FII_AP_INV_LINES_FSTG
147: SET COLLECTION_STATUS = 'READY'
148: WHERE COLLECTION_STATUS = 'LOCAL READY'
149: AND INSTANCE = (SELECT INSTANCE_CODE
150: FROM EDW_LOCAL_INSTANCE);
188: -- completed successfully.
189: -- ------------------------------------------------
190: fii_flex_mapping.init_cache('FII_AP_INV_LINES_F');
191:
192: Insert Into FII_AP_INV_LINES_FSTG(
193: APPROVAL_STATUS,
194: ACCOUNTING_DATE,
195: ACCOUNTING_DATE_FK,
196: ACCRUAL_POSTED_FLAG,
535: fstg.user_measure3, --old_dist_line_number
536: fstg.user_measure1, --invoice_distribution_id
537: fstg.user_measure2,
538: fstg.inv_line_pk
539: from fii_ap_inv_lines_fstg fstg
540: where fstg.collection_status = 'LOCAL READY';
541:
542: l_duration := sysdate - l_temp_date;
543: edw_log.put_line ('Process Time for Insert into TMP: '||edw_log.duration(l_duration));
605: l_duration := sysdate - l_temp_date;
606: edw_log.put_line ('Process Time for Insert into TMP w/ Discount: ' ||
607: edw_log.duration(l_duration));
608:
609: -- update fii_ap_inv_lines_fstg from fii_ap_tmp_line_pk
610:
611: l_temp_date := sysdate;
612:
613: FOR v_tmp IN c_tmp LOOP
614:
615: -- NOTE: discount_amt_g was populated with GLOBAL_CURRENCY_RATE previously
616:
617: UPDATE /*+ ORDERED USE_NL (FSTG) */
618: fii_ap_inv_lines_fstg fstg
619: SET discount_amt_t = v_tmp.amt_t,
620: discount_amt_b = v_tmp.amt_b,
621: discount_amt_g = ROUND(v_tmp.amt_b * discount_amt_g /l_mau)*l_mau
622: WHERE fstg.inv_line_pk = v_tmp.pk;
624:
625: END LOOP;
626:
627: -- set DISCOUNT_AMT_G = 0 for those no discount records
628: update FII_AP_INV_LINES_FSTG
629: set DISCOUNT_AMT_G = 0
630: where DISCOUNT_AMT_B = 0;
631:
632: l_duration := sysdate - l_temp_date;
655: BEGIN
656:
657: -- Bug 3716166. Added substrb to all the varchar2 columns.
658:
659: Insert Into FII_AP_INV_LINES_FSTG@EDW_APPS_TO_WH(
660: APPROVAL_STATUS,
661: ACCOUNTING_DATE,
662: ACCOUNTING_DATE_FK,
663: ACCRUAL_POSTED_FLAG,
919: substrb(VOUCHER_NUMBER,1,50),
920: DOC_SEQUENCE_VALUE,
921: TASK_ID, -- Addded for bug#2926033
922: RCV_TRANSACTION_ID -- Added for bug#3116554
923: from FII_AP_INV_LINES_FSTG
924: WHERE collection_status = 'LOCAL READY';
925: --ensures that only the records with collection status of local ready will be pushed to remote fstg
926:
927: RETURN(sql%rowcount);
1121: from xla_ae_headers xah,
1122: xla_transaction_entities xte,
1123: xla_distribution_links xdl,
1124: xla_ae_lines xal,
1125: fii_ap_inv_lines_fstg fstg,
1126: accounting_class ac
1127: where xte.entity_code='AP_INVOICES'
1128: and xah.entity_id=xte.entity_id
1129: and xah.ae_header_id=xal.ae_header_id
1143: -- user_measure2 will be populated with ledger_id in push_to_local procedure
1144: --user_measure1 will be populated with invoice_distribution_id in push_to_local
1145:
1146: FOR l_ccid IN ccid_cursor LOOP
1147: update fii_ap_inv_lines_fstg fstg
1148: set fstg.CCID = l_ccid.ccid
1149: where fstg.inv_line_pk=l_ccid.inv_line_pk;
1150: END LOOP;
1151:
1210: Decode(g_acct_or_inv_date,
1211: 1, ACCOUNTING_DATE,
1212: INV_DATE) CONVERSION_DATE,
1213: COLLECTION_STATUS
1214: From FII_AP_INV_LINES_FSTG
1215: where (COLLECTION_STATUS='RATE NOT AVAILABLE'
1216: OR COLLECTION_STATUS = 'INVALID CURRENCY')
1217: AND trunc(Decode(g_acct_or_inv_date,
1218: 1, ACCOUNTING_DATE,
1230: Decode(g_acct_or_inv_date,
1231: 1, ACCOUNTING_DATE,
1232: INV_DATE) CONVERSION_DATE,
1233: COLLECTION_STATUS
1234: From FII_AP_INV_LINES_FSTG
1235: where (COLLECTION_STATUS='RATE NOT AVAILABLE'
1236: OR COLLECTION_STATUS = 'INVALID CURRENCY')
1237: AND trunc(Decode(g_acct_or_inv_date,
1238: 1, ACCOUNTING_DATE,
1320: -- --------------------------------------------------------
1321: edw_log.put_line(' ');
1322: edw_log.put_line('Cleaning up unprocessed records left in local staging table');
1323: IF (NOT LOCAL_SAME_AS_REMOTE) THEN
1324: TRUNCATE_TABLE('FII_AP_INV_LINES_FSTG');
1325: ELSE
1326: DELETE_STG;
1327: END IF;
1328:
1495: edw_log.put_line(' ');
1496: edw_log.put_line('Cleaning local staging table');
1497:
1498: fii_util.start_timer;
1499: TRUNCATE_table('FII_AP_INV_LINES_FSTG');
1500: fii_util.stop_timer;
1501: fii_util.print_timer('Duration');
1502:
1503: ELSE