To solve this optimization problem, we first need to define the decision variables and the objective function. Let's denote the number of orders of fries as $F$ and the number of orders of onion rings as $R$. The profit per order of fries is $4, and the profit per order of onion rings is $5. Therefore, the total profit can be represented as $4F + 5R$.

The constraints are as follows:
1. The food truck must sell at least 20 orders of fries: $F \geq 20$
2. The food truck can make at most 50 orders of fries: $F \leq 50$
3. The food truck must sell at least 10 orders of onion rings: $R \geq 10$
4. The food truck can make at most 40 orders of onion rings: $R \leq 40$
5. The total number of orders cannot exceed 50: $F + R \leq 50$

Since we want to maximize the profit, we will use these constraints and the objective function to formulate a linear programming problem.

```python
from gurobipy import *

# Create a new model
m = Model("Food Truck Profit Maximization")

# Define the decision variables
F = m.addVar(name="fries", lb=20, ub=50)  # Number of orders of fries
R = m.addVar(name="onion_rings", lb=10, ub=40)  # Number of orders of onion rings

# Define the objective function: Maximize profit
m.setObjective(4*F + 5*R, GRB.MAXIMIZE)

# Add constraints
m.addConstr(F + R <= 50, name="total_orders")  # Total orders cannot exceed 50

# Optimize the model
m.optimize()

# Print the results
if m.status == GRB.OPTIMAL:
    print("Optimal solution found:")
    print(f"Orders of fries: {F.x}")
    print(f"Orders of onion rings: {R.x}")
    print(f"Maximum profit: ${4*F.x + 5*R.x:.2f}")
else:
    print("No optimal solution found")
```