Advertisement
Guest User

Untitled

a guest
Apr 24th, 2014
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 74.85 KB | None | 0 0
  1. <?php
  2.  
  3. global $config;
  4. mysql_connect($config->database->params->host, $config->database->params->username, $config->database->params->password);
  5. mysql_select_db($config->database->params->dbname);
  6.  
  7. define("IMG_PATH", 'uploads');
  8. //define("hosturl_1","http://".$_SERVER['HTTP_HOST']."/");
  9. define("hosturl_1", "http://manage.rentalcommand.com/");
  10.  
  11. $path = str_replace("../", "", IMG_PATH);
  12.  
  13. function SMTP_AUTH_MAIL($from, $to, $subject, $body, $host, $username, $password) {
  14.     //echo $from.$to.$subject.$host.$username.$password;
  15.     //extract($_REQUEST);
  16.     //$from = "<".$from_booking.">";
  17.     // $to = $test_email;
  18.     // $subject = "Hi!";
  19.     //$body = "<table><tr><td><strong>hello gopesh</strong></td><td>hjkgsdjfghsd</td></tr></table>";
  20.     // $host = "smtp.gmail.com";
  21.     //$username = $username;
  22.     // $password =$password;
  23.  
  24.     $headers = array('From' => $from,
  25.         'To' => $to,
  26.         'Subject' => $subject,
  27.         'MIME-Version' => '1.0\r\n',
  28.         'Content-type' => 'text/html');
  29.  
  30.     $smtp = Mail::factory('smtp', array('host' => $host,
  31.                 'auth' => true,
  32.                 'username' => $username,
  33.                 'password' => $password));
  34.  
  35.     $mail = $smtp->send($to, $headers, $body);
  36.  
  37.     if (PEAR::isError($mail)) {
  38.         echo("<p>" . $mail->getMessage() . "</p>");
  39.     } else {
  40.         return 1;
  41.     }
  42. }
  43.  
  44. function check_price($table, $column, $condition, $value, $booking_days) {
  45.     $qry = "SELECT $column FROM $table WHERE $condition=$value";
  46.  
  47.     $res = mysql_query($qry);
  48.     $f_res = mysql_fetch_assoc($res);
  49.  
  50.     if ($f_res['rate_type'] == 'Weekly') {
  51.         if ($f_res['min_req_duration'] == 0) {
  52.             $optional_upgrade_price = ($f_res['upgradePrice'] * $booking_days) / 7;
  53.         } elseif ($booking_days > 7) {
  54.             $optional_upgrade_price = ($f_res['upgradePrice'] * $booking_days) / 7;
  55.             //  $optional_upgrade_price.= $optional_upgrade_price ($f_res['upgradePrice']."/wk");
  56.         } elseif ($f_res['min_req_duration'] == 7) {
  57.             $optional_upgrade_price = $f_res['upgradePrice'];
  58.             //  elseif (($f_res['min_req_duration'] == 7) && ($booking_days > $f_res['min_req_duration']) ) {
  59.             //  $optional_upgrade_price= $optional_upgrade_price= ($f_res['upgradePrice']*$booking_days)/7;;
  60.             // }
  61.         }
  62.     } else {
  63.         $optional_upgrade_price = $f_res['upgradePrice'] * $booking_days;
  64.     }
  65.     return number_format($optional_upgrade_price, 2);
  66. }
  67.  
  68. function get_optiional_ugrade_list() {
  69.     $fq = "SELECT * FROM optional_upgrade_property";
  70.     $frun = mysql_query($fq);
  71.     $x = array();
  72.     while ($frow = mysql_fetch_array($frun)) {
  73.         $x[$frow['CounterId']]['opUpgradeName'] = $frow['opUpgradeName'];
  74.         $x[$frow['CounterId']]['rate_type'] = $frow['rate_type'];
  75.     }
  76.     return $x;
  77. }
  78.  
  79. function unhtmlentities($string) {
  80.     // replace numeric entities
  81.     $string = preg_replace('~&#x([0-9a-f]+);~ei', 'chr(hexdec("\\1"))', $string);
  82.     $string = preg_replace('~&#([0-9]+);~e', 'chr("\\1")', $string);
  83.     // replace literal entities
  84.     $trans_tbl = get_html_translation_table(HTML_ENTITIES);
  85.     $trans_tbl = array_flip($trans_tbl);
  86.     return strtr($string, $trans_tbl);
  87. }
  88.  
  89. /* function get_optiional_ugrade_list()
  90.   {
  91.   $fq="SELECT * FROM optional_upgrade";
  92.   $frun=mysql_query($fq);
  93.   $x=array();
  94.   while($frow=mysql_fetch_array($frun))
  95.   {
  96.   $x[$frow['CounterId']]=$frow['opUpgradeName'];
  97.   }
  98.   return $x;
  99.   } */
  100.  
  101. function get_val_col($tabel, $column, $condition, $value, $oder = '') {
  102.     $fq = "SELECT $column FROM $tabel WHERE  $condition='$value' $oder";
  103.     $frun = mysql_query($fq);
  104.     $frow = mysql_fetch_array($frun);
  105.     return $frow[$column];
  106. }
  107.  
  108. function get_val_col_result($tabel, $column, $condition, $value, $oder = '') {
  109.     $fq = "SELECT $column FROM $tabel WHERE  $condition='$value' $oder";
  110.     $frun = mysql_query($fq);
  111.     $frow = mysql_fetch_array($frun);
  112.     return $frow;
  113. }
  114.  
  115. /* function get_val_col_result_1($tabel,$column,$condition,$value,$oder='')
  116.   {
  117.   $fq="SELECT $column FROM $tabel WHERE  $condition='$value' and site_id='".$_SESSION['user_site_id']."' $oder";
  118.   $frun=mysql_query($fq);
  119.   $frow=mysql_fetch_array($frun);
  120.   return $frow;
  121.   } */
  122.  
  123. function get_val_col_result_1($tabel, $column, $condition, $value, $oder = '') {
  124.     $fq = "SELECT $column FROM $tabel WHERE  $condition='$value' and site_id='" . $siteKey . "' $oder";
  125.     $frun = mysql_query($fq);
  126.     $frow = mysql_fetch_array($frun);
  127.     return $frow;
  128. }
  129.  
  130. function get_smtp_detail() {
  131.     $smq = "SELECT * FROM smtp_authentication WHERE site_id='" . $_SESSION['user_site_id'] . "'";
  132.     $smrun = mysql_query($smq);
  133.     $smrow = mysql_fetch_array($smrun);
  134.     return $smrow;
  135. }
  136.  
  137. //echo "<br><br>Amount: ";print_r($row2['credit_amount']);
  138.  
  139.  
  140. $q = "SELECT * FROM propertybooking_summary WHERE booking_reference='$booking_reference' group by booking_reference";
  141. $run1 = mysql_query($q);
  142. $row1 = mysql_fetch_array($run1);
  143. $guestRecipt = $row1['guest_reciept'];
  144. $OwnerID = get_val_col("propertymaster", "OwnerID", "PropertyID", $row1['PropertyID']);
  145. $ManagerID = get_val_col("propertymaster", "ManagerID", "PropertyID", $row1['PropertyID']);
  146. $crossID = get_val_col("propertymaster", "crosshire_id", "PropertyID", $row1['PropertyID']);
  147. $booking_source = $row1['booking_source'];
  148.  
  149. $qp = "SELECT * FROM propertymaster WHERE PropertyID='" . $row1['PropertyID'] . "'";
  150. $runp1 = mysql_query($qp);
  151. $rowp1 = mysql_fetch_array($runp1);
  152.  
  153. $guestlastname = get_val_col("propertybooking_payment", "last_name", "booking_reference", $row1['booking_reference'], 'order by CounterID desc');
  154. $Manager_Email = get_val_col("contacts", "Email", "CounterID", $ManagerID);
  155. $Owner_Email = get_val_col("contacts", "Email", "CounterID", $OwnerID);
  156. $Cross_Email = get_val_col("contacts", "Email", "CounterID", $crossID);
  157. $Agent_Email = get_val_col("contacts", "Email", "CounterID", $row1['agent_id']);
  158.  
  159. //$frommail=get_val_col("site_info","Email","site_reference",$_SESSION['user_site_id']);
  160. $frommail = get_val_col("site_info", "Email", "site_reference", $siteKey);
  161.  
  162. //$fromnotification=get_val_col("site_info","from_booking","site_reference",$_SESSION['user_site_id']);
  163. $fromnotification = get_val_col("site_info", "from_booking", "site_reference", $siteKey);
  164.  
  165. if ($fromnotification != '')
  166.     $frommail = $fromnotification;
  167.  
  168. $Owner_Lastname = get_val_col("contacts", "LastName", "CounterID", $OwnerID);
  169. $pro_title = get_val_col("propertymaster", "Title", "PropertyID", $row1['PropertyID']);
  170. $pro_addr = get_val_col("propertymaster", "Addr1", "PropertyID", $row1['PropertyID']);
  171. $pro_city = get_val_col("propertymaster", "City", "PropertyID", $row1['PropertyID']);
  172. $pro_state = get_val_col("propertymaster", "StateId", "PropertyID", $row1['PropertyID']);
  173. $pro_zip = get_val_col("propertymaster", "Postcode", "PropertyID", $row1['PropertyID']);
  174.  
  175. $pay_method = get_val_col("propertybooking_payment", "payment_method", "booking_reference", $booking_reference, 'order by payment_date desc');
  176. $pro_USERID = get_val_col("propertymaster", "user_PropertyID", "PropertyID", $row1['PropertyID']);
  177. $booking_require_owner_approval = get_val_col("propertymaster", "booking_require_owner_approval", "PropertyID", $row1['PropertyID']);
  178. $min_date = $row1['DateFrom']; //get_val_col("propertybooking","MIN(DateFrom)","booking_reference",$booking_reference);
  179. $query = "SELECT * FROM propertybooking_customerdetail WHERE booking_reference='$booking_reference'";
  180. /* $frommailManager=get_val_col_result_1('mail_format','*','format_name','Manager');
  181.   $frommailOwner=get_val_col_result_1('mail_format','*','format_name','Owner');
  182.   $frommailGuest=get_val_col_result_1('mail_format','*','format_name','Guest');
  183.   $frommailCross=get_val_col_result_1('mail_format','*','format_name','Crosshire');
  184.   $frommailAgent=get_val_col_result_1('mail_format','*','format_name','Agent'); */
  185.  
  186. $frommailManager = get_val_col_result('mail_format', '*', 'format_name', 'Manager');
  187. $frommailOwner = get_val_col_result('mail_format', '*', 'format_name', 'Owner');
  188. $frommailGuest = get_val_col_result('mail_format', '*', 'format_name', 'Guest');
  189. $frommailCross = get_val_col_result('mail_format', '*', 'format_name', 'Crosshire');
  190. $frommailAgent = get_val_col_result('mail_format', '*', 'format_name', 'Agent');
  191.  
  192. $crdit_card_fee_amount = get_val_col("propertybooking_payment", "crdit_card_fee_amount", "booking_reference", $booking_reference);
  193.  
  194. $notify_owner = get_val_col("propertymaster", "notify_owner_of_booking", "PropertyID", $row1['PropertyID']);
  195.  
  196. $run = mysql_query($query);
  197. $row = mysql_fetch_array($run);
  198. extract($row);
  199. $Customer_Email = $Email;
  200.  
  201.  
  202.  
  203. //$qsite="select * from site_info where site_reference='".$_SESSION['user_site_id']."'";
  204. $qsite = "select * from site_info where site_reference='" . $siteKey . "'";
  205. $qsite_run = mysql_query($qsite);
  206. $site_row = mysql_fetch_array($qsite_run);
  207. $imgname = $site_row['company_logo'];
  208. $upload_folder = $site_row['upload_folder'];
  209.  
  210. $smtp_info = get_smtp_detail();
  211.  
  212. //if(get_val_col("site_info","notify_manager_of_booking","site_reference",$_SESSION['user_site_id'])==1)
  213. if (get_val_col("site_info", "notify_manager_website_of_booking", "site_reference", $siteKey) == 1) {
  214. //$msg_content=$site_row['email_msg_content_manager'];
  215.     $msg_content_manager_website = $site_row['email_msg_content_manager_website'];
  216.     $name_re = "Manager";
  217. }
  218.  
  219. //if(get_val_col("site_info","notify_agent_of_booking","site_reference",$_SESSION['user_site_id'])==1)
  220. if (get_val_col("site_info", "notify_agent_website_of_booking", "site_reference", $siteKey) == 1) {
  221. //$msg_content=$site_row['email_msg_content_agent'];
  222.     $msg_content_agent_website = $site_row['email_msg_content_agent_website'];
  223.     $name_re = "Agent";
  224. }
  225.  
  226. //if(get_val_col("site_info","notify_crosshire_of_booking","site_reference",$_SESSION['user_site_id'])==1)
  227. if (get_val_col("site_info", "notify_crosshire_website_of_booking", "site_reference", $siteKey) == 1) {
  228. //$msg_content=$site_row['email_msg_content_crosshire'];
  229.     $msg_content_crosshire_website = $site_row['email_msg_content_crosshire_website'];
  230.     $name_re = "Crosshire";
  231. }
  232.  
  233. if (get_val_col("site_info", "notify_owner_website_of_booking", "site_reference", $siteKey) == 1) {
  234. //$msg_content=$site_row['email_msg_content_crosshire'];
  235.     $msg_content_owner_website = $site_row['email_msg_content_owner_website'];
  236.     $name_re = "Owner";
  237. }
  238.  
  239. if (get_val_col("site_info", "notify_guest_website_of_booking", "site_reference", $siteKey) == 1) {
  240. //$msg_content=$site_row['email_msg_content_crosshire'];
  241.     $msg_content_guest_website = $site_row['email_msg_content_guest_website'];
  242.     $name_re = "Guest";
  243. }
  244.  
  245. $noofdays = $row1['days_booking'];
  246.  
  247. ///manager Mail
  248. //echo $Manager_Email.'ffff'.$Customer_Email.$Owner_Email;
  249. $mail_msg = '<table width="718" border="0" cellspacing="0" cellpadding="0">
  250.  <tr valign="top" align="left">
  251.    <td style="border-top:4px #e2eff6 solid; border-bottom:4px #626262 solid; padding-bottom:10px;"><table width="718" border="0" cellspacing="0" cellpadding="0">
  252.        <tr valign="top" align="left">
  253.          <td width="396" style="padding-top:34px; padding-left:20px;"><a href="#"><img src="' . hosturl_1 . $path . '/' . $upload_folder . '/' . $imgname . '" border="0" /></a></td>
  254.          <td width="322" align="right" style="font-family:Arial, Helvetica, sans-serif; font-weight:bold; font-size:13px;"><p style="margin:0px; padding-bottom:3px; padding-top:18px; padding-right:10px;">' . $site_row['site_name'] . '</p>
  255.            <p style="margin:0px;  padding-right:10px;" >' . $site_row['Address1'] . ', ' . $site_row['City'] . ', ' . $site_row['StateID'] . ' ' . $site_row['Postalcode'] . '</p>
  256.            <p style="border-bottom:1px #e3e3e3 solid; margin:0px; padding-top:8px;"></p>
  257.            <p style="margin:0px; padding-top:8px;  padding-right:10px;">Ph:  ' . $site_row['Phone'] . '  Fax:  ' . $site_row['Fax'] . '</p>
  258.            <p style="margin:0px; padding-top:5px;  padding-right:10px;">E-mail: <a href="mailto:' . $site_row['Email'] . '" style="color:#000; text-decoration:none">' . $site_row['Email'] . '</a></p></td>
  259.        </tr>
  260.      </table></td></tr>';
  261. $mail_msg.='<tr valign="top" align="left">
  262.    <td height="5"></td>
  263.  </tr>
  264.  <tr valign="top" align="left">
  265.    <td style="border:1px #a9dbf5 solid; background:#eff6fa url(' . hosturl_1 . 'img/titlebg.gif) repeat-x left top; height:35px; line-height:35px; padding-left:23px; color:#005687; font-family:Arial, Helvetica, sans-serif; font-size:18px; font-weight:bold">Receipt</td>
  266.  </tr>';
  267. $mail_msg.='<tr valign="top" align="left">
  268.    <td style="border:1px #a9dbf5 solid; border-top:0px; padding-bottom:20px;"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  269.        <tr valign="top" align="left">
  270.          <td style="padding-left:20px; font-family:Arial, Helvetica, sans-serif; font-size:13px;">' .
  271.         '<p>' . "{##}" . '</p>' .
  272.         '<p><strong>Following are the details of your transaction.</strong></p></td>
  273.        </tr>
  274.        <tr valign="top" align="left">
  275.          <td style="padding-left:20px;"><table width="674" border="0" cellspacing="0" cellpadding="0">
  276.              <tr valign="top" align="left">
  277.                <td style="background:#00649c url(' . hosturl_1 . 'img/bluetitlebg.gif) repeat-x left top; height:27px; font-family:Arial, Helvetica, sans-serif; font-size:13px; font-weight:bold; color:#ffffff; padding-left:10px; line-height:27px;">Booking Information</td>
  278.              </tr>
  279.            </table></td>
  280.        </tr>';
  281.  
  282. $mail_msg.='<tr valign="top" align="left">
  283.          <td style="background:#ffffff url(' . hosturl_1 . 'img/contentbg.gif) repeat-x left top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  284.              <tr valign="top" align="left">
  285.                <td style="padding-left:22px; padding-right:22px; font-family:Arial, Helvetica, sans-serif; font-size:13px; color:#00466e"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  286.                    <tr valign="top" align="left">
  287.                      <td width="41%" style="padding-top:10px; padding-bottom:5px; padding-left:10px; border-bottom:1px #e3e3e3 solid">Booking ID:</td>
  288.                      <td width="59%" style="padding-top:10px; padding-bottom:5px; border-bottom:1px #e3e3e3 solid">' . $new_book_id . '</td>
  289.                    </tr>
  290.                  </table></td>
  291.              </tr>
  292.               <tr valign="top" align="left">
  293.                <td style="padding-left:22px; padding-right:22px; font-family:Arial, Helvetica, sans-serif; font-size:13px; color:#00466e"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  294.                    <tr valign="top" align="left">
  295.                      <td width="41%" style="padding-top:10px; padding-bottom:5px; padding-left:10px; border-bottom:1px #e3e3e3 solid">Property ID:</td>
  296.                      <td width="59%" style="padding-top:10px; padding-bottom:5px; border-bottom:1px #e3e3e3 solid">' . $rowp1['user_PropertyID'] . '</td>
  297.                    </tr>
  298.                  </table></td>
  299.              </tr>
  300.              <tr valign="top" align="left">
  301.                <td style="padding-left:22px; padding-right:22px; font-family:Arial, Helvetica, sans-serif; font-size:13px; color:#00466e"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  302.                    <tr valign="top" align="left">
  303.                      <td width="41%" style="padding-top:10px; padding-bottom:5px; padding-left:10px; border-bottom:1px #e3e3e3 solid">Property Address:</td>
  304.                      <td width="59%" style="padding-top:10px; padding-bottom:5px; border-bottom:1px #e3e3e3 solid">' . $pro_addr . ', ' . $pro_city . ', ' . $pro_state . ' ' . $pro_zip . '</td>
  305.                    </tr>
  306.                  </table></td>
  307.              </tr>
  308.              <tr valign="top" align="left">
  309.                <td style="padding-left:22px; padding-right:22px; font-family:Arial, Helvetica, sans-serif; font-size:13px; color:#00466e"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  310.                    <tr valign="top" align="left">
  311.                      <td width="41%" style="padding-top:10px; padding-bottom:5px; padding-left:10px; border-bottom:1px #e3e3e3 solid">Booking Duration:</td>
  312.                      <td width="59%" style="padding-top:10px; padding-bottom:5px; border-bottom:1px #e3e3e3 solid">' . date('F d, Y', strtotime($min_date)) . '&nbsp;to&nbsp;' . date('F d, Y', strtotime(date("Y-m-d", strtotime("+1 day", strtotime($row1['DateTo']))))) . '</td>
  313.                    </tr>
  314.                  </table></td>
  315.              </tr>
  316.               <tr valign="top" align="left">
  317.                <td style="padding-left:22px; padding-right:22px; font-family:Arial, Helvetica, sans-serif; font-size:13px; color:#00466e"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  318.                    <tr valign="top" align="left">
  319.                      <td width="41%" style="padding-top:10px; padding-bottom:5px; padding-left:10px; border-bottom:1px #e3e3e3 solid">Booking Source:</td>
  320.                      <td width="59%" style="padding-top:10px; padding-bottom:5px; border-bottom:1px #e3e3e3 solid">' . $booking_source . '</td>
  321.                    </tr>
  322.                  </table></td>
  323.              </tr>
  324.            
  325.               <tr valign="top" align="left">
  326.                <td style="padding-left:22px; padding-right:22px; font-family:Arial, Helvetica, sans-serif; font-size:13px; color:#00466e"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  327.                    <tr valign="top" align="left">
  328.                      <td width="41%" style="padding-top:10px; padding-bottom:5px; padding-left:10px; border-bottom:4px #d6d6d6 solid">Booked By:</td>
  329.                      <td width="59%" style="padding-top:10px; padding-bottom:5px; border-bottom:4px #d6d6d6 solid">' . $row1['created_by'] . '</td>
  330.                    </tr>
  331.                  </table></td>
  332.              </tr>
  333.              </table></td>
  334.        </tr>';
  335. $mail_msg.=' <tr valign="top" align="left">
  336.          <td height="10"></td>
  337.        </tr>
  338.        <tr valign="top" align="left">
  339.          <td style="padding-left:20px;"><table width="674" border="0" cellspacing="0" cellpadding="0">
  340.              <tr valign="top" align="left">
  341.                <td style="background:#00649c url(' . hosturl_1 . 'img/bluetitlebg.gif) repeat-x left top; height:27px; font-family:Arial, Helvetica, sans-serif; font-size:13px; font-weight:bold; color:#ffffff; padding-left:10px; line-height:27px;">Guest Details</td>
  342.              </tr>
  343.            </table></td>
  344.        </tr>
  345.        <tr valign="top" align="left">
  346.          <td style="background:#ffffff url(' . hosturl_1 . 'img/contentbg.gif) repeat-x left top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  347.              <tr valign="top" align="left">
  348.                <td style="padding-left:22px; padding-right:22px; font-family:Arial, Helvetica, sans-serif; font-size:13px; color:#00466e"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  349.                    <tr valign="top" align="left">
  350.                      <td width="41%" style="padding-top:10px; padding-bottom:5px; padding-left:10px; border-bottom:1px #e3e3e3 solid">Guest:</td>
  351.                      <td width="59%" style="padding-top:10px; padding-bottom:5px; border-bottom:1px #e3e3e3 solid">' . $first_name . ' ' . $last_name . '</td>
  352.                    </tr>
  353.                  </table></td>
  354.              </tr>
  355.              <tr valign="top" align="left">
  356.                <td style="padding-left:22px; padding-right:22px; font-family:Arial, Helvetica, sans-serif; font-size:13px; color:#00466e"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  357.                    <tr valign="top" align="left">
  358.                      <td width="41%" style="padding-top:10px; padding-bottom:5px; padding-left:10px; border-bottom:1px #e3e3e3 solid">Address:</td>
  359.                      <td width="59%" style="padding-top:10px; padding-bottom:5px; border-bottom:1px #e3e3e3 solid">' . $address . ', ' . $city . ', ' . $state . ' ' . $postal_code . '</td>
  360.                    </tr>
  361.                  </table></td>
  362.              </tr>
  363.              <tr valign="top" align="left">
  364.                <td style="padding-left:22px; padding-right:22px; font-family:Arial, Helvetica, sans-serif; font-size:13px; color:#00466e"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  365.                    <tr valign="top" align="left">
  366.                      <td width="41%" style="padding-top:10px; padding-bottom:5px; padding-left:10px; border-bottom:1px #e3e3e3 solid">Phone:</td>
  367.                      <td width="59%" style="padding-top:10px; padding-bottom:5px; border-bottom:1px #e3e3e3 solid">' . $phonenumber . '&nbsp;</td>
  368.                    </tr>
  369.                  </table></td>
  370.              </tr>
  371.              <tr valign="top" align="left">
  372.                <td style="padding-left:22px; padding-right:22px; font-family:Arial, Helvetica, sans-serif; font-size:13px; color:#00466e"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  373.                    <tr valign="top" align="left">
  374.                      <td width="41%" style="padding-top:10px; padding-bottom:5px; padding-left:10px; border-bottom:4px #d6d6d6 solid">Email:</td>
  375.                      <td width="59%" style="padding-top:10px; padding-bottom:5px; border-bottom:4px #d6d6d6 solid">' . $Email . '</td>
  376.                    </tr>
  377.                  </table></td>
  378.              </tr>
  379.            </table></td>
  380.        </tr>
  381.        <tr valign="top" align="left">
  382.          <td height="10"></td>
  383.        </tr>';
  384. $mail_msg.='<tr valign="top" align="left">
  385.          <td style="padding-left:20px;"><table width="674" border="0" cellspacing="0" cellpadding="0">
  386.              <tr valign="top" align="left">
  387.                <td style="background:#009c64 url(' . hosturl_1 . 'img/greentitlebg.gif) repeat-x left top; height:27px; font-family:Arial, Helvetica, sans-serif; font-size:13px; font-weight:bold; color:#ffffff; padding-left:10px; line-height:27px;">Fees</td>
  388.              </tr>
  389.            </table></td>
  390.        </tr>
  391.        <tr valign="top" align="left">
  392.          <td style="background:#ffffff url(' . hosturl_1 . 'img/contentbg.gif) repeat-x left top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  393.              <tr valign="top" align="left">
  394.                <td style="padding-left:22px; padding-right:22px; font-family:Arial, Helvetica, sans-serif; font-size:13px; color:#00466e"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  395.                    <tr valign="top" align="left">
  396.                      <td width="41%" style="padding-top:10px; padding-bottom:5px; padding-left:10px; border-bottom:1px #e3e3e3 solid">Rental:</td>
  397.                      <td width="59%" style="padding-top:10px; padding-bottom:5px; border-bottom:1px #e3e3e3 solid">$' . $row1['RentalFees'] . '</td>
  398.                    </tr>
  399.                  </table></td>
  400.              </tr>';
  401.  
  402. $rf = $row1['RentalFees'];
  403. $uf = $row1['UpgradesFee'];
  404. $cf = $row1['CleaningFee'];
  405. $dis = $row1['property_discount'];
  406. $total = $rf + $uf + $cf - $dis;
  407.  
  408. if (isset($row1['tax_amount']) && $row1['tax_amount'] > 0) {
  409.     $t = $row1['tax_amount'];
  410. } else {
  411.     if ($row1['tax_include'] == 1) {
  412.         if ($row1['cleanfee_include'] == 1)
  413.             $t = ($total * $row1['Tax__Percentage']) / (100 + $row1['Tax__Percentage']);
  414.         else
  415.             $t = (($total - $cf) * $row1['Tax__Percentage']) / (100 + $row1['Tax__Percentage']);
  416.     }
  417.     else {
  418.         if ($row1['cleanfee_include'] == 1)
  419.             $t = ($total * $row1['Tax__Percentage']) / 100;
  420.         else
  421.             $t = (($total - $cf) * $row1['Tax__Percentage']) / 100;
  422.     }
  423. }
  424. $tax = $t;
  425.  
  426. /* echo "<br><br>Booking tax: " . $t;
  427.   echo "<br><br>Property tax: " . $tax; */
  428.  
  429. $tax = sprintf("%.2f", $tax);
  430.  
  431. //$total=$total+$tax;
  432. //$total=$total;
  433.  
  434. if ($row1['tax_include'] == 1) {
  435.     $total = $total;
  436. } else {
  437.     $total = $total + $tax;
  438. }
  439.  
  440. $ccardfee = 0;
  441. if ($pay_method != 'Cash' and $pay_method != 'Check') {
  442.     $ccardfee = ($total * $row1['CreditCardFee_Percentage']) / 100;
  443.     $ccardfee = sprintf("%.2f", $ccardfee);
  444. } else {
  445.     $ccardfee = sprintf("%.2f", $ccardfee);
  446.     $total = $total + $ccardfee;
  447. }
  448.  
  449.  
  450. //$customermail_msg=$customermail_msg.'<tr><td align="right"  valign="top"><strong>Optional Upgrade:</strong> </td>    <td align="left"  valign="top">';
  451. //$option_upgrade=$row1['optional_upgrade_options'];
  452.  
  453.  
  454. /*
  455.   $upgrdid=array();
  456.   $poolheat=$row1['optional_upgrade_options'];
  457.   $poolheat=explode(',',$poolheat);
  458.   $cnt=count($poolheat);
  459.   for($i=0;$i<$cnt;$i++)
  460.   {
  461.   $poolid=explode('PRICE',$poolheat[$i]);
  462.   $upgrdid[$i]=$poolid[0];
  463.   }
  464.  
  465.  
  466.  
  467.  
  468.   if($poolheat<>'')
  469.   {
  470.   $upids=implode(',',$upgrdid);
  471.   $pooldetail=Booking::getPoolheat_forguest($upids);
  472.   if($pooldetail)
  473.   {
  474.   //$customermail_msg=$customermail_msg."<table cellspacing=\"5\">";
  475.  
  476.   while($value=mysql_fetch_array($pooldetail))
  477.   {
  478.   $poolprice=Booking::getPoolPriceByUser($value,$row1);
  479.   $mail_msg.='<tr valign="top" align="left">
  480.   <td style="padding-left:22px; padding-right:22px; font-family:Arial, Helvetica, sans-serif; font-size:13px; color:#00466e"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  481.   <tr valign="top" align="left">
  482.   <td width="41%" style="padding-top:10px; padding-bottom:5px; padding-left:10px; border-bottom:1px #e3e3e3 solid">Upgrade, '.$value['opUpgradeName'].':</td>
  483.   <td width="59%" style="padding-top:10px; padding-bottom:5px; border-bottom:1px #e3e3e3 solid">$'.$poolprice.'('.$value['rate_type'].')</td>
  484.   </tr>
  485.   </table></td>
  486.   </tr>';
  487.   }
  488.  
  489.   //$customermail_msg=$customermail_msg. "<tr>";
  490.   //        $customermail_msg=$customermail_msg."<td align=\"right\">Sub-Total:</td>";
  491.   //        $customermail_msg=$customermail_msg."<td align=\"left\">$".$uf=$row1['UpgradesFee']."</td>";
  492.   //    $customermail_msg=$customermail_msg."</tr>";
  493.   //$customermail_msg=$customermail_msg."</table>";
  494.   }
  495.   }
  496.  */
  497.  
  498. $mail_msg.='<tr valign="top" align="left">
  499.             <td style="padding-left:22px; padding-right:22px; font-family:Arial, Helvetica, sans-serif; font-size:13px; color:#00466e"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  500.                 <tr valign="top" align="left">
  501.                   <td width="41%" style="padding-top:10px; padding-bottom:5px; padding-left:10px; border-bottom:1px #d6d6d6 solid">Optional Upgrade:</td>
  502.                   <td width="59%" style="padding-top:10px; padding-bottom:5px; border-bottom:1px #d6d6d6 solid">';
  503.  
  504. $option_upgrade = $row1['optional_upgrade_options'];
  505. if ($option_upgrade <> '') {
  506.     $option_upgrade = explode(",", $option_upgrade);
  507.     $y = get_optiional_ugrade_list($row1['PropertyID']);
  508.     $mail_msg = $mail_msg . "<table cellspacing=\"0\" width='100%'>";
  509.     foreach ($option_upgrade as $value) {
  510.         $val = explode("PRICE", $value);
  511.         //check_price
  512.  
  513.  
  514.  
  515.         $mail_msg = $mail_msg . "<tr align='left'>";
  516.         $mail_msg = $mail_msg . "<td align=\"left\" style='padding-bottom:10px;'>" . $y[$val[0]]['opUpgradeName'] . ":</td>";
  517.         $mail_msg = $mail_msg . "<td align=\"left\" style='padding-bottom:10px;'>$" . $check_price_arr = check_price('optional_upgrade_property', 'rate_type,min_req_duration,upgradePrice', 'CounterId', $val[0], $noofdays) . "</td>";
  518.         //$mail_msg=$mail_msg."<td align=\"left\" style='padding-bottom:10px;'>(".$y[$val[0]]['rate_type'].")</td>";
  519.         $mail_msg = $mail_msg . "</tr>";
  520.     }
  521.     $mail_msg = $mail_msg . "<tr>";
  522.     $mail_msg = $mail_msg . "<td align=\"left\" style='padding-bottom:10px;'>Sub-Total:</td>";
  523.     $mail_msg = $mail_msg . "<td align=\"left\" style='padding-bottom:10px;'>$" . $row1['UpgradesFee'] . "</td>";
  524.     $mail_msg = $mail_msg . "</tr>";
  525.     $mail_msg = $mail_msg . "</table>";
  526. }
  527.  
  528. $mail_msg.='</td>
  529.                 </tr>
  530.               </table></td>
  531.           </tr>';
  532.  
  533. $mail_msg.='<tr valign="top" align="left">
  534.                <td style="padding-left:22px; padding-right:22px; font-family:Arial, Helvetica, sans-serif; font-size:13px; color:#00466e"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  535.                    <tr valign="top" align="left">
  536.                      <td width="41%" style="padding-top:10px; padding-bottom:5px; padding-left:10px; border-bottom:1px #d6d6d6 solid">Cleaning:</td>
  537.                      <td width="59%" style="padding-top:10px; padding-bottom:5px; border-bottom:1px #d6d6d6 solid">$' . $row1['CleaningFee'] . '</td>
  538.                    </tr>
  539.                     <tr valign="top" align="left">
  540.                      <td width="41%" style="padding-top:10px; padding-bottom:5px; padding-left:10px; border-bottom:1px #d6d6d6 solid">Discount:</td>
  541.                      <td width="59%" style="padding-top:10px; padding-bottom:5px; border-bottom:1px #d6d6d6 solid">$' . $dis . '</td>
  542.                    </tr>
  543.                  </table></td>
  544.              </tr>
  545.              <tr valign="top" align="left">
  546.                <td style="padding-left:22px; padding-right:22px; font-family:Arial, Helvetica, sans-serif; font-size:13px; color:#00466e"><table width="100%" border="0" cellspacing="0" cellpadding="0">';
  547. /* <tr valign="top" align="left">
  548.   <td width="41%" style="padding-top:10px; padding-bottom:5px; color:#00466e; font-weight:bold; background-color:#e5eff4; padding-left:10px; border-bottom:1px #d6d6d6 solid">Sub Total:</td>
  549.   <td width="59%" style="padding-top:10px; padding-bottom:5px; color:#00466e; font-weight:bold; background-color:#e5eff4; border-bottom:1px #d6d6d6 solid">$1,210.00</td>
  550.   </tr> */
  551.  
  552.  
  553. $mail_msg.='</table></td>
  554.              </tr>';
  555.  
  556. $mail_msg.='<tr valign="top" align="left">
  557.                <td style="padding-left:22px; padding-right:22px; font-family:Arial, Helvetica, sans-serif; font-size:13px; color:#00466e"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  558.                    <tr valign="top" align="left">
  559.                      <td width="41%" style="padding-top:10px; padding-bottom:5px; padding-left:10px; border-bottom:1px #d6d6d6 solid">Tax:</td>
  560.                      <td width="59%" style="padding-top:10px; padding-bottom:5px; border-bottom:1px #d6d6d6 solid">';
  561. if ($row1['tax_include'] == 1)
  562.     $p = '$' . $tax . ' (' . $row1['Tax__Percentage'] . ' % included in total)';
  563. else
  564.     $p = '$' . $tax;
  565. $mail_msg.=$p . '</td>
  566.                    </tr>
  567.                  </table></td>
  568.              </tr>';
  569.  
  570. if ($ccardfee > 0) {
  571.     $mail_msg.='<tr valign="top" align="left">
  572.                <td style="padding-left:22px; padding-right:22px; font-family:Arial, Helvetica, sans-serif; font-size:13px; color:#00466e"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  573.                    <tr valign="top" align="left">
  574.                      <td width="41%" style="padding-top:10px; padding-bottom:5px; padding-left:10px; border-bottom:1px #d6d6d6 solid">Credit Card Fees:</td>
  575.                      <td width="59%" style="padding-top:10px; padding-bottom:5px; border-bottom:1px #d6d6d6 solid">$' . sprintf("%.2f", $crdit_card_fee_amount) . ' (' . $row1['CreditCardFee_Percentage'] . ' %)</td>
  576.                    </tr>
  577.                  </table></td>
  578.              </tr>';
  579. }
  580. /* <tr valign="top" align="left">
  581.   <td style="padding-left:22px; padding-right:22px; font-family:Arial, Helvetica, sans-serif; font-size:13px; color:#00466e"><table width="100%" border="0" cellspacing="0" cellpadding="0">';
  582.   <tr valign="top" align="left">
  583.   <td width="41%" style="padding-top:10px; padding-bottom:5px; padding-left:10px; border-bottom:1px #d6d6d6 solid">Credit Card Fee:</td>
  584.   <td width="59%" style="padding-top:10px; padding-bottom:5px; border-bottom:1px #d6d6d6 solid">$5.00 (3%)</td>
  585.   </tr>
  586.   </table></td>
  587.   </tr> */
  588. $mail_msg.='<tr valign="top" align="left">
  589.                <td style="padding-left:22px; padding-right:22px; font-family:Arial, Helvetica, sans-serif; font-size:13px; color:#00466e"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  590.                    <tr valign="top" align="left">
  591.                      <td width="41%" style="padding-top:10px; background-color:#cffdce; padding-bottom:5px; color:#00466e; font-weight:bold; padding-left:10px; border-bottom:4px #d6d6d6 solid">Total:</td>
  592.                      <td width="59%" style="padding-top:10px; background-color:#cffdce; padding-bottom:5px; color:#00466e; font-weight:bold; border-bottom:4px #d6d6d6 solid">$' . $row1['Total'] . '</td>
  593.                    </tr>
  594.                  </table></td>
  595.              </tr>';
  596. if ($row1['agent_id'] <> 0) {
  597.     $mail_msg.='<tr valign="top" align="left">
  598.                <td style="padding-left:22px; padding-right:22px; font-family:Arial, Helvetica, sans-serif; font-size:13px; color:#00466e"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  599.                    <tr valign="top" align="left">
  600.                      <td width="41%" style="padding-top:10px; padding-bottom:5px; padding-left:10px; border-bottom:1px #d6d6d6 solid">Agent Name:</td>
  601.                      <td width="59%" style="padding-top:10px; padding-bottom:5px; border-bottom:1px #d6d6d6 solid">' . get_val_col("contacts", "FirstName", "CounterID", $row1['agent_id']) . '</td>
  602.                    </tr>
  603.                  </table></td>
  604.              </tr>';
  605. }
  606.  
  607.  
  608. $mail_msg.='</table></td>
  609.        </tr>
  610.        <tr valign="top" align="left">
  611.          <td height="10"></td>
  612.        </tr>';
  613. $query = "SELECT * FROM propertybooking_payment WHERE booking_reference='$booking_reference' and advance_amount>0 order by payment_date";
  614. $run = mysql_query($query);
  615. $total_row = mysql_num_rows($run);
  616. $paid_amount = 0.00;
  617.  
  618. if ($total_row > 0) {
  619.     $mail_msg.='<tr valign="top" align="left">
  620.          <td style="padding-left:20px;"><table width="674" border="0" cellspacing="0" cellpadding="0">
  621.              <tr valign="top" align="left">
  622.                <td style="background:#00649c url(' . hosturl_1 . 'img/bluetitlebg.gif) repeat-x left top; height:27px; font-family:Arial, Helvetica, sans-serif; font-size:13px; font-weight:bold; color:#ffffff; padding-left:10px; line-height:27px;">Payment Details</td>
  623.              </tr>
  624.            </table></td>
  625.        </tr>';
  626.     while ($row = mysql_fetch_array($run)) {
  627.         $paid_amount = $paid_amount + $row['advance_amount'];
  628.         $mail_msg___.='
  629.        <tr valign="top" align="left">
  630.          <td style="background:#ffffff url(' . hosturl_1 . 'img/contentbg.gif) repeat-x left top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  631.              <tr valign="top" align="left">
  632.                <td style="padding-left:22px; padding-right:22px; font-family:Arial, Helvetica, sans-serif; font-size:13px; color:#00466e"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  633.                    <tr valign="top" align="left">
  634.                      <td width="41%" style="padding-top:10px; padding-bottom:5px; padding-left:10px; border-bottom:1px #e3e3e3 solid">Total Fee:</td>
  635.                      <td width="59%" style="padding-top:10px; padding-bottom:5px; border-bottom:1px #e3e3e3 solid">$' . $row1['Total'] . '</td>
  636.                    </tr>
  637.                  </table></td>
  638.              </tr>';
  639.  
  640.         $mail_msg.='<tr valign="top" align="left">
  641.                <td style="padding-left:22px; padding-right:22px; font-family:Arial, Helvetica, sans-serif; font-size:13px; color:#00466e"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  642.                    <tr valign="top" align="left">
  643.                      <td width="41%" style="padding-top:10px; padding-bottom:5px; padding-left:10px; border-bottom:1px #e3e3e3 solid">Payment Date:</td>
  644.                      <td width="59%" style="padding-top:10px; padding-bottom:5px; border-bottom:1px #e3e3e3 solid">' . date('M d, Y', strtotime($row['payment_date'])) . '</td>
  645.                    </tr>
  646.                  </table></td>
  647.              </tr>';
  648.     }
  649. }
  650. $mail_msg.='<tr valign="top" align="left">
  651.                <td style="padding-left:22px; padding-right:22px; font-family:Arial, Helvetica, sans-serif; font-size:13px; color:#00466e"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  652.                    <tr valign="top" align="left">
  653.                      <td width="41%" style="padding-top:10px; padding-bottom:5px; padding-left:10px; border-bottom:1px #d6d6d6 solid"><strong>Amount Paid:</strong></td>
  654.                      <td width="59%" style="padding-top:10px; padding-bottom:5px; border-bottom:1px #d6d6d6 solid">$' . sprintf("%.2f", $paid_amount) . '</td>
  655.                    </tr>
  656.                  </table></td>
  657.              </tr>
  658.              <tr valign="top" align="left">
  659.  
  660.                <td style="padding-left:22px; padding-right:22px; font-family:Arial, Helvetica, sans-serif; font-size:13px; color:#00466e"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  661.                    <tr valign="top" align="left">
  662.                      <td width="41%" style="padding-top:10px; padding-bottom:5px; padding-left:10px; border-bottom:4px #d6d6d6 solid"><strong>Amount Due:</strong></td>
  663.                      <td width="59%" style="padding-top:10px; padding-bottom:5px; border-bottom:4px #d6d6d6 solid">$' . sprintf("%.2f", $row1['Total'] - $paid_amount) . '</td>
  664.                    </tr>
  665.                  </table></td>
  666.              </tr>
  667.            </table></td>
  668.        </tr>';
  669. $mail_msg.=' </table></td>
  670.  </tr>
  671. </table>';
  672.  
  673.  
  674.  
  675. // end Manager Mail
  676. //************** start Customer Mail******************************
  677.  
  678. $customermail_msg = '<table width="718" border="0" cellspacing="0" cellpadding="0">
  679.  <tr valign="top" align="left">
  680.    <td style="border-top:4px #e2eff6 solid; border-bottom:4px #626262 solid; padding-bottom:10px;"><table width="718" border="0" cellspacing="0" cellpadding="0">
  681.        <tr valign="top" align="left">
  682.          <td width="396" style="padding-top:34px; padding-left:20px;"><a href="#"><img src="' . hosturl_1 . $path . '/' . $upload_folder . '/' . $imgname . '" border="0" /></a></td>
  683.          <td width="322" align="right" style="font-family:Arial, Helvetica, sans-serif; font-weight:bold; font-size:13px;"><p style="margin:0px; padding-bottom:3px; padding-top:18px; padding-right:10px;">' . $site_row['site_name'] . '</p>
  684.            <p style="margin:0px;  padding-right:10px;" >' . $site_row['Address1'] . ', ' . $site_row['City'] . ', ' . $site_row['StateID'] . ' ' . $site_row['Postalcode'] . '</p>
  685.            <p style="border-bottom:1px #e3e3e3 solid; margin:0px; padding-top:8px;"></p>
  686.            <p style="margin:0px; padding-top:8px;  padding-right:10px;">Ph:  ' . $site_row['Phone'] . '  Fax:  ' . $site_row['Fax'] . '</p>
  687.            <p style="margin:0px; padding-top:5px;  padding-right:10px;">E-mail: <a href="mailto:' . $site_row['Email'] . '" style="color:#000; text-decoration:none">' . $site_row['Email'] . '</a></p></td>
  688.        </tr>
  689.      </table></td></tr>';
  690. $customermail_msg.='<tr valign="top" align="left">
  691.    <td height="5"></td>
  692.  </tr>
  693.  <tr valign="top" align="left">
  694.    <td style="border:1px #a9dbf5 solid; background:#eff6fa url(' . hosturl_1 . 'img/titlebg.gif) repeat-x left top; height:35px; line-height:35px; padding-left:23px; color:#005687; font-family:Arial, Helvetica, sans-serif; font-size:18px; font-weight:bold">Receipt</td>
  695.  </tr>';
  696. $customermail_msg.='<tr valign="top" align="left">
  697.    <td style="border:1px #a9dbf5 solid; border-top:0px; padding-bottom:20px;"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  698.        <tr valign="top" align="left">
  699.          <td style="padding-left:20px; font-family:Arial, Helvetica, sans-serif; font-size:13px;">' . html_entity_decode($site_row['email_msg_content_guest_website']) .
  700.         '<p><strong>Following are the details of your transaction.</strong></p></td>
  701.        </tr>
  702.        <tr valign="top" align="left">
  703.          <td style="padding-left:20px;"><table width="674" border="0" cellspacing="0" cellpadding="0">
  704.              <tr valign="top" align="left">
  705.                <td style="background:#00649c url(' . hosturl_1 . 'img/bluetitlebg.gif) repeat-x left top; height:27px; font-family:Arial, Helvetica, sans-serif; font-size:13px; font-weight:bold; color:#ffffff; padding-left:10px; line-height:27px;">Booking Information</td>
  706.              </tr>
  707.            </table></td>
  708.        </tr>';
  709.  
  710. $customermail_msg.='<tr valign="top" align="left">
  711.          <td style="background:#ffffff url(' . hosturl_1 . 'img/contentbg.gif) repeat-x left top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  712.              <tr valign="top" align="left">
  713.                <td style="padding-left:22px; padding-right:22px; font-family:Arial, Helvetica, sans-serif; font-size:13px; color:#00466e"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  714.                    <tr valign="top" align="left">
  715.                      <td width="41%" style="padding-top:10px; padding-bottom:5px; padding-left:10px; border-bottom:1px #e3e3e3 solid">Property:</td>
  716.                      <td width="59%" style="padding-top:10px; padding-bottom:5px; border-bottom:1px #e3e3e3 solid">' . $pro_title . '</td>
  717.                    </tr>
  718.                  </table></td>
  719.              </tr>
  720.              <tr valign="top" align="left">
  721.                <td style="padding-left:22px; padding-right:22px; font-family:Arial, Helvetica, sans-serif; font-size:13px; color:#00466e"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  722.                    <tr valign="top" align="left">
  723.                      <td width="41%" style="padding-top:10px; padding-bottom:5px; padding-left:10px; border-bottom:1px #e3e3e3 solid">Property Address:</td>
  724.                      <td width="59%" style="padding-top:10px; padding-bottom:5px; border-bottom:1px #e3e3e3 solid">' . $pro_addr . ', ' . $pro_city . ', ' . $pro_state . ' ' . $pro_zip . '</td>
  725.                    </tr>
  726.                  </table></td>
  727.              </tr>
  728.              <tr valign="top" align="left">
  729.                <td style="padding-left:22px; padding-right:22px; font-family:Arial, Helvetica, sans-serif; font-size:13px; color:#00466e"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  730.                    <tr valign="top" align="left">
  731.                      <td width="41%" style="padding-top:10px; padding-bottom:5px; padding-left:10px; border-bottom:1px #e3e3e3 solid">Booking Duration:</td>
  732.                      <td width="59%" style="padding-top:10px; padding-bottom:5px; border-bottom:1px #e3e3e3 solid">' . date('F d, Y', strtotime($min_date)) . '&nbsp;through&nbsp;' . date('F d, Y', strtotime(date("Y-m-d", strtotime("+1 day", strtotime($row1['DateTo']))))) . '</td>
  733.                    </tr>
  734.                  </table></td>
  735.              </tr>
  736.              <tr valign="top" align="left">
  737.                <td style="padding-left:22px; padding-right:22px; font-family:Arial, Helvetica, sans-serif; font-size:13px; color:#00466e"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  738.                    <tr valign="top" align="left">
  739.                      <td width="41%" style="padding-top:10px; padding-bottom:5px; padding-left:10px; border-bottom:4px #d6d6d6 solid">Booking Source:</td>
  740.                      <td width="59%" style="padding-top:10px; padding-bottom:5px; border-bottom:4px #d6d6d6 solid">' . $booking_source . '</td>
  741.                    </tr>
  742.                  </table></td>
  743.              </tr>
  744.            </table></td>
  745.        </tr>';
  746. $customermail_msg.=' <tr valign="top" align="left">
  747.          <td height="10"></td>
  748.        </tr>
  749.        <tr valign="top" align="left">
  750.          <td style="padding-left:20px;"><table width="674" border="0" cellspacing="0" cellpadding="0">
  751.              <tr valign="top" align="left">
  752.                <td style="background:#00649c url(' . hosturl_1 . 'img/bluetitlebg.gif) repeat-x left top; height:27px; font-family:Arial, Helvetica, sans-serif; font-size:13px; font-weight:bold; color:#ffffff; padding-left:10px; line-height:27px;">Guest Details</td>
  753.              </tr>
  754.            </table></td>
  755.        </tr>
  756.        <tr valign="top" align="left">
  757.          <td style="background:#ffffff url(' . hosturl_1 . 'img/contentbg.gif) repeat-x left top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  758.              <tr valign="top" align="left">
  759.                <td style="padding-left:22px; padding-right:22px; font-family:Arial, Helvetica, sans-serif; font-size:13px; color:#00466e"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  760.                    <tr valign="top" align="left">
  761.                      <td width="41%" style="padding-top:10px; padding-bottom:5px; padding-left:10px; border-bottom:1px #e3e3e3 solid">Guest:</td>
  762.                      <td width="59%" style="padding-top:10px; padding-bottom:5px; border-bottom:1px #e3e3e3 solid">' . $first_name . ' ' . $last_name . '</td>
  763.                    </tr>
  764.                  </table></td>
  765.              </tr>
  766.              <tr valign="top" align="left">
  767.                <td style="padding-left:22px; padding-right:22px; font-family:Arial, Helvetica, sans-serif; font-size:13px; color:#00466e"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  768.                    <tr valign="top" align="left">
  769.                      <td width="41%" style="padding-top:10px; padding-bottom:5px; padding-left:10px; border-bottom:1px #e3e3e3 solid">Address:</td>
  770.                      <td width="59%" style="padding-top:10px; padding-bottom:5px; border-bottom:1px #e3e3e3 solid">' . $address . ', ' . $city . ', ' . $state . ' ' . $postal_code . '</td>
  771.                    </tr>
  772.                  </table></td>
  773.              </tr>
  774.              <tr valign="top" align="left">
  775.                <td style="padding-left:22px; padding-right:22px; font-family:Arial, Helvetica, sans-serif; font-size:13px; color:#00466e"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  776.                    <tr valign="top" align="left">
  777.                      <td width="41%" style="padding-top:10px; padding-bottom:5px; padding-left:10px; border-bottom:1px #e3e3e3 solid">Phone:</td>
  778.                      <td width="59%" style="padding-top:10px; padding-bottom:5px; border-bottom:1px #e3e3e3 solid">' . $phonenumber . '</td>
  779.                    </tr>
  780.                  </table></td>
  781.              </tr>
  782.              <tr valign="top" align="left">
  783.                <td style="padding-left:22px; padding-right:22px; font-family:Arial, Helvetica, sans-serif; font-size:13px; color:#00466e"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  784.                    <tr valign="top" align="left">
  785.                      <td width="41%" style="padding-top:10px; padding-bottom:5px; padding-left:10px; border-bottom:4px #d6d6d6 solid">Email:</td>
  786.                      <td width="59%" style="padding-top:10px; padding-bottom:5px; border-bottom:4px #d6d6d6 solid">' . $Email . '</td>
  787.                    </tr>
  788.                  </table></td>
  789.              </tr>
  790.            </table></td>
  791.        </tr>
  792.        <tr valign="top" align="left">
  793.          <td height="10"></td>
  794.        </tr>';
  795. $customermail_msg.='<tr valign="top" align="left">
  796.          <td style="padding-left:20px;"><table width="674" border="0" cellspacing="0" cellpadding="0">
  797.              <tr valign="top" align="left">
  798.                <td style="background:#009c64 url(' . hosturl_1 . 'img/greentitlebg.gif) repeat-x left top; height:27px; font-family:Arial, Helvetica, sans-serif; font-size:13px; font-weight:bold; color:#ffffff; padding-left:10px; line-height:27px;">Fees</td>
  799.              </tr>
  800.            </table></td>
  801.        </tr>
  802.        <tr valign="top" align="left">
  803.          <td style="background:#ffffff url(' . hosturl_1 . 'img/contentbg.gif) repeat-x left top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  804.              <tr valign="top" align="left">
  805.                <td style="padding-left:22px; padding-right:22px; font-family:Arial, Helvetica, sans-serif; font-size:13px; color:#00466e"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  806.                    <tr valign="top" align="left">
  807.                      <td width="41%" style="padding-top:10px; padding-bottom:5px; padding-left:10px; border-bottom:1px #e3e3e3 solid">Rental:</td>
  808.                      <td width="59%" style="padding-top:10px; padding-bottom:5px; border-bottom:1px #e3e3e3 solid">$' . $row1['RentalFees'] . '</td>
  809.                    </tr>
  810.                  </table></td>
  811.              </tr>';
  812. $rf = $row1['RentalFees'];
  813. $uf = $row1['UpgradesFee'];
  814. $cf = $row1['CleaningFee'];
  815. $dis = $row1['property_discount'];
  816. $total = $rf + $uf + $cf - $dis;
  817.  
  818. if (isset($row1['tax_amount']) && $row1['tax_amount'] > 0) {
  819.     $t = $row1['tax_amount'];
  820. } else {
  821.     if ($row1['tax_include'] == 1) {
  822.         if ($row1['cleanfee_include'] == 1)
  823.             $t = ($total * $row1['Tax__Percentage']) / (100 + $row1['Tax__Percentage']);
  824.         else
  825.             $t = (($total - $cf) * $row1['Tax__Percentage']) / (100 + $row1['Tax__Percentage']);
  826.     }
  827.     else {
  828.         if ($row1['cleanfee_include'] == 1)
  829.             $t = ($total * $row1['Tax__Percentage']) / 100;
  830.         else
  831.             $t = (($total - $cf) * $row1['Tax__Percentage']) / 100;
  832.     }
  833. }
  834. $tax = $t;
  835. $tax = sprintf("%.2f", $tax);
  836. if ($row1['tax_include'] == 0)
  837.     $total = $total + $tax;
  838. $ccardfee = 0;
  839. if ($pay_method != 'Cash') {
  840.     $ccardfee = ($total * $row1['CreditCardFee_Percentage']) / 100;
  841.     $ccardfee = sprintf("%.2f", $ccardfee);
  842. } else if ($pay_method == 'Cheque') {
  843.     $ccardfee = 0;
  844. }
  845. else
  846.     $ccardfee = sprintf("%.2f", $ccardfee);
  847. $total = $total + $ccardfee;
  848. //$customermail_msg=$customermail_msg.'<tr><td align="right"  valign="top"><strong>Optional Upgrade:</strong> </td>    <td align="left"  valign="top">';
  849. //$option_upgrade=$row1['optional_upgrade_options'];
  850.  
  851. /*
  852.   $upgrdid=array();
  853.   $poolheat=$row1['optional_upgrade_options'];
  854.   $poolheat=explode(',',$poolheat);
  855.   $cnt=count($poolheat);
  856.   for($i=0;$i<$cnt;$i++)
  857.   {
  858.   $poolid=explode('PRICE',$poolheat[$i]);
  859.   $upgrdid[$i]=$poolid[0];
  860.   }
  861.  
  862.  
  863.  
  864.  
  865.   if($poolheat<>'')
  866.   {
  867.   $upids=implode(',',$upgrdid);
  868.   $pooldetail=Booking::getPoolheat_forguest($upids);
  869.   if($pooldetail)
  870.   {
  871.   //$customermail_msg=$customermail_msg."<table cellspacing=\"5\">";
  872.  
  873.   while($value=mysql_fetch_array($pooldetail))
  874.   {
  875.   $poolprice=Booking::getPoolPriceByUser($value,$row1);
  876.   $customermail_msg.='<tr valign="top" align="left">
  877.   <td style="padding-left:22px; padding-right:22px; font-family:Arial, Helvetica, sans-serif; font-size:13px; color:#00466e"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  878.   <tr valign="top" align="left">
  879.   <td width="41%" style="padding-top:10px; padding-bottom:5px; padding-left:10px; border-bottom:1px #e3e3e3 solid">Upgrade, '.$value['opUpgradeName'].':</td>
  880.   <td width="59%" style="padding-top:10px; padding-bottom:5px; border-bottom:1px #e3e3e3 solid">$'.$poolprice.'('.$value['rate_type'].')</td>
  881.   </tr>
  882.   </table></td>
  883.   </tr>';
  884.   }
  885.  
  886.   //$customermail_msg=$customermail_msg. "<tr>";
  887.   //        $customermail_msg=$customermail_msg."<td align=\"right\">Sub-Total:</td>";
  888.   //        $customermail_msg=$customermail_msg."<td align=\"left\">$".$uf=$row1['UpgradesFee']."</td>";
  889.   //    $customermail_msg=$customermail_msg."</tr>";
  890.   //$customermail_msg=$customermail_msg."</table>";
  891.   }
  892.   }
  893.  
  894.  */
  895.  
  896. $customermail_msg.='<tr valign="top" align="left">
  897.                     <td style="padding-left:22px; padding-right:22px; font-family:Arial, Helvetica, sans-serif; font-size:13px; color:#00466e"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  898.                         <tr valign="top" align="left">
  899.                           <td width="41%" style="padding-top:10px; padding-bottom:5px; padding-left:10px; border-bottom:1px #d6d6d6 solid">Optional Upgrade:</td>
  900.                           <td width="59%" style="padding-top:10px; padding-bottom:5px; border-bottom:1px #d6d6d6 solid">';
  901.  
  902. $option_upgrade = $row1['optional_upgrade_options'];
  903. if ($option_upgrade <> '') {
  904.     $option_upgrade = explode(",", $option_upgrade);
  905.     $y = get_optiional_ugrade_list($row1['PropertyID']);
  906.     $customermail_msg = $customermail_msg . "<table cellspacing=\"0\" width='100%'>";
  907.     foreach ($option_upgrade as $value) {
  908.         $val = explode("PRICE", $value);
  909.         //check_price
  910.  
  911.  
  912.  
  913.         $customermail_msg = $customermail_msg . "<tr align='left'>";
  914.         $customermail_msg = $customermail_msg . "<td align=\"left\" style='padding-bottom:10px;'>" . $y[$val[0]]['opUpgradeName'] . ":</td>";
  915.         $customermail_msg = $customermail_msg . "<td align=\"left\" style='padding-bottom:10px;'>$" . $check_price_arr = check_price('optional_upgrade_property', 'rate_type,min_req_duration,upgradePrice', 'CounterId', $val[0], $noofdays) . "</td>";
  916.         //$customermail_msg=$customermail_msg."<td align=\"left\" style='padding-bottom:10px;'>(".$y[$val[0]]['rate_type'].")</td>";
  917.         $customermail_msg = $customermail_msg . "</tr>";
  918.     }
  919.     $customermail_msg = $customermail_msg . "<tr>";
  920.     $customermail_msg = $customermail_msg . "<td align=\"left\" style='padding-bottom:10px;'>Sub-Total:</td>";
  921.     $customermail_msg = $customermail_msg . "<td align=\"left\" style='padding-bottom:10px;'>$" . $row1['UpgradesFee'] . "</td>";
  922.     $customermail_msg = $customermail_msg . "</tr>";
  923.     $customermail_msg = $customermail_msg . "</table>";
  924. }
  925.  
  926. $customermail_msg.='</td>
  927.                         </tr>
  928.                       </table></td>
  929.                   </tr>';
  930.  
  931. $customermail_msg.='<tr valign="top" align="left">
  932.                <td style="padding-left:22px; padding-right:22px; font-family:Arial, Helvetica, sans-serif; font-size:13px; color:#00466e"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  933.                    <tr valign="top" align="left">
  934.                      <td width="41%" style="padding-top:10px; padding-bottom:5px; padding-left:10px; border-bottom:1px #d6d6d6 solid">Cleaning:</td>
  935.                      <td width="59%" style="padding-top:10px; padding-bottom:5px; border-bottom:1px #d6d6d6 solid">$' . $row1['CleaningFee'] . '</td>
  936.                    </tr>
  937.                     <tr valign="top" align="left">
  938.                      <td width="41%" style="padding-top:10px; padding-bottom:5px; padding-left:10px; border-bottom:1px #d6d6d6 solid">Discount:</td>
  939.                      <td width="59%" style="padding-top:10px; padding-bottom:5px; border-bottom:1px #d6d6d6 solid">$' . $dis . '</td>
  940.                    </tr>
  941.                  </table></td>
  942.              </tr>
  943.              <tr valign="top" align="left">
  944.                <td style="padding-left:22px; padding-right:22px; font-family:Arial, Helvetica, sans-serif; font-size:13px; color:#00466e"><table width="100%" border="0" cellspacing="0" cellpadding="0">';
  945. /* <tr valign="top" align="left">
  946.   <td width="41%" style="padding-top:10px; padding-bottom:5px; color:#00466e; font-weight:bold; background-color:#e5eff4; padding-left:10px; border-bottom:1px #d6d6d6 solid">Sub Total:</td>
  947.   <td width="59%" style="padding-top:10px; padding-bottom:5px; color:#00466e; font-weight:bold; background-color:#e5eff4; border-bottom:1px #d6d6d6 solid">$1,210.00</td>
  948.   </tr> */
  949. $customermail_msg.='</table></td>
  950.              </tr>
  951.              <tr valign="top" align="left">
  952.                <td style="padding-left:22px; padding-right:22px; font-family:Arial, Helvetica, sans-serif; font-size:13px; color:#00466e"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  953.                    <tr valign="top" align="left">
  954.                      <td width="41%" style="padding-top:10px; padding-bottom:5px; padding-left:10px; border-bottom:1px #d6d6d6 solid">Tax:</td>
  955.                      <td width="59%" style="padding-top:10px; padding-bottom:5px; border-bottom:1px #d6d6d6 solid">';
  956. if ($row1['tax_include'] == 1)
  957.     $p = '$' . $tax . ' (' . $row1['Tax__Percentage'] . ' % included in total)';
  958. else
  959.     $p = '$' . $tax;
  960. $customermail_msg.=$p . '</td>
  961.                    </tr>
  962.                  </table></td>
  963.              </tr>
  964.              <tr valign="top" align="left">
  965.                <td style="padding-left:22px; padding-right:22px; font-family:Arial, Helvetica, sans-serif; font-size:13px; color:#00466e"><table width="100%" border="0" cellspacing="0" cellpadding="0">';
  966. /* <tr valign="top" align="left">
  967.   <td width="41%" style="padding-top:10px; padding-bottom:5px; padding-left:10px; border-bottom:1px #d6d6d6 solid">Credit Card Fee:</td>
  968.   <td width="59%" style="padding-top:10px; padding-bottom:5px; border-bottom:1px #d6d6d6 solid">$5.00 (3%)</td>
  969.   </tr> */
  970.  
  971. $customermail_msg.='</table></td>
  972.              </tr>
  973.              <tr valign="top" align="left">
  974.                <td style="padding-left:22px; padding-right:22px; font-family:Arial, Helvetica, sans-serif; font-size:13px; color:#00466e"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  975.                    <tr valign="top" align="left">
  976.                      <td width="41%" style="padding-top:10px; background-color:#cffdce; padding-bottom:5px; color:#00466e; font-weight:bold; padding-left:10px; border-bottom:4px #d6d6d6 solid">Total:</td>
  977.                      <td width="59%" style="padding-top:10px; background-color:#cffdce; padding-bottom:5px; color:#00466e; font-weight:bold; border-bottom:4px #d6d6d6 solid">$' .sprintf("%.2f", /*$row1['Total']*/ ($rf + $uf + $cf - $dis + $tax)) . '</td>
  978.                    </tr>
  979.                  </table></td>
  980.              </tr>
  981.            </table></td>
  982.        </tr>
  983.        <tr valign="top" align="left">
  984.          <td height="10"></td>
  985.        </tr>';
  986. $query = "SELECT * FROM propertybooking_payment WHERE booking_reference='$booking_reference' and advance_amount>0 order by payment_date";
  987. $run = mysql_query($query);
  988. $total_row = mysql_num_rows($run);
  989. $paid_amount = 0.00;
  990.  
  991. if ($total_row > 0) {
  992.     $customermail_msg.='<tr valign="top" align="left">
  993.          <td style="padding-left:20px;"><table width="674" border="0" cellspacing="0" cellpadding="0">
  994.              <tr valign="top" align="left">
  995.                <td style="background:#00649c url(' . hosturl_1 . 'img/bluetitlebg.gif) repeat-x left top; height:27px; font-family:Arial, Helvetica, sans-serif; font-size:13px; font-weight:bold; color:#ffffff; padding-left:10px; line-height:27px;">Payment Details</td>
  996.              </tr>
  997.            </table></td>
  998.        </tr>';
  999.     while ($row = mysql_fetch_array($run)) {
  1000.         $paid_amount = $paid_amount + $row['advance_amount'];
  1001.         $customermail_msg_______.='
  1002.        <tr valign="top" align="left">
  1003.          <td style="background:#ffffff url(' . hosturl_1 . 'img/contentbg.gif) repeat-x left top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  1004.              <tr valign="top" align="left">
  1005.                <td style="padding-left:22px; padding-right:22px; font-family:Arial, Helvetica, sans-serif; font-size:13px; color:#00466e"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  1006.                    <tr valign="top" align="left">
  1007.                      <td width="41%" style="padding-top:10px; padding-bottom:5px; padding-left:10px; border-bottom:1px #e3e3e3 solid">Total Fee:</td>
  1008.                      <td width="59%" style="padding-top:10px; padding-bottom:5px; border-bottom:1px #e3e3e3 solid">$' .sprintf("%.2f", ($row1['Total']-(isset($row['credit_amount'])?$row['credit_amount']:0))) . '</td>
  1009.                    </tr>
  1010.                  </table></td>
  1011.              </tr>';
  1012.          $customermail_msg.='<tr valign="top" align="left">
  1013.                <td style="padding-left:22px; padding-right:22px; font-family:Arial, Helvetica, sans-serif; font-size:13px; color:#00466e"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  1014.                    <tr valign="top" align="left">
  1015.                      <td width="41%" style="padding-top:10px; padding-bottom:5px; padding-left:10px; border-bottom:1px #e3e3e3 solid">Payment Date:</td>
  1016.                      <td width="59%" style="padding-top:10px; padding-bottom:5px; border-bottom:1px #e3e3e3 solid">' . date('M d, Y', strtotime($row['payment_date'])) . '</td>
  1017.                    </tr>
  1018.                  </table></td>
  1019.              </tr>';
  1020.          if ($row['payment_method'] != 'Cash' and $row['credit_amount'] != "") {
  1021.             $customermail_msg.='<tr valign="top" align="left">
  1022.                <td style="padding-left:22px; padding-right:22px; font-family:Arial, Helvetica, sans-serif; font-size:13px; color:#00466e"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  1023.                    <tr valign="top" align="left">
  1024.                      <td width="41%" style="padding-top:10px; padding-bottom:5px; padding-left:10px; border-bottom:1px #e3e3e3 solid">Credit Card Fee:</td>
  1025.                      <td width="59%" style="padding-top:10px; padding-bottom:5px; border-bottom:1px #e3e3e3 solid">$' . sprintf("%.2f",$row['credit_amount']) . '</td>
  1026.                    </tr>
  1027.                  </table></td>
  1028.              </tr>';
  1029.         }
  1030.        
  1031.     }
  1032. }
  1033. $customermail_msg.='<tr valign="top" align="left">
  1034.                <td style="padding-left:22px; padding-right:22px; font-family:Arial, Helvetica, sans-serif; font-size:13px; color:#00466e"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  1035.                    <tr valign="top" align="left">
  1036.                      <td width="41%" style="padding-top:10px; padding-bottom:5px; padding-left:10px; border-bottom:1px #d6d6d6 solid"><strong>Amount Paid:</strong></td>
  1037.                      <td width="59%" style="padding-top:10px; padding-bottom:5px; border-bottom:1px #d6d6d6 solid">$' . sprintf("%.2f", $paid_amount) . '</td>
  1038.                    </tr>
  1039.                  </table></td>
  1040.              </tr>
  1041.              <tr valign="top" align="left">
  1042.                <td style="padding-left:22px; padding-right:22px; font-family:Arial, Helvetica, sans-serif; font-size:13px; color:#00466e"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  1043.                    <tr valign="top" align="left">
  1044.                      <td width="41%" style="padding-top:10px; padding-bottom:5px; padding-left:10px; border-bottom:4px #d6d6d6 solid"><strong>Amount Due:</strong></td>
  1045.                      <td width="59%" style="padding-top:10px; padding-bottom:5px; border-bottom:4px #d6d6d6 solid">$' . sprintf("%.2f", $row1['Total'] - $paid_amount) . '</td>
  1046.                    </tr>
  1047.                  </table></td>
  1048.              </tr>
  1049.            </table></td>
  1050.        </tr>';
  1051. $customermail_msg.=' </table></td>
  1052.  </tr>
  1053. </table>';
  1054.  
  1055.  
  1056.  
  1057. // End Customer Mail*********************************//
  1058. //$ownermail_msg='<p>'.$frommailOwner['message'].'</p><br/>';
  1059. $ownermail_msg.='<table width="718" border="0" cellspacing="0" cellpadding="0">
  1060.  <tr valign="top" align="left">
  1061.    <td style="border-top:4px #e2eff6 solid; border-bottom:4px #626262 solid; padding-bottom:10px;"><table width="718" border="0" cellspacing="0" cellpadding="0">
  1062.        <tr valign="top" align="left">
  1063.          <td width="396" style="padding-top:34px; padding-left:20px;"><a href="#"><img src="' . hosturl_1 . $path . '/' . $upload_folder . '/' . $imgname . '" border="0" /></a></td>
  1064.          <td width="322" align="right" style="font-family:Arial, Helvetica, sans-serif; font-weight:bold; font-size:13px;"><p style="margin:0px; padding-bottom:3px; padding-top:18px; padding-right:10px;">' . $site_row['site_name'] . '</p>
  1065.            <p style="margin:0px;  padding-right:10px;" >' . $site_row['Address1'] . ', ' . $site_row['City'] . ', ' . $site_row['StateID'] . ' ' . $site_row['Postalcode'] . '</p>
  1066.            <p style="border-bottom:1px #e3e3e3 solid; margin:0px; padding-top:8px;"></p>
  1067.            <p style="margin:0px; padding-top:8px;  padding-right:10px;">Ph:  ' . $site_row['Phone'] . '  Fax:  ' . $site_row['Fax'] . '</p>
  1068.            <p style="margin:0px; padding-top:5px;  padding-right:10px;">E-mail: <a href="mailto:' . $site_row['Email'] . '" style="color:#000; text-decoration:none">' . $site_row['Email'] . '</a></p></td>
  1069.        </tr>
  1070.      </table></td></tr>';
  1071. $ownermail_msg.='<tr valign="top" align="left">
  1072.    <td height="5"></td>
  1073.  </tr>
  1074.  <tr valign="top" align="left">
  1075.    <td style="border:1px #a9dbf5 solid; background:#eff6fa url(' . hosturl_1 . 'img/titlebg.gif) repeat-x left top; height:35px; line-height:35px; padding-left:23px; color:#005687; font-family:Arial, Helvetica, sans-serif; font-size:18px; font-weight:bold">Receipt</td>
  1076.  </tr>';
  1077. $ownermail_msg.='<tr valign="top" align="left">
  1078.    <td style="border:1px #a9dbf5 solid; border-top:0px; padding-bottom:20px;"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  1079.        <tr valign="top" align="left">
  1080.          <td style="padding-left:20px; font-family:Arial, Helvetica, sans-serif; font-size:13px;"><p> Dear ' . $Owner_Lastname . ',<p>' . html_entity_decode($site_row['email_msg_content_owner_website']) . '</p>
  1081.            <p><strong>Following are the details of your transaction.</strong></p>
  1082.             <p>Your Property ' . $pro_USERID . '&nbsp; has been booked!</p></td>
  1083.        </tr>
  1084.        <tr valign="top" align="left">
  1085.          <td style="background:#ffffff url(' . hosturl_1 . 'img/contentbg.gif) repeat-x left top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  1086.              <tr valign="top" align="left">
  1087.                <td style="padding-left:22px; padding-right:22px; font-family:Arial, Helvetica, sans-serif; font-size:13px; color:#00466e"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  1088.                    <tr valign="top" align="left">
  1089.                      <td width="41%" style="padding-top:10px; padding-bottom:5px; padding-left:10px; border-bottom:1px #e3e3e3 solid">Guest Name:</td>
  1090.                      <td width="59%" style="padding-top:10px; padding-bottom:5px; border-bottom:1px #e3e3e3 solid">' . $guestlastname . '</td>
  1091.                    </tr>
  1092.                  </table></td>
  1093.              </tr>
  1094.                <tr valign="top" align="left">
  1095.                <td style="padding-left:22px; padding-right:22px; font-family:Arial, Helvetica, sans-serif; font-size:13px; color:#00466e"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  1096.                    <tr valign="top" align="left">
  1097.                      <td width="41%" style="padding-top:10px; padding-bottom:5px; padding-left:10px; border-bottom:1px #e3e3e3 solid">Booking Duration:</td>
  1098.                      <td width="59%" style="padding-top:10px; padding-bottom:5px; border-bottom:1px #e3e3e3 solid">' . date('F d, Y', strtotime($min_date)) . '&nbsp;through&nbsp;' . date('F d, Y', strtotime(date("Y-m-d", strtotime("+1 day", strtotime($row1['DateTo']))))) . '</td>
  1099.                    </tr>
  1100.                  </table></td>
  1101.              </tr>';
  1102.  
  1103.  
  1104. /*
  1105.  
  1106.   $upgrdid=array();
  1107.   $poolheat=$row1['optional_upgrade_options'];
  1108.   $poolheat=explode(',',$poolheat);
  1109.   $cnt=count($poolheat);
  1110.   for($i=0;$i<$cnt;$i++)
  1111.   {
  1112.   $poolid=explode('PRICE',$poolheat[$i]);
  1113.   $upgrdid[$i]=$poolid[0];
  1114.   }
  1115.   $upids=implode(',',$upgrdid);
  1116.   $pooldetail=Booking::getPoolheat($upids);
  1117.   $poolprice=Booking::getPoolPriceByUser($pooldetail,$row1);
  1118.   if($poolprice>0)
  1119.   {
  1120.   $ownermail_msg.='<tr valign="top" align="left">
  1121.   <td style="padding-left:22px; padding-right:22px; font-family:Arial, Helvetica, sans-serif; font-size:13px; color:#00466e"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  1122.   <tr valign="top" align="left">
  1123.   <td width="41%" style="padding-top:10px; padding-bottom:5px; padding-left:10px; border-bottom:1px #e3e3e3 solid">Pool Heat:</td>
  1124.   <td width="59%" style="padding-top:10px; padding-bottom:5px; border-bottom:1px #e3e3e3 solid">$'.sprintf('%.2f',$poolprice).'</td>
  1125.   </tr>
  1126.   </table></td>
  1127.   </tr>';
  1128.   }
  1129.  
  1130.  */
  1131.  
  1132.  
  1133. $ownermail_msg.='<tr valign="top" align="left">
  1134.                <td style="padding-left:22px; padding-right:22px; font-family:Arial, Helvetica, sans-serif; font-size:13px; color:#00466e"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  1135.                    <tr valign="top" align="left">
  1136.                      <td width="41%" style="padding-top:10px; padding-bottom:5px; padding-left:10px; border-bottom:1px #e3e3e3 solid">Rental Amount:</td>
  1137.                      <td width="59%" style="padding-top:10px; padding-bottom:5px; border-bottom:1px #e3e3e3 solid">$' . ($row1['Total'] + $poolprice) . '</td>
  1138.                    </tr>
  1139.                  </table></td>
  1140.              </tr>
  1141.               </table></td>
  1142.  </tr>
  1143. </table></table>';
  1144.  
  1145.  
  1146.  
  1147. //$ownermail_msg = '<p>'.unhtmlentities($msg_content_owner_website).'<p/>'.$ownermail_msg;
  1148. //$customermail_msg = $customermail_msg . '<br/><p>'.unhtmlentities($msg_content_guest_website).'<p/>';
  1149.  
  1150. $new_sub = $rowp1['user_PropertyID'] . " - " . ucfirst($last_name); // Add Propetry ID and guest last name to subject line of mail....
  1151. //if(get_val_col("site_info","notify_manager_of_booking","site_reference",$_SESSION['user_site_id'])==1)
  1152. if (get_val_col("site_info", "notify_manager_website_of_booking", "site_reference", $siteKey)) {
  1153. //$nfem=get_val_col("site_info","notify_manager_email","site_reference",$_SESSION['user_site_id']);
  1154.     $nfem = get_val_col("site_info", "notify_manager_website_email", "site_reference", $siteKey);
  1155.     if ($nfem != '' && $nfem != 'manager email address')
  1156.         $Manager_Email = $nfem;
  1157.     $E_mail_From = $frommail;
  1158.     $headers = "MIME-Version: 1.0\r\n";
  1159.     $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
  1160.     $headers .= 'From: <' . $E_mail_From . '>' . "\r\n";
  1161.     $subject = $frommailManager['subject'] ? $frommailManager['subject'] : "Booking Detail";
  1162.     $subject = $new_sub . "  " . $subject;
  1163.  
  1164.     $mail_msg1 = str_replace("{##}", unhtmlentities($msg_content_manager_website), $mail_msg);
  1165.  
  1166.  
  1167.     echo "Manager Email ::----->" . $Manager_Email . "<br/>" . $mail_msg1;
  1168.  
  1169.     @mail('testforemail.test@gmail.com', 'Manager-' . $subject, $mail_msg1, $headers);
  1170.  
  1171.     if ($smtp_info['mailer'] == "smtp_mail") {
  1172.         $sendtocustomer = SMTP_AUTH_MAIL($frommail, $Manager_Email, $subject, $mail_msg1, $smtp_info['smtp_host'], $smtp_info['username'], $smtp_info['password']);
  1173.         //$sendtocustomer=mail($Customer_Email,$subject,$customermail_msg,$headers);
  1174.     } else {
  1175.         //echo $Manager_Email."<br>".$mail_msg;
  1176.         @mail($Manager_Email, $subject, $mail_msg1, $headers);
  1177.     }
  1178. }
  1179. ///new changes
  1180. $E_mail_From = $frommail;
  1181. $headers = "MIME-Version: 1.0\r\n";
  1182. $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
  1183. $headers .= 'From: <' . $E_mail_From . '>' . "\r\n";
  1184. $subject = $frommailAgent['subject'] ? $frommailAgent['subject'] : "Booking Detail";
  1185. $subject = $new_sub . "  " . $subject;
  1186. //if(get_val_col("site_info","notify_agent_of_booking","site_reference",$_SESSION['user_site_id'])==1)
  1187. if (get_val_col("site_info", "notify_agent_website_of_booking", "site_reference", $siteKey)) {
  1188.  
  1189.     $mail_msg1 = str_replace("{##}", unhtmlentities($msg_content_agent_website), $mail_msg);
  1190.  
  1191.     echo "Agent Email ::----->" . $Agent_Email . "<br/>" . $mail_msg1;
  1192.  
  1193.     @mail('testforemail.test@gmail.com', 'agent-' . $subject, $mail_msg1, $headers);
  1194.  
  1195.     if ($smtp_info['mailer'] == "smtp_mail") {
  1196.         $sendtocustomer = SMTP_AUTH_MAIL($frommail, $Agent_Email, $subject, $mail_msg1, $smtp_info['smtp_host'], $smtp_info['username'], $smtp_info['password']);
  1197.         //$sendtocustomer=mail($Customer_Email,$subject,$customermail_msg,$headers);
  1198.     } else {
  1199.         @mail($Agent_Email, $subject, $mail_msg1, $headers);
  1200.     }
  1201. }
  1202. $E_mail_From = $frommail;
  1203. $headers = "MIME-Version: 1.0\r\n";
  1204. $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
  1205. $headers .= 'From: <' . $E_mail_From . '>' . "\r\n";
  1206. $subject = $frommailCross['subject'] ? $frommailCross['subject'] : "Booking Detail";
  1207. $subject = $new_sub . "  " . $subject;
  1208. //if(get_val_col("site_info","notify_crosshire_of_booking","site_reference",$_SESSION['user_site_id'])==1)
  1209. if (get_val_col("site_info", "notify_crosshire_website_of_booking", "site_reference", $siteKey)) {
  1210.  
  1211.     $mail_msg1 = str_replace("{##}", unhtmlentities($msg_content_crosshire_website), $mail_msg);
  1212.  
  1213.     echo "Crosshire Email ::----->" . $Cross_Email . "<br/>" . $mail_msg1;
  1214.  
  1215.     @mail('testforemail.test@gmail.com', 'crosshire-' . $subject, $mail_msg1, $headers);
  1216.  
  1217.     if ($smtp_info['mailer'] == "smtp_mail") {
  1218.         $sendtocustomer = SMTP_AUTH_MAIL($frommail, $Cross_Email, $subject, $mail_msg1, $smtp_info['smtp_host'], $smtp_info['username'], $smtp_info['password']);
  1219.         //$sendtocustomer=mail($Customer_Email,$subject,$customermail_msg,$headers);
  1220.     } else {
  1221.         @mail($Cross_Email, $subject, $mail_msg1, $headers);
  1222.     }
  1223. }
  1224. //end new changes
  1225. $E_mail_From = $frommail;
  1226. $headers = "MIME-Version: 1.0\r\n";
  1227. $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
  1228. $headers .= 'From: <' . $E_mail_From . '>' . "\r\n";
  1229. $subject = $frommailOwner['subject'] ? $frommailOwner['subject'] : "Booking Detail";
  1230. $subject = $new_sub . "  " . $subject;
  1231. if (get_val_col("site_info", "notify_owner_website_of_booking", "site_reference", $siteKey)) {
  1232.     if ($notify_owner == 1) {
  1233.  
  1234.         echo "Owner Email:----->" . $Owner_Email . "<br/>" . $ownermail_msg;
  1235.  
  1236.         @mail('testforemail.test@gmail.com', 'owner-' . $subject, $ownermail_msg, $headers);
  1237.  
  1238.         if ($smtp_info['mailer'] == "smtp_mail") {
  1239.             $sendtocustomer = SMTP_AUTH_MAIL($frommail, $Owner_Email, $subject, $ownermail_msg, $smtp_info['smtp_host'], $smtp_info['username'], $smtp_info['password']);
  1240.             //$sendtocustomer=mail($Customer_Email,$subject,$customermail_msg,$headers);
  1241.         } else {
  1242.             if (@mail($Owner_Email, $subject, $ownermail_msg, $headers)) {
  1243.                 $qry = "update propertybooking_summary set maildateTime=CURDATE() where     booking_reference='" . $row1['booking_reference'] . "'";
  1244.  
  1245.                 mysql_query($qry);
  1246.             }
  1247.         }
  1248.     }
  1249. }
  1250.  
  1251.  
  1252.  
  1253. //if(intval($guestRecipt)== 1)
  1254. //{
  1255. //echo 'hhhhh'.$guestRecipt11."hello";
  1256. //echo $customermail_msg;
  1257. if (trim($Customer_Email) <> '') {
  1258.     $E_mail_From = $frommail;
  1259.     $headers = "MIME-Version: 1.0\r\n";
  1260.     $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
  1261.     $headers .= 'From: <' . $E_mail_From . '>' . "\r\n";
  1262.     $subject = $frommailGuest['subject'] ? $frommailGuest['subject'] : "Booking Detail";
  1263.     $subject = $new_sub . "  " . $subject;
  1264.  
  1265.     echo "custumor email :: --->" . $Customer_Email . "<br/>" . $customermail_msg;
  1266.  
  1267.     @mail('testforemail.test@gmail.com', 'Customer-' . $subject, $mail_msg, $headers);
  1268.  
  1269.     if ($smtp_info['mailer'] == "smtp_mail") {
  1270.         $sendtocustomer = SMTP_AUTH_MAIL($frommail, $Customer_Email, $subject, $customermail_msg, $smtp_info['smtp_host'], $smtp_info['username'], $smtp_info['password']);
  1271.         //$sendtocustomer=mail($Customer_Email,$subject,$customermail_msg,$headers);
  1272.     } else {
  1273.         $sendtocustomer = mail($Customer_Email, $subject, $customermail_msg, $headers);
  1274.     }
  1275.     if ($sendtocustomer == '1') {
  1276.         $myup = "UPDATE propertybooking_customerdetail SET send_email='1' WHERE booking_reference='$booking_reference'";
  1277.         mysql_query($myup);
  1278.     }
  1279. }
  1280.  
  1281. //}
  1282.  
  1283.  
  1284. if (get_val_col("site_info", "notify_guest_website_of_booking", "site_reference", $siteKey) == 1) {
  1285.     $booking_msg_guest_website = unhtmlentities($site_row['email_msg_content_guest_website']);
  1286. } else {
  1287.     $booking_msg_guest_website = "Your booking has been successfully completed.";
  1288. }
  1289. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement