@silexpert/core 1.0.5 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/api/resources/AccountingFiles.d.ts +1 -0
- package/es/api/resources/AccountingFiles.d.ts.map +1 -1
- package/es/api/resources/AccountingFiles.js +3 -0
- package/es/api/resources/AccountingFiles.js.map +1 -1
- package/es/api/resources/Invoice.d.ts +3 -1
- package/es/api/resources/Invoice.d.ts.map +1 -1
- package/es/api/resources/Invoice.js +6 -0
- package/es/api/resources/Invoice.js.map +1 -1
- package/es/api/resources/commercialDocument.d.ts +1 -4
- package/es/api/resources/commercialDocument.d.ts.map +1 -1
- package/es/api/resources/commercialDocument.js +0 -6
- package/es/api/resources/commercialDocument.js.map +1 -1
- package/es/types/Enum/CommercialManagement.d.ts +10 -0
- package/es/types/Enum/CommercialManagement.d.ts.map +1 -1
- package/es/types/Enum/CommercialManagement.js +25 -0
- package/es/types/Enum/CommercialManagement.js.map +1 -1
- package/es/types/Enum/Vat.js +1 -1
- package/es/types/Enum/Vat.js.map +1 -1
- package/es/types/Interface/api/commercialManagement/Create.d.ts +2 -0
- package/es/types/Interface/api/commercialManagement/Create.d.ts.map +1 -1
- package/es/types/Interface/api/commercialManagement/Create.js.map +1 -1
- package/es/types/Interface/api/commercialManagement/Query.d.ts +2 -2
- package/es/types/Interface/api/commercialManagement/Query.d.ts.map +1 -1
- package/es/types/Interface/api/commercialManagement/Query.js +1 -1
- package/es/types/Interface/api/commercialManagement/Query.js.map +1 -1
- package/es/types/Interface/api/commercialManagement/Read.d.ts +3 -0
- package/es/types/Interface/api/commercialManagement/Read.d.ts.map +1 -1
- package/es/types/Interface/api/commercialManagement/Read.js.map +1 -1
- package/es/types/Interface/api/generalLedger/QueryGeneralLedgerAuxiliary.d.ts +1 -0
- package/es/types/Interface/api/generalLedger/QueryGeneralLedgerAuxiliary.d.ts.map +1 -1
- package/es/types/Interface/api/generalLedger/QueryGeneralLedgerAuxiliary.js +7 -1
- package/es/types/Interface/api/generalLedger/QueryGeneralLedgerAuxiliary.js.map +1 -1
- package/es/types/Interface/api/product/CreateProduct.d.ts +2 -1
- package/es/types/Interface/api/product/CreateProduct.d.ts.map +1 -1
- package/es/types/Interface/api/product/CreateProduct.js +7 -1
- package/es/types/Interface/api/product/CreateProduct.js.map +1 -1
- package/es/types/Interface/api/thirdParty/QueryThirdParty.d.ts +1 -0
- package/es/types/Interface/api/thirdParty/QueryThirdParty.d.ts.map +1 -1
- package/es/types/Interface/api/thirdParty/QueryThirdParty.js +7 -1
- package/es/types/Interface/api/thirdParty/QueryThirdParty.js.map +1 -1
- package/es/types/Interface/models/IAccountingTransaction.d.ts +1 -1
- package/es/types/Interface/models/IAccountingTransaction.d.ts.map +1 -1
- package/es/types/Interface/models/IAccountingTransaction.js.map +1 -1
- package/es/types/Interface/models/IApiError.d.ts +1 -0
- package/es/types/Interface/models/IApiError.d.ts.map +1 -1
- package/es/types/Interface/models/IApiError.js +1 -0
- package/es/types/Interface/models/IApiError.js.map +1 -1
- package/es/types/Interface/models/ICommercialMail.d.ts +1 -3
- package/es/types/Interface/models/ICommercialMail.d.ts.map +1 -1
- package/es/types/Interface/models/ICommercialMail.js.map +1 -1
- package/es/types/Interface/models/IEngagementBankTransaction.d.ts +0 -2
- package/es/types/Interface/models/IEngagementBankTransaction.d.ts.map +1 -1
- package/es/types/Interface/models/IEngagementBankTransaction.js.map +1 -1
- package/es/types/Interface/models/IFile.d.ts +2 -0
- package/es/types/Interface/models/IFile.d.ts.map +1 -1
- package/es/types/Interface/models/IFile.js.map +1 -1
- package/es/types/Interface/models/ILoan.d.ts +2 -0
- package/es/types/Interface/models/ILoan.d.ts.map +1 -1
- package/es/types/Interface/models/ILoan.js.map +1 -1
- package/es/types/Interface/models/IPartnerTransaction.d.ts +0 -1
- package/es/types/Interface/models/IPartnerTransaction.d.ts.map +1 -1
- package/es/types/Interface/models/IPartnerTransaction.js.map +1 -1
- package/es/types/Interface/models/IProduct.d.ts +4 -2
- package/es/types/Interface/models/IProduct.d.ts.map +1 -1
- package/es/types/Interface/models/IProduct.js.map +1 -1
- package/es/types/Interface/models/IProductInvoice.d.ts +2 -0
- package/es/types/Interface/models/IProductInvoice.d.ts.map +1 -1
- package/es/types/Interface/models/IProductInvoice.js.map +1 -1
- package/es/utils/commercialManagement/document.d.ts.map +1 -1
- package/es/utils/commercialManagement/document.js +12 -8
- package/es/utils/commercialManagement/document.js.map +1 -1
- package/es/utils/commercialManagement/product.d.ts.map +1 -1
- package/es/utils/commercialManagement/product.js +3 -3
- package/es/utils/commercialManagement/product.js.map +1 -1
- package/es/utils/commercialManagement/templates/body.js +1 -1
- package/es/utils/commercialManagement/templates/body.js.map +1 -1
- package/es/utils/commercialManagement/templates/common.js +1 -1
- package/es/utils/commercialManagement/templates/common.js.map +1 -1
- package/es/utils/commercialManagement/vat.d.ts.map +1 -1
- package/es/utils/commercialManagement/vat.js +1 -0
- package/es/utils/commercialManagement/vat.js.map +1 -1
- package/js/api/resources/AccountingFiles.js +4 -0
- package/js/api/resources/AccountingFiles.js.map +1 -1
- package/js/api/resources/Invoice.js +8 -0
- package/js/api/resources/Invoice.js.map +1 -1
- package/js/api/resources/commercialDocument.js +0 -8
- package/js/api/resources/commercialDocument.js.map +1 -1
- package/js/types/Enum/CommercialManagement.js +23 -0
- package/js/types/Enum/CommercialManagement.js.map +1 -1
- package/js/types/Enum/Vat.js +1 -1
- package/js/types/Enum/Vat.js.map +1 -1
- package/js/types/Interface/api/commercialManagement/Create.js.map +1 -1
- package/js/types/Interface/api/commercialManagement/Query.js.map +1 -1
- package/js/types/Interface/api/generalLedger/QueryGeneralLedgerAuxiliary.js +2 -0
- package/js/types/Interface/api/generalLedger/QueryGeneralLedgerAuxiliary.js.map +1 -1
- package/js/types/Interface/api/product/CreateProduct.js +3 -1
- package/js/types/Interface/api/product/CreateProduct.js.map +1 -1
- package/js/types/Interface/api/thirdParty/QueryThirdParty.js +2 -0
- package/js/types/Interface/api/thirdParty/QueryThirdParty.js.map +1 -1
- package/js/types/Interface/models/IApiError.js +1 -0
- package/js/types/Interface/models/IApiError.js.map +1 -1
- package/js/utils/commercialManagement/document.js +16 -7
- package/js/utils/commercialManagement/document.js.map +1 -1
- package/js/utils/commercialManagement/product.js +3 -2
- package/js/utils/commercialManagement/product.js.map +1 -1
- package/js/utils/commercialManagement/templates/body.js +1 -1
- package/js/utils/commercialManagement/templates/body.js.map +1 -1
- package/js/utils/commercialManagement/templates/common.js +1 -1
- package/js/utils/commercialManagement/templates/common.js.map +1 -1
- package/js/utils/commercialManagement/vat.js +1 -0
- package/js/utils/commercialManagement/vat.js.map +1 -1
- package/package.json +1 -1
- package/ts/api/resources/AccountingFiles.ts +4 -0
- package/ts/api/resources/Invoice.ts +10 -0
- package/ts/api/resources/commercialDocument.ts +0 -10
- package/ts/types/Enum/CommercialManagement.ts +27 -1
- package/ts/types/Enum/Vat.ts +1 -1
- package/ts/types/Interface/api/commercialManagement/Create.ts +2 -0
- package/ts/types/Interface/api/commercialManagement/Query.ts +2 -2
- package/ts/types/Interface/api/commercialManagement/Read.ts +3 -0
- package/ts/types/Interface/api/generalLedger/QueryGeneralLedgerAuxiliary.ts +6 -1
- package/ts/types/Interface/api/product/CreateProduct.ts +6 -1
- package/ts/types/Interface/api/thirdParty/QueryThirdParty.ts +8 -1
- package/ts/types/Interface/models/IAccountingTransaction.ts +1 -1
- package/ts/types/Interface/models/IApiError.ts +1 -0
- package/ts/types/Interface/models/ICommercialMail.ts +1 -5
- package/ts/types/Interface/models/IEngagementBankTransaction.ts +0 -2
- package/ts/types/Interface/models/IFile.ts +2 -0
- package/ts/types/Interface/models/ILoan.ts +2 -0
- package/ts/types/Interface/models/IPartnerTransaction.ts +0 -1
- package/ts/types/Interface/models/IProduct.ts +4 -2
- package/ts/types/Interface/models/IProductInvoice.ts +2 -0
- package/ts/utils/commercialManagement/document.ts +10 -4
- package/ts/utils/commercialManagement/product.ts +2 -1
- package/ts/utils/commercialManagement/templates/body.ts +1 -1
- package/ts/utils/commercialManagement/templates/common.ts +1 -1
- package/ts/utils/commercialManagement/vat.ts +1 -0
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
import { Order } from 'sequelize/types';
|
|
5
5
|
import { ApiProperty, ApiPropertyOptional } from '../../../../utils';
|
|
6
6
|
import { ToBoolean } from '../../../../utils/transforms/boolean.transform';
|
|
7
|
-
import { DiscountType, InvoiceStatus } from '../../../Enum/CommercialManagement';
|
|
7
|
+
import { DiscountType, EstimateStatus, InvoiceStatus } from '../../../Enum/CommercialManagement';
|
|
8
8
|
import { EstimateInvoiceType } from '../../../Enum/EstimateInvoice';
|
|
9
9
|
import { QueryPaginate } from '../BasePaginate';
|
|
10
10
|
|
|
@@ -90,7 +90,7 @@ export class QueryDocumentPaginated {
|
|
|
90
90
|
@ApiPropertyOptional()
|
|
91
91
|
@IsOptional()
|
|
92
92
|
@IsString()
|
|
93
|
-
status?:
|
|
93
|
+
status?: EstimateStatus;
|
|
94
94
|
|
|
95
95
|
@ApiPropertyOptional()
|
|
96
96
|
@IsOptional()
|
|
@@ -19,9 +19,11 @@ export type ReadProductEditing = IProductInvoice & {
|
|
|
19
19
|
discountTypeFormatted: string | null;
|
|
20
20
|
priceTaxExcludedFormatted: string | null;
|
|
21
21
|
totalTaxExcludedFormatted: string | null;
|
|
22
|
+
marginVatFormatted: string | null;
|
|
22
23
|
};
|
|
23
24
|
|
|
24
25
|
export type ReadVatEditing = {
|
|
26
|
+
id: number;
|
|
25
27
|
name: string;
|
|
26
28
|
amount: number;
|
|
27
29
|
value: number;
|
|
@@ -54,6 +56,7 @@ export type ReadDocumentEditing = CommercialDocumentInputs & {
|
|
|
54
56
|
},
|
|
55
57
|
shouldDisplayDiscountColumn: boolean;
|
|
56
58
|
paymentLink?: string;
|
|
59
|
+
marginVats: string[];
|
|
57
60
|
};
|
|
58
61
|
|
|
59
62
|
export type ReadCommercialDocumentTemplate = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
-
IsBoolean, IsEnum, IsInt, IsOptional, IsString, Min,
|
|
2
|
+
IsBoolean, IsEnum, IsInt, IsOptional, IsString, Min, IsNumber,
|
|
3
3
|
} from 'class-validator';
|
|
4
4
|
import { ApiProperty, ApiPropertyOptional } from '../../../../utils';
|
|
5
5
|
import { ToBoolean } from '../../../../utils/transforms/boolean.transform';
|
|
@@ -45,4 +45,9 @@ export class QueryGeneralLedgerAuxiliary {
|
|
|
45
45
|
@IsString()
|
|
46
46
|
@IsOptional()
|
|
47
47
|
search?: string;
|
|
48
|
+
|
|
49
|
+
@ApiPropertyOptional()
|
|
50
|
+
@IsNumber()
|
|
51
|
+
@IsOptional()
|
|
52
|
+
idThirdParty?: number;
|
|
48
53
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
IsEnum, IsNumber, IsOptional, IsString,
|
|
3
|
+
} from 'class-validator';
|
|
2
4
|
import { ThirdPartyType } from '../../..';
|
|
3
5
|
import { ApiPropertyOptional } from '../../../..';
|
|
4
6
|
|
|
@@ -12,4 +14,9 @@ export class QueryThirdParty {
|
|
|
12
14
|
@IsOptional()
|
|
13
15
|
@IsEnum(ThirdPartyType)
|
|
14
16
|
type?: number;
|
|
17
|
+
|
|
18
|
+
@ApiPropertyOptional()
|
|
19
|
+
@IsOptional()
|
|
20
|
+
@IsNumber()
|
|
21
|
+
idThirdParty?: number;
|
|
15
22
|
}
|
|
@@ -10,7 +10,7 @@ import { IFile } from './IFile';
|
|
|
10
10
|
import { IComptaType } from './IComptaType';
|
|
11
11
|
import { IPartnerTransaction } from './IPartnerTransaction';
|
|
12
12
|
import { ICurrency } from './ICurrency';
|
|
13
|
-
import { IMachineLearningResult } from '
|
|
13
|
+
import { IMachineLearningResult } from './IMachineLearningResult';
|
|
14
14
|
|
|
15
15
|
// accountingTransactions
|
|
16
16
|
export interface IAccountingTransaction {
|
|
@@ -24,6 +24,7 @@ export enum Code {
|
|
|
24
24
|
failedCheckBalance = 'failed_check_balance',
|
|
25
25
|
vatIntracomCanOnlyBeSetForDebit = 'vat_intracom_can_only_be_set_for_debit',
|
|
26
26
|
vatMargeCanOnlyBeSetForCredit = 'vat_marge_can_only_be_set_for_credit',
|
|
27
|
+
vatMargeWithAssetCanOnlyBeSetForDebit = 'vat_marge_with_asset_can_only_be_set_for_debit',
|
|
27
28
|
vatMargeCanOnlyBeSetIfAmountAllTaxIncludedPurchaseIsSet = 'vat_marge_can_only_be_set_if_amount_all_tax_included_purchase_is_set',
|
|
28
29
|
missingParamSplit = 'missing_param_split',
|
|
29
30
|
totalAmountSplitNotEqualTransaction = 'total_amount_split_not_equal_transaction',
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { IEstimateInvoice } from '../..';
|
|
2
|
-
|
|
3
1
|
export interface ICommercialMail {
|
|
4
2
|
id?: number;
|
|
5
3
|
to: string;
|
|
@@ -7,9 +5,7 @@ export interface ICommercialMail {
|
|
|
7
5
|
bcc?: string | null;
|
|
8
6
|
subject: string;
|
|
9
7
|
content: string;
|
|
8
|
+
idFile: number;
|
|
10
9
|
createdAt?: Date;
|
|
11
10
|
updatedAt?: Date;
|
|
12
|
-
idEstimateInvoice: number;
|
|
13
|
-
|
|
14
|
-
estimateInvoice?: IEstimateInvoice;
|
|
15
11
|
}
|
|
@@ -3,7 +3,6 @@ import { IEngagementAccountingEntry } from './IEngagementAccountingEntry';
|
|
|
3
3
|
import { IAccountingJournal } from './IAccountingJournal';
|
|
4
4
|
import { IUser } from './IUser';
|
|
5
5
|
import { ILettering } from './ILettering';
|
|
6
|
-
import { IPartnerTransaction } from './IPartnerTransaction';
|
|
7
6
|
|
|
8
7
|
// engagementBankTransactions
|
|
9
8
|
export interface IEngagementBankTransaction {
|
|
@@ -34,5 +33,4 @@ export interface IEngagementBankTransaction {
|
|
|
34
33
|
accountingJournal: IAccountingJournal;
|
|
35
34
|
user: IUser;
|
|
36
35
|
lettering: ILettering;
|
|
37
|
-
partnersTransaction: IPartnerTransaction;
|
|
38
36
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { IAttachmentFile } from './IAttachmentFile';
|
|
2
2
|
import { IFolderFile } from './IFolderFile';
|
|
3
3
|
import { IFileType } from './IFileType';
|
|
4
|
+
import { ICommercialMail } from '../..';
|
|
4
5
|
|
|
5
6
|
// files
|
|
6
7
|
export interface IFile {
|
|
@@ -17,4 +18,5 @@ export interface IFile {
|
|
|
17
18
|
attachmentFile?: IAttachmentFile;
|
|
18
19
|
folderFile?: IFolderFile;
|
|
19
20
|
fileType?: IFileType;
|
|
21
|
+
commercialMails?: ICommercialMail[]
|
|
20
22
|
}
|
|
@@ -20,6 +20,7 @@ export interface ILoan {
|
|
|
20
20
|
idAccountBenefit: number;
|
|
21
21
|
idAccountInsurance: number;
|
|
22
22
|
idAccountCommission: number;
|
|
23
|
+
idAccountReleaseLoanCapital: number;
|
|
23
24
|
createdAt?: Date | null;
|
|
24
25
|
updatedAt?: Date | null;
|
|
25
26
|
|
|
@@ -30,5 +31,6 @@ export interface ILoan {
|
|
|
30
31
|
accountBenefit?: IAccount;
|
|
31
32
|
accountInsurance?: IAccount;
|
|
32
33
|
accountCommission?: IAccount;
|
|
34
|
+
accountReleaseLoanCapital?: IAccount;
|
|
33
35
|
loanFiles?: ILoanFile[];
|
|
34
36
|
}
|
|
@@ -6,12 +6,14 @@ export interface IProduct {
|
|
|
6
6
|
id?: number;
|
|
7
7
|
name: string;
|
|
8
8
|
comment: string | null;
|
|
9
|
-
isFree
|
|
9
|
+
isFree?: boolean;
|
|
10
10
|
codeProduct: string | null;
|
|
11
11
|
priceTaxExcluded: number;
|
|
12
|
-
|
|
12
|
+
idVat: number;
|
|
13
13
|
unit: number | null;
|
|
14
14
|
type: number | null;
|
|
15
|
+
amountOfPurchase: number | null;
|
|
16
|
+
marginVatType?: number;
|
|
15
17
|
idSociety: number;
|
|
16
18
|
createdAt?: Date | null;
|
|
17
19
|
updatedAt?: Date | null;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import * as ejs from 'ejs';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
orderBy as _orderBy, groupBy as _groupBy, sumBy as _sumBy, uniq as _uniq,
|
|
4
|
+
} from 'lodash';
|
|
3
5
|
import * as dayjs from 'dayjs';
|
|
4
6
|
import { ReadCommercialDocumentTemplate, ReadDocumentEditing } from '../../types/Interface/api/commercialManagement/Read';
|
|
5
|
-
import { fontList } from '../../types/Enum/CommercialManagement';
|
|
7
|
+
import { fontList, VatMarginCategyList } from '../../types/Enum/CommercialManagement';
|
|
6
8
|
import { EstimateInvoiceType } from '../../types/Enum/EstimateInvoice';
|
|
9
|
+
import { Vat } from '../../types/Enum/Vat';
|
|
7
10
|
import { integerToFormattedAmountString } from '../amount';
|
|
8
11
|
import { CommercialDocumentCommonHTML } from './templates/common';
|
|
9
12
|
import { bodyTemplate } from './templates/body';
|
|
@@ -13,8 +16,7 @@ import { CreateInvoiceDocument, CreatePreSaleDocument } from '../../types';
|
|
|
13
16
|
|
|
14
17
|
export function generateCommercialDocument(idEstimateInvoiceType: EstimateInvoiceType, payload: CreateInvoiceDocument | CreatePreSaleDocument): ReadCommercialDocumentTemplate {
|
|
15
18
|
const products = _orderBy(payload.products.map((product) => productToReadProductEditing(product), 'reorder'));
|
|
16
|
-
|
|
17
|
-
const vats = _orderBy(Object.values(_groupBy(products, 'vatFormatted')).map((v) => (vatToReadVatEditing(v)), 'value'));
|
|
19
|
+
const vats = _orderBy(Object.values(_groupBy(products, 'vatFormatted')).map((v) => (vatToReadVatEditing(v)), 'value')).filter((v) => v.id !== Vat.MARGE.id);
|
|
18
20
|
|
|
19
21
|
const data: ReadDocumentEditing = {
|
|
20
22
|
...payload,
|
|
@@ -41,6 +43,8 @@ export function generateCommercialDocument(idEstimateInvoiceType: EstimateInvoic
|
|
|
41
43
|
expirationDateFormatted: payload.expirationDate ? dayjs(payload.expirationDate).format('DD/MM/YYYY') : null,
|
|
42
44
|
emissionDateFormatted: payload.emissionDate ? dayjs(payload.emissionDate).format('DD/MM/YYYY') : null,
|
|
43
45
|
shouldDisplayDiscountColumn: !!products.find((p) => p.discount2 && p.discount2 > 0),
|
|
46
|
+
// @ts-ignore
|
|
47
|
+
marginVats: _uniq(products.filter((p) => p.marginVatFormatted !== null).map((p) => p.marginVatFormatted)),
|
|
44
48
|
};
|
|
45
49
|
|
|
46
50
|
const commonTemplate = new CommercialDocumentCommonHTML();
|
|
@@ -92,6 +96,8 @@ export function generateAdvanceDocument(payload: CreateInvoiceDocument): ReadCom
|
|
|
92
96
|
emissionDateFormatted: payload.emissionDate ? dayjs(payload.emissionDate).format('DD/MM/YYYY') : null,
|
|
93
97
|
shouldDisplayDiscountColumn: false,
|
|
94
98
|
disableVat: true,
|
|
99
|
+
// @ts-ignore
|
|
100
|
+
marginVats: _uniq((payload.assetMarginVatIds ?? []).map((m) => VatMarginCategyList.find((c) => c.id === m)?.label ?? null)),
|
|
95
101
|
};
|
|
96
102
|
|
|
97
103
|
const commonTemplate = new CommercialDocumentCommonHTML();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isDefined } from 'class-validator';
|
|
2
2
|
import { IProductInvoice, ReadProductEditing } from '../../types';
|
|
3
3
|
import { Unit } from '../../types/Enum/Unit';
|
|
4
|
-
import { DiscountType } from '../../types/Enum/CommercialManagement';
|
|
4
|
+
import { DiscountType, VatMarginCategyList } from '../../types/Enum/CommercialManagement';
|
|
5
5
|
import { getById } from './vat';
|
|
6
6
|
import { integerToFormattedAmountString } from '../amount';
|
|
7
7
|
|
|
@@ -32,5 +32,6 @@ export function productToReadProductEditing(payload: IProductInvoice): ReadProdu
|
|
|
32
32
|
totalTaxExcludedFormatted: isDefined(payload.priceTaxExcluded) ? integerToFormattedAmountString(getTotalTaxExcluded(payload)) : null,
|
|
33
33
|
discountFormatted: payload.discount2 && payload.discount2 > 0 ? integerToFormattedAmountString(getDiscount(payload)) : null,
|
|
34
34
|
discountTypeFormatted: payload.discount2 && payload.discount2 > 0 ? payload.discountType === DiscountType.PERCENT ? `${(payload.discount2 / 100).toFixed(2)}%` : `${integerToFormattedAmountString(payload.discount2)}€` : null,
|
|
35
|
+
marginVatFormatted: payload.marginVatType ? VatMarginCategyList.find((c) => c.id === payload.marginVatType)?.label ?? null : null,
|
|
35
36
|
};
|
|
36
37
|
}
|
|
@@ -89,7 +89,7 @@ export const bodyTemplate = `<html>
|
|
|
89
89
|
</div>
|
|
90
90
|
|
|
91
91
|
<% if ((settings && (settings.iban || settings.bic)) || isStripeAllowed) { %>
|
|
92
|
-
<div class="row mt-30 space-between">
|
|
92
|
+
<div class="row mt-30 space-between" style="page-break-inside: avoid !important;">
|
|
93
93
|
<div>
|
|
94
94
|
<% if (settings && (settings.iban || settings.bic)) { %>
|
|
95
95
|
<% if(settings.iban) { %>IBAN : <%= settings.iban %><br/><% } %>
|
|
@@ -10,7 +10,7 @@ export class CommercialDocumentCommonHTML {
|
|
|
10
10
|
|
|
11
11
|
footer = `<div style="font-size: 8px; color: #DADCDF; text-align: center; margin-left: 40px; margin-right: 40px; display: block; width: 100%">
|
|
12
12
|
<% if (freeText) { %><%- freeText %><br/><br/><% } %>
|
|
13
|
-
<% if(penalties || compensation || discount) {%><%= penalties ? 'Pénalités en cas de retard : ' + penalties : ''%><%= penalties && compensation ? '|' : ''%><%= compensation ? 'Indemnité forfaitaire en cas de retard :' + compensation : '' %><%= (compensation || penalties) && discount ? '| ' : '' %><%= discount %><% if(name || legalForm || capital || siren || rcs) {%><br/><br/><% } %><% }%>
|
|
13
|
+
<% if(marginVats.length > 0) {%>Régime TVA sur marge - <% marginVats.forEach(function(v, index) { %><%= v %> - <% }) } %> ART 297-A du CGI ou directive 2006-212 CE | <% if(penalties || compensation || discount) {%><%= penalties ? 'Pénalités en cas de retard : ' + penalties : ''%><%= penalties && compensation ? '|' : ''%><%= compensation ? 'Indemnité forfaitaire en cas de retard :' + compensation : '' %><%= (compensation || penalties) && discount ? '| ' : '' %><%= discount %><% if(name || legalForm || capital || siren || rcs) {%><br/><br/><% } %><% }%>
|
|
14
14
|
<%= name %><%= name && (legalForm || capital || siren || rcs) ? ',' : ''%><%= legalForm %><%= capital ? ' au capital de ' + capitalFormatted + ' €' : '' %><%= siren ? ' immatriculée sous le SIREN ' + siren : ''%><%= rcs ? 'RCS ' + rcs + vatCode || nafCode ? '|' : '' : ''%><% if (vatCode || nafCode) {%><br/><% } %><%= vatCode ? 'N° TVA '+vatCode : ''%><% if(vatCode && nafCode){%>|<%}%><%= nafCode ? 'APE '+nafCode : '' %>
|
|
15
15
|
</div>`;
|
|
16
16
|
|
|
@@ -15,6 +15,7 @@ export function getById(id: number): VatType | undefined {
|
|
|
15
15
|
export function vatToReadVatEditing(products: ReadProductEditing[]): ReadVatEditing {
|
|
16
16
|
const { idVat } = products[0];
|
|
17
17
|
return {
|
|
18
|
+
id: idVat,
|
|
18
19
|
name: getById(idVat)?.saleName ?? '',
|
|
19
20
|
amount: _sumBy(products, (p) => getAmount(p.totalTaxExcluded, getById(idVat)?.value ?? 0)),
|
|
20
21
|
value: getById(idVat)?.value ?? 0,
|