Skip to content

Commit

Permalink
Sanitaze code
Browse files Browse the repository at this point in the history
  • Loading branch information
lomamech committed Aug 6, 2019
1 parent 3588ff8 commit 7268cad
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
8 changes: 4 additions & 4 deletions server/controllers/finance/creditors.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,14 +173,14 @@ 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 = (dateFrom && dateTo)
? [db.exec(sql, [uid, uid]), balance(creditorUuid), openingBalanceCreditor(creditorUuid, dateFrom)]
: [db.exec(sql, [uid, uid]), balance(creditorUuid)];

return q.all(tabSql)
.spread((transactions, aggs, openingBalance) => {
if (!aggs.length) {
aggs.push({ debit: 0, credit: 0, balance: 0 });
aggs.push({ debit : 0, credit : 0, balance : 0 });
}

const [aggregates] = aggs;
Expand Down
18 changes: 9 additions & 9 deletions server/controllers/finance/reports/financial.employee.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const db = require('../../../lib/db');
const TEMPLATE = './server/controllers/finance/reports/financial.employee.handlebars';

const PDF_OPTIONS = {
filename: 'FORM.LABELS.FINANCIAL_STATUS',
filename : 'FORM.LABELS.FINANCIAL_STATUS',
};

/**
Expand Down Expand Up @@ -70,15 +70,15 @@ async function build(req, res, next) {

_.extend(data, {
employee,
creditorTransactions: creditorOperations.transactions,
creditorAggregates: creditorOperations.aggregates,
debtorTransactions: debtorOperations.transactions,
debtorAggregates: debtorOperations.aggregates,
creditorTransactions : creditorOperations.transactions,
creditorAggregates : creditorOperations.aggregates,
debtorTransactions : debtorOperations.transactions,
debtorAggregates : debtorOperations.aggregates,
});

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

Expand All @@ -88,13 +88,13 @@ async function build(req, res, next) {
if (options.extractEmployee) {

const lastTxn = _.last(creditorOperations.transactions);
data.lastTransaction = lastTxn || { cumsum: 0 };
data.lastTransaction = lastTxn || { cumsum : 0 };
data.extratCreditorText = data.lastTransaction.cumsum >= 0
? 'FORM.LABELS.CREDIT_BALANCE' : 'FORM.LABELS.DEBIT_BALANCE';

data.dates = {
dateFrom: options.dateFrom,
dateTo: options.dateTo,
dateFrom : options.dateFrom,
dateTo : options.dateTo,
};
}

Expand Down

0 comments on commit 7268cad

Please sign in to comment.