Skip to content

Commit

Permalink
total front receipts by payment method (openemr#7449)
Browse files Browse the repository at this point in the history
* feat: add payment method to front receipts

* use format money class

* styling

* styling
  • Loading branch information
stephenwaite committed May 22, 2024
1 parent c49a6ac commit 224fd36
Showing 1 changed file with 29 additions and 2 deletions.
31 changes: 29 additions & 2 deletions interface/reports/front_receipts_report.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
// The OnClick handler for receipt display.
function show_receipt(pid,timestamp) {
dlgopen('../patient_file/front_payment.php?receipt=1&patient=' + encodeURIComponent(pid) +
'&time=' + encodeURIComponent(timestamp), '_blank', 550, 400, '', '', {
'&time=' + encodeURIComponent(timestamp), '_blank', 850, 550, '', '', {
onClosed: 'reload'
});
}
Expand Down Expand Up @@ -208,7 +208,7 @@ function show_receipt(pid,timestamp) {
if (!empty($_POST['form_refresh']) || !empty($_POST['form_orderby'])) {
?>
<div id="report_results">
<table class='table'>
<table class='table table-striped'>
<thead class='thead-light'>
<th> <?php echo xlt('Time'); ?> </th>
<th> <?php echo xlt('Patient'); ?> </th>
Expand Down Expand Up @@ -288,6 +288,15 @@ function show_receipt(pid,timestamp) {
<?php
$total1 += $row['amount1'];
$total2 += $row['amount2'];
$method = $row['method'];
if (empty($total1_by_method[$method])) {
$total1_by_method[$method] = 0;
}
$total1_by_method[$method] += $row['amount1'];
if (empty($total2_by_method[$method])) {
$total2_by_method[$method] = 0;
}
$total2_by_method[$method] += $row['amount2'];
}
?>

Expand All @@ -297,6 +306,24 @@ function show_receipt(pid,timestamp) {
</td>
</tr>

<?php
$method_keys = array_keys(array_unique(array_merge($total1_by_method, $total2_by_method)));
foreach ($method_keys as $method_key) { ?>
<tr class="report_totals_by_method">
<td colspan='5'>
<?php echo xlt('Totals by Method') . ' ' . text($method_key); ?>
<td align='right'>
<?php echo text(FormatMoney::getBucks($total1_by_method[$method_key])); ?>
</td>
<td align='right'>
<?php echo text(FormatMoney::getBucks($total2_by_method[$method_key])); ?>
</td>
<td align='right'>
<?php echo text(FormatMoney::getBucks($total1_by_method[$method_key] + $total2_by_method[$method_key])); ?>
</td>
</tr>
<?php } ?>

<tr class="report_totals">
<td colspan='5'>
<?php echo xlt('Totals'); ?>
Expand Down

0 comments on commit 224fd36

Please sign in to comment.