Esempio n. 1
0
    public function renderCRTypeDashboard()
    {
        $model = new Order ( 'search' );
        $model->unsetAttributes();  // clear any default values
        $model->splsearch = Helper::CONST_Tomorrow;
        $model->hdnactionname = Helper::CONST_indexactionid;

        $timeslotmodel = new Persontimeslot;
        $timeslotmodel->unsetAttributes();
        $timeslotmodel->slotdate = $model->splsearch;

        if ( isset( $_GET['Order'] ) )
        {
            $model->attributes = $_GET['Order'];
            $timeslotmodel->slotdate = $model->splsearch;
        }
        $options = $this->prepareOrderGridOptions($model->hdnactionname, 
                Helper::CONST_grid_Height_200);
        $this->render( $this->getView('index','index'),
                        array(
                            'model' => $model,
                            'origin' => $model->hdnactionname,
                            'options'=> $options,
                            'fromdb' => true,
                            'timeslotmodel' => $timeslotmodel,
                            )
                    );
    }
Esempio n. 2
0
	public function actionList()
	{
		$pid = 5;//支付状态
		$start = '';//开始时间
		$stop = '';//结束时间
		$model=new Order();
		//计算总共有几个订单
		$allcount = $model->count(array('condition'=>'updatetime<>0'));
		
		$model->unsetAttributes();  // clear any default values
		if(isset($_GET['pay_way'])){
			//$model->attributes=$_GET['Order'];
			$pid = $_GET['pay_way'];
		}
		
		if(isset($_GET['start'])){
			$start = $_GET['start'];
		}
		
		if(isset($_GET['stop'])){
			$stop = $_GET['stop'];
		}
		
		Yii::app()->session['myurl'] = $this->createUrl('list');
		$this->render('list',array(
			'model'=>$model,
			'pid'=>$pid,
			'start'=>$start,
			'stop'=>$stop,
				'allcount'=>$allcount,
		));
	}
Esempio n. 3
0
 /**
  * Update order
  * @param bool $new
  * @throws CHttpException
  */
 public function actionUpdate($new = false)
 {
     if (SLicenseChecker::check() === false && SLicenseChecker::isOnLocalhost() === false) {
         throw new CHttpException(404, 'В ознакомительной версии редактирование заказов недоступно.');
     }
     if ($new === true) {
         $model = new Order();
         $model->unsetAttributes();
     } else {
         $model = $this->_loadModel($_GET['id']);
     }
     if (Yii::app()->request->isPostRequest) {
         $model->attributes = $_POST['Order'];
         if ($model->validate()) {
             $model->save();
             // Update quantities
             if (sizeof(Yii::app()->request->getPost('quantity', array()))) {
                 $model->setProductQuantities(Yii::app()->request->getPost('quantity'));
             }
             $model->updateDeliveryPrice();
             $model->updateTotalPrice();
             $this->setFlashMessage(Yii::t('OrdersModule.admin', 'Изменения успешно сохранены'));
             if (isset($_POST['REDIRECT'])) {
                 $this->smartRedirect($model);
             } else {
                 $this->redirect(array('index'));
             }
         }
     }
     $this->render('update', array('deliveryMethods' => StoreDeliveryMethod::model()->applyTranslateCriteria()->orderByName()->findAll(), 'statuses' => OrderStatus::model()->orderByPosition()->findAll(), 'model' => $model));
 }
Esempio n. 4
0
 public function actionAdmin()
 {
     $model = new Order('search');
     $model->unsetAttributes();
     if (isset($_GET['Order'])) {
         $model->setAttributes($_GET['Order']);
     }
     $this->render('admin', array('model' => $model));
 }
 /**
  * Manages all models.
  */
 public function actionIndex()
 {
     $model = new Order('search');
     $model->unsetAttributes();
     // clear any default values
     if (isset($_GET['Order'])) {
         $model->attributes = $_GET['Order'];
     }
     $this->render('admin', array('model' => $model));
 }
 public function actionIndex()
 {
     $model = new Order('search');
     $model->unsetAttributes();
     // clear any default values
     if (Yii::app()->getRequest()->getQuery('Order')) {
         $model->setAttributes(Yii::app()->getRequest()->getQuery('Order'));
     }
     $this->render('index', ['model' => $model]);
 }
