108: cst_cost_group_assignments ccga
109: WHERE ccg.cost_group_id = ccga.cost_group_id
110: AND ccg.cost_group_type = 2
111: AND ccg.cost_group = ( SELECT cpici.cost_group
112: FROM cst_pc_item_cost_interface cpici
113: WHERE cpici.interface_header_id = x_interface_header_id);
114:
115:
116: l_stmt_num := 2;
114:
115:
116: l_stmt_num := 2;
117:
118: UPDATE cst_pc_item_cost_interface cpici
119: SET cpici.cost_group_id = x_cost_group_id
120: WHERE cpici.interface_header_id = x_interface_header_id;
121:
122: COMMIT;
166: cst_le_cost_types clct
167: WHERE cct.cost_type_id = clct.cost_type_id
168: AND clct.legal_entity = x_legal_entity
169: AND cct.cost_type = ( SELECT cpici.cost_type
170: FROM cst_pc_item_cost_interface cpici
171: WHERE cpici.interface_header_id = x_interface_header_id );
172:
173:
174:
209: SELECT cpp.pac_period_id
210: INTO x_pac_period_id
211: FROM cst_pac_periods cpp
212: WHERE cpp.period_name = ( SELECT cpici.period_name
213: FROM cst_pc_item_cost_interface cpici
214: WHERE cpici.interface_header_id = x_interface_header_id )
215: AND cpp.pac_period_id =( SELECT MAX(cpp1.pac_period_id )
216: FROM cst_pac_periods cpp1
217: WHERE cpp1.legal_entity = x_legal_entity
219:
220:
221: l_stmt_num := 2;
222:
223: UPDATE cst_pc_item_cost_interface cpici
224: SET cpici.pac_period_id = x_pac_period_id
225: WHERE cpici.interface_header_id = x_interface_header_id;
226:
227:
267: cst_cost_group_assignments ccga
268: WHERE msi.organization_id = ccga.organization_id
269: AND ccga.cost_group_id = x_cost_group_id
270: AND msi.inventory_item_id = ( SELECT cpici.inventory_item_id
271: FROM cst_pc_item_cost_interface cpici
272: WHERE cpici.interface_header_id = x_interface_header_id );
273:
274:
275:
352: l_stmt_num := 1;
353:
354: SELECT count(*)
355: INTO x_no_of_rows
356: FROM cst_pc_item_cost_interface cpici
357: WHERE cpici.interface_header_id = x_interface_header_id
358: AND cpici.market_value > cpici.item_cost;
359:
360:
392: l_stmt_num := 1;
393:
394: SELECT count(*)
395: INTO x_no_of_rows
396: FROM cst_pc_item_cost_interface cpici
397: WHERE cpici.interface_header_id = x_interface_header_id
398: AND cpici.market_value IS NOT NULL
399: AND cpici.justification IS NULL;
400:
450: cst_le_cost_types clct
451: WHERE cct.cost_type_id = clct.cost_type_id
452: AND cct.cost_type =
453: ( SELECT cpici.cost_type
454: FROM cst_pc_item_cost_interface cpici
455: WHERE cpici.interface_header_id = x_interface_header_id )
456: AND clct.legal_entity =
457: (SELECT DISTINCT ccg.legal_entity
458: FROM cst_cost_groups ccg,
460: WHERE ccg.cost_group_id = ccga.cost_group_id
461: AND ccg.cost_group_type = 2
462: AND ccg.cost_group =
463: (SELECT cpici.cost_group
464: FROM cst_pc_item_cost_interface cpici
465: WHERE cpici.interface_header_id =
466: x_interface_header_id));
467:
468: l_stmt_num := 1;
551: x_prg_appid,
552: x_prg_id,
553: SYSDATE,
554: x_login_id
555: FROM cst_pc_item_cost_interface cpici
556: WHERE cpici.interface_header_id = x_interface_header_id ;
557:
558:
559: x_no_of_rows := SQL%ROWCOUNT;
641: x_prg_appid,
642: x_prg_id,
643: SYSDATE,
644: x_login_id
645: FROM CST_PC_ITEM_COST_INTERFACE cpici
646: WHERE cpici.interface_header_id = x_interface_header_id ;
647:
648:
649: if(SQL%ROWCOUNT = 0) then
708:
709:
710: l_stmt_num := 2;
711:
712: UPDATE cst_pc_item_cost_interface cpici
713: SET tl_material = ( SELECT NVL(SUM(item_cost),0)
714: FROM cst_pc_cost_det_interface cpcdi
715: WHERE cpcdi.interface_header_id = x_interface_header_id
716: AND level_type = 1
723:
724:
725: l_stmt_num := 3;
726:
727: UPDATE cst_pc_item_cost_interface cpici
728: SET tl_material_overhead = ( SELECT NVL(SUM(item_cost),0)
729: FROM cst_pc_cost_det_interface cpcdi
730: WHERE cpcdi.interface_header_id = x_interface_header_id
731: AND level_type = 1
739:
740: l_stmt_num := 4;
741:
742:
743: UPDATE cst_pc_item_cost_interface cpici
744: SET tl_resource = ( SELECT NVL(SUM(item_cost),0)
745: FROM cst_pc_cost_det_interface cpcdi
746: WHERE cpcdi.interface_header_id = x_interface_header_id
747: AND level_type = 1
756:
757: l_stmt_num := 5;
758:
759:
760: UPDATE cst_pc_item_cost_interface cpici
761: SET tl_outside_processing = ( SELECT NVL(SUM(item_cost),0)
762: FROM cst_pc_cost_det_interface cpcdi
763: WHERE cpcdi.interface_header_id = x_interface_header_id
764: AND level_type = 1
771:
772:
773: l_stmt_num := 6;
774:
775: UPDATE cst_pc_item_cost_interface cpici
776: SET tl_overhead = ( SELECT NVL(SUM(item_cost),0)
777: FROM cst_pc_cost_det_interface cpcdi
778: WHERE cpcdi.interface_header_id = x_interface_header_id
779: AND level_type = 1
786:
787:
788: l_stmt_num := 7;
789:
790: UPDATE cst_pc_item_cost_interface cpici
791: SET pl_material = ( SELECT NVL(SUM(item_cost),0)
792: FROM cst_pc_cost_det_interface cpcdi
793: WHERE cpcdi.interface_header_id = x_interface_header_id
794: AND level_type = 2
801:
802:
803: l_stmt_num := 8;
804:
805: UPDATE cst_pc_item_cost_interface cpici
806: SET pl_material_overhead
807: = ( SELECT NVL(SUM(item_cost),0)
808: FROM cst_pc_cost_det_interface cpcdi
809: WHERE cpcdi.interface_header_id = x_interface_header_id
817:
818:
819: l_stmt_num := 9;
820:
821: UPDATE cst_pc_item_cost_interface cpici
822: SET pl_resource = ( SELECT NVL(SUM(item_cost),0)
823: FROM cst_pc_cost_det_interface cpcdi
824: WHERE cpcdi.interface_header_id = x_interface_header_id
825: AND level_type = 2
832:
833:
834: l_stmt_num := 10;
835:
836: UPDATE cst_pc_item_cost_interface cpici
837: SET pl_outside_processing = ( SELECT NVL(SUM(item_cost),0)
838: FROM cst_pc_cost_det_interface cpcdi
839: WHERE cpcdi.interface_header_id = x_interface_header_id
840: AND level_type = 2
848:
849: l_stmt_num := 11;
850:
851:
852: UPDATE cst_pc_item_cost_interface cpici
853: SET pl_overhead = ( SELECT NVL(SUM(item_cost),0)
854: FROM cst_pc_cost_det_interface cpcdi
855: WHERE cpcdi.interface_header_id = x_interface_header_id
856: AND level_type = 2
863:
864:
865: l_stmt_num := 12;
866:
867: UPDATE cst_pc_item_cost_interface cpici
868: SET cpici.tl_item_cost = NVL(NVL(cpici.tl_material,0)+NVL(cpici.tl_material_overhead,0)+NVL(cpici.tl_resource,0)+NVL(cpici.tl_outside_processing,0)+NVL(cpici.tl_overhead,0),0)
869: WHERE cpici.interface_header_id = x_interface_header_id;
870:
871: if(SQL%ROWCOUNT = 0) then
874:
875:
876: l_stmt_num := 13;
877:
878: UPDATE cst_pc_item_cost_interface cpici
879: SET cpici.pl_item_cost = NVL(NVL(cpici.pl_material,0)+NVL(cpici.pl_material_overhead,0)+NVL(cpici.pl_resource,0)+NVL(cpici.pl_outside_processing,0)+NVL(cpici.pl_overhead,0),0)
880: WHERE cpici.interface_header_id = x_interface_header_id;
881:
882: if(SQL%ROWCOUNT = 0) then
885:
886:
887: l_stmt_num := 14;
888:
889: UPDATE cst_pc_item_cost_interface cpici
890: SET cpici.item_cost = NVL(NVL(cpici.tl_item_cost,0) + NVL(cpici.pl_item_cost,0),0)
891: WHERE cpici.interface_header_id = x_interface_header_id;
892:
893: if(SQL%ROWCOUNT = 0) then
896:
897:
898: l_stmt_num := 15;
899:
900: UPDATE cst_pc_item_cost_interface cpici
901: SET cpici.material_cost = NVL(NVL(cpici.tl_material,0) + NVL(cpici.pl_material,0),0)
902: WHERE cpici.interface_header_id = x_interface_header_id;
903:
904: if(SQL%ROWCOUNT = 0) then
907:
908:
909: l_stmt_num := 16;
910:
911: UPDATE cst_pc_item_cost_interface cpici
912: SET cpici.material_overhead_cost = NVL(NVL(cpici.tl_material_overhead,0) + NVL(cpici.pl_material_overhead,0),0)
913: WHERE cpici.interface_header_id = x_interface_header_id;
914:
915: if(SQL%ROWCOUNT = 0) then
918:
919:
920: l_stmt_num := 17;
921:
922: UPDATE cst_pc_item_cost_interface cpici
923: SET cpici.resource_cost = NVL(NVL(cpici.tl_resource,0) + NVL(cpici.pl_resource,0),0)
924: WHERE cpici.interface_header_id = x_interface_header_id;
925:
926: if(SQL%ROWCOUNT = 0) then
930:
931: l_stmt_num := 18;
932:
933:
934: UPDATE cst_pc_item_cost_interface cpici
935: SET cpici.outside_processing_cost = NVL(NVL(cpici.tl_outside_processing,0) + NVL(cpici. pl_outside_processing,0),0)
936: WHERE cpici.interface_header_id = x_interface_header_id;
937:
938: if(SQL%ROWCOUNT = 0) then
941:
942:
943: l_stmt_num := 19;
944:
945: UPDATE cst_pc_item_cost_interface cpici
946: SET cpici.overhead_cost = NVL(NVL(cpici.tl_overhead,0) + NVL(cpici.pl_overhead,0),0)
947: WHERE cpici.interface_header_id = x_interface_header_id;
948:
949: if(SQL%ROWCOUNT = 0) then
952:
953:
954: l_stmt_num := 20;
955:
956: UPDATE cst_pc_item_cost_interface cpici
957: SET cpici.buy_quantity = 0
958: WHERE cpici.interface_header_id = x_interface_header_id;
959:
960: if(SQL%ROWCOUNT = 0) then
963:
964:
965: l_stmt_num := 21;
966:
967: UPDATE cst_pc_item_cost_interface cpici
968: SET cpici.make_quantity = 0
969: WHERE cpici.interface_header_id = x_interface_header_id;
970:
971: if(SQL%ROWCOUNT = 0) then
974:
975:
976: l_stmt_num := 22;
977:
978: UPDATE cst_pc_item_cost_interface cpici
979: SET cpici.issue_quantity = 0
980: WHERE cpici.interface_header_id = x_interface_header_id;
981:
982: if(SQL%ROWCOUNT = 0) then
985:
986:
987: l_stmt_num := 23;
988:
989: UPDATE cst_pc_item_cost_interface cpici
990: SET cpici.unburdened_cost = NVL(NVL(cpici.material_cost,0) + NVL(cpici.resource_cost,0) + NVL(cpici.outside_processing_cost,0),0)
991: WHERE cpici.interface_header_id = x_interface_header_id;
992:
993: if(SQL%ROWCOUNT = 0) then
996:
997:
998: l_stmt_num := 24;
999:
1000: UPDATE cst_pc_item_cost_interface cpici
1001: SET cpici.burden_cost = NVL(NVL(cpici.overhead_cost,0) + NVL(cpici.material_overhead_cost,0),0)
1002: WHERE cpici.interface_header_id = x_interface_header_id;
1003:
1004: if(SQL%ROWCOUNT = 0) then
1007:
1008:
1009: l_stmt_num := 25;
1010:
1011: UPDATE cst_pc_item_cost_interface cpici
1012: SET cpici.item_buy_cost = ( SELECT NVL(SUM(item_buy_cost),0)
1013: FROM cst_pc_cost_det_interface cpcdi
1014: WHERE cpcdi.interface_header_id = x_interface_header_id)
1015: WHERE cpici.interface_header_id = x_interface_header_id;
1020:
1021:
1022: l_stmt_num := 26;
1023:
1024: UPDATE cst_pc_item_cost_interface cpici
1025: SET cpici.item_make_cost = ( SELECT NVL(SUM(item_make_cost),0)
1026: FROM cst_pc_cost_det_interface cpcdi
1027: WHERE cpcdi.interface_header_id = x_interface_header_id )
1028: WHERE cpici.interface_header_id = x_interface_header_id;