393 lines
17 KiB
PHP
Executable File
393 lines
17 KiB
PHP
Executable File
<div class="row">
|
|
<div class="col-12">
|
|
<div class="card">
|
|
<div class="card-body">
|
|
|
|
<div class="text-center">
|
|
<div class="row">
|
|
<div class="col-md-4"></div>
|
|
<div class="col-md-4">
|
|
<i class="font-24"></i>
|
|
<h4>CD Account No : <?php echo isset($insurerName->cd_master_account_no) && !empty($insurerName->cd_master_account_no) ? $insurerName->cd_master_account_no : 'N/A' ?></h4>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="text-center">
|
|
<div class="row">
|
|
|
|
<div class="col-md-6 col-xl-5">
|
|
<div class="py-1">
|
|
<i class="font-24"></i>
|
|
<h4>Deposit Summary Of <?php echo $clientData->short_name?></h4>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-6 col-xl-5">
|
|
<div class="py-1">
|
|
<i class=" font-24"></i>
|
|
<h4><?php echo $insurerName->name; ?></h4>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="row mt-3 text-center">
|
|
|
|
<div class="col-3">
|
|
<p class="text-muted font-15 mb-1 text-truncate">Deposits</p>
|
|
<h4 style="font-size: 26px;"><i
|
|
class="fe-arrow-up text-success mr-1"></i>₹<?php echo $deposiamount->total_credit?>
|
|
</h4>
|
|
</div>
|
|
|
|
<div class="col-3">
|
|
<p class="text-muted font-15 mb-1 text-truncate">Consumed</p>
|
|
<h4 style="font-size: 26px;"><i
|
|
class="fe-arrow-down text-danger mr-1"></i>₹<?php echo $deposiamount->total_withdraw?>
|
|
</h4>
|
|
</div>
|
|
|
|
<div class="col-3">
|
|
<p class="text-muted font-15 mb-1 text-truncate">Refund</p>
|
|
<h4 style="font-size: 26px;"><i
|
|
class="fe-arrow-up text-success mr-1"></i>₹<?php echo $deposiamount->total_refund?>
|
|
</h4>
|
|
</div>
|
|
|
|
<div class="col-3">
|
|
<p class="text-muted font-15 mb-1 text-truncate">Current Balance</p>
|
|
<h4 style="font-size: 26px;"><i
|
|
class="fe-credit-card text-sucess mr-1"></i>₹<?php echo $deposiamount->balance?>
|
|
</h4>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- start page title -->
|
|
<!-- <div class="row">
|
|
<div class="col-12">
|
|
<div class="page-title-box page-title-box-alt">
|
|
<h4 class="page-title"></h4>
|
|
<div class="page-title-right">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div> -->
|
|
<!-- end page title -->
|
|
<div class="row" id="List-page">
|
|
<div class="col-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>
|
|
</div>
|
|
|
|
<div class="row" style="margin-bottom:1rem;">
|
|
<div class="col-6" style="align-self: center;">
|
|
<h4 style="position: relative;">Transaction Details</h4>
|
|
</div>
|
|
|
|
<div class="col-6" style="text-align: right; position: relative;top: 56px;">
|
|
<button type="button" id="btnAdd" class="btn btn-primary waves-effect waves-light"
|
|
data-toggle="modal" data-target="#addTransactionModal">New</button>
|
|
</div>
|
|
</div>
|
|
|
|
<table class="table table-sm table-hover m-0 table-centered dt-responsive w-100" cellspacing="0"
|
|
id="tickets-table">
|
|
<thead class="bg-light">
|
|
<tr>
|
|
<th class="font-weight-medium">Date</th>
|
|
<th class="font-weight-medium">Unit</th>
|
|
<th class="font-weight-medium">Policy</th>
|
|
<th class="font-weight-medium">Endorsement No</th>
|
|
<th class="font-weight-medium">Sub Type</th>
|
|
<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">Description</th>
|
|
<th class="font-weight-medium">User</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php foreach($depositdata as $row) { ?>
|
|
<tr id="<?php echo $row->id;?>">
|
|
<td><?php echo date('d-M-Y h:i A', strtotime($row->created_at)); ?></td>
|
|
<td><?php echo $row->unit ?? ' - '; ?></td>
|
|
<!-- <td><?php echo $row->policy_name ?? '<center> - </center>'; ?></td> -->
|
|
<td>
|
|
<?php
|
|
$policyType = $row->policy_type ?? '';
|
|
$policyNo = $row->policy_no ?? '';
|
|
|
|
if ($policyType || $policyNo) {
|
|
echo trim($policyType . ' - ' . $policyNo, ' -');
|
|
} else {
|
|
echo '<center> - </center>';
|
|
}
|
|
?>
|
|
</td>
|
|
<td><?php echo $row->endorsement_no ?? '<center> - </center>'; ?></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 $row->description; ?></td>
|
|
<td><?php echo $row->username; ?></td>
|
|
</tr>
|
|
<?php } ?>
|
|
</tbody>
|
|
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- end col -->
|
|
</div>
|
|
</div>
|
|
<!-- Add this modal markup at the end of your HTML body -->
|
|
<!-- Button to trigger modal -->
|
|
|
|
<!-- Add this modal markup at the end of your HTML body -->
|
|
<div class="modal fade" id="addTransactionModal" tabindex="-1" role="dialog" aria-labelledby="addTransactionModalLabel"
|
|
aria-hidden="true">
|
|
<div class="modal-dialog" role="document">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title" id="addTransactionModalLabel">Add Transaction</h5>
|
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
|
<span aria-hidden="true">×</span>
|
|
</button>
|
|
</div>
|
|
<div class="modal-body">
|
|
|
|
<div class="row">
|
|
<div class="col-md-6">
|
|
<div class="form-group">
|
|
<label for="transactionMode" class="control-label">Transaction Mode</label>
|
|
<div class="form-check">
|
|
<input class="form-check-input" type="radio" name="transactionMode" id="addMode"value="1" checked>
|
|
<label class="form-check-label" for="addMode">Replenishment by Client</label>
|
|
</div>
|
|
<div class="form-check">
|
|
<input class="form-check-input" type="radio" name="transactionMode" id="refund_by_insurer"value="6">
|
|
<label class="form-check-label" for="addMode">Refund by Insurer</label>
|
|
</div>
|
|
<!-- <div class="form-check">
|
|
<input class="form-check-input" type="radio" name="transactionMode" id="adjustmentModeadd"value="2">
|
|
<label class="form-check-label" for="adjustmentMode">Adjustment Add</label>
|
|
</div>
|
|
<div class="form-check">
|
|
<input class="form-check-input" type="radio" name="transactionMode" id="adjustmentModereduce"value="3">
|
|
<label class="form-check-label" for="adjustmentMode">Adjustment Reduce</label>
|
|
</div> -->
|
|
<div class="form-check">
|
|
<input class="form-check-input" type="radio" name="transactionMode" id="assetpolicyadd"value="4">
|
|
<label class="form-check-label" for="adjustmentMode">Non EB Credit</label>
|
|
</div>
|
|
<div class="form-check">
|
|
<input class="form-check-input" type="radio" name="transactionMode" id="assetpolicyreduce"value="5">
|
|
<label class="form-check-label" for="adjustmentMode">No EB Debit</label>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<div class="form-group">
|
|
<label for="field-1" class="control-label">Amount<span class="text-danger">*</span></label>
|
|
<input type="number" class="form-control" id="amount" placeholder="Amount" required>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<!-- <div class="row" id="transactionTypeRow" style="display:none;">
|
|
<div class="col-md-6">
|
|
<div class="form-group">
|
|
<label for="transactionType" class="control-label">Transaction Type</label>
|
|
<select class="form-control" id="transactionType">
|
|
<option value="Credit">Add</option>
|
|
<option value="Debit">Reduce</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
</div> -->
|
|
|
|
|
|
<div class="row">
|
|
<div class="col-md-12">
|
|
<div class="form-group no-margin">
|
|
<label for="description" class="control-label">Description<span class="text-danger">*</span></label>
|
|
<textarea class="form-control" id="description"
|
|
placeholder="Write something about the transaction" required></textarea>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- <div class="form-group">
|
|
<label for="subType" class="control-label" style="display: none;">Transaction Sub Type</label>
|
|
<select class="form-control" id="subType" name="sub_type" style="display: none;">
|
|
<option value="Deposit" hidden>Replenishment</option>
|
|
<option value="Adjustment" hidden>Adjustment</option>
|
|
</select>
|
|
</div> -->
|
|
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
|
<button type="button" class="btn btn-primary" id="saveTransactionBtn">Save Transaction</button>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<script>
|
|
$(document).ready(function() {
|
|
$('input[name="transactionMode"]').change(function() {
|
|
if ($(this).val() === 'adjustment') {
|
|
$('#transactionTypeRow').show();
|
|
} else {
|
|
$('#transactionTypeRow').hide();
|
|
}
|
|
});
|
|
});
|
|
</script>
|
|
<script>
|
|
$(document).ready(function() {
|
|
|
|
$('#tickets-table').DataTable({
|
|
dom: "<'row'<'col-sm-0'f><'col-sm-7 text-right'B>>" +
|
|
"<'row'<'col-sm-12'tr>>" +
|
|
"<'row'<'col-sm-5'i><'col-sm-7'p>>",
|
|
buttons: [{
|
|
extend: 'csv',
|
|
text: 'CSV',
|
|
title: 'CD TransactionDetails',
|
|
exportOptions: {
|
|
columns: ''
|
|
}
|
|
},
|
|
{
|
|
extend: 'pdf',
|
|
text: 'PDF',
|
|
title: 'TransactionDetails',
|
|
exportOptions: {
|
|
columns: ''
|
|
}
|
|
}
|
|
],
|
|
language: {
|
|
search: "_INPUT_",
|
|
searchPlaceholder: "Search..."
|
|
},
|
|
ordering: false,
|
|
paging: true ,
|
|
});
|
|
});
|
|
</script>
|
|
|
|
|
|
<script>
|
|
|
|
$(document).ready(function() {
|
|
|
|
|
|
// // Event listener for radio buttons
|
|
// $('input[name="transactionMode"]').change(function() {
|
|
// if ($(this).val() === 'add') {
|
|
// // Set the hidden input value to 'Deposit' when 'Deposit' radio button is selected
|
|
// $('#subType').val('Deposit');
|
|
// } else if ($(this).val() === 'adjustment') {
|
|
// // Set the hidden input value to 'Adjustment' when 'Adjustment' radio button is selected
|
|
// $('#subType').val('Adjustment');
|
|
// }
|
|
// });
|
|
|
|
$('#saveTransactionBtn').on('click', function() {
|
|
|
|
var amount = $('#amount').val();
|
|
var description = $('#description').val();
|
|
var clientId = '<?php echo $clientData->id; ?>';
|
|
var insurerId = '<?php echo $insurerName->id; ?>';
|
|
var transactionTypeValue = $('input[name="transactionMode"]:checked').val();
|
|
var subType = "";
|
|
|
|
if(amount == ""){
|
|
toastr.warning('Amount field is required')
|
|
return;
|
|
}
|
|
|
|
if(description == ""){
|
|
toastr.warning('Description field is required')
|
|
return;
|
|
}
|
|
|
|
|
|
//tranction type
|
|
if(transactionTypeValue == 1){
|
|
transactionType = 'Credit';
|
|
subType = '1'; // Replenishment or Deposite
|
|
}else if(transactionTypeValue == 2){
|
|
transactionType = 'Credit'
|
|
subType = '2'; // Adjustment add
|
|
}else if(transactionTypeValue == 3){
|
|
transactionType = 'Debit'
|
|
subType = '2'; // Adjustment reduce
|
|
}else if(transactionTypeValue == 4){
|
|
transactionType = 'Credit'
|
|
subType = '5'; // Asset Policy add
|
|
}else if(transactionTypeValue == 5){
|
|
transactionType = 'Debit'
|
|
subType = '5'; // Asset Policy reduce
|
|
}else if(transactionTypeValue == 6){
|
|
transactionType = 'Debit'
|
|
subType = '6'; // Refund by indurer
|
|
}
|
|
|
|
console.log('transactionTypeValue', transactionTypeValue)
|
|
console.log('transactionType', transactionType)
|
|
console.log('description ', description)
|
|
console.log('amount ', amount)
|
|
console.log('clientId ', clientId)
|
|
console.log('insurerId ', insurerId)
|
|
console.log('subType ', subType)
|
|
|
|
|
|
// Send data to the server using Ajax
|
|
$.ajax({
|
|
type: 'POST',
|
|
url: '<?= base_url()."client/save_deposit" ?>',
|
|
data: {
|
|
amount: amount,
|
|
description: description,
|
|
transaction_type: transactionType,
|
|
sub_type_id: subType, // Include sub_type_id
|
|
client_id: clientId,
|
|
insurer_id: insurerId
|
|
},
|
|
success: function(response) {
|
|
// Handle success response
|
|
toastr.success("Transaction saved successfully", "Success");
|
|
// Reload the page or perform other actions as needed
|
|
location.reload();
|
|
},
|
|
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>
|