mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-15 20:30:33 +00:00
Merge pull request #389 from bigcapitalhq/accounts-bank-transactions-demo-sheet
feat: add sample sheet to accounts and bank transactions
This commit is contained in:
@@ -242,7 +242,7 @@
|
||||
"account.field.normal.credit": "دائن",
|
||||
"account.field.normal.debit": "مدين",
|
||||
"account.field.type": "نوع الحساب",
|
||||
"account.field.active": "Activity",
|
||||
"account.field.active": "Active",
|
||||
"account.field.balance": "الرصيد",
|
||||
"account.field.created_at": "أنشئت في",
|
||||
"item.field.type": "نوع الصنف",
|
||||
|
||||
@@ -241,7 +241,8 @@
|
||||
"account.field.normal.credit": "Credit",
|
||||
"account.field.normal.debit": "Debit",
|
||||
"account.field.type": "Type",
|
||||
"account.field.active": "Activity",
|
||||
"account.field.active": "Active",
|
||||
"account.field.currency": "Currency",
|
||||
"account.field.balance": "Balance",
|
||||
"account.field.created_at": "Created at",
|
||||
"item.field.type": "Item type",
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
export const AccountsSampleData = [
|
||||
{
|
||||
'Account Name': 'Utilities Expense',
|
||||
'Account Code': 9000,
|
||||
Type: 'Expense',
|
||||
Description: 'Omnis voluptatum consequatur.',
|
||||
Active: 'T',
|
||||
'Currency Code': '',
|
||||
},
|
||||
{
|
||||
'Account Name': 'Unearned Revenue',
|
||||
'Account Code': 9010,
|
||||
Type: 'Long Term Liability',
|
||||
Description: 'Autem odit voluptas nihil unde.',
|
||||
Active: 'T',
|
||||
'Currency Code': '',
|
||||
},
|
||||
{
|
||||
'Account Name': 'Long-Term Debt',
|
||||
'Account Code': 9020,
|
||||
Type: 'Long Term Liability',
|
||||
Description: 'In voluptas cumque exercitationem.',
|
||||
Active: 'T',
|
||||
'Currency Code': '',
|
||||
},
|
||||
{
|
||||
'Account Name': 'Salaries and Wages Expense',
|
||||
'Account Code': 9030,
|
||||
Type: 'Expense',
|
||||
Description: 'Assumenda aspernatur soluta aliquid perspiciatis quasi.',
|
||||
Active: 'T',
|
||||
'Currency Code': '',
|
||||
},
|
||||
{
|
||||
'Account Name': 'Rental Income',
|
||||
'Account Code': 9040,
|
||||
Type: 'Income',
|
||||
Description: 'Omnis possimus amet occaecati inventore.',
|
||||
Active: 'T',
|
||||
'Currency Code': '',
|
||||
},
|
||||
{
|
||||
'Account Name': 'Paypal',
|
||||
'Account Code': 9050,
|
||||
Type: 'Bank',
|
||||
Description: 'In voluptas cumque exercitationem.',
|
||||
Active: 'T',
|
||||
'Currency Code': '',
|
||||
},
|
||||
];
|
||||
@@ -3,6 +3,7 @@ import { Knex } from 'knex';
|
||||
import { IAccountCreateDTO } from '@/interfaces';
|
||||
import { CreateAccount } from './CreateAccount';
|
||||
import { Importable } from '../Import/Importable';
|
||||
import { AccountsSampleData } from './AccountsImportable.SampleData';
|
||||
|
||||
@Service()
|
||||
export class AccountsImportable extends Importable {
|
||||
@@ -35,11 +36,10 @@ export class AccountsImportable extends Importable {
|
||||
return 1;
|
||||
}
|
||||
|
||||
public public sampleData(): any[] {
|
||||
return [
|
||||
{
|
||||
|
||||
}
|
||||
]
|
||||
/**
|
||||
* Retrieves the sample data that used to download accounts sample sheet.
|
||||
*/
|
||||
public sampleData(): any[] {
|
||||
return AccountsSampleData;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import { CreateUncategorizedTransaction } from './CreateUncategorizedTransaction
|
||||
import { CreateUncategorizedTransactionDTO } from '@/interfaces';
|
||||
import { ImportableContext } from '../Import/interfaces';
|
||||
import HasTenancyService from '../Tenancy/TenancyService';
|
||||
import { ImportSampleData } from './constants';
|
||||
import { BankTransactionsSampleData } from './constants';
|
||||
|
||||
@Service()
|
||||
export class UncategorizedTransactionsImportable extends Importable {
|
||||
@@ -32,8 +32,8 @@ export class UncategorizedTransactionsImportable extends Importable {
|
||||
|
||||
/**
|
||||
* Transformes the DTO before validating and importing.
|
||||
* @param {CreateUncategorizedTransactionDTO} createDTO
|
||||
* @param {ImportableContext} context
|
||||
* @param {CreateUncategorizedTransactionDTO} createDTO
|
||||
* @param {ImportableContext} context
|
||||
* @returns {CreateUncategorizedTransactionDTO}
|
||||
*/
|
||||
public transform(
|
||||
@@ -51,7 +51,7 @@ export class UncategorizedTransactionsImportable extends Importable {
|
||||
* @returns {Record<string, any>[]}
|
||||
*/
|
||||
public sampleData(): Record<string, any>[] {
|
||||
return ImportSampleData;
|
||||
return BankTransactionsSampleData;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -76,9 +76,7 @@ export class UncategorizedTransactionsImportable extends Importable {
|
||||
const { Account } = this.tenancy.models(tenantId);
|
||||
|
||||
if (params.accountId) {
|
||||
await Account.query()
|
||||
.findById(params.accountId)
|
||||
.throwIfNotFound({});
|
||||
await Account.query().findById(params.accountId).throwIfNotFound({});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,8 +11,10 @@ export const ERRORS = {
|
||||
ACCOUNT_HAS_ASSOCIATED_TRANSACTIONS: 'account_has_associated_transactions',
|
||||
TRANSACTION_ALREADY_CATEGORIZED: 'TRANSACTION_ALREADY_CATEGORIZED',
|
||||
TRANSACTION_ALREADY_UNCATEGORIZED: 'TRANSACTION_ALREADY_UNCATEGORIZED',
|
||||
UNCATEGORIZED_TRANSACTION_TYPE_INVALID: 'UNCATEGORIZED_TRANSACTION_TYPE_INVALID',
|
||||
CANNOT_DELETE_TRANSACTION_CONVERTED_FROM_UNCATEGORIZED: 'CANNOT_DELETE_TRANSACTION_CONVERTED_FROM_UNCATEGORIZED'
|
||||
UNCATEGORIZED_TRANSACTION_TYPE_INVALID:
|
||||
'UNCATEGORIZED_TRANSACTION_TYPE_INVALID',
|
||||
CANNOT_DELETE_TRANSACTION_CONVERTED_FROM_UNCATEGORIZED:
|
||||
'CANNOT_DELETE_TRANSACTION_CONVERTED_FROM_UNCATEGORIZED',
|
||||
};
|
||||
|
||||
export enum CASHFLOW_DIRECTION {
|
||||
@@ -76,24 +78,28 @@ export interface ICashflowTransactionTypeMeta {
|
||||
creditType: string[];
|
||||
}
|
||||
|
||||
|
||||
export const ImportSampleData = [
|
||||
{
|
||||
Amount: 5000,
|
||||
Date: '2024-01-01',
|
||||
Payee: 'John Roberts',
|
||||
Description: 'Cheque deposit',
|
||||
},
|
||||
{
|
||||
Amount: 5000,
|
||||
Date: '2024-01-01',
|
||||
Payee: 'John Roberts',
|
||||
Description: 'Cheque deposit',
|
||||
},
|
||||
{
|
||||
Amount: 5000,
|
||||
Date: '2024-01-01',
|
||||
Payee: 'John Roberts',
|
||||
Description: 'Cheque deposit',
|
||||
},
|
||||
]
|
||||
export const BankTransactionsSampleData = [
|
||||
[
|
||||
{
|
||||
Amount: '6,410.19',
|
||||
Date: '2024-03-26',
|
||||
Payee: 'MacGyver and Sons',
|
||||
'Reference No.': 'REF-1',
|
||||
Description: 'Commodi quo labore.',
|
||||
},
|
||||
{
|
||||
Amount: '8,914.17',
|
||||
Date: '2024-01-05',
|
||||
Payee: 'Eichmann - Bergnaum',
|
||||
'Reference No.': 'REF-1',
|
||||
Description: 'Quia enim et.',
|
||||
},
|
||||
{
|
||||
Amount: '6,200.88',
|
||||
Date: '2024-02-17',
|
||||
Payee: 'Luettgen, Mraz and Legros',
|
||||
'Reference No.': 'REF-1',
|
||||
Description: 'Occaecati consequuntur cum impedit illo.',
|
||||
},
|
||||
],
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user