FIX_CD_ACCOUNT_NUMBER_IN _POLICY_BINDING : RV
This commit is contained in:
parent
6d70b517da
commit
b38ccd6698
@ -206,16 +206,16 @@ class ClientController extends AdminController
|
|||||||
public function view_Deposit($insurerId)
|
public function view_Deposit($insurerId)
|
||||||
{
|
{
|
||||||
// Load your model to fetch data based on $clientId and $insurerId
|
// Load your model to fetch data based on $clientId and $insurerId
|
||||||
$subTypeOptions = [
|
// $subTypeOptions = [
|
||||||
1 => 'Deposit',
|
// 1 => 'Deposit',
|
||||||
2 => 'Adjustment',
|
// 2 => 'Adjustment',
|
||||||
3 => 'Refund',
|
// 3 => 'Refund',
|
||||||
4 => 'Debit',
|
// 4 => 'Debit',
|
||||||
];
|
// ];
|
||||||
$subTypeOptions = [
|
$subTypeOptions = [
|
||||||
1 => 'Replenishment',
|
1 => 'Replenishment',
|
||||||
2 => 'Adjustment',
|
2 => 'Adjustment',
|
||||||
3 => 'RefundFromDeletion',
|
3 => 'Refund From Deletion',
|
||||||
4 => 'Debit',
|
4 => 'Debit',
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -248,7 +248,7 @@ class ClientController extends AdminController
|
|||||||
|
|
||||||
$CD_Account_Number = $this->CDMasterModel
|
$CD_Account_Number = $this->CDMasterModel
|
||||||
->where('client_id', $client_id)
|
->where('client_id', $client_id)
|
||||||
->where('insurer_id', $insurer_id['insurer_id'])
|
->where('insurer_id', $insurer_id)
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
// Prepare the array with data
|
// Prepare the array with data
|
||||||
@ -262,12 +262,14 @@ class ClientController extends AdminController
|
|||||||
'insurer_id' => $this->request->getPost('insurer_id'),
|
'insurer_id' => $this->request->getPost('insurer_id'),
|
||||||
'description' => $this->request->getPost('description'),
|
'description' => $this->request->getPost('description'),
|
||||||
'transaction_type' => $this->request->getPost('transaction_type') ?: 'Credit',
|
'transaction_type' => $this->request->getPost('transaction_type') ?: 'Credit',
|
||||||
'updated_by' => 1, // You need to set the correct value for updated_by
|
'updated_by' => 1,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
// Call the saveDeposit function from DepositHelper
|
// Call the saveDeposit function from DepositHelper
|
||||||
$response = DepositHelper::saveDeposit($data, $loggedInUserID);
|
$response = DepositHelper::saveDeposit($data, $loggedInUserID);
|
||||||
|
|
||||||
|
|
||||||
// Return a boolean value based on success
|
// Return a boolean value based on success
|
||||||
return $this->response->setJSON(['success' => $response['success']]);
|
return $this->response->setJSON(['success' => $response['success']]);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1124,7 +1124,7 @@ class MasterController extends AdminController
|
|||||||
{
|
{
|
||||||
|
|
||||||
$data['CD_Master_Data'] = $this->CDMasterModel
|
$data['CD_Master_Data'] = $this->CDMasterModel
|
||||||
->select('cd_master.*, clients.client_name, insurers.name as insurer_name, user_profiles.first_name as user_name')
|
->select('cd_master.*, clients.client_name, clients.short_name, insurers.name as insurer_name, user_profiles.first_name as user_name')
|
||||||
->join('clients', 'clients.id = cd_master.client_id')
|
->join('clients', 'clients.id = cd_master.client_id')
|
||||||
->join('insurers', 'insurers.id = cd_master.insurer_id')
|
->join('insurers', 'insurers.id = cd_master.insurer_id')
|
||||||
->join('user_profiles', 'user_profiles.id = cd_master.created_by')
|
->join('user_profiles', 'user_profiles.id = cd_master.created_by')
|
||||||
|
|||||||
@ -185,19 +185,19 @@ class ClientPolicyModel extends Model
|
|||||||
->select('clients.client_name as clientname, clients.short_name as clientshort')
|
->select('clients.client_name as clientname, clients.short_name as clientshort')
|
||||||
->select('policies.name as policy_name')
|
->select('policies.name as policy_name')
|
||||||
->select('user_profiles.first_name as username')
|
->select('user_profiles.first_name as username')
|
||||||
->join('user_profiles','user_profiles.id=cash_deposit.created_by')
|
->join('user_profiles', 'user_profiles.id = cash_deposit.created_by', 'left')
|
||||||
->join('insurers', 'insurers.id = cash_deposit.insurer_id')
|
->join('insurers', 'insurers.id = cash_deposit.insurer_id', 'left')
|
||||||
->join('clients', 'clients.id = cash_deposit.client_id')
|
->join('clients', 'clients.id = cash_deposit.client_id', 'left')
|
||||||
->join('client_policy', 'client_policy.id = cash_deposit.client_policy_id')
|
->join('client_policy', 'client_policy.id = cash_deposit.client_policy_id', 'left')
|
||||||
->join('policies', 'policies.id = client_policy.policy_id')
|
->join('policies', 'policies.id = client_policy.policy_id', 'left')
|
||||||
|
|
||||||
->where('cash_deposit.client_id', $clientId)
|
->where('cash_deposit.client_id', $clientId)
|
||||||
->where('cash_deposit.insurer_id', $insurerId) // Add this line to filter by insurer_id
|
->where('cash_deposit.insurer_id', $insurerId)
|
||||||
->orderBy('cash_deposit.id', 'DESC')
|
->orderBy('cash_deposit.id', 'DESC')
|
||||||
->get()
|
->get()
|
||||||
->getResult();
|
->getResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function getDepositSummary($clientId, $insurerId)
|
public function getDepositSummary($clientId, $insurerId)
|
||||||
{
|
{
|
||||||
// Fetch the sum of credit and debit transactions and calculate the balance
|
// Fetch the sum of credit and debit transactions and calculate the balance
|
||||||
|
|||||||
@ -49,7 +49,7 @@ table.dataTable thead th {
|
|||||||
<tbody>
|
<tbody>
|
||||||
<?php foreach($CD_Master_Data as $row){ ?>
|
<?php foreach($CD_Master_Data as $row){ ?>
|
||||||
<tr>
|
<tr>
|
||||||
<td><?php echo $row['client_name']; ?></td>
|
<td><?php echo $row['client_name']; ?>( <?= $row['short_name'] ?> )</td>
|
||||||
<td><?php echo $row['insurer_name']; ?></td>
|
<td><?php echo $row['insurer_name']; ?></td>
|
||||||
<td><?php echo date('d-m-Y', strtotime($row['opening_date'])); ?></td>
|
<td><?php echo date('d-m-Y', strtotime($row['opening_date'])); ?></td>
|
||||||
<td><?php echo $row['cd_ac_no']; ?></td>
|
<td><?php echo $row['cd_ac_no']; ?></td>
|
||||||
@ -81,11 +81,11 @@ table.dataTable thead th {
|
|||||||
<!-- modal content -->
|
<!-- modal content -->
|
||||||
|
|
||||||
<div id="con-close-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
|
<div id="con-close-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
|
||||||
aria-hidden="true" style="display: none;">
|
aria-hidden="true" data-backdrop="static" style="display: none;">
|
||||||
<div class="modal-dialog">
|
<div class="modal-dialog">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<h4 class="modal-title">Add Cash Deposite</h4>
|
<h4 class="modal-title" id="title">Add Cash Deposite</h4>
|
||||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -161,7 +161,7 @@ table.dataTable thead th {
|
|||||||
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
$('#tickets-table').DataTable({
|
$('#tickets-table').DataTable({
|
||||||
dom: "<'row'<'col-sm-0'f><'col-sm-9 text-right'B>>" +
|
dom: "<'row'<'col-sm-0'f><'col-sm-9 text-right'B>>" +
|
||||||
@ -170,7 +170,7 @@ $(document).ready(function() {
|
|||||||
buttons: [{
|
buttons: [{
|
||||||
extend: 'csv',
|
extend: 'csv',
|
||||||
text: 'CSV',
|
text: 'CSV',
|
||||||
title: 'ClientList',
|
title: 'CD-Master-List',
|
||||||
className: 'my_class',
|
className: 'my_class',
|
||||||
exportOptions: {
|
exportOptions: {
|
||||||
columns: ':not(:last-child)'
|
columns: ':not(:last-child)'
|
||||||
@ -183,8 +183,7 @@ $(document).ready(function() {
|
|||||||
paging: true,
|
paging: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
})
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
@ -203,6 +202,9 @@ $(document).ready(function() {
|
|||||||
allowInput: false
|
allowInput: false
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('#client_id').select2();
|
||||||
|
$('#insurer_id').select2();
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@ -213,22 +215,29 @@ $(document).ready(function() {
|
|||||||
$('#cd_ac_no').val('');
|
$('#cd_ac_no').val('');
|
||||||
$('#opening_bal').val('');
|
$('#opening_bal').val('');
|
||||||
$('#CDMasterForm').attr('action', '<?php echo base_url('master/cash_deposite/create');?>');
|
$('#CDMasterForm').attr('action', '<?php echo base_url('master/cash_deposite/create');?>');
|
||||||
|
$('#title').html('Add Cash Deposite');
|
||||||
|
$('#btnSubmit').html('Submit');
|
||||||
|
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
$('.close').click(function(){
|
$('.close').click(function(){
|
||||||
$('#CD_Master_ID').val('');
|
$('#CD_Master_ID').val('');
|
||||||
$('#client_id').val('');
|
$('#client_id').val('').change();
|
||||||
$('#insurer_id').val('');
|
$('#insurer_id').val('').change();
|
||||||
$('#opening_date').val('');
|
$('#opening_date').val('');
|
||||||
$('#cd_ac_no').val('');
|
$('#cd_ac_no').val('');
|
||||||
$('#opening_bal').val('');
|
$('#opening_bal').val('');
|
||||||
|
$('#CDMasterForm')[0].reset();
|
||||||
|
$('#CDMasterForm').parsley().reset();
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
$('body').on('click', '.btnEdit', function () {
|
$('body').on('click', '.btnEdit', function () {
|
||||||
|
|
||||||
var cd_id = $(this).attr('data-id');
|
var cd_id = $(this).attr('data-id');
|
||||||
|
$('#title').html('Update Cash Deposite');
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '<?php echo base_url('master/cash_deposite/list/');?>'+cd_id,
|
url: '<?php echo base_url('master/cash_deposite/list/');?>'+cd_id,
|
||||||
@ -241,8 +250,8 @@ $(document).ready(function() {
|
|||||||
$('#updateModal').modal('show');
|
$('#updateModal').modal('show');
|
||||||
$('#CDMasterForm').attr('action', '<?php echo base_url('master/cash_deposite/edit');?>');
|
$('#CDMasterForm').attr('action', '<?php echo base_url('master/cash_deposite/edit');?>');
|
||||||
$('#CD_Master_ID').val(res.data.id);
|
$('#CD_Master_ID').val(res.data.id);
|
||||||
$('#client_id').val(res.data.client_id);
|
$('#client_id').val(res.data.client_id).change();
|
||||||
$('#insurer_id').val(res.data.insurer_id);
|
$('#insurer_id').val(res.data.insurer_id).change();
|
||||||
$('#opening_date').val(res.data.opening_date);
|
$('#opening_date').val(res.data.opening_date);
|
||||||
$('#cd_ac_no').val(res.data.cd_ac_no);
|
$('#cd_ac_no').val(res.data.cd_ac_no);
|
||||||
$('#opening_bal').val(res.data.opening_bal);
|
$('#opening_bal').val(res.data.opening_bal);
|
||||||
|
|||||||
@ -752,7 +752,6 @@
|
|||||||
// $('#policy').val(res.data.policy_id).change();
|
// $('#policy').val(res.data.policy_id).change();
|
||||||
$('#policy_type').val(res.data.is_addon).change();
|
$('#policy_type').val(res.data.is_addon).change();
|
||||||
$('#base_policy').val(res.data.base_policy);
|
$('#base_policy').val(res.data.base_policy);
|
||||||
$('#client_branch').val(res.data.client_branch_id).change();
|
|
||||||
|
|
||||||
$('#policy_type_id').val(res.data.policy_type_id);
|
$('#policy_type_id').val(res.data.policy_type_id);
|
||||||
$('#policy_PrimaryKey').val(res.data.id);
|
$('#policy_PrimaryKey').val(res.data.id);
|
||||||
@ -878,7 +877,7 @@
|
|||||||
appendCDACNO(res.cd_data, res.data.cd_ac_no)
|
appendCDACNO(res.cd_data, res.data.cd_ac_no)
|
||||||
}, 3000)
|
}, 3000)
|
||||||
|
|
||||||
|
$('#client_branch').val(res.data.client_branch_id).change();
|
||||||
|
|
||||||
},
|
},
|
||||||
error: function(xhr, status, error) {
|
error: function(xhr, status, error) {
|
||||||
|
|||||||
@ -78,7 +78,8 @@
|
|||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12" style="text-align: right;">
|
<div class="col-12" style="text-align: right;">
|
||||||
<a href="<?= base_url("client/deposit/$clientData->id"); ?>"><i class="fas fa-arrow-left" style="font-size: 17px;"></i></a>
|
<a href="<?= base_url("client/deposit/$clientData->id"); ?>"><i class="fas fa-arrow-left"
|
||||||
|
style="font-size: 17px;"></i></a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -97,7 +98,6 @@
|
|||||||
id="tickets-table">
|
id="tickets-table">
|
||||||
<thead class="bg-light">
|
<thead class="bg-light">
|
||||||
<tr>
|
<tr>
|
||||||
|
|
||||||
<th class="font-weight-medium">CD Account No</th>
|
<th class="font-weight-medium">CD Account No</th>
|
||||||
<th class="font-weight-medium">Policy Name</th>
|
<th class="font-weight-medium">Policy Name</th>
|
||||||
<th class="font-weight-medium">Endorsement No</th>
|
<th class="font-weight-medium">Endorsement No</th>
|
||||||
@ -105,9 +105,8 @@
|
|||||||
<th class="font-weight-medium">Credit</th>
|
<th class="font-weight-medium">Credit</th>
|
||||||
<th class="font-weight-medium">Debit</th>
|
<th class="font-weight-medium">Debit</th>
|
||||||
<th class="font-weight-medium">Balance</th>
|
<th class="font-weight-medium">Balance</th>
|
||||||
<th class="font-weight-medium">Date/User</th>
|
|
||||||
<th class="font-weight-medium">Description</th>
|
<th class="font-weight-medium">Description</th>
|
||||||
|
<th class="font-weight-medium">Date/User</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@ -116,12 +115,14 @@
|
|||||||
<td><?php echo $row->cd_ac_no; ?></td>
|
<td><?php echo $row->cd_ac_no; ?></td>
|
||||||
<td><?php echo $row->policy_name; ?></td>
|
<td><?php echo $row->policy_name; ?></td>
|
||||||
<td><?php echo $row->endorsement_no; ?></td>
|
<td><?php echo $row->endorsement_no; ?></td>
|
||||||
<td><?php echo isset($subTypeOptions[$row->sub_type]) ? $subTypeOptions[$row->sub_type] : ''; ?></td>
|
<td><?php echo isset($subTypeOptions[$row->sub_type]) ? $subTypeOptions[$row->sub_type] : ''; ?>
|
||||||
|
</td>
|
||||||
<td><?php echo ($row->transaction_type == 'Credit') ? $row->amount : ''; ?></td>
|
<td><?php echo ($row->transaction_type == 'Credit') ? $row->amount : ''; ?></td>
|
||||||
<td><?php echo ($row->transaction_type == 'Debit') ? $row->amount : ''; ?></td>
|
<td><?php echo ($row->transaction_type == 'Debit') ? $row->amount : ''; ?></td>
|
||||||
<td><?php echo $row->balance; ?></td>
|
<td><?php echo $row->balance; ?></td>
|
||||||
<td><?php echo date('d-M-Y h:i A', strtotime($row->created_at)); ?> by <?php echo $row->username; ?> </td>
|
|
||||||
<td><?php echo $row->description; ?></td>
|
<td><?php echo $row->description; ?></td>
|
||||||
|
<td><?php echo date('d-M-Y h:i A', strtotime($row->created_at)); ?> by
|
||||||
|
<?php echo $row->username; ?> </td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</tbody>
|
</tbody>
|
||||||
@ -292,15 +293,25 @@ $(document).ready(function() {
|
|||||||
// Add more options as needed
|
// Add more options as needed
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
var subType = $('#subType').val();
|
var subType = $('#subType').val();
|
||||||
var subTypeId = subTypeOptions[subType] || null;
|
var subTypeId = subTypeOptions[subType] || null;
|
||||||
|
|
||||||
if (subTypeId === null) {
|
if (subTypeId === null) {
|
||||||
// Handle the case where sub_type is not found in the options
|
// Handle the case where sub_type is not found in the options
|
||||||
alert('Invalid sub_type selected.');
|
toastr.warning('Invalid sub_type selected.', "Warning");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// console.log('transactionType ', transactionType)
|
||||||
|
// console.log('description ', description)
|
||||||
|
// console.log('amount ', amount)
|
||||||
|
// console.log('subType ', subType)
|
||||||
|
// console.log('sub_type_id ', sub_type_id)
|
||||||
|
// console.log('clientId ', clientId)
|
||||||
|
// console.log('insurerId ', insurerId)
|
||||||
|
|
||||||
|
|
||||||
// Send data to the server using Ajax
|
// Send data to the server using Ajax
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
@ -316,15 +327,18 @@ $(document).ready(function() {
|
|||||||
},
|
},
|
||||||
success: function(response) {
|
success: function(response) {
|
||||||
// Handle success response
|
// Handle success response
|
||||||
console.log("Transaction saved successfully");
|
toastr.success("Transaction saved successfully", "Success");
|
||||||
// Reload the page or perform other actions as needed
|
// Reload the page or perform other actions as needed
|
||||||
location.reload();
|
location.reload();
|
||||||
},
|
},
|
||||||
error: function(error) {
|
error: function(xhr, status, error) {
|
||||||
// Handle error response
|
toastr.error("Transaction save failed", "Error");
|
||||||
console.error(error);
|
console.error(xhr.responseText);
|
||||||
|
console.error(status, error);
|
||||||
|
location.reload(); // Uncomment if you need to reload the page on error
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
Loading…
Reference in New Issue
Block a user