mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 05:40:31 +00:00
add server to monorepo.
This commit is contained in:
@@ -0,0 +1,84 @@
|
||||
import { Transformer } from '@/lib/Transformer/Transformer';
|
||||
import { formatNumber } from 'utils';
|
||||
|
||||
export class ItemReceiptTransactionTransformer extends Transformer {
|
||||
/**
|
||||
* Include these attributes to sale invoice object.
|
||||
* @returns {Array}
|
||||
*/
|
||||
public includeAttributes = (): string[] => {
|
||||
return [
|
||||
'formattedAmount',
|
||||
'formattedReceiptDate',
|
||||
'formattedRate',
|
||||
'formattedCost',
|
||||
];
|
||||
};
|
||||
|
||||
/**
|
||||
* Formatted sell price.
|
||||
* @param item
|
||||
* @returns {string}
|
||||
*/
|
||||
public formattedAmount(item): string {
|
||||
return formatNumber(item.amount, {
|
||||
currencyCode: item.receipt.currencyCode,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param item
|
||||
* @returns
|
||||
*/
|
||||
public formattedReceiptDate = (entry): string => {
|
||||
return this.formatDate(entry.receipt.receiptDate);
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public formattedQuantity = (entry): string => {
|
||||
return entry.quantity;
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* @param entry
|
||||
* @returns
|
||||
*/
|
||||
public formattedRate = (entry): string => {
|
||||
return formatNumber(entry.rate, {
|
||||
currencyCode: entry.receipt.currencyCode,
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* @param entry
|
||||
* @returns
|
||||
*/
|
||||
public transform = (entry) => {
|
||||
return {
|
||||
receiptId: entry.receipt.id,
|
||||
|
||||
receipNumber: entry.receipt.receiptNumber,
|
||||
referenceNumber: entry.receipt.referenceNo,
|
||||
|
||||
receiptDate: entry.receipt.receiptDate,
|
||||
formattedReceiptDate: entry.formattedReceiptDate,
|
||||
|
||||
amount: entry.amount,
|
||||
formattedAmount: entry.formattedAmount,
|
||||
|
||||
quantity: entry.quantity,
|
||||
formattedQuantity: entry.formattedQuantity,
|
||||
|
||||
rate: entry.rate,
|
||||
formattedRate: entry.formattedRate,
|
||||
|
||||
customerDisplayName: entry.receipt.customer.displayName,
|
||||
customerCurrencyCode: entry.receipt.customer.currencyCode,
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user