예제 #1
0
 public function actionIndex()
 {
     $y = date('Y');
     $m = date('m');
     if (!empty($_POST)) {
         $y = $_POST['year'];
         $m = $_POST['month'];
     }
     $params = [':y' => $y, ':m' => $m];
     $conditions = "\n      YEAR(pay_date) = :y \n      AND MONTH(pay_date) = :m \n      AND status = 'pay'\n    ";
     $billOrder = new BillOrder();
     $year_list = [];
     $month_list = [];
     // year list
     $start_year = date('Y');
     for ($i = $start_year - 1; $i <= $start_year; $i++) {
         $year_list[$i] = $i;
     }
     // month list
     for ($i = 1; $i <= 12; $i++) {
         $month_list[$i] = $i;
     }
     $orderDetails = BillOrderDetail::find()->leftJoin('bill_orders', 'bill_orders.id = bill_order_details.bill_order_id')->where($conditions, $params)->orderBy('bill_order_details.id DESC')->all();
     return $this->render('//Report/Index', ['n' => 1, 'y' => $y * 1, 'm' => $m * 1, 'billOrderDetails' => $orderDetails, 'billOrder' => $billOrder, 'year_list' => $year_list, 'month_list' => $month_list]);
 }
예제 #2
0
 public function actionDetail($id)
 {
     $billOrder = BillOrder::findOne($id);
     $billOrderDetails = BillOrderDetail::find()->where(['bill_order_id' => $id])->orderBy('id DESC')->all();
     return $this->render('//Order/Detail', ['billOrder' => $billOrder, 'billOrderDetails' => $billOrderDetails, 'n' => 1]);
 }
예제 #3
0
    ?>
    </h4>
    <table style="margin-bottom: 50px" class="table table-bordered table-striped">
      <thead>
        <tr>
          <th width="40px" style="text-align: right">no</th>
          <th width="100px">code</th>
          <th>name</th>
          <th width="80px" style="text-align: right">price</th>
          <th width="80px" style="text-align: right">qty</th>
          <th width="100px" style="text-align: right">total</th>
        </tr>
      </thead>
      <tbody>
        <?php 
    $billOrderDetails = BillOrderDetail::find()->where(['bill_order_id' => $billOrder->id])->orderBy('id DESC')->all();
    $n = 1;
    ?>

        <?php 
    foreach ($billOrderDetails as $billOrderDetail) {
        ?>
        <?php 
        $total = $billOrderDetail->price * $billOrderDetail->qty;
        $sumQty += $billOrderDetail->qty;
        $sumPrice += $total;
        ?>
        <tr>
          <td style="text-align: right"><?php 
        echo $n++;
        ?>