document
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
document [2017/06/28 01:22] – created marco | document [2020/03/14 22:53] (current) – ddam | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | In this page you can Change create or change the number | + | Document templates are used by Hoteldruid to generate all kinds of records |
+ | Thanks to the use of variables, repetitions | ||
- | Here's an [[example]] of an invoice using HTML | + | ====== Editing documents ====== |
- | From "configure | + | It's important to understand the logic of how documents function, which can be a little offsetting at first. There is two sides to documents: the first side is the visual part of the document, i.e. which data to display where inside the generated record. This happens on the main document modification page. The second side is the creation of the content itself, where you can use variables and rules that set those variables, as the record is being generated. This happens on the "Custom variables |
- | can edit the texts of documents to be printed, saved or emailed. | + | |
- | The texts must be inserted | + | ===== Document modification page ===== |
- | text to send emails. You'll find some examples of alredy | + | |
- | documents after intalling php-residence. To easily | + | As administrator, click on " |
- | document you can write the text in your preferred program (like | + | |
- | Word or OpenOffice), save it in RTF format and reopen | + | ==== Document formats ==== |
- | text editor, then copy all the text and paste it in the | + | |
- | document. | + | Documents can be created |
- | In the documents you can use predefined variables that, if left | + | You'll find more examples of already |
- | empty, will be replaced by spaces to be filled | + | |
- | document | + | |
- | repeated | + | === RTF/HTML documents === |
- | whole document will be repeated). Inside these parts other lists | + | To easily |
- | can be inserted with tags [r2][/ | + | |
- | (for extra costs). For example for the list with guests data the | + | |
- | variables end all with the " | + | === Variables (all document formats) === |
- | variables that can be inserted are (the complete list is in the | + | Inside |
- | page where you modify | + | |
+ | == Inline | ||
+ | For simple documents created | ||
+ | |||
+ | == Available built-in variables == | ||
+ | Some available variables that can be inserted are (the complete list is in the | ||
+ | drop-down menu of the Document modification page): | ||
Client' | Client' | ||
Line 61: | Line 68: | ||
respective values | respective values | ||
[sel_extra_cost_name] name of the extra cost selected before | [sel_extra_cost_name] name of the extra cost selected before | ||
- | viewing the document | + | viewing the record |
[sel_extra_cost_value] value of the extra cost selected before | [sel_extra_cost_value] value of the extra cost selected before | ||
- | viewing the document | + | viewing the record |
[today] today date | [today] today date | ||
[price_tot_p], | [price_tot_p], | ||
Line 74: | Line 81: | ||
< | < | ||
- | is not added to the document | + | is not added to the record |
[email_already_sent] 1 if an email with the same subject has | [email_already_sent] 1 if an email with the same subject has | ||
already been sent to client, otherwise 0 | already been sent to client, otherwise 0 | ||
Line 80: | Line 87: | ||
instead of the document</ | instead of the document</ | ||
- | ---- | + | == Custom variables == |
+ | You may create and use custom variables as you see fit. Please refer to the " | ||
+ | === 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: < | ||
+ | will display surnames for all reservations from the current view (e.g. " | ||
+ | The document parts that are enclosed in [r][/r] tags will be | ||
+ | repeated for each reservation. Inside these parts, other lists | ||
+ | can be inserted with tags [r2][/r2] (for guests) or [r3][/ | ||
+ | (for extra costs). | ||
+ | You can use the '' | ||
+ | on the Document modification page to easily add repetitions inside your documents.\\ | ||
- | Rules to consider | + | == Caveats |
- | | + | __Use specific variables inside repetitions__ |
+ | | ||
+ | *r6 repetitions: | ||
+ | __Special cases__ | ||
+ | *r4 repetitions: | ||
+ | *The tags for reservations repetition ([r][/r]) are forbidden in multilingual mode (i.e. the whole document is repeated for each reservation).\\ | ||
+ | |||
+ | ===== " | ||
+ | On the lowest part of the Document modification page, you will find a button called " | ||
+ | |||
+ | === Custom variables and arrays === | ||
+ | You can create whichever variable you want, valid for just this document, or usable in all.\\ | ||
+ | **WARNING: | ||
+ | |||
+ | Arrays are variables of variables. They are key/value pairs: at each key (or index, or position) inside the array, is stored a value. | ||
+ | You can create arrays of any existing variable (custom or built-in). They can be useful when working with periods (e.g. arrays of days (r4)), or when you don't know exactly how many variables your document will need. | ||
+ | For instance, let's assume you want to count your guests by nationality: | ||
+ | |||
+ | ==== (Rule) conditions ==== | ||
+ | Rule conditions are at the heart of documents. By configuring them, ordering them, and nesting them (i.e. deciding inside which kind of repetition they should be used), you can set all your custom variables to the values you need, and then have those values appear inside the record. | ||
+ | |||
+ | **Caveat:** When nesting a repetition inside another one, e.g. an extra-costs repetition inside a reservation repetition, like: < | ||
+ | |||
+ | ------ | ||
+ | |||
+ | TBC | ||
* you can compare dates with format YYYY-MM-DD in " | * you can compare dates with format YYYY-MM-DD in " | ||
+ |
document.1498612975.txt.gz · Last modified: 2017/06/28 01:22 by marco