From 26cd4809282fa19249d77feb4d4672a4eb88b5e7 Mon Sep 17 00:00:00 2001 From: Eric Delord <04-ete.elit@icloud.com> Date: Fri, 3 May 2024 18:23:39 +0200 Subject: [PATCH] fix pay parser --- CHANGELOG.md | 6 ++++++ package.json | 2 +- src/components/PayTable.svelte | 4 ++-- src/parsers/payParser.js | 11 +++++++++-- 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e49107..7764ba0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.3.9] - 2024-05-03 + +### Fixed + +- Correctif pour les frais de transport qui peuvent avoir un détail du kilométrage et un taux de remboursement kilométrique dans certains cas + ## [1.3.8] - 2024-04-19 ### Fixed diff --git a/package.json b/package.json index a5aa875..61efd74 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "flytax", - "version": "1.3.8", + "version": "1.3.9", "type": "module", "scripts": { "build": "rollup -c", diff --git a/src/components/PayTable.svelte b/src/components/PayTable.svelte index a1e9142..416adc5 100644 --- a/src/components/PayTable.svelte +++ b/src/components/PayTable.svelte @@ -209,7 +209,7 @@ font-size: initial; } .col1 { - width: 130px; + width: 140px; } .col2 { width: 50%; @@ -237,7 +237,7 @@ } td input { margin-bottom: 0; - width: 120px; + width: 130px; } td input:disabled { color: var(--green); diff --git a/src/parsers/payParser.js b/src/parsers/payParser.js index acb8a17..b51c0d1 100644 --- a/src/parsers/payParser.js +++ b/src/parsers/payParser.js @@ -77,8 +77,15 @@ export const payParser = (text, fileName, fileOrder) => { let result = {"type": "pay", fileName, fileOrder, errors: []}; let re = /(?:IND\.REPAS_+|INDEMNITE REPAS_+|IR\.FIN ANNEE DOUBL_+|IR EXONEREES_+|IR NON EXONEREES_+)([\-0-9, ]+)/g; result.repas = matchAll(text, re, "0").map(decimal); - re = /(?:IND\. TRANSPORT EXO_+|IND\. TRANSPORT_+|FRAIS REELS TRANSP_+|R\. FRAIS DE TRANSPORT_+)([\-0-9, ]+)/g; - result.transport = matchAll(text, re, "0").map(decimal); + // case where there is a quantity, value, total + re = /(?:IND\. TRANSPORT EXO_+|IND\. TRANSPORT_+|FRAIS REELS TRANSP_+|R\. FRAIS DE TRANSPORT_+)[\-0-9, ]+_[\-0-9, ]+_([\-0-9, ]+)/g; + let matches = matchAll(text, re, "0").map(decimal); + if (matches.toString() == "0.00") { + // case where there is just a total + re = /(?:IND\. TRANSPORT EXO_+|IND\. TRANSPORT_+|FRAIS REELS TRANSP_+|R\. FRAIS DE TRANSPORT_+)([\-0-9, ]+)/g; + matches = matchAll(text, re, "0").map(decimal); + } + result.transport = matches; re = /(?:_I.DECOUCHERS F.PRO_+)([\-0-9, ]+)/g; result.decouchers_fpro = matchAll(text, re, "0").map(decimal); try {