diff --git a/app/Config/Routes.php b/app/Config/Routes.php
index a9cd0ae2..dbf222fc 100755
--- a/app/Config/Routes.php
+++ b/app/Config/Routes.php
@@ -384,6 +384,8 @@ $routes->group("/util", ["filter" => "authMVC"], function ($routes) {
$routes->get('getClaimDumpFileErrorData', 'TicketController::getClaimDumpFileErrorData');
$routes->get("claim_dump_excel_error/(:any)", "TicketController::getClaimDumpExcelFileErrors/$1");
$routes->get("download_claim_dump_file/(:any)", "TicketController::downloadClaimDumpFile/$1");
+ $routes->post('uploadMultiFileFromRfq', 'LeadsController::uploadMultiFileFromRfq');
+ $routes->get('downloadMemberFile/(:any)', 'LeadsController::downloadMemberFile/$1');
});
$routes->post("policy_tranction/sendInstallmentRemainderMail","PolicyTransactionController::sendInstallmentRemainderMail");
@@ -692,6 +694,9 @@ $routes->group('test', function($routes) {
$routes->get('viewPDF', 'TestingController::viewPDF');
$routes->get('generate-pdf-view', 'TestingController::generatePDFWithView');
$routes->get('param/(:any)', 'TestingController::ptedfitdata/$1');
+ $routes->get('viewrfq', 'TestingController::viewRFQNonEb');
+ $routes->get('exportexcel', 'TestingController::exportExcel');
+ $routes->post('saverfq', 'TestingController::saverfq');
});
$routes->cli('cli/testcli', 'TestingController::testcli');
diff --git a/app/Controllers/LeadsController.php b/app/Controllers/LeadsController.php
index d5f8ea12..7465ad7a 100644
--- a/app/Controllers/LeadsController.php
+++ b/app/Controllers/LeadsController.php
@@ -528,7 +528,7 @@ class LeadsController extends BaseController
return $this->respond(['status' => false, 'lead_id' => $id, 'message' => "Failed to update Lead", 'data' => $data], 200);
}
- // Get the Single Lead data for edit uisng ajax ( do not delete)
+ // Get the Single Lead data for edit uisng ajax (do not delete)
public function getLeadDataForEdit($id)
{
@@ -603,7 +603,7 @@ class LeadsController extends BaseController
}
public function uploadMultiFiles($files, $docs_names, $primaryKey)
- {
+ {
$uploadFilePath = WRITEPATH . 'uploads/lead_files/';
$multi_file_data = [];
@@ -696,63 +696,287 @@ class LeadsController extends BaseController
//--------RFQ-----------------------------------------------------------------------------------------------
+ // public function viewRFQ($id, $type = 1)
+ // {
+
+ // $data['rfq_data'] = $this->RFQModel
+ // ->where('lead_id', $id)
+ // // ->where('type', $type)
+ // ->where('is_active', 1)
+ // ->orderBy('id', 'desc')
+ // ->first();
+ // // dd($data);
+
+ // $data['rfq_count'] = $this->RFQModel
+ // ->where('lead_id', $id)
+ // // ->where('type', 1)
+ // ->where('is_active', 1)
+ // ->countAllResults();
+
+ // $data['qcr_count'] = $this->RFQModel
+ // ->where('lead_id', $id)
+ // ->where('type', 2)
+ // ->where('is_active', 1)
+ // ->countAllResults();
+
+ // // dd(count($data['rfq_data']));
+
+ // $data['lead_id'] = $id;
+ // $lead_data = $this->leadsModel
+ // ->select('
+ // leads.*,
+ // policy_type.question_json,
+ // policy_type.policy_type,
+ // policy_type.long_name,
+ // user_profiles.email as created_person_email
+ // ')
+ // ->join('policy_type', 'leads.policy_type_id = policy_type.id')
+ // ->join('user_profiles', 'leads.created_by = user_profiles.id', 'left')
+ // ->where('leads.id', $id)
+ // ->where('leads.is_active', 1)
+ // ->first();
+
+ // // dd($lead_data);
+
+ // if ($lead_data['lead_type'] != 1) {
+ // $client_policy_data = $this->clientPolicyModel->where('is_active', 1)->where('id', $lead_data['source_policy_id'])->first();
+ // if (isset($client_policy_data)) {
+ // $data['policy_terms'] = $client_policy_data['policy_terms'];
+ // }
+ // }
+
+ // $data['question_json'] = $lead_data['question_json'];
+ // $data['page_name'] = $type == 2 ? 'QCR' : 'RFQ';
+ // $data['insurer'] = $this->insurerBranchModel->getInsurerBranchesWithInsurerNames();
+ // $data['userList'] = $this->userModel->getUserListForRFQ();
+ // $data['exclusiveUserList'] = $this->userModel->getexclusiveUserListForRFQ();
+ // $data['lead_data'] = $lead_data;
+ // $data['tpa_list'] = $this->tpaBranchModel->getTpaBranchesWithTpaNames();
+ // $data['account_manager'] = $this->userModel->where('is_active', 1)->where('role', 3)->findAll();
+
+
+ // $mail_content = '
+ //
Kindly request you to share the competitive quotes at the earliest.
+ // In case of any query, please feel free to contact us.
+ //
+
{{LOGGED_USER_NAME}}
Mobile: {{LOGGED_USER_MOBILE}}
-

+

';
+ }
- if ($data['lead_data']['policy_end_date'] != null) {
- $subject = "{{CLIENT_NAME}} _ {{POLICY_TYPE}} _ {{RFQ_OR_QCR}} _ {{POLICY_YEAR}} {{POLICY_END_DATE}}";
- } else {
- $subject = "{{CLIENT_NAME}} _ {{POLICY_TYPE}} _ {{RFQ_OR_QCR}} _ {{POLICY_YEAR}}";
- }
-
- if ($lead_data['policy_type_id'] == 1) {
- $data['totalSumAssured'] = $this->handleMemberDataGPATotalSumInsurerFromExcel(['lead_id' => $id]);
- } else {
- $data['totalSumAssured'] = [];
- }
-
- $data['mail_content'] = $this->transformMailContent($lead_data, $mail_content, $data['page_name']);
- $data['subject'] = $this->transformMailContent($lead_data, $subject, $data['page_name']);
-
- $data['placement_mail_content'] = $this->transformMailContent($lead_data, $mail_content, 'Placement');
- $data['placement_subject'] = $this->transformMailContent($lead_data, $subject, 'Placement');
-
- $data['multi_file_data'] = $this->leadFilesModel->where('lead_id', $id)->where('is_active', 1)->findAll() ?? null;
- $installment_data['installments'] = $this->leadInstallmentPaymentDetails->where('lead_id', $id)->where('is_active', 1)->findAll() ?? null;
- $data['lead_data']['installment_data'] = view('rfq/installment_fields', $installment_data) ?? null;
- $data['attachment_html'] = view('rfq/attachment_files', $data) ?? "";
- $data['user_team'] = $this->userModel->select("ut.team_id")->join("user_teams ut", "ut.user_id = user_profiles.id and ut.is_active = 1")->where("user_profiles.is_active", 1)->first()['team_id'];
- // dd($data);
-
- if ($data['lead_data']['lead_form_type'] == 1) {
- $data['demogrphy_html_data'] = $this->generateDemographyDataTable(['lead_id' => $id]);
- $this->loadLayout('view_rfq.php', $data);
- } else if ($data['lead_data']['lead_form_type'] == 2) {
-
- $data['occupancy'] = $this->occupancyModel->findAll();
- // dd($data['occupancy']);
-
- if ($lead_data['lead_type'] != 1 && $data['rfq_count'] == 0) {
- $client_policy_data = $this->clientPolicyModel->where('is_active', 1)->where('id', $lead_data['source_policy_id'])->first();
- if (isset($client_policy_data)) {
-
- $data['rfq_data']['json'] = $client_policy_data['placement_json'];
- }
- }
-
- if (!empty($data['question_json'])) {
- $data['policies'] = json_decode($data['question_json'], true)['policies'];
- $data["child_table_data"] = json_decode($data['question_json'], true)['child_table_data'];
- }
-
- $data['product'] = $this->leadsModel->select("policy_type.policy_type")->join('policy_type', 'leads.policy_type_id = policy_type.id')->where('leads.id', $id)->first()['policy_type'];
- // $data['lead_register_data'] = json_decode($data['lead_data']['custom_fields']);
- // dd($data['lead_register_data']);
- // $data['entity_type'] = $this->kycEntityTypeModel->where('is_active', 1)->findAll();
- $data['buisness_type'] = $this->buisnessType;
-
- // dd($data);
- $data['client_type'] = $this->clientType;
- $this->loadLayout('view_rfq_non_eb', $data);
- }
+ // 14. Extract subject template to separate method
+ private function getSubjectTemplate($lead_data)
+ {
+ return $lead_data['policy_end_date'] != null
+ ? "{{CLIENT_NAME}} _ {{POLICY_TYPE}} _ {{RFQ_OR_QCR}} _ {{POLICY_YEAR}} {{POLICY_END_DATE}}"
+ : "{{CLIENT_NAME}} _ {{POLICY_TYPE}} _ {{RFQ_OR_QCR}} _ {{POLICY_YEAR}}";
}
public function savePolicyInfo()
@@ -1452,20 +1627,22 @@ class LeadsController extends BaseController
'Policy Type' => $this->leadType[$rfq_data['lead_type']] ?? "",
];
}
+
} else {
+
if (in_array($rfq_data['policy_type_id'], [2, 3, 4, 5])) {
$lead_data = [
'Insured' => $rfq_data['client_name'],
'Policy Type' => $this->leadType[$rfq_data['lead_type']] ?? "",
- 'No of Employees at Inception' => $rfq_data['incept_emp_count'],
- 'No of Dependents at Inception' => $rfq_data['incept_dept_count'],
- 'Total Lives at Inception ' => $rfq_data['incept_no_of_lives'],
+ // 'No of Employees at Inception' => $rfq_data['incept_emp_count'],
+ // 'No of Dependents at Inception' => $rfq_data['incept_dept_count'],
+ // 'Total Lives at Inception ' => $rfq_data['incept_no_of_lives'],
- 'No of Employees at Expiry' => $rfq_data['exp_emp_count'],
- 'No of Dependents at Expiry' => $rfq_data['exp_dept_count'],
- 'Total Lives at Expiry ' => $rfq_data['exp_no_of_lives'],
+ // 'No of Employees at Expiry' => $rfq_data['exp_emp_count'],
+ // 'No of Dependents at Expiry' => $rfq_data['exp_dept_count'],
+ // 'Total Lives at Expiry ' => $rfq_data['exp_no_of_lives'],
'No of Employees at Renewal' => $rfq_data['renewal_emp_count'],
'No of Dependents at Renewal' => $rfq_data['renewal_dept_count'],
@@ -1474,30 +1651,32 @@ class LeadsController extends BaseController
'Period of Insurance ' => !empty($rfq_data['policy_start_date']) && !empty($rfq_data['policy_end_date']) ? date('d-m-Y', strtotime($rfq_data['policy_start_date'])) . ' to ' . date('d-m-Y', strtotime($rfq_data['policy_end_date'])) : "To be decided",
'Insurer' => $rfq_data['insurer_name'] ?? " - ",
'TPA' => $rfq_data['tpa_name'] ?? " - ",
- 'Policy Run Days' => $rfq_data['policy_run_days'],
- 'Inception Premium' => formatIndianCurrency($rfq_data['premium_at_inception']),
- 'Premium as on (' . date('d-m-Y', strtotime($rfq_data['incurred_claims_date'])) . ')' => formatIndianCurrency($rfq_data['premium_date']),
- 'Earned Premium' => formatIndianCurrency(intval($rfq_data['earned_premium'])),
- 'Incurred Claims as on (' . date('d-m-Y', strtotime($rfq_data['incurred_claims_date'])) . ')' => formatIndianCurrency($rfq_data['incurred_claims']),
- 'Annualised Claims' => formatIndianCurrency(intval($rfq_data['annualised_claims'])),
- 'Incurred Claims Ratio' => $rfq_data['incurred_claims_ratio'] . " %",
- 'Earned Claims Ratio' => $rfq_data['earned_claims_ratio'] . " %",
+
+ // 'Policy Run Days' => $rfq_data['policy_run_days'],
+ // 'Inception Premium' => formatIndianCurrency($rfq_data['premium_at_inception']),
+ // 'Premium as on (' . date('d-m-Y', strtotime($rfq_data['incurred_claims_date'])) . ')' => formatIndianCurrency($rfq_data['premium_date']),
+ // 'Earned Premium' => formatIndianCurrency(intval($rfq_data['earned_premium'])),
+ // 'Incurred Claims as on (' . date('d-m-Y', strtotime($rfq_data['incurred_claims_date'])) . ')' => formatIndianCurrency($rfq_data['incurred_claims']),
+ // 'Annualised Claims' => formatIndianCurrency(intval($rfq_data['annualised_claims'])),
+ // 'Incurred Claims Ratio' => $rfq_data['incurred_claims_ratio'] . " %",
+ // 'Earned Claims Ratio' => $rfq_data['earned_claims_ratio'] . " %",
];
} else if (in_array($rfq_data['policy_type_id'], [1, 6, 7])) {
+
$lead_data = [
'Insured' => $rfq_data['client_name'],
'No of Employees at Inception' => $rfq_data['incept_emp_count'],
- 'Total Lives at Inception' => $rfq_data['total_lives_at_incept'],
'Total Sum Insured at Inception' => $rfq_data['total_si_at_incept'],
'Premium at inception' => $rfq_data['premium_at_incept'],
- 'No of Employees at Renewal' => $rfq_data['renewal_emp_count'],
- 'Total Sum Insured at Renewal ' => $rfq_data['total_si_at_renewal'],
'Policy Period' => !empty($rfq_data['policy_start_date']) && !empty($rfq_data['policy_end_date']) ? date('d-m-Y', strtotime($rfq_data['policy_start_date'])) . ' to ' . date('d-m-Y', strtotime($rfq_data['policy_end_date'])) : "To be decided",
- // 'Insurer' => $rfq_data['insurer_name'] ?? " - ",
- // 'TPA' => $rfq_data['tpa_name'] ?? " - ",
'Policy Type' => $this->leadType[$rfq_data['lead_type']] ?? "",
'Existing Insurer' => $rfq_data['insurer_name'],
- // 'TPA ' => $rfq_data['tpa_name'],
+ 'No of Employees at Renewal' => $rfq_data['renewal_emp_count'],
+ 'Total Sum Insured at Renewal' => $rfq_data['total_si_at_renewal'],
+ 'Claims Experience for last 3 years' => "Mentioned in Claims sheet",
+ // 'Insurer' => $rfq_data['insurer_name'] ?? " - ",
+ // 'TPA' => $rfq_data['tpa_name'] ?? " - ",
+ // 'Total Lives at Inception' => $rfq_data['total_lives_at_incept'],
];
}
}
@@ -2825,6 +3004,22 @@ class LeadsController extends BaseController
}
}
+ if($recipient_type == 'placement' && isset($params['acm_email']) && !empty($params['acm_email'])){
+
+ $common['mail_type'] = "internal acm";
+ $acm_mail_content = '
+
Dear Sir,
+
The placement for the {{POLICY_TYPE}} policy pertaining to {{CLIENT_NAME}} has been successfully won.
+
Please proceed with the next steps accordingly.
+
Thank You!
+
Best regards,
+
+

+ ';
+ $acm_mail_content = $this->transformMailContent($lead_data, $acm_mail_content, $data['page_name'] = 'QCR');
+ $res = MailHelper::send_email(['from_mail' => $from_mail, 'mail' => $params['acm_email'], 'subject' => $subject, 'message' => $acm_mail_content, 'attachments' => $attachments, 'common' => $common]);
+ }
+
$is_placement = false;
if ($recipient_type == 'placement') {
@@ -2850,8 +3045,16 @@ class LeadsController extends BaseController
'cd_amount' => $params['cd_amount'] ?? null,
'no_of_installment' => $params['no_of_installment'] ?? null,
'is_installment' => $params['is_installment'] ?? null,
+ 'is_installment' => $params['is_installment'] ?? null,
+ 'acm_id' => $params['acm_pk'] ?? null,
];
+ if(isset($params['tpa_id']) && !empty($params['tpa_id'])){
+ list($tpaBranchId, $tpaId) = explode('-', $params['tpa_id']);
+ $data['tpa_branch_id'] = $tpaBranchId;
+ $data['tpa_id'] = $tpaId;
+ }
+
$this->leadsModel->where('id', $lead_id)->set($data)->update();
if (isset($params['installments']) && !empty($params['installments'])) {
@@ -3639,7 +3842,7 @@ class LeadsController extends BaseController
$this->loadLayout('view_rfq_non_eb');
}
- // get lead data for edit bot EB and NON-EB
+ // get lead data for edit both EB and NON-EB
public function getLeadNonEB($type, $id = null)
{
// Set basic data
@@ -4899,7 +5102,7 @@ class LeadsController extends BaseController
$lower_headers = array_map('strtolower', $members_heading);
foreach ($lower_headers as $index => $header) {
- if (preg_match('/^sa\s*-\s*option\s*\d*$/i', $header)) {
+ if (preg_match('/^(sa\s*-\s*option|proposed\s+sum\s+insured)\s+\d+$/i', $header)) {
$column_name = $members_heading[$index];
$sum = 0;
@@ -5166,5 +5369,182 @@ class LeadsController extends BaseController
return ['status' => true, "data" => $reminder_sended_lead];
}
+ public function uploadMultiFileFromRfq()
+ {
+ try {
+
+ $this->myLogger->logme('error', "uploadMultiFileFromRfq START");
+ $this->myLogger->logme('error', "Files received: " . json_encode($this->request->getPost() ?? []));
+
+ $lead_id = $this->request->getPost('lead_id');
+ $lead_form_type = $this->request->getPost('lead_form_type');
+ $leads_file_primary_key = $this->request->getPost('leads_file_id') ?? [];
+ $docs_name = $this->request->getPost('docs_name') ?? [];
+ $files = $this->request->getFileMultiple('file_name');
+
+ if (empty($files) || empty($docs_name)) {
+ $this->myLogger->logme('error', "No files or document names provided");
+ return $this->respond([
+ 'status' => false,
+ 'code' => 400,
+ 'message' => 'No files or document names provided'
+ ], 400);
+ }
+
+ // Upload process
+ $multi_file_data = $this->uploadMultiFiles($files, $docs_name, $leads_file_primary_key) ?? [];
+
+ $this->myLogger->logme('error', "uploadMultiFiles result: " . json_encode($multi_file_data ?? []));
+
+ if (!empty($multi_file_data)) {
+ $this->insertMultiFilesData($multi_file_data, $lead_id, $lead_form_type);
+ $this->myLogger->logme('error', "Files inserted successfully into DB");
+
+ // update lead file name if change
+ if(isset($multi_file_data[0]['file_name']) && !empty($multi_file_data[0]['file_name'])){
+ $this->leadsModel->where('id', $lead_id)->set('file_name', $multi_file_data[0]['file_name'])->update();
+ }
+
+ } else {
+ $this->myLogger->logme('error', "uploadMultiFiles returned empty");
+ }
+
+
+ // Get the updated lead file data
+ $lead_file_data = $this->leadFilesModel
+ ->where('is_active', 1)
+ ->where('lead_id', $lead_id)
+ ->findAll();
+
+ $this->myLogger->logme('error', "Fetched " . count($lead_file_data) . " lead file records");
+
+ $document_data = $this->renderFileFields($lead_file_data);
+ $attch_data['multi_file_data'] = $lead_file_data;
+ $attachment_html = view('rfq/attachment_files', $attch_data) ?? "";
+
+ $this->myLogger->logme('error', "uploadMultiFileFromRfq END");
+
+ return $this->respond([
+ 'status' => true,
+ 'code' => 200,
+ 'message' => "File uploaded Successfully",
+ 'document_data' => $document_data,
+ 'attachment_html' => $attachment_html,
+ ], 200);
+
+ } catch (\Throwable $e) {
+
+ $errorDetails = [
+ 'error_message' => $e->getMessage(),
+ 'file' => $e->getFile(),
+ 'line' => $e->getLine(),
+ 'stack_trace' => $e->getTraceAsString(),
+ ];
+
+ // Catch any error/exception and log with trace
+ $this->myLogger->logme('error', "Exception in uploadMultiFileFromRfq: " . json_encode($errorDetails));
+
+ return $this->respond([
+ 'status' => false,
+ 'code' => 500,
+ 'message' => "File upload failed: " . $e->getMessage(),
+ 'errorDetails' => $errorDetails,
+ ], 500);
+ }
+ }
+
+
+ function renderFileFields($multi_file_data = [])
+ {
+ $uploadFilePath = WRITEPATH . 'uploads/lead_files/';
+ $html = '';
+
+ // If data exists (edit mode)
+ if (!empty($multi_file_data)) {
+
+ foreach ($multi_file_data as $index => $value) {
+
+ $sample_dwn_link = ' [
Download ]';
+ $isFirstField = ($index === 0);
+ $placeholder = $isFirstField ? 'First file must be Demography.' : '';
+ $first_file_name = $isFirstField ? 'Member List' : '';
+ $member_data_link = $isFirstField ? $sample_dwn_link : '';
+ $read_only = $isFirstField ? 'readonly' : '';
+ $accept = $isFirstField ? '.xls,.xlsx' : '';
+ $displayIndex = $index + 1;
+
+ $html .= '
+
';
+ }
+ } else {
+ // Default (add mode)
+ $html .= '
+
';
+ }
+
+ return $html;
+ }
+
+ public function downloadMemberFile($fileName)
+ {
+ $filePath = WRITEPATH . 'uploads/lead_files/' . $fileName;
+
+ if (!file_exists($filePath)) {
+ $data['message'] = 'The Physical File Not Found';
+ echo view('errors/404', $data);
+ }
+
+ // force download
+ return $this->response->download($filePath, null);
+ }
+
}
diff --git a/app/Controllers/PolicyTransactionController.php b/app/Controllers/PolicyTransactionController.php
index 8b2a80bb..8e8a74e1 100644
--- a/app/Controllers/PolicyTransactionController.php
+++ b/app/Controllers/PolicyTransactionController.php
@@ -1241,7 +1241,8 @@ class PolicyTransactionController extends BaseController
$issue_type = $this->policyTransactionModel
->where('action_type', 'inception')
->where('client_id', $this->request->getPost('client_id'))
- ->where('client_policy_id', $this->request->getPost('client_policy_id'))
+ // ->where('client_policy_id', $this->request->getPost('client_policy_id'))
+ ->where('id', $this->request->getPost('client_policy_id'))
->where('policy_transaction.is_active', 1)
->first();
@@ -3054,9 +3055,28 @@ class PolicyTransactionController extends BaseController
$clientIds = array_column($clients, 'id');
- $policies = $this->clientPolicyModel
+ // $policies = $this->clientPolicyModel
+ // ->select("
+ // client_policy.*,
+ // policy_type.policy_type,
+ // policy_type.ebp,
+ // policy_type.etp,
+ // policy_type.iep,
+ // policy_type.itp,
+ // policy_type.bap,
+ // policy_type.allocg,
+ // DATE_FORMAT(client_policy.policy_start_date, '%d/%m/%Y') as policy_start_date,
+ // DATE_FORMAT(client_policy.policy_end_date, '%d/%m/%Y') as policy_end_date
+ // ")
+ // ->join('policy_type', 'policy_type.id = client_policy.policy_type_id')
+ // ->join('policy_transaction pt', 'pt.client_policy_id = client_policy.id and pt.action_type = "inception" and pt.is_active = 1 and pt.client_policy_id is not null')
+ // ->whereIn('client_policy.client_id', $clientIds)
+ // ->where('client_policy.is_active', 1)
+ // ->findAll();
+
+ $policies = $this->policyTransactionModel
->select("
- client_policy.*,
+ policy_transaction.*,
policy_type.policy_type,
policy_type.ebp,
policy_type.etp,
@@ -3064,14 +3084,14 @@ class PolicyTransactionController extends BaseController
policy_type.itp,
policy_type.bap,
policy_type.allocg,
- DATE_FORMAT(client_policy.policy_start_date, '%d/%m/%Y') as policy_start_date,
- DATE_FORMAT(client_policy.policy_end_date, '%d/%m/%Y') as policy_end_date
+ DATE_FORMAT(policy_transaction.policy_start_date, '%d/%m/%Y') as policy_start_date,
+ DATE_FORMAT(policy_transaction.policy_end_date, '%d/%m/%Y') as policy_end_date
")
- ->join('policy_type', 'policy_type.id = client_policy.policy_type_id')
- ->join('policy_transaction pt', 'pt.client_policy_id = client_policy.id and pt.action_type = "inception" and pt.is_active = 1 and pt.client_policy_id is not null')
- ->whereIn('client_policy.client_id', $clientIds)
- ->where('client_policy.is_active', 1)
- ->findAll();
+ ->join('policy_type', 'policy_type.id = policy_transaction.policy_type_id')
+ ->whereIn('policy_transaction.client_id', $clientIds)
+ ->where('policy_transaction.is_active', 1)
+ ->where('policy_transaction.action_type', "inception")
+ ->findAll();
foreach ($policies as $policy) {
$policyList[$policy['client_branch_id']][] = $policy;
diff --git a/app/Views/layout/header.php b/app/Views/layout/header.php
index 8857a211..4120c3ea 100755
--- a/app/Views/layout/header.php
+++ b/app/Views/layout/header.php
@@ -1460,7 +1460,7 @@
-
+
@@ -1470,27 +1470,39 @@
diff --git a/app/Views/leads_form_handler.php b/app/Views/leads_form_handler.php
index 2367957c..8d7e7fdb 100644
--- a/app/Views/leads_form_handler.php
+++ b/app/Views/leads_form_handler.php
@@ -238,17 +238,19 @@ if (isset($selected_lead_type)) {
}));
$.each(data, function(index, item) {
- var option = $('