@silexpert/core 1.0.30 → 1.0.39
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/CommercialDocument.js +1 -1
- package/es/api/resources/CommercialDocument.js.map +1 -1
- package/es/api/resources/Dashboard.d.ts +2 -1
- package/es/api/resources/Dashboard.d.ts.map +1 -1
- package/es/api/resources/Dashboard.js +3 -0
- package/es/api/resources/Dashboard.js.map +1 -1
- package/es/api/resources/Qonto.js +1 -1
- package/es/api/resources/Qonto.js.map +1 -1
- package/es/types/Enum/CommercialManagement.d.ts +1 -1
- package/es/types/Enum/CommercialManagement.d.ts.map +1 -1
- package/es/types/Enum/CommercialManagement.js +1 -1
- package/es/types/Enum/CommercialManagement.js.map +1 -1
- package/es/types/Enum/CustomerVat.d.ts +24 -0
- package/es/types/Enum/CustomerVat.d.ts.map +1 -0
- package/es/types/Enum/CustomerVat.js +26 -0
- package/es/types/Enum/CustomerVat.js.map +1 -0
- package/es/types/Enum/RecurrenceType.d.ts +1 -1
- package/es/types/Enum/RecurrenceType.d.ts.map +1 -1
- package/es/types/Enum/RecurrenceType.js +2 -2
- package/es/types/Enum/RecurrenceType.js.map +1 -1
- package/es/types/Interface/api/3cx/Query3cxSearch.d.ts +1 -0
- package/es/types/Interface/api/3cx/Query3cxSearch.d.ts.map +1 -1
- package/es/types/Interface/api/3cx/Query3cxSearch.js +6 -0
- package/es/types/Interface/api/3cx/Query3cxSearch.js.map +1 -1
- package/es/types/Interface/api/commercialManagement/Create.d.ts +6 -6
- 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 +4 -2
- package/es/types/Interface/api/commercialManagement/Query.d.ts.map +1 -1
- package/es/types/Interface/api/commercialManagement/Query.js +10 -3
- package/es/types/Interface/api/commercialManagement/Query.js.map +1 -1
- package/es/types/Interface/api/dashboard/QueryVatDisbursed.d.ts +5 -0
- package/es/types/Interface/api/dashboard/QueryVatDisbursed.d.ts.map +1 -0
- package/es/types/Interface/api/dashboard/QueryVatDisbursed.js +24 -0
- package/es/types/Interface/api/dashboard/QueryVatDisbursed.js.map +1 -0
- package/es/types/Interface/api/dashboard/ReadVatDisbursed.d.ts +13 -0
- package/es/types/Interface/api/dashboard/ReadVatDisbursed.d.ts.map +1 -0
- package/es/types/Interface/api/dashboard/ReadVatDisbursed.js +2 -0
- package/es/types/Interface/api/dashboard/ReadVatDisbursed.js.map +1 -0
- package/es/types/Interface/api/mail/QueryPaginatedMail.d.ts +1 -0
- package/es/types/Interface/api/mail/QueryPaginatedMail.d.ts.map +1 -1
- package/es/types/Interface/api/mail/QueryPaginatedMail.js +6 -0
- package/es/types/Interface/api/mail/QueryPaginatedMail.js.map +1 -1
- package/es/types/Interface/api/thirdParty/CreateThirdPartyForm.d.ts +3 -3
- package/es/types/Interface/api/thirdParty/CreateThirdPartyForm.d.ts.map +1 -1
- package/es/types/Interface/api/thirdParty/CreateThirdPartyForm.js +1 -3
- package/es/types/Interface/api/thirdParty/CreateThirdPartyForm.js.map +1 -1
- package/es/types/Interface/api/thirdParty/UpdateThirdPartyForm.d.ts +3 -3
- package/es/types/Interface/api/thirdParty/UpdateThirdPartyForm.d.ts.map +1 -1
- package/es/types/Interface/api/thirdParty/UpdateThirdPartyForm.js +1 -3
- package/es/types/Interface/api/thirdParty/UpdateThirdPartyForm.js.map +1 -1
- package/es/types/Interface/models/IEstimateInvoice.d.ts +1 -1
- package/es/types/Interface/models/IEstimateInvoice.d.ts.map +1 -1
- package/es/types/Interface/models/IEstimateInvoice.js.map +1 -1
- package/es/types/index.d.ts +3 -0
- package/es/types/index.d.ts.map +1 -1
- package/es/types/index.js +3 -0
- package/es/types/index.js.map +1 -1
- package/es/utils/commercialManagement/document.d.ts.map +1 -1
- package/es/utils/commercialManagement/document.js +6 -14
- package/es/utils/commercialManagement/document.js.map +1 -1
- package/es/utils/commercialManagement/product.js +2 -2
- package/es/utils/commercialManagement/product.js.map +1 -1
- package/es/utils/commercialManagement/recurrence.js +1 -1
- package/es/utils/commercialManagement/recurrence.js.map +1 -1
- package/js/api/resources/CommercialDocument.js +1 -1
- package/js/api/resources/CommercialDocument.js.map +1 -1
- package/js/api/resources/Dashboard.js +6 -0
- package/js/api/resources/Dashboard.js.map +1 -1
- package/js/api/resources/Qonto.js +1 -1
- package/js/api/resources/Qonto.js.map +1 -1
- package/js/types/Enum/CommercialManagement.js +1 -1
- package/js/types/Enum/CommercialManagement.js.map +1 -1
- package/js/types/Enum/CustomerVat.js +34 -0
- package/js/types/Enum/CustomerVat.js.map +1 -0
- package/js/types/Enum/RecurrenceType.js +2 -2
- package/js/types/Enum/RecurrenceType.js.map +1 -1
- package/js/types/Interface/api/3cx/Query3cxSearch.js +2 -0
- package/js/types/Interface/api/3cx/Query3cxSearch.js.map +1 -1
- package/js/types/Interface/api/commercialManagement/Create.js.map +1 -1
- package/js/types/Interface/api/commercialManagement/Query.js +6 -4
- package/js/types/Interface/api/commercialManagement/Query.js.map +1 -1
- package/js/types/Interface/api/dashboard/QueryVatDisbursed.js +31 -0
- package/js/types/Interface/api/dashboard/QueryVatDisbursed.js.map +1 -0
- package/js/types/Interface/api/dashboard/ReadVatDisbursed.js +6 -0
- package/js/types/Interface/api/dashboard/ReadVatDisbursed.js.map +1 -0
- package/js/types/Interface/api/mail/QueryPaginatedMail.js +2 -0
- package/js/types/Interface/api/mail/QueryPaginatedMail.js.map +1 -1
- package/js/types/Interface/api/thirdParty/CreateThirdPartyForm.js +2 -2
- package/js/types/Interface/api/thirdParty/CreateThirdPartyForm.js.map +1 -1
- package/js/types/Interface/api/thirdParty/UpdateThirdPartyForm.js +2 -2
- package/js/types/Interface/api/thirdParty/UpdateThirdPartyForm.js.map +1 -1
- package/js/types/index.js +36 -0
- package/js/types/index.js.map +1 -1
- package/js/utils/commercialManagement/document.js +13 -21
- package/js/utils/commercialManagement/document.js.map +1 -1
- package/js/utils/commercialManagement/product.js +2 -2
- package/js/utils/commercialManagement/product.js.map +1 -1
- package/js/utils/commercialManagement/recurrence.js +1 -1
- package/js/utils/commercialManagement/recurrence.js.map +1 -1
- package/package.json +1 -1
- package/ts/api/resources/CommercialDocument.ts +1 -1
- package/ts/api/resources/Dashboard.ts +6 -0
- package/ts/api/resources/Qonto.ts +1 -1
- package/ts/types/Enum/CommercialManagement.ts +1 -1
- package/ts/types/Enum/CustomerVat.ts +24 -0
- package/ts/types/Enum/RecurrenceType.ts +2 -2
- package/ts/types/Interface/api/3cx/Query3cxSearch.ts +5 -0
- package/ts/types/Interface/api/commercialManagement/Create.ts +17 -17
- package/ts/types/Interface/api/commercialManagement/Query.ts +12 -5
- package/ts/types/Interface/api/dashboard/QueryVatDisbursed.ts +12 -0
- package/ts/types/Interface/api/dashboard/ReadVatDisbursed.ts +14 -0
- package/ts/types/Interface/api/mail/QueryPaginatedMail.ts +5 -0
- package/ts/types/Interface/api/thirdParty/CreateThirdPartyForm.ts +4 -6
- package/ts/types/Interface/api/thirdParty/UpdateThirdPartyForm.ts +4 -6
- package/ts/types/Interface/models/IEstimateInvoice.ts +1 -1
- package/ts/types/index.ts +3 -0
- package/ts/utils/commercialManagement/document.ts +5 -14
- package/ts/utils/commercialManagement/product.ts +1 -1
- package/ts/utils/commercialManagement/recurrence.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"document.js","mappings":";;;;;QAiBgBA,0B,GAAAA,0B;QAsDAC,uB,GAAAA,uB;;AAvEhB;;AAGA;;IAAYC,K;;AAEZ;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AAGA,MAAMC,GAAG,GAAGC,OAAO,CAAC,KAAD,CAAnB;;AAEM,SAAUJ,0BAAV,CAAqCK,qBAArC,EAAiFC,OAAjF,EAAuI;;;EAC3I,MAAMC,QAAQ,GAAG,qBAASD,OAAO,CAACC,QAAR,CAAiBC,GAAjB,CAAsBC,OAAD,IAA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,GAAO,MAAP,UAAO,CAAEzE,QAAT,MAAiB,IAAjB,IAAiB6B,aAAjB,GAAiB,MAAjB,GAAiBA,GAAEsC,eAAnB,MAAkC,IAAlC,IAAkCb,aAAlC,GAAkCA,EAAlC,GAAsC;IAAlD,CAAX,CAAjC,CAHH;IAIL1D;EAJK,CAAP;AAMD","names":["generateCommercialDocument","generateAdvanceDocument","dayjs","ejs","require","idEstimateInvoiceType","payload","products","map","product","vats","Object","values","v","filter","id","Vat","MARGE","data","paymentLink","_a","phoneContact","settings","_b","_c","totalTaxExcluded","totalTaxIncluded","totalTaxAndDiscountIncluded","generalDiscount2","_d","generalDiscountFormatted","depositFormatted","deposit","totalTaxExcludedFormatted","totalTaxIncludedFormatted","_e","totalTaxAndDiscountIncludedFormatted","_f","_g","totalVatAmountFormatted","font","name","find","f","idFont","_h","_j","fontList","url","_k","link","_l","capitalFormatted","capital","split","reduceRight","acc","char","i","length","trim","dueDateFormatted","dueDate","format","expirationDateFormatted","expirationDate","emissionDateFormatted","emissionDate","shouldDisplayDiscountColumn","p","discount2","marginVats","marginVatFormatted","accountingCategoryFormatted","a","accountingCategory","_m","label","_o","commonTemplate","CommercialDocumentCommonHTML","documentFreeText","EstimateInvoiceType","DEVIS","BON","includes","_p","freeEstimateText","_q","freeInvoiceText","header","render","body","bodyTemplate","footer","freeText","Error","ACOMPTE","disableVat","assetMarginVatIds","m","c"],"sourceRoot":"","sources":["../../../ts/utils/commercialManagement/document.ts"],"sourcesContent":["import {\n orderBy as _orderBy, groupBy as _groupBy, sumBy as _sumBy, uniq as _uniq,\n} from 'lodash';\nimport * as dayjs from 'dayjs';\nimport { ReadCommercialDocumentTemplate, ReadDocumentEditing } from '../../types/Interface/api/commercialManagement/Read';\nimport { AccountingCategoryList, fontList, VatMarginCategyList } from '../../types/Enum/CommercialManagement';\nimport { EstimateInvoiceType } from '../../types/Enum/EstimateInvoice';\nimport { Vat } from '../../types/Enum/Vat';\nimport { integerToFormattedAmountString } from '../amount';\nimport { CommercialDocumentCommonHTML } from './templates/common';\nimport { bodyTemplate } from './templates/body';\nimport { productToReadProductEditing } from './product';\nimport { vatToReadVatEditing } from './vat';\nimport { CreateInvoiceDocument, CreatePreSaleDocument } from '../../types';\n\nconst ejs = require('ejs');\n\nexport function generateCommercialDocument(idEstimateInvoiceType: EstimateInvoiceType, payload: CreateInvoiceDocument | CreatePreSaleDocument): ReadCommercialDocumentTemplate {\n const products = _orderBy(payload.products.map((product) => productToReadProductEditing(product), 'reorder'));\n const vats = _orderBy(Object.values(_groupBy(products, 'vatFormatted')).map((v) => (vatToReadVatEditing(v)), 'value')).filter((v) => v.id !== Vat.MARGE.id);\n\n const data: ReadDocumentEditing = {\n ...payload,\n paymentLink: payload.paymentLink ?? '#',\n idEstimateInvoiceType,\n phoneContact: payload.settings?.phoneContact ?? null,\n products,\n vats,\n totalTaxExcluded: _sumBy(products, 'totalTaxExcluded'),\n totalTaxIncluded: _sumBy(products, 'totalTaxExcluded') + _sumBy(vats, 'amount'),\n totalTaxAndDiscountIncluded: _sumBy(products, 'totalTaxExcluded') + _sumBy(vats, 'amount') - (payload.generalDiscount2 ?? 0),\n generalDiscountFormatted: payload.generalDiscount2 ? integerToFormattedAmountString(payload.generalDiscount2) : null,\n depositFormatted: payload.deposit ? integerToFormattedAmountString(payload.deposit) : null,\n totalTaxExcludedFormatted: integerToFormattedAmountString(_sumBy(products, 'totalTaxExcluded')),\n totalTaxIncludedFormatted: integerToFormattedAmountString(_sumBy(products, 'totalTaxExcluded') + _sumBy(vats, 'amount') - (payload.deposit ?? 0)),\n totalTaxAndDiscountIncludedFormatted: integerToFormattedAmountString(_sumBy(products, 'totalTaxExcluded') + _sumBy(vats, 'amount') - (payload.generalDiscount2 ?? 0) - (payload.deposit ?? 0)),\n totalVatAmountFormatted: integerToFormattedAmountString(_sumBy(vats, 'amount')),\n font: {\n name: fontList.find((f) => f.id === payload.settings?.idFont)?.name ?? fontList[0].name,\n url: fontList.find((f) => f.id === payload.settings?.idFont)?.link ?? fontList[0].link,\n },\n capitalFormatted: payload.capital ? `${payload.capital}`.split('').reduceRight((acc, char, i, { length }) => `${char}${(length - (i + 1)) % 3 === 0 ? ' ' : ''}${acc}`, '').trim() : null,\n dueDateFormatted: payload.dueDate ? dayjs(payload.dueDate).format('DD/MM/YYYY') : null,\n expirationDateFormatted: payload.expirationDate ? dayjs(payload.expirationDate).format('DD/MM/YYYY') : null,\n emissionDateFormatted: payload.emissionDate ? dayjs(payload.emissionDate).format('DD/MM/YYYY') : null,\n shouldDisplayDiscountColumn: !!products.find((p) => p.discount2 && p.discount2 > 0),\n // @ts-ignore\n marginVats: _uniq(products.filter((p) => p.marginVatFormatted !== null).map((p) => p.marginVatFormatted)),\n accountingCategoryFormatted: AccountingCategoryList.find((a) => a.id === payload.accountingCategory)?.label ?? null,\n };\n\n const commonTemplate = new CommercialDocumentCommonHTML();\n\n let documentFreeText: string | null | undefined;\n\n // A GERER EN FONCTION DU DOCUMENT\n if ([EstimateInvoiceType.DEVIS, EstimateInvoiceType.BON].includes(idEstimateInvoiceType)) {\n documentFreeText = payload?.settings?.freeEstimateText;\n } else {\n documentFreeText = payload?.settings?.freeInvoiceText;\n }\n //\n\n return {\n header: ejs.render(commonTemplate.header, data),\n body: ejs.render(bodyTemplate, data),\n footer: ejs.render(commonTemplate.footer, { ...data, freeText: documentFreeText ?? null }),\n data,\n };\n}\n\nexport function generateAdvanceDocument(payload: CreateInvoiceDocument): ReadCommercialDocumentTemplate {\n if (!payload.deposit) throw new Error('Aucun acompte défini');\n\n const data: ReadDocumentEditing = {\n ...payload,\n paymentLink: payload.paymentLink ?? '#',\n idEstimateInvoiceType: EstimateInvoiceType.ACOMPTE,\n phoneContact: payload.settings?.phoneContact ?? null,\n products: [],\n vats: [],\n totalTaxExcluded: payload.deposit,\n totalTaxIncluded: payload.deposit,\n totalTaxAndDiscountIncluded: payload.deposit,\n generalDiscountFormatted: null,\n depositFormatted: integerToFormattedAmountString(payload.deposit),\n totalTaxExcludedFormatted: integerToFormattedAmountString(payload.deposit),\n totalTaxIncludedFormatted: integerToFormattedAmountString(payload.deposit),\n totalTaxAndDiscountIncludedFormatted: integerToFormattedAmountString(payload.deposit),\n totalVatAmountFormatted: integerToFormattedAmountString(0),\n font: {\n name: fontList.find((f) => f.id === payload.settings?.idFont)?.name ?? fontList[0].name,\n url: fontList.find((f) => f.id === payload.settings?.idFont)?.link ?? fontList[0].link,\n },\n capitalFormatted: payload.capital ? `${payload.capital}`.split('').reduceRight((acc, char, i, { length }) => `${char}${(length - (i + 1)) % 3 === 0 ? ' ' : ''}${acc}`, '').trim() : null,\n dueDateFormatted: payload.dueDate ? dayjs(payload.dueDate).format('DD/MM/YYYY') : null,\n expirationDateFormatted: payload.expirationDate ? dayjs(payload.expirationDate).format('DD/MM/YYYY') : null,\n emissionDateFormatted: payload.emissionDate ? dayjs(payload.emissionDate).format('DD/MM/YYYY') : null,\n shouldDisplayDiscountColumn: false,\n disableVat: true,\n // @ts-ignore\n marginVats: _uniq((payload.assetMarginVatIds ?? []).map((m) => VatMarginCategyList.find((c) => c.id === m)?.label ?? null)),\n accountingCategoryFormatted: AccountingCategoryList.find((a) => a.id === payload.accountingCategory)?.label ?? null,\n };\n\n const commonTemplate = new CommercialDocumentCommonHTML();\n\n return {\n header: ejs?.render(commonTemplate.header, data),\n body: ejs?.render(bodyTemplate, data),\n footer: ejs?.render(commonTemplate.footer, { ...data, freeText: payload?.settings?.freeInvoiceText ?? null }),\n data,\n };\n}"]}
|
|
1
|
+
{"version":3,"file":"document.js","mappings":";;;;;QAiBgBA,0B,GAAAA,0B;QA6CAC,uB,GAAAA,uB;;AA9DhB;;AAGA;;IAAYC,K;;AAEZ;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AAGA,MAAMC,GAAG,GAAGC,OAAO,CAAC,KAAD,CAAnB;;AAEM,SAAUJ,0BAAV,CAAqCK,qBAArC,EAAiFC,OAAjF,EAAuI;;;EAC3I,MAAMC,QAAQ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AAG,WAAH,GAAG,MAAH,MAAG,CAAE4F,MAAL,CAAYE,kBAAZ,EAA0B/E,IAA1B,CAFD;IAGLgF,MAAM,EAAE/F,GAAG,SAAH,OAAG,WAAH,GAAG,MAAH,MAAG,CAAE4F,MAAL,CAAYZ,cAAc,CAACe,MAA3B,EAAiCvF,gCAAOO,IAAP,GAAW;MAAEiF,QAAQ,EAAE,mBAAO,SAAP,WAAO,WAAP,GAAO,MAAP,UAAO,CAAE7E,QAAT,MAAiB,IAAjB,IAAiBoB,aAAjB,GAAiB,MAAjB,GAAiBA,GAAEmD,eAAnB,MAAkC,IAAlC,IAAkC5C,aAAlC,GAAkCA,EAAlC,GAAsC;IAAlD,CAAX,CAAjC,CAHH;IAIL/B;EAJK,CAAP;AAMD","names":["generateCommercialDocument","generateAdvanceDocument","dayjs","ejs","require","idEstimateInvoiceType","payload","products","map","product","vats","Object","values","v","filter","id","Vat","MARGE","data","paymentLink","_a","phoneContact","settings","_b","_c","totalTaxExcluded","deposit","_d","totalTaxIncluded","_e","totalTaxAndDiscountIncluded","generalDiscount2","_f","_g","generalDiscountFormatted","depositFormatted","totalTaxExcludedFormatted","_h","totalTaxIncludedFormatted","_j","totalTaxAndDiscountIncludedFormatted","_k","_l","totalVatAmountFormatted","font","name","find","f","idFont","_m","_o","fontList","url","_p","link","_q","capitalFormatted","capital","split","reduceRight","acc","char","i","length","trim","dueDateFormatted","dueDate","format","expirationDateFormatted","expirationDate","emissionDateFormatted","emissionDate","shouldDisplayDiscountColumn","p","discount2","marginVats","marginVatFormatted","accountingCategoryFormatted","a","accountingCategory","_r","label","_s","commonTemplate","CommercialDocumentCommonHTML","documentFreeText","EstimateInvoiceType","DEVIS","BON","includes","_t","freeEstimateText","_u","freeInvoiceText","header","render","body","bodyTemplate","footer","freeText","Error","ACOMPTE","disableVat","assetMarginVatIds","m","c"],"sourceRoot":"","sources":["../../../ts/utils/commercialManagement/document.ts"],"sourcesContent":["import {\n orderBy as _orderBy, groupBy as _groupBy, sumBy as _sumBy, uniq as _uniq,\n} from 'lodash';\nimport * as dayjs from 'dayjs';\nimport { ReadCommercialDocumentTemplate, ReadDocumentEditing } from '../../types/Interface/api/commercialManagement/Read';\nimport { AccountingCategoryList, fontList, VatMarginCategyList } from '../../types/Enum/CommercialManagement';\nimport { EstimateInvoiceType } from '../../types/Enum/EstimateInvoice';\nimport { Vat } from '../../types/Enum/Vat';\nimport { integerToFormattedAmountString } from '../amount';\nimport { CommercialDocumentCommonHTML } from './templates/common';\nimport { bodyTemplate } from './templates/body';\nimport { productToReadProductEditing } from './product';\nimport { vatToReadVatEditing } from './vat';\nimport { CreateInvoiceDocument, CreatePreSaleDocument } from '../../types';\n\nconst ejs = require('ejs');\n\nexport function generateCommercialDocument(idEstimateInvoiceType: EstimateInvoiceType, payload: CreateInvoiceDocument | CreatePreSaleDocument): ReadCommercialDocumentTemplate {\n const products = _orderBy(payload.products.map((product) => productToReadProductEditing(product), 'reorder'));\n const vats = _orderBy(Object.values(_groupBy(products, 'vatFormatted')).map((v) => (vatToReadVatEditing(v)), 'value')).filter((v) => v.id !== Vat.MARGE.id);\n\n const data: ReadDocumentEditing = {\n ...payload,\n paymentLink: payload.paymentLink ?? '#',\n idEstimateInvoiceType,\n phoneContact: payload.settings?.phoneContact ?? null,\n products,\n vats,\n totalTaxExcluded: _sumBy(products, 'totalTaxExcluded') - (payload.deposit ?? 0),\n totalTaxIncluded: _sumBy(products, 'totalTaxExcluded') + _sumBy(vats, 'amount') - (payload.deposit ?? 0),\n totalTaxAndDiscountIncluded: _sumBy(products, 'totalTaxExcluded') + _sumBy(vats, 'amount') - (payload.generalDiscount2 ?? 0) - (payload.deposit ?? 0),\n generalDiscountFormatted: payload.generalDiscount2 ? integerToFormattedAmountString(payload.generalDiscount2) : null,\n depositFormatted: payload.deposit ? integerToFormattedAmountString(payload.deposit) : null,\n totalTaxExcludedFormatted: integerToFormattedAmountString(_sumBy(products, 'totalTaxExcluded') - (payload.deposit ?? 0)),\n totalTaxIncludedFormatted: integerToFormattedAmountString(_sumBy(products, 'totalTaxExcluded') + _sumBy(vats, 'amount') - (payload.deposit ?? 0)),\n totalTaxAndDiscountIncludedFormatted: integerToFormattedAmountString(_sumBy(products, 'totalTaxExcluded') + _sumBy(vats, 'amount') - (payload.generalDiscount2 ?? 0) - (payload.deposit ?? 0)),\n totalVatAmountFormatted: integerToFormattedAmountString(_sumBy(vats, 'amount')),\n font: {\n name: fontList.find((f) => f.id === payload.settings?.idFont)?.name ?? fontList[0].name,\n url: fontList.find((f) => f.id === payload.settings?.idFont)?.link ?? fontList[0].link,\n },\n capitalFormatted: payload.capital ? `${payload.capital}`.split('').reduceRight((acc, char, i, { length }) => `${char}${(length - (i + 1)) % 3 === 0 ? ' ' : ''}${acc}`, '').trim() : null,\n dueDateFormatted: payload.dueDate ? dayjs(payload.dueDate).format('DD/MM/YYYY') : null,\n expirationDateFormatted: payload.expirationDate ? dayjs(payload.expirationDate).format('DD/MM/YYYY') : null,\n emissionDateFormatted: payload.emissionDate ? dayjs(payload.emissionDate).format('DD/MM/YYYY') : null,\n shouldDisplayDiscountColumn: !!products.find((p) => p.discount2 && p.discount2 > 0),\n // @ts-ignore\n marginVats: _uniq(products.filter((p) => p.marginVatFormatted !== null).map((p) => p.marginVatFormatted)),\n accountingCategoryFormatted: AccountingCategoryList.find((a) => a.id === payload.accountingCategory)?.label ?? null,\n };\n\n const commonTemplate = new CommercialDocumentCommonHTML();\n const documentFreeText = [EstimateInvoiceType.DEVIS, EstimateInvoiceType.BON].includes(idEstimateInvoiceType) ? payload?.settings?.freeEstimateText : payload?.settings?.freeInvoiceText;\n\n return {\n header: ejs.render(commonTemplate.header, data),\n body: ejs.render(bodyTemplate, data),\n footer: ejs.render(commonTemplate.footer, { ...data, freeText: documentFreeText ?? null }),\n data,\n };\n}\n\nexport function generateAdvanceDocument(payload: CreateInvoiceDocument): ReadCommercialDocumentTemplate {\n if (!payload.deposit) throw new Error('Aucun acompte défini');\n\n const data: ReadDocumentEditing = {\n ...payload,\n paymentLink: payload.paymentLink ?? '#',\n idEstimateInvoiceType: EstimateInvoiceType.ACOMPTE,\n phoneContact: payload.settings?.phoneContact ?? null,\n products: [],\n vats: [],\n totalTaxExcluded: payload.deposit,\n totalTaxIncluded: payload.deposit,\n totalTaxAndDiscountIncluded: payload.deposit,\n generalDiscountFormatted: null,\n depositFormatted: integerToFormattedAmountString(payload.deposit),\n totalTaxExcludedFormatted: integerToFormattedAmountString(payload.deposit),\n totalTaxIncludedFormatted: integerToFormattedAmountString(payload.deposit),\n totalTaxAndDiscountIncludedFormatted: integerToFormattedAmountString(payload.deposit),\n totalVatAmountFormatted: integerToFormattedAmountString(0),\n font: {\n name: fontList.find((f) => f.id === payload.settings?.idFont)?.name ?? fontList[0].name,\n url: fontList.find((f) => f.id === payload.settings?.idFont)?.link ?? fontList[0].link,\n },\n capitalFormatted: payload.capital ? `${payload.capital}`.split('').reduceRight((acc, char, i, { length }) => `${char}${(length - (i + 1)) % 3 === 0 ? ' ' : ''}${acc}`, '').trim() : null,\n dueDateFormatted: payload.dueDate ? dayjs(payload.dueDate).format('DD/MM/YYYY') : null,\n expirationDateFormatted: payload.expirationDate ? dayjs(payload.expirationDate).format('DD/MM/YYYY') : null,\n emissionDateFormatted: payload.emissionDate ? dayjs(payload.emissionDate).format('DD/MM/YYYY') : null,\n shouldDisplayDiscountColumn: false,\n disableVat: true,\n // @ts-ignore\n marginVats: _uniq((payload.assetMarginVatIds ?? []).map((m) => VatMarginCategyList.find((c) => c.id === m)?.label ?? null)),\n accountingCategoryFormatted: AccountingCategoryList.find((a) => a.id === payload.accountingCategory)?.label ?? null,\n };\n\n const commonTemplate = new CommercialDocumentCommonHTML();\n\n return {\n header: ejs?.render(commonTemplate.header, data),\n body: ejs?.render(bodyTemplate, data),\n footer: ejs?.render(commonTemplate.footer, { ...data, freeText: payload?.settings?.freeInvoiceText ?? null }),\n data,\n };\n}"]}
|
|
@@ -34,10 +34,10 @@ function getDiscount(product) {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
function getTotalTaxExcluded(product) {
|
|
37
|
-
var _a, _b
|
|
37
|
+
var _a, _b;
|
|
38
38
|
|
|
39
39
|
const discount = product.discount2 && product.discount2 > 0 ? getDiscount(product) : 0;
|
|
40
|
-
return ((_a = product.priceTaxExcluded) !== null && _a !== void 0 ? _a : 0)
|
|
40
|
+
return (((_a = product.priceTaxExcluded) !== null && _a !== void 0 ? _a : 0) - discount) * ((_b = product.quantity) !== null && _b !== void 0 ? _b : 1);
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
function productToReadProductEditing(payload) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"product.js","mappings":";;;;;QAOgBA,W,GAAAA,W;QAYAC,mB,GAAAA,mB;QAKAC,2B,GAAAA,2B;;AAxBhB;;AAEA;;AACA;;AACA;;AACA;;AAEM,SAAUF,WAAV,CAAsBG,OAAtB,EAA8C;;;EAClD,IAAIA,OAAO,CAACC,SAAR,KAAsB,IAAtB,IAA8BD,OAAO,CAACC,SAAR,KAAsBC,SAApD,IAAiEF,OAAO,CAACC,SAAR,IAAqB,CAA1F,EAA6F,OAAO,CAAP;;EAE7F,IAAID,OAAO,CAACG,YAAR,KAAyBC,mCAAaC,OAA1C,EAAmD;IACjD,OAAQ,CAAC,aAAO,CAACC,gBAAR,MAAwB,IAAxB,IAAwBC,aAAxB,GAAwBA,EAAxB,GAA4B,CAA7B,KAAmC,CAAC,aAAO,CAACN,SAAR,MAAiB,IAAjB,IAAiBO,aAAjB,GAAiBA,EAAjB,GAAqB,CAAtB,IAA2B,GAA9D,CAAD,GAAuE,GAA9E;EACD;;EAAC,IAAIR,OAAO,CAACG,YAAR,KAAyBC,mCAAaK,MAA1C,EAAkD;IAClD,OAAQ,aAAO,CAACR,SAAR,MAAiB,IAAjB,IAAiBS,aAAjB,GAAiBA,EAAjB,GAAqB,CAA7B;EACD;;EAED,OAAO,CAAP;AACD;;AAEK,SAAUZ,mBA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,SAAR,GAAoB,CAAzC,GAA6CY,OAAO,CAACV,YAAR,KAAyBC,mCAAaC,OAAtC,GAAgD,GAAG,CAACQ,OAAO,CAACZ,SAAR,GAAoB,GAArB,EAA0B6B,OAA1B,CAAkC,CAAlC,CAAoC,GAAvF,GAA6F,GAAG,4CAA+BjB,OAAO,CAACZ,SAAvC,CAAiD,GAA9L,GAAoM,IAPjN;IAQV8B,kBAAkB,EAAElB,OAAO,CAACmB,aAAR,GAAwB,sDAAoBd,IAApB,CAA0Be,CAAD,IAAOA,CAAC,CAACb,EAAF,KAASP,OAAO,CAACmB,aAAjD,OAA+D,IAA/D,IAA+DE,aAA/D,GAA+D,MAA/D,GAA+DA,GAAEC,KAAjE,MAAsE,IAAtE,IAAsEC,aAAtE,GAAsEA,EAAtE,GAA0E,IAAlG,GAAyG;EARnH,CADZ;AAWD","names":["getDiscount","getTotalTaxExcluded","productToReadProductEditing","product","discount2","undefined","discountType","DiscountType","PERCENT","priceTaxExcluded","_a","_b","AMOUNT","_c","discount","quantity","payload","totalTaxExcluded","unitFormatted","values","Unit","find","unit","id","shortName","vatFormatted","idVat","saleName","_d","priceTaxExcludedFormatted","totalTaxExcludedFormatted","discountFormatted","discountTypeFormatted","toFixed","marginVatFormatted","marginVatType","c","_e","label","_f"],"sourceRoot":"","sources":["../../../ts/utils/commercialManagement/product.ts"],"sourcesContent":["import { isDefined } from 'class-validator';\nimport { IProductInvoice, ReadProductEditing } from '../../types';\nimport { Unit } from '../../types/Enum/Unit';\nimport { DiscountType, VatMarginCategyList } from '../../types/Enum/CommercialManagement';\nimport { getById } from './vat';\nimport { integerToFormattedAmountString } from '../amount';\n\nexport function getDiscount(product: IProductInvoice): number {\n if (product.discount2 === null || product.discount2 === undefined || product.discount2 <= 0) return 0;\n\n if (product.discountType === DiscountType.PERCENT) {\n return ((product.priceTaxExcluded ?? 0) * ((product.discount2 ?? 0) / 100)) / 100;\n } if (product.discountType === DiscountType.AMOUNT) {\n return (product.discount2 ?? 0);\n }\n\n return 0;\n}\n\nexport function getTotalTaxExcluded(product: IProductInvoice): number {\n const discount = product.discount2 && product.discount2 > 0 ? getDiscount(product) : 0;\n return ((product.priceTaxExcluded ?? 0) - discount) * (product.quantity ?? 1);\n}\n\nexport function productToReadProductEditing(payload: IProductInvoice): ReadProductEditing {\n return {\n ...payload,\n totalTaxExcluded: getTotalTaxExcluded(payload),\n unitFormatted: Object.values(Unit).find((unit) => unit.id === payload.unit)?.shortName ?? '',\n vatFormatted: getById(payload.idVat)?.saleName ?? '',\n priceTaxExcludedFormatted: isDefined(payload.priceTaxExcluded) ? integerToFormattedAmountString(payload.priceTaxExcluded) : null,\n totalTaxExcludedFormatted: isDefined(payload.priceTaxExcluded) ? integerToFormattedAmountString(getTotalTaxExcluded(payload)) : null,\n discountFormatted: payload.discount2 && payload.discount2 > 0 ? integerToFormattedAmountString(getDiscount(payload)) : null,\n discountTypeFormatted: payload.discount2 && payload.discount2 > 0 ? payload.discountType === DiscountType.PERCENT ? `${(payload.discount2 / 100).toFixed(2)}%` : `${integerToFormattedAmountString(payload.discount2)}€` : null,\n marginVatFormatted: payload.marginVatType ? VatMarginCategyList.find((c) => c.id === payload.marginVatType)?.label ?? null : null,\n };\n}"]}
|
|
@@ -33,7 +33,7 @@ function getAllRecurrences(params) {
|
|
|
33
33
|
let loop = 0;
|
|
34
34
|
let recurrency = 'month';
|
|
35
35
|
if (type === _RecurrenceType.RecurrenceType.MONHLY) recurrency = 'month'; // @ts-ignore
|
|
36
|
-
else if (type === _RecurrenceType.RecurrenceType.
|
|
36
|
+
else if (type === _RecurrenceType.RecurrenceType.QUARTERLY) recurrency = 'quarter';else if (type === _RecurrenceType.RecurrenceType.WEEKLY) recurrency = 'week';else if (type === _RecurrenceType.RecurrenceType.YEARLY) recurrency = 'year';
|
|
37
37
|
const nextInvoices = []; // @ts-ignore
|
|
38
38
|
|
|
39
39
|
while (dayjs(startDate).add(loop, recurrency).isSameOrBefore(endDate)) {
|
|
@@ -1 +1 @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KK,+BAAeC,MAA5B,EAAoCF,UAAU,GAAG,OAAb,CAApC,CACA;EADA,KAEK,IAAIJ,IAAI,KAAKK,+BAAeE,SAA5B,EAAuCH,UAAU,GAAG,SAAb,CAAvC,KACA,IAAIJ,IAAI,KAAKK,+BAAeG,MAA5B,EAAoCJ,UAAU,GAAG,MAAb,CAApC,KACA,IAAIJ,IAAI,KAAKK,+BAAeI,MAA5B,EAAoCL,UAAU,GAAG,MAAb;EAEzC,MAAMM,YAAY,GAAa,EAA/B,CAdD,CAgBC;;EACA,OAAOjB,KAAK,CAACM,SAAD,CAAL,CAAiBY,GAAjB,CAAqBR,IAArB,EAA2BC,UAA3B,EAAuCV,cAAvC,CAAsDO,OAAtD,CAAP,EAAuE;IACrE,MAAMW,WAAW,GAAGnB,KAAK,CAACM,SAAD,CAAL,CAAiBY,GAAjB,CAAqBR,IAArB,EAA2BC,UAA3B,CAApB;IACAM,YAAY,CAACG,IAAb,CAAkBD,WAAW,CAACE,MAAZ,CAAmB,YAAnB,CAAlB;IACAX,IAAI,IAAI,CAAR;EACD;;EAED,OAAOO,YAAP;AACD","names":["getAllRecurrences","dayjs","isSameOrBefore","require","quarterOfYear","extend","params","startDate","type","endDate","_a","loop","recurrency","RecurrenceType","MONHLY","QUARTERLY","WEEKLY","YEARLY","nextInvoices","add","currentDate","push","format"],"sourceRoot":"","sources":["../../../ts/utils/commercialManagement/recurrence.ts"],"sourcesContent":["import * as dayjs from 'dayjs';\nimport { OpUnitType } from 'dayjs';\nimport { RecurrenceType } from '../../types/Enum/RecurrenceType';\n\nconst isSameOrBefore = require('dayjs/plugin/isSameOrBefore');\nconst quarterOfYear = require('dayjs/plugin/quarterOfYear');\n\ndayjs.extend(quarterOfYear);\ndayjs.extend(isSameOrBefore);\n\nexport function getAllRecurrences(params: {\n startDate: string;\n endDate: string | null;\n type: RecurrenceType;\n}): string[] {\n const { startDate, type } = params;\n const endDate = params.endDate ?? '2100-01-01';\n\n let loop = 0;\n\n let recurrency: OpUnitType = 'month';\n\n if (type === RecurrenceType.MONHLY) recurrency = 'month';\n // @ts-ignore\n else if (type === RecurrenceType.QUARTERLY) recurrency = 'quarter';\n else if (type === RecurrenceType.WEEKLY) recurrency = 'week';\n else if (type === RecurrenceType.YEARLY) recurrency = 'year';\n\n const nextInvoices: string[] = [];\n\n // @ts-ignore\n while (dayjs(startDate).add(loop, recurrency).isSameOrBefore(endDate)) {\n const currentDate = dayjs(startDate).add(loop, recurrency);\n nextInvoices.push(currentDate.format('YYYY-MM-DD'));\n loop += 1;\n }\n\n return nextInvoices;\n}"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@silexpert/core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.39",
|
|
4
4
|
"description": "Silex Core perform HTTP Request and object binding. Silex core helps developers to retrieve and return formatted object",
|
|
5
5
|
"homepage": "https://gitlab.compta-clementine.fr/dev/silex-api",
|
|
6
6
|
"main": "js/index.js",
|
|
@@ -53,7 +53,7 @@ export class CommercialDocument extends Resource {
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
preview(idEstimateInvoiceType: EstimateInvoiceType, payload: CreatePreSaleDocument | CreateInvoiceDocument): Promise<IFile> {
|
|
56
|
-
return this.axios.$post('/commercial-management/preview
|
|
56
|
+
return this.axios.$post('/commercial-management/preview', { ...payload, idEstimateInvoiceType });
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
getFormValues(id: number): Promise<CreatePreSaleDocument> {
|
|
@@ -10,6 +10,8 @@ import {
|
|
|
10
10
|
QueryDeadline,
|
|
11
11
|
ReadDeadline,
|
|
12
12
|
ReadTurnoverProfitAndLossAndVats,
|
|
13
|
+
QueryVatDisbursed,
|
|
14
|
+
ReadVatDisbursed,
|
|
13
15
|
} from '../../types';
|
|
14
16
|
|
|
15
17
|
const ROUTE = 'dashboard';
|
|
@@ -37,4 +39,8 @@ export class Dashboard extends Resource {
|
|
|
37
39
|
getDeadlines(params: QueryDeadline): Promise<ReadDeadline> {
|
|
38
40
|
return this.axios.$get(`${ROUTE}/deadlines`, { params });
|
|
39
41
|
}
|
|
42
|
+
|
|
43
|
+
getVatDisbursed(params: QueryVatDisbursed): Promise<ReadVatDisbursed> {
|
|
44
|
+
return this.axios.$get(`${ROUTE}/vat-disbursed`, { params });
|
|
45
|
+
}
|
|
40
46
|
}
|
|
@@ -7,7 +7,7 @@ import { Resource } from '../Resource';
|
|
|
7
7
|
|
|
8
8
|
export class Qonto extends Resource {
|
|
9
9
|
delete(idBankConnection: number): Promise<IBankAccount> {
|
|
10
|
-
return this.axios.$delete(`connectors/qonto/${idBankConnection}`);
|
|
10
|
+
return this.axios.$delete(`connectors/qonto/connections/${idBankConnection}`);
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
getInformation(queries: GetConnectionInformation): Promise<GetQontoOrganization> {
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export enum CustomerVatType {
|
|
2
|
+
VAT_REFUND = 1,
|
|
3
|
+
VAT_TO_PAY = 2,
|
|
4
|
+
VAT_REPORT = 3,
|
|
5
|
+
VAT_TO_NIL = 4,
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export enum CustomerVatState {
|
|
9
|
+
WAITING = 0,
|
|
10
|
+
SIE_ACCEPTED = 1,
|
|
11
|
+
SIE_SENT = 2,
|
|
12
|
+
PROBLEM_CLIENT = 3,
|
|
13
|
+
DID_BY_CLIENT = 4,
|
|
14
|
+
NON_ATTRIBUTED = 5,
|
|
15
|
+
SENT_TO_CLIENT = 6,
|
|
16
|
+
REVIVE_CLIENT = 7,
|
|
17
|
+
BACK_IN_PROGESS = 8,
|
|
18
|
+
UNPAID = 9,
|
|
19
|
+
SIE_PROBLEM = 10,
|
|
20
|
+
ACCEPTED_BY_CLIENT = 11,
|
|
21
|
+
REJECTED_BY_CLIENT = 12,
|
|
22
|
+
TO_DO = 13,
|
|
23
|
+
WAITING_CLIENT = 14,
|
|
24
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export enum RecurrenceType {
|
|
2
2
|
WEEKLY = 1,
|
|
3
3
|
MONHLY = 2,
|
|
4
|
-
|
|
4
|
+
QUARTERLY = 3,
|
|
5
5
|
YEARLY = 4,
|
|
6
6
|
}
|
|
7
7
|
|
|
@@ -15,7 +15,7 @@ export const RecurrenceList: Array<{ id: RecurrenceType, label: string; }> = [
|
|
|
15
15
|
label: 'Mensuelle',
|
|
16
16
|
},
|
|
17
17
|
{
|
|
18
|
-
id: RecurrenceType.
|
|
18
|
+
id: RecurrenceType.QUARTERLY,
|
|
19
19
|
label: 'Trimestrielle',
|
|
20
20
|
},
|
|
21
21
|
{
|
|
@@ -204,13 +204,13 @@ export class CreateCommercialSetting {
|
|
|
204
204
|
|
|
205
205
|
@ApiPropertyOptional()
|
|
206
206
|
@IsOptional()
|
|
207
|
-
accountingCategory
|
|
207
|
+
accountingCategory?: AccountingCategoryId;
|
|
208
208
|
|
|
209
209
|
@ApiPropertyOptional()
|
|
210
210
|
@IsOptional()
|
|
211
211
|
@IsBoolean()
|
|
212
212
|
@ToBoolean()
|
|
213
|
-
shouldPayTaxAfterDebit
|
|
213
|
+
shouldPayTaxAfterDebit?: boolean;
|
|
214
214
|
}
|
|
215
215
|
|
|
216
216
|
export class CreateCommercialMail {
|
|
@@ -258,18 +258,18 @@ export class CommercialDocumentInputs {
|
|
|
258
258
|
|
|
259
259
|
@ApiProperty()
|
|
260
260
|
@IsString()
|
|
261
|
-
reference: string;
|
|
261
|
+
reference: string;
|
|
262
262
|
|
|
263
263
|
@ApiProperty()
|
|
264
|
-
thirdParty: IThirdParty;
|
|
264
|
+
thirdParty: IThirdParty;
|
|
265
265
|
|
|
266
266
|
@ApiProperty()
|
|
267
267
|
@IsDateString()
|
|
268
|
-
emissionDate: string;
|
|
268
|
+
emissionDate: string;
|
|
269
269
|
|
|
270
270
|
@ApiProperty()
|
|
271
271
|
@IsDateString()
|
|
272
|
-
dueDate: string;
|
|
272
|
+
dueDate: string;
|
|
273
273
|
|
|
274
274
|
@ApiProperty({ description: 'Date d\'expiration pour la facture d\'acompte' })
|
|
275
275
|
expirationDate: string | null;
|
|
@@ -283,23 +283,23 @@ export class CommercialDocumentInputs {
|
|
|
283
283
|
|
|
284
284
|
@ApiProperty({ description: 'Escompte' })
|
|
285
285
|
@IsString()
|
|
286
|
-
discount: string;
|
|
286
|
+
discount: string;
|
|
287
287
|
|
|
288
288
|
@ApiProperty()
|
|
289
|
-
comment: string | null;
|
|
289
|
+
comment: string | null;
|
|
290
290
|
|
|
291
291
|
@ApiProperty({ description: 'Pénalité de retard' })
|
|
292
|
-
penalties: string | null;
|
|
292
|
+
penalties: string | null;
|
|
293
293
|
|
|
294
294
|
@ApiProperty({ description: 'Remise globale' })
|
|
295
295
|
@IsNumber()
|
|
296
|
-
generalDiscount2: number;
|
|
296
|
+
generalDiscount2: number;
|
|
297
297
|
|
|
298
298
|
@ApiProperty({ description: 'Indemnité forfaitaire' })
|
|
299
|
-
compensation: string | null;
|
|
299
|
+
compensation: string | null;
|
|
300
300
|
|
|
301
301
|
@ApiProperty()
|
|
302
|
-
vatMention: string | null;
|
|
302
|
+
vatMention: string | null;
|
|
303
303
|
|
|
304
304
|
@ApiProperty()
|
|
305
305
|
@IsBoolean()
|
|
@@ -307,7 +307,7 @@ export class CommercialDocumentInputs {
|
|
|
307
307
|
disableVat: boolean;
|
|
308
308
|
|
|
309
309
|
@ApiProperty()
|
|
310
|
-
title: string | null;
|
|
310
|
+
title: string | null;
|
|
311
311
|
|
|
312
312
|
@ApiProperty({ description: 'Commercial name of seller' })
|
|
313
313
|
@IsString()
|
|
@@ -326,7 +326,7 @@ export class CommercialDocumentInputs {
|
|
|
326
326
|
city: string | null;
|
|
327
327
|
|
|
328
328
|
@ApiProperty()
|
|
329
|
-
settings
|
|
329
|
+
settings: ISocietyGescom;
|
|
330
330
|
|
|
331
331
|
@ApiProperty()
|
|
332
332
|
cgv: string | null;
|
|
@@ -337,12 +337,12 @@ export class CommercialDocumentInputs {
|
|
|
337
337
|
@ApiProperty()
|
|
338
338
|
@IsBoolean()
|
|
339
339
|
@ToBoolean()
|
|
340
|
-
isStripeAllowed
|
|
340
|
+
isStripeAllowed: boolean;
|
|
341
341
|
|
|
342
342
|
@ApiProperty()
|
|
343
343
|
@IsBoolean()
|
|
344
344
|
@ToBoolean()
|
|
345
|
-
isDraft
|
|
345
|
+
isDraft: boolean;
|
|
346
346
|
|
|
347
347
|
@ApiProperty()
|
|
348
348
|
idEstimateInvoiceType: EstimateInvoiceType;
|
|
@@ -353,7 +353,7 @@ export class CommercialDocumentInputs {
|
|
|
353
353
|
@ApiProperty()
|
|
354
354
|
@IsBoolean()
|
|
355
355
|
@ToBoolean()
|
|
356
|
-
shouldPayTaxAfterDebit
|
|
356
|
+
shouldPayTaxAfterDebit?: boolean;
|
|
357
357
|
}
|
|
358
358
|
|
|
359
359
|
export class CreatePreSaleDocument extends CommercialDocumentInputs {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
-
IsArray, IsBoolean, IsDateString,
|
|
2
|
+
IsArray, IsBoolean, IsDateString, IsOptional, IsString,
|
|
3
3
|
} from 'class-validator';
|
|
4
4
|
import { Order } from '../../..';
|
|
5
5
|
import { ApiProperty, ApiPropertyOptional } from '../../../../utils';
|
|
@@ -37,6 +37,13 @@ export class QueryInvoice {
|
|
|
37
37
|
@ApiPropertyOptional()
|
|
38
38
|
@IsBoolean()
|
|
39
39
|
@ToBoolean()
|
|
40
|
+
@IsOptional()
|
|
41
|
+
toAnnotate?: boolean;
|
|
42
|
+
|
|
43
|
+
@ApiPropertyOptional()
|
|
44
|
+
@IsOptional()
|
|
45
|
+
@IsBoolean()
|
|
46
|
+
@ToBoolean()
|
|
40
47
|
isDescending?: boolean;
|
|
41
48
|
}
|
|
42
49
|
|
|
@@ -49,19 +56,18 @@ export interface ParamPaginatedInvoices {
|
|
|
49
56
|
status?: InvoiceStatus;
|
|
50
57
|
search?: string;
|
|
51
58
|
pagination: QueryPaginate;
|
|
59
|
+
toAnnotate?: boolean;
|
|
52
60
|
order?: Order;
|
|
53
61
|
}
|
|
54
62
|
|
|
55
63
|
export class QueryGetDefaultPayload {
|
|
56
64
|
@ApiProperty()
|
|
57
|
-
|
|
58
|
-
idEstimateInvoiceType: number;
|
|
65
|
+
idEstimateInvoiceType: EstimateInvoiceType;
|
|
59
66
|
}
|
|
60
67
|
|
|
61
68
|
export class QueryNextReference {
|
|
62
69
|
@ApiProperty()
|
|
63
|
-
|
|
64
|
-
idEstimateInvoiceType: number;
|
|
70
|
+
idEstimateInvoiceType: EstimateInvoiceType;
|
|
65
71
|
|
|
66
72
|
@ApiPropertyOptional()
|
|
67
73
|
@IsBoolean()
|
|
@@ -119,6 +125,7 @@ export class QueryDocumentPaginated {
|
|
|
119
125
|
@ApiPropertyOptional()
|
|
120
126
|
@IsBoolean()
|
|
121
127
|
@ToBoolean()
|
|
128
|
+
@IsOptional()
|
|
122
129
|
isDraft?: boolean;
|
|
123
130
|
}
|
|
124
131
|
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { CustomerVatState, CustomerVatType } from '../../../Enum/CustomerVat';
|
|
2
|
+
|
|
3
|
+
export type VatDisbursedWithFutureDate = {
|
|
4
|
+
todo: boolean;
|
|
5
|
+
amount: number;
|
|
6
|
+
state: CustomerVatState;
|
|
7
|
+
type: CustomerVatType;
|
|
8
|
+
date: string
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export type ReadVatDisbursed = {
|
|
12
|
+
data: VatDisbursedWithFutureDate[];
|
|
13
|
+
total: number;
|
|
14
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IsEnum, IsOptional
|
|
1
|
+
import { IsEnum, IsOptional } from 'class-validator';
|
|
2
2
|
import { ThirdPartyType } from '../../..';
|
|
3
3
|
import { ApiProperty, ApiPropertyOptional } from '../../../../utils';
|
|
4
4
|
|
|
@@ -66,15 +66,13 @@ export class CreateThirdPartyForm {
|
|
|
66
66
|
|
|
67
67
|
@ApiPropertyOptional()
|
|
68
68
|
@IsOptional()
|
|
69
|
-
|
|
70
|
-
deliveryAddress: string | null;
|
|
69
|
+
deliveryAddress?: string | null;
|
|
71
70
|
|
|
72
71
|
@ApiPropertyOptional()
|
|
73
72
|
@IsOptional()
|
|
74
|
-
|
|
75
|
-
deliveryCity: string | null;
|
|
73
|
+
deliveryCity?: string | null;
|
|
76
74
|
|
|
77
75
|
@ApiPropertyOptional()
|
|
78
76
|
@IsOptional()
|
|
79
|
-
deliveryZipCode
|
|
77
|
+
deliveryZipCode?: string | null;
|
|
80
78
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IsEnum, IsOptional
|
|
1
|
+
import { IsEnum, IsOptional } from 'class-validator';
|
|
2
2
|
import { ThirdPartyType } from '../../..';
|
|
3
3
|
import { ApiPropertyOptional } from '../../../../utils';
|
|
4
4
|
|
|
@@ -86,15 +86,13 @@ export class UpdateThirdPartyForm {
|
|
|
86
86
|
|
|
87
87
|
@ApiPropertyOptional()
|
|
88
88
|
@IsOptional()
|
|
89
|
-
|
|
90
|
-
deliveryAddress: string | null;
|
|
89
|
+
deliveryAddress?: string | null;
|
|
91
90
|
|
|
92
91
|
@ApiPropertyOptional()
|
|
93
92
|
@IsOptional()
|
|
94
|
-
|
|
95
|
-
deliveryCity: string | null;
|
|
93
|
+
deliveryCity?: string | null;
|
|
96
94
|
|
|
97
95
|
@ApiPropertyOptional()
|
|
98
96
|
@IsOptional()
|
|
99
|
-
deliveryZipCode
|
|
97
|
+
deliveryZipCode?: string | null;
|
|
100
98
|
}
|
|
@@ -64,7 +64,7 @@ export interface IEstimateInvoice {
|
|
|
64
64
|
assetRelatedToThisEstimateInvoice?: IEstimateInvoice;
|
|
65
65
|
estimateInvoiceForThisAsset?: IEstimateInvoice;
|
|
66
66
|
estimateInvoiceForThisRepeat?: IEstimateInvoice;
|
|
67
|
-
|
|
67
|
+
reminder?: IInvoiceReminder;
|
|
68
68
|
relatedInvoice?: IEstimateInvoice;
|
|
69
69
|
recurrence?: IInvoiceRecurrence;
|
|
70
70
|
file?: IFile;
|
package/ts/types/index.ts
CHANGED
|
@@ -438,6 +438,7 @@ export * from './Enum/Call';
|
|
|
438
438
|
export * from './Enum/ConnectionError';
|
|
439
439
|
export * from './Enum/RecurrenceType';
|
|
440
440
|
export * from './Enum/Rules';
|
|
441
|
+
export * from './Enum/CustomerVat';
|
|
441
442
|
|
|
442
443
|
// Interfaces API
|
|
443
444
|
export * from './Interface/api/partnerTransactionType/ReadPartnerTransactionType';
|
|
@@ -523,6 +524,8 @@ export * from './Interface/api/pdf/BillingDocumentData';
|
|
|
523
524
|
export * from './Interface/api/dashboard/QueryBalanceBankAccount';
|
|
524
525
|
export * from './Interface/api/dashboard/QueryTopBuys';
|
|
525
526
|
export * from './Interface/api/dashboard/QueryTopProviders';
|
|
527
|
+
export * from './Interface/api/dashboard/QueryVatDisbursed';
|
|
528
|
+
export * from './Interface/api/dashboard/ReadVatDisbursed';
|
|
526
529
|
export * from './Interface/api/dashboard/ReadBalanceBankAccount';
|
|
527
530
|
export * from './Interface/api/dashboard/QueryDeadline';
|
|
528
531
|
export * from './Interface/api/dashboard/ReadTopBuys';
|
|
@@ -26,12 +26,12 @@ export function generateCommercialDocument(idEstimateInvoiceType: EstimateInvoic
|
|
|
26
26
|
phoneContact: payload.settings?.phoneContact ?? null,
|
|
27
27
|
products,
|
|
28
28
|
vats,
|
|
29
|
-
totalTaxExcluded: _sumBy(products, 'totalTaxExcluded'),
|
|
30
|
-
totalTaxIncluded: _sumBy(products, 'totalTaxExcluded') + _sumBy(vats, 'amount'),
|
|
31
|
-
totalTaxAndDiscountIncluded: _sumBy(products, 'totalTaxExcluded') + _sumBy(vats, 'amount') - (payload.generalDiscount2 ?? 0),
|
|
29
|
+
totalTaxExcluded: _sumBy(products, 'totalTaxExcluded') - (payload.deposit ?? 0),
|
|
30
|
+
totalTaxIncluded: _sumBy(products, 'totalTaxExcluded') + _sumBy(vats, 'amount') - (payload.deposit ?? 0),
|
|
31
|
+
totalTaxAndDiscountIncluded: _sumBy(products, 'totalTaxExcluded') + _sumBy(vats, 'amount') - (payload.generalDiscount2 ?? 0) - (payload.deposit ?? 0),
|
|
32
32
|
generalDiscountFormatted: payload.generalDiscount2 ? integerToFormattedAmountString(payload.generalDiscount2) : null,
|
|
33
33
|
depositFormatted: payload.deposit ? integerToFormattedAmountString(payload.deposit) : null,
|
|
34
|
-
totalTaxExcludedFormatted: integerToFormattedAmountString(_sumBy(products, 'totalTaxExcluded')),
|
|
34
|
+
totalTaxExcludedFormatted: integerToFormattedAmountString(_sumBy(products, 'totalTaxExcluded') - (payload.deposit ?? 0)),
|
|
35
35
|
totalTaxIncludedFormatted: integerToFormattedAmountString(_sumBy(products, 'totalTaxExcluded') + _sumBy(vats, 'amount') - (payload.deposit ?? 0)),
|
|
36
36
|
totalTaxAndDiscountIncludedFormatted: integerToFormattedAmountString(_sumBy(products, 'totalTaxExcluded') + _sumBy(vats, 'amount') - (payload.generalDiscount2 ?? 0) - (payload.deposit ?? 0)),
|
|
37
37
|
totalVatAmountFormatted: integerToFormattedAmountString(_sumBy(vats, 'amount')),
|
|
@@ -50,16 +50,7 @@ export function generateCommercialDocument(idEstimateInvoiceType: EstimateInvoic
|
|
|
50
50
|
};
|
|
51
51
|
|
|
52
52
|
const commonTemplate = new CommercialDocumentCommonHTML();
|
|
53
|
-
|
|
54
|
-
let documentFreeText: string | null | undefined;
|
|
55
|
-
|
|
56
|
-
// A GERER EN FONCTION DU DOCUMENT
|
|
57
|
-
if ([EstimateInvoiceType.DEVIS, EstimateInvoiceType.BON].includes(idEstimateInvoiceType)) {
|
|
58
|
-
documentFreeText = payload?.settings?.freeEstimateText;
|
|
59
|
-
} else {
|
|
60
|
-
documentFreeText = payload?.settings?.freeInvoiceText;
|
|
61
|
-
}
|
|
62
|
-
//
|
|
53
|
+
const documentFreeText = [EstimateInvoiceType.DEVIS, EstimateInvoiceType.BON].includes(idEstimateInvoiceType) ? payload?.settings?.freeEstimateText : payload?.settings?.freeInvoiceText;
|
|
63
54
|
|
|
64
55
|
return {
|
|
65
56
|
header: ejs.render(commonTemplate.header, data),
|
|
@@ -19,7 +19,7 @@ export function getDiscount(product: IProductInvoice): number {
|
|
|
19
19
|
|
|
20
20
|
export function getTotalTaxExcluded(product: IProductInvoice): number {
|
|
21
21
|
const discount = product.discount2 && product.discount2 > 0 ? getDiscount(product) : 0;
|
|
22
|
-
return (product.priceTaxExcluded ?? 0)
|
|
22
|
+
return ((product.priceTaxExcluded ?? 0) - discount) * (product.quantity ?? 1);
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
export function productToReadProductEditing(payload: IProductInvoice): ReadProductEditing {
|
|
@@ -22,7 +22,7 @@ export function getAllRecurrences(params: {
|
|
|
22
22
|
|
|
23
23
|
if (type === RecurrenceType.MONHLY) recurrency = 'month';
|
|
24
24
|
// @ts-ignore
|
|
25
|
-
else if (type === RecurrenceType.
|
|
25
|
+
else if (type === RecurrenceType.QUARTERLY) recurrency = 'quarter';
|
|
26
26
|
else if (type === RecurrenceType.WEEKLY) recurrency = 'week';
|
|
27
27
|
else if (type === RecurrenceType.YEARLY) recurrency = 'year';
|
|
28
28
|
|