This commit is contained in:
velz 2024-10-05 09:32:15 +05:30
parent e82e55d672
commit c180192a52
6 changed files with 118 additions and 42 deletions

View File

@ -214,25 +214,25 @@ class PolicyTransactionController extends BaseController
// $data['renewal_date'] = change_date_format($this->request->getPost('renewal_date'), 'd/m/Y', 'Y-m-d') ?? null;
// $data['rollover_date'] = change_date_format($this->request->getPost('rollover_date'), 'd/m/Y', 'Y-m-d') ?? null;
$data['policy_issue_date'] = (isset($data['policy_issue_date']) && $data['policy_issue_date'] !== null && $data['policy_issue_date'] !== '')
? date('d/m/Y', strtotime($data['policy_issue_date']))
: null;
// $data['policy_issue_date'] = (isset($data['policy_issue_date']) && $data['policy_issue_date'] !== null && $data['policy_issue_date'] !== '')
// ? date('d/m/Y', strtotime($data['policy_issue_date']))
// : null;
$data['policy_start_date'] = (isset($data['policy_start_date']) && $data['policy_start_date'] !== null && $data['policy_start_date'] !== '')
? date('d/m/Y', strtotime($data['policy_start_date']))
: null;
// $data['policy_start_date'] = (isset($data['policy_start_date']) && $data['policy_start_date'] !== null && $data['policy_start_date'] !== '')
// ? date('d/m/Y', strtotime($data['policy_start_date']))
// : null;
$data['policy_end_date'] = (isset($data['policy_end_date']) && $data['policy_end_date'] !== null && $data['policy_end_date'] !== '')
? date('d/m/Y', strtotime($data['policy_end_date']))
: null;
// $data['policy_end_date'] = (isset($data['policy_end_date']) && $data['policy_end_date'] !== null && $data['policy_end_date'] !== '')
// ? date('d/m/Y', strtotime($data['policy_end_date']))
// : null;
$data['renewal_date'] = (isset($data['renewal_date']) && $data['renewal_date'] !== null && $data['renewal_date'] !== '')
? date('d/m/Y', strtotime($data['renewal_date']))
: null;
// $data['renewal_date'] = (isset($data['renewal_date']) && $data['renewal_date'] !== null && $data['renewal_date'] !== '')
// ? date('d/m/Y', strtotime($data['renewal_date']))
// : null;
$data['rollover_date'] = (isset($data['rollover_date']) && $data['rollover_date'] !== null && $data['rollover_date'] !== '')
? date('d/m/Y', strtotime($data['rollover_date']))
: null;
// $data['rollover_date'] = (isset($data['rollover_date']) && $data['rollover_date'] !== null && $data['rollover_date'] !== '')
// ? date('d/m/Y', strtotime($data['rollover_date']))
// : null;
// Separate Insurer and TPA Branch IDs and IDs
@ -268,8 +268,8 @@ class PolicyTransactionController extends BaseController
$data['ct_type'] = 1;
}
$month = '01-'.(string)$this->request->getPost('month');
$data['month'] = empty($data['month']) ? null : date('Y-m-d', strtotime($month));
// $month = '01-'.(string)$this->request->getPost('month');
// $data['month'] = empty($data['month']) ? null : date('Y-m-d', strtotime($month));
// Determine $is_addon value
$data['is_addon'] = in_array($data['policy_type_id'], [1, 2, 6, 7]) ? 1 :
@ -825,12 +825,13 @@ class PolicyTransactionController extends BaseController
$endorse_eff_date = (string)$this->request->getPost('endorse_eff_date');
$month = (string)$this->request->getPost('month');
$data['data_received_date'] = empty($data['data_received_date']) ? null : date('Y-m-d', strtotime($data_received_date));
$data['closure_date'] = empty($data['closure_date']) ? null : date('Y-m-d', strtotime($closure_date));
$data['endorse_eff_date'] = empty($data['endorse_eff_date']) ? null : date('Y-m-d', strtotime($endorse_eff_date));
$data['data_received_date'] = empty($data['data_received_date']) ? null : change_date_format($data_received_date,'d/m/Y','Y-m-d');
//date('Y-m-d', strtotime($data_received_date));
$data['closure_date'] = empty($data['closure_date']) ? null : change_date_format($closure_date,'d/m/Y','Y-m-d');
$data['endorse_eff_date'] = empty($data['endorse_eff_date']) ? null : change_date_format($endorse_eff_date,'d/m/Y','Y-m-d');
$month = '01-'.$data['month'];
$data['month'] = empty($data['month']) ? null : date('Y-m-d', strtotime($month));
$month = $data['month'].'/01';
$data['month'] = empty($data['month']) ? null : change_date_format($month,'M/Y/d','Y-m-d');
// Separate Insurer and TPA Branch IDs and IDs
if(isset($data['insurer_id']) && !empty($data['insurer_id'])){
@ -934,7 +935,7 @@ class PolicyTransactionController extends BaseController
{
if ($data['status'] == 'completed' && $data['ct_type'] == 2) {
$tolamt = $data['total'][0] ?? 0;
$tolamt = isset($data['total'][0]) && is_numeric($data['total'][0]) ? $data['total'][0] : 0;
$description = 'The following amount of Rs. ' . round($tolamt, 2) . '/- has been' .
($data['action_type'] == 'deletion' ? ' Credit ' : ' Debit ') . 'from the policy transaction';

View File

@ -479,12 +479,25 @@ class PolicyTransactionModel extends Model
pt_co_share_details.exp_amt,
pt_co_share_details.variance,
insurer_statements.invoice_amount,
insurer_statements.invoice_status,
ROUND((pt_co_share_details.actual_bp_brokerage_amt + pt_co_share_details.actual_tp_brokerage_amt + pt_co_share_details.actual_tep_brokerage_amt), 2) AS realization_amount
ROUND((pt_co_share_details.actual_bp_brokerage_amt + pt_co_share_details.actual_tp_brokerage_amt + pt_co_share_details.actual_tep_brokerage_amt), 2) AS realization_amount2,
(
SELECT
(SUM(inv_payment_details.inv_amt) + SUM(inv_payment_details.tds)) AS realization_amount
FROM
inv_payment_details
WHERE
inv_payment_details.statement_id = insurer_statements.id
AND inv_payment_details.is_active = 1
) AS realization_amount,
")
->join('pt_co_share_details', 'policy_transaction.id = pt_co_share_details.pt_id', 'left')
->join('insurer_statements', 'pt_co_share_details.statement_id = insurer_statements.id', 'left')
->join('inv_payment_details', 'insurer_statements.id = inv_payment_details.statement_id', 'left')
->join('clients', 'clients.id = policy_transaction.client_id', 'left')
->join('insurers', 'pt_co_share_details.insurer_id = insurers.id', 'left')
->join('client_policy', 'policy_transaction.client_policy_id = client_policy.id', 'left')

View File

@ -109,7 +109,7 @@
</div>
<div class="col-6" style="text-align: right;">
<a href="<?= base_url('policy_tranction/endorsement/list') ?>" id="btnAdd" class="btn btn-primary waves-effect waves-light"
onclick="//show_list_hide_add()">Back</a>
>Back</a>
</div>
</div>
<form role="form" class="parsley-examples" method="post" id="endorsement_form_id" enctype="multipart/form-data">
@ -555,7 +555,7 @@ $(document).ready(function(){
}else{
addInsurerColumn()
}
hidePermiumDetailsBasedOnTheTeam();
},
error: function (xhr, status, error) {
console.error(xhr.responseText);
@ -564,6 +564,8 @@ $(document).ready(function(){
});
}
});
})
@ -1184,8 +1186,8 @@ function hidePermiumDetailsBasedOnTheTeam(){
// $('#' + id + ' input, #' + id + ' select, #' + id + ' textarea').prop('disabled', true); // Disable inputs
});
$('.hideter').hide()
$('.hidetp').hide()
$('.hideter').hide();
$('.hidetp').hide();
}
}
@ -1236,7 +1238,7 @@ $('#setInsurerCount').on('input', function() {
function addInsurerColumn() {
insurerCount++;
hidePermiumDetailsBasedOnTheTeam()
hidePermiumDetailsBasedOnTheTeam();
// Update header
$('#insurerTable thead tr').append(`

View File

@ -179,6 +179,7 @@ table.dataTable thead th {
<table class="table table-striped mb-0 nowrap" cellspacing="0" id="tickets-table">
<thead class="bg-light">
<tr>
<th>Sno</th>
<th>Issuer</th>
<th>Client</th>
<th>Branch</th>

View File

@ -140,7 +140,7 @@
</div>
<div class="col-1" style="text-align: right; position: relative; left: 193px;">
<a href="<?= base_url('policy_tranction/inception/list') ?>" type="button" id="btnAdd" class="btn btn-primary waves-effect waves-light"
onclick="//show_list_hide_add()">Back</a>
>Back</a>
</div>
</div>
<form role="form" class="parsley-examples" method="post" id="inception_form_id"
@ -1080,7 +1080,7 @@ $(document).ready(function(){
$('#policy_type_id').change(function() {
hidePermiumDetailsBasedOnTheTeam()
hidePermiumDetailsBasedOnTheTeam();
$('#client_type').val('');
$('#client_id').val('').select2();
@ -1116,11 +1116,11 @@ $(document).ready(function(){
$('.hidetp').hide();
}else{
if(bap == 'Motor'){
$('.hidetp').show()
$('.hideter').hide()
$('.hidetp').show();
$('.hideter').hide();
}else{
$('.hideter').hide()
$('.hidetp').hide()
$('.hideter').hide();
$('.hidetp').hide();
}
}
@ -1147,6 +1147,8 @@ $(document).ready(function(){
$('#client_id').removeClass('readonly-select ').select2();
$('#client_branch_id').removeClass('readonly-select ').select2();
}
hidePermiumDetailsBasedOnTheTeam();
});
})
@ -2187,13 +2189,39 @@ function hidePermiumDetailsBasedOnTheTeam(){
// $('#' + id + ' input').prop('disabled', true);
});
$('.hideter').hide()
$('.hidetp').hide()
$('.hideter').hide();
$('.hidetp').hide();
}
}
//---------------------------------------------------------------------------------------------------------
function convertToMySQLDate(dateString) {
// console.log('convertToMySQLDate' + dateString);
if(dateString !== "" && dateString !== undefined)
{
// Split the input date string by '/'
const [day, month, year] = dateString.split('/');
// Return the date in MySQL format: YYYY-MM-DD
return `${year}-${month}-${day}`;
}
return '';
}
function convertMonthYearToMySQLDate(dateString) {
// console.log('convertMonthYearToMySQLDate' + dateString);
if(dateString !== "" && dateString !== undefined)
{
// Create a new Date object using the string with '01' as the day
const date = new Date(dateString + '/01');
// Format the date to MySQL style: YYYY-MM-DD
return date.toISOString().split('T')[0];
}
return '';
}
$("#inception_form_id").submit(function(event) {
@ -2255,6 +2283,9 @@ $("#inception_form_id").submit(function(event) {
var formData = new FormData($('#inception_form_id')[0]);
console.log(formData);
const jsonString = JSON.stringify(shortListedInsurer);
// console.log('jsonString', jsonString);
@ -2263,7 +2294,23 @@ $("#inception_form_id").submit(function(event) {
co_share_type.forEach((value, index) => {
formData.append(`co_share_type[${index}]`, value);
});
//covert date to mysql format
// alert(formData.get('policy_issue_date'));
formData.set('policy_issue_date',convertToMySQLDate(formData.get('policy_issue_date')));
formData.set('policy_start_date',convertToMySQLDate(formData.get('policy_start_date')));
formData.set('policy_end_date',convertToMySQLDate(formData.get('policy_end_date')));
formData.set('renewal_date',convertToMySQLDate(formData.get('renewal_date')));
formData.set('rollover_date',convertToMySQLDate(formData.get('rollover_date')));
formData.set('month',convertMonthYearToMySQLDate(formData.get('month')));
// formData['policy_start_date'] = convertToMySQLDate(formData['policy_start_date']);
// formData['policy_end_date'] = convertToMySQLDate(formData['policy_end_date']);
// formData['renewal_date'] = convertToMySQLDate(formData['renewal_date']);
// formData['rollover_date'] = convertToMySQLDate(formData['rollover_date']);
// formData['month'] = convertMonthYearToMySQLDate(formData['month']);
// console.log(formData);
// return false;
$.ajax({
data: formData,
url: form_action,

View File

@ -16,6 +16,14 @@ table.dataTable tbody td {
.dataTables_filter {
position: absolute;
}
.right-align-input {
text-align: right;
}
.center-align-input {
text-align: center;
}
</style>
<div class="row" id="varience_filter">
@ -153,9 +161,11 @@ table.dataTable tbody td {
<th>Client Name</th>
<th>Insurer</th>
<th>Policy</th>
<th>Policy No</th>
<!-- <th>Policy No</th> -->
<th>Endorsement No</th>
<th>Expected Amount</th>
<th>Invoice Status</th>
<th>Invoice Amount</th>
<th>Realization Amount</th>
<th>Variance</th>
<!-- <th>Action</th> -->
@ -168,11 +178,13 @@ table.dataTable tbody td {
<td><?= $index + 1 ?></td>
<td><?php echo $row['client_name']; ?></td>
<td><?php echo $row['insurer_name']; ?></td>
<td><?php echo $row['policy_type']; ?></td>
<td><?php echo $row['policy_no']; ?></td>
<td><?php echo $row['policy_type'] .' - '. $row['policy_no']; ?></td>
<!-- <td><?php echo $row['policy_no']; ?></td> -->
<td><?php echo $row['endorsement_no']; ?></td>
<td class="right-align-input"><?php echo $row['exp_amt']; ?></td>
<td class="right-align-input"><?php echo $row['realization_amount']; ?></td>
<td class="center-align-input"><?php echo isset($row['invoice_status']) ? $row['invoice_status'] : ' - '; ?></td>
<td class="right-align-input"><?php echo isset($row['invoice_amount']) ? $row['invoice_amount'] : '0.00'; ?></td>
<td class="right-align-input"><?php echo isset($row['realization_amount']) ? $row['realization_amount'] : '0.00'; ?></td>
<td class="right-align-input"><?php echo $row['variance']; ?></td>
<!-- <td>
<div class="btn-group dropdown">