31: TmpRetnLineFmt pa_retn_billing_pkg.TabRetnBillingInvFmt;
32:
33: BEGIN
34: IF g1_debug_mode = 'Y' THEN
35: pa_retention_util.write_log('Entering pa_retn_billing_pkg.Get_Retn_Billing_Inv_Format');
36: END IF;
37:
38: OPEN cur_inv_group_columns;
39: LOOP
54: TmpRetnLineFmt(Cnt).end_position := InvGroupColumnsRec.end_position;
55: TmpRetnLineFmt(Cnt).right_justify_flag := InvGroupColumnsRec.right_justify_flag;
56:
57: IF g1_debug_mode = 'Y' THEN
58: pa_retention_util.write_log('Get_Retn_Billing_Inv_Format: ' || 'Format Column : ' || InvGroupColumnsRec.column_code);
59: END IF;
60:
61: END LOOP;
62:
62:
63: CLOSE cur_inv_group_columns;
64:
65: IF g1_debug_mode = 'Y' THEN
66: pa_retention_util.write_log('Leaving pa_retn_billing_pkg.Get_Retn_Billing_Inv_Format');
67: END IF;
68:
69: RETURN TmpRetnLineFmt;
70: EXCEPTION
81: ExistsFlag VARCHAR2(1) := 'N';
82:
83: BEGIN
84: IF g1_debug_mode = 'Y' THEN
85: pa_retention_util.write_log('Enterting pa_retn_billing_pkg.CheckInvoiceExists');
86: END IF;
87:
88: BEGIN
89: SELECT 'Y'
103: RAISE;
104:
105: END;
106: IF g1_debug_mode = 'Y' THEN
107: pa_retention_util.write_log('CheckInvoiceExists : ' || ExistsFlag);
108: pa_retention_util.write_log('Leaving pa_retn_billing_pkg.CheckInvoiceExists');
109: END IF;
110:
111: RETURN(ExistsFlag);
104:
105: END;
106: IF g1_debug_mode = 'Y' THEN
107: pa_retention_util.write_log('CheckInvoiceExists : ' || ExistsFlag);
108: pa_retention_util.write_log('Leaving pa_retn_billing_pkg.CheckInvoiceExists');
109: END IF;
110:
111: RETURN(ExistsFlag);
112:
184: /* Shared services changes: local variable to store org ID from org context */
185: l_org_id NUMBER;
186: BEGIN
187: IF g1_debug_mode = 'Y' THEN
188: pa_retention_util.write_log('Entering pa_retn_billing_pkg.Build_Retn_Invoice_Header');
189: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'AgreementId : ' || p_agreement_id);
190: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'Project Id : ' || p_project_id);
191: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'Customer Id : ' || p_customer_id);
192: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'Request Id : ' || p_request_id);
185: l_org_id NUMBER;
186: BEGIN
187: IF g1_debug_mode = 'Y' THEN
188: pa_retention_util.write_log('Entering pa_retn_billing_pkg.Build_Retn_Invoice_Header');
189: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'AgreementId : ' || p_agreement_id);
190: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'Project Id : ' || p_project_id);
191: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'Customer Id : ' || p_customer_id);
192: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'Request Id : ' || p_request_id);
193: END IF;
186: BEGIN
187: IF g1_debug_mode = 'Y' THEN
188: pa_retention_util.write_log('Entering pa_retn_billing_pkg.Build_Retn_Invoice_Header');
189: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'AgreementId : ' || p_agreement_id);
190: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'Project Id : ' || p_project_id);
191: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'Customer Id : ' || p_customer_id);
192: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'Request Id : ' || p_request_id);
193: END IF;
194:
187: IF g1_debug_mode = 'Y' THEN
188: pa_retention_util.write_log('Entering pa_retn_billing_pkg.Build_Retn_Invoice_Header');
189: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'AgreementId : ' || p_agreement_id);
190: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'Project Id : ' || p_project_id);
191: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'Customer Id : ' || p_customer_id);
192: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'Request Id : ' || p_request_id);
193: END IF;
194:
195: /* TCA changes
188: pa_retention_util.write_log('Entering pa_retn_billing_pkg.Build_Retn_Invoice_Header');
189: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'AgreementId : ' || p_agreement_id);
190: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'Project Id : ' || p_project_id);
191: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'Customer Id : ' || p_customer_id);
192: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'Request Id : ' || p_request_id);
193: END IF;
194:
195: /* TCA changes
196: select DISTINCT
427: TmpInvoiceSetId := pa_billing.Globvars.InvoiceSetId;
428: END IF;
429:
430: IF g1_debug_mode = 'Y' THEN
431: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'TmpInvoiceSetId : ' || TmpInvoiceSetId);
432: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'Credit Hold : ' || TmpCreditHold);
433: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'TmpPaymentSetId : ' || TmpPaymentSetId);
434: END IF;
435:
428: END IF;
429:
430: IF g1_debug_mode = 'Y' THEN
431: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'TmpInvoiceSetId : ' || TmpInvoiceSetId);
432: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'Credit Hold : ' || TmpCreditHold);
433: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'TmpPaymentSetId : ' || TmpPaymentSetId);
434: END IF;
435:
436:
429:
430: IF g1_debug_mode = 'Y' THEN
431: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'TmpInvoiceSetId : ' || TmpInvoiceSetId);
432: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'Credit Hold : ' || TmpCreditHold);
433: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'TmpPaymentSetId : ' || TmpPaymentSetId);
434: END IF;
435:
436:
437: -- Get the new draft invoice num
442: FROM pa_draft_invoices_all p
443: WHERE p.project_id = p_project_id;
444:
445: IF g1_debug_mode = 'Y' THEN
446: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'New Invoice Num : ' || TmpInvoiceNum);
447: END IF;
448:
449: --- Get the set of books id
450: SELECT imp.set_of_books_id
451: INTO TmpSetOfBooks
452: FROM pa_implementations imp;
453:
454: IF g1_debug_mode = 'Y' THEN
455: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'TmpSetOfBooks : ' || TmpSetOfBooks);
456: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'Call PA_OUTPUT_TAX.GET_DEFAULT_TAX_INFO');
457: END IF;
458:
459: --- Call Tax Information
452: FROM pa_implementations imp;
453:
454: IF g1_debug_mode = 'Y' THEN
455: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'TmpSetOfBooks : ' || TmpSetOfBooks);
456: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'Call PA_OUTPUT_TAX.GET_DEFAULT_TAX_INFO');
457: END IF;
458:
459: --- Call Tax Information
460:
485: X_Output_tax_exempt_number :=Tmp_Output_tax_exempt_number;
486: X_Output_exempt_reason_code :=Tmp_Output_exempt_reason_code;
487:
488: IF g1_debug_mode = 'Y' THEN
489: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'Tax Information: ');
490: -- pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'X_Output_vat_tax_id : ' || X_Output_vat_tax_id);
491: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'X_Output_tax_code : ' || X_Output_tax_code);
492: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'X_Output_tax_exempt_flag : ' || X_Output_tax_exempt_flag);
493: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'X_Output_tax_exempt_number : ' || X_Output_tax_exempt_number);
486: X_Output_exempt_reason_code :=Tmp_Output_exempt_reason_code;
487:
488: IF g1_debug_mode = 'Y' THEN
489: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'Tax Information: ');
490: -- pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'X_Output_vat_tax_id : ' || X_Output_vat_tax_id);
491: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'X_Output_tax_code : ' || X_Output_tax_code);
492: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'X_Output_tax_exempt_flag : ' || X_Output_tax_exempt_flag);
493: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'X_Output_tax_exempt_number : ' || X_Output_tax_exempt_number);
494: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'X_Output_exempt_reason_code : ' || X_Output_exempt_reason_code);
487:
488: IF g1_debug_mode = 'Y' THEN
489: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'Tax Information: ');
490: -- pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'X_Output_vat_tax_id : ' || X_Output_vat_tax_id);
491: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'X_Output_tax_code : ' || X_Output_tax_code);
492: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'X_Output_tax_exempt_flag : ' || X_Output_tax_exempt_flag);
493: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'X_Output_tax_exempt_number : ' || X_Output_tax_exempt_number);
494: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'X_Output_exempt_reason_code : ' || X_Output_exempt_reason_code);
495: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'Invoice Currency : ' || TmpInvCurrency );
488: IF g1_debug_mode = 'Y' THEN
489: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'Tax Information: ');
490: -- pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'X_Output_vat_tax_id : ' || X_Output_vat_tax_id);
491: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'X_Output_tax_code : ' || X_Output_tax_code);
492: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'X_Output_tax_exempt_flag : ' || X_Output_tax_exempt_flag);
493: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'X_Output_tax_exempt_number : ' || X_Output_tax_exempt_number);
494: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'X_Output_exempt_reason_code : ' || X_Output_exempt_reason_code);
495: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'Invoice Currency : ' || TmpInvCurrency );
496: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'Insert into Invoice Header ');
489: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'Tax Information: ');
490: -- pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'X_Output_vat_tax_id : ' || X_Output_vat_tax_id);
491: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'X_Output_tax_code : ' || X_Output_tax_code);
492: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'X_Output_tax_exempt_flag : ' || X_Output_tax_exempt_flag);
493: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'X_Output_tax_exempt_number : ' || X_Output_tax_exempt_number);
494: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'X_Output_exempt_reason_code : ' || X_Output_exempt_reason_code);
495: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'Invoice Currency : ' || TmpInvCurrency );
496: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'Insert into Invoice Header ');
497: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'Invoice Currency : ' || TmpInvCurrency );
490: -- pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'X_Output_vat_tax_id : ' || X_Output_vat_tax_id);
491: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'X_Output_tax_code : ' || X_Output_tax_code);
492: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'X_Output_tax_exempt_flag : ' || X_Output_tax_exempt_flag);
493: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'X_Output_tax_exempt_number : ' || X_Output_tax_exempt_number);
494: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'X_Output_exempt_reason_code : ' || X_Output_exempt_reason_code);
495: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'Invoice Currency : ' || TmpInvCurrency );
496: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'Insert into Invoice Header ');
497: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'Invoice Currency : ' || TmpInvCurrency );
498: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'Bill By Bill Trans Currency : ' || TmpInvByBTC);
491: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'X_Output_tax_code : ' || X_Output_tax_code);
492: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'X_Output_tax_exempt_flag : ' || X_Output_tax_exempt_flag);
493: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'X_Output_tax_exempt_number : ' || X_Output_tax_exempt_number);
494: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'X_Output_exempt_reason_code : ' || X_Output_exempt_reason_code);
495: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'Invoice Currency : ' || TmpInvCurrency );
496: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'Insert into Invoice Header ');
497: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'Invoice Currency : ' || TmpInvCurrency );
498: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'Bill By Bill Trans Currency : ' || TmpInvByBTC);
499: END IF;
492: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'X_Output_tax_exempt_flag : ' || X_Output_tax_exempt_flag);
493: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'X_Output_tax_exempt_number : ' || X_Output_tax_exempt_number);
494: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'X_Output_exempt_reason_code : ' || X_Output_exempt_reason_code);
495: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'Invoice Currency : ' || TmpInvCurrency );
496: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'Insert into Invoice Header ');
497: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'Invoice Currency : ' || TmpInvCurrency );
498: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'Bill By Bill Trans Currency : ' || TmpInvByBTC);
499: END IF;
500: IF TmpInvByBTC='Y' THEN
493: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'X_Output_tax_exempt_number : ' || X_Output_tax_exempt_number);
494: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'X_Output_exempt_reason_code : ' || X_Output_exempt_reason_code);
495: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'Invoice Currency : ' || TmpInvCurrency );
496: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'Insert into Invoice Header ');
497: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'Invoice Currency : ' || TmpInvCurrency );
498: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'Bill By Bill Trans Currency : ' || TmpInvByBTC);
499: END IF;
500: IF TmpInvByBTC='Y' THEN
501: TmpInvCurrency := TmpInvProcCurrency;
494: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'X_Output_exempt_reason_code : ' || X_Output_exempt_reason_code);
495: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'Invoice Currency : ' || TmpInvCurrency );
496: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'Insert into Invoice Header ');
497: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'Invoice Currency : ' || TmpInvCurrency );
498: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'Bill By Bill Trans Currency : ' || TmpInvByBTC);
499: END IF;
500: IF TmpInvByBTC='Y' THEN
501: TmpInvCurrency := TmpInvProcCurrency;
502: IF g1_debug_mode = 'Y' THEN
499: END IF;
500: IF TmpInvByBTC='Y' THEN
501: TmpInvCurrency := TmpInvProcCurrency;
502: IF g1_debug_mode = 'Y' THEN
503: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'Assing IPC to Invoice Currency : ' || TmpInvCurrency);
504: END IF;
505: END IF;
506: IF g1_debug_mode = 'Y' THEN
507: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'Invoice Currency : ' || TmpInvCurrency);
503: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'Assing IPC to Invoice Currency : ' || TmpInvCurrency);
504: END IF;
505: END IF;
506: IF g1_debug_mode = 'Y' THEN
507: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'Invoice Currency : ' || TmpInvCurrency);
508: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'Bill Thru Date : ' || pa_billing.GetBillThruDate);
509: END IF;
510:
511: IF TmpCreditHold ='Y' OR NVL(TmpRetnBillInvFmtID,0) = 0 THEN
504: END IF;
505: END IF;
506: IF g1_debug_mode = 'Y' THEN
507: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'Invoice Currency : ' || TmpInvCurrency);
508: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'Bill Thru Date : ' || pa_billing.GetBillThruDate);
509: END IF;
510:
511: IF TmpCreditHold ='Y' OR NVL(TmpRetnBillInvFmtID,0) = 0 THEN
512:
524:
525: END IF;
526:
527: IF g1_debug_mode = 'Y' THEN
528: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'Warning : ' || TmpWarningCode);
529: END IF;
530:
531: SELECT lk.meaning
532: INTO TmpWarningMsg
534: WHERE lk.lookup_code = TmpWarningCode
535: AND lk.lookup_type = 'INVOICE DISTRIBUTION WARNING';
536:
537: IF g1_debug_mode = 'Y' THEN
538: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'Warning Code : ' || TmpWarningCode);
539: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'Warning Mesg : ' || TmpWarningMsg);
540: END IF;
541: END IF;
542:
535: AND lk.lookup_type = 'INVOICE DISTRIBUTION WARNING';
536:
537: IF g1_debug_mode = 'Y' THEN
538: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'Warning Code : ' || TmpWarningCode);
539: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'Warning Mesg : ' || TmpWarningMsg);
540: END IF;
541: END IF;
542:
543: /* Shared services changes: get org id from org context, and
612:
613: IF TmpCreditHold ='Y' OR NVL(TmpRetnBillInvFmtID,0) = 0 THEN
614:
615: IF g1_debug_mode = 'Y' THEN
616: pa_retention_util.write_log('Build_Retn_Invoice_Header: ' || 'Insert Warning ');
617: END IF;
618:
619:
620: INSERT INTO PA_DISTRIBUTION_WARNINGS (
654:
655: END IF;
656:
657: IF g1_debug_mode = 'Y' THEN
658: pa_retention_util.write_log('Leaving Build_Retn_Invoice_Header ');
659: END IF;
660:
661:
662:
671: /*End of change for bug no 2760630 */
672: WHEN OTHERS THEN
673: pa_retn_billing_pkg.G_ERROR_CODE :='E';
674: IF g1_debug_mode = 'Y' THEN
675: pa_retention_util.write_log('pa_retn_billing_pkg.Build_Retn_Invoice_Header' || ' Oracle Error : ' || sqlerrm);
676: END IF;
677: RAISE;
678:
679: END Build_Retn_Invoice_Header;
708: EXCEPTION
709: WHEN OTHERS THEN
710: pa_retn_billing_pkg.G_ERROR_CODE :='E';
711: IF g1_debug_mode = 'Y' THEN
712: pa_retention_util.write_log('pa_retn_billing_pkg.Update_ProjFunc_Attributes' || ' Oracle Error : ' || sqlerrm);
713: END IF;
714:
715: END Update_ProjFunc_Attributes;
716:
770:
771: BEGIN
772:
773: IF g1_debug_mode = 'Y' THEN
774: pa_retention_util.write_log('Entering Create_Retn_Invoice_Lines ');
775: pa_retention_util.write_log('Create_Retn_Invoice_Lines: ' || 'Project Id : ' || p_project_id);
776: pa_retention_util.write_log('Create_Retn_Invoice_Lines: ' || 'Task Id : ' || p_task_id);
777: END IF;
778:
771: BEGIN
772:
773: IF g1_debug_mode = 'Y' THEN
774: pa_retention_util.write_log('Entering Create_Retn_Invoice_Lines ');
775: pa_retention_util.write_log('Create_Retn_Invoice_Lines: ' || 'Project Id : ' || p_project_id);
776: pa_retention_util.write_log('Create_Retn_Invoice_Lines: ' || 'Task Id : ' || p_task_id);
777: END IF;
778:
779: -- Get task name
772:
773: IF g1_debug_mode = 'Y' THEN
774: pa_retention_util.write_log('Entering Create_Retn_Invoice_Lines ');
775: pa_retention_util.write_log('Create_Retn_Invoice_Lines: ' || 'Project Id : ' || p_project_id);
776: pa_retention_util.write_log('Create_Retn_Invoice_Lines: ' || 'Task Id : ' || p_task_id);
777: END IF;
778:
779: -- Get task name
780: IF g1_debug_mode = 'Y' THEN
777: END IF;
778:
779: -- Get task name
780: IF g1_debug_mode = 'Y' THEN
781: pa_retention_util.write_log('Create_Retn_Invoice_Lines: ' || 'Get task name');
782: END IF;
783:
784: BEGIN
785:
803: l_task_name := NULL;
804:
805: END;
806: IF g1_debug_mode = 'Y' THEN
807: pa_retention_util.write_log('Create_Retn_Invoice_Lines: ' || 'Task Name : ' || l_task_name);
808: END IF;
809: -- Find out any lines are existing or not
810: IF g1_debug_mode = 'Y' THEN
811: pa_retention_util.write_log('Create_Retn_Invoice_Lines: ' || 'CAll pa_retention_pkg.Get_Invoice_Max_Line');
807: pa_retention_util.write_log('Create_Retn_Invoice_Lines: ' || 'Task Name : ' || l_task_name);
808: END IF;
809: -- Find out any lines are existing or not
810: IF g1_debug_mode = 'Y' THEN
811: pa_retention_util.write_log('Create_Retn_Invoice_Lines: ' || 'CAll pa_retention_pkg.Get_Invoice_Max_Line');
812: END IF;
813:
814: LastLineNum := pa_retention_pkg.Get_Invoice_Max_Line(p_project_id=>p_project_id,
815: p_draft_Invoice_num=>p_draft_invoice_num);
814: LastLineNum := pa_retention_pkg.Get_Invoice_Max_Line(p_project_id=>p_project_id,
815: p_draft_Invoice_num=>p_draft_invoice_num);
816:
817: IF g1_debug_mode = 'Y' THEN
818: pa_retention_util.write_log('Create_Retn_Invoice_Lines: ' || 'CAll Get_Retn_Billing_Inv_Format');
819: END IF;
820:
821: l_RetnInvLineFmt := Get_Retn_Billing_Inv_Format(p_project_id=>p_project_id);
822:
844:
845: END IF;
846:
847: IF g1_debug_mode = 'Y' THEN
848: pa_retention_util.write_log('Create_Retn_Invoice_Lines: ' || i || ': Fmt Text : ' || RetnLineText);
849: END IF;
850:
851: IF l_RetnInvLineFmt(i).column_code = 'RETENTION BILLING PERCENTAGE' THEN
852:
872: l_RetnInvLineFmt(i).start_position,' ');
873: END IF;
874:
875: IF g1_debug_mode = 'Y' THEN
876: pa_retention_util.write_log('% Text : ' || NVL(p_billing_percentage,p_billing_amount));
877: pa_retention_util.write_log('Create_Retn_Invoice_Lines: ' || 'After % Text : ' || RetnLineText);
878: END IF;
879:
880: ELSIF l_RetnInvLineFmt(i).column_code = 'TEXT' THEN
873: END IF;
874:
875: IF g1_debug_mode = 'Y' THEN
876: pa_retention_util.write_log('% Text : ' || NVL(p_billing_percentage,p_billing_amount));
877: pa_retention_util.write_log('Create_Retn_Invoice_Lines: ' || 'After % Text : ' || RetnLineText);
878: END IF;
879:
880: ELSIF l_RetnInvLineFmt(i).column_code = 'TEXT' THEN
881:
891: l_RetnInvLineFmt(i).start_position,' ');
892: END IF;
893:
894: IF g1_debug_mode = 'Y' THEN
895: pa_retention_util.write_log('Create_Retn_Invoice_Lines: ' || 'User Text : ' || l_RetnInvLineFmt(i).UserText);
896: pa_retention_util.write_log('Create_Retn_Invoice_Lines: ' || 'User Text : ' || RetnLineText);
897: END IF;
898:
899: ELSIF l_RetnInvLineFmt(i).column_code = 'INVPROC CURRENCY CODE' THEN
892: END IF;
893:
894: IF g1_debug_mode = 'Y' THEN
895: pa_retention_util.write_log('Create_Retn_Invoice_Lines: ' || 'User Text : ' || l_RetnInvLineFmt(i).UserText);
896: pa_retention_util.write_log('Create_Retn_Invoice_Lines: ' || 'User Text : ' || RetnLineText);
897: END IF;
898:
899: ELSIF l_RetnInvLineFmt(i).column_code = 'INVPROC CURRENCY CODE' THEN
900:
909: l_RetnInvLineFmt(i).end_position-
910: l_RetnInvLineFmt(i).start_position,' ');
911: END IF;
912: IF g1_debug_mode = 'Y' THEN
913: pa_retention_util.write_log('Create_Retn_Invoice_Lines: ' || 'IPC : ' || p_invproc_currency);
914: pa_retention_util.write_log('Create_Retn_Invoice_Lines: ' || 'IPC Text : ' || RetnLineText);
915: END IF;
916:
917: ELSIF l_RetnInvLineFmt(i).column_code = 'BILLING METHOD' THEN
910: l_RetnInvLineFmt(i).start_position,' ');
911: END IF;
912: IF g1_debug_mode = 'Y' THEN
913: pa_retention_util.write_log('Create_Retn_Invoice_Lines: ' || 'IPC : ' || p_invproc_currency);
914: pa_retention_util.write_log('Create_Retn_Invoice_Lines: ' || 'IPC Text : ' || RetnLineText);
915: END IF;
916:
917: ELSIF l_RetnInvLineFmt(i).column_code = 'BILLING METHOD' THEN
918:
927: l_RetnInvLineFmt(i).end_position-
928: l_RetnInvLineFmt(i).start_position,' ');
929: END IF;
930: IF g1_debug_mode = 'Y' THEN
931: pa_retention_util.write_log('Create_Retn_Invoice_Lines: ' || 'Billing Method : ' || p_billing_method);
932: pa_retention_util.write_log('Create_Retn_Invoice_Lines: ' || 'After BM Text : ' || RetnLineText);
933: END IF;
934:
935: ELSIF l_RetnInvLineFmt(i).column_code = 'METHOD VALUE' THEN
928: l_RetnInvLineFmt(i).start_position,' ');
929: END IF;
930: IF g1_debug_mode = 'Y' THEN
931: pa_retention_util.write_log('Create_Retn_Invoice_Lines: ' || 'Billing Method : ' || p_billing_method);
932: pa_retention_util.write_log('Create_Retn_Invoice_Lines: ' || 'After BM Text : ' || RetnLineText);
933: END IF;
934:
935: ELSIF l_RetnInvLineFmt(i).column_code = 'METHOD VALUE' THEN
936:
945: l_RetnInvLineFmt(i).end_position-
946: l_RetnInvLineFmt(i).start_position,' ');
947: END IF;
948: IF g1_debug_mode = 'Y' THEN
949: pa_retention_util.write_log('Create_Retn_Invoice_Lines: ' || 'Method Value : ' || p_method_value);
950: pa_retention_util.write_log('Create_Retn_Invoice_Lines: ' || 'After MV Text : ' || RetnLineText);
951: END IF;
952:
953:
946: l_RetnInvLineFmt(i).start_position,' ');
947: END IF;
948: IF g1_debug_mode = 'Y' THEN
949: pa_retention_util.write_log('Create_Retn_Invoice_Lines: ' || 'Method Value : ' || p_method_value);
950: pa_retention_util.write_log('Create_Retn_Invoice_Lines: ' || 'After MV Text : ' || RetnLineText);
951: END IF;
952:
953:
954: ELSIF l_RetnInvLineFmt(i).column_code = 'TOTAL RETAINED AMOUNT' THEN
964: l_RetnInvLineFmt(i).end_position-
965: l_RetnInvLineFmt(i).start_position,' ');
966: END IF;
967: IF g1_debug_mode = 'Y' THEN
968: pa_retention_util.write_log('Create_Retn_Invoice_Lines: ' || 'Total Retained : ' || p_total_retained);
969: pa_retention_util.write_log('Create_Retn_Invoice_Lines: ' || 'After TR Text : ' || RetnLineText);
970: END IF;
971:
972:
965: l_RetnInvLineFmt(i).start_position,' ');
966: END IF;
967: IF g1_debug_mode = 'Y' THEN
968: pa_retention_util.write_log('Create_Retn_Invoice_Lines: ' || 'Total Retained : ' || p_total_retained);
969: pa_retention_util.write_log('Create_Retn_Invoice_Lines: ' || 'After TR Text : ' || RetnLineText);
970: END IF;
971:
972:
973: END IF;
976:
977: END IF;
978:
979: IF g1_debug_mode = 'Y' THEN
980: pa_retention_util.write_log('Create_Retn_Invoice_Lines: ' || 'RetnLineText : ' || RetnLineText);
981: pa_retention_util.write_log('Create_Retn_Invoice_Lines: ' || 'Insert DII');
982: END IF;
983:
984: INSERT INTO pa_draft_invoice_items
977: END IF;
978:
979: IF g1_debug_mode = 'Y' THEN
980: pa_retention_util.write_log('Create_Retn_Invoice_Lines: ' || 'RetnLineText : ' || RetnLineText);
981: pa_retention_util.write_log('Create_Retn_Invoice_Lines: ' || 'Insert DII');
982: END IF;
983:
984: INSERT INTO pa_draft_invoice_items
985: ( PROJECT_ID,
1065: p_task_id);
1066:
1067: --- Create the retention invoice details
1068: IF g1_debug_mode = 'Y' THEN
1069: pa_retention_util.write_log('Create_Retn_Invoice_Lines: ' || 'Call Create_Retn_Invoice_Details');
1070: END IF;
1071:
1072: Create_Retn_Invoice_Details ( p_project_id=>p_project_id,
1073: p_draft_invoice_num=>p_draft_invoice_num,
1078:
1079: -- Update the balances
1080:
1081: IF g1_debug_mode = 'Y' THEN
1082: pa_retention_util.write_log('Create_Retn_Invoice_Lines: ' || 'Call pa_retention_pkg.Update_Retention_Balances');
1083: END IF;
1084:
1085: pa_retention_pkg.Update_Retention_Balances(
1086: p_project_id=>p_project_id,
1098: p_funding_currency =>p_funding_currency,
1099: p_funding_amount =>p_funding_amount);
1100:
1101: IF g1_debug_mode = 'Y' THEN
1102: pa_retention_util.write_log('Leaving pa_retn_billing_pkg.Create_Retn_Invoice_Lines');
1103: END IF;
1104: EXCEPTION
1105: WHEN OTHERS THEN
1106: pa_retn_billing_pkg.G_ERROR_CODE :='E';
1104: EXCEPTION
1105: WHEN OTHERS THEN
1106: pa_retn_billing_pkg.G_ERROR_CODE :='E';
1107: IF g1_debug_mode = 'Y' THEN
1108: pa_retention_util.write_log('pa_retn_billing_pkg.Create_Retn_Invoice_Lines : Oracle Error : ' || sqlerrm);
1109: END IF;
1110:
1111: END Create_Retn_Invoice_Lines;
1112:
1156:
1157:
1158: BEGIN
1159: IF g1_debug_mode = 'Y' THEN
1160: pa_retention_util.write_log('Entering pa_retn_billing_pkg.Create_Retn_Invoice_Details');
1161: pa_retention_util.write_log('Create_Retn_Invoice_Details: ' || 'Project Id : ' || p_project_id);
1162: pa_retention_util.write_log('Create_Retn_Invoice_Details: ' || 'Task Id : ' || p_task_id);
1163: pa_retention_util.write_log('Create_Retn_Invoice_Details: ' || 'Agreement Id : ' || p_agreement_id);
1164: END IF;
1157:
1158: BEGIN
1159: IF g1_debug_mode = 'Y' THEN
1160: pa_retention_util.write_log('Entering pa_retn_billing_pkg.Create_Retn_Invoice_Details');
1161: pa_retention_util.write_log('Create_Retn_Invoice_Details: ' || 'Project Id : ' || p_project_id);
1162: pa_retention_util.write_log('Create_Retn_Invoice_Details: ' || 'Task Id : ' || p_task_id);
1163: pa_retention_util.write_log('Create_Retn_Invoice_Details: ' || 'Agreement Id : ' || p_agreement_id);
1164: END IF;
1165:
1158: BEGIN
1159: IF g1_debug_mode = 'Y' THEN
1160: pa_retention_util.write_log('Entering pa_retn_billing_pkg.Create_Retn_Invoice_Details');
1161: pa_retention_util.write_log('Create_Retn_Invoice_Details: ' || 'Project Id : ' || p_project_id);
1162: pa_retention_util.write_log('Create_Retn_Invoice_Details: ' || 'Task Id : ' || p_task_id);
1163: pa_retention_util.write_log('Create_Retn_Invoice_Details: ' || 'Agreement Id : ' || p_agreement_id);
1164: END IF;
1165:
1166: OPEN cur_proj_retn;
1159: IF g1_debug_mode = 'Y' THEN
1160: pa_retention_util.write_log('Entering pa_retn_billing_pkg.Create_Retn_Invoice_Details');
1161: pa_retention_util.write_log('Create_Retn_Invoice_Details: ' || 'Project Id : ' || p_project_id);
1162: pa_retention_util.write_log('Create_Retn_Invoice_Details: ' || 'Task Id : ' || p_task_id);
1163: pa_retention_util.write_log('Create_Retn_Invoice_Details: ' || 'Agreement Id : ' || p_agreement_id);
1164: END IF;
1165:
1166: OPEN cur_proj_retn;
1167:
1178: INTO l_detail_id
1179: FROM DUAL;
1180:
1181: IF g1_debug_mode = 'Y' THEN
1182: pa_retention_util.write_log('Create_Retn_Invoice_Details: ' || 'Insert pa_retn_invoice_details');
1183: END IF;
1184:
1185: -- Insert into the Retention Invoice Detail table
1186: INSERT INTO pa_retn_invoice_details
1235:
1236: CLOSE cur_proj_retn;
1237:
1238: IF g1_debug_mode = 'Y' THEN
1239: pa_retention_util.write_log('Leaving pa_retn_billing_pkg.Create_Retn_Invoice_Details');
1240: END IF;
1241: EXCEPTION
1242: WHEN OTHERS THEN
1243: pa_retn_billing_pkg.G_ERROR_CODE :='E';
1241: EXCEPTION
1242: WHEN OTHERS THEN
1243: pa_retn_billing_pkg.G_ERROR_CODE :='E';
1244: IF g1_debug_mode = 'Y' THEN
1245: pa_retention_util.write_log('pa_retn_billing_pkg.Create_Retn_Invoice_Details
1246: : Oracle Error : ' || sqlerrm);
1247: END IF;
1248:
1249: END Create_Retn_Invoice_Details;
1439: TmpRetnBillInvFmt Number:=0;
1440:
1441: BEGIN
1442: IF g1_debug_mode = 'Y' THEN
1443: pa_retention_util.write_log('Entering pa_retn_billing_pkg.Retention_Billing_Processing');
1444: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'From Project Number ' || p_start_proj_number );
1445: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'End Project Number ' || p_end_proj_number);
1446: END IF;
1447:
1440:
1441: BEGIN
1442: IF g1_debug_mode = 'Y' THEN
1443: pa_retention_util.write_log('Entering pa_retn_billing_pkg.Retention_Billing_Processing');
1444: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'From Project Number ' || p_start_proj_number );
1445: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'End Project Number ' || p_end_proj_number);
1446: END IF;
1447:
1448:
1441: BEGIN
1442: IF g1_debug_mode = 'Y' THEN
1443: pa_retention_util.write_log('Entering pa_retn_billing_pkg.Retention_Billing_Processing');
1444: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'From Project Number ' || p_start_proj_number );
1445: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'End Project Number ' || p_end_proj_number);
1446: END IF;
1447:
1448:
1449:
1460: TmpCustomerId := ProjCustRec.Customer_id;
1461: TmpProjectId := ProjCustRec.project_id;
1462: TmpRetnBillInvFmt := ProjCustRec.RETN_BILLING_INV_FORMAT_ID;
1463: IF g1_debug_mode = 'Y' THEN
1464: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'TmpCustomerId : ' || TmpCustomerId);
1465: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'TmpProjectId : ' || TmpProjectId);
1466: END IF;
1467: TmpTaskId := 0;
1468: OldTask := 0;
1461: TmpProjectId := ProjCustRec.project_id;
1462: TmpRetnBillInvFmt := ProjCustRec.RETN_BILLING_INV_FORMAT_ID;
1463: IF g1_debug_mode = 'Y' THEN
1464: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'TmpCustomerId : ' || TmpCustomerId);
1465: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'TmpProjectId : ' || TmpProjectId);
1466: END IF;
1467: TmpTaskId := 0;
1468: OldTask := 0;
1469: NewTask := 0;
1492: TmpTotRetenion :=RetnRuleRec.total_retention_amount;
1493: TmpClientExt :=RetnRuleRec.client_extn_flag;
1494:
1495: IF g1_debug_mode = 'Y' THEN
1496: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'retention_level : ' || ProjCustRec.retention_level);
1497: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'TmpProjectId : ' || TmpProjectId);
1498: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'NewTask : ' || NewTask);
1499: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'TmpCompPercent : ' || TmpCompPercent);
1500: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'TmpBillCycleId : ' || TmpBillCycleId);
1493: TmpClientExt :=RetnRuleRec.client_extn_flag;
1494:
1495: IF g1_debug_mode = 'Y' THEN
1496: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'retention_level : ' || ProjCustRec.retention_level);
1497: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'TmpProjectId : ' || TmpProjectId);
1498: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'NewTask : ' || NewTask);
1499: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'TmpCompPercent : ' || TmpCompPercent);
1500: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'TmpBillCycleId : ' || TmpBillCycleId);
1501: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'TmpTotRetenion : ' || TmpTotRetenion);
1494:
1495: IF g1_debug_mode = 'Y' THEN
1496: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'retention_level : ' || ProjCustRec.retention_level);
1497: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'TmpProjectId : ' || TmpProjectId);
1498: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'NewTask : ' || NewTask);
1499: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'TmpCompPercent : ' || TmpCompPercent);
1500: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'TmpBillCycleId : ' || TmpBillCycleId);
1501: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'TmpTotRetenion : ' || TmpTotRetenion);
1502: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'TmpClientExt : ' || TmpClientExt);
1495: IF g1_debug_mode = 'Y' THEN
1496: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'retention_level : ' || ProjCustRec.retention_level);
1497: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'TmpProjectId : ' || TmpProjectId);
1498: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'NewTask : ' || NewTask);
1499: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'TmpCompPercent : ' || TmpCompPercent);
1500: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'TmpBillCycleId : ' || TmpBillCycleId);
1501: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'TmpTotRetenion : ' || TmpTotRetenion);
1502: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'TmpClientExt : ' || TmpClientExt);
1503: END IF;
1496: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'retention_level : ' || ProjCustRec.retention_level);
1497: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'TmpProjectId : ' || TmpProjectId);
1498: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'NewTask : ' || NewTask);
1499: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'TmpCompPercent : ' || TmpCompPercent);
1500: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'TmpBillCycleId : ' || TmpBillCycleId);
1501: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'TmpTotRetenion : ' || TmpTotRetenion);
1502: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'TmpClientExt : ' || TmpClientExt);
1503: END IF;
1504:
1497: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'TmpProjectId : ' || TmpProjectId);
1498: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'NewTask : ' || NewTask);
1499: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'TmpCompPercent : ' || TmpCompPercent);
1500: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'TmpBillCycleId : ' || TmpBillCycleId);
1501: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'TmpTotRetenion : ' || TmpTotRetenion);
1502: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'TmpClientExt : ' || TmpClientExt);
1503: END IF;
1504:
1505: -- to get current bill amount that is total retained amount - total billed
1498: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'NewTask : ' || NewTask);
1499: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'TmpCompPercent : ' || TmpCompPercent);
1500: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'TmpBillCycleId : ' || TmpBillCycleId);
1501: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'TmpTotRetenion : ' || TmpTotRetenion);
1502: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'TmpClientExt : ' || TmpClientExt);
1503: END IF;
1504:
1505: -- to get current bill amount that is total retained amount - total billed
1506: -- For Project Level
1514: WHERE spr.project_id= TmpProjectId
1515: AND spr.customer_id= TmpCustomerId; /*Added for bug 3234999*/
1516:
1517: IF g1_debug_mode = 'Y' THEN
1518: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'Sum of Retention Level : ' || ProjCustRec.retention_level);
1519: END IF;
1520:
1521: ELSE
1522:
1528: AND spr.task_id = NewTask
1529: AND spr.customer_id= TmpCustomerId; /*Added for bug 3234999*/
1530:
1531: IF g1_debug_mode = 'Y' THEN
1532: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'Sum of Retention Level : ' || ProjCustRec.retention_level
1533: ||' : ' || NewTask);
1534: END IF;
1535: -- For Percent Complet Case
1536: -- Process should execute only once
1542: END IF;
1543:
1544: END IF;
1545: IF g1_debug_mode = 'Y' THEN
1546: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'CurRetained : ' || CurRetained);
1547: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'Billing Method : ' || RetnRuleRec.Billing_Method);
1548: END IF;
1549:
1550: IF NVL(CurRetained,0) <> 0 THEN
1543:
1544: END IF;
1545: IF g1_debug_mode = 'Y' THEN
1546: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'CurRetained : ' || CurRetained);
1547: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'Billing Method : ' || RetnRuleRec.Billing_Method);
1548: END IF;
1549:
1550: IF NVL(CurRetained,0) <> 0 THEN
1551:
1550: IF NVL(CurRetained,0) <> 0 THEN
1551:
1552: IF rtrim(RetnRuleRec.Billing_Method)='TOTAL_RETENTION_AMOUNT' THEN
1553: IF g1_debug_mode = 'Y' THEN
1554: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'Processing Method : ' || RetnRuleRec.Billing_Method);
1555: END IF;
1556:
1557: IF g1_debug_mode = 'Y' THEN
1558: pa_retention_util.write_log('Total Retn Amt : ' ||
1554: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'Processing Method : ' || RetnRuleRec.Billing_Method);
1555: END IF;
1556:
1557: IF g1_debug_mode = 'Y' THEN
1558: pa_retention_util.write_log('Total Retn Amt : ' ||
1559: NVL(RetnRuleRec.total_retention_amount,0));
1560: END IF;
1561: TmpMethodValue := TO_CHAR(
1562: NVL(RetnRuleRec.total_retention_amount,
1575: RetnRuleRec.bill_amount := 0;
1576:
1577: END IF;
1578: IF g1_debug_mode = 'Y' THEN
1579: pa_retention_util.write_log('bill_percentage : ' ||
1580: NVL(RetnRuleRec.bill_percentage,0));
1581: pa_retention_util.write_log('bill_amount : ' ||
1582: NVL(RetnRuleRec.bill_amount,0));
1583: END IF;
1577: END IF;
1578: IF g1_debug_mode = 'Y' THEN
1579: pa_retention_util.write_log('bill_percentage : ' ||
1580: NVL(RetnRuleRec.bill_percentage,0));
1581: pa_retention_util.write_log('bill_amount : ' ||
1582: NVL(RetnRuleRec.bill_amount,0));
1583: END IF;
1584:
1585: ElsIF rtrim(RetnRuleRec.Billing_Method)='CLIENT_EXTENSION' THEN
1583: END IF;
1584:
1585: ElsIF rtrim(RetnRuleRec.Billing_Method)='CLIENT_EXTENSION' THEN
1586: IF g1_debug_mode = 'Y' THEN
1587: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'Processing Method : ' || RetnRuleRec.Billing_Method);
1588: END IF;
1589:
1590: -- Call Client Extension to get the percent or amount
1591: IF g1_debug_mode = 'Y' THEN
1588: END IF;
1589:
1590: -- Call Client Extension to get the percent or amount
1591: IF g1_debug_mode = 'Y' THEN
1592: pa_retention_util.write_log('Total Retn Amt : ' ||
1593: NVL(RetnRuleRec.total_retention_amount,0));
1594: END IF;
1595:
1596: TmpBillPercentage :=0;
1633: RetnRuleRec.bill_amount := 0;
1634:
1635: END IF;
1636: IF g1_debug_mode = 'Y' THEN
1637: pa_retention_util.write_log('bill_percentage : ' ||
1638: NVL(RetnRuleRec.bill_percentage,0));
1639: pa_retention_util.write_log('bill_amount : ' ||
1640: NVL(RetnRuleRec.bill_amount,0));
1641: END IF;
1635: END IF;
1636: IF g1_debug_mode = 'Y' THEN
1637: pa_retention_util.write_log('bill_percentage : ' ||
1638: NVL(RetnRuleRec.bill_percentage,0));
1639: pa_retention_util.write_log('bill_amount : ' ||
1640: NVL(RetnRuleRec.bill_amount,0));
1641: END IF;
1642:
1643: ElsIF rtrim(RetnRuleRec.Billing_Method) ='PERCENT_COMPLETE' THEN
1642:
1643: ElsIF rtrim(RetnRuleRec.Billing_Method) ='PERCENT_COMPLETE' THEN
1644:
1645: IF g1_debug_mode = 'Y' THEN
1646: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'Processing Method : ' || RetnRuleRec.Billing_Method);
1647: pa_retention_util.write_log('Total Retn Amt : ' ||
1648: NVL(RetnRuleRec.total_retention_amount,0));
1649: END IF;
1650:
1643: ElsIF rtrim(RetnRuleRec.Billing_Method) ='PERCENT_COMPLETE' THEN
1644:
1645: IF g1_debug_mode = 'Y' THEN
1646: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'Processing Method : ' || RetnRuleRec.Billing_Method);
1647: pa_retention_util.write_log('Total Retn Amt : ' ||
1648: NVL(RetnRuleRec.total_retention_amount,0));
1649: END IF;
1650:
1651:
1664: RetnRuleRec.bill_amount := 0;
1665: END IF;
1666:
1667: IF g1_debug_mode = 'Y' THEN
1668: pa_retention_util.write_log('bill_percentage : ' ||
1669: NVL(RetnRuleRec.bill_percentage,0));
1670: pa_retention_util.write_log('bill_amount : ' ||
1671: NVL(RetnRuleRec.bill_amount,0));
1672: END IF;
1666:
1667: IF g1_debug_mode = 'Y' THEN
1668: pa_retention_util.write_log('bill_percentage : ' ||
1669: NVL(RetnRuleRec.bill_percentage,0));
1670: pa_retention_util.write_log('bill_amount : ' ||
1671: NVL(RetnRuleRec.bill_amount,0));
1672: END IF;
1673:
1674: ElsIF RetnRuleRec.Billing_Method='RETENTION_BILLING_CYCLE' THEN
1675: TmpMethodValue :=
1676: RetnRuleRec.Billing_Cycle_Name;
1677:
1678:
1679: IF pa_retention_util.IsBillingCycleQualified(
1680: p_project_id => TmpProjectId,
1681: p_task_id => TmpTaskId,
1682: P_bill_thru_date =>
1683: TO_DATE(pa_billing.globvars.billthrudate,'YYYY/MM/DD'),
1700:
1701: END IF;
1702:
1703: IF g1_debug_mode = 'Y' THEN
1704: pa_retention_util.write_log('Billing Percentage : ' ||
1705: NVL(RetnRuleRec.bill_percentage,0));
1706:
1707: pa_retention_util.write_log('Billing Amount : ' ||
1708: NVL(RetnRuleRec.bill_amount,0));
1703: IF g1_debug_mode = 'Y' THEN
1704: pa_retention_util.write_log('Billing Percentage : ' ||
1705: NVL(RetnRuleRec.bill_percentage,0));
1706:
1707: pa_retention_util.write_log('Billing Amount : ' ||
1708: NVL(RetnRuleRec.bill_amount,0));
1709: END IF;
1710:
1711: If NVL(RetnRuleRec.bill_percentage,0) <> 0 THEN
1719:
1720: END IF;
1721:
1722: IF g1_debug_mode = 'Y' THEN
1723: pa_retention_util.write_log('CurrBillAmount : ' ||
1724: NVL(CurBillAmount,0));
1725: END IF;
1726:
1727: IF NVL(CurBillAmount,0) <> 0 THEN
1726:
1727: IF NVL(CurBillAmount,0) <> 0 THEN
1728:
1729: IF g1_debug_mode = 'Y' THEN
1730: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'Open Cursor CurAgr ');
1731: END IF;
1732:
1733: OPEN Cur_Agr;
1734:
1769:
1770: END IF;
1771:
1772: IF g1_debug_mode = 'Y' THEN
1773: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'TmpBillAmount : '
1774: || TmpBillAmount);
1775: END IF;
1776:
1777: TmpPFCBillAmount :=
1789: NVL(SprRec.total_retained,0))
1790: * NVL(TmpBillAmount,0);
1791:
1792: IF g1_debug_mode = 'Y' THEN
1793: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'TmpPFCBillAmount : '
1794: || TmpPFCBillAmount);
1795: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'TmpPCBillAmount : '
1796: || TmpPCBillAmount);
1797: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'TmpFCBillAmount : '
1791:
1792: IF g1_debug_mode = 'Y' THEN
1793: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'TmpPFCBillAmount : '
1794: || TmpPFCBillAmount);
1795: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'TmpPCBillAmount : '
1796: || TmpPCBillAmount);
1797: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'TmpFCBillAmount : '
1798: || TmpFCBillAmount);
1799: END IF;
1793: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'TmpPFCBillAmount : '
1794: || TmpPFCBillAmount);
1795: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'TmpPCBillAmount : '
1796: || TmpPCBillAmount);
1797: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'TmpFCBillAmount : '
1798: || TmpFCBillAmount);
1799: END IF;
1800:
1801: IF (( ProjCustRec.retention_level = 'TOP_TASK'
1804: p_request_id=>p_request_id)='N' ) OR
1805: (ProjCustRec.retention_level = 'PROJECT')) THEN
1806:
1807: IF g1_debug_mode = 'Y' THEN
1808: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'Agreement Id : ' || SprRec.Agreement_id);
1809: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'Customer Id : ' || TmpCustomerId);
1810: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'Project Id : ' || TmpProjectId);
1811: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'CAll Build_Retn_Invoice_Header');
1812: /*The exception block has been added for customer account relation change,bug no 2760630 */ END IF;
1805: (ProjCustRec.retention_level = 'PROJECT')) THEN
1806:
1807: IF g1_debug_mode = 'Y' THEN
1808: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'Agreement Id : ' || SprRec.Agreement_id);
1809: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'Customer Id : ' || TmpCustomerId);
1810: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'Project Id : ' || TmpProjectId);
1811: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'CAll Build_Retn_Invoice_Header');
1812: /*The exception block has been added for customer account relation change,bug no 2760630 */ END IF;
1813: BEGIN
1806:
1807: IF g1_debug_mode = 'Y' THEN
1808: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'Agreement Id : ' || SprRec.Agreement_id);
1809: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'Customer Id : ' || TmpCustomerId);
1810: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'Project Id : ' || TmpProjectId);
1811: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'CAll Build_Retn_Invoice_Header');
1812: /*The exception block has been added for customer account relation change,bug no 2760630 */ END IF;
1813: BEGIN
1814: Tmprelactive :=0;
1807: IF g1_debug_mode = 'Y' THEN
1808: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'Agreement Id : ' || SprRec.Agreement_id);
1809: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'Customer Id : ' || TmpCustomerId);
1810: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'Project Id : ' || TmpProjectId);
1811: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'CAll Build_Retn_Invoice_Header');
1812: /*The exception block has been added for customer account relation change,bug no 2760630 */ END IF;
1813: BEGIN
1814: Tmprelactive :=0;
1815: IF NVL(TmpBillAmount,0) <> 0 THEN
1837:
1838: IF NVL(TmpBillAmounT,0) <> 0 THEN
1839:
1840: IF g1_debug_mode = 'Y' THEN
1841: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'CAll Create_Retn_Invoice_Lines');
1842: END IF;
1843:
1844: Create_Retn_Invoice_Lines(
1845: p_project_id=>TmpProjectId,
1874: -- Call the MRC hook
1875:
1876: /* MRC elimination bug 4941054
1877: IF g1_debug_mode = 'Y' THEN
1878: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'CAll MRC Hook');
1879: END IF;
1880:
1881: PA_MC_RETN_INV_DETAIL_PKG.Process_RetnInvDetails(
1882: p_project_id=>TmpProjectId,
1890: IF (SprRec.invproc_currency_code <> SprRec.projfunc_currency_code)
1891: AND (SprRec.inv_by_bill_trans_curr_flag ='Y') THEN
1892:
1893: IF g1_debug_mode = 'Y' THEN
1894: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'CAll Update_ProjFunc_Attributes');
1895: END IF;
1896:
1897: Update_ProjFunc_Attributes(p_project_id=>TmpProjectId,
1898: p_draft_invoice_num=>TmpInvoiceNum);
1924:
1925: -- Update the invoice currency attributes for retention invoices
1926:
1927: IF g1_debug_mode = 'Y' THEN
1928: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'CAll Update_Inv_Trans_Attributes');
1929: END IF;
1930:
1931: Update_Inv_Trans_Attributes(p_request_id=>p_request_id);
1932:
1932:
1933: -- create distribution warning if the project is not generated any retention invoices
1934:
1935: IF g1_debug_mode = 'Y' THEN
1936: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'Call Invoice_Generation_Exceptions');
1937: END IF;
1938:
1939: Invoice_Generation_Exceptions (p_request_id =>p_request_id,
1940: p_start_proj_number=>p_start_proj_number ,
1940: p_start_proj_number=>p_start_proj_number ,
1941: p_end_proj_number=>p_end_proj_number) ;
1942:
1943: IF g1_debug_mode = 'Y' THEN
1944: pa_retention_util.write_log('Retention_Billing_Processing: ' || 'Update MRC for Retention Invoices');
1945: END IF;
1946:
1947: UPDATE PA_DRAFT_INVOICES
1948: SET CREATION_DATE = sysdate
1957: WHEN OTHERS THEN
1958: x_return_status :='E';
1959: pa_retn_billing_pkg.G_ERROR_CODE :='E';
1960: IF g1_debug_mode = 'Y' THEN
1961: pa_retention_util.write_log('Retention_Billing_Processing: Oracle Error : ' || sqlerrm);
1962: END IF;
1963: END Retention_Billing_Processing;
1964:
1965: PROCEDURE Update_Inv_Trans_Attributes (p_request_id IN NUMBER) IS
1974: TmpUserId NUMBER:= fnd_global.user_id;
1975:
1976: BEGIN
1977: IF g1_debug_mode = 'Y' THEN
1978: pa_retention_util.write_log('Entering Update_Inv_Trans_Attributes');
1979: END IF;
1980:
1981: FOR ProjectRec IN Retn_Inv_Project LOOP
1982: IF g1_debug_mode = 'Y' THEN
1979: END IF;
1980:
1981: FOR ProjectRec IN Retn_Inv_Project LOOP
1982: IF g1_debug_mode = 'Y' THEN
1983: pa_retention_util.write_log('Update_Inv_Trans_Attributes: ' || 'Calling PA_INVOICE_CURRENCY.Recalculate_Driver for project id : '
1984: || ProjectRec.project_id);
1985: END IF;
1986: PA_INVOICE_CURRENCY.Recalculate_Driver
1987: ( P_Request_ID =>p_request_id,
2035: TmpWarningCode VARCHAR2(30):= 'NO_RETN_BILLING_INVOICES';
2036:
2037: BEGIN
2038: IF g1_debug_mode = 'Y' THEN
2039: pa_retention_util.write_log('Invoice_Generation_Exceptions: ' || 'Warning : ' || TmpWarningCode);
2040: END IF;
2041:
2042: SELECT lk.meaning
2043: INTO TmpWarningMsg
2045: WHERE lk.lookup_code = TmpWarningCode
2046: AND lk.lookup_type = 'INVOICE DISTRIBUTION WARNING';
2047:
2048: IF g1_debug_mode = 'Y' THEN
2049: pa_retention_util.write_log('Invoice_Generation_Exceptions: ' || 'Warning Code : ' || TmpWarningCode);
2050: pa_retention_util.write_log('Invoice_Generation_Exceptions: ' || 'Warning Mesg : ' || TmpWarningMsg);
2051: END IF;
2052:
2053:
2046: AND lk.lookup_type = 'INVOICE DISTRIBUTION WARNING';
2047:
2048: IF g1_debug_mode = 'Y' THEN
2049: pa_retention_util.write_log('Invoice_Generation_Exceptions: ' || 'Warning Code : ' || TmpWarningCode);
2050: pa_retention_util.write_log('Invoice_Generation_Exceptions: ' || 'Warning Mesg : ' || TmpWarningMsg);
2051: END IF;
2052:
2053:
2054: OPEN cur_select_projects;
2056: FETCH cur_select_projects INTO RecSelectProjects;
2057: EXIT WHEN cur_select_projects%NOTFOUND;
2058:
2059: IF g1_debug_mode = 'Y' THEN
2060: pa_retention_util.write_log('Invoice_Generation_Exceptions: ' || 'Insert Warning ');
2061: END IF;
2062:
2063:
2064: INSERT INTO PA_DISTRIBUTION_WARNINGS (