227: Current_Time := sysdate;
228: fnd_message_cache.set_name('FND' , 'UTIL-CURRENT TIME');
229: fnd_message_cache.set_token('DATE' , fnd_date.date_to_displaydate(Current_Time));
230: fnd_message_cache.set_token('TIME' , to_char(Current_Time , 'HH24:MI:SS'));
231: PJM_CONC.put_line(fnd_message_cache.get);
232: PJM_CONC.new_line(1);
233: EXCEPTION
234: WHEN OTHERS THEN
235: NULL;
228: fnd_message_cache.set_name('FND' , 'UTIL-CURRENT TIME');
229: fnd_message_cache.set_token('DATE' , fnd_date.date_to_displaydate(Current_Time));
230: fnd_message_cache.set_token('TIME' , to_char(Current_Time , 'HH24:MI:SS'));
231: PJM_CONC.put_line(fnd_message_cache.get);
232: PJM_CONC.new_line(1);
233: EXCEPTION
234: WHEN OTHERS THEN
235: NULL;
236: END Timestamp;
637: l_uom := 'DOLLARS'; -- bug 4145856
638:
639:
640: fnd_message.set_name('PJM','CONC-APINV IPV Transfer');
641: PJM_CONC.put_line(fnd_message.get || ' ...');
642: PJM_CONC.new_line(1);
643:
644: PJM_CONC.put_line('[PROJECT_ID] = ' || X_Project_Id);
645: PJM_CONC.put_line('[START_DATE] = ' || X_Start_Date);
638:
639:
640: fnd_message.set_name('PJM','CONC-APINV IPV Transfer');
641: PJM_CONC.put_line(fnd_message.get || ' ...');
642: PJM_CONC.new_line(1);
643:
644: PJM_CONC.put_line('[PROJECT_ID] = ' || X_Project_Id);
645: PJM_CONC.put_line('[START_DATE] = ' || X_Start_Date);
646: PJM_CONC.put_line('[END_DATE] = ' || X_End_Date);
640: fnd_message.set_name('PJM','CONC-APINV IPV Transfer');
641: PJM_CONC.put_line(fnd_message.get || ' ...');
642: PJM_CONC.new_line(1);
643:
644: PJM_CONC.put_line('[PROJECT_ID] = ' || X_Project_Id);
645: PJM_CONC.put_line('[START_DATE] = ' || X_Start_Date);
646: PJM_CONC.put_line('[END_DATE] = ' || X_End_Date);
647: PJM_CONC.put_line('[SUBMIT_TRX_IMPORT] = ' || X_Submit_Trx_Import);
648: PJM_CONC.put_line('[EXP_TYPE_BSD_ON_PUR_CTGY] = ' || X_Exp_Type_Bsd_On_Pur_Ctgy); -- bug fix 12835119 (FP of 7372638)
641: PJM_CONC.put_line(fnd_message.get || ' ...');
642: PJM_CONC.new_line(1);
643:
644: PJM_CONC.put_line('[PROJECT_ID] = ' || X_Project_Id);
645: PJM_CONC.put_line('[START_DATE] = ' || X_Start_Date);
646: PJM_CONC.put_line('[END_DATE] = ' || X_End_Date);
647: PJM_CONC.put_line('[SUBMIT_TRX_IMPORT] = ' || X_Submit_Trx_Import);
648: PJM_CONC.put_line('[EXP_TYPE_BSD_ON_PUR_CTGY] = ' || X_Exp_Type_Bsd_On_Pur_Ctgy); -- bug fix 12835119 (FP of 7372638)
649:
642: PJM_CONC.new_line(1);
643:
644: PJM_CONC.put_line('[PROJECT_ID] = ' || X_Project_Id);
645: PJM_CONC.put_line('[START_DATE] = ' || X_Start_Date);
646: PJM_CONC.put_line('[END_DATE] = ' || X_End_Date);
647: PJM_CONC.put_line('[SUBMIT_TRX_IMPORT] = ' || X_Submit_Trx_Import);
648: PJM_CONC.put_line('[EXP_TYPE_BSD_ON_PUR_CTGY] = ' || X_Exp_Type_Bsd_On_Pur_Ctgy); -- bug fix 12835119 (FP of 7372638)
649:
650: l_request_id := fnd_global.conc_request_id;
643:
644: PJM_CONC.put_line('[PROJECT_ID] = ' || X_Project_Id);
645: PJM_CONC.put_line('[START_DATE] = ' || X_Start_Date);
646: PJM_CONC.put_line('[END_DATE] = ' || X_End_Date);
647: PJM_CONC.put_line('[SUBMIT_TRX_IMPORT] = ' || X_Submit_Trx_Import);
648: PJM_CONC.put_line('[EXP_TYPE_BSD_ON_PUR_CTGY] = ' || X_Exp_Type_Bsd_On_Pur_Ctgy); -- bug fix 12835119 (FP of 7372638)
649:
650: l_request_id := fnd_global.conc_request_id;
651: l_user_id := fnd_global.user_id;
644: PJM_CONC.put_line('[PROJECT_ID] = ' || X_Project_Id);
645: PJM_CONC.put_line('[START_DATE] = ' || X_Start_Date);
646: PJM_CONC.put_line('[END_DATE] = ' || X_End_Date);
647: PJM_CONC.put_line('[SUBMIT_TRX_IMPORT] = ' || X_Submit_Trx_Import);
648: PJM_CONC.put_line('[EXP_TYPE_BSD_ON_PUR_CTGY] = ' || X_Exp_Type_Bsd_On_Pur_Ctgy); -- bug fix 12835119 (FP of 7372638)
649:
650: l_request_id := fnd_global.conc_request_id;
651: l_user_id := fnd_global.user_id;
652: l_Start_Date := fnd_date.canonical_to_date(X_Start_Date);
651: l_user_id := fnd_global.user_id;
652: l_Start_Date := fnd_date.canonical_to_date(X_Start_Date);
653: l_End_Date := fnd_date.canonical_to_date(X_End_Date);
654:
655: PJM_CONC.put_line('[REQUEST_ID] = ' || l_request_id);
656: PJM_CONC.new_line(1);
657:
658: l_IPV_Exp_Comment := fnd_message.get_string('PJM','CONC-APINV IPV');
659: l_ERV_Exp_Comment := fnd_message.get_string('PJM','CONC-APINV ERV');
652: l_Start_Date := fnd_date.canonical_to_date(X_Start_Date);
653: l_End_Date := fnd_date.canonical_to_date(X_End_Date);
654:
655: PJM_CONC.put_line('[REQUEST_ID] = ' || l_request_id);
656: PJM_CONC.new_line(1);
657:
658: l_IPV_Exp_Comment := fnd_message.get_string('PJM','CONC-APINV IPV');
659: l_ERV_Exp_Comment := fnd_message.get_string('PJM','CONC-APINV ERV');
660: l_Freight_Exp_Comment := fnd_message.get_string('PJM','CONC-APINV FREIGHT');
661: l_Tax_Exp_Comment := fnd_message.get_string('PJM','CONC-APINV TAX');
662: l_Misc_Exp_Comment := fnd_message.get_string('PJM','CONC-APINV MISC');
663: l_Batch_Name := Batch_Name;
664:
665: PJM_CONC.put_line('Batch_Name = ' || l_batch_name);
666: PJM_CONC.new_line(1);
667:
668: ----------------------------------------------------------------------
669: -- Loop for transfering Variances from Invoice_Distribution_All to
662: l_Misc_Exp_Comment := fnd_message.get_string('PJM','CONC-APINV MISC');
663: l_Batch_Name := Batch_Name;
664:
665: PJM_CONC.put_line('Batch_Name = ' || l_batch_name);
666: PJM_CONC.new_line(1);
667:
668: ----------------------------------------------------------------------
669: -- Loop for transfering Variances from Invoice_Distribution_All to
670: -- PA_Transaction_Interface_All
670: -- PA_Transaction_Interface_All
671: ----------------------------------------------------------------------
672:
673: fnd_message.set_name('PJM','CONC-APINV Start Loop');
674: PJM_CONC.put_line(fnd_message.get || ' ...');
675:
676: Timestamp;
677:
678: if (x_project_id is not null) then
717: , PoRec.Destination_Type_Code
718: , InvRec.Project_Id );
719: END IF;
720:
721: PJM_CONC.put_line(' invoice_id ............ '||InvRec.Invoice_Id);
722: PJM_CONC.put_line(' line_num .............. '||
723: InvRec.Invoice_Distribution_Id);
724: PJM_CONC.put_line(' project_id ............ '||InvRec.Project_ID);
725: PJM_CONC.put_line(' task_id ............... '||l_Task_Id);
718: , InvRec.Project_Id );
719: END IF;
720:
721: PJM_CONC.put_line(' invoice_id ............ '||InvRec.Invoice_Id);
722: PJM_CONC.put_line(' line_num .............. '||
723: InvRec.Invoice_Distribution_Id);
724: PJM_CONC.put_line(' project_id ............ '||InvRec.Project_ID);
725: PJM_CONC.put_line(' task_id ............... '||l_Task_Id);
726: PJM_CONC.put_line(' expenditure_org_id .... '||
720:
721: PJM_CONC.put_line(' invoice_id ............ '||InvRec.Invoice_Id);
722: PJM_CONC.put_line(' line_num .............. '||
723: InvRec.Invoice_Distribution_Id);
724: PJM_CONC.put_line(' project_id ............ '||InvRec.Project_ID);
725: PJM_CONC.put_line(' task_id ............... '||l_Task_Id);
726: PJM_CONC.put_line(' expenditure_org_id .... '||
727: InvRec.Expenditure_Organization_ID);
728:
721: PJM_CONC.put_line(' invoice_id ............ '||InvRec.Invoice_Id);
722: PJM_CONC.put_line(' line_num .............. '||
723: InvRec.Invoice_Distribution_Id);
724: PJM_CONC.put_line(' project_id ............ '||InvRec.Project_ID);
725: PJM_CONC.put_line(' task_id ............... '||l_Task_Id);
726: PJM_CONC.put_line(' expenditure_org_id .... '||
727: InvRec.Expenditure_Organization_ID);
728:
729: Timestamp;
722: PJM_CONC.put_line(' line_num .............. '||
723: InvRec.Invoice_Distribution_Id);
724: PJM_CONC.put_line(' project_id ............ '||InvRec.Project_ID);
725: PJM_CONC.put_line(' task_id ............... '||l_Task_Id);
726: PJM_CONC.put_line(' expenditure_org_id .... '||
727: InvRec.Expenditure_Organization_ID);
728:
729: Timestamp;
730:
758: when others then
759: NULL;
760: END;
761: END IF;
762: PJM_CONC.put_line('Category id for Direct item'||l_po_category_id);
763:
764: IF l_po_category_id is not NULL then
765: l_exp_type := get_ExpType_for_DirectItem(InvRec.Invoice_Id,l_po_category_id);
766: PJM_CONC.put_line('Exp type for Direct item'||l_exp_type);
762: PJM_CONC.put_line('Category id for Direct item'||l_po_category_id);
763:
764: IF l_po_category_id is not NULL then
765: l_exp_type := get_ExpType_for_DirectItem(InvRec.Invoice_Id,l_po_category_id);
766: PJM_CONC.put_line('Exp type for Direct item'||l_exp_type);
767: END IF;
768: END IF;
769: --- bug fix 12835119(FP of 7372638)
770:
775: , invrec.project_id
776: , invrec.expenditure_organization_id );
777:
778: END IF; --- bug fix 12835119(FP of 7372638)
779: PJM_CONC.put_line(' Invoice line type is .. '||invrec.line_type_lookup_code);
780: PJM_CONC.put_line(' Charge amount ............ '||
781: InvRec.charge_amount);
782: PJM_CONC.put_line(' Charge expenditure_type .. '||l_exp_type);
783: PJM_CONC.put_line(' expenditure_comment ... '||
776: , invrec.expenditure_organization_id );
777:
778: END IF; --- bug fix 12835119(FP of 7372638)
779: PJM_CONC.put_line(' Invoice line type is .. '||invrec.line_type_lookup_code);
780: PJM_CONC.put_line(' Charge amount ............ '||
781: InvRec.charge_amount);
782: PJM_CONC.put_line(' Charge expenditure_type .. '||l_exp_type);
783: PJM_CONC.put_line(' expenditure_comment ... '||
784: InvRec.Expenditure_Comment);
778: END IF; --- bug fix 12835119(FP of 7372638)
779: PJM_CONC.put_line(' Invoice line type is .. '||invrec.line_type_lookup_code);
780: PJM_CONC.put_line(' Charge amount ............ '||
781: InvRec.charge_amount);
782: PJM_CONC.put_line(' Charge expenditure_type .. '||l_exp_type);
783: PJM_CONC.put_line(' expenditure_comment ... '||
784: InvRec.Expenditure_Comment);
785: PJM_CONC.new_line(1);
786:
779: PJM_CONC.put_line(' Invoice line type is .. '||invrec.line_type_lookup_code);
780: PJM_CONC.put_line(' Charge amount ............ '||
781: InvRec.charge_amount);
782: PJM_CONC.put_line(' Charge expenditure_type .. '||l_exp_type);
783: PJM_CONC.put_line(' expenditure_comment ... '||
784: InvRec.Expenditure_Comment);
785: PJM_CONC.new_line(1);
786:
787:
781: InvRec.charge_amount);
782: PJM_CONC.put_line(' Charge expenditure_type .. '||l_exp_type);
783: PJM_CONC.put_line(' expenditure_comment ... '||
784: InvRec.Expenditure_Comment);
785: PJM_CONC.new_line(1);
786:
787:
788:
789: /* Bug 13853188 The expenditure organization is not active */
799: AND BD.department_id = WO.department_id
800: AND BD.organization_id = WO.organization_id
801: AND pod.po_distribution_id = InvRec.PO_Distribution_Id;
802:
803: PJM_CONC.put_line('pa_expenditure_org_id .....'||l_exp_org_id);
804: PJM_CONC.put_line('pa_expenditure_org_id .....'||InvRec.PO_Distribution_Id);
805:
806: EXCEPTION
807: when others then
800: AND BD.organization_id = WO.organization_id
801: AND pod.po_distribution_id = InvRec.PO_Distribution_Id;
802:
803: PJM_CONC.put_line('pa_expenditure_org_id .....'||l_exp_org_id);
804: PJM_CONC.put_line('pa_expenditure_org_id .....'||InvRec.PO_Distribution_Id);
805:
806: EXCEPTION
807: when others then
808: PJM_CONC.put_line('Exp organization is not specified on Department. Will use the Inv organization. ');
804: PJM_CONC.put_line('pa_expenditure_org_id .....'||InvRec.PO_Distribution_Id);
805:
806: EXCEPTION
807: when others then
808: PJM_CONC.put_line('Exp organization is not specified on Department. Will use the Inv organization. ');
809: END;
810: /* Bug Fix ends Bug 13853188 The expenditure organization is not active */
811: ---------------------------------------------------------------------
812: -- Set Expenditure Comment
863: -- Insert into PA_TRANSACTION_INTERFACES table
864: ----------------------------------------------------------------------
865:
866: fnd_message.set_name('PJM','CONC-APINV Insert');
867: PJM_CONC.put_line('... ' || fnd_message.get);
868:
869: if not ( InvRec.Dist_Code_Combination_Id is not null AND
870: nvl(nvl(InvRec.Base_Charge_Amount,
871: InvRec.Charge_Amount) , 0) <> 0 ) then
869: if not ( InvRec.Dist_Code_Combination_Id is not null AND
870: nvl(nvl(InvRec.Base_Charge_Amount,
871: InvRec.Charge_Amount) , 0) <> 0 ) then
872:
873: PJM_CONC.put_line('...... Charge amount not available, skipping...');
874: -- Mark skipped record to 'G'
875: UPDATE AP_Invoice_Distributions_all
876: SET pa_addition_flag = 'G'
877: WHERE invoice_distribution_id = ( select nvl(related_id, charge_applicable_to_dist_id)
880: and Invoice_Distribution_Id = InvRec.Invoice_Distribution_Id);
881:
882: elsif ( l_Exp_Type is null) then
883:
884: PJM_CONC.put_line('...... Inv Org not setup to transfer charges, skipping...');
885: -- Mark skipped record to 'G'
886: UPDATE AP_Invoice_Distributions_all
887: SET pa_addition_flag = 'G'
888: WHERE invoice_distribution_id = ( select nvl(related_id, charge_applicable_to_dist_id)
990: select next_day( trunc(InvRec.Expenditure_Item_Date)-1, l_week_ending_day )
991: into l_week_ending
992: from dual;
993:
994: PJM_CONC.put_line('...... Processing IPV, ERV, Tax Variances');
995:
996: -- Insert for all the charges
997:
998: INSERT INTO pa_transaction_interface_all
1089: -- Update pa_addition_flag to 'Y' for successful invoice distributions
1090: ----------------------------------------------------------------------
1091:
1092: fnd_message.set_name('PJM','CONC-APINV Flag Comp');
1093: PJM_CONC.put_line('... ' || fnd_message.get);
1094: PJM_CONC.new_line(1);
1095:
1096: l_progress := 80;
1097:
1090: ----------------------------------------------------------------------
1091:
1092: fnd_message.set_name('PJM','CONC-APINV Flag Comp');
1093: PJM_CONC.put_line('... ' || fnd_message.get);
1094: PJM_CONC.new_line(1);
1095:
1096: l_progress := 80;
1097:
1098: UPDATE AP_Invoice_Distributions_all
1147: , PoRec.Destination_Type_Code
1148: , InvRec.Project_Id );
1149: END IF;
1150:
1151: PJM_CONC.put_line(' invoice_id ............ '||InvRec.Invoice_Id);
1152: PJM_CONC.put_line(' line_num .............. '||
1153: InvRec.Invoice_Distribution_Id);
1154: PJM_CONC.put_line(' project_id ............ '||InvRec.Project_ID);
1155: PJM_CONC.put_line(' task_id ............... '||l_Task_Id);
1148: , InvRec.Project_Id );
1149: END IF;
1150:
1151: PJM_CONC.put_line(' invoice_id ............ '||InvRec.Invoice_Id);
1152: PJM_CONC.put_line(' line_num .............. '||
1153: InvRec.Invoice_Distribution_Id);
1154: PJM_CONC.put_line(' project_id ............ '||InvRec.Project_ID);
1155: PJM_CONC.put_line(' task_id ............... '||l_Task_Id);
1156: PJM_CONC.put_line(' expenditure_org_id .... '||
1150:
1151: PJM_CONC.put_line(' invoice_id ............ '||InvRec.Invoice_Id);
1152: PJM_CONC.put_line(' line_num .............. '||
1153: InvRec.Invoice_Distribution_Id);
1154: PJM_CONC.put_line(' project_id ............ '||InvRec.Project_ID);
1155: PJM_CONC.put_line(' task_id ............... '||l_Task_Id);
1156: PJM_CONC.put_line(' expenditure_org_id .... '||
1157: InvRec.Expenditure_Organization_ID);
1158:
1151: PJM_CONC.put_line(' invoice_id ............ '||InvRec.Invoice_Id);
1152: PJM_CONC.put_line(' line_num .............. '||
1153: InvRec.Invoice_Distribution_Id);
1154: PJM_CONC.put_line(' project_id ............ '||InvRec.Project_ID);
1155: PJM_CONC.put_line(' task_id ............... '||l_Task_Id);
1156: PJM_CONC.put_line(' expenditure_org_id .... '||
1157: InvRec.Expenditure_Organization_ID);
1158:
1159: Timestamp;
1152: PJM_CONC.put_line(' line_num .............. '||
1153: InvRec.Invoice_Distribution_Id);
1154: PJM_CONC.put_line(' project_id ............ '||InvRec.Project_ID);
1155: PJM_CONC.put_line(' task_id ............... '||l_Task_Id);
1156: PJM_CONC.put_line(' expenditure_org_id .... '||
1157: InvRec.Expenditure_Organization_ID);
1158:
1159: Timestamp;
1160:
1188: when others then
1189: NULL;
1190: END;
1191: END IF;
1192: PJM_CONC.put_line('Category id for Direct item'||l_po_category_id);
1193:
1194: IF l_po_category_id is not NULL then
1195: l_exp_type := get_ExpType_for_DirectItem(InvRec.Invoice_Id,l_po_category_id);
1196: PJM_CONC.put_line('Exp type for Direct item'||l_exp_type);
1192: PJM_CONC.put_line('Category id for Direct item'||l_po_category_id);
1193:
1194: IF l_po_category_id is not NULL then
1195: l_exp_type := get_ExpType_for_DirectItem(InvRec.Invoice_Id,l_po_category_id);
1196: PJM_CONC.put_line('Exp type for Direct item'||l_exp_type);
1197: END IF;
1198: END IF;
1199: --- bug fix 12835119(FP of 7372638)
1200:
1207: , invrec.expenditure_organization_id );
1208:
1209: END IF; --- bug fix 12835119(FP of 7372638)
1210:
1211: PJM_CONC.put_line(' Invoice line type is .. '||invrec.line_type_lookup_code);
1212: PJM_CONC.put_line(' Charge amount ............ '||
1213: InvRec.charge_amount);
1214: PJM_CONC.put_line(' Charge expenditure_type .. '||l_exp_type);
1215: PJM_CONC.put_line(' expenditure_comment ... '||
1208:
1209: END IF; --- bug fix 12835119(FP of 7372638)
1210:
1211: PJM_CONC.put_line(' Invoice line type is .. '||invrec.line_type_lookup_code);
1212: PJM_CONC.put_line(' Charge amount ............ '||
1213: InvRec.charge_amount);
1214: PJM_CONC.put_line(' Charge expenditure_type .. '||l_exp_type);
1215: PJM_CONC.put_line(' expenditure_comment ... '||
1216: InvRec.Expenditure_Comment);
1210:
1211: PJM_CONC.put_line(' Invoice line type is .. '||invrec.line_type_lookup_code);
1212: PJM_CONC.put_line(' Charge amount ............ '||
1213: InvRec.charge_amount);
1214: PJM_CONC.put_line(' Charge expenditure_type .. '||l_exp_type);
1215: PJM_CONC.put_line(' expenditure_comment ... '||
1216: InvRec.Expenditure_Comment);
1217: PJM_CONC.new_line(1);
1218:
1211: PJM_CONC.put_line(' Invoice line type is .. '||invrec.line_type_lookup_code);
1212: PJM_CONC.put_line(' Charge amount ............ '||
1213: InvRec.charge_amount);
1214: PJM_CONC.put_line(' Charge expenditure_type .. '||l_exp_type);
1215: PJM_CONC.put_line(' expenditure_comment ... '||
1216: InvRec.Expenditure_Comment);
1217: PJM_CONC.new_line(1);
1218:
1219:
1213: InvRec.charge_amount);
1214: PJM_CONC.put_line(' Charge expenditure_type .. '||l_exp_type);
1215: PJM_CONC.put_line(' expenditure_comment ... '||
1216: InvRec.Expenditure_Comment);
1217: PJM_CONC.new_line(1);
1218:
1219:
1220: /* Bug 13853188 The expenditure organization is not active */
1221: Begin
1230: AND BD.department_id = WO.department_id
1231: AND BD.organization_id = WO.organization_id
1232: AND pod.po_distribution_id = InvRec.PO_Distribution_Id;
1233:
1234: PJM_CONC.put_line('pa_expenditure_org_id .....'||l_exp_org_id);
1235: PJM_CONC.put_line('pa_expenditure_org_id .....'||InvRec.PO_Distribution_Id);
1236:
1237: EXCEPTION
1238: when others then
1231: AND BD.organization_id = WO.organization_id
1232: AND pod.po_distribution_id = InvRec.PO_Distribution_Id;
1233:
1234: PJM_CONC.put_line('pa_expenditure_org_id .....'||l_exp_org_id);
1235: PJM_CONC.put_line('pa_expenditure_org_id .....'||InvRec.PO_Distribution_Id);
1236:
1237: EXCEPTION
1238: when others then
1239: PJM_CONC.put_line('Exp organization is not specified on Department. Will use the Inv organization. ');
1235: PJM_CONC.put_line('pa_expenditure_org_id .....'||InvRec.PO_Distribution_Id);
1236:
1237: EXCEPTION
1238: when others then
1239: PJM_CONC.put_line('Exp organization is not specified on Department. Will use the Inv organization. ');
1240: END;
1241: /* Bug Fix ends Bug 13853188 The expenditure organization is not active */
1242:
1243:
1297: -- Insert into PA_TRANSACTION_INTERFACES table
1298: ----------------------------------------------------------------------
1299:
1300: fnd_message.set_name('PJM','CONC-APINV Insert');
1301: PJM_CONC.put_line('... ' || fnd_message.get);
1302:
1303: if not ( InvRec.Dist_Code_Combination_Id is not null AND
1304: nvl(nvl(InvRec.Base_Charge_Amount,
1305: InvRec.Charge_Amount) , 0) <> 0 ) then
1303: if not ( InvRec.Dist_Code_Combination_Id is not null AND
1304: nvl(nvl(InvRec.Base_Charge_Amount,
1305: InvRec.Charge_Amount) , 0) <> 0 ) then
1306:
1307: PJM_CONC.put_line('...... Charge amount not available, skipping...');
1308: -- Mark skipped record to 'G'
1309: UPDATE AP_Invoice_Distributions_all
1310: SET pa_addition_flag = 'G'
1311: WHERE invoice_distribution_id = ( select nvl(related_id, charge_applicable_to_dist_id)
1314: and Invoice_Distribution_Id = InvRec.Invoice_Distribution_Id);
1315:
1316: elsif ( l_Exp_Type is null) then
1317:
1318: PJM_CONC.put_line('...... Inv Org not setup to transfer charges, skipping...');
1319: -- Mark skipped record to 'G'
1320: UPDATE AP_Invoice_Distributions_all
1321: SET pa_addition_flag = 'G'
1322: WHERE invoice_distribution_id = ( select nvl(related_id, charge_applicable_to_dist_id)
1423: select next_day( trunc(InvRec.Expenditure_Item_Date)-1, l_week_ending_day )
1424: into l_week_ending
1425: from dual;
1426:
1427: PJM_CONC.put_line('...... Processing Special Charge');
1428:
1429: -- Insert for all the charges
1430:
1431: INSERT INTO pa_transaction_interface_all
1522: -- Update pa_addition_flag to 'Y' for successful invoice distributions
1523: ----------------------------------------------------------------------
1524:
1525: fnd_message.set_name('PJM','CONC-APINV Flag Comp');
1526: PJM_CONC.put_line('... ' || fnd_message.get);
1527: PJM_CONC.new_line(1);
1528:
1529: l_progress := 88;
1530:
1523: ----------------------------------------------------------------------
1524:
1525: fnd_message.set_name('PJM','CONC-APINV Flag Comp');
1526: PJM_CONC.put_line('... ' || fnd_message.get);
1527: PJM_CONC.new_line(1);
1528:
1529: l_progress := 88;
1530:
1531: UPDATE AP_Invoice_Distributions_all
1589: , PoRec.Destination_Type_Code
1590: , InvRec.Project_Id );
1591: END IF;
1592:
1593: PJM_CONC.put_line(' invoice_id ............ '||InvRec.Invoice_Id);
1594: PJM_CONC.put_line(' line_num .............. '||
1595: InvRec.Invoice_Distribution_Id);
1596: PJM_CONC.put_line(' project_id ............ '||InvRec.Project_ID);
1597: PJM_CONC.put_line(' task_id ............... '||l_Task_Id);
1590: , InvRec.Project_Id );
1591: END IF;
1592:
1593: PJM_CONC.put_line(' invoice_id ............ '||InvRec.Invoice_Id);
1594: PJM_CONC.put_line(' line_num .............. '||
1595: InvRec.Invoice_Distribution_Id);
1596: PJM_CONC.put_line(' project_id ............ '||InvRec.Project_ID);
1597: PJM_CONC.put_line(' task_id ............... '||l_Task_Id);
1598: PJM_CONC.put_line(' expenditure_org_id .... '||
1592:
1593: PJM_CONC.put_line(' invoice_id ............ '||InvRec.Invoice_Id);
1594: PJM_CONC.put_line(' line_num .............. '||
1595: InvRec.Invoice_Distribution_Id);
1596: PJM_CONC.put_line(' project_id ............ '||InvRec.Project_ID);
1597: PJM_CONC.put_line(' task_id ............... '||l_Task_Id);
1598: PJM_CONC.put_line(' expenditure_org_id .... '||
1599: InvRec.Expenditure_Organization_ID);
1600:
1593: PJM_CONC.put_line(' invoice_id ............ '||InvRec.Invoice_Id);
1594: PJM_CONC.put_line(' line_num .............. '||
1595: InvRec.Invoice_Distribution_Id);
1596: PJM_CONC.put_line(' project_id ............ '||InvRec.Project_ID);
1597: PJM_CONC.put_line(' task_id ............... '||l_Task_Id);
1598: PJM_CONC.put_line(' expenditure_org_id .... '||
1599: InvRec.Expenditure_Organization_ID);
1600:
1601: Timestamp;
1594: PJM_CONC.put_line(' line_num .............. '||
1595: InvRec.Invoice_Distribution_Id);
1596: PJM_CONC.put_line(' project_id ............ '||InvRec.Project_ID);
1597: PJM_CONC.put_line(' task_id ............... '||l_Task_Id);
1598: PJM_CONC.put_line(' expenditure_org_id .... '||
1599: InvRec.Expenditure_Organization_ID);
1600:
1601: Timestamp;
1602:
1630: when others then
1631: NULL;
1632: END;
1633: END IF;
1634: PJM_CONC.put_line('Category id for Direct item'||l_po_category_id);
1635:
1636: IF l_po_category_id is not NULL then
1637: l_exp_type := get_ExpType_for_DirectItem(InvRec.Invoice_Id,l_po_category_id);
1638: PJM_CONC.put_line('Exp type for Direct item'||l_exp_type);
1634: PJM_CONC.put_line('Category id for Direct item'||l_po_category_id);
1635:
1636: IF l_po_category_id is not NULL then
1637: l_exp_type := get_ExpType_for_DirectItem(InvRec.Invoice_Id,l_po_category_id);
1638: PJM_CONC.put_line('Exp type for Direct item'||l_exp_type);
1639: END IF;
1640: END IF;
1641: --- bug fix 12835119(FP of 7372638)
1642:
1647: , invrec.project_id
1648: , invrec.expenditure_organization_id );
1649: END IF; --- bug fix 12835119(FP of 7372638)
1650:
1651: PJM_CONC.put_line(' Invoice line type is .. '||invrec.line_type_lookup_code);
1652: PJM_CONC.put_line(' Charge amount ............ '||
1653: InvRec.charge_amount);
1654: PJM_CONC.put_line(' Charge expenditure_type .. '||l_exp_type);
1655: PJM_CONC.put_line(' expenditure_comment ... '||
1648: , invrec.expenditure_organization_id );
1649: END IF; --- bug fix 12835119(FP of 7372638)
1650:
1651: PJM_CONC.put_line(' Invoice line type is .. '||invrec.line_type_lookup_code);
1652: PJM_CONC.put_line(' Charge amount ............ '||
1653: InvRec.charge_amount);
1654: PJM_CONC.put_line(' Charge expenditure_type .. '||l_exp_type);
1655: PJM_CONC.put_line(' expenditure_comment ... '||
1656: InvRec.Expenditure_Comment);
1650:
1651: PJM_CONC.put_line(' Invoice line type is .. '||invrec.line_type_lookup_code);
1652: PJM_CONC.put_line(' Charge amount ............ '||
1653: InvRec.charge_amount);
1654: PJM_CONC.put_line(' Charge expenditure_type .. '||l_exp_type);
1655: PJM_CONC.put_line(' expenditure_comment ... '||
1656: InvRec.Expenditure_Comment);
1657: PJM_CONC.new_line(1);
1658:
1651: PJM_CONC.put_line(' Invoice line type is .. '||invrec.line_type_lookup_code);
1652: PJM_CONC.put_line(' Charge amount ............ '||
1653: InvRec.charge_amount);
1654: PJM_CONC.put_line(' Charge expenditure_type .. '||l_exp_type);
1655: PJM_CONC.put_line(' expenditure_comment ... '||
1656: InvRec.Expenditure_Comment);
1657: PJM_CONC.new_line(1);
1658:
1659:
1653: InvRec.charge_amount);
1654: PJM_CONC.put_line(' Charge expenditure_type .. '||l_exp_type);
1655: PJM_CONC.put_line(' expenditure_comment ... '||
1656: InvRec.Expenditure_Comment);
1657: PJM_CONC.new_line(1);
1658:
1659:
1660: /* Bug 13853188 The expenditure organization is not active */
1661: Begin
1670: AND BD.department_id = WO.department_id
1671: AND BD.organization_id = WO.organization_id
1672: AND pod.po_distribution_id = InvRec.PO_Distribution_Id;
1673:
1674: PJM_CONC.put_line('pa_expenditure_org_id .....'||l_exp_org_id);
1675: PJM_CONC.put_line('pa_expenditure_org_id .....'||InvRec.PO_Distribution_Id);
1676:
1677: EXCEPTION
1678: when others then
1671: AND BD.organization_id = WO.organization_id
1672: AND pod.po_distribution_id = InvRec.PO_Distribution_Id;
1673:
1674: PJM_CONC.put_line('pa_expenditure_org_id .....'||l_exp_org_id);
1675: PJM_CONC.put_line('pa_expenditure_org_id .....'||InvRec.PO_Distribution_Id);
1676:
1677: EXCEPTION
1678: when others then
1679: PJM_CONC.put_line('Exp organization is not specified on Department. Will use the Inv organization. ');
1675: PJM_CONC.put_line('pa_expenditure_org_id .....'||InvRec.PO_Distribution_Id);
1676:
1677: EXCEPTION
1678: when others then
1679: PJM_CONC.put_line('Exp organization is not specified on Department. Will use the Inv organization. ');
1680: END;
1681: /* Bug Fix ends Bug 13853188 The expenditure organization is not active */
1682:
1683:
1736: -- Insert into PA_TRANSACTION_INTERFACES table
1737: ----------------------------------------------------------------------
1738:
1739: fnd_message.set_name('PJM','CONC-APINV Insert');
1740: PJM_CONC.put_line('... ' || fnd_message.get);
1741:
1742: if not ( InvRec.Dist_Code_Combination_Id is not null AND
1743: nvl(nvl(InvRec.Base_Charge_Amount,
1744: InvRec.Charge_Amount) , 0) <> 0 ) then
1742: if not ( InvRec.Dist_Code_Combination_Id is not null AND
1743: nvl(nvl(InvRec.Base_Charge_Amount,
1744: InvRec.Charge_Amount) , 0) <> 0 ) then
1745:
1746: PJM_CONC.put_line('...... Charge amount not available, skipping...');
1747: -- Mark skipped record to 'G'
1748: UPDATE AP_Invoice_Distributions_all
1749: SET pa_addition_flag = 'G'
1750: WHERE invoice_distribution_id = ( select nvl(related_id, charge_applicable_to_dist_id)
1753: and Invoice_Distribution_Id = InvRec.Invoice_Distribution_Id);
1754:
1755: elsif ( l_Exp_Type is null) then
1756:
1757: PJM_CONC.put_line('...... Inv Org not setup to transfer charges, skipping...');
1758: -- Mark skipped record to 'G'
1759: UPDATE AP_Invoice_Distributions_all
1760: SET pa_addition_flag = 'G'
1761: WHERE invoice_distribution_id = ( select nvl(related_id, charge_applicable_to_dist_id)
1863: select next_day( trunc(InvRec.Expenditure_Item_Date)-1, l_week_ending_day )
1864: into l_week_ending
1865: from dual;
1866:
1867: PJM_CONC.put_line('...... Processing IPV, ERV, Tax Variances');
1868:
1869: -- Insert for Charges
1870: INSERT INTO pa_transaction_interface_all
1871: (transaction_source,
1961: -- Update pa_addition_flag to 'Y' for successful invoice distributions
1962: ----------------------------------------------------------------------
1963:
1964: fnd_message.set_name('PJM','CONC-APINV Flag Comp');
1965: PJM_CONC.put_line('... ' || fnd_message.get);
1966: PJM_CONC.new_line(1);
1967:
1968: l_progress := 160;
1969:
1962: ----------------------------------------------------------------------
1963:
1964: fnd_message.set_name('PJM','CONC-APINV Flag Comp');
1965: PJM_CONC.put_line('... ' || fnd_message.get);
1966: PJM_CONC.new_line(1);
1967:
1968: l_progress := 160;
1969:
1970: UPDATE AP_Invoice_Distributions_all
2018: , PoRec.Destination_Type_Code
2019: , InvRec.Project_Id );
2020: END IF;
2021:
2022: PJM_CONC.put_line(' invoice_id ............ '||InvRec.Invoice_Id);
2023: PJM_CONC.put_line(' line_num .............. '||
2024: InvRec.Invoice_Distribution_Id);
2025: PJM_CONC.put_line(' project_id ............ '||InvRec.Project_ID);
2026: PJM_CONC.put_line(' task_id ............... '||l_Task_Id);
2019: , InvRec.Project_Id );
2020: END IF;
2021:
2022: PJM_CONC.put_line(' invoice_id ............ '||InvRec.Invoice_Id);
2023: PJM_CONC.put_line(' line_num .............. '||
2024: InvRec.Invoice_Distribution_Id);
2025: PJM_CONC.put_line(' project_id ............ '||InvRec.Project_ID);
2026: PJM_CONC.put_line(' task_id ............... '||l_Task_Id);
2027: PJM_CONC.put_line(' expenditure_org_id .... '||
2021:
2022: PJM_CONC.put_line(' invoice_id ............ '||InvRec.Invoice_Id);
2023: PJM_CONC.put_line(' line_num .............. '||
2024: InvRec.Invoice_Distribution_Id);
2025: PJM_CONC.put_line(' project_id ............ '||InvRec.Project_ID);
2026: PJM_CONC.put_line(' task_id ............... '||l_Task_Id);
2027: PJM_CONC.put_line(' expenditure_org_id .... '||
2028: InvRec.Expenditure_Organization_ID);
2029:
2022: PJM_CONC.put_line(' invoice_id ............ '||InvRec.Invoice_Id);
2023: PJM_CONC.put_line(' line_num .............. '||
2024: InvRec.Invoice_Distribution_Id);
2025: PJM_CONC.put_line(' project_id ............ '||InvRec.Project_ID);
2026: PJM_CONC.put_line(' task_id ............... '||l_Task_Id);
2027: PJM_CONC.put_line(' expenditure_org_id .... '||
2028: InvRec.Expenditure_Organization_ID);
2029:
2030: Timestamp;
2023: PJM_CONC.put_line(' line_num .............. '||
2024: InvRec.Invoice_Distribution_Id);
2025: PJM_CONC.put_line(' project_id ............ '||InvRec.Project_ID);
2026: PJM_CONC.put_line(' task_id ............... '||l_Task_Id);
2027: PJM_CONC.put_line(' expenditure_org_id .... '||
2028: InvRec.Expenditure_Organization_ID);
2029:
2030: Timestamp;
2031:
2059: when others then
2060: NULL;
2061: END;
2062: END IF;
2063: PJM_CONC.put_line('Category id for Direct item'||l_po_category_id);
2064:
2065: IF l_po_category_id is not NULL then
2066: l_exp_type := get_ExpType_for_DirectItem(InvRec.Invoice_Id,l_po_category_id);
2067: PJM_CONC.put_line('Exp type for Direct item'||l_exp_type);
2063: PJM_CONC.put_line('Category id for Direct item'||l_po_category_id);
2064:
2065: IF l_po_category_id is not NULL then
2066: l_exp_type := get_ExpType_for_DirectItem(InvRec.Invoice_Id,l_po_category_id);
2067: PJM_CONC.put_line('Exp type for Direct item'||l_exp_type);
2068: END IF;
2069: END IF;
2070: --- bug fix 12835119(FP of 7372638)
2071:
2076: , invrec.project_id
2077: , invrec.expenditure_organization_id );
2078: END IF; --- bug fix 12835119(FP of 7372638)
2079:
2080: PJM_CONC.put_line(' Invoice line type is .. '||invrec.line_type_lookup_code);
2081: PJM_CONC.put_line(' Charge amount ............ '||
2082: InvRec.charge_amount);
2083: PJM_CONC.put_line(' Charge expenditure_type .. '||l_exp_type);
2084: PJM_CONC.put_line(' expenditure_comment ... '||
2077: , invrec.expenditure_organization_id );
2078: END IF; --- bug fix 12835119(FP of 7372638)
2079:
2080: PJM_CONC.put_line(' Invoice line type is .. '||invrec.line_type_lookup_code);
2081: PJM_CONC.put_line(' Charge amount ............ '||
2082: InvRec.charge_amount);
2083: PJM_CONC.put_line(' Charge expenditure_type .. '||l_exp_type);
2084: PJM_CONC.put_line(' expenditure_comment ... '||
2085: InvRec.Expenditure_Comment);
2079:
2080: PJM_CONC.put_line(' Invoice line type is .. '||invrec.line_type_lookup_code);
2081: PJM_CONC.put_line(' Charge amount ............ '||
2082: InvRec.charge_amount);
2083: PJM_CONC.put_line(' Charge expenditure_type .. '||l_exp_type);
2084: PJM_CONC.put_line(' expenditure_comment ... '||
2085: InvRec.Expenditure_Comment);
2086: PJM_CONC.new_line(1);
2087:
2080: PJM_CONC.put_line(' Invoice line type is .. '||invrec.line_type_lookup_code);
2081: PJM_CONC.put_line(' Charge amount ............ '||
2082: InvRec.charge_amount);
2083: PJM_CONC.put_line(' Charge expenditure_type .. '||l_exp_type);
2084: PJM_CONC.put_line(' expenditure_comment ... '||
2085: InvRec.Expenditure_Comment);
2086: PJM_CONC.new_line(1);
2087:
2088: /* Bug 13853188 The expenditure organization is not active */
2082: InvRec.charge_amount);
2083: PJM_CONC.put_line(' Charge expenditure_type .. '||l_exp_type);
2084: PJM_CONC.put_line(' expenditure_comment ... '||
2085: InvRec.Expenditure_Comment);
2086: PJM_CONC.new_line(1);
2087:
2088: /* Bug 13853188 The expenditure organization is not active */
2089: Begin
2090: SELECT BD.pa_expenditure_org_id
2098: AND BD.department_id = WO.department_id
2099: AND BD.organization_id = WO.organization_id
2100: AND pod.po_distribution_id = InvRec.PO_Distribution_Id;
2101:
2102: PJM_CONC.put_line('pa_expenditure_org_id .....'||l_exp_org_id);
2103: PJM_CONC.put_line('pa_expenditure_org_id .....'||InvRec.PO_Distribution_Id);
2104:
2105: EXCEPTION
2106: when others then
2099: AND BD.organization_id = WO.organization_id
2100: AND pod.po_distribution_id = InvRec.PO_Distribution_Id;
2101:
2102: PJM_CONC.put_line('pa_expenditure_org_id .....'||l_exp_org_id);
2103: PJM_CONC.put_line('pa_expenditure_org_id .....'||InvRec.PO_Distribution_Id);
2104:
2105: EXCEPTION
2106: when others then
2107: PJM_CONC.put_line('Exp organization is not specified on Department. Will use the Inv organization. ');
2103: PJM_CONC.put_line('pa_expenditure_org_id .....'||InvRec.PO_Distribution_Id);
2104:
2105: EXCEPTION
2106: when others then
2107: PJM_CONC.put_line('Exp organization is not specified on Department. Will use the Inv organization. ');
2108: END;
2109: /* Bug Fix ends Bug 13853188 The expenditure organization is not active */
2110:
2111: ---------------------------------------------------------------------
2164: -- Insert into PA_TRANSACTION_INTERFACES table
2165: ----------------------------------------------------------------------
2166:
2167: fnd_message.set_name('PJM','CONC-APINV Insert');
2168: PJM_CONC.put_line('... ' || fnd_message.get);
2169:
2170: if not ( InvRec.Dist_Code_Combination_Id is not null AND
2171: nvl(nvl(InvRec.Base_Charge_Amount,
2172: InvRec.Charge_Amount) , 0) <> 0 ) then
2170: if not ( InvRec.Dist_Code_Combination_Id is not null AND
2171: nvl(nvl(InvRec.Base_Charge_Amount,
2172: InvRec.Charge_Amount) , 0) <> 0 ) then
2173:
2174: PJM_CONC.put_line('...... Charge amount not available, skipping...');
2175: -- Mark skipped record to 'G'
2176: UPDATE AP_Invoice_Distributions_all
2177: SET pa_addition_flag = 'G'
2178: WHERE invoice_distribution_id = ( select nvl(related_id, charge_applicable_to_dist_id)
2181: and Invoice_Distribution_Id = InvRec.Invoice_Distribution_Id);
2182:
2183: elsif ( l_Exp_Type is null) then
2184:
2185: PJM_CONC.put_line('...... Inv Org not setup to transfer charges, skipping...');
2186: -- Mark skipped record to 'G'
2187: UPDATE AP_Invoice_Distributions_all
2188: SET pa_addition_flag = 'G'
2189: WHERE invoice_distribution_id = ( select nvl(related_id, charge_applicable_to_dist_id)
2292: select next_day( trunc(InvRec.Expenditure_Item_Date)-1, l_week_ending_day )
2293: into l_week_ending
2294: from dual;
2295:
2296: PJM_CONC.put_line('...... Processing Special Charges');
2297:
2298: -- Insert for Charges
2299: INSERT INTO pa_transaction_interface_all
2300: (transaction_source,
2390: -- Update pa_addition_flag to 'Y' for successful invoice distributions
2391: ----------------------------------------------------------------------
2392:
2393: fnd_message.set_name('PJM','CONC-APINV Flag Comp');
2394: PJM_CONC.put_line('... ' || fnd_message.get);
2395: PJM_CONC.new_line(1);
2396:
2397: l_progress := 168;
2398:
2391: ----------------------------------------------------------------------
2392:
2393: fnd_message.set_name('PJM','CONC-APINV Flag Comp');
2394: PJM_CONC.put_line('... ' || fnd_message.get);
2395: PJM_CONC.new_line(1);
2396:
2397: l_progress := 168;
2398:
2399: UPDATE AP_Invoice_Distributions_all
2419: END IF; -- End of both with project specified or without conditions
2420:
2421: COMMIT;
2422: fnd_message.set_name('PJM','CONC-APINV Finish Loop');
2423: PJM_CONC.put_line(fnd_message.get || ' ...');
2424: PJM_CONC.new_line(1);
2425:
2426: Timestamp;
2427:
2420:
2421: COMMIT;
2422: fnd_message.set_name('PJM','CONC-APINV Finish Loop');
2423: PJM_CONC.put_line(fnd_message.get || ' ...');
2424: PJM_CONC.new_line(1);
2425:
2426: Timestamp;
2427:
2428: l_progress := 169;
2434: l_transaction_source,
2435: l_Batch_Name);
2436: end if;
2437:
2438: retcode := PJM_CONC.G_conc_success;
2439: return;
2440:
2441:
2442: EXCEPTION
2441:
2442: EXCEPTION
2443: when OTHERS then
2444: errbuf := 'IPV-'||l_progress||': '||sqlerrm;
2445: retcode := PJM_CONC.G_conc_failure;
2446: return;
2447:
2448: END Transfer_Charges_TO_PA;
2449:
2455: l_expenditure_type VARCHAR2(30);
2456: l_invoice_date DATE;
2457:
2458: BEGIN
2459: PJM_CONC.put_line('Get ExpType for DirectItem');
2460: -------------------------
2461: -- Obtain Invoice_date
2462: -------------------------
2463: select invoice_date
2481:
2482: return l_expenditure_type;
2483: EXCEPTION
2484: WHEN No_Data_Found THEN
2485: PJM_CONC.put_line('Purchase category association is either not defined or inactive');
2486: RETURN NULL;
2487: when OTHERS then
2488: NULL;
2489: RETURN NULL;