<?php
include(dirname(__FILE__) . '/../header.php');
?>
<h2>予約詳細</h2>

<table class="inp">
<tr><th width="240px">予約日 :</th>
<td><?php echo $created ?></td></tr>
<tr><th>予約id / コード :</th>
<td><?php echo $resid . '/' . $rescode ?></td></tr>
<tr><th>ステータス :</th>
<td>
<?php
if ($status == 1) { echo '仮予約'; }
else if ($status == 2) { echo '本予約'; }
else if ($status == 0) { echo 'キャンセル'; }
if ($status == 1 || $status == 2)
{
    echo '&nbsp;(';
    if ($status == 1)
    {
        // 仮予約 -> 本予約
        echo '<a href="' . site_url('admin/res/changeStatus/' . $hotelid . '/' . $resid . '/2') . '">→本予約<a/>';
        echo '&nbsp;';
    }
    echo '&nbsp;';
    if ($status == 1 || $status == 2)
    {
        // -> キャンセル
        echo '<a href="' . site_url('admin/res/changeStatus/' . $hotelid . '/' . $resid . '/0') . '">→キャンセル<a/>';
    }
    echo ')';
}
?>
</td></tr>
<tr><th>チェックイン～チェックアウト :</th>
<td>
<?php
echo $cin;
echo '(' . $this->Common_model->week($cin) . ')';
echo '～';
echo $cout;
echo '(' . $this->Common_model->week($cout) . ')';
?>
</td></tr>
<tr><th>プラン :</th>
<td><?php echo $plan_name ?></td></tr>
<tr><th>部屋タイプ :</th>
<td><?php echo $roomtype_name ?></td></tr>
<tr><th>部屋数 :</th>
<td><?php echo $room_num . '部屋'; ?></td></tr>
<tr><th>人数 :</th>
<td>
<?php 
foreach ($resrooms as $resroom)
{
    //var_dump($resroom);
    
    echo $resroom['room_no'] . '部屋目' . "<br />\n";
    if ($resroom['basic_num'] > 0)
    {
        echo "大人:"  . $resroom['basic_num']  . "人&nbsp;";
    }
    if ($resroom['child1_num'] > 0)
    {
        echo "子供A:" . $resroom['child1_num'] . "人&nbsp;";
    }
    if ($resroom['child2_num'] > 0)
    {
        echo "子供B:" . $resroom['child2_num'] . "人&nbsp;";
    }
    if ($resroom['child3_num'] > 0)
    {
        echo "子供C:" . $resroom['child3_num'] . "人&nbsp;";
    }
    if ($resroom['child4_num'] > 0)
    {
        echo "子供D:" . $resroom['child4_num'] . "人";
    }
    echo "<br />\n";
}
?></td></tr>
<tr><th>料金 :</th>
<td>
<?php
//var_dump($resrooms);
$strDay = '';
foreach ($resrooms as $room_i)
{
    if ($strDay != $room_i['day'])
    {
        echo $room_i['day'] . "<br />\n";
        $strDay = $room_i['day'];
    }
    echo $room_i['room_no'] . '部屋目' . "<br />\n";
    if ($room_i['basic_num'] > 0)
    {
        echo "大人:"  . $room_i['basic_num']  . "人&nbsp;";
        $temp = $room_i['basic_num'] * $room_i['basic_price'];
        echo $room_i['basic_num'] . '人 x ' . number_format($room_i['basic_price']) . '円 = ' . number_format($temp) . '円' . "<br />\n";
    }
    if ($room_i['child1_num'] > 0)
    {
        echo "子供A:" . $room_i['child1_num'] . "人&nbsp;";
        $temp = $room_i['child1_num'] * $room_i['child1_price'];
        echo $room_i['child1_num'] . '人 x ' . number_format($room_i['child1_price']) . '円 = ' . number_format($temp) . '円' . "<br />\n";
    }
    if ($room_i['child2_num'] > 0)
    {
        echo "子供B:" . $room_i['child2_num'] . "人&nbsp;";
        $temp = $room_i['child2_num'] * $room_i['child2_price'];
        echo $room_i['child2_num'] . '人 x ' . number_format($room_i['child2_price']) . '円 = ' . number_format($temp) . '円' . "<br />\n";
    }
    if ($room_i['child3_num'] > 0)
    {
        echo "子供C:" . $room_i['child3_num'] . "人&nbsp;";
        $temp = $room_i['child3_num'] * $room_i['child3_price'];
        echo $room_i['child3_num'] . '人 x ' . number_format($room_i['child3_price']) . '円 = ' . number_format($temp) . '円' . "<br />\n";
    }
    if ($room_i['child4_num'] > 0)
    {
        echo "子供D:" . $room_i['child4_num'] . "人";
        $temp = $room_i['child4_num'] * $room_i['child4_price'];
        echo $room_i['child4_num'] . '人 x ' . number_format($room_i['child4_price']) . '円 = ' . number_format($temp) . '円' . "<br />\n";
    }
}
?>
</td>
</tr>

<tr><th>合計 :</th>
<td><?php echo number_format($total_price) . '円' ?></td></tr>
<tr><th>チェックイン時刻 :</th>
<td><?php echo substr($cinhour, 0, 5); ?></td></tr>
<tr><th>備考 :</th>
<td><?php echo $memo; ?></td></tr>

</table>
<br />
<table class="inp">
<tr><th width="240px">氏名（かな） :</th>
<td><?php echo $name . '（' . $name_kana . '）' ?></td></tr>
<tr><th>住所 :</th>
<td>
<?php
echo '〒' . $postcode . "<br />";
echo $prefecture . ' ' . $city;
?></td></tr>
<tr><th>電話 :</th>
<td>
<?php echo $phone; ?></td></tr>
<tr><th>Eメールアドレス :</th>
<td>
<?php echo $email; ?></td></tr>

</table>
<?php
echo '<a href="' . site_url('admin/res/index/' . $hotelid) . '">予約リストに戻る<a/>';
?>

<?php
include(dirname(__FILE__) . '/../footer.php');
?>