Esempio n. 7
0
 /**
  * This is the default 'index' action that is invoked
  * when an action is not explicitly requested by users.
  */
 public function actionIndex()
 {
     $this->breadcrumbs = array($this->ID . ' Manager' => array('index'));
     $this->pageTitle = "List of Order";
     $model = new Order('search');
     $model->unsetAttributes();
     if (isset($_GET['Order'])) {
         $model->attributes = $_GET['Order'];
     }
     $this->render($this->view . 'index', array('model' => $model));
 }
Esempio n. 8
0
 public function actionIndex()
 {
     $model = new Order('search');
     $model->unsetAttributes();
     if ($_GET['Order']) {
         $model->attributes = $_GET['Order'];
     }
     $users = Order::model()->getUser();
     $amount = Order::model()->getAmount();
     $this->render('index', ['model' => $model, 'users' => $users, 'amount' => $amount]);
 }
Esempio n. 9
0
 /**
  * list data order
  */
 public function actionAdmin()
 {
     /* untuk cek login admin */
     IsAuth::Admin();
     /* panggil model order dan function search */
     $model = new Order('search');
     /* clear semua default value attributes */
     $model->unsetAttributes();
     /* jika data order dikirim
      * sebagai kriteria pencarian */
     if (isset($_GET['Order'])) {
         /* set nilai attributes 
          * untuk pencarian data order */
         $model->attributes = $_GET['Order'];
     }
     /* render file views/orders/admin */
     $this->render('admin', array('model' => $model));
 }
Esempio n. 10
0
 /**
  * Manages all models.
  */
 public function actionAdmin()
 {
     unset(Yii::app()->request->cookies['from_date']);
     // first unset cookie for dates
     unset(Yii::app()->request->cookies['to_date']);
     $model = new Order('search');
     $model->unsetAttributes();
     // clear any default values
     if (!empty($_POST)) {
         Yii::app()->request->cookies['from_date'] = new CHttpCookie('from_date', $_POST['from_date']);
         // define cookie for from_date
         Yii::app()->request->cookies['to_date'] = new CHttpCookie('to_date', $_POST['to_date']);
         $model->from_date = $_POST['from_date'];
         $model->to_date = $_POST['to_date'];
     }
     if (isset($_GET['Order'])) {
         $model->attributes = $_GET['Order'];
     }
     $this->render('admin', array('model' => $model));
 }
Esempio n. 11
0
 /**
  * Update order
  * @param bool $new
  * @throws CHttpException
  */
 public function actionUpdate($new = false)
 {
     Yii::app()->clientScript->registerScriptFile($this->module->assetsUrl . '/admin/orders.update.js', CClientScript::POS_END);
     if ($new === true) {
         $model = new Order();
         $model->unsetAttributes();
     } else {
         $model = $this->_loadModel($_GET['id']);
     }
     if (!$model->isNewRecord) {
         $update = Yii::t('CartModule.admin', 'UPDATE_ORDER', array('{order_id}' => CHtml::encode($model->id)));
     }
     $this->pageName = $model->isNewRecord ? Yii::t('CartModule.admin', 'Создание заказа') : Yii::t('CartModule.admin', 'ORDER', 0);
     $this->breadcrumbs = array(Yii::t('CartModule.admin', 'ORDER', 0) => $this->createUrl('index'), $model->isNewRecord ? Yii::t('CartModule.admin', 'Создание заказа') : $update);
     if (Yii::app()->request->isPostRequest) {
         $model->attributes = $_POST['Order'];
         if ($model->validate()) {
             $model->save();
             // Update quantities
             if (sizeof(Yii::app()->request->getPost('quantity', array()))) {
                 $model->setProductQuantities(Yii::app()->request->getPost('quantity'));
             }
             $model->updateDeliveryPrice();
             $model->updateTotalPrice();
             if ($model->isNewRecord === false) {
                 $template[] = 'delete';
             }
             // register all delivery methods to recalculate prices
             Yii::app()->clientScript->registerScript('deliveryMetohds', strtr('var deliveryMethods = {data};', array('{data}' => CJavaScript::jsonEncode($deliveryMethods))), CClientScript::POS_END);
             ///  if ($new) {
             //      $this->setFlashMessage(Yii::t('core', 'Теперь Вы можете добавить товары.'));
             //}
             $this->redirect(array('update', 'id' => $model->id));
         }
     }
     $this->render('update', array('deliveryMethods' => ShopDeliveryMethod::model()->applyTranslateCriteria()->orderByName()->findAll(), 'paymentMethods' => ShopPaymentMethod::model()->findAll(), 'statuses' => OrderStatus::model()->orderByPosition()->findAll(), 'model' => $model));
 }
