PHP code in Documents.
Moderator: marco
PHP code in Documents.
Is there a way to include PHP code in the Documents? What I want to do is print a bill, with a subtotal excluding the extra costs, so I want to multiply the rate by the number of nights and print that.
Oh, and another thing I need to do is the following: I have a 10% discount as an extra cost, and I need to substract that discount from the rate cost, that does not include extra costs. For example, the bill has to look something like this:
Rate: rate1($33,00)
Number of nights: 2
Subtotal: $66,00
10% Discount: $6,60
Subtotal: $59,4
Extra costs:
Laundry: $5,00
Extra costs subtotal: $5,00
Total: $64,40
I need all these details because the hostel's accountant needs detailed reports. So that's why I'd like to know if somehow I can insert php code in the Documents to do these calculations. Any help is greatly appreciated.
Rate: rate1($33,00)
Number of nights: 2
Subtotal: $66,00
10% Discount: $6,60
Subtotal: $59,4
Extra costs:
Laundry: $5,00
Extra costs subtotal: $5,00
Total: $64,40
I need all these details because the hostel's accountant needs detailed reports. So that's why I'd like to know if somehow I can insert php code in the Documents to do these calculations. Any help is greatly appreciated.
The price without extra costs is already provided in document variables.
For the extra cost discount you can use custom variables, if the name of the extra cost is equal to X put the custom variable equal to 10, otherwise default it with 0 (with an always true expression inserted before). Then you put a 2nd custom variable as rate_price / 100 and then 2nd c.v. = 2nd c.v. * 1st c.v. , so you have the value of the discount. If the value is different than 0 you can add the lines with another custom variable.
Marco
For the extra cost discount you can use custom variables, if the name of the extra cost is equal to X put the custom variable equal to 10, otherwise default it with 0 (with an always true expression inserted before). Then you put a 2nd custom variable as rate_price / 100 and then 2nd c.v. = 2nd c.v. * 1st c.v. , so you have the value of the discount. If the value is different than 0 you can add the lines with another custom variable.
Marco
Problems installing, configuring, upgrading?
Try the easiest way to use HotelDruid:
https://www.digitaldruid.net/hosted/index.php
Try the easiest way to use HotelDruid:
https://www.digitaldruid.net/hosted/index.php