Compare commits
1 Commits
bugs-bashi
...
fix-total-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c1e9cc8252 |
@@ -15,7 +15,7 @@ export const transformEstimateToPdfTemplate = (
|
||||
quantity: entry.quantityFormatted,
|
||||
total: entry.totalFormatted,
|
||||
})),
|
||||
total: estimate.formattedSubtotal,
|
||||
total: estimate.totalFormatted,
|
||||
subtotal: estimate.formattedSubtotal,
|
||||
adjustment: estimate.adjustmentFormatted,
|
||||
customerNote: estimate.note,
|
||||
|
||||
@@ -82,21 +82,21 @@ export class GetSaleReceiptMailStateTransformer extends SaleReceiptTransformer {
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* Retrieves the total amount.
|
||||
* @param receipt
|
||||
* @returns
|
||||
*/
|
||||
protected total = (receipt) => {
|
||||
return receipt.amount;
|
||||
return receipt.total;
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* Retrieves the formatted total amount.
|
||||
* @param receipt
|
||||
* @returns
|
||||
* @returns {string}
|
||||
*/
|
||||
protected totalFormatted = (receipt) => {
|
||||
return this.formatMoney(receipt.amount, {
|
||||
return this.formatMoney(receipt.total, {
|
||||
currencyCode: receipt.currencyCode,
|
||||
});
|
||||
};
|
||||
@@ -118,7 +118,7 @@ export class GetSaleReceiptMailStateTransformer extends SaleReceiptTransformer {
|
||||
* @returns
|
||||
*/
|
||||
protected subtotal = (receipt) => {
|
||||
return receipt.amount;
|
||||
return receipt.subtotal;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -127,7 +127,7 @@ export class GetSaleReceiptMailStateTransformer extends SaleReceiptTransformer {
|
||||
* @returns
|
||||
*/
|
||||
protected subtotalFormatted = (receipt) => {
|
||||
return this.formatMoney(receipt.amount, {
|
||||
return this.formatMoney(receipt.subtotal, {
|
||||
currencyCode: receipt.currencyCode,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -413,7 +413,10 @@ export const formatSmsMessage = (message: string, args) => {
|
||||
const variable = `{${key}}`;
|
||||
const value = _.defaultTo(args[key], '');
|
||||
|
||||
formattedMessage = formattedMessage.replace(variable, value);
|
||||
formattedMessage = formattedMessage.replace(
|
||||
new RegExp(variable, 'g'),
|
||||
value
|
||||
);
|
||||
});
|
||||
return formattedMessage;
|
||||
};
|
||||
|
||||
@@ -36,7 +36,7 @@ export const withEstimateMailReceiptPreviewProps = <
|
||||
estimateNumber: estimateMailState?.estimateNumber,
|
||||
estimateDate: estimateMailState?.estimateDateFormatted,
|
||||
subtotal: estimateMailState?.subtotalFormatted,
|
||||
discount: estimateMailState?.discountFormatted,
|
||||
discount: estimateMailState?.discountAmountFormatted,
|
||||
adjustment: estimateMailState?.adjustmentFormatted,
|
||||
items,
|
||||
message,
|
||||
|
||||
@@ -67,7 +67,7 @@ export const formatSmsMessage = (
|
||||
const variable = `{${key}}`;
|
||||
const value = defaultTo(args[key], '');
|
||||
|
||||
formattedMessage = formattedMessage.replace(variable, value);
|
||||
formattedMessage = formattedMessage.replaceAll(variable, value);
|
||||
});
|
||||
return formattedMessage;
|
||||
};
|
||||
|
||||
@@ -284,8 +284,8 @@ export interface SaleEstimateMailStateResponse {
|
||||
subtotal: number;
|
||||
subtotalFormatted: string;
|
||||
|
||||
discount: number;
|
||||
discountFormatted: string;
|
||||
discountAmount: number;
|
||||
discountAmountFormatted: string;
|
||||
discountLabel: string;
|
||||
discountPercentage: number | null;
|
||||
discountPercentageFormatted: string;
|
||||
|
||||
@@ -16,6 +16,7 @@ import {
|
||||
PaperTemplateProps,
|
||||
PaperTemplateTotalBorder,
|
||||
} from './PaperTemplate';
|
||||
import { theme } from '../constants';
|
||||
|
||||
export interface EstimatePaperTemplateProps extends PaperTemplateProps {
|
||||
// # Company
|
||||
@@ -173,6 +174,7 @@ export function EstimatePaperTemplate({
|
||||
lineRateLabel = 'Rate',
|
||||
lineTotalLabel = 'Total',
|
||||
}: EstimatePaperTemplateProps) {
|
||||
|
||||
return (
|
||||
<PaperTemplate primaryColor={primaryColor} secondaryColor={secondaryColor}>
|
||||
<Stack spacing={24}>
|
||||
@@ -228,13 +230,13 @@ export function EstimatePaperTemplate({
|
||||
<Text>{data.item}</Text>
|
||||
<Text
|
||||
fontSize={'12px'}
|
||||
// className={Classes.TEXT_MUTED}
|
||||
// style={{ fontSize: 12 }}
|
||||
color={theme.colors['cool-gray-500']}
|
||||
>
|
||||
{data.description}
|
||||
</Text>
|
||||
</Stack>
|
||||
),
|
||||
thStyle: { width: '60%' },
|
||||
},
|
||||
{ label: lineQuantityLabel, accessor: 'quantity' },
|
||||
{ label: lineRateLabel, accessor: 'rate', align: 'right' },
|
||||
|
||||
@@ -118,23 +118,27 @@ export interface InvoicePaperTemplateProps extends PaperTemplateProps {
|
||||
}
|
||||
|
||||
export function InvoicePaperTemplate({
|
||||
// # Colors
|
||||
primaryColor,
|
||||
secondaryColor,
|
||||
|
||||
// # Company.
|
||||
companyName = 'Bigcapital Technology, Inc.',
|
||||
|
||||
showCompanyLogo = true,
|
||||
companyLogoUri = '',
|
||||
|
||||
// # Due date
|
||||
dueDate = 'September 3, 2024',
|
||||
dueDateLabel = 'Date due',
|
||||
showDueDate = true,
|
||||
|
||||
// # Issue date.
|
||||
dateIssue = 'September 3, 2024',
|
||||
dateIssueLabel = 'Date of issue',
|
||||
showDateIssue = true,
|
||||
|
||||
// dateIssue,
|
||||
// Invoice #,
|
||||
invoiceNumberLabel = 'Invoice number',
|
||||
invoiceNumber = '346D3D40-0001',
|
||||
showInvoiceNumber = true,
|
||||
@@ -197,6 +201,7 @@ export function InvoicePaperTemplate({
|
||||
{ label: 'Sample Tax2 (7.00%)', amount: '21.74' },
|
||||
],
|
||||
|
||||
// # Statement
|
||||
statementLabel = 'Statement',
|
||||
showStatement = true,
|
||||
statement = DefaultPdfTemplateStatement,
|
||||
|
||||
@@ -16,6 +16,7 @@ import {
|
||||
DefaultPdfTemplateAddressBilledTo,
|
||||
DefaultPdfTemplateAddressBilledFrom,
|
||||
} from './_constants';
|
||||
import { theme } from '../constants';
|
||||
|
||||
export interface ReceiptPaperTemplateProps extends PaperTemplateProps {
|
||||
// # Company logo
|
||||
@@ -216,8 +217,7 @@ export function ReceiptPaperTemplate({
|
||||
<Text>{data.item}</Text>
|
||||
<Text
|
||||
fontSize={'12px'}
|
||||
// className={Classes.TEXT_MUTED}
|
||||
// style={{ fontSize: 12 }}
|
||||
color={theme.colors['cool-gray-500']}
|
||||
>
|
||||
{data.description}
|
||||
</Text>
|
||||
@@ -255,7 +255,7 @@ export function ReceiptPaperTemplate({
|
||||
<PaperTemplate.TotalLine
|
||||
label={totalLabel}
|
||||
amount={total}
|
||||
border={PaperTemplateTotalBorder.Gray}
|
||||
border={PaperTemplateTotalBorder.Dark}
|
||||
style={{ fontWeight: 500 }}
|
||||
/>
|
||||
)}
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
import { defaultTheme } from "@xstyled/system";
|
||||
|
||||
export const OpenSansFontLink = `
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,300..800;1,300..800&family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap" rel="stylesheet">
|
||||
`;
|
||||
|
||||
export const theme = {
|
||||
...defaultTheme,
|
||||
}
|
||||
Reference in New Issue
Block a user