Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(journal): order Trial Balance by account number #1602

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions server/config/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -607,10 +607,10 @@ exports.configure = function configure(app) {
app.get('/finance/cashflow', financeReports.cashflow.report);
app.get('/finance/incomeExpense', financeReports.incomeExpense.report);

// stock flux
// stock flux
app.get('/stock/flux', stock.listStockFlux);

// stock management API
// stock management API
app.post('/stock/lots/movements', stock.createMovement);
app.get('/stock/lots/movements', stock.listLotsMovements);

Expand All @@ -624,7 +624,7 @@ exports.configure = function configure(app) {
// stock integration
app.post('/stock/integration', stock.createIntegration);

// stock reports API
// stock reports API
app.get('/reports/stock/lots', stockReports.stockLotsReport);
app.get('/reports/stock/movements', stockReports.stockMovementsReport);
app.get('/reports/stock/inventories', stockReports.stockInventoriesReport);
Expand Down
10 changes: 6 additions & 4 deletions server/controllers/finance/journal/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -389,8 +389,8 @@ function transformColumns(rows, newRecord) {

if (row.account_label) {
delete row.account_label;
}
}

if (row.hrEntity) {
// reverse barcode lookup entity
databaseRequests.push(ENTITY_QUERY);
Expand Down Expand Up @@ -502,10 +502,12 @@ function reverse(req, res, next) {
*
*/
function count(req, res, next) {
const sql = `SELECT COUNT(DISTINCT posting_journal.trans_id) AS number_transactions FROM posting_journal;`;
const sql = `
SELECT COUNT(DISTINCT posting_journal.trans_id) AS number_transactions FROM posting_journal;
`;

db.exec(sql)
.then(function (rows) {
.then((rows) => {
res.status(200).send(rows);
})
.catch(next);
Expand Down
7 changes: 4 additions & 3 deletions server/controllers/finance/trialBalance/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
const db = require('../../../lib/db');
const BadRequest = require('../../../lib/errors/BadRequest');

exports.getDataPerAccount = function (req, res, next) {
exports.getDataPerAccount = function getDataPerAccount(req, res, next) {
const transactions = req.body.transactions;

if (!transactions) {
Expand Down Expand Up @@ -40,7 +40,8 @@ exports.getDataPerAccount = function (req, res, next) {
WHERE posting_journal.trans_id IN (?)
GROUP BY posting_journal.account_id
) AS combined
JOIN account ON account.id = combined.account_id;
JOIN account ON account.id = combined.account_id
ORDER BY account.number;
`;

// execute the query
Expand Down Expand Up @@ -108,7 +109,7 @@ exports.checkTransactions = function runTrialBalance(req, res, next) {
* This function can be called only when there is no fatal error
* It posts data to the general ledger.
**/
exports.postToGeneralLedger = function (req, res, next) {
exports.postToGeneralLedger = function postToGeneralLedger(req, res, next) {
const transactions = req.body.transactions;

if (!transactions || !Array.isArray(transactions)) {
Expand Down