This topic is locked
[SOLVED]

Conditional formating of totals on list-page

2/14/2024 6:42:21 AM
PHPRunner General questions
S
SVblue author

I've a list of numeric values.
At the end I sum up by using "totals".
Is it poosible to change the color of the total-value if this value is less then/more then a fix value?

admin 2/14/2024

I think this is something that needs to be coded completely manually. I would use a code snippet there where I can calculate the current total and display it in different colors based on some condition.

S
SVblue author 2/15/2024

Thanks,
that works on list-page.
But trying to print the is no id-value (lfdnr) by getMasterRecord() !?

img alt

For calculating I need this identifier. How to get this on print-view and pdf?

fhumanes 2/18/2024

Hello,

If you use this method to put group such: https://fhumanes.com/blog/guias-desarrollo/guia-16-phprunner-totales-en-grupo-en-paginas-list/

Then you have control to represent the total as you want, color change, font size, label, etc.

Greetings,
fernando

jadachDevClub member 2/18/2024

I had success using javascropt

// Get the element by its ID
var total1AmountElement = document.getElementById("total1_Amount");

// Get the text content of the element and convert it to a number
var total1Amount = parseFloat(total1AmountElement.textContent);

// Check if the value is less than 0
if (total1Amount < 0) {
// Change the color of the element
total1AmountElement.style.color = "red";
}
else
{
total1AmountElement.style.color = "green";
}

fhumanes 2/19/2024

Thanks for sharing.

Greetings,