Skip to content

Commit

Permalink
improvement(Employee voucher)
Browse files Browse the repository at this point in the history
- Add creditor name in Voucher for Employee

closes #6377
  • Loading branch information
lomamech committed Mar 15, 2022
1 parent 51d2b99 commit e8436a7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
1 change: 0 additions & 1 deletion server/controllers/finance/reports/vouchers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ async function receipt(req, res, next) {
}
}


/**
* GET reports/finance/vouchers
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
</td>
<td class="text-right">{{currency debit ../details.currency_id}}</td>
<td class="text-right">{{currency credit ../details.currency_id}}</td>
<td>{{ entity_reference }}</td>
<td>{{ entity_reference }} {{ creditorName }}</td>
<td>{{ document_reference }}</td>
</tr>
{{/each}}
Expand Down
6 changes: 5 additions & 1 deletion server/controllers/finance/vouchers.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,18 @@ async function lookupVoucher(vUuid) {
WHERE v.uuid = ?;
`;

// For get Creditor name
const itemSql = `
SELECT BUID(vi.uuid) AS uuid, vi.debit, vi.credit, vi.account_id, a.number, a.label,
BUID(vi.document_uuid) as document_uuid, document_map.text AS document_reference,
BUID(entity_uuid) AS entity_uuid, entity_map.text AS entity_reference, vi.description
BUID(entity_uuid) AS entity_uuid, entity_map.text AS entity_reference, vi.description,
CONCAT('/ ', c.text) AS creditorName
FROM voucher_item vi
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
LEFT JOIN employee emp ON emp.creditor_uuid = vi.entity_uuid
LEFT JOIN creditor c ON c.uuid = emp.creditor_uuid
WHERE vi.voucher_uuid = ?
ORDER BY vi.account_id DESC, vi.debit DESC, vi.credit ASC, entity_reference;
`;
Expand Down

0 comments on commit e8436a7

Please sign in to comment.