mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-21 15:20:34 +00:00
refactor: inventory to nestjs
This commit is contained in:
@@ -15,12 +15,14 @@ import { GetAccountTypesService } from './GetAccountTypes.service';
|
|||||||
import { GetAccountTransactionsService } from './GetAccountTransactions.service';
|
import { GetAccountTransactionsService } from './GetAccountTransactions.service';
|
||||||
import { RegisterTenancyModel } from '../Tenancy/TenancyModels/Tenancy.module';
|
import { RegisterTenancyModel } from '../Tenancy/TenancyModels/Tenancy.module';
|
||||||
import { BankAccount } from '../BankingTransactions/models/BankAccount';
|
import { BankAccount } from '../BankingTransactions/models/BankAccount';
|
||||||
|
import { GetAccountsService } from './GetAccounts.service';
|
||||||
|
import { DynamicListModule } from '../DynamicListing/DynamicList.module';
|
||||||
// import { GetAccountsService } from './GetAccounts.service';
|
// import { GetAccountsService } from './GetAccounts.service';
|
||||||
|
|
||||||
const models = [RegisterTenancyModel(BankAccount)];
|
const models = [RegisterTenancyModel(BankAccount)];
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports: [TenancyDatabaseModule],
|
imports: [TenancyDatabaseModule, DynamicListModule],
|
||||||
controllers: [AccountsController],
|
controllers: [AccountsController],
|
||||||
providers: [
|
providers: [
|
||||||
AccountsApplication,
|
AccountsApplication,
|
||||||
@@ -35,6 +37,7 @@ const models = [RegisterTenancyModel(BankAccount)];
|
|||||||
ActivateAccount,
|
ActivateAccount,
|
||||||
GetAccountTypesService,
|
GetAccountTypesService,
|
||||||
GetAccountTransactionsService,
|
GetAccountTransactionsService,
|
||||||
|
GetAccountsService,
|
||||||
...models,
|
...models,
|
||||||
],
|
],
|
||||||
exports: [AccountRepository, CreateAccountService, ...models],
|
exports: [AccountRepository, CreateAccountService, ...models],
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ export interface IAccountEventCreatingPayload {
|
|||||||
accountDTO: any;
|
accountDTO: any;
|
||||||
trx: Knex.Transaction;
|
trx: Knex.Transaction;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IAccountEventCreatedPayload {
|
export interface IAccountEventCreatedPayload {
|
||||||
account: Account;
|
account: Account;
|
||||||
accountId: number;
|
accountId: number;
|
||||||
|
|||||||
@@ -1,14 +1,11 @@
|
|||||||
|
|
||||||
import { Inject, Injectable } from '@nestjs/common';
|
import { Inject, Injectable } from '@nestjs/common';
|
||||||
import { kebabCase } from 'lodash';
|
import { kebabCase } from 'lodash';
|
||||||
import { Knex } from 'knex';
|
import { Knex } from 'knex';
|
||||||
import { EventEmitter2 } from '@nestjs/event-emitter';
|
import { EventEmitter2 } from '@nestjs/event-emitter';
|
||||||
import {
|
import {
|
||||||
// IAccount,
|
|
||||||
// IAccountEventCreatedPayload,
|
|
||||||
// IAccountCreateDTO,
|
|
||||||
IAccountEventCreatingPayload,
|
IAccountEventCreatingPayload,
|
||||||
CreateAccountParams,
|
CreateAccountParams,
|
||||||
|
IAccountEventCreatedPayload,
|
||||||
} from './Accounts.types';
|
} from './Accounts.types';
|
||||||
import { CommandAccountValidators } from './CommandAccountValidators.service';
|
import { CommandAccountValidators } from './CommandAccountValidators.service';
|
||||||
import { Account } from './models/Account.model';
|
import { Account } from './models/Account.model';
|
||||||
@@ -16,6 +13,7 @@ import { UnitOfWork } from '../Tenancy/TenancyDB/UnitOfWork.service';
|
|||||||
import { TenancyContext } from '../Tenancy/TenancyContext.service';
|
import { TenancyContext } from '../Tenancy/TenancyContext.service';
|
||||||
import { events } from '@/common/events/events';
|
import { events } from '@/common/events/events';
|
||||||
import { CreateAccountDTO } from './CreateAccount.dto';
|
import { CreateAccountDTO } from './CreateAccount.dto';
|
||||||
|
import { PartialModelObject } from 'objection';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class CreateAccountService {
|
export class CreateAccountService {
|
||||||
@@ -80,7 +78,7 @@ export class CreateAccountService {
|
|||||||
private transformDTOToModel = (
|
private transformDTOToModel = (
|
||||||
createAccountDTO: CreateAccountDTO,
|
createAccountDTO: CreateAccountDTO,
|
||||||
baseCurrency: string,
|
baseCurrency: string,
|
||||||
) => {
|
): PartialModelObject<Account> => {
|
||||||
return {
|
return {
|
||||||
...createAccountDTO,
|
...createAccountDTO,
|
||||||
slug: kebabCase(createAccountDTO.name),
|
slug: kebabCase(createAccountDTO.name),
|
||||||
@@ -127,11 +125,11 @@ export class CreateAccountService {
|
|||||||
...accountInputModel,
|
...accountInputModel,
|
||||||
});
|
});
|
||||||
// Triggers `onAccountCreated` event.
|
// Triggers `onAccountCreated` event.
|
||||||
// await this.eventEmitter.emitAsync(events.accounts.onCreated, {
|
await this.eventEmitter.emitAsync(events.accounts.onCreated, {
|
||||||
// account,
|
account,
|
||||||
// accountId: account.id,
|
accountId: account.id,
|
||||||
// trx,
|
trx,
|
||||||
// } as IAccountEventCreatedPayload);
|
} as IAccountEventCreatedPayload);
|
||||||
|
|
||||||
return account;
|
return account;
|
||||||
}, trx);
|
}, trx);
|
||||||
|
|||||||
@@ -33,9 +33,10 @@ export class Account extends TenantBaseModel {
|
|||||||
public bankBalance!: number;
|
public bankBalance!: number;
|
||||||
public lastFeedsUpdatedAt!: string | Date | null;
|
public lastFeedsUpdatedAt!: string | Date | null;
|
||||||
public amount!: number;
|
public amount!: number;
|
||||||
public plaidItemId!: number;
|
public plaidItemId!: string;
|
||||||
public plaidAccountId!: string | null;
|
public plaidAccountId!: string | null;
|
||||||
public isFeedsActive!: boolean;
|
public isFeedsActive!: boolean;
|
||||||
|
public isSyncingOwner!: boolean;
|
||||||
public plaidItem!: PlaidItem;
|
public plaidItem!: PlaidItem;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import { BankRulesModule } from '../BankRules/BankRules.module';
|
|||||||
RefreshBankAccountService,
|
RefreshBankAccountService,
|
||||||
ResumeBankAccountFeedsService,
|
ResumeBankAccountFeedsService,
|
||||||
PauseBankAccountFeeds,
|
PauseBankAccountFeeds,
|
||||||
// DeleteUncategorizedTransactionsOnAccountDeleting,
|
DeleteUncategorizedTransactionsOnAccountDeleting,
|
||||||
DisconnectPlaidItemOnAccountDeleted,
|
DisconnectPlaidItemOnAccountDeleted,
|
||||||
BankAccountsApplication
|
BankAccountsApplication
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { UncategorizedBankTransaction } from './models/UncategorizedBankTransact
|
|||||||
import { BankTransactionLine } from './models/BankTransactionLine';
|
import { BankTransactionLine } from './models/BankTransactionLine';
|
||||||
import { BankTransaction } from './models/BankTransaction';
|
import { BankTransaction } from './models/BankTransaction';
|
||||||
import { BankTransactionAutoIncrement } from './commands/BankTransactionAutoIncrement.service';
|
import { BankTransactionAutoIncrement } from './commands/BankTransactionAutoIncrement.service';
|
||||||
import BankingTransactionGLEntriesSubscriber from './subscribers/CashflowTransactionSubscriber';
|
import { BankingTransactionGLEntriesSubscriber } from './subscribers/CashflowTransactionSubscriber';
|
||||||
import { DecrementUncategorizedTransactionOnCategorizeSubscriber } from './subscribers/DecrementUncategorizedTransactionOnCategorize';
|
import { DecrementUncategorizedTransactionOnCategorizeSubscriber } from './subscribers/DecrementUncategorizedTransactionOnCategorize';
|
||||||
import { DeleteCashflowTransactionOnUncategorizeSubscriber } from './subscribers/DeleteCashflowTransactionOnUncategorize';
|
import { DeleteCashflowTransactionOnUncategorizeSubscriber } from './subscribers/DeleteCashflowTransactionOnUncategorize';
|
||||||
import { PreventDeleteTransactionOnDeleteSubscriber } from './subscribers/PreventDeleteTransactionsOnDelete';
|
import { PreventDeleteTransactionOnDeleteSubscriber } from './subscribers/PreventDeleteTransactionsOnDelete';
|
||||||
@@ -21,15 +21,24 @@ import { BranchTransactionDTOTransformer } from '../Branches/integrations/Branch
|
|||||||
import { BranchesModule } from '../Branches/Branches.module';
|
import { BranchesModule } from '../Branches/Branches.module';
|
||||||
import { RemovePendingUncategorizedTransaction } from './commands/RemovePendingUncategorizedTransaction.service';
|
import { RemovePendingUncategorizedTransaction } from './commands/RemovePendingUncategorizedTransaction.service';
|
||||||
import { BankingTransactionsController } from './BankingTransactions.controller';
|
import { BankingTransactionsController } from './BankingTransactions.controller';
|
||||||
|
import { GetBankAccountsService } from './queries/GetBankAccounts.service';
|
||||||
|
import { DynamicListModule } from '../DynamicListing/DynamicList.module';
|
||||||
|
import { BankAccount } from './models/BankAccount';
|
||||||
|
|
||||||
const models = [
|
const models = [
|
||||||
RegisterTenancyModel(UncategorizedBankTransaction),
|
RegisterTenancyModel(UncategorizedBankTransaction),
|
||||||
RegisterTenancyModel(BankTransaction),
|
RegisterTenancyModel(BankTransaction),
|
||||||
RegisterTenancyModel(BankTransactionLine),
|
RegisterTenancyModel(BankTransactionLine),
|
||||||
|
RegisterTenancyModel(BankAccount),
|
||||||
];
|
];
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports: [AutoIncrementOrdersModule, LedgerModule, BranchesModule],
|
imports: [
|
||||||
|
AutoIncrementOrdersModule,
|
||||||
|
LedgerModule,
|
||||||
|
BranchesModule,
|
||||||
|
DynamicListModule,
|
||||||
|
],
|
||||||
controllers: [BankingTransactionsController],
|
controllers: [BankingTransactionsController],
|
||||||
providers: [
|
providers: [
|
||||||
BankTransactionAutoIncrement,
|
BankTransactionAutoIncrement,
|
||||||
@@ -43,6 +52,7 @@ const models = [
|
|||||||
DeleteCashflowTransaction,
|
DeleteCashflowTransaction,
|
||||||
CreateBankTransactionService,
|
CreateBankTransactionService,
|
||||||
GetBankTransactionService,
|
GetBankTransactionService,
|
||||||
|
GetBankAccountsService,
|
||||||
CommandBankTransactionValidator,
|
CommandBankTransactionValidator,
|
||||||
BranchTransactionDTOTransformer,
|
BranchTransactionDTOTransformer,
|
||||||
RemovePendingUncategorizedTransaction,
|
RemovePendingUncategorizedTransaction,
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ export class BankAccount extends TenantBaseModel {
|
|||||||
/**
|
/**
|
||||||
* Retrieve account type label.
|
* Retrieve account type label.
|
||||||
*/
|
*/
|
||||||
get accountTypeLabel() {
|
get accountTypeLabel(): string {
|
||||||
return AccountTypesUtils.getType(this.accountType, 'label');
|
return AccountTypesUtils.getType(this.accountType, 'label');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,4 @@
|
|||||||
/* eslint-disable global-require */
|
|
||||||
import { Model } from 'objection';
|
import { Model } from 'objection';
|
||||||
// import {
|
|
||||||
// getCashflowAccountTransactionsTypes,
|
|
||||||
// getCashflowTransactionType,
|
|
||||||
// } from '@/services/Cashflow/utils';
|
|
||||||
// import { CASHFLOW_DIRECTION } from '@/services/Cashflow/constants';
|
|
||||||
// import { getCashflowTransactionFormattedType } from '@/utils/transactions-types';
|
|
||||||
import { BaseModel } from '@/models/Model';
|
import { BaseModel } from '@/models/Model';
|
||||||
import {
|
import {
|
||||||
getCashflowAccountTransactionsTypes,
|
getCashflowAccountTransactionsTypes,
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
/* eslint-disable global-require */
|
/* eslint-disable global-require */
|
||||||
import { Model } from 'objection';
|
import { Model } from 'objection';
|
||||||
// import TenantModel from 'models/TenantModel';
|
import { TenantBaseModel } from '@/modules/System/models/TenantBaseModel';
|
||||||
import { BaseModel } from '@/models/Model';
|
|
||||||
|
|
||||||
export class BankTransactionLine extends BaseModel{
|
export class BankTransactionLine extends TenantBaseModel{
|
||||||
/**
|
/**
|
||||||
* Table name.
|
* Table name.
|
||||||
*/
|
*/
|
||||||
@@ -18,6 +17,14 @@ export class BankTransactionLine extends BaseModel{
|
|||||||
return ['createdAt', 'updatedAt'];
|
return ['createdAt', 'updatedAt'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the model is resourceable.
|
||||||
|
* @returns {boolean}
|
||||||
|
*/
|
||||||
|
static get resourceable(): boolean {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Relationship mapping.
|
* Relationship mapping.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { events } from '@/common/events/events';
|
|||||||
import { ICommandCashflowCreatedPayload, ICommandCashflowDeletedPayload } from '../types/BankingTransactions.types';
|
import { ICommandCashflowCreatedPayload, ICommandCashflowDeletedPayload } from '../types/BankingTransactions.types';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export default class BankingTransactionGLEntriesSubscriber {
|
export class BankingTransactionGLEntriesSubscriber {
|
||||||
/**
|
/**
|
||||||
* @param {BankTransactionGLEntriesService} bankTransactionGLEntries - Bank transaction GL entries service.
|
* @param {BankTransactionGLEntriesService} bankTransactionGLEntries - Bank transaction GL entries service.
|
||||||
* @param {BankTransactionAutoIncrement} cashflowTransactionAutoIncrement - Cashflow transaction auto increment service.
|
* @param {BankTransactionAutoIncrement} cashflowTransactionAutoIncrement - Cashflow transaction auto increment service.
|
||||||
|
|||||||
@@ -23,9 +23,18 @@ import { LedgerModule } from '../Ledger/Ledger.module';
|
|||||||
import { AccountsModule } from '../Accounts/Accounts.module';
|
import { AccountsModule } from '../Accounts/Accounts.module';
|
||||||
import { BillWriteInventoryTransactionsSubscriber } from './subscribers/BillWriteInventoryTransactionsSubscriber';
|
import { BillWriteInventoryTransactionsSubscriber } from './subscribers/BillWriteInventoryTransactionsSubscriber';
|
||||||
import { BillInventoryTransactions } from './commands/BillInventoryTransactions';
|
import { BillInventoryTransactions } from './commands/BillInventoryTransactions';
|
||||||
|
import { GetBillsService } from './queries/GetBills.service';
|
||||||
|
import { DynamicListModule } from '../DynamicListing/DynamicList.module';
|
||||||
|
import { InventoryCostModule } from '../InventoryCost/InventoryCost.module';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports: [BillLandedCostsModule, LedgerModule, AccountsModule],
|
imports: [
|
||||||
|
BillLandedCostsModule,
|
||||||
|
LedgerModule,
|
||||||
|
AccountsModule,
|
||||||
|
DynamicListModule,
|
||||||
|
InventoryCostModule,
|
||||||
|
],
|
||||||
providers: [
|
providers: [
|
||||||
TenancyContext,
|
TenancyContext,
|
||||||
BillsApplication,
|
BillsApplication,
|
||||||
@@ -39,6 +48,7 @@ import { BillInventoryTransactions } from './commands/BillInventoryTransactions'
|
|||||||
GetDueBills,
|
GetDueBills,
|
||||||
OpenBillService,
|
OpenBillService,
|
||||||
GetBill,
|
GetBill,
|
||||||
|
GetBillsService,
|
||||||
DeleteBill,
|
DeleteBill,
|
||||||
BillDTOTransformer,
|
BillDTOTransformer,
|
||||||
BillsValidators,
|
BillsValidators,
|
||||||
|
|||||||
@@ -13,8 +13,9 @@ import { ItemEntry } from '@/modules/TransactionItemEntry/models/ItemEntry';
|
|||||||
import { BillLandedCost } from '@/modules/BillLandedCosts/models/BillLandedCost';
|
import { BillLandedCost } from '@/modules/BillLandedCosts/models/BillLandedCost';
|
||||||
import { DiscountType } from '@/common/types/Discount';
|
import { DiscountType } from '@/common/types/Discount';
|
||||||
import type { Knex, QueryBuilder } from 'knex';
|
import type { Knex, QueryBuilder } from 'knex';
|
||||||
|
import { TenantBaseModel } from '@/modules/System/models/TenantBaseModel';
|
||||||
|
|
||||||
export class Bill extends BaseModel {
|
export class Bill extends TenantBaseModel {
|
||||||
public amount: number;
|
public amount: number;
|
||||||
public paymentAmount: number;
|
public paymentAmount: number;
|
||||||
public landedCostAmount: number;
|
public landedCostAmount: number;
|
||||||
@@ -95,7 +96,7 @@ export class Bill extends BaseModel {
|
|||||||
* Invoice amount in base currency.
|
* Invoice amount in base currency.
|
||||||
* @returns {number}
|
* @returns {number}
|
||||||
*/
|
*/
|
||||||
get amountLocal() {
|
get amountLocal(): number {
|
||||||
return this.amount * this.exchangeRate;
|
return this.amount * this.exchangeRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -103,7 +104,7 @@ export class Bill extends BaseModel {
|
|||||||
* Subtotal. (Tax inclusive) if the tax inclusive is enabled.
|
* Subtotal. (Tax inclusive) if the tax inclusive is enabled.
|
||||||
* @returns {number}
|
* @returns {number}
|
||||||
*/
|
*/
|
||||||
get subtotal() {
|
get subtotal(): number {
|
||||||
return this.amount;
|
return this.amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -111,7 +112,7 @@ export class Bill extends BaseModel {
|
|||||||
* Subtotal in base currency. (Tax inclusive) if the tax inclusive is enabled.
|
* Subtotal in base currency. (Tax inclusive) if the tax inclusive is enabled.
|
||||||
* @returns {number}
|
* @returns {number}
|
||||||
*/
|
*/
|
||||||
get subtotalLocal() {
|
get subtotalLocal(): number {
|
||||||
return this.amountLocal;
|
return this.amountLocal;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -119,7 +120,7 @@ export class Bill extends BaseModel {
|
|||||||
* Sale invoice amount excluding tax.
|
* Sale invoice amount excluding tax.
|
||||||
* @returns {number}
|
* @returns {number}
|
||||||
*/
|
*/
|
||||||
get subtotalExcludingTax() {
|
get subtotalExcludingTax(): number {
|
||||||
return this.isInclusiveTax
|
return this.isInclusiveTax
|
||||||
? this.subtotal - this.taxAmountWithheld
|
? this.subtotal - this.taxAmountWithheld
|
||||||
: this.subtotal;
|
: this.subtotal;
|
||||||
@@ -129,7 +130,7 @@ export class Bill extends BaseModel {
|
|||||||
* Tax amount withheld in base currency.
|
* Tax amount withheld in base currency.
|
||||||
* @returns {number}
|
* @returns {number}
|
||||||
*/
|
*/
|
||||||
get taxAmountWithheldLocal() {
|
get taxAmountWithheldLocal(): number {
|
||||||
return this.taxAmountWithheld * this.exchangeRate;
|
return this.taxAmountWithheld * this.exchangeRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -137,7 +138,7 @@ export class Bill extends BaseModel {
|
|||||||
* Discount amount.
|
* Discount amount.
|
||||||
* @returns {number}
|
* @returns {number}
|
||||||
*/
|
*/
|
||||||
get discountAmount() {
|
get discountAmount(): number {
|
||||||
return this.discountType === DiscountType.Amount
|
return this.discountType === DiscountType.Amount
|
||||||
? this.discount
|
? this.discount
|
||||||
: this.subtotal * (this.discount / 100);
|
: this.subtotal * (this.discount / 100);
|
||||||
@@ -147,7 +148,7 @@ export class Bill extends BaseModel {
|
|||||||
* Discount amount in local currency.
|
* Discount amount in local currency.
|
||||||
* @returns {number | null}
|
* @returns {number | null}
|
||||||
*/
|
*/
|
||||||
get discountAmountLocal() {
|
get discountAmountLocal(): number | null {
|
||||||
return this.discountAmount ? this.discountAmount * this.exchangeRate : null;
|
return this.discountAmount ? this.discountAmount * this.exchangeRate : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -190,6 +191,132 @@ export class Bill extends BaseModel {
|
|||||||
return this.total * this.exchangeRate;
|
return this.total * this.exchangeRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Invoice amount in organization base currency.
|
||||||
|
* @deprecated
|
||||||
|
* @returns {number}
|
||||||
|
*/
|
||||||
|
get localAmount(): number {
|
||||||
|
return this.amountLocal;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the local allocated cost amount.
|
||||||
|
* @returns {number}
|
||||||
|
*/
|
||||||
|
get localAllocatedCostAmount(): number {
|
||||||
|
return this.allocatedCostAmount * this.exchangeRate;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the local landed cost amount.
|
||||||
|
* @returns {number}
|
||||||
|
*/
|
||||||
|
get localLandedCostAmount(): number {
|
||||||
|
return this.landedCostAmount * this.exchangeRate;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the local unallocated cost amount.
|
||||||
|
* @returns {number}
|
||||||
|
*/
|
||||||
|
get localUnallocatedCostAmount(): number {
|
||||||
|
return this.unallocatedCostAmount * this.exchangeRate;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve the balance of bill.
|
||||||
|
* @return {number}
|
||||||
|
*/
|
||||||
|
get balance(): number {
|
||||||
|
return this.paymentAmount + this.creditedAmount;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Due amount of the given.
|
||||||
|
* @return {number}
|
||||||
|
*/
|
||||||
|
get dueAmount(): number {
|
||||||
|
return Math.max(this.total - this.balance, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Detarmine whether the bill is open.
|
||||||
|
* @return {boolean}
|
||||||
|
*/
|
||||||
|
get isOpen(): boolean {
|
||||||
|
return !!this.openedAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deetarmine whether the bill paid partially.
|
||||||
|
* @return {boolean}
|
||||||
|
*/
|
||||||
|
get isPartiallyPaid(): boolean {
|
||||||
|
return this.dueAmount !== this.total && this.dueAmount > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deetarmine whether the bill paid fully.
|
||||||
|
* @return {boolean}
|
||||||
|
*/
|
||||||
|
get isFullyPaid(): boolean {
|
||||||
|
return this.dueAmount === 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Detarmines whether the bill paid fully or partially.
|
||||||
|
* @return {boolean}
|
||||||
|
*/
|
||||||
|
get isPaid(): boolean {
|
||||||
|
return this.isPartiallyPaid || this.isFullyPaid;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve the remaining days in number
|
||||||
|
* @return {number|null}
|
||||||
|
*/
|
||||||
|
get remainingDays(): number | null {
|
||||||
|
const currentMoment = moment();
|
||||||
|
const dueDateMoment = moment(this.dueDate);
|
||||||
|
|
||||||
|
return Math.max(dueDateMoment.diff(currentMoment, 'days'), 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve the overdue days in number.
|
||||||
|
* @return {number|null}
|
||||||
|
*/
|
||||||
|
get overdueDays(): number | null {
|
||||||
|
const currentMoment = moment();
|
||||||
|
const dueDateMoment = moment(this.dueDate);
|
||||||
|
|
||||||
|
return Math.max(currentMoment.diff(dueDateMoment, 'days'), 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Detarmines the due date is over.
|
||||||
|
* @return {boolean}
|
||||||
|
*/
|
||||||
|
get isOverdue(): boolean {
|
||||||
|
return this.overdueDays > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve the unallocated cost amount.
|
||||||
|
* @return {number}
|
||||||
|
*/
|
||||||
|
get unallocatedCostAmount(): number {
|
||||||
|
return Math.max(this.landedCostAmount - this.allocatedCostAmount, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the calculated amount which have not been invoiced.
|
||||||
|
*/
|
||||||
|
get billableAmount(): number {
|
||||||
|
return Math.max(this.total - this.invoicedAmount, 0);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Table name
|
* Table name
|
||||||
*/
|
*/
|
||||||
@@ -335,132 +462,6 @@ export class Bill extends BaseModel {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Invoice amount in organization base currency.
|
|
||||||
* @deprecated
|
|
||||||
* @returns {number}
|
|
||||||
*/
|
|
||||||
get localAmount() {
|
|
||||||
return this.amountLocal;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Retrieves the local allocated cost amount.
|
|
||||||
* @returns {number}
|
|
||||||
*/
|
|
||||||
get localAllocatedCostAmount() {
|
|
||||||
return this.allocatedCostAmount * this.exchangeRate;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Retrieves the local landed cost amount.
|
|
||||||
* @returns {number}
|
|
||||||
*/
|
|
||||||
get localLandedCostAmount() {
|
|
||||||
return this.landedCostAmount * this.exchangeRate;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Retrieves the local unallocated cost amount.
|
|
||||||
* @returns {number}
|
|
||||||
*/
|
|
||||||
get localUnallocatedCostAmount() {
|
|
||||||
return this.unallocatedCostAmount * this.exchangeRate;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Retrieve the balance of bill.
|
|
||||||
* @return {number}
|
|
||||||
*/
|
|
||||||
get balance() {
|
|
||||||
return this.paymentAmount + this.creditedAmount;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Due amount of the given.
|
|
||||||
* @return {number}
|
|
||||||
*/
|
|
||||||
get dueAmount() {
|
|
||||||
return Math.max(this.total - this.balance, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Detarmine whether the bill is open.
|
|
||||||
* @return {boolean}
|
|
||||||
*/
|
|
||||||
get isOpen() {
|
|
||||||
return !!this.openedAt;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Deetarmine whether the bill paid partially.
|
|
||||||
* @return {boolean}
|
|
||||||
*/
|
|
||||||
get isPartiallyPaid() {
|
|
||||||
return this.dueAmount !== this.total && this.dueAmount > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Deetarmine whether the bill paid fully.
|
|
||||||
* @return {boolean}
|
|
||||||
*/
|
|
||||||
get isFullyPaid() {
|
|
||||||
return this.dueAmount === 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Detarmines whether the bill paid fully or partially.
|
|
||||||
* @return {boolean}
|
|
||||||
*/
|
|
||||||
get isPaid() {
|
|
||||||
return this.isPartiallyPaid || this.isFullyPaid;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Retrieve the remaining days in number
|
|
||||||
* @return {number|null}
|
|
||||||
*/
|
|
||||||
get remainingDays() {
|
|
||||||
const currentMoment = moment();
|
|
||||||
const dueDateMoment = moment(this.dueDate);
|
|
||||||
|
|
||||||
return Math.max(dueDateMoment.diff(currentMoment, 'days'), 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Retrieve the overdue days in number.
|
|
||||||
* @return {number|null}
|
|
||||||
*/
|
|
||||||
get overdueDays() {
|
|
||||||
const currentMoment = moment();
|
|
||||||
const dueDateMoment = moment(this.dueDate);
|
|
||||||
|
|
||||||
return Math.max(currentMoment.diff(dueDateMoment, 'days'), 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Detarmines the due date is over.
|
|
||||||
* @return {boolean}
|
|
||||||
*/
|
|
||||||
get isOverdue() {
|
|
||||||
return this.overdueDays > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Retrieve the unallocated cost amount.
|
|
||||||
* @return {number}
|
|
||||||
*/
|
|
||||||
get unallocatedCostAmount() {
|
|
||||||
return Math.max(this.landedCostAmount - this.allocatedCostAmount, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Retrieves the calculated amount which have not been invoiced.
|
|
||||||
*/
|
|
||||||
get billableAmount() {
|
|
||||||
return Math.max(this.total - this.invoicedAmount, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bill model settings.
|
* Bill model settings.
|
||||||
*/
|
*/
|
||||||
@@ -482,7 +483,9 @@ export class Bill extends BaseModel {
|
|||||||
const { Branch } = require('../../Branches/models/Branch.model');
|
const { Branch } = require('../../Branches/models/Branch.model');
|
||||||
const { Warehouse } = require('../../Warehouses/models/Warehouse.model');
|
const { Warehouse } = require('../../Warehouses/models/Warehouse.model');
|
||||||
const { TaxRateModel } = require('../../TaxRates/models/TaxRate.model');
|
const { TaxRateModel } = require('../../TaxRates/models/TaxRate.model');
|
||||||
const { TaxRateTransaction } = require('../../TaxRates/models/TaxRateTransaction.model');
|
const {
|
||||||
|
TaxRateTransaction,
|
||||||
|
} = require('../../TaxRates/models/TaxRateTransaction.model');
|
||||||
const { Document } = require('../../ChromiumlyTenancy/models/Document');
|
const { Document } = require('../../ChromiumlyTenancy/models/Document');
|
||||||
// const { MatchedBankTransaction } = require('models/MatchedBankTransaction');
|
// const { MatchedBankTransaction } = require('models/MatchedBankTransaction');
|
||||||
|
|
||||||
|
|||||||
@@ -16,9 +16,10 @@ import { ExpenseGLEntriesService } from './subscribers/ExpenseGLEntries.service'
|
|||||||
import { LedgerModule } from '../Ledger/Ledger.module';
|
import { LedgerModule } from '../Ledger/Ledger.module';
|
||||||
import { BranchesModule } from '../Branches/Branches.module';
|
import { BranchesModule } from '../Branches/Branches.module';
|
||||||
import { GetExpensesService } from './queries/GetExpenses.service';
|
import { GetExpensesService } from './queries/GetExpenses.service';
|
||||||
|
import { DynamicListModule } from '../DynamicListing/DynamicList.module';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports: [LedgerModule, BranchesModule],
|
imports: [LedgerModule, BranchesModule, DynamicListModule],
|
||||||
controllers: [ExpensesController],
|
controllers: [ExpensesController],
|
||||||
exports: [
|
exports: [
|
||||||
CreateExpense,
|
CreateExpense,
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { InventoryAdjustmentEntry } from './models/InventoryAdjustmentEntry';
|
|||||||
import { CreateQuickInventoryAdjustmentService } from './commands/CreateQuickInventoryAdjustment.service';
|
import { CreateQuickInventoryAdjustmentService } from './commands/CreateQuickInventoryAdjustment.service';
|
||||||
import { PublishInventoryAdjustmentService } from './commands/PublishInventoryAdjustment.service';
|
import { PublishInventoryAdjustmentService } from './commands/PublishInventoryAdjustment.service';
|
||||||
import { GetInventoryAdjustmentService } from './queries/GetInventoryAdjustment.service';
|
import { GetInventoryAdjustmentService } from './queries/GetInventoryAdjustment.service';
|
||||||
// import { GetInventoryAdjustmentsService } from './queries/GetInventoryAdjustments.service';
|
import { GetInventoryAdjustmentsService } from './queries/GetInventoryAdjustments.service';
|
||||||
import { DeleteInventoryAdjustmentService } from './commands/DeleteInventoryAdjustment.service';
|
import { DeleteInventoryAdjustmentService } from './commands/DeleteInventoryAdjustment.service';
|
||||||
import { InventoryAdjustmentsApplicationService } from './InventoryAdjustmentsApplication.service';
|
import { InventoryAdjustmentsApplicationService } from './InventoryAdjustmentsApplication.service';
|
||||||
import { InventoryAdjustmentsController } from './InventoryAdjustments.controller';
|
import { InventoryAdjustmentsController } from './InventoryAdjustments.controller';
|
||||||
@@ -13,23 +13,24 @@ import { BranchesModule } from '../Branches/Branches.module';
|
|||||||
import { WarehousesModule } from '../Warehouses/Warehouses.module';
|
import { WarehousesModule } from '../Warehouses/Warehouses.module';
|
||||||
import { InventoryAdjustmentsGLSubscriber } from './subscribers/InventoryAdjustmentGL.subscriber';
|
import { InventoryAdjustmentsGLSubscriber } from './subscribers/InventoryAdjustmentGL.subscriber';
|
||||||
import { InventoryAdjustmentsGLEntries } from './commands/ledger/InventoryAdjustmentsGLEntries';
|
import { InventoryAdjustmentsGLEntries } from './commands/ledger/InventoryAdjustmentsGLEntries';
|
||||||
import { LedgerModule } from '../Ledger/Ledger.module';
|
|
||||||
import { TenancyContext } from '../Tenancy/TenancyContext.service';
|
|
||||||
import { InventoryAdjustmentInventoryTransactionsSubscriber } from './inventory/InventoryAdjustmentInventoryTransactionsSubscriber';
|
import { InventoryAdjustmentInventoryTransactionsSubscriber } from './inventory/InventoryAdjustmentInventoryTransactionsSubscriber';
|
||||||
import { InventoryAdjustmentInventoryTransactions } from './inventory/InventoryAdjustmentInventoryTransactions';
|
import { InventoryAdjustmentInventoryTransactions } from './inventory/InventoryAdjustmentInventoryTransactions';
|
||||||
|
import { DynamicListModule } from '../DynamicListing/DynamicList.module';
|
||||||
|
import { LedgerModule } from '../Ledger/Ledger.module';
|
||||||
|
import { TenancyContext } from '../Tenancy/TenancyContext.service';
|
||||||
|
|
||||||
const models = [
|
const models = [
|
||||||
RegisterTenancyModel(InventoryAdjustment),
|
RegisterTenancyModel(InventoryAdjustment),
|
||||||
RegisterTenancyModel(InventoryAdjustmentEntry),
|
RegisterTenancyModel(InventoryAdjustmentEntry),
|
||||||
];
|
];
|
||||||
@Module({
|
@Module({
|
||||||
imports: [BranchesModule, WarehousesModule, LedgerModule],
|
imports: [BranchesModule, WarehousesModule, LedgerModule, DynamicListModule],
|
||||||
controllers: [InventoryAdjustmentsController],
|
controllers: [InventoryAdjustmentsController],
|
||||||
providers: [
|
providers: [
|
||||||
...models,
|
...models,
|
||||||
CreateQuickInventoryAdjustmentService,
|
CreateQuickInventoryAdjustmentService,
|
||||||
PublishInventoryAdjustmentService,
|
PublishInventoryAdjustmentService,
|
||||||
// GetInventoryAdjustmentsService,
|
GetInventoryAdjustmentsService,
|
||||||
GetInventoryAdjustmentService,
|
GetInventoryAdjustmentService,
|
||||||
DeleteInventoryAdjustmentService,
|
DeleteInventoryAdjustmentService,
|
||||||
InventoryAdjustmentsApplicationService,
|
InventoryAdjustmentsApplicationService,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { Knex } from 'knex';
|
import { Knex } from 'knex';
|
||||||
import { Inject } from '@nestjs/common';
|
import { Inject, Injectable } from '@nestjs/common';
|
||||||
import * as R from 'ramda';
|
import * as R from 'ramda';
|
||||||
import * as moment from 'moment';
|
import * as moment from 'moment';
|
||||||
import { omit } from 'lodash';
|
import { omit } from 'lodash';
|
||||||
@@ -20,6 +20,7 @@ import { WarehouseTransactionDTOTransform } from '@/modules/Warehouses/Integrati
|
|||||||
import { TenancyContext } from '@/modules/Tenancy/TenancyContext.service';
|
import { TenancyContext } from '@/modules/Tenancy/TenancyContext.service';
|
||||||
import { ERRORS } from '../constants/InventoryAdjustments.constants';
|
import { ERRORS } from '../constants/InventoryAdjustments.constants';
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
export class CreateQuickInventoryAdjustmentService {
|
export class CreateQuickInventoryAdjustmentService {
|
||||||
constructor(
|
constructor(
|
||||||
@Inject(InventoryAdjustment.name)
|
@Inject(InventoryAdjustment.name)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Inject } from '@nestjs/common';
|
import { Inject, Injectable } from '@nestjs/common';
|
||||||
import { Knex } from 'knex';
|
import { Knex } from 'knex';
|
||||||
import { EventEmitter2 } from '@nestjs/event-emitter';
|
import { EventEmitter2 } from '@nestjs/event-emitter';
|
||||||
import { events } from '@/common/events/events';
|
import { events } from '@/common/events/events';
|
||||||
@@ -10,6 +10,7 @@ import { UnitOfWork } from '@/modules/Tenancy/TenancyDB/UnitOfWork.service';
|
|||||||
import { InventoryAdjustmentEntry } from '../models/InventoryAdjustmentEntry';
|
import { InventoryAdjustmentEntry } from '../models/InventoryAdjustmentEntry';
|
||||||
import { InventoryAdjustment } from '../models/InventoryAdjustment';
|
import { InventoryAdjustment } from '../models/InventoryAdjustment';
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
export class DeleteInventoryAdjustmentService {
|
export class DeleteInventoryAdjustmentService {
|
||||||
constructor(
|
constructor(
|
||||||
private readonly eventEmitter: EventEmitter2,
|
private readonly eventEmitter: EventEmitter2,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { Knex } from 'knex';
|
import { Knex } from 'knex';
|
||||||
import { Inject } from '@nestjs/common';
|
import { Inject, Injectable } from '@nestjs/common';
|
||||||
import { EventEmitter2 } from '@nestjs/event-emitter';
|
import { EventEmitter2 } from '@nestjs/event-emitter';
|
||||||
import * as moment from 'moment';
|
import * as moment from 'moment';
|
||||||
import { UnitOfWork } from '@/modules/Tenancy/TenancyDB/UnitOfWork.service';
|
import { UnitOfWork } from '@/modules/Tenancy/TenancyDB/UnitOfWork.service';
|
||||||
@@ -12,6 +12,7 @@ import { events } from '@/common/events/events';
|
|||||||
import { ServiceError } from '@/modules/Items/ServiceError';
|
import { ServiceError } from '@/modules/Items/ServiceError';
|
||||||
import { ERRORS } from '../constants/InventoryAdjustments.constants';
|
import { ERRORS } from '../constants/InventoryAdjustments.constants';
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
export class PublishInventoryAdjustmentService {
|
export class PublishInventoryAdjustmentService {
|
||||||
constructor(
|
constructor(
|
||||||
private readonly eventEmitter: EventEmitter2,
|
private readonly eventEmitter: EventEmitter2,
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
import { Knex } from 'knex';
|
import { Knex } from 'knex';
|
||||||
import { Inject } from '@nestjs/common';
|
import { Inject, Injectable } from '@nestjs/common';
|
||||||
import { LedgerStorageService } from '../../../Ledger/LedgerStorage.service';
|
import { LedgerStorageService } from '../../../Ledger/LedgerStorage.service';
|
||||||
import { InventoryAdjustment } from '../../models/InventoryAdjustment';
|
import { InventoryAdjustment } from '../../models/InventoryAdjustment';
|
||||||
import { TenancyContext } from '../../../Tenancy/TenancyContext.service';
|
import { TenancyContext } from '../../../Tenancy/TenancyContext.service';
|
||||||
import { InventoryAdjustmentsGL } from './InventoryAdjustmentGL';
|
import { InventoryAdjustmentsGL } from './InventoryAdjustmentGL';
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
export class InventoryAdjustmentsGLEntries {
|
export class InventoryAdjustmentsGLEntries {
|
||||||
constructor(
|
constructor(
|
||||||
private readonly ledgerStorage: LedgerStorageService,
|
private readonly ledgerStorage: LedgerStorageService,
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
|
import { Injectable } from "@nestjs/common";
|
||||||
import { Knex } from "knex";
|
import { Knex } from "knex";
|
||||||
import { InventoryAdjustment } from "../models/InventoryAdjustment";
|
import { InventoryAdjustment } from "../models/InventoryAdjustment";
|
||||||
import { InventoryTransaction } from "@/modules/InventoryCost/models/InventoryTransaction";
|
import { InventoryTransaction } from "@/modules/InventoryCost/models/InventoryTransaction";
|
||||||
import { InventoryService } from "@/modules/InventoryCost/Inventory";
|
import { InventoryTransactionsService } from "@/modules/InventoryCost/InventoryTransactions.service";
|
||||||
import { Injectable } from "@nestjs/common";
|
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class InventoryAdjustmentInventoryTransactions {
|
export class InventoryAdjustmentInventoryTransactions {
|
||||||
constructor(
|
constructor(
|
||||||
private readonly inventoryService: InventoryService
|
private readonly inventoryService: InventoryTransactionsService
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -3,21 +3,21 @@ import { InventoryAdjustmentEntry } from './InventoryAdjustmentEntry';
|
|||||||
import { TenantBaseModel } from '@/modules/System/models/TenantBaseModel';
|
import { TenantBaseModel } from '@/modules/System/models/TenantBaseModel';
|
||||||
|
|
||||||
export class InventoryAdjustment extends TenantBaseModel {
|
export class InventoryAdjustment extends TenantBaseModel {
|
||||||
date!: string;
|
public readonly date!: string;
|
||||||
type!: string;
|
public readonly type!: string;
|
||||||
adjustmentAccountId!: number;
|
public readonly adjustmentAccountId!: number;
|
||||||
reason?: string;
|
public readonly reason?: string;
|
||||||
referenceNo!: string;
|
public readonly referenceNo!: string;
|
||||||
description?: string;
|
public readonly description?: string;
|
||||||
userId!: number;
|
public readonly userId!: number;
|
||||||
publishedAt?: string;
|
public readonly publishedAt?: string;
|
||||||
|
|
||||||
branchId!: number;
|
public readonly branchId!: number;
|
||||||
warehouseId!: number;
|
public readonly warehouseId!: number;
|
||||||
|
|
||||||
createdAt!: Date | string;
|
public readonly createdAt!: Date | string;
|
||||||
|
|
||||||
entries: InventoryAdjustmentEntry[];
|
public readonly entries: InventoryAdjustmentEntry[];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Table name
|
* Table name
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
|
import { Inject, Injectable } from '@nestjs/common';
|
||||||
import { TransformerInjectable } from '@/modules/Transformer/TransformerInjectable.service';
|
import { TransformerInjectable } from '@/modules/Transformer/TransformerInjectable.service';
|
||||||
import { InventoryAdjustment } from '../models/InventoryAdjustment';
|
import { InventoryAdjustment } from '../models/InventoryAdjustment';
|
||||||
import { InventoryAdjustmentTransformer } from '../InventoryAdjustmentTransformer';
|
import { InventoryAdjustmentTransformer } from '../InventoryAdjustmentTransformer';
|
||||||
import { Inject } from '@nestjs/common';
|
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
export class GetInventoryAdjustmentService {
|
export class GetInventoryAdjustmentService {
|
||||||
constructor(
|
constructor(
|
||||||
private readonly transformer: TransformerInjectable,
|
private readonly transformer: TransformerInjectable,
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Inject } from '@nestjs/common';
|
import { Inject, Injectable } from '@nestjs/common';
|
||||||
import * as R from 'ramda';
|
import * as R from 'ramda';
|
||||||
import { IPaginationMeta } from '@/interfaces/Model';
|
import { IPaginationMeta } from '@/interfaces/Model';
|
||||||
import { InventoryAdjustmentTransformer } from '../InventoryAdjustmentTransformer';
|
import { InventoryAdjustmentTransformer } from '../InventoryAdjustmentTransformer';
|
||||||
@@ -7,9 +7,10 @@ import { IInventoryAdjustmentsFilter } from '../types/InventoryAdjustments.types
|
|||||||
import { TransformerInjectable } from '@/modules/Transformer/TransformerInjectable.service';
|
import { TransformerInjectable } from '@/modules/Transformer/TransformerInjectable.service';
|
||||||
import { DynamicListService } from '@/modules/DynamicListing/DynamicList.service';
|
import { DynamicListService } from '@/modules/DynamicListing/DynamicList.service';
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
export class GetInventoryAdjustmentsService {
|
export class GetInventoryAdjustmentsService {
|
||||||
constructor(
|
constructor(
|
||||||
public readonly transformer: TransformerInjectable,
|
private readonly transformer: TransformerInjectable,
|
||||||
private readonly dynamicListService: DynamicListService,
|
private readonly dynamicListService: DynamicListService,
|
||||||
|
|
||||||
@Inject(InventoryAdjustment.name)
|
@Inject(InventoryAdjustment.name)
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ import { InventoryTransaction } from './models/InventoryTransaction';
|
|||||||
import { InventoryCostGLBeforeWriteSubscriber } from './subscribers/InventoryCostGLBeforeWriteSubscriber';
|
import { InventoryCostGLBeforeWriteSubscriber } from './subscribers/InventoryCostGLBeforeWriteSubscriber';
|
||||||
import { InventoryItemsQuantitySyncService } from './InventoryItemsQuantitySync.service';
|
import { InventoryItemsQuantitySyncService } from './InventoryItemsQuantitySync.service';
|
||||||
import { InventoryCostMethod } from './InventoryCostMethod';
|
import { InventoryCostMethod } from './InventoryCostMethod';
|
||||||
|
import { InventoryTransactionsService } from './InventoryTransactions.service';
|
||||||
|
import { LedgerModule } from '../Ledger/Ledger.module';
|
||||||
|
|
||||||
const models = [
|
const models = [
|
||||||
RegisterTenancyModel(InventoryCostLotTracker),
|
RegisterTenancyModel(InventoryCostLotTracker),
|
||||||
@@ -13,12 +15,14 @@ const models = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
|
imports: [LedgerModule],
|
||||||
providers: [
|
providers: [
|
||||||
...models,
|
...models,
|
||||||
InventoryCostGLBeforeWriteSubscriber,
|
InventoryCostGLBeforeWriteSubscriber,
|
||||||
InventoryCostGLStorage,
|
InventoryCostGLStorage,
|
||||||
InventoryItemsQuantitySyncService,
|
InventoryItemsQuantitySyncService,
|
||||||
InventoryCostMethod,
|
InventoryCostMethod,
|
||||||
|
InventoryTransactionsService
|
||||||
],
|
],
|
||||||
exports: [...models],
|
exports: [...models],
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,31 +1,33 @@
|
|||||||
|
import { Knex } from 'knex';
|
||||||
|
import { Inject } from '@nestjs/common';
|
||||||
import { omit } from 'lodash';
|
import { omit } from 'lodash';
|
||||||
import { InventoryCostLotTracker } from './models/InventoryCostLotTracker';
|
import { InventoryCostLotTracker } from './models/InventoryCostLotTracker';
|
||||||
import { Inject } from '@nestjs/common';
|
|
||||||
import { Knex } from 'knex';
|
|
||||||
|
|
||||||
export class InventoryCostMethod {
|
export class InventoryCostMethod {
|
||||||
constructor(
|
constructor(
|
||||||
@Inject(InventoryCostLotTracker.name)
|
@Inject(InventoryCostLotTracker.name)
|
||||||
private readonly inventoryCostLotTracker: typeof InventoryCostLotTracker
|
private readonly inventoryCostLotTracker: typeof InventoryCostLotTracker,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stores the inventory lots costs transactions in bulk.
|
* Stores the inventory lots costs transactions in bulk.
|
||||||
* @param {IInventoryLotCost[]} costLotsTransactions
|
* @param {InventoryCostLotTracker[]} costLotsTransactions - Inventory lots costs transactions.
|
||||||
* @return {Promise[]}
|
* @param {Knex.Transaction} trx - Knex transaction.
|
||||||
|
* @return {Promise<object>}
|
||||||
*/
|
*/
|
||||||
public storeInventoryLotsCost(
|
public storeInventoryLotsCost(
|
||||||
costLotsTransactions: InventoryCostLotTracker[],
|
costLotsTransactions: InventoryCostLotTracker[],
|
||||||
trx: Knex.Transaction
|
trx: Knex.Transaction,
|
||||||
): Promise<object> {
|
): Promise<object> {
|
||||||
const opers: any = [];
|
const opers: any = [];
|
||||||
|
|
||||||
costLotsTransactions.forEach((transaction: any) => {
|
costLotsTransactions.forEach((transaction: any) => {
|
||||||
if (transaction.lotTransId && transaction.decrement) {
|
if (transaction.lotTransId && transaction.decrement) {
|
||||||
const decrementOper = this.inventoryCostLotTracker.query(trx)
|
const decrementOper = this.inventoryCostLotTracker
|
||||||
|
.query(trx)
|
||||||
.where('id', transaction.lotTransId)
|
.where('id', transaction.lotTransId)
|
||||||
.decrement('remaining', transaction.decrement);
|
.decrement('remaining', transaction.decrement);
|
||||||
|
|
||||||
opers.push(decrementOper);
|
opers.push(decrementOper);
|
||||||
} else if (!transaction.lotTransId) {
|
} else if (!transaction.lotTransId) {
|
||||||
const operation = this.inventoryCostLotTracker.query(trx).insert({
|
const operation = this.inventoryCostLotTracker.query(trx).insert({
|
||||||
|
|||||||
@@ -0,0 +1,167 @@
|
|||||||
|
import { IInventoryTransactionsDeletedPayload, TInventoryTransactionDirection } from './types/InventoryCost.types';
|
||||||
|
import { EventEmitter2 } from '@nestjs/event-emitter';
|
||||||
|
import { InventoryCostLotTracker } from './models/InventoryCostLotTracker';
|
||||||
|
import { InventoryTransaction } from './models/InventoryTransaction';
|
||||||
|
import { Knex } from 'knex';
|
||||||
|
import { events } from '@/common/events/events';
|
||||||
|
import { IInventoryTransactionsCreatedPayload } from './types/InventoryCost.types';
|
||||||
|
import { transformItemEntriesToInventory } from "./utils";
|
||||||
|
import { IItemEntryTransactionType } from '../TransactionItemEntry/ItemEntry.types';
|
||||||
|
import { ItemEntry } from '../TransactionItemEntry/models/ItemEntry';
|
||||||
|
import { Inject } from '@nestjs/common';
|
||||||
|
|
||||||
|
export class InventoryTransactionsService {
|
||||||
|
constructor(
|
||||||
|
private readonly eventEmitter: EventEmitter2,
|
||||||
|
|
||||||
|
@Inject(InventoryTransaction.name)
|
||||||
|
private readonly inventoryTransactionModel: typeof InventoryTransaction,
|
||||||
|
|
||||||
|
@Inject(InventoryCostLotTracker.name)
|
||||||
|
private readonly inventoryCostLotTracker: typeof InventoryCostLotTracker,
|
||||||
|
) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Records the inventory transactions.
|
||||||
|
* @param {InventoryTransaction[]} transactions - Inventory transactions.
|
||||||
|
* @param {boolean} override - Override the existing transactions.
|
||||||
|
* @param {Knex.Transaction} trx - Knex transaction.
|
||||||
|
* @return {Promise<void>}
|
||||||
|
*/
|
||||||
|
async recordInventoryTransactions(
|
||||||
|
transactions: InventoryTransaction[],
|
||||||
|
override: boolean = false,
|
||||||
|
trx?: Knex.Transaction,
|
||||||
|
): Promise<void> {
|
||||||
|
const bulkInsertOpers = [];
|
||||||
|
|
||||||
|
transactions.forEach((transaction: InventoryTransaction) => {
|
||||||
|
const oper = this.recordInventoryTransaction(transaction, override, trx);
|
||||||
|
bulkInsertOpers.push(oper);
|
||||||
|
});
|
||||||
|
const inventoryTransactions = await Promise.all(bulkInsertOpers);
|
||||||
|
|
||||||
|
// Triggers `onInventoryTransactionsCreated` event.
|
||||||
|
await this.eventEmitter.emitAsync(
|
||||||
|
events.inventory.onInventoryTransactionsCreated,
|
||||||
|
{
|
||||||
|
inventoryTransactions,
|
||||||
|
trx,
|
||||||
|
} as IInventoryTransactionsCreatedPayload,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Writes the inventory transactiosn on the storage from the given
|
||||||
|
* inventory transactions entries.
|
||||||
|
* @param {InventoryTransaction} inventoryEntry - Inventory transaction.
|
||||||
|
* @param {boolean} deleteOld - Delete the existing inventory transactions.
|
||||||
|
* @param {Knex.Transaction} trx - Knex transaction.
|
||||||
|
* @return {Promise<InventoryTransaction>}
|
||||||
|
*/
|
||||||
|
async recordInventoryTransaction(
|
||||||
|
inventoryEntry: InventoryTransaction,
|
||||||
|
deleteOld: boolean = false,
|
||||||
|
trx: Knex.Transaction,
|
||||||
|
): Promise<InventoryTransaction> {
|
||||||
|
if (deleteOld) {
|
||||||
|
await this.deleteInventoryTransactions(
|
||||||
|
inventoryEntry.transactionId,
|
||||||
|
inventoryEntry.transactionType,
|
||||||
|
trx,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return this.inventoryTransactionModel.query(trx).insertGraph({
|
||||||
|
...inventoryEntry,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Records the inventory transactions from items entries that have (inventory) type.
|
||||||
|
*
|
||||||
|
* @param {number} tenantId
|
||||||
|
* @param {number} transactionId
|
||||||
|
* @param {string} transactionType
|
||||||
|
* @param {Date|string} transactionDate
|
||||||
|
* @param {boolean} override
|
||||||
|
*/
|
||||||
|
async recordInventoryTransactionsFromItemsEntries(
|
||||||
|
transaction: {
|
||||||
|
transactionId: number;
|
||||||
|
transactionType: IItemEntryTransactionType;
|
||||||
|
exchangeRate: number;
|
||||||
|
|
||||||
|
date: Date | string;
|
||||||
|
direction: TInventoryTransactionDirection;
|
||||||
|
entries: ItemEntry[];
|
||||||
|
createdAt: Date | string;
|
||||||
|
|
||||||
|
warehouseId?: number;
|
||||||
|
},
|
||||||
|
override: boolean = false,
|
||||||
|
trx?: Knex.Transaction,
|
||||||
|
): Promise<void> {
|
||||||
|
// Can't continue if there is no entries has inventory items in the invoice.
|
||||||
|
if (transaction.entries.length <= 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Inventory transactions.
|
||||||
|
const inventoryTranscations = transformItemEntriesToInventory(transaction);
|
||||||
|
|
||||||
|
// Records the inventory transactions of the given sale invoice.
|
||||||
|
await this.recordInventoryTransactions(
|
||||||
|
inventoryTranscations,
|
||||||
|
override,
|
||||||
|
trx,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes the given inventory transactions.
|
||||||
|
* @param {number} transactionId - Transaction id.
|
||||||
|
* @param {string} transactionType - Transaction type.
|
||||||
|
* @param {Knex.Transaction} trx - Knex transaction.
|
||||||
|
* @return {Promise<{ oldInventoryTransactions: IInventoryTransaction[] }>}
|
||||||
|
*/
|
||||||
|
public async deleteInventoryTransactions(
|
||||||
|
transactionId: number,
|
||||||
|
transactionType: string,
|
||||||
|
trx?: Knex.Transaction,
|
||||||
|
): Promise<{ oldInventoryTransactions: InventoryTransaction[] }> {
|
||||||
|
// Retrieve the inventory transactions of the given sale invoice.
|
||||||
|
const oldInventoryTransactions = await this.inventoryTransactionModel
|
||||||
|
.query(trx)
|
||||||
|
.where({ transactionId, transactionType });
|
||||||
|
|
||||||
|
// Deletes the inventory transactions by the given transaction type and id.
|
||||||
|
await this.inventoryTransactionModel
|
||||||
|
.query(trx)
|
||||||
|
.where({ transactionType, transactionId })
|
||||||
|
.delete();
|
||||||
|
|
||||||
|
// Triggers `onInventoryTransactionsDeleted` event.
|
||||||
|
await this.eventEmitter.emitAsync(
|
||||||
|
events.inventory.onInventoryTransactionsDeleted,
|
||||||
|
{
|
||||||
|
oldInventoryTransactions,
|
||||||
|
transactionId,
|
||||||
|
transactionType,
|
||||||
|
trx,
|
||||||
|
} as IInventoryTransactionsDeletedPayload,
|
||||||
|
);
|
||||||
|
return { oldInventoryTransactions };
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Records the inventory cost lot transaction.
|
||||||
|
* @param {InventoryCostLotTracker} inventoryLotEntry
|
||||||
|
* @return {Promise<InventoryCostLotTracker>}
|
||||||
|
*/
|
||||||
|
async recordInventoryCostLotTransaction(
|
||||||
|
inventoryLotEntry: Partial<InventoryCostLotTracker>,
|
||||||
|
): Promise<InventoryCostLotTracker> {
|
||||||
|
return this.inventoryCostLotTracker.query().insert({
|
||||||
|
...inventoryLotEntry,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,8 +4,9 @@ import moment, { unitOfTime } from 'moment';
|
|||||||
import { BaseModel } from '@/models/Model';
|
import { BaseModel } from '@/models/Model';
|
||||||
import { getTransactionTypeLabel } from '@/modules/BankingTransactions/utils';
|
import { getTransactionTypeLabel } from '@/modules/BankingTransactions/utils';
|
||||||
import { TInventoryTransactionDirection } from '../types/InventoryCost.types';
|
import { TInventoryTransactionDirection } from '../types/InventoryCost.types';
|
||||||
|
import { TenantBaseModel } from '@/modules/System/models/TenantBaseModel';
|
||||||
|
|
||||||
export class InventoryTransaction extends BaseModel {
|
export class InventoryTransaction extends TenantBaseModel {
|
||||||
date: Date | string;
|
date: Date | string;
|
||||||
direction: TInventoryTransactionDirection;
|
direction: TInventoryTransactionDirection;
|
||||||
itemId: number;
|
itemId: number;
|
||||||
@@ -39,7 +40,7 @@ export class InventoryTransaction extends BaseModel {
|
|||||||
* Retrieve formatted reference type.
|
* Retrieve formatted reference type.
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
get transcationTypeFormatted() {
|
get transcationTypeFormatted(): string {
|
||||||
return getTransactionTypeLabel(this.transactionType);
|
return getTransactionTypeLabel(this.transactionType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,14 +9,17 @@ import { ItemCategoryController } from './ItemCategory.controller';
|
|||||||
import { CommandItemCategoryValidatorService } from './commands/CommandItemCategoryValidator.service';
|
import { CommandItemCategoryValidatorService } from './commands/CommandItemCategoryValidator.service';
|
||||||
import { TransformerInjectable } from '../Transformer/TransformerInjectable.service';
|
import { TransformerInjectable } from '../Transformer/TransformerInjectable.service';
|
||||||
import { TenancyContext } from '../Tenancy/TenancyContext.service';
|
import { TenancyContext } from '../Tenancy/TenancyContext.service';
|
||||||
|
import { GetItemCategoriesService } from './queries/GetItemCategories.service';
|
||||||
|
import { DynamicListModule } from '../DynamicListing/DynamicList.module';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports: [TenancyDatabaseModule],
|
imports: [TenancyDatabaseModule, DynamicListModule],
|
||||||
controllers: [ItemCategoryController],
|
controllers: [ItemCategoryController],
|
||||||
providers: [
|
providers: [
|
||||||
CreateItemCategoryService,
|
CreateItemCategoryService,
|
||||||
EditItemCategoryService,
|
EditItemCategoryService,
|
||||||
GetItemCategoryService,
|
GetItemCategoryService,
|
||||||
|
GetItemCategoriesService,
|
||||||
DeleteItemCategoryService,
|
DeleteItemCategoryService,
|
||||||
ItemCategoryApplication,
|
ItemCategoryApplication,
|
||||||
CommandItemCategoryValidatorService,
|
CommandItemCategoryValidatorService,
|
||||||
|
|||||||
@@ -5,29 +5,26 @@ import { MAIL_TRANSPORTER_PROVIDER } from './Mail.constants';
|
|||||||
import { MailTransporter } from './MailTransporter.service';
|
import { MailTransporter } from './MailTransporter.service';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports: [
|
providers: [
|
||||||
{
|
{
|
||||||
module: MailModule,
|
provide: MAIL_TRANSPORTER_PROVIDER,
|
||||||
providers: [
|
inject: [ConfigService],
|
||||||
{
|
useFactory: (configService: ConfigService) => {
|
||||||
provide: MAIL_TRANSPORTER_PROVIDER,
|
// Create reusable transporter object using the default SMTP transport
|
||||||
useFactory: (configService: ConfigService) => {
|
const transporter = createTransport({
|
||||||
// Create reusable transporter object using the default SMTP transport
|
host: configService.get('mail.host'),
|
||||||
const transporter = createTransport({
|
port: configService.get('mail.port'),
|
||||||
host: configService.get('mail.host'),
|
secure: configService.get('mail.secure'), // true for 465, false for other ports
|
||||||
port: configService.get('mail.port'),
|
auth: {
|
||||||
secure: configService.get('mail.secure'), // true for 465, false for other ports
|
user: configService.get('mail.username'),
|
||||||
auth: {
|
pass: configService.get('mail.password'),
|
||||||
user: configService.get('mail.username'),
|
|
||||||
pass: configService.get('mail.password'),
|
|
||||||
},
|
|
||||||
});
|
|
||||||
return transporter;
|
|
||||||
},
|
},
|
||||||
},
|
});
|
||||||
],
|
return transporter;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
MailTransporter
|
MailTransporter,
|
||||||
],
|
],
|
||||||
|
exports: [MAIL_TRANSPORTER_PROVIDER, MailTransporter],
|
||||||
})
|
})
|
||||||
export class MailModule {}
|
export class MailModule {}
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
import { Module } from '@nestjs/common';
|
import { Module } from '@nestjs/common';
|
||||||
import { ContactMailNotification } from './ContactMailNotification';
|
import { ContactMailNotification } from './ContactMailNotification';
|
||||||
|
import { MailTenancyModule } from '../MailTenancy/MailTenancy.module';
|
||||||
|
import { TenancyContext } from '../Tenancy/TenancyContext.service';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports: [ContactMailNotification],
|
imports: [MailTenancyModule],
|
||||||
|
providers: [ContactMailNotification, TenancyContext],
|
||||||
exports: [ContactMailNotification],
|
exports: [ContactMailNotification],
|
||||||
})
|
})
|
||||||
export class MailNotificationModule {}
|
export class MailNotificationModule {}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { MailTenancy } from './MailTenancy.service';
|
|||||||
import { TenancyContext } from '../Tenancy/TenancyContext.service';
|
import { TenancyContext } from '../Tenancy/TenancyContext.service';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports: [],
|
|
||||||
providers: [MailTenancy, TenancyContext],
|
providers: [MailTenancy, TenancyContext],
|
||||||
|
exports: [MailTenancy],
|
||||||
})
|
})
|
||||||
export class MailTenancyModule {}
|
export class MailTenancyModule {}
|
||||||
|
|||||||
@@ -24,11 +24,24 @@ import { DeleteSaleEstimate } from './commands/DeleteSaleEstimate.service';
|
|||||||
import { GetSaleEstimate } from './queries/GetSaleEstimate.service';
|
import { GetSaleEstimate } from './queries/GetSaleEstimate.service';
|
||||||
import { GetSaleEstimateState } from './queries/GetSaleEstimateState.service';
|
import { GetSaleEstimateState } from './queries/GetSaleEstimateState.service';
|
||||||
import { SendSaleEstimateMail } from './commands/SendSaleEstimateMail';
|
import { SendSaleEstimateMail } from './commands/SendSaleEstimateMail';
|
||||||
|
import { GetSaleEstimatesService } from './queries/GetSaleEstimates.service';
|
||||||
|
import { DynamicListModule } from '../DynamicListing/DynamicList.module';
|
||||||
|
import { GetSaleEstimatePdf } from './queries/GetSaleEstimatePdf';
|
||||||
|
import { MailNotificationModule } from '../MailNotification/MailNotification.module';
|
||||||
|
import { MailModule } from '../Mail/Mail.module';
|
||||||
|
import { ChromiumlyTenancyModule } from '../ChromiumlyTenancy/ChromiumlyTenancy.module';
|
||||||
|
import { TemplateInjectableModule } from '../TemplateInjectable/TemplateInjectable.module';
|
||||||
// import { SaleEstimateNotifyBySms } from './commands/SaleEstimateSmsNotify';
|
// import { SaleEstimateNotifyBySms } from './commands/SaleEstimateSmsNotify';
|
||||||
// import { SendSaleEstimateMail } from './commands/SendSaleEstimateMail';
|
|
||||||
//
|
|
||||||
@Module({
|
@Module({
|
||||||
imports: [TenancyDatabaseModule],
|
imports: [
|
||||||
|
TenancyDatabaseModule,
|
||||||
|
DynamicListModule,
|
||||||
|
MailNotificationModule,
|
||||||
|
MailModule,
|
||||||
|
ChromiumlyTenancyModule,
|
||||||
|
TemplateInjectableModule
|
||||||
|
],
|
||||||
controllers: [SaleEstimatesController],
|
controllers: [SaleEstimatesController],
|
||||||
providers: [
|
providers: [
|
||||||
AutoIncrementOrdersService,
|
AutoIncrementOrdersService,
|
||||||
@@ -39,6 +52,7 @@ import { SendSaleEstimateMail } from './commands/SendSaleEstimateMail';
|
|||||||
EditSaleEstimate,
|
EditSaleEstimate,
|
||||||
DeleteSaleEstimate,
|
DeleteSaleEstimate,
|
||||||
GetSaleEstimate,
|
GetSaleEstimate,
|
||||||
|
GetSaleEstimatesService,
|
||||||
GetSaleEstimateState,
|
GetSaleEstimateState,
|
||||||
ApproveSaleEstimateService,
|
ApproveSaleEstimateService,
|
||||||
DeliverSaleEstimateService,
|
DeliverSaleEstimateService,
|
||||||
@@ -54,6 +68,7 @@ import { SendSaleEstimateMail } from './commands/SendSaleEstimateMail';
|
|||||||
TransformerInjectable,
|
TransformerInjectable,
|
||||||
SaleEstimatesApplication,
|
SaleEstimatesApplication,
|
||||||
SendSaleEstimateMail,
|
SendSaleEstimateMail,
|
||||||
|
GetSaleEstimatePdf,
|
||||||
// SaleEstimateNotifyBySms,
|
// SaleEstimateNotifyBySms,
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import { CommandTaxRatesValidators } from './commands/CommandTaxRatesValidator.s
|
|||||||
import { TenancyContext } from '../Tenancy/TenancyContext.service';
|
import { TenancyContext } from '../Tenancy/TenancyContext.service';
|
||||||
import { TaxRatesApplication } from './TaxRate.application';
|
import { TaxRatesApplication } from './TaxRate.application';
|
||||||
import { ItemEntriesTaxTransactions } from './ItemEntriesTaxTransactions.service';
|
import { ItemEntriesTaxTransactions } from './ItemEntriesTaxTransactions.service';
|
||||||
|
import { GetTaxRatesService } from './queries/GetTaxRates.service';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports: [],
|
imports: [],
|
||||||
@@ -20,6 +21,7 @@ import { ItemEntriesTaxTransactions } from './ItemEntriesTaxTransactions.service
|
|||||||
EditTaxRateService,
|
EditTaxRateService,
|
||||||
DeleteTaxRateService,
|
DeleteTaxRateService,
|
||||||
GetTaxRateService,
|
GetTaxRateService,
|
||||||
|
GetTaxRatesService,
|
||||||
ActivateTaxRateService,
|
ActivateTaxRateService,
|
||||||
InactivateTaxRateService,
|
InactivateTaxRateService,
|
||||||
CommandTaxRatesValidators,
|
CommandTaxRatesValidators,
|
||||||
|
|||||||
Reference in New Issue
Block a user