744: i_codes in codes_table )
745: is
746: i int;
747: l_score varchar2(100);
748: l_code IBY_MAPPINGS.MAPPING_CODE%TYPE;
749:
750: begin
751:
752: -- Assumption, Ranges are verified in Java Code it self.
754: -- initialize the values.
755: i := 1;
756: -- loop through the list of ranges passed and update
757: -- the database.
758: delete from iby_mappings
759: where (( payeeid = i_payeeid) or
760: ( payeeid is null and i_payeeid is null ))
761: and mapping_type = 'AVS_CODE_TYPE';
762:
766: l_code := i_codes(i).code;
767: l_score := i_codes(i).score;
768: i := i+1;
769:
770: insert into iby_mappings ( payeeid, mapping_type, mapping_code,
771: value, object_version_number,
772: last_update_date, last_updated_by, creation_date, created_by)
773: values ( i_payeeid, 'AVS_CODE_TYPE', l_code,
774: l_score,1,
820:
821:
822: cursor c_avs_codes(ci_payeeid varchar2) is
823: select mapping_code, value
824: from iby_mappings
825: where mapping_type = 'AVS_CODE_TYPE'
826: and (( payeeid is null and ci_payeeid is null ) or
827: ( payeeid = ci_payeeid));
828:
827: ( payeeid = ci_payeeid));
828:
829: cursor c_avs_codes_count(ci_payeeid varchar2) is
830: select count(*)
831: from iby_mappings
832: where mapping_type = 'AVS_CODE_TYPE'
833: and payeeid = ci_payeeid;
834:
835: begin
901: i_codes in codes_table )
902: is
903: i int;
904: l_score varchar2(100);
905: l_code IBY_MAPPINGS.MAPPING_CODE%TYPE;
906:
907: begin
908:
909: -- initialize the values.
911:
912: -- loop through the list of ranges passed and update
913: -- the database.
914: -- delete the risk scodes and then insert;
915: delete from iby_mappings
916: where (( payeeid = i_payeeid) or
917: ( payeeid is null and i_payeeid is null ))
918: and mapping_type = 'RISK_CODE_TYPE';
919:
922: l_code := i_codes(i).code;
923: l_score := i_codes(i).score;
924: i := i+1;
925:
926: insert into iby_mappings ( payeeid, mapping_type, mapping_code, value,
927: last_update_date, last_updated_by, creation_date, created_by,object_version_number)
928: values ( i_payeeid, 'RISK_CODE_TYPE', l_code, l_score,
929: sysdate, fnd_global.user_id, sysdate, fnd_global.user_id,1);
930:
970:
971:
972: cursor c_risk_codes(ci_payeeid varchar2) is
973: select mapping_code lookup_code,value
974: from iby_mappings
975: where mapping_type = 'RISK_CODE_TYPE' and
976: payeeid = ci_payeeid
977: UNION
978: select lookup_code,null
984: --security_group_id = fnd_global.lookup_security_group
985: --(lookup_type,view_application_id) and
986:
987: lookup_code not in ( select mapping_code
988: from iby_mappings
989: where mapping_type = 'RISK_CODE_TYPE' and
990: payeeid = ci_payeeid);
991:
992:
1005:
1006:
1007: cursor c_del_risk_codes is
1008: select lookup_code
1009: from iby_mappings a,
1010: fnd_lookup_values b
1011: where b.lookup_type = 'RISK_CODE' and
1012: b.enabled_flag = 'N' and
1013: b.lookup_code = a.mapping_code and
1019: --del_code c_del_risk_codes%ROWTYPE;
1020:
1021: cursor c_risk_codes_count(ci_payeeid varchar2) is
1022: select count(*)
1023: from iby_mappings
1024: where mapping_type = 'RISK_CODE_TYPE' and
1025: payeeid = ci_payeeid;
1026: begin
1027: --dbms_output.put_line(i_payeeid);
1034:
1035: for i in c_del_risk_codes
1036: loop
1037: --dbms_output.put_line('inside delete loop');
1038: delete from iby_mappings
1039: where mapping_type = 'RISK_CODE_TYPE' and
1040: mapping_code = i.lookup_code;
1041: end loop;
1042: if (l_payeeid is not null) then
1107: i_codes in codes_table )
1108: is
1109: i int;
1110: l_score varchar2(100);
1111: l_code IBY_MAPPINGS.MAPPING_CODE%TYPE;
1112:
1113: begin
1114:
1115: -- Assumption, Ranges are verified in Java Code it self.
1119:
1120: -- loop through the list of ranges passed and update
1121: -- the database.
1122: -- delete the existing config and insert new data.
1123: delete from iby_mappings
1124: where (( payeeid = i_payeeid) or
1125: ( payeeid is null and i_payeeid is null ))
1126: and mapping_type = 'CREDIT_CODE_TYPE';
1127:
1130: -- extract the values from the input and insert in database.
1131: l_code := i_codes(i).code;
1132: l_score := i_codes(i).score;
1133: i := i+1;
1134: insert into iby_mappings ( payeeid, mapping_type, mapping_code, value,
1135: last_update_date, last_updated_by, creation_date, created_by,object_version_number)
1136: values ( i_payeeid, 'CREDIT_CODE_TYPE', l_code, l_score,
1137: sysdate, fnd_global.user_id, sysdate, fnd_global.user_id,1);
1138:
1178:
1179:
1180: cursor c_creditrating_codes(ci_payeeid varchar2) is
1181: select mapping_code lookup_code,value
1182: from iby_mappings
1183: where mapping_type = 'CREDIT_CODE_TYPE' and
1184: payeeid = ci_payeeid
1185: UNION
1186: select lookup_code,null
1192: --security_group_id = fnd_global.lookup_security_group
1193: --(lookup_type,view_application_id) and
1194:
1195: lookup_code not in ( select mapping_code
1196: from iby_mappings
1197: where mapping_type = 'CREDIT_CODE_TYPE' and
1198: payeeid = ci_payeeid);
1199:
1200:
1211: --(lookup_type,view_application_id);
1212:
1213: cursor c_del_creditrating_codes is
1214: select lookup_code
1215: from iby_mappings a,
1216: fnd_lookup_values b
1217: where b.lookup_type = 'CREDIT_RATING' and
1218: b.enabled_flag = 'N' and
1219: b.lookup_code = a.mapping_code and
1224:
1225:
1226: cursor c_creditrating_codes_count(ci_payeeid varchar2) is
1227: select count(*)
1228: from iby_mappings
1229: where mapping_type = 'CREDIT_CODE_TYPE' and
1230: payeeid = ci_payeeid;
1231:
1232: begin
1237: end if;
1238:
1239: for i in c_del_creditrating_codes
1240: loop
1241: delete from iby_mappings
1242: where mapping_type = 'CREDIT_CODE_TYPE' and
1243: mapping_code = i.lookup_code;
1244: end loop;
1245: if (l_payeeid is not null) then
1455: is
1456: begin
1457:
1458: -- update the risk scores based on the payeeid.
1459: update iby_mappings
1460: set value = i_lowVal,
1461: last_update_date = sysdate,
1462: last_updated_by = fnd_global.user_id
1463: where mapping_code = 'L'
1467:
1468: -- if count is zero then insert new rows for all the scores.
1469: -- otherwise update the other risk Score rows.
1470: if ( SQL%ROWCOUNT = 0 ) then
1471: insert into iby_mappings( value, mapping_code, mapping_type, payeeid,
1472: last_update_date, last_updated_by, creation_date, created_by, object_version_number)
1473: values( 0, 'S', 'IBY_RISK_SCORE_TYPE', i_payeeid,
1474: sysdate, fnd_global.user_id, sysdate, fnd_global.user_id, 1);
1475:
1472: last_update_date, last_updated_by, creation_date, created_by, object_version_number)
1473: values( 0, 'S', 'IBY_RISK_SCORE_TYPE', i_payeeid,
1474: sysdate, fnd_global.user_id, sysdate, fnd_global.user_id, 1);
1475:
1476: insert into iby_mappings( value, mapping_code, mapping_type, payeeid,
1477: last_update_date, last_updated_by, creation_date, created_by, object_version_number)
1478: values( 0, 'NR', 'IBY_RISK_SCORE_TYPE', i_payeeid,
1479: sysdate, fnd_global.user_id, sysdate, fnd_global.user_id, 1);
1480:
1477: last_update_date, last_updated_by, creation_date, created_by, object_version_number)
1478: values( 0, 'NR', 'IBY_RISK_SCORE_TYPE', i_payeeid,
1479: sysdate, fnd_global.user_id, sysdate, fnd_global.user_id, 1);
1480:
1481: insert into iby_mappings( value, mapping_code, mapping_type, payeeid,
1482: last_update_date, last_updated_by, creation_date, created_by, object_version_number)
1483: values( i_lowVal, 'L', 'IBY_RISK_SCORE_TYPE', i_payeeid,
1484: sysdate, fnd_global.user_id, sysdate, fnd_global.user_id, 1);
1485:
1482: last_update_date, last_updated_by, creation_date, created_by, object_version_number)
1483: values( i_lowVal, 'L', 'IBY_RISK_SCORE_TYPE', i_payeeid,
1484: sysdate, fnd_global.user_id, sysdate, fnd_global.user_id, 1);
1485:
1486: insert into iby_mappings( value, mapping_code, mapping_type, payeeid,
1487: last_update_date, last_updated_by, creation_date, created_by, object_version_number)
1488: values( i_lowMedVal, 'LM', 'IBY_RISK_SCORE_TYPE', i_payeeid,
1489: sysdate, fnd_global.user_id, sysdate, fnd_global.user_id, 1);
1490:
1487: last_update_date, last_updated_by, creation_date, created_by, object_version_number)
1488: values( i_lowMedVal, 'LM', 'IBY_RISK_SCORE_TYPE', i_payeeid,
1489: sysdate, fnd_global.user_id, sysdate, fnd_global.user_id, 1);
1490:
1491: insert into iby_mappings( value, mapping_code, mapping_type, payeeid,
1492: last_update_date, last_updated_by, creation_date, created_by, object_version_number)
1493: values( i_medVal, 'M', 'IBY_RISK_SCORE_TYPE', i_payeeid,
1494: sysdate, fnd_global.user_id, sysdate, fnd_global.user_id, 1);
1495:
1492: last_update_date, last_updated_by, creation_date, created_by, object_version_number)
1493: values( i_medVal, 'M', 'IBY_RISK_SCORE_TYPE', i_payeeid,
1494: sysdate, fnd_global.user_id, sysdate, fnd_global.user_id, 1);
1495:
1496: insert into iby_mappings( value, mapping_code, mapping_type, payeeid,
1497: last_update_date, last_updated_by, creation_date, created_by, object_version_number)
1498: values( i_medHighVal, 'MH', 'IBY_RISK_SCORE_TYPE', i_payeeid,
1499: sysdate, fnd_global.user_id, sysdate, fnd_global.user_id, 1);
1500:
1497: last_update_date, last_updated_by, creation_date, created_by, object_version_number)
1498: values( i_medHighVal, 'MH', 'IBY_RISK_SCORE_TYPE', i_payeeid,
1499: sysdate, fnd_global.user_id, sysdate, fnd_global.user_id, 1);
1500:
1501: insert into iby_mappings( value, mapping_code, mapping_type, payeeid,
1502: last_update_date, last_updated_by, creation_date, created_by, object_version_number)
1503: values( i_highVal, 'H', 'IBY_RISK_SCORE_TYPE', i_payeeid,
1504: sysdate, fnd_global.user_id, sysdate, fnd_global.user_id, 1);
1505: else
1503: values( i_highVal, 'H', 'IBY_RISK_SCORE_TYPE', i_payeeid,
1504: sysdate, fnd_global.user_id, sysdate, fnd_global.user_id, 1);
1505: else
1506:
1507: update iby_mappings
1508: set value = i_lowMedVal,
1509: last_update_date = sysdate,
1510: last_updated_by = fnd_global.user_id
1511: where mapping_code = 'LM'
1512: and mapping_type = 'IBY_RISK_SCORE_TYPE'
1513: and (( payeeid is null and i_payeeid is null ) or
1514: (payeeid = i_payeeid) );
1515:
1516: update iby_mappings
1517: set value = i_medVal,
1518: last_update_date = sysdate,
1519: last_updated_by = fnd_global.user_id
1520: where mapping_code = 'M'
1521: and mapping_type = 'IBY_RISK_SCORE_TYPE'
1522: and (( payeeid is null and i_payeeid is null ) or
1523: (payeeid = i_payeeid) );
1524:
1525: update iby_mappings
1526: set value = i_medHighVal,
1527: last_update_date = sysdate,
1528: last_updated_by = fnd_global.user_id
1529: where mapping_code = 'MH'
1530: and mapping_type = 'IBY_RISK_SCORE_TYPE'
1531: and (( payeeid is null and i_payeeid is null ) or
1532: (payeeid = i_payeeid) );
1533:
1534: update iby_mappings
1535: set value = i_highVal,
1536: last_update_date = sysdate,
1537: last_updated_by = fnd_global.user_id
1538: where mapping_code = 'H'
1564:
1565: l_payeeid varchar2(80);
1566: l_cnt integer;
1567:
1568: cursor c_insert_scores( ci_code in iby_mappings.mapping_code%type,
1569: ci_payeeid varchar2)
1570: is
1571: select value
1572: from iby_mappings
1568: cursor c_insert_scores( ci_code in iby_mappings.mapping_code%type,
1569: ci_payeeid varchar2)
1570: is
1571: select value
1572: from iby_mappings
1573: where mapping_code = ci_code
1574: and mapping_type = 'IBY_RISK_SCORE_TYPE'
1575: and (( payeeid is null and ci_payeeid is null ) or
1576: ( payeeid = ci_payeeid));
1577:
1578: cursor c_payee_scores_count(ci_payeeid varchar2)
1579: is
1580: select count(*)
1581: from iby_mappings
1582: where mapping_type = 'IBY_RISK_SCORE_TYPE'
1583: and payeeid = ci_payeeid;
1584:
1585: begin