basically I need to generate all possible combinations with room accommodations.
For example:
+-----------+----------+--------------------------+
| Room Type | Quantity | Sub quantity from Double |
+-----------+----------+--------------------------+
| Double | 10 | X |
+-----------+----------+--------------------------+
| Single | 5 | 5 |
+-----------+----------+--------------------------+
| Triple | 3 | 10 |
+-----------+----------+--------------------------+
If we look only Quantity column I can generate the all combinations with cartesian function and the result will be something like follows:
- 1Double 1Single 1Triple
- 2Double 1Single 1Triple
- .................
But the tricky part is for the last column which is something like "virtual" rooms. It show how many double rooms can be used as Single and Triple.
Again from the example we can use 5 out of 10 double rooms as Single and 10 out of 10 double rooms as Triple.
The result from with the accommodations from the last column should be something like this:
- 1Single 0Double 9Triple
- 2Single 0Double 8Triple
- 2Single 1Double 7Triple
Any hints how this can be achieved?