- feat: Sales estimates.

- feat: Sales invoices.
- feat: Sales payment receives.
- feat: Purchases bills.
- feat: Purchases bills payments that made to the vendors.
This commit is contained in:
Ahmed Bouhuolia
2020-08-03 22:46:50 +02:00
parent 56278a25f0
commit db28cd2aef
56 changed files with 3290 additions and 1208 deletions

View File

@@ -1,9 +1,24 @@
import { Account } from '@/models';
import { Account, AccountType } from '@/models';
export default class AccountsService {
static async isAccountExists(accountId) {
const foundAccounts = await Account.tenant().query().where('id', accountId);
return foundAccounts.length > 0;
}
}
static async getAccountByType(accountTypeKey) {
const accountType = await AccountType.tenant()
.query()
.where('key', accountTypeKey)
.first();
const account = await Account.tenant()
.query()
.where('account_type_id', accountType.id)
.first();
console.log(account);
return account;
}
}