mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-27 01:59:48 +00:00
Compare commits
9 Commits
feat/accou
...
v0.24.15
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5dd7179cca | ||
|
|
3575d54efa | ||
|
|
6991ec7780 | ||
|
|
ad252d2e4a | ||
|
|
12eb8c32dc | ||
|
|
ca68918caa | ||
|
|
fa1acc9773 | ||
|
|
558fc29962 | ||
|
|
8a32e13a79 |
@@ -1,5 +1,6 @@
|
|||||||
import { QueryBuilder, Model } from 'objection';
|
import { QueryBuilder, Model, mixin } from 'objection';
|
||||||
import { ModelHasRelationsError } from '@/common/exceptions/ModelHasRelations.exception';
|
import { ModelHasRelationsError } from '@/common/exceptions/ModelHasRelations.exception';
|
||||||
|
import { withDateSessionMixin } from './withDateSessionMixin';
|
||||||
|
|
||||||
interface PaginationResult<M extends Model> {
|
interface PaginationResult<M extends Model> {
|
||||||
results: M[];
|
results: M[];
|
||||||
@@ -69,6 +70,7 @@ export class PaginationQueryBuilder<
|
|||||||
dependentRelationNames.forEach((relationName: string) => {
|
dependentRelationNames.forEach((relationName: string) => {
|
||||||
recordQuery.withGraphFetched(relationName);
|
recordQuery.withGraphFetched(relationName);
|
||||||
});
|
});
|
||||||
|
|
||||||
const record = await recordQuery;
|
const record = await recordQuery;
|
||||||
|
|
||||||
const hasRelations = dependentRelationNames.some((name) => {
|
const hasRelations = dependentRelationNames.some((name) => {
|
||||||
@@ -97,7 +99,7 @@ export class BaseQueryBuilder<
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class BaseModel extends Model {
|
export class BaseModel extends mixin(Model, [withDateSessionMixin]) {
|
||||||
public readonly id: number;
|
public readonly id: number;
|
||||||
public readonly tableName: string;
|
public readonly tableName: string;
|
||||||
|
|
||||||
|
|||||||
40
packages/server/src/models/withDateSessionMixin.ts
Normal file
40
packages/server/src/models/withDateSessionMixin.ts
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
import * as moment from 'moment';
|
||||||
|
import { Model } from 'objection';
|
||||||
|
|
||||||
|
type Constructor<T = {}> = new (...args: any[]) => T;
|
||||||
|
|
||||||
|
export const withDateSessionMixin = <T extends Constructor<Model>>(BaseModel: T) => {
|
||||||
|
return class DateSession extends BaseModel {
|
||||||
|
constructor(...args: any[]) {
|
||||||
|
super(...args);
|
||||||
|
}
|
||||||
|
|
||||||
|
get timestamps() {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
$beforeUpdate(opt, context) {
|
||||||
|
const maybePromise = super.$beforeUpdate(opt, context);
|
||||||
|
|
||||||
|
return Promise.resolve(maybePromise).then(() => {
|
||||||
|
const key = this.timestamps[1];
|
||||||
|
|
||||||
|
if (key && !this[key]) {
|
||||||
|
this[key] = moment().format('YYYY/MM/DD HH:mm:ss');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
$beforeInsert(context) {
|
||||||
|
const maybePromise = super.$beforeInsert(context);
|
||||||
|
|
||||||
|
return Promise.resolve(maybePromise).then(() => {
|
||||||
|
const key = this.timestamps[0];
|
||||||
|
|
||||||
|
if (key && !this[key]) {
|
||||||
|
this[key] = moment().format('YYYY/MM/DD HH:mm:ss');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -15,6 +15,8 @@ import { AttachmentsOnPaymentsReceived } from "./events/AttachmentsOnPaymentsRec
|
|||||||
import { AttachmentsOnManualJournals } from "./events/AttachmentsOnManualJournals";
|
import { AttachmentsOnManualJournals } from "./events/AttachmentsOnManualJournals";
|
||||||
import { AttachmentsOnVendorCredits } from "./events/AttachmentsOnVendorCredits";
|
import { AttachmentsOnVendorCredits } from "./events/AttachmentsOnVendorCredits";
|
||||||
import { AttachmentsOnSaleInvoiceCreated } from "./events/AttachmentsOnSaleInvoice";
|
import { AttachmentsOnSaleInvoiceCreated } from "./events/AttachmentsOnSaleInvoice";
|
||||||
|
import { AttachmentsOnSaleReceipt } from "./events/AttachmentsOnSaleReceipts";
|
||||||
|
import { AttachmentsOnSaleEstimates } from "./events/AttachmentsOnSaleEstimates";
|
||||||
import { AttachmentsController } from "./Attachments.controller";
|
import { AttachmentsController } from "./Attachments.controller";
|
||||||
import { RegisterTenancyModel } from "../Tenancy/TenancyModels/Tenancy.module";
|
import { RegisterTenancyModel } from "../Tenancy/TenancyModels/Tenancy.module";
|
||||||
import { DocumentModel } from "./models/Document.model";
|
import { DocumentModel } from "./models/Document.model";
|
||||||
@@ -50,6 +52,8 @@ const models = [
|
|||||||
AttachmentsOnManualJournals,
|
AttachmentsOnManualJournals,
|
||||||
AttachmentsOnVendorCredits,
|
AttachmentsOnVendorCredits,
|
||||||
AttachmentsOnSaleInvoiceCreated,
|
AttachmentsOnSaleInvoiceCreated,
|
||||||
|
AttachmentsOnSaleReceipt,
|
||||||
|
AttachmentsOnSaleEstimates,
|
||||||
AttachmentsApplication,
|
AttachmentsApplication,
|
||||||
UploadDocument,
|
UploadDocument,
|
||||||
AttachmentUploadPipeline,
|
AttachmentUploadPipeline,
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ export class AttachmentsOnPaymentsReceived {
|
|||||||
);
|
);
|
||||||
await this.linkAttachmentService.bulkLink(
|
await this.linkAttachmentService.bulkLink(
|
||||||
keys,
|
keys,
|
||||||
'PaymentReceive',
|
'PaymentReceived',
|
||||||
paymentReceive.id,
|
paymentReceive.id,
|
||||||
trx,
|
trx,
|
||||||
);
|
);
|
||||||
@@ -76,7 +76,7 @@ export class AttachmentsOnPaymentsReceived {
|
|||||||
);
|
);
|
||||||
await this.unlinkAttachmentService.unlinkUnpresentedKeys(
|
await this.unlinkAttachmentService.unlinkUnpresentedKeys(
|
||||||
keys,
|
keys,
|
||||||
'PaymentReceive',
|
'PaymentReceived',
|
||||||
oldPaymentReceive.id,
|
oldPaymentReceive.id,
|
||||||
trx,
|
trx,
|
||||||
);
|
);
|
||||||
@@ -100,7 +100,7 @@ export class AttachmentsOnPaymentsReceived {
|
|||||||
);
|
);
|
||||||
await this.linkAttachmentService.bulkLink(
|
await this.linkAttachmentService.bulkLink(
|
||||||
keys,
|
keys,
|
||||||
'PaymentReceive',
|
'PaymentReceived',
|
||||||
oldPaymentReceive.id,
|
oldPaymentReceive.id,
|
||||||
trx,
|
trx,
|
||||||
);
|
);
|
||||||
@@ -117,7 +117,7 @@ export class AttachmentsOnPaymentsReceived {
|
|||||||
trx,
|
trx,
|
||||||
}: IPaymentReceivedDeletingPayload) {
|
}: IPaymentReceivedDeletingPayload) {
|
||||||
await this.unlinkAttachmentService.unlinkAllModelKeys(
|
await this.unlinkAttachmentService.unlinkAllModelKeys(
|
||||||
'PaymentReceive',
|
'PaymentReceived',
|
||||||
oldPaymentReceive.id,
|
oldPaymentReceive.id,
|
||||||
trx,
|
trx,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import { GetBankAccountsService } from './queries/GetBankAccounts.service';
|
|||||||
import { DynamicListModule } from '../DynamicListing/DynamicList.module';
|
import { DynamicListModule } from '../DynamicListing/DynamicList.module';
|
||||||
import { BankAccount } from './models/BankAccount';
|
import { BankAccount } from './models/BankAccount';
|
||||||
import { LedgerModule } from '../Ledger/Ledger.module';
|
import { LedgerModule } from '../Ledger/Ledger.module';
|
||||||
|
import { TenancyModule } from '../Tenancy/Tenancy.module';
|
||||||
import { GetBankAccountTransactionsService } from './queries/GetBankAccountTransactions/GetBankAccountTransactions.service';
|
import { GetBankAccountTransactionsService } from './queries/GetBankAccountTransactions/GetBankAccountTransactions.service';
|
||||||
import { GetBankAccountTransactionsRepository } from './queries/GetBankAccountTransactions/GetBankAccountTransactionsRepo.service';
|
import { GetBankAccountTransactionsRepository } from './queries/GetBankAccountTransactions/GetBankAccountTransactionsRepo.service';
|
||||||
import { GetUncategorizedTransactions } from './queries/GetUncategorizedTransactions';
|
import { GetUncategorizedTransactions } from './queries/GetUncategorizedTransactions';
|
||||||
@@ -46,6 +47,7 @@ const models = [
|
|||||||
LedgerModule,
|
LedgerModule,
|
||||||
BranchesModule,
|
BranchesModule,
|
||||||
DynamicListModule,
|
DynamicListModule,
|
||||||
|
TenancyModule,
|
||||||
...models,
|
...models,
|
||||||
],
|
],
|
||||||
controllers: [
|
controllers: [
|
||||||
|
|||||||
@@ -4,12 +4,14 @@ import { GetBankAccountTransactionsRepository } from './GetBankAccountTransactio
|
|||||||
import { GetBankAccountTransactions } from './GetBankAccountTransactions';
|
import { GetBankAccountTransactions } from './GetBankAccountTransactions';
|
||||||
import { GetBankTransactionsQueryDto } from '../../dtos/GetBankTranasctionsQuery.dto';
|
import { GetBankTransactionsQueryDto } from '../../dtos/GetBankTranasctionsQuery.dto';
|
||||||
import { I18nService } from 'nestjs-i18n';
|
import { I18nService } from 'nestjs-i18n';
|
||||||
|
import { TenancyContext } from '@/modules/Tenancy/TenancyContext.service';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class GetBankAccountTransactionsService {
|
export class GetBankAccountTransactionsService {
|
||||||
constructor(
|
constructor(
|
||||||
private readonly getBankAccountTransactionsRepository: GetBankAccountTransactionsRepository,
|
private readonly getBankAccountTransactionsRepository: GetBankAccountTransactionsRepository,
|
||||||
private readonly i18nService: I18nService
|
private readonly i18nService: I18nService,
|
||||||
|
private readonly tenancyContext: TenancyContext,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -28,11 +30,16 @@ export class GetBankAccountTransactionsService {
|
|||||||
|
|
||||||
await this.getBankAccountTransactionsRepository.asyncInit();
|
await this.getBankAccountTransactionsRepository.asyncInit();
|
||||||
|
|
||||||
|
// Retrieve the tenant metadata to get the date format.
|
||||||
|
const tenantMetadata = await this.tenancyContext.getTenantMetadata();
|
||||||
|
const dateFormat = tenantMetadata?.dateFormat;
|
||||||
|
|
||||||
// Retrieve the computed report.
|
// Retrieve the computed report.
|
||||||
const report = new GetBankAccountTransactions(
|
const report = new GetBankAccountTransactions(
|
||||||
this.getBankAccountTransactionsRepository,
|
this.getBankAccountTransactionsRepository,
|
||||||
parsedQuery,
|
parsedQuery,
|
||||||
this.i18nService
|
this.i18nService,
|
||||||
|
dateFormat,
|
||||||
);
|
);
|
||||||
const transactions = report.reportData();
|
const transactions = report.reportData();
|
||||||
const pagination = this.getBankAccountTransactionsRepository.pagination;
|
const pagination = this.getBankAccountTransactionsRepository.pagination;
|
||||||
|
|||||||
@@ -24,17 +24,20 @@ export class GetBankAccountTransactions extends FinancialSheet {
|
|||||||
* @param {IAccountTransaction[]} transactions -
|
* @param {IAccountTransaction[]} transactions -
|
||||||
* @param {number} openingBalance -
|
* @param {number} openingBalance -
|
||||||
* @param {ICashflowAccountTransactionsQuery} query -
|
* @param {ICashflowAccountTransactionsQuery} query -
|
||||||
|
* @param {string} dateFormat - The date format from organization settings.
|
||||||
*/
|
*/
|
||||||
constructor(
|
constructor(
|
||||||
repo: GetBankAccountTransactionsRepository,
|
repo: GetBankAccountTransactionsRepository,
|
||||||
query: ICashflowAccountTransactionsQuery,
|
query: ICashflowAccountTransactionsQuery,
|
||||||
i18n: I18nService,
|
i18n: I18nService,
|
||||||
|
dateFormat?: string,
|
||||||
) {
|
) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
this.repo = repo;
|
this.repo = repo;
|
||||||
this.query = query;
|
this.query = query;
|
||||||
this.i18n = i18n;
|
this.i18n = i18n;
|
||||||
|
this.dateFormat = dateFormat || this.dateFormat;
|
||||||
|
|
||||||
this.runningBalance = runningBalance(this.repo.openingBalance);
|
this.runningBalance = runningBalance(this.repo.openingBalance);
|
||||||
}
|
}
|
||||||
@@ -98,7 +101,7 @@ export class GetBankAccountTransactions extends FinancialSheet {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
date: transaction.date,
|
date: transaction.date,
|
||||||
formattedDate: moment(transaction.date).format('YYYY-MM-DD'),
|
formattedDate: this.getDateFormatted(transaction.date),
|
||||||
|
|
||||||
withdrawal: transaction.credit,
|
withdrawal: transaction.credit,
|
||||||
deposit: transaction.debit,
|
deposit: transaction.debit,
|
||||||
|
|||||||
@@ -13,6 +13,13 @@ export class BillLandedCostEntry extends BaseModel {
|
|||||||
return 'bill_located_cost_entries';
|
return 'bill_located_cost_entries';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Timestamps columns.
|
||||||
|
*/
|
||||||
|
get timestamps() {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Relationship mapping.
|
* Relationship mapping.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -9,7 +9,9 @@ import { BillPaymentMeta } from './BillPayment.meta';
|
|||||||
import { TenantBaseModel } from '@/modules/System/models/TenantBaseModel';
|
import { TenantBaseModel } from '@/modules/System/models/TenantBaseModel';
|
||||||
import { InjectModelDefaultViews } from '@/modules/Views/decorators/InjectModelDefaultViews.decorator';
|
import { InjectModelDefaultViews } from '@/modules/Views/decorators/InjectModelDefaultViews.decorator';
|
||||||
import { BillPaymentDefaultViews } from '../constants';
|
import { BillPaymentDefaultViews } from '../constants';
|
||||||
|
import { InjectAttachable } from '@/modules/Attachments/decorators/InjectAttachable.decorator';
|
||||||
|
|
||||||
|
@InjectAttachable()
|
||||||
@ImportableModel()
|
@ImportableModel()
|
||||||
@ExportableModel()
|
@ExportableModel()
|
||||||
@InjectModelMeta(BillPaymentMeta)
|
@InjectModelMeta(BillPaymentMeta)
|
||||||
|
|||||||
@@ -13,7 +13,9 @@ import { InjectModelMeta } from '@/modules/Tenancy/TenancyModels/decorators/Inje
|
|||||||
import { BillMeta } from './Bill.meta';
|
import { BillMeta } from './Bill.meta';
|
||||||
import { InjectModelDefaultViews } from '@/modules/Views/decorators/InjectModelDefaultViews.decorator';
|
import { InjectModelDefaultViews } from '@/modules/Views/decorators/InjectModelDefaultViews.decorator';
|
||||||
import { BillDefaultViews } from '../Bills.constants';
|
import { BillDefaultViews } from '../Bills.constants';
|
||||||
|
import { InjectAttachable } from '@/modules/Attachments/decorators/InjectAttachable.decorator';
|
||||||
|
|
||||||
|
@InjectAttachable()
|
||||||
@ExportableModel()
|
@ExportableModel()
|
||||||
@InjectModelMeta(BillMeta)
|
@InjectModelMeta(BillMeta)
|
||||||
@InjectModelDefaultViews(BillDefaultViews)
|
@InjectModelDefaultViews(BillDefaultViews)
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ export class Branch extends BaseModel{
|
|||||||
* Timestamps columns.
|
* Timestamps columns.
|
||||||
*/
|
*/
|
||||||
get timestamps() {
|
get timestamps() {
|
||||||
return ['created_at', 'updated_at'];
|
return ['createdAt', 'updatedAt'];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ export class DocumentLink extends BaseModel{
|
|||||||
* Relationship mapping.
|
* Relationship mapping.
|
||||||
*/
|
*/
|
||||||
static get relationMappings() {
|
static get relationMappings() {
|
||||||
const Document = require('./Document');
|
const { Document } = require('./Document');
|
||||||
|
|
||||||
return {
|
return {
|
||||||
/**
|
/**
|
||||||
@@ -36,7 +36,7 @@ export class DocumentLink extends BaseModel{
|
|||||||
*/
|
*/
|
||||||
document: {
|
document: {
|
||||||
relation: Model.HasOneRelation,
|
relation: Model.HasOneRelation,
|
||||||
modelClass: Document.default,
|
modelClass: Document,
|
||||||
join: {
|
join: {
|
||||||
from: 'document_links.documentId',
|
from: 'document_links.documentId',
|
||||||
to: 'documents.id',
|
to: 'documents.id',
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ export class RefundCreditNote extends BaseModel {
|
|||||||
* Timestamps columns.
|
* Timestamps columns.
|
||||||
*/
|
*/
|
||||||
get timestamps() {
|
get timestamps() {
|
||||||
return ['created_at', 'updated_at'];
|
return ['createdAt', 'updatedAt'];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -11,7 +11,9 @@ import { Warehouse } from '@/modules/Warehouses/models/Warehouse.model';
|
|||||||
import { CreditNoteMeta } from './CreditNote.meta';
|
import { CreditNoteMeta } from './CreditNote.meta';
|
||||||
import { InjectModelDefaultViews } from '@/modules/Views/decorators/InjectModelDefaultViews.decorator';
|
import { InjectModelDefaultViews } from '@/modules/Views/decorators/InjectModelDefaultViews.decorator';
|
||||||
import { CreditNoteDefaultViews } from '../constants';
|
import { CreditNoteDefaultViews } from '../constants';
|
||||||
|
import { InjectAttachable } from '@/modules/Attachments/decorators/InjectAttachable.decorator';
|
||||||
|
|
||||||
|
@InjectAttachable()
|
||||||
@ExportableModel()
|
@ExportableModel()
|
||||||
@ImportableModel()
|
@ImportableModel()
|
||||||
@InjectModelMeta(CreditNoteMeta)
|
@InjectModelMeta(CreditNoteMeta)
|
||||||
@@ -56,7 +58,7 @@ export class CreditNote extends TenantBaseModel {
|
|||||||
* Timestamps columns.
|
* Timestamps columns.
|
||||||
*/
|
*/
|
||||||
get timestamps() {
|
get timestamps() {
|
||||||
return ['created_at', 'updated_at'];
|
return ['createdAt', 'updatedAt'];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ export class CreditNoteAppliedInvoice extends BaseModel {
|
|||||||
* Timestamps columns.
|
* Timestamps columns.
|
||||||
*/
|
*/
|
||||||
get timestamps() {
|
get timestamps() {
|
||||||
return ['created_at', 'updated_at'];
|
return ['createdAt', 'updatedAt'];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -9,7 +9,9 @@ import { InjectModelMeta } from '@/modules/Tenancy/TenancyModels/decorators/Inje
|
|||||||
import { ExpenseMeta } from './Expense.meta';
|
import { ExpenseMeta } from './Expense.meta';
|
||||||
import { InjectModelDefaultViews } from '@/modules/Views/decorators/InjectModelDefaultViews.decorator';
|
import { InjectModelDefaultViews } from '@/modules/Views/decorators/InjectModelDefaultViews.decorator';
|
||||||
import { ExpenseDefaultViews } from '../constants';
|
import { ExpenseDefaultViews } from '../constants';
|
||||||
|
import { InjectAttachable } from '@/modules/Attachments/decorators/InjectAttachable.decorator';
|
||||||
|
|
||||||
|
@InjectAttachable()
|
||||||
@ExportableModel()
|
@ExportableModel()
|
||||||
@ImportableModel()
|
@ImportableModel()
|
||||||
@InjectModelMeta(ExpenseMeta)
|
@InjectModelMeta(ExpenseMeta)
|
||||||
|
|||||||
@@ -149,6 +149,11 @@ export class FinancialSheet {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected getDateFormatted(date: moment.MomentInput, format?: string) {
|
||||||
|
const dateFormat = format || this.dateFormat || 'YYYY MMM DD';
|
||||||
|
return moment(date).format(dateFormat);
|
||||||
|
}
|
||||||
|
|
||||||
getPercentageBasis = (base, amount) => {
|
getPercentageBasis = (base, amount) => {
|
||||||
return base ? amount / base : 0;
|
return base ? amount / base : 0;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ export class TransactionsByReferenceService {
|
|||||||
const report = new TransactionsByReference(
|
const report = new TransactionsByReference(
|
||||||
transactions,
|
transactions,
|
||||||
filter,
|
filter,
|
||||||
tenantMetadata.baseCurrency
|
{ baseCurrency: tenantMetadata.baseCurrency, dateFormat: tenantMetadata.dateFormat }
|
||||||
);
|
);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import {
|
|||||||
import { FinancialSheet } from '../../common/FinancialSheet';
|
import { FinancialSheet } from '../../common/FinancialSheet';
|
||||||
import { ModelObject } from 'objection';
|
import { ModelObject } from 'objection';
|
||||||
import { AccountTransaction } from '@/modules/Accounts/models/AccountTransaction.model';
|
import { AccountTransaction } from '@/modules/Accounts/models/AccountTransaction.model';
|
||||||
import { INumberFormatQuery } from '../../types/Report.types';
|
import { INumberFormatQuery, IFinancialReportMeta, DEFAULT_REPORT_META } from '../../types/Report.types';
|
||||||
import { TransactionsByReferenceQueryDto } from './TransactionsByReferenceQuery.dto';
|
import { TransactionsByReferenceQueryDto } from './TransactionsByReferenceQuery.dto';
|
||||||
|
|
||||||
export class TransactionsByReference extends FinancialSheet {
|
export class TransactionsByReference extends FinancialSheet {
|
||||||
@@ -17,18 +17,19 @@ export class TransactionsByReference extends FinancialSheet {
|
|||||||
* Constructor method.
|
* Constructor method.
|
||||||
* @param {ModelObject<AccountTransaction>[]} transactions
|
* @param {ModelObject<AccountTransaction>[]} transactions
|
||||||
* @param {TransactionsByVendorQueryDto} query
|
* @param {TransactionsByVendorQueryDto} query
|
||||||
* @param {string} baseCurrency
|
* @param {IFinancialReportMeta} meta
|
||||||
*/
|
*/
|
||||||
constructor(
|
constructor(
|
||||||
transactions: ModelObject<AccountTransaction>[],
|
transactions: ModelObject<AccountTransaction>[],
|
||||||
query: TransactionsByReferenceQueryDto,
|
query: TransactionsByReferenceQueryDto,
|
||||||
baseCurrency: string
|
meta: IFinancialReportMeta,
|
||||||
) {
|
) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
this.transactions = transactions;
|
this.transactions = transactions;
|
||||||
this.query = query;
|
this.query = query;
|
||||||
this.baseCurrency = baseCurrency;
|
this.baseCurrency = meta.baseCurrency;
|
||||||
|
this.dateFormat = meta.dateFormat || DEFAULT_REPORT_META.dateFormat;
|
||||||
// this.numberFormat = this.query.numberFormat;
|
// this.numberFormat = this.query.numberFormat;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ export class InventoryAdjustment extends TenantBaseModel {
|
|||||||
* Timestamps columns.
|
* Timestamps columns.
|
||||||
*/
|
*/
|
||||||
get timestamps(): Array<string> {
|
get timestamps(): Array<string> {
|
||||||
return ['created_at'];
|
return ['createdAt'];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -20,6 +20,13 @@ export class InventoryAdjustmentEntry extends BaseModel {
|
|||||||
return 'inventory_adjustments_entries';
|
return 'inventory_adjustments_entries';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Timestamps columns.
|
||||||
|
*/
|
||||||
|
get timestamps() {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Relationship mapping.
|
* Relationship mapping.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -13,6 +13,13 @@ export class InventoryTransactionMeta extends BaseModel {
|
|||||||
return 'inventory_transaction_meta';
|
return 'inventory_transaction_meta';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Timestamps columns.
|
||||||
|
*/
|
||||||
|
get timestamps() {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Relationship mapping.
|
* Relationship mapping.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -44,6 +44,13 @@ export class Item extends TenantBaseModel {
|
|||||||
return 'items';
|
return 'items';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Timestamps columns.
|
||||||
|
*/
|
||||||
|
get timestamps() {
|
||||||
|
return ['createdAt', 'updatedAt'];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Model modifiers.
|
* Model modifiers.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -8,7 +8,9 @@ import { ManualJournalMeta } from './ManualJournal.meta';
|
|||||||
import { ImportableModel } from '@/modules/Import/decorators/Import.decorator';
|
import { ImportableModel } from '@/modules/Import/decorators/Import.decorator';
|
||||||
import { InjectModelDefaultViews } from '@/modules/Views/decorators/InjectModelDefaultViews.decorator';
|
import { InjectModelDefaultViews } from '@/modules/Views/decorators/InjectModelDefaultViews.decorator';
|
||||||
import { ManualJournalDefaultViews } from '../constants';
|
import { ManualJournalDefaultViews } from '../constants';
|
||||||
|
import { InjectAttachable } from '@/modules/Attachments/decorators/InjectAttachable.decorator';
|
||||||
|
|
||||||
|
@InjectAttachable()
|
||||||
@ExportableModel()
|
@ExportableModel()
|
||||||
@ImportableModel()
|
@ImportableModel()
|
||||||
@InjectModelMeta(ManualJournalMeta)
|
@InjectModelMeta(ManualJournalMeta)
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { Model } from 'objection';
|
import { Model } from 'objection';
|
||||||
import { PaymentReceivedEntry } from './PaymentReceivedEntry';
|
import { PaymentReceivedEntry } from './PaymentReceivedEntry';
|
||||||
|
import { Document } from '@/modules/ChromiumlyTenancy/models/Document';
|
||||||
import { TenantBaseModel } from '@/modules/System/models/TenantBaseModel';
|
import { TenantBaseModel } from '@/modules/System/models/TenantBaseModel';
|
||||||
import { ExportableModel } from '@/modules/Export/decorators/ExportableModel.decorator';
|
import { ExportableModel } from '@/modules/Export/decorators/ExportableModel.decorator';
|
||||||
import { ImportableModel } from '@/modules/Import/decorators/Import.decorator';
|
import { ImportableModel } from '@/modules/Import/decorators/Import.decorator';
|
||||||
@@ -7,7 +8,9 @@ import { InjectModelMeta } from '@/modules/Tenancy/TenancyModels/decorators/Inje
|
|||||||
import { PaymentReceivedMeta } from './PaymentReceived.meta';
|
import { PaymentReceivedMeta } from './PaymentReceived.meta';
|
||||||
import { InjectModelDefaultViews } from '@/modules/Views/decorators/InjectModelDefaultViews.decorator';
|
import { InjectModelDefaultViews } from '@/modules/Views/decorators/InjectModelDefaultViews.decorator';
|
||||||
import { PaymentReceivedDefaultViews } from '../constants';
|
import { PaymentReceivedDefaultViews } from '../constants';
|
||||||
|
import { InjectAttachable } from '@/modules/Attachments/decorators/InjectAttachable.decorator';
|
||||||
|
|
||||||
|
@InjectAttachable()
|
||||||
@ExportableModel()
|
@ExportableModel()
|
||||||
@ImportableModel()
|
@ImportableModel()
|
||||||
@InjectModelMeta(PaymentReceivedMeta)
|
@InjectModelMeta(PaymentReceivedMeta)
|
||||||
@@ -31,6 +34,7 @@ export class PaymentReceived extends TenantBaseModel {
|
|||||||
updatedAt: string;
|
updatedAt: string;
|
||||||
|
|
||||||
entries?: PaymentReceivedEntry[];
|
entries?: PaymentReceivedEntry[];
|
||||||
|
public attachments!: Document[];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Table name.
|
* Table name.
|
||||||
@@ -43,7 +47,7 @@ export class PaymentReceived extends TenantBaseModel {
|
|||||||
* Timestamps columns.
|
* Timestamps columns.
|
||||||
*/
|
*/
|
||||||
get timestamps() {
|
get timestamps() {
|
||||||
return ['created_at', 'updated_at'];
|
return ['createdAt', 'updatedAt'];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -159,7 +163,7 @@ export class PaymentReceived extends TenantBaseModel {
|
|||||||
to: 'documents.id',
|
to: 'documents.id',
|
||||||
},
|
},
|
||||||
filter(query) {
|
filter(query) {
|
||||||
query.where('model_ref', 'PaymentReceive');
|
query.where('model_ref', 'PaymentReceived');
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ export class GetPaymentReceivedService {
|
|||||||
.withGraphFetched('entries.invoice')
|
.withGraphFetched('entries.invoice')
|
||||||
.withGraphFetched('transactions')
|
.withGraphFetched('transactions')
|
||||||
.withGraphFetched('branch')
|
.withGraphFetched('branch')
|
||||||
|
.withGraphFetched('attachments')
|
||||||
.findById(paymentReceiveId);
|
.findById(paymentReceiveId);
|
||||||
|
|
||||||
if (!paymentReceive) {
|
if (!paymentReceive) {
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { Transformer } from '../../Transformer/Transformer';
|
|||||||
import { PaymentReceived } from '../models/PaymentReceived';
|
import { PaymentReceived } from '../models/PaymentReceived';
|
||||||
import { PaymentReceivedEntry } from '../models/PaymentReceivedEntry';
|
import { PaymentReceivedEntry } from '../models/PaymentReceivedEntry';
|
||||||
import { PaymentReceivedEntryTransfromer } from './PaymentReceivedEntryTransformer';
|
import { PaymentReceivedEntryTransfromer } from './PaymentReceivedEntryTransformer';
|
||||||
|
import { AttachmentTransformer } from '@/modules/Attachments/Attachment.transformer';
|
||||||
|
|
||||||
export class PaymentReceiveTransfromer extends Transformer {
|
export class PaymentReceiveTransfromer extends Transformer {
|
||||||
/**
|
/**
|
||||||
@@ -17,6 +18,7 @@ export class PaymentReceiveTransfromer extends Transformer {
|
|||||||
'formattedAmount',
|
'formattedAmount',
|
||||||
'formattedExchangeRate',
|
'formattedExchangeRate',
|
||||||
'entries',
|
'entries',
|
||||||
|
'attachments',
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -89,4 +91,13 @@ export class PaymentReceiveTransfromer extends Transformer {
|
|||||||
protected entries = (payment: PaymentReceived): PaymentReceivedEntry[] => {
|
protected entries = (payment: PaymentReceived): PaymentReceivedEntry[] => {
|
||||||
return this.item(payment.entries, new PaymentReceivedEntryTransfromer());
|
return this.item(payment.entries, new PaymentReceivedEntryTransfromer());
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the payment received attachments.
|
||||||
|
* @param {PaymentReceived} payment
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
protected attachments = (payment: PaymentReceived) => {
|
||||||
|
return this.item(payment.attachments, new AttachmentTransformer());
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,13 @@ export class Role extends TenantBaseModel {
|
|||||||
return 'roles';
|
return 'roles';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Timestamps columns.
|
||||||
|
*/
|
||||||
|
get timestamps() {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Relationship mapping.
|
* Relationship mapping.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -13,6 +13,13 @@ export class RolePermission extends TenantBaseModel {
|
|||||||
return 'role_permissions';
|
return 'role_permissions';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Timestamps columns.
|
||||||
|
*/
|
||||||
|
get timestamps() {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Relationship mapping.
|
* Relationship mapping.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -12,7 +12,9 @@ import { Customer } from '@/modules/Customers/models/Customer';
|
|||||||
import { DiscountType } from '@/common/types/Discount';
|
import { DiscountType } from '@/common/types/Discount';
|
||||||
import { InjectModelDefaultViews } from '@/modules/Views/decorators/InjectModelDefaultViews.decorator';
|
import { InjectModelDefaultViews } from '@/modules/Views/decorators/InjectModelDefaultViews.decorator';
|
||||||
import { SaleEstimateDefaultViews } from '../constants';
|
import { SaleEstimateDefaultViews } from '../constants';
|
||||||
|
import { InjectAttachable } from '@/modules/Attachments/decorators/InjectAttachable.decorator';
|
||||||
|
|
||||||
|
@InjectAttachable()
|
||||||
@ExportableModel()
|
@ExportableModel()
|
||||||
@ImportableModel()
|
@ImportableModel()
|
||||||
@InjectModelMeta(SaleEstimateMeta)
|
@InjectModelMeta(SaleEstimateMeta)
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ export class SaleInvoice extends TenantBaseModel {
|
|||||||
* Timestamps columns.
|
* Timestamps columns.
|
||||||
*/
|
*/
|
||||||
get timestamps() {
|
get timestamps() {
|
||||||
return ['created_at', 'updated_at'];
|
return ['createdAt', 'updatedAt'];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import { BaseModel } from '@/models/Model';
|
|||||||
import { ItemEntry } from '@/modules/TransactionItemEntry/models/ItemEntry';
|
import { ItemEntry } from '@/modules/TransactionItemEntry/models/ItemEntry';
|
||||||
import { Customer } from '@/modules/Customers/models/Customer';
|
import { Customer } from '@/modules/Customers/models/Customer';
|
||||||
import { AccountTransaction } from '@/modules/Accounts/models/AccountTransaction.model';
|
import { AccountTransaction } from '@/modules/Accounts/models/AccountTransaction.model';
|
||||||
|
import { Document } from '@/modules/ChromiumlyTenancy/models/Document';
|
||||||
import { Branch } from '@/modules/Branches/models/Branch.model';
|
import { Branch } from '@/modules/Branches/models/Branch.model';
|
||||||
import { Warehouse } from '@/modules/Warehouses/models/Warehouse.model';
|
import { Warehouse } from '@/modules/Warehouses/models/Warehouse.model';
|
||||||
import { DiscountType } from '@/common/types/Discount';
|
import { DiscountType } from '@/common/types/Discount';
|
||||||
@@ -15,6 +16,7 @@ import { SearchableBaseModelMixin } from '@/modules/DynamicListing/models/Search
|
|||||||
import { ExportableModel } from '@/modules/Export/decorators/ExportableModel.decorator';
|
import { ExportableModel } from '@/modules/Export/decorators/ExportableModel.decorator';
|
||||||
import { ImportableModel } from '@/modules/Import/decorators/Import.decorator';
|
import { ImportableModel } from '@/modules/Import/decorators/Import.decorator';
|
||||||
import { InjectModelMeta } from '@/modules/Tenancy/TenancyModels/decorators/InjectModelMeta.decorator';
|
import { InjectModelMeta } from '@/modules/Tenancy/TenancyModels/decorators/InjectModelMeta.decorator';
|
||||||
|
import { InjectAttachable } from '@/modules/Attachments/decorators/InjectAttachable.decorator';
|
||||||
import { SaleReceiptMeta } from './SaleReceipt.meta';
|
import { SaleReceiptMeta } from './SaleReceipt.meta';
|
||||||
import { InjectModelDefaultViews } from '@/modules/Views/decorators/InjectModelDefaultViews.decorator';
|
import { InjectModelDefaultViews } from '@/modules/Views/decorators/InjectModelDefaultViews.decorator';
|
||||||
import { SaleReceiptDefaultViews } from '../constants';
|
import { SaleReceiptDefaultViews } from '../constants';
|
||||||
@@ -26,6 +28,7 @@ const ExtendedModel = R.pipe(
|
|||||||
MetadataModelMixin,
|
MetadataModelMixin,
|
||||||
)(BaseModel);
|
)(BaseModel);
|
||||||
|
|
||||||
|
@InjectAttachable()
|
||||||
@ExportableModel()
|
@ExportableModel()
|
||||||
@ImportableModel()
|
@ImportableModel()
|
||||||
@InjectModelMeta(SaleReceiptMeta)
|
@InjectModelMeta(SaleReceiptMeta)
|
||||||
@@ -58,6 +61,7 @@ export class SaleReceipt extends ExtendedModel {
|
|||||||
public customer!: Customer;
|
public customer!: Customer;
|
||||||
public entries!: ItemEntry[];
|
public entries!: ItemEntry[];
|
||||||
public transactions!: AccountTransaction[];
|
public transactions!: AccountTransaction[];
|
||||||
|
public attachments!: Document[];
|
||||||
public branch!: Branch;
|
public branch!: Branch;
|
||||||
public warehouse!: Warehouse;
|
public warehouse!: Warehouse;
|
||||||
|
|
||||||
@@ -72,7 +76,7 @@ export class SaleReceipt extends ExtendedModel {
|
|||||||
* Timestamps columns.
|
* Timestamps columns.
|
||||||
*/
|
*/
|
||||||
get timestamps() {
|
get timestamps() {
|
||||||
return ['created_at', 'updated_at'];
|
return ['createdAt', 'updatedAt'];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -139,22 +139,22 @@ export class SaleReceiptTransformer extends Transformer {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the entries of the credit note.
|
* Retrieves the entries of the sale receipt.
|
||||||
* @param {ISaleReceipt} credit
|
* @param {ISaleReceipt} receipt
|
||||||
* @returns {}
|
* @returns {}
|
||||||
*/
|
*/
|
||||||
// protected entries = (receipt: SaleReceipt) => {
|
protected entries = (receipt: SaleReceipt) => {
|
||||||
// return this.item(receipt.entries, new ItemEntryTransformer(), {
|
return this.item(receipt.entries, new ItemEntryTransformer(), {
|
||||||
// currencyCode: receipt.currencyCode,
|
currencyCode: receipt.currencyCode,
|
||||||
// });
|
});
|
||||||
// };
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the sale receipt attachments.
|
* Retrieves the sale receipt attachments.
|
||||||
* @param {SaleReceipt} receipt
|
* @param {SaleReceipt} receipt
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
// protected attachments = (receipt: SaleReceipt) => {
|
protected attachments = (receipt: SaleReceipt) => {
|
||||||
// return this.item(receipt.attachments, new AttachmentTransformer());
|
return this.item(receipt.attachments, new AttachmentTransformer());
|
||||||
// };
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,10 @@ export class Setting extends BaseModel {
|
|||||||
return 'settings';
|
return 'settings';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get timestamps() {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extra metadata query to query with the current authenticate user.
|
* Extra metadata query to query with the current authenticate user.
|
||||||
* @param {Object} query
|
* @param {Object} query
|
||||||
|
|||||||
@@ -50,6 +50,13 @@ export class TenantMetadata extends BaseModel {
|
|||||||
*/
|
*/
|
||||||
static tableName = 'tenants_metadata';
|
static tableName = 'tenants_metadata';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Timestamps columns.
|
||||||
|
*/
|
||||||
|
get timestamps() {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Virtual attributes.
|
* Virtual attributes.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ export class TenantUser extends TenantBaseModel {
|
|||||||
* Timestamps columns.
|
* Timestamps columns.
|
||||||
*/
|
*/
|
||||||
get timestamps() {
|
get timestamps() {
|
||||||
return ['created_at', 'updated_at'];
|
return ['createdAt', 'updatedAt'];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ export class ItemEntry extends BaseModel {
|
|||||||
* @returns {string[]}
|
* @returns {string[]}
|
||||||
*/
|
*/
|
||||||
get timestamps() {
|
get timestamps() {
|
||||||
return ['created_at', 'updated_at'];
|
return ['createdAt', 'updatedAt'];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -11,7 +11,9 @@ import { InjectModelMeta } from '@/modules/Tenancy/TenancyModels/decorators/Inje
|
|||||||
import { VendorCreditMeta } from './VendorCredit.meta';
|
import { VendorCreditMeta } from './VendorCredit.meta';
|
||||||
import { InjectModelDefaultViews } from '@/modules/Views/decorators/InjectModelDefaultViews.decorator';
|
import { InjectModelDefaultViews } from '@/modules/Views/decorators/InjectModelDefaultViews.decorator';
|
||||||
import { VendorCreditDefaultViews } from '../constants';
|
import { VendorCreditDefaultViews } from '../constants';
|
||||||
|
import { InjectAttachable } from '@/modules/Attachments/decorators/InjectAttachable.decorator';
|
||||||
|
|
||||||
|
@InjectAttachable()
|
||||||
@ExportableModel()
|
@ExportableModel()
|
||||||
@ImportableModel()
|
@ImportableModel()
|
||||||
@InjectModelMeta(VendorCreditMeta)
|
@InjectModelMeta(VendorCreditMeta)
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ export class VendorCreditAppliedBill extends BaseModel {
|
|||||||
* Timestamps columns.
|
* Timestamps columns.
|
||||||
*/
|
*/
|
||||||
public get timestamps() {
|
public get timestamps() {
|
||||||
return ['created_at', 'updated_at'];
|
return ['createdAt', 'updatedAt'];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ export class RefundVendorCredit extends BaseModel {
|
|||||||
* Timestamps columns.
|
* Timestamps columns.
|
||||||
*/
|
*/
|
||||||
get timestamps() {
|
get timestamps() {
|
||||||
return ['created_at', 'updated_at'];
|
return ['createdAt', 'updatedAt'];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -8,6 +8,13 @@ export class ViewColumn extends BaseModel {
|
|||||||
return 'view_has_columns';
|
return 'view_has_columns';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Timestamps columns.
|
||||||
|
*/
|
||||||
|
get timestamps() {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Relationship mapping.
|
* Relationship mapping.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -25,6 +25,13 @@ export class ViewRole extends BaseModel {
|
|||||||
return 'view_roles';
|
return 'view_roles';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Timestamps columns.
|
||||||
|
*/
|
||||||
|
get timestamps() {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Relationship mapping.
|
* Relationship mapping.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -9,6 +9,13 @@ export class ItemWarehouseQuantity extends BaseModel{
|
|||||||
return 'items_warehouses_quantity';
|
return 'items_warehouses_quantity';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Timestamps columns.
|
||||||
|
*/
|
||||||
|
get timestamps() {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Relation mappings.
|
* Relation mappings.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ export class Warehouse extends BaseModel {
|
|||||||
* Timestamps columns.
|
* Timestamps columns.
|
||||||
*/
|
*/
|
||||||
get timestamps() {
|
get timestamps() {
|
||||||
return ['created_at', 'updated_at'];
|
return ['createdAt', 'updatedAt'];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ export class WarehouseTransfer extends TenantBaseModel {
|
|||||||
* Timestamps columns.
|
* Timestamps columns.
|
||||||
*/
|
*/
|
||||||
get timestamps() {
|
get timestamps() {
|
||||||
return ['created_at', 'updated_at'];
|
return ['createdAt', 'updatedAt'];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -19,6 +19,13 @@ export class WarehouseTransferEntry extends TenantBaseModel {
|
|||||||
return 'warehouses_transfers_entries';
|
return 'warehouses_transfers_entries';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Timestamps columns.
|
||||||
|
*/
|
||||||
|
get timestamps() {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Virtual attributes.
|
* Virtual attributes.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import intl from 'react-intl-universal';
|
import intl from 'react-intl-universal';
|
||||||
import { Intent, Menu, MenuItem, Tag } from '@blueprintjs/core';
|
import { Intent, Menu, MenuItem, Tag } from '@blueprintjs/core';
|
||||||
import { FormatDateCell, Icon } from '@/components';
|
import { Icon } from '@/components';
|
||||||
import { safeCallback } from '@/utils';
|
import { safeCallback } from '@/utils';
|
||||||
import { useAccountTransactionsContext } from './AccountTransactionsProvider';
|
import { useAccountTransactionsContext } from './AccountTransactionsProvider';
|
||||||
import FinancialLoadingBar from '@/containers/FinancialStatements/FinancialLoadingBar';
|
import FinancialLoadingBar from '@/containers/FinancialStatements/FinancialLoadingBar';
|
||||||
@@ -75,8 +75,7 @@ export function useAccountTransactionsColumns() {
|
|||||||
{
|
{
|
||||||
id: 'date',
|
id: 'date',
|
||||||
Header: intl.get('date'),
|
Header: intl.get('date'),
|
||||||
accessor: 'date',
|
accessor: 'formatted_date',
|
||||||
Cell: FormatDateCell,
|
|
||||||
width: 110,
|
width: 110,
|
||||||
className: 'date',
|
className: 'date',
|
||||||
clickable: true,
|
clickable: true,
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ function CashflowBankAccount({
|
|||||||
const handleEditAccount = () => {
|
const handleEditAccount = () => {
|
||||||
openDialog(DialogsName.AccountForm, {
|
openDialog(DialogsName.AccountForm, {
|
||||||
action: AccountDialogAction.Edit,
|
action: AccountDialogAction.Edit,
|
||||||
id: account.id,
|
accountId: account.id,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
// Handle money in menu item actions.
|
// Handle money in menu item actions.
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
import intl from 'react-intl-universal';
|
import intl from 'react-intl-universal';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import { FormatDateCell } from '@/components';
|
|
||||||
import { useAccountDrawerTableOptionsContext } from './AccountDrawerTableOptionsProvider';
|
import { useAccountDrawerTableOptionsContext } from './AccountDrawerTableOptionsProvider';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -15,8 +14,7 @@ export const useAccountReadEntriesColumns = () => {
|
|||||||
() => [
|
() => [
|
||||||
{
|
{
|
||||||
Header: intl.get('transaction_date'),
|
Header: intl.get('transaction_date'),
|
||||||
accessor: 'date',
|
accessor: 'formatted_date',
|
||||||
Cell: FormatDateCell,
|
|
||||||
width: 110,
|
width: 110,
|
||||||
textOverview: true,
|
textOverview: true,
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user