Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
abouolia committed Nov 27, 2023
1 parent b70e876 commit 2349bfd
Show file tree
Hide file tree
Showing 11 changed files with 102 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,15 @@ export class ARAgingSummaryExportInjectable {
private ARAgingSummaryTable: ARAgingSummaryTableInjectable;

/**
* Retrieves the AR aging summary sheet in XLSX format.
* Retrieves the A/R aging summary sheet in XLSX format.
* @param {number} tenantId
* @param {IARAgingSummaryQuery} query
* @returns {Promise<Buffer>}
*/
public async xlsx(tenantId: number, query: IARAgingSummaryQuery) {
public async xlsx(
tenantId: number,
query: IARAgingSummaryQuery
): Promise<Buffer> {
const table = await this.ARAgingSummaryTable.table(tenantId, query);

const tableSheet = new TableSheet(table.table);
Expand All @@ -24,7 +27,7 @@ export class ARAgingSummaryExportInjectable {
}

/**
* Retrieves the AR aging summary sheet in CSV format.
* Retrieves the A/R aging summary sheet in CSV format.
* @param {number} tenantId
* @param {ICashFlowStatementQuery} query
* @returns {Promise<Buffer>}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import { IInventoryDetailsQuery } from '@/interfaces';
import {
IInventoryDetailsQuery,
IInvetoryItemDetailsTable,
} from '@/interfaces';
import { Inject, Service } from 'typedi';
import { InventoryDetailsExportInjectable } from './InventoryDetailsExportInjectable';
import { InventoryDetailsTableInjectable } from './InventoryDetailsTableInjectable';
Expand All @@ -17,8 +20,8 @@ export class InventortyDetailsApplication {

/**
* Retrieves the inventory details report in sheet format.
* @param {number} tenantId
* @param {IInventoryDetailsQuery} query
* @param {number} tenantId
* @param {IInventoryDetailsQuery} query
* @returns {Promise<IInvetoryItemDetailDOO>}
*/
public sheet(tenantId: number, query: IInventoryDetailsQuery) {
Expand All @@ -31,7 +34,10 @@ export class InventortyDetailsApplication {
* @param {IInventoryDetailsQuery} query
* @returns
*/
public table(tenantId: number, query: IInventoryDetailsQuery) {
public table(
tenantId: number,
query: IInventoryDetailsQuery
): Promise<IInvetoryItemDetailsTable> {
return this.inventoryDetailsTable.table(tenantId, query);
}

Expand All @@ -41,17 +47,20 @@ export class InventortyDetailsApplication {
* @param {IInventoryDetailsQuery} query
* @returns {Promise<Buffer>}
*/
public xlsx(tenantId: number, query: IInventoryDetailsQuery) {
public xlsx(
tenantId: number,
query: IInventoryDetailsQuery
): Promise<Buffer> {
return this.inventoryDetailsExport.xlsx(tenantId, query);
}

/**
* Retrieves the inventory details report in CSV format.
* @param {number} tenantId
* @param {IInventoryDetailsQuery} query
* @returns {Promise<Buffer>}
* @returns {Promise<string>}
*/
public csv(tenantId: number, query: IInventoryDetailsQuery) {
public csv(tenantId: number, query: IInventoryDetailsQuery): Promise<string> {
return this.inventoryDetailsExport.csv(tenantId, query);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,23 @@ export class SalesTaxLiabilitySummaryApplication {
* @param {SalesTaxLiabilitySummaryQuery} query
* @returns {Promise<Buffer>}
*/
public xlsx(tenantId: number, query: SalesTaxLiabilitySummaryQuery) {
public xlsx(
tenantId: number,
query: SalesTaxLiabilitySummaryQuery
): Promise<Buffer> {
return this.salesTaxLiabilityExport.xlsx(tenantId, query);
}

/**
* Retrieves the sales tax liability summary in CSV format.
* @param {number} tenantId
* @param {SalesTaxLiabilitySummaryQuery} query
* @returns {Promise<Buffer>}
* @returns {Promise<string>}
*/
public csv(tenantId: number, query: SalesTaxLiabilitySummaryQuery) {
public csv(
tenantId: number,
query: SalesTaxLiabilitySummaryQuery
): Promise<string> {
return this.salesTaxLiabilityExport.csv(tenantId, query);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ export class SalesTaxLiabilitySummaryExportInjectable {
* @param {ICashFlowStatementQuery} query
* @returns {Promise<Buffer>}
*/
public async xlsx(tenantId: number, query: SalesTaxLiabilitySummaryQuery) {
public async xlsx(
tenantId: number,
query: SalesTaxLiabilitySummaryQuery
): Promise<Buffer> {
const table = await this.salesTaxLiabilityTable.table(tenantId, query);

const tableSheet = new TableSheet(table.table);
Expand All @@ -27,7 +30,7 @@ export class SalesTaxLiabilitySummaryExportInjectable {
* Retrieves the cashflow sheet in CSV format.
* @param {number} tenantId
* @param {ICashFlowStatementQuery} query
* @returns {Promise<Buffer>}
* @returns {Promise<string>}
*/
public async csv(
tenantId: number,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ export class SalesTaxLiabilitySummaryTableInjectable {
rows: table.tableRows(),
columns: table.tableColumns(),
},
data: report.data,
query: report.query,
meta: report.meta,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export class TransactionsByCustomerApplication {
* Retrieves the transactions by vendors sheet in table format.
* @param {number} tenantId
* @param {ITransactionsByCustomersFilter} query
* @returns {}
* @returns {Promise<ITransactionsByCustomersTable>}
*/
public table(tenantId: number, query: ITransactionsByCustomersFilter) {
return this.transactionsByCustomersTable.table(tenantId, query);
Expand All @@ -48,17 +48,25 @@ export class TransactionsByCustomerApplication {
* Retrieves the transactions by vendors sheet in CSV format.
* @param {number} tenantId
* @param {ITransactionsByCustomersFilter} query
* @returns {Promise<string>}
*/
public csv(tenantId: number, query: ITransactionsByCustomersFilter) {
public csv(
tenantId: number,
query: ITransactionsByCustomersFilter
): Promise<string> {
return this.transactionsByCustomersExport.csv(tenantId, query);
}

/**
* Retrieves the transactions by vendors sheet in XLSX format.
* @param {number} tenantId
* @param {ITransactionsByCustomersFilter} query
* @returns {Promise<Buffer>}
*/
public xlsx(tenantId: number, query: ITransactionsByCustomersFilter) {
public xlsx(
tenantId: number,
query: ITransactionsByCustomersFilter
): Promise<Buffer> {
return this.transactionsByCustomersExport.xlsx(tenantId, query);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ export class TransactionsByCustomersExportInjectable {
* @param {ITransactionsByCustomersFilter} query
* @returns {Promise<Buffer>}
*/
public async xlsx(tenantId: number, query: ITransactionsByCustomersFilter) {
public async xlsx(
tenantId: number,
query: ITransactionsByCustomersFilter
): Promise<Buffer> {
const table = await this.transactionsByCustomerTable.table(tenantId, query);

const tableSheet = new TableSheet(table.table);
Expand All @@ -27,7 +30,7 @@ export class TransactionsByCustomersExportInjectable {
* Retrieves the cashflow sheet in CSV format.
* @param {number} tenantId
* @param {ITransactionsByCustomersFilter} query
* @returns {Promise<Buffer>}
* @returns {Promise<string>}
*/
public async csv(
tenantId: number,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import { Inject, Service } from 'typedi';
import { ITransactionsByVendorsFilter } from '@/interfaces';
import {
ITransactionsByVendorTable,
ITransactionsByVendorsFilter,
ITransactionsByVendorsStatement,
} from '@/interfaces';
import { TransactionsByVendorExportInjectable } from './TransactionsByVendorExportInjectable';
import { TransactionsByVendorTableInjectable } from './TransactionsByVendorTableInjectable';
import { TransactionsByVendorsInjectable } from './TransactionsByVendorInjectable';
Expand All @@ -19,8 +23,12 @@ export class TransactionsByVendorApplication {
* Retrieves the transactions by vendor in sheet format.
* @param {number} tenantId
* @param {ITransactionsByVendorsFilter} query
* @returns {Promise<ITransactionsByVendorsStatement>}
*/
public sheet(tenantId: number, query: ITransactionsByVendorsFilter) {
public sheet(
tenantId: number,
query: ITransactionsByVendorsFilter
): Promise<ITransactionsByVendorsStatement> {
return this.transactionsByVendorSheet.transactionsByVendors(
tenantId,
query
Expand All @@ -31,17 +39,25 @@ export class TransactionsByVendorApplication {
* Retrieves the transactions by vendor in table format.
* @param {number} tenantId
* @param {ITransactionsByVendorsFilter} query
* @returns {Promise<ITransactionsByVendorTable>}
*/
public table(tenantId: number, query: ITransactionsByVendorsFilter) {
public table(
tenantId: number,
query: ITransactionsByVendorsFilter
): Promise<ITransactionsByVendorTable> {
return this.transactionsByVendorTable.table(tenantId, query);
}

/**
* Retrieves the transactions by vendor in CSV format.
* @param {number} tenantId
* @param {ITransactionsByVendorsFilter} query
* @returns {Promise<string>}
*/
public csv(tenantId: number, query: ITransactionsByVendorsFilter) {
public csv(
tenantId: number,
query: ITransactionsByVendorsFilter
): Promise<string> {
return this.transactionsByVendorExport.csv(tenantId, query);
}

Expand All @@ -50,7 +66,10 @@ export class TransactionsByVendorApplication {
* @param {number} tenantId
* @param {ITransactionsByVendorsFilter} query
*/
public xlsx(tenantId: number, query: ITransactionsByVendorsFilter) {
public xlsx(
tenantId: number,
query: ITransactionsByVendorsFilter
): Promise<Buffer> {
return this.transactionsByVendorExport.xlsx(tenantId, query);
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ITransactionsByReferenceQuery, ITransactionsByVendorsFilter } from '@/interfaces';
import { TableSheet } from '@/lib/Xlsx/TableSheet';
import { Inject, Service } from 'typedi';
import { ITransactionsByVendorsFilter } from '@/interfaces';
import { TableSheet } from '@/lib/Xlsx/TableSheet';
import { TransactionsByVendorTableInjectable } from './TransactionsByVendorTableInjectable';

@Service()
Expand All @@ -14,7 +14,10 @@ export class TransactionsByVendorExportInjectable {
* @param {ITransactionsByVendorsFilter} query
* @returns {Promise<Buffer>}
*/
public async xlsx(tenantId: number, query: ITransactionsByVendorsFilter) {
public async xlsx(
tenantId: number,
query: ITransactionsByVendorsFilter
): Promise<Buffer> {
const table = await this.transactionsByVendorTable.table(tenantId, query);

const tableSheet = new TableSheet(table.table);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import * as R from 'ramda';
import { tableRowMapper } from 'utils';
import { ITransactionsByVendorsVendor, ITableRow, ITableColumn } from '@/interfaces';
import {
ITransactionsByVendorsVendor,
ITableRow,
ITableColumn,
} from '@/interfaces';
import TransactionsByContactsTableRows from '../TransactionsByContact/TransactionsByContactTableRows';

enum ROW_TYPE {
Expand All @@ -15,6 +19,8 @@ export class TransactionsByVendorsTable extends TransactionsByContactsTableRows

/**
* Constructor method.
* @param {ITransactionsByVendorsVendor[]} vendorsTransactions -
* @param {any} i18n
*/
constructor(vendorsTransactions: ITransactionsByVendorsVendor[], i18n) {
super();
Expand Down Expand Up @@ -71,7 +77,11 @@ export class TransactionsByVendorsTable extends TransactionsByContactsTableRows
return R.map(this.vendorRowsMapper)(this.vendorsTransactions);
};

/**
* Retrieve the table columns of transactions by vendors report.
* @returns {ITableColumn[]}
*/
public tableColumns = (): ITableColumn[] => {
return [];
}
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ export class VendorBalanceSummaryApplication {
* @param {IVendorBalanceSummaryQuery} query
* @returns {Promise<Buffer>}
*/
public xlsx(tenantId: number, query: IVendorBalanceSummaryQuery) {
public xlsx(
tenantId: number,
query: IVendorBalanceSummaryQuery
): Promise<Buffer> {
return this.vendorBalanceSummaryExport.xlsx(tenantId, query);
}

Expand All @@ -50,7 +53,10 @@ export class VendorBalanceSummaryApplication {
* @param {IVendorBalanceSummaryQuery} query
* @returns {Promise<Buffer>}
*/
public csv(tenantId: number, query: IVendorBalanceSummaryQuery) {
public csv(
tenantId: number,
query: IVendorBalanceSummaryQuery
): Promise<string> {
return this.vendorBalanceSummaryExport.csv(tenantId, query);
}
}

0 comments on commit 2349bfd

Please sign in to comment.