Page 1 of 1

Understanding units repetition loop and conditions in Docume

Posted: Sat Jun 13, 2015 12:42 pm
by Martin Pusch
Hello,

I'd like to understand the good usage of the units repetition loop in the documents. I tried several possibilities, with simple loops, nested loops, documents in different situations…

Code: Select all

[r6]
Room: [occupied_unit] Name: [surname]
[/r6]
Has anybody an example for me?

Another question:

I've worked for the first time with "part under condition", with the possibility to compare and decide what to print. Example:

Code: Select all

[c short_stay="false"]
where "short_stay" is a custom variable. This works.
But then I tried to compare two variables, and I didn't find the correct syntax:

Code: Select all

[c ending_date="selection_ending_date"]
[c ending_date=[selection_ending_date]]
[c ending_date="[selection_ending_date]"]
Nothing worked. I found a way using a bunch of custom variables, but the condition thing would have been easier. Any proposition?

Martin

Re: Understanding units repetition loop and conditions in Do

Posted: Sun Jun 14, 2015 5:31 pm
by AndilgE
+1 in the wait list for any further info about this. This will enable proper listing of all extra costs, eg. consumption at the bar, on the generated invoices.

On thing is clear, repetition loop will not work on multilingual base.

Brgs

AndilgE

Re: Understanding units repetition loop and conditions in Do

Posted: Tue Dec 01, 2015 3:24 pm
by marco
Hello,
[r6] is to repeat all units (rooms) in the hotel, all variables beginning with unit_ are only defined inside this repetition. The variables you're using are for reservations, so you probably want them in a reservation loop (for example in a document selected from "current" reservations table). If you want the information ordered by rooms either order the reservations table by room (if you select the document from there) or you need to have firstly a loop of reservations that stores informations in arrays and then a loop of units to show the information (more complicated).

For now the condition can't be compared with another variable, only with a string. In multilingual only the tags for reservations repetition are forbidden (the whole document is repeated for each reservation) the other repetitions should work fine.

Regards,
Marco

Re: Understanding units repetition loop and conditions in Docume

Posted: Thu Jan 18, 2018 9:49 pm
by AndilgE
Hi Marco,

Every now and then I search for further information about the repetitions and fall back to this topic. Can you please give an overview, not just a response to a question on a specific situation?

in php sources I find these repetitions
[r]
[r2]
[r3]
[r4]
[r5]
[r6]

Picking up bits and pieces in forum I managed to gather the following
[r2] is to repeat all the guests, use it with and the variables that end with "_guest"
[r3] is to repeat all the extra costs
[r6] is to repeat all units (rooms)

Please complete the missing ones.

Brgs,

Andi

Re: Understanding units repetition loop and conditions in Docume

Posted: Thu Apr 12, 2018 11:22 pm
by ddam
A more elaborate documentation woud be nice to have indeed !
In the meanwhile, according to this page (http://www.hoteldruid.com/wiki/doku.php?id=document), [r4] is a repetition of dates ([r4 array=“dates_array”][/r4])

I found an example by Marco:
To display a list of daily rates you can create custom variable [day] and a custom array [reservation_days(day)] of the variable day. Then add a condition to assign to that array the progressive values between first arrival and last departure, only when starting reservations repetitions. Insert this in the document text:

[r4 array="reservation_days"]
Day [reservation_days(day)]: [rate_price_of_array_day_p]<br>
[/r4]
Finally, looking at the "Limits of" menu of the Document modification page, we can see that:
[r] is a repetition of reservations
[r5] is a repetition of payments