Skip to content

Commit

Permalink
Fix Payment Overview display
Browse files Browse the repository at this point in the history
- Fix query on paymenthistory endpoint
  • Loading branch information
beesaferoot committed Dec 15, 2024
1 parent ce622eb commit e0b16d8
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/backend/app/Models/PaymentHistory.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,10 @@ public function transaction(): BelongsTo {
}

public function getFlow(string $payer_type, int $payer_id, string $period, $limit = null, string $order = 'ASC') {
$sql = 'SELECT sum(amount) as amount, payment_type, CONCAT_WS("/", '.$period.') as aperiod from'.
' payment_histories where payer_id=:payer_id and payer_type=:payer_type '.
'GROUP by concat( '.$period.'), payment_type ORDER BY created_at '.$order;
$sql = 'SELECT sum(amount) as amount, payment_type, CONCAT_WS("/", '.$period.') as aperiod '.
'FROM payment_histories '.
'WHERE payer_id=:payer_id AND payer_type=:payer_type '.
'GROUP by aperiod, payment_type ORDER BY aperiod '.$order;

if ($limit !== null) {
$sql .= ' limit '.(int) $limit;
Expand Down

0 comments on commit e0b16d8

Please sign in to comment.