public function actionIndex()
 {
     $period = new Backend_period();
     $data['model'] = $period;
     $data['result'] = $period->get_period();
     $this->render('//backend/period/index', $data);
 }
 public function actionLogin()
 {
     $email = $_POST['login_email'];
     $password = $_POST['login_password'];
     $use = new User();
     $result = $use->Check_user($email, $password);
     if (!empty($result)) {
         $Order = new Orders();
         $period_model = new Backend_period();
         $Config = new Configweb_model();
         $row = $result;
         $user = $row['name'] . ' ' . $row['lname'];
         $status = $row['status'];
         $pid = $row['pid'];
         Yii::app()->session['username'] = $user;
         Yii::app()->session['status'] = $status;
         Yii::app()->session['pid'] = $pid;
         //เก็บค่าประวัติทั้งหมดไว้ใน session
         Yii::app()->session['member'] = $row;
         //เช็คออเดอร์ที่ไม่ชำระเงินตามระยะเวลาที่กำหนด
         $period = $period_model->get_period_active();
         $overtime = $Order->check_order_overtime($pid);
         if (!empty($overtime)) {
             //เช็ควันที่เกิน
             $datenow = date("Y-m-d");
             foreach ($overtime as $over) {
                 $date_order = $over['order_date'];
                 $dayover = $Config->Datediff($date_order, $datenow);
                 $count_basket = $Order->check_product_inorder($over['order_id']);
                 if ($dayover > $period && $count_basket > 0) {
                     $orderId = $over['order_id'];
                     Yii::app()->db->createCommand()->delete("orders", "order_id = '{$orderId} '");
                 }
             }
         }
         //ดึงรหัสการสั่งซื้อมาแสดง
         $max_order_id = $Order->Get_status_last_order($pid);
         Yii::app()->session['order_id'] = $max_order_id;
         echo "success";
     } else {
         echo "nosuccess";
     }
 }
Exemple #3
0
<?php
$period = new Backend_period();
$period_active = $period->get_period_active();
$this->breadcrumbs = array(
    'สรุปรายการสั่งซื้อ',
);
?>

<div class="well" id="font-rsu-16" style=" font-weight: bold; background: #FFF; color: #ff3300;">
    <img src="<?php echo Yii::app()->baseUrl; ?>/images/notification-icon.png"/><br/>
    ระบบจะทำการล็อคสินค้าไว้ให้ท่านเป็นเวลา <?php if(!empty($period_active)){echo $period_active;} else { echo "3";}?> วัน<br/>
    หากท่านไม่ชำระเงินภายในระยะเวลาที่กำหนดระบบจะทำการลบรายการสั่งซื้อของท่าน<br/><br/>
    ท่านสามารถแจ้งการชำระเงินได้ที่เมนู "แจ้งชำระเงิน" หรือคลิกที่นี้
    <a href="<?php echo Yii::app()->createUrl('frontend/orders/Informpayment') ?>">
      <div class="btn btn-success btn-sm"><i class="fa fa-hand-o-up"></i> แจ้งการชำระเงิน</div>
    </a>
</div>
<div class="well" style=" background: #FFF;" id="font-18">
    <label id="font-rsu-20"><i class="fa fa-home"></i> ที่อยู่จัดส่ง</label><br/>
    <label>
        คุณ <?php echo $address['name'] . ' ' . $address['lname'] ?>
    </label>
    <br/><br/>
    <label>เลขที่</label> <?php echo $address['number'] ?>
    <label>อาคาร</label> <?php echo $address['building'] ?>
    <label>ชั้น</label> <?php echo $address['class'] ?>
    <label>ห้อง</label> <?php echo $address['room'] ?><br/>
    <label>ตำบล</label>  <?php echo $address['tambon_name'] ?><br/>
    <label>อำเภอ</label>  <?php echo $address['ampur_name'] ?><br/>
    <label>จังหวัด</label>  <?php echo $address['changwat_name'] ?><br/>
    <label>รหัสไปรษณีย์</label>  <?php echo $address['zipcode'] ?>