PHP code in Documents.

Discuss here how to configure hoteldruid and better use its features.

Moderator: marco

Post Reply
MarcAstr0
Posts: 12
Joined: Wed Apr 16, 2008 6:19 pm
Location: Santiago, Chile

PHP code in Documents.

Post by MarcAstr0 »

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.
MarcAstr0
Posts: 12
Joined: Wed Apr 16, 2008 6:19 pm
Location: Santiago, Chile

Post by MarcAstr0 »

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.
gonesouth
Posts: 105
Joined: Fri Apr 25, 2008 12:59 am
Location: Canada

Post by gonesouth »

I don't see why not. If not, just code a file in php that does what you want, place it on the server, and have your accountant call it when needed.
marco
Posts: 1332
Joined: Tue Jul 05, 2005 6:00 pm
Location: Roma, Italia

Post by marco »

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
Problems installing, configuring, upgrading?
Try the easiest way to use HotelDruid:
https://www.digitaldruid.net/hosted/index.php
Post Reply