User Tools

Site Tools


document

This is an old revision of the document!


Document templates (simply called “documents” hereafter) are used by hoteldruid to generate all kinds of records that might be needed for daily operations (reports, invoices, contracts, etc.). Thanks to the use of variables, repetitions and conditions, documents are a powerfull tool that can save a lot of time once properly set up.

The Documents section

Click on “Configure”, then “Documents”, to land on the Documents page. Here you can create and modify documents. Clicking on a document's number, you will open the Document modification page, where you can edit its content. Documents can be created in HTML, RTF, e-mail and text format. Here's an example of an invoice using HTML. You'll find more examples of alredy usable documents after a fresh intall of hoteldruid.

RTF Documents

To easily create an RTF document, you can write the text in your preferred word processing software (like Microsoft Word or LibreOffice/OpenOffice Writer) and save it in RTF format, using all needed variables inside the document. In order to make sure formatting is kept, it might help to use the provided RTF example file as a starting point (some advanced formatting might get lost when starting from scratch): to download the example file, just click “View document” inside its modification page. Once edited, saved and closed, you can reopen the RTF file with a text editor (like Notepad on Windows, or Leafpad on Linux), then copy all the raw text (i.e. RTF code) and paste it inside a document from hoteldruid.

Variables (all document formats)

Inside documents, you can use predefined variables that will take the corresponding value when the document is generated by hoteldruid. Combined with repetitions, variables allow to iterate through lists of reservations, guests, rooms, costs, etc. If a variable is empty (i.e. is not set by hoteldruid because data is missing), it will be replaced by spaces in order to be filled in by hand.
If you choose to edit your document directly on the document modification page (instead of using an external editor/word processor), you can use the Variables drop-down menu to easily add some variable: first choose a variable, then place the cursor where you want the variable inside the document, then click on the Add button. Some available variables that can be inserted are (the complete list is in the drop-down menu of the document modification page):

Client's data:

[surname]		surname
[name]			name
[birthdate]		birthday
[Mr]			'' (if male) or 's' (if female)
[nation]		origin nation
[city]			residence city
[street]		street
[street2]		the same as $street but if it's not 
			defined it inserts the word street 
			before the spaces
[street_number]		street number
[postal_code]		postal code
[telephone]		telephone number
[telephone2]		second telephone
[telephone3]		third telephone
[fax]			fax number

Reservation's data:

[people_num]		number of people
[extra_beds_num]	number of extra beds from the costs
[people_num_tot]	number of people + extra beds
[price_tot]		complete price
[deposit]		deposit
[deposit_rest]		complete price - deposit
[starting_date]		starting date
[ending_date]		departure date
[rate_name]		rate name
[rate_price]		price without extra costs and discount
[discount]		discount
[comment]		comment
[apartment]		apartment number
[apartment_list]	list of apartments that can be assigned 
			separated by commas
[paid]			what has been paid until now
[all_extra_costs]	list with all the extra costs and their
			respective values
[sel_extra_cost_name]	name of the extra cost selected before 
			viewing the document
[sel_extra_cost_value]	value of the extra cost selected before
			viewing the document
[today]			today date
[price_tot_p],		as the previous ones without final _p  
[deposit_p],[paid_p],	but formatted with points or commas  
[deposit_rest_p],	between thousands and decimals
[rate_price_p],
[discount_p],
[all_extra_costs_p],
[sel_extra_cost_value_p]
[repetition_error]	when not empty the current reservation 
			is not added to the document
[email_already_sent]	1 if an email with the same subject has 
			already been sent to client, otherwise 0
[error_message]		when not empty its contents are shown 
			instead of the document

Repetitions

Repetitions allow to iterate through lists: by enclosing variables inside repetition tags, hoteldruid will automatically replace the variable names with the corresponding data, and loop through all elements of the list. Example:

[r][surname][/r]

will display surnames for all reservations from the current view (e.g. “Arrivals”). The document parts that are enclosed in [r][/r] tags will be repeated for each reservation (if these tags are not present the whole document will be repeated). Inside these parts, other lists can be inserted with tags [r2][/r2] (for guests) or [r3][/r3] (for extra costs).
Please note:

  • When creating a list with guest data (which is done with a [r2] repetition), you need to use the variables ending with the “_guest” suffix inside this repetition. These variables are only defined inside a guest repetition.
  • When creating a list with room data (which is done with a [r6] repetiton), you need to use the variables beginning with “unit_” inside this repetition. These variables are only defined inside a room repetition.
  • When you have a repetition of reservations ([r][/r]) inside a repetition of dates ([r4 array=“dates_array”][/r4]), then only reservations that are present in current date will be repeated.
  • The tags for reservations repetition ([r][/r]) are forbidden in multilingual mode (i.e. the whole document is repeated for each reservation).

You can use the Limits of drop-down menu (same usage as variables) on the document modification page to easily add repetitions inside your documents.


Rules to consider when editing a document:

  • you can compare dates with format YYYY-MM-DD in “if” conditions, then the date format is changed when they are displayed or assigned to other variables
document.1523619495.txt.gz · Last modified: 2018/04/13 11:38 by ddam