mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-19 14:20:31 +00:00
fix(server): getting matched transaction transformer
This commit is contained in:
@@ -169,8 +169,8 @@ export class Transformer {
|
|||||||
* @param number
|
* @param number
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
protected formatNumber(number) {
|
protected formatNumber(number, props?) {
|
||||||
return formatNumber(number, { money: false });
|
return formatNumber(number, { money: false, ...props });
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ export class GetMatchedTransactionBillsTransformer extends Transformer {
|
|||||||
'amountFormatted',
|
'amountFormatted',
|
||||||
'transactionNo',
|
'transactionNo',
|
||||||
'date',
|
'date',
|
||||||
'dateFromatted',
|
'dateFormatted',
|
||||||
'transactionId',
|
'transactionId',
|
||||||
'transactionNo',
|
'transactionNo',
|
||||||
'transactionType',
|
'transactionType',
|
||||||
@@ -52,8 +52,9 @@ export class GetMatchedTransactionBillsTransformer extends Transformer {
|
|||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
protected amountFormatted(bill) {
|
protected amountFormatted(bill) {
|
||||||
return this.formatNumber(bill.totalAmount, {
|
return this.formatNumber(bill.amount, {
|
||||||
currencyCode: bill.currencyCode,
|
currencyCode: bill.currencyCode,
|
||||||
|
money: true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -63,7 +64,7 @@ export class GetMatchedTransactionBillsTransformer extends Transformer {
|
|||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
protected date(bill) {
|
protected date(bill) {
|
||||||
return bill.date;
|
return bill.billDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -71,8 +72,8 @@ export class GetMatchedTransactionBillsTransformer extends Transformer {
|
|||||||
* @param {Object} bill - The bill object.
|
* @param {Object} bill - The bill object.
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
protected dateFromatted(bill) {
|
protected dateFormatted(bill) {
|
||||||
return this.formatDate(bill.date);
|
return this.formatDate(bill.billDate);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -83,4 +84,20 @@ export class GetMatchedTransactionBillsTransformer extends Transformer {
|
|||||||
protected transactionId(bill) {
|
protected transactionId(bill) {
|
||||||
return bill.id;
|
return bill.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve the manual journal transaction type.
|
||||||
|
* @returns {string}
|
||||||
|
*/
|
||||||
|
protected transactionType() {
|
||||||
|
return 'Bill';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the manual journal formatted transaction type.
|
||||||
|
* @returns {string}
|
||||||
|
*/
|
||||||
|
protected transsactionTypeFormatted() {
|
||||||
|
return 'Bill';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ export class GetMatchedTransactionExpensesTransformer extends Transformer {
|
|||||||
'amountFormatted',
|
'amountFormatted',
|
||||||
'transactionNo',
|
'transactionNo',
|
||||||
'date',
|
'date',
|
||||||
'dateFromatted',
|
'dateFormatted',
|
||||||
'transactionId',
|
'transactionId',
|
||||||
'transactionNo',
|
'transactionNo',
|
||||||
'transactionType',
|
'transactionType',
|
||||||
@@ -54,6 +54,7 @@ export class GetMatchedTransactionExpensesTransformer extends Transformer {
|
|||||||
protected amountFormatted(expense) {
|
protected amountFormatted(expense) {
|
||||||
return this.formatNumber(expense.totalAmount, {
|
return this.formatNumber(expense.totalAmount, {
|
||||||
currencyCode: expense.currencyCode,
|
currencyCode: expense.currencyCode,
|
||||||
|
money: true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,7 +72,7 @@ export class GetMatchedTransactionExpensesTransformer extends Transformer {
|
|||||||
* @param expense
|
* @param expense
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
protected dateFromatted(expense) {
|
protected dateFormatted(expense) {
|
||||||
return this.formatDate(expense.paymentDate);
|
return this.formatDate(expense.paymentDate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ export class GetMatchedTransactionInvoicesTransformer extends Transformer {
|
|||||||
'amountFormatted',
|
'amountFormatted',
|
||||||
'transactionNo',
|
'transactionNo',
|
||||||
'date',
|
'date',
|
||||||
'dateFromatted',
|
'dateFormatted',
|
||||||
'transactionId',
|
'transactionId',
|
||||||
'transactionNo',
|
'transactionNo',
|
||||||
'transactionType',
|
'transactionType',
|
||||||
@@ -52,6 +52,7 @@ export class GetMatchedTransactionInvoicesTransformer extends Transformer {
|
|||||||
protected formatAmount(invoice) {
|
protected formatAmount(invoice) {
|
||||||
return this.formatNumber(invoice.dueAmount, {
|
return this.formatNumber(invoice.dueAmount, {
|
||||||
currencyCode: invoice.currencyCode,
|
currencyCode: invoice.currencyCode,
|
||||||
|
money: true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -60,7 +61,7 @@ export class GetMatchedTransactionInvoicesTransformer extends Transformer {
|
|||||||
* @param invoice
|
* @param invoice
|
||||||
* @returns {Date}
|
* @returns {Date}
|
||||||
*/
|
*/
|
||||||
protected getDate(invoice) {
|
protected date(invoice) {
|
||||||
return invoice.invoiceDate;
|
return invoice.invoiceDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,7 +70,7 @@ export class GetMatchedTransactionInvoicesTransformer extends Transformer {
|
|||||||
* @param invoice
|
* @param invoice
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
protected formatDate(invoice) {
|
protected dateFormatted(invoice) {
|
||||||
return this.formatDate(invoice.invoiceDate);
|
return this.formatDate(invoice.invoiceDate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ export class GetMatchedTransactionManualJournalsTransformer extends Transformer
|
|||||||
'amountFormatted',
|
'amountFormatted',
|
||||||
'transactionNo',
|
'transactionNo',
|
||||||
'date',
|
'date',
|
||||||
'dateFromatted',
|
'dateFormatted',
|
||||||
'transactionId',
|
'transactionId',
|
||||||
'transactionNo',
|
'transactionNo',
|
||||||
'transactionType',
|
'transactionType',
|
||||||
@@ -54,6 +54,7 @@ export class GetMatchedTransactionManualJournalsTransformer extends Transformer
|
|||||||
protected amountFormatted(manualJournal) {
|
protected amountFormatted(manualJournal) {
|
||||||
return this.formatNumber(manualJournal.amount, {
|
return this.formatNumber(manualJournal.amount, {
|
||||||
currencyCode: manualJournal.currencyCode,
|
currencyCode: manualJournal.currencyCode,
|
||||||
|
money: true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,7 +72,7 @@ export class GetMatchedTransactionManualJournalsTransformer extends Transformer
|
|||||||
* @param manualJournal
|
* @param manualJournal
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
protected dateFromatted(manualJournal) {
|
protected dateFormatted(manualJournal) {
|
||||||
return this.formatDate(manualJournal.date);
|
return this.formatDate(manualJournal.date);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,3 +108,4 @@ export class GetMatchedTransactionManualJournalsTransformer extends Transformer
|
|||||||
return 'Manual Journal';
|
return 'Manual Journal';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user