<?php
/**
 * 予約内容を表示する。
 * estimate, confirmで表示する。
 */
 
$reservation = $this->phpsession->get('reservation');
$reservation_detail = $this->phpsession->get('reservation_detail');
//var_dump($reservation_detail);
$reservation_options = $this->phpsession->get('reservation_options');
?>
<table class="inp">
<tr><th width="200px">チェックイン :</th>
<td>
<?php
$s_cin = $reservation['cin'];
echo $s_cin;
echo ' (' . $this->Common_model->week($s_cin) . ')';
?>
</td></tr>
<tr><th>チェックアウト :</th>
<td>
<?php
$s_cout = $reservation['cout'];
echo $s_cout;
echo ' (' . $this->Common_model->week($s_cout) . ')';
?></td>
</tr>

<tr><th>宿泊日数 :</th>
<td>
<?php
echo $reservation['stay_days'] . ' 日';
?>
</td></tr>

<tr>
<th>プラン :</th>
<td><?php echo $plan_name ?></td>
</tr>
<tr><th>部屋タイプ :</th>
<td>
<?php echo $roomtype_name . ' (' . $roomtypes_guest_min . '～' . $roomtypes_guest_max . '人)'; ?>
</td></tr>
<tr>
<th>部屋数 :</th>
<td><?php echo $reservation['room_num'] . '部屋'; ?></td>
</tr>
<tr>
<th>人数 :</th>
<td>
<?php
$reservation_detail_1 = null;
foreach ($reservation_detail as $tmp)
{
    $reservation_detail_1 = $tmp;
    break;
}
$i = 0;
foreach ($reservation_detail_1 as $tmp)
{
    echo $i + 1 . '部屋目' . "<br />\n";
    
    foreach ($tmp as $tmp2)
    {
        //echo "guestypeid=" . $tmp2['guesttypeid'] . ",\n";
        echo $tmp2['guesttype_name'] . " : ";
        echo $tmp2['num'] . "人<br />\n";
    }
    $i++;
}
//for ($i = 0; $i < $reservation['room_num']; $i++)
//{
//    $room_i = $resrooms[$i];
//    
//    echo $i + 1 . '部屋目' . "<br />\n";
//    if ($room_i['basic_num'] > 0)
//    {
//        echo "大人:"  . $room_i['basic_num']  . "人&nbsp;";
//    }
//    echo "<br />\n";
//}
?></td>
</tr>
<tr>
<th>料金 :</th>
<td>
<?php
$i = 0;
foreach ($reservation_detail as $tmp)
{
    echo $i + 1 . '日目' . "<br />\n";
    
    $j = 0;
    foreach ($tmp as $tmp2)
    {
        echo $j + 1 . '部屋目' . "<br />\n";
        foreach ($tmp2 as $tmp3)
        {
            //echo "guestypeid=" . $tmp3['guesttypeid'] . " : ";
            echo $tmp3['guesttype_name'] . " : ";
            echo $tmp3['num'] . "人 x ";
            echo number_format($tmp3['price']) . "円 = ";
            echo number_format($tmp3['subtotal']) . "円<br />\n";
        }
        $j++;
    }
    $i++;
}
?>
</td>
</tr>

<?php
if (count($reservation_options) > 0) {
?>

<tr>
<th>オプション :</th>
<td>
<?php
//var_dump($reservation_options);
$i = 0;
foreach ($reservation_options as $key => $value)
{
    echo $i + 1 . '日目' . "<br />\n";
    //echo $key . "<br />\n";
    foreach ($value as $key2 => $value2)
    {
        if ($value2['num'] > 0)
        {
            echo $value2['option_name'] . ':';
            echo number_format($value2['price']) . '円' . " x ";
            echo $value2['num'] . " " . $value2['unitname'] . " = ";
            $option_subtotal = $value2['price'] * $value2['num'];
            echo number_format($option_subtotal) . '円' . "<br />\n";
        }
    }
    $i++;
}
?>
</td></tr>

<?php
}
?>

<tr>
<th>合計 :</th>
<td>
<?php echo number_format($reservation['total_price']) . "円"; ?>
</td>
</tr>
</table>
