Skip to content

Commit

Permalink
fix(cash): render patient name instead of debtor
Browse files Browse the repository at this point in the history
This commit fixes the cash payments page to render the patient name for
a better correspondence between the Patient Invoice and the Cash
Payments registry. This should make auditing the registries a lot
easier.
  • Loading branch information
Jonathan Niles authored and sfount committed Jan 14, 2017
1 parent 140282b commit 0bceba1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion client/src/partials/cash/payments/registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function CashPaymentRegistryController(Cash, bhConstants, Notify, Session, uiGri
}, {
field : 'date', displayName : 'TABLE.COLUMNS.DATE', headerCellFilter: 'translate', cellFilter : 'date:"mediumDate"',
}, {
field : 'debtor_name', displayName : 'TABLE.COLUMNS.CLIENT', headerCellFilter: 'translate'
field : 'patientName', displayName : 'TABLE.COLUMNS.CLIENT', headerCellFilter: 'translate'
}, {
field : 'description', displayName : 'TABLE.COLUMNS.DESCRIPTION', headerCellFilter: 'translate'
}, {
Expand Down
7 changes: 4 additions & 3 deletions server/controllers/finance/cash.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,13 @@ function listPayment(params) {
CONCAT_WS('.', '${identifiers.CASH_PAYMENT.key}', project.abbr, cash.reference) AS reference,
cash.date, BUID(cash.debtor_uuid) AS debtor_uuid, cash.currency_id, cash.amount,
cash.description, cash.cashbox_id, cash.is_caution, cash.user_id,
d.text AS debtor_name, cb.label AS cashbox_label, u.display_name, v.type_id
d.text AS debtor_name, cb.label AS cashbox_label, u.display_name,
v.type_id, p.display_name AS patientName
FROM cash
LEFT JOIN voucher v ON v.reference_uuid = cash.uuid
JOIN project ON cash.project_id = project.id
JOIN debtor d ON d.uuid = cash.debtor_uuid
JOIN patient p on p.debtor_uuid = d.uuid
JOIN cash_box cb ON cb.id = cash.cashbox_id
JOIN user u ON u.id = cash.user_id
WHERE
Expand Down Expand Up @@ -340,8 +342,7 @@ function checkInvoicePayment(req, res, next) {
const REVERSAL_TYPE_ID = 10;

const sql = `
SELECT cash_item.cash_uuid, cash_item.invoice_uuid
FROM cash_item
SELECT cash_item.cash_uuid, cash_item.invoice_uuid FROM cash_item
WHERE cash_item.invoice_uuid = ?
AND cash_item.cash_uuid NOT IN (
SELECT voucher.reference_uuid FROM voucher WHERE voucher.type_id = ${REVERSAL_TYPE_ID}
Expand Down

0 comments on commit 0bceba1

Please sign in to comment.