Merge branch 'develop' into big-105-convert-invoice-status-after-sending-mail-notification

This commit is contained in:
Ahmed Bouhuolia
2024-02-21 20:20:36 +02:00
committed by GitHub
368 changed files with 6512 additions and 2339 deletions

View File

@@ -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

View File

@@ -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 });
};
/**

View File

@@ -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);

View File

@@ -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

View File

@@ -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');

View File

@@ -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