If Else statement in Complementary attributes (lines)

Hello,

Currently I am using the following code to display inventory in the sales order forms

And it works perfectly for the sales orders.

Now I would like to be able to show on the PDF whether something is in stock or not.
not by displaying the actual inventory, but by using the and if else statement.

example:

If

warehouse inventory is available by matching the quantity to order

  • show on PDF = Ex-stock

Else

Warehouse stock partially available

  • show on PDF = Partially in stock

Else

No stock available

  • show on PDF = Out of stock

I know I need to create new additional attributes that will only appear in the PDF.

Can someone help me?