27:
28: -- Log file Generation
29: lv_log_file_name VARCHAR2(50) := 'ja_in_ap_aida_after_trg.log';
30: lv_utl_location VARCHAR2(512);
31: lv_myfilehandle UTL_FILE.FILE_TYPE;
32: lv_debug VARCHAR2(1) := 'N'; -- Harshita for Bug 5219176
33:
34: /* Variables related to CP */
35:
422: Select DECODE(SUBSTR (value,1,INSTR(value,',') -1),NULL,
423: Value,SUBSTR (value,1,INSTR(value,',') -1))
424: INTO lv_utl_location
425: from v$parameter
426: where name = 'utl_file_dir';
427:
428: lv_myfilehandle := UTL_FILE.FOPEN(lv_utl_location, lv_log_file_name ,'A');
429: UTL_FILE.PUT_LINE(lv_myfilehandle, '********* Start ja_in_ap_aida_after_trg('||TO_CHAR(SYSDATE,'DD/MM/RRRR HH24:MI:SS') ||') *********');
430:
424: INTO lv_utl_location
425: from v$parameter
426: where name = 'utl_file_dir';
427:
428: lv_myfilehandle := UTL_FILE.FOPEN(lv_utl_location, lv_log_file_name ,'A');
429: UTL_FILE.PUT_LINE(lv_myfilehandle, '********* Start ja_in_ap_aida_after_trg('||TO_CHAR(SYSDATE,'DD/MM/RRRR HH24:MI:SS') ||') *********');
430:
431: EXCEPTION
432: WHEN OTHERS THEN
425: from v$parameter
426: where name = 'utl_file_dir';
427:
428: lv_myfilehandle := UTL_FILE.FOPEN(lv_utl_location, lv_log_file_name ,'A');
429: UTL_FILE.PUT_LINE(lv_myfilehandle, '********* Start ja_in_ap_aida_after_trg('||TO_CHAR(SYSDATE,'DD/MM/RRRR HH24:MI:SS') ||') *********');
430:
431: EXCEPTION
432: WHEN OTHERS THEN
433: lv_debug := 'N';
434: END;
435: End if; /* lv_debug ='Y' */
436:
437: If lv_debug = 'Y' Then -- added, Harshita for Bug 5219176
438: UTL_FILE.PUT_LINE(lv_myfilehandle, ' inside update ');
439: UTL_FILE.PUT_LINE(lv_myfilehandle, ' line type lookup code '|| pr_new.line_type_lookup_code);
440: UTL_FILE.PUT_LINE(lv_myfilehandle, ' reversal flag '|| pr_new.reversal_flag);
441: UTL_FILE.PUT_LINE(lv_myfilehandle, ' old match status flag '|| pr_old.match_status_flag);
442: UTL_FILE.PUT_LINE(lv_myfilehandle, ' match status flag '|| pr_new.match_status_flag);
435: End if; /* lv_debug ='Y' */
436:
437: If lv_debug = 'Y' Then -- added, Harshita for Bug 5219176
438: UTL_FILE.PUT_LINE(lv_myfilehandle, ' inside update ');
439: UTL_FILE.PUT_LINE(lv_myfilehandle, ' line type lookup code '|| pr_new.line_type_lookup_code);
440: UTL_FILE.PUT_LINE(lv_myfilehandle, ' reversal flag '|| pr_new.reversal_flag);
441: UTL_FILE.PUT_LINE(lv_myfilehandle, ' old match status flag '|| pr_old.match_status_flag);
442: UTL_FILE.PUT_LINE(lv_myfilehandle, ' match status flag '|| pr_new.match_status_flag);
443: UTL_FILE.PUT_LINE(lv_myfilehandle, ' old price variance '|| pr_old.invoice_price_variance);
436:
437: If lv_debug = 'Y' Then -- added, Harshita for Bug 5219176
438: UTL_FILE.PUT_LINE(lv_myfilehandle, ' inside update ');
439: UTL_FILE.PUT_LINE(lv_myfilehandle, ' line type lookup code '|| pr_new.line_type_lookup_code);
440: UTL_FILE.PUT_LINE(lv_myfilehandle, ' reversal flag '|| pr_new.reversal_flag);
441: UTL_FILE.PUT_LINE(lv_myfilehandle, ' old match status flag '|| pr_old.match_status_flag);
442: UTL_FILE.PUT_LINE(lv_myfilehandle, ' match status flag '|| pr_new.match_status_flag);
443: UTL_FILE.PUT_LINE(lv_myfilehandle, ' old price variance '|| pr_old.invoice_price_variance);
444: UTL_FILE.PUT_LINE(lv_myfilehandle, ' new price variance '|| pr_new.invoice_price_variance);
437: If lv_debug = 'Y' Then -- added, Harshita for Bug 5219176
438: UTL_FILE.PUT_LINE(lv_myfilehandle, ' inside update ');
439: UTL_FILE.PUT_LINE(lv_myfilehandle, ' line type lookup code '|| pr_new.line_type_lookup_code);
440: UTL_FILE.PUT_LINE(lv_myfilehandle, ' reversal flag '|| pr_new.reversal_flag);
441: UTL_FILE.PUT_LINE(lv_myfilehandle, ' old match status flag '|| pr_old.match_status_flag);
442: UTL_FILE.PUT_LINE(lv_myfilehandle, ' match status flag '|| pr_new.match_status_flag);
443: UTL_FILE.PUT_LINE(lv_myfilehandle, ' old price variance '|| pr_old.invoice_price_variance);
444: UTL_FILE.PUT_LINE(lv_myfilehandle, ' new price variance '|| pr_new.invoice_price_variance);
445: UTL_FILE.PUT_LINE(lv_myfilehandle, ' old exc. vari '|| pr_old.exchange_rate_variance);
438: UTL_FILE.PUT_LINE(lv_myfilehandle, ' inside update ');
439: UTL_FILE.PUT_LINE(lv_myfilehandle, ' line type lookup code '|| pr_new.line_type_lookup_code);
440: UTL_FILE.PUT_LINE(lv_myfilehandle, ' reversal flag '|| pr_new.reversal_flag);
441: UTL_FILE.PUT_LINE(lv_myfilehandle, ' old match status flag '|| pr_old.match_status_flag);
442: UTL_FILE.PUT_LINE(lv_myfilehandle, ' match status flag '|| pr_new.match_status_flag);
443: UTL_FILE.PUT_LINE(lv_myfilehandle, ' old price variance '|| pr_old.invoice_price_variance);
444: UTL_FILE.PUT_LINE(lv_myfilehandle, ' new price variance '|| pr_new.invoice_price_variance);
445: UTL_FILE.PUT_LINE(lv_myfilehandle, ' old exc. vari '|| pr_old.exchange_rate_variance);
446: UTL_FILE.PUT_LINE(lv_myfilehandle, ' exc. vari '|| pr_new.exchange_rate_variance);
439: UTL_FILE.PUT_LINE(lv_myfilehandle, ' line type lookup code '|| pr_new.line_type_lookup_code);
440: UTL_FILE.PUT_LINE(lv_myfilehandle, ' reversal flag '|| pr_new.reversal_flag);
441: UTL_FILE.PUT_LINE(lv_myfilehandle, ' old match status flag '|| pr_old.match_status_flag);
442: UTL_FILE.PUT_LINE(lv_myfilehandle, ' match status flag '|| pr_new.match_status_flag);
443: UTL_FILE.PUT_LINE(lv_myfilehandle, ' old price variance '|| pr_old.invoice_price_variance);
444: UTL_FILE.PUT_LINE(lv_myfilehandle, ' new price variance '|| pr_new.invoice_price_variance);
445: UTL_FILE.PUT_LINE(lv_myfilehandle, ' old exc. vari '|| pr_old.exchange_rate_variance);
446: UTL_FILE.PUT_LINE(lv_myfilehandle, ' exc. vari '|| pr_new.exchange_rate_variance);
447: UTL_FILE.PUT_LINE(lv_myfilehandle, ' invoice id '|| pr_new.invoice_id);
440: UTL_FILE.PUT_LINE(lv_myfilehandle, ' reversal flag '|| pr_new.reversal_flag);
441: UTL_FILE.PUT_LINE(lv_myfilehandle, ' old match status flag '|| pr_old.match_status_flag);
442: UTL_FILE.PUT_LINE(lv_myfilehandle, ' match status flag '|| pr_new.match_status_flag);
443: UTL_FILE.PUT_LINE(lv_myfilehandle, ' old price variance '|| pr_old.invoice_price_variance);
444: UTL_FILE.PUT_LINE(lv_myfilehandle, ' new price variance '|| pr_new.invoice_price_variance);
445: UTL_FILE.PUT_LINE(lv_myfilehandle, ' old exc. vari '|| pr_old.exchange_rate_variance);
446: UTL_FILE.PUT_LINE(lv_myfilehandle, ' exc. vari '|| pr_new.exchange_rate_variance);
447: UTL_FILE.PUT_LINE(lv_myfilehandle, ' invoice id '|| pr_new.invoice_id);
448: UTL_FILE.PUT_LINE(lv_myfilehandle, ' invoice dist id '|| pr_new.invoice_distribution_id);
441: UTL_FILE.PUT_LINE(lv_myfilehandle, ' old match status flag '|| pr_old.match_status_flag);
442: UTL_FILE.PUT_LINE(lv_myfilehandle, ' match status flag '|| pr_new.match_status_flag);
443: UTL_FILE.PUT_LINE(lv_myfilehandle, ' old price variance '|| pr_old.invoice_price_variance);
444: UTL_FILE.PUT_LINE(lv_myfilehandle, ' new price variance '|| pr_new.invoice_price_variance);
445: UTL_FILE.PUT_LINE(lv_myfilehandle, ' old exc. vari '|| pr_old.exchange_rate_variance);
446: UTL_FILE.PUT_LINE(lv_myfilehandle, ' exc. vari '|| pr_new.exchange_rate_variance);
447: UTL_FILE.PUT_LINE(lv_myfilehandle, ' invoice id '|| pr_new.invoice_id);
448: UTL_FILE.PUT_LINE(lv_myfilehandle, ' invoice dist id '|| pr_new.invoice_distribution_id);
449: end if ;
442: UTL_FILE.PUT_LINE(lv_myfilehandle, ' match status flag '|| pr_new.match_status_flag);
443: UTL_FILE.PUT_LINE(lv_myfilehandle, ' old price variance '|| pr_old.invoice_price_variance);
444: UTL_FILE.PUT_LINE(lv_myfilehandle, ' new price variance '|| pr_new.invoice_price_variance);
445: UTL_FILE.PUT_LINE(lv_myfilehandle, ' old exc. vari '|| pr_old.exchange_rate_variance);
446: UTL_FILE.PUT_LINE(lv_myfilehandle, ' exc. vari '|| pr_new.exchange_rate_variance);
447: UTL_FILE.PUT_LINE(lv_myfilehandle, ' invoice id '|| pr_new.invoice_id);
448: UTL_FILE.PUT_LINE(lv_myfilehandle, ' invoice dist id '|| pr_new.invoice_distribution_id);
449: end if ;
450:
443: UTL_FILE.PUT_LINE(lv_myfilehandle, ' old price variance '|| pr_old.invoice_price_variance);
444: UTL_FILE.PUT_LINE(lv_myfilehandle, ' new price variance '|| pr_new.invoice_price_variance);
445: UTL_FILE.PUT_LINE(lv_myfilehandle, ' old exc. vari '|| pr_old.exchange_rate_variance);
446: UTL_FILE.PUT_LINE(lv_myfilehandle, ' exc. vari '|| pr_new.exchange_rate_variance);
447: UTL_FILE.PUT_LINE(lv_myfilehandle, ' invoice id '|| pr_new.invoice_id);
448: UTL_FILE.PUT_LINE(lv_myfilehandle, ' invoice dist id '|| pr_new.invoice_distribution_id);
449: end if ;
450:
451: If updating Then
444: UTL_FILE.PUT_LINE(lv_myfilehandle, ' new price variance '|| pr_new.invoice_price_variance);
445: UTL_FILE.PUT_LINE(lv_myfilehandle, ' old exc. vari '|| pr_old.exchange_rate_variance);
446: UTL_FILE.PUT_LINE(lv_myfilehandle, ' exc. vari '|| pr_new.exchange_rate_variance);
447: UTL_FILE.PUT_LINE(lv_myfilehandle, ' invoice id '|| pr_new.invoice_id);
448: UTL_FILE.PUT_LINE(lv_myfilehandle, ' invoice dist id '|| pr_new.invoice_distribution_id);
449: end if ;
450:
451: If updating Then
452:
459: ) Then
460:
461: If lv_debug = 'Y' Then -- added, Harshita for Bug 5219176
462:
463: UTL_FILE.PUT_LINE(lv_myfilehandle, ' inside all condition chec k ');
464:
465: UTL_FILE.PUT_LINE(lv_myfilehandle, ' inside match status flag ');
466:
467: End If ;
461: If lv_debug = 'Y' Then -- added, Harshita for Bug 5219176
462:
463: UTL_FILE.PUT_LINE(lv_myfilehandle, ' inside all condition chec k ');
464:
465: UTL_FILE.PUT_LINE(lv_myfilehandle, ' inside match status flag ');
466:
467: End If ;
468:
469: /* Check whether MISC (Tax lines) exists for this invoice
478: /* Proceed only when the variances are calculated and old variance
479: is not equal to the new variances */
480:
481: IF lv_debug = 'Y' THEN
482: UTL_FILE.PUT_LINE(lv_myfilehandle, ' exists flag ');
483: UTL_FILE.PUT_LINE(lv_myfilehandle,
484: 'invoice_id => '|| pr_new.invoice_id
485: || ', po_distribution_id => ' ||pr_new.po_distribution_id
486: || ', line_type_lookup_code => ' ||pr_new.line_type_lookup_code
479: is not equal to the new variances */
480:
481: IF lv_debug = 'Y' THEN
482: UTL_FILE.PUT_LINE(lv_myfilehandle, ' exists flag ');
483: UTL_FILE.PUT_LINE(lv_myfilehandle,
484: 'invoice_id => '|| pr_new.invoice_id
485: || ', po_distribution_id => ' ||pr_new.po_distribution_id
486: || ', line_type_lookup_code => ' ||pr_new.line_type_lookup_code
487: || ', amount => ' ||pr_new.amount
486: || ', line_type_lookup_code => ' ||pr_new.line_type_lookup_code
487: || ', amount => ' ||pr_new.amount
488: || ', Dist Line number => ' || pr_new.distribution_line_number
489: );
490: UTL_FILE.PUT_LINE(lv_myfilehandle,
491: ', amount => ' ||pr_new.amount
492: || ', base_amount => ' ||pr_new.base_amount
493: || ', Old Price Variance => ' || pr_old.invoice_price_variance
494: || ', New Price Variance => ' || pr_new.invoice_price_variance
520: pr_new.Exchange_rate_variance,
521: pr_new.rate_var_code_combination_id
522: );
523: IF lv_debug = 'Y' THEN
524: UTL_FILE.fclose(lv_myfilehandle);
525: END IF;
526:
527: End if; /* lv_exists ='Y' */
528:
863: --Add by Wenqiong for POT, reg bug#12397015 on 26-Apr-2011, end
864: End if; /* updating */
865:
866: IF lv_debug = 'Y' THEN
867: UTL_FILE.fclose(lv_myfilehandle);
868: END IF;
869:
870: /* Added an exception block by Ramananda for bug#4570303 */
871: EXCEPTION
870: /* Added an exception block by Ramananda for bug#4570303 */
871: EXCEPTION
872: WHEN OTHERS THEN
873: IF lv_debug ='Y' Then
874: UTL_FILE.PUT_LINE(lv_myfilehandle, 'Error in trigger , errm -> '||SQLERRM);
875: UTL_FILE.fclose(lv_myfilehandle);
876: End if;
877: RAISE;
878: END ARUID_T1 ;
871: EXCEPTION
872: WHEN OTHERS THEN
873: IF lv_debug ='Y' Then
874: UTL_FILE.PUT_LINE(lv_myfilehandle, 'Error in trigger , errm -> '||SQLERRM);
875: UTL_FILE.fclose(lv_myfilehandle);
876: End if;
877: RAISE;
878: END ARUID_T1 ;
879: /*