Color-coding Reservations for special fields |
Top Previous Next |
(From Newsletter #49, Feb 27, 2023)
DISCLAIMER: This article involves Advanced Customizations, which can be technically challenging to get working and is not part of standard support. This is programming and must be done precisely or the results can be unpredictable. This information is provided as a service for those who have the technical skills to work through it -- we cannot help you solve any issues with getting it working. For more information about Advanced Customizations, see the full documentation:
https://campgroundmaster.com/help/overview32.html
A previous newsletter explained a simple way to add a Color Scheme to color-code new Reservation Types using the "Quick-Add" feature:
https://campgroundmaster.com/help/color-codingreservationtypes.html
However, you may want to color-code reservations based on some field other than the Reservation Type. While you could just add a Color Rule that checks the field, this can lead to problems (e.g. it would always be that custom color even if it's checked out, etc). The rules should still be checking the status of the reservation so it must have a separate rule for each status that should be a special color.
Here's the basic information using the Quick-Add function to get the basic rules inserted, but modifying them for a different field (please refer to the previous article linked above and understand that method before proceeding). Keep in mind that this is a relatively complicated customization and should not be attempted if you're not familiar with the functions mentioned or have not read the Advanced Customizations documentation. Support will not be able to help you get this working.
1. Go to Maintenance / Advanced Customizations / Color Schemes.
2. If you already have a Color Scheme you're using for Reservations, select that and Edit it to add more rules. Otherwise click "Add scheme definition", and give it a name like "Reservations override". Note that only one Color Scheme can be used to override the normal reservations colors, so if you have multiple types, etc. then the rules for all of them need to be defined in this one scheme.
3. Select the Default scheme "Reservations".
4. Click "Quick-add Resv Type", and select an appropriate Reservation Type from the list that appears (which also correlates to reservations using the special field you're interested in). A list of Rules will be automatically added with the appropriate expressions programmed in them. The colors assigned at this point will be the same as the Base type (e.g. Normal or Monthly).
5. If you have more than one Reservation Type that you want to color-code based on the special field, repeat step 4 for each one (they must all be in the same Color Scheme definition). However if you don't need the color for your special field to be different for each reservation type, then you don't need to add each type (see below) -- but you DO need to add at least one type of each BASE type that will be affected (e.g. Normal, Monthly, Group, and Free Stay) because they use different sets of ColorStatusResv() values -- you just don't have to create rules for each type that's the same BASE type.
6. So far the rules are checking the reservation types, but you need to edit the rules to add your special field check. You will see a series of rules that look something like:
ColorStatusResv(Resv(),ThisDate(),ThisPeriod()) = 28 AND Resv:Resv_Type = "Normal"
Double-click on each Rule (line in the table) to Edit the Rule
- The first part, before the "AND", must not be changed.
- If (and only if) you don't care about the specific Resv Type for the color (all Types of the same base type will be the same color if your special field condition is met), then you can remove everything after the AND. Otherwise, add another AND (make sure you have spaces around the word AND).
- Now Add a condition expression for your special field. The format depends on the field type -- you will need to understand Expressions and conditions (refer to the Advanced Customization documentation for details). Here are a few examples:
If it's a text field or list, like Discount Used:
Resv:Resv_Discount_Used = "Military"
If it's an Attribute field, like 50A:
Resv:Attrib_50A = "Must Have"
If it's a Boolean field, e.g. one you added yourself:
Resv:Resv_User_WiFi = .T.
So for instance the resulting rule will look like:
ColorStatusResv(Resv(),ThisDate(),ThisPeriod()) = 28 AND Resv:Resv_Type = "Normal" AND Resv:Resv_User_WiFi = .T.
...or if you didn't need a specific Resv Type, you can remove that part:
ColorStatusResv(Resv(),ThisDate(),ThisPeriod()) = 28 AND Resv:Resv_User_WiFi = .T.
Note: Ignore the "28" value in these examples! This will be different for each rule and corresponds to the specific reservation status for that color -- do not change it!
Repeat for every Rule that was added.
7. Now you just need to edit the colors -- double-click on each Rule (line in the table) to Edit Rule, and then use the Change Text Color and/or Change Background Color accordingly.
8. IMPORTANT -- Now once the scheme is complete and you Save it, there's one more thing you need to do -- make this scheme the default for reservations. Go to Maintenance / Advanced Customizations / Select Global Color Schemes, and select the scheme you just created in the drop-down list after "Override reservation names with color scheme:".
Now your new colors should be used on the Rack and other tab views, wherever a reservation name is normally colored. The Color Key will also show your new definitions along with the default ones, in case the operators need a reference. You can also edit the new colors directly from the Color Key.