mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-19 14:20:31 +00:00
Merge branch 'develop' into big-105-convert-invoice-status-after-sending-mail-notification
This commit is contained in:
@@ -10,6 +10,7 @@ export class SaleEstimateTransfromer extends Transformer {
|
||||
*/
|
||||
public includeAttributes = (): string[] => {
|
||||
return [
|
||||
'formattedSubtotal',
|
||||
'formattedAmount',
|
||||
'formattedEstimateDate',
|
||||
'formattedExpirationDate',
|
||||
@@ -76,6 +77,15 @@ export class SaleEstimateTransfromer extends Transformer {
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Retrieves the formatted invoice subtotal.
|
||||
* @param {ISaleEstimate} estimate
|
||||
* @returns {string}
|
||||
*/
|
||||
protected formattedSubtotal = (estimate: ISaleEstimate): string => {
|
||||
return formatNumber(estimate.amount, { money: false });
|
||||
};
|
||||
|
||||
/**
|
||||
* Retrieves the entries of the sale estimate.
|
||||
* @param {ISaleEstimate} estimate
|
||||
|
||||
@@ -8,7 +8,16 @@ export class ItemEntryTransformer extends Transformer {
|
||||
* @returns {Array}
|
||||
*/
|
||||
public includeAttributes = (): string[] => {
|
||||
return ['rateFormatted', 'totalFormatted'];
|
||||
return ['quantityFormatted', 'rateFormatted', 'totalFormatted'];
|
||||
};
|
||||
|
||||
/**
|
||||
* Retrieves the formatted quantitty of item entry.
|
||||
* @param {IItemEntry} entry
|
||||
* @returns {string}
|
||||
*/
|
||||
protected quantityFormatted = (entry: IItemEntry): string => {
|
||||
return formatNumber(entry.quantity, { money: false });
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -61,7 +61,8 @@ export class EditPaymentReceive {
|
||||
// Validate the payment receive existance.
|
||||
const oldPaymentReceive = await PaymentReceive.query()
|
||||
.withGraphFetched('entries')
|
||||
.findById(paymentReceiveId);
|
||||
.findById(paymentReceiveId)
|
||||
.throwIfNotFound();
|
||||
|
||||
// Validates the payment existance.
|
||||
this.validators.validatePaymentExistance(oldPaymentReceive);
|
||||
|
||||
@@ -10,6 +10,7 @@ export class PaymentReceiveTransfromer extends Transformer {
|
||||
*/
|
||||
public includeAttributes = (): string[] => {
|
||||
return [
|
||||
'subtotalFormatted',
|
||||
'formattedPaymentDate',
|
||||
'formattedAmount',
|
||||
'formattedExchangeRate',
|
||||
@@ -26,6 +27,18 @@ export class PaymentReceiveTransfromer extends Transformer {
|
||||
return this.formatDate(payment.paymentDate);
|
||||
};
|
||||
|
||||
/**
|
||||
* Retrieve the formatted payment subtotal.
|
||||
* @param {IPaymentReceive} payment
|
||||
* @returns {string}
|
||||
*/
|
||||
protected subtotalFormatted = (payment: IPaymentReceive): string => {
|
||||
return formatNumber(payment.amount, {
|
||||
currencyCode: payment.currencyCode,
|
||||
money: false,
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Retrieve formatted payment amount.
|
||||
* @param {ISaleInvoice} invoice
|
||||
|
||||
@@ -32,7 +32,7 @@ export class SaleReceiptGLEntries {
|
||||
): Promise<void> => {
|
||||
const { SaleReceipt } = this.tenancy.models(tenantId);
|
||||
|
||||
const saleReceipt = await SaleReceipt.query()
|
||||
const saleReceipt = await SaleReceipt.query(trx)
|
||||
.findById(saleReceiptId)
|
||||
.withGraphFetched('entries.item');
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ export class SaleReceiptTransformer extends Transformer {
|
||||
*/
|
||||
public includeAttributes = (): string[] => {
|
||||
return [
|
||||
'formattedSubtotal',
|
||||
'formattedAmount',
|
||||
'formattedReceiptDate',
|
||||
'formattedClosedAtDate',
|
||||
@@ -37,6 +38,15 @@ export class SaleReceiptTransformer extends Transformer {
|
||||
return this.formatDate(receipt.closedAt);
|
||||
};
|
||||
|
||||
/**
|
||||
* Retrieves the estimate formatted subtotal.
|
||||
* @param {ISaleReceipt} receipt
|
||||
* @returns {string}
|
||||
*/
|
||||
protected formattedSubtotal = (receipt: ISaleReceipt): string => {
|
||||
return formatNumber(receipt.amount, { money: false });
|
||||
};
|
||||
|
||||
/**
|
||||
* Retrieve formatted invoice amount.
|
||||
* @param {ISaleReceipt} estimate
|
||||
|
||||
Reference in New Issue
Block a user