mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-15 20:30:33 +00:00
fix bugs.
This commit is contained in:
@@ -29,6 +29,7 @@
|
||||
<body>
|
||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||
<div id="root"></div>
|
||||
<div id="nprogress"></div>
|
||||
<!--
|
||||
This HTML file is a template.
|
||||
If you open it directly in the browser, you will see an empty page.
|
||||
|
||||
@@ -6,7 +6,7 @@ export const fetchGeneralLedger = ({ query }) => {
|
||||
dispatch({
|
||||
type: t.GENERAL_LEDGER_SHEET_LOADING,
|
||||
loading: true,
|
||||
})
|
||||
});
|
||||
ApiService.get('/financial_statements/general_ledger', { params: query }).then((response) => {
|
||||
dispatch({
|
||||
type: t.GENERAL_LEDGER_STATEMENT_SET,
|
||||
@@ -23,6 +23,9 @@ export const fetchGeneralLedger = ({ query }) => {
|
||||
|
||||
export const fetchBalanceSheet = ({ query }) => {
|
||||
return (dispatch) => new Promise((resolve, reject) => {
|
||||
dispatch({
|
||||
type: t.SET_DASHBOARD_REQUEST_LOADING,
|
||||
});
|
||||
dispatch({
|
||||
type: t.BALANCE_SHEET_LOADING,
|
||||
loading: true,
|
||||
@@ -37,6 +40,9 @@ export const fetchBalanceSheet = ({ query }) => {
|
||||
type: t.BALANCE_SHEET_LOADING,
|
||||
loading: false,
|
||||
});
|
||||
dispatch({
|
||||
type: t.SET_DASHBOARD_REQUEST_COMPLETED,
|
||||
});
|
||||
resolve(response);
|
||||
}).catch((error) => { reject(error); });
|
||||
});
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
import BaseModel from '@/models/Model';
|
||||
|
||||
export default class TenantModel extends BaseModel{
|
||||
}
|
||||
export default class TenantModel extends BaseModel {
|
||||
static tenant() {
|
||||
if (!this.knexBinded) {
|
||||
throw new Error('Tenant knex is not binded yet.');
|
||||
}
|
||||
return super.bindKnex(this.knexBinded);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,7 +86,8 @@ export default class JournalPoster {
|
||||
let balanceAccounts = [];
|
||||
|
||||
balancesList.forEach((balance) => {
|
||||
const oper = AccountBalance.query().findOne('account_id', balance.account_id);
|
||||
const oper = AccountBalance.tenant()
|
||||
.query().findOne('account_id', balance.account_id);
|
||||
balanceFindOneOpers.push(oper);
|
||||
});
|
||||
balanceAccounts = await Promise.all(balanceFindOneOpers);
|
||||
@@ -99,13 +100,13 @@ export default class JournalPoster {
|
||||
account && account.account_id === balance.account_id
|
||||
));
|
||||
if (foundAccBalance) {
|
||||
const query = AccountBalance
|
||||
const query = AccountBalance.tenant()
|
||||
.query()[method]('amount', Math.abs(balance.amount))
|
||||
.where('account_id', balance.account_id);
|
||||
|
||||
balanceUpdateOpers.push(query);
|
||||
} else {
|
||||
const query = AccountBalance.query().insert({
|
||||
const query = AccountBalance.tenant().query().insert({
|
||||
account_id: balance.account_id,
|
||||
amount: balance.amount,
|
||||
currency_code: 'USD',
|
||||
@@ -125,7 +126,7 @@ export default class JournalPoster {
|
||||
const saveOperations = [];
|
||||
|
||||
this.entries.forEach((entry) => {
|
||||
const oper = AccountTransaction.query().insert({
|
||||
const oper = AccountTransaction.tenant().query().insert({
|
||||
accountId: entry.account,
|
||||
...pick(entry, ['credit', 'debit', 'transactionType', 'date', 'userId',
|
||||
'referenceType', 'referenceId', 'note']),
|
||||
|
||||
Reference in New Issue
Block a user