Esempio n. 12
0
	public function actionRecord($id)
	{
		$model=new Order('search');
		$model->unsetAttributes();  // clear any default values
		$model->mid = $id;
		if(isset($_GET['Order']))
			$model->attributes=$_GET['Order'];
		
		$this->render('record',array(
				'model'=>$model,
		));
	}
Esempio n. 13
0
 /**
  * Manages all models.
  */
 public function actionAdmin()
 {
     $model = new Order('search');
     $model->unsetAttributes();
     $users = new Users('search');
     $users->unsetAttributes();
     if (isset($_GET['Users'])) {
         $users->attributes = $_GET['Users'];
     }
     if (isset($_GET['Order'])) {
         $model->attributes = $_GET['Order'];
     }
     $this->render('admin', array('model' => $model, 'users' => $users));
 }
Esempio n. 14
0
 public function actionViewAssignedOrders()
 {
     $model = new Order('viewAssignedOrders');
     $model->unsetAttributes();
     // clear any default values
     if (isset($_GET['Order'])) {
         $model->attributes = $_GET['Order'];
     }
     if (isset($_GET['pageSize'])) {
         Yii::app()->user->setState('pageSize', (int) $_GET['pageSize']);
         unset($_GET['pageSize']);
     }
     $this->render('viewAssignedOrders', array('model' => $model));
 }
Esempio n. 15
0
 /**
  * Manages all models.
  */
 public function actionAdmin()
 {
     $model = new Order( 'search' );
     $model->unsetAttributes();  // clear any default values
     $this->subTitle = ucwords( $this->action->id ) . ' ' . $this->getMenuLabels( ucwords( $this->controllerID ) );
     if ( isset( $_GET['Order'] ) )
         $model->attributes = $_GET['Order'];
        if(!empty( $_GET['actionid'] ) && $_GET['actionid'] == Helper::CONST_PDF)
         {
             $html = $this->renderPartial( 'admin', array(
                         'model' => $model,
                     ),true );
             
             $this->writeToPdf( $html );
         }
         else
         {
     $this->render( 'admin', array(
         'model' => $model,
     ) );
         }
 }
Esempio n. 16
0
 public function actionCancel()
 {
    $model = new Order( 'cancel' );
     $model->unsetAttributes();  // clear any default values
     if ( isset( $_GET['Order'] ) )
         $model->attributes = $_GET['Order'];
     if(!empty( $_GET['actionid'] ) && $_GET['actionid'] == Helper::CONST_PDF)
     {
         $html = $this->renderPartial( Helper::CONST_cancel, array(
                     'model' => $model,
                 ),true );
         
         $this->writeToPdf( $html );
     }
     else
     {
         $this->render( Helper::CONST_cancel, array(
             'model' => $model,
         ) );
     }
 }
Esempio n. 17
0
    /**
     * Updates a particular model.
     * If update is successful, the browser will be redirected to the 'view' page.
     * @param integer $id the ID of the model to be updated
     */
    public function actionUpdate( $id )
    {
        $model = $this->loadModel( $id );
        $model->scamount = Helper::CONST_Default_SC_Amount;
        $this->performAjaxValidation($model);
        $accoutordersearch = new Order;
        $accoutordersearch->unsetAttributes();
        $accoutordersearch->acnt_no = $model->acnt_no;
        
        if ( isset( $_POST['Account'] ) )
        {
            $this->saveAndRedirect($model);
        }
//        else
//        {
//            if (Yii::app()->request->isAjaxRequest)
//            {
//                echo 'Nothing to save';
//                Yii::app()->end();
//            }
//        }
        $this->render( 'update', array(
                'model' => $model, 'accoutordersearch' => $accoutordersearch,
            ) );
    }
