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)
|
||||
{
|
||||
// Load your model to fetch data based on $clientId and $insurerId
|
||||
$subTypeOptions = [
|
||||
1 => 'Deposit',
|
||||
2 => 'Adjustment',
|
||||
3 => 'Refund',
|
||||
4 => 'Debit',
|
||||
];
|
||||
// $subTypeOptions = [
|
||||
// 1 => 'Deposit',
|
||||
// 2 => 'Adjustment',
|
||||
// 3 => 'Refund',
|
||||
// 4 => 'Debit',
|
||||
// ];
|
||||
$subTypeOptions = [
|
||||
1 => 'Replenishment',
|
||||
2 => 'Adjustment',
|
||||
3 => 'RefundFromDeletion',
|
||||
3 => 'Refund From Deletion',
|
||||
4 => 'Debit',
|
||||
];
|
||||
|
||||
@ -248,7 +248,7 @@ class ClientController extends AdminController
|
||||
|
||||
$CD_Account_Number = $this->CDMasterModel
|
||||
->where('client_id', $client_id)
|
||||
->where('insurer_id', $insurer_id['insurer_id'])
|
||||
->where('insurer_id', $insurer_id)
|
||||
->first();
|
||||
|
||||
// Prepare the array with data
|
||||
@ -262,12 +262,14 @@ class ClientController extends AdminController
|
||||
'insurer_id' => $this->request->getPost('insurer_id'),
|
||||
'description' => $this->request->getPost('description'),
|
||||
'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
|
||||
$response = DepositHelper::saveDeposit($data, $loggedInUserID);
|
||||
|
||||
|
||||
// Return a boolean value based on success
|
||||
return $this->response->setJSON(['success' => $response['success']]);
|
||||
}
|
||||
|
||||
@ -1124,7 +1124,7 @@ class MasterController extends AdminController
|
||||
{
|
||||
|
||||
$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('insurers', 'insurers.id = cd_master.insurer_id')
|
||||
->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('policies.name as policy_name')
|
||||
->select('user_profiles.first_name as username')
|
||||
->join('user_profiles','user_profiles.id=cash_deposit.created_by')
|
||||
->join('insurers', 'insurers.id = cash_deposit.insurer_id')
|
||||
->join('clients', 'clients.id = cash_deposit.client_id')
|
||||
->join('client_policy', 'client_policy.id = cash_deposit.client_policy_id')
|
||||
->join('policies', 'policies.id = client_policy.policy_id')
|
||||
|
||||
->join('user_profiles', 'user_profiles.id = cash_deposit.created_by', 'left')
|
||||
->join('insurers', 'insurers.id = cash_deposit.insurer_id', 'left')
|
||||
->join('clients', 'clients.id = cash_deposit.client_id', 'left')
|
||||
->join('client_policy', 'client_policy.id = cash_deposit.client_policy_id', 'left')
|
||||
->join('policies', 'policies.id = client_policy.policy_id', 'left')
|
||||
->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')
|
||||
->get()
|
||||
->getResult();
|
||||
}
|
||||
|
||||
|
||||
public function getDepositSummary($clientId, $insurerId)
|
||||
{
|
||||
// Fetch the sum of credit and debit transactions and calculate the balance
|
||||
|
||||
@ -49,7 +49,7 @@ table.dataTable thead th {
|
||||
<tbody>
|
||||
<?php foreach($CD_Master_Data as $row){ ?>
|
||||
<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 date('d-m-Y', strtotime($row['opening_date'])); ?></td>
|
||||
<td><?php echo $row['cd_ac_no']; ?></td>
|
||||
@ -81,11 +81,11 @@ table.dataTable thead th {
|
||||
<!-- modal content -->
|
||||
|
||||
<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-content">
|
||||
<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>
|
||||
</div>
|
||||
|
||||
@ -161,30 +161,29 @@ table.dataTable thead th {
|
||||
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$(document).ready(function() {
|
||||
|
||||
$('#tickets-table').DataTable({
|
||||
dom: "<'row'<'col-sm-0'f><'col-sm-9 text-right'B>>" +
|
||||
"<'row'<'col-sm-12'tr>>" +
|
||||
"<'row'<'col-sm-5'i><'col-sm-7'p>>",
|
||||
buttons: [{
|
||||
extend: 'csv',
|
||||
text: 'CSV',
|
||||
title: 'ClientList',
|
||||
className: 'my_class',
|
||||
exportOptions: {
|
||||
columns: ':not(:last-child)'
|
||||
$('#tickets-table').DataTable({
|
||||
dom: "<'row'<'col-sm-0'f><'col-sm-9 text-right'B>>" +
|
||||
"<'row'<'col-sm-12'tr>>" +
|
||||
"<'row'<'col-sm-5'i><'col-sm-7'p>>",
|
||||
buttons: [{
|
||||
extend: 'csv',
|
||||
text: 'CSV',
|
||||
title: 'CD-Master-List',
|
||||
className: 'my_class',
|
||||
exportOptions: {
|
||||
columns: ':not(:last-child)'
|
||||
},
|
||||
}],
|
||||
language: {
|
||||
search: "_INPUT_",
|
||||
searchPlaceholder: "Search..."
|
||||
},
|
||||
}],
|
||||
language: {
|
||||
search: "_INPUT_",
|
||||
searchPlaceholder: "Search..."
|
||||
},
|
||||
paging: true,
|
||||
});
|
||||
paging: true,
|
||||
});
|
||||
|
||||
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
$(document).ready(function(){
|
||||
@ -203,6 +202,9 @@ $(document).ready(function() {
|
||||
allowInput: false
|
||||
});
|
||||
|
||||
$('#client_id').select2();
|
||||
$('#insurer_id').select2();
|
||||
|
||||
})
|
||||
|
||||
|
||||
@ -212,23 +214,30 @@ $(document).ready(function() {
|
||||
$('#opening_date').val('');
|
||||
$('#cd_ac_no').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(){
|
||||
$('#CD_Master_ID').val('');
|
||||
$('#client_id').val('');
|
||||
$('#insurer_id').val('');
|
||||
$('#client_id').val('').change();
|
||||
$('#insurer_id').val('').change();
|
||||
$('#opening_date').val('');
|
||||
$('#cd_ac_no').val('');
|
||||
$('#opening_bal').val('');
|
||||
$('#CDMasterForm')[0].reset();
|
||||
$('#CDMasterForm').parsley().reset();
|
||||
})
|
||||
|
||||
|
||||
$('body').on('click', '.btnEdit', function () {
|
||||
|
||||
var cd_id = $(this).attr('data-id');
|
||||
$('#title').html('Update Cash Deposite');
|
||||
|
||||
$.ajax({
|
||||
url: '<?php echo base_url('master/cash_deposite/list/');?>'+cd_id,
|
||||
@ -241,8 +250,8 @@ $(document).ready(function() {
|
||||
$('#updateModal').modal('show');
|
||||
$('#CDMasterForm').attr('action', '<?php echo base_url('master/cash_deposite/edit');?>');
|
||||
$('#CD_Master_ID').val(res.data.id);
|
||||
$('#client_id').val(res.data.client_id);
|
||||
$('#insurer_id').val(res.data.insurer_id);
|
||||
$('#client_id').val(res.data.client_id).change();
|
||||
$('#insurer_id').val(res.data.insurer_id).change();
|
||||
$('#opening_date').val(res.data.opening_date);
|
||||
$('#cd_ac_no').val(res.data.cd_ac_no);
|
||||
$('#opening_bal').val(res.data.opening_bal);
|
||||
|
||||
@ -752,7 +752,6 @@
|
||||
// $('#policy').val(res.data.policy_id).change();
|
||||
$('#policy_type').val(res.data.is_addon).change();
|
||||
$('#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_PrimaryKey').val(res.data.id);
|
||||
@ -878,7 +877,7 @@
|
||||
appendCDACNO(res.cd_data, res.data.cd_ac_no)
|
||||
}, 3000)
|
||||
|
||||
|
||||
$('#client_branch').val(res.data.client_branch_id).change();
|
||||
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
|
||||
@ -76,11 +76,12 @@
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
|
||||
<div class="row">
|
||||
<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>
|
||||
<div class="row">
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" style="margin-bottom:1rem;">
|
||||
<div class="col-6" style="align-self: center;">
|
||||
@ -97,7 +98,6 @@
|
||||
id="tickets-table">
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
|
||||
<th class="font-weight-medium">CD Account No</th>
|
||||
<th class="font-weight-medium">Policy Name</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">Debit</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">Date/User</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@ -116,12 +115,14 @@
|
||||
<td><?php echo $row->cd_ac_no; ?></td>
|
||||
<td><?php echo $row->policy_name; ?></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 == 'Debit') ? $row->amount : ''; ?></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 date('d-M-Y h:i A', strtotime($row->created_at)); ?> by
|
||||
<?php echo $row->username; ?> </td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
@ -226,22 +227,22 @@ $(document).ready(function() {
|
||||
$('#tickets-table').DataTable({
|
||||
dom: "<'row'<'col-sm-0'f><'col-sm-9 text-right'B>>",
|
||||
buttons: [{
|
||||
extend: 'csv',
|
||||
text: 'CSV',
|
||||
title: 'TransactionDetails',
|
||||
exportOptions: {
|
||||
columns: ''
|
||||
extend: 'csv',
|
||||
text: 'CSV',
|
||||
title: 'TransactionDetails',
|
||||
exportOptions: {
|
||||
columns: ''
|
||||
}
|
||||
},
|
||||
{
|
||||
extend: 'pdf',
|
||||
text: 'PDF',
|
||||
title: 'TransactionDetails',
|
||||
exportOptions: {
|
||||
columns: ''
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
extend: 'pdf',
|
||||
text: 'PDF',
|
||||
title: 'TransactionDetails',
|
||||
exportOptions: {
|
||||
columns: ''
|
||||
}
|
||||
}
|
||||
],
|
||||
],
|
||||
|
||||
|
||||
language: {
|
||||
@ -292,15 +293,25 @@ $(document).ready(function() {
|
||||
// Add more options as needed
|
||||
};
|
||||
|
||||
|
||||
var subType = $('#subType').val();
|
||||
var subTypeId = subTypeOptions[subType] || null;
|
||||
|
||||
if (subTypeId === null) {
|
||||
// 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;
|
||||
}
|
||||
|
||||
// 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
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
@ -316,15 +327,18 @@ $(document).ready(function() {
|
||||
},
|
||||
success: function(response) {
|
||||
// Handle success response
|
||||
console.log("Transaction saved successfully");
|
||||
toastr.success("Transaction saved successfully", "Success");
|
||||
// Reload the page or perform other actions as needed
|
||||
location.reload();
|
||||
},
|
||||
error: function(error) {
|
||||
// Handle error response
|
||||
console.error(error);
|
||||
error: function(xhr, status, error) {
|
||||
toastr.error("Transaction save failed", "Error");
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
location.reload(); // Uncomment if you need to reload the page on error
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
</script>
|
||||
Loading…
Reference in New Issue
Block a user