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