| Server IP : 210.245.233.93 / Your IP : 216.73.216.226 Web Server : Apache/2.2.15 (CentOS) System : Linux webserver2.onesolution.com.hk 2.6.32-754.35.1.el6.x86_64 #1 SMP Sat Nov 7 12:42:14 UTC 2020 x86_64 User : apache ( 48) PHP Version : 5.3.3 Disable Function : exec, shell_exec, system, passthru, popen, proc_open, pcntl_exec MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/hkosl.com/m.musiccircle/ |
Upload File : |
<?php
include('_init.php');
if ($_SESSION["is_student"] != 1 && $_SESSION["is_tutor"] != 1) {
header("Location: index.php");
exit;
}
$page_settings['domain'] = "order";
$sql = "select profile_id,user_id
from `profile_user` as tb where user_id = ? and deleted = ? LIMIT 1";
$parameters = array($_SESSION['cmsloginid'], 0);
$row_profile = bind_pdo($sql, $parameters, "selectone");
$order = get_order((int)$_GET["id"]);
if ($row_profile['profile_id'] == 4) {
$sql99 = "select id from `student_main` where cmsloginid = ? LIMIT 1";
$parameters99 = array((int)$row_profile['user_id']);
$row_user = bind_pdo($sql99, $parameters99, "selectone");
if ($row_user['id'] != $order['studentmain_id']) {
$path = $page_settings['domain'] . '_index.php';
@header("Location: {$path}");
echo "<script language='JavaScript'>window.location='{$path}'</script>";
}
} else if ($row_profile['profile_id'] == 3) {
$sql99 = "select id from `tutor_main` where cmsloginid = ? LIMIT 1";
$parameters99 = array((int)$row_profile['user_id']);
$row_user = bind_pdo($sql99, $parameters99, "selectone");
if ($row_user['id'] != $order['tutormain_id']) {
$path = $page_settings['domain'] . '_index.php';
@header("Location: {$path}");
echo "<script language='JavaScript'>window.location='{$path}'</script>";
}
}
if ($order) {
$action = 'Modify'; // Add or Modify
$sql99 = "SELECT * FROM sys_cms_login WHERE cmsloginid=?";
$parameters99 = array((int)$row{'cmsloginid'});
$row_user = bind_pdo($sql99, $parameters99, "selectone");
} else {
//$action = 'Add'; // Add or Modify
$path = $page_settings['domain'] . '_index.php';
@header("Location: {$path}");
echo "<script language='JavaScript'>window.location='{$path}'</script>";
exit();
}
$sql = "select id,datetime,tutor_status,student_status,solution_status from order_detail where order_id = ?";
$parameters = array($order['id']);
$rows_detail = bind_pdo($sql, $parameters, "selectall");
if ($order['order_type'] == 'course') {
$sql = "select id, postjob_no,mas_instrument,address_cn, course_hours, course_count from tutor_postjob where id = ? and deleted = ?";
$parameters = array($order['job_id'], 0);
$row_job = bind_pdo($sql, $parameters, "selectone");
} else {
$sql = "select id,postjob_no,mas_instrument from student_postjob where id = ? and deleted = ?";
$parameters = array($order['job_id'], 0);
$row_job = bind_pdo($sql, $parameters, "selectone");
}
$sql = "select tutor_no,nickname as name from tutor_main where id = ? and deleted = ?";
$parameters = array($order['tutormain_id'], 0);
$row_tutor = bind_pdo($sql, $parameters, "selectone");
$sql = "select student_no,contactname as name from student_main where id = ? and deleted = ?";
$parameters = array($order['studentmain_id'], 0);
$row_student = bind_pdo($sql, $parameters, "selectone");
$sql = "select name_cn from master_type_code where id = ? and typeid = ? and deleted = ?";
$parameters = array($order['mas_residencecode'], 'TEACH_POSITIONCODE', 0);
$row_positioncode = bind_pdo($sql, $parameters, "selectone");
$sql = "select name_cn from master_type_code where id = ? and typeid = ? and deleted = ?";
$parameters = array($order['course_venus'], 'TEACH_VENUS', 0);
$row_venus = bind_pdo($sql, $parameters, "selectone");
if (!empty($row_job['mas_instrument'])) {
$mas_instrument_id = $row_job['mas_instrument'];
} else {
$mas_instrument_id = $order["mas_instrument"];
}
$sql = "select name_en,name_cn from master_type_code where id = ? and typeid = 'INSTRUMENT' LIMIT 1";
$parameters = array($mas_instrument_id);
$row_instrument = bind_pdo($sql, $parameters, "selectone");
$paypal_link = "";
if ($row_profile['profile_id'] == 4) {
if ($order['status'] == 'approved') {
$shipping_price = 0;
$amount = intval($order['total_fee']) - intval($order['coupon_fee']);
$invoiceNo = $order['order_no'];
//$amount = 0.1;
$extra_url = EXTRA_URL;
$paypal_url = PAYPAL_URL;
$paypal_array = array('cmd' => '_xclick',
'upload' => '1',
'custom' => $order['id'],
'invoice' => $invoiceNo,
'business' => PAYPAL_BUSINESS,
'item_name' => $row_instrument['name_en'] . ' - Course Fee',
//'item_name' =>'a',
'item_number' => $invoiceNo,
'currency_code' => 'HKD',
'shipping' => $shipping_price,
'no_shipping' => 1,
'amount' => $amount,
//'image_url' =>$GLOBALS['site_info']['full_path'].'images/logo.png',
'return' => 'http://' . $_SERVER['HTTP_HOST'] . '/' . $extra_url . 'webadmin/order_form.php?id=' . $order['id'],
'notify_url' => 'http://' . $_SERVER['HTTP_HOST'] . '/' . $extra_url . 'paypal_notify.php',
'cancel_return' => 'http://' . $_SERVER['HTTP_HOST'] . '/' . $extra_url . 'order_form.php?id=' . $order['id']
);
$array = array();
foreach ($paypal_array as $name => $data) {
$array[] = $name . '=' . urlencode($data);
}
$paypal_link = $paypal_url . '?' . implode('&', $array);
}
}
if (!empty($_GET["click_paypal"]) && $_GET["click_paypal"] == 1 && !empty($paypal_link)) {
header("Location: " . $paypal_link);
exit;
}
//read notification
$sql = "update notification set `read` = ?, read_date = ? where table_name = ? and table_id = ? and cmsloginid = ? and deleted = ? and `read` = ? and read_date is null";
$parameters = array(1, date("Y-m-d"), "order", (int)$_GET["id"], $_SESSION["cmsloginid"], 0, 0);
bind_pdo($sql, $parameters);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<?php include('_head.php'); ?>
<link href="css/style_k.css?v=<?=time();?>" type="text/css" rel="stylesheet">
</head>
<body>
<?php include('_header.php') ?>
<?php include('_dialog.php') ?>
<div class="ProfileContent">
<div class="Profilecontainer">
<div class="row">
<div class="col-md-12 faq">
<form action="<?= $page_settings['domain'] ?>_<? if ($order['status'] == 'process') { ?>action<? } elseif ($order['status'] == 'paid' || ($order['status'] != 'paid' && ($row_profile['profile_id'] == 1 || $row_profile['profile_id'] == 2))) { ?>process<? } ?>.php" class="myform" id="myform" method="<? if ($order['status'] == 'process') { ?>get<? } elseif ($order['status'] == 'paid' || ($order['status'] != 'paid' && ($row_profile['profile_id'] == 1 || $row_profile['profile_id'] == 2))) { ?>post<? } ?>" enctype="multipart/form-data">
<? if ($order['id']) { ?>
<input type="hidden" name="id" value="<?= _h($order['id']) ?>"/>
<? if ($order['status'] == 'process') { ?>
<input type="hidden" name="action" value="approved"/>
<? } ?>
<? } ?>
<div class="row">
<div class="col-xs-12">
<div class="box">
<div class="box-header">
<div class="col-md-4">
<div class="btn-group">
<!--<a href="order_index.php" class="btn btn-default"><i class="fa fa-chevron-left" aria-hidden="true"></i>
<?/*= _lang('Back') */?>
</a>-->
<?
if ($order['order_type'] == 'course') {
if ($order['status'] == 'process') {
$order['status'] = 'approved';
}
}
?>
<? if ($order['status'] == 'process' || $order['status'] == 'approved' || $order['status'] == 'reject') { ?>
<? if ($row_profile['profile_id'] == 3) { ?>
<? if ($order['status'] == 'approved' || $order['status'] == 'reject') { ?>
<span class="btn btn-default"><i class="fa fa-paypal" aria-hidden="true"></i>
<? if ($order['status'] == 'approved') { ?>
等待學生付款中
<? } else if ($order['status'] == 'reject') { ?>
<? if ($order['form_type'] == 'tutor') { ?>
學生已拒絕你的邀請
<? } else { ?>
你已拒絕學生的邀請
<? } ?>
<? } ?>
</span>
<? } else { ?>
<? if ($order['from_type'] == 'student') { ?>
<a href="<?= $page_settings['domain'] ?>_action.php?id=<?= $order['id'] ?>&action=approved" class="btn btn-default btn-success" style="color:#FFF;" onClick="return <? if ($order['status'] == 'process') { ?>submitfrom();<? } else { ?>confirm('你確認嗎?');<? } ?>">
<i class="glyphicon glyphicon-ok-sign" aria-hidden="true"></i>
<?= _lang("Accept") ?>
</a>
<a href="<?= $page_settings['domain'] ?>_action.php?id=<?= $order['id'] ?>&action=reject" class="btn btn-default btn-warning" style="color:#FFF;" onClick="return confirm('你確認嗎?')">
<i class="glyphicon glyphicon-remove-sign" aria-hidden="true"></i>
<?= _lang("Reject") ?>
</a>
<?php } else if ($order['from_type'] == 'tutor') { ?>
<a href="<?= $page_settings['domain'] ?>_action.php?id=<?= $order['id'] ?>&action=cancel" class="btn btn-default btn-warning" style="color:#FFF;" onClick="return confirm('你確認嗎?')">
<i class="glyphicon glyphicon-remove-sign" aria-hidden="true"></i>
<?= _lang("取消邀請") ?>
</a>
<? } ?>
<? } ?>
<? } else if ($row_profile['profile_id'] == 4) { ?>
<? if ($order['status'] == 'approved' || $order['status'] == 'reject') { ?>
<? if ($order['status'] == 'approved') { ?>
<a href="<?= $paypal_link ?>" class="btn btn-default btn-success" style="color:#FFF;" id="payment_btn">
<i class="fa fa-paypal" aria-hidden="true"></i>
<?= _lang("付款") ?>
</a>
<? if ($order["order_type"] == "course") { ?>
<a href="<?= $page_settings['domain'] ?>_action.php?id=<?= $order['id'] ?>&action=cancel" class="btn btn-default btn-warning" style="color:#FFF;" onClick="return confirm('你確認嗎?')">
<i class="glyphicon glyphicon-remove-sign" aria-hidden="true"></i>
<?= _lang("取消") ?>
</a>
<?php } ?>
<? } else if ($order['status'] == 'reject') { ?>
<span class="btn btn-default"><i class="fa fa-paypal" aria-hidden="true"></i>
<? if ($order['form_type'] == 'student') { ?>
你已拒絕導師的邀請
<? } else { ?>
導師已拒絕你的邀請
<? } ?>
</span>
<? } ?>
<? } else { ?>
<? if ($order['from_type'] == 'tutor') { ?>
<a href="<?= $page_settings['domain'] ?>_action.php?id=<?= $order['id'] ?>&action=approved" class="btn btn-default btn-success" style="color:#FFF;" onClick="return confirm('你確認嗎?')">
<i class="glyphicon glyphicon-ok-sign" aria-hidden="true"></i>
<?= _lang("Accept") ?>
</a>
<a href="<?= $page_settings['domain'] ?>_action.php?id=<?= $order['id'] ?>&action=reject" class="btn btn-default btn-warning" style="color:#FFF;" onClick="return confirm('你確認嗎?')">
<i class="glyphicon glyphicon-remove-sign" aria-hidden="true"></i>
<?= _lang("Reject") ?>
</a>
<?php } else if ($order['from_type'] == 'student') { ?>
<a href="<?= $page_settings['domain'] ?>_action.php?id=<?= $order['id'] ?>&action=cancel" class="btn btn-default btn-warning" style="color:#FFF;" onClick="return confirm('你確認嗎?')">
<i class="glyphicon glyphicon-remove-sign" aria-hidden="true"></i>
<?= _lang("取消邀請") ?>
</a>
<?php } ?>
<? } ?>
<? } ?>
<? } ?>
<? /*if (($order['status'] == 'paid' && ($row_profile['profile_id'] == 3 || $row_profile['profile_id'] == 1 || $row_profile['profile_id'] == 2)) || ($order['status'] != 'paid' && ($row_profile['profile_id'] == 1 || $row_profile['profile_id'] == 2))) { ?>
<button type="button" class="btn btn-primary" onClick="submitfrom()">
<i class="fa fa-floppy-o" aria-hidden="true"></i> <?= _lang('Save') ?>
</button>
<? } */?>
</div>
</div>
<? /*if ($order['status'] == 'paid') { ?>
<div class="col-md-2" style="float:right;">
<div class="btn-group" style="float:right;">
<span onclick="printDiv('printableArea')" class="btn btn-default">
<i class="fa fa-print" aria-hidden="true"></i>
<?= _lang("Print") ?>
</span></div>
</div>
<? } */?>
</div>
<!-- /.box-header -->
<div class="box-body" id="printableArea">
<br>
<table width="100%" border="0" cellpadding="0" cellspacing="2">
<?php //if($order['status'] != "paid"){ ?>
<tr>
<th width="120" align="right" valign="top" style="text-align:right;">狀態</th>
<td width="5" valign="top" class=''>: </td>
<td class=''>
<div class="col-sm-12 form-group">
<?= get_order_status($order['status']) ?>
</div>
</td>
</tr>
<?php //} ?>
<? if ($order['status'] == 'paid' || $order['status'] == 'fail' || $order['status'] == 'refunded') { ?>
<tr>
<th width="120" align="right" valign="top" class='' style="text-align:right;">
Paypal 編號
</th>
<td width="5" valign="top" class=''>: </td>
<td class=''>
<div class="col-sm-12 form-group">
<?= $order['paypal_id'] ?>
</div>
</td>
</tr>
<tr>
<th width="120" align="right" valign="top" class='' style="text-align:right;">
Paypal 處理日期
</th>
<td width="5" valign="top" class=''>: </td>
<td class=''>
<div class="col-sm-12 form-group">
<?= $order['paypal_date'] ?>
</div>
</td>
</tr>
<? }?>
<tr>
<th width="120" align="right" valign="top" height="40" style="text-align:right;"><?= lang("Post No.") ?></th>
<td valign="top" class=''> </td>
<td valign="top" class=''>
<div class="col-sm-12 form-group">
<?php $row_job['postjob_no'] = "J".str_pad($row_job["id"], 5, "0", STR_PAD_LEFT); if ($order["order_type"] == 'course') { ?>
<?= $row_job['postjob_no'] ? $row_job['postjob_no'] : '-' ?>
<?php } else { ?>
<a href="chat_index.php?first_chat_id=<?= $order['first_chat_id'] ?>" target="_blank">
<?= $row_job['postjob_no'] ? $row_job['postjob_no'] : '-' ?>
</a>
<?php } ?>
</div>
</td>
</tr>
<tr>
<th width="120" align="right" valign="top" height="40" style="text-align:right;"><?= lang("Order No.") ?></th>
<td valign="top" class=''> </td>
<td valign="top" class=''>
<div class="col-sm-12 form-group">
<?= short_code($order['order_no'], 2, -5) ?>
</div>
</td>
</tr>
<tr>
<th width="120" align="right" valign="top" height="40" style="text-align:right;">
學生
</th>
<td width="5" valign="top" class=''>: </td>
<td class=''>
<div class="col-sm-12 form-group">
<?php if ($_SESSION["is_tutor"] == 1) { ?>
<a href="chat_index.php?first_chat_id=<?= $order['first_chat_id'] ?>" target="_blank">
<?= $row_student['student_no'] ?>
<?= $row_student['name'] ?>
</a>
<?php } else { ?>
<?= $row_student['student_no'] ?>
<?= $row_student['name'] ?>
<?php } ?>
</div>
</td>
</tr>
<tr>
<th width="120" align="right" valign="top" height="40" style="text-align:right;">
導師
</th>
<td width="5" valign="top" class=''>: </td>
<td class=''>
<div class="col-sm-12 form-group">
<?php if ($_SESSION["is_student"] == 1) { ?>
<a href="chat_index.php?first_chat_id=<?= $order['first_chat_id'] ?>" target="_blank">
<?= $row_tutor['tutor_no'] ?>
<?= $row_tutor['name'] ?>
</a>
<?php } else { ?>
<?= $row_tutor['tutor_no'] ?>
<?= $row_tutor['name'] ?>
<?php } ?>
</div>
</td>
</tr>
<!--<tr>
<td width="120" align="right" valign="top" class=''>課堂類型</td>
<td width="5" valign="top" class=''>: </td>
<td class=''>
<div class="col-sm-12 form-group">
<?/* if ($order["order_type"] == 'course') {
echo "小組音樂班";
} else if ($order["order_type"] == "formal") {
echo "正堂";
} else if ($order["order_type"] == "try") {
echo "試堂";
}
*/?>
</div>
</td>
</tr>-->
<tr>
<td width="120" align="right" valign="top" class=''>上課地區</td>
<td width="5" valign="top" class=''>: </td>
<td class=''>
<div class="col-sm-12 form-group">
<? if ($order["order_type"] == 'course') { ?>
<?= $row_job['address_cn'] ? $row_job['address_cn'] : '-' ?>
<? } else { ?>
<?= $row_positioncode["name_cn"] ? $row_positioncode["name_cn"] : '-' ?>
<? } ?>
</div>
</td>
</tr>
<? if ($order["order_type"] != 'course') { ?>
<tr>
<td width="120" align="right" valign="top" class=''>上課場地</td>
<td width="5" valign="top" class=''>: </td>
<td class=''>
<div class="col-sm-12 form-group">
<?= $row_venus['name_cn'] ? $row_venus['name_cn'] : '-' ?>
</div>
</td>
</tr>
<? } ?>
<tr>
<td width="120" align="right" valign="top" class=''>樂器</td>
<td width="5" valign="top" class=''>: </td>
<td class=''>
<div class="col-sm-12 form-group">
<?= $row_instrument['name_cn']; ?>
</div>
</td>
</tr>
<tr>
<td width="120" align="right" valign="top" class=''>學習級別</td>
<td width="5" valign="top" class=''>: </td>
<td class=''>
<div class="col-sm-12 form-group">
<?
if ($order['order_type'] == 'try') {
if ($order['level'] == 1) {
echo '1 - 2';
} elseif ($order['level'] == 2) {
echo '3 - 5';
} elseif ($order['level'] == 3) {
echo _lang("6 or above 6");
}
} else if ($order['order_type'] == 'formal') {
if ($order['level'] < 8) {
echo $order['level'];
} else if ($order['level'] == 9) {
echo '8級以上';
}
} else if ($order['order_type'] == 'course') {
if ($order['level'] == 1) {
echo "初級";
} else if ($order['level'] == 3) {
echo "中級";
}
}
?>
</div>
</td>
</tr>
<tr>
<td width="120" align="right" valign="top" class=''>學習時間長度</td>
<td width="5" valign="top" class=''>: </td>
<td class=''>
<div class="col-sm-12 form-group">
<?php
if ($order["order_type"] == 'course') {
echo $row_job["course_hours"];
} else {
echo $order['course_length'];
}
echo _lang("mins");
?>
</div>
</td>
</tr>
<tr>
<td width="120" align="right" valign="top" class=''>學習堂數</td>
<td width="5" valign="top" class=''>: </td>
<td class=''>
<div class="col-sm-12 form-group">
<?php
if ($order["order_type"] == 'course') {
echo $row_job["course_count"];
} else {
echo $order['course_count'];
}
?>
</div>
</td>
</tr>
<? if ($order['order_type'] == 'try' || ($order['order_type'] == 'formal' && $order['status'] == 'paid') || $order['order_type'] == 'course') {
?>
<tr>
<td width="120" align="right" valign="top" class=''>上課日期 / 時間</td>
<td width="5" valign="top" class=''>: </td>
<td class=''>
<div class="col-sm-12 form-group">
<? if ($order['order_type'] == 'formal' || ($order['order_type'] == 'try' && !$row_job['postjob_no'])) { ?>
<? for ($i = 0; $i < $order['course_count']; $i++) { ?>
<?
$sql = "select * from order_detail as tt where order_id = ? and sort = ? LIMIT 1";
$parameters = array($order['id'], $i);
$row_detail = bind_pdo($sql, $parameters, "selectone");
?>
<div style="margin-bottom:5px;">
<? if ($row_profile['profile_id'] == 3 || $row_profile['profile_id'] == 2 || $row_profile['profile_id'] == 1) { ?>
<? $time = new DateTime();
if ($row_detail['datetime'] && ($time->modify("+ 1 day")->format("Y-m-d H:i:s") >= $row_detail['datetime'])) {
$end_datetime = new DateTime($row_detail['datetime']);
$end_datetime->modify("+" . $order['course_length'] . " minute");
?>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="100%">
<?= ($i + 1) ?>
.
<?= $row_detail['datetime'] . " 至 " . $end_datetime->format("Y-m-d H:i:s") ?>
<input type="hidden" name="datetime[<?= $i ?>]" value="<?= $row_detail['datetime'] ?>">
</td>
<?php ?>
<td style="padding-left:19px;">
<div class="orderdetailbtn">
<? if ($order['status'] == 'paid') { ?>
<a href="course_form.php?id=<?= $row_detail['id'] ?>" class="btn <? if ($row_detail['student_status'] == 1) { ?><? if ($row_detail['solution_status'] == 1) { ?>btn-success<? } else { ?>btn-warning<? } ?><? } elseif ($row_detail['tutor_status'] == 1) { ?>btn-success<? } else { ?>btn-default<? } ?>"><i class="fa fa-link" aria-hidden="true"></i>
課堂資料
<? if ($row_detail['student_status'] == 1) { ?>
(已投訴)
<? if ($row_detail['solution_status'] == 1) { ?>
(已解決)
<? } ?>
<? } elseif ($row_detail['tutor_status'] == 1) { ?>
(已上課)
<? } ?>
</a>
<? } ?>
</div>
</td>
<?php ?>
</tr>
</table>
<? } else { ?>
<?= ($i + 1) ?>
.
<input type="text" class="form-control datetimepicker" name="datetime[<?= $i ?>]" value="<?= $row_detail['datetime'] ?>" style="width:100%; display:inline-block;" placeholder="請輸入上課日期/時間">
<div id="dateError<?= $i ?>_1" style="color:#F00; display:none;" class="error">
請輸入上課日期/時間
</div>
<div id="dateError<?= $i ?>_2" style="color:#F00; display:none;" class="error">
不能輸入相同上課日期/時間
</div>
<?php if (!empty($row_detail['datetime'])) { ?>
<a href="course_form.php?id=<?= $row_detail['id'] ?>" class="btn <? if ($row_detail['student_status'] == 1) { ?><? if ($row_detail['solution_status'] == 1) { ?>btn-success<? } else { ?>btn-warning<? } ?><? } elseif ($row_detail['tutor_status'] == 1) { ?>btn-success<? } else { ?>btn-default<? } ?>"><i class="fa fa-link" aria-hidden="true"></i>
課堂資料
<? if ($row_detail['student_status'] == 1) { ?>
(已投訴)
<? if ($row_detail['solution_status'] == 1) { ?>
(已解決)
<? } ?>
<? } elseif ($row_detail['tutor_status'] == 1) { ?>
(已上課)
<? } ?>
</a>
<?php } ?>
<? } ?>
<? } else { ?>
<? if ($row_detail['datetime']) {
$end_datetime = new DateTime($row_detail['datetime']);
$end_datetime->modify("+" . $order['course_length'] . " minute");
?>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="100%"><?= ($i + 1) ?>
.
<?= $row_detail['datetime'] . " 至 " . $end_datetime->format("Y-m-d H:i:s") ?>
</td>
<?php ?>
<td>
<div class="orderdetailbtn">
<? if ($order['status'] == 'paid') { ?>
<a href="course_form.php?id=<?= $row_detail['id'] ?>" class="btn <? if ($row_detail['student_status'] == 1) { ?><? if ($row_detail['solution_status'] == 1) { ?>btn-success<? } else { ?>btn-warning<? } ?><? } elseif ($row_detail['tutor_status'] == 1) { ?>btn-success<? } else { ?>btn-default<? } ?>"><i class="fa fa-link" aria-hidden="true"></i>
課堂資料
<? if ($row_detail['student_status'] == 1) { ?>
(已投訴)
<? if ($row_detail['solution_status'] == 1) { ?>
(已解決)
<? } ?>
<? } elseif ($row_detail['tutor_status'] == 1) { ?>
(已上課)
<? } ?>
</a>
<? } ?>
</div>
</td>
<?php ?>
</tr>
</table>
<? } else { ?>
<?= ($i + 1) ?>
. -
<? } ?>
<? } ?>
</div>
<? } ?>
<? } else if ($order['order_type'] == 'try' || $order['order_type'] == 'course') { ?>
<? foreach ($rows_detail as $i => $row_detail) {
$end_datetime = new DateTime($row_detail['datetime']);
if ($order['order_type'] == 'try') {
$end_datetime->modify("+" . $order['course_length'] . " minute");
} else {
$end_datetime->modify("+" . $row_job['course_hours'] . " minute");
}
?>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="100%">
<div>
<?= ($i + 1) ?>
.
<?= $row_detail['datetime'] . " 至 " . $end_datetime->format("Y-m-d H:i:s") ?>
</div>
</td>
<?php ?>
<td>
<div class="orderdetailbtn">
<? if ($order['status'] == 'paid') { ?>
<a href="course_form.php?id=<?= $row_detail['id'] ?>" class="btn <? if ($row_detail['student_status'] == 1) { ?><? if ($row_detail['solution_status'] == 1) { ?>btn-success<? } else { ?>btn-warning<? } ?><? } elseif ($row_detail['tutor_status'] == 1) { ?>btn-success<? } else { ?>btn-default<? } ?>"><i class="fa fa-link" aria-hidden="true"></i>
課堂資料
<? if ($row_detail['student_status'] == 1) { ?>
(已投訴)
<? if ($row_detail['solution_status'] == 1) { ?>
(已解決)
<? } ?>
<? } elseif ($row_detail['tutor_status'] == 1) { ?>
(已上課)
<? } ?>
</a>
<? } ?>
</div>
</td>
<?php ?>
</tr>
</table>
<? } ?>
<? } ?>
</div>
</td>
</tr>
<? } ?>
<?
if ($order['order_type'] == 'formal') {
$sql = "select mas_instrument from student_postjob as tt where id = ? and deleted = ?";
$parameters = array($order['job_id'], 0);
$row_job = bind_pdo($sql, $parameters, "selectone");
if ($order['course_venus'] == 6) {
$sql = "select studenhome_addcharge as fee from tutor_teachareacode as tt where mas_teachareacode = ? and tutormain_id = ? and deleted = ?";
$parameters = array($order['mas_residencecode'], $order['tutormain_id'], 0);
$row_addcharge = bind_pdo($sql, $parameters, "selectone");
}
$sql = "select id from tutor_charge as tt where tutormain_id = ? and mas_instrument = ? and deleted = ?";
$parameters = array($order['tutormain_id'], $row_job['mas_instrument'], 0);
$row_charge = bind_pdo($sql, $parameters, "selectone");
$sql = "select charge_" . $order['course_length'] . "min as fee from tutor_expectcharge where type = ? and charge_id = ? and grade = ? and deleted = ?";
$parameters = array('tfee', $row_charge['id'], $order['level'], 0);
$row_expectcharge = bind_pdo($sql, $parameters, "selectone");
$jsonReturnArr['fee_min'] = (intval($row_expectcharge['fee']) + intval($row_addcharge['fee'])) * 0.8;
$jsonReturnArr['fee_max'] = (intval($row_expectcharge['fee']) + intval($row_addcharge['fee'])) * 1.2;
}
?>
<? if ($order["order_type"] != 'course') { ?>
<tr>
<td width="120" align="right" valign="top" class=''>每堂上課費用
<? if ($row_profile['profile_id'] == 3) { ?>
<br>
($
<?= $jsonReturnArr['fee_min'] ?>
~ $
<?= $jsonReturnArr['fee_max'] ?>
)
<? } ?></td>
<td width="5" valign="top" class=''>: </td>
<td class=''>
<div class="col-sm-4 form-group">
<? if ($order['order_type'] == 'formal' && $order['status'] == 'process' && $_SESSION["is_tutor"] == 1) { ?>
$
<input type="text" class="form-control" name="fee" value="<?= $order['fee'] ? intval($order['fee']) : '' ?>" style="width:50%; display:inline-block;" min="<?= $jsonReturnArr['fee_min'] ?>" max="<?= $jsonReturnArr['fee_max'] ?>">
<br>
<font color="#0012ff" style="font-size:12px; ">每堂學費按導師於iMusicCircle內所訂立的收費作指標,導師可按個別學生的情況調整學費,調整幅度為
+/- 20%。我們建議導師先跟學生議定價格。</font>
<div style="color:#F00; display:none;" class="error" id="feeError">
請輸入每堂收費
</div>
<div style="color:#F00; display:none;" class="error" id="feeError2">
請輸入每堂收費不能少於<span></span></div>
<div style="color:#F00; display:none;" class="error" id="feeError3">
請輸入每堂收費不能多於<span></span></div>
<div style="color:#F00; display:none;" class="error" id="feeError4">
請先選擇地區/地方/級數/時間長度
</div>
<? } else { ?>
$<?= intval($order['fee']) ?>
<? } ?>
</div>
</td>
</tr>
<? } ?>
<? if ($order['order_type'] == 'try') { ?>
<tr>
<td width="120" align="right" valign="top" class=''>每堂上門附加費</td>
<td width="5" valign="top" class=''>: </td>
<td class=''>
<div class="col-sm-12 form-group"> $
<?= intval($order['extra_fee']) ?>.00
</div>
</td>
</tr>
<? } ?>
<tr>
<td width="120" align="right" valign="top" class=''>總費用</td>
<td width="5" valign="top" class=''>: </td>
<td class=''>
<div class="col-sm-12 form-group" id="totalbox">
<? if ($row_profile['profile_id'] != 3) { ?>
<span <? if (intval($order['admin_fee'])) { ?> style="text-decoration:line-through;"<? } ?>>
<? if (intval($order['coupon_fee']) > 0) { ?>
<span style="text-decoration:line-through;">
$<?= intval($order['total_fee']) ?>.00</span><? } ?>
$<?= intval($order['total_fee']) - intval($order['coupon_fee']) ?>
.00 </span>
<? } else { ?>
<span> $<?= intval($order['total_fee']) ?>
</span>
<? } ?>
</div>
</td>
</tr>
<? if ((intval($order['admin_fee']) == 0 && $order['order_type'] == 'try') || $order['order_type'] == 'formal') { ?>
<? if ($row_profile['profile_id'] != 3 && ($order['order_type'] == 'try' || $order['order_type'] == 'formal')) { ?>
<? /*if ($order['status'] == 'approved' || $order['status'] == 'paid') { ?>
<tr>
<td width="120" align="right" valign="top" class=''>優惠劵</td>
<td width="5" valign="top" class=''>: </td>
<td class=''>
<? if ($order['status'] == 'paid') { ?>
<div class="col-sm-12 form-group">
$ <?= $order['coupon_fee'] ?> (<?= $order['coupon_code'] ?>)
</div>
<? } else if ($order['status'] == 'approved') { ?>
<div class="col-sm-2 form-group" id="couponbox2" <? if (!$order['coupon_code']){ ?>style="display:none;"<? } ?>>
- $ <span>
<?= intval($order['coupon_fee']) ?>
</span></div>
<div id="couponbox1" <? if ($order['coupon_code']){ ?>style="display:none;"<? } ?>>
<div class="col-sm-2 form-group">
<input name="coupon" class="form-control" placeholder="如有" value="" maxlength="10">
<div style="color:#F00; display:none;" class="error" id="couponError">
<?= _lang('請輸入正確的優惠劵號碼') ?>
</div>
<div style="color:#F00; display:none;" class="error" id="couponError2">
*$20優惠已滿額,多謝支持。有興趣學習音樂的同學,可以輸入 "INKY50"
以半價體驗兩堂音樂班。
</div>
</div>
<button type="button" class="btn btn-block btn-success " id="LiCouponBtn">
<i class="glyphicon glyphicon-ok-sign" aria-hidden="true"></i>
<?= _lang('確認優惠劵') ?>
</button>
</div>
<? } ?>
</td>
</tr>
<? } */?>
<? } ?>
<? } ?>
<? if ($row_profile['profile_id'] == 1 || $row_profile['profile_id'] == 2) { ?>
<tr>
<td width="120" align="right" valign="top" class=''>調整價格</td>
<td width="5" valign="top" class=''>: </td>
<td class=''>
<div class="col-sm-4 form-group">$
<input type="text" class="form-control" name="admin_fee" style="width:90%; display:inline-block;" value="<?= $order['admin_fee'] ?>">
</div>
</td>
</tr>
<? } ?>
</table>
<!-- End Content -->
<br><br><br><br>
</div>
<!-- /.box-body -->
</div>
<!-- /.box -->
</div>
<!-- /.col -->
</div>
<!-- /.row -->
</form>
</div>
</div>
</div>
</div>
<? include('_footer.php') ?>
<script type="text/javascript" src="webadmin/js/jquery-ui-1.11.4/jquery-ui.min.js"></script>
<link rel="stylesheet" href="webadmin/js/jquery-ui-1.11.4/jquery-ui.min.css">
<script type="text/javascript" src="webadmin/js/jquery-ui-sliderAccess.js"></script>
<script type="text/javascript" src="webadmin/js/jquery-ui-timepicker-addon.js"></script>
<link type="text/css" href="webadmin/css/jquery-ui-timepicker-addon.css" rel="stylesheet"/>
<script type="text/javascript">
$(function () {
var opt = {
//
dayNames: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"],
dayNamesMin: ["日", "一", "二", "三", "四", "五", "六"],
monthNames: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
monthNamesShort: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
prevText: "上月",
nextText: "次月",
weekHeader: "週",
timeOnlyTitle: "選擇時分秒",
timeText: "時間",
hourText: "時",
minuteText: "分",
secondText: "秒",
millisecText: "毫秒",
timezoneText: "時區",
currentText: "現在時間",
closeText: "確定",
amNames: ["上午", "AM", "A"],
pmNames: ["下午", "PM", "P"],
//
dateFormat: 'yy-mm-dd',
stepMinute: 5,
minDate: new Date(2016, 9, 1),
timeFormat: 'HH:mm:ss',
hourMin: 9,
hourMax: 22,
//minDate: 0
};
$(".datetimepicker").datetimepicker(opt);
});
</script>
<script type="text/javascript">
function printDiv(divName) {
$('.orderdetailbtn').hide();
var printContents = document.getElementById(divName).innerHTML;
var originalContents = document.body.innerHTML;
document.body.innerHTML = printContents;
window.print();
$('.orderdetailbtn').show();
document.body.innerHTML = originalContents;
}
function submitfrom() {
var table = $('#myform');
var error = false;
$('.error').hide();
<? if($order['status'] != 'paid' && ($row_profile['profile_id'] == 1 || $row_profile['profile_id'] == 2)){ ?>
if (error == false) {
table.submit();
}
<? }else{ ?>
<? if($order['status'] == 'paid'){?>
$('.datetimepicker').each(
function (index) {
var value = $(this).val();
var count = 0;
if (!$(this).val()) {
$('#dateError' + index + '_1').show();
error = true;
} else {
$('.datetimepicker').each(
function () {
if (value == $(this).val()) {
count++;
}
}
);
if (count > 1) {
$('#dateError' + index + '_2').show();
error = true;
}
}
}
);
if (error == false) {
table.submit();
}
<? }else if($order['status'] == 'process'){?>
<?php if($order["order_type"] == "formal"){ ?>
if (!$('input[name="fee"]', table).val()) {
error = true;
$('#feeError', table).show();
} else {
if (!($('input[name="fee"]', table).attr('min') && $('input[name="fee"]', table).attr('max'))) {
error = true;
$('#feeError4', table).show();
} else {
if (Number($('input[name="fee"]', table).val()) < Number($('input[name="fee"]', table).attr('min'))) {
error = true;
$('#feeError2 span', table).html($('input[name="fee"]', table).attr('min'));
$('#feeError2', table).show();
} else if (Number($('input[name="fee"]', table).val()) > Number($('input[name="fee"]', table).attr('max'))) {
error = true;
$('#feeError3 span', table).html($('input[name="fee"]', table).attr('max'));
$('#feeError3', table).show();
}
}
}<?php } ?>
if (error == false) {
table.submit();
}
<? }?>
<? }?>
return false;
}
$('input[name="fee"]').change(
function () {
$('#totalbox span').html($('input[name="fee"]').val() *<?= $order['course_count'] ?>);
}
);
$('#LiCouponBtn').click(
function () {
var error = false;
$('#couponError').hide();
$('#couponError2').hide();
if (!$('input[name="coupon"]').val()) {
error = true;
$('#couponError').show();
}
if (error == false) {
var coupon_code = $('input[name="coupon"]').val();
jQuery.ajax({
url: '_ajax.php',
type: 'POST',
data: {
ajax: "coupon",
id: <?=$order['id']?>,
limit_type: '<?=$order["order_type"] == 'formal' ? 'normal' : 'try'?>',
coupon: coupon_code
},
dataType: 'html', //dataType (default: Intelligent Guess (xml, json, script, or html))
timeout: 1000,
error: function (result) {
//alert('Error Occur. Please try again.');
//console.log(result.responseText);
},
success: function (json) {
var json = JSON.parse(json);
if (json.status == false) {
if (coupon_code.toUpperCase() == "INKY20" || coupon_code.toUpperCase() == "IMC$20") {
$('#couponError2').show();
} else {
$('#couponError').show();
}
} else if (json.status == true) {
location.reload();
return;
$('#totalbox span').html(json.total);
$('#couponbox2').show();
$('#couponbox2 span').html(json.discount);
$('#couponbox1').hide();
}
console.log(json);
}
});
}
}
);
</script>
</body>
</html>