<tr> <td></td> <td> <div class="clearfix"> <span style="float:left; margin:0 10px 0 0;"> <input type="hidden" name="list_id" value="<?php echo $result->list_id; ?> " /> <input type="hidden" name="reservation_id" value="<?php echo $result->id; ?> " /> <?php $host_payout_id = get_userPayout($result->userto); $guest_payout_id = get_userPayout($result->userby); if ($result->is_payed != 1) { if ($result->status != 1 && $result->status != 2 && $result->status != 4 && $result->status != 5 && $result->status != 6) { if (isset($host_payout_id->email)) { ?> <input type="hidden" name="biz_id" value="<?php echo $host_payout_id->email; ?> " /> <input class="clsSubmitBt1" type="submit" name="payviapaypal" value="<?php echo translate_admin('Pay Using PayPal to Host'); ?> " style="width:190px;" /> <?php } else { ?>
function paypal_commission_success($id) { $accept_pay_result = $this->db->where('id', $id)->get('accept_pay')->row(); $is_payed = $accept_pay_result->status; if ($is_payed == 0) { // echo 'test';exit; $custom = $this->session->userdata('custom'); $data = array(); $list = array(); $data = explode(',', $custom); $list_id = $data[0]; $reservation_id = $data[1]; $email_id = $data[2]; $price = $data[3]; $result = $this->Common_model->getTableData('reservation', array('id' => $reservation_id))->row(); $checkin = $result->checkin; $checkout = $result->checkout; $admin_email = $this->dx_auth->get_site_sadmin(); $admin_name = $this->dx_auth->get_site_title(); $query = $this->Users_model->get_user_by_id($result->userby); $traveler_name = $query->row()->username; $traveler_email = $query->row()->email; $query1 = $this->Users_model->get_user_by_id($result->userto); $hotelier_name = $query1->row()->username; $hotelier_email = $query1->row()->email; $currency_symbol = $this->Common_model->getTableData('currency', array('currency_code' => $accept_pay_result->currency))->row()->currency_symbol; $refund_amt = $currency_symbol . $accept_pay_result->amount; $conversation = $this->db->where('userto', $result->userto)->where('userby', 1)->order_by('id', 'desc')->get('messages'); if ($conversation->num_rows() != 0) { foreach ($conversation->result() as $row3) { if ($row3->conversation_id != 0) { $conversation_id = $row3->conversation_id; } else { $conversation1 = $this->db->where('userto', 1)->where('userby', $result->userto)->order_by('id', 'desc')->get('messages'); if ($conversation1->num_rows() != 0) { foreach ($conversation1->result() as $row2) { if ($row2->conversation_id != 0) { $conversation_id = $row2->conversation_id; } } } else { $conversation_id = 0; } } } } else { $conversation1 = $this->db->where('userto', 1)->where('userby', $result->userto)->order_by('id', 'desc')->get('messages'); if ($conversation1->num_rows() != 0) { foreach ($conversation1->result() as $row1) { if ($row1->conversation_id != 0) { $conversation_id = $row1->conversation_id; } } } else { $conversation_id = 0; } } $name = ''; //Reservation Notification To Host $host_payout_id = get_userPayout($result->userto)->email; $name = $hotelier_name; $email_name = 'refund_host_commission'; $splVars = array("{site_name}" => $this->dx_auth->get_site_title(), "{currency}" => $currency_symbol, "{host_name}" => ucfirst($hotelier_name), "{account}" => "PayPal {$host_payout_id}", "{list_title}" => get_list_by_id($list_id)->title, "{payed_date}" => date("F j, Y", time()), "{refund_amt}" => $refund_amt); //Send Mail $this->Email_model->sendMail($hotelier_email, $admin_email, ucfirst($admin_name), $email_name, $splVars); if (!isset($conversation_id)) { $insertData = array('list_id' => $result->list_id, 'reservation_id' => $result->id, 'userby' => 1, 'userto' => $result->userto, 'message' => "Admin refund {$refund_amt} to you for Host reservation accept commission.", 'created' => date('m/d/Y g:i A'), 'message_type ' => 3); } else { $insertData = array('list_id' => $result->list_id, 'reservation_id' => $result->id, 'conversation_id' => $conversation_id, 'userby' => 1, 'userto' => $result->userto, 'message' => "Admin refund {$refund_amt} to you for Host reservation accept commission.", 'created' => date('m/d/Y g:i A'), 'message_type ' => 3); } $refund_data['userto'] = $result->userto; $this->Message_model->sentMessage($insertData); $refund_data['reservation_id'] = $result->id; $refund_data['payout_id'] = $this->session->userdata('payout_id'); $refund_data['created'] = time(); $refund_data['accept_status'] = 1; $this->Common_model->inserTableData('refund', $refund_data); $admin_to_email = $this->db->where('id', 1)->get('users')->row()->email; //Reservation Notification To Admin $email_name = 'refund_host_commission_admin'; $splVars = array("{name}" => $name, "{traveler_email}" => $traveler_email, "{host_email}" => $hotelier_email, "{site_name}" => $this->dx_auth->get_site_title(), "{currency}" => $currency_symbol, "{account}" => "PayPal {$host_payout_id}", "{host_name}" => ucfirst($hotelier_name), "{list_title}" => get_list_by_id($list_id)->title, "{payed_date}" => date("F j, Y", time()), "{refund_amt}" => $refund_amt); //Send Mail $this->Email_model->sendMail($admin_to_email, $admin_email, ucfirst($admin_name), $email_name, $splVars); $this->db->where('id', $id)->update('accept_pay', array('status' => 1)); $data['message_element'] = "administrator/payment/paypal_success"; $this->load->view('administrator/admin_template', $data); } else { $data['message_element'] = "administrator/payment/paypal_success"; $this->load->view('administrator/admin_template', $data); } }