mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 21:00:31 +00:00
feat: WIP transactions by customers/vendors.
This commit is contained in:
@@ -5,7 +5,7 @@ import {
|
||||
IContactBalanceSummaryContact,
|
||||
IContactBalanceSummaryTotal,
|
||||
IContactBalanceSummaryAmount,
|
||||
IContactBalanceSummaryPercentage
|
||||
IContactBalanceSummaryPercentage,
|
||||
} from 'interfaces';
|
||||
|
||||
export class ContactBalanceSummaryReport extends FinancialSheet {
|
||||
@@ -60,7 +60,7 @@ export class ContactBalanceSummaryReport extends FinancialSheet {
|
||||
* @param {IContactBalanceSummaryContact} contact
|
||||
* @returns {IContactBalanceSummaryContact}
|
||||
*/
|
||||
private contactCamparsionPercentageOfColumnMapper(
|
||||
private contactCamparsionPercentageOfColumnMapper(
|
||||
total: number,
|
||||
contact: IContactBalanceSummaryContact
|
||||
): IContactBalanceSummaryContact {
|
||||
@@ -90,7 +90,14 @@ export class ContactBalanceSummaryReport extends FinancialSheet {
|
||||
return contacts.map(camparsionPercentageOfColummn);
|
||||
}
|
||||
|
||||
getContactTotalFormat(amount: number) {
|
||||
/**
|
||||
* Retrieve the contact total format.
|
||||
* @param {number} amount -
|
||||
* @return {IContactBalanceSummaryAmount}
|
||||
*/
|
||||
protected getContactTotalFormat(
|
||||
amount: number
|
||||
): IContactBalanceSummaryAmount {
|
||||
return {
|
||||
amount,
|
||||
formattedAmount: this.formatNumber(amount),
|
||||
@@ -100,10 +107,10 @@ export class ContactBalanceSummaryReport extends FinancialSheet {
|
||||
|
||||
/**
|
||||
* Retrieve the total amount of contacts sections.
|
||||
* @param {number} amount
|
||||
* @param {number} amount
|
||||
* @returns {IContactBalanceSummaryAmount}
|
||||
*/
|
||||
getTotalFormat(amount: number): IContactBalanceSummaryAmount {
|
||||
protected getTotalFormat(amount: number): IContactBalanceSummaryAmount {
|
||||
return {
|
||||
amount,
|
||||
formattedAmount: this.formatNumber(amount),
|
||||
@@ -113,10 +120,12 @@ export class ContactBalanceSummaryReport extends FinancialSheet {
|
||||
|
||||
/**
|
||||
* Retrieve the percentage amount object.
|
||||
* @param {number} amount
|
||||
* @param {number} amount
|
||||
* @returns {IContactBalanceSummaryPercentage}
|
||||
*/
|
||||
getPercentageMeta(amount: number): IContactBalanceSummaryPercentage {
|
||||
protected getPercentageMeta(
|
||||
amount: number
|
||||
): IContactBalanceSummaryPercentage {
|
||||
return {
|
||||
amount,
|
||||
formattedAmount: this.formatPercentage(amount),
|
||||
|
||||
@@ -9,7 +9,6 @@ export default class FinancialSheet {
|
||||
* Transformes the number format query to settings
|
||||
*/
|
||||
protected transfromFormatQueryToSettings(): IFormatNumberSettings {
|
||||
console.log(this.numberFormat, 'XX');
|
||||
const { numberFormat } = this;
|
||||
|
||||
return {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import moment from 'moment';
|
||||
import { tableMapper, tableRowMapper } from 'utils';
|
||||
import {
|
||||
ITransactionsByContactsContact,
|
||||
@@ -12,6 +13,11 @@ enum ROW_TYPE {
|
||||
}
|
||||
|
||||
export default class TransactionsByContactsTableRows {
|
||||
|
||||
private dateAccessor(value) {
|
||||
return moment(value.date).format('YYYY MMM DD');
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the table rows of contact transactions.
|
||||
* @param {ITransactionsByCustomersCustomer} contact
|
||||
@@ -21,7 +27,7 @@ export default class TransactionsByContactsTableRows {
|
||||
contact: ITransactionsByContactsContact
|
||||
): ITableRow[] {
|
||||
const columns = [
|
||||
{ key: 'date', accessor: 'date' },
|
||||
{ key: 'date', accessor: this.dateAccessor },
|
||||
{ key: 'account', accessor: 'account.name' },
|
||||
{ key: 'referenceType', accessor: 'referenceType' },
|
||||
{ key: 'transactionType', accessor: 'transactionType' },
|
||||
@@ -62,9 +68,9 @@ export default class TransactionsByContactsTableRows {
|
||||
contact: ITransactionsByContactsContact
|
||||
): ITableRow {
|
||||
const columns = [
|
||||
{ key: 'openingBalanceLabel', value: 'Closing balance' },
|
||||
{ key: 'closingBalanceLabel', value: 'Closing balance' },
|
||||
{
|
||||
key: 'openingBalanceValue',
|
||||
key: 'closingBalanceValue',
|
||||
accessor: 'closingBalance.formattedAmount',
|
||||
},
|
||||
];
|
||||
|
||||
@@ -22,8 +22,8 @@ export default class TransactionsByCustomersTableRows extends TransactionsByCont
|
||||
return {
|
||||
...tableRowMapper(customer, columns, { rowTypes: [ROW_TYPE.CUSTOMER] }),
|
||||
children: R.pipe(
|
||||
R.append(this.contactOpeningBalance(customer)),
|
||||
R.concat(this.contactTransactions(customer)),
|
||||
R.prepend(this.contactOpeningBalance(customer)),
|
||||
R.append(this.contactClosingBalance(customer))
|
||||
)([]),
|
||||
};
|
||||
@@ -35,7 +35,7 @@ export default class TransactionsByCustomersTableRows extends TransactionsByCont
|
||||
* @returns {ITableRow[]}
|
||||
*/
|
||||
private customerRowsMapper(customer: ITransactionsByCustomersCustomer) {
|
||||
return R.pipe(R.append(this.customerDetails(customer))).bind(this)([]);
|
||||
return R.pipe(this.customerDetails).bind(this)(customer);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user