diff --git a/app/Controllers/EmpDataServiceController.php b/app/Controllers/EmpDataServiceController.php index 45e7097c..07a7ce3b 100755 --- a/app/Controllers/EmpDataServiceController.php +++ b/app/Controllers/EmpDataServiceController.php @@ -1032,8 +1032,9 @@ class EmpDataServiceController extends BaseController return false; } + //for cd tranction and cd master data is empty check - if(!empty($inceptionData) && $inceptionData != null){ + if(!empty($inceptionData) && $inceptionData != null || !empty($additionData) && $additionData != null || !empty($dependentAdditionData) && $dependentAdditionData != null){ $policy_details = $this->clientPolicyModel->where('id', $export_data['client_policy_id'])->first(); @@ -1065,6 +1066,14 @@ class EmpDataServiceController extends BaseController $totals = $totals + $item->total; } + foreach ($additionData as $item) { + $totals = $totals + $item->total; + } + + foreach ($dependentAdditionData as $item) { + $totals = $totals + $item->total; + } + $totals = round($totals, 2); @@ -1127,8 +1136,7 @@ class EmpDataServiceController extends BaseController AND `insurer_excel_export_template`.`type_name` = :type_name: LIMIT 1"; - $binds = ['client_policy_id' => (int)$export_data['client_policy_id'], - 'type_name' => $export_data['actions']]; + $binds = ['client_policy_id' => (int)$export_data['client_policy_id'],'type_name' => $export_data['actions']]; $query = db_connect()->query($sql,$binds); $template_json = $query->getRowArray(); diff --git a/app/Controllers/SalesController.php b/app/Controllers/SalesController.php index 659299cd..edf64242 100644 --- a/app/Controllers/SalesController.php +++ b/app/Controllers/SalesController.php @@ -2028,6 +2028,35 @@ private function buildOppAchievement($db, array $sales_manager_ids, $branchId, s ORDER BY l.created_at DESC ", [$uid, $fyStart, $fyEnd])->getResultArray(); + // ── Lost Leads for this user in FY (Opportunities tab — toggle off) ── + $lossLeads = $db->query(" + SELECT + l.id AS opportunities_id, + l.actual_lead_id, + COALESCE(l.lead_form_type, 1) AS lead_form_type_id, + l.lead_type AS lead_type_id, + sal.company_name AS company, + l.client_name AS client_name, + CASE WHEN COALESCE(l.lead_form_type, 1) = 1 THEN 'EB' ELSE 'Non-EB' END AS lead_form_type, + CASE + WHEN l.lead_type = 1 THEN 'Fresh' + WHEN l.lead_type = 2 THEN 'Renewal' + WHEN l.lead_type = 3 THEN 'Roll Over' + ELSE '' + END AS lead_type, + l.created_at AS created_at, + l.status, + l.lost_reason AS lost_reason + FROM leads l + INNER JOIN sales_actual_leads sal + ON sal.lead_id = l.actual_lead_id + WHERE l.status = 'lost' + AND sal.assigned_to = ? + AND l.created_at >= ? + AND l.created_at <= ? + ORDER BY l.created_at DESC + ", [$uid, $fyStart, $fyEnd])->getResultArray(); + // -- NOTE: AND TRIM(sal.company_name) = TRIM(l.client_name) $result[$uid] = [ 'total_policies' => $totalPolicies, @@ -2035,6 +2064,7 @@ private function buildOppAchievement($db, array $sales_manager_ids, $branchId, s 'target_amt' => $targetAmt, 'policies' => $policies, 'won_leads' => $wonLeads, // for Table 2 in modal Tab 2 + 'loss_leads' => $lossLeads, ]; } diff --git a/app/Views/insurer_export_templete.php b/app/Views/insurer_export_templete.php index 5edcc832..fa78b8e1 100755 --- a/app/Views/insurer_export_templete.php +++ b/app/Views/insurer_export_templete.php @@ -14,7 +14,8 @@ text-overflow: ellipsis; } - .select2-hidden-accessible + .select2-container .select2-dropdown { + /* Hide dropdown list only for the insurer copy select (search-only UX) */ + #insurer.select2-hidden-accessible + .select2-container .select2-dropdown { display: none !important; } @@ -53,6 +54,14 @@ z-index: 1060; } + #template_modal .select2-container { + z-index: 1061; + } + + #template_modal .select2-dropdown { + z-index: 1062; + } + #template_modal.show { display: flex !important; align-items: center; @@ -276,6 +285,44 @@