Skip to content

Commit

Permalink
fix(vouchers): sort receipt items
Browse files Browse the repository at this point in the history
This commit fixes the voucher receipt by sorting the lines first by
account, then by amounts, and finally by the entity affected.  This
should ensure a fairly stable appearance to all receipts, no matter how
the accountant ordered the transaction initially or in what order the
database decided to enter them.

Closes #2221.
  • Loading branch information
jniles committed Oct 26, 2017
1 parent 72af815 commit ba717b5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion server/controllers/finance/vouchers.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ function lookupVoucher(vUuid) {
JOIN account a ON a.id = vi.account_id
LEFT JOIN entity_map ON entity_map.uuid = vi.entity_uuid
LEFT JOIN document_map ON document_map.uuid = vi.document_uuid
WHERE vi.voucher_uuid = ?;
WHERE vi.voucher_uuid = ?
ORDER BY vi.account_id DESC, vi.debit DESC, vi.credit ASC, entity_reference;
`;

return db.one(sql, [db.bid(vUuid)])
Expand Down

0 comments on commit ba717b5

Please sign in to comment.