501: l_state_level NUMBER;
502:
503: BEGIN
504:
505: IF (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
506: FND_LOG.string(FND_LOG.LEVEL_PROCEDURE
507: , G_MODULE_HEAD || l_routine || '.begin'
508: , l_routine || '<'
509: );
502:
503: BEGIN
504:
505: IF (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
506: FND_LOG.string(FND_LOG.LEVEL_PROCEDURE
507: , G_MODULE_HEAD || l_routine || '.begin'
508: , l_routine || '<'
509: );
510: END IF;
508: , l_routine || '<'
509: );
510: END IF;
511:
512: IF (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
513: FND_LOG.string(FND_LOG.LEVEL_STATEMENT
514: , G_MODULE_HEAD || l_routine || '.acctpd'
515: , 'Account Period Id:' || p_acct_period_id
516: );
509: );
510: END IF;
511:
512: IF (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
513: FND_LOG.string(FND_LOG.LEVEL_STATEMENT
514: , G_MODULE_HEAD || l_routine || '.acctpd'
515: , 'Account Period Id:' || p_acct_period_id
516: );
517: END IF;
518:
519: l_txn_init_qty := p_item_init_qty - p_offset_qty;
520: l_txn_init_infl := p_item_init_infl;
521:
522: IF (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
523: FND_LOG.string(FND_LOG.LEVEL_STATEMENT
524: , G_MODULE_HEAD || l_routine || '.txniniinfl'
525: , 'Txn initial inflation:' || l_txn_init_infl ||
526: ' ' || 'Txn initial inflation cost:' || p_item_unit_infl_adj
519: l_txn_init_qty := p_item_init_qty - p_offset_qty;
520: l_txn_init_infl := p_item_init_infl;
521:
522: IF (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
523: FND_LOG.string(FND_LOG.LEVEL_STATEMENT
524: , G_MODULE_HEAD || l_routine || '.txniniinfl'
525: , 'Txn initial inflation:' || l_txn_init_infl ||
526: ' ' || 'Txn initial inflation cost:' || p_item_unit_infl_adj
527: );
527: );
528: END IF;
529:
530: -- Assign local debug variables to use within loop
531: l_debug_level := FND_LOG.G_CURRENT_RUNTIME_LEVEL;
532: l_state_level := FND_LOG.LEVEL_STATEMENT;
533:
534: FOR l_item_txn_info IN l_item_txn_csr
535: LOOP
528: END IF;
529:
530: -- Assign local debug variables to use within loop
531: l_debug_level := FND_LOG.G_CURRENT_RUNTIME_LEVEL;
532: l_state_level := FND_LOG.LEVEL_STATEMENT;
533:
534: FOR l_item_txn_info IN l_item_txn_csr
535: LOOP
536:
682: l_txn_init_qty := l_rpt_item_tbl_rec(l_index).txn_fnl_qty;
683: l_txn_init_infl := l_rpt_item_tbl_rec(l_index).txn_fnl_adj_total_cost;
684:
685: IF (l_state_level >= l_debug_level) THEN
686: FND_LOG.string(l_state_level
687: , G_MODULE_HEAD || l_routine || '.itemtxninfo'
688: , '*** Item Txn Info *** '
689: );
690:
687: , G_MODULE_HEAD || l_routine || '.itemtxninfo'
688: , '*** Item Txn Info *** '
689: );
690:
691: FND_LOG.string(l_state_level
692: , G_MODULE_HEAD || l_routine || '.itemtxndate'
693: , 'Item Id:' || l_rpt_item_tbl_rec(l_index).inventory_item_id
694: || ' Transaction Date:' || l_rpt_item_tbl_rec(l_index).txn_date
695: );
693: , 'Item Id:' || l_rpt_item_tbl_rec(l_index).inventory_item_id
694: || ' Transaction Date:' || l_rpt_item_tbl_rec(l_index).txn_date
695: );
696:
697: FND_LOG.string(l_state_level
698: , G_MODULE_HEAD || l_routine || '.inicostdtls1'
699: , 'Initial cost details:' || 'initial qty:'
700: || l_rpt_item_tbl_rec(l_index).txn_ini_qty || ' '
701: || 'unit cost:'
701: || 'unit cost:'
702: || l_rpt_item_tbl_rec(l_index).txn_ini_unit_cost
703: );
704:
705: FND_LOG.string(l_state_level
706: , G_MODULE_HEAD || l_routine || '.inicostdtls2'
707: , 'historical total cost:' || l_rpt_item_tbl_rec(l_index).txn_ini_h_total_cost || ' ' || 'adj total cost:' || l_rpt_item_tbl_rec(l_index).txn_ini_adj_total_cost
708: );
709:
706: , G_MODULE_HEAD || l_routine || '.inicostdtls2'
707: , 'historical total cost:' || l_rpt_item_tbl_rec(l_index).txn_ini_h_total_cost || ' ' || 'adj total cost:' || l_rpt_item_tbl_rec(l_index).txn_ini_adj_total_cost
708: );
709:
710: FND_LOG.string(l_state_level
711: , G_MODULE_HEAD || l_routine || '.txncostdtls1'
712: , 'Transaction cost details:' || 'trn qty:' || l_rpt_item_tbl_rec(l_index).txn_qty || ' ' || 'unit cost:' || l_rpt_item_tbl_rec(l_index).txn_unit_cost
713: );
714:
711: , G_MODULE_HEAD || l_routine || '.txncostdtls1'
712: , 'Transaction cost details:' || 'trn qty:' || l_rpt_item_tbl_rec(l_index).txn_qty || ' ' || 'unit cost:' || l_rpt_item_tbl_rec(l_index).txn_unit_cost
713: );
714:
715: FND_LOG.string(l_state_level
716: , G_MODULE_HEAD || l_routine || '.txncostdtls2'
717: , 'historical total cost:' || l_rpt_item_tbl_rec(l_index).txn_h_total_cost || ' ' || 'adj total cost:' || l_rpt_item_tbl_rec(l_index).txn_adj_total_cost
718: );
719:
716: , G_MODULE_HEAD || l_routine || '.txncostdtls2'
717: , 'historical total cost:' || l_rpt_item_tbl_rec(l_index).txn_h_total_cost || ' ' || 'adj total cost:' || l_rpt_item_tbl_rec(l_index).txn_adj_total_cost
718: );
719:
720: FND_LOG.string(l_state_level
721: , G_MODULE_HEAD || l_routine || '.fnlcostdtls1'
722: , 'Final cost details:' || 'final qty:' || l_rpt_item_tbl_rec(l_index).txn_fnl_qty || ' ' || 'unit cost:' || l_rpt_item_tbl_rec(l_index).txn_fnl_unit_cost
723: );
724:
721: , G_MODULE_HEAD || l_routine || '.fnlcostdtls1'
722: , 'Final cost details:' || 'final qty:' || l_rpt_item_tbl_rec(l_index).txn_fnl_qty || ' ' || 'unit cost:' || l_rpt_item_tbl_rec(l_index).txn_fnl_unit_cost
723: );
724:
725: FND_LOG.string(l_state_level
726: , G_MODULE_HEAD || l_routine || '.fnlcostdtls2'
727: , 'historical total cost:' || l_rpt_item_tbl_rec(l_index).txn_fnl_h_total_cost || ' ' || 'adj total cost:' || l_rpt_item_tbl_rec(l_index).txn_fnl_adj_total_cost
728: );
729:
753: END IF;
754:
755: x_rpt_item_tbl_rec := l_rpt_item_tbl_rec;
756:
757: IF (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
758: FND_LOG.string(FND_LOG.LEVEL_PROCEDURE
759: ,G_MODULE_HEAD || l_routine || '.end'
760: ,l_routine || '>'
761: );
754:
755: x_rpt_item_tbl_rec := l_rpt_item_tbl_rec;
756:
757: IF (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
758: FND_LOG.string(FND_LOG.LEVEL_PROCEDURE
759: ,G_MODULE_HEAD || l_routine || '.end'
760: ,l_routine || '>'
761: );
762: END IF;
905: AND PER.PERIOD_CLOSE_DATE IS NOT NULL
906: ORDER BY INFL.Acct_Period_ID;
907: BEGIN
908:
909: IF (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
910: FND_LOG.string(FND_LOG.LEVEL_PROCEDURE
911: ,G_MODULE_HEAD || l_routine || '.begin'
912: , l_routine || '<'
913: );
906: ORDER BY INFL.Acct_Period_ID;
907: BEGIN
908:
909: IF (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
910: FND_LOG.string(FND_LOG.LEVEL_PROCEDURE
911: ,G_MODULE_HEAD || l_routine || '.begin'
912: , l_routine || '<'
913: );
914: END IF;
924: -- used to get the accounting periods
925: l_date_from := FND_DATE.canonical_to_date(p_rpt_from_date);
926: l_date_to := FND_DATE.canonical_to_date(p_rpt_to_date);
927:
928: IF (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
929: FND_LOG.string(FND_LOG.LEVEL_STATEMENT
930: ,G_MODULE_HEAD || l_routine || '.rptdatefrom'
931: ,'Canonical Date From:' || l_rpt_date_from
932: );
925: l_date_from := FND_DATE.canonical_to_date(p_rpt_from_date);
926: l_date_to := FND_DATE.canonical_to_date(p_rpt_to_date);
927:
928: IF (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
929: FND_LOG.string(FND_LOG.LEVEL_STATEMENT
930: ,G_MODULE_HEAD || l_routine || '.rptdatefrom'
931: ,'Canonical Date From:' || l_rpt_date_from
932: );
933:
930: ,G_MODULE_HEAD || l_routine || '.rptdatefrom'
931: ,'Canonical Date From:' || l_rpt_date_from
932: );
933:
934: FND_LOG.string(FND_LOG.LEVEL_STATEMENT
935: ,G_MODULE_HEAD || l_routine || '.rptdateto'
936: ,'Canonical Date To:' || l_rpt_date_to
937: );
938:
935: ,G_MODULE_HEAD || l_routine || '.rptdateto'
936: ,'Canonical Date To:' || l_rpt_date_to
937: );
938:
939: FND_LOG.string(FND_LOG.LEVEL_STATEMENT
940: ,G_MODULE_HEAD || l_routine || '.acctpdfrom'
941: ,'Accounting Period Date From:' || l_date_from
942: );
943:
940: ,G_MODULE_HEAD || l_routine || '.acctpdfrom'
941: ,'Accounting Period Date From:' || l_date_from
942: );
943:
944: FND_LOG.string(FND_LOG.LEVEL_STATEMENT
945: ,G_MODULE_HEAD || l_routine || '.acctpdto'
946: ,'Accounting Period Date To:' || l_date_to
947: );
948:
957: , x_rpt_from_acct_per_id => l_rpt_from_acct_per_id
958: , x_rpt_to_acct_per_id => l_rpt_to_acct_per_id
959: );
960:
961: IF (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
962: FND_LOG.string(FND_LOG.LEVEL_STATEMENT
963: ,G_MODULE_HEAD || l_routine || '.rptacctpd'
964: ,'Report from Acct period id:' || l_rpt_from_acct_per_id ||
965: ' ' || 'Report to Acct period id:' || l_rpt_to_acct_per_id
958: , x_rpt_to_acct_per_id => l_rpt_to_acct_per_id
959: );
960:
961: IF (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
962: FND_LOG.string(FND_LOG.LEVEL_STATEMENT
963: ,G_MODULE_HEAD || l_routine || '.rptacctpd'
964: ,'Report from Acct period id:' || l_rpt_from_acct_per_id ||
965: ' ' || 'Report to Acct period id:' || l_rpt_to_acct_per_id
966: );
1057: ELSE
1058: l_offset_qty := 0;
1059: END IF;
1060:
1061: IF (FND_LOG.LEVEL_EVENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
1062: FND_LOG.string(FND_LOG.LEVEL_EVENT
1063: ,G_MODULE_HEAD || l_routine || '.offsetqty'
1064: ,'Offset Qty:' || l_offset_qty
1065: );
1058: l_offset_qty := 0;
1059: END IF;
1060:
1061: IF (FND_LOG.LEVEL_EVENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
1062: FND_LOG.string(FND_LOG.LEVEL_EVENT
1063: ,G_MODULE_HEAD || l_routine || '.offsetqty'
1064: ,'Offset Qty:' || l_offset_qty
1065: );
1066: END IF;
1073: , p_cost_group_id => l_cost_group_id
1074: , x_period_end_item_avg_cost => l_item_unit_cost
1075: );
1076:
1077: IF (FND_LOG.LEVEL_EVENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
1078: FND_LOG.string(FND_LOG.LEVEL_EVENT
1079: ,G_MODULE_HEAD || l_routine || '.itemunitcost'
1080: ,'Item Id:' || l_item_id || ' ' ||
1081: 'Item Unit Cost:' || l_item_unit_cost
1074: , x_period_end_item_avg_cost => l_item_unit_cost
1075: );
1076:
1077: IF (FND_LOG.LEVEL_EVENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
1078: FND_LOG.string(FND_LOG.LEVEL_EVENT
1079: ,G_MODULE_HEAD || l_routine || '.itemunitcost'
1080: ,'Item Id:' || l_item_id || ' ' ||
1081: 'Item Unit Cost:' || l_item_unit_cost
1082: );
1092:
1093: -- Schedule close date set to 23:59:59
1094: l_prev_sch_close_date := TRUNC(l_prev_sch_close_date) + (86399/86400);
1095:
1096: IF (FND_LOG.LEVEL_EVENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
1097: FND_LOG.string(FND_LOG.LEVEL_EVENT
1098: ,G_MODULE_HEAD || l_routine || '.itempdinfo'
1099: ,'Item Id:' || l_item_id || ' ' ||
1100: 'Period Start Date:' || l_period_start_date || ' ' ||
1093: -- Schedule close date set to 23:59:59
1094: l_prev_sch_close_date := TRUNC(l_prev_sch_close_date) + (86399/86400);
1095:
1096: IF (FND_LOG.LEVEL_EVENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
1097: FND_LOG.string(FND_LOG.LEVEL_EVENT
1098: ,G_MODULE_HEAD || l_routine || '.itempdinfo'
1099: ,'Item Id:' || l_item_id || ' ' ||
1100: 'Period Start Date:' || l_period_start_date || ' ' ||
1101: 'Previous Acct Period Id:' || l_prev_acct_period_id || ' ' ||
1121: ELSE
1122: l_previous_unit_cost := 0;
1123: END IF;
1124:
1125: IF (FND_LOG.LEVEL_EVENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
1126: FND_LOG.string(FND_LOG.LEVEL_EVENT
1127: ,G_MODULE_HEAD || l_routine || '.prevpdinfo'
1128: ,'Previous Qty:' || l_previous_qty || ' ' ||
1129: 'Previous Period Cost:' || l_previous_cost || ' ' ||
1122: l_previous_unit_cost := 0;
1123: END IF;
1124:
1125: IF (FND_LOG.LEVEL_EVENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
1126: FND_LOG.string(FND_LOG.LEVEL_EVENT
1127: ,G_MODULE_HEAD || l_routine || '.prevpdinfo'
1128: ,'Previous Qty:' || l_previous_qty || ' ' ||
1129: 'Previous Period Cost:' || l_previous_cost || ' ' ||
1130: 'Previous Inflation Adj:' || l_previous_inflation_adj
1186: END IF;
1187:
1188: END LOOP;
1189:
1190: IF (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
1191: FND_LOG.string(FND_LOG.LEVEL_PROCEDURE
1192: ,G_MODULE_HEAD || l_routine || '.end'
1193: ,l_routine || '>'
1194: );
1187:
1188: END LOOP;
1189:
1190: IF (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
1191: FND_LOG.string(FND_LOG.LEVEL_PROCEDURE
1192: ,G_MODULE_HEAD || l_routine || '.end'
1193: ,l_routine || '>'
1194: );
1195: END IF;