Skip to content

Commit

Permalink
Merge pull request #7 from jajoho/v2.5.X
Browse files Browse the repository at this point in the history
V2.5.2
  • Loading branch information
jajoho authored Feb 9, 2022
2 parents df7b840 + ddfbc38 commit 49dca8f
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 11 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
.vscode/extensions.json
.trunk/trunk.yaml
.trunk/.gitignore
.vscode/launch.json
2 changes: 1 addition & 1 deletion CalculateInterest.grandtotalplugin/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
<key>copyright</key>
<string>CC0 v1.0 2022 Jatayu Holznagel</string>
<key>CFBundleVersion</key>
<string>2.5.1</string>
<string>2.5.2</string>
<key>width</key>
<real>500</real>
<key>GrandTotalMinimumVersion</key>
Expand Down
18 changes: 10 additions & 8 deletions CalculateInterest.grandtotalplugin/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// ownInterestRate -> Own interest rate, if the automatically calculated one is to be overwritten (number)

// Interest rate calculated with actual/360 method (EZB): https://en.wikipedia.org/wiki/Day_count_convention#Actual/360
var actEZB = parseInt(360.00);
var actEZB = 360.00;

// Function to fetch via API the prime rate from bundesbank.de
function getXML() {
Expand All @@ -22,8 +22,9 @@ function getXML() {
return result;

function getString() {
const regExp = /-[0-9]*\.[0-9]+/m;
result = string.match(regExp);
const regExp = /(?:<generic:ObsValue value=")([+-]?(?=\.\d|\d)(?:\d+)?(?:\.?\d*))(?:[eE]([+-]?\d+))?/i;
search = string.match(regExp);
result = search[1];
}
}
}
Expand Down Expand Up @@ -54,10 +55,11 @@ var interestRate = calculatedInterestRate();
// Calculate interest
var sumInterest = ((originalClaimAmount * interestRate) / 100 / actEZB) * delayInDays;

// Options for date format
optionsLocaleDate = {
year: "numeric",
month: "short",
day: "numeric",
year: "numeric", // "numeric" und "2-digit"
month: "short", // "numeric", "2-digit", "narrow", "short" und "long"
day: "numeric", // "numeric" und "2-digit"
};

// Distinction between 1 and several days for notes
Expand All @@ -66,9 +68,9 @@ function localizeDay() {
return `${localize("ErrorDayCount")}`;
}
if (delayInDays == 1) {
return `${localize("DelayPeriod")}: ${new Intl.NumberFormat().format(delayInDays)} ${localize("Day")} (${delayStart.toLocaleDateString(optionsLocaleDate)})`;
return `${localize("DelayPeriod")}: ${new Intl.NumberFormat().format(delayInDays)} ${localize("Day")} (${delayStart.toLocaleDateString(undefined, optionsLocaleDate)})`;
} else {
return `${localize("DelayPeriod")}: ${new Intl.NumberFormat().format(delayInDays)} ${localize("Days")} (${localize("from")} ${delayStart.toLocaleDateString(optionsLocaleDate)} ${localize("until")} ${delayEnd.toLocaleDateString(optionsLocaleDate)})`;
return `${localize("DelayPeriod")}: ${new Intl.NumberFormat().format(delayInDays)} ${localize("Days")} (${localize("from")} ${delayStart.toLocaleDateString(undefined, optionsLocaleDate)} ${localize("until")} ${delayEnd.toLocaleDateString(undefined, optionsLocaleDate)})`;
}
}

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Ein Plugin für GrandTotal, um die Verzugszinsen zu berechnen.
3. Auf das Zahnradsymbol klicken und auf `Verzugszinsen berechnen`.
4. Eigene Werte eintragen (wenn ein eigener Zinssatz angegeben wird, überschreibt dieser den Zinssatz über dem Basiszins).

![Calculate Interest DE](https://user-images.githubusercontent.com/15175599/152795901-5580dc54-0b18-4aac-9740-6503bc979a70.png)
![Verzugszinsen berechnen](https://user-images.githubusercontent.com/15175599/152641374-c7db59d9-2bf1-45eb-ac41-897b7c4fdaa6.png)

#### Berechnungsmethode

Expand All @@ -42,7 +42,7 @@ A plugin for GrandTotal to calculate the default interest.
3. Click on the wheeel icon and on `Calculate interest`.
4. Enter your own values (if your own interest rate is specified, it will overwrite the interest rate above the prime rate).

![Calculate Interest EN](https://user-images.githubusercontent.com/15175599/152795877-f8ccb255-2e0e-4c7a-a14d-88fc43bc0552.png)
![Calculate Interest Rate](https://user-images.githubusercontent.com/15175599/152641465-27db9988-ff97-467b-8806-22ad7a6018de.png)

#### Calculation method

Expand Down

0 comments on commit 49dca8f

Please sign in to comment.