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