public function actionOrdershow()
 {
     $orderFactory = OrderFactory::getinstance();
     $itemFactory = ItemFactory::getinstance();
     $res = $orderFactory->showTodayOrder();
     $resitem = $itemFactory->findItemName();
     return $this->render('ordershow', ['res' => $res, 'resitem' => $resitem]);
 }
 public function itemFullPrice($order_id)
 {
     $allPrice = 0;
     $item = Item::getinstance();
     $orderFactory = OrderFactory::getinstance();
     $res = $orderFactory->getAll($order_id);
     // print_r($res);
     foreach ($res as $value) {
         $itemFactory = ItemFactory::getinstance();
         $itemPrice = $itemFactory->getPrice($value['item_id']);
         $allPrice += (int) $itemPrice * (int) $value['number'];
     }
     return $allPrice;
 }
Example #3
0
<table class="table">
   <caption>今日订单</caption>
   <thead>
      <tr>
         <th>订单号</th>
         <th>菜品</th>
         <th>数量</th>
      </tr>
   </thead>
   <tbody>
   <p></p>
<?php 
$datetime = date('ymd');
$itemqian = $datetime . '000';
foreach ($res as $value) {
    $itemFactory = ItemFactory::getinstance();
    $itemname = $itemFactory->whichname($value['item_id']);
    if ($value['order_id'] == $itemqian) {
        ?>
						<tr><td></td><td><?php 
        echo $itemname;
        ?>
</td><td><?php 
        echo $value['number'];
        ?>
</td></tr>
		<?php 
    } else {
        //调用工厂类
        $allPrice = $itemFactory->itemFullPrice($value['order_id']);
        ?>