2020-09-25 12:45:00 +00:00
|
|
|
SELECT
|
|
|
|
r.id,
|
|
|
|
r.amountPaid,
|
2021-07-01 06:33:56 +00:00
|
|
|
cr.amount AS amountUnpaid,
|
2020-09-25 12:45:00 +00:00
|
|
|
r.payed,
|
|
|
|
r.companyFk
|
|
|
|
FROM receipt r
|
|
|
|
JOIN client c ON c.id = r.clientFk
|
2021-07-01 06:33:56 +00:00
|
|
|
JOIN bi.customer_risk cr ON cr.customer_id = c.id
|
|
|
|
AND cr.company_id = r.companyFk
|
2020-09-25 12:45:00 +00:00
|
|
|
WHERE r.id = ?
|