Skip to content

Commit

Permalink
Merge pull request #58 from insane-code/feat/0.x-fees
Browse files Browse the repository at this point in the history
fix: invoice getPaidAmount
  • Loading branch information
jesusantguerrero authored May 15, 2024
2 parents 9351ad2 + 1bec833 commit ac0d95e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Models/Invoice/Invoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -489,15 +489,15 @@ public function getInvoiceData() {

public function getPaidAmount() {
try {
$selection = DB::select(DB::raw('SELECT invoice_id, sum(amount) as total
$selection = DB::select("SELECT invoice_id, sum(amount) as total
FROM (SELECT payable_id as invoice_id, amount
from payments
WHERE payable_type=?
UNION
SELECT invoice_id, amount
FROM invoice_notes
) AS combine
WHERE invoice_id=? limit 1'), [Invoice::class, $this->id]);
WHERE invoice_id=? limit 1", [Invoice::class, $this->id]);
return $selection[0]->total ?? 0;
} catch (\Exception $e) {
echo $e->getMessage();
Expand Down

0 comments on commit ac0d95e

Please sign in to comment.