1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
| if (mysql_num_rows($qry))
{
while ($data = mysql_fetch_assoc($qry)){
$success= $xml->createElement('success');
$success = $message->appendChild($success);
$bookings= $xml->createElement('bookings');
$bookings = $message->appendChild($bookings);
$bookings->setAttribute("hotelId",$data['propertys_uid']);
//if (!isset($booking) || $data['contract_uid'] != $bookings->getAttribute('id')) {
$booking= $xml->createElement('booking');
$booking = $bookings->appendChild($booking);
$booking->setAttribute("id",$data['contract_uid']);
$booking->setAttribute("action","Create");// test IF cancel=0 { action=Creat} else {action=cancel}
$booking->setAttribute("currency",$data['currency']);
$booking->setAttribute("date",$data['date_achat']);
$booking->setAttribute("totalAmount",$data['contract_total']);
$booking->setAttribute("paidAmount",$data['deposit_paid']);
$booking->setAttribute("dueAmount",$data['dueAmount']);
$booking->setAttribute("origin","");
$booking->setAttribute("paxCount",$data['paxCount']);
$customer= $xml->createElement('customer');
$customer = $booking->appendChild($customer);
$customer->setAttribute("firstName",$data['firstname']);
$customer->setAttribute("lastName",$data['surname']);
$customer->setAttribute("title","");
$contact= $xml->createElement('contact');
$contact = $customer->appendChild($contact);
$contact->setAttribute("email",$data['email']);
$contact->setAttribute("phone",$data['tel_mobile']);
$contact->setAttribute("fax",$data['tel_fax']);
$address= $xml->createElement('address');
$address = $contact->appendChild($address);
$address->setAttribute("city",$data['town']);
$address->setAttribute("country",$data['country']);
$address->setAttribute("postalCode",$data['postcode']);
$creditCard= $xml->createElement('creditCard');
$creditCard = $customer->appendChild($creditCard);
$distributor= $xml->createElement('distributor');
$distributor = $booking->appendChild($distributor);
if (!isset($room) || $data['room_uid'] != $room->getAttribute('id')) {
$rooms = $xml->createElement('rooms');
$rooms = $booking->appendChild($rooms);
$room = $xml->createElement('room');
$room = $rooms->appendChild($room);
$room->setAttribute("id",$data['room_uid']);
$stays = $xml->createElement('stays');
$stays = $room->appendChild($stays);
$stay = $xml->createElement('stay');
$stay = $stays->appendChild($stay);
$stay->setAttribute("date",$data['date']);
$stay->setAttribute("quantity",$data['nbroom']);
$stay->setAttribute("unitPrice",$data['prix']);
$stay->setAttribute("rateCode",$data['rateuid']);
$guests = $xml->createElement('guests');
$guests = $room->appendChild($guests);
$guest = $xml->createElement('guest');
$guest = $guests->appendChild($guest);
$guest->setAttribute("firstName",$data['firstname']);
$guest->setAttribute("lastName",$data['surname']);
$guest->setAttribute("title","");
} |
Partager