FEAT_PLACELEMNT_CRON
This commit is contained in:
parent
f1e66204bf
commit
237bd215a3
@ -360,6 +360,9 @@ $routes->group("/util", ["filter" => "authMVC"], function ($routes) {
|
|||||||
$routes->get('removeInstallments', 'LeadsController::removeInstallments');
|
$routes->get('removeInstallments', 'LeadsController::removeInstallments');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$routes->post("policy_tranction/sendInstallmentRemainderMail","PolicyTransactionController::sendInstallmentRemainderMail");
|
||||||
|
$routes->cli("cli/sendInstallmentRemainderMail","PolicyTransactionController::sendInstallmentRemainderMail");
|
||||||
|
|
||||||
$routes->group("policy_tranction", ["filter" => "authMVC"], function ($routes) {
|
$routes->group("policy_tranction", ["filter" => "authMVC"], function ($routes) {
|
||||||
|
|
||||||
$routes->group("inception", ["filter" => "authMVC"], function ($routes) {
|
$routes->group("inception", ["filter" => "authMVC"], function ($routes) {
|
||||||
|
|||||||
@ -1680,7 +1680,7 @@ class MasterController extends AdminController
|
|||||||
["filePath" => ROOTPATH."public/sample_excel/sample_inception.xls","fileName" => "sample_inception.xls"],
|
["filePath" => ROOTPATH."public/sample_excel/sample_inception.xls","fileName" => "sample_inception.xls"],
|
||||||
["filePath" => ROOTPATH."public/assets/images/login_bg.jpg","fileName" => "login_bg.jpg"]
|
["filePath" => ROOTPATH."public/assets/images/login_bg.jpg","fileName" => "login_bg.jpg"]
|
||||||
];
|
];
|
||||||
$email_id = 'srinivas.saravanan@venbainfotech.com';
|
$email_id = ['srinivas.saravanan@venbainfotech.com','srinivassaravanan2002@gmail.com'];
|
||||||
$params = ['mail'=>$email_id];
|
$params = ['mail'=>$email_id];
|
||||||
$common = ['mail_type'=>'test_mail_cli'];
|
$common = ['mail_type'=>'test_mail_cli'];
|
||||||
// $bcc = "vijayalakshmi@nhanceindia.in,vitvelz@gmail.com,velmurugan.s@venbainfotech.com,hariharan@nhanceindia.in,hariharan@jubiliant.in,srinivas.saravanan@venbainfotech.com";
|
// $bcc = "vijayalakshmi@nhanceindia.in,vitvelz@gmail.com,velmurugan.s@venbainfotech.com,hariharan@nhanceindia.in,hariharan@jubiliant.in,srinivas.saravanan@venbainfotech.com";
|
||||||
|
|||||||
@ -32,10 +32,13 @@ use App\Models\InvPaymentDetailsModel;
|
|||||||
use App\Models\BatchFileModel;
|
use App\Models\BatchFileModel;
|
||||||
use App\Models\FileModel;
|
use App\Models\FileModel;
|
||||||
use App\Models\COShareStmtDetailsModel;
|
use App\Models\COShareStmtDetailsModel;
|
||||||
use Kint;
|
use App\Models\BdsPlacementModel;
|
||||||
|
use Kint\Kint;
|
||||||
|
use App\Helpers\MailHelper;
|
||||||
|
use Exception;
|
||||||
|
|
||||||
class PolicyTransactionController extends BaseController
|
class PolicyTransactionController extends BaseController
|
||||||
{
|
{
|
||||||
use ResponseTrait;
|
use ResponseTrait;
|
||||||
|
|
||||||
protected $myLogger;
|
protected $myLogger;
|
||||||
@ -64,6 +67,7 @@ class PolicyTransactionController extends BaseController
|
|||||||
protected $batchFileModel;
|
protected $batchFileModel;
|
||||||
protected $filesModel;
|
protected $filesModel;
|
||||||
protected $coShareStmtDetailsModel;
|
protected $coShareStmtDetailsModel;
|
||||||
|
protected $BdsPlacementModel;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
@ -94,6 +98,7 @@ class PolicyTransactionController extends BaseController
|
|||||||
$this->batchFileModel = new BatchFileModel();
|
$this->batchFileModel = new BatchFileModel();
|
||||||
$this->filesModel = new FileModel();
|
$this->filesModel = new FileModel();
|
||||||
$this->coShareStmtDetailsModel = new COShareStmtDetailsModel();
|
$this->coShareStmtDetailsModel = new COShareStmtDetailsModel();
|
||||||
|
$this->BdsPlacementModel = new BdsPlacementModel();
|
||||||
$this->invoiceStatus = [
|
$this->invoiceStatus = [
|
||||||
'pending' => 'Pending',
|
'pending' => 'Pending',
|
||||||
'generated' => 'Generated',
|
'generated' => 'Generated',
|
||||||
@ -182,8 +187,7 @@ class PolicyTransactionController extends BaseController
|
|||||||
$issuer,
|
$issuer,
|
||||||
$status
|
$status
|
||||||
);
|
);
|
||||||
|
} else {
|
||||||
}else{
|
|
||||||
|
|
||||||
$ids = $this->request->getPost('ids');
|
$ids = $this->request->getPost('ids');
|
||||||
$ids = array_filter(explode(',', $ids));
|
$ids = array_filter(explode(',', $ids));
|
||||||
@ -1831,7 +1835,7 @@ class PolicyTransactionController extends BaseController
|
|||||||
|
|
||||||
if (isset($isFromDashboard) && !empty($isFromDashboard) && $isFromDashboard == 1) {
|
if (isset($isFromDashboard) && !empty($isFromDashboard) && $isFromDashboard == 1) {
|
||||||
$ids = $this->request->getPost('ids');
|
$ids = $this->request->getPost('ids');
|
||||||
|
|
||||||
$ids = array_filter(explode(',', $ids));
|
$ids = array_filter(explode(',', $ids));
|
||||||
|
|
||||||
if (!empty($ids)) {
|
if (!empty($ids)) {
|
||||||
@ -2801,4 +2805,105 @@ class PolicyTransactionController extends BaseController
|
|||||||
->update();
|
->update();
|
||||||
return $this->respond(['dataStatus' => true, 'code' => 200], 200);
|
return $this->respond(['dataStatus' => true, 'code' => 200], 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function sendInstallmentRemainderMail()
|
||||||
|
{
|
||||||
|
|
||||||
|
$this->myLogger->logme("error", "Cron Job For Send Installment Remainder Mail Started");
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
$bdsInstallmentData = $this->BdsPlacementModel->getClientInstallmentDetails();
|
||||||
|
|
||||||
|
}catch (Exception $e) {
|
||||||
|
|
||||||
|
$this->myLogger->logme('error', 'Exception: ' . $e->getMessage() . 'Page: ' . $e->getFile() . ' Line: ' . $e->getLine());
|
||||||
|
|
||||||
|
}
|
||||||
|
$this->myLogger->logme("error", "Data for BDS Installment " . json_encode($bdsInstallmentData));
|
||||||
|
// dd($bdsInstallmentData);
|
||||||
|
|
||||||
|
if (empty($bdsInstallmentData)) {
|
||||||
|
|
||||||
|
$this->myLogger->logme("error", "No Client Installment is Due in the 15th Day");
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($bdsInstallmentData as $installmentData) {
|
||||||
|
|
||||||
|
$mailData = $this->PrepareBDSMailData($installmentData);
|
||||||
|
$to_mail = $mailData['to_mail'];
|
||||||
|
$message = $mailData['message'];
|
||||||
|
$subject = $mailData['subject'];
|
||||||
|
|
||||||
|
$this->myLogger->logme("error", "Installment Pending for" . $subject);
|
||||||
|
|
||||||
|
$common = ['mail_type' => 'installment_amount_due_remainder_mail'];
|
||||||
|
|
||||||
|
$res = MailHelper::send_email(['mail' => $to_mail, 'subject' => $subject, 'message' => $message, 'common' => $common]);
|
||||||
|
|
||||||
|
$res = json_decode($res);
|
||||||
|
$this->myLogger->logme('error', 'res: ' . json_encode($res));
|
||||||
|
|
||||||
|
if ($res->status == 'success') {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception $e) {
|
||||||
|
|
||||||
|
$this->myLogger->logme('error', 'Exception: ' . $e->getMessage() . 'Page: ' . $e->getFile() . ' Line: ' . $e->getLine());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function PrepareBDSMailData($data)
|
||||||
|
{
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
$installment_amount = $data['installment_amount'];
|
||||||
|
$payment_date = date('d-m-Y', strtotime($data['payment_date']));
|
||||||
|
$client = $data['client_name'];
|
||||||
|
$branch = $data['branch_name'];
|
||||||
|
$sales_person_mail = $data['sales_person'];
|
||||||
|
$heads = $data['heads'];
|
||||||
|
$admins = $data['admins'];
|
||||||
|
$buisness_team = $data['buisness_team'];
|
||||||
|
$policy_no = $data['policy_no'];
|
||||||
|
$client_short_name = isset($data['short_name']) && $data['short_name'] != null ? $data['short_name'] : $data['client_name'];
|
||||||
|
|
||||||
|
$subject = "Installment Amount Due For Client - {$client_short_name} - Policy NO({$policy_no}) is Due On - {$payment_date}";
|
||||||
|
|
||||||
|
$message = "Policy Installment for Client - {$client}, Branch - {$branch} is Due on {$payment_date}
|
||||||
|
with amount of {$installment_amount}.<br>
|
||||||
|
Policy No : {$policy_no}";
|
||||||
|
|
||||||
|
|
||||||
|
$to_mail = array_merge(
|
||||||
|
array_column($heads, 'email'),
|
||||||
|
array_column($admins, 'email'),
|
||||||
|
array_column($buisness_team, 'email'),
|
||||||
|
[$sales_person_mail]
|
||||||
|
);
|
||||||
|
|
||||||
|
$to_mail = array_unique($to_mail);
|
||||||
|
|
||||||
|
$this->myLogger->logme("error", "Selected To Address : " . json_encode($to_mail));
|
||||||
|
|
||||||
|
// dd($to_mail);
|
||||||
|
return [
|
||||||
|
'to_mail' => $to_mail,
|
||||||
|
'message' => $message,
|
||||||
|
'subject' => $subject
|
||||||
|
];
|
||||||
|
|
||||||
|
} catch (Exception $e) {
|
||||||
|
|
||||||
|
$this->myLogger->logme('error', 'Exception: ' . $e->getMessage() . 'Page: ' . $e->getFile() . ' Line: ' . $e->getLine());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
93
app/Models/BdsPlacementModel.php
Normal file
93
app/Models/BdsPlacementModel.php
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use CodeIgniter\Model;
|
||||||
|
|
||||||
|
class BdsPlacementModel extends Model
|
||||||
|
{
|
||||||
|
protected $table = 'bds_installment_payment_details';
|
||||||
|
protected $primaryKey = 'id';
|
||||||
|
protected $allowedFields = [
|
||||||
|
'id',
|
||||||
|
'pt_id',
|
||||||
|
'lead_id',
|
||||||
|
'installment_amount',
|
||||||
|
'payment_date',
|
||||||
|
'utr_no',
|
||||||
|
'created_at',
|
||||||
|
'created_by',
|
||||||
|
'updated_at',
|
||||||
|
'updated_by',
|
||||||
|
'is_active'
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
public function getClientInstallmentDetails()
|
||||||
|
{
|
||||||
|
|
||||||
|
$builder = $this->db->table("bds_installment_payment_details bipd")
|
||||||
|
->select("bipd.*, ct.client_name,ct.short_name, cb.branch_name, leads.salse_person_id,cp.policy_no")
|
||||||
|
->join("policy_transaction pt", "pt.id = bipd.pt_id")
|
||||||
|
->join("clients ct", "ct.id = pt.client_id")
|
||||||
|
->join("client_branch cb", "cb.id = pt.client_branch_id")
|
||||||
|
->join("leads", "leads.id = bipd.lead_id")
|
||||||
|
->join("client_policy cp","cp.id = pt.client_policy_id")
|
||||||
|
->where("bipd.is_active", 1)
|
||||||
|
->where("bipd.payment_date", date('Y-m-d', strtotime('+15 days')));
|
||||||
|
|
||||||
|
$data = $builder->get()->getResultArray();
|
||||||
|
|
||||||
|
// Loop through to extract sales person details
|
||||||
|
foreach ($data as &$row) {
|
||||||
|
$sales_person_ids = json_decode($row['salse_person_id'], true);
|
||||||
|
$sales_person_id = $sales_person_ids[0] ?? null;
|
||||||
|
|
||||||
|
if ($sales_person_id) {
|
||||||
|
$user = $this->db->table('user_profiles')
|
||||||
|
->select('email') // or whatever field
|
||||||
|
->where('id', $sales_person_id)
|
||||||
|
->get()
|
||||||
|
->getRowArray();
|
||||||
|
|
||||||
|
$row['sales_person'] = $user['email'] ?? 'N/A';
|
||||||
|
} else {
|
||||||
|
$row['sales_person'] = 'Not Assigned';
|
||||||
|
}
|
||||||
|
|
||||||
|
$head = $this->db->table('user_profiles')
|
||||||
|
->select('email') // or whatever field
|
||||||
|
->where('role', 5)
|
||||||
|
->where('is_active',1)
|
||||||
|
->get()
|
||||||
|
->getResultArray();
|
||||||
|
|
||||||
|
|
||||||
|
$row['heads'] = $head;
|
||||||
|
|
||||||
|
$admin = $this->db->table('user_profiles')
|
||||||
|
->select('email')
|
||||||
|
->where("is_active",1)
|
||||||
|
->where("role",1)
|
||||||
|
->get()
|
||||||
|
->getResultArray();
|
||||||
|
|
||||||
|
$row['admins'] = $admin;
|
||||||
|
|
||||||
|
$buisenessTeam = $this->db->table("user_teams ut")
|
||||||
|
->select("up.email")
|
||||||
|
->join('user_profiles up','up.id = ut.user_id and up.is_active = 1')
|
||||||
|
->where("ut.team_id",7)
|
||||||
|
->where("ut.is_active",1)
|
||||||
|
->get()
|
||||||
|
->getResultArray();
|
||||||
|
|
||||||
|
$row['buisness_team'] = $buisenessTeam;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -541,7 +541,7 @@ class TicketMasterModel extends Model
|
|||||||
AND th.is_active = 1),
|
AND th.is_active = 1),
|
||||||
tm.created_at
|
tm.created_at
|
||||||
)) BETWEEN 13 AND 20 THEN "13-20 Days"
|
)) BETWEEN 13 AND 20 THEN "13-20 Days"
|
||||||
ELSE "Above 20 Days"g
|
ELSE "Above 20 Days"
|
||||||
END AS tat_category',
|
END AS tat_category',
|
||||||
'COUNT(*) AS count'
|
'COUNT(*) AS count'
|
||||||
])
|
])
|
||||||
|
|||||||
@ -777,6 +777,7 @@
|
|||||||
console.log(response.message, 'SUCCESS');
|
console.log(response.message, 'SUCCESS');
|
||||||
$('#appendArea_' + dataIncrement).append(response.data);
|
$('#appendArea_' + dataIncrement).append(response.data);
|
||||||
|
|
||||||
|
console.log("Policy Type ID : ",policy_type_id);
|
||||||
if (policy_type_id == 1 || policy_type_id == 6 || policy_type_id == 7) {
|
if (policy_type_id == 1 || policy_type_id == 6 || policy_type_id == 7) {
|
||||||
|
|
||||||
let newId = 'appendAreaForClaim_' + dataIncrement;
|
let newId = 'appendAreaForClaim_' + dataIncrement;
|
||||||
|
|||||||
@ -719,6 +719,11 @@ if (isset($selected_lead_type)) {
|
|||||||
$('#policy_type_id').val(data.policy_type_id || '').select2();
|
$('#policy_type_id').val(data.policy_type_id || '').select2();
|
||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
$(".loss_date").each(function () {
|
||||||
|
flatpickr(this, {
|
||||||
|
dateFormat: "d-m-Y",
|
||||||
|
});
|
||||||
|
});
|
||||||
}, 1000);
|
}, 1000);
|
||||||
}, 1000);
|
}, 1000);
|
||||||
}, 2000);
|
}, 2000);
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -13,6 +13,21 @@
|
|||||||
} ?>
|
} ?>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group col-md-2">
|
||||||
|
<label for="first_policy_type_${increment}">Policy Type<span class="text-danger">*</span></label>
|
||||||
|
<input type="text" class="form-control" id="first_policy_type_${increment}" name="first_policy_type_[]"
|
||||||
|
value="<?= htmlspecialchars($value['policy_type']) ?>">
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-md-2">
|
||||||
|
<label for="first_date_of_loss_${increment}">Date of Loss<span class="text-danger">*</span></label>
|
||||||
|
<input type="text" class="form-control loss_date" id="first_date_of_loss_${increment}" name="first_date_of_loss_[]"
|
||||||
|
value="<?= htmlspecialchars($value['date_of_loss']) ?>">
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-md-2">
|
||||||
|
<label for="first_cause_of_death_${increment}">Cause Of Loss <span class="text-danger">*</span></label>
|
||||||
|
<input type="text" class="form-control" id="first_cause_of_loss_${increment}" name="first_cause_of_loss[]"
|
||||||
|
value="<?= htmlspecialchars($value['cause_of_loss']) ?>">
|
||||||
|
</div>
|
||||||
<div class="form-group col-md-2">
|
<div class="form-group col-md-2">
|
||||||
<label for="first_claim_amount_${increment}">Claim Amount<span class="text-danger">*</span></label>
|
<label for="first_claim_amount_${increment}">Claim Amount<span class="text-danger">*</span></label>
|
||||||
<input type="text" class="form-control" id="first_claim_amount_${increment}" name="first_claim_amount[]"
|
<input type="text" class="form-control" id="first_claim_amount_${increment}" name="first_claim_amount[]"
|
||||||
@ -23,11 +38,6 @@
|
|||||||
<input type="text" class="form-control" id="first_settled_amount_${increment}" name="first_settled_amount[]"
|
<input type="text" class="form-control" id="first_settled_amount_${increment}" name="first_settled_amount[]"
|
||||||
value="<?= htmlspecialchars($value['settled_amount']) ?>">
|
value="<?= htmlspecialchars($value['settled_amount']) ?>">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-2">
|
|
||||||
<label for="first_cause_of_death_${increment}">Cause Of Loss <span class="text-danger">*</span></label>
|
|
||||||
<input type="text" class="form-control" id="first_cause_of_loss_${increment}" name="first_cause_of_loss[]"
|
|
||||||
value="<?= htmlspecialchars($value['cause_of_loss']) ?>">
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-md-2">
|
<div class="form-group col-md-2">
|
||||||
<label for="first_claim_status_${increment}">Claim Status<span class="text-danger">*</span></label>
|
<label for="first_claim_status_${increment}">Claim Status<span class="text-danger">*</span></label>
|
||||||
<input type="text" class="form-control" id="first_claim_status_${increment}" name="first_claim_status[]"
|
<input type="text" class="form-control" id="first_claim_status_${increment}" name="first_claim_status[]"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user