Skip to content

Commit

Permalink
imp: Show reimbursed payments in CSV export
Browse files Browse the repository at this point in the history
  • Loading branch information
marienfressinaud committed Feb 2, 2021
1 parent 1cab844 commit f603281
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/models/Payment.php
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,18 @@ public function invoiceExists()
return file_exists($this->invoiceFilepath());
}

/**
* @return boolean
*/
public function isReimbursed()
{
$payment_dao = new dao\Payment();
$db_credit_payment = $payment_dao->findBy([
'credited_payment_id' => $this->id,
]);
return $db_credit_payment !== null;
}

/**
* @return string
*/
Expand Down
5 changes: 5 additions & 0 deletions src/views/admin/payments/index.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@
echo 'virement;';
endif;
echo "=MOIS(A{$line_number});";
if ($payment->isReimbursed()):
echo 'x;';
else:
echo ';';
endif;
echo $payment->invoice_number . ';';
echo "\n";
endforeach;
Expand Down

0 comments on commit f603281

Please sign in to comment.