Example #1
0
 private function actionAddeditems($added_items, $booking_id)
 {
     for ($i = 0; $i < sizeof($added_items); $i++) {
         foreach ($added_items[$i] as $key => $val) {
             $item = \app\models\Bookingitems::find()->where(['idBooking' => $booking_id, 'idItem' => (int) $key])->one();
             if (empty($item)) {
                 $item = new \app\models\Bookingitems();
             }
             $item->idBooking = $booking_id;
             $item->idItem = (int) $key;
             $item->quantity = $val;
             $item->save();
         }
     }
 }
Example #2
0
        <?php 
foreach ($model as $m) {
    ?>
            <tr>
                <td>
                    <?php 
    $customer = app\models\Customers::findOne($m->idCustomer);
    ?>
                    <?php 
    echo $customer->firstname . " " . $customer->lastname;
    ?>
                </td>
                <td class="container-td">
                    <table cellpading="0" cellspacing="0">
                        <?php 
    $booked_items = app\models\Bookingitems::find()->where(['idBooking' => $m->id])->all();
    ?>
                    <?php 
    $price = 0;
    foreach ($booked_items as $bi) {
        ?>
                        <?php 
        $item = app\models\Items::findOne($bi->idItem);
        ?>
                        <tr>
                            <td><?php 
        echo $item->name . " " . $item->dimensions;
        ?>
</td>
                            <td><?php 
        echo $bi->quantity;