Skip to content

Commit

Permalink
improvement(Employee Standing)
Browse files Browse the repository at this point in the history
- clean the representation of tabSQL
- Capitalize creditoropeningbalance
  • Loading branch information
lomamech committed Aug 6, 2019
1 parent 7268cad commit 01893e9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
7 changes: 3 additions & 4 deletions server/controllers/finance/creditors.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,10 @@ function getFinancialActivity(creditorUuid, dateFrom, dateTo) {
ORDER BY trans_date ASC, trans_id;
`;

const tabSql = (dateFrom && dateTo)
? [db.exec(sql, [uid, uid]), balance(creditorUuid), openingBalanceCreditor(creditorUuid, dateFrom)]
: [db.exec(sql, [uid, uid]), balance(creditorUuid)];
const tabSQL = [ db.exec(sql, [uid, uid]), balance(creditorUuid) ];
if (dateFrom && dateTo) { tabSQL.push(openingBalanceCreditor(creditorUuid, dateFrom)); }

return q.all(tabSql)
return q.all(tabSQL)
.spread((transactions, aggs, openingBalance) => {
if (!aggs.length) {
aggs.push({ debit : 0, credit : 0, balance : 0 });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@
<tr>
<td colspan="4" class="text-right"><b>{{translate "TABLE.COLUMNS.BALANCE_AT" }} {{date dates.dateFrom }} </b></td>
<td class="text-right">
{{debcred creditoropeningBalance.debit metadata.enterprise.currency_id}}
{{debcred creditorOpeningBalance.debit metadata.enterprise.currency_id}}
</td>
<td class="text-right">
{{debcred creditoropeningBalance.credit metadata.enterprise.currency_id}}
{{debcred creditorOpeningBalance.credit metadata.enterprise.currency_id}}
</td>
<td class="text-right">
<span> {{debcred creditoropeningBalance.balance metadata.enterprise.currency_id}} </span>
<span> {{debcred creditorOpeningBalance.balance metadata.enterprise.currency_id}} </span>
</td>
</tr>
{{/if}}
Expand Down
2 changes: 1 addition & 1 deletion server/controllers/finance/reports/financial.employee.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ async function build(req, res, next) {

if (creditorOperations.openingBalance) {
_.extend(data, {
creditoropeningBalance : creditorOperations.openingBalance[0],
creditorOpeningBalance : creditorOperations.openingBalance[0],
});
}

Expand Down

0 comments on commit 01893e9

Please sign in to comment.