Esempio n. 18
0
 public function actionIndex()
 {
     if (!WebUser::isGuest() && WebUser::isAdmin()) {
         $this->render('index');
     } elseif (!WebUser::isGuest() && WebUser::isKasir()) {
         //inisialisasi model Order
         $order = new Order('search');
         $order->unsetAttributes();
         // clear any default values
         if (isset($_GET['Order'])) {
             $order->attributes = $_GET['Order'];
         }
         $orderbaru = new Order('baru');
         $orderbaru->RESEP = 1;
         $orderbaru->orderdetail = new OrderDetail('baru');
         //inisialisasi model OrderDetail
         $order_detail = new OrderDetail();
         //inisialisasi model Pelanggan
         $pelanggan = new Pasien('search');
         $pelanggan->unsetAttributes();
         // clear any default values
         if (isset($_GET['Pasien'])) {
             $pelanggan->attributes = $_GET['Pasien'];
         }
         $newpl = new Pasien('baru');
         // $newpl->ID_LAYANAN = 1;
         if (isset($_POST['Pasien'])) {
             $newpl->attributes = $_POST['Pasien'];
             //$newpl->BIAYA_REGISTRASI = 5000;
             $newpl->TANGGAL_REGISTRASI = date('Y-m-d H:i:s');
             if ($newpl->save()) {
                 Yii::app()->user->setFlash('info', MyFormatter::alertSuccess('<strong>Selamat!</strong> Data telah berhasil disimpan.'));
                 $this->redirect(array('/site'));
             }
         }
         if (isset($_POST['Order'])) {
             //var_dump($_POST['Order']);
             //die();
             $orderbaru->attributes = $_POST['Order'];
             $orderbaru->TANGGAL_ORDER = date('Y-m-d H:i:s');
             $orderbaru->USER_PEMBUAT = Yii::app()->user->nama;
             if ($orderbaru->save()) {
                 $subtotal = 0;
                 foreach ($_POST['OrderDetail'] as $detail) {
                     //var_dump($_POST['OrderDetail']);
                     //die();
                     $od = new OrderDetail('baru');
                     $od->ID_ITEM = $detail['ID_ITEM'];
                     $od->KODE_ORDER = $orderbaru->KODE_ORDER;
                     //proses harga by resep
                     $od->HARGA = Item::getHargaByResep($detail['ID_ITEM'], $orderbaru->RESEP);
                     $od->JUMLAH = $detail['JUMLAH'];
                     $od->DISKON = $detail['DISKON'];
                     $od->save();
                     Item::updateStokItem($detail['ID_ITEM'], $detail['JUMLAH']);
                     $subtotal += $od->JUMLAH * $od->HARGA;
                 }
                 Yii::app()->user->setFlash('info', MyFormatter::alertSuccess('<strong>Selamat!</strong> Data telah berhasil disimpan.'));
                 $this->redirect(array('/order/view', 'id' => $orderbaru->KODE_ORDER));
             }
             // if ($orderbaru->validate()) {
             //     $transaction = Yii::app()->db->beginTransaction();
             //     try {
             //         if (!$orderbaru->save())
             //             throw new Exception;
             //         $subtotal = 0;
             //         foreach ($_POST['OrderDetail'] as $kd => $detail) {
             //             if (!empty($detail['JUMLAH'])) {
             //                 $od = new OrderDetail('baru');
             //              $od->ID_ITEM = $kd;
             //              $od->KODE_ORDER = $orderbaru->KODE_ORDER;
             //              //proses harga by resep
             //              $od->HARGA = Item::getHargaByResep($kd, $orderbaru->RESEP);
             //              $od->JUMLAH = $detail['JUMLAH'];
             //              //$od->DISKON = $detail['DISKON'];
             //              //$od->DISKON = Barang::getDiskonById($kd);
             //              //var_dump($_POST['OrderDetail']);
             // 	//die();
             //              //update stok barang
             //              Item::updateStokItem($kd, $detail['JUMLAH']);
             //              $subtotal += $od->JUMLAH * $od->HARGA;
             //                 if (!$od->save())
             //                     throw new Exception;
             //             }
             //         }
             //         $transaction->commit();
             //         Yii::app()->user->setFlash('info', MyFormatter::alertSuccess('<strong>Selamat!</strong> Data telah berhasil disimpan.'));
             //         $this->redirect(array('/order/view', 'id' => $orderbaru->KODE_ORDER));
             //     } catch (Exception $ex) {
             //         $transaction->rollback();
             //         echo $ex->getMessage(); exit();
             //     }
             // }
         }
         $criteria = new CDbCriteria();
         $criteria->order = 'TANGGAL_REGISTRASI DESC';
         $dataProvider = new CActiveDataProvider('Pasien', array('criteria' => $criteria, 'pagination' => false));
         $pasien_today = Pasien::listRegisterToday();
         $this->render('index3', array('dataProvider' => $dataProvider, 'order' => $order, 'order_detail' => $order_detail, 'pelanggan' => $pelanggan, 'pelanggan_baru' => $newpl, 'orderbaru' => $orderbaru, 'pasien_today' => $pasien_today));
     } else {
         $this->redirect(array('login'));
     }
 }
