diff --git a/app/Config/Routes.php b/app/Config/Routes.php
index 2a41fda8..9996931c 100755
--- a/app/Config/Routes.php
+++ b/app/Config/Routes.php
@@ -386,6 +386,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");
@@ -695,6 +697,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/ClientController.php b/app/Controllers/ClientController.php
index 34830575..c7e9beaf 100755
--- a/app/Controllers/ClientController.php
+++ b/app/Controllers/ClientController.php
@@ -4564,11 +4564,11 @@ class ClientController extends AdminController
// Additional logic for non-individual clients (client_type != 2)
$branch_insert = null;
if ($client_type != 2) {
- $unit[] = $postData['short_name'] . '-' . 001;
+ $unit[] = $postData['short_name'] . '-' . $postData['branch_code'] ?? 001;
$branch_data = [
'client_id' => $client_insert,
'branch_name' => $postData['branch_name'],
- 'branch_code' => 001,
+ 'branch_code' => $postData['branch_code'] ?? 001,
'gst' => $postData['gst'],
'units' => json_encode($unit) ?? null,
];
@@ -4580,6 +4580,7 @@ class ClientController extends AdminController
'contact_type' => 'client',
'name' => $postData['name'],
'email' => $postData['email'],
+ 'mobile' => $postData['mobile'] ?? null,
];
$this->levelContactModel->insert($contact_data);
}
diff --git a/app/Controllers/LeadsController.php b/app/Controllers/LeadsController.php
index 09db4318..308e7184 100644
--- a/app/Controllers/LeadsController.php
+++ b/app/Controllers/LeadsController.php
@@ -529,7 +529,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)
{
@@ -604,7 +604,7 @@ class LeadsController extends BaseController
}
public function uploadMultiFiles($files, $docs_names, $primaryKey)
- {
+ {
$uploadFilePath = WRITEPATH . 'uploads/lead_files/';
$multi_file_data = [];
@@ -697,64 +697,288 @@ 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()
@@ -1454,20 +1629,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'],
@@ -1476,30 +1653,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'],
];
}
}
@@ -2827,6 +3006,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') {
@@ -2852,8 +3047,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'])) {
@@ -3641,7 +3844,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
@@ -4901,7 +5104,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;
@@ -5168,5 +5371,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 19e2addd..db8be45b 100644
--- a/app/Controllers/PolicyTransactionController.php
+++ b/app/Controllers/PolicyTransactionController.php
@@ -1243,7 +1243,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();
@@ -3062,9 +3063,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,
@@ -3072,14 +3092,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/Controllers/RestAuthenticationController.php b/app/Controllers/RestAuthenticationController.php
index f5b918c4..26c8aedc 100755
--- a/app/Controllers/RestAuthenticationController.php
+++ b/app/Controllers/RestAuthenticationController.php
@@ -503,14 +503,14 @@ class RestAuthenticationController extends AdminController
log_message('error', ' ');
log_message('error', '************************ POST END ********************************');
log_message('error', ' ');
- return $this->respond(['status' => 'failed','code' => 404,'data' => []],200);
+ return $this->respond(['status' => 'failed','code' => 404,'data' => "", 'message' => 'No data found'],200);
}
} catch (\Exception $e) {
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - getVerifiedUserData: Exception: " . $e->getMessage() . " --- Line: " . $e->getLine() . " --- Trace: " . $e->getTraceAsString());
log_message('error', ' ');
log_message('error', ' ************************************* POST END **************************************** ');
log_message('error', ' ');
- return $this->respond(['status' => 'failed','code' => 500,'data' =>[], 'error' => $e->getMessage()],500);
+ return $this->respond(['status' => 'failed','code' => 500,'data' => "", 'message' => $e->getMessage()],500);
}
}
@@ -862,7 +862,7 @@ class RestAuthenticationController extends AdminController
log_message('error', ' ');
log_message('error', ' ************************************* POST END **************************************** ');
log_message('error', ' ');
- return $this->respond(['status' => 'failed','code' => 500,'data' => $th],500);
+ return $this->respond(['status' => 'failed','code' => 500,'data' => "", 'message' => $th],500);
}
}
@@ -966,7 +966,7 @@ class RestAuthenticationController extends AdminController
log_message('error', ' ');
log_message('error', ' ************************************* POST END **************************************** ');
log_message('error', ' ');
- return $this->respond(['status' => 'failed','code' => 500,'data' => $th],500);
+ return $this->respond(['status' => 'failed','code' => 500,'data' => "", 'message' => $th],500);
}
}
@@ -1200,13 +1200,13 @@ class RestAuthenticationController extends AdminController
log_message('error', ' ');
log_message('error', ' ************************************* POST END **************************************** ');
log_message('error', ' ');
- return $this->respond(['status' => 'success','code' => 200,'data' => "Mpin - exist" , 'Mpin' =>$employeeData["mpin"], 'is_mpin_skipped' => $employeeData['is_mpin_skipped'], 'is_biometric_enabled' => $employeeData['is_biometric_enabled']],200);
+ return $this->respond(['status' => 'success','code' => 200,'data' => "", 'message' => "Mpin - exist" , 'Mpin' =>$employeeData["mpin"], 'is_mpin_skipped' => $employeeData['is_mpin_skipped'], 'is_biometric_enabled' => $employeeData['is_biometric_enabled']],200);
} else {
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - checkMpin: Mpin - not found");
log_message('error', ' ');
log_message('error', ' ************************************* POST END **************************************** ');
log_message('error', ' ');
- return $this->respond(['status' => 'failed','code' => 404,'data' => "Mpin - not found", 'Mpin' =>null],200);
+ return $this->respond(['status' => 'failed','code' => 404,'data' => "", 'message' => "Mpin - not found", 'Mpin' =>null],200);
}
} catch (\Exception $e) {
@@ -1215,7 +1215,7 @@ class RestAuthenticationController extends AdminController
log_message('error', ' ************************************* POST END **************************************** ');
log_message('error', ' ');
- return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()],500);
+ return $this->respond(['status' => 'failed','code' => 500,'data' => "", 'message' => $e->getMessage()],500);
}
}
diff --git a/app/Controllers/TestingController.php b/app/Controllers/TestingController.php
index cb432d24..87310adc 100644
--- a/app/Controllers/TestingController.php
+++ b/app/Controllers/TestingController.php
@@ -5,6 +5,7 @@ namespace App\Controllers;
use App\Controllers\BaseController;
use App\Models\EmployeePolicyModel;
use App\Models\InsurerBranchModel;
+use App\Models\RFQModel;
use CodeIgniter\HTTP\ResponseInterface;
use CodeIgniter\API\ResponseTrait;
use Dompdf\Dompdf;
@@ -313,4 +314,36 @@ class TestingController extends BaseController
return $html;
}
+ public function viewRFQNonEb()
+ {
+ $insurerBranchModel = new InsurerBranchModel();
+ $data['page_name'] = "RFQ NON EB";
+ $data['insurer'] = $insurerBranchModel->getInsurerBranchesWithInsurerNames();
+ // dd($data);
+ return $this->loadLayout('view_rfq_non_eb_new', $data);
+ }
+
+ public function saverfq(){
+ $json = $this->request->getPost('json');
+ $json = json_encode($json);
+ print_r($json);
+
+ // $data['lead_id'] = 10000;
+ // $data['json'] = $json;
+ // $rfq = new RFQModel();
+
+ // $rfq->insert($data);
+ }
+
+ public function exportExcel()
+ {
+ $rfq = new RFQModel();
+ $policy_data = $rfq->where('lead_id', 10000)->first();
+ // print_rr($policy_data['json']); die;
+ $policy_data = json_decode($policy_data['json'], true);
+ $policy_data = array_slice($policy_data, 0, -2);
+ print_rr($policy_data); die;
+ dd($policy_data);
+ }
+
}
diff --git a/app/Models/LeadsModel.php b/app/Models/LeadsModel.php
index 67a354b1..005eacd2 100644
--- a/app/Models/LeadsModel.php
+++ b/app/Models/LeadsModel.php
@@ -105,6 +105,7 @@ class LeadsModel extends Model
'next_reminder_date',
'is_insurer_auto_mail',
'quote_received_insurer',
+ 'acm_id',
];
diff --git a/app/Views/layout/header.php b/app/Views/layout/header.php
index ca5466ba..cd3f6886 100755
--- a/app/Views/layout/header.php
+++ b/app/Views/layout/header.php
@@ -1751,41 +1751,53 @@
-
-
+
+
/assets/images/masters_sb.png" alt="Logo" height="20">
- Masters
-
-
-
+
Masters
+
+
+
diff --git a/app/Views/leads_form_handler.php b/app/Views/leads_form_handler.php
index 0235dccf..477e610b 100644
--- a/app/Views/leads_form_handler.php
+++ b/app/Views/leads_form_handler.php
@@ -189,7 +189,7 @@ if (isset($selected_lead_type)) {
$('#leads_form').hide()
}
- function getClientAndBranchAndPolicy() {
+ function getClientAndBranchAndPolicy(append = true) {
console.log('getClientAndBranchAndPolicy function called')
@@ -204,7 +204,9 @@ if (isset($selected_lead_type)) {
client_list = res.client_data;
branch_list = res.branch_data;
policy_list = res.policy_data;
- appendClients(res.client_data);
+ if(append == true){
+ appendClients(res.client_data);
+ }
} else {
console.log('No data found');
}
@@ -217,7 +219,7 @@ if (isset($selected_lead_type)) {
});
}
- function appendClients(data) {
+ function appendClients(data, client_id = null) {
// console.log("lead_type",lead_type.value);
$('#client_id').empty();
@@ -238,22 +240,28 @@ if (isset($selected_lead_type)) {
}));
$.each(data, function(index, item) {
- var option = $('