@silexpert/core 1.0.81 → 1.0.84

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.
@@ -11,7 +11,7 @@ export const Vat = {
11
11
  roundPercentage: [0],
12
12
  isVatImportation: false,
13
13
  isVatIntracom: false,
14
- saleName: 'Hors-Taxe',
14
+ saleName: 'HT',
15
15
  },
16
16
  TX_5_5: {
17
17
  id: 2,
@@ -1 +1 @@
1
- {"version":3,"file":"Vat.js","sourceRoot":"","sources":["../../../ts/types/Enum/Vat.ts"],"names":[],"mappings":"AAmBA,MAAM,CAAC,MAAM,GAAG,GAAe;IAC7B,YAAY,EAAE;QACZ,EAAE,EAAE,CAAC;QACL,KAAK,EAAE,CAAC;QACR,KAAK,EAAE,CAAC;QACR,YAAY,EAAE,CAAC;QACf,IAAI,EAAE,WAAW;QACjB,SAAS,EAAE,GAAG;QACd,UAAU,EAAE,GAAG;QACf,cAAc,EAAE,EAAE;QAClB,eAAe,EAAE,CAAC,CAAC,CAAC;QACpB,gBAAgB,EAAE,KAAK;QACvB,aAAa,EAAE,KAAK;QACpB,QAAQ,EAAE,WAAW;KACtB;IACD,MAAM,EAAE;QACN,EAAE,EAAE,CAAC;QACL,KAAK,EAAE,CAAC;QACR,KAAK,EAAE,GAAG;QACV,YAAY,EAAE,CAAC;QACf,IAAI,EAAE,UAAU;QAChB,SAAS,EAAE,GAAG;QACd,UAAU,EAAE,CAAC;QACb,cAAc,EAAE,EAAE;QAClB,eAAe,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;QACvB,gBAAgB,EAAE,KAAK;QACvB,aAAa,EAAE,KAAK;QACpB,QAAQ,EAAE,MAAM;KACjB;IACD,KAAK,EAAE;QACL,EAAE,EAAE,CAAC;QACL,KAAK,EAAE,CAAC;QACR,KAAK,EAAE,EAAE;QACT,YAAY,EAAE,CAAC;QACf,IAAI,EAAE,SAAS;QACf,SAAS,EAAE,GAAG;QACd,UAAU,EAAE,CAAC;Q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,EAAE;QACN,KAAK,EAAE,EAAE;QACT,KAAK,EAAE,GAAG;QACV,YAAY,EAAE,CAAC;QACf,IAAI,EAAE,sBAAsB;QAC5B,SAAS,EAAE,GAAG;QACd,UAAU,EAAE,GAAG;QACf,cAAc,EAAE,GAAG;QACnB,eAAe,EAAE,EAAE;QACnB,gBAAgB,EAAE,IAAI;QACtB,aAAa,EAAE,KAAK;QACpB,QAAQ,EAAE,MAAM;KACjB;IACD,MAAM,EAAE;QACN,EAAE,EAAE,EAAE;QACN,KAAK,EAAE,EAAE;QACT,KAAK,EAAE,CAAC;QACR,YAAY,EAAE,CAAC;QACf,IAAI,EAAE,cAAc;QACpB,SAAS,EAAE,CAAC;QACZ,UAAU,EAAE,CAAC;QACb,cAAc,EAAE,IAAI;QACpB,eAAe,EAAE,EAAE;QACnB,gBAAgB,EAAE,KAAK;QACvB,aAAa,EAAE,KAAK;QACpB,QAAQ,EAAE,EAAE;KACb;CACF,CAAC;AAEF,MAAM,CAAN,IAAY,QAgBX;AAhBD,WAAY,QAAQ;IAClB,6CAAW,CAAA;IACX,uDAAgB,CAAA;IAChB,+CAAY,CAAA;IACZ,uDAAgB,CAAA;IAChB,2DAAkB,CAAA;IAClB,mCAAM,CAAA;IACN,2DAAkB,CAAA;IAClB,iEAAqB,CAAA;IACrB,mDAAc,CAAA;IACd,6CAAW,CAAA;IACX,kDAAc,CAAA;IACd,oEAAuB,CAAA;IACvB,kEAAsB,CAAA;IACtB,0CAAU,CAAA;IACV,4DAAmB,CAAA;AACrB,CAAC,EAhBW,QAAQ,KAAR,QAAQ,QAgBnB","sourcesContent":["export interface VatType{\n id: number;\n idTva: number;\n value: number;\n displayOrder: number;\n name: string;\n collected: number;\n deductible: number;\n immobilization: number | null;\n roundPercentage: number[];\n isVatImportation: boolean;\n isVatIntracom: boolean;\n saleName: string; // Used for commercial documents\n}\n\nexport interface VatTypeEnum {\n [key: string]: VatType\n}\n\nexport const Vat:VatTypeEnum = {\n WITHOUT_TAXE: {\n id: 1,\n idTva: 1,\n value: 0,\n displayOrder: 6,\n name: 'Hors-Taxe',\n collected: 212,\n deductible: 221,\n immobilization: 19,\n roundPercentage: [0],\n isVatImportation: false,\n isVatIntracom: false,\n saleName: 'Hors-Taxe',\n },\n TX_5_5: {\n id: 2,\n idTva: 2,\n value: 5.5,\n displayOrder: 4,\n name: 'TVA 5.5%',\n collected: 209,\n deductible: 4,\n immobilization: 10,\n roundPercentage: [5, 6],\n isVatImportation: false,\n isVatIntracom: false,\n saleName: '5.5%',\n },\n TX_10: {\n id: 3,\n idTva: 3,\n value: 10,\n displayOrder: 2,\n name: 'TVA 10%',\n collected: 210,\n deductible: 5,\n immobilization: 11,\n roundPercentage: [10, 11],\n isVatImportation: false,\n isVatIntracom: false,\n saleName: '10%',\n },\n TX_20: {\n id: 4,\n idTva: 4,\n value: 20,\n displayOrder: 1,\n name: 'TVA 20%',\n collected: 211,\n deductible: 6,\n immobilization: 12,\n roundPercentage: [19, 20, 21],\n isVatImportation: false,\n isVatIntracom: false,\n saleName: '20%',\n },\n TX_2_1: {\n id: 6,\n idTva: 6,\n value: 2.1,\n displayOrder: 5,\n name: 'TVA 2.1%',\n collected: 222,\n deductible: 7,\n immobilization: 13,\n roundPercentage: [2, 3],\n isVatImportation: false,\n isVatIntracom: false,\n saleName: '2.1%',\n },\n TX_8_5: {\n id: 7,\n idTva: 7,\n value: 8.5,\n displayOrder: 3,\n name: 'TVA 8.5%',\n collected: 345,\n deductible: 8,\n immobilization: 15,\n roundPercentage: [8, 9],\n isVatImportation: false,\n isVatIntracom: false,\n saleName: '8.5%',\n },\n MARGE: {\n id: 8,\n idTva: 8,\n value: 0,\n displayOrder: 9,\n name: 'Sur Marge',\n collected: 211,\n deductible: 9,\n immobilization: null,\n roundPercentage: [],\n isVatImportation: false,\n isVatIntracom: false,\n saleName: 'Sur marge',\n },\n INTRACOM_TX_20: {\n id: 9,\n idTva: 9,\n value: 20,\n displayOrder: 7,\n name: 'TVA Intracom 20%',\n collected: 207,\n deductible: 208,\n immobilization: 208,\n roundPercentage: [],\n isVatImportation: false,\n isVatIntracom: true,\n saleName: '20%',\n },\n INTRACOM_WITHOUT_TAXE: {\n id: 17,\n idTva: 17,\n value: 0,\n displayOrder: 7,\n name: 'TVA Intracom Hors-Taxe',\n collected: 207,\n deductible: 208,\n immobilization: 208,\n roundPercentage: [],\n isVatImportation: false,\n isVatIntracom: true,\n saleName: 'Hors-Taxe',\n },\n INTRACOM_TX_5_5: {\n id: 18,\n idTva: 18,\n value: 5.5,\n displayOrder: 7,\n name: 'TVA Intracom 5.5%',\n collected: 207,\n deductible: 208,\n immobilization: 208,\n roundPercentage: [],\n isVatImportation: false,\n isVatIntracom: true,\n saleName: '5.5%',\n },\n INTRACOM_TX_10: {\n id: 19,\n idTva: 19,\n value: 10,\n displayOrder: 7,\n name: 'TVA Intracom 10%',\n collected: 207,\n deductible: 208,\n immobilization: 208,\n roundPercentage: [],\n isVatImportation: false,\n isVatIntracom: true,\n saleName: '10%',\n },\n INTRACOM_TX_2_1: {\n id: 20,\n idTva: 20,\n value: 2.1,\n displayOrder: 7,\n name: 'TVA Intracom 2.1%',\n collected: 207,\n deductible: 208,\n immobilization: 208,\n roundPercentage: [],\n isVatImportation: false,\n isVatIntracom: true,\n saleName: '2.1%',\n },\n INTRACOM_TX_8_5: {\n id: 21,\n idTva: 21,\n value: 8.5,\n displayOrder: 7,\n name: 'TVA Intracom 8.5%',\n collected: 207,\n deductible: 208,\n immobilization: 208,\n roundPercentage: [],\n isVatImportation: false,\n isVatIntracom: true,\n saleName: '8.5%',\n },\n IMPORTATION_WITHOUT_TAXE: {\n id: 10,\n idTva: 10,\n value: 0,\n displayOrder: 8,\n name: 'TVA Importation Hors-Taxe',\n collected: 572,\n deductible: 573,\n immobilization: 573,\n roundPercentage: [],\n isVatImportation: true,\n isVatIntracom: false,\n saleName: 'Hors-Taxe',\n },\n IMPORTATION_TX_5_5: {\n id: 12,\n idTva: 12,\n value: 5.5,\n displayOrder: 8,\n name: 'TVA Importation 5.5%',\n collected: 574,\n deductible: 575,\n immobilization: 575,\n roundPercentage: [],\n isVatImportation: true,\n isVatIntracom: false,\n saleName: '5.5%',\n },\n IMPORTATION_TX_10: {\n id: 13,\n idTva: 13,\n value: 10,\n displayOrder: 8,\n name: 'TVA Importation 10%',\n collected: 576,\n deductible: 577,\n immobilization: 577,\n roundPercentage: [],\n isVatImportation: true,\n isVatIntracom: false,\n saleName: '10%',\n },\n IMPORTATION_TX_20: {\n id: 14,\n idTva: 14,\n value: 20,\n displayOrder: 8,\n name: 'TVA Importation 20%',\n collected: 578,\n deductible: 579,\n immobilization: 579,\n roundPercentage: [],\n isVatImportation: true,\n isVatIntracom: false,\n saleName: '20%',\n },\n IMPORTATION_TX_2_1: {\n id: 15,\n idTva: 15,\n value: 2.1,\n displayOrder: 8,\n name: 'TVA Importation 2.1%',\n collected: 580,\n deductible: 581,\n immobilization: 581,\n roundPercentage: [],\n isVatImportation: true,\n isVatIntracom: false,\n saleName: '2.1%',\n },\n IMPORTATION_TX_8_5: {\n id: 16,\n idTva: 16,\n value: 8.5,\n displayOrder: 8,\n name: 'TVA Importation 8.5%',\n collected: 582,\n deductible: 583,\n immobilization: 583,\n roundPercentage: [],\n isVatImportation: true,\n isVatIntracom: false,\n saleName: '8.5%',\n },\n MANUAL: {\n id: 11,\n idTva: 11,\n value: 0,\n displayOrder: 8,\n name: 'TVA manuelle',\n collected: 0,\n deductible: 0,\n immobilization: null,\n roundPercentage: [],\n isVatImportation: false,\n isVatIntracom: false,\n saleName: '',\n },\n};\n\nexport enum VatState {\n WAITING = 0,\n ACCEPTED_SIE = 1,\n SEND_SIE = 2,\n CLIENT_ISSUE = 3,\n DONE_BY_CLIENT = 4,\n NA = 5,\n SEND_TO_CLIENT = 6,\n CLIENT_RELAUNCHED = 7,\n DOING_BACK = 8,\n UNPAYED = 9,\n SIE_ISSUE = 10,\n ACCEPTED_BY_CLIENT = 11,\n REFUSED_BY_CLIENT = 12,\n TO_DO = 13,\n WAITING_CLIENT = 14,\n}"]}
1
+ {"version":3,"file":"Vat.js","sourceRoot":"","sources":["../../../ts/types/Enum/Vat.ts"],"names":[],"mappings":"AAmBA,MAAM,CAAC,MAAM,GAAG,GAAe;IAC7B,YAAY,EAAE;QACZ,EAAE,EAAE,CAAC;QACL,KAAK,EAAE,CAAC;QACR,KAAK,EAAE,CAAC;QACR,YAAY,EAAE,CAAC;QACf,IAAI,EAAE,WAAW;QACjB,SAAS,EAAE,GAAG;QACd,UAAU,EAAE,GAAG;QACf,cAAc,EAAE,EAAE;QAClB,eAAe,EAAE,CAAC,CAAC,CAAC;QACpB,gBAAgB,EAAE,KAAK;QACvB,aAAa,EAAE,KAAK;QACpB,QAAQ,EAAE,IAAI;KACf;IACD,MAAM,EAAE;QACN,EAAE,EAAE,CAAC;QACL,KAAK,EAAE,CAAC;QACR,KAAK,EAAE,GAAG;QACV,YAAY,EAAE,CAAC;QACf,IAAI,EAAE,UAAU;QAChB,SAAS,EAAE,GAAG;QACd,UAAU,EAAE,CAAC;QACb,cAAc,EAAE,EAAE;QAClB,eAAe,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;QACvB,gBAAgB,EAAE,KAAK;QACvB,aAAa,EAAE,KAAK;QACpB,QAAQ,EAAE,MAAM;KACjB;IACD,KAAK,EAAE;QACL,EAAE,EAAE,CAAC;QACL,KAAK,EAAE,CAAC;QACR,KAAK,EAAE,EAAE;QACT,YAAY,EAAE,CAAC;QACf,IAAI,EAAE,SAAS;QACf,SAAS,EAAE,GAAG;QACd,UAAU,EAAE,CAAC;QACb,cAAc,EAAE,EAAE;QAClB,eAAe,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC;QACzB,gBAAgB,EAAE,KAAK;QACvB,aAAa,EAAE,KAAK;QACpB,QAAQ,EAAE,KAAK;KAChB;IACD,KAAK,EAAE;QACL,EAAE,EAAE,CAAC;QACL,KAAK,EAAE,CAAC;QACR,KAAK,EAAE,EAAE;QACT,YAAY,EAAE,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AAQ,EAAE,MAAM;KACjB;IACD,MAAM,EAAE;QACN,EAAE,EAAE,EAAE;QACN,KAAK,EAAE,EAAE;QACT,KAAK,EAAE,CAAC;QACR,YAAY,EAAE,CAAC;QACf,IAAI,EAAE,cAAc;QACpB,SAAS,EAAE,CAAC;QACZ,UAAU,EAAE,CAAC;QACb,cAAc,EAAE,IAAI;QACpB,eAAe,EAAE,EAAE;QACnB,gBAAgB,EAAE,KAAK;QACvB,aAAa,EAAE,KAAK;QACpB,QAAQ,EAAE,EAAE;KACb;CACF,CAAC;AAEF,MAAM,CAAN,IAAY,QAgBX;AAhBD,WAAY,QAAQ;IAClB,6CAAW,CAAA;IACX,uDAAgB,CAAA;IAChB,+CAAY,CAAA;IACZ,uDAAgB,CAAA;IAChB,2DAAkB,CAAA;IAClB,mCAAM,CAAA;IACN,2DAAkB,CAAA;IAClB,iEAAqB,CAAA;IACrB,mDAAc,CAAA;IACd,6CAAW,CAAA;IACX,kDAAc,CAAA;IACd,oEAAuB,CAAA;IACvB,kEAAsB,CAAA;IACtB,0CAAU,CAAA;IACV,4DAAmB,CAAA;AACrB,CAAC,EAhBW,QAAQ,KAAR,QAAQ,QAgBnB","sourcesContent":["export interface VatType{\n id: number;\n idTva: number;\n value: number;\n displayOrder: number;\n name: string;\n collected: number;\n deductible: number;\n immobilization: number | null;\n roundPercentage: number[];\n isVatImportation: boolean;\n isVatIntracom: boolean;\n saleName: string; // Used for commercial documents\n}\n\nexport interface VatTypeEnum {\n [key: string]: VatType\n}\n\nexport const Vat:VatTypeEnum = {\n WITHOUT_TAXE: {\n id: 1,\n idTva: 1,\n value: 0,\n displayOrder: 6,\n name: 'Hors-Taxe',\n collected: 212,\n deductible: 221,\n immobilization: 19,\n roundPercentage: [0],\n isVatImportation: false,\n isVatIntracom: false,\n saleName: 'HT',\n },\n TX_5_5: {\n id: 2,\n idTva: 2,\n value: 5.5,\n displayOrder: 4,\n name: 'TVA 5.5%',\n collected: 209,\n deductible: 4,\n immobilization: 10,\n roundPercentage: [5, 6],\n isVatImportation: false,\n isVatIntracom: false,\n saleName: '5.5%',\n },\n TX_10: {\n id: 3,\n idTva: 3,\n value: 10,\n displayOrder: 2,\n name: 'TVA 10%',\n collected: 210,\n deductible: 5,\n immobilization: 11,\n roundPercentage: [10, 11],\n isVatImportation: false,\n isVatIntracom: false,\n saleName: '10%',\n },\n TX_20: {\n id: 4,\n idTva: 4,\n value: 20,\n displayOrder: 1,\n name: 'TVA 20%',\n collected: 211,\n deductible: 6,\n immobilization: 12,\n roundPercentage: [19, 20, 21],\n isVatImportation: false,\n isVatIntracom: false,\n saleName: '20%',\n },\n TX_2_1: {\n id: 6,\n idTva: 6,\n value: 2.1,\n displayOrder: 5,\n name: 'TVA 2.1%',\n collected: 222,\n deductible: 7,\n immobilization: 13,\n roundPercentage: [2, 3],\n isVatImportation: false,\n isVatIntracom: false,\n saleName: '2.1%',\n },\n TX_8_5: {\n id: 7,\n idTva: 7,\n value: 8.5,\n displayOrder: 3,\n name: 'TVA 8.5%',\n collected: 345,\n deductible: 8,\n immobilization: 15,\n roundPercentage: [8, 9],\n isVatImportation: false,\n isVatIntracom: false,\n saleName: '8.5%',\n },\n MARGE: {\n id: 8,\n idTva: 8,\n value: 0,\n displayOrder: 9,\n name: 'Sur Marge',\n collected: 211,\n deductible: 9,\n immobilization: null,\n roundPercentage: [],\n isVatImportation: false,\n isVatIntracom: false,\n saleName: 'Sur marge',\n },\n INTRACOM_TX_20: {\n id: 9,\n idTva: 9,\n value: 20,\n displayOrder: 7,\n name: 'TVA Intracom 20%',\n collected: 207,\n deductible: 208,\n immobilization: 208,\n roundPercentage: [],\n isVatImportation: false,\n isVatIntracom: true,\n saleName: '20%',\n },\n INTRACOM_WITHOUT_TAXE: {\n id: 17,\n idTva: 17,\n value: 0,\n displayOrder: 7,\n name: 'TVA Intracom Hors-Taxe',\n collected: 207,\n deductible: 208,\n immobilization: 208,\n roundPercentage: [],\n isVatImportation: false,\n isVatIntracom: true,\n saleName: 'Hors-Taxe',\n },\n INTRACOM_TX_5_5: {\n id: 18,\n idTva: 18,\n value: 5.5,\n displayOrder: 7,\n name: 'TVA Intracom 5.5%',\n collected: 207,\n deductible: 208,\n immobilization: 208,\n roundPercentage: [],\n isVatImportation: false,\n isVatIntracom: true,\n saleName: '5.5%',\n },\n INTRACOM_TX_10: {\n id: 19,\n idTva: 19,\n value: 10,\n displayOrder: 7,\n name: 'TVA Intracom 10%',\n collected: 207,\n deductible: 208,\n immobilization: 208,\n roundPercentage: [],\n isVatImportation: false,\n isVatIntracom: true,\n saleName: '10%',\n },\n INTRACOM_TX_2_1: {\n id: 20,\n idTva: 20,\n value: 2.1,\n displayOrder: 7,\n name: 'TVA Intracom 2.1%',\n collected: 207,\n deductible: 208,\n immobilization: 208,\n roundPercentage: [],\n isVatImportation: false,\n isVatIntracom: true,\n saleName: '2.1%',\n },\n INTRACOM_TX_8_5: {\n id: 21,\n idTva: 21,\n value: 8.5,\n displayOrder: 7,\n name: 'TVA Intracom 8.5%',\n collected: 207,\n deductible: 208,\n immobilization: 208,\n roundPercentage: [],\n isVatImportation: false,\n isVatIntracom: true,\n saleName: '8.5%',\n },\n IMPORTATION_WITHOUT_TAXE: {\n id: 10,\n idTva: 10,\n value: 0,\n displayOrder: 8,\n name: 'TVA Importation Hors-Taxe',\n collected: 572,\n deductible: 573,\n immobilization: 573,\n roundPercentage: [],\n isVatImportation: true,\n isVatIntracom: false,\n saleName: 'Hors-Taxe',\n },\n IMPORTATION_TX_5_5: {\n id: 12,\n idTva: 12,\n value: 5.5,\n displayOrder: 8,\n name: 'TVA Importation 5.5%',\n collected: 574,\n deductible: 575,\n immobilization: 575,\n roundPercentage: [],\n isVatImportation: true,\n isVatIntracom: false,\n saleName: '5.5%',\n },\n IMPORTATION_TX_10: {\n id: 13,\n idTva: 13,\n value: 10,\n displayOrder: 8,\n name: 'TVA Importation 10%',\n collected: 576,\n deductible: 577,\n immobilization: 577,\n roundPercentage: [],\n isVatImportation: true,\n isVatIntracom: false,\n saleName: '10%',\n },\n IMPORTATION_TX_20: {\n id: 14,\n idTva: 14,\n value: 20,\n displayOrder: 8,\n name: 'TVA Importation 20%',\n collected: 578,\n deductible: 579,\n immobilization: 579,\n roundPercentage: [],\n isVatImportation: true,\n isVatIntracom: false,\n saleName: '20%',\n },\n IMPORTATION_TX_2_1: {\n id: 15,\n idTva: 15,\n value: 2.1,\n displayOrder: 8,\n name: 'TVA Importation 2.1%',\n collected: 580,\n deductible: 581,\n immobilization: 581,\n roundPercentage: [],\n isVatImportation: true,\n isVatIntracom: false,\n saleName: '2.1%',\n },\n IMPORTATION_TX_8_5: {\n id: 16,\n idTva: 16,\n value: 8.5,\n displayOrder: 8,\n name: 'TVA Importation 8.5%',\n collected: 582,\n deductible: 583,\n immobilization: 583,\n roundPercentage: [],\n isVatImportation: true,\n isVatIntracom: false,\n saleName: '8.5%',\n },\n MANUAL: {\n id: 11,\n idTva: 11,\n value: 0,\n displayOrder: 8,\n name: 'TVA manuelle',\n collected: 0,\n deductible: 0,\n immobilization: null,\n roundPercentage: [],\n isVatImportation: false,\n isVatIntracom: false,\n saleName: '',\n },\n};\n\nexport enum VatState {\n WAITING = 0,\n ACCEPTED_SIE = 1,\n SEND_SIE = 2,\n CLIENT_ISSUE = 3,\n DONE_BY_CLIENT = 4,\n NA = 5,\n SEND_TO_CLIENT = 6,\n CLIENT_RELAUNCHED = 7,\n DOING_BACK = 8,\n UNPAYED = 9,\n SIE_ISSUE = 10,\n ACCEPTED_BY_CLIENT = 11,\n REFUSED_BY_CLIENT = 12,\n TO_DO = 13,\n WAITING_CLIENT = 14,\n}"]}
@@ -6,6 +6,7 @@ export interface IBalanceSheet {
6
6
  state: number;
7
7
  dateBalanceSend: Date | null;
8
8
  deadline: Date | null;
9
+ bankCollectingState: number;
9
10
  idExercice: number;
10
11
  idCalendarEvent: number | null;
11
12
  createdAt?: Date | null;
@@ -1 +1 @@
1
- {"version":3,"file":"IBalanceSheet.d.ts","sourceRoot":"","sources":["../../../../ts/types/Interface/models/IBalanceSheet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,MAAM,WAAW,aAAa;IAC5B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,eAAe,EAAE,IAAI,GAAG,IAAI,CAAC;IAC7B,QAAQ,EAAE,IAAI,GAAG,IAAI,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,SAAS,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACxB,SAAS,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IAGxB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,aAAa,CAAC,EAAE,cAAc,CAAC;IAC/B,WAAW,EAAE,YAAY,CAAC;CAC3B"}
1
+ {"version":3,"file":"IBalanceSheet.d.ts","sourceRoot":"","sources":["../../../../ts/types/Interface/models/IBalanceSheet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,MAAM,WAAW,aAAa;IAC5B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,eAAe,EAAE,IAAI,GAAG,IAAI,CAAC;IAC7B,QAAQ,EAAE,IAAI,GAAG,IAAI,CAAC;IACtB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,SAAS,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACxB,SAAS,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IAGxB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,aAAa,CAAC,EAAE,cAAc,CAAC;IAC/B,WAAW,EAAE,YAAY,CAAC;CAC3B"}
@@ -1 +1 @@
1
- {"version":3,"file":"IBalanceSheet.js","sourceRoot":"","sources":["../../../../ts/types/Interface/models/IBalanceSheet.ts"],"names":[],"mappings":"","sourcesContent":["import { IExercice } from './IExercice';\nimport { ICalendarEvent } from './ICalendarEvent';\nimport { ISupervision } from './ISupervision';\n\n// balanceSheet\nexport interface IBalanceSheet {\n id?: number;\n state: number;\n dateBalanceSend: Date | null;\n deadline: Date | null;\n idExercice: number;\n idCalendarEvent: number | null;\n createdAt?: Date | null;\n updatedAt?: Date | null;\n\n // Associations\n exercice?: IExercice;\n calendarEvent?: ICalendarEvent;\n supervision: ISupervision;\n}\n"]}
1
+ {"version":3,"file":"IBalanceSheet.js","sourceRoot":"","sources":["../../../../ts/types/Interface/models/IBalanceSheet.ts"],"names":[],"mappings":"","sourcesContent":["import { IExercice } from './IExercice';\nimport { ICalendarEvent } from './ICalendarEvent';\nimport { ISupervision } from './ISupervision';\n\n// balanceSheet\nexport interface IBalanceSheet {\n id?: number;\n state: number;\n dateBalanceSend: Date | null;\n deadline: Date | null;\n bankCollectingState: number;\n idExercice: number;\n idCalendarEvent: number | null;\n createdAt?: Date | null;\n updatedAt?: Date | null;\n\n // Associations\n exercice?: IExercice;\n calendarEvent?: ICalendarEvent;\n supervision: ISupervision;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"document.d.ts","sourceRoot":"","sources":["../../../ts/utils/commercialManagement/document.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,8BAA8B,EAAuB,MAAM,qDAAqD,CAAC;AAI1H,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAOvE,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAK3E,wBAAgB,0BAA0B,CAAC,qBAAqB,EAAE,mBAAmB,EAAE,OAAO,EAAE,qBAAqB,GAAG,qBAAqB,GAAG,8BAA8B,CAoD7K;AAED,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,qBAAqB,GAAG,8BAA8B,CA6CtG"}
1
+ {"version":3,"file":"document.d.ts","sourceRoot":"","sources":["../../../ts/utils/commercialManagement/document.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,8BAA8B,EAAuB,MAAM,qDAAqD,CAAC;AAI1H,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAOvE,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAK3E,wBAAgB,0BAA0B,CAAC,qBAAqB,EAAE,mBAAmB,EAAE,OAAO,EAAE,qBAAqB,GAAG,qBAAqB,GAAG,8BAA8B,CA0D7K;AAED,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,qBAAqB,GAAG,8BAA8B,CAmDtG"}
@@ -11,11 +11,11 @@ import { vatToReadVatEditing } from './vat';
11
11
  import { thirdPartyToReadThirdPartyEditing } from './thirdParty';
12
12
  const ejs = require('ejs');
13
13
  export function generateCommercialDocument(idEstimateInvoiceType, payload) {
14
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
14
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
15
15
  const products = _orderBy(payload.products.map((product) => productToReadProductEditing(product), 'reorder'));
16
16
  const vats = _orderBy(Object.values(_groupBy(products, 'vatFormatted')).map((v) => (vatToReadVatEditing(v)), 'value')).filter((v) => v.id !== Vat.MARGE.id);
17
17
  const thirdParty = thirdPartyToReadThirdPartyEditing(payload.thirdParty);
18
- const data = Object.assign(Object.assign({}, payload), { thirdParty, paymentLink: (_a = payload.paymentLink) !== null && _a !== void 0 ? _a : '#', idEstimateInvoiceType, title: (_b = payload.title) !== null && _b !== void 0 ? _b : null, penalties: (_c = payload.penalties) !== null && _c !== void 0 ? _c : null, compensation: (_d = payload.compensation) !== null && _d !== void 0 ? _d : null, discount: (_e = payload.discount) !== null && _e !== void 0 ? _e : null, vatMention: (_f = payload.vatMention) !== null && _f !== void 0 ? _f : null, phoneContact: (_h = (_g = payload.settings) === null || _g === void 0 ? void 0 : _g.phoneContact) !== null && _h !== void 0 ? _h : null, comment: payload.comment && typeof payload.comment === 'string' ? payload.comment.replace(/\n/g, '<br/>') : payload.comment, products,
18
+ const data = Object.assign(Object.assign({}, payload), { thirdParty, paymentLink: (_a = payload.paymentLink) !== null && _a !== void 0 ? _a : '#', idEstimateInvoiceType, title: (_b = payload.title) !== null && _b !== void 0 ? _b : null, penalties: (_c = payload.penalties) !== null && _c !== void 0 ? _c : null, compensation: (_d = payload.compensation) !== null && _d !== void 0 ? _d : null, discount: (_e = payload.discount) !== null && _e !== void 0 ? _e : null, vatMention: (_f = payload.vatMention) !== null && _f !== void 0 ? _f : null, phoneContact: (_h = (_g = payload.settings) === null || _g === void 0 ? void 0 : _g.phoneContact) !== null && _h !== void 0 ? _h : null, products,
19
19
  vats, totalTaxExcluded: _sumBy(products, 'totalTaxExcluded'), totalTaxIncluded: _sumBy(products, 'totalTaxExcluded') + _sumBy(vats, 'amount'), totalTaxAndDiscountIncluded: _sumBy(products, 'totalTaxExcluded') + _sumBy(vats, 'amount'), generalDiscountFormatted: payload.generalDiscount2 ? integerToFormattedAmountString(payload.generalDiscount2) : null, depositFormatted: payload.deposit ? integerToFormattedAmountString(payload.deposit) : null, totalTaxExcludedFormatted: integerToFormattedAmountString(_sumBy(products, 'totalTaxExcluded')), totalTaxIncludedFormatted: integerToFormattedAmountString(_sumBy(products, 'totalTaxExcluded') + _sumBy(vats, 'amount')), totalTaxAndDiscountIncludedFormatted: integerToFormattedAmountString(_sumBy(products, 'totalTaxExcluded') + _sumBy(vats, 'amount') - ((_j = payload.generalDiscount2) !== null && _j !== void 0 ? _j : 0) - ((_k = payload.deposit) !== null && _k !== void 0 ? _k : 0)), totalVatAmountFormatted: integerToFormattedAmountString(_sumBy(vats, 'amount')), font: {
20
20
  id: (_m = (_l = payload.settings) === null || _l === void 0 ? void 0 : _l.idFont) !== null && _m !== void 0 ? _m : FontIds.CIRCULAR_STD,
21
21
  name: (_p = (_o = fontList.find((f) => { var _a; return f.id === ((_a = payload.settings) === null || _a === void 0 ? void 0 : _a.idFont); })) === null || _o === void 0 ? void 0 : _o.name) !== null && _p !== void 0 ? _p : fontList[0].name,
@@ -27,16 +27,19 @@ export function generateCommercialDocument(idEstimateInvoiceType, payload) {
27
27
  const documentFreeText = [EstimateInvoiceType.DEVIS, EstimateInvoiceType.BON].includes(idEstimateInvoiceType) ? (_u = payload === null || payload === void 0 ? void 0 : payload.settings) === null || _u === void 0 ? void 0 : _u.freeEstimateText : (_v = payload === null || payload === void 0 ? void 0 : payload.settings) === null || _v === void 0 ? void 0 : _v.freeInvoiceText;
28
28
  return {
29
29
  header: ejs.render(commonTemplate.header, data),
30
- body: ejs.render(bodyTemplate, data),
30
+ body: ejs.render(bodyTemplate, Object.assign(Object.assign({}, data), { comment: data.comment && typeof data.comment === 'string' ? (_w = data.comment) === null || _w === void 0 ? void 0 : _w.replace(/\n/g, '<br/>') : null, products: data.products.map((p) => {
31
+ var _a;
32
+ return (Object.assign(Object.assign({}, p), { comment: p.comment && typeof p.comment === 'string' ? (_a = p.comment) === null || _a === void 0 ? void 0 : _a.replace(/\n/g, '<br/>') : null }));
33
+ }) })),
31
34
  footer: ejs.render(commonTemplate.footer, Object.assign(Object.assign({}, data), { freeText: documentFreeText !== null && documentFreeText !== void 0 ? documentFreeText : null })),
32
35
  data,
33
36
  };
34
37
  }
35
38
  export function generateAdvanceDocument(payload) {
36
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
39
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
37
40
  if (!payload.deposit)
38
41
  throw new Error('Aucun acompte défini');
39
- const data = Object.assign(Object.assign({}, payload), { title: (_a = payload.title) !== null && _a !== void 0 ? _a : null, paymentLink: (_b = payload.paymentLink) !== null && _b !== void 0 ? _b : '#', idEstimateInvoiceType: EstimateInvoiceType.ACOMPTE, phoneContact: (_d = (_c = payload.settings) === null || _c === void 0 ? void 0 : _c.phoneContact) !== null && _d !== void 0 ? _d : null, products: [], vats: [], totalTaxExcluded: payload.deposit, totalTaxIncluded: payload.deposit, totalTaxAndDiscountIncluded: payload.deposit, generalDiscountFormatted: null, comment: payload.comment && typeof payload.comment === 'string' ? payload.comment.replace(/\n/g, '<br/>') : payload.comment, depositFormatted: integerToFormattedAmountString(payload.deposit), totalTaxExcludedFormatted: integerToFormattedAmountString(payload.deposit), totalTaxIncludedFormatted: integerToFormattedAmountString(payload.deposit), totalTaxAndDiscountIncludedFormatted: integerToFormattedAmountString(payload.deposit), totalVatAmountFormatted: integerToFormattedAmountString(0), font: {
42
+ const data = Object.assign(Object.assign({}, payload), { title: (_a = payload.title) !== null && _a !== void 0 ? _a : null, paymentLink: (_b = payload.paymentLink) !== null && _b !== void 0 ? _b : '#', idEstimateInvoiceType: EstimateInvoiceType.ACOMPTE, phoneContact: (_d = (_c = payload.settings) === null || _c === void 0 ? void 0 : _c.phoneContact) !== null && _d !== void 0 ? _d : null, products: [], vats: [], totalTaxExcluded: payload.deposit, totalTaxIncluded: payload.deposit, totalTaxAndDiscountIncluded: payload.deposit, generalDiscountFormatted: null, depositFormatted: integerToFormattedAmountString(payload.deposit), totalTaxExcludedFormatted: integerToFormattedAmountString(payload.deposit), totalTaxIncludedFormatted: integerToFormattedAmountString(payload.deposit), totalTaxAndDiscountIncludedFormatted: integerToFormattedAmountString(payload.deposit), totalVatAmountFormatted: integerToFormattedAmountString(0), font: {
40
43
  id: (_f = (_e = payload.settings) === null || _e === void 0 ? void 0 : _e.idFont) !== null && _f !== void 0 ? _f : FontIds.CIRCULAR_STD,
41
44
  name: (_h = (_g = fontList.find((f) => { var _a; return f.id === ((_a = payload.settings) === null || _a === void 0 ? void 0 : _a.idFont); })) === null || _g === void 0 ? void 0 : _g.name) !== null && _h !== void 0 ? _h : fontList[0].name,
42
45
  url: (_k = (_j = fontList.find((f) => { var _a; return f.id === ((_a = payload.settings) === null || _a === void 0 ? void 0 : _a.idFont); })) === null || _j === void 0 ? void 0 : _j.link) !== null && _k !== void 0 ? _k : fontList[0].link,
@@ -46,8 +49,11 @@ export function generateAdvanceDocument(payload) {
46
49
  const commonTemplate = new CommercialDocumentCommonHTML();
47
50
  return {
48
51
  header: ejs === null || ejs === void 0 ? void 0 : ejs.render(commonTemplate.header, data),
49
- body: ejs === null || ejs === void 0 ? void 0 : ejs.render(bodyTemplate, data),
50
- footer: ejs === null || ejs === void 0 ? void 0 : ejs.render(commonTemplate.footer, Object.assign(Object.assign({}, data), { freeText: (_q = (_p = payload === null || payload === void 0 ? void 0 : payload.settings) === null || _p === void 0 ? void 0 : _p.freeInvoiceText) !== null && _q !== void 0 ? _q : null })),
52
+ body: ejs === null || ejs === void 0 ? void 0 : ejs.render(bodyTemplate, Object.assign(Object.assign({}, data), { comment: data.comment && typeof data.comment === 'string' ? (_p = data.comment) === null || _p === void 0 ? void 0 : _p.replace(/\n/g, '<br/>') : null, products: data.products.map((p) => {
53
+ var _a;
54
+ return (Object.assign(Object.assign({}, p), { comment: p.comment && typeof p.comment === 'string' ? (_a = p.comment) === null || _a === void 0 ? void 0 : _a.replace(/\n/g, '<br/>') : null }));
55
+ }) })),
56
+ footer: ejs === null || ejs === void 0 ? void 0 : ejs.render(commonTemplate.footer, Object.assign(Object.assign({}, data), { freeText: (_r = (_q = payload === null || payload === void 0 ? void 0 : payload.settings) === null || _q === void 0 ? void 0 : _q.freeInvoiceText) !== null && _r !== void 0 ? _r : null })),
51
57
  data,
52
58
  };
53
59
  }
@@ -1 +1 @@
1
- {"version":3,"file":"document.js","sour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AAE,KAAK,CAAC,CAAC,0CAAE,KAAK,mCAAI,IAAI,CAAA,EAAA,CAAC,CAAC,EAC3H,2BAA2B,EAAE,MAAA,MAAA,sBAAsB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,OAAO,CAAC,kBAAkB,CAAC,0CAAE,KAAK,mCAAI,IAAI,GACpH,CAAC;IAEF,MAAM,cAAc,GAAG,IAAI,4BAA4B,EAAE,CAAC;IAE1D,OAAO;QACL,MAAM,EAAE,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,IAAI,CAAC;QAChD,IAAI,EAAE,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,MAAM,CAAC,YAAY,EAAE,IAAI,CAAC;QACrC,MAAM,EAAE,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,MAAM,CAAC,cAAc,CAAC,MAAM,kCAAO,IAAI,KAAE,QAAQ,EAAE,MAAA,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,QAAQ,0CAAE,eAAe,mCAAI,IAAI,IAAG;QAC7G,IAAI;KACL,CAAC;AACJ,CAAC","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 {\n AccountingCategoryList, FontIds, fontList, VatMarginCategyList,\n} 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';\nimport { thirdPartyToReadThirdPartyEditing } from './thirdParty';\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 const thirdParty = thirdPartyToReadThirdPartyEditing(payload.thirdParty);\n\n const data: ReadDocumentEditing = {\n ...payload,\n thirdParty,\n paymentLink: payload.paymentLink ?? '#',\n idEstimateInvoiceType,\n title: payload.title ?? null,\n penalties: payload.penalties ?? null,\n compensation: payload.compensation ?? null,\n discount: payload.discount ?? null,\n vatMention: payload.vatMention ?? null,\n phoneContact: payload.settings?.phoneContact ?? null,\n comment: payload.comment && typeof payload.comment === 'string' ? payload.comment.replace(/\\n/g, '<br/>') : payload.comment,\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'),\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')),\n totalTaxAndDiscountIncludedFormatted: integerToFormattedAmountString(_sumBy(products, 'totalTaxExcluded') + _sumBy(vats, 'amount') - (payload.generalDiscount2 ?? 0) - (payload.deposit ?? 0)),\n totalVatAmountFormatted: integerToFormattedAmountString(_sumBy(vats, 'amount')),\n font: {\n id: payload.settings?.idFont ?? FontIds.CIRCULAR_STD,\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 title: payload.title ?? null,\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 comment: payload.comment && typeof payload.comment === 'string' ? payload.comment.replace(/\\n/g, '<br/>') : payload.comment,\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 id: payload.settings?.idFont ?? FontIds.CIRCULAR_STD,\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","sourceRoot":"","sources":["../../../ts/utils/commercialManagement/document.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,IAAI,QAAQ,EAAE,OAAO,IAAI,QAAQ,EAAE,KAAK,IAAI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L,CAAC;AACJ,CAAC","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 {\n AccountingCategoryList, FontIds, fontList, VatMarginCategyList,\n} 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';\nimport { thirdPartyToReadThirdPartyEditing } from './thirdParty';\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 const thirdParty = thirdPartyToReadThirdPartyEditing(payload.thirdParty);\n\n const data: ReadDocumentEditing = {\n ...payload,\n thirdParty,\n paymentLink: payload.paymentLink ?? '#',\n idEstimateInvoiceType,\n title: payload.title ?? null,\n penalties: payload.penalties ?? null,\n compensation: payload.compensation ?? null,\n discount: payload.discount ?? null,\n vatMention: payload.vatMention ?? null,\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'),\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')),\n totalTaxAndDiscountIncludedFormatted: integerToFormattedAmountString(_sumBy(products, 'totalTaxExcluded') + _sumBy(vats, 'amount') - (payload.generalDiscount2 ?? 0) - (payload.deposit ?? 0)),\n totalVatAmountFormatted: integerToFormattedAmountString(_sumBy(vats, 'amount')),\n font: {\n id: payload.settings?.idFont ?? FontIds.CIRCULAR_STD,\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, {\n ...data,\n comment: data.comment && typeof data.comment === 'string' ? data.comment?.replace(/\\n/g, '<br/>') : null,\n products: data.products.map((p) => ({\n ...p,\n comment: p.comment && typeof p.comment === 'string' ? p.comment?.replace(/\\n/g, '<br/>') : null,\n })),\n }),\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 title: payload.title ?? null,\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 id: payload.settings?.idFont ?? FontIds.CIRCULAR_STD,\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, {\n ...data,\n comment: data.comment && typeof data.comment === 'string' ? data.comment?.replace(/\\n/g, '<br/>') : null,\n products: data.products.map((p) => ({\n ...p,\n comment: p.comment && typeof p.comment === 'string' ? p.comment?.replace(/\\n/g, '<br/>') : null,\n })),\n }),\n footer: ejs?.render(commonTemplate.footer, { ...data, freeText: payload?.settings?.freeInvoiceText ?? null }),\n data,\n };\n}"]}
@@ -1 +1 @@
1
- {"version":3,"file":"product.d.ts","sourceRoot":"","sources":["../../../ts/utils/commercialManagement/product.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAMlE,wBAAgB,WAAW,CAAC,OAAO,EAAE,eAAe,GAAG,MAAM,CAU5D;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,eAAe,GAAG,MAAM,CAGpE;AAED,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,eAAe,GAAG,kBAAkB,CAaxF"}
1
+ {"version":3,"file":"product.d.ts","sourceRoot":"","sources":["../../../ts/utils/commercialManagement/product.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAMlE,wBAAgB,WAAW,CAAC,OAAO,EAAE,eAAe,GAAG,MAAM,CAU5D;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,eAAe,GAAG,MAAM,CAGpE;AAED,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,eAAe,GAAG,kBAAkB,CAYxF"}
@@ -22,6 +22,6 @@ export function getTotalTaxExcluded(product) {
22
22
  }
23
23
  export function productToReadProductEditing(payload) {
24
24
  var _a, _b, _c, _d, _e, _f;
25
- return Object.assign(Object.assign({}, payload), { comment: payload.comment && typeof payload.comment === 'string' ? payload.comment.replace(/\n/g, '<br/>') : payload.comment, totalTaxExcluded: getTotalTaxExcluded(payload), unitFormatted: (_b = (_a = Object.values(Unit).find((unit) => unit.id === payload.unit)) === null || _a === void 0 ? void 0 : _a.shortName) !== null && _b !== void 0 ? _b : '', vatFormatted: (_d = (_c = getById(payload.idVat)) === null || _c === void 0 ? void 0 : _c.saleName) !== null && _d !== void 0 ? _d : '', priceTaxExcludedFormatted: isDefined(payload.priceTaxExcluded) ? integerToFormattedAmountString(payload.priceTaxExcluded) : null, totalTaxExcludedFormatted: isDefined(payload.priceTaxExcluded) ? integerToFormattedAmountString(getTotalTaxExcluded(payload)) : null, discountFormatted: payload.discount2 && payload.discount2 > 0 ? integerToFormattedAmountString(getDiscount(payload)) : null, discountTypeFormatted: payload.discount2 && payload.discount2 > 0 ? payload.discountType === DiscountType.PERCENT ? `${(payload.discount2 / 100).toFixed(2)}%` : `${integerToFormattedAmountString(payload.discount2)}€` : null, marginVatFormatted: payload.marginVatType ? (_f = (_e = VatMarginCategyList.find((c) => c.id === payload.marginVatType)) === null || _e === void 0 ? void 0 : _e.label) !== null && _f !== void 0 ? _f : null : null });
25
+ return Object.assign(Object.assign({}, payload), { totalTaxExcluded: getTotalTaxExcluded(payload), unitFormatted: (_b = (_a = Object.values(Unit).find((unit) => unit.id === payload.unit)) === null || _a === void 0 ? void 0 : _a.shortName) !== null && _b !== void 0 ? _b : '', vatFormatted: (_d = (_c = getById(payload.idVat)) === null || _c === void 0 ? void 0 : _c.saleName) !== null && _d !== void 0 ? _d : '', priceTaxExcludedFormatted: isDefined(payload.priceTaxExcluded) ? integerToFormattedAmountString(payload.priceTaxExcluded) : null, totalTaxExcludedFormatted: isDefined(payload.priceTaxExcluded) ? integerToFormattedAmountString(getTotalTaxExcluded(payload)) : null, discountFormatted: payload.discount2 && payload.discount2 > 0 ? integerToFormattedAmountString(getDiscount(payload)) : null, discountTypeFormatted: payload.discount2 && payload.discount2 > 0 ? payload.discountType === DiscountType.PERCENT ? `${(payload.discount2 / 100).toFixed(2)}%` : `${integerToFormattedAmountString(payload.discount2)}€` : null, marginVatFormatted: payload.marginVatType ? (_f = (_e = VatMarginCategyList.find((c) => c.id === payload.marginVatType)) === null || _e === void 0 ? void 0 : _e.label) !== null && _f !== void 0 ? _f : null : null });
26
26
  }
27
27
  //# sourceMappingURL=product.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"product.js","sourceRoot":"","sources":["../../../ts/utils/commercialManagement/product.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAC1F,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,8BAA8B,EAAE,MAAM,WAAW,CAAC;AAE3D,MAAM,UAAU,WAAW,CAAC,OAAwB;;IAClD,IAAI,OAAO,CAAC,SAAS,KAAK,IAAI,IAAI,OAAO,CAAC,SAAS,KAAK,SAAS,IAAI,OAAO,CAAC,SAAS,IAAI,CAAC;QAAE,OAAO,CAAC,CAAC;IAEtG,IAAI,OAAO,CAAC,YAAY,KAAK,YAAY,CAAC,OAAO,EAAE;QACjD,OAAO,CAAC,CAAC,MAAA,OAAO,CAAC,gBAAgB,mCAAI,CAAC,CAAC,GAAG,CAAC,CAAC,MAAA,OAAO,CAAC,SAAS,mCAAI,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC;KACnF;IAAC,IAAI,OAAO,CAAC,YAAY,KAAK,YAAY,CAAC,MAAM,EAAE;QAClD,OAAO,CAAC,MAAA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AAC,CAAC,8BAA8B,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EACpI,iBAAiB,EAAE,OAAO,CAAC,SAAS,IAAI,OAAO,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC,CAAC,8BAA8B,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAC3H,qBAAqB,EAAE,OAAO,CAAC,SAAS,IAAI,OAAO,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,KAAK,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,SAAS,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,8BAA8B,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAC/N,kBAAkB,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,MAAA,MAAA,mBAAmB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,OAAO,CAAC,aAAa,CAAC,0CAAE,KAAK,mCAAI,IAAI,CAAC,CAAC,CAAC,IAAI,IACjI;AACJ,CAAC","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 comment: payload.comment && typeof payload.comment === 'string' ? payload.comment.replace(/\\n/g, '<br/>') : payload.comment,\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}"]}
1
+ {"version":3,"file":"product.js","sourceRoot":"","sources":["../../../ts/utils/commercialManagement/product.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAC1F,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,8BAA8B,EAAE,MAAM,WAAW,CAAC;AAE3D,MAAM,UAAU,WAAW,CAAC,OAAwB;;IAClD,IAAI,OAAO,CAAC,SAAS,KAAK,IAAI,I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,mCAAI,EAAE,EACpD,yBAAyB,EAAE,SAAS,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,8BAA8B,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,IAAI,EAChI,yBAAyB,EAAE,SAAS,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,8BAA8B,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EACpI,iBAAiB,EAAE,OAAO,CAAC,SAAS,IAAI,OAAO,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC,CAAC,8BAA8B,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAC3H,qBAAqB,EAAE,OAAO,CAAC,SAAS,IAAI,OAAO,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,KAAK,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,SAAS,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,8BAA8B,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAC/N,kBAAkB,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,MAAA,MAAA,mBAAmB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,OAAO,CAAC,aAAa,CAAC,0CAAE,KAAK,mCAAI,IAAI,CAAC,CAAC,CAAC,IAAI,IACjI;AACJ,CAAC","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}"]}
@@ -51,8 +51,8 @@ const headOfDocument = `<div class="row space-between">
51
51
  <p></p>
52
52
  <% if (thirdParty) { %>
53
53
  <div class="<%= settings && settings.isCoordinatesFrameDisplayed ? 'customer-border' : '' %>">
54
- <% if(thirdParty.fullname) {%><b><%= thirdParty.fullname %></b><br/><% } %>
55
- <% if(thirdParty.company) {%><%= thirdParty.company %><br/><% } %>
54
+ <% if(thirdParty.company) {%><b><%= thirdParty.company %></b><br/><% } %>
55
+ <% if(thirdParty.fullname) {%><%= thirdParty.fullname %><br/><% } %>
56
56
  <% if(thirdParty.address) {%><%= thirdParty.address %><br/><% } %>
57
57
  <% if(thirdParty.zipCode) {%><%= thirdParty.zipCode + ' ' %><% } %><%= thirdParty.city %> <%= thirdParty.country %><br/>
58
58
  <% if(thirdParty.deliveryAddress && thirdParty.deliveryCity && thirdParty.deliveryZipCode) {%>Adresse de livraison : <%= thirdParty.deliveryAddress %> <%= thirdParty.deliveryZipCode %> <%= thirdParty.deliveryCity %> <%= thirdParty.deliveryCountry %><br/><% } %>
@@ -1 +1 @@
1
- {"version":3,"file":"body.js","sourceRoot":"","sources":["../../../../ts/utils/commercialManagement/templates/body.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,4BAA4B,EAAE,MAAM,UAAU,CAAC;AAExD,MAAM,cAAc,GAAG,IAAI,4BAA4B,EAAE,CAAC;AAE1D,MAAM,cAAc,GAAG;;;YAGX,cAAc,CAAC,IAAI;YACnB,cAAc,CAAC,OAAO;;;4CAGU,cAAc,CAAC,OAAO;UACxD,cAAc,CAAC,IAAI;;;;;;;yCAOY,mBAAmB,CAAC,GAAG;;gDAEhB,mBAAmB,CAAC,KAAK;;gDAEzB,mBAAmB,CAAC,OAAO;;gDAE3B,mBAAmB,CAAC,KAAK;;gDAEzB,mBAAmB,CAAC,KAAK;;gDAEzB,mBAAmB,CAAC,OAAO;;;;;mDAKxB,mBAAmB,CAAC,OAAO;;oBAE1D,mBAAmB,CAAC,GAAG,KAAK,mBAAmB,CAAC,KAAK;;;;;;;2DAOd,mBAAmB,CAAC,OAAO;;;;mDAInC,mBAAmB,CAAC,GAAG,KAAK,mBAAmB,CAAC,KAAK;;;;;;;;;;;;;;;;;SAiB/F,CAAC;AAEV,MAAM,CAAC,MAAM,YAAY,GAAG;;;;IAIxB,cAAc;;;;;;6BAMW,cAAc,CAAC,QAAQ;;;;;YAKxC,cAAc,CAAC,iBAAiB;;;;;;;;;;UAUlC,cAAc,CAAC,oBAAoB;;;8DAGiB,cAAc,CAAC,aAAa;;;;;;;;;;;;;;;;wEAgBlB,mBAAmB,CAAC,KAAK,iCAAiC,mBAAmB,CAAC,GAAG;;;;oFAIrE,mBAAmB,CAAC,KAAK,iCAAiC,mBAAmB,CAAC,GAAG;;;;;;;QAO7J,cAAc,CAAC,KAAK;;QAEpB,CAAC","sourcesContent":["import { EstimateInvoiceType } from '../../../types/Enum/EstimateInvoice';\nimport { CommercialDocumentCommonHTML } from './common';\n\nconst commonTemplate = new CommercialDocumentCommonHTML();\n\nconst headOfDocument = `<div class=\"row space-between\">\n <% if (settings && settings.logoAlignment === 'left') { %>\n <div class=\"society-informations\">\n ${commonTemplate.logo}\n ${commonTemplate.company}\n </div>\n <% } else { %>\n <div class=\"society-informations\">${commonTemplate.company}</div>\n ${commonTemplate.logo}\n <% } %>\n </div>\n\n <div class=\"row space-between items-end\" style=\"margin-top: 10px\">\n <div style=\"width: 45%; margin-top: auto;\">\n <span class=\"document-reference\">\n <% if (idEstimateInvoiceType === ${EstimateInvoiceType.BON}) { %>\n Bon de commande\n <% } else if (idEstimateInvoiceType === ${EstimateInvoiceType.DEVIS}) { %>\n Devis\n <% } else if (idEstimateInvoiceType === ${EstimateInvoiceType.FACTURE}) { %>\n Facture\n <% } else if (idEstimateInvoiceType === ${EstimateInvoiceType.AVOIR}) { %>\n Avoir\n <% } else if (idEstimateInvoiceType === ${EstimateInvoiceType.RESTE}) { %>\n Facture de solde\n <% } else if (idEstimateInvoiceType === ${EstimateInvoiceType.ACOMPTE}) { %>\n Facture d'acompte\n <% } %>\n <%= reference %></span><br/>\n <% if(emissionDate) {%><span class=\"document-emission-date\">Date d’émission : <%= emissionDateFormatted %></span><br/><% } %>\n <% if(dueDate && idEstimateInvoiceType !== ${EstimateInvoiceType.ACOMPTE}) {%>\n <span class=\"document-due-date\">\n <% if ([${EstimateInvoiceType.BON}, ${EstimateInvoiceType.DEVIS}].includes(idEstimateInvoiceType)) {%>\n Valide jusqu'au :\n <% } else { %>\n Date d'échéance :\n <% } %>\n <%= dueDateFormatted %></span>\n <% } %>\n <% if (expirationDate && idEstimateInvoiceType === ${EstimateInvoiceType.ACOMPTE}) {%>\n <span class=\"document-due-date\">Date d'expiration : <%= expirationDateFormatted %></span>\n <% } %>\n <% if(termsOfPayment) { %>\n <br/><p style=\"margin-bottom: 0px;\"><%= [${EstimateInvoiceType.BON}, ${EstimateInvoiceType.DEVIS}].includes(idEstimateInvoiceType) ? 'Conditions de règlement' : 'Date limite de règlement' %> : <%= termsOfPayment %></p>\n <% } %>\n </div>\n <div style=\"width: 40%; margin-top: auto;\">\n <p></p>\n <% if (thirdParty) { %>\n <div class=\"<%= settings && settings.isCoordinatesFrameDisplayed ? 'customer-border' : '' %>\">\n <% if(thirdParty.fullname) {%><b><%= thirdParty.fullname %></b><br/><% } %>\n <% if(thirdParty.company) {%><%= thirdParty.company %><br/><% } %>\n <% if(thirdParty.address) {%><%= thirdParty.address %><br/><% } %>\n <% if(thirdParty.zipCode) {%><%= thirdParty.zipCode + ' ' %><% } %><%= thirdParty.city %> <%= thirdParty.country %><br/>\n <% if(thirdParty.deliveryAddress && thirdParty.deliveryCity && thirdParty.deliveryZipCode) {%>Adresse de livraison : <%= thirdParty.deliveryAddress %> <%= thirdParty.deliveryZipCode %> <%= thirdParty.deliveryCity %> <%= thirdParty.deliveryCountry %><br/><% } %>\n <% if(thirdParty.nSiret) {%>SIRET : <%= thirdParty.nSiret %><br/><% } %>\n <% if(thirdParty.nTva) {%>N° TVA : <%= thirdParty.nTva %><% } %>\n </div>\n <% } %>\n </div>\n </div>`;\n\nexport const bodyTemplate = `<html class=\"pdf-content\">\n\n <body>\n\n ${headOfDocument}\n\n <div class=\"row mt-25\">\n <% if (title) { %>Titre : <%= title %><% } %>\n </div>\n\n <div class=\"row mt-10\">${commonTemplate.products}</div>\n\n <div class=\"row space-between mt-20\">\n <div style=\"width: 55%;\">\n <% if (disableVat !== true && vats.length) { %>\n ${commonTemplate.vatRecapitulation}\n <% } %>\n <% if (vatMention) { %><div class=\"vat-mention <%= disableVat !== true ? 'mt-20' : ''%>\"><%= vatMention %></div><% } %>\n <% if (comment) { %>\n <p class=\"mt-20\">Commentaire :<br/>\n <%- comment %>\n <% } %>\n </div>\n\n <div>\n ${commonTemplate.amountRecapitulation}\n\n <% if (isStripeAllowed) { %>\n <div style=\"text-align: right; margin-top: 30px;\">${commonTemplate.paymentButton}</div>\n <% } %>\n </div>\n \n </div>\n\n <% if (settings && (settings.iban || settings.bic)) { %>\n <div class=\"row mt-30 space-between\" style=\"page-break-inside: avoid !important;\">\n <div>\n <% if (settings && (settings.iban || settings.bic)) { %>\n <% if(settings.iban) { %>IBAN : <%= settings.iban %><br/><% } %>\n <% if(settings.bic) { %>BIC : <%= settings.bic %><% } %>\n <% } %>\n </div>\n </div>\n <% } %>\n <% if (settings && settings.bonPour && (idEstimateInvoiceType === ${EstimateInvoiceType.DEVIS} || idEstimateInvoiceType === ${EstimateInvoiceType.BON})) { %>\n <br/>Bon pour accord : <br/><br/><br/><br/>\n <% } %>\n\n <% if (cgv && ((settings && settings.invoiceCgv) || idEstimateInvoiceType === ${EstimateInvoiceType.DEVIS} || idEstimateInvoiceType === ${EstimateInvoiceType.BON})) { %>\n <br><div style=\"page-break-after:always;\"></div>\n <%- cgv %>\n <% } %>\n </body>\n\n <style>\n ${commonTemplate.style}\n </style>\n</html>`;"]}
1
+ {"version":3,"file":"body.js","sourceRoot":"","sources":["../../../../ts/utils/commercialManagement/templates/body.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,4BAA4B,EAAE,MAAM,UAAU,CAAC;AAExD,MAAM,cAAc,GAAG,IAAI,4BAA4B,EAAE,CAAC;AAE1D,MAAM,cAAc,GAAG;;;YAGX,cAAc,CAAC,IAAI;YACnB,cAAc,CAAC,OAAO;;;4CAGU,cAAc,CAAC,OAAO;UACxD,cAAc,CAAC,IAAI;;;;;;;yCAOY,mBAAmB,CAAC,GAAG;;gDAEhB,mBAAmB,CAAC,KAAK;;gDAEzB,mBAAmB,CAAC,OAAO;;gDAE3B,mBAAmB,CAAC,KAAK;;gDAEzB,mBAAmB,CAAC,KAAK;;gDAEzB,mBAAmB,CAAC,OAAO;;;;;mDAKxB,mBAAmB,CAAC,OAAO;;oBAE1D,mBAAmB,CAAC,GAAG,KAAK,mBAAmB,CAAC,KAAK;;;;;;;2DAOd,mBAAmB,CAAC,OAAO;;;;mDAInC,mBAAmB,CAAC,GAAG,KAAK,mBAAmB,CAAC,KAAK;;;;;;;;;;;;;;;;;SAiB/F,CAAC;AAEV,MAAM,CAAC,MAAM,YAAY,GAAG;;;;IAIxB,cAAc;;;;;;6BAMW,cAAc,CAAC,QAAQ;;;;;YAKxC,cAAc,CAAC,iBAAiB;;;;;;;;;;UAUlC,cAAc,CAAC,oBAAoB;;;8DAGiB,cAAc,CAAC,aAAa;;;;;;;;;;;;;;;;wEAgBlB,mBAAmB,CAAC,KAAK,iCAAiC,mBAAmB,CAAC,GAAG;;;;oFAIrE,mBAAmB,CAAC,KAAK,iCAAiC,mBAAmB,CAAC,GAAG;;;;;;;QAO7J,cAAc,CAAC,KAAK;;QAEpB,CAAC","sourcesContent":["import { EstimateInvoiceType } from '../../../types/Enum/EstimateInvoice';\nimport { CommercialDocumentCommonHTML } from './common';\n\nconst commonTemplate = new CommercialDocumentCommonHTML();\n\nconst headOfDocument = `<div class=\"row space-between\">\n <% if (settings && settings.logoAlignment === 'left') { %>\n <div class=\"society-informations\">\n ${commonTemplate.logo}\n ${commonTemplate.company}\n </div>\n <% } else { %>\n <div class=\"society-informations\">${commonTemplate.company}</div>\n ${commonTemplate.logo}\n <% } %>\n </div>\n\n <div class=\"row space-between items-end\" style=\"margin-top: 10px\">\n <div style=\"width: 45%; margin-top: auto;\">\n <span class=\"document-reference\">\n <% if (idEstimateInvoiceType === ${EstimateInvoiceType.BON}) { %>\n Bon de commande\n <% } else if (idEstimateInvoiceType === ${EstimateInvoiceType.DEVIS}) { %>\n Devis\n <% } else if (idEstimateInvoiceType === ${EstimateInvoiceType.FACTURE}) { %>\n Facture\n <% } else if (idEstimateInvoiceType === ${EstimateInvoiceType.AVOIR}) { %>\n Avoir\n <% } else if (idEstimateInvoiceType === ${EstimateInvoiceType.RESTE}) { %>\n Facture de solde\n <% } else if (idEstimateInvoiceType === ${EstimateInvoiceType.ACOMPTE}) { %>\n Facture d'acompte\n <% } %>\n <%= reference %></span><br/>\n <% if(emissionDate) {%><span class=\"document-emission-date\">Date d’émission : <%= emissionDateFormatted %></span><br/><% } %>\n <% if(dueDate && idEstimateInvoiceType !== ${EstimateInvoiceType.ACOMPTE}) {%>\n <span class=\"document-due-date\">\n <% if ([${EstimateInvoiceType.BON}, ${EstimateInvoiceType.DEVIS}].includes(idEstimateInvoiceType)) {%>\n Valide jusqu'au :\n <% } else { %>\n Date d'échéance :\n <% } %>\n <%= dueDateFormatted %></span>\n <% } %>\n <% if (expirationDate && idEstimateInvoiceType === ${EstimateInvoiceType.ACOMPTE}) {%>\n <span class=\"document-due-date\">Date d'expiration : <%= expirationDateFormatted %></span>\n <% } %>\n <% if(termsOfPayment) { %>\n <br/><p style=\"margin-bottom: 0px;\"><%= [${EstimateInvoiceType.BON}, ${EstimateInvoiceType.DEVIS}].includes(idEstimateInvoiceType) ? 'Conditions de règlement' : 'Date limite de règlement' %> : <%= termsOfPayment %></p>\n <% } %>\n </div>\n <div style=\"width: 40%; margin-top: auto;\">\n <p></p>\n <% if (thirdParty) { %>\n <div class=\"<%= settings && settings.isCoordinatesFrameDisplayed ? 'customer-border' : '' %>\">\n <% if(thirdParty.company) {%><b><%= thirdParty.company %></b><br/><% } %>\n <% if(thirdParty.fullname) {%><%= thirdParty.fullname %><br/><% } %>\n <% if(thirdParty.address) {%><%= thirdParty.address %><br/><% } %>\n <% if(thirdParty.zipCode) {%><%= thirdParty.zipCode + ' ' %><% } %><%= thirdParty.city %> <%= thirdParty.country %><br/>\n <% if(thirdParty.deliveryAddress && thirdParty.deliveryCity && thirdParty.deliveryZipCode) {%>Adresse de livraison : <%= thirdParty.deliveryAddress %> <%= thirdParty.deliveryZipCode %> <%= thirdParty.deliveryCity %> <%= thirdParty.deliveryCountry %><br/><% } %>\n <% if(thirdParty.nSiret) {%>SIRET : <%= thirdParty.nSiret %><br/><% } %>\n <% if(thirdParty.nTva) {%>N° TVA : <%= thirdParty.nTva %><% } %>\n </div>\n <% } %>\n </div>\n </div>`;\n\nexport const bodyTemplate = `<html class=\"pdf-content\">\n\n <body>\n\n ${headOfDocument}\n\n <div class=\"row mt-25\">\n <% if (title) { %>Titre : <%= title %><% } %>\n </div>\n\n <div class=\"row mt-10\">${commonTemplate.products}</div>\n\n <div class=\"row space-between mt-20\">\n <div style=\"width: 55%;\">\n <% if (disableVat !== true && vats.length) { %>\n ${commonTemplate.vatRecapitulation}\n <% } %>\n <% if (vatMention) { %><div class=\"vat-mention <%= disableVat !== true ? 'mt-20' : ''%>\"><%= vatMention %></div><% } %>\n <% if (comment) { %>\n <p class=\"mt-20\">Commentaire :<br/>\n <%- comment %>\n <% } %>\n </div>\n\n <div>\n ${commonTemplate.amountRecapitulation}\n\n <% if (isStripeAllowed) { %>\n <div style=\"text-align: right; margin-top: 30px;\">${commonTemplate.paymentButton}</div>\n <% } %>\n </div>\n \n </div>\n\n <% if (settings && (settings.iban || settings.bic)) { %>\n <div class=\"row mt-30 space-between\" style=\"page-break-inside: avoid !important;\">\n <div>\n <% if (settings && (settings.iban || settings.bic)) { %>\n <% if(settings.iban) { %>IBAN : <%= settings.iban %><br/><% } %>\n <% if(settings.bic) { %>BIC : <%= settings.bic %><% } %>\n <% } %>\n </div>\n </div>\n <% } %>\n <% if (settings && settings.bonPour && (idEstimateInvoiceType === ${EstimateInvoiceType.DEVIS} || idEstimateInvoiceType === ${EstimateInvoiceType.BON})) { %>\n <br/>Bon pour accord : <br/><br/><br/><br/>\n <% } %>\n\n <% if (cgv && ((settings && settings.invoiceCgv) || idEstimateInvoiceType === ${EstimateInvoiceType.DEVIS} || idEstimateInvoiceType === ${EstimateInvoiceType.BON})) { %>\n <br><div style=\"page-break-after:always;\"></div>\n <%- cgv %>\n <% } %>\n </body>\n\n <style>\n ${commonTemplate.style}\n </style>\n</html>`;"]}
@@ -16,7 +16,7 @@ const Vat = exports.Vat = {
16
16
  roundPercentage: [0],
17
17
  isVatImportation: false,
18
18
  isVatIntracom: false,
19
- saleName: 'Hors-Taxe'
19
+ saleName: 'HT'
20
20
  },
21
21
  TX_5_5: {
22
22
  id: 2,
@@ -1 +1 @@
1
- {"version":3,"file":"Vat.js","mappings":";;;;;AAmBO,MAAMA,GAAG,WAAHA,GAAG,GAAe;EAC7BC,YAAY,EAAE;IACZC,EAAE,EAAE,CADQ;IAEZC,KAAK,EAAE,CAFK;IAGZC,KAAK,EAAE,CAHK;IAIZC,YAAY,EAAE,CAJF;IAKZC,IAAI,EAAE,WALM;IAMZC,SAAS,EAAE,GANC;IAOZC,UAAU,EAAE,GAPA;IAQZC,cAAc,EAAE,EARJ;IASZC,eAAe,EAAE,CAAC,CAAD,CATL;IAUZC,gBAAgB,EAAE,KAVN;IAWZC,aAAa,EAAE,KAXH;IAYZC,QAAQ,EAAE;EAZE,CADe;EAe7BC,MAAM,EAAE;IACNZ,EAAE,EAAE,CADE;IAENC,KAAK,EAAE,CAFD;IAGNC,KAAK,EAAE,GAHD;IAINC,YAAY,EAAE,CAJR;IAKNC,IAAI,EAAE,UALA;IAMNC,SAAS,EAAE,GANL;IAONC,UAAU,EAAE,CAPN;IAQNC,cAAc,EAAE,EARV;IASNC,eAAe,EAAE,CAAC,CAAD,EAAI,CAAJ,CATX;IAUNC,gBAAgB,EAAE,KAVZ;IAWNC,aAAa,EAAE,KAXT;IAYNC,QAAQ,EAAE;EAZJ,CAfqB;EA6B7BE,KAAK,EAAE;IACLb,EA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YoB,QAgBX,WAhBWA,QAgBX,YAhBD;;AAAA,WAAYA,QAAZ,EAAoB;EAClBA;EACAA;EACAA;EACAA;EACAA;EACAA;EACAA;EACAA;EACAA;EACAA;EACAA;EACAA;EACAA;EACAA;EACAA;AACD,CAhBD,EAAYA,QAAQ,aAARA,QAAQ,GAARA,QAAQ,MAApB","names":["Vat","WITHOUT_TAXE","id","idTva","value","displayOrder","name","collected","deductible","immobilization","roundPercentage","isVatImportation","isVatIntracom","saleName","TX_5_5","TX_10","TX_20","TX_2_1","TX_8_5","MARGE","INTRACOM_TX_20","INTRACOM_WITHOUT_TAXE","INTRACOM_TX_5_5","INTRACOM_TX_10","INTRACOM_TX_2_1","INTRACOM_TX_8_5","IMPORTATION_WITHOUT_TAXE","IMPORTATION_TX_5_5","IMPORTATION_TX_10","IMPORTATION_TX_20","IMPORTATION_TX_2_1","IMPORTATION_TX_8_5","MANUAL","VatState"],"sourceRoot":"","sources":["../../../ts/types/Enum/Vat.ts"],"sourcesContent":["export interface VatType{\n id: number;\n idTva: number;\n value: number;\n displayOrder: number;\n name: string;\n collected: number;\n deductible: number;\n immobilization: number | null;\n roundPercentage: number[];\n isVatImportation: boolean;\n isVatIntracom: boolean;\n saleName: string; // Used for commercial documents\n}\n\nexport interface VatTypeEnum {\n [key: string]: VatType\n}\n\nexport const Vat:VatTypeEnum = {\n WITHOUT_TAXE: {\n id: 1,\n idTva: 1,\n value: 0,\n displayOrder: 6,\n name: 'Hors-Taxe',\n collected: 212,\n deductible: 221,\n immobilization: 19,\n roundPercentage: [0],\n isVatImportation: false,\n isVatIntracom: false,\n saleName: 'Hors-Taxe',\n },\n TX_5_5: {\n id: 2,\n idTva: 2,\n value: 5.5,\n displayOrder: 4,\n name: 'TVA 5.5%',\n collected: 209,\n deductible: 4,\n immobilization: 10,\n roundPercentage: [5, 6],\n isVatImportation: false,\n isVatIntracom: false,\n saleName: '5.5%',\n },\n TX_10: {\n id: 3,\n idTva: 3,\n value: 10,\n displayOrder: 2,\n name: 'TVA 10%',\n collected: 210,\n deductible: 5,\n immobilization: 11,\n roundPercentage: [10, 11],\n isVatImportation: false,\n isVatIntracom: false,\n saleName: '10%',\n },\n TX_20: {\n id: 4,\n idTva: 4,\n value: 20,\n displayOrder: 1,\n name: 'TVA 20%',\n collected: 211,\n deductible: 6,\n immobilization: 12,\n roundPercentage: [19, 20, 21],\n isVatImportation: false,\n isVatIntracom: false,\n saleName: '20%',\n },\n TX_2_1: {\n id: 6,\n idTva: 6,\n value: 2.1,\n displayOrder: 5,\n name: 'TVA 2.1%',\n collected: 222,\n deductible: 7,\n immobilization: 13,\n roundPercentage: [2, 3],\n isVatImportation: false,\n isVatIntracom: false,\n saleName: '2.1%',\n },\n TX_8_5: {\n id: 7,\n idTva: 7,\n value: 8.5,\n displayOrder: 3,\n name: 'TVA 8.5%',\n collected: 345,\n deductible: 8,\n immobilization: 15,\n roundPercentage: [8, 9],\n isVatImportation: false,\n isVatIntracom: false,\n saleName: '8.5%',\n },\n MARGE: {\n id: 8,\n idTva: 8,\n value: 0,\n displayOrder: 9,\n name: 'Sur Marge',\n collected: 211,\n deductible: 9,\n immobilization: null,\n roundPercentage: [],\n isVatImportation: false,\n isVatIntracom: false,\n saleName: 'Sur marge',\n },\n INTRACOM_TX_20: {\n id: 9,\n idTva: 9,\n value: 20,\n displayOrder: 7,\n name: 'TVA Intracom 20%',\n collected: 207,\n deductible: 208,\n immobilization: 208,\n roundPercentage: [],\n isVatImportation: false,\n isVatIntracom: true,\n saleName: '20%',\n },\n INTRACOM_WITHOUT_TAXE: {\n id: 17,\n idTva: 17,\n value: 0,\n displayOrder: 7,\n name: 'TVA Intracom Hors-Taxe',\n collected: 207,\n deductible: 208,\n immobilization: 208,\n roundPercentage: [],\n isVatImportation: false,\n isVatIntracom: true,\n saleName: 'Hors-Taxe',\n },\n INTRACOM_TX_5_5: {\n id: 18,\n idTva: 18,\n value: 5.5,\n displayOrder: 7,\n name: 'TVA Intracom 5.5%',\n collected: 207,\n deductible: 208,\n immobilization: 208,\n roundPercentage: [],\n isVatImportation: false,\n isVatIntracom: true,\n saleName: '5.5%',\n },\n INTRACOM_TX_10: {\n id: 19,\n idTva: 19,\n value: 10,\n displayOrder: 7,\n name: 'TVA Intracom 10%',\n collected: 207,\n deductible: 208,\n immobilization: 208,\n roundPercentage: [],\n isVatImportation: false,\n isVatIntracom: true,\n saleName: '10%',\n },\n INTRACOM_TX_2_1: {\n id: 20,\n idTva: 20,\n value: 2.1,\n displayOrder: 7,\n name: 'TVA Intracom 2.1%',\n collected: 207,\n deductible: 208,\n immobilization: 208,\n roundPercentage: [],\n isVatImportation: false,\n isVatIntracom: true,\n saleName: '2.1%',\n },\n INTRACOM_TX_8_5: {\n id: 21,\n idTva: 21,\n value: 8.5,\n displayOrder: 7,\n name: 'TVA Intracom 8.5%',\n collected: 207,\n deductible: 208,\n immobilization: 208,\n roundPercentage: [],\n isVatImportation: false,\n isVatIntracom: true,\n saleName: '8.5%',\n },\n IMPORTATION_WITHOUT_TAXE: {\n id: 10,\n idTva: 10,\n value: 0,\n displayOrder: 8,\n name: 'TVA Importation Hors-Taxe',\n collected: 572,\n deductible: 573,\n immobilization: 573,\n roundPercentage: [],\n isVatImportation: true,\n isVatIntracom: false,\n saleName: 'Hors-Taxe',\n },\n IMPORTATION_TX_5_5: {\n id: 12,\n idTva: 12,\n value: 5.5,\n displayOrder: 8,\n name: 'TVA Importation 5.5%',\n collected: 574,\n deductible: 575,\n immobilization: 575,\n roundPercentage: [],\n isVatImportation: true,\n isVatIntracom: false,\n saleName: '5.5%',\n },\n IMPORTATION_TX_10: {\n id: 13,\n idTva: 13,\n value: 10,\n displayOrder: 8,\n name: 'TVA Importation 10%',\n collected: 576,\n deductible: 577,\n immobilization: 577,\n roundPercentage: [],\n isVatImportation: true,\n isVatIntracom: false,\n saleName: '10%',\n },\n IMPORTATION_TX_20: {\n id: 14,\n idTva: 14,\n value: 20,\n displayOrder: 8,\n name: 'TVA Importation 20%',\n collected: 578,\n deductible: 579,\n immobilization: 579,\n roundPercentage: [],\n isVatImportation: true,\n isVatIntracom: false,\n saleName: '20%',\n },\n IMPORTATION_TX_2_1: {\n id: 15,\n idTva: 15,\n value: 2.1,\n displayOrder: 8,\n name: 'TVA Importation 2.1%',\n collected: 580,\n deductible: 581,\n immobilization: 581,\n roundPercentage: [],\n isVatImportation: true,\n isVatIntracom: false,\n saleName: '2.1%',\n },\n IMPORTATION_TX_8_5: {\n id: 16,\n idTva: 16,\n value: 8.5,\n displayOrder: 8,\n name: 'TVA Importation 8.5%',\n collected: 582,\n deductible: 583,\n immobilization: 583,\n roundPercentage: [],\n isVatImportation: true,\n isVatIntracom: false,\n saleName: '8.5%',\n },\n MANUAL: {\n id: 11,\n idTva: 11,\n value: 0,\n displayOrder: 8,\n name: 'TVA manuelle',\n collected: 0,\n deductible: 0,\n immobilization: null,\n roundPercentage: [],\n isVatImportation: false,\n isVatIntracom: false,\n saleName: '',\n },\n};\n\nexport enum VatState {\n WAITING = 0,\n ACCEPTED_SIE = 1,\n SEND_SIE = 2,\n CLIENT_ISSUE = 3,\n DONE_BY_CLIENT = 4,\n NA = 5,\n SEND_TO_CLIENT = 6,\n CLIENT_RELAUNCHED = 7,\n DOING_BACK = 8,\n UNPAYED = 9,\n SIE_ISSUE = 10,\n ACCEPTED_BY_CLIENT = 11,\n REFUSED_BY_CLIENT = 12,\n TO_DO = 13,\n WAITING_CLIENT = 14,\n}"]}
1
+ {"version":3,"file":"Vat.js","mappings":";;;;;AAmBO,MAAMA,GAAG,WAAHA,GAAG,GAAe;EAC7BC,YAAY,EAAE;IACZC,EAAE,EAAE,CADQ;IAEZC,KAAK,EAAE,CAFK;IAGZC,KAAK,EAAE,CAHK;IAIZC,YAAY,EAAE,CAJF;IAKZC,IAAI,EAAE,WALM;IAMZC,SAAS,EAAE,GANC;IAOZC,UAAU,EAAE,GAPA;IAQZC,cAAc,EAAE,EARJ;IASZC,eAAe,EAAE,CAAC,CAAD,CATL;IAUZC,gBAA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e,EAAE,EATC;IAUlBC,gBAAgB,EAAE,IAVA;IAWlBC,aAAa,EAAE,KAXG;IAYlBC,QAAQ,EAAE;EAZQ,CA7PS;EA2Q7BmB,MAAM,EAAE;IACN9B,EAAE,EAAE,EADE;IAENC,KAAK,EAAE,EAFD;IAGNC,KAAK,EAAE,CAHD;IAINC,YAAY,EAAE,CAJR;IAKNC,IAAI,EAAE,cALA;IAMNC,SAAS,EAAE,CANL;IAONC,UAAU,EAAE,CAPN;IAQNC,cAAc,EAAE,IARV;IASNC,eAAe,EAAE,EATX;IAUNC,gBAAgB,EAAE,KAVZ;IAWNC,aAAa,EAAE,KAXT;IAYNC,QAAQ,EAAE;EAZJ;AA3QqB,CAAxB;AA2RP,IAAYoB,QAgBX,WAhBWA,QAgBX,YAhBD;;AAAA,WAAYA,QAAZ,EAAoB;EAClBA;EACAA;EACAA;EACAA;EACAA;EACAA;EACAA;EACAA;EACAA;EACAA;EACAA;EACAA;EACAA;EACAA;EACAA;AACD,CAhBD,EAAYA,QAAQ,aAARA,QAAQ,GAARA,QAAQ,MAApB","names":["Vat","WITHOUT_TAXE","id","idTva","value","displayOrder","name","collected","deductible","immobilization","roundPercentage","isVatImportation","isVatIntracom","saleName","TX_5_5","TX_10","TX_20","TX_2_1","TX_8_5","MARGE","INTRACOM_TX_20","INTRACOM_WITHOUT_TAXE","INTRACOM_TX_5_5","INTRACOM_TX_10","INTRACOM_TX_2_1","INTRACOM_TX_8_5","IMPORTATION_WITHOUT_TAXE","IMPORTATION_TX_5_5","IMPORTATION_TX_10","IMPORTATION_TX_20","IMPORTATION_TX_2_1","IMPORTATION_TX_8_5","MANUAL","VatState"],"sourceRoot":"","sources":["../../../ts/types/Enum/Vat.ts"],"sourcesContent":["export interface VatType{\n id: number;\n idTva: number;\n value: number;\n displayOrder: number;\n name: string;\n collected: number;\n deductible: number;\n immobilization: number | null;\n roundPercentage: number[];\n isVatImportation: boolean;\n isVatIntracom: boolean;\n saleName: string; // Used for commercial documents\n}\n\nexport interface VatTypeEnum {\n [key: string]: VatType\n}\n\nexport const Vat:VatTypeEnum = {\n WITHOUT_TAXE: {\n id: 1,\n idTva: 1,\n value: 0,\n displayOrder: 6,\n name: 'Hors-Taxe',\n collected: 212,\n deductible: 221,\n immobilization: 19,\n roundPercentage: [0],\n isVatImportation: false,\n isVatIntracom: false,\n saleName: 'HT',\n },\n TX_5_5: {\n id: 2,\n idTva: 2,\n value: 5.5,\n displayOrder: 4,\n name: 'TVA 5.5%',\n collected: 209,\n deductible: 4,\n immobilization: 10,\n roundPercentage: [5, 6],\n isVatImportation: false,\n isVatIntracom: false,\n saleName: '5.5%',\n },\n TX_10: {\n id: 3,\n idTva: 3,\n value: 10,\n displayOrder: 2,\n name: 'TVA 10%',\n collected: 210,\n deductible: 5,\n immobilization: 11,\n roundPercentage: [10, 11],\n isVatImportation: false,\n isVatIntracom: false,\n saleName: '10%',\n },\n TX_20: {\n id: 4,\n idTva: 4,\n value: 20,\n displayOrder: 1,\n name: 'TVA 20%',\n collected: 211,\n deductible: 6,\n immobilization: 12,\n roundPercentage: [19, 20, 21],\n isVatImportation: false,\n isVatIntracom: false,\n saleName: '20%',\n },\n TX_2_1: {\n id: 6,\n idTva: 6,\n value: 2.1,\n displayOrder: 5,\n name: 'TVA 2.1%',\n collected: 222,\n deductible: 7,\n immobilization: 13,\n roundPercentage: [2, 3],\n isVatImportation: false,\n isVatIntracom: false,\n saleName: '2.1%',\n },\n TX_8_5: {\n id: 7,\n idTva: 7,\n value: 8.5,\n displayOrder: 3,\n name: 'TVA 8.5%',\n collected: 345,\n deductible: 8,\n immobilization: 15,\n roundPercentage: [8, 9],\n isVatImportation: false,\n isVatIntracom: false,\n saleName: '8.5%',\n },\n MARGE: {\n id: 8,\n idTva: 8,\n value: 0,\n displayOrder: 9,\n name: 'Sur Marge',\n collected: 211,\n deductible: 9,\n immobilization: null,\n roundPercentage: [],\n isVatImportation: false,\n isVatIntracom: false,\n saleName: 'Sur marge',\n },\n INTRACOM_TX_20: {\n id: 9,\n idTva: 9,\n value: 20,\n displayOrder: 7,\n name: 'TVA Intracom 20%',\n collected: 207,\n deductible: 208,\n immobilization: 208,\n roundPercentage: [],\n isVatImportation: false,\n isVatIntracom: true,\n saleName: '20%',\n },\n INTRACOM_WITHOUT_TAXE: {\n id: 17,\n idTva: 17,\n value: 0,\n displayOrder: 7,\n name: 'TVA Intracom Hors-Taxe',\n collected: 207,\n deductible: 208,\n immobilization: 208,\n roundPercentage: [],\n isVatImportation: false,\n isVatIntracom: true,\n saleName: 'Hors-Taxe',\n },\n INTRACOM_TX_5_5: {\n id: 18,\n idTva: 18,\n value: 5.5,\n displayOrder: 7,\n name: 'TVA Intracom 5.5%',\n collected: 207,\n deductible: 208,\n immobilization: 208,\n roundPercentage: [],\n isVatImportation: false,\n isVatIntracom: true,\n saleName: '5.5%',\n },\n INTRACOM_TX_10: {\n id: 19,\n idTva: 19,\n value: 10,\n displayOrder: 7,\n name: 'TVA Intracom 10%',\n collected: 207,\n deductible: 208,\n immobilization: 208,\n roundPercentage: [],\n isVatImportation: false,\n isVatIntracom: true,\n saleName: '10%',\n },\n INTRACOM_TX_2_1: {\n id: 20,\n idTva: 20,\n value: 2.1,\n displayOrder: 7,\n name: 'TVA Intracom 2.1%',\n collected: 207,\n deductible: 208,\n immobilization: 208,\n roundPercentage: [],\n isVatImportation: false,\n isVatIntracom: true,\n saleName: '2.1%',\n },\n INTRACOM_TX_8_5: {\n id: 21,\n idTva: 21,\n value: 8.5,\n displayOrder: 7,\n name: 'TVA Intracom 8.5%',\n collected: 207,\n deductible: 208,\n immobilization: 208,\n roundPercentage: [],\n isVatImportation: false,\n isVatIntracom: true,\n saleName: '8.5%',\n },\n IMPORTATION_WITHOUT_TAXE: {\n id: 10,\n idTva: 10,\n value: 0,\n displayOrder: 8,\n name: 'TVA Importation Hors-Taxe',\n collected: 572,\n deductible: 573,\n immobilization: 573,\n roundPercentage: [],\n isVatImportation: true,\n isVatIntracom: false,\n saleName: 'Hors-Taxe',\n },\n IMPORTATION_TX_5_5: {\n id: 12,\n idTva: 12,\n value: 5.5,\n displayOrder: 8,\n name: 'TVA Importation 5.5%',\n collected: 574,\n deductible: 575,\n immobilization: 575,\n roundPercentage: [],\n isVatImportation: true,\n isVatIntracom: false,\n saleName: '5.5%',\n },\n IMPORTATION_TX_10: {\n id: 13,\n idTva: 13,\n value: 10,\n displayOrder: 8,\n name: 'TVA Importation 10%',\n collected: 576,\n deductible: 577,\n immobilization: 577,\n roundPercentage: [],\n isVatImportation: true,\n isVatIntracom: false,\n saleName: '10%',\n },\n IMPORTATION_TX_20: {\n id: 14,\n idTva: 14,\n value: 20,\n displayOrder: 8,\n name: 'TVA Importation 20%',\n collected: 578,\n deductible: 579,\n immobilization: 579,\n roundPercentage: [],\n isVatImportation: true,\n isVatIntracom: false,\n saleName: '20%',\n },\n IMPORTATION_TX_2_1: {\n id: 15,\n idTva: 15,\n value: 2.1,\n displayOrder: 8,\n name: 'TVA Importation 2.1%',\n collected: 580,\n deductible: 581,\n immobilization: 581,\n roundPercentage: [],\n isVatImportation: true,\n isVatIntracom: false,\n saleName: '2.1%',\n },\n IMPORTATION_TX_8_5: {\n id: 16,\n idTva: 16,\n value: 8.5,\n displayOrder: 8,\n name: 'TVA Importation 8.5%',\n collected: 582,\n deductible: 583,\n immobilization: 583,\n roundPercentage: [],\n isVatImportation: true,\n isVatIntracom: false,\n saleName: '8.5%',\n },\n MANUAL: {\n id: 11,\n idTva: 11,\n value: 0,\n displayOrder: 8,\n name: 'TVA manuelle',\n collected: 0,\n deductible: 0,\n immobilization: null,\n roundPercentage: [],\n isVatImportation: false,\n isVatIntracom: false,\n saleName: '',\n },\n};\n\nexport enum VatState {\n WAITING = 0,\n ACCEPTED_SIE = 1,\n SEND_SIE = 2,\n CLIENT_ISSUE = 3,\n DONE_BY_CLIENT = 4,\n NA = 5,\n SEND_TO_CLIENT = 6,\n CLIENT_RELAUNCHED = 7,\n DOING_BACK = 8,\n UNPAYED = 9,\n SIE_ISSUE = 10,\n ACCEPTED_BY_CLIENT = 11,\n REFUSED_BY_CLIENT = 12,\n TO_DO = 13,\n WAITING_CLIENT = 14,\n}"]}
@@ -37,7 +37,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
37
37
  const ejs = require('ejs');
38
38
 
39
39
  function generateCommercialDocument(idEstimateInvoiceType, payload) {
40
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
40
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
41
41
 
42
42
  const products = (0, _lodash.orderBy)(payload.products.map(product => (0, _product.productToReadProductEditing)(product), 'reorder'));
43
43
  const vats = (0, _lodash.orderBy)(Object.values((0, _lodash.groupBy)(products, 'vatFormatted')).map(v => (0, _vat.vatToReadVatEditing)(v), 'value')).filter(v => v.id !== _Vat.Vat.MARGE.id);
@@ -52,7 +52,6 @@ function generateCommercialDocument(idEstimateInvoiceType, payload) {
52
52
  discount: (_e = payload.discount) !== null && _e !== void 0 ? _e : null,
53
53
  vatMention: (_f = payload.vatMention) !== null && _f !== void 0 ? _f : null,
54
54
  phoneContact: (_h = (_g = payload.settings) === null || _g === void 0 ? void 0 : _g.phoneContact) !== null && _h !== void 0 ? _h : null,
55
- comment: payload.comment && typeof payload.comment === 'string' ? payload.comment.replace(/\n/g, '<br/>') : payload.comment,
56
55
  products,
57
56
  vats,
58
57
  totalTaxExcluded: (0, _lodash.sumBy)(products, 'totalTaxExcluded'),
@@ -92,7 +91,16 @@ function generateCommercialDocument(idEstimateInvoiceType, payload) {
92
91
  const documentFreeText = [_EstimateInvoice.EstimateInvoiceType.DEVIS, _EstimateInvoice.EstimateInvoiceType.BON].includes(idEstimateInvoiceType) ? (_u = payload === null || payload === void 0 ? void 0 : payload.settings) === null || _u === void 0 ? void 0 : _u.freeEstimateText : (_v = payload === null || payload === void 0 ? void 0 : payload.settings) === null || _v === void 0 ? void 0 : _v.freeInvoiceText;
93
92
  return {
94
93
  header: ejs.render(commonTemplate.header, data),
95
- body: ejs.render(_body.bodyTemplate, data),
94
+ body: ejs.render(_body.bodyTemplate, Object.assign(Object.assign({}, data), {
95
+ comment: data.comment && typeof data.comment === 'string' ? (_w = data.comment) === null || _w === void 0 ? void 0 : _w.replace(/\n/g, '<br/>') : null,
96
+ products: data.products.map(p => {
97
+ var _a;
98
+
99
+ return Object.assign(Object.assign({}, p), {
100
+ comment: p.comment && typeof p.comment === 'string' ? (_a = p.comment) === null || _a === void 0 ? void 0 : _a.replace(/\n/g, '<br/>') : null
101
+ });
102
+ })
103
+ })),
96
104
  footer: ejs.render(commonTemplate.footer, Object.assign(Object.assign({}, data), {
97
105
  freeText: documentFreeText !== null && documentFreeText !== void 0 ? documentFreeText : null
98
106
  })),
@@ -101,7 +109,7 @@ function generateCommercialDocument(idEstimateInvoiceType, payload) {
101
109
  }
102
110
 
103
111
  function generateAdvanceDocument(payload) {
104
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
112
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
105
113
 
106
114
  if (!payload.deposit) throw new Error('Aucun acompte défini');
107
115
  const data = Object.assign(Object.assign({}, payload), {
@@ -115,7 +123,6 @@ function generateAdvanceDocument(payload) {
115
123
  totalTaxIncluded: payload.deposit,
116
124
  totalTaxAndDiscountIncluded: payload.deposit,
117
125
  generalDiscountFormatted: null,
118
- comment: payload.comment && typeof payload.comment === 'string' ? payload.comment.replace(/\n/g, '<br/>') : payload.comment,
119
126
  depositFormatted: (0, _amount.integerToFormattedAmountString)(payload.deposit),
120
127
  totalTaxExcludedFormatted: (0, _amount.integerToFormattedAmountString)(payload.deposit),
121
128
  totalTaxIncludedFormatted: (0, _amount.integerToFormattedAmountString)(payload.deposit),
@@ -153,9 +160,18 @@ function generateAdvanceDocument(payload) {
153
160
  const commonTemplate = new _common.CommercialDocumentCommonHTML();
154
161
  return {
155
162
  header: ejs === null || ejs === void 0 ? void 0 : ejs.render(commonTemplate.header, data),
156
- body: ejs === null || ejs === void 0 ? void 0 : ejs.render(_body.bodyTemplate, data),
163
+ body: ejs === null || ejs === void 0 ? void 0 : ejs.render(_body.bodyTemplate, Object.assign(Object.assign({}, data), {
164
+ comment: data.comment && typeof data.comment === 'string' ? (_p = data.comment) === null || _p === void 0 ? void 0 : _p.replace(/\n/g, '<br/>') : null,
165
+ products: data.products.map(p => {
166
+ var _a;
167
+
168
+ return Object.assign(Object.assign({}, p), {
169
+ comment: p.comment && typeof p.comment === 'string' ? (_a = p.comment) === null || _a === void 0 ? void 0 : _a.replace(/\n/g, '<br/>') : null
170
+ });
171
+ })
172
+ })),
157
173
  footer: ejs === null || ejs === void 0 ? void 0 : ejs.render(commonTemplate.footer, Object.assign(Object.assign({}, data), {
158
- freeText: (_q = (_p = payload === null || payload === void 0 ? void 0 : payload.settings) === null || _p === void 0 ? void 0 : _p.freeInvoiceText) !== null && _q !== void 0 ? _q : null
174
+ freeText: (_r = (_q = payload === null || payload === void 0 ? void 0 : payload.settings) === null || _q === void 0 ? void 0 : _q.freeInvoiceText) !== null && _r !== void 0 ? _r : null
159
175
  })),
160
176
  data
161
177
  };
@@ -1 +1 @@
1
- {"version":3,"file":"document.js","mappings":";;;;;QAoBgBA,0B,GAAAA,0B;QAsDAC,uB,GAAAA,uB;;AA1EhB;;AAGA;;IAAYC,K;;AAEZ;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;;;;;AAEA,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,IAAa,0CAA4BA,OAA5B,CAAlC,EAAwE,SA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IAAkCxC,aAAlC,GAAkCA,EAAlC,GAAsC;IAAlD,CAAX,CAAjC,CAHH;IAIL7C;EAJK,CAAP;AAMD","names":["generateCommercialDocument","generateAdvanceDocument","dayjs","ejs","require","idEstimateInvoiceType","payload","products","map","product","vats","Object","values","v","filter","id","Vat","MARGE","thirdParty","data","paymentLink","_a","title","_b","penalties","_c","compensation","_d","discount","_e","vatMention","_f","phoneContact","settings","_g","_h","comment","replace","totalTaxExcluded","totalTaxIncluded","totalTaxAndDiscountIncluded","generalDiscountFormatted","generalDiscount2","depositFormatted","deposit","totalTaxExcludedFormatted","totalTaxIncludedFormatted","totalTaxAndDiscountIncludedFormatted","_j","_k","totalVatAmountFormatted","font","_l","idFont","_m","FontIds","CIRCULAR_STD","name","find","f","_o","_p","fontList","url","_q","link","_r","capitalFormatted","capital","split","reduceRight","acc","char","i","length","trim","dueDateFormatted","dueDate","format","expirationDateFormatted","expirationDate","emissionDateFormatted","emissionDate","shouldDisplayDiscountColumn","p","discount2","marginVats","marginVatFormatted","accountingCategoryFormatted","a","accountingCategory","_s","label","_t","commonTemplate","CommercialDocumentCommonHTML","documentFreeText","EstimateInvoiceType","DEVIS","BON","includes","_u","freeEstimateText","_v","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 {\n AccountingCategoryList, FontIds, fontList, VatMarginCategyList,\n} 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';\nimport { thirdPartyToReadThirdPartyEditing } from './thirdParty';\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 const thirdParty = thirdPartyToReadThirdPartyEditing(payload.thirdParty);\n\n const data: ReadDocumentEditing = {\n ...payload,\n thirdParty,\n paymentLink: payload.paymentLink ?? '#',\n idEstimateInvoiceType,\n title: payload.title ?? null,\n penalties: payload.penalties ?? null,\n compensation: payload.compensation ?? null,\n discount: payload.discount ?? null,\n vatMention: payload.vatMention ?? null,\n phoneContact: payload.settings?.phoneContact ?? null,\n comment: payload.comment && typeof payload.comment === 'string' ? payload.comment.replace(/\\n/g, '<br/>') : payload.comment,\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'),\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')),\n totalTaxAndDiscountIncludedFormatted: integerToFormattedAmountString(_sumBy(products, 'totalTaxExcluded') + _sumBy(vats, 'amount') - (payload.generalDiscount2 ?? 0) - (payload.deposit ?? 0)),\n totalVatAmountFormatted: integerToFormattedAmountString(_sumBy(vats, 'amount')),\n font: {\n id: payload.settings?.idFont ?? FontIds.CIRCULAR_STD,\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 title: payload.title ?? null,\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 comment: payload.comment && typeof payload.comment === 'string' ? payload.comment.replace(/\\n/g, '<br/>') : payload.comment,\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 id: payload.settings?.idFont ?? FontIds.CIRCULAR_STD,\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":";;;;;QAoBgBA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,CAVH;IAWL7C;EAXK,CAAP;AAaD","names":["generateCommercialDocument","generateAdvanceDocument","dayjs","ejs","require","idEstimateInvoiceType","payload","products","map","product","vats","Object","values","v","filter","id","Vat","MARGE","thirdParty","data","paymentLink","_a","title","_b","penalties","_c","compensation","_d","discount","_e","vatMention","_f","phoneContact","settings","_g","_h","totalTaxExcluded","totalTaxIncluded","totalTaxAndDiscountIncluded","generalDiscountFormatted","generalDiscount2","depositFormatted","deposit","totalTaxExcludedFormatted","totalTaxIncludedFormatted","totalTaxAndDiscountIncludedFormatted","_j","_k","totalVatAmountFormatted","font","_l","idFont","_m","FontIds","CIRCULAR_STD","name","find","f","_o","_p","fontList","url","_q","link","_r","capitalFormatted","capital","split","reduceRight","acc","char","i","length","trim","dueDateFormatted","dueDate","format","expirationDateFormatted","expirationDate","emissionDateFormatted","emissionDate","shouldDisplayDiscountColumn","p","discount2","marginVats","marginVatFormatted","accountingCategoryFormatted","a","accountingCategory","_s","label","_t","commonTemplate","CommercialDocumentCommonHTML","documentFreeText","EstimateInvoiceType","DEVIS","BON","includes","_u","freeEstimateText","_v","freeInvoiceText","header","render","body","bodyTemplate","comment","_w","replace","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 {\n AccountingCategoryList, FontIds, fontList, VatMarginCategyList,\n} 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';\nimport { thirdPartyToReadThirdPartyEditing } from './thirdParty';\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 const thirdParty = thirdPartyToReadThirdPartyEditing(payload.thirdParty);\n\n const data: ReadDocumentEditing = {\n ...payload,\n thirdParty,\n paymentLink: payload.paymentLink ?? '#',\n idEstimateInvoiceType,\n title: payload.title ?? null,\n penalties: payload.penalties ?? null,\n compensation: payload.compensation ?? null,\n discount: payload.discount ?? null,\n vatMention: payload.vatMention ?? null,\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'),\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')),\n totalTaxAndDiscountIncludedFormatted: integerToFormattedAmountString(_sumBy(products, 'totalTaxExcluded') + _sumBy(vats, 'amount') - (payload.generalDiscount2 ?? 0) - (payload.deposit ?? 0)),\n totalVatAmountFormatted: integerToFormattedAmountString(_sumBy(vats, 'amount')),\n font: {\n id: payload.settings?.idFont ?? FontIds.CIRCULAR_STD,\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, {\n ...data,\n comment: data.comment && typeof data.comment === 'string' ? data.comment?.replace(/\\n/g, '<br/>') : null,\n products: data.products.map((p) => ({\n ...p,\n comment: p.comment && typeof p.comment === 'string' ? p.comment?.replace(/\\n/g, '<br/>') : null,\n })),\n }),\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 title: payload.title ?? null,\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 id: payload.settings?.idFont ?? FontIds.CIRCULAR_STD,\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, {\n ...data,\n comment: data.comment && typeof data.comment === 'string' ? data.comment?.replace(/\\n/g, '<br/>') : null,\n products: data.products.map((p) => ({\n ...p,\n comment: p.comment && typeof p.comment === 'string' ? p.comment?.replace(/\\n/g, '<br/>') : null,\n })),\n }),\n footer: ejs?.render(commonTemplate.footer, { ...data, freeText: payload?.settings?.freeInvoiceText ?? null }),\n data,\n };\n}"]}
@@ -44,7 +44,6 @@ function productToReadProductEditing(payload) {
44
44
  var _a, _b, _c, _d, _e, _f;
45
45
 
46
46
  return Object.assign(Object.assign({}, payload), {
47
- comment: payload.comment && typeof payload.comment === 'string' ? payload.comment.replace(/\n/g, '<br/>') : payload.comment,
48
47
  totalTaxExcluded: getTotalTaxExcluded(payload),
49
48
  unitFormatted: (_b = (_a = Object.values(_Unit.Unit).find(unit => unit.id === payload.unit)) === null || _a === void 0 ? void 0 : _a.shortName) !== null && _b !== void 0 ? _b : '',
50
49
  vatFormatted: (_d = (_c = (0, _vat.getById)(payload.idVat)) === null || _c === void 0 ? void 0 : _c.saleName) !== null && _d !== void 0 ? _d : '',
@@ -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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oC,EAJxC;IAKVC,yBAAyB,EAAE,+BAAUf,OAAO,CAACP,gBAAlB,IAAsC,4CAA+BO,OAAO,CAACP,gBAAvC,CAAtC,GAAiG,IALlH;IAMVuB,yBAAyB,EAAE,+BAAUhB,OAAO,CAACP,gBAAlB,IAAsC,4CAA+BR,mBAAmB,CAACe,OAAD,CAAlD,CAAtC,GAAqG,IANtH;IAOViB,iBAAiB,EAAEjB,OAAO,CAACZ,SAAR,IAAqBY,OAAO,CAACZ,SAAR,GAAoB,CAAzC,GAA6C,4CAA+BJ,WAAW,CAACgB,OAAD,CAA1C,CAA7C,GAAoG,IAP7G;IAQVkB,qBAAqB,EAAElB,OAAO,CAACZ,SAAR,IAAqBY,OAAO,CAACZ,SAAR,GAAoB,CAAzC,GAA6CY,OAAO,CAACV,YAAR,KAAyBC,mCAAaC,OAAtC,GAAgD,GAAG,CAACQ,OAAO,CAACZ,SAAR,GAAoB,GAArB,EAA0B+B,OAA1B,CAAkC,CAAlC,CAAoC,GAAvF,GAA6F,GAAG,4CAA+BnB,OAAO,CAACZ,SAAvC,CAAiD,GAA9L,GAAoM,IARjN;IASVgC,kBAAkB,EAAEpB,OAAO,CAACqB,aAAR,GAAwB,sDAAoBd,IAApB,CAA0Be,CAAD,IAAOA,CAAC,CAACb,EAAF,KAAST,OAAO,CAACqB,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;EATnH,CADZ;AAYD","names":["getDiscount","getTotalTaxExcluded","productToReadProductEditing","product","discount2","undefined","discountType","DiscountType","PERCENT","priceTaxExcluded","_a","_b","AMOUNT","_c","discount","quantity","payload","comment","replace","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 comment: payload.comment && typeof payload.comment === 'string' ? payload.comment.replace(/\\n/g, '<br/>') : payload.comment,\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 ? VatMar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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}"]}
@@ -60,8 +60,8 @@ const headOfDocument = `<div class="row space-between">
60
60
  <p></p>
61
61
  <% if (thirdParty) { %>
62
62
  <div class="<%= settings && settings.isCoordinatesFrameDisplayed ? 'customer-border' : '' %>">
63
- <% if(thirdParty.fullname) {%><b><%= thirdParty.fullname %></b><br/><% } %>
64
- <% if(thirdParty.company) {%><%= thirdParty.company %><br/><% } %>
63
+ <% if(thirdParty.company) {%><b><%= thirdParty.company %></b><br/><% } %>
64
+ <% if(thirdParty.fullname) {%><%= thirdParty.fullname %><br/><% } %>
65
65
  <% if(thirdParty.address) {%><%= thirdParty.address %><br/><% } %>
66
66
  <% if(thirdParty.zipCode) {%><%= thirdParty.zipCode + ' ' %><% } %><%= thirdParty.city %> <%= thirdParty.country %><br/>
67
67
  <% if(thirdParty.deliveryAddress && thirdParty.deliveryCity && thirdParty.deliveryZipCode) {%>Adresse de livraison : <%= thirdParty.deliveryAddress %> <%= thirdParty.deliveryZipCode %> <%= thirdParty.deliveryCity %> <%= thirdParty.deliveryCountry %><br/><% } %>
@@ -1 +1 @@
1
- {"version":3,"file":"body.js","mappings":";;;;;;;AAAA;;AACA;;AAEA,MAAMA,cAAc,GAAG,IAAIC,oCAAJ,EAAvB;AAEA,MAAMC,cAAc,GAAG;;;YAGXF,cAAc,CAACG,IAAI;YACnBH,cAAc,CAACI,OAAO;;;4CAGUJ,cAAc,CAACI,OAAO;UACxDJ,cAAc,CAACG,IAAI;;;;;;;yCAOYE,qCAAoBC,GAAG;;gDAEhBD,qCAAoBE,KAAK;;gDAEzBF,qCAAoBG,OAAO;;gDAE3BH,qCAAoBI,KAAK;;gDAEzBJ,qCAAoBK,KAAK;;gDAEzBL,qCAAoBM,OAAO;;;;;mDAKxBN,qCAAoBM,OAAO;;oBAE1DN,qCAAoBC,GAAG,KAAKD,qCAAoBE,KAAK;;;;;;;2DAOdF,qCAAoBM,OAAO;;;;mDAInCN,qCAAoBC,GAAG,KAAKD,qCAAoBE,KAAK;;;;;;;;;;;;;;;;;SA3CxG;AA8DO,MAAMK,YAAY,WAAZA,YAAY,GAAG;;;;IAIxBV,cAAc;;;;;;6BAMWF,cAAc,CAACa,QAAQ;;;;;YAKxCb,cAAc,CAACc,iBAAiB;;;;;;;;;;UAUlCd,cAAc,CAACe,oBAAoB;;;8DAGiBf,cAAc,CAACgB,aAAa;;;;;;;;;;;;;;;;wEAgBlBX,qCAAoBE,KAAK,iCAAiCF,qCAAoBC,GAAG;;;;oFAIrED,qCAAoBE,KAAK,iCAAiCF,qCAAoBC,GAAG;;;;;;;QAO7JN,cAAc,CAACiB,KAAK;;QAvDrB","names":["commonTemplate","CommercialDocumentCommonHTML","headOfDocument","logo","company","EstimateInvoiceType","BON","DEVIS","FACTURE","AVOIR","RESTE","ACOMPTE","bodyTemplate","products","vatRecapitulation","amountRecapitulation","paymentButton","style"],"sourceRoot":"","sources":["../../../../ts/utils/commercialManagement/templates/body.ts"],"sourcesContent":["import { EstimateInvoiceType } from '../../../types/Enum/EstimateInvoice';\nimport { CommercialDocumentCommonHTML } from './common';\n\nconst commonTemplate = new CommercialDocumentCommonHTML();\n\nconst headOfDocument = `<div class=\"row space-between\">\n <% if (settings && settings.logoAlignment === 'left') { %>\n <div class=\"society-informations\">\n ${commonTemplate.logo}\n ${commonTemplate.company}\n </div>\n <% } else { %>\n <div class=\"society-informations\">${commonTemplate.company}</div>\n ${commonTemplate.logo}\n <% } %>\n </div>\n\n <div class=\"row space-between items-end\" style=\"margin-top: 10px\">\n <div style=\"width: 45%; margin-top: auto;\">\n <span class=\"document-reference\">\n <% if (idEstimateInvoiceType === ${EstimateInvoiceType.BON}) { %>\n Bon de commande\n <% } else if (idEstimateInvoiceType === ${EstimateInvoiceType.DEVIS}) { %>\n Devis\n <% } else if (idEstimateInvoiceType === ${EstimateInvoiceType.FACTURE}) { %>\n Facture\n <% } else if (idEstimateInvoiceType === ${EstimateInvoiceType.AVOIR}) { %>\n Avoir\n <% } else if (idEstimateInvoiceType === ${EstimateInvoiceType.RESTE}) { %>\n Facture de solde\n <% } else if (idEstimateInvoiceType === ${EstimateInvoiceType.ACOMPTE}) { %>\n Facture d'acompte\n <% } %>\n <%= reference %></span><br/>\n <% if(emissionDate) {%><span class=\"document-emission-date\">Date d’émission : <%= emissionDateFormatted %></span><br/><% } %>\n <% if(dueDate && idEstimateInvoiceType !== ${EstimateInvoiceType.ACOMPTE}) {%>\n <span class=\"document-due-date\">\n <% if ([${EstimateInvoiceType.BON}, ${EstimateInvoiceType.DEVIS}].includes(idEstimateInvoiceType)) {%>\n Valide jusqu'au :\n <% } else { %>\n Date d'échéance :\n <% } %>\n <%= dueDateFormatted %></span>\n <% } %>\n <% if (expirationDate && idEstimateInvoiceType === ${EstimateInvoiceType.ACOMPTE}) {%>\n <span class=\"document-due-date\">Date d'expiration : <%= expirationDateFormatted %></span>\n <% } %>\n <% if(termsOfPayment) { %>\n <br/><p style=\"margin-bottom: 0px;\"><%= [${EstimateInvoiceType.BON}, ${EstimateInvoiceType.DEVIS}].includes(idEstimateInvoiceType) ? 'Conditions de règlement' : 'Date limite de règlement' %> : <%= termsOfPayment %></p>\n <% } %>\n </div>\n <div style=\"width: 40%; margin-top: auto;\">\n <p></p>\n <% if (thirdParty) { %>\n <div class=\"<%= settings && settings.isCoordinatesFrameDisplayed ? 'customer-border' : '' %>\">\n <% if(thirdParty.fullname) {%><b><%= thirdParty.fullname %></b><br/><% } %>\n <% if(thirdParty.company) {%><%= thirdParty.company %><br/><% } %>\n <% if(thirdParty.address) {%><%= thirdParty.address %><br/><% } %>\n <% if(thirdParty.zipCode) {%><%= thirdParty.zipCode + ' ' %><% } %><%= thirdParty.city %> <%= thirdParty.country %><br/>\n <% if(thirdParty.deliveryAddress && thirdParty.deliveryCity && thirdParty.deliveryZipCode) {%>Adresse de livraison : <%= thirdParty.deliveryAddress %> <%= thirdParty.deliveryZipCode %> <%= thirdParty.deliveryCity %> <%= thirdParty.deliveryCountry %><br/><% } %>\n <% if(thirdParty.nSiret) {%>SIRET : <%= thirdParty.nSiret %><br/><% } %>\n <% if(thirdParty.nTva) {%>N° TVA : <%= thirdParty.nTva %><% } %>\n </div>\n <% } %>\n </div>\n </div>`;\n\nexport const bodyTemplate = `<html class=\"pdf-content\">\n\n <body>\n\n ${headOfDocument}\n\n <div class=\"row mt-25\">\n <% if (title) { %>Titre : <%= title %><% } %>\n </div>\n\n <div class=\"row mt-10\">${commonTemplate.products}</div>\n\n <div class=\"row space-between mt-20\">\n <div style=\"width: 55%;\">\n <% if (disableVat !== true && vats.length) { %>\n ${commonTemplate.vatRecapitulation}\n <% } %>\n <% if (vatMention) { %><div class=\"vat-mention <%= disableVat !== true ? 'mt-20' : ''%>\"><%= vatMention %></div><% } %>\n <% if (comment) { %>\n <p class=\"mt-20\">Commentaire :<br/>\n <%- comment %>\n <% } %>\n </div>\n\n <div>\n ${commonTemplate.amountRecapitulation}\n\n <% if (isStripeAllowed) { %>\n <div style=\"text-align: right; margin-top: 30px;\">${commonTemplate.paymentButton}</div>\n <% } %>\n </div>\n \n </div>\n\n <% if (settings && (settings.iban || settings.bic)) { %>\n <div class=\"row mt-30 space-between\" style=\"page-break-inside: avoid !important;\">\n <div>\n <% if (settings && (settings.iban || settings.bic)) { %>\n <% if(settings.iban) { %>IBAN : <%= settings.iban %><br/><% } %>\n <% if(settings.bic) { %>BIC : <%= settings.bic %><% } %>\n <% } %>\n </div>\n </div>\n <% } %>\n <% if (settings && settings.bonPour && (idEstimateInvoiceType === ${EstimateInvoiceType.DEVIS} || idEstimateInvoiceType === ${EstimateInvoiceType.BON})) { %>\n <br/>Bon pour accord : <br/><br/><br/><br/>\n <% } %>\n\n <% if (cgv && ((settings && settings.invoiceCgv) || idEstimateInvoiceType === ${EstimateInvoiceType.DEVIS} || idEstimateInvoiceType === ${EstimateInvoiceType.BON})) { %>\n <br><div style=\"page-break-after:always;\"></div>\n <%- cgv %>\n <% } %>\n </body>\n\n <style>\n ${commonTemplate.style}\n </style>\n</html>`;"]}
1
+ {"version":3,"file":"body.js","mappings":";;;;;;;AAAA;;AACA;;AAEA,MAAMA,cAAc,GAAG,IAAIC,oCAAJ,EAAvB;AAEA,MAAMC,cAAc,GAAG;;;YAGXF,cAAc,CAACG,IAAI;YACnBH,cAAc,CAACI,OAAO;;;4CAGUJ,cAAc,CAACI,OAAO;UACxDJ,cAAc,CAACG,IAAI;;;;;;;yCAOYE,qCAAoBC,GAAG;;gDAEhBD,qCAAoBE,KAAK;;gDAEzBF,qCAAoBG,OAAO;;gDAE3BH,qCAAoBI,KAAK;;gDAEzBJ,qCAAoBK,KAAK;;gDAEzBL,qCAAoBM,OAAO;;;;;mDAKxBN,qCAAoBM,OAAO;;oBAE1DN,qCAAoBC,GAAG,KAAKD,qCAAoBE,KAAK;;;;;;;2DAOdF,qCAAoBM,OAAO;;;;mDAInCN,qCAAoBC,GAAG,KAAKD,qCAAoBE,KAAK;;;;;;;;;;;;;;;;;SA3CxG;AA8DO,MAAMK,YAAY,WAAZA,YAAY,GAAG;;;;IAIxBV,cAAc;;;;;;6BAMWF,cAAc,CAACa,QAAQ;;;;;YAKxCb,cAAc,CAACc,iBAAiB;;;;;;;;;;UAUlCd,cAAc,CAACe,oBAAoB;;;8DAGiBf,cAAc,CAACgB,aAAa;;;;;;;;;;;;;;;;wEAgBlBX,qCAAoBE,KAAK,iCAAiCF,qCAAoBC,GAAG;;;;oFAIrED,qCAAoBE,KAAK,iCAAiCF,qCAAoBC,GAAG;;;;;;;QAO7JN,cAAc,CAACiB,KAAK;;QAvDrB","names":["commonTemplate","CommercialDocumentCommonHTML","headOfDocument","logo","company","EstimateInvoiceType","BON","DEVIS","FACTURE","AVOIR","RESTE","ACOMPTE","bodyTemplate","products","vatRecapitulation","amountRecapitulation","paymentButton","style"],"sourceRoot":"","sources":["../../../../ts/utils/commercialManagement/templates/body.ts"],"sourcesContent":["import { EstimateInvoiceType } from '../../../types/Enum/EstimateInvoice';\nimport { CommercialDocumentCommonHTML } from './common';\n\nconst commonTemplate = new CommercialDocumentCommonHTML();\n\nconst headOfDocument = `<div class=\"row space-between\">\n <% if (settings && settings.logoAlignment === 'left') { %>\n <div class=\"society-informations\">\n ${commonTemplate.logo}\n ${commonTemplate.company}\n </div>\n <% } else { %>\n <div class=\"society-informations\">${commonTemplate.company}</div>\n ${commonTemplate.logo}\n <% } %>\n </div>\n\n <div class=\"row space-between items-end\" style=\"margin-top: 10px\">\n <div style=\"width: 45%; margin-top: auto;\">\n <span class=\"document-reference\">\n <% if (idEstimateInvoiceType === ${EstimateInvoiceType.BON}) { %>\n Bon de commande\n <% } else if (idEstimateInvoiceType === ${EstimateInvoiceType.DEVIS}) { %>\n Devis\n <% } else if (idEstimateInvoiceType === ${EstimateInvoiceType.FACTURE}) { %>\n Facture\n <% } else if (idEstimateInvoiceType === ${EstimateInvoiceType.AVOIR}) { %>\n Avoir\n <% } else if (idEstimateInvoiceType === ${EstimateInvoiceType.RESTE}) { %>\n Facture de solde\n <% } else if (idEstimateInvoiceType === ${EstimateInvoiceType.ACOMPTE}) { %>\n Facture d'acompte\n <% } %>\n <%= reference %></span><br/>\n <% if(emissionDate) {%><span class=\"document-emission-date\">Date d’émission : <%= emissionDateFormatted %></span><br/><% } %>\n <% if(dueDate && idEstimateInvoiceType !== ${EstimateInvoiceType.ACOMPTE}) {%>\n <span class=\"document-due-date\">\n <% if ([${EstimateInvoiceType.BON}, ${EstimateInvoiceType.DEVIS}].includes(idEstimateInvoiceType)) {%>\n Valide jusqu'au :\n <% } else { %>\n Date d'échéance :\n <% } %>\n <%= dueDateFormatted %></span>\n <% } %>\n <% if (expirationDate && idEstimateInvoiceType === ${EstimateInvoiceType.ACOMPTE}) {%>\n <span class=\"document-due-date\">Date d'expiration : <%= expirationDateFormatted %></span>\n <% } %>\n <% if(termsOfPayment) { %>\n <br/><p style=\"margin-bottom: 0px;\"><%= [${EstimateInvoiceType.BON}, ${EstimateInvoiceType.DEVIS}].includes(idEstimateInvoiceType) ? 'Conditions de règlement' : 'Date limite de règlement' %> : <%= termsOfPayment %></p>\n <% } %>\n </div>\n <div style=\"width: 40%; margin-top: auto;\">\n <p></p>\n <% if (thirdParty) { %>\n <div class=\"<%= settings && settings.isCoordinatesFrameDisplayed ? 'customer-border' : '' %>\">\n <% if(thirdParty.company) {%><b><%= thirdParty.company %></b><br/><% } %>\n <% if(thirdParty.fullname) {%><%= thirdParty.fullname %><br/><% } %>\n <% if(thirdParty.address) {%><%= thirdParty.address %><br/><% } %>\n <% if(thirdParty.zipCode) {%><%= thirdParty.zipCode + ' ' %><% } %><%= thirdParty.city %> <%= thirdParty.country %><br/>\n <% if(thirdParty.deliveryAddress && thirdParty.deliveryCity && thirdParty.deliveryZipCode) {%>Adresse de livraison : <%= thirdParty.deliveryAddress %> <%= thirdParty.deliveryZipCode %> <%= thirdParty.deliveryCity %> <%= thirdParty.deliveryCountry %><br/><% } %>\n <% if(thirdParty.nSiret) {%>SIRET : <%= thirdParty.nSiret %><br/><% } %>\n <% if(thirdParty.nTva) {%>N° TVA : <%= thirdParty.nTva %><% } %>\n </div>\n <% } %>\n </div>\n </div>`;\n\nexport const bodyTemplate = `<html class=\"pdf-content\">\n\n <body>\n\n ${headOfDocument}\n\n <div class=\"row mt-25\">\n <% if (title) { %>Titre : <%= title %><% } %>\n </div>\n\n <div class=\"row mt-10\">${commonTemplate.products}</div>\n\n <div class=\"row space-between mt-20\">\n <div style=\"width: 55%;\">\n <% if (disableVat !== true && vats.length) { %>\n ${commonTemplate.vatRecapitulation}\n <% } %>\n <% if (vatMention) { %><div class=\"vat-mention <%= disableVat !== true ? 'mt-20' : ''%>\"><%= vatMention %></div><% } %>\n <% if (comment) { %>\n <p class=\"mt-20\">Commentaire :<br/>\n <%- comment %>\n <% } %>\n </div>\n\n <div>\n ${commonTemplate.amountRecapitulation}\n\n <% if (isStripeAllowed) { %>\n <div style=\"text-align: right; margin-top: 30px;\">${commonTemplate.paymentButton}</div>\n <% } %>\n </div>\n \n </div>\n\n <% if (settings && (settings.iban || settings.bic)) { %>\n <div class=\"row mt-30 space-between\" style=\"page-break-inside: avoid !important;\">\n <div>\n <% if (settings && (settings.iban || settings.bic)) { %>\n <% if(settings.iban) { %>IBAN : <%= settings.iban %><br/><% } %>\n <% if(settings.bic) { %>BIC : <%= settings.bic %><% } %>\n <% } %>\n </div>\n </div>\n <% } %>\n <% if (settings && settings.bonPour && (idEstimateInvoiceType === ${EstimateInvoiceType.DEVIS} || idEstimateInvoiceType === ${EstimateInvoiceType.BON})) { %>\n <br/>Bon pour accord : <br/><br/><br/><br/>\n <% } %>\n\n <% if (cgv && ((settings && settings.invoiceCgv) || idEstimateInvoiceType === ${EstimateInvoiceType.DEVIS} || idEstimateInvoiceType === ${EstimateInvoiceType.BON})) { %>\n <br><div style=\"page-break-after:always;\"></div>\n <%- cgv %>\n <% } %>\n </body>\n\n <style>\n ${commonTemplate.style}\n </style>\n</html>`;"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@silexpert/core",
3
- "version": "1.0.81",
3
+ "version": "1.0.84",
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",
@@ -30,7 +30,7 @@ export const Vat:VatTypeEnum = {
30
30
  roundPercentage: [0],
31
31
  isVatImportation: false,
32
32
  isVatIntracom: false,
33
- saleName: 'Hors-Taxe',
33
+ saleName: 'HT',
34
34
  },
35
35
  TX_5_5: {
36
36
  id: 2,
@@ -8,6 +8,7 @@ export interface IBalanceSheet {
8
8
  state: number;
9
9
  dateBalanceSend: Date | null;
10
10
  deadline: Date | null;
11
+ bankCollectingState: number;
11
12
  idExercice: number;
12
13
  idCalendarEvent: number | null;
13
14
  createdAt?: Date | null;
@@ -34,7 +34,6 @@ export function generateCommercialDocument(idEstimateInvoiceType: EstimateInvoic
34
34
  discount: payload.discount ?? null,
35
35
  vatMention: payload.vatMention ?? null,
36
36
  phoneContact: payload.settings?.phoneContact ?? null,
37
- comment: payload.comment && typeof payload.comment === 'string' ? payload.comment.replace(/\n/g, '<br/>') : payload.comment,
38
37
  products,
39
38
  vats,
40
39
  totalTaxExcluded: _sumBy(products, 'totalTaxExcluded'),
@@ -66,7 +65,14 @@ export function generateCommercialDocument(idEstimateInvoiceType: EstimateInvoic
66
65
 
67
66
  return {
68
67
  header: ejs.render(commonTemplate.header, data),
69
- body: ejs.render(bodyTemplate, data),
68
+ body: ejs.render(bodyTemplate, {
69
+ ...data,
70
+ comment: data.comment && typeof data.comment === 'string' ? data.comment?.replace(/\n/g, '<br/>') : null,
71
+ products: data.products.map((p) => ({
72
+ ...p,
73
+ comment: p.comment && typeof p.comment === 'string' ? p.comment?.replace(/\n/g, '<br/>') : null,
74
+ })),
75
+ }),
70
76
  footer: ejs.render(commonTemplate.footer, { ...data, freeText: documentFreeText ?? null }),
71
77
  data,
72
78
  };
@@ -87,7 +93,6 @@ export function generateAdvanceDocument(payload: CreateInvoiceDocument): ReadCom
87
93
  totalTaxIncluded: payload.deposit,
88
94
  totalTaxAndDiscountIncluded: payload.deposit,
89
95
  generalDiscountFormatted: null,
90
- comment: payload.comment && typeof payload.comment === 'string' ? payload.comment.replace(/\n/g, '<br/>') : payload.comment,
91
96
  depositFormatted: integerToFormattedAmountString(payload.deposit),
92
97
  totalTaxExcludedFormatted: integerToFormattedAmountString(payload.deposit),
93
98
  totalTaxIncludedFormatted: integerToFormattedAmountString(payload.deposit),
@@ -113,7 +118,14 @@ export function generateAdvanceDocument(payload: CreateInvoiceDocument): ReadCom
113
118
 
114
119
  return {
115
120
  header: ejs?.render(commonTemplate.header, data),
116
- body: ejs?.render(bodyTemplate, data),
121
+ body: ejs?.render(bodyTemplate, {
122
+ ...data,
123
+ comment: data.comment && typeof data.comment === 'string' ? data.comment?.replace(/\n/g, '<br/>') : null,
124
+ products: data.products.map((p) => ({
125
+ ...p,
126
+ comment: p.comment && typeof p.comment === 'string' ? p.comment?.replace(/\n/g, '<br/>') : null,
127
+ })),
128
+ }),
117
129
  footer: ejs?.render(commonTemplate.footer, { ...data, freeText: payload?.settings?.freeInvoiceText ?? null }),
118
130
  data,
119
131
  };
@@ -25,7 +25,6 @@ export function getTotalTaxExcluded(product: IProductInvoice): number {
25
25
  export function productToReadProductEditing(payload: IProductInvoice): ReadProductEditing {
26
26
  return {
27
27
  ...payload,
28
- comment: payload.comment && typeof payload.comment === 'string' ? payload.comment.replace(/\n/g, '<br/>') : payload.comment,
29
28
  totalTaxExcluded: getTotalTaxExcluded(payload),
30
29
  unitFormatted: Object.values(Unit).find((unit) => unit.id === payload.unit)?.shortName ?? '',
31
30
  vatFormatted: getById(payload.idVat)?.saleName ?? '',
@@ -53,8 +53,8 @@ const headOfDocument = `<div class="row space-between">
53
53
  <p></p>
54
54
  <% if (thirdParty) { %>
55
55
  <div class="<%= settings && settings.isCoordinatesFrameDisplayed ? 'customer-border' : '' %>">
56
- <% if(thirdParty.fullname) {%><b><%= thirdParty.fullname %></b><br/><% } %>
57
- <% if(thirdParty.company) {%><%= thirdParty.company %><br/><% } %>
56
+ <% if(thirdParty.company) {%><b><%= thirdParty.company %></b><br/><% } %>
57
+ <% if(thirdParty.fullname) {%><%= thirdParty.fullname %><br/><% } %>
58
58
  <% if(thirdParty.address) {%><%= thirdParty.address %><br/><% } %>
59
59
  <% if(thirdParty.zipCode) {%><%= thirdParty.zipCode + ' ' %><% } %><%= thirdParty.city %> <%= thirdParty.country %><br/>
60
60
  <% if(thirdParty.deliveryAddress && thirdParty.deliveryCity && thirdParty.deliveryZipCode) {%>Adresse de livraison : <%= thirdParty.deliveryAddress %> <%= thirdParty.deliveryZipCode %> <%= thirdParty.deliveryCity %> <%= thirdParty.deliveryCountry %><br/><% } %>