/** * @param $orderId */ public function actionNewInvoice($orderId) { $order = Order::findOne($orderId); $invoice = new Invoice(['order_id' => $order->id, 'due_amount' => $order->due_amount, 'due_datetime' => (new \DateTime('+10 days'))->format('Y-m-d H:i:s'), 'created' => new Expression('NOW()')]); $invoice->save(); $this->redirect(['order/view', 'orderId' => $orderId]); }
public function actionBankReturn() { /** @var $ecom Component */ $ecom = \Yii::$app->ecom; /** @var $model Order */ $model = $ecom->payment->handleResponse($_REQUEST, Order::className()); $this->redirect(['order/view', 'orderId' => $model->id]); }
/** * @return \yii\db\ActiveRelation */ public function getOrder() { return $this->hasOne(\app\models\ar\Order::className(), ['id' => 'order_id']); }
/** * @return \yii\db\ActiveRelation */ public function getOrders() { return $this->hasMany(\app\models\ar\Order::className(), ['user_id' => 'id']); }