Esempio n. 19
0
 /**
  * 
  */
 public function actionUserBoxes($date = null)
 {
     $DeliveryDates = DeliveryDate::model()->findAll();
     if (!$date) {
         $date = DeliveryDate::getCurrentDeliveryDateId();
     }
     $CDD = new Order('search');
     $CDD->unsetAttributes();
     if (isset($_GET['Order'])) {
         $CDD->attributes = $_GET['Order'];
     }
     $CDDsWithExtras = $CDD->extrasSearch($date);
     $SelectedDeliveryDate = DeliveryDate::model()->findByPk($date);
     $UserBoxes = new UserBox('search');
     $UserBoxes->unsetAttributes();
     // clear any default values
     if (isset($_GET['UserBox'])) {
         $UserBoxes->attributes = $_GET['UserBox'];
     }
     $this->render('user_boxes', array('SelectedDeliveryDate' => $SelectedDeliveryDate, 'DeliveryDates' => $DeliveryDates, 'UserBoxes' => $UserBoxes, 'CDDsWithExtras' => $CDDsWithExtras, 'CDD' => $CDD));
 }
Esempio n. 20
0
 public function actionOrders($id = '')
 {
     IsAuth::Customer();
     /* untuk konfirmasi pembayaran */
     if (isset($_GET['confirm'])) {
         /* panggil model Confirmpayment */
         $model = new ConfirmPayment();
         /* jika data Confirmpayment dikirim dengan method POST */
         if (isset($_POST['ConfirmPayment'])) {
             /* set value field */
             $order_code = $_POST['ConfirmPayment']['nomerPemesanan'];
             $model->attributes = $_POST['ConfirmPayment'];
             $model->order_code = $_POST['ConfirmPayment']['nomerPemesanan'];
             $model->text_detail .= $_POST['ConfirmPayment']['bankAsal'] . '#';
             $model->text_detail .= $_POST['ConfirmPayment']['pemilikRekAsal'] . '#';
             $model->text_detail .= $_POST['ConfirmPayment']['bankTujuan'] . '#';
             $model->text_detail .= $_POST['ConfirmPayment']['nominalTransfer'];
             /* jika data confirmpayment disimpan */
             if ($model->save()) {
                 /* find data order by attributes berdasarkan order code */
                 $modelOrder = Order::model()->findByAttributes(array('order_code' => $order_code));
                 /* set field payment_status menjadi 1 
                  * yg artinya telah pembayaran telah dikonfirmasi */
                 $modelOrder->payment_status = 1;
                 /* simpan perubahan */
                 $modelOrder->save();
                 /* setFlash untuk informasi sukses konfirmasi pesanan */
                 Yii::app()->user->setFlash('success', "Your order with order code #" . $order_code . " has been confirmed...");
                 /* direct ke halaman orders */
                 $this->redirect(array('orders'));
                 return;
             }
         }
         /* render ke file account/confirmasi_payment */
         $this->render('confirm_payment', array('model' => $model));
         return;
     }
     /* untuk halaman list data pesanan */
     if (empty($id)) {
         /* panggil model Order dan function search */
         $model = new Order('search');
         // hapus default values pada attributes
         $model->unsetAttributes();
         $model->customer_id = Yii::app()->user->customerId;
         /* jika data order dikirim view get */
         if (isset($_GET['Order'])) {
             /* set attributes untuk pencarian */
             $model->attributes = $_GET['Order'];
         }
         /* render ke file account/list_orders */
         $this->render('list_orders', array('model' => $model));
         return;
     }
     /* untuk detail order */
     if (!empty($id)) {
         /* join query untuk mendapatkan detail order */
         $dataOrderDetail = Yii::app()->db->createCommand()->select('order.*,orderdetail.*,product.*')->from('order')->join('orderdetail', 'orderdetail.order_id = order.order_id')->join('product', 'product.product_id = orderdetail.product_id')->where('order.order_id=:order_id', array(':order_id' => $id))->queryAll();
         /* join query untuk mendapatkan data order 
          * dan customer/pelanggan */
         $dataOrder = Yii::app()->db->createCommand()->select('order.*,customer.customer_name')->from('order')->join('customer', 'order.customer_id = customer.customer_id')->where('order.order_id=:order_id', array(':order_id' => $id))->queryRow();
         /* render ke file account/detail_order */
         $this->render('detail_order', array('dataOrder' => $dataOrder, 'orderDetail' => $dataOrderDetail, 'subtotal' => '', 'grandtotal' => ''));
         return;
     }
 }
Esempio n. 21
0
$this->widget('bootstrap.widgets.TbButton', ['buttonType' => 'submit', 'context' => 'primary', 'label' => $model->getIsNewRecord() ? Yii::t('CouponModule.coupon', 'Add coupon and continue') : Yii::t('CouponModule.coupon', 'Save coupon and continue')]);
?>

        <?php 
$this->widget('bootstrap.widgets.TbButton', ['buttonType' => 'submit', 'htmlOptions' => ['name' => 'submit-type', 'value' => 'index'], 'label' => $model->getIsNewRecord() ? Yii::t('CouponModule.coupon', 'Add coupon and close') : Yii::t('CouponModule.coupon', 'Save coupon and close')]);
?>

        <?php 
$this->endWidget();
?>
    </div>

    <?php 
if (!$model->getIsNewRecord()) {
    ?>
    <div class="tab-pane panel-body" id="history">

        <?php 
    Yii::app()->getModule('order');
    $order = new Order('search');
    $order->unsetAttributes();
    $this->widget('yupe\\widgets\\CustomGridView', ['id' => 'order-grid', 'type' => 'condensed', 'dataProvider' => $order->search($model->id), 'filter' => $order, 'rowCssClassExpression' => '$data->paid == Order::PAID_STATUS_PAID ? "alert-success" : ""', 'ajaxUrl' => Yii::app()->createUrl('/order/orderBackend/index'), 'actionsButtons' => false, 'bulkActions' => [false], 'columns' => [['name' => 'id', 'htmlOptions' => ['width' => '90px'], 'type' => 'raw', 'value' => 'CHtml::link(Yii::t("CouponModule.coupon", "Order #").$data->id, array("/order/orderBackend/update", "id" => $data->id))'], ['name' => 'name', 'type' => 'raw', 'value' => '$data->name . ($data->note ? "<br><div class=\\"note\\">$data->note</div>" : "")', 'htmlOptions' => ['width' => '400px']], 'total_price', ['name' => 'paid', 'value' => '$data->getPaidStatus()', 'filter' => $order->getPaidStatusList()], ['name' => 'date'], ['name' => 'status', 'type' => 'raw', 'value' => function ($data) {
        return $data->status->getTitle();
    }, 'filter' => OrderStatus::model()->getList()]]]);
    ?>
    </div>
    <?php 
}
?>
</div>
Esempio n. 22
0
 /**
  * Manages all models.
  */
 public function actionAdmin($courseId)
 {
     $course = Course::model()->findByPk($courseId);
     $model = new Order('search');
     $model->unsetAttributes();
     // clear any default values
     if (isset($_GET['Order'])) {
         $model->attributes = $_GET['Order'];
     }
     $model->produceEntityId = 153;
     $this->render('admin', array('model' => $model, 'course' => $course));
 }