diff --git a/src/main/java/com/iemr/flw/controller/MaternalHealthController.java b/src/main/java/com/iemr/flw/controller/MaternalHealthController.java
index e65eacda..d98104b1 100644
--- a/src/main/java/com/iemr/flw/controller/MaternalHealthController.java
+++ b/src/main/java/com/iemr/flw/controller/MaternalHealthController.java
@@ -98,16 +98,19 @@ public String getPregnantWomanList(@RequestBody GetBenRequestHandler requestDTO,
     @Operation(summary = "save anc visit details")
     @RequestMapping(value = { "/ancVisit/saveAll" }, method = { RequestMethod.POST })
     public String saveANCVisit(@RequestBody List<ANCVisitDTO> ancVisitDTOs,
-            @RequestHeader(value = "Authorization") String Authorization) {
+            @RequestHeader(value = "jwtToken") String token) {
         OutputResponse response = new OutputResponse();
         try {
             if (ancVisitDTOs.size() != 0) {
                 logger.info("Saving ANC visits with timestamp : " + new Timestamp(System.currentTimeMillis()));
-                String s = maternalHealthService.saveANCVisit(ancVisitDTOs);
-                if (s != null)
-                    response.setResponse(s);
-                else
-                    response.setError(5000, "Saving anc data to db failed");
+                if(token!=null){
+                    String s = maternalHealthService.saveANCVisit(ancVisitDTOs,jwtUtil.extractUserId(token));
+                    if (s != null)
+                        response.setResponse(s);
+                    else
+                        response.setError(5000, "Saving anc data to db failed");
+                }
+
             } else
                 response.setError(5000, "Invalid/NULL request obj");
         } catch (Exception e) {
diff --git a/src/main/java/com/iemr/flw/service/MaternalHealthService.java b/src/main/java/com/iemr/flw/service/MaternalHealthService.java
index 33de9bc9..e76d5a31 100644
--- a/src/main/java/com/iemr/flw/service/MaternalHealthService.java
+++ b/src/main/java/com/iemr/flw/service/MaternalHealthService.java
@@ -16,7 +16,7 @@ public interface MaternalHealthService {
 
     List<ANCVisitDTO> getANCVisits(GetBenRequestHandler dto);
 
-    String saveANCVisit(List<ANCVisitDTO> ancVisitDTOs);
+    String saveANCVisit(List<ANCVisitDTO> ancVisitDTOs,Integer userId);
 
     List<PmsmaDTO> getPmsmaRecords(GetBenRequestHandler dto);
 
diff --git a/src/main/java/com/iemr/flw/service/impl/MaternalHealthServiceImpl.java b/src/main/java/com/iemr/flw/service/impl/MaternalHealthServiceImpl.java
index 8914941f..4bdf3743 100644
--- a/src/main/java/com/iemr/flw/service/impl/MaternalHealthServiceImpl.java
+++ b/src/main/java/com/iemr/flw/service/impl/MaternalHealthServiceImpl.java
@@ -23,6 +23,7 @@
 import java.time.LocalTime;
 import java.time.format.DateTimeFormatter;
 import java.time.format.DateTimeParseException;
+import java.time.temporal.ChronoUnit;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -144,7 +145,7 @@ public List<ANCVisitDTO> getANCVisits(GetBenRequestHandler dto) {
     }
 
     @Override
-    public String saveANCVisit(List<ANCVisitDTO> ancVisitDTOs) {
+    public String saveANCVisit(List<ANCVisitDTO> ancVisitDTOs,Integer userId) {
         try {
             List<ANCVisit> ancList = new ArrayList<>();
             List<AncCare> ancCareList = new ArrayList<>();
@@ -200,7 +201,7 @@ public String saveANCVisit(List<ANCVisitDTO> ancVisitDTOs) {
 
             ancVisitRepo.saveAll(ancList);
             ancCareRepo.saveAll(ancCareList);
-            checkAndAddIncentives(ancList);
+            checkAndAddIncentives(ancList,userId);
             logger.info("ANC visit details saved");
             return "no of anc details saved: " + ancList.size();
         } catch (Exception e) {
@@ -613,112 +614,104 @@ record = new IncentiveActivityRecord();
     }
 
 
-    private void checkAndAddIncentives(List<ANCVisit> ancList) {
-
-        IncentiveActivity anc1Activity =
-                incentivesRepo.findIncentiveMasterByNameAndGroup("ANC_REGISTRATION_1ST_TRIM", GroupName.MATERNAL_HEALTH.getDisplayName());
-
-        IncentiveActivity ancFullActivityAM =
-                incentivesRepo.findIncentiveMasterByNameAndGroup("FULL_ANC", GroupName.MATERNAL_HEALTH.getDisplayName());
-
-        IncentiveActivity ancFullActivityCH =
-                incentivesRepo.findIncentiveMasterByNameAndGroup("ANC_FOUR_CHECKUPS_SUPPORT", GroupName.ACTIVITY.getDisplayName());
-
-        IncentiveActivity comprehensiveAbortionActivityAM = incentivesRepo.findIncentiveMasterByNameAndGroup("COMPREHENSIVE_ABORTION_CARE", GroupName.MATERNAL_HEALTH.getDisplayName());
-        IncentiveActivity comprehensiveAbortionActivityCH = incentivesRepo.findIncentiveMasterByNameAndGroup("COMPREHENSIVE_ABORTION_CARE", GroupName.ACTIVITY.getDisplayName());
-
-        IncentiveActivity identifiedHrpActivityAM = incentivesRepo.findIncentiveMasterByNameAndGroup("EPMSMA_HRP_IDENTIFIED", GroupName.MATERNAL_HEALTH.getDisplayName());
-        IncentiveActivity identifiedHrpActivityCH = incentivesRepo.findIncentiveMasterByNameAndGroup("EPMSMA_HRP_IDENTIFIED", GroupName.ACTIVITY.getDisplayName());
+    private void checkAndAddIncentives(List<ANCVisit> ancList, Integer userId) {
+
+        Integer stateId = userRepo.getUserRole(userId).get(0).getStateId();
+
+        IncentiveActivity anc1Activity = null;
+        IncentiveActivity ancFullActivityAM = null;
+        IncentiveActivity identifiedHrpActivityAM = null;
+        IncentiveActivity comprehensiveAbortionActivityAM = null;
+        IncentiveActivity paiucdActivityAM = null;
+
+        IncentiveActivity ancFullActivityCH = null;
+        IncentiveActivity comprehensiveAbortionActivityCH = null;
+        IncentiveActivity identifiedHrpActivityCH = null;
+        IncentiveActivity paiucdActivityCH = null;
+
+        // ✅ State 5 — Assam
+        if (stateId.equals(5)) {
+            anc1Activity = incentivesRepo.findIncentiveMasterByNameAndGroup(
+                    "ANC_REGISTRATION_1ST_TRIM", GroupName.MATERNAL_HEALTH.getDisplayName());
+            ancFullActivityAM = incentivesRepo.findIncentiveMasterByNameAndGroup(
+                    "FULL_ANC", GroupName.MATERNAL_HEALTH.getDisplayName());
+            identifiedHrpActivityAM = incentivesRepo.findIncentiveMasterByNameAndGroup(
+                    "EPMSMA_HRP_IDENTIFIED", GroupName.MATERNAL_HEALTH.getDisplayName());
+            comprehensiveAbortionActivityAM = incentivesRepo.findIncentiveMasterByNameAndGroup(
+                    "COMPREHENSIVE_ABORTION_CARE", GroupName.MATERNAL_HEALTH.getDisplayName());
+            paiucdActivityAM = incentivesRepo.findIncentiveMasterByNameAndGroup(
+                    "FP_PAIUCD", GroupName.FAMILY_PLANNING.getDisplayName());
+        }
 
-        IncentiveActivity paiucdActivityAM =
-                incentivesRepo.findIncentiveMasterByNameAndGroup("FP_PAIUCD", GroupName.FAMILY_PLANNING.getDisplayName());
+        // ✅ State 8
+        if (stateId.equals(8)) {
+            ancFullActivityCH = incentivesRepo.findIncentiveMasterByNameAndGroup(
+                    "ANC_FOUR_CHECKUPS_SUPPORT", GroupName.ACTIVITY.getDisplayName());
+            comprehensiveAbortionActivityCH = incentivesRepo.findIncentiveMasterByNameAndGroup(
+                    "COMPREHENSIVE_ABORTION_CARE", GroupName.ACTIVITY.getDisplayName());
+            identifiedHrpActivityCH = incentivesRepo.findIncentiveMasterByNameAndGroup(
+                    "EPMSMA_HRP_IDENTIFIED", GroupName.ACTIVITY.getDisplayName());
+            paiucdActivityCH = incentivesRepo.findIncentiveMasterByNameAndGroup(
+                    "FP_PAIUCD", GroupName.ACTIVITY.getDisplayName());
+        }
 
-        IncentiveActivity paiucdActivityCH =
-                incentivesRepo.findIncentiveMasterByNameAndGroup("FP_PAIUCD", GroupName.ACTIVITY.getDisplayName());
+        final IncentiveActivity finalAnc1Activity = anc1Activity;
+        final IncentiveActivity finalAncFullActivityAM = ancFullActivityAM;
+        final IncentiveActivity finalIdentifiedHrpActivityAM = identifiedHrpActivityAM;
+        final IncentiveActivity finalComprehensiveAbortionActivityAM = comprehensiveAbortionActivityAM;
+        final IncentiveActivity finalPaiucdActivityAM = paiucdActivityAM;
+        final IncentiveActivity finalAncFullActivityCH = ancFullActivityCH;
+        final IncentiveActivity finalComprehensiveAbortionActivityCH = comprehensiveAbortionActivityCH;
+        final IncentiveActivity finalIdentifiedHrpActivityCH = identifiedHrpActivityCH;
+        final IncentiveActivity finalPaiucdActivityCH = paiucdActivityCH;
 
         ancList.forEach(ancVisit -> {
-            if (paiucdActivityAM != null) {
-                if (ancVisit.getIsPaiucd()!= null) {
-                    if (ancVisit.getIsPaiucd().equals("Yes")) {
-                        recordAncRelatedIncentive(paiucdActivityAM, ancVisit);
-
-                    }
-                }
 
+            if (finalPaiucdActivityAM != null && ancVisit.getIsPaiucd() != null
+                    && ancVisit.getIsPaiucd().equals("Yes")) {
+                recordAncRelatedIncentive(finalPaiucdActivityAM, ancVisit);
             }
 
-            if (paiucdActivityCH != null) {
-
-                if (ancVisit.getIsPaiucd()!= null) {
-                    if (ancVisit.getIsPaiucd().equals("Yes")) {
-
-                        recordAncRelatedIncentive(paiucdActivityCH, ancVisit);
-
-                    }
-                }
-
-
+            if (finalPaiucdActivityCH != null && ancVisit.getIsPaiucd() != null
+                    && ancVisit.getIsPaiucd().equals("Yes")) {
+                recordAncRelatedIncentive(finalPaiucdActivityCH, ancVisit);
             }
-            if (anc1Activity != null) {
-                if (ancVisit.getAncVisit() != null) {
 
-                    if (ancVisit.getAncVisit() == 1) {
-                        recordAncRelatedIncentive(anc1Activity, ancVisit);
-                    }
-                }
+            if (finalAnc1Activity != null && ancVisit.getAncVisit() != null
+                    && ancVisit.getAncVisit() == 1) {
+                recordAncFirstTRIMIncentive(finalAnc1Activity, ancVisit);
             }
-            if (ancFullActivityAM != null) {
-                if (ancVisit.getAncVisit() == 4 || ancVisit.getAncVisit() == 2 || ancVisit.getAncVisit() == 3) {
-                    recordAncRelatedIncentive(ancFullActivityAM, ancVisit);
-                }
 
+            if (finalAncFullActivityAM != null && ancVisit.getAncVisit() != null
+                    && ancVisit.getAncVisit() == 4) {
+                recordFullAncIncentive(finalAncFullActivityAM, ancVisit);
             }
-            if (ancFullActivityCH != null) {
-                if (ancVisit.getAncVisit() != null) {
-                    if (ancVisit.getAncVisit() == 4) {
-                        recordAncRelatedIncentive(ancFullActivityCH, ancVisit);
-                    }
-                }
 
+            if (finalAncFullActivityCH != null && ancVisit.getAncVisit() != null
+                    && ancVisit.getAncVisit() == 4) {
+                recordAncRelatedIncentive(finalAncFullActivityCH, ancVisit);
             }
-            if (comprehensiveAbortionActivityAM != null) {
-                if (ancVisit.getIsAborted() != null) {
-                    if (ancVisit.getIsAborted()) {
-                        recordAncRelatedIncentive(comprehensiveAbortionActivityAM, ancVisit);
-                    }
-                }
 
+            if (finalComprehensiveAbortionActivityAM != null && ancVisit.getIsAborted() != null
+                    && ancVisit.getIsAborted()) {
+                recordAncRelatedIncentive(finalComprehensiveAbortionActivityAM, ancVisit);
             }
 
-            if (comprehensiveAbortionActivityCH != null) {
-                if (ancVisit.getIsAborted() != null) {
-                    if (ancVisit.getIsAborted()) {
-                        recordAncRelatedIncentive(comprehensiveAbortionActivityCH, ancVisit);
-                    }
-                }
-
+            if (finalComprehensiveAbortionActivityCH != null && ancVisit.getIsAborted() != null
+                    && ancVisit.getIsAborted()) {
+                recordAncRelatedIncentive(finalComprehensiveAbortionActivityCH, ancVisit);
             }
-            if (identifiedHrpActivityAM != null) {
-                if (ancVisit.getIsHrpConfirmed() != null) {
-                    if (ancVisit.getIsHrpConfirmed()) {
-                        recordAncRelatedIncentive(identifiedHrpActivityAM, ancVisit);
-                    }
-                }
 
+            if (finalIdentifiedHrpActivityAM != null && ancVisit.getIsHrpConfirmed() != null
+                    && ancVisit.getIsHrpConfirmed()) {
+                recordAncRelatedIncentive(finalIdentifiedHrpActivityAM, ancVisit);
             }
 
-            if (identifiedHrpActivityCH != null) {
-                if (ancVisit.getIsHrpConfirmed() != null) {
-                    if (ancVisit.getIsHrpConfirmed()) {
-                        recordAncRelatedIncentive(identifiedHrpActivityCH, ancVisit);
-                    }
-                }
-
+            if (finalIdentifiedHrpActivityCH != null && ancVisit.getIsHrpConfirmed() != null
+                    && ancVisit.getIsHrpConfirmed()) {
+                recordAncRelatedIncentive(finalIdentifiedHrpActivityCH, ancVisit);
             }
-
         });
-
-
     }
 
     private void recordAncRelatedIncentive(IncentiveActivity incentiveActivity, ANCVisit ancVisit) {
@@ -741,6 +734,76 @@ record = new IncentiveActivityRecord();
         }
 
     }
+    private void recordAncFirstTRIMIncentive(IncentiveActivity incentiveActivity, ANCVisit ancVisit) {
+
+        if (ancVisit.getAncDate() == null || ancVisit.getLmpDate() == null) {
+            return;
+        }
+
+        LocalDate ancLocalDate = ancVisit.getAncDate().toLocalDateTime().toLocalDate();
+        LocalDate lmpLocalDate = ancVisit.getLmpDate().toLocalDateTime().toLocalDate();
+
+        long weeksBetween = ChronoUnit.WEEKS.between(lmpLocalDate, ancLocalDate);
+
+        if (weeksBetween < 0 || weeksBetween >= 12) {
+            return;
+        }
+
+        IncentiveActivityRecord record = recordRepo.findRecordByActivityIdCreatedDateBenId(
+                incentiveActivity.getId(),
+                ancVisit.getCreatedDate(),
+                ancVisit.getBenId()
+        );
+
+        Integer userId = userRepo.getUserIdByName(ancVisit.getCreatedBy());
+
+        if (record == null) {
+            record = new IncentiveActivityRecord();
+            record.setActivityId(incentiveActivity.getId());
+            record.setCreatedDate(ancVisit.getLmpDate());
+            record.setCreatedBy(ancVisit.getCreatedBy());
+            record.setUpdatedDate(ancVisit.getLmpDate());
+            record.setUpdatedBy(ancVisit.getCreatedBy());
+            record.setStartDate(ancVisit.getLmpDate());
+            record.setEndDate(ancVisit.getLmpDate());
+            record.setBenId(ancVisit.getBenId());
+            record.setAshaId(userId);
+            record.setAmount(Long.valueOf(incentiveActivity.getRate()));
+            recordRepo.save(record);
+        }
+    }
+
+    private void recordFullAncIncentive(IncentiveActivity incentiveActivity, ANCVisit ancVisit) {
+
+        IncentiveActivityRecord existRecord = recordRepo.findRecordByActivityIdCreatedDateBenId(
+                incentiveActivity.getId(),
+                ancVisit.getCreatedDate(),
+                ancVisit.getBenId()
+        );
+
+
+        if (existRecord != null) {
+            return;
+        }
+
+        Integer userId = userRepo.getUserIdByName(ancVisit.getCreatedBy());
+        if (userId == null) {
+            return;
+        }
+
+        IncentiveActivityRecord record = new IncentiveActivityRecord();
+        record.setActivityId(incentiveActivity.getId());
+        record.setCreatedDate(ancVisit.getAncDate());
+        record.setCreatedBy(ancVisit.getCreatedBy());
+        record.setUpdatedDate(ancVisit.getAncDate());
+        record.setUpdatedBy(ancVisit.getCreatedBy());
+        record.setStartDate(ancVisit.getAncDate());
+        record.setEndDate(ancVisit.getAncDate());
+        record.setBenId(ancVisit.getBenId());
+        record.setAshaId(userId);
+        record.setAmount(Long.valueOf(incentiveActivity.getRate()));
+        recordRepo.save(record);
+    }
 
 
     public void sendAncDueTomorrowNotifications(String ashaId